This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
dquote_static.c -> dquote.c
[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 ! -c /dev/null ; then
73         cat <<EOF
74 ***
75 *** I'm sorry, but /dev/null appears to be a file rather than a device.
76 *** Please consult your operating sytem's notes for making a device
77 *** in /dev.
78 *** Cannot continue, aborting.
79 ***
80 EOF
81         exit 1
82 fi
83
84 : compute my invocation name
85 me=$0
86 case "$0" in
87 */*)
88         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
89         test "$me" || me=$0
90         ;;
91 esac
92
93 : Proper separator for the PATH environment variable
94 p_=:
95 : On OS/2 this directory should exist if this is not floppy only system ":-]"
96 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' 2>&1 ) 2>&1 >/dev/null ; then
97         if test -n "$OS2_SHELL"; then
98                 p_=\;
99                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
100                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
101                 is_os2=yes
102         elif test -n "$DJGPP"; then
103                 case "X${MACHTYPE:-nonesuchmach}" in
104                 *cygwin|*msys) ;;
105                 *) p_=\; ;;
106                 esac
107         fi
108 fi
109
110 : Proper PATH setting
111 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
112 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
113 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
114 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
115 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
116 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
117 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
118 paths="$paths /sbin /usr/sbin /usr/libexec"
119 paths="$paths /system/gnu_library/bin"
120
121 for p in $paths
122 do
123         case "$p_$PATH$p_" in
124         *$p_$p$p_*) ;;
125         *) test -d $p && PATH=$PATH$p_$p ;;
126         esac
127 done
128
129 PATH=.$p_$PATH
130 export PATH
131
132 : shall we be using ksh?
133 inksh=''
134 needksh=''
135 avoidksh=''
136 newsh=/bin/ksh
137 changesh=''
138 if (PATH=.; alias -x) >/dev/null 2>&1; then
139                 inksh=true
140 fi
141 if test -f /hp-ux -a -f /bin/ksh; then
142         needksh='to avoid sh bug in "here document" expansion'
143 fi
144 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
145         if test X`/usr/bin/uname -v` = X4; then
146                 avoidksh="to avoid AIX 4's /bin/sh"
147                 newsh=/usr/bin/bsh
148         fi
149 fi
150 if test -f /osf_boot -a -f /usr/sbin/setld; then
151         if test X`/usr/bin/uname -s` = XOSF1; then
152                 avoidksh="to avoid Digital UNIX' ksh"
153                 newsh=/bin/sh
154                 unset BIN_SH
155         fi
156 fi
157 case "$inksh/$needksh" in
158 /[a-z]*)
159                 ENV=''
160                 changesh=true
161                 reason="$needksh"
162         ;;
163 esac
164 case "$inksh/$avoidksh" in
165 true/[a-z]*)
166         changesh=true
167         reason="$avoidksh"
168         ;;
169 esac
170 case "$inksh/$needksh-$avoidksh-" in
171 true/--)
172                 cat <<EOM
173 (I see you are using the Korn shell.  Some ksh's blow up on $me,
174 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
175 EOM
176         ;;
177 esac
178 case "$changesh" in
179 true)
180         export newsh
181         echo "(Feeding myself to $newsh $reason.)"
182         case "$0" in
183         Configure|*/Configure) exec $newsh $0 "$@";;
184         *) exec $newsh Configure "$@";;
185         esac
186         ;;
187 esac
188 test -x "${newsh}" || unset newsh
189
190 : if needed, set CDPATH to a harmless value that is not chatty
191 : avoid bash 2.02 problems with empty CDPATH.
192 case "$CDPATH" in
193 '')     ;;
194 *)      case "$SHELL" in
195         *bash*) CDPATH='.' ;;
196         *) CDPATH='' ;;
197         esac
198         ;;
199 esac
200
201 : Configure runs within the UU subdirectory
202 test -d UU || mkdir UU
203 cd UU && rm -f ./*
204
205 ccname=''
206 ccversion=''
207 ccsymbols=''
208 cppccsymbols=''
209 cppsymbols=''
210 from=''
211 hostgenerate=''
212 hostosname=''
213 hostperl=''
214 run=''
215 targetarch=''
216 targetdir=''
217 targetenv=''
218 targethost=''
219 targetmkdir=''
220 targetport=''
221 to=''
222 usecrosscompile=''
223 extern_C=''
224 mistrustnm=''
225 usedevel=''
226 perllibs=''
227 dynamic_ext=''
228 extensions=''
229 known_extensions=''
230 nonxs_ext=''
231 static_ext=''
232 useopcode=''
233 useposix=''
234 extras=''
235 d_bsd=''
236 d_eunice=''
237 d_xenix=''
238 eunicefix=''
239 ar=''
240 awk=''
241 bash=''
242 bison=''
243 byacc=''
244 cat=''
245 chgrp=''
246 chmod=''
247 chown=''
248 comm=''
249 compress=''
250 cp=''
251 cpio=''
252 cpp=''
253 csh=''
254 date=''
255 echo=''
256 egrep=''
257 emacs=''
258 expr=''
259 find=''
260 flex=''
261 gmake=''
262 grep=''
263 gzip=''
264 inews=''
265 ksh=''
266 less=''
267 line=''
268 lint=''
269 ln=''
270 lp=''
271 lpr=''
272 ls=''
273 mail=''
274 mailx=''
275 make=''
276 mkdir=''
277 more=''
278 mv=''
279 nm=''
280 nroff=''
281 perl=''
282 pg=''
283 pmake=''
284 pr=''
285 rm=''
286 rmail=''
287 sed=''
288 sendmail=''
289 shar=''
290 sleep=''
291 smail=''
292 sort=''
293 submit=''
294 tail=''
295 tar=''
296 tbl=''
297 tee=''
298 test=''
299 touch=''
300 tr=''
301 troff=''
302 uname=''
303 uniq=''
304 uuname=''
305 vi=''
306 zcat=''
307 zip=''
308 full_ar=''
309 full_sed=''
310 libswanted=''
311 hint=''
312 myuname=''
313 osname=''
314 osvers=''
315 Author=''
316 Date=''
317 Header=''
318 Id=''
319 Locker=''
320 Log=''
321 RCSfile=''
322 Revision=''
323 Source=''
324 State=''
325 sysroot=''
326 _a=''
327 _exe=''
328 _o=''
329 archobjs=''
330 exe_ext=''
331 firstmakefile=''
332 lib_ext=''
333 obj_ext=''
334 path_sep=''
335 rm_try=''
336 afs=''
337 afsroot=''
338 alignbytes=''
339 ansi2knr=''
340 archlib=''
341 archlibexp=''
342 d_archlib=''
343 installarchlib=''
344 archname=''
345 myarchname=''
346 useversionedarchname=''
347 d_atolf=''
348 d_atoll=''
349 baserev=''
350 bin=''
351 binexp=''
352 initialinstalllocation=''
353 installbin=''
354 userelocatableinc=''
355 byteorder=''
356 cc=''
357 ccflags=''
358 cppflags=''
359 ldflags=''
360 lkflags=''
361 locincpth=''
362 optimize=''
363 cf_email=''
364 cf_by=''
365 cf_time=''
366 charbits=''
367 charsize=''
368 contains=''
369 cpp_stuff=''
370 cpplast=''
371 cppminus=''
372 cpprun=''
373 cppstdin=''
374 d__fwalk=''
375 d_access=''
376 d_accessx=''
377 d_acosh=''
378 d_aintl=''
379 d_alarm=''
380 asctime_r_proto=''
381 d_asctime_r=''
382 d_asinh=''
383 d_atanh=''
384 d_attribute_deprecated=''
385 d_attribute_format=''
386 d_attribute_malloc=''
387 d_attribute_nonnull=''
388 d_attribute_noreturn=''
389 d_attribute_pure=''
390 d_attribute_unused=''
391 d_attribute_warn_unused_result=''
392 d_printf_format_null=''
393 d_backtrace=''
394 d_bcmp=''
395 d_bcopy=''
396 d_builtin_choose_expr=''
397 d_builtin_expect=''
398 d_bzero=''
399 d_c99_variadic_macros=''
400 d_casti32=''
401 castflags=''
402 d_castneg=''
403 d_cbrt=''
404 d_chown=''
405 d_chroot=''
406 d_chsize=''
407 d_class=''
408 d_clearenv=''
409 d_closedir=''
410 d_void_closedir=''
411 d_cmsghdr_s=''
412 d_const=''
413 d_copysign=''
414 d_copysignl=''
415 d_cplusplus=''
416 cryptlib=''
417 d_crypt=''
418 crypt_r_proto=''
419 d_crypt_r=''
420 d_csh=''
421 full_csh=''
422 d_ctermid=''
423 ctermid_r_proto=''
424 d_ctermid_r=''
425 ctime_r_proto=''
426 d_ctime_r=''
427 d_cuserid=''
428 d_dbl_dig=''
429 d_dbminitproto=''
430 d_difftime=''
431 d_dir_dd_fd=''
432 d_dirfd=''
433 d_dladdr=''
434 d_dlerror=''
435 d_dlopen=''
436 d_dlsymun=''
437 d_dosuid=''
438 d_suidsafe=''
439 d_drand48_r=''
440 drand48_r_proto=''
441 d_drand48proto=''
442 d_dup2=''
443 d_eaccess=''
444 d_endgrent=''
445 d_endgrent_r=''
446 endgrent_r_proto=''
447 d_endhent=''
448 d_endhostent_r=''
449 endhostent_r_proto=''
450 d_endnent=''
451 d_endnetent_r=''
452 endnetent_r_proto=''
453 d_endpent=''
454 d_endprotoent_r=''
455 endprotoent_r_proto=''
456 d_endpwent=''
457 d_endpwent_r=''
458 endpwent_r_proto=''
459 d_endsent=''
460 d_endservent_r=''
461 endservent_r_proto=''
462 d_erf=''
463 d_erfc=''
464 d_exp2=''
465 d_expm1=''
466 d_faststdio=''
467 d_fchdir=''
468 d_fchmod=''
469 d_fchown=''
470 d_fcntl=''
471 d_fcntl_can_lock=''
472 d_fd_macros=''
473 d_fd_set=''
474 d_fds_bits=''
475 d_fdim=''
476 d_fegetround=''
477 d_fgetpos=''
478 d_finite=''
479 d_finitel=''
480 d_flexfnam=''
481 d_flock=''
482 d_flockproto=''
483 d_fma=''
484 d_fmax=''
485 d_fmin=''
486 d_fork=''
487 d_fp_class=''
488 d_fp_classl=''
489 d_fpclass=''
490 d_fp_classify=''
491 d_fpclassify=''
492 d_fpclassl=''
493 d_fpgetround=''
494 d_fpos64_t=''
495 d_frexpl=''
496 d_fs_data_s=''
497 d_fseeko=''
498 d_fsetpos=''
499 d_fstatfs=''
500 d_fsync=''
501 d_ftello=''
502 d_ftime=''
503 d_gettimeod=''
504 d_futimes=''
505 d_Gconvert=''
506 d_getaddrinfo=''
507 d_getcwd=''
508 d_getespwnam=''
509 d_getfsstat=''
510 d_getgrent=''
511 d_getgrent_r=''
512 getgrent_r_proto=''
513 d_getgrgid_r=''
514 getgrgid_r_proto=''
515 d_getgrnam_r=''
516 getgrnam_r_proto=''
517 d_getgrps=''
518 d_gethbyaddr=''
519 d_gethbyname=''
520 d_gethent=''
521 aphostname=''
522 d_gethname=''
523 d_phostname=''
524 d_uname=''
525 d_gethostbyaddr_r=''
526 gethostbyaddr_r_proto=''
527 d_gethostbyname_r=''
528 gethostbyname_r_proto=''
529 d_gethostent_r=''
530 gethostent_r_proto=''
531 d_gethostprotos=''
532 d_getitimer=''
533 d_getlogin=''
534 d_getlogin_r=''
535 getlogin_r_proto=''
536 d_getmnt=''
537 d_getmntent=''
538 d_getnameinfo=''
539 d_getnbyaddr=''
540 d_getnbyname=''
541 d_getnent=''
542 d_getnetbyaddr_r=''
543 getnetbyaddr_r_proto=''
544 d_getnetbyname_r=''
545 getnetbyname_r_proto=''
546 d_getnetent_r=''
547 getnetent_r_proto=''
548 d_getnetprotos=''
549 d_getpagsz=''
550 d_getpent=''
551 d_getpgid=''
552 d_getpgrp2=''
553 d_bsdgetpgrp=''
554 d_getpgrp=''
555 d_getppid=''
556 d_getprior=''
557 d_getpbyname=''
558 d_getpbynumber=''
559 d_getprotobyname_r=''
560 getprotobyname_r_proto=''
561 d_getprotobynumber_r=''
562 getprotobynumber_r_proto=''
563 d_getprotoent_r=''
564 getprotoent_r_proto=''
565 d_getprotoprotos=''
566 d_getprpwnam=''
567 d_getpwent=''
568 d_getpwent_r=''
569 getpwent_r_proto=''
570 d_getpwnam_r=''
571 getpwnam_r_proto=''
572 d_getpwuid_r=''
573 getpwuid_r_proto=''
574 d_getsent=''
575 d_getservbyname_r=''
576 getservbyname_r_proto=''
577 d_getservbyport_r=''
578 getservbyport_r_proto=''
579 d_getservent_r=''
580 getservent_r_proto=''
581 d_getservprotos=''
582 d_getspnam=''
583 d_getspnam_r=''
584 getspnam_r_proto=''
585 d_getsbyname=''
586 d_getsbyport=''
587 d_gmtime_r=''
588 gmtime_r_proto=''
589 d_gnulibc=''
590 gnulibc_version=''
591 d_hasmntopt=''
592 d_htonl=''
593 d_hypot=''
594 d_ilogb=''
595 d_ilogbl=''
596 d_inetaton=''
597 d_inetntop=''
598 d_inetpton=''
599 d_int64_t=''
600 d_isascii=''
601 d_isblank=''
602 d_isfinite=''
603 d_isfinitel=''
604 d_isinf=''
605 d_isinfl=''
606 d_isless=''
607 d_isnan=''
608 d_isnanl=''
609 d_isnormal=''
610 d_j0=''
611 d_j0l=''
612 d_killpg=''
613 d_lc_monetary_2008=''
614 d_lchown=''
615 d_ldbl_dig=''
616 d_lgamma=''
617 d_lgamma_r=''
618 d_libm_lib_version=''
619 d_link=''
620 d_llrint=''
621 d_llrintl=''
622 d_llround=''
623 d_llroundl=''
624 d_localtime_r=''
625 d_localtime_r_needs_tzset=''
626 localtime_r_proto=''
627 d_locconv=''
628 d_lockf=''
629 d_log1p=''
630 d_log2=''
631 d_logb=''
632 d_ldexpl=''
633 d_longdbl=''
634 longdblkind=''
635 longdblsize=''
636 d_longlong=''
637 longlongsize=''
638 d_lrint=''
639 d_lrintl=''
640 d_lround=''
641 d_lroundl=''
642 d_lseekproto=''
643 d_lstat=''
644 d_madvise=''
645 d_malloc_good_size=''
646 d_malloc_size=''
647 d_mblen=''
648 d_mbstowcs=''
649 d_mbtowc=''
650 d_memchr=''
651 d_memcmp=''
652 d_memcpy=''
653 d_memmove=''
654 d_memset=''
655 d_mkdir=''
656 d_mkdtemp=''
657 d_mkfifo=''
658 d_mkstemp=''
659 d_mkstemps=''
660 d_mktime=''
661 d_mmap=''
662 mmaptype=''
663 d_modfl=''
664 d_modfl_pow32_bug=''
665 d_modflproto=''
666 d_mprotect=''
667 d_msg=''
668 d_msgctl=''
669 d_msgget=''
670 d_msghdr_s=''
671 d_msgrcv=''
672 d_msgsnd=''
673 d_msync=''
674 d_munmap=''
675 d_nan=''
676 d_nearbyint=''
677 d_nextafter=''
678 d_nexttoward=''
679 d_nice=''
680 d_nl_langinfo=''
681 d_off64_t=''
682 d_open3=''
683 d_fpathconf=''
684 d_pathconf=''
685 d_pause=''
686 d_pipe=''
687 d_poll=''
688 d_portable=''
689 d_prctl=''
690 d_prctl_set_name=''
691 d_procselfexe=''
692 procselfexe=''
693 d_old_pthread_create_joinable=''
694 old_pthread_create_joinable=''
695 d_pthread_atfork=''
696 d_pthread_attr_setscope=''
697 d_pthread_yield=''
698 d_sched_yield=''
699 sched_yield=''
700 d_ptrdiff_t=''
701 d_qgcvt=''
702 d_random_r=''
703 random_r_proto=''
704 d_readdir64_r=''
705 readdir64_r_proto=''
706 d_readdir=''
707 d_rewinddir=''
708 d_seekdir=''
709 d_telldir=''
710 d_readdir_r=''
711 readdir_r_proto=''
712 d_readlink=''
713 d_readv=''
714 d_recvmsg=''
715 d_re_comp=''
716 d_regcmp=''
717 d_regcomp=''
718 d_remainder=''
719 d_remquo=''
720 d_rename=''
721 d_rint=''
722 d_rmdir=''
723 d_round=''
724 d_safebcpy=''
725 d_safemcpy=''
726 d_sanemcmp=''
727 d_sbrkproto=''
728 d_scalbn=''
729 d_scalbnl=''
730 d_select=''
731 d_sem=''
732 d_semctl=''
733 d_semget=''
734 d_semop=''
735 d_sendmsg=''
736 d_setegid=''
737 d_seteuid=''
738 d_setgrent=''
739 d_setgrent_r=''
740 setgrent_r_proto=''
741 d_setgrps=''
742 d_sethent=''
743 d_sethostent_r=''
744 sethostent_r_proto=''
745 d_setitimer=''
746 d_setlinebuf=''
747 d_setlocale=''
748 d_setlocale_r=''
749 setlocale_r_proto=''
750 d_setnent=''
751 d_setnetent_r=''
752 setnetent_r_proto=''
753 d_setpent=''
754 d_setpgid=''
755 d_setpgrp2=''
756 d_bsdsetpgrp=''
757 d_setpgrp=''
758 d_setprior=''
759 d_setproctitle=''
760 d_setprotoent_r=''
761 setprotoent_r_proto=''
762 d_setpwent=''
763 d_setpwent_r=''
764 setpwent_r_proto=''
765 d_setregid=''
766 d_setresgid=''
767 d_setresuid=''
768 d_setreuid=''
769 d_setrgid=''
770 d_setruid=''
771 d_setsent=''
772 d_setservent_r=''
773 setservent_r_proto=''
774 d_setsid=''
775 d_setvbuf=''
776 d_shm=''
777 d_shmat=''
778 d_shmatprototype=''
779 shmattype=''
780 d_shmctl=''
781 d_shmdt=''
782 d_shmget=''
783 d_sigaction=''
784 d_signbit=''
785 d_sigprocmask=''
786 d_sigsetjmp=''
787 usesitecustomize=''
788 d_snprintf=''
789 d_vsnprintf=''
790 d_sockatmark=''
791 d_sockatmarkproto=''
792 d_ip_mreq=''
793 d_ip_mreq_source=''
794 d_ipv6_mreq=''
795 d_ipv6_mreq_source=''
796 d_msg_ctrunc=''
797 d_msg_dontroute=''
798 d_msg_oob=''
799 d_msg_peek=''
800 d_msg_proxy=''
801 d_oldsock=''
802 d_scm_rights=''
803 d_sin6_scope_id=''
804 d_sockaddr_in6=''
805 d_sockaddr_sa_len=''
806 d_socket=''
807 d_sockpair=''
808 sockethdr=''
809 socketlib=''
810 d_socklen_t=''
811 d_socks5_init=''
812 d_sprintf_returns_strlen=''
813 d_sqrtl=''
814 d_srand48_r=''
815 srand48_r_proto=''
816 d_srandom_r=''
817 srandom_r_proto=''
818 d_sresgproto=''
819 d_sresuproto=''
820 d_stat=''
821 d_statblks=''
822 d_statfs_f_flags=''
823 d_statfs_s=''
824 d_static_inline=''
825 perl_static_inline=''
826 d_fstatvfs=''
827 d_statvfs=''
828 d_stdio_cnt_lval=''
829 d_stdio_ptr_lval=''
830 d_stdio_ptr_lval_nochange_cnt=''
831 d_stdio_ptr_lval_sets_cnt=''
832 d_stdiobase=''
833 d_stdstdio=''
834 stdio_base=''
835 stdio_bufsiz=''
836 stdio_cnt=''
837 stdio_filbuf=''
838 stdio_ptr=''
839 d_index=''
840 d_strchr=''
841 d_strcoll=''
842 d_strctcpy=''
843 d_strerrm=''
844 d_strerror=''
845 d_sysernlst=''
846 d_syserrlst=''
847 d_strerror_r=''
848 strerror_r_proto=''
849 d_strftime=''
850 d_strlcat=''
851 d_strlcpy=''
852 d_strtod=''
853 d_strtol=''
854 d_strtold=''
855 d_strtoll=''
856 d_strtoq=''
857 d_strtoul=''
858 d_strtoull=''
859 d_strtouq=''
860 d_strxfrm=''
861 d_symlink=''
862 d_syscall=''
863 d_syscallproto=''
864 d_sysconf=''
865 d_system=''
866 d_tcgetpgrp=''
867 d_tcsetpgrp=''
868 d_telldirproto=''
869 d_tgamma=''
870 d_time=''
871 timetype=''
872 d_asctime64=''
873 d_ctime64=''
874 d_difftime64=''
875 d_gmtime64=''
876 d_localtime64=''
877 d_mktime64=''
878 d_timegm=''
879 clocktype=''
880 d_times=''
881 d_tmpnam_r=''
882 tmpnam_r_proto=''
883 d_trunc=''
884 d_truncate=''
885 d_truncl=''
886 d_ttyname_r=''
887 ttyname_r_proto=''
888 d_tzname=''
889 d_u32align=''
890 d_ualarm=''
891 d_umask=''
892 d_semctl_semid_ds=''
893 d_semctl_semun=''
894 d_union_semun=''
895 d_unordered=''
896 d_unsetenv=''
897 d_usleep=''
898 d_usleepproto=''
899 d_ustat=''
900 d_pseudofork=''
901 d_vfork=''
902 usevfork=''
903 d_voidsig=''
904 signal_t=''
905 d_volatile=''
906 d_charvspr=''
907 d_vprintf=''
908 d_wait4=''
909 d_waitpid=''
910 d_wcscmp=''
911 d_wcstombs=''
912 d_wcsxfrm=''
913 d_wctomb=''
914 d_writev=''
915 dlext=''
916 bin_ELF=''
917 cccdlflags=''
918 ccdlflags=''
919 dlsrc=''
920 ld=''
921 ld_can_script=''
922 lddlflags=''
923 usedl=''
924 doublesize=''
925 ebcdic=''
926 fflushNULL=''
927 fflushall=''
928 fpossize=''
929 fpostype=''
930 gccansipedantic=''
931 gccosandvers=''
932 gccversion=''
933 gidformat=''
934 gidsign=''
935 gidsize=''
936 gidtype=''
937 groupstype=''
938 h_fcntl=''
939 h_sysfile=''
940 html1dir=''
941 html1direxp=''
942 installhtml1dir=''
943 html3dir=''
944 html3direxp=''
945 installhtml3dir=''
946 i_arpainet=''
947 i_assert=''
948 i_bfd=''
949 i_crypt=''
950 db_hashtype=''
951 db_prefixtype=''
952 db_version_major=''
953 db_version_minor=''
954 db_version_patch=''
955 i_db=''
956 i_dbm=''
957 i_rpcsvcdbm=''
958 d_dirnamlen=''
959 direntrytype=''
960 i_dirent=''
961 i_dlfcn=''
962 i_execinfo=''
963 i_fcntl=''
964 i_fenv=''
965 i_float=''
966 i_fp=''
967 i_fp_class=''
968 i_gdbm=''
969 d_grpasswd=''
970 i_grp=''
971 i_ieeefp=''
972 i_inttypes=''
973 i_langinfo=''
974 i_libutil=''
975 i_limits=''
976 i_locale=''
977 i_machcthr=''
978 i_malloc=''
979 i_mallocmalloc=''
980 i_math=''
981 i_memory=''
982 i_mntent=''
983 d_gdbm_ndbm_h_uses_prototypes=''
984 d_gdbmndbm_h_uses_prototypes=''
985 d_ndbm=''
986 d_ndbm_h_uses_prototypes=''
987 i_gdbm_ndbm=''
988 i_gdbmndbm=''
989 i_ndbm=''
990 i_netdb=''
991 i_neterrno=''
992 i_netinettcp=''
993 i_niin=''
994 i_sysin=''
995 i_poll=''
996 i_prot=''
997 i_pthread=''
998 d_pwage=''
999 d_pwchange=''
1000 d_pwclass=''
1001 d_pwcomment=''
1002 d_pwexpire=''
1003 d_pwgecos=''
1004 d_pwpasswd=''
1005 d_pwquota=''
1006 i_pwd=''
1007 i_quadmath=''
1008 i_shadow=''
1009 i_socks=''
1010 i_stdbool=''
1011 i_stddef=''
1012 i_stdint=''
1013 i_stdlib=''
1014 i_string=''
1015 strings=''
1016 i_sunmath=''
1017 i_sysaccess=''
1018 i_sysdir=''
1019 i_sysfile=''
1020 d_voidtty=''
1021 i_bsdioctl=''
1022 i_sysfilio=''
1023 i_sysioctl=''
1024 i_syssockio=''
1025 i_syslog=''
1026 i_sysmman=''
1027 i_sysmode=''
1028 i_sysmount=''
1029 i_sysndir=''
1030 i_sysparam=''
1031 i_syspoll=''
1032 i_sysresrc=''
1033 i_syssecrt=''
1034 i_sysselct=''
1035 i_sysstat=''
1036 i_sysstatfs=''
1037 i_sysstatvfs=''
1038 i_systimes=''
1039 i_systypes=''
1040 i_sysuio=''
1041 i_sysun=''
1042 i_sysutsname=''
1043 i_sysvfs=''
1044 i_syswait=''
1045 i_sgtty=''
1046 i_termio=''
1047 i_termios=''
1048 d_tm_tm_gmtoff=''
1049 d_tm_tm_zone=''
1050 i_systime=''
1051 i_systimek=''
1052 i_time=''
1053 timeincl=''
1054 i_unistd=''
1055 i_ustat=''
1056 i_utime=''
1057 i_values=''
1058 i_stdarg=''
1059 i_varargs=''
1060 i_varhdr=''
1061 i_vfork=''
1062 d_inc_version_list=''
1063 inc_version_list=''
1064 inc_version_list_init=''
1065 doubleinfbytes=''
1066 doublenanbytes=''
1067 longdblinfbytes=''
1068 longdblnanbytes=''
1069 installprefix=''
1070 installprefixexp=''
1071 installstyle=''
1072 installusrbinperl=''
1073 intsize=''
1074 longsize=''
1075 shortsize=''
1076 issymlink=''
1077 libc=''
1078 ldlibpthname=''
1079 libperl=''
1080 shrpenv=''
1081 useshrplib=''
1082 glibpth=''
1083 incpth=''
1084 libpth=''
1085 loclibpth=''
1086 plibpth=''
1087 xlibpth=''
1088 ignore_versioned_solibs=''
1089 libs=''
1090 libsdirs=''
1091 libsfiles=''
1092 libsfound=''
1093 libspath=''
1094 lns=''
1095 d_PRIEUldbl=''
1096 d_PRIFUldbl=''
1097 d_PRIGUldbl=''
1098 d_PRIeldbl=''
1099 d_PRIfldbl=''
1100 d_PRIgldbl=''
1101 d_SCNfldbl=''
1102 doublekind=''
1103 sPRIEUldbl=''
1104 sPRIFUldbl=''
1105 sPRIGUldbl=''
1106 sPRIeldbl=''
1107 sPRIfldbl=''
1108 sPRIgldbl=''
1109 sSCNfldbl=''
1110 lseeksize=''
1111 lseektype=''
1112 make_set_make=''
1113 d_mymalloc=''
1114 freetype=''
1115 mallocobj=''
1116 mallocsrc=''
1117 malloctype=''
1118 usemallocwrap=''
1119 usemymalloc=''
1120 installman1dir=''
1121 man1dir=''
1122 man1direxp=''
1123 man1ext=''
1124 installman3dir=''
1125 man3dir=''
1126 man3direxp=''
1127 man3ext=''
1128 doublemantbits=''
1129 longdblmantbits=''
1130 nvmantbits=''
1131 modetype=''
1132 multiarch=''
1133 mydomain=''
1134 myhostname=''
1135 phostname=''
1136 c=''
1137 n=''
1138 d_eofnblk=''
1139 eagain=''
1140 o_nonblock=''
1141 rd_nodata=''
1142 need_va_copy=''
1143 netdb_hlen_type=''
1144 netdb_host_type=''
1145 netdb_name_type=''
1146 netdb_net_type=''
1147 groupcat=''
1148 hostcat=''
1149 passcat=''
1150 orderlib=''
1151 ranlib=''
1152 d_perl_otherlibdirs=''
1153 otherlibdirs=''
1154 package=''
1155 spackage=''
1156 pager=''
1157 api_revision=''
1158 api_subversion=''
1159 api_version=''
1160 api_versionstring=''
1161 patchlevel=''
1162 perl_patchlevel=''
1163 revision=''
1164 subversion=''
1165 version=''
1166 version_patchlevel_string=''
1167 perl5=''
1168 perladmin=''
1169 perlpath=''
1170 d_nv_preserves_uv=''
1171 d_nv_zero_is_allbits_zero=''
1172 i16size=''
1173 i16type=''
1174 i32size=''
1175 i32type=''
1176 i64size=''
1177 i64type=''
1178 i8size=''
1179 i8type=''
1180 ivsize=''
1181 ivtype=''
1182 nv_overflows_integers_at=''
1183 nv_preserves_uv_bits=''
1184 nvsize=''
1185 nvtype=''
1186 u16size=''
1187 u16type=''
1188 u32size=''
1189 u32type=''
1190 u64size=''
1191 u64type=''
1192 u8size=''
1193 u8type=''
1194 uvsize=''
1195 uvtype=''
1196 ivdformat=''
1197 nvEUformat=''
1198 nvFUformat=''
1199 nvGUformat=''
1200 nveformat=''
1201 nvfformat=''
1202 nvgformat=''
1203 uvXUformat=''
1204 uvoformat=''
1205 uvuformat=''
1206 uvxformat=''
1207 pidtype=''
1208 prefix=''
1209 prefixexp=''
1210 installprivlib=''
1211 privlib=''
1212 privlibexp=''
1213 prototype=''
1214 ptrsize=''
1215 d_PRIXU64=''
1216 d_PRId64=''
1217 d_PRIi64=''
1218 d_PRIo64=''
1219 d_PRIu64=''
1220 d_PRIx64=''
1221 sPRIXU64=''
1222 sPRId64=''
1223 sPRIi64=''
1224 sPRIo64=''
1225 sPRIu64=''
1226 sPRIx64=''
1227 d_quad=''
1228 quadkind=''
1229 quadtype=''
1230 uquadtype=''
1231 drand01=''
1232 randbits=''
1233 randfunc=''
1234 randseedtype=''
1235 seedfunc=''
1236 installscript=''
1237 scriptdir=''
1238 scriptdirexp=''
1239 selectminbits=''
1240 selecttype=''
1241 sh=''
1242 targetsh=''
1243 sig_count=''
1244 sig_name=''
1245 sig_name_init=''
1246 sig_num=''
1247 sig_num_init=''
1248 sig_size=''
1249 d_sitearch=''
1250 installsitearch=''
1251 sitearch=''
1252 sitearchexp=''
1253 installsitebin=''
1254 sitebin=''
1255 sitebinexp=''
1256 installsitehtml1dir=''
1257 sitehtml1dir=''
1258 sitehtml1direxp=''
1259 installsitehtml3dir=''
1260 sitehtml3dir=''
1261 sitehtml3direxp=''
1262 installsitelib=''
1263 sitelib=''
1264 sitelib_stem=''
1265 sitelibexp=''
1266 installsiteman1dir=''
1267 siteman1dir=''
1268 siteman1direxp=''
1269 installsiteman3dir=''
1270 siteman3dir=''
1271 siteman3direxp=''
1272 siteprefix=''
1273 siteprefixexp=''
1274 installsitescript=''
1275 sitescript=''
1276 sitescriptexp=''
1277 sizesize=''
1278 sizetype=''
1279 d_libname_unique=''
1280 so=''
1281 socksizetype=''
1282 sharpbang=''
1283 shsharp=''
1284 spitshell=''
1285 src=''
1286 ssizetype=''
1287 st_ino_sign=''
1288 st_ino_size=''
1289 startperl=''
1290 startsh=''
1291 stdchar=''
1292 d_stdio_stream_array=''
1293 stdio_stream_array=''
1294 sysman=''
1295 sGMTIME_max=''
1296 sGMTIME_min=''
1297 sLOCALTIME_max=''
1298 sLOCALTIME_min=''
1299 trnl=''
1300 uidformat=''
1301 uidsign=''
1302 uidsize=''
1303 uidtype=''
1304 archname64=''
1305 use64bitall=''
1306 use64bitint=''
1307 usecbacktrace=''
1308 dtrace=''
1309 usedtrace=''
1310 usefaststdio=''
1311 usekernprocpathname=''
1312 ccflags_uselargefiles=''
1313 ldflags_uselargefiles=''
1314 libswanted_uselargefiles=''
1315 uselargefiles=''
1316 uselongdouble=''
1317 usemorebits=''
1318 usemultiplicity=''
1319 nm_opt=''
1320 nm_so_opt=''
1321 runnm=''
1322 usenm=''
1323 usensgetexecutablepath=''
1324 useperlio=''
1325 usequadmath=''
1326 usesocks=''
1327 d_oldpthreads=''
1328 use5005threads=''
1329 useithreads=''
1330 usereentrant=''
1331 usethreads=''
1332 incpath=''
1333 mips_type=''
1334 usrinc=''
1335 vaproto=''
1336 d_vendorarch=''
1337 installvendorarch=''
1338 vendorarch=''
1339 vendorarchexp=''
1340 d_vendorbin=''
1341 installvendorbin=''
1342 vendorbin=''
1343 vendorbinexp=''
1344 installvendorhtml1dir=''
1345 vendorhtml1dir=''
1346 vendorhtml1direxp=''
1347 installvendorhtml3dir=''
1348 vendorhtml3dir=''
1349 vendorhtml3direxp=''
1350 d_vendorlib=''
1351 installvendorlib=''
1352 vendorlib=''
1353 vendorlib_stem=''
1354 vendorlibexp=''
1355 installvendorman1dir=''
1356 vendorman1dir=''
1357 vendorman1direxp=''
1358 installvendorman3dir=''
1359 vendorman3dir=''
1360 vendorman3direxp=''
1361 usevendorprefix=''
1362 vendorprefix=''
1363 vendorprefixexp=''
1364 d_vendorscript=''
1365 installvendorscript=''
1366 vendorscript=''
1367 vendorscriptexp=''
1368 versiononly=''
1369 yacc=''
1370 yaccflags=''
1371 CONFIG=''
1372
1373 : Detect odd OSs
1374 define='define'
1375 undef='undef'
1376 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1377 rmlist=''
1378
1379 : We must find out about Eunice early
1380 eunicefix=':'
1381 if test -f /etc/unixtovms; then
1382         eunicefix=/etc/unixtovms
1383 fi
1384 if test -f /etc/unixtovms.exe; then
1385         eunicefix=/etc/unixtovms.exe
1386 fi
1387
1388 : Set executable suffix now -- needed before hints available
1389 if test -f "/libs/version.library"; then
1390 : Amiga OS
1391     _exe=""
1392 elif test -f "/system/gnu_library/bin/ar.pm"; then
1393 : Stratus VOS
1394     _exe=".pm"
1395 elif test -n "$DJGPP"; then
1396 : DOS DJGPP
1397     _exe=".exe"
1398 elif test -f /kern/cookiejar; then
1399 : MiNT
1400     _exe=""
1401 elif test -d c:/. -o -n "$is_os2" ; then
1402 : OS/2 or cygwin
1403     _exe=".exe"
1404 fi
1405
1406 groupstype=''
1407 i_whoami=''
1408 : Trailing extension.  Override this in a hint file, if needed.
1409 : Extra object files, if any, needed on this platform.
1410 archobjs=''
1411 archname=''
1412 : Possible local include directories to search.
1413 : Set locincpth to "" in a hint file to defeat local include searches.
1414 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1415 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1416 :
1417 : no include file wanted by default
1418 inclwanted=''
1419
1420 : Enable -DEBUGGING and -DDEBUGGING from the command line
1421 EBUGGING=''
1422 DEBUGGING=''
1423
1424 libnames=''
1425 : change the next line if compiling for Xenix/286 on Xenix/386
1426 xlibpth='/usr/lib/386 /lib/386'
1427 : Possible local library directories to search.
1428 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1429 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1430
1431 : general looking path for locating libraries
1432 glibpth="/lib /usr/lib $xlibpth"
1433 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1434 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1435 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1436 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1437
1438 : Private path used by Configure to find libraries.  Its value
1439 : is prepended to libpth. This variable takes care of special
1440 : machines, like the mips.  Usually, it should be empty.
1441 plibpth=''
1442
1443 : default library list
1444 libswanted=''
1445 : some systems want to use only the non-versioned libso:s
1446 ignore_versioned_solibs=''
1447 : set usethreads on the Configure command line to enable threads.
1448 usereentrant='undef'
1449 ccname=''
1450 ccversion=''
1451 perllibs=''
1452 : set useposix=false in your hint file to disable the POSIX extension.
1453 useposix=true
1454 : set useopcode=false in your hint file to disable the Opcode extension.
1455 useopcode=true
1456 archname64=''
1457 ccflags_uselargefiles=''
1458 ldflags_uselargefiles=''
1459 libswanted_uselargefiles=''
1460 : set usemultiplicity on the Configure command line to enable multiplicity.
1461 : set usesocks on the Configure command line to enable socks.
1462 : List of libraries we want.
1463 : If anyone needs extra -lxxx, put those in a hint file.
1464 libswanted="cl pthread socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld"
1465 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1466 : We probably want to search /usr/shlib before most other libraries.
1467 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1468 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1469 glibpth="/usr/shlib $glibpth"
1470 : Do not use vfork unless overridden by a hint file.
1471 usevfork=false
1472
1473 : Find the basic shell for Bourne shell scripts
1474 case "$sh" in
1475 '')
1476         case "$SYSTYPE" in
1477         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1478         *) xxx='/bin/sh';;
1479         esac
1480         if test -f "$xxx"; then
1481                 sh="$xxx"
1482         else
1483                 : Build up a list and do a single loop so we can 'break' out.
1484                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1485                 for xxx in sh bash ksh pdksh ash; do
1486                         for p in $pth; do
1487                                 try="$try ${p}/${xxx}"
1488                         done
1489                 done
1490                 for xxx in $try; do
1491                         if test -f "$xxx"; then
1492                                 sh="$xxx";
1493                                 break
1494                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1495                                 sh="$xxx";
1496                                 break
1497                         elif test -f "$xxx.exe"; then
1498                                 sh="$xxx";
1499                                 break
1500                         fi
1501                 done
1502         fi
1503         ;;
1504 esac
1505
1506 case "$sh" in
1507 '')     cat >&2 <<EOM
1508 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1509
1510 Usually it's in /bin/sh.  How did you even get this far?
1511 Please contact me (Perl Maintainers) at perlbug@perl.org and
1512 we'll try to straighten this all out.
1513 EOM
1514         exit 1
1515         ;;
1516 esac
1517
1518 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1519 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1520 targetsh=$sh
1521
1522 : see if sh knows # comments
1523 if `$sh -c '#' >/dev/null 2>&1`; then
1524         shsharp=true
1525         spitshell=cat
1526         xcat=/bin/cat
1527         test -f $xcat$_exe || xcat=/usr/bin/cat
1528         if test ! -f $xcat$_exe; then
1529                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1530                         if test -f $p/cat$_exe; then
1531                                 xcat=$p/cat
1532                                 break
1533                         fi
1534                 done
1535                 if test ! -f $xcat$_exe; then
1536                         echo "Can't find cat anywhere!"
1537                         exit 1
1538                 fi
1539         fi
1540         echo "#!$xcat" >sharp
1541         $eunicefix sharp
1542         chmod +x sharp
1543         ./sharp > today 2>/dev/null
1544         if test -s today; then
1545                 sharpbang='#!'
1546         else
1547                 echo "#! $xcat" > sharp
1548                 $eunicefix sharp
1549                 chmod +x sharp
1550                 ./sharp > today 2>/dev/null
1551                 if test -s today; then
1552                         sharpbang='#! '
1553                 else
1554                         sharpbang=': use '
1555                 fi
1556         fi
1557 else
1558         echo " "
1559         echo "Your $sh doesn't grok # comments--I will strip them later on."
1560         shsharp=false
1561         cd ..
1562         echo "exec grep -v '^[  ]*#'" >spitshell
1563         chmod +x spitshell
1564         $eunicefix spitshell
1565         spitshell=`pwd`/spitshell
1566         cd UU
1567         echo "I presume that if # doesn't work, #! won't work either!"
1568         sharpbang=': use '
1569 fi
1570 rm -f sharp today
1571
1572 : figure out how to guarantee sh startup
1573 case "$startsh" in
1574 '') startsh=${sharpbang}${sh} ;;
1575 *)
1576 esac
1577 cat >sharp <<EOSS
1578 $startsh
1579 set abc
1580 test "$?abc" != 1
1581 EOSS
1582
1583 chmod +x sharp
1584 $eunicefix sharp
1585 if ./sharp; then
1586         : echo "Yup, it does."
1587 else
1588         echo "Hmm... '$startsh' does not guarantee sh startup..."
1589         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1590 fi
1591 rm -f sharp
1592
1593 : Save command line options in file UU/cmdline.opt for later use in
1594 : generating config.sh.
1595 cat > cmdline.opt <<EOSH
1596 : Configure command line arguments.
1597 config_arg0='$0'
1598 config_args='$*'
1599 config_argc=$#
1600 EOSH
1601 argn=1
1602 args_exp=''
1603 args_sep=''
1604 for arg in "$@"; do
1605         cat >>cmdline.opt <<EOSH
1606 config_arg$argn='$arg'
1607 EOSH
1608         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1609 $arg
1610 EOC
1611         arg_exp=`cat cmdl.opt`
1612         args_exp="$args_exp$args_sep'$arg_exp'"
1613         argn=`expr $argn + 1`
1614         args_sep=' '
1615 done
1616 rm -f cmdl.opt
1617
1618 : produce awk script to parse command line options
1619 cat >options.awk <<'EOF'
1620 BEGIN {
1621         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1622
1623         len = length(optstr);
1624         for (i = 1; i <= len; i++) {
1625                 c = substr(optstr, i, 1);
1626                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1627                 if (a == ":") {
1628                         arg[c] = 1;
1629                         i++;
1630                 }
1631                 opt[c] = 1;
1632         }
1633 }
1634 {
1635         expect = 0;
1636         str = $0;
1637         if (substr(str, 1, 1) != "-") {
1638                 printf("'%s'\n", str);
1639                 next;
1640         }
1641         len = length($0);
1642         for (i = 2; i <= len; i++) {
1643                 c = substr(str, i, 1);
1644                 if (!opt[c]) {
1645                         printf("-%s\n", substr(str, i));
1646                         next;
1647                 }
1648                 printf("-%s\n", c);
1649                 if (arg[c]) {
1650                         if (i < len)
1651                                 printf("'%s'\n", substr(str, i + 1));
1652                         else
1653                                 expect = 1;
1654                         next;
1655                 }
1656         }
1657 }
1658 END {
1659         if (expect)
1660                 print "?";
1661 }
1662 EOF
1663
1664 : process the command line options
1665 set X `for arg in "$@"; do echo "X$arg"; done |
1666         sed -e s/X// | awk -f options.awk`
1667 eval "set $*"
1668 shift
1669 rm -f options.awk
1670
1671 : set up default values
1672 fastread=''
1673 reuseval=false
1674 config_sh=''
1675 alldone=''
1676 error=''
1677 silent=''
1678 extractsh=''
1679 override=''
1680 knowitall=''
1681 rm -f optdef.sh posthint.sh
1682 cat >optdef.sh <<EOS
1683 $startsh
1684 EOS
1685
1686
1687 : option parsing
1688 while test $# -gt 0; do
1689         case "$1" in
1690         -d) shift; fastread=yes;;
1691         -e) shift; alldone=cont;;
1692         -f)
1693                 shift
1694                 cd ..
1695                 if test -r "$1"; then
1696                         config_sh="$1"
1697                 else
1698                         echo "$me: cannot read config file $1." >&2
1699                         error=true
1700                 fi
1701                 cd UU
1702                 shift;;
1703         --help|\
1704         -h) shift; error=true;;
1705         -r) shift; reuseval=true;;
1706         -s) shift; silent=true; realsilent=true;;
1707         -E) shift; alldone=exit;;
1708         -K) shift; knowitall=true;;
1709         -O) shift; override=true;;
1710         -S) shift; silent=true; extractsh=true;;
1711         -D)
1712                 shift
1713                 case "$1" in
1714                 *=)
1715                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1716                         echo "$me: ignoring -D $1" >&2
1717                         ;;
1718                 *=*) echo "$1" | \
1719                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1720                 *) echo "$1='define'" >> optdef.sh;;
1721                 esac
1722                 shift
1723                 ;;
1724         -U)
1725                 shift
1726                 case "$1" in
1727                 *=) echo "$1" >> optdef.sh;;
1728                 *=*)
1729                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1730                         echo "$me: ignoring -U $1" >&2
1731                         ;;
1732                 *) echo "$1='undef'" >> optdef.sh;;
1733                 esac
1734                 shift
1735                 ;;
1736         -A)
1737             shift
1738             xxx=''
1739             yyy="$1"
1740             zzz=''
1741             uuu=undef
1742             case "$yyy" in
1743             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1744                  case "$zzz" in
1745                  *:*) zzz='' ;;
1746                  *)   xxx=append
1747                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1748                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1749                  esac
1750                  ;;
1751             esac
1752             case "$xxx" in
1753             '')  case "$yyy" in
1754                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1755                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1756                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1757                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1758                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1759                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1760                  esac
1761                  ;;
1762             esac
1763             case "$xxx" in
1764             append)
1765                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1766             clear)
1767                 echo "$yyy=''"                  >> posthint.sh ;;
1768             define)
1769                 case "$zzz" in
1770                 '') zzz=define ;;
1771                 esac
1772                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1773             eval)
1774                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1775             prepend)
1776                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1777             undef)
1778                 case "$zzz" in
1779                 '') zzz="$uuu" ;;
1780                 esac
1781                 echo "$yyy=$zzz"                >> posthint.sh ;;
1782             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1783             esac
1784             shift
1785             ;;
1786         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1787             exit 0;;
1788         --) break;;
1789         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1790         *) break;;
1791         esac
1792 done
1793
1794 case "$error" in
1795 true)
1796         cat >&2 <<EOM
1797 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1798                  [-U symbol] [-U symbol=] [-A command:symbol...]
1799   -d : use defaults for all answers.
1800   -e : go on without questioning past the production of config.sh.
1801   -f : specify an alternate default configuration file.
1802   -h : print this help message and exit (with an error status).
1803   -r : reuse C symbols value if possible (skips costly nm extraction).
1804   -s : silent mode, only echoes questions and essential information.
1805   -D : define symbol to have some value:
1806          -D symbol         symbol gets the value 'define'
1807          -D symbol=value   symbol gets the value 'value'
1808        common used examples (see INSTALL for more info):
1809          -Duse64bitint            use 64bit integers
1810          -Duse64bitall            use 64bit integers and pointers
1811          -Dusethreads             use thread support
1812          -Dinc_version_list=none  do not include older perl trees in @INC
1813          -DEBUGGING=none          DEBUGGING options
1814          -Dcc=gcc                 choose your compiler
1815          -Dprefix=/opt/perl5      choose your destination
1816   -E : stop at the end of questions, after having produced config.sh.
1817   -K : do not use unless you know what you are doing.
1818   -O : let -D and -U override definitions from loaded configuration file.
1819   -S : perform variable substitutions on all .SH files (can mix with -f)
1820   -U : undefine symbol:
1821          -U symbol    symbol gets the value 'undef'
1822          -U symbol=   symbol gets completely empty
1823        e.g.:  -Uversiononly
1824   -A : manipulate symbol after the platform specific hints have been applied:
1825          -A append:symbol=value   append value to symbol
1826          -A symbol=value          like append:, but with a separating space
1827          -A define:symbol=value   define symbol to have value
1828          -A clear:symbol          define symbol to be ''
1829          -A define:symbol         define symbol to be 'define'
1830          -A eval:symbol=value     define symbol to be eval of value
1831          -A prepend:symbol=value  prepend value to symbol
1832          -A undef:symbol          define symbol to be 'undef'
1833          -A undef:symbol=         define symbol to be ''
1834        e.g.:  -A prepend:libswanted='cl pthread '
1835               -A ccflags=-DSOME_MACRO
1836   -V : print version number and exit (with a zero status).
1837 EOM
1838         exit 1
1839         ;;
1840 esac
1841
1842 : Sanity checks
1843 case "$fastread$alldone" in
1844 yescont|yesexit) ;;
1845 *)
1846         case "$extractsh" in
1847         true) ;;
1848         *)
1849                 if test ! -t 0; then
1850                         echo "Say 'sh Configure', not 'sh <Configure'"
1851                         exit 1
1852                 fi
1853                 ;;
1854         esac
1855         ;;
1856 esac
1857
1858 exec 4>&1
1859 case "$silent" in
1860 true) exec 1>/dev/null;;
1861 esac
1862
1863 : run the defines and the undefines, if any, but leave the file out there...
1864 touch optdef.sh
1865 grep -q '\\' optdef.sh
1866 if test $? = 0; then
1867     echo "Configure does not support \\ in -D arguments"
1868     exit 1
1869 fi
1870 . ./optdef.sh
1871 : create the posthint manipulation script and leave the file out there...
1872 touch posthint.sh
1873
1874 : set package name
1875 package='perl5'
1876 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1877 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1878 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1879 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1880 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1881 esac
1882
1883 : Some greps do not return status, grrr.
1884 echo "grimblepritz" >grimble
1885 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1886         contains=contains
1887 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1888         contains=grep
1889 else
1890         contains=contains
1891 fi
1892 rm -f grimble
1893 : the following should work in any shell
1894 case "$contains" in
1895 contains*)
1896         echo " "
1897         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1898         cat >contains <<'EOSS'
1899 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1900 EOSS
1901 chmod +x contains
1902 esac
1903
1904 : Find the path to the source tree
1905 case "$src" in
1906 '') case "$0" in
1907     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1908          case "$src" in
1909          /*)    ;;
1910          .)     ;;
1911          *)     src=`cd ../$src && pwd` ;;
1912          esac
1913          ;;
1914     *)   src='.';;
1915     esac;;
1916 esac
1917 case "$src" in
1918 '')     src=/
1919         rsrc=/
1920         ;;
1921 /*)     rsrc="$src";;
1922 *)      rsrc="../$src";;
1923 esac
1924 if test -f $rsrc/Configure && \
1925         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1926 then
1927    : found it, so we are ok.
1928 else
1929         rsrc=''
1930         for src in . .. ../.. ../../.. ../../../..; do
1931                 if test -f ../$src/Configure && \
1932                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1933                 then
1934                         rsrc=../$src
1935                         break
1936                 fi
1937         done
1938 fi
1939 case "$rsrc" in
1940 '')
1941         cat <<EOM >&4
1942
1943 Sorry, I can't seem to locate the source dir for $package.  Please start
1944 Configure with an explicit path -- i.e. /some/path/Configure.
1945
1946 EOM
1947         exit 1
1948         ;;
1949 ../.)   rsrc='..';;
1950 *)
1951         echo " "
1952         echo "Sources for $package found in \"$src\"." >&4
1953         ;;
1954 esac
1955
1956 : script used to extract .SH files with variable substitutions
1957 cat >extract <<'EOS'
1958 PERL_CONFIG_SH=true
1959 echo "Doing variable substitutions on .SH files..."
1960 if test -f MANIFEST; then
1961         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1962 else
1963         echo "(Looking for .SH files under the source directory.)"
1964         set x `(cd "$src"; find . -name "*.SH" -print)`
1965 fi
1966 shift
1967 case $# in
1968 0) set x `(cd "$src"; echo *.SH)`; shift;;
1969 esac
1970 if test ! -f "$src/$1"; then
1971         shift
1972 fi
1973 mkdir_p='
1974 name=$1;
1975 create="";
1976 while test $name; do
1977         if test ! -d "$name"; then
1978                 create="$name $create";
1979                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1980                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1981         else
1982                 name="";
1983         fi;
1984 done;
1985 for file in $create; do
1986         mkdir $file;
1987 done
1988 '
1989 for file in $*; do
1990         case "$src" in
1991         ".")
1992                 case "$file" in
1993                 */*)
1994                         dir=`expr X$file : 'X\(.*\)/'`
1995                         file=`expr X$file : 'X.*/\(.*\)'`
1996                         (cd "$dir" && . ./$file)
1997                         ;;
1998                 *)
1999                         . ./$file
2000                         ;;
2001                 esac
2002                 ;;
2003         *)
2004                 case "$file" in
2005                 */*)
2006                         dir=`expr X$file : 'X\(.*\)/'`
2007                         file=`expr X$file : 'X.*/\(.*\)'`
2008                         (set x $dir; shift; eval $mkdir_p)
2009                         sh <"$src/$dir/$file"
2010                         ;;
2011                 *)
2012                         sh <"$src/$file"
2013                         ;;
2014                 esac
2015                 ;;
2016         esac
2017 done
2018 if test -f "$src/config_h.SH"; then
2019         if test ! -f config.h; then
2020         : oops, they left it out of MANIFEST, probably, so do it anyway.
2021         . "$src/config_h.SH"
2022         fi
2023 fi
2024 EOS
2025
2026 : extract files and exit if asked to do so
2027 case "$extractsh" in
2028 true)
2029         case "$realsilent" in
2030         true) ;;
2031         *) exec 1>&4;;
2032         esac
2033         case "$config_sh" in
2034         '') config_sh='config.sh';;
2035         esac
2036         echo " "
2037         echo "Fetching answers from $config_sh..."
2038         cd ..
2039         . $config_sh
2040         test "$override" && . ./optdef.sh
2041         echo " "
2042         . UU/extract
2043         rm -rf UU
2044         echo "Extraction done."
2045         exit 0
2046         ;;
2047 esac
2048
2049 : Eunice requires " " instead of "", can you believe it
2050 echo " "
2051 : Here we go...
2052 echo "Beginning of configuration questions for $package."
2053
2054 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2055
2056 : first determine how to suppress newline on echo command
2057 echo " "
2058 echo "Checking echo to see how to suppress newlines..."
2059 (echo "hi there\c" ; echo " ") >.echotmp
2060 if $contains c .echotmp >/dev/null 2>&1 ; then
2061         echo "...using -n."
2062         n='-n'
2063         c=''
2064 else
2065         cat <<'EOM'
2066 ...using \c
2067 EOM
2068         n=''
2069         c='\c'
2070 fi
2071 echo $n "The star should be here-->$c"
2072 echo '*'
2073 rm -f .echotmp
2074
2075 : Now test for existence of everything in MANIFEST
2076 echo " "
2077 if test -f "$rsrc/MANIFEST"; then
2078         echo "First let's make sure your kit is complete.  Checking..." >&4
2079         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2080                 (split -l 50 2>/dev/null || split -50)
2081         rm -f missing
2082         tmppwd=`pwd`
2083         for filelist in x??; do
2084                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2085                         >/dev/null 2>>"$tmppwd/missing")
2086         done
2087         if test -s missing; then
2088                 cat missing >&4
2089                 cat >&4 <<'EOM'
2090
2091 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2092
2093 You have the option of continuing the configuration process, despite the
2094 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2095 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2096 and contact the author (perlbug@perl.org).
2097
2098 EOM
2099                 echo $n "Continue? [n] $c" >&4
2100                 read ans
2101                 case "$ans" in
2102                 y*)
2103                         echo "Continuing..." >&4
2104                         rm -f missing
2105                         ;;
2106                 *)
2107                         echo "ABORTING..." >&4
2108                         kill $$
2109                         ;;
2110                 esac
2111         else
2112                 echo "Looks good..."
2113         fi
2114 else
2115         echo "There is no MANIFEST file.  I hope your kit is complete !"
2116 fi
2117 rm -f missing x??
2118
2119 : Find the appropriate value for a newline for tr
2120 echo " "
2121 if test -n "$DJGPP"; then
2122        trnl='\012'
2123 fi
2124 if test X"$trnl" = X; then
2125         case "`echo foo|tr '\n' x 2>/dev/null`" in
2126         foox) trnl='\n' ;;
2127         esac
2128 fi
2129 if test X"$trnl" = X; then
2130         case "`echo foo|tr '\012' x 2>/dev/null`" in
2131         foox) trnl='\012' ;;
2132         esac
2133 fi
2134 if test X"$trnl" = X; then
2135        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2136        fooxy) trnl='\n\r' ;;
2137        esac
2138 fi
2139 if test X"$trnl" = X; then
2140         cat <<EOM >&2
2141
2142 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2143
2144 EOM
2145         exit 1
2146 fi
2147
2148 : compute the number of columns on the terminal for proper question formatting
2149 case "$COLUMNS" in
2150 '') COLUMNS='80';;
2151 esac
2152
2153 : set up the echo used in my read
2154 myecho="case \"\$xxxm\" in
2155 '') echo $n \"\$rp $c\" >&4;;
2156 *) case \"\$rp\" in
2157         '') echo $n \"[\$xxxm] $c\";;
2158         *)
2159                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2160                         echo \"\$rp\" >&4
2161                         echo $n \"[\$xxxm] $c\" >&4
2162                 else
2163                         echo $n \"\$rp [\$xxxm] $c\" >&4
2164                 fi
2165                 ;;
2166         esac;;
2167 esac"
2168
2169 : now set up to do reads with possible shell escape and default assignment
2170 cat <<EOSC >myread
2171 $startsh
2172 xxxm=\$dflt
2173 $myecho
2174 ans='!'
2175 case "\$fastread" in
2176 yes) case "\$dflt" in
2177         '') ;;
2178         *) ans='';
2179                 case "\$silent-\$rp" in
2180                 true-) ;;
2181                 *) echo " " >&4;;
2182                 esac;;
2183         esac;;
2184 *) case "\$silent" in
2185         true) case "\$rp" in
2186                 '') ans='';;
2187                 esac;;
2188         esac;;
2189 esac
2190 while expr "X\$ans" : "X!" >/dev/null; do
2191         read answ
2192         set x \$xxxm
2193         shift
2194         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2195         case  "\$answ" in
2196         "!")
2197                 sh 1>&4
2198                 echo " "
2199                 $myecho
2200                 ;;
2201         !*)
2202                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2203                 shift
2204                 sh 1>&4 -c "\$*"
2205                 echo " "
2206                 $myecho
2207                 ;;
2208         "\$ans")
2209                 case "\$ans" in
2210                 \\&*)
2211                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2212                         shift
2213                         case "\$1" in
2214                         -d)
2215                                 fastread=yes
2216                                 echo "(OK, I'll run with -d after this question.)" >&4
2217                                 ;;
2218                         -*)
2219                                 echo "*** Sorry, \$1 not supported yet." >&4
2220                                 ;;
2221                         esac
2222                         $myecho
2223                         ans=!
2224                         ;;
2225                 esac;;
2226         *)
2227                 case "\$aok" in
2228                 y)
2229                         echo "*** Substitution done -- please confirm."
2230                         xxxm="\$ans"
2231                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2232                         xxxm="\$ans"
2233                         ans=!
2234                         ;;
2235                 *)
2236                         echo "*** Error -- try again."
2237                         ans=!
2238                         ;;
2239                 esac
2240                 $myecho
2241                 ;;
2242         esac
2243         case "\$ans\$xxxm\$nostick" in
2244         '')
2245                 ans=!
2246                 $myecho
2247                 ;;
2248         esac
2249 done
2250 case "\$ans" in
2251 '') ans="\$xxxm";;
2252 esac
2253 EOSC
2254
2255 : create .config dir to save info across Configure sessions
2256 test -d ../.config || mkdir ../.config
2257 cat >../.config/README <<EOF
2258 This directory created by Configure to save information that should
2259 persist across sessions for $package.
2260
2261 You may safely delete it if you wish.
2262 EOF
2263
2264 : See if we are using a devel version and want that
2265 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2266 case "$usedevel" in
2267 $define|true|[yY]*)
2268     usedevel="$define" ;;
2269 *) case "$xversion" in
2270    *[13579])
2271         cat >&4 <<EOH
2272 *** WHOA THERE!!! ***
2273
2274     This is an UNSTABLE DEVELOPMENT release.
2275     The version of this $package distribution is $xversion, that is, odd,
2276     (as opposed to even) and that signifies a development release.
2277     If you want a maintenance release, you want an even-numbered version.
2278
2279     Do ***NOT*** install this into production use.
2280     Data corruption and crashes are possible.
2281
2282     It is most seriously suggested that you do not continue any further
2283     unless you want to help in developing and debugging Perl.
2284
2285     If you *still* want to build perl, you can answer 'y' now,
2286     or pass -Dusedevel to Configure.
2287
2288 EOH
2289         rp='Do you really want to continue?'
2290         dflt='n'
2291         . ./myread
2292         case "$ans" in
2293         [yY]) echo >&4 "Okay, continuing."
2294               usedevel="$define" ;;
2295         *) echo >&4 "Okay, bye."
2296            exit 1
2297            ;;
2298         esac
2299         ;;
2300     esac
2301     usedevel="$undef"
2302     ;;
2303 esac
2304 case "$usedevel" in
2305 $define|true|[yY]*)
2306         case "$versiononly" in
2307         '') versiononly="$define" ;;
2308         esac
2309         case "$installusrbinperl" in
2310         '') installusrbinperl="$undef" ;;
2311         esac
2312         ;;
2313 esac
2314
2315 : general instructions
2316 needman=true
2317 firsttime=true
2318 user=`(logname) 2>/dev/null`
2319 case "$user" in
2320 '') user=`whoami 2>&1`;;
2321 esac
2322 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2323         firsttime=false
2324         echo " "
2325         rp='Would you like to see the instructions?'
2326         dflt=n
2327         . ./myread
2328         case "$ans" in
2329         [yY]*) ;;
2330         *) needman=false;;
2331         esac
2332 fi
2333 if $needman; then
2334         cat <<EOH
2335
2336 This installation shell script will examine your system and ask you questions
2337 to determine how the perl5 package should be installed. If you get
2338 stuck on a question, you may use a ! shell escape to start a subshell or
2339 execute a command.  Many of the questions will have default answers in square
2340 brackets; typing carriage return will give you the default.
2341
2342 On some of the questions which ask for file or directory names you are allowed
2343 to use the ~name construct to specify the login directory belonging to "name",
2344 even if you don't have a shell which knows about that.  Questions where this is
2345 allowed will be marked "(~name ok)".
2346
2347 EOH
2348         rp=''
2349         dflt='Type carriage return to continue'
2350         . ./myread
2351         cat <<'EOH'
2352
2353 The prompter used in this script allows you to use shell variables and
2354 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2355 in the default answer, as if the default line was a set of arguments given to a
2356 script shell.  This means you may also use $* to repeat the whole default line,
2357 so you do not have to re-type everything to add something to the default.
2358
2359 Every time there is a substitution, you will have to confirm.  If there is an
2360 error (e.g. an unmatched backtick), the default answer will remain unchanged
2361 and you will be prompted again.
2362
2363 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2364 the questions and use the computed defaults (or the previous answers if there
2365 was already a config.sh file). Type 'Configure -h' for a list of options.
2366 You may also start interactively and then answer '& -d' at any prompt to turn
2367 on the non-interactive behaviour for the remainder of the execution.
2368
2369 EOH
2370         . ./myread
2371         cat <<EOH
2372
2373 Much effort has been expended to ensure that this shell script will run on any
2374 Unix system.  If despite that it blows up on yours, your best bet is to edit
2375 Configure and run it again.  If you can't run Configure for some reason,
2376 you'll have to generate a config.sh file by hand.  Whatever problems you
2377 have, let me (perlbug@perl.org) know how I blew it.
2378
2379 This installation script affects things in two ways:
2380
2381 1) it may do direct variable substitutions on some of the files included
2382    in this kit.
2383 2) it builds a config.h file for inclusion in C programs.  You may edit
2384    any of these files as the need arises after running this script.
2385
2386 If you make a mistake on a question, there is no easy way to back up to it
2387 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2388 files.  Configure will offer to let you do this before it runs the SH files.
2389
2390 EOH
2391         dflt='Type carriage return to continue'
2392         . ./myread
2393         case "$firsttime" in
2394         true) echo $user >>../.config/instruct;;
2395         esac
2396 fi
2397
2398 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2399 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2400 if test "X$sysroot" = X; then
2401     sysroot=""
2402 else
2403     case "$cc" in
2404         *gcc*|*g++*)
2405             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2406             # _sysroot is used in places where we need --sysroot=foo
2407             # but using the rest of the flags could cause issues.
2408             _sysroot="--sysroot=$sysroot";
2409             case "$ccflags" in
2410                 *sysroot*) ;;
2411                 'undef'|*)
2412                 ccflags="$ccflags $_sysroot"
2413             esac
2414             case "$ldflags" in
2415                 *sysroot*) ;;
2416                 'undef'|*)
2417                 ldflags="$ldflags $_sysroot"
2418             esac
2419             case "$cppflags" in
2420                 *sysroot*) ;;
2421                 'undef'|*)
2422                 cppflags="$cppflags $_sysroot"
2423             esac
2424             # lddlflags updated below in lddlflags section;
2425             # same with cccdlflags
2426             ;;
2427     esac
2428
2429     # Adjust some defaults to also use $sysroot
2430     for var in xlibpth loclibpth locincpth glibpth; do
2431         eval xxx=\$$var
2432         eval $var=''
2433         for path in $xxx; do
2434             eval $var=\"\$$var $sysroot$path\"
2435         done
2436     done
2437
2438 fi
2439
2440 : find out where common programs are
2441 echo " "
2442 echo "Locating common programs..." >&4
2443 cat <<EOSC >loc
2444 $startsh
2445 case \$# in
2446 0) exit 1;;
2447 esac
2448 thing=\$1
2449 shift
2450 dflt=\$1
2451 shift
2452 for dir in \$*; do
2453         case "\$thing" in
2454         .)
2455         if test -d \$dir/\$thing; then
2456                 echo \$dir
2457                 exit 0
2458         fi
2459         ;;
2460         *)
2461         for thisthing in \$dir/\$thing; do
2462                 : just loop through to pick last item
2463         done
2464         if test -f \$thisthing; then
2465                 echo \$thisthing
2466                 exit 0
2467         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2468                 echo \$thisthing
2469                 exit 0
2470         elif test -f \$dir/\$thing.exe; then
2471                 if test -n "$DJGPP"; then
2472                         echo \$dir/\$thing.exe
2473                 elif test "$eunicefix" != ":"; then
2474                         : on Eunice apparently
2475                         echo \$dir/\$thing
2476                 fi
2477                 exit 0
2478         fi
2479         ;;
2480         esac
2481 done
2482 echo \$dflt
2483 exit 1
2484 EOSC
2485 chmod +x loc
2486 $eunicefix loc
2487 loclist="
2488 awk
2489 cat
2490 chmod
2491 comm
2492 cp
2493 echo
2494 expr
2495 grep
2496 ls
2497 mkdir
2498 rm
2499 sed
2500 sort
2501 touch
2502 tr
2503 uniq
2504 "
2505 trylist="
2506 ar
2507 bison
2508 byacc
2509 cpp
2510 csh
2511 date
2512 egrep
2513 gmake
2514 gzip
2515 less
2516 ln
2517 make
2518 more
2519 nm
2520 nroff
2521 perl
2522 pg
2523 test
2524 uname
2525 zip
2526 "
2527 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2528 pth="$pth $sysroot/lib $sysroot/usr/lib"
2529 for file in $loclist; do
2530         eval xxx=\$$file
2531         case "$xxx" in
2532         /*|?:[\\/]*)
2533                 if test -f "$xxx"; then
2534                         : ok
2535                 else
2536                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2537                         xxx=`./loc $file $file $pth`
2538                 fi
2539                 ;;
2540         '') xxx=`./loc $file $file $pth`;;
2541         *) xxx=`./loc $xxx $xxx $pth`;;
2542         esac
2543         eval $file=$xxx$_exe
2544         eval _$file=$xxx
2545         case "$xxx" in
2546         /*)
2547                 echo $file is in $xxx.
2548                 ;;
2549         ?:[\\/]*)
2550                 echo $file is in $xxx.
2551                 ;;
2552         *)
2553                 echo "I don't know where '$file' is, and my life depends on it." >&4
2554                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2555                 exit 1
2556                 ;;
2557         esac
2558 done
2559 echo " "
2560 echo "Don't worry if any of the following aren't found..."
2561 say=offhand
2562 for file in $trylist; do
2563         eval xxx=\$$file
2564         case "$xxx" in
2565         /*|?:[\\/]*)
2566                 if test -f "$xxx"; then
2567                         : ok
2568                 else
2569                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2570                         xxx=`./loc $file $file $pth`
2571                 fi
2572                 ;;
2573         '') xxx=`./loc $file $file $pth`;;
2574         *) xxx=`./loc $xxx $xxx $pth`;;
2575         esac
2576         eval $file=$xxx$_exe
2577         eval _$file=$xxx
2578         case "$xxx" in
2579         /*)
2580                 echo $file is in $xxx.
2581                 ;;
2582         ?:[\\/]*)
2583                 echo $file is in $xxx.
2584                 ;;
2585         *)
2586                 echo "I don't see $file out there, $say."
2587                 say=either
2588                 ;;
2589         esac
2590 done
2591 case "$egrep" in
2592 egrep)
2593         echo "Substituting grep for egrep."
2594         egrep=$grep
2595         _egrep=$grep
2596         ;;
2597 esac
2598 case "$less" in
2599 '')     ;;
2600 *)      if $less -R </dev/null >/dev/null 2>&1; then
2601                echo "Substituting less -R for less."
2602                less="$less -R"
2603                _less=$less
2604         fi
2605         ;;
2606 esac
2607 case "$ln" in
2608 ln)
2609         echo "Substituting cp for ln."
2610         ln=$cp
2611         _ln=$cp
2612         ;;
2613 esac
2614 case "$make" in
2615 make)
2616         case "$gmake" in
2617         gmake)
2618         echo "I can't find make or gmake, and my life depends on it." >&4
2619         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2620         exit 1
2621         ;;
2622         esac
2623         ;;
2624 esac
2625 case "$gmake" in
2626 gmake)  ;;
2627 *)      # We can't have osname yet.
2628         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2629                 # Assume that gmake, if found, is definitely GNU make
2630                 # and prefer it over the system make.
2631                 echo "Substituting gmake for make."
2632                 make=$gmake
2633                 _make=$gmake
2634         fi
2635         ;;
2636 esac
2637 case "$test" in
2638 test)
2639         echo "Hopefully test is built into your sh."
2640         ;;
2641 *)
2642         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2643                 echo "Using the test built into your sh."
2644                 test=test
2645                 _test=test
2646         fi
2647         ;;
2648 esac
2649 case "$echo" in
2650 echo)
2651         echo "Hopefully echo is built into your sh."
2652         ;;
2653 '') ;;
2654 *)
2655         echo " "
2656 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2657         $echo $n "hi there$c" >foo1
2658         echo $n "hi there$c" >foo2
2659         if cmp foo1 foo2 >/dev/null 2>&1; then
2660                 echo "They are compatible.  In fact, they may be identical."
2661         else
2662                 case "$n" in
2663                 '-n') n='' c='\c';;
2664                 *) n='-n' c='';;
2665                 esac
2666                 cat <<FOO
2667 They are not compatible!  You are probably running ksh on a non-USG system.
2668 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2669 have echo built in and we may have to run some Bourne shell scripts.  That
2670 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2671
2672 FOO
2673                 $echo $n "The star should be here-->$c"
2674                 $echo "*"
2675         fi
2676         $rm -f foo1 foo2
2677         ;;
2678 esac
2679
2680 # This question was auctioned at YAPC::Europe-2007 in Vienna
2681 # I never promised you could answer it. I only auctioned the question.
2682 cat <<FOO
2683 The following message is sponsored by
2684
2685   Dresden.pm<--The stars should be here.
2686
2687 Dear Perl user, system administrator or package
2688 maintainer, the Perl community sends greetings to
2689 you. Do you (emblematical) greet back [Y/n]? n
2690
2691 FOO
2692
2693 : Check what type of C compiler we use
2694 cat <<EOS >trygcc
2695 $startsh
2696 EOS
2697 cat <<'EOSC' >>trygcc
2698 case "$cc" in
2699 '') ;;
2700 *)  $rm -f try try.*
2701     $cat >try.c <<EOM
2702 int main(int argc, char *argv[]) {
2703   return 0;
2704 }
2705 EOM
2706     if $cc -o try $ccflags $ldflags try.c; then
2707        :
2708     else
2709         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2710         despair=yes
2711         trygcc=yes
2712         case "$cc" in
2713         *gcc*) trygcc=no ;;
2714         esac
2715         # Skip this test because it gives a false match on output like:
2716         #    ./trygcc: line 23: cc: command not found
2717         # case "`$cc -v -c try.c 2>&1`" in
2718         # *gcc*) trygcc=no ;;
2719         # esac
2720         if $test X"$trygcc" = Xyes; then
2721             if gcc -o try -c try.c; then
2722                 echo " "
2723                 echo "You seem to have a working gcc, though." >&4
2724                 # Switching compilers may undo the work of hints files.
2725                 # The most common problem is -D_REENTRANT for threads.
2726                 # This heuristic catches that case, but gets false positives
2727                 # if -Dusethreads was not actually specified.  Better to
2728                 # bail out here with a useful message than fail
2729                 # mysteriously later. Should we perhaps just try to
2730                 # re-invoke Configure -Dcc=gcc config_args ?
2731                 if $test -f usethreads.cbu; then
2732                         $cat >&4 <<EOM
2733
2734 *** However, any setting of the C compiler flags (e.g. for thread support)
2735 *** will be lost.  It may be necessary for you to restart Configure and
2736 *** add -Dcc=gcc to your Configure command line.
2737
2738 EOM
2739                         rp="Would you like to go ahead and try gcc anyway?"
2740                         dflt=n
2741                 else
2742                         rp="Would you like to use it?"
2743                         dflt=y
2744                 fi
2745                 if $test -f myread; then
2746                     . ./myread
2747                 else
2748                     if $test -f UU/myread; then
2749                         . ./UU/myread
2750                     else
2751                         echo "Cannot find myread, sorry.  Aborting." >&2
2752                         exit 1
2753                     fi
2754                 fi
2755                 case "$ans" in
2756                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2757                 esac
2758             fi
2759         fi
2760     fi
2761     $rm -f try try.*
2762     ;;
2763 esac
2764 EOSC
2765
2766 cat <<EOS >checkcc
2767 $startsh
2768 EOS
2769 cat <<'EOSC' >>checkcc
2770 case "$cc" in
2771 '') ;;
2772 *)  $rm -f try try.*
2773     $cat >try.c <<EOM
2774 int main(int argc, char *argv[]) {
2775   return 0;
2776 }
2777 EOM
2778     if $cc -o try $ccflags $ldflags try.c; then
2779        :
2780     else
2781         if $test X"$despair" = Xyes; then
2782            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2783         fi
2784         $cat >&4 <<EOM
2785 You need to find a working C compiler.
2786 Either (purchase and) install the C compiler supplied by your OS vendor,
2787 or for a free C compiler try http://gcc.gnu.org/
2788 I cannot continue any further, aborting.
2789 EOM
2790         exit 1
2791     fi
2792     $rm -f try try.*
2793     ;;
2794 esac
2795 EOSC
2796
2797 : determine whether symbolic links are supported
2798 echo " "
2799 $touch blurfl
2800 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2801         echo "Symbolic links are supported." >&4
2802         lns="$ln -s"
2803 else
2804         echo "Symbolic links are NOT supported." >&4
2805         lns="$ln"
2806 fi
2807 $rm -f blurfl sym
2808
2809 : determine whether symbolic links are supported
2810 echo " "
2811 case "$lns" in
2812 *"ln"*" -s")
2813         echo "Checking how to test for symbolic links..." >&4
2814         $lns blurfl sym
2815         if $test "X$issymlink" = X; then
2816                 case "$newsh" in
2817                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2818                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2819                 esac
2820                 if test $? = 0; then
2821                         issymlink="test -h"
2822                 else
2823                         echo "Your builtin 'test -h' may be broken." >&4
2824                         case "$test" in
2825                         /*)     ;;
2826                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2827                                 for p in $pth
2828                                 do
2829                                         if test -f "$p/$test"; then
2830                                                 test="$p/$test"
2831                                                 break
2832                                         fi
2833                                 done
2834                                 ;;
2835                         esac
2836                         case "$test" in
2837                         /*)
2838                                 echo "Trying external '$test -h'." >&4
2839                                 issymlink="$test -h"
2840                                 if $test ! -h sym >/dev/null 2>&1; then
2841                                         echo "External '$test -h' is broken, too." >&4
2842                                         issymlink=''
2843                                 fi
2844                                 ;;
2845                         *)      issymlink='' ;;
2846                         esac
2847                 fi
2848         fi
2849         if $test "X$issymlink" = X; then
2850                 if $test -L sym 2>/dev/null; then
2851                         issymlink="$test -L"
2852                         echo "The builtin '$test -L' worked." >&4
2853                 fi
2854         fi
2855         if $test "X$issymlink" != X; then
2856                 echo "You can test for symbolic links with '$issymlink'." >&4
2857         else
2858                 echo "I do not know how you can test for symbolic links." >&4
2859         fi
2860         $rm -f blurfl sym
2861         ;;
2862 *)      echo "No symbolic links, so not testing for their testing..." >&4
2863         ;;
2864 esac
2865 echo " "
2866
2867 : Make symlinks util
2868 case "$mksymlinks" in
2869 $define|true|[yY]*)
2870         case "$src" in
2871         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2872                 exit 1
2873                 ;;
2874         *)      case "$lns:$issymlink" in
2875                 *"ln"*" -s:"*"test -"?)
2876                         echo "Creating the symbolic links..." >&4
2877                         cd ..
2878                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2879                         awk 'NF == 1 {
2880                                 dir=".";
2881                                 file=$1 "";
2882                              }
2883                              NF == 2 {
2884                                 dir=$1 "";
2885                                 file=$2 "";
2886                              }
2887                              {
2888                                  print "# dir = ", dir, "file = ", file
2889                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2890                              } END {
2891                                  for (d in mf) {
2892                                      if (d != ".") { print("mkdir -p "d) }
2893                                      print("ln -sf "mf[d]" "d);
2894                                  }
2895                              }' source="$src" > UU/mksymlinks.$$
2896                         sh UU/mksymlinks.$$
2897                         rm UU/mksymlinks.$$
2898                         # Sanity check 1.
2899                         if test ! -d t/base; then
2900                                 echo "Failed to create the subdirectories.  Aborting." >&4
2901                                 exit 1
2902                         fi
2903                         # Sanity check 2.
2904                         if test ! -f t/base/lex.t; then
2905                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2906                                 exit 1
2907                         fi
2908                         if test ! -f win32/win32.c; then
2909                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2910                                 exit 1
2911                         fi
2912                         cd UU
2913                         ;;
2914                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2915                         ;;
2916                 esac
2917                 ;;
2918         esac
2919         ;;
2920 esac
2921
2922 : Check for Cross-Compilation
2923 if $test "X$targethost" = "X"; then
2924     targethost=""
2925 fi
2926 if $test "X$targetenv" = "X"; then
2927     targetenv=""
2928 fi
2929 case "$usecrosscompile" in
2930 $define|true|[yY]*)
2931         $echo "Cross-compiling..."
2932         croak=''
2933         case "$cc" in
2934         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2935             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2936             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2937             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2938             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2939             # leave out ld, choosing it is more complex
2940             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2941             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2942             # We are in a weird spot. Just before us, some values
2943             # were 'saved', to be restored after the hints are
2944             # run.  This means that the changes we made to ar,
2945             # nm and ranlib will get reverted.
2946             # To avoid that, we hijack the saving mechanism and
2947             # have it save our new values.
2948             for file in ar nm ranlib; do
2949                 eval xxx=\$$file
2950                 eval $file=$xxx$_exe
2951                 eval _$file=$xxx
2952             done
2953         ;;
2954         esac
2955         case "$targetarch" in
2956         '') echo "Targetarch not defined." >&4; croak=y ;;
2957         *)  echo "Using targetarch $targetarch." >&4 ;;
2958         esac
2959         case "$targethost" in
2960         '') echo "Targethost not defined." >&4; croak=y ;;
2961         *)  echo "Using targethost $targethost." >&4
2962         esac
2963         locincpth=' '
2964         loclibpth=' '
2965         case "$croak" in
2966         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2967         esac
2968     : compile a host miniperl and generate_uudmap, unless we got passed them
2969     if $test "X$hostperl" = X; then
2970       echo "Building host miniperl and generate_uudmap binaries" >&4
2971       before_host=`pwd`
2972       cd ..
2973       cd $src
2974       src=`pwd`
2975       rm -rf $src/host
2976       mkdir $src/host
2977       cd $src/host
2978       $src/Configure -des -Dusedevel -Dmksymlinks
2979       $make miniperl
2980       case "$hostgenerate" in
2981       '') $make generate_uudmap
2982           hostgenerate=$src/host/generate_uudmap
2983           ;;
2984        "$undef") hostgenerate=''
2985           ;;
2986       esac
2987       hostperl=$src/host/miniperl
2988       cd $before_host
2989     fi
2990     hostosname=`$hostperl -le 'print $^O'`
2991     ;;
2992 *)
2993     usecrosscompile="$undef"
2994     ;;
2995 esac
2996
2997 : Define -Dtargethost=somecomputer to run compiled tests on another machine
2998 case "$targethost" in
2999     '') echo "Checking for cross-compile" >&4
3000     case "$usecrosscompile$multiarch" in
3001        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3002          if [ -f Makefile ]; then
3003            echo " "
3004            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3005          else
3006            echo "Configure done."
3007          fi
3008        exit 0
3009        ;;
3010      *) echo "No targethost for running compiler tests against defined, running locally" >&4
3011         run=''
3012         to=:
3013         from=:
3014         ;;
3015     esac
3016     ;;
3017     *) echo "Using targethost $targethost." >&4
3018         case "$src" in
3019         /*) run=$src/Cross/run
3020             targetmkdir=$src/Cross/mkdir
3021             to=$src/Cross/to
3022             from=$src/Cross/from
3023             ;;
3024         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3025             run=$pwd/Cross/run
3026             targetmkdir=$pwd/Cross/mkdir
3027             to=$pwd/Cross/to
3028             from=$pwd/Cross/from
3029             ;;
3030         esac
3031         case "$targetrun" in
3032         '') targetrun=ssh ;;
3033         esac
3034         case "$targetto" in
3035         '') targetto=scp ;;
3036         esac
3037         case "$targetfrom" in
3038         '') targetfrom=scp ;;
3039         esac
3040         run=$run-$targetrun
3041         to=$to-$targetto
3042         from=$from-$targetfrom
3043         case "$targetdir" in
3044         '')  targetdir=/tmp
3045              echo "Guessing targetdir $targetdir." >&4
3046              ;;
3047         esac
3048         case "$targetuser" in
3049         '')  targetuser=root
3050              echo "Guessing targetuser $targetuser." >&4
3051              ;;
3052         esac
3053         case "$targetport" in
3054         '')  targetport=22
3055              echo "Guessing targetport $targetport." >&4
3056              ;;
3057         esac
3058         case "$targetfrom" in
3059         scp)    q=-q ;;
3060         *)      q='' ;;
3061         esac
3062         case "$targetrun" in
3063         ssh|rsh)
3064             cat >$run <<EOF
3065 #!/bin/sh
3066 env=''
3067 case "\$1" in
3068 -cwd)
3069   shift
3070   cwd=\$1
3071   shift
3072   ;;
3073 esac
3074 case "\$1" in
3075 -env)
3076   shift
3077   env=\$1
3078   shift
3079   ;;
3080 esac
3081 case "\$cwd" in
3082 '') cwd=$targetdir ;;
3083 esac
3084 exe=\$1
3085 shift
3086 $to \$exe
3087 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3088 EOF
3089             ;;
3090         adb)
3091             $touch $run
3092             ;;
3093         *)  echo "Unknown targetrun '$targetrun'" >&4
3094             exit 1
3095             ;;
3096         esac
3097         case "$targetmkdir" in
3098         */Cross/mkdir)
3099             cat >$targetmkdir <<EOF
3100 #!/bin/sh
3101 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3102 EOF
3103             $chmod a+rx $targetmkdir
3104             ;;
3105         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3106             exit 1
3107             ;;
3108         esac
3109         case "$targetto" in
3110         scp|rcp)
3111             cat >$to <<EOF
3112 #!/bin/sh
3113 for f in \$@
3114 do
3115   case "\$f" in
3116   /*)
3117     $targetmkdir \`dirname \$f\`
3118     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3119     ;;
3120   *)
3121     $targetmkdir $targetdir/\`dirname \$f\`
3122     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3123     ;;
3124   esac
3125 done
3126 exit 0
3127 EOF
3128             ;;
3129         cp) cat >$to <<EOF
3130 #!/bin/sh
3131 for f in \$@
3132 do
3133   case "\$f" in
3134   /*)
3135     $mkdir -p $targetdir/\`dirname \$f\`
3136     $cp \$f $targetdir/\$f || exit 1
3137     ;;
3138   *)
3139     $targetmkdir $targetdir/\`dirname \$f\`
3140     $cp \$f $targetdir/\$f || exit 1
3141     ;;
3142   esac
3143 done
3144 exit 0
3145 EOF
3146             ;;
3147         *)  echo "Unknown targetto '$targetto'" >&4
3148             exit 1
3149             ;;
3150         esac
3151         case "$targetfrom" in
3152         scp|rcp)
3153           cat >$from <<EOF
3154 #!/bin/sh
3155 for f in \$@
3156 do
3157   $rm -f \$f
3158   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3159 done
3160 exit 0
3161 EOF
3162             ;;
3163         cp) cat >$from <<EOF
3164 #!/bin/sh
3165 for f in \$@
3166 do
3167   $rm -f \$f
3168   cp $targetdir/\$f . || exit 1
3169 done
3170 exit 0
3171 EOF
3172             ;;
3173         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3174             exit 1
3175             ;;
3176         esac
3177         if $test ! -f $run; then
3178             echo "Target 'run' script '$run' not found." >&4
3179         else
3180             $chmod a+rx $run
3181         fi
3182         if $test ! -f $to; then
3183             echo "Target 'to' script '$to' not found." >&4
3184         else
3185             $chmod a+rx $to
3186         fi
3187         if $test ! -f $from; then
3188             echo "Target 'from' script '$from' not found." >&4
3189         else
3190             $chmod a+rx $from
3191         fi
3192         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3193             exit 1
3194         fi
3195         cat >&4 <<EOF
3196 Using '$run' for remote execution,
3197 and '$from' and '$to'
3198 for remote file transfer.
3199 EOF
3200         ;;
3201 *)      run=''
3202         to=:
3203         from=:
3204         usecrosscompile="$undef"
3205         targetarch=''
3206         ;;
3207 esac
3208
3209 : see whether [:lower:] and [:upper:] are supported character classes
3210 echo " "
3211 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3212 ABYZ)
3213         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3214         up='[:upper:]'
3215         low='[:lower:]'
3216         ;;
3217 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3218         # (0xd9 and 0xe2), therefore that is a nice testing point.
3219         if test "X$up" = X -o "X$low" = X; then
3220             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3221             rs) up='[A-Z]'
3222                 low='[a-z]'
3223                 ;;
3224             esac
3225         fi
3226         if test "X$up" = X -o "X$low" = X; then
3227             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3228             rs) up='A-Z'
3229                 low='a-z'
3230                 ;;
3231             esac
3232         fi
3233         if test "X$up" = X -o "X$low" = X; then
3234             case "`echo RS | od -x 2>/dev/null`" in
3235             *D9E2*|*d9e2*)
3236                 echo "Hey, this might be EBCDIC." >&4
3237                 if test "X$up" = X -o "X$low" = X; then
3238                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3239                     rs) up='[A-IJ-RS-Z]'
3240                         low='[a-ij-rs-z]'
3241                         ;;
3242                     esac
3243                 fi
3244                 if test "X$up" = X -o "X$low" = X; then
3245                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3246                     rs) up='A-IJ-RS-Z'
3247                         low='a-ij-rs-z'
3248                         ;;
3249                     esac
3250                 fi
3251                 ;;
3252             esac
3253         fi
3254 esac
3255 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3256 rs)
3257     echo "Using $up and $low to convert case." >&4
3258     ;;
3259 *)
3260     echo "I don't know how to translate letters from upper to lower case." >&4
3261     echo "Your tr is not acting any way I know of." >&4
3262     exit 1
3263     ;;
3264 esac
3265 : set up the translation script tr, must be called with ./tr of course
3266 cat >tr <<EOSC
3267 $startsh
3268 case "\$1\$2" in
3269 '[A-Z][a-z]') exec $tr '$up' '$low';;
3270 '[a-z][A-Z]') exec $tr '$low' '$up';;
3271 esac
3272 exec $tr "\$@"
3273 EOSC
3274 chmod +x tr
3275 $eunicefix tr
3276
3277 : Try to determine whether config.sh was made on this system
3278 case "$config_sh" in
3279 '')
3280 myuname=`$uname -a 2>/dev/null`
3281 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3282 # Downcase everything to avoid ambiguity.
3283 # Remove slashes and single quotes so we can use parts of this in
3284 # directory and file names.
3285 # Remove newlines so myuname is sane to use elsewhere.
3286 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3287 # because the A-Z/a-z are not consecutive.
3288 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3289         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3290 newmyuname="$myuname"
3291 dflt=n
3292 case "$knowitall" in
3293 '')
3294         if test -f ../config.sh; then
3295                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3296                         eval "`grep myuname= ../config.sh`"
3297                 fi
3298                 if test "X$myuname" = "X$newmyuname"; then
3299                         dflt=y
3300                 fi
3301         fi
3302         ;;
3303 *) dflt=y;;
3304 esac
3305
3306 : Get old answers from old config file if Configure was run on the
3307 : same system, otherwise use the hints.
3308 hint=default
3309 cd ..
3310 if test -f config.sh; then
3311         echo " "
3312         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3313         . UU/myread
3314         case "$ans" in
3315         n*|N*) echo "OK, I'll ignore it."
3316                 mv config.sh config.sh.old
3317                 myuname="$newmyuname"
3318                 ;;
3319         *)  echo "Fetching default answers from your old config.sh file..." >&4
3320                 tmp_n="$n"
3321                 tmp_c="$c"
3322                 tmp_sh="$sh"
3323                 . ./config.sh
3324                 cp config.sh UU
3325                 n="$tmp_n"
3326                 c="$tmp_c"
3327                 : Older versions did not always set $sh.  Catch re-use of such
3328                 : an old config.sh.
3329                 case "$sh" in
3330                 '') sh="$tmp_sh" ;;
3331                 esac
3332                 hint=previous
3333                 ;;
3334         esac
3335 fi
3336 . ./UU/checkcc
3337 if test ! -f config.sh; then
3338         $cat <<EOM
3339
3340 First time through, eh?  I have some defaults handy for some systems
3341 that need some extra help getting the Configure answers right:
3342
3343 EOM
3344         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3345         dflt=''
3346         : Half the following guesses are probably wrong... If you have better
3347         : tests or hints, please send them to perlbug@perl.org
3348         : The metaconfig authors would also appreciate a copy...
3349         $test -f /irix && osname=irix
3350         $test -f /xenix && osname=sco_xenix
3351         $test -f /dynix && osname=dynix
3352         $test -f /dnix && osname=dnix
3353         $test -f /lynx.os && osname=lynxos
3354         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3355         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3356         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3357         $test -f /bin/mips && /bin/mips && osname=mips
3358         $test -d /usr/apollo/bin && osname=apollo
3359         $test -f /etc/saf/_sactab && osname=svr4
3360         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3361         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3362         if $test -d /MachTen -o -d /MachTen_Folder; then
3363                 osname=machten
3364                 if $test -x /sbin/version; then
3365                         osvers=`/sbin/version | $awk '{print $2}' |
3366                         $sed -e 's/[A-Za-z]$//'`
3367                 elif $test -x /usr/etc/version; then
3368                         osvers=`/usr/etc/version | $awk '{print $2}' |
3369                         $sed -e 's/[A-Za-z]$//'`
3370                 else
3371                         osvers="$2.$3"
3372                 fi
3373         fi
3374
3375         $test -f /sys/posix.dll &&
3376                 $test -f /usr/bin/what &&
3377                 set X `/usr/bin/what /sys/posix.dll` &&
3378                 $test "$3" = UWIN &&
3379                 osname=uwin &&
3380                 osvers="$5"
3381
3382         if $test -f $uname; then
3383                 set X $myuname
3384                 shift
3385
3386                 case "$5" in
3387                 fps*) osname=fps ;;
3388                 mips*)
3389                         case "$4" in
3390                         umips) osname=umips ;;
3391                         *) osname=mips ;;
3392                         esac;;
3393                 [23]100) osname=mips ;;
3394                 i386*)
3395                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3396                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3397                                 osname='sco'
3398                                 osvers=$tmp
3399                         elif $test -f /etc/kconfig; then
3400                                 osname=isc
3401                                 if test "$lns" = "$ln -s"; then
3402                                         osvers=4
3403                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3404                                         osvers=3
3405                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3406                                         osvers=2
3407                                 fi
3408                         fi
3409                         tmp=''
3410                         ;;
3411                 pc*)
3412                         if test -n "$DJGPP"; then
3413                                 osname=dos
3414                                 osvers=djgpp
3415                         fi
3416                         ;;
3417                 esac
3418
3419                 case "$1" in
3420                 aix) osname=aix
3421                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3422                         case "$tmp" in
3423                         # oslevel can fail with:
3424                         # oslevel: Unable to acquire lock.
3425                         *not\ found) osvers="$4"."$3" ;;
3426                         '<3240'|'<>3240') osvers=3.2.0 ;;
3427                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3428                         '=3250'|'>3250') osvers=3.2.5 ;;
3429                         *) osvers=$tmp;;
3430                         esac
3431                         ;;
3432                 bitrig) osname=bitrig
3433                         osvers="$3"
3434                         ;;
3435                 bsd386) osname=bsd386
3436                         osvers=`$uname -r`
3437                         ;;
3438                 cygwin*) osname=cygwin
3439                         osvers="$3"
3440                         ;;
3441                 *dc.osx) osname=dcosx
3442                         osvers="$3"
3443                         ;;
3444                 dnix) osname=dnix
3445                         osvers="$3"
3446                         ;;
3447                 domainos) osname=apollo
3448                         osvers="$3"
3449                         ;;
3450                 dgux)   osname=dgux
3451                         osvers="$3"
3452                         ;;
3453                 dragonfly) osname=dragonfly
3454                         osvers="$3"
3455                         ;;
3456                 dynixptx*) osname=dynixptx
3457                         osvers=`echo "$4"|sed 's/^v//'`
3458                         ;;
3459                 freebsd) osname=freebsd
3460                         osvers="$3" ;;
3461                 genix)  osname=genix ;;
3462                 gnu)    osname=gnu
3463                         osvers="$3" ;;
3464                 hp*)    osname=hpux
3465                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3466                         ;;
3467                 irix*)  osname=irix
3468                         case "$3" in
3469                         4*) osvers=4 ;;
3470                         5*) osvers=5 ;;
3471                         *)      osvers="$3" ;;
3472                         esac
3473                         ;;
3474                 linux)  osname=linux
3475                         case "$3" in
3476                         *)      osvers="$3" ;;
3477                         esac
3478                         $test -f /system/lib/libandroid.so && osname=linux-android
3479                         ;;
3480                 MiNT)   osname=mint
3481                         ;;
3482                 netbsd*) osname=netbsd
3483                         osvers="$3"
3484                         ;;
3485                 news-os) osvers="$3"
3486                         case "$3" in
3487                         4*) osname=newsos4 ;;
3488                         *) osname=newsos ;;
3489                         esac
3490                         ;;
3491                 nonstop-ux) osname=nonstopux ;;
3492                 openbsd) osname=openbsd
3493                         osvers="$3"
3494                         ;;
3495                 os2)    osname=os2
3496                         osvers="$4"
3497                         ;;
3498                 POSIX-BC | posix-bc ) osname=posix-bc
3499                         osvers="$3"
3500                         ;;
3501                 powerux | power_ux | powermax_os | powermaxos | \
3502                 powerunix | power_unix) osname=powerux
3503                         osvers="$3"
3504                         ;;
3505                 qnx) osname=qnx
3506                         osvers="$4"
3507                         ;;
3508                 solaris) osname=solaris
3509                         case "$3" in
3510                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3511                         *)      osvers="$3" ;;
3512                         esac
3513                         ;;
3514                 sunos) osname=sunos
3515                         case "$3" in
3516                         5*) osname=solaris
3517                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3518                         *)      osvers="$3" ;;
3519                         esac
3520                         ;;
3521                 titanos) osname=titanos
3522                         case "$3" in
3523                         1*) osvers=1 ;;
3524                         2*) osvers=2 ;;
3525                         3*) osvers=3 ;;
3526                         4*) osvers=4 ;;
3527                         *)      osvers="$3" ;;
3528                         esac
3529                         ;;
3530                 ultrix) osname=ultrix
3531                         osvers="$3"
3532                         ;;
3533                 osf1|mls+)      case "$5" in
3534                                 alpha)
3535                                         osname=dec_osf
3536                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3537                                         case "$osvers" in
3538                                         [1-9].[0-9]*) ;;
3539                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3540                                         esac
3541                                         ;;
3542                         hp*)    osname=hp_osf1  ;;
3543                         mips)   osname=mips_osf1 ;;
3544                         esac
3545                         ;;
3546                 # UnixWare 7.1.2 is known as Open UNIX 8
3547                 openunix|unixware) osname=svr5
3548                         osvers="$4"
3549                         ;;
3550                 uts)    osname=uts
3551                         osvers="$3"
3552                         ;;
3553                 vos) osvers="$3"
3554                         ;;
3555                 $2) case "$osname" in
3556                         *isc*) ;;
3557                         *freebsd*) ;;
3558                         svr*)
3559                                 : svr4.x or possibly later
3560                                 case "svr$3" in
3561                                 ${osname}*)
3562                                         osname=svr$3
3563                                         osvers=$4
3564                                         ;;
3565                                 esac
3566                                 case "$osname" in
3567                                 svr4.0)
3568                                         : Check for ESIX
3569                                         if test -f /stand/boot ; then
3570                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3571                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3572                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3573                                                         if test -n "$isesix"; then
3574                                                                 osname=esix4
3575                                                         fi
3576                                                 fi
3577                                         fi
3578                                         ;;
3579                                 esac
3580                                 ;;
3581                         *)      if test -f /etc/systemid; then
3582                                         osname=sco
3583                                         set `echo $3 | $sed 's/\./ /g'` $4
3584                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3585                                                 osvers=$1.$2.$3
3586                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3587                                                 osvers=$1.$2
3588                                         elif $test -f $src/hints/sco_$1.sh; then
3589                                                 osvers=$1
3590                                         fi
3591                                 else
3592                                         case "$osname" in
3593                                         '') : Still unknown.  Probably a generic Sys V.
3594                                                 osname="sysv"
3595                                                 osvers="$3"
3596                                                 ;;
3597                                         esac
3598                                 fi
3599                                 ;;
3600                         esac
3601                         ;;
3602                 *)      case "$osname" in
3603                         '') : Still unknown.  Probably a generic BSD.
3604                                 osname="$1"
3605                                 osvers="$3"
3606                                 ;;
3607                         esac
3608                         ;;
3609                 esac
3610         else
3611                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3612                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3613                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3614                                 osname=news_os
3615                         fi
3616                         $rm -f UU/kernel.what
3617                 elif test -d c:/. -o -n "$is_os2" ; then
3618                         set X $myuname
3619                         osname=os2
3620                         osvers="$5"
3621                 fi
3622         fi
3623
3624         case "$targetarch" in
3625         '') ;;
3626         *)  hostarch=$osname
3627             case "$targetarch" in
3628                 nto*|*-nto-*)
3629                     # Will load qnx.sh, which should change osname to nto
3630                     osname=qnx
3631                     osvers=''
3632                     ;;
3633                 *linux-android*)
3634                     # Catch arm-linux-androideabi, mipsel-linux-android,
3635                     # and i686-linux-android
3636                     osname=linux-android
3637                     osvers=''
3638                     ;;
3639                 *linux*)
3640                     # Something like arm-linux-gnueabihf is really just
3641                     # plain linux.
3642                     osname=linux
3643                     osvers=''
3644                     ;;
3645                 *solaris*|*sunos*)
3646                     osname=solaris
3647                     # XXX perhaps we should just assume
3648                     # osvers to be 2, or maybe take the value
3649                     # from targetarch. Using $run before the
3650                     # hints are run is somewhat icky.
3651                     set X `$run $uname -a 2>/dev/null`
3652                     shift
3653                     case "$3" in
3654                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3655                         *)  osvers="$3" ;;
3656                     esac
3657                     ;;
3658                 *)
3659                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3660                     osvers=''
3661                 ;;
3662             esac
3663             ;;
3664         esac
3665
3666         : Now look for a hint file osname_osvers, unless one has been
3667         : specified already.
3668         case "$hintfile" in
3669         ''|' ')
3670                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3671                 : Also try without trailing minor version numbers.
3672                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3673                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3674                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3675                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3676                 case "$file" in
3677                 '') dflt=none ;;
3678                 *)  case "$osvers" in
3679                         '') dflt=$file
3680                                 ;;
3681                         *)  if $test -f $src/hints/$file.sh ; then
3682                                         dflt=$file
3683                                 elif $test -f $src/hints/$xfile.sh ; then
3684                                         dflt=$xfile
3685                                 elif $test -f $src/hints/$xxfile.sh ; then
3686                                         dflt=$xxfile
3687                                 elif $test -f $src/hints/$xxxfile.sh ; then
3688                                         dflt=$xxxfile
3689                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3690                                         dflt=$xxxxfile
3691                                 elif $test -f "$src/hints/${osname}.sh" ; then
3692                                         dflt="${osname}"
3693                                 else
3694                                         dflt=none
3695                                 fi
3696                                 ;;
3697                         esac
3698                         ;;
3699                 esac
3700                 if $test -f Policy.sh ; then
3701                         case "$dflt" in
3702                         *Policy*) ;;
3703                         none) dflt="Policy" ;;
3704                         *) dflt="Policy $dflt" ;;
3705                         esac
3706                 fi
3707                 ;;
3708         *)
3709                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3710                 ;;
3711         esac
3712
3713         if $test -f Policy.sh ; then
3714                 $cat <<EOM
3715
3716 There's also a Policy hint file available, which should make the
3717 site-specific (policy) questions easier to answer.
3718 EOM
3719
3720         fi
3721
3722         $cat <<EOM
3723
3724 You may give one or more space-separated answers, or "none" if appropriate.
3725 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3726 previous run of Configure, you may specify it as well as or instead of
3727 OS-specific hints.  If hints are provided for your OS, you should use them:
3728 although Perl can probably be built without hints on many platforms, using
3729 hints often improve performance and may enable features that Configure can't
3730 set up on its own. If there are no hints that match your OS, specify "none";
3731 DO NOT give a wrong version or a wrong OS.
3732
3733 EOM
3734
3735         rp="Which of these apply, if any?"
3736         . UU/myread
3737         tans=$ans
3738         for file in $tans; do
3739                 if $test X$file = XPolicy -a -f Policy.sh; then
3740                         . Policy.sh
3741                         $cat Policy.sh >> UU/config.sh
3742                 elif $test -f $src/hints/$file.sh; then
3743                         . $src/hints/$file.sh
3744                         $cat $src/hints/$file.sh >> UU/config.sh
3745                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3746                         : nothing
3747                 else
3748                         : Give one chance to correct a possible typo.
3749                         echo "$file.sh does not exist"
3750                         dflt=$file
3751                         rp="hint to use instead?"
3752                         . UU/myread
3753                         for file in $ans; do
3754                                 if $test -f "$src/hints/$file.sh"; then
3755                                         . $src/hints/$file.sh
3756                                         $cat $src/hints/$file.sh >> UU/config.sh
3757                                 elif $test X$ans = X -o X$ans = Xnone ; then
3758                                         : nothing
3759                                 else
3760                                         echo "$file.sh does not exist -- ignored."
3761                                 fi
3762                         done
3763                 fi
3764         done
3765
3766         hint=recommended
3767         : Remember our hint file for later.
3768         if $test -f "$src/hints/$file.sh" ; then
3769                 hintfile="$file"
3770         else
3771                 hintfile=''
3772         fi
3773 fi
3774 cd UU
3775 ;;
3776 *)
3777         echo " "
3778         echo "Fetching default answers from $config_sh..." >&4
3779         tmp_n="$n"
3780         tmp_c="$c"
3781         cd ..
3782         cp $config_sh config.sh 2>/dev/null
3783         chmod +w config.sh
3784         . ./config.sh
3785         cd UU
3786         cp ../config.sh .
3787         n="$tmp_n"
3788         c="$tmp_c"
3789         hint=previous
3790         ;;
3791 esac
3792 test "$override" && . ./optdef.sh
3793
3794 : Restore computed paths
3795 for file in $loclist $trylist; do
3796         eval $file="\$_$file"
3797 done
3798
3799 cat << EOM
3800
3801 Configure uses the operating system name and version to set some defaults.
3802 The default value is probably right if the name rings a bell. Otherwise,
3803 since spelling matters for me, either accept the default or answer "none"
3804 to leave it blank.
3805
3806 EOM
3807 case "$osname" in
3808         ''|' ')
3809                 case "$hintfile" in
3810                 ''|' '|none) dflt=none ;;
3811                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3812                 esac
3813                 ;;
3814         *) dflt="$osname" ;;
3815 esac
3816 rp="Operating system name?"
3817 . ./myread
3818 case "$ans" in
3819 none)  osname='' ;;
3820 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3821 esac
3822 echo " "
3823 case "$osvers" in
3824         ''|' ')
3825                 case "$hintfile" in
3826                 ''|' '|none) dflt=none ;;
3827                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3828                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3829                         case "$dflt" in
3830                         ''|' ') dflt=none ;;
3831                         esac
3832                         ;;
3833                 esac
3834                 ;;
3835         *) dflt="$osvers" ;;
3836 esac
3837 rp="Operating system version?"
3838 . ./myread
3839 case "$ans" in
3840 none)  osvers='' ;;
3841 *) osvers="$ans" ;;
3842 esac
3843
3844
3845 . ./posthint.sh
3846
3847 : who configured the system
3848 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3849 case "$cf_by" in
3850 "")
3851         cf_by=`(logname) 2>/dev/null`
3852         case "$cf_by" in
3853         "")
3854                 cf_by=`(whoami) 2>/dev/null`
3855                 case "$cf_by" in
3856                 "") cf_by=unknown ;;
3857                 esac ;;
3858         esac ;;
3859 esac
3860
3861 : decide how portable to be.  Allow command line overrides.
3862 case "$d_portable" in
3863 "$undef") ;;
3864 *)      d_portable="$define" ;;
3865 esac
3866
3867 : set up shell script to do ~ expansion
3868 cat >filexp <<EOSS
3869 $startsh
3870 : expand filename
3871 case "\$1" in
3872  \~/*|\~)
3873         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3874         ;;
3875  \~*)
3876         if $test -f /bin/csh; then
3877                 /bin/csh -f -c "glob \$1"
3878                 failed=\$?
3879                 echo ""
3880                 exit \$failed
3881         else
3882                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3883                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3884                 if $test ! -d "\$dir"; then
3885                         me=\`basename \$0\`
3886                         echo "\$me: can't locate home directory for: \$name" >&2
3887                         exit 1
3888                 fi
3889                 case "\$1" in
3890                 */*)
3891                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3892                         ;;
3893                 *)
3894                         echo \$dir
3895                         ;;
3896                 esac
3897         fi
3898         ;;
3899 *)
3900         echo \$1
3901         ;;
3902 esac
3903 EOSS
3904 chmod +x filexp
3905 $eunicefix filexp
3906
3907 : now set up to get a file name
3908 cat <<EOS >getfile
3909 $startsh
3910 EOS
3911 cat <<'EOSC' >>getfile
3912 tilde=''
3913 fullpath=''
3914 already=''
3915 skip=''
3916 none_ok=''
3917 exp_file=''
3918 nopath_ok=''
3919 orig_rp="$rp"
3920 orig_dflt="$dflt"
3921 case "$gfpth" in
3922 '') gfpth='.' ;;
3923 esac
3924
3925 case "$fn" in
3926 *\(*)
3927         : getfile will accept an answer from the comma-separated list
3928         : enclosed in parentheses even if it does not meet other criteria.
3929         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3930         fn=`echo $fn | sed 's/(.*)//'`
3931         ;;
3932 esac
3933
3934 case "$fn" in
3935 *:*)
3936         loc_file=`expr $fn : '.*:\(.*\)'`
3937         fn=`expr $fn : '\(.*\):.*'`
3938         ;;
3939 esac
3940
3941 case "$fn" in
3942 *~*) tilde=true;;
3943 esac
3944 case "$fn" in
3945 */*) fullpath=true;;
3946 esac
3947 case "$fn" in
3948 *+*) skip=true;;
3949 esac
3950 case "$fn" in
3951 *n*) none_ok=true;;
3952 esac
3953 case "$fn" in
3954 *e*) exp_file=true;;
3955 esac
3956 case "$fn" in
3957 *p*) nopath_ok=true;;
3958 esac
3959
3960 case "$fn" in
3961 *f*) type='File';;
3962 *d*) type='Directory';;
3963 *l*) type='Locate';;
3964 esac
3965
3966 what="$type"
3967 case "$what" in
3968 Locate) what='File';;
3969 esac
3970
3971 case "$exp_file" in
3972 '')
3973         case "$d_portable" in
3974         "$define") ;;
3975         *) exp_file=true;;
3976         esac
3977         ;;
3978 esac
3979
3980 cd ..
3981 while test "$type"; do
3982         redo=''
3983         rp="$orig_rp"
3984         dflt="$orig_dflt"
3985         case "$tilde" in
3986         true) rp="$rp (~name ok)";;
3987         esac
3988         . UU/myread
3989         if test -f UU/getfile.ok && \
3990                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3991         then
3992                 value="$ans"
3993                 ansexp="$ans"
3994                 break
3995         fi
3996         case "$ans" in
3997         none)
3998                 value=''
3999                 ansexp=''
4000                 case "$none_ok" in
4001                 true) type='';;
4002                 esac
4003                 ;;
4004         *)
4005                 case "$tilde" in
4006                 '') value="$ans"
4007                         ansexp="$ans";;
4008                 *)
4009                         value=`UU/filexp $ans`
4010                         case $? in
4011                         0)
4012                                 if test "$ans" != "$value"; then
4013                                         echo "(That expands to $value on this system.)"
4014                                 fi
4015                                 ;;
4016                         *) value="$ans";;
4017                         esac
4018                         ansexp="$value"
4019                         case "$exp_file" in
4020                         '') value="$ans";;
4021                         esac
4022                         ;;
4023                 esac
4024                 case "$fullpath" in
4025                 true)
4026                         case "$ansexp" in
4027                         /*) value="$ansexp" ;;
4028                         [a-zA-Z]:/*) value="$ansexp" ;;
4029                         *)
4030                                 redo=true
4031                                 case "$already" in
4032                                 true)
4033                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4034                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4035                                         ;;
4036                                 *)
4037                                 echo "Please give a full path name, starting with slash." >&4
4038                                         case "$tilde" in
4039                                         true)
4040                                 echo "Note that using ~name is ok provided it expands well." >&4
4041                                                 already=true
4042                                                 ;;
4043                                         esac
4044                                 esac
4045                                 ;;
4046                         esac
4047                         ;;
4048                 esac
4049                 case "$redo" in
4050                 '')
4051                         case "$type" in
4052                         File)
4053                                 for fp in $gfpth; do
4054                                         if test "X$fp" = X.; then
4055                                             pf="$ansexp"
4056                                         else    
4057                                             pf="$fp/$ansexp"
4058                                         fi
4059                                         if test -f "$pf"; then
4060                                                 type=''
4061                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4062                                         then
4063                                                 echo "($value is not a plain file, but that's ok.)"
4064                                                 type=''
4065                                         fi
4066                                         if test X"$type" = X; then
4067                                             value="$pf"
4068                                             break
4069                                         fi
4070                                 done
4071                                 ;;
4072                         Directory)
4073                                 for fp in $gfpth; do
4074                                         if test "X$fp" = X.; then
4075                                             dir="$ans"
4076                                             direxp="$ansexp"
4077                                         else    
4078                                             dir="$fp/$ansexp"
4079                                             direxp="$fp/$ansexp"
4080                                         fi
4081                                         if test -d "$direxp"; then
4082                                                 type=''
4083                                                 value="$dir"
4084                                                 break
4085                                         fi
4086                                 done
4087                                 ;;
4088                         Locate)
4089                                 if test -d "$ansexp"; then
4090                                         echo "(Looking for $loc_file in directory $value.)"
4091                                         value="$value/$loc_file"
4092                                         ansexp="$ansexp/$loc_file"
4093                                 fi
4094                                 if test -f "$ansexp"; then
4095                                         type=''
4096                                 fi
4097                                 case "$nopath_ok" in
4098                                 true)   case "$value" in
4099                                         */*) ;;
4100                                         *)      echo "Assuming $value will be in people's path."
4101                                                 type=''
4102                                                 ;;
4103                                         esac
4104                                         ;;
4105                                 esac
4106                                 ;;
4107                         esac
4108
4109                         case "$skip" in
4110                         true) type='';
4111                         esac
4112
4113                         case "$type" in
4114                         '') ;;
4115                         *)
4116                                 if test "$fastread" = yes; then
4117                                         dflt=y
4118                                 else
4119                                         dflt=n
4120                                 fi
4121                                 rp="$what $value doesn't exist.  Use that name anyway?"
4122                                 . UU/myread
4123                                 dflt=''
4124                                 case "$ans" in
4125                                 y*) type='';;
4126                                 *) echo " ";;
4127                                 esac
4128                                 ;;
4129                         esac
4130                         ;;
4131                 esac
4132                 ;;
4133         esac
4134 done
4135 cd UU
4136 ans="$value"
4137 rp="$orig_rp"
4138 dflt="$orig_dflt"
4139 rm -f getfile.ok
4140 test "X$gfpthkeep" != Xy && gfpth=""
4141 EOSC
4142
4143 : determine root of directory hierarchy where package will be installed.
4144 case "$prefix" in
4145 '')
4146         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4147         ;;
4148 *?/)
4149         dflt=`echo "$prefix" | sed 's/.$//'`
4150         ;;
4151 *)
4152         dflt="$prefix"
4153         ;;
4154 esac
4155 $cat <<EOM
4156
4157 By default, $package will be installed in $dflt/bin, manual pages
4158 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4159 installation directories. Typically this is something like /usr/local.
4160 If you wish to have binaries under /usr/bin but other parts of the
4161 installation under /usr/local, that's ok: you will be prompted
4162 separately for each of the installation directories, the prefix being
4163 only used to set the defaults.
4164
4165 EOM
4166 fn=d~
4167 rp='Installation prefix to use?'
4168 . ./getfile
4169 oldprefix=''
4170 case "$prefix" in
4171 '') ;;
4172 *)
4173         case "$ans" in
4174         "$prefix") ;;
4175         *) oldprefix="$prefix";;
4176         esac
4177         ;;
4178 esac
4179 prefix="$ans"
4180 prefixexp="$ansexp"
4181
4182 : allow them to override the AFS root
4183 case "$afsroot" in
4184 '')     afsroot=/afs ;;
4185 *)      afsroot=$afsroot ;;
4186 esac
4187
4188 : is AFS running?
4189 echo " "
4190 case "$afs" in
4191 $define|true)   afs=true ;;
4192 $undef|false)   afs=false ;;
4193 *)      if $test -d $afsroot; then
4194                 afs=true
4195         else
4196                 afs=false
4197         fi
4198         ;;
4199 esac
4200 if $afs; then
4201         echo "AFS may be running... I'll be extra cautious then..." >&4
4202 else
4203         echo "AFS does not seem to be running..." >&4
4204 fi
4205
4206 : determine installation prefix for where package is to be installed.
4207 if $afs; then
4208 $cat <<EOM
4209
4210 Since you are running AFS, I need to distinguish the directory in which
4211 files will reside from the directory in which they are installed (and from
4212 which they are presumably copied to the former directory by occult means).
4213
4214 EOM
4215         case "$installprefix" in
4216         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4217         *) dflt="$installprefix";;
4218         esac
4219 else
4220 $cat <<EOM
4221
4222 In some special cases, particularly when building $package for distribution,
4223 it is convenient to distinguish the directory in which files should be
4224 installed from the directory ($prefix) in which they will
4225 eventually reside.  For most users, these two directories are the same.
4226
4227 EOM
4228         case "$installprefix" in
4229         '') dflt=$prefix ;;
4230         *) dflt=$installprefix;;
4231         esac
4232 fi
4233 fn=d~
4234 rp='What installation prefix should I use for installing files?'
4235 . ./getfile
4236 installprefix="$ans"
4237 installprefixexp="$ansexp"
4238
4239 : Perform the prefixexp/installprefixexp correction if necessary
4240 cat <<EOS >installprefix
4241 $startsh
4242 EOS
4243 cat <<'EOSC' >>installprefix
4244 : Change installation prefix, if necessary.
4245 if $test X"$prefix" != X"$installprefix"; then
4246     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4247 else
4248     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4249 fi
4250 EOSC
4251 chmod +x installprefix
4252 $eunicefix installprefix
4253
4254 : Set variables such as privlib and privlibexp from the output of ./getfile
4255 : performing the prefixexp/installprefixexp correction if necessary.
4256 cat <<EOS >setprefixvar
4257 $startsh
4258 EOS
4259 cat <<'EOSC' >>setprefixvar
4260 eval "${prefixvar}=\"\$ans\""
4261 eval "${prefixvar}exp=\"\$ansexp\""
4262 . ./installprefix
4263 EOSC
4264 chmod +x setprefixvar
4265 $eunicefix setprefixvar
4266
4267 : set up the script used to warn in case of inconsistency
4268 cat <<EOS >whoa
4269 $startsh
4270 EOS
4271 cat <<'EOSC' >>whoa
4272 dflt=y
4273 case "$hint" in
4274     recommended)
4275         case "$hintfile" in
4276         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4277                 ;;
4278         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4279                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4280                 ;;
4281         esac
4282         ;;
4283     *)  echo " "
4284         echo "*** WHOA THERE!!! ***" >&4
4285         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4286         ;;
4287 esac
4288 rp="    Keep the $hint value?"
4289 . ./myread
4290 case "$ans" in
4291 y) td=$was; tu=$was;;
4292 esac
4293 EOSC
4294
4295 : function used to set '$1' to '$val'
4296 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4297 case "$val$was" in
4298 $define$undef) . ./whoa; eval "$var=\$td";;
4299 $undef$define) . ./whoa; eval "$var=\$tu";;
4300 *) eval "$var=$val";;
4301 esac'
4302
4303 : get the patchlevel
4304 echo " "
4305 echo "Getting the current patchlevel..." >&4
4306 if $test -r $rsrc/patchlevel.h;then
4307         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4308         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4309         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4310         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4311         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4312         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4313         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4314 else
4315         revision=0
4316         patchlevel=0
4317         subversion=0
4318         api_revision=0
4319         api_version=0
4320         api_subversion=0
4321         perl_patchlevel=0
4322         $echo "(You do not have patchlevel.h.  Eek.)"
4323 fi
4324 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4325 version_patchlevel_string="version $patchlevel subversion $subversion"
4326 case "$perl_patchlevel" in
4327 0|'') ;;
4328 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4329     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4330     ;;
4331 esac
4332
4333 $echo "(You have $package $version_patchlevel_string.)"
4334
4335 case "$osname" in
4336 dos|vms)
4337         : XXX Should be a Configure test for double-dots in filenames.
4338         version=`echo $revision $patchlevel $subversion | \
4339                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4340         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4341                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4342         ;;
4343 *)
4344         version=`echo $revision $patchlevel $subversion | \
4345                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4346         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4347                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4348         ;;
4349 esac
4350 : Special case the 5.005_xx maintenance series, which used 5.005
4351 : without any subversion label as a subdirectory in $sitelib
4352 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4353         api_versionstring='5.005'
4354 fi
4355
4356 : Do we want threads support and if so, what type
4357 case "$usethreads" in
4358 $define|true|[yY]*)     dflt='y';;
4359 *)     # Catch case where user specified ithreads or 5005threads but
4360        # forgot -Dusethreads (A.D. 4/2002)
4361        case "$useithreads$use5005threads" in
4362        *$define*)       dflt='y';;
4363        *)               dflt='n';;
4364        esac
4365        ;;
4366 esac
4367 cat <<EOM
4368
4369 Perl can be built to offer a form of threading support on some systems
4370 To do so, Configure can be run with -Dusethreads.
4371
4372 Note that Perl built with threading support runs slightly slower
4373 and uses slightly more memory than plain Perl.
4374
4375 If this doesn't make any sense to you, just accept the default '$dflt'.
4376 EOM
4377 rp='Build a threading Perl?'
4378 . ./myread
4379 case "$ans" in
4380 y|Y)    val="$define" ;;
4381 *)      val="$undef" ;;
4382 esac
4383 set usethreads
4384 eval $setvar
4385
4386 if $test $patchlevel -lt 9; then
4387     case "$usethreads" in
4388     $define)
4389         : Default to ithreads unless overridden on command line or with
4390         : old config.sh
4391         dflt='y'
4392         case "$use5005threads" in
4393                 $define|true|[yY]*)
4394                         echo "5.005 threads are no longer supported"
4395                         exit 1
4396                 ;;
4397         esac
4398         case "$useithreads" in
4399                 $undef|false|[nN]*) dflt='n';;
4400         esac
4401         rp='Use the newer interpreter-based ithreads?'
4402         . ./myread
4403         case "$ans" in
4404         y|Y)    val="$define" ;;
4405         *)      val="$undef" ;;
4406         esac
4407         set useithreads
4408         eval $setvar
4409         : Now set use5005threads to the opposite value.
4410         case "$useithreads" in
4411         $define) val="$undef" ;;
4412         *) val="$define" ;;
4413         esac
4414         set use5005threads
4415         eval $setvar
4416         ;;
4417     *)
4418         useithreads="$undef"
4419         use5005threads="$undef"
4420         ;;
4421     esac
4422
4423     case "$useithreads$use5005threads" in
4424     "$define$define")
4425         $cat >&4 <<EOM
4426
4427 You cannot have both the ithreads and the 5.005 threads enabled
4428 at the same time.  Disabling the 5.005 threads since they are
4429 much less stable than the ithreads.
4430
4431 EOM
4432         use5005threads="$undef"
4433         ;;
4434     esac
4435
4436 else
4437 : perl-5.9.x and later
4438
4439     if test X"$usethreads" = "X$define"; then
4440         case "$use5005threads" in
4441             $define|true|[yY]*)
4442                 $cat >&4 <<EOM
4443
4444 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4445
4446 EOM
4447             ;;
4448         esac
4449     fi
4450
4451     use5005threads="$undef"
4452     useithreads="$usethreads"
4453 fi
4454
4455 case "$d_oldpthreads" in
4456 '')     : Configure tests would be welcome here.  For now, assume undef.
4457         val="$undef" ;;
4458 *)      val="$d_oldpthreads" ;;
4459 esac
4460 set d_oldpthreads
4461 eval $setvar
4462
4463
4464 : Look for a hint-file generated 'call-back-unit'.  If the
4465 : user has specified that a threading perl is to be built,
4466 : we may need to set or change some other defaults.
4467 if $test -f usethreads.cbu; then
4468     echo "Your platform has some specific hints regarding threaded builds, using them..."
4469     . ./usethreads.cbu
4470 else
4471     case "$usethreads" in
4472         "$define"|true|[yY]*)
4473                 $cat <<EOM
4474 (Your platform does not have any specific hints for threaded builds.
4475  Assuming POSIX threads, then.)
4476 EOM
4477         ;;
4478     esac
4479 fi
4480
4481 : Check if multiplicity is required
4482 cat <<EOM
4483
4484 Perl can be built so that multiple Perl interpreters can coexist
4485 within the same Perl executable.
4486 EOM
4487
4488 case "$useithreads" in
4489 $define)
4490         cat <<EOM
4491 This multiple interpreter support is required for interpreter-based threads.
4492 EOM
4493         val="$define"
4494         ;;
4495 *)      case "$usemultiplicity" in
4496         $define|true|[yY]*)     dflt='y';;
4497         *) dflt='n';;
4498         esac
4499         echo " "
4500         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4501         rp='Build Perl for multiplicity?'
4502         . ./myread
4503         case "$ans" in
4504         y|Y)    val="$define" ;;
4505         *)      val="$undef" ;;
4506         esac
4507         ;;
4508 esac
4509 set usemultiplicity
4510 eval $setvar
4511
4512 : Check if morebits is requested
4513 case "$usemorebits" in
4514 "$define"|true|[yY]*)
4515         use64bitint="$define"
4516         uselongdouble="$define"
4517         usemorebits="$define"
4518         ;;
4519 *)      usemorebits="$undef"
4520         ;;
4521 esac
4522
4523 : Determine the C compiler to be used
4524 echo " "
4525 case "$cc" in
4526 '') dflt=cc;;
4527 *) dflt="$cc";;
4528 esac
4529 rp="Use which C compiler?"
4530 . ./myread
4531 cc="$ans"
4532
4533 : See whether they have no cc but they do have gcc
4534 . ./trygcc
4535 if $test -f cc.cbu; then
4536     . ./cc.cbu
4537 fi
4538 . ./checkcc
4539
4540 : make some quick guesses about what we are up against
4541 echo " "
4542 $echo $n "Hmm...  $c"
4543 echo exit 1 >bsd
4544 echo exit 1 >usg
4545 echo exit 1 >v7
4546 echo exit 1 >osf1
4547 echo exit 1 >eunice
4548 echo exit 1 >xenix
4549 echo exit 1 >venix
4550 echo exit 1 >os2
4551 d_bsd="$undef"
4552 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4553 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4554 then
4555         echo "Looks kind of like an OSF/1 system, but we'll see..."
4556         echo exit 0 >osf1
4557 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4558         xxx=`./loc addbib blurfl $pth`
4559         if $test -f $xxx; then
4560         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4561                 echo exit 0 >bsd
4562                 echo exit 0 >usg
4563         else
4564                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4565                         echo "Looks kind of like an extended USG system, but we'll see..."
4566                 else
4567                         echo "Looks kind of like a USG system, but we'll see..."
4568                 fi
4569                 echo exit 0 >usg
4570         fi
4571 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4572         echo "Looks kind of like a BSD system, but we'll see..."
4573         d_bsd="$define"
4574         echo exit 0 >bsd
4575 else
4576         echo "Looks kind of like a Version 7 system, but we'll see..."
4577         echo exit 0 >v7
4578 fi
4579 case "$eunicefix" in
4580 *unixtovms*)
4581         $cat <<'EOI'
4582 There is, however, a strange, musty smell in the air that reminds me of
4583 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4584 EOI
4585         echo exit 0 >eunice
4586         d_eunice="$define"
4587 : it so happens the Eunice I know will not run shell scripts in Unix format
4588         ;;
4589 *)
4590         echo " "
4591         echo "Congratulations.  You aren't running Eunice."
4592         d_eunice="$undef"
4593         ;;
4594 esac
4595 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4596 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4597 : semicolon as a patch separator
4598 case "$p_" in
4599 :) ;;
4600 *)
4601         $cat <<'EOI'
4602 I have the feeling something is not exactly right, however...don't tell me...
4603 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4604 (Or you may be running DOS with DJGPP.)
4605 EOI
4606         echo exit 0 >os2
4607         ;;
4608 esac
4609 if test -f /xenix; then
4610         echo "Actually, this looks more like a XENIX system..."
4611         echo exit 0 >xenix
4612         d_xenix="$define"
4613 else
4614         echo " "
4615         echo "It's not Xenix..."
4616         d_xenix="$undef"
4617 fi
4618 chmod +x xenix
4619 $eunicefix xenix
4620 if test -f /venix; then
4621         echo "Actually, this looks more like a VENIX system..."
4622         echo exit 0 >venix
4623 else
4624         echo " "
4625         if ./xenix; then
4626                 : null
4627         else
4628                 echo "Nor is it Venix..."
4629         fi
4630 fi
4631 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4632 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4633 $rm -f foo
4634
4635 : Check if we are using GNU gcc and what its version is
4636 echo " "
4637 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4638 $cat >try.c <<EOM
4639 #include <stdio.h>
4640 int main() {
4641 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4642 #ifdef __VERSION__
4643         printf("%s\n", __VERSION__);
4644 #else
4645         printf("%s\n", "1");
4646 #endif
4647 #endif
4648         return(0);
4649 }
4650 EOM
4651 if $cc -o try $ccflags $ldflags try.c; then
4652         gccversion=`$run ./try`
4653         case "$gccversion" in
4654         '') echo "You are not using GNU cc." ;;
4655         *)  echo "You are using GNU cc $gccversion."
4656             ccname=gcc
4657             ;;
4658         esac
4659 else
4660         echo " "
4661         echo "*** WHOA THERE!!! ***" >&4
4662         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4663         case "$knowitall" in
4664         '')
4665         echo "    You'd better start hunting for one and let me know about it." >&4
4666                 exit 1
4667                 ;;
4668         esac
4669 fi
4670 $rm -f try try.*
4671 case "$gccversion" in
4672 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4673 esac
4674 case "$gccversion" in
4675 '') gccosandvers='' ;;
4676 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4677    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4678    gccshortvers=''
4679    case "$gccosandvers" in
4680    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4681    $osname$osvers) ;; # looking good
4682    $osname*) cat <<EOM >&4
4683
4684 *** WHOA THERE!!! ***
4685
4686     Your gcc has not been compiled for the exact release of
4687     your operating system ($gccosandvers versus $osname$osvers).
4688
4689     In general it is a good idea to keep gcc synchronized with
4690     the operating system because otherwise serious problems
4691     may ensue when trying to compile software, like Perl.
4692
4693     I'm trying to be optimistic here, though, and will continue.
4694     If later during the configuration and build icky compilation
4695     problems appear (headerfile conflicts being the most common
4696     manifestation), I suggest reinstalling the gcc to match
4697     your operating system release.
4698
4699 EOM
4700       ;;
4701    *) gccosandvers='' ;; # failed to parse, better be silent
4702    esac
4703    ;;
4704 esac
4705 case "$ccname" in
4706 '') ccname="$cc" ;;
4707 esac
4708
4709 # gcc 3.* complain about adding -Idirectories that they already know about,
4710 # so we will take those off from locincpth.
4711 case "$gccversion" in
4712 3*)
4713     echo "main(){}">try.c
4714     for incdir in $locincpth; do
4715        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4716              grep '^c[cp]p*[01]: warning: changing search order '`
4717        if test "X$warn" != X; then
4718            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4719        fi
4720     done
4721     $rm -f try try.*
4722 esac
4723
4724 # gcc 4.9 by default does some optimizations that break perl.
4725 # see ticket 121505.
4726 #
4727 # The -fwrapv disables those optimizations (and probably others,) so
4728 # for gcc 4.9 (and later, since the optimizations probably won't go
4729 # away), add -fwrapv unless the user requests -fno-wrapv, which
4730 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4731 # which turns the overflows -fwrapv ignores into runtime errors.
4732 case "$gccversion" in
4733 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4734     case "$ccflags" in
4735     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4736     *) ccflags="$ccflags -fwrapv" ;;
4737     esac
4738 esac
4739
4740 : What should the include directory be ?
4741 : Use sysroot if set, so findhdr looks in the right place.
4742 echo " "
4743 $echo $n "Hmm...  $c"
4744 dflt="$sysroot/usr/include"
4745 incpath=''
4746 mips_type=''
4747 if $test -f /bin/mips && /bin/mips; then
4748         echo "Looks like a MIPS system..."
4749         $cat >usr.c <<'EOCP'
4750 #ifdef SYSTYPE_BSD43
4751 /bsd43
4752 #endif
4753 EOCP
4754         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4755                 dflt='/bsd43/usr/include'
4756                 incpath='/bsd43'
4757                 mips_type='BSD 4.3'
4758         else
4759                 mips_type='System V'
4760         fi
4761         $rm -f usr.c usr.out
4762         echo "and you're compiling with the $mips_type compiler and libraries."
4763         xxx_prompt=y
4764         echo "exit 0" >mips
4765 else
4766         echo "Doesn't look like a MIPS system."
4767         xxx_prompt=n
4768         echo "exit 1" >mips
4769 fi
4770 chmod +x mips
4771 $eunicefix mips
4772 case "$usrinc" in
4773 '') ;;
4774 *) dflt="$usrinc";;
4775 esac
4776 case "$xxx_prompt" in
4777 y)      fn=d/
4778         echo " "
4779         rp='Where are the include files you want to use?'
4780         . ./getfile
4781         usrinc="$ans"
4782         ;;
4783 *)      usrinc="$dflt"
4784         ;;
4785 esac
4786
4787 : see how we invoke the C preprocessor
4788 echo " "
4789 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4790 cat <<'EOT' >testcpp.c
4791 #define ABC abc
4792 #define XYZ xyz
4793 ABC.XYZ
4794 EOT
4795 cd ..
4796 if test ! -f cppstdin; then
4797         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4798                 # AIX cc -E doesn't show the absolute headerfile
4799                 # locations but we'll cheat by using the -M flag.
4800                 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
4801         else
4802                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4803         fi
4804 else
4805         echo "Keeping your $hint cppstdin wrapper."
4806 fi
4807 chmod 755 cppstdin
4808 wrapper=`pwd`/cppstdin
4809 ok='false'
4810 cd UU
4811
4812 if $test "X$cppstdin" != "X" && \
4813         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4814         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4815 then
4816         echo "You used to use $cppstdin $cppminus so we'll use that again."
4817         case "$cpprun" in
4818         '') echo "But let's see if we can live without a wrapper..." ;;
4819         *)
4820                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4821                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4822                 then
4823                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4824                         ok='true'
4825                 else
4826                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4827                 fi
4828                 ;;
4829         esac
4830 else
4831         case "$cppstdin" in
4832         '') ;;
4833         *)
4834                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4835                 ;;
4836         esac
4837 fi
4838
4839 if $ok; then
4840         : nothing
4841 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4842         $cc -E <testcpp.c >testcpp.out 2>&1; \
4843         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4844         echo "Yup, it does."
4845         x_cpp="$cc $cppflags -E"
4846         x_minus='';
4847 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4848         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4849         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4850         echo "Yup, it does."
4851         x_cpp="$cc $cppflags -E"
4852         x_minus='-';
4853 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4854         $cc -P <testcpp.c >testcpp.out 2>&1; \
4855         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4856         echo "Yipee, that works!"
4857         x_cpp="$cc $cppflags -P"
4858         x_minus='';
4859 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4860         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4861         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4862         echo "At long last!"
4863         x_cpp="$cc $cppflags -P"
4864         x_minus='-';
4865 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4866         $cpp <testcpp.c >testcpp.out 2>&1; \
4867         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4868         echo "It works!"
4869         x_cpp="$cpp $cppflags"
4870         x_minus='';
4871 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4872         $cpp - <testcpp.c >testcpp.out 2>&1; \
4873         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4874         echo "Hooray, it works!  I was beginning to wonder."
4875         x_cpp="$cpp $cppflags"
4876         x_minus='-';
4877 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4878         $wrapper <testcpp.c >testcpp.out 2>&1; \
4879         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4880         x_cpp="$wrapper"
4881         x_minus=''
4882         echo "Eureka!"
4883 else
4884         dflt=''
4885         rp="No dice.  I can't find a C preprocessor.  Name one:"
4886         . ./myread
4887         x_cpp="$ans"
4888         x_minus=''
4889         $x_cpp <testcpp.c >testcpp.out 2>&1
4890         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4891                 echo "OK, that will do." >&4
4892         else
4893 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4894                 exit 1
4895         fi
4896 fi
4897
4898 case "$ok" in
4899 false)
4900         cppstdin="$x_cpp"
4901         cppminus="$x_minus"
4902         cpprun="$x_cpp"
4903         cpplast="$x_minus"
4904         set X $x_cpp
4905         shift
4906         case "$1" in
4907         "$cpp")
4908                 echo "Perhaps can we force $cc -E using a wrapper..."
4909                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4910                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4911                 then
4912                         echo "Yup, we can."
4913                         cppstdin="$wrapper"
4914                         cppminus='';
4915                 else
4916                         echo "Nope, we'll have to live without it..."
4917                 fi
4918                 ;;
4919         esac
4920         case "$cpprun" in
4921         "$wrapper")
4922                 cpprun=''
4923                 cpplast=''
4924                 ;;
4925         esac
4926         ;;
4927 esac
4928
4929 case "$cppstdin" in
4930 "$wrapper"|'cppstdin') ;;
4931 *) $rm -f $wrapper;;
4932 esac
4933 $rm -f testcpp.c testcpp.out
4934
4935 : Adjust cppfilter for path component separator
4936 case "$osname" in
4937 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4938 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4939 *)   cppfilter='' ;;
4940 esac
4941
4942 : Use gcc to determine libpth and incpth
4943 # If using gcc or clang, we can get better values for libpth, incpth
4944 # and usrinc directly from the compiler.
4945 # Note that ccname for clang is also gcc.
4946 case "$ccname" in
4947     gcc)
4948         $echo 'extern int foo;' > try.c
4949         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4950         shift
4951         if $test $# -gt 0; then
4952             incpth="$incpth $*"
4953             incpth="`$echo $incpth|$sed 's/^ //'`"
4954             for i in $*; do
4955                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4956                 if $test -d $j; then
4957                     libpth="$libpth $j"
4958                 fi
4959             done
4960             libpth="`$echo $libpth|$sed 's/^ //'`"
4961             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4962                 if $test -d $xxx; then
4963                     case " $libpth " in
4964                     *" $xxx "*) ;;
4965                     *) libpth="$libpth $xxx";;
4966                     esac
4967                 fi
4968             done
4969         fi
4970         $rm -f try.c
4971         case "$usrinc" in
4972         '') for i in $incpth; do
4973                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4974                     usrinc="$i"
4975                     break
4976                 fi
4977             done
4978             ;;
4979         esac
4980
4981         case "$usecrosscompile" in
4982         $define|true|[yY]*)
4983             case "$incpth" in
4984                 '') echo "Incpth not defined." >&4; croak=y ;;
4985                 *)  echo "Using incpth '$incpth'." >&4 ;;
4986             esac
4987             case "$libpth" in
4988                 '') echo "Libpth not defined." >&4; croak=y ;;
4989                 *)  echo "Using libpth '$libpth'." >&4 ;;
4990             esac
4991             case "$usrinc" in
4992                 '') echo "Usrinc not defined." >&4; croak=y ;;
4993                 *)  echo "Using usrinc $usrinc." >&4 ;;
4994             esac
4995             case "$croak" in
4996                 y)
4997                 if test "X$sysroot" = X; then
4998                     echo "Cannot continue, aborting." >&4; exit 1
4999                 else
5000                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5001                 fi
5002                 ;;
5003             esac
5004             ;;
5005         esac
5006     ;;
5007 esac
5008
5009 : Default value for incpth is just usrinc
5010 case "$incpth" in
5011 '') incpth="$usrinc";;
5012 esac
5013
5014 : Set private lib path
5015 case "$plibpth" in
5016 '') if ./mips; then
5017         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5018     fi;;
5019 esac
5020 case "$libpth" in
5021 ' ') dlist='';;
5022 '') dlist="$loclibpth $plibpth $glibpth";;
5023 *) dlist="$libpth";;
5024 esac
5025
5026 : Now check and see which directories actually exist, avoiding duplicates
5027 for xxx in $dlist
5028 do
5029     if $test -d $xxx; then
5030                 case " $libpth " in
5031                 *" $xxx "*) ;;
5032                 *) libpth="$libpth $xxx";;
5033                 esac
5034     fi
5035 done
5036 $cat <<'EOM'
5037
5038 Some systems have incompatible or broken versions of libraries.  Among
5039 the directories listed in the question below, please remove any you
5040 know not to be holding relevant libraries, and add any that are needed.
5041 Say "none" for none.
5042
5043 EOM
5044
5045 if test "X$sysroot" != X; then
5046     $cat <<EOM
5047 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5048
5049 EOM
5050 fi
5051
5052 case "$libpth" in
5053 '') dflt='none';;
5054 *)
5055         set X $libpth
5056         shift
5057         dflt=${1+"$@"}
5058         ;;
5059 esac
5060 rp="Directories to use for library searches?"
5061 . ./myread
5062 case "$ans" in
5063 none) libpth=' ';;
5064 *) libpth="$ans";;
5065 esac
5066
5067 : compute shared library extension
5068 case "$so" in
5069 '')
5070         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5071                 dflt='sl'
5072         else
5073                 dflt='so'
5074         fi
5075         ;;
5076 *) dflt="$so";;
5077 esac
5078 $cat <<EOM
5079
5080 On some systems, shared libraries may be available.  Answer 'none' if
5081 you want to suppress searching of shared libraries for the remainder
5082 of this configuration.
5083
5084 EOM
5085 rp='What is the file extension used for shared libraries?'
5086 . ./myread
5087 so="$ans"
5088
5089 : Does target system insist that shared library basenames are unique
5090 $cat << EOM
5091
5092 Some dynamic loaders assume that the *basename* of shared library filenames
5093 are globally unique.  We'll default this to undef as we assume your system
5094 is not this weird. Set to defined if you're on one of them.
5095
5096 EOM
5097
5098 dflt='n'
5099 rp='Make shared library basenames unique?'
5100 . ./myread
5101 case "$ans" in
5102 y|Y) val="$define" ;;
5103 *)   val="$undef"  ;;
5104 esac
5105 set d_libname_unique
5106 eval $setvar
5107
5108 : Define several unixisms.
5109 : Hints files or command line option can be used to override them.
5110 : The convoluted testing is in case hints files set either the old
5111 : or the new name.
5112 case "$_exe" in
5113 '')     case "$exe_ext" in
5114         '')     ;;
5115         *)      _exe="$exe_ext" ;;
5116         esac
5117         ;;
5118 esac
5119 case "$_a" in
5120 '')     case "$lib_ext" in
5121     '') _a='.a';;
5122         *)      _a="$lib_ext" ;;
5123         esac
5124         ;;
5125 esac
5126 case "$_o" in
5127 '') case "$obj_ext" in
5128         '')     _o='.o';;
5129         *)      _o="$obj_ext";;
5130         esac
5131         ;;
5132 esac
5133 case "$p_" in
5134 '') case "$path_sep" in
5135         '')     p_=':';;
5136         *)      p_="$path_sep";;
5137         esac
5138         ;;
5139 esac
5140 exe_ext=$_exe
5141 lib_ext=$_a
5142 obj_ext=$_o
5143 path_sep=$p_
5144
5145 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5146
5147 : Which makefile gets called first.  This is used by make depend.
5148 case "$firstmakefile" in
5149 '') firstmakefile='makefile';;
5150 esac
5151
5152 : Check is we will use socks
5153 case "$usesocks" in
5154 $define|true|[yY]*)     dflt='y';;
5155 *) dflt='n';;
5156 esac
5157 cat <<EOM
5158
5159 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5160 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5161 to use the PerlIO abstraction layer, this will be implicitly selected.
5162
5163 If this doesn't make any sense to you, just accept the default '$dflt'.
5164 EOM
5165 rp='Build Perl for SOCKS?'
5166 . ./myread
5167 case "$ans" in
5168 y|Y)    val="$define" ;;
5169 *)      val="$undef" ;;
5170 esac
5171 set usesocks
5172 eval $setvar
5173
5174 : Check for uselongdouble support
5175 case "$ccflags" in
5176 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5177 esac
5178
5179 case "$uselongdouble" in
5180 $define|true|[yY]*)     dflt='y';;
5181 *) dflt='n';;
5182 esac
5183 cat <<EOM
5184
5185 Perl can be built to take advantage of long doubles which
5186 (if available) may give more accuracy and range for floating point numbers.
5187
5188 If this doesn't make any sense to you, just accept the default '$dflt'.
5189 EOM
5190 rp='Try to use long doubles if available?'
5191 . ./myread
5192 case "$ans" in
5193 y|Y)    val="$define"   ;;
5194 *)      val="$undef"    ;;
5195 esac
5196 set uselongdouble
5197 eval $setvar
5198
5199 case "$uselongdouble" in
5200 true|[yY]*) uselongdouble="$define" ;;
5201 esac
5202
5203 : Look for a hint-file generated 'call-back-unit'.  If the
5204 : user has specified that long doubles should be used,
5205 : we may need to set or change some other defaults.
5206 if $test -f uselongdouble.cbu; then
5207     echo "Your platform has some specific hints regarding long doubles, using them..."
5208     . ./uselongdouble.cbu
5209 else
5210     case "$uselongdouble" in
5211         $define)
5212                 $cat <<EOM
5213 (Your platform does not have any specific hints for long doubles.)
5214 EOM
5215         ;;
5216     esac
5217 fi
5218
5219 : Check if quadmath is requested
5220 case "$usequadmath" in
5221 "$define"|true|[yY]*) usequadmath="$define" ;;
5222 *)                    usequadmath="$undef"  ;;
5223 esac
5224
5225 : Looking for optional libraries
5226 echo " "
5227 echo "Checking for optional libraries..." >&4
5228 case "$libs" in
5229 ' '|'') dflt='';;
5230 *) dflt="$libs";;
5231 esac
5232 case "$libswanted" in
5233 '') libswanted='c_s';;
5234 esac
5235 case "$usesocks" in
5236 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5237 esac
5238 case "$usecbacktrace" in
5239 "$define") libswanted="$libswanted bfd" ;;
5240 esac
5241 case "$usequadmath" in
5242 "$define") libswanted="$libswanted quadmath" ;;
5243 esac
5244 libsfound=''
5245 libsfiles=''
5246 libsdirs=''
5247 libspath=''
5248 for thisdir in $libpth $xlibpth; do
5249   test -d $thisdir && libspath="$libspath $thisdir"
5250 done
5251 for thislib in $libswanted; do
5252         for thisdir in $libspath; do
5253             xxx=''
5254             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5255                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5256                 $test -f "$xxx" && eval $libscheck
5257                 $test -f "$xxx" && libstyle=shared
5258                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5259                 $test -f "$xxx" && eval $libscheck
5260                 $test -f "$xxx" && libstyle=shared
5261             fi
5262             if test ! -f "$xxx"; then
5263                 xxx=$thisdir/lib$thislib.$so
5264                 $test -f "$xxx" && eval $libscheck
5265                 $test -f "$xxx" && libstyle=shared
5266             fi
5267             if test ! -f "$xxx"; then
5268                 xxx=$thisdir/lib$thislib$_a
5269                 $test -f "$xxx" && eval $libscheck
5270                 $test -f "$xxx" && libstyle=static
5271             fi
5272             if test ! -f "$xxx"; then
5273                 xxx=$thisdir/$thislib$_a
5274                 $test -f "$xxx" && eval $libscheck
5275                 $test -f "$xxx" && libstyle=static
5276             fi
5277             if test ! -f "$xxx"; then
5278                 xxx=$thisdir/lib${thislib}_s$_a
5279                 $test -f "$xxx" && eval $libscheck
5280                 $test -f "$xxx" && libstyle=static
5281                 $test -f "$xxx" && thislib=${thislib}_s
5282             fi
5283             if test ! -f "$xxx"; then
5284                 xxx=$thisdir/Slib$thislib$_a
5285                 $test -f "$xxx" && eval $libscheck
5286                 $test -f "$xxx" && libstyle=static
5287             fi
5288             if $test -f "$xxx"; then
5289                 case "$libstyle" in
5290                 shared) echo "Found -l$thislib (shared)." ;;
5291                 static) echo "Found -l$thislib." ;;
5292                 *)      echo "Found -l$thislib ($libstyle)." ;;
5293                 esac
5294                 case " $dflt " in
5295                 *"-l$thislib "*);;
5296                 *) dflt="$dflt -l$thislib"
5297                    libsfound="$libsfound $xxx"
5298                    yyy=`basename $xxx`
5299                    libsfiles="$libsfiles $yyy"
5300                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5301                    case " $libsdirs " in
5302                    *" $yyy "*) ;;
5303                    *) libsdirs="$libsdirs $yyy" ;;
5304                    esac
5305                    ;;
5306                 esac
5307                 break
5308             fi
5309         done
5310         if $test ! -f "$xxx"; then
5311             echo "No -l$thislib."
5312         fi
5313 done
5314 set X $dflt
5315 shift
5316 dflt="$*"
5317 case "$libs" in
5318 '') dflt="$dflt";;
5319 *) dflt="$libs";;
5320 esac
5321 case "$dflt" in
5322 ' '|'') dflt='none';;
5323 esac
5324
5325 $cat <<EOM
5326
5327 In order to compile $package on your machine, a number of libraries
5328 are usually needed.  Include any other special libraries here as well.
5329 Say "none" for none.  The default list is almost always right.
5330 EOM
5331
5332 echo " "
5333 rp="What libraries to use?"
5334 . ./myread
5335 case "$ans" in
5336 none) libs=' ';;
5337 *) libs="$ans";;
5338 esac
5339
5340 : determine optimization, if desired, or use for debug flag also
5341 case "$optimize" in
5342 ' '|$undef) dflt='none';;
5343 '') dflt='-O';;
5344 *) dflt="$optimize";;
5345 esac
5346 $cat <<EOH
5347
5348 By default, $package compiles with the -O flag to use the optimizer.
5349 Alternately, you might want to use the symbolic debugger, which uses
5350 the -g flag (on traditional Unix systems).  Either flag can be
5351 specified here.  To use neither flag, specify the word "none".
5352
5353 EOH
5354 rp="What optimizer/debugger flag should be used?"
5355 . ./myread
5356 optimize="$ans"
5357 case "$optimize" in
5358 'none') optimize=" ";;
5359 esac
5360
5361 : Check what DEBUGGING is required from the command line
5362 : -DEBUGGING      or -DDEBUGGING or
5363 : -DEBUGGING=both                       = -g + -DDEBUGGING
5364 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5365 : -DEBUGGING=none or -UDEBUGGING        =
5366 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5367 case "$EBUGGING" in
5368 '')     ;;
5369 *)      DEBUGGING=$EBUGGING ;;
5370 esac
5371
5372 case "$DEBUGGING" in
5373 -g|both|$define)
5374     case "$optimize" in
5375         *-g*) ;;
5376         *)    optimize="$optimize -g" ;;
5377     esac ;;
5378 none|$undef)
5379     case "$optimize" in
5380         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5381                 shift
5382                 optimize="$*"
5383                 ;;
5384     esac ;;
5385 esac
5386
5387 dflt=''
5388 case "$DEBUGGING" in
5389 both|$define) dflt='-DDEBUGGING'
5390 esac
5391
5392 : argument order is deliberate, as the flag will start with - which set could
5393 : think is an option
5394 checkccflag='check=$1; flag=$2; callback=$3;
5395 echo " ";
5396 echo "Checking if your compiler accepts $flag" 2>&1;
5397 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5398 echo "int main(void) { return 0; }" > gcctest.c;
5399 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5400     echo "Yes, it does." 2>&1;
5401     if $test -s gcctest.out ; then
5402         echo "But your platform does not like it:";
5403         cat gcctest.out;
5404     else
5405         case "$ccflags" in
5406         *$check*)
5407             echo "Leaving current flags $ccflags alone." 2>&1
5408             ;;
5409         *) dflt="$dflt $flag";
5410             eval $callback
5411             ;;
5412         esac
5413     fi
5414 else
5415     echo "Nope, it does not, but that is ok." 2>&1;
5416 fi
5417 '
5418
5419 : We will not override a previous value, but we might want to
5420 : augment a hint file
5421 case "$hint" in
5422 default|recommended)
5423         case "$gccversion" in
5424         1*) dflt="$dflt -fpcc-struct-return" ;;
5425         esac
5426         case "$optimize:$DEBUGGING" in
5427         *-g*:old) dflt="$dflt -DDEBUGGING";;
5428         esac
5429         case "$gccversion" in
5430         2*) if $test -d /etc/conf/kconfig.d &&
5431                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5432                 then
5433                         # Interactive Systems (ISC) POSIX mode.
5434                         dflt="$dflt -posix"
5435                 fi
5436                 ;;
5437         esac
5438         case "$gccversion" in
5439         1*) ;;
5440         2.[0-8]*) ;;
5441         ?*)     set strict-aliasing -fno-strict-aliasing
5442                 eval $checkccflag
5443                 ;;
5444         esac
5445         # For gcc, adding -pipe speeds up compilations for some, but apparently
5446         # some assemblers can't read from stdin.  (It also slows down compilations
5447         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5448         case "$gccversion" in
5449         ?*)     set pipe -pipe
5450                 eval $checkccflag
5451                 ;;
5452         esac
5453
5454         # on x86_64 (at least) we require an extra library (libssp) in the
5455         # link command line. This library is not named, so I infer that it is
5456         # an implementation detail that may change. Hence the safest approach
5457         # is to add the flag to the flags passed to the compiler at link time,
5458         # as that way the compiler can do the right implementation dependant
5459         # thing. (NWC)
5460         case "$gccversion" in
5461         ?*)     set stack-protector-strong -fstack-protector-strong
5462                 eval $checkccflag
5463                 case "$dflt" in
5464                 *-fstack-protector-strong*) ;; # It got added.
5465                 *) # Try the plain/older -fstack-protector.
5466                    set stack-protector -fstack-protector
5467                    eval $checkccflag
5468                    ;;
5469                 esac
5470                 ;;
5471         esac
5472         ;;
5473 esac
5474
5475 case "$mips_type" in
5476 *BSD*|'') inclwanted="$locincpth $usrinc";;
5477 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5478 esac
5479 for thisincl in $inclwanted; do
5480         if $test -d $thisincl; then
5481                 if $test x$thisincl != x$usrinc; then
5482                         case "$dflt" in
5483                         *" -I$thisincl "*);;
5484                         *) dflt="$dflt -I$thisincl ";;
5485                         esac
5486                 fi
5487         fi
5488 done
5489
5490 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5491         xxx=true;
5492 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5493         xxx=true;
5494 else
5495         xxx=false;
5496 fi;
5497 if $xxx; then
5498         case "$dflt" in
5499         *$2*);;
5500         *) dflt="$dflt -D$2";;
5501         esac;
5502 fi'
5503
5504 set signal.h LANGUAGE_C; eval $inctest
5505
5506 case "$usesocks" in
5507 $define)
5508         ccflags="$ccflags -DSOCKS"
5509         ;;
5510 esac
5511
5512 case "$hint" in
5513 default|recommended) dflt="$ccflags $dflt" ;;
5514 *) dflt="$ccflags";;
5515 esac
5516
5517 case "$dflt" in
5518 ''|' ') dflt=none;;
5519 esac
5520
5521 $cat <<EOH
5522
5523 Your C compiler may want other flags.  For this question you should include
5524 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5525 but you should NOT include libraries or ld flags like -lwhatever.  If you
5526 want $package to honor its debug switch, you should include -DDEBUGGING here.
5527 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5528
5529 To use no flags, specify the word "none".
5530
5531 EOH
5532 set X $dflt
5533 shift
5534 dflt=${1+"$@"}
5535 rp="Any additional cc flags?"
5536 . ./myread
5537 case "$ans" in
5538 none) ccflags='';;
5539 *) ccflags="$ans";;
5540 esac
5541
5542 : the following weeds options from ccflags that are of no interest to cpp
5543 case "$cppflags" in
5544 '') cppflags="$ccflags" ;;
5545 *)  cppflags="$cppflags $ccflags" ;;
5546 esac
5547 case "$gccversion" in
5548 1*) cppflags="$cppflags -D__GNUC__"
5549 esac
5550 case "$mips_type" in
5551 '');;
5552 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5553 esac
5554 case "$cppflags" in
5555 '');;
5556 *)
5557         echo " "
5558         echo "Let me guess what the preprocessor flags are..." >&4
5559         set X $cppflags
5560         shift
5561         cppflags=''
5562         $cat >cpp.c <<'EOM'
5563 #define BLURFL foo
5564
5565 BLURFL xx LFRULB
5566 EOM
5567         previous=''
5568         for flag in $*
5569         do
5570                 case "$flag" in
5571                 -*) ftry="$flag";;
5572                 *) ftry="$previous $flag";;
5573                 esac
5574                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5575                         >cpp1.out 2>/dev/null && \
5576                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5577                         >cpp2.out 2>/dev/null && \
5578                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5579                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5580                 then
5581                         cppflags="$cppflags $ftry"
5582                         previous=''
5583                 else
5584                         previous="$flag"
5585                 fi
5586         done
5587         set X $cppflags
5588         shift
5589         cppflags=${1+"$@"}
5590         case "$cppflags" in
5591         *-*)  echo "They appear to be: $cppflags";;
5592         esac
5593         $rm -f cpp.c cpp?.out
5594         ;;
5595 esac
5596
5597 : flags used in final linking phase
5598 case "$ldflags" in
5599 '') if ./venix; then
5600                 dflt='-i -z'
5601         else
5602                 dflt=''
5603         fi
5604         case "$ccflags" in
5605         *-posix*) dflt="$dflt -posix" ;;
5606         esac
5607         ;;
5608 *) dflt="$ldflags";;
5609 esac
5610 # See note above about -fstack-protector
5611 case "$ccflags" in
5612 *-fstack-protector-strong*)
5613         case "$dflt" in
5614         *-fstack-protector-strong*) ;; # Don't add it again
5615         *) dflt="$dflt -fstack-protector-strong" ;;
5616         esac
5617         ;;
5618 *-fstack-protector*)
5619         case "$dflt" in
5620         *-fstack-protector*) ;; # Don't add it again
5621         *) dflt="$dflt -fstack-protector" ;;
5622         esac
5623         ;;
5624 esac
5625
5626 : Try to guess additional flags to pick up local libraries.
5627 for thislibdir in $libpth; do
5628         case " $loclibpth " in
5629         *" $thislibdir "*)
5630                 case "$dflt " in
5631                 *"-L$thislibdir "*) ;;
5632                 *)  dflt="$dflt -L$thislibdir" ;;
5633                 esac
5634                 ;;
5635         esac
5636 done
5637
5638 case "$dflt" in
5639 '') dflt='none' ;;
5640 esac
5641
5642 $cat <<EOH
5643
5644 Your C linker may need flags.  For this question you should
5645 include -L/whatever and any other flags used by the C linker, but you
5646 should NOT include libraries like -lwhatever.
5647
5648 Make sure you include the appropriate -L/path flags if your C linker
5649 does not normally search all of the directories you specified above,
5650 namely
5651         $libpth
5652 To use no flags, specify the word "none".
5653
5654 EOH
5655
5656 rp="Any additional ld flags (NOT including libraries)?"
5657 . ./myread
5658 case "$ans" in
5659 none) ldflags='';;
5660 *) ldflags="$ans";;
5661 esac
5662 rmlist="$rmlist pdp11"
5663
5664 : coherency check
5665 echo " "
5666 echo "Checking your choice of C compiler and flags for coherency..." >&4
5667 $cat > try.c <<'EOF'
5668 #include <stdio.h>
5669 int main() { printf("Ok\n"); return(0); }
5670 EOF
5671 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5672 shift
5673 $cat >try.msg <<'EOM'
5674 I've tried to compile and run the following simple program:
5675
5676 EOM
5677 $cat try.c >> try.msg
5678
5679 $cat >> try.msg <<EOM
5680
5681 I used the command:
5682
5683         $*
5684         $run ./try
5685
5686 and I got the following output:
5687
5688 EOM
5689 dflt=y
5690 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5691         if $sh -c "$run ./try " >>try.msg 2>&1; then
5692                 xxx=`$run ./try`
5693                 case "$xxx" in
5694                 "Ok") dflt=n ;;
5695                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5696                 esac
5697         else
5698                 echo "The program compiled OK, but exited with status $?." >>try.msg
5699                 rp="You have a problem.  Shall I abort Configure"
5700                 dflt=y
5701         fi
5702 else
5703         echo "I can't compile the test program." >>try.msg
5704         rp="You have a BIG problem.  Shall I abort Configure"
5705         dflt=y
5706 fi
5707 case "$dflt" in
5708 y)
5709         $cat try.msg >&4
5710         case "$knowitall" in
5711         '')
5712                 echo "(The supplied flags or libraries might be incorrect.)"
5713                 ;;
5714         *) dflt=n;;
5715         esac
5716         echo " "
5717         . ./myread
5718         case "$ans" in
5719         n*|N*) ;;
5720         *)      echo "Ok.  Stopping Configure." >&4
5721                 exit 1
5722                 ;;
5723         esac
5724         ;;
5725 n) echo "OK, that should do.";;
5726 esac
5727 $rm_try gcctest gcctest.out
5728
5729 : define a shorthand compile call
5730 compile='
5731 mc_file=$1;
5732 shift;
5733 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5734 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5735 exit 1;
5736 fi;
5737 esac;
5738 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5739 : define a shorthand compile call for compilations that should be ok.
5740 compile_ok='
5741 mc_file=$1;
5742 shift;
5743 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5744
5745 : determine filename position in cpp output
5746 echo " "
5747 echo "Computing filename position in cpp output for #include directives..." >&4
5748 case "$osname" in
5749 vos) testaccess=-e ;;
5750 *)   testaccess=-r ;;
5751 esac
5752 echo '#include <stdio.h>' > foo.c
5753 $cat >fieldn <<EOF
5754 $startsh
5755 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5756 $grep '^[       ]*#.*stdio\.h' | \
5757 while read cline; do
5758         pos=1
5759         set \$cline
5760         while $test \$# -gt 0; do
5761                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5762                         echo "\$pos"
5763                         exit 0
5764                 fi
5765                 shift
5766                 pos=\`expr \$pos + 1\`
5767         done
5768 done
5769 EOF
5770 chmod +x fieldn
5771 fieldn=`./fieldn`
5772 $rm -f foo.c fieldn
5773 case $fieldn in
5774 '') pos='???';;
5775 1) pos=first;;
5776 2) pos=second;;
5777 3) pos=third;;
5778 *) pos="${fieldn}th";;
5779 esac
5780 echo "Your cpp writes the filename in the $pos field of the line."
5781
5782 : locate header file
5783 $cat >findhdr <<EOF
5784 $startsh
5785 wanted=\$1
5786 name=''
5787 for usrincdir in $incpth
5788 do
5789         if test -f \$usrincdir/\$wanted; then
5790                 echo "\$usrincdir/\$wanted"
5791                 exit 0
5792         fi
5793 done
5794 awkprg='{ print \$$fieldn }'
5795 echo "#include <\$wanted>" > foo\$\$.c
5796 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5797 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5798 while read cline; do
5799         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5800         case "\$name" in
5801         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5802         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5803         *) exit 2;;
5804         esac;
5805 done;
5806 #
5807 # status = 0: grep returned 0 lines, case statement not executed
5808 # status = 1: headerfile found
5809 # status = 2: while loop executed, no headerfile found
5810 #
5811 status=\$?
5812 $rm -f foo\$\$.c;
5813 if test \$status -eq 1; then
5814         exit 0;
5815 fi
5816 exit 1
5817 EOF
5818 chmod +x findhdr
5819
5820 : define an alternate in-header-list? function
5821 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5822 cont=true; xxf="echo \"<\$1> found.\" >&4";
5823 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5824 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5825 esac;
5826 case $# in 4) instead=instead;; *) instead="at last";; esac;
5827 while $test "$cont"; do
5828         xxx=`./findhdr $1`
5829         var=$2; eval "was=\$$2";
5830         if $test "$xxx" && $test -r "$xxx";
5831         then eval $xxf;
5832         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5833                 cont="";
5834         else eval $xxnf;
5835         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5836         set $yyy; shift; shift; yyy=$@;
5837         case $# in 0) cont="";;
5838         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5839                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5840         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5841                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5842         esac;
5843 done;
5844 while $test "$yyy";
5845 do set $yyy; var=$2; eval "was=\$$2";
5846         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5847         set $yyy; shift; shift; yyy=$@;
5848 done'
5849
5850 : see if stdlib is available
5851 set stdlib.h i_stdlib
5852 eval $inhdr
5853
5854 : check for lengths of integral types
5855 echo " "
5856 case "$intsize" in
5857 '')
5858         echo "Checking to see how big your integers are..." >&4
5859         $cat >try.c <<EOCP
5860 #include <stdio.h>
5861 #$i_stdlib I_STDLIB
5862 #ifdef I_STDLIB
5863 #include <stdlib.h>
5864 #endif
5865 int main()
5866 {
5867         printf("intsize=%d;\n", (int)sizeof(int));
5868         printf("longsize=%d;\n", (int)sizeof(long));
5869         printf("shortsize=%d;\n", (int)sizeof(short));
5870         exit(0);
5871 }
5872 EOCP
5873         set try
5874         if eval $compile_ok && $run ./try > /dev/null; then
5875                 eval `$run ./try`
5876                 echo "Your integers are $intsize bytes long."
5877                 echo "Your long integers are $longsize bytes long."
5878                 echo "Your short integers are $shortsize bytes long."
5879         else
5880                 $cat >&4 <<EOM
5881 !
5882 Help! I can't compile and run the intsize test program: please enlighten me!
5883 (This is probably a misconfiguration in your system or libraries, and
5884 you really ought to fix it.  Still, I'll try anyway.)
5885 !
5886 EOM
5887                 dflt=4
5888                 rp="What is the size of an integer (in bytes)?"
5889                 . ./myread
5890                 intsize="$ans"
5891                 dflt=$intsize
5892                 rp="What is the size of a long integer (in bytes)?"
5893                 . ./myread
5894                 longsize="$ans"
5895                 dflt=2
5896                 rp="What is the size of a short integer (in bytes)?"
5897                 . ./myread
5898                 shortsize="$ans"
5899         fi
5900         ;;
5901 esac
5902 $rm_try
5903
5904 : check for long long
5905 echo " "
5906 echo "Checking to see if you have long long..." >&4
5907 echo 'int main() { long long x = 7; return 0; }' > try.c
5908 set try
5909 if eval $compile; then
5910         val="$define"
5911         echo "You have long long."
5912 else
5913         val="$undef"
5914         echo "You do not have long long."
5915 fi
5916 $rm_try
5917 set d_longlong
5918 eval $setvar
5919
5920 : check for length of long long
5921 case "${d_longlong}${longlongsize}" in
5922 $define)
5923         echo " "
5924         echo "Checking to see how big your long longs are..." >&4
5925         $cat >try.c <<'EOCP'
5926 #include <stdio.h>
5927 int main()
5928 {
5929     printf("%d\n", (int)sizeof(long long));
5930     return(0);
5931 }
5932 EOCP
5933         set try
5934         if eval $compile_ok; then
5935                 longlongsize=`$run ./try`
5936                 echo "Your long longs are $longlongsize bytes long."
5937         else
5938                 dflt='8'
5939                 echo " "
5940                 echo "(I can't seem to compile the test program.  Guessing...)"
5941                 rp="What is the size of a long long (in bytes)?"
5942                 . ./myread
5943                 longlongsize="$ans"
5944         fi
5945         if $test "X$longsize" = "X$longlongsize"; then
5946                 echo "(That isn't any different from an ordinary long.)"
5947         fi
5948         ;;
5949 esac
5950 $rm_try
5951
5952 : see if inttypes.h is available
5953 : we want a real compile instead of Inhdr because some systems
5954 : have an inttypes.h which includes non-existent headers
5955 echo " "
5956 $cat >try.c <<EOCP
5957 #include <inttypes.h>
5958 int main() {
5959         static int32_t foo32 = 0x12345678;
5960 }
5961 EOCP
5962 set try
5963 if eval $compile; then
5964         echo "<inttypes.h> found." >&4
5965         val="$define"
5966 else
5967         echo "<inttypes.h> NOT found." >&4
5968         val="$undef"
5969 fi
5970 $rm_try
5971 set i_inttypes
5972 eval $setvar
5973
5974 : check for int64_t
5975 echo " "
5976 echo "Checking to see if you have int64_t..." >&4
5977 $cat >try.c <<EOCP
5978 #include <sys/types.h>
5979 #$i_inttypes I_INTTYPES
5980 #ifdef I_INTTYPES
5981 #include <inttypes.h>
5982 #endif
5983 int main() { int64_t x = 7; }
5984 EOCP
5985 set try
5986 if eval $compile; then
5987         val="$define"
5988         echo "You have int64_t."
5989 else
5990         val="$undef"
5991         echo "You do not have int64_t."
5992 fi
5993 $rm_try
5994 set d_int64_t
5995 eval $setvar
5996
5997 : Check if 64bit ints have a quad type
5998 echo " "
5999 echo "Checking which 64-bit integer type we could use..." >&4
6000
6001 case "$intsize" in
6002 8) val=int
6003    set quadtype
6004    eval $setvar
6005    val='"unsigned int"'
6006    set uquadtype
6007    eval $setvar
6008    quadkind=1
6009    ;;
6010 *) case "$longsize" in
6011    8) val=long
6012       set quadtype
6013       eval $setvar
6014       val='"unsigned long"'
6015       set uquadtype
6016       eval $setvar
6017       quadkind=2
6018       ;;
6019    *) case "$d_longlong:$longlongsize" in
6020       define:8)
6021         val='"long long"'
6022         set quadtype
6023         eval $setvar
6024         val='"unsigned long long"'
6025         set uquadtype
6026         eval $setvar
6027         quadkind=3
6028         ;;
6029       *) case "$d_int64_t" in
6030          define)
6031            val=int64_t
6032            set quadtype
6033            eval $setvar
6034            val=uint64_t
6035            set uquadtype
6036            eval $setvar
6037            quadkind=4
6038            ;;
6039          esac
6040          ;;
6041       esac
6042       ;;
6043    esac
6044    ;;
6045 esac
6046
6047 case "$quadtype" in
6048 '')     echo "Alas, no 64-bit integer types in sight." >&4
6049         d_quad="$undef"
6050         ;;
6051 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6052         d_quad="$define"
6053         ;;
6054 esac
6055
6056 : Do we want 64bit support
6057 case "$uselonglong" in
6058 "$define"|true|[yY]*)
6059         cat <<EOM >&4
6060
6061 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6062 EOM
6063         use64bitint="$define"
6064         ;;
6065 esac
6066 case "$use64bits" in
6067 "$define"|true|[yY]*)
6068         cat <<EOM >&4
6069
6070 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6071 EOM
6072         use64bitint="$define"
6073         ;;
6074 esac
6075 case "$use64bitints" in
6076 "$define"|true|[yY]*)
6077         cat <<EOM >&4
6078
6079 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6080 EOM
6081         use64bitint="$define"
6082         ;;
6083 esac
6084 case "$use64bitsint" in
6085 "$define"|true|[yY]*)
6086         cat <<EOM >&4
6087
6088 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6089 EOM
6090         use64bitint="$define"
6091         ;;
6092 esac
6093 case "$uselonglongs" in
6094 "$define"|true|[yY]*)
6095         cat <<EOM >&4
6096
6097 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6098 EOM
6099         use64bitint="$define"
6100         ;;
6101 esac
6102 case "$use64bitsall" in
6103 "$define"|true|[yY]*)
6104         cat <<EOM >&4
6105
6106 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6107 EOM
6108         use64bitall="$define"
6109         ;;
6110 esac
6111
6112 case "$ccflags" in
6113 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6114 esac
6115 case "$use64bitall" in
6116 "$define"|true|[yY]*) use64bitint="$define" ;;
6117 esac
6118
6119 case "$longsize" in
6120 8) cat <<EOM
6121
6122 You have natively 64-bit long integers.
6123 EOM
6124    val="$define"
6125    ;;
6126 *) case "$use64bitint" in
6127    "$define"|true|[yY]*) dflt='y';;
6128    *) dflt='n';;
6129    esac
6130    case "$d_quad" in
6131    "$define") ;;
6132    *) dflt='n' ;;
6133    esac
6134    cat <<EOM
6135
6136 Perl can be built to take advantage of 64-bit integer types
6137 on some systems.  To do so, Configure can be run with -Duse64bitint.
6138 Choosing this option will most probably introduce binary incompatibilities.
6139
6140 If this doesn't make any sense to you, just accept the default '$dflt'.
6141 (The default has been chosen based on your configuration.)
6142 EOM
6143    rp='Try to use 64-bit integers, if available?'
6144    . ./myread
6145    case "$ans" in
6146    [yY]*) val="$define" ;;
6147    *)     val="$undef"  ;;
6148    esac
6149    ;;
6150 esac
6151 set use64bitint
6152 eval $setvar
6153
6154 case "$use64bitall" in
6155 "$define"|true|[yY]*) dflt='y' ;;
6156 *) case "$longsize" in
6157    8) dflt='y' ;;
6158    *) dflt='n' ;;
6159    esac
6160    ;;
6161 esac
6162 cat <<EOM
6163
6164 You may also choose to try maximal 64-bitness.  It means using as much
6165 64-bitness as possible on the platform.  This in turn means even more
6166 binary incompatibilities.  On the other hand, your platform may not
6167 have any more 64-bitness available than what you already have chosen.
6168
6169 If this doesn't make any sense to you, just accept the default '$dflt'.
6170 (The default has been chosen based on your configuration.)
6171 EOM
6172 rp='Try to use maximal 64-bit support, if available?'
6173 . ./myread
6174 case "$ans" in
6175 [yY]*) val="$define" ;;
6176 *)     val="$undef"  ;;
6177 esac
6178 set use64bitall
6179 eval $setvar
6180 case "$use64bitall" in
6181 "$define")
6182         case "$use64bitint" in
6183         "$undef")
6184                 cat <<EOM
6185
6186 Since you have chosen a maximally 64-bit build, I'm also turning on
6187 the use of 64-bit integers.
6188 EOM
6189                 use64bitint="$define" ;;
6190         esac
6191         ;;
6192 esac
6193
6194 : Look for a hint-file generated 'call-back-unit'.  If the
6195 : user has specified that a 64-bit perl is to be built,
6196 : we may need to set or change some other defaults.
6197 if $test -f use64bitint.cbu; then
6198         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6199         . ./use64bitint.cbu
6200 fi
6201 case "$use64bitint" in
6202 "$define"|true|[yY]*)
6203         : This test was common to all the OpenBSD forks, and seems harmless for
6204         : other platforms:
6205         echo " "
6206         echo "Checking if your C library has broken 64-bit functions..." >&4
6207         cat >try.c <<EOCP
6208 #include <stdio.h>
6209 typedef $uquadtype myULL;
6210 int main (void)
6211 {
6212     struct {
6213         double d;
6214         myULL  u;
6215     } *p, test[] = {
6216         {4294967303.15, 4294967303ULL},
6217         {4294967294.2,  4294967294ULL},
6218         {4294967295.7,  4294967295ULL},
6219         {0.0, 0ULL}
6220     };
6221     for (p = test; p->u; p++) {
6222         myULL x = (myULL)p->d;
6223         if (x != p->u) {
6224             printf("buggy\n");
6225             return 0;
6226         }
6227     }
6228     printf("ok\n");
6229     return 0;
6230 }
6231 EOCP
6232         set try
6233         if eval $compile_ok; then
6234             libcquad=`$run ./try`
6235             echo "Your C library's 64-bit functions are $libcquad."
6236         else
6237             echo "(I can't seem to compile the test program.)"
6238             echo "Assuming that your C library's 64-bit functions are ok."
6239             libcquad="ok"
6240         fi
6241         $rm_try
6242
6243         case "$libcquad" in
6244             buggy*)
6245                 cat >&4 <<EOM
6246
6247 *** You have a C library with broken 64-bit functions.
6248 *** 64-bit support does not work reliably in this configuration.
6249 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6250 *** Cannot continue, aborting.
6251
6252 EOM
6253                 exit 1
6254                 ;;
6255         esac
6256         case "$longsize" in
6257         4) case "$archname64" in
6258            '') archname64=64int ;;
6259            esac
6260            ;;
6261         esac
6262         ;;
6263 esac
6264
6265 : Look for a hint-file generated 'call-back-unit'.  If the
6266 : user has specified that a maximally 64-bit perl is to be built,
6267 : we may need to set or change some other defaults.
6268 if $test -f use64bitall.cbu; then
6269         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6270         . ./use64bitall.cbu
6271 fi
6272 case "$use64bitall" in
6273 "$define"|true|[yY]*)
6274         case "$longsize" in
6275         4) case "$archname64" in
6276            ''|64int) archname64=64all ;;
6277            esac
6278            ;;
6279         esac
6280         ;;
6281 esac
6282
6283 case "$d_quad:$use64bitint" in
6284 $undef:$define)
6285         cat >&4 <<EOF
6286
6287 *** You have chosen to use 64-bit integers,
6288 *** but none can be found.
6289 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6290 *** Cannot continue, aborting.
6291
6292 EOF
6293         exit 1
6294         ;;
6295 esac
6296
6297 : Check if we are using the GNU C library
6298 echo " "
6299 echo "Checking for GNU C Library..." >&4
6300 cat >try.c <<'EOCP'
6301 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6302    alone are insufficient to distinguish different versions, such as
6303    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6304    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6305 */
6306 #include <stdio.h>
6307 int main(void)
6308 {
6309 #ifdef __GLIBC__
6310 #   ifdef __GLIBC_MINOR__
6311 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6312 #           include <gnu/libc-version.h>
6313             printf("%s\n",  gnu_get_libc_version());
6314 #       else
6315             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6316 #       endif
6317 #   else
6318         printf("%d\n",  __GLIBC__);
6319 #   endif
6320     return 0;
6321 #else
6322     return 1;
6323 #endif
6324 }
6325 EOCP
6326 set try
6327 if eval $compile_ok && $run ./try > glibc.ver; then
6328         val="$define"
6329         gnulibc_version=`$cat glibc.ver`
6330         echo "You are using the GNU C Library version $gnulibc_version"
6331 else
6332         val="$undef"
6333         gnulibc_version=''
6334         echo "You are not using the GNU C Library"
6335 fi
6336 $rm_try glibc.ver
6337 set d_gnulibc
6338 eval $setvar
6339
6340 : see if nm is to be used to determine whether a symbol is defined or not
6341 case "$usenm" in
6342 '')
6343         dflt=''
6344         case "$d_gnulibc" in
6345         "$define")
6346                 echo " "
6347                 echo "nm probably won't work on the GNU C Library." >&4
6348                 dflt=n
6349                 ;;
6350         esac
6351         case "$dflt" in
6352         '')
6353                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6354                         echo " "
6355                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6356                         echo "'nm' won't be sufficient on this system." >&4
6357                         dflt=n
6358                 fi
6359                 ;;
6360         esac
6361         case "$dflt" in
6362         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6363                 if $test $dflt -gt 20; then
6364                         dflt=y
6365                 else
6366                         dflt=n
6367                 fi
6368                 ;;
6369         esac
6370         ;;
6371 *)
6372         case "$usenm" in
6373         true|$define) dflt=y;;
6374         *) dflt=n;;
6375         esac
6376         ;;
6377 esac
6378 $cat <<EOM
6379
6380 I can use $nm to extract the symbols from your C libraries. This
6381 is a time consuming task which may generate huge output on the disk (up
6382 to 3 megabytes) but that should make the symbols extraction faster. The
6383 alternative is to skip the 'nm' extraction part and to compile a small
6384 test program instead to determine whether each symbol is present. If
6385 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6386 this may be the best solution.
6387
6388 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6389
6390 EOM
6391 rp="Shall I use $nm to extract C symbols from the libraries?"
6392 . ./myread
6393 case "$ans" in
6394 [Nn]*) usenm=false;;
6395 *) usenm=true;;
6396 esac
6397
6398 runnm=$usenm
6399 case "$reuseval" in
6400 true) runnm=false;;
6401 esac
6402
6403 : nm options which may be necessary
6404 case "$nm_opt" in
6405 '') if $test -f /mach_boot; then
6406                 nm_opt=''       # Mach
6407         elif $test -d /usr/ccs/lib; then
6408                 nm_opt='-p'     # Solaris (and SunOS?)
6409         elif $test -f /dgux; then
6410                 nm_opt='-p'     # DG-UX
6411         elif $test -f /lib64/rld; then
6412                 nm_opt='-p'     # 64-bit Irix
6413         else
6414                 nm_opt=''
6415         fi;;
6416 esac
6417
6418 : nm options which may be necessary for shared libraries but illegal
6419 : for archive libraries.  Thank you, Linux.
6420 case "$nm_so_opt" in
6421 '')     case "$myuname" in
6422         *linux*|gnu*)
6423                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6424                         nm_so_opt='--dynamic'
6425                 fi
6426                 ;;
6427         esac
6428         ;;
6429 esac
6430
6431 : Figure out where the libc is located
6432 case "$runnm" in
6433 true)
6434 : get list of predefined functions in a handy place
6435 echo " "
6436 case "$libc" in
6437 '') libc=unknown
6438         case "$libs" in
6439         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6440         esac
6441         ;;
6442 esac
6443 case "$libs" in
6444 '') ;;
6445 *)  for thislib in $libs; do
6446         case "$thislib" in
6447         -lc|-lc_s)
6448                 : Handle C library specially below.
6449                 ;;
6450         -l*)
6451                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6452                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6453                         :
6454                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6455                         :
6456                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6457                         :
6458                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6459                         :
6460                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6461                         :
6462                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6463                         :
6464                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6465                         :
6466                 else
6467                         try=''
6468                 fi
6469                 libnames="$libnames $try"
6470                 ;;
6471         *) libnames="$libnames $thislib" ;;
6472         esac
6473         done
6474         ;;
6475 esac
6476 xxx=normal
6477 case "$libc" in
6478 unknown)
6479         set /lib/libc.$so
6480         for xxx in $libpth; do
6481                 $test -r $1 || set $xxx/libc.$so
6482                 : The messy sed command sorts on library version numbers.
6483                 $test -r $1 || \
6484                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6485                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6486                                 h
6487                                 s/[0-9][0-9]*/0000&/g
6488                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6489                                 G
6490                                 s/\n/ /' | \
6491                          $sort | $sed -e 's/^.* //'`
6492                 eval set \$$#
6493         done
6494         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6495         $test -r $1 || set $sysroot/lib/libsys_s$_a
6496         ;;
6497 *)
6498         set blurfl
6499         ;;
6500 esac
6501 if $test -r "$1"; then
6502         echo "Your (shared) C library seems to be in $1."
6503         libc="$1"
6504 elif $test -r /lib/libc && $test -r /lib/clib; then
6505         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6506         xxx=apollo
6507         libc='/lib/clib /lib/libc'
6508         if $test -r /lib/syslib; then
6509                 echo "(Your math library is in /lib/syslib.)"
6510                 libc="$libc /lib/syslib"
6511         fi
6512 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6513         echo "Your C library seems to be in $libc, as you said before."
6514 elif $test -r $incpath/usr/lib/libc$_a; then
6515         libc=$incpath/usr/lib/libc$_a;
6516         echo "Your C library seems to be in $libc.  That's fine."
6517 elif $test -r /lib/libc$_a; then
6518         libc=/lib/libc$_a;
6519         echo "Your C library seems to be in $libc.  You're normal."
6520 else
6521         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6522                 :
6523         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6524                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6525         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6526                 :
6527         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6528                 :
6529         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6530                 :
6531         else
6532                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6533         fi
6534         if $test -r "$tans"; then
6535                 echo "Your C library seems to be in $tans, of all places."
6536                 libc=$tans
6537         else
6538                 libc='blurfl'
6539         fi
6540 fi
6541 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6542         dflt="$libc"
6543         cat <<EOM
6544
6545 If the guess above is wrong (which it might be if you're using a strange
6546 compiler, or your machine supports multiple models), you can override it here.
6547
6548 EOM
6549 else
6550         dflt=''
6551         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6552         cat >&4 <<EOM
6553 I can't seem to find your C library.  I've looked in the following places:
6554
6555 EOM
6556         $sed 's/^/      /' libpath
6557         cat <<EOM
6558
6559 None of these seems to contain your C library. I need to get its name...
6560
6561 EOM
6562 fi
6563 fn=f
6564 rp='Where is your C library?'
6565 . ./getfile
6566 libc="$ans"
6567
6568 echo " "
6569 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6570 set X `cat libnames`
6571 shift
6572 xxx=files
6573 case $# in 1) xxx=file; esac
6574 echo "Extracting names from the following $xxx for later perusal:" >&4
6575 echo " "
6576 $sed 's/^/      /' libnames >&4
6577 echo " "
6578 $echo $n "This may take a while...$c" >&4
6579
6580 for file in $*; do
6581         case $file in
6582         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6583         *) $nm $nm_opt $file 2>/dev/null;;
6584         esac
6585 done >libc.tmp
6586
6587 $echo $n ".$c"
6588 $grep fprintf libc.tmp > libc.ptf
6589 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6590 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6591 xxx='[ADTSIWi]'
6592 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6593         eval $xscan;\
6594         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6595                 eval $xrun
6596 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6597         eval $xscan;\
6598         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6599                 eval $xrun
6600 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6601         eval $xscan;\
6602         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6603                 eval $xrun
6604 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6605         eval $xscan;\
6606         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6607                 eval $xrun
6608 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6609         eval $xscan;\
6610         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6611                 eval $xrun
6612 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6613         eval $xscan;\
6614         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6615                 eval $xrun
6616 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6617                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6618         eval $xscan;\
6619         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6620                 eval $xrun
6621 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6622         eval $xscan;\
6623         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6624                 eval $xrun
6625 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6626         eval $xscan;\
6627         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6628                 eval $xrun
6629 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6630         eval $xscan;\
6631         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6632                 eval $xrun
6633 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6634         eval $xscan;\
6635         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6636                 eval $xrun
6637 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6638         eval $xscan;\
6639         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6640                 eval $xrun
6641 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6642         eval $xscan;\
6643         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6644                 eval $xrun
6645 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6646         eval $xscan;\
6647         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6648                 eval $xrun
6649 else
6650         $nm -p $* 2>/dev/null >libc.tmp
6651         $grep fprintf libc.tmp > libc.ptf
6652         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6653                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6654         then
6655                 nm_opt='-p'
6656                 eval $xrun
6657         else
6658                 echo " "
6659                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6660                 com=''
6661                 if $ar t $libc > libc.tmp && \
6662                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6663                 then
6664                         for thisname in $libnames $libc; do
6665                                 $ar t $thisname >>libc.tmp
6666                         done
6667                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6668                         echo "Ok." >&4
6669                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6670                         for thisname in $libnames $libc; do
6671                                 $ar tv $thisname >>libc.tmp
6672                                 emximp -o tmp.imp $thisname \
6673                                     2>/dev/null && \
6674                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6675                                     < tmp.imp >>libc.tmp
6676                                 $rm -f tmp.imp
6677                         done
6678                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6679                         echo "Ok." >&4
6680                 else
6681                         echo "$ar didn't seem to work right." >&4
6682                         echo "Maybe this is a Cray...trying bld instead..." >&4
6683                         if  bld t $libc | \
6684                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6685                                 $test -s libc.list
6686                         then
6687                                 for thisname in $libnames; do
6688                                         bld t $libnames | \
6689                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6690                                         $ar t $thisname >>libc.tmp
6691                                 done
6692                                 echo "Ok." >&4
6693                         else
6694                                 echo "That didn't work either.  Giving up." >&4
6695                                 exit 1
6696                         fi
6697                 fi
6698         fi
6699 fi
6700 nm_extract="$com"
6701 case "$PASE" in
6702 define)
6703     echo " "
6704     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6705     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6706     ;;
6707 *)  if $test -f /lib/syscalls.exp; then
6708         echo " "
6709         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6710         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6711                 /lib/syscalls.exp >>libc.list
6712     fi
6713     ;;
6714 esac
6715 ;;
6716 esac
6717 $rm -f libnames libpath
6718
6719 : Check if we are using C++
6720 echo " "
6721 echo "Checking for C++..." >&4
6722 $cat >try.c <<'EOCP'
6723 #include <stdio.h>
6724 int main(void)
6725 {
6726 #ifdef __cplusplus
6727     return 0;
6728 #else
6729     return 1;
6730 #endif
6731 }
6732 EOCP
6733 set try
6734 if eval $compile_ok && $run ./try; then
6735         val="$define"
6736         echo "You are using a C++ compiler."
6737 else
6738         val="$undef"
6739         echo "You are not using a C++ compiler."
6740 fi
6741 $rm_try cplusplus$$
6742 set d_cplusplus
6743 eval $setvar
6744
6745 : is a C symbol defined?
6746 csym='tlook=$1;
6747 case "$3" in
6748 -v) tf=libc.tmp; tdc="";;
6749 -a) tf=libc.tmp; tdc="[]";;
6750 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6751 esac;
6752 case "$d_cplusplus" in
6753     $define)    extern_C="extern \"C\"" ;;
6754     *)          extern_C="extern"       ;;
6755 esac;
6756 tx=yes;
6757 case "$reuseval-$4" in
6758 true-) ;;
6759 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6760 esac;
6761 case "$tx" in
6762 yes)
6763         tval=false;
6764         if $test "$runnm" = true; then
6765                 if $contains $tlook $tf >/dev/null 2>&1; then
6766                         tval=true;
6767                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6768                         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;
6769                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6770                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6771                         $rm_try;
6772                 fi;
6773         else
6774                 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;
6775                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6776                 $rm_try;
6777         fi;
6778         ;;
6779 *)
6780         case "$tval" in
6781         $define) tval=true;;
6782         *) tval=false;;
6783         esac;
6784         ;;
6785 esac;
6786 eval "$2=$tval"'
6787
6788 : define an is-in-libc? function
6789 inlibc='echo " "; td=$define; tu=$undef;
6790 sym=$1; var=$2; eval "was=\$$2";
6791 tx=yes;
6792 case "$reuseval$was" in
6793 true) ;;
6794 true*) tx=no;;
6795 esac;
6796 case "$tx" in
6797 yes)
6798         set $sym tres -f;
6799         eval $csym;
6800         case "$tres" in
6801         true)
6802                 echo "$sym() found." >&4;
6803                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6804         *)
6805                 echo "$sym() NOT found." >&4;
6806                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6807         esac;;
6808 *)
6809         case "$was" in
6810         $define) echo "$sym() found." >&4;;
6811         *) echo "$sym() NOT found." >&4;;
6812         esac;;
6813 esac'
6814
6815 : check for length of double
6816 echo " "
6817 case "$doublesize" in
6818 '')
6819         echo "Checking to see how big your double precision numbers are..." >&4
6820         $cat >try.c <<EOCP
6821 #include <stdio.h>
6822 #$i_stdlib I_STDLIB
6823 #ifdef I_STDLIB
6824 #include <stdlib.h>
6825 #endif
6826 int main()
6827 {
6828     printf("%d\n", (int)sizeof(double));
6829     exit(0);
6830 }
6831 EOCP
6832         set try
6833         if eval $compile_ok; then
6834                 doublesize=`$run ./try`
6835                 echo "Your double is $doublesize bytes long."
6836         else
6837                 dflt='8'
6838                 echo "(I can't seem to compile the test program.  Guessing...)"
6839                 rp="What is the size of a double precision number (in bytes)?"
6840                 . ./myread
6841                 doublesize="$ans"
6842         fi
6843         ;;
6844 esac
6845 $rm_try
6846
6847 : see if this is a float.h system
6848 set float.h i_float
6849 eval $inhdr
6850
6851 : check for long doubles
6852 echo " "
6853 echo "Checking to see if you have long double..." >&4
6854 echo 'int main() { long double x = 7.0; }' > try.c
6855 set try
6856 if eval $compile; then
6857         val="$define"
6858         echo "You have long double."
6859 else
6860         val="$undef"
6861         echo "You do not have long double."
6862 fi
6863 $rm_try
6864 set d_longdbl
6865 eval $setvar
6866
6867 : see if ldexpl exists
6868 set ldexpl d_ldexpl
6869 eval $inlibc
6870
6871 : check for length of long double
6872 case "${d_longdbl}${longdblsize}" in
6873 $define)
6874         echo " "
6875         echo "Checking to see how big your long doubles are..." >&4
6876         $cat >try.c <<'EOCP'
6877 #include <stdio.h>
6878 int main()
6879 {
6880         printf("%d\n", sizeof(long double));
6881 }
6882 EOCP
6883         set try
6884         set try
6885         if eval $compile; then
6886                 longdblsize=`$run ./try`
6887                 echo "Your long doubles are $longdblsize bytes long."
6888         else
6889                 dflt='8'
6890                 echo " "
6891                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6892                 rp="What is the size of a long double (in bytes)?"
6893                 . ./myread
6894                 longdblsize="$ans"
6895         fi
6896         if $test "X$doublesize" = "X$longdblsize"; then
6897                 echo "That isn't any different from an ordinary double."
6898                 echo "I'll keep your setting anyway, but you may see some"
6899                 echo "harmless compilation warnings."
6900         fi
6901         ;;
6902 esac
6903 $rm_try
6904
6905 $echo "Checking the kind of long doubles you have..." >&4
6906 case "$d_longdbl" in
6907 define)
6908 $cat <<EOP >try.c
6909 #$i_float I_FLOAT
6910 #$i_stdlib I_STDLIB
6911 #define LONGDBLSIZE $longdblsize
6912 #define DOUBLESIZE $doublesize
6913 #ifdef I_FLOAT
6914 #include <float.h>
6915 #endif
6916 #ifdef I_STDLIB
6917 #include <stdlib.h>
6918 #endif
6919 #include <stdio.h>
6920 static const long double d = -0.1L;
6921 int main() {
6922   unsigned const char* b = (unsigned const char*)(&d);
6923 #if DOUBLESIZE == LONGDBLSIZE
6924   printf("0\n"); /* if it floats like double */
6925   exit(0);
6926 #endif
6927 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6928   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6929     /* IEEE 754 128-bit little-endian */
6930     printf("1\n");
6931     exit(0);
6932   }
6933   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6934     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6935     printf("2\n");
6936     exit(0);
6937   }
6938 #endif
6939 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6940  * while 64-bits platforms have it in 16 bytes. */
6941 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6942   if (b[0] == 0xCD && b[9] == 0xBF && b[10] == 0x00) {
6943     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6944      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6945      * Also known as "extended precision". */
6946     printf("3\n");
6947     exit(0);
6948   }
6949   if (b[0] == 0xBF && b[9] == 0xCD && b[10] == 0x00) {
6950     /* is there ever big-endian 80-bit, really? */
6951     printf("4\n");
6952     exit(0);
6953   }
6954 #endif
6955 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
6956   /* software "double double", the 106 is 53+53.
6957    * but irix thinks it is 107. */
6958   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
6959     /* double double 128-bit little-endian,
6960      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
6961     printf("5\n");
6962     exit(0);
6963   }
6964   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
6965     /* double double 128-bit big-endian, e.g. PPC/Power and MIPS:
6966      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
6967     printf("6\n");
6968     exit(0);
6969   }
6970 #endif
6971   printf("-1\n"); /* unknown */
6972   exit(0);
6973 }
6974 EOP
6975 set try
6976 if eval $compile; then
6977     longdblkind=`$run ./try`
6978 else
6979     longdblkind=-1
6980 fi
6981 ;;
6982 *) longdblkind=0 ;;
6983 esac
6984 case "$longdblkind" in
6985 0) echo "Your long doubles are doubles." >&4 ;;
6986 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
6987 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
6988 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
6989 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
6990 5) echo "You have 128-bit little-endian double-double long doubles." >& 4 ;;
6991 6) echo "You have 128-bit big-endian double-double long doubles." >& 4 ;;
6992 *) echo "Cannot figure out your long double." >&4 ;;
6993 esac
6994 $rm_try
6995
6996 : determine the architecture name
6997 echo " "
6998 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6999         tarch=`arch`"-$osname"
7000 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7001         if uname -m > tmparch 2>&1 ; then
7002                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7003                         -e 's/$/'"-$osname/" tmparch`
7004         else
7005                 tarch="$osname"
7006         fi
7007         $rm -f tmparch
7008 else
7009         tarch="$osname"
7010 fi
7011 case "$myarchname" in
7012 ''|"$tarch") ;;
7013 *)
7014         echo "(Your architecture name used to be $myarchname.)"
7015         archname=''
7016         ;;
7017 esac
7018 case "$targetarch" in
7019 '') ;;
7020 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7021 esac
7022 myarchname="$tarch"
7023 case "$archname" in
7024 '') dflt="$tarch";;
7025 *) dflt="$archname";;
7026 esac
7027 rp='What is your architecture name'
7028 . ./myread
7029 archname="$ans"
7030
7031 : optionally add API version to the architecture for versioned archlibs
7032 case "$useversionedarchname" in
7033 $define|true|[yY]*) dflt='y';;
7034 *)                  dflt='n';;
7035 esac
7036 rp='Add the Perl API version to your archname?'
7037 . ./myread
7038 case "$ans" in
7039 y|Y)    useversionedarchname="$define" ;;
7040 *)      useversionedarchname="$undef" ;;
7041 esac
7042 case "$useversionedarchname" in
7043 $define)
7044         case "$archname" in
7045         *-$api_versionstring)
7046                 echo "...and architecture name already has -$api_versionstring" >&4
7047                 ;;
7048         *)
7049                 archname="$archname-$api_versionstring"
7050                 echo "...setting architecture name to $archname." >&4
7051                 ;;
7052         esac
7053         ;;
7054 esac
7055
7056 case "$usethreads" in
7057 $define)
7058         echo "Threads selected." >&4
7059         case "$archname" in
7060         *-thread*) echo "...and architecture name already has -thread." >&4
7061                 ;;
7062         *)      archname="$archname-thread"
7063                 echo "...setting architecture name to $archname." >&4
7064                 ;;
7065         esac
7066         ;;
7067 esac
7068 case "$usemultiplicity" in
7069 $define)
7070         echo "Multiplicity selected." >&4
7071         case "$archname" in
7072         *-multi*) echo "...and architecture name already has -multi." >&4
7073                 ;;
7074         *)      archname="$archname-multi"
7075                 echo "...setting architecture name to $archname." >&4
7076                 ;;
7077         esac
7078         ;;
7079 esac
7080 case "$use64bitint$use64bitall" in
7081 *"$define"*)
7082         case "$archname64" in
7083         '')
7084                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7085                 ;;
7086         *)
7087                 case "$use64bitint" in
7088                 "$define") echo "64 bit integers selected." >&4 ;;
7089                 esac
7090                 case "$use64bitall" in
7091                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7092                 esac
7093                 case "$archname" in
7094                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7095                         ;;
7096                 *)      archname="$archname-$archname64"
7097                         echo "...setting architecture name to $archname." >&4
7098                         ;;
7099                 esac
7100                 ;;
7101         esac
7102 esac
7103 case "$uselongdouble" in
7104 $define)
7105         echo "Long doubles selected." >&4
7106         case "$longdblsize" in
7107         $doublesize)
7108                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7109                 ;;
7110         *)
7111                 case "$archname" in
7112                 *-ld*) echo "...and architecture name already has -ld." >&4
7113                         ;;
7114                 *)      archname="$archname-ld"
7115                         echo "...setting architecture name to $archname." >&4
7116                         ;;
7117                 esac
7118                 ;;
7119         esac
7120         ;;
7121 esac
7122 case "$usequadmath" in
7123 $define)
7124         echo "quadmath selected." >&4
7125         case "$archname" in
7126         *-ld*) echo "...and architecture name already has -quadmath." >&4
7127                 ;;
7128         *)      archname="$archname-quadmath"
7129                 echo "...setting architecture name to $archname." >&4
7130                 ;;
7131         esac
7132         ;;
7133 esac
7134 if $test -f archname.cbu; then
7135         echo "Your platform has some specific hints for architecture name, using them..."
7136         . ./archname.cbu
7137 fi
7138
7139 : set the prefixit variable, to compute a suitable default value
7140 prefixit='case "$3" in
7141 ""|none)
7142         case "$oldprefix" in
7143         "") eval "$1=\"\$$2\"";;
7144         *)
7145                 case "$3" in
7146                 "") eval "$1=";;
7147                 none)
7148                         eval "tp=\"\$$2\"";
7149                         case "$tp" in
7150                         ""|" ") eval "$1=\"\$$2\"";;
7151                         *) eval "$1=";;
7152                         esac;;
7153                 esac;;
7154         esac;;
7155 *)
7156         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7157         case "$tp" in
7158         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7159         /*-$oldprefix/*|\~*-$oldprefix/*)
7160                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7161         *) eval "$1=\"\$$2\"";;
7162         esac;;
7163 esac'
7164
7165 : determine installation style
7166 : For now, try to deduce it from prefix unless it is already set.
7167 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7168 case "$installstyle" in
7169 '')     case "$prefix" in
7170                 *perl*) dflt='lib';;
7171                 *) dflt='lib/perl5' ;;
7172         esac
7173         ;;
7174 *)      dflt="$installstyle" ;;
7175 esac
7176 : Probably not worth prompting for this since we prompt for all
7177 : the directories individually, and the prompt would be too long and
7178 : confusing anyway.
7179 installstyle=$dflt
7180
7181 : determine where public executables go
7182 echo " "
7183 set dflt bin bin
7184 eval $prefixit
7185 fn=d~
7186 rp='Pathname where the public executables will reside?'
7187 . ./getfile
7188 if $test "X$ansexp" != "X$binexp"; then
7189         installbin=''
7190 fi
7191 prefixvar=bin
7192 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7193 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7194 :     this via initialinstalllocation
7195 . ./setprefixvar
7196
7197 case "$userelocatableinc" in
7198 $define|true|[yY]*)     dflt='y' ;;
7199 *)                      dflt='n' ;;
7200 esac
7201 cat <<EOM
7202
7203 Would you like to build Perl so that the installation is relocatable, so that
7204 library paths in @INC are determined relative to the path of the perl binary?
7205 This is not advised for system Perl installs, or if you need to run setid
7206 scripts or scripts under taint mode.
7207
7208 If this doesn't make any sense to you, just accept the default '$dflt'.
7209 EOM
7210 rp='Use relocatable @INC?'
7211 . ./myread
7212 case "$ans" in
7213 y|Y)    val="$define" ;;
7214 *)      val="$undef"  ;;
7215 esac
7216 set userelocatableinc
7217 eval $setvar
7218
7219 initialinstalllocation="$binexp"
7220 : Default prefix is now "up one level from where the binaries are"
7221 case "$userelocatableinc" in
7222 $define|true|[yY]*)
7223     bin=".../"
7224     binexp=".../"
7225     prefix=".../.."
7226     prefixexp=".../.."
7227     installprefixexp=".../.."
7228     ;;
7229 esac
7230
7231 : determine where private library files go
7232 : Usual default is /usr/local/lib/perl5/$version.
7233 : Also allow things like /opt/perl/lib/$version, since
7234 : /opt/perl/lib/perl5... would be redundant.
7235 : The default "style" setting is made in installstyle.U
7236 case "$installstyle" in
7237 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7238 *)       set dflt privlib lib/$version ;;
7239 esac
7240 eval $prefixit
7241 $cat <<EOM
7242
7243 There are some auxiliary files for $package that need to be put into a
7244 private library directory that is accessible by everyone.
7245
7246 EOM
7247 fn=$binexp
7248 fn=d~+
7249 rp='Pathname where the private library files will reside?'
7250 . ./getfile
7251 prefixvar=privlib
7252 . ./setprefixvar
7253
7254 : set the prefixup variable, to restore leading tilda escape
7255 prefixup='case "$prefixexp" in
7256 "$prefix") ;;
7257 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7258 esac'
7259
7260 : determine where public architecture dependent libraries go
7261 set archlib archlib
7262 eval $prefixit
7263 : privlib default is /usr/local/lib/$package/$version
7264 : archlib default is /usr/local/lib/$package/$version/$archname
7265 : privlib may have an optional trailing /share.
7266 tdflt=`echo $privlib | $sed 's,/share$,,'`
7267 tdflt=$tdflt/$archname
7268 case "$archlib" in
7269 '')     dflt=$tdflt
7270         ;;
7271 *)      dflt="$archlib"
7272     ;;
7273 esac
7274 $cat <<EOM
7275
7276 $spackage contains architecture-dependent library files.  If you are
7277 sharing libraries in a heterogeneous environment, you might store
7278 these files in a separate location.  Otherwise, you can just include
7279 them with the rest of the public library files.
7280
7281 EOM
7282 fn=$binexp
7283 fn=d+~
7284 rp='Where do you want to put the public architecture-dependent libraries?'
7285 . ./getfile
7286 prefixvar=archlib
7287 . ./setprefixvar
7288 if $test X"$archlib" = X"$privlib"; then
7289         d_archlib="$undef"
7290 else
7291         d_archlib="$define"
7292 fi
7293
7294 : see if setuid scripts can be secure
7295 $cat <<EOM
7296
7297 Some kernels have a bug that prevents setuid #! scripts from being
7298 secure.  Some sites have disabled setuid #! scripts because of this.
7299
7300 First let's decide if your kernel supports secure setuid #! scripts.
7301 (If setuid #! scripts would be secure but have been disabled anyway,
7302 don't say that they are secure if asked.)
7303
7304 EOM
7305
7306 val="$undef"
7307 if $test -d /dev/fd; then
7308         echo "#!$ls" >reflect
7309         chmod +x,u+s reflect
7310         ./reflect >flect 2>&1
7311         if $contains "/dev/fd" flect >/dev/null; then
7312                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7313                 val="$define"
7314         else
7315                 $cat <<EOM
7316 If you are not sure if they are secure, I can check but I'll need a
7317 username and password different from the one you are using right now.
7318 If you don't have such a username or don't want me to test, simply
7319 enter 'none'.
7320
7321 EOM
7322                 rp='Other username to test security of setuid scripts with?'
7323                 dflt='none'
7324                 . ./myread
7325                 case "$ans" in
7326                 n|none)
7327                         case "$d_suidsafe" in
7328                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7329                                 dflt=n;;
7330                         "$undef")
7331                                 echo "Well, the $hint value is *not* secure." >&4
7332                                 dflt=n;;
7333                         *)      echo "Well, the $hint value *is* secure." >&4
7334                                 dflt=y;;
7335                         esac
7336                         ;;
7337                 *)
7338                         $rm -f reflect flect
7339                         echo "#!$ls" >reflect
7340                         chmod +x,u+s reflect
7341                         echo >flect
7342                         chmod a+w flect
7343                         echo '"su" will (probably) prompt you for '"$ans's password."
7344                         su $ans -c './reflect >flect'
7345                         if $contains "/dev/fd" flect >/dev/null; then
7346                                 echo "Okay, it looks like setuid scripts are secure." >&4
7347                                 dflt=y
7348                         else
7349                                 echo "I don't think setuid scripts are secure." >&4
7350                                 dflt=n
7351                         fi
7352                         ;;
7353                 esac
7354                 rp='Does your kernel have *secure* setuid scripts?'
7355                 . ./myread
7356                 case "$ans" in
7357                 [yY]*)  val="$define";;
7358                 *)      val="$undef";;
7359                 esac
7360         fi
7361 else
7362         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7363         echo "(That's for file descriptors, not floppy disks.)"
7364         val="$undef"
7365 fi
7366 set d_suidsafe
7367 eval $setvar
7368
7369 $rm -f reflect flect
7370
7371 : now see if they want to do setuid emulation
7372 if $test $patchlevel -lt 11; then
7373 echo " "
7374 val="$undef"
7375 case "$d_suidsafe" in
7376 "$define")
7377         val="$undef"
7378         echo "No need to emulate SUID scripts since they are secure here." >&4
7379         ;;
7380 *)
7381         $cat <<EOM
7382 Some systems have disabled setuid scripts, especially systems where
7383 setuid scripts cannot be secure.  On systems where setuid scripts have
7384 been disabled, the setuid/setgid bits on scripts are currently
7385 useless.  It is possible for $package to detect those bits and emulate
7386 setuid/setgid in a secure fashion.  This emulation will only work if
7387 setuid scripts have been disabled in your kernel.
7388
7389 EOM
7390         case "$d_dosuid" in
7391         "$define") dflt=y ;;
7392         *) dflt=n ;;
7393         esac
7394         rp="Do you want to do setuid/setgid emulation?"
7395         . ./myread
7396         case "$ans" in
7397         [yY]*)  val="$define";;
7398         *)      val="$undef";;
7399         esac
7400         ;;
7401 esac
7402 set d_dosuid
7403 eval $setvar
7404 else
7405     case "$d_dosuid" in
7406         "$define")
7407         cat >&4 <<EOH
7408
7409 SUID emulation has been removed for 5.12
7410 Please re-run Configure without -Dd_dosuid
7411
7412 EOH
7413         exit 1;
7414         ;;
7415     esac
7416     d_dosuid=undef
7417 fi
7418
7419 : Find perl5.005 or later.
7420 echo "Looking for a previously installed perl5.005 or later... "
7421 case "$perl5" in
7422 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7423                 : Check if this perl is recent and can load a simple module
7424                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7425                         perl5=$tdir/perl
7426                         break;
7427                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7428                         perl5=$tdir/perl5
7429                         break;
7430                 fi
7431         done
7432         ;;
7433 *)      perl5="$perl5"
7434         ;;
7435 esac
7436 case "$perl5" in
7437 '')     echo "None found.  That's ok.";;
7438 *)      echo "Using $perl5." ;;
7439 esac
7440
7441 : Set the siteprefix variables
7442 $cat <<EOM
7443
7444 After $package is installed, you may wish to install various
7445 add-on modules and utilities.  Typically, these add-ons will
7446 be installed under $prefix with the rest
7447 of this package.  However, you may wish to install such add-ons
7448 elsewhere under a different prefix.
7449
7450 If you do not wish to put everything under a single prefix, that's
7451 ok.  You will be prompted for the individual locations; this siteprefix
7452 is only used to suggest the defaults.
7453
7454 The default should be fine for most people.
7455
7456 EOM
7457 fn=d~+
7458 rp='Installation prefix to use for add-on modules and utilities?'
7459 : XXX Here might be another good place for an installstyle setting.
7460 case "$siteprefix" in
7461 '') dflt=$prefix ;;
7462 *)  dflt=$siteprefix ;;
7463 esac
7464 . ./getfile
7465 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7466 oldsiteprefix=''
7467 case "$siteprefix" in
7468 '') ;;
7469 *)      case "$ans" in
7470         "$prefix") ;;
7471         *) oldsiteprefix="$prefix";;
7472         esac
7473         ;;
7474 esac
7475 siteprefix="$ans"
7476 siteprefixexp="$ansexp"
7477
7478 : determine where site specific libraries go.
7479 : Usual default is /usr/local/lib/perl5/site_perl/$version
7480 : The default "style" setting is made in installstyle.U
7481 : XXX No longer works with Prefixit stuff.
7482 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7483 case "$sitelib" in
7484 '') case "$installstyle" in
7485         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7486         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7487         esac
7488         ;;
7489 *)      dflt="$sitelib"
7490         ;;
7491 esac
7492 $cat <<EOM
7493
7494 The installation process will create a directory for
7495 site-specific extensions and modules.  Most users find it convenient
7496 to place all site-specific files in this directory rather than in the
7497 main distribution directory.
7498
7499 EOM
7500 fn=d~+
7501 rp='Pathname for the site-specific library files?'
7502 . ./getfile
7503 prefixvar=sitelib
7504 . ./setprefixvar
7505 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7506
7507 : Determine list of previous versions to include in @INC
7508 $cat > getverlist <<EOPL
7509 #!$perl5 -w
7510 use File::Basename;
7511 \$api_versionstring = "$api_versionstring";
7512 \$version = "$version";
7513 \$stem = "$sitelib_stem";
7514 \$archname = "$archname";
7515 EOPL
7516         $cat >> getverlist <<'EOPL'
7517 # The list found is store twice for each entry: the original name, and
7518 # the binary broken down version as pack "sss", so sorting is easy and
7519 # unambiguous. This will work for all versions that have a maximum of
7520 # three digit groups, separate by '.'s or '_'s. Names are extended with
7521 # ".0.0" to ensure at least three elements for the pack.
7522 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7523
7524 # Can't have leading @ because metaconfig interprets it as a command!
7525 ;@inc_version_list=();
7526 # XXX Redo to do opendir/readdir?
7527 if (-d $stem) {
7528     chdir($stem);
7529     ;@candidates = map {
7530         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7531     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7532 }
7533 else {
7534     ;@candidates = ();
7535 }
7536
7537 ($pversion, $aversion, $vsn5005) = map {
7538     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7539 foreach $d (@candidates) {
7540     if ($d->[1] lt $pversion) {
7541         if ($d->[1] ge $aversion) {
7542             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7543         }
7544         elsif ($d->[1] ge $vsn5005) {
7545             unshift(@inc_version_list, grep { -d } $d->[0]);
7546         }
7547     }
7548     else {
7549         # Skip newer version.  I.e. don't look in
7550         # 5.7.0 if we're installing 5.6.1.
7551     }
7552 }
7553
7554 if (@inc_version_list) {
7555     print join(' ', @inc_version_list);
7556 }
7557 else {
7558     # Blank space to preserve value for next Configure run.
7559     print " ";
7560 }
7561 EOPL
7562 chmod +x getverlist
7563 case "$inc_version_list" in
7564 '')     if test -x "$perl5$exe_ext"; then
7565                 dflt=`$perl5 getverlist`
7566         else
7567                 dflt='none'
7568         fi
7569         ;;
7570 $undef) dflt='none' ;;
7571 *)  eval dflt=\"$inc_version_list\" ;;
7572 esac
7573 case "$dflt" in
7574 ''|' ') dflt=none ;;
7575 esac
7576 case "$dflt" in
7577 5.005) dflt=none ;;
7578 esac
7579 $cat <<EOM
7580
7581 In order to ease the process of upgrading, this version of perl
7582 can be configured to use modules built and installed with earlier
7583 versions of perl that were installed under $prefix.  Specify here
7584 the list of earlier versions that this version of perl should check.
7585 If Configure detected no earlier versions of perl installed under
7586 $prefix, then the list will be empty.  Answer 'none' to tell perl
7587 to not search earlier versions.
7588
7589 The default should almost always be sensible, so if you're not sure,
7590 just accept the default.
7591 EOM
7592
7593 rp='List of earlier versions to include in @INC?'
7594 . ./myread
7595 case "$ans" in
7596 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7597 *) inc_version_list="$ans" ;;
7598 esac
7599 case "$inc_version_list" in
7600 ''|' ')
7601         inc_version_list_init='0'
7602         d_inc_version_list="$undef"
7603         ;;
7604 *)      inc_version_list_init=`echo $inc_version_list |
7605                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7606         d_inc_version_list="$define"
7607         ;;
7608 esac
7609 $rm -f getverlist
7610
7611 : see if malloc/malloc.h has to be included
7612 set malloc/malloc.h i_mallocmalloc
7613 eval $inhdr
7614
7615 : see if this is a malloc.h system
7616 : we want a real compile instead of Inhdr because some systems have a
7617 : malloc.h that just gives a compile error saying to use stdlib.h instead
7618 echo " "
7619 $cat >try.c <<EOCP
7620 #include <stdlib.h>
7621 #include <malloc.h>
7622 #$i_mallocmalloc I_MALLOCMALLOC
7623 #ifdef I_MALLOCMALLOC
7624 # include <malloc/malloc.h>
7625 #endif
7626
7627 int main () { return 0; }
7628 EOCP
7629 set try
7630 if eval $compile; then
7631     echo "<malloc.h> found." >&4
7632     val="$define"
7633 else
7634     echo "<malloc.h> NOT found." >&4
7635     val="$undef"
7636 fi
7637 $rm_try
7638 set i_malloc
7639 eval $setvar
7640
7641 : check for length of pointer
7642 echo " "
7643 case "$ptrsize" in
7644 '')
7645         echo "Checking to see how big your pointers are..." >&4
7646         $cat >try.c <<EOCP
7647 #include <stdio.h>
7648 #$i_stdlib I_STDLIB
7649 #ifdef I_STDLIB
7650 #include <stdlib.h>
7651 #endif
7652 int main()
7653 {
7654     printf("%d\n", (int)sizeof(void *));
7655     exit(0);
7656 }
7657 EOCP
7658         set try
7659         if eval $compile_ok; then
7660                 ptrsize=`$run ./try`
7661                 echo "Your pointers are $ptrsize bytes long."
7662         else
7663                 dflt='4'
7664                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7665                 rp="What is the size of a pointer (in bytes)?"
7666                 . ./myread
7667                 ptrsize="$ans"
7668         fi
7669         ;;
7670 esac
7671 $rm_try
7672 case "$use64bitall" in
7673 "$define"|true|[yY]*)
7674         case "$ptrsize" in
7675         4)      cat <<EOM >&4
7676
7677 *** You have chosen a maximally 64-bit build,
7678 *** but your pointers are only 4 bytes wide.
7679 *** Please rerun Configure without -Duse64bitall.
7680 EOM
7681                 case "$d_quad" in
7682                 define)
7683                         cat <<EOM >&4
7684 *** Since you have quads, you could possibly try with -Duse64bitint.
7685 EOM
7686                         ;;
7687                 esac
7688                 cat <<EOM >&4
7689 *** Cannot continue, aborting.
7690
7691 EOM
7692
7693                 exit 1
7694                 ;;
7695         esac
7696         ;;
7697 esac
7698
7699
7700 : determine whether to use malloc wrapping
7701 echo " "
7702 case "$usemallocwrap" in
7703 [yY]*|true|$define)     dflt='y' ;;
7704 [nN]*|false|$undef)     dflt='n' ;;
7705 *)      case "$usedevel" in
7706         [yY]*|true|$define)     dflt='y' ;;
7707         *) dflt='n' ;;
7708         esac
7709         ;;
7710 esac
7711 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7712 . ./myread
7713 usemallocwrap="$ans"
7714 case "$ans" in
7715 y*|true)
7716         usemallocwrap="$define" ;;
7717 *)
7718         usemallocwrap="$undef" ;;
7719 esac
7720
7721 : determine which malloc to compile in
7722 echo " "
7723 case "$usemymalloc" in
7724 [yY]*|true|$define)     dflt='y' ;;
7725 [nN]*|false|$undef)     dflt='n' ;;
7726 *)      case "$ptrsize" in
7727         4) dflt='y' ;;
7728         *) dflt='n' ;;
7729         esac
7730         if test "$useithreads" = "$define"; then dflt='n'; fi
7731         ;;
7732 esac
7733 rp="Do you wish to attempt to use the malloc that comes with $package?"
7734 . ./myread
7735 usemymalloc="$ans"
7736 case "$ans" in
7737 y*|true)
7738         usemymalloc='y'
7739         mallocsrc='malloc.c'
7740         mallocobj="malloc$_o"
7741         d_mymalloc="$define"
7742         case "$libs" in
7743         *-lmalloc*)
7744                 : Remove malloc from list of libraries to use
7745                 echo "Removing unneeded -lmalloc from library list" >&4
7746                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7747                 shift
7748                 libs="$*"
7749                 echo "libs = $libs" >&4
7750                 ;;
7751         esac
7752         ;;
7753 *)
7754         usemymalloc='n'
7755         mallocsrc=''
7756         mallocobj=''
7757         d_mymalloc="$undef"
7758         ;;
7759 esac
7760
7761 : compute the return types of malloc and free
7762 echo " "
7763 $cat >malloc.c <<END
7764 #$i_malloc I_MALLOC
7765 #$i_stdlib I_STDLIB
7766 #include <stdio.h>
7767 #include <sys/types.h>
7768 #ifdef I_MALLOC
7769 #include <malloc.h>
7770 #endif
7771 #ifdef I_STDLIB
7772 #include <stdlib.h>
7773 #endif
7774 #ifdef TRY_MALLOC
7775 void *malloc();
7776 #endif
7777 #ifdef TRY_FREE
7778 void free();
7779 #endif
7780 END
7781 case "$malloctype" in
7782 '')
7783         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7784                 malloctype='void *'
7785         else
7786                 malloctype='char *'
7787         fi
7788         ;;
7789 esac
7790 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7791
7792 case "$freetype" in
7793 '')
7794         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7795                 freetype='void'
7796         else
7797                 freetype='int'
7798         fi
7799         ;;
7800 esac
7801 echo "Your system uses $freetype free(), it would seem." >&4
7802 $rm -f malloc.[co]
7803 : determine where site specific architecture-dependent libraries go.
7804 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7805 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7806 : sitelib may have an optional trailing /share.
7807 case "$sitearch" in
7808 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7809         dflt="$dflt/$archname"
7810         ;;
7811 *)      dflt="$sitearch"
7812         ;;
7813 esac
7814 set sitearch sitearch none
7815 eval $prefixit
7816 $cat <<EOM
7817
7818 The installation process will also create a directory for
7819 architecture-dependent site-specific extensions and modules.
7820
7821 EOM
7822 fn=d~+
7823 rp='Pathname for the site-specific architecture-dependent library files?'
7824 . ./getfile
7825 prefixvar=sitearch
7826 . ./setprefixvar
7827 if $test X"$sitearch" = X"$sitelib"; then
7828         d_sitearch="$undef"
7829 else
7830         d_sitearch="$define"
7831 fi
7832
7833 : Set the vendorprefix variables
7834 $cat <<EOM
7835
7836 The installation process will also create a directory for
7837 vendor-supplied add-ons.  Vendors who supply perl with their system
7838 may find it convenient to place all vendor-supplied files in this
7839 directory rather than in the main distribution directory.  This will
7840 ease upgrades between binary-compatible maintenance versions of perl.
7841
7842 Of course you may also use these directories in whatever way you see
7843 fit.  For example, you might use them to access modules shared over a
7844 company-wide network.
7845
7846 The default answer should be fine for most people.
7847 This causes further questions about vendor add-ons to be skipped
7848 and no vendor-specific directories will be configured for perl.
7849
7850 EOM
7851 rp='Do you want to configure vendor-specific add-on directories?'
7852 case "$usevendorprefix" in
7853 define|true|[yY]*) dflt=y ;;
7854 *)      : User may have set vendorprefix directly on Configure command line.
7855         case "$vendorprefix" in
7856         ''|' ') dflt=n ;;
7857         *)      dflt=y ;;
7858         esac
7859         ;;
7860 esac
7861 . ./myread
7862 case "$ans" in
7863 [yY]*)  fn=d~+
7864         rp='Installation prefix to use for vendor-supplied add-ons?'
7865         case "$vendorprefix" in
7866         '') dflt="$prefix" ;;
7867         *)  dflt=$vendorprefix ;;
7868         esac
7869         . ./getfile
7870         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7871         oldvendorprefix=''
7872         case "$vendorprefix" in
7873         '') ;;
7874         *)      case "$ans" in
7875                 "$prefix") ;;
7876                 *) oldvendorprefix="$prefix";;
7877                 esac
7878                 ;;
7879         esac
7880         usevendorprefix="$define"
7881         vendorprefix="$ans"
7882         vendorprefixexp="$ansexp"
7883         ;;
7884 *)      usevendorprefix="$undef"
7885         vendorprefix=''
7886         vendorprefixexp=''
7887         ;;
7888 esac
7889
7890 : Set the vendorlib variables
7891 case "$vendorprefix" in
7892 '')     d_vendorlib="$undef"
7893         vendorlib=''
7894         vendorlibexp=''
7895         ;;
7896 *)      d_vendorlib="$define"
7897         : determine where vendor-supplied modules go.
7898         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7899         case "$vendorlib" in
7900         '')
7901                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7902                 case "$installstyle" in
7903                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7904                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7905                 esac
7906                 ;;
7907         *)      dflt="$vendorlib"
7908                 ;;
7909         esac
7910         fn=d~+
7911         rp='Pathname for the vendor-supplied library files?'
7912         . ./getfile
7913         vendorlib="$ans"
7914         vendorlibexp="$ansexp"
7915         ;;
7916 esac
7917 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7918 prefixvar=vendorlib
7919 . ./installprefix
7920
7921 : Set the vendorarch variables
7922 case "$vendorprefix" in
7923 '')     d_vendorarch="$undef"
7924         vendorarch=''
7925         vendorarchexp=''
7926         ;;
7927 *)      d_vendorarch="$define"
7928         : determine where vendor-supplied architecture-dependent libraries go.
7929         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7930         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7931         : vendorlib may have an optional trailing /share.
7932         case "$vendorarch" in
7933         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7934                 dflt="$dflt/$archname"
7935                 ;;
7936         *)      dflt="$vendorarch" ;;
7937         esac
7938         fn=d~+
7939         rp='Pathname for vendor-supplied architecture-dependent files?'
7940         . ./getfile
7941         vendorarch="$ans"
7942         vendorarchexp="$ansexp"
7943         ;;
7944 esac
7945 prefixvar=vendorarch
7946 . ./installprefix
7947 if $test X"$vendorarch" = X"$vendorlib"; then
7948         d_vendorarch="$undef"
7949 else
7950         d_vendorarch="$define"
7951 fi
7952
7953 : Final catch-all directories to search
7954 $cat <<EOM
7955
7956 Lastly, you can have perl look in other directories for extensions and
7957 modules in addition to those already specified.
7958 These directories will be searched after
7959         $sitearch
7960         $sitelib
7961 EOM
7962 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7963 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7964 echo ' '
7965 case "$otherlibdirs" in
7966 ''|' ') dflt='none' ;;
7967 *)      dflt="$otherlibdirs" ;;
7968 esac
7969 $cat <<EOM
7970 Enter a colon-separated set of extra paths to include in perl's @INC
7971 search path, or enter 'none' for no extra paths.
7972
7973 EOM
7974
7975 rp='Colon-separated list of additional directories for perl to search?'
7976 . ./myread
7977 case "$ans" in
7978 ' '|''|none)    otherlibdirs=' ' ;;
7979 *)      otherlibdirs="$ans" ;;
7980 esac
7981 case "$otherlibdirs" in
7982 ' ') val=$undef ;;
7983 *)      val=$define ;;
7984 esac
7985 set d_perl_otherlibdirs
7986 eval $setvar
7987
7988 : Cruising for prototypes
7989 echo " "
7990 echo "Checking out function prototypes..." >&4
7991 $cat >prototype.c <<EOCP
7992 #$i_stdlib I_STDLIB
7993 #ifdef I_STDLIB
7994 #include <stdlib.h>
7995 #endif
7996 int main(int argc, char *argv[]) {
7997         exit(0);}
7998 EOCP
7999 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
8000         echo "Your C compiler appears to support function prototypes."
8001         val="$define"
8002 else
8003         echo "Your C compiler doesn't seem to understand function prototypes."
8004         val="$undef"
8005 fi
8006 set prototype
8007 eval $setvar
8008 $rm -f prototype*
8009
8010 : Check if ansi2knr is required
8011 case "$prototype" in
8012 "$define") ;;
8013 *)      ansi2knr='ansi2knr'
8014         echo " "
8015         cat <<EOM >&4
8016
8017 $me:  FATAL ERROR:
8018 This version of $package can only be compiled by a compiler that
8019 understands function prototypes.  Unfortunately, your C compiler
8020         $cc $ccflags
8021 doesn't seem to understand them.  Sorry about that.
8022
8023 If GNU cc is available for your system, perhaps you could try that instead.
8024
8025 Eventually, we hope to support building Perl with pre-ANSI compilers.
8026 If you would like to help in that effort, please contact <perlbug@perl.org>.
8027
8028 Aborting Configure now.
8029 EOM
8030         exit 2
8031         ;;
8032 esac
8033
8034 : DTrace support
8035 dflt_dtrace='/usr/sbin/dtrace'
8036 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8037
8038 cat <<EOM
8039
8040 Perl can be built to support DTrace on platforms that support it.
8041 DTrace is a diagnosis and performance analysis tool from Sun.
8042
8043 If this doesn't make any sense to you, just accept the default '$dflt'.
8044 EOM
8045
8046 while $test 1 ; do
8047         case "$usedtrace" in
8048         $define|true|[yY]*)
8049                 dflt='y'
8050                 ;;
8051         ?*)
8052                 dflt='y'
8053                 dflt_dtrace=$usedtrace
8054                 ;;
8055         *)
8056                 dflt='n'
8057                 ;;
8058         esac
8059
8060         rp='Support DTrace if available?'
8061         . ./myread
8062         case "$ans" in
8063         y|Y)    val="$define" ;;
8064         *)      val="$undef" ;;
8065         esac
8066         set usedtrace
8067         eval $setvar
8068
8069         test "X$usedtrace" != "X$define" && break
8070
8071         echo " "
8072         rp='Where is the dtrace executable?'
8073         dflt=$dflt_dtrace
8074         . ./getfile
8075         val="$ans"
8076         set dtrace
8077         eval $setvar
8078
8079         if $test -f $dtrace
8080         then
8081                 if $dtrace -h -s ../perldtrace.d \
8082                         -o perldtrace.tmp >/dev/null 2>&1 \
8083                         && rm -f perldtrace.tmp
8084                 then
8085                         echo " "
8086                         echo "Good: your $dtrace knows about the -h flag."
8087                 else
8088                         cat >&2 <<EOM
8089
8090 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8091 ***
8092 *** Your installed dtrace doesn't support the -h switch to compile a D
8093 *** program into a C header. Can't continue.
8094
8095 EOM
8096                         exit 1
8097                 fi
8098                 break;
8099         fi
8100
8101         case "$fastread" in
8102         yes)
8103                 cat >&2 <<EOM
8104
8105 *** $me:  Fatal Error:  $dtrace not found.
8106 *** Can't continue.
8107
8108 EOM
8109                 exit 1
8110                 ;;
8111         *)
8112                 echo "*** $dtrace was not found."
8113                 echo " "
8114                 ;;
8115         esac
8116 done
8117
8118 : See if we want extra modules installed
8119 echo " "
8120 case "$extras" in
8121 '') dflt='n';;
8122 *) dflt='y';;
8123 esac
8124 cat <<EOM
8125 Perl can be built with extra modules or bundles of modules which
8126 will be fetched from the CPAN and installed alongside Perl.
8127
8128 Notice that you will need access to the CPAN; either via the Internet,
8129 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8130 be asked later to configure the CPAN.pm module which will in turn do
8131 the installation of the rest of the extra modules or bundles.)
8132
8133 Notice also that if the modules require any external software such as
8134 libraries and headers (the libz library and the zlib.h header for the
8135 Compress::Zlib module, for example) you MUST have any such software
8136 already installed, this configuration process will NOT install such
8137 things for you.
8138
8139 If this doesn't make any sense to you, just accept the default '$dflt'.
8140 EOM
8141 rp='Install any extra modules (y or n)?'
8142 . ./myread
8143 case "$ans" in
8144 y|Y)
8145         cat <<EOM
8146
8147 Please list any extra modules or bundles to be installed from CPAN,
8148 with spaces between the names.  The names can be in any format the
8149 'install' command of CPAN.pm will understand.  (Answer 'none',
8150 without the quotes, to install no extra modules or bundles.)
8151 EOM
8152         rp='Extras?'
8153         dflt="$extras"
8154         . ./myread
8155         extras="$ans"
8156 esac
8157 case "$extras" in
8158 ''|'none')
8159         val=''
8160         $rm -f ../extras.lst
8161         ;;
8162 *)      echo "(Saving the list of extras for later...)"
8163         echo "$extras" > ../extras.lst
8164         val="'$extras'"
8165         ;;
8166 esac
8167 set extras
8168 eval $setvar
8169 echo " "
8170
8171 : determine where html pages for programs go
8172 set html1dir html1dir none
8173 eval $prefixit
8174 $cat <<EOM
8175
8176 If you wish to install html files for programs in $spackage, indicate
8177 the appropriate directory here.  To skip installing html files,
8178 answer "none".
8179 EOM
8180 case "$html1dir" in
8181 ''|none|$undef|' ') dflt=none ;;
8182 *) dflt=$html1dir ;;
8183 esac
8184 fn=dn+~
8185 rp="Directory for the main $spackage html pages?"
8186 . ./getfile
8187 prefixvar=html1dir
8188 . ./setprefixvar
8189 : Use ' ' for none so value is preserved next time through Configure
8190 $test X"$html1dir" = "X" && html1dir=' '
8191
8192 : determine where html pages for libraries and modules go
8193 set html3dir html3dir none
8194 eval $prefixit
8195 $cat <<EOM
8196
8197 If you wish to install html files for modules associated with $spackage,
8198 indicate the appropriate directory here.  To skip installing html files,
8199 answer "none".
8200 EOM
8201 : There is no obvious default.  If they have specified html1dir, then
8202 : try to key off that, possibly changing .../html1 into .../html3.
8203 case "$html3dir" in
8204 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8205 *) dflt=$html3dir ;;
8206 esac
8207 fn=dn+~
8208 rp="Directory for the $spackage module html pages?"
8209 . ./getfile
8210 prefixvar=html3dir
8211 . ./setprefixvar
8212 : Use ' ' for none so value is preserved next time through Configure
8213 $test X"$html3dir" = "X" && html3dir=' '
8214
8215 : determine whether to install perl also as /usr/bin/perl
8216
8217 echo " "
8218 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8219         $cat <<EOM
8220 Many scripts expect perl to be installed as /usr/bin/perl.
8221
8222 If you want to, I can install the perl you are about to compile
8223 as /usr/bin/perl (in addition to $bin/perl).
8224 EOM
8225         if test -f /usr/bin/perl; then
8226             $cat <<EOM
8227
8228 However, please note that because you already have a /usr/bin/perl,
8229 overwriting that with a new Perl would very probably cause problems.
8230 Therefore I'm assuming you don't want to do that (unless you insist).
8231
8232 EOM
8233             case "$installusrbinperl" in
8234             "$define"|[yY]*)    dflt='y';;
8235             *)                  dflt='n';;
8236             esac
8237         else
8238             $cat <<EOM
8239
8240 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8241
8242 EOM
8243             case "$installusrbinperl" in
8244             "$undef"|[nN]*)     dflt='n';;
8245             *)                  dflt='y';;
8246             esac
8247         fi
8248         rp="Do you want to install perl as /usr/bin/perl?"
8249         . ./myread
8250         case "$ans" in
8251         [yY]*)  val="$define";;
8252         *)      val="$undef" ;;
8253         esac
8254 else
8255         val="$undef"
8256 fi
8257 set installusrbinperl
8258 eval $setvar
8259
8260 : see if dlopen exists
8261 xxx_runnm="$runnm"
8262 xxx_ccflags="$ccflags"
8263 runnm=false
8264 : with g++ one needs -shared to get is-in-libc to work for dlopen
8265 case "$gccversion" in
8266 '')     ;;
8267 *)      case "$d_cplusplus" in
8268         "$define") ccflags="$ccflags -shared" ;;
8269         esac
8270         ;;
8271 esac
8272 set dlopen d_dlopen
8273 eval $inlibc
8274 runnm="$xxx_runnm"
8275 ccflags="$xxx_ccflags"
8276
8277 : see if this is a unistd.h system
8278 set unistd.h i_unistd
8279 eval $inhdr
8280
8281 : determine which dynamic loading, if any, to compile in
8282 echo " "
8283 dldir="ext/DynaLoader"
8284 case "$usedl" in
8285     $define|y|true)
8286         dflt='y'
8287         usedl="$define"
8288         ;;
8289     $undef|n|false)
8290         dflt='n'
8291         usedl="$undef"
8292         ;;
8293     *)
8294         dflt='n'
8295         case "$d_dlopen" in
8296             $define) dflt='y' ;;
8297         esac
8298         : Does a dl_xxx.xs file exist for this operating system
8299         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8300         ;;
8301 esac
8302 rp="Do you wish to use dynamic loading?"
8303 . ./myread
8304 usedl="$ans"
8305 bin_ELF="$undef"
8306 case "$ans" in
8307     y*) usedl="$define"
8308         case "$dlsrc" in
8309             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8310                     dflt="$dldir/dl_${osname}.xs"
8311                 elif $test "$d_dlopen" = "$define" ; then
8312                     dflt="$dldir/dl_dlopen.xs"
8313                 else
8314                     dflt=''
8315                 fi
8316                 ;;
8317             *)  dflt="$dldir/$dlsrc"
8318                 ;;
8319         esac
8320         echo "The following dynamic loading files are available:"
8321         : Can not go over to $dldir because getfile has path hard-coded in.
8322         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8323         rp="Source file to use for dynamic loading"
8324         fn="fne"
8325         gfpth="$src"
8326         . ./getfile
8327         usedl="$define"
8328         : emulate basename
8329         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8330
8331         $cat << EOM
8332
8333 Some systems may require passing special flags to $cc -c to
8334 compile modules that will be used to create a shared library.
8335 To use no flags, say "none".
8336
8337 EOM
8338         case "$cccdlflags" in
8339             '') case "$gccversion" in
8340                 '') case "$osname" in
8341                         hpux)   dflt='+z' ;;
8342                         irix*)  dflt='-KPIC' ;;
8343                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8344                         sunos)  dflt='-pic' ;;
8345                         *)      dflt='none' ;;
8346                     esac
8347                     ;;
8348                 *)  case "$osname" in
8349                         darwin) dflt='none' ;;
8350                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8351                         *)      dflt='-fpic' ;;
8352                     esac ;;
8353                 esac ;;
8354             ' ') dflt='none' ;;
8355             *)   dflt="$cccdlflags" ;;
8356         esac
8357
8358         case "$dflt" in
8359             none) dflt='' ;;
8360         esac
8361
8362         # If -Dsysroot was specified, now's the time to add it
8363         # to cccdlflags
8364         if test "X$sysroot" != X; then
8365             case "$gccversion" in
8366                 '') ;;
8367                 *)  case "$dflt" in
8368                         *sysroot*) ;;
8369                         'undef'|*)
8370                             dflt="$dflt --sysroot=$sysroot" ;;
8371                     esac
8372                     ;;
8373             esac
8374         fi
8375
8376         case "$dflt" in
8377             '') dflt='none';;
8378         esac
8379
8380         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8381         . ./myread
8382         case "$ans" in
8383             none) cccdlflags=' ' ;;
8384             *)    cccdlflags="$ans" ;;
8385         esac
8386
8387         cat << EOM
8388
8389 Some systems use ld to create libraries that can be dynamically loaded,
8390 while other systems (such as those using ELF) use $cc.
8391
8392 EOM
8393
8394 : Determine if this is ELF
8395         $cat >try.c <<EOM
8396 /* Test for whether ELF binaries are produced */
8397 #include <fcntl.h>
8398 #$i_stdlib I_STDLIB
8399 #ifdef I_STDLIB
8400 #include <stdlib.h>
8401 #endif
8402 #$i_unistd I_UNISTD
8403 #ifdef I_UNISTD
8404 #include <unistd.h>
8405 #endif
8406 int main() {
8407     char b[4];
8408     int i = open("a.out",O_RDONLY);
8409     if(i == -1)
8410         exit(1); /* fail */
8411     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8412         exit(0); /* succeed (yes, it is ELF) */
8413     exit(1); /* fail */
8414 }
8415 EOM
8416         if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8417             bin_ELF="$define"
8418         fi
8419         $rm_try
8420
8421         case "$ld" in
8422             '') if $test $bin_ELF = "$define"; then
8423                     cat <<EOM
8424 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8425 EOM
8426                     dflt="$cc"
8427                 else
8428                     echo "I'll use ld to build dynamic libraries."
8429                     dflt='ld'
8430                 fi
8431                 ;;
8432             *)  dflt="$ld"
8433                 ;;
8434         esac
8435
8436         rp="What command should be used to create dynamic libraries?"
8437         . ./myread
8438         ld="$ans"
8439
8440         cat << EOM
8441
8442 Some systems may require passing special flags to $ld to create a
8443 library that can be dynamically loaded.  If your ld flags include
8444 -L/other/path options to locate libraries outside your loader's normal
8445 search path, you may need to specify those -L options here as well.  To
8446 use no flags, say "none".
8447
8448 EOM
8449         case "$lddlflags" in
8450             '') case "$osname" in
8451                     haiku) dflt='-shared' ;;
8452                     hpux) dflt='-b';
8453                           case "$gccversion" in
8454                               '') dflt="$dflt +vnocompatwarnings" ;;
8455                           esac
8456                           ;;
8457                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8458                     solaris) # See [perl #66604].
8459                             # On Solaris 11, gcc -m64 on amd64
8460                             # appears not to understand -G.  gcc versions at
8461                             # least as old as 3.4.3 support -shared, so just
8462                             # use that with Solaris 11 and later, but keep
8463                             # the old behavior for older Solaris versions.
8464                             case "$gccversion" in
8465                                 '') dflt='-G' ;;
8466                                 *)  case "$osvers" in
8467                                         2.?|2.10) dflt='-G' ;;
8468                                         *) dflt='-shared' ;;
8469                                     esac
8470                                     ;;
8471                             esac
8472                             ;;
8473                     sunos) dflt='-assert nodefinitions' ;;
8474                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8475                     *)     dflt='none' ;;
8476                 esac
8477                 ;;
8478             *) dflt="$lddlflags" ;;
8479         esac
8480
8481         : Only do this for gcc, since, for example, qcc has no concept
8482         : of --sysroot.
8483         if $test "X$sysroot" != X; then
8484             case "$gccversion" in
8485                 '') ;;
8486                 *)  dflt="$dflt --sysroot $sysroot" ;;
8487             esac
8488         fi
8489
8490         : Try to guess additional flags to pick up local libraries.
8491         : Be careful not to append to a plain 'none'
8492         case "$dflt" in
8493             none) dflt='' ;;
8494         esac
8495         for thisflag in $ldflags; do
8496             case "$thisflag" in
8497                 -L*|-R*|-Wl,-R*)
8498                     case " $dflt " in
8499                         *" $thisflag "*) ;;
8500                         *) dflt="$dflt $thisflag" ;;
8501                     esac
8502                     ;;
8503             esac
8504         done
8505
8506         case "$dflt" in
8507             ''|' ') dflt='none' ;;
8508         esac
8509
8510         case "$ldflags" in
8511             *-fstack-protector-strong*)
8512                 case "$dflt" in
8513                     *-fstack-protector-strong*) ;; # Don't add it again
8514                     *) dflt="$dflt -fstack-protector-strong" ;;
8515                 esac
8516                 ;;
8517             *-fstack-protector*)
8518                 case "$dflt" in
8519                     *-fstack-protector*) ;; # Don't add it again
8520                     *) dflt="$dflt -fstack-protector" ;;
8521                 esac
8522                 ;;
8523         esac
8524
8525         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8526         . ./myread
8527         case "$ans" in
8528             none) lddlflags=' ' ;;
8529             *) lddlflags="$ans" ;;
8530         esac
8531
8532         cat <<EOM
8533
8534 Some systems may require passing special flags to $cc to indicate that
8535 the resulting executable will use dynamic linking.  To use no flags,
8536 say "none".
8537
8538 EOM
8539         case "$ccdlflags" in
8540             '') case "$osname" in
8541                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8542                     sunos)             dflt='none'   ;;
8543                     *)                 dflt='none'   ;;
8544                 esac ;;
8545             ' ') dflt='none' ;;
8546             *)   dflt="$ccdlflags" ;;
8547         esac
8548         rp="Any special flags to pass to $cc to use dynamic linking?"
8549         . ./myread
8550         case "$ans" in
8551             none) ccdlflags=' ' ;;
8552             *)    ccdlflags="$ans" ;;
8553         esac
8554         ;;
8555
8556     *)  usedl="$undef"
8557         ld='ld'
8558         dlsrc='dl_none.xs'
8559         lddlflags=''
8560         ccdlflags=''
8561         ;;
8562 esac
8563
8564 ld_can_script="$undef"
8565 case "$bin_ELF$usedl" in
8566     $define$define)
8567         # Abuse try.h and a.out names for neat cleanup
8568         $cat >try.c <<EOM
8569 void foo() {}
8570 void bar() {}
8571 EOM
8572         $cat >try.h <<EOM
8573 LIBTEST_42 {
8574  global:
8575   foo;
8576  local: *;
8577  };
8578 EOM
8579         if $cc $cccdlflags $ccdlflags $ccflags \
8580                $ldflags $lddlflags -o a.out try.c \
8581                -Wl,--version-script=try.h >/dev/null 2>&1 \
8582            &&  $test -s a.out ; then
8583             echo "ld supports scripting" >&4
8584             ld_can_script="$define"
8585         else
8586             echo "ld does not support scripting" >&4
8587         fi
8588         $rm_try
8589         ;;
8590 esac
8591
8592 : Do we want a shared libperl?
8593 also=''
8594 case "$usedl" in
8595 $undef)
8596         # No dynamic loading being used, so don't bother even to prompt.
8597         useshrplib='false'
8598         ;;
8599 *)      case "$useshrplib" in
8600         '')     case "$osname" in
8601                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8602                         dflt=y
8603                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8604                         ;;
8605                 *)      dflt=n
8606                         ;;
8607                 esac
8608                 ;;
8609         $define|true|[Yy]*)
8610                 dflt=y
8611                 ;;
8612         *)      dflt=n
8613                 ;;
8614         esac
8615         $cat << EOM
8616
8617 The perl executable is normally obtained by linking perlmain.c with
8618 libperl${_a}, any static extensions (usually just DynaLoader), and
8619 any other libraries needed on this system (such as -lm, etc.).  Since
8620 your system supports dynamic loading, it is probably possible to build
8621 a shared libperl.$so.  If you will have more than one executable linked
8622 to libperl.$so, this will significantly reduce the size of each
8623 executable, but it may have a noticeable effect on performance.  The
8624 default is probably sensible for your system.
8625 $also
8626
8627 EOM
8628         rp="Build a shared libperl.$so (y/n)"
8629         . ./myread
8630         case "$ans" in
8631         true|$define|[Yy]*)
8632                 useshrplib='true'  ;;
8633         *)      useshrplib='false' ;;
8634         esac
8635         ;;
8636 esac
8637
8638 case "$useshrplib" in
8639 true)
8640         case "$userelocatableinc" in
8641         true|define)
8642                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8643                 echo "See INSTALL for an explanation why that won't work." >&4
8644                 exit 4
8645                 ;;
8646         esac
8647         case "$libperl" in
8648         '')
8649                 # Figure out a good name for libperl.so.  Since it gets stored in
8650                 # a version-specific architecture-dependent library, the version
8651                 # number isn't really that important, except for making cc/ld happy.
8652                 #
8653                 # A name such as libperl.so.10.1
8654                 majmin="libperl.$so.$patchlevel.$subversion"
8655                 # A name such as libperl.so.100
8656                 majonly=`echo $patchlevel $subversion |
8657                         $awk '{printf "%d%02d", $1, $2}'`
8658                 majonly=libperl.$so.$majonly
8659                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8660                 # rely on figuring it out from the naming of libc.
8661                 case "${osname}${osvers}" in
8662                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8663                         dflt=libperl.$so
8664                         ;;
8665                 cygwin*) # ld links now against the dll directly
8666                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8667                         majonly=`echo $patchlevel $subversion |
8668                                 $awk '{printf "%03d%03d", $1, $2}'`
8669                         majonly=cygperl5.$majonly.$so
8670                         dflt=$majmin
8671                         ;;
8672                 *)      # Try to guess based on whether libc has major.minor.
8673                         case "$libc" in
8674                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8675                         *libc.$so.[0-9]*) dflt=$majonly ;;
8676                         *)      dflt=libperl.$so ;;
8677                         esac
8678                         ;;
8679                 esac
8680                 ;;
8681         *)      dflt=$libperl
8682                 ;;
8683         esac
8684         cat << EOM
8685
8686 I need to select a good name for the shared libperl.  If your system uses
8687 library names with major and minor numbers, then you might want something
8688 like $majmin.  Alternatively, if your system uses a single version
8689 number for shared libraries, then you might want to use $majonly.
8690 Or, your system might be quite happy with a simple libperl.$so.
8691
8692 Since the shared libperl will get installed into a version-specific
8693 architecture-dependent directory, the version number of the shared perl
8694 library probably isn't important, so the default should be o.k.
8695
8696 EOM
8697         rp='What name do you want to give to the shared libperl?'
8698         . ./myread
8699         libperl=$ans
8700         echo "Ok, I'll use $libperl"
8701         ;;
8702 *)
8703         libperl="libperl${_a}"
8704         ;;
8705 esac
8706
8707 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8708 case "$shrpdir" in
8709 '') ;;
8710 *)      $cat >&4 <<EOM
8711 WARNING:  Use of the shrpdir variable for the installation location of
8712 the shared $libperl is not supported.  It was never documented and
8713 will not work in this version.  Let me (perlbug@perl.org)
8714 know of any problems this may cause.
8715
8716 EOM
8717         case "$shrpdir" in
8718         "$archlibexp/CORE")
8719                 $cat >&4 <<EOM
8720 But your current setting of $shrpdir is
8721 the default anyway, so it's harmless.
8722 EOM
8723                 ;;
8724         *)
8725                 $cat >&4 <<EOM
8726 Further, your current attempted setting of $shrpdir
8727 conflicts with the value of $archlibexp/CORE
8728 that installperl will use.
8729 EOM
8730                 ;;
8731         esac
8732         ;;
8733 esac
8734
8735 # How will the perl executable find the installed shared $libperl?
8736 # Add $xxx to ccdlflags.
8737 # If we can't figure out a command-line option, use $shrpenv to
8738 # set env LD_RUN_PATH.  The main perl makefile uses this.
8739 shrpdir=$archlibexp/CORE
8740 xxx=''
8741 tmp_shrpenv=''
8742 if "$useshrplib"; then
8743     case "$osname" in
8744         aix)
8745                 # We'll set it in Makefile.SH...
8746                 ;;
8747         solaris)
8748                 xxx="-R $shrpdir"
8749                 ;;
8750         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8751                 xxx="-Wl,-R$shrpdir"
8752                 ;;
8753         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8754                 xxx="-Wl,-rpath,$shrpdir"
8755                 ;;
8756         hpux*)
8757                 # hpux doesn't like the default, either.
8758                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8759                 ;;
8760         cygwin)
8761                 # cygwin needs only ldlibpth
8762                 ;;
8763         *)
8764                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8765                 ;;
8766         esac
8767         case "$xxx" in
8768         '') ;;
8769         *)
8770                 # Only add $xxx if it isn't already in ccdlflags.
8771                 case " $ccdlflags " in
8772                 *" $xxx "*)     ;;
8773                 *)      ccdlflags="$ccdlflags $xxx"
8774                         cat <<EOM >&4
8775
8776 Adding $xxx to the flags
8777 passed to $ld so that the perl executable will find the
8778 installed shared $libperl.
8779
8780 EOM
8781                         ;;
8782                 esac
8783                 ;;
8784         esac
8785 fi
8786 # Fix ccdlflags in AIX for building external extensions.
8787 # (For building Perl itself bare -bE:perl.exp is needed,
8788 #  Makefile.SH takes care of this.)
8789 case "$osname" in
8790 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8791 esac
8792 # Respect a hint or command-line value.
8793 case "$shrpenv" in
8794 '') shrpenv="$tmp_shrpenv" ;;
8795 esac
8796 case "$ldlibpthname" in
8797 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8798 none)   ldlibpthname='' ;;
8799 esac
8800
8801 : determine where manual pages are on this system
8802 echo " "
8803 case "$sysman" in
8804 '')
8805         syspath='/usr/share/man/man1 /usr/man/man1'
8806         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8807         syspath="$syspath /usr/man/u_man/man1"
8808         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8809         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8810         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8811         sysman=`./loc . /usr/man/man1 $syspath`
8812         ;;
8813 esac
8814 if $test -d "$sysman"; then
8815         echo "System manual is in $sysman." >&4
8816 else
8817         echo "Could not find manual pages in source form." >&4
8818 fi
8819
8820 : determine where manual pages go
8821 set man1dir man1dir none
8822 eval $prefixit
8823 $cat <<EOM
8824
8825 $spackage has manual pages available in source form.
8826 EOM
8827 case "$nroff" in
8828 nroff)
8829         echo "However, you don't have nroff, so they're probably useless to you."
8830         case "$man1dir" in
8831         '') man1dir="none";;
8832         esac;;
8833 esac
8834 echo "If you don't want the manual sources installed, answer 'none'."
8835 case "$man1dir" in
8836 ' ') dflt=none
8837         ;;
8838 '')
8839         lookpath="$prefixexp/share/man/man1"
8840         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8841         lookpath="$lookpath $prefixexp/man/p_man/man1"
8842         lookpath="$lookpath $prefixexp/man/u_man/man1"
8843         lookpath="$lookpath $prefixexp/man/man.1"
8844         case "$sysman" in
8845         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8846         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8847         esac
8848         set dflt
8849         eval $prefixup
8850         ;;
8851 *)  dflt="$man1dir"
8852         ;;
8853 esac
8854 echo " "
8855 fn=dn+~
8856 rp="Where do the main $spackage manual pages (source) go?"
8857 . ./getfile
8858 if $test "X$man1direxp" != "X$ansexp"; then
8859         installman1dir=''
8860 fi
8861 prefixvar=man1dir
8862 . ./setprefixvar
8863
8864 case "$man1dir" in
8865 '')     man1dir=' '
8866         installman1dir='';;
8867 esac
8868
8869 : What suffix to use on installed man pages
8870
8871 case "$man1dir" in
8872 ' ')
8873         man1ext='0'
8874         ;;
8875 *)
8876         rp="What suffix should be used for the main $spackage man pages?"
8877         case "$man1ext" in
8878         '')     case "$man1dir" in
8879                 *1)  dflt=1 ;;
8880                 *1p) dflt=1p ;;
8881                 *1pm) dflt=1pm ;;
8882                 *l) dflt=l;;
8883                 *n) dflt=n;;
8884                 *o) dflt=o;;
8885                 *p) dflt=p;;
8886                 *C) dflt=C;;
8887                 *L) dflt=L;;
8888                 *L1) dflt=L1;;
8889                 *) dflt=1;;
8890                 esac
8891                 ;;
8892         *)      dflt="$man1ext";;
8893         esac
8894         . ./myread
8895         man1ext="$ans"
8896         ;;
8897 esac
8898
8899 : see if we can have long filenames
8900 echo " "
8901 first=123456789abcdef
8902 $rm -f $first
8903 if (echo hi >$first) 2>/dev/null; then
8904         if $test -f 123456789abcde; then
8905                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8906                 val="$undef"
8907         else
8908                 echo 'You can have filenames longer than 14 characters.'>&4
8909                 val="$define"
8910         fi
8911 else
8912         $cat <<'EOM'
8913 You can't have filenames longer than 14 chars.
8914 You can't even think about them!
8915 EOM
8916         val="$undef"
8917 fi
8918 set d_flexfnam
8919 eval $setvar
8920 $rm -rf 123456789abcde*
8921
8922 : determine where library module manual pages go
8923 set man3dir man3dir none
8924 eval $prefixit
8925 $cat <<EOM
8926
8927 $spackage has manual pages for many of the library modules.
8928 EOM
8929
8930 case "$nroff" in
8931 nroff)
8932         $cat <<'EOM'
8933 However, you don't have nroff, so they're probably useless to you.
8934 EOM
8935         case "$man3dir" in
8936         '') man3dir="none";;
8937         esac;;
8938 esac
8939
8940 case "$d_flexfnam" in
8941 undef)
8942         $cat <<'EOM'
8943 However, your system can't handle the long file names like File::Basename.3.
8944 EOM
8945         case "$man3dir" in
8946         '') man3dir="none";;
8947         esac;;
8948 esac
8949
8950 echo "If you don't want the manual sources installed, answer 'none'."
8951 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8952 case "$man3dir" in
8953 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8954         if $test -d "$privlib/man/man3"; then
8955                 cat <<EOM >&4
8956
8957 WARNING:  Previous versions of perl installed man3 pages into
8958 $privlib/man/man3.  This version will suggest a
8959 new default of $dflt.
8960 EOM
8961                 tdflt=$dflt
8962                 dflt='n'
8963                 rp='Do you wish to preserve the old behavior?(y/n)'
8964                 . ./myread
8965                 case "$ans" in
8966                 y*) dflt="$privlib/man/man3" ;;
8967                 *)  dflt=$tdflt ;;
8968                 esac
8969     fi
8970         ;;
8971 *)      dflt="$man3dir" ;;
8972 esac
8973 case "$dflt" in
8974 ' ') dflt=none ;;
8975 esac
8976 echo " "
8977 fn=dn+~
8978 rp="Where do the $package library man pages (source) go?"
8979 . ./getfile
8980 prefixvar=man3dir
8981 . ./setprefixvar
8982
8983 case "$man3dir" in
8984 '')     man3dir=' '
8985         installman3dir='';;
8986 esac
8987
8988 : What suffix to use on installed man pages
8989 case "$man3dir" in
8990 ' ')
8991         man3ext='0'
8992         ;;
8993 *)
8994         rp="What suffix should be used for the $package library man pages?"
8995         case "$man3ext" in
8996         '')     case "$man3dir" in
8997                 *3)  dflt=3 ;;
8998                 *3p) dflt=3p ;;
8999                 *3pm) dflt=3pm ;;
9000                 *l) dflt=l;;
9001                 *n) dflt=n;;
9002                 *o) dflt=o;;
9003                 *p) dflt=p;;
9004                 *C) dflt=C;;
9005                 *L) dflt=L;;
9006                 *L3) dflt=L3;;
9007                 *) dflt=3;;
9008                 esac
9009                 ;;
9010         *)      dflt="$man3ext";;
9011         esac
9012         . ./myread
9013         man3ext="$ans"
9014         ;;
9015 esac
9016
9017 : see if we have to deal with yellow pages, now NIS.
9018 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9019         case "$hostcat" in
9020         nidump*) ;;
9021         *)
9022                 case "$hostcat" in
9023                 *ypcat*) dflt=y;;
9024                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9025                                 dflt=y
9026                         else
9027                                 dflt=n
9028                         fi;;
9029                 *) dflt=n;;
9030                 esac
9031                 echo " "
9032                 rp='Are you getting the hosts file via yellow pages?'
9033                 . ./myread
9034                 case "$ans" in
9035                 y*) hostcat='ypcat hosts';;
9036                 *) hostcat='cat /etc/hosts';;
9037                 esac
9038                 ;;
9039         esac
9040 fi
9041 case "$hostcat" in
9042 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9043 esac
9044 case "$groupcat" in
9045 '') test -f /etc/group && groupcat='cat /etc/group';;
9046 esac
9047 case "$passcat" in
9048 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9049 esac
9050
9051 : now get the host name
9052 echo " "
9053 echo "Figuring out host name..." >&4
9054 case "$myhostname" in
9055 '') cont=true
9056         echo 'Maybe "hostname" will work...'
9057         if tans=`sh -c hostname 2>&1` ; then
9058                 myhostname=$tans
9059                 phostname=hostname
9060                 cont=''
9061         fi
9062         ;;
9063 *) cont='';;
9064 esac
9065 if $test "$cont"; then
9066         if ./xenix; then
9067                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9068                 if tans=`cat /etc/systemid 2>&1` ; then
9069                         myhostname=$tans
9070                         phostname='cat /etc/systemid'
9071                         echo "Whadyaknow.  Xenix always was a bit strange..."
9072                         cont=''
9073                 fi
9074         elif $test -r /etc/systemid; then
9075                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9076         fi
9077 fi
9078 if $test "$cont"; then
9079         echo 'No, maybe "uuname -l" will work...'
9080         if tans=`sh -c 'uuname -l' 2>&1` ; then
9081                 myhostname=$tans
9082                 phostname='uuname -l'
9083         else
9084                 echo 'Strange.  Maybe "uname -n" will work...'
9085                 if tans=`sh -c 'uname -n' 2>&1` ; then
9086                         myhostname=$tans
9087                         phostname='uname -n'
9088                 else
9089                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9090                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9091                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9092                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9093                         else
9094                                 case "$myhostname" in
9095                                 '') echo "Does this machine have an identity crisis or something?"
9096                                         phostname='';;
9097                                 *)
9098                                         echo "Well, you said $myhostname before..."
9099                                         phostname='echo $myhostname';;
9100                                 esac
9101                         fi
9102                 fi
9103         fi
9104 fi
9105 case "$myhostname" in
9106 '') myhostname=noname ;;
9107 esac
9108 : you do not want to know about this
9109 set $myhostname
9110 myhostname=$1
9111
9112 : verify guess
9113 if $test "$myhostname" ; then
9114         dflt=y
9115         rp='Your host name appears to be "'$myhostname'".'" Right?"
9116         . ./myread
9117         case "$ans" in
9118         y*) ;;
9119         *) myhostname='';;
9120         esac
9121 fi
9122
9123 : bad guess or no guess
9124 while $test "X$myhostname" = X ; do
9125         dflt=''
9126         rp="Please type the (one word) name of your host:"
9127         . ./myread
9128         myhostname="$ans"
9129 done
9130
9131 : translate upper to lower if necessary
9132 case "$myhostname" in
9133 *[A-Z]*)
9134         echo "(Normalizing case in your host name)"
9135         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9136         ;;
9137 esac
9138
9139 case "$myhostname" in
9140 *.*)
9141         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9142         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9143         echo "(Trimming domain name from host name--host name is now $myhostname)"
9144         ;;
9145 *) case "$mydomain" in
9146         '')
9147                 {
9148                         test "X$hostcat" = "Xypcat hosts" &&
9149                         ypmatch "$myhostname" hosts 2>/dev/null |\
9150                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9151                         $test -s hosts
9152                 } || {
9153                         test "X$hostcat" != "X" &&
9154                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9155                                         /[       ]$myhostname[  . ]/p" > hosts
9156                 }
9157                 tmp_re="[       . ]"
9158                 if $test -f hosts; then
9159                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9160                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9161                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9162                                 hosts | $sort | $uniq | \
9163                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9164                         case `$echo X$dflt` in
9165                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9166                                 dflt=.
9167                                 ;;
9168                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9169                                 ;;
9170                         esac
9171                 else
9172                         echo "(I cannot locate a hosts database anywhere)"
9173                         dflt=.
9174                 fi
9175                 case "$dflt" in
9176                 .)
9177                         tans=`./loc resolv.conf X /etc /usr/etc`
9178                         if $test -f "$tans"; then
9179                                 echo "(Attempting domain name extraction from $tans)"
9180                                 dflt=.`$sed -n -e 's/   / /g' \
9181                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9182                                   -e 1q 2>/dev/null`
9183                                 case "$dflt" in
9184                                 .) dflt=.`$sed -n -e 's/        / /g' \
9185                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9186                                      -e 1q 2>/dev/null`
9187                                         ;;
9188                                 esac
9189                         fi
9190                         ;;
9191                 esac
9192                 case "$dflt" in
9193                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9194                         dflt=.`sh -c domainname 2>/dev/null`
9195                         case "$dflt" in
9196                         '') dflt='.';;
9197                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9198                         esac
9199                         ;;
9200                 esac
9201                 case "$dflt$osname" in
9202                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9203                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9204                         ;;
9205                 esac
9206                 case "$dflt" in
9207                 .) echo "(Lost all hope -- silly guess then)"
9208                         dflt='.nonet'
9209                         ;;
9210                 esac
9211                 $rm -f hosts
9212                 ;;
9213         *) dflt="$mydomain";;
9214         esac;;
9215 esac
9216 echo " "
9217 rp="What is your domain name?"
9218 . ./myread
9219 tans="$ans"
9220 case "$ans" in
9221 '') ;;
9222 .*) ;;
9223 *) tans=".$tans";;
9224 esac
9225 mydomain="$tans"
9226
9227 : translate upper to lower if necessary
9228 case "$mydomain" in
9229 *[A-Z]*)
9230         echo "(Normalizing case in your domain name)"
9231         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9232         ;;
9233 esac
9234
9235 : a little sanity check here
9236 case "$phostname" in
9237 '') ;;
9238 *)
9239         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9240         $myhostname$mydomain|$myhostname) ;;
9241         *)
9242                 case "$phostname" in
9243                 sed*)
9244                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9245                         ;;
9246                 *)
9247                         echo "(That doesn't agree with your $phostname command, by the way.)"
9248                         ;;
9249                 esac
9250         ;;
9251         esac
9252         ;;
9253 esac
9254
9255 : determine the e-mail address of the user who is running us
9256 $cat <<EOM
9257
9258 I need to get your e-mail address in Internet format if possible, i.e.
9259 something like user@host.domain. Please answer accurately since I have
9260 no easy means to double check it. The default value provided below
9261 is most probably close to reality but may not be valid from outside
9262 your organization...
9263
9264 EOM
9265 cont=x
9266 while test "$cont"; do
9267         case "$MAILDOMAIN" in
9268         '')
9269                 if $test -s /etc/mailname; then
9270                         maildomain=`$cat /etc/mailname`
9271                 else
9272                         maildomain="$myhostname$mydomain"
9273                 fi
9274                 ;;
9275         *)  maildomain="$MAILDOMAIN";;
9276         esac
9277         case "$cf_email" in
9278         '') dflt="$cf_by@$maildomain";;
9279         *)  dflt="$cf_email";;
9280         esac
9281         rp='What is your e-mail address?'
9282         . ./myread
9283         cf_email="$ans"
9284         case "$cf_email" in
9285         *@*.*) cont='' ;;
9286         *)
9287                 rp='Address does not look like an Internet one.  Use it anyway?'
9288                 case "$fastread" in
9289                 yes) dflt=y ;;
9290                 *) dflt=n ;;
9291                 esac
9292                 . ./myread
9293                 case "$ans" in
9294                 y*) cont='' ;;
9295                 *) echo " " ;;
9296                 esac
9297                 ;;
9298         esac
9299 done
9300
9301 : Ask e-mail of administrator
9302 $cat <<EOM
9303
9304 If you or somebody else will be maintaining perl at your site, please
9305 fill in the correct e-mail address here so that they may be contacted
9306 if necessary. Currently, the "perlbug" program included with perl
9307 will send mail to this address in addition to perlbug@perl.org. You may
9308 enter "none" for no administrator.
9309
9310 EOM
9311 case "$perladmin" in
9312 '') dflt="$cf_email";;
9313 *) dflt="$perladmin";;
9314 esac
9315 rp='Perl administrator e-mail address'
9316 . ./myread
9317 perladmin="$ans"
9318
9319 : determine whether to only install version-specific parts.
9320 echo " "
9321 $cat <<EOM
9322 Do you want to install only the version-specific parts of the perl
9323 distribution?  Usually you do *not* want to do this.
9324 EOM
9325 case "$versiononly" in
9326 "$define"|[Yy]*|true) dflt='y' ;;
9327 *) dflt='n';
9328 esac
9329 rp="Do you want to install only the version-specific parts of perl?"
9330 . ./myread
9331 case "$ans" in
9332 [yY]*)  val="$define";;
9333 *)      val="$undef" ;;
9334 esac
9335 set versiononly
9336 eval $setvar
9337
9338 case "$versiononly" in
9339 "$define") inc_version_list=''
9340            inc_version_list_init=0
9341            ;;
9342 esac
9343
9344 : figure out how to guarantee perl startup
9345 : XXX Note that this currently takes advantage of the bug that binexp ignores
9346 :     the Configure -Dinstallprefix setting, which in turn means that under
9347 :     relocatable @INC, initialinstalllocation is what binexp started as.
9348 case "$startperl" in
9349 '')
9350         case "$sharpbang" in
9351         *!)
9352                 $cat <<EOH
9353
9354 I can use the #! construct to start perl on your system. This will
9355 make startup of perl scripts faster, but may cause problems if you
9356 want to share those scripts and perl is not in a standard place
9357 ($initialinstalllocation/perl) on all your platforms. The alternative
9358 is to force a shell by starting the script with a single ':' character.
9359
9360 EOH
9361                 case "$versiononly" in
9362                 "$define")      dflt="$initialinstalllocation/perl$version";;
9363                 *)              dflt="$initialinstalllocation/perl";;
9364                 esac
9365                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9366                 . ./myread
9367                 case "$ans" in
9368                 none)   startperl=": # use perl";;
9369                 *)      startperl="#!$ans"
9370                         if $test 30 -lt `echo "$ans" | wc -c`; then
9371                                 $cat >&4 <<EOM
9372
9373 WARNING:  Some systems limit the #! command to 32 characters.
9374 If you experience difficulty running Perl scripts with #!, try
9375 installing Perl in a directory with a shorter pathname.
9376
9377 EOM
9378                         fi ;;
9379                 esac
9380                 ;;
9381         *) startperl=": # use perl"
9382                 ;;
9383         esac
9384         ;;
9385 esac
9386 echo "I'll use $startperl to start perl scripts."
9387
9388 : figure best path for perl in scripts
9389 case "$perlpath" in
9390 '')
9391         case "$versiononly" in
9392         "$define")      perlpath="$initialinstalllocation/perl$version";;
9393         *)              perlpath="$initialinstalllocation/perl";;
9394         esac
9395         case "$startperl" in
9396         *!*) ;;
9397         *)
9398                 $cat <<EOH
9399
9400 I will use the "eval 'exec'" idiom to start Perl on your system.
9401 I can use the full path of your Perl binary for this purpose, but
9402 doing so may cause problems if you want to share those scripts and
9403 Perl is not always in a standard place ($initialinstalllocation/perl).
9404
9405 EOH
9406                 dflt="$initialinstalllocation/perl"
9407                 rp="What path shall I use in \"eval 'exec'\"?"
9408                 . ./myread
9409                 perlpath="$ans"
9410                 ;;
9411         esac
9412         ;;
9413 esac
9414 case "$startperl" in
9415 *!*)    ;;
9416 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9417 esac
9418
9419 : determine where public executable scripts go
9420 set scriptdir scriptdir
9421 eval $prefixit
9422 case "$scriptdir" in
9423 '')
9424         dflt="$bin"
9425         : guess some guesses
9426         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9427         $test -d /usr/share/bin     && dflt=/usr/share/bin
9428         $test -d /usr/local/script  && dflt=/usr/local/script
9429         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9430         $test -d $prefixexp/script  && dflt=$prefixexp/script
9431         set dflt
9432         eval $prefixup
9433         ;;
9434 *)  dflt="$scriptdir"
9435         ;;
9436 esac
9437 $cat <<EOM
9438
9439 Some installations have a separate directory just for executable scripts so
9440 that they can mount it across multiple architectures but keep the scripts in
9441 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9442 Or you might just lump your scripts in with all your other executables.
9443
9444 EOM
9445 fn=d~
9446 rp='Where do you keep publicly executable scripts?'
9447 . ./getfile
9448 if $test "X$ansexp" != "X$scriptdirexp"; then
9449         installscript=''
9450 fi
9451 installscriptdir=''
9452 prefixvar=scriptdir
9453 . ./setprefixvar
9454 : A little fix up for an irregularly named variable.
9455 installscript="$installscriptdir"
9456
9457 : determine where add-on public executables go
9458 case "$sitebin" in
9459 '')     dflt=$siteprefix/bin ;;
9460 *)      dflt=$sitebin ;;
9461 esac
9462 fn=d~
9463 rp='Pathname where the add-on public executables should be installed?'
9464 . ./getfile
9465 prefixvar=sitebin
9466 . ./setprefixvar
9467
9468 : determine where add-on html pages go
9469 : There is no standard location, so try to copy the previously-selected
9470 : directory structure for the core html pages.
9471 case "$sitehtml1dir" in
9472 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9473 *)     dflt=$sitehtml1dir ;;
9474 esac
9475 case "$dflt" in
9476 ''|' ') dflt=none ;;
9477 esac
9478 fn=dn+~
9479 rp='Pathname where the site-specific html pages should be installed?'
9480 . ./getfile
9481 prefixvar=sitehtml1dir
9482 . ./setprefixvar
9483
9484 : determine where add-on library html pages go
9485 : There is no standard location, so try to copy the previously-selected
9486 : directory structure for the core html pages.
9487 case "$sitehtml3dir" in
9488 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9489 *)     dflt=$sitehtml3dir ;;
9490 esac
9491 case "$dflt" in
9492 ''|' ') dflt=none ;;
9493 esac
9494 fn=dn+~
9495 rp='Pathname where the site-specific library html pages should be installed?'
9496 . ./getfile
9497 prefixvar=sitehtml3dir
9498 . ./setprefixvar
9499
9500 : determine where add-on manual pages go
9501 case "$siteman1dir" in
9502 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9503 *)      dflt=$siteman1dir ;;
9504 esac
9505 case "$dflt" in
9506 ''|' ') dflt=none ;;
9507 esac
9508 fn=dn+~
9509 rp='Pathname where the site-specific manual pages should be installed?'
9510 . ./getfile
9511 prefixvar=siteman1dir
9512 . ./setprefixvar
9513
9514 : determine where add-on library man pages go
9515 case "$siteman3dir" in
9516 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9517 *)      dflt=$siteman3dir ;;
9518 esac
9519 case "$dflt" in
9520 ''|' ') dflt=none ;;
9521 esac
9522 fn=dn+~
9523 rp='Pathname where the site-specific library manual pages should be installed?'
9524 . ./getfile
9525 prefixvar=siteman3dir
9526 . ./setprefixvar
9527
9528 : determine where add-on public executable scripts go
9529 case "$sitescript" in
9530 '')     dflt=$siteprefix/script
9531         $test -d $dflt || dflt=$sitebin ;;
9532 *)  dflt="$sitescript" ;;
9533 esac
9534 fn=d~+
9535 rp='Pathname where add-on public executable scripts should be installed?'
9536 . ./getfile
9537 prefixvar=sitescript
9538 . ./setprefixvar
9539
9540 : see if backtrace exists
9541 set backtrace d_backtrace
9542 eval $inlibc
9543
9544 : add flags if using c backtrace
9545 case "$usecbacktrace" in
9546   "") usecbacktrace=$undef ;;
9547   [yY]*|true|$define)
9548     case "$d_backtrace" in
9549       [yY]*|true|$define)
9550         case " $ccflags " in
9551           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9552           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9553           esac
9554         ;;
9555       *)
9556         echo "This system does not support backtrace" >&4
9557         usecbacktrace=$undef
9558         ;;
9559       esac
9560     ;;
9561   esac
9562
9563 : Check if faststdio is requested and available
9564 case "$usefaststdio" in
9565 $define|true|[yY]*|'')
9566         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9567         case "$xversion" in
9568         [68])   dflt='y' ;;
9569         *)      dflt='n' ;;
9570         esac
9571         ;;
9572 *) dflt='n';;
9573 esac
9574 cat <<EOM
9575
9576 Perl can be built to use 'fast stdio', which means using the stdio
9577 library but also directly manipulating the stdio buffers to enable
9578 faster I/O.  Using stdio is better for backward compatibility (especially
9579 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9580 interface has been preferred instead of stdio.
9581
9582 If this doesn't make any sense to you, just accept the default '$dflt'.
9583 EOM
9584 rp='Use the "fast stdio" if available?'
9585 . ./myread
9586 case "$ans" in
9587 y|Y)    val="$define" ;;
9588 *)      val="$undef" ;;
9589 esac
9590 set usefaststdio
9591 eval $setvar
9592
9593
9594 : define an is-a-typedef? function
9595 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9596 case "$inclist" in
9597 "") inclist="sys/types.h";;
9598 esac;
9599 eval "varval=\$$var";
9600 case "$varval" in
9601 "")
9602         $rm -f temp.c;
9603         for inc in $inclist; do
9604                 echo "#include <$inc>" >>temp.c;
9605         done;
9606         echo "#ifdef $type" >> temp.c;
9607         echo "printf(\"We have $type\");" >> temp.c;
9608         echo "#endif" >> temp.c;
9609         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9610         if $contains $type temp.E >/dev/null 2>&1; then
9611                 eval "$var=\$type";
9612         else
9613                 eval "$var=\$def";
9614         fi;
9615         $rm -f temp.?;;
9616 *) eval "$var=\$varval";;
9617 esac'
9618
9619 : define an is-a-typedef? function that prompts if the type is not available.
9620 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9621 case "$inclist" in
9622 "") inclist="sys/types.h";;
9623 esac;
9624 eval "varval=\$$var";
9625 case "$varval" in
9626 "")
9627         $rm -f temp.c;
9628         for inc in $inclist; do
9629                 echo "#include <$inc>" >>temp.c;
9630         done;
9631         echo "#ifdef $type" >> temp.c;
9632         echo "printf(\"We have $type\");" >> temp.c;
9633         echo "#endif" >> temp.c;
9634         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9635         echo " " ;
9636         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9637         if $contains $type temp.E >/dev/null 2>&1; then
9638                 echo "$type found." >&4;
9639                 eval "$var=\$type";
9640         else
9641                 echo "$type NOT found." >&4;
9642                 dflt="$def";
9643                 . ./myread ;
9644                 eval "$var=\$ans";
9645         fi;
9646         $rm -f temp.?;;
9647 *) eval "$var=\$varval";;
9648 esac'
9649
9650 : see what type lseek is declared as in the kernel
9651 rp="What is the type used for lseek's offset on this system?"
9652 set off_t lseektype long stdio.h sys/types.h
9653 eval $typedef_ask
9654
9655 echo " "
9656 echo "Checking to see how big your file offsets are..." >&4
9657 $cat >try.c <<EOCP
9658 #include <sys/types.h>
9659 #include <stdio.h>
9660 int main()
9661 {
9662     printf("%d\n", (int)sizeof($lseektype));
9663     return(0);
9664 }
9665 EOCP
9666 set try
9667 if eval $compile_ok; then
9668         lseeksize=`$run ./try`
9669         echo "Your file offsets are $lseeksize bytes long."
9670 else
9671         dflt=$longsize
9672         echo " "
9673         echo "(I can't seem to compile the test program.  Guessing...)"
9674         rp="What is the size of your file offsets (in bytes)?"
9675         . ./myread
9676         lseeksize="$ans"
9677 fi
9678 $rm_try
9679
9680 : see what type file positions are declared as in the library
9681 rp="What is the type for file position used by fsetpos()?"
9682 set fpos_t fpostype long stdio.h sys/types.h
9683 eval $typedef_ask
9684
9685 : Check size for Fpos_t
9686 echo " "
9687 case "$fpostype" in
9688 *_t) zzz="$fpostype"    ;;
9689 *)   zzz="fpos_t"       ;;
9690 esac
9691 echo "Checking the size of $zzz..." >&4
9692 cat > try.c <<EOCP
9693 #include <sys/types.h>
9694 #include <stdio.h>
9695 #$i_stdlib I_STDLIB
9696 #ifdef I_STDLIB
9697 #include <stdlib.h>
9698 #endif
9699 int main() {
9700     printf("%d\n", (int)sizeof($fpostype));
9701     exit(0);
9702 }
9703 EOCP
9704 set try
9705 if eval $compile_ok; then
9706         yyy=`$run ./try`
9707         case "$yyy" in
9708         '')     fpossize=4
9709                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9710                 ;;
9711         *)      fpossize=$yyy
9712                 echo "Your $zzz is $fpossize bytes long."
9713                 ;;
9714         esac
9715 else
9716         dflt="$longsize"
9717         echo " " >&4
9718         echo "(I can't compile the test program.  Guessing...)" >&4
9719         rp="What is the size of your file positions (in bytes)?"
9720         . ./myread
9721         fpossize="$ans"
9722 fi
9723
9724 : Check for large file support
9725 # Backward compatibility (uselfs is deprecated).
9726 case "$uselfs" in
9727 "$define"|true|[yY]*)
9728         cat <<EOM >&4
9729
9730 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9731 EOM
9732         uselargefiles="$define"
9733         ;;
9734 esac
9735
9736 case "$lseeksize:$fpossize" in
9737 8:8) cat <<EOM
9738
9739 You can have files larger than 2 gigabytes.
9740 EOM
9741    val="$define" ;;
9742 *)    case "$uselargefiles" in
9743    "$undef"|false|[nN]*) dflt='n' ;;
9744    *)   dflt='y' ;;
9745    esac
9746    cat <<EOM
9747
9748 Perl can be built to understand large files (files larger than 2 gigabytes)
9749 on some systems.  To do so, Configure can be run with -Duselargefiles.
9750
9751 If this doesn't make any sense to you, just accept the default '$dflt'.
9752 EOM
9753    rp='Try to understand large files, if available?'
9754    . ./myread
9755    case "$ans" in
9756    y|Y)         val="$define" ;;
9757    *)           val="$undef"  ;;
9758    esac
9759    ;;
9760 esac
9761 set uselargefiles
9762 eval $setvar
9763 : Look for a hint-file generated 'call-back-unit'.  If the
9764 : user has specified that a large files perl is to be built,
9765 : we may need to set or change some other defaults.
9766 if $test -f uselargefiles.cbu; then
9767         echo "Your platform has some specific hints regarding large file builds, using them..."
9768         . ./uselargefiles.cbu
9769 fi
9770 case "$uselargefiles" in
9771 "$define")
9772         if $test -f uselargefiles.cbu; then
9773                 echo " "
9774                 echo "Rechecking to see how big your file offsets are..." >&4
9775                 $cat >try.c <<EOCP
9776 #include <sys/types.h>
9777 #include <stdio.h>
9778 int main()
9779 {
9780     printf("%d\n", (int)sizeof($lseektype));
9781     return(0);
9782 }
9783 EOCP
9784                 set try
9785                 if eval $compile_ok; then
9786                         lseeksize=`$run ./try`
9787                         $echo "Your file offsets are now $lseeksize bytes long."
9788                 else
9789                         dflt="$lseeksize"
9790                         echo " "
9791                         echo "(I can't seem to compile the test program.  Guessing...)"
9792                         rp="What is the size of your file offsets (in bytes)?"
9793                         . ./myread
9794                         lseeksize="$ans"
9795                 fi
9796                 case "$fpostype" in
9797                 *_t) zzz="$fpostype"    ;;
9798                 *)   zzz="fpos_t"       ;;
9799                 esac
9800                 $echo $n "Rechecking the size of $zzz...$c" >&4
9801                 $cat > try.c <<EOCP
9802 #include <sys/types.h>
9803 #include <stdio.h>
9804 #$i_stdlib I_STDLIB
9805 #ifdef I_STDLIB
9806 #include <stdlib.h>
9807 #endif
9808 int main() {
9809     printf("%d\n", (int)sizeof($fpostype));
9810     return(0);
9811 }
9812 EOCP
9813                 set try
9814                 if eval $compile_ok; then
9815                         yyy=`$run ./try`
9816                         dflt="$lseeksize"
9817                         case "$yyy" in
9818                         '')     echo " "
9819                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9820                                 ;;
9821                         *)      fpossize=$yyy
9822                                 echo " $fpossize bytes." >&4
9823                                 ;;
9824                         esac
9825                 else
9826                         dflt="$fpossize"
9827                         echo " "
9828                         echo "(I can't compile the test program.  Guessing...)" >&4
9829                         rp="What is the size of your file positions (in bytes)?"
9830                         . ./myread
9831                         fpossize="$ans"
9832                 fi
9833                 $rm_try
9834         fi
9835         ;;
9836 esac
9837
9838 : Check if we want perlio
9839 useperlio="$define"
9840
9841 : Set the vendorbin variables
9842 case "$vendorprefix" in
9843 '')     d_vendorbin="$undef"
9844         vendorbin=''
9845         vendorbinexp=''
9846         ;;
9847 *)      d_vendorbin="$define"
9848         : determine where vendor-supplied executables go.
9849         case "$vendorbin" in
9850         '') dflt=$vendorprefix/bin ;;
9851         *)      dflt="$vendorbin" ;;
9852         esac
9853         fn=d~+
9854         rp='Pathname for the vendor-supplied executables directory?'
9855         . ./getfile
9856         vendorbin="$ans"
9857         vendorbinexp="$ansexp"
9858         ;;
9859 esac
9860 prefixvar=vendorbin
9861 . ./installprefix
9862
9863 : Set the vendorhtml1dir variables
9864 case "$vendorprefix" in
9865 '')     vendorhtml1dir=''
9866         vendorhtml1direxp=''
9867         ;;
9868 *)      : determine where vendor-supplied html pages go.
9869         : There is no standard location, so try to copy the previously-selected
9870         : directory structure for the core html pages.
9871         : XXX Better default suggestions would be welcome.
9872         case "$vendorhtml1dir" in
9873         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9874         *)      dflt=$vendorhtml1dir ;;
9875         esac
9876         case "$dflt" in
9877         ''|' ') dflt=none ;;
9878         esac
9879         fn=dn+~
9880         rp='Pathname for the vendor-supplied html pages?'
9881         . ./getfile
9882         vendorhtml1dir="$ans"
9883         vendorhtml1direxp="$ansexp"
9884         ;;
9885 esac
9886 : Use ' ' for none so value is preserved next time through Configure
9887 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9888 prefixvar=vendorhtml1dir
9889 . ./installprefix
9890
9891 : Set the vendorhtml3dir variables
9892 case "$vendorprefix" in
9893 '')     vendorhtml3dir=''
9894         vendorhtml3direxp=''
9895         ;;
9896 *)      : determine where vendor-supplied module html pages go.
9897         : There is no standard location, so try to copy the previously-selected
9898         : directory structure for the core html pages.
9899         : XXX Better default suggestions would be welcome.
9900         case "$vendorhtml3dir" in
9901         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9902         *)      dflt=$vendorhtml3dir ;;
9903         esac
9904         case "$dflt" in
9905         ''|' ') dflt=none ;;
9906         esac
9907         fn=dn+~
9908         rp='Pathname for the vendor-supplied html pages?'
9909         . ./getfile
9910         vendorhtml3dir="$ans"
9911         vendorhtml3direxp="$ansexp"
9912         ;;
9913 esac
9914 : Use ' ' for none so value is preserved next time through Configure
9915 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9916 prefixvar=vendorhtml3dir
9917 . ./installprefix
9918
9919 : Set the vendorman1dir variables
9920 case "$vendorprefix" in
9921 '')     vendorman1dir=''
9922         vendorman1direxp=''
9923         ;;
9924 *)      : determine where vendor-supplied manual pages go.
9925         case "$vendorman1dir" in
9926         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9927         *)      dflt=$vendorman1dir ;;
9928         esac
9929         case "$dflt" in
9930         ''|' ') dflt=none ;;
9931         esac
9932         fn=nd~+
9933         rp='Pathname for the vendor-supplied manual section 1 pages?'
9934         . ./getfile
9935         vendorman1dir="$ans"
9936         vendorman1direxp="$ansexp"
9937         ;;
9938 esac
9939 : Use ' ' for none so value is preserved next time through Configure
9940 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9941 prefixvar=vendorman1dir
9942 . ./installprefix
9943
9944 : Set the vendorman3dir variables
9945 case "$vendorprefix" in
9946 '')     vendorman3dir=''
9947         vendorman3direxp=''
9948         ;;
9949 *)      : determine where vendor-supplied module manual pages go.
9950         case "$vendorman3dir" in
9951         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9952         *)      dflt=$vendorman3dir ;;
9953         esac
9954         case "$dflt" in
9955         ''|' ') dflt=none ;;
9956         esac
9957         fn=nd~+
9958         rp='Pathname for the vendor-supplied manual section 3 pages?'
9959         . ./getfile
9960         vendorman3dir="$ans"
9961         vendorman3direxp="$ansexp"
9962         ;;
9963 esac
9964 : Use ' ' for none so value is preserved next time through Configure
9965 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9966 prefixvar=vendorman3dir
9967 . ./installprefix
9968
9969 : Set the vendorscript variables
9970 case "$vendorprefix" in
9971 '')     d_vendorscript="$undef"
9972         vendorscript=''
9973         vendorscriptexp=''
9974         ;;
9975 *)      d_vendorscript="$define"
9976         : determine where vendor-supplied scripts go.
9977         case "$vendorscript" in
9978         '')     dflt=$vendorprefix/script
9979                 $test -d $dflt || dflt=$vendorbin ;;
9980         *)  dflt="$vendorscript" ;;
9981         esac
9982         $cat <<EOM
9983
9984 The installation process will create a directory for
9985 vendor-supplied scripts.
9986
9987 EOM
9988         fn=d~+
9989         rp='Pathname for the vendor-supplied scripts directory?'
9990         . ./getfile
9991         vendorscript="$ans"
9992         vendorscriptexp="$ansexp"
9993         ;;
9994 esac
9995 prefixvar=vendorscript
9996 . ./installprefix
9997
9998 : script used to emit important warnings
9999 cat >warn <<EOS
10000 $startsh
10001 if test \$# -gt 0; then
10002         echo "\$@" >msg
10003 else
10004         cat >msg
10005 fi
10006 echo "*** WARNING:" >&4
10007 sed -e 's/^/*** /' <msg >&4
10008 echo "*** " >&4
10009 cat msg >>config.msg
10010 echo " " >>config.msg
10011 rm -f msg
10012 EOS
10013 chmod +x warn
10014 $eunicefix warn
10015
10016 : see which of string.h or strings.h is needed
10017 echo " "
10018 strings=`./findhdr string.h`
10019 if $test "$strings" && $test -r "$strings"; then
10020         echo "Using <string.h> instead of <strings.h>." >&4
10021         val="$define"
10022 else
10023         val="$undef"
10024         strings=`./findhdr strings.h`
10025         if $test "$strings" && $test -r "$strings"; then
10026                 echo "Using <strings.h> instead of <string.h>." >&4
10027         else
10028                 ./warn "No string header found -- You'll surely have problems."
10029         fi
10030 fi
10031 set i_string
10032 eval $setvar
10033 case "$i_string" in
10034 "$undef") strings=`./findhdr strings.h`;;
10035 *)        strings=`./findhdr string.h`;;
10036 esac
10037
10038 : see if qgcvt exists
10039 set qgcvt d_qgcvt
10040 eval $inlibc
10041
10042 : Check what kind of doubles your system has
10043 $echo "Checking the kind of doubles you have..." >&4
10044 $cat >try.c <<EOP
10045 #$i_stdlib I_STDLIB
10046 #define DOUBLESIZE $doublesize
10047 #ifdef I_STDLIB
10048 #include <stdlib.h>
10049 #endif
10050 #include <stdio.h>
10051 static const double d = -0.1;
10052 int main() {
10053   unsigned const char* b = (unsigned const char*)(&d);
10054 #if DOUBLESIZE == 4
10055   if (b[0] == 0xCD && b[3] == 0xBD) {
10056     /* IEEE 754 32-bit little-endian */
10057     printf("1\n");
10058     exit(0);
10059   }
10060   if (b[0] == 0xBD && b[3] == 0xCD) {
10061     /* IEEE 754 32-bit big-endian */
10062     printf("2\n");
10063     exit(0);
10064   }
10065 #endif
10066 #if DOUBLESIZE == 8
10067   if (b[0] == 0x9A && b[7] == 0xBF) {
10068     /* IEEE 754 64-bit little-endian */
10069     printf("3\n");
10070     exit(0);
10071   }
10072   if (b[0] == 0xBF && b[7] == 0x9A) {
10073     /* IEEE 754 64-bit big-endian */
10074     printf("4\n");
10075     exit(0);
10076   }
10077   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10078    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10079     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10080     * 99 99 b9 bf 9a 99 99 99 */
10081     printf("7\n");
10082     exit(0);
10083   }
10084   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10085    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10086     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10087     * 99 99 99 9a bf b9 99 99 */
10088     printf("8\n");
10089     exit(0);
10090   }
10091 #endif
10092 #if DOUBLESIZE == 16
10093   if (b[0] == 0x9A && b[15] == 0xBF) {
10094     /* IEEE 754 128-bit little-endian */
10095     printf("5\n");
10096     exit(0);
10097   }
10098   if (b[0] == 0xBF && b[15] == 0x9A) {
10099     /* IEEE 754 128-bit big-endian */
10100     printf("6\n");
10101     exit(0);
10102   }
10103 #endif
10104   /* Then there are old mainframe/miniframe formats like VAX, IBM, and CRAY.
10105    * Whether those environments can still build Perl is debatable. */
10106   printf("-1\n"); /* unknown */
10107   exit(0);
10108 }
10109 EOP
10110 set try
10111 if eval $compile; then
10112     doublekind=`$run ./try`
10113 else
10114     doublekind=-1
10115 fi
10116 case "$doublekind" in
10117 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10118 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10119 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10120 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10121 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10122 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10123 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10124 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10125 *) echo "Cannot figure out your double.  You VAX, or something?" >&4 ;;
10126 esac
10127 $rm_try
10128
10129 : Check print/scan long double stuff
10130 echo " "
10131
10132 if $test X"$d_longdbl" = X"$define"; then
10133
10134 echo "Checking how to print long doubles..." >&4
10135
10136 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10137         $cat >try.c <<'EOCP'
10138 #include <sys/types.h>
10139 #include <stdio.h>
10140 int main() {
10141   double d = 123.456;
10142   printf("%.3f\n", d);
10143 }
10144 EOCP
10145         set try
10146         if eval $compile; then
10147                 yyy=`$run ./try`
10148                 case "$yyy" in
10149                 123.456)
10150                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10151                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10152                         echo "We will use %f."
10153                         ;;
10154                 esac
10155         fi
10156 fi
10157
10158 if $test X"$sPRIfldbl" = X; then
10159         $cat >try.c <<'EOCP'
10160 #include <sys/types.h>
10161 #include <stdio.h>
10162 int main() {
10163   long double d = 123.456;
10164   printf("%.3Lf\n", d);
10165 }
10166 EOCP
10167         set try
10168         if eval $compile; then
10169                 yyy=`$run ./try`
10170                 case "$yyy" in
10171                 123.456)
10172                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10173                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10174                         echo "We will use %Lf."
10175                         ;;
10176                 esac
10177         fi
10178 fi
10179
10180 if $test X"$sPRIfldbl" = X; then
10181         $cat >try.c <<'EOCP'
10182 #include <sys/types.h>
10183 #include <stdio.h>
10184 int main() {
10185   long double d = 123.456;
10186   printf("%.3llf\n", d);
10187 }
10188 EOCP
10189         set try
10190         if eval $compile; then
10191                 yyy=`$run ./try`
10192                 case "$yyy" in
10193                 123.456)
10194                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10195                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10196                         echo "We will use %llf."
10197                         ;;
10198                 esac
10199         fi
10200 fi
10201
10202 if $test X"$sPRIfldbl" = X; then
10203         $cat >try.c <<'EOCP'
10204 #include <sys/types.h>
10205 #include <stdio.h>
10206 int main() {
10207   long double d = 123.456;
10208   printf("%.3lf\n", d);
10209 }
10210 EOCP
10211         set try
10212         if eval $compile; then
10213                 yyy=`$run ./try`
10214                 case "$yyy" in
10215                 123.456)
10216                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10217                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10218                         echo "We will use %lf."
10219                         ;;
10220                 esac
10221         fi
10222 fi
10223
10224 if $test X"$sPRIfldbl" = X; then
10225         echo "Cannot figure out how to print long doubles." >&4
10226 else
10227         sSCNfldbl=$sPRIfldbl    # expect consistency
10228 fi
10229
10230 $rm_try
10231
10232 fi # d_longdbl
10233
10234 case "$sPRIfldbl" in
10235 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10236         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10237         d_SCNfldbl="$undef";
10238         ;;
10239 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10240         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10241         d_SCNfldbl="$define";
10242         ;;
10243 esac
10244
10245 : Before committing on uselongdouble, see whether that looks sane.
10246 if $test "$uselongdouble" = "$define"; then
10247     message=""
10248     echo " "
10249     echo "Checking if your long double math functions work right..." >&4
10250     $cat > try.c <<EOF
10251 #include <math.h>
10252 #include <stdio.h>
10253 int main() {
10254   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10255 }
10256 EOF
10257     case "$osname:$gccversion" in
10258     aix:)       saveccflags="$ccflags"
10259                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10260     esac
10261     set try
10262     if eval $compile_ok; then
10263       yyy=`$run ./try`
10264     fi
10265     case "$yyy" in
10266     3) echo "Your long double math functions are working correctly." >&4 ;;
10267     *) echo "Your long double math functions are broken, not using long doubles." >&4
10268        uselongdouble=$undef
10269        ;;
10270     esac
10271     $rm_try
10272     case "$osname:$gccversion" in
10273     aix:)       ccflags="$saveccflags" ;; # restore
10274     esac
10275 fi
10276
10277 : Check how to convert floats to strings.
10278
10279 if test "X$d_Gconvert" = X; then
10280
10281 echo " "
10282 echo "Checking for an efficient way to convert floats to strings."
10283 echo " " > try.c
10284 case "$uselongdouble" in
10285 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10286 esac
10287 case "$d_longdbl" in
10288 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10289 esac
10290 case "$d_PRIgldbl" in
10291 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10292 esac
10293 $cat >>try.c <<EOP
10294 #ifdef TRY_gconvert
10295 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10296 char *myname = "gconvert";
10297 #endif
10298 #ifdef TRY_gcvt
10299 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10300 char *myname = "gcvt";
10301 #endif
10302 #ifdef TRY_qgcvt
10303 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10304 char *myname = "qgcvt";
10305 #define DOUBLETYPE long double
10306 #endif
10307 #ifdef TRY_sprintf
10308 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10309 #ifdef HAS_PRIgldbl
10310 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10311 #else
10312 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10313 #endif
10314 #else
10315 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10316 #endif
10317 char *myname = "sprintf";
10318 #endif
10319
10320 #ifndef DOUBLETYPE
10321 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10322 #define DOUBLETYPE long double
10323 #else
10324 #define DOUBLETYPE double
10325 #endif
10326 #endif
10327
10328 #include <stdio.h>
10329
10330 #$i_stdlib I_STDLIB
10331 #ifdef I_STDLIB
10332 #include <stdlib.h>
10333 #endif
10334 #$i_string I_STRING
10335 #ifdef I_STRING
10336 #  include <string.h>
10337 #else
10338 #  include <strings.h>
10339 #endif
10340
10341 int checkit(char *expect, char *got)
10342 {
10343     if (strcmp(expect, got)) {
10344                 printf("%s oddity:  Expected %s, got %s\n",
10345                         myname, expect, got);
10346                 exit(1);
10347         }
10348 }
10349
10350 int main()
10351 {
10352         char buf[64];
10353         buf[63] = '\0';
10354
10355         /* This must be 1st test on (which?) platform */
10356         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10357         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10358         checkit("0.1", buf);
10359
10360         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10361         checkit("0.01", buf);
10362
10363         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10364         checkit("0.001", buf);
10365
10366         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10367         checkit("0.0001", buf);
10368
10369         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10370         if (strlen(buf) > 5)
10371             checkit("9e-005", buf); /* for Microsoft ?? */
10372         else
10373             checkit("9e-05", buf);
10374
10375         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10376         checkit("1", buf);
10377
10378         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10379         checkit("1.1", buf);
10380
10381         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10382         checkit("1.01", buf);
10383
10384         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10385         checkit("1.001", buf);
10386
10387         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10388         checkit("1.0001", buf);
10389
10390         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10391         checkit("1.00001", buf);
10392
10393         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10394         checkit("1.000001", buf);
10395
10396         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10397         checkit("0", buf);
10398
10399         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10400         checkit("-1", buf);
10401
10402         /* Some Linux gcvt's give 1.e+5 here. */
10403         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10404         checkit("100000", buf);
10405
10406         /* Some Linux gcvt's give -1.e+5 here. */
10407         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10408         checkit("-100000", buf);
10409
10410         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10411         checkit("123.456", buf);
10412
10413         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10414         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10415         /* 34 should be enough to scare even long double
10416          * places into using the e notation. */
10417         if (strlen(buf) > 5)
10418             checkit("1e+034", buf); /* for Microsoft */
10419         else
10420             checkit("1e+34", buf);
10421
10422         /* For Perl, if you add additional tests here, also add them to
10423          * t/base/num.t for benefit of platforms not using Configure or
10424          * overriding d_Gconvert */
10425
10426         exit(0);
10427 }
10428 EOP
10429 : first add preferred functions to our list
10430 xxx_list=""
10431 for xxx_convert in $gconvert_preference; do
10432     case $xxx_convert in
10433     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10434     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10435     esac
10436 done
10437 : then add any others
10438 for xxx_convert in gconvert gcvt sprintf; do
10439     case "$xxx_list" in
10440     *$xxx_convert*) ;;
10441     *) xxx_list="$xxx_list $xxx_convert" ;;
10442     esac
10443 done
10444
10445 case "$d_longdbl$uselongdouble" in
10446 "$define$define")
10447     : again, add preferred functions to our list first
10448     xxx_ld_list=""
10449     for xxx_convert in $gconvert_ld_preference; do
10450         case $xxx_convert in
10451         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10452         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10453         esac
10454     done
10455     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10456     for xxx_convert in qgcvt sprintf $xxx_list; do
10457         case "$xxx_ld_list" in
10458         $xxx_convert*|*" $xxx_convert"*) ;;
10459         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10460         esac
10461     done
10462     : if sprintf cannot do long doubles, move it to the end
10463     if test "$d_PRIgldbl" != "$define"; then
10464         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10465     fi
10466     : if no qgcvt, remove it
10467     if test "$d_qgcvt" != "$define"; then
10468         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10469     fi
10470     : use the ld_list
10471     xxx_list="$xxx_ld_list"
10472     ;;
10473 esac
10474
10475 for xxx_convert in $xxx_list; do
10476         echo "Trying $xxx_convert..."
10477         $rm -f try try$_o core
10478         set try -DTRY_$xxx_convert
10479         if eval $compile; then
10480                 echo "$xxx_convert() found." >&4
10481                 if $run ./try; then
10482                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10483                         break;
10484                 else
10485                         echo "...But $xxx_convert didn't work as I expected."
10486                         xxx_convert=''
10487                 fi
10488         else
10489                 echo "$xxx_convert NOT found." >&4
10490         fi
10491 done
10492
10493 if test X$xxx_convert = X; then
10494     echo "*** WHOA THERE!!! ***" >&4
10495     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10496     xxx_convert=sprintf
10497 fi
10498
10499 case "$xxx_convert" in
10500 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10501 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10502 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10503 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10504    "$define$define$define")
10505       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10506    "$define$define$undef")
10507       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10508    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10509    esac
10510    ;;
10511 esac
10512
10513 fi
10514 $rm_try
10515
10516 : see if _fwalk exists
10517 set fwalk d__fwalk
10518 eval $inlibc
10519
10520 : Initialize h_fcntl
10521 h_fcntl=false
10522
10523 : Initialize h_sysfile
10524 h_sysfile=false
10525
10526 : access call always available on UNIX
10527 set access d_access
10528 eval $inlibc
10529
10530 : locate the flags for 'access()'
10531 case "$d_access" in
10532 "$define")
10533         echo " "
10534         $cat >access.c <<EOCP
10535 #include <sys/types.h>
10536 #ifdef I_FCNTL
10537 #include <fcntl.h>
10538 #endif
10539 #ifdef I_SYS_FILE
10540 #include <sys/file.h>
10541 #endif
10542 #ifdef I_UNISTD
10543 #include <unistd.h>
10544 #endif
10545 #$i_stdlib I_STDLIB
10546 #ifdef I_STDLIB
10547 #include <stdlib.h>
10548 #endif
10549 int main() {
10550         exit(R_OK);
10551 }
10552 EOCP
10553         : check sys/file.h first, no particular reason here
10554         if $test `./findhdr sys/file.h` && \
10555                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10556                 h_sysfile=true;
10557                 echo "<sys/file.h> defines the *_OK access constants." >&4
10558         elif $test `./findhdr fcntl.h` && \
10559                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10560                 h_fcntl=true;
10561                 echo "<fcntl.h> defines the *_OK access constants." >&4
10562         elif $test `./findhdr unistd.h` && \
10563                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10564                 echo "<unistd.h> defines the *_OK access constants." >&4
10565         else
10566                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10567         fi
10568         ;;
10569 esac
10570 $rm -f access*
10571
10572 : see if accessx exists
10573 set accessx d_accessx
10574 eval $inlibc
10575
10576 : see if acosh exists
10577 set acosh d_acosh
10578 eval $inlibc
10579
10580 : see if aintl exists
10581 set aintl d_aintl
10582 eval $inlibc
10583
10584 : see if alarm exists
10585 set alarm d_alarm
10586 eval $inlibc
10587
10588 : see if 64bit time functions exists
10589
10590 set ctime64 d_ctime64
10591 eval $inlibc
10592
10593 set localtime64 d_localtime64
10594 eval $inlibc
10595
10596 set gmtime64 d_gmtime64
10597 eval $inlibc
10598
10599 set mktime64 d_mktime64
10600 eval $inlibc
10601
10602 set difftime64 d_difftime64
10603 eval $inlibc
10604
10605 set asctime64 d_asctime64
10606 eval $inlibc
10607
10608 : see if POSIX threads are available
10609 set pthread.h i_pthread
10610 eval $inhdr
10611
10612 : define a function to check prototypes
10613 $cat > protochk <<EOSH
10614 $startsh
10615 cc="$cc"
10616 optimize="$optimize"
10617 ccflags="$ccflags"
10618 prototype="$prototype"
10619 define="$define"
10620 rm_try="$rm_try"
10621 usethreads=$usethreads
10622 i_pthread=$i_pthread
10623 pthread_h_first=$pthread_h_first
10624 EOSH
10625
10626 $cat >> protochk <<'EOSH'
10627
10628 $rm_try
10629 foo="$1"
10630 shift
10631 while test $# -ge 2; do
10632         case "$1" in
10633                 $define) echo "#include <$2>" >> try.c ;;
10634                 literal) echo "$2" >> try.c ;;
10635         esac
10636     # Extra magic for the benefit of systems that need pthread.h
10637     # to be included early to correctly detect threadsafe functions.
10638     # Such functions must guarantee themselves, though, that the usethreads
10639     # and i_pthread have been defined, before calling protochk.
10640     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10641         echo "#include <pthread.h>" >> try.c
10642         pthread_h_done=yes
10643     fi
10644     shift 2
10645 done
10646 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10647 cat >> try.c <<'EOCP'
10648 #ifdef CAN_PROTOTYPE
10649 #define _(args) args
10650 #else
10651 #define _(args) ()
10652 #endif
10653 EOCP
10654 echo "$foo" >> try.c
10655 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10656 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10657 status=$?
10658 $rm_try
10659 exit $status
10660 EOSH
10661 chmod +x protochk
10662 $eunicefix protochk
10663
10664 : Define hasproto macro for Configure internal use
10665 hasproto='varname=$1; func=$2; shift; shift;
10666 while $test $# -ge 2; do
10667         case "$1" in
10668         $define) echo "#include <$2>";;
10669         esac ;
10670     shift 2;
10671 done > try.c;
10672 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10673 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10674         echo "$func() prototype found.";
10675         val="$define";
10676 else
10677         echo "$func() prototype NOT found.";
10678         val="$undef";
10679 fi;
10680 set $varname;
10681 eval $setvar;
10682 $rm_try tryout.c'
10683
10684 : see if sys/types.h has to be included
10685 set sys/types.h i_systypes
10686 eval $inhdr
10687
10688 : see if sys/select.h has to be included
10689 set sys/select.h i_sysselct
10690 eval $inhdr
10691
10692 : Define hasfield macro for Configure internal use
10693 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10694 while $test $# -ge 2; do
10695         case "$1" in
10696         $define) echo "#include <$2>";;
10697         esac ;
10698     shift 2;
10699 done > try.c;
10700 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10701 set try;
10702 if eval $compile; then
10703         val="$define";
10704 else
10705         val="$undef";
10706 fi;
10707 set $varname;
10708 eval $setvar;
10709 $rm_try'
10710
10711 : see if we should include time.h, sys/time.h, or both
10712 echo " "
10713 if test "X$timeincl" = X; then
10714         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10715         $echo $n "I'm now running the test program...$c"
10716         $cat >try.c <<EOCP
10717 #include <sys/types.h>
10718 #ifdef I_TIME
10719 #include <time.h>
10720 #endif
10721 #ifdef I_SYSTIME
10722 #ifdef SYSTIMEKERNEL
10723 #define KERNEL
10724 #endif
10725 #include <sys/time.h>
10726 #endif
10727 #ifdef I_SYSSELECT
10728 #include <sys/select.h>
10729 #endif
10730 #$i_stdlib I_STDLIB
10731 #ifdef I_STDLIB
10732 #include <stdlib.h>
10733 #endif
10734 int main()
10735 {
10736         struct tm foo;
10737 #ifdef S_TIMEVAL
10738         struct timeval bar;
10739 #endif
10740 #ifdef S_TIMEZONE
10741         struct timezone tzp;
10742 #endif
10743         if (foo.tm_sec == foo.tm_sec)
10744                 exit(0);
10745 #ifdef S_TIMEVAL
10746         if (bar.tv_sec == bar.tv_sec)
10747                 exit(0);
10748 #endif
10749         exit(1);
10750 }
10751 EOCP
10752         flags=''
10753         for s_timezone in '-DS_TIMEZONE' ''; do
10754         sysselect=''
10755         for s_timeval in '-DS_TIMEVAL' ''; do
10756         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10757         for i_time in '' '-DI_TIME'; do
10758         for i_systime in '-DI_SYSTIME' ''; do
10759                 case "$flags" in
10760                 '') $echo $n ".$c"
10761                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10762                         if eval $compile; then
10763                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10764                                 shift
10765                                 flags="$*"
10766                                 echo " "
10767                                 $echo $n "Succeeded with $flags$c"
10768                         fi
10769                         ;;
10770                 esac
10771         done
10772         done
10773         done
10774         done
10775         done
10776         timeincl=''
10777         echo " "
10778         case "$flags" in
10779         *SYSTIMEKERNEL*) i_systimek="$define"
10780                 timeincl=`./findhdr sys/time.h`
10781                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10782         *) i_systimek="$undef";;
10783         esac
10784         case "$flags" in
10785         *I_TIME*) i_time="$define"
10786                 timeincl=`./findhdr time.h`" $timeincl"
10787                 echo "We'll include <time.h>." >&4;;
10788         *) i_time="$undef";;
10789         esac
10790         case "$flags" in
10791         *I_SYSTIME*) i_systime="$define"
10792                 timeincl=`./findhdr sys/time.h`" $timeincl"
10793                 echo "We'll include <sys/time.h>." >&4;;
10794         *) i_systime="$undef";;
10795         esac
10796         $rm_try
10797 fi
10798 : see if struct tm knows about tm_zone
10799 case "$i_systime$i_time" in
10800 *$define*)
10801         echo " "
10802         echo "Checking to see if your struct tm has tm_zone field..." >&4
10803         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10804         eval $hasfield
10805         ;;
10806 *)      val="$undef"
10807         set d_tm_tm_zone
10808         eval $setvar
10809         ;;
10810 esac
10811 case "$d_tm_tm_zone" in
10812 "$define")      echo "Yes, it does."   ;;
10813 *)              echo "No, it doesn't." ;;
10814 esac
10815 : see if struct tm knows about tm_gmtoff
10816 case "$i_systime$i_time" in
10817 *$define*)
10818         echo " "
10819         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10820         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10821         eval $hasfield
10822         ;;
10823 *)      val="$undef"
10824         set d_tm_tm_gmtoff
10825         eval $setvar
10826         ;;
10827 esac
10828 case "$d_tm_tm_gmtoff" in
10829 "$define")      echo "Yes, it does."   ;;
10830 *)              echo "No, it doesn't." ;;
10831 esac
10832
10833 : see if asctime_r exists
10834 set asctime_r d_asctime_r
10835 eval $inlibc
10836 case "$d_asctime_r" in
10837 "$define")
10838         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10839         case "$d_asctime_r_proto:$usethreads" in
10840         ":define")      d_asctime_r_proto=define
10841                 set d_asctime_r_proto asctime_r $hdrs
10842                 eval $hasproto ;;
10843         *)      ;;
10844         esac
10845         case "$d_asctime_r_proto" in
10846         define)
10847         case "$asctime_r_proto" in
10848         ''|0) try='char* asctime_r(const struct tm*, char*);'
10849         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10850         esac
10851         case "$asctime_r_proto" in
10852         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10853         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10854         esac
10855         case "$asctime_r_proto" in
10856         ''|0) try='int asctime_r(const struct tm*, char*);'
10857         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10858         esac
10859         case "$asctime_r_proto" in
10860         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10861         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10862         esac
10863         case "$asctime_r_proto" in
10864         ''|0)   d_asctime_r=undef
10865                 asctime_r_proto=0
10866                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10867         * )     case "$asctime_r_proto" in
10868                 REENTRANT_PROTO*) ;;
10869                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10870                 esac
10871                 echo "Prototype: $try" ;;
10872         esac
10873         ;;
10874         *)      case "$usethreads" in
10875                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10876                 esac
10877                 d_asctime_r=undef
10878                 asctime_r_proto=0
10879                 ;;
10880         esac
10881         ;;
10882 *)      asctime_r_proto=0
10883         ;;
10884 esac
10885
10886 : see if asinh exists
10887 set asinh d_asinh
10888 eval $inlibc
10889
10890 : see if atanh exists
10891 set atanh d_atanh
10892 eval $inlibc
10893
10894 : see if atolf exists
10895 set atolf d_atolf
10896 eval $inlibc
10897
10898 : see if atoll exists
10899 set atoll d_atoll
10900 eval $inlibc
10901
10902 : Look for GCC-style attribute format
10903 case "$d_attribute_format" in
10904 '')
10905 echo " "
10906 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10907 $cat >attrib.c <<'EOCP'
10908 #include <stdio.h>
10909 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10910 EOCP
10911 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10912         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10913                 echo "Your C compiler doesn't support __attribute__((format))."
10914                 val="$undef"
10915         else
10916                 echo "Your C compiler supports __attribute__((format))."
10917                 val="$define"
10918         fi
10919 else
10920         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10921         val="$undef"
10922 fi
10923 ;;
10924 *) val="$d_attribute_format" ;;
10925 esac
10926 set d_attribute_format
10927 eval $setvar
10928 $rm -f attrib*
10929
10930 : Look for GCC-style attribute format with null format allowed
10931 case "$d_printf_format_null" in
10932 '') case "$d_attribute_format" in
10933     $define)
10934         echo " "
10935         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10936 $cat >attrib.c <<EOCP
10937 #include <stdio.h>
10938 #$i_stdlib I_STDLIB
10939 #ifdef I_STDLIB
10940 #include <stdlib.h>
10941 #endif
10942 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10943 int null_printf (char* pat,...) { return (int)pat; }
10944 int main () { exit(null_printf(NULL)); }
10945 EOCP
10946         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10947             : run the executable in case it produces a run-time warning
10948             if $run ./attrib >>attrib.out 2>&1; then
10949                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10950                     echo "Your C compiler doesn't allow __printf__ format to be null."
10951                     val="$undef"
10952                 else
10953                     echo "Your C compiler allows __printf__ format to be null."
10954                     val="$define"
10955                 fi
10956             else
10957             echo "Your C compiler executable failed with __printf__ format null."
10958             val="$undef"
10959         fi
10960     else
10961         echo "Your C compiler fails with __printf__ format null."
10962         val="$undef"
10963     fi
10964     ;;
10965     *)  val="$undef" ;;
10966     esac
10967 ;;
10968 *)  val="$d_printf_format_null" ;;
10969 esac
10970 set d_printf_format_null
10971 eval $setvar
10972 $rm -f attrib*
10973
10974 : Look for GCC-style attribute malloc
10975 case "$d_attribute_malloc" in
10976 '')
10977 echo " "
10978 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10979 $cat >attrib.c <<'EOCP'
10980 #include <stdio.h>
10981 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10982 EOCP
10983 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10984         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10985                 echo "Your C compiler doesn't support __attribute__((malloc))."
10986                 val="$undef"
10987         else
10988                 echo "Your C compiler supports __attribute__((malloc))."
10989                 val="$define"
10990         fi
10991 else
10992         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10993         val="$undef"
10994 fi
10995 ;;
10996 *) val="$d_attribute_malloc" ;;
10997 esac
10998 set d_attribute_malloc
10999 eval $setvar
11000 $rm -f attrib*
11001
11002 : Look for GCC-style attribute nonnull
11003 case "$d_attribute_nonnull" in
11004 '')
11005 echo " "
11006 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11007 $cat >attrib.c <<'EOCP'
11008 #include <stdio.h>
11009 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11010 EOCP
11011 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11012         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11013                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11014                 val="$undef"
11015         else
11016                 echo "Your C compiler supports __attribute__((nonnull))."
11017                 val="$define"
11018         fi
11019 else
11020         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11021         val="$undef"
11022 fi
11023 ;;
11024 *) val="$d_attribute_nonnull" ;;
11025 esac
11026 set d_attribute_nonnull
11027 eval $setvar
11028 $rm -f attrib*
11029
11030 : Look for GCC-style attribute noreturn
11031 case "$d_attribute_noreturn" in
11032 '')
11033 echo " "
11034 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11035 $cat >attrib.c <<'EOCP'
11036 #include <stdio.h>
11037 void fall_over_dead( void ) __attribute__((noreturn));
11038 EOCP
11039 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11040         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11041                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11042                 val="$undef"
11043         else
11044                 echo "Your C compiler supports __attribute__((noreturn))."
11045                 val="$define"
11046         fi
11047 else
11048         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11049         val="$undef"
11050 fi
11051 ;;
11052 *) val="$d_attribute_noreturn" ;;
11053 esac
11054 set d_attribute_noreturn
11055 eval $setvar
11056 $rm -f attrib*
11057
11058 : Look for GCC-style attribute pure
11059 case "$d_attribute_pure" in
11060 '')
11061 echo " "
11062 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11063 $cat >attrib.c <<'EOCP'
11064 #include <stdio.h>
11065 int square( int n ) __attribute__((pure));
11066 EOCP
11067 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11068         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11069                 echo "Your C compiler doesn't support __attribute__((pure))."
11070                 val="$undef"
11071         else
11072                 echo "Your C compiler supports __attribute__((pure))."
11073                 val="$define"
11074         fi
11075 else
11076         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11077         val="$undef"
11078 fi
11079 ;;
11080 *) val="$d_attribute_pure" ;;
11081 esac
11082 set d_attribute_pure
11083 eval $setvar
11084 $rm -f attrib*
11085
11086 : Look for GCC-style attribute unused
11087 case "$d_attribute_unused" in
11088 '')
11089 echo " "
11090 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11091 $cat >attrib.c <<'EOCP'
11092 #include <stdio.h>
11093 int do_something( int dummy __attribute__((unused)), int n );
11094 EOCP
11095 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11096         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11097                 echo "Your C compiler doesn't support __attribute__((unused))."
11098                 val="$undef"
11099         else
11100                 echo "Your C compiler supports __attribute__((unused))."
11101                 val="$define"
11102         fi
11103 else
11104         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11105         val="$undef"
11106 fi
11107 ;;
11108 *) val="$d_attribute_unused" ;;
11109 esac
11110 set d_attribute_unused
11111 eval $setvar
11112 $rm -f attrib*
11113
11114 : Look for GCC-style attribute deprecated
11115 case "$d_attribute_deprecated" in
11116 '')
11117 echo " "
11118 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11119 $cat >attrib.c <<'EOCP'
11120 #include <stdio.h>
11121 int I_am_deprecated(void) __attribute__((deprecated));
11122 EOCP
11123 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11124         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11125                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11126                 val="$undef"
11127         else
11128                 echo "Your C compiler supports __attribute__((deprecated))."
11129                 val="$define"
11130         fi
11131 else
11132         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11133         val="$undef"
11134 fi
11135 ;;
11136 *) val="$d_attribute_deprecated" ;;
11137 esac
11138 set d_attribute_deprecated
11139 eval $setvar
11140 $rm -f attrib*
11141
11142 : Look for GCC-style attribute warn_unused_result
11143 case "$d_attribute_warn_unused_result" in
11144 '')
11145 echo " "
11146 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11147 $cat >attrib.c <<'EOCP'
11148 #include <stdio.h>
11149 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11150 EOCP
11151 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11152         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11153                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11154                 val="$undef"
11155         else
11156                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11157                 val="$define"
11158         fi
11159 else
11160         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11161         val="$undef"
11162 fi
11163 ;;
11164 *) val="$d_attribute_warn_unused_result" ;;
11165 esac
11166 set d_attribute_warn_unused_result
11167 eval $setvar
11168 $rm -f attrib*
11169
11170 : see if bcmp exists
11171 set bcmp d_bcmp
11172 eval $inlibc
11173
11174 : see if bcopy exists
11175 set bcopy d_bcopy
11176 eval $inlibc
11177
11178 : see if getpgrp exists
11179 set getpgrp d_getpgrp
11180 eval $inlibc
11181
11182 case "$d_getpgrp" in
11183 "$define")
11184         echo " "
11185         echo "Checking to see which flavor of getpgrp is in use..."
11186         $cat >try.c <<EOP
11187 #$i_unistd I_UNISTD
11188 #include <sys/types.h>
11189 #ifdef I_UNISTD
11190 #  include <unistd.h>
11191 #endif
11192 #$i_stdlib I_STDLIB
11193 #ifdef I_STDLIB
11194 #include <stdlib.h>
11195 #endif
11196 int main()
11197 {
11198         if (getuid() == 0) {
11199                 printf("(I see you are running Configure as super-user...)\n");
11200                 setuid(1);
11201         }
11202 #ifdef TRY_BSD_PGRP
11203         if (getpgrp(1) == 0)
11204                 exit(0);
11205 #else
11206         if (getpgrp() > 0)
11207                 exit(0);
11208 #endif
11209         exit(1);
11210 }
11211 EOP
11212         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11213                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11214                 val="$define"
11215         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11216                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11217                 val="$undef"
11218         else
11219                 echo "I can't seem to compile and run the test program."
11220                 if ./usg; then
11221                         xxx="a USG one, i.e. you use getpgrp()."
11222                 else
11223                         # SVR4 systems can appear rather BSD-ish.
11224                         case "$i_unistd" in
11225                         $undef)
11226                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11227                                 val="$define"
11228                                 ;;
11229                         $define)
11230                                 xxx="probably a USG one, i.e. you use getpgrp()."
11231                                 val="$undef"
11232                                 ;;
11233                         esac
11234                 fi
11235                 echo "Assuming your getpgrp is $xxx" >&4
11236         fi
11237         ;;
11238 *) val="$undef";;
11239 esac
11240 set d_bsdgetpgrp
11241 eval $setvar
11242 $rm_try
11243
11244 : see if setpgrp exists
11245 set setpgrp d_setpgrp
11246 eval $inlibc
11247
11248 case "$d_setpgrp" in
11249 "$define")
11250         echo " "
11251         echo "Checking to see which flavor of setpgrp is in use..."
11252         $cat >try.c <<EOP
11253 #$i_unistd I_UNISTD
11254 #include <sys/types.h>
11255 #ifdef I_UNISTD
11256 #  include <unistd.h>
11257 #endif
11258 #$i_stdlib I_STDLIB
11259 #ifdef I_STDLIB
11260 #include <stdlib.h>
11261 #endif
11262 int main()
11263 {
11264         if (getuid() == 0) {
11265                 printf("(I see you are running Configure as super-user...)\n");
11266                 setuid(1);
11267         }
11268 #ifdef TRY_BSD_PGRP
11269         if (-1 == setpgrp(1, 1))
11270                 exit(0);
11271 #else
11272         if (setpgrp() != -1)
11273                 exit(0);
11274 #endif
11275         exit(1);
11276 }
11277 EOP
11278         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11279                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11280                 val="$define"
11281         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11282                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11283                 val="$undef"
11284         else
11285                 echo "(I can't seem to compile and run the test program.)"
11286                 if ./usg; then
11287                         xxx="a USG one, i.e. you use setpgrp()."
11288                 else
11289                         # SVR4 systems can appear rather BSD-ish.
11290                         case "$i_unistd" in
11291                         $undef)
11292                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11293                                 val="$define"
11294                                 ;;
11295                         $define)
11296                                 xxx="probably a USG one, i.e. you use setpgrp()."
11297                                 val="$undef"
11298                                 ;;
11299                         esac
11300                 fi
11301                 echo "Assuming your setpgrp is $xxx" >&4
11302         fi
11303         ;;
11304 *) val="$undef";;
11305 esac
11306 set d_bsdsetpgrp
11307 eval $setvar
11308 $rm_try
11309
11310 : Look for GCC-style __builtin_choose_expr
11311 case "$d_builtin_choose_expr" in
11312 '')
11313     echo " "
11314     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11315     $cat >try.c <<'EOCP'
11316 #include <assert.h>
11317 #include <stdlib.h>
11318 #include <stdio.h>
11319
11320 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11321
11322 int main(void) {
11323     assert( SYRINX(1) == 2112 );
11324     assert( SYRINX(1) != 5150 );
11325     assert( SYRINX(0) == 5150 );
11326     assert( SYRINX(0) != 2112 );
11327     puts( "All good!" );
11328     exit(0);
11329 }
11330
11331 EOCP
11332     set try
11333     if eval $compile && $run ./try; then
11334         echo "Your C compiler supports __builtin_choose_expr."
11335         val="$define"
11336     else
11337         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11338         val="$undef"
11339     fi
11340 ;;
11341 *) val="$d_builtin_choose_expr" ;;
11342 esac
11343
11344 set d_builtin_choose_expr
11345 eval $setvar
11346 $rm_try
11347
11348 : Look for GCC-style __builtin_expect
11349 case "$d_builtin_expect" in
11350 '')
11351     echo " "
11352     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11353     $cat >try.c <<'EOCP'
11354 int main(void) {
11355     int n = 50;
11356     if ( __builtin_expect(n, 0) ) n = 1;
11357     /* Remember shell exit code truth is 0, C truth is non-zero */
11358     return !(n == 1);
11359 }
11360 EOCP
11361     set try
11362     if eval $compile && $run ./try; then
11363         echo "Your C compiler supports __builtin_expect."
11364         val="$define"
11365     else
11366         echo "Your C compiler doesn't seem to understand __builtin_expect."
11367         val="$undef"
11368     fi
11369     ;;
11370 *) val="$d_builtin_expect" ;;
11371 esac
11372
11373 set d_builtin_expect
11374 eval $setvar
11375 $rm_try
11376
11377 : see if bzero exists
11378 set bzero d_bzero
11379 eval $inlibc
11380
11381 : see if stdarg is available
11382 echo " "
11383 if $test `./findhdr stdarg.h`; then
11384         echo "<stdarg.h> found." >&4
11385         valstd="$define"
11386 else
11387         echo "<stdarg.h> NOT found." >&4
11388         valstd="$undef"
11389 fi
11390
11391 : see if varargs is available
11392 echo " "
11393 if $test `./findhdr varargs.h`; then
11394         echo "<varargs.h> found." >&4
11395 else
11396         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11397 fi
11398
11399 : set up the varargs testing programs
11400 $cat > varargs.c <<EOP
11401 #ifdef I_STDARG
11402 #include <stdarg.h>
11403 #endif
11404 #ifdef I_VARARGS
11405 #include <varargs.h>
11406 #endif
11407
11408 #ifdef I_STDARG
11409 int f(char *p, ...)
11410 #else
11411 int f(va_alist)
11412 va_dcl
11413 #endif
11414 {
11415         va_list ap;
11416 #ifndef I_STDARG
11417         char *p;
11418 #endif
11419 #ifdef I_STDARG
11420         va_start(ap,p);
11421 #else
11422         va_start(ap);
11423         p = va_arg(ap, char *);
11424 #endif
11425         va_end(ap);
11426         return 0;
11427 }
11428 EOP
11429 $cat > varargs <<EOP
11430 $startsh
11431 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11432         echo "true"
11433 else
11434         echo "false"
11435 fi
11436 $rm -f varargs$_o
11437 EOP
11438 chmod +x varargs
11439
11440 : now check which varargs header should be included
11441 echo " "
11442 i_varhdr=''
11443 val=''
11444 case "$valstd" in
11445 "$define")
11446         if `./varargs I_STDARG`; then
11447                 val='stdarg.h'
11448         elif `./varargs I_VARARGS`; then
11449                 val='varargs.h'
11450         fi
11451         ;;
11452 *)
11453         if `./varargs I_VARARGS`; then
11454                 val='varargs.h'
11455         fi
11456         ;;
11457 esac
11458 case "$val" in
11459 '')
11460         echo " "
11461         echo "*** WHOA THERE!!! ***" >&4
11462         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
11463         case "$knowitall" in
11464         '')
11465         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
11466                 exit 1
11467                 ;;
11468         esac
11469 echo "I could not find the definition for va_dcl... You have problems..." >&4
11470         val="$undef"; set i_stdarg; eval $setvar
11471         val="$undef"; set i_varargs; eval $setvar
11472         ;;
11473 *)
11474         set i_varhdr
11475         eval $setvar
11476         case "$i_varhdr" in
11477         stdarg.h)
11478                 val="$define"; set i_stdarg; eval $setvar
11479                 val="$undef"; set i_varargs; eval $setvar
11480                 ;;
11481         varargs.h)
11482                 val="$undef"; set i_stdarg; eval $setvar
11483                 val="$define"; set i_varargs; eval $setvar
11484                 ;;
11485         esac
11486         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11487 esac
11488 $rm -f varargs*
11489
11490 : see if the Compiler supports C99 variadic macros
11491 case "$i_stdarg$i_stdlib" in
11492     "$define$define")
11493     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11494     $cat >try.c <<EOCP
11495 #include <stdio.h>
11496 #include <stdarg.h>
11497
11498 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11499
11500 int main() {
11501   char buf[20];
11502   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11503   puts(buf);
11504   return 0;
11505 }
11506 EOCP
11507     set try
11508     if eval $compile && $run ./try 2>&1 >/dev/null; then
11509         case "`$run ./try`" in
11510             "123 456 789")
11511             echo "You have C99 variadic macros." >&4
11512             d_c99_variadic_macros="$define"
11513             ;;
11514             *)
11515             echo "You don't have functional C99 variadic macros." >&4
11516             d_c99_variadic_macros="$undef"
11517             ;;
11518         esac
11519     else
11520         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11521         d_c99_variadic_macros="$undef"
11522     fi
11523     $rm_try
11524     ;;
11525     *)
11526     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11527     d_c99_variadic_macros="$undef"
11528     ;;
11529 esac
11530
11531 : see if signal is declared as pointer to function returning int or void
11532 echo " "
11533 xxx=`./findhdr signal.h`
11534 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11535 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11536         echo "You have int (*signal())() instead of void." >&4
11537         val="$undef"
11538 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11539         echo "You have void (*signal())()." >&4
11540         val="$define"
11541 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11542         echo "You have int (*signal())() instead of void." >&4
11543         val="$undef"
11544 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11545         echo "You have void (*signal())()." >&4
11546         val="$define"
11547 else
11548         case "$d_voidsig" in
11549         '')
11550         echo "I can't determine whether signal handler returns void or int..." >&4
11551                 dflt=void
11552                 rp="What type does your signal handler return?"
11553                 . ./myread
11554                 case "$ans" in
11555                 v*) val="$define";;
11556                 *) val="$undef";;
11557                 esac;;
11558         "$define")
11559                 echo "As you already told me, signal handler returns void." >&4
11560                 val="$define"
11561                 ;;
11562         *)      echo "As you already told me, signal handler returns int." >&4
11563                 val="$undef"
11564                 ;;
11565         esac
11566 fi
11567 set d_voidsig
11568 eval $setvar
11569 case "$d_voidsig" in
11570 "$define") signal_t="void";;
11571 *) signal_t="int";;
11572 esac
11573 $rm -f $$.tmp
11574
11575 : check for ability to cast large floats to 32-bit ints.
11576 echo " "
11577 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11578 if $test "$intsize" -ge 4; then
11579         xxx=int
11580 else
11581         xxx=long
11582 fi
11583 $cat >try.c <<EOCP
11584 #include <stdio.h>
11585 #$i_stdlib I_STDLIB
11586 #ifdef I_STDLIB
11587 #include <stdlib.h>
11588 #endif
11589 #include <sys/types.h>
11590 #include <signal.h>
11591 $signal_t blech(int s) { exit(3); }
11592 int main()
11593 {
11594         $xxx i32;
11595         double f, g;
11596         int result = 0;
11597         char str[16];
11598         signal(SIGFPE, blech);
11599
11600         /* Don't let compiler optimize the test away.  Store the number
11601            in a writable string for gcc to pass to sscanf under HP-UX.
11602         */
11603         sprintf(str, "2147483647");
11604         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11605         g = 10 * f;
11606         i32  = ($xxx) g;
11607
11608         /* x86 processors will probably give 0x8000 0000, which is a
11609            sign change.  We don't want that.  We want to mimic SPARC
11610            behavior here, which is to preserve the sign and give
11611            back 0x7fff ffff.
11612         */
11613         if (i32 != ($xxx) f)
11614                 result |= 1;
11615         exit(result);
11616 }
11617 EOCP
11618 set try
11619 if eval $compile_ok; then
11620         $run ./try 2>/dev/null
11621         yyy=$?
11622 else
11623         echo "(I can't seem to compile the test program--assuming it can't)"
11624         yyy=1
11625 fi
11626 case "$yyy" in
11627 0)      val="$define"
11628         echo "Yup, it can."
11629         ;;
11630 *)      val="$undef"
11631         echo "Nope, it can't."
11632         ;;
11633 esac
11634 set d_casti32
11635 eval $setvar
11636 $rm_try
11637
11638 : check for ability to cast negative floats to unsigned
11639 echo " "
11640 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11641 $cat >try.c <<EOCP
11642 #include <stdio.h>
11643 #$i_stdlib I_STDLIB
11644 #ifdef I_STDLIB
11645 #include <stdlib.h>
11646 #endif
11647 #include <sys/types.h>
11648 #include <signal.h>
11649 $signal_t blech(int s) { exit(7); }
11650 $signal_t blech_in_list(int s) { exit(4); }
11651 unsigned long dummy_long(unsigned long p) { return p; }
11652 unsigned int dummy_int(unsigned int p) { return p; }
11653 unsigned short dummy_short(unsigned short p) { return p; }
11654 int main()
11655 {
11656         double f;
11657         unsigned long along;
11658         unsigned int aint;
11659         unsigned short ashort;
11660         int result = 0;
11661         char str[16];
11662
11663         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11664            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11665            optimized the whole file away
11666         */
11667         /* Store the number in a writable string for gcc to pass to
11668            sscanf under HP-UX.
11669         */
11670         sprintf(str, "-123");
11671         sscanf(str, "%lf", &f);  /* f = -123.; */
11672
11673         signal(SIGFPE, blech);
11674         along = (unsigned long)f;
11675         aint = (unsigned int)f;
11676         ashort = (unsigned short)f;
11677         if (along != (unsigned long)-123)
11678                 result |= 1;
11679         if (aint != (unsigned int)-123)
11680                 result |= 1;
11681         if (ashort != (unsigned short)-123)
11682                 result |= 1;
11683         sprintf(str, "1073741824.");
11684         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11685         f = f + f;
11686         along = 0;
11687         along = (unsigned long)f;
11688         if (along != 0x80000000)
11689                 result |= 2;
11690         f -= 1.;
11691         along = 0;
11692         along = (unsigned long)f;
11693         if (along != 0x7fffffff)
11694                 result |= 1;
11695         f += 2.;
11696         along = 0;
11697         along = (unsigned long)f;
11698         if (along != 0x80000001)
11699                 result |= 2;
11700         if (result)
11701                 exit(result);
11702         signal(SIGFPE, blech_in_list);
11703         sprintf(str, "123.");
11704         sscanf(str, "%lf", &f);  /* f = 123.; */
11705         along = dummy_long((unsigned long)f);
11706         aint = dummy_int((unsigned int)f);
11707         ashort = dummy_short((unsigned short)f);
11708         if (along != (unsigned long)123)
11709                 result |= 4;
11710         if (aint != (unsigned int)123)
11711                 result |= 4;
11712         if (ashort != (unsigned short)123)
11713                 result |= 4;
11714         exit(result);
11715
11716 }
11717 EOCP
11718 set try
11719 if eval $compile_ok; then
11720         $run ./try 2>/dev/null
11721         castflags=$?
11722 else
11723         echo "(I can't seem to compile the test program--assuming it can't)"
11724         castflags=7
11725 fi
11726 case "$castflags" in
11727 0)      val="$define"
11728         echo "Yup, it can."
11729         ;;
11730 *)      val="$undef"
11731         echo "Nope, it can't."
11732         ;;
11733 esac
11734 set d_castneg
11735 eval $setvar
11736 $rm_try
11737
11738 : see if cbrt exists
11739 set cbrt d_cbrt
11740 eval $inlibc
11741
11742 : see if vprintf exists
11743 echo " "
11744 if set vprintf val -f d_vprintf; eval $csym; $val; then
11745         echo 'vprintf() found.' >&4
11746         val="$define"
11747         $cat >try.c <<EOF
11748 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11749 #$i_varargs I_VARARGS
11750
11751 #$i_stdlib I_STDLIB
11752 #$i_unistd I_UNISTD
11753
11754 #ifdef I_STDARG
11755 #  include <stdarg.h>
11756 #else /* I_VARARGS */
11757 #  include <varargs.h>
11758 #endif
11759
11760 #ifdef I_UNISTD
11761 #  include <unistd.h>
11762 #endif
11763
11764 #ifdef I_STDLIB
11765 #  include <stdlib.h>
11766 #endif
11767
11768 #include <stdio.h> /* vsprintf prototype */
11769
11770 #ifdef I_STDARG
11771 void xxx(int n, ...)
11772 {
11773     va_list args;
11774     char buf[10];
11775     va_start(args, n);
11776     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11777 }
11778 int main() { xxx(1, "foo"); }
11779
11780 #else /* I_VARARGS */
11781
11782 xxx(va_alist)
11783 va_dcl
11784 {
11785     va_list args;
11786     char buf[10];
11787     va_start(args);
11788     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11789 }
11790 int main() { xxx("foo"); }
11791
11792 #endif
11793
11794 EOF
11795         set try
11796         if eval $compile_ok; then
11797                 if $run ./try; then
11798                         echo "Your vsprintf() returns (int)." >&4
11799                         val2="$undef"
11800                 else
11801                         echo "Your vsprintf() returns (char*)." >&4
11802                         val2="$define"
11803                 fi
11804         else
11805                 echo 'I am unable to compile the vsprintf() test program.' >&4
11806                 # We shouldn't get here.  If we do, assume the standard signature,
11807                 # not the old BSD one.
11808                 echo 'Guessing that vsprintf() returns (int).' >&4
11809                 val2="$undef"
11810         fi
11811 else
11812         echo 'vprintf() NOT found.' >&4
11813         val="$undef"
11814         val2="$undef"
11815 fi
11816 $rm_try
11817 set d_vprintf
11818 eval $setvar
11819 val=$val2
11820 set d_charvspr
11821 eval $setvar
11822
11823 : see if chown exists
11824 set chown d_chown
11825 eval $inlibc
11826
11827 : see if chroot exists
11828 set chroot d_chroot
11829 eval $inlibc
11830
11831 : see if chsize exists
11832 set chsize d_chsize
11833 eval $inlibc
11834
11835 : see if class exists
11836 set class d_class
11837 eval $inlibc
11838
11839 : see if clearenv exists
11840 set clearenv d_clearenv
11841 eval $inlibc
11842
11843 : Define hasstruct macro for Configure internal use
11844 hasstruct='varname=$1; struct=$2; shift; shift;
11845 while $test $# -ge 2; do
11846         case "$1" in
11847         $define) echo "#include <$2>";;
11848         esac ;
11849     shift 2;
11850 done > try.c;
11851 echo "int main () { struct $struct foo; }" >> try.c;
11852 set try;
11853 if eval $compile; then
11854         val="$define";
11855 else
11856         val="$undef";
11857 fi;
11858 set $varname;
11859 eval $setvar;
11860 $rm_try'
11861
11862 : see whether socket exists
11863 socketlib=''
11864 sockethdr=''
11865 echo " "
11866 $echo $n "Hmm... $c" >&4
11867 if set socket val -f d_socket; eval $csym; $val; then
11868     echo "Looks like you have Berkeley networking support." >&4
11869     d_socket="$define"
11870     if set setsockopt val -f; eval $csym; $val; then
11871         d_oldsock="$undef"
11872     else
11873         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11874         d_oldsock="$define"
11875     fi
11876 else
11877     if $contains socklib libc.list >/dev/null 2>&1; then
11878         echo "Looks like you have Berkeley networking support." >&4
11879         d_socket="$define"
11880         : we will have to assume that it supports the 4.2 BSD interface
11881         d_oldsock="$undef"
11882     else
11883         echo "You don't have Berkeley networking in libc$_a..." >&4
11884         if test "X$d_socket" = "X$define"; then
11885             echo "...but you seem to believe that you have sockets." >&4
11886         else
11887             for net in net socket
11888             do
11889                 if test -f $sysroot/usr/lib/lib$net$_a; then
11890                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11891                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11892                     if $contains socket libc.list >/dev/null 2>&1; then
11893                         d_socket="$define"
11894                         socketlib="-l$net"
11895                         case "$net" in
11896                         net)
11897                             echo "...but the Wollongong group seems to have hacked it in." >&4
11898                             sockethdr="-I$sysroot/usr/netinclude"
11899                             ;;
11900                         esac
11901                         echo "Found Berkeley sockets interface in lib$net." >&4
11902                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11903                             d_oldsock="$undef"
11904                         else
11905                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11906                             d_oldsock="$define"
11907                         fi
11908                         break
11909                     fi
11910                 fi
11911             done
11912             if test "X$d_socket" != "X$define"; then
11913                echo "or anywhere else I see." >&4
11914                d_socket="$undef"
11915                d_oldsock="$undef"
11916             fi
11917         fi
11918     fi
11919 fi
11920
11921 : see if socketpair exists
11922 set socketpair d_sockpair
11923 eval $inlibc
11924
11925
11926 echo " "
11927 echo "Checking the availability sa_len in the sock struct ..." >&4
11928 $cat >try.c <<EOF
11929 #include <sys/types.h>
11930 #include <sys/socket.h>
11931 int main() {
11932 struct sockaddr sa;
11933 return (sa.sa_len);
11934 }
11935 EOF
11936 val="$undef"
11937 set try; if eval $compile; then
11938     val="$define"
11939 fi
11940 set d_sockaddr_sa_len; eval $setvar
11941 $rm_try
11942
11943 echo " "
11944 echo "Checking the availability struct sockaddr_in6 ..." >&4
11945 $cat >try.c <<EOF
11946 #include <sys/types.h>
11947 #include <sys/socket.h>
11948 #include <netinet/in.h>
11949 int main() {
11950 struct sockaddr_in6 sin6;
11951 return (sin6.sin6_family);
11952 }
11953 EOF
11954 val="$undef"
11955 set try; if eval $compile; then
11956     val="$define"
11957 fi
11958 set d_sockaddr_in6; eval $setvar
11959 $rm_try
11960
11961 echo " "
11962 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11963 $cat >try.c <<EOF
11964 #include <sys/types.h>
11965 #include <sys/socket.h>
11966 #include <netinet/in.h>
11967 int main() {
11968 struct sockaddr_in6 sin6;
11969 return (sin6.sin6_scope_id);
11970 }
11971 EOF
11972 val="$undef"
11973 set try; if eval $compile; then
11974     val="$define"
11975 fi
11976 set d_sin6_scope_id; eval $setvar
11977 $rm_try
11978
11979 echo " "
11980 echo "Checking the availability struct ip_mreq ..." >&4
11981 $cat >try.c <<EOF
11982 #include <sys/types.h>
11983 #include <sys/socket.h>
11984 #include <netinet/in.h>
11985 int main() {
11986 struct ip_mreq mreq;
11987 return (mreq.imr_multiaddr.s_addr);
11988 }
11989 EOF
11990 val="$undef"
11991 set try; if eval $compile; then
11992        val="$define"
11993 fi
11994 set d_ip_mreq; eval $setvar
11995 $rm_try
11996
11997 echo " "
11998 echo "Checking the availability struct ip_mreq_source ..." >&4
11999 $cat >try.c <<EOF
12000 #include <sys/types.h>
12001 #include <sys/socket.h>
12002 #include <netinet/in.h>
12003 int main() {
12004 struct ip_mreq_source mreq;
12005 return (mreq.imr_multiaddr.s_addr);
12006 }
12007 EOF
12008 val="$undef"
12009 set try; if eval $compile; then
12010        val="$define"
12011 fi
12012 set d_ip_mreq_source; eval $setvar
12013 $rm_try
12014
12015 echo " "
12016 echo "Checking the availability struct ipv6_mreq ..." >&4
12017 $cat >try.c <<EOF
12018 #include <sys/types.h>
12019 #include <sys/socket.h>
12020 #include <netinet/in.h>
12021 int main() {
12022 struct ipv6_mreq mreq;
12023 return (mreq.ipv6mr_interface);
12024 }
12025 EOF
12026 val="$undef"
12027 set try; if eval $compile; then
12028     val="$define"
12029 fi
12030 set d_ipv6_mreq; eval $setvar
12031 $rm_try
12032
12033 echo " "
12034 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12035 $cat >try.c <<EOF
12036 #include <sys/types.h>
12037 #include <sys/socket.h>
12038 #include <netinet/in.h>
12039 int main() {
12040 struct ipv6_mreq_source mreq;
12041 return (mreq.imr_multiaddr.s_addr);
12042 }
12043 EOF
12044 val="$undef"
12045 set try; if eval $compile; then
12046        val="$define"
12047 fi
12048 set d_ipv6_mreq_source; eval $setvar
12049 $rm_try
12050
12051 echo " "
12052 echo "Checking the availability of certain socket constants..." >&4
12053 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12054     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12055     $cat >try.c <<EOF
12056 #include <sys/types.h>
12057 #include <sys/socket.h>
12058 int main() {
12059     int i = $ENUM;
12060 }
12061 EOF
12062     val="$undef"
12063     set try; if eval $compile; then
12064         val="$define"
12065     fi
12066     set d_${enum}; eval $setvar
12067     $rm_try
12068 done
12069
12070 : see if this is a sys/uio.h system
12071 set sys/uio.h i_sysuio
12072 eval $inhdr
12073
12074 : Check for cmsghdr support
12075 echo " "
12076 echo "Checking to see if your system supports struct cmsghdr..." >&4
12077 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12078 eval $hasstruct
12079 case "$d_cmsghdr_s" in
12080 "$define")      echo "Yes, it does."   ;;
12081 *)              echo "No, it doesn't." ;;
12082 esac
12083
12084
12085 : check for const keyword
12086 echo " "
12087 echo 'Checking to see if your C compiler knows about "const"...' >&4
12088 $cat >const.c <<'EOCP'
12089 typedef struct spug { int drokk; } spug;
12090 int main()
12091 {
12092         const char *foo;
12093         const spug y = { 0 };
12094 }
12095 EOCP
12096 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
12097         val="$define"
12098         echo "Yup, it does."
12099 else
12100         val="$undef"
12101         echo "Nope, it doesn't."
12102 fi
12103 set d_const
12104 eval $setvar
12105
12106 : see if copysign exists
12107 set copysign d_copysign
12108 eval $inlibc
12109
12110 : see if copysignl exists
12111 set copysignl d_copysignl
12112 eval $inlibc
12113
12114 : see if crypt exists
12115 echo " "
12116 set crypt d_crypt
12117 eval $inlibc
12118 case "$d_crypt" in
12119 $define) cryptlib='' ;;
12120 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12121                 echo 'crypt() found.' >&4
12122                 val="$define"
12123                 cryptlib=''
12124         else
12125                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12126                 if $test -z "$cryptlib"; then
12127                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12128                 else
12129                         cryptlib=-lcrypt
12130                 fi
12131                 if $test -z "$cryptlib"; then
12132                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12133                 else
12134                         cryptlib=-lcrypt
12135                 fi
12136                 if $test -z "$cryptlib"; then
12137                         cryptlib=`./loc libcrypt$_a "" $libpth`
12138                 else
12139                         cryptlib=-lcrypt
12140                 fi
12141                 if $test -z "$cryptlib"; then
12142                         echo 'crypt() NOT found.' >&4
12143                         val="$undef"
12144                 else
12145                         val="$define"
12146                 fi
12147         fi
12148         set d_crypt
12149         eval $setvar
12150         ;;
12151 esac
12152
12153 : see if this is a crypt.h system
12154 set crypt.h i_crypt
12155 eval $inhdr
12156
12157 : see if crypt_r exists
12158 set crypt_r d_crypt_r
12159 eval $inlibc
12160 case "$d_crypt_r" in
12161 "$define")
12162         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12163         case "$d_crypt_r_proto:$usethreads" in
12164         ":define")      d_crypt_r_proto=define
12165                 set d_crypt_r_proto crypt_r $hdrs
12166                 eval $hasproto ;;
12167         *)      ;;
12168         esac
12169         case "$d_crypt_r_proto" in
12170         define)
12171         case "$crypt_r_proto" in
12172         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12173         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12174         esac
12175         case "$crypt_r_proto" in
12176         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12177         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12178         esac
12179         case "$crypt_r_proto" in
12180         ''|0)   d_crypt_r=undef
12181                 crypt_r_proto=0
12182                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12183         * )     case "$crypt_r_proto" in
12184                 REENTRANT_PROTO*) ;;
12185                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12186                 esac
12187                 echo "Prototype: $try" ;;
12188         esac
12189         ;;
12190         *)      case "$usethreads" in
12191                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12192                 esac
12193                 d_crypt_r=undef
12194                 crypt_r_proto=0
12195                 ;;
12196         esac
12197         ;;
12198 *)      crypt_r_proto=0
12199         ;;
12200 esac
12201
12202 : get csh whereabouts
12203 case "$csh" in
12204 'csh') val="$undef" ;;
12205 *) val="$define" ;;
12206 esac
12207 set d_csh
12208 eval $setvar
12209 : Respect a hint or command line value for full_csh.
12210 case "$full_csh" in
12211 '') full_csh=$csh ;;
12212 esac
12213
12214 : see if ctermid exists
12215 set ctermid d_ctermid
12216 eval $inlibc
12217
12218 : see if ctermid_r exists
12219 set ctermid_r d_ctermid_r
12220 eval $inlibc
12221 case "$d_ctermid_r" in
12222 "$define")
12223         hdrs="$i_systypes sys/types.h define stdio.h "
12224         case "$d_ctermid_r_proto:$usethreads" in
12225         ":define")      d_ctermid_r_proto=define
12226                 set d_ctermid_r_proto ctermid_r $hdrs
12227                 eval $hasproto ;;
12228         *)      ;;
12229         esac
12230         case "$d_ctermid_r_proto" in
12231         define)
12232         case "$ctermid_r_proto" in
12233         ''|0) try='char* ctermid_r(char*);'
12234         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12235         esac
12236         case "$ctermid_r_proto" in
12237         ''|0)   d_ctermid_r=undef
12238                 ctermid_r_proto=0
12239                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12240         * )     case "$ctermid_r_proto" in
12241                 REENTRANT_PROTO*) ;;
12242                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12243                 esac
12244                 echo "Prototype: $try" ;;
12245         esac
12246         ;;
12247         *)      case "$usethreads" in
12248                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12249                 esac
12250                 d_ctermid_r=undef
12251                 ctermid_r_proto=0
12252                 ;;
12253         esac
12254         ;;
12255 *)      ctermid_r_proto=0
12256         ;;
12257 esac
12258
12259 : see if ctime_r exists
12260 set ctime_r d_ctime_r
12261 eval $inlibc
12262 case "$d_ctime_r" in
12263 "$define")
12264         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12265         case "$d_ctime_r_proto:$usethreads" in
12266         ":define")      d_ctime_r_proto=define
12267                 set d_ctime_r_proto ctime_r $hdrs
12268                 eval $hasproto ;;
12269         *)      ;;
12270         esac
12271         case "$d_ctime_r_proto" in
12272         define)
12273         case "$ctime_r_proto" in
12274         ''|0) try='char* ctime_r(const time_t*, char*);'
12275         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12276         esac
12277         case "$ctime_r_proto" in
12278         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12279         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12280         esac
12281         case "$ctime_r_proto" in
12282         ''|0) try='int ctime_r(const time_t*, char*);'
12283         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12284         esac
12285         case "$ctime_r_proto" in
12286         ''|0) try='int ctime_r(const time_t*, char*, int);'
12287         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12288         esac
12289         case "$ctime_r_proto" in
12290         ''|0)   d_ctime_r=undef
12291                 ctime_r_proto=0
12292                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12293         * )     case "$ctime_r_proto" in
12294                 REENTRANT_PROTO*) ;;
12295                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12296                 esac
12297                 echo "Prototype: $try" ;;
12298         esac
12299         ;;
12300         *)      case "$usethreads" in
12301                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12302                 esac
12303                 d_ctime_r=undef
12304                 ctime_r_proto=0
12305                 ;;
12306         esac
12307         ;;
12308 *)      ctime_r_proto=0
12309         ;;
12310 esac
12311
12312 : see if cuserid exists
12313 set cuserid d_cuserid
12314 eval $inlibc
12315
12316 : see if this is a limits.h system
12317 set limits.h i_limits
12318 eval $inhdr
12319
12320 : See if number of significant digits in a double precision number is known
12321 echo " "
12322 $cat >dbl_dig.c <<EOM
12323 #$i_limits I_LIMITS
12324 #$i_float I_FLOAT
12325 #ifdef I_LIMITS
12326 #include <limits.h>
12327 #endif
12328 #ifdef I_FLOAT
12329 #include <float.h>
12330 #endif
12331 #ifdef DBL_DIG
12332 printf("Contains DBL_DIG");
12333 #endif
12334 EOM
12335 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
12336 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
12337         echo "DBL_DIG found." >&4
12338         val="$define"
12339 else
12340         echo "DBL_DIG NOT found." >&4
12341         val="$undef"
12342 fi
12343 $rm -f dbl_dig.?
12344 set d_dbl_dig
12345 eval $setvar
12346
12347 : see if dbm.h is available
12348 : see if dbmclose exists
12349 set dbmclose d_dbmclose
12350 eval $inlibc
12351
12352 case "$d_dbmclose" in
12353 $define)
12354         set dbm.h i_dbm
12355         eval $inhdr
12356         case "$i_dbm" in
12357         $define)
12358                 val="$undef"
12359                 set i_rpcsvcdbm
12360                 eval $setvar
12361                 ;;
12362         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12363                 eval $inhdr
12364                 ;;
12365         esac
12366         ;;
12367 *)      echo "We won't be including <dbm.h>"
12368         val="$undef"
12369         set i_dbm
12370         eval $setvar
12371         val="$undef"
12372         set i_rpcsvcdbm
12373         eval $setvar
12374         ;;
12375 esac
12376
12377 : see if prototype for dbminit is available
12378 echo " "
12379 set d_dbminitproto dbminit $i_dbm dbm.h
12380 eval $hasproto
12381
12382 : see if difftime exists
12383 set difftime d_difftime
12384 eval $inlibc
12385
12386 : see if this is a dirent system
12387 echo " "
12388 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12389         val="$define"
12390         echo "<dirent.h> found." >&4
12391 else
12392         val="$undef"
12393         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12394                 echo "<sys/dir.h> found." >&4
12395                 echo " "
12396         else
12397                 xinc=`./findhdr sys/ndir.h`
12398         fi
12399         echo "<dirent.h> NOT found." >&4
12400 fi
12401 set i_dirent
12402 eval $setvar
12403
12404 : Look for type of directory structure.
12405 echo " "
12406 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12407
12408 case "$direntrytype" in
12409 ''|' ')
12410         case "$i_dirent" in
12411         $define) guess1='struct dirent' ;;
12412         *) guess1='struct direct'  ;;
12413         esac
12414         ;;
12415 *)      guess1="$direntrytype"
12416         ;;
12417 esac
12418
12419 case "$guess1" in
12420 'struct dirent') guess2='struct direct' ;;
12421 *) guess2='struct dirent' ;;
12422 esac
12423
12424 if $contains "$guess1" try.c >/dev/null 2>&1; then
12425         direntrytype="$guess1"
12426         echo "Your directory entries are $direntrytype." >&4
12427 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12428         direntrytype="$guess2"
12429         echo "Your directory entries seem to be $direntrytype." >&4
12430 else
12431         echo "I don't recognize your system's directory entries." >&4
12432         rp="What type is used for directory entries on this system?"
12433         dflt="$guess1"
12434         . ./myread
12435         direntrytype="$ans"
12436 fi
12437 $rm_try
12438
12439 : see if the directory entry stores field length
12440 echo " "
12441 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12442 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12443         echo "Good, your directory entry keeps length information in d_namlen." >&4
12444         val="$define"
12445 else
12446         echo "Your directory entry does not know about the d_namlen field." >&4
12447         val="$undef"
12448 fi
12449 set d_dirnamlen
12450 eval $setvar
12451 $rm_try
12452
12453 : Look for DIR.dd_fd
12454 case "$i_dirent" in
12455 "$define")
12456     echo "Checking to see if DIR has a dd_fd member variable" >&4
12457     $cat >try.c <<EOCP
12458 #$i_stdlib I_STDLIB
12459 #ifdef I_STDLIB
12460 #include <stdlib.h>
12461 #endif
12462 #include <dirent.h>
12463
12464 int main() {
12465     DIR dir;
12466     dir.dd_fd = 1;
12467     return 0;
12468 }
12469 EOCP
12470     val=$undef
12471     set try
12472     if eval $compile; then
12473         echo "Yes, it does."
12474         val="$define"
12475     else
12476         echo "No, it does not."
12477         val="$undef"
12478     fi
12479     ;;
12480 *)
12481     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12482     val="$undef"
12483     ;;
12484 esac
12485 set d_dir_dd_fd
12486 eval $setvar
12487 $rm_try
12488
12489 : see if this is an sysdir system
12490 set sys/dir.h i_sysdir
12491 eval $inhdr
12492
12493 : see if this is an sysndir system
12494 set sys/ndir.h i_sysndir
12495 eval $inhdr
12496
12497 : Look for dirfd
12498 echo " "
12499 $cat >dirfd.c <<EOM
12500 #include <stdio.h>
12501 #$i_stdlib I_STDLIB
12502 #ifdef I_STDLIB
12503 #include <stdlib.h>
12504 #endif
12505 #$i_dirent I_DIRENT             /**/
12506 #$i_sysdir I_SYS_DIR            /**/
12507 #$i_sysndir I_SYS_NDIR          /**/
12508 #$i_systypes I_SYS_TYPES        /**/
12509 #if defined(I_SYS_TYPES)
12510 #include <sys/types.h>
12511 #endif
12512 #if defined(I_DIRENT)
12513 #include <dirent.h>
12514 #else
12515 #ifdef I_SYS_NDIR
12516 #include <sys/ndir.h>
12517 #else
12518 #ifdef I_SYS_DIR
12519 #ifdef hp9000s500
12520 #include <ndir.h>       /* may be wrong in the future */
12521 #else
12522 #include <sys/dir.h>
12523 #endif
12524 #endif
12525 #endif
12526 #endif
12527 int main() {
12528         DIR *dirp = opendir(".");
12529         if (dirfd(dirp) >= 0)
12530                 exit(0);
12531         else
12532                 exit(1);
12533 }
12534 EOM
12535 val=$undef
12536 set dirfd
12537 if eval $compile; then
12538         val="$define"
12539 fi
12540 case "$val" in
12541 $define)        echo "dirfd() found." >&4       ;;
12542 *)              echo "dirfd() NOT found." >&4   ;;
12543 esac
12544 set d_dirfd
12545 eval $setvar
12546 $rm -f dirfd*
12547
12548 : see if dladdr exists
12549 set dladdr d_dladdr
12550 eval $inlibc
12551
12552 : see if dlerror exists
12553 xxx_runnm="$runnm"
12554 runnm=false
12555 set dlerror d_dlerror
12556 eval $inlibc
12557 runnm="$xxx_runnm"
12558
12559 : see if dlfcn is available
12560 set dlfcn.h i_dlfcn
12561 eval $inhdr
12562
12563 : Check what extension to use for shared libs
12564 case "$usedl" in
12565 $define|y|true)
12566         $cat << EOM
12567
12568 On a few systems, the dynamically loaded modules that perl generates and uses
12569 will need a different extension than shared libs. The default will probably
12570 be appropriate.
12571
12572 EOM
12573         case "$dlext" in
12574         '')     dflt="$so" ;;
12575         *)      dflt="$dlext" ;;
12576         esac
12577         rp='What is the extension of dynamically loaded modules'
12578         . ./myread
12579         dlext="$ans"
12580         ;;
12581 *)
12582         dlext="none"
12583         ;;
12584 esac
12585
12586 : Check if dlsym need a leading underscore
12587 echo " "
12588 val="$undef"
12589
12590 case "$dlsrc" in
12591 dl_dlopen.xs)
12592         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12593         $cat >dyna.c <<'EOM'
12594 fred () { }
12595 EOM
12596
12597 $cat >fred.c<<EOM
12598
12599 #include <stdio.h>
12600 #$i_stdlib I_STDLIB
12601 #ifdef I_STDLIB
12602 #include <stdlib.h>
12603 #endif
12604 #$i_dlfcn I_DLFCN
12605 #ifdef I_DLFCN
12606 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12607 #else
12608 #include <sys/types.h>
12609 #include <nlist.h>
12610 #include <link.h>
12611 #endif
12612
12613 extern int fred() ;
12614
12615 int main()
12616 {
12617     void * handle ;
12618     void * symbol ;
12619 #ifndef RTLD_LAZY
12620     int mode = 1 ;
12621 #else
12622     int mode = RTLD_LAZY ;
12623 #endif
12624     handle = dlopen("./dyna.$dlext", mode) ;
12625     if (handle == NULL) {
12626         printf ("1\n") ;
12627         fflush (stdout) ;
12628         exit(0);
12629     }
12630     symbol = dlsym(handle, "fred") ;
12631     if (symbol == NULL) {
12632         /* try putting a leading underscore */
12633         symbol = dlsym(handle, "_fred") ;
12634         if (symbol == NULL) {
12635             printf ("2\n") ;
12636             fflush (stdout) ;
12637             exit(0);
12638         }
12639         printf ("3\n") ;
12640     }
12641     else
12642         printf ("4\n") ;
12643     fflush (stdout) ;
12644     exit(0);
12645 }
12646 EOM
12647         : Call the object file tmp-dyna.o in case dlext=o.
12648         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12649                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12650                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12651                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12652                 xxx=`$run ./fred`
12653                 case $xxx in
12654                 1)      echo "Test program failed using dlopen." >&4
12655                         echo "Perhaps you should not use dynamic loading." >&4;;
12656                 2)      echo "Test program failed using dlsym." >&4
12657                         echo "Perhaps you should not use dynamic loading." >&4;;
12658                 3)      echo "dlsym needs a leading underscore" >&4
12659                         val="$define" ;;
12660                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12661                 esac
12662         else
12663                 echo "I can't compile and run the test program." >&4
12664                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12665         fi
12666         ;;
12667 esac
12668
12669 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12670
12671 set d_dlsymun
12672 eval $setvar
12673
12674 : see if drand48_r exists
12675 set drand48_r d_drand48_r
12676 eval $inlibc
12677 case "$d_drand48_r" in
12678 "$define")
12679         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12680         case "$d_drand48_r_proto:$usethreads" in
12681         ":define")      d_drand48_r_proto=define
12682                 set d_drand48_r_proto drand48_r $hdrs
12683                 eval $hasproto ;;
12684         *)      ;;
12685         esac
12686         case "$d_drand48_r_proto" in
12687         define)
12688         case "$drand48_r_proto" in
12689         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12690         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12691         esac
12692         case "$drand48_r_proto" in
12693         ''|0)   d_drand48_r=undef
12694                 drand48_r_proto=0
12695                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12696         * )     case "$drand48_r_proto" in
12697                 REENTRANT_PROTO*) ;;
12698                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12699                 esac
12700                 echo "Prototype: $try" ;;
12701         esac
12702         ;;
12703         *)      case "$usethreads" in
12704                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12705                 esac
12706                 d_drand48_r=undef
12707                 drand48_r_proto=0
12708                 ;;
12709         esac
12710         ;;
12711 *)      drand48_r_proto=0
12712         ;;
12713 esac
12714
12715 : see if prototype for drand48 is available
12716 echo " "
12717 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12718 eval $hasproto
12719
12720 : see if dup2 exists
12721 set dup2 d_dup2
12722 eval $inlibc
12723
12724 : see if eaccess exists
12725 set eaccess d_eaccess
12726 eval $inlibc
12727
12728 : see if endgrent exists
12729 set endgrent d_endgrent
12730 eval $inlibc
12731
12732 : see if this is an grp system
12733 set grp.h i_grp
12734 eval $inhdr
12735
12736 case "$i_grp" in
12737 $define)
12738         xxx=`./findhdr grp.h`
12739         $cppstdin $cppflags $cppminus < $xxx >$$.h
12740
12741         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12742                 val="$define"
12743         else
12744                 val="$undef"
12745         fi
12746         set d_grpasswd
12747         eval $setvar
12748
12749         $rm -f $$.h
12750         ;;
12751 *)
12752         val="$undef";
12753         set d_grpasswd; eval $setvar
12754         ;;
12755 esac
12756
12757 : see if endgrent_r exists
12758 set endgrent_r d_endgrent_r
12759 eval $inlibc
12760 case "$d_endgrent_r" in
12761 "$define")
12762         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12763         case "$d_endgrent_r_proto:$usethreads" in
12764         ":define")      d_endgrent_r_proto=define
12765                 set d_endgrent_r_proto endgrent_r $hdrs
12766                 eval $hasproto ;;
12767         *)      ;;
12768         esac
12769         case "$d_endgrent_r_proto" in
12770         define)
12771         case "$endgrent_r_proto" in
12772         ''|0) try='int endgrent_r(FILE**);'
12773         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12774         esac
12775         case "$endgrent_r_proto" in
12776         ''|0) try='void endgrent_r(FILE**);'
12777         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12778         esac
12779         case "$endgrent_r_proto" in
12780         ''|0)   d_endgrent_r=undef
12781                 endgrent_r_proto=0
12782                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12783         * )     case "$endgrent_r_proto" in
12784                 REENTRANT_PROTO*) ;;
12785                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12786                 esac
12787                 echo "Prototype: $try" ;;
12788         esac
12789         ;;
12790         *)      case "$usethreads" in
12791                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12792                 esac
12793                 d_endgrent_r=undef
12794                 endgrent_r_proto=0
12795                 ;;
12796         esac
12797         ;;
12798 *)      endgrent_r_proto=0
12799         ;;
12800 esac
12801
12802 : see if endhostent exists
12803 set endhostent d_endhent
12804 eval $inlibc
12805
12806 : see if this is a netdb.h system
12807 set netdb.h i_netdb
12808 eval $inhdr
12809
12810 : see if endhostent_r exists
12811 set endhostent_r d_endhostent_r
12812 eval $inlibc
12813 case "$d_endhostent_r" in
12814 "$define")
12815         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12816         case "$d_endhostent_r_proto:$usethreads" in
12817         ":define")      d_endhostent_r_proto=define
12818                 set d_endhostent_r_proto endhostent_r $hdrs
12819                 eval $hasproto ;;
12820         *)      ;;
12821         esac
12822         case "$d_endhostent_r_proto" in
12823         define)
12824         case "$endhostent_r_proto" in
12825         ''|0) try='int endhostent_r(struct hostent_data*);'
12826         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12827         esac
12828         case "$endhostent_r_proto" in
12829         ''|0) try='void endhostent_r(struct hostent_data*);'
12830         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12831         esac
12832         case "$endhostent_r_proto" in
12833         ''|0)   d_endhostent_r=undef
12834                 endhostent_r_proto=0
12835                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12836         * )     case "$endhostent_r_proto" in
12837                 REENTRANT_PROTO*) ;;
12838                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12839                 esac
12840                 echo "Prototype: $try" ;;
12841         esac
12842         ;;
12843         *)      case "$usethreads" in
12844                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12845                 esac
12846                 d_endhostent_r=undef
12847                 endhostent_r_proto=0
12848                 ;;
12849         esac
12850         ;;
12851 *)      endhostent_r_proto=0
12852         ;;
12853 esac
12854
12855 : see if endnetent exists
12856 set endnetent d_endnent
12857 eval $inlibc
12858
12859 : see if endnetent_r exists
12860 set endnetent_r d_endnetent_r
12861 eval $inlibc
12862 case "$d_endnetent_r" in
12863 "$define")
12864         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12865         case "$d_endnetent_r_proto:$usethreads" in
12866         ":define")      d_endnetent_r_proto=define
12867                 set d_endnetent_r_proto endnetent_r $hdrs
12868                 eval $hasproto ;;
12869         *)      ;;
12870         esac
12871         case "$d_endnetent_r_proto" in
12872         define)
12873         case "$endnetent_r_proto" in
12874         ''|0) try='int endnetent_r(struct netent_data*);'
12875         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12876         esac
12877         case "$endnetent_r_proto" in
12878         ''|0) try='void endnetent_r(struct netent_data*);'
12879         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12880         esac
12881         case "$endnetent_r_proto" in
12882         ''|0)   d_endnetent_r=undef
12883                 endnetent_r_proto=0
12884                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12885         * )     case "$endnetent_r_proto" in
12886                 REENTRANT_PROTO*) ;;
12887                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12888                 esac
12889                 echo "Prototype: $try" ;;
12890         esac
12891         ;;
12892         *)      case "$usethreads" in
12893                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12894                 esac
12895                 d_endnetent_r=undef
12896                 endnetent_r_proto=0
12897                 ;;
12898         esac
12899         ;;
12900 *)      endnetent_r_proto=0
12901         ;;
12902 esac
12903
12904 : see if endprotoent exists
12905 set endprotoent d_endpent
12906 eval $inlibc
12907
12908 : see if endprotoent_r exists
12909 set endprotoent_r d_endprotoent_r
12910 eval $inlibc
12911 case "$d_endprotoent_r" in
12912 "$define")
12913         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12914         case "$d_endprotoent_r_proto:$usethreads" in
12915         ":define")      d_endprotoent_r_proto=define
12916                 set d_endprotoent_r_proto endprotoent_r $hdrs
12917                 eval $hasproto ;;
12918         *)      ;;
12919         esac
12920         case "$d_endprotoent_r_proto" in
12921         define)
12922         case "$endprotoent_r_proto" in
12923         ''|0) try='int endprotoent_r(struct protoent_data*);'
12924         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12925         esac
12926         case "$endprotoent_r_proto" in
12927         ''|0) try='void endprotoent_r(struct protoent_data*);'
12928         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12929         esac
12930         case "$endprotoent_r_proto" in
12931         ''|0)   d_endprotoent_r=undef
12932                 endprotoent_r_proto=0
12933                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12934         * )     case "$endprotoent_r_proto" in
12935                 REENTRANT_PROTO*) ;;
12936                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12937                 esac
12938                 echo "Prototype: $try" ;;
12939         esac
12940         ;;
12941         *)      case "$usethreads" in
12942                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12943                 esac
12944                 d_endprotoent_r=undef
12945                 endprotoent_r_proto=0
12946                 ;;
12947         esac
12948         ;;
12949 *)      endprotoent_r_proto=0
12950         ;;
12951 esac
12952
12953 : see if endpwent exists
12954 set endpwent d_endpwent
12955 eval $inlibc
12956
12957 : see if this is a pwd.h system
12958 set pwd.h i_pwd
12959 eval $inhdr
12960
12961 case "$i_pwd" in
12962 $define)
12963         xxx=`./findhdr pwd.h`
12964         $cppstdin $cppflags $cppminus < $xxx >$$.h
12965
12966         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12967                 val="$define"
12968         else
12969                 val="$undef"
12970         fi
12971         set d_pwquota
12972         eval $setvar
12973
12974         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12975                 val="$define"
12976         else
12977                 val="$undef"
12978         fi
12979         set d_pwage
12980         eval $setvar
12981
12982         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12983                 val="$define"
12984         else
12985                 val="$undef"
12986         fi
12987         set d_pwchange
12988         eval $setvar
12989
12990         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12991                 val="$define"
12992         else
12993                 val="$undef"
12994         fi
12995         set d_pwclass
12996         eval $setvar
12997
12998         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12999                 val="$define"
13000         else
13001                 val="$undef"
13002         fi
13003         set d_pwexpire
13004         eval $setvar
13005
13006         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
13007                 val="$define"
13008         else
13009                 val="$undef"
13010         fi
13011         set d_pwcomment
13012         eval $setvar
13013
13014         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
13015                 val="$define"
13016         else
13017                 val="$undef"
13018         fi
13019         set d_pwgecos
13020         eval $setvar
13021
13022         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
13023                 val="$define"
13024         else
13025                 val="$undef"
13026         fi
13027         set d_pwpasswd
13028         eval $setvar
13029
13030         $rm -f $$.h
13031         ;;
13032 *)
13033         val="$undef";
13034         set d_pwquota; eval $setvar
13035         set d_pwage; eval $setvar
13036         set d_pwchange; eval $setvar
13037         set d_pwclass; eval $setvar
13038         set d_pwexpire; eval $setvar
13039         set d_pwcomment; eval $setvar
13040         set d_pwgecos; eval $setvar
13041         set d_pwpasswd; eval $setvar
13042         ;;
13043 esac
13044
13045 : see if endpwent_r exists
13046 set endpwent_r d_endpwent_r
13047 eval $inlibc
13048 case "$d_endpwent_r" in
13049 "$define")
13050         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13051         case "$d_endpwent_r_proto:$usethreads" in
13052         ":define")      d_endpwent_r_proto=define
13053                 set d_endpwent_r_proto endpwent_r $hdrs
13054                 eval $hasproto ;;
13055         *)      ;;
13056         esac
13057         case "$d_endpwent_r_proto" in
13058         define)
13059         case "$endpwent_r_proto" in
13060         ''|0) try='int endpwent_r(FILE**);'
13061         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13062         esac
13063         case "$endpwent_r_proto" in
13064         ''|0) try='void endpwent_r(FILE**);'
13065         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13066         esac
13067         case "$endpwent_r_proto" in
13068         ''|0)   d_endpwent_r=undef
13069                 endpwent_r_proto=0
13070                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13071         * )     case "$endpwent_r_proto" in
13072                 REENTRANT_PROTO*) ;;
13073                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13074                 esac
13075                 echo "Prototype: $try" ;;
13076         esac
13077         ;;
13078         *)      case "$usethreads" in
13079                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13080                 esac
13081                 d_endpwent_r=undef
13082                 endpwent_r_proto=0
13083                 ;;
13084         esac
13085         ;;
13086 *)      endpwent_r_proto=0
13087         ;;
13088 esac
13089
13090 : see if endservent exists
13091 set endservent d_endsent
13092 eval $inlibc
13093
13094 : see if endservent_r exists
13095 set endservent_r d_endservent_r
13096 eval $inlibc
13097 case "$d_endservent_r" in
13098 "$define")
13099         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13100         case "$d_endservent_r_proto:$usethreads" in
13101         ":define")      d_endservent_r_proto=define
13102                 set d_endservent_r_proto endservent_r $hdrs
13103                 eval $hasproto ;;
13104         *)      ;;
13105         esac
13106         case "$d_endservent_r_proto" in
13107         define)
13108         case "$endservent_r_proto" in
13109         ''|0) try='int endservent_r(struct servent_data*);'
13110         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13111         esac
13112         case "$endservent_r_proto" in
13113         ''|0) try='void endservent_r(struct servent_data*);'
13114         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13115         esac
13116         case "$endservent_r_proto" in
13117         ''|0)   d_endservent_r=undef
13118                 endservent_r_proto=0
13119                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13120         * )     case "$endservent_r_proto" in
13121                 REENTRANT_PROTO*) ;;
13122                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13123                 esac
13124                 echo "Prototype: $try" ;;
13125         esac
13126         ;;
13127         *)      case "$usethreads" in
13128                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13129                 esac
13130                 d_endservent_r=undef
13131                 endservent_r_proto=0
13132                 ;;
13133         esac
13134         ;;
13135 *)      endservent_r_proto=0
13136         ;;
13137 esac
13138
13139 : Locate the flags for 'open()'
13140 echo " "
13141 $cat >try.c <<EOCP
13142 #include <sys/types.h>
13143 #ifdef I_FCNTL
13144 #include <fcntl.h>
13145 #endif
13146 #ifdef I_SYS_FILE
13147 #include <sys/file.h>
13148 #endif
13149 #$i_stdlib I_STDLIB
13150 #ifdef I_STDLIB
13151 #include <stdlib.h>
13152 #endif
13153 int main() {
13154         if(O_RDONLY);
13155 #ifdef O_TRUNC
13156         exit(0);
13157 #else
13158         exit(1);
13159 #endif
13160 }
13161 EOCP
13162 : check sys/file.h first to get FREAD on Sun
13163 if $test `./findhdr sys/file.h` && \
13164                 set try -DI_SYS_FILE && eval $compile; then
13165         h_sysfile=true;
13166         echo "<sys/file.h> defines the O_* constants..." >&4
13167         if $run ./try; then
13168                 echo "and you have the 3 argument form of open()." >&4
13169                 val="$define"
13170         else
13171                 echo "but not the 3 argument form of open().  Oh, well." >&4
13172                 val="$undef"
13173         fi
13174 elif $test `./findhdr fcntl.h` && \
13175                 set try -DI_FCNTL && eval $compile; then
13176         h_fcntl=true;
13177         echo "<fcntl.h> defines the O_* constants..." >&4
13178         if $run ./try; then
13179                 echo "and you have the 3 argument form of open()." >&4
13180                 val="$define"
13181         else
13182                 echo "but not the 3 argument form of open().  Oh, well." >&4
13183                 val="$undef"
13184         fi
13185 else
13186         val="$undef"
13187         echo "I can't find the O_* constant definitions!  You got problems." >&4
13188 fi
13189 set d_open3
13190 eval $setvar
13191 $rm_try
13192
13193 : see if this is a sys/file.h system
13194 val=''
13195 set sys/file.h val
13196 eval $inhdr
13197
13198 : do we need to include sys/file.h ?
13199 case "$val" in
13200 "$define")
13201         echo " "
13202         if $h_sysfile; then
13203                 val="$define"
13204                 echo "We'll be including <sys/file.h>." >&4
13205         else
13206                 val="$undef"
13207                 echo "We won't be including <sys/file.h>." >&4
13208         fi
13209         ;;
13210 *)
13211         h_sysfile=false
13212         ;;
13213 esac
13214 set i_sysfile
13215 eval $setvar
13216
13217 : see if fcntl.h is there
13218 val=''
13219 set fcntl.h val
13220 eval $inhdr
13221
13222 : see if we can include fcntl.h
13223 case "$val" in
13224 "$define")
13225         echo " "
13226         if $h_fcntl; then
13227                 val="$define"
13228                 echo "We'll be including <fcntl.h>." >&4
13229         else
13230                 val="$undef"
13231                 if $h_sysfile; then
13232         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13233                 else
13234                         echo "We won't be including <fcntl.h>." >&4
13235                 fi
13236         fi
13237         ;;
13238 *)
13239         h_fcntl=false
13240         val="$undef"
13241         ;;
13242 esac
13243 set i_fcntl
13244 eval $setvar
13245
13246 : see if fork exists
13247 set fork d_fork
13248 eval $inlibc
13249
13250 : see if pipe exists
13251 set pipe d_pipe
13252 eval $inlibc
13253
13254 : check for non-blocking I/O stuff
13255 case "$h_sysfile" in
13256 true) echo "#include <sys/file.h>" > head.c;;
13257 *)
13258        case "$h_fcntl" in
13259        true) echo "#include <fcntl.h>" > head.c;;
13260        *) echo "#include <sys/fcntl.h>" > head.c;;
13261        esac
13262        ;;
13263 esac
13264 echo " "
13265 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13266 case "$o_nonblock" in
13267 '')
13268         $cat head.c > try.c
13269         $cat >>try.c <<EOCP
13270 #include <stdio.h>
13271 #$i_stdlib I_STDLIB
13272 #ifdef I_STDLIB
13273 #include <stdlib.h>
13274 #endif
13275 #$i_fcntl I_FCNTL
13276 #ifdef I_FCNTL
13277 #include <fcntl.h>
13278 #endif
13279 int main() {
13280 #ifdef O_NONBLOCK
13281         printf("O_NONBLOCK\n");
13282         exit(0);
13283 #endif
13284 #ifdef O_NDELAY
13285         printf("O_NDELAY\n");
13286         exit(0);
13287 #endif
13288 #ifdef FNDELAY
13289         printf("FNDELAY\n");
13290         exit(0);
13291 #endif
13292         exit(0);
13293 }
13294 EOCP
13295         set try
13296         if eval $compile_ok; then
13297                 o_nonblock=`$run ./try`
13298                 case "$o_nonblock" in
13299                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13300                 *) echo "Seems like we can use $o_nonblock.";;
13301                 esac
13302         else
13303                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13304         fi
13305         ;;
13306 *) echo "Using $hint value $o_nonblock.";;
13307 esac
13308 $rm_try
13309
13310 echo " "
13311 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13312 case "$eagain" in
13313 '')
13314         case "$d_fork:$d_pipe" in
13315         define:define)
13316         $cat head.c > try.c
13317         $cat >>try.c <<EOCP
13318 #include <errno.h>
13319 #include <sys/types.h>
13320 #include <signal.h>
13321 #include <stdio.h>
13322 #$i_stdlib I_STDLIB
13323 #ifdef I_STDLIB
13324 #include <stdlib.h>
13325 #endif
13326 #$i_fcntl I_FCNTL
13327 #ifdef I_FCNTL
13328 #include <fcntl.h>
13329 #endif
13330 #define MY_O_NONBLOCK $o_nonblock
13331 #ifndef errno  /* XXX need better Configure test */
13332 extern int errno;
13333 #endif
13334 #$i_unistd I_UNISTD
13335 #ifdef I_UNISTD
13336 #include <unistd.h>
13337 #endif
13338 #$i_string I_STRING
13339 #ifdef I_STRING
13340 #include <string.h>
13341 #else
13342 #include <strings.h>
13343 #endif
13344 $signal_t blech(int x) { exit(3); }
13345 EOCP
13346         $cat >> try.c <<'EOCP'
13347 int main()
13348 {
13349         int pd[2];
13350         int pu[2];
13351         char buf[1];
13352         char string[100];
13353         int ret;
13354
13355         ret = pipe(pd); /* Down: child -> parent */
13356         if (ret != 0)
13357                 exit(3);
13358         ret = pipe(pu); /* Up: parent -> child */
13359         if (ret != 0)
13360                 exit(3);
13361         if (0 != fork()) {
13362                 close(pd[1]);   /* Parent reads from pd[0] */
13363                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13364 #ifdef F_SETFL
13365                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13366                         exit(1);
13367 #else
13368                 exit(4);
13369 #endif
13370                 signal(SIGALRM, blech);
13371                 alarm(5);
13372                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13373                         exit(2);
13374                 sprintf(string, "%d\n", ret);
13375                 ret = write(2, string, strlen(string));
13376                 if (ret != strlen(string))
13377                         exit(3);
13378                 alarm(0);
13379 #ifdef EAGAIN
13380                 if (errno == EAGAIN) {
13381                         printf("EAGAIN\n");
13382                         goto ok;
13383                 }
13384 #endif
13385 #ifdef EWOULDBLOCK
13386                 if (errno == EWOULDBLOCK)
13387                         printf("EWOULDBLOCK\n");
13388 #endif
13389         ok:
13390                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13391                 if (ret != 1)
13392                         exit(3);
13393                 sleep(2);                               /* Give it time to close our pipe */
13394                 alarm(5);
13395                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13396                 alarm(0);
13397                 sprintf(string, "%d\n", ret);
13398                 ret = write(4, string, strlen(string));
13399                 if (ret != strlen(string))
13400                         exit(3);
13401                 exit(0);
13402         }
13403
13404         close(pd[0]);                   /* We write to pd[1] */
13405         close(pu[1]);                   /* We read from pu[0] */
13406         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13407         if (ret != 1)
13408                 exit(3);
13409         close(pd[1]);                   /* Pipe pd is now fully closed! */
13410         exit(0);                                /* Bye bye, thank you for playing! */
13411 }
13412 EOCP
13413         set try
13414         if eval $compile_ok; then
13415                 echo "$startsh" >mtry
13416                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13417                 chmod +x mtry
13418                 $run ./mtry >/dev/null 2>&1
13419                 case $? in
13420                 0) eagain=`$cat try.out`;;
13421                 1) echo "Could not perform non-blocking setting!";;
13422                 2) echo "I did a successful read() for something that was not there!";;
13423                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13424                 4) echo "Could not find F_SETFL!";;
13425                 *) echo "Something terribly wrong happened during testing.";;
13426                 esac
13427                 rd_nodata=`$cat try.ret`
13428                 echo "A read() system call with no data present returns $rd_nodata."
13429                 case "$rd_nodata" in
13430                 0|-1) ;;
13431                 *)
13432                         echo "(That's peculiar, fixing that to be -1.)"
13433                         rd_nodata=-1
13434                         ;;
13435                 esac
13436                 case "$eagain" in
13437                 '')
13438                         echo "Forcing errno EAGAIN on read() with no data available."
13439                         eagain=EAGAIN
13440                         ;;
13441                 *)
13442                         echo "Your read() sets errno to $eagain when no data is available."
13443                         ;;
13444                 esac
13445                 status=`$cat try.err`
13446                 case "$status" in
13447                 0) echo "And it correctly returns 0 to signal EOF.";;
13448                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13449                 *) echo "However, your read() returns '$status' on EOF??";;
13450                 esac
13451                 val="$define"
13452                 if test "$status" = "$rd_nodata"; then
13453                         echo "WARNING: you can't distinguish between EOF and no data!"
13454                         val="$undef"
13455                 fi
13456         else
13457                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13458                 eagain=EAGAIN
13459         fi
13460         ;;
13461         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13462                 eagain=EAGAIN
13463                 val="$define"
13464                 ;;
13465         esac
13466         set d_eofnblk
13467         eval $setvar
13468         ;;
13469 *)
13470         echo "Using $hint value $eagain."
13471         echo "Your read() returns $rd_nodata when no data is present."
13472         case "$d_eofnblk" in
13473         "$define") echo "And you can see EOF because read() returns 0.";;
13474         "$undef") echo "But you can't see EOF status from read() returned value.";;
13475         *)
13476                 echo "(Assuming you can't see EOF status from read anyway.)"
13477                 d_eofnblk=$undef
13478                 ;;
13479         esac
13480         ;;
13481 esac
13482 $rm_try head.c mtry
13483
13484 : see if erf exists
13485 set erf d_erf
13486 eval $inlibc
13487
13488 : see if erfc exists
13489 set erfc d_erfc
13490 eval $inlibc
13491
13492 : see if exp2 exists
13493 set exp2 d_exp2
13494 eval $inlibc
13495
13496 : see if expm1 exists
13497 set expm1 d_expm1
13498 eval $inlibc
13499
13500 : see if _ptr and _cnt from stdio act std
13501 echo " "
13502
13503 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13504         echo "(Looks like you have stdio.h from BSD.)"
13505         case "$stdio_ptr" in
13506         '') stdio_ptr='((fp)->_p)'
13507                 ptr_lval=$define
13508                 ;;
13509         *)      ptr_lval=$d_stdio_ptr_lval;;
13510         esac
13511         case "$stdio_cnt" in
13512         '') stdio_cnt='((fp)->_r)'
13513                 cnt_lval=$define
13514                 ;;
13515         *)      cnt_lval=$d_stdio_cnt_lval;;
13516         esac
13517         case "$stdio_base" in
13518         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13519         esac
13520         case "$stdio_bufsiz" in
13521         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13522         esac
13523 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13524         echo "(Looks like you have stdio.h from Linux.)"
13525         case "$stdio_ptr" in
13526         '') stdio_ptr='((fp)->_IO_read_ptr)'
13527                 ptr_lval=$define
13528                 ;;
13529         *)      ptr_lval=$d_stdio_ptr_lval;;
13530         esac
13531         case "$stdio_cnt" in
13532         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13533                 cnt_lval=$undef
13534                 ;;
13535         *)      cnt_lval=$d_stdio_cnt_lval;;
13536         esac
13537         case "$stdio_base" in
13538         '') stdio_base='((fp)->_IO_read_base)';;
13539         esac
13540         case "$stdio_bufsiz" in
13541         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13542         esac
13543 else
13544         case "$stdio_ptr" in
13545         '') stdio_ptr='((fp)->_ptr)'
13546                 ptr_lval=$define
13547                 ;;
13548         *)      ptr_lval=$d_stdio_ptr_lval;;
13549         esac
13550         case "$stdio_cnt" in
13551         '') stdio_cnt='((fp)->_cnt)'
13552                 cnt_lval=$define
13553                 ;;
13554         *)      cnt_lval=$d_stdio_cnt_lval;;
13555         esac
13556         case "$stdio_base" in
13557         '') stdio_base='((fp)->_base)';;
13558         esac
13559         case "$stdio_bufsiz" in
13560         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13561         esac
13562 fi
13563
13564 : test whether _ptr and _cnt really work
13565 echo "Checking how std your stdio is..." >&4
13566 $cat >try.c <<EOP
13567 #include <stdio.h>
13568 #$i_stdlib I_STDLIB
13569 #ifdef I_STDLIB
13570 #include <stdlib.h>
13571 #endif
13572 #define FILE_ptr(fp)    $stdio_ptr
13573 #define FILE_cnt(fp)    $stdio_cnt
13574 int main() {
13575         FILE *fp = fopen("try.c", "r");
13576         char c = getc(fp);
13577         if (
13578                 18 <= FILE_cnt(fp) &&
13579                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13580         )
13581                 exit(0);
13582         exit(1);
13583 }
13584 EOP
13585 val="$undef"
13586 set try
13587 if eval $compile && $to try.c; then
13588         if $run ./try; then
13589                 echo "Your stdio acts pretty std."
13590                 val="$define"
13591         else
13592                 echo "Your stdio isn't very std."
13593         fi
13594 else
13595         echo "Your stdio doesn't appear very std."
13596 fi
13597 $rm_try
13598
13599 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13600 # direct buffer manipulation no longer works.  The Configure tests
13601 # should be changed to correctly detect this, but until then,
13602 # the following check should at least let perl compile and run.
13603 # (This quick fix should be updated before 5.8.1.)
13604 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13605 # A. Dougherty, June 3, 2002.
13606 case "$d_gnulibc" in
13607 $define)
13608         case "$gnulibc_version" in
13609         2.[01]*)  ;;
13610         2.2) ;;
13611         2.2.[0-9]) ;;
13612         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13613                 val="$undef"
13614                 ;;
13615         esac
13616         ;;
13617 esac
13618 set d_stdstdio
13619 eval $setvar
13620
13621 : Can _ptr be used as an lvalue?
13622 case "$d_stdstdio$ptr_lval" in
13623 $define$define) val=$define ;;
13624 *) val=$undef ;;
13625 esac
13626 set d_stdio_ptr_lval
13627 eval $setvar
13628
13629 : Can _cnt be used as an lvalue?
13630 case "$d_stdstdio$cnt_lval" in
13631 $define$define) val=$define ;;
13632 *) val=$undef ;;
13633 esac
13634 set d_stdio_cnt_lval
13635 eval $setvar
13636
13637
13638 : test whether setting _ptr sets _cnt as a side effect
13639 d_stdio_ptr_lval_sets_cnt="$undef"
13640 d_stdio_ptr_lval_nochange_cnt="$undef"
13641 case "$d_stdio_ptr_lval$d_stdstdio" in
13642 $define$define)
13643         echo "Checking to see what happens if we set the stdio ptr..." >&4
13644 $cat >try.c <<EOP
13645 #include <stdio.h>
13646 /* Can we scream? */
13647 /* Eat dust sed :-) */
13648 /* In the buffer space, no one can hear you scream. */
13649 #$i_stdlib I_STDLIB
13650 #ifdef I_STDLIB
13651 #include <stdlib.h>
13652 #endif
13653 #define FILE_ptr(fp)    $stdio_ptr
13654 #define FILE_cnt(fp)    $stdio_cnt
13655 #include <sys/types.h>
13656 int main() {
13657         FILE *fp = fopen("try.c", "r");
13658         int c;
13659         char *ptr;
13660         size_t cnt;
13661         if (!fp) {
13662             puts("Fail even to read");
13663             exit(1);
13664         }
13665         c = getc(fp); /* Read away the first # */
13666         if (c == EOF) {
13667             puts("Fail even to read");
13668             exit(1);
13669         }
13670         if (!(
13671                 18 <= FILE_cnt(fp) &&
13672                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13673         )) {
13674                 puts("Fail even to read");
13675                 exit (1);
13676         }
13677         ptr = (char*) FILE_ptr(fp);
13678         cnt = (size_t)FILE_cnt(fp);
13679
13680         FILE_ptr(fp) += 42;
13681
13682         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13683                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13684                 exit (1);
13685         }
13686         if (FILE_cnt(fp) <= 20) {
13687                 printf ("Fail (<20 chars to test)");
13688                 exit (1);
13689         }
13690         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13691                 puts("Fail compare");
13692                 exit (1);
13693         }
13694         if (cnt == FILE_cnt(fp)) {
13695                 puts("Pass_unchanged");
13696                 exit (0);
13697         }
13698         if (FILE_cnt(fp) == (cnt - 42)) {
13699                 puts("Pass_changed");
13700                 exit (0);
13701         }
13702         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13703         return 1;
13704
13705 }
13706 EOP
13707         set try
13708         if eval $compile && $to try.c; then
13709                 case `$run ./try` in
13710                 Pass_changed)
13711                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13712                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13713                 Pass_unchanged)
13714                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13715                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13716                 Fail*)
13717                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13718                 *)
13719                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13720         esac
13721         else
13722                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13723         fi
13724         $rm_try
13725         ;;
13726 esac
13727
13728 : see if _base is also standard
13729 val="$undef"
13730 case "$d_stdstdio" in
13731 $define)
13732         $cat >try.c <<EOP
13733 #include <stdio.h>
13734 #$i_stdlib I_STDLIB
13735 #ifdef I_STDLIB
13736 #include <stdlib.h>
13737 #endif
13738 #define FILE_base(fp)   $stdio_base
13739 #define FILE_bufsiz(fp) $stdio_bufsiz
13740 int main() {
13741         FILE *fp = fopen("try.c", "r");
13742         char c = getc(fp);
13743         if (
13744                 19 <= FILE_bufsiz(fp) &&
13745                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13746         )
13747                 exit(0);
13748         exit(1);
13749 }
13750 EOP
13751         set try
13752         if eval $compile && $to try.c; then
13753                 if $run ./try; then
13754                         echo "And its _base field acts std."
13755                         val="$define"
13756                 else
13757                         echo "But its _base field isn't std."
13758                 fi
13759         else
13760                 echo "However, it seems to be lacking the _base field."
13761         fi
13762         $rm_try
13763         ;;
13764 esac
13765 set d_stdiobase
13766 eval $setvar
13767
13768 : see if fast_stdio exists
13769 val="$undef"
13770 case "$d_stdstdio:$d_stdio_ptr_lval" in
13771 "$define:$define")
13772         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13773         *$define*)
13774                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13775                 val="$define"
13776                 ;;
13777         esac
13778         ;;
13779 esac
13780 set d_faststdio
13781 eval $setvar
13782
13783
13784
13785 : see if fchdir exists
13786 set fchdir d_fchdir
13787 eval $inlibc
13788
13789 : see if fchmod exists
13790 set fchmod d_fchmod
13791 eval $inlibc
13792
13793 : see if fchown exists
13794 set fchown d_fchown
13795 eval $inlibc
13796
13797 : see if this is an fcntl system
13798 set fcntl d_fcntl
13799 eval $inlibc
13800
13801 : See if fcntl-based locking works.
13802 echo " "
13803 $cat >try.c <<EOCP
13804 #$i_stdlib I_STDLIB
13805 #ifdef I_STDLIB
13806 #include <stdlib.h>
13807 #endif
13808 #include <unistd.h>
13809 #include <fcntl.h>
13810 #include <signal.h>
13811 $signal_t blech(int x) { exit(3); }
13812 int main() {
13813 #if defined(F_SETLK) && defined(F_SETLKW)
13814      struct flock flock;
13815      int retval, fd;
13816      fd = open("try.c", O_RDONLY);
13817      flock.l_type = F_RDLCK;
13818      flock.l_whence = SEEK_SET;
13819      flock.l_start = flock.l_len = 0;
13820      signal(SIGALRM, blech);
13821      alarm(10);
13822      retval = fcntl(fd, F_SETLK, &flock);
13823      close(fd);
13824      (retval < 0 ? exit(2) : exit(0));
13825 #else
13826      exit(2);
13827 #endif
13828 }
13829 EOCP
13830 echo "Checking if fcntl-based file locking works... "
13831 case "$d_fcntl" in
13832 "$define")
13833         set try
13834         if eval $compile_ok; then
13835                 if $run ./try; then
13836                         echo "Yes, it seems to work."
13837                         val="$define"
13838                 else
13839                         echo "Nope, it didn't work."
13840                         val="$undef"
13841                         case "$?" in
13842                         3) $cat >&4 <<EOM
13843 ***
13844 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13845 *** This is (almost) impossible.
13846 *** If your NFS lock daemons are not feeling well, something like
13847 *** this may happen, please investigate.  Cannot continue, aborting.
13848 ***
13849 EOM
13850                                 exit 1
13851                                 ;;
13852                         esac
13853                 fi
13854         else
13855                 echo "I'm unable to compile the test program, so I'll assume not."
13856                 val="$undef"
13857         fi
13858         ;;
13859 *) val="$undef";
13860         echo "Nope, since you don't even have fcntl()."
13861         ;;
13862 esac
13863 set d_fcntl_can_lock
13864 eval $setvar
13865 $rm_try
13866
13867 : check for fd_set items
13868 $cat <<EOM
13869
13870 Checking to see how well your C compiler handles fd_set and friends ...
13871 EOM
13872 $cat >try.c <<EOCP
13873 #$i_stdlib I_STDLIB
13874 #ifdef I_STDLIB
13875 #include <stdlib.h>
13876 #endif
13877 #$i_systime I_SYS_TIME
13878 #$i_sysselct I_SYS_SELECT
13879 #$d_socket HAS_SOCKET
13880 #include <sys/types.h>
13881 #ifdef HAS_SOCKET
13882 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13883 #endif
13884 #ifdef I_SYS_TIME
13885 #include <sys/time.h>
13886 #endif
13887 #ifdef I_SYS_SELECT
13888 #include <sys/select.h>
13889 #endif
13890 int main() {
13891         fd_set fds;
13892
13893 #ifdef TRYBITS
13894         if(fds.fds_bits);
13895 #endif
13896
13897 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13898         exit(0);
13899 #else
13900         exit(1);
13901 #endif
13902 }
13903 EOCP
13904 set try -DTRYBITS
13905 if eval $compile; then
13906         d_fds_bits="$define"
13907         d_fd_set="$define"
13908         echo "Well, your system knows about the normal fd_set typedef..." >&4
13909         if $run ./try; then
13910                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13911                 d_fd_macros="$define"
13912         else
13913                 $cat >&4 <<'EOM'
13914 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13915 EOM
13916                 d_fd_macros="$undef"
13917         fi
13918 else
13919         $cat <<'EOM'
13920 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13921 EOM
13922         set try
13923         if eval $compile; then
13924                 d_fds_bits="$undef"
13925                 d_fd_set="$define"
13926                 echo "Well, your system has some sort of fd_set available..." >&4
13927                 if $run ./try; then
13928                         echo "and you have the normal fd_set macros." >&4
13929                         d_fd_macros="$define"
13930                 else
13931                         $cat <<'EOM'
13932 but not the normal fd_set macros!  Gross!  More work for me...
13933 EOM
13934                         d_fd_macros="$undef"
13935                 fi
13936         else
13937         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13938                 d_fd_set="$undef"
13939                 d_fds_bits="$undef"
13940                 d_fd_macros="$undef"
13941         fi
13942 fi
13943 $rm_try
13944
13945 : see if fdim exists
13946 set fdim d_fdim
13947 eval $inlibc
13948
13949 : see if fegetround exists
13950 set fegetround d_fegetround
13951 eval $inlibc
13952
13953 : see if fgetpos exists
13954 set fgetpos d_fgetpos
13955 eval $inlibc
13956
13957 : see if finite exists
13958 set finite d_finite
13959 eval $inlibc
13960
13961 : see if finitel exists
13962 set finitel d_finitel
13963 eval $inlibc
13964
13965 : see if flock exists
13966 set flock d_flock
13967 eval $inlibc
13968
13969 : see if prototype for flock is available
13970 echo " "
13971 set d_flockproto flock $i_sysfile sys/file.h
13972 eval $hasproto
13973
13974 : see if fma exists
13975 set fma d_fma
13976 eval $inlibc
13977
13978 : see if fmax exists
13979 set fmax d_fmax
13980 eval $inlibc
13981
13982 : see if fmin exists
13983 set fmin d_fmin
13984 eval $inlibc
13985
13986 : see if fp_class exists
13987 set fp_class d_fp_class
13988 eval $inlibc
13989
13990 : see if this is a math.h system
13991 set math.h i_math
13992 eval $inhdr
13993
13994 : check for fpclassify
13995 echo "Checking to see if you have fpclassify..." >&4
13996 $cat >try.c <<EOCP
13997 #$i_math I_MATH
13998 #ifdef I_MATH
13999 #include <math.h>
14000 #endif
14001 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
14002 EOCP
14003 set try
14004 if eval $compile; then
14005         val="$define"
14006         echo "You have fpclassify."
14007 else
14008         val="$undef"
14009         echo "You do not have fpclassify."
14010 fi
14011 $rm_try
14012 set d_fpclassify
14013 eval $setvar
14014
14015 : see if fp_classify exists
14016 set fp_classify d_fp_classify
14017 eval $inlibc
14018
14019 : see if fp_classl exists
14020 set fp_classl d_fp_classl
14021 eval $inlibc
14022
14023 : see if pathconf exists
14024 set pathconf d_pathconf
14025 eval $inlibc
14026
14027 : see if fpathconf exists
14028 set fpathconf d_fpathconf
14029 eval $inlibc
14030
14031 : see if fpclass exists
14032 set fpclass d_fpclass
14033 eval $inlibc
14034
14035 : see if fpclassl exists
14036 set fpclassl d_fpclassl
14037 eval $inlibc
14038
14039 : see if fpgetround exists
14040 set fpgetround d_fpgetround
14041 eval $inlibc
14042
14043 : check for fpos64_t
14044 echo " "
14045 echo "Checking to see if you have fpos64_t..." >&4
14046 $cat >try.c <<EOCP
14047 #include <stdio.h>
14048 int main() { fpos64_t x = 7; }
14049 EOCP
14050 set try
14051 if eval $compile; then
14052         val="$define"
14053         echo "You have fpos64_t."
14054 else
14055         val="$undef"
14056         echo "You do not have fpos64_t."
14057         case "$fpossize" in
14058         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14059         esac
14060 fi
14061 $rm_try
14062 set d_fpos64_t
14063 eval $setvar
14064
14065 : see if frexpl exists
14066 set frexpl d_frexpl
14067 eval $inlibc
14068
14069 : see if this is a sys/param system
14070 set sys/param.h i_sysparam
14071 eval $inhdr
14072
14073 : see if this is a sys/mount.h system
14074 set sys/mount.h i_sysmount
14075 eval $inhdr
14076
14077 : Check for fs_data_s
14078 echo " "
14079 echo "Checking to see if your system supports struct fs_data..." >&4
14080 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14081 eval $hasstruct
14082 case "$d_fs_data_s" in
14083 "$define")      echo "Yes, it does."   ;;
14084 *)              echo "No, it doesn't." ;;
14085 esac
14086
14087 : see if fseeko exists
14088 set fseeko d_fseeko
14089 eval $inlibc
14090 case "$longsize" in
14091 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14092 esac
14093
14094 : see if fsetpos exists
14095 set fsetpos d_fsetpos
14096 eval $inlibc
14097
14098 : see if fstatfs exists
14099 set fstatfs d_fstatfs
14100 eval $inlibc
14101
14102 : see if statvfs exists
14103 set statvfs d_statvfs
14104 eval $inlibc
14105
14106 : see if fstatvfs exists
14107 set fstatvfs d_fstatvfs
14108 eval $inlibc
14109
14110
14111 : see if fsync exists
14112 set fsync d_fsync
14113 eval $inlibc
14114
14115 : see if ftello exists
14116 set ftello d_ftello
14117 eval $inlibc
14118 case "$longsize" in
14119 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14120 esac
14121
14122 : check for a working futimes
14123 d_futimes="$undef"
14124 echo " "
14125 echo "Checking if you have a working futimes()" >&4
14126 $cat >try.c <<EOCP
14127 #include <stdio.h>
14128 #include <sys/time.h>
14129 #include <errno.h>
14130 #include <fcntl.h>
14131
14132 int main ()
14133 {
14134     int fd, rv;
14135     fd = open ("try.c", O_RDWR);
14136     if (-1 == fd) exit (1);
14137     rv = futimes (fd, NULL);
14138     exit (rv == -1 ? errno : 0);
14139 }
14140 EOCP
14141 set try
14142 if eval $compile; then
14143     `$run ./try`
14144     rc=$?
14145     case "$rc" in
14146         0)  echo "Yes, you have" >&4
14147             d_futimes="$define"
14148             ;;
14149         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14150             ;;
14151     esac
14152 else
14153     echo "No, it does not (probably harmless)" >&4
14154 fi
14155 $rm_try
14156
14157 : see if ndbm.h is available
14158 set ndbm.h i_ndbm
14159 eval $inhdr
14160 : Compatibility location for RedHat 7.1
14161 set gdbm/ndbm.h i_gdbmndbm
14162 eval $inhdr
14163 : Compatibility location for Debian 4.0
14164 set gdbm-ndbm.h i_gdbm_ndbm
14165 eval $inhdr
14166
14167 val="$undef"
14168 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14169         : see if dbm_open exists
14170         set dbm_open d_dbm_open
14171         eval $inlibc
14172         case "$d_dbm_open" in
14173         $undef)
14174                 i_ndbm="$undef"
14175                 i_gdbmndbm="$undef"
14176                 i_gdbm_ndbm="$undef"
14177                 echo "We won't be including <ndbm.h>"
14178                 val="$undef"
14179                 ;;
14180         *) val="$define"
14181            ;;
14182         esac
14183 fi
14184 set d_ndbm
14185 eval $setvar
14186
14187 ndbm_hdr_protochk='name=$1; hdr=$2;
14188 eval "ihdr=\$""i_$name";
14189 val="$undef";
14190 if $test "$ihdr" = "$define"; then
14191         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14192         case "$d_cplusplus" in
14193         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14194         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14195         esac;
14196         case "$val" in
14197         $define) $echo "Your <$hdr> seems to have prototypes";;
14198         *) $echo "Your <$hdr> does not seem to have prototypes";;
14199         esac;
14200 fi;
14201 set "d_${name}_h_uses_prototypes";
14202 eval $setvar'
14203
14204 set ndbm ndbm.h
14205 eval $ndbm_hdr_protochk
14206 set gdbmndbm gdbm/ndbm.h
14207 eval $ndbm_hdr_protochk
14208 set gdbm_ndbm gdbm-ndbm.h
14209 eval $ndbm_hdr_protochk
14210
14211 : see if getaddrinfo exists
14212 set getaddrinfo d_getaddrinfo
14213 eval $inlibc
14214
14215 : see if getcwd exists
14216 set getcwd d_getcwd
14217 eval $inlibc
14218
14219 : see if getespwnam exists
14220 set getespwnam d_getespwnam
14221 eval $inlibc
14222
14223 : see if getfsstat exists
14224 set getfsstat d_getfsstat
14225 eval $inlibc
14226
14227 : see if getgrent exists
14228 set getgrent d_getgrent
14229 eval $inlibc
14230
14231 : see if getgrent_r exists
14232 set getgrent_r d_getgrent_r
14233 eval $inlibc
14234 case "$d_getgrent_r" in
14235 "$define")
14236         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14237         case "$d_getgrent_r_proto:$usethreads" in
14238         ":define")      d_getgrent_r_proto=define
14239                 set d_getgrent_r_proto getgrent_r $hdrs
14240                 eval $hasproto ;;
14241         *)      ;;
14242         esac
14243         case "$d_getgrent_r_proto" in
14244         define)
14245         case "$getgrent_r_proto" in
14246         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14247         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14248         esac
14249         case "$getgrent_r_proto" in
14250         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14251         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14252         esac
14253         case "$getgrent_r_proto" in
14254         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14255         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14256         esac
14257         case "$getgrent_r_proto" in
14258         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14259         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14260         esac
14261         case "$getgrent_r_proto" in
14262         ''|0) try='int getgrent_r(struct group*, char*, int);'
14263         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14264         esac
14265         case "$getgrent_r_proto" in
14266         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14267         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14268         esac
14269         case "$getgrent_r_proto" in
14270         ''|0)   d_getgrent_r=undef
14271                 getgrent_r_proto=0
14272                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14273         * )     case "$getgrent_r_proto" in
14274                 REENTRANT_PROTO*) ;;
14275                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14276                 esac
14277                 echo "Prototype: $try" ;;
14278         esac
14279         ;;
14280         *)      case "$usethreads" in
14281                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14282                 esac
14283                 d_getgrent_r=undef
14284                 getgrent_r_proto=0
14285                 ;;
14286         esac
14287         ;;
14288 *)      getgrent_r_proto=0
14289         ;;
14290 esac
14291
14292 : see if getgrgid_r exists
14293 set getgrgid_r d_getgrgid_r
14294 eval $inlibc
14295 case "$d_getgrgid_r" in
14296 "$define")
14297         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14298         case "$d_getgrgid_r_proto:$usethreads" in
14299         ":define")      d_getgrgid_r_proto=define
14300                 set d_getgrgid_r_proto getgrgid_r $hdrs
14301                 eval $hasproto ;;
14302         *)      ;;
14303         esac
14304         case "$d_getgrgid_r_proto" in
14305         define)
14306         case "$getgrgid_r_proto" in
14307         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14308         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14309         esac
14310         case "$getgrgid_r_proto" in
14311         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14312         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14313         esac
14314         case "$getgrgid_r_proto" in
14315         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14316         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14317         esac
14318         case "$getgrgid_r_proto" in
14319         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14320         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14321         esac
14322         case "$getgrgid_r_proto" in
14323         ''|0)   d_getgrgid_r=undef
14324                 getgrgid_r_proto=0
14325                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14326         * )     case "$getgrgid_r_proto" in
14327                 REENTRANT_PROTO*) ;;
14328                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14329                 esac
14330                 echo "Prototype: $try" ;;
14331         esac
14332         ;;
14333         *)      case "$usethreads" in
14334                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14335                 esac
14336                 d_getgrgid_r=undef
14337                 getgrgid_r_proto=0
14338                 ;;
14339         esac
14340         ;;
14341 *)      getgrgid_r_proto=0
14342         ;;
14343 esac
14344
14345 : see if getgrnam_r exists
14346 set getgrnam_r d_getgrnam_r
14347 eval $inlibc
14348 case "$d_getgrnam_r" in
14349 "$define")
14350         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14351         case "$d_getgrnam_r_proto:$usethreads" in
14352         ":define")      d_getgrnam_r_proto=define
14353                 set d_getgrnam_r_proto getgrnam_r $hdrs
14354                 eval $hasproto ;;
14355         *)      ;;
14356         esac
14357         case "$d_getgrnam_r_proto" in
14358         define)
14359         case "$getgrnam_r_proto" in
14360         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14361         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14362         esac
14363         case "$getgrnam_r_proto" in
14364         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14365         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14366         esac
14367         case "$getgrnam_r_proto" in
14368         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14369         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14370         esac
14371         case "$getgrnam_r_proto" in
14372         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14373         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14374         esac
14375         case "$getgrnam_r_proto" in
14376         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14377         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14378         esac
14379         case "$getgrnam_r_proto" in
14380         ''|0)   d_getgrnam_r=undef
14381                 getgrnam_r_proto=0
14382                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14383         * )     case "$getgrnam_r_proto" in
14384                 REENTRANT_PROTO*) ;;
14385                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14386                 esac
14387                 echo "Prototype: $try" ;;
14388         esac
14389         ;;
14390         *)      case "$usethreads" in
14391                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14392                 esac
14393                 d_getgrnam_r=undef
14394                 getgrnam_r_proto=0
14395                 ;;
14396         esac
14397         ;;
14398 *)      getgrnam_r_proto=0
14399         ;;
14400 esac
14401
14402 : see if gethostbyaddr exists
14403 set gethostbyaddr d_gethbyaddr
14404 eval $inlibc
14405
14406 : see if gethostbyname exists
14407 set gethostbyname d_gethbyname
14408 eval $inlibc
14409
14410 : see if gethostent exists
14411 set gethostent d_gethent
14412 eval $inlibc
14413
14414 : see how we will look up host name
14415 echo " "
14416 call=''
14417 if set gethostname val -f d_gethname; eval $csym; $val; then
14418         echo 'gethostname() found.' >&4
14419         d_gethname="$define"
14420         call=gethostname
14421 fi
14422 if set uname val -f d_uname; eval $csym; $val; then
14423         if ./xenix; then
14424                 $cat <<'EOM'
14425 uname() was found, but you're running xenix, and older versions of xenix
14426 have a broken uname(). If you don't really know whether your xenix is old
14427 enough to have a broken system call, use the default answer.
14428
14429 EOM
14430                 dflt=y
14431                 case "$d_uname" in
14432                 "$define") dflt=n;;
14433                 esac
14434                 rp='Is your uname() broken?'
14435                 . ./myread
14436                 case "$ans" in
14437                 n*) d_uname="$define"; call=uname;;
14438                 esac
14439         else
14440                 echo 'uname() found.' >&4
14441                 d_uname="$define"
14442                 case "$call" in
14443                 '') call=uname ;;
14444                 esac
14445         fi
14446 fi
14447 case "$d_gethname" in
14448 '') d_gethname="$undef";;
14449 esac
14450 case "$d_uname" in
14451 '') d_uname="$undef";;
14452 esac
14453 case "$d_uname$d_gethname" in
14454 *define*)
14455         dflt=n
14456         cat <<EOM
14457
14458 Every now and then someone has a $call() that lies about the hostname
14459 but can't be fixed for political or economic reasons.  If you wish, I can
14460 pretend $call() isn't there and maybe compute hostname at run-time
14461 thanks to the '$phostname' command.
14462
14463 EOM
14464         rp="Shall I ignore $call() from now on?"
14465         . ./myread
14466         case "$ans" in
14467         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14468         esac;;
14469 esac
14470 case "$phostname" in
14471 '') aphostname='';;
14472 *) case "$aphostname" in
14473         /*) ;;
14474         *) set X $phostname
14475                 shift
14476                 file=$1
14477                 shift
14478                 file=`./loc $file $file $pth`
14479                 aphostname=`echo $file $*`
14480                 ;;
14481         esac
14482         ;;
14483 esac
14484 case "$d_uname$d_gethname" in
14485 *define*) ;;
14486 *)
14487         case "$phostname" in
14488         '')
14489                 echo "There will be no way for $package to get your hostname." >&4;;
14490         *)
14491         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14492                 ;;
14493         esac;;
14494 esac
14495 case "$d_phostname" in
14496 '') d_phostname="$undef";;
14497 esac
14498
14499 : see if gethostbyaddr_r exists
14500 set gethostbyaddr_r d_gethostbyaddr_r
14501 eval $inlibc
14502 case "$d_gethostbyaddr_r" in
14503 "$define")
14504         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14505         case "$d_gethostbyaddr_r_proto:$usethreads" in
14506         ":define")      d_gethostbyaddr_r_proto=define
14507                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14508                 eval $hasproto ;;
14509         *)      ;;
14510         esac
14511         case "$d_gethostbyaddr_r_proto" in
14512         define)
14513         case "$gethostbyaddr_r_proto" in
14514         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14515         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14516         esac
14517         case "$gethostbyaddr_r_proto" in
14518         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14519         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14520         esac
14521         case "$gethostbyaddr_r_proto" in
14522         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14523         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14524         esac
14525         case "$gethostbyaddr_r_proto" in
14526         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14527         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14528         esac
14529         case "$gethostbyaddr_r_proto" in
14530         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14531         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14532         esac
14533         case "$gethostbyaddr_r_proto" in
14534         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14535         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14536         esac
14537         case "$gethostbyaddr_r_proto" in
14538         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14539         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14540         esac
14541         case "$gethostbyaddr_r_proto" in
14542         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14543         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14544         esac
14545         case "$gethostbyaddr_r_proto" in
14546         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14547         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14548         esac
14549         case "$gethostbyaddr_r_proto" in
14550         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14551         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14552         esac
14553         case "$gethostbyaddr_r_proto" in
14554         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14555         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14556         esac
14557         case "$gethostbyaddr_r_proto" in
14558         ''|0)   d_gethostbyaddr_r=undef
14559                 gethostbyaddr_r_proto=0
14560                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14561         * )     case "$gethostbyaddr_r_proto" in
14562                 REENTRANT_PROTO*) ;;
14563                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14564                 esac
14565                 echo "Prototype: $try" ;;
14566         esac
14567         ;;
14568         *)      case "$usethreads" in
14569                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14570                 esac
14571                 d_gethostbyaddr_r=undef
14572                 gethostbyaddr_r_proto=0
14573                 ;;
14574         esac
14575         ;;
14576 *)      gethostbyaddr_r_proto=0
14577         ;;
14578 esac
14579
14580 : see if gethostbyname_r exists
14581 set gethostbyname_r d_gethostbyname_r
14582 eval $inlibc
14583 case "$d_gethostbyname_r" in
14584 "$define")
14585         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14586         case "$d_gethostbyname_r_proto:$usethreads" in
14587         ":define")      d_gethostbyname_r_proto=define
14588                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14589                 eval $hasproto ;;
14590         *)      ;;
14591         esac
14592         case "$d_gethostbyname_r_proto" in
14593         define)
14594         case "$gethostbyname_r_proto" in
14595         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14596         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14597         esac
14598         case "$gethostbyname_r_proto" in
14599         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14600         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14601         esac
14602         case "$gethostbyname_r_proto" in
14603         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14604         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14605         esac
14606         case "$gethostbyname_r_proto" in
14607         ''|0)   d_gethostbyname_r=undef
14608                 gethostbyname_r_proto=0
14609                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14610         * )     case "$gethostbyname_r_proto" in
14611                 REENTRANT_PROTO*) ;;
14612                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14613                 esac
14614                 echo "Prototype: $try" ;;
14615         esac
14616         ;;
14617         *)      case "$usethreads" in
14618                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14619                 esac
14620                 d_gethostbyname_r=undef
14621                 gethostbyname_r_proto=0
14622                 ;;
14623         esac
14624         ;;
14625 *)      gethostbyname_r_proto=0
14626         ;;
14627 esac
14628
14629 : see if gethostent_r exists
14630 set gethostent_r d_gethostent_r
14631 eval $inlibc
14632 case "$d_gethostent_r" in
14633 "$define")
14634         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14635         case "$d_gethostent_r_proto:$usethreads" in
14636         ":define")      d_gethostent_r_proto=define
14637                 set d_gethostent_r_proto gethostent_r $hdrs
14638                 eval $hasproto ;;
14639         *)      ;;
14640         esac
14641         case "$d_gethostent_r_proto" in
14642         define)
14643         case "$gethostent_r_proto" in
14644         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14645         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14646         esac
14647         case "$gethostent_r_proto" in
14648         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14649         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14650         esac
14651         case "$gethostent_r_proto" in
14652         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14653         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14654         esac
14655         case "$gethostent_r_proto" in
14656         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14657         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14658         esac
14659         case "$gethostent_r_proto" in
14660         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14661         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14662         esac
14663         case "$gethostent_r_proto" in
14664         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14665         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14666         esac
14667         case "$gethostent_r_proto" in
14668         ''|0)   d_gethostent_r=undef
14669                 gethostent_r_proto=0
14670                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14671         * )     case "$gethostent_r_proto" in
14672                 REENTRANT_PROTO*) ;;
14673                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14674                 esac
14675                 echo "Prototype: $try" ;;
14676         esac
14677         ;;
14678         *)      case "$usethreads" in
14679                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14680                 esac
14681                 d_gethostent_r=undef
14682                 gethostent_r_proto=0
14683                 ;;
14684         esac
14685         ;;
14686 *)      gethostent_r_proto=0
14687         ;;
14688 esac
14689
14690 : see if prototypes for various gethostxxx netdb.h functions are available
14691 echo " "
14692 set d_gethostprotos gethostent $i_netdb netdb.h
14693 eval $hasproto
14694
14695 : see if getitimer exists
14696 set getitimer d_getitimer
14697 eval $inlibc
14698
14699 : see if getlogin exists
14700 set getlogin d_getlogin
14701 eval $inlibc
14702
14703 : see if getlogin_r exists
14704 set getlogin_r d_getlogin_r
14705 eval $inlibc
14706 case "$d_getlogin_r" in
14707 "$define")
14708         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14709         case "$d_getlogin_r_proto:$usethreads" in
14710         ":define")      d_getlogin_r_proto=define
14711                 set d_getlogin_r_proto getlogin_r $hdrs
14712                 eval $hasproto ;;
14713         *)      ;;
14714         esac
14715         case "$d_getlogin_r_proto" in
14716         define)
14717         case "$getlogin_r_proto" in
14718         ''|0) try='int getlogin_r(char*, size_t);'
14719         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14720         esac
14721         case "$getlogin_r_proto" in
14722         ''|0) try='int getlogin_r(char*, int);'
14723         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14724         esac
14725         case "$getlogin_r_proto" in
14726         ''|0) try='char* getlogin_r(char*, size_t);'
14727         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14728         esac
14729         case "$getlogin_r_proto" in
14730         ''|0) try='char* getlogin_r(char*, int);'
14731         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14732         esac
14733         case "$getlogin_r_proto" in
14734         ''|0)   d_getlogin_r=undef
14735                 getlogin_r_proto=0
14736                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14737         * )     case "$getlogin_r_proto" in
14738                 REENTRANT_PROTO*) ;;
14739                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14740                 esac
14741                 echo "Prototype: $try" ;;
14742         esac
14743         ;;
14744         *)      case "$usethreads" in
14745                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14746                 esac
14747                 d_getlogin_r=undef
14748                 getlogin_r_proto=0
14749                 ;;
14750         esac
14751         ;;
14752 *)      getlogin_r_proto=0
14753         ;;
14754 esac
14755
14756 : see if getmnt exists
14757 set getmnt d_getmnt
14758 eval $inlibc
14759
14760 : see if getmntent exists
14761 set getmntent d_getmntent
14762 eval $inlibc
14763
14764 : see if getnameinfo exists
14765 set getnameinfo d_getnameinfo
14766 eval $inlibc
14767
14768 : see if getnetbyaddr exists
14769 set getnetbyaddr d_getnbyaddr
14770 eval $inlibc
14771
14772 : see if getnetbyname exists
14773 set getnetbyname d_getnbyname
14774 eval $inlibc
14775
14776 : see if getnetent exists
14777 set getnetent d_getnent
14778 eval $inlibc
14779
14780 : see if getnetbyaddr_r exists
14781 set getnetbyaddr_r d_getnetbyaddr_r
14782 eval $inlibc
14783 case "$d_getnetbyaddr_r" in
14784 "$define")
14785         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14786         case "$d_getnetbyaddr_r_proto:$usethreads" in
14787         ":define")      d_getnetbyaddr_r_proto=define
14788                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14789                 eval $hasproto ;;
14790         *)      ;;
14791         esac
14792         case "$d_getnetbyaddr_r_proto" in
14793         define)
14794         case "$getnetbyaddr_r_proto" in
14795         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14796         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14797         esac
14798         case "$getnetbyaddr_r_proto" in
14799         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14800         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14801         esac
14802         case "$getnetbyaddr_r_proto" in
14803         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14804         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14805         esac
14806         case "$getnetbyaddr_r_proto" in
14807         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14808         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14809         esac
14810         case "$getnetbyaddr_r_proto" in
14811         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14812         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14813         esac
14814         case "$getnetbyaddr_r_proto" in
14815         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14816         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14817         esac
14818         case "$getnetbyaddr_r_proto" in
14819         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14820         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14821         esac
14822         case "$getnetbyaddr_r_proto" in
14823         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14824         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14825         esac
14826         case "$getnetbyaddr_r_proto" in
14827         ''|0)   d_getnetbyaddr_r=undef
14828                 getnetbyaddr_r_proto=0
14829                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14830         * )     case "$getnetbyaddr_r_proto" in
14831                 REENTRANT_PROTO*) ;;
14832                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14833                 esac
14834                 echo "Prototype: $try" ;;
14835         esac
14836         ;;
14837         *)      case "$usethreads" in
14838                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14839                 esac
14840                 d_getnetbyaddr_r=undef
14841                 getnetbyaddr_r_proto=0
14842                 ;;
14843         esac
14844         ;;
14845 *)      getnetbyaddr_r_proto=0
14846         ;;
14847 esac
14848
14849 : see if getnetbyname_r exists
14850 set getnetbyname_r d_getnetbyname_r
14851 eval $inlibc
14852 case "$d_getnetbyname_r" in
14853 "$define")
14854         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14855         case "$d_getnetbyname_r_proto:$usethreads" in
14856         ":define")      d_getnetbyname_r_proto=define
14857                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14858                 eval $hasproto ;;
14859         *)      ;;
14860         esac
14861         case "$d_getnetbyname_r_proto" in
14862         define)
14863         case "$getnetbyname_r_proto" in
14864         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14865         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14866         esac
14867         case "$getnetbyname_r_proto" in
14868         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14869         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14870         esac
14871         case "$getnetbyname_r_proto" in
14872         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14873         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14874         esac
14875         case "$getnetbyname_r_proto" in
14876         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14877         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14878         esac
14879         case "$getnetbyname_r_proto" in
14880         ''|0)   d_getnetbyname_r=undef
14881                 getnetbyname_r_proto=0
14882                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14883         * )     case "$getnetbyname_r_proto" in
14884                 REENTRANT_PROTO*) ;;
14885                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14886                 esac
14887                 echo "Prototype: $try" ;;
14888         esac
14889         ;;
14890         *)      case "$usethreads" in
14891                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14892                 esac
14893                 d_getnetbyname_r=undef
14894                 getnetbyname_r_proto=0
14895                 ;;
14896         esac
14897         ;;
14898 *)      getnetbyname_r_proto=0
14899         ;;
14900 esac
14901
14902 : see if getnetent_r exists
14903 set getnetent_r d_getnetent_r
14904 eval $inlibc
14905 case "$d_getnetent_r" in
14906 "$define")
14907         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14908         case "$d_getnetent_r_proto:$usethreads" in
14909         ":define")      d_getnetent_r_proto=define
14910                 set d_getnetent_r_proto getnetent_r $hdrs
14911                 eval $hasproto ;;
14912         *)      ;;
14913         esac
14914         case "$d_getnetent_r_proto" in
14915         define)
14916         case "$getnetent_r_proto" in
14917         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14918         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14919         esac
14920         case "$getnetent_r_proto" in
14921         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14922         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14923         esac
14924         case "$getnetent_r_proto" in
14925         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14926         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14927         esac
14928         case "$getnetent_r_proto" in
14929         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14930         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14931         esac
14932         case "$getnetent_r_proto" in
14933         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14934         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14935         esac
14936         case "$getnetent_r_proto" in
14937         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14938         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14939         esac
14940         case "$getnetent_r_proto" in
14941         ''|0)   d_getnetent_r=undef
14942                 getnetent_r_proto=0
14943                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14944         * )     case "$getnetent_r_proto" in
14945                 REENTRANT_PROTO*) ;;
14946                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14947                 esac
14948                 echo "Prototype: $try" ;;
14949         esac
14950         ;;
14951         *)      case "$usethreads" in
14952                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14953                 esac
14954                 d_getnetent_r=undef
14955                 getnetent_r_proto=0
14956                 ;;
14957         esac
14958         ;;
14959 *)      getnetent_r_proto=0
14960         ;;
14961 esac
14962
14963 : see if prototypes for various getnetxxx netdb.h functions are available
14964 echo " "
14965 set d_getnetprotos getnetent $i_netdb netdb.h
14966 eval $hasproto
14967
14968 : see if getpagesize exists
14969 set getpagesize d_getpagsz
14970 eval $inlibc
14971
14972 : Optional checks for getprotobyname and getprotobynumber
14973
14974 : see if getprotobyname exists
14975 set getprotobyname d_getpbyname
14976 eval $inlibc
14977
14978 : see if getprotobynumber exists
14979 set getprotobynumber d_getpbynumber
14980 eval $inlibc
14981
14982 : see if getprotoent exists
14983 set getprotoent d_getpent
14984 eval $inlibc
14985
14986 : see if getpgid exists
14987 set getpgid d_getpgid
14988 eval $inlibc
14989
14990 : see if getpgrp2 exists
14991 set getpgrp2 d_getpgrp2
14992 eval $inlibc
14993
14994 : see if getppid exists
14995 set getppid d_getppid
14996 eval $inlibc
14997
14998 : see if getpriority exists
14999 set getpriority d_getprior
15000 eval $inlibc
15001
15002 : see if getprotobyname_r exists
15003 set getprotobyname_r d_getprotobyname_r
15004 eval $inlibc
15005 case "$d_getprotobyname_r" in
15006 "$define")
15007         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15008         case "$d_getprotobyname_r_proto:$usethreads" in
15009         ":define")      d_getprotobyname_r_proto=define
15010                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
15011                 eval $hasproto ;;
15012         *)      ;;
15013         esac
15014         case "$d_getprotobyname_r_proto" in
15015         define)
15016         case "$getprotobyname_r_proto" in
15017         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15018         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15019         esac
15020         case "$getprotobyname_r_proto" in
15021         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15022         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15023         esac
15024         case "$getprotobyname_r_proto" in
15025         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15026         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15027         esac
15028         case "$getprotobyname_r_proto" in
15029         ''|0)   d_getprotobyname_r=undef
15030                 getprotobyname_r_proto=0
15031                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15032         * )     case "$getprotobyname_r_proto" in
15033                 REENTRANT_PROTO*) ;;
15034                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15035                 esac
15036                 echo "Prototype: $try" ;;
15037         esac
15038         ;;
15039         *)      case "$usethreads" in
15040                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15041                 esac
15042                 d_getprotobyname_r=undef
15043                 getprotobyname_r_proto=0
15044                 ;;
15045         esac
15046         ;;
15047 *)      getprotobyname_r_proto=0
15048         ;;
15049 esac
15050
15051 : see if getprotobynumber_r exists
15052 set getprotobynumber_r d_getprotobynumber_r
15053 eval $inlibc
15054 case "$d_getprotobynumber_r" in
15055 "$define")
15056         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15057         case "$d_getprotobynumber_r_proto:$usethreads" in
15058         ":define")      d_getprotobynumber_r_proto=define
15059                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15060                 eval $hasproto ;;
15061         *)      ;;
15062         esac
15063         case "$d_getprotobynumber_r_proto" in
15064         define)
15065         case "$getprotobynumber_r_proto" in
15066         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15067         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15068         esac
15069         case "$getprotobynumber_r_proto" in
15070         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15071         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15072         esac
15073         case "$getprotobynumber_r_proto" in
15074         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15075         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15076         esac
15077         case "$getprotobynumber_r_proto" in
15078         ''|0)   d_getprotobynumber_r=undef
15079                 getprotobynumber_r_proto=0
15080                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15081         * )     case "$getprotobynumber_r_proto" in
15082                 REENTRANT_PROTO*) ;;
15083                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15084                 esac
15085                 echo "Prototype: $try" ;;
15086         esac
15087         ;;
15088         *)      case "$usethreads" in
15089                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15090                 esac
15091                 d_getprotobynumber_r=undef
15092                 getprotobynumber_r_proto=0
15093                 ;;
15094         esac
15095         ;;
15096 *)      getprotobynumber_r_proto=0
15097         ;;
15098 esac
15099
15100 : see if getprotoent_r exists
15101 set getprotoent_r d_getprotoent_r
15102 eval $inlibc
15103 case "$d_getprotoent_r" in
15104 "$define")
15105         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15106         case "$d_getprotoent_r_proto:$usethreads" in
15107         ":define")      d_getprotoent_r_proto=define
15108                 set d_getprotoent_r_proto getprotoent_r $hdrs
15109                 eval $hasproto ;;
15110         *)      ;;
15111         esac
15112         case "$d_getprotoent_r_proto" in
15113         define)
15114         case "$getprotoent_r_proto" in
15115         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15116         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15117         esac
15118         case "$getprotoent_r_proto" in
15119         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15120         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15121         esac
15122         case "$getprotoent_r_proto" in
15123         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15124         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15125         esac
15126         case "$getprotoent_r_proto" in
15127         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15128         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15129         esac
15130         case "$getprotoent_r_proto" in
15131         ''|0)   d_getprotoent_r=undef
15132                 getprotoent_r_proto=0
15133                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15134         * )     case "$getprotoent_r_proto" in
15135                 REENTRANT_PROTO*) ;;
15136                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15137                 esac
15138                 echo "Prototype: $try" ;;
15139         esac
15140         ;;
15141         *)      case "$usethreads" in
15142                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15143                 esac
15144                 d_getprotoent_r=undef
15145                 getprotoent_r_proto=0
15146                 ;;
15147         esac
15148         ;;
15149 *)      getprotoent_r_proto=0
15150         ;;
15151 esac
15152
15153 : see if prototypes for various getprotoxxx netdb.h functions are available
15154 echo " "
15155 set d_getprotoprotos getprotoent $i_netdb netdb.h
15156 eval $hasproto
15157
15158 : see if getprpwnam exists
15159 set getprpwnam d_getprpwnam
15160 eval $inlibc
15161
15162 : see if getpwent exists
15163 set getpwent d_getpwent
15164 eval $inlibc
15165
15166 : see if getpwent_r exists
15167 set getpwent_r d_getpwent_r
15168 eval $inlibc
15169 case "$d_getpwent_r" in
15170 "$define")
15171         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15172         case "$d_getpwent_r_proto:$usethreads" in
15173         ":define")      d_getpwent_r_proto=define
15174                 set d_getpwent_r_proto getpwent_r $hdrs
15175                 eval $hasproto ;;
15176         *)      ;;
15177         esac
15178         case "$d_getpwent_r_proto" in
15179         define)
15180         case "$getpwent_r_proto" in
15181         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15182         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15183         esac
15184         case "$getpwent_r_proto" in
15185         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15186         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15187         esac
15188         case "$getpwent_r_proto" in
15189         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15190         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15191         esac
15192         case "$getpwent_r_proto" in
15193         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15194         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15195         esac
15196         case "$getpwent_r_proto" in
15197         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15198         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15199         esac
15200         case "$getpwent_r_proto" in
15201         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15202         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15203         esac
15204         case "$getpwent_r_proto" in
15205         ''|0)   d_getpwent_r=undef
15206                 getpwent_r_proto=0
15207                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15208         * )     case "$getpwent_r_proto" in
15209                 REENTRANT_PROTO*) ;;
15210                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15211                 esac
15212                 echo "Prototype: $try" ;;
15213         esac
15214         ;;
15215         *)      case "$usethreads" in
15216                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15217                 esac
15218                 d_getpwent_r=undef
15219                 getpwent_r_proto=0
15220                 ;;
15221         esac
15222         ;;
15223 *)      getpwent_r_proto=0
15224         ;;
15225 esac
15226
15227 : see if getpwnam_r exists
15228 set getpwnam_r d_getpwnam_r
15229 eval $inlibc
15230 case "$d_getpwnam_r" in
15231 "$define")
15232         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15233         case "$d_getpwnam_r_proto:$usethreads" in
15234         ":define")      d_getpwnam_r_proto=define
15235                 set d_getpwnam_r_proto getpwnam_r $hdrs
15236                 eval $hasproto ;;
15237         *)      ;;
15238         esac
15239         case "$d_getpwnam_r_proto" in
15240         define)
15241         case "$getpwnam_r_proto" in
15242         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15243         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15244         esac
15245         case "$getpwnam_r_proto" in
15246         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15247         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15248         esac
15249         case "$getpwnam_r_proto" in
15250         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15251         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15252         esac
15253         case "$getpwnam_r_proto" in
15254         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15255         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15256         esac
15257         case "$getpwnam_r_proto" in
15258         ''|0)   d_getpwnam_r=undef
15259                 getpwnam_r_proto=0
15260                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15261         * )     case "$getpwnam_r_proto" in
15262                 REENTRANT_PROTO*) ;;
15263                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15264                 esac
15265                 echo "Prototype: $try" ;;
15266         esac
15267         ;;
15268         *)      case "$usethreads" in
15269                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15270                 esac
15271                 d_getpwnam_r=undef
15272                 getpwnam_r_proto=0
15273                 ;;
15274         esac
15275         ;;
15276 *)      getpwnam_r_proto=0
15277         ;;
15278 esac
15279
15280 : see if getpwuid_r exists
15281 set getpwuid_r d_getpwuid_r
15282 eval $inlibc
15283 case "$d_getpwuid_r" in
15284 "$define")
15285         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15286         case "$d_getpwuid_r_proto:$usethreads" in
15287         ":define")      d_getpwuid_r_proto=define
15288                 set d_getpwuid_r_proto getpwuid_r $hdrs
15289                 eval $hasproto ;;
15290         *)      ;;
15291         esac
15292         case "$d_getpwuid_r_proto" in
15293         define)
15294         case "$getpwuid_r_proto" in
15295         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15296         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15297         esac
15298         case "$getpwuid_r_proto" in
15299         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15300         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15301         esac
15302         case "$getpwuid_r_proto" in
15303         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15304         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15305         esac
15306         case "$getpwuid_r_proto" in
15307         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15308         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15309         esac
15310         case "$getpwuid_r_proto" in
15311         ''|0)   d_getpwuid_r=undef
15312                 getpwuid_r_proto=0
15313                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15314         * )     case "$getpwuid_r_proto" in
15315                 REENTRANT_PROTO*) ;;
15316                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15317                 esac
15318                 echo "Prototype: $try" ;;
15319         esac
15320         ;;
15321         *)      case "$usethreads" in
15322                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15323                 esac
15324                 d_getpwuid_r=undef
15325                 getpwuid_r_proto=0
15326                 ;;
15327         esac
15328         ;;
15329 *)      getpwuid_r_proto=0
15330         ;;
15331 esac
15332
15333 : Optional checks for getsbyname and getsbyport
15334
15335 : see if getservbyname exists
15336 set getservbyname d_getsbyname
15337 eval $inlibc
15338
15339 : see if getservbyport exists
15340 set getservbyport d_getsbyport
15341 eval $inlibc
15342
15343 : see if getservent exists
15344 set getservent d_getsent
15345 eval $inlibc
15346
15347 : see if getservbyname_r exists
15348 set getservbyname_r d_getservbyname_r
15349 eval $inlibc
15350 case "$d_getservbyname_r" in
15351 "$define")
15352         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15353         case "$d_getservbyname_r_proto:$usethreads" in
15354         ":define")      d_getservbyname_r_proto=define
15355                 set d_getservbyname_r_proto getservbyname_r $hdrs
15356                 eval $hasproto ;;
15357         *)      ;;
15358         esac
15359         case "$d_getservbyname_r_proto" in
15360         define)
15361         case "$getservbyname_r_proto" in
15362         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15363         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15364         esac
15365         case "$getservbyname_r_proto" in
15366         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15367         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15368         esac
15369         case "$getservbyname_r_proto" in
15370         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15371         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15372         esac
15373         case "$getservbyname_r_proto" in
15374         ''|0)   d_getservbyname_r=undef
15375                 getservbyname_r_proto=0
15376                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15377         * )     case "$getservbyname_r_proto" in
15378                 REENTRANT_PROTO*) ;;
15379                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15380                 esac
15381                 echo "Prototype: $try" ;;
15382         esac
15383         ;;
15384         *)      case "$usethreads" in
15385                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15386                 esac
15387                 d_getservbyname_r=undef
15388                 getservbyname_r_proto=0
15389                 ;;
15390         esac
15391         ;;
15392 *)      getservbyname_r_proto=0
15393         ;;
15394 esac
15395
15396 : see if getservbyport_r exists
15397 set getservbyport_r d_getservbyport_r
15398 eval $inlibc
15399 case "$d_getservbyport_r" in
15400 "$define")
15401         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15402         case "$d_getservbyport_r_proto:$usethreads" in
15403         ":define")      d_getservbyport_r_proto=define
15404                 set d_getservbyport_r_proto getservbyport_r $hdrs
15405                 eval $hasproto ;;
15406         *)      ;;
15407         esac
15408         case "$d_getservbyport_r_proto" in
15409         define)
15410         case "$getservbyport_r_proto" in
15411         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15412         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15413         esac
15414         case "$getservbyport_r_proto" in
15415         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15416         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15417         esac
15418         case "$getservbyport_r_proto" in
15419         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15420         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15421         esac
15422         case "$getservbyport_r_proto" in
15423         ''|0)   d_getservbyport_r=undef
15424                 getservbyport_r_proto=0
15425                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15426         * )     case "$getservbyport_r_proto" in
15427                 REENTRANT_PROTO*) ;;
15428                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15429                 esac
15430                 echo "Prototype: $try" ;;
15431         esac
15432         ;;
15433         *)      case "$usethreads" in
15434                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15435                 esac
15436                 d_getservbyport_r=undef
15437                 getservbyport_r_proto=0
15438                 ;;
15439         esac
15440         ;;
15441 *)      getservbyport_r_proto=0
15442         ;;
15443 esac
15444
15445 : see if getservent_r exists
15446 set getservent_r d_getservent_r
15447 eval $inlibc
15448 case "$d_getservent_r" in
15449 "$define")
15450         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15451         case "$d_getservent_r_proto:$usethreads" in
15452         ":define")      d_getservent_r_proto=define
15453                 set d_getservent_r_proto getservent_r $hdrs
15454                 eval $hasproto ;;
15455         *)      ;;
15456         esac
15457         case "$d_getservent_r_proto" in
15458         define)
15459         case "$getservent_r_proto" in
15460         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15461         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15462         esac
15463         case "$getservent_r_proto" in
15464         ''|0) try='int getservent_r(struct servent*, char*, int);'
15465         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15466         esac
15467         case "$getservent_r_proto" in
15468         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15469         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15470         esac
15471         case "$getservent_r_proto" in
15472         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15473         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15474         esac
15475         case "$getservent_r_proto" in
15476         ''|0)   d_getservent_r=undef
15477                 getservent_r_proto=0
15478                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15479         * )     case "$getservent_r_proto" in
15480                 REENTRANT_PROTO*) ;;
15481                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15482                 esac
15483                 echo "Prototype: $try" ;;
15484         esac
15485         ;;
15486         *)      case "$usethreads" in
15487                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15488                 esac
15489                 d_getservent_r=undef
15490                 getservent_r_proto=0
15491                 ;;
15492         esac
15493         ;;
15494 *)      getservent_r_proto=0
15495         ;;
15496 esac
15497
15498 : see if prototypes for various getservxxx netdb.h functions are available
15499 echo " "
15500 set d_getservprotos getservent $i_netdb netdb.h
15501 eval $hasproto
15502
15503 : see if getspnam exists
15504 set getspnam d_getspnam
15505 eval $inlibc
15506
15507 : see if this is a shadow.h system
15508 set shadow.h i_shadow
15509 eval $inhdr
15510
15511 : see if getspnam_r exists
15512 set getspnam_r d_getspnam_r
15513 eval $inlibc
15514 case "$d_getspnam_r" in
15515 "$define")
15516         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15517         case "$d_getspnam_r_proto:$usethreads" in
15518         ":define")      d_getspnam_r_proto=define
15519                 set d_getspnam_r_proto getspnam_r $hdrs
15520                 eval $hasproto ;;
15521         *)      ;;
15522         esac
15523         case "$d_getspnam_r_proto" in
15524         define)
15525         case "$getspnam_r_proto" in
15526         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15527         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15528         esac
15529         case "$getspnam_r_proto" in
15530         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15531         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15532         esac
15533         case "$getspnam_r_proto" in
15534         ''|0)   d_getspnam_r=undef
15535                 getspnam_r_proto=0
15536                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15537         * )     case "$getspnam_r_proto" in
15538                 REENTRANT_PROTO*) ;;
15539                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15540                 esac
15541                 echo "Prototype: $try" ;;
15542         esac
15543         ;;
15544         *)      case "$usethreads" in
15545                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15546                 esac
15547                 d_getspnam_r=undef
15548                 getspnam_r_proto=0
15549                 ;;
15550         esac
15551         ;;
15552 *)      getspnam_r_proto=0
15553         ;;
15554 esac
15555
15556 : see if gettimeofday or ftime exists
15557 set gettimeofday d_gettimeod
15558 eval $inlibc
15559 case "$d_gettimeod" in
15560 "$undef")
15561         set ftime d_ftime 
15562         eval $inlibc
15563         ;;
15564 *)
15565         val="$undef"; set d_ftime; eval $setvar
15566         ;;
15567 esac
15568 case "$d_gettimeod$d_ftime" in
15569 "$undef$undef")
15570         echo " "
15571         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15572         ;;
15573 esac
15574
15575 : see if gmtime_r exists
15576 set gmtime_r d_gmtime_r
15577 eval $inlibc
15578 case "$d_gmtime_r" in
15579 "$define")
15580         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15581         case "$d_gmtime_r_proto:$usethreads" in
15582         ":define")      d_gmtime_r_proto=define
15583                 set d_gmtime_r_proto gmtime_r $hdrs
15584                 eval $hasproto ;;
15585         *)      ;;
15586         esac
15587         case "$d_gmtime_r_proto" in
15588         define)
15589         case "$gmtime_r_proto" in
15590         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15591         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15592         esac
15593         case "$gmtime_r_proto" in
15594         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15595         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15596         esac
15597         case "$gmtime_r_proto" in
15598         ''|0)   d_gmtime_r=undef
15599                 gmtime_r_proto=0
15600                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15601         * )     case "$gmtime_r_proto" in
15602                 REENTRANT_PROTO*) ;;
15603                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15604                 esac
15605                 echo "Prototype: $try" ;;
15606         esac
15607         ;;
15608         *)      case "$usethreads" in
15609                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15610                 esac
15611                 d_gmtime_r=undef
15612                 gmtime_r_proto=0
15613                 ;;
15614         esac
15615         ;;
15616 *)      gmtime_r_proto=0
15617         ;;
15618 esac
15619
15620 : see if hasmntopt exists
15621 set hasmntopt d_hasmntopt
15622 eval $inlibc
15623
15624 : see if this is a netinet/in.h or sys/in.h system
15625 set netinet/in.h i_niin sys/in.h i_sysin
15626 eval $inhdr
15627
15628 : see if arpa/inet.h has to be included
15629 set arpa/inet.h i_arpainet
15630 eval $inhdr
15631
15632 : see if htonl --and friends-- exists
15633 val=''
15634 set htonl val
15635 eval $inlibc
15636
15637 : Maybe they are macros.
15638 case "$val" in
15639 $undef)
15640         $cat >htonl.c <<EOM
15641 #include <stdio.h>
15642 #include <sys/types.h>
15643 #$i_niin I_NETINET_IN
15644 #$i_sysin I_SYS_IN
15645 #$i_arpainet I_ARPA_INET
15646 #ifdef I_NETINET_IN
15647 #include <netinet/in.h>
15648 #endif
15649 #ifdef I_SYS_IN
15650 #include <sys/in.h>
15651 #endif
15652 #ifdef I_ARPA_INET
15653 #include <arpa/inet.h>
15654 #endif
15655 #ifdef htonl
15656 printf("Defined as a macro.");
15657 #endif
15658 EOM
15659         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15660         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15661                 val="$define"
15662                 echo "But it seems to be defined as a macro." >&4
15663         fi
15664         $rm -f htonl.?
15665         ;;
15666 esac
15667 set d_htonl
15668 eval $setvar
15669
15670 : see if hypot exists
15671 set hypot d_hypot
15672 eval $inlibc
15673
15674 : see if ilogb exists
15675 set ilogb d_ilogb
15676 eval $inlibc
15677
15678 : see if ilogbl exists
15679 set ilogbl d_ilogbl
15680 eval $inlibc
15681
15682 : index or strchr
15683 echo " "
15684 if set index val -f; eval $csym; $val; then
15685         if set strchr val -f d_strchr; eval $csym; $val; then
15686                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15687                         val="$define"
15688                         vali="$undef"
15689                         echo "strchr() found." >&4
15690                 else
15691                         val="$undef"
15692                         vali="$define"
15693                         echo "index() found." >&4
15694                 fi
15695         else
15696                 val="$undef"
15697                 vali="$define"
15698                 echo "index() found." >&4
15699         fi
15700 else
15701         if set strchr val -f d_strchr; eval $csym; $val; then
15702                 val="$define"
15703                 vali="$undef"
15704                 echo "strchr() found." >&4
15705         else
15706                 echo "No index() or strchr() found!" >&4
15707                 val="$undef"
15708                 vali="$undef"
15709         fi
15710 fi
15711 set d_strchr; eval $setvar
15712 val="$vali"
15713 set d_index; eval $setvar
15714
15715 : check whether inet_aton exists
15716 set inet_aton d_inetaton
15717 eval $inlibc
15718
15719 : see if inet_ntop exists
15720 set inet_ntop d_inetntop
15721 eval $inlibc
15722
15723 : see if inet_pton exists
15724 set inet_pton d_inetpton
15725 eval $inlibc
15726
15727 : Look for isascii
15728 echo " "
15729 $cat >isascii.c <<EOCP
15730 #include <stdio.h>
15731 #include <ctype.h>
15732 #$i_stdlib I_STDLIB
15733 #ifdef I_STDLIB
15734 #include <stdlib.h>
15735 #endif
15736 int main() {
15737         int c = 'A';
15738         if (isascii(c))
15739                 exit(0);
15740         else
15741                 exit(1);
15742 }
15743 EOCP
15744 set isascii
15745 if eval $compile; then
15746         echo "isascii() found." >&4
15747         val="$define"
15748 else
15749         echo "isascii() NOT found." >&4
15750         val="$undef"
15751 fi
15752 set d_isascii
15753 eval $setvar
15754 $rm -f isascii*
15755
15756 : Look for isblank
15757 echo " "
15758 $cat >isblank.c <<'EOCP'
15759 #include <stdio.h>
15760 #include <ctype.h>
15761 int main() {
15762         int c = ' ';
15763         if (isblank(c))
15764                 return 0 ;
15765         else
15766                 return 1 ;
15767 }
15768 EOCP
15769 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15770         echo "isblank() found." >&4
15771         val="$define"
15772 else
15773         echo "isblank() NOT found." >&4
15774         val="$undef"
15775 fi
15776 set d_isblank
15777 eval $setvar
15778 $rm -f isblank*
15779
15780 : check for isfinite
15781 echo "Checking to see if you have isfinite..." >&4
15782 $cat >try.c <<EOCP
15783 #$i_math I_MATH
15784 #ifdef I_MATH
15785 #include <math.h>
15786 #endif
15787 int main() { return isfinite(0.0); }
15788 EOCP
15789 set try
15790 if eval $compile; then
15791         val="$define"
15792         echo "You have isfinite."
15793 else
15794         val="$undef"
15795         echo "You do not have isfinite."
15796 fi
15797 $rm_try
15798 set d_isfinite
15799 eval $setvar
15800
15801 : see if isfinitel exists
15802 set isfinitel d_isfinitel
15803 eval $inlibc
15804
15805 : check for isinf
15806 echo "Checking to see if you have isinf..." >&4
15807 $cat >try.c <<EOCP
15808 #$i_math I_MATH
15809 #ifdef I_MATH
15810 #include <math.h>
15811 #endif
15812 int main() { return isinf(0.0); }
15813 EOCP
15814 set try
15815 if eval $compile; then
15816         val="$define"
15817         echo "You have isinf."
15818 else
15819         val="$undef"
15820         echo "You do not have isinf."
15821 fi
15822 $rm_try
15823 set d_isinf
15824 eval $setvar
15825
15826 : see if isinfl exists
15827 set isinfl d_isinfl
15828 eval $inlibc
15829
15830 : check for isless
15831 echo "Checking to see if you have isless..." >&4
15832 $cat >try.c <<EOCP
15833 #$i_math I_MATH
15834 #ifdef I_MATH
15835 #include <math.h>
15836 #endif
15837 int main() { return isless(0.0); }
15838 EOCP
15839 set try
15840 if eval $compile; then
15841         val="$define"
15842         echo "You have isless."
15843 else
15844         val="$undef"
15845         echo "You do not have isless."
15846 fi
15847 $rm_try
15848 set d_isless
15849 eval $setvar
15850
15851 : check for isnan
15852 echo "Checking to see if you have isnan..." >&4
15853 $cat >try.c <<EOCP
15854 #$i_math I_MATH
15855 #ifdef I_MATH
15856 #include <math.h>
15857 #endif
15858 int main() { return isnan(0.0); }
15859 EOCP
15860 set try
15861 if eval $compile; then
15862         val="$define"
15863         echo "You have isnan."
15864 else
15865         val="$undef"
15866         echo "You do not have isnan."
15867 fi
15868 $rm_try
15869 set d_isnan
15870 eval $setvar
15871
15872 : see if isnanl exists
15873 set isnanl d_isnanl
15874 eval $inlibc
15875
15876 : check for isnormal
15877 echo "Checking to see if you have isnormal..." >&4
15878 $cat >try.c <<EOCP
15879 #$i_math I_MATH
15880 #ifdef I_MATH
15881 #include <math.h>
15882 #endif
15883 int main() { return isnormal(0.0); }
15884 EOCP
15885 set try
15886 if eval $compile; then
15887         val="$define"
15888         echo "You have isnormal."
15889 else
15890         val="$undef"
15891         echo "You do not have isnormal."
15892 fi
15893 $rm_try
15894 set d_isnormal
15895 eval $setvar
15896
15897 : see if j0 exists
15898 set j0 d_j0
15899 eval $inlibc
15900
15901 : see if j0l exists
15902 set j0l d_j0l
15903 eval $inlibc
15904
15905 : see if killpg exists
15906 set killpg d_killpg
15907 eval $inlibc
15908
15909 : see if localeconv exists
15910 set localeconv d_locconv
15911 eval $inlibc
15912
15913 : see if libc has the POSIX.1-2008 currency locale rules
15914 case "$d_locconv:$d_lc_monetary_2008" in
15915 $define:)
15916         $cat >try.c <<EOCP
15917 #include <locale.h>
15918 int main() {
15919         struct lconv *lc = localeconv();
15920         char int_p_cs_precedes = lc->int_p_cs_precedes;
15921         return 0;
15922 }
15923 EOCP
15924         set try
15925         if eval $compile; then
15926                 d_lc_monetary_2008="$define"
15927         else
15928                 d_lc_monetary_2008="$undef"
15929         fi;
15930         $rm_try
15931         ;;
15932 esac
15933
15934 : see if lchown exists
15935 echo " "
15936 $cat > try.c <<'EOCP'
15937 /* System header to define __stub macros and hopefully few prototypes,
15938     which can conflict with char lchown(); below.  */
15939 #include <assert.h>
15940 /* Override any gcc2 internal prototype to avoid an error.  */
15941 /* We use char because int might match the return type of a gcc2
15942    builtin and then its argument prototype would still apply.  */
15943 char lchown();
15944 int main() {
15945     /*  The GNU C library defines this for functions which it implements
15946         to always fail with ENOSYS.  Some functions are actually named
15947         something starting with __ and the normal name is an alias.  */
15948 #if defined (__stub_lchown) || defined (__stub___lchown)
15949 choke me
15950 #else
15951 lchown();
15952 #endif
15953 ; return 0; }
15954 EOCP
15955 set try
15956 if eval $compile; then
15957     $echo "lchown() found." >&4
15958     val="$define"
15959 else
15960     $echo "lchown() NOT found." >&4
15961     val="$undef"
15962 fi
15963 set d_lchown
15964 eval $setvar
15965
15966 : See if number of significant digits in a double precision number is known
15967 echo " "
15968 $cat >ldbl_dig.c <<EOM
15969 #$i_limits I_LIMITS
15970 #$i_float I_FLOAT
15971 #ifdef I_LIMITS
15972 #include <limits.h>
15973 #endif
15974 #ifdef I_FLOAT
15975 #include <float.h>
15976 #endif
15977 #ifdef LDBL_DIG
15978 printf("Contains LDBL_DIG");
15979 #endif
15980 EOM
15981 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15982 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15983         echo "LDBL_DIG found." >&4
15984         val="$define"
15985 else
15986         echo "LDBL_DIG NOT found." >&4
15987         val="$undef"
15988 fi
15989 $rm -f ldbl_dig.?
15990 set d_ldbl_dig
15991 eval $setvar
15992
15993 : see if lgamma exists
15994 set lgamma d_lgamma
15995 eval $inlibc
15996
15997 : see if lgamma_r exists
15998 set lgamma_r d_lgamma_r
15999 eval $inlibc
16000
16001 : check to see if math.h defines _LIB_VERSION
16002 d_libm_lib_version="$undef"
16003 case $i_math in
16004     $define)
16005         echo " "
16006         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
16007         $cat >try.c <<EOCP
16008 #include <unistd.h>
16009 #include <math.h>
16010 int main (int argc, char *argv[])
16011 {
16012     printf ("%d\n", _LIB_VERSION);
16013     return (0);
16014     } /* main */
16015 EOCP
16016         set try
16017         if eval $compile; then
16018             foo=`$run ./try`
16019             echo "Yes, it does ($foo)" >&4
16020             d_libm_lib_version="$define"
16021         else
16022             echo "No, it does not (probably harmless)" >&4
16023             fi
16024         $rm_try
16025         ;;
16026
16027     esac
16028
16029 : see if link exists
16030 set link d_link
16031 eval $inlibc
16032
16033 : see if llrint exists
16034 set llrint d_llrint
16035 eval $inlibc
16036
16037 : see if llrintl exists
16038 set llrintl d_llrintl
16039 eval $inlibc
16040
16041 : see if llround exists
16042 set llround d_llround
16043 eval $inlibc
16044
16045 : see if llroundl exists
16046 set llroundl d_llroundl
16047 eval $inlibc
16048
16049 : see if localtime_r exists
16050 set localtime_r d_localtime_r
16051 eval $inlibc
16052 case "$d_localtime_r" in
16053 "$define")
16054         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16055         case "$d_localtime_r_proto:$usethreads" in
16056         ":define")      d_localtime_r_proto=define
16057                 set d_localtime_r_proto localtime_r $hdrs
16058                 eval $hasproto ;;
16059         *)      ;;
16060         esac
16061         case "$d_localtime_r_proto" in
16062         define)
16063         case "$localtime_r_proto" in
16064         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16065         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16066         esac
16067         case "$localtime_r_proto" in
16068         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16069         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16070         esac
16071         case "$localtime_r_proto" in
16072         ''|0)   d_localtime_r=undef
16073                 localtime_r_proto=0
16074                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16075         * )     case "$localtime_r_proto" in
16076                 REENTRANT_PROTO*) ;;
16077                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16078                 esac
16079                 echo "Prototype: $try" ;;
16080         esac
16081         ;;
16082         *)      case "$usethreads" in
16083                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16084                 esac
16085                 d_localtime_r=undef
16086                 localtime_r_proto=0
16087                 ;;
16088         esac
16089         ;;
16090 *)      localtime_r_proto=0
16091         ;;
16092 esac
16093
16094 : see if localtime_r calls tzset
16095 case "$localtime_r_proto" in
16096 REENTRANT_PROTO*)
16097         $cat >try.c <<EOCP
16098 /*  Does our libc's localtime_r call tzset ?
16099  *  return 0 if so, 1 otherwise.
16100  */
16101 #$i_systypes    I_SYS_TYPES
16102 #$i_unistd      I_UNISTD
16103 #$i_time        I_TIME
16104 #$i_stdlib      I_STDLIB
16105 #$i_string      I_STRING
16106 #$i_malloc      I_MALLOC
16107 #ifdef I_SYS_TYPES
16108 #  include <sys/types.h>
16109 #endif
16110 #ifdef I_UNISTD
16111 #  include <unistd.h>
16112 #endif
16113 #ifdef I_TIME
16114 #  include <time.h>
16115 #endif
16116 #ifdef I_STDLIB
16117 #include <stdlib.h>
16118 #endif
16119 #ifdef I_STRING
16120 #  include <string.h>
16121 #else
16122 #  include <strings.h>
16123 #endif
16124 #ifdef I_MALLOC
16125 #  include <malloc.h>
16126 #endif
16127 int main()
16128 {
16129     time_t t = time(0L);
16130     char w_tz[]="TZ" "=GMT+5",
16131          e_tz[]="TZ" "=GMT-5",
16132         *tz_e = (char*)malloc(16),
16133         *tz_w = (char*)malloc(16);
16134     struct tm tm_e, tm_w;
16135     memset(&tm_e,'\0',sizeof(struct tm));
16136     memset(&tm_w,'\0',sizeof(struct tm));
16137     strcpy(tz_e,e_tz);
16138     strcpy(tz_w,w_tz);
16139
16140     putenv(tz_e);
16141     localtime_r(&t, &tm_e);
16142
16143     putenv(tz_w);
16144     localtime_r(&t, &tm_w);
16145
16146     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16147         return 1;
16148     return 0;
16149 }
16150 EOCP
16151         set try
16152         if eval $compile; then
16153             if $run ./try; then
16154                 d_localtime_r_needs_tzset=undef;
16155             else
16156                 d_localtime_r_needs_tzset=define;
16157             fi;
16158         else
16159             d_localtime_r_needs_tzset=undef;
16160         fi;
16161      ;;
16162   *)
16163      d_localtime_r_needs_tzset=undef;
16164      ;;
16165 esac
16166 $rm_try
16167
16168 : see if lockf exists
16169 set lockf d_lockf
16170 eval $inlibc
16171
16172 : see if log1p exists
16173 set log1p d_log1p
16174 eval $inlibc
16175
16176 : see if log2 exists
16177 set log2 d_log2
16178 eval $inlibc
16179
16180 : see if logb exists
16181 set logb d_logb
16182 eval $inlibc
16183
16184 : see if lrint exists
16185 set lrint d_lrint
16186 eval $inlibc
16187
16188 : see if lrintl exists
16189 set lrintl d_lrintl
16190 eval $inlibc
16191
16192 : see if lround exists
16193 set lround d_lround
16194 eval $inlibc
16195
16196 : see if lroundl exists
16197 set lroundl d_lroundl
16198 eval $inlibc
16199
16200 : see if prototype for lseek is available
16201 echo " "
16202 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16203 eval $hasproto
16204
16205 : see if lstat exists
16206 set lstat d_lstat
16207 eval $inlibc
16208
16209 : see if madvise exists
16210 set madvise d_madvise
16211 eval $inlibc
16212
16213 : see if malloc_size exists
16214 set malloc_size d_malloc_size
16215 eval $inlibc
16216
16217 : see if malloc_size_good exists
16218 set malloc_good_size d_malloc_good_size
16219 eval $inlibc
16220
16221 : see if mblen exists
16222 set mblen d_mblen
16223 eval $inlibc
16224
16225 : see if mbstowcs exists
16226 set mbstowcs d_mbstowcs
16227 eval $inlibc
16228
16229 : see if mbtowc exists
16230 set mbtowc d_mbtowc
16231 eval $inlibc
16232
16233 : see if memchr exists
16234 set memchr d_memchr
16235 eval $inlibc
16236
16237 : see if memcmp exists
16238 set memcmp d_memcmp
16239 eval $inlibc
16240
16241 : see if memcpy exists
16242 set memcpy d_memcpy
16243 eval $inlibc
16244
16245 : see if memmove exists
16246 set memmove d_memmove
16247 eval $inlibc
16248
16249 : see if memset exists
16250 set memset d_memset
16251 eval $inlibc
16252
16253 : see if mkdir exists
16254 set mkdir d_mkdir
16255 eval $inlibc
16256
16257 : see if mkdtemp exists
16258 set mkdtemp d_mkdtemp
16259 eval $inlibc
16260
16261 : see if mkfifo exists
16262 set mkfifo d_mkfifo
16263 eval $inlibc
16264
16265 : see if mkstemp exists
16266 set mkstemp d_mkstemp
16267 eval $inlibc
16268
16269 : see if mkstemps exists
16270 set mkstemps d_mkstemps
16271 eval $inlibc
16272
16273 : see if mktime exists
16274 set mktime d_mktime
16275 eval $inlibc
16276
16277 : see if this is a sys/mman.h system
16278 set sys/mman.h i_sysmman
16279 eval $inhdr
16280
16281 : see if mmap exists
16282 set mmap d_mmap
16283 eval $inlibc
16284 : see what shmat returns
16285 : default to something harmless
16286 mmaptype='void *'
16287 case "$i_sysmman$d_mmap" in
16288 "$define$define")
16289         $cat >mmap.c <<'END'
16290 #include <sys/mman.h>
16291 void *mmap();
16292 END
16293         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16294                 mmaptype='void *'
16295         else
16296                 mmaptype='caddr_t'
16297         fi
16298         echo "and it returns ($mmaptype)." >&4
16299         ;;
16300 esac
16301
16302
16303
16304 : see if sqrtl exists
16305 set sqrtl d_sqrtl
16306 eval $inlibc
16307
16308 : see if scalbnl exists
16309 set scalbnl d_scalbnl
16310 eval $inlibc
16311
16312 : see if truncl exists
16313 set truncl d_truncl
16314 eval $inlibc
16315
16316 : see if modfl exists
16317 set modfl d_modfl
16318 eval $inlibc
16319
16320 : see if prototype for modfl is available
16321 echo " "
16322 set d_modflproto modfl $i_math math.h
16323 eval $hasproto
16324
16325 d_modfl_pow32_bug="$undef"
16326
16327 case "$d_longdbl$d_modfl" in
16328 $define$define)
16329         $cat <<EOM
16330 Checking to see whether your modfl() is okay for large values...
16331 EOM
16332 $cat >try.c <<EOCP
16333 #include <math.h>
16334 #include <stdio.h>
16335 EOCP
16336 if $test "X$d_modflproto" != "X$define"; then
16337         $cat >>try.c <<EOCP
16338 /* Sigh. many current glibcs provide the function, but do not prototype it. */
16339 long double modfl (long double, long double *);
16340 EOCP
16341 fi
16342 $cat >>try.c <<EOCP
16343 int main() {
16344     long double nv = 4294967303.15;
16345     long double v, w;
16346     v = modfl(nv, &w);
16347 #ifdef __GLIBC__
16348     printf("glibc");
16349 #endif
16350     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
16351     return 0;
16352 }
16353 EOCP
16354         case "$osname:$gccversion" in
16355         aix:)   saveccflags="$ccflags"
16356                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
16357         esac
16358         set try
16359         if eval $compile; then
16360                 foo=`$run ./try`
16361                 case "$foo" in
16362                 *" 4294967303.150000 1.150000 4294967302.000000")
16363                         echo >&4 "Your modfl() is broken for large values."
16364                         d_modfl_pow32_bug="$define"
16365                         case "$foo" in
16366                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
16367                         ;;
16368                         esac
16369                         ;;
16370                 *" 4294967303.150000 0.150000 4294967303.000000")
16371                         echo >&4 "Your modfl() seems okay for large values."
16372                         ;;
16373                 *)      echo >&4 "I don't understand your modfl() at all."
16374                         d_modfl="$undef"
16375                         ;;
16376                 esac
16377                 $rm_try
16378         else
16379                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
16380                 d_modfl="$undef"
16381         fi
16382         case "$osname:$gccversion" in
16383         aix:)   ccflags="$saveccflags" ;; # restore
16384         esac
16385         ;;
16386 esac
16387
16388 if $test "$uselongdouble" = "$define"; then
16389     message=""
16390     if $test "$d_sqrtl" != "$define"; then
16391         message="$message sqrtl"
16392     fi
16393     if $test "$d_modfl" != "$define"; then
16394         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16395             echo "You have both truncl and copysignl, so I can emulate modfl."
16396         else
16397             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16398                 echo "You have both aintl and copysignl, so I can emulate modfl."
16399             else
16400                 message="$message modfl"
16401             fi
16402         fi
16403     fi
16404     if $test "$d_frexpl" != "$define"; then
16405         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16406             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16407         else
16408             message="$message frexpl"
16409         fi
16410     fi
16411     if $test "$d_ldexpl" != "$define"; then
16412         message="$message ldexpl"
16413     fi
16414
16415     if $test "$message" != ""; then
16416         $cat <<EOM >&4
16417
16418 *** You requested the use of long doubles but you do not seem to have
16419 *** the following mathematical functions needed for long double support:
16420 ***    $message
16421 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16422 *** Cannot continue, aborting.
16423
16424 EOM
16425
16426         exit 1
16427     fi
16428 fi
16429
16430 : see if mprotect exists
16431 set mprotect d_mprotect
16432 eval $inlibc
16433
16434 : see if msgctl exists
16435 set msgctl d_msgctl
16436 eval $inlibc
16437
16438 : see if msgget exists
16439 set msgget d_msgget
16440 eval $inlibc
16441
16442 : see if msgsnd exists
16443 set msgsnd d_msgsnd
16444 eval $inlibc
16445
16446 : see if msgrcv exists
16447 set msgrcv d_msgrcv
16448 eval $inlibc
16449
16450 : see how much of the 'msg*(2)' library is present.
16451 h_msg=true
16452 echo " "
16453 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16454 *"$undef"*) h_msg=false;;
16455 esac
16456 case "$osname" in
16457 freebsd)
16458     case "`ipcs 2>&1`" in
16459     "SVID messages"*"not configured"*)
16460         echo "Your $osname does not have the msg*(2) configured." >&4
16461         h_msg=false
16462         val="$undef"
16463         set msgctl d_msgctl
16464         eval $setvar
16465         set msgget d_msgget
16466         eval $setvar
16467         set msgsnd d_msgsnd
16468         eval $setvar
16469         set msgrcv d_msgrcv
16470         eval $setvar
16471         ;;
16472     esac
16473     ;;
16474 esac
16475 : we could also check for sys/ipc.h ...
16476 if $h_msg && $test `./findhdr sys/msg.h`; then
16477         echo "You have the full msg*(2) library." >&4
16478         val="$define"
16479 else
16480         echo "You don't have the full msg*(2) library." >&4
16481         val="$undef"
16482 fi
16483 set d_msg
16484 eval $setvar
16485
16486 : Check for msghdr_s
16487 echo " "
16488 echo "Checking to see if your system supports struct msghdr..." >&4
16489 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16490 eval $hasstruct
16491 case "$d_msghdr_s" in
16492 "$define")      echo "Yes, it does."   ;;
16493 *)              echo "No, it doesn't." ;;
16494 esac
16495
16496
16497 : see if msync exists
16498 set msync d_msync
16499 eval $inlibc
16500
16501 : see if munmap exists
16502 set munmap d_munmap
16503 eval $inlibc
16504
16505 : see if nan exists
16506 set nan d_nan
16507 eval $inlibc
16508
16509 : see if nearbyint exists
16510 set nearbyint d_nearbyint
16511 eval $inlibc
16512
16513 : see if nextafter exists
16514 set nextafter d_nextafter
16515 eval $inlibc
16516
16517 : see if nexttoward exists
16518 set nexttoward d_nexttoward
16519 eval $inlibc
16520
16521 : see if nice exists
16522 set nice d_nice
16523 eval $inlibc
16524
16525 : see if this is a langinfo.h system
16526 set langinfo.h i_langinfo
16527 eval $inhdr
16528
16529 : see if nl_langinfo exists
16530 set nl_langinfo d_nl_langinfo
16531 eval $inlibc
16532
16533 : see if this is a quadmath.h system
16534 set quadmath.h i_quadmath
16535 eval $inhdr
16536
16537 : check for volatile keyword
16538 echo " "
16539 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
16540 $cat >try.c <<'EOCP'
16541 int main()
16542 {
16543         typedef struct _goo_struct goo_struct;
16544         goo_struct * volatile goo = ((goo_struct *)0);
16545         struct _goo_struct {
16546                 long long_int;
16547                 int reg_int;
16548                 char char_var;
16549         };
16550         typedef unsigned short foo_t;
16551         char *volatile foo;
16552         volatile int bar;
16553         volatile foo_t blech;
16554         foo = foo;
16555 }
16556 EOCP
16557 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
16558         val="$define"
16559         echo "Yup, it does."
16560 else
16561         val="$undef"
16562         echo "Nope, it doesn't."
16563 fi
16564 set d_volatile
16565 eval $setvar
16566 $rm_try
16567
16568 : Check basic sizes
16569 echo " "
16570 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16571
16572 case "$use64bitint:$d_quad:$quadtype" in
16573 define:define:?*)
16574         ivtype="$quadtype"
16575         uvtype="$uquadtype"
16576         ivsize=8
16577         uvsize=8
16578         ;;
16579 *)      ivtype="long"
16580         uvtype="unsigned long"
16581         ivsize=$longsize
16582         uvsize=$longsize
16583         ;;
16584 esac
16585
16586 case "$uselongdouble:$d_longdbl" in
16587 define:define)
16588         nvtype="long double"
16589         nvsize=$longdblsize
16590         ;;
16591 *)      nvtype=double
16592         nvsize=$doublesize
16593         ;;
16594 esac
16595
16596 case "$usequadmath:$i_quadmath" in
16597 define:define)
16598   nvtype="__float128"
16599   nvsize=16
16600   case "$libs" in
16601   *quadmath*) ;;
16602   *) $cat <<EOM >&4
16603
16604 *** You requested the use of the quadmath library, but you
16605 *** do not seem to have the quadmath library installed.
16606 *** Cannot continue, aborting.
16607 EOM
16608     exit 1
16609     ;;
16610   esac
16611   ;;
16612 define:*) $cat <<EOM >&4
16613
16614 *** You requested the use of the quadmath library, but you
16615 *** do not seem to have the required header, <quadmath.h>.
16616 EOM
16617   case "$gccversion" in
16618   [23].*|4.[0-5]*)
16619    $cat <<EOM >&4
16620 *** Your gcc looks a bit old:
16621 *** $gccversion
16622 EOM
16623     ;;
16624   '')
16625    $cat <<EOM >&4
16626 *** You are not running a gcc.
16627 EOM
16628     ;;
16629   esac
16630   $cat <<EOM >&4
16631 *** For the quadmath library you need at least gcc 4.6.
16632 *** Cannot continue, aborting.
16633 EOM
16634   exit 1
16635   ;;
16636 esac
16637
16638 $echo "(IV will be "$ivtype", $ivsize bytes)"
16639 $echo "(UV will be "$uvtype", $uvsize bytes)"
16640 $echo "(NV will be "$nvtype", $nvsize bytes)"
16641
16642 $cat >try.c <<EOCP
16643 #$i_inttypes I_INTTYPES
16644 #ifdef I_INTTYPES
16645 #include <inttypes.h>
16646 #endif
16647 #include <stdio.h>
16648 int main() {
16649 #ifdef INT8
16650    int8_t i =  INT8_MAX;
16651   uint8_t u = UINT8_MAX;
16652   printf("int8_t\n");
16653 #endif
16654 #ifdef INT16
16655    int16_t i =  INT16_MAX;
16656   uint16_t u = UINT16_MAX;
16657   printf("int16_t\n");
16658 #endif
16659 #ifdef INT32
16660    int32_t i =  INT32_MAX;
16661   uint32_t u = UINT32_MAX;
16662   printf("int32_t\n");
16663 #endif
16664 }
16665 EOCP
16666
16667 i8type="signed char"
16668 u8type="unsigned char"
16669 i8size=1
16670 u8size=1
16671
16672 case "$i16type" in
16673 '')     case "$shortsize" in
16674         2)      i16type=short
16675                 u16type="unsigned short"
16676                 i16size=$shortsize
16677                 u16size=$shortsize
16678                 ;;
16679         esac
16680         ;;
16681 esac
16682 case "$i16type" in
16683 '')     set try -DINT16
16684         if eval $compile; then
16685                 case "`$run ./try`" in
16686                 int16_t)
16687                         i16type=int16_t
16688                         u16type=uint16_t
16689                         i16size=2
16690                         u16size=2
16691                         ;;
16692                 esac
16693         fi
16694         ;;
16695 esac
16696 case "$i16type" in
16697 '')     if $test $shortsize -ge 2; then
16698                 i16type=short
16699                 u16type="unsigned short"
16700                 i16size=$shortsize
16701                 u16size=$shortsize
16702         fi
16703         ;;
16704 esac
16705
16706 case "$i32type" in
16707 '')     case "$longsize" in
16708         4)      i32type=long
16709                 u32type="unsigned long"
16710                 i32size=$longsize
16711                 u32size=$longsize
16712                 ;;
16713         *)      case "$intsize" in
16714                 4)      i32type=int
16715                         u32type="unsigned int"
16716                         i32size=$intsize
16717                         u32size=$intsize
16718                         ;;
16719                 esac
16720                 ;;
16721         esac
16722         ;;
16723 esac
16724 case "$i32type" in
16725 '')     set try -DINT32
16726         if eval $compile; then
16727                 case "`$run ./try`" in
16728                 int32_t)
16729                         i32type=int32_t
16730                         u32type=uint32_t
16731                         i32size=4
16732                         u32size=4
16733                         ;;
16734                 esac
16735         fi
16736         ;;
16737 esac
16738 case "$i32type" in
16739 '')     if $test $intsize -ge 4; then
16740                 i32type=int
16741                 u32type="unsigned int"
16742                 i32size=$intsize
16743                 u32size=$intsize
16744         fi
16745         ;;
16746 esac
16747
16748 case "$i64type" in
16749 '')     case "$d_quad:$quadtype" in
16750         define:?*)
16751                 i64type="$quadtype"
16752                 u64type="$uquadtype"
16753                 i64size=8
16754                 u64size=8
16755                 ;;
16756         esac
16757         ;;
16758 esac
16759
16760 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16761 : volatile so that the compiler has to store it out to memory.
16762 if test X"$d_volatile" = X"$define"; then
16763         volatile=volatile
16764 fi
16765 $cat <<EOP >try.c
16766 #include <stdio.h>
16767 #$i_stdlib I_STDLIB
16768 #ifdef I_STDLIB
16769 #include <stdlib.h>
16770 #endif
16771 #include <sys/types.h>
16772 #include <signal.h>
16773 #ifdef SIGFPE
16774 $volatile int bletched = 0;
16775 $signal_t blech(int s) { bletched = 1; }
16776 #endif
16777 int main() {
16778     $uvtype u = 0;
16779     $nvtype d;
16780     int     n = 8 * $uvsize;
16781     int     i;
16782 #ifdef SIGFPE
16783     signal(SIGFPE, blech);
16784 #endif
16785
16786     for (i = 0; i < n; i++) {
16787       u = u << 1 | ($uvtype)1;
16788       d = ($nvtype)u;
16789       if (($uvtype)d != u)
16790         break;
16791       if (d <= 0)
16792         break;
16793       d = ($nvtype)(u - 1);
16794       if (($uvtype)d != (u - 1))
16795         break;
16796 #ifdef SIGFPE
16797       if (bletched)
16798         break;
16799 #endif
16800     }
16801     printf("%d\n", ((i == n) ? -n : i));
16802     exit(0);
16803 }
16804 EOP
16805 set try
16806
16807 d_nv_preserves_uv="$undef"
16808 if eval $compile; then
16809         nv_preserves_uv_bits="`$run ./try`"
16810 fi
16811 case "$nv_preserves_uv_bits" in
16812 \-[1-9]*)
16813         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16814         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16815         d_nv_preserves_uv="$define"
16816         ;;
16817 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16818         d_nv_preserves_uv="$undef" ;;
16819 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16820         nv_preserves_uv_bits="0" ;;
16821 esac
16822 $rm_try
16823
16824 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16825 : volatile so that the compiler has to store it out to memory.
16826 if test X"$d_volatile" = X"$define"; then
16827         volatile=volatile
16828 fi
16829 $cat <<EOP >try.c
16830 #include <stdio.h>
16831
16832 typedef $nvtype NV;
16833
16834 int
16835 main() {
16836   NV value = 2;
16837   int count = 1;
16838
16839   while(count < 256) {
16840     $volatile NV up = value + 1.0;
16841     $volatile NV negated = -value;
16842     $volatile NV down = negated - 1.0;
16843     $volatile NV got_up = up - value;
16844     int up_good = got_up == 1.0;
16845     int got_down = down - negated;
16846     int down_good = got_down == -1.0;
16847
16848     if (down_good != up_good) {
16849       fprintf(stderr,
16850               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16851               up_good, (double) got_up, down_good, (double) got_down,
16852               count, (double) value);
16853       return 1;
16854     }
16855     if (!up_good) {
16856       while (1) {
16857         if (count > 8) {
16858           count -= 8;
16859           fputs("256.0", stdout);
16860         } else {
16861           count--;
16862           fputs("2.0", stdout);
16863         }
16864         if (!count) {
16865           puts("");
16866           return 0;
16867         }
16868         fputs("*", stdout);
16869       }
16870     }
16871     value *= 2;
16872     ++count;
16873   }
16874   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16875           count, (double) value);
16876   return 1;
16877 }
16878 EOP
16879 set try
16880
16881 nv_overflows_integers_at='0'
16882 if eval $compile; then
16883     xxx="`$run ./try`"
16884     case "$?" in
16885         0)
16886             case "$xxx" in
16887                 2*)  cat >&4 <<EOM
16888 The largest integer your NVs can preserve is equal to $xxx
16889 EOM
16890                     nv_overflows_integers_at="$xxx"
16891                     ;;
16892                 *)  cat >&4 <<EOM
16893 Cannot determine the largest integer value your NVs can hold, unexpected output
16894 '$xxx'
16895 EOM
16896                     ;;
16897             esac
16898             ;;
16899         *)  cat >&4 <<EOM
16900 Cannot determine the largest integer value your NVs can hold
16901 EOM
16902             ;;
16903     esac
16904 fi
16905 $rm_try
16906
16907 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16908 : volatile so that the compiler has to store it out to memory.
16909 if test X"$d_volatile" = X"$define"; then
16910         volatile=volatile
16911 fi
16912 $cat <<EOP >try.c
16913 #include <stdio.h>
16914 #$i_stdlib I_STDLIB
16915 #ifdef I_STDLIB
16916 #include <stdlib.h>
16917 #endif
16918 #$i_string I_STRING
16919 #ifdef I_STRING
16920 #  include <string.h>
16921 #else
16922 #  include <strings.h>
16923 #endif
16924 #include <sys/types.h>
16925 #include <signal.h>
16926 #ifdef SIGFPE
16927 $volatile int bletched = 0;
16928 $signal_t blech(int s) { bletched = 1; }
16929 #endif
16930
16931 int checkit($nvtype d, char *where) {
16932     unsigned char *p = (char *)&d;
16933     unsigned char *end = p + sizeof(d);
16934     int fail = 0;
16935
16936     while (p < end)
16937         fail += *p++;
16938
16939     if (!fail)
16940         return 0;
16941
16942     p = (char *)&d;
16943     printf("No - %s: 0x", where);
16944     while (p < end)
16945         printf ("%02X", *p++);
16946     printf("\n");
16947     return 1;
16948 }
16949
16950 int main(int argc, char **argv) {
16951     $nvtype d = 0.0;
16952     int fail = 0;
16953     fail += checkit(d, "0.0");
16954
16955     /* The compiler shouldn't be assuming that bletched is 0  */
16956     d = bletched;
16957
16958     fail += checkit(d, "bleched");
16959
16960 #ifdef SIGFPE
16961     signal(SIGFPE, blech);
16962 #endif
16963
16964     /* Paranoia - the compiler should have no way of knowing that ANSI says
16965        that argv[argc] will always be NULL.  Actually, if it did assume this it
16966        would be buggy, as this is C and main() can be called from elsewhere in
16967        the program.  */
16968     d = argv[argc] ? 1 : 0;
16969
16970     if (d) {
16971         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16972     }
16973
16974     fail += checkit(d, "ternary");
16975
16976     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16977
16978     if (d != 0.0) {
16979         printf("No - memset doesn't give 0.0\n");
16980         /* This might just blow up:  */
16981         printf("(gives %g)\n", d);
16982         return 1;
16983     }
16984
16985 #ifdef SIGFPE
16986     if (bletched) {
16987         printf("No - something bleched\n");
16988         return 1;
16989     }
16990 #endif
16991     if (fail) {
16992       printf("No - %d fail(s)\n", fail);
16993       return 1;
16994     }
16995     printf("Yes\n");
16996     return 0;
16997 }
16998 EOP
16999 set try
17000
17001 d_nv_zero_is_allbits_zero="$undef"
17002 if eval $compile; then
17003     xxx="`$run ./try`"
17004     case "$?" in
17005         0)
17006             case "$xxx" in
17007                 Yes)  cat >&4 <<EOM
17008 0.0 is represented as all bits zero in memory
17009 EOM
17010                     d_nv_zero_is_allbits_zero="$define"
17011                     ;;
17012                 *)  cat >&4 <<EOM
17013 0.0 is not represented as all bits zero in memory
17014 EOM
17015                     d_nv_zero_is_allbits_zero="$undef"
17016                     ;;
17017             esac
17018             ;;
17019         *)  cat >&4 <<EOM
17020 0.0 is not represented as all bits zero in memory
17021 EOM
17022             d_nv_zero_is_allbits_zero="$undef"
17023             ;;
17024     esac
17025 fi
17026 $rm_try
17027
17028 : check for off64_t
17029 echo " "
17030 echo "Checking to see if you have off64_t..." >&4
17031 $cat >try.c <<EOCP
17032 #include <sys/types.h>
17033 #include <unistd.h>
17034 int main() { off64_t x = 7; }
17035 EOCP
17036 set try
17037 if eval $compile; then
17038         val="$define"
17039         echo "You have off64_t."
17040 else
17041         val="$undef"
17042         echo "You do not have off64_t."
17043         case "$lseeksize" in
17044         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
17045         esac
17046 fi
17047 $rm_try
17048 set d_off64_t
17049 eval $setvar
17050
17051 : how to create joinable pthreads
17052 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
17053         echo " "
17054         echo "Checking what constant to use for creating joinable pthreads..." >&4
17055         $cat >try.c <<'EOCP'
17056 #include <pthread.h>
17057 int main() {
17058     int detachstate = JOINABLE;
17059 }
17060 EOCP
17061         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
17062         if eval $compile; then
17063                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
17064                 val="$undef" # Yes, undef.
17065                 set d_old_pthread_create_joinable
17066                 eval $setvar
17067                 val=""
17068                 set old_pthread_create_joinable
17069                 eval $setvar
17070         else
17071                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
17072                 if eval $compile; then
17073                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
17074                         val="$define"
17075                         set d_old_pthread_create_joinable
17076                         eval $setvar
17077                         val=PTHREAD_CREATE_UNDETACHED
17078                         set old_pthread_create_joinable
17079                         eval $setvar
17080                 else
17081                         set try -DJOINABLE=__UNDETACHED
17082                         if eval $compile; then
17083                                 echo "You seem to use __UNDETACHED." >&4
17084                                 val="$define"
17085                                 set d_old_pthread_create_joinable
17086                                 eval $setvar
17087                                 val=__UNDETACHED
17088                                 set old_pthread_create_joinable
17089                                 eval $setvar
17090                         else
17091                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
17092                                 val="$define"
17093                                 set d_old_pthread_create_joinable
17094                                 eval $setvar
17095                                 val=0
17096                                 set old_pthread_create_joinable
17097                                 eval $setvar
17098                         fi
17099                 fi
17100         fi
17101         $rm_try
17102 else
17103     d_old_pthread_create_joinable="$undef"
17104     old_pthread_create_joinable=""
17105 fi
17106
17107 : see if pause exists
17108 set pause d_pause
17109 eval $inlibc
17110
17111 : see if poll exists
17112 set poll d_poll
17113 eval $inlibc
17114
17115 : see if prctl exists
17116 set prctl d_prctl
17117 eval $inlibc
17118
17119 : see if prctl supports PR_SET_NAME
17120 d_prctl_set_name=$undef
17121 case $d_prctl in
17122     $define)
17123         $cat >try.c <<EOM
17124 #ifdef __ANDROID__
17125 #include <unistd.h>
17126 #endif
17127 #include <sys/prctl.h>
17128
17129 int main (int argc, char *argv[])
17130 {
17131     return (prctl (PR_SET_NAME, "Test"));
17132     } /* main */
17133 EOM
17134         set try
17135         if eval $compile_ok && $run ./try; then
17136             echo "Your prctl (PR_SET_NAME, ...) works"
17137             d_prctl_set_name=$define
17138             fi
17139         $rm_try
17140         ;;
17141     esac
17142
17143 : see if readlink exists
17144 set readlink d_readlink
17145 eval $inlibc
17146
17147 : Check if exe is symlink to abs path of executing program
17148 echo " "
17149 procselfexe=''
17150 val="$undef"
17151 case "$d_readlink" in
17152     "$define")
17153         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
17154         : more tidy to avoid an extra level of symlink
17155         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17156         while test $# -gt 0; do
17157             type=$1; try=$2
17158             shift; shift
17159             if $issymlink $try; then
17160                 $ls -l $try > reflect
17161                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17162                     echo "You have $type-like $try."
17163                     procselfexe='"'$try'"'
17164                     val="$define"
17165                     : This will break out of the loop
17166                     set X; shift
17167                 fi
17168             fi
17169         done
17170         ;;
17171 esac
17172 $rm -f reflect
17173 set d_procselfexe
17174 eval $setvar
17175
17176 : backward compatibility for d_hvfork
17177 if test X$d_hvfork != X; then
17178         d_vfork="$d_hvfork"
17179         d_hvfork=''
17180 fi
17181 : see if there is a vfork
17182 val=''
17183 set vfork val
17184 eval $inlibc
17185
17186 d_pseudofork=$undef
17187
17188 : Ok, but do we want to use it. vfork is reportedly unreliable in
17189 : perl on Solaris 2.x, and probably elsewhere.
17190 case "$val" in
17191 $define)
17192         echo " "
17193         case "$usevfork" in
17194         false) dflt='n';;
17195         *) dflt='y';;
17196         esac
17197         cat <<'EOM'
17198
17199 Perl can only use a vfork() that doesn't suffer from strict
17200 restrictions on calling functions or modifying global data in
17201 the child.  For example, glibc-2.1 contains such a vfork()
17202 that is unsuitable.  If your system provides a proper fork()
17203 call, chances are that you do NOT want perl to use vfork().
17204
17205 EOM
17206         rp="Do you still want to use vfork()?"
17207         . ./myread
17208         case "$ans" in
17209         y|Y) ;;
17210         *)
17211                 echo "Ok, we won't use vfork()."
17212                 val="$undef"
17213                 ;;
17214         esac
17215         ;;
17216 esac
17217 set d_vfork
17218 eval $setvar
17219 case "$d_vfork" in
17220 $define) usevfork='true';;
17221 *) usevfork='false';;
17222 esac
17223
17224 : see whether the pthread_atfork exists
17225 $cat >try.c <<EOP
17226 #include <pthread.h>
17227 #include <stdio.h>
17228 int main() {
17229 #ifdef  PTHREAD_ATFORK
17230         pthread_atfork(NULL,NULL,NULL);
17231 #endif
17232 }
17233 EOP
17234
17235 : see if pthread_atfork exists
17236 set try -DPTHREAD_ATFORK
17237 if eval $compile; then
17238     val="$define"
17239 else
17240     val="$undef"
17241 fi
17242 case "$usethreads" in
17243 $define)
17244         case "$val" in
17245         $define) echo 'pthread_atfork found.' >&4        ;;
17246         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17247         esac
17248 esac
17249 set d_pthread_atfork
17250 eval $setvar
17251
17252 : see if pthread_attr_setscope exists
17253 set pthread_attr_setscope d_pthread_attr_setscope
17254 eval $inlibc
17255
17256 : see whether the various POSIXish _yields exist
17257 $cat >try.c <<EOP
17258 #include <pthread.h>
17259 #include <stdio.h>
17260 int main() {
17261 #ifdef SCHED_YIELD
17262         sched_yield();
17263 #else
17264 #ifdef PTHREAD_YIELD
17265         pthread_yield();
17266 #else
17267 #ifdef PTHREAD_YIELD_NULL
17268         pthread_yield(NULL);
17269 #endif
17270 #endif
17271 #endif
17272 }
17273 EOP
17274 : see if sched_yield exists
17275 set try -DSCHED_YIELD
17276 if eval $compile; then
17277     val="$define"
17278     sched_yield='sched_yield()'
17279 else
17280     val="$undef"
17281 fi
17282 case "$usethreads" in
17283 $define)
17284         case "$val" in
17285         $define) echo 'sched_yield() found.' >&4        ;;
17286         *)       echo 'sched_yield() NOT found.' >&4    ;;
17287         esac
17288 esac
17289 set d_sched_yield
17290 eval $setvar
17291
17292 : see if pthread_yield exists
17293 set try -DPTHREAD_YIELD
17294 if eval $compile; then
17295     val="$define"
17296     case "$sched_yield" in
17297     '') sched_yield='pthread_yield()' ;;
17298     esac
17299 else
17300     set try -DPTHREAD_YIELD_NULL
17301     if eval $compile; then
17302         val="$define"
17303         case "$sched_yield" in
17304         '') sched_yield='pthread_yield(NULL)' ;;
17305         esac
17306     else
17307         val="$undef"
17308     fi
17309 fi
17310 case "$usethreads" in
17311 $define)
17312         case "$val" in
17313         $define) echo 'pthread_yield() found.' >&4      ;;
17314         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17315         esac
17316         ;;
17317 esac
17318 set d_pthread_yield
17319 eval $setvar
17320 case "$sched_yield" in
17321 '') sched_yield=undef ;;
17322 esac
17323 $rm_try
17324
17325 : check for ptrdiff_t
17326 echo " "
17327 echo "Checking to see if you have ptrdiff_t..." >&4
17328 $cat >try.c <<EOCP
17329 #include <stddef.h>
17330 int main() { ptrdiff_t x = 7; }
17331 EOCP
17332 set try
17333 if eval $compile; then
17334         val="$define"
17335         echo "You have ptrdiff_t."
17336 else
17337         val="$undef"
17338         echo "You do not have ptrdiff_t."
17339 fi
17340 $rm_try
17341 set d_ptrdiff_t
17342 eval $setvar
17343
17344 : see if random_r exists
17345 set random_r d_random_r
17346 eval $inlibc
17347 case "$d_random_r" in
17348 "$define")
17349         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17350         case "$d_random_r_proto:$usethreads" in
17351         ":define")      d_random_r_proto=define
17352                 set d_random_r_proto random_r $hdrs
17353                 eval $hasproto ;;
17354         *)      ;;
17355         esac
17356         case "$d_random_r_proto" in
17357         define)
17358         case "$random_r_proto" in
17359         ''|0) try='int random_r(int*, struct random_data*);'
17360         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17361         esac
17362         case "$random_r_proto" in
17363         ''|0) try='int random_r(long*, struct random_data*);'
17364         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17365         esac
17366         case "$random_r_proto" in
17367         ''|0) try='int random_r(struct random_data*, int32_t*);'
17368         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17369         esac
17370         case "$random_r_proto" in
17371         ''|0)   d_random_r=undef
17372                 random_r_proto=0
17373                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17374         * )     case "$random_r_proto" in
17375                 REENTRANT_PROTO*) ;;
17376                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17377                 esac
17378                 echo "Prototype: $try" ;;
17379         esac
17380         ;;
17381         *)      case "$usethreads" in
17382                 define) echo "random_r has no prototype, not using it." >&4 ;;
17383                 esac
17384                 d_random_r=undef
17385                 random_r_proto=0
17386                 ;;
17387         esac
17388         ;;
17389 *)      random_r_proto=0
17390         ;;
17391 esac
17392
17393 : see if readdir and friends exist
17394 set readdir d_readdir
17395 eval $inlibc
17396 set seekdir d_seekdir
17397 eval $inlibc
17398 set telldir d_telldir
17399 eval $inlibc
17400 set rewinddir d_rewinddir
17401 eval $inlibc
17402
17403 : see if readdir64_r exists
17404 set readdir64_r d_readdir64_r
17405 eval $inlibc
17406 case "$d_readdir64_r" in
17407 "$define")
17408         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17409         case "$d_readdir64_r_proto:$usethreads" in
17410         ":define")      d_readdir64_r_proto=define
17411                 set d_readdir64_r_proto readdir64_r $hdrs
17412                 eval $hasproto ;;
17413         *)      ;;
17414         esac
17415         case "$d_readdir64_r_proto" in
17416         define)
17417         case "$readdir64_r_proto" in
17418         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17419         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17420         esac
17421         case "$readdir64_r_proto" in
17422         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17423         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17424         esac
17425         case "$readdir64_r_proto" in
17426         ''|0)   d_readdir64_r=undef
17427                 readdir64_r_proto=0
17428                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17429         * )     case "$readdir64_r_proto" in
17430                 REENTRANT_PROTO*) ;;
17431                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17432                 esac
17433                 echo "Prototype: $try" ;;
17434         esac
17435         ;;
17436         *)      case "$usethreads" in
17437                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17438                 esac
17439                 d_readdir64_r=undef
17440                 readdir64_r_proto=0
17441                 ;;
17442         esac
17443         ;;
17444 *)      readdir64_r_proto=0
17445         ;;
17446 esac
17447
17448 : see if readdir_r exists
17449 set readdir_r d_readdir_r
17450 eval $inlibc
17451 case "$d_readdir_r" in
17452 "$define")
17453         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17454         case "$d_readdir_r_proto:$usethreads" in
17455         ":define")      d_readdir_r_proto=define
17456                 set d_readdir_r_proto readdir_r $hdrs
17457                 eval $hasproto ;;
17458         *)      ;;
17459         esac
17460         case "$d_readdir_r_proto" in
17461         define)
17462         case "$readdir_r_proto" in
17463         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17464         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17465         esac
17466         case "$readdir_r_proto" in
17467         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17468         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17469         esac
17470         case "$readdir_r_proto" in
17471         ''|0)   d_readdir_r=undef
17472                 readdir_r_proto=0
17473                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17474         * )     case "$readdir_r_proto" in
17475                 REENTRANT_PROTO*) ;;
17476                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17477                 esac
17478                 echo "Prototype: $try" ;;
17479         esac
17480         ;;
17481         *)      case "$usethreads" in
17482                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17483                 esac
17484                 d_readdir_r=undef
17485                 readdir_r_proto=0
17486                 ;;
17487         esac
17488         ;;
17489 *)      readdir_r_proto=0
17490         ;;
17491 esac
17492
17493 : see if readv exists
17494 set readv d_readv
17495 eval $inlibc
17496
17497 : see if recvmsg exists
17498 set recvmsg d_recvmsg
17499 eval $inlibc
17500
17501 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17502 echo " "
17503 if set regcomp val -f d_regcomp; eval $csym; $val; then
17504         echo 'regcomp() found.' >&4
17505         d_regcomp="$define"
17506         d_regcmp="$undef"
17507         d_re_comp="$undef"
17508 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17509         echo 'regcmp() found.' >&4
17510         d_regcmp="$define"
17511         d_regcomp="$undef"
17512         d_re_comp="$undef"
17513 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17514         echo 're_comp() found, assuming re_exec() also exists.' >&4
17515         d_re_comp="$define"
17516         d_regcomp="$undef"
17517         d_regcmp="$undef"
17518 else
17519         $cat >&4 <<EOM
17520 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17521 EOM
17522         d_regcmp="$undef"
17523         d_re_comp="$undef"
17524         d_regcomp="$undef"
17525 fi
17526
17527 : see if remainder exists
17528 set remainder d_remainder
17529 eval $inlibc
17530
17531 : see if remquo exists
17532 set remquo d_remquo
17533 eval $inlibc
17534
17535 : see if rename exists
17536 set rename d_rename
17537 eval $inlibc
17538
17539 : see if rint exists
17540 set rint d_rint
17541 eval $inlibc
17542
17543 : see if rmdir exists
17544 set rmdir d_rmdir
17545 eval $inlibc
17546
17547 : see if round exists
17548 set round d_round
17549 eval $inlibc
17550
17551 : see if memory.h is available.
17552 val=''
17553 set memory.h val
17554 eval $inhdr
17555
17556 : See if it conflicts with string.h
17557 case "$val" in
17558 $define)
17559         case "$strings" in
17560         '') ;;
17561         *)
17562                 $cppstdin $cppflags $cppminus < $strings > mem.h
17563                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
17564                         echo " "
17565                         echo "We won't be including <memory.h>."
17566                         val="$undef"
17567                 fi
17568                 $rm -f mem.h
17569                 ;;
17570         esac
17571 esac
17572 set i_memory
17573 eval $setvar
17574
17575 : can bcopy handle overlapping blocks?
17576 echo " "
17577 val="$undef"
17578 case "$d_memmove" in
17579 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
17580 *)      case "$d_bcopy" in
17581         "$define")
17582                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
17583                 $cat >try.c <<EOCP
17584 #$i_memory I_MEMORY
17585 #$i_stdlib I_STDLIB
17586 #$i_string I_STRING
17587 #$i_unistd I_UNISTD
17588 EOCP
17589         $cat >>try.c <<'EOCP'
17590 #include <stdio.h>
17591 #ifdef I_MEMORY
17592 #  include <memory.h>
17593 #endif
17594 #ifdef I_STDLIB
17595 #  include <stdlib.h>
17596 #endif
17597 #ifdef I_STRING
17598 #  include <string.h>
17599 #else
17600 #  include <strings.h>
17601 #endif
17602 #ifdef I_UNISTD
17603 #  include <unistd.h>  /* Needed for NetBSD */
17604 #endif
17605 int main()
17606 {
17607 char buf[128], abc[128];
17608 char *b;
17609 int len;
17610 int off;
17611 int align;
17612
17613 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17614    try to store the string in read-only memory. */
17615 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
17616
17617 for (align = 7; align >= 0; align--) {
17618         for (len = 36; len; len--) {
17619                 b = buf+align;
17620                 bcopy(abc, b, len);
17621                 for (off = 1; off <= len; off++) {
17622                         bcopy(b, b+off, len);
17623                         bcopy(b+off, b, len);
17624                         if (bcmp(b, abc, len))
17625                                 exit(1);
17626                 }
17627         }
17628 }
17629 exit(0);
17630 }
17631 EOCP
17632                 set try
17633                 if eval $compile_ok; then
17634                         if $run ./try 2>/dev/null; then
17635                                 echo "Yes, it can."
17636                                 val="$define"
17637                         else
17638                                 echo "It can't, sorry."
17639                         fi
17640                 else
17641                         echo "(I can't compile the test program, so we'll assume not...)"
17642                 fi
17643                 ;;
17644         esac
17645         $rm_try
17646         ;;
17647 esac
17648 set d_safebcpy
17649 eval $setvar
17650
17651 : can memcpy handle overlapping blocks?
17652 echo " "
17653 val="$undef"
17654 case "$d_memmove" in
17655 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
17656 *)      case "$d_memcpy" in
17657         "$define")
17658                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
17659                 $cat >try.c <<EOCP
17660 #$i_memory I_MEMORY
17661 #$i_stdlib I_STDLIB
17662 #$i_string I_STRING
17663 #$i_unistd I_UNISTD
17664 EOCP
17665         $cat >>try.c <<'EOCP'
17666 #include <stdio.h>
17667 #ifdef I_MEMORY
17668 #  include <memory.h>
17669 #endif
17670 #ifdef I_STDLIB
17671 #  include <stdlib.h>
17672 #endif
17673 #ifdef I_STRING
17674 #  include <string.h>
17675 #else
17676 #  include <strings.h>
17677 #endif
17678 #ifdef I_UNISTD
17679 #  include <unistd.h>  /* Needed for NetBSD */
17680 #endif
17681 int main()
17682 {
17683 char buf[128], abc[128];
17684 char *b;
17685 int len;
17686 int off;
17687 int align;
17688
17689 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17690    try to store the string in read-only memory. */
17691 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
17692
17693 for (align = 7; align >= 0; align--) {
17694         for (len = 36; len; len--) {
17695                 b = buf+align;
17696                 memcpy(b, abc, len);
17697                 for (off = 1; off <= len; off++) {
17698                         memcpy(b+off, b, len);
17699                         memcpy(b, b+off, len);
17700                         if (memcmp(b, abc, len))
17701                                 exit(1);
17702                 }
17703         }
17704 }
17705 exit(0);
17706 }
17707 EOCP
17708                 set try
17709                 if eval $compile_ok; then
17710                         if $run ./try 2>/dev/null; then
17711                                 echo "Yes, it can."
17712                                 val="$define"
17713                         else
17714                                 echo "It can't, sorry."
17715                         fi
17716                 else
17717                         echo "(I can't compile the test program, so we'll assume not...)"
17718                 fi
17719                 ;;
17720         esac
17721         $rm_try
17722         ;;
17723 esac
17724 set d_safemcpy
17725 eval $setvar
17726
17727 : can memcmp be trusted to compare relative magnitude?
17728 val="$undef"
17729 case "$d_memcmp" in
17730 "$define")
17731         echo " "
17732         echo "Checking if your memcmp() can compare relative magnitude..." >&4
17733         $cat >try.c <<EOCP
17734 #$i_memory I_MEMORY
17735 #$i_stdlib I_STDLIB
17736 #$i_string I_STRING
17737 #$i_unistd I_UNISTD
17738 EOCP
17739         $cat >>try.c <<'EOCP'
17740 #include <stdio.h>
17741 #ifdef I_MEMORY
17742 #  include <memory.h>
17743 #endif
17744 #ifdef I_STDLIB
17745 #  include <stdlib.h>
17746 #endif
17747 #ifdef I_STRING
17748 #  include <string.h>
17749 #else
17750 #  include <strings.h>
17751 #endif
17752 #ifdef I_UNISTD
17753 #  include <unistd.h>  /* Needed for NetBSD */
17754 #endif
17755 int main()
17756 {
17757 char a = -1;
17758 char b = 0;
17759 if ((a < b) && memcmp(&a, &b, 1) < 0)
17760         exit(1);
17761 exit(0);
17762 }
17763 EOCP
17764         set try
17765         if eval $compile_ok; then
17766                 if $run ./try 2>/dev/null; then
17767                         echo "Yes, it can."
17768                         val="$define"
17769                 else
17770                         echo "No, it can't (it uses signed chars)."
17771                 fi
17772         else
17773                 echo "(I can't compile the test program, so we'll assume not...)"
17774         fi
17775         ;;
17776 esac
17777 $rm_try
17778 set d_sanemcmp
17779 eval $setvar
17780
17781 : see if prototype for sbrk is available
17782 echo " "
17783 set d_sbrkproto sbrk $i_unistd unistd.h
17784 eval $hasproto
17785
17786 : see if scalbn exists
17787 set scalbn d_scalbn
17788 eval $inlibc
17789
17790 : see if select exists
17791 set select d_select
17792 eval $inlibc
17793
17794 : see if semctl exists
17795 set semctl d_semctl
17796 eval $inlibc
17797
17798 : see if semget exists
17799 set semget d_semget
17800 eval $inlibc
17801
17802 : see if semop exists
17803 set semop d_semop
17804 eval $inlibc
17805
17806 : see how much of the 'sem*(2)' library is present.
17807 h_sem=true
17808 echo " "
17809 case "$d_semctl$d_semget$d_semop" in
17810 *"$undef"*) h_sem=false;;
17811 esac
17812 case "$osname" in
17813 freebsd)
17814     case "`ipcs 2>&1`" in
17815     "SVID messages"*"not configured"*)
17816         echo "Your $osname does not have the sem*(2) configured." >&4
17817         h_sem=false
17818         val="$undef"
17819         set semctl d_semctl
17820         eval $setvar
17821         set semget d_semget
17822         eval $setvar
17823         set semop d_semop
17824         eval $setvar
17825         ;;
17826     esac
17827     ;;
17828 esac
17829 : we could also check for sys/ipc.h ...
17830 if $h_sem && $test `./findhdr sys/sem.h`; then
17831         echo "You have the full sem*(2) library." >&4
17832         val="$define"
17833 else
17834         echo "You don't have the full sem*(2) library." >&4
17835         val="$undef"
17836 fi
17837 set d_sem
17838 eval $setvar
17839
17840 : see whether sys/sem.h defines union semun
17841 echo " "
17842 $cat > try.c <<'END'
17843 #include <sys/types.h>
17844 #include <sys/ipc.h>
17845 #include <sys/sem.h>
17846 int main () { union semun semun; semun.buf = 0; }
17847 END
17848 set try
17849 if eval $compile; then
17850     echo "You have union semun in <sys/sem.h>." >&4
17851     val="$define"
17852 else
17853     echo "You do not have union semun in <sys/sem.h>." >&4
17854     val="$undef"
17855 fi
17856 $rm_try
17857 set d_union_semun
17858 eval $setvar
17859
17860 : see how to do semctl IPC_STAT
17861 case "$d_sem" in
17862 $define)
17863     echo " "
17864     $cat > tryh.h <<END
17865 #ifndef S_IRUSR
17866 #   ifdef S_IREAD
17867 #       define S_IRUSR S_IREAD
17868 #       define S_IWUSR S_IWRITE
17869 #       define S_IXUSR S_IEXEC
17870 #   else
17871 #       define S_IRUSR 0400
17872 #       define S_IWUSR 0200
17873 #       define S_IXUSR 0100
17874 #   endif
17875 #   define S_IRGRP (S_IRUSR>>3)
17876 #   define S_IWGRP (S_IWUSR>>3)
17877 #   define S_IXGRP (S_IXUSR>>3)
17878 #   define S_IROTH (S_IRUSR>>6)
17879 #   define S_IWOTH (S_IWUSR>>6)
17880 #   define S_IXOTH (S_IXUSR>>6)
17881 #endif
17882 #ifndef S_IRWXU
17883 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17884 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17885 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17886 #endif
17887 END
17888     : see whether semctl IPC_STAT can use union semun
17889     case "$d_semctl_semun" in
17890     '')
17891       val="$undef"
17892       $cat > try.c <<END
17893 #include <sys/types.h>
17894 #include <sys/ipc.h>
17895 #include <sys/sem.h>
17896 #include <sys/stat.h>
17897 #include <stdio.h>
17898 #include <errno.h>
17899 #include "tryh.h"
17900 #ifndef errno
17901 extern int errno;
17902 #endif
17903 #$d_union_semun HAS_UNION_SEMUN
17904 int main() {
17905     union semun
17906 #ifndef HAS_UNION_SEMUN
17907     {
17908         int val;
17909         struct semid_ds *buf;
17910         unsigned short *array;
17911     }
17912 #endif
17913     arg;
17914     int sem, st;
17915
17916 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17917     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17918     if (sem > -1) {
17919         struct semid_ds argbuf;
17920         arg.buf = &argbuf;
17921 #       ifdef IPC_STAT
17922         st = semctl(sem, 0, IPC_STAT, arg);
17923         if (st == 0)
17924             printf("semun\n");
17925         else
17926 #       endif /* IPC_STAT */
17927             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17928 #       ifdef IPC_RMID
17929         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17930 #       endif /* IPC_RMID */
17931             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17932     } else
17933 #endif /* IPC_PRIVATE && ... */
17934         printf("semget failed: errno = %d\n", errno);
17935   return 0;
17936 }
17937 END
17938       set try
17939       if eval $compile; then
17940           xxx=`$run ./try`
17941           case "$xxx" in
17942           semun) val="$define" ;;
17943           esac
17944       fi
17945       $rm_try
17946       set d_semctl_semun
17947       eval $setvar
17948       ;;
17949     esac
17950     case "$d_semctl_semun" in
17951     $define)
17952         echo "You can use union semun for semctl IPC_STAT." >&4
17953         also='also'
17954         ;;
17955     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17956         also=''
17957         ;;
17958     esac
17959
17960     : see whether semctl IPC_STAT can use struct semid_ds pointer
17961     case "$d_semctl_semid_ds" in
17962     '')
17963       val="$undef"
17964       $cat > try.c <<'END'
17965 #include <sys/types.h>
17966 #include <sys/ipc.h>
17967 #include <sys/sem.h>
17968 #include <sys/stat.h>
17969 #include "tryh.h"
17970 #include <stdio.h>
17971 #include <errno.h>
17972 #ifndef errno
17973 extern int errno;
17974 #endif
17975 int main() {
17976     struct semid_ds arg;
17977     int sem, st;
17978
17979 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17980     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17981     if (sem > -1) {
17982 #       ifdef IPC_STAT
17983         st = semctl(sem, 0, IPC_STAT, &arg);
17984         if (st == 0)
17985             printf("semid_ds\n");
17986         else
17987 #       endif /* IPC_STAT */
17988             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17989 #       ifdef IPC_RMID
17990         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
17991 #       endif /* IPC_RMID */
17992             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17993     } else
17994 #endif /* IPC_PRIVATE && ... */
17995         printf("semget failed: errno = %d\n", errno);
17996
17997     return 0;
17998 }
17999 END
18000       set try
18001       if eval $compile; then
18002           xxx=`$run ./try`
18003           case "$xxx" in
18004           semid_ds) val="$define" ;;
18005           esac
18006       fi
18007       $rm_try
18008       set d_semctl_semid_ds
18009       eval $setvar
18010       ;;
18011     esac
18012     case "$d_semctl_semid_ds" in
18013     $define)
18014         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
18015         ;;
18016     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
18017         ;;
18018     esac
18019     ;;
18020 *)  val="$undef"
18021
18022     # We do not have the full sem*(2) library, so assume we can not
18023     # use either.
18024
18025     set d_semctl_semun
18026     eval $setvar
18027
18028     set d_semctl_semid_ds
18029     eval $setvar
18030     ;;
18031 esac
18032 $rm_try tryh.h
18033
18034 : see if sendmsg exists
18035 set sendmsg d_sendmsg
18036 eval $inlibc
18037
18038 : see if setegid exists
18039 set setegid d_setegid
18040 eval $inlibc
18041
18042 : see if seteuid exists
18043 set seteuid d_seteuid
18044 eval $inlibc
18045
18046 : see if setgrent exists
18047 set setgrent d_setgrent
18048 eval $inlibc
18049
18050 : see if setgrent_r exists
18051 set setgrent_r d_setgrent_r
18052 eval $inlibc
18053 case "$d_setgrent_r" in
18054 "$define")
18055         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
18056         case "$d_setgrent_r_proto:$usethreads" in
18057         ":define")      d_setgrent_r_proto=define
18058                 set d_setgrent_r_proto setgrent_r $hdrs
18059                 eval $hasproto ;;
18060         *)      ;;
18061         esac
18062         case "$d_setgrent_r_proto" in
18063         define)
18064         case "$setgrent_r_proto" in
18065         ''|0) try='int setgrent_r(FILE**);'
18066         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
18067         esac
18068         case "$setgrent_r_proto" in
18069         ''|0) try='void setgrent_r(FILE**);'
18070         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
18071         esac
18072         case "$setgrent_r_proto" in
18073         ''|0)   d_setgrent_r=undef
18074                 setgrent_r_proto=0
18075                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
18076         * )     case "$setgrent_r_proto" in
18077                 REENTRANT_PROTO*) ;;
18078                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
18079                 esac
18080                 echo "Prototype: $try" ;;
18081         esac
18082         ;;
18083         *)      case "$usethreads" in
18084                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
18085                 esac
18086                 d_setgrent_r=undef
18087                 setgrent_r_proto=0
18088                 ;;
18089         esac
18090         ;;
18091 *)      setgrent_r_proto=0
18092         ;;
18093 esac
18094
18095 : see if sethostent exists
18096 set sethostent d_sethent
18097 eval $inlibc
18098
18099 : see if sethostent_r exists
18100 set sethostent_r d_sethostent_r
18101 eval $inlibc
18102 case "$d_sethostent_r" in
18103 "$define")
18104         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18105         case "$d_sethostent_r_proto:$usethreads" in
18106         ":define")      d_sethostent_r_proto=define
18107                 set d_sethostent_r_proto sethostent_r $hdrs
18108                 eval $hasproto ;;
18109         *)      ;;
18110         esac
18111         case "$d_sethostent_r_proto" in
18112         define)
18113         case "$sethostent_r_proto" in
18114         ''|0) try='int sethostent_r(int, struct hostent_data*);'
18115         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
18116         esac
18117         case "$sethostent_r_proto" in
18118         ''|0) try='void sethostent_r(int, struct hostent_data*);'
18119         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
18120         esac
18121         case "$sethostent_r_proto" in
18122         ''|0)   d_sethostent_r=undef
18123                 sethostent_r_proto=0
18124                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
18125         * )     case "$sethostent_r_proto" in
18126                 REENTRANT_PROTO*) ;;
18127                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
18128                 esac
18129                 echo "Prototype: $try" ;;
18130         esac
18131         ;;
18132         *)      case "$usethreads" in
18133                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
18134                 esac
18135                 d_sethostent_r=undef
18136                 sethostent_r_proto=0
18137                 ;;
18138         esac
18139         ;;
18140 *)      sethostent_r_proto=0
18141         ;;
18142 esac
18143
18144 : see if setitimer exists
18145 set setitimer d_setitimer
18146 eval $inlibc
18147
18148 : see if setlinebuf exists
18149 set setlinebuf d_setlinebuf
18150 eval $inlibc
18151
18152 : see if setlocale exists
18153 set setlocale d_setlocale
18154 eval $inlibc
18155
18156 : see if locale.h is available
18157 set locale.h i_locale
18158 eval $inhdr
18159
18160 : see if setlocale_r exists
18161 set setlocale_r d_setlocale_r
18162 eval $inlibc
18163 case "$d_setlocale_r" in
18164 "$define")
18165         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18166         case "$d_setlocale_r_proto:$usethreads" in
18167         ":define")      d_setlocale_r_proto=define
18168                 set d_setlocale_r_proto setlocale_r $hdrs
18169                 eval $hasproto ;;
18170         *)      ;;
18171         esac
18172         case "$d_setlocale_r_proto" in
18173         define)
18174         case "$setlocale_r_proto" in
18175         ''|0) try='int setlocale_r(int, const char*, char*, int);'
18176         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18177         esac
18178         case "$setlocale_r_proto" in
18179         ''|0)   d_setlocale_r=undef
18180                 setlocale_r_proto=0
18181                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18182         * )     case "$setlocale_r_proto" in
18183                 REENTRANT_PROTO*) ;;
18184                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18185                 esac
18186                 echo "Prototype: $try" ;;
18187         esac
18188         ;;
18189         *)      case "$usethreads" in
18190                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18191                 esac
18192                 d_setlocale_r=undef
18193                 setlocale_r_proto=0
18194                 ;;
18195         esac
18196         ;;
18197 *)      setlocale_r_proto=0
18198         ;;
18199 esac
18200
18201 : see if setnetent exists
18202 set setnetent d_setnent
18203 eval $inlibc
18204
18205 : see if setnetent_r exists
18206 set setnetent_r d_setnetent_r
18207 eval $inlibc
18208 case "$d_setnetent_r" in
18209 "$define")
18210         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18211         case "$d_setnetent_r_proto:$usethreads" in
18212         ":define")      d_setnetent_r_proto=define
18213                 set d_setnetent_r_proto setnetent_r $hdrs
18214                 eval $hasproto ;;
18215         *)      ;;
18216         esac
18217         case "$d_setnetent_r_proto" in
18218         define)
18219         case "$setnetent_r_proto" in
18220         ''|0) try='int setnetent_r(int, struct netent_data*);'
18221         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18222         esac
18223         case "$setnetent_r_proto" in
18224         ''|0) try='void setnetent_r(int, struct netent_data*);'
18225         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18226         esac
18227         case "$setnetent_r_proto" in
18228         ''|0)   d_setnetent_r=undef
18229                 setnetent_r_proto=0
18230                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18231         * )     case "$setnetent_r_proto" in
18232                 REENTRANT_PROTO*) ;;
18233                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18234                 esac
18235                 echo "Prototype: $try" ;;
18236         esac
18237         ;;
18238         *)      case "$usethreads" in
18239                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18240                 esac
18241                 d_setnetent_r=undef
18242                 setnetent_r_proto=0
18243                 ;;
18244         esac
18245         ;;
18246 *)      setnetent_r_proto=0
18247         ;;
18248 esac
18249
18250 : see if setprotoent exists
18251 set setprotoent d_setpent
18252 eval $inlibc
18253
18254 : see if setpgid exists
18255 set setpgid d_setpgid
18256 eval $inlibc
18257
18258 : see if setpgrp2 exists
18259 set setpgrp2 d_setpgrp2
18260 eval $inlibc
18261
18262 : see if setpriority exists
18263 set setpriority d_setprior
18264 eval $inlibc
18265
18266 : see if setproctitle exists
18267 set setproctitle d_setproctitle
18268 eval $inlibc
18269
18270 : see if setprotoent_r exists
18271 set setprotoent_r d_setprotoent_r
18272 eval $inlibc
18273 case "$d_setprotoent_r" in
18274 "$define")
18275         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18276         case "$d_setprotoent_r_proto:$usethreads" in
18277         ":define")      d_setprotoent_r_proto=define
18278                 set d_setprotoent_r_proto setprotoent_r $hdrs
18279                 eval $hasproto ;;
18280         *)      ;;
18281         esac
18282         case "$d_setprotoent_r_proto" in
18283         define)
18284         case "$setprotoent_r_proto" in
18285         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18286         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18287         esac
18288         case "$setprotoent_r_proto" in
18289         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18290         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18291         esac
18292         case "$setprotoent_r_proto" in
18293         ''|0)   d_setprotoent_r=undef
18294                 setprotoent_r_proto=0
18295                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18296         * )     case "$setprotoent_r_proto" in
18297                 REENTRANT_PROTO*) ;;
18298                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18299                 esac
18300                 echo "Prototype: $try" ;;
18301         esac
18302         ;;
18303         *)      case "$usethreads" in
18304                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18305                 esac
18306                 d_setprotoent_r=undef
18307                 setprotoent_r_proto=0
18308                 ;;
18309         esac
18310         ;;
18311 *)      setprotoent_r_proto=0
18312         ;;
18313 esac
18314
18315 : see if setpwent exists
18316 set setpwent d_setpwent
18317 eval $inlibc
18318
18319 : see if setpwent_r exists
18320 set setpwent_r d_setpwent_r
18321 eval $inlibc
18322 case "$d_setpwent_r" in
18323 "$define")
18324         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18325         case "$d_setpwent_r_proto:$usethreads" in
18326         ":define")      d_setpwent_r_proto=define
18327                 set d_setpwent_r_proto setpwent_r $hdrs
18328                 eval $hasproto ;;
18329         *)      ;;
18330         esac
18331         case "$d_setpwent_r_proto" in
18332         define)
18333         case "$setpwent_r_proto" in
18334         ''|0) try='int setpwent_r(FILE**);'
18335         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18336         esac
18337         case "$setpwent_r_proto" in
18338         ''|0) try='void setpwent_r(FILE**);'
18339         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18340         esac
18341         case "$setpwent_r_proto" in
18342         ''|0)   d_setpwent_r=undef
18343                 setpwent_r_proto=0
18344                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18345         * )     case "$setpwent_r_proto" in
18346                 REENTRANT_PROTO*) ;;
18347                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18348                 esac
18349                 echo "Prototype: $try" ;;
18350         esac
18351         ;;
18352         *)      case "$usethreads" in
18353                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18354                 esac
18355                 d_setpwent_r=undef
18356                 setpwent_r_proto=0
18357                 ;;
18358         esac
18359         ;;
18360 *)      setpwent_r_proto=0
18361         ;;
18362 esac
18363
18364 : see if setregid exists
18365 set setregid d_setregid
18366 eval $inlibc
18367 set setresgid d_setresgid
18368 eval $inlibc
18369
18370 : see if setreuid exists
18371 set setreuid d_setreuid
18372 eval $inlibc
18373 set setresuid d_setresuid
18374 eval $inlibc
18375
18376 : see if setrgid exists
18377 set setrgid d_setrgid
18378 eval $inlibc
18379
18380 : see if setruid exists
18381 set setruid d_setruid
18382 eval $inlibc
18383
18384 : see if setservent exists
18385 set setservent d_setsent
18386 eval $inlibc
18387
18388 : see if setservent_r exists
18389 set setservent_r d_setservent_r
18390 eval $inlibc
18391 case "$d_setservent_r" in
18392 "$define")
18393         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18394         case "$d_setservent_r_proto:$usethreads" in
18395         ":define")      d_setservent_r_proto=define
18396                 set d_setservent_r_proto setservent_r $hdrs
18397                 eval $hasproto ;;
18398         *)      ;;
18399         esac
18400         case "$d_setservent_r_proto" in
18401         define)
18402         case "$setservent_r_proto" in
18403         ''|0) try='int setservent_r(int, struct servent_data*);'
18404         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18405         esac
18406         case "$setservent_r_proto" in
18407         ''|0) try='void setservent_r(int, struct servent_data*);'
18408         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18409         esac
18410         case "$setservent_r_proto" in
18411         ''|0)   d_setservent_r=undef
18412                 setservent_r_proto=0
18413                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18414         * )     case "$setservent_r_proto" in
18415                 REENTRANT_PROTO*) ;;
18416                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18417                 esac
18418                 echo "Prototype: $try" ;;
18419         esac
18420         ;;
18421         *)      case "$usethreads" in
18422                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18423                 esac
18424                 d_setservent_r=undef
18425                 setservent_r_proto=0
18426                 ;;
18427         esac
18428         ;;
18429 *)      setservent_r_proto=0
18430         ;;
18431 esac
18432
18433 : see if setsid exists
18434 set setsid d_setsid
18435 eval $inlibc
18436
18437 : see if setvbuf exists
18438 set setvbuf d_setvbuf
18439 eval $inlibc
18440
18441 : see if shmctl exists
18442 set shmctl d_shmctl
18443 eval $inlibc
18444
18445 : see if shmget exists
18446 set shmget d_shmget
18447 eval $inlibc
18448
18449 : see if shmat exists
18450 set shmat d_shmat
18451 eval $inlibc
18452 : see what shmat returns
18453 case "$d_shmat" in
18454 "$define")
18455         $cat >shmat.c <<'END'
18456 #include <sys/shm.h>
18457 void *shmat();
18458 END
18459         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18460                 shmattype='void *'
18461         else
18462                 shmattype='char *'
18463         fi
18464         echo "and it returns ($shmattype)." >&4
18465         : see if a prototype for shmat is available
18466         xxx=`./findhdr sys/shm.h`
18467         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18468         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18469                 val="$define"
18470         else
18471                 val="$undef"
18472         fi
18473         $rm -f shmat.[co]
18474         ;;
18475 *)
18476         val="$undef"
18477         ;;
18478 esac
18479 set d_shmatprototype
18480 eval $setvar
18481
18482 : see if shmdt exists
18483 set shmdt d_shmdt
18484 eval $inlibc
18485
18486 : see how much of the 'shm*(2)' library is present.
18487 h_shm=true
18488 echo " "
18489 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18490 *"$undef"*) h_shm=false;;
18491 esac
18492 case "$osname" in
18493 freebsd)
18494     case "`ipcs 2>&1`" in
18495     "SVID shared memory"*"not configured"*)
18496         echo "Your $osname does not have the shm*(2) configured." >&4
18497         h_shm=false
18498         val="$undef"
18499         set shmctl d_shmctl
18500         eval $setvar
18501         set shmget d_shmget
18502         eval $setvar
18503         set shmat d_shmat
18504         eval $setvar
18505         set shmdt d_shmdt
18506         eval $setvar
18507         ;;
18508     esac
18509     ;;
18510 esac
18511 : we could also check for sys/ipc.h ...
18512 if $h_shm && $test `./findhdr sys/shm.h`; then
18513         echo "You have the full shm*(2) library." >&4
18514         val="$define"
18515 else
18516         echo "You don't have the full shm*(2) library." >&4
18517         val="$undef"
18518 fi
18519 set d_shm
18520 eval $setvar
18521
18522 : see if we have sigaction
18523 echo " "
18524 if set sigaction val -f d_sigaction; eval $csym; $val; then
18525         echo 'sigaction() found.' >&4
18526         $cat > try.c <<EOP
18527 #include <stdio.h>
18528 #include <sys/types.h>
18529 #include <signal.h>
18530 #$i_stdlib I_STDLIB
18531 #ifdef I_STDLIB
18532 #include <stdlib.h>
18533 #endif
18534 int main()
18535 {
18536     struct sigaction act, oact;
18537     act.sa_flags = 0;
18538     oact.sa_handler = 0;
18539     /* so that act and oact are used */
18540     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18541 }
18542 EOP
18543         set try
18544         if eval $compile_ok; then
18545                 val="$define"
18546         else
18547                 echo "But you don't seem to have a usable struct sigaction." >&4
18548                 val="$undef"
18549         fi
18550 else
18551         echo 'sigaction NOT found.' >&4
18552         val="$undef"
18553 fi
18554 set d_sigaction; eval $setvar
18555 $rm_try
18556
18557 : see if this is a sunmath.h system
18558 set sunmath.h i_sunmath
18559 eval $inhdr
18560
18561 : see if signbit exists
18562 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18563 $cat >try.c <<EOCP
18564 #$i_math I_MATH
18565 #$i_sunmath I_SUNMATH
18566 #ifdef I_MATH
18567 #  include <math.h>
18568 #endif
18569 #ifdef I_SUNMATH  /* Solaris special math library */
18570 #  include <sunmath.h>
18571 #endif
18572 #define NV $nvtype
18573 int main(int argc, char **argv)
18574 {
18575     NV x = 0.0;
18576     NV y = -0.0;
18577     if ((signbit(x) == 0) && (signbit(y) != 0))
18578         return 0;
18579     else
18580         return 1;
18581 }
18582 EOCP
18583 val="$undef"
18584 set try
18585 if eval $compile; then
18586     if $run ./try; then
18587         $echo "Yes." >&4
18588         val="$define"
18589     else
18590         $echo "Signbit seems to be available, but doesn't work as I expected."
18591         $echo "I won't use it." >&4
18592         val="$undef"
18593     fi
18594 else
18595     $echo "Nope." >&4
18596     dflt="$undef"
18597 fi
18598 set d_signbit
18599 eval $setvar
18600 $rm_try
18601
18602 : see if sigprocmask exists
18603 set sigprocmask d_sigprocmask
18604 eval $inlibc
18605
18606 : see if sigsetjmp exists
18607 echo " "
18608 case "$d_sigsetjmp" in
18609 '')
18610         $cat >try.c <<EOP
18611 #include <setjmp.h>
18612 #$i_stdlib I_STDLIB
18613 #ifdef I_STDLIB
18614 #include <stdlib.h>
18615 #endif
18616 sigjmp_buf env;
18617 int set = 1;
18618 int main()
18619 {
18620         if (sigsetjmp(env,1))
18621                 exit(set);
18622         set = 0;
18623         siglongjmp(env, 1);
18624         exit(1);
18625 }
18626 EOP
18627         set try
18628         if eval $compile; then
18629                 if $run ./try >/dev/null 2>&1; then
18630                         echo "POSIX sigsetjmp found." >&4
18631                         val="$define"
18632                 else
18633                         $cat >&4 <<EOM
18634 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18635 I'll ignore them.
18636 EOM
18637                         val="$undef"
18638                 fi
18639         else
18640                 echo "sigsetjmp not found." >&4
18641                 val="$undef"
18642         fi
18643         ;;
18644 *) val="$d_sigsetjmp"
18645         case "$d_sigsetjmp" in
18646         $define) echo "POSIX sigsetjmp found." >&4;;
18647         $undef) echo "sigsetjmp not found." >&4;;
18648         esac
18649         ;;
18650 esac
18651 set d_sigsetjmp
18652 eval $setvar
18653 $rm_try
18654
18655 : see if snprintf exists
18656 set snprintf d_snprintf
18657 eval $inlibc
18658
18659 : see if vsnprintf exists
18660 set vsnprintf d_vsnprintf
18661 eval $inlibc
18662
18663 case "$d_snprintf-$d_vsnprintf" in
18664 "$define-$define")
18665     $cat <<EOM
18666 Checking whether your snprintf() and vsnprintf() work okay...
18667 EOM
18668     $cat >try.c <<'EOCP'
18669 /* v?snprintf testing logic courtesy of Russ Allbery.
18670  * According to C99:
18671  * - if the buffer is too short it still must be \0-terminated
18672  * - if the buffer is too short the potentially required length
18673  *   must be returned and not -1
18674  * - if the buffer is NULL the potentially required length
18675  *   must be returned and not -1 or core dump
18676  */
18677 #include <stdio.h>
18678 #include <stdarg.h>
18679
18680 char buf[2];
18681
18682 int test (char *format, ...)
18683 {
18684     va_list args;
18685     int count;
18686
18687     va_start (args, format);
18688     count = vsnprintf (buf, sizeof buf, format, args);
18689     va_end (args);
18690     return count;
18691 }
18692
18693 int main ()
18694 {
18695     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18696              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18697 }
18698 EOCP
18699     set try
18700     if eval $compile; then
18701         `$run ./try`
18702         case "$?" in
18703         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18704         *) cat <<EOM >&4
18705 Your snprintf() and snprintf() don't seem to be working okay.
18706 EOM
18707            d_snprintf="$undef"
18708            d_vsnprintf="$undef"
18709            ;;
18710         esac
18711     else
18712         echo "(I can't seem to compile the test program--assuming they don't)"
18713         d_snprintf="$undef"
18714         d_vsnprintf="$undef"
18715     fi
18716     $rm_try
18717     ;;
18718 esac
18719
18720 : see if sockatmark exists
18721 set sockatmark d_sockatmark
18722 eval $inlibc
18723
18724 : see if prototype for sockatmark is available
18725 echo " "
18726 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18727 eval $hasproto
18728
18729 : see if socks5_init exists
18730 set socks5_init d_socks5_init
18731 eval $inlibc
18732
18733 : see if sprintf returns the length of the string in the buffer as per ANSI
18734 $echo "Checking whether sprintf returns the length of the string..." >&4
18735 $cat <<EOP >try.c
18736 #include <stdio.h>
18737 #$i_stdlib I_STDLIB
18738 #ifdef I_STDLIB
18739 #include <stdlib.h>
18740 #endif
18741 #$i_string I_STRING
18742 #ifdef I_STRING
18743 #  include <string.h>
18744 #else
18745 #  include <strings.h>
18746 #endif
18747 #$i_math I_MATH
18748 #ifdef I_MATH
18749 #include <math.h>
18750 #endif
18751
18752 char buffer[256];
18753
18754 int check (size_t expect, int test) {
18755   size_t got = strlen(buffer);
18756   if (expect == got)
18757     return 0;
18758
18759   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
18760        test, buffer);
18761   exit (test);
18762 }
18763
18764 int main(int argc, char **argv) {
18765   int test = 0;
18766
18767   check(sprintf(buffer, ""), ++test);
18768   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
18769   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
18770
18771   return 0;
18772 }
18773 EOP
18774 set try
18775
18776 if eval $compile; then
18777     xxx="`$run ./try`"
18778     case "$?" in
18779         0) cat >&4 <<EOM
18780 sprintf returns the length of the string (as ANSI says it should)
18781 EOM
18782         d_sprintf_returns_strlen="$define"
18783         ;;
18784         *) cat >&4 <<EOM
18785 sprintf does not return the length of the string (how old is this system?)
18786 EOM
18787         d_sprintf_returns_strlen="$undef"
18788         ;;
18789     esac
18790 else
18791     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
18792     d_sprintf_returns_strlen="$undef"
18793 fi
18794 $rm_try
18795
18796 : see if srand48_r exists
18797 set srand48_r d_srand48_r
18798 eval $inlibc
18799 case "$d_srand48_r" in
18800 "$define")
18801         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18802         case "$d_srand48_r_proto:$usethreads" in
18803         ":define")      d_srand48_r_proto=define
18804                 set d_srand48_r_proto srand48_r $hdrs
18805                 eval $hasproto ;;
18806         *)      ;;
18807         esac
18808         case "$d_srand48_r_proto" in
18809         define)
18810         case "$srand48_r_proto" in
18811         ''|0) try='int srand48_r(long, struct drand48_data*);'
18812         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18813         esac
18814         case "$srand48_r_proto" in
18815         ''|0)   d_srand48_r=undef
18816                 srand48_r_proto=0
18817                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18818         * )     case "$srand48_r_proto" in
18819                 REENTRANT_PROTO*) ;;
18820                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18821                 esac
18822                 echo "Prototype: $try" ;;
18823         esac
18824         ;;
18825         *)      case "$usethreads" in
18826                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18827                 esac
18828                 d_srand48_r=undef
18829                 srand48_r_proto=0
18830                 ;;
18831         esac
18832         ;;
18833 *)      srand48_r_proto=0
18834         ;;
18835 esac
18836
18837 : see if srandom_r exists
18838 set srandom_r d_srandom_r
18839 eval $inlibc
18840 case "$d_srandom_r" in
18841 "$define")
18842         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18843         case "$d_srandom_r_proto:$usethreads" in
18844         ":define")      d_srandom_r_proto=define
18845                 set d_srandom_r_proto srandom_r $hdrs
18846                 eval $hasproto ;;
18847         *)      ;;
18848         esac
18849         case "$d_srandom_r_proto" in
18850         define)
18851         case "$srandom_r_proto" in
18852         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18853         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18854         esac
18855         case "$srandom_r_proto" in
18856         ''|0)   d_srandom_r=undef
18857                 srandom_r_proto=0
18858                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18859         * )     case "$srandom_r_proto" in
18860                 REENTRANT_PROTO*) ;;
18861                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18862                 esac
18863                 echo "Prototype: $try" ;;
18864         esac
18865         ;;
18866         *)      case "$usethreads" in
18867                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18868                 esac
18869                 d_srandom_r=undef
18870                 srandom_r_proto=0
18871                 ;;
18872         esac
18873         ;;
18874 *)      srandom_r_proto=0
18875         ;;
18876 esac
18877
18878 : see if prototype for setresgid is available
18879 echo " "
18880 set d_sresgproto setresgid $i_unistd unistd.h
18881 eval $hasproto
18882
18883 : see if prototype for setresuid is available
18884 echo " "
18885 set d_sresuproto setresuid $i_unistd unistd.h
18886 eval $hasproto
18887
18888 : see if stat exists
18889 set stat d_stat
18890 eval $inlibc
18891
18892 : see if sys/stat.h is available
18893 set sys/stat.h i_sysstat
18894 eval $inhdr
18895
18896 : see if stat knows about block sizes
18897 echo " "
18898 echo "Checking to see if your struct stat has st_blocks field..." >&4
18899 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18900 eval $hasfield
18901
18902 : see if this is a sys/vfs.h system
18903 set sys/vfs.h i_sysvfs
18904 eval $inhdr
18905
18906 : see if this is a sys/statfs.h system
18907 set sys/statfs.h i_sysstatfs
18908 eval $inhdr
18909
18910 : Check for statfs_s
18911 echo " "
18912 echo "Checking to see if your system supports struct statfs..." >&4
18913 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
18914 eval $hasstruct
18915 case "$d_statfs_s" in
18916 "$define")      echo "Yes, it does."   ;;
18917 *)              echo "No, it doesn't." ;;
18918 esac
18919
18920
18921 : see if struct statfs knows about f_flags
18922 case "$d_statfs_s" in
18923 define)
18924         echo " "
18925         echo "Checking to see if your struct statfs has f_flags field..." >&4
18926         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
18927         eval $hasfield
18928         ;;
18929 *)      val="$undef"
18930         set d_statfs_f_flags
18931         eval $setvar
18932         ;;
18933 esac
18934 case "$d_statfs_f_flags" in
18935 "$define")      echo "Yes, it does."   ;;
18936 *)              echo "No, it doesn't." ;;
18937 esac
18938
18939 : see what flavor, if any, of static inline is supported
18940 echo " "
18941 echo "Checking to see if your system supports static inline..."
18942 $cat > try.c <<'EOCP'
18943 #include <stdlib.h>
18944 extern int f_via_a(int x);
18945 extern int f_via_b(int x);
18946 int main(int argc, char **argv)
18947 {
18948     int y;
18949
18950     y = f_via_a(0);
18951 #ifdef USE_B
18952     y = f_via_b(0);
18953 #endif
18954     if (y == 42) {
18955         return EXIT_SUCCESS;
18956     }
18957     else {
18958         return EXIT_FAILURE;
18959     }
18960 }
18961 EOCP
18962 $cat > a.c <<'EOCP'
18963 static INLINE int f(int x) {
18964     int y;
18965     y = x + 42;
18966     return y;
18967 }
18968
18969 int f_via_a(int x)
18970 {
18971     return f(x);
18972 }
18973 EOCP
18974 $cat > b.c <<'EOCP'
18975 extern int f(int x);
18976
18977 int f_via_b(int x)
18978 {
18979     return f(x);
18980 }
18981 EOCP
18982
18983 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18984 case "$perl_static_inline" in
18985 '')     # Check the various possibilities, and break out on success.
18986         # For gcc, prefer __inline__, which will still permit
18987         # cflags.SH to add in -ansi.
18988         case "$gccversion" in
18989                 '') xxx="inline __inline__ __inline _inline";;
18990                 *)  xxx="__inline__ inline __inline _inline";;
18991         esac
18992         for inline in $xxx; do
18993                 set try -DINLINE=$inline a.c
18994                 if eval $compile && $run ./try; then
18995                         # Now make sure there is no external linkage of static
18996                         # functions
18997                         set try -DINLINE=$inline -DUSE_B a.c b.c
18998                         if eval $compile && $run ./try; then
18999                                 $echo "Your compiler supports static $inline, " >&4
19000                                 $echo "but it also creates an external definition," >&4
19001                                 $echo "so I won't use it." >&4
19002                                 val=$undef
19003                         else
19004                                 $echo "Your compiler supports static $inline." >&4
19005                                 val=$define
19006                                 perl_static_inline="static $inline";
19007                                 break;
19008                         fi
19009                 else
19010                         $echo "Your compiler does NOT support static $inline." >&4
19011                         val="$undef"
19012                 fi
19013         done
19014         ;;
19015 *inline*) # Some variant of inline exists.
19016         echo "Keeping your $hint value of $perl_static_inline."
19017         val=$define
19018         ;;
19019 static)  # No inline capabilities
19020         echo "Keeping your $hint value of $perl_static_inline."
19021         val=$undef
19022         ;;
19023 *)  # Unrecognized previous value -- blindly trust the supplied
19024         # value and hope it makes sense.  Use old value for
19025         # d_static_inline, if there is one.
19026         echo "Keeping your $hint value of $perl_static_inline."
19027         case "$d_static_inline" in
19028                 '') val=$define ;;
19029                 *)  val=$d_static_inline ;;
19030         esac
19031         ;;
19032 esac
19033 # Fallback to plain 'static' if nothing worked.
19034 case "$perl_static_inline" in
19035 '')
19036         perl_static_inline="static"
19037         val=$undef
19038         ;;
19039 esac
19040 set d_static_inline
19041 eval $setvar
19042 $rm -f a.[co] b.[co]
19043 $rm_try
19044
19045 : Check stream access
19046 $cat >&4 <<EOM
19047 Checking how to access stdio streams by file descriptor number...
19048 EOM
19049 case "$stdio_stream_array" in
19050 '')     $cat >try.c <<EOCP
19051 #include <stdio.h>
19052 int main() {
19053   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
19054     printf("yes\n");
19055 }
19056 EOCP
19057         for s in _iob __iob __sF
19058         do
19059                 set try -DSTDIO_STREAM_ARRAY=$s
19060                 if eval $compile; then
19061                         case "`$run ./try`" in
19062                         yes)    stdio_stream_array=$s; break ;;
19063                         esac
19064                 fi
19065         done
19066         $rm_try
19067 esac
19068 case "$stdio_stream_array" in
19069 '')     $cat >&4 <<EOM
19070 I can't figure out how to access stdio streams by file descriptor number.
19071 EOM
19072         d_stdio_stream_array="$undef"
19073         ;;
19074 *)      $cat >&4 <<EOM
19075 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
19076 EOM
19077         d_stdio_stream_array="$define"
19078         ;;
19079 esac
19080
19081 : see if strcoll exists
19082 set strcoll d_strcoll
19083 eval $inlibc
19084
19085 : check for structure copying
19086 echo " "
19087 echo "Checking to see if your C compiler can copy structs..." >&4
19088 $cat >try.c <<'EOCP'
19089 int main()
19090 {
19091         struct blurfl {
19092                 int dyick;
19093         } foo, bar;
19094
19095         foo = bar;
19096 }
19097 EOCP
19098 if $cc -c try.c >/dev/null 2>&1 ; then
19099         val="$define"
19100         echo "Yup, it can."
19101 else
19102         val="$undef"
19103         echo "Nope, it can't."
19104 fi
19105 set d_strctcpy
19106 eval $setvar
19107 $rm_try
19108
19109 : see if strerror and/or sys_errlist[] exist
19110 echo " "
19111 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
19112     if set strerror val -f d_strerror; eval $csym; $val; then
19113                 echo 'strerror() found.' >&4
19114                 d_strerror="$define"
19115                 d_strerrm='strerror(e)'
19116                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19117                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
19118                         d_syserrlst="$define"
19119                 else
19120                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
19121                         d_syserrlst="$undef"
19122                 fi
19123     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
19124                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
19125                 echo 'strerror() found in string header.' >&4
19126                 d_strerror="$define"
19127                 d_strerrm='strerror(e)'
19128                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19129                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
19130                                 d_syserrlst="$define"
19131                 else
19132                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
19133                         d_syserrlst="$undef"
19134                 fi
19135     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19136                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
19137                 d_strerror="$undef"
19138                 d_syserrlst="$define"
19139                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
19140     else
19141                 echo 'strerror() and sys_errlist[] NOT found.' >&4
19142                 d_strerror="$undef"
19143                 d_syserrlst="$undef"
19144                 d_strerrm='"unknown"'
19145     fi
19146 fi
19147
19148 : see if strerror_r exists
19149 set strerror_r d_strerror_r
19150 eval $inlibc
19151 case "$d_strerror_r" in
19152 "$define")
19153         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
19154         case "$d_strerror_r_proto:$usethreads" in
19155         ":define")      d_strerror_r_proto=define
19156                 set d_strerror_r_proto strerror_r $hdrs
19157                 eval $hasproto ;;
19158         *)      ;;
19159         esac
19160         case "$d_strerror_r_proto" in
19161         define)
19162         case "$strerror_r_proto" in
19163         ''|0) try='int strerror_r(int, char*, size_t);'
19164         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
19165         esac
19166         case "$strerror_r_proto" in
19167         ''|0) try='int strerror_r(int, char*, int);'
19168         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
19169         esac
19170         case "$strerror_r_proto" in
19171         ''|0) try='char* strerror_r(int, char*, size_t);'
19172         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
19173         esac
19174         case "$strerror_r_proto" in
19175         ''|0)   d_strerror_r=undef
19176                 strerror_r_proto=0
19177                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19178         * )     case "$strerror_r_proto" in
19179                 REENTRANT_PROTO*) ;;
19180                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19181                 esac
19182                 echo "Prototype: $try" ;;
19183         esac
19184         ;;
19185         *)      case "$usethreads" in
19186                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
19187                 esac
19188                 d_strerror_r=undef
19189                 strerror_r_proto=0
19190                 ;;
19191         esac
19192         ;;
19193 *)      strerror_r_proto=0
19194         ;;
19195 esac
19196
19197 : see if strftime exists
19198 set strftime d_strftime
19199 eval $inlibc
19200
19201 : see if strlcat exists
19202 set strlcat d_strlcat
19203 eval $inlibc
19204
19205 : see if strlcpy exists
19206 set strlcpy d_strlcpy
19207 eval $inlibc
19208
19209 : see if strtod exists
19210 set strtod d_strtod
19211 eval $inlibc
19212
19213 : see if strtol exists
19214 set strtol d_strtol
19215 eval $inlibc
19216
19217 : see if strtold exists
19218 set strtold d_strtold
19219 eval $inlibc
19220
19221 : see if strtoll exists
19222 set strtoll d_strtoll
19223 eval $inlibc
19224
19225 case "$d_longlong-$d_strtoll" in
19226 "$define-$define")
19227         $cat <<EOM
19228 Checking whether your strtoll() works okay...
19229 EOM
19230         $cat >try.c <<'EOCP'
19231 #include <errno.h>
19232 #ifdef __hpux
19233 #define strtoll __strtoll
19234 #endif
19235 #ifdef __EMX__
19236 #define strtoll _strtoll
19237 #endif
19238 #include <stdio.h>
19239 extern long long int strtoll(char *s, char **, int);
19240 static int bad = 0;
19241 int check(char *s, long long ell, int een) {
19242         long long gll;
19243         errno = 0;
19244         gll = strtoll(s, 0, 10);
19245         if (!((gll == ell) && (errno == een)))
19246                 bad++;
19247 }
19248 int main() {
19249         check(" 1",                                      1LL, 0);
19250         check(" 0",                                      0LL, 0);
19251         check("-1",                                     -1LL, 0);
19252         check("-9223372036854775808", -9223372036854775808LL, 0);
19253         check("-9223372036854775808", -9223372036854775808LL, 0);
19254         check(" 9223372036854775807",  9223372036854775807LL, 0);
19255         check("-9223372036854775808", -9223372036854775808LL, 0);
19256         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19257         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19258         if (!bad)
19259                 printf("ok\n");
19260 }
19261 EOCP
19262         set try
19263         if eval $compile; then
19264                 yyy=`$run ./try`
19265                 case "$yyy" in
19266                 ok) echo "Your strtoll() seems to be working okay." ;;
19267                 *) cat <<EOM >&4
19268 Your strtoll() doesn't seem to be working okay.
19269 EOM
19270                    d_strtoll="$undef"
19271                    ;;
19272                 esac
19273         else
19274                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19275                 d_strtoll="$undef"
19276         fi
19277         ;;
19278 esac
19279
19280 : see if strtoq exists
19281 set strtoq d_strtoq
19282 eval $inlibc
19283
19284 : see if strtoul exists
19285 set strtoul d_strtoul
19286 eval $inlibc
19287
19288 case "$d_strtoul" in
19289 "$define")
19290         $cat <<EOM
19291 Checking whether your strtoul() works okay...
19292 EOM
19293         $cat >try.c <<'EOCP'
19294 #include <errno.h>
19295 #include <stdio.h>
19296 extern unsigned long int strtoul(char *s, char **, int);
19297 static int bad = 0;
19298 void check(char *s, unsigned long eul, int een) {
19299         unsigned long gul;
19300         errno = 0;
19301         gul = strtoul(s, 0, 10);
19302         if (!((gul == eul) && (errno == een)))
19303                 bad++;
19304 }
19305 int main() {
19306         check(" 1", 1L, 0);
19307         check(" 0", 0L, 0);
19308 EOCP
19309         case "$longsize" in
19310         8)
19311             $cat >>try.c <<'EOCP'
19312         check("18446744073709551615", 18446744073709551615UL, 0);
19313         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19314 #if 0 /* strtoul() for /^-/ strings is undefined. */
19315         check("-1", 18446744073709551615UL, 0);
19316         check("-18446744073709551614", 2, 0);
19317         check("-18446744073709551615", 1, 0);
19318         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19319         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19320 #endif
19321 EOCP
19322                 ;;
19323         4)
19324                     $cat >>try.c <<'EOCP'
19325         check("4294967295", 4294967295UL, 0);
19326         check("4294967296", 4294967295UL, ERANGE);
19327 #if 0 /* strtoul() for /^-/ strings is undefined. */
19328         check("-1", 4294967295UL, 0);
19329         check("-4294967294", 2, 0);
19330         check("-4294967295", 1, 0);
19331         check("-4294967296", 4294967295UL, ERANGE);
19332         check("-4294967297", 4294967295UL, ERANGE);
19333 #endif
19334 EOCP
19335                 ;;
19336         *)
19337 : Should we write these tests to be more portable by sprintf-ing
19338 : ~0 and then manipulating that char string as input for strtol?
19339                 ;;
19340         esac
19341         $cat >>try.c <<'EOCP'
19342         if (!bad)
19343                 printf("ok\n");
19344         return 0;
19345 }
19346 EOCP
19347         set try
19348         if eval $compile; then
19349                 case "`$run ./try`" in
19350                 ok) echo "Your strtoul() seems to be working okay." ;;
19351                 *) cat <<EOM >&4
19352 Your strtoul() doesn't seem to be working okay.
19353 EOM
19354                    d_strtoul="$undef"
19355                    ;;
19356                 esac
19357         else
19358                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19359                 d_strtoul="$undef"
19360         fi
19361         ;;
19362 esac
19363
19364 : see if strtoull exists
19365 set strtoull d_strtoull
19366 eval $inlibc
19367
19368 case "$d_longlong-$d_strtoull" in
19369 "$define-$define")
19370         $cat <<EOM
19371 Checking whether your strtoull() works okay...
19372 EOM
19373         $cat >try.c <<'EOCP'
19374 #include <errno.h>
19375 #ifdef __hpux
19376 #define strtoull __strtoull
19377 #endif
19378 #include <stdio.h>
19379 extern unsigned long long int strtoull(char *s, char **, int);
19380 static int bad = 0;
19381 int check(char *s, long long eull, int een) {
19382         long long gull;
19383         errno = 0;
19384         gull = strtoull(s, 0, 10);
19385         if (!((gull == eull) && (errno == een)))
19386                 bad++;
19387 }
19388 int main() {
19389         check(" 1",                                        1LL, 0);
19390         check(" 0",                                        0LL, 0);
19391         check("18446744073709551615",  18446744073709551615ULL, 0);
19392         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19393 #if 0 /* strtoull() for /^-/ strings is undefined. */
19394         check("-1",                    18446744073709551615ULL, 0);
19395         check("-18446744073709551614",                     2LL, 0);
19396         check("-18446744073709551615",                     1LL, 0);
19397         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19398         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19399 #endif
19400         if (!bad)
19401                 printf("ok\n");
19402 }
19403 EOCP
19404         set try
19405         if eval $compile; then
19406                 case "`$run ./try`" in
19407                 ok) echo "Your strtoull() seems to be working okay." ;;
19408                 *) cat <<EOM >&4
19409 Your strtoull() doesn't seem to be working okay.
19410 EOM
19411                    d_strtoull="$undef"
19412                    ;;
19413                 esac
19414         else
19415                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19416                 d_strtoull="$undef"
19417         fi
19418         ;;
19419 esac
19420
19421 : see if strtouq exists
19422 set strtouq d_strtouq
19423 eval $inlibc
19424
19425 case "$d_strtouq" in
19426 "$define")
19427         $cat <<EOM
19428 Checking whether your strtouq() works okay...
19429 EOM
19430         $cat >try.c <<'EOCP'
19431 #include <errno.h>
19432 #include <stdio.h>
19433 extern unsigned long long int strtouq(char *s, char **, int);
19434 static int bad = 0;
19435 void check(char *s, unsigned long long eull, int een) {
19436         unsigned long long gull;
19437         errno = 0;
19438         gull = strtouq(s, 0, 10);
19439         if (!((gull == eull) && (errno == een)))
19440                 bad++;
19441 }
19442 int main() {
19443         check(" 1",                                        1LL, 0);
19444         check(" 0",                                        0LL, 0);
19445         check("18446744073709551615",  18446744073709551615ULL, 0);
19446         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19447 #if 0 /* strtouq() for /^-/ strings is undefined. */
19448         check("-1",                    18446744073709551615ULL, 0);
19449         check("-18446744073709551614",                     2LL, 0);
19450         check("-18446744073709551615",                     1LL, 0);
19451         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19452         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19453 #endif
19454         if (!bad)
19455                 printf("ok\n");
19456         return 0;
19457 }
19458 EOCP
19459         set try
19460         if eval $compile; then
19461                 case "`$run ./try`" in
19462                 ok) echo "Your strtouq() seems to be working okay." ;;
19463                 *) cat <<EOM >&4
19464 Your strtouq() doesn't seem to be working okay.
19465 EOM
19466                    d_strtouq="$undef"
19467                    ;;
19468                 esac
19469         else
19470                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19471                 d_strtouq="$undef"
19472         fi
19473         ;;
19474 esac
19475
19476 : see if strxfrm exists
19477 set strxfrm d_strxfrm
19478 eval $inlibc
19479
19480 : see if symlink exists
19481 set symlink d_symlink
19482 eval $inlibc
19483
19484 : see if syscall exists
19485 set syscall d_syscall
19486 eval $inlibc
19487
19488 : see if prototype for syscall is available
19489 echo " "
19490 set d_syscallproto syscall $i_unistd unistd.h
19491 eval $hasproto
19492
19493 : see if sysconf exists
19494 set sysconf d_sysconf
19495 eval $inlibc
19496
19497 : see if system exists
19498 set system d_system
19499 eval $inlibc
19500
19501 : see if tcgetpgrp exists
19502 set tcgetpgrp d_tcgetpgrp
19503 eval $inlibc
19504
19505 : see if tcsetpgrp exists
19506 set tcsetpgrp d_tcsetpgrp
19507 eval $inlibc
19508
19509 : see if prototype for telldir is available
19510 echo " "
19511 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19512 eval $hasproto
19513
19514 : see if tgamma exists
19515 set tgamma d_tgamma
19516 eval $inlibc
19517
19518 : see if time exists
19519 echo " "
19520 if test "X$d_time" = X -o X"$timetype" = X; then
19521     if set time val -f d_time; eval $csym; $val; then
19522                 echo 'time() found.' >&4
19523                 val="$define"
19524                 rp="What is the type returned by time() on this system?"
19525                 set time_t timetype long stdio.h sys/types.h
19526                 eval $typedef_ask
19527     else
19528                 echo 'time() not found, hope that will do.' >&4
19529                 val="$undef"
19530                 timetype='int';
19531     fi
19532     set d_time
19533     eval $setvar
19534 fi
19535
19536 : see if timegm exists
19537 set timegm d_timegm
19538 eval $inlibc
19539
19540 : see if this is a sys/times.h system
19541 set sys/times.h i_systimes
19542 eval $inhdr
19543
19544 : see if times exists
19545 echo " "
19546 if set times val -f d_times; eval $csym; $val; then
19547         echo 'times() found.' >&4
19548         d_times="$define"
19549         inc=''
19550         case "$i_systimes" in
19551         "$define") inc='sys/times.h';;
19552         esac
19553         rp="What is the type returned by times() on this system?"
19554         set clock_t clocktype long stdio.h sys/types.h $inc
19555         eval $typedef_ask
19556 else
19557         echo 'times() NOT found, hope that will do.' >&4
19558         d_times="$undef"
19559         clocktype='int'
19560 fi
19561
19562 : see if tmpnam_r exists
19563 set tmpnam_r d_tmpnam_r
19564 eval $inlibc
19565 case "$d_tmpnam_r" in
19566 "$define")
19567         hdrs="$i_systypes sys/types.h define stdio.h "
19568         case "$d_tmpnam_r_proto:$usethreads" in
19569         ":define")      d_tmpnam_r_proto=define
19570                 set d_tmpnam_r_proto tmpnam_r $hdrs
19571                 eval $hasproto ;;
19572         *)      ;;
19573         esac
19574         case "$d_tmpnam_r_proto" in
19575         define)
19576         case "$tmpnam_r_proto" in
19577         ''|0) try='char* tmpnam_r(char*);'
19578         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19579         esac
19580         case "$tmpnam_r_proto" in
19581         ''|0)   d_tmpnam_r=undef
19582                 tmpnam_r_proto=0
19583                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19584         * )     case "$tmpnam_r_proto" in
19585                 REENTRANT_PROTO*) ;;
19586                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19587                 esac
19588                 echo "Prototype: $try" ;;
19589         esac
19590         ;;
19591         *)      case "$usethreads" in
19592                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19593                 esac
19594                 d_tmpnam_r=undef
19595                 tmpnam_r_proto=0
19596                 ;;
19597         esac
19598         ;;
19599 *)      tmpnam_r_proto=0
19600         ;;
19601 esac
19602
19603 : see if trunc exists
19604 set trunc d_trunc
19605 eval $inlibc
19606
19607 : see if truncate exists
19608 set truncate d_truncate
19609 eval $inlibc
19610
19611 : see if ttyname_r exists
19612 set ttyname_r d_ttyname_r
19613 eval $inlibc
19614 case "$d_ttyname_r" in
19615 "$define")
19616         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19617         case "$d_ttyname_r_proto:$usethreads" in
19618         ":define")      d_ttyname_r_proto=define
19619                 set d_ttyname_r_proto ttyname_r $hdrs
19620                 eval $hasproto ;;
19621         *)      ;;
19622         esac
19623         case "$d_ttyname_r_proto" in
19624         define)
19625         case "$ttyname_r_proto" in
19626         ''|0) try='int ttyname_r(int, char*, size_t);'
19627         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19628         esac
19629         case "$ttyname_r_proto" in
19630         ''|0) try='int ttyname_r(int, char*, int);'
19631         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19632         esac
19633         case "$ttyname_r_proto" in
19634         ''|0) try='char* ttyname_r(int, char*, int);'
19635         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19636         esac
19637         case "$ttyname_r_proto" in
19638         ''|0)   d_ttyname_r=undef
19639                 ttyname_r_proto=0
19640                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19641         * )     case "$ttyname_r_proto" in
19642                 REENTRANT_PROTO*) ;;
19643                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19644                 esac
19645                 echo "Prototype: $try" ;;
19646         esac
19647         ;;
19648         *)      case "$usethreads" in
19649                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19650                 esac
19651                 d_ttyname_r=undef
19652                 ttyname_r_proto=0
19653                 ;;
19654         esac
19655         ;;
19656 *)      ttyname_r_proto=0
19657         ;;
19658 esac
19659
19660 : see if tzname[] exists
19661 echo " "
19662 if set tzname val -a d_tzname; eval $csym; $val; then
19663         val="$define"
19664         echo 'tzname[] found.' >&4
19665 else
19666         val="$undef"
19667         echo 'tzname[] NOT found.' >&4
19668 fi
19669 set d_tzname
19670 eval $setvar
19671
19672 : Check if is a multiplatform env
19673 case "$osname" in
19674 darwin) multiarch="$define" ;;
19675 esac
19676 case "$multiarch" in
19677 ''|[nN]*) multiarch="$undef" ;;
19678 esac
19679
19680 : check for ordering of bytes in a UV
19681 echo " "
19682 case "$multiarch" in
19683 *$define*)
19684         $cat <<EOM
19685 You seem to be doing a multiarchitecture build,
19686 skipping the byteorder check.
19687
19688 EOM
19689         byteorder='ffff'
19690         ;;
19691 *)
19692         case "$byteorder" in
19693         '')
19694                 $cat <<'EOM'
19695 In the following, larger digits indicate more significance.  A big-endian
19696 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19697 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19698 machines may have weird orders like 3412.  A Cray will report 87654321,
19699 an Alpha will report 12345678. If the test program works the default is
19700 probably right.
19701 I'm now running the test program...
19702 EOM
19703                 $cat >try.c <<EOCP
19704 #include <stdio.h>
19705 #$i_stdlib I_STDLIB
19706 #ifdef I_STDLIB
19707 #include <stdlib.h>
19708 #endif
19709 #include <sys/types.h>
19710 typedef $uvtype UV;
19711 int main()
19712 {
19713         int i;
19714         union {
19715                 UV l;
19716                 char c[$uvsize];
19717         } u;
19718
19719         if ($uvsize > 4)
19720                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19721         else
19722                 u.l = (UV)0x04030201;
19723         for (i = 0; i < $uvsize; i++)
19724                 printf("%c", u.c[i]+'0');
19725         printf("\n");
19726         exit(0);
19727 }
19728 EOCP
19729                 xxx_prompt=y
19730                 set try
19731                 if eval $compile && $run ./try > /dev/null; then
19732                         dflt=`$run ./try`
19733                         case "$dflt" in
19734                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19735                                 echo "(The test program ran ok.)"
19736                                 echo "byteorder=$dflt"
19737                                 xxx_prompt=n
19738                         ;;
19739                         ????|????????) echo "(The test program ran ok.)" ;;
19740                         *) echo "(The test program didn't run right for some reason.)" ;;
19741                         esac
19742                 else
19743                         dflt='4321'
19744                         cat <<'EOM'
19745 (I can't seem to compile the test program.  Guessing big-endian...)
19746 EOM
19747                 fi
19748                 case "$xxx_prompt" in
19749                 y)
19750                         rp="What is the order of bytes in $uvtype?"
19751                         . ./myread
19752                         byteorder="$ans"
19753                         ;;
19754                 *)      byteorder=$dflt
19755                         ;;
19756                 esac
19757                 ;;
19758         esac
19759         $rm_try
19760         ;;
19761 esac
19762
19763 : Checking 32bit alignedness
19764 $cat <<EOM
19765
19766 Checking to see whether you can access character data unalignedly...
19767 EOM
19768 case "$d_u32align" in
19769 '')   $cat >try.c <<EOCP
19770 #include <stdio.h>
19771 #$i_stdlib I_STDLIB
19772 #ifdef I_STDLIB
19773 #include <stdlib.h>
19774 #endif
19775 #define U32 $u32type
19776 #define BYTEORDER 0x$byteorder
19777 #define U8 $u8type
19778 #include <signal.h>
19779 #ifdef SIGBUS
19780 $signal_t bletch(int s) { exit(4); }
19781 #endif
19782 int main() {
19783 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19784     volatile U8 buf[8];
19785     volatile U32 *up;
19786     int i;
19787
19788     if (sizeof(U32) != 4) {
19789         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19790         exit(1);
19791     }
19792
19793     fflush(stdout);
19794
19795 #ifdef SIGBUS
19796     signal(SIGBUS, bletch);
19797 #endif
19798
19799     buf[0] = 0;
19800     buf[1] = 0;
19801     buf[2] = 0;
19802     buf[3] = 1;
19803     buf[4] = 0;
19804     buf[5] = 0;
19805     buf[6] = 0;
19806     buf[7] = 1;
19807
19808     for (i = 0; i < 4; i++) {
19809         up = (U32*)(buf + i);
19810         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19811                (*up == 1 << (8*(3-i)))  /* little-endian */
19812               )
19813            )
19814         {
19815             printf("read failed (%x)\n", *up);
19816             exit(2);
19817         }
19818     }
19819
19820     /* write test */
19821     for (i = 0; i < 4; i++) {
19822         up = (U32*)(buf + i);
19823         *up = 0xBeef;
19824         if (*up != 0xBeef) {
19825             printf("write failed (%x)\n", *up);
19826             exit(3);
19827         }
19828     }
19829
19830     exit(0);
19831 #else
19832     printf("1\n");
19833     exit(1);
19834 #endif
19835     return 0;
19836 }
19837 EOCP
19838 set try
19839 if eval $compile_ok; then
19840         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19841         $run ./try 2>&1 >/dev/null
19842         case "$?" in
19843         0)      cat >&4 <<EOM
19844 You can access character data pretty unalignedly.
19845 EOM
19846                 d_u32align="$undef"
19847                 ;;
19848         *)      cat >&4 <<EOM
19849 It seems that you must access character data in an aligned manner.
19850 EOM
19851                 d_u32align="$define"
19852                 ;;
19853         esac
19854 else
19855         rp='Can you access character data at unaligned addresses?'
19856         dflt='n'
19857         . ./myread
19858         case "$ans" in
19859         [yY]*)  d_u32align="$undef"  ;;
19860         *)      d_u32align="$define" ;;
19861         esac
19862 fi
19863 $rm_try
19864 ;;
19865 esac
19866
19867 : see if ualarm exists
19868 set ualarm d_ualarm
19869 eval $inlibc
19870
19871 : see if umask exists
19872 set umask d_umask
19873 eval $inlibc
19874
19875 : see if unordered exists
19876 set unordered d_unordered
19877 eval $inlibc
19878
19879 : see if unsetenv exists
19880 set unsetenv d_unsetenv
19881 eval $inlibc
19882
19883 : see if usleep exists
19884 set usleep d_usleep
19885 eval $inlibc
19886
19887 : see if prototype for usleep is available
19888 echo " "
19889 set d_usleepproto usleep $i_unistd unistd.h
19890 eval $hasproto
19891
19892 : see if ustat exists
19893 set ustat d_ustat
19894 eval $inlibc
19895
19896 : see if closedir exists
19897 set closedir d_closedir
19898 eval $inlibc
19899
19900 case "$d_closedir" in
19901 "$define")
19902         echo " "
19903         echo "Checking whether closedir() returns a status..." >&4
19904         cat > try.c <<EOM
19905 #$i_dirent I_DIRENT             /**/
19906 #$i_sysdir I_SYS_DIR            /**/
19907 #$i_sysndir I_SYS_NDIR          /**/
19908 #$i_systypes I_SYS_TYPES        /**/
19909
19910 #if defined(I_SYS_TYPES)
19911 #include <sys/types.h>
19912 #endif
19913 #if defined(I_DIRENT)
19914 #include <dirent.h>
19915 #else
19916 #ifdef I_SYS_NDIR
19917 #include <sys/ndir.h>
19918 #else
19919 #ifdef I_SYS_DIR
19920 #ifdef hp9000s500
19921 #include <ndir.h>       /* may be wrong in the future */
19922 #else
19923 #include <sys/dir.h>
19924 #endif
19925 #endif
19926 #endif
19927 #endif
19928 int main() { return closedir(opendir(".")); }
19929 EOM
19930         set try
19931         if eval $compile_ok; then
19932                 if $run ./try > /dev/null 2>&1 ; then
19933                         echo "Yes, it does."
19934                         val="$undef"
19935                 else
19936                         echo "No, it doesn't."
19937                         val="$define"
19938                 fi
19939         else
19940                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19941                 val="$define"
19942         fi
19943         ;;
19944 *)
19945         val="$undef";
19946         ;;
19947 esac
19948 set d_void_closedir
19949 eval $setvar
19950 $rm_try
19951
19952 : see if there is a wait4
19953 set wait4 d_wait4
19954 eval $inlibc
19955
19956 : see if waitpid exists
19957 set waitpid d_waitpid
19958 eval $inlibc
19959
19960 : look for wcscmp
19961 echo " "
19962 $cat >try.c <<'EOCP'
19963 #include <stdio.h>
19964 #include <wchar.h>
19965 int main ()
19966 {
19967     wchar_t *s = L" ";
19968     return (wcscmp (s, s) ? 1 : 0);
19969     }
19970 EOCP
19971 set try
19972 val="$undef"
19973 if eval $compile; then
19974     `$run ./try`
19975     case "$?" in
19976         0)  echo "A working wcscmp() found." >&4
19977             val="$define" ;;
19978         *)  echo "wcscmp() found, but it doesn't work" >&4
19979             ;;
19980         esac
19981 else
19982     echo "wcscmp() NOT found." >&4
19983     fi
19984 set d_wcscmp
19985 eval $setvar
19986 $rm_try
19987
19988 : see if wcstombs exists
19989 set wcstombs d_wcstombs
19990 eval $inlibc
19991
19992 : look for wcsxfrm
19993 echo " "
19994 $cat >try.c <<'EOCP'
19995 #include <errno.h>
19996 #include <wchar.h>
19997 int main ()
19998 {
19999     wchar_t dst[4], *src = L" ";
20000     errno = 0;
20001     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
20002     }
20003 EOCP
20004 set try
20005 val="$undef"
20006 if eval $compile; then
20007     `$run ./try`
20008     case "$?" in
20009         0)  echo "A working wcsxfrm() found." >&4
20010             val="$define" ;;
20011         *)  echo "wcsxfrm() found, but it doesn't work" >&4
20012             ;;
20013         esac
20014 else
20015     echo "wcsxfrm() NOT found." >&4
20016     fi
20017 set d_wcsxfrm
20018 eval $setvar
20019 $rm_try
20020
20021 : see if wctomb exists
20022 set wctomb d_wctomb
20023 eval $inlibc
20024
20025 : see if writev exists
20026 set writev d_writev
20027 eval $inlibc
20028
20029 : check for alignment requirements
20030 echo " "
20031 case "$alignbytes" in
20032     '') echo "Checking alignment constraints..." >&4
20033         if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
20034             $cat >try.c <<'EOCP'
20035 typedef long double NV;
20036 EOCP
20037         else
20038             $cat >try.c <<'EOCP'
20039 typedef double NV;
20040 EOCP
20041         fi
20042         $cat >>try.c <<'EOCP'
20043 #include <stdio.h>
20044 struct foobar {
20045     char foo;
20046     NV bar;
20047 } try_algn;
20048 int main()
20049 {
20050     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20051     return(0);
20052 }
20053 EOCP
20054         set try
20055         if eval $compile_ok; then
20056             dflt=`$run ./try`
20057         else
20058             dflt='8'
20059             echo "(I can't seem to compile the test program...)"
20060         fi
20061         case "$multiarch" in
20062             *$define*)
20063                 : The usual safe value is 8, but Darwin with -Duselongdouble
20064                 : needs 16.  Hence, we will take 8 as a minimum, but allow
20065                 : Configure to pick a larger value if needed.
20066                 if $test "$dflt" -lt 8; then
20067                     dflt='8'
20068                     echo "Setting alignment to 8 for multiarch support.">&4
20069                 fi
20070                 ;;
20071         esac
20072         ;;
20073     *) dflt="$alignbytes"
20074         ;;
20075 esac
20076 rp="Doubles must be aligned on a how-many-byte boundary?"
20077 . ./myread
20078 alignbytes="$ans"
20079 $rm_try
20080
20081 : set the base revision
20082 baserev=5.0
20083
20084 : length of character in bytes. Is always 1, otherwise it is not C
20085 : This used to be a test using sizeof
20086 charsize=1
20087
20088 : Check for the number of bits in a character
20089 case "$charbits" in
20090 '')     echo "Checking how long a character is (in bits)..." >&4
20091         $cat >try.c <<EOCP
20092 #include <stdio.h>
20093 int main ()
20094 {
20095     int n;
20096     unsigned char c;
20097     for (c = 1, n = 0; c; c <<= 1, n++) ;
20098     printf ("%d\n", n);
20099     return (0);
20100     }
20101 EOCP
20102         set try
20103         if eval $compile_ok; then
20104                 dflt=`$run ./try`
20105         else
20106                 dflt='8'
20107                 echo "(I can't seem to compile the test program.  Guessing...)"
20108         fi
20109         ;;
20110 *)
20111         dflt="$charbits"
20112         ;;
20113 esac
20114 rp="What is the length of a character (in bits)?"
20115 . ./myread
20116 charbits="$ans"
20117 $rm_try
20118 case "$charbits" in
20119 8)      ;;
20120 *)      cat >&4 << EOM
20121 Your system has an unsigned character size of $charbits bits, which
20122 is rather unusual (normally it is 8 bits).  Perl likely will not work
20123 correctly on your system, with subtle bugs in various places.
20124 EOM
20125         rp='Do you really want to continue?'
20126         dflt='n'
20127         . ./myread
20128         case "$ans" in
20129                 [yY])   echo >&4 "Okay, continuing."    ;;
20130                 *)      exit 1                          ;;
20131         esac
20132 esac
20133
20134 : how do we concatenate cpp tokens here?
20135 echo " "
20136 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20137 $cat >cpp_stuff.c <<'EOCP'
20138 #define RCAT(a,b)a/**/b
20139 #define ACAT(a,b)a ## b
20140 RCAT(Rei,ser)
20141 ACAT(Cir,cus)
20142 EOCP
20143 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20144 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20145         echo "Oh!  Smells like ANSI's been here." >&4
20146         echo "We can catify or stringify, separately or together!"
20147         cpp_stuff=42
20148 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20149         echo "Ah, yes!  The good old days!" >&4
20150         echo "However, in the good old days we don't know how to stringify and"
20151         echo "catify at the same time."
20152         cpp_stuff=1
20153 else
20154         $cat >&4 <<EOM
20155 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20156 You're going to have to edit the values of CAT[2-5] in config.h...
20157 EOM
20158         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20159 fi
20160 $rm -f cpp_stuff.*
20161
20162 : see if this is a db.h system
20163 set db.h i_db
20164 eval $inhdr
20165
20166 case "$i_db" in
20167 $define)
20168         : Check db version.
20169         echo " "
20170         echo "Checking Berkeley DB version ..." >&4
20171         $cat >try.c <<EOCP
20172 #$d_const HASCONST
20173 #ifndef HASCONST
20174 #define const
20175 #endif
20176 #include <sys/types.h>
20177 #include <stdio.h>
20178 #$i_stdlib I_STDLIB
20179 #ifdef I_STDLIB
20180 #include <stdlib.h>
20181 #endif
20182 #include <db.h>
20183 int main(int argc, char *argv[])
20184 {
20185 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20186     int Major, Minor, Patch ;
20187     unsigned long Version ;
20188     (void)db_version(&Major, &Minor, &Patch) ;
20189     if (argc == 2) {
20190         printf("%d %d %d %d %d %d\n",
20191                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20192                Major, Minor, Patch);
20193         exit(0);
20194     }
20195     printf("You have Berkeley DB Version 2 or greater.\n");
20196
20197     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20198                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20199     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20200                 Major, Minor, Patch) ;
20201
20202     /* check that db.h & libdb are compatible */
20203     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20204         printf("db.h and libdb are incompatible.\n") ;
20205         exit(3);
20206     }
20207
20208     printf("db.h and libdb are compatible.\n") ;
20209
20210     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20211                 + DB_VERSION_PATCH ;
20212
20213     /* needs to be >= 2.3.4 */
20214     if (Version < 2003004) {
20215     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20216         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20217         exit(2);
20218     }
20219
20220     exit(0);
20221 #else
20222 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20223     if (argc == 2) {
20224         printf("1 0 0\n");
20225         exit(0);
20226     }
20227     printf("You have Berkeley DB Version 1.\n");
20228     exit(0);    /* DB version < 2: the coast is clear. */
20229 #else
20230     exit(1);    /* <db.h> not Berkeley DB? */
20231 #endif
20232 #endif
20233 }
20234 EOCP
20235         set try
20236         if eval $compile_ok && $run ./try; then
20237                 echo 'Looks OK.' >&4
20238                 set `$run ./try 1`
20239                 db_version_major=$1
20240                 db_version_minor=$2
20241                 db_version_patch=$3
20242         else
20243                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20244                 i_db=$undef
20245                 case " $libs " in
20246                 *"-ldb "*)
20247                         : Remove db from list of libraries to use
20248                         echo "Removing unusable -ldb from library list" >&4
20249                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20250                         shift
20251                         libs="$*"
20252                         echo "libs = $libs" >&4
20253                         ;;
20254                 esac
20255         fi
20256         $rm_try
20257         ;;
20258 esac
20259
20260 case "$i_db" in
20261 define)
20262         : Check the return type needed for hash
20263         echo " "
20264         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20265         $cat >try.c <<EOCP
20266 #$d_const HASCONST
20267 #ifndef HASCONST
20268 #define const
20269 #endif
20270 #include <sys/types.h>
20271 #include <db.h>
20272
20273 #ifndef DB_VERSION_MAJOR
20274 u_int32_t hash_cb (const void* ptr, size_t size)
20275 {
20276 }
20277 HASHINFO info;
20278 int main()
20279 {
20280         info.hash = hash_cb;
20281 }
20282 #endif
20283 EOCP
20284         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20285                 if $contains warning try.out >>/dev/null 2>&1 ; then
20286                         db_hashtype='int'
20287                 else
20288                         db_hashtype='u_int32_t'
20289                 fi
20290         else
20291                 : XXX Maybe we should just give up here.
20292                 db_hashtype=u_int32_t
20293                 $cat try.out >&4
20294                 echo "Help:  I can't seem to compile the db test program." >&4
20295                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20296         fi
20297         $rm_try
20298         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20299         ;;
20300 *)      db_hashtype=u_int32_t
20301         ;;
20302 esac
20303 case "$i_db" in
20304 define)
20305         : Check the return type needed for prefix
20306         echo " "
20307         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20308         cat >try.c <<EOCP
20309 #$d_const HASCONST
20310 #ifndef HASCONST
20311 #define const
20312 #endif
20313 #include <sys/types.h>
20314 #include <db.h>
20315
20316 #ifndef DB_VERSION_MAJOR
20317 size_t prefix_cb (const DBT *key1, const DBT *key2)
20318 {
20319 }
20320 BTREEINFO info;
20321 int main()
20322 {
20323         info.prefix = prefix_cb;
20324 }
20325 #endif
20326 EOCP
20327         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20328                 if $contains warning try.out >>/dev/null 2>&1 ; then
20329                         db_prefixtype='int'
20330                 else
20331                         db_prefixtype='size_t'
20332                 fi
20333         else
20334                 db_prefixtype='size_t'
20335                 : XXX Maybe we should just give up here.
20336                 $cat try.out >&4
20337                 echo "Help:  I can't seem to compile the db test program." >&4
20338                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20339         fi
20340         $rm_try
20341         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20342         ;;
20343 *)      db_prefixtype='size_t'
20344         ;;
20345 esac
20346
20347 : Check what kind of inf/nan your system has
20348 $echo "Checking the kind of infinities and nans you have..." >&4
20349 $cat >try.c <<EOP
20350 #define DOUBLESIZE $doublesize
20351 #$d_longdbl HAS_LONG_DOUBLE
20352 #ifdef HAS_LONG_DOUBLE
20353 #define LONGDBLSIZE $longdblsize
20354 #define LONGDBLKIND $longdblkind
20355 #endif
20356 #$i_math I_MATH
20357 #ifdef I_MATH
20358 #include <math.h>
20359 #endif
20360 #include <stdio.h>
20361 /* Note that whether the sign bit is on or off
20362  * for NaN depends on the CPU/FPU, and possibly
20363  * can be affected by the build toolchain.
20364  *
20365  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20366  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20367  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20368  * (respectively) as opposed to the more usual
20369  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20370  */
20371 static void bytes(unsigned char *p, unsigned int n) {
20372   int i;
20373   for (i = 0; i < n; i++) {
20374     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20375   }
20376 }
20377 int main(int argc, char *argv[]) {
20378    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20379     * because some compilers are 'smart' and not only warn but refuse to
20380     * compile such 'illegal' values. */
20381    double dinf = exp(1e9);
20382    double dnan = sqrt(-1.0);
20383 #ifdef HAS_LONG_DOUBLE
20384    long double ldinf = (long double)exp(1e9);
20385    long double ldnan = (long double)sqrt(-1.0);
20386 #endif
20387   if (argc == 2) {
20388     switch (argv[1][0]) {
20389     case '1': bytes(&dinf, sizeof(dinf)); break;
20390     case '2': bytes(&dnan, sizeof(dnan)); break;
20391 #ifdef HAS_LONG_DOUBLE
20392 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20393 /* the 80-bit long doubles might have garbage in their excess bytes */
20394     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20395 # endif
20396     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20397     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20398 #endif
20399     }
20400   }
20401   return 0;
20402 }
20403 EOP
20404 set try
20405 if eval $compile; then
20406     doubleinfbytes=`$run ./try 1`
20407     doublenanbytes=`$run ./try 2`
20408     case "$d_longdbl" in
20409     $define)
20410       longdblinfbytes=`$run ./try 3`
20411       longdblnanbytes=`$run ./try 4`
20412       ;;
20413     esac
20414 else
20415     # Defaults in case the above test program failed.
20416     case "$doublekind" in
20417     1) # IEEE 754 32-bit LE
20418        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20419        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20420        ;;
20421     2) # IEEE 754 32-bit BE
20422        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20423        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20424        ;;
20425     3) # IEEE 754 64-bit LE
20426        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20427        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20428        ;;
20429     4) # IEEE 754 64-bit BE
20430        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20431        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20432        ;;
20433     5) # IEEE 754 128-bit LE
20434        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20435        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20436        ;;
20437     6) # IEEE 754 128-bit BE
20438        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20439        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20440        ;;
20441     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20442        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20443        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20444        ;;
20445     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20446        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20447        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20448        ;;
20449     *) # No idea.
20450        doubleinfbytes=$undef
20451        doublenanbytes=$undef
20452        ;;
20453     esac
20454     case "$longdblkind" in
20455     1) # IEEE 754 128-bit LE
20456        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20457        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20458        ;;
20459     2) # IEEE 754 128-bit BE
20460        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20461        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20462        ;;
20463     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20464        case "$longdblsize" in
20465        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20466            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20467            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20468            ;;
20469        16) # x86_64
20470            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20471            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20472            ;;
20473        *)  # No idea.
20474            longdblinfbytes=$undef
20475            longdblnanbytes=$undef
20476        ;;
20477        esac
20478        ;;
20479     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20480        case "$longdblsize" in
20481        12) # 32-bit system
20482            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20483            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20484            ;;
20485        16) # 64-bit system
20486            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20487            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20488            ;;
20489        *)  # No idea.
20490            longdblinfbytes=$undef
20491            longdblnanbytes=$undef
20492        ;;
20493        esac
20494        ;;
20495     5) # 128-bit LE "double double"
20496        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20497        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20498        ;;
20499     6) # 128-bit BE "double double"
20500        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20501        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20502        ;;
20503     *) # No idea.
20504        longdblinfbytes=$undef
20505        longdblnanbytes=$undef
20506        ;;
20507     esac
20508 fi
20509 $rm_try
20510
20511 : Check the length of the double mantissa
20512 $echo "Checking how many mantissa bits your doubles have..." >&4
20513 $cat >try.c <<EOP
20514 #$i_float I_FLOAT
20515 #$i_sunmath I_SUNMATH
20516 #ifdef I_FLOAT
20517 # include <float.h>
20518 #endif
20519 #ifdef I_SUNMATH
20520 # include <sunmath.h>
20521 #endif
20522 #ifdef DBL_MANT_DIG
20523 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20524 #endif
20525 #include <stdio.h>
20526 int main(int argc, char *argv[]) {
20527 #ifdef BITS
20528   printf("%d\n", BITS);
20529 #endif
20530   return 0;
20531 }
20532 EOP
20533 set try
20534 if eval $compile; then
20535     doublemantbits=`$run ./try`
20536 else
20537     doublemantbits="$undef"
20538 fi
20539 $rm_try
20540
20541 : Check the length of the longdouble mantissa
20542 $echo "Checking how many mantissa bits your long doubles have..." >&4
20543 $cat >try.c <<EOP
20544 #$i_float I_FLOAT
20545 #$i_sunmath I_SUNMATH
20546 #ifdef I_FLOAT
20547 # include <float.h>
20548 #endif
20549 #ifdef I_SUNMATH
20550 # include <sunmath.h>
20551 #endif
20552 #$d_longdbl HAS_LONG_DOUBLE
20553 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20554 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20555 /* This format has no implicit bit.  Beware, however, that for
20556  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20557  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20558  * and the top bit must have been one since 387, zero is plain invalid.
20559  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20560 #  define BITS LDBL_MANT_DIG
20561 # elif ($longdblkind == 5 || $longdblkind == 6) /* double double */
20562 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20563  * reason e.g. Irix thinks 107.  But in any case, we want only
20564  * the number of real bits, the implicit bits are of no interest.  */
20565 #  define BITS 2 * (DBL_MANT_DIG - 1)
20566 # else
20567 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20568 # endif
20569 #endif
20570 #include <stdio.h>
20571 int main(int argc, char *argv[]) {
20572 #ifdef BITS
20573   printf("%d\n", BITS);
20574 #endif
20575   return 0;
20576 }
20577 EOP
20578 set try
20579 if eval $compile; then
20580     longdblmantbits=`$run ./try`
20581 else
20582     longdblmantbits="$undef"
20583 fi
20584 $rm_try
20585
20586 : Check the length of the NV mantissa
20587 $echo "Checking how many mantissa bits your NVs have..." >&4
20588 if test "X$usequadmath" = "X$define"; then
20589   nvmantbits=112 # 128-1-15
20590 else
20591   if test "X$nvsize" = "X$doublesize"; then
20592     nvmantbits="$doublemantbits"
20593   else
20594      if test "X$nvsize" = "X$longdblsize"; then
20595        nvmantbits="$longdblmantbits"
20596      else
20597        nvmantbits="$undef"
20598      fi
20599   fi
20600 fi
20601
20602 : How can we generate normalized random numbers ?
20603 echo " "
20604 echo "Using our internal random number implementation..." >&4
20605
20606 case "$ccflags" in
20607 *-Dmy_rand=*|*-Dmy_srand=*)
20608         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20609         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20610         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20611         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20612         ;;
20613 esac
20614
20615 randfunc=Perl_drand48
20616 drand01="Perl_drand48()"
20617 seedfunc="Perl_drand48_init"
20618 randbits=48
20619 randseedtype=U32
20620
20621 : Determine if this is an EBCDIC system
20622 echo " "
20623 echo "Determining whether or not we are on an EBCDIC system..." >&4
20624 $cat >try.c <<'EOM'
20625 int main()
20626 {
20627   if ('M'==0xd4) return 0;
20628   return 1;
20629 }
20630 EOM
20631
20632 val=$undef
20633 set try
20634 if eval $compile_ok; then
20635         if $run ./try; then
20636                 echo "You seem to speak EBCDIC." >&4
20637                 val="$define"
20638         else
20639                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20640         fi
20641 else
20642         echo "I'm unable to compile the test program." >&4
20643         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20644 fi
20645 $rm_try
20646 set ebcdic
20647 eval $setvar
20648
20649 : Check how to flush
20650 echo " "
20651 $cat >&4 <<EOM
20652 Checking how to flush all pending stdio output...
20653 EOM
20654 # I only know how to find the first 32 possibly open files on SunOS.
20655 # See also hints/sunos_4_1.sh and util.c  --AD
20656 case "$osname" in
20657 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20658 esac
20659 $cat >>try.c <<EOCP
20660 #include <stdio.h>
20661 #$i_stdlib I_STDLIB
20662 #ifdef I_STDLIB
20663 #include <stdlib.h>
20664 #endif
20665 #$i_unistd I_UNISTD
20666 #ifdef I_UNISTD
20667 # include <unistd.h>
20668 #endif
20669 #$d_sysconf HAS_SYSCONF
20670 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20671 #ifdef HAS_STDIO_STREAM_ARRAY
20672 # define STDIO_STREAM_ARRAY $stdio_stream_array
20673 #endif
20674 int main() {
20675   FILE* p;
20676   unlink("try.out");
20677   p = fopen("try.out", "w");
20678 #ifdef TRY_FPUTC
20679   fputc('x', p);
20680 #else
20681 # ifdef TRY_FPRINTF
20682   fprintf(p, "x");
20683 # endif
20684 #endif
20685 #ifdef TRY_FFLUSH_NULL
20686   fflush(NULL);
20687 #endif
20688 #ifdef TRY_FFLUSH_ALL
20689   {
20690     long open_max = -1;
20691 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20692     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20693 # else
20694 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20695     open_max = sysconf(_SC_OPEN_MAX);
20696 #  else
20697 #   ifdef FOPEN_MAX
20698     open_max = FOPEN_MAX;
20699 #   else
20700 #    ifdef OPEN_MAX
20701     open_max = OPEN_MAX;
20702 #    else
20703 #     ifdef _NFILE
20704     open_max = _NFILE;
20705 #     endif
20706 #    endif
20707 #   endif
20708 #  endif
20709 # endif
20710 # ifdef HAS_STDIO_STREAM_ARRAY
20711     if (open_max > 0) {
20712       long i;
20713       for (i = 0; i < open_max; i++)
20714             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20715                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20716                 STDIO_STREAM_ARRAY[i]._flag)
20717                 fflush(&STDIO_STREAM_ARRAY[i]);
20718     }
20719   }
20720 # endif
20721 #endif
20722   _exit(42);
20723 }
20724 EOCP
20725 : first we have to find out how _not_ to flush
20726 $to try.c
20727 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20728     output=''
20729     set try -DTRY_FPUTC
20730     if eval $compile; then
20731             $run ./try 2>/dev/null
20732             code="$?"
20733             $from try.out
20734             if $test ! -s try.out -a "X$code" = X42; then
20735                 output=-DTRY_FPUTC
20736             fi
20737     fi
20738     case "$output" in
20739     '')
20740             set try -DTRY_FPRINTF
20741             if eval $compile; then
20742                     $run ./try 2>/dev/null
20743                     code="$?"
20744                     $from try.out
20745                     if $test ! -s try.out -a "X$code" = X42; then
20746                         output=-DTRY_FPRINTF
20747                     fi
20748             fi
20749         ;;
20750     esac
20751 fi
20752 : check for fflush NULL behavior
20753 case "$fflushNULL" in
20754 '')     set try -DTRY_FFLUSH_NULL $output
20755         if eval $compile; then
20756                 $run ./try 2>/dev/null
20757                 code="$?"
20758                 $from try.out
20759                 if $test -s try.out -a "X$code" = X42; then
20760                         fflushNULL="`$cat try.out`"
20761                 else
20762                         if $test "X$code" != X42; then
20763                                 $cat >&4 <<EOM
20764 (If this test failed, don't worry, we'll try another method shortly.)
20765 EOM
20766                         fi
20767                 fi
20768         fi
20769         $rm -f core try.core core.try.*
20770         case "$fflushNULL" in
20771         x)      $cat >&4 <<EOM
20772 Your fflush(NULL) works okay for output streams.
20773 Let's see if it clobbers input pipes...
20774 EOM
20775 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20776 # bug that improperly flushes the input end of pipes.  So we avoid the
20777 # autoflush on fork/system/exec support for now. :-(
20778 $cat >tryp.c <<EOCP
20779 #include <stdio.h>
20780 int
20781 main(int argc, char **argv)
20782 {
20783     char buf[1024];
20784     int i;
20785     char *bp = buf;
20786     while (1) {
20787         while ((i = getc(stdin)) != -1
20788                && (*bp++ = i) != '\n'
20789                && bp < &buf[1024])
20790         /* DO NOTHING */ ;
20791         *bp = '\0';
20792         fprintf(stdout, "%s", buf);
20793         fflush(NULL);
20794         if (i == -1)
20795             return 0;
20796         bp = buf;
20797     }
20798 }
20799 EOCP
20800                 fflushNULL="$define"
20801                 set tryp
20802                 if eval $compile; then
20803                     $rm -f tryp.out
20804                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20805                     if $test "X$targethost" != X; then
20806                         $to tryp.c
20807                         $to tryp
20808                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20809                     else
20810                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20811                     fi
20812                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20813                        $cat >&4 <<EOM
20814 fflush(NULL) seems to behave okay with input streams.
20815 EOM
20816                         fflushNULL="$define"
20817                     else
20818                         $cat >&4 <<EOM
20819 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20820 EOM
20821                         fflushNULL="$undef"
20822                     fi
20823                 fi
20824                 $rm -f core tryp.c tryp.core core.tryp.*
20825                 ;;
20826         '')     $cat >&4 <<EOM
20827 Your fflush(NULL) isn't working (contrary to ANSI C).
20828 EOM
20829                 fflushNULL="$undef"
20830                 ;;
20831         *)      $cat >&4 <<EOM
20832 Cannot figure out whether your fflush(NULL) works or not.
20833 I'm assuming it doesn't (contrary to ANSI C).
20834 EOM
20835                 fflushNULL="$undef"
20836                 ;;
20837         esac
20838         ;;
20839 $define|true|[yY]*)
20840         fflushNULL="$define"
20841         ;;
20842 *)
20843         fflushNULL="$undef"
20844         ;;
20845 esac
20846 : check explicit looping only if NULL did not work, and if the pipe
20847 : bug does not show up on an explicit flush too
20848 case "$fflushNULL" in
20849 "$undef")
20850         $cat >tryp.c <<EOCP
20851 #include <stdio.h>
20852 int
20853 main(int argc, char **argv)
20854 {
20855     char buf[1024];
20856     int i;
20857     char *bp = buf;
20858     while (1) {
20859         while ((i = getc(stdin)) != -1
20860                && (*bp++ = i) != '\n'
20861                && bp < &buf[1024])
20862         /* DO NOTHING */ ;
20863         *bp = '\0';
20864         fprintf(stdout, "%s", buf);
20865         fflush(stdin);
20866         if (i == -1)
20867             return 0;
20868         bp = buf;
20869     }
20870 }
20871 EOCP
20872         set tryp
20873         if eval $compile; then
20874             $rm -f tryp.out
20875             if $test "X$targethost" != X; then
20876                 $to tryp.c
20877                 $to tryp
20878                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20879             else
20880                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20881             fi
20882             if cmp tryp.c tryp.out >/dev/null 2>&1; then
20883                $cat >&4 <<EOM
20884 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20885 EOM
20886                 : now check for fflushall behaviour
20887                 case "$fflushall" in
20888                 '')     set try -DTRY_FFLUSH_ALL $output
20889                         if eval $compile; then
20890                                 $cat >&4 <<EOM
20891 (Now testing the other method--but note that this also may fail.)
20892 EOM
20893                                 $run ./try 2>/dev/null
20894                                 code=$?
20895                                 $from try.out
20896                                 if $test -s try.out -a "X$code" = X42; then
20897                                         fflushall="`$cat try.out`"
20898                                 fi
20899                         fi
20900                         $rm_try
20901                         case "$fflushall" in
20902                         x)      $cat >&4 <<EOM
20903 Whew. Flushing explicitly all the stdio streams works.
20904 EOM
20905                                 fflushall="$define"
20906                                 ;;
20907                         '')     $cat >&4 <<EOM
20908 Sigh. Flushing explicitly all the stdio streams doesn't work.
20909 EOM
20910                                 fflushall="$undef"
20911                                 ;;
20912                         *)      $cat >&4 <<EOM
20913 Cannot figure out whether flushing stdio streams explicitly works or not.
20914 I'm assuming it doesn't.
20915 EOM
20916                                 fflushall="$undef"
20917                                 ;;
20918                         esac
20919                         ;;
20920                 "$define"|true|[yY]*)
20921                         fflushall="$define"
20922                         ;;
20923                 *)
20924                         fflushall="$undef"
20925                         ;;
20926                 esac
20927             else
20928                 $cat >&4 <<EOM
20929 All is futile.  Even fflush(stdin) clobbers input pipes!
20930 EOM
20931                 fflushall="$undef"
20932             fi
20933         else
20934             fflushall="$undef"
20935         fi
20936         $rm -f core tryp.c tryp.core core.tryp.*
20937         ;;
20938 *)      fflushall="$undef"
20939         ;;
20940 esac
20941
20942 case "$fflushNULL$fflushall" in
20943 undefundef)
20944         $cat <<EOM
20945 OK, I give up.  I cannot figure out how to flush pending stdio output.
20946 We won't be flushing handles at all before fork/exec/popen.
20947 EOM
20948         ;;
20949 esac
20950 $rm_try tryp
20951
20952 : Store the full pathname to the ar program for use in the C program
20953 : Respect a hint or command line value for full_ar.
20954 case "$full_ar" in
20955 '') full_ar=$ar ;;
20956 esac
20957
20958 : Store the full pathname to the sed program for use in the C program
20959 full_sed=$sed
20960
20961 : see what type gids are declared as in the kernel
20962 echo " "
20963 echo "Looking for the type for group ids returned by getgid()."
20964 set gid_t gidtype xxx stdio.h sys/types.h
20965 eval $typedef
20966 case "$gidtype" in
20967 xxx)
20968         xxx=`./findhdr sys/user.h`
20969         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
20970         case $1 in
20971         unsigned) dflt="$1 $2" ;;
20972         *) dflt="$1" ;;
20973         esac
20974         ;;
20975 *) dflt="$gidtype";;
20976 esac
20977 case "$gidtype" in
20978 gid_t) echo "gid_t found." ;;
20979 *)      rp="What is the type for group ids returned by getgid()?"
20980         . ./myread
20981         gidtype="$ans"
20982         ;;
20983 esac
20984
20985 : Check the size of GID
20986 echo " "
20987 case "$gidtype" in
20988 *_t) zzz="$gidtype"     ;;
20989 *)   zzz="gid"          ;;
20990 esac
20991 echo "Checking the size of $zzz..." >&4
20992 cat > try.c <<EOCP
20993 #include <sys/types.h>
20994 #include <stdio.h>
20995 #$i_stdlib I_STDLIB
20996 #ifdef I_STDLIB
20997 #include <stdlib.h>
20998 #endif
20999 int main() {
21000     printf("%d\n", (int)sizeof($gidtype));
21001     exit(0);
21002 }
21003 EOCP
21004 set try
21005 if eval $compile_ok; then
21006         yyy=`$run ./try`
21007         case "$yyy" in
21008         '')     gidsize=4
21009                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
21010                 ;;
21011         *)      gidsize=$yyy
21012                 echo "Your $zzz is $gidsize bytes long."
21013                 ;;
21014         esac
21015 else
21016         gidsize=4
21017         echo "(I can't compile the test program--guessing $gidsize.)" >&4
21018 fi
21019
21020
21021 : Check if GID is signed
21022 echo " "
21023 case "$gidtype" in
21024 *_t) zzz="$gidtype"     ;;
21025 *)   zzz="gid"          ;;
21026 esac
21027 echo "Checking the sign of $zzz..." >&4
21028 cat > try.c <<EOCP
21029 #include <sys/types.h>
21030 #include <stdio.h>
21031 int main() {
21032         $gidtype foo = -1;
21033         if (foo < 0)
21034                 printf("-1\n");
21035         else
21036                 printf("1\n");
21037 }
21038 EOCP
21039 set try
21040 if eval $compile; then
21041         yyy=`$run ./try`
21042         case "$yyy" in
21043         '')     gidsign=1
21044                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21045                 ;;
21046         *)      gidsign=$yyy
21047                 case "$gidsign" in
21048                  1) echo "Your $zzz is unsigned." ;;
21049                 -1) echo "Your $zzz is signed."   ;;
21050                 esac
21051                 ;;
21052         esac
21053 else
21054         gidsign=1
21055         echo "(I can't compile the test program--guessing unsigned.)" >&4
21056 fi
21057
21058
21059 : Check 64bit sizes
21060 echo " "
21061
21062 if $test X"$quadtype" != X; then
21063
21064 echo "Checking how to print 64-bit integers..." >&4
21065
21066 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21067         $cat >try.c <<'EOCP'
21068 #include <sys/types.h>
21069 #include <stdio.h>
21070 int main() {
21071   int q = 12345678901;
21072   printf("%ld\n", q);
21073 }
21074 EOCP
21075         set try
21076         if eval $compile; then
21077                 yyy=`$run ./try`
21078                 case "$yyy" in
21079                 12345678901)
21080                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21081                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21082                         echo "We will use %d."
21083                         ;;
21084                 esac
21085         fi
21086 fi
21087
21088 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21089         $cat >try.c <<'EOCP'
21090 #include <sys/types.h>
21091 #include <stdio.h>
21092 int main() {
21093   long q = 12345678901;
21094   printf("%ld\n", q);
21095 }
21096 EOCP
21097         set try
21098         if eval $compile; then
21099                 yyy=`$run ./try`
21100                 case "$yyy" in
21101                 12345678901)
21102                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21103                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21104                         echo "We will use %ld."
21105                         ;;
21106                 esac
21107         fi
21108 fi
21109
21110 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21111         $cat >try.c <<'EOCP'
21112 #include <sys/types.h>
21113 #include <inttypes.h>
21114 #include <stdio.h>
21115 int main() {
21116   int64_t q = 12345678901;
21117   printf("%" PRId64 "\n", q);
21118 }
21119 EOCP
21120         set try
21121         if eval $compile; then
21122                 yyy=`$run ./try`
21123                 case "$yyy" in
21124                 12345678901)
21125                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21126                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
21127                         echo "We will use the C9X style."
21128                         ;;
21129                 esac
21130         fi
21131 fi
21132
21133 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21134         $cat >try.c <<EOCP
21135 #include <sys/types.h>
21136 #include <stdio.h>
21137 int main() {
21138   $quadtype q = 12345678901;
21139   printf("%Ld\n", q);
21140 }
21141 EOCP
21142         set try
21143         if eval $compile; then
21144                 yyy=`$run ./try`
21145                 case "$yyy" in
21146                 12345678901)
21147                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21148                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21149                         echo "We will use %Ld."
21150                         ;;
21151                 esac
21152         fi
21153 fi
21154
21155 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21156         $cat >try.c <<'EOCP'
21157 #include <sys/types.h>
21158 #include <stdio.h>
21159 int main() {
21160   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21161   printf("%lld\n", q);
21162 }
21163 EOCP
21164         set try
21165         if eval $compile; then
21166                 yyy=`$run ./try`
21167                 case "$yyy" in
21168                 12345678901)
21169                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21170                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21171                         echo "We will use the %lld style."
21172                         ;;
21173                 esac
21174         fi
21175 fi
21176
21177 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21178         $cat >try.c <<EOCP
21179 #include <sys/types.h>
21180 #include <stdio.h>
21181 int main() {
21182   $quadtype q = 12345678901;
21183   printf("%qd\n", q);
21184 }
21185 EOCP
21186         set try
21187         if eval $compile; then
21188                 yyy=`$run ./try`
21189                 case "$yyy" in
21190                 12345678901)
21191                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21192                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21193                         echo "We will use %qd."
21194                         ;;
21195                 esac
21196         fi
21197 fi
21198
21199 if $test X"$sPRId64" = X; then
21200         echo "Cannot figure out how to print 64-bit integers." >&4
21201 fi
21202 $rm_try
21203
21204 fi
21205
21206 case "$sPRId64" in
21207 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21208         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21209         ;;
21210 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21211         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21212         ;;
21213 esac
21214
21215 : Check format strings for internal types
21216 echo " "
21217 $echo "Checking the format strings to be used for Perl's internal types..." >&4
21218
21219 if $test X"$ivsize" = X8; then
21220         ivdformat="$sPRId64"
21221         uvuformat="$sPRIu64"
21222         uvoformat="$sPRIo64"
21223         uvxformat="$sPRIx64"
21224         uvXUformat="$sPRIXU64"
21225 else
21226         if $test X"$ivsize" = X"$longsize"; then
21227                 ivdformat='"ld"'
21228                 uvuformat='"lu"'
21229                 uvoformat='"lo"'
21230                 uvxformat='"lx"'
21231                 uvXUformat='"lX"'
21232         else
21233                 if $test X"$ivsize" = X"$intsize"; then
21234                         ivdformat='"d"'
21235                         uvuformat='"u"'
21236                         uvoformat='"o"'
21237                         uvxformat='"x"'
21238                         uvXUformat='"X"'
21239                 else
21240                         : far out
21241                         if $test X"$ivsize" = X"$shortsize"; then
21242                                 ivdformat='"hd"'
21243                                 uvuformat='"hu"'
21244                                 uvoformat='"ho"'
21245                                 uvxformat='"hx"'
21246                                 uvXUformat='"hX"'
21247                         fi
21248                 fi
21249         fi
21250 fi
21251
21252 if $test X"$usequadmath" = X"$define"; then
21253     nveformat='"Qe"'
21254     nvfformat='"Qf"'
21255     nvgformat='"Qg"'
21256     nvEUformat='"QE"'
21257     nvFUformat='"QF"'
21258     nvGUformat='"QG"'
21259 else
21260     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21261         nveformat="$sPRIeldbl"
21262         nvfformat="$sPRIfldbl"
21263         nvgformat="$sPRIgldbl"
21264         nvEUformat="$sPRIEUldbl"
21265         nvFUformat="$sPRIFUldbl"
21266         nvGUformat="$sPRIGUldbl"
21267     else
21268         nveformat='"e"'
21269         nvfformat='"f"'
21270         nvgformat='"g"'
21271         nvEUformat='"E"'
21272         nvFUformat='"F"'
21273         nvGUformat='"G"'
21274     fi
21275 fi
21276
21277 case "$ivdformat" in
21278 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21279     exit 1
21280     ;;
21281 esac
21282
21283 : Check format string for GID
21284
21285 echo " "
21286 $echo "Checking the format string to be used for gids..." >&4
21287
21288 case "$gidsign" in
21289 -1)     if $test X"$gidsize" = X"$ivsize"; then
21290                 gidformat="$ivdformat"
21291         else
21292                 if $test X"$gidsize" = X"$longsize"; then
21293                         gidformat='"ld"'
21294                 else
21295                         if $test X"$gidsize" = X"$intsize"; then
21296                                 gidformat='"d"'
21297                         else
21298                                 if $test X"$gidsize" = X"$shortsize"; then
21299                                         gidformat='"hd"'
21300                                 fi
21301                         fi
21302                 fi
21303         fi
21304         ;;
21305 *)      if $test X"$gidsize" = X"$uvsize"; then
21306                 gidformat="$uvuformat"
21307         else
21308                 if $test X"$gidsize" = X"$longsize"; then
21309                         gidformat='"lu"'
21310                 else
21311                         if $test X"$gidsize" = X"$intsize"; then
21312                                 gidformat='"u"'
21313                         else
21314                                 if $test X"$gidsize" = X"$shortsize"; then
21315                                         gidformat='"hu"'
21316                                 fi
21317                         fi
21318                 fi
21319         fi
21320         ;;
21321 esac
21322
21323 : see if getgroups exists
21324 set getgroups d_getgrps
21325 eval $inlibc
21326
21327 : see if setgroups exists
21328 set setgroups d_setgrps
21329 eval $inlibc
21330
21331 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21332 echo " "
21333 case "$d_getgrps$d_setgrps" in
21334 *define*)
21335         case "$groupstype" in
21336         '') dflt="$gidtype" ;;
21337         *)  dflt="$groupstype" ;;
21338         esac
21339         $cat <<EOM
21340 What type of pointer is the second argument to getgroups() and setgroups()?
21341 Usually this is the same as group ids, $gidtype, but not always.
21342
21343 EOM
21344         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21345         . ./myread
21346         groupstype="$ans"
21347         ;;
21348 *)  groupstype="$gidtype";;
21349 esac
21350
21351 : check whether make sets MAKE
21352 echo " "
21353 echo "Checking if your $make program sets \$(MAKE)..." >&4
21354 case "$make_set_make" in
21355 '')
21356         $sed 's/^X //' > testmake.mak << 'EOF'
21357 Xall:
21358 X       @echo 'maketemp="$(MAKE)"'
21359 EOF
21360         case "`$make -f testmake.mak 2>/dev/null`" in
21361         *maketemp=*) make_set_make='#' ;;
21362         *)      make_set_make="MAKE=$make" ;;
21363         esac
21364         $rm -f testmake.mak
21365         ;;
21366 esac
21367 case "$make_set_make" in
21368 '#') echo "Yup, it does.";;
21369 *) echo "Nope, it doesn't.";;
21370 esac
21371
21372 : see what type is used for mode_t
21373 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21374 set mode_t modetype int stdio.h sys/types.h
21375 eval $typedef_ask
21376
21377 : see if we need va_copy
21378 echo " "
21379 case "$i_stdarg" in
21380 "$define")
21381         $cat >try.c <<EOCP
21382 #include <stdarg.h>
21383 #include <stdio.h>
21384 #$i_stdlib I_STDLIB
21385 #ifdef I_STDLIB
21386 #include <stdlib.h>
21387 #endif
21388 #include <signal.h>
21389
21390 int
21391 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21392 {
21393   return vfprintf(f, fmt, *valp);
21394 }
21395
21396 int
21397 myvfprintf(FILE *f, const  char *fmt, va_list val)
21398 {
21399   return ivfprintf(f, fmt, &val);
21400 }
21401
21402 int
21403 myprintf(char *fmt, ...)
21404 {
21405   va_list val;
21406   va_start(val, fmt);
21407   return myvfprintf(stdout, fmt, val);
21408 }
21409
21410 int
21411 main(int ac, char **av)
21412 {
21413   signal(SIGSEGV, exit);
21414
21415   myprintf("%s%cs all right, then\n", "that", '\'');
21416   exit(0);
21417 }
21418 EOCP
21419         set try
21420         if eval $compile && $run ./try 2>&1 >/dev/null; then
21421                 case "`$run ./try`" in
21422                 "that's all right, then")
21423                         okay=yes
21424                         ;;
21425                 esac
21426         fi
21427         case "$okay" in
21428         yes)    echo "It seems that you don't need va_copy()." >&4
21429                 need_va_copy="$undef"
21430                 ;;
21431         *)      echo "It seems that va_copy() or similar will be needed." >&4
21432                 need_va_copy="$define"
21433                 ;;
21434         esac
21435         $rm_try
21436         ;;
21437 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
21438         need_va_copy="$undef"
21439         ;;
21440 esac
21441
21442 : see what type is used for size_t
21443 rp="What is the type used for the length parameter for string functions?"
21444 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21445 eval $typedef_ask
21446
21447 : check for type of arguments to gethostbyaddr.
21448 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21449         case "$d_gethbyaddr" in
21450         $define)
21451                 $cat <<EOM
21452
21453 Checking to see what type of arguments are accepted by gethostbyaddr().
21454 EOM
21455                 hdrs="$define sys/types.h
21456                         $d_socket sys/socket.h
21457                         $i_niin netinet/in.h
21458                         $i_netdb netdb.h
21459                         $i_unistd unistd.h"
21460                 : The first arg can 'char *' or 'void *'
21461                 : The second arg is some of integral type
21462                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21463                         for yyy in size_t long int; do
21464                                 case "$netdb_host_type" in
21465                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21466                                         if ./protochk "$try" $hdrs; then
21467                                                 echo "Your system accepts $xxx for the first arg."
21468                                                 echo "...and $yyy for the second arg."
21469                                                 netdb_host_type="$xxx"
21470                                                 netdb_hlen_type="$yyy"
21471                                         fi
21472                                         ;;
21473                                 esac
21474                         done
21475                 done
21476                 : In case none of those worked, prompt the user.
21477                 case "$netdb_host_type" in
21478                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21479                         dflt='char *'
21480                         . ./myread
21481                         netdb_host_type=$ans
21482                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21483                         dflt="$sizetype"
21484                         . ./myread
21485                         netdb_hlen_type=$ans
21486                         ;;
21487                 esac
21488                 ;;
21489         *)      : no gethostbyaddr, so pick harmless defaults
21490                 netdb_host_type='char *'
21491                 netdb_hlen_type="$sizetype"
21492                 ;;
21493         esac
21494         # Remove the "const" if needed. -- but then we'll have a
21495         # prototype clash!
21496         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21497 fi
21498
21499 : check for type of argument to gethostbyname.
21500 if test "X$netdb_name_type" = X ; then
21501         case "$d_gethbyname" in
21502         $define)
21503                 $cat <<EOM
21504
21505 Checking to see what type of argument is accepted by gethostbyname().
21506 EOM
21507                 hdrs="$define sys/types.h
21508                         $d_socket sys/socket.h
21509                         $i_niin netinet/in.h
21510                         $i_netdb netdb.h
21511                         $i_unistd unistd.h"
21512                 for xxx in "const char *" "char *"; do
21513                         case "$netdb_name_type" in
21514                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21515                                 if ./protochk "$try" $hdrs; then
21516                                         echo "Your system accepts $xxx."
21517                                         netdb_name_type="$xxx"
21518                                 fi
21519                                 ;;
21520                         esac
21521                 done
21522                 : In case none of those worked, prompt the user.
21523                 case "$netdb_name_type" in
21524                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21525                         dflt='char *'
21526                         . ./myread
21527                         netdb_name_type=$ans
21528                         ;;
21529                 esac
21530                 ;;
21531         *)      : no gethostbyname, so pick harmless default
21532                 netdb_name_type='char *'
21533                 ;;
21534         esac
21535 fi
21536
21537 : check for type of 1st argument to getnetbyaddr.
21538 if test "X$netdb_net_type" = X ; then
21539         case "$d_getnbyaddr" in
21540         $define)
21541                 $cat <<EOM
21542
21543 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21544 EOM
21545                 hdrs="$define sys/types.h
21546                         $d_socket sys/socket.h
21547                         $i_niin netinet/in.h
21548                         $i_netdb netdb.h
21549                         $i_unistd unistd.h"
21550                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21551                         case "$netdb_net_type" in
21552                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21553                                 if ./protochk "$try" $hdrs; then
21554                                         echo "Your system accepts $xxx."
21555                                         netdb_net_type="$xxx"
21556                                 fi
21557                                 ;;
21558                         esac
21559                 done
21560                 : In case none of those worked, prompt the user.
21561                 case "$netdb_net_type" in
21562                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21563                         dflt='long'
21564                         . ./myread
21565                         netdb_net_type=$ans
21566                         ;;
21567                 esac
21568                 ;;
21569         *)      : no getnetbyaddr, so pick harmless default
21570                 netdb_net_type='long'
21571                 ;;
21572         esac
21573 fi
21574 : locate the preferred pager for this system
21575 fn=f/
21576 case "$pager" in
21577 '')
21578         dflt=''
21579         case "$pg" in
21580         /*) dflt=$pg;;
21581         [a-zA-Z]:/*) dflt=$pg;;
21582         esac
21583         case "$more" in
21584         /*) dflt=$more;;
21585         [a-zA-Z]:/*) dflt=$more;;
21586         esac
21587         case "$less" in
21588         /*) dflt=$less;;
21589         [a-zA-Z]:/*) dflt=$less;;
21590         esac
21591         case "$dflt" in
21592         '') dflt=/usr/ucb/more;;
21593         esac
21594         ;;
21595 *)      dflt="$pager"
21596         ;;
21597 esac
21598 fn="f/($dflt)"
21599 echo " "
21600 rp='What pager is used on your system?'
21601 . ./getfile
21602 pager="$ans"
21603
21604 : see what type pids are declared as in the kernel
21605 rp="What is the type of process ids on this system?"
21606 set pid_t pidtype int stdio.h sys/types.h
21607 eval $typedef_ask
21608
21609 : see if ar generates random libraries by itself
21610 echo " "
21611 echo "Checking how to generate random libraries on your machine..." >&4
21612 echo 'int bar1() { return bar2(); }' > bar1.c
21613 echo 'int bar2() { return 2; }' > bar2.c
21614 $cat > foo.c <<EOP
21615 #$i_stdlib I_STDLIB
21616 #ifdef I_STDLIB
21617 #include <stdlib.h>
21618 #endif
21619 int main() { printf("%d\n", bar1()); exit(0); }
21620 EOP
21621 $cc $ccflags -c bar1.c >/dev/null 2>&1
21622 $cc $ccflags -c bar2.c >/dev/null 2>&1
21623 $cc $ccflags -c foo.c >/dev/null 2>&1
21624 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21625 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21626         $run ./foobar >/dev/null 2>&1; then
21627         echo "$ar appears to generate random libraries itself."
21628         orderlib=false
21629         if [ "X$ranlib" = "X" ]; then
21630             ranlib=":"
21631         fi
21632 elif $ar s bar$_a >/dev/null 2>&1 &&
21633         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21634         $run ./foobar >/dev/null 2>&1; then
21635                 echo "a table of contents needs to be added with '$ar s'."
21636                 orderlib=false
21637                 ranlib="$ar s"
21638 elif $ar ts bar$_a >/dev/null 2>&1 &&
21639         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21640         $run ./foobar >/dev/null 2>&1; then
21641                 echo "a table of contents needs to be added with '$ar ts'."
21642                 orderlib=false
21643                 ranlib="$ar ts"
21644 else
21645         case "$ranlib" in
21646         :) ranlib='';;
21647         '')
21648                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21649                 $test -f $ranlib || ranlib=''
21650                 ;;
21651         esac
21652         if $test -n "$ranlib"; then
21653                 echo "your system has '$ranlib'; we'll use that."
21654                 orderlib=false
21655         else
21656                 echo "your system doesn't seem to support random libraries"
21657                 echo "so we'll use lorder and tsort to order the libraries."
21658                 orderlib=true
21659                 ranlib=":"
21660         fi
21661 fi
21662 $rm -f foo* bar*
21663
21664 : see if this is a values.h system
21665 set values.h i_values
21666 eval $inhdr
21667
21668 : Check the max offset that gmtime and localtime accept
21669 echo "Checking max offsets that gmtime () accepts"
21670
21671 case $i_values in
21672     define) yyy="#include <values.h>" ;;
21673     *)      yyy="" ;;
21674     esac
21675
21676 case "$sGMTIME_min/$sGMTIME_max" in
21677     0/0|/)
21678         $cat >try.c <<EOCP
21679 #include <sys/types.h>
21680 #include <stdio.h>
21681 #include <time.h>
21682 $yyy
21683
21684 int i;
21685 struct tm *tmp;
21686 time_t pt;
21687
21688 void gm_check (time_t t, int min_year, int max_year)
21689 {
21690     tmp = gmtime (&t);
21691     if ( tmp == NULL ||
21692         /* Check tm_year overflow */
21693          tmp->tm_year < min_year || tmp->tm_year > max_year)
21694         tmp = NULL;
21695     else
21696         pt = t;
21697     } /* gm_check */
21698
21699 int check_max ()
21700 {
21701     tmp = NULL;
21702     pt  = 0;
21703 #ifdef MAXLONG
21704     gm_check (MAXLONG, 69, 0x7fffffff);
21705 #endif
21706     if (tmp == NULL || tmp->tm_year < 0) {
21707         for (i = 63; i >= 0; i--) {
21708             time_t x = pt | ((time_t)1 << i);
21709             if (x < 0 || x < pt) continue;
21710             gm_check (x, 69, 0x7fffffff);
21711             }
21712         }
21713     printf ("sGMTIME_max=%ld\n", pt);
21714     return (0);
21715     } /* check_max */
21716
21717 int check_min ()
21718 {
21719     tmp = NULL;
21720     pt  = 0;
21721 #ifdef MINLONG
21722     gm_check (MINLONG, -1900, 70);
21723 #endif
21724     if (tmp == NULL) {
21725         for (i = 36; i >= 0; i--) {
21726             time_t x = pt - ((time_t)1 << i);
21727             if (x > 0) continue;
21728             gm_check (x, -1900, 70);
21729             }
21730         }
21731     printf ("sGMTIME_min=%ld\n", pt);
21732     return (0);
21733     } /* check_min */
21734
21735 int main (int argc, char *argv[])
21736 {
21737     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21738     check_max ();
21739     check_min ();
21740     return (0);
21741     } /* main */
21742 EOCP
21743         set try
21744         if eval $compile; then
21745             eval `$run ./try 2>/dev/null`
21746         else
21747             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21748             fi
21749         $rm_try
21750         ;;
21751     esac
21752
21753 echo "Checking max offsets that localtime () accepts"
21754
21755 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21756     0/0|/)
21757         $cat >try.c <<EOCP
21758 #include <sys/types.h>
21759 #include <stdio.h>
21760 #include <time.h>
21761 $yyy
21762
21763 int i;
21764 struct tm *tmp;
21765 time_t pt;
21766
21767 void local_check (time_t t, int min_year, int max_year)
21768 {
21769     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21770         tmp = NULL;
21771     else
21772         tmp = localtime (&t);
21773     if ( tmp == NULL ||
21774         /* Check tm_year overflow */
21775          tmp->tm_year < min_year || tmp->tm_year > max_year)
21776         tmp = NULL;
21777     else
21778         pt = t;
21779     } /* local_check */
21780
21781 int check_max ()
21782 {
21783     tmp = NULL;
21784     pt  = 0;
21785 #ifdef MAXLONG
21786     local_check (MAXLONG, 69, 0x7fffffff);
21787 #endif
21788     if (tmp == NULL || tmp->tm_year < 0) {
21789         for (i = 63; i >= 0; i--) {
21790             time_t x = pt | ((time_t)1 << i);
21791             if (x < 0 || x < pt) continue;
21792             local_check (x, 69, 0x7fffffff);
21793             }
21794         }
21795     printf ("sLOCALTIME_max=%ld\n", pt);
21796     return (0);
21797    } /* check_max */
21798
21799 int check_min ()
21800 {
21801     tmp = NULL;
21802     pt  = 0;
21803 #ifdef MINLONG
21804     local_check (MINLONG, -1900, 70);
21805 #endif
21806     if (tmp == NULL) {
21807         for (i = 36; i >= 0; i--) {
21808             time_t x = pt - ((time_t)1 << i);
21809             if (x > 0) continue;
21810             local_check (x, -1900, 70);
21811             }
21812         }
21813     printf ("sLOCALTIME_min=%ld\n", pt);
21814     return (0);
21815     } /* check_min */
21816
21817 int main (int argc, char *argv[])
21818 {
21819     check_max ();
21820     check_min ();
21821     return (0);
21822     } /* main */
21823 EOCP
21824         set try
21825         if eval $compile; then
21826             eval `$run ./try 2>/dev/null`
21827         else
21828             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21829             fi
21830         $rm_try
21831         ;;
21832     esac
21833
21834 : check for type of arguments to select.
21835 case "$selecttype" in
21836 '') case "$d_select" in
21837         $define)
21838                 echo " "
21839                 $cat <<EOM
21840 Checking to see what type of arguments are accepted by select().
21841 EOM
21842                 hdrs="$define sys/types.h
21843                         $i_systime sys/time.h
21844                         $i_sysselct sys/select.h
21845                         $d_socket sys/socket.h"
21846                 : The first arg can be int, unsigned, or size_t
21847                 : The last arg may or may not be 'const'
21848                 val=''
21849                 : void pointer has been seen but using that
21850                 : breaks the selectminbits test
21851                 for xxx in 'fd_set *' 'int *'; do
21852                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21853                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
21854                                         case "$val" in
21855                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21856                                                 if ./protochk "$try" $hdrs; then
21857                                                         echo "Your system accepts $xxx."
21858                                                         val="$xxx"
21859                                                 fi
21860                                                 ;;
21861                                         esac
21862                                 done
21863                         done
21864                 done
21865                 case "$val" in
21866                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21867                         case "$d_fd_set" in
21868                                 $define) dflt="fd_set *" ;;
21869                                 *)              dflt="int *" ;;
21870                         esac
21871                         . ./myread
21872                         val=$ans
21873                         ;;
21874                 esac
21875                 selecttype="$val"
21876                 ;;
21877         *)      : no select, so pick a harmless default
21878                 selecttype='int *'
21879                 ;;
21880         esac
21881         ;;
21882 esac
21883
21884 : check for the select 'width'
21885 case "$selectminbits" in
21886 '') safebits=`expr $ptrsize \* 8`
21887     case "$d_select" in
21888         $define)
21889                 $cat <<EOM
21890
21891 Checking to see on how many bits at a time your select() operates...
21892 EOM
21893                 $cat >try.c <<EOCP
21894 #include <sys/types.h>
21895 #$i_time I_TIME
21896 #$i_systime I_SYS_TIME
21897 #$i_systimek I_SYS_TIME_KERNEL
21898 #ifdef I_TIME
21899 #   include <time.h>
21900 #endif
21901 #ifdef I_SYS_TIME
21902 #   ifdef I_SYS_TIME_KERNEL
21903 #       define KERNEL
21904 #   endif
21905 #   include <sys/time.h>
21906 #   ifdef I_SYS_TIME_KERNEL
21907 #       undef KERNEL
21908 #   endif
21909 #endif
21910 #$i_sysselct I_SYS_SELECT
21911 #ifdef I_SYS_SELECT
21912 #include <sys/select.h>
21913 #endif
21914 #$d_socket HAS_SOCKET
21915 #ifdef HAS_SOCKET
21916 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21917 #endif
21918 #include <stdio.h>
21919 #$i_stdlib I_STDLIB
21920 #ifdef I_STDLIB
21921 #include <stdlib.h>
21922 #endif
21923 $selecttype b;
21924 #define S sizeof(*(b))
21925 #define MINBITS 64
21926 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21927 #define NBITS  (NBYTES * 8)
21928 int main() {
21929     char *s = (char *)malloc(NBYTES);
21930     struct timeval t;
21931     int i;
21932     FILE* fp;
21933     int fd;
21934
21935     if (!s)
21936         exit(1);
21937     fclose(stdin);
21938     fp = fopen("try.c", "r");
21939     if (fp == 0)
21940       exit(2);
21941     fd = fileno(fp);
21942     if (fd < 0)
21943       exit(3);
21944     b = ($selecttype)s;
21945     for (i = 0; i < NBITS; i++)
21946         FD_SET(i, b);
21947     t.tv_sec  = 0;
21948     t.tv_usec = 0;
21949     select(fd + 1, b, 0, 0, &t);
21950     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
21951     free(s);
21952     printf("%d\n", i + 1);
21953     return 0;
21954 }
21955 EOCP
21956                 set try
21957                 if eval $compile_ok; then
21958                         selectminbits=`$run ./try 2>/dev/null`
21959                         case "$selectminbits" in
21960                         '')     cat >&4 <<EOM
21961 Cannot figure out on how many bits at a time your select() operates.
21962 I'll play safe and guess it is $safebits bits.
21963 EOM
21964                                 selectminbits=$safebits
21965                                 bits="$safebits bits"
21966                                 ;;
21967                         1)      bits="1 bit" ;;
21968                         *)      bits="$selectminbits bits" ;;
21969                         esac
21970                         echo "Your select() operates on $bits at a time." >&4
21971                 else
21972                         rp='What is the minimum number of bits your select() operates on?'
21973                         case "$byteorder" in
21974                         12345678)       dflt=64 ;;
21975                         1234)           dflt=32 ;;
21976                         *)              dflt=1  ;;
21977                         esac
21978                         . ./myread
21979                         val=$ans
21980                         selectminbits="$val"
21981                 fi
21982                 $rm_try
21983                 ;;
21984         *)      : no select, so pick a harmless default
21985                 selectminbits=$safebits
21986                 ;;
21987         esac
21988         ;;
21989 esac
21990
21991 : Trace out the files included by signal.h, then look for SIGxxx names.
21992 if [ "X$fieldn" = X ]; then
21993         : Just make some guesses.  We check them later.
21994         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
21995 else
21996         xxx=`echo '#include <signal.h>' |
21997         $cppstdin $cppminus $cppflags 2>/dev/null |
21998         $grep '^[       ]*#.*include' |
21999         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
22000                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
22001 fi
22002 xxxfiles=''
22003 for xx in $xxx /dev/null ; do
22004         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
22005 done
22006 case "$xxxfiles" in
22007 '')     xxxfiles=`./findhdr signal.h` ;;
22008 esac
22009 xxx=`awk '
22010 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
22011         print substr($2, 4, 20)
22012 }
22013 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
22014         print substr($3, 4, 20)
22015 }' $xxxfiles`
22016 : Append some common names just in case the awk scan failed.
22017 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22018 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22019 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22020 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22021 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22022
22023 : generate a few handy files for later
22024 $cat > signal.c <<EOCP
22025 #include <sys/types.h>
22026 #include <signal.h>
22027 #$i_stdlib I_STDLIB
22028 #ifdef I_STDLIB
22029 #include <stdlib.h>
22030 #endif
22031 #include <stdio.h>
22032 int main() {
22033
22034 /* Strange style to avoid deeply-nested #if/#else/#endif */
22035 #ifndef NSIG
22036 #  ifdef _NSIG
22037 #    define NSIG (_NSIG)
22038 #  endif
22039 #endif
22040
22041 #ifndef NSIG
22042 #  ifdef SIGMAX
22043 #    define NSIG (SIGMAX+1)
22044 #  endif
22045 #endif
22046
22047 #ifndef NSIG
22048 #  ifdef SIG_MAX
22049 #    define NSIG (SIG_MAX+1)
22050 #  endif
22051 #endif
22052
22053 #ifndef NSIG
22054 #  ifdef _SIG_MAX
22055 #    define NSIG (_SIG_MAX+1)
22056 #  endif
22057 #endif
22058
22059 #ifndef NSIG
22060 #  ifdef MAXSIG
22061 #    define NSIG (MAXSIG+1)
22062 #  endif
22063 #endif
22064
22065 #ifndef NSIG
22066 #  ifdef MAX_SIG
22067 #    define NSIG (MAX_SIG+1)
22068 #  endif
22069 #endif
22070
22071 #ifndef NSIG
22072 #  ifdef SIGARRAYSIZE
22073 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22074 #  endif
22075 #endif
22076
22077 #ifndef NSIG
22078 #  ifdef _sys_nsig
22079 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
22080 #  endif
22081 #endif
22082
22083 /* Default to some arbitrary number that's big enough to get most
22084    of the common signals.
22085 */
22086 #ifndef NSIG
22087 #    define NSIG 50
22088 #endif
22089
22090 printf("NSIG %d\n", NSIG);
22091
22092 #ifndef JUST_NSIG
22093
22094 EOCP
22095
22096 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22097 {
22098         printf "#ifdef SIG"; printf $1; printf "\n"
22099         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22100         printf $1; printf ");\n"
22101         printf "#endif\n"
22102 }
22103 END {
22104         printf "#endif /* JUST_NSIG */\n";
22105         printf "exit(0);\n}\n";
22106 }
22107 ' >>signal.c
22108 $cat >signal.awk <<'EOP'
22109 BEGIN { ndups = 0 }
22110 $1 ~ /^NSIG$/ { nsig = $2 }
22111 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22112     if ($2 > maxsig) { maxsig = $2 }
22113     if (sig_name[$2]) {
22114         dup_name[ndups] = $1
22115         dup_num[ndups] = $2
22116         ndups++
22117     }
22118     else {
22119         sig_name[$2] = $1
22120         sig_num[$2] = $2
22121     }
22122 }
22123 END {
22124     if (nsig == 0) {
22125         nsig = maxsig + 1
22126     }
22127     printf("NSIG %d\n", nsig);
22128     for (n = 1; n < nsig; n++) {
22129         if (sig_name[n]) {
22130             printf("%s %d\n", sig_name[n], sig_num[n])
22131         }
22132         else {
22133             printf("NUM%d %d\n", n, n)
22134         }
22135     }
22136     for (n = 0; n < ndups; n++) {
22137         printf("%s %d\n", dup_name[n], dup_num[n])
22138     }
22139 }
22140 EOP
22141 $cat >signal_cmd <<EOS
22142 $startsh
22143 if $test -s signal.lst; then
22144     echo "Using your existing signal.lst file"
22145         exit 0
22146 fi
22147 xxx="$xxx"
22148 EOS
22149 $cat >>signal_cmd <<'EOS'
22150
22151 set signal
22152 if eval $compile_ok; then
22153         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22154                 $uniq | $awk -f signal.awk >signal.lst
22155 else
22156         echo "(I can't seem be able to compile the whole test program)" >&4
22157         echo "(I'll try it in little pieces.)" >&4
22158         set signal -DJUST_NSIG
22159         if eval $compile_ok; then
22160                 $run ./signal$_exe > signal.nsg
22161                 $cat signal.nsg
22162         else
22163                 echo "I can't seem to figure out how many signals you have." >&4
22164                 echo "Guessing 50." >&4
22165                 echo 'NSIG 50' > signal.nsg
22166         fi
22167         : Now look at all the signal names, one at a time.
22168         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22169                 $cat > signal.c <<EOCP
22170 #include <sys/types.h>
22171 #include <signal.h>
22172 #include <stdio.h>
22173 int main() {
22174 printf("$xx %d\n", SIG${xx});
22175 return 0;
22176 }
22177 EOCP
22178                 set signal
22179                 if eval $compile; then
22180                         echo "SIG${xx} found."
22181                         $run ./signal$_exe  >> signal.ls1
22182                 else
22183                         echo "SIG${xx} NOT found."
22184                 fi
22185         done
22186         if $test -s signal.ls1; then
22187                 $cat signal.nsg signal.ls1 |
22188                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
22189         fi
22190
22191 fi
22192 if $test -s signal.lst; then
22193         :
22194 else
22195         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
22196         echo 'kill -l' >signal
22197         set X `csh -f <signal`
22198         $rm -f signal
22199         shift
22200         case $# in
22201         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
22202         esac
22203         echo $@ | $tr ' ' $trnl | \
22204             $awk '{ printf "%s %d\n", $1, ++s; }
22205                   END { printf "NSIG %d\n", ++s }' >signal.lst
22206 fi
22207 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
22208 EOS
22209 chmod a+x signal_cmd
22210 $eunicefix signal_cmd
22211
22212 : generate list of signal names
22213 echo " "
22214 case "$sig_name_init" in
22215 '') doinit=yes ;;
22216 *)  case "$sig_num_init" in
22217     ''|*,*) doinit=yes ;;
22218     esac ;;
22219 esac
22220 case "$doinit" in
22221 yes)
22222         echo "Generating a list of signal names and numbers..." >&4
22223         . ./signal_cmd
22224         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22225         sig_name=`$awk 'BEGIN { printf "ZERO " }
22226                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
22227         sig_num=`$awk  'BEGIN { printf "0 " }
22228                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
22229         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
22230                              !/^NSIG/   { printf "\"%s\", ", $1 }
22231                              END        { printf "0\n" }' signal.lst`
22232         sig_num_init=`$awk  'BEGIN      { printf "0, " }
22233                              !/^NSIG/   { printf "%d, ", $2}
22234                              END        { printf "0\n"}' signal.lst`
22235         ;;
22236 esac
22237 echo "The following $sig_count signals are available:"
22238 echo " "
22239 echo $sig_name | $awk \
22240 'BEGIN { linelen = 0 }
22241 {
22242         for (i = 1; i <= NF; i++) {
22243                 name = "SIG" $i " "
22244                 linelen = linelen + length(name)
22245                 if (linelen > 70) {
22246                         printf "\n"
22247                         linelen = length(name)
22248                 }
22249                 printf "%s", name
22250         }
22251         printf "\n"
22252 }'
22253 sig_size=`echo $sig_name | awk '{print NF}'`
22254 $rm -f signal signal.c signal.awk signal.lst signal_cmd
22255
22256 : Check size of size
22257 echo " "
22258 case "$sizetype" in
22259 *_t) zzz="$sizetype"    ;;
22260 *)   zzz="filesize"     ;;
22261 esac
22262 echo "Checking the size of $zzz..." >&4
22263 cat > try.c <<EOCP
22264 #include <sys/types.h>
22265 #include <stdio.h>
22266 #$i_stdlib I_STDLIB
22267 #ifdef I_STDLIB
22268 #include <stdlib.h>
22269 #endif
22270 int main() {
22271     printf("%d\n", (int)sizeof($sizetype));
22272     exit(0);
22273 }
22274 EOCP
22275 set try
22276 if eval $compile_ok; then
22277         yyy=`$run ./try`
22278         case "$yyy" in
22279         '')     sizesize=4
22280                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22281                 ;;
22282         *)      sizesize=$yyy
22283                 echo "Your $zzz size is $sizesize bytes."
22284                 ;;
22285         esac
22286 else
22287         sizesize=4
22288         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22289 fi
22290
22291
22292 : check for socklen_t
22293 echo " "
22294 echo "Checking to see if you have socklen_t..." >&4
22295 $cat >try.c <<EOCP
22296 #include <sys/types.h>
22297 #$d_socket HAS_SOCKET
22298 #ifdef HAS_SOCKET
22299 #include <sys/socket.h>
22300 #endif
22301 int main() { socklen_t x = 16; }
22302 EOCP
22303 set try
22304 if eval $compile; then
22305         val="$define"
22306         echo "You have socklen_t."
22307 else
22308         val="$undef"
22309         echo "You do not have socklen_t."
22310         case "$sizetype" in
22311         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22312         esac
22313 fi
22314 $rm_try
22315 set d_socklen_t
22316 eval $setvar
22317
22318 : see if this is a socks.h system
22319 set socks.h i_socks
22320 eval $inhdr
22321
22322 : check for type of the size argument to socket calls
22323 case "$d_socket" in
22324 "$define")
22325         $cat <<EOM
22326
22327 Checking to see what type is the last argument of accept().
22328 EOM
22329         yyy=''
22330         case "$d_socklen_t" in
22331         "$define") yyy="$yyy socklen_t"
22332         esac
22333         yyy="$yyy $sizetype int long unsigned"
22334         for xxx in $yyy; do
22335                 case "$socksizetype" in
22336                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22337                         case "$usesocks" in
22338                         "$define")
22339                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22340                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22341                                         socksizetype="$xxx"
22342                                 fi
22343                                 ;;
22344                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22345                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22346                                         socksizetype="$xxx"
22347                                 fi
22348                                 ;;
22349                         esac
22350                         ;;
22351                 esac
22352         done
22353 : In case none of those worked, prompt the user.
22354         case "$socksizetype" in
22355         '')     rp='What is the type for socket address structure sizes?'
22356                 dflt='int'
22357                 . ./myread
22358                 socksizetype=$ans
22359                 ;;
22360         esac
22361         ;;
22362 *)      : no sockets, so pick relatively harmless default
22363         socksizetype='int'
22364         ;;
22365 esac
22366
22367 : see what type is used for signed size_t
22368 set ssize_t ssizetype int stdio.h sys/types.h
22369 eval $typedef
22370 dflt="$ssizetype"
22371 $cat > try.c <<EOM
22372 #include <stdio.h>
22373 #$i_stdlib I_STDLIB
22374 #ifdef I_STDLIB
22375 #include <stdlib.h>
22376 #endif
22377 #include <sys/types.h>
22378 #define Size_t $sizetype
22379 #define SSize_t $dflt
22380 int main()
22381 {
22382         if (sizeof(Size_t) == sizeof(SSize_t))
22383                 printf("$dflt\n");
22384         else if (sizeof(Size_t) == sizeof(int))
22385                 printf("int\n");
22386         else
22387                 printf("long\n");
22388         exit(0);
22389 }
22390 EOM
22391 echo " "
22392 set try
22393 if eval $compile_ok && $run ./try > /dev/null; then
22394         ssizetype=`$run ./try`
22395         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22396 else
22397         $cat >&4 <<EOM
22398 Help! I can't compile and run the ssize_t test program: please enlighten me!
22399 (This is probably a misconfiguration in your system or libraries, and
22400 you really ought to fix it.  Still, I'll try anyway.)
22401
22402 I need a type that is the same size as $sizetype, but is guaranteed to
22403 be signed.  Common values are ssize_t, int and long.
22404
22405 EOM
22406         rp="What signed type is the same size as $sizetype?"
22407         . ./myread
22408         ssizetype="$ans"
22409 fi
22410 $rm_try
22411
22412 : Check the size of st_ino
22413 $echo " "
22414 $echo "Checking the size of st_ino..." >&4
22415 $cat > try.c <<EOCP
22416 #include <sys/stat.h>
22417 #include <stdio.h>
22418 #$i_stdlib I_STDLIB
22419 #ifdef I_STDLIB
22420 #include <stdlib.h>
22421 #endif
22422 int main() {
22423     struct stat st;
22424     printf("%d\n", (int)sizeof(st.st_ino));
22425     exit(0);
22426 }
22427 EOCP
22428 set try
22429 if eval $compile_ok; then
22430         val=`$run ./try`
22431         case "$val" in
22432         '')     st_ino_size=4
22433                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22434                 ;;
22435         *)      st_ino_size=$val
22436                 $echo "Your st_ino is $st_ino_size bytes long."
22437                 ;;
22438         esac
22439 else
22440         st_ino_size=4
22441         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22442 fi
22443 $rm_try
22444
22445 : Check if st_ino is signed
22446 $echo " "
22447 $echo "Checking the sign of st_ino..." >&4
22448 $cat > try.c <<EOCP
22449 #include <sys/stat.h>
22450 #include <stdio.h>
22451 int main() {
22452         struct stat foo;
22453         foo.st_ino = -1;
22454         if (foo.st_ino < 0)
22455                 printf("-1\n");
22456         else
22457                 printf("1\n");
22458 }
22459 EOCP
22460 set try
22461 if eval $compile; then
22462         val=`$run ./try`
22463         case "$val" in
22464         '')     st_ino_sign=1
22465                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22466                 ;;
22467         *)      st_ino_sign=$val
22468                 case "$st_ino_sign" in
22469                  1) $echo "Your st_ino is unsigned." ;;
22470                 -1) $echo "Your st_ino is signed."   ;;
22471                 esac
22472                 ;;
22473         esac
22474 else
22475         st_ino_sign=1
22476         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22477 fi
22478 $rm_try
22479
22480 : see what type of char stdio uses.
22481 echo " "
22482 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22483 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22484         echo "Your stdio uses unsigned chars." >&4
22485         stdchar="unsigned char"
22486 else
22487         echo "Your stdio uses signed chars." >&4
22488         stdchar="char"
22489 fi
22490 $rm -f stdioh
22491
22492 : see what type uids are declared as in the kernel
22493 echo " "
22494 echo "Looking for the type for user ids returned by getuid()."
22495 set uid_t uidtype xxx stdio.h sys/types.h
22496 eval $typedef
22497 case "$uidtype" in
22498 xxx)
22499         xxx=`./findhdr sys/user.h`
22500         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
22501         case $1 in
22502         unsigned) dflt="$1 $2" ;;
22503         *) dflt="$1" ;;
22504         esac
22505         ;;
22506 *) dflt="$uidtype";;
22507 esac
22508 case "$uidtype" in
22509 uid_t)  echo "uid_t found." ;;
22510 *)      rp="What is the type for user ids returned by getuid()?"
22511         . ./myread
22512         uidtype="$ans"
22513         ;;
22514 esac
22515
22516 : Check size of UID
22517 echo " "
22518 case "$uidtype" in
22519 *_t) zzz="$uidtype"     ;;
22520 *)   zzz="uid"          ;;
22521 esac
22522 echo "Checking the size of $zzz..." >&4
22523 cat > try.c <<EOCP
22524 #include <sys/types.h>
22525 #include <stdio.h>
22526 #$i_stdlib I_STDLIB
22527 #ifdef I_STDLIB
22528 #include <stdlib.h>
22529 #endif
22530 int main() {
22531     printf("%d\n", (int)sizeof($uidtype));
22532     exit(0);
22533 }
22534 EOCP
22535 set try
22536 if eval $compile_ok; then
22537         yyy=`$run ./try`
22538         case "$yyy" in
22539         '')     uidsize=4
22540                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22541                 ;;
22542         *)      uidsize=$yyy
22543                 echo "Your $zzz is $uidsize bytes long."
22544                 ;;
22545         esac
22546 else
22547         uidsize=4
22548         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22549 fi
22550
22551 : Check if UID is signed
22552 echo " "
22553 case "$uidtype" in
22554 *_t) zzz="$uidtype"     ;;
22555 *)   zzz="uid"          ;;
22556 esac
22557 echo "Checking the sign of $zzz..." >&4
22558 cat > try.c <<EOCP
22559 #include <sys/types.h>
22560 #include <stdio.h>
22561 int main() {
22562         $uidtype foo = -1;
22563         if (foo < 0)
22564                 printf("-1\n");
22565         else
22566                 printf("1\n");
22567 }
22568 EOCP
22569 set try
22570 if eval $compile; then
22571         yyy=`$run ./try`
22572         case "$yyy" in
22573         '')     uidsign=1
22574                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22575                 ;;
22576         *)      uidsign=$yyy
22577                 case "$uidsign" in
22578                  1) echo "Your $zzz is unsigned." ;;
22579                 -1) echo "Your $zzz is signed."   ;;
22580                 esac
22581                 ;;
22582         esac
22583 else
22584         uidsign=1
22585         echo "(I can't compile the test program--guessing unsigned.)" >&4
22586 fi
22587
22588
22589 : Check format string for UID
22590 echo " "
22591 $echo "Checking the format string to be used for uids..." >&4
22592
22593 case "$uidsign" in
22594 -1)     if $test X"$uidsize" = X"$ivsize"; then
22595                 uidformat="$ivdformat"
22596         else
22597                 if $test X"$uidsize" = X"$longsize"; then
22598                         uidformat='"ld"'
22599                 else
22600                         if $test X"$uidsize" = X"$intsize"; then
22601                                 uidformat='"d"'
22602                         else
22603                                 if $test X"$uidsize" = X"$shortsize"; then
22604                                         uidformat='"hd"'
22605                                 fi
22606                         fi
22607                 fi
22608         fi
22609         ;;
22610 *)      if $test X"$uidsize" = X"$uvsize"; then
22611                 uidformat="$uvuformat"
22612         else
22613                 if $test X"$uidsize" = X"$longsize"; then
22614                         uidformat='"lu"'
22615                 else
22616                         if $test X"$uidsize" = X"$intsize"; then
22617                                 uidformat='"u"'
22618                         else
22619                                 if $test X"$uidsize" = X"$shortsize"; then
22620                                         uidformat='"hu"'
22621                                 fi
22622                         fi
22623                 fi
22624         fi
22625         ;;
22626 esac
22627
22628 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22629 echo " "
22630 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22631 $cat >try.c <<'EOM'
22632 /* Intentionally a long probe as I'd like to sanity check that the exact
22633    approach is going to work, as thinking it will work, but only having it
22634    part working at runtime is worse than not having it.  */
22635
22636 #include <sys/types.h>
22637 #include <sys/sysctl.h>
22638 #include <sys/param.h>
22639 #include <stdio.h>
22640 #include <string.h>
22641 #include <stdlib.h>
22642 #include <unistd.h>
22643
22644 int
22645 main(int argc, char **argv) {
22646     char *buffer;
22647     char *argv_leaf = strrchr(argv[0], '/');
22648     char *buffer_leaf;
22649     size_t size = 0;
22650     int mib[4];
22651
22652     mib[0] = CTL_KERN;
22653     mib[1] = KERN_PROC;
22654     mib[2] = KERN_PROC_PATHNAME;
22655     mib[3] = -1;
22656
22657     if (!argv_leaf) {
22658         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22659         return 1;
22660     }
22661
22662     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22663         perror("sysctl");
22664         return 2;
22665     }
22666
22667     if (size < strlen(argv_leaf) + 1) {
22668         fprintf(stderr, "size %lu is too short for a path\n",
22669                 (unsigned long) size);
22670         return 3;
22671     }
22672
22673     if (size > MAXPATHLEN * MAXPATHLEN) {
22674         fprintf(stderr, "size %lu is too long for a path\n",
22675                 (unsigned long) size);
22676         return 4;
22677     }
22678
22679     buffer = malloc(size);
22680     if (!buffer) {
22681         perror("malloc");
22682         return 5;
22683     }
22684
22685     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22686         perror("sysctl");
22687         return 6;
22688     }
22689
22690     if (strlen(buffer) + 1 != size) {
22691         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22692                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22693         return 7;
22694     }
22695
22696
22697     if (*buffer != '/') {
22698         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22699         return 8;
22700     }
22701
22702     if (strstr(buffer, "/./")) {
22703         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22704         return 9;
22705     }
22706
22707     if (strstr(buffer, "/../")) {
22708         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22709         return 10;
22710     }
22711
22712     buffer_leaf = strrchr(buffer, '/');
22713     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22714         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22715         return 11;
22716     }
22717
22718     free(buffer);
22719
22720     return 0;
22721 }
22722 EOM
22723
22724 val=$undef
22725 set try
22726 if eval $compile; then
22727         if $run ./try; then
22728                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22729                 val="$define"
22730         else
22731                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22732                 val="$undef"
22733         fi
22734 else
22735         echo "I'm unable to compile the test program." >&4
22736         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22737         val="$undef"
22738 fi
22739 $rm_try
22740 set usekernprocpathname
22741 eval $setvar
22742
22743 : Determine if we can use _NSGetExecutablePath to find executing program
22744 echo " "
22745 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22746 $cat >try.c <<'EOM'
22747 /* Intentionally a long probe as I'd like to sanity check that the exact
22748    approach is going to work, as thinking it will work, but only having it
22749    part working at runtime is worse than not having it.  */
22750 #include <mach-o/dyld.h>
22751 #include <stdio.h>
22752 #include <stdlib.h>
22753 #include <sys/param.h>
22754 #include <string.h>
22755
22756 int
22757 main(int argc, char **argv) {
22758     char buf[1];
22759     uint32_t size = sizeof(buf);
22760     int result;
22761     char *buffer;
22762     char *tidied;
22763     char *argv_leaf = strrchr(argv[0], '/');
22764     char *tidied_leaf;
22765
22766     if (!argv_leaf) {
22767         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22768         return 1;
22769     }
22770
22771     _NSGetExecutablePath(buf, &size);
22772     if (size > MAXPATHLEN * MAXPATHLEN) {
22773         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22774                 (unsigned int) size);
22775         return 2;
22776     }
22777
22778     buffer = malloc(size);
22779     if (!buffer) {
22780         perror("malloc");
22781         return 3;
22782     }
22783
22784     result = _NSGetExecutablePath(buffer, &size);
22785     if (result != 0) {
22786         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22787                 result, (unsigned int) size);
22788         return 4;
22789     }
22790
22791     tidied = realpath(buffer, NULL);
22792     if (!tidied) {
22793         perror("realpath");
22794         return 5;
22795     }
22796
22797     free(buffer);
22798
22799     if (*tidied != '/') {
22800         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22801         return 6;
22802     }
22803
22804     if (strstr(tidied, "/./")) {
22805         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22806         return 7;
22807     }
22808
22809     if (strstr(tidied, "/../")) {
22810         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22811         return 8;
22812     }
22813
22814     tidied_leaf = strrchr(tidied, '/');
22815     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22816         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22817         return 9;
22818     }
22819
22820     free(tidied);
22821
22822     return 0;
22823 }
22824 EOM
22825
22826 val=$undef
22827 set try
22828 if eval $compile; then
22829         if $run ./try; then
22830                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22831                 val="$define"
22832         else
22833                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22834         fi
22835 else
22836         echo "I'm unable to compile the test program." >&4
22837         echo "I'll assume no _NSGetExecutablePath here." >&4
22838 fi
22839 $rm_try
22840 set usensgetexecutablepath
22841 eval $setvar
22842
22843 : Check if site customization support was requested
22844 case "$usesitecustomize" in
22845     $define|true|[Yy]*)
22846         usesitecustomize="$define"
22847         ;;
22848     *)
22849         usesitecustomize="$undef"
22850         ;;
22851     esac
22852
22853 : see if prototypes support variable argument declarations
22854 echo " "
22855 case "$prototype$i_stdarg" in
22856 $define$define)
22857         echo "It appears we'll be able to prototype varargs functions." >&4
22858         val="$define"
22859         ;;
22860 *)
22861         echo "Too bad... We won't be using prototyped varargs functions..." >&4
22862         val="$undef"
22863         ;;
22864 esac
22865 set vaproto
22866 eval $setvar
22867
22868 : determine compiler compiler
22869 case "$yacc" in
22870 '')
22871         dflt=yacc;;
22872 *)
22873         dflt="$yacc";;
22874 esac
22875 echo " "
22876 comp='yacc'
22877 if $test -f "$byacc$_exe"; then
22878         dflt="$byacc"
22879         comp="byacc or $comp"
22880 fi
22881 if $test -f "$bison$_exe"; then
22882         comp="$comp or bison -y"
22883 fi
22884 rp="Which compiler compiler ($comp) shall I use?"
22885 . ./myread
22886 yacc="$ans"
22887 case "$yacc" in
22888 *bis*)
22889         case "$yacc" in
22890         *-y*) ;;
22891         *)
22892                 yacc="$yacc -y"
22893                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22894                 ;;
22895         esac
22896         ;;
22897 esac
22898
22899 : see if this is a assert.h system
22900 set assert.h i_assert
22901 eval $inhdr
22902
22903 : see if this is a bfd.h system
22904 set bfd.h i_bfd
22905 eval $inhdr
22906
22907 : see if this is an execinfo.h system
22908 set execinfo.h i_execinfo
22909 eval $inhdr
22910
22911 : see if this is a fenv.h system
22912 set fenv.h i_fenv
22913 eval $inhdr
22914
22915 : see if this is a fp.h system
22916 set fp.h i_fp
22917 eval $inhdr
22918
22919 : see if this is a fp_class.h system
22920 set fp_class.h i_fp_class
22921 eval $inhdr
22922
22923 : see if gdbm.h is available
22924 set gdbm.h t_gdbm
22925 eval $inhdr
22926 case "$t_gdbm" in
22927 $define)
22928         : see if gdbm_open exists
22929         set gdbm_open d_gdbm_open
22930         eval $inlibc
22931         case "$d_gdbm_open" in
22932         $undef)
22933                 t_gdbm="$undef"
22934                 echo "We won't be including <gdbm.h>"
22935                 ;;
22936         esac
22937         ;;
22938 esac
22939 val="$t_gdbm"
22940 set i_gdbm
22941 eval $setvar
22942
22943 : see if this is a ieeefp.h system
22944 case "$i_ieeefp" in
22945 '' ) set ieeefp.h i_ieeefp
22946      eval $inhdr
22947      ;;
22948 esac
22949
22950 : see if this is a libutil.h system
22951 set libutil.h i_libutil
22952 eval $inhdr
22953
22954 : see if mach cthreads are available
22955 if test "X$usethreads" = "X$define"; then
22956         set mach/cthreads.h i_machcthr
22957         eval $inhdr
22958 else
22959         i_machcthr="$undef"
22960 fi
22961
22962 : see if this is a mntent.h system
22963 set mntent.h i_mntent
22964 eval $inhdr
22965
22966 : see if net/errno.h is available
22967 val=''
22968 set net/errno.h val
22969 eval $inhdr
22970
22971 : Unfortunately, it causes problems on some systems.  Arrgh.
22972 case "$val" in
22973 $define)
22974         cat > try.c <<'EOM'
22975 #include <stdio.h>
22976 #include <errno.h>
22977 #include <net/errno.h>
22978 int func()
22979 {
22980         return ENOTSOCK;
22981 }
22982 EOM
22983         if $cc $ccflags -c try.c >/dev/null 2>&1; then
22984                 echo "We'll be including <net/errno.h>." >&4
22985         else
22986                 echo "We won't be including <net/errno.h>." >&4
22987                 val="$undef"
22988         fi
22989         $rm_try
22990         ;;
22991 esac
22992 set i_neterrno
22993 eval $setvar
22994
22995 : see if netinet/tcp.h is available
22996 set netinet/tcp.h i_netinettcp
22997 eval $inhdr
22998
22999 : see if this is a poll.h system
23000 set poll.h i_poll
23001 eval $inhdr
23002
23003 : see if this is a prot.h system
23004 set prot.h i_prot
23005 eval $inhdr
23006
23007 : Preprocessor symbols
23008 echo " "
23009 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
23010 $cat <<'EOSH' > Cppsym.know
23011 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
23012 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
23013 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
23014 arch_pwr ardent ARM ARM32 atarist att386 att3b
23015 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
23016 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
23017 byteorder byte_order
23018 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
23019 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
23020 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
23021 ELF encore EPI EXTENSIONS
23022 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
23023 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
23024 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
23025 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
23026 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400 hp9000s500
23027 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
23028 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
23029 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
23030 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
23031 ksr1
23032 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
23033 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
23034 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
23035 luna88k Lynx
23036 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
23037 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
23038 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
23039 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
23040 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
23041 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
23042 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
23043 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
23044 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
23045 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
23046 ns32000 ns32016 ns32332 ns32k nsc32000
23047 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23048 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23049 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23050 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23051 QK_USER QNX
23052 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23053 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23054 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23055 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23056 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23057 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23058 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23059 SYSV4 SYSV5 sysV68 sysV88
23060 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23061 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23062 tower32_800 tower32_850 tss
23063 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23064 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23065 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23066 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23067 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23068 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23069 uxpm uxps
23070 vax venix VMESA vms
23071 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23072 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23073 z8000 zarch
23074 EOSH
23075 # Maybe put other stuff here too.
23076 ./tr '-' '_' <<EOSH >>Cppsym.know
23077 $osname
23078 EOSH
23079 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23080 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23081 $cat Cppsym.know > Cppsym.c
23082 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23083 $rm -f Cppsym.a Cppsym.b Cppsym.c
23084 cat <<EOSH > Cppsym
23085 $startsh
23086 if $test \$# -gt 0; then
23087     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23088     if $test -s Cppsym.got; then
23089         $rm -f Cppsym.got
23090         exit 0
23091     fi
23092     $rm -f Cppsym.got
23093     exit 1
23094 else
23095     $tr " " "$trnl" | ./Cppsym.try
23096     exit 0
23097 fi
23098 EOSH
23099 chmod +x Cppsym
23100 $eunicefix Cppsym
23101 cat <<EOSH > Cppsym.try
23102 $startsh
23103 cat <<'EOCP' > try.c
23104 #include <stdio.h>
23105 #if cpp_stuff == 1
23106 #define STRINGIFY(a)    "a"
23107 #endif
23108 #if cpp_stuff == 42
23109 #define StGiFy(a)  #a
23110 #define STRINGIFY(a)    StGiFy(a)
23111 #endif
23112 #if $cpp_stuff != 1 && $cpp_stuff != 42
23113 #   include "Bletch: How does this C preprocessor stringify macros?"
23114 #endif
23115 int main() {
23116 EOCP
23117 $awk \\
23118 EOSH
23119 cat <<'EOSH' >> Cppsym.try
23120 'length($1) > 0 {
23121     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23122     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23123     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23124     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23125 }'       >> try.c
23126 echo 'return 0;}' >> try.c
23127 EOSH
23128 cat <<EOSH >> Cppsym.try
23129 ccflags="$ccflags"
23130 case "$osname-$gccversion" in
23131 irix-) ccflags="\$ccflags -woff 1178" ;;
23132 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
23133 esac
23134 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
23135 EOSH
23136 chmod +x Cppsym.try
23137 $eunicefix Cppsym.try
23138 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
23139 : Add in any Linux cpp "predefined macros":
23140 case "$osname::$gccversion" in
23141   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
23142     tHdrH=_tmpHdr
23143     rm -f $tHdrH'.h' $tHdrH
23144     touch $tHdrH'.h'
23145     # Filter out macro arguments, such as Linux's __INT8_C(c)
23146     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
23147        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
23148        if [ -s $tHdrH'_cppsym.real' ]; then
23149           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
23150        fi
23151     fi
23152     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
23153   ;;
23154 esac
23155 : now check the C compiler for additional symbols
23156 postprocess_cc_v=''
23157 case "$osname" in
23158 aix) postprocess_cc_v="|$tr , ' '" ;;
23159 esac
23160 $cat >ccsym <<EOS
23161 $startsh
23162 $cat >tmp.c <<EOF
23163 extern int foo;
23164 EOF
23165 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
23166 do
23167         case "\$i" in
23168         -D*) echo "\$i" | $sed 's/^-D//';;
23169         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
23170         esac
23171 done
23172 $rm_try
23173 EOS
23174 postprocess_cc_v=''
23175 chmod +x ccsym
23176 $eunicefix ccsym
23177 ./ccsym > ccsym1.raw
23178 if $test -s ccsym1.raw; then
23179     $sort ccsym1.raw | $uniq >ccsym.raw
23180 else
23181     mv ccsym1.raw ccsym.raw
23182 fi
23183
23184 $awk '/\=/ { print $0; next }
23185         { print $0"=1" }' ccsym.raw >ccsym.list
23186 $comm -13 Cppsym.true ccsym.list >ccsym.own
23187 $comm -12 Cppsym.true ccsym.list >ccsym.com
23188 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
23189 also=''
23190 if $test -z ccsym.raw; then
23191         echo "Your C compiler doesn't seem to define any symbols!" >&4
23192         echo " "
23193         echo "However, your C preprocessor defines the following symbols:"
23194         $cat Cppsym.true
23195         ccsymbols=''
23196         cppsymbols=`$cat Cppsym.true`
23197         cppsymbols=`echo $cppsymbols`
23198         cppccsymbols="$cppsymbols"
23199 else
23200         if $test -s ccsym.com; then
23201                 echo "Your C compiler and pre-processor define these symbols:"
23202                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
23203                 also='also '
23204                 symbols='ones'
23205                 cppccsymbols=`$cat ccsym.com`
23206                 cppccsymbols=`echo $cppccsymbols`
23207                 $test "$silent" || sleep 1
23208         fi
23209         if $test -s ccsym.cpp; then
23210                 $test "$also" && echo " "
23211                 echo "Your C pre-processor ${also}defines the following symbols:"
23212                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
23213                 also='further '
23214                 cppsymbols=`$cat ccsym.cpp`
23215                 cppsymbols=`echo $cppsymbols`
23216                 $test "$silent" || sleep 1
23217         fi
23218         if $test -s ccsym.own; then
23219                 $test "$also" && echo " "
23220                 echo "Your C compiler ${also}defines the following cpp symbols:"
23221                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
23222                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
23223                 ccsymbols=`$cat ccsym.own`
23224                 ccsymbols=`echo $ccsymbols`
23225                 $test "$silent" || sleep 1
23226         fi
23227 fi
23228
23229 : add -D_FORTIFY_SOURCE if feasible and not already there
23230 case "$gccversion" in
23231 4.*)    case "$optimize$ccflags" in
23232         *-O*)   case "$ccflags$cppsymbols" in
23233                 *_FORTIFY_SOURCE=*) # Don't add it again.
23234                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
23235                         ;;
23236                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
23237                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
23238                         ;;
23239                 esac
23240                 ;;
23241         *)      echo "You have gcc 4.* but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
23242                 ;;
23243         esac
23244         ;;
23245 *)      echo "You seem not to have gcc 4.*, not adding -D_FORTIFY_SOURCE." >&4
23246         ;;
23247 esac
23248
23249 : see if this is a termio system
23250 val="$undef"
23251 val2="$undef"
23252 val3="$undef"
23253 if $test `./findhdr termios.h`; then
23254     set tcsetattr i_termios
23255     eval $inlibc
23256     val3="$i_termios"
23257 fi
23258 echo " "
23259 case "$val3" in
23260     "$define") echo "You have POSIX termios.h... good!" >&4;;
23261     *)  if ./Cppsym pyr; then
23262             case "`$run /bin/universe`" in
23263                 ucb) if $test `./findhdr sgtty.h`; then
23264                         val2="$define"
23265                         echo "<sgtty.h> found." >&4
23266                     else
23267                         echo "System is pyramid with BSD universe."
23268                         ./warn "<sgtty.h> not found--you could have problems."
23269                     fi;;
23270                 *)  if $test `./findhdr termio.h`; then
23271                         val="$define"
23272                         echo "<termio.h> found." >&4
23273                     else
23274                         echo "System is pyramid with USG universe."
23275                         ./warn "<termio.h> not found--you could have problems."
23276                     fi;;
23277             esac
23278         elif ./usg; then
23279             if $test `./findhdr termio.h`; then
23280                 echo "<termio.h> found." >&4
23281                 val="$define"
23282             elif $test `./findhdr sgtty.h`; then
23283                 echo "<sgtty.h> found." >&4
23284                 val2="$define"
23285             else
23286                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23287             fi
23288         else
23289             if $test `./findhdr sgtty.h`; then
23290                 echo "<sgtty.h> found." >&4
23291                 val2="$define"
23292             elif $test `./findhdr termio.h`; then
23293                 echo "<termio.h> found." >&4
23294                 val="$define"
23295             else
23296                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23297             fi
23298         fi;;
23299 esac
23300 set i_termio; eval $setvar
23301 val=$val2; set i_sgtty; eval $setvar
23302 val=$val3; set i_termios; eval $setvar
23303
23304 : see if stdbool is available
23305 : we want a real compile instead of Inhdr because some Solaris systems
23306 : have stdbool.h, but it can only be used if the compiler indicates it
23307 : is sufficiently c99-compliant.
23308 echo " "
23309 $cat >try.c <<EOCP
23310 #include <stdio.h>
23311 #include <stdbool.h>
23312 int func(bool x)
23313 {
23314     return x ? 1 : 0;
23315 }
23316 int main(int argc, char **argv)
23317 {
23318     return func(0);
23319 }
23320 EOCP
23321 set try
23322 if eval $compile; then
23323         echo "<stdbool.h> found." >&4
23324         val="$define"
23325 else
23326         echo "<stdbool.h> NOT found." >&4
23327         val="$undef"
23328 fi
23329 $rm_try
23330 set i_stdbool
23331 eval $setvar
23332
23333 : see if stddef is available
23334 set stddef.h i_stddef
23335 eval $inhdr
23336
23337 : see if stdint is available
23338 set stdint.h i_stdint
23339 eval $inhdr
23340
23341 : see if sys/access.h is available
23342 set sys/access.h i_sysaccess
23343 eval $inhdr
23344
23345 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23346 set sys/filio.h i_sysfilio
23347 eval $inhdr
23348 echo " "
23349 if $test `./findhdr sys/ioctl.h`; then
23350         val="$define"
23351         echo '<sys/ioctl.h> found.' >&4
23352 else
23353         val="$undef"
23354         if $test $i_sysfilio = "$define"; then
23355             echo '<sys/ioctl.h> NOT found.' >&4
23356         else
23357                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23358                 $test $i_termio = "$define" && xxx="termio.h"
23359                 $test $i_termios = "$define" && xxx="termios.h"
23360 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23361         fi
23362 fi
23363 set i_sysioctl
23364 eval $setvar
23365
23366 : see if socket ioctl defs are in sys/sockio.h
23367 echo " "
23368 xxx=`./findhdr sys/sockio.h`
23369 if $test "$xxx"; then
23370         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23371                 val="$define"
23372                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23373         else
23374                 val="$undef"
23375                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23376         fi
23377 else
23378         val="$undef"
23379         $cat <<EOM
23380 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23381 EOM
23382 fi
23383 set i_syssockio
23384 eval $setvar
23385
23386 : see if this is a syslog.h system
23387 set syslog.h i_syslog
23388 eval $inhdr
23389
23390 : see if this is a sys/mode.h system
23391 set sys/mode.h i_sysmode
23392 eval $inhdr
23393
23394 : see if there is a sys/poll.h file
23395 set sys/poll.h i_syspoll
23396 eval $inhdr
23397
23398 : see if sys/resource.h has to be included
23399 set sys/resource.h i_sysresrc
23400 eval $inhdr
23401
23402 : see if sys/security.h is available
23403 set sys/security.h i_syssecrt
23404 eval $inhdr
23405
23406 : see if this is a sys/statvfs.h system
23407 set sys/statvfs.h i_sysstatvfs
23408 eval $inhdr
23409
23410 : see if this is a sys/un.h system
23411 set sys/un.h i_sysun
23412 eval $inhdr
23413
23414 : see if this is a sys/utsname.h system
23415 set sys/utsname.h i_sysutsname
23416 eval $inhdr
23417
23418 : see if this is a syswait system
23419 set sys/wait.h i_syswait
23420 eval $inhdr
23421
23422 : see if this is a ustat.h system
23423 set ustat.h i_ustat
23424 eval $inhdr
23425
23426 : see if this is an utime system
23427 set utime.h i_utime
23428 eval $inhdr
23429
23430 : see if this is a vfork system
23431 case "$d_vfork" in
23432 "$define")
23433         set vfork.h i_vfork
23434         eval $inhdr
23435         ;;
23436 *)
23437         i_vfork="$undef"
23438         ;;
23439 esac
23440
23441 : Check extensions
23442 echo " "
23443 echo "Looking for extensions..." >&4
23444 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23445 : contain old or inaccurate or duplicate values.
23446 nonxs_extensions=''
23447 xs_extensions=''
23448 : We do not use find because it might not be available.
23449 : We do not just use MANIFEST because the user may have dropped
23450 : some additional extensions into the source tree and expect them
23451 : to be built.
23452
23453 : Function to recursively find available extensions, ignoring DynaLoader
23454 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23455 : In 5.10.1 and later, extensions are stored in directories
23456 : like File-Glob instead of the older File/Glob/.
23457 find_extensions='
23458     for xxx in *; do
23459         case "$xxx" in
23460             DynaLoader|dynaload) ;;
23461             *)
23462             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
23463             case "$this_ext" in
23464                 Scalar/List/Utils) this_ext="List/Util" ;;
23465                 PathTools)         this_ext="Cwd"       ;;
23466             esac;
23467             echo " $xs_extensions $nonxs_extensions" > $tdir/$$.tmp;
23468             if $contains " $this_ext " $tdir/$$.tmp; then
23469                 echo >&4;
23470                 echo "Duplicate directories detected for extension $xxx" >&4;
23471                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23472                 case "$knowitall" in
23473                 "") dflt=y;;
23474                 *) dflt=n;;
23475                 esac;
23476                 . ../UU/myread;
23477                 case "$ans" in
23478                 n*|N*) ;;
23479                 *) echo >&4;
23480                     echo "Ok.  Stopping Configure." >&4;
23481                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23482                     exit 1;;
23483                 esac;
23484                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23485             fi;
23486             $ls -1 $xxx > $tdir/$$.tmp;
23487             if   $contains "\.xs$" $tdir/$$.tmp > /dev/null 2>&1; then
23488                 xs_extensions="$xs_extensions $this_ext";
23489             elif $contains "\.c$"  $tdir/$$.tmp > /dev/null 2>&1; then
23490                 xs_extensions="$xs_extensions $this_ext";
23491             elif $test -d $xxx; then
23492                 nonxs_extensions="$nonxs_extensions $this_ext";
23493             fi;
23494             $rm -f $tdir/$$.tmp;
23495             ;;
23496         esac;
23497     done'
23498 tdir=`pwd`
23499 cd "$rsrc/cpan"
23500 set X
23501 shift
23502 eval $find_extensions
23503 cd "$rsrc/dist"
23504 set X
23505 shift
23506 eval $find_extensions
23507 cd "$rsrc/ext"
23508 set X
23509 shift
23510 eval $find_extensions
23511 set X $xs_extensions
23512 shift
23513 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23514 set X $nonxs_extensions
23515 shift
23516 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23517 cd "$tdir"
23518 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23519
23520 : Now see which are supported on this system.
23521 avail_ext=''
23522 for xxx in $xs_extensions ; do
23523         case "$xxx" in
23524         DB_File|db_file)
23525                 case "$i_db" in
23526                 $define) avail_ext="$avail_ext $xxx" ;;
23527                 esac
23528                 ;;
23529         GDBM_File|gdbm_fil)
23530                 case "$i_gdbm" in
23531                 $define) avail_ext="$avail_ext $xxx" ;;
23532                 esac
23533                 ;;
23534         I18N/Langinfo|i18n_lan)
23535                 case "$i_langinfo$d_nl_langinfo" in
23536                 $define$define) avail_ext="$avail_ext $xxx" ;;
23537                 esac
23538                 ;;
23539         IPC/SysV|ipc/sysv)
23540                 : XXX Do we need a useipcsysv variable here
23541                 case "${d_msg}${d_sem}${d_shm}" in
23542                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23543                 esac
23544                 ;;
23545         NDBM_File|ndbm_fil)
23546                 case "$d_ndbm" in
23547                 $define)
23548                     case "$osname-$use64bitint" in
23549                     hpux-define)
23550                         case "$libs" in
23551                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23552                         esac
23553                         ;;
23554                     *) avail_ext="$avail_ext $xxx" ;;
23555                     esac
23556                     ;;
23557                 esac
23558                 ;;
23559         ODBM_File|odbm_fil)
23560                 case "${i_dbm}${i_rpcsvcdbm}" in
23561                 *"${define}"*)
23562                     case "$d_cplusplus" in
23563                     define) ;; # delete as a function name will not work
23564                     *)  case "$osname-$use64bitint" in
23565                         hpux-define)
23566                             case "$libs" in
23567                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23568                             esac
23569                             ;;
23570                         *) avail_ext="$avail_ext $xxx" ;;
23571                         esac
23572                         ;;
23573                     esac
23574                     ;;
23575                 esac
23576                 ;;
23577         Opcode|opcode)
23578                 case "$useopcode" in
23579                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23580                 esac
23581                 ;;
23582         POSIX|posix)
23583                 case "$useposix" in
23584                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23585                 esac
23586                 ;;
23587         Socket|socket)
23588                 case "$d_socket" in
23589                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23590                 esac
23591                 ;;
23592         Sys/Syslog|sys/syslog)
23593                 : XXX syslog requires socket
23594                 case "$d_socket" in
23595                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23596                 esac
23597                 ;;
23598         Thread|thread)
23599                 case "$usethreads" in
23600                 true|$define|y)
23601                         case "$use5005threads" in
23602                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23603                         esac
23604                 esac
23605                 ;;
23606         threads|threads/shared)
23607                 # threads and threads::shared are special cases.
23608                 # To stop people from asking "Perl 5.8.0 was supposed
23609                 # to have this new fancy threads implementation but my
23610                 # perl doesn't have it" and from people trying to
23611                 # (re)install the threads module using CPAN.pm and
23612                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23613                 # the threads.pm and threads/shared.pm will always be
23614                 # there, croaking informatively ("you need to rebuild
23615                 # all of Perl with threads, sorry") when threads haven't
23616                 # been compiled in.
23617                 # --jhi
23618                 avail_ext="$avail_ext $xxx"
23619                 ;;
23620         VMS*)
23621                 ;;
23622         Win32*)
23623                 case "$osname" in
23624                 cygwin) avail_ext="$avail_ext $xxx" ;;
23625                 esac
23626                 ;;
23627         XS/APItest|xs/apitest)
23628                 # This is just for testing.  Skip it unless we have dynamic loading.
23629
23630                 case "$usedl" in
23631                 $define) avail_ext="$avail_ext $xxx" ;;
23632                 esac
23633                 ;;
23634         XS/Typemap|xs/typemap)
23635                 # This is just for testing.  Skip it unless we have dynamic loading.
23636                 case "$usedl" in
23637                 $define) avail_ext="$avail_ext $xxx" ;;
23638                 esac
23639                 ;;
23640         *)      avail_ext="$avail_ext $xxx"
23641                 ;;
23642         esac
23643 done
23644
23645 set X $avail_ext
23646 shift
23647 avail_ext="$*"
23648
23649 case "$onlyextensions" in
23650 '') ;;
23651 *)  keepextensions=''
23652     echo "You have requested that only certain extensions be included..." >&4
23653     for i in $onlyextensions; do
23654         case " $avail_ext " in
23655         *" $i "*)
23656             echo "Keeping extension $i."
23657             keepextensions="$keepextensions $i"
23658             ;;
23659         *) echo "Ignoring extension $i." ;;
23660         esac
23661     done
23662     avail_ext="$keepextensions"
23663     ;;
23664 esac
23665
23666 case "$noextensions" in
23667 '') ;;
23668 *)  keepextensions=''
23669     echo "You have requested that certain extensions be ignored..." >&4
23670     for i in $avail_ext; do
23671         case " $noextensions " in
23672         *" $i "*) echo "Ignoring extension $i." ;;
23673         *) echo "Keeping extension $i.";
23674            keepextensions="$keepextensions $i"
23675            ;;
23676         esac
23677     done
23678     avail_ext="$keepextensions"
23679     ;;
23680 esac
23681
23682 : Now see which nonxs extensions are supported on this system.
23683 : For now assume all are.
23684 nonxs_ext=''
23685 for xxx in $nonxs_extensions ; do
23686         case "$xxx" in
23687         VMS*)
23688                 ;;
23689         *)      nonxs_ext="$nonxs_ext $xxx"
23690                 ;;
23691         esac
23692 done
23693
23694 set X $nonxs_ext
23695 shift
23696 nonxs_ext="$*"
23697
23698 case $usedl in
23699 $define)
23700         $cat <<EOM
23701 A number of extensions are supplied with $package.  You may choose to
23702 compile these extensions for dynamic loading (the default), compile
23703 them into the $package executable (static loading), or not include
23704 them at all.  Answer "none" to include no extensions.
23705 Note that DynaLoader is always built and need not be mentioned here.
23706
23707 EOM
23708         case "$dynamic_ext" in
23709         '')
23710                 : Exclude those listed in static_ext
23711                 dflt=''
23712                 for xxx in $avail_ext; do
23713                         case " $static_ext " in
23714                         *" $xxx "*) ;;
23715                         *) dflt="$dflt $xxx" ;;
23716                         esac
23717                 done
23718                 set X $dflt
23719                 shift
23720                 dflt="$*"
23721                 ;;
23722         *)      dflt="$dynamic_ext"
23723                 # Perhaps we are reusing an old out-of-date config.sh.
23724                 case "$hint" in
23725                 previous)
23726                         if test X"$dynamic_ext" != X"$avail_ext"; then
23727                                 $cat <<EOM
23728 NOTICE:  Your previous config.sh list may be incorrect.
23729 The extensions now available to you are
23730         ${avail_ext}
23731 but the default list from your previous config.sh is
23732         ${dynamic_ext}
23733
23734 EOM
23735                         fi
23736                         ;;
23737                 esac
23738                 ;;
23739         esac
23740         case "$dflt" in
23741         '')     dflt=none;;
23742         esac
23743         rp="What extensions do you wish to load dynamically?"
23744         . ./myread
23745         case "$ans" in
23746         none) dynamic_ext=' ' ;;
23747         *) dynamic_ext="$ans" ;;
23748         esac
23749
23750         case "$static_ext" in
23751         '')
23752                 : Exclude those already listed in dynamic linking
23753                 dflt=''
23754                 for xxx in $avail_ext; do
23755                         case " $dynamic_ext " in
23756                         *" $xxx "*) ;;
23757                         *) dflt="$dflt $xxx" ;;
23758                         esac
23759                 done
23760                 set X $dflt
23761                 shift
23762                 dflt="$*"
23763                 ;;
23764         *)  dflt="$static_ext"
23765                 ;;
23766         esac
23767
23768         case "$dflt" in
23769         '')     dflt=none;;
23770         esac
23771         rp="What extensions do you wish to load statically?"
23772         . ./myread
23773         case "$ans" in
23774         none) static_ext=' ' ;;
23775         *) static_ext="$ans" ;;
23776         esac
23777         ;;
23778 *)
23779         $cat <<EOM
23780 A number of extensions are supplied with $package.  Answer "none"
23781 to include no extensions.
23782 Note that DynaLoader is always built and need not be mentioned here.
23783
23784 EOM
23785         case "$static_ext" in
23786         '') dflt="$avail_ext" ;;
23787         *)      dflt="$static_ext"
23788                 # Perhaps we are reusing an old out-of-date config.sh.
23789                 case "$hint" in
23790                 previous)
23791                         if test X"$static_ext" != X"$avail_ext"; then
23792                                 $cat <<EOM
23793 NOTICE:  Your previous config.sh list may be incorrect.
23794 The extensions now available to you are
23795         ${avail_ext}
23796 but the default list from your previous config.sh is
23797         ${static_ext}
23798
23799 EOM
23800                         fi
23801                         ;;
23802                 esac
23803                 ;;
23804         esac
23805         : Exclude those that are not xs extensions
23806         case "$dflt" in
23807         '')     dflt=none;;
23808         esac
23809         rp="What extensions do you wish to include?"
23810         . ./myread
23811         case "$ans" in
23812         none) static_ext=' ' ;;
23813         *) static_ext="$ans" ;;
23814         esac
23815         ;;
23816 esac
23817 #
23818 # Encode is a special case.  If we are building Encode as a static
23819 # extension, we need to explicitly list its subextensions as well.
23820 # For other nested extensions, this is handled automatically by
23821 # the appropriate Makefile.PL.
23822 case " $static_ext " in
23823         *" Encode "*) # Add the subextensions of Encode
23824         cd "$rsrc/cpan"
23825         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23826                 static_ext="$static_ext Encode/$xxx"
23827                 known_extensions="$known_extensions Encode/$xxx"
23828         done
23829         cd "$tdir"
23830         ;;
23831 esac
23832
23833 set X $dynamic_ext $static_ext $nonxs_ext
23834 shift
23835 extensions="$*"
23836
23837 # Sanity check:  We require an extension suitable for use with
23838 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23839 # should show up as failures in the test suite, but it's helpful to
23840 # catch them now.) The 'extensions' list is normally sorted
23841 # alphabetically, so we need to accept either
23842 #    DB_File ... Fcntl ... IO  ....
23843 # or something like
23844 #    Fcntl ... NDBM_File ... IO  ....
23845 case " $extensions"  in
23846 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
23847 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23848 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23849 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23850    echo "WARNING: The Perl you are building will be quite crippled." >& 4
23851    ;;
23852 esac
23853
23854 : Remove libraries needed only for extensions
23855 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23856 : The exception is SunOS 4.x, which needs them.
23857 case "${osname}X${osvers}" in
23858 sunos*X4*)
23859     perllibs="$libs"
23860     ;;
23861 *) case "$usedl" in
23862     $define|true|[yY]*)
23863             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23864             shift
23865             perllibs="$*"
23866             ;;
23867     *)  perllibs="$libs"
23868             ;;
23869     esac
23870     ;;
23871 esac
23872
23873 : Remove build directory name from cppstdin so it can be used from
23874 : either the present location or the final installed location.
23875 echo " "
23876 : Get out of the UU directory to get correct path name.
23877 cd ..
23878 case "$cppstdin" in
23879 `pwd`/cppstdin)
23880         echo "Stripping down cppstdin path name"
23881         cppstdin=cppstdin
23882         ;;
23883 esac
23884 cd UU
23885
23886 : end of configuration questions
23887 echo " "
23888 echo "End of configuration questions."
23889 echo " "
23890
23891 : back to where it started
23892 if test -d ../UU; then
23893         cd ..
23894 fi
23895
23896 : configuration may be unconditionally patched via a 'config.arch' file
23897 if $test -f config.arch; then
23898         echo "I see a config.arch file, loading it." >&4
23899         . ./config.arch
23900 fi
23901
23902 : configuration may be patched via a 'config.over' file
23903 if $test -f config.over; then
23904         echo " "
23905         dflt=y
23906         rp='I see a config.over file.  Do you wish to load it?'
23907         . UU/myread
23908         case "$ans" in
23909         n*) echo "OK, I'll ignore it.";;
23910         *)      . ./config.over
23911                 echo "Configuration override changes have been loaded."
23912                 ;;
23913         esac
23914 fi
23915
23916 : in case they want portability, strip down executable paths
23917 case "$d_portable" in
23918 "$define")
23919         echo " "
23920         echo "Stripping down executable paths..." >&4
23921         for file in $loclist $trylist; do
23922                 eval temp=\$$file
23923                 eval $file=`basename $temp`
23924         done
23925         ;;
23926 esac
23927
23928 : create config.sh file
23929 echo " "
23930 echo "Creating config.sh..." >&4
23931 $spitshell <<EOT >config.sh
23932 $startsh
23933 #
23934 # This file was produced by running the Configure script. It holds all the
23935 # definitions figured out by Configure. Should you modify one of these values,
23936 # do not forget to propagate your changes by running "Configure -der". You may
23937 # instead choose to run each of the .SH files by yourself, or "Configure -S".
23938 #
23939
23940 # Package name      : $package
23941 # Source directory  : $src
23942 # Configuration time: $cf_time
23943 # Configured by     : $cf_by
23944 # Target system     : $myuname
23945
23946 EOT
23947 : Add in command line options if available
23948 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23949
23950 $spitshell <<EOT >>config.sh
23951
23952 Author='$Author'
23953 Date='$Date'
23954 Header='$Header'
23955 Id='$Id'
23956 Locker='$Locker'
23957 Log='$Log'
23958 RCSfile='$RCSfile'
23959 Revision='$Revision'
23960 Source='$Source'
23961 State='$State'
23962 _a='$_a'
23963 _exe='$_exe'
23964 _o='$_o'
23965 afs='$afs'
23966 afsroot='$afsroot'
23967 alignbytes='$alignbytes'
23968 ansi2knr='$ansi2knr'
23969 aphostname='$aphostname'
23970 api_revision='$api_revision'
23971 api_subversion='$api_subversion'
23972 api_version='$api_version'
23973 api_versionstring='$api_versionstring'
23974 ar='$ar'
23975 archlib='$archlib'
23976 archlibexp='$archlibexp'
23977 archname64='$archname64'
23978 archname='$archname'
23979 archobjs='$archobjs'
23980 asctime_r_proto='$asctime_r_proto'
23981 awk='$awk'
23982 baserev='$baserev'
23983 bash='$bash'
23984 bin='$bin'
23985 bin_ELF='$bin_ELF'
23986 binexp='$binexp'
23987 bison='$bison'
23988 byacc='$byacc'
23989 byteorder='$byteorder'
23990 c='$c'
23991 castflags='$castflags'
23992 cat='$cat'
23993 cc='$cc'
23994 cccdlflags='$cccdlflags'
23995 ccdlflags='$ccdlflags'
23996 ccflags='$ccflags'
23997 ccflags_uselargefiles='$ccflags_uselargefiles'
23998 ccname='$ccname'
23999 ccsymbols='$ccsymbols'
24000 ccversion='$ccversion'
24001 cf_by='$cf_by'
24002 cf_email='$cf_email'
24003 cf_time='$cf_time'
24004 charbits='$charbits'
24005 charsize='$charsize'
24006 chgrp='$chgrp'
24007 chmod='$chmod'
24008 chown='$chown'
24009 clocktype='$clocktype'
24010 comm='$comm'
24011 compress='$compress'
24012 contains='$contains'
24013 cp='$cp'
24014 cpio='$cpio'
24015 cpp='$cpp'
24016 cpp_stuff='$cpp_stuff'
24017 cppccsymbols='$cppccsymbols'
24018 cppflags='$cppflags'
24019 cpplast='$cpplast'
24020 cppminus='$cppminus'
24021 cpprun='$cpprun'
24022 cppstdin='$cppstdin'
24023 cppsymbols='$cppsymbols'
24024 crypt_r_proto='$crypt_r_proto'
24025 cryptlib='$cryptlib'
24026 csh='$csh'
24027 ctermid_r_proto='$ctermid_r_proto'
24028 ctime_r_proto='$ctime_r_proto'
24029 d_Gconvert='$d_Gconvert'
24030 d_PRIEUldbl='$d_PRIEUldbl'
24031 d_PRIFUldbl='$d_PRIFUldbl'
24032 d_PRIGUldbl='$d_PRIGUldbl'
24033 d_PRIXU64='$d_PRIXU64'
24034 d_PRId64='$d_PRId64'
24035 d_PRIeldbl='$d_PRIeldbl'
24036 d_PRIfldbl='$d_PRIfldbl'
24037 d_PRIgldbl='$d_PRIgldbl'
24038 d_PRIi64='$d_PRIi64'
24039 d_PRIo64='$d_PRIo64'
24040 d_PRIu64='$d_PRIu64'
24041 d_PRIx64='$d_PRIx64'
24042 d_SCNfldbl='$d_SCNfldbl'
24043 d__fwalk='$d__fwalk'
24044 d_access='$d_access'
24045 d_accessx='$d_accessx'
24046 d_acosh='$d_acosh'
24047 d_aintl='$d_aintl'
24048 d_alarm='$d_alarm'
24049 d_archlib='$d_archlib'
24050 d_asctime64='$d_asctime64'
24051 d_asctime_r='$d_asctime_r'
24052 d_asinh='$d_asinh'
24053 d_atanh='$d_atanh'
24054 d_atolf='$d_atolf'
24055 d_atoll='$d_atoll'
24056 d_attribute_deprecated='$d_attribute_deprecated'
24057 d_attribute_format='$d_attribute_format'
24058 d_attribute_malloc='$d_attribute_malloc'
24059 d_attribute_nonnull='$d_attribute_nonnull'
24060 d_attribute_noreturn='$d_attribute_noreturn'
24061 d_attribute_pure='$d_attribute_pure'
24062 d_attribute_unused='$d_attribute_unused'
24063 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24064 d_backtrace='$d_backtrace'
24065 d_bcmp='$d_bcmp'
24066 d_bcopy='$d_bcopy'
24067 d_bsd='$d_bsd'
24068 d_bsdgetpgrp='$d_bsdgetpgrp'
24069 d_bsdsetpgrp='$d_bsdsetpgrp'
24070 d_builtin_choose_expr='$d_builtin_choose_expr'
24071 d_builtin_expect='$d_builtin_expect'
24072 d_bzero='$d_bzero'
24073 d_c99_variadic_macros='$d_c99_variadic_macros'
24074 d_casti32='$d_casti32'
24075 d_castneg='$d_castneg'
24076 d_cbrt='$d_cbrt'
24077 d_charvspr='$d_charvspr'
24078 d_chown='$d_chown'
24079 d_chroot='$d_chroot'
24080 d_chsize='$d_chsize'
24081 d_class='$d_class'
24082 d_clearenv='$d_clearenv'
24083 d_closedir='$d_closedir'
24084 d_cmsghdr_s='$d_cmsghdr_s'
24085 d_const='$d_const'
24086 d_copysign='$d_copysign'
24087 d_copysignl='$d_copysignl'
24088 d_cplusplus='$d_cplusplus'
24089 d_crypt='$d_crypt'
24090 d_crypt_r='$d_crypt_r'
24091 d_csh='$d_csh'
24092 d_ctermid='$d_ctermid'
24093 d_ctermid_r='$d_ctermid_r'
24094 d_ctime64='$d_ctime64'
24095 d_ctime_r='$d_ctime_r'
24096 d_cuserid='$d_cuserid'
24097 d_dbl_dig='$d_dbl_dig'
24098 d_dbminitproto='$d_dbminitproto'
24099 d_difftime64='$d_difftime64'
24100 d_difftime='$d_difftime'
24101 d_dir_dd_fd='$d_dir_dd_fd'
24102 d_dirfd='$d_dirfd'
24103 d_dirnamlen='$d_dirnamlen'
24104 d_dladdr='$d_dladdr'
24105 d_dlerror='$d_dlerror'
24106 d_dlopen='$d_dlopen'
24107 d_dlsymun='$d_dlsymun'
24108 d_dosuid='$d_dosuid'
24109 d_drand48_r='$d_drand48_r'
24110 d_drand48proto='$d_drand48proto'
24111 d_dup2='$d_dup2'
24112 d_eaccess='$d_eaccess'
24113 d_endgrent='$d_endgrent'
24114 d_endgrent_r='$d_endgrent_r'
24115 d_endhent='$d_endhent'
24116 d_endhostent_r='$d_endhostent_r'
24117 d_endnent='$d_endnent'
24118 d_endnetent_r='$d_endnetent_r'
24119 d_endpent='$d_endpent'
24120 d_endprotoent_r='$d_endprotoent_r'
24121 d_endpwent='$d_endpwent'
24122 d_endpwent_r='$d_endpwent_r'
24123 d_endsent='$d_endsent'
24124 d_endservent_r='$d_endservent_r'
24125 d_eofnblk='$d_eofnblk'
24126 d_erf='$d_erf'
24127 d_erfc='$d_erfc'
24128 d_eunice='$d_eunice'
24129 d_exp2='$d_exp2'
24130 d_expm1='$d_expm1'
24131 d_faststdio='$d_faststdio'
24132 d_fchdir='$d_fchdir'
24133 d_fchmod='$d_fchmod'
24134 d_fchown='$d_fchown'
24135 d_fcntl='$d_fcntl'
24136 d_fcntl_can_lock='$d_fcntl_can_lock'
24137 d_fd_macros='$d_fd_macros'
24138 d_fd_set='$d_fd_set'
24139 d_fdim='$d_fdim'
24140 d_fds_bits='$d_fds_bits'
24141 d_fegetround='$d_fegetround'
24142 d_fgetpos='$d_fgetpos'
24143 d_finite='$d_finite'
24144 d_finitel='$d_finitel'
24145 d_flexfnam='$d_flexfnam'
24146 d_flock='$d_flock'
24147 d_flockproto='$d_flockproto'
24148 d_fma='$d_fma'
24149 d_fmax='$d_fmax'
24150 d_fmin='$d_fmin'
24151 d_fork='$d_fork'
24152 d_fp_class='$d_fp_class'
24153 d_fp_classify='$d_fp_classify'
24154 d_fp_classl='$d_fp_classl'
24155 d_fpathconf='$d_fpathconf'
24156 d_fpclass='$d_fpclass'
24157 d_fpclassify='$d_fpclassify'
24158 d_fpclassl='$d_fpclassl'
24159 d_fpgetround='$d_fpgetround'
24160 d_fpos64_t='$d_fpos64_t'
24161 d_frexpl='$d_frexpl'
24162 d_fs_data_s='$d_fs_data_s'
24163 d_fseeko='$d_fseeko'
24164 d_fsetpos='$d_fsetpos'
24165 d_fstatfs='$d_fstatfs'
24166 d_fstatvfs='$d_fstatvfs'
24167 d_fsync='$d_fsync'
24168 d_ftello='$d_ftello'
24169 d_ftime='$d_ftime'
24170 d_futimes='$d_futimes'
24171 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
24172 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
24173 d_getaddrinfo='$d_getaddrinfo'
24174 d_getcwd='$d_getcwd'
24175 d_getespwnam='$d_getespwnam'
24176 d_getfsstat='$d_getfsstat'
24177 d_getgrent='$d_getgrent'
24178 d_getgrent_r='$d_getgrent_r'
24179 d_getgrgid_r='$d_getgrgid_r'
24180 d_getgrnam_r='$d_getgrnam_r'
24181 d_getgrps='$d_getgrps'
24182 d_gethbyaddr='$d_gethbyaddr'
24183 d_gethbyname='$d_gethbyname'
24184 d_gethent='$d_gethent'
24185 d_gethname='$d_gethname'
24186 d_gethostbyaddr_r='$d_gethostbyaddr_r'
24187 d_gethostbyname_r='$d_gethostbyname_r'
24188 d_gethostent_r='$d_gethostent_r'
24189 d_gethostprotos='$d_gethostprotos'
24190 d_getitimer='$d_getitimer'
24191 d_getlogin='$d_getlogin'
24192 d_getlogin_r='$d_getlogin_r'
24193 d_getmnt='$d_getmnt'
24194 d_getmntent='$d_getmntent'
24195 d_getnameinfo='$d_getnameinfo'
24196 d_getnbyaddr='$d_getnbyaddr'
24197 d_getnbyname='$d_getnbyname'
24198 d_getnent='$d_getnent'
24199 d_getnetbyaddr_r='$d_getnetbyaddr_r'
24200 d_getnetbyname_r='$d_getnetbyname_r'
24201 d_getnetent_r='$d_getnetent_r'
24202 d_getnetprotos='$d_getnetprotos'
24203 d_getpagsz='$d_getpagsz'
24204 d_getpbyname='$d_getpbyname'
24205 d_getpbynumber='$d_getpbynumber'
24206 d_getpent='$d_getpent'
24207 d_getpgid='$d_getpgid'
24208 d_getpgrp2='$d_getpgrp2'
24209 d_getpgrp='$d_getpgrp'
24210 d_getppid='$d_getppid'
24211 d_getprior='$d_getprior'
24212 d_getprotobyname_r='$d_getprotobyname_r'
24213 d_getprotobynumber_r='$d_getprotobynumber_r'
24214 d_getprotoent_r='$d_getprotoent_r'
24215 d_getprotoprotos='$d_getprotoprotos'
24216 d_getprpwnam='$d_getprpwnam'
24217 d_getpwent='$d_getpwent'
24218 d_getpwent_r='$d_getpwent_r'
24219 d_getpwnam_r='$d_getpwnam_r'
24220 d_getpwuid_r='$d_getpwuid_r'
24221 d_getsbyname='$d_getsbyname'
24222 d_getsbyport='$d_getsbyport'
24223 d_getsent='$d_getsent'
24224 d_getservbyname_r='$d_getservbyname_r'
24225 d_getservbyport_r='$d_getservbyport_r'
24226 d_getservent_r='$d_getservent_r'
24227 d_getservprotos='$d_getservprotos'
24228 d_getspnam='$d_getspnam'
24229 d_getspnam_r='$d_getspnam_r'
24230 d_gettimeod='$d_gettimeod'
24231 d_gmtime64='$d_gmtime64'
24232 d_gmtime_r='$d_gmtime_r'
24233 d_gnulibc='$d_gnulibc'
24234 d_grpasswd='$d_grpasswd'
24235 d_hasmntopt='$d_hasmntopt'
24236 d_htonl='$d_htonl'
24237 d_hypot='$d_hypot'
24238 d_ilogb='$d_ilogb'
24239 d_ilogbl='$d_ilogbl'
24240 d_inc_version_list='$d_inc_version_list'
24241 d_index='$d_index'
24242 d_inetaton='$d_inetaton'
24243 d_inetntop='$d_inetntop'
24244 d_inetpton='$d_inetpton'
24245 d_int64_t='$d_int64_t'
24246 d_ip_mreq='$d_ip_mreq'
24247 d_ip_mreq_source='$d_ip_mreq_source'
24248 d_ipv6_mreq='$d_ipv6_mreq'
24249 d_ipv6_mreq_source='$d_ipv6_mreq_source'
24250 d_isascii='$d_isascii'
24251 d_isblank='$d_isblank'
24252 d_isfinite='$d_isfinite'
24253 d_isfinitel='$d_isfinitel'
24254 d_isinf='$d_isinf'
24255 d_isinfl='$d_isinfl'
24256 d_isless='$d_isless'
24257 d_isnan='$d_isnan'
24258 d_isnanl='$d_isnanl'
24259 d_isnormal='$d_isnormal'
24260 d_j0='$d_j0'
24261 d_j0l='$d_j0l'
24262 d_killpg='$d_killpg'
24263 d_lc_monetary_2008='$d_lc_monetary_2008'
24264 d_lchown='$d_lchown'
24265 d_ldbl_dig='$d_ldbl_dig'
24266 d_ldexpl='$d_ldexpl'
24267 d_lgamma='$d_lgamma'
24268 d_lgamma_r='$d_lgamma_r'
24269 d_libm_lib_version='$d_libm_lib_version'
24270 d_libname_unique='$d_libname_unique'
24271 d_link='$d_link'
24272 d_llrint='$d_llrint'
24273 d_llrintl='$d_llrintl'
24274 d_llround='$d_llround'
24275 d_llroundl='$d_llroundl'
24276 d_localtime64='$d_localtime64'
24277 d_localtime_r='$d_localtime_r'
24278 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24279 d_locconv='$d_locconv'
24280 d_lockf='$d_lockf'
24281 d_log1p='$d_log1p'
24282 d_log2='$d_log2'
24283 d_logb='$d_logb'
24284 d_longdbl='$d_longdbl'
24285 d_longlong='$d_longlong'
24286 d_lrint='$d_lrint'
24287 d_lrintl='$d_lrintl'
24288 d_lround='$d_lround'
24289 d_lroundl='$d_lroundl'
24290 d_lseekproto='$d_lseekproto'
24291 d_lstat='$d_lstat'
24292 d_madvise='$d_madvise'
24293 d_malloc_good_size='$d_malloc_good_size'
24294 d_malloc_size='$d_malloc_size'
24295 d_mblen='$d_mblen'
24296 d_mbstowcs='$d_mbstowcs'
24297 d_mbtowc='$d_mbtowc'
24298 d_memchr='$d_memchr'
24299 d_memcmp='$d_memcmp'
24300 d_memcpy='$d_memcpy'
24301 d_memmove='$d_memmove'
24302 d_memset='$d_memset'
24303 d_mkdir='$d_mkdir'
24304 d_mkdtemp='$d_mkdtemp'
24305 d_mkfifo='$d_mkfifo'
24306 d_mkstemp='$d_mkstemp'
24307 d_mkstemps='$d_mkstemps'
24308 d_mktime64='$d_mktime64'
24309 d_mktime='$d_mktime'
24310 d_mmap='$d_mmap'
24311 d_modfl='$d_modfl'
24312 d_modfl_pow32_bug='$d_modfl_pow32_bug'
24313 d_modflproto='$d_modflproto'
24314 d_mprotect='$d_mprotect'
24315 d_msg='$d_msg'
24316 d_msg_ctrunc='$d_msg_ctrunc'
24317 d_msg_dontroute='$d_msg_dontroute'
24318 d_msg_oob='$d_msg_oob'
24319 d_msg_peek='$d_msg_peek'
24320 d_msg_proxy='$d_msg_proxy'
24321 d_msgctl='$d_msgctl'
24322 d_msgget='$d_msgget'
24323 d_msghdr_s='$d_msghdr_s'
24324 d_msgrcv='$d_msgrcv'
24325 d_msgsnd='$d_msgsnd'
24326 d_msync='$d_msync'
24327 d_munmap='$d_munmap'
24328 d_mymalloc='$d_mymalloc'
24329 d_nan='$d_nan'
24330 d_ndbm='$d_ndbm'
24331 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24332 d_nearbyint='$d_nearbyint'
24333 d_nextafter='$d_nextafter'
24334 d_nexttoward='$d_nexttoward'
24335 d_nice='$d_nice'
24336 d_nl_langinfo='$d_nl_langinfo'
24337 d_nv_preserves_uv='$d_nv_preserves_uv'
24338 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24339 d_off64_t='$d_off64_t'
24340 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24341 d_oldpthreads='$d_oldpthreads'
24342 d_oldsock='$d_oldsock'
24343 d_open3='$d_open3'
24344 d_pathconf='$d_pathconf'
24345 d_pause='$d_pause'
24346 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24347 d_phostname='$d_phostname'
24348 d_pipe='$d_pipe'
24349 d_poll='$d_poll'
24350 d_portable='$d_portable'
24351 d_prctl='$d_prctl'
24352 d_prctl_set_name='$d_prctl_set_name'
24353 d_printf_format_null='$d_printf_format_null'
24354 d_procselfexe='$d_procselfexe'
24355 d_pseudofork='$d_pseudofork'
24356 d_pthread_atfork='$d_pthread_atfork'
24357 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24358 d_pthread_yield='$d_pthread_yield'
24359 d_ptrdiff_t='$d_ptrdiff_t'
24360 d_pwage='$d_pwage'
24361 d_pwchange='$d_pwchange'
24362 d_pwclass='$d_pwclass'
24363 d_pwcomment='$d_pwcomment'
24364 d_pwexpire='$d_pwexpire'
24365 d_pwgecos='$d_pwgecos'
24366 d_pwpasswd='$d_pwpasswd'
24367 d_pwquota='$d_pwquota'
24368 d_qgcvt='$d_qgcvt'
24369 d_quad='$d_quad'
24370 d_random_r='$d_random_r'
24371 d_re_comp='$d_re_comp'
24372 d_readdir64_r='$d_readdir64_r'
24373 d_readdir='$d_readdir'
24374 d_readdir_r='$d_readdir_r'
24375 d_readlink='$d_readlink'
24376 d_readv='$d_readv'
24377 d_recvmsg='$d_recvmsg'
24378 d_regcmp='$d_regcmp'
24379 d_regcomp='$d_regcomp'
24380 d_remainder='$d_remainder'
24381 d_remquo='$d_remquo'
24382 d_rename='$d_rename'
24383 d_rewinddir='$d_rewinddir'
24384 d_rint='$d_rint'
24385 d_rmdir='$d_rmdir'
24386 d_round='$d_round'
24387 d_safebcpy='$d_safebcpy'
24388 d_safemcpy='$d_safemcpy'
24389 d_sanemcmp='$d_sanemcmp'
24390 d_sbrkproto='$d_sbrkproto'
24391 d_scalbn='$d_scalbn'
24392 d_scalbnl='$d_scalbnl'
24393 d_sched_yield='$d_sched_yield'
24394 d_scm_rights='$d_scm_rights'
24395 d_seekdir='$d_seekdir'
24396 d_select='$d_select'
24397 d_sem='$d_sem'
24398 d_semctl='$d_semctl'
24399 d_semctl_semid_ds='$d_semctl_semid_ds'
24400 d_semctl_semun='$d_semctl_semun'
24401 d_semget='$d_semget'
24402 d_semop='$d_semop'
24403 d_sendmsg='$d_sendmsg'
24404 d_setegid='$d_setegid'
24405 d_seteuid='$d_seteuid'
24406 d_setgrent='$d_setgrent'
24407 d_setgrent_r='$d_setgrent_r'
24408 d_setgrps='$d_setgrps'
24409 d_sethent='$d_sethent'
24410 d_sethostent_r='$d_sethostent_r'
24411 d_setitimer='$d_setitimer'
24412 d_setlinebuf='$d_setlinebuf'
24413 d_setlocale='$d_setlocale'
24414 d_setlocale_r='$d_setlocale_r'
24415 d_setnent='$d_setnent'
24416 d_setnetent_r='$d_setnetent_r'
24417 d_setpent='$d_setpent'
24418 d_setpgid='$d_setpgid'
24419 d_setpgrp2='$d_setpgrp2'
24420 d_setpgrp='$d_setpgrp'
24421 d_setprior='$d_setprior'
24422 d_setproctitle='$d_setproctitle'
24423 d_setprotoent_r='$d_setprotoent_r'
24424 d_setpwent='$d_setpwent'
24425 d_setpwent_r='$d_setpwent_r'
24426 d_setregid='$d_setregid'
24427 d_setresgid='$d_setresgid'
24428 d_setresuid='$d_setresuid'
24429 d_setreuid='$d_setreuid'
24430 d_setrgid='$d_setrgid'
24431 d_setruid='$d_setruid'
24432 d_setsent='$d_setsent'
24433 d_setservent_r='$d_setservent_r'
24434 d_setsid='$d_setsid'
24435 d_setvbuf='$d_setvbuf'
24436 d_shm='$d_shm'
24437 d_shmat='$d_shmat'
24438 d_shmatprototype='$d_shmatprototype'
24439 d_shmctl='$d_shmctl'
24440 d_shmdt='$d_shmdt'
24441 d_shmget='$d_shmget'
24442 d_sigaction='$d_sigaction'
24443 d_signbit='$d_signbit'
24444 d_sigprocmask='$d_sigprocmask'
24445 d_sigsetjmp='$d_sigsetjmp'
24446 d_sin6_scope_id='$d_sin6_scope_id'
24447 d_sitearch='$d_sitearch'
24448 d_snprintf='$d_snprintf'
24449 d_sockaddr_in6='$d_sockaddr_in6'
24450 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24451 d_sockatmark='$d_sockatmark'
24452 d_sockatmarkproto='$d_sockatmarkproto'
24453 d_socket='$d_socket'
24454 d_socklen_t='$d_socklen_t'
24455 d_sockpair='$d_sockpair'
24456 d_socks5_init='$d_socks5_init'
24457 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
24458 d_sqrtl='$d_sqrtl'
24459 d_srand48_r='$d_srand48_r'
24460 d_srandom_r='$d_srandom_r'
24461 d_sresgproto='$d_sresgproto'
24462 d_sresuproto='$d_sresuproto'
24463 d_stat='$d_stat'
24464 d_statblks='$d_statblks'
24465 d_statfs_f_flags='$d_statfs_f_flags'
24466 d_statfs_s='$d_statfs_s'
24467 d_static_inline='$d_static_inline'
24468 d_statvfs='$d_statvfs'
24469 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24470 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24471 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24472 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24473 d_stdio_stream_array='$d_stdio_stream_array'
24474 d_stdiobase='$d_stdiobase'
24475 d_stdstdio='$d_stdstdio'
24476 d_strchr='$d_strchr'
24477 d_strcoll='$d_strcoll'
24478 d_strctcpy='$d_strctcpy'
24479 d_strerrm='$d_strerrm'
24480 d_strerror='$d_strerror'
24481 d_strerror_r='$d_strerror_r'
24482 d_strftime='$d_strftime'
24483 d_strlcat='$d_strlcat'
24484 d_strlcpy='$d_strlcpy'
24485 d_strtod='$d_strtod'
24486 d_strtol='$d_strtol'
24487 d_strtold='$d_strtold'
24488 d_strtoll='$d_strtoll'
24489 d_strtoq='$d_strtoq'
24490 d_strtoul='$d_strtoul'
24491 d_strtoull='$d_strtoull'
24492 d_strtouq='$d_strtouq'
24493 d_strxfrm='$d_strxfrm'
24494 d_suidsafe='$d_suidsafe'
24495 d_symlink='$d_symlink'
24496 d_syscall='$d_syscall'
24497 d_syscallproto='$d_syscallproto'
24498 d_sysconf='$d_sysconf'
24499 d_sysernlst='$d_sysernlst'
24500 d_syserrlst='$d_syserrlst'
24501 d_system='$d_system'
24502 d_tcgetpgrp='$d_tcgetpgrp'
24503 d_tcsetpgrp='$d_tcsetpgrp'
24504 d_telldir='$d_telldir'
24505 d_telldirproto='$d_telldirproto'
24506 d_tgamma='$d_tgamma'
24507 d_time='$d_time'
24508 d_timegm='$d_timegm'
24509 d_times='$d_times'
24510 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24511 d_tm_tm_zone='$d_tm_tm_zone'
24512 d_tmpnam_r='$d_tmpnam_r'
24513 d_trunc='$d_trunc'
24514 d_truncate='$d_truncate'
24515 d_truncl='$d_truncl'
24516 d_ttyname_r='$d_ttyname_r'
24517 d_tzname='$d_tzname'
24518 d_u32align='$d_u32align'
24519 d_ualarm='$d_ualarm'
24520 d_umask='$d_umask'
24521 d_uname='$d_uname'
24522 d_union_semun='$d_union_semun'
24523 d_unordered='$d_unordered'
24524 d_unsetenv='$d_unsetenv'
24525 d_usleep='$d_usleep'
24526 d_usleepproto='$d_usleepproto'
24527 d_ustat='$d_ustat'
24528 d_vendorarch='$d_vendorarch'
24529 d_vendorbin='$d_vendorbin'
24530 d_vendorlib='$d_vendorlib'
24531 d_vendorscript='$d_vendorscript'
24532 d_vfork='$d_vfork'
24533 d_void_closedir='$d_void_closedir'
24534 d_voidsig='$d_voidsig'
24535 d_voidtty='$d_voidtty'
24536 d_volatile='$d_volatile'
24537 d_vprintf='$d_vprintf'
24538 d_vsnprintf='$d_vsnprintf'
24539 d_wait4='$d_wait4'
24540 d_waitpid='$d_waitpid'
24541 d_wcscmp='$d_wcscmp'
24542 d_wcstombs='$d_wcstombs'
24543 d_wcsxfrm='$d_wcsxfrm'
24544 d_wctomb='$d_wctomb'
24545 d_writev='$d_writev'
24546 d_xenix='$d_xenix'
24547 date='$date'
24548 db_hashtype='$db_hashtype'
24549 db_prefixtype='$db_prefixtype'
24550 db_version_major='$db_version_major'
24551 db_version_minor='$db_version_minor'
24552 db_version_patch='$db_version_patch'
24553 direntrytype='$direntrytype'
24554 dlext='$dlext'
24555 dlsrc='$dlsrc'
24556 doubleinfbytes='$doubleinfbytes'
24557 doublekind='$doublekind'
24558 doublemantbits='$doublemantbits'
24559 doublenanbytes='$doublenanbytes'
24560 doublesize='$doublesize'
24561 drand01='$drand01'
24562 drand48_r_proto='$drand48_r_proto'
24563 dtrace='$dtrace'
24564 dynamic_ext='$dynamic_ext'
24565 eagain='$eagain'
24566 ebcdic='$ebcdic'
24567 echo='$echo'
24568 egrep='$egrep'
24569 emacs='$emacs'
24570 endgrent_r_proto='$endgrent_r_proto'
24571 endhostent_r_proto='$endhostent_r_proto'
24572 endnetent_r_proto='$endnetent_r_proto'
24573 endprotoent_r_proto='$endprotoent_r_proto'
24574 endpwent_r_proto='$endpwent_r_proto'
24575 endservent_r_proto='$endservent_r_proto'
24576 eunicefix='$eunicefix'
24577 exe_ext='$exe_ext'
24578 expr='$expr'
24579 extensions='$extensions'
24580 extern_C='$extern_C'
24581 extras='$extras'
24582 fflushNULL='$fflushNULL'
24583 fflushall='$fflushall'
24584 find='$find'
24585 firstmakefile='$firstmakefile'
24586 flex='$flex'
24587 fpossize='$fpossize'
24588 fpostype='$fpostype'
24589 freetype='$freetype'
24590 from='$from'
24591 full_ar='$full_ar'
24592 full_csh='$full_csh'
24593 full_sed='$full_sed'
24594 gccansipedantic='$gccansipedantic'
24595 gccosandvers='$gccosandvers'
24596 gccversion='$gccversion'
24597 getgrent_r_proto='$getgrent_r_proto'
24598 getgrgid_r_proto='$getgrgid_r_proto'
24599 getgrnam_r_proto='$getgrnam_r_proto'
24600 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24601 gethostbyname_r_proto='$gethostbyname_r_proto'
24602 gethostent_r_proto='$gethostent_r_proto'
24603 getlogin_r_proto='$getlogin_r_proto'
24604 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24605 getnetbyname_r_proto='$getnetbyname_r_proto'
24606 getnetent_r_proto='$getnetent_r_proto'
24607 getprotobyname_r_proto='$getprotobyname_r_proto'
24608 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24609 getprotoent_r_proto='$getprotoent_r_proto'
24610 getpwent_r_proto='$getpwent_r_proto'
24611 getpwnam_r_proto='$getpwnam_r_proto'
24612 getpwuid_r_proto='$getpwuid_r_proto'
24613 getservbyname_r_proto='$getservbyname_r_proto'
24614 getservbyport_r_proto='$getservbyport_r_proto'
24615 getservent_r_proto='$getservent_r_proto'
24616 getspnam_r_proto='$getspnam_r_proto'
24617 gidformat='$gidformat'
24618 gidsign='$gidsign'
24619 gidsize='$gidsize'
24620 gidtype='$gidtype'
24621 glibpth='$glibpth'
24622 gmake='$gmake'
24623 gmtime_r_proto='$gmtime_r_proto'
24624 gnulibc_version='$gnulibc_version'
24625 grep='$grep'
24626 groupcat='$groupcat'
24627 groupstype='$groupstype'
24628 gzip='$gzip'
24629 h_fcntl='$h_fcntl'
24630 h_sysfile='$h_sysfile'
24631 hint='$hint'
24632 hostcat='$hostcat'
24633 hostgenerate='$hostgenerate'
24634 hostosname='$hostosname'
24635 hostperl='$hostperl'
24636 html1dir='$html1dir'
24637 html1direxp='$html1direxp'
24638 html3dir='$html3dir'
24639 html3direxp='$html3direxp'
24640 i16size='$i16size'
24641 i16type='$i16type'
24642 i32size='$i32size'
24643 i32type='$i32type'
24644 i64size='$i64size'
24645 i64type='$i64type'
24646 i8size='$i8size'
24647 i8type='$i8type'
24648 i_arpainet='$i_arpainet'
24649 i_assert='$i_assert'
24650 i_bfd='$i_bfd'
24651 i_bsdioctl='$i_bsdioctl'
24652 i_crypt='$i_crypt'
24653 i_db='$i_db'
24654 i_dbm='$i_dbm'
24655 i_dirent='$i_dirent'
24656 i_dlfcn='$i_dlfcn'
24657 i_execinfo='$i_execinfo'
24658 i_fcntl='$i_fcntl'
24659 i_fenv='$i_fenv'
24660 i_float='$i_float'
24661 i_fp='$i_fp'
24662 i_fp_class='$i_fp_class'
24663 i_gdbm='$i_gdbm'
24664 i_gdbm_ndbm='$i_gdbm_ndbm'
24665 i_gdbmndbm='$i_gdbmndbm'
24666 i_grp='$i_grp'
24667 i_ieeefp='$i_ieeefp'
24668 i_inttypes='$i_inttypes'
24669 i_langinfo='$i_langinfo'
24670 i_libutil='$i_libutil'
24671 i_limits='$i_limits'
24672 i_locale='$i_locale'
24673 i_machcthr='$i_machcthr'
24674 i_malloc='$i_malloc'
24675 i_mallocmalloc='$i_mallocmalloc'
24676 i_math='$i_math'
24677 i_memory='$i_memory'
24678 i_mntent='$i_mntent'
24679 i_ndbm='$i_ndbm'
24680 i_netdb='$i_netdb'
24681 i_neterrno='$i_neterrno'
24682 i_netinettcp='$i_netinettcp'
24683 i_niin='$i_niin'
24684 i_poll='$i_poll'
24685 i_prot='$i_prot'
24686 i_pthread='$i_pthread'
24687 i_pwd='$i_pwd'
24688 i_quadmath='$i_quadmath'
24689 i_rpcsvcdbm='$i_rpcsvcdbm'
24690 i_sgtty='$i_sgtty'
24691 i_shadow='$i_shadow'
24692 i_socks='$i_socks'
24693 i_stdarg='$i_stdarg'
24694 i_stdbool='$i_stdbool'
24695 i_stddef='$i_stddef'
24696 i_stdint='$i_stdint'
24697 i_stdlib='$i_stdlib'
24698 i_string='$i_string'
24699 i_sunmath='$i_sunmath'
24700 i_sysaccess='$i_sysaccess'
24701 i_sysdir='$i_sysdir'
24702 i_sysfile='$i_sysfile'
24703 i_sysfilio='$i_sysfilio'
24704 i_sysin='$i_sysin'
24705 i_sysioctl='$i_sysioctl'
24706 i_syslog='$i_syslog'
24707 i_sysmman='$i_sysmman'
24708 i_sysmode='$i_sysmode'
24709 i_sysmount='$i_sysmount'
24710 i_sysndir='$i_sysndir'
24711 i_sysparam='$i_sysparam'
24712 i_syspoll='$i_syspoll'
24713 i_sysresrc='$i_sysresrc'
24714 i_syssecrt='$i_syssecrt'
24715 i_sysselct='$i_sysselct'
24716 i_syssockio='$i_syssockio'
24717 i_sysstat='$i_sysstat'
24718 i_sysstatfs='$i_sysstatfs'
24719 i_sysstatvfs='$i_sysstatvfs'
24720 i_systime='$i_systime'
24721 i_systimek='$i_systimek'
24722 i_systimes='$i_systimes'
24723 i_systypes='$i_systypes'
24724 i_sysuio='$i_sysuio'
24725 i_sysun='$i_sysun'
24726 i_sysutsname='$i_sysutsname'
24727 i_sysvfs='$i_sysvfs'
24728 i_syswait='$i_syswait'
24729 i_termio='$i_termio'
24730 i_termios='$i_termios'
24731 i_time='$i_time'
24732 i_unistd='$i_unistd'
24733 i_ustat='$i_ustat'
24734 i_utime='$i_utime'
24735 i_values='$i_values'
24736 i_varargs='$i_varargs'
24737 i_varhdr='$i_varhdr'
24738 i_vfork='$i_vfork'
24739 ignore_versioned_solibs='$ignore_versioned_solibs'
24740 inc_version_list='$inc_version_list'
24741 inc_version_list_init='$inc_version_list_init'
24742 incpath='$incpath'
24743 incpth='$incpth'
24744 inews='$inews'
24745 initialinstalllocation='$initialinstalllocation'
24746 installarchlib='$installarchlib'
24747 installbin='$installbin'
24748 installhtml1dir='$installhtml1dir'
24749 installhtml3dir='$installhtml3dir'
24750 installman1dir='$installman1dir'
24751 installman3dir='$installman3dir'
24752 installprefix='$installprefix'
24753 installprefixexp='$installprefixexp'
24754 installprivlib='$installprivlib'
24755 installscript='$installscript'
24756 installsitearch='$installsitearch'
24757 installsitebin='$installsitebin'
24758 installsitehtml1dir='$installsitehtml1dir'
24759 installsitehtml3dir='$installsitehtml3dir'
24760 installsitelib='$installsitelib'
24761 installsiteman1dir='$installsiteman1dir'
24762 installsiteman3dir='$installsiteman3dir'
24763 installsitescript='$installsitescript'
24764 installstyle='$installstyle'
24765 installusrbinperl='$installusrbinperl'
24766 installvendorarch='$installvendorarch'
24767 installvendorbin='$installvendorbin'
24768 installvendorhtml1dir='$installvendorhtml1dir'
24769 installvendorhtml3dir='$installvendorhtml3dir'
24770 installvendorlib='$installvendorlib'
24771 installvendorman1dir='$installvendorman1dir'
24772 installvendorman3dir='$installvendorman3dir'
24773 installvendorscript='$installvendorscript'
24774 intsize='$intsize'
24775 issymlink='$issymlink'
24776 ivdformat='$ivdformat'
24777 ivsize='$ivsize'
24778 ivtype='$ivtype'
24779 known_extensions='$known_extensions'
24780 ksh='$ksh'
24781 ld='$ld'
24782 ld_can_script='$ld_can_script'
24783 lddlflags='$lddlflags'
24784 ldflags='$ldflags'
24785 ldflags_uselargefiles='$ldflags_uselargefiles'
24786 ldlibpthname='$ldlibpthname'
24787 less='$less'
24788 lib_ext='$lib_ext'
24789 libc='$libc'
24790 libperl='$libperl'
24791 libpth='$libpth'
24792 libs='$libs'
24793 libsdirs='$libsdirs'
24794 libsfiles='$libsfiles'
24795 libsfound='$libsfound'
24796 libspath='$libspath'
24797 libswanted='$libswanted'
24798 libswanted_uselargefiles='$libswanted_uselargefiles'
24799 line='$line'
24800 lint='$lint'
24801 lkflags='$lkflags'
24802 ln='$ln'
24803 lns='$lns'
24804 localtime_r_proto='$localtime_r_proto'
24805 locincpth='$locincpth'
24806 loclibpth='$loclibpth'
24807 longdblinfbytes='$longdblinfbytes'
24808 longdblkind='$longdblkind'
24809 longdblmantbits='$longdblmantbits'
24810 longdblnanbytes='$longdblnanbytes'
24811 longdblsize='$longdblsize'
24812 longlongsize='$longlongsize'
24813 longsize='$longsize'
24814 lp='$lp'
24815 lpr='$lpr'
24816 ls='$ls'
24817 lseeksize='$lseeksize'
24818 lseektype='$lseektype'
24819 mail='$mail'
24820 mailx='$mailx'
24821 make='$make'
24822 make_set_make='$make_set_make'
24823 mallocobj='$mallocobj'
24824 mallocsrc='$mallocsrc'
24825 malloctype='$malloctype'
24826 man1dir='$man1dir'
24827 man1direxp='$man1direxp'
24828 man1ext='$man1ext'
24829 man3dir='$man3dir'
24830 man3direxp='$man3direxp'
24831 man3ext='$man3ext'
24832 mips_type='$mips_type'
24833 mistrustnm='$mistrustnm'
24834 mkdir='$mkdir'
24835 mmaptype='$mmaptype'
24836 modetype='$modetype'
24837 more='$more'
24838 multiarch='$multiarch'
24839 mv='$mv'
24840 myarchname='$myarchname'
24841 mydomain='$mydomain'
24842 myhostname='$myhostname'
24843 myuname='$myuname'
24844 n='$n'
24845 need_va_copy='$need_va_copy'
24846 netdb_hlen_type='$netdb_hlen_type'
24847 netdb_host_type='$netdb_host_type'
24848 netdb_name_type='$netdb_name_type'
24849 netdb_net_type='$netdb_net_type'
24850 nm='$nm'
24851 nm_opt='$nm_opt'
24852 nm_so_opt='$nm_so_opt'
24853 nonxs_ext='$nonxs_ext'
24854 nroff='$nroff'
24855 nvEUformat='$nvEUformat'
24856 nvFUformat='$nvFUformat'
24857 nvGUformat='$nvGUformat'
24858 nv_overflows_integers_at='$nv_overflows_integers_at'
24859 nv_preserves_uv_bits='$nv_preserves_uv_bits'
24860 nveformat='$nveformat'
24861 nvfformat='$nvfformat'
24862 nvgformat='$nvgformat'
24863 nvmantbits='$nvmantbits'
24864 nvsize='$nvsize'
24865 nvtype='$nvtype'
24866 o_nonblock='$o_nonblock'
24867 obj_ext='$obj_ext'
24868 old_pthread_create_joinable='$old_pthread_create_joinable'
24869 optimize='$optimize'
24870 orderlib='$orderlib'
24871 osname='$osname'
24872 osvers='$osvers'
24873 otherlibdirs='$otherlibdirs'
24874 package='$package'
24875 pager='$pager'
24876 passcat='$passcat'
24877 patchlevel='$patchlevel'
24878 path_sep='$path_sep'
24879 perl5='$perl5'
24880 perl='$perl'
24881 perl_patchlevel='$perl_patchlevel'
24882 perl_static_inline='$perl_static_inline'
24883 perladmin='$perladmin'
24884 perllibs='$perllibs'
24885 perlpath='$perlpath'
24886 pg='$pg'
24887 phostname='$phostname'
24888 pidtype='$pidtype'
24889 plibpth='$plibpth'
24890 pmake='$pmake'
24891 pr='$pr'
24892 prefix='$prefix'
24893 prefixexp='$prefixexp'
24894 privlib='$privlib'
24895 privlibexp='$privlibexp'
24896 procselfexe='$procselfexe'
24897 prototype='$prototype'
24898 ptrsize='$ptrsize'
24899 quadkind='$quadkind'
24900 quadtype='$quadtype'
24901 randbits='$randbits'
24902 randfunc='$randfunc'
24903 random_r_proto='$random_r_proto'
24904 randseedtype='$randseedtype'
24905 ranlib='$ranlib'
24906 rd_nodata='$rd_nodata'
24907 readdir64_r_proto='$readdir64_r_proto'
24908 readdir_r_proto='$readdir_r_proto'
24909 revision='$revision'
24910 rm='$rm'
24911 rm_try='$rm_try'
24912 rmail='$rmail'
24913 run='$run'
24914 runnm='$runnm'
24915 sGMTIME_max='$sGMTIME_max'
24916 sGMTIME_min='$sGMTIME_min'
24917 sLOCALTIME_max='$sLOCALTIME_max'
24918 sLOCALTIME_min='$sLOCALTIME_min'
24919 sPRIEUldbl='$sPRIEUldbl'
24920 sPRIFUldbl='$sPRIFUldbl'
24921 sPRIGUldbl='$sPRIGUldbl'
24922 sPRIXU64='$sPRIXU64'
24923 sPRId64='$sPRId64'
24924 sPRIeldbl='$sPRIeldbl'
24925 sPRIfldbl='$sPRIfldbl'
24926 sPRIgldbl='$sPRIgldbl'
24927 sPRIi64='$sPRIi64'
24928 sPRIo64='$sPRIo64'
24929 sPRIu64='$sPRIu64'
24930 sPRIx64='$sPRIx64'
24931 sSCNfldbl='$sSCNfldbl'
24932 sched_yield='$sched_yield'
24933 scriptdir='$scriptdir'
24934 scriptdirexp='$scriptdirexp'
24935 sed='$sed'
24936 seedfunc='$seedfunc'
24937 selectminbits='$selectminbits'
24938 selecttype='$selecttype'
24939 sendmail='$sendmail'
24940 setgrent_r_proto='$setgrent_r_proto'
24941 sethostent_r_proto='$sethostent_r_proto'
24942 setlocale_r_proto='$setlocale_r_proto'
24943 setnetent_r_proto='$setnetent_r_proto'
24944 setprotoent_r_proto='$setprotoent_r_proto'
24945 setpwent_r_proto='$setpwent_r_proto'
24946 setservent_r_proto='$setservent_r_proto'
24947 sh='$sh'
24948 shar='$shar'
24949 sharpbang='$sharpbang'
24950 shmattype='$shmattype'
24951 shortsize='$shortsize'
24952 shrpenv='$shrpenv'
24953 shsharp='$shsharp'
24954 sig_count='$sig_count'
24955 sig_name='$sig_name'
24956 sig_name_init='$sig_name_init'
24957 sig_num='$sig_num'
24958 sig_num_init='$sig_num_init'
24959 sig_size='$sig_size'
24960 signal_t='$signal_t'
24961 sitearch='$sitearch'
24962 sitearchexp='$sitearchexp'
24963 sitebin='$sitebin'
24964 sitebinexp='$sitebinexp'
24965 sitehtml1dir='$sitehtml1dir'
24966 sitehtml1direxp='$sitehtml1direxp'
24967 sitehtml3dir='$sitehtml3dir'
24968 sitehtml3direxp='$sitehtml3direxp'
24969 sitelib='$sitelib'
24970 sitelib_stem='$sitelib_stem'
24971 sitelibexp='$sitelibexp'
24972 siteman1dir='$siteman1dir'
24973 siteman1direxp='$siteman1direxp'
24974 siteman3dir='$siteman3dir'
24975 siteman3direxp='$siteman3direxp'
24976 siteprefix='$siteprefix'
24977 siteprefixexp='$siteprefixexp'
24978 sitescript='$sitescript'
24979 sitescriptexp='$sitescriptexp'
24980 sizesize='$sizesize'
24981 sizetype='$sizetype'
24982 sleep='$sleep'
24983 smail='$smail'
24984 so='$so'
24985 sockethdr='$sockethdr'
24986 socketlib='$socketlib'
24987 socksizetype='$socksizetype'
24988 sort='$sort'
24989 spackage='$spackage'
24990 spitshell='$spitshell'
24991 srand48_r_proto='$srand48_r_proto'
24992 srandom_r_proto='$srandom_r_proto'
24993 src='$src'
24994 ssizetype='$ssizetype'
24995 st_ino_sign='$st_ino_sign'
24996 st_ino_size='$st_ino_size'
24997 startperl='$startperl'
24998 startsh='$startsh'
24999 static_ext='$static_ext'
25000 stdchar='$stdchar'
25001 stdio_base='$stdio_base'
25002 stdio_bufsiz='$stdio_bufsiz'
25003 stdio_cnt='$stdio_cnt'
25004 stdio_filbuf='$stdio_filbuf'
25005 stdio_ptr='$stdio_ptr'
25006 stdio_stream_array='$stdio_stream_array'
25007 strerror_r_proto='$strerror_r_proto'
25008 strings='$strings'
25009 submit='$submit'
25010 subversion='$subversion'
25011 sysman='$sysman'
25012 sysroot='$sysroot'
25013 tail='$tail'
25014 tar='$tar'
25015 targetarch='$targetarch'
25016 targetdir='$targetdir'
25017 targetenv='$targetenv'
25018 targethost='$targethost'
25019 targetmkdir='$targetmkdir'
25020 targetport='$targetport'
25021 targetsh='$targetsh'
25022 tbl='$tbl'
25023 tee='$tee'
25024 test='$test'
25025 timeincl='$timeincl'
25026 timetype='$timetype'
25027 tmpnam_r_proto='$tmpnam_r_proto'
25028 to='$to'
25029 touch='$touch'
25030 tr='$tr'
25031 trnl='$trnl'
25032 troff='$troff'
25033 ttyname_r_proto='$ttyname_r_proto'
25034 u16size='$u16size'
25035 u16type='$u16type'
25036 u32size='$u32size'
25037 u32type='$u32type'
25038 u64size='$u64size'
25039 u64type='$u64type'
25040 u8size='$u8size'
25041 u8type='$u8type'
25042 uidformat='$uidformat'
25043 uidsign='$uidsign'
25044 uidsize='$uidsize'
25045 uidtype='$uidtype'
25046 uname='$uname'
25047 uniq='$uniq'
25048 uquadtype='$uquadtype'
25049 use5005threads='$use5005threads'
25050 use64bitall='$use64bitall'
25051 use64bitint='$use64bitint'
25052 usecbacktrace='$usecbacktrace'
25053 usecrosscompile='$usecrosscompile'
25054 usedevel='$usedevel'
25055 usedl='$usedl'
25056 usedtrace='$usedtrace'
25057 usefaststdio='$usefaststdio'
25058 useithreads='$useithreads'
25059 usekernprocpathname='$usekernprocpathname'
25060 uselargefiles='$uselargefiles'
25061 uselongdouble='$uselongdouble'
25062 usemallocwrap='$usemallocwrap'
25063 usemorebits='$usemorebits'
25064 usemultiplicity='$usemultiplicity'
25065 usemymalloc='$usemymalloc'
25066 usenm='$usenm'
25067 usensgetexecutablepath='$usensgetexecutablepath'
25068 useopcode='$useopcode'
25069 useperlio='$useperlio'
25070 useposix='$useposix'
25071 usequadmath='$usequadmath'
25072 usereentrant='$usereentrant'
25073 userelocatableinc='$userelocatableinc'
25074 useshrplib='$useshrplib'
25075 usesitecustomize='$usesitecustomize'
25076 usesocks='$usesocks'
25077 usethreads='$usethreads'
25078 usevendorprefix='$usevendorprefix'
25079 useversionedarchname='$useversionedarchname'
25080 usevfork='$usevfork'
25081 usrinc='$usrinc'
25082 uuname='$uuname'
25083 uvXUformat='$uvXUformat'
25084 uvoformat='$uvoformat'
25085 uvsize='$uvsize'
25086 uvtype='$uvtype'
25087 uvuformat='$uvuformat'
25088 uvxformat='$uvxformat'
25089 vaproto='$vaproto'
25090 vendorarch='$vendorarch'
25091 vendorarchexp='$vendorarchexp'
25092 vendorbin='$vendorbin'
25093 vendorbinexp='$vendorbinexp'
25094 vendorhtml1dir='$vendorhtml1dir'
25095 vendorhtml1direxp='$vendorhtml1direxp'
25096 vendorhtml3dir='$vendorhtml3dir'
25097 vendorhtml3direxp='$vendorhtml3direxp'
25098 vendorlib='$vendorlib'
25099 vendorlib_stem='$vendorlib_stem'
25100 vendorlibexp='$vendorlibexp'
25101 vendorman1dir='$vendorman1dir'
25102 vendorman1direxp='$vendorman1direxp'
25103 vendorman3dir='$vendorman3dir'
25104 vendorman3direxp='$vendorman3direxp'
25105 vendorprefix='$vendorprefix'
25106 vendorprefixexp='$vendorprefixexp'
25107 vendorscript='$vendorscript'
25108 vendorscriptexp='$vendorscriptexp'
25109 version='$version'
25110 version_patchlevel_string='$version_patchlevel_string'
25111 versiononly='$versiononly'
25112 vi='$vi'
25113 xlibpth='$xlibpth'
25114 yacc='$yacc'
25115 yaccflags='$yaccflags'
25116 zcat='$zcat'
25117 zip='$zip'
25118 EOT
25119
25120 : add special variables
25121 $test -f $src/patchlevel.h && \
25122 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
25123 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
25124 echo "PERL_CONFIG_SH=true" >>config.sh
25125
25126 : propagate old symbols
25127 if $test -f UU/config.sh; then
25128         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
25129         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
25130                 config.sh config.sh UU/oldconfig.sh |\
25131                 $sort | $uniq -u >UU/oldsyms
25132         set X `$cat UU/oldsyms`
25133         shift
25134         case $# in
25135         0) ;;
25136         *)
25137                 $cat <<EOM
25138 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
25139 EOM
25140                 echo ": Variables propagated from previous config.sh file." >>config.sh
25141                 for sym in `$cat UU/oldsyms`; do
25142                         echo "    Propagating $hint variable "'$'"$sym..."
25143                         eval 'tmp="$'"${sym}"'"'
25144                         echo "$tmp" | \
25145                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
25146                 done
25147                 ;;
25148         esac
25149 fi
25150
25151 : preserve RCS keywords in files with variable substitution, grrr
25152 Id='$Id'
25153
25154 : Finish up by extracting the .SH files
25155 case "$alldone" in
25156 exit)
25157         $rm -rf UU
25158         echo "Extraction done."
25159         exit 0
25160         ;;
25161 cont)
25162         ;;
25163 '')
25164         dflt=''
25165         nostick=true
25166         $cat <<EOM
25167
25168 If you'd like to make any changes to the config.sh file before I begin
25169 to configure things, do it as a shell escape now (e.g. !vi config.sh).
25170
25171 EOM
25172         rp="Press return or use a shell escape to edit config.sh:"
25173         . UU/myread
25174         nostick=''
25175         case "$ans" in
25176         '') ;;
25177         *) : in case they cannot read
25178                 sh 1>&4 -c "$ans";;
25179         esac
25180         ;;
25181 esac
25182
25183 : if this fails, just run all the .SH files by hand
25184 . ./config.sh
25185
25186 echo " "
25187 exec 1>&4
25188 pwd=`pwd`
25189 . ./UU/extract
25190 cd "$pwd"
25191
25192 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
25193         dflt=y
25194         case "$silent" in
25195         true) ;;
25196         *)
25197                 $cat <<EOM
25198
25199 Now you need to generate make dependencies by running "$make depend".
25200 You might prefer to run it in background: "$make depend > makedepend.out &"
25201 It can take a while, so you might not want to run it right now.
25202
25203 EOM
25204                 ;;
25205         esac
25206         rp="Run $make depend now?"
25207         . UU/myread
25208         case "$ans" in
25209         y*)
25210                 $make depend && echo "Now you must run '$make'."
25211                 ;;
25212         *)
25213                 echo "You must run '$make depend' then '$make'."
25214                 ;;
25215         esac
25216 elif test -f [Mm]akefile; then
25217         echo " "
25218         echo "Now you must run a $make."
25219 else
25220         echo "Configure done."
25221 fi
25222
25223 if $test -f Policy.sh; then
25224     $cat <<EOM
25225
25226 If you compile $package on a different machine or from a different object
25227 directory, copy the Policy.sh file from this object directory to the
25228 new one before you run Configure -- this will help you with most of
25229 the policy defaults.
25230
25231 EOM
25232 fi
25233 if $test -f config.msg; then
25234     echo "Hmm.  I also noted the following information while running:"
25235     echo " "
25236     $cat config.msg >&4
25237     $rm -f config.msg
25238 fi
25239 $rm -f kit*isdone ark*isdone
25240 $rm -rf UU
25241
25242 : End of Configure
25243