This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Pod::Parser is no longer customized in blead, since commit 534577b24e
[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 installprefix=''
1066 installprefixexp=''
1067 installstyle=''
1068 installusrbinperl=''
1069 intsize=''
1070 longsize=''
1071 shortsize=''
1072 issymlink=''
1073 libc=''
1074 ldlibpthname=''
1075 libperl=''
1076 shrpenv=''
1077 useshrplib=''
1078 glibpth=''
1079 incpth=''
1080 libpth=''
1081 loclibpth=''
1082 plibpth=''
1083 xlibpth=''
1084 ignore_versioned_solibs=''
1085 libs=''
1086 libsdirs=''
1087 libsfiles=''
1088 libsfound=''
1089 libspath=''
1090 lns=''
1091 d_PRIEUldbl=''
1092 d_PRIFUldbl=''
1093 d_PRIGUldbl=''
1094 d_PRIeldbl=''
1095 d_PRIfldbl=''
1096 d_PRIgldbl=''
1097 d_SCNfldbl=''
1098 doublekind=''
1099 sPRIEUldbl=''
1100 sPRIFUldbl=''
1101 sPRIGUldbl=''
1102 sPRIeldbl=''
1103 sPRIfldbl=''
1104 sPRIgldbl=''
1105 sSCNfldbl=''
1106 lseeksize=''
1107 lseektype=''
1108 make_set_make=''
1109 d_mymalloc=''
1110 freetype=''
1111 mallocobj=''
1112 mallocsrc=''
1113 malloctype=''
1114 usemallocwrap=''
1115 usemymalloc=''
1116 installman1dir=''
1117 man1dir=''
1118 man1direxp=''
1119 man1ext=''
1120 installman3dir=''
1121 man3dir=''
1122 man3direxp=''
1123 man3ext=''
1124 modetype=''
1125 multiarch=''
1126 mydomain=''
1127 myhostname=''
1128 phostname=''
1129 c=''
1130 n=''
1131 d_eofnblk=''
1132 eagain=''
1133 o_nonblock=''
1134 rd_nodata=''
1135 need_va_copy=''
1136 netdb_hlen_type=''
1137 netdb_host_type=''
1138 netdb_name_type=''
1139 netdb_net_type=''
1140 groupcat=''
1141 hostcat=''
1142 passcat=''
1143 orderlib=''
1144 ranlib=''
1145 d_perl_otherlibdirs=''
1146 otherlibdirs=''
1147 package=''
1148 spackage=''
1149 pager=''
1150 api_revision=''
1151 api_subversion=''
1152 api_version=''
1153 api_versionstring=''
1154 patchlevel=''
1155 perl_patchlevel=''
1156 revision=''
1157 subversion=''
1158 version=''
1159 version_patchlevel_string=''
1160 perl5=''
1161 perladmin=''
1162 perlpath=''
1163 d_nv_preserves_uv=''
1164 d_nv_zero_is_allbits_zero=''
1165 i16size=''
1166 i16type=''
1167 i32size=''
1168 i32type=''
1169 i64size=''
1170 i64type=''
1171 i8size=''
1172 i8type=''
1173 ivsize=''
1174 ivtype=''
1175 nv_overflows_integers_at=''
1176 nv_preserves_uv_bits=''
1177 nvsize=''
1178 nvtype=''
1179 u16size=''
1180 u16type=''
1181 u32size=''
1182 u32type=''
1183 u64size=''
1184 u64type=''
1185 u8size=''
1186 u8type=''
1187 uvsize=''
1188 uvtype=''
1189 ivdformat=''
1190 nvEUformat=''
1191 nvFUformat=''
1192 nvGUformat=''
1193 nveformat=''
1194 nvfformat=''
1195 nvgformat=''
1196 uvXUformat=''
1197 uvoformat=''
1198 uvuformat=''
1199 uvxformat=''
1200 pidtype=''
1201 prefix=''
1202 prefixexp=''
1203 installprivlib=''
1204 privlib=''
1205 privlibexp=''
1206 prototype=''
1207 ptrsize=''
1208 d_PRIXU64=''
1209 d_PRId64=''
1210 d_PRIi64=''
1211 d_PRIo64=''
1212 d_PRIu64=''
1213 d_PRIx64=''
1214 sPRIXU64=''
1215 sPRId64=''
1216 sPRIi64=''
1217 sPRIo64=''
1218 sPRIu64=''
1219 sPRIx64=''
1220 d_quad=''
1221 quadkind=''
1222 quadtype=''
1223 uquadtype=''
1224 drand01=''
1225 randbits=''
1226 randfunc=''
1227 randseedtype=''
1228 seedfunc=''
1229 installscript=''
1230 scriptdir=''
1231 scriptdirexp=''
1232 selectminbits=''
1233 selecttype=''
1234 sh=''
1235 targetsh=''
1236 sig_count=''
1237 sig_name=''
1238 sig_name_init=''
1239 sig_num=''
1240 sig_num_init=''
1241 sig_size=''
1242 d_sitearch=''
1243 installsitearch=''
1244 sitearch=''
1245 sitearchexp=''
1246 installsitebin=''
1247 sitebin=''
1248 sitebinexp=''
1249 installsitehtml1dir=''
1250 sitehtml1dir=''
1251 sitehtml1direxp=''
1252 installsitehtml3dir=''
1253 sitehtml3dir=''
1254 sitehtml3direxp=''
1255 installsitelib=''
1256 sitelib=''
1257 sitelib_stem=''
1258 sitelibexp=''
1259 installsiteman1dir=''
1260 siteman1dir=''
1261 siteman1direxp=''
1262 installsiteman3dir=''
1263 siteman3dir=''
1264 siteman3direxp=''
1265 siteprefix=''
1266 siteprefixexp=''
1267 installsitescript=''
1268 sitescript=''
1269 sitescriptexp=''
1270 sizesize=''
1271 sizetype=''
1272 d_libname_unique=''
1273 so=''
1274 socksizetype=''
1275 sharpbang=''
1276 shsharp=''
1277 spitshell=''
1278 src=''
1279 ssizetype=''
1280 st_ino_sign=''
1281 st_ino_size=''
1282 startperl=''
1283 startsh=''
1284 stdchar=''
1285 d_stdio_stream_array=''
1286 stdio_stream_array=''
1287 sysman=''
1288 sGMTIME_max=''
1289 sGMTIME_min=''
1290 sLOCALTIME_max=''
1291 sLOCALTIME_min=''
1292 trnl=''
1293 uidformat=''
1294 uidsign=''
1295 uidsize=''
1296 uidtype=''
1297 archname64=''
1298 use64bitall=''
1299 use64bitint=''
1300 usecbacktrace=''
1301 dtrace=''
1302 usedtrace=''
1303 usefaststdio=''
1304 usekernprocpathname=''
1305 ccflags_uselargefiles=''
1306 ldflags_uselargefiles=''
1307 libswanted_uselargefiles=''
1308 uselargefiles=''
1309 uselongdouble=''
1310 usemorebits=''
1311 usemultiplicity=''
1312 nm_opt=''
1313 nm_so_opt=''
1314 runnm=''
1315 usenm=''
1316 usensgetexecutablepath=''
1317 useperlio=''
1318 usequadmath=''
1319 usesocks=''
1320 d_oldpthreads=''
1321 use5005threads=''
1322 useithreads=''
1323 usereentrant=''
1324 usethreads=''
1325 incpath=''
1326 mips_type=''
1327 usrinc=''
1328 vaproto=''
1329 d_vendorarch=''
1330 installvendorarch=''
1331 vendorarch=''
1332 vendorarchexp=''
1333 d_vendorbin=''
1334 installvendorbin=''
1335 vendorbin=''
1336 vendorbinexp=''
1337 installvendorhtml1dir=''
1338 vendorhtml1dir=''
1339 vendorhtml1direxp=''
1340 installvendorhtml3dir=''
1341 vendorhtml3dir=''
1342 vendorhtml3direxp=''
1343 d_vendorlib=''
1344 installvendorlib=''
1345 vendorlib=''
1346 vendorlib_stem=''
1347 vendorlibexp=''
1348 installvendorman1dir=''
1349 vendorman1dir=''
1350 vendorman1direxp=''
1351 installvendorman3dir=''
1352 vendorman3dir=''
1353 vendorman3direxp=''
1354 usevendorprefix=''
1355 vendorprefix=''
1356 vendorprefixexp=''
1357 d_vendorscript=''
1358 installvendorscript=''
1359 vendorscript=''
1360 vendorscriptexp=''
1361 versiononly=''
1362 yacc=''
1363 yaccflags=''
1364 CONFIG=''
1365
1366 : Detect odd OSs
1367 define='define'
1368 undef='undef'
1369 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1370 rmlist=''
1371
1372 : We must find out about Eunice early
1373 eunicefix=':'
1374 if test -f /etc/unixtovms; then
1375         eunicefix=/etc/unixtovms
1376 fi
1377 if test -f /etc/unixtovms.exe; then
1378         eunicefix=/etc/unixtovms.exe
1379 fi
1380
1381 : Set executable suffix now -- needed before hints available
1382 if test -f "/libs/version.library"; then
1383 : Amiga OS
1384     _exe=""
1385 elif test -f "/system/gnu_library/bin/ar.pm"; then
1386 : Stratus VOS
1387     _exe=".pm"
1388 elif test -n "$DJGPP"; then
1389 : DOS DJGPP
1390     _exe=".exe"
1391 elif test -f /kern/cookiejar; then
1392 : MiNT
1393     _exe=""
1394 elif test -d c:/. -o -n "$is_os2" ; then
1395 : OS/2 or cygwin
1396     _exe=".exe"
1397 fi
1398
1399 groupstype=''
1400 i_whoami=''
1401 : Trailing extension.  Override this in a hint file, if needed.
1402 : Extra object files, if any, needed on this platform.
1403 archobjs=''
1404 archname=''
1405 : Possible local include directories to search.
1406 : Set locincpth to "" in a hint file to defeat local include searches.
1407 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1408 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1409 :
1410 : no include file wanted by default
1411 inclwanted=''
1412
1413 : Enable -DEBUGGING and -DDEBUGGING from the command line
1414 EBUGGING=''
1415 DEBUGGING=''
1416
1417 libnames=''
1418 : change the next line if compiling for Xenix/286 on Xenix/386
1419 xlibpth='/usr/lib/386 /lib/386'
1420 : Possible local library directories to search.
1421 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1422 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1423
1424 : general looking path for locating libraries
1425 glibpth="/lib /usr/lib $xlibpth"
1426 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1427 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1428 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1429 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1430
1431 : Private path used by Configure to find libraries.  Its value
1432 : is prepended to libpth. This variable takes care of special
1433 : machines, like the mips.  Usually, it should be empty.
1434 plibpth=''
1435
1436 : default library list
1437 libswanted=''
1438 : some systems want to use only the non-versioned libso:s
1439 ignore_versioned_solibs=''
1440 : set usethreads on the Configure command line to enable threads.
1441 usereentrant='undef'
1442 ccname=''
1443 ccversion=''
1444 perllibs=''
1445 : set useposix=false in your hint file to disable the POSIX extension.
1446 useposix=true
1447 : set useopcode=false in your hint file to disable the Opcode extension.
1448 useopcode=true
1449 archname64=''
1450 ccflags_uselargefiles=''
1451 ldflags_uselargefiles=''
1452 libswanted_uselargefiles=''
1453 : set usemultiplicity on the Configure command line to enable multiplicity.
1454 : set usesocks on the Configure command line to enable socks.
1455 : List of libraries we want.
1456 : If anyone needs extra -lxxx, put those in a hint file.
1457 libswanted="cl pthread socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld"
1458 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1459 : We probably want to search /usr/shlib before most other libraries.
1460 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1461 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1462 glibpth="/usr/shlib $glibpth"
1463 : Do not use vfork unless overridden by a hint file.
1464 usevfork=false
1465
1466 : Find the basic shell for Bourne shell scripts
1467 case "$sh" in
1468 '')
1469         case "$SYSTYPE" in
1470         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1471         *) xxx='/bin/sh';;
1472         esac
1473         if test -f "$xxx"; then
1474                 sh="$xxx"
1475         else
1476                 : Build up a list and do a single loop so we can 'break' out.
1477                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1478                 for xxx in sh bash ksh pdksh ash; do
1479                         for p in $pth; do
1480                                 try="$try ${p}/${xxx}"
1481                         done
1482                 done
1483                 for xxx in $try; do
1484                         if test -f "$xxx"; then
1485                                 sh="$xxx";
1486                                 break
1487                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1488                                 sh="$xxx";
1489                                 break
1490                         elif test -f "$xxx.exe"; then
1491                                 sh="$xxx";
1492                                 break
1493                         fi
1494                 done
1495         fi
1496         ;;
1497 esac
1498
1499 case "$sh" in
1500 '')     cat >&2 <<EOM
1501 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1502
1503 Usually it's in /bin/sh.  How did you even get this far?
1504 Please contact me (Perl Maintainers) at perlbug@perl.org and
1505 we'll try to straighten this all out.
1506 EOM
1507         exit 1
1508         ;;
1509 esac
1510
1511 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1512 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1513 targetsh=$sh
1514
1515 : see if sh knows # comments
1516 if `$sh -c '#' >/dev/null 2>&1`; then
1517         shsharp=true
1518         spitshell=cat
1519         xcat=/bin/cat
1520         test -f $xcat$_exe || xcat=/usr/bin/cat
1521         if test ! -f $xcat$_exe; then
1522                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1523                         if test -f $p/cat$_exe; then
1524                                 xcat=$p/cat
1525                                 break
1526                         fi
1527                 done
1528                 if test ! -f $xcat$_exe; then
1529                         echo "Can't find cat anywhere!"
1530                         exit 1
1531                 fi
1532         fi
1533         echo "#!$xcat" >sharp
1534         $eunicefix sharp
1535         chmod +x sharp
1536         ./sharp > today 2>/dev/null
1537         if test -s today; then
1538                 sharpbang='#!'
1539         else
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                         sharpbang=': use '
1548                 fi
1549         fi
1550 else
1551         echo " "
1552         echo "Your $sh doesn't grok # comments--I will strip them later on."
1553         shsharp=false
1554         cd ..
1555         echo "exec grep -v '^[  ]*#'" >spitshell
1556         chmod +x spitshell
1557         $eunicefix spitshell
1558         spitshell=`pwd`/spitshell
1559         cd UU
1560         echo "I presume that if # doesn't work, #! won't work either!"
1561         sharpbang=': use '
1562 fi
1563 rm -f sharp today
1564
1565 : figure out how to guarantee sh startup
1566 case "$startsh" in
1567 '') startsh=${sharpbang}${sh} ;;
1568 *)
1569 esac
1570 cat >sharp <<EOSS
1571 $startsh
1572 set abc
1573 test "$?abc" != 1
1574 EOSS
1575
1576 chmod +x sharp
1577 $eunicefix sharp
1578 if ./sharp; then
1579         : echo "Yup, it does."
1580 else
1581         echo "Hmm... '$startsh' does not guarantee sh startup..."
1582         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1583 fi
1584 rm -f sharp
1585
1586 : Save command line options in file UU/cmdline.opt for later use in
1587 : generating config.sh.
1588 cat > cmdline.opt <<EOSH
1589 : Configure command line arguments.
1590 config_arg0='$0'
1591 config_args='$*'
1592 config_argc=$#
1593 EOSH
1594 argn=1
1595 args_exp=''
1596 args_sep=''
1597 for arg in "$@"; do
1598         cat >>cmdline.opt <<EOSH
1599 config_arg$argn='$arg'
1600 EOSH
1601         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1602 $arg
1603 EOC
1604         arg_exp=`cat cmdl.opt`
1605         args_exp="$args_exp$args_sep'$arg_exp'"
1606         argn=`expr $argn + 1`
1607         args_sep=' '
1608 done
1609 rm -f cmdl.opt
1610
1611 : produce awk script to parse command line options
1612 cat >options.awk <<'EOF'
1613 BEGIN {
1614         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1615
1616         len = length(optstr);
1617         for (i = 1; i <= len; i++) {
1618                 c = substr(optstr, i, 1);
1619                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1620                 if (a == ":") {
1621                         arg[c] = 1;
1622                         i++;
1623                 }
1624                 opt[c] = 1;
1625         }
1626 }
1627 {
1628         expect = 0;
1629         str = $0;
1630         if (substr(str, 1, 1) != "-") {
1631                 printf("'%s'\n", str);
1632                 next;
1633         }
1634         len = length($0);
1635         for (i = 2; i <= len; i++) {
1636                 c = substr(str, i, 1);
1637                 if (!opt[c]) {
1638                         printf("-%s\n", substr(str, i));
1639                         next;
1640                 }
1641                 printf("-%s\n", c);
1642                 if (arg[c]) {
1643                         if (i < len)
1644                                 printf("'%s'\n", substr(str, i + 1));
1645                         else
1646                                 expect = 1;
1647                         next;
1648                 }
1649         }
1650 }
1651 END {
1652         if (expect)
1653                 print "?";
1654 }
1655 EOF
1656
1657 : process the command line options
1658 set X `for arg in "$@"; do echo "X$arg"; done |
1659         sed -e s/X// | awk -f options.awk`
1660 eval "set $*"
1661 shift
1662 rm -f options.awk
1663
1664 : set up default values
1665 fastread=''
1666 reuseval=false
1667 config_sh=''
1668 alldone=''
1669 error=''
1670 silent=''
1671 extractsh=''
1672 override=''
1673 knowitall=''
1674 rm -f optdef.sh posthint.sh
1675 cat >optdef.sh <<EOS
1676 $startsh
1677 EOS
1678
1679
1680 : option parsing
1681 while test $# -gt 0; do
1682         case "$1" in
1683         -d) shift; fastread=yes;;
1684         -e) shift; alldone=cont;;
1685         -f)
1686                 shift
1687                 cd ..
1688                 if test -r "$1"; then
1689                         config_sh="$1"
1690                 else
1691                         echo "$me: cannot read config file $1." >&2
1692                         error=true
1693                 fi
1694                 cd UU
1695                 shift;;
1696         --help|\
1697         -h) shift; error=true;;
1698         -r) shift; reuseval=true;;
1699         -s) shift; silent=true; realsilent=true;;
1700         -E) shift; alldone=exit;;
1701         -K) shift; knowitall=true;;
1702         -O) shift; override=true;;
1703         -S) shift; silent=true; extractsh=true;;
1704         -D)
1705                 shift
1706                 case "$1" in
1707                 *=)
1708                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1709                         echo "$me: ignoring -D $1" >&2
1710                         ;;
1711                 *=*) echo "$1" | \
1712                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1713                 *) echo "$1='define'" >> optdef.sh;;
1714                 esac
1715                 shift
1716                 ;;
1717         -U)
1718                 shift
1719                 case "$1" in
1720                 *=) echo "$1" >> optdef.sh;;
1721                 *=*)
1722                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1723                         echo "$me: ignoring -U $1" >&2
1724                         ;;
1725                 *) echo "$1='undef'" >> optdef.sh;;
1726                 esac
1727                 shift
1728                 ;;
1729         -A)
1730             shift
1731             xxx=''
1732             yyy="$1"
1733             zzz=''
1734             uuu=undef
1735             case "$yyy" in
1736             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1737                  case "$zzz" in
1738                  *:*) zzz='' ;;
1739                  *)   xxx=append
1740                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1741                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1742                  esac
1743                  ;;
1744             esac
1745             case "$xxx" in
1746             '')  case "$yyy" in
1747                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1748                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1749                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1750                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1751                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1752                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1753                  esac
1754                  ;;
1755             esac
1756             case "$xxx" in
1757             append)
1758                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1759             clear)
1760                 echo "$yyy=''"                  >> posthint.sh ;;
1761             define)
1762                 case "$zzz" in
1763                 '') zzz=define ;;
1764                 esac
1765                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1766             eval)
1767                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1768             prepend)
1769                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1770             undef)
1771                 case "$zzz" in
1772                 '') zzz="$uuu" ;;
1773                 esac
1774                 echo "$yyy=$zzz"                >> posthint.sh ;;
1775             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1776             esac
1777             shift
1778             ;;
1779         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1780             exit 0;;
1781         --) break;;
1782         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1783         *) break;;
1784         esac
1785 done
1786
1787 case "$error" in
1788 true)
1789         cat >&2 <<EOM
1790 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1791                  [-U symbol] [-U symbol=] [-A command:symbol...]
1792   -d : use defaults for all answers.
1793   -e : go on without questioning past the production of config.sh.
1794   -f : specify an alternate default configuration file.
1795   -h : print this help message and exit (with an error status).
1796   -r : reuse C symbols value if possible (skips costly nm extraction).
1797   -s : silent mode, only echoes questions and essential information.
1798   -D : define symbol to have some value:
1799          -D symbol         symbol gets the value 'define'
1800          -D symbol=value   symbol gets the value 'value'
1801        common used examples (see INSTALL for more info):
1802          -Duse64bitint            use 64bit integers
1803          -Duse64bitall            use 64bit integers and pointers
1804          -Dusethreads             use thread support
1805          -Dinc_version_list=none  do not include older perl trees in @INC
1806          -DEBUGGING=none          DEBUGGING options
1807          -Dcc=gcc                 choose your compiler
1808          -Dprefix=/opt/perl5      choose your destination
1809   -E : stop at the end of questions, after having produced config.sh.
1810   -K : do not use unless you know what you are doing.
1811   -O : let -D and -U override definitions from loaded configuration file.
1812   -S : perform variable substitutions on all .SH files (can mix with -f)
1813   -U : undefine symbol:
1814          -U symbol    symbol gets the value 'undef'
1815          -U symbol=   symbol gets completely empty
1816        e.g.:  -Uversiononly
1817   -A : manipulate symbol after the platform specific hints have been applied:
1818          -A append:symbol=value   append value to symbol
1819          -A symbol=value          like append:, but with a separating space
1820          -A define:symbol=value   define symbol to have value
1821          -A clear:symbol          define symbol to be ''
1822          -A define:symbol         define symbol to be 'define'
1823          -A eval:symbol=value     define symbol to be eval of value
1824          -A prepend:symbol=value  prepend value to symbol
1825          -A undef:symbol          define symbol to be 'undef'
1826          -A undef:symbol=         define symbol to be ''
1827        e.g.:  -A prepend:libswanted='cl pthread '
1828               -A ccflags=-DSOME_MACRO
1829   -V : print version number and exit (with a zero status).
1830 EOM
1831         exit 1
1832         ;;
1833 esac
1834
1835 : Sanity checks
1836 case "$fastread$alldone" in
1837 yescont|yesexit) ;;
1838 *)
1839         case "$extractsh" in
1840         true) ;;
1841         *)
1842                 if test ! -t 0; then
1843                         echo "Say 'sh Configure', not 'sh <Configure'"
1844                         exit 1
1845                 fi
1846                 ;;
1847         esac
1848         ;;
1849 esac
1850
1851 exec 4>&1
1852 case "$silent" in
1853 true) exec 1>/dev/null;;
1854 esac
1855
1856 : run the defines and the undefines, if any, but leave the file out there...
1857 touch optdef.sh
1858 . ./optdef.sh
1859 : create the posthint manipulation script and leave the file out there...
1860 touch posthint.sh
1861
1862 : set package name
1863 package='perl5'
1864 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1865 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1866 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1867 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1868 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1869 esac
1870
1871 : Some greps do not return status, grrr.
1872 echo "grimblepritz" >grimble
1873 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1874         contains=contains
1875 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1876         contains=grep
1877 else
1878         contains=contains
1879 fi
1880 rm -f grimble
1881 : the following should work in any shell
1882 case "$contains" in
1883 contains*)
1884         echo " "
1885         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1886         cat >contains <<'EOSS'
1887 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1888 EOSS
1889 chmod +x contains
1890 esac
1891
1892 : Find the path to the source tree
1893 case "$src" in
1894 '') case "$0" in
1895     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1896          case "$src" in
1897          /*)    ;;
1898          .)     ;;
1899          *)     src=`cd ../$src && pwd` ;;
1900          esac
1901          ;;
1902     *)   src='.';;
1903     esac;;
1904 esac
1905 case "$src" in
1906 '')     src=/
1907         rsrc=/
1908         ;;
1909 /*)     rsrc="$src";;
1910 *)      rsrc="../$src";;
1911 esac
1912 if test -f $rsrc/Configure && \
1913         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1914 then
1915    : found it, so we are ok.
1916 else
1917         rsrc=''
1918         for src in . .. ../.. ../../.. ../../../..; do
1919                 if test -f ../$src/Configure && \
1920                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1921                 then
1922                         rsrc=../$src
1923                         break
1924                 fi
1925         done
1926 fi
1927 case "$rsrc" in
1928 '')
1929         cat <<EOM >&4
1930
1931 Sorry, I can't seem to locate the source dir for $package.  Please start
1932 Configure with an explicit path -- i.e. /some/path/Configure.
1933
1934 EOM
1935         exit 1
1936         ;;
1937 ../.)   rsrc='..';;
1938 *)
1939         echo " "
1940         echo "Sources for $package found in \"$src\"." >&4
1941         ;;
1942 esac
1943
1944 : script used to extract .SH files with variable substitutions
1945 cat >extract <<'EOS'
1946 PERL_CONFIG_SH=true
1947 echo "Doing variable substitutions on .SH files..."
1948 if test -f MANIFEST; then
1949         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1950 else
1951         echo "(Looking for .SH files under the source directory.)"
1952         set x `(cd "$src"; find . -name "*.SH" -print)`
1953 fi
1954 shift
1955 case $# in
1956 0) set x `(cd "$src"; echo *.SH)`; shift;;
1957 esac
1958 if test ! -f "$src/$1"; then
1959         shift
1960 fi
1961 mkdir_p='
1962 name=$1;
1963 create="";
1964 while test $name; do
1965         if test ! -d "$name"; then
1966                 create="$name $create";
1967                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1968                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1969         else
1970                 name="";
1971         fi;
1972 done;
1973 for file in $create; do
1974         mkdir $file;
1975 done
1976 '
1977 for file in $*; do
1978         case "$src" in
1979         ".")
1980                 case "$file" in
1981                 */*)
1982                         dir=`expr X$file : 'X\(.*\)/'`
1983                         file=`expr X$file : 'X.*/\(.*\)'`
1984                         (cd "$dir" && . ./$file)
1985                         ;;
1986                 *)
1987                         . ./$file
1988                         ;;
1989                 esac
1990                 ;;
1991         *)
1992                 case "$file" in
1993                 */*)
1994                         dir=`expr X$file : 'X\(.*\)/'`
1995                         file=`expr X$file : 'X.*/\(.*\)'`
1996                         (set x $dir; shift; eval $mkdir_p)
1997                         sh <"$src/$dir/$file"
1998                         ;;
1999                 *)
2000                         sh <"$src/$file"
2001                         ;;
2002                 esac
2003                 ;;
2004         esac
2005 done
2006 if test -f "$src/config_h.SH"; then
2007         if test ! -f config.h; then
2008         : oops, they left it out of MANIFEST, probably, so do it anyway.
2009         . "$src/config_h.SH"
2010         fi
2011 fi
2012 EOS
2013
2014 : extract files and exit if asked to do so
2015 case "$extractsh" in
2016 true)
2017         case "$realsilent" in
2018         true) ;;
2019         *) exec 1>&4;;
2020         esac
2021         case "$config_sh" in
2022         '') config_sh='config.sh';;
2023         esac
2024         echo " "
2025         echo "Fetching answers from $config_sh..."
2026         cd ..
2027         . $config_sh
2028         test "$override" && . ./optdef.sh
2029         echo " "
2030         . UU/extract
2031         rm -rf UU
2032         echo "Extraction done."
2033         exit 0
2034         ;;
2035 esac
2036
2037 : Eunice requires " " instead of "", can you believe it
2038 echo " "
2039 : Here we go...
2040 echo "Beginning of configuration questions for $package."
2041
2042 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2043
2044 : first determine how to suppress newline on echo command
2045 echo " "
2046 echo "Checking echo to see how to suppress newlines..."
2047 (echo "hi there\c" ; echo " ") >.echotmp
2048 if $contains c .echotmp >/dev/null 2>&1 ; then
2049         echo "...using -n."
2050         n='-n'
2051         c=''
2052 else
2053         cat <<'EOM'
2054 ...using \c
2055 EOM
2056         n=''
2057         c='\c'
2058 fi
2059 echo $n "The star should be here-->$c"
2060 echo '*'
2061 rm -f .echotmp
2062
2063 : Now test for existence of everything in MANIFEST
2064 echo " "
2065 if test -f "$rsrc/MANIFEST"; then
2066         echo "First let's make sure your kit is complete.  Checking..." >&4
2067         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2068                 (split -l 50 2>/dev/null || split -50)
2069         rm -f missing
2070         tmppwd=`pwd`
2071         for filelist in x??; do
2072                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2073                         >/dev/null 2>>"$tmppwd/missing")
2074         done
2075         if test -s missing; then
2076                 cat missing >&4
2077                 cat >&4 <<'EOM'
2078
2079 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2080
2081 You have the option of continuing the configuration process, despite the
2082 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2083 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2084 and contact the author (perlbug@perl.org).
2085
2086 EOM
2087                 echo $n "Continue? [n] $c" >&4
2088                 read ans
2089                 case "$ans" in
2090                 y*)
2091                         echo "Continuing..." >&4
2092                         rm -f missing
2093                         ;;
2094                 *)
2095                         echo "ABORTING..." >&4
2096                         kill $$
2097                         ;;
2098                 esac
2099         else
2100                 echo "Looks good..."
2101         fi
2102 else
2103         echo "There is no MANIFEST file.  I hope your kit is complete !"
2104 fi
2105 rm -f missing x??
2106
2107 : Find the appropriate value for a newline for tr
2108 echo " "
2109 if test -n "$DJGPP"; then
2110        trnl='\012'
2111 fi
2112 if test X"$trnl" = X; then
2113         case "`echo foo|tr '\n' x 2>/dev/null`" in
2114         foox) trnl='\n' ;;
2115         esac
2116 fi
2117 if test X"$trnl" = X; then
2118         case "`echo foo|tr '\012' x 2>/dev/null`" in
2119         foox) trnl='\012' ;;
2120         esac
2121 fi
2122 if test X"$trnl" = X; then
2123        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2124        fooxy) trnl='\n\r' ;;
2125        esac
2126 fi
2127 if test X"$trnl" = X; then
2128         cat <<EOM >&2
2129
2130 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2131
2132 EOM
2133         exit 1
2134 fi
2135
2136 : compute the number of columns on the terminal for proper question formatting
2137 case "$COLUMNS" in
2138 '') COLUMNS='80';;
2139 esac
2140
2141 : set up the echo used in my read
2142 myecho="case \"\$xxxm\" in
2143 '') echo $n \"\$rp $c\" >&4;;
2144 *) case \"\$rp\" in
2145         '') echo $n \"[\$xxxm] $c\";;
2146         *)
2147                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2148                         echo \"\$rp\" >&4
2149                         echo $n \"[\$xxxm] $c\" >&4
2150                 else
2151                         echo $n \"\$rp [\$xxxm] $c\" >&4
2152                 fi
2153                 ;;
2154         esac;;
2155 esac"
2156
2157 : now set up to do reads with possible shell escape and default assignment
2158 cat <<EOSC >myread
2159 $startsh
2160 xxxm=\$dflt
2161 $myecho
2162 ans='!'
2163 case "\$fastread" in
2164 yes) case "\$dflt" in
2165         '') ;;
2166         *) ans='';
2167                 case "\$silent-\$rp" in
2168                 true-) ;;
2169                 *) echo " " >&4;;
2170                 esac;;
2171         esac;;
2172 *) case "\$silent" in
2173         true) case "\$rp" in
2174                 '') ans='';;
2175                 esac;;
2176         esac;;
2177 esac
2178 while expr "X\$ans" : "X!" >/dev/null; do
2179         read answ
2180         set x \$xxxm
2181         shift
2182         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2183         case  "\$answ" in
2184         "!")
2185                 sh 1>&4
2186                 echo " "
2187                 $myecho
2188                 ;;
2189         !*)
2190                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2191                 shift
2192                 sh 1>&4 -c "\$*"
2193                 echo " "
2194                 $myecho
2195                 ;;
2196         "\$ans")
2197                 case "\$ans" in
2198                 \\&*)
2199                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2200                         shift
2201                         case "\$1" in
2202                         -d)
2203                                 fastread=yes
2204                                 echo "(OK, I'll run with -d after this question.)" >&4
2205                                 ;;
2206                         -*)
2207                                 echo "*** Sorry, \$1 not supported yet." >&4
2208                                 ;;
2209                         esac
2210                         $myecho
2211                         ans=!
2212                         ;;
2213                 esac;;
2214         *)
2215                 case "\$aok" in
2216                 y)
2217                         echo "*** Substitution done -- please confirm."
2218                         xxxm="\$ans"
2219                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2220                         xxxm="\$ans"
2221                         ans=!
2222                         ;;
2223                 *)
2224                         echo "*** Error -- try again."
2225                         ans=!
2226                         ;;
2227                 esac
2228                 $myecho
2229                 ;;
2230         esac
2231         case "\$ans\$xxxm\$nostick" in
2232         '')
2233                 ans=!
2234                 $myecho
2235                 ;;
2236         esac
2237 done
2238 case "\$ans" in
2239 '') ans="\$xxxm";;
2240 esac
2241 EOSC
2242
2243 : create .config dir to save info across Configure sessions
2244 test -d ../.config || mkdir ../.config
2245 cat >../.config/README <<EOF
2246 This directory created by Configure to save information that should
2247 persist across sessions for $package.
2248
2249 You may safely delete it if you wish.
2250 EOF
2251
2252 : See if we are using a devel version and want that
2253 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2254 case "$usedevel" in
2255 $define|true|[yY]*)
2256     usedevel="$define" ;;
2257 *) case "$xversion" in
2258    *[13579])
2259         cat >&4 <<EOH
2260 *** WHOA THERE!!! ***
2261
2262     This is an UNSTABLE DEVELOPMENT release.
2263     The version of this $package distribution is $xversion, that is, odd,
2264     (as opposed to even) and that signifies a development release.
2265     If you want a maintenance release, you want an even-numbered version.
2266
2267     Do ***NOT*** install this into production use.
2268     Data corruption and crashes are possible.
2269
2270     It is most seriously suggested that you do not continue any further
2271     unless you want to help in developing and debugging Perl.
2272
2273     If you *still* want to build perl, you can answer 'y' now,
2274     or pass -Dusedevel to Configure.
2275
2276 EOH
2277         rp='Do you really want to continue?'
2278         dflt='n'
2279         . ./myread
2280         case "$ans" in
2281         [yY]) echo >&4 "Okay, continuing."
2282               usedevel="$define" ;;
2283         *) echo >&4 "Okay, bye."
2284            exit 1
2285            ;;
2286         esac
2287         ;;
2288     esac
2289     usedevel="$undef"
2290     ;;
2291 esac
2292 case "$usedevel" in
2293 $define|true|[yY]*)
2294         case "$versiononly" in
2295         '') versiononly="$define" ;;
2296         esac
2297         case "$installusrbinperl" in
2298         '') installusrbinperl="$undef" ;;
2299         esac
2300         ;;
2301 esac
2302
2303 : general instructions
2304 needman=true
2305 firsttime=true
2306 user=`(logname) 2>/dev/null`
2307 case "$user" in
2308 '') user=`whoami 2>&1`;;
2309 esac
2310 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2311         firsttime=false
2312         echo " "
2313         rp='Would you like to see the instructions?'
2314         dflt=n
2315         . ./myread
2316         case "$ans" in
2317         [yY]*) ;;
2318         *) needman=false;;
2319         esac
2320 fi
2321 if $needman; then
2322         cat <<EOH
2323
2324 This installation shell script will examine your system and ask you questions
2325 to determine how the perl5 package should be installed. If you get
2326 stuck on a question, you may use a ! shell escape to start a subshell or
2327 execute a command.  Many of the questions will have default answers in square
2328 brackets; typing carriage return will give you the default.
2329
2330 On some of the questions which ask for file or directory names you are allowed
2331 to use the ~name construct to specify the login directory belonging to "name",
2332 even if you don't have a shell which knows about that.  Questions where this is
2333 allowed will be marked "(~name ok)".
2334
2335 EOH
2336         rp=''
2337         dflt='Type carriage return to continue'
2338         . ./myread
2339         cat <<'EOH'
2340
2341 The prompter used in this script allows you to use shell variables and
2342 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2343 in the default answer, as if the default line was a set of arguments given to a
2344 script shell.  This means you may also use $* to repeat the whole default line,
2345 so you do not have to re-type everything to add something to the default.
2346
2347 Every time there is a substitution, you will have to confirm.  If there is an
2348 error (e.g. an unmatched backtick), the default answer will remain unchanged
2349 and you will be prompted again.
2350
2351 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2352 the questions and use the computed defaults (or the previous answers if there
2353 was already a config.sh file). Type 'Configure -h' for a list of options.
2354 You may also start interactively and then answer '& -d' at any prompt to turn
2355 on the non-interactive behaviour for the remainder of the execution.
2356
2357 EOH
2358         . ./myread
2359         cat <<EOH
2360
2361 Much effort has been expended to ensure that this shell script will run on any
2362 Unix system.  If despite that it blows up on yours, your best bet is to edit
2363 Configure and run it again.  If you can't run Configure for some reason,
2364 you'll have to generate a config.sh file by hand.  Whatever problems you
2365 have, let me (perlbug@perl.org) know how I blew it.
2366
2367 This installation script affects things in two ways:
2368
2369 1) it may do direct variable substitutions on some of the files included
2370    in this kit.
2371 2) it builds a config.h file for inclusion in C programs.  You may edit
2372    any of these files as the need arises after running this script.
2373
2374 If you make a mistake on a question, there is no easy way to back up to it
2375 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2376 files.  Configure will offer to let you do this before it runs the SH files.
2377
2378 EOH
2379         dflt='Type carriage return to continue'
2380         . ./myread
2381         case "$firsttime" in
2382         true) echo $user >>../.config/instruct;;
2383         esac
2384 fi
2385
2386 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2387 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2388 if test "X$sysroot" = X; then
2389     sysroot=""
2390 else
2391     case "$cc" in
2392         *gcc*|*g++*)
2393             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2394             # _sysroot is used in places where we need --sysroot=foo
2395             # but using the rest of the flags could cause issues.
2396             _sysroot="--sysroot=$sysroot";
2397             case "$ccflags" in
2398                 *sysroot*) ;;
2399                 'undef'|*)
2400                 ccflags="$ccflags $_sysroot"
2401             esac
2402             case "$ldflags" in
2403                 *sysroot*) ;;
2404                 'undef'|*)
2405                 ldflags="$ldflags $_sysroot"
2406             esac
2407             case "$cppflags" in
2408                 *sysroot*) ;;
2409                 'undef'|*)
2410                 cppflags="$cppflags $_sysroot"
2411             esac
2412             # lddlflags updated below in lddlflags section;
2413             # same with cccdlflags
2414             ;;
2415     esac
2416
2417     # Adjust some defaults to also use $sysroot
2418     for var in xlibpth loclibpth locincpth glibpth; do
2419         eval xxx=\$$var
2420         eval $var=''
2421         for path in $xxx; do
2422             eval $var=\"\$$var $sysroot$path\"
2423         done
2424     done
2425
2426 fi
2427
2428 : find out where common programs are
2429 echo " "
2430 echo "Locating common programs..." >&4
2431 cat <<EOSC >loc
2432 $startsh
2433 case \$# in
2434 0) exit 1;;
2435 esac
2436 thing=\$1
2437 shift
2438 dflt=\$1
2439 shift
2440 for dir in \$*; do
2441         case "\$thing" in
2442         .)
2443         if test -d \$dir/\$thing; then
2444                 echo \$dir
2445                 exit 0
2446         fi
2447         ;;
2448         *)
2449         for thisthing in \$dir/\$thing; do
2450                 : just loop through to pick last item
2451         done
2452         if test -f \$thisthing; then
2453                 echo \$thisthing
2454                 exit 0
2455         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2456                 echo \$thisthing
2457                 exit 0
2458         elif test -f \$dir/\$thing.exe; then
2459                 if test -n "$DJGPP"; then
2460                         echo \$dir/\$thing.exe
2461                 elif test "$eunicefix" != ":"; then
2462                         : on Eunice apparently
2463                         echo \$dir/\$thing
2464                 fi
2465                 exit 0
2466         fi
2467         ;;
2468         esac
2469 done
2470 echo \$dflt
2471 exit 1
2472 EOSC
2473 chmod +x loc
2474 $eunicefix loc
2475 loclist="
2476 awk
2477 cat
2478 chmod
2479 comm
2480 cp
2481 echo
2482 expr
2483 grep
2484 ls
2485 mkdir
2486 rm
2487 sed
2488 sort
2489 touch
2490 tr
2491 uniq
2492 "
2493 trylist="
2494 ar
2495 bison
2496 byacc
2497 cpp
2498 csh
2499 date
2500 egrep
2501 gmake
2502 gzip
2503 less
2504 ln
2505 make
2506 more
2507 nm
2508 nroff
2509 perl
2510 pg
2511 test
2512 uname
2513 zip
2514 "
2515 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2516 pth="$pth $sysroot/lib $sysroot/usr/lib"
2517 for file in $loclist; do
2518         eval xxx=\$$file
2519         case "$xxx" in
2520         /*|?:[\\/]*)
2521                 if test -f "$xxx"; then
2522                         : ok
2523                 else
2524                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2525                         xxx=`./loc $file $file $pth`
2526                 fi
2527                 ;;
2528         '') xxx=`./loc $file $file $pth`;;
2529         *) xxx=`./loc $xxx $xxx $pth`;;
2530         esac
2531         eval $file=$xxx$_exe
2532         eval _$file=$xxx
2533         case "$xxx" in
2534         /*)
2535                 echo $file is in $xxx.
2536                 ;;
2537         ?:[\\/]*)
2538                 echo $file is in $xxx.
2539                 ;;
2540         *)
2541                 echo "I don't know where '$file' is, and my life depends on it." >&4
2542                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2543                 exit 1
2544                 ;;
2545         esac
2546 done
2547 echo " "
2548 echo "Don't worry if any of the following aren't found..."
2549 say=offhand
2550 for file in $trylist; do
2551         eval xxx=\$$file
2552         case "$xxx" in
2553         /*|?:[\\/]*)
2554                 if test -f "$xxx"; then
2555                         : ok
2556                 else
2557                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2558                         xxx=`./loc $file $file $pth`
2559                 fi
2560                 ;;
2561         '') xxx=`./loc $file $file $pth`;;
2562         *) xxx=`./loc $xxx $xxx $pth`;;
2563         esac
2564         eval $file=$xxx$_exe
2565         eval _$file=$xxx
2566         case "$xxx" in
2567         /*)
2568                 echo $file is in $xxx.
2569                 ;;
2570         ?:[\\/]*)
2571                 echo $file is in $xxx.
2572                 ;;
2573         *)
2574                 echo "I don't see $file out there, $say."
2575                 say=either
2576                 ;;
2577         esac
2578 done
2579 case "$egrep" in
2580 egrep)
2581         echo "Substituting grep for egrep."
2582         egrep=$grep
2583         _egrep=$grep
2584         ;;
2585 esac
2586 case "$less" in
2587 '')     ;;
2588 *)      if $less -R </dev/null >/dev/null 2>&1; then
2589                echo "Substituting less -R for less."
2590                less="$less -R"
2591                _less=$less
2592         fi
2593         ;;
2594 esac
2595 case "$ln" in
2596 ln)
2597         echo "Substituting cp for ln."
2598         ln=$cp
2599         _ln=$cp
2600         ;;
2601 esac
2602 case "$make" in
2603 make)
2604         case "$gmake" in
2605         gmake)
2606         echo "I can't find make or gmake, and my life depends on it." >&4
2607         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2608         exit 1
2609         ;;
2610         esac
2611         ;;
2612 esac
2613 case "$gmake" in
2614 gmake)  ;;
2615 *)      # We can't have osname yet.
2616         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2617                 # Assume that gmake, if found, is definitely GNU make
2618                 # and prefer it over the system make.
2619                 echo "Substituting gmake for make."
2620                 make=$gmake
2621                 _make=$gmake
2622         fi
2623         ;;
2624 esac
2625 case "$test" in
2626 test)
2627         echo "Hopefully test is built into your sh."
2628         ;;
2629 *)
2630         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2631                 echo "Using the test built into your sh."
2632                 test=test
2633                 _test=test
2634         fi
2635         ;;
2636 esac
2637 case "$echo" in
2638 echo)
2639         echo "Hopefully echo is built into your sh."
2640         ;;
2641 '') ;;
2642 *)
2643         echo " "
2644 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2645         $echo $n "hi there$c" >foo1
2646         echo $n "hi there$c" >foo2
2647         if cmp foo1 foo2 >/dev/null 2>&1; then
2648                 echo "They are compatible.  In fact, they may be identical."
2649         else
2650                 case "$n" in
2651                 '-n') n='' c='\c';;
2652                 *) n='-n' c='';;
2653                 esac
2654                 cat <<FOO
2655 They are not compatible!  You are probably running ksh on a non-USG system.
2656 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2657 have echo built in and we may have to run some Bourne shell scripts.  That
2658 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2659
2660 FOO
2661                 $echo $n "The star should be here-->$c"
2662                 $echo "*"
2663         fi
2664         $rm -f foo1 foo2
2665         ;;
2666 esac
2667
2668 # This question was auctioned at YAPC::Europe-2007 in Vienna
2669 # I never promised you could answer it. I only auctioned the question.
2670 cat <<FOO
2671 The following message is sponsored by
2672
2673   Dresden.pm<--The stars should be here.
2674
2675 Dear Perl user, system administrator or package
2676 maintainer, the Perl community sends greetings to
2677 you. Do you (emblematical) greet back [Y/n]? n
2678
2679 FOO
2680
2681 : Check what type of C compiler we use
2682 cat <<EOS >trygcc
2683 $startsh
2684 EOS
2685 cat <<'EOSC' >>trygcc
2686 case "$cc" in
2687 '') ;;
2688 *)  $rm -f try try.*
2689     $cat >try.c <<EOM
2690 int main(int argc, char *argv[]) {
2691   return 0;
2692 }
2693 EOM
2694     if $cc -o try $ccflags $ldflags try.c; then
2695        :
2696     else
2697         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2698         despair=yes
2699         trygcc=yes
2700         case "$cc" in
2701         *gcc*) trygcc=no ;;
2702         esac
2703         # Skip this test because it gives a false match on output like:
2704         #    ./trygcc: line 23: cc: command not found
2705         # case "`$cc -v -c try.c 2>&1`" in
2706         # *gcc*) trygcc=no ;;
2707         # esac
2708         if $test X"$trygcc" = Xyes; then
2709             if gcc -o try -c try.c; then
2710                 echo " "
2711                 echo "You seem to have a working gcc, though." >&4
2712                 # Switching compilers may undo the work of hints files.
2713                 # The most common problem is -D_REENTRANT for threads.
2714                 # This heuristic catches that case, but gets false positives
2715                 # if -Dusethreads was not actually specified.  Better to
2716                 # bail out here with a useful message than fail
2717                 # mysteriously later. Should we perhaps just try to
2718                 # re-invoke Configure -Dcc=gcc config_args ?
2719                 if $test -f usethreads.cbu; then
2720                         $cat >&4 <<EOM
2721
2722 *** However, any setting of the C compiler flags (e.g. for thread support)
2723 *** will be lost.  It may be necessary for you to restart Configure and
2724 *** add -Dcc=gcc to your Configure command line.
2725
2726 EOM
2727                         rp="Would you like to go ahead and try gcc anyway?"
2728                         dflt=n
2729                 else
2730                         rp="Would you like to use it?"
2731                         dflt=y
2732                 fi
2733                 if $test -f myread; then
2734                     . ./myread
2735                 else
2736                     if $test -f UU/myread; then
2737                         . ./UU/myread
2738                     else
2739                         echo "Cannot find myread, sorry.  Aborting." >&2
2740                         exit 1
2741                     fi
2742                 fi
2743                 case "$ans" in
2744                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2745                 esac
2746             fi
2747         fi
2748     fi
2749     $rm -f try try.*
2750     ;;
2751 esac
2752 EOSC
2753
2754 cat <<EOS >checkcc
2755 $startsh
2756 EOS
2757 cat <<'EOSC' >>checkcc
2758 case "$cc" in
2759 '') ;;
2760 *)  $rm -f try try.*
2761     $cat >try.c <<EOM
2762 int main(int argc, char *argv[]) {
2763   return 0;
2764 }
2765 EOM
2766     if $cc -o try $ccflags $ldflags try.c; then
2767        :
2768     else
2769         if $test X"$despair" = Xyes; then
2770            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2771         fi
2772         $cat >&4 <<EOM
2773 You need to find a working C compiler.
2774 Either (purchase and) install the C compiler supplied by your OS vendor,
2775 or for a free C compiler try http://gcc.gnu.org/
2776 I cannot continue any further, aborting.
2777 EOM
2778         exit 1
2779     fi
2780     $rm -f try try.*
2781     ;;
2782 esac
2783 EOSC
2784
2785 : determine whether symbolic links are supported
2786 echo " "
2787 $touch blurfl
2788 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2789         echo "Symbolic links are supported." >&4
2790         lns="$ln -s"
2791 else
2792         echo "Symbolic links are NOT supported." >&4
2793         lns="$ln"
2794 fi
2795 $rm -f blurfl sym
2796
2797 : determine whether symbolic links are supported
2798 echo " "
2799 case "$lns" in
2800 *"ln"*" -s")
2801         echo "Checking how to test for symbolic links..." >&4
2802         $lns blurfl sym
2803         if $test "X$issymlink" = X; then
2804                 case "$newsh" in
2805                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2806                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2807                 esac
2808                 if test $? = 0; then
2809                         issymlink="test -h"
2810                 else
2811                         echo "Your builtin 'test -h' may be broken." >&4
2812                         case "$test" in
2813                         /*)     ;;
2814                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2815                                 for p in $pth
2816                                 do
2817                                         if test -f "$p/$test"; then
2818                                                 test="$p/$test"
2819                                                 break
2820                                         fi
2821                                 done
2822                                 ;;
2823                         esac
2824                         case "$test" in
2825                         /*)
2826                                 echo "Trying external '$test -h'." >&4
2827                                 issymlink="$test -h"
2828                                 if $test ! -h sym >/dev/null 2>&1; then
2829                                         echo "External '$test -h' is broken, too." >&4
2830                                         issymlink=''
2831                                 fi
2832                                 ;;
2833                         *)      issymlink='' ;;
2834                         esac
2835                 fi
2836         fi
2837         if $test "X$issymlink" = X; then
2838                 if $test -L sym 2>/dev/null; then
2839                         issymlink="$test -L"
2840                         echo "The builtin '$test -L' worked." >&4
2841                 fi
2842         fi
2843         if $test "X$issymlink" != X; then
2844                 echo "You can test for symbolic links with '$issymlink'." >&4
2845         else
2846                 echo "I do not know how you can test for symbolic links." >&4
2847         fi
2848         $rm -f blurfl sym
2849         ;;
2850 *)      echo "No symbolic links, so not testing for their testing..." >&4
2851         ;;
2852 esac
2853 echo " "
2854
2855 : Make symlinks util
2856 case "$mksymlinks" in
2857 $define|true|[yY]*)
2858         case "$src" in
2859         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2860                 exit 1
2861                 ;;
2862         *)      case "$lns:$issymlink" in
2863                 *"ln"*" -s:"*"test -"?)
2864                         echo "Creating the symbolic links..." >&4
2865                         cd ..
2866                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2867                         awk 'NF == 1 {
2868                                 dir=".";
2869                                 file=$1 "";
2870                              }
2871                              NF == 2 {
2872                                 dir=$1 "";
2873                                 file=$2 "";
2874                              }
2875                              {
2876                                  print "# dir = ", dir, "file = ", file
2877                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2878                              } END {
2879                                  for (d in mf) {
2880                                      if (d != ".") { print("mkdir -p "d) }
2881                                      print("ln -sf "mf[d]" "d);
2882                                  }
2883                              }' source="$src" > UU/mksymlinks.$$
2884                         sh UU/mksymlinks.$$
2885                         rm UU/mksymlinks.$$
2886                         # Sanity check 1.
2887                         if test ! -d t/base; then
2888                                 echo "Failed to create the subdirectories.  Aborting." >&4
2889                                 exit 1
2890                         fi
2891                         # Sanity check 2.
2892                         if test ! -f t/base/lex.t; then
2893                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2894                                 exit 1
2895                         fi
2896                         if test ! -f win32/win32.c; then
2897                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2898                                 exit 1
2899                         fi
2900                         cd UU
2901                         ;;
2902                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2903                         ;;
2904                 esac
2905                 ;;
2906         esac
2907         ;;
2908 esac
2909
2910 : Check for Cross-Compilation
2911 if $test "X$targethost" = "X"; then
2912     targethost=""
2913 fi
2914 if $test "X$targetenv" = "X"; then
2915     targetenv=""
2916 fi
2917 case "$usecrosscompile" in
2918 $define|true|[yY]*)
2919         $echo "Cross-compiling..."
2920         croak=''
2921         case "$cc" in
2922         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2923             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2924             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2925             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2926             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2927             # leave out ld, choosing it is more complex
2928             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2929             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2930             # We are in a weird spot. Just before us, some values
2931             # were 'saved', to be restored after the hints are
2932             # run.  This means that the changes we made to ar,
2933             # nm and ranlib will get reverted.
2934             # To avoid that, we hijack the saving mechanism and
2935             # have it save our new values.
2936             for file in ar nm ranlib; do
2937                 eval xxx=\$$file
2938                 eval $file=$xxx$_exe
2939                 eval _$file=$xxx
2940             done
2941         ;;
2942         esac
2943         case "$targetarch" in
2944         '') echo "Targetarch not defined." >&4; croak=y ;;
2945         *)  echo "Using targetarch $targetarch." >&4 ;;
2946         esac
2947         case "$targethost" in
2948         '') echo "Targethost not defined." >&4; croak=y ;;
2949         *)  echo "Using targethost $targethost." >&4
2950         esac
2951         locincpth=' '
2952         loclibpth=' '
2953         case "$croak" in
2954         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2955         esac
2956     : compile a host miniperl and generate_uudmap, unless we got passed them
2957     if $test "X$hostperl" = X; then
2958       echo "Building host miniperl and generate_uudmap binaries" >&4
2959       before_host=`pwd`
2960       cd ..
2961       cd $src
2962       src=`pwd`
2963       rm -rf $src/host
2964       mkdir $src/host
2965       cd $src/host
2966       $src/Configure -des -Dusedevel -Dmksymlinks
2967       $make miniperl
2968       case "$hostgenerate" in
2969       '') $make generate_uudmap
2970           hostgenerate=$src/host/generate_uudmap
2971           ;;
2972        "$undef") hostgenerate=''
2973           ;;
2974       esac
2975       hostperl=$src/host/miniperl
2976       cd $before_host
2977     fi
2978     hostosname=`$hostperl -le 'print $^O'`
2979     ;;
2980 *)
2981     usecrosscompile="$undef"
2982     ;;
2983 esac
2984
2985 : Define -Dtargethost=somecomputer to run compiled tests on another machine
2986 case "$targethost" in
2987     '') echo "Checking for cross-compile" >&4
2988     case "$usecrosscompile$multiarch" in
2989        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
2990          if [ -f Makefile ]; then
2991            echo " "
2992            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
2993          else
2994            echo "Configure done."
2995          fi
2996        exit 0
2997        ;;
2998      *) echo "No targethost for running compiler tests against defined, running locally" >&4
2999         run=''
3000         to=:
3001         from=:
3002         ;;
3003     esac
3004     ;;
3005     *) echo "Using targethost $targethost." >&4
3006         case "$src" in
3007         /*) run=$src/Cross/run
3008             targetmkdir=$src/Cross/mkdir
3009             to=$src/Cross/to
3010             from=$src/Cross/from
3011             ;;
3012         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3013             run=$pwd/Cross/run
3014             targetmkdir=$pwd/Cross/mkdir
3015             to=$pwd/Cross/to
3016             from=$pwd/Cross/from
3017             ;;
3018         esac
3019         case "$targetrun" in
3020         '') targetrun=ssh ;;
3021         esac
3022         case "$targetto" in
3023         '') targetto=scp ;;
3024         esac
3025         case "$targetfrom" in
3026         '') targetfrom=scp ;;
3027         esac
3028         run=$run-$targetrun
3029         to=$to-$targetto
3030         from=$from-$targetfrom
3031         case "$targetdir" in
3032         '')  targetdir=/tmp
3033              echo "Guessing targetdir $targetdir." >&4
3034              ;;
3035         esac
3036         case "$targetuser" in
3037         '')  targetuser=root
3038              echo "Guessing targetuser $targetuser." >&4
3039              ;;
3040         esac
3041         case "$targetport" in
3042         '')  targetport=22
3043              echo "Guessing targetport $targetport." >&4
3044              ;;
3045         esac
3046         case "$targetfrom" in
3047         scp)    q=-q ;;
3048         *)      q='' ;;
3049         esac
3050         case "$targetrun" in
3051         ssh|rsh)
3052             cat >$run <<EOF
3053 #!/bin/sh
3054 env=''
3055 case "\$1" in
3056 -cwd)
3057   shift
3058   cwd=\$1
3059   shift
3060   ;;
3061 esac
3062 case "\$1" in
3063 -env)
3064   shift
3065   env=\$1
3066   shift
3067   ;;
3068 esac
3069 case "\$cwd" in
3070 '') cwd=$targetdir ;;
3071 esac
3072 exe=\$1
3073 shift
3074 $to \$exe
3075 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3076 EOF
3077             ;;
3078         adb)
3079             $touch $run
3080             ;;
3081         *)  echo "Unknown targetrun '$targetrun'" >&4
3082             exit 1
3083             ;;
3084         esac
3085         case "$targetmkdir" in
3086         */Cross/mkdir)
3087             cat >$targetmkdir <<EOF
3088 #!/bin/sh
3089 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3090 EOF
3091             $chmod a+rx $targetmkdir
3092             ;;
3093         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3094             exit 1
3095             ;;
3096         esac
3097         case "$targetto" in
3098         scp|rcp)
3099             cat >$to <<EOF
3100 #!/bin/sh
3101 for f in \$@
3102 do
3103   case "\$f" in
3104   /*)
3105     $targetmkdir \`dirname \$f\`
3106     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3107     ;;
3108   *)
3109     $targetmkdir $targetdir/\`dirname \$f\`
3110     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3111     ;;
3112   esac
3113 done
3114 exit 0
3115 EOF
3116             ;;
3117         cp) cat >$to <<EOF
3118 #!/bin/sh
3119 for f in \$@
3120 do
3121   case "\$f" in
3122   /*)
3123     $mkdir -p $targetdir/\`dirname \$f\`
3124     $cp \$f $targetdir/\$f || exit 1
3125     ;;
3126   *)
3127     $targetmkdir $targetdir/\`dirname \$f\`
3128     $cp \$f $targetdir/\$f || exit 1
3129     ;;
3130   esac
3131 done
3132 exit 0
3133 EOF
3134             ;;
3135         *)  echo "Unknown targetto '$targetto'" >&4
3136             exit 1
3137             ;;
3138         esac
3139         case "$targetfrom" in
3140         scp|rcp)
3141           cat >$from <<EOF
3142 #!/bin/sh
3143 for f in \$@
3144 do
3145   $rm -f \$f
3146   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3147 done
3148 exit 0
3149 EOF
3150             ;;
3151         cp) cat >$from <<EOF
3152 #!/bin/sh
3153 for f in \$@
3154 do
3155   $rm -f \$f
3156   cp $targetdir/\$f . || exit 1
3157 done
3158 exit 0
3159 EOF
3160             ;;
3161         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3162             exit 1
3163             ;;
3164         esac
3165         if $test ! -f $run; then
3166             echo "Target 'run' script '$run' not found." >&4
3167         else
3168             $chmod a+rx $run
3169         fi
3170         if $test ! -f $to; then
3171             echo "Target 'to' script '$to' not found." >&4
3172         else
3173             $chmod a+rx $to
3174         fi
3175         if $test ! -f $from; then
3176             echo "Target 'from' script '$from' not found." >&4
3177         else
3178             $chmod a+rx $from
3179         fi
3180         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3181             exit 1
3182         fi
3183         cat >&4 <<EOF
3184 Using '$run' for remote execution,
3185 and '$from' and '$to'
3186 for remote file transfer.
3187 EOF
3188         ;;
3189 *)      run=''
3190         to=:
3191         from=:
3192         usecrosscompile="$undef"
3193         targetarch=''
3194         ;;
3195 esac
3196
3197 : see whether [:lower:] and [:upper:] are supported character classes
3198 echo " "
3199 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3200 ABYZ)
3201         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3202         up='[:upper:]'
3203         low='[:lower:]'
3204         ;;
3205 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3206         # (0xd9 and 0xe2), therefore that is a nice testing point.
3207         if test "X$up" = X -o "X$low" = X; then
3208             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3209             rs) up='[A-Z]'
3210                 low='[a-z]'
3211                 ;;
3212             esac
3213         fi
3214         if test "X$up" = X -o "X$low" = X; then
3215             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3216             rs) up='A-Z'
3217                 low='a-z'
3218                 ;;
3219             esac
3220         fi
3221         if test "X$up" = X -o "X$low" = X; then
3222             case "`echo RS | od -x 2>/dev/null`" in
3223             *D9E2*|*d9e2*)
3224                 echo "Hey, this might be EBCDIC." >&4
3225                 if test "X$up" = X -o "X$low" = X; then
3226                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3227                     rs) up='[A-IJ-RS-Z]'
3228                         low='[a-ij-rs-z]'
3229                         ;;
3230                     esac
3231                 fi
3232                 if test "X$up" = X -o "X$low" = X; then
3233                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3234                     rs) up='A-IJ-RS-Z'
3235                         low='a-ij-rs-z'
3236                         ;;
3237                     esac
3238                 fi
3239                 ;;
3240             esac
3241         fi
3242 esac
3243 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3244 rs)
3245     echo "Using $up and $low to convert case." >&4
3246     ;;
3247 *)
3248     echo "I don't know how to translate letters from upper to lower case." >&4
3249     echo "Your tr is not acting any way I know of." >&4
3250     exit 1
3251     ;;
3252 esac
3253 : set up the translation script tr, must be called with ./tr of course
3254 cat >tr <<EOSC
3255 $startsh
3256 case "\$1\$2" in
3257 '[A-Z][a-z]') exec $tr '$up' '$low';;
3258 '[a-z][A-Z]') exec $tr '$low' '$up';;
3259 esac
3260 exec $tr "\$@"
3261 EOSC
3262 chmod +x tr
3263 $eunicefix tr
3264
3265 : Try to determine whether config.sh was made on this system
3266 case "$config_sh" in
3267 '')
3268 myuname=`$uname -a 2>/dev/null`
3269 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3270 # Downcase everything to avoid ambiguity.
3271 # Remove slashes and single quotes so we can use parts of this in
3272 # directory and file names.
3273 # Remove newlines so myuname is sane to use elsewhere.
3274 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3275 # because the A-Z/a-z are not consecutive.
3276 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3277         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3278 newmyuname="$myuname"
3279 dflt=n
3280 case "$knowitall" in
3281 '')
3282         if test -f ../config.sh; then
3283                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3284                         eval "`grep myuname= ../config.sh`"
3285                 fi
3286                 if test "X$myuname" = "X$newmyuname"; then
3287                         dflt=y
3288                 fi
3289         fi
3290         ;;
3291 *) dflt=y;;
3292 esac
3293
3294 : Get old answers from old config file if Configure was run on the
3295 : same system, otherwise use the hints.
3296 hint=default
3297 cd ..
3298 if test -f config.sh; then
3299         echo " "
3300         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3301         . UU/myread
3302         case "$ans" in
3303         n*|N*) echo "OK, I'll ignore it."
3304                 mv config.sh config.sh.old
3305                 myuname="$newmyuname"
3306                 ;;
3307         *)  echo "Fetching default answers from your old config.sh file..." >&4
3308                 tmp_n="$n"
3309                 tmp_c="$c"
3310                 tmp_sh="$sh"
3311                 . ./config.sh
3312                 cp config.sh UU
3313                 n="$tmp_n"
3314                 c="$tmp_c"
3315                 : Older versions did not always set $sh.  Catch re-use of such
3316                 : an old config.sh.
3317                 case "$sh" in
3318                 '') sh="$tmp_sh" ;;
3319                 esac
3320                 hint=previous
3321                 ;;
3322         esac
3323 fi
3324 . ./UU/checkcc
3325 if test ! -f config.sh; then
3326         $cat <<EOM
3327
3328 First time through, eh?  I have some defaults handy for some systems
3329 that need some extra help getting the Configure answers right:
3330
3331 EOM
3332         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3333         dflt=''
3334         : Half the following guesses are probably wrong... If you have better
3335         : tests or hints, please send them to perlbug@perl.org
3336         : The metaconfig authors would also appreciate a copy...
3337         $test -f /irix && osname=irix
3338         $test -f /xenix && osname=sco_xenix
3339         $test -f /dynix && osname=dynix
3340         $test -f /dnix && osname=dnix
3341         $test -f /lynx.os && osname=lynxos
3342         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3343         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3344         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3345         $test -f /bin/mips && /bin/mips && osname=mips
3346         $test -d /usr/apollo/bin && osname=apollo
3347         $test -f /etc/saf/_sactab && osname=svr4
3348         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3349         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3350         if $test -d /MachTen -o -d /MachTen_Folder; then
3351                 osname=machten
3352                 if $test -x /sbin/version; then
3353                         osvers=`/sbin/version | $awk '{print $2}' |
3354                         $sed -e 's/[A-Za-z]$//'`
3355                 elif $test -x /usr/etc/version; then
3356                         osvers=`/usr/etc/version | $awk '{print $2}' |
3357                         $sed -e 's/[A-Za-z]$//'`
3358                 else
3359                         osvers="$2.$3"
3360                 fi
3361         fi
3362
3363         $test -f /sys/posix.dll &&
3364                 $test -f /usr/bin/what &&
3365                 set X `/usr/bin/what /sys/posix.dll` &&
3366                 $test "$3" = UWIN &&
3367                 osname=uwin &&
3368                 osvers="$5"
3369
3370         if $test -f $uname; then
3371                 set X $myuname
3372                 shift
3373
3374                 case "$5" in
3375                 fps*) osname=fps ;;
3376                 mips*)
3377                         case "$4" in
3378                         umips) osname=umips ;;
3379                         *) osname=mips ;;
3380                         esac;;
3381                 [23]100) osname=mips ;;
3382                 i386*)
3383                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3384                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3385                                 osname='sco'
3386                                 osvers=$tmp
3387                         elif $test -f /etc/kconfig; then
3388                                 osname=isc
3389                                 if test "$lns" = "$ln -s"; then
3390                                         osvers=4
3391                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3392                                         osvers=3
3393                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3394                                         osvers=2
3395                                 fi
3396                         fi
3397                         tmp=''
3398                         ;;
3399                 pc*)
3400                         if test -n "$DJGPP"; then
3401                                 osname=dos
3402                                 osvers=djgpp
3403                         fi
3404                         ;;
3405                 esac
3406
3407                 case "$1" in
3408                 aix) osname=aix
3409                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3410                         case "$tmp" in
3411                         # oslevel can fail with:
3412                         # oslevel: Unable to acquire lock.
3413                         *not\ found) osvers="$4"."$3" ;;
3414                         '<3240'|'<>3240') osvers=3.2.0 ;;
3415                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3416                         '=3250'|'>3250') osvers=3.2.5 ;;
3417                         *) osvers=$tmp;;
3418                         esac
3419                         ;;
3420                 bitrig) osname=bitrig
3421                         osvers="$3"
3422                         ;;
3423                 bsd386) osname=bsd386
3424                         osvers=`$uname -r`
3425                         ;;
3426                 cygwin*) osname=cygwin
3427                         osvers="$3"
3428                         ;;
3429                 *dc.osx) osname=dcosx
3430                         osvers="$3"
3431                         ;;
3432                 dnix) osname=dnix
3433                         osvers="$3"
3434                         ;;
3435                 domainos) osname=apollo
3436                         osvers="$3"
3437                         ;;
3438                 dgux)   osname=dgux
3439                         osvers="$3"
3440                         ;;
3441                 dragonfly) osname=dragonfly
3442                         osvers="$3"
3443                         ;;
3444                 dynixptx*) osname=dynixptx
3445                         osvers=`echo "$4"|sed 's/^v//'`
3446                         ;;
3447                 freebsd) osname=freebsd
3448                         osvers="$3" ;;
3449                 genix)  osname=genix ;;
3450                 gnu)    osname=gnu
3451                         osvers="$3" ;;
3452                 hp*)    osname=hpux
3453                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3454                         ;;
3455                 irix*)  osname=irix
3456                         case "$3" in
3457                         4*) osvers=4 ;;
3458                         5*) osvers=5 ;;
3459                         *)      osvers="$3" ;;
3460                         esac
3461                         ;;
3462                 linux)  osname=linux
3463                         case "$3" in
3464                         *)      osvers="$3" ;;
3465                         esac
3466                         $test -f /system/lib/libandroid.so && osname=linux-android
3467                         ;;
3468                 MiNT)   osname=mint
3469                         ;;
3470                 netbsd*) osname=netbsd
3471                         osvers="$3"
3472                         ;;
3473                 news-os) osvers="$3"
3474                         case "$3" in
3475                         4*) osname=newsos4 ;;
3476                         *) osname=newsos ;;
3477                         esac
3478                         ;;
3479                 nonstop-ux) osname=nonstopux ;;
3480                 openbsd) osname=openbsd
3481                         osvers="$3"
3482                         ;;
3483                 os2)    osname=os2
3484                         osvers="$4"
3485                         ;;
3486                 POSIX-BC | posix-bc ) osname=posix-bc
3487                         osvers="$3"
3488                         ;;
3489                 powerux | power_ux | powermax_os | powermaxos | \
3490                 powerunix | power_unix) osname=powerux
3491                         osvers="$3"
3492                         ;;
3493                 qnx) osname=qnx
3494                         osvers="$4"
3495                         ;;
3496                 solaris) osname=solaris
3497                         case "$3" in
3498                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3499                         *)      osvers="$3" ;;
3500                         esac
3501                         ;;
3502                 sunos) osname=sunos
3503                         case "$3" in
3504                         5*) osname=solaris
3505                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3506                         *)      osvers="$3" ;;
3507                         esac
3508                         ;;
3509                 titanos) osname=titanos
3510                         case "$3" in
3511                         1*) osvers=1 ;;
3512                         2*) osvers=2 ;;
3513                         3*) osvers=3 ;;
3514                         4*) osvers=4 ;;
3515                         *)      osvers="$3" ;;
3516                         esac
3517                         ;;
3518                 ultrix) osname=ultrix
3519                         osvers="$3"
3520                         ;;
3521                 osf1|mls+)      case "$5" in
3522                                 alpha)
3523                                         osname=dec_osf
3524                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3525                                         case "$osvers" in
3526                                         [1-9].[0-9]*) ;;
3527                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3528                                         esac
3529                                         ;;
3530                         hp*)    osname=hp_osf1  ;;
3531                         mips)   osname=mips_osf1 ;;
3532                         esac
3533                         ;;
3534                 # UnixWare 7.1.2 is known as Open UNIX 8
3535                 openunix|unixware) osname=svr5
3536                         osvers="$4"
3537                         ;;
3538                 uts)    osname=uts
3539                         osvers="$3"
3540                         ;;
3541                 vos) osvers="$3"
3542                         ;;
3543                 $2) case "$osname" in
3544                         *isc*) ;;
3545                         *freebsd*) ;;
3546                         svr*)
3547                                 : svr4.x or possibly later
3548                                 case "svr$3" in
3549                                 ${osname}*)
3550                                         osname=svr$3
3551                                         osvers=$4
3552                                         ;;
3553                                 esac
3554                                 case "$osname" in
3555                                 svr4.0)
3556                                         : Check for ESIX
3557                                         if test -f /stand/boot ; then
3558                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3559                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3560                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3561                                                         if test -n "$isesix"; then
3562                                                                 osname=esix4
3563                                                         fi
3564                                                 fi
3565                                         fi
3566                                         ;;
3567                                 esac
3568                                 ;;
3569                         *)      if test -f /etc/systemid; then
3570                                         osname=sco
3571                                         set `echo $3 | $sed 's/\./ /g'` $4
3572                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3573                                                 osvers=$1.$2.$3
3574                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3575                                                 osvers=$1.$2
3576                                         elif $test -f $src/hints/sco_$1.sh; then
3577                                                 osvers=$1
3578                                         fi
3579                                 else
3580                                         case "$osname" in
3581                                         '') : Still unknown.  Probably a generic Sys V.
3582                                                 osname="sysv"
3583                                                 osvers="$3"
3584                                                 ;;
3585                                         esac
3586                                 fi
3587                                 ;;
3588                         esac
3589                         ;;
3590                 *)      case "$osname" in
3591                         '') : Still unknown.  Probably a generic BSD.
3592                                 osname="$1"
3593                                 osvers="$3"
3594                                 ;;
3595                         esac
3596                         ;;
3597                 esac
3598         else
3599                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3600                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3601                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3602                                 osname=news_os
3603                         fi
3604                         $rm -f UU/kernel.what
3605                 elif test -d c:/. -o -n "$is_os2" ; then
3606                         set X $myuname
3607                         osname=os2
3608                         osvers="$5"
3609                 fi
3610         fi
3611
3612         case "$targetarch" in
3613         '') ;;
3614         *)  hostarch=$osname
3615             case "$targetarch" in
3616                 nto*|*-nto-*)
3617                     # Will load qnx.sh, which should change osname to nto
3618                     osname=qnx
3619                     osvers=''
3620                     ;;
3621                 *linux-android*)
3622                     # Catch arm-linux-androideabi, mipsel-linux-android,
3623                     # and i686-linux-android
3624                     osname=linux-android
3625                     osvers=''
3626                     ;;
3627                 *linux*)
3628                     # Something like arm-linux-gnueabihf is really just
3629                     # plain linux.
3630                     osname=linux
3631                     osvers=''
3632                     ;;
3633                 *solaris*|*sunos*)
3634                     osname=solaris
3635                     # XXX perhaps we should just assume
3636                     # osvers to be 2, or maybe take the value
3637                     # from targetarch. Using $run before the
3638                     # hints are run is somewhat icky.
3639                     set X `$run $uname -a 2>/dev/null`
3640                     shift
3641                     case "$3" in
3642                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3643                         *)  osvers="$3" ;;
3644                     esac
3645                     ;;
3646                 *)
3647                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3648                     osvers=''
3649                 ;;
3650             esac
3651             ;;
3652         esac
3653
3654         : Now look for a hint file osname_osvers, unless one has been
3655         : specified already.
3656         case "$hintfile" in
3657         ''|' ')
3658                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3659                 : Also try without trailing minor version numbers.
3660                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3661                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3662                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3663                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3664                 case "$file" in
3665                 '') dflt=none ;;
3666                 *)  case "$osvers" in
3667                         '') dflt=$file
3668                                 ;;
3669                         *)  if $test -f $src/hints/$file.sh ; then
3670                                         dflt=$file
3671                                 elif $test -f $src/hints/$xfile.sh ; then
3672                                         dflt=$xfile
3673                                 elif $test -f $src/hints/$xxfile.sh ; then
3674                                         dflt=$xxfile
3675                                 elif $test -f $src/hints/$xxxfile.sh ; then
3676                                         dflt=$xxxfile
3677                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3678                                         dflt=$xxxxfile
3679                                 elif $test -f "$src/hints/${osname}.sh" ; then
3680                                         dflt="${osname}"
3681                                 else
3682                                         dflt=none
3683                                 fi
3684                                 ;;
3685                         esac
3686                         ;;
3687                 esac
3688                 if $test -f Policy.sh ; then
3689                         case "$dflt" in
3690                         *Policy*) ;;
3691                         none) dflt="Policy" ;;
3692                         *) dflt="Policy $dflt" ;;
3693                         esac
3694                 fi
3695                 ;;
3696         *)
3697                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3698                 ;;
3699         esac
3700
3701         if $test -f Policy.sh ; then
3702                 $cat <<EOM
3703
3704 There's also a Policy hint file available, which should make the
3705 site-specific (policy) questions easier to answer.
3706 EOM
3707
3708         fi
3709
3710         $cat <<EOM
3711
3712 You may give one or more space-separated answers, or "none" if appropriate.
3713 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3714 previous run of Configure, you may specify it as well as or instead of
3715 OS-specific hints.  If hints are provided for your OS, you should use them:
3716 although Perl can probably be built without hints on many platforms, using
3717 hints often improve performance and may enable features that Configure can't
3718 set up on its own. If there are no hints that match your OS, specify "none";
3719 DO NOT give a wrong version or a wrong OS.
3720
3721 EOM
3722
3723         rp="Which of these apply, if any?"
3724         . UU/myread
3725         tans=$ans
3726         for file in $tans; do
3727                 if $test X$file = XPolicy -a -f Policy.sh; then
3728                         . Policy.sh
3729                         $cat Policy.sh >> UU/config.sh
3730                 elif $test -f $src/hints/$file.sh; then
3731                         . $src/hints/$file.sh
3732                         $cat $src/hints/$file.sh >> UU/config.sh
3733                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3734                         : nothing
3735                 else
3736                         : Give one chance to correct a possible typo.
3737                         echo "$file.sh does not exist"
3738                         dflt=$file
3739                         rp="hint to use instead?"
3740                         . UU/myread
3741                         for file in $ans; do
3742                                 if $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$ans = X -o X$ans = Xnone ; then
3746                                         : nothing
3747                                 else
3748                                         echo "$file.sh does not exist -- ignored."
3749                                 fi
3750                         done
3751                 fi
3752         done
3753
3754         hint=recommended
3755         : Remember our hint file for later.
3756         if $test -f "$src/hints/$file.sh" ; then
3757                 hintfile="$file"
3758         else
3759                 hintfile=''
3760         fi
3761 fi
3762 cd UU
3763 ;;
3764 *)
3765         echo " "
3766         echo "Fetching default answers from $config_sh..." >&4
3767         tmp_n="$n"
3768         tmp_c="$c"
3769         cd ..
3770         cp $config_sh config.sh 2>/dev/null
3771         chmod +w config.sh
3772         . ./config.sh
3773         cd UU
3774         cp ../config.sh .
3775         n="$tmp_n"
3776         c="$tmp_c"
3777         hint=previous
3778         ;;
3779 esac
3780 test "$override" && . ./optdef.sh
3781
3782 : Restore computed paths
3783 for file in $loclist $trylist; do
3784         eval $file="\$_$file"
3785 done
3786
3787 cat << EOM
3788
3789 Configure uses the operating system name and version to set some defaults.
3790 The default value is probably right if the name rings a bell. Otherwise,
3791 since spelling matters for me, either accept the default or answer "none"
3792 to leave it blank.
3793
3794 EOM
3795 case "$osname" in
3796         ''|' ')
3797                 case "$hintfile" in
3798                 ''|' '|none) dflt=none ;;
3799                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3800                 esac
3801                 ;;
3802         *) dflt="$osname" ;;
3803 esac
3804 rp="Operating system name?"
3805 . ./myread
3806 case "$ans" in
3807 none)  osname='' ;;
3808 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3809 esac
3810 echo " "
3811 case "$osvers" in
3812         ''|' ')
3813                 case "$hintfile" in
3814                 ''|' '|none) dflt=none ;;
3815                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3816                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3817                         case "$dflt" in
3818                         ''|' ') dflt=none ;;
3819                         esac
3820                         ;;
3821                 esac
3822                 ;;
3823         *) dflt="$osvers" ;;
3824 esac
3825 rp="Operating system version?"
3826 . ./myread
3827 case "$ans" in
3828 none)  osvers='' ;;
3829 *) osvers="$ans" ;;
3830 esac
3831
3832
3833 . ./posthint.sh
3834
3835 : who configured the system
3836 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3837 case "$cf_by" in
3838 "")
3839         cf_by=`(logname) 2>/dev/null`
3840         case "$cf_by" in
3841         "")
3842                 cf_by=`(whoami) 2>/dev/null`
3843                 case "$cf_by" in
3844                 "") cf_by=unknown ;;
3845                 esac ;;
3846         esac ;;
3847 esac
3848
3849 : decide how portable to be.  Allow command line overrides.
3850 case "$d_portable" in
3851 "$undef") ;;
3852 *)      d_portable="$define" ;;
3853 esac
3854
3855 : set up shell script to do ~ expansion
3856 cat >filexp <<EOSS
3857 $startsh
3858 : expand filename
3859 case "\$1" in
3860  \~/*|\~)
3861         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3862         ;;
3863  \~*)
3864         if $test -f /bin/csh; then
3865                 /bin/csh -f -c "glob \$1"
3866                 failed=\$?
3867                 echo ""
3868                 exit \$failed
3869         else
3870                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3871                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3872                 if $test ! -d "\$dir"; then
3873                         me=\`basename \$0\`
3874                         echo "\$me: can't locate home directory for: \$name" >&2
3875                         exit 1
3876                 fi
3877                 case "\$1" in
3878                 */*)
3879                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3880                         ;;
3881                 *)
3882                         echo \$dir
3883                         ;;
3884                 esac
3885         fi
3886         ;;
3887 *)
3888         echo \$1
3889         ;;
3890 esac
3891 EOSS
3892 chmod +x filexp
3893 $eunicefix filexp
3894
3895 : now set up to get a file name
3896 cat <<EOS >getfile
3897 $startsh
3898 EOS
3899 cat <<'EOSC' >>getfile
3900 tilde=''
3901 fullpath=''
3902 already=''
3903 skip=''
3904 none_ok=''
3905 exp_file=''
3906 nopath_ok=''
3907 orig_rp="$rp"
3908 orig_dflt="$dflt"
3909 case "$gfpth" in
3910 '') gfpth='.' ;;
3911 esac
3912
3913 case "$fn" in
3914 *\(*)
3915         : getfile will accept an answer from the comma-separated list
3916         : enclosed in parentheses even if it does not meet other criteria.
3917         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3918         fn=`echo $fn | sed 's/(.*)//'`
3919         ;;
3920 esac
3921
3922 case "$fn" in
3923 *:*)
3924         loc_file=`expr $fn : '.*:\(.*\)'`
3925         fn=`expr $fn : '\(.*\):.*'`
3926         ;;
3927 esac
3928
3929 case "$fn" in
3930 *~*) tilde=true;;
3931 esac
3932 case "$fn" in
3933 */*) fullpath=true;;
3934 esac
3935 case "$fn" in
3936 *+*) skip=true;;
3937 esac
3938 case "$fn" in
3939 *n*) none_ok=true;;
3940 esac
3941 case "$fn" in
3942 *e*) exp_file=true;;
3943 esac
3944 case "$fn" in
3945 *p*) nopath_ok=true;;
3946 esac
3947
3948 case "$fn" in
3949 *f*) type='File';;
3950 *d*) type='Directory';;
3951 *l*) type='Locate';;
3952 esac
3953
3954 what="$type"
3955 case "$what" in
3956 Locate) what='File';;
3957 esac
3958
3959 case "$exp_file" in
3960 '')
3961         case "$d_portable" in
3962         "$define") ;;
3963         *) exp_file=true;;
3964         esac
3965         ;;
3966 esac
3967
3968 cd ..
3969 while test "$type"; do
3970         redo=''
3971         rp="$orig_rp"
3972         dflt="$orig_dflt"
3973         case "$tilde" in
3974         true) rp="$rp (~name ok)";;
3975         esac
3976         . UU/myread
3977         if test -f UU/getfile.ok && \
3978                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3979         then
3980                 value="$ans"
3981                 ansexp="$ans"
3982                 break
3983         fi
3984         case "$ans" in
3985         none)
3986                 value=''
3987                 ansexp=''
3988                 case "$none_ok" in
3989                 true) type='';;
3990                 esac
3991                 ;;
3992         *)
3993                 case "$tilde" in
3994                 '') value="$ans"
3995                         ansexp="$ans";;
3996                 *)
3997                         value=`UU/filexp $ans`
3998                         case $? in
3999                         0)
4000                                 if test "$ans" != "$value"; then
4001                                         echo "(That expands to $value on this system.)"
4002                                 fi
4003                                 ;;
4004                         *) value="$ans";;
4005                         esac
4006                         ansexp="$value"
4007                         case "$exp_file" in
4008                         '') value="$ans";;
4009                         esac
4010                         ;;
4011                 esac
4012                 case "$fullpath" in
4013                 true)
4014                         case "$ansexp" in
4015                         /*) value="$ansexp" ;;
4016                         [a-zA-Z]:/*) value="$ansexp" ;;
4017                         *)
4018                                 redo=true
4019                                 case "$already" in
4020                                 true)
4021                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4022                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4023                                         ;;
4024                                 *)
4025                                 echo "Please give a full path name, starting with slash." >&4
4026                                         case "$tilde" in
4027                                         true)
4028                                 echo "Note that using ~name is ok provided it expands well." >&4
4029                                                 already=true
4030                                                 ;;
4031                                         esac
4032                                 esac
4033                                 ;;
4034                         esac
4035                         ;;
4036                 esac
4037                 case "$redo" in
4038                 '')
4039                         case "$type" in
4040                         File)
4041                                 for fp in $gfpth; do
4042                                         if test "X$fp" = X.; then
4043                                             pf="$ansexp"
4044                                         else    
4045                                             pf="$fp/$ansexp"
4046                                         fi
4047                                         if test -f "$pf"; then
4048                                                 type=''
4049                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4050                                         then
4051                                                 echo "($value is not a plain file, but that's ok.)"
4052                                                 type=''
4053                                         fi
4054                                         if test X"$type" = X; then
4055                                             value="$pf"
4056                                             break
4057                                         fi
4058                                 done
4059                                 ;;
4060                         Directory)
4061                                 for fp in $gfpth; do
4062                                         if test "X$fp" = X.; then
4063                                             dir="$ans"
4064                                             direxp="$ansexp"
4065                                         else    
4066                                             dir="$fp/$ansexp"
4067                                             direxp="$fp/$ansexp"
4068                                         fi
4069                                         if test -d "$direxp"; then
4070                                                 type=''
4071                                                 value="$dir"
4072                                                 break
4073                                         fi
4074                                 done
4075                                 ;;
4076                         Locate)
4077                                 if test -d "$ansexp"; then
4078                                         echo "(Looking for $loc_file in directory $value.)"
4079                                         value="$value/$loc_file"
4080                                         ansexp="$ansexp/$loc_file"
4081                                 fi
4082                                 if test -f "$ansexp"; then
4083                                         type=''
4084                                 fi
4085                                 case "$nopath_ok" in
4086                                 true)   case "$value" in
4087                                         */*) ;;
4088                                         *)      echo "Assuming $value will be in people's path."
4089                                                 type=''
4090                                                 ;;
4091                                         esac
4092                                         ;;
4093                                 esac
4094                                 ;;
4095                         esac
4096
4097                         case "$skip" in
4098                         true) type='';
4099                         esac
4100
4101                         case "$type" in
4102                         '') ;;
4103                         *)
4104                                 if test "$fastread" = yes; then
4105                                         dflt=y
4106                                 else
4107                                         dflt=n
4108                                 fi
4109                                 rp="$what $value doesn't exist.  Use that name anyway?"
4110                                 . UU/myread
4111                                 dflt=''
4112                                 case "$ans" in
4113                                 y*) type='';;
4114                                 *) echo " ";;
4115                                 esac
4116                                 ;;
4117                         esac
4118                         ;;
4119                 esac
4120                 ;;
4121         esac
4122 done
4123 cd UU
4124 ans="$value"
4125 rp="$orig_rp"
4126 dflt="$orig_dflt"
4127 rm -f getfile.ok
4128 test "X$gfpthkeep" != Xy && gfpth=""
4129 EOSC
4130
4131 : determine root of directory hierarchy where package will be installed.
4132 case "$prefix" in
4133 '')
4134         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4135         ;;
4136 *?/)
4137         dflt=`echo "$prefix" | sed 's/.$//'`
4138         ;;
4139 *)
4140         dflt="$prefix"
4141         ;;
4142 esac
4143 $cat <<EOM
4144
4145 By default, $package will be installed in $dflt/bin, manual pages
4146 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4147 installation directories. Typically this is something like /usr/local.
4148 If you wish to have binaries under /usr/bin but other parts of the
4149 installation under /usr/local, that's ok: you will be prompted
4150 separately for each of the installation directories, the prefix being
4151 only used to set the defaults.
4152
4153 EOM
4154 fn=d~
4155 rp='Installation prefix to use?'
4156 . ./getfile
4157 oldprefix=''
4158 case "$prefix" in
4159 '') ;;
4160 *)
4161         case "$ans" in
4162         "$prefix") ;;
4163         *) oldprefix="$prefix";;
4164         esac
4165         ;;
4166 esac
4167 prefix="$ans"
4168 prefixexp="$ansexp"
4169
4170 : allow them to override the AFS root
4171 case "$afsroot" in
4172 '')     afsroot=/afs ;;
4173 *)      afsroot=$afsroot ;;
4174 esac
4175
4176 : is AFS running?
4177 echo " "
4178 case "$afs" in
4179 $define|true)   afs=true ;;
4180 $undef|false)   afs=false ;;
4181 *)      if $test -d $afsroot; then
4182                 afs=true
4183         else
4184                 afs=false
4185         fi
4186         ;;
4187 esac
4188 if $afs; then
4189         echo "AFS may be running... I'll be extra cautious then..." >&4
4190 else
4191         echo "AFS does not seem to be running..." >&4
4192 fi
4193
4194 : determine installation prefix for where package is to be installed.
4195 if $afs; then
4196 $cat <<EOM
4197
4198 Since you are running AFS, I need to distinguish the directory in which
4199 files will reside from the directory in which they are installed (and from
4200 which they are presumably copied to the former directory by occult means).
4201
4202 EOM
4203         case "$installprefix" in
4204         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4205         *) dflt="$installprefix";;
4206         esac
4207 else
4208 $cat <<EOM
4209
4210 In some special cases, particularly when building $package for distribution,
4211 it is convenient to distinguish the directory in which files should be
4212 installed from the directory ($prefix) in which they will
4213 eventually reside.  For most users, these two directories are the same.
4214
4215 EOM
4216         case "$installprefix" in
4217         '') dflt=$prefix ;;
4218         *) dflt=$installprefix;;
4219         esac
4220 fi
4221 fn=d~
4222 rp='What installation prefix should I use for installing files?'
4223 . ./getfile
4224 installprefix="$ans"
4225 installprefixexp="$ansexp"
4226
4227 : Perform the prefixexp/installprefixexp correction if necessary
4228 cat <<EOS >installprefix
4229 $startsh
4230 EOS
4231 cat <<'EOSC' >>installprefix
4232 : Change installation prefix, if necessary.
4233 if $test X"$prefix" != X"$installprefix"; then
4234     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4235 else
4236     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4237 fi
4238 EOSC
4239 chmod +x installprefix
4240 $eunicefix installprefix
4241
4242 : Set variables such as privlib and privlibexp from the output of ./getfile
4243 : performing the prefixexp/installprefixexp correction if necessary.
4244 cat <<EOS >setprefixvar
4245 $startsh
4246 EOS
4247 cat <<'EOSC' >>setprefixvar
4248 eval "${prefixvar}=\"\$ans\""
4249 eval "${prefixvar}exp=\"\$ansexp\""
4250 . ./installprefix
4251 EOSC
4252 chmod +x setprefixvar
4253 $eunicefix setprefixvar
4254
4255 : set up the script used to warn in case of inconsistency
4256 cat <<EOS >whoa
4257 $startsh
4258 EOS
4259 cat <<'EOSC' >>whoa
4260 dflt=y
4261 case "$hint" in
4262     recommended)
4263         case "$hintfile" in
4264         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4265                 ;;
4266         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4267                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4268                 ;;
4269         esac
4270         ;;
4271     *)  echo " "
4272         echo "*** WHOA THERE!!! ***" >&4
4273         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4274         ;;
4275 esac
4276 rp="    Keep the $hint value?"
4277 . ./myread
4278 case "$ans" in
4279 y) td=$was; tu=$was;;
4280 esac
4281 EOSC
4282
4283 : function used to set '$1' to '$val'
4284 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4285 case "$val$was" in
4286 $define$undef) . ./whoa; eval "$var=\$td";;
4287 $undef$define) . ./whoa; eval "$var=\$tu";;
4288 *) eval "$var=$val";;
4289 esac'
4290
4291 : get the patchlevel
4292 echo " "
4293 echo "Getting the current patchlevel..." >&4
4294 if $test -r $rsrc/patchlevel.h;then
4295         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4296         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4297         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4298         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4299         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4300         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4301         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4302 else
4303         revision=0
4304         patchlevel=0
4305         subversion=0
4306         api_revision=0
4307         api_version=0
4308         api_subversion=0
4309         perl_patchlevel=0
4310         $echo "(You do not have patchlevel.h.  Eek.)"
4311 fi
4312 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4313 version_patchlevel_string="version $patchlevel subversion $subversion"
4314 case "$perl_patchlevel" in
4315 0|'') ;;
4316 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4317     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4318     ;;
4319 esac
4320
4321 $echo "(You have $package $version_patchlevel_string.)"
4322
4323 case "$osname" in
4324 dos|vms)
4325         : XXX Should be a Configure test for double-dots in filenames.
4326         version=`echo $revision $patchlevel $subversion | \
4327                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4328         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4329                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4330         ;;
4331 *)
4332         version=`echo $revision $patchlevel $subversion | \
4333                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4334         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4335                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4336         ;;
4337 esac
4338 : Special case the 5.005_xx maintenance series, which used 5.005
4339 : without any subversion label as a subdirectory in $sitelib
4340 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4341         api_versionstring='5.005'
4342 fi
4343
4344 : Do we want threads support and if so, what type
4345 case "$usethreads" in
4346 $define|true|[yY]*)     dflt='y';;
4347 *)     # Catch case where user specified ithreads or 5005threads but
4348        # forgot -Dusethreads (A.D. 4/2002)
4349        case "$useithreads$use5005threads" in
4350        *$define*)       dflt='y';;
4351        *)               dflt='n';;
4352        esac
4353        ;;
4354 esac
4355 cat <<EOM
4356
4357 Perl can be built to offer a form of threading support on some systems
4358 To do so, Configure can be run with -Dusethreads.
4359
4360 Note that Perl built with threading support runs slightly slower
4361 and uses slightly more memory than plain Perl.
4362
4363 If this doesn't make any sense to you, just accept the default '$dflt'.
4364 EOM
4365 rp='Build a threading Perl?'
4366 . ./myread
4367 case "$ans" in
4368 y|Y)    val="$define" ;;
4369 *)      val="$undef" ;;
4370 esac
4371 set usethreads
4372 eval $setvar
4373
4374 if $test $patchlevel -lt 9; then
4375     case "$usethreads" in
4376     $define)
4377         : Default to ithreads unless overridden on command line or with
4378         : old config.sh
4379         dflt='y'
4380         case "$use5005threads" in
4381                 $define|true|[yY]*)
4382                         echo "5.005 threads are no longer supported"
4383                         exit 1
4384                 ;;
4385         esac
4386         case "$useithreads" in
4387                 $undef|false|[nN]*) dflt='n';;
4388         esac
4389         rp='Use the newer interpreter-based ithreads?'
4390         . ./myread
4391         case "$ans" in
4392         y|Y)    val="$define" ;;
4393         *)      val="$undef" ;;
4394         esac
4395         set useithreads
4396         eval $setvar
4397         : Now set use5005threads to the opposite value.
4398         case "$useithreads" in
4399         $define) val="$undef" ;;
4400         *) val="$define" ;;
4401         esac
4402         set use5005threads
4403         eval $setvar
4404         ;;
4405     *)
4406         useithreads="$undef"
4407         use5005threads="$undef"
4408         ;;
4409     esac
4410
4411     case "$useithreads$use5005threads" in
4412     "$define$define")
4413         $cat >&4 <<EOM
4414
4415 You cannot have both the ithreads and the 5.005 threads enabled
4416 at the same time.  Disabling the 5.005 threads since they are
4417 much less stable than the ithreads.
4418
4419 EOM
4420         use5005threads="$undef"
4421         ;;
4422     esac
4423
4424 else
4425 : perl-5.9.x and later
4426
4427     if test X"$usethreads" = "X$define"; then
4428         case "$use5005threads" in
4429             $define|true|[yY]*)
4430                 $cat >&4 <<EOM
4431
4432 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4433
4434 EOM
4435             ;;
4436         esac
4437     fi
4438
4439     use5005threads="$undef"
4440     useithreads="$usethreads"
4441 fi
4442
4443 case "$d_oldpthreads" in
4444 '')     : Configure tests would be welcome here.  For now, assume undef.
4445         val="$undef" ;;
4446 *)      val="$d_oldpthreads" ;;
4447 esac
4448 set d_oldpthreads
4449 eval $setvar
4450
4451
4452 : Look for a hint-file generated 'call-back-unit'.  If the
4453 : user has specified that a threading perl is to be built,
4454 : we may need to set or change some other defaults.
4455 if $test -f usethreads.cbu; then
4456     echo "Your platform has some specific hints regarding threaded builds, using them..."
4457     . ./usethreads.cbu
4458 else
4459     case "$usethreads" in
4460         "$define"|true|[yY]*)
4461                 $cat <<EOM
4462 (Your platform does not have any specific hints for threaded builds.
4463  Assuming POSIX threads, then.)
4464 EOM
4465         ;;
4466     esac
4467 fi
4468
4469 : Check if multiplicity is required
4470 cat <<EOM
4471
4472 Perl can be built so that multiple Perl interpreters can coexist
4473 within the same Perl executable.
4474 EOM
4475
4476 case "$useithreads" in
4477 $define)
4478         cat <<EOM
4479 This multiple interpreter support is required for interpreter-based threads.
4480 EOM
4481         val="$define"
4482         ;;
4483 *)      case "$usemultiplicity" in
4484         $define|true|[yY]*)     dflt='y';;
4485         *) dflt='n';;
4486         esac
4487         echo " "
4488         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4489         rp='Build Perl for multiplicity?'
4490         . ./myread
4491         case "$ans" in
4492         y|Y)    val="$define" ;;
4493         *)      val="$undef" ;;
4494         esac
4495         ;;
4496 esac
4497 set usemultiplicity
4498 eval $setvar
4499
4500 : Check if morebits is requested
4501 case "$usemorebits" in
4502 "$define"|true|[yY]*)
4503         use64bitint="$define"
4504         uselongdouble="$define"
4505         usemorebits="$define"
4506         ;;
4507 *)      usemorebits="$undef"
4508         ;;
4509 esac
4510
4511 : Determine the C compiler to be used
4512 echo " "
4513 case "$cc" in
4514 '') dflt=cc;;
4515 *) dflt="$cc";;
4516 esac
4517 rp="Use which C compiler?"
4518 . ./myread
4519 cc="$ans"
4520
4521 : See whether they have no cc but they do have gcc
4522 . ./trygcc
4523 if $test -f cc.cbu; then
4524     . ./cc.cbu
4525 fi
4526 . ./checkcc
4527
4528 : make some quick guesses about what we are up against
4529 echo " "
4530 $echo $n "Hmm...  $c"
4531 echo exit 1 >bsd
4532 echo exit 1 >usg
4533 echo exit 1 >v7
4534 echo exit 1 >osf1
4535 echo exit 1 >eunice
4536 echo exit 1 >xenix
4537 echo exit 1 >venix
4538 echo exit 1 >os2
4539 d_bsd="$undef"
4540 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4541 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4542 then
4543         echo "Looks kind of like an OSF/1 system, but we'll see..."
4544         echo exit 0 >osf1
4545 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4546         xxx=`./loc addbib blurfl $pth`
4547         if $test -f $xxx; then
4548         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4549                 echo exit 0 >bsd
4550                 echo exit 0 >usg
4551         else
4552                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4553                         echo "Looks kind of like an extended USG system, but we'll see..."
4554                 else
4555                         echo "Looks kind of like a USG system, but we'll see..."
4556                 fi
4557                 echo exit 0 >usg
4558         fi
4559 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4560         echo "Looks kind of like a BSD system, but we'll see..."
4561         d_bsd="$define"
4562         echo exit 0 >bsd
4563 else
4564         echo "Looks kind of like a Version 7 system, but we'll see..."
4565         echo exit 0 >v7
4566 fi
4567 case "$eunicefix" in
4568 *unixtovms*)
4569         $cat <<'EOI'
4570 There is, however, a strange, musty smell in the air that reminds me of
4571 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4572 EOI
4573         echo exit 0 >eunice
4574         d_eunice="$define"
4575 : it so happens the Eunice I know will not run shell scripts in Unix format
4576         ;;
4577 *)
4578         echo " "
4579         echo "Congratulations.  You aren't running Eunice."
4580         d_eunice="$undef"
4581         ;;
4582 esac
4583 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4584 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4585 : semicolon as a patch separator
4586 case "$p_" in
4587 :) ;;
4588 *)
4589         $cat <<'EOI'
4590 I have the feeling something is not exactly right, however...don't tell me...
4591 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4592 (Or you may be running DOS with DJGPP.)
4593 EOI
4594         echo exit 0 >os2
4595         ;;
4596 esac
4597 if test -f /xenix; then
4598         echo "Actually, this looks more like a XENIX system..."
4599         echo exit 0 >xenix
4600         d_xenix="$define"
4601 else
4602         echo " "
4603         echo "It's not Xenix..."
4604         d_xenix="$undef"
4605 fi
4606 chmod +x xenix
4607 $eunicefix xenix
4608 if test -f /venix; then
4609         echo "Actually, this looks more like a VENIX system..."
4610         echo exit 0 >venix
4611 else
4612         echo " "
4613         if ./xenix; then
4614                 : null
4615         else
4616                 echo "Nor is it Venix..."
4617         fi
4618 fi
4619 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4620 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4621 $rm -f foo
4622
4623 : Check if we are using GNU gcc and what its version is
4624 echo " "
4625 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4626 $cat >try.c <<EOM
4627 #include <stdio.h>
4628 int main() {
4629 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4630 #ifdef __VERSION__
4631         printf("%s\n", __VERSION__);
4632 #else
4633         printf("%s\n", "1");
4634 #endif
4635 #endif
4636         return(0);
4637 }
4638 EOM
4639 if $cc -o try $ccflags $ldflags try.c; then
4640         gccversion=`$run ./try`
4641         case "$gccversion" in
4642         '') echo "You are not using GNU cc." ;;
4643         *)  echo "You are using GNU cc $gccversion."
4644             ccname=gcc
4645             ;;
4646         esac
4647 else
4648         echo " "
4649         echo "*** WHOA THERE!!! ***" >&4
4650         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4651         case "$knowitall" in
4652         '')
4653         echo "    You'd better start hunting for one and let me know about it." >&4
4654                 exit 1
4655                 ;;
4656         esac
4657 fi
4658 $rm -f try try.*
4659 case "$gccversion" in
4660 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4661 esac
4662 case "$gccversion" in
4663 '') gccosandvers='' ;;
4664 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4665    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4666    gccshortvers=''
4667    case "$gccosandvers" in
4668    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4669    $osname$osvers) ;; # looking good
4670    $osname*) cat <<EOM >&4
4671
4672 *** WHOA THERE!!! ***
4673
4674     Your gcc has not been compiled for the exact release of
4675     your operating system ($gccosandvers versus $osname$osvers).
4676
4677     In general it is a good idea to keep gcc synchronized with
4678     the operating system because otherwise serious problems
4679     may ensue when trying to compile software, like Perl.
4680
4681     I'm trying to be optimistic here, though, and will continue.
4682     If later during the configuration and build icky compilation
4683     problems appear (headerfile conflicts being the most common
4684     manifestation), I suggest reinstalling the gcc to match
4685     your operating system release.
4686
4687 EOM
4688       ;;
4689    *) gccosandvers='' ;; # failed to parse, better be silent
4690    esac
4691    ;;
4692 esac
4693 case "$ccname" in
4694 '') ccname="$cc" ;;
4695 esac
4696
4697 # gcc 3.* complain about adding -Idirectories that they already know about,
4698 # so we will take those off from locincpth.
4699 case "$gccversion" in
4700 3*)
4701     echo "main(){}">try.c
4702     for incdir in $locincpth; do
4703        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4704              grep '^c[cp]p*[01]: warning: changing search order '`
4705        if test "X$warn" != X; then
4706            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4707        fi
4708     done
4709     $rm -f try try.*
4710 esac
4711
4712 # gcc 4.9 by default does some optimizations that break perl.
4713 # see ticket 121505.
4714 #
4715 # The -fwrapv disables those optimizations (and probably others,) so
4716 # for gcc 4.9 (and later, since the optimizations probably won't go
4717 # away), add -fwrapv unless the user requests -fno-wrapv, which
4718 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4719 # which turns the overflows -fwrapv ignores into runtime errors.
4720 case "$gccversion" in
4721 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4722     case "$ccflags" in
4723     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4724     *) ccflags="$ccflags -fwrapv" ;;
4725     esac
4726 esac
4727
4728 : What should the include directory be ?
4729 : Use sysroot if set, so findhdr looks in the right place.
4730 echo " "
4731 $echo $n "Hmm...  $c"
4732 dflt="$sysroot/usr/include"
4733 incpath=''
4734 mips_type=''
4735 if $test -f /bin/mips && /bin/mips; then
4736         echo "Looks like a MIPS system..."
4737         $cat >usr.c <<'EOCP'
4738 #ifdef SYSTYPE_BSD43
4739 /bsd43
4740 #endif
4741 EOCP
4742         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4743                 dflt='/bsd43/usr/include'
4744                 incpath='/bsd43'
4745                 mips_type='BSD 4.3'
4746         else
4747                 mips_type='System V'
4748         fi
4749         $rm -f usr.c usr.out
4750         echo "and you're compiling with the $mips_type compiler and libraries."
4751         xxx_prompt=y
4752         echo "exit 0" >mips
4753 else
4754         echo "Doesn't look like a MIPS system."
4755         xxx_prompt=n
4756         echo "exit 1" >mips
4757 fi
4758 chmod +x mips
4759 $eunicefix mips
4760 case "$usrinc" in
4761 '') ;;
4762 *) dflt="$usrinc";;
4763 esac
4764 case "$xxx_prompt" in
4765 y)      fn=d/
4766         echo " "
4767         rp='Where are the include files you want to use?'
4768         . ./getfile
4769         usrinc="$ans"
4770         ;;
4771 *)      usrinc="$dflt"
4772         ;;
4773 esac
4774
4775 : see how we invoke the C preprocessor
4776 echo " "
4777 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4778 cat <<'EOT' >testcpp.c
4779 #define ABC abc
4780 #define XYZ xyz
4781 ABC.XYZ
4782 EOT
4783 cd ..
4784 if test ! -f cppstdin; then
4785         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4786                 # AIX cc -E doesn't show the absolute headerfile
4787                 # locations but we'll cheat by using the -M flag.
4788                 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
4789         else
4790                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4791         fi
4792 else
4793         echo "Keeping your $hint cppstdin wrapper."
4794 fi
4795 chmod 755 cppstdin
4796 wrapper=`pwd`/cppstdin
4797 ok='false'
4798 cd UU
4799
4800 if $test "X$cppstdin" != "X" && \
4801         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4802         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4803 then
4804         echo "You used to use $cppstdin $cppminus so we'll use that again."
4805         case "$cpprun" in
4806         '') echo "But let's see if we can live without a wrapper..." ;;
4807         *)
4808                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4809                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4810                 then
4811                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4812                         ok='true'
4813                 else
4814                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4815                 fi
4816                 ;;
4817         esac
4818 else
4819         case "$cppstdin" in
4820         '') ;;
4821         *)
4822                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4823                 ;;
4824         esac
4825 fi
4826
4827 if $ok; then
4828         : nothing
4829 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4830         $cc -E <testcpp.c >testcpp.out 2>&1; \
4831         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4832         echo "Yup, it does."
4833         x_cpp="$cc $cppflags -E"
4834         x_minus='';
4835 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4836         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4837         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4838         echo "Yup, it does."
4839         x_cpp="$cc $cppflags -E"
4840         x_minus='-';
4841 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4842         $cc -P <testcpp.c >testcpp.out 2>&1; \
4843         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4844         echo "Yipee, that works!"
4845         x_cpp="$cc $cppflags -P"
4846         x_minus='';
4847 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4848         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4849         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4850         echo "At long last!"
4851         x_cpp="$cc $cppflags -P"
4852         x_minus='-';
4853 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4854         $cpp <testcpp.c >testcpp.out 2>&1; \
4855         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4856         echo "It works!"
4857         x_cpp="$cpp $cppflags"
4858         x_minus='';
4859 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4860         $cpp - <testcpp.c >testcpp.out 2>&1; \
4861         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4862         echo "Hooray, it works!  I was beginning to wonder."
4863         x_cpp="$cpp $cppflags"
4864         x_minus='-';
4865 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4866         $wrapper <testcpp.c >testcpp.out 2>&1; \
4867         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4868         x_cpp="$wrapper"
4869         x_minus=''
4870         echo "Eureka!"
4871 else
4872         dflt=''
4873         rp="No dice.  I can't find a C preprocessor.  Name one:"
4874         . ./myread
4875         x_cpp="$ans"
4876         x_minus=''
4877         $x_cpp <testcpp.c >testcpp.out 2>&1
4878         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4879                 echo "OK, that will do." >&4
4880         else
4881 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4882                 exit 1
4883         fi
4884 fi
4885
4886 case "$ok" in
4887 false)
4888         cppstdin="$x_cpp"
4889         cppminus="$x_minus"
4890         cpprun="$x_cpp"
4891         cpplast="$x_minus"
4892         set X $x_cpp
4893         shift
4894         case "$1" in
4895         "$cpp")
4896                 echo "Perhaps can we force $cc -E using a wrapper..."
4897                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4898                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4899                 then
4900                         echo "Yup, we can."
4901                         cppstdin="$wrapper"
4902                         cppminus='';
4903                 else
4904                         echo "Nope, we'll have to live without it..."
4905                 fi
4906                 ;;
4907         esac
4908         case "$cpprun" in
4909         "$wrapper")
4910                 cpprun=''
4911                 cpplast=''
4912                 ;;
4913         esac
4914         ;;
4915 esac
4916
4917 case "$cppstdin" in
4918 "$wrapper"|'cppstdin') ;;
4919 *) $rm -f $wrapper;;
4920 esac
4921 $rm -f testcpp.c testcpp.out
4922
4923 : Adjust cppfilter for path component separator
4924 case "$osname" in
4925 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4926 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4927 *)   cppfilter='' ;;
4928 esac
4929
4930 : Use gcc to determine libpth and incpth
4931 # If using gcc or clang, we can get better values for libpth, incpth
4932 # and usrinc directly from the compiler.
4933 # Note that ccname for clang is also gcc.
4934 case "$ccname" in
4935     gcc)
4936         $echo 'extern int foo;' > try.c
4937         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4938         shift
4939         if $test $# -gt 0; then
4940             incpth="$incpth $*"
4941             incpth="`$echo $incpth|$sed 's/^ //'`"
4942             for i in $*; do
4943                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4944                 if $test -d $j; then
4945                     libpth="$libpth $j"
4946                 fi
4947             done
4948             libpth="`$echo $libpth|$sed 's/^ //'`"
4949             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4950                 if $test -d $xxx; then
4951                     case " $libpth " in
4952                     *" $xxx "*) ;;
4953                     *) libpth="$libpth $xxx";;
4954                     esac
4955                 fi
4956             done
4957         fi
4958         $rm -f try.c
4959         case "$usrinc" in
4960         '') for i in $incpth; do
4961                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4962                     usrinc="$i"
4963                     break
4964                 fi
4965             done
4966             ;;
4967         esac
4968
4969         case "$usecrosscompile" in
4970         $define|true|[yY]*)
4971             case "$incpth" in
4972                 '') echo "Incpth not defined." >&4; croak=y ;;
4973                 *)  echo "Using incpth '$incpth'." >&4 ;;
4974             esac
4975             case "$libpth" in
4976                 '') echo "Libpth not defined." >&4; croak=y ;;
4977                 *)  echo "Using libpth '$libpth'." >&4 ;;
4978             esac
4979             case "$usrinc" in
4980                 '') echo "Usrinc not defined." >&4; croak=y ;;
4981                 *)  echo "Using usrinc $usrinc." >&4 ;;
4982             esac
4983             case "$croak" in
4984                 y)
4985                 if test "X$sysroot" = X; then
4986                     echo "Cannot continue, aborting." >&4; exit 1
4987                 else
4988                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
4989                 fi
4990                 ;;
4991             esac
4992             ;;
4993         esac
4994     ;;
4995 esac
4996
4997 : Default value for incpth is just usrinc
4998 case "$incpth" in
4999 '') incpth="$usrinc";;
5000 esac
5001
5002 : Set private lib path
5003 case "$plibpth" in
5004 '') if ./mips; then
5005         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5006     fi;;
5007 esac
5008 case "$libpth" in
5009 ' ') dlist='';;
5010 '') dlist="$loclibpth $plibpth $glibpth";;
5011 *) dlist="$libpth";;
5012 esac
5013
5014 : Now check and see which directories actually exist, avoiding duplicates
5015 for xxx in $dlist
5016 do
5017     if $test -d $xxx; then
5018                 case " $libpth " in
5019                 *" $xxx "*) ;;
5020                 *) libpth="$libpth $xxx";;
5021                 esac
5022     fi
5023 done
5024 $cat <<'EOM'
5025
5026 Some systems have incompatible or broken versions of libraries.  Among
5027 the directories listed in the question below, please remove any you
5028 know not to be holding relevant libraries, and add any that are needed.
5029 Say "none" for none.
5030
5031 EOM
5032
5033 if test "X$sysroot" != X; then
5034     $cat <<EOM
5035 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5036
5037 EOM
5038 fi
5039
5040 case "$libpth" in
5041 '') dflt='none';;
5042 *)
5043         set X $libpth
5044         shift
5045         dflt=${1+"$@"}
5046         ;;
5047 esac
5048 rp="Directories to use for library searches?"
5049 . ./myread
5050 case "$ans" in
5051 none) libpth=' ';;
5052 *) libpth="$ans";;
5053 esac
5054
5055 : compute shared library extension
5056 case "$so" in
5057 '')
5058         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5059                 dflt='sl'
5060         else
5061                 dflt='so'
5062         fi
5063         ;;
5064 *) dflt="$so";;
5065 esac
5066 $cat <<EOM
5067
5068 On some systems, shared libraries may be available.  Answer 'none' if
5069 you want to suppress searching of shared libraries for the remainder
5070 of this configuration.
5071
5072 EOM
5073 rp='What is the file extension used for shared libraries?'
5074 . ./myread
5075 so="$ans"
5076
5077 : Does target system insist that shared library basenames are unique
5078 $cat << EOM
5079
5080 Some dynamic loaders assume that the *basename* of shared library filenames
5081 are globally unique.  We'll default this to undef as we assume your system
5082 is not this weird. Set to defined if you're on one of them.
5083
5084 EOM
5085
5086 dflt='n'
5087 rp='Make shared library basenames unique?'
5088 . ./myread
5089 case "$ans" in
5090 y|Y) val="$define" ;;
5091 *)   val="$undef"  ;;
5092 esac
5093 set d_libname_unique
5094 eval $setvar
5095
5096 : Define several unixisms.
5097 : Hints files or command line option can be used to override them.
5098 : The convoluted testing is in case hints files set either the old
5099 : or the new name.
5100 case "$_exe" in
5101 '')     case "$exe_ext" in
5102         '')     ;;
5103         *)      _exe="$exe_ext" ;;
5104         esac
5105         ;;
5106 esac
5107 case "$_a" in
5108 '')     case "$lib_ext" in
5109     '') _a='.a';;
5110         *)      _a="$lib_ext" ;;
5111         esac
5112         ;;
5113 esac
5114 case "$_o" in
5115 '') case "$obj_ext" in
5116         '')     _o='.o';;
5117         *)      _o="$obj_ext";;
5118         esac
5119         ;;
5120 esac
5121 case "$p_" in
5122 '') case "$path_sep" in
5123         '')     p_=':';;
5124         *)      p_="$path_sep";;
5125         esac
5126         ;;
5127 esac
5128 exe_ext=$_exe
5129 lib_ext=$_a
5130 obj_ext=$_o
5131 path_sep=$p_
5132
5133 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5134
5135 : Which makefile gets called first.  This is used by make depend.
5136 case "$firstmakefile" in
5137 '') firstmakefile='makefile';;
5138 esac
5139
5140 : Check is we will use socks
5141 case "$usesocks" in
5142 $define|true|[yY]*)     dflt='y';;
5143 *) dflt='n';;
5144 esac
5145 cat <<EOM
5146
5147 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5148 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5149 to use the PerlIO abstraction layer, this will be implicitly selected.
5150
5151 If this doesn't make any sense to you, just accept the default '$dflt'.
5152 EOM
5153 rp='Build Perl for SOCKS?'
5154 . ./myread
5155 case "$ans" in
5156 y|Y)    val="$define" ;;
5157 *)      val="$undef" ;;
5158 esac
5159 set usesocks
5160 eval $setvar
5161
5162 : Check for uselongdouble support
5163 case "$ccflags" in
5164 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5165 esac
5166
5167 case "$uselongdouble" in
5168 $define|true|[yY]*)     dflt='y';;
5169 *) dflt='n';;
5170 esac
5171 cat <<EOM
5172
5173 Perl can be built to take advantage of long doubles which
5174 (if available) may give more accuracy and range for floating point numbers.
5175
5176 If this doesn't make any sense to you, just accept the default '$dflt'.
5177 EOM
5178 rp='Try to use long doubles if available?'
5179 . ./myread
5180 case "$ans" in
5181 y|Y)    val="$define"   ;;
5182 *)      val="$undef"    ;;
5183 esac
5184 set uselongdouble
5185 eval $setvar
5186
5187 case "$uselongdouble" in
5188 true|[yY]*) uselongdouble="$define" ;;
5189 esac
5190
5191 : Look for a hint-file generated 'call-back-unit'.  If the
5192 : user has specified that long doubles should be used,
5193 : we may need to set or change some other defaults.
5194 if $test -f uselongdouble.cbu; then
5195     echo "Your platform has some specific hints regarding long doubles, using them..."
5196     . ./uselongdouble.cbu
5197 else
5198     case "$uselongdouble" in
5199         $define)
5200                 $cat <<EOM
5201 (Your platform does not have any specific hints for long doubles.)
5202 EOM
5203         ;;
5204     esac
5205 fi
5206
5207 : Check if quadmath is requested
5208 case "$usequadmath" in
5209 "$define"|true|[yY]*) usequadmath="$define" ;;
5210 *)                    usequadmath="$undef"  ;;
5211 esac
5212
5213 : Looking for optional libraries
5214 echo " "
5215 echo "Checking for optional libraries..." >&4
5216 case "$libs" in
5217 ' '|'') dflt='';;
5218 *) dflt="$libs";;
5219 esac
5220 case "$libswanted" in
5221 '') libswanted='c_s';;
5222 esac
5223 case "$usesocks" in
5224 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5225 esac
5226 case "$usecbacktrace" in
5227 "$define") libswanted="$libswanted bfd" ;;
5228 esac
5229 case "$usequadmath" in
5230 "$define") libswanted="$libswanted quadmath" ;;
5231 esac
5232 libsfound=''
5233 libsfiles=''
5234 libsdirs=''
5235 libspath=''
5236 for thisdir in $libpth $xlibpth; do
5237   test -d $thisdir && libspath="$libspath $thisdir"
5238 done
5239 for thislib in $libswanted; do
5240         for thisdir in $libspath; do
5241             xxx=''
5242             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5243                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5244                 $test -f "$xxx" && eval $libscheck
5245                 $test -f "$xxx" && libstyle=shared
5246                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5247                 $test -f "$xxx" && eval $libscheck
5248                 $test -f "$xxx" && libstyle=shared
5249             fi
5250             if test ! -f "$xxx"; then
5251                 xxx=$thisdir/lib$thislib.$so
5252                 $test -f "$xxx" && eval $libscheck
5253                 $test -f "$xxx" && libstyle=shared
5254             fi
5255             if test ! -f "$xxx"; then
5256                 xxx=$thisdir/lib$thislib$_a
5257                 $test -f "$xxx" && eval $libscheck
5258                 $test -f "$xxx" && libstyle=static
5259             fi
5260             if test ! -f "$xxx"; then
5261                 xxx=$thisdir/$thislib$_a
5262                 $test -f "$xxx" && eval $libscheck
5263                 $test -f "$xxx" && libstyle=static
5264             fi
5265             if test ! -f "$xxx"; then
5266                 xxx=$thisdir/lib${thislib}_s$_a
5267                 $test -f "$xxx" && eval $libscheck
5268                 $test -f "$xxx" && libstyle=static
5269                 $test -f "$xxx" && thislib=${thislib}_s
5270             fi
5271             if test ! -f "$xxx"; then
5272                 xxx=$thisdir/Slib$thislib$_a
5273                 $test -f "$xxx" && eval $libscheck
5274                 $test -f "$xxx" && libstyle=static
5275             fi
5276             if $test -f "$xxx"; then
5277                 case "$libstyle" in
5278                 shared) echo "Found -l$thislib (shared)." ;;
5279                 static) echo "Found -l$thislib." ;;
5280                 *)      echo "Found -l$thislib ($libstyle)." ;;
5281                 esac
5282                 case " $dflt " in
5283                 *"-l$thislib "*);;
5284                 *) dflt="$dflt -l$thislib"
5285                    libsfound="$libsfound $xxx"
5286                    yyy=`basename $xxx`
5287                    libsfiles="$libsfiles $yyy"
5288                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5289                    case " $libsdirs " in
5290                    *" $yyy "*) ;;
5291                    *) libsdirs="$libsdirs $yyy" ;;
5292                    esac
5293                    ;;
5294                 esac
5295                 break
5296             fi
5297         done
5298         if $test ! -f "$xxx"; then
5299             echo "No -l$thislib."
5300         fi
5301 done
5302 set X $dflt
5303 shift
5304 dflt="$*"
5305 case "$libs" in
5306 '') dflt="$dflt";;
5307 *) dflt="$libs";;
5308 esac
5309 case "$dflt" in
5310 ' '|'') dflt='none';;
5311 esac
5312
5313 $cat <<EOM
5314
5315 In order to compile $package on your machine, a number of libraries
5316 are usually needed.  Include any other special libraries here as well.
5317 Say "none" for none.  The default list is almost always right.
5318 EOM
5319
5320 echo " "
5321 rp="What libraries to use?"
5322 . ./myread
5323 case "$ans" in
5324 none) libs=' ';;
5325 *) libs="$ans";;
5326 esac
5327
5328 : determine optimization, if desired, or use for debug flag also
5329 case "$optimize" in
5330 ' '|$undef) dflt='none';;
5331 '') dflt='-O';;
5332 *) dflt="$optimize";;
5333 esac
5334 $cat <<EOH
5335
5336 By default, $package compiles with the -O flag to use the optimizer.
5337 Alternately, you might want to use the symbolic debugger, which uses
5338 the -g flag (on traditional Unix systems).  Either flag can be
5339 specified here.  To use neither flag, specify the word "none".
5340
5341 EOH
5342 rp="What optimizer/debugger flag should be used?"
5343 . ./myread
5344 optimize="$ans"
5345 case "$optimize" in
5346 'none') optimize=" ";;
5347 esac
5348
5349 : Check what DEBUGGING is required from the command line
5350 : -DEBUGGING      or -DDEBUGGING or
5351 : -DEBUGGING=both                       = -g + -DDEBUGGING
5352 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5353 : -DEBUGGING=none or -UDEBUGGING        =
5354 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5355 case "$EBUGGING" in
5356 '')     ;;
5357 *)      DEBUGGING=$EBUGGING ;;
5358 esac
5359
5360 case "$DEBUGGING" in
5361 -g|both|$define)
5362     case "$optimize" in
5363         *-g*) ;;
5364         *)    optimize="$optimize -g" ;;
5365     esac ;;
5366 none|$undef)
5367     case "$optimize" in
5368         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5369                 shift
5370                 optimize="$*"
5371                 ;;
5372     esac ;;
5373 esac
5374
5375 dflt=''
5376 case "$DEBUGGING" in
5377 both|$define) dflt='-DDEBUGGING'
5378 esac
5379
5380 : argument order is deliberate, as the flag will start with - which set could
5381 : think is an option
5382 checkccflag='check=$1; flag=$2; callback=$3;
5383 echo " ";
5384 echo "Checking if your compiler accepts $flag" 2>&1;
5385 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5386 echo "int main(void) { return 0; }" > gcctest.c;
5387 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5388     echo "Yes, it does." 2>&1;
5389     if $test -s gcctest.out ; then
5390         echo "But your platform does not like it:";
5391         cat gcctest.out;
5392     else
5393         case "$ccflags" in
5394         *$check*)
5395             echo "Leaving current flags $ccflags alone." 2>&1
5396             ;;
5397         *) dflt="$dflt $flag";
5398             eval $callback
5399             ;;
5400         esac
5401     fi
5402 else
5403     echo "Nope, it does not, but that is ok." 2>&1;
5404 fi
5405 '
5406
5407 : We will not override a previous value, but we might want to
5408 : augment a hint file
5409 case "$hint" in
5410 default|recommended)
5411         case "$gccversion" in
5412         1*) dflt="$dflt -fpcc-struct-return" ;;
5413         esac
5414         case "$optimize:$DEBUGGING" in
5415         *-g*:old) dflt="$dflt -DDEBUGGING";;
5416         esac
5417         case "$gccversion" in
5418         2*) if $test -d /etc/conf/kconfig.d &&
5419                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5420                 then
5421                         # Interactive Systems (ISC) POSIX mode.
5422                         dflt="$dflt -posix"
5423                 fi
5424                 ;;
5425         esac
5426         case "$gccversion" in
5427         1*) ;;
5428         2.[0-8]*) ;;
5429         ?*)     set strict-aliasing -fno-strict-aliasing
5430                 eval $checkccflag
5431                 ;;
5432         esac
5433         # For gcc, adding -pipe speeds up compilations for some, but apparently
5434         # some assemblers can't read from stdin.  (It also slows down compilations
5435         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5436         case "$gccversion" in
5437         ?*)     set pipe -pipe
5438                 eval $checkccflag
5439                 ;;
5440         esac
5441
5442         # on x86_64 (at least) we require an extra library (libssp) in the
5443         # link command line. This library is not named, so I infer that it is
5444         # an implementation detail that may change. Hence the safest approach
5445         # is to add the flag to the flags passed to the compiler at link time,
5446         # as that way the compiler can do the right implementation dependant
5447         # thing. (NWC)
5448         case "$gccversion" in
5449         ?*)     set stack-protector-strong -fstack-protector-strong
5450                 eval $checkccflag
5451                 case "$dflt" in
5452                 *-fstack-protector-strong*) ;; # It got added.
5453                 *) # Try the plain/older -fstack-protector.
5454                    set stack-protector -fstack-protector
5455                    eval $checkccflag
5456                    ;;
5457                 esac
5458                 ;;
5459         esac
5460         ;;
5461 esac
5462
5463 case "$mips_type" in
5464 *BSD*|'') inclwanted="$locincpth $usrinc";;
5465 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5466 esac
5467 for thisincl in $inclwanted; do
5468         if $test -d $thisincl; then
5469                 if $test x$thisincl != x$usrinc; then
5470                         case "$dflt" in
5471                         *" -I$thisincl "*);;
5472                         *) dflt="$dflt -I$thisincl ";;
5473                         esac
5474                 fi
5475         fi
5476 done
5477
5478 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5479         xxx=true;
5480 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5481         xxx=true;
5482 else
5483         xxx=false;
5484 fi;
5485 if $xxx; then
5486         case "$dflt" in
5487         *$2*);;
5488         *) dflt="$dflt -D$2";;
5489         esac;
5490 fi'
5491
5492 set signal.h LANGUAGE_C; eval $inctest
5493
5494 case "$usesocks" in
5495 $define)
5496         ccflags="$ccflags -DSOCKS"
5497         ;;
5498 esac
5499
5500 case "$hint" in
5501 default|recommended) dflt="$ccflags $dflt" ;;
5502 *) dflt="$ccflags";;
5503 esac
5504
5505 case "$dflt" in
5506 ''|' ') dflt=none;;
5507 esac
5508
5509 $cat <<EOH
5510
5511 Your C compiler may want other flags.  For this question you should include
5512 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5513 but you should NOT include libraries or ld flags like -lwhatever.  If you
5514 want $package to honor its debug switch, you should include -DDEBUGGING here.
5515 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5516
5517 To use no flags, specify the word "none".
5518
5519 EOH
5520 set X $dflt
5521 shift
5522 dflt=${1+"$@"}
5523 rp="Any additional cc flags?"
5524 . ./myread
5525 case "$ans" in
5526 none) ccflags='';;
5527 *) ccflags="$ans";;
5528 esac
5529
5530 : the following weeds options from ccflags that are of no interest to cpp
5531 case "$cppflags" in
5532 '') cppflags="$ccflags" ;;
5533 *)  cppflags="$cppflags $ccflags" ;;
5534 esac
5535 case "$gccversion" in
5536 1*) cppflags="$cppflags -D__GNUC__"
5537 esac
5538 case "$mips_type" in
5539 '');;
5540 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5541 esac
5542 case "$cppflags" in
5543 '');;
5544 *)
5545         echo " "
5546         echo "Let me guess what the preprocessor flags are..." >&4
5547         set X $cppflags
5548         shift
5549         cppflags=''
5550         $cat >cpp.c <<'EOM'
5551 #define BLURFL foo
5552
5553 BLURFL xx LFRULB
5554 EOM
5555         previous=''
5556         for flag in $*
5557         do
5558                 case "$flag" in
5559                 -*) ftry="$flag";;
5560                 *) ftry="$previous $flag";;
5561                 esac
5562                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5563                         >cpp1.out 2>/dev/null && \
5564                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5565                         >cpp2.out 2>/dev/null && \
5566                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5567                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5568                 then
5569                         cppflags="$cppflags $ftry"
5570                         previous=''
5571                 else
5572                         previous="$flag"
5573                 fi
5574         done
5575         set X $cppflags
5576         shift
5577         cppflags=${1+"$@"}
5578         case "$cppflags" in
5579         *-*)  echo "They appear to be: $cppflags";;
5580         esac
5581         $rm -f cpp.c cpp?.out
5582         ;;
5583 esac
5584
5585 : flags used in final linking phase
5586 case "$ldflags" in
5587 '') if ./venix; then
5588                 dflt='-i -z'
5589         else
5590                 dflt=''
5591         fi
5592         case "$ccflags" in
5593         *-posix*) dflt="$dflt -posix" ;;
5594         esac
5595         ;;
5596 *) dflt="$ldflags";;
5597 esac
5598 # See note above about -fstack-protector
5599 case "$ccflags" in
5600 *-fstack-protector-strong*)
5601         case "$dflt" in
5602         *-fstack-protector-strong*) ;; # Don't add it again
5603         *) dflt="$dflt -fstack-protector-strong" ;;
5604         esac
5605         ;;
5606 *-fstack-protector*)
5607         case "$dflt" in
5608         *-fstack-protector*) ;; # Don't add it again
5609         *) dflt="$dflt -fstack-protector" ;;
5610         esac
5611         ;;
5612 esac
5613
5614 : Try to guess additional flags to pick up local libraries.
5615 for thislibdir in $libpth; do
5616         case " $loclibpth " in
5617         *" $thislibdir "*)
5618                 case "$dflt " in
5619                 *"-L$thislibdir "*) ;;
5620                 *)  dflt="$dflt -L$thislibdir" ;;
5621                 esac
5622                 ;;
5623         esac
5624 done
5625
5626 case "$dflt" in
5627 '') dflt='none' ;;
5628 esac
5629
5630 $cat <<EOH
5631
5632 Your C linker may need flags.  For this question you should
5633 include -L/whatever and any other flags used by the C linker, but you
5634 should NOT include libraries like -lwhatever.
5635
5636 Make sure you include the appropriate -L/path flags if your C linker
5637 does not normally search all of the directories you specified above,
5638 namely
5639         $libpth
5640 To use no flags, specify the word "none".
5641
5642 EOH
5643
5644 rp="Any additional ld flags (NOT including libraries)?"
5645 . ./myread
5646 case "$ans" in
5647 none) ldflags='';;
5648 *) ldflags="$ans";;
5649 esac
5650 rmlist="$rmlist pdp11"
5651
5652 : coherency check
5653 echo " "
5654 echo "Checking your choice of C compiler and flags for coherency..." >&4
5655 $cat > try.c <<'EOF'
5656 #include <stdio.h>
5657 int main() { printf("Ok\n"); return(0); }
5658 EOF
5659 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5660 shift
5661 $cat >try.msg <<'EOM'
5662 I've tried to compile and run the following simple program:
5663
5664 EOM
5665 $cat try.c >> try.msg
5666
5667 $cat >> try.msg <<EOM
5668
5669 I used the command:
5670
5671         $*
5672         $run ./try
5673
5674 and I got the following output:
5675
5676 EOM
5677 dflt=y
5678 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5679         if $sh -c "$run ./try " >>try.msg 2>&1; then
5680                 xxx=`$run ./try`
5681                 case "$xxx" in
5682                 "Ok") dflt=n ;;
5683                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5684                 esac
5685         else
5686                 echo "The program compiled OK, but exited with status $?." >>try.msg
5687                 rp="You have a problem.  Shall I abort Configure"
5688                 dflt=y
5689         fi
5690 else
5691         echo "I can't compile the test program." >>try.msg
5692         rp="You have a BIG problem.  Shall I abort Configure"
5693         dflt=y
5694 fi
5695 case "$dflt" in
5696 y)
5697         $cat try.msg >&4
5698         case "$knowitall" in
5699         '')
5700                 echo "(The supplied flags or libraries might be incorrect.)"
5701                 ;;
5702         *) dflt=n;;
5703         esac
5704         echo " "
5705         . ./myread
5706         case "$ans" in
5707         n*|N*) ;;
5708         *)      echo "Ok.  Stopping Configure." >&4
5709                 exit 1
5710                 ;;
5711         esac
5712         ;;
5713 n) echo "OK, that should do.";;
5714 esac
5715 $rm_try gcctest gcctest.out
5716
5717 : define a shorthand compile call
5718 compile='
5719 mc_file=$1;
5720 shift;
5721 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5722 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5723 exit 1;
5724 fi;
5725 esac;
5726 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5727 : define a shorthand compile call for compilations that should be ok.
5728 compile_ok='
5729 mc_file=$1;
5730 shift;
5731 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5732
5733 : determine filename position in cpp output
5734 echo " "
5735 echo "Computing filename position in cpp output for #include directives..." >&4
5736 case "$osname" in
5737 vos) testaccess=-e ;;
5738 *)   testaccess=-r ;;
5739 esac
5740 echo '#include <stdio.h>' > foo.c
5741 $cat >fieldn <<EOF
5742 $startsh
5743 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5744 $grep '^[       ]*#.*stdio\.h' | \
5745 while read cline; do
5746         pos=1
5747         set \$cline
5748         while $test \$# -gt 0; do
5749                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5750                         echo "\$pos"
5751                         exit 0
5752                 fi
5753                 shift
5754                 pos=\`expr \$pos + 1\`
5755         done
5756 done
5757 EOF
5758 chmod +x fieldn
5759 fieldn=`./fieldn`
5760 $rm -f foo.c fieldn
5761 case $fieldn in
5762 '') pos='???';;
5763 1) pos=first;;
5764 2) pos=second;;
5765 3) pos=third;;
5766 *) pos="${fieldn}th";;
5767 esac
5768 echo "Your cpp writes the filename in the $pos field of the line."
5769
5770 : locate header file
5771 $cat >findhdr <<EOF
5772 $startsh
5773 wanted=\$1
5774 name=''
5775 for usrincdir in $incpth
5776 do
5777         if test -f \$usrincdir/\$wanted; then
5778                 echo "\$usrincdir/\$wanted"
5779                 exit 0
5780         fi
5781 done
5782 awkprg='{ print \$$fieldn }'
5783 echo "#include <\$wanted>" > foo\$\$.c
5784 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5785 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5786 while read cline; do
5787         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5788         case "\$name" in
5789         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5790         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5791         *) exit 2;;
5792         esac;
5793 done;
5794 #
5795 # status = 0: grep returned 0 lines, case statement not executed
5796 # status = 1: headerfile found
5797 # status = 2: while loop executed, no headerfile found
5798 #
5799 status=\$?
5800 $rm -f foo\$\$.c;
5801 if test \$status -eq 1; then
5802         exit 0;
5803 fi
5804 exit 1
5805 EOF
5806 chmod +x findhdr
5807
5808 : define an alternate in-header-list? function
5809 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5810 cont=true; xxf="echo \"<\$1> found.\" >&4";
5811 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5812 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5813 esac;
5814 case $# in 4) instead=instead;; *) instead="at last";; esac;
5815 while $test "$cont"; do
5816         xxx=`./findhdr $1`
5817         var=$2; eval "was=\$$2";
5818         if $test "$xxx" && $test -r "$xxx";
5819         then eval $xxf;
5820         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5821                 cont="";
5822         else eval $xxnf;
5823         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5824         set $yyy; shift; shift; yyy=$@;
5825         case $# in 0) cont="";;
5826         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5827                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5828         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5829                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5830         esac;
5831 done;
5832 while $test "$yyy";
5833 do set $yyy; var=$2; eval "was=\$$2";
5834         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5835         set $yyy; shift; shift; yyy=$@;
5836 done'
5837
5838 : see if stdlib is available
5839 set stdlib.h i_stdlib
5840 eval $inhdr
5841
5842 : check for lengths of integral types
5843 echo " "
5844 case "$intsize" in
5845 '')
5846         echo "Checking to see how big your integers are..." >&4
5847         $cat >try.c <<EOCP
5848 #include <stdio.h>
5849 #$i_stdlib I_STDLIB
5850 #ifdef I_STDLIB
5851 #include <stdlib.h>
5852 #endif
5853 int main()
5854 {
5855         printf("intsize=%d;\n", (int)sizeof(int));
5856         printf("longsize=%d;\n", (int)sizeof(long));
5857         printf("shortsize=%d;\n", (int)sizeof(short));
5858         exit(0);
5859 }
5860 EOCP
5861         set try
5862         if eval $compile_ok && $run ./try > /dev/null; then
5863                 eval `$run ./try`
5864                 echo "Your integers are $intsize bytes long."
5865                 echo "Your long integers are $longsize bytes long."
5866                 echo "Your short integers are $shortsize bytes long."
5867         else
5868                 $cat >&4 <<EOM
5869 !
5870 Help! I can't compile and run the intsize test program: please enlighten me!
5871 (This is probably a misconfiguration in your system or libraries, and
5872 you really ought to fix it.  Still, I'll try anyway.)
5873 !
5874 EOM
5875                 dflt=4
5876                 rp="What is the size of an integer (in bytes)?"
5877                 . ./myread
5878                 intsize="$ans"
5879                 dflt=$intsize
5880                 rp="What is the size of a long integer (in bytes)?"
5881                 . ./myread
5882                 longsize="$ans"
5883                 dflt=2
5884                 rp="What is the size of a short integer (in bytes)?"
5885                 . ./myread
5886                 shortsize="$ans"
5887         fi
5888         ;;
5889 esac
5890 $rm_try
5891
5892 : check for long long
5893 echo " "
5894 echo "Checking to see if you have long long..." >&4
5895 echo 'int main() { long long x = 7; return 0; }' > try.c
5896 set try
5897 if eval $compile; then
5898         val="$define"
5899         echo "You have long long."
5900 else
5901         val="$undef"
5902         echo "You do not have long long."
5903 fi
5904 $rm_try
5905 set d_longlong
5906 eval $setvar
5907
5908 : check for length of long long
5909 case "${d_longlong}${longlongsize}" in
5910 $define)
5911         echo " "
5912         echo "Checking to see how big your long longs are..." >&4
5913         $cat >try.c <<'EOCP'
5914 #include <stdio.h>
5915 int main()
5916 {
5917     printf("%d\n", (int)sizeof(long long));
5918     return(0);
5919 }
5920 EOCP
5921         set try
5922         if eval $compile_ok; then
5923                 longlongsize=`$run ./try`
5924                 echo "Your long longs are $longlongsize bytes long."
5925         else
5926                 dflt='8'
5927                 echo " "
5928                 echo "(I can't seem to compile the test program.  Guessing...)"
5929                 rp="What is the size of a long long (in bytes)?"
5930                 . ./myread
5931                 longlongsize="$ans"
5932         fi
5933         if $test "X$longsize" = "X$longlongsize"; then
5934                 echo "(That isn't any different from an ordinary long.)"
5935         fi
5936         ;;
5937 esac
5938 $rm_try
5939
5940 : see if inttypes.h is available
5941 : we want a real compile instead of Inhdr because some systems
5942 : have an inttypes.h which includes non-existent headers
5943 echo " "
5944 $cat >try.c <<EOCP
5945 #include <inttypes.h>
5946 int main() {
5947         static int32_t foo32 = 0x12345678;
5948 }
5949 EOCP
5950 set try
5951 if eval $compile; then
5952         echo "<inttypes.h> found." >&4
5953         val="$define"
5954 else
5955         echo "<inttypes.h> NOT found." >&4
5956         val="$undef"
5957 fi
5958 $rm_try
5959 set i_inttypes
5960 eval $setvar
5961
5962 : check for int64_t
5963 echo " "
5964 echo "Checking to see if you have int64_t..." >&4
5965 $cat >try.c <<EOCP
5966 #include <sys/types.h>
5967 #$i_inttypes I_INTTYPES
5968 #ifdef I_INTTYPES
5969 #include <inttypes.h>
5970 #endif
5971 int main() { int64_t x = 7; }
5972 EOCP
5973 set try
5974 if eval $compile; then
5975         val="$define"
5976         echo "You have int64_t."
5977 else
5978         val="$undef"
5979         echo "You do not have int64_t."
5980 fi
5981 $rm_try
5982 set d_int64_t
5983 eval $setvar
5984
5985 : Check if 64bit ints have a quad type
5986 echo " "
5987 echo "Checking which 64-bit integer type we could use..." >&4
5988
5989 case "$intsize" in
5990 8) val=int
5991    set quadtype
5992    eval $setvar
5993    val='"unsigned int"'
5994    set uquadtype
5995    eval $setvar
5996    quadkind=1
5997    ;;
5998 *) case "$longsize" in
5999    8) val=long
6000       set quadtype
6001       eval $setvar
6002       val='"unsigned long"'
6003       set uquadtype
6004       eval $setvar
6005       quadkind=2
6006       ;;
6007    *) case "$d_longlong:$longlongsize" in
6008       define:8)
6009         val='"long long"'
6010         set quadtype
6011         eval $setvar
6012         val='"unsigned long long"'
6013         set uquadtype
6014         eval $setvar
6015         quadkind=3
6016         ;;
6017       *) case "$d_int64_t" in
6018          define)
6019            val=int64_t
6020            set quadtype
6021            eval $setvar
6022            val=uint64_t
6023            set uquadtype
6024            eval $setvar
6025            quadkind=4
6026            ;;
6027          esac
6028          ;;
6029       esac
6030       ;;
6031    esac
6032    ;;
6033 esac
6034
6035 case "$quadtype" in
6036 '')     echo "Alas, no 64-bit integer types in sight." >&4
6037         d_quad="$undef"
6038         ;;
6039 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6040         d_quad="$define"
6041         ;;
6042 esac
6043
6044 : Do we want 64bit support
6045 case "$uselonglong" in
6046 "$define"|true|[yY]*)
6047         cat <<EOM >&4
6048
6049 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6050 EOM
6051         use64bitint="$define"
6052         ;;
6053 esac
6054 case "$use64bits" in
6055 "$define"|true|[yY]*)
6056         cat <<EOM >&4
6057
6058 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6059 EOM
6060         use64bitint="$define"
6061         ;;
6062 esac
6063 case "$use64bitints" in
6064 "$define"|true|[yY]*)
6065         cat <<EOM >&4
6066
6067 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6068 EOM
6069         use64bitint="$define"
6070         ;;
6071 esac
6072 case "$use64bitsint" in
6073 "$define"|true|[yY]*)
6074         cat <<EOM >&4
6075
6076 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6077 EOM
6078         use64bitint="$define"
6079         ;;
6080 esac
6081 case "$uselonglongs" in
6082 "$define"|true|[yY]*)
6083         cat <<EOM >&4
6084
6085 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6086 EOM
6087         use64bitint="$define"
6088         ;;
6089 esac
6090 case "$use64bitsall" in
6091 "$define"|true|[yY]*)
6092         cat <<EOM >&4
6093
6094 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6095 EOM
6096         use64bitall="$define"
6097         ;;
6098 esac
6099
6100 case "$ccflags" in
6101 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6102 esac
6103 case "$use64bitall" in
6104 "$define"|true|[yY]*) use64bitint="$define" ;;
6105 esac
6106
6107 case "$longsize" in
6108 8) cat <<EOM
6109
6110 You have natively 64-bit long integers.
6111 EOM
6112    val="$define"
6113    ;;
6114 *) case "$use64bitint" in
6115    "$define"|true|[yY]*) dflt='y';;
6116    *) dflt='n';;
6117    esac
6118    case "$d_quad" in
6119    "$define") ;;
6120    *) dflt='n' ;;
6121    esac
6122    cat <<EOM
6123
6124 Perl can be built to take advantage of 64-bit integer types
6125 on some systems.  To do so, Configure can be run with -Duse64bitint.
6126 Choosing this option will most probably introduce binary incompatibilities.
6127
6128 If this doesn't make any sense to you, just accept the default '$dflt'.
6129 (The default has been chosen based on your configuration.)
6130 EOM
6131    rp='Try to use 64-bit integers, if available?'
6132    . ./myread
6133    case "$ans" in
6134    [yY]*) val="$define" ;;
6135    *)     val="$undef"  ;;
6136    esac
6137    ;;
6138 esac
6139 set use64bitint
6140 eval $setvar
6141
6142 case "$use64bitall" in
6143 "$define"|true|[yY]*) dflt='y' ;;
6144 *) case "$longsize" in
6145    8) dflt='y' ;;
6146    *) dflt='n' ;;
6147    esac
6148    ;;
6149 esac
6150 cat <<EOM
6151
6152 You may also choose to try maximal 64-bitness.  It means using as much
6153 64-bitness as possible on the platform.  This in turn means even more
6154 binary incompatibilities.  On the other hand, your platform may not
6155 have any more 64-bitness available than what you already have chosen.
6156
6157 If this doesn't make any sense to you, just accept the default '$dflt'.
6158 (The default has been chosen based on your configuration.)
6159 EOM
6160 rp='Try to use maximal 64-bit support, if available?'
6161 . ./myread
6162 case "$ans" in
6163 [yY]*) val="$define" ;;
6164 *)     val="$undef"  ;;
6165 esac
6166 set use64bitall
6167 eval $setvar
6168 case "$use64bitall" in
6169 "$define")
6170         case "$use64bitint" in
6171         "$undef")
6172                 cat <<EOM
6173
6174 Since you have chosen a maximally 64-bit build, I'm also turning on
6175 the use of 64-bit integers.
6176 EOM
6177                 use64bitint="$define" ;;
6178         esac
6179         ;;
6180 esac
6181
6182 : Look for a hint-file generated 'call-back-unit'.  If the
6183 : user has specified that a 64-bit perl is to be built,
6184 : we may need to set or change some other defaults.
6185 if $test -f use64bitint.cbu; then
6186         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6187         . ./use64bitint.cbu
6188 fi
6189 case "$use64bitint" in
6190 "$define"|true|[yY]*)
6191         : This test was common to all the OpenBSD forks, and seems harmless for
6192         : other platforms:
6193         echo " "
6194         echo "Checking if your C library has broken 64-bit functions..." >&4
6195         cat >try.c <<EOCP
6196 #include <stdio.h>
6197 typedef $uquadtype myULL;
6198 int main (void)
6199 {
6200     struct {
6201         double d;
6202         myULL  u;
6203     } *p, test[] = {
6204         {4294967303.15, 4294967303ULL},
6205         {4294967294.2,  4294967294ULL},
6206         {4294967295.7,  4294967295ULL},
6207         {0.0, 0ULL}
6208     };
6209     for (p = test; p->u; p++) {
6210         myULL x = (myULL)p->d;
6211         if (x != p->u) {
6212             printf("buggy\n");
6213             return 0;
6214         }
6215     }
6216     printf("ok\n");
6217     return 0;
6218 }
6219 EOCP
6220         set try
6221         if eval $compile_ok; then
6222             libcquad=`$run ./try`
6223             echo "Your C library's 64-bit functions are $libcquad."
6224         else
6225             echo "(I can't seem to compile the test program.)"
6226             echo "Assuming that your C library's 64-bit functions are ok."
6227             libcquad="ok"
6228         fi
6229         $rm_try
6230
6231         case "$libcquad" in
6232             buggy*)
6233                 cat >&4 <<EOM
6234
6235 *** You have a C library with broken 64-bit functions.
6236 *** 64-bit support does not work reliably in this configuration.
6237 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6238 *** Cannot continue, aborting.
6239
6240 EOM
6241                 exit 1
6242                 ;;
6243         esac
6244         case "$longsize" in
6245         4) case "$archname64" in
6246            '') archname64=64int ;;
6247            esac
6248            ;;
6249         esac
6250         ;;
6251 esac
6252
6253 : Look for a hint-file generated 'call-back-unit'.  If the
6254 : user has specified that a maximally 64-bit perl is to be built,
6255 : we may need to set or change some other defaults.
6256 if $test -f use64bitall.cbu; then
6257         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6258         . ./use64bitall.cbu
6259 fi
6260 case "$use64bitall" in
6261 "$define"|true|[yY]*)
6262         case "$longsize" in
6263         4) case "$archname64" in
6264            ''|64int) archname64=64all ;;
6265            esac
6266            ;;
6267         esac
6268         ;;
6269 esac
6270
6271 case "$d_quad:$use64bitint" in
6272 $undef:$define)
6273         cat >&4 <<EOF
6274
6275 *** You have chosen to use 64-bit integers,
6276 *** but none can be found.
6277 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6278 *** Cannot continue, aborting.
6279
6280 EOF
6281         exit 1
6282         ;;
6283 esac
6284
6285 : Check if we are using the GNU C library
6286 echo " "
6287 echo "Checking for GNU C Library..." >&4
6288 cat >try.c <<'EOCP'
6289 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6290    alone are insufficient to distinguish different versions, such as
6291    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6292    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6293 */
6294 #include <stdio.h>
6295 int main(void)
6296 {
6297 #ifdef __GLIBC__
6298 #   ifdef __GLIBC_MINOR__
6299 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6300 #           include <gnu/libc-version.h>
6301             printf("%s\n",  gnu_get_libc_version());
6302 #       else
6303             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6304 #       endif
6305 #   else
6306         printf("%d\n",  __GLIBC__);
6307 #   endif
6308     return 0;
6309 #else
6310     return 1;
6311 #endif
6312 }
6313 EOCP
6314 set try
6315 if eval $compile_ok && $run ./try > glibc.ver; then
6316         val="$define"
6317         gnulibc_version=`$cat glibc.ver`
6318         echo "You are using the GNU C Library version $gnulibc_version"
6319 else
6320         val="$undef"
6321         gnulibc_version=''
6322         echo "You are not using the GNU C Library"
6323 fi
6324 $rm_try glibc.ver
6325 set d_gnulibc
6326 eval $setvar
6327
6328 : see if nm is to be used to determine whether a symbol is defined or not
6329 case "$usenm" in
6330 '')
6331         dflt=''
6332         case "$d_gnulibc" in
6333         "$define")
6334                 echo " "
6335                 echo "nm probably won't work on the GNU C Library." >&4
6336                 dflt=n
6337                 ;;
6338         esac
6339         case "$dflt" in
6340         '')
6341                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6342                         echo " "
6343                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6344                         echo "'nm' won't be sufficient on this system." >&4
6345                         dflt=n
6346                 fi
6347                 ;;
6348         esac
6349         case "$dflt" in
6350         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6351                 if $test $dflt -gt 20; then
6352                         dflt=y
6353                 else
6354                         dflt=n
6355                 fi
6356                 ;;
6357         esac
6358         ;;
6359 *)
6360         case "$usenm" in
6361         true|$define) dflt=y;;
6362         *) dflt=n;;
6363         esac
6364         ;;
6365 esac
6366 $cat <<EOM
6367
6368 I can use $nm to extract the symbols from your C libraries. This
6369 is a time consuming task which may generate huge output on the disk (up
6370 to 3 megabytes) but that should make the symbols extraction faster. The
6371 alternative is to skip the 'nm' extraction part and to compile a small
6372 test program instead to determine whether each symbol is present. If
6373 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6374 this may be the best solution.
6375
6376 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6377
6378 EOM
6379 rp="Shall I use $nm to extract C symbols from the libraries?"
6380 . ./myread
6381 case "$ans" in
6382 [Nn]*) usenm=false;;
6383 *) usenm=true;;
6384 esac
6385
6386 runnm=$usenm
6387 case "$reuseval" in
6388 true) runnm=false;;
6389 esac
6390
6391 : nm options which may be necessary
6392 case "$nm_opt" in
6393 '') if $test -f /mach_boot; then
6394                 nm_opt=''       # Mach
6395         elif $test -d /usr/ccs/lib; then
6396                 nm_opt='-p'     # Solaris (and SunOS?)
6397         elif $test -f /dgux; then
6398                 nm_opt='-p'     # DG-UX
6399         elif $test -f /lib64/rld; then
6400                 nm_opt='-p'     # 64-bit Irix
6401         else
6402                 nm_opt=''
6403         fi;;
6404 esac
6405
6406 : nm options which may be necessary for shared libraries but illegal
6407 : for archive libraries.  Thank you, Linux.
6408 case "$nm_so_opt" in
6409 '')     case "$myuname" in
6410         *linux*|gnu*)
6411                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6412                         nm_so_opt='--dynamic'
6413                 fi
6414                 ;;
6415         esac
6416         ;;
6417 esac
6418
6419 : Figure out where the libc is located
6420 case "$runnm" in
6421 true)
6422 : get list of predefined functions in a handy place
6423 echo " "
6424 case "$libc" in
6425 '') libc=unknown
6426         case "$libs" in
6427         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6428         esac
6429         ;;
6430 esac
6431 case "$libs" in
6432 '') ;;
6433 *)  for thislib in $libs; do
6434         case "$thislib" in
6435         -lc|-lc_s)
6436                 : Handle C library specially below.
6437                 ;;
6438         -l*)
6439                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6440                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6441                         :
6442                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6443                         :
6444                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6445                         :
6446                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6447                         :
6448                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6449                         :
6450                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6451                         :
6452                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6453                         :
6454                 else
6455                         try=''
6456                 fi
6457                 libnames="$libnames $try"
6458                 ;;
6459         *) libnames="$libnames $thislib" ;;
6460         esac
6461         done
6462         ;;
6463 esac
6464 xxx=normal
6465 case "$libc" in
6466 unknown)
6467         set /lib/libc.$so
6468         for xxx in $libpth; do
6469                 $test -r $1 || set $xxx/libc.$so
6470                 : The messy sed command sorts on library version numbers.
6471                 $test -r $1 || \
6472                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6473                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6474                                 h
6475                                 s/[0-9][0-9]*/0000&/g
6476                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6477                                 G
6478                                 s/\n/ /' | \
6479                          $sort | $sed -e 's/^.* //'`
6480                 eval set \$$#
6481         done
6482         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6483         $test -r $1 || set $sysroot/lib/libsys_s$_a
6484         ;;
6485 *)
6486         set blurfl
6487         ;;
6488 esac
6489 if $test -r "$1"; then
6490         echo "Your (shared) C library seems to be in $1."
6491         libc="$1"
6492 elif $test -r /lib/libc && $test -r /lib/clib; then
6493         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6494         xxx=apollo
6495         libc='/lib/clib /lib/libc'
6496         if $test -r /lib/syslib; then
6497                 echo "(Your math library is in /lib/syslib.)"
6498                 libc="$libc /lib/syslib"
6499         fi
6500 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6501         echo "Your C library seems to be in $libc, as you said before."
6502 elif $test -r $incpath/usr/lib/libc$_a; then
6503         libc=$incpath/usr/lib/libc$_a;
6504         echo "Your C library seems to be in $libc.  That's fine."
6505 elif $test -r /lib/libc$_a; then
6506         libc=/lib/libc$_a;
6507         echo "Your C library seems to be in $libc.  You're normal."
6508 else
6509         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6510                 :
6511         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6512                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6513         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6514                 :
6515         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6516                 :
6517         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6518                 :
6519         else
6520                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6521         fi
6522         if $test -r "$tans"; then
6523                 echo "Your C library seems to be in $tans, of all places."
6524                 libc=$tans
6525         else
6526                 libc='blurfl'
6527         fi
6528 fi
6529 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6530         dflt="$libc"
6531         cat <<EOM
6532
6533 If the guess above is wrong (which it might be if you're using a strange
6534 compiler, or your machine supports multiple models), you can override it here.
6535
6536 EOM
6537 else
6538         dflt=''
6539         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6540         cat >&4 <<EOM
6541 I can't seem to find your C library.  I've looked in the following places:
6542
6543 EOM
6544         $sed 's/^/      /' libpath
6545         cat <<EOM
6546
6547 None of these seems to contain your C library. I need to get its name...
6548
6549 EOM
6550 fi
6551 fn=f
6552 rp='Where is your C library?'
6553 . ./getfile
6554 libc="$ans"
6555
6556 echo " "
6557 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6558 set X `cat libnames`
6559 shift
6560 xxx=files
6561 case $# in 1) xxx=file; esac
6562 echo "Extracting names from the following $xxx for later perusal:" >&4
6563 echo " "
6564 $sed 's/^/      /' libnames >&4
6565 echo " "
6566 $echo $n "This may take a while...$c" >&4
6567
6568 for file in $*; do
6569         case $file in
6570         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6571         *) $nm $nm_opt $file 2>/dev/null;;
6572         esac
6573 done >libc.tmp
6574
6575 $echo $n ".$c"
6576 $grep fprintf libc.tmp > libc.ptf
6577 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6578 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6579 xxx='[ADTSIWi]'
6580 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6581         eval $xscan;\
6582         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6583                 eval $xrun
6584 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6585         eval $xscan;\
6586         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6587                 eval $xrun
6588 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6589         eval $xscan;\
6590         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6591                 eval $xrun
6592 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //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.*text.*/\1/p'";\
6597         eval $xscan;\
6598         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6599                 eval $xrun
6600 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6601         eval $xscan;\
6602         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6603                 eval $xrun
6604 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6605                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6606         eval $xscan;\
6607         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6608                 eval $xrun
6609 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6610         eval $xscan;\
6611         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6612                 eval $xrun
6613 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6614         eval $xscan;\
6615         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6616                 eval $xrun
6617 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6618         eval $xscan;\
6619         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6620                 eval $xrun
6621 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6622         eval $xscan;\
6623         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6624                 eval $xrun
6625 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6626         eval $xscan;\
6627         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6628                 eval $xrun
6629 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6630         eval $xscan;\
6631         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6632                 eval $xrun
6633 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6634         eval $xscan;\
6635         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6636                 eval $xrun
6637 else
6638         $nm -p $* 2>/dev/null >libc.tmp
6639         $grep fprintf libc.tmp > libc.ptf
6640         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6641                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6642         then
6643                 nm_opt='-p'
6644                 eval $xrun
6645         else
6646                 echo " "
6647                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6648                 com=''
6649                 if $ar t $libc > libc.tmp && \
6650                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6651                 then
6652                         for thisname in $libnames $libc; do
6653                                 $ar t $thisname >>libc.tmp
6654                         done
6655                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6656                         echo "Ok." >&4
6657                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6658                         for thisname in $libnames $libc; do
6659                                 $ar tv $thisname >>libc.tmp
6660                                 emximp -o tmp.imp $thisname \
6661                                     2>/dev/null && \
6662                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6663                                     < tmp.imp >>libc.tmp
6664                                 $rm -f tmp.imp
6665                         done
6666                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6667                         echo "Ok." >&4
6668                 else
6669                         echo "$ar didn't seem to work right." >&4
6670                         echo "Maybe this is a Cray...trying bld instead..." >&4
6671                         if  bld t $libc | \
6672                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6673                                 $test -s libc.list
6674                         then
6675                                 for thisname in $libnames; do
6676                                         bld t $libnames | \
6677                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6678                                         $ar t $thisname >>libc.tmp
6679                                 done
6680                                 echo "Ok." >&4
6681                         else
6682                                 echo "That didn't work either.  Giving up." >&4
6683                                 exit 1
6684                         fi
6685                 fi
6686         fi
6687 fi
6688 nm_extract="$com"
6689 case "$PASE" in
6690 define)
6691     echo " "
6692     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6693     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6694     ;;
6695 *)  if $test -f /lib/syscalls.exp; then
6696         echo " "
6697         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6698         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6699                 /lib/syscalls.exp >>libc.list
6700     fi
6701     ;;
6702 esac
6703 ;;
6704 esac
6705 $rm -f libnames libpath
6706
6707 : Check if we are using C++
6708 echo " "
6709 echo "Checking for C++..." >&4
6710 $cat >try.c <<'EOCP'
6711 #include <stdio.h>
6712 int main(void)
6713 {
6714 #ifdef __cplusplus
6715     return 0;
6716 #else
6717     return 1;
6718 #endif
6719 }
6720 EOCP
6721 set try
6722 if eval $compile_ok && $run ./try; then
6723         val="$define"
6724         echo "You are using a C++ compiler."
6725 else
6726         val="$undef"
6727         echo "You are not using a C++ compiler."
6728 fi
6729 $rm_try cplusplus$$
6730 set d_cplusplus
6731 eval $setvar
6732
6733 : is a C symbol defined?
6734 csym='tlook=$1;
6735 case "$3" in
6736 -v) tf=libc.tmp; tdc="";;
6737 -a) tf=libc.tmp; tdc="[]";;
6738 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6739 esac;
6740 case "$d_cplusplus" in
6741     $define)    extern_C="extern \"C\"" ;;
6742     *)          extern_C="extern"       ;;
6743 esac;
6744 tx=yes;
6745 case "$reuseval-$4" in
6746 true-) ;;
6747 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6748 esac;
6749 case "$tx" in
6750 yes)
6751         tval=false;
6752         if $test "$runnm" = true; then
6753                 if $contains $tlook $tf >/dev/null 2>&1; then
6754                         tval=true;
6755                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6756                         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;
6757                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6758                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6759                         $rm_try;
6760                 fi;
6761         else
6762                 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;
6763                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6764                 $rm_try;
6765         fi;
6766         ;;
6767 *)
6768         case "$tval" in
6769         $define) tval=true;;
6770         *) tval=false;;
6771         esac;
6772         ;;
6773 esac;
6774 eval "$2=$tval"'
6775
6776 : define an is-in-libc? function
6777 inlibc='echo " "; td=$define; tu=$undef;
6778 sym=$1; var=$2; eval "was=\$$2";
6779 tx=yes;
6780 case "$reuseval$was" in
6781 true) ;;
6782 true*) tx=no;;
6783 esac;
6784 case "$tx" in
6785 yes)
6786         set $sym tres -f;
6787         eval $csym;
6788         case "$tres" in
6789         true)
6790                 echo "$sym() found." >&4;
6791                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6792         *)
6793                 echo "$sym() NOT found." >&4;
6794                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6795         esac;;
6796 *)
6797         case "$was" in
6798         $define) echo "$sym() found." >&4;;
6799         *) echo "$sym() NOT found." >&4;;
6800         esac;;
6801 esac'
6802
6803 : check for length of double
6804 echo " "
6805 case "$doublesize" in
6806 '')
6807         echo "Checking to see how big your double precision numbers are..." >&4
6808         $cat >try.c <<EOCP
6809 #include <stdio.h>
6810 #$i_stdlib I_STDLIB
6811 #ifdef I_STDLIB
6812 #include <stdlib.h>
6813 #endif
6814 int main()
6815 {
6816     printf("%d\n", (int)sizeof(double));
6817     exit(0);
6818 }
6819 EOCP
6820         set try
6821         if eval $compile_ok; then
6822                 doublesize=`$run ./try`
6823                 echo "Your double is $doublesize bytes long."
6824         else
6825                 dflt='8'
6826                 echo "(I can't seem to compile the test program.  Guessing...)"
6827                 rp="What is the size of a double precision number (in bytes)?"
6828                 . ./myread
6829                 doublesize="$ans"
6830         fi
6831         ;;
6832 esac
6833 $rm_try
6834
6835 : see if this is a float.h system
6836 set float.h i_float
6837 eval $inhdr
6838
6839 : check for long doubles
6840 echo " "
6841 echo "Checking to see if you have long double..." >&4
6842 echo 'int main() { long double x = 7.0; }' > try.c
6843 set try
6844 if eval $compile; then
6845         val="$define"
6846         echo "You have long double."
6847 else
6848         val="$undef"
6849         echo "You do not have long double."
6850 fi
6851 $rm_try
6852 set d_longdbl
6853 eval $setvar
6854
6855 : see if ldexpl exists
6856 set ldexpl d_ldexpl
6857 eval $inlibc
6858
6859 : check for length of long double
6860 case "${d_longdbl}${longdblsize}" in
6861 $define)
6862         echo " "
6863         echo "Checking to see how big your long doubles are..." >&4
6864         $cat >try.c <<'EOCP'
6865 #include <stdio.h>
6866 int main()
6867 {
6868         printf("%d\n", sizeof(long double));
6869 }
6870 EOCP
6871         set try
6872         set try
6873         if eval $compile; then
6874                 longdblsize=`$run ./try`
6875                 echo "Your long doubles are $longdblsize bytes long."
6876         else
6877                 dflt='8'
6878                 echo " "
6879                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6880                 rp="What is the size of a long double (in bytes)?"
6881                 . ./myread
6882                 longdblsize="$ans"
6883         fi
6884         if $test "X$doublesize" = "X$longdblsize"; then
6885                 echo "That isn't any different from an ordinary double."
6886                 echo "I'll keep your setting anyway, but you may see some"
6887                 echo "harmless compilation warnings."
6888         fi
6889         ;;
6890 esac
6891 $rm_try
6892
6893 $echo "Checking the kind of long doubles you have..." >&4
6894 case "$d_longdbl" in
6895 define)
6896 $cat <<EOP >try.c
6897 #$i_float I_FLOAT
6898 #$i_stdlib I_STDLIB
6899 #define LONGDBLSIZE $longdblsize
6900 #define DOUBLESIZE $doublesize
6901 #ifdef I_FLOAT
6902 #include <float.h>
6903 #endif
6904 #ifdef I_STDLIB
6905 #include <stdlib.h>
6906 #endif
6907 #include <stdio.h>
6908 static const long double d = -0.1L;
6909 int main() {
6910   unsigned const char* b = (unsigned const char*)(&d);
6911 #if DOUBLESIZE == LONGDBLSIZE
6912   printf("0\n"); /* if it floats like double */
6913   exit(0);
6914 #endif
6915 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6916   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6917     /* IEEE 754 128-bit little-endian */
6918     printf("1\n");
6919     exit(0);
6920   }
6921   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6922     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6923     printf("2\n");
6924     exit(0);
6925   }
6926 #endif
6927 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6928  * while 64-bits platforms have it in 16 bytes. */
6929 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6930   if (b[0] == 0xCD && b[9] == 0xBF && b[10] == 0x00) {
6931     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6932      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6933      * Also known as "extended precision". */
6934     printf("3\n");
6935     exit(0);
6936   }
6937   if (b[0] == 0xBF && b[9] == 0xCD && b[10] == 0x00) {
6938     /* is there ever big-endian 80-bit, really? */
6939     printf("4\n");
6940     exit(0);
6941   }
6942 #endif
6943 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
6944   /* software "double double", the 106 is 53+53.
6945    * but irix thinks it is 107. */
6946   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
6947     /* double double 128-bit little-endian,
6948      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
6949     printf("5\n");
6950     exit(0);
6951   }
6952   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
6953     /* double double 128-bit big-endian, e.g. PPC/Power and MIPS:
6954      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
6955     printf("6\n");
6956     exit(0);
6957   }
6958 #endif
6959   printf("-1\n"); /* unknown */
6960   exit(0);
6961 }
6962 EOP
6963 set try
6964 if eval $compile; then
6965     longdblkind=`$run ./try`
6966 else
6967     longdblkind=-1
6968 fi
6969 ;;
6970 *) longdblkind=0 ;;
6971 esac
6972 case "$longdblkind" in
6973 0) echo "Your long doubles are doubles." >&4 ;;
6974 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
6975 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
6976 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
6977 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
6978 5) echo "You have 128-bit little-endian double-double long doubles." >& 4 ;;
6979 6) echo "You have 128-bit big-endian double-double long doubles." >& 4 ;;
6980 *) echo "Cannot figure out your long double." >&4 ;;
6981 esac
6982 $rm_try
6983
6984 : determine the architecture name
6985 echo " "
6986 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6987         tarch=`arch`"-$osname"
6988 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6989         if uname -m > tmparch 2>&1 ; then
6990                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6991                         -e 's/$/'"-$osname/" tmparch`
6992         else
6993                 tarch="$osname"
6994         fi
6995         $rm -f tmparch
6996 else
6997         tarch="$osname"
6998 fi
6999 case "$myarchname" in
7000 ''|"$tarch") ;;
7001 *)
7002         echo "(Your architecture name used to be $myarchname.)"
7003         archname=''
7004         ;;
7005 esac
7006 case "$targetarch" in
7007 '') ;;
7008 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7009 esac
7010 myarchname="$tarch"
7011 case "$archname" in
7012 '') dflt="$tarch";;
7013 *) dflt="$archname";;
7014 esac
7015 rp='What is your architecture name'
7016 . ./myread
7017 archname="$ans"
7018
7019 : optionally add API version to the architecture for versioned archlibs
7020 case "$useversionedarchname" in
7021 $define|true|[yY]*) dflt='y';;
7022 *)                  dflt='n';;
7023 esac
7024 rp='Add the Perl API version to your archname?'
7025 . ./myread
7026 case "$ans" in
7027 y|Y)    useversionedarchname="$define" ;;
7028 *)      useversionedarchname="$undef" ;;
7029 esac
7030 case "$useversionedarchname" in
7031 $define)
7032         case "$archname" in
7033         *-$api_versionstring)
7034                 echo "...and architecture name already has -$api_versionstring" >&4
7035                 ;;
7036         *)
7037                 archname="$archname-$api_versionstring"
7038                 echo "...setting architecture name to $archname." >&4
7039                 ;;
7040         esac
7041         ;;
7042 esac
7043
7044 case "$usethreads" in
7045 $define)
7046         echo "Threads selected." >&4
7047         case "$archname" in
7048         *-thread*) echo "...and architecture name already has -thread." >&4
7049                 ;;
7050         *)      archname="$archname-thread"
7051                 echo "...setting architecture name to $archname." >&4
7052                 ;;
7053         esac
7054         ;;
7055 esac
7056 case "$usemultiplicity" in
7057 $define)
7058         echo "Multiplicity selected." >&4
7059         case "$archname" in
7060         *-multi*) echo "...and architecture name already has -multi." >&4
7061                 ;;
7062         *)      archname="$archname-multi"
7063                 echo "...setting architecture name to $archname." >&4
7064                 ;;
7065         esac
7066         ;;
7067 esac
7068 case "$use64bitint$use64bitall" in
7069 *"$define"*)
7070         case "$archname64" in
7071         '')
7072                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7073                 ;;
7074         *)
7075                 case "$use64bitint" in
7076                 "$define") echo "64 bit integers selected." >&4 ;;
7077                 esac
7078                 case "$use64bitall" in
7079                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7080                 esac
7081                 case "$archname" in
7082                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7083                         ;;
7084                 *)      archname="$archname-$archname64"
7085                         echo "...setting architecture name to $archname." >&4
7086                         ;;
7087                 esac
7088                 ;;
7089         esac
7090 esac
7091 case "$uselongdouble" in
7092 $define)
7093         echo "Long doubles selected." >&4
7094         case "$longdblsize" in
7095         $doublesize)
7096                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7097                 ;;
7098         *)
7099                 case "$archname" in
7100                 *-ld*) echo "...and architecture name already has -ld." >&4
7101                         ;;
7102                 *)      archname="$archname-ld"
7103                         echo "...setting architecture name to $archname." >&4
7104                         ;;
7105                 esac
7106                 ;;
7107         esac
7108         ;;
7109 esac
7110 case "$usequadmath" in
7111 $define)
7112         echo "quadmath selected." >&4
7113         case "$archname" in
7114         *-ld*) echo "...and architecture name already has -quadmath." >&4
7115                 ;;
7116         *)      archname="$archname-quadmath"
7117                 echo "...setting architecture name to $archname." >&4
7118                 ;;
7119         esac
7120         ;;
7121 esac
7122 if $test -f archname.cbu; then
7123         echo "Your platform has some specific hints for architecture name, using them..."
7124         . ./archname.cbu
7125 fi
7126
7127 : set the prefixit variable, to compute a suitable default value
7128 prefixit='case "$3" in
7129 ""|none)
7130         case "$oldprefix" in
7131         "") eval "$1=\"\$$2\"";;
7132         *)
7133                 case "$3" in
7134                 "") eval "$1=";;
7135                 none)
7136                         eval "tp=\"\$$2\"";
7137                         case "$tp" in
7138                         ""|" ") eval "$1=\"\$$2\"";;
7139                         *) eval "$1=";;
7140                         esac;;
7141                 esac;;
7142         esac;;
7143 *)
7144         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7145         case "$tp" in
7146         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7147         /*-$oldprefix/*|\~*-$oldprefix/*)
7148                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7149         *) eval "$1=\"\$$2\"";;
7150         esac;;
7151 esac'
7152
7153 : determine installation style
7154 : For now, try to deduce it from prefix unless it is already set.
7155 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7156 case "$installstyle" in
7157 '')     case "$prefix" in
7158                 *perl*) dflt='lib';;
7159                 *) dflt='lib/perl5' ;;
7160         esac
7161         ;;
7162 *)      dflt="$installstyle" ;;
7163 esac
7164 : Probably not worth prompting for this since we prompt for all
7165 : the directories individually, and the prompt would be too long and
7166 : confusing anyway.
7167 installstyle=$dflt
7168
7169 : determine where public executables go
7170 echo " "
7171 set dflt bin bin
7172 eval $prefixit
7173 fn=d~
7174 rp='Pathname where the public executables will reside?'
7175 . ./getfile
7176 if $test "X$ansexp" != "X$binexp"; then
7177         installbin=''
7178 fi
7179 prefixvar=bin
7180 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7181 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7182 :     this via initialinstalllocation
7183 . ./setprefixvar
7184
7185 case "$userelocatableinc" in
7186 $define|true|[yY]*)     dflt='y' ;;
7187 *)                      dflt='n' ;;
7188 esac
7189 cat <<EOM
7190
7191 Would you like to build Perl so that the installation is relocatable, so that
7192 library paths in @INC are determined relative to the path of the perl binary?
7193 This is not advised for system Perl installs, or if you need to run setid
7194 scripts or scripts under taint mode.
7195
7196 If this doesn't make any sense to you, just accept the default '$dflt'.
7197 EOM
7198 rp='Use relocatable @INC?'
7199 . ./myread
7200 case "$ans" in
7201 y|Y)    val="$define" ;;
7202 *)      val="$undef"  ;;
7203 esac
7204 set userelocatableinc
7205 eval $setvar
7206
7207 initialinstalllocation="$binexp"
7208 : Default prefix is now "up one level from where the binaries are"
7209 case "$userelocatableinc" in
7210 $define|true|[yY]*)
7211     bin=".../"
7212     binexp=".../"
7213     prefix=".../.."
7214     prefixexp=".../.."
7215     installprefixexp=".../.."
7216     ;;
7217 esac
7218
7219 : determine where private library files go
7220 : Usual default is /usr/local/lib/perl5/$version.
7221 : Also allow things like /opt/perl/lib/$version, since
7222 : /opt/perl/lib/perl5... would be redundant.
7223 : The default "style" setting is made in installstyle.U
7224 case "$installstyle" in
7225 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7226 *)       set dflt privlib lib/$version ;;
7227 esac
7228 eval $prefixit
7229 $cat <<EOM
7230
7231 There are some auxiliary files for $package that need to be put into a
7232 private library directory that is accessible by everyone.
7233
7234 EOM
7235 fn=$binexp
7236 fn=d~+
7237 rp='Pathname where the private library files will reside?'
7238 . ./getfile
7239 prefixvar=privlib
7240 . ./setprefixvar
7241
7242 : set the prefixup variable, to restore leading tilda escape
7243 prefixup='case "$prefixexp" in
7244 "$prefix") ;;
7245 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7246 esac'
7247
7248 : determine where public architecture dependent libraries go
7249 set archlib archlib
7250 eval $prefixit
7251 : privlib default is /usr/local/lib/$package/$version
7252 : archlib default is /usr/local/lib/$package/$version/$archname
7253 : privlib may have an optional trailing /share.
7254 tdflt=`echo $privlib | $sed 's,/share$,,'`
7255 tdflt=$tdflt/$archname
7256 case "$archlib" in
7257 '')     dflt=$tdflt
7258         ;;
7259 *)      dflt="$archlib"
7260     ;;
7261 esac
7262 $cat <<EOM
7263
7264 $spackage contains architecture-dependent library files.  If you are
7265 sharing libraries in a heterogeneous environment, you might store
7266 these files in a separate location.  Otherwise, you can just include
7267 them with the rest of the public library files.
7268
7269 EOM
7270 fn=$binexp
7271 fn=d+~
7272 rp='Where do you want to put the public architecture-dependent libraries?'
7273 . ./getfile
7274 prefixvar=archlib
7275 . ./setprefixvar
7276 if $test X"$archlib" = X"$privlib"; then
7277         d_archlib="$undef"
7278 else
7279         d_archlib="$define"
7280 fi
7281
7282 : see if setuid scripts can be secure
7283 $cat <<EOM
7284
7285 Some kernels have a bug that prevents setuid #! scripts from being
7286 secure.  Some sites have disabled setuid #! scripts because of this.
7287
7288 First let's decide if your kernel supports secure setuid #! scripts.
7289 (If setuid #! scripts would be secure but have been disabled anyway,
7290 don't say that they are secure if asked.)
7291
7292 EOM
7293
7294 val="$undef"
7295 if $test -d /dev/fd; then
7296         echo "#!$ls" >reflect
7297         chmod +x,u+s reflect
7298         ./reflect >flect 2>&1
7299         if $contains "/dev/fd" flect >/dev/null; then
7300                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7301                 val="$define"
7302         else
7303                 $cat <<EOM
7304 If you are not sure if they are secure, I can check but I'll need a
7305 username and password different from the one you are using right now.
7306 If you don't have such a username or don't want me to test, simply
7307 enter 'none'.
7308
7309 EOM
7310                 rp='Other username to test security of setuid scripts with?'
7311                 dflt='none'
7312                 . ./myread
7313                 case "$ans" in
7314                 n|none)
7315                         case "$d_suidsafe" in
7316                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7317                                 dflt=n;;
7318                         "$undef")
7319                                 echo "Well, the $hint value is *not* secure." >&4
7320                                 dflt=n;;
7321                         *)      echo "Well, the $hint value *is* secure." >&4
7322                                 dflt=y;;
7323                         esac
7324                         ;;
7325                 *)
7326                         $rm -f reflect flect
7327                         echo "#!$ls" >reflect
7328                         chmod +x,u+s reflect
7329                         echo >flect
7330                         chmod a+w flect
7331                         echo '"su" will (probably) prompt you for '"$ans's password."
7332                         su $ans -c './reflect >flect'
7333                         if $contains "/dev/fd" flect >/dev/null; then
7334                                 echo "Okay, it looks like setuid scripts are secure." >&4
7335                                 dflt=y
7336                         else
7337                                 echo "I don't think setuid scripts are secure." >&4
7338                                 dflt=n
7339                         fi
7340                         ;;
7341                 esac
7342                 rp='Does your kernel have *secure* setuid scripts?'
7343                 . ./myread
7344                 case "$ans" in
7345                 [yY]*)  val="$define";;
7346                 *)      val="$undef";;
7347                 esac
7348         fi
7349 else
7350         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7351         echo "(That's for file descriptors, not floppy disks.)"
7352         val="$undef"
7353 fi
7354 set d_suidsafe
7355 eval $setvar
7356
7357 $rm -f reflect flect
7358
7359 : now see if they want to do setuid emulation
7360 if $test $patchlevel -lt 11; then
7361 echo " "
7362 val="$undef"
7363 case "$d_suidsafe" in
7364 "$define")
7365         val="$undef"
7366         echo "No need to emulate SUID scripts since they are secure here." >&4
7367         ;;
7368 *)
7369         $cat <<EOM
7370 Some systems have disabled setuid scripts, especially systems where
7371 setuid scripts cannot be secure.  On systems where setuid scripts have
7372 been disabled, the setuid/setgid bits on scripts are currently
7373 useless.  It is possible for $package to detect those bits and emulate
7374 setuid/setgid in a secure fashion.  This emulation will only work if
7375 setuid scripts have been disabled in your kernel.
7376
7377 EOM
7378         case "$d_dosuid" in
7379         "$define") dflt=y ;;
7380         *) dflt=n ;;
7381         esac
7382         rp="Do you want to do setuid/setgid emulation?"
7383         . ./myread
7384         case "$ans" in
7385         [yY]*)  val="$define";;
7386         *)      val="$undef";;
7387         esac
7388         ;;
7389 esac
7390 set d_dosuid
7391 eval $setvar
7392 else
7393     case "$d_dosuid" in
7394         "$define")
7395         cat >&4 <<EOH
7396
7397 SUID emulation has been removed for 5.12
7398 Please re-run Configure without -Dd_dosuid
7399
7400 EOH
7401         exit 1;
7402         ;;
7403     esac
7404     d_dosuid=undef
7405 fi
7406
7407 : Find perl5.005 or later.
7408 echo "Looking for a previously installed perl5.005 or later... "
7409 case "$perl5" in
7410 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7411                 : Check if this perl is recent and can load a simple module
7412                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7413                         perl5=$tdir/perl
7414                         break;
7415                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7416                         perl5=$tdir/perl5
7417                         break;
7418                 fi
7419         done
7420         ;;
7421 *)      perl5="$perl5"
7422         ;;
7423 esac
7424 case "$perl5" in
7425 '')     echo "None found.  That's ok.";;
7426 *)      echo "Using $perl5." ;;
7427 esac
7428
7429 : Set the siteprefix variables
7430 $cat <<EOM
7431
7432 After $package is installed, you may wish to install various
7433 add-on modules and utilities.  Typically, these add-ons will
7434 be installed under $prefix with the rest
7435 of this package.  However, you may wish to install such add-ons
7436 elsewhere under a different prefix.
7437
7438 If you do not wish to put everything under a single prefix, that's
7439 ok.  You will be prompted for the individual locations; this siteprefix
7440 is only used to suggest the defaults.
7441
7442 The default should be fine for most people.
7443
7444 EOM
7445 fn=d~+
7446 rp='Installation prefix to use for add-on modules and utilities?'
7447 : XXX Here might be another good place for an installstyle setting.
7448 case "$siteprefix" in
7449 '') dflt=$prefix ;;
7450 *)  dflt=$siteprefix ;;
7451 esac
7452 . ./getfile
7453 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7454 oldsiteprefix=''
7455 case "$siteprefix" in
7456 '') ;;
7457 *)      case "$ans" in
7458         "$prefix") ;;
7459         *) oldsiteprefix="$prefix";;
7460         esac
7461         ;;
7462 esac
7463 siteprefix="$ans"
7464 siteprefixexp="$ansexp"
7465
7466 : determine where site specific libraries go.
7467 : Usual default is /usr/local/lib/perl5/site_perl/$version
7468 : The default "style" setting is made in installstyle.U
7469 : XXX No longer works with Prefixit stuff.
7470 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7471 case "$sitelib" in
7472 '') case "$installstyle" in
7473         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7474         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7475         esac
7476         ;;
7477 *)      dflt="$sitelib"
7478         ;;
7479 esac
7480 $cat <<EOM
7481
7482 The installation process will create a directory for
7483 site-specific extensions and modules.  Most users find it convenient
7484 to place all site-specific files in this directory rather than in the
7485 main distribution directory.
7486
7487 EOM
7488 fn=d~+
7489 rp='Pathname for the site-specific library files?'
7490 . ./getfile
7491 prefixvar=sitelib
7492 . ./setprefixvar
7493 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7494
7495 : Determine list of previous versions to include in @INC
7496 $cat > getverlist <<EOPL
7497 #!$perl5 -w
7498 use File::Basename;
7499 \$api_versionstring = "$api_versionstring";
7500 \$version = "$version";
7501 \$stem = "$sitelib_stem";
7502 \$archname = "$archname";
7503 EOPL
7504         $cat >> getverlist <<'EOPL'
7505 # The list found is store twice for each entry: the original name, and
7506 # the binary broken down version as pack "sss", so sorting is easy and
7507 # unambiguous. This will work for all versions that have a maximum of
7508 # three digit groups, separate by '.'s or '_'s. Names are extended with
7509 # ".0.0" to ensure at least three elements for the pack.
7510 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7511
7512 # Can't have leading @ because metaconfig interprets it as a command!
7513 ;@inc_version_list=();
7514 # XXX Redo to do opendir/readdir?
7515 if (-d $stem) {
7516     chdir($stem);
7517     ;@candidates = map {
7518         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7519     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7520 }
7521 else {
7522     ;@candidates = ();
7523 }
7524
7525 ($pversion, $aversion, $vsn5005) = map {
7526     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7527 foreach $d (@candidates) {
7528     if ($d->[1] lt $pversion) {
7529         if ($d->[1] ge $aversion) {
7530             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7531         }
7532         elsif ($d->[1] ge $vsn5005) {
7533             unshift(@inc_version_list, grep { -d } $d->[0]);
7534         }
7535     }
7536     else {
7537         # Skip newer version.  I.e. don't look in
7538         # 5.7.0 if we're installing 5.6.1.
7539     }
7540 }
7541
7542 if (@inc_version_list) {
7543     print join(' ', @inc_version_list);
7544 }
7545 else {
7546     # Blank space to preserve value for next Configure run.
7547     print " ";
7548 }
7549 EOPL
7550 chmod +x getverlist
7551 case "$inc_version_list" in
7552 '')     if test -x "$perl5$exe_ext"; then
7553                 dflt=`$perl5 getverlist`
7554         else
7555                 dflt='none'
7556         fi
7557         ;;
7558 $undef) dflt='none' ;;
7559 *)  eval dflt=\"$inc_version_list\" ;;
7560 esac
7561 case "$dflt" in
7562 ''|' ') dflt=none ;;
7563 esac
7564 case "$dflt" in
7565 5.005) dflt=none ;;
7566 esac
7567 $cat <<EOM
7568
7569 In order to ease the process of upgrading, this version of perl
7570 can be configured to use modules built and installed with earlier
7571 versions of perl that were installed under $prefix.  Specify here
7572 the list of earlier versions that this version of perl should check.
7573 If Configure detected no earlier versions of perl installed under
7574 $prefix, then the list will be empty.  Answer 'none' to tell perl
7575 to not search earlier versions.
7576
7577 The default should almost always be sensible, so if you're not sure,
7578 just accept the default.
7579 EOM
7580
7581 rp='List of earlier versions to include in @INC?'
7582 . ./myread
7583 case "$ans" in
7584 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7585 *) inc_version_list="$ans" ;;
7586 esac
7587 case "$inc_version_list" in
7588 ''|' ')
7589         inc_version_list_init='0'
7590         d_inc_version_list="$undef"
7591         ;;
7592 *)      inc_version_list_init=`echo $inc_version_list |
7593                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7594         d_inc_version_list="$define"
7595         ;;
7596 esac
7597 $rm -f getverlist
7598
7599 : see if malloc/malloc.h has to be included
7600 set malloc/malloc.h i_mallocmalloc
7601 eval $inhdr
7602
7603 : see if this is a malloc.h system
7604 : we want a real compile instead of Inhdr because some systems have a
7605 : malloc.h that just gives a compile error saying to use stdlib.h instead
7606 echo " "
7607 $cat >try.c <<EOCP
7608 #include <stdlib.h>
7609 #include <malloc.h>
7610 #$i_mallocmalloc I_MALLOCMALLOC
7611 #ifdef I_MALLOCMALLOC
7612 # include <malloc/malloc.h>
7613 #endif
7614
7615 int main () { return 0; }
7616 EOCP
7617 set try
7618 if eval $compile; then
7619     echo "<malloc.h> found." >&4
7620     val="$define"
7621 else
7622     echo "<malloc.h> NOT found." >&4
7623     val="$undef"
7624 fi
7625 $rm_try
7626 set i_malloc
7627 eval $setvar
7628
7629 : check for length of pointer
7630 echo " "
7631 case "$ptrsize" in
7632 '')
7633         echo "Checking to see how big your pointers are..." >&4
7634         $cat >>try.c <<EOCP
7635 #include <stdio.h>
7636 #$i_stdlib I_STDLIB
7637 #ifdef I_STDLIB
7638 #include <stdlib.h>
7639 #endif
7640 int main()
7641 {
7642     printf("%d\n", (int)sizeof(void *));
7643     exit(0);
7644 }
7645 EOCP
7646         set try
7647         if eval $compile_ok; then
7648                 ptrsize=`$run ./try`
7649                 echo "Your pointers are $ptrsize bytes long."
7650         else
7651                 dflt='4'
7652                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7653                 rp="What is the size of a pointer (in bytes)?"
7654                 . ./myread
7655                 ptrsize="$ans"
7656         fi
7657         ;;
7658 esac
7659 $rm_try
7660 case "$use64bitall" in
7661 "$define"|true|[yY]*)
7662         case "$ptrsize" in
7663         4)      cat <<EOM >&4
7664
7665 *** You have chosen a maximally 64-bit build,
7666 *** but your pointers are only 4 bytes wide.
7667 *** Please rerun Configure without -Duse64bitall.
7668 EOM
7669                 case "$d_quad" in
7670                 define)
7671                         cat <<EOM >&4
7672 *** Since you have quads, you could possibly try with -Duse64bitint.
7673 EOM
7674                         ;;
7675                 esac
7676                 cat <<EOM >&4
7677 *** Cannot continue, aborting.
7678
7679 EOM
7680
7681                 exit 1
7682                 ;;
7683         esac
7684         ;;
7685 esac
7686
7687
7688 : determine whether to use malloc wrapping
7689 echo " "
7690 case "$usemallocwrap" in
7691 [yY]*|true|$define)     dflt='y' ;;
7692 [nN]*|false|$undef)     dflt='n' ;;
7693 *)      case "$usedevel" in
7694         [yY]*|true|$define)     dflt='y' ;;
7695         *) dflt='n' ;;
7696         esac
7697         ;;
7698 esac
7699 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7700 . ./myread
7701 usemallocwrap="$ans"
7702 case "$ans" in
7703 y*|true)
7704         usemallocwrap="$define" ;;
7705 *)
7706         usemallocwrap="$undef" ;;
7707 esac
7708
7709 : determine which malloc to compile in
7710 echo " "
7711 case "$usemymalloc" in
7712 [yY]*|true|$define)     dflt='y' ;;
7713 [nN]*|false|$undef)     dflt='n' ;;
7714 *)      case "$ptrsize" in
7715         4) dflt='y' ;;
7716         *) dflt='n' ;;
7717         esac
7718         if test "$useithreads" = "$define"; then dflt='n'; fi
7719         ;;
7720 esac
7721 rp="Do you wish to attempt to use the malloc that comes with $package?"
7722 . ./myread
7723 usemymalloc="$ans"
7724 case "$ans" in
7725 y*|true)
7726         usemymalloc='y'
7727         mallocsrc='malloc.c'
7728         mallocobj="malloc$_o"
7729         d_mymalloc="$define"
7730         case "$libs" in
7731         *-lmalloc*)
7732                 : Remove malloc from list of libraries to use
7733                 echo "Removing unneeded -lmalloc from library list" >&4
7734                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7735                 shift
7736                 libs="$*"
7737                 echo "libs = $libs" >&4
7738                 ;;
7739         esac
7740         ;;
7741 *)
7742         usemymalloc='n'
7743         mallocsrc=''
7744         mallocobj=''
7745         d_mymalloc="$undef"
7746         ;;
7747 esac
7748
7749 : compute the return types of malloc and free
7750 echo " "
7751 $cat >malloc.c <<END
7752 #$i_malloc I_MALLOC
7753 #$i_stdlib I_STDLIB
7754 #include <stdio.h>
7755 #include <sys/types.h>
7756 #ifdef I_MALLOC
7757 #include <malloc.h>
7758 #endif
7759 #ifdef I_STDLIB
7760 #include <stdlib.h>
7761 #endif
7762 #ifdef TRY_MALLOC
7763 void *malloc();
7764 #endif
7765 #ifdef TRY_FREE
7766 void free();
7767 #endif
7768 END
7769 case "$malloctype" in
7770 '')
7771         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7772                 malloctype='void *'
7773         else
7774                 malloctype='char *'
7775         fi
7776         ;;
7777 esac
7778 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7779
7780 case "$freetype" in
7781 '')
7782         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7783                 freetype='void'
7784         else
7785                 freetype='int'
7786         fi
7787         ;;
7788 esac
7789 echo "Your system uses $freetype free(), it would seem." >&4
7790 $rm -f malloc.[co]
7791 : determine where site specific architecture-dependent libraries go.
7792 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7793 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7794 : sitelib may have an optional trailing /share.
7795 case "$sitearch" in
7796 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7797         dflt="$dflt/$archname"
7798         ;;
7799 *)      dflt="$sitearch"
7800         ;;
7801 esac
7802 set sitearch sitearch none
7803 eval $prefixit
7804 $cat <<EOM
7805
7806 The installation process will also create a directory for
7807 architecture-dependent site-specific extensions and modules.
7808
7809 EOM
7810 fn=d~+
7811 rp='Pathname for the site-specific architecture-dependent library files?'
7812 . ./getfile
7813 prefixvar=sitearch
7814 . ./setprefixvar
7815 if $test X"$sitearch" = X"$sitelib"; then
7816         d_sitearch="$undef"
7817 else
7818         d_sitearch="$define"
7819 fi
7820
7821 : Set the vendorprefix variables
7822 $cat <<EOM
7823
7824 The installation process will also create a directory for
7825 vendor-supplied add-ons.  Vendors who supply perl with their system
7826 may find it convenient to place all vendor-supplied files in this
7827 directory rather than in the main distribution directory.  This will
7828 ease upgrades between binary-compatible maintenance versions of perl.
7829
7830 Of course you may also use these directories in whatever way you see
7831 fit.  For example, you might use them to access modules shared over a
7832 company-wide network.
7833
7834 The default answer should be fine for most people.
7835 This causes further questions about vendor add-ons to be skipped
7836 and no vendor-specific directories will be configured for perl.
7837
7838 EOM
7839 rp='Do you want to configure vendor-specific add-on directories?'
7840 case "$usevendorprefix" in
7841 define|true|[yY]*) dflt=y ;;
7842 *)      : User may have set vendorprefix directly on Configure command line.
7843         case "$vendorprefix" in
7844         ''|' ') dflt=n ;;
7845         *)      dflt=y ;;
7846         esac
7847         ;;
7848 esac
7849 . ./myread
7850 case "$ans" in
7851 [yY]*)  fn=d~+
7852         rp='Installation prefix to use for vendor-supplied add-ons?'
7853         case "$vendorprefix" in
7854         '') dflt="$prefix" ;;
7855         *)  dflt=$vendorprefix ;;
7856         esac
7857         . ./getfile
7858         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7859         oldvendorprefix=''
7860         case "$vendorprefix" in
7861         '') ;;
7862         *)      case "$ans" in
7863                 "$prefix") ;;
7864                 *) oldvendorprefix="$prefix";;
7865                 esac
7866                 ;;
7867         esac
7868         usevendorprefix="$define"
7869         vendorprefix="$ans"
7870         vendorprefixexp="$ansexp"
7871         ;;
7872 *)      usevendorprefix="$undef"
7873         vendorprefix=''
7874         vendorprefixexp=''
7875         ;;
7876 esac
7877
7878 : Set the vendorlib variables
7879 case "$vendorprefix" in
7880 '')     d_vendorlib="$undef"
7881         vendorlib=''
7882         vendorlibexp=''
7883         ;;
7884 *)      d_vendorlib="$define"
7885         : determine where vendor-supplied modules go.
7886         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7887         case "$vendorlib" in
7888         '')
7889                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7890                 case "$installstyle" in
7891                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7892                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7893                 esac
7894                 ;;
7895         *)      dflt="$vendorlib"
7896                 ;;
7897         esac
7898         fn=d~+
7899         rp='Pathname for the vendor-supplied library files?'
7900         . ./getfile
7901         vendorlib="$ans"
7902         vendorlibexp="$ansexp"
7903         ;;
7904 esac
7905 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7906 prefixvar=vendorlib
7907 . ./installprefix
7908
7909 : Set the vendorarch variables
7910 case "$vendorprefix" in
7911 '')     d_vendorarch="$undef"
7912         vendorarch=''
7913         vendorarchexp=''
7914         ;;
7915 *)      d_vendorarch="$define"
7916         : determine where vendor-supplied architecture-dependent libraries go.
7917         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7918         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7919         : vendorlib may have an optional trailing /share.
7920         case "$vendorarch" in
7921         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7922                 dflt="$dflt/$archname"
7923                 ;;
7924         *)      dflt="$vendorarch" ;;
7925         esac
7926         fn=d~+
7927         rp='Pathname for vendor-supplied architecture-dependent files?'
7928         . ./getfile
7929         vendorarch="$ans"
7930         vendorarchexp="$ansexp"
7931         ;;
7932 esac
7933 prefixvar=vendorarch
7934 . ./installprefix
7935 if $test X"$vendorarch" = X"$vendorlib"; then
7936         d_vendorarch="$undef"
7937 else
7938         d_vendorarch="$define"
7939 fi
7940
7941 : Final catch-all directories to search
7942 $cat <<EOM
7943
7944 Lastly, you can have perl look in other directories for extensions and
7945 modules in addition to those already specified.
7946 These directories will be searched after
7947         $sitearch
7948         $sitelib
7949 EOM
7950 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7951 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7952 echo ' '
7953 case "$otherlibdirs" in
7954 ''|' ') dflt='none' ;;
7955 *)      dflt="$otherlibdirs" ;;
7956 esac
7957 $cat <<EOM
7958 Enter a colon-separated set of extra paths to include in perl's @INC
7959 search path, or enter 'none' for no extra paths.
7960
7961 EOM
7962
7963 rp='Colon-separated list of additional directories for perl to search?'
7964 . ./myread
7965 case "$ans" in
7966 ' '|''|none)    otherlibdirs=' ' ;;
7967 *)      otherlibdirs="$ans" ;;
7968 esac
7969 case "$otherlibdirs" in
7970 ' ') val=$undef ;;
7971 *)      val=$define ;;
7972 esac
7973 set d_perl_otherlibdirs
7974 eval $setvar
7975
7976 : Cruising for prototypes
7977 echo " "
7978 echo "Checking out function prototypes..." >&4
7979 $cat >prototype.c <<EOCP
7980 #$i_stdlib I_STDLIB
7981 #ifdef I_STDLIB
7982 #include <stdlib.h>
7983 #endif
7984 int main(int argc, char *argv[]) {
7985         exit(0);}
7986 EOCP
7987 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7988         echo "Your C compiler appears to support function prototypes."
7989         val="$define"
7990 else
7991         echo "Your C compiler doesn't seem to understand function prototypes."
7992         val="$undef"
7993 fi
7994 set prototype
7995 eval $setvar
7996 $rm -f prototype*
7997
7998 : Check if ansi2knr is required
7999 case "$prototype" in
8000 "$define") ;;
8001 *)      ansi2knr='ansi2knr'
8002         echo " "
8003         cat <<EOM >&4
8004
8005 $me:  FATAL ERROR:
8006 This version of $package can only be compiled by a compiler that
8007 understands function prototypes.  Unfortunately, your C compiler
8008         $cc $ccflags
8009 doesn't seem to understand them.  Sorry about that.
8010
8011 If GNU cc is available for your system, perhaps you could try that instead.
8012
8013 Eventually, we hope to support building Perl with pre-ANSI compilers.
8014 If you would like to help in that effort, please contact <perlbug@perl.org>.
8015
8016 Aborting Configure now.
8017 EOM
8018         exit 2
8019         ;;
8020 esac
8021
8022 : DTrace support
8023 dflt_dtrace='/usr/sbin/dtrace'
8024 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8025
8026 cat <<EOM
8027
8028 Perl can be built to support DTrace on platforms that support it.
8029 DTrace is a diagnosis and performance analysis tool from Sun.
8030
8031 If this doesn't make any sense to you, just accept the default '$dflt'.
8032 EOM
8033
8034 while $test 1 ; do
8035         case "$usedtrace" in
8036         $define|true|[yY]*)
8037                 dflt='y'
8038                 ;;
8039         ?*)
8040                 dflt='y'
8041                 dflt_dtrace=$usedtrace
8042                 ;;
8043         *)
8044                 dflt='n'
8045                 ;;
8046         esac
8047
8048         rp='Support DTrace if available?'
8049         . ./myread
8050         case "$ans" in
8051         y|Y)    val="$define" ;;
8052         *)      val="$undef" ;;
8053         esac
8054         set usedtrace
8055         eval $setvar
8056
8057         test "X$usedtrace" != "X$define" && break
8058
8059         echo " "
8060         rp='Where is the dtrace executable?'
8061         dflt=$dflt_dtrace
8062         . ./getfile
8063         val="$ans"
8064         set dtrace
8065         eval $setvar
8066
8067         if $test -f $dtrace
8068         then
8069                 if $dtrace -h -s ../perldtrace.d \
8070                         -o perldtrace.tmp >/dev/null 2>&1 \
8071                         && rm -f perldtrace.tmp
8072                 then
8073                         echo " "
8074                         echo "Good: your $dtrace knows about the -h flag."
8075                 else
8076                         cat >&2 <<EOM
8077
8078 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8079 ***
8080 *** Your installed dtrace doesn't support the -h switch to compile a D
8081 *** program into a C header. Can't continue.
8082
8083 EOM
8084                         exit 1
8085                 fi
8086                 break;
8087         fi
8088
8089         case "$fastread" in
8090         yes)
8091                 cat >&2 <<EOM
8092
8093 *** $me:  Fatal Error:  $dtrace not found.
8094 *** Can't continue.
8095
8096 EOM
8097                 exit 1
8098                 ;;
8099         *)
8100                 echo "*** $dtrace was not found."
8101                 echo " "
8102                 ;;
8103         esac
8104 done
8105
8106 : See if we want extra modules installed
8107 echo " "
8108 case "$extras" in
8109 '') dflt='n';;
8110 *) dflt='y';;
8111 esac
8112 cat <<EOM
8113 Perl can be built with extra modules or bundles of modules which
8114 will be fetched from the CPAN and installed alongside Perl.
8115
8116 Notice that you will need access to the CPAN; either via the Internet,
8117 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8118 be asked later to configure the CPAN.pm module which will in turn do
8119 the installation of the rest of the extra modules or bundles.)
8120
8121 Notice also that if the modules require any external software such as
8122 libraries and headers (the libz library and the zlib.h header for the
8123 Compress::Zlib module, for example) you MUST have any such software
8124 already installed, this configuration process will NOT install such
8125 things for you.
8126
8127 If this doesn't make any sense to you, just accept the default '$dflt'.
8128 EOM
8129 rp='Install any extra modules (y or n)?'
8130 . ./myread
8131 case "$ans" in
8132 y|Y)
8133         cat <<EOM
8134
8135 Please list any extra modules or bundles to be installed from CPAN,
8136 with spaces between the names.  The names can be in any format the
8137 'install' command of CPAN.pm will understand.  (Answer 'none',
8138 without the quotes, to install no extra modules or bundles.)
8139 EOM
8140         rp='Extras?'
8141         dflt="$extras"
8142         . ./myread
8143         extras="$ans"
8144 esac
8145 case "$extras" in
8146 ''|'none')
8147         val=''
8148         $rm -f ../extras.lst
8149         ;;
8150 *)      echo "(Saving the list of extras for later...)"
8151         echo "$extras" > ../extras.lst
8152         val="'$extras'"
8153         ;;
8154 esac
8155 set extras
8156 eval $setvar
8157 echo " "
8158
8159 : determine where html pages for programs go
8160 set html1dir html1dir none
8161 eval $prefixit
8162 $cat <<EOM
8163
8164 If you wish to install html files for programs in $spackage, indicate
8165 the appropriate directory here.  To skip installing html files,
8166 answer "none".
8167 EOM
8168 case "$html1dir" in
8169 ''|none|$undef|' ') dflt=none ;;
8170 *) dflt=$html1dir ;;
8171 esac
8172 fn=dn+~
8173 rp="Directory for the main $spackage html pages?"
8174 . ./getfile
8175 prefixvar=html1dir
8176 . ./setprefixvar
8177 : Use ' ' for none so value is preserved next time through Configure
8178 $test X"$html1dir" = "X" && html1dir=' '
8179
8180 : determine where html pages for libraries and modules go
8181 set html3dir html3dir none
8182 eval $prefixit
8183 $cat <<EOM
8184
8185 If you wish to install html files for modules associated with $spackage,
8186 indicate the appropriate directory here.  To skip installing html files,
8187 answer "none".
8188 EOM
8189 : There is no obvious default.  If they have specified html1dir, then
8190 : try to key off that, possibly changing .../html1 into .../html3.
8191 case "$html3dir" in
8192 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8193 *) dflt=$html3dir ;;
8194 esac
8195 fn=dn+~
8196 rp="Directory for the $spackage module html pages?"
8197 . ./getfile
8198 prefixvar=html3dir
8199 . ./setprefixvar
8200 : Use ' ' for none so value is preserved next time through Configure
8201 $test X"$html3dir" = "X" && html3dir=' '
8202
8203 : determine whether to install perl also as /usr/bin/perl
8204
8205 echo " "
8206 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8207         $cat <<EOM
8208 Many scripts expect perl to be installed as /usr/bin/perl.
8209
8210 If you want to, I can install the perl you are about to compile
8211 as /usr/bin/perl (in addition to $bin/perl).
8212 EOM
8213         if test -f /usr/bin/perl; then
8214             $cat <<EOM
8215
8216 However, please note that because you already have a /usr/bin/perl,
8217 overwriting that with a new Perl would very probably cause problems.
8218 Therefore I'm assuming you don't want to do that (unless you insist).
8219
8220 EOM
8221             case "$installusrbinperl" in
8222             "$define"|[yY]*)    dflt='y';;
8223             *)                  dflt='n';;
8224             esac
8225         else
8226             $cat <<EOM
8227
8228 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8229
8230 EOM
8231             case "$installusrbinperl" in
8232             "$undef"|[nN]*)     dflt='n';;
8233             *)                  dflt='y';;
8234             esac
8235         fi
8236         rp="Do you want to install perl as /usr/bin/perl?"
8237         . ./myread
8238         case "$ans" in
8239         [yY]*)  val="$define";;
8240         *)      val="$undef" ;;
8241         esac
8242 else
8243         val="$undef"
8244 fi
8245 set installusrbinperl
8246 eval $setvar
8247
8248 : see if dlopen exists
8249 xxx_runnm="$runnm"
8250 xxx_ccflags="$ccflags"
8251 runnm=false
8252 : with g++ one needs -shared to get is-in-libc to work for dlopen
8253 case "$gccversion" in
8254 '')     ;;
8255 *)      case "$d_cplusplus" in
8256         "$define") ccflags="$ccflags -shared" ;;
8257         esac
8258         ;;
8259 esac
8260 set dlopen d_dlopen
8261 eval $inlibc
8262 runnm="$xxx_runnm"
8263 ccflags="$xxx_ccflags"
8264
8265 : see if this is a unistd.h system
8266 set unistd.h i_unistd
8267 eval $inhdr
8268
8269 : determine which dynamic loading, if any, to compile in
8270 echo " "
8271 dldir="ext/DynaLoader"
8272 case "$usedl" in
8273     $define|y|true)
8274         dflt='y'
8275         usedl="$define"
8276         ;;
8277     $undef|n|false)
8278         dflt='n'
8279         usedl="$undef"
8280         ;;
8281     *)
8282         dflt='n'
8283         case "$d_dlopen" in
8284             $define) dflt='y' ;;
8285         esac
8286         : Does a dl_xxx.xs file exist for this operating system
8287         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8288         ;;
8289 esac
8290 rp="Do you wish to use dynamic loading?"
8291 . ./myread
8292 usedl="$ans"
8293 bin_ELF="$undef"
8294 case "$ans" in
8295     y*) usedl="$define"
8296         case "$dlsrc" in
8297             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8298                     dflt="$dldir/dl_${osname}.xs"
8299                 elif $test "$d_dlopen" = "$define" ; then
8300                     dflt="$dldir/dl_dlopen.xs"
8301                 else
8302                     dflt=''
8303                 fi
8304                 ;;
8305             *)  dflt="$dldir/$dlsrc"
8306                 ;;
8307         esac
8308         echo "The following dynamic loading files are available:"
8309         : Can not go over to $dldir because getfile has path hard-coded in.
8310         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8311         rp="Source file to use for dynamic loading"
8312         fn="fne"
8313         gfpth="$src"
8314         . ./getfile
8315         usedl="$define"
8316         : emulate basename
8317         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8318
8319         $cat << EOM
8320
8321 Some systems may require passing special flags to $cc -c to
8322 compile modules that will be used to create a shared library.
8323 To use no flags, say "none".
8324
8325 EOM
8326         case "$cccdlflags" in
8327             '') case "$gccversion" in
8328                 '') case "$osname" in
8329                         hpux)   dflt='+z' ;;
8330                         irix*)  dflt='-KPIC' ;;
8331                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8332                         sunos)  dflt='-pic' ;;
8333                         *)      dflt='none' ;;
8334                     esac
8335                     ;;
8336                 *)  case "$osname" in
8337                         darwin) dflt='none' ;;
8338                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8339                         *)      dflt='-fpic' ;;
8340                     esac ;;
8341                 esac ;;
8342             ' ') dflt='none' ;;
8343             *)   dflt="$cccdlflags" ;;
8344         esac
8345
8346         case "$dflt" in
8347             none) dflt='' ;;
8348         esac
8349
8350         # If -Dsysroot was specified, now's the time to add it
8351         # to cccdlflags
8352         if test "X$sysroot" != X; then
8353             case "$gccversion" in
8354                 '') ;;
8355                 *)  case "$dflt" in
8356                         *sysroot*) ;;
8357                         'undef'|*)
8358                             dflt="$dflt --sysroot=$sysroot" ;;
8359                     esac
8360                     ;;
8361             esac
8362         fi
8363
8364         case "$dflt" in
8365             '') dflt='none';;
8366         esac
8367
8368         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8369         . ./myread
8370         case "$ans" in
8371             none) cccdlflags=' ' ;;
8372             *)    cccdlflags="$ans" ;;
8373         esac
8374
8375         cat << EOM
8376
8377 Some systems use ld to create libraries that can be dynamically loaded,
8378 while other systems (such as those using ELF) use $cc.
8379
8380 EOM
8381
8382 : Determine if this is ELF
8383         $cat >try.c <<EOM
8384 /* Test for whether ELF binaries are produced */
8385 #include <fcntl.h>
8386 #$i_stdlib I_STDLIB
8387 #ifdef I_STDLIB
8388 #include <stdlib.h>
8389 #endif
8390 #$i_unistd I_UNISTD
8391 #ifdef I_UNISTD
8392 #include <unistd.h>
8393 #endif
8394 int main() {
8395     char b[4];
8396     int i = open("a.out",O_RDONLY);
8397     if(i == -1)
8398         exit(1); /* fail */
8399     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8400         exit(0); /* succeed (yes, it is ELF) */
8401     exit(1); /* fail */
8402 }
8403 EOM
8404         if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8405             bin_ELF="$define"
8406         fi
8407         $rm_try
8408
8409         case "$ld" in
8410             '') if $test $bin_ELF = "$define"; then
8411                     cat <<EOM
8412 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8413 EOM
8414                     dflt="$cc"
8415                 else
8416                     echo "I'll use ld to build dynamic libraries."
8417                     dflt='ld'
8418                 fi
8419                 ;;
8420             *)  dflt="$ld"
8421                 ;;
8422         esac
8423
8424         rp="What command should be used to create dynamic libraries?"
8425         . ./myread
8426         ld="$ans"
8427
8428         cat << EOM
8429
8430 Some systems may require passing special flags to $ld to create a
8431 library that can be dynamically loaded.  If your ld flags include
8432 -L/other/path options to locate libraries outside your loader's normal
8433 search path, you may need to specify those -L options here as well.  To
8434 use no flags, say "none".
8435
8436 EOM
8437         case "$lddlflags" in
8438             '') case "$osname" in
8439                     haiku) dflt='-shared' ;;
8440                     hpux) dflt='-b';
8441                           case "$gccversion" in
8442                               '') dflt="$dflt +vnocompatwarnings" ;;
8443                           esac
8444                           ;;
8445                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8446                     solaris) # See [perl #66604].
8447                             # On Solaris 11, gcc -m64 on amd64
8448                             # appears not to understand -G.  gcc versions at
8449                             # least as old as 3.4.3 support -shared, so just
8450                             # use that with Solaris 11 and later, but keep
8451                             # the old behavior for older Solaris versions.
8452                             case "$gccversion" in
8453                                 '') dflt='-G' ;;
8454                                 *)  case "$osvers" in
8455                                         2.?|2.10) dflt='-G' ;;
8456                                         *) dflt='-shared' ;;
8457                                     esac
8458                                     ;;
8459                             esac
8460                             ;;
8461                     sunos) dflt='-assert nodefinitions' ;;
8462                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8463                     *)     dflt='none' ;;
8464                 esac
8465                 ;;
8466             *) dflt="$lddlflags" ;;
8467         esac
8468
8469         : Only do this for gcc, since, for example, qcc has no concept
8470         : of --sysroot.
8471         if $test "X$sysroot" != X; then
8472             case "$gccversion" in
8473                 '') ;;
8474                 *)  dflt="$dflt --sysroot $sysroot" ;;
8475             esac
8476         fi
8477
8478         : Try to guess additional flags to pick up local libraries.
8479         : Be careful not to append to a plain 'none'
8480         case "$dflt" in
8481             none) dflt='' ;;
8482         esac
8483         for thisflag in $ldflags; do
8484             case "$thisflag" in
8485                 -L*|-R*|-Wl,-R*)
8486                     case " $dflt " in
8487                         *" $thisflag "*) ;;
8488                         *) dflt="$dflt $thisflag" ;;
8489                     esac
8490                     ;;
8491             esac
8492         done
8493
8494         case "$dflt" in
8495             ''|' ') dflt='none' ;;
8496         esac
8497
8498         case "$ldflags" in
8499             *-fstack-protector-strong*)
8500                 case "$dflt" in
8501                     *-fstack-protector-strong*) ;; # Don't add it again
8502                     *) dflt="$dflt -fstack-protector-strong" ;;
8503                 esac
8504                 ;;
8505             *-fstack-protector*)
8506                 case "$dflt" in
8507                     *-fstack-protector*) ;; # Don't add it again
8508                     *) dflt="$dflt -fstack-protector" ;;
8509                 esac
8510                 ;;
8511         esac
8512
8513         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8514         . ./myread
8515         case "$ans" in
8516             none) lddlflags=' ' ;;
8517             *) lddlflags="$ans" ;;
8518         esac
8519
8520         cat <<EOM
8521
8522 Some systems may require passing special flags to $cc to indicate that
8523 the resulting executable will use dynamic linking.  To use no flags,
8524 say "none".
8525
8526 EOM
8527         case "$ccdlflags" in
8528             '') case "$osname" in
8529                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8530                     sunos)             dflt='none'   ;;
8531                     *)                 dflt='none'   ;;
8532                 esac ;;
8533             ' ') dflt='none' ;;
8534             *)   dflt="$ccdlflags" ;;
8535         esac
8536         rp="Any special flags to pass to $cc to use dynamic linking?"
8537         . ./myread
8538         case "$ans" in
8539             none) ccdlflags=' ' ;;
8540             *)    ccdlflags="$ans" ;;
8541         esac
8542         ;;
8543
8544     *)  usedl="$undef"
8545         ld='ld'
8546         dlsrc='dl_none.xs'
8547         lddlflags=''
8548         ccdlflags=''
8549         ;;
8550 esac
8551
8552 ld_can_script="$undef"
8553 case "$bin_ELF$usedl" in
8554     $define$define)
8555         # Abuse try.h and a.out names for neat cleanup
8556         $cat >try.c <<EOM
8557 void foo() {}
8558 void bar() {}
8559 EOM
8560         $cat >try.h <<EOM
8561 LIBTEST_42 {
8562  global:
8563   foo;
8564  local: *;
8565  };
8566 EOM
8567         if $cc $cccdlflags $ccdlflags $ccflags \
8568                $ldflags $lddlflags -o a.out try.c \
8569                -Wl,--version-script=try.h >/dev/null 2>&1 \
8570            &&  $test -s a.out ; then
8571             echo "ld supports scripting" >&4
8572             ld_can_script="$define"
8573         else
8574             echo "ld does not support scripting" >&4
8575         fi
8576         $rm_try
8577         ;;
8578 esac
8579
8580 : Do we want a shared libperl?
8581 also=''
8582 case "$usedl" in
8583 $undef)
8584         # No dynamic loading being used, so don't bother even to prompt.
8585         useshrplib='false'
8586         ;;
8587 *)      case "$useshrplib" in
8588         '')     case "$osname" in
8589                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8590                         dflt=y
8591                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8592                         ;;
8593                 *)      dflt=n
8594                         ;;
8595                 esac
8596                 ;;
8597         $define|true|[Yy]*)
8598                 dflt=y
8599                 ;;
8600         *)      dflt=n
8601                 ;;
8602         esac
8603         $cat << EOM
8604
8605 The perl executable is normally obtained by linking perlmain.c with
8606 libperl${_a}, any static extensions (usually just DynaLoader), and
8607 any other libraries needed on this system (such as -lm, etc.).  Since
8608 your system supports dynamic loading, it is probably possible to build
8609 a shared libperl.$so.  If you will have more than one executable linked
8610 to libperl.$so, this will significantly reduce the size of each
8611 executable, but it may have a noticeable effect on performance.  The
8612 default is probably sensible for your system.
8613 $also
8614
8615 EOM
8616         rp="Build a shared libperl.$so (y/n)"
8617         . ./myread
8618         case "$ans" in
8619         true|$define|[Yy]*)
8620                 useshrplib='true'  ;;
8621         *)      useshrplib='false' ;;
8622         esac
8623         ;;
8624 esac
8625
8626 case "$useshrplib" in
8627 true)
8628         case "$userelocatableinc" in
8629         true|define)
8630                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8631                 echo "See INSTALL for an explanation why that won't work." >&4
8632                 exit 4
8633                 ;;
8634         esac
8635         case "$libperl" in
8636         '')
8637                 # Figure out a good name for libperl.so.  Since it gets stored in
8638                 # a version-specific architecture-dependent library, the version
8639                 # number isn't really that important, except for making cc/ld happy.
8640                 #
8641                 # A name such as libperl.so.10.1
8642                 majmin="libperl.$so.$patchlevel.$subversion"
8643                 # A name such as libperl.so.100
8644                 majonly=`echo $patchlevel $subversion |
8645                         $awk '{printf "%d%02d", $1, $2}'`
8646                 majonly=libperl.$so.$majonly
8647                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8648                 # rely on figuring it out from the naming of libc.
8649                 case "${osname}${osvers}" in
8650                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8651                         dflt=libperl.$so
8652                         ;;
8653                 cygwin*) # ld links now against the dll directly
8654                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8655                         majonly=`echo $patchlevel $subversion |
8656                                 $awk '{printf "%03d%03d", $1, $2}'`
8657                         majonly=cygperl5.$majonly.$so
8658                         dflt=$majmin
8659                         ;;
8660                 *)      # Try to guess based on whether libc has major.minor.
8661                         case "$libc" in
8662                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8663                         *libc.$so.[0-9]*) dflt=$majonly ;;
8664                         *)      dflt=libperl.$so ;;
8665                         esac
8666                         ;;
8667                 esac
8668                 ;;
8669         *)      dflt=$libperl
8670                 ;;
8671         esac
8672         cat << EOM
8673
8674 I need to select a good name for the shared libperl.  If your system uses
8675 library names with major and minor numbers, then you might want something
8676 like $majmin.  Alternatively, if your system uses a single version
8677 number for shared libraries, then you might want to use $majonly.
8678 Or, your system might be quite happy with a simple libperl.$so.
8679
8680 Since the shared libperl will get installed into a version-specific
8681 architecture-dependent directory, the version number of the shared perl
8682 library probably isn't important, so the default should be o.k.
8683
8684 EOM
8685         rp='What name do you want to give to the shared libperl?'
8686         . ./myread
8687         libperl=$ans
8688         echo "Ok, I'll use $libperl"
8689         ;;
8690 *)
8691         libperl="libperl${_a}"
8692         ;;
8693 esac
8694
8695 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8696 case "$shrpdir" in
8697 '') ;;
8698 *)      $cat >&4 <<EOM
8699 WARNING:  Use of the shrpdir variable for the installation location of
8700 the shared $libperl is not supported.  It was never documented and
8701 will not work in this version.  Let me (perlbug@perl.org)
8702 know of any problems this may cause.
8703
8704 EOM
8705         case "$shrpdir" in
8706         "$archlibexp/CORE")
8707                 $cat >&4 <<EOM
8708 But your current setting of $shrpdir is
8709 the default anyway, so it's harmless.
8710 EOM
8711                 ;;
8712         *)
8713                 $cat >&4 <<EOM
8714 Further, your current attempted setting of $shrpdir
8715 conflicts with the value of $archlibexp/CORE
8716 that installperl will use.
8717 EOM
8718                 ;;
8719         esac
8720         ;;
8721 esac
8722
8723 # How will the perl executable find the installed shared $libperl?
8724 # Add $xxx to ccdlflags.
8725 # If we can't figure out a command-line option, use $shrpenv to
8726 # set env LD_RUN_PATH.  The main perl makefile uses this.
8727 shrpdir=$archlibexp/CORE
8728 xxx=''
8729 tmp_shrpenv=''
8730 if "$useshrplib"; then
8731     case "$osname" in
8732         aix)
8733                 # We'll set it in Makefile.SH...
8734                 ;;
8735         solaris)
8736                 xxx="-R $shrpdir"
8737                 ;;
8738         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8739                 xxx="-Wl,-R$shrpdir"
8740                 ;;
8741         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8742                 xxx="-Wl,-rpath,$shrpdir"
8743                 ;;
8744         hpux*)
8745                 # hpux doesn't like the default, either.
8746                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8747                 ;;
8748         cygwin)
8749                 # cygwin needs only ldlibpth
8750                 ;;
8751         *)
8752                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8753                 ;;
8754         esac
8755         case "$xxx" in
8756         '') ;;
8757         *)
8758                 # Only add $xxx if it isn't already in ccdlflags.
8759                 case " $ccdlflags " in
8760                 *" $xxx "*)     ;;
8761                 *)      ccdlflags="$ccdlflags $xxx"
8762                         cat <<EOM >&4
8763
8764 Adding $xxx to the flags
8765 passed to $ld so that the perl executable will find the
8766 installed shared $libperl.
8767
8768 EOM
8769                         ;;
8770                 esac
8771                 ;;
8772         esac
8773 fi
8774 # Fix ccdlflags in AIX for building external extensions.
8775 # (For building Perl itself bare -bE:perl.exp is needed,
8776 #  Makefile.SH takes care of this.)
8777 case "$osname" in
8778 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8779 esac
8780 # Respect a hint or command-line value.
8781 case "$shrpenv" in
8782 '') shrpenv="$tmp_shrpenv" ;;
8783 esac
8784 case "$ldlibpthname" in
8785 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8786 none)   ldlibpthname='' ;;
8787 esac
8788
8789 : determine where manual pages are on this system
8790 echo " "
8791 case "$sysman" in
8792 '')
8793         syspath='/usr/share/man/man1 /usr/man/man1'
8794         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8795         syspath="$syspath /usr/man/u_man/man1"
8796         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8797         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8798         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8799         sysman=`./loc . /usr/man/man1 $syspath`
8800         ;;
8801 esac
8802 if $test -d "$sysman"; then
8803         echo "System manual is in $sysman." >&4
8804 else
8805         echo "Could not find manual pages in source form." >&4
8806 fi
8807
8808 : determine where manual pages go
8809 set man1dir man1dir none
8810 eval $prefixit
8811 $cat <<EOM
8812
8813 $spackage has manual pages available in source form.
8814 EOM
8815 case "$nroff" in
8816 nroff)
8817         echo "However, you don't have nroff, so they're probably useless to you."
8818         case "$man1dir" in
8819         '') man1dir="none";;
8820         esac;;
8821 esac
8822 echo "If you don't want the manual sources installed, answer 'none'."
8823 case "$man1dir" in
8824 ' ') dflt=none
8825         ;;
8826 '')
8827         lookpath="$prefixexp/share/man/man1"
8828         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8829         lookpath="$lookpath $prefixexp/man/p_man/man1"
8830         lookpath="$lookpath $prefixexp/man/u_man/man1"
8831         lookpath="$lookpath $prefixexp/man/man.1"
8832         case "$sysman" in
8833         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8834         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8835         esac
8836         set dflt
8837         eval $prefixup
8838         ;;
8839 *)  dflt="$man1dir"
8840         ;;
8841 esac
8842 echo " "
8843 fn=dn+~
8844 rp="Where do the main $spackage manual pages (source) go?"
8845 . ./getfile
8846 if $test "X$man1direxp" != "X$ansexp"; then
8847         installman1dir=''
8848 fi
8849 prefixvar=man1dir
8850 . ./setprefixvar
8851
8852 case "$man1dir" in
8853 '')     man1dir=' '
8854         installman1dir='';;
8855 esac
8856
8857 : What suffix to use on installed man pages
8858
8859 case "$man1dir" in
8860 ' ')
8861         man1ext='0'
8862         ;;
8863 *)
8864         rp="What suffix should be used for the main $spackage man pages?"
8865         case "$man1ext" in
8866         '')     case "$man1dir" in
8867                 *1)  dflt=1 ;;
8868                 *1p) dflt=1p ;;
8869                 *1pm) dflt=1pm ;;
8870                 *l) dflt=l;;
8871                 *n) dflt=n;;
8872                 *o) dflt=o;;
8873                 *p) dflt=p;;
8874                 *C) dflt=C;;
8875                 *L) dflt=L;;
8876                 *L1) dflt=L1;;
8877                 *) dflt=1;;
8878                 esac
8879                 ;;
8880         *)      dflt="$man1ext";;
8881         esac
8882         . ./myread
8883         man1ext="$ans"
8884         ;;
8885 esac
8886
8887 : see if we can have long filenames
8888 echo " "
8889 first=123456789abcdef
8890 $rm -f $first
8891 if (echo hi >$first) 2>/dev/null; then
8892         if $test -f 123456789abcde; then
8893                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8894                 val="$undef"
8895         else
8896                 echo 'You can have filenames longer than 14 characters.'>&4
8897                 val="$define"
8898         fi
8899 else
8900         $cat <<'EOM'
8901 You can't have filenames longer than 14 chars.
8902 You can't even think about them!
8903 EOM
8904         val="$undef"
8905 fi
8906 set d_flexfnam
8907 eval $setvar
8908 $rm -rf 123456789abcde*
8909
8910 : determine where library module manual pages go
8911 set man3dir man3dir none
8912 eval $prefixit
8913 $cat <<EOM
8914
8915 $spackage has manual pages for many of the library modules.
8916 EOM
8917
8918 case "$nroff" in
8919 nroff)
8920         $cat <<'EOM'
8921 However, you don't have nroff, so they're probably useless to you.
8922 EOM
8923         case "$man3dir" in
8924         '') man3dir="none";;
8925         esac;;
8926 esac
8927
8928 case "$d_flexfnam" in
8929 undef)
8930         $cat <<'EOM'
8931 However, your system can't handle the long file names like File::Basename.3.
8932 EOM
8933         case "$man3dir" in
8934         '') man3dir="none";;
8935         esac;;
8936 esac
8937
8938 echo "If you don't want the manual sources installed, answer 'none'."
8939 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8940 case "$man3dir" in
8941 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8942         if $test -d "$privlib/man/man3"; then
8943                 cat <<EOM >&4
8944
8945 WARNING:  Previous versions of perl installed man3 pages into
8946 $privlib/man/man3.  This version will suggest a
8947 new default of $dflt.
8948 EOM
8949                 tdflt=$dflt
8950                 dflt='n'
8951                 rp='Do you wish to preserve the old behavior?(y/n)'
8952                 . ./myread
8953                 case "$ans" in
8954                 y*) dflt="$privlib/man/man3" ;;
8955                 *)  dflt=$tdflt ;;
8956                 esac
8957     fi
8958         ;;
8959 *)      dflt="$man3dir" ;;
8960 esac
8961 case "$dflt" in
8962 ' ') dflt=none ;;
8963 esac
8964 echo " "
8965 fn=dn+~
8966 rp="Where do the $package library man pages (source) go?"
8967 . ./getfile
8968 prefixvar=man3dir
8969 . ./setprefixvar
8970
8971 case "$man3dir" in
8972 '')     man3dir=' '
8973         installman3dir='';;
8974 esac
8975
8976 : What suffix to use on installed man pages
8977 case "$man3dir" in
8978 ' ')
8979         man3ext='0'
8980         ;;
8981 *)
8982         rp="What suffix should be used for the $package library man pages?"
8983         case "$man3ext" in
8984         '')     case "$man3dir" in
8985                 *3)  dflt=3 ;;
8986                 *3p) dflt=3p ;;
8987                 *3pm) dflt=3pm ;;
8988                 *l) dflt=l;;
8989                 *n) dflt=n;;
8990                 *o) dflt=o;;
8991                 *p) dflt=p;;
8992                 *C) dflt=C;;
8993                 *L) dflt=L;;
8994                 *L3) dflt=L3;;
8995                 *) dflt=3;;
8996                 esac
8997                 ;;
8998         *)      dflt="$man3ext";;
8999         esac
9000         . ./myread
9001         man3ext="$ans"
9002         ;;
9003 esac
9004
9005 : see if we have to deal with yellow pages, now NIS.
9006 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9007         case "$hostcat" in
9008         nidump*) ;;
9009         *)
9010                 case "$hostcat" in
9011                 *ypcat*) dflt=y;;
9012                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9013                                 dflt=y
9014                         else
9015                                 dflt=n
9016                         fi;;
9017                 *) dflt=n;;
9018                 esac
9019                 echo " "
9020                 rp='Are you getting the hosts file via yellow pages?'
9021                 . ./myread
9022                 case "$ans" in
9023                 y*) hostcat='ypcat hosts';;
9024                 *) hostcat='cat /etc/hosts';;
9025                 esac
9026                 ;;
9027         esac
9028 fi
9029 case "$hostcat" in
9030 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9031 esac
9032 case "$groupcat" in
9033 '') test -f /etc/group && groupcat='cat /etc/group';;
9034 esac
9035 case "$passcat" in
9036 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9037 esac
9038
9039 : now get the host name
9040 echo " "
9041 echo "Figuring out host name..." >&4
9042 case "$myhostname" in
9043 '') cont=true
9044         echo 'Maybe "hostname" will work...'
9045         if tans=`sh -c hostname 2>&1` ; then
9046                 myhostname=$tans
9047                 phostname=hostname
9048                 cont=''
9049         fi
9050         ;;
9051 *) cont='';;
9052 esac
9053 if $test "$cont"; then
9054         if ./xenix; then
9055                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9056                 if tans=`cat /etc/systemid 2>&1` ; then
9057                         myhostname=$tans
9058                         phostname='cat /etc/systemid'
9059                         echo "Whadyaknow.  Xenix always was a bit strange..."
9060                         cont=''
9061                 fi
9062         elif $test -r /etc/systemid; then
9063                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9064         fi
9065 fi
9066 if $test "$cont"; then
9067         echo 'No, maybe "uuname -l" will work...'
9068         if tans=`sh -c 'uuname -l' 2>&1` ; then
9069                 myhostname=$tans
9070                 phostname='uuname -l'
9071         else
9072                 echo 'Strange.  Maybe "uname -n" will work...'
9073                 if tans=`sh -c 'uname -n' 2>&1` ; then
9074                         myhostname=$tans
9075                         phostname='uname -n'
9076                 else
9077                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9078                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9079                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9080                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9081                         else
9082                                 case "$myhostname" in
9083                                 '') echo "Does this machine have an identity crisis or something?"
9084                                         phostname='';;
9085                                 *)
9086                                         echo "Well, you said $myhostname before..."
9087                                         phostname='echo $myhostname';;
9088                                 esac
9089                         fi
9090                 fi
9091         fi
9092 fi
9093 case "$myhostname" in
9094 '') myhostname=noname ;;
9095 esac
9096 : you do not want to know about this
9097 set $myhostname
9098 myhostname=$1
9099
9100 : verify guess
9101 if $test "$myhostname" ; then
9102         dflt=y
9103         rp='Your host name appears to be "'$myhostname'".'" Right?"
9104         . ./myread
9105         case "$ans" in
9106         y*) ;;
9107         *) myhostname='';;
9108         esac
9109 fi
9110
9111 : bad guess or no guess
9112 while $test "X$myhostname" = X ; do
9113         dflt=''
9114         rp="Please type the (one word) name of your host:"
9115         . ./myread
9116         myhostname="$ans"
9117 done
9118
9119 : translate upper to lower if necessary
9120 case "$myhostname" in
9121 *[A-Z]*)
9122         echo "(Normalizing case in your host name)"
9123         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9124         ;;
9125 esac
9126
9127 case "$myhostname" in
9128 *.*)
9129         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9130         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9131         echo "(Trimming domain name from host name--host name is now $myhostname)"
9132         ;;
9133 *) case "$mydomain" in
9134         '')
9135                 {
9136                         test "X$hostcat" = "Xypcat hosts" &&
9137                         ypmatch "$myhostname" hosts 2>/dev/null |\
9138                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9139                         $test -s hosts
9140                 } || {
9141                         test "X$hostcat" != "X" &&
9142                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9143                                         /[       ]$myhostname[  . ]/p" > hosts
9144                 }
9145                 tmp_re="[       . ]"
9146                 if $test -f hosts; then
9147                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9148                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9149                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9150                                 hosts | $sort | $uniq | \
9151                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9152                         case `$echo X$dflt` in
9153                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9154                                 dflt=.
9155                                 ;;
9156                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9157                                 ;;
9158                         esac
9159                 else
9160                         echo "(I cannot locate a hosts database anywhere)"
9161                         dflt=.
9162                 fi
9163                 case "$dflt" in
9164                 .)
9165                         tans=`./loc resolv.conf X /etc /usr/etc`
9166                         if $test -f "$tans"; then
9167                                 echo "(Attempting domain name extraction from $tans)"
9168                                 dflt=.`$sed -n -e 's/   / /g' \
9169                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9170                                   -e 1q 2>/dev/null`
9171                                 case "$dflt" in
9172                                 .) dflt=.`$sed -n -e 's/        / /g' \
9173                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9174                                      -e 1q 2>/dev/null`
9175                                         ;;
9176                                 esac
9177                         fi
9178                         ;;
9179                 esac
9180                 case "$dflt" in
9181                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9182                         dflt=.`sh -c domainname 2>/dev/null`
9183                         case "$dflt" in
9184                         '') dflt='.';;
9185                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9186                         esac
9187                         ;;
9188                 esac
9189                 case "$dflt$osname" in
9190                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9191                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9192                         ;;
9193                 esac
9194                 case "$dflt" in
9195                 .) echo "(Lost all hope -- silly guess then)"
9196                         dflt='.nonet'
9197                         ;;
9198                 esac
9199                 $rm -f hosts
9200                 ;;
9201         *) dflt="$mydomain";;
9202         esac;;
9203 esac
9204 echo " "
9205 rp="What is your domain name?"
9206 . ./myread
9207 tans="$ans"
9208 case "$ans" in
9209 '') ;;
9210 .*) ;;
9211 *) tans=".$tans";;
9212 esac
9213 mydomain="$tans"
9214
9215 : translate upper to lower if necessary
9216 case "$mydomain" in
9217 *[A-Z]*)
9218         echo "(Normalizing case in your domain name)"
9219         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9220         ;;
9221 esac
9222
9223 : a little sanity check here
9224 case "$phostname" in
9225 '') ;;
9226 *)
9227         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9228         $myhostname$mydomain|$myhostname) ;;
9229         *)
9230                 case "$phostname" in
9231                 sed*)
9232                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9233                         ;;
9234                 *)
9235                         echo "(That doesn't agree with your $phostname command, by the way.)"
9236                         ;;
9237                 esac
9238         ;;
9239         esac
9240         ;;
9241 esac
9242
9243 : determine the e-mail address of the user who is running us
9244 $cat <<EOM
9245
9246 I need to get your e-mail address in Internet format if possible, i.e.
9247 something like user@host.domain. Please answer accurately since I have
9248 no easy means to double check it. The default value provided below
9249 is most probably close to reality but may not be valid from outside
9250 your organization...
9251
9252 EOM
9253 cont=x
9254 while test "$cont"; do
9255         case "$MAILDOMAIN" in
9256         '')
9257                 if $test -s /etc/mailname; then
9258                         maildomain=`$cat /etc/mailname`
9259                 else
9260                         maildomain="$myhostname$mydomain"
9261                 fi
9262                 ;;
9263         *)  maildomain="$MAILDOMAIN";;
9264         esac
9265         case "$cf_email" in
9266         '') dflt="$cf_by@$maildomain";;
9267         *)  dflt="$cf_email";;
9268         esac
9269         rp='What is your e-mail address?'
9270         . ./myread
9271         cf_email="$ans"
9272         case "$cf_email" in
9273         *@*.*) cont='' ;;
9274         *)
9275                 rp='Address does not look like an Internet one.  Use it anyway?'
9276                 case "$fastread" in
9277                 yes) dflt=y ;;
9278                 *) dflt=n ;;
9279                 esac
9280                 . ./myread
9281                 case "$ans" in
9282                 y*) cont='' ;;
9283                 *) echo " " ;;
9284                 esac
9285                 ;;
9286         esac
9287 done
9288
9289 : Ask e-mail of administrator
9290 $cat <<EOM
9291
9292 If you or somebody else will be maintaining perl at your site, please
9293 fill in the correct e-mail address here so that they may be contacted
9294 if necessary. Currently, the "perlbug" program included with perl
9295 will send mail to this address in addition to perlbug@perl.org. You may
9296 enter "none" for no administrator.
9297
9298 EOM
9299 case "$perladmin" in
9300 '') dflt="$cf_email";;
9301 *) dflt="$perladmin";;
9302 esac
9303 rp='Perl administrator e-mail address'
9304 . ./myread
9305 perladmin="$ans"
9306
9307 : determine whether to only install version-specific parts.
9308 echo " "
9309 $cat <<EOM
9310 Do you want to install only the version-specific parts of the perl
9311 distribution?  Usually you do *not* want to do this.
9312 EOM
9313 case "$versiononly" in
9314 "$define"|[Yy]*|true) dflt='y' ;;
9315 *) dflt='n';
9316 esac
9317 rp="Do you want to install only the version-specific parts of perl?"
9318 . ./myread
9319 case "$ans" in
9320 [yY]*)  val="$define";;
9321 *)      val="$undef" ;;
9322 esac
9323 set versiononly
9324 eval $setvar
9325
9326 case "$versiononly" in
9327 "$define") inc_version_list=''
9328            inc_version_list_init=0
9329            ;;
9330 esac
9331
9332 : figure out how to guarantee perl startup
9333 : XXX Note that this currently takes advantage of the bug that binexp ignores
9334 :     the Configure -Dinstallprefix setting, which in turn means that under
9335 :     relocatable @INC, initialinstalllocation is what binexp started as.
9336 case "$startperl" in
9337 '')
9338         case "$sharpbang" in
9339         *!)
9340                 $cat <<EOH
9341
9342 I can use the #! construct to start perl on your system. This will
9343 make startup of perl scripts faster, but may cause problems if you
9344 want to share those scripts and perl is not in a standard place
9345 ($initialinstalllocation/perl) on all your platforms. The alternative
9346 is to force a shell by starting the script with a single ':' character.
9347
9348 EOH
9349                 case "$versiononly" in
9350                 "$define")      dflt="$initialinstalllocation/perl$version";;
9351                 *)              dflt="$initialinstalllocation/perl";;
9352                 esac
9353                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9354                 . ./myread
9355                 case "$ans" in
9356                 none)   startperl=": # use perl";;
9357                 *)      startperl="#!$ans"
9358                         if $test 30 -lt `echo "$ans" | wc -c`; then
9359                                 $cat >&4 <<EOM
9360
9361 WARNING:  Some systems limit the #! command to 32 characters.
9362 If you experience difficulty running Perl scripts with #!, try
9363 installing Perl in a directory with a shorter pathname.
9364
9365 EOM
9366                         fi ;;
9367                 esac
9368                 ;;
9369         *) startperl=": # use perl"
9370                 ;;
9371         esac
9372         ;;
9373 esac
9374 echo "I'll use $startperl to start perl scripts."
9375
9376 : figure best path for perl in scripts
9377 case "$perlpath" in
9378 '')
9379         case "$versiononly" in
9380         "$define")      perlpath="$initialinstalllocation/perl$version";;
9381         *)              perlpath="$initialinstalllocation/perl";;
9382         esac
9383         case "$startperl" in
9384         *!*) ;;
9385         *)
9386                 $cat <<EOH
9387
9388 I will use the "eval 'exec'" idiom to start Perl on your system.
9389 I can use the full path of your Perl binary for this purpose, but
9390 doing so may cause problems if you want to share those scripts and
9391 Perl is not always in a standard place ($initialinstalllocation/perl).
9392
9393 EOH
9394                 dflt="$initialinstalllocation/perl"
9395                 rp="What path shall I use in \"eval 'exec'\"?"
9396                 . ./myread
9397                 perlpath="$ans"
9398                 ;;
9399         esac
9400         ;;
9401 esac
9402 case "$startperl" in
9403 *!*)    ;;
9404 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9405 esac
9406
9407 : determine where public executable scripts go
9408 set scriptdir scriptdir
9409 eval $prefixit
9410 case "$scriptdir" in
9411 '')
9412         dflt="$bin"
9413         : guess some guesses
9414         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9415         $test -d /usr/share/bin     && dflt=/usr/share/bin
9416         $test -d /usr/local/script  && dflt=/usr/local/script
9417         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9418         $test -d $prefixexp/script  && dflt=$prefixexp/script
9419         set dflt
9420         eval $prefixup
9421         ;;
9422 *)  dflt="$scriptdir"
9423         ;;
9424 esac
9425 $cat <<EOM
9426
9427 Some installations have a separate directory just for executable scripts so
9428 that they can mount it across multiple architectures but keep the scripts in
9429 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9430 Or you might just lump your scripts in with all your other executables.
9431
9432 EOM
9433 fn=d~
9434 rp='Where do you keep publicly executable scripts?'
9435 . ./getfile
9436 if $test "X$ansexp" != "X$scriptdirexp"; then
9437         installscript=''
9438 fi
9439 installscriptdir=''
9440 prefixvar=scriptdir
9441 . ./setprefixvar
9442 : A little fix up for an irregularly named variable.
9443 installscript="$installscriptdir"
9444
9445 : determine where add-on public executables go
9446 case "$sitebin" in
9447 '')     dflt=$siteprefix/bin ;;
9448 *)      dflt=$sitebin ;;
9449 esac
9450 fn=d~
9451 rp='Pathname where the add-on public executables should be installed?'
9452 . ./getfile
9453 prefixvar=sitebin
9454 . ./setprefixvar
9455
9456 : determine where add-on html pages go
9457 : There is no standard location, so try to copy the previously-selected
9458 : directory structure for the core html pages.
9459 case "$sitehtml1dir" in
9460 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9461 *)     dflt=$sitehtml1dir ;;
9462 esac
9463 case "$dflt" in
9464 ''|' ') dflt=none ;;
9465 esac
9466 fn=dn+~
9467 rp='Pathname where the site-specific html pages should be installed?'
9468 . ./getfile
9469 prefixvar=sitehtml1dir
9470 . ./setprefixvar
9471
9472 : determine where add-on library html pages go
9473 : There is no standard location, so try to copy the previously-selected
9474 : directory structure for the core html pages.
9475 case "$sitehtml3dir" in
9476 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9477 *)     dflt=$sitehtml3dir ;;
9478 esac
9479 case "$dflt" in
9480 ''|' ') dflt=none ;;
9481 esac
9482 fn=dn+~
9483 rp='Pathname where the site-specific library html pages should be installed?'
9484 . ./getfile
9485 prefixvar=sitehtml3dir
9486 . ./setprefixvar
9487
9488 : determine where add-on manual pages go
9489 case "$siteman1dir" in
9490 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9491 *)      dflt=$siteman1dir ;;
9492 esac
9493 case "$dflt" in
9494 ''|' ') dflt=none ;;
9495 esac
9496 fn=dn+~
9497 rp='Pathname where the site-specific manual pages should be installed?'
9498 . ./getfile
9499 prefixvar=siteman1dir
9500 . ./setprefixvar
9501
9502 : determine where add-on library man pages go
9503 case "$siteman3dir" in
9504 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9505 *)      dflt=$siteman3dir ;;
9506 esac
9507 case "$dflt" in
9508 ''|' ') dflt=none ;;
9509 esac
9510 fn=dn+~
9511 rp='Pathname where the site-specific library manual pages should be installed?'
9512 . ./getfile
9513 prefixvar=siteman3dir
9514 . ./setprefixvar
9515
9516 : determine where add-on public executable scripts go
9517 case "$sitescript" in
9518 '')     dflt=$siteprefix/script
9519         $test -d $dflt || dflt=$sitebin ;;
9520 *)  dflt="$sitescript" ;;
9521 esac
9522 fn=d~+
9523 rp='Pathname where add-on public executable scripts should be installed?'
9524 . ./getfile
9525 prefixvar=sitescript
9526 . ./setprefixvar
9527
9528 : see if backtrace exists
9529 set backtrace d_backtrace
9530 eval $inlibc
9531
9532 : add flags if using c backtrace
9533 case "$usecbacktrace" in
9534   "") usecbacktrace=$undef ;;
9535   [yY]*|true|$define)
9536     case "$d_backtrace" in
9537       [yY]*|true|$define)
9538         case " $ccflags " in
9539           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9540           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9541           esac
9542         ;;
9543       *)
9544         echo "This system does not support backtrace" >&4
9545         usecbacktrace=$undef
9546         ;;
9547       esac
9548     ;;
9549   esac
9550
9551 : Check if faststdio is requested and available
9552 case "$usefaststdio" in
9553 $define|true|[yY]*|'')
9554         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9555         case "$xversion" in
9556         [68])   dflt='y' ;;
9557         *)      dflt='n' ;;
9558         esac
9559         ;;
9560 *) dflt='n';;
9561 esac
9562 cat <<EOM
9563
9564 Perl can be built to use 'fast stdio', which means using the stdio
9565 library but also directly manipulating the stdio buffers to enable
9566 faster I/O.  Using stdio is better for backward compatibility (especially
9567 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9568 interface has been preferred instead of stdio.
9569
9570 If this doesn't make any sense to you, just accept the default '$dflt'.
9571 EOM
9572 rp='Use the "fast stdio" if available?'
9573 . ./myread
9574 case "$ans" in
9575 y|Y)    val="$define" ;;
9576 *)      val="$undef" ;;
9577 esac
9578 set usefaststdio
9579 eval $setvar
9580
9581
9582 : define an is-a-typedef? function
9583 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9584 case "$inclist" in
9585 "") inclist="sys/types.h";;
9586 esac;
9587 eval "varval=\$$var";
9588 case "$varval" in
9589 "")
9590         $rm -f temp.c;
9591         for inc in $inclist; do
9592                 echo "#include <$inc>" >>temp.c;
9593         done;
9594         echo "#ifdef $type" >> temp.c;
9595         echo "printf(\"We have $type\");" >> temp.c;
9596         echo "#endif" >> temp.c;
9597         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9598         if $contains $type temp.E >/dev/null 2>&1; then
9599                 eval "$var=\$type";
9600         else
9601                 eval "$var=\$def";
9602         fi;
9603         $rm -f temp.?;;
9604 *) eval "$var=\$varval";;
9605 esac'
9606
9607 : define an is-a-typedef? function that prompts if the type is not available.
9608 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9609 case "$inclist" in
9610 "") inclist="sys/types.h";;
9611 esac;
9612 eval "varval=\$$var";
9613 case "$varval" in
9614 "")
9615         $rm -f temp.c;
9616         for inc in $inclist; do
9617                 echo "#include <$inc>" >>temp.c;
9618         done;
9619         echo "#ifdef $type" >> temp.c;
9620         echo "printf(\"We have $type\");" >> temp.c;
9621         echo "#endif" >> temp.c;
9622         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9623         echo " " ;
9624         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9625         if $contains $type temp.E >/dev/null 2>&1; then
9626                 echo "$type found." >&4;
9627                 eval "$var=\$type";
9628         else
9629                 echo "$type NOT found." >&4;
9630                 dflt="$def";
9631                 . ./myread ;
9632                 eval "$var=\$ans";
9633         fi;
9634         $rm -f temp.?;;
9635 *) eval "$var=\$varval";;
9636 esac'
9637
9638 : see what type lseek is declared as in the kernel
9639 rp="What is the type used for lseek's offset on this system?"
9640 set off_t lseektype long stdio.h sys/types.h
9641 eval $typedef_ask
9642
9643 echo " "
9644 echo "Checking to see how big your file offsets are..." >&4
9645 $cat >try.c <<EOCP
9646 #include <sys/types.h>
9647 #include <stdio.h>
9648 int main()
9649 {
9650     printf("%d\n", (int)sizeof($lseektype));
9651     return(0);
9652 }
9653 EOCP
9654 set try
9655 if eval $compile_ok; then
9656         lseeksize=`$run ./try`
9657         echo "Your file offsets are $lseeksize bytes long."
9658 else
9659         dflt=$longsize
9660         echo " "
9661         echo "(I can't seem to compile the test program.  Guessing...)"
9662         rp="What is the size of your file offsets (in bytes)?"
9663         . ./myread
9664         lseeksize="$ans"
9665 fi
9666 $rm_try
9667
9668 : see what type file positions are declared as in the library
9669 rp="What is the type for file position used by fsetpos()?"
9670 set fpos_t fpostype long stdio.h sys/types.h
9671 eval $typedef_ask
9672
9673 : Check size for Fpos_t
9674 echo " "
9675 case "$fpostype" in
9676 *_t) zzz="$fpostype"    ;;
9677 *)   zzz="fpos_t"       ;;
9678 esac
9679 echo "Checking the size of $zzz..." >&4
9680 cat > try.c <<EOCP
9681 #include <sys/types.h>
9682 #include <stdio.h>
9683 #$i_stdlib I_STDLIB
9684 #ifdef I_STDLIB
9685 #include <stdlib.h>
9686 #endif
9687 int main() {
9688     printf("%d\n", (int)sizeof($fpostype));
9689     exit(0);
9690 }
9691 EOCP
9692 set try
9693 if eval $compile_ok; then
9694         yyy=`$run ./try`
9695         case "$yyy" in
9696         '')     fpossize=4
9697                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9698                 ;;
9699         *)      fpossize=$yyy
9700                 echo "Your $zzz is $fpossize bytes long."
9701                 ;;
9702         esac
9703 else
9704         dflt="$longsize"
9705         echo " " >&4
9706         echo "(I can't compile the test program.  Guessing...)" >&4
9707         rp="What is the size of your file positions (in bytes)?"
9708         . ./myread
9709         fpossize="$ans"
9710 fi
9711
9712 : Check for large file support
9713 # Backward compatibility (uselfs is deprecated).
9714 case "$uselfs" in
9715 "$define"|true|[yY]*)
9716         cat <<EOM >&4
9717
9718 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9719 EOM
9720         uselargefiles="$define"
9721         ;;
9722 esac
9723
9724 case "$lseeksize:$fpossize" in
9725 8:8) cat <<EOM
9726
9727 You can have files larger than 2 gigabytes.
9728 EOM
9729    val="$define" ;;
9730 *)    case "$uselargefiles" in
9731    "$undef"|false|[nN]*) dflt='n' ;;
9732    *)   dflt='y' ;;
9733    esac
9734    cat <<EOM
9735
9736 Perl can be built to understand large files (files larger than 2 gigabytes)
9737 on some systems.  To do so, Configure can be run with -Duselargefiles.
9738
9739 If this doesn't make any sense to you, just accept the default '$dflt'.
9740 EOM
9741    rp='Try to understand large files, if available?'
9742    . ./myread
9743    case "$ans" in
9744    y|Y)         val="$define" ;;
9745    *)           val="$undef"  ;;
9746    esac
9747    ;;
9748 esac
9749 set uselargefiles
9750 eval $setvar
9751 : Look for a hint-file generated 'call-back-unit'.  If the
9752 : user has specified that a large files perl is to be built,
9753 : we may need to set or change some other defaults.
9754 if $test -f uselargefiles.cbu; then
9755         echo "Your platform has some specific hints regarding large file builds, using them..."
9756         . ./uselargefiles.cbu
9757 fi
9758 case "$uselargefiles" in
9759 "$define")
9760         if $test -f uselargefiles.cbu; then
9761                 echo " "
9762                 echo "Rechecking to see how big your file offsets are..." >&4
9763                 $cat >try.c <<EOCP
9764 #include <sys/types.h>
9765 #include <stdio.h>
9766 int main()
9767 {
9768     printf("%d\n", (int)sizeof($lseektype));
9769     return(0);
9770 }
9771 EOCP
9772                 set try
9773                 if eval $compile_ok; then
9774                         lseeksize=`$run ./try`
9775                         $echo "Your file offsets are now $lseeksize bytes long."
9776                 else
9777                         dflt="$lseeksize"
9778                         echo " "
9779                         echo "(I can't seem to compile the test program.  Guessing...)"
9780                         rp="What is the size of your file offsets (in bytes)?"
9781                         . ./myread
9782                         lseeksize="$ans"
9783                 fi
9784                 case "$fpostype" in
9785                 *_t) zzz="$fpostype"    ;;
9786                 *)   zzz="fpos_t"       ;;
9787                 esac
9788                 $echo $n "Rechecking the size of $zzz...$c" >&4
9789                 $cat > try.c <<EOCP
9790 #include <sys/types.h>
9791 #include <stdio.h>
9792 #$i_stdlib I_STDLIB
9793 #ifdef I_STDLIB
9794 #include <stdlib.h>
9795 #endif
9796 int main() {
9797     printf("%d\n", (int)sizeof($fpostype));
9798     return(0);
9799 }
9800 EOCP
9801                 set try
9802                 if eval $compile_ok; then
9803                         yyy=`$run ./try`
9804                         dflt="$lseeksize"
9805                         case "$yyy" in
9806                         '')     echo " "
9807                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9808                                 ;;
9809                         *)      fpossize=$yyy
9810                                 echo " $fpossize bytes." >&4
9811                                 ;;
9812                         esac
9813                 else
9814                         dflt="$fpossize"
9815                         echo " "
9816                         echo "(I can't compile the test program.  Guessing...)" >&4
9817                         rp="What is the size of your file positions (in bytes)?"
9818                         . ./myread
9819                         fpossize="$ans"
9820                 fi
9821                 $rm_try
9822         fi
9823         ;;
9824 esac
9825
9826 : Check if we want perlio
9827 useperlio="$define"
9828
9829 : Set the vendorbin variables
9830 case "$vendorprefix" in
9831 '')     d_vendorbin="$undef"
9832         vendorbin=''
9833         vendorbinexp=''
9834         ;;
9835 *)      d_vendorbin="$define"
9836         : determine where vendor-supplied executables go.
9837         case "$vendorbin" in
9838         '') dflt=$vendorprefix/bin ;;
9839         *)      dflt="$vendorbin" ;;
9840         esac
9841         fn=d~+
9842         rp='Pathname for the vendor-supplied executables directory?'
9843         . ./getfile
9844         vendorbin="$ans"
9845         vendorbinexp="$ansexp"
9846         ;;
9847 esac
9848 prefixvar=vendorbin
9849 . ./installprefix
9850
9851 : Set the vendorhtml1dir variables
9852 case "$vendorprefix" in
9853 '')     vendorhtml1dir=''
9854         vendorhtml1direxp=''
9855         ;;
9856 *)      : determine where vendor-supplied html pages go.
9857         : There is no standard location, so try to copy the previously-selected
9858         : directory structure for the core html pages.
9859         : XXX Better default suggestions would be welcome.
9860         case "$vendorhtml1dir" in
9861         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9862         *)      dflt=$vendorhtml1dir ;;
9863         esac
9864         case "$dflt" in
9865         ''|' ') dflt=none ;;
9866         esac
9867         fn=dn+~
9868         rp='Pathname for the vendor-supplied html pages?'
9869         . ./getfile
9870         vendorhtml1dir="$ans"
9871         vendorhtml1direxp="$ansexp"
9872         ;;
9873 esac
9874 : Use ' ' for none so value is preserved next time through Configure
9875 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9876 prefixvar=vendorhtml1dir
9877 . ./installprefix
9878
9879 : Set the vendorhtml3dir variables
9880 case "$vendorprefix" in
9881 '')     vendorhtml3dir=''
9882         vendorhtml3direxp=''
9883         ;;
9884 *)      : determine where vendor-supplied module html pages go.
9885         : There is no standard location, so try to copy the previously-selected
9886         : directory structure for the core html pages.
9887         : XXX Better default suggestions would be welcome.
9888         case "$vendorhtml3dir" in
9889         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9890         *)      dflt=$vendorhtml3dir ;;
9891         esac
9892         case "$dflt" in
9893         ''|' ') dflt=none ;;
9894         esac
9895         fn=dn+~
9896         rp='Pathname for the vendor-supplied html pages?'
9897         . ./getfile
9898         vendorhtml3dir="$ans"
9899         vendorhtml3direxp="$ansexp"
9900         ;;
9901 esac
9902 : Use ' ' for none so value is preserved next time through Configure
9903 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9904 prefixvar=vendorhtml3dir
9905 . ./installprefix
9906
9907 : Set the vendorman1dir variables
9908 case "$vendorprefix" in
9909 '')     vendorman1dir=''
9910         vendorman1direxp=''
9911         ;;
9912 *)      : determine where vendor-supplied manual pages go.
9913         case "$vendorman1dir" in
9914         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9915         *)      dflt=$vendorman1dir ;;
9916         esac
9917         case "$dflt" in
9918         ''|' ') dflt=none ;;
9919         esac
9920         fn=nd~+
9921         rp='Pathname for the vendor-supplied manual section 1 pages?'
9922         . ./getfile
9923         vendorman1dir="$ans"
9924         vendorman1direxp="$ansexp"
9925         ;;
9926 esac
9927 : Use ' ' for none so value is preserved next time through Configure
9928 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9929 prefixvar=vendorman1dir
9930 . ./installprefix
9931
9932 : Set the vendorman3dir variables
9933 case "$vendorprefix" in
9934 '')     vendorman3dir=''
9935         vendorman3direxp=''
9936         ;;
9937 *)      : determine where vendor-supplied module manual pages go.
9938         case "$vendorman3dir" in
9939         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9940         *)      dflt=$vendorman3dir ;;
9941         esac
9942         case "$dflt" in
9943         ''|' ') dflt=none ;;
9944         esac
9945         fn=nd~+
9946         rp='Pathname for the vendor-supplied manual section 3 pages?'
9947         . ./getfile
9948         vendorman3dir="$ans"
9949         vendorman3direxp="$ansexp"
9950         ;;
9951 esac
9952 : Use ' ' for none so value is preserved next time through Configure
9953 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9954 prefixvar=vendorman3dir
9955 . ./installprefix
9956
9957 : Set the vendorscript variables
9958 case "$vendorprefix" in
9959 '')     d_vendorscript="$undef"
9960         vendorscript=''
9961         vendorscriptexp=''
9962         ;;
9963 *)      d_vendorscript="$define"
9964         : determine where vendor-supplied scripts go.
9965         case "$vendorscript" in
9966         '')     dflt=$vendorprefix/script
9967                 $test -d $dflt || dflt=$vendorbin ;;
9968         *)  dflt="$vendorscript" ;;
9969         esac
9970         $cat <<EOM
9971
9972 The installation process will create a directory for
9973 vendor-supplied scripts.
9974
9975 EOM
9976         fn=d~+
9977         rp='Pathname for the vendor-supplied scripts directory?'
9978         . ./getfile
9979         vendorscript="$ans"
9980         vendorscriptexp="$ansexp"
9981         ;;
9982 esac
9983 prefixvar=vendorscript
9984 . ./installprefix
9985
9986 : script used to emit important warnings
9987 cat >warn <<EOS
9988 $startsh
9989 if test \$# -gt 0; then
9990         echo "\$@" >msg
9991 else
9992         cat >msg
9993 fi
9994 echo "*** WARNING:" >&4
9995 sed -e 's/^/*** /' <msg >&4
9996 echo "*** " >&4
9997 cat msg >>config.msg
9998 echo " " >>config.msg
9999 rm -f msg
10000 EOS
10001 chmod +x warn
10002 $eunicefix warn
10003
10004 : see which of string.h or strings.h is needed
10005 echo " "
10006 strings=`./findhdr string.h`
10007 if $test "$strings" && $test -r "$strings"; then
10008         echo "Using <string.h> instead of <strings.h>." >&4
10009         val="$define"
10010 else
10011         val="$undef"
10012         strings=`./findhdr strings.h`
10013         if $test "$strings" && $test -r "$strings"; then
10014                 echo "Using <strings.h> instead of <string.h>." >&4
10015         else
10016                 ./warn "No string header found -- You'll surely have problems."
10017         fi
10018 fi
10019 set i_string
10020 eval $setvar
10021 case "$i_string" in
10022 "$undef") strings=`./findhdr strings.h`;;
10023 *)        strings=`./findhdr string.h`;;
10024 esac
10025
10026 : see if qgcvt exists
10027 set qgcvt d_qgcvt
10028 eval $inlibc
10029
10030 : Check what kind of doubles your system has
10031 $echo "Checking the kind of doubles you have..." >&4
10032 $cat >try.c <<EOP
10033 #$i_stdlib I_STDLIB
10034 #define DOUBLESIZE $doublesize
10035 #ifdef I_STDLIB
10036 #include <stdlib.h>
10037 #endif
10038 #include <stdio.h>
10039 static const double d = -0.1;
10040 int main() {
10041   unsigned const char* b = (unsigned const char*)(&d);
10042 #if DOUBLESIZE == 4
10043   if (b[0] == 0xCD && b[3] == 0xBD) {
10044     /* IEEE 754 32-bit little-endian */
10045     printf("1\n");
10046     exit(0);
10047   }
10048   if (b[0] == 0xBD && b[3] == 0xCD) {
10049     /* IEEE 754 32-bit big-endian */
10050     printf("2\n");
10051     exit(0);
10052   }
10053 #endif
10054 #if DOUBLESIZE == 8
10055   if (b[0] == 0x9A && b[7] == 0xBF) {
10056     /* IEEE 754 64-bit little-endian */
10057     printf("3\n");
10058     exit(0);
10059   }
10060   if (b[0] == 0xBF && b[7] == 0x9A) {
10061     /* IEEE 754 64-bit big-endian */
10062     printf("4\n");
10063     exit(0);
10064   }
10065   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10066    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10067     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10068     * 99 99 b9 bf 9a 99 99 99 */
10069     printf("7\n");
10070     exit(0);
10071   }
10072   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10073    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10074     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10075     * 99 99 99 9a bf b9 99 99 */
10076     printf("8\n");
10077     exit(0);
10078   }
10079 #endif
10080 #if DOUBLESIZE == 16
10081   if (b[0] == 0x9A && b[15] == 0xBF) {
10082     /* IEEE 754 128-bit little-endian */
10083     printf("5\n");
10084     exit(0);
10085   }
10086   if (b[0] == 0xBF && b[15] == 0x9A) {
10087     /* IEEE 754 128-bit big-endian */
10088     printf("6\n");
10089     exit(0);
10090   }
10091 #endif
10092   /* Then there are old mainframe/miniframe formats like VAX, IBM, and CRAY.
10093    * Whether those environments can still build Perl is debatable. */
10094   printf("-1\n"); /* unknown */
10095   exit(0);
10096 }
10097 EOP
10098 set try
10099 if eval $compile; then
10100     doublekind=`$run ./try`
10101 else
10102     doublekind=-1
10103 fi
10104 case "$doublekind" in
10105 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10106 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10107 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10108 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10109 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10110 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10111 *) echo "Cannot figure out your double.  You VAX, or something?" >&4 ;;
10112 esac
10113 $rm_try
10114
10115 : Check print/scan long double stuff
10116 echo " "
10117
10118 if $test X"$d_longdbl" = X"$define"; then
10119
10120 echo "Checking how to print long doubles..." >&4
10121
10122 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10123         $cat >try.c <<'EOCP'
10124 #include <sys/types.h>
10125 #include <stdio.h>
10126 int main() {
10127   double d = 123.456;
10128   printf("%.3f\n", d);
10129 }
10130 EOCP
10131         set try
10132         if eval $compile; then
10133                 yyy=`$run ./try`
10134                 case "$yyy" in
10135                 123.456)
10136                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10137                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10138                         echo "We will use %f."
10139                         ;;
10140                 esac
10141         fi
10142 fi
10143
10144 if $test X"$sPRIfldbl" = X; then
10145         $cat >try.c <<'EOCP'
10146 #include <sys/types.h>
10147 #include <stdio.h>
10148 int main() {
10149   long double d = 123.456;
10150   printf("%.3Lf\n", d);
10151 }
10152 EOCP
10153         set try
10154         if eval $compile; then
10155                 yyy=`$run ./try`
10156                 case "$yyy" in
10157                 123.456)
10158                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10159                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10160                         echo "We will use %Lf."
10161                         ;;
10162                 esac
10163         fi
10164 fi
10165
10166 if $test X"$sPRIfldbl" = X; then
10167         $cat >try.c <<'EOCP'
10168 #include <sys/types.h>
10169 #include <stdio.h>
10170 int main() {
10171   long double d = 123.456;
10172   printf("%.3llf\n", d);
10173 }
10174 EOCP
10175         set try
10176         if eval $compile; then
10177                 yyy=`$run ./try`
10178                 case "$yyy" in
10179                 123.456)
10180                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10181                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10182                         echo "We will use %llf."
10183                         ;;
10184                 esac
10185         fi
10186 fi
10187
10188 if $test X"$sPRIfldbl" = X; then
10189         $cat >try.c <<'EOCP'
10190 #include <sys/types.h>
10191 #include <stdio.h>
10192 int main() {
10193   long double d = 123.456;
10194   printf("%.3lf\n", d);
10195 }
10196 EOCP
10197         set try
10198         if eval $compile; then
10199                 yyy=`$run ./try`
10200                 case "$yyy" in
10201                 123.456)
10202                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10203                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10204                         echo "We will use %lf."
10205                         ;;
10206                 esac
10207         fi
10208 fi
10209
10210 if $test X"$sPRIfldbl" = X; then
10211         echo "Cannot figure out how to print long doubles." >&4
10212 else
10213         sSCNfldbl=$sPRIfldbl    # expect consistency
10214 fi
10215
10216 $rm_try
10217
10218 fi # d_longdbl
10219
10220 case "$sPRIfldbl" in
10221 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10222         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10223         d_SCNfldbl="$undef";
10224         ;;
10225 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10226         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10227         d_SCNfldbl="$define";
10228         ;;
10229 esac
10230
10231 : Before committing on uselongdouble, see whether that looks sane.
10232 if $test "$uselongdouble" = "$define"; then
10233     message=""
10234     echo " "
10235     echo "Checking if your long double math functions work right..." >&4
10236     $cat > try.c <<EOF
10237 #include <math.h>
10238 #include <stdio.h>
10239 int main() {
10240   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10241 }
10242 EOF
10243     case "$osname:$gccversion" in
10244     aix:)       saveccflags="$ccflags"
10245                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10246     esac
10247     set try
10248     if eval $compile_ok; then
10249       yyy=`$run ./try`
10250     fi
10251     case "$yyy" in
10252     3) echo "Your long double math functions are working correctly." >&4 ;;
10253     *) echo "Your long double math functions are broken, not using long doubles." >&4
10254        uselongdouble=$undef
10255        ;;
10256     esac
10257     $rm_try
10258     case "$osname:$gccversion" in
10259     aix:)       ccflags="$saveccflags" ;; # restore
10260     esac
10261 fi
10262
10263 : Check how to convert floats to strings.
10264
10265 if test "X$d_Gconvert" = X; then
10266
10267 echo " "
10268 echo "Checking for an efficient way to convert floats to strings."
10269 echo " " > try.c
10270 case "$uselongdouble" in
10271 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10272 esac
10273 case "$d_longdbl" in
10274 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10275 esac
10276 case "$d_PRIgldbl" in
10277 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10278 esac
10279 $cat >>try.c <<EOP
10280 #ifdef TRY_gconvert
10281 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10282 char *myname = "gconvert";
10283 #endif
10284 #ifdef TRY_gcvt
10285 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10286 char *myname = "gcvt";
10287 #endif
10288 #ifdef TRY_qgcvt
10289 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10290 char *myname = "qgcvt";
10291 #define DOUBLETYPE long double
10292 #endif
10293 #ifdef TRY_sprintf
10294 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10295 #ifdef HAS_PRIgldbl
10296 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10297 #else
10298 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10299 #endif
10300 #else
10301 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10302 #endif
10303 char *myname = "sprintf";
10304 #endif
10305
10306 #ifndef DOUBLETYPE
10307 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10308 #define DOUBLETYPE long double
10309 #else
10310 #define DOUBLETYPE double
10311 #endif
10312 #endif
10313
10314 #include <stdio.h>
10315
10316 #$i_stdlib I_STDLIB
10317 #ifdef I_STDLIB
10318 #include <stdlib.h>
10319 #endif
10320 #$i_string I_STRING
10321 #ifdef I_STRING
10322 #  include <string.h>
10323 #else
10324 #  include <strings.h>
10325 #endif
10326
10327 int checkit(char *expect, char *got)
10328 {
10329     if (strcmp(expect, got)) {
10330                 printf("%s oddity:  Expected %s, got %s\n",
10331                         myname, expect, got);
10332                 exit(1);
10333         }
10334 }
10335
10336 int main()
10337 {
10338         char buf[64];
10339         buf[63] = '\0';
10340
10341         /* This must be 1st test on (which?) platform */
10342         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10343         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10344         checkit("0.1", buf);
10345
10346         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10347         checkit("0.01", buf);
10348
10349         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10350         checkit("0.001", buf);
10351
10352         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10353         checkit("0.0001", buf);
10354
10355         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10356         if (strlen(buf) > 5)
10357             checkit("9e-005", buf); /* for Microsoft ?? */
10358         else
10359             checkit("9e-05", buf);
10360
10361         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10362         checkit("1", buf);
10363
10364         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10365         checkit("1.1", buf);
10366
10367         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10368         checkit("1.01", buf);
10369
10370         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10371         checkit("1.001", buf);
10372
10373         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10374         checkit("1.0001", buf);
10375
10376         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10377         checkit("1.00001", buf);
10378
10379         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10380         checkit("1.000001", buf);
10381
10382         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10383         checkit("0", buf);
10384
10385         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10386         checkit("-1", buf);
10387
10388         /* Some Linux gcvt's give 1.e+5 here. */
10389         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10390         checkit("100000", buf);
10391
10392         /* Some Linux gcvt's give -1.e+5 here. */
10393         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10394         checkit("-100000", buf);
10395
10396         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10397         checkit("123.456", buf);
10398
10399         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10400         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10401         /* 34 should be enough to scare even long double
10402          * places into using the e notation. */
10403         if (strlen(buf) > 5)
10404             checkit("1e+034", buf); /* for Microsoft */
10405         else
10406             checkit("1e+34", buf);
10407
10408         /* For Perl, if you add additional tests here, also add them to
10409          * t/base/num.t for benefit of platforms not using Configure or
10410          * overriding d_Gconvert */
10411
10412         exit(0);
10413 }
10414 EOP
10415 : first add preferred functions to our list
10416 xxx_list=""
10417 for xxx_convert in $gconvert_preference; do
10418     case $xxx_convert in
10419     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10420     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10421     esac
10422 done
10423 : then add any others
10424 for xxx_convert in gconvert gcvt sprintf; do
10425     case "$xxx_list" in
10426     *$xxx_convert*) ;;
10427     *) xxx_list="$xxx_list $xxx_convert" ;;
10428     esac
10429 done
10430
10431 case "$d_longdbl$uselongdouble" in
10432 "$define$define")
10433     : again, add preferred functions to our list first
10434     xxx_ld_list=""
10435     for xxx_convert in $gconvert_ld_preference; do
10436         case $xxx_convert in
10437         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10438         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10439         esac
10440     done
10441     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10442     for xxx_convert in qgcvt sprintf $xxx_list; do
10443         case "$xxx_ld_list" in
10444         $xxx_convert*|*" $xxx_convert"*) ;;
10445         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10446         esac
10447     done
10448     : if sprintf cannot do long doubles, move it to the end
10449     if test "$d_PRIgldbl" != "$define"; then
10450         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10451     fi
10452     : if no qgcvt, remove it
10453     if test "$d_qgcvt" != "$define"; then
10454         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10455     fi
10456     : use the ld_list
10457     xxx_list="$xxx_ld_list"
10458     ;;
10459 esac
10460
10461 for xxx_convert in $xxx_list; do
10462         echo "Trying $xxx_convert..."
10463         $rm -f try try$_o core
10464         set try -DTRY_$xxx_convert
10465         if eval $compile; then
10466                 echo "$xxx_convert() found." >&4
10467                 if $run ./try; then
10468                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10469                         break;
10470                 else
10471                         echo "...But $xxx_convert didn't work as I expected."
10472                         xxx_convert=''
10473                 fi
10474         else
10475                 echo "$xxx_convert NOT found." >&4
10476         fi
10477 done
10478
10479 if test X$xxx_convert = X; then
10480     echo "*** WHOA THERE!!! ***" >&4
10481     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10482     xxx_convert=sprintf
10483 fi
10484
10485 case "$xxx_convert" in
10486 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10487 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10488 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10489 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10490    "$define$define$define")
10491       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10492    "$define$define$undef")
10493       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10494    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10495    esac
10496    ;;
10497 esac
10498
10499 fi
10500 $rm_try
10501
10502 : see if _fwalk exists
10503 set fwalk d__fwalk
10504 eval $inlibc
10505
10506 : Initialize h_fcntl
10507 h_fcntl=false
10508
10509 : Initialize h_sysfile
10510 h_sysfile=false
10511
10512 : access call always available on UNIX
10513 set access d_access
10514 eval $inlibc
10515
10516 : locate the flags for 'access()'
10517 case "$d_access" in
10518 "$define")
10519         echo " "
10520         $cat >access.c <<EOCP
10521 #include <sys/types.h>
10522 #ifdef I_FCNTL
10523 #include <fcntl.h>
10524 #endif
10525 #ifdef I_SYS_FILE
10526 #include <sys/file.h>
10527 #endif
10528 #ifdef I_UNISTD
10529 #include <unistd.h>
10530 #endif
10531 #$i_stdlib I_STDLIB
10532 #ifdef I_STDLIB
10533 #include <stdlib.h>
10534 #endif
10535 int main() {
10536         exit(R_OK);
10537 }
10538 EOCP
10539         : check sys/file.h first, no particular reason here
10540         if $test `./findhdr sys/file.h` && \
10541                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10542                 h_sysfile=true;
10543                 echo "<sys/file.h> defines the *_OK access constants." >&4
10544         elif $test `./findhdr fcntl.h` && \
10545                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10546                 h_fcntl=true;
10547                 echo "<fcntl.h> defines the *_OK access constants." >&4
10548         elif $test `./findhdr unistd.h` && \
10549                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10550                 echo "<unistd.h> defines the *_OK access constants." >&4
10551         else
10552                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10553         fi
10554         ;;
10555 esac
10556 $rm -f access*
10557
10558 : see if accessx exists
10559 set accessx d_accessx
10560 eval $inlibc
10561
10562 : see if acosh exists
10563 set acosh d_acosh
10564 eval $inlibc
10565
10566 : see if aintl exists
10567 set aintl d_aintl
10568 eval $inlibc
10569
10570 : see if alarm exists
10571 set alarm d_alarm
10572 eval $inlibc
10573
10574 : see if 64bit time functions exists
10575
10576 set ctime64 d_ctime64
10577 eval $inlibc
10578
10579 set localtime64 d_localtime64
10580 eval $inlibc
10581
10582 set gmtime64 d_gmtime64
10583 eval $inlibc
10584
10585 set mktime64 d_mktime64
10586 eval $inlibc
10587
10588 set difftime64 d_difftime64
10589 eval $inlibc
10590
10591 set asctime64 d_asctime64
10592 eval $inlibc
10593
10594 : see if POSIX threads are available
10595 set pthread.h i_pthread
10596 eval $inhdr
10597
10598 : define a function to check prototypes
10599 $cat > protochk <<EOSH
10600 $startsh
10601 cc="$cc"
10602 optimize="$optimize"
10603 ccflags="$ccflags"
10604 prototype="$prototype"
10605 define="$define"
10606 rm_try="$rm_try"
10607 usethreads=$usethreads
10608 i_pthread=$i_pthread
10609 pthread_h_first=$pthread_h_first
10610 EOSH
10611
10612 $cat >> protochk <<'EOSH'
10613
10614 $rm_try
10615 foo="$1"
10616 shift
10617 while test $# -ge 2; do
10618         case "$1" in
10619                 $define) echo "#include <$2>" >> try.c ;;
10620                 literal) echo "$2" >> try.c ;;
10621         esac
10622     # Extra magic for the benefit of systems that need pthread.h
10623     # to be included early to correctly detect threadsafe functions.
10624     # Such functions must guarantee themselves, though, that the usethreads
10625     # and i_pthread have been defined, before calling protochk.
10626     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10627         echo "#include <pthread.h>" >> try.c
10628         pthread_h_done=yes
10629     fi
10630     shift 2
10631 done
10632 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10633 cat >> try.c <<'EOCP'
10634 #ifdef CAN_PROTOTYPE
10635 #define _(args) args
10636 #else
10637 #define _(args) ()
10638 #endif
10639 EOCP
10640 echo "$foo" >> try.c
10641 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10642 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10643 status=$?
10644 $rm_try
10645 exit $status
10646 EOSH
10647 chmod +x protochk
10648 $eunicefix protochk
10649
10650 : Define hasproto macro for Configure internal use
10651 hasproto='varname=$1; func=$2; shift; shift;
10652 while $test $# -ge 2; do
10653         case "$1" in
10654         $define) echo "#include <$2>";;
10655         esac ;
10656     shift 2;
10657 done > try.c;
10658 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10659 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10660         echo "$func() prototype found.";
10661         val="$define";
10662 else
10663         echo "$func() prototype NOT found.";
10664         val="$undef";
10665 fi;
10666 set $varname;
10667 eval $setvar;
10668 $rm_try tryout.c'
10669
10670 : see if sys/types.h has to be included
10671 set sys/types.h i_systypes
10672 eval $inhdr
10673
10674 : see if sys/select.h has to be included
10675 set sys/select.h i_sysselct
10676 eval $inhdr
10677
10678 : Define hasfield macro for Configure internal use
10679 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10680 while $test $# -ge 2; do
10681         case "$1" in
10682         $define) echo "#include <$2>";;
10683         esac ;
10684     shift 2;
10685 done > try.c;
10686 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10687 set try;
10688 if eval $compile; then
10689         val="$define";
10690 else
10691         val="$undef";
10692 fi;
10693 set $varname;
10694 eval $setvar;
10695 $rm_try'
10696
10697 : see if we should include time.h, sys/time.h, or both
10698 echo " "
10699 if test "X$timeincl" = X; then
10700         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10701         $echo $n "I'm now running the test program...$c"
10702         $cat >try.c <<EOCP
10703 #include <sys/types.h>
10704 #ifdef I_TIME
10705 #include <time.h>
10706 #endif
10707 #ifdef I_SYSTIME
10708 #ifdef SYSTIMEKERNEL
10709 #define KERNEL
10710 #endif
10711 #include <sys/time.h>
10712 #endif
10713 #ifdef I_SYSSELECT
10714 #include <sys/select.h>
10715 #endif
10716 #$i_stdlib I_STDLIB
10717 #ifdef I_STDLIB
10718 #include <stdlib.h>
10719 #endif
10720 int main()
10721 {
10722         struct tm foo;
10723 #ifdef S_TIMEVAL
10724         struct timeval bar;
10725 #endif
10726 #ifdef S_TIMEZONE
10727         struct timezone tzp;
10728 #endif
10729         if (foo.tm_sec == foo.tm_sec)
10730                 exit(0);
10731 #ifdef S_TIMEVAL
10732         if (bar.tv_sec == bar.tv_sec)
10733                 exit(0);
10734 #endif
10735         exit(1);
10736 }
10737 EOCP
10738         flags=''
10739         for s_timezone in '-DS_TIMEZONE' ''; do
10740         sysselect=''
10741         for s_timeval in '-DS_TIMEVAL' ''; do
10742         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10743         for i_time in '' '-DI_TIME'; do
10744         for i_systime in '-DI_SYSTIME' ''; do
10745                 case "$flags" in
10746                 '') $echo $n ".$c"
10747                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10748                         if eval $compile; then
10749                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10750                                 shift
10751                                 flags="$*"
10752                                 echo " "
10753                                 $echo $n "Succeeded with $flags$c"
10754                         fi
10755                         ;;
10756                 esac
10757         done
10758         done
10759         done
10760         done
10761         done
10762         timeincl=''
10763         echo " "
10764         case "$flags" in
10765         *SYSTIMEKERNEL*) i_systimek="$define"
10766                 timeincl=`./findhdr sys/time.h`
10767                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10768         *) i_systimek="$undef";;
10769         esac
10770         case "$flags" in
10771         *I_TIME*) i_time="$define"
10772                 timeincl=`./findhdr time.h`" $timeincl"
10773                 echo "We'll include <time.h>." >&4;;
10774         *) i_time="$undef";;
10775         esac
10776         case "$flags" in
10777         *I_SYSTIME*) i_systime="$define"
10778                 timeincl=`./findhdr sys/time.h`" $timeincl"
10779                 echo "We'll include <sys/time.h>." >&4;;
10780         *) i_systime="$undef";;
10781         esac
10782         $rm_try
10783 fi
10784 : see if struct tm knows about tm_zone
10785 case "$i_systime$i_time" in
10786 *$define*)
10787         echo " "
10788         echo "Checking to see if your struct tm has tm_zone field..." >&4
10789         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10790         eval $hasfield
10791         ;;
10792 *)      val="$undef"
10793         set d_tm_tm_zone
10794         eval $setvar
10795         ;;
10796 esac
10797 case "$d_tm_tm_zone" in
10798 "$define")      echo "Yes, it does."   ;;
10799 *)              echo "No, it doesn't." ;;
10800 esac
10801 : see if struct tm knows about tm_gmtoff
10802 case "$i_systime$i_time" in
10803 *$define*)
10804         echo " "
10805         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10806         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10807         eval $hasfield
10808         ;;
10809 *)      val="$undef"
10810         set d_tm_tm_gmtoff
10811         eval $setvar
10812         ;;
10813 esac
10814 case "$d_tm_tm_gmtoff" in
10815 "$define")      echo "Yes, it does."   ;;
10816 *)              echo "No, it doesn't." ;;
10817 esac
10818
10819 : see if asctime_r exists
10820 set asctime_r d_asctime_r
10821 eval $inlibc
10822 case "$d_asctime_r" in
10823 "$define")
10824         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10825         case "$d_asctime_r_proto:$usethreads" in
10826         ":define")      d_asctime_r_proto=define
10827                 set d_asctime_r_proto asctime_r $hdrs
10828                 eval $hasproto ;;
10829         *)      ;;
10830         esac
10831         case "$d_asctime_r_proto" in
10832         define)
10833         case "$asctime_r_proto" in
10834         ''|0) try='char* asctime_r(const struct tm*, char*);'
10835         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10836         esac
10837         case "$asctime_r_proto" in
10838         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10839         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10840         esac
10841         case "$asctime_r_proto" in
10842         ''|0) try='int asctime_r(const struct tm*, char*);'
10843         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10844         esac
10845         case "$asctime_r_proto" in
10846         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10847         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10848         esac
10849         case "$asctime_r_proto" in
10850         ''|0)   d_asctime_r=undef
10851                 asctime_r_proto=0
10852                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10853         * )     case "$asctime_r_proto" in
10854                 REENTRANT_PROTO*) ;;
10855                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10856                 esac
10857                 echo "Prototype: $try" ;;
10858         esac
10859         ;;
10860         *)      case "$usethreads" in
10861                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10862                 esac
10863                 d_asctime_r=undef
10864                 asctime_r_proto=0
10865                 ;;
10866         esac
10867         ;;
10868 *)      asctime_r_proto=0
10869         ;;
10870 esac
10871
10872 : see if asinh exists
10873 set asinh d_asinh
10874 eval $inlibc
10875
10876 : see if atanh exists
10877 set atanh d_atanh
10878 eval $inlibc
10879
10880 : see if atolf exists
10881 set atolf d_atolf
10882 eval $inlibc
10883
10884 : see if atoll exists
10885 set atoll d_atoll
10886 eval $inlibc
10887
10888 : Look for GCC-style attribute format
10889 case "$d_attribute_format" in
10890 '')
10891 echo " "
10892 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10893 $cat >attrib.c <<'EOCP'
10894 #include <stdio.h>
10895 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10896 EOCP
10897 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10898         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10899                 echo "Your C compiler doesn't support __attribute__((format))."
10900                 val="$undef"
10901         else
10902                 echo "Your C compiler supports __attribute__((format))."
10903                 val="$define"
10904         fi
10905 else
10906         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10907         val="$undef"
10908 fi
10909 ;;
10910 *) val="$d_attribute_format" ;;
10911 esac
10912 set d_attribute_format
10913 eval $setvar
10914 $rm -f attrib*
10915
10916 : Look for GCC-style attribute format with null format allowed
10917 case "$d_printf_format_null" in
10918 '') case "$d_attribute_format" in
10919     $define)
10920         echo " "
10921         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10922 $cat >attrib.c <<EOCP
10923 #include <stdio.h>
10924 #$i_stdlib I_STDLIB
10925 #ifdef I_STDLIB
10926 #include <stdlib.h>
10927 #endif
10928 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10929 int null_printf (char* pat,...) { return (int)pat; }
10930 int main () { exit(null_printf(NULL)); }
10931 EOCP
10932         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10933             : run the executable in case it produces a run-time warning
10934             if $run ./attrib >>attrib.out 2>&1; then
10935                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10936                     echo "Your C compiler doesn't allow __printf__ format to be null."
10937                     val="$undef"
10938                 else
10939                     echo "Your C compiler allows __printf__ format to be null."
10940                     val="$define"
10941                 fi
10942             else
10943             echo "Your C compiler executable failed with __printf__ format null."
10944             val="$undef"
10945         fi
10946     else
10947         echo "Your C compiler fails with __printf__ format null."
10948         val="$undef"
10949     fi
10950     ;;
10951     *)  val="$undef" ;;
10952     esac
10953 ;;
10954 *)  val="$d_printf_format_null" ;;
10955 esac
10956 set d_printf_format_null
10957 eval $setvar
10958 $rm -f attrib*
10959
10960 : Look for GCC-style attribute malloc
10961 case "$d_attribute_malloc" in
10962 '')
10963 echo " "
10964 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10965 $cat >attrib.c <<'EOCP'
10966 #include <stdio.h>
10967 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10968 EOCP
10969 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10970         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10971                 echo "Your C compiler doesn't support __attribute__((malloc))."
10972                 val="$undef"
10973         else
10974                 echo "Your C compiler supports __attribute__((malloc))."
10975                 val="$define"
10976         fi
10977 else
10978         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10979         val="$undef"
10980 fi
10981 ;;
10982 *) val="$d_attribute_malloc" ;;
10983 esac
10984 set d_attribute_malloc
10985 eval $setvar
10986 $rm -f attrib*
10987
10988 : Look for GCC-style attribute nonnull
10989 case "$d_attribute_nonnull" in
10990 '')
10991 echo " "
10992 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10993 $cat >attrib.c <<'EOCP'
10994 #include <stdio.h>
10995 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10996 EOCP
10997 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10998         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10999                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11000                 val="$undef"
11001         else
11002                 echo "Your C compiler supports __attribute__((nonnull))."
11003                 val="$define"
11004         fi
11005 else
11006         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11007         val="$undef"
11008 fi
11009 ;;
11010 *) val="$d_attribute_nonnull" ;;
11011 esac
11012 set d_attribute_nonnull
11013 eval $setvar
11014 $rm -f attrib*
11015
11016 : Look for GCC-style attribute noreturn
11017 case "$d_attribute_noreturn" in
11018 '')
11019 echo " "
11020 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11021 $cat >attrib.c <<'EOCP'
11022 #include <stdio.h>
11023 void fall_over_dead( void ) __attribute__((noreturn));
11024 EOCP
11025 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11026         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11027                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11028                 val="$undef"
11029         else
11030                 echo "Your C compiler supports __attribute__((noreturn))."
11031                 val="$define"
11032         fi
11033 else
11034         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11035         val="$undef"
11036 fi
11037 ;;
11038 *) val="$d_attribute_noreturn" ;;
11039 esac
11040 set d_attribute_noreturn
11041 eval $setvar
11042 $rm -f attrib*
11043
11044 : Look for GCC-style attribute pure
11045 case "$d_attribute_pure" in
11046 '')
11047 echo " "
11048 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11049 $cat >attrib.c <<'EOCP'
11050 #include <stdio.h>
11051 int square( int n ) __attribute__((pure));
11052 EOCP
11053 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11054         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11055                 echo "Your C compiler doesn't support __attribute__((pure))."
11056                 val="$undef"
11057         else
11058                 echo "Your C compiler supports __attribute__((pure))."
11059                 val="$define"
11060         fi
11061 else
11062         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11063         val="$undef"
11064 fi
11065 ;;
11066 *) val="$d_attribute_pure" ;;
11067 esac
11068 set d_attribute_pure
11069 eval $setvar
11070 $rm -f attrib*
11071
11072 : Look for GCC-style attribute unused
11073 case "$d_attribute_unused" in
11074 '')
11075 echo " "
11076 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11077 $cat >attrib.c <<'EOCP'
11078 #include <stdio.h>
11079 int do_something( int dummy __attribute__((unused)), int n );
11080 EOCP
11081 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11082         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11083                 echo "Your C compiler doesn't support __attribute__((unused))."
11084                 val="$undef"
11085         else
11086                 echo "Your C compiler supports __attribute__((unused))."
11087                 val="$define"
11088         fi
11089 else
11090         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11091         val="$undef"
11092 fi
11093 ;;
11094 *) val="$d_attribute_unused" ;;
11095 esac
11096 set d_attribute_unused
11097 eval $setvar
11098 $rm -f attrib*
11099
11100 : Look for GCC-style attribute deprecated
11101 case "$d_attribute_deprecated" in
11102 '')
11103 echo " "
11104 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11105 $cat >attrib.c <<'EOCP'
11106 #include <stdio.h>
11107 int I_am_deprecated(void) __attribute__((deprecated));
11108 EOCP
11109 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11110         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11111                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11112                 val="$undef"
11113         else
11114                 echo "Your C compiler supports __attribute__((deprecated))."
11115                 val="$define"
11116         fi
11117 else
11118         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11119         val="$undef"
11120 fi
11121 ;;
11122 *) val="$d_attribute_deprecated" ;;
11123 esac
11124 set d_attribute_deprecated
11125 eval $setvar
11126 $rm -f attrib*
11127
11128 : Look for GCC-style attribute warn_unused_result
11129 case "$d_attribute_warn_unused_result" in
11130 '')
11131 echo " "
11132 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11133 $cat >attrib.c <<'EOCP'
11134 #include <stdio.h>
11135 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11136 EOCP
11137 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11138         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11139                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11140                 val="$undef"
11141         else
11142                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11143                 val="$define"
11144         fi
11145 else
11146         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11147         val="$undef"
11148 fi
11149 ;;
11150 *) val="$d_attribute_warn_unused_result" ;;
11151 esac
11152 set d_attribute_warn_unused_result
11153 eval $setvar
11154 $rm -f attrib*
11155
11156 : see if bcmp exists
11157 set bcmp d_bcmp
11158 eval $inlibc
11159
11160 : see if bcopy exists
11161 set bcopy d_bcopy
11162 eval $inlibc
11163
11164 : see if getpgrp exists
11165 set getpgrp d_getpgrp
11166 eval $inlibc
11167
11168 case "$d_getpgrp" in
11169 "$define")
11170         echo " "
11171         echo "Checking to see which flavor of getpgrp is in use..."
11172         $cat >try.c <<EOP
11173 #$i_unistd I_UNISTD
11174 #include <sys/types.h>
11175 #ifdef I_UNISTD
11176 #  include <unistd.h>
11177 #endif
11178 #$i_stdlib I_STDLIB
11179 #ifdef I_STDLIB
11180 #include <stdlib.h>
11181 #endif
11182 int main()
11183 {
11184         if (getuid() == 0) {
11185                 printf("(I see you are running Configure as super-user...)\n");
11186                 setuid(1);
11187         }
11188 #ifdef TRY_BSD_PGRP
11189         if (getpgrp(1) == 0)
11190                 exit(0);
11191 #else
11192         if (getpgrp() > 0)
11193                 exit(0);
11194 #endif
11195         exit(1);
11196 }
11197 EOP
11198         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11199                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11200                 val="$define"
11201         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11202                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11203                 val="$undef"
11204         else
11205                 echo "I can't seem to compile and run the test program."
11206                 if ./usg; then
11207                         xxx="a USG one, i.e. you use getpgrp()."
11208                 else
11209                         # SVR4 systems can appear rather BSD-ish.
11210                         case "$i_unistd" in
11211                         $undef)
11212                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11213                                 val="$define"
11214                                 ;;
11215                         $define)
11216                                 xxx="probably a USG one, i.e. you use getpgrp()."
11217                                 val="$undef"
11218                                 ;;
11219                         esac
11220                 fi
11221                 echo "Assuming your getpgrp is $xxx" >&4
11222         fi
11223         ;;
11224 *) val="$undef";;
11225 esac
11226 set d_bsdgetpgrp
11227 eval $setvar
11228 $rm_try
11229
11230 : see if setpgrp exists
11231 set setpgrp d_setpgrp
11232 eval $inlibc
11233
11234 case "$d_setpgrp" in
11235 "$define")
11236         echo " "
11237         echo "Checking to see which flavor of setpgrp is in use..."
11238         $cat >try.c <<EOP
11239 #$i_unistd I_UNISTD
11240 #include <sys/types.h>
11241 #ifdef I_UNISTD
11242 #  include <unistd.h>
11243 #endif
11244 #$i_stdlib I_STDLIB
11245 #ifdef I_STDLIB
11246 #include <stdlib.h>
11247 #endif
11248 int main()
11249 {
11250         if (getuid() == 0) {
11251                 printf("(I see you are running Configure as super-user...)\n");
11252                 setuid(1);
11253         }
11254 #ifdef TRY_BSD_PGRP
11255         if (-1 == setpgrp(1, 1))
11256                 exit(0);
11257 #else
11258         if (setpgrp() != -1)
11259                 exit(0);
11260 #endif
11261         exit(1);
11262 }
11263 EOP
11264         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11265                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11266                 val="$define"
11267         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11268                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11269                 val="$undef"
11270         else
11271                 echo "(I can't seem to compile and run the test program.)"
11272                 if ./usg; then
11273                         xxx="a USG one, i.e. you use setpgrp()."
11274                 else
11275                         # SVR4 systems can appear rather BSD-ish.
11276                         case "$i_unistd" in
11277                         $undef)
11278                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11279                                 val="$define"
11280                                 ;;
11281                         $define)
11282                                 xxx="probably a USG one, i.e. you use setpgrp()."
11283                                 val="$undef"
11284                                 ;;
11285                         esac
11286                 fi
11287                 echo "Assuming your setpgrp is $xxx" >&4
11288         fi
11289         ;;
11290 *) val="$undef";;
11291 esac
11292 set d_bsdsetpgrp
11293 eval $setvar
11294 $rm_try
11295
11296 : Look for GCC-style __builtin_choose_expr
11297 case "$d_builtin_choose_expr" in
11298 '')
11299     echo " "
11300     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11301     $cat >try.c <<'EOCP'
11302 #include <assert.h>
11303 #include <stdlib.h>
11304 #include <stdio.h>
11305
11306 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11307
11308 int main(void) {
11309     assert( SYRINX(1) == 2112 );
11310     assert( SYRINX(1) != 5150 );
11311     assert( SYRINX(0) == 5150 );
11312     assert( SYRINX(0) != 2112 );
11313     puts( "All good!" );
11314     exit(0);
11315 }
11316
11317 EOCP
11318     set try
11319     if eval $compile && $run ./try; then
11320         echo "Your C compiler supports __builtin_choose_expr."
11321         val="$define"
11322     else
11323         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11324         val="$undef"
11325     fi
11326 ;;
11327 *) val="$d_builtin_choose_expr" ;;
11328 esac
11329
11330 set d_builtin_choose_expr
11331 eval $setvar
11332 $rm_try
11333
11334 : Look for GCC-style __builtin_expect
11335 case "$d_builtin_expect" in
11336 '')
11337     echo " "
11338     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11339     $cat >try.c <<'EOCP'
11340 int main(void) {
11341     int n = 50;
11342     if ( __builtin_expect(n, 0) ) n = 1;
11343     /* Remember shell exit code truth is 0, C truth is non-zero */
11344     return !(n == 1);
11345 }
11346 EOCP
11347     set try
11348     if eval $compile && $run ./try; then
11349         echo "Your C compiler supports __builtin_expect."
11350         val="$define"
11351     else
11352         echo "Your C compiler doesn't seem to understand __builtin_expect."
11353         val="$undef"
11354     fi
11355     ;;
11356 *) val="$d_builtin_expect" ;;
11357 esac
11358
11359 set d_builtin_expect
11360 eval $setvar
11361 $rm_try
11362
11363 : see if bzero exists
11364 set bzero d_bzero
11365 eval $inlibc
11366
11367 : see if stdarg is available
11368 echo " "
11369 if $test `./findhdr stdarg.h`; then
11370         echo "<stdarg.h> found." >&4
11371         valstd="$define"
11372 else
11373         echo "<stdarg.h> NOT found." >&4
11374         valstd="$undef"
11375 fi
11376
11377 : see if varargs is available
11378 echo " "
11379 if $test `./findhdr varargs.h`; then
11380         echo "<varargs.h> found." >&4
11381 else
11382         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11383 fi
11384
11385 : set up the varargs testing programs
11386 $cat > varargs.c <<EOP
11387 #ifdef I_STDARG
11388 #include <stdarg.h>
11389 #endif
11390 #ifdef I_VARARGS
11391 #include <varargs.h>
11392 #endif
11393
11394 #ifdef I_STDARG
11395 int f(char *p, ...)
11396 #else
11397 int f(va_alist)
11398 va_dcl
11399 #endif
11400 {
11401         va_list ap;
11402 #ifndef I_STDARG
11403         char *p;
11404 #endif
11405 #ifdef I_STDARG
11406         va_start(ap,p);
11407 #else
11408         va_start(ap);
11409         p = va_arg(ap, char *);
11410 #endif
11411         va_end(ap);
11412         return 0;
11413 }
11414 EOP
11415 $cat > varargs <<EOP
11416 $startsh
11417 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11418         echo "true"
11419 else
11420         echo "false"
11421 fi
11422 $rm -f varargs$_o
11423 EOP
11424 chmod +x varargs
11425
11426 : now check which varargs header should be included
11427 echo " "
11428 i_varhdr=''
11429 val=''
11430 case "$valstd" in
11431 "$define")
11432         if `./varargs I_STDARG`; then
11433                 val='stdarg.h'
11434         elif `./varargs I_VARARGS`; then
11435                 val='varargs.h'
11436         fi
11437         ;;
11438 *)
11439         if `./varargs I_VARARGS`; then
11440                 val='varargs.h'
11441         fi
11442         ;;
11443 esac
11444 case "$val" in
11445 '')
11446         echo " "
11447         echo "*** WHOA THERE!!! ***" >&4
11448         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
11449         case "$knowitall" in
11450         '')
11451         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
11452                 exit 1
11453                 ;;
11454         esac
11455 echo "I could not find the definition for va_dcl... You have problems..." >&4
11456         val="$undef"; set i_stdarg; eval $setvar
11457         val="$undef"; set i_varargs; eval $setvar
11458         ;;
11459 *)
11460         set i_varhdr
11461         eval $setvar
11462         case "$i_varhdr" in
11463         stdarg.h)
11464                 val="$define"; set i_stdarg; eval $setvar
11465                 val="$undef"; set i_varargs; eval $setvar
11466                 ;;
11467         varargs.h)
11468                 val="$undef"; set i_stdarg; eval $setvar
11469                 val="$define"; set i_varargs; eval $setvar
11470                 ;;
11471         esac
11472         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11473 esac
11474 $rm -f varargs*
11475
11476 : see if the Compiler supports C99 variadic macros
11477 case "$i_stdarg$i_stdlib" in
11478     "$define$define")
11479     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11480     $cat >try.c <<EOCP
11481 #include <stdio.h>
11482 #include <stdarg.h>
11483
11484 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11485
11486 int main() {
11487   char buf[20];
11488   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11489   puts(buf);
11490   return 0;
11491 }
11492 EOCP
11493     set try
11494     if eval $compile && $run ./try 2>&1 >/dev/null; then
11495         case "`$run ./try`" in
11496             "123 456 789")
11497             echo "You have C99 variadic macros." >&4
11498             d_c99_variadic_macros="$define"
11499             ;;
11500             *)
11501             echo "You don't have functional C99 variadic macros." >&4
11502             d_c99_variadic_macros="$undef"
11503             ;;
11504         esac
11505     else
11506         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11507         d_c99_variadic_macros="$undef"
11508     fi
11509     $rm_try
11510     ;;
11511     *)
11512     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11513     d_c99_variadic_macros="$undef"
11514     ;;
11515 esac
11516
11517 : see if signal is declared as pointer to function returning int or void
11518 echo " "
11519 xxx=`./findhdr signal.h`
11520 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11521 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11522         echo "You have int (*signal())() instead of void." >&4
11523         val="$undef"
11524 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11525         echo "You have void (*signal())()." >&4
11526         val="$define"
11527 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11528         echo "You have int (*signal())() instead of void." >&4
11529         val="$undef"
11530 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11531         echo "You have void (*signal())()." >&4
11532         val="$define"
11533 else
11534         case "$d_voidsig" in
11535         '')
11536         echo "I can't determine whether signal handler returns void or int..." >&4
11537                 dflt=void
11538                 rp="What type does your signal handler return?"
11539                 . ./myread
11540                 case "$ans" in
11541                 v*) val="$define";;
11542                 *) val="$undef";;
11543                 esac;;
11544         "$define")
11545                 echo "As you already told me, signal handler returns void." >&4
11546                 val="$define"
11547                 ;;
11548         *)      echo "As you already told me, signal handler returns int." >&4
11549                 val="$undef"
11550                 ;;
11551         esac
11552 fi
11553 set d_voidsig
11554 eval $setvar
11555 case "$d_voidsig" in
11556 "$define") signal_t="void";;
11557 *) signal_t="int";;
11558 esac
11559 $rm -f $$.tmp
11560
11561 : check for ability to cast large floats to 32-bit ints.
11562 echo " "
11563 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11564 if $test "$intsize" -ge 4; then
11565         xxx=int
11566 else
11567         xxx=long
11568 fi
11569 $cat >try.c <<EOCP
11570 #include <stdio.h>
11571 #$i_stdlib I_STDLIB
11572 #ifdef I_STDLIB
11573 #include <stdlib.h>
11574 #endif
11575 #include <sys/types.h>
11576 #include <signal.h>
11577 $signal_t blech(int s) { exit(3); }
11578 int main()
11579 {
11580         $xxx i32;
11581         double f, g;
11582         int result = 0;
11583         char str[16];
11584         signal(SIGFPE, blech);
11585
11586         /* Don't let compiler optimize the test away.  Store the number
11587            in a writable string for gcc to pass to sscanf under HP-UX.
11588         */
11589         sprintf(str, "2147483647");
11590         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11591         g = 10 * f;
11592         i32  = ($xxx) g;
11593
11594         /* x86 processors will probably give 0x8000 0000, which is a
11595            sign change.  We don't want that.  We want to mimic SPARC
11596            behavior here, which is to preserve the sign and give
11597            back 0x7fff ffff.
11598         */
11599         if (i32 != ($xxx) f)
11600                 result |= 1;
11601         exit(result);
11602 }
11603 EOCP
11604 set try
11605 if eval $compile_ok; then
11606         $run ./try 2>/dev/null
11607         yyy=$?
11608 else
11609         echo "(I can't seem to compile the test program--assuming it can't)"
11610         yyy=1
11611 fi
11612 case "$yyy" in
11613 0)      val="$define"
11614         echo "Yup, it can."
11615         ;;
11616 *)      val="$undef"
11617         echo "Nope, it can't."
11618         ;;
11619 esac
11620 set d_casti32
11621 eval $setvar
11622 $rm_try
11623
11624 : check for ability to cast negative floats to unsigned
11625 echo " "
11626 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11627 $cat >try.c <<EOCP
11628 #include <stdio.h>
11629 #$i_stdlib I_STDLIB
11630 #ifdef I_STDLIB
11631 #include <stdlib.h>
11632 #endif
11633 #include <sys/types.h>
11634 #include <signal.h>
11635 $signal_t blech(int s) { exit(7); }
11636 $signal_t blech_in_list(int s) { exit(4); }
11637 unsigned long dummy_long(unsigned long p) { return p; }
11638 unsigned int dummy_int(unsigned int p) { return p; }
11639 unsigned short dummy_short(unsigned short p) { return p; }
11640 int main()
11641 {
11642         double f;
11643         unsigned long along;
11644         unsigned int aint;
11645         unsigned short ashort;
11646         int result = 0;
11647         char str[16];
11648
11649         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11650            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11651            optimized the whole file away
11652         */
11653         /* Store the number in a writable string for gcc to pass to
11654            sscanf under HP-UX.
11655         */
11656         sprintf(str, "-123");
11657         sscanf(str, "%lf", &f);  /* f = -123.; */
11658
11659         signal(SIGFPE, blech);
11660         along = (unsigned long)f;
11661         aint = (unsigned int)f;
11662         ashort = (unsigned short)f;
11663         if (along != (unsigned long)-123)
11664                 result |= 1;
11665         if (aint != (unsigned int)-123)
11666                 result |= 1;
11667         if (ashort != (unsigned short)-123)
11668                 result |= 1;
11669         sprintf(str, "1073741824.");
11670         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11671         f = f + f;
11672         along = 0;
11673         along = (unsigned long)f;
11674         if (along != 0x80000000)
11675                 result |= 2;
11676         f -= 1.;
11677         along = 0;
11678         along = (unsigned long)f;
11679         if (along != 0x7fffffff)
11680                 result |= 1;
11681         f += 2.;
11682         along = 0;
11683         along = (unsigned long)f;
11684         if (along != 0x80000001)
11685                 result |= 2;
11686         if (result)
11687                 exit(result);
11688         signal(SIGFPE, blech_in_list);
11689         sprintf(str, "123.");
11690         sscanf(str, "%lf", &f);  /* f = 123.; */
11691         along = dummy_long((unsigned long)f);
11692         aint = dummy_int((unsigned int)f);
11693         ashort = dummy_short((unsigned short)f);
11694         if (along != (unsigned long)123)
11695                 result |= 4;
11696         if (aint != (unsigned int)123)
11697                 result |= 4;
11698         if (ashort != (unsigned short)123)
11699                 result |= 4;
11700         exit(result);
11701
11702 }
11703 EOCP
11704 set try
11705 if eval $compile_ok; then
11706         $run ./try 2>/dev/null
11707         castflags=$?
11708 else
11709         echo "(I can't seem to compile the test program--assuming it can't)"
11710         castflags=7
11711 fi
11712 case "$castflags" in
11713 0)      val="$define"
11714         echo "Yup, it can."
11715         ;;
11716 *)      val="$undef"
11717         echo "Nope, it can't."
11718         ;;
11719 esac
11720 set d_castneg
11721 eval $setvar
11722 $rm_try
11723
11724 : see if cbrt exists
11725 set cbrt d_cbrt
11726 eval $inlibc
11727
11728 : see if vprintf exists
11729 echo " "
11730 if set vprintf val -f d_vprintf; eval $csym; $val; then
11731         echo 'vprintf() found.' >&4
11732         val="$define"
11733         $cat >try.c <<EOF
11734 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11735 #$i_varargs I_VARARGS
11736
11737 #$i_stdlib I_STDLIB
11738 #$i_unistd I_UNISTD
11739
11740 #ifdef I_STDARG
11741 #  include <stdarg.h>
11742 #else /* I_VARARGS */
11743 #  include <varargs.h>
11744 #endif
11745
11746 #ifdef I_UNISTD
11747 #  include <unistd.h>
11748 #endif
11749
11750 #ifdef I_STDLIB
11751 #  include <stdlib.h>
11752 #endif
11753
11754 #include <stdio.h> /* vsprintf prototype */
11755
11756 #ifdef I_STDARG
11757 void xxx(int n, ...)
11758 {
11759     va_list args;
11760     char buf[10];
11761     va_start(args, n);
11762     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11763 }
11764 int main() { xxx(1, "foo"); }
11765
11766 #else /* I_VARARGS */
11767
11768 xxx(va_alist)
11769 va_dcl
11770 {
11771     va_list args;
11772     char buf[10];
11773     va_start(args);
11774     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11775 }
11776 int main() { xxx("foo"); }
11777
11778 #endif
11779
11780 EOF
11781         set try
11782         if eval $compile_ok; then
11783                 if $run ./try; then
11784                         echo "Your vsprintf() returns (int)." >&4
11785                         val2="$undef"
11786                 else
11787                         echo "Your vsprintf() returns (char*)." >&4
11788                         val2="$define"
11789                 fi
11790         else
11791                 echo 'I am unable to compile the vsprintf() test program.' >&4
11792                 # We shouldn't get here.  If we do, assume the standard signature,
11793                 # not the old BSD one.
11794                 echo 'Guessing that vsprintf() returns (int).' >&4
11795                 val2="$undef"
11796         fi
11797 else
11798         echo 'vprintf() NOT found.' >&4
11799         val="$undef"
11800         val2="$undef"
11801 fi
11802 $rm_try
11803 set d_vprintf
11804 eval $setvar
11805 val=$val2
11806 set d_charvspr
11807 eval $setvar
11808
11809 : see if chown exists
11810 set chown d_chown
11811 eval $inlibc
11812
11813 : see if chroot exists
11814 set chroot d_chroot
11815 eval $inlibc
11816
11817 : see if chsize exists
11818 set chsize d_chsize
11819 eval $inlibc
11820
11821 : see if class exists
11822 set class d_class
11823 eval $inlibc
11824
11825 : see if clearenv exists
11826 set clearenv d_clearenv
11827 eval $inlibc
11828
11829 : Define hasstruct macro for Configure internal use
11830 hasstruct='varname=$1; struct=$2; shift; shift;
11831 while $test $# -ge 2; do
11832         case "$1" in
11833         $define) echo "#include <$2>";;
11834         esac ;
11835     shift 2;
11836 done > try.c;
11837 echo "int main () { struct $struct foo; }" >> try.c;
11838 set try;
11839 if eval $compile; then
11840         val="$define";
11841 else
11842         val="$undef";
11843 fi;
11844 set $varname;
11845 eval $setvar;
11846 $rm_try'
11847
11848 : see whether socket exists
11849 socketlib=''
11850 sockethdr=''
11851 echo " "
11852 $echo $n "Hmm... $c" >&4
11853 if set socket val -f d_socket; eval $csym; $val; then
11854     echo "Looks like you have Berkeley networking support." >&4
11855     d_socket="$define"
11856     if set setsockopt val -f; eval $csym; $val; then
11857         d_oldsock="$undef"
11858     else
11859         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11860         d_oldsock="$define"
11861     fi
11862 else
11863     if $contains socklib libc.list >/dev/null 2>&1; then
11864         echo "Looks like you have Berkeley networking support." >&4
11865         d_socket="$define"
11866         : we will have to assume that it supports the 4.2 BSD interface
11867         d_oldsock="$undef"
11868     else
11869         echo "You don't have Berkeley networking in libc$_a..." >&4
11870         if test "X$d_socket" = "X$define"; then
11871             echo "...but you seem to believe that you have sockets." >&4
11872         else
11873             for net in net socket
11874             do
11875                 if test -f $sysroot/usr/lib/lib$net$_a; then
11876                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11877                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11878                     if $contains socket libc.list >/dev/null 2>&1; then
11879                         d_socket="$define"
11880                         socketlib="-l$net"
11881                         case "$net" in
11882                         net)
11883                             echo "...but the Wollongong group seems to have hacked it in." >&4
11884                             sockethdr="-I$sysroot/usr/netinclude"
11885                             ;;
11886                         esac
11887                         echo "Found Berkeley sockets interface in lib$net." >&4
11888                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11889                             d_oldsock="$undef"
11890                         else
11891                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11892                             d_oldsock="$define"
11893                         fi
11894                         break
11895                     fi
11896                 fi
11897             done
11898             if test "X$d_socket" != "X$define"; then
11899                echo "or anywhere else I see." >&4
11900                d_socket="$undef"
11901                d_oldsock="$undef"
11902             fi
11903         fi
11904     fi
11905 fi
11906
11907 : see if socketpair exists
11908 set socketpair d_sockpair
11909 eval $inlibc
11910
11911
11912 echo " "
11913 echo "Checking the availability sa_len in the sock struct ..." >&4
11914 $cat >try.c <<EOF
11915 #include <sys/types.h>
11916 #include <sys/socket.h>
11917 int main() {
11918 struct sockaddr sa;
11919 return (sa.sa_len);
11920 }
11921 EOF
11922 val="$undef"
11923 set try; if eval $compile; then
11924     val="$define"
11925 fi
11926 set d_sockaddr_sa_len; eval $setvar
11927 $rm_try
11928
11929 echo " "
11930 echo "Checking the availability struct sockaddr_in6 ..." >&4
11931 $cat >try.c <<EOF
11932 #include <sys/types.h>
11933 #include <sys/socket.h>
11934 #include <netinet/in.h>
11935 int main() {
11936 struct sockaddr_in6 sin6;
11937 return (sin6.sin6_family);
11938 }
11939 EOF
11940 val="$undef"
11941 set try; if eval $compile; then
11942     val="$define"
11943 fi
11944 set d_sockaddr_in6; eval $setvar
11945 $rm_try
11946
11947 echo " "
11948 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11949 $cat >try.c <<EOF
11950 #include <sys/types.h>
11951 #include <sys/socket.h>
11952 #include <netinet/in.h>
11953 int main() {
11954 struct sockaddr_in6 sin6;
11955 return (sin6.sin6_scope_id);
11956 }
11957 EOF
11958 val="$undef"
11959 set try; if eval $compile; then
11960     val="$define"
11961 fi
11962 set d_sin6_scope_id; eval $setvar
11963 $rm_try
11964
11965 echo " "
11966 echo "Checking the availability struct ip_mreq ..." >&4
11967 $cat >try.c <<EOF
11968 #include <sys/types.h>
11969 #include <sys/socket.h>
11970 #include <netinet/in.h>
11971 int main() {
11972 struct ip_mreq mreq;
11973 return (mreq.imr_multiaddr.s_addr);
11974 }
11975 EOF
11976 val="$undef"
11977 set try; if eval $compile; then
11978        val="$define"
11979 fi
11980 set d_ip_mreq; eval $setvar
11981 $rm_try
11982
11983 echo " "
11984 echo "Checking the availability struct ip_mreq_source ..." >&4
11985 $cat >try.c <<EOF
11986 #include <sys/types.h>
11987 #include <sys/socket.h>
11988 #include <netinet/in.h>
11989 int main() {
11990 struct ip_mreq_source mreq;
11991 return (mreq.imr_multiaddr.s_addr);
11992 }
11993 EOF
11994 val="$undef"
11995 set try; if eval $compile; then
11996        val="$define"
11997 fi
11998 set d_ip_mreq_source; eval $setvar
11999 $rm_try
12000
12001 echo " "
12002 echo "Checking the availability struct ipv6_mreq ..." >&4
12003 $cat >try.c <<EOF
12004 #include <sys/types.h>
12005 #include <sys/socket.h>
12006 #include <netinet/in.h>
12007 int main() {
12008 struct ipv6_mreq mreq;
12009 return (mreq.ipv6mr_interface);
12010 }
12011 EOF
12012 val="$undef"
12013 set try; if eval $compile; then
12014     val="$define"
12015 fi
12016 set d_ipv6_mreq; eval $setvar
12017 $rm_try
12018
12019 echo " "
12020 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12021 $cat >try.c <<EOF
12022 #include <sys/types.h>
12023 #include <sys/socket.h>
12024 #include <netinet/in.h>
12025 int main() {
12026 struct ipv6_mreq_source mreq;
12027 return (mreq.imr_multiaddr.s_addr);
12028 }
12029 EOF
12030 val="$undef"
12031 set try; if eval $compile; then
12032        val="$define"
12033 fi
12034 set d_ipv6_mreq_source; eval $setvar
12035 $rm_try
12036
12037 echo " "
12038 echo "Checking the availability of certain socket constants..." >&4
12039 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12040     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12041     $cat >try.c <<EOF
12042 #include <sys/types.h>
12043 #include <sys/socket.h>
12044 int main() {
12045     int i = $ENUM;
12046 }
12047 EOF
12048     val="$undef"
12049     set try; if eval $compile; then
12050         val="$define"
12051     fi
12052     set d_${enum}; eval $setvar
12053     $rm_try
12054 done
12055
12056 : see if this is a sys/uio.h system
12057 set sys/uio.h i_sysuio
12058 eval $inhdr
12059
12060 : Check for cmsghdr support
12061 echo " "
12062 echo "Checking to see if your system supports struct cmsghdr..." >&4
12063 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12064 eval $hasstruct
12065 case "$d_cmsghdr_s" in
12066 "$define")      echo "Yes, it does."   ;;
12067 *)              echo "No, it doesn't." ;;
12068 esac
12069
12070
12071 : check for const keyword
12072 echo " "
12073 echo 'Checking to see if your C compiler knows about "const"...' >&4
12074 $cat >const.c <<'EOCP'
12075 typedef struct spug { int drokk; } spug;
12076 int main()
12077 {
12078         const char *foo;
12079         const spug y = { 0 };
12080 }
12081 EOCP
12082 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
12083         val="$define"
12084         echo "Yup, it does."
12085 else
12086         val="$undef"
12087         echo "Nope, it doesn't."
12088 fi
12089 set d_const
12090 eval $setvar
12091
12092 : see if copysign exists
12093 set copysign d_copysign
12094 eval $inlibc
12095
12096 : see if copysignl exists
12097 set copysignl d_copysignl
12098 eval $inlibc
12099
12100 : see if crypt exists
12101 echo " "
12102 set crypt d_crypt
12103 eval $inlibc
12104 case "$d_crypt" in
12105 $define) cryptlib='' ;;
12106 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12107                 echo 'crypt() found.' >&4
12108                 val="$define"
12109                 cryptlib=''
12110         else
12111                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12112                 if $test -z "$cryptlib"; then
12113                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12114                 else
12115                         cryptlib=-lcrypt
12116                 fi
12117                 if $test -z "$cryptlib"; then
12118                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12119                 else
12120                         cryptlib=-lcrypt
12121                 fi
12122                 if $test -z "$cryptlib"; then
12123                         cryptlib=`./loc libcrypt$_a "" $libpth`
12124                 else
12125                         cryptlib=-lcrypt
12126                 fi
12127                 if $test -z "$cryptlib"; then
12128                         echo 'crypt() NOT found.' >&4
12129                         val="$undef"
12130                 else
12131                         val="$define"
12132                 fi
12133         fi
12134         set d_crypt
12135         eval $setvar
12136         ;;
12137 esac
12138
12139 : see if this is a crypt.h system
12140 set crypt.h i_crypt
12141 eval $inhdr
12142
12143 : see if crypt_r exists
12144 set crypt_r d_crypt_r
12145 eval $inlibc
12146 case "$d_crypt_r" in
12147 "$define")
12148         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12149         case "$d_crypt_r_proto:$usethreads" in
12150         ":define")      d_crypt_r_proto=define
12151                 set d_crypt_r_proto crypt_r $hdrs
12152                 eval $hasproto ;;
12153         *)      ;;
12154         esac
12155         case "$d_crypt_r_proto" in
12156         define)
12157         case "$crypt_r_proto" in
12158         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12159         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12160         esac
12161         case "$crypt_r_proto" in
12162         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12163         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12164         esac
12165         case "$crypt_r_proto" in
12166         ''|0)   d_crypt_r=undef
12167                 crypt_r_proto=0
12168                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12169         * )     case "$crypt_r_proto" in
12170                 REENTRANT_PROTO*) ;;
12171                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12172                 esac
12173                 echo "Prototype: $try" ;;
12174         esac
12175         ;;
12176         *)      case "$usethreads" in
12177                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12178                 esac
12179                 d_crypt_r=undef
12180                 crypt_r_proto=0
12181                 ;;
12182         esac
12183         ;;
12184 *)      crypt_r_proto=0
12185         ;;
12186 esac
12187
12188 : get csh whereabouts
12189 case "$csh" in
12190 'csh') val="$undef" ;;
12191 *) val="$define" ;;
12192 esac
12193 set d_csh
12194 eval $setvar
12195 : Respect a hint or command line value for full_csh.
12196 case "$full_csh" in
12197 '') full_csh=$csh ;;
12198 esac
12199
12200 : see if ctermid exists
12201 set ctermid d_ctermid
12202 eval $inlibc
12203
12204 : see if ctermid_r exists
12205 set ctermid_r d_ctermid_r
12206 eval $inlibc
12207 case "$d_ctermid_r" in
12208 "$define")
12209         hdrs="$i_systypes sys/types.h define stdio.h "
12210         case "$d_ctermid_r_proto:$usethreads" in
12211         ":define")      d_ctermid_r_proto=define
12212                 set d_ctermid_r_proto ctermid_r $hdrs
12213                 eval $hasproto ;;
12214         *)      ;;
12215         esac
12216         case "$d_ctermid_r_proto" in
12217         define)
12218         case "$ctermid_r_proto" in
12219         ''|0) try='char* ctermid_r(char*);'
12220         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12221         esac
12222         case "$ctermid_r_proto" in
12223         ''|0)   d_ctermid_r=undef
12224                 ctermid_r_proto=0
12225                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12226         * )     case "$ctermid_r_proto" in
12227                 REENTRANT_PROTO*) ;;
12228                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12229                 esac
12230                 echo "Prototype: $try" ;;
12231         esac
12232         ;;
12233         *)      case "$usethreads" in
12234                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12235                 esac
12236                 d_ctermid_r=undef
12237                 ctermid_r_proto=0
12238                 ;;
12239         esac
12240         ;;
12241 *)      ctermid_r_proto=0
12242         ;;
12243 esac
12244
12245 : see if ctime_r exists
12246 set ctime_r d_ctime_r
12247 eval $inlibc
12248 case "$d_ctime_r" in
12249 "$define")
12250         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12251         case "$d_ctime_r_proto:$usethreads" in
12252         ":define")      d_ctime_r_proto=define
12253                 set d_ctime_r_proto ctime_r $hdrs
12254                 eval $hasproto ;;
12255         *)      ;;
12256         esac
12257         case "$d_ctime_r_proto" in
12258         define)
12259         case "$ctime_r_proto" in
12260         ''|0) try='char* ctime_r(const time_t*, char*);'
12261         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12262         esac
12263         case "$ctime_r_proto" in
12264         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12265         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12266         esac
12267         case "$ctime_r_proto" in
12268         ''|0) try='int ctime_r(const time_t*, char*);'
12269         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12270         esac
12271         case "$ctime_r_proto" in
12272         ''|0) try='int ctime_r(const time_t*, char*, int);'
12273         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12274         esac
12275         case "$ctime_r_proto" in
12276         ''|0)   d_ctime_r=undef
12277                 ctime_r_proto=0
12278                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12279         * )     case "$ctime_r_proto" in
12280                 REENTRANT_PROTO*) ;;
12281                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12282                 esac
12283                 echo "Prototype: $try" ;;
12284         esac
12285         ;;
12286         *)      case "$usethreads" in
12287                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12288                 esac
12289                 d_ctime_r=undef
12290                 ctime_r_proto=0
12291                 ;;
12292         esac
12293         ;;
12294 *)      ctime_r_proto=0
12295         ;;
12296 esac
12297
12298 : see if cuserid exists
12299 set cuserid d_cuserid
12300 eval $inlibc
12301
12302 : see if this is a limits.h system
12303 set limits.h i_limits
12304 eval $inhdr
12305
12306 : See if number of significant digits in a double precision number is known
12307 echo " "
12308 $cat >dbl_dig.c <<EOM
12309 #$i_limits I_LIMITS
12310 #$i_float I_FLOAT
12311 #ifdef I_LIMITS
12312 #include <limits.h>
12313 #endif
12314 #ifdef I_FLOAT
12315 #include <float.h>
12316 #endif
12317 #ifdef DBL_DIG
12318 printf("Contains DBL_DIG");
12319 #endif
12320 EOM
12321 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
12322 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
12323         echo "DBL_DIG found." >&4
12324         val="$define"
12325 else
12326         echo "DBL_DIG NOT found." >&4
12327         val="$undef"
12328 fi
12329 $rm -f dbl_dig.?
12330 set d_dbl_dig
12331 eval $setvar
12332
12333 : see if dbm.h is available
12334 : see if dbmclose exists
12335 set dbmclose d_dbmclose
12336 eval $inlibc
12337
12338 case "$d_dbmclose" in
12339 $define)
12340         set dbm.h i_dbm
12341         eval $inhdr
12342         case "$i_dbm" in
12343         $define)
12344                 val="$undef"
12345                 set i_rpcsvcdbm
12346                 eval $setvar
12347                 ;;
12348         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12349                 eval $inhdr
12350                 ;;
12351         esac
12352         ;;
12353 *)      echo "We won't be including <dbm.h>"
12354         val="$undef"
12355         set i_dbm
12356         eval $setvar
12357         val="$undef"
12358         set i_rpcsvcdbm
12359         eval $setvar
12360         ;;
12361 esac
12362
12363 : see if prototype for dbminit is available
12364 echo " "
12365 set d_dbminitproto dbminit $i_dbm dbm.h
12366 eval $hasproto
12367
12368 : see if difftime exists
12369 set difftime d_difftime
12370 eval $inlibc
12371
12372 : see if this is a dirent system
12373 echo " "
12374 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12375         val="$define"
12376         echo "<dirent.h> found." >&4
12377 else
12378         val="$undef"
12379         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12380                 echo "<sys/dir.h> found." >&4
12381                 echo " "
12382         else
12383                 xinc=`./findhdr sys/ndir.h`
12384         fi
12385         echo "<dirent.h> NOT found." >&4
12386 fi
12387 set i_dirent
12388 eval $setvar
12389
12390 : Look for type of directory structure.
12391 echo " "
12392 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12393
12394 case "$direntrytype" in
12395 ''|' ')
12396         case "$i_dirent" in
12397         $define) guess1='struct dirent' ;;
12398         *) guess1='struct direct'  ;;
12399         esac
12400         ;;
12401 *)      guess1="$direntrytype"
12402         ;;
12403 esac
12404
12405 case "$guess1" in
12406 'struct dirent') guess2='struct direct' ;;
12407 *) guess2='struct dirent' ;;
12408 esac
12409
12410 if $contains "$guess1" try.c >/dev/null 2>&1; then
12411         direntrytype="$guess1"
12412         echo "Your directory entries are $direntrytype." >&4
12413 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12414         direntrytype="$guess2"
12415         echo "Your directory entries seem to be $direntrytype." >&4
12416 else
12417         echo "I don't recognize your system's directory entries." >&4
12418         rp="What type is used for directory entries on this system?"
12419         dflt="$guess1"
12420         . ./myread
12421         direntrytype="$ans"
12422 fi
12423 $rm_try
12424
12425 : see if the directory entry stores field length
12426 echo " "
12427 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12428 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12429         echo "Good, your directory entry keeps length information in d_namlen." >&4
12430         val="$define"
12431 else
12432         echo "Your directory entry does not know about the d_namlen field." >&4
12433         val="$undef"
12434 fi
12435 set d_dirnamlen
12436 eval $setvar
12437 $rm_try
12438
12439 : Look for DIR.dd_fd
12440 case "$i_dirent" in
12441 "$define")
12442     echo "Checking to see if DIR has a dd_fd member variable" >&4
12443     $cat >try.c <<EOCP
12444 #$i_stdlib I_STDLIB
12445 #ifdef I_STDLIB
12446 #include <stdlib.h>
12447 #endif
12448 #include <dirent.h>
12449
12450 int main() {
12451     DIR dir;
12452     dir.dd_fd = 1;
12453     return 0;
12454 }
12455 EOCP
12456     val=$undef
12457     set try
12458     if eval $compile; then
12459         echo "Yes, it does."
12460         val="$define"
12461     else
12462         echo "No, it does not."
12463         val="$undef"
12464     fi
12465     ;;
12466 *)
12467     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12468     val="$undef"
12469     ;;
12470 esac
12471 set d_dir_dd_fd
12472 eval $setvar
12473 $rm_try
12474
12475 : see if this is an sysdir system
12476 set sys/dir.h i_sysdir
12477 eval $inhdr
12478
12479 : see if this is an sysndir system
12480 set sys/ndir.h i_sysndir
12481 eval $inhdr
12482
12483 : Look for dirfd
12484 echo " "
12485 $cat >dirfd.c <<EOM
12486 #include <stdio.h>
12487 #$i_stdlib I_STDLIB
12488 #ifdef I_STDLIB
12489 #include <stdlib.h>
12490 #endif
12491 #$i_dirent I_DIRENT             /**/
12492 #$i_sysdir I_SYS_DIR            /**/
12493 #$i_sysndir I_SYS_NDIR          /**/
12494 #$i_systypes I_SYS_TYPES        /**/
12495 #if defined(I_SYS_TYPES)
12496 #include <sys/types.h>
12497 #endif
12498 #if defined(I_DIRENT)
12499 #include <dirent.h>
12500 #else
12501 #ifdef I_SYS_NDIR
12502 #include <sys/ndir.h>
12503 #else
12504 #ifdef I_SYS_DIR
12505 #ifdef hp9000s500
12506 #include <ndir.h>       /* may be wrong in the future */
12507 #else
12508 #include <sys/dir.h>
12509 #endif
12510 #endif
12511 #endif
12512 #endif
12513 int main() {
12514         DIR *dirp = opendir(".");
12515         if (dirfd(dirp) >= 0)
12516                 exit(0);
12517         else
12518                 exit(1);
12519 }
12520 EOM
12521 val=$undef
12522 set dirfd
12523 if eval $compile; then
12524         val="$define"
12525 fi
12526 case "$val" in
12527 $define)        echo "dirfd() found." >&4       ;;
12528 *)              echo "dirfd() NOT found." >&4   ;;
12529 esac
12530 set d_dirfd
12531 eval $setvar
12532 $rm -f dirfd*
12533
12534 : see if dladdr exists
12535 set dladdr d_dladdr
12536 eval $inlibc
12537
12538 : see if dlerror exists
12539 xxx_runnm="$runnm"
12540 runnm=false
12541 set dlerror d_dlerror
12542 eval $inlibc
12543 runnm="$xxx_runnm"
12544
12545 : see if dlfcn is available
12546 set dlfcn.h i_dlfcn
12547 eval $inhdr
12548
12549 : Check what extension to use for shared libs
12550 case "$usedl" in
12551 $define|y|true)
12552         $cat << EOM
12553
12554 On a few systems, the dynamically loaded modules that perl generates and uses
12555 will need a different extension than shared libs. The default will probably
12556 be appropriate.
12557
12558 EOM
12559         case "$dlext" in
12560         '')     dflt="$so" ;;
12561         *)      dflt="$dlext" ;;
12562         esac
12563         rp='What is the extension of dynamically loaded modules'
12564         . ./myread
12565         dlext="$ans"
12566         ;;
12567 *)
12568         dlext="none"
12569         ;;
12570 esac
12571
12572 : Check if dlsym need a leading underscore
12573 echo " "
12574 val="$undef"
12575
12576 case "$dlsrc" in
12577 dl_dlopen.xs)
12578         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12579         $cat >dyna.c <<'EOM'
12580 fred () { }
12581 EOM
12582
12583 $cat >fred.c<<EOM
12584
12585 #include <stdio.h>
12586 #$i_stdlib I_STDLIB
12587 #ifdef I_STDLIB
12588 #include <stdlib.h>
12589 #endif
12590 #$i_dlfcn I_DLFCN
12591 #ifdef I_DLFCN
12592 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12593 #else
12594 #include <sys/types.h>
12595 #include <nlist.h>
12596 #include <link.h>
12597 #endif
12598
12599 extern int fred() ;
12600
12601 int main()
12602 {
12603     void * handle ;
12604     void * symbol ;
12605 #ifndef RTLD_LAZY
12606     int mode = 1 ;
12607 #else
12608     int mode = RTLD_LAZY ;
12609 #endif
12610     handle = dlopen("./dyna.$dlext", mode) ;
12611     if (handle == NULL) {
12612         printf ("1\n") ;
12613         fflush (stdout) ;
12614         exit(0);
12615     }
12616     symbol = dlsym(handle, "fred") ;
12617     if (symbol == NULL) {
12618         /* try putting a leading underscore */
12619         symbol = dlsym(handle, "_fred") ;
12620         if (symbol == NULL) {
12621             printf ("2\n") ;
12622             fflush (stdout) ;
12623             exit(0);
12624         }
12625         printf ("3\n") ;
12626     }
12627     else
12628         printf ("4\n") ;
12629     fflush (stdout) ;
12630     exit(0);
12631 }
12632 EOM
12633         : Call the object file tmp-dyna.o in case dlext=o.
12634         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12635                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12636                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12637                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12638                 xxx=`$run ./fred`
12639                 case $xxx in
12640                 1)      echo "Test program failed using dlopen." >&4
12641                         echo "Perhaps you should not use dynamic loading." >&4;;
12642                 2)      echo "Test program failed using dlsym." >&4
12643                         echo "Perhaps you should not use dynamic loading." >&4;;
12644                 3)      echo "dlsym needs a leading underscore" >&4
12645                         val="$define" ;;
12646                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12647                 esac
12648         else
12649                 echo "I can't compile and run the test program." >&4
12650                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12651         fi
12652         ;;
12653 esac
12654
12655 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12656
12657 set d_dlsymun
12658 eval $setvar
12659
12660 : see if drand48_r exists
12661 set drand48_r d_drand48_r
12662 eval $inlibc
12663 case "$d_drand48_r" in
12664 "$define")
12665         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12666         case "$d_drand48_r_proto:$usethreads" in
12667         ":define")      d_drand48_r_proto=define
12668                 set d_drand48_r_proto drand48_r $hdrs
12669                 eval $hasproto ;;
12670         *)      ;;
12671         esac
12672         case "$d_drand48_r_proto" in
12673         define)
12674         case "$drand48_r_proto" in
12675         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12676         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12677         esac
12678         case "$drand48_r_proto" in
12679         ''|0)   d_drand48_r=undef
12680                 drand48_r_proto=0
12681                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12682         * )     case "$drand48_r_proto" in
12683                 REENTRANT_PROTO*) ;;
12684                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12685                 esac
12686                 echo "Prototype: $try" ;;
12687         esac
12688         ;;
12689         *)      case "$usethreads" in
12690                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12691                 esac
12692                 d_drand48_r=undef
12693                 drand48_r_proto=0
12694                 ;;
12695         esac
12696         ;;
12697 *)      drand48_r_proto=0
12698         ;;
12699 esac
12700
12701 : see if prototype for drand48 is available
12702 echo " "
12703 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12704 eval $hasproto
12705
12706 : see if dup2 exists
12707 set dup2 d_dup2
12708 eval $inlibc
12709
12710 : see if eaccess exists
12711 set eaccess d_eaccess
12712 eval $inlibc
12713
12714 : see if endgrent exists
12715 set endgrent d_endgrent
12716 eval $inlibc
12717
12718 : see if this is an grp system
12719 set grp.h i_grp
12720 eval $inhdr
12721
12722 case "$i_grp" in
12723 $define)
12724         xxx=`./findhdr grp.h`
12725         $cppstdin $cppflags $cppminus < $xxx >$$.h
12726
12727         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12728                 val="$define"
12729         else
12730                 val="$undef"
12731         fi
12732         set d_grpasswd
12733         eval $setvar
12734
12735         $rm -f $$.h
12736         ;;
12737 *)
12738         val="$undef";
12739         set d_grpasswd; eval $setvar
12740         ;;
12741 esac
12742
12743 : see if endgrent_r exists
12744 set endgrent_r d_endgrent_r
12745 eval $inlibc
12746 case "$d_endgrent_r" in
12747 "$define")
12748         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12749         case "$d_endgrent_r_proto:$usethreads" in
12750         ":define")      d_endgrent_r_proto=define
12751                 set d_endgrent_r_proto endgrent_r $hdrs
12752                 eval $hasproto ;;
12753         *)      ;;
12754         esac
12755         case "$d_endgrent_r_proto" in
12756         define)
12757         case "$endgrent_r_proto" in
12758         ''|0) try='int endgrent_r(FILE**);'
12759         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12760         esac
12761         case "$endgrent_r_proto" in
12762         ''|0) try='void endgrent_r(FILE**);'
12763         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12764         esac
12765         case "$endgrent_r_proto" in
12766         ''|0)   d_endgrent_r=undef
12767                 endgrent_r_proto=0
12768                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12769         * )     case "$endgrent_r_proto" in
12770                 REENTRANT_PROTO*) ;;
12771                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12772                 esac
12773                 echo "Prototype: $try" ;;
12774         esac
12775         ;;
12776         *)      case "$usethreads" in
12777                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12778                 esac
12779                 d_endgrent_r=undef
12780                 endgrent_r_proto=0
12781                 ;;
12782         esac
12783         ;;
12784 *)      endgrent_r_proto=0
12785         ;;
12786 esac
12787
12788 : see if endhostent exists
12789 set endhostent d_endhent
12790 eval $inlibc
12791
12792 : see if this is a netdb.h system
12793 set netdb.h i_netdb
12794 eval $inhdr
12795
12796 : see if endhostent_r exists
12797 set endhostent_r d_endhostent_r
12798 eval $inlibc
12799 case "$d_endhostent_r" in
12800 "$define")
12801         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12802         case "$d_endhostent_r_proto:$usethreads" in
12803         ":define")      d_endhostent_r_proto=define
12804                 set d_endhostent_r_proto endhostent_r $hdrs
12805                 eval $hasproto ;;
12806         *)      ;;
12807         esac
12808         case "$d_endhostent_r_proto" in
12809         define)
12810         case "$endhostent_r_proto" in
12811         ''|0) try='int endhostent_r(struct hostent_data*);'
12812         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12813         esac
12814         case "$endhostent_r_proto" in
12815         ''|0) try='void endhostent_r(struct hostent_data*);'
12816         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12817         esac
12818         case "$endhostent_r_proto" in
12819         ''|0)   d_endhostent_r=undef
12820                 endhostent_r_proto=0
12821                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12822         * )     case "$endhostent_r_proto" in
12823                 REENTRANT_PROTO*) ;;
12824                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12825                 esac
12826                 echo "Prototype: $try" ;;
12827         esac
12828         ;;
12829         *)      case "$usethreads" in
12830                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12831                 esac
12832                 d_endhostent_r=undef
12833                 endhostent_r_proto=0
12834                 ;;
12835         esac
12836         ;;
12837 *)      endhostent_r_proto=0
12838         ;;
12839 esac
12840
12841 : see if endnetent exists
12842 set endnetent d_endnent
12843 eval $inlibc
12844
12845 : see if endnetent_r exists
12846 set endnetent_r d_endnetent_r
12847 eval $inlibc
12848 case "$d_endnetent_r" in
12849 "$define")
12850         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12851         case "$d_endnetent_r_proto:$usethreads" in
12852         ":define")      d_endnetent_r_proto=define
12853                 set d_endnetent_r_proto endnetent_r $hdrs
12854                 eval $hasproto ;;
12855         *)      ;;
12856         esac
12857         case "$d_endnetent_r_proto" in
12858         define)
12859         case "$endnetent_r_proto" in
12860         ''|0) try='int endnetent_r(struct netent_data*);'
12861         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12862         esac
12863         case "$endnetent_r_proto" in
12864         ''|0) try='void endnetent_r(struct netent_data*);'
12865         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12866         esac
12867         case "$endnetent_r_proto" in
12868         ''|0)   d_endnetent_r=undef
12869                 endnetent_r_proto=0
12870                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12871         * )     case "$endnetent_r_proto" in
12872                 REENTRANT_PROTO*) ;;
12873                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12874                 esac
12875                 echo "Prototype: $try" ;;
12876         esac
12877         ;;
12878         *)      case "$usethreads" in
12879                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12880                 esac
12881                 d_endnetent_r=undef
12882                 endnetent_r_proto=0
12883                 ;;
12884         esac
12885         ;;
12886 *)      endnetent_r_proto=0
12887         ;;
12888 esac
12889
12890 : see if endprotoent exists
12891 set endprotoent d_endpent
12892 eval $inlibc
12893
12894 : see if endprotoent_r exists
12895 set endprotoent_r d_endprotoent_r
12896 eval $inlibc
12897 case "$d_endprotoent_r" in
12898 "$define")
12899         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12900         case "$d_endprotoent_r_proto:$usethreads" in
12901         ":define")      d_endprotoent_r_proto=define
12902                 set d_endprotoent_r_proto endprotoent_r $hdrs
12903                 eval $hasproto ;;
12904         *)      ;;
12905         esac
12906         case "$d_endprotoent_r_proto" in
12907         define)
12908         case "$endprotoent_r_proto" in
12909         ''|0) try='int endprotoent_r(struct protoent_data*);'
12910         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12911         esac
12912         case "$endprotoent_r_proto" in
12913         ''|0) try='void endprotoent_r(struct protoent_data*);'
12914         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12915         esac
12916         case "$endprotoent_r_proto" in
12917         ''|0)   d_endprotoent_r=undef
12918                 endprotoent_r_proto=0
12919                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12920         * )     case "$endprotoent_r_proto" in
12921                 REENTRANT_PROTO*) ;;
12922                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12923                 esac
12924                 echo "Prototype: $try" ;;
12925         esac
12926         ;;
12927         *)      case "$usethreads" in
12928                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12929                 esac
12930                 d_endprotoent_r=undef
12931                 endprotoent_r_proto=0
12932                 ;;
12933         esac
12934         ;;
12935 *)      endprotoent_r_proto=0
12936         ;;
12937 esac
12938
12939 : see if endpwent exists
12940 set endpwent d_endpwent
12941 eval $inlibc
12942
12943 : see if this is a pwd.h system
12944 set pwd.h i_pwd
12945 eval $inhdr
12946
12947 case "$i_pwd" in
12948 $define)
12949         xxx=`./findhdr pwd.h`
12950         $cppstdin $cppflags $cppminus < $xxx >$$.h
12951
12952         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12953                 val="$define"
12954         else
12955                 val="$undef"
12956         fi
12957         set d_pwquota
12958         eval $setvar
12959
12960         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12961                 val="$define"
12962         else
12963                 val="$undef"
12964         fi
12965         set d_pwage
12966         eval $setvar
12967
12968         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12969                 val="$define"
12970         else
12971                 val="$undef"
12972         fi
12973         set d_pwchange
12974         eval $setvar
12975
12976         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12977                 val="$define"
12978         else
12979                 val="$undef"
12980         fi
12981         set d_pwclass
12982         eval $setvar
12983
12984         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12985                 val="$define"
12986         else
12987                 val="$undef"
12988         fi
12989         set d_pwexpire
12990         eval $setvar
12991
12992         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12993                 val="$define"
12994         else
12995                 val="$undef"
12996         fi
12997         set d_pwcomment
12998         eval $setvar
12999
13000         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
13001                 val="$define"
13002         else
13003                 val="$undef"
13004         fi
13005         set d_pwgecos
13006         eval $setvar
13007
13008         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
13009                 val="$define"
13010         else
13011                 val="$undef"
13012         fi
13013         set d_pwpasswd
13014         eval $setvar
13015
13016         $rm -f $$.h
13017         ;;
13018 *)
13019         val="$undef";
13020         set d_pwquota; eval $setvar
13021         set d_pwage; eval $setvar
13022         set d_pwchange; eval $setvar
13023         set d_pwclass; eval $setvar
13024         set d_pwexpire; eval $setvar
13025         set d_pwcomment; eval $setvar
13026         set d_pwgecos; eval $setvar
13027         set d_pwpasswd; eval $setvar
13028         ;;
13029 esac
13030
13031 : see if endpwent_r exists
13032 set endpwent_r d_endpwent_r
13033 eval $inlibc
13034 case "$d_endpwent_r" in
13035 "$define")
13036         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13037         case "$d_endpwent_r_proto:$usethreads" in
13038         ":define")      d_endpwent_r_proto=define
13039                 set d_endpwent_r_proto endpwent_r $hdrs
13040                 eval $hasproto ;;
13041         *)      ;;
13042         esac
13043         case "$d_endpwent_r_proto" in
13044         define)
13045         case "$endpwent_r_proto" in
13046         ''|0) try='int endpwent_r(FILE**);'
13047         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13048         esac
13049         case "$endpwent_r_proto" in
13050         ''|0) try='void endpwent_r(FILE**);'
13051         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13052         esac
13053         case "$endpwent_r_proto" in
13054         ''|0)   d_endpwent_r=undef
13055                 endpwent_r_proto=0
13056                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13057         * )     case "$endpwent_r_proto" in
13058                 REENTRANT_PROTO*) ;;
13059                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13060                 esac
13061                 echo "Prototype: $try" ;;
13062         esac
13063         ;;
13064         *)      case "$usethreads" in
13065                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13066                 esac
13067                 d_endpwent_r=undef
13068                 endpwent_r_proto=0
13069                 ;;
13070         esac
13071         ;;
13072 *)      endpwent_r_proto=0
13073         ;;
13074 esac
13075
13076 : see if endservent exists
13077 set endservent d_endsent
13078 eval $inlibc
13079
13080 : see if endservent_r exists
13081 set endservent_r d_endservent_r
13082 eval $inlibc
13083 case "$d_endservent_r" in
13084 "$define")
13085         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13086         case "$d_endservent_r_proto:$usethreads" in
13087         ":define")      d_endservent_r_proto=define
13088                 set d_endservent_r_proto endservent_r $hdrs
13089                 eval $hasproto ;;
13090         *)      ;;
13091         esac
13092         case "$d_endservent_r_proto" in
13093         define)
13094         case "$endservent_r_proto" in
13095         ''|0) try='int endservent_r(struct servent_data*);'
13096         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13097         esac
13098         case "$endservent_r_proto" in
13099         ''|0) try='void endservent_r(struct servent_data*);'
13100         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13101         esac
13102         case "$endservent_r_proto" in
13103         ''|0)   d_endservent_r=undef
13104                 endservent_r_proto=0
13105                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13106         * )     case "$endservent_r_proto" in
13107                 REENTRANT_PROTO*) ;;
13108                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13109                 esac
13110                 echo "Prototype: $try" ;;
13111         esac
13112         ;;
13113         *)      case "$usethreads" in
13114                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13115                 esac
13116                 d_endservent_r=undef
13117                 endservent_r_proto=0
13118                 ;;
13119         esac
13120         ;;
13121 *)      endservent_r_proto=0
13122         ;;
13123 esac
13124
13125 : Locate the flags for 'open()'
13126 echo " "
13127 $cat >try.c <<EOCP
13128 #include <sys/types.h>
13129 #ifdef I_FCNTL
13130 #include <fcntl.h>
13131 #endif
13132 #ifdef I_SYS_FILE
13133 #include <sys/file.h>
13134 #endif
13135 #$i_stdlib I_STDLIB
13136 #ifdef I_STDLIB
13137 #include <stdlib.h>
13138 #endif
13139 int main() {
13140         if(O_RDONLY);
13141 #ifdef O_TRUNC
13142         exit(0);
13143 #else
13144         exit(1);
13145 #endif
13146 }
13147 EOCP
13148 : check sys/file.h first to get FREAD on Sun
13149 if $test `./findhdr sys/file.h` && \
13150                 set try -DI_SYS_FILE && eval $compile; then
13151         h_sysfile=true;
13152         echo "<sys/file.h> defines the O_* constants..." >&4
13153         if $run ./try; then
13154                 echo "and you have the 3 argument form of open()." >&4
13155                 val="$define"
13156         else
13157                 echo "but not the 3 argument form of open().  Oh, well." >&4
13158                 val="$undef"
13159         fi
13160 elif $test `./findhdr fcntl.h` && \
13161                 set try -DI_FCNTL && eval $compile; then
13162         h_fcntl=true;
13163         echo "<fcntl.h> defines the O_* constants..." >&4
13164         if $run ./try; then
13165                 echo "and you have the 3 argument form of open()." >&4
13166                 val="$define"
13167         else
13168                 echo "but not the 3 argument form of open().  Oh, well." >&4
13169                 val="$undef"
13170         fi
13171 else
13172         val="$undef"
13173         echo "I can't find the O_* constant definitions!  You got problems." >&4
13174 fi
13175 set d_open3
13176 eval $setvar
13177 $rm_try
13178
13179 : see if this is a sys/file.h system
13180 val=''
13181 set sys/file.h val
13182 eval $inhdr
13183
13184 : do we need to include sys/file.h ?
13185 case "$val" in
13186 "$define")
13187         echo " "
13188         if $h_sysfile; then
13189                 val="$define"
13190                 echo "We'll be including <sys/file.h>." >&4
13191         else
13192                 val="$undef"
13193                 echo "We won't be including <sys/file.h>." >&4
13194         fi
13195         ;;
13196 *)
13197         h_sysfile=false
13198         ;;
13199 esac
13200 set i_sysfile
13201 eval $setvar
13202
13203 : see if fcntl.h is there
13204 val=''
13205 set fcntl.h val
13206 eval $inhdr
13207
13208 : see if we can include fcntl.h
13209 case "$val" in
13210 "$define")
13211         echo " "
13212         if $h_fcntl; then
13213                 val="$define"
13214                 echo "We'll be including <fcntl.h>." >&4
13215         else
13216                 val="$undef"
13217                 if $h_sysfile; then
13218         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13219                 else
13220                         echo "We won't be including <fcntl.h>." >&4
13221                 fi
13222         fi
13223         ;;
13224 *)
13225         h_fcntl=false
13226         val="$undef"
13227         ;;
13228 esac
13229 set i_fcntl
13230 eval $setvar
13231
13232 : see if fork exists
13233 set fork d_fork
13234 eval $inlibc
13235
13236 : see if pipe exists
13237 set pipe d_pipe
13238 eval $inlibc
13239
13240 : check for non-blocking I/O stuff
13241 case "$h_sysfile" in
13242 true) echo "#include <sys/file.h>" > head.c;;
13243 *)
13244        case "$h_fcntl" in
13245        true) echo "#include <fcntl.h>" > head.c;;
13246        *) echo "#include <sys/fcntl.h>" > head.c;;
13247        esac
13248        ;;
13249 esac
13250 echo " "
13251 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13252 case "$o_nonblock" in
13253 '')
13254         $cat head.c > try.c
13255         $cat >>try.c <<EOCP
13256 #include <stdio.h>
13257 #$i_stdlib I_STDLIB
13258 #ifdef I_STDLIB
13259 #include <stdlib.h>
13260 #endif
13261 #$i_fcntl I_FCNTL
13262 #ifdef I_FCNTL
13263 #include <fcntl.h>
13264 #endif
13265 int main() {
13266 #ifdef O_NONBLOCK
13267         printf("O_NONBLOCK\n");
13268         exit(0);
13269 #endif
13270 #ifdef O_NDELAY
13271         printf("O_NDELAY\n");
13272         exit(0);
13273 #endif
13274 #ifdef FNDELAY
13275         printf("FNDELAY\n");
13276         exit(0);
13277 #endif
13278         exit(0);
13279 }
13280 EOCP
13281         set try
13282         if eval $compile_ok; then
13283                 o_nonblock=`$run ./try`
13284                 case "$o_nonblock" in
13285                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13286                 *) echo "Seems like we can use $o_nonblock.";;
13287                 esac
13288         else
13289                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13290         fi
13291         ;;
13292 *) echo "Using $hint value $o_nonblock.";;
13293 esac
13294 $rm_try
13295
13296 echo " "
13297 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13298 case "$eagain" in
13299 '')
13300         case "$d_fork:$d_pipe" in
13301         define:define)
13302         $cat head.c > try.c
13303         $cat >>try.c <<EOCP
13304 #include <errno.h>
13305 #include <sys/types.h>
13306 #include <signal.h>
13307 #include <stdio.h>
13308 #$i_stdlib I_STDLIB
13309 #ifdef I_STDLIB
13310 #include <stdlib.h>
13311 #endif
13312 #$i_fcntl I_FCNTL
13313 #ifdef I_FCNTL
13314 #include <fcntl.h>
13315 #endif
13316 #define MY_O_NONBLOCK $o_nonblock
13317 #ifndef errno  /* XXX need better Configure test */
13318 extern int errno;
13319 #endif
13320 #$i_unistd I_UNISTD
13321 #ifdef I_UNISTD
13322 #include <unistd.h>
13323 #endif
13324 #$i_string I_STRING
13325 #ifdef I_STRING
13326 #include <string.h>
13327 #else
13328 #include <strings.h>
13329 #endif
13330 $signal_t blech(int x) { exit(3); }
13331 EOCP
13332         $cat >> try.c <<'EOCP'
13333 int main()
13334 {
13335         int pd[2];
13336         int pu[2];
13337         char buf[1];
13338         char string[100];
13339         int ret;
13340
13341         ret = pipe(pd); /* Down: child -> parent */
13342         if (ret != 0)
13343                 exit(3);
13344         ret = pipe(pu); /* Up: parent -> child */
13345         if (ret != 0)
13346                 exit(3);
13347         if (0 != fork()) {
13348                 close(pd[1]);   /* Parent reads from pd[0] */
13349                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13350 #ifdef F_SETFL
13351                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13352                         exit(1);
13353 #else
13354                 exit(4);
13355 #endif
13356                 signal(SIGALRM, blech);
13357                 alarm(5);
13358                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13359                         exit(2);
13360                 sprintf(string, "%d\n", ret);
13361                 ret = write(2, string, strlen(string));
13362                 if (ret != strlen(string))
13363                         exit(3);
13364                 alarm(0);
13365 #ifdef EAGAIN
13366                 if (errno == EAGAIN) {
13367                         printf("EAGAIN\n");
13368                         goto ok;
13369                 }
13370 #endif
13371 #ifdef EWOULDBLOCK
13372                 if (errno == EWOULDBLOCK)
13373                         printf("EWOULDBLOCK\n");
13374 #endif
13375         ok:
13376                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13377                 if (ret != 1)
13378                         exit(3);
13379                 sleep(2);                               /* Give it time to close our pipe */
13380                 alarm(5);
13381                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13382                 alarm(0);
13383                 sprintf(string, "%d\n", ret);
13384                 ret = write(4, string, strlen(string));
13385                 if (ret != strlen(string))
13386                         exit(3);
13387                 exit(0);
13388         }
13389
13390         close(pd[0]);                   /* We write to pd[1] */
13391         close(pu[1]);                   /* We read from pu[0] */
13392         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13393         if (ret != 1)
13394                 exit(3);
13395         close(pd[1]);                   /* Pipe pd is now fully closed! */
13396         exit(0);                                /* Bye bye, thank you for playing! */
13397 }
13398 EOCP
13399         set try
13400         if eval $compile_ok; then
13401                 echo "$startsh" >mtry
13402                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13403                 chmod +x mtry
13404                 $run ./mtry >/dev/null 2>&1
13405                 case $? in
13406                 0) eagain=`$cat try.out`;;
13407                 1) echo "Could not perform non-blocking setting!";;
13408                 2) echo "I did a successful read() for something that was not there!";;
13409                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13410                 4) echo "Could not find F_SETFL!";;
13411                 *) echo "Something terribly wrong happened during testing.";;
13412                 esac
13413                 rd_nodata=`$cat try.ret`
13414                 echo "A read() system call with no data present returns $rd_nodata."
13415                 case "$rd_nodata" in
13416                 0|-1) ;;
13417                 *)
13418                         echo "(That's peculiar, fixing that to be -1.)"
13419                         rd_nodata=-1
13420                         ;;
13421                 esac
13422                 case "$eagain" in
13423                 '')
13424                         echo "Forcing errno EAGAIN on read() with no data available."
13425                         eagain=EAGAIN
13426                         ;;
13427                 *)
13428                         echo "Your read() sets errno to $eagain when no data is available."
13429                         ;;
13430                 esac
13431                 status=`$cat try.err`
13432                 case "$status" in
13433                 0) echo "And it correctly returns 0 to signal EOF.";;
13434                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13435                 *) echo "However, your read() returns '$status' on EOF??";;
13436                 esac
13437                 val="$define"
13438                 if test "$status" = "$rd_nodata"; then
13439                         echo "WARNING: you can't distinguish between EOF and no data!"
13440                         val="$undef"
13441                 fi
13442         else
13443                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13444                 eagain=EAGAIN
13445         fi
13446         ;;
13447         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13448                 eagain=EAGAIN
13449                 val="$define"
13450                 ;;
13451         esac
13452         set d_eofnblk
13453         eval $setvar
13454         ;;
13455 *)
13456         echo "Using $hint value $eagain."
13457         echo "Your read() returns $rd_nodata when no data is present."
13458         case "$d_eofnblk" in
13459         "$define") echo "And you can see EOF because read() returns 0.";;
13460         "$undef") echo "But you can't see EOF status from read() returned value.";;
13461         *)
13462                 echo "(Assuming you can't see EOF status from read anyway.)"
13463                 d_eofnblk=$undef
13464                 ;;
13465         esac
13466         ;;
13467 esac
13468 $rm_try head.c mtry
13469
13470 : see if erf exists
13471 set erf d_erf
13472 eval $inlibc
13473
13474 : see if erfc exists
13475 set erfc d_erfc
13476 eval $inlibc
13477
13478 : see if exp2 exists
13479 set exp2 d_exp2
13480 eval $inlibc
13481
13482 : see if expm1 exists
13483 set expm1 d_expm1
13484 eval $inlibc
13485
13486 : see if _ptr and _cnt from stdio act std
13487 echo " "
13488
13489 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13490         echo "(Looks like you have stdio.h from BSD.)"
13491         case "$stdio_ptr" in
13492         '') stdio_ptr='((fp)->_p)'
13493                 ptr_lval=$define
13494                 ;;
13495         *)      ptr_lval=$d_stdio_ptr_lval;;
13496         esac
13497         case "$stdio_cnt" in
13498         '') stdio_cnt='((fp)->_r)'
13499                 cnt_lval=$define
13500                 ;;
13501         *)      cnt_lval=$d_stdio_cnt_lval;;
13502         esac
13503         case "$stdio_base" in
13504         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13505         esac
13506         case "$stdio_bufsiz" in
13507         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13508         esac
13509 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13510         echo "(Looks like you have stdio.h from Linux.)"
13511         case "$stdio_ptr" in
13512         '') stdio_ptr='((fp)->_IO_read_ptr)'
13513                 ptr_lval=$define
13514                 ;;
13515         *)      ptr_lval=$d_stdio_ptr_lval;;
13516         esac
13517         case "$stdio_cnt" in
13518         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13519                 cnt_lval=$undef
13520                 ;;
13521         *)      cnt_lval=$d_stdio_cnt_lval;;
13522         esac
13523         case "$stdio_base" in
13524         '') stdio_base='((fp)->_IO_read_base)';;
13525         esac
13526         case "$stdio_bufsiz" in
13527         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13528         esac
13529 else
13530         case "$stdio_ptr" in
13531         '') stdio_ptr='((fp)->_ptr)'
13532                 ptr_lval=$define
13533                 ;;
13534         *)      ptr_lval=$d_stdio_ptr_lval;;
13535         esac
13536         case "$stdio_cnt" in
13537         '') stdio_cnt='((fp)->_cnt)'
13538                 cnt_lval=$define
13539                 ;;
13540         *)      cnt_lval=$d_stdio_cnt_lval;;
13541         esac
13542         case "$stdio_base" in
13543         '') stdio_base='((fp)->_base)';;
13544         esac
13545         case "$stdio_bufsiz" in
13546         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13547         esac
13548 fi
13549
13550 : test whether _ptr and _cnt really work
13551 echo "Checking how std your stdio is..." >&4
13552 $cat >try.c <<EOP
13553 #include <stdio.h>
13554 #$i_stdlib I_STDLIB
13555 #ifdef I_STDLIB
13556 #include <stdlib.h>
13557 #endif
13558 #define FILE_ptr(fp)    $stdio_ptr
13559 #define FILE_cnt(fp)    $stdio_cnt
13560 int main() {
13561         FILE *fp = fopen("try.c", "r");
13562         char c = getc(fp);
13563         if (
13564                 18 <= FILE_cnt(fp) &&
13565                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13566         )
13567                 exit(0);
13568         exit(1);
13569 }
13570 EOP
13571 val="$undef"
13572 set try
13573 if eval $compile && $to try.c; then
13574         if $run ./try; then
13575                 echo "Your stdio acts pretty std."
13576                 val="$define"
13577         else
13578                 echo "Your stdio isn't very std."
13579         fi
13580 else
13581         echo "Your stdio doesn't appear very std."
13582 fi
13583 $rm_try
13584
13585 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13586 # direct buffer manipulation no longer works.  The Configure tests
13587 # should be changed to correctly detect this, but until then,
13588 # the following check should at least let perl compile and run.
13589 # (This quick fix should be updated before 5.8.1.)
13590 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13591 # A. Dougherty, June 3, 2002.
13592 case "$d_gnulibc" in
13593 $define)
13594         case "$gnulibc_version" in
13595         2.[01]*)  ;;
13596         2.2) ;;
13597         2.2.[0-9]) ;;
13598         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13599                 val="$undef"
13600                 ;;
13601         esac
13602         ;;
13603 esac
13604 set d_stdstdio
13605 eval $setvar
13606
13607 : Can _ptr be used as an lvalue?
13608 case "$d_stdstdio$ptr_lval" in
13609 $define$define) val=$define ;;
13610 *) val=$undef ;;
13611 esac
13612 set d_stdio_ptr_lval
13613 eval $setvar
13614
13615 : Can _cnt be used as an lvalue?
13616 case "$d_stdstdio$cnt_lval" in
13617 $define$define) val=$define ;;
13618 *) val=$undef ;;
13619 esac
13620 set d_stdio_cnt_lval
13621 eval $setvar
13622
13623
13624 : test whether setting _ptr sets _cnt as a side effect
13625 d_stdio_ptr_lval_sets_cnt="$undef"
13626 d_stdio_ptr_lval_nochange_cnt="$undef"
13627 case "$d_stdio_ptr_lval$d_stdstdio" in
13628 $define$define)
13629         echo "Checking to see what happens if we set the stdio ptr..." >&4
13630 $cat >try.c <<EOP
13631 #include <stdio.h>
13632 /* Can we scream? */
13633 /* Eat dust sed :-) */
13634 /* In the buffer space, no one can hear you scream. */
13635 #$i_stdlib I_STDLIB
13636 #ifdef I_STDLIB
13637 #include <stdlib.h>
13638 #endif
13639 #define FILE_ptr(fp)    $stdio_ptr
13640 #define FILE_cnt(fp)    $stdio_cnt
13641 #include <sys/types.h>
13642 int main() {
13643         FILE *fp = fopen("try.c", "r");
13644         int c;
13645         char *ptr;
13646         size_t cnt;
13647         if (!fp) {
13648             puts("Fail even to read");
13649             exit(1);
13650         }
13651         c = getc(fp); /* Read away the first # */
13652         if (c == EOF) {
13653             puts("Fail even to read");
13654             exit(1);
13655         }
13656         if (!(
13657                 18 <= FILE_cnt(fp) &&
13658                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13659         )) {
13660                 puts("Fail even to read");
13661                 exit (1);
13662         }
13663         ptr = (char*) FILE_ptr(fp);
13664         cnt = (size_t)FILE_cnt(fp);
13665
13666         FILE_ptr(fp) += 42;
13667
13668         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13669                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13670                 exit (1);
13671         }
13672         if (FILE_cnt(fp) <= 20) {
13673                 printf ("Fail (<20 chars to test)");
13674                 exit (1);
13675         }
13676         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13677                 puts("Fail compare");
13678                 exit (1);
13679         }
13680         if (cnt == FILE_cnt(fp)) {
13681                 puts("Pass_unchanged");
13682                 exit (0);
13683         }
13684         if (FILE_cnt(fp) == (cnt - 42)) {
13685                 puts("Pass_changed");
13686                 exit (0);
13687         }
13688         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13689         return 1;
13690
13691 }
13692 EOP
13693         set try
13694         if eval $compile && $to try.c; then
13695                 case `$run ./try` in
13696                 Pass_changed)
13697                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13698                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13699                 Pass_unchanged)
13700                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13701                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13702                 Fail*)
13703                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13704                 *)
13705                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13706         esac
13707         else
13708                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13709         fi
13710         $rm_try
13711         ;;
13712 esac
13713
13714 : see if _base is also standard
13715 val="$undef"
13716 case "$d_stdstdio" in
13717 $define)
13718         $cat >try.c <<EOP
13719 #include <stdio.h>
13720 #$i_stdlib I_STDLIB
13721 #ifdef I_STDLIB
13722 #include <stdlib.h>
13723 #endif
13724 #define FILE_base(fp)   $stdio_base
13725 #define FILE_bufsiz(fp) $stdio_bufsiz
13726 int main() {
13727         FILE *fp = fopen("try.c", "r");
13728         char c = getc(fp);
13729         if (
13730                 19 <= FILE_bufsiz(fp) &&
13731                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13732         )
13733                 exit(0);
13734         exit(1);
13735 }
13736 EOP
13737         set try
13738         if eval $compile && $to try.c; then
13739                 if $run ./try; then
13740                         echo "And its _base field acts std."
13741                         val="$define"
13742                 else
13743                         echo "But its _base field isn't std."
13744                 fi
13745         else
13746                 echo "However, it seems to be lacking the _base field."
13747         fi
13748         $rm_try
13749         ;;
13750 esac
13751 set d_stdiobase
13752 eval $setvar
13753
13754 : see if fast_stdio exists
13755 val="$undef"
13756 case "$d_stdstdio:$d_stdio_ptr_lval" in
13757 "$define:$define")
13758         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13759         *$define*)
13760                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13761                 val="$define"
13762                 ;;
13763         esac
13764         ;;
13765 esac
13766 set d_faststdio
13767 eval $setvar
13768
13769
13770
13771 : see if fchdir exists
13772 set fchdir d_fchdir
13773 eval $inlibc
13774
13775 : see if fchmod exists
13776 set fchmod d_fchmod
13777 eval $inlibc
13778
13779 : see if fchown exists
13780 set fchown d_fchown
13781 eval $inlibc
13782
13783 : see if this is an fcntl system
13784 set fcntl d_fcntl
13785 eval $inlibc
13786
13787 : See if fcntl-based locking works.
13788 echo " "
13789 $cat >try.c <<EOCP
13790 #$i_stdlib I_STDLIB
13791 #ifdef I_STDLIB
13792 #include <stdlib.h>
13793 #endif
13794 #include <unistd.h>
13795 #include <fcntl.h>
13796 #include <signal.h>
13797 $signal_t blech(int x) { exit(3); }
13798 int main() {
13799 #if defined(F_SETLK) && defined(F_SETLKW)
13800      struct flock flock;
13801      int retval, fd;
13802      fd = open("try.c", O_RDONLY);
13803      flock.l_type = F_RDLCK;
13804      flock.l_whence = SEEK_SET;
13805      flock.l_start = flock.l_len = 0;
13806      signal(SIGALRM, blech);
13807      alarm(10);
13808      retval = fcntl(fd, F_SETLK, &flock);
13809      close(fd);
13810      (retval < 0 ? exit(2) : exit(0));
13811 #else
13812      exit(2);
13813 #endif
13814 }
13815 EOCP
13816 echo "Checking if fcntl-based file locking works... "
13817 case "$d_fcntl" in
13818 "$define")
13819         set try
13820         if eval $compile_ok; then
13821                 if $run ./try; then
13822                         echo "Yes, it seems to work."
13823                         val="$define"
13824                 else
13825                         echo "Nope, it didn't work."
13826                         val="$undef"
13827                         case "$?" in
13828                         3) $cat >&4 <<EOM
13829 ***
13830 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13831 *** This is (almost) impossible.
13832 *** If your NFS lock daemons are not feeling well, something like
13833 *** this may happen, please investigate.  Cannot continue, aborting.
13834 ***
13835 EOM
13836                                 exit 1
13837                                 ;;
13838                         esac
13839                 fi
13840         else
13841                 echo "I'm unable to compile the test program, so I'll assume not."
13842                 val="$undef"
13843         fi
13844         ;;
13845 *) val="$undef";
13846         echo "Nope, since you don't even have fcntl()."
13847         ;;
13848 esac
13849 set d_fcntl_can_lock
13850 eval $setvar
13851 $rm_try
13852
13853 : check for fd_set items
13854 $cat <<EOM
13855
13856 Checking to see how well your C compiler handles fd_set and friends ...
13857 EOM
13858 $cat >try.c <<EOCP
13859 #$i_stdlib I_STDLIB
13860 #ifdef I_STDLIB
13861 #include <stdlib.h>
13862 #endif
13863 #$i_systime I_SYS_TIME
13864 #$i_sysselct I_SYS_SELECT
13865 #$d_socket HAS_SOCKET
13866 #include <sys/types.h>
13867 #ifdef HAS_SOCKET
13868 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13869 #endif
13870 #ifdef I_SYS_TIME
13871 #include <sys/time.h>
13872 #endif
13873 #ifdef I_SYS_SELECT
13874 #include <sys/select.h>
13875 #endif
13876 int main() {
13877         fd_set fds;
13878
13879 #ifdef TRYBITS
13880         if(fds.fds_bits);
13881 #endif
13882
13883 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13884         exit(0);
13885 #else
13886         exit(1);
13887 #endif
13888 }
13889 EOCP
13890 set try -DTRYBITS
13891 if eval $compile; then
13892         d_fds_bits="$define"
13893         d_fd_set="$define"
13894         echo "Well, your system knows about the normal fd_set typedef..." >&4
13895         if $run ./try; then
13896                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13897                 d_fd_macros="$define"
13898         else
13899                 $cat >&4 <<'EOM'
13900 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13901 EOM
13902                 d_fd_macros="$undef"
13903         fi
13904 else
13905         $cat <<'EOM'
13906 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13907 EOM
13908         set try
13909         if eval $compile; then
13910                 d_fds_bits="$undef"
13911                 d_fd_set="$define"
13912                 echo "Well, your system has some sort of fd_set available..." >&4
13913                 if $run ./try; then
13914                         echo "and you have the normal fd_set macros." >&4
13915                         d_fd_macros="$define"
13916                 else
13917                         $cat <<'EOM'
13918 but not the normal fd_set macros!  Gross!  More work for me...
13919 EOM
13920                         d_fd_macros="$undef"
13921                 fi
13922         else
13923         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13924                 d_fd_set="$undef"
13925                 d_fds_bits="$undef"
13926                 d_fd_macros="$undef"
13927         fi
13928 fi
13929 $rm_try
13930
13931 : see if fdim exists
13932 set fdim d_fdim
13933 eval $inlibc
13934
13935 : see if fegetround exists
13936 set fegetround d_fegetround
13937 eval $inlibc
13938
13939 : see if fgetpos exists
13940 set fgetpos d_fgetpos
13941 eval $inlibc
13942
13943 : see if finite exists
13944 set finite d_finite
13945 eval $inlibc
13946
13947 : see if finitel exists
13948 set finitel d_finitel
13949 eval $inlibc
13950
13951 : see if flock exists
13952 set flock d_flock
13953 eval $inlibc
13954
13955 : see if prototype for flock is available
13956 echo " "
13957 set d_flockproto flock $i_sysfile sys/file.h
13958 eval $hasproto
13959
13960 : see if fma exists
13961 set fma d_fma
13962 eval $inlibc
13963
13964 : see if fmax exists
13965 set fmax d_fmax
13966 eval $inlibc
13967
13968 : see if fmin exists
13969 set fmin d_fmin
13970 eval $inlibc
13971
13972 : see if fp_class exists
13973 set fp_class d_fp_class
13974 eval $inlibc
13975
13976 : see if this is a math.h system
13977 set math.h i_math
13978 eval $inhdr
13979
13980 : check for fpclassify
13981 echo "Checking to see if you have fpclassify..." >&4
13982 $cat >try.c <<EOCP
13983 #$i_math I_MATH
13984 #ifdef I_MATH
13985 #include <math.h>
13986 #endif
13987 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
13988 EOCP
13989 set try
13990 if eval $compile; then
13991         val="$define"
13992         echo "You have fpclassify."
13993 else
13994         val="$undef"
13995         echo "You do not have fpclassify."
13996 fi
13997 $rm_try
13998 set d_fpclassify
13999 eval $setvar
14000
14001 : see if fp_classify exists
14002 set fp_classify d_fp_classify
14003 eval $inlibc
14004
14005 : see if fp_classl exists
14006 set fp_classl d_fp_classl
14007 eval $inlibc
14008
14009 : see if pathconf exists
14010 set pathconf d_pathconf
14011 eval $inlibc
14012
14013 : see if fpathconf exists
14014 set fpathconf d_fpathconf
14015 eval $inlibc
14016
14017 : see if fpclass exists
14018 set fpclass d_fpclass
14019 eval $inlibc
14020
14021 : see if fpclassl exists
14022 set fpclassl d_fpclassl
14023 eval $inlibc
14024
14025 : see if fpgetround exists
14026 set fpgetround d_fpgetround
14027 eval $inlibc
14028
14029 : check for fpos64_t
14030 echo " "
14031 echo "Checking to see if you have fpos64_t..." >&4
14032 $cat >try.c <<EOCP
14033 #include <stdio.h>
14034 int main() { fpos64_t x = 7; }
14035 EOCP
14036 set try
14037 if eval $compile; then
14038         val="$define"
14039         echo "You have fpos64_t."
14040 else
14041         val="$undef"
14042         echo "You do not have fpos64_t."
14043         case "$fpossize" in
14044         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14045         esac
14046 fi
14047 $rm_try
14048 set d_fpos64_t
14049 eval $setvar
14050
14051 : see if frexpl exists
14052 set frexpl d_frexpl
14053 eval $inlibc
14054
14055 : see if this is a sys/param system
14056 set sys/param.h i_sysparam
14057 eval $inhdr
14058
14059 : see if this is a sys/mount.h system
14060 set sys/mount.h i_sysmount
14061 eval $inhdr
14062
14063 : Check for fs_data_s
14064 echo " "
14065 echo "Checking to see if your system supports struct fs_data..." >&4
14066 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14067 eval $hasstruct
14068 case "$d_fs_data_s" in
14069 "$define")      echo "Yes, it does."   ;;
14070 *)              echo "No, it doesn't." ;;
14071 esac
14072
14073 : see if fseeko exists
14074 set fseeko d_fseeko
14075 eval $inlibc
14076 case "$longsize" in
14077 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14078 esac
14079
14080 : see if fsetpos exists
14081 set fsetpos d_fsetpos
14082 eval $inlibc
14083
14084 : see if fstatfs exists
14085 set fstatfs d_fstatfs
14086 eval $inlibc
14087
14088 : see if statvfs exists
14089 set statvfs d_statvfs
14090 eval $inlibc
14091
14092 : see if fstatvfs exists
14093 set fstatvfs d_fstatvfs
14094 eval $inlibc
14095
14096
14097 : see if fsync exists
14098 set fsync d_fsync
14099 eval $inlibc
14100
14101 : see if ftello exists
14102 set ftello d_ftello
14103 eval $inlibc
14104 case "$longsize" in
14105 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14106 esac
14107
14108 : check for a working futimes
14109 d_futimes="$undef"
14110 echo " "
14111 echo "Checking if you have a working futimes()" >&4
14112 $cat >try.c <<EOCP
14113 #include <stdio.h>
14114 #include <sys/time.h>
14115 #include <errno.h>
14116 #include <fcntl.h>
14117
14118 int main ()
14119 {
14120     int fd, rv;
14121     fd = open ("try.c", O_RDWR);
14122     if (-1 == fd) exit (1);
14123     rv = futimes (fd, NULL);
14124     exit (rv == -1 ? errno : 0);
14125 }
14126 EOCP
14127 set try
14128 if eval $compile; then
14129     `$run ./try`
14130     rc=$?
14131     case "$rc" in
14132         0)  echo "Yes, you have" >&4
14133             d_futimes="$define"
14134             ;;
14135         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14136             ;;
14137     esac
14138 else
14139     echo "No, it does not (probably harmless)" >&4
14140 fi
14141 $rm_try
14142
14143 : see if ndbm.h is available
14144 set ndbm.h i_ndbm
14145 eval $inhdr
14146 : Compatibility location for RedHat 7.1
14147 set gdbm/ndbm.h i_gdbmndbm
14148 eval $inhdr
14149 : Compatibility location for Debian 4.0
14150 set gdbm-ndbm.h i_gdbm_ndbm
14151 eval $inhdr
14152
14153 val="$undef"
14154 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14155         : see if dbm_open exists
14156         set dbm_open d_dbm_open
14157         eval $inlibc
14158         case "$d_dbm_open" in
14159         $undef)
14160                 i_ndbm="$undef"
14161                 i_gdbmndbm="$undef"
14162                 i_gdbm_ndbm="$undef"
14163                 echo "We won't be including <ndbm.h>"
14164                 val="$undef"
14165                 ;;
14166         *) val="$define"
14167            ;;
14168         esac
14169 fi
14170 set d_ndbm
14171 eval $setvar
14172
14173 ndbm_hdr_protochk='name=$1; hdr=$2;
14174 eval "ihdr=\$""i_$name";
14175 val="$undef";
14176 if $test "$ihdr" = "$define"; then
14177         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14178         case "$d_cplusplus" in
14179         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14180         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14181         esac;
14182         case "$val" in
14183         $define) $echo "Your <$hdr> seems to have prototypes";;
14184         *) $echo "Your <$hdr> does not seem to have prototypes";;
14185         esac;
14186 fi;
14187 set "d_${name}_h_uses_prototypes";
14188 eval $setvar'
14189
14190 set ndbm ndbm.h
14191 eval $ndbm_hdr_protochk
14192 set gdbmndbm gdbm/ndbm.h
14193 eval $ndbm_hdr_protochk
14194 set gdbm_ndbm gdbm-ndbm.h
14195 eval $ndbm_hdr_protochk
14196
14197 : see if getaddrinfo exists
14198 set getaddrinfo d_getaddrinfo
14199 eval $inlibc
14200
14201 : see if getcwd exists
14202 set getcwd d_getcwd
14203 eval $inlibc
14204
14205 : see if getespwnam exists
14206 set getespwnam d_getespwnam
14207 eval $inlibc
14208
14209 : see if getfsstat exists
14210 set getfsstat d_getfsstat
14211 eval $inlibc
14212
14213 : see if getgrent exists
14214 set getgrent d_getgrent
14215 eval $inlibc
14216
14217 : see if getgrent_r exists
14218 set getgrent_r d_getgrent_r
14219 eval $inlibc
14220 case "$d_getgrent_r" in
14221 "$define")
14222         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14223         case "$d_getgrent_r_proto:$usethreads" in
14224         ":define")      d_getgrent_r_proto=define
14225                 set d_getgrent_r_proto getgrent_r $hdrs
14226                 eval $hasproto ;;
14227         *)      ;;
14228         esac
14229         case "$d_getgrent_r_proto" in
14230         define)
14231         case "$getgrent_r_proto" in
14232         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14233         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14234         esac
14235         case "$getgrent_r_proto" in
14236         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14237         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14238         esac
14239         case "$getgrent_r_proto" in
14240         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14241         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14242         esac
14243         case "$getgrent_r_proto" in
14244         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14245         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14246         esac
14247         case "$getgrent_r_proto" in
14248         ''|0) try='int getgrent_r(struct group*, char*, int);'
14249         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14250         esac
14251         case "$getgrent_r_proto" in
14252         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14253         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14254         esac
14255         case "$getgrent_r_proto" in
14256         ''|0)   d_getgrent_r=undef
14257                 getgrent_r_proto=0
14258                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14259         * )     case "$getgrent_r_proto" in
14260                 REENTRANT_PROTO*) ;;
14261                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14262                 esac
14263                 echo "Prototype: $try" ;;
14264         esac
14265         ;;
14266         *)      case "$usethreads" in
14267                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14268                 esac
14269                 d_getgrent_r=undef
14270                 getgrent_r_proto=0
14271                 ;;
14272         esac
14273         ;;
14274 *)      getgrent_r_proto=0
14275         ;;
14276 esac
14277
14278 : see if getgrgid_r exists
14279 set getgrgid_r d_getgrgid_r
14280 eval $inlibc
14281 case "$d_getgrgid_r" in
14282 "$define")
14283         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14284         case "$d_getgrgid_r_proto:$usethreads" in
14285         ":define")      d_getgrgid_r_proto=define
14286                 set d_getgrgid_r_proto getgrgid_r $hdrs
14287                 eval $hasproto ;;
14288         *)      ;;
14289         esac
14290         case "$d_getgrgid_r_proto" in
14291         define)
14292         case "$getgrgid_r_proto" in
14293         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14294         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14295         esac
14296         case "$getgrgid_r_proto" in
14297         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14298         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14299         esac
14300         case "$getgrgid_r_proto" in
14301         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14302         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14303         esac
14304         case "$getgrgid_r_proto" in
14305         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14306         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14307         esac
14308         case "$getgrgid_r_proto" in
14309         ''|0)   d_getgrgid_r=undef
14310                 getgrgid_r_proto=0
14311                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14312         * )     case "$getgrgid_r_proto" in
14313                 REENTRANT_PROTO*) ;;
14314                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14315                 esac
14316                 echo "Prototype: $try" ;;
14317         esac
14318         ;;
14319         *)      case "$usethreads" in
14320                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14321                 esac
14322                 d_getgrgid_r=undef
14323                 getgrgid_r_proto=0
14324                 ;;
14325         esac
14326         ;;
14327 *)      getgrgid_r_proto=0
14328         ;;
14329 esac
14330
14331 : see if getgrnam_r exists
14332 set getgrnam_r d_getgrnam_r
14333 eval $inlibc
14334 case "$d_getgrnam_r" in
14335 "$define")
14336         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14337         case "$d_getgrnam_r_proto:$usethreads" in
14338         ":define")      d_getgrnam_r_proto=define
14339                 set d_getgrnam_r_proto getgrnam_r $hdrs
14340                 eval $hasproto ;;
14341         *)      ;;
14342         esac
14343         case "$d_getgrnam_r_proto" in
14344         define)
14345         case "$getgrnam_r_proto" in
14346         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14347         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14348         esac
14349         case "$getgrnam_r_proto" in
14350         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14351         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14352         esac
14353         case "$getgrnam_r_proto" in
14354         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14355         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14356         esac
14357         case "$getgrnam_r_proto" in
14358         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14359         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14360         esac
14361         case "$getgrnam_r_proto" in
14362         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14363         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14364         esac
14365         case "$getgrnam_r_proto" in
14366         ''|0)   d_getgrnam_r=undef
14367                 getgrnam_r_proto=0
14368                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14369         * )     case "$getgrnam_r_proto" in
14370                 REENTRANT_PROTO*) ;;
14371                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14372                 esac
14373                 echo "Prototype: $try" ;;
14374         esac
14375         ;;
14376         *)      case "$usethreads" in
14377                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14378                 esac
14379                 d_getgrnam_r=undef
14380                 getgrnam_r_proto=0
14381                 ;;
14382         esac
14383         ;;
14384 *)      getgrnam_r_proto=0
14385         ;;
14386 esac
14387
14388 : see if gethostbyaddr exists
14389 set gethostbyaddr d_gethbyaddr
14390 eval $inlibc
14391
14392 : see if gethostbyname exists
14393 set gethostbyname d_gethbyname
14394 eval $inlibc
14395
14396 : see if gethostent exists
14397 set gethostent d_gethent
14398 eval $inlibc
14399
14400 : see how we will look up host name
14401 echo " "
14402 call=''
14403 if set gethostname val -f d_gethname; eval $csym; $val; then
14404         echo 'gethostname() found.' >&4
14405         d_gethname="$define"
14406         call=gethostname
14407 fi
14408 if set uname val -f d_uname; eval $csym; $val; then
14409         if ./xenix; then
14410                 $cat <<'EOM'
14411 uname() was found, but you're running xenix, and older versions of xenix
14412 have a broken uname(). If you don't really know whether your xenix is old
14413 enough to have a broken system call, use the default answer.
14414
14415 EOM
14416                 dflt=y
14417                 case "$d_uname" in
14418                 "$define") dflt=n;;
14419                 esac
14420                 rp='Is your uname() broken?'
14421                 . ./myread
14422                 case "$ans" in
14423                 n*) d_uname="$define"; call=uname;;
14424                 esac
14425         else
14426                 echo 'uname() found.' >&4
14427                 d_uname="$define"
14428                 case "$call" in
14429                 '') call=uname ;;
14430                 esac
14431         fi
14432 fi
14433 case "$d_gethname" in
14434 '') d_gethname="$undef";;
14435 esac
14436 case "$d_uname" in
14437 '') d_uname="$undef";;
14438 esac
14439 case "$d_uname$d_gethname" in
14440 *define*)
14441         dflt=n
14442         cat <<EOM
14443
14444 Every now and then someone has a $call() that lies about the hostname
14445 but can't be fixed for political or economic reasons.  If you wish, I can
14446 pretend $call() isn't there and maybe compute hostname at run-time
14447 thanks to the '$phostname' command.
14448
14449 EOM
14450         rp="Shall I ignore $call() from now on?"
14451         . ./myread
14452         case "$ans" in
14453         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14454         esac;;
14455 esac
14456 case "$phostname" in
14457 '') aphostname='';;
14458 *) case "$aphostname" in
14459         /*) ;;
14460         *) set X $phostname
14461                 shift
14462                 file=$1
14463                 shift
14464                 file=`./loc $file $file $pth`
14465                 aphostname=`echo $file $*`
14466                 ;;
14467         esac
14468         ;;
14469 esac
14470 case "$d_uname$d_gethname" in
14471 *define*) ;;
14472 *)
14473         case "$phostname" in
14474         '')
14475                 echo "There will be no way for $package to get your hostname." >&4;;
14476         *)
14477         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14478                 ;;
14479         esac;;
14480 esac
14481 case "$d_phostname" in
14482 '') d_phostname="$undef";;
14483 esac
14484
14485 : see if gethostbyaddr_r exists
14486 set gethostbyaddr_r d_gethostbyaddr_r
14487 eval $inlibc
14488 case "$d_gethostbyaddr_r" in
14489 "$define")
14490         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14491         case "$d_gethostbyaddr_r_proto:$usethreads" in
14492         ":define")      d_gethostbyaddr_r_proto=define
14493                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14494                 eval $hasproto ;;
14495         *)      ;;
14496         esac
14497         case "$d_gethostbyaddr_r_proto" in
14498         define)
14499         case "$gethostbyaddr_r_proto" in
14500         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14501         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14502         esac
14503         case "$gethostbyaddr_r_proto" in
14504         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14505         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14506         esac
14507         case "$gethostbyaddr_r_proto" in
14508         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14509         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14510         esac
14511         case "$gethostbyaddr_r_proto" in
14512         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14513         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14514         esac
14515         case "$gethostbyaddr_r_proto" in
14516         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14517         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14518         esac
14519         case "$gethostbyaddr_r_proto" in
14520         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14521         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14522         esac
14523         case "$gethostbyaddr_r_proto" in
14524         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14525         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14526         esac
14527         case "$gethostbyaddr_r_proto" in
14528         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14529         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14530         esac
14531         case "$gethostbyaddr_r_proto" in
14532         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14533         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14534         esac
14535         case "$gethostbyaddr_r_proto" in
14536         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14537         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14538         esac
14539         case "$gethostbyaddr_r_proto" in
14540         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14541         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14542         esac
14543         case "$gethostbyaddr_r_proto" in
14544         ''|0)   d_gethostbyaddr_r=undef
14545                 gethostbyaddr_r_proto=0
14546                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14547         * )     case "$gethostbyaddr_r_proto" in
14548                 REENTRANT_PROTO*) ;;
14549                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14550                 esac
14551                 echo "Prototype: $try" ;;
14552         esac
14553         ;;
14554         *)      case "$usethreads" in
14555                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14556                 esac
14557                 d_gethostbyaddr_r=undef
14558                 gethostbyaddr_r_proto=0
14559                 ;;
14560         esac
14561         ;;
14562 *)      gethostbyaddr_r_proto=0
14563         ;;
14564 esac
14565
14566 : see if gethostbyname_r exists
14567 set gethostbyname_r d_gethostbyname_r
14568 eval $inlibc
14569 case "$d_gethostbyname_r" in
14570 "$define")
14571         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14572         case "$d_gethostbyname_r_proto:$usethreads" in
14573         ":define")      d_gethostbyname_r_proto=define
14574                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14575                 eval $hasproto ;;
14576         *)      ;;
14577         esac
14578         case "$d_gethostbyname_r_proto" in
14579         define)
14580         case "$gethostbyname_r_proto" in
14581         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14582         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14583         esac
14584         case "$gethostbyname_r_proto" in
14585         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14586         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14587         esac
14588         case "$gethostbyname_r_proto" in
14589         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14590         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14591         esac
14592         case "$gethostbyname_r_proto" in
14593         ''|0)   d_gethostbyname_r=undef
14594                 gethostbyname_r_proto=0
14595                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14596         * )     case "$gethostbyname_r_proto" in
14597                 REENTRANT_PROTO*) ;;
14598                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14599                 esac
14600                 echo "Prototype: $try" ;;
14601         esac
14602         ;;
14603         *)      case "$usethreads" in
14604                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14605                 esac
14606                 d_gethostbyname_r=undef
14607                 gethostbyname_r_proto=0
14608                 ;;
14609         esac
14610         ;;
14611 *)      gethostbyname_r_proto=0
14612         ;;
14613 esac
14614
14615 : see if gethostent_r exists
14616 set gethostent_r d_gethostent_r
14617 eval $inlibc
14618 case "$d_gethostent_r" in
14619 "$define")
14620         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14621         case "$d_gethostent_r_proto:$usethreads" in
14622         ":define")      d_gethostent_r_proto=define
14623                 set d_gethostent_r_proto gethostent_r $hdrs
14624                 eval $hasproto ;;
14625         *)      ;;
14626         esac
14627         case "$d_gethostent_r_proto" in
14628         define)
14629         case "$gethostent_r_proto" in
14630         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14631         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14632         esac
14633         case "$gethostent_r_proto" in
14634         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14635         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14636         esac
14637         case "$gethostent_r_proto" in
14638         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14639         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14640         esac
14641         case "$gethostent_r_proto" in
14642         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14643         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14644         esac
14645         case "$gethostent_r_proto" in
14646         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14647         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14648         esac
14649         case "$gethostent_r_proto" in
14650         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14651         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14652         esac
14653         case "$gethostent_r_proto" in
14654         ''|0)   d_gethostent_r=undef
14655                 gethostent_r_proto=0
14656                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14657         * )     case "$gethostent_r_proto" in
14658                 REENTRANT_PROTO*) ;;
14659                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14660                 esac
14661                 echo "Prototype: $try" ;;
14662         esac
14663         ;;
14664         *)      case "$usethreads" in
14665                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14666                 esac
14667                 d_gethostent_r=undef
14668                 gethostent_r_proto=0
14669                 ;;
14670         esac
14671         ;;
14672 *)      gethostent_r_proto=0
14673         ;;
14674 esac
14675
14676 : see if prototypes for various gethostxxx netdb.h functions are available
14677 echo " "
14678 set d_gethostprotos gethostent $i_netdb netdb.h
14679 eval $hasproto
14680
14681 : see if getitimer exists
14682 set getitimer d_getitimer
14683 eval $inlibc
14684
14685 : see if getlogin exists
14686 set getlogin d_getlogin
14687 eval $inlibc
14688
14689 : see if getlogin_r exists
14690 set getlogin_r d_getlogin_r
14691 eval $inlibc
14692 case "$d_getlogin_r" in
14693 "$define")
14694         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14695         case "$d_getlogin_r_proto:$usethreads" in
14696         ":define")      d_getlogin_r_proto=define
14697                 set d_getlogin_r_proto getlogin_r $hdrs
14698                 eval $hasproto ;;
14699         *)      ;;
14700         esac
14701         case "$d_getlogin_r_proto" in
14702         define)
14703         case "$getlogin_r_proto" in
14704         ''|0) try='int getlogin_r(char*, size_t);'
14705         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14706         esac
14707         case "$getlogin_r_proto" in
14708         ''|0) try='int getlogin_r(char*, int);'
14709         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14710         esac
14711         case "$getlogin_r_proto" in
14712         ''|0) try='char* getlogin_r(char*, size_t);'
14713         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14714         esac
14715         case "$getlogin_r_proto" in
14716         ''|0) try='char* getlogin_r(char*, int);'
14717         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14718         esac
14719         case "$getlogin_r_proto" in
14720         ''|0)   d_getlogin_r=undef
14721                 getlogin_r_proto=0
14722                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14723         * )     case "$getlogin_r_proto" in
14724                 REENTRANT_PROTO*) ;;
14725                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14726                 esac
14727                 echo "Prototype: $try" ;;
14728         esac
14729         ;;
14730         *)      case "$usethreads" in
14731                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14732                 esac
14733                 d_getlogin_r=undef
14734                 getlogin_r_proto=0
14735                 ;;
14736         esac
14737         ;;
14738 *)      getlogin_r_proto=0
14739         ;;
14740 esac
14741
14742 : see if getmnt exists
14743 set getmnt d_getmnt
14744 eval $inlibc
14745
14746 : see if getmntent exists
14747 set getmntent d_getmntent
14748 eval $inlibc
14749
14750 : see if getnameinfo exists
14751 set getnameinfo d_getnameinfo
14752 eval $inlibc
14753
14754 : see if getnetbyaddr exists
14755 set getnetbyaddr d_getnbyaddr
14756 eval $inlibc
14757
14758 : see if getnetbyname exists
14759 set getnetbyname d_getnbyname
14760 eval $inlibc
14761
14762 : see if getnetent exists
14763 set getnetent d_getnent
14764 eval $inlibc
14765
14766 : see if getnetbyaddr_r exists
14767 set getnetbyaddr_r d_getnetbyaddr_r
14768 eval $inlibc
14769 case "$d_getnetbyaddr_r" in
14770 "$define")
14771         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14772         case "$d_getnetbyaddr_r_proto:$usethreads" in
14773         ":define")      d_getnetbyaddr_r_proto=define
14774                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14775                 eval $hasproto ;;
14776         *)      ;;
14777         esac
14778         case "$d_getnetbyaddr_r_proto" in
14779         define)
14780         case "$getnetbyaddr_r_proto" in
14781         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14782         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14783         esac
14784         case "$getnetbyaddr_r_proto" in
14785         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14786         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14787         esac
14788         case "$getnetbyaddr_r_proto" in
14789         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14790         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14791         esac
14792         case "$getnetbyaddr_r_proto" in
14793         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14794         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14795         esac
14796         case "$getnetbyaddr_r_proto" in
14797         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14798         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14799         esac
14800         case "$getnetbyaddr_r_proto" in
14801         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14802         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14803         esac
14804         case "$getnetbyaddr_r_proto" in
14805         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14806         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14807         esac
14808         case "$getnetbyaddr_r_proto" in
14809         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14810         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14811         esac
14812         case "$getnetbyaddr_r_proto" in
14813         ''|0)   d_getnetbyaddr_r=undef
14814                 getnetbyaddr_r_proto=0
14815                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14816         * )     case "$getnetbyaddr_r_proto" in
14817                 REENTRANT_PROTO*) ;;
14818                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14819                 esac
14820                 echo "Prototype: $try" ;;
14821         esac
14822         ;;
14823         *)      case "$usethreads" in
14824                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14825                 esac
14826                 d_getnetbyaddr_r=undef
14827                 getnetbyaddr_r_proto=0
14828                 ;;
14829         esac
14830         ;;
14831 *)      getnetbyaddr_r_proto=0
14832         ;;
14833 esac
14834
14835 : see if getnetbyname_r exists
14836 set getnetbyname_r d_getnetbyname_r
14837 eval $inlibc
14838 case "$d_getnetbyname_r" in
14839 "$define")
14840         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14841         case "$d_getnetbyname_r_proto:$usethreads" in
14842         ":define")      d_getnetbyname_r_proto=define
14843                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14844                 eval $hasproto ;;
14845         *)      ;;
14846         esac
14847         case "$d_getnetbyname_r_proto" in
14848         define)
14849         case "$getnetbyname_r_proto" in
14850         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14851         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14852         esac
14853         case "$getnetbyname_r_proto" in
14854         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14855         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14856         esac
14857         case "$getnetbyname_r_proto" in
14858         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14859         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14860         esac
14861         case "$getnetbyname_r_proto" in
14862         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14863         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14864         esac
14865         case "$getnetbyname_r_proto" in
14866         ''|0)   d_getnetbyname_r=undef
14867                 getnetbyname_r_proto=0
14868                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14869         * )     case "$getnetbyname_r_proto" in
14870                 REENTRANT_PROTO*) ;;
14871                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14872                 esac
14873                 echo "Prototype: $try" ;;
14874         esac
14875         ;;
14876         *)      case "$usethreads" in
14877                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14878                 esac
14879                 d_getnetbyname_r=undef
14880                 getnetbyname_r_proto=0
14881                 ;;
14882         esac
14883         ;;
14884 *)      getnetbyname_r_proto=0
14885         ;;
14886 esac
14887
14888 : see if getnetent_r exists
14889 set getnetent_r d_getnetent_r
14890 eval $inlibc
14891 case "$d_getnetent_r" in
14892 "$define")
14893         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14894         case "$d_getnetent_r_proto:$usethreads" in
14895         ":define")      d_getnetent_r_proto=define
14896                 set d_getnetent_r_proto getnetent_r $hdrs
14897                 eval $hasproto ;;
14898         *)      ;;
14899         esac
14900         case "$d_getnetent_r_proto" in
14901         define)
14902         case "$getnetent_r_proto" in
14903         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14904         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14905         esac
14906         case "$getnetent_r_proto" in
14907         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14908         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14909         esac
14910         case "$getnetent_r_proto" in
14911         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14912         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14913         esac
14914         case "$getnetent_r_proto" in
14915         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14916         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14917         esac
14918         case "$getnetent_r_proto" in
14919         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14920         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14921         esac
14922         case "$getnetent_r_proto" in
14923         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14924         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14925         esac
14926         case "$getnetent_r_proto" in
14927         ''|0)   d_getnetent_r=undef
14928                 getnetent_r_proto=0
14929                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14930         * )     case "$getnetent_r_proto" in
14931                 REENTRANT_PROTO*) ;;
14932                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14933                 esac
14934                 echo "Prototype: $try" ;;
14935         esac
14936         ;;
14937         *)      case "$usethreads" in
14938                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14939                 esac
14940                 d_getnetent_r=undef
14941                 getnetent_r_proto=0
14942                 ;;
14943         esac
14944         ;;
14945 *)      getnetent_r_proto=0
14946         ;;
14947 esac
14948
14949 : see if prototypes for various getnetxxx netdb.h functions are available
14950 echo " "
14951 set d_getnetprotos getnetent $i_netdb netdb.h
14952 eval $hasproto
14953
14954 : see if getpagesize exists
14955 set getpagesize d_getpagsz
14956 eval $inlibc
14957
14958 : Optional checks for getprotobyname and getprotobynumber
14959
14960 : see if getprotobyname exists
14961 set getprotobyname d_getpbyname
14962 eval $inlibc
14963
14964 : see if getprotobynumber exists
14965 set getprotobynumber d_getpbynumber
14966 eval $inlibc
14967
14968 : see if getprotoent exists
14969 set getprotoent d_getpent
14970 eval $inlibc
14971
14972 : see if getpgid exists
14973 set getpgid d_getpgid
14974 eval $inlibc
14975
14976 : see if getpgrp2 exists
14977 set getpgrp2 d_getpgrp2
14978 eval $inlibc
14979
14980 : see if getppid exists
14981 set getppid d_getppid
14982 eval $inlibc
14983
14984 : see if getpriority exists
14985 set getpriority d_getprior
14986 eval $inlibc
14987
14988 : see if getprotobyname_r exists
14989 set getprotobyname_r d_getprotobyname_r
14990 eval $inlibc
14991 case "$d_getprotobyname_r" in
14992 "$define")
14993         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14994         case "$d_getprotobyname_r_proto:$usethreads" in
14995         ":define")      d_getprotobyname_r_proto=define
14996                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14997                 eval $hasproto ;;
14998         *)      ;;
14999         esac
15000         case "$d_getprotobyname_r_proto" in
15001         define)
15002         case "$getprotobyname_r_proto" in
15003         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15004         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15005         esac
15006         case "$getprotobyname_r_proto" in
15007         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15008         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15009         esac
15010         case "$getprotobyname_r_proto" in
15011         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15012         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15013         esac
15014         case "$getprotobyname_r_proto" in
15015         ''|0)   d_getprotobyname_r=undef
15016                 getprotobyname_r_proto=0
15017                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15018         * )     case "$getprotobyname_r_proto" in
15019                 REENTRANT_PROTO*) ;;
15020                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15021                 esac
15022                 echo "Prototype: $try" ;;
15023         esac
15024         ;;
15025         *)      case "$usethreads" in
15026                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15027                 esac
15028                 d_getprotobyname_r=undef
15029                 getprotobyname_r_proto=0
15030                 ;;
15031         esac
15032         ;;
15033 *)      getprotobyname_r_proto=0
15034         ;;
15035 esac
15036
15037 : see if getprotobynumber_r exists
15038 set getprotobynumber_r d_getprotobynumber_r
15039 eval $inlibc
15040 case "$d_getprotobynumber_r" in
15041 "$define")
15042         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15043         case "$d_getprotobynumber_r_proto:$usethreads" in
15044         ":define")      d_getprotobynumber_r_proto=define
15045                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15046                 eval $hasproto ;;
15047         *)      ;;
15048         esac
15049         case "$d_getprotobynumber_r_proto" in
15050         define)
15051         case "$getprotobynumber_r_proto" in
15052         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15053         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15054         esac
15055         case "$getprotobynumber_r_proto" in
15056         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15057         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15058         esac
15059         case "$getprotobynumber_r_proto" in
15060         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15061         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15062         esac
15063         case "$getprotobynumber_r_proto" in
15064         ''|0)   d_getprotobynumber_r=undef
15065                 getprotobynumber_r_proto=0
15066                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15067         * )     case "$getprotobynumber_r_proto" in
15068                 REENTRANT_PROTO*) ;;
15069                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15070                 esac
15071                 echo "Prototype: $try" ;;
15072         esac
15073         ;;
15074         *)      case "$usethreads" in
15075                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15076                 esac
15077                 d_getprotobynumber_r=undef
15078                 getprotobynumber_r_proto=0
15079                 ;;
15080         esac
15081         ;;
15082 *)      getprotobynumber_r_proto=0
15083         ;;
15084 esac
15085
15086 : see if getprotoent_r exists
15087 set getprotoent_r d_getprotoent_r
15088 eval $inlibc
15089 case "$d_getprotoent_r" in
15090 "$define")
15091         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15092         case "$d_getprotoent_r_proto:$usethreads" in
15093         ":define")      d_getprotoent_r_proto=define
15094                 set d_getprotoent_r_proto getprotoent_r $hdrs
15095                 eval $hasproto ;;
15096         *)      ;;
15097         esac
15098         case "$d_getprotoent_r_proto" in
15099         define)
15100         case "$getprotoent_r_proto" in
15101         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15102         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15103         esac
15104         case "$getprotoent_r_proto" in
15105         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15106         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15107         esac
15108         case "$getprotoent_r_proto" in
15109         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15110         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15111         esac
15112         case "$getprotoent_r_proto" in
15113         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15114         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15115         esac
15116         case "$getprotoent_r_proto" in
15117         ''|0)   d_getprotoent_r=undef
15118                 getprotoent_r_proto=0
15119                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15120         * )     case "$getprotoent_r_proto" in
15121                 REENTRANT_PROTO*) ;;
15122                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15123                 esac
15124                 echo "Prototype: $try" ;;
15125         esac
15126         ;;
15127         *)      case "$usethreads" in
15128                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15129                 esac
15130                 d_getprotoent_r=undef
15131                 getprotoent_r_proto=0
15132                 ;;
15133         esac
15134         ;;
15135 *)      getprotoent_r_proto=0
15136         ;;
15137 esac
15138
15139 : see if prototypes for various getprotoxxx netdb.h functions are available
15140 echo " "
15141 set d_getprotoprotos getprotoent $i_netdb netdb.h
15142 eval $hasproto
15143
15144 : see if getprpwnam exists
15145 set getprpwnam d_getprpwnam
15146 eval $inlibc
15147
15148 : see if getpwent exists
15149 set getpwent d_getpwent
15150 eval $inlibc
15151
15152 : see if getpwent_r exists
15153 set getpwent_r d_getpwent_r
15154 eval $inlibc
15155 case "$d_getpwent_r" in
15156 "$define")
15157         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15158         case "$d_getpwent_r_proto:$usethreads" in
15159         ":define")      d_getpwent_r_proto=define
15160                 set d_getpwent_r_proto getpwent_r $hdrs
15161                 eval $hasproto ;;
15162         *)      ;;
15163         esac
15164         case "$d_getpwent_r_proto" in
15165         define)
15166         case "$getpwent_r_proto" in
15167         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15168         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15169         esac
15170         case "$getpwent_r_proto" in
15171         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15172         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15173         esac
15174         case "$getpwent_r_proto" in
15175         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15176         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15177         esac
15178         case "$getpwent_r_proto" in
15179         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15180         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15181         esac
15182         case "$getpwent_r_proto" in
15183         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15184         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15185         esac
15186         case "$getpwent_r_proto" in
15187         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15188         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15189         esac
15190         case "$getpwent_r_proto" in
15191         ''|0)   d_getpwent_r=undef
15192                 getpwent_r_proto=0
15193                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15194         * )     case "$getpwent_r_proto" in
15195                 REENTRANT_PROTO*) ;;
15196                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15197                 esac
15198                 echo "Prototype: $try" ;;
15199         esac
15200         ;;
15201         *)      case "$usethreads" in
15202                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15203                 esac
15204                 d_getpwent_r=undef
15205                 getpwent_r_proto=0
15206                 ;;
15207         esac
15208         ;;
15209 *)      getpwent_r_proto=0
15210         ;;
15211 esac
15212
15213 : see if getpwnam_r exists
15214 set getpwnam_r d_getpwnam_r
15215 eval $inlibc
15216 case "$d_getpwnam_r" in
15217 "$define")
15218         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15219         case "$d_getpwnam_r_proto:$usethreads" in
15220         ":define")      d_getpwnam_r_proto=define
15221                 set d_getpwnam_r_proto getpwnam_r $hdrs
15222                 eval $hasproto ;;
15223         *)      ;;
15224         esac
15225         case "$d_getpwnam_r_proto" in
15226         define)
15227         case "$getpwnam_r_proto" in
15228         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15229         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15230         esac
15231         case "$getpwnam_r_proto" in
15232         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15233         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15234         esac
15235         case "$getpwnam_r_proto" in
15236         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15237         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15238         esac
15239         case "$getpwnam_r_proto" in
15240         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15241         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15242         esac
15243         case "$getpwnam_r_proto" in
15244         ''|0)   d_getpwnam_r=undef
15245                 getpwnam_r_proto=0
15246                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15247         * )     case "$getpwnam_r_proto" in
15248                 REENTRANT_PROTO*) ;;
15249                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15250                 esac
15251                 echo "Prototype: $try" ;;
15252         esac
15253         ;;
15254         *)      case "$usethreads" in
15255                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15256                 esac
15257                 d_getpwnam_r=undef
15258                 getpwnam_r_proto=0
15259                 ;;
15260         esac
15261         ;;
15262 *)      getpwnam_r_proto=0
15263         ;;
15264 esac
15265
15266 : see if getpwuid_r exists
15267 set getpwuid_r d_getpwuid_r
15268 eval $inlibc
15269 case "$d_getpwuid_r" in
15270 "$define")
15271         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15272         case "$d_getpwuid_r_proto:$usethreads" in
15273         ":define")      d_getpwuid_r_proto=define
15274                 set d_getpwuid_r_proto getpwuid_r $hdrs
15275                 eval $hasproto ;;
15276         *)      ;;
15277         esac
15278         case "$d_getpwuid_r_proto" in
15279         define)
15280         case "$getpwuid_r_proto" in
15281         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15282         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15283         esac
15284         case "$getpwuid_r_proto" in
15285         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15286         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15287         esac
15288         case "$getpwuid_r_proto" in
15289         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15290         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15291         esac
15292         case "$getpwuid_r_proto" in
15293         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15294         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15295         esac
15296         case "$getpwuid_r_proto" in
15297         ''|0)   d_getpwuid_r=undef
15298                 getpwuid_r_proto=0
15299                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15300         * )     case "$getpwuid_r_proto" in
15301                 REENTRANT_PROTO*) ;;
15302                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15303                 esac
15304                 echo "Prototype: $try" ;;
15305         esac
15306         ;;
15307         *)      case "$usethreads" in
15308                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15309                 esac
15310                 d_getpwuid_r=undef
15311                 getpwuid_r_proto=0
15312                 ;;
15313         esac
15314         ;;
15315 *)      getpwuid_r_proto=0
15316         ;;
15317 esac
15318
15319 : Optional checks for getsbyname and getsbyport
15320
15321 : see if getservbyname exists
15322 set getservbyname d_getsbyname
15323 eval $inlibc
15324
15325 : see if getservbyport exists
15326 set getservbyport d_getsbyport
15327 eval $inlibc
15328
15329 : see if getservent exists
15330 set getservent d_getsent
15331 eval $inlibc
15332
15333 : see if getservbyname_r exists
15334 set getservbyname_r d_getservbyname_r
15335 eval $inlibc
15336 case "$d_getservbyname_r" in
15337 "$define")
15338         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15339         case "$d_getservbyname_r_proto:$usethreads" in
15340         ":define")      d_getservbyname_r_proto=define
15341                 set d_getservbyname_r_proto getservbyname_r $hdrs
15342                 eval $hasproto ;;
15343         *)      ;;
15344         esac
15345         case "$d_getservbyname_r_proto" in
15346         define)
15347         case "$getservbyname_r_proto" in
15348         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15349         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15350         esac
15351         case "$getservbyname_r_proto" in
15352         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15353         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15354         esac
15355         case "$getservbyname_r_proto" in
15356         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15357         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15358         esac
15359         case "$getservbyname_r_proto" in
15360         ''|0)   d_getservbyname_r=undef
15361                 getservbyname_r_proto=0
15362                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15363         * )     case "$getservbyname_r_proto" in
15364                 REENTRANT_PROTO*) ;;
15365                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15366                 esac
15367                 echo "Prototype: $try" ;;
15368         esac
15369         ;;
15370         *)      case "$usethreads" in
15371                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15372                 esac
15373                 d_getservbyname_r=undef
15374                 getservbyname_r_proto=0
15375                 ;;
15376         esac
15377         ;;
15378 *)      getservbyname_r_proto=0
15379         ;;
15380 esac
15381
15382 : see if getservbyport_r exists
15383 set getservbyport_r d_getservbyport_r
15384 eval $inlibc
15385 case "$d_getservbyport_r" in
15386 "$define")
15387         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15388         case "$d_getservbyport_r_proto:$usethreads" in
15389         ":define")      d_getservbyport_r_proto=define
15390                 set d_getservbyport_r_proto getservbyport_r $hdrs
15391                 eval $hasproto ;;
15392         *)      ;;
15393         esac
15394         case "$d_getservbyport_r_proto" in
15395         define)
15396         case "$getservbyport_r_proto" in
15397         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15398         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15399         esac
15400         case "$getservbyport_r_proto" in
15401         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15402         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15403         esac
15404         case "$getservbyport_r_proto" in
15405         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15406         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15407         esac
15408         case "$getservbyport_r_proto" in
15409         ''|0)   d_getservbyport_r=undef
15410                 getservbyport_r_proto=0
15411                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15412         * )     case "$getservbyport_r_proto" in
15413                 REENTRANT_PROTO*) ;;
15414                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15415                 esac
15416                 echo "Prototype: $try" ;;
15417         esac
15418         ;;
15419         *)      case "$usethreads" in
15420                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15421                 esac
15422                 d_getservbyport_r=undef
15423                 getservbyport_r_proto=0
15424                 ;;
15425         esac
15426         ;;
15427 *)      getservbyport_r_proto=0
15428         ;;
15429 esac
15430
15431 : see if getservent_r exists
15432 set getservent_r d_getservent_r
15433 eval $inlibc
15434 case "$d_getservent_r" in
15435 "$define")
15436         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15437         case "$d_getservent_r_proto:$usethreads" in
15438         ":define")      d_getservent_r_proto=define
15439                 set d_getservent_r_proto getservent_r $hdrs
15440                 eval $hasproto ;;
15441         *)      ;;
15442         esac
15443         case "$d_getservent_r_proto" in
15444         define)
15445         case "$getservent_r_proto" in
15446         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15447         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15448         esac
15449         case "$getservent_r_proto" in
15450         ''|0) try='int getservent_r(struct servent*, char*, int);'
15451         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15452         esac
15453         case "$getservent_r_proto" in
15454         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15455         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15456         esac
15457         case "$getservent_r_proto" in
15458         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15459         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15460         esac
15461         case "$getservent_r_proto" in
15462         ''|0)   d_getservent_r=undef
15463                 getservent_r_proto=0
15464                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15465         * )     case "$getservent_r_proto" in
15466                 REENTRANT_PROTO*) ;;
15467                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15468                 esac
15469                 echo "Prototype: $try" ;;
15470         esac
15471         ;;
15472         *)      case "$usethreads" in
15473                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15474                 esac
15475                 d_getservent_r=undef
15476                 getservent_r_proto=0
15477                 ;;
15478         esac
15479         ;;
15480 *)      getservent_r_proto=0
15481         ;;
15482 esac
15483
15484 : see if prototypes for various getservxxx netdb.h functions are available
15485 echo " "
15486 set d_getservprotos getservent $i_netdb netdb.h
15487 eval $hasproto
15488
15489 : see if getspnam exists
15490 set getspnam d_getspnam
15491 eval $inlibc
15492
15493 : see if this is a shadow.h system
15494 set shadow.h i_shadow
15495 eval $inhdr
15496
15497 : see if getspnam_r exists
15498 set getspnam_r d_getspnam_r
15499 eval $inlibc
15500 case "$d_getspnam_r" in
15501 "$define")
15502         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15503         case "$d_getspnam_r_proto:$usethreads" in
15504         ":define")      d_getspnam_r_proto=define
15505                 set d_getspnam_r_proto getspnam_r $hdrs
15506                 eval $hasproto ;;
15507         *)      ;;
15508         esac
15509         case "$d_getspnam_r_proto" in
15510         define)
15511         case "$getspnam_r_proto" in
15512         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15513         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15514         esac
15515         case "$getspnam_r_proto" in
15516         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15517         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15518         esac
15519         case "$getspnam_r_proto" in
15520         ''|0)   d_getspnam_r=undef
15521                 getspnam_r_proto=0
15522                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15523         * )     case "$getspnam_r_proto" in
15524                 REENTRANT_PROTO*) ;;
15525                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15526                 esac
15527                 echo "Prototype: $try" ;;
15528         esac
15529         ;;
15530         *)      case "$usethreads" in
15531                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15532                 esac
15533                 d_getspnam_r=undef
15534                 getspnam_r_proto=0
15535                 ;;
15536         esac
15537         ;;
15538 *)      getspnam_r_proto=0
15539         ;;
15540 esac
15541
15542 : see if gettimeofday or ftime exists
15543 set gettimeofday d_gettimeod
15544 eval $inlibc
15545 case "$d_gettimeod" in
15546 "$undef")
15547         set ftime d_ftime 
15548         eval $inlibc
15549         ;;
15550 *)
15551         val="$undef"; set d_ftime; eval $setvar
15552         ;;
15553 esac
15554 case "$d_gettimeod$d_ftime" in
15555 "$undef$undef")
15556         echo " "
15557         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15558         ;;
15559 esac
15560
15561 : see if gmtime_r exists
15562 set gmtime_r d_gmtime_r
15563 eval $inlibc
15564 case "$d_gmtime_r" in
15565 "$define")
15566         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15567         case "$d_gmtime_r_proto:$usethreads" in
15568         ":define")      d_gmtime_r_proto=define
15569                 set d_gmtime_r_proto gmtime_r $hdrs
15570                 eval $hasproto ;;
15571         *)      ;;
15572         esac
15573         case "$d_gmtime_r_proto" in
15574         define)
15575         case "$gmtime_r_proto" in
15576         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15577         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15578         esac
15579         case "$gmtime_r_proto" in
15580         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15581         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15582         esac
15583         case "$gmtime_r_proto" in
15584         ''|0)   d_gmtime_r=undef
15585                 gmtime_r_proto=0
15586                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15587         * )     case "$gmtime_r_proto" in
15588                 REENTRANT_PROTO*) ;;
15589                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15590                 esac
15591                 echo "Prototype: $try" ;;
15592         esac
15593         ;;
15594         *)      case "$usethreads" in
15595                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15596                 esac
15597                 d_gmtime_r=undef
15598                 gmtime_r_proto=0
15599                 ;;
15600         esac
15601         ;;
15602 *)      gmtime_r_proto=0
15603         ;;
15604 esac
15605
15606 : see if hasmntopt exists
15607 set hasmntopt d_hasmntopt
15608 eval $inlibc
15609
15610 : see if this is a netinet/in.h or sys/in.h system
15611 set netinet/in.h i_niin sys/in.h i_sysin
15612 eval $inhdr
15613
15614 : see if arpa/inet.h has to be included
15615 set arpa/inet.h i_arpainet
15616 eval $inhdr
15617
15618 : see if htonl --and friends-- exists
15619 val=''
15620 set htonl val
15621 eval $inlibc
15622
15623 : Maybe they are macros.
15624 case "$val" in
15625 $undef)
15626         $cat >htonl.c <<EOM
15627 #include <stdio.h>
15628 #include <sys/types.h>
15629 #$i_niin I_NETINET_IN
15630 #$i_sysin I_SYS_IN
15631 #$i_arpainet I_ARPA_INET
15632 #ifdef I_NETINET_IN
15633 #include <netinet/in.h>
15634 #endif
15635 #ifdef I_SYS_IN
15636 #include <sys/in.h>
15637 #endif
15638 #ifdef I_ARPA_INET
15639 #include <arpa/inet.h>
15640 #endif
15641 #ifdef htonl
15642 printf("Defined as a macro.");
15643 #endif
15644 EOM
15645         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15646         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15647                 val="$define"
15648                 echo "But it seems to be defined as a macro." >&4
15649         fi
15650         $rm -f htonl.?
15651         ;;
15652 esac
15653 set d_htonl
15654 eval $setvar
15655
15656 : see if hypot exists
15657 set hypot d_hypot
15658 eval $inlibc
15659
15660 : see if ilogb exists
15661 set ilogb d_ilogb
15662 eval $inlibc
15663
15664 : see if ilogbl exists
15665 set ilogbl d_ilogbl
15666 eval $inlibc
15667
15668 : index or strchr
15669 echo " "
15670 if set index val -f; eval $csym; $val; then
15671         if set strchr val -f d_strchr; eval $csym; $val; then
15672                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15673                         val="$define"
15674                         vali="$undef"
15675                         echo "strchr() found." >&4
15676                 else
15677                         val="$undef"
15678                         vali="$define"
15679                         echo "index() found." >&4
15680                 fi
15681         else
15682                 val="$undef"
15683                 vali="$define"
15684                 echo "index() found." >&4
15685         fi
15686 else
15687         if set strchr val -f d_strchr; eval $csym; $val; then
15688                 val="$define"
15689                 vali="$undef"
15690                 echo "strchr() found." >&4
15691         else
15692                 echo "No index() or strchr() found!" >&4
15693                 val="$undef"
15694                 vali="$undef"
15695         fi
15696 fi
15697 set d_strchr; eval $setvar
15698 val="$vali"
15699 set d_index; eval $setvar
15700
15701 : check whether inet_aton exists
15702 set inet_aton d_inetaton
15703 eval $inlibc
15704
15705 : see if inet_ntop exists
15706 set inet_ntop d_inetntop
15707 eval $inlibc
15708
15709 : see if inet_pton exists
15710 set inet_pton d_inetpton
15711 eval $inlibc
15712
15713 : Look for isascii
15714 echo " "
15715 $cat >isascii.c <<EOCP
15716 #include <stdio.h>
15717 #include <ctype.h>
15718 #$i_stdlib I_STDLIB
15719 #ifdef I_STDLIB
15720 #include <stdlib.h>
15721 #endif
15722 int main() {
15723         int c = 'A';
15724         if (isascii(c))
15725                 exit(0);
15726         else
15727                 exit(1);
15728 }
15729 EOCP
15730 set isascii
15731 if eval $compile; then
15732         echo "isascii() found." >&4
15733         val="$define"
15734 else
15735         echo "isascii() NOT found." >&4
15736         val="$undef"
15737 fi
15738 set d_isascii
15739 eval $setvar
15740 $rm -f isascii*
15741
15742 : Look for isblank
15743 echo " "
15744 $cat >isblank.c <<'EOCP'
15745 #include <stdio.h>
15746 #include <ctype.h>
15747 int main() {
15748         int c = ' ';
15749         if (isblank(c))
15750                 return 0 ;
15751         else
15752                 return 1 ;
15753 }
15754 EOCP
15755 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15756         echo "isblank() found." >&4
15757         val="$define"
15758 else
15759         echo "isblank() NOT found." >&4
15760         val="$undef"
15761 fi
15762 set d_isblank
15763 eval $setvar
15764 $rm -f isblank*
15765
15766 : check for isfinite
15767 echo "Checking to see if you have isfinite..." >&4
15768 $cat >try.c <<EOCP
15769 #$i_math I_MATH
15770 #ifdef I_MATH
15771 #include <math.h>
15772 #endif
15773 int main() { return isfinite(0.0); }
15774 EOCP
15775 set try
15776 if eval $compile; then
15777         val="$define"
15778         echo "You have isfinite."
15779 else
15780         val="$undef"
15781         echo "You do not have isfinite."
15782 fi
15783 $rm_try
15784 set d_isfinite
15785 eval $setvar
15786
15787 : see if isfinitel exists
15788 set isfinitel d_isfinitel
15789 eval $inlibc
15790
15791 : check for isinf
15792 echo "Checking to see if you have isinf..." >&4
15793 $cat >try.c <<EOCP
15794 #$i_math I_MATH
15795 #ifdef I_MATH
15796 #include <math.h>
15797 #endif
15798 int main() { return isinf(0.0); }
15799 EOCP
15800 set try
15801 if eval $compile; then
15802         val="$define"
15803         echo "You have isinf."
15804 else
15805         val="$undef"
15806         echo "You do not have isinf."
15807 fi
15808 $rm_try
15809 set d_isinf
15810 eval $setvar
15811
15812 : see if isinfl exists
15813 set isinfl d_isinfl
15814 eval $inlibc
15815
15816 : check for isless
15817 echo "Checking to see if you have isless..." >&4
15818 $cat >try.c <<EOCP
15819 #$i_math I_MATH
15820 #ifdef I_MATH
15821 #include <math.h>
15822 #endif
15823 int main() { return isless(0.0); }
15824 EOCP
15825 set try
15826 if eval $compile; then
15827         val="$define"
15828         echo "You have isless."
15829 else
15830         val="$undef"
15831         echo "You do not have isless."
15832 fi
15833 $rm_try
15834 set d_isless
15835 eval $setvar
15836
15837 : check for isnan
15838 echo "Checking to see if you have isnan..." >&4
15839 $cat >try.c <<EOCP
15840 #$i_math I_MATH
15841 #ifdef I_MATH
15842 #include <math.h>
15843 #endif
15844 int main() { return isnan(0.0); }
15845 EOCP
15846 set try
15847 if eval $compile; then
15848         val="$define"
15849         echo "You have isnan."
15850 else
15851         val="$undef"
15852         echo "You do not have isnan."
15853 fi
15854 $rm_try
15855 set d_isnan
15856 eval $setvar
15857
15858 : see if isnanl exists
15859 set isnanl d_isnanl
15860 eval $inlibc
15861
15862 : check for isnormal
15863 echo "Checking to see if you have isnormal..." >&4
15864 $cat >try.c <<EOCP
15865 #$i_math I_MATH
15866 #ifdef I_MATH
15867 #include <math.h>
15868 #endif
15869 int main() { return isnormal(0.0); }
15870 EOCP
15871 set try
15872 if eval $compile; then
15873         val="$define"
15874         echo "You have isnormal."
15875 else
15876         val="$undef"
15877         echo "You do not have isnormal."
15878 fi
15879 $rm_try
15880 set d_isnormal
15881 eval $setvar
15882
15883 : see if j0 exists
15884 set j0 d_j0
15885 eval $inlibc
15886
15887 : see if j0l exists
15888 set j0l d_j0l
15889 eval $inlibc
15890
15891 : see if killpg exists
15892 set killpg d_killpg
15893 eval $inlibc
15894
15895 : see if localeconv exists
15896 set localeconv d_locconv
15897 eval $inlibc
15898
15899 : see if libc has the POSIX.1-2008 currency locale rules
15900 case "$d_locconv:$d_lc_monetary_2008" in
15901 $define:)
15902         $cat >try.c <<EOCP
15903 #include <locale.h>
15904 int main() {
15905         struct lconv *lc = localeconv();
15906         char int_p_cs_precedes = lc->int_p_cs_precedes;
15907         return 0;
15908 }
15909 EOCP
15910         set try
15911         if eval $compile; then
15912                 d_lc_monetary_2008="$define"
15913         else
15914                 d_lc_monetary_2008="$undef"
15915         fi;
15916         $rm_try
15917         ;;
15918 esac
15919
15920 : see if lchown exists
15921 echo " "
15922 $cat > try.c <<'EOCP'
15923 /* System header to define __stub macros and hopefully few prototypes,
15924     which can conflict with char lchown(); below.  */
15925 #include <assert.h>
15926 /* Override any gcc2 internal prototype to avoid an error.  */
15927 /* We use char because int might match the return type of a gcc2
15928    builtin and then its argument prototype would still apply.  */
15929 char lchown();
15930 int main() {
15931     /*  The GNU C library defines this for functions which it implements
15932         to always fail with ENOSYS.  Some functions are actually named
15933         something starting with __ and the normal name is an alias.  */
15934 #if defined (__stub_lchown) || defined (__stub___lchown)
15935 choke me
15936 #else
15937 lchown();
15938 #endif
15939 ; return 0; }
15940 EOCP
15941 set try
15942 if eval $compile; then
15943     $echo "lchown() found." >&4
15944     val="$define"
15945 else
15946     $echo "lchown() NOT found." >&4
15947     val="$undef"
15948 fi
15949 set d_lchown
15950 eval $setvar
15951
15952 : See if number of significant digits in a double precision number is known
15953 echo " "
15954 $cat >ldbl_dig.c <<EOM
15955 #$i_limits I_LIMITS
15956 #$i_float I_FLOAT
15957 #ifdef I_LIMITS
15958 #include <limits.h>
15959 #endif
15960 #ifdef I_FLOAT
15961 #include <float.h>
15962 #endif
15963 #ifdef LDBL_DIG
15964 printf("Contains LDBL_DIG");
15965 #endif
15966 EOM
15967 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15968 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15969         echo "LDBL_DIG found." >&4
15970         val="$define"
15971 else
15972         echo "LDBL_DIG NOT found." >&4
15973         val="$undef"
15974 fi
15975 $rm -f ldbl_dig.?
15976 set d_ldbl_dig
15977 eval $setvar
15978
15979 : see if lgamma exists
15980 set lgamma d_lgamma
15981 eval $inlibc
15982
15983 : see if lgamma_r exists
15984 set lgamma_r d_lgamma_r
15985 eval $inlibc
15986
15987 : check to see if math.h defines _LIB_VERSION
15988 d_libm_lib_version="$undef"
15989 case $i_math in
15990     $define)
15991         echo " "
15992         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15993         $cat >try.c <<EOCP
15994 #include <unistd.h>
15995 #include <math.h>
15996 int main (int argc, char *argv[])
15997 {
15998     printf ("%d\n", _LIB_VERSION);
15999     return (0);
16000     } /* main */
16001 EOCP
16002         set try
16003         if eval $compile; then
16004             foo=`$run ./try`
16005             echo "Yes, it does ($foo)" >&4
16006             d_libm_lib_version="$define"
16007         else
16008             echo "No, it does not (probably harmless)" >&4
16009             fi
16010         $rm_try
16011         ;;
16012
16013     esac
16014
16015 : see if link exists
16016 set link d_link
16017 eval $inlibc
16018
16019 : see if llrint exists
16020 set llrint d_llrint
16021 eval $inlibc
16022
16023 : see if llrintl exists
16024 set llrintl d_llrintl
16025 eval $inlibc
16026
16027 : see if llround exists
16028 set llround d_llround
16029 eval $inlibc
16030
16031 : see if llroundl exists
16032 set llroundl d_llroundl
16033 eval $inlibc
16034
16035 : see if localtime_r exists
16036 set localtime_r d_localtime_r
16037 eval $inlibc
16038 case "$d_localtime_r" in
16039 "$define")
16040         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16041         case "$d_localtime_r_proto:$usethreads" in
16042         ":define")      d_localtime_r_proto=define
16043                 set d_localtime_r_proto localtime_r $hdrs
16044                 eval $hasproto ;;
16045         *)      ;;
16046         esac
16047         case "$d_localtime_r_proto" in
16048         define)
16049         case "$localtime_r_proto" in
16050         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16051         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16052         esac
16053         case "$localtime_r_proto" in
16054         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16055         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16056         esac
16057         case "$localtime_r_proto" in
16058         ''|0)   d_localtime_r=undef
16059                 localtime_r_proto=0
16060                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16061         * )     case "$localtime_r_proto" in
16062                 REENTRANT_PROTO*) ;;
16063                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16064                 esac
16065                 echo "Prototype: $try" ;;
16066         esac
16067         ;;
16068         *)      case "$usethreads" in
16069                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16070                 esac
16071                 d_localtime_r=undef
16072                 localtime_r_proto=0
16073                 ;;
16074         esac
16075         ;;
16076 *)      localtime_r_proto=0
16077         ;;
16078 esac
16079
16080 : see if localtime_r calls tzset
16081 case "$localtime_r_proto" in
16082 REENTRANT_PROTO*)
16083         $cat >try.c <<EOCP
16084 /*  Does our libc's localtime_r call tzset ?
16085  *  return 0 if so, 1 otherwise.
16086  */
16087 #$i_systypes    I_SYS_TYPES
16088 #$i_unistd      I_UNISTD
16089 #$i_time        I_TIME
16090 #$i_stdlib      I_STDLIB
16091 #$i_string      I_STRING
16092 #$i_malloc      I_MALLOC
16093 #ifdef I_SYS_TYPES
16094 #  include <sys/types.h>
16095 #endif
16096 #ifdef I_UNISTD
16097 #  include <unistd.h>
16098 #endif
16099 #ifdef I_TIME
16100 #  include <time.h>
16101 #endif
16102 #ifdef I_STDLIB
16103 #include <stdlib.h>
16104 #endif
16105 #ifdef I_STRING
16106 #  include <string.h>
16107 #else
16108 #  include <strings.h>
16109 #endif
16110 #ifdef I_MALLOC
16111 #  include <malloc.h>
16112 #endif
16113 int main()
16114 {
16115     time_t t = time(0L);
16116     char w_tz[]="TZ" "=GMT+5",
16117          e_tz[]="TZ" "=GMT-5",
16118         *tz_e = (char*)malloc(16),
16119         *tz_w = (char*)malloc(16);
16120     struct tm tm_e, tm_w;
16121     memset(&tm_e,'\0',sizeof(struct tm));
16122     memset(&tm_w,'\0',sizeof(struct tm));
16123     strcpy(tz_e,e_tz);
16124     strcpy(tz_w,w_tz);
16125
16126     putenv(tz_e);
16127     localtime_r(&t, &tm_e);
16128
16129     putenv(tz_w);
16130     localtime_r(&t, &tm_w);
16131
16132     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16133         return 1;
16134     return 0;
16135 }
16136 EOCP
16137         set try
16138         if eval $compile; then
16139             if $run ./try; then
16140                 d_localtime_r_needs_tzset=undef;
16141             else
16142                 d_localtime_r_needs_tzset=define;
16143             fi;
16144         else
16145             d_localtime_r_needs_tzset=undef;
16146         fi;
16147      ;;
16148   *)
16149      d_localtime_r_needs_tzset=undef;
16150      ;;
16151 esac
16152 $rm_try
16153
16154 : see if lockf exists
16155 set lockf d_lockf
16156 eval $inlibc
16157
16158 : see if log1p exists
16159 set log1p d_log1p
16160 eval $inlibc
16161
16162 : see if log2 exists
16163 set log2 d_log2
16164 eval $inlibc
16165
16166 : see if logb exists
16167 set logb d_logb
16168 eval $inlibc
16169
16170 : see if lrint exists
16171 set lrint d_lrint
16172 eval $inlibc
16173
16174 : see if lrintl exists
16175 set lrintl d_lrintl
16176 eval $inlibc
16177
16178 : see if lround exists
16179 set lround d_lround
16180 eval $inlibc
16181
16182 : see if lroundl exists
16183 set lroundl d_lroundl
16184 eval $inlibc
16185
16186 : see if prototype for lseek is available
16187 echo " "
16188 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16189 eval $hasproto
16190
16191 : see if lstat exists
16192 set lstat d_lstat
16193 eval $inlibc
16194
16195 : see if madvise exists
16196 set madvise d_madvise
16197 eval $inlibc
16198
16199 : see if malloc_size exists
16200 set malloc_size d_malloc_size
16201 eval $inlibc
16202
16203 : see if malloc_size_good exists
16204 set malloc_good_size d_malloc_good_size
16205 eval $inlibc
16206
16207 : see if mblen exists
16208 set mblen d_mblen
16209 eval $inlibc
16210
16211 : see if mbstowcs exists
16212 set mbstowcs d_mbstowcs
16213 eval $inlibc
16214
16215 : see if mbtowc exists
16216 set mbtowc d_mbtowc
16217 eval $inlibc
16218
16219 : see if memchr exists
16220 set memchr d_memchr
16221 eval $inlibc
16222
16223 : see if memcmp exists
16224 set memcmp d_memcmp
16225 eval $inlibc
16226
16227 : see if memcpy exists
16228 set memcpy d_memcpy
16229 eval $inlibc
16230
16231 : see if memmove exists
16232 set memmove d_memmove
16233 eval $inlibc
16234
16235 : see if memset exists
16236 set memset d_memset
16237 eval $inlibc
16238
16239 : see if mkdir exists
16240 set mkdir d_mkdir
16241 eval $inlibc
16242
16243 : see if mkdtemp exists
16244 set mkdtemp d_mkdtemp
16245 eval $inlibc
16246
16247 : see if mkfifo exists
16248 set mkfifo d_mkfifo
16249 eval $inlibc
16250
16251 : see if mkstemp exists
16252 set mkstemp d_mkstemp
16253 eval $inlibc
16254
16255 : see if mkstemps exists
16256 set mkstemps d_mkstemps
16257 eval $inlibc
16258
16259 : see if mktime exists
16260 set mktime d_mktime
16261 eval $inlibc
16262
16263 : see if this is a sys/mman.h system
16264 set sys/mman.h i_sysmman
16265 eval $inhdr
16266
16267 : see if mmap exists
16268 set mmap d_mmap
16269 eval $inlibc
16270 : see what shmat returns
16271 : default to something harmless
16272 mmaptype='void *'
16273 case "$i_sysmman$d_mmap" in
16274 "$define$define")
16275         $cat >mmap.c <<'END'
16276 #include <sys/mman.h>
16277 void *mmap();
16278 END
16279         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16280                 mmaptype='void *'
16281         else
16282                 mmaptype='caddr_t'
16283         fi
16284         echo "and it returns ($mmaptype)." >&4
16285         ;;
16286 esac
16287
16288
16289
16290 : see if sqrtl exists
16291 set sqrtl d_sqrtl
16292 eval $inlibc
16293
16294 : see if scalbnl exists
16295 set scalbnl d_scalbnl
16296 eval $inlibc
16297
16298 : see if truncl exists
16299 set truncl d_truncl
16300 eval $inlibc
16301
16302 : see if modfl exists
16303 set modfl d_modfl
16304 eval $inlibc
16305
16306 : see if prototype for modfl is available
16307 echo " "
16308 set d_modflproto modfl $i_math math.h
16309 eval $hasproto
16310
16311 d_modfl_pow32_bug="$undef"
16312
16313 case "$d_longdbl$d_modfl" in
16314 $define$define)
16315         $cat <<EOM
16316 Checking to see whether your modfl() is okay for large values...
16317 EOM
16318 $cat >try.c <<EOCP
16319 #include <math.h>
16320 #include <stdio.h>
16321 EOCP
16322 if $test "X$d_modflproto" != "X$define"; then
16323         $cat >>try.c <<EOCP
16324 /* Sigh. many current glibcs provide the function, but do not prototype it. */
16325 long double modfl (long double, long double *);
16326 EOCP
16327 fi
16328 $cat >>try.c <<EOCP
16329 int main() {
16330     long double nv = 4294967303.15;
16331     long double v, w;
16332     v = modfl(nv, &w);
16333 #ifdef __GLIBC__
16334     printf("glibc");
16335 #endif
16336     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
16337     return 0;
16338 }
16339 EOCP
16340         case "$osname:$gccversion" in
16341         aix:)   saveccflags="$ccflags"
16342                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
16343         esac
16344         set try
16345         if eval $compile; then
16346                 foo=`$run ./try`
16347                 case "$foo" in
16348                 *" 4294967303.150000 1.150000 4294967302.000000")
16349                         echo >&4 "Your modfl() is broken for large values."
16350                         d_modfl_pow32_bug="$define"
16351                         case "$foo" in
16352                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
16353                         ;;
16354                         esac
16355                         ;;
16356                 *" 4294967303.150000 0.150000 4294967303.000000")
16357                         echo >&4 "Your modfl() seems okay for large values."
16358                         ;;
16359                 *)      echo >&4 "I don't understand your modfl() at all."
16360                         d_modfl="$undef"
16361                         ;;
16362                 esac
16363                 $rm_try
16364         else
16365                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
16366                 d_modfl="$undef"
16367         fi
16368         case "$osname:$gccversion" in
16369         aix:)   ccflags="$saveccflags" ;; # restore
16370         esac
16371         ;;
16372 esac
16373
16374 if $test "$uselongdouble" = "$define"; then
16375     message=""
16376     if $test "$d_sqrtl" != "$define"; then
16377         message="$message sqrtl"
16378     fi
16379     if $test "$d_modfl" != "$define"; then
16380         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16381             echo "You have both truncl and copysignl, so I can emulate modfl."
16382         else
16383             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16384                 echo "You have both aintl and copysignl, so I can emulate modfl."
16385             else
16386                 message="$message modfl"
16387             fi
16388         fi
16389     fi
16390     if $test "$d_frexpl" != "$define"; then
16391         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16392             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16393         else
16394             message="$message frexpl"
16395         fi
16396     fi
16397     if $test "$d_ldexpl" != "$define"; then
16398         message="$message ldexpl"
16399     fi
16400
16401     if $test "$message" != ""; then
16402         $cat <<EOM >&4
16403
16404 *** You requested the use of long doubles but you do not seem to have
16405 *** the following mathematical functions needed for long double support:
16406 ***    $message
16407 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16408 *** Cannot continue, aborting.
16409
16410 EOM
16411
16412         exit 1
16413     fi
16414 fi
16415
16416 : see if mprotect exists
16417 set mprotect d_mprotect
16418 eval $inlibc
16419
16420 : see if msgctl exists
16421 set msgctl d_msgctl
16422 eval $inlibc
16423
16424 : see if msgget exists
16425 set msgget d_msgget
16426 eval $inlibc
16427
16428 : see if msgsnd exists
16429 set msgsnd d_msgsnd
16430 eval $inlibc
16431
16432 : see if msgrcv exists
16433 set msgrcv d_msgrcv
16434 eval $inlibc
16435
16436 : see how much of the 'msg*(2)' library is present.
16437 h_msg=true
16438 echo " "
16439 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16440 *"$undef"*) h_msg=false;;
16441 esac
16442 case "$osname" in
16443 freebsd)
16444     case "`ipcs 2>&1`" in
16445     "SVID messages"*"not configured"*)
16446         echo "Your $osname does not have the msg*(2) configured." >&4
16447         h_msg=false
16448         val="$undef"
16449         set msgctl d_msgctl
16450         eval $setvar
16451         set msgget d_msgget
16452         eval $setvar
16453         set msgsnd d_msgsnd
16454         eval $setvar
16455         set msgrcv d_msgrcv
16456         eval $setvar
16457         ;;
16458     esac
16459     ;;
16460 esac
16461 : we could also check for sys/ipc.h ...
16462 if $h_msg && $test `./findhdr sys/msg.h`; then
16463         echo "You have the full msg*(2) library." >&4
16464         val="$define"
16465 else
16466         echo "You don't have the full msg*(2) library." >&4
16467         val="$undef"
16468 fi
16469 set d_msg
16470 eval $setvar
16471
16472 : Check for msghdr_s
16473 echo " "
16474 echo "Checking to see if your system supports struct msghdr..." >&4
16475 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16476 eval $hasstruct
16477 case "$d_msghdr_s" in
16478 "$define")      echo "Yes, it does."   ;;
16479 *)              echo "No, it doesn't." ;;
16480 esac
16481
16482
16483 : see if msync exists
16484 set msync d_msync
16485 eval $inlibc
16486
16487 : see if munmap exists
16488 set munmap d_munmap
16489 eval $inlibc
16490
16491 : see if nan exists
16492 set nan d_nan
16493 eval $inlibc
16494
16495 : see if nearbyint exists
16496 set nearbyint d_nearbyint
16497 eval $inlibc
16498
16499 : see if nextafter exists
16500 set nextafter d_nextafter
16501 eval $inlibc
16502
16503 : see if nexttoward exists
16504 set nexttoward d_nexttoward
16505 eval $inlibc
16506
16507 : see if nice exists
16508 set nice d_nice
16509 eval $inlibc
16510
16511 : see if this is a langinfo.h system
16512 set langinfo.h i_langinfo
16513 eval $inhdr
16514
16515 : see if nl_langinfo exists
16516 set nl_langinfo d_nl_langinfo
16517 eval $inlibc
16518
16519 : see if this is a quadmath.h system
16520 set quadmath.h i_quadmath
16521 eval $inhdr
16522
16523 : check for volatile keyword
16524 echo " "
16525 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
16526 $cat >try.c <<'EOCP'
16527 int main()
16528 {
16529         typedef struct _goo_struct goo_struct;
16530         goo_struct * volatile goo = ((goo_struct *)0);
16531         struct _goo_struct {
16532                 long long_int;
16533                 int reg_int;
16534                 char char_var;
16535         };
16536         typedef unsigned short foo_t;
16537         char *volatile foo;
16538         volatile int bar;
16539         volatile foo_t blech;
16540         foo = foo;
16541 }
16542 EOCP
16543 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
16544         val="$define"
16545         echo "Yup, it does."
16546 else
16547         val="$undef"
16548         echo "Nope, it doesn't."
16549 fi
16550 set d_volatile
16551 eval $setvar
16552 $rm_try
16553
16554 : Check basic sizes
16555 echo " "
16556 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16557
16558 case "$use64bitint:$d_quad:$quadtype" in
16559 define:define:?*)
16560         ivtype="$quadtype"
16561         uvtype="$uquadtype"
16562         ivsize=8
16563         uvsize=8
16564         ;;
16565 *)      ivtype="long"
16566         uvtype="unsigned long"
16567         ivsize=$longsize
16568         uvsize=$longsize
16569         ;;
16570 esac
16571
16572 case "$uselongdouble:$d_longdbl" in
16573 define:define)
16574         nvtype="long double"
16575         nvsize=$longdblsize
16576         ;;
16577 *)      nvtype=double
16578         nvsize=$doublesize
16579         ;;
16580 esac
16581
16582 case "$usequadmath:$i_quadmath" in
16583 define:define)
16584   nvtype="__float128"
16585   nvsize=16
16586   case "$libs" in
16587   *quadmath*) ;;
16588   *) $cat <<EOM >&4
16589
16590 *** You requested the use of the quadmath library, but you
16591 *** do not seem to have the quadmath library installed.
16592 *** Cannot continue, aborting.
16593 EOM
16594     exit 1
16595     ;;
16596   esac
16597   ;;
16598 define:*) $cat <<EOM >&4
16599
16600 *** You requested the use of the quadmath library, but you
16601 *** do not seem to have the required header, <quadmath.h>.
16602 EOM
16603   case "$gccversion" in
16604   [23].*|4.[0-5]*)
16605    $cat <<EOM >&4
16606 *** Your gcc looks a bit old:
16607 *** $gccversion
16608 EOM
16609     ;;
16610   '')
16611    $cat <<EOM >&4
16612 *** You are not running a gcc.
16613 EOM
16614     ;;
16615   esac
16616   $cat <<EOM >&4
16617 *** For the quadmath library you need at least gcc 4.6.
16618 *** Cannot continue, aborting.
16619 EOM
16620   exit 1
16621   ;;
16622 esac
16623
16624 $echo "(IV will be "$ivtype", $ivsize bytes)"
16625 $echo "(UV will be "$uvtype", $uvsize bytes)"
16626 $echo "(NV will be "$nvtype", $nvsize bytes)"
16627
16628 $cat >try.c <<EOCP
16629 #$i_inttypes I_INTTYPES
16630 #ifdef I_INTTYPES
16631 #include <inttypes.h>
16632 #endif
16633 #include <stdio.h>
16634 int main() {
16635 #ifdef INT8
16636    int8_t i =  INT8_MAX;
16637   uint8_t u = UINT8_MAX;
16638   printf("int8_t\n");
16639 #endif
16640 #ifdef INT16
16641    int16_t i =  INT16_MAX;
16642   uint16_t u = UINT16_MAX;
16643   printf("int16_t\n");
16644 #endif
16645 #ifdef INT32
16646    int32_t i =  INT32_MAX;
16647   uint32_t u = UINT32_MAX;
16648   printf("int32_t\n");
16649 #endif
16650 }
16651 EOCP
16652
16653 i8type="signed char"
16654 u8type="unsigned char"
16655 i8size=1
16656 u8size=1
16657
16658 case "$i16type" in
16659 '')     case "$shortsize" in
16660         2)      i16type=short
16661                 u16type="unsigned short"
16662                 i16size=$shortsize
16663                 u16size=$shortsize
16664                 ;;
16665         esac
16666         ;;
16667 esac
16668 case "$i16type" in
16669 '')     set try -DINT16
16670         if eval $compile; then
16671                 case "`$run ./try`" in
16672                 int16_t)
16673                         i16type=int16_t
16674                         u16type=uint16_t
16675                         i16size=2
16676                         u16size=2
16677                         ;;
16678                 esac
16679         fi
16680         ;;
16681 esac
16682 case "$i16type" in
16683 '')     if $test $shortsize -ge 2; then
16684                 i16type=short
16685                 u16type="unsigned short"
16686                 i16size=$shortsize
16687                 u16size=$shortsize
16688         fi
16689         ;;
16690 esac
16691
16692 case "$i32type" in
16693 '')     case "$longsize" in
16694         4)      i32type=long
16695                 u32type="unsigned long"
16696                 i32size=$longsize
16697                 u32size=$longsize
16698                 ;;
16699         *)      case "$intsize" in
16700                 4)      i32type=int
16701                         u32type="unsigned int"
16702                         i32size=$intsize
16703                         u32size=$intsize
16704                         ;;
16705                 esac
16706                 ;;
16707         esac
16708         ;;
16709 esac
16710 case "$i32type" in
16711 '')     set try -DINT32
16712         if eval $compile; then
16713                 case "`$run ./try`" in
16714                 int32_t)
16715                         i32type=int32_t
16716                         u32type=uint32_t
16717                         i32size=4
16718                         u32size=4
16719                         ;;
16720                 esac
16721         fi
16722         ;;
16723 esac
16724 case "$i32type" in
16725 '')     if $test $intsize -ge 4; then
16726                 i32type=int
16727                 u32type="unsigned int"
16728                 i32size=$intsize
16729                 u32size=$intsize
16730         fi
16731         ;;
16732 esac
16733
16734 case "$i64type" in
16735 '')     case "$d_quad:$quadtype" in
16736         define:?*)
16737                 i64type="$quadtype"
16738                 u64type="$uquadtype"
16739                 i64size=8
16740                 u64size=8
16741                 ;;
16742         esac
16743         ;;
16744 esac
16745
16746 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16747 : volatile so that the compiler has to store it out to memory.
16748 if test X"$d_volatile" = X"$define"; then
16749         volatile=volatile
16750 fi
16751 $cat <<EOP >try.c
16752 #include <stdio.h>
16753 #$i_stdlib I_STDLIB
16754 #ifdef I_STDLIB
16755 #include <stdlib.h>
16756 #endif
16757 #include <sys/types.h>
16758 #include <signal.h>
16759 #ifdef SIGFPE
16760 $volatile int bletched = 0;
16761 $signal_t blech(int s) { bletched = 1; }
16762 #endif
16763 int main() {
16764     $uvtype u = 0;
16765     $nvtype d;
16766     int     n = 8 * $uvsize;
16767     int     i;
16768 #ifdef SIGFPE
16769     signal(SIGFPE, blech);
16770 #endif
16771
16772     for (i = 0; i < n; i++) {
16773       u = u << 1 | ($uvtype)1;
16774       d = ($nvtype)u;
16775       if (($uvtype)d != u)
16776         break;
16777       if (d <= 0)
16778         break;
16779       d = ($nvtype)(u - 1);
16780       if (($uvtype)d != (u - 1))
16781         break;
16782 #ifdef SIGFPE
16783       if (bletched)
16784         break;
16785 #endif
16786     }
16787     printf("%d\n", ((i == n) ? -n : i));
16788     exit(0);
16789 }
16790 EOP
16791 set try
16792
16793 d_nv_preserves_uv="$undef"
16794 if eval $compile; then
16795         nv_preserves_uv_bits="`$run ./try`"
16796 fi
16797 case "$nv_preserves_uv_bits" in
16798 \-[1-9]*)
16799         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16800         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16801         d_nv_preserves_uv="$define"
16802         ;;
16803 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16804         d_nv_preserves_uv="$undef" ;;
16805 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16806         nv_preserves_uv_bits="0" ;;
16807 esac
16808 $rm_try
16809
16810 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16811 : volatile so that the compiler has to store it out to memory.
16812 if test X"$d_volatile" = X"$define"; then
16813         volatile=volatile
16814 fi
16815 $cat <<EOP >try.c
16816 #include <stdio.h>
16817
16818 typedef $nvtype NV;
16819
16820 int
16821 main() {
16822   NV value = 2;
16823   int count = 1;
16824
16825   while(count < 256) {
16826     $volatile NV up = value + 1.0;
16827     $volatile NV negated = -value;
16828     $volatile NV down = negated - 1.0;
16829     $volatile NV got_up = up - value;
16830     int up_good = got_up == 1.0;
16831     int got_down = down - negated;
16832     int down_good = got_down == -1.0;
16833
16834     if (down_good != up_good) {
16835       fprintf(stderr,
16836               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16837               up_good, (double) got_up, down_good, (double) got_down,
16838               count, (double) value);
16839       return 1;
16840     }
16841     if (!up_good) {
16842       while (1) {
16843         if (count > 8) {
16844           count -= 8;
16845           fputs("256.0", stdout);
16846         } else {
16847           count--;
16848           fputs("2.0", stdout);
16849         }
16850         if (!count) {
16851           puts("");
16852           return 0;
16853         }
16854         fputs("*", stdout);
16855       }
16856     }
16857     value *= 2;
16858     ++count;
16859   }
16860   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16861           count, (double) value);
16862   return 1;
16863 }
16864 EOP
16865 set try
16866
16867 nv_overflows_integers_at='0'
16868 if eval $compile; then
16869     xxx="`$run ./try`"
16870     case "$?" in
16871         0)
16872             case "$xxx" in
16873                 2*)  cat >&4 <<EOM
16874 The largest integer your NVs can preserve is equal to $xxx
16875 EOM
16876                     nv_overflows_integers_at="$xxx"
16877                     ;;
16878                 *)  cat >&4 <<EOM
16879 Cannot determine the largest integer value your NVs can hold, unexpected output
16880 '$xxx'
16881 EOM
16882                     ;;
16883             esac
16884             ;;
16885         *)  cat >&4 <<EOM
16886 Cannot determine the largest integer value your NVs can hold
16887 EOM
16888             ;;
16889     esac
16890 fi
16891 $rm_try
16892
16893 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16894 : volatile so that the compiler has to store it out to memory.
16895 if test X"$d_volatile" = X"$define"; then
16896         volatile=volatile
16897 fi
16898 $cat <<EOP >try.c
16899 #include <stdio.h>
16900 #$i_stdlib I_STDLIB
16901 #ifdef I_STDLIB
16902 #include <stdlib.h>
16903 #endif
16904 #$i_string I_STRING
16905 #ifdef I_STRING
16906 #  include <string.h>
16907 #else
16908 #  include <strings.h>
16909 #endif
16910 #include <sys/types.h>
16911 #include <signal.h>
16912 #ifdef SIGFPE
16913 $volatile int bletched = 0;
16914 $signal_t blech(int s) { bletched = 1; }
16915 #endif
16916
16917 int checkit($nvtype d, char *where) {
16918     unsigned char *p = (char *)&d;
16919     unsigned char *end = p + sizeof(d);
16920     int fail = 0;
16921
16922     while (p < end)
16923         fail += *p++;
16924
16925     if (!fail)
16926         return 0;
16927
16928     p = (char *)&d;
16929     printf("No - %s: 0x", where);
16930     while (p < end)
16931         printf ("%02X", *p++);
16932     printf("\n");
16933     return 1;
16934 }
16935
16936 int main(int argc, char **argv) {
16937     $nvtype d = 0.0;
16938     int fail = 0;
16939     fail += checkit(d, "0.0");
16940
16941     /* The compiler shouldn't be assuming that bletched is 0  */
16942     d = bletched;
16943
16944     fail += checkit(d, "bleched");
16945
16946 #ifdef SIGFPE
16947     signal(SIGFPE, blech);
16948 #endif
16949
16950     /* Paranoia - the compiler should have no way of knowing that ANSI says
16951        that argv[argc] will always be NULL.  Actually, if it did assume this it
16952        would be buggy, as this is C and main() can be called from elsewhere in
16953        the program.  */
16954     d = argv[argc] ? 1 : 0;
16955
16956     if (d) {
16957         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16958     }
16959
16960     fail += checkit(d, "ternary");
16961
16962     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16963
16964     if (d != 0.0) {
16965         printf("No - memset doesn't give 0.0\n");
16966         /* This might just blow up:  */
16967         printf("(gives %g)\n", d);
16968         return 1;
16969     }
16970
16971 #ifdef SIGFPE
16972     if (bletched) {
16973         printf("No - something bleched\n");
16974         return 1;
16975     }
16976 #endif
16977     if (fail) {
16978       printf("No - %d fail(s)\n", fail);
16979       return 1;
16980     }
16981     printf("Yes\n");
16982     return 0;
16983 }
16984 EOP
16985 set try
16986
16987 d_nv_zero_is_allbits_zero="$undef"
16988 if eval $compile; then
16989     xxx="`$run ./try`"
16990     case "$?" in
16991         0)
16992             case "$xxx" in
16993                 Yes)  cat >&4 <<EOM
16994 0.0 is represented as all bits zero in memory
16995 EOM
16996                     d_nv_zero_is_allbits_zero="$define"
16997                     ;;
16998                 *)  cat >&4 <<EOM
16999 0.0 is not represented as all bits zero in memory
17000 EOM
17001                     d_nv_zero_is_allbits_zero="$undef"
17002                     ;;
17003             esac
17004             ;;
17005         *)  cat >&4 <<EOM
17006 0.0 is not represented as all bits zero in memory
17007 EOM
17008             d_nv_zero_is_allbits_zero="$undef"
17009             ;;
17010     esac
17011 fi
17012 $rm_try
17013
17014 : check for off64_t
17015 echo " "
17016 echo "Checking to see if you have off64_t..." >&4
17017 $cat >try.c <<EOCP
17018 #include <sys/types.h>
17019 #include <unistd.h>
17020 int main() { off64_t x = 7; }
17021 EOCP
17022 set try
17023 if eval $compile; then
17024         val="$define"
17025         echo "You have off64_t."
17026 else
17027         val="$undef"
17028         echo "You do not have off64_t."
17029         case "$lseeksize" in
17030         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
17031         esac
17032 fi
17033 $rm_try
17034 set d_off64_t
17035 eval $setvar
17036
17037 : how to create joinable pthreads
17038 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
17039         echo " "
17040         echo "Checking what constant to use for creating joinable pthreads..." >&4
17041         $cat >try.c <<'EOCP'
17042 #include <pthread.h>
17043 int main() {
17044     int detachstate = JOINABLE;
17045 }
17046 EOCP
17047         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
17048         if eval $compile; then
17049                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
17050                 val="$undef" # Yes, undef.
17051                 set d_old_pthread_create_joinable
17052                 eval $setvar
17053                 val=""
17054                 set old_pthread_create_joinable
17055                 eval $setvar
17056         else
17057                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
17058                 if eval $compile; then
17059                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
17060                         val="$define"
17061                         set d_old_pthread_create_joinable
17062                         eval $setvar
17063                         val=PTHREAD_CREATE_UNDETACHED
17064                         set old_pthread_create_joinable
17065                         eval $setvar
17066                 else
17067                         set try -DJOINABLE=__UNDETACHED
17068                         if eval $compile; then
17069                                 echo "You seem to use __UNDETACHED." >&4
17070                                 val="$define"
17071                                 set d_old_pthread_create_joinable
17072                                 eval $setvar
17073                                 val=__UNDETACHED
17074                                 set old_pthread_create_joinable
17075                                 eval $setvar
17076                         else
17077                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
17078                                 val="$define"
17079                                 set d_old_pthread_create_joinable
17080                                 eval $setvar
17081                                 val=0
17082                                 set old_pthread_create_joinable
17083                                 eval $setvar
17084                         fi
17085                 fi
17086         fi
17087         $rm_try
17088 else
17089     d_old_pthread_create_joinable="$undef"
17090     old_pthread_create_joinable=""
17091 fi
17092
17093 : see if pause exists
17094 set pause d_pause
17095 eval $inlibc
17096
17097 : see if poll exists
17098 set poll d_poll
17099 eval $inlibc
17100
17101 : see if prctl exists
17102 set prctl d_prctl
17103 eval $inlibc
17104
17105 : see if prctl supports PR_SET_NAME
17106 d_prctl_set_name=$undef
17107 case $d_prctl in
17108     $define)
17109         $cat >try.c <<EOM
17110 #ifdef __ANDROID__
17111 #include <unistd.h>
17112 #endif
17113 #include <sys/prctl.h>
17114
17115 int main (int argc, char *argv[])
17116 {
17117     return (prctl (PR_SET_NAME, "Test"));
17118     } /* main */
17119 EOM
17120         set try
17121         if eval $compile_ok && $run ./try; then
17122             echo "Your prctl (PR_SET_NAME, ...) works"
17123             d_prctl_set_name=$define
17124             fi
17125         $rm_try
17126         ;;
17127     esac
17128
17129 : see if readlink exists
17130 set readlink d_readlink
17131 eval $inlibc
17132
17133 : Check if exe is symlink to abs path of executing program
17134 echo " "
17135 procselfexe=''
17136 val="$undef"
17137 case "$d_readlink" in
17138     "$define")
17139         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
17140         : more tidy to avoid an extra level of symlink
17141         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17142         while test $# -gt 0; do
17143             type=$1; try=$2
17144             shift; shift
17145             if $issymlink $try; then
17146                 $ls -l $try > reflect
17147                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17148                     echo "You have $type-like $try."
17149                     procselfexe='"'$try'"'
17150                     val="$define"
17151                     : This will break out of the loop
17152                     set X; shift
17153                 fi
17154             fi
17155         done
17156         ;;
17157 esac
17158 $rm -f reflect
17159 set d_procselfexe
17160 eval $setvar
17161
17162 : backward compatibility for d_hvfork
17163 if test X$d_hvfork != X; then
17164         d_vfork="$d_hvfork"
17165         d_hvfork=''
17166 fi
17167 : see if there is a vfork
17168 val=''
17169 set vfork val
17170 eval $inlibc
17171
17172 d_pseudofork=$undef
17173
17174 : Ok, but do we want to use it. vfork is reportedly unreliable in
17175 : perl on Solaris 2.x, and probably elsewhere.
17176 case "$val" in
17177 $define)
17178         echo " "
17179         case "$usevfork" in
17180         false) dflt='n';;
17181         *) dflt='y';;
17182         esac
17183         cat <<'EOM'
17184
17185 Perl can only use a vfork() that doesn't suffer from strict
17186 restrictions on calling functions or modifying global data in
17187 the child.  For example, glibc-2.1 contains such a vfork()
17188 that is unsuitable.  If your system provides a proper fork()
17189 call, chances are that you do NOT want perl to use vfork().
17190
17191 EOM
17192         rp="Do you still want to use vfork()?"
17193         . ./myread
17194         case "$ans" in
17195         y|Y) ;;
17196         *)
17197                 echo "Ok, we won't use vfork()."
17198                 val="$undef"
17199                 ;;
17200         esac
17201         ;;
17202 esac
17203 set d_vfork
17204 eval $setvar
17205 case "$d_vfork" in
17206 $define) usevfork='true';;
17207 *) usevfork='false';;
17208 esac
17209
17210 : see whether the pthread_atfork exists
17211 $cat >try.c <<EOP
17212 #include <pthread.h>
17213 #include <stdio.h>
17214 int main() {
17215 #ifdef  PTHREAD_ATFORK
17216         pthread_atfork(NULL,NULL,NULL);
17217 #endif
17218 }
17219 EOP
17220
17221 : see if pthread_atfork exists
17222 set try -DPTHREAD_ATFORK
17223 if eval $compile; then
17224     val="$define"
17225 else
17226     val="$undef"
17227 fi
17228 case "$usethreads" in
17229 $define)
17230         case "$val" in
17231         $define) echo 'pthread_atfork found.' >&4        ;;
17232         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17233         esac
17234 esac
17235 set d_pthread_atfork
17236 eval $setvar
17237
17238 : see if pthread_attr_setscope exists
17239 set pthread_attr_setscope d_pthread_attr_setscope
17240 eval $inlibc
17241
17242 : see whether the various POSIXish _yields exist
17243 $cat >try.c <<EOP
17244 #include <pthread.h>
17245 #include <stdio.h>
17246 int main() {
17247 #ifdef SCHED_YIELD
17248         sched_yield();
17249 #else
17250 #ifdef PTHREAD_YIELD
17251         pthread_yield();
17252 #else
17253 #ifdef PTHREAD_YIELD_NULL
17254         pthread_yield(NULL);
17255 #endif
17256 #endif
17257 #endif
17258 }
17259 EOP
17260 : see if sched_yield exists
17261 set try -DSCHED_YIELD
17262 if eval $compile; then
17263     val="$define"
17264     sched_yield='sched_yield()'
17265 else
17266     val="$undef"
17267 fi
17268 case "$usethreads" in
17269 $define)
17270         case "$val" in
17271         $define) echo 'sched_yield() found.' >&4        ;;
17272         *)       echo 'sched_yield() NOT found.' >&4    ;;
17273         esac
17274 esac
17275 set d_sched_yield
17276 eval $setvar
17277
17278 : see if pthread_yield exists
17279 set try -DPTHREAD_YIELD
17280 if eval $compile; then
17281     val="$define"
17282     case "$sched_yield" in
17283     '') sched_yield='pthread_yield()' ;;
17284     esac
17285 else
17286     set try -DPTHREAD_YIELD_NULL
17287     if eval $compile; then
17288         val="$define"
17289         case "$sched_yield" in
17290         '') sched_yield='pthread_yield(NULL)' ;;
17291         esac
17292     else
17293         val="$undef"
17294     fi
17295 fi
17296 case "$usethreads" in
17297 $define)
17298         case "$val" in
17299         $define) echo 'pthread_yield() found.' >&4      ;;
17300         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17301         esac
17302         ;;
17303 esac
17304 set d_pthread_yield
17305 eval $setvar
17306 case "$sched_yield" in
17307 '') sched_yield=undef ;;
17308 esac
17309 $rm_try
17310
17311 : check for ptrdiff_t
17312 echo " "
17313 echo "Checking to see if you have ptrdiff_t..." >&4
17314 $cat >try.c <<EOCP
17315 #include <stddef.h>
17316 int main() { ptrdiff_t x = 7; }
17317 EOCP
17318 set try
17319 if eval $compile; then
17320         val="$define"
17321         echo "You have ptrdiff_t."
17322 else
17323         val="$undef"
17324         echo "You do not have ptrdiff_t."
17325 fi
17326 $rm_try
17327 set d_ptrdiff_t
17328 eval $setvar
17329
17330 : see if random_r exists
17331 set random_r d_random_r
17332 eval $inlibc
17333 case "$d_random_r" in
17334 "$define")
17335         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17336         case "$d_random_r_proto:$usethreads" in
17337         ":define")      d_random_r_proto=define
17338                 set d_random_r_proto random_r $hdrs
17339                 eval $hasproto ;;
17340         *)      ;;
17341         esac
17342         case "$d_random_r_proto" in
17343         define)
17344         case "$random_r_proto" in
17345         ''|0) try='int random_r(int*, struct random_data*);'
17346         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17347         esac
17348         case "$random_r_proto" in
17349         ''|0) try='int random_r(long*, struct random_data*);'
17350         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17351         esac
17352         case "$random_r_proto" in
17353         ''|0) try='int random_r(struct random_data*, int32_t*);'
17354         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17355         esac
17356         case "$random_r_proto" in
17357         ''|0)   d_random_r=undef
17358                 random_r_proto=0
17359                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17360         * )     case "$random_r_proto" in
17361                 REENTRANT_PROTO*) ;;
17362                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17363                 esac
17364                 echo "Prototype: $try" ;;
17365         esac
17366         ;;
17367         *)      case "$usethreads" in
17368                 define) echo "random_r has no prototype, not using it." >&4 ;;
17369                 esac
17370                 d_random_r=undef
17371                 random_r_proto=0
17372                 ;;
17373         esac
17374         ;;
17375 *)      random_r_proto=0
17376         ;;
17377 esac
17378
17379 : see if readdir and friends exist
17380 set readdir d_readdir
17381 eval $inlibc
17382 set seekdir d_seekdir
17383 eval $inlibc
17384 set telldir d_telldir
17385 eval $inlibc
17386 set rewinddir d_rewinddir
17387 eval $inlibc
17388
17389 : see if readdir64_r exists
17390 set readdir64_r d_readdir64_r
17391 eval $inlibc
17392 case "$d_readdir64_r" in
17393 "$define")
17394         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17395         case "$d_readdir64_r_proto:$usethreads" in
17396         ":define")      d_readdir64_r_proto=define
17397                 set d_readdir64_r_proto readdir64_r $hdrs
17398                 eval $hasproto ;;
17399         *)      ;;
17400         esac
17401         case "$d_readdir64_r_proto" in
17402         define)
17403         case "$readdir64_r_proto" in
17404         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17405         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17406         esac
17407         case "$readdir64_r_proto" in
17408         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17409         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17410         esac
17411         case "$readdir64_r_proto" in
17412         ''|0)   d_readdir64_r=undef
17413                 readdir64_r_proto=0
17414                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17415         * )     case "$readdir64_r_proto" in
17416                 REENTRANT_PROTO*) ;;
17417                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17418                 esac
17419                 echo "Prototype: $try" ;;
17420         esac
17421         ;;
17422         *)      case "$usethreads" in
17423                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17424                 esac
17425                 d_readdir64_r=undef
17426                 readdir64_r_proto=0
17427                 ;;
17428         esac
17429         ;;
17430 *)      readdir64_r_proto=0
17431         ;;
17432 esac
17433
17434 : see if readdir_r exists
17435 set readdir_r d_readdir_r
17436 eval $inlibc
17437 case "$d_readdir_r" in
17438 "$define")
17439         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17440         case "$d_readdir_r_proto:$usethreads" in
17441         ":define")      d_readdir_r_proto=define
17442                 set d_readdir_r_proto readdir_r $hdrs
17443                 eval $hasproto ;;
17444         *)      ;;
17445         esac
17446         case "$d_readdir_r_proto" in
17447         define)
17448         case "$readdir_r_proto" in
17449         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17450         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17451         esac
17452         case "$readdir_r_proto" in
17453         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17454         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17455         esac
17456         case "$readdir_r_proto" in
17457         ''|0)   d_readdir_r=undef
17458                 readdir_r_proto=0
17459                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17460         * )     case "$readdir_r_proto" in
17461                 REENTRANT_PROTO*) ;;
17462                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17463                 esac
17464                 echo "Prototype: $try" ;;
17465         esac
17466         ;;
17467         *)      case "$usethreads" in
17468                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17469                 esac
17470                 d_readdir_r=undef
17471                 readdir_r_proto=0
17472                 ;;
17473         esac
17474         ;;
17475 *)      readdir_r_proto=0
17476         ;;
17477 esac
17478
17479 : see if readv exists
17480 set readv d_readv
17481 eval $inlibc
17482
17483 : see if recvmsg exists
17484 set recvmsg d_recvmsg
17485 eval $inlibc
17486
17487 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17488 echo " "
17489 if set regcomp val -f d_regcomp; eval $csym; $val; then
17490         echo 'regcomp() found.' >&4
17491         d_regcomp="$define"
17492         d_regcmp="$undef"
17493         d_re_comp="$undef"
17494 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17495         echo 'regcmp() found.' >&4
17496         d_regcmp="$define"
17497         d_regcomp="$undef"
17498         d_re_comp="$undef"
17499 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17500         echo 're_comp() found, assuming re_exec() also exists.' >&4
17501         d_re_comp="$define"
17502         d_regcomp="$undef"
17503         d_regcmp="$undef"
17504 else
17505         $cat >&4 <<EOM
17506 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17507 EOM
17508         d_regcmp="$undef"
17509         d_re_comp="$undef"
17510         d_regcomp="$undef"
17511 fi
17512
17513 : see if remainder exists
17514 set remainder d_remainder
17515 eval $inlibc
17516
17517 : see if remquo exists
17518 set remquo d_remquo
17519 eval $inlibc
17520
17521 : see if rename exists
17522 set rename d_rename
17523 eval $inlibc
17524
17525 : see if rint exists
17526 set rint d_rint
17527 eval $inlibc
17528
17529 : see if rmdir exists
17530 set rmdir d_rmdir
17531 eval $inlibc
17532
17533 : see if round exists
17534 set round d_round
17535 eval $inlibc
17536
17537 : see if memory.h is available.
17538 val=''
17539 set memory.h val
17540 eval $inhdr
17541
17542 : See if it conflicts with string.h
17543 case "$val" in
17544 $define)
17545         case "$strings" in
17546         '') ;;
17547         *)
17548                 $cppstdin $cppflags $cppminus < $strings > mem.h
17549                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
17550                         echo " "
17551                         echo "We won't be including <memory.h>."
17552                         val="$undef"
17553                 fi
17554                 $rm -f mem.h
17555                 ;;
17556         esac
17557 esac
17558 set i_memory
17559 eval $setvar
17560
17561 : can bcopy handle overlapping blocks?
17562 echo " "
17563 val="$undef"
17564 case "$d_memmove" in
17565 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
17566 *)      case "$d_bcopy" in
17567         "$define")
17568                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
17569                 $cat >try.c <<EOCP
17570 #$i_memory I_MEMORY
17571 #$i_stdlib I_STDLIB
17572 #$i_string I_STRING
17573 #$i_unistd I_UNISTD
17574 EOCP
17575         $cat >>try.c <<'EOCP'
17576 #include <stdio.h>
17577 #ifdef I_MEMORY
17578 #  include <memory.h>
17579 #endif
17580 #ifdef I_STDLIB
17581 #  include <stdlib.h>
17582 #endif
17583 #ifdef I_STRING
17584 #  include <string.h>
17585 #else
17586 #  include <strings.h>
17587 #endif
17588 #ifdef I_UNISTD
17589 #  include <unistd.h>  /* Needed for NetBSD */
17590 #endif
17591 int main()
17592 {
17593 char buf[128], abc[128];
17594 char *b;
17595 int len;
17596 int off;
17597 int align;
17598
17599 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17600    try to store the string in read-only memory. */
17601 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
17602
17603 for (align = 7; align >= 0; align--) {
17604         for (len = 36; len; len--) {
17605                 b = buf+align;
17606                 bcopy(abc, b, len);
17607                 for (off = 1; off <= len; off++) {
17608                         bcopy(b, b+off, len);
17609                         bcopy(b+off, b, len);
17610                         if (bcmp(b, abc, len))
17611                                 exit(1);
17612                 }
17613         }
17614 }
17615 exit(0);
17616 }
17617 EOCP
17618                 set try
17619                 if eval $compile_ok; then
17620                         if $run ./try 2>/dev/null; then
17621                                 echo "Yes, it can."
17622                                 val="$define"
17623                         else
17624                                 echo "It can't, sorry."
17625                         fi
17626                 else
17627                         echo "(I can't compile the test program, so we'll assume not...)"
17628                 fi
17629                 ;;
17630         esac
17631         $rm_try
17632         ;;
17633 esac
17634 set d_safebcpy
17635 eval $setvar
17636
17637 : can memcpy handle overlapping blocks?
17638 echo " "
17639 val="$undef"
17640 case "$d_memmove" in
17641 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
17642 *)      case "$d_memcpy" in
17643         "$define")
17644                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
17645                 $cat >try.c <<EOCP
17646 #$i_memory I_MEMORY
17647 #$i_stdlib I_STDLIB
17648 #$i_string I_STRING
17649 #$i_unistd I_UNISTD
17650 EOCP
17651         $cat >>try.c <<'EOCP'
17652 #include <stdio.h>
17653 #ifdef I_MEMORY
17654 #  include <memory.h>
17655 #endif
17656 #ifdef I_STDLIB
17657 #  include <stdlib.h>
17658 #endif
17659 #ifdef I_STRING
17660 #  include <string.h>
17661 #else
17662 #  include <strings.h>
17663 #endif
17664 #ifdef I_UNISTD
17665 #  include <unistd.h>  /* Needed for NetBSD */
17666 #endif
17667 int main()
17668 {
17669 char buf[128], abc[128];
17670 char *b;
17671 int len;
17672 int off;
17673 int align;
17674
17675 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17676    try to store the string in read-only memory. */
17677 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
17678
17679 for (align = 7; align >= 0; align--) {
17680         for (len = 36; len; len--) {
17681                 b = buf+align;
17682                 memcpy(b, abc, len);
17683                 for (off = 1; off <= len; off++) {
17684                         memcpy(b+off, b, len);
17685                         memcpy(b, b+off, len);
17686                         if (memcmp(b, abc, len))
17687                                 exit(1);
17688                 }
17689         }
17690 }
17691 exit(0);
17692 }
17693 EOCP
17694                 set try
17695                 if eval $compile_ok; then
17696                         if $run ./try 2>/dev/null; then
17697                                 echo "Yes, it can."
17698                                 val="$define"
17699                         else
17700                                 echo "It can't, sorry."
17701                         fi
17702                 else
17703                         echo "(I can't compile the test program, so we'll assume not...)"
17704                 fi
17705                 ;;
17706         esac
17707         $rm_try
17708         ;;
17709 esac
17710 set d_safemcpy
17711 eval $setvar
17712
17713 : can memcmp be trusted to compare relative magnitude?
17714 val="$undef"
17715 case "$d_memcmp" in
17716 "$define")
17717         echo " "
17718         echo "Checking if your memcmp() can compare relative magnitude..." >&4
17719         $cat >try.c <<EOCP
17720 #$i_memory I_MEMORY
17721 #$i_stdlib I_STDLIB
17722 #$i_string I_STRING
17723 #$i_unistd I_UNISTD
17724 EOCP
17725         $cat >>try.c <<'EOCP'
17726 #include <stdio.h>
17727 #ifdef I_MEMORY
17728 #  include <memory.h>
17729 #endif
17730 #ifdef I_STDLIB
17731 #  include <stdlib.h>
17732 #endif
17733 #ifdef I_STRING
17734 #  include <string.h>
17735 #else
17736 #  include <strings.h>
17737 #endif
17738 #ifdef I_UNISTD
17739 #  include <unistd.h>  /* Needed for NetBSD */
17740 #endif
17741 int main()
17742 {
17743 char a = -1;
17744 char b = 0;
17745 if ((a < b) && memcmp(&a, &b, 1) < 0)
17746         exit(1);
17747 exit(0);
17748 }
17749 EOCP
17750         set try
17751         if eval $compile_ok; then
17752                 if $run ./try 2>/dev/null; then
17753                         echo "Yes, it can."
17754                         val="$define"
17755                 else
17756                         echo "No, it can't (it uses signed chars)."
17757                 fi
17758         else
17759                 echo "(I can't compile the test program, so we'll assume not...)"
17760         fi
17761         ;;
17762 esac
17763 $rm_try
17764 set d_sanemcmp
17765 eval $setvar
17766
17767 : see if prototype for sbrk is available
17768 echo " "
17769 set d_sbrkproto sbrk $i_unistd unistd.h
17770 eval $hasproto
17771
17772 : see if scalbn exists
17773 set scalbn d_scalbn
17774 eval $inlibc
17775
17776 : see if select exists
17777 set select d_select
17778 eval $inlibc
17779
17780 : see if semctl exists
17781 set semctl d_semctl
17782 eval $inlibc
17783
17784 : see if semget exists
17785 set semget d_semget
17786 eval $inlibc
17787
17788 : see if semop exists
17789 set semop d_semop
17790 eval $inlibc
17791
17792 : see how much of the 'sem*(2)' library is present.
17793 h_sem=true
17794 echo " "
17795 case "$d_semctl$d_semget$d_semop" in
17796 *"$undef"*) h_sem=false;;
17797 esac
17798 case "$osname" in
17799 freebsd)
17800     case "`ipcs 2>&1`" in
17801     "SVID messages"*"not configured"*)
17802         echo "Your $osname does not have the sem*(2) configured." >&4
17803         h_sem=false
17804         val="$undef"
17805         set semctl d_semctl
17806         eval $setvar
17807         set semget d_semget
17808         eval $setvar
17809         set semop d_semop
17810         eval $setvar
17811         ;;
17812     esac
17813     ;;
17814 esac
17815 : we could also check for sys/ipc.h ...
17816 if $h_sem && $test `./findhdr sys/sem.h`; then
17817         echo "You have the full sem*(2) library." >&4
17818         val="$define"
17819 else
17820         echo "You don't have the full sem*(2) library." >&4
17821         val="$undef"
17822 fi
17823 set d_sem
17824 eval $setvar
17825
17826 : see whether sys/sem.h defines union semun
17827 echo " "
17828 $cat > try.c <<'END'
17829 #include <sys/types.h>
17830 #include <sys/ipc.h>
17831 #include <sys/sem.h>
17832 int main () { union semun semun; semun.buf = 0; }
17833 END
17834 set try
17835 if eval $compile; then
17836     echo "You have union semun in <sys/sem.h>." >&4
17837     val="$define"
17838 else
17839     echo "You do not have union semun in <sys/sem.h>." >&4
17840     val="$undef"
17841 fi
17842 $rm_try
17843 set d_union_semun
17844 eval $setvar
17845
17846 : see how to do semctl IPC_STAT
17847 case "$d_sem" in
17848 $define)
17849     echo " "
17850     $cat > tryh.h <<END
17851 #ifndef S_IRUSR
17852 #   ifdef S_IREAD
17853 #       define S_IRUSR S_IREAD
17854 #       define S_IWUSR S_IWRITE
17855 #       define S_IXUSR S_IEXEC
17856 #   else
17857 #       define S_IRUSR 0400
17858 #       define S_IWUSR 0200
17859 #       define S_IXUSR 0100
17860 #   endif
17861 #   define S_IRGRP (S_IRUSR>>3)
17862 #   define S_IWGRP (S_IWUSR>>3)
17863 #   define S_IXGRP (S_IXUSR>>3)
17864 #   define S_IROTH (S_IRUSR>>6)
17865 #   define S_IWOTH (S_IWUSR>>6)
17866 #   define S_IXOTH (S_IXUSR>>6)
17867 #endif
17868 #ifndef S_IRWXU
17869 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17870 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17871 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17872 #endif
17873 END
17874     : see whether semctl IPC_STAT can use union semun
17875     case "$d_semctl_semun" in
17876     '')
17877       val="$undef"
17878       $cat > try.c <<END
17879 #include <sys/types.h>
17880 #include <sys/ipc.h>
17881 #include <sys/sem.h>
17882 #include <sys/stat.h>
17883 #include <stdio.h>
17884 #include <errno.h>
17885 #include "tryh.h"
17886 #ifndef errno
17887 extern int errno;
17888 #endif
17889 #$d_union_semun HAS_UNION_SEMUN
17890 int main() {
17891     union semun
17892 #ifndef HAS_UNION_SEMUN
17893     {
17894         int val;
17895         struct semid_ds *buf;
17896         unsigned short *array;
17897     }
17898 #endif
17899     arg;
17900     int sem, st;
17901
17902 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17903     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17904     if (sem > -1) {
17905         struct semid_ds argbuf;
17906         arg.buf = &argbuf;
17907 #       ifdef IPC_STAT
17908         st = semctl(sem, 0, IPC_STAT, arg);
17909         if (st == 0)
17910             printf("semun\n");
17911         else
17912 #       endif /* IPC_STAT */
17913             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17914 #       ifdef IPC_RMID
17915         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17916 #       endif /* IPC_RMID */
17917             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17918     } else
17919 #endif /* IPC_PRIVATE && ... */
17920         printf("semget failed: errno = %d\n", errno);
17921   return 0;
17922 }
17923 END
17924       set try
17925       if eval $compile; then
17926           xxx=`$run ./try`
17927           case "$xxx" in
17928           semun) val="$define" ;;
17929           esac
17930       fi
17931       $rm_try
17932       set d_semctl_semun
17933       eval $setvar
17934       ;;
17935     esac
17936     case "$d_semctl_semun" in
17937     $define)
17938         echo "You can use union semun for semctl IPC_STAT." >&4
17939         also='also'
17940         ;;
17941     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17942         also=''
17943         ;;
17944     esac
17945
17946     : see whether semctl IPC_STAT can use struct semid_ds pointer
17947     case "$d_semctl_semid_ds" in
17948     '')
17949       val="$undef"
17950       $cat > try.c <<'END'
17951 #include <sys/types.h>
17952 #include <sys/ipc.h>
17953 #include <sys/sem.h>
17954 #include <sys/stat.h>
17955 #include "tryh.h"
17956 #include <stdio.h>
17957 #include <errno.h>
17958 #ifndef errno
17959 extern int errno;
17960 #endif
17961 int main() {
17962     struct semid_ds arg;
17963     int sem, st;
17964
17965 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17966     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17967     if (sem > -1) {
17968 #       ifdef IPC_STAT
17969         st = semctl(sem, 0, IPC_STAT, &arg);
17970         if (st == 0)
17971             printf("semid_ds\n");
17972         else
17973 #       endif /* IPC_STAT */
17974             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17975 #       ifdef IPC_RMID
17976         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
17977 #       endif /* IPC_RMID */
17978             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17979     } else
17980 #endif /* IPC_PRIVATE && ... */
17981         printf("semget failed: errno = %d\n", errno);
17982
17983     return 0;
17984 }
17985 END
17986       set try
17987       if eval $compile; then
17988           xxx=`$run ./try`
17989           case "$xxx" in
17990           semid_ds) val="$define" ;;
17991           esac
17992       fi
17993       $rm_try
17994       set d_semctl_semid_ds
17995       eval $setvar
17996       ;;
17997     esac
17998     case "$d_semctl_semid_ds" in
17999     $define)
18000         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
18001         ;;
18002     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
18003         ;;
18004     esac
18005     ;;
18006 *)  val="$undef"
18007
18008     # We do not have the full sem*(2) library, so assume we can not
18009     # use either.
18010
18011     set d_semctl_semun
18012     eval $setvar
18013
18014     set d_semctl_semid_ds
18015     eval $setvar
18016     ;;
18017 esac
18018 $rm_try tryh.h
18019
18020 : see if sendmsg exists
18021 set sendmsg d_sendmsg
18022 eval $inlibc
18023
18024 : see if setegid exists
18025 set setegid d_setegid
18026 eval $inlibc
18027
18028 : see if seteuid exists
18029 set seteuid d_seteuid
18030 eval $inlibc
18031
18032 : see if setgrent exists
18033 set setgrent d_setgrent
18034 eval $inlibc
18035
18036 : see if setgrent_r exists
18037 set setgrent_r d_setgrent_r
18038 eval $inlibc
18039 case "$d_setgrent_r" in
18040 "$define")
18041         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
18042         case "$d_setgrent_r_proto:$usethreads" in
18043         ":define")      d_setgrent_r_proto=define
18044                 set d_setgrent_r_proto setgrent_r $hdrs
18045                 eval $hasproto ;;
18046         *)      ;;
18047         esac
18048         case "$d_setgrent_r_proto" in
18049         define)
18050         case "$setgrent_r_proto" in
18051         ''|0) try='int setgrent_r(FILE**);'
18052         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
18053         esac
18054         case "$setgrent_r_proto" in
18055         ''|0) try='void setgrent_r(FILE**);'
18056         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
18057         esac
18058         case "$setgrent_r_proto" in
18059         ''|0)   d_setgrent_r=undef
18060                 setgrent_r_proto=0
18061                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
18062         * )     case "$setgrent_r_proto" in
18063                 REENTRANT_PROTO*) ;;
18064                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
18065                 esac
18066                 echo "Prototype: $try" ;;
18067         esac
18068         ;;
18069         *)      case "$usethreads" in
18070                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
18071                 esac
18072                 d_setgrent_r=undef
18073                 setgrent_r_proto=0
18074                 ;;
18075         esac
18076         ;;
18077 *)      setgrent_r_proto=0
18078         ;;
18079 esac
18080
18081 : see if sethostent exists
18082 set sethostent d_sethent
18083 eval $inlibc
18084
18085 : see if sethostent_r exists
18086 set sethostent_r d_sethostent_r
18087 eval $inlibc
18088 case "$d_sethostent_r" in
18089 "$define")
18090         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18091         case "$d_sethostent_r_proto:$usethreads" in
18092         ":define")      d_sethostent_r_proto=define
18093                 set d_sethostent_r_proto sethostent_r $hdrs
18094                 eval $hasproto ;;
18095         *)      ;;
18096         esac
18097         case "$d_sethostent_r_proto" in
18098         define)
18099         case "$sethostent_r_proto" in
18100         ''|0) try='int sethostent_r(int, struct hostent_data*);'
18101         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
18102         esac
18103         case "$sethostent_r_proto" in
18104         ''|0) try='void sethostent_r(int, struct hostent_data*);'
18105         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
18106         esac
18107         case "$sethostent_r_proto" in
18108         ''|0)   d_sethostent_r=undef
18109                 sethostent_r_proto=0
18110                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
18111         * )     case "$sethostent_r_proto" in
18112                 REENTRANT_PROTO*) ;;
18113                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
18114                 esac
18115                 echo "Prototype: $try" ;;
18116         esac
18117         ;;
18118         *)      case "$usethreads" in
18119                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
18120                 esac
18121                 d_sethostent_r=undef
18122                 sethostent_r_proto=0
18123                 ;;
18124         esac
18125         ;;
18126 *)      sethostent_r_proto=0
18127         ;;
18128 esac
18129
18130 : see if setitimer exists
18131 set setitimer d_setitimer
18132 eval $inlibc
18133
18134 : see if setlinebuf exists
18135 set setlinebuf d_setlinebuf
18136 eval $inlibc
18137
18138 : see if setlocale exists
18139 set setlocale d_setlocale
18140 eval $inlibc
18141
18142 : see if locale.h is available
18143 set locale.h i_locale
18144 eval $inhdr
18145
18146 : see if setlocale_r exists
18147 set setlocale_r d_setlocale_r
18148 eval $inlibc
18149 case "$d_setlocale_r" in
18150 "$define")
18151         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18152         case "$d_setlocale_r_proto:$usethreads" in
18153         ":define")      d_setlocale_r_proto=define
18154                 set d_setlocale_r_proto setlocale_r $hdrs
18155                 eval $hasproto ;;
18156         *)      ;;
18157         esac
18158         case "$d_setlocale_r_proto" in
18159         define)
18160         case "$setlocale_r_proto" in
18161         ''|0) try='int setlocale_r(int, const char*, char*, int);'
18162         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18163         esac
18164         case "$setlocale_r_proto" in
18165         ''|0)   d_setlocale_r=undef
18166                 setlocale_r_proto=0
18167                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18168         * )     case "$setlocale_r_proto" in
18169                 REENTRANT_PROTO*) ;;
18170                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18171                 esac
18172                 echo "Prototype: $try" ;;
18173         esac
18174         ;;
18175         *)      case "$usethreads" in
18176                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18177                 esac
18178                 d_setlocale_r=undef
18179                 setlocale_r_proto=0
18180                 ;;
18181         esac
18182         ;;
18183 *)      setlocale_r_proto=0
18184         ;;
18185 esac
18186
18187 : see if setnetent exists
18188 set setnetent d_setnent
18189 eval $inlibc
18190
18191 : see if setnetent_r exists
18192 set setnetent_r d_setnetent_r
18193 eval $inlibc
18194 case "$d_setnetent_r" in
18195 "$define")
18196         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18197         case "$d_setnetent_r_proto:$usethreads" in
18198         ":define")      d_setnetent_r_proto=define
18199                 set d_setnetent_r_proto setnetent_r $hdrs
18200                 eval $hasproto ;;
18201         *)      ;;
18202         esac
18203         case "$d_setnetent_r_proto" in
18204         define)
18205         case "$setnetent_r_proto" in
18206         ''|0) try='int setnetent_r(int, struct netent_data*);'
18207         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18208         esac
18209         case "$setnetent_r_proto" in
18210         ''|0) try='void setnetent_r(int, struct netent_data*);'
18211         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18212         esac
18213         case "$setnetent_r_proto" in
18214         ''|0)   d_setnetent_r=undef
18215                 setnetent_r_proto=0
18216                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18217         * )     case "$setnetent_r_proto" in
18218                 REENTRANT_PROTO*) ;;
18219                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18220                 esac
18221                 echo "Prototype: $try" ;;
18222         esac
18223         ;;
18224         *)      case "$usethreads" in
18225                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18226                 esac
18227                 d_setnetent_r=undef
18228                 setnetent_r_proto=0
18229                 ;;
18230         esac
18231         ;;
18232 *)      setnetent_r_proto=0
18233         ;;
18234 esac
18235
18236 : see if setprotoent exists
18237 set setprotoent d_setpent
18238 eval $inlibc
18239
18240 : see if setpgid exists
18241 set setpgid d_setpgid
18242 eval $inlibc
18243
18244 : see if setpgrp2 exists
18245 set setpgrp2 d_setpgrp2
18246 eval $inlibc
18247
18248 : see if setpriority exists
18249 set setpriority d_setprior
18250 eval $inlibc
18251
18252 : see if setproctitle exists
18253 set setproctitle d_setproctitle
18254 eval $inlibc
18255
18256 : see if setprotoent_r exists
18257 set setprotoent_r d_setprotoent_r
18258 eval $inlibc
18259 case "$d_setprotoent_r" in
18260 "$define")
18261         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18262         case "$d_setprotoent_r_proto:$usethreads" in
18263         ":define")      d_setprotoent_r_proto=define
18264                 set d_setprotoent_r_proto setprotoent_r $hdrs
18265                 eval $hasproto ;;
18266         *)      ;;
18267         esac
18268         case "$d_setprotoent_r_proto" in
18269         define)
18270         case "$setprotoent_r_proto" in
18271         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18272         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18273         esac
18274         case "$setprotoent_r_proto" in
18275         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18276         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18277         esac
18278         case "$setprotoent_r_proto" in
18279         ''|0)   d_setprotoent_r=undef
18280                 setprotoent_r_proto=0
18281                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18282         * )     case "$setprotoent_r_proto" in
18283                 REENTRANT_PROTO*) ;;
18284                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18285                 esac
18286                 echo "Prototype: $try" ;;
18287         esac
18288         ;;
18289         *)      case "$usethreads" in
18290                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18291                 esac
18292                 d_setprotoent_r=undef
18293                 setprotoent_r_proto=0
18294                 ;;
18295         esac
18296         ;;
18297 *)      setprotoent_r_proto=0
18298         ;;
18299 esac
18300
18301 : see if setpwent exists
18302 set setpwent d_setpwent
18303 eval $inlibc
18304
18305 : see if setpwent_r exists
18306 set setpwent_r d_setpwent_r
18307 eval $inlibc
18308 case "$d_setpwent_r" in
18309 "$define")
18310         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18311         case "$d_setpwent_r_proto:$usethreads" in
18312         ":define")      d_setpwent_r_proto=define
18313                 set d_setpwent_r_proto setpwent_r $hdrs
18314                 eval $hasproto ;;
18315         *)      ;;
18316         esac
18317         case "$d_setpwent_r_proto" in
18318         define)
18319         case "$setpwent_r_proto" in
18320         ''|0) try='int setpwent_r(FILE**);'
18321         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18322         esac
18323         case "$setpwent_r_proto" in
18324         ''|0) try='void setpwent_r(FILE**);'
18325         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18326         esac
18327         case "$setpwent_r_proto" in
18328         ''|0)   d_setpwent_r=undef
18329                 setpwent_r_proto=0
18330                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18331         * )     case "$setpwent_r_proto" in
18332                 REENTRANT_PROTO*) ;;
18333                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18334                 esac
18335                 echo "Prototype: $try" ;;
18336         esac
18337         ;;
18338         *)      case "$usethreads" in
18339                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18340                 esac
18341                 d_setpwent_r=undef
18342                 setpwent_r_proto=0
18343                 ;;
18344         esac
18345         ;;
18346 *)      setpwent_r_proto=0
18347         ;;
18348 esac
18349
18350 : see if setregid exists
18351 set setregid d_setregid
18352 eval $inlibc
18353 set setresgid d_setresgid
18354 eval $inlibc
18355
18356 : see if setreuid exists
18357 set setreuid d_setreuid
18358 eval $inlibc
18359 set setresuid d_setresuid
18360 eval $inlibc
18361
18362 : see if setrgid exists
18363 set setrgid d_setrgid
18364 eval $inlibc
18365
18366 : see if setruid exists
18367 set setruid d_setruid
18368 eval $inlibc
18369
18370 : see if setservent exists
18371 set setservent d_setsent
18372 eval $inlibc
18373
18374 : see if setservent_r exists
18375 set setservent_r d_setservent_r
18376 eval $inlibc
18377 case "$d_setservent_r" in
18378 "$define")
18379         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18380         case "$d_setservent_r_proto:$usethreads" in
18381         ":define")      d_setservent_r_proto=define
18382                 set d_setservent_r_proto setservent_r $hdrs
18383                 eval $hasproto ;;
18384         *)      ;;
18385         esac
18386         case "$d_setservent_r_proto" in
18387         define)
18388         case "$setservent_r_proto" in
18389         ''|0) try='int setservent_r(int, struct servent_data*);'
18390         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18391         esac
18392         case "$setservent_r_proto" in
18393         ''|0) try='void setservent_r(int, struct servent_data*);'
18394         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18395         esac
18396         case "$setservent_r_proto" in
18397         ''|0)   d_setservent_r=undef
18398                 setservent_r_proto=0
18399                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18400         * )     case "$setservent_r_proto" in
18401                 REENTRANT_PROTO*) ;;
18402                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18403                 esac
18404                 echo "Prototype: $try" ;;
18405         esac
18406         ;;
18407         *)      case "$usethreads" in
18408                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18409                 esac
18410                 d_setservent_r=undef
18411                 setservent_r_proto=0
18412                 ;;
18413         esac
18414         ;;
18415 *)      setservent_r_proto=0
18416         ;;
18417 esac
18418
18419 : see if setsid exists
18420 set setsid d_setsid
18421 eval $inlibc
18422
18423 : see if setvbuf exists
18424 set setvbuf d_setvbuf
18425 eval $inlibc
18426
18427 : see if shmctl exists
18428 set shmctl d_shmctl
18429 eval $inlibc
18430
18431 : see if shmget exists
18432 set shmget d_shmget
18433 eval $inlibc
18434
18435 : see if shmat exists
18436 set shmat d_shmat
18437 eval $inlibc
18438 : see what shmat returns
18439 case "$d_shmat" in
18440 "$define")
18441         $cat >shmat.c <<'END'
18442 #include <sys/shm.h>
18443 void *shmat();
18444 END
18445         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18446                 shmattype='void *'
18447         else
18448                 shmattype='char *'
18449         fi
18450         echo "and it returns ($shmattype)." >&4
18451         : see if a prototype for shmat is available
18452         xxx=`./findhdr sys/shm.h`
18453         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18454         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18455                 val="$define"
18456         else
18457                 val="$undef"
18458         fi
18459         $rm -f shmat.[co]
18460         ;;
18461 *)
18462         val="$undef"
18463         ;;
18464 esac
18465 set d_shmatprototype
18466 eval $setvar
18467
18468 : see if shmdt exists
18469 set shmdt d_shmdt
18470 eval $inlibc
18471
18472 : see how much of the 'shm*(2)' library is present.
18473 h_shm=true
18474 echo " "
18475 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18476 *"$undef"*) h_shm=false;;
18477 esac
18478 case "$osname" in
18479 freebsd)
18480     case "`ipcs 2>&1`" in
18481     "SVID shared memory"*"not configured"*)
18482         echo "Your $osname does not have the shm*(2) configured." >&4
18483         h_shm=false
18484         val="$undef"
18485         set shmctl d_shmctl
18486         eval $setvar
18487         set shmget d_shmget
18488         eval $setvar
18489         set shmat d_shmat
18490         eval $setvar
18491         set shmdt d_shmdt
18492         eval $setvar
18493         ;;
18494     esac
18495     ;;
18496 esac
18497 : we could also check for sys/ipc.h ...
18498 if $h_shm && $test `./findhdr sys/shm.h`; then
18499         echo "You have the full shm*(2) library." >&4
18500         val="$define"
18501 else
18502         echo "You don't have the full shm*(2) library." >&4
18503         val="$undef"
18504 fi
18505 set d_shm
18506 eval $setvar
18507
18508 : see if we have sigaction
18509 echo " "
18510 if set sigaction val -f d_sigaction; eval $csym; $val; then
18511         echo 'sigaction() found.' >&4
18512         $cat > try.c <<EOP
18513 #include <stdio.h>
18514 #include <sys/types.h>
18515 #include <signal.h>
18516 #$i_stdlib I_STDLIB
18517 #ifdef I_STDLIB
18518 #include <stdlib.h>
18519 #endif
18520 int main()
18521 {
18522     struct sigaction act, oact;
18523     act.sa_flags = 0;
18524     oact.sa_handler = 0;
18525     /* so that act and oact are used */
18526     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18527 }
18528 EOP
18529         set try
18530         if eval $compile_ok; then
18531                 val="$define"
18532         else
18533                 echo "But you don't seem to have a usable struct sigaction." >&4
18534                 val="$undef"
18535         fi
18536 else
18537         echo 'sigaction NOT found.' >&4
18538         val="$undef"
18539 fi
18540 set d_sigaction; eval $setvar
18541 $rm_try
18542
18543 : see if this is a sunmath.h system
18544 set sunmath.h i_sunmath
18545 eval $inhdr
18546
18547 : see if signbit exists
18548 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18549 $cat >try.c <<EOCP
18550 #$i_math I_MATH
18551 #$i_sunmath I_SUNMATH
18552 #ifdef I_MATH
18553 #  include <math.h>
18554 #endif
18555 #ifdef I_SUNMATH  /* Solaris special math library */
18556 #  include <sunmath.h>
18557 #endif
18558 #define NV $nvtype
18559 int main(int argc, char **argv)
18560 {
18561     NV x = 0.0;
18562     NV y = -0.0;
18563     if ((signbit(x) == 0) && (signbit(y) != 0))
18564         return 0;
18565     else
18566         return 1;
18567 }
18568 EOCP
18569 val="$undef"
18570 set try
18571 if eval $compile; then
18572     if $run ./try; then
18573         $echo "Yes." >&4
18574         val="$define"
18575     else
18576         $echo "Signbit seems to be available, but doesn't work as I expected."
18577         $echo "I won't use it." >&4
18578         val="$undef"
18579     fi
18580 else
18581     $echo "Nope." >&4
18582     dflt="$undef"
18583 fi
18584 set d_signbit
18585 eval $setvar
18586 $rm_try
18587
18588 : see if sigprocmask exists
18589 set sigprocmask d_sigprocmask
18590 eval $inlibc
18591
18592 : see if sigsetjmp exists
18593 echo " "
18594 case "$d_sigsetjmp" in
18595 '')
18596         $cat >try.c <<EOP
18597 #include <setjmp.h>
18598 #$i_stdlib I_STDLIB
18599 #ifdef I_STDLIB
18600 #include <stdlib.h>
18601 #endif
18602 sigjmp_buf env;
18603 int set = 1;
18604 int main()
18605 {
18606         if (sigsetjmp(env,1))
18607                 exit(set);
18608         set = 0;
18609         siglongjmp(env, 1);
18610         exit(1);
18611 }
18612 EOP
18613         set try
18614         if eval $compile; then
18615                 if $run ./try >/dev/null 2>&1; then
18616                         echo "POSIX sigsetjmp found." >&4
18617                         val="$define"
18618                 else
18619                         $cat >&4 <<EOM
18620 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18621 I'll ignore them.
18622 EOM
18623                         val="$undef"
18624                 fi
18625         else
18626                 echo "sigsetjmp not found." >&4
18627                 val="$undef"
18628         fi
18629         ;;
18630 *) val="$d_sigsetjmp"
18631         case "$d_sigsetjmp" in
18632         $define) echo "POSIX sigsetjmp found." >&4;;
18633         $undef) echo "sigsetjmp not found." >&4;;
18634         esac
18635         ;;
18636 esac
18637 set d_sigsetjmp
18638 eval $setvar
18639 $rm_try
18640
18641 : see if snprintf exists
18642 set snprintf d_snprintf
18643 eval $inlibc
18644
18645 : see if vsnprintf exists
18646 set vsnprintf d_vsnprintf
18647 eval $inlibc
18648
18649 case "$d_snprintf-$d_vsnprintf" in
18650 "$define-$define")
18651     $cat <<EOM
18652 Checking whether your snprintf() and vsnprintf() work okay...
18653 EOM
18654     $cat >try.c <<'EOCP'
18655 /* v?snprintf testing logic courtesy of Russ Allbery.
18656  * According to C99:
18657  * - if the buffer is too short it still must be \0-terminated
18658  * - if the buffer is too short the potentially required length
18659  *   must be returned and not -1
18660  * - if the buffer is NULL the potentially required length
18661  *   must be returned and not -1 or core dump
18662  */
18663 #include <stdio.h>
18664 #include <stdarg.h>
18665
18666 char buf[2];
18667
18668 int test (char *format, ...)
18669 {
18670     va_list args;
18671     int count;
18672
18673     va_start (args, format);
18674     count = vsnprintf (buf, sizeof buf, format, args);
18675     va_end (args);
18676     return count;
18677 }
18678
18679 int main ()
18680 {
18681     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18682              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18683 }
18684 EOCP
18685     set try
18686     if eval $compile; then
18687         `$run ./try`
18688         case "$?" in
18689         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18690         *) cat <<EOM >&4
18691 Your snprintf() and snprintf() don't seem to be working okay.
18692 EOM
18693            d_snprintf="$undef"
18694            d_vsnprintf="$undef"
18695            ;;
18696         esac
18697     else
18698         echo "(I can't seem to compile the test program--assuming they don't)"
18699         d_snprintf="$undef"
18700         d_vsnprintf="$undef"
18701     fi
18702     $rm_try
18703     ;;
18704 esac
18705
18706 : see if sockatmark exists
18707 set sockatmark d_sockatmark
18708 eval $inlibc
18709
18710 : see if prototype for sockatmark is available
18711 echo " "
18712 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18713 eval $hasproto
18714
18715 : see if socks5_init exists
18716 set socks5_init d_socks5_init
18717 eval $inlibc
18718
18719 : see if sprintf returns the length of the string in the buffer as per ANSI
18720 $echo "Checking whether sprintf returns the length of the string..." >&4
18721 $cat <<EOP >try.c
18722 #include <stdio.h>
18723 #$i_stdlib I_STDLIB
18724 #ifdef I_STDLIB
18725 #include <stdlib.h>
18726 #endif
18727 #$i_string I_STRING
18728 #ifdef I_STRING
18729 #  include <string.h>
18730 #else
18731 #  include <strings.h>
18732 #endif
18733 #$i_math I_MATH
18734 #ifdef I_MATH
18735 #include <math.h>
18736 #endif
18737
18738 char buffer[256];
18739
18740 int check (size_t expect, int test) {
18741   size_t got = strlen(buffer);
18742   if (expect == got)
18743     return 0;
18744
18745   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
18746        test, buffer);
18747   exit (test);
18748 }
18749
18750 int main(int argc, char **argv) {
18751   int test = 0;
18752
18753   check(sprintf(buffer, ""), ++test);
18754   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
18755   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
18756
18757   return 0;
18758 }
18759 EOP
18760 set try
18761
18762 if eval $compile; then
18763     xxx="`$run ./try`"
18764     case "$?" in
18765         0) cat >&4 <<EOM
18766 sprintf returns the length of the string (as ANSI says it should)
18767 EOM
18768         d_sprintf_returns_strlen="$define"
18769         ;;
18770         *) cat >&4 <<EOM
18771 sprintf does not return the length of the string (how old is this system?)
18772 EOM
18773         d_sprintf_returns_strlen="$undef"
18774         ;;
18775     esac
18776 else
18777     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
18778     d_sprintf_returns_strlen="$undef"
18779 fi
18780 $rm_try
18781
18782 : see if srand48_r exists
18783 set srand48_r d_srand48_r
18784 eval $inlibc
18785 case "$d_srand48_r" in
18786 "$define")
18787         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18788         case "$d_srand48_r_proto:$usethreads" in
18789         ":define")      d_srand48_r_proto=define
18790                 set d_srand48_r_proto srand48_r $hdrs
18791                 eval $hasproto ;;
18792         *)      ;;
18793         esac
18794         case "$d_srand48_r_proto" in
18795         define)
18796         case "$srand48_r_proto" in
18797         ''|0) try='int srand48_r(long, struct drand48_data*);'
18798         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18799         esac
18800         case "$srand48_r_proto" in
18801         ''|0)   d_srand48_r=undef
18802                 srand48_r_proto=0
18803                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18804         * )     case "$srand48_r_proto" in
18805                 REENTRANT_PROTO*) ;;
18806                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18807                 esac
18808                 echo "Prototype: $try" ;;
18809         esac
18810         ;;
18811         *)      case "$usethreads" in
18812                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18813                 esac
18814                 d_srand48_r=undef
18815                 srand48_r_proto=0
18816                 ;;
18817         esac
18818         ;;
18819 *)      srand48_r_proto=0
18820         ;;
18821 esac
18822
18823 : see if srandom_r exists
18824 set srandom_r d_srandom_r
18825 eval $inlibc
18826 case "$d_srandom_r" in
18827 "$define")
18828         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18829         case "$d_srandom_r_proto:$usethreads" in
18830         ":define")      d_srandom_r_proto=define
18831                 set d_srandom_r_proto srandom_r $hdrs
18832                 eval $hasproto ;;
18833         *)      ;;
18834         esac
18835         case "$d_srandom_r_proto" in
18836         define)
18837         case "$srandom_r_proto" in
18838         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18839         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18840         esac
18841         case "$srandom_r_proto" in
18842         ''|0)   d_srandom_r=undef
18843                 srandom_r_proto=0
18844                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18845         * )     case "$srandom_r_proto" in
18846                 REENTRANT_PROTO*) ;;
18847                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18848                 esac
18849                 echo "Prototype: $try" ;;
18850         esac
18851         ;;
18852         *)      case "$usethreads" in
18853                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18854                 esac
18855                 d_srandom_r=undef
18856                 srandom_r_proto=0
18857                 ;;
18858         esac
18859         ;;
18860 *)      srandom_r_proto=0
18861         ;;
18862 esac
18863
18864 : see if prototype for setresgid is available
18865 echo " "
18866 set d_sresgproto setresgid $i_unistd unistd.h
18867 eval $hasproto
18868
18869 : see if prototype for setresuid is available
18870 echo " "
18871 set d_sresuproto setresuid $i_unistd unistd.h
18872 eval $hasproto
18873
18874 : see if stat exists
18875 set stat d_stat
18876 eval $inlibc
18877
18878 : see if sys/stat.h is available
18879 set sys/stat.h i_sysstat
18880 eval $inhdr
18881
18882 : see if stat knows about block sizes
18883 echo " "
18884 echo "Checking to see if your struct stat has st_blocks field..." >&4
18885 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18886 eval $hasfield
18887
18888 : see if this is a sys/vfs.h system
18889 set sys/vfs.h i_sysvfs
18890 eval $inhdr
18891
18892 : see if this is a sys/statfs.h system
18893 set sys/statfs.h i_sysstatfs
18894 eval $inhdr
18895
18896 : Check for statfs_s
18897 echo " "
18898 echo "Checking to see if your system supports struct statfs..." >&4
18899 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
18900 eval $hasstruct
18901 case "$d_statfs_s" in
18902 "$define")      echo "Yes, it does."   ;;
18903 *)              echo "No, it doesn't." ;;
18904 esac
18905
18906
18907 : see if struct statfs knows about f_flags
18908 case "$d_statfs_s" in
18909 define)
18910         echo " "
18911         echo "Checking to see if your struct statfs has f_flags field..." >&4
18912         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
18913         eval $hasfield
18914         ;;
18915 *)      val="$undef"
18916         set d_statfs_f_flags
18917         eval $setvar
18918         ;;
18919 esac
18920 case "$d_statfs_f_flags" in
18921 "$define")      echo "Yes, it does."   ;;
18922 *)              echo "No, it doesn't." ;;
18923 esac
18924
18925 : see what flavor, if any, of static inline is supported
18926 echo " "
18927 echo "Checking to see if your system supports static inline..."
18928 $cat > try.c <<'EOCP'
18929 #include <stdlib.h>
18930 extern int f_via_a(int x);
18931 extern int f_via_b(int x);
18932 int main(int argc, char **argv)
18933 {
18934     int y;
18935
18936     y = f_via_a(0);
18937 #ifdef USE_B
18938     y = f_via_b(0);
18939 #endif
18940     if (y == 42) {
18941         return EXIT_SUCCESS;
18942     }
18943     else {
18944         return EXIT_FAILURE;
18945     }
18946 }
18947 EOCP
18948 $cat > a.c <<'EOCP'
18949 static INLINE int f(int x) {
18950     int y;
18951     y = x + 42;
18952     return y;
18953 }
18954
18955 int f_via_a(int x)
18956 {
18957     return f(x);
18958 }
18959 EOCP
18960 $cat > b.c <<'EOCP'
18961 extern int f(int x);
18962
18963 int f_via_b(int x)
18964 {
18965     return f(x);
18966 }
18967 EOCP
18968
18969 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18970 case "$perl_static_inline" in
18971 '')     # Check the various possibilities, and break out on success.
18972         # For gcc, prefer __inline__, which will still permit
18973         # cflags.SH to add in -ansi.
18974         case "$gccversion" in
18975                 '') xxx="inline __inline__ __inline _inline";;
18976                 *)  xxx="__inline__ inline __inline _inline";;
18977         esac
18978         for inline in $xxx; do
18979                 set try -DINLINE=$inline a.c
18980                 if eval $compile && $run ./try; then
18981                         # Now make sure there is no external linkage of static
18982                         # functions
18983                         set try -DINLINE=$inline -DUSE_B a.c b.c
18984                         if eval $compile && $run ./try; then
18985                                 $echo "Your compiler supports static $inline, " >&4
18986                                 $echo "but it also creates an external definition," >&4
18987                                 $echo "so I won't use it." >&4
18988                                 val=$undef
18989                         else
18990                                 $echo "Your compiler supports static $inline." >&4
18991                                 val=$define
18992                                 perl_static_inline="static $inline";
18993                                 break;
18994                         fi
18995                 else
18996                         $echo "Your compiler does NOT support static $inline." >&4
18997                         val="$undef"
18998                 fi
18999         done
19000         ;;
19001 *inline*) # Some variant of inline exists.
19002         echo "Keeping your $hint value of $perl_static_inline."
19003         val=$define
19004         ;;
19005 static)  # No inline capabilities
19006         echo "Keeping your $hint value of $perl_static_inline."
19007         val=$undef
19008         ;;
19009 *)  # Unrecognized previous value -- blindly trust the supplied
19010         # value and hope it makes sense.  Use old value for
19011         # d_static_inline, if there is one.
19012         echo "Keeping your $hint value of $perl_static_inline."
19013         case "$d_static_inline" in
19014                 '') val=$define ;;
19015                 *)  val=$d_static_inline ;;
19016         esac
19017         ;;
19018 esac
19019 # Fallback to plain 'static' if nothing worked.
19020 case "$perl_static_inline" in
19021 '')
19022         perl_static_inline="static"
19023         val=$undef
19024         ;;
19025 esac
19026 set d_static_inline
19027 eval $setvar
19028 $rm -f a.[co] b.[co]
19029 $rm_try
19030
19031 : Check stream access
19032 $cat >&4 <<EOM
19033 Checking how to access stdio streams by file descriptor number...
19034 EOM
19035 case "$stdio_stream_array" in
19036 '')     $cat >try.c <<EOCP
19037 #include <stdio.h>
19038 int main() {
19039   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
19040     printf("yes\n");
19041 }
19042 EOCP
19043         for s in _iob __iob __sF
19044         do
19045                 set try -DSTDIO_STREAM_ARRAY=$s
19046                 if eval $compile; then
19047                         case "`$run ./try`" in
19048                         yes)    stdio_stream_array=$s; break ;;
19049                         esac
19050                 fi
19051         done
19052         $rm_try
19053 esac
19054 case "$stdio_stream_array" in
19055 '')     $cat >&4 <<EOM
19056 I can't figure out how to access stdio streams by file descriptor number.
19057 EOM
19058         d_stdio_stream_array="$undef"
19059         ;;
19060 *)      $cat >&4 <<EOM
19061 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
19062 EOM
19063         d_stdio_stream_array="$define"
19064         ;;
19065 esac
19066
19067 : see if strcoll exists
19068 set strcoll d_strcoll
19069 eval $inlibc
19070
19071 : check for structure copying
19072 echo " "
19073 echo "Checking to see if your C compiler can copy structs..." >&4
19074 $cat >try.c <<'EOCP'
19075 int main()
19076 {
19077         struct blurfl {
19078                 int dyick;
19079         } foo, bar;
19080
19081         foo = bar;
19082 }
19083 EOCP
19084 if $cc -c try.c >/dev/null 2>&1 ; then
19085         val="$define"
19086         echo "Yup, it can."
19087 else
19088         val="$undef"
19089         echo "Nope, it can't."
19090 fi
19091 set d_strctcpy
19092 eval $setvar
19093 $rm_try
19094
19095 : see if strerror and/or sys_errlist[] exist
19096 echo " "
19097 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
19098     if set strerror val -f d_strerror; eval $csym; $val; then
19099                 echo 'strerror() found.' >&4
19100                 d_strerror="$define"
19101                 d_strerrm='strerror(e)'
19102                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19103                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
19104                         d_syserrlst="$define"
19105                 else
19106                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
19107                         d_syserrlst="$undef"
19108                 fi
19109     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
19110                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
19111                 echo 'strerror() found in string header.' >&4
19112                 d_strerror="$define"
19113                 d_strerrm='strerror(e)'
19114                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19115                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
19116                                 d_syserrlst="$define"
19117                 else
19118                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
19119                         d_syserrlst="$undef"
19120                 fi
19121     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19122                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
19123                 d_strerror="$undef"
19124                 d_syserrlst="$define"
19125                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
19126     else
19127                 echo 'strerror() and sys_errlist[] NOT found.' >&4
19128                 d_strerror="$undef"
19129                 d_syserrlst="$undef"
19130                 d_strerrm='"unknown"'
19131     fi
19132 fi
19133
19134 : see if strerror_r exists
19135 set strerror_r d_strerror_r
19136 eval $inlibc
19137 case "$d_strerror_r" in
19138 "$define")
19139         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
19140         case "$d_strerror_r_proto:$usethreads" in
19141         ":define")      d_strerror_r_proto=define
19142                 set d_strerror_r_proto strerror_r $hdrs
19143                 eval $hasproto ;;
19144         *)      ;;
19145         esac
19146         case "$d_strerror_r_proto" in
19147         define)
19148         case "$strerror_r_proto" in
19149         ''|0) try='int strerror_r(int, char*, size_t);'
19150         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
19151         esac
19152         case "$strerror_r_proto" in
19153         ''|0) try='int strerror_r(int, char*, int);'
19154         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
19155         esac
19156         case "$strerror_r_proto" in
19157         ''|0) try='char* strerror_r(int, char*, size_t);'
19158         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
19159         esac
19160         case "$strerror_r_proto" in
19161         ''|0)   d_strerror_r=undef
19162                 strerror_r_proto=0
19163                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19164         * )     case "$strerror_r_proto" in
19165                 REENTRANT_PROTO*) ;;
19166                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19167                 esac
19168                 echo "Prototype: $try" ;;
19169         esac
19170         ;;
19171         *)      case "$usethreads" in
19172                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
19173                 esac
19174                 d_strerror_r=undef
19175                 strerror_r_proto=0
19176                 ;;
19177         esac
19178         ;;
19179 *)      strerror_r_proto=0
19180         ;;
19181 esac
19182
19183 : see if strftime exists
19184 set strftime d_strftime
19185 eval $inlibc
19186
19187 : see if strlcat exists
19188 set strlcat d_strlcat
19189 eval $inlibc
19190
19191 : see if strlcpy exists
19192 set strlcpy d_strlcpy
19193 eval $inlibc
19194
19195 : see if strtod exists
19196 set strtod d_strtod
19197 eval $inlibc
19198
19199 : see if strtol exists
19200 set strtol d_strtol
19201 eval $inlibc
19202
19203 : see if strtold exists
19204 set strtold d_strtold
19205 eval $inlibc
19206
19207 : see if strtoll exists
19208 set strtoll d_strtoll
19209 eval $inlibc
19210
19211 case "$d_longlong-$d_strtoll" in
19212 "$define-$define")
19213         $cat <<EOM
19214 Checking whether your strtoll() works okay...
19215 EOM
19216         $cat >try.c <<'EOCP'
19217 #include <errno.h>
19218 #ifdef __hpux
19219 #define strtoll __strtoll
19220 #endif
19221 #ifdef __EMX__
19222 #define strtoll _strtoll
19223 #endif
19224 #include <stdio.h>
19225 extern long long int strtoll(char *s, char **, int);
19226 static int bad = 0;
19227 int check(char *s, long long ell, int een) {
19228         long long gll;
19229         errno = 0;
19230         gll = strtoll(s, 0, 10);
19231         if (!((gll == ell) && (errno == een)))
19232                 bad++;
19233 }
19234 int main() {
19235         check(" 1",                                      1LL, 0);
19236         check(" 0",                                      0LL, 0);
19237         check("-1",                                     -1LL, 0);
19238         check("-9223372036854775808", -9223372036854775808LL, 0);
19239         check("-9223372036854775808", -9223372036854775808LL, 0);
19240         check(" 9223372036854775807",  9223372036854775807LL, 0);
19241         check("-9223372036854775808", -9223372036854775808LL, 0);
19242         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19243         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19244         if (!bad)
19245                 printf("ok\n");
19246 }
19247 EOCP
19248         set try
19249         if eval $compile; then
19250                 yyy=`$run ./try`
19251                 case "$yyy" in
19252                 ok) echo "Your strtoll() seems to be working okay." ;;
19253                 *) cat <<EOM >&4
19254 Your strtoll() doesn't seem to be working okay.
19255 EOM
19256                    d_strtoll="$undef"
19257                    ;;
19258                 esac
19259         else
19260                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19261                 d_strtoll="$undef"
19262         fi
19263         ;;
19264 esac
19265
19266 : see if strtoq exists
19267 set strtoq d_strtoq
19268 eval $inlibc
19269
19270 : see if strtoul exists
19271 set strtoul d_strtoul
19272 eval $inlibc
19273
19274 case "$d_strtoul" in
19275 "$define")
19276         $cat <<EOM
19277 Checking whether your strtoul() works okay...
19278 EOM
19279         $cat >try.c <<'EOCP'
19280 #include <errno.h>
19281 #include <stdio.h>
19282 extern unsigned long int strtoul(char *s, char **, int);
19283 static int bad = 0;
19284 void check(char *s, unsigned long eul, int een) {
19285         unsigned long gul;
19286         errno = 0;
19287         gul = strtoul(s, 0, 10);
19288         if (!((gul == eul) && (errno == een)))
19289                 bad++;
19290 }
19291 int main() {
19292         check(" 1", 1L, 0);
19293         check(" 0", 0L, 0);
19294 EOCP
19295         case "$longsize" in
19296         8)
19297             $cat >>try.c <<'EOCP'
19298         check("18446744073709551615", 18446744073709551615UL, 0);
19299         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19300 #if 0 /* strtoul() for /^-/ strings is undefined. */
19301         check("-1", 18446744073709551615UL, 0);
19302         check("-18446744073709551614", 2, 0);
19303         check("-18446744073709551615", 1, 0);
19304         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19305         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19306 #endif
19307 EOCP
19308                 ;;
19309         4)
19310                     $cat >>try.c <<'EOCP'
19311         check("4294967295", 4294967295UL, 0);
19312         check("4294967296", 4294967295UL, ERANGE);
19313 #if 0 /* strtoul() for /^-/ strings is undefined. */
19314         check("-1", 4294967295UL, 0);
19315         check("-4294967294", 2, 0);
19316         check("-4294967295", 1, 0);
19317         check("-4294967296", 4294967295UL, ERANGE);
19318         check("-4294967297", 4294967295UL, ERANGE);
19319 #endif
19320 EOCP
19321                 ;;
19322         *)
19323 : Should we write these tests to be more portable by sprintf-ing
19324 : ~0 and then manipulating that char string as input for strtol?
19325                 ;;
19326         esac
19327         $cat >>try.c <<'EOCP'
19328         if (!bad)
19329                 printf("ok\n");
19330         return 0;
19331 }
19332 EOCP
19333         set try
19334         if eval $compile; then
19335                 case "`$run ./try`" in
19336                 ok) echo "Your strtoul() seems to be working okay." ;;
19337                 *) cat <<EOM >&4
19338 Your strtoul() doesn't seem to be working okay.
19339 EOM
19340                    d_strtoul="$undef"
19341                    ;;
19342                 esac
19343         else
19344                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19345                 d_strtoul="$undef"
19346         fi
19347         ;;
19348 esac
19349
19350 : see if strtoull exists
19351 set strtoull d_strtoull
19352 eval $inlibc
19353
19354 case "$d_longlong-$d_strtoull" in
19355 "$define-$define")
19356         $cat <<EOM
19357 Checking whether your strtoull() works okay...
19358 EOM
19359         $cat >try.c <<'EOCP'
19360 #include <errno.h>
19361 #ifdef __hpux
19362 #define strtoull __strtoull
19363 #endif
19364 #include <stdio.h>
19365 extern unsigned long long int strtoull(char *s, char **, int);
19366 static int bad = 0;
19367 int check(char *s, long long eull, int een) {
19368         long long gull;
19369         errno = 0;
19370         gull = strtoull(s, 0, 10);
19371         if (!((gull == eull) && (errno == een)))
19372                 bad++;
19373 }
19374 int main() {
19375         check(" 1",                                        1LL, 0);
19376         check(" 0",                                        0LL, 0);
19377         check("18446744073709551615",  18446744073709551615ULL, 0);
19378         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19379 #if 0 /* strtoull() for /^-/ strings is undefined. */
19380         check("-1",                    18446744073709551615ULL, 0);
19381         check("-18446744073709551614",                     2LL, 0);
19382         check("-18446744073709551615",                     1LL, 0);
19383         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19384         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19385 #endif
19386         if (!bad)
19387                 printf("ok\n");
19388 }
19389 EOCP
19390         set try
19391         if eval $compile; then
19392                 case "`$run ./try`" in
19393                 ok) echo "Your strtoull() seems to be working okay." ;;
19394                 *) cat <<EOM >&4
19395 Your strtoull() doesn't seem to be working okay.
19396 EOM
19397                    d_strtoull="$undef"
19398                    ;;
19399                 esac
19400         else
19401                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19402                 d_strtoull="$undef"
19403         fi
19404         ;;
19405 esac
19406
19407 : see if strtouq exists
19408 set strtouq d_strtouq
19409 eval $inlibc
19410
19411 case "$d_strtouq" in
19412 "$define")
19413         $cat <<EOM
19414 Checking whether your strtouq() works okay...
19415 EOM
19416         $cat >try.c <<'EOCP'
19417 #include <errno.h>
19418 #include <stdio.h>
19419 extern unsigned long long int strtouq(char *s, char **, int);
19420 static int bad = 0;
19421 void check(char *s, unsigned long long eull, int een) {
19422         unsigned long long gull;
19423         errno = 0;
19424         gull = strtouq(s, 0, 10);
19425         if (!((gull == eull) && (errno == een)))
19426                 bad++;
19427 }
19428 int main() {
19429         check(" 1",                                        1LL, 0);
19430         check(" 0",                                        0LL, 0);
19431         check("18446744073709551615",  18446744073709551615ULL, 0);
19432         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19433 #if 0 /* strtouq() for /^-/ strings is undefined. */
19434         check("-1",                    18446744073709551615ULL, 0);
19435         check("-18446744073709551614",                     2LL, 0);
19436         check("-18446744073709551615",                     1LL, 0);
19437         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19438         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19439 #endif
19440         if (!bad)
19441                 printf("ok\n");
19442         return 0;
19443 }
19444 EOCP
19445         set try
19446         if eval $compile; then
19447                 case "`$run ./try`" in
19448                 ok) echo "Your strtouq() seems to be working okay." ;;
19449                 *) cat <<EOM >&4
19450 Your strtouq() doesn't seem to be working okay.
19451 EOM
19452                    d_strtouq="$undef"
19453                    ;;
19454                 esac
19455         else
19456                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19457                 d_strtouq="$undef"
19458         fi
19459         ;;
19460 esac
19461
19462 : see if strxfrm exists
19463 set strxfrm d_strxfrm
19464 eval $inlibc
19465
19466 : see if symlink exists
19467 set symlink d_symlink
19468 eval $inlibc
19469
19470 : see if syscall exists
19471 set syscall d_syscall
19472 eval $inlibc
19473
19474 : see if prototype for syscall is available
19475 echo " "
19476 set d_syscallproto syscall $i_unistd unistd.h
19477 eval $hasproto
19478
19479 : see if sysconf exists
19480 set sysconf d_sysconf
19481 eval $inlibc
19482
19483 : see if system exists
19484 set system d_system
19485 eval $inlibc
19486
19487 : see if tcgetpgrp exists
19488 set tcgetpgrp d_tcgetpgrp
19489 eval $inlibc
19490
19491 : see if tcsetpgrp exists
19492 set tcsetpgrp d_tcsetpgrp
19493 eval $inlibc
19494
19495 : see if prototype for telldir is available
19496 echo " "
19497 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19498 eval $hasproto
19499
19500 : see if tgamma exists
19501 set tgamma d_tgamma
19502 eval $inlibc
19503
19504 : see if time exists
19505 echo " "
19506 if test "X$d_time" = X -o X"$timetype" = X; then
19507     if set time val -f d_time; eval $csym; $val; then
19508                 echo 'time() found.' >&4
19509                 val="$define"
19510                 rp="What is the type returned by time() on this system?"
19511                 set time_t timetype long stdio.h sys/types.h
19512                 eval $typedef_ask
19513     else
19514                 echo 'time() not found, hope that will do.' >&4
19515                 val="$undef"
19516                 timetype='int';
19517     fi
19518     set d_time
19519     eval $setvar
19520 fi
19521
19522 : see if timegm exists
19523 set timegm d_timegm
19524 eval $inlibc
19525
19526 : see if this is a sys/times.h system
19527 set sys/times.h i_systimes
19528 eval $inhdr
19529
19530 : see if times exists
19531 echo " "
19532 if set times val -f d_times; eval $csym; $val; then
19533         echo 'times() found.' >&4
19534         d_times="$define"
19535         inc=''
19536         case "$i_systimes" in
19537         "$define") inc='sys/times.h';;
19538         esac
19539         rp="What is the type returned by times() on this system?"
19540         set clock_t clocktype long stdio.h sys/types.h $inc
19541         eval $typedef_ask
19542 else
19543         echo 'times() NOT found, hope that will do.' >&4
19544         d_times="$undef"
19545         clocktype='int'
19546 fi
19547
19548 : see if tmpnam_r exists
19549 set tmpnam_r d_tmpnam_r
19550 eval $inlibc
19551 case "$d_tmpnam_r" in
19552 "$define")
19553         hdrs="$i_systypes sys/types.h define stdio.h "
19554         case "$d_tmpnam_r_proto:$usethreads" in
19555         ":define")      d_tmpnam_r_proto=define
19556                 set d_tmpnam_r_proto tmpnam_r $hdrs
19557                 eval $hasproto ;;
19558         *)      ;;
19559         esac
19560         case "$d_tmpnam_r_proto" in
19561         define)
19562         case "$tmpnam_r_proto" in
19563         ''|0) try='char* tmpnam_r(char*);'
19564         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19565         esac
19566         case "$tmpnam_r_proto" in
19567         ''|0)   d_tmpnam_r=undef
19568                 tmpnam_r_proto=0
19569                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19570         * )     case "$tmpnam_r_proto" in
19571                 REENTRANT_PROTO*) ;;
19572                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19573                 esac
19574                 echo "Prototype: $try" ;;
19575         esac
19576         ;;
19577         *)      case "$usethreads" in
19578                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19579                 esac
19580                 d_tmpnam_r=undef
19581                 tmpnam_r_proto=0
19582                 ;;
19583         esac
19584         ;;
19585 *)      tmpnam_r_proto=0
19586         ;;
19587 esac
19588
19589 : see if trunc exists
19590 set trunc d_trunc
19591 eval $inlibc
19592
19593 : see if truncate exists
19594 set truncate d_truncate
19595 eval $inlibc
19596
19597 : see if ttyname_r exists
19598 set ttyname_r d_ttyname_r
19599 eval $inlibc
19600 case "$d_ttyname_r" in
19601 "$define")
19602         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19603         case "$d_ttyname_r_proto:$usethreads" in
19604         ":define")      d_ttyname_r_proto=define
19605                 set d_ttyname_r_proto ttyname_r $hdrs
19606                 eval $hasproto ;;
19607         *)      ;;
19608         esac
19609         case "$d_ttyname_r_proto" in
19610         define)
19611         case "$ttyname_r_proto" in
19612         ''|0) try='int ttyname_r(int, char*, size_t);'
19613         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19614         esac
19615         case "$ttyname_r_proto" in
19616         ''|0) try='int ttyname_r(int, char*, int);'
19617         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19618         esac
19619         case "$ttyname_r_proto" in
19620         ''|0) try='char* ttyname_r(int, char*, int);'
19621         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19622         esac
19623         case "$ttyname_r_proto" in
19624         ''|0)   d_ttyname_r=undef
19625                 ttyname_r_proto=0
19626                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19627         * )     case "$ttyname_r_proto" in
19628                 REENTRANT_PROTO*) ;;
19629                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19630                 esac
19631                 echo "Prototype: $try" ;;
19632         esac
19633         ;;
19634         *)      case "$usethreads" in
19635                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19636                 esac
19637                 d_ttyname_r=undef
19638                 ttyname_r_proto=0
19639                 ;;
19640         esac
19641         ;;
19642 *)      ttyname_r_proto=0
19643         ;;
19644 esac
19645
19646 : see if tzname[] exists
19647 echo " "
19648 if set tzname val -a d_tzname; eval $csym; $val; then
19649         val="$define"
19650         echo 'tzname[] found.' >&4
19651 else
19652         val="$undef"
19653         echo 'tzname[] NOT found.' >&4
19654 fi
19655 set d_tzname
19656 eval $setvar
19657
19658 : Check if is a multiplatform env
19659 case "$osname" in
19660 darwin) multiarch="$define" ;;
19661 esac
19662 case "$multiarch" in
19663 ''|[nN]*) multiarch="$undef" ;;
19664 esac
19665
19666 : check for ordering of bytes in a UV
19667 echo " "
19668 case "$multiarch" in
19669 *$define*)
19670         $cat <<EOM
19671 You seem to be doing a multiarchitecture build,
19672 skipping the byteorder check.
19673
19674 EOM
19675         byteorder='ffff'
19676         ;;
19677 *)
19678         case "$byteorder" in
19679         '')
19680                 $cat <<'EOM'
19681 In the following, larger digits indicate more significance.  A big-endian
19682 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19683 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19684 machines may have weird orders like 3412.  A Cray will report 87654321,
19685 an Alpha will report 12345678. If the test program works the default is
19686 probably right.
19687 I'm now running the test program...
19688 EOM
19689                 $cat >try.c <<EOCP
19690 #include <stdio.h>
19691 #$i_stdlib I_STDLIB
19692 #ifdef I_STDLIB
19693 #include <stdlib.h>
19694 #endif
19695 #include <sys/types.h>
19696 typedef $uvtype UV;
19697 int main()
19698 {
19699         int i;
19700         union {
19701                 UV l;
19702                 char c[$uvsize];
19703         } u;
19704
19705         if ($uvsize > 4)
19706                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19707         else
19708                 u.l = (UV)0x04030201;
19709         for (i = 0; i < $uvsize; i++)
19710                 printf("%c", u.c[i]+'0');
19711         printf("\n");
19712         exit(0);
19713 }
19714 EOCP
19715                 xxx_prompt=y
19716                 set try
19717                 if eval $compile && $run ./try > /dev/null; then
19718                         dflt=`$run ./try`
19719                         case "$dflt" in
19720                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19721                                 echo "(The test program ran ok.)"
19722                                 echo "byteorder=$dflt"
19723                                 xxx_prompt=n
19724                         ;;
19725                         ????|????????) echo "(The test program ran ok.)" ;;
19726                         *) echo "(The test program didn't run right for some reason.)" ;;
19727                         esac
19728                 else
19729                         dflt='4321'
19730                         cat <<'EOM'
19731 (I can't seem to compile the test program.  Guessing big-endian...)
19732 EOM
19733                 fi
19734                 case "$xxx_prompt" in
19735                 y)
19736                         rp="What is the order of bytes in $uvtype?"
19737                         . ./myread
19738                         byteorder="$ans"
19739                         ;;
19740                 *)      byteorder=$dflt
19741                         ;;
19742                 esac
19743                 ;;
19744         esac
19745         $rm_try
19746         ;;
19747 esac
19748
19749 : Checking 32bit alignedness
19750 $cat <<EOM
19751
19752 Checking to see whether you can access character data unalignedly...
19753 EOM
19754 case "$d_u32align" in
19755 '')   $cat >try.c <<EOCP
19756 #include <stdio.h>
19757 #$i_stdlib I_STDLIB
19758 #ifdef I_STDLIB
19759 #include <stdlib.h>
19760 #endif
19761 #define U32 $u32type
19762 #define BYTEORDER 0x$byteorder
19763 #define U8 $u8type
19764 #include <signal.h>
19765 #ifdef SIGBUS
19766 $signal_t bletch(int s) { exit(4); }
19767 #endif
19768 int main() {
19769 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19770     volatile U8 buf[8];
19771     volatile U32 *up;
19772     int i;
19773
19774     if (sizeof(U32) != 4) {
19775         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19776         exit(1);
19777     }
19778
19779     fflush(stdout);
19780
19781 #ifdef SIGBUS
19782     signal(SIGBUS, bletch);
19783 #endif
19784
19785     buf[0] = 0;
19786     buf[1] = 0;
19787     buf[2] = 0;
19788     buf[3] = 1;
19789     buf[4] = 0;
19790     buf[5] = 0;
19791     buf[6] = 0;
19792     buf[7] = 1;
19793
19794     for (i = 0; i < 4; i++) {
19795         up = (U32*)(buf + i);
19796         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19797                (*up == 1 << (8*(3-i)))  /* little-endian */
19798               )
19799            )
19800         {
19801             printf("read failed (%x)\n", *up);
19802             exit(2);
19803         }
19804     }
19805
19806     /* write test */
19807     for (i = 0; i < 4; i++) {
19808         up = (U32*)(buf + i);
19809         *up = 0xBeef;
19810         if (*up != 0xBeef) {
19811             printf("write failed (%x)\n", *up);
19812             exit(3);
19813         }
19814     }
19815
19816     exit(0);
19817 #else
19818     printf("1\n");
19819     exit(1);
19820 #endif
19821     return 0;
19822 }
19823 EOCP
19824 set try
19825 if eval $compile_ok; then
19826         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19827         $run ./try 2>&1 >/dev/null
19828         case "$?" in
19829         0)      cat >&4 <<EOM
19830 You can access character data pretty unalignedly.
19831 EOM
19832                 d_u32align="$undef"
19833                 ;;
19834         *)      cat >&4 <<EOM
19835 It seems that you must access character data in an aligned manner.
19836 EOM
19837                 d_u32align="$define"
19838                 ;;
19839         esac
19840 else
19841         rp='Can you access character data at unaligned addresses?'
19842         dflt='n'
19843         . ./myread
19844         case "$ans" in
19845         [yY]*)  d_u32align="$undef"  ;;
19846         *)      d_u32align="$define" ;;
19847         esac
19848 fi
19849 $rm_try
19850 ;;
19851 esac
19852
19853 : see if ualarm exists
19854 set ualarm d_ualarm
19855 eval $inlibc
19856
19857 : see if umask exists
19858 set umask d_umask
19859 eval $inlibc
19860
19861 : see if unordered exists
19862 set unordered d_unordered
19863 eval $inlibc
19864
19865 : see if unsetenv exists
19866 set unsetenv d_unsetenv
19867 eval $inlibc
19868
19869 : see if usleep exists
19870 set usleep d_usleep
19871 eval $inlibc
19872
19873 : see if prototype for usleep is available
19874 echo " "
19875 set d_usleepproto usleep $i_unistd unistd.h
19876 eval $hasproto
19877
19878 : see if ustat exists
19879 set ustat d_ustat
19880 eval $inlibc
19881
19882 : see if closedir exists
19883 set closedir d_closedir
19884 eval $inlibc
19885
19886 case "$d_closedir" in
19887 "$define")
19888         echo " "
19889         echo "Checking whether closedir() returns a status..." >&4
19890         cat > try.c <<EOM
19891 #$i_dirent I_DIRENT             /**/
19892 #$i_sysdir I_SYS_DIR            /**/
19893 #$i_sysndir I_SYS_NDIR          /**/
19894 #$i_systypes I_SYS_TYPES        /**/
19895
19896 #if defined(I_SYS_TYPES)
19897 #include <sys/types.h>
19898 #endif
19899 #if defined(I_DIRENT)
19900 #include <dirent.h>
19901 #else
19902 #ifdef I_SYS_NDIR
19903 #include <sys/ndir.h>
19904 #else
19905 #ifdef I_SYS_DIR
19906 #ifdef hp9000s500
19907 #include <ndir.h>       /* may be wrong in the future */
19908 #else
19909 #include <sys/dir.h>
19910 #endif
19911 #endif
19912 #endif
19913 #endif
19914 int main() { return closedir(opendir(".")); }
19915 EOM
19916         set try
19917         if eval $compile_ok; then
19918                 if $run ./try > /dev/null 2>&1 ; then
19919                         echo "Yes, it does."
19920                         val="$undef"
19921                 else
19922                         echo "No, it doesn't."
19923                         val="$define"
19924                 fi
19925         else
19926                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19927                 val="$define"
19928         fi
19929         ;;
19930 *)
19931         val="$undef";
19932         ;;
19933 esac
19934 set d_void_closedir
19935 eval $setvar
19936 $rm_try
19937
19938 : see if there is a wait4
19939 set wait4 d_wait4
19940 eval $inlibc
19941
19942 : see if waitpid exists
19943 set waitpid d_waitpid
19944 eval $inlibc
19945
19946 : look for wcscmp
19947 echo " "
19948 $cat >try.c <<'EOCP'
19949 #include <stdio.h>
19950 #include <wchar.h>
19951 int main ()
19952 {
19953     wchar_t *s = L" ";
19954     return (wcscmp (s, s) ? 1 : 0);
19955     }
19956 EOCP
19957 set try
19958 val="$undef"
19959 if eval $compile; then
19960     `$run ./try`
19961     case "$?" in
19962         0)  echo "A working wcscmp() found." >&4
19963             val="$define" ;;
19964         *)  echo "wcscmp() found, but it doesn't work" >&4
19965             ;;
19966         esac
19967 else
19968     echo "wcscmp() NOT found." >&4
19969     fi
19970 set d_wcscmp
19971 eval $setvar
19972 $rm_try
19973
19974 : see if wcstombs exists
19975 set wcstombs d_wcstombs
19976 eval $inlibc
19977
19978 : look for wcsxfrm
19979 echo " "
19980 $cat >try.c <<'EOCP'
19981 #include <errno.h>
19982 #include <wchar.h>
19983 int main ()
19984 {
19985     wchar_t dst[4], *src = L" ";
19986     errno = 0;
19987     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
19988     }
19989 EOCP
19990 set try
19991 val="$undef"
19992 if eval $compile; then
19993     `$run ./try`
19994     case "$?" in
19995         0)  echo "A working wcsxfrm() found." >&4
19996             val="$define" ;;
19997         *)  echo "wcsxfrm() found, but it doesn't work" >&4
19998             ;;
19999         esac
20000 else
20001     echo "wcsxfrm() NOT found." >&4
20002     fi
20003 set d_wcsxfrm
20004 eval $setvar
20005 $rm_try
20006
20007 : see if wctomb exists
20008 set wctomb d_wctomb
20009 eval $inlibc
20010
20011 : see if writev exists
20012 set writev d_writev
20013 eval $inlibc
20014
20015 : check for alignment requirements
20016 echo " "
20017 case "$alignbytes" in
20018     '') echo "Checking alignment constraints..." >&4
20019         if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
20020             $cat >try.c <<'EOCP'
20021 typedef long double NV;
20022 EOCP
20023         else
20024             $cat >try.c <<'EOCP'
20025 typedef double NV;
20026 EOCP
20027         fi
20028         $cat >>try.c <<'EOCP'
20029 #include <stdio.h>
20030 struct foobar {
20031     char foo;
20032     NV bar;
20033 } try_algn;
20034 int main()
20035 {
20036     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20037     return(0);
20038 }
20039 EOCP
20040         set try
20041         if eval $compile_ok; then
20042             dflt=`$run ./try`
20043         else
20044             dflt='8'
20045             echo "(I can't seem to compile the test program...)"
20046         fi
20047         case "$multiarch" in
20048             *$define*)
20049                 : The usual safe value is 8, but Darwin with -Duselongdouble
20050                 : needs 16.  Hence, we will take 8 as a minimum, but allow
20051                 : Configure to pick a larger value if needed.
20052                 if $test "$dflt" -lt 8; then
20053                     dflt='8'
20054                     echo "Setting alignment to 8 for multiarch support.">&4
20055                 fi
20056                 ;;
20057         esac
20058         ;;
20059     *) dflt="$alignbytes"
20060         ;;
20061 esac
20062 rp="Doubles must be aligned on a how-many-byte boundary?"
20063 . ./myread
20064 alignbytes="$ans"
20065 $rm_try
20066
20067 : set the base revision
20068 baserev=5.0
20069
20070 : length of character in bytes. Is always 1, otherwise it is not C
20071 : This used to be a test using sizeof
20072 charsize=1
20073
20074 : Check for the number of bits in a character
20075 case "$charbits" in
20076 '')     echo "Checking how long a character is (in bits)..." >&4
20077         $cat >try.c <<EOCP
20078 #include <stdio.h>
20079 int main ()
20080 {
20081     int n;
20082     unsigned char c;
20083     for (c = 1, n = 0; c; c <<= 1, n++) ;
20084     printf ("%d\n", n);
20085     return (0);
20086     }
20087 EOCP
20088         set try
20089         if eval $compile_ok; then
20090                 dflt=`$run ./try`
20091         else
20092                 dflt='8'
20093                 echo "(I can't seem to compile the test program.  Guessing...)"
20094         fi
20095         ;;
20096 *)
20097         dflt="$charbits"
20098         ;;
20099 esac
20100 rp="What is the length of a character (in bits)?"
20101 . ./myread
20102 charbits="$ans"
20103 $rm_try
20104 case "$charbits" in
20105 8)      ;;
20106 *)      cat >&4 << EOM
20107 Your system has an unsigned character size of $charbits bits, which
20108 is rather unusual (normally it is 8 bits).  Perl likely will not work
20109 correctly on your system, with subtle bugs in various places.
20110 EOM
20111         rp='Do you really want to continue?'
20112         dflt='n'
20113         . ./myread
20114         case "$ans" in
20115                 [yY])   echo >&4 "Okay, continuing."    ;;
20116                 *)      exit 1                          ;;
20117         esac
20118 esac
20119
20120 : how do we concatenate cpp tokens here?
20121 echo " "
20122 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20123 $cat >cpp_stuff.c <<'EOCP'
20124 #define RCAT(a,b)a/**/b
20125 #define ACAT(a,b)a ## b
20126 RCAT(Rei,ser)
20127 ACAT(Cir,cus)
20128 EOCP
20129 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20130 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20131         echo "Oh!  Smells like ANSI's been here." >&4
20132         echo "We can catify or stringify, separately or together!"
20133         cpp_stuff=42
20134 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20135         echo "Ah, yes!  The good old days!" >&4
20136         echo "However, in the good old days we don't know how to stringify and"
20137         echo "catify at the same time."
20138         cpp_stuff=1
20139 else
20140         $cat >&4 <<EOM
20141 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20142 You're going to have to edit the values of CAT[2-5] in config.h...
20143 EOM
20144         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20145 fi
20146 $rm -f cpp_stuff.*
20147
20148 : see if this is a db.h system
20149 set db.h i_db
20150 eval $inhdr
20151
20152 case "$i_db" in
20153 $define)
20154         : Check db version.
20155         echo " "
20156         echo "Checking Berkeley DB version ..." >&4
20157         $cat >try.c <<EOCP
20158 #$d_const HASCONST
20159 #ifndef HASCONST
20160 #define const
20161 #endif
20162 #include <sys/types.h>
20163 #include <stdio.h>
20164 #$i_stdlib I_STDLIB
20165 #ifdef I_STDLIB
20166 #include <stdlib.h>
20167 #endif
20168 #include <db.h>
20169 int main(int argc, char *argv[])
20170 {
20171 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20172     int Major, Minor, Patch ;
20173     unsigned long Version ;
20174     (void)db_version(&Major, &Minor, &Patch) ;
20175     if (argc == 2) {
20176         printf("%d %d %d %d %d %d\n",
20177                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20178                Major, Minor, Patch);
20179         exit(0);
20180     }
20181     printf("You have Berkeley DB Version 2 or greater.\n");
20182
20183     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20184                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20185     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20186                 Major, Minor, Patch) ;
20187
20188     /* check that db.h & libdb are compatible */
20189     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20190         printf("db.h and libdb are incompatible.\n") ;
20191         exit(3);
20192     }
20193
20194     printf("db.h and libdb are compatible.\n") ;
20195
20196     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20197                 + DB_VERSION_PATCH ;
20198
20199     /* needs to be >= 2.3.4 */
20200     if (Version < 2003004) {
20201     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20202         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20203         exit(2);
20204     }
20205
20206     exit(0);
20207 #else
20208 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20209     if (argc == 2) {
20210         printf("1 0 0\n");
20211         exit(0);
20212     }
20213     printf("You have Berkeley DB Version 1.\n");
20214     exit(0);    /* DB version < 2: the coast is clear. */
20215 #else
20216     exit(1);    /* <db.h> not Berkeley DB? */
20217 #endif
20218 #endif
20219 }
20220 EOCP
20221         set try
20222         if eval $compile_ok && $run ./try; then
20223                 echo 'Looks OK.' >&4
20224                 set `$run ./try 1`
20225                 db_version_major=$1
20226                 db_version_minor=$2
20227                 db_version_patch=$3
20228         else
20229                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20230                 i_db=$undef
20231                 case " $libs " in
20232                 *"-ldb "*)
20233                         : Remove db from list of libraries to use
20234                         echo "Removing unusable -ldb from library list" >&4
20235                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20236                         shift
20237                         libs="$*"
20238                         echo "libs = $libs" >&4
20239                         ;;
20240                 esac
20241         fi
20242         $rm_try
20243         ;;
20244 esac
20245
20246 case "$i_db" in
20247 define)
20248         : Check the return type needed for hash
20249         echo " "
20250         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20251         $cat >try.c <<EOCP
20252 #$d_const HASCONST
20253 #ifndef HASCONST
20254 #define const
20255 #endif
20256 #include <sys/types.h>
20257 #include <db.h>
20258
20259 #ifndef DB_VERSION_MAJOR
20260 u_int32_t hash_cb (const void* ptr, size_t size)
20261 {
20262 }
20263 HASHINFO info;
20264 int main()
20265 {
20266         info.hash = hash_cb;
20267 }
20268 #endif
20269 EOCP
20270         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20271                 if $contains warning try.out >>/dev/null 2>&1 ; then
20272                         db_hashtype='int'
20273                 else
20274                         db_hashtype='u_int32_t'
20275                 fi
20276         else
20277                 : XXX Maybe we should just give up here.
20278                 db_hashtype=u_int32_t
20279                 $cat try.out >&4
20280                 echo "Help:  I can't seem to compile the db test program." >&4
20281                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20282         fi
20283         $rm_try
20284         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20285         ;;
20286 *)      db_hashtype=u_int32_t
20287         ;;
20288 esac
20289 case "$i_db" in
20290 define)
20291         : Check the return type needed for prefix
20292         echo " "
20293         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20294         cat >try.c <<EOCP
20295 #$d_const HASCONST
20296 #ifndef HASCONST
20297 #define const
20298 #endif
20299 #include <sys/types.h>
20300 #include <db.h>
20301
20302 #ifndef DB_VERSION_MAJOR
20303 size_t prefix_cb (const DBT *key1, const DBT *key2)
20304 {
20305 }
20306 BTREEINFO info;
20307 int main()
20308 {
20309         info.prefix = prefix_cb;
20310 }
20311 #endif
20312 EOCP
20313         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20314                 if $contains warning try.out >>/dev/null 2>&1 ; then
20315                         db_prefixtype='int'
20316                 else
20317                         db_prefixtype='size_t'
20318                 fi
20319         else
20320                 db_prefixtype='size_t'
20321                 : XXX Maybe we should just give up here.
20322                 $cat try.out >&4
20323                 echo "Help:  I can't seem to compile the db test program." >&4
20324                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20325         fi
20326         $rm_try
20327         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20328         ;;
20329 *)      db_prefixtype='size_t'
20330         ;;
20331 esac
20332
20333 : How can we generate normalized random numbers ?
20334 echo " "
20335 echo "Using our internal random number implementation..." >&4
20336
20337 case "$ccflags" in
20338 *-Dmy_rand=*|*-Dmy_srand=*)
20339         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20340         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20341         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20342         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20343         ;;
20344 esac
20345
20346 randfunc=Perl_drand48
20347 drand01="Perl_drand48()"
20348 seedfunc="Perl_drand48_init"
20349 randbits=48
20350 randseedtype=U32
20351
20352 : Determine if this is an EBCDIC system
20353 echo " "
20354 echo "Determining whether or not we are on an EBCDIC system..." >&4
20355 $cat >try.c <<'EOM'
20356 int main()
20357 {
20358   if ('M'==0xd4) return 0;
20359   return 1;
20360 }
20361 EOM
20362
20363 val=$undef
20364 set try
20365 if eval $compile_ok; then
20366         if $run ./try; then
20367                 echo "You seem to speak EBCDIC." >&4
20368                 val="$define"
20369         else
20370                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20371         fi
20372 else
20373         echo "I'm unable to compile the test program." >&4
20374         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20375 fi
20376 $rm_try
20377 set ebcdic
20378 eval $setvar
20379
20380 : Check how to flush
20381 echo " "
20382 $cat >&4 <<EOM
20383 Checking how to flush all pending stdio output...
20384 EOM
20385 # I only know how to find the first 32 possibly open files on SunOS.
20386 # See also hints/sunos_4_1.sh and util.c  --AD
20387 case "$osname" in
20388 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20389 esac
20390 $cat >>try.c <<EOCP
20391 #include <stdio.h>
20392 #$i_stdlib I_STDLIB
20393 #ifdef I_STDLIB
20394 #include <stdlib.h>
20395 #endif
20396 #$i_unistd I_UNISTD
20397 #ifdef I_UNISTD
20398 # include <unistd.h>
20399 #endif
20400 #$d_sysconf HAS_SYSCONF
20401 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20402 #ifdef HAS_STDIO_STREAM_ARRAY
20403 # define STDIO_STREAM_ARRAY $stdio_stream_array
20404 #endif
20405 int main() {
20406   FILE* p;
20407   unlink("try.out");
20408   p = fopen("try.out", "w");
20409 #ifdef TRY_FPUTC
20410   fputc('x', p);
20411 #else
20412 # ifdef TRY_FPRINTF
20413   fprintf(p, "x");
20414 # endif
20415 #endif
20416 #ifdef TRY_FFLUSH_NULL
20417   fflush(NULL);
20418 #endif
20419 #ifdef TRY_FFLUSH_ALL
20420   {
20421     long open_max = -1;
20422 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20423     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20424 # else
20425 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20426     open_max = sysconf(_SC_OPEN_MAX);
20427 #  else
20428 #   ifdef FOPEN_MAX
20429     open_max = FOPEN_MAX;
20430 #   else
20431 #    ifdef OPEN_MAX
20432     open_max = OPEN_MAX;
20433 #    else
20434 #     ifdef _NFILE
20435     open_max = _NFILE;
20436 #     endif
20437 #    endif
20438 #   endif
20439 #  endif
20440 # endif
20441 # ifdef HAS_STDIO_STREAM_ARRAY
20442     if (open_max > 0) {
20443       long i;
20444       for (i = 0; i < open_max; i++)
20445             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20446                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20447                 STDIO_STREAM_ARRAY[i]._flag)
20448                 fflush(&STDIO_STREAM_ARRAY[i]);
20449     }
20450   }
20451 # endif
20452 #endif
20453   _exit(42);
20454 }
20455 EOCP
20456 : first we have to find out how _not_ to flush
20457 $to try.c
20458 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20459     output=''
20460     set try -DTRY_FPUTC
20461     if eval $compile; then
20462             $run ./try 2>/dev/null
20463             code="$?"
20464             $from try.out
20465             if $test ! -s try.out -a "X$code" = X42; then
20466                 output=-DTRY_FPUTC
20467             fi
20468     fi
20469     case "$output" in
20470     '')
20471             set try -DTRY_FPRINTF
20472             if eval $compile; then
20473                     $run ./try 2>/dev/null
20474                     code="$?"
20475                     $from try.out
20476                     if $test ! -s try.out -a "X$code" = X42; then
20477                         output=-DTRY_FPRINTF
20478                     fi
20479             fi
20480         ;;
20481     esac
20482 fi
20483 : check for fflush NULL behavior
20484 case "$fflushNULL" in
20485 '')     set try -DTRY_FFLUSH_NULL $output
20486         if eval $compile; then
20487                 $run ./try 2>/dev/null
20488                 code="$?"
20489                 $from try.out
20490                 if $test -s try.out -a "X$code" = X42; then
20491                         fflushNULL="`$cat try.out`"
20492                 else
20493                         if $test "X$code" != X42; then
20494                                 $cat >&4 <<EOM
20495 (If this test failed, don't worry, we'll try another method shortly.)
20496 EOM
20497                         fi
20498                 fi
20499         fi
20500         $rm -f core try.core core.try.*
20501         case "$fflushNULL" in
20502         x)      $cat >&4 <<EOM
20503 Your fflush(NULL) works okay for output streams.
20504 Let's see if it clobbers input pipes...
20505 EOM
20506 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20507 # bug that improperly flushes the input end of pipes.  So we avoid the
20508 # autoflush on fork/system/exec support for now. :-(
20509 $cat >tryp.c <<EOCP
20510 #include <stdio.h>
20511 int
20512 main(int argc, char **argv)
20513 {
20514     char buf[1024];
20515     int i;
20516     char *bp = buf;
20517     while (1) {
20518         while ((i = getc(stdin)) != -1
20519                && (*bp++ = i) != '\n'
20520                && bp < &buf[1024])
20521         /* DO NOTHING */ ;
20522         *bp = '\0';
20523         fprintf(stdout, "%s", buf);
20524         fflush(NULL);
20525         if (i == -1)
20526             return 0;
20527         bp = buf;
20528     }
20529 }
20530 EOCP
20531                 fflushNULL="$define"
20532                 set tryp
20533                 if eval $compile; then
20534                     $rm -f tryp.out
20535                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20536                     if $test "X$targethost" != X; then
20537                         $to tryp.c
20538                         $to tryp
20539                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20540                     else
20541                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20542                     fi
20543                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20544                        $cat >&4 <<EOM
20545 fflush(NULL) seems to behave okay with input streams.
20546 EOM
20547                         fflushNULL="$define"
20548                     else
20549                         $cat >&4 <<EOM
20550 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20551 EOM
20552                         fflushNULL="$undef"
20553                     fi
20554                 fi
20555                 $rm -f core tryp.c tryp.core core.tryp.*
20556                 ;;
20557         '')     $cat >&4 <<EOM
20558 Your fflush(NULL) isn't working (contrary to ANSI C).
20559 EOM
20560                 fflushNULL="$undef"
20561                 ;;
20562         *)      $cat >&4 <<EOM
20563 Cannot figure out whether your fflush(NULL) works or not.
20564 I'm assuming it doesn't (contrary to ANSI C).
20565 EOM
20566                 fflushNULL="$undef"
20567                 ;;
20568         esac
20569         ;;
20570 $define|true|[yY]*)
20571         fflushNULL="$define"
20572         ;;
20573 *)
20574         fflushNULL="$undef"
20575         ;;
20576 esac
20577 : check explicit looping only if NULL did not work, and if the pipe
20578 : bug does not show up on an explicit flush too
20579 case "$fflushNULL" in
20580 "$undef")
20581         $cat >tryp.c <<EOCP
20582 #include <stdio.h>
20583 int
20584 main(int argc, char **argv)
20585 {
20586     char buf[1024];
20587     int i;
20588     char *bp = buf;
20589     while (1) {
20590         while ((i = getc(stdin)) != -1
20591                && (*bp++ = i) != '\n'
20592                && bp < &buf[1024])
20593         /* DO NOTHING */ ;
20594         *bp = '\0';
20595         fprintf(stdout, "%s", buf);
20596         fflush(stdin);
20597         if (i == -1)
20598             return 0;
20599         bp = buf;
20600     }
20601 }
20602 EOCP
20603         set tryp
20604         if eval $compile; then
20605             $rm -f tryp.out
20606             if $test "X$targethost" != X; then
20607                 $to tryp.c
20608                 $to tryp
20609                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20610             else
20611                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20612             fi
20613             if cmp tryp.c tryp.out >/dev/null 2>&1; then
20614                $cat >&4 <<EOM
20615 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20616 EOM
20617                 : now check for fflushall behaviour
20618                 case "$fflushall" in
20619                 '')     set try -DTRY_FFLUSH_ALL $output
20620                         if eval $compile; then
20621                                 $cat >&4 <<EOM
20622 (Now testing the other method--but note that this also may fail.)
20623 EOM
20624                                 $run ./try 2>/dev/null
20625                                 code=$?
20626                                 $from try.out
20627                                 if $test -s try.out -a "X$code" = X42; then
20628                                         fflushall="`$cat try.out`"
20629                                 fi
20630                         fi
20631                         $rm_try
20632                         case "$fflushall" in
20633                         x)      $cat >&4 <<EOM
20634 Whew. Flushing explicitly all the stdio streams works.
20635 EOM
20636                                 fflushall="$define"
20637                                 ;;
20638                         '')     $cat >&4 <<EOM
20639 Sigh. Flushing explicitly all the stdio streams doesn't work.
20640 EOM
20641                                 fflushall="$undef"
20642                                 ;;
20643                         *)      $cat >&4 <<EOM
20644 Cannot figure out whether flushing stdio streams explicitly works or not.
20645 I'm assuming it doesn't.
20646 EOM
20647                                 fflushall="$undef"
20648                                 ;;
20649                         esac
20650                         ;;
20651                 "$define"|true|[yY]*)
20652                         fflushall="$define"
20653                         ;;
20654                 *)
20655                         fflushall="$undef"
20656                         ;;
20657                 esac
20658             else
20659                 $cat >&4 <<EOM
20660 All is futile.  Even fflush(stdin) clobbers input pipes!
20661 EOM
20662                 fflushall="$undef"
20663             fi
20664         else
20665             fflushall="$undef"
20666         fi
20667         $rm -f core tryp.c tryp.core core.tryp.*
20668         ;;
20669 *)      fflushall="$undef"
20670         ;;
20671 esac
20672
20673 case "$fflushNULL$fflushall" in
20674 undefundef)
20675         $cat <<EOM
20676 OK, I give up.  I cannot figure out how to flush pending stdio output.
20677 We won't be flushing handles at all before fork/exec/popen.
20678 EOM
20679         ;;
20680 esac
20681 $rm_try tryp
20682
20683 : Store the full pathname to the ar program for use in the C program
20684 : Respect a hint or command line value for full_ar.
20685 case "$full_ar" in
20686 '') full_ar=$ar ;;
20687 esac
20688
20689 : Store the full pathname to the sed program for use in the C program
20690 full_sed=$sed
20691
20692 : see what type gids are declared as in the kernel
20693 echo " "
20694 echo "Looking for the type for group ids returned by getgid()."
20695 set gid_t gidtype xxx stdio.h sys/types.h
20696 eval $typedef
20697 case "$gidtype" in
20698 xxx)
20699         xxx=`./findhdr sys/user.h`
20700         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
20701         case $1 in
20702         unsigned) dflt="$1 $2" ;;
20703         *) dflt="$1" ;;
20704         esac
20705         ;;
20706 *) dflt="$gidtype";;
20707 esac
20708 case "$gidtype" in
20709 gid_t) echo "gid_t found." ;;
20710 *)      rp="What is the type for group ids returned by getgid()?"
20711         . ./myread
20712         gidtype="$ans"
20713         ;;
20714 esac
20715
20716 : Check the size of GID
20717 echo " "
20718 case "$gidtype" in
20719 *_t) zzz="$gidtype"     ;;
20720 *)   zzz="gid"          ;;
20721 esac
20722 echo "Checking the size of $zzz..." >&4
20723 cat > try.c <<EOCP
20724 #include <sys/types.h>
20725 #include <stdio.h>
20726 #$i_stdlib I_STDLIB
20727 #ifdef I_STDLIB
20728 #include <stdlib.h>
20729 #endif
20730 int main() {
20731     printf("%d\n", (int)sizeof($gidtype));
20732     exit(0);
20733 }
20734 EOCP
20735 set try
20736 if eval $compile_ok; then
20737         yyy=`$run ./try`
20738         case "$yyy" in
20739         '')     gidsize=4
20740                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
20741                 ;;
20742         *)      gidsize=$yyy
20743                 echo "Your $zzz is $gidsize bytes long."
20744                 ;;
20745         esac
20746 else
20747         gidsize=4
20748         echo "(I can't compile the test program--guessing $gidsize.)" >&4
20749 fi
20750
20751
20752 : Check if GID is signed
20753 echo " "
20754 case "$gidtype" in
20755 *_t) zzz="$gidtype"     ;;
20756 *)   zzz="gid"          ;;
20757 esac
20758 echo "Checking the sign of $zzz..." >&4
20759 cat > try.c <<EOCP
20760 #include <sys/types.h>
20761 #include <stdio.h>
20762 int main() {
20763         $gidtype foo = -1;
20764         if (foo < 0)
20765                 printf("-1\n");
20766         else
20767                 printf("1\n");
20768 }
20769 EOCP
20770 set try
20771 if eval $compile; then
20772         yyy=`$run ./try`
20773         case "$yyy" in
20774         '')     gidsign=1
20775                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20776                 ;;
20777         *)      gidsign=$yyy
20778                 case "$gidsign" in
20779                  1) echo "Your $zzz is unsigned." ;;
20780                 -1) echo "Your $zzz is signed."   ;;
20781                 esac
20782                 ;;
20783         esac
20784 else
20785         gidsign=1
20786         echo "(I can't compile the test program--guessing unsigned.)" >&4
20787 fi
20788
20789
20790 : Check 64bit sizes
20791 echo " "
20792
20793 if $test X"$quadtype" != X; then
20794
20795 echo "Checking how to print 64-bit integers..." >&4
20796
20797 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
20798         $cat >try.c <<'EOCP'
20799 #include <sys/types.h>
20800 #include <stdio.h>
20801 int main() {
20802   int q = 12345678901;
20803   printf("%ld\n", q);
20804 }
20805 EOCP
20806         set try
20807         if eval $compile; then
20808                 yyy=`$run ./try`
20809                 case "$yyy" in
20810                 12345678901)
20811                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
20812                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
20813                         echo "We will use %d."
20814                         ;;
20815                 esac
20816         fi
20817 fi
20818
20819 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
20820         $cat >try.c <<'EOCP'
20821 #include <sys/types.h>
20822 #include <stdio.h>
20823 int main() {
20824   long q = 12345678901;
20825   printf("%ld\n", q);
20826 }
20827 EOCP
20828         set try
20829         if eval $compile; then
20830                 yyy=`$run ./try`
20831                 case "$yyy" in
20832                 12345678901)
20833                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
20834                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
20835                         echo "We will use %ld."
20836                         ;;
20837                 esac
20838         fi
20839 fi
20840
20841 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
20842         $cat >try.c <<'EOCP'
20843 #include <sys/types.h>
20844 #include <inttypes.h>
20845 #include <stdio.h>
20846 int main() {
20847   int64_t q = 12345678901;
20848   printf("%" PRId64 "\n", q);
20849 }
20850 EOCP
20851         set try
20852         if eval $compile; then
20853                 yyy=`$run ./try`
20854                 case "$yyy" in
20855                 12345678901)
20856                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
20857                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
20858                         echo "We will use the C9X style."
20859                         ;;
20860                 esac
20861         fi
20862 fi
20863
20864 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20865         $cat >try.c <<EOCP
20866 #include <sys/types.h>
20867 #include <stdio.h>
20868 int main() {
20869   $quadtype q = 12345678901;
20870   printf("%Ld\n", q);
20871 }
20872 EOCP
20873         set try
20874         if eval $compile; then
20875                 yyy=`$run ./try`
20876                 case "$yyy" in
20877                 12345678901)
20878                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
20879                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20880                         echo "We will use %Ld."
20881                         ;;
20882                 esac
20883         fi
20884 fi
20885
20886 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20887         $cat >try.c <<'EOCP'
20888 #include <sys/types.h>
20889 #include <stdio.h>
20890 int main() {
20891   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20892   printf("%lld\n", q);
20893 }
20894 EOCP
20895         set try
20896         if eval $compile; then
20897                 yyy=`$run ./try`
20898                 case "$yyy" in
20899                 12345678901)
20900                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20901                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20902                         echo "We will use the %lld style."
20903                         ;;
20904                 esac
20905         fi
20906 fi
20907
20908 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20909         $cat >try.c <<EOCP
20910 #include <sys/types.h>
20911 #include <stdio.h>
20912 int main() {
20913   $quadtype q = 12345678901;
20914   printf("%qd\n", q);
20915 }
20916 EOCP
20917         set try
20918         if eval $compile; then
20919                 yyy=`$run ./try`
20920                 case "$yyy" in
20921                 12345678901)
20922                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20923                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20924                         echo "We will use %qd."
20925                         ;;
20926                 esac
20927         fi
20928 fi
20929
20930 if $test X"$sPRId64" = X; then
20931         echo "Cannot figure out how to print 64-bit integers." >&4
20932 fi
20933 $rm_try
20934
20935 fi
20936
20937 case "$sPRId64" in
20938 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20939         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20940         ;;
20941 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20942         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20943         ;;
20944 esac
20945
20946 : Check format strings for internal types
20947 echo " "
20948 $echo "Checking the format strings to be used for Perl's internal types..." >&4
20949
20950 if $test X"$ivsize" = X8; then
20951         ivdformat="$sPRId64"
20952         uvuformat="$sPRIu64"
20953         uvoformat="$sPRIo64"
20954         uvxformat="$sPRIx64"
20955         uvXUformat="$sPRIXU64"
20956 else
20957         if $test X"$ivsize" = X"$longsize"; then
20958                 ivdformat='"ld"'
20959                 uvuformat='"lu"'
20960                 uvoformat='"lo"'
20961                 uvxformat='"lx"'
20962                 uvXUformat='"lX"'
20963         else
20964                 if $test X"$ivsize" = X"$intsize"; then
20965                         ivdformat='"d"'
20966                         uvuformat='"u"'
20967                         uvoformat='"o"'
20968                         uvxformat='"x"'
20969                         uvXUformat='"X"'
20970                 else
20971                         : far out
20972                         if $test X"$ivsize" = X"$shortsize"; then
20973                                 ivdformat='"hd"'
20974                                 uvuformat='"hu"'
20975                                 uvoformat='"ho"'
20976                                 uvxformat='"hx"'
20977                                 uvXUformat='"hX"'
20978                         fi
20979                 fi
20980         fi
20981 fi
20982
20983 if $test X"$usequadmath" = X"$define"; then
20984     nveformat='"Qe"'
20985     nvfformat='"Qf"'
20986     nvgformat='"Qg"'
20987     nvEUformat='"QE"'
20988     nvFUformat='"QF"'
20989     nvGUformat='"QG"'
20990 else
20991     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20992         nveformat="$sPRIeldbl"
20993         nvfformat="$sPRIfldbl"
20994         nvgformat="$sPRIgldbl"
20995         nvEUformat="$sPRIEUldbl"
20996         nvFUformat="$sPRIFUldbl"
20997         nvGUformat="$sPRIGUldbl"
20998     else
20999         nveformat='"e"'
21000         nvfformat='"f"'
21001         nvgformat='"g"'
21002         nvEUformat='"E"'
21003         nvFUformat='"F"'
21004         nvGUformat='"G"'
21005     fi
21006 fi
21007
21008 case "$ivdformat" in
21009 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21010     exit 1
21011     ;;
21012 esac
21013
21014 : Check format string for GID
21015
21016 echo " "
21017 $echo "Checking the format string to be used for gids..." >&4
21018
21019 case "$gidsign" in
21020 -1)     if $test X"$gidsize" = X"$ivsize"; then
21021                 gidformat="$ivdformat"
21022         else
21023                 if $test X"$gidsize" = X"$longsize"; then
21024                         gidformat='"ld"'
21025                 else
21026                         if $test X"$gidsize" = X"$intsize"; then
21027                                 gidformat='"d"'
21028                         else
21029                                 if $test X"$gidsize" = X"$shortsize"; then
21030                                         gidformat='"hd"'
21031                                 fi
21032                         fi
21033                 fi
21034         fi
21035         ;;
21036 *)      if $test X"$gidsize" = X"$uvsize"; then
21037                 gidformat="$uvuformat"
21038         else
21039                 if $test X"$gidsize" = X"$longsize"; then
21040                         gidformat='"lu"'
21041                 else
21042                         if $test X"$gidsize" = X"$intsize"; then
21043                                 gidformat='"u"'
21044                         else
21045                                 if $test X"$gidsize" = X"$shortsize"; then
21046                                         gidformat='"hu"'
21047                                 fi
21048                         fi
21049                 fi
21050         fi
21051         ;;
21052 esac
21053
21054 : see if getgroups exists
21055 set getgroups d_getgrps
21056 eval $inlibc
21057
21058 : see if setgroups exists
21059 set setgroups d_setgrps
21060 eval $inlibc
21061
21062 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21063 echo " "
21064 case "$d_getgrps$d_setgrps" in
21065 *define*)
21066         case "$groupstype" in
21067         '') dflt="$gidtype" ;;
21068         *)  dflt="$groupstype" ;;
21069         esac
21070         $cat <<EOM
21071 What type of pointer is the second argument to getgroups() and setgroups()?
21072 Usually this is the same as group ids, $gidtype, but not always.
21073
21074 EOM
21075         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21076         . ./myread
21077         groupstype="$ans"
21078         ;;
21079 *)  groupstype="$gidtype";;
21080 esac
21081
21082 : check whether make sets MAKE
21083 echo " "
21084 echo "Checking if your $make program sets \$(MAKE)..." >&4
21085 case "$make_set_make" in
21086 '')
21087         $sed 's/^X //' > testmake.mak << 'EOF'
21088 Xall:
21089 X       @echo 'maketemp="$(MAKE)"'
21090 EOF
21091         case "`$make -f testmake.mak 2>/dev/null`" in
21092         *maketemp=*) make_set_make='#' ;;
21093         *)      make_set_make="MAKE=$make" ;;
21094         esac
21095         $rm -f testmake.mak
21096         ;;
21097 esac
21098 case "$make_set_make" in
21099 '#') echo "Yup, it does.";;
21100 *) echo "Nope, it doesn't.";;
21101 esac
21102
21103 : see what type is used for mode_t
21104 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21105 set mode_t modetype int stdio.h sys/types.h
21106 eval $typedef_ask
21107
21108 : see if we need va_copy
21109 echo " "
21110 case "$i_stdarg" in
21111 "$define")
21112         $cat >try.c <<EOCP
21113 #include <stdarg.h>
21114 #include <stdio.h>
21115 #$i_stdlib I_STDLIB
21116 #ifdef I_STDLIB
21117 #include <stdlib.h>
21118 #endif
21119 #include <signal.h>
21120
21121 int
21122 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21123 {
21124   return vfprintf(f, fmt, *valp);
21125 }
21126
21127 int
21128 myvfprintf(FILE *f, const  char *fmt, va_list val)
21129 {
21130   return ivfprintf(f, fmt, &val);
21131 }
21132
21133 int
21134 myprintf(char *fmt, ...)
21135 {
21136   va_list val;
21137   va_start(val, fmt);
21138   return myvfprintf(stdout, fmt, val);
21139 }
21140
21141 int
21142 main(int ac, char **av)
21143 {
21144   signal(SIGSEGV, exit);
21145
21146   myprintf("%s%cs all right, then\n", "that", '\'');
21147   exit(0);
21148 }
21149 EOCP
21150         set try
21151         if eval $compile && $run ./try 2>&1 >/dev/null; then
21152                 case "`$run ./try`" in
21153                 "that's all right, then")
21154                         okay=yes
21155                         ;;
21156                 esac
21157         fi
21158         case "$okay" in
21159         yes)    echo "It seems that you don't need va_copy()." >&4
21160                 need_va_copy="$undef"
21161                 ;;
21162         *)      echo "It seems that va_copy() or similar will be needed." >&4
21163                 need_va_copy="$define"
21164                 ;;
21165         esac
21166         $rm_try
21167         ;;
21168 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
21169         need_va_copy="$undef"
21170         ;;
21171 esac
21172
21173 : see what type is used for size_t
21174 rp="What is the type used for the length parameter for string functions?"
21175 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21176 eval $typedef_ask
21177
21178 : check for type of arguments to gethostbyaddr.
21179 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21180         case "$d_gethbyaddr" in
21181         $define)
21182                 $cat <<EOM
21183
21184 Checking to see what type of arguments are accepted by gethostbyaddr().
21185 EOM
21186                 hdrs="$define sys/types.h
21187                         $d_socket sys/socket.h
21188                         $i_niin netinet/in.h
21189                         $i_netdb netdb.h
21190                         $i_unistd unistd.h"
21191                 : The first arg can 'char *' or 'void *'
21192                 : The second arg is some of integral type
21193                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21194                         for yyy in size_t long int; do
21195                                 case "$netdb_host_type" in
21196                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21197                                         if ./protochk "$try" $hdrs; then
21198                                                 echo "Your system accepts $xxx for the first arg."
21199                                                 echo "...and $yyy for the second arg."
21200                                                 netdb_host_type="$xxx"
21201                                                 netdb_hlen_type="$yyy"
21202                                         fi
21203                                         ;;
21204                                 esac
21205                         done
21206                 done
21207                 : In case none of those worked, prompt the user.
21208                 case "$netdb_host_type" in
21209                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21210                         dflt='char *'
21211                         . ./myread
21212                         netdb_host_type=$ans
21213                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21214                         dflt="$sizetype"
21215                         . ./myread
21216                         netdb_hlen_type=$ans
21217                         ;;
21218                 esac
21219                 ;;
21220         *)      : no gethostbyaddr, so pick harmless defaults
21221                 netdb_host_type='char *'
21222                 netdb_hlen_type="$sizetype"
21223                 ;;
21224         esac
21225         # Remove the "const" if needed. -- but then we'll have a
21226         # prototype clash!
21227         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21228 fi
21229
21230 : check for type of argument to gethostbyname.
21231 if test "X$netdb_name_type" = X ; then
21232         case "$d_gethbyname" in
21233         $define)
21234                 $cat <<EOM
21235
21236 Checking to see what type of argument is accepted by gethostbyname().
21237 EOM
21238                 hdrs="$define sys/types.h
21239                         $d_socket sys/socket.h
21240                         $i_niin netinet/in.h
21241                         $i_netdb netdb.h
21242                         $i_unistd unistd.h"
21243                 for xxx in "const char *" "char *"; do
21244                         case "$netdb_name_type" in
21245                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21246                                 if ./protochk "$try" $hdrs; then
21247                                         echo "Your system accepts $xxx."
21248                                         netdb_name_type="$xxx"
21249                                 fi
21250                                 ;;
21251                         esac
21252                 done
21253                 : In case none of those worked, prompt the user.
21254                 case "$netdb_name_type" in
21255                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21256                         dflt='char *'
21257                         . ./myread
21258                         netdb_name_type=$ans
21259                         ;;
21260                 esac
21261                 ;;
21262         *)      : no gethostbyname, so pick harmless default
21263                 netdb_name_type='char *'
21264                 ;;
21265         esac
21266 fi
21267
21268 : check for type of 1st argument to getnetbyaddr.
21269 if test "X$netdb_net_type" = X ; then
21270         case "$d_getnbyaddr" in
21271         $define)
21272                 $cat <<EOM
21273
21274 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21275 EOM
21276                 hdrs="$define sys/types.h
21277                         $d_socket sys/socket.h
21278                         $i_niin netinet/in.h
21279                         $i_netdb netdb.h
21280                         $i_unistd unistd.h"
21281                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21282                         case "$netdb_net_type" in
21283                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21284                                 if ./protochk "$try" $hdrs; then
21285                                         echo "Your system accepts $xxx."
21286                                         netdb_net_type="$xxx"
21287                                 fi
21288                                 ;;
21289                         esac
21290                 done
21291                 : In case none of those worked, prompt the user.
21292                 case "$netdb_net_type" in
21293                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21294                         dflt='long'
21295                         . ./myread
21296                         netdb_net_type=$ans
21297                         ;;
21298                 esac
21299                 ;;
21300         *)      : no getnetbyaddr, so pick harmless default
21301                 netdb_net_type='long'
21302                 ;;
21303         esac
21304 fi
21305 : locate the preferred pager for this system
21306 fn=f/
21307 case "$pager" in
21308 '')
21309         dflt=''
21310         case "$pg" in
21311         /*) dflt=$pg;;
21312         [a-zA-Z]:/*) dflt=$pg;;
21313         esac
21314         case "$more" in
21315         /*) dflt=$more;;
21316         [a-zA-Z]:/*) dflt=$more;;
21317         esac
21318         case "$less" in
21319         /*) dflt=$less;;
21320         [a-zA-Z]:/*) dflt=$less;;
21321         esac
21322         case "$dflt" in
21323         '') dflt=/usr/ucb/more;;
21324         esac
21325         ;;
21326 *)      dflt="$pager"
21327         ;;
21328 esac
21329 fn="f/($dflt)"
21330 echo " "
21331 rp='What pager is used on your system?'
21332 . ./getfile
21333 pager="$ans"
21334
21335 : see what type pids are declared as in the kernel
21336 rp="What is the type of process ids on this system?"
21337 set pid_t pidtype int stdio.h sys/types.h
21338 eval $typedef_ask
21339
21340 : see if ar generates random libraries by itself
21341 echo " "
21342 echo "Checking how to generate random libraries on your machine..." >&4
21343 echo 'int bar1() { return bar2(); }' > bar1.c
21344 echo 'int bar2() { return 2; }' > bar2.c
21345 $cat > foo.c <<EOP
21346 #$i_stdlib I_STDLIB
21347 #ifdef I_STDLIB
21348 #include <stdlib.h>
21349 #endif
21350 int main() { printf("%d\n", bar1()); exit(0); }
21351 EOP
21352 $cc $ccflags -c bar1.c >/dev/null 2>&1
21353 $cc $ccflags -c bar2.c >/dev/null 2>&1
21354 $cc $ccflags -c foo.c >/dev/null 2>&1
21355 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21356 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21357         $run ./foobar >/dev/null 2>&1; then
21358         echo "$ar appears to generate random libraries itself."
21359         orderlib=false
21360         if [ "X$ranlib" = "X" ]; then
21361             ranlib=":"
21362         fi
21363 elif $ar s bar$_a >/dev/null 2>&1 &&
21364         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21365         $run ./foobar >/dev/null 2>&1; then
21366                 echo "a table of contents needs to be added with '$ar s'."
21367                 orderlib=false
21368                 ranlib="$ar s"
21369 elif $ar ts bar$_a >/dev/null 2>&1 &&
21370         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21371         $run ./foobar >/dev/null 2>&1; then
21372                 echo "a table of contents needs to be added with '$ar ts'."
21373                 orderlib=false
21374                 ranlib="$ar ts"
21375 else
21376         case "$ranlib" in
21377         :) ranlib='';;
21378         '')
21379                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21380                 $test -f $ranlib || ranlib=''
21381                 ;;
21382         esac
21383         if $test -n "$ranlib"; then
21384                 echo "your system has '$ranlib'; we'll use that."
21385                 orderlib=false
21386         else
21387                 echo "your system doesn't seem to support random libraries"
21388                 echo "so we'll use lorder and tsort to order the libraries."
21389                 orderlib=true
21390                 ranlib=":"
21391         fi
21392 fi
21393 $rm -f foo* bar*
21394
21395 : see if this is a values.h system
21396 set values.h i_values
21397 eval $inhdr
21398
21399 : Check the max offset that gmtime and localtime accept
21400 echo "Checking max offsets that gmtime () accepts"
21401
21402 case $i_values in
21403     define) yyy="#include <values.h>" ;;
21404     *)      yyy="" ;;
21405     esac
21406
21407 case "$sGMTIME_min/$sGMTIME_max" in
21408     0/0|/)
21409         $cat >try.c <<EOCP
21410 #include <sys/types.h>
21411 #include <stdio.h>
21412 #include <time.h>
21413 $yyy
21414
21415 int i;
21416 struct tm *tmp;
21417 time_t pt;
21418
21419 void gm_check (time_t t, int min_year, int max_year)
21420 {
21421     tmp = gmtime (&t);
21422     if ( tmp == NULL ||
21423         /* Check tm_year overflow */
21424          tmp->tm_year < min_year || tmp->tm_year > max_year)
21425         tmp = NULL;
21426     else
21427         pt = t;
21428     } /* gm_check */
21429
21430 int check_max ()
21431 {
21432     tmp = NULL;
21433     pt  = 0;
21434 #ifdef MAXLONG
21435     gm_check (MAXLONG, 69, 0x7fffffff);
21436 #endif
21437     if (tmp == NULL || tmp->tm_year < 0) {
21438         for (i = 63; i >= 0; i--) {
21439             time_t x = pt | ((time_t)1 << i);
21440             if (x < 0 || x < pt) continue;
21441             gm_check (x, 69, 0x7fffffff);
21442             }
21443         }
21444     printf ("sGMTIME_max=%ld\n", pt);
21445     return (0);
21446     } /* check_max */
21447
21448 int check_min ()
21449 {
21450     tmp = NULL;
21451     pt  = 0;
21452 #ifdef MINLONG
21453     gm_check (MINLONG, -1900, 70);
21454 #endif
21455     if (tmp == NULL) {
21456         for (i = 36; i >= 0; i--) {
21457             time_t x = pt - ((time_t)1 << i);
21458             if (x > 0) continue;
21459             gm_check (x, -1900, 70);
21460             }
21461         }
21462     printf ("sGMTIME_min=%ld\n", pt);
21463     return (0);
21464     } /* check_min */
21465
21466 int main (int argc, char *argv[])
21467 {
21468     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21469     check_max ();
21470     check_min ();
21471     return (0);
21472     } /* main */
21473 EOCP
21474         set try
21475         if eval $compile; then
21476             eval `$run ./try 2>/dev/null`
21477         else
21478             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21479             fi
21480         $rm_try
21481         ;;
21482     esac
21483
21484 echo "Checking max offsets that localtime () accepts"
21485
21486 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21487     0/0|/)
21488         $cat >try.c <<EOCP
21489 #include <sys/types.h>
21490 #include <stdio.h>
21491 #include <time.h>
21492 $yyy
21493
21494 int i;
21495 struct tm *tmp;
21496 time_t pt;
21497
21498 void local_check (time_t t, int min_year, int max_year)
21499 {
21500     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21501         tmp = NULL;
21502     else
21503         tmp = localtime (&t);
21504     if ( tmp == NULL ||
21505         /* Check tm_year overflow */
21506          tmp->tm_year < min_year || tmp->tm_year > max_year)
21507         tmp = NULL;
21508     else
21509         pt = t;
21510     } /* local_check */
21511
21512 int check_max ()
21513 {
21514     tmp = NULL;
21515     pt  = 0;
21516 #ifdef MAXLONG
21517     local_check (MAXLONG, 69, 0x7fffffff);
21518 #endif
21519     if (tmp == NULL || tmp->tm_year < 0) {
21520         for (i = 63; i >= 0; i--) {
21521             time_t x = pt | ((time_t)1 << i);
21522             if (x < 0 || x < pt) continue;
21523             local_check (x, 69, 0x7fffffff);
21524             }
21525         }
21526     printf ("sLOCALTIME_max=%ld\n", pt);
21527     return (0);
21528    } /* check_max */
21529
21530 int check_min ()
21531 {
21532     tmp = NULL;
21533     pt  = 0;
21534 #ifdef MINLONG
21535     local_check (MINLONG, -1900, 70);
21536 #endif
21537     if (tmp == NULL) {
21538         for (i = 36; i >= 0; i--) {
21539             time_t x = pt - ((time_t)1 << i);
21540             if (x > 0) continue;
21541             local_check (x, -1900, 70);
21542             }
21543         }
21544     printf ("sLOCALTIME_min=%ld\n", pt);
21545     return (0);
21546     } /* check_min */
21547
21548 int main (int argc, char *argv[])
21549 {
21550     check_max ();
21551     check_min ();
21552     return (0);
21553     } /* main */
21554 EOCP
21555         set try
21556         if eval $compile; then
21557             eval `$run ./try 2>/dev/null`
21558         else
21559             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21560             fi
21561         $rm_try
21562         ;;
21563     esac
21564
21565 : check for type of arguments to select.
21566 case "$selecttype" in
21567 '') case "$d_select" in
21568         $define)
21569                 echo " "
21570                 $cat <<EOM
21571 Checking to see what type of arguments are accepted by select().
21572 EOM
21573                 hdrs="$define sys/types.h
21574                         $i_systime sys/time.h
21575                         $i_sysselct sys/select.h
21576                         $d_socket sys/socket.h"
21577                 : The first arg can be int, unsigned, or size_t
21578                 : The last arg may or may not be 'const'
21579                 val=''
21580                 : void pointer has been seen but using that
21581                 : breaks the selectminbits test
21582                 for xxx in 'fd_set *' 'int *'; do
21583                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21584                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
21585                                         case "$val" in
21586                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21587                                                 if ./protochk "$try" $hdrs; then
21588                                                         echo "Your system accepts $xxx."
21589                                                         val="$xxx"
21590                                                 fi
21591                                                 ;;
21592                                         esac
21593                                 done
21594                         done
21595                 done
21596                 case "$val" in
21597                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21598                         case "$d_fd_set" in
21599                                 $define) dflt="fd_set *" ;;
21600                                 *)              dflt="int *" ;;
21601                         esac
21602                         . ./myread
21603                         val=$ans
21604                         ;;
21605                 esac
21606                 selecttype="$val"
21607                 ;;
21608         *)      : no select, so pick a harmless default
21609                 selecttype='int *'
21610                 ;;
21611         esac
21612         ;;
21613 esac
21614
21615 : check for the select 'width'
21616 case "$selectminbits" in
21617 '') safebits=`expr $ptrsize \* 8`
21618     case "$d_select" in
21619         $define)
21620                 $cat <<EOM
21621
21622 Checking to see on how many bits at a time your select() operates...
21623 EOM
21624                 $cat >try.c <<EOCP
21625 #include <sys/types.h>
21626 #$i_time I_TIME
21627 #$i_systime I_SYS_TIME
21628 #$i_systimek I_SYS_TIME_KERNEL
21629 #ifdef I_TIME
21630 #   include <time.h>
21631 #endif
21632 #ifdef I_SYS_TIME
21633 #   ifdef I_SYS_TIME_KERNEL
21634 #       define KERNEL
21635 #   endif
21636 #   include <sys/time.h>
21637 #   ifdef I_SYS_TIME_KERNEL
21638 #       undef KERNEL
21639 #   endif
21640 #endif
21641 #$i_sysselct I_SYS_SELECT
21642 #ifdef I_SYS_SELECT
21643 #include <sys/select.h>
21644 #endif
21645 #$d_socket HAS_SOCKET
21646 #ifdef HAS_SOCKET
21647 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21648 #endif
21649 #include <stdio.h>
21650 #$i_stdlib I_STDLIB
21651 #ifdef I_STDLIB
21652 #include <stdlib.h>
21653 #endif
21654 $selecttype b;
21655 #define S sizeof(*(b))
21656 #define MINBITS 64
21657 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21658 #define NBITS  (NBYTES * 8)
21659 int main() {
21660     char *s = (char *)malloc(NBYTES);
21661     struct timeval t;
21662     int i;
21663     FILE* fp;
21664     int fd;
21665
21666     if (!s)
21667         exit(1);
21668     fclose(stdin);
21669     fp = fopen("try.c", "r");
21670     if (fp == 0)
21671       exit(2);
21672     fd = fileno(fp);
21673     if (fd < 0)
21674       exit(3);
21675     b = ($selecttype)s;
21676     for (i = 0; i < NBITS; i++)
21677         FD_SET(i, b);
21678     t.tv_sec  = 0;
21679     t.tv_usec = 0;
21680     select(fd + 1, b, 0, 0, &t);
21681     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
21682     free(s);
21683     printf("%d\n", i + 1);
21684     return 0;
21685 }
21686 EOCP
21687                 set try
21688                 if eval $compile_ok; then
21689                         selectminbits=`$run ./try 2>/dev/null`
21690                         case "$selectminbits" in
21691                         '')     cat >&4 <<EOM
21692 Cannot figure out on how many bits at a time your select() operates.
21693 I'll play safe and guess it is $safebits bits.
21694 EOM
21695                                 selectminbits=$safebits
21696                                 bits="$safebits bits"
21697                                 ;;
21698                         1)      bits="1 bit" ;;
21699                         *)      bits="$selectminbits bits" ;;
21700                         esac
21701                         echo "Your select() operates on $bits at a time." >&4
21702                 else
21703                         rp='What is the minimum number of bits your select() operates on?'
21704                         case "$byteorder" in
21705                         12345678)       dflt=64 ;;
21706                         1234)           dflt=32 ;;
21707                         *)              dflt=1  ;;
21708                         esac
21709                         . ./myread
21710                         val=$ans
21711                         selectminbits="$val"
21712                 fi
21713                 $rm_try
21714                 ;;
21715         *)      : no select, so pick a harmless default
21716                 selectminbits=$safebits
21717                 ;;
21718         esac
21719         ;;
21720 esac
21721
21722 : Trace out the files included by signal.h, then look for SIGxxx names.
21723 if [ "X$fieldn" = X ]; then
21724         : Just make some guesses.  We check them later.
21725         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
21726 else
21727         xxx=`echo '#include <signal.h>' |
21728         $cppstdin $cppminus $cppflags 2>/dev/null |
21729         $grep '^[       ]*#.*include' |
21730         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
21731                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
21732 fi
21733 xxxfiles=''
21734 for xx in $xxx /dev/null ; do
21735         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
21736 done
21737 case "$xxxfiles" in
21738 '')     xxxfiles=`./findhdr signal.h` ;;
21739 esac
21740 xxx=`awk '
21741 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
21742         print substr($2, 4, 20)
21743 }
21744 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
21745         print substr($3, 4, 20)
21746 }' $xxxfiles`
21747 : Append some common names just in case the awk scan failed.
21748 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
21749 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
21750 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
21751 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
21752 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
21753
21754 : generate a few handy files for later
21755 $cat > signal.c <<EOCP
21756 #include <sys/types.h>
21757 #include <signal.h>
21758 #$i_stdlib I_STDLIB
21759 #ifdef I_STDLIB
21760 #include <stdlib.h>
21761 #endif
21762 #include <stdio.h>
21763 int main() {
21764
21765 /* Strange style to avoid deeply-nested #if/#else/#endif */
21766 #ifndef NSIG
21767 #  ifdef _NSIG
21768 #    define NSIG (_NSIG)
21769 #  endif
21770 #endif
21771
21772 #ifndef NSIG
21773 #  ifdef SIGMAX
21774 #    define NSIG (SIGMAX+1)
21775 #  endif
21776 #endif
21777
21778 #ifndef NSIG
21779 #  ifdef SIG_MAX
21780 #    define NSIG (SIG_MAX+1)
21781 #  endif
21782 #endif
21783
21784 #ifndef NSIG
21785 #  ifdef _SIG_MAX
21786 #    define NSIG (_SIG_MAX+1)
21787 #  endif
21788 #endif
21789
21790 #ifndef NSIG
21791 #  ifdef MAXSIG
21792 #    define NSIG (MAXSIG+1)
21793 #  endif
21794 #endif
21795
21796 #ifndef NSIG
21797 #  ifdef MAX_SIG
21798 #    define NSIG (MAX_SIG+1)
21799 #  endif
21800 #endif
21801
21802 #ifndef NSIG
21803 #  ifdef SIGARRAYSIZE
21804 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
21805 #  endif
21806 #endif
21807
21808 #ifndef NSIG
21809 #  ifdef _sys_nsig
21810 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
21811 #  endif
21812 #endif
21813
21814 /* Default to some arbitrary number that's big enough to get most
21815    of the common signals.
21816 */
21817 #ifndef NSIG
21818 #    define NSIG 50
21819 #endif
21820
21821 printf("NSIG %d\n", NSIG);
21822
21823 #ifndef JUST_NSIG
21824
21825 EOCP
21826
21827 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
21828 {
21829         printf "#ifdef SIG"; printf $1; printf "\n"
21830         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
21831         printf $1; printf ");\n"
21832         printf "#endif\n"
21833 }
21834 END {
21835         printf "#endif /* JUST_NSIG */\n";
21836         printf "exit(0);\n}\n";
21837 }
21838 ' >>signal.c
21839 $cat >signal.awk <<'EOP'
21840 BEGIN { ndups = 0 }
21841 $1 ~ /^NSIG$/ { nsig = $2 }
21842 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
21843     if ($2 > maxsig) { maxsig = $2 }
21844     if (sig_name[$2]) {
21845         dup_name[ndups] = $1
21846         dup_num[ndups] = $2
21847         ndups++
21848     }
21849     else {
21850         sig_name[$2] = $1
21851         sig_num[$2] = $2
21852     }
21853 }
21854 END {
21855     if (nsig == 0) {
21856         nsig = maxsig + 1
21857     }
21858     printf("NSIG %d\n", nsig);
21859     for (n = 1; n < nsig; n++) {
21860         if (sig_name[n]) {
21861             printf("%s %d\n", sig_name[n], sig_num[n])
21862         }
21863         else {
21864             printf("NUM%d %d\n", n, n)
21865         }
21866     }
21867     for (n = 0; n < ndups; n++) {
21868         printf("%s %d\n", dup_name[n], dup_num[n])
21869     }
21870 }
21871 EOP
21872 $cat >signal_cmd <<EOS
21873 $startsh
21874 if $test -s signal.lst; then
21875     echo "Using your existing signal.lst file"
21876         exit 0
21877 fi
21878 xxx="$xxx"
21879 EOS
21880 $cat >>signal_cmd <<'EOS'
21881
21882 set signal
21883 if eval $compile_ok; then
21884         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21885                 $uniq | $awk -f signal.awk >signal.lst
21886 else
21887         echo "(I can't seem be able to compile the whole test program)" >&4
21888         echo "(I'll try it in little pieces.)" >&4
21889         set signal -DJUST_NSIG
21890         if eval $compile_ok; then
21891                 $run ./signal$_exe > signal.nsg
21892                 $cat signal.nsg
21893         else
21894                 echo "I can't seem to figure out how many signals you have." >&4
21895                 echo "Guessing 50." >&4
21896                 echo 'NSIG 50' > signal.nsg
21897         fi
21898         : Now look at all the signal names, one at a time.
21899         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21900                 $cat > signal.c <<EOCP
21901 #include <sys/types.h>
21902 #include <signal.h>
21903 #include <stdio.h>
21904 int main() {
21905 printf("$xx %d\n", SIG${xx});
21906 return 0;
21907 }
21908 EOCP
21909                 set signal
21910                 if eval $compile; then
21911                         echo "SIG${xx} found."
21912                         $run ./signal$_exe  >> signal.ls1
21913                 else
21914                         echo "SIG${xx} NOT found."
21915                 fi
21916         done
21917         if $test -s signal.ls1; then
21918                 $cat signal.nsg signal.ls1 |
21919                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
21920         fi
21921
21922 fi
21923 if $test -s signal.lst; then
21924         :
21925 else
21926         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21927         echo 'kill -l' >signal
21928         set X `csh -f <signal`
21929         $rm -f signal
21930         shift
21931         case $# in
21932         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21933         esac
21934         echo $@ | $tr ' ' $trnl | \
21935             $awk '{ printf "%s %d\n", $1, ++s; }
21936                   END { printf "NSIG %d\n", ++s }' >signal.lst
21937 fi
21938 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21939 EOS
21940 chmod a+x signal_cmd
21941 $eunicefix signal_cmd
21942
21943 : generate list of signal names
21944 echo " "
21945 case "$sig_name_init" in
21946 '') doinit=yes ;;
21947 *)  case "$sig_num_init" in
21948     ''|*,*) doinit=yes ;;
21949     esac ;;
21950 esac
21951 case "$doinit" in
21952 yes)
21953         echo "Generating a list of signal names and numbers..." >&4
21954         . ./signal_cmd
21955         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21956         sig_name=`$awk 'BEGIN { printf "ZERO " }
21957                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21958         sig_num=`$awk  'BEGIN { printf "0 " }
21959                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21960         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
21961                              !/^NSIG/   { printf "\"%s\", ", $1 }
21962                              END        { printf "0\n" }' signal.lst`
21963         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21964                              !/^NSIG/   { printf "%d, ", $2}
21965                              END        { printf "0\n"}' signal.lst`
21966         ;;
21967 esac
21968 echo "The following $sig_count signals are available:"
21969 echo " "
21970 echo $sig_name | $awk \
21971 'BEGIN { linelen = 0 }
21972 {
21973         for (i = 1; i <= NF; i++) {
21974                 name = "SIG" $i " "
21975                 linelen = linelen + length(name)
21976                 if (linelen > 70) {
21977                         printf "\n"
21978                         linelen = length(name)
21979                 }
21980                 printf "%s", name
21981         }
21982         printf "\n"
21983 }'
21984 sig_size=`echo $sig_name | awk '{print NF}'`
21985 $rm -f signal signal.c signal.awk signal.lst signal_cmd
21986
21987 : Check size of size
21988 echo " "
21989 case "$sizetype" in
21990 *_t) zzz="$sizetype"    ;;
21991 *)   zzz="filesize"     ;;
21992 esac
21993 echo "Checking the size of $zzz..." >&4
21994 cat > try.c <<EOCP
21995 #include <sys/types.h>
21996 #include <stdio.h>
21997 #$i_stdlib I_STDLIB
21998 #ifdef I_STDLIB
21999 #include <stdlib.h>
22000 #endif
22001 int main() {
22002     printf("%d\n", (int)sizeof($sizetype));
22003     exit(0);
22004 }
22005 EOCP
22006 set try
22007 if eval $compile_ok; then
22008         yyy=`$run ./try`
22009         case "$yyy" in
22010         '')     sizesize=4
22011                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22012                 ;;
22013         *)      sizesize=$yyy
22014                 echo "Your $zzz size is $sizesize bytes."
22015                 ;;
22016         esac
22017 else
22018         sizesize=4
22019         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22020 fi
22021
22022
22023 : check for socklen_t
22024 echo " "
22025 echo "Checking to see if you have socklen_t..." >&4
22026 $cat >try.c <<EOCP
22027 #include <sys/types.h>
22028 #$d_socket HAS_SOCKET
22029 #ifdef HAS_SOCKET
22030 #include <sys/socket.h>
22031 #endif
22032 int main() { socklen_t x = 16; }
22033 EOCP
22034 set try
22035 if eval $compile; then
22036         val="$define"
22037         echo "You have socklen_t."
22038 else
22039         val="$undef"
22040         echo "You do not have socklen_t."
22041         case "$sizetype" in
22042         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22043         esac
22044 fi
22045 $rm_try
22046 set d_socklen_t
22047 eval $setvar
22048
22049 : see if this is a socks.h system
22050 set socks.h i_socks
22051 eval $inhdr
22052
22053 : check for type of the size argument to socket calls
22054 case "$d_socket" in
22055 "$define")
22056         $cat <<EOM
22057
22058 Checking to see what type is the last argument of accept().
22059 EOM
22060         yyy=''
22061         case "$d_socklen_t" in
22062         "$define") yyy="$yyy socklen_t"
22063         esac
22064         yyy="$yyy $sizetype int long unsigned"
22065         for xxx in $yyy; do
22066                 case "$socksizetype" in
22067                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22068                         case "$usesocks" in
22069                         "$define")
22070                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22071                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22072                                         socksizetype="$xxx"
22073                                 fi
22074                                 ;;
22075                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22076                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22077                                         socksizetype="$xxx"
22078                                 fi
22079                                 ;;
22080                         esac
22081                         ;;
22082                 esac
22083         done
22084 : In case none of those worked, prompt the user.
22085         case "$socksizetype" in
22086         '')     rp='What is the type for socket address structure sizes?'
22087                 dflt='int'
22088                 . ./myread
22089                 socksizetype=$ans
22090                 ;;
22091         esac
22092         ;;
22093 *)      : no sockets, so pick relatively harmless default
22094         socksizetype='int'
22095         ;;
22096 esac
22097
22098 : see what type is used for signed size_t
22099 set ssize_t ssizetype int stdio.h sys/types.h
22100 eval $typedef
22101 dflt="$ssizetype"
22102 $cat > try.c <<EOM
22103 #include <stdio.h>
22104 #$i_stdlib I_STDLIB
22105 #ifdef I_STDLIB
22106 #include <stdlib.h>
22107 #endif
22108 #include <sys/types.h>
22109 #define Size_t $sizetype
22110 #define SSize_t $dflt
22111 int main()
22112 {
22113         if (sizeof(Size_t) == sizeof(SSize_t))
22114                 printf("$dflt\n");
22115         else if (sizeof(Size_t) == sizeof(int))
22116                 printf("int\n");
22117         else
22118                 printf("long\n");
22119         exit(0);
22120 }
22121 EOM
22122 echo " "
22123 set try
22124 if eval $compile_ok && $run ./try > /dev/null; then
22125         ssizetype=`$run ./try`
22126         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22127 else
22128         $cat >&4 <<EOM
22129 Help! I can't compile and run the ssize_t test program: please enlighten me!
22130 (This is probably a misconfiguration in your system or libraries, and
22131 you really ought to fix it.  Still, I'll try anyway.)
22132
22133 I need a type that is the same size as $sizetype, but is guaranteed to
22134 be signed.  Common values are ssize_t, int and long.
22135
22136 EOM
22137         rp="What signed type is the same size as $sizetype?"
22138         . ./myread
22139         ssizetype="$ans"
22140 fi
22141 $rm_try
22142
22143 : Check the size of st_ino
22144 $echo " "
22145 $echo "Checking the size of st_ino..." >&4
22146 $cat > try.c <<EOCP
22147 #include <sys/stat.h>
22148 #include <stdio.h>
22149 #$i_stdlib I_STDLIB
22150 #ifdef I_STDLIB
22151 #include <stdlib.h>
22152 #endif
22153 int main() {
22154     struct stat st;
22155     printf("%d\n", (int)sizeof(st.st_ino));
22156     exit(0);
22157 }
22158 EOCP
22159 set try
22160 if eval $compile_ok; then
22161         val=`$run ./try`
22162         case "$val" in
22163         '')     st_ino_size=4
22164                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22165                 ;;
22166         *)      st_ino_size=$val
22167                 $echo "Your st_ino is $st_ino_size bytes long."
22168                 ;;
22169         esac
22170 else
22171         st_ino_size=4
22172         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22173 fi
22174 $rm_try
22175
22176 : Check if st_ino is signed
22177 $echo " "
22178 $echo "Checking the sign of st_ino..." >&4
22179 $cat > try.c <<EOCP
22180 #include <sys/stat.h>
22181 #include <stdio.h>
22182 int main() {
22183         struct stat foo;
22184         foo.st_ino = -1;
22185         if (foo.st_ino < 0)
22186                 printf("-1\n");
22187         else
22188                 printf("1\n");
22189 }
22190 EOCP
22191 set try
22192 if eval $compile; then
22193         val=`$run ./try`
22194         case "$val" in
22195         '')     st_ino_sign=1
22196                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22197                 ;;
22198         *)      st_ino_sign=$val
22199                 case "$st_ino_sign" in
22200                  1) $echo "Your st_ino is unsigned." ;;
22201                 -1) $echo "Your st_ino is signed."   ;;
22202                 esac
22203                 ;;
22204         esac
22205 else
22206         st_ino_sign=1
22207         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22208 fi
22209 $rm_try
22210
22211 : see what type of char stdio uses.
22212 echo " "
22213 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22214 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22215         echo "Your stdio uses unsigned chars." >&4
22216         stdchar="unsigned char"
22217 else
22218         echo "Your stdio uses signed chars." >&4
22219         stdchar="char"
22220 fi
22221 $rm -f stdioh
22222
22223 : see what type uids are declared as in the kernel
22224 echo " "
22225 echo "Looking for the type for user ids returned by getuid()."
22226 set uid_t uidtype xxx stdio.h sys/types.h
22227 eval $typedef
22228 case "$uidtype" in
22229 xxx)
22230         xxx=`./findhdr sys/user.h`
22231         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
22232         case $1 in
22233         unsigned) dflt="$1 $2" ;;
22234         *) dflt="$1" ;;
22235         esac
22236         ;;
22237 *) dflt="$uidtype";;
22238 esac
22239 case "$uidtype" in
22240 uid_t)  echo "uid_t found." ;;
22241 *)      rp="What is the type for user ids returned by getuid()?"
22242         . ./myread
22243         uidtype="$ans"
22244         ;;
22245 esac
22246
22247 : Check size of UID
22248 echo " "
22249 case "$uidtype" in
22250 *_t) zzz="$uidtype"     ;;
22251 *)   zzz="uid"          ;;
22252 esac
22253 echo "Checking the size of $zzz..." >&4
22254 cat > try.c <<EOCP
22255 #include <sys/types.h>
22256 #include <stdio.h>
22257 #$i_stdlib I_STDLIB
22258 #ifdef I_STDLIB
22259 #include <stdlib.h>
22260 #endif
22261 int main() {
22262     printf("%d\n", (int)sizeof($uidtype));
22263     exit(0);
22264 }
22265 EOCP
22266 set try
22267 if eval $compile_ok; then
22268         yyy=`$run ./try`
22269         case "$yyy" in
22270         '')     uidsize=4
22271                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22272                 ;;
22273         *)      uidsize=$yyy
22274                 echo "Your $zzz is $uidsize bytes long."
22275                 ;;
22276         esac
22277 else
22278         uidsize=4
22279         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22280 fi
22281
22282 : Check if UID is signed
22283 echo " "
22284 case "$uidtype" in
22285 *_t) zzz="$uidtype"     ;;
22286 *)   zzz="uid"          ;;
22287 esac
22288 echo "Checking the sign of $zzz..." >&4
22289 cat > try.c <<EOCP
22290 #include <sys/types.h>
22291 #include <stdio.h>
22292 int main() {
22293         $uidtype foo = -1;
22294         if (foo < 0)
22295                 printf("-1\n");
22296         else
22297                 printf("1\n");
22298 }
22299 EOCP
22300 set try
22301 if eval $compile; then
22302         yyy=`$run ./try`
22303         case "$yyy" in
22304         '')     uidsign=1
22305                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22306                 ;;
22307         *)      uidsign=$yyy
22308                 case "$uidsign" in
22309                  1) echo "Your $zzz is unsigned." ;;
22310                 -1) echo "Your $zzz is signed."   ;;
22311                 esac
22312                 ;;
22313         esac
22314 else
22315         uidsign=1
22316         echo "(I can't compile the test program--guessing unsigned.)" >&4
22317 fi
22318
22319
22320 : Check format string for UID
22321 echo " "
22322 $echo "Checking the format string to be used for uids..." >&4
22323
22324 case "$uidsign" in
22325 -1)     if $test X"$uidsize" = X"$ivsize"; then
22326                 uidformat="$ivdformat"
22327         else
22328                 if $test X"$uidsize" = X"$longsize"; then
22329                         uidformat='"ld"'
22330                 else
22331                         if $test X"$uidsize" = X"$intsize"; then
22332                                 uidformat='"d"'
22333                         else
22334                                 if $test X"$uidsize" = X"$shortsize"; then
22335                                         uidformat='"hd"'
22336                                 fi
22337                         fi
22338                 fi
22339         fi
22340         ;;
22341 *)      if $test X"$uidsize" = X"$uvsize"; then
22342                 uidformat="$uvuformat"
22343         else
22344                 if $test X"$uidsize" = X"$longsize"; then
22345                         uidformat='"lu"'
22346                 else
22347                         if $test X"$uidsize" = X"$intsize"; then
22348                                 uidformat='"u"'
22349                         else
22350                                 if $test X"$uidsize" = X"$shortsize"; then
22351                                         uidformat='"hu"'
22352                                 fi
22353                         fi
22354                 fi
22355         fi
22356         ;;
22357 esac
22358
22359 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22360 echo " "
22361 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22362 $cat >try.c <<'EOM'
22363 /* Intentionally a long probe as I'd like to sanity check that the exact
22364    approach is going to work, as thinking it will work, but only having it
22365    part working at runtime is worse than not having it.  */
22366
22367 #include <sys/types.h>
22368 #include <sys/sysctl.h>
22369 #include <sys/param.h>
22370 #include <stdio.h>
22371 #include <string.h>
22372 #include <stdlib.h>
22373 #include <unistd.h>
22374
22375 int
22376 main(int argc, char **argv) {
22377     char *buffer;
22378     char *argv_leaf = strrchr(argv[0], '/');
22379     char *buffer_leaf;
22380     size_t size = 0;
22381     int mib[4];
22382
22383     mib[0] = CTL_KERN;
22384     mib[1] = KERN_PROC;
22385     mib[2] = KERN_PROC_PATHNAME;
22386     mib[3] = -1;
22387
22388     if (!argv_leaf) {
22389         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22390         return 1;
22391     }
22392
22393     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22394         perror("sysctl");
22395         return 2;
22396     }
22397
22398     if (size < strlen(argv_leaf) + 1) {
22399         fprintf(stderr, "size %lu is too short for a path\n",
22400                 (unsigned long) size);
22401         return 3;
22402     }
22403
22404     if (size > MAXPATHLEN * MAXPATHLEN) {
22405         fprintf(stderr, "size %lu is too long for a path\n",
22406                 (unsigned long) size);
22407         return 4;
22408     }
22409
22410     buffer = malloc(size);
22411     if (!buffer) {
22412         perror("malloc");
22413         return 5;
22414     }
22415
22416     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22417         perror("sysctl");
22418         return 6;
22419     }
22420
22421     if (strlen(buffer) + 1 != size) {
22422         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22423                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22424         return 7;
22425     }
22426
22427
22428     if (*buffer != '/') {
22429         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22430         return 8;
22431     }
22432
22433     if (strstr(buffer, "/./")) {
22434         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22435         return 9;
22436     }
22437
22438     if (strstr(buffer, "/../")) {
22439         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22440         return 10;
22441     }
22442
22443     buffer_leaf = strrchr(buffer, '/');
22444     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22445         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22446         return 11;
22447     }
22448
22449     free(buffer);
22450
22451     return 0;
22452 }
22453 EOM
22454
22455 val=$undef
22456 set try
22457 if eval $compile; then
22458         if $run ./try; then
22459                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22460                 val="$define"
22461         else
22462                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22463                 val="$undef"
22464         fi
22465 else
22466         echo "I'm unable to compile the test program." >&4
22467         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22468         val="$undef"
22469 fi
22470 $rm_try
22471 set usekernprocpathname
22472 eval $setvar
22473
22474 : Determine if we can use _NSGetExecutablePath to find executing program
22475 echo " "
22476 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22477 $cat >try.c <<'EOM'
22478 /* Intentionally a long probe as I'd like to sanity check that the exact
22479    approach is going to work, as thinking it will work, but only having it
22480    part working at runtime is worse than not having it.  */
22481 #include <mach-o/dyld.h>
22482 #include <stdio.h>
22483 #include <stdlib.h>
22484 #include <sys/param.h>
22485 #include <string.h>
22486
22487 int
22488 main(int argc, char **argv) {
22489     char buf[1];
22490     uint32_t size = sizeof(buf);
22491     int result;
22492     char *buffer;
22493     char *tidied;
22494     char *argv_leaf = strrchr(argv[0], '/');
22495     char *tidied_leaf;
22496
22497     if (!argv_leaf) {
22498         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22499         return 1;
22500     }
22501
22502     _NSGetExecutablePath(buf, &size);
22503     if (size > MAXPATHLEN * MAXPATHLEN) {
22504         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22505                 (unsigned int) size);
22506         return 2;
22507     }
22508
22509     buffer = malloc(size);
22510     if (!buffer) {
22511         perror("malloc");
22512         return 3;
22513     }
22514
22515     result = _NSGetExecutablePath(buffer, &size);
22516     if (result != 0) {
22517         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22518                 result, (unsigned int) size);
22519         return 4;
22520     }
22521
22522     tidied = realpath(buffer, NULL);
22523     if (!tidied) {
22524         perror("realpath");
22525         return 5;
22526     }
22527
22528     free(buffer);
22529
22530     if (*tidied != '/') {
22531         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22532         return 6;
22533     }
22534
22535     if (strstr(tidied, "/./")) {
22536         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22537         return 7;
22538     }
22539
22540     if (strstr(tidied, "/../")) {
22541         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22542         return 8;
22543     }
22544
22545     tidied_leaf = strrchr(tidied, '/');
22546     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22547         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22548         return 9;
22549     }
22550
22551     free(tidied);
22552
22553     return 0;
22554 }
22555 EOM
22556
22557 val=$undef
22558 set try
22559 if eval $compile; then
22560         if $run ./try; then
22561                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22562                 val="$define"
22563         else
22564                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22565         fi
22566 else
22567         echo "I'm unable to compile the test program." >&4
22568         echo "I'll assume no _NSGetExecutablePath here." >&4
22569 fi
22570 $rm_try
22571 set usensgetexecutablepath
22572 eval $setvar
22573
22574 : Check if site customization support was requested
22575 case "$usesitecustomize" in
22576     $define|true|[Yy]*)
22577         usesitecustomize="$define"
22578         ;;
22579     *)
22580         usesitecustomize="$undef"
22581         ;;
22582     esac
22583
22584 : see if prototypes support variable argument declarations
22585 echo " "
22586 case "$prototype$i_stdarg" in
22587 $define$define)
22588         echo "It appears we'll be able to prototype varargs functions." >&4
22589         val="$define"
22590         ;;
22591 *)
22592         echo "Too bad... We won't be using prototyped varargs functions..." >&4
22593         val="$undef"
22594         ;;
22595 esac
22596 set vaproto
22597 eval $setvar
22598
22599 : determine compiler compiler
22600 case "$yacc" in
22601 '')
22602         dflt=yacc;;
22603 *)
22604         dflt="$yacc";;
22605 esac
22606 echo " "
22607 comp='yacc'
22608 if $test -f "$byacc$_exe"; then
22609         dflt="$byacc"
22610         comp="byacc or $comp"
22611 fi
22612 if $test -f "$bison$_exe"; then
22613         comp="$comp or bison -y"
22614 fi
22615 rp="Which compiler compiler ($comp) shall I use?"
22616 . ./myread
22617 yacc="$ans"
22618 case "$yacc" in
22619 *bis*)
22620         case "$yacc" in
22621         *-y*) ;;
22622         *)
22623                 yacc="$yacc -y"
22624                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22625                 ;;
22626         esac
22627         ;;
22628 esac
22629
22630 : see if this is a assert.h system
22631 set assert.h i_assert
22632 eval $inhdr
22633
22634 : see if this is a bfd.h system
22635 set bfd.h i_bfd
22636 eval $inhdr
22637
22638 : see if this is an execinfo.h system
22639 set execinfo.h i_execinfo
22640 eval $inhdr
22641
22642 : see if this is a fenv.h system
22643 set fenv.h i_fenv
22644 eval $inhdr
22645
22646 : see if this is a fp.h system
22647 set fp.h i_fp
22648 eval $inhdr
22649
22650 : see if this is a fp_class.h system
22651 set fp_class.h i_fp_class
22652 eval $inhdr
22653
22654 : see if gdbm.h is available
22655 set gdbm.h t_gdbm
22656 eval $inhdr
22657 case "$t_gdbm" in
22658 $define)
22659         : see if gdbm_open exists
22660         set gdbm_open d_gdbm_open
22661         eval $inlibc
22662         case "$d_gdbm_open" in
22663         $undef)
22664                 t_gdbm="$undef"
22665                 echo "We won't be including <gdbm.h>"
22666                 ;;
22667         esac
22668         ;;
22669 esac
22670 val="$t_gdbm"
22671 set i_gdbm
22672 eval $setvar
22673
22674 : see if this is a ieeefp.h system
22675 case "$i_ieeefp" in
22676 '' ) set ieeefp.h i_ieeefp
22677      eval $inhdr
22678      ;;
22679 esac
22680
22681 : see if this is a libutil.h system
22682 set libutil.h i_libutil
22683 eval $inhdr
22684
22685 : see if mach cthreads are available
22686 if test "X$usethreads" = "X$define"; then
22687         set mach/cthreads.h i_machcthr
22688         eval $inhdr
22689 else
22690         i_machcthr="$undef"
22691 fi
22692
22693 : see if this is a mntent.h system
22694 set mntent.h i_mntent
22695 eval $inhdr
22696
22697 : see if net/errno.h is available
22698 val=''
22699 set net/errno.h val
22700 eval $inhdr
22701
22702 : Unfortunately, it causes problems on some systems.  Arrgh.
22703 case "$val" in
22704 $define)
22705         cat > try.c <<'EOM'
22706 #include <stdio.h>
22707 #include <errno.h>
22708 #include <net/errno.h>
22709 int func()
22710 {
22711         return ENOTSOCK;
22712 }
22713 EOM
22714         if $cc $ccflags -c try.c >/dev/null 2>&1; then
22715                 echo "We'll be including <net/errno.h>." >&4
22716         else
22717                 echo "We won't be including <net/errno.h>." >&4
22718                 val="$undef"
22719         fi
22720         $rm_try
22721         ;;
22722 esac
22723 set i_neterrno
22724 eval $setvar
22725
22726 : see if netinet/tcp.h is available
22727 set netinet/tcp.h i_netinettcp
22728 eval $inhdr
22729
22730 : see if this is a poll.h system
22731 set poll.h i_poll
22732 eval $inhdr
22733
22734 : see if this is a prot.h system
22735 set prot.h i_prot
22736 eval $inhdr
22737
22738 : Preprocessor symbols
22739 echo " "
22740 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
22741 $cat <<'EOSH' > Cppsym.know
22742 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
22743 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
22744 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
22745 arch_pwr ardent ARM ARM32 atarist att386 att3b
22746 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
22747 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
22748 byteorder byte_order
22749 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
22750 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
22751 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
22752 ELF encore EPI EXTENSIONS
22753 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
22754 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
22755 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
22756 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
22757 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400 hp9000s500
22758 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
22759 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
22760 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
22761 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
22762 ksr1
22763 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
22764 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
22765 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
22766 luna88k Lynx
22767 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
22768 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
22769 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
22770 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
22771 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
22772 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
22773 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
22774 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
22775 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
22776 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
22777 ns32000 ns32016 ns32332 ns32k nsc32000
22778 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
22779 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
22780 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
22781 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
22782 QK_USER QNX
22783 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
22784 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
22785 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
22786 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
22787 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
22788 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
22789 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
22790 SYSV4 SYSV5 sysV68 sysV88
22791 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
22792 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
22793 tower32_800 tower32_850 tss
22794 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
22795 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
22796 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
22797 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
22798 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
22799 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
22800 uxpm uxps
22801 vax venix VMESA vms
22802 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
22803 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
22804 z8000 zarch
22805 EOSH
22806 # Maybe put other stuff here too.
22807 ./tr '-' '_' <<EOSH >>Cppsym.know
22808 $osname
22809 EOSH
22810 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
22811 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
22812 $cat Cppsym.know > Cppsym.c
22813 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
22814 $rm -f Cppsym.a Cppsym.b Cppsym.c
22815 cat <<EOSH > Cppsym
22816 $startsh
22817 if $test \$# -gt 0; then
22818     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
22819     if $test -s Cppsym.got; then
22820         $rm -f Cppsym.got
22821         exit 0
22822     fi
22823     $rm -f Cppsym.got
22824     exit 1
22825 else
22826     $tr " " "$trnl" | ./Cppsym.try
22827     exit 0
22828 fi
22829 EOSH
22830 chmod +x Cppsym
22831 $eunicefix Cppsym
22832 cat <<EOSH > Cppsym.try
22833 $startsh
22834 cat <<'EOCP' > try.c
22835 #include <stdio.h>
22836 #if cpp_stuff == 1
22837 #define STRINGIFY(a)    "a"
22838 #endif
22839 #if cpp_stuff == 42
22840 #define StGiFy(a)  #a
22841 #define STRINGIFY(a)    StGiFy(a)
22842 #endif
22843 #if $cpp_stuff != 1 && $cpp_stuff != 42
22844 #   include "Bletch: How does this C preprocessor stringify macros?"
22845 #endif
22846 int main() {
22847 EOCP
22848 $awk \\
22849 EOSH
22850 cat <<'EOSH' >> Cppsym.try
22851 'length($1) > 0 {
22852     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
22853     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
22854     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
22855     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
22856 }'       >> try.c
22857 echo 'return 0;}' >> try.c
22858 EOSH
22859 cat <<EOSH >> Cppsym.try
22860 ccflags="$ccflags"
22861 case "$osname-$gccversion" in
22862 irix-) ccflags="\$ccflags -woff 1178" ;;
22863 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
22864 esac
22865 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
22866 EOSH
22867 chmod +x Cppsym.try
22868 $eunicefix Cppsym.try
22869 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
22870 : Add in any Linux cpp "predefined macros":
22871 case "$osname::$gccversion" in
22872   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
22873     tHdrH=_tmpHdr
22874     rm -f $tHdrH'.h' $tHdrH
22875     touch $tHdrH'.h'
22876     # Filter out macro arguments, such as Linux's __INT8_C(c)
22877     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
22878        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
22879        if [ -s $tHdrH'_cppsym.real' ]; then
22880           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22881        fi
22882     fi
22883     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22884   ;;
22885 esac
22886 : now check the C compiler for additional symbols
22887 postprocess_cc_v=''
22888 case "$osname" in
22889 aix) postprocess_cc_v="|$tr , ' '" ;;
22890 esac
22891 $cat >ccsym <<EOS
22892 $startsh
22893 $cat >tmp.c <<EOF
22894 extern int foo;
22895 EOF
22896 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22897 do
22898         case "\$i" in
22899         -D*) echo "\$i" | $sed 's/^-D//';;
22900         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22901         esac
22902 done
22903 $rm_try
22904 EOS
22905 postprocess_cc_v=''
22906 chmod +x ccsym
22907 $eunicefix ccsym
22908 ./ccsym > ccsym1.raw
22909 if $test -s ccsym1.raw; then
22910     $sort ccsym1.raw | $uniq >ccsym.raw
22911 else
22912     mv ccsym1.raw ccsym.raw
22913 fi
22914
22915 $awk '/\=/ { print $0; next }
22916         { print $0"=1" }' ccsym.raw >ccsym.list
22917 $comm -13 Cppsym.true ccsym.list >ccsym.own
22918 $comm -12 Cppsym.true ccsym.list >ccsym.com
22919 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
22920 also=''
22921 if $test -z ccsym.raw; then
22922         echo "Your C compiler doesn't seem to define any symbols!" >&4
22923         echo " "
22924         echo "However, your C preprocessor defines the following symbols:"
22925         $cat Cppsym.true
22926         ccsymbols=''
22927         cppsymbols=`$cat Cppsym.true`
22928         cppsymbols=`echo $cppsymbols`
22929         cppccsymbols="$cppsymbols"
22930 else
22931         if $test -s ccsym.com; then
22932                 echo "Your C compiler and pre-processor define these symbols:"
22933                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22934                 also='also '
22935                 symbols='ones'
22936                 cppccsymbols=`$cat ccsym.com`
22937                 cppccsymbols=`echo $cppccsymbols`
22938                 $test "$silent" || sleep 1
22939         fi
22940         if $test -s ccsym.cpp; then
22941                 $test "$also" && echo " "
22942                 echo "Your C pre-processor ${also}defines the following symbols:"
22943                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22944                 also='further '
22945                 cppsymbols=`$cat ccsym.cpp`
22946                 cppsymbols=`echo $cppsymbols`
22947                 $test "$silent" || sleep 1
22948         fi
22949         if $test -s ccsym.own; then
22950                 $test "$also" && echo " "
22951                 echo "Your C compiler ${also}defines the following cpp symbols:"
22952                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22953                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22954                 ccsymbols=`$cat ccsym.own`
22955                 ccsymbols=`echo $ccsymbols`
22956                 $test "$silent" || sleep 1
22957         fi
22958 fi
22959
22960 : add -D_FORTIFY_SOURCE if feasible and not already there
22961 case "$gccversion" in
22962 4.*)    case "$optimize$ccflags" in
22963         *-O*)   case "$ccflags$cppsymbols" in
22964                 *_FORTIFY_SOURCE=*) # Don't add it again.
22965                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
22966                         ;;
22967                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
22968                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
22969                         ;;
22970                 esac
22971                 ;;
22972         *)      echo "You have gcc 4.* but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
22973                 ;;
22974         esac
22975         ;;
22976 *)      echo "You seem not to have gcc 4.*, not adding -D_FORTIFY_SOURCE." >&4
22977         ;;
22978 esac
22979
22980 : see if this is a termio system
22981 val="$undef"
22982 val2="$undef"
22983 val3="$undef"
22984 if $test `./findhdr termios.h`; then
22985     set tcsetattr i_termios
22986     eval $inlibc
22987     val3="$i_termios"
22988 fi
22989 echo " "
22990 case "$val3" in
22991     "$define") echo "You have POSIX termios.h... good!" >&4;;
22992     *)  if ./Cppsym pyr; then
22993             case "`$run /bin/universe`" in
22994                 ucb) if $test `./findhdr sgtty.h`; then
22995                         val2="$define"
22996                         echo "<sgtty.h> found." >&4
22997                     else
22998                         echo "System is pyramid with BSD universe."
22999                         ./warn "<sgtty.h> not found--you could have problems."
23000                     fi;;
23001                 *)  if $test `./findhdr termio.h`; then
23002                         val="$define"
23003                         echo "<termio.h> found." >&4
23004                     else
23005                         echo "System is pyramid with USG universe."
23006                         ./warn "<termio.h> not found--you could have problems."
23007                     fi;;
23008             esac
23009         elif ./usg; then
23010             if $test `./findhdr termio.h`; then
23011                 echo "<termio.h> found." >&4
23012                 val="$define"
23013             elif $test `./findhdr sgtty.h`; then
23014                 echo "<sgtty.h> found." >&4
23015                 val2="$define"
23016             else
23017                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23018             fi
23019         else
23020             if $test `./findhdr sgtty.h`; then
23021                 echo "<sgtty.h> found." >&4
23022                 val2="$define"
23023             elif $test `./findhdr termio.h`; then
23024                 echo "<termio.h> found." >&4
23025                 val="$define"
23026             else
23027                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23028             fi
23029         fi;;
23030 esac
23031 set i_termio; eval $setvar
23032 val=$val2; set i_sgtty; eval $setvar
23033 val=$val3; set i_termios; eval $setvar
23034
23035 : see if stdbool is available
23036 : we want a real compile instead of Inhdr because some Solaris systems
23037 : have stdbool.h, but it can only be used if the compiler indicates it
23038 : is sufficiently c99-compliant.
23039 echo " "
23040 $cat >try.c <<EOCP
23041 #include <stdio.h>
23042 #include <stdbool.h>
23043 int func(bool x)
23044 {
23045     return x ? 1 : 0;
23046 }
23047 int main(int argc, char **argv)
23048 {
23049     return func(0);
23050 }
23051 EOCP
23052 set try
23053 if eval $compile; then
23054         echo "<stdbool.h> found." >&4
23055         val="$define"
23056 else
23057         echo "<stdbool.h> NOT found." >&4
23058         val="$undef"
23059 fi
23060 $rm_try
23061 set i_stdbool
23062 eval $setvar
23063
23064 : see if stddef is available
23065 set stddef.h i_stddef
23066 eval $inhdr
23067
23068 : see if stdint is available
23069 set stdint.h i_stdint
23070 eval $inhdr
23071
23072 : see if sys/access.h is available
23073 set sys/access.h i_sysaccess
23074 eval $inhdr
23075
23076 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23077 set sys/filio.h i_sysfilio
23078 eval $inhdr
23079 echo " "
23080 if $test `./findhdr sys/ioctl.h`; then
23081         val="$define"
23082         echo '<sys/ioctl.h> found.' >&4
23083 else
23084         val="$undef"
23085         if $test $i_sysfilio = "$define"; then
23086             echo '<sys/ioctl.h> NOT found.' >&4
23087         else
23088                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23089                 $test $i_termio = "$define" && xxx="termio.h"
23090                 $test $i_termios = "$define" && xxx="termios.h"
23091 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23092         fi
23093 fi
23094 set i_sysioctl
23095 eval $setvar
23096
23097 : see if socket ioctl defs are in sys/sockio.h
23098 echo " "
23099 xxx=`./findhdr sys/sockio.h`
23100 if $test "$xxx"; then
23101         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23102                 val="$define"
23103                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23104         else
23105                 val="$undef"
23106                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23107         fi
23108 else
23109         val="$undef"
23110         $cat <<EOM
23111 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23112 EOM
23113 fi
23114 set i_syssockio
23115 eval $setvar
23116
23117 : see if this is a syslog.h system
23118 set syslog.h i_syslog
23119 eval $inhdr
23120
23121 : see if this is a sys/mode.h system
23122 set sys/mode.h i_sysmode
23123 eval $inhdr
23124
23125 : see if there is a sys/poll.h file
23126 set sys/poll.h i_syspoll
23127 eval $inhdr
23128
23129 : see if sys/resource.h has to be included
23130 set sys/resource.h i_sysresrc
23131 eval $inhdr
23132
23133 : see if sys/security.h is available
23134 set sys/security.h i_syssecrt
23135 eval $inhdr
23136
23137 : see if this is a sys/statvfs.h system
23138 set sys/statvfs.h i_sysstatvfs
23139 eval $inhdr
23140
23141 : see if this is a sys/un.h system
23142 set sys/un.h i_sysun
23143 eval $inhdr
23144
23145 : see if this is a sys/utsname.h system
23146 set sys/utsname.h i_sysutsname
23147 eval $inhdr
23148
23149 : see if this is a syswait system
23150 set sys/wait.h i_syswait
23151 eval $inhdr
23152
23153 : see if this is a ustat.h system
23154 set ustat.h i_ustat
23155 eval $inhdr
23156
23157 : see if this is an utime system
23158 set utime.h i_utime
23159 eval $inhdr
23160
23161 : see if this is a vfork system
23162 case "$d_vfork" in
23163 "$define")
23164         set vfork.h i_vfork
23165         eval $inhdr
23166         ;;
23167 *)
23168         i_vfork="$undef"
23169         ;;
23170 esac
23171
23172 : Check extensions
23173 echo " "
23174 echo "Looking for extensions..." >&4
23175 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23176 : contain old or inaccurate or duplicate values.
23177 nonxs_extensions=''
23178 xs_extensions=''
23179 : We do not use find because it might not be available.
23180 : We do not just use MANIFEST because the user may have dropped
23181 : some additional extensions into the source tree and expect them
23182 : to be built.
23183
23184 : Function to recursively find available extensions, ignoring DynaLoader
23185 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23186 : In 5.10.1 and later, extensions are stored in directories
23187 : like File-Glob instead of the older File/Glob/.
23188 find_extensions='
23189     for xxx in *; do
23190         case "$xxx" in
23191             DynaLoader|dynaload) ;;
23192             *)
23193             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
23194             case "$this_ext" in
23195                 Scalar/List/Utils) this_ext="List/Util" ;;
23196                 PathTools)         this_ext="Cwd"       ;;
23197             esac;
23198             echo " $xs_extensions $nonxs_extensions" > $tdir/$$.tmp;
23199             if $contains " $this_ext " $tdir/$$.tmp; then
23200                 echo >&4;
23201                 echo "Duplicate directories detected for extension $xxx" >&4;
23202                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23203                 case "$knowitall" in
23204                 "") dflt=y;;
23205                 *) dflt=n;;
23206                 esac;
23207                 . ../UU/myread;
23208                 case "$ans" in
23209                 n*|N*) ;;
23210                 *) echo >&4;
23211                     echo "Ok.  Stopping Configure." >&4;
23212                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23213                     exit 1;;
23214                 esac;
23215                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23216             fi;
23217             $ls -1 $xxx > $tdir/$$.tmp;
23218             if   $contains "\.xs$" $tdir/$$.tmp > /dev/null 2>&1; then
23219                 xs_extensions="$xs_extensions $this_ext";
23220             elif $contains "\.c$"  $tdir/$$.tmp > /dev/null 2>&1; then
23221                 xs_extensions="$xs_extensions $this_ext";
23222             elif $test -d $xxx; then
23223                 nonxs_extensions="$nonxs_extensions $this_ext";
23224             fi;
23225             $rm -f $tdir/$$.tmp;
23226             ;;
23227         esac;
23228     done'
23229 tdir=`pwd`
23230 cd "$rsrc/cpan"
23231 set X
23232 shift
23233 eval $find_extensions
23234 cd "$rsrc/dist"
23235 set X
23236 shift
23237 eval $find_extensions
23238 cd "$rsrc/ext"
23239 set X
23240 shift
23241 eval $find_extensions
23242 set X $xs_extensions
23243 shift
23244 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23245 set X $nonxs_extensions
23246 shift
23247 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23248 cd "$tdir"
23249 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23250
23251 : Now see which are supported on this system.
23252 avail_ext=''
23253 for xxx in $xs_extensions ; do
23254         case "$xxx" in
23255         DB_File|db_file)
23256                 case "$i_db" in
23257                 $define) avail_ext="$avail_ext $xxx" ;;
23258                 esac
23259                 ;;
23260         GDBM_File|gdbm_fil)
23261                 case "$i_gdbm" in
23262                 $define) avail_ext="$avail_ext $xxx" ;;
23263                 esac
23264                 ;;
23265         I18N/Langinfo|i18n_lan)
23266                 case "$i_langinfo$d_nl_langinfo" in
23267                 $define$define) avail_ext="$avail_ext $xxx" ;;
23268                 esac
23269                 ;;
23270         IPC/SysV|ipc/sysv)
23271                 : XXX Do we need a useipcsysv variable here
23272                 case "${d_msg}${d_sem}${d_shm}" in
23273                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23274                 esac
23275                 ;;
23276         NDBM_File|ndbm_fil)
23277                 case "$d_ndbm" in
23278                 $define)
23279                     case "$osname-$use64bitint" in
23280                     hpux-define)
23281                         case "$libs" in
23282                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23283                         esac
23284                         ;;
23285                     *) avail_ext="$avail_ext $xxx" ;;
23286                     esac
23287                     ;;
23288                 esac
23289                 ;;
23290         ODBM_File|odbm_fil)
23291                 case "${i_dbm}${i_rpcsvcdbm}" in
23292                 *"${define}"*)
23293                     case "$d_cplusplus" in
23294                     define) ;; # delete as a function name will not work
23295                     *)  case "$osname-$use64bitint" in
23296                         hpux-define)
23297                             case "$libs" in
23298                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23299                             esac
23300                             ;;
23301                         *) avail_ext="$avail_ext $xxx" ;;
23302                         esac
23303                         ;;
23304                     esac
23305                     ;;
23306                 esac
23307                 ;;
23308         Opcode|opcode)
23309                 case "$useopcode" in
23310                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23311                 esac
23312                 ;;
23313         POSIX|posix)
23314                 case "$useposix" in
23315                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23316                 esac
23317                 ;;
23318         Socket|socket)
23319                 case "$d_socket" in
23320                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23321                 esac
23322                 ;;
23323         Sys/Syslog|sys/syslog)
23324                 : XXX syslog requires socket
23325                 case "$d_socket" in
23326                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23327                 esac
23328                 ;;
23329         Thread|thread)
23330                 case "$usethreads" in
23331                 true|$define|y)
23332                         case "$use5005threads" in
23333                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23334                         esac
23335                 esac
23336                 ;;
23337         threads|threads/shared)
23338                 # threads and threads::shared are special cases.
23339                 # To stop people from asking "Perl 5.8.0 was supposed
23340                 # to have this new fancy threads implementation but my
23341                 # perl doesn't have it" and from people trying to
23342                 # (re)install the threads module using CPAN.pm and
23343                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23344                 # the threads.pm and threads/shared.pm will always be
23345                 # there, croaking informatively ("you need to rebuild
23346                 # all of Perl with threads, sorry") when threads haven't
23347                 # been compiled in.
23348                 # --jhi
23349                 avail_ext="$avail_ext $xxx"
23350                 ;;
23351         VMS*)
23352                 ;;
23353         Win32*)
23354                 case "$osname" in
23355                 cygwin) avail_ext="$avail_ext $xxx" ;;
23356                 esac
23357                 ;;
23358         XS/APItest|xs/apitest)
23359                 # This is just for testing.  Skip it unless we have dynamic loading.
23360
23361                 case "$usedl" in
23362                 $define) avail_ext="$avail_ext $xxx" ;;
23363                 esac
23364                 ;;
23365         XS/Typemap|xs/typemap)
23366                 # This is just for testing.  Skip it unless we have dynamic loading.
23367                 case "$usedl" in
23368                 $define) avail_ext="$avail_ext $xxx" ;;
23369                 esac
23370                 ;;
23371         *)      avail_ext="$avail_ext $xxx"
23372                 ;;
23373         esac
23374 done
23375
23376 set X $avail_ext
23377 shift
23378 avail_ext="$*"
23379
23380 case "$onlyextensions" in
23381 '') ;;
23382 *)  keepextensions=''
23383     echo "You have requested that only certain extensions be included..." >&4
23384     for i in $onlyextensions; do
23385         case " $avail_ext " in
23386         *" $i "*)
23387             echo "Keeping extension $i."
23388             keepextensions="$keepextensions $i"
23389             ;;
23390         *) echo "Ignoring extension $i." ;;
23391         esac
23392     done
23393     avail_ext="$keepextensions"
23394     ;;
23395 esac
23396
23397 case "$noextensions" in
23398 '') ;;
23399 *)  keepextensions=''
23400     echo "You have requested that certain extensions be ignored..." >&4
23401     for i in $avail_ext; do
23402         case " $noextensions " in
23403         *" $i "*) echo "Ignoring extension $i." ;;
23404         *) echo "Keeping extension $i.";
23405            keepextensions="$keepextensions $i"
23406            ;;
23407         esac
23408     done
23409     avail_ext="$keepextensions"
23410     ;;
23411 esac
23412
23413 : Now see which nonxs extensions are supported on this system.
23414 : For now assume all are.
23415 nonxs_ext=''
23416 for xxx in $nonxs_extensions ; do
23417         case "$xxx" in
23418         VMS*)
23419                 ;;
23420         *)      nonxs_ext="$nonxs_ext $xxx"
23421                 ;;
23422         esac
23423 done
23424
23425 set X $nonxs_ext
23426 shift
23427 nonxs_ext="$*"
23428
23429 case $usedl in
23430 $define)
23431         $cat <<EOM
23432 A number of extensions are supplied with $package.  You may choose to
23433 compile these extensions for dynamic loading (the default), compile
23434 them into the $package executable (static loading), or not include
23435 them at all.  Answer "none" to include no extensions.
23436 Note that DynaLoader is always built and need not be mentioned here.
23437
23438 EOM
23439         case "$dynamic_ext" in
23440         '')
23441                 : Exclude those listed in static_ext
23442                 dflt=''
23443                 for xxx in $avail_ext; do
23444                         case " $static_ext " in
23445                         *" $xxx "*) ;;
23446                         *) dflt="$dflt $xxx" ;;
23447                         esac
23448                 done
23449                 set X $dflt
23450                 shift
23451                 dflt="$*"
23452                 ;;
23453         *)      dflt="$dynamic_ext"
23454                 # Perhaps we are reusing an old out-of-date config.sh.
23455                 case "$hint" in
23456                 previous)
23457                         if test X"$dynamic_ext" != X"$avail_ext"; then
23458                                 $cat <<EOM
23459 NOTICE:  Your previous config.sh list may be incorrect.
23460 The extensions now available to you are
23461         ${avail_ext}
23462 but the default list from your previous config.sh is
23463         ${dynamic_ext}
23464
23465 EOM
23466                         fi
23467                         ;;
23468                 esac
23469                 ;;
23470         esac
23471         case "$dflt" in
23472         '')     dflt=none;;
23473         esac
23474         rp="What extensions do you wish to load dynamically?"
23475         . ./myread
23476         case "$ans" in
23477         none) dynamic_ext=' ' ;;
23478         *) dynamic_ext="$ans" ;;
23479         esac
23480
23481         case "$static_ext" in
23482         '')
23483                 : Exclude those already listed in dynamic linking
23484                 dflt=''
23485                 for xxx in $avail_ext; do
23486                         case " $dynamic_ext " in
23487                         *" $xxx "*) ;;
23488                         *) dflt="$dflt $xxx" ;;
23489                         esac
23490                 done
23491                 set X $dflt
23492                 shift
23493                 dflt="$*"
23494                 ;;
23495         *)  dflt="$static_ext"
23496                 ;;
23497         esac
23498
23499         case "$dflt" in
23500         '')     dflt=none;;
23501         esac
23502         rp="What extensions do you wish to load statically?"
23503         . ./myread
23504         case "$ans" in
23505         none) static_ext=' ' ;;
23506         *) static_ext="$ans" ;;
23507         esac
23508         ;;
23509 *)
23510         $cat <<EOM
23511 A number of extensions are supplied with $package.  Answer "none"
23512 to include no extensions.
23513 Note that DynaLoader is always built and need not be mentioned here.
23514
23515 EOM
23516         case "$static_ext" in
23517         '') dflt="$avail_ext" ;;
23518         *)      dflt="$static_ext"
23519                 # Perhaps we are reusing an old out-of-date config.sh.
23520                 case "$hint" in
23521                 previous)
23522                         if test X"$static_ext" != X"$avail_ext"; then
23523                                 $cat <<EOM
23524 NOTICE:  Your previous config.sh list may be incorrect.
23525 The extensions now available to you are
23526         ${avail_ext}
23527 but the default list from your previous config.sh is
23528         ${static_ext}
23529
23530 EOM
23531                         fi
23532                         ;;
23533                 esac
23534                 ;;
23535         esac
23536         : Exclude those that are not xs extensions
23537         case "$dflt" in
23538         '')     dflt=none;;
23539         esac
23540         rp="What extensions do you wish to include?"
23541         . ./myread
23542         case "$ans" in
23543         none) static_ext=' ' ;;
23544         *) static_ext="$ans" ;;
23545         esac
23546         ;;
23547 esac
23548 #
23549 # Encode is a special case.  If we are building Encode as a static
23550 # extension, we need to explicitly list its subextensions as well.
23551 # For other nested extensions, this is handled automatically by
23552 # the appropriate Makefile.PL.
23553 case " $static_ext " in
23554         *" Encode "*) # Add the subextensions of Encode
23555         cd "$rsrc/cpan"
23556         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23557                 static_ext="$static_ext Encode/$xxx"
23558                 known_extensions="$known_extensions Encode/$xxx"
23559         done
23560         cd "$tdir"
23561         ;;
23562 esac
23563
23564 set X $dynamic_ext $static_ext $nonxs_ext
23565 shift
23566 extensions="$*"
23567
23568 # Sanity check:  We require an extension suitable for use with
23569 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23570 # should show up as failures in the test suite, but it's helpful to
23571 # catch them now.) The 'extensions' list is normally sorted
23572 # alphabetically, so we need to accept either
23573 #    DB_File ... Fcntl ... IO  ....
23574 # or something like
23575 #    Fcntl ... NDBM_File ... IO  ....
23576 case " $extensions"  in
23577 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
23578 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23579 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23580 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23581    echo "WARNING: The Perl you are building will be quite crippled." >& 4
23582    ;;
23583 esac
23584
23585 : Remove libraries needed only for extensions
23586 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23587 : The exception is SunOS 4.x, which needs them.
23588 case "${osname}X${osvers}" in
23589 sunos*X4*)
23590     perllibs="$libs"
23591     ;;
23592 *) case "$usedl" in
23593     $define|true|[yY]*)
23594             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23595             shift
23596             perllibs="$*"
23597             ;;
23598     *)  perllibs="$libs"
23599             ;;
23600     esac
23601     ;;
23602 esac
23603
23604 : Remove build directory name from cppstdin so it can be used from
23605 : either the present location or the final installed location.
23606 echo " "
23607 : Get out of the UU directory to get correct path name.
23608 cd ..
23609 case "$cppstdin" in
23610 `pwd`/cppstdin)
23611         echo "Stripping down cppstdin path name"
23612         cppstdin=cppstdin
23613         ;;
23614 esac
23615 cd UU
23616
23617 : end of configuration questions
23618 echo " "
23619 echo "End of configuration questions."
23620 echo " "
23621
23622 : back to where it started
23623 if test -d ../UU; then
23624         cd ..
23625 fi
23626
23627 : configuration may be unconditionally patched via a 'config.arch' file
23628 if $test -f config.arch; then
23629         echo "I see a config.arch file, loading it." >&4
23630         . ./config.arch
23631 fi
23632
23633 : configuration may be patched via a 'config.over' file
23634 if $test -f config.over; then
23635         echo " "
23636         dflt=y
23637         rp='I see a config.over file.  Do you wish to load it?'
23638         . UU/myread
23639         case "$ans" in
23640         n*) echo "OK, I'll ignore it.";;
23641         *)      . ./config.over
23642                 echo "Configuration override changes have been loaded."
23643                 ;;
23644         esac
23645 fi
23646
23647 : in case they want portability, strip down executable paths
23648 case "$d_portable" in
23649 "$define")
23650         echo " "
23651         echo "Stripping down executable paths..." >&4
23652         for file in $loclist $trylist; do
23653                 eval temp=\$$file
23654                 eval $file=`basename $temp`
23655         done
23656         ;;
23657 esac
23658
23659 : create config.sh file
23660 echo " "
23661 echo "Creating config.sh..." >&4
23662 $spitshell <<EOT >config.sh
23663 $startsh
23664 #
23665 # This file was produced by running the Configure script. It holds all the
23666 # definitions figured out by Configure. Should you modify one of these values,
23667 # do not forget to propagate your changes by running "Configure -der". You may
23668 # instead choose to run each of the .SH files by yourself, or "Configure -S".
23669 #
23670
23671 # Package name      : $package
23672 # Source directory  : $src
23673 # Configuration time: $cf_time
23674 # Configured by     : $cf_by
23675 # Target system     : $myuname
23676
23677 EOT
23678 : Add in command line options if available
23679 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23680
23681 $spitshell <<EOT >>config.sh
23682
23683 Author='$Author'
23684 Date='$Date'
23685 Header='$Header'
23686 Id='$Id'
23687 Locker='$Locker'
23688 Log='$Log'
23689 RCSfile='$RCSfile'
23690 Revision='$Revision'
23691 Source='$Source'
23692 State='$State'
23693 _a='$_a'
23694 _exe='$_exe'
23695 _o='$_o'
23696 afs='$afs'
23697 afsroot='$afsroot'
23698 alignbytes='$alignbytes'
23699 ansi2knr='$ansi2knr'
23700 aphostname='$aphostname'
23701 api_revision='$api_revision'
23702 api_subversion='$api_subversion'
23703 api_version='$api_version'
23704 api_versionstring='$api_versionstring'
23705 ar='$ar'
23706 archlib='$archlib'
23707 archlibexp='$archlibexp'
23708 archname64='$archname64'
23709 archname='$archname'
23710 archobjs='$archobjs'
23711 asctime_r_proto='$asctime_r_proto'
23712 awk='$awk'
23713 baserev='$baserev'
23714 bash='$bash'
23715 bin='$bin'
23716 bin_ELF='$bin_ELF'
23717 binexp='$binexp'
23718 bison='$bison'
23719 byacc='$byacc'
23720 byteorder='$byteorder'
23721 c='$c'
23722 castflags='$castflags'
23723 cat='$cat'
23724 cc='$cc'
23725 cccdlflags='$cccdlflags'
23726 ccdlflags='$ccdlflags'
23727 ccflags='$ccflags'
23728 ccflags_uselargefiles='$ccflags_uselargefiles'
23729 ccname='$ccname'
23730 ccsymbols='$ccsymbols'
23731 ccversion='$ccversion'
23732 cf_by='$cf_by'
23733 cf_email='$cf_email'
23734 cf_time='$cf_time'
23735 charbits='$charbits'
23736 charsize='$charsize'
23737 chgrp='$chgrp'
23738 chmod='$chmod'
23739 chown='$chown'
23740 clocktype='$clocktype'
23741 comm='$comm'
23742 compress='$compress'
23743 contains='$contains'
23744 cp='$cp'
23745 cpio='$cpio'
23746 cpp='$cpp'
23747 cpp_stuff='$cpp_stuff'
23748 cppccsymbols='$cppccsymbols'
23749 cppflags='$cppflags'
23750 cpplast='$cpplast'
23751 cppminus='$cppminus'
23752 cpprun='$cpprun'
23753 cppstdin='$cppstdin'
23754 cppsymbols='$cppsymbols'
23755 crypt_r_proto='$crypt_r_proto'
23756 cryptlib='$cryptlib'
23757 csh='$csh'
23758 ctermid_r_proto='$ctermid_r_proto'
23759 ctime_r_proto='$ctime_r_proto'
23760 d_Gconvert='$d_Gconvert'
23761 d_PRIEUldbl='$d_PRIEUldbl'
23762 d_PRIFUldbl='$d_PRIFUldbl'
23763 d_PRIGUldbl='$d_PRIGUldbl'
23764 d_PRIXU64='$d_PRIXU64'
23765 d_PRId64='$d_PRId64'
23766 d_PRIeldbl='$d_PRIeldbl'
23767 d_PRIfldbl='$d_PRIfldbl'
23768 d_PRIgldbl='$d_PRIgldbl'
23769 d_PRIi64='$d_PRIi64'
23770 d_PRIo64='$d_PRIo64'
23771 d_PRIu64='$d_PRIu64'
23772 d_PRIx64='$d_PRIx64'
23773 d_SCNfldbl='$d_SCNfldbl'
23774 d__fwalk='$d__fwalk'
23775 d_access='$d_access'
23776 d_accessx='$d_accessx'
23777 d_acosh='$d_acosh'
23778 d_aintl='$d_aintl'
23779 d_alarm='$d_alarm'
23780 d_archlib='$d_archlib'
23781 d_asctime64='$d_asctime64'
23782 d_asctime_r='$d_asctime_r'
23783 d_asinh='$d_asinh'
23784 d_atanh='$d_atanh'
23785 d_atolf='$d_atolf'
23786 d_atoll='$d_atoll'
23787 d_attribute_deprecated='$d_attribute_deprecated'
23788 d_attribute_format='$d_attribute_format'
23789 d_attribute_malloc='$d_attribute_malloc'
23790 d_attribute_nonnull='$d_attribute_nonnull'
23791 d_attribute_noreturn='$d_attribute_noreturn'
23792 d_attribute_pure='$d_attribute_pure'
23793 d_attribute_unused='$d_attribute_unused'
23794 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
23795 d_backtrace='$d_backtrace'
23796 d_bcmp='$d_bcmp'
23797 d_bcopy='$d_bcopy'
23798 d_bsd='$d_bsd'
23799 d_bsdgetpgrp='$d_bsdgetpgrp'
23800 d_bsdsetpgrp='$d_bsdsetpgrp'
23801 d_builtin_choose_expr='$d_builtin_choose_expr'
23802 d_builtin_expect='$d_builtin_expect'
23803 d_bzero='$d_bzero'
23804 d_c99_variadic_macros='$d_c99_variadic_macros'
23805 d_casti32='$d_casti32'
23806 d_castneg='$d_castneg'
23807 d_cbrt='$d_cbrt'
23808 d_charvspr='$d_charvspr'
23809 d_chown='$d_chown'
23810 d_chroot='$d_chroot'
23811 d_chsize='$d_chsize'
23812 d_class='$d_class'
23813 d_clearenv='$d_clearenv'
23814 d_closedir='$d_closedir'
23815 d_cmsghdr_s='$d_cmsghdr_s'
23816 d_const='$d_const'
23817 d_copysign='$d_copysign'
23818 d_copysignl='$d_copysignl'
23819 d_cplusplus='$d_cplusplus'
23820 d_crypt='$d_crypt'
23821 d_crypt_r='$d_crypt_r'
23822 d_csh='$d_csh'
23823 d_ctermid='$d_ctermid'
23824 d_ctermid_r='$d_ctermid_r'
23825 d_ctime64='$d_ctime64'
23826 d_ctime_r='$d_ctime_r'
23827 d_cuserid='$d_cuserid'
23828 d_dbl_dig='$d_dbl_dig'
23829 d_dbminitproto='$d_dbminitproto'
23830 d_difftime64='$d_difftime64'
23831 d_difftime='$d_difftime'
23832 d_dir_dd_fd='$d_dir_dd_fd'
23833 d_dirfd='$d_dirfd'
23834 d_dirnamlen='$d_dirnamlen'
23835 d_dladdr='$d_dladdr'
23836 d_dlerror='$d_dlerror'
23837 d_dlopen='$d_dlopen'
23838 d_dlsymun='$d_dlsymun'
23839 d_dosuid='$d_dosuid'
23840 d_drand48_r='$d_drand48_r'
23841 d_drand48proto='$d_drand48proto'
23842 d_dup2='$d_dup2'
23843 d_eaccess='$d_eaccess'
23844 d_endgrent='$d_endgrent'
23845 d_endgrent_r='$d_endgrent_r'
23846 d_endhent='$d_endhent'
23847 d_endhostent_r='$d_endhostent_r'
23848 d_endnent='$d_endnent'
23849 d_endnetent_r='$d_endnetent_r'
23850 d_endpent='$d_endpent'
23851 d_endprotoent_r='$d_endprotoent_r'
23852 d_endpwent='$d_endpwent'
23853 d_endpwent_r='$d_endpwent_r'
23854 d_endsent='$d_endsent'
23855 d_endservent_r='$d_endservent_r'
23856 d_eofnblk='$d_eofnblk'
23857 d_erf='$d_erf'
23858 d_erfc='$d_erfc'
23859 d_eunice='$d_eunice'
23860 d_exp2='$d_exp2'
23861 d_expm1='$d_expm1'
23862 d_faststdio='$d_faststdio'
23863 d_fchdir='$d_fchdir'
23864 d_fchmod='$d_fchmod'
23865 d_fchown='$d_fchown'
23866 d_fcntl='$d_fcntl'
23867 d_fcntl_can_lock='$d_fcntl_can_lock'
23868 d_fd_macros='$d_fd_macros'
23869 d_fd_set='$d_fd_set'
23870 d_fdim='$d_fdim'
23871 d_fds_bits='$d_fds_bits'
23872 d_fegetround='$d_fegetround'
23873 d_fgetpos='$d_fgetpos'
23874 d_finite='$d_finite'
23875 d_finitel='$d_finitel'
23876 d_flexfnam='$d_flexfnam'
23877 d_flock='$d_flock'
23878 d_flockproto='$d_flockproto'
23879 d_fma='$d_fma'
23880 d_fmax='$d_fmax'
23881 d_fmin='$d_fmin'
23882 d_fork='$d_fork'
23883 d_fp_class='$d_fp_class'
23884 d_fp_classify='$d_fp_classify'
23885 d_fp_classl='$d_fp_classl'
23886 d_fpathconf='$d_fpathconf'
23887 d_fpclass='$d_fpclass'
23888 d_fpclassify='$d_fpclassify'
23889 d_fpclassl='$d_fpclassl'
23890 d_fpgetround='$d_fpgetround'
23891 d_fpos64_t='$d_fpos64_t'
23892 d_frexpl='$d_frexpl'
23893 d_fs_data_s='$d_fs_data_s'
23894 d_fseeko='$d_fseeko'
23895 d_fsetpos='$d_fsetpos'
23896 d_fstatfs='$d_fstatfs'
23897 d_fstatvfs='$d_fstatvfs'
23898 d_fsync='$d_fsync'
23899 d_ftello='$d_ftello'
23900 d_ftime='$d_ftime'
23901 d_futimes='$d_futimes'
23902 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23903 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
23904 d_getaddrinfo='$d_getaddrinfo'
23905 d_getcwd='$d_getcwd'
23906 d_getespwnam='$d_getespwnam'
23907 d_getfsstat='$d_getfsstat'
23908 d_getgrent='$d_getgrent'
23909 d_getgrent_r='$d_getgrent_r'
23910 d_getgrgid_r='$d_getgrgid_r'
23911 d_getgrnam_r='$d_getgrnam_r'
23912 d_getgrps='$d_getgrps'
23913 d_gethbyaddr='$d_gethbyaddr'
23914 d_gethbyname='$d_gethbyname'
23915 d_gethent='$d_gethent'
23916 d_gethname='$d_gethname'
23917 d_gethostbyaddr_r='$d_gethostbyaddr_r'
23918 d_gethostbyname_r='$d_gethostbyname_r'
23919 d_gethostent_r='$d_gethostent_r'
23920 d_gethostprotos='$d_gethostprotos'
23921 d_getitimer='$d_getitimer'
23922 d_getlogin='$d_getlogin'
23923 d_getlogin_r='$d_getlogin_r'
23924 d_getmnt='$d_getmnt'
23925 d_getmntent='$d_getmntent'
23926 d_getnameinfo='$d_getnameinfo'
23927 d_getnbyaddr='$d_getnbyaddr'
23928 d_getnbyname='$d_getnbyname'
23929 d_getnent='$d_getnent'
23930 d_getnetbyaddr_r='$d_getnetbyaddr_r'
23931 d_getnetbyname_r='$d_getnetbyname_r'
23932 d_getnetent_r='$d_getnetent_r'
23933 d_getnetprotos='$d_getnetprotos'
23934 d_getpagsz='$d_getpagsz'
23935 d_getpbyname='$d_getpbyname'
23936 d_getpbynumber='$d_getpbynumber'
23937 d_getpent='$d_getpent'
23938 d_getpgid='$d_getpgid'
23939 d_getpgrp2='$d_getpgrp2'
23940 d_getpgrp='$d_getpgrp'
23941 d_getppid='$d_getppid'
23942 d_getprior='$d_getprior'
23943 d_getprotobyname_r='$d_getprotobyname_r'
23944 d_getprotobynumber_r='$d_getprotobynumber_r'
23945 d_getprotoent_r='$d_getprotoent_r'
23946 d_getprotoprotos='$d_getprotoprotos'
23947 d_getprpwnam='$d_getprpwnam'
23948 d_getpwent='$d_getpwent'
23949 d_getpwent_r='$d_getpwent_r'
23950 d_getpwnam_r='$d_getpwnam_r'
23951 d_getpwuid_r='$d_getpwuid_r'
23952 d_getsbyname='$d_getsbyname'
23953 d_getsbyport='$d_getsbyport'
23954 d_getsent='$d_getsent'
23955 d_getservbyname_r='$d_getservbyname_r'
23956 d_getservbyport_r='$d_getservbyport_r'
23957 d_getservent_r='$d_getservent_r'
23958 d_getservprotos='$d_getservprotos'
23959 d_getspnam='$d_getspnam'
23960 d_getspnam_r='$d_getspnam_r'
23961 d_gettimeod='$d_gettimeod'
23962 d_gmtime64='$d_gmtime64'
23963 d_gmtime_r='$d_gmtime_r'
23964 d_gnulibc='$d_gnulibc'
23965 d_grpasswd='$d_grpasswd'
23966 d_hasmntopt='$d_hasmntopt'
23967 d_htonl='$d_htonl'
23968 d_hypot='$d_hypot'
23969 d_ilogb='$d_ilogb'
23970 d_ilogbl='$d_ilogbl'
23971 d_inc_version_list='$d_inc_version_list'
23972 d_index='$d_index'
23973 d_inetaton='$d_inetaton'
23974 d_inetntop='$d_inetntop'
23975 d_inetpton='$d_inetpton'
23976 d_int64_t='$d_int64_t'
23977 d_ip_mreq='$d_ip_mreq'
23978 d_ip_mreq_source='$d_ip_mreq_source'
23979 d_ipv6_mreq='$d_ipv6_mreq'
23980 d_ipv6_mreq_source='$d_ipv6_mreq_source'
23981 d_isascii='$d_isascii'
23982 d_isblank='$d_isblank'
23983 d_isfinite='$d_isfinite'
23984 d_isfinitel='$d_isfinitel'
23985 d_isinf='$d_isinf'
23986 d_isinfl='$d_isinfl'
23987 d_isless='$d_isless'
23988 d_isnan='$d_isnan'
23989 d_isnanl='$d_isnanl'
23990 d_isnormal='$d_isnormal'
23991 d_j0='$d_j0'
23992 d_j0l='$d_j0l'
23993 d_killpg='$d_killpg'
23994 d_lc_monetary_2008='$d_lc_monetary_2008'
23995 d_lchown='$d_lchown'
23996 d_ldbl_dig='$d_ldbl_dig'
23997 d_ldexpl='$d_ldexpl'
23998 d_lgamma='$d_lgamma'
23999 d_lgamma_r='$d_lgamma_r'
24000 d_libm_lib_version='$d_libm_lib_version'
24001 d_libname_unique='$d_libname_unique'
24002 d_link='$d_link'
24003 d_llrint='$d_llrint'
24004 d_llrintl='$d_llrintl'
24005 d_llround='$d_llround'
24006 d_llroundl='$d_llroundl'
24007 d_localtime64='$d_localtime64'
24008 d_localtime_r='$d_localtime_r'
24009 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24010 d_locconv='$d_locconv'
24011 d_lockf='$d_lockf'
24012 d_log1p='$d_log1p'
24013 d_log2='$d_log2'
24014 d_logb='$d_logb'
24015 d_longdbl='$d_longdbl'
24016 d_longlong='$d_longlong'
24017 d_lrint='$d_lrint'
24018 d_lrintl='$d_lrintl'
24019 d_lround='$d_lround'
24020 d_lroundl='$d_lroundl'
24021 d_lseekproto='$d_lseekproto'
24022 d_lstat='$d_lstat'
24023 d_madvise='$d_madvise'
24024 d_malloc_good_size='$d_malloc_good_size'
24025 d_malloc_size='$d_malloc_size'
24026 d_mblen='$d_mblen'
24027 d_mbstowcs='$d_mbstowcs'
24028 d_mbtowc='$d_mbtowc'
24029 d_memchr='$d_memchr'
24030 d_memcmp='$d_memcmp'
24031 d_memcpy='$d_memcpy'
24032 d_memmove='$d_memmove'
24033 d_memset='$d_memset'
24034 d_mkdir='$d_mkdir'
24035 d_mkdtemp='$d_mkdtemp'
24036 d_mkfifo='$d_mkfifo'
24037 d_mkstemp='$d_mkstemp'
24038 d_mkstemps='$d_mkstemps'
24039 d_mktime64='$d_mktime64'
24040 d_mktime='$d_mktime'
24041 d_mmap='$d_mmap'
24042 d_modfl='$d_modfl'
24043 d_modfl_pow32_bug='$d_modfl_pow32_bug'
24044 d_modflproto='$d_modflproto'
24045 d_mprotect='$d_mprotect'
24046 d_msg='$d_msg'
24047 d_msg_ctrunc='$d_msg_ctrunc'
24048 d_msg_dontroute='$d_msg_dontroute'
24049 d_msg_oob='$d_msg_oob'
24050 d_msg_peek='$d_msg_peek'
24051 d_msg_proxy='$d_msg_proxy'
24052 d_msgctl='$d_msgctl'
24053 d_msgget='$d_msgget'
24054 d_msghdr_s='$d_msghdr_s'
24055 d_msgrcv='$d_msgrcv'
24056 d_msgsnd='$d_msgsnd'
24057 d_msync='$d_msync'
24058 d_munmap='$d_munmap'
24059 d_mymalloc='$d_mymalloc'
24060 d_nan='$d_nan'
24061 d_ndbm='$d_ndbm'
24062 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24063 d_nearbyint='$d_nearbyint'
24064 d_nextafter='$d_nextafter'
24065 d_nexttoward='$d_nexttoward'
24066 d_nice='$d_nice'
24067 d_nl_langinfo='$d_nl_langinfo'
24068 d_nv_preserves_uv='$d_nv_preserves_uv'
24069 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24070 d_off64_t='$d_off64_t'
24071 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24072 d_oldpthreads='$d_oldpthreads'
24073 d_oldsock='$d_oldsock'
24074 d_open3='$d_open3'
24075 d_pathconf='$d_pathconf'
24076 d_pause='$d_pause'
24077 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24078 d_phostname='$d_phostname'
24079 d_pipe='$d_pipe'
24080 d_poll='$d_poll'
24081 d_portable='$d_portable'
24082 d_prctl='$d_prctl'
24083 d_prctl_set_name='$d_prctl_set_name'
24084 d_printf_format_null='$d_printf_format_null'
24085 d_procselfexe='$d_procselfexe'
24086 d_pseudofork='$d_pseudofork'
24087 d_pthread_atfork='$d_pthread_atfork'
24088 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24089 d_pthread_yield='$d_pthread_yield'
24090 d_ptrdiff_t='$d_ptrdiff_t'
24091 d_pwage='$d_pwage'
24092 d_pwchange='$d_pwchange'
24093 d_pwclass='$d_pwclass'
24094 d_pwcomment='$d_pwcomment'
24095 d_pwexpire='$d_pwexpire'
24096 d_pwgecos='$d_pwgecos'
24097 d_pwpasswd='$d_pwpasswd'
24098 d_pwquota='$d_pwquota'
24099 d_qgcvt='$d_qgcvt'
24100 d_quad='$d_quad'
24101 d_random_r='$d_random_r'
24102 d_re_comp='$d_re_comp'
24103 d_readdir64_r='$d_readdir64_r'
24104 d_readdir='$d_readdir'
24105 d_readdir_r='$d_readdir_r'
24106 d_readlink='$d_readlink'
24107 d_readv='$d_readv'
24108 d_recvmsg='$d_recvmsg'
24109 d_regcmp='$d_regcmp'
24110 d_regcomp='$d_regcomp'
24111 d_remainder='$d_remainder'
24112 d_remquo='$d_remquo'
24113 d_rename='$d_rename'
24114 d_rewinddir='$d_rewinddir'
24115 d_rint='$d_rint'
24116 d_rmdir='$d_rmdir'
24117 d_round='$d_round'
24118 d_safebcpy='$d_safebcpy'
24119 d_safemcpy='$d_safemcpy'
24120 d_sanemcmp='$d_sanemcmp'
24121 d_sbrkproto='$d_sbrkproto'
24122 d_scalbn='$d_scalbn'
24123 d_scalbnl='$d_scalbnl'
24124 d_sched_yield='$d_sched_yield'
24125 d_scm_rights='$d_scm_rights'
24126 d_seekdir='$d_seekdir'
24127 d_select='$d_select'
24128 d_sem='$d_sem'
24129 d_semctl='$d_semctl'
24130 d_semctl_semid_ds='$d_semctl_semid_ds'
24131 d_semctl_semun='$d_semctl_semun'
24132 d_semget='$d_semget'
24133 d_semop='$d_semop'
24134 d_sendmsg='$d_sendmsg'
24135 d_setegid='$d_setegid'
24136 d_seteuid='$d_seteuid'
24137 d_setgrent='$d_setgrent'
24138 d_setgrent_r='$d_setgrent_r'
24139 d_setgrps='$d_setgrps'
24140 d_sethent='$d_sethent'
24141 d_sethostent_r='$d_sethostent_r'
24142 d_setitimer='$d_setitimer'
24143 d_setlinebuf='$d_setlinebuf'
24144 d_setlocale='$d_setlocale'
24145 d_setlocale_r='$d_setlocale_r'
24146 d_setnent='$d_setnent'
24147 d_setnetent_r='$d_setnetent_r'
24148 d_setpent='$d_setpent'
24149 d_setpgid='$d_setpgid'
24150 d_setpgrp2='$d_setpgrp2'
24151 d_setpgrp='$d_setpgrp'
24152 d_setprior='$d_setprior'
24153 d_setproctitle='$d_setproctitle'
24154 d_setprotoent_r='$d_setprotoent_r'
24155 d_setpwent='$d_setpwent'
24156 d_setpwent_r='$d_setpwent_r'
24157 d_setregid='$d_setregid'
24158 d_setresgid='$d_setresgid'
24159 d_setresuid='$d_setresuid'
24160 d_setreuid='$d_setreuid'
24161 d_setrgid='$d_setrgid'
24162 d_setruid='$d_setruid'
24163 d_setsent='$d_setsent'
24164 d_setservent_r='$d_setservent_r'
24165 d_setsid='$d_setsid'
24166 d_setvbuf='$d_setvbuf'
24167 d_shm='$d_shm'
24168 d_shmat='$d_shmat'
24169 d_shmatprototype='$d_shmatprototype'
24170 d_shmctl='$d_shmctl'
24171 d_shmdt='$d_shmdt'
24172 d_shmget='$d_shmget'
24173 d_sigaction='$d_sigaction'
24174 d_signbit='$d_signbit'
24175 d_sigprocmask='$d_sigprocmask'
24176 d_sigsetjmp='$d_sigsetjmp'
24177 d_sin6_scope_id='$d_sin6_scope_id'
24178 d_sitearch='$d_sitearch'
24179 d_snprintf='$d_snprintf'
24180 d_sockaddr_in6='$d_sockaddr_in6'
24181 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24182 d_sockatmark='$d_sockatmark'
24183 d_sockatmarkproto='$d_sockatmarkproto'
24184 d_socket='$d_socket'
24185 d_socklen_t='$d_socklen_t'
24186 d_sockpair='$d_sockpair'
24187 d_socks5_init='$d_socks5_init'
24188 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
24189 d_sqrtl='$d_sqrtl'
24190 d_srand48_r='$d_srand48_r'
24191 d_srandom_r='$d_srandom_r'
24192 d_sresgproto='$d_sresgproto'
24193 d_sresuproto='$d_sresuproto'
24194 d_stat='$d_stat'
24195 d_statblks='$d_statblks'
24196 d_statfs_f_flags='$d_statfs_f_flags'
24197 d_statfs_s='$d_statfs_s'
24198 d_static_inline='$d_static_inline'
24199 d_statvfs='$d_statvfs'
24200 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24201 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24202 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24203 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24204 d_stdio_stream_array='$d_stdio_stream_array'
24205 d_stdiobase='$d_stdiobase'
24206 d_stdstdio='$d_stdstdio'
24207 d_strchr='$d_strchr'
24208 d_strcoll='$d_strcoll'
24209 d_strctcpy='$d_strctcpy'
24210 d_strerrm='$d_strerrm'
24211 d_strerror='$d_strerror'
24212 d_strerror_r='$d_strerror_r'
24213 d_strftime='$d_strftime'
24214 d_strlcat='$d_strlcat'
24215 d_strlcpy='$d_strlcpy'
24216 d_strtod='$d_strtod'
24217 d_strtol='$d_strtol'
24218 d_strtold='$d_strtold'
24219 d_strtoll='$d_strtoll'
24220 d_strtoq='$d_strtoq'
24221 d_strtoul='$d_strtoul'
24222 d_strtoull='$d_strtoull'
24223 d_strtouq='$d_strtouq'
24224 d_strxfrm='$d_strxfrm'
24225 d_suidsafe='$d_suidsafe'
24226 d_symlink='$d_symlink'
24227 d_syscall='$d_syscall'
24228 d_syscallproto='$d_syscallproto'
24229 d_sysconf='$d_sysconf'
24230 d_sysernlst='$d_sysernlst'
24231 d_syserrlst='$d_syserrlst'
24232 d_system='$d_system'
24233 d_tcgetpgrp='$d_tcgetpgrp'
24234 d_tcsetpgrp='$d_tcsetpgrp'
24235 d_telldir='$d_telldir'
24236 d_telldirproto='$d_telldirproto'
24237 d_tgamma='$d_tgamma'
24238 d_time='$d_time'
24239 d_timegm='$d_timegm'
24240 d_times='$d_times'
24241 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24242 d_tm_tm_zone='$d_tm_tm_zone'
24243 d_tmpnam_r='$d_tmpnam_r'
24244 d_trunc='$d_trunc'
24245 d_truncate='$d_truncate'
24246 d_truncl='$d_truncl'
24247 d_ttyname_r='$d_ttyname_r'
24248 d_tzname='$d_tzname'
24249 d_u32align='$d_u32align'
24250 d_ualarm='$d_ualarm'
24251 d_umask='$d_umask'
24252 d_uname='$d_uname'
24253 d_union_semun='$d_union_semun'
24254 d_unordered='$d_unordered'
24255 d_unsetenv='$d_unsetenv'
24256 d_usleep='$d_usleep'
24257 d_usleepproto='$d_usleepproto'
24258 d_ustat='$d_ustat'
24259 d_vendorarch='$d_vendorarch'
24260 d_vendorbin='$d_vendorbin'
24261 d_vendorlib='$d_vendorlib'
24262 d_vendorscript='$d_vendorscript'
24263 d_vfork='$d_vfork'
24264 d_void_closedir='$d_void_closedir'
24265 d_voidsig='$d_voidsig'
24266 d_voidtty='$d_voidtty'
24267 d_volatile='$d_volatile'
24268 d_vprintf='$d_vprintf'
24269 d_vsnprintf='$d_vsnprintf'
24270 d_wait4='$d_wait4'
24271 d_waitpid='$d_waitpid'
24272 d_wcscmp='$d_wcscmp'
24273 d_wcstombs='$d_wcstombs'
24274 d_wcsxfrm='$d_wcsxfrm'
24275 d_wctomb='$d_wctomb'
24276 d_writev='$d_writev'
24277 d_xenix='$d_xenix'
24278 date='$date'
24279 db_hashtype='$db_hashtype'
24280 db_prefixtype='$db_prefixtype'
24281 db_version_major='$db_version_major'
24282 db_version_minor='$db_version_minor'
24283 db_version_patch='$db_version_patch'
24284 direntrytype='$direntrytype'
24285 dlext='$dlext'
24286 dlsrc='$dlsrc'
24287 doublekind='$doublekind'
24288 doublesize='$doublesize'
24289 drand01='$drand01'
24290 drand48_r_proto='$drand48_r_proto'
24291 dtrace='$dtrace'
24292 dynamic_ext='$dynamic_ext'
24293 eagain='$eagain'
24294 ebcdic='$ebcdic'
24295 echo='$echo'
24296 egrep='$egrep'
24297 emacs='$emacs'
24298 endgrent_r_proto='$endgrent_r_proto'
24299 endhostent_r_proto='$endhostent_r_proto'
24300 endnetent_r_proto='$endnetent_r_proto'
24301 endprotoent_r_proto='$endprotoent_r_proto'
24302 endpwent_r_proto='$endpwent_r_proto'
24303 endservent_r_proto='$endservent_r_proto'
24304 eunicefix='$eunicefix'
24305 exe_ext='$exe_ext'
24306 expr='$expr'
24307 extensions='$extensions'
24308 extern_C='$extern_C'
24309 extras='$extras'
24310 fflushNULL='$fflushNULL'
24311 fflushall='$fflushall'
24312 find='$find'
24313 firstmakefile='$firstmakefile'
24314 flex='$flex'
24315 fpossize='$fpossize'
24316 fpostype='$fpostype'
24317 freetype='$freetype'
24318 from='$from'
24319 full_ar='$full_ar'
24320 full_csh='$full_csh'
24321 full_sed='$full_sed'
24322 gccansipedantic='$gccansipedantic'
24323 gccosandvers='$gccosandvers'
24324 gccversion='$gccversion'
24325 getgrent_r_proto='$getgrent_r_proto'
24326 getgrgid_r_proto='$getgrgid_r_proto'
24327 getgrnam_r_proto='$getgrnam_r_proto'
24328 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24329 gethostbyname_r_proto='$gethostbyname_r_proto'
24330 gethostent_r_proto='$gethostent_r_proto'
24331 getlogin_r_proto='$getlogin_r_proto'
24332 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24333 getnetbyname_r_proto='$getnetbyname_r_proto'
24334 getnetent_r_proto='$getnetent_r_proto'
24335 getprotobyname_r_proto='$getprotobyname_r_proto'
24336 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24337 getprotoent_r_proto='$getprotoent_r_proto'
24338 getpwent_r_proto='$getpwent_r_proto'
24339 getpwnam_r_proto='$getpwnam_r_proto'
24340 getpwuid_r_proto='$getpwuid_r_proto'
24341 getservbyname_r_proto='$getservbyname_r_proto'
24342 getservbyport_r_proto='$getservbyport_r_proto'
24343 getservent_r_proto='$getservent_r_proto'
24344 getspnam_r_proto='$getspnam_r_proto'
24345 gidformat='$gidformat'
24346 gidsign='$gidsign'
24347 gidsize='$gidsize'
24348 gidtype='$gidtype'
24349 glibpth='$glibpth'
24350 gmake='$gmake'
24351 gmtime_r_proto='$gmtime_r_proto'
24352 gnulibc_version='$gnulibc_version'
24353 grep='$grep'
24354 groupcat='$groupcat'
24355 groupstype='$groupstype'
24356 gzip='$gzip'
24357 h_fcntl='$h_fcntl'
24358 h_sysfile='$h_sysfile'
24359 hint='$hint'
24360 hostcat='$hostcat'
24361 hostgenerate='$hostgenerate'
24362 hostosname='$hostosname'
24363 hostperl='$hostperl'
24364 html1dir='$html1dir'
24365 html1direxp='$html1direxp'
24366 html3dir='$html3dir'
24367 html3direxp='$html3direxp'
24368 i16size='$i16size'
24369 i16type='$i16type'
24370 i32size='$i32size'
24371 i32type='$i32type'
24372 i64size='$i64size'
24373 i64type='$i64type'
24374 i8size='$i8size'
24375 i8type='$i8type'
24376 i_arpainet='$i_arpainet'
24377 i_assert='$i_assert'
24378 i_bfd='$i_bfd'
24379 i_bsdioctl='$i_bsdioctl'
24380 i_crypt='$i_crypt'
24381 i_db='$i_db'
24382 i_dbm='$i_dbm'
24383 i_dirent='$i_dirent'
24384 i_dlfcn='$i_dlfcn'
24385 i_execinfo='$i_execinfo'
24386 i_fcntl='$i_fcntl'
24387 i_fenv='$i_fenv'
24388 i_float='$i_float'
24389 i_fp='$i_fp'
24390 i_fp_class='$i_fp_class'
24391 i_gdbm='$i_gdbm'
24392 i_gdbm_ndbm='$i_gdbm_ndbm'
24393 i_gdbmndbm='$i_gdbmndbm'
24394 i_grp='$i_grp'
24395 i_ieeefp='$i_ieeefp'
24396 i_inttypes='$i_inttypes'
24397 i_langinfo='$i_langinfo'
24398 i_libutil='$i_libutil'
24399 i_limits='$i_limits'
24400 i_locale='$i_locale'
24401 i_machcthr='$i_machcthr'
24402 i_malloc='$i_malloc'
24403 i_mallocmalloc='$i_mallocmalloc'
24404 i_math='$i_math'
24405 i_memory='$i_memory'
24406 i_mntent='$i_mntent'
24407 i_ndbm='$i_ndbm'
24408 i_netdb='$i_netdb'
24409 i_neterrno='$i_neterrno'
24410 i_netinettcp='$i_netinettcp'
24411 i_niin='$i_niin'
24412 i_poll='$i_poll'
24413 i_prot='$i_prot'
24414 i_pthread='$i_pthread'
24415 i_pwd='$i_pwd'
24416 i_quadmath='$i_quadmath'
24417 i_rpcsvcdbm='$i_rpcsvcdbm'
24418 i_sgtty='$i_sgtty'
24419 i_shadow='$i_shadow'
24420 i_socks='$i_socks'
24421 i_stdarg='$i_stdarg'
24422 i_stdbool='$i_stdbool'
24423 i_stddef='$i_stddef'
24424 i_stdint='$i_stdint'
24425 i_stdlib='$i_stdlib'
24426 i_string='$i_string'
24427 i_sunmath='$i_sunmath'
24428 i_sysaccess='$i_sysaccess'
24429 i_sysdir='$i_sysdir'
24430 i_sysfile='$i_sysfile'
24431 i_sysfilio='$i_sysfilio'
24432 i_sysin='$i_sysin'
24433 i_sysioctl='$i_sysioctl'
24434 i_syslog='$i_syslog'
24435 i_sysmman='$i_sysmman'
24436 i_sysmode='$i_sysmode'
24437 i_sysmount='$i_sysmount'
24438 i_sysndir='$i_sysndir'
24439 i_sysparam='$i_sysparam'
24440 i_syspoll='$i_syspoll'
24441 i_sysresrc='$i_sysresrc'
24442 i_syssecrt='$i_syssecrt'
24443 i_sysselct='$i_sysselct'
24444 i_syssockio='$i_syssockio'
24445 i_sysstat='$i_sysstat'
24446 i_sysstatfs='$i_sysstatfs'
24447 i_sysstatvfs='$i_sysstatvfs'
24448 i_systime='$i_systime'
24449 i_systimek='$i_systimek'
24450 i_systimes='$i_systimes'
24451 i_systypes='$i_systypes'
24452 i_sysuio='$i_sysuio'
24453 i_sysun='$i_sysun'
24454 i_sysutsname='$i_sysutsname'
24455 i_sysvfs='$i_sysvfs'
24456 i_syswait='$i_syswait'
24457 i_termio='$i_termio'
24458 i_termios='$i_termios'
24459 i_time='$i_time'
24460 i_unistd='$i_unistd'
24461 i_ustat='$i_ustat'
24462 i_utime='$i_utime'
24463 i_values='$i_values'
24464 i_varargs='$i_varargs'
24465 i_varhdr='$i_varhdr'
24466 i_vfork='$i_vfork'
24467 ignore_versioned_solibs='$ignore_versioned_solibs'
24468 inc_version_list='$inc_version_list'
24469 inc_version_list_init='$inc_version_list_init'
24470 incpath='$incpath'
24471 incpth='$incpth'
24472 inews='$inews'
24473 initialinstalllocation='$initialinstalllocation'
24474 installarchlib='$installarchlib'
24475 installbin='$installbin'
24476 installhtml1dir='$installhtml1dir'
24477 installhtml3dir='$installhtml3dir'
24478 installman1dir='$installman1dir'
24479 installman3dir='$installman3dir'
24480 installprefix='$installprefix'
24481 installprefixexp='$installprefixexp'
24482 installprivlib='$installprivlib'
24483 installscript='$installscript'
24484 installsitearch='$installsitearch'
24485 installsitebin='$installsitebin'
24486 installsitehtml1dir='$installsitehtml1dir'
24487 installsitehtml3dir='$installsitehtml3dir'
24488 installsitelib='$installsitelib'
24489 installsiteman1dir='$installsiteman1dir'
24490 installsiteman3dir='$installsiteman3dir'
24491 installsitescript='$installsitescript'
24492 installstyle='$installstyle'
24493 installusrbinperl='$installusrbinperl'
24494 installvendorarch='$installvendorarch'
24495 installvendorbin='$installvendorbin'
24496 installvendorhtml1dir='$installvendorhtml1dir'
24497 installvendorhtml3dir='$installvendorhtml3dir'
24498 installvendorlib='$installvendorlib'
24499 installvendorman1dir='$installvendorman1dir'
24500 installvendorman3dir='$installvendorman3dir'
24501 installvendorscript='$installvendorscript'
24502 intsize='$intsize'
24503 issymlink='$issymlink'
24504 ivdformat='$ivdformat'
24505 ivsize='$ivsize'
24506 ivtype='$ivtype'
24507 known_extensions='$known_extensions'
24508 ksh='$ksh'
24509 ld='$ld'
24510 ld_can_script='$ld_can_script'
24511 lddlflags='$lddlflags'
24512 ldflags='$ldflags'
24513 ldflags_uselargefiles='$ldflags_uselargefiles'
24514 ldlibpthname='$ldlibpthname'
24515 less='$less'
24516 lib_ext='$lib_ext'
24517 libc='$libc'
24518 libperl='$libperl'
24519 libpth='$libpth'
24520 libs='$libs'
24521 libsdirs='$libsdirs'
24522 libsfiles='$libsfiles'
24523 libsfound='$libsfound'
24524 libspath='$libspath'
24525 libswanted='$libswanted'
24526 libswanted_uselargefiles='$libswanted_uselargefiles'
24527 line='$line'
24528 lint='$lint'
24529 lkflags='$lkflags'
24530 ln='$ln'
24531 lns='$lns'
24532 localtime_r_proto='$localtime_r_proto'
24533 locincpth='$locincpth'
24534 loclibpth='$loclibpth'
24535 longdblkind='$longdblkind'
24536 longdblsize='$longdblsize'
24537 longlongsize='$longlongsize'
24538 longsize='$longsize'
24539 lp='$lp'
24540 lpr='$lpr'
24541 ls='$ls'
24542 lseeksize='$lseeksize'
24543 lseektype='$lseektype'
24544 mail='$mail'
24545 mailx='$mailx'
24546 make='$make'
24547 make_set_make='$make_set_make'
24548 mallocobj='$mallocobj'
24549 mallocsrc='$mallocsrc'
24550 malloctype='$malloctype'
24551 man1dir='$man1dir'
24552 man1direxp='$man1direxp'
24553 man1ext='$man1ext'
24554 man3dir='$man3dir'
24555 man3direxp='$man3direxp'
24556 man3ext='$man3ext'
24557 mips_type='$mips_type'
24558 mistrustnm='$mistrustnm'
24559 mkdir='$mkdir'
24560 mmaptype='$mmaptype'
24561 modetype='$modetype'
24562 more='$more'
24563 multiarch='$multiarch'
24564 mv='$mv'
24565 myarchname='$myarchname'
24566 mydomain='$mydomain'
24567 myhostname='$myhostname'
24568 myuname='$myuname'
24569 n='$n'
24570 need_va_copy='$need_va_copy'
24571 netdb_hlen_type='$netdb_hlen_type'
24572 netdb_host_type='$netdb_host_type'
24573 netdb_name_type='$netdb_name_type'
24574 netdb_net_type='$netdb_net_type'
24575 nm='$nm'
24576 nm_opt='$nm_opt'
24577 nm_so_opt='$nm_so_opt'
24578 nonxs_ext='$nonxs_ext'
24579 nroff='$nroff'
24580 nvEUformat='$nvEUformat'
24581 nvFUformat='$nvFUformat'
24582 nvGUformat='$nvGUformat'
24583 nv_overflows_integers_at='$nv_overflows_integers_at'
24584 nv_preserves_uv_bits='$nv_preserves_uv_bits'
24585 nveformat='$nveformat'
24586 nvfformat='$nvfformat'
24587 nvgformat='$nvgformat'
24588 nvsize='$nvsize'
24589 nvtype='$nvtype'
24590 o_nonblock='$o_nonblock'
24591 obj_ext='$obj_ext'
24592 old_pthread_create_joinable='$old_pthread_create_joinable'
24593 optimize='$optimize'
24594 orderlib='$orderlib'
24595 osname='$osname'
24596 osvers='$osvers'
24597 otherlibdirs='$otherlibdirs'
24598 package='$package'
24599 pager='$pager'
24600 passcat='$passcat'
24601 patchlevel='$patchlevel'
24602 path_sep='$path_sep'
24603 perl5='$perl5'
24604 perl='$perl'
24605 perl_patchlevel='$perl_patchlevel'
24606 perl_static_inline='$perl_static_inline'
24607 perladmin='$perladmin'
24608 perllibs='$perllibs'
24609 perlpath='$perlpath'
24610 pg='$pg'
24611 phostname='$phostname'
24612 pidtype='$pidtype'
24613 plibpth='$plibpth'
24614 pmake='$pmake'
24615 pr='$pr'
24616 prefix='$prefix'
24617 prefixexp='$prefixexp'
24618 privlib='$privlib'
24619 privlibexp='$privlibexp'
24620 procselfexe='$procselfexe'
24621 prototype='$prototype'
24622 ptrsize='$ptrsize'
24623 quadkind='$quadkind'
24624 quadtype='$quadtype'
24625 randbits='$randbits'
24626 randfunc='$randfunc'
24627 random_r_proto='$random_r_proto'
24628 randseedtype='$randseedtype'
24629 ranlib='$ranlib'
24630 rd_nodata='$rd_nodata'
24631 readdir64_r_proto='$readdir64_r_proto'
24632 readdir_r_proto='$readdir_r_proto'
24633 revision='$revision'
24634 rm='$rm'
24635 rm_try='$rm_try'
24636 rmail='$rmail'
24637 run='$run'
24638 runnm='$runnm'
24639 sGMTIME_max='$sGMTIME_max'
24640 sGMTIME_min='$sGMTIME_min'
24641 sLOCALTIME_max='$sLOCALTIME_max'
24642 sLOCALTIME_min='$sLOCALTIME_min'
24643 sPRIEUldbl='$sPRIEUldbl'
24644 sPRIFUldbl='$sPRIFUldbl'
24645 sPRIGUldbl='$sPRIGUldbl'
24646 sPRIXU64='$sPRIXU64'
24647 sPRId64='$sPRId64'
24648 sPRIeldbl='$sPRIeldbl'
24649 sPRIfldbl='$sPRIfldbl'
24650 sPRIgldbl='$sPRIgldbl'
24651 sPRIi64='$sPRIi64'
24652 sPRIo64='$sPRIo64'
24653 sPRIu64='$sPRIu64'
24654 sPRIx64='$sPRIx64'
24655 sSCNfldbl='$sSCNfldbl'
24656 sched_yield='$sched_yield'
24657 scriptdir='$scriptdir'
24658 scriptdirexp='$scriptdirexp'
24659 sed='$sed'
24660 seedfunc='$seedfunc'
24661 selectminbits='$selectminbits'
24662 selecttype='$selecttype'
24663 sendmail='$sendmail'
24664 setgrent_r_proto='$setgrent_r_proto'
24665 sethostent_r_proto='$sethostent_r_proto'
24666 setlocale_r_proto='$setlocale_r_proto'
24667 setnetent_r_proto='$setnetent_r_proto'
24668 setprotoent_r_proto='$setprotoent_r_proto'
24669 setpwent_r_proto='$setpwent_r_proto'
24670 setservent_r_proto='$setservent_r_proto'
24671 sh='$sh'
24672 shar='$shar'
24673 sharpbang='$sharpbang'
24674 shmattype='$shmattype'
24675 shortsize='$shortsize'
24676 shrpenv='$shrpenv'
24677 shsharp='$shsharp'
24678 sig_count='$sig_count'
24679 sig_name='$sig_name'
24680 sig_name_init='$sig_name_init'
24681 sig_num='$sig_num'
24682 sig_num_init='$sig_num_init'
24683 sig_size='$sig_size'
24684 signal_t='$signal_t'
24685 sitearch='$sitearch'
24686 sitearchexp='$sitearchexp'
24687 sitebin='$sitebin'
24688 sitebinexp='$sitebinexp'
24689 sitehtml1dir='$sitehtml1dir'
24690 sitehtml1direxp='$sitehtml1direxp'
24691 sitehtml3dir='$sitehtml3dir'
24692 sitehtml3direxp='$sitehtml3direxp'
24693 sitelib='$sitelib'
24694 sitelib_stem='$sitelib_stem'
24695 sitelibexp='$sitelibexp'
24696 siteman1dir='$siteman1dir'
24697 siteman1direxp='$siteman1direxp'
24698 siteman3dir='$siteman3dir'
24699 siteman3direxp='$siteman3direxp'
24700 siteprefix='$siteprefix'
24701 siteprefixexp='$siteprefixexp'
24702 sitescript='$sitescript'
24703 sitescriptexp='$sitescriptexp'
24704 sizesize='$sizesize'
24705 sizetype='$sizetype'
24706 sleep='$sleep'
24707 smail='$smail'
24708 so='$so'
24709 sockethdr='$sockethdr'
24710 socketlib='$socketlib'
24711 socksizetype='$socksizetype'
24712 sort='$sort'
24713 spackage='$spackage'
24714 spitshell='$spitshell'
24715 srand48_r_proto='$srand48_r_proto'
24716 srandom_r_proto='$srandom_r_proto'
24717 src='$src'
24718 ssizetype='$ssizetype'
24719 st_ino_sign='$st_ino_sign'
24720 st_ino_size='$st_ino_size'
24721 startperl='$startperl'
24722 startsh='$startsh'
24723 static_ext='$static_ext'
24724 stdchar='$stdchar'
24725 stdio_base='$stdio_base'
24726 stdio_bufsiz='$stdio_bufsiz'
24727 stdio_cnt='$stdio_cnt'
24728 stdio_filbuf='$stdio_filbuf'
24729 stdio_ptr='$stdio_ptr'
24730 stdio_stream_array='$stdio_stream_array'
24731 strerror_r_proto='$strerror_r_proto'
24732 strings='$strings'
24733 submit='$submit'
24734 subversion='$subversion'
24735 sysman='$sysman'
24736 sysroot='$sysroot'
24737 tail='$tail'
24738 tar='$tar'
24739 targetarch='$targetarch'
24740 targetdir='$targetdir'
24741 targetenv='$targetenv'
24742 targethost='$targethost'
24743 targetmkdir='$targetmkdir'
24744 targetport='$targetport'
24745 targetsh='$targetsh'
24746 tbl='$tbl'
24747 tee='$tee'
24748 test='$test'
24749 timeincl='$timeincl'
24750 timetype='$timetype'
24751 tmpnam_r_proto='$tmpnam_r_proto'
24752 to='$to'
24753 touch='$touch'
24754 tr='$tr'
24755 trnl='$trnl'
24756 troff='$troff'
24757 ttyname_r_proto='$ttyname_r_proto'
24758 u16size='$u16size'
24759 u16type='$u16type'
24760 u32size='$u32size'
24761 u32type='$u32type'
24762 u64size='$u64size'
24763 u64type='$u64type'
24764 u8size='$u8size'
24765 u8type='$u8type'
24766 uidformat='$uidformat'
24767 uidsign='$uidsign'
24768 uidsize='$uidsize'
24769 uidtype='$uidtype'
24770 uname='$uname'
24771 uniq='$uniq'
24772 uquadtype='$uquadtype'
24773 use5005threads='$use5005threads'
24774 use64bitall='$use64bitall'
24775 use64bitint='$use64bitint'
24776 usecbacktrace='$usecbacktrace'
24777 usecrosscompile='$usecrosscompile'
24778 usedevel='$usedevel'
24779 usedl='$usedl'
24780 usedtrace='$usedtrace'
24781 usefaststdio='$usefaststdio'
24782 useithreads='$useithreads'
24783 usekernprocpathname='$usekernprocpathname'
24784 uselargefiles='$uselargefiles'
24785 uselongdouble='$uselongdouble'
24786 usemallocwrap='$usemallocwrap'
24787 usemorebits='$usemorebits'
24788 usemultiplicity='$usemultiplicity'
24789 usemymalloc='$usemymalloc'
24790 usenm='$usenm'
24791 usensgetexecutablepath='$usensgetexecutablepath'
24792 useopcode='$useopcode'
24793 useperlio='$useperlio'
24794 useposix='$useposix'
24795 usequadmath='$usequadmath'
24796 usereentrant='$usereentrant'
24797 userelocatableinc='$userelocatableinc'
24798 useshrplib='$useshrplib'
24799 usesitecustomize='$usesitecustomize'
24800 usesocks='$usesocks'
24801 usethreads='$usethreads'
24802 usevendorprefix='$usevendorprefix'
24803 useversionedarchname='$useversionedarchname'
24804 usevfork='$usevfork'
24805 usrinc='$usrinc'
24806 uuname='$uuname'
24807 uvXUformat='$uvXUformat'
24808 uvoformat='$uvoformat'
24809 uvsize='$uvsize'
24810 uvtype='$uvtype'
24811 uvuformat='$uvuformat'
24812 uvxformat='$uvxformat'
24813 vaproto='$vaproto'
24814 vendorarch='$vendorarch'
24815 vendorarchexp='$vendorarchexp'
24816 vendorbin='$vendorbin'
24817 vendorbinexp='$vendorbinexp'
24818 vendorhtml1dir='$vendorhtml1dir'
24819 vendorhtml1direxp='$vendorhtml1direxp'
24820 vendorhtml3dir='$vendorhtml3dir'
24821 vendorhtml3direxp='$vendorhtml3direxp'
24822 vendorlib='$vendorlib'
24823 vendorlib_stem='$vendorlib_stem'
24824 vendorlibexp='$vendorlibexp'
24825 vendorman1dir='$vendorman1dir'
24826 vendorman1direxp='$vendorman1direxp'
24827 vendorman3dir='$vendorman3dir'
24828 vendorman3direxp='$vendorman3direxp'
24829 vendorprefix='$vendorprefix'
24830 vendorprefixexp='$vendorprefixexp'
24831 vendorscript='$vendorscript'
24832 vendorscriptexp='$vendorscriptexp'
24833 version='$version'
24834 version_patchlevel_string='$version_patchlevel_string'
24835 versiononly='$versiononly'
24836 vi='$vi'
24837 xlibpth='$xlibpth'
24838 yacc='$yacc'
24839 yaccflags='$yaccflags'
24840 zcat='$zcat'
24841 zip='$zip'
24842 EOT
24843
24844 : add special variables
24845 $test -f $src/patchlevel.h && \
24846 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
24847 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
24848 echo "PERL_CONFIG_SH=true" >>config.sh
24849
24850 : propagate old symbols
24851 if $test -f UU/config.sh; then
24852         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
24853         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
24854                 config.sh config.sh UU/oldconfig.sh |\
24855                 $sort | $uniq -u >UU/oldsyms
24856         set X `$cat UU/oldsyms`
24857         shift
24858         case $# in
24859         0) ;;
24860         *)
24861                 $cat <<EOM
24862 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
24863 EOM
24864                 echo ": Variables propagated from previous config.sh file." >>config.sh
24865                 for sym in `$cat UU/oldsyms`; do
24866                         echo "    Propagating $hint variable "'$'"$sym..."
24867                         eval 'tmp="$'"${sym}"'"'
24868                         echo "$tmp" | \
24869                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
24870                 done
24871                 ;;
24872         esac
24873 fi
24874
24875 : preserve RCS keywords in files with variable substitution, grrr
24876 Id='$Id'
24877
24878 : Finish up by extracting the .SH files
24879 case "$alldone" in
24880 exit)
24881         $rm -rf UU
24882         echo "Extraction done."
24883         exit 0
24884         ;;
24885 cont)
24886         ;;
24887 '')
24888         dflt=''
24889         nostick=true
24890         $cat <<EOM
24891
24892 If you'd like to make any changes to the config.sh file before I begin
24893 to configure things, do it as a shell escape now (e.g. !vi config.sh).
24894
24895 EOM
24896         rp="Press return or use a shell escape to edit config.sh:"
24897         . UU/myread
24898         nostick=''
24899         case "$ans" in
24900         '') ;;
24901         *) : in case they cannot read
24902                 sh 1>&4 -c "$ans";;
24903         esac
24904         ;;
24905 esac
24906
24907 : if this fails, just run all the .SH files by hand
24908 . ./config.sh
24909
24910 echo " "
24911 exec 1>&4
24912 pwd=`pwd`
24913 . ./UU/extract
24914 cd "$pwd"
24915
24916 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
24917         dflt=y
24918         case "$silent" in
24919         true) ;;
24920         *)
24921                 $cat <<EOM
24922
24923 Now you need to generate make dependencies by running "$make depend".
24924 You might prefer to run it in background: "$make depend > makedepend.out &"
24925 It can take a while, so you might not want to run it right now.
24926
24927 EOM
24928                 ;;
24929         esac
24930         rp="Run $make depend now?"
24931         . UU/myread
24932         case "$ans" in
24933         y*)
24934                 $make depend && echo "Now you must run '$make'."
24935                 ;;
24936         *)
24937                 echo "You must run '$make depend' then '$make'."
24938                 ;;
24939         esac
24940 elif test -f [Mm]akefile; then
24941         echo " "
24942         echo "Now you must run a $make."
24943 else
24944         echo "Configure done."
24945 fi
24946
24947 if $test -f Policy.sh; then
24948     $cat <<EOM
24949
24950 If you compile $package on a different machine or from a different object
24951 directory, copy the Policy.sh file from this object directory to the
24952 new one before you run Configure -- this will help you with most of
24953 the policy defaults.
24954
24955 EOM
24956 fi
24957 if $test -f config.msg; then
24958     echo "Hmm.  I also noted the following information while running:"
24959     echo " "
24960     $cat config.msg >&4
24961     $rm -f config.msg
24962 fi
24963 $rm -f kit*isdone ark*isdone
24964 $rm -rf UU
24965
24966 : End of Configure
24967