This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix minitest (op/taint.t) for GCC 4.x
[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_llround=''
622 d_localtime_r=''
623 d_localtime_r_needs_tzset=''
624 localtime_r_proto=''
625 d_locconv=''
626 d_lockf=''
627 d_log1p=''
628 d_log2=''
629 d_logb=''
630 d_ldexpl=''
631 d_longdbl=''
632 longdblkind=''
633 longdblsize=''
634 d_longlong=''
635 longlongsize=''
636 d_lrint=''
637 d_lround=''
638 d_lseekproto=''
639 d_lstat=''
640 d_madvise=''
641 d_malloc_good_size=''
642 d_malloc_size=''
643 d_mblen=''
644 d_mbstowcs=''
645 d_mbtowc=''
646 d_memchr=''
647 d_memcmp=''
648 d_memcpy=''
649 d_memmove=''
650 d_memset=''
651 d_mkdir=''
652 d_mkdtemp=''
653 d_mkfifo=''
654 d_mkstemp=''
655 d_mkstemps=''
656 d_mktime=''
657 d_mmap=''
658 mmaptype=''
659 d_modfl=''
660 d_modfl_pow32_bug=''
661 d_modflproto=''
662 d_mprotect=''
663 d_msg=''
664 d_msgctl=''
665 d_msgget=''
666 d_msghdr_s=''
667 d_msgrcv=''
668 d_msgsnd=''
669 d_msync=''
670 d_munmap=''
671 d_nan=''
672 d_nearbyint=''
673 d_nextafter=''
674 d_nexttoward=''
675 d_nice=''
676 d_nl_langinfo=''
677 d_off64_t=''
678 d_open3=''
679 d_fpathconf=''
680 d_pathconf=''
681 d_pause=''
682 d_pipe=''
683 d_poll=''
684 d_portable=''
685 d_prctl=''
686 d_prctl_set_name=''
687 d_procselfexe=''
688 procselfexe=''
689 d_old_pthread_create_joinable=''
690 old_pthread_create_joinable=''
691 d_pthread_atfork=''
692 d_pthread_attr_setscope=''
693 d_pthread_yield=''
694 d_sched_yield=''
695 sched_yield=''
696 d_ptrdiff_t=''
697 d_qgcvt=''
698 d_random_r=''
699 random_r_proto=''
700 d_readdir64_r=''
701 readdir64_r_proto=''
702 d_readdir=''
703 d_rewinddir=''
704 d_seekdir=''
705 d_telldir=''
706 d_readdir_r=''
707 readdir_r_proto=''
708 d_readlink=''
709 d_readv=''
710 d_recvmsg=''
711 d_re_comp=''
712 d_regcmp=''
713 d_regcomp=''
714 d_remainder=''
715 d_remquo=''
716 d_rename=''
717 d_rint=''
718 d_rmdir=''
719 d_round=''
720 d_safebcpy=''
721 d_safemcpy=''
722 d_sanemcmp=''
723 d_sbrkproto=''
724 d_scalbn=''
725 d_scalbnl=''
726 d_select=''
727 d_sem=''
728 d_semctl=''
729 d_semget=''
730 d_semop=''
731 d_sendmsg=''
732 d_setegid=''
733 d_seteuid=''
734 d_setgrent=''
735 d_setgrent_r=''
736 setgrent_r_proto=''
737 d_setgrps=''
738 d_sethent=''
739 d_sethostent_r=''
740 sethostent_r_proto=''
741 d_setitimer=''
742 d_setlinebuf=''
743 d_setlocale=''
744 d_setlocale_r=''
745 setlocale_r_proto=''
746 d_setnent=''
747 d_setnetent_r=''
748 setnetent_r_proto=''
749 d_setpent=''
750 d_setpgid=''
751 d_setpgrp2=''
752 d_bsdsetpgrp=''
753 d_setpgrp=''
754 d_setprior=''
755 d_setproctitle=''
756 d_setprotoent_r=''
757 setprotoent_r_proto=''
758 d_setpwent=''
759 d_setpwent_r=''
760 setpwent_r_proto=''
761 d_setregid=''
762 d_setresgid=''
763 d_setresuid=''
764 d_setreuid=''
765 d_setrgid=''
766 d_setruid=''
767 d_setsent=''
768 d_setservent_r=''
769 setservent_r_proto=''
770 d_setsid=''
771 d_setvbuf=''
772 d_shm=''
773 d_shmat=''
774 d_shmatprototype=''
775 shmattype=''
776 d_shmctl=''
777 d_shmdt=''
778 d_shmget=''
779 d_sigaction=''
780 d_signbit=''
781 d_sigprocmask=''
782 d_sigsetjmp=''
783 usesitecustomize=''
784 d_snprintf=''
785 d_vsnprintf=''
786 d_sockatmark=''
787 d_sockatmarkproto=''
788 d_ip_mreq=''
789 d_ip_mreq_source=''
790 d_ipv6_mreq=''
791 d_ipv6_mreq_source=''
792 d_msg_ctrunc=''
793 d_msg_dontroute=''
794 d_msg_oob=''
795 d_msg_peek=''
796 d_msg_proxy=''
797 d_oldsock=''
798 d_scm_rights=''
799 d_sin6_scope_id=''
800 d_sockaddr_in6=''
801 d_sockaddr_sa_len=''
802 d_socket=''
803 d_sockpair=''
804 sockethdr=''
805 socketlib=''
806 d_socklen_t=''
807 d_socks5_init=''
808 d_sprintf_returns_strlen=''
809 d_sqrtl=''
810 d_srand48_r=''
811 srand48_r_proto=''
812 d_srandom_r=''
813 srandom_r_proto=''
814 d_sresgproto=''
815 d_sresuproto=''
816 d_stat=''
817 d_statblks=''
818 d_statfs_f_flags=''
819 d_statfs_s=''
820 d_static_inline=''
821 perl_static_inline=''
822 d_fstatvfs=''
823 d_statvfs=''
824 d_stdio_cnt_lval=''
825 d_stdio_ptr_lval=''
826 d_stdio_ptr_lval_nochange_cnt=''
827 d_stdio_ptr_lval_sets_cnt=''
828 d_stdiobase=''
829 d_stdstdio=''
830 stdio_base=''
831 stdio_bufsiz=''
832 stdio_cnt=''
833 stdio_filbuf=''
834 stdio_ptr=''
835 d_index=''
836 d_strchr=''
837 d_strcoll=''
838 d_strctcpy=''
839 d_strerrm=''
840 d_strerror=''
841 d_sysernlst=''
842 d_syserrlst=''
843 d_strerror_r=''
844 strerror_r_proto=''
845 d_strftime=''
846 d_strlcat=''
847 d_strlcpy=''
848 d_strtod=''
849 d_strtol=''
850 d_strtold=''
851 d_strtoll=''
852 d_strtoq=''
853 d_strtoul=''
854 d_strtoull=''
855 d_strtouq=''
856 d_strxfrm=''
857 d_symlink=''
858 d_syscall=''
859 d_syscallproto=''
860 d_sysconf=''
861 d_system=''
862 d_tcgetpgrp=''
863 d_tcsetpgrp=''
864 d_telldirproto=''
865 d_tgamma=''
866 d_time=''
867 timetype=''
868 d_asctime64=''
869 d_ctime64=''
870 d_difftime64=''
871 d_gmtime64=''
872 d_localtime64=''
873 d_mktime64=''
874 d_timegm=''
875 clocktype=''
876 d_times=''
877 d_tmpnam_r=''
878 tmpnam_r_proto=''
879 d_trunc=''
880 d_truncate=''
881 d_truncl=''
882 d_ttyname_r=''
883 ttyname_r_proto=''
884 d_tzname=''
885 d_u32align=''
886 d_ualarm=''
887 d_umask=''
888 d_semctl_semid_ds=''
889 d_semctl_semun=''
890 d_union_semun=''
891 d_unordered=''
892 d_unsetenv=''
893 d_usleep=''
894 d_usleepproto=''
895 d_ustat=''
896 d_pseudofork=''
897 d_vfork=''
898 usevfork=''
899 d_voidsig=''
900 signal_t=''
901 d_volatile=''
902 d_charvspr=''
903 d_vprintf=''
904 d_wait4=''
905 d_waitpid=''
906 d_wcscmp=''
907 d_wcstombs=''
908 d_wcsxfrm=''
909 d_wctomb=''
910 d_writev=''
911 dlext=''
912 bin_ELF=''
913 cccdlflags=''
914 ccdlflags=''
915 dlsrc=''
916 ld=''
917 ld_can_script=''
918 lddlflags=''
919 usedl=''
920 doublesize=''
921 ebcdic=''
922 fflushNULL=''
923 fflushall=''
924 fpossize=''
925 fpostype=''
926 gccansipedantic=''
927 gccosandvers=''
928 gccversion=''
929 gidformat=''
930 gidsign=''
931 gidsize=''
932 gidtype=''
933 groupstype=''
934 h_fcntl=''
935 h_sysfile=''
936 html1dir=''
937 html1direxp=''
938 installhtml1dir=''
939 html3dir=''
940 html3direxp=''
941 installhtml3dir=''
942 i_arpainet=''
943 i_assert=''
944 i_bfd=''
945 i_crypt=''
946 db_hashtype=''
947 db_prefixtype=''
948 db_version_major=''
949 db_version_minor=''
950 db_version_patch=''
951 i_db=''
952 i_dbm=''
953 i_rpcsvcdbm=''
954 d_dirnamlen=''
955 direntrytype=''
956 i_dirent=''
957 i_dlfcn=''
958 i_execinfo=''
959 i_fcntl=''
960 i_fenv=''
961 i_float=''
962 i_fp=''
963 i_fp_class=''
964 i_gdbm=''
965 d_grpasswd=''
966 i_grp=''
967 i_ieeefp=''
968 i_inttypes=''
969 i_langinfo=''
970 i_libutil=''
971 i_limits=''
972 i_locale=''
973 i_machcthr=''
974 i_malloc=''
975 i_mallocmalloc=''
976 i_math=''
977 i_memory=''
978 i_mntent=''
979 d_gdbm_ndbm_h_uses_prototypes=''
980 d_gdbmndbm_h_uses_prototypes=''
981 d_ndbm=''
982 d_ndbm_h_uses_prototypes=''
983 i_gdbm_ndbm=''
984 i_gdbmndbm=''
985 i_ndbm=''
986 i_netdb=''
987 i_neterrno=''
988 i_netinettcp=''
989 i_niin=''
990 i_sysin=''
991 i_poll=''
992 i_prot=''
993 i_pthread=''
994 d_pwage=''
995 d_pwchange=''
996 d_pwclass=''
997 d_pwcomment=''
998 d_pwexpire=''
999 d_pwgecos=''
1000 d_pwpasswd=''
1001 d_pwquota=''
1002 i_pwd=''
1003 i_quadmath=''
1004 i_shadow=''
1005 i_socks=''
1006 i_stdbool=''
1007 i_stddef=''
1008 i_stdint=''
1009 i_stdlib=''
1010 i_string=''
1011 strings=''
1012 i_sunmath=''
1013 i_sysaccess=''
1014 i_sysdir=''
1015 i_sysfile=''
1016 d_voidtty=''
1017 i_bsdioctl=''
1018 i_sysfilio=''
1019 i_sysioctl=''
1020 i_syssockio=''
1021 i_syslog=''
1022 i_sysmman=''
1023 i_sysmode=''
1024 i_sysmount=''
1025 i_sysndir=''
1026 i_sysparam=''
1027 i_syspoll=''
1028 i_sysresrc=''
1029 i_syssecrt=''
1030 i_sysselct=''
1031 i_sysstat=''
1032 i_sysstatfs=''
1033 i_sysstatvfs=''
1034 i_systimes=''
1035 i_systypes=''
1036 i_sysuio=''
1037 i_sysun=''
1038 i_sysutsname=''
1039 i_sysvfs=''
1040 i_syswait=''
1041 i_sgtty=''
1042 i_termio=''
1043 i_termios=''
1044 d_tm_tm_gmtoff=''
1045 d_tm_tm_zone=''
1046 i_systime=''
1047 i_systimek=''
1048 i_time=''
1049 timeincl=''
1050 i_unistd=''
1051 i_ustat=''
1052 i_utime=''
1053 i_values=''
1054 i_stdarg=''
1055 i_varargs=''
1056 i_varhdr=''
1057 i_vfork=''
1058 d_inc_version_list=''
1059 inc_version_list=''
1060 inc_version_list_init=''
1061 installprefix=''
1062 installprefixexp=''
1063 installstyle=''
1064 installusrbinperl=''
1065 intsize=''
1066 longsize=''
1067 shortsize=''
1068 issymlink=''
1069 libc=''
1070 ldlibpthname=''
1071 libperl=''
1072 shrpenv=''
1073 useshrplib=''
1074 glibpth=''
1075 incpth=''
1076 libpth=''
1077 loclibpth=''
1078 plibpth=''
1079 xlibpth=''
1080 ignore_versioned_solibs=''
1081 libs=''
1082 libsdirs=''
1083 libsfiles=''
1084 libsfound=''
1085 libspath=''
1086 lns=''
1087 d_PRIEUldbl=''
1088 d_PRIFUldbl=''
1089 d_PRIGUldbl=''
1090 d_PRIeldbl=''
1091 d_PRIfldbl=''
1092 d_PRIgldbl=''
1093 d_SCNfldbl=''
1094 doublekind=''
1095 sPRIEUldbl=''
1096 sPRIFUldbl=''
1097 sPRIGUldbl=''
1098 sPRIeldbl=''
1099 sPRIfldbl=''
1100 sPRIgldbl=''
1101 sSCNfldbl=''
1102 lseeksize=''
1103 lseektype=''
1104 make_set_make=''
1105 d_mymalloc=''
1106 freetype=''
1107 mallocobj=''
1108 mallocsrc=''
1109 malloctype=''
1110 usemallocwrap=''
1111 usemymalloc=''
1112 installman1dir=''
1113 man1dir=''
1114 man1direxp=''
1115 man1ext=''
1116 installman3dir=''
1117 man3dir=''
1118 man3direxp=''
1119 man3ext=''
1120 modetype=''
1121 multiarch=''
1122 mydomain=''
1123 myhostname=''
1124 phostname=''
1125 c=''
1126 n=''
1127 d_eofnblk=''
1128 eagain=''
1129 o_nonblock=''
1130 rd_nodata=''
1131 need_va_copy=''
1132 netdb_hlen_type=''
1133 netdb_host_type=''
1134 netdb_name_type=''
1135 netdb_net_type=''
1136 groupcat=''
1137 hostcat=''
1138 passcat=''
1139 orderlib=''
1140 ranlib=''
1141 d_perl_otherlibdirs=''
1142 otherlibdirs=''
1143 package=''
1144 spackage=''
1145 pager=''
1146 api_revision=''
1147 api_subversion=''
1148 api_version=''
1149 api_versionstring=''
1150 patchlevel=''
1151 perl_patchlevel=''
1152 revision=''
1153 subversion=''
1154 version=''
1155 version_patchlevel_string=''
1156 perl5=''
1157 perladmin=''
1158 perlpath=''
1159 d_nv_preserves_uv=''
1160 d_nv_zero_is_allbits_zero=''
1161 i16size=''
1162 i16type=''
1163 i32size=''
1164 i32type=''
1165 i64size=''
1166 i64type=''
1167 i8size=''
1168 i8type=''
1169 ivsize=''
1170 ivtype=''
1171 nv_overflows_integers_at=''
1172 nv_preserves_uv_bits=''
1173 nvsize=''
1174 nvtype=''
1175 u16size=''
1176 u16type=''
1177 u32size=''
1178 u32type=''
1179 u64size=''
1180 u64type=''
1181 u8size=''
1182 u8type=''
1183 uvsize=''
1184 uvtype=''
1185 ivdformat=''
1186 nvEUformat=''
1187 nvFUformat=''
1188 nvGUformat=''
1189 nveformat=''
1190 nvfformat=''
1191 nvgformat=''
1192 uvXUformat=''
1193 uvoformat=''
1194 uvuformat=''
1195 uvxformat=''
1196 pidtype=''
1197 prefix=''
1198 prefixexp=''
1199 installprivlib=''
1200 privlib=''
1201 privlibexp=''
1202 prototype=''
1203 ptrsize=''
1204 d_PRIXU64=''
1205 d_PRId64=''
1206 d_PRIi64=''
1207 d_PRIo64=''
1208 d_PRIu64=''
1209 d_PRIx64=''
1210 sPRIXU64=''
1211 sPRId64=''
1212 sPRIi64=''
1213 sPRIo64=''
1214 sPRIu64=''
1215 sPRIx64=''
1216 d_quad=''
1217 quadkind=''
1218 quadtype=''
1219 uquadtype=''
1220 drand01=''
1221 randbits=''
1222 randfunc=''
1223 randseedtype=''
1224 seedfunc=''
1225 installscript=''
1226 scriptdir=''
1227 scriptdirexp=''
1228 selectminbits=''
1229 selecttype=''
1230 sh=''
1231 targetsh=''
1232 sig_count=''
1233 sig_name=''
1234 sig_name_init=''
1235 sig_num=''
1236 sig_num_init=''
1237 sig_size=''
1238 d_sitearch=''
1239 installsitearch=''
1240 sitearch=''
1241 sitearchexp=''
1242 installsitebin=''
1243 sitebin=''
1244 sitebinexp=''
1245 installsitehtml1dir=''
1246 sitehtml1dir=''
1247 sitehtml1direxp=''
1248 installsitehtml3dir=''
1249 sitehtml3dir=''
1250 sitehtml3direxp=''
1251 installsitelib=''
1252 sitelib=''
1253 sitelib_stem=''
1254 sitelibexp=''
1255 installsiteman1dir=''
1256 siteman1dir=''
1257 siteman1direxp=''
1258 installsiteman3dir=''
1259 siteman3dir=''
1260 siteman3direxp=''
1261 siteprefix=''
1262 siteprefixexp=''
1263 installsitescript=''
1264 sitescript=''
1265 sitescriptexp=''
1266 sizesize=''
1267 sizetype=''
1268 d_libname_unique=''
1269 so=''
1270 socksizetype=''
1271 sharpbang=''
1272 shsharp=''
1273 spitshell=''
1274 src=''
1275 ssizetype=''
1276 st_ino_sign=''
1277 st_ino_size=''
1278 startperl=''
1279 startsh=''
1280 stdchar=''
1281 d_stdio_stream_array=''
1282 stdio_stream_array=''
1283 sysman=''
1284 sGMTIME_max=''
1285 sGMTIME_min=''
1286 sLOCALTIME_max=''
1287 sLOCALTIME_min=''
1288 trnl=''
1289 uidformat=''
1290 uidsign=''
1291 uidsize=''
1292 uidtype=''
1293 archname64=''
1294 use64bitall=''
1295 use64bitint=''
1296 usecbacktrace=''
1297 dtrace=''
1298 usedtrace=''
1299 usefaststdio=''
1300 usekernprocpathname=''
1301 ccflags_uselargefiles=''
1302 ldflags_uselargefiles=''
1303 libswanted_uselargefiles=''
1304 uselargefiles=''
1305 uselongdouble=''
1306 usemorebits=''
1307 usemultiplicity=''
1308 nm_opt=''
1309 nm_so_opt=''
1310 runnm=''
1311 usenm=''
1312 usensgetexecutablepath=''
1313 useperlio=''
1314 usequadmath=''
1315 usesocks=''
1316 d_oldpthreads=''
1317 use5005threads=''
1318 useithreads=''
1319 usereentrant=''
1320 usethreads=''
1321 incpath=''
1322 mips_type=''
1323 usrinc=''
1324 vaproto=''
1325 d_vendorarch=''
1326 installvendorarch=''
1327 vendorarch=''
1328 vendorarchexp=''
1329 d_vendorbin=''
1330 installvendorbin=''
1331 vendorbin=''
1332 vendorbinexp=''
1333 installvendorhtml1dir=''
1334 vendorhtml1dir=''
1335 vendorhtml1direxp=''
1336 installvendorhtml3dir=''
1337 vendorhtml3dir=''
1338 vendorhtml3direxp=''
1339 d_vendorlib=''
1340 installvendorlib=''
1341 vendorlib=''
1342 vendorlib_stem=''
1343 vendorlibexp=''
1344 installvendorman1dir=''
1345 vendorman1dir=''
1346 vendorman1direxp=''
1347 installvendorman3dir=''
1348 vendorman3dir=''
1349 vendorman3direxp=''
1350 usevendorprefix=''
1351 vendorprefix=''
1352 vendorprefixexp=''
1353 d_vendorscript=''
1354 installvendorscript=''
1355 vendorscript=''
1356 vendorscriptexp=''
1357 versiononly=''
1358 yacc=''
1359 yaccflags=''
1360 CONFIG=''
1361
1362 : Detect odd OSs
1363 define='define'
1364 undef='undef'
1365 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1366 rmlist=''
1367
1368 : We must find out about Eunice early
1369 eunicefix=':'
1370 if test -f /etc/unixtovms; then
1371         eunicefix=/etc/unixtovms
1372 fi
1373 if test -f /etc/unixtovms.exe; then
1374         eunicefix=/etc/unixtovms.exe
1375 fi
1376
1377 : Set executable suffix now -- needed before hints available
1378 if test -f "/libs/version.library"; then
1379 : Amiga OS
1380     _exe=""
1381 elif test -f "/system/gnu_library/bin/ar.pm"; then
1382 : Stratus VOS
1383     _exe=".pm"
1384 elif test -n "$DJGPP"; then
1385 : DOS DJGPP
1386     _exe=".exe"
1387 elif test -f /kern/cookiejar; then
1388 : MiNT
1389     _exe=""
1390 elif test -d c:/. -o -n "$is_os2" ; then
1391 : OS/2 or cygwin
1392     _exe=".exe"
1393 fi
1394
1395 groupstype=''
1396 i_whoami=''
1397 : Trailing extension.  Override this in a hint file, if needed.
1398 : Extra object files, if any, needed on this platform.
1399 archobjs=''
1400 archname=''
1401 : Possible local include directories to search.
1402 : Set locincpth to "" in a hint file to defeat local include searches.
1403 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1404 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1405 :
1406 : no include file wanted by default
1407 inclwanted=''
1408
1409 : Enable -DEBUGGING and -DDEBUGGING from the command line
1410 EBUGGING=''
1411 DEBUGGING=''
1412
1413 libnames=''
1414 : change the next line if compiling for Xenix/286 on Xenix/386
1415 xlibpth='/usr/lib/386 /lib/386'
1416 : Possible local library directories to search.
1417 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1418 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1419
1420 : general looking path for locating libraries
1421 glibpth="/lib /usr/lib $xlibpth"
1422 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1423 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1424 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1425 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1426
1427 : Private path used by Configure to find libraries.  Its value
1428 : is prepended to libpth. This variable takes care of special
1429 : machines, like the mips.  Usually, it should be empty.
1430 plibpth=''
1431
1432 : default library list
1433 libswanted=''
1434 : some systems want to use only the non-versioned libso:s
1435 ignore_versioned_solibs=''
1436 : set usethreads on the Configure command line to enable threads.
1437 usereentrant='undef'
1438 ccname=''
1439 ccversion=''
1440 perllibs=''
1441 : set useposix=false in your hint file to disable the POSIX extension.
1442 useposix=true
1443 : set useopcode=false in your hint file to disable the Opcode extension.
1444 useopcode=true
1445 archname64=''
1446 ccflags_uselargefiles=''
1447 ldflags_uselargefiles=''
1448 libswanted_uselargefiles=''
1449 : set usemultiplicity on the Configure command line to enable multiplicity.
1450 : set usesocks on the Configure command line to enable socks.
1451 : List of libraries we want.
1452 : If anyone needs extra -lxxx, put those in a hint file.
1453 libswanted="cl pthread socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld"
1454 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1455 : We probably want to search /usr/shlib before most other libraries.
1456 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1457 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1458 glibpth="/usr/shlib $glibpth"
1459 : Do not use vfork unless overridden by a hint file.
1460 usevfork=false
1461
1462 : Find the basic shell for Bourne shell scripts
1463 case "$sh" in
1464 '')
1465         case "$SYSTYPE" in
1466         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1467         *) xxx='/bin/sh';;
1468         esac
1469         if test -f "$xxx"; then
1470                 sh="$xxx"
1471         else
1472                 : Build up a list and do a single loop so we can 'break' out.
1473                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1474                 for xxx in sh bash ksh pdksh ash; do
1475                         for p in $pth; do
1476                                 try="$try ${p}/${xxx}"
1477                         done
1478                 done
1479                 for xxx in $try; do
1480                         if test -f "$xxx"; then
1481                                 sh="$xxx";
1482                                 break
1483                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1484                                 sh="$xxx";
1485                                 break
1486                         elif test -f "$xxx.exe"; then
1487                                 sh="$xxx";
1488                                 break
1489                         fi
1490                 done
1491         fi
1492         ;;
1493 esac
1494
1495 case "$sh" in
1496 '')     cat >&2 <<EOM
1497 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1498
1499 Usually it's in /bin/sh.  How did you even get this far?
1500 Please contact me (Perl Maintainers) at perlbug@perl.org and
1501 we'll try to straighten this all out.
1502 EOM
1503         exit 1
1504         ;;
1505 esac
1506
1507 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1508 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1509 targetsh=$sh
1510
1511 : see if sh knows # comments
1512 if `$sh -c '#' >/dev/null 2>&1`; then
1513         shsharp=true
1514         spitshell=cat
1515         xcat=/bin/cat
1516         test -f $xcat$_exe || xcat=/usr/bin/cat
1517         if test ! -f $xcat$_exe; then
1518                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1519                         if test -f $p/cat$_exe; then
1520                                 xcat=$p/cat
1521                                 break
1522                         fi
1523                 done
1524                 if test ! -f $xcat$_exe; then
1525                         echo "Can't find cat anywhere!"
1526                         exit 1
1527                 fi
1528         fi
1529         echo "#!$xcat" >sharp
1530         $eunicefix sharp
1531         chmod +x sharp
1532         ./sharp > today 2>/dev/null
1533         if test -s today; then
1534                 sharpbang='#!'
1535         else
1536                 echo "#! $xcat" > sharp
1537                 $eunicefix sharp
1538                 chmod +x sharp
1539                 ./sharp > today 2>/dev/null
1540                 if test -s today; then
1541                         sharpbang='#! '
1542                 else
1543                         sharpbang=': use '
1544                 fi
1545         fi
1546 else
1547         echo " "
1548         echo "Your $sh doesn't grok # comments--I will strip them later on."
1549         shsharp=false
1550         cd ..
1551         echo "exec grep -v '^[  ]*#'" >spitshell
1552         chmod +x spitshell
1553         $eunicefix spitshell
1554         spitshell=`pwd`/spitshell
1555         cd UU
1556         echo "I presume that if # doesn't work, #! won't work either!"
1557         sharpbang=': use '
1558 fi
1559 rm -f sharp today
1560
1561 : figure out how to guarantee sh startup
1562 case "$startsh" in
1563 '') startsh=${sharpbang}${sh} ;;
1564 *)
1565 esac
1566 cat >sharp <<EOSS
1567 $startsh
1568 set abc
1569 test "$?abc" != 1
1570 EOSS
1571
1572 chmod +x sharp
1573 $eunicefix sharp
1574 if ./sharp; then
1575         : echo "Yup, it does."
1576 else
1577         echo "Hmm... '$startsh' does not guarantee sh startup..."
1578         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1579 fi
1580 rm -f sharp
1581
1582 : Save command line options in file UU/cmdline.opt for later use in
1583 : generating config.sh.
1584 cat > cmdline.opt <<EOSH
1585 : Configure command line arguments.
1586 config_arg0='$0'
1587 config_args='$*'
1588 config_argc=$#
1589 EOSH
1590 argn=1
1591 args_exp=''
1592 args_sep=''
1593 for arg in "$@"; do
1594         cat >>cmdline.opt <<EOSH
1595 config_arg$argn='$arg'
1596 EOSH
1597         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1598 $arg
1599 EOC
1600         arg_exp=`cat cmdl.opt`
1601         args_exp="$args_exp$args_sep'$arg_exp'"
1602         argn=`expr $argn + 1`
1603         args_sep=' '
1604 done
1605 rm -f cmdl.opt
1606
1607 : produce awk script to parse command line options
1608 cat >options.awk <<'EOF'
1609 BEGIN {
1610         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1611
1612         len = length(optstr);
1613         for (i = 1; i <= len; i++) {
1614                 c = substr(optstr, i, 1);
1615                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1616                 if (a == ":") {
1617                         arg[c] = 1;
1618                         i++;
1619                 }
1620                 opt[c] = 1;
1621         }
1622 }
1623 {
1624         expect = 0;
1625         str = $0;
1626         if (substr(str, 1, 1) != "-") {
1627                 printf("'%s'\n", str);
1628                 next;
1629         }
1630         len = length($0);
1631         for (i = 2; i <= len; i++) {
1632                 c = substr(str, i, 1);
1633                 if (!opt[c]) {
1634                         printf("-%s\n", substr(str, i));
1635                         next;
1636                 }
1637                 printf("-%s\n", c);
1638                 if (arg[c]) {
1639                         if (i < len)
1640                                 printf("'%s'\n", substr(str, i + 1));
1641                         else
1642                                 expect = 1;
1643                         next;
1644                 }
1645         }
1646 }
1647 END {
1648         if (expect)
1649                 print "?";
1650 }
1651 EOF
1652
1653 : process the command line options
1654 set X `for arg in "$@"; do echo "X$arg"; done |
1655         sed -e s/X// | awk -f options.awk`
1656 eval "set $*"
1657 shift
1658 rm -f options.awk
1659
1660 : set up default values
1661 fastread=''
1662 reuseval=false
1663 config_sh=''
1664 alldone=''
1665 error=''
1666 silent=''
1667 extractsh=''
1668 override=''
1669 knowitall=''
1670 rm -f optdef.sh posthint.sh
1671 cat >optdef.sh <<EOS
1672 $startsh
1673 EOS
1674
1675
1676 : option parsing
1677 while test $# -gt 0; do
1678         case "$1" in
1679         -d) shift; fastread=yes;;
1680         -e) shift; alldone=cont;;
1681         -f)
1682                 shift
1683                 cd ..
1684                 if test -r "$1"; then
1685                         config_sh="$1"
1686                 else
1687                         echo "$me: cannot read config file $1." >&2
1688                         error=true
1689                 fi
1690                 cd UU
1691                 shift;;
1692         --help|\
1693         -h) shift; error=true;;
1694         -r) shift; reuseval=true;;
1695         -s) shift; silent=true; realsilent=true;;
1696         -E) shift; alldone=exit;;
1697         -K) shift; knowitall=true;;
1698         -O) shift; override=true;;
1699         -S) shift; silent=true; extractsh=true;;
1700         -D)
1701                 shift
1702                 case "$1" in
1703                 *=)
1704                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1705                         echo "$me: ignoring -D $1" >&2
1706                         ;;
1707                 *=*) echo "$1" | \
1708                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1709                 *) echo "$1='define'" >> optdef.sh;;
1710                 esac
1711                 shift
1712                 ;;
1713         -U)
1714                 shift
1715                 case "$1" in
1716                 *=) echo "$1" >> optdef.sh;;
1717                 *=*)
1718                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1719                         echo "$me: ignoring -U $1" >&2
1720                         ;;
1721                 *) echo "$1='undef'" >> optdef.sh;;
1722                 esac
1723                 shift
1724                 ;;
1725         -A)
1726             shift
1727             xxx=''
1728             yyy="$1"
1729             zzz=''
1730             uuu=undef
1731             case "$yyy" in
1732             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1733                  case "$zzz" in
1734                  *:*) zzz='' ;;
1735                  *)   xxx=append
1736                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1737                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1738                  esac
1739                  ;;
1740             esac
1741             case "$xxx" in
1742             '')  case "$yyy" in
1743                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1744                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1745                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1746                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1747                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1748                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1749                  esac
1750                  ;;
1751             esac
1752             case "$xxx" in
1753             append)
1754                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1755             clear)
1756                 echo "$yyy=''"                  >> posthint.sh ;;
1757             define)
1758                 case "$zzz" in
1759                 '') zzz=define ;;
1760                 esac
1761                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1762             eval)
1763                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1764             prepend)
1765                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1766             undef)
1767                 case "$zzz" in
1768                 '') zzz="$uuu" ;;
1769                 esac
1770                 echo "$yyy=$zzz"                >> posthint.sh ;;
1771             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1772             esac
1773             shift
1774             ;;
1775         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1776             exit 0;;
1777         --) break;;
1778         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1779         *) break;;
1780         esac
1781 done
1782
1783 case "$error" in
1784 true)
1785         cat >&2 <<EOM
1786 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1787                  [-U symbol] [-U symbol=] [-A command:symbol...]
1788   -d : use defaults for all answers.
1789   -e : go on without questioning past the production of config.sh.
1790   -f : specify an alternate default configuration file.
1791   -h : print this help message and exit (with an error status).
1792   -r : reuse C symbols value if possible (skips costly nm extraction).
1793   -s : silent mode, only echoes questions and essential information.
1794   -D : define symbol to have some value:
1795          -D symbol         symbol gets the value 'define'
1796          -D symbol=value   symbol gets the value 'value'
1797        common used examples (see INSTALL for more info):
1798          -Duse64bitint            use 64bit integers
1799          -Duse64bitall            use 64bit integers and pointers
1800          -Dusethreads             use thread support
1801          -Dinc_version_list=none  do not include older perl trees in @INC
1802          -DEBUGGING=none          DEBUGGING options
1803          -Dcc=gcc                 choose your compiler
1804          -Dprefix=/opt/perl5      choose your destination
1805   -E : stop at the end of questions, after having produced config.sh.
1806   -K : do not use unless you know what you are doing.
1807   -O : let -D and -U override definitions from loaded configuration file.
1808   -S : perform variable substitutions on all .SH files (can mix with -f)
1809   -U : undefine symbol:
1810          -U symbol    symbol gets the value 'undef'
1811          -U symbol=   symbol gets completely empty
1812        e.g.:  -Uversiononly
1813   -A : manipulate symbol after the platform specific hints have been applied:
1814          -A append:symbol=value   append value to symbol
1815          -A symbol=value          like append:, but with a separating space
1816          -A define:symbol=value   define symbol to have value
1817          -A clear:symbol          define symbol to be ''
1818          -A define:symbol         define symbol to be 'define'
1819          -A eval:symbol=value     define symbol to be eval of value
1820          -A prepend:symbol=value  prepend value to symbol
1821          -A undef:symbol          define symbol to be 'undef'
1822          -A undef:symbol=         define symbol to be ''
1823        e.g.:  -A prepend:libswanted='cl pthread '
1824               -A ccflags=-DSOME_MACRO
1825   -V : print version number and exit (with a zero status).
1826 EOM
1827         exit 1
1828         ;;
1829 esac
1830
1831 : Sanity checks
1832 case "$fastread$alldone" in
1833 yescont|yesexit) ;;
1834 *)
1835         case "$extractsh" in
1836         true) ;;
1837         *)
1838                 if test ! -t 0; then
1839                         echo "Say 'sh Configure', not 'sh <Configure'"
1840                         exit 1
1841                 fi
1842                 ;;
1843         esac
1844         ;;
1845 esac
1846
1847 exec 4>&1
1848 case "$silent" in
1849 true) exec 1>/dev/null;;
1850 esac
1851
1852 : run the defines and the undefines, if any, but leave the file out there...
1853 touch optdef.sh
1854 . ./optdef.sh
1855 : create the posthint manipulation script and leave the file out there...
1856 touch posthint.sh
1857
1858 : set package name
1859 package='perl5'
1860 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1861 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1862 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1863 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1864 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1865 esac
1866
1867 : Some greps do not return status, grrr.
1868 echo "grimblepritz" >grimble
1869 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1870         contains=contains
1871 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1872         contains=grep
1873 else
1874         contains=contains
1875 fi
1876 rm -f grimble
1877 : the following should work in any shell
1878 case "$contains" in
1879 contains*)
1880         echo " "
1881         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1882         cat >contains <<'EOSS'
1883 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1884 EOSS
1885 chmod +x contains
1886 esac
1887
1888 : Find the path to the source tree
1889 case "$src" in
1890 '') case "$0" in
1891     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1892          case "$src" in
1893          /*)    ;;
1894          .)     ;;
1895          *)     src=`cd ../$src && pwd` ;;
1896          esac
1897          ;;
1898     *)   src='.';;
1899     esac;;
1900 esac
1901 case "$src" in
1902 '')     src=/
1903         rsrc=/
1904         ;;
1905 /*)     rsrc="$src";;
1906 *)      rsrc="../$src";;
1907 esac
1908 if test -f $rsrc/Configure && \
1909         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1910 then
1911    : found it, so we are ok.
1912 else
1913         rsrc=''
1914         for src in . .. ../.. ../../.. ../../../..; do
1915                 if test -f ../$src/Configure && \
1916                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1917                 then
1918                         rsrc=../$src
1919                         break
1920                 fi
1921         done
1922 fi
1923 case "$rsrc" in
1924 '')
1925         cat <<EOM >&4
1926
1927 Sorry, I can't seem to locate the source dir for $package.  Please start
1928 Configure with an explicit path -- i.e. /some/path/Configure.
1929
1930 EOM
1931         exit 1
1932         ;;
1933 ../.)   rsrc='..';;
1934 *)
1935         echo " "
1936         echo "Sources for $package found in \"$src\"." >&4
1937         ;;
1938 esac
1939
1940 : script used to extract .SH files with variable substitutions
1941 cat >extract <<'EOS'
1942 PERL_CONFIG_SH=true
1943 echo "Doing variable substitutions on .SH files..."
1944 if test -f MANIFEST; then
1945         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1946 else
1947         echo "(Looking for .SH files under the source directory.)"
1948         set x `(cd "$src"; find . -name "*.SH" -print)`
1949 fi
1950 shift
1951 case $# in
1952 0) set x `(cd "$src"; echo *.SH)`; shift;;
1953 esac
1954 if test ! -f "$src/$1"; then
1955         shift
1956 fi
1957 mkdir_p='
1958 name=$1;
1959 create="";
1960 while test $name; do
1961         if test ! -d "$name"; then
1962                 create="$name $create";
1963                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1964                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1965         else
1966                 name="";
1967         fi;
1968 done;
1969 for file in $create; do
1970         mkdir $file;
1971 done
1972 '
1973 for file in $*; do
1974         case "$src" in
1975         ".")
1976                 case "$file" in
1977                 */*)
1978                         dir=`expr X$file : 'X\(.*\)/'`
1979                         file=`expr X$file : 'X.*/\(.*\)'`
1980                         (cd "$dir" && . ./$file)
1981                         ;;
1982                 *)
1983                         . ./$file
1984                         ;;
1985                 esac
1986                 ;;
1987         *)
1988                 case "$file" in
1989                 */*)
1990                         dir=`expr X$file : 'X\(.*\)/'`
1991                         file=`expr X$file : 'X.*/\(.*\)'`
1992                         (set x $dir; shift; eval $mkdir_p)
1993                         sh <"$src/$dir/$file"
1994                         ;;
1995                 *)
1996                         sh <"$src/$file"
1997                         ;;
1998                 esac
1999                 ;;
2000         esac
2001 done
2002 if test -f "$src/config_h.SH"; then
2003         if test ! -f config.h; then
2004         : oops, they left it out of MANIFEST, probably, so do it anyway.
2005         . "$src/config_h.SH"
2006         fi
2007 fi
2008 EOS
2009
2010 : extract files and exit if asked to do so
2011 case "$extractsh" in
2012 true)
2013         case "$realsilent" in
2014         true) ;;
2015         *) exec 1>&4;;
2016         esac
2017         case "$config_sh" in
2018         '') config_sh='config.sh';;
2019         esac
2020         echo " "
2021         echo "Fetching answers from $config_sh..."
2022         cd ..
2023         . $config_sh
2024         test "$override" && . ./optdef.sh
2025         echo " "
2026         . UU/extract
2027         rm -rf UU
2028         echo "Extraction done."
2029         exit 0
2030         ;;
2031 esac
2032
2033 : Eunice requires " " instead of "", can you believe it
2034 echo " "
2035 : Here we go...
2036 echo "Beginning of configuration questions for $package."
2037
2038 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2039
2040 : first determine how to suppress newline on echo command
2041 echo " "
2042 echo "Checking echo to see how to suppress newlines..."
2043 (echo "hi there\c" ; echo " ") >.echotmp
2044 if $contains c .echotmp >/dev/null 2>&1 ; then
2045         echo "...using -n."
2046         n='-n'
2047         c=''
2048 else
2049         cat <<'EOM'
2050 ...using \c
2051 EOM
2052         n=''
2053         c='\c'
2054 fi
2055 echo $n "The star should be here-->$c"
2056 echo '*'
2057 rm -f .echotmp
2058
2059 : Now test for existence of everything in MANIFEST
2060 echo " "
2061 if test -f "$rsrc/MANIFEST"; then
2062         echo "First let's make sure your kit is complete.  Checking..." >&4
2063         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2064                 (split -l 50 2>/dev/null || split -50)
2065         rm -f missing
2066         tmppwd=`pwd`
2067         for filelist in x??; do
2068                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2069                         >/dev/null 2>>"$tmppwd/missing")
2070         done
2071         if test -s missing; then
2072                 cat missing >&4
2073                 cat >&4 <<'EOM'
2074
2075 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2076
2077 You have the option of continuing the configuration process, despite the
2078 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2079 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2080 and contact the author (perlbug@perl.org).
2081
2082 EOM
2083                 echo $n "Continue? [n] $c" >&4
2084                 read ans
2085                 case "$ans" in
2086                 y*)
2087                         echo "Continuing..." >&4
2088                         rm -f missing
2089                         ;;
2090                 *)
2091                         echo "ABORTING..." >&4
2092                         kill $$
2093                         ;;
2094                 esac
2095         else
2096                 echo "Looks good..."
2097         fi
2098 else
2099         echo "There is no MANIFEST file.  I hope your kit is complete !"
2100 fi
2101 rm -f missing x??
2102
2103 : Find the appropriate value for a newline for tr
2104 echo " "
2105 if test -n "$DJGPP"; then
2106        trnl='\012'
2107 fi
2108 if test X"$trnl" = X; then
2109         case "`echo foo|tr '\n' x 2>/dev/null`" in
2110         foox) trnl='\n' ;;
2111         esac
2112 fi
2113 if test X"$trnl" = X; then
2114         case "`echo foo|tr '\012' x 2>/dev/null`" in
2115         foox) trnl='\012' ;;
2116         esac
2117 fi
2118 if test X"$trnl" = X; then
2119        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2120        fooxy) trnl='\n\r' ;;
2121        esac
2122 fi
2123 if test X"$trnl" = X; then
2124         cat <<EOM >&2
2125
2126 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2127
2128 EOM
2129         exit 1
2130 fi
2131
2132 : compute the number of columns on the terminal for proper question formatting
2133 case "$COLUMNS" in
2134 '') COLUMNS='80';;
2135 esac
2136
2137 : set up the echo used in my read
2138 myecho="case \"\$xxxm\" in
2139 '') echo $n \"\$rp $c\" >&4;;
2140 *) case \"\$rp\" in
2141         '') echo $n \"[\$xxxm] $c\";;
2142         *)
2143                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2144                         echo \"\$rp\" >&4
2145                         echo $n \"[\$xxxm] $c\" >&4
2146                 else
2147                         echo $n \"\$rp [\$xxxm] $c\" >&4
2148                 fi
2149                 ;;
2150         esac;;
2151 esac"
2152
2153 : now set up to do reads with possible shell escape and default assignment
2154 cat <<EOSC >myread
2155 $startsh
2156 xxxm=\$dflt
2157 $myecho
2158 ans='!'
2159 case "\$fastread" in
2160 yes) case "\$dflt" in
2161         '') ;;
2162         *) ans='';
2163                 case "\$silent-\$rp" in
2164                 true-) ;;
2165                 *) echo " " >&4;;
2166                 esac;;
2167         esac;;
2168 *) case "\$silent" in
2169         true) case "\$rp" in
2170                 '') ans='';;
2171                 esac;;
2172         esac;;
2173 esac
2174 while expr "X\$ans" : "X!" >/dev/null; do
2175         read answ
2176         set x \$xxxm
2177         shift
2178         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2179         case  "\$answ" in
2180         "!")
2181                 sh 1>&4
2182                 echo " "
2183                 $myecho
2184                 ;;
2185         !*)
2186                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2187                 shift
2188                 sh 1>&4 -c "\$*"
2189                 echo " "
2190                 $myecho
2191                 ;;
2192         "\$ans")
2193                 case "\$ans" in
2194                 \\&*)
2195                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2196                         shift
2197                         case "\$1" in
2198                         -d)
2199                                 fastread=yes
2200                                 echo "(OK, I'll run with -d after this question.)" >&4
2201                                 ;;
2202                         -*)
2203                                 echo "*** Sorry, \$1 not supported yet." >&4
2204                                 ;;
2205                         esac
2206                         $myecho
2207                         ans=!
2208                         ;;
2209                 esac;;
2210         *)
2211                 case "\$aok" in
2212                 y)
2213                         echo "*** Substitution done -- please confirm."
2214                         xxxm="\$ans"
2215                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2216                         xxxm="\$ans"
2217                         ans=!
2218                         ;;
2219                 *)
2220                         echo "*** Error -- try again."
2221                         ans=!
2222                         ;;
2223                 esac
2224                 $myecho
2225                 ;;
2226         esac
2227         case "\$ans\$xxxm\$nostick" in
2228         '')
2229                 ans=!
2230                 $myecho
2231                 ;;
2232         esac
2233 done
2234 case "\$ans" in
2235 '') ans="\$xxxm";;
2236 esac
2237 EOSC
2238
2239 : create .config dir to save info across Configure sessions
2240 test -d ../.config || mkdir ../.config
2241 cat >../.config/README <<EOF
2242 This directory created by Configure to save information that should
2243 persist across sessions for $package.
2244
2245 You may safely delete it if you wish.
2246 EOF
2247
2248 : See if we are using a devel version and want that
2249 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2250 case "$usedevel" in
2251 $define|true|[yY]*)
2252     usedevel="$define" ;;
2253 *) case "$xversion" in
2254    *[13579])
2255         cat >&4 <<EOH
2256 *** WHOA THERE!!! ***
2257
2258     This is an UNSTABLE DEVELOPMENT release.
2259     The version of this $package distribution is $xversion, that is, odd,
2260     (as opposed to even) and that signifies a development release.
2261     If you want a maintenance release, you want an even-numbered version.
2262
2263     Do ***NOT*** install this into production use.
2264     Data corruption and crashes are possible.
2265
2266     It is most seriously suggested that you do not continue any further
2267     unless you want to help in developing and debugging Perl.
2268
2269     If you *still* want to build perl, you can answer 'y' now,
2270     or pass -Dusedevel to Configure.
2271
2272 EOH
2273         rp='Do you really want to continue?'
2274         dflt='n'
2275         . ./myread
2276         case "$ans" in
2277         [yY]) echo >&4 "Okay, continuing."
2278               usedevel="$define" ;;
2279         *) echo >&4 "Okay, bye."
2280            exit 1
2281            ;;
2282         esac
2283         ;;
2284     esac
2285     usedevel="$undef"
2286     ;;
2287 esac
2288 case "$usedevel" in
2289 $define|true|[yY]*)
2290         case "$versiononly" in
2291         '') versiononly="$define" ;;
2292         esac
2293         case "$installusrbinperl" in
2294         '') installusrbinperl="$undef" ;;
2295         esac
2296         ;;
2297 esac
2298
2299 : general instructions
2300 needman=true
2301 firsttime=true
2302 user=`(logname) 2>/dev/null`
2303 case "$user" in
2304 '') user=`whoami 2>&1`;;
2305 esac
2306 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2307         firsttime=false
2308         echo " "
2309         rp='Would you like to see the instructions?'
2310         dflt=n
2311         . ./myread
2312         case "$ans" in
2313         [yY]*) ;;
2314         *) needman=false;;
2315         esac
2316 fi
2317 if $needman; then
2318         cat <<EOH
2319
2320 This installation shell script will examine your system and ask you questions
2321 to determine how the perl5 package should be installed. If you get
2322 stuck on a question, you may use a ! shell escape to start a subshell or
2323 execute a command.  Many of the questions will have default answers in square
2324 brackets; typing carriage return will give you the default.
2325
2326 On some of the questions which ask for file or directory names you are allowed
2327 to use the ~name construct to specify the login directory belonging to "name",
2328 even if you don't have a shell which knows about that.  Questions where this is
2329 allowed will be marked "(~name ok)".
2330
2331 EOH
2332         rp=''
2333         dflt='Type carriage return to continue'
2334         . ./myread
2335         cat <<'EOH'
2336
2337 The prompter used in this script allows you to use shell variables and
2338 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2339 in the default answer, as if the default line was a set of arguments given to a
2340 script shell.  This means you may also use $* to repeat the whole default line,
2341 so you do not have to re-type everything to add something to the default.
2342
2343 Every time there is a substitution, you will have to confirm.  If there is an
2344 error (e.g. an unmatched backtick), the default answer will remain unchanged
2345 and you will be prompted again.
2346
2347 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2348 the questions and use the computed defaults (or the previous answers if there
2349 was already a config.sh file). Type 'Configure -h' for a list of options.
2350 You may also start interactively and then answer '& -d' at any prompt to turn
2351 on the non-interactive behaviour for the remainder of the execution.
2352
2353 EOH
2354         . ./myread
2355         cat <<EOH
2356
2357 Much effort has been expended to ensure that this shell script will run on any
2358 Unix system.  If despite that it blows up on yours, your best bet is to edit
2359 Configure and run it again.  If you can't run Configure for some reason,
2360 you'll have to generate a config.sh file by hand.  Whatever problems you
2361 have, let me (perlbug@perl.org) know how I blew it.
2362
2363 This installation script affects things in two ways:
2364
2365 1) it may do direct variable substitutions on some of the files included
2366    in this kit.
2367 2) it builds a config.h file for inclusion in C programs.  You may edit
2368    any of these files as the need arises after running this script.
2369
2370 If you make a mistake on a question, there is no easy way to back up to it
2371 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2372 files.  Configure will offer to let you do this before it runs the SH files.
2373
2374 EOH
2375         dflt='Type carriage return to continue'
2376         . ./myread
2377         case "$firsttime" in
2378         true) echo $user >>../.config/instruct;;
2379         esac
2380 fi
2381
2382 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2383 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2384 if test "X$sysroot" = X; then
2385     sysroot=""
2386 else
2387     case "$cc" in
2388         *gcc*|*g++*)
2389             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2390             # _sysroot is used in places where we need --sysroot=foo
2391             # but using the rest of the flags could cause issues.
2392             _sysroot="--sysroot=$sysroot";
2393             case "$ccflags" in
2394                 *sysroot*) ;;
2395                 'undef'|*)
2396                 ccflags="$ccflags $_sysroot"
2397             esac
2398             case "$ldflags" in
2399                 *sysroot*) ;;
2400                 'undef'|*)
2401                 ldflags="$ldflags $_sysroot"
2402             esac
2403             case "$cppflags" in
2404                 *sysroot*) ;;
2405                 'undef'|*)
2406                 cppflags="$cppflags $_sysroot"
2407             esac
2408             # lddlflags updated below in lddlflags section;
2409             # same with cccdlflags
2410             ;;
2411     esac
2412
2413     # Adjust some defaults to also use $sysroot
2414     for var in xlibpth loclibpth locincpth glibpth; do
2415         eval xxx=\$$var
2416         eval $var=''
2417         for path in $xxx; do
2418             eval $var=\"\$$var $sysroot$path\"
2419         done
2420     done
2421
2422 fi
2423
2424 : find out where common programs are
2425 echo " "
2426 echo "Locating common programs..." >&4
2427 cat <<EOSC >loc
2428 $startsh
2429 case \$# in
2430 0) exit 1;;
2431 esac
2432 thing=\$1
2433 shift
2434 dflt=\$1
2435 shift
2436 for dir in \$*; do
2437         case "\$thing" in
2438         .)
2439         if test -d \$dir/\$thing; then
2440                 echo \$dir
2441                 exit 0
2442         fi
2443         ;;
2444         *)
2445         for thisthing in \$dir/\$thing; do
2446                 : just loop through to pick last item
2447         done
2448         if test -f \$thisthing; then
2449                 echo \$thisthing
2450                 exit 0
2451         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2452                 echo \$thisthing
2453                 exit 0
2454         elif test -f \$dir/\$thing.exe; then
2455                 if test -n "$DJGPP"; then
2456                         echo \$dir/\$thing.exe
2457                 elif test "$eunicefix" != ":"; then
2458                         : on Eunice apparently
2459                         echo \$dir/\$thing
2460                 fi
2461                 exit 0
2462         fi
2463         ;;
2464         esac
2465 done
2466 echo \$dflt
2467 exit 1
2468 EOSC
2469 chmod +x loc
2470 $eunicefix loc
2471 loclist="
2472 awk
2473 cat
2474 chmod
2475 comm
2476 cp
2477 echo
2478 expr
2479 grep
2480 ls
2481 mkdir
2482 rm
2483 sed
2484 sort
2485 touch
2486 tr
2487 uniq
2488 "
2489 trylist="
2490 ar
2491 bison
2492 byacc
2493 cpp
2494 csh
2495 date
2496 egrep
2497 gmake
2498 gzip
2499 less
2500 ln
2501 make
2502 more
2503 nm
2504 nroff
2505 perl
2506 pg
2507 test
2508 uname
2509 zip
2510 "
2511 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2512 pth="$pth $sysroot/lib $sysroot/usr/lib"
2513 for file in $loclist; do
2514         eval xxx=\$$file
2515         case "$xxx" in
2516         /*|?:[\\/]*)
2517                 if test -f "$xxx"; then
2518                         : ok
2519                 else
2520                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2521                         xxx=`./loc $file $file $pth`
2522                 fi
2523                 ;;
2524         '') xxx=`./loc $file $file $pth`;;
2525         *) xxx=`./loc $xxx $xxx $pth`;;
2526         esac
2527         eval $file=$xxx$_exe
2528         eval _$file=$xxx
2529         case "$xxx" in
2530         /*)
2531                 echo $file is in $xxx.
2532                 ;;
2533         ?:[\\/]*)
2534                 echo $file is in $xxx.
2535                 ;;
2536         *)
2537                 echo "I don't know where '$file' is, and my life depends on it." >&4
2538                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2539                 exit 1
2540                 ;;
2541         esac
2542 done
2543 echo " "
2544 echo "Don't worry if any of the following aren't found..."
2545 say=offhand
2546 for file in $trylist; do
2547         eval xxx=\$$file
2548         case "$xxx" in
2549         /*|?:[\\/]*)
2550                 if test -f "$xxx"; then
2551                         : ok
2552                 else
2553                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2554                         xxx=`./loc $file $file $pth`
2555                 fi
2556                 ;;
2557         '') xxx=`./loc $file $file $pth`;;
2558         *) xxx=`./loc $xxx $xxx $pth`;;
2559         esac
2560         eval $file=$xxx$_exe
2561         eval _$file=$xxx
2562         case "$xxx" in
2563         /*)
2564                 echo $file is in $xxx.
2565                 ;;
2566         ?:[\\/]*)
2567                 echo $file is in $xxx.
2568                 ;;
2569         *)
2570                 echo "I don't see $file out there, $say."
2571                 say=either
2572                 ;;
2573         esac
2574 done
2575 case "$egrep" in
2576 egrep)
2577         echo "Substituting grep for egrep."
2578         egrep=$grep
2579         _egrep=$grep
2580         ;;
2581 esac
2582 case "$less" in
2583 '')     ;;
2584 *)      if $less -R </dev/null >/dev/null 2>&1; then
2585                echo "Substituting less -R for less."
2586                less="$less -R"
2587                _less=$less
2588         fi
2589         ;;
2590 esac
2591 case "$ln" in
2592 ln)
2593         echo "Substituting cp for ln."
2594         ln=$cp
2595         _ln=$cp
2596         ;;
2597 esac
2598 case "$make" in
2599 make)
2600         case "$gmake" in
2601         gmake)
2602         echo "I can't find make or gmake, and my life depends on it." >&4
2603         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2604         exit 1
2605         ;;
2606         esac
2607         ;;
2608 esac
2609 case "$gmake" in
2610 gmake)  ;;
2611 *)      # We can't have osname yet.
2612         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2613                 # Assume that gmake, if found, is definitely GNU make
2614                 # and prefer it over the system make.
2615                 echo "Substituting gmake for make."
2616                 make=$gmake
2617                 _make=$gmake
2618         fi
2619         ;;
2620 esac
2621 case "$test" in
2622 test)
2623         echo "Hopefully test is built into your sh."
2624         ;;
2625 *)
2626         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2627                 echo "Using the test built into your sh."
2628                 test=test
2629                 _test=test
2630         fi
2631         ;;
2632 esac
2633 case "$echo" in
2634 echo)
2635         echo "Hopefully echo is built into your sh."
2636         ;;
2637 '') ;;
2638 *)
2639         echo " "
2640 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2641         $echo $n "hi there$c" >foo1
2642         echo $n "hi there$c" >foo2
2643         if cmp foo1 foo2 >/dev/null 2>&1; then
2644                 echo "They are compatible.  In fact, they may be identical."
2645         else
2646                 case "$n" in
2647                 '-n') n='' c='\c';;
2648                 *) n='-n' c='';;
2649                 esac
2650                 cat <<FOO
2651 They are not compatible!  You are probably running ksh on a non-USG system.
2652 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2653 have echo built in and we may have to run some Bourne shell scripts.  That
2654 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2655
2656 FOO
2657                 $echo $n "The star should be here-->$c"
2658                 $echo "*"
2659         fi
2660         $rm -f foo1 foo2
2661         ;;
2662 esac
2663
2664 # This question was auctioned at YAPC::Europe-2007 in Vienna
2665 # I never promised you could answer it. I only auctioned the question.
2666 cat <<FOO
2667 The following message is sponsored by
2668
2669   Dresden.pm<--The stars should be here.
2670
2671 Dear Perl user, system administrator or package
2672 maintainer, the Perl community sends greetings to
2673 you. Do you (emblematical) greet back [Y/n]? n
2674
2675 FOO
2676
2677 : Check what type of C compiler we use
2678 cat <<EOS >trygcc
2679 $startsh
2680 EOS
2681 cat <<'EOSC' >>trygcc
2682 case "$cc" in
2683 '') ;;
2684 *)  $rm -f try try.*
2685     $cat >try.c <<EOM
2686 int main(int argc, char *argv[]) {
2687   return 0;
2688 }
2689 EOM
2690     if $cc -o try $ccflags $ldflags try.c; then
2691        :
2692     else
2693         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2694         despair=yes
2695         trygcc=yes
2696         case "$cc" in
2697         *gcc*) trygcc=no ;;
2698         esac
2699         # Skip this test because it gives a false match on output like:
2700         #    ./trygcc: line 23: cc: command not found
2701         # case "`$cc -v -c try.c 2>&1`" in
2702         # *gcc*) trygcc=no ;;
2703         # esac
2704         if $test X"$trygcc" = Xyes; then
2705             if gcc -o try -c try.c; then
2706                 echo " "
2707                 echo "You seem to have a working gcc, though." >&4
2708                 # Switching compilers may undo the work of hints files.
2709                 # The most common problem is -D_REENTRANT for threads.
2710                 # This heuristic catches that case, but gets false positives
2711                 # if -Dusethreads was not actually specified.  Better to
2712                 # bail out here with a useful message than fail
2713                 # mysteriously later. Should we perhaps just try to
2714                 # re-invoke Configure -Dcc=gcc config_args ?
2715                 if $test -f usethreads.cbu; then
2716                         $cat >&4 <<EOM
2717
2718 *** However, any setting of the C compiler flags (e.g. for thread support)
2719 *** will be lost.  It may be necessary for you to restart Configure and
2720 *** add -Dcc=gcc to your Configure command line.
2721
2722 EOM
2723                         rp="Would you like to go ahead and try gcc anyway?"
2724                         dflt=n
2725                 else
2726                         rp="Would you like to use it?"
2727                         dflt=y
2728                 fi
2729                 if $test -f myread; then
2730                     . ./myread
2731                 else
2732                     if $test -f UU/myread; then
2733                         . ./UU/myread
2734                     else
2735                         echo "Cannot find myread, sorry.  Aborting." >&2
2736                         exit 1
2737                     fi
2738                 fi
2739                 case "$ans" in
2740                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2741                 esac
2742             fi
2743         fi
2744     fi
2745     $rm -f try try.*
2746     ;;
2747 esac
2748 EOSC
2749
2750 cat <<EOS >checkcc
2751 $startsh
2752 EOS
2753 cat <<'EOSC' >>checkcc
2754 case "$cc" in
2755 '') ;;
2756 *)  $rm -f try try.*
2757     $cat >try.c <<EOM
2758 int main(int argc, char *argv[]) {
2759   return 0;
2760 }
2761 EOM
2762     if $cc -o try $ccflags $ldflags try.c; then
2763        :
2764     else
2765         if $test X"$despair" = Xyes; then
2766            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2767         fi
2768         $cat >&4 <<EOM
2769 You need to find a working C compiler.
2770 Either (purchase and) install the C compiler supplied by your OS vendor,
2771 or for a free C compiler try http://gcc.gnu.org/
2772 I cannot continue any further, aborting.
2773 EOM
2774         exit 1
2775     fi
2776     $rm -f try try.*
2777     ;;
2778 esac
2779 EOSC
2780
2781 : determine whether symbolic links are supported
2782 echo " "
2783 $touch blurfl
2784 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2785         echo "Symbolic links are supported." >&4
2786         lns="$ln -s"
2787 else
2788         echo "Symbolic links are NOT supported." >&4
2789         lns="$ln"
2790 fi
2791 $rm -f blurfl sym
2792
2793 : determine whether symbolic links are supported
2794 echo " "
2795 case "$lns" in
2796 *"ln"*" -s")
2797         echo "Checking how to test for symbolic links..." >&4
2798         $lns blurfl sym
2799         if $test "X$issymlink" = X; then
2800                 case "$newsh" in
2801                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2802                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2803                 esac
2804                 if test $? = 0; then
2805                         issymlink="test -h"
2806                 else
2807                         echo "Your builtin 'test -h' may be broken." >&4
2808                         case "$test" in
2809                         /*)     ;;
2810                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2811                                 for p in $pth
2812                                 do
2813                                         if test -f "$p/$test"; then
2814                                                 test="$p/$test"
2815                                                 break
2816                                         fi
2817                                 done
2818                                 ;;
2819                         esac
2820                         case "$test" in
2821                         /*)
2822                                 echo "Trying external '$test -h'." >&4
2823                                 issymlink="$test -h"
2824                                 if $test ! -h sym >/dev/null 2>&1; then
2825                                         echo "External '$test -h' is broken, too." >&4
2826                                         issymlink=''
2827                                 fi
2828                                 ;;
2829                         *)      issymlink='' ;;
2830                         esac
2831                 fi
2832         fi
2833         if $test "X$issymlink" = X; then
2834                 if $test -L sym 2>/dev/null; then
2835                         issymlink="$test -L"
2836                         echo "The builtin '$test -L' worked." >&4
2837                 fi
2838         fi
2839         if $test "X$issymlink" != X; then
2840                 echo "You can test for symbolic links with '$issymlink'." >&4
2841         else
2842                 echo "I do not know how you can test for symbolic links." >&4
2843         fi
2844         $rm -f blurfl sym
2845         ;;
2846 *)      echo "No symbolic links, so not testing for their testing..." >&4
2847         ;;
2848 esac
2849 echo " "
2850
2851 : Make symlinks util
2852 case "$mksymlinks" in
2853 $define|true|[yY]*)
2854         case "$src" in
2855         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2856                 exit 1
2857                 ;;
2858         *)      case "$lns:$issymlink" in
2859                 *"ln"*" -s:"*"test -"?)
2860                         echo "Creating the symbolic links..." >&4
2861                         cd ..
2862                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2863                         awk 'NF == 1 {
2864                                 dir=".";
2865                                 file=$1 "";
2866                              }
2867                              NF == 2 {
2868                                 dir=$1 "";
2869                                 file=$2 "";
2870                              }
2871                              {
2872                                  print "# dir = ", dir, "file = ", file
2873                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2874                              } END {
2875                                  for (d in mf) {
2876                                      if (d != ".") { print("mkdir -p "d) }
2877                                      print("ln -sf "mf[d]" "d);
2878                                  }
2879                              }' source="$src" > UU/mksymlinks.$$
2880                         sh UU/mksymlinks.$$
2881                         rm UU/mksymlinks.$$
2882                         # Sanity check 1.
2883                         if test ! -d t/base; then
2884                                 echo "Failed to create the subdirectories.  Aborting." >&4
2885                                 exit 1
2886                         fi
2887                         # Sanity check 2.
2888                         if test ! -f t/base/lex.t; then
2889                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2890                                 exit 1
2891                         fi
2892                         if test ! -f win32/win32.c; then
2893                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2894                                 exit 1
2895                         fi
2896                         cd UU
2897                         ;;
2898                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2899                         ;;
2900                 esac
2901                 ;;
2902         esac
2903         ;;
2904 esac
2905
2906 : Check for Cross-Compilation
2907 if $test "X$targethost" = "X"; then
2908     targethost=""
2909 fi
2910 if $test "X$targetenv" = "X"; then
2911     targetenv=""
2912 fi
2913 case "$usecrosscompile" in
2914 $define|true|[yY]*)
2915         $echo "Cross-compiling..."
2916         croak=''
2917         case "$cc" in
2918         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2919             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2920             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2921             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2922             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2923             # leave out ld, choosing it is more complex
2924             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2925             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2926             # We are in a weird spot. Just before us, some values
2927             # were 'saved', to be restored after the hints are
2928             # run.  This means that the changes we made to ar,
2929             # nm and ranlib will get reverted.
2930             # To avoid that, we hijack the saving mechanism and
2931             # have it save our new values.
2932             for file in ar nm ranlib; do
2933                 eval xxx=\$$file
2934                 eval $file=$xxx$_exe
2935                 eval _$file=$xxx
2936             done
2937         ;;
2938         esac
2939         case "$targetarch" in
2940         '') echo "Targetarch not defined." >&4; croak=y ;;
2941         *)  echo "Using targetarch $targetarch." >&4 ;;
2942         esac
2943         case "$targethost" in
2944         '') echo "Targethost not defined." >&4; croak=y ;;
2945         *)  echo "Using targethost $targethost." >&4
2946         esac
2947         locincpth=' '
2948         loclibpth=' '
2949         case "$croak" in
2950         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2951         esac
2952     : compile a host miniperl and generate_uudmap, unless we got passed them
2953     if $test "X$hostperl" = X; then
2954       echo "Building host miniperl and generate_uudmap binaries" >&4
2955       before_host=`pwd`
2956       cd ..
2957       cd $src
2958       src=`pwd`
2959       rm -rf $src/host
2960       mkdir $src/host
2961       cd $src/host
2962       $src/Configure -des -Dusedevel -Dmksymlinks
2963       $make miniperl
2964       case "$hostgenerate" in
2965       '') $make generate_uudmap
2966           hostgenerate=$src/host/generate_uudmap
2967           ;;
2968        "$undef") hostgenerate=''
2969           ;;
2970       esac
2971       hostperl=$src/host/miniperl
2972       cd $before_host
2973     fi
2974     hostosname=`$hostperl -le 'print $^O'`
2975     ;;
2976 *)
2977     usecrosscompile="$undef"
2978     ;;
2979 esac
2980
2981 : Define -Dtargethost=somecomputer to run compiled tests on another machine
2982 case "$targethost" in
2983     '') echo "Checking for cross-compile" >&4
2984     case "$usecrosscompile$multiarch" in
2985        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
2986          if [ -f Makefile ]; then
2987            echo " "
2988            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
2989          else
2990            echo "Configure done."
2991          fi
2992        exit 0
2993        ;;
2994      *) echo "No targethost for running compiler tests against defined, running locally" >&4
2995         run=''
2996         to=:
2997         from=:
2998         ;;
2999     esac
3000     ;;
3001     *) echo "Using targethost $targethost." >&4
3002         case "$src" in
3003         /*) run=$src/Cross/run
3004             targetmkdir=$src/Cross/mkdir
3005             to=$src/Cross/to
3006             from=$src/Cross/from
3007             ;;
3008         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3009             run=$pwd/Cross/run
3010             targetmkdir=$pwd/Cross/mkdir
3011             to=$pwd/Cross/to
3012             from=$pwd/Cross/from
3013             ;;
3014         esac
3015         case "$targetrun" in
3016         '') targetrun=ssh ;;
3017         esac
3018         case "$targetto" in
3019         '') targetto=scp ;;
3020         esac
3021         case "$targetfrom" in
3022         '') targetfrom=scp ;;
3023         esac
3024         run=$run-$targetrun
3025         to=$to-$targetto
3026         from=$from-$targetfrom
3027         case "$targetdir" in
3028         '')  targetdir=/tmp
3029              echo "Guessing targetdir $targetdir." >&4
3030              ;;
3031         esac
3032         case "$targetuser" in
3033         '')  targetuser=root
3034              echo "Guessing targetuser $targetuser." >&4
3035              ;;
3036         esac
3037         case "$targetport" in
3038         '')  targetport=22
3039              echo "Guessing targetport $targetport." >&4
3040              ;;
3041         esac
3042         case "$targetfrom" in
3043         scp)    q=-q ;;
3044         *)      q='' ;;
3045         esac
3046         case "$targetrun" in
3047         ssh|rsh)
3048             cat >$run <<EOF
3049 #!/bin/sh
3050 env=''
3051 case "\$1" in
3052 -cwd)
3053   shift
3054   cwd=\$1
3055   shift
3056   ;;
3057 esac
3058 case "\$1" in
3059 -env)
3060   shift
3061   env=\$1
3062   shift
3063   ;;
3064 esac
3065 case "\$cwd" in
3066 '') cwd=$targetdir ;;
3067 esac
3068 exe=\$1
3069 shift
3070 $to \$exe
3071 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3072 EOF
3073             ;;
3074         adb)
3075             $touch $run
3076             ;;
3077         *)  echo "Unknown targetrun '$targetrun'" >&4
3078             exit 1
3079             ;;
3080         esac
3081         case "$targetmkdir" in
3082         */Cross/mkdir)
3083             cat >$targetmkdir <<EOF
3084 #!/bin/sh
3085 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3086 EOF
3087             $chmod a+rx $targetmkdir
3088             ;;
3089         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3090             exit 1
3091             ;;
3092         esac
3093         case "$targetto" in
3094         scp|rcp)
3095             cat >$to <<EOF
3096 #!/bin/sh
3097 for f in \$@
3098 do
3099   case "\$f" in
3100   /*)
3101     $targetmkdir \`dirname \$f\`
3102     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3103     ;;
3104   *)
3105     $targetmkdir $targetdir/\`dirname \$f\`
3106     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3107     ;;
3108   esac
3109 done
3110 exit 0
3111 EOF
3112             ;;
3113         cp) cat >$to <<EOF
3114 #!/bin/sh
3115 for f in \$@
3116 do
3117   case "\$f" in
3118   /*)
3119     $mkdir -p $targetdir/\`dirname \$f\`
3120     $cp \$f $targetdir/\$f || exit 1
3121     ;;
3122   *)
3123     $targetmkdir $targetdir/\`dirname \$f\`
3124     $cp \$f $targetdir/\$f || exit 1
3125     ;;
3126   esac
3127 done
3128 exit 0
3129 EOF
3130             ;;
3131         *)  echo "Unknown targetto '$targetto'" >&4
3132             exit 1
3133             ;;
3134         esac
3135         case "$targetfrom" in
3136         scp|rcp)
3137           cat >$from <<EOF
3138 #!/bin/sh
3139 for f in \$@
3140 do
3141   $rm -f \$f
3142   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3143 done
3144 exit 0
3145 EOF
3146             ;;
3147         cp) cat >$from <<EOF
3148 #!/bin/sh
3149 for f in \$@
3150 do
3151   $rm -f \$f
3152   cp $targetdir/\$f . || exit 1
3153 done
3154 exit 0
3155 EOF
3156             ;;
3157         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3158             exit 1
3159             ;;
3160         esac
3161         if $test ! -f $run; then
3162             echo "Target 'run' script '$run' not found." >&4
3163         else
3164             $chmod a+rx $run
3165         fi
3166         if $test ! -f $to; then
3167             echo "Target 'to' script '$to' not found." >&4
3168         else
3169             $chmod a+rx $to
3170         fi
3171         if $test ! -f $from; then
3172             echo "Target 'from' script '$from' not found." >&4
3173         else
3174             $chmod a+rx $from
3175         fi
3176         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3177             exit 1
3178         fi
3179         cat >&4 <<EOF
3180 Using '$run' for remote execution,
3181 and '$from' and '$to'
3182 for remote file transfer.
3183 EOF
3184         ;;
3185 *)      run=''
3186         to=:
3187         from=:
3188         usecrosscompile="$undef"
3189         targetarch=''
3190         ;;
3191 esac
3192
3193 : see whether [:lower:] and [:upper:] are supported character classes
3194 echo " "
3195 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3196 ABYZ)
3197         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3198         up='[:upper:]'
3199         low='[:lower:]'
3200         ;;
3201 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3202         # (0xd9 and 0xe2), therefore that is a nice testing point.
3203         if test "X$up" = X -o "X$low" = X; then
3204             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3205             rs) up='[A-Z]'
3206                 low='[a-z]'
3207                 ;;
3208             esac
3209         fi
3210         if test "X$up" = X -o "X$low" = X; then
3211             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3212             rs) up='A-Z'
3213                 low='a-z'
3214                 ;;
3215             esac
3216         fi
3217         if test "X$up" = X -o "X$low" = X; then
3218             case "`echo RS | od -x 2>/dev/null`" in
3219             *D9E2*|*d9e2*)
3220                 echo "Hey, this might be EBCDIC." >&4
3221                 if test "X$up" = X -o "X$low" = X; then
3222                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3223                     rs) up='[A-IJ-RS-Z]'
3224                         low='[a-ij-rs-z]'
3225                         ;;
3226                     esac
3227                 fi
3228                 if test "X$up" = X -o "X$low" = X; then
3229                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3230                     rs) up='A-IJ-RS-Z'
3231                         low='a-ij-rs-z'
3232                         ;;
3233                     esac
3234                 fi
3235                 ;;
3236             esac
3237         fi
3238 esac
3239 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3240 rs)
3241     echo "Using $up and $low to convert case." >&4
3242     ;;
3243 *)
3244     echo "I don't know how to translate letters from upper to lower case." >&4
3245     echo "Your tr is not acting any way I know of." >&4
3246     exit 1
3247     ;;
3248 esac
3249 : set up the translation script tr, must be called with ./tr of course
3250 cat >tr <<EOSC
3251 $startsh
3252 case "\$1\$2" in
3253 '[A-Z][a-z]') exec $tr '$up' '$low';;
3254 '[a-z][A-Z]') exec $tr '$low' '$up';;
3255 esac
3256 exec $tr "\$@"
3257 EOSC
3258 chmod +x tr
3259 $eunicefix tr
3260
3261 : Try to determine whether config.sh was made on this system
3262 case "$config_sh" in
3263 '')
3264 myuname=`$uname -a 2>/dev/null`
3265 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3266 # Downcase everything to avoid ambiguity.
3267 # Remove slashes and single quotes so we can use parts of this in
3268 # directory and file names.
3269 # Remove newlines so myuname is sane to use elsewhere.
3270 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3271 # because the A-Z/a-z are not consecutive.
3272 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3273         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3274 newmyuname="$myuname"
3275 dflt=n
3276 case "$knowitall" in
3277 '')
3278         if test -f ../config.sh; then
3279                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3280                         eval "`grep myuname= ../config.sh`"
3281                 fi
3282                 if test "X$myuname" = "X$newmyuname"; then
3283                         dflt=y
3284                 fi
3285         fi
3286         ;;
3287 *) dflt=y;;
3288 esac
3289
3290 : Get old answers from old config file if Configure was run on the
3291 : same system, otherwise use the hints.
3292 hint=default
3293 cd ..
3294 if test -f config.sh; then
3295         echo " "
3296         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3297         . UU/myread
3298         case "$ans" in
3299         n*|N*) echo "OK, I'll ignore it."
3300                 mv config.sh config.sh.old
3301                 myuname="$newmyuname"
3302                 ;;
3303         *)  echo "Fetching default answers from your old config.sh file..." >&4
3304                 tmp_n="$n"
3305                 tmp_c="$c"
3306                 tmp_sh="$sh"
3307                 . ./config.sh
3308                 cp config.sh UU
3309                 n="$tmp_n"
3310                 c="$tmp_c"
3311                 : Older versions did not always set $sh.  Catch re-use of such
3312                 : an old config.sh.
3313                 case "$sh" in
3314                 '') sh="$tmp_sh" ;;
3315                 esac
3316                 hint=previous
3317                 ;;
3318         esac
3319 fi
3320 . ./UU/checkcc
3321 if test ! -f config.sh; then
3322         $cat <<EOM
3323
3324 First time through, eh?  I have some defaults handy for some systems
3325 that need some extra help getting the Configure answers right:
3326
3327 EOM
3328         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3329         dflt=''
3330         : Half the following guesses are probably wrong... If you have better
3331         : tests or hints, please send them to perlbug@perl.org
3332         : The metaconfig authors would also appreciate a copy...
3333         $test -f /irix && osname=irix
3334         $test -f /xenix && osname=sco_xenix
3335         $test -f /dynix && osname=dynix
3336         $test -f /dnix && osname=dnix
3337         $test -f /lynx.os && osname=lynxos
3338         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3339         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3340         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3341         $test -f /bin/mips && /bin/mips && osname=mips
3342         $test -d /usr/apollo/bin && osname=apollo
3343         $test -f /etc/saf/_sactab && osname=svr4
3344         $test -d /usr/include/minix && osname=minix
3345         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3346         if $test -d /MachTen -o -d /MachTen_Folder; then
3347                 osname=machten
3348                 if $test -x /sbin/version; then
3349                         osvers=`/sbin/version | $awk '{print $2}' |
3350                         $sed -e 's/[A-Za-z]$//'`
3351                 elif $test -x /usr/etc/version; then
3352                         osvers=`/usr/etc/version | $awk '{print $2}' |
3353                         $sed -e 's/[A-Za-z]$//'`
3354                 else
3355                         osvers="$2.$3"
3356                 fi
3357         fi
3358
3359         $test -f /sys/posix.dll &&
3360                 $test -f /usr/bin/what &&
3361                 set X `/usr/bin/what /sys/posix.dll` &&
3362                 $test "$3" = UWIN &&
3363                 osname=uwin &&
3364                 osvers="$5"
3365
3366         if $test -f $uname; then
3367                 set X $myuname
3368                 shift
3369
3370                 case "$5" in
3371                 fps*) osname=fps ;;
3372                 mips*)
3373                         case "$4" in
3374                         umips) osname=umips ;;
3375                         *) osname=mips ;;
3376                         esac;;
3377                 [23]100) osname=mips ;;
3378                 i386*)
3379                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3380                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3381                                 osname='sco'
3382                                 osvers=$tmp
3383                         elif $test -f /etc/kconfig; then
3384                                 osname=isc
3385                                 if test "$lns" = "$ln -s"; then
3386                                         osvers=4
3387                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3388                                         osvers=3
3389                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3390                                         osvers=2
3391                                 fi
3392                         fi
3393                         tmp=''
3394                         ;;
3395                 pc*)
3396                         if test -n "$DJGPP"; then
3397                                 osname=dos
3398                                 osvers=djgpp
3399                         fi
3400                         ;;
3401                 esac
3402
3403                 case "$1" in
3404                 aix) osname=aix
3405                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3406                         case "$tmp" in
3407                         # oslevel can fail with:
3408                         # oslevel: Unable to acquire lock.
3409                         *not\ found) osvers="$4"."$3" ;;
3410                         '<3240'|'<>3240') osvers=3.2.0 ;;
3411                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3412                         '=3250'|'>3250') osvers=3.2.5 ;;
3413                         *) osvers=$tmp;;
3414                         esac
3415                         ;;
3416                 bitrig) osname=bitrig
3417                         osvers="$3"
3418                         ;;
3419                 bsd386) osname=bsd386
3420                         osvers=`$uname -r`
3421                         ;;
3422                 cygwin*) osname=cygwin
3423                         osvers="$3"
3424                         ;;
3425                 *dc.osx) osname=dcosx
3426                         osvers="$3"
3427                         ;;
3428                 dnix) osname=dnix
3429                         osvers="$3"
3430                         ;;
3431                 domainos) osname=apollo
3432                         osvers="$3"
3433                         ;;
3434                 dgux)   osname=dgux
3435                         osvers="$3"
3436                         ;;
3437                 dragonfly) osname=dragonfly
3438                         osvers="$3"
3439                         ;;
3440                 dynixptx*) osname=dynixptx
3441                         osvers=`echo "$4"|sed 's/^v//'`
3442                         ;;
3443                 freebsd) osname=freebsd
3444                         osvers="$3" ;;
3445                 genix)  osname=genix ;;
3446                 gnu)    osname=gnu
3447                         osvers="$3" ;;
3448                 hp*)    osname=hpux
3449                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3450                         ;;
3451                 irix*)  osname=irix
3452                         case "$3" in
3453                         4*) osvers=4 ;;
3454                         5*) osvers=5 ;;
3455                         *)      osvers="$3" ;;
3456                         esac
3457                         ;;
3458                 linux)  osname=linux
3459                         case "$3" in
3460                         *)      osvers="$3" ;;
3461                         esac
3462                         $test -f /system/lib/libandroid.so && osname=linux-android
3463                         ;;
3464                 MiNT)   osname=mint
3465                         ;;
3466                 netbsd*) osname=netbsd
3467                         osvers="$3"
3468                         ;;
3469                 news-os) osvers="$3"
3470                         case "$3" in
3471                         4*) osname=newsos4 ;;
3472                         *) osname=newsos ;;
3473                         esac
3474                         ;;
3475                 nonstop-ux) osname=nonstopux ;;
3476                 openbsd) osname=openbsd
3477                         osvers="$3"
3478                         ;;
3479                 os2)    osname=os2
3480                         osvers="$4"
3481                         ;;
3482                 POSIX-BC | posix-bc ) osname=posix-bc
3483                         osvers="$3"
3484                         ;;
3485                 powerux | power_ux | powermax_os | powermaxos | \
3486                 powerunix | power_unix) osname=powerux
3487                         osvers="$3"
3488                         ;;
3489                 qnx) osname=qnx
3490                         osvers="$4"
3491                         ;;
3492                 solaris) osname=solaris
3493                         case "$3" in
3494                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3495                         *)      osvers="$3" ;;
3496                         esac
3497                         ;;
3498                 sunos) osname=sunos
3499                         case "$3" in
3500                         5*) osname=solaris
3501                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3502                         *)      osvers="$3" ;;
3503                         esac
3504                         ;;
3505                 titanos) osname=titanos
3506                         case "$3" in
3507                         1*) osvers=1 ;;
3508                         2*) osvers=2 ;;
3509                         3*) osvers=3 ;;
3510                         4*) osvers=4 ;;
3511                         *)      osvers="$3" ;;
3512                         esac
3513                         ;;
3514                 ultrix) osname=ultrix
3515                         osvers="$3"
3516                         ;;
3517                 osf1|mls+)      case "$5" in
3518                                 alpha)
3519                                         osname=dec_osf
3520                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3521                                         case "$osvers" in
3522                                         [1-9].[0-9]*) ;;
3523                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3524                                         esac
3525                                         ;;
3526                         hp*)    osname=hp_osf1  ;;
3527                         mips)   osname=mips_osf1 ;;
3528                         esac
3529                         ;;
3530                 # UnixWare 7.1.2 is known as Open UNIX 8
3531                 openunix|unixware) osname=svr5
3532                         osvers="$4"
3533                         ;;
3534                 uts)    osname=uts
3535                         osvers="$3"
3536                         ;;
3537                 vos) osvers="$3"
3538                         ;;
3539                 $2) case "$osname" in
3540                         *isc*) ;;
3541                         *freebsd*) ;;
3542                         svr*)
3543                                 : svr4.x or possibly later
3544                                 case "svr$3" in
3545                                 ${osname}*)
3546                                         osname=svr$3
3547                                         osvers=$4
3548                                         ;;
3549                                 esac
3550                                 case "$osname" in
3551                                 svr4.0)
3552                                         : Check for ESIX
3553                                         if test -f /stand/boot ; then
3554                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3555                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3556                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3557                                                         if test -n "$isesix"; then
3558                                                                 osname=esix4
3559                                                         fi
3560                                                 fi
3561                                         fi
3562                                         ;;
3563                                 esac
3564                                 ;;
3565                         *)      if test -f /etc/systemid; then
3566                                         osname=sco
3567                                         set `echo $3 | $sed 's/\./ /g'` $4
3568                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3569                                                 osvers=$1.$2.$3
3570                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3571                                                 osvers=$1.$2
3572                                         elif $test -f $src/hints/sco_$1.sh; then
3573                                                 osvers=$1
3574                                         fi
3575                                 else
3576                                         case "$osname" in
3577                                         '') : Still unknown.  Probably a generic Sys V.
3578                                                 osname="sysv"
3579                                                 osvers="$3"
3580                                                 ;;
3581                                         esac
3582                                 fi
3583                                 ;;
3584                         esac
3585                         ;;
3586                 *)      case "$osname" in
3587                         '') : Still unknown.  Probably a generic BSD.
3588                                 osname="$1"
3589                                 osvers="$3"
3590                                 ;;
3591                         esac
3592                         ;;
3593                 esac
3594         else
3595                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3596                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3597                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3598                                 osname=news_os
3599                         fi
3600                         $rm -f UU/kernel.what
3601                 elif test -d c:/. -o -n "$is_os2" ; then
3602                         set X $myuname
3603                         osname=os2
3604                         osvers="$5"
3605                 fi
3606         fi
3607
3608         case "$targetarch" in
3609         '') ;;
3610         *)  hostarch=$osname
3611             case "$targetarch" in
3612                 nto*|*-nto-*)
3613                     # Will load qnx.sh, which should change osname to nto
3614                     osname=qnx
3615                     osvers=''
3616                     ;;
3617                 *linux-android*)
3618                     # Catch arm-linux-androideabi, mipsel-linux-android,
3619                     # and i686-linux-android
3620                     osname=linux-android
3621                     osvers=''
3622                     ;;
3623                 *linux*)
3624                     # Something like arm-linux-gnueabihf is really just
3625                     # plain linux.
3626                     osname=linux
3627                     osvers=''
3628                     ;;
3629                 *solaris*|*sunos*)
3630                     osname=solaris
3631                     # XXX perhaps we should just assume
3632                     # osvers to be 2, or maybe take the value
3633                     # from targetarch. Using $run before the
3634                     # hints are run is somewhat icky.
3635                     set X `$run $uname -a 2>/dev/null`
3636                     shift
3637                     case "$3" in
3638                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3639                         *)  osvers="$3" ;;
3640                     esac
3641                     ;;
3642                 *)
3643                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3644                     osvers=''
3645                 ;;
3646             esac
3647             ;;
3648         esac
3649
3650         : Now look for a hint file osname_osvers, unless one has been
3651         : specified already.
3652         case "$hintfile" in
3653         ''|' ')
3654                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3655                 : Also try without trailing minor version numbers.
3656                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3657                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3658                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3659                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3660                 case "$file" in
3661                 '') dflt=none ;;
3662                 *)  case "$osvers" in
3663                         '') dflt=$file
3664                                 ;;
3665                         *)  if $test -f $src/hints/$file.sh ; then
3666                                         dflt=$file
3667                                 elif $test -f $src/hints/$xfile.sh ; then
3668                                         dflt=$xfile
3669                                 elif $test -f $src/hints/$xxfile.sh ; then
3670                                         dflt=$xxfile
3671                                 elif $test -f $src/hints/$xxxfile.sh ; then
3672                                         dflt=$xxxfile
3673                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3674                                         dflt=$xxxxfile
3675                                 elif $test -f "$src/hints/${osname}.sh" ; then
3676                                         dflt="${osname}"
3677                                 else
3678                                         dflt=none
3679                                 fi
3680                                 ;;
3681                         esac
3682                         ;;
3683                 esac
3684                 if $test -f Policy.sh ; then
3685                         case "$dflt" in
3686                         *Policy*) ;;
3687                         none) dflt="Policy" ;;
3688                         *) dflt="Policy $dflt" ;;
3689                         esac
3690                 fi
3691                 ;;
3692         *)
3693                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3694                 ;;
3695         esac
3696
3697         if $test -f Policy.sh ; then
3698                 $cat <<EOM
3699
3700 There's also a Policy hint file available, which should make the
3701 site-specific (policy) questions easier to answer.
3702 EOM
3703
3704         fi
3705
3706         $cat <<EOM
3707
3708 You may give one or more space-separated answers, or "none" if appropriate.
3709 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3710 previous run of Configure, you may specify it as well as or instead of
3711 OS-specific hints.  If hints are provided for your OS, you should use them:
3712 although Perl can probably be built without hints on many platforms, using
3713 hints often improve performance and may enable features that Configure can't
3714 set up on its own. If there are no hints that match your OS, specify "none";
3715 DO NOT give a wrong version or a wrong OS.
3716
3717 EOM
3718
3719         rp="Which of these apply, if any?"
3720         . UU/myread
3721         tans=$ans
3722         for file in $tans; do
3723                 if $test X$file = XPolicy -a -f Policy.sh; then
3724                         . Policy.sh
3725                         $cat Policy.sh >> UU/config.sh
3726                 elif $test -f $src/hints/$file.sh; then
3727                         . $src/hints/$file.sh
3728                         $cat $src/hints/$file.sh >> UU/config.sh
3729                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3730                         : nothing
3731                 else
3732                         : Give one chance to correct a possible typo.
3733                         echo "$file.sh does not exist"
3734                         dflt=$file
3735                         rp="hint to use instead?"
3736                         . UU/myread
3737                         for file in $ans; do
3738                                 if $test -f "$src/hints/$file.sh"; then
3739                                         . $src/hints/$file.sh
3740                                         $cat $src/hints/$file.sh >> UU/config.sh
3741                                 elif $test X$ans = X -o X$ans = Xnone ; then
3742                                         : nothing
3743                                 else
3744                                         echo "$file.sh does not exist -- ignored."
3745                                 fi
3746                         done
3747                 fi
3748         done
3749
3750         hint=recommended
3751         : Remember our hint file for later.
3752         if $test -f "$src/hints/$file.sh" ; then
3753                 hintfile="$file"
3754         else
3755                 hintfile=''
3756         fi
3757 fi
3758 cd UU
3759 ;;
3760 *)
3761         echo " "
3762         echo "Fetching default answers from $config_sh..." >&4
3763         tmp_n="$n"
3764         tmp_c="$c"
3765         cd ..
3766         cp $config_sh config.sh 2>/dev/null
3767         chmod +w config.sh
3768         . ./config.sh
3769         cd UU
3770         cp ../config.sh .
3771         n="$tmp_n"
3772         c="$tmp_c"
3773         hint=previous
3774         ;;
3775 esac
3776 test "$override" && . ./optdef.sh
3777
3778 : Restore computed paths
3779 for file in $loclist $trylist; do
3780         eval $file="\$_$file"
3781 done
3782
3783 cat << EOM
3784
3785 Configure uses the operating system name and version to set some defaults.
3786 The default value is probably right if the name rings a bell. Otherwise,
3787 since spelling matters for me, either accept the default or answer "none"
3788 to leave it blank.
3789
3790 EOM
3791 case "$osname" in
3792         ''|' ')
3793                 case "$hintfile" in
3794                 ''|' '|none) dflt=none ;;
3795                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3796                 esac
3797                 ;;
3798         *) dflt="$osname" ;;
3799 esac
3800 rp="Operating system name?"
3801 . ./myread
3802 case "$ans" in
3803 none)  osname='' ;;
3804 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3805 esac
3806 echo " "
3807 case "$osvers" in
3808         ''|' ')
3809                 case "$hintfile" in
3810                 ''|' '|none) dflt=none ;;
3811                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3812                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3813                         case "$dflt" in
3814                         ''|' ') dflt=none ;;
3815                         esac
3816                         ;;
3817                 esac
3818                 ;;
3819         *) dflt="$osvers" ;;
3820 esac
3821 rp="Operating system version?"
3822 . ./myread
3823 case "$ans" in
3824 none)  osvers='' ;;
3825 *) osvers="$ans" ;;
3826 esac
3827
3828
3829 . ./posthint.sh
3830
3831 : who configured the system
3832 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3833 case "$cf_by" in
3834 "")
3835         cf_by=`(logname) 2>/dev/null`
3836         case "$cf_by" in
3837         "")
3838                 cf_by=`(whoami) 2>/dev/null`
3839                 case "$cf_by" in
3840                 "") cf_by=unknown ;;
3841                 esac ;;
3842         esac ;;
3843 esac
3844
3845 : decide how portable to be.  Allow command line overrides.
3846 case "$d_portable" in
3847 "$undef") ;;
3848 *)      d_portable="$define" ;;
3849 esac
3850
3851 : set up shell script to do ~ expansion
3852 cat >filexp <<EOSS
3853 $startsh
3854 : expand filename
3855 case "\$1" in
3856  \~/*|\~)
3857         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3858         ;;
3859  \~*)
3860         if $test -f /bin/csh; then
3861                 /bin/csh -f -c "glob \$1"
3862                 failed=\$?
3863                 echo ""
3864                 exit \$failed
3865         else
3866                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3867                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3868                 if $test ! -d "\$dir"; then
3869                         me=\`basename \$0\`
3870                         echo "\$me: can't locate home directory for: \$name" >&2
3871                         exit 1
3872                 fi
3873                 case "\$1" in
3874                 */*)
3875                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3876                         ;;
3877                 *)
3878                         echo \$dir
3879                         ;;
3880                 esac
3881         fi
3882         ;;
3883 *)
3884         echo \$1
3885         ;;
3886 esac
3887 EOSS
3888 chmod +x filexp
3889 $eunicefix filexp
3890
3891 : now set up to get a file name
3892 cat <<EOS >getfile
3893 $startsh
3894 EOS
3895 cat <<'EOSC' >>getfile
3896 tilde=''
3897 fullpath=''
3898 already=''
3899 skip=''
3900 none_ok=''
3901 exp_file=''
3902 nopath_ok=''
3903 orig_rp="$rp"
3904 orig_dflt="$dflt"
3905 case "$gfpth" in
3906 '') gfpth='.' ;;
3907 esac
3908
3909 case "$fn" in
3910 *\(*)
3911         : getfile will accept an answer from the comma-separated list
3912         : enclosed in parentheses even if it does not meet other criteria.
3913         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3914         fn=`echo $fn | sed 's/(.*)//'`
3915         ;;
3916 esac
3917
3918 case "$fn" in
3919 *:*)
3920         loc_file=`expr $fn : '.*:\(.*\)'`
3921         fn=`expr $fn : '\(.*\):.*'`
3922         ;;
3923 esac
3924
3925 case "$fn" in
3926 *~*) tilde=true;;
3927 esac
3928 case "$fn" in
3929 */*) fullpath=true;;
3930 esac
3931 case "$fn" in
3932 *+*) skip=true;;
3933 esac
3934 case "$fn" in
3935 *n*) none_ok=true;;
3936 esac
3937 case "$fn" in
3938 *e*) exp_file=true;;
3939 esac
3940 case "$fn" in
3941 *p*) nopath_ok=true;;
3942 esac
3943
3944 case "$fn" in
3945 *f*) type='File';;
3946 *d*) type='Directory';;
3947 *l*) type='Locate';;
3948 esac
3949
3950 what="$type"
3951 case "$what" in
3952 Locate) what='File';;
3953 esac
3954
3955 case "$exp_file" in
3956 '')
3957         case "$d_portable" in
3958         "$define") ;;
3959         *) exp_file=true;;
3960         esac
3961         ;;
3962 esac
3963
3964 cd ..
3965 while test "$type"; do
3966         redo=''
3967         rp="$orig_rp"
3968         dflt="$orig_dflt"
3969         case "$tilde" in
3970         true) rp="$rp (~name ok)";;
3971         esac
3972         . UU/myread
3973         if test -f UU/getfile.ok && \
3974                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3975         then
3976                 value="$ans"
3977                 ansexp="$ans"
3978                 break
3979         fi
3980         case "$ans" in
3981         none)
3982                 value=''
3983                 ansexp=''
3984                 case "$none_ok" in
3985                 true) type='';;
3986                 esac
3987                 ;;
3988         *)
3989                 case "$tilde" in
3990                 '') value="$ans"
3991                         ansexp="$ans";;
3992                 *)
3993                         value=`UU/filexp $ans`
3994                         case $? in
3995                         0)
3996                                 if test "$ans" != "$value"; then
3997                                         echo "(That expands to $value on this system.)"
3998                                 fi
3999                                 ;;
4000                         *) value="$ans";;
4001                         esac
4002                         ansexp="$value"
4003                         case "$exp_file" in
4004                         '') value="$ans";;
4005                         esac
4006                         ;;
4007                 esac
4008                 case "$fullpath" in
4009                 true)
4010                         case "$ansexp" in
4011                         /*) value="$ansexp" ;;
4012                         [a-zA-Z]:/*) value="$ansexp" ;;
4013                         *)
4014                                 redo=true
4015                                 case "$already" in
4016                                 true)
4017                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4018                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4019                                         ;;
4020                                 *)
4021                                 echo "Please give a full path name, starting with slash." >&4
4022                                         case "$tilde" in
4023                                         true)
4024                                 echo "Note that using ~name is ok provided it expands well." >&4
4025                                                 already=true
4026                                                 ;;
4027                                         esac
4028                                 esac
4029                                 ;;
4030                         esac
4031                         ;;
4032                 esac
4033                 case "$redo" in
4034                 '')
4035                         case "$type" in
4036                         File)
4037                                 for fp in $gfpth; do
4038                                         if test "X$fp" = X.; then
4039                                             pf="$ansexp"
4040                                         else    
4041                                             pf="$fp/$ansexp"
4042                                         fi
4043                                         if test -f "$pf"; then
4044                                                 type=''
4045                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4046                                         then
4047                                                 echo "($value is not a plain file, but that's ok.)"
4048                                                 type=''
4049                                         fi
4050                                         if test X"$type" = X; then
4051                                             value="$pf"
4052                                             break
4053                                         fi
4054                                 done
4055                                 ;;
4056                         Directory)
4057                                 for fp in $gfpth; do
4058                                         if test "X$fp" = X.; then
4059                                             dir="$ans"
4060                                             direxp="$ansexp"
4061                                         else    
4062                                             dir="$fp/$ansexp"
4063                                             direxp="$fp/$ansexp"
4064                                         fi
4065                                         if test -d "$direxp"; then
4066                                                 type=''
4067                                                 value="$dir"
4068                                                 break
4069                                         fi
4070                                 done
4071                                 ;;
4072                         Locate)
4073                                 if test -d "$ansexp"; then
4074                                         echo "(Looking for $loc_file in directory $value.)"
4075                                         value="$value/$loc_file"
4076                                         ansexp="$ansexp/$loc_file"
4077                                 fi
4078                                 if test -f "$ansexp"; then
4079                                         type=''
4080                                 fi
4081                                 case "$nopath_ok" in
4082                                 true)   case "$value" in
4083                                         */*) ;;
4084                                         *)      echo "Assuming $value will be in people's path."
4085                                                 type=''
4086                                                 ;;
4087                                         esac
4088                                         ;;
4089                                 esac
4090                                 ;;
4091                         esac
4092
4093                         case "$skip" in
4094                         true) type='';
4095                         esac
4096
4097                         case "$type" in
4098                         '') ;;
4099                         *)
4100                                 if test "$fastread" = yes; then
4101                                         dflt=y
4102                                 else
4103                                         dflt=n
4104                                 fi
4105                                 rp="$what $value doesn't exist.  Use that name anyway?"
4106                                 . UU/myread
4107                                 dflt=''
4108                                 case "$ans" in
4109                                 y*) type='';;
4110                                 *) echo " ";;
4111                                 esac
4112                                 ;;
4113                         esac
4114                         ;;
4115                 esac
4116                 ;;
4117         esac
4118 done
4119 cd UU
4120 ans="$value"
4121 rp="$orig_rp"
4122 dflt="$orig_dflt"
4123 rm -f getfile.ok
4124 test "X$gfpthkeep" != Xy && gfpth=""
4125 EOSC
4126
4127 : determine root of directory hierarchy where package will be installed.
4128 case "$prefix" in
4129 '')
4130         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4131         ;;
4132 *?/)
4133         dflt=`echo "$prefix" | sed 's/.$//'`
4134         ;;
4135 *)
4136         dflt="$prefix"
4137         ;;
4138 esac
4139 $cat <<EOM
4140
4141 By default, $package will be installed in $dflt/bin, manual pages
4142 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4143 installation directories. Typically this is something like /usr/local.
4144 If you wish to have binaries under /usr/bin but other parts of the
4145 installation under /usr/local, that's ok: you will be prompted
4146 separately for each of the installation directories, the prefix being
4147 only used to set the defaults.
4148
4149 EOM
4150 fn=d~
4151 rp='Installation prefix to use?'
4152 . ./getfile
4153 oldprefix=''
4154 case "$prefix" in
4155 '') ;;
4156 *)
4157         case "$ans" in
4158         "$prefix") ;;
4159         *) oldprefix="$prefix";;
4160         esac
4161         ;;
4162 esac
4163 prefix="$ans"
4164 prefixexp="$ansexp"
4165
4166 : allow them to override the AFS root
4167 case "$afsroot" in
4168 '')     afsroot=/afs ;;
4169 *)      afsroot=$afsroot ;;
4170 esac
4171
4172 : is AFS running?
4173 echo " "
4174 case "$afs" in
4175 $define|true)   afs=true ;;
4176 $undef|false)   afs=false ;;
4177 *)      if $test -d $afsroot; then
4178                 afs=true
4179         else
4180                 afs=false
4181         fi
4182         ;;
4183 esac
4184 if $afs; then
4185         echo "AFS may be running... I'll be extra cautious then..." >&4
4186 else
4187         echo "AFS does not seem to be running..." >&4
4188 fi
4189
4190 : determine installation prefix for where package is to be installed.
4191 if $afs; then
4192 $cat <<EOM
4193
4194 Since you are running AFS, I need to distinguish the directory in which
4195 files will reside from the directory in which they are installed (and from
4196 which they are presumably copied to the former directory by occult means).
4197
4198 EOM
4199         case "$installprefix" in
4200         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4201         *) dflt="$installprefix";;
4202         esac
4203 else
4204 $cat <<EOM
4205
4206 In some special cases, particularly when building $package for distribution,
4207 it is convenient to distinguish the directory in which files should be
4208 installed from the directory ($prefix) in which they will
4209 eventually reside.  For most users, these two directories are the same.
4210
4211 EOM
4212         case "$installprefix" in
4213         '') dflt=$prefix ;;
4214         *) dflt=$installprefix;;
4215         esac
4216 fi
4217 fn=d~
4218 rp='What installation prefix should I use for installing files?'
4219 . ./getfile
4220 installprefix="$ans"
4221 installprefixexp="$ansexp"
4222
4223 : Perform the prefixexp/installprefixexp correction if necessary
4224 cat <<EOS >installprefix
4225 $startsh
4226 EOS
4227 cat <<'EOSC' >>installprefix
4228 : Change installation prefix, if necessary.
4229 if $test X"$prefix" != X"$installprefix"; then
4230     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4231 else
4232     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4233 fi
4234 EOSC
4235 chmod +x installprefix
4236 $eunicefix installprefix
4237
4238 : Set variables such as privlib and privlibexp from the output of ./getfile
4239 : performing the prefixexp/installprefixexp correction if necessary.
4240 cat <<EOS >setprefixvar
4241 $startsh
4242 EOS
4243 cat <<'EOSC' >>setprefixvar
4244 eval "${prefixvar}=\"\$ans\""
4245 eval "${prefixvar}exp=\"\$ansexp\""
4246 . ./installprefix
4247 EOSC
4248 chmod +x setprefixvar
4249 $eunicefix setprefixvar
4250
4251 : set up the script used to warn in case of inconsistency
4252 cat <<EOS >whoa
4253 $startsh
4254 EOS
4255 cat <<'EOSC' >>whoa
4256 dflt=y
4257 case "$hint" in
4258     recommended)
4259         case "$hintfile" in
4260         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4261                 ;;
4262         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4263                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4264                 ;;
4265         esac
4266         ;;
4267     *)  echo " "
4268         echo "*** WHOA THERE!!! ***" >&4
4269         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4270         ;;
4271 esac
4272 rp="    Keep the $hint value?"
4273 . ./myread
4274 case "$ans" in
4275 y) td=$was; tu=$was;;
4276 esac
4277 EOSC
4278
4279 : function used to set '$1' to '$val'
4280 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4281 case "$val$was" in
4282 $define$undef) . ./whoa; eval "$var=\$td";;
4283 $undef$define) . ./whoa; eval "$var=\$tu";;
4284 *) eval "$var=$val";;
4285 esac'
4286
4287 : get the patchlevel
4288 echo " "
4289 echo "Getting the current patchlevel..." >&4
4290 if $test -r $rsrc/patchlevel.h;then
4291         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4292         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4293         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4294         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4295         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4296         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4297         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4298 else
4299         revision=0
4300         patchlevel=0
4301         subversion=0
4302         api_revision=0
4303         api_version=0
4304         api_subversion=0
4305         perl_patchlevel=0
4306         $echo "(You do not have patchlevel.h.  Eek.)"
4307 fi
4308 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4309 version_patchlevel_string="version $patchlevel subversion $subversion"
4310 case "$perl_patchlevel" in
4311 0|'') ;;
4312 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4313     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4314     ;;
4315 esac
4316
4317 $echo "(You have $package $version_patchlevel_string.)"
4318
4319 case "$osname" in
4320 dos|vms)
4321         : XXX Should be a Configure test for double-dots in filenames.
4322         version=`echo $revision $patchlevel $subversion | \
4323                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4324         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4325                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4326         ;;
4327 *)
4328         version=`echo $revision $patchlevel $subversion | \
4329                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4330         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4331                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4332         ;;
4333 esac
4334 : Special case the 5.005_xx maintenance series, which used 5.005
4335 : without any subversion label as a subdirectory in $sitelib
4336 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4337         api_versionstring='5.005'
4338 fi
4339
4340 : Do we want threads support and if so, what type
4341 case "$usethreads" in
4342 $define|true|[yY]*)     dflt='y';;
4343 *)     # Catch case where user specified ithreads or 5005threads but
4344        # forgot -Dusethreads (A.D. 4/2002)
4345        case "$useithreads$use5005threads" in
4346        *$define*)       dflt='y';;
4347        *)               dflt='n';;
4348        esac
4349        ;;
4350 esac
4351 cat <<EOM
4352
4353 Perl can be built to offer a form of threading support on some systems
4354 To do so, Configure can be run with -Dusethreads.
4355
4356 Note that Perl built with threading support runs slightly slower
4357 and uses slightly more memory than plain Perl.
4358
4359 If this doesn't make any sense to you, just accept the default '$dflt'.
4360 EOM
4361 rp='Build a threading Perl?'
4362 . ./myread
4363 case "$ans" in
4364 y|Y)    val="$define" ;;
4365 *)      val="$undef" ;;
4366 esac
4367 set usethreads
4368 eval $setvar
4369
4370 if $test $patchlevel -lt 9; then
4371     case "$usethreads" in
4372     $define)
4373         : Default to ithreads unless overridden on command line or with
4374         : old config.sh
4375         dflt='y'
4376         case "$use5005threads" in
4377                 $define|true|[yY]*)
4378                         echo "5.005 threads are no longer supported"
4379                         exit 1
4380                 ;;
4381         esac
4382         case "$useithreads" in
4383                 $undef|false|[nN]*) dflt='n';;
4384         esac
4385         rp='Use the newer interpreter-based ithreads?'
4386         . ./myread
4387         case "$ans" in
4388         y|Y)    val="$define" ;;
4389         *)      val="$undef" ;;
4390         esac
4391         set useithreads
4392         eval $setvar
4393         : Now set use5005threads to the opposite value.
4394         case "$useithreads" in
4395         $define) val="$undef" ;;
4396         *) val="$define" ;;
4397         esac
4398         set use5005threads
4399         eval $setvar
4400         ;;
4401     *)
4402         useithreads="$undef"
4403         use5005threads="$undef"
4404         ;;
4405     esac
4406
4407     case "$useithreads$use5005threads" in
4408     "$define$define")
4409         $cat >&4 <<EOM
4410
4411 You cannot have both the ithreads and the 5.005 threads enabled
4412 at the same time.  Disabling the 5.005 threads since they are
4413 much less stable than the ithreads.
4414
4415 EOM
4416         use5005threads="$undef"
4417         ;;
4418     esac
4419
4420 else
4421 : perl-5.9.x and later
4422
4423     if test X"$usethreads" = "X$define"; then
4424         case "$use5005threads" in
4425             $define|true|[yY]*)
4426                 $cat >&4 <<EOM
4427
4428 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4429
4430 EOM
4431             ;;
4432         esac
4433     fi
4434
4435     use5005threads="$undef"
4436     useithreads="$usethreads"
4437 fi
4438
4439 case "$d_oldpthreads" in
4440 '')     : Configure tests would be welcome here.  For now, assume undef.
4441         val="$undef" ;;
4442 *)      val="$d_oldpthreads" ;;
4443 esac
4444 set d_oldpthreads
4445 eval $setvar
4446
4447
4448 : Look for a hint-file generated 'call-back-unit'.  If the
4449 : user has specified that a threading perl is to be built,
4450 : we may need to set or change some other defaults.
4451 if $test -f usethreads.cbu; then
4452     echo "Your platform has some specific hints regarding threaded builds, using them..."
4453     . ./usethreads.cbu
4454 else
4455     case "$usethreads" in
4456         "$define"|true|[yY]*)
4457                 $cat <<EOM
4458 (Your platform does not have any specific hints for threaded builds.
4459  Assuming POSIX threads, then.)
4460 EOM
4461         ;;
4462     esac
4463 fi
4464
4465 : Check if multiplicity is required
4466 cat <<EOM
4467
4468 Perl can be built so that multiple Perl interpreters can coexist
4469 within the same Perl executable.
4470 EOM
4471
4472 case "$useithreads" in
4473 $define)
4474         cat <<EOM
4475 This multiple interpreter support is required for interpreter-based threads.
4476 EOM
4477         val="$define"
4478         ;;
4479 *)      case "$usemultiplicity" in
4480         $define|true|[yY]*)     dflt='y';;
4481         *) dflt='n';;
4482         esac
4483         echo " "
4484         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4485         rp='Build Perl for multiplicity?'
4486         . ./myread
4487         case "$ans" in
4488         y|Y)    val="$define" ;;
4489         *)      val="$undef" ;;
4490         esac
4491         ;;
4492 esac
4493 set usemultiplicity
4494 eval $setvar
4495
4496 : Check if morebits is requested
4497 case "$usemorebits" in
4498 "$define"|true|[yY]*)
4499         use64bitint="$define"
4500         uselongdouble="$define"
4501         usemorebits="$define"
4502         ;;
4503 *)      usemorebits="$undef"
4504         ;;
4505 esac
4506
4507 : Determine the C compiler to be used
4508 echo " "
4509 case "$cc" in
4510 '') dflt=cc;;
4511 *) dflt="$cc";;
4512 esac
4513 rp="Use which C compiler?"
4514 . ./myread
4515 cc="$ans"
4516
4517 : See whether they have no cc but they do have gcc
4518 . ./trygcc
4519 if $test -f cc.cbu; then
4520     . ./cc.cbu
4521 fi
4522 . ./checkcc
4523
4524 : make some quick guesses about what we are up against
4525 echo " "
4526 $echo $n "Hmm...  $c"
4527 echo exit 1 >bsd
4528 echo exit 1 >usg
4529 echo exit 1 >v7
4530 echo exit 1 >osf1
4531 echo exit 1 >eunice
4532 echo exit 1 >xenix
4533 echo exit 1 >venix
4534 echo exit 1 >os2
4535 d_bsd="$undef"
4536 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4537 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4538 then
4539         echo "Looks kind of like an OSF/1 system, but we'll see..."
4540         echo exit 0 >osf1
4541 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4542         xxx=`./loc addbib blurfl $pth`
4543         if $test -f $xxx; then
4544         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4545                 echo exit 0 >bsd
4546                 echo exit 0 >usg
4547         else
4548                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4549                         echo "Looks kind of like an extended USG system, but we'll see..."
4550                 else
4551                         echo "Looks kind of like a USG system, but we'll see..."
4552                 fi
4553                 echo exit 0 >usg
4554         fi
4555 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4556         echo "Looks kind of like a BSD system, but we'll see..."
4557         d_bsd="$define"
4558         echo exit 0 >bsd
4559 else
4560         echo "Looks kind of like a Version 7 system, but we'll see..."
4561         echo exit 0 >v7
4562 fi
4563 case "$eunicefix" in
4564 *unixtovms*)
4565         $cat <<'EOI'
4566 There is, however, a strange, musty smell in the air that reminds me of
4567 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4568 EOI
4569         echo exit 0 >eunice
4570         d_eunice="$define"
4571 : it so happens the Eunice I know will not run shell scripts in Unix format
4572         ;;
4573 *)
4574         echo " "
4575         echo "Congratulations.  You aren't running Eunice."
4576         d_eunice="$undef"
4577         ;;
4578 esac
4579 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4580 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4581 : semicolon as a patch separator
4582 case "$p_" in
4583 :) ;;
4584 *)
4585         $cat <<'EOI'
4586 I have the feeling something is not exactly right, however...don't tell me...
4587 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4588 (Or you may be running DOS with DJGPP.)
4589 EOI
4590         echo exit 0 >os2
4591         ;;
4592 esac
4593 if test -f /xenix; then
4594         echo "Actually, this looks more like a XENIX system..."
4595         echo exit 0 >xenix
4596         d_xenix="$define"
4597 else
4598         echo " "
4599         echo "It's not Xenix..."
4600         d_xenix="$undef"
4601 fi
4602 chmod +x xenix
4603 $eunicefix xenix
4604 if test -f /venix; then
4605         echo "Actually, this looks more like a VENIX system..."
4606         echo exit 0 >venix
4607 else
4608         echo " "
4609         if ./xenix; then
4610                 : null
4611         else
4612                 echo "Nor is it Venix..."
4613         fi
4614 fi
4615 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4616 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4617 $rm -f foo
4618
4619 : Check if we are using GNU gcc and what its version is
4620 echo " "
4621 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4622 $cat >try.c <<EOM
4623 #include <stdio.h>
4624 int main() {
4625 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4626 #ifdef __VERSION__
4627         printf("%s\n", __VERSION__);
4628 #else
4629         printf("%s\n", "1");
4630 #endif
4631 #endif
4632         return(0);
4633 }
4634 EOM
4635 if $cc -o try $ccflags $ldflags try.c; then
4636         gccversion=`$run ./try`
4637         case "$gccversion" in
4638         '') echo "You are not using GNU cc." ;;
4639         *)  echo "You are using GNU cc $gccversion."
4640             ccname=gcc
4641             ;;
4642         esac
4643 else
4644         echo " "
4645         echo "*** WHOA THERE!!! ***" >&4
4646         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4647         case "$knowitall" in
4648         '')
4649         echo "    You'd better start hunting for one and let me know about it." >&4
4650                 exit 1
4651                 ;;
4652         esac
4653 fi
4654 $rm -f try try.*
4655 case "$gccversion" in
4656 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4657 esac
4658 case "$gccversion" in
4659 '') gccosandvers='' ;;
4660 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4661    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4662    gccshortvers=''
4663    case "$gccosandvers" in
4664    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4665    $osname$osvers) ;; # looking good
4666    $osname*) cat <<EOM >&4
4667
4668 *** WHOA THERE!!! ***
4669
4670     Your gcc has not been compiled for the exact release of
4671     your operating system ($gccosandvers versus $osname$osvers).
4672
4673     In general it is a good idea to keep gcc synchronized with
4674     the operating system because otherwise serious problems
4675     may ensue when trying to compile software, like Perl.
4676
4677     I'm trying to be optimistic here, though, and will continue.
4678     If later during the configuration and build icky compilation
4679     problems appear (headerfile conflicts being the most common
4680     manifestation), I suggest reinstalling the gcc to match
4681     your operating system release.
4682
4683 EOM
4684       ;;
4685    *) gccosandvers='' ;; # failed to parse, better be silent
4686    esac
4687    ;;
4688 esac
4689 case "$ccname" in
4690 '') ccname="$cc" ;;
4691 esac
4692
4693 # gcc 3.* complain about adding -Idirectories that they already know about,
4694 # so we will take those off from locincpth.
4695 case "$gccversion" in
4696 3*)
4697     echo "main(){}">try.c
4698     for incdir in $locincpth; do
4699        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4700              grep '^c[cp]p*[01]: warning: changing search order '`
4701        if test "X$warn" != X; then
4702            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4703        fi
4704     done
4705     $rm -f try try.*
4706 esac
4707
4708 # gcc 4.9 by default does some optimizations that break perl.
4709 # see ticket 121505.
4710 #
4711 # The -fwrapv disables those optimizations (and probably others,) so
4712 # for gcc 4.9 (and later, since the optimizations probably won't go
4713 # away), add -fwrapv unless the user requests -fno-wrapv, which
4714 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4715 # which turns the overflows -fwrapv ignores into runtime errors.
4716 case "$gccversion" in
4717 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4718     case "$ccflags" in
4719     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4720     *) ccflags="$ccflags -fwrapv" ;;
4721     esac
4722 esac
4723
4724 : What should the include directory be ?
4725 : Use sysroot if set, so findhdr looks in the right place.
4726 echo " "
4727 $echo $n "Hmm...  $c"
4728 dflt="$sysroot/usr/include"
4729 incpath=''
4730 mips_type=''
4731 if $test -f /bin/mips && /bin/mips; then
4732         echo "Looks like a MIPS system..."
4733         $cat >usr.c <<'EOCP'
4734 #ifdef SYSTYPE_BSD43
4735 /bsd43
4736 #endif
4737 EOCP
4738         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4739                 dflt='/bsd43/usr/include'
4740                 incpath='/bsd43'
4741                 mips_type='BSD 4.3'
4742         else
4743                 mips_type='System V'
4744         fi
4745         $rm -f usr.c usr.out
4746         echo "and you're compiling with the $mips_type compiler and libraries."
4747         xxx_prompt=y
4748         echo "exit 0" >mips
4749 else
4750         echo "Doesn't look like a MIPS system."
4751         xxx_prompt=n
4752         echo "exit 1" >mips
4753 fi
4754 chmod +x mips
4755 $eunicefix mips
4756 case "$usrinc" in
4757 '') ;;
4758 *) dflt="$usrinc";;
4759 esac
4760 case "$xxx_prompt" in
4761 y)      fn=d/
4762         echo " "
4763         rp='Where are the include files you want to use?'
4764         . ./getfile
4765         usrinc="$ans"
4766         ;;
4767 *)      usrinc="$dflt"
4768         ;;
4769 esac
4770
4771 : see how we invoke the C preprocessor
4772 echo " "
4773 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4774 cat <<'EOT' >testcpp.c
4775 #define ABC abc
4776 #define XYZ xyz
4777 ABC.XYZ
4778 EOT
4779 cd ..
4780 if test ! -f cppstdin; then
4781         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4782                 # AIX cc -E doesn't show the absolute headerfile
4783                 # locations but we'll cheat by using the -M flag.
4784                 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
4785         else
4786                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4787         fi
4788 else
4789         echo "Keeping your $hint cppstdin wrapper."
4790 fi
4791 chmod 755 cppstdin
4792 wrapper=`pwd`/cppstdin
4793 ok='false'
4794 cd UU
4795
4796 if $test "X$cppstdin" != "X" && \
4797         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4798         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4799 then
4800         echo "You used to use $cppstdin $cppminus so we'll use that again."
4801         case "$cpprun" in
4802         '') echo "But let's see if we can live without a wrapper..." ;;
4803         *)
4804                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4805                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4806                 then
4807                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4808                         ok='true'
4809                 else
4810                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4811                 fi
4812                 ;;
4813         esac
4814 else
4815         case "$cppstdin" in
4816         '') ;;
4817         *)
4818                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4819                 ;;
4820         esac
4821 fi
4822
4823 if $ok; then
4824         : nothing
4825 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4826         $cc -E <testcpp.c >testcpp.out 2>&1; \
4827         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4828         echo "Yup, it does."
4829         x_cpp="$cc $cppflags -E"
4830         x_minus='';
4831 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4832         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4833         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4834         echo "Yup, it does."
4835         x_cpp="$cc $cppflags -E"
4836         x_minus='-';
4837 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4838         $cc -P <testcpp.c >testcpp.out 2>&1; \
4839         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4840         echo "Yipee, that works!"
4841         x_cpp="$cc $cppflags -P"
4842         x_minus='';
4843 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4844         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4845         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4846         echo "At long last!"
4847         x_cpp="$cc $cppflags -P"
4848         x_minus='-';
4849 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4850         $cpp <testcpp.c >testcpp.out 2>&1; \
4851         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4852         echo "It works!"
4853         x_cpp="$cpp $cppflags"
4854         x_minus='';
4855 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4856         $cpp - <testcpp.c >testcpp.out 2>&1; \
4857         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4858         echo "Hooray, it works!  I was beginning to wonder."
4859         x_cpp="$cpp $cppflags"
4860         x_minus='-';
4861 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4862         $wrapper <testcpp.c >testcpp.out 2>&1; \
4863         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4864         x_cpp="$wrapper"
4865         x_minus=''
4866         echo "Eureka!"
4867 else
4868         dflt=''
4869         rp="No dice.  I can't find a C preprocessor.  Name one:"
4870         . ./myread
4871         x_cpp="$ans"
4872         x_minus=''
4873         $x_cpp <testcpp.c >testcpp.out 2>&1
4874         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4875                 echo "OK, that will do." >&4
4876         else
4877 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4878                 exit 1
4879         fi
4880 fi
4881
4882 case "$ok" in
4883 false)
4884         cppstdin="$x_cpp"
4885         cppminus="$x_minus"
4886         cpprun="$x_cpp"
4887         cpplast="$x_minus"
4888         set X $x_cpp
4889         shift
4890         case "$1" in
4891         "$cpp")
4892                 echo "Perhaps can we force $cc -E using a wrapper..."
4893                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4894                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4895                 then
4896                         echo "Yup, we can."
4897                         cppstdin="$wrapper"
4898                         cppminus='';
4899                 else
4900                         echo "Nope, we'll have to live without it..."
4901                 fi
4902                 ;;
4903         esac
4904         case "$cpprun" in
4905         "$wrapper")
4906                 cpprun=''
4907                 cpplast=''
4908                 ;;
4909         esac
4910         ;;
4911 esac
4912
4913 case "$cppstdin" in
4914 "$wrapper"|'cppstdin') ;;
4915 *) $rm -f $wrapper;;
4916 esac
4917 $rm -f testcpp.c testcpp.out
4918
4919 : Adjust cppfilter for path component separator
4920 case "$osname" in
4921 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4922 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4923 *)   cppfilter='' ;;
4924 esac
4925
4926 : Use gcc to determine libpth and incpth
4927 # If using gcc or clang, we can get better values for libpth, incpth
4928 # and usrinc directly from the compiler.
4929 # Note that ccname for clang is also gcc.
4930 case "$ccname" in
4931     gcc)
4932         $echo 'extern int foo;' > try.c
4933         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4934         shift
4935         if $test $# -gt 0; then
4936             incpth="$incpth $*"
4937             incpth="`$echo $incpth|$sed 's/^ //'`"
4938             for i in $*; do
4939                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4940                 if $test -d $j; then
4941                     libpth="$libpth $j"
4942                 fi
4943             done
4944             libpth="`$echo $libpth|$sed 's/^ //'`"
4945             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4946                 if $test -d $xxx; then
4947                     case " $libpth " in
4948                     *" $xxx "*) ;;
4949                     *) libpth="$libpth $xxx";;
4950                     esac
4951                 fi
4952             done
4953         fi
4954         $rm -f try.c
4955         case "$usrinc" in
4956         '') for i in $incpth; do
4957                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4958                     usrinc="$i"
4959                     break
4960                 fi
4961             done
4962             ;;
4963         esac
4964
4965         case "$usecrosscompile" in
4966         $define|true|[yY]*)
4967             case "$incpth" in
4968                 '') echo "Incpth not defined." >&4; croak=y ;;
4969                 *)  echo "Using incpth '$incpth'." >&4 ;;
4970             esac
4971             case "$libpth" in
4972                 '') echo "Libpth not defined." >&4; croak=y ;;
4973                 *)  echo "Using libpth '$libpth'." >&4 ;;
4974             esac
4975             case "$usrinc" in
4976                 '') echo "Usrinc not defined." >&4; croak=y ;;
4977                 *)  echo "Using usrinc $usrinc." >&4 ;;
4978             esac
4979             case "$croak" in
4980                 y)
4981                 if test "X$sysroot" = X; then
4982                     echo "Cannot continue, aborting." >&4; exit 1
4983                 else
4984                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
4985                 fi
4986                 ;;
4987             esac
4988             ;;
4989         esac
4990     ;;
4991 esac
4992
4993 : Default value for incpth is just usrinc
4994 case "$incpth" in
4995 '') incpth="$usrinc";;
4996 esac
4997
4998 : Set private lib path
4999 case "$plibpth" in
5000 '') if ./mips; then
5001         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5002     fi;;
5003 esac
5004 case "$libpth" in
5005 ' ') dlist='';;
5006 '') dlist="$loclibpth $plibpth $glibpth";;
5007 *) dlist="$libpth";;
5008 esac
5009
5010 : Now check and see which directories actually exist, avoiding duplicates
5011 for xxx in $dlist
5012 do
5013     if $test -d $xxx; then
5014                 case " $libpth " in
5015                 *" $xxx "*) ;;
5016                 *) libpth="$libpth $xxx";;
5017                 esac
5018     fi
5019 done
5020 $cat <<'EOM'
5021
5022 Some systems have incompatible or broken versions of libraries.  Among
5023 the directories listed in the question below, please remove any you
5024 know not to be holding relevant libraries, and add any that are needed.
5025 Say "none" for none.
5026
5027 EOM
5028
5029 if test "X$sysroot" != X; then
5030     $cat <<EOM
5031 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5032
5033 EOM
5034 fi
5035
5036 case "$libpth" in
5037 '') dflt='none';;
5038 *)
5039         set X $libpth
5040         shift
5041         dflt=${1+"$@"}
5042         ;;
5043 esac
5044 rp="Directories to use for library searches?"
5045 . ./myread
5046 case "$ans" in
5047 none) libpth=' ';;
5048 *) libpth="$ans";;
5049 esac
5050
5051 : compute shared library extension
5052 case "$so" in
5053 '')
5054         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5055                 dflt='sl'
5056         else
5057                 dflt='so'
5058         fi
5059         ;;
5060 *) dflt="$so";;
5061 esac
5062 $cat <<EOM
5063
5064 On some systems, shared libraries may be available.  Answer 'none' if
5065 you want to suppress searching of shared libraries for the remainder
5066 of this configuration.
5067
5068 EOM
5069 rp='What is the file extension used for shared libraries?'
5070 . ./myread
5071 so="$ans"
5072
5073 : Does target system insist that shared library basenames are unique
5074 $cat << EOM
5075
5076 Some dynamic loaders assume that the *basename* of shared library filenames
5077 are globally unique.  We'll default this to undef as we assume your system
5078 is not this weird. Set to defined if you're on one of them.
5079
5080 EOM
5081
5082 dflt='n'
5083 rp='Make shared library basenames unique?'
5084 . ./myread
5085 case "$ans" in
5086 y|Y) val="$define" ;;
5087 *)   val="$undef"  ;;
5088 esac
5089 set d_libname_unique
5090 eval $setvar
5091
5092 : Define several unixisms.
5093 : Hints files or command line option can be used to override them.
5094 : The convoluted testing is in case hints files set either the old
5095 : or the new name.
5096 case "$_exe" in
5097 '')     case "$exe_ext" in
5098         '')     ;;
5099         *)      _exe="$exe_ext" ;;
5100         esac
5101         ;;
5102 esac
5103 case "$_a" in
5104 '')     case "$lib_ext" in
5105     '') _a='.a';;
5106         *)      _a="$lib_ext" ;;
5107         esac
5108         ;;
5109 esac
5110 case "$_o" in
5111 '') case "$obj_ext" in
5112         '')     _o='.o';;
5113         *)      _o="$obj_ext";;
5114         esac
5115         ;;
5116 esac
5117 case "$p_" in
5118 '') case "$path_sep" in
5119         '')     p_=':';;
5120         *)      p_="$path_sep";;
5121         esac
5122         ;;
5123 esac
5124 exe_ext=$_exe
5125 lib_ext=$_a
5126 obj_ext=$_o
5127 path_sep=$p_
5128
5129 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5130
5131 : Which makefile gets called first.  This is used by make depend.
5132 case "$firstmakefile" in
5133 '') firstmakefile='makefile';;
5134 esac
5135
5136 : Check is we will use socks
5137 case "$usesocks" in
5138 $define|true|[yY]*)     dflt='y';;
5139 *) dflt='n';;
5140 esac
5141 cat <<EOM
5142
5143 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5144 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5145 to use the PerlIO abstraction layer, this will be implicitly selected.
5146
5147 If this doesn't make any sense to you, just accept the default '$dflt'.
5148 EOM
5149 rp='Build Perl for SOCKS?'
5150 . ./myread
5151 case "$ans" in
5152 y|Y)    val="$define" ;;
5153 *)      val="$undef" ;;
5154 esac
5155 set usesocks
5156 eval $setvar
5157
5158 : Check for uselongdouble support
5159 case "$ccflags" in
5160 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5161 esac
5162
5163 case "$uselongdouble" in
5164 $define|true|[yY]*)     dflt='y';;
5165 *) dflt='n';;
5166 esac
5167 cat <<EOM
5168
5169 Perl can be built to take advantage of long doubles which
5170 (if available) may give more accuracy and range for floating point numbers.
5171
5172 If this doesn't make any sense to you, just accept the default '$dflt'.
5173 EOM
5174 rp='Try to use long doubles if available?'
5175 . ./myread
5176 case "$ans" in
5177 y|Y)    val="$define"   ;;
5178 *)      val="$undef"    ;;
5179 esac
5180 set uselongdouble
5181 eval $setvar
5182
5183 case "$uselongdouble" in
5184 true|[yY]*) uselongdouble="$define" ;;
5185 esac
5186
5187 : Look for a hint-file generated 'call-back-unit'.  If the
5188 : user has specified that long doubles should be used,
5189 : we may need to set or change some other defaults.
5190 if $test -f uselongdouble.cbu; then
5191     echo "Your platform has some specific hints regarding long doubles, using them..."
5192     . ./uselongdouble.cbu
5193 else
5194     case "$uselongdouble" in
5195         $define)
5196                 $cat <<EOM
5197 (Your platform does not have any specific hints for long doubles.)
5198 EOM
5199         ;;
5200     esac
5201 fi
5202
5203 : Check if quadmath is requested
5204 case "$usequadmath" in
5205 "$define"|true|[yY]*) usequadmath="$define" ;;
5206 *)                    usequadmath="$undef"  ;;
5207 esac
5208
5209 : Looking for optional libraries
5210 echo " "
5211 echo "Checking for optional libraries..." >&4
5212 case "$libs" in
5213 ' '|'') dflt='';;
5214 *) dflt="$libs";;
5215 esac
5216 case "$libswanted" in
5217 '') libswanted='c_s';;
5218 esac
5219 case "$usesocks" in
5220 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5221 esac
5222 case "$usecbacktrace" in
5223 "$define") libswanted="$libswanted bfd" ;;
5224 esac
5225 case "$usequadmath" in
5226 "$define") libswanted="$libswanted quadmath" ;;
5227 esac
5228 libsfound=''
5229 libsfiles=''
5230 libsdirs=''
5231 libspath=''
5232 for thisdir in $libpth $xlibpth; do
5233   test -d $thisdir && libspath="$libspath $thisdir"
5234 done
5235 for thislib in $libswanted; do
5236         for thisdir in $libspath; do
5237             xxx=''
5238             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5239                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5240                 $test -f "$xxx" && eval $libscheck
5241                 $test -f "$xxx" && libstyle=shared
5242                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5243                 $test -f "$xxx" && eval $libscheck
5244                 $test -f "$xxx" && libstyle=shared
5245             fi
5246             if test ! -f "$xxx"; then
5247                 xxx=$thisdir/lib$thislib.$so
5248                 $test -f "$xxx" && eval $libscheck
5249                 $test -f "$xxx" && libstyle=shared
5250             fi
5251             if test ! -f "$xxx"; then
5252                 xxx=$thisdir/lib$thislib$_a
5253                 $test -f "$xxx" && eval $libscheck
5254                 $test -f "$xxx" && libstyle=static
5255             fi
5256             if test ! -f "$xxx"; then
5257                 xxx=$thisdir/$thislib$_a
5258                 $test -f "$xxx" && eval $libscheck
5259                 $test -f "$xxx" && libstyle=static
5260             fi
5261             if test ! -f "$xxx"; then
5262                 xxx=$thisdir/lib${thislib}_s$_a
5263                 $test -f "$xxx" && eval $libscheck
5264                 $test -f "$xxx" && libstyle=static
5265                 $test -f "$xxx" && thislib=${thislib}_s
5266             fi
5267             if test ! -f "$xxx"; then
5268                 xxx=$thisdir/Slib$thislib$_a
5269                 $test -f "$xxx" && eval $libscheck
5270                 $test -f "$xxx" && libstyle=static
5271             fi
5272             if $test -f "$xxx"; then
5273                 case "$libstyle" in
5274                 shared) echo "Found -l$thislib (shared)." ;;
5275                 static) echo "Found -l$thislib." ;;
5276                 *)      echo "Found -l$thislib ($libstyle)." ;;
5277                 esac
5278                 case " $dflt " in
5279                 *"-l$thislib "*);;
5280                 *) dflt="$dflt -l$thislib"
5281                    libsfound="$libsfound $xxx"
5282                    yyy=`basename $xxx`
5283                    libsfiles="$libsfiles $yyy"
5284                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5285                    case " $libsdirs " in
5286                    *" $yyy "*) ;;
5287                    *) libsdirs="$libsdirs $yyy" ;;
5288                    esac
5289                    ;;
5290                 esac
5291                 break
5292             fi
5293         done
5294         if $test ! -f "$xxx"; then
5295             echo "No -l$thislib."
5296         fi
5297 done
5298 set X $dflt
5299 shift
5300 dflt="$*"
5301 case "$libs" in
5302 '') dflt="$dflt";;
5303 *) dflt="$libs";;
5304 esac
5305 case "$dflt" in
5306 ' '|'') dflt='none';;
5307 esac
5308
5309 $cat <<EOM
5310
5311 In order to compile $package on your machine, a number of libraries
5312 are usually needed.  Include any other special libraries here as well.
5313 Say "none" for none.  The default list is almost always right.
5314 EOM
5315
5316 echo " "
5317 rp="What libraries to use?"
5318 . ./myread
5319 case "$ans" in
5320 none) libs=' ';;
5321 *) libs="$ans";;
5322 esac
5323
5324 : determine optimization, if desired, or use for debug flag also
5325 case "$optimize" in
5326 ' '|$undef) dflt='none';;
5327 '') dflt='-O';;
5328 *) dflt="$optimize";;
5329 esac
5330 $cat <<EOH
5331
5332 By default, $package compiles with the -O flag to use the optimizer.
5333 Alternately, you might want to use the symbolic debugger, which uses
5334 the -g flag (on traditional Unix systems).  Either flag can be
5335 specified here.  To use neither flag, specify the word "none".
5336
5337 EOH
5338 rp="What optimizer/debugger flag should be used?"
5339 . ./myread
5340 optimize="$ans"
5341 case "$optimize" in
5342 'none') optimize=" ";;
5343 esac
5344
5345 : Check what DEBUGGING is required from the command line
5346 : -DEBUGGING      or -DDEBUGGING or
5347 : -DEBUGGING=both                       = -g + -DDEBUGGING
5348 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5349 : -DEBUGGING=none or -UDEBUGGING        =
5350 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5351 case "$EBUGGING" in
5352 '')     ;;
5353 *)      DEBUGGING=$EBUGGING ;;
5354 esac
5355
5356 case "$DEBUGGING" in
5357 -g|both|$define)
5358     case "$optimize" in
5359         *-g*) ;;
5360         *)    optimize="$optimize -g" ;;
5361     esac ;;
5362 none|$undef)
5363     case "$optimize" in
5364         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5365                 shift
5366                 optimize="$*"
5367                 ;;
5368     esac ;;
5369 esac
5370
5371 dflt=''
5372 case "$DEBUGGING" in
5373 both|$define) dflt='-DDEBUGGING'
5374 esac
5375
5376 : argument order is deliberate, as the flag will start with - which set could
5377 : think is an option
5378 checkccflag='check=$1; flag=$2; callback=$3;
5379 echo " ";
5380 echo "Checking if your compiler accepts $flag" 2>&1;
5381 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5382 echo "int main(void) { return 0; }" > gcctest.c;
5383 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5384     echo "Yes, it does." 2>&1;
5385     if $test -s gcctest.out ; then
5386         echo "But your platform does not like it:";
5387         cat gcctest.out;
5388     else
5389         case "$ccflags" in
5390         *$check*)
5391             echo "Leaving current flags $ccflags alone." 2>&1
5392             ;;
5393         *) dflt="$dflt $flag";
5394             eval $callback
5395             ;;
5396         esac
5397     fi
5398 else
5399     echo "Nope, it does not, but that is ok." 2>&1;
5400 fi
5401 '
5402
5403 : We will not override a previous value, but we might want to
5404 : augment a hint file
5405 case "$hint" in
5406 default|recommended)
5407         case "$gccversion" in
5408         1*) dflt="$dflt -fpcc-struct-return" ;;
5409         esac
5410         case "$optimize:$DEBUGGING" in
5411         *-g*:old) dflt="$dflt -DDEBUGGING";;
5412         esac
5413         case "$gccversion" in
5414         2*) if $test -d /etc/conf/kconfig.d &&
5415                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5416                 then
5417                         # Interactive Systems (ISC) POSIX mode.
5418                         dflt="$dflt -posix"
5419                 fi
5420                 ;;
5421         esac
5422         case "$gccversion" in
5423         1*) ;;
5424         2.[0-8]*) ;;
5425         ?*)     set strict-aliasing -fno-strict-aliasing
5426                 eval $checkccflag
5427                 ;;
5428         esac
5429         # For gcc, adding -pipe speeds up compilations for some, but apparently
5430         # some assemblers can't read from stdin.  (It also slows down compilations
5431         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5432         case "$gccversion" in
5433         ?*)     set pipe -pipe
5434                 eval $checkccflag
5435                 ;;
5436         esac
5437
5438         # on x86_64 (at least) we require an extra library (libssp) in the
5439         # link command line. This library is not named, so I infer that it is
5440         # an implementation detail that may change. Hence the safest approach
5441         # is to add the flag to the flags passed to the compiler at link time,
5442         # as that way the compiler can do the right implementation dependant
5443         # thing. (NWC)
5444         case "$gccversion" in
5445         ?*)     set stack-protector-strong -fstack-protector-strong
5446                 eval $checkccflag
5447                 case "$dflt" in
5448                 *-fstack-protector-strong*) ;; # It got added.
5449                 *) # Try the plain/older -fstack-protector.
5450                    set stack-protector -fstack-protector
5451                    eval $checkccflag
5452                    ;;
5453                 esac
5454                 ;;
5455         esac
5456         ;;
5457 esac
5458
5459 case "$mips_type" in
5460 *BSD*|'') inclwanted="$locincpth $usrinc";;
5461 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5462 esac
5463 for thisincl in $inclwanted; do
5464         if $test -d $thisincl; then
5465                 if $test x$thisincl != x$usrinc; then
5466                         case "$dflt" in
5467                         *" -I$thisincl "*);;
5468                         *) dflt="$dflt -I$thisincl ";;
5469                         esac
5470                 fi
5471         fi
5472 done
5473
5474 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5475         xxx=true;
5476 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5477         xxx=true;
5478 else
5479         xxx=false;
5480 fi;
5481 if $xxx; then
5482         case "$dflt" in
5483         *$2*);;
5484         *) dflt="$dflt -D$2";;
5485         esac;
5486 fi'
5487
5488 set signal.h LANGUAGE_C; eval $inctest
5489
5490 case "$usesocks" in
5491 $define)
5492         ccflags="$ccflags -DSOCKS"
5493         ;;
5494 esac
5495
5496 case "$hint" in
5497 default|recommended) dflt="$ccflags $dflt" ;;
5498 *) dflt="$ccflags";;
5499 esac
5500
5501 case "$dflt" in
5502 ''|' ') dflt=none;;
5503 esac
5504
5505 $cat <<EOH
5506
5507 Your C compiler may want other flags.  For this question you should include
5508 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5509 but you should NOT include libraries or ld flags like -lwhatever.  If you
5510 want $package to honor its debug switch, you should include -DDEBUGGING here.
5511 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5512
5513 To use no flags, specify the word "none".
5514
5515 EOH
5516 set X $dflt
5517 shift
5518 dflt=${1+"$@"}
5519 rp="Any additional cc flags?"
5520 . ./myread
5521 case "$ans" in
5522 none) ccflags='';;
5523 *) ccflags="$ans";;
5524 esac
5525
5526 : the following weeds options from ccflags that are of no interest to cpp
5527 case "$cppflags" in
5528 '') cppflags="$ccflags" ;;
5529 *)  cppflags="$cppflags $ccflags" ;;
5530 esac
5531 case "$gccversion" in
5532 1*) cppflags="$cppflags -D__GNUC__"
5533 esac
5534 case "$mips_type" in
5535 '');;
5536 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5537 esac
5538 case "$cppflags" in
5539 '');;
5540 *)
5541         echo " "
5542         echo "Let me guess what the preprocessor flags are..." >&4
5543         set X $cppflags
5544         shift
5545         cppflags=''
5546         $cat >cpp.c <<'EOM'
5547 #define BLURFL foo
5548
5549 BLURFL xx LFRULB
5550 EOM
5551         previous=''
5552         for flag in $*
5553         do
5554                 case "$flag" in
5555                 -*) ftry="$flag";;
5556                 *) ftry="$previous $flag";;
5557                 esac
5558                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5559                         >cpp1.out 2>/dev/null && \
5560                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5561                         >cpp2.out 2>/dev/null && \
5562                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5563                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5564                 then
5565                         cppflags="$cppflags $ftry"
5566                         previous=''
5567                 else
5568                         previous="$flag"
5569                 fi
5570         done
5571         set X $cppflags
5572         shift
5573         cppflags=${1+"$@"}
5574         case "$cppflags" in
5575         *-*)  echo "They appear to be: $cppflags";;
5576         esac
5577         $rm -f cpp.c cpp?.out
5578         ;;
5579 esac
5580
5581 : flags used in final linking phase
5582 case "$ldflags" in
5583 '') if ./venix; then
5584                 dflt='-i -z'
5585         else
5586                 dflt=''
5587         fi
5588         case "$ccflags" in
5589         *-posix*) dflt="$dflt -posix" ;;
5590         esac
5591         ;;
5592 *) dflt="$ldflags";;
5593 esac
5594 # See note above about -fstack-protector
5595 case "$ccflags" in
5596 *-fstack-protector-strong*)
5597         case "$dflt" in
5598         *-fstack-protector-strong*) ;; # Don't add it again
5599         *) dflt="$dflt -fstack-protector-strong" ;;
5600         esac
5601         ;;
5602 *-fstack-protector*)
5603         case "$dflt" in
5604         *-fstack-protector*) ;; # Don't add it again
5605         *) dflt="$dflt -fstack-protector" ;;
5606         esac
5607         ;;
5608 esac
5609
5610 : Try to guess additional flags to pick up local libraries.
5611 for thislibdir in $libpth; do
5612         case " $loclibpth " in
5613         *" $thislibdir "*)
5614                 case "$dflt " in
5615                 *"-L$thislibdir "*) ;;
5616                 *)  dflt="$dflt -L$thislibdir" ;;
5617                 esac
5618                 ;;
5619         esac
5620 done
5621
5622 case "$dflt" in
5623 '') dflt='none' ;;
5624 esac
5625
5626 $cat <<EOH
5627
5628 Your C linker may need flags.  For this question you should
5629 include -L/whatever and any other flags used by the C linker, but you
5630 should NOT include libraries like -lwhatever.
5631
5632 Make sure you include the appropriate -L/path flags if your C linker
5633 does not normally search all of the directories you specified above,
5634 namely
5635         $libpth
5636 To use no flags, specify the word "none".
5637
5638 EOH
5639
5640 rp="Any additional ld flags (NOT including libraries)?"
5641 . ./myread
5642 case "$ans" in
5643 none) ldflags='';;
5644 *) ldflags="$ans";;
5645 esac
5646 rmlist="$rmlist pdp11"
5647
5648 : coherency check
5649 echo " "
5650 echo "Checking your choice of C compiler and flags for coherency..." >&4
5651 $cat > try.c <<'EOF'
5652 #include <stdio.h>
5653 int main() { printf("Ok\n"); return(0); }
5654 EOF
5655 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5656 shift
5657 $cat >try.msg <<'EOM'
5658 I've tried to compile and run the following simple program:
5659
5660 EOM
5661 $cat try.c >> try.msg
5662
5663 $cat >> try.msg <<EOM
5664
5665 I used the command:
5666
5667         $*
5668         $run ./try
5669
5670 and I got the following output:
5671
5672 EOM
5673 dflt=y
5674 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5675         if $sh -c "$run ./try " >>try.msg 2>&1; then
5676                 xxx=`$run ./try`
5677                 case "$xxx" in
5678                 "Ok") dflt=n ;;
5679                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5680                 esac
5681         else
5682                 echo "The program compiled OK, but exited with status $?." >>try.msg
5683                 rp="You have a problem.  Shall I abort Configure"
5684                 dflt=y
5685         fi
5686 else
5687         echo "I can't compile the test program." >>try.msg
5688         rp="You have a BIG problem.  Shall I abort Configure"
5689         dflt=y
5690 fi
5691 case "$dflt" in
5692 y)
5693         $cat try.msg >&4
5694         case "$knowitall" in
5695         '')
5696                 echo "(The supplied flags or libraries might be incorrect.)"
5697                 ;;
5698         *) dflt=n;;
5699         esac
5700         echo " "
5701         . ./myread
5702         case "$ans" in
5703         n*|N*) ;;
5704         *)      echo "Ok.  Stopping Configure." >&4
5705                 exit 1
5706                 ;;
5707         esac
5708         ;;
5709 n) echo "OK, that should do.";;
5710 esac
5711 $rm_try gcctest gcctest.out
5712
5713 : define a shorthand compile call
5714 compile='
5715 mc_file=$1;
5716 shift;
5717 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5718 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5719 exit 1;
5720 fi;
5721 esac;
5722 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5723 : define a shorthand compile call for compilations that should be ok.
5724 compile_ok='
5725 mc_file=$1;
5726 shift;
5727 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5728
5729 : determine filename position in cpp output
5730 echo " "
5731 echo "Computing filename position in cpp output for #include directives..." >&4
5732 case "$osname" in
5733 vos) testaccess=-e ;;
5734 *)   testaccess=-r ;;
5735 esac
5736 echo '#include <stdio.h>' > foo.c
5737 $cat >fieldn <<EOF
5738 $startsh
5739 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5740 $grep '^[       ]*#.*stdio\.h' | \
5741 while read cline; do
5742         pos=1
5743         set \$cline
5744         while $test \$# -gt 0; do
5745                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5746                         echo "\$pos"
5747                         exit 0
5748                 fi
5749                 shift
5750                 pos=\`expr \$pos + 1\`
5751         done
5752 done
5753 EOF
5754 chmod +x fieldn
5755 fieldn=`./fieldn`
5756 $rm -f foo.c fieldn
5757 case $fieldn in
5758 '') pos='???';;
5759 1) pos=first;;
5760 2) pos=second;;
5761 3) pos=third;;
5762 *) pos="${fieldn}th";;
5763 esac
5764 echo "Your cpp writes the filename in the $pos field of the line."
5765
5766 : locate header file
5767 $cat >findhdr <<EOF
5768 $startsh
5769 wanted=\$1
5770 name=''
5771 for usrincdir in $incpth
5772 do
5773         if test -f \$usrincdir/\$wanted; then
5774                 echo "\$usrincdir/\$wanted"
5775                 exit 0
5776         fi
5777 done
5778 awkprg='{ print \$$fieldn }'
5779 echo "#include <\$wanted>" > foo\$\$.c
5780 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5781 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5782 while read cline; do
5783         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5784         case "\$name" in
5785         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5786         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5787         *) exit 2;;
5788         esac;
5789 done;
5790 #
5791 # status = 0: grep returned 0 lines, case statement not executed
5792 # status = 1: headerfile found
5793 # status = 2: while loop executed, no headerfile found
5794 #
5795 status=\$?
5796 $rm -f foo\$\$.c;
5797 if test \$status -eq 1; then
5798         exit 0;
5799 fi
5800 exit 1
5801 EOF
5802 chmod +x findhdr
5803
5804 : define an alternate in-header-list? function
5805 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5806 cont=true; xxf="echo \"<\$1> found.\" >&4";
5807 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5808 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5809 esac;
5810 case $# in 4) instead=instead;; *) instead="at last";; esac;
5811 while $test "$cont"; do
5812         xxx=`./findhdr $1`
5813         var=$2; eval "was=\$$2";
5814         if $test "$xxx" && $test -r "$xxx";
5815         then eval $xxf;
5816         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5817                 cont="";
5818         else eval $xxnf;
5819         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5820         set $yyy; shift; shift; yyy=$@;
5821         case $# in 0) cont="";;
5822         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5823                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5824         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5825                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5826         esac;
5827 done;
5828 while $test "$yyy";
5829 do set $yyy; var=$2; eval "was=\$$2";
5830         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5831         set $yyy; shift; shift; yyy=$@;
5832 done'
5833
5834 : see if stdlib is available
5835 set stdlib.h i_stdlib
5836 eval $inhdr
5837
5838 : check for lengths of integral types
5839 echo " "
5840 case "$intsize" in
5841 '')
5842         echo "Checking to see how big your integers are..." >&4
5843         $cat >try.c <<EOCP
5844 #include <stdio.h>
5845 #$i_stdlib I_STDLIB
5846 #ifdef I_STDLIB
5847 #include <stdlib.h>
5848 #endif
5849 int main()
5850 {
5851         printf("intsize=%d;\n", (int)sizeof(int));
5852         printf("longsize=%d;\n", (int)sizeof(long));
5853         printf("shortsize=%d;\n", (int)sizeof(short));
5854         exit(0);
5855 }
5856 EOCP
5857         set try
5858         if eval $compile_ok && $run ./try > /dev/null; then
5859                 eval `$run ./try`
5860                 echo "Your integers are $intsize bytes long."
5861                 echo "Your long integers are $longsize bytes long."
5862                 echo "Your short integers are $shortsize bytes long."
5863         else
5864                 $cat >&4 <<EOM
5865 !
5866 Help! I can't compile and run the intsize test program: please enlighten me!
5867 (This is probably a misconfiguration in your system or libraries, and
5868 you really ought to fix it.  Still, I'll try anyway.)
5869 !
5870 EOM
5871                 dflt=4
5872                 rp="What is the size of an integer (in bytes)?"
5873                 . ./myread
5874                 intsize="$ans"
5875                 dflt=$intsize
5876                 rp="What is the size of a long integer (in bytes)?"
5877                 . ./myread
5878                 longsize="$ans"
5879                 dflt=2
5880                 rp="What is the size of a short integer (in bytes)?"
5881                 . ./myread
5882                 shortsize="$ans"
5883         fi
5884         ;;
5885 esac
5886 $rm_try
5887
5888 : check for long long
5889 echo " "
5890 echo "Checking to see if you have long long..." >&4
5891 echo 'int main() { long long x = 7; return 0; }' > try.c
5892 set try
5893 if eval $compile; then
5894         val="$define"
5895         echo "You have long long."
5896 else
5897         val="$undef"
5898         echo "You do not have long long."
5899 fi
5900 $rm_try
5901 set d_longlong
5902 eval $setvar
5903
5904 : check for length of long long
5905 case "${d_longlong}${longlongsize}" in
5906 $define)
5907         echo " "
5908         echo "Checking to see how big your long longs are..." >&4
5909         $cat >try.c <<'EOCP'
5910 #include <stdio.h>
5911 int main()
5912 {
5913     printf("%d\n", (int)sizeof(long long));
5914     return(0);
5915 }
5916 EOCP
5917         set try
5918         if eval $compile_ok; then
5919                 longlongsize=`$run ./try`
5920                 echo "Your long longs are $longlongsize bytes long."
5921         else
5922                 dflt='8'
5923                 echo " "
5924                 echo "(I can't seem to compile the test program.  Guessing...)"
5925                 rp="What is the size of a long long (in bytes)?"
5926                 . ./myread
5927                 longlongsize="$ans"
5928         fi
5929         if $test "X$longsize" = "X$longlongsize"; then
5930                 echo "(That isn't any different from an ordinary long.)"
5931         fi
5932         ;;
5933 esac
5934 $rm_try
5935
5936 : see if inttypes.h is available
5937 : we want a real compile instead of Inhdr because some systems
5938 : have an inttypes.h which includes non-existent headers
5939 echo " "
5940 $cat >try.c <<EOCP
5941 #include <inttypes.h>
5942 int main() {
5943         static int32_t foo32 = 0x12345678;
5944 }
5945 EOCP
5946 set try
5947 if eval $compile; then
5948         echo "<inttypes.h> found." >&4
5949         val="$define"
5950 else
5951         echo "<inttypes.h> NOT found." >&4
5952         val="$undef"
5953 fi
5954 $rm_try
5955 set i_inttypes
5956 eval $setvar
5957
5958 : check for int64_t
5959 echo " "
5960 echo "Checking to see if you have int64_t..." >&4
5961 $cat >try.c <<EOCP
5962 #include <sys/types.h>
5963 #$i_inttypes I_INTTYPES
5964 #ifdef I_INTTYPES
5965 #include <inttypes.h>
5966 #endif
5967 int main() { int64_t x = 7; }
5968 EOCP
5969 set try
5970 if eval $compile; then
5971         val="$define"
5972         echo "You have int64_t."
5973 else
5974         val="$undef"
5975         echo "You do not have int64_t."
5976 fi
5977 $rm_try
5978 set d_int64_t
5979 eval $setvar
5980
5981 : Check if 64bit ints have a quad type
5982 echo " "
5983 echo "Checking which 64-bit integer type we could use..." >&4
5984
5985 case "$intsize" in
5986 8) val=int
5987    set quadtype
5988    eval $setvar
5989    val='"unsigned int"'
5990    set uquadtype
5991    eval $setvar
5992    quadkind=1
5993    ;;
5994 *) case "$longsize" in
5995    8) val=long
5996       set quadtype
5997       eval $setvar
5998       val='"unsigned long"'
5999       set uquadtype
6000       eval $setvar
6001       quadkind=2
6002       ;;
6003    *) case "$d_longlong:$longlongsize" in
6004       define:8)
6005         val='"long long"'
6006         set quadtype
6007         eval $setvar
6008         val='"unsigned long long"'
6009         set uquadtype
6010         eval $setvar
6011         quadkind=3
6012         ;;
6013       *) case "$d_int64_t" in
6014          define)
6015            val=int64_t
6016            set quadtype
6017            eval $setvar
6018            val=uint64_t
6019            set uquadtype
6020            eval $setvar
6021            quadkind=4
6022            ;;
6023          esac
6024          ;;
6025       esac
6026       ;;
6027    esac
6028    ;;
6029 esac
6030
6031 case "$quadtype" in
6032 '')     echo "Alas, no 64-bit integer types in sight." >&4
6033         d_quad="$undef"
6034         ;;
6035 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6036         d_quad="$define"
6037         ;;
6038 esac
6039
6040 : Do we want 64bit support
6041 case "$uselonglong" in
6042 "$define"|true|[yY]*)
6043         cat <<EOM >&4
6044
6045 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6046 EOM
6047         use64bitint="$define"
6048         ;;
6049 esac
6050 case "$use64bits" in
6051 "$define"|true|[yY]*)
6052         cat <<EOM >&4
6053
6054 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6055 EOM
6056         use64bitint="$define"
6057         ;;
6058 esac
6059 case "$use64bitints" in
6060 "$define"|true|[yY]*)
6061         cat <<EOM >&4
6062
6063 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6064 EOM
6065         use64bitint="$define"
6066         ;;
6067 esac
6068 case "$use64bitsint" in
6069 "$define"|true|[yY]*)
6070         cat <<EOM >&4
6071
6072 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6073 EOM
6074         use64bitint="$define"
6075         ;;
6076 esac
6077 case "$uselonglongs" in
6078 "$define"|true|[yY]*)
6079         cat <<EOM >&4
6080
6081 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6082 EOM
6083         use64bitint="$define"
6084         ;;
6085 esac
6086 case "$use64bitsall" in
6087 "$define"|true|[yY]*)
6088         cat <<EOM >&4
6089
6090 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6091 EOM
6092         use64bitall="$define"
6093         ;;
6094 esac
6095
6096 case "$ccflags" in
6097 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6098 esac
6099 case "$use64bitall" in
6100 "$define"|true|[yY]*) use64bitint="$define" ;;
6101 esac
6102
6103 case "$longsize" in
6104 8) cat <<EOM
6105
6106 You have natively 64-bit long integers.
6107 EOM
6108    val="$define"
6109    ;;
6110 *) case "$use64bitint" in
6111    "$define"|true|[yY]*) dflt='y';;
6112    *) dflt='n';;
6113    esac
6114    case "$d_quad" in
6115    "$define") ;;
6116    *) dflt='n' ;;
6117    esac
6118    cat <<EOM
6119
6120 Perl can be built to take advantage of 64-bit integer types
6121 on some systems.  To do so, Configure can be run with -Duse64bitint.
6122 Choosing this option will most probably introduce binary incompatibilities.
6123
6124 If this doesn't make any sense to you, just accept the default '$dflt'.
6125 (The default has been chosen based on your configuration.)
6126 EOM
6127    rp='Try to use 64-bit integers, if available?'
6128    . ./myread
6129    case "$ans" in
6130    [yY]*) val="$define" ;;
6131    *)     val="$undef"  ;;
6132    esac
6133    ;;
6134 esac
6135 set use64bitint
6136 eval $setvar
6137
6138 case "$use64bitall" in
6139 "$define"|true|[yY]*) dflt='y' ;;
6140 *) case "$longsize" in
6141    8) dflt='y' ;;
6142    *) dflt='n' ;;
6143    esac
6144    ;;
6145 esac
6146 cat <<EOM
6147
6148 You may also choose to try maximal 64-bitness.  It means using as much
6149 64-bitness as possible on the platform.  This in turn means even more
6150 binary incompatibilities.  On the other hand, your platform may not
6151 have any more 64-bitness available than what you already have chosen.
6152
6153 If this doesn't make any sense to you, just accept the default '$dflt'.
6154 (The default has been chosen based on your configuration.)
6155 EOM
6156 rp='Try to use maximal 64-bit support, if available?'
6157 . ./myread
6158 case "$ans" in
6159 [yY]*) val="$define" ;;
6160 *)     val="$undef"  ;;
6161 esac
6162 set use64bitall
6163 eval $setvar
6164 case "$use64bitall" in
6165 "$define")
6166         case "$use64bitint" in
6167         "$undef")
6168                 cat <<EOM
6169
6170 Since you have chosen a maximally 64-bit build, I'm also turning on
6171 the use of 64-bit integers.
6172 EOM
6173                 use64bitint="$define" ;;
6174         esac
6175         ;;
6176 esac
6177
6178 : Look for a hint-file generated 'call-back-unit'.  If the
6179 : user has specified that a 64-bit perl is to be built,
6180 : we may need to set or change some other defaults.
6181 if $test -f use64bitint.cbu; then
6182         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6183         . ./use64bitint.cbu
6184 fi
6185 case "$use64bitint" in
6186 "$define"|true|[yY]*)
6187         : This test was common to all the OpenBSD forks, and seems harmless for
6188         : other platforms:
6189         echo " "
6190         echo "Checking if your C library has broken 64-bit functions..." >&4
6191         cat >try.c <<EOCP
6192 #include <stdio.h>
6193 typedef $uquadtype myULL;
6194 int main (void)
6195 {
6196     struct {
6197         double d;
6198         myULL  u;
6199     } *p, test[] = {
6200         {4294967303.15, 4294967303ULL},
6201         {4294967294.2,  4294967294ULL},
6202         {4294967295.7,  4294967295ULL},
6203         {0.0, 0ULL}
6204     };
6205     for (p = test; p->u; p++) {
6206         myULL x = (myULL)p->d;
6207         if (x != p->u) {
6208             printf("buggy\n");
6209             return 0;
6210         }
6211     }
6212     printf("ok\n");
6213     return 0;
6214 }
6215 EOCP
6216         set try
6217         if eval $compile_ok; then
6218             libcquad=`$run ./try`
6219             echo "Your C library's 64-bit functions are $libcquad."
6220         else
6221             echo "(I can't seem to compile the test program.)"
6222             echo "Assuming that your C library's 64-bit functions are ok."
6223             libcquad="ok"
6224         fi
6225         $rm_try
6226
6227         case "$libcquad" in
6228             buggy*)
6229                 cat >&4 <<EOM
6230
6231 *** You have a C library with broken 64-bit functions.
6232 *** 64-bit support does not work reliably in this configuration.
6233 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6234 *** Cannot continue, aborting.
6235
6236 EOM
6237                 exit 1
6238                 ;;
6239         esac
6240         case "$longsize" in
6241         4) case "$archname64" in
6242            '') archname64=64int ;;
6243            esac
6244            ;;
6245         esac
6246         ;;
6247 esac
6248
6249 : Look for a hint-file generated 'call-back-unit'.  If the
6250 : user has specified that a maximally 64-bit perl is to be built,
6251 : we may need to set or change some other defaults.
6252 if $test -f use64bitall.cbu; then
6253         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6254         . ./use64bitall.cbu
6255 fi
6256 case "$use64bitall" in
6257 "$define"|true|[yY]*)
6258         case "$longsize" in
6259         4) case "$archname64" in
6260            ''|64int) archname64=64all ;;
6261            esac
6262            ;;
6263         esac
6264         ;;
6265 esac
6266
6267 case "$d_quad:$use64bitint" in
6268 $undef:$define)
6269         cat >&4 <<EOF
6270
6271 *** You have chosen to use 64-bit integers,
6272 *** but none can be found.
6273 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6274 *** Cannot continue, aborting.
6275
6276 EOF
6277         exit 1
6278         ;;
6279 esac
6280
6281 : Check if we are using the GNU C library
6282 echo " "
6283 echo "Checking for GNU C Library..." >&4
6284 cat >try.c <<'EOCP'
6285 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6286    alone are insufficient to distinguish different versions, such as
6287    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6288    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6289 */
6290 #include <stdio.h>
6291 int main(void)
6292 {
6293 #ifdef __GLIBC__
6294 #   ifdef __GLIBC_MINOR__
6295 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6296 #           include <gnu/libc-version.h>
6297             printf("%s\n",  gnu_get_libc_version());
6298 #       else
6299             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6300 #       endif
6301 #   else
6302         printf("%d\n",  __GLIBC__);
6303 #   endif
6304     return 0;
6305 #else
6306     return 1;
6307 #endif
6308 }
6309 EOCP
6310 set try
6311 if eval $compile_ok && $run ./try > glibc.ver; then
6312         val="$define"
6313         gnulibc_version=`$cat glibc.ver`
6314         echo "You are using the GNU C Library version $gnulibc_version"
6315 else
6316         val="$undef"
6317         gnulibc_version=''
6318         echo "You are not using the GNU C Library"
6319 fi
6320 $rm_try glibc.ver
6321 set d_gnulibc
6322 eval $setvar
6323
6324 : see if nm is to be used to determine whether a symbol is defined or not
6325 case "$usenm" in
6326 '')
6327         dflt=''
6328         case "$d_gnulibc" in
6329         "$define")
6330                 echo " "
6331                 echo "nm probably won't work on the GNU C Library." >&4
6332                 dflt=n
6333                 ;;
6334         esac
6335         case "$dflt" in
6336         '')
6337                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6338                         echo " "
6339                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6340                         echo "'nm' won't be sufficient on this system." >&4
6341                         dflt=n
6342                 fi
6343                 ;;
6344         esac
6345         case "$dflt" in
6346         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6347                 if $test $dflt -gt 20; then
6348                         dflt=y
6349                 else
6350                         dflt=n
6351                 fi
6352                 ;;
6353         esac
6354         ;;
6355 *)
6356         case "$usenm" in
6357         true|$define) dflt=y;;
6358         *) dflt=n;;
6359         esac
6360         ;;
6361 esac
6362 $cat <<EOM
6363
6364 I can use $nm to extract the symbols from your C libraries. This
6365 is a time consuming task which may generate huge output on the disk (up
6366 to 3 megabytes) but that should make the symbols extraction faster. The
6367 alternative is to skip the 'nm' extraction part and to compile a small
6368 test program instead to determine whether each symbol is present. If
6369 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6370 this may be the best solution.
6371
6372 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6373
6374 EOM
6375 rp="Shall I use $nm to extract C symbols from the libraries?"
6376 . ./myread
6377 case "$ans" in
6378 [Nn]*) usenm=false;;
6379 *) usenm=true;;
6380 esac
6381
6382 runnm=$usenm
6383 case "$reuseval" in
6384 true) runnm=false;;
6385 esac
6386
6387 : nm options which may be necessary
6388 case "$nm_opt" in
6389 '') if $test -f /mach_boot; then
6390                 nm_opt=''       # Mach
6391         elif $test -d /usr/ccs/lib; then
6392                 nm_opt='-p'     # Solaris (and SunOS?)
6393         elif $test -f /dgux; then
6394                 nm_opt='-p'     # DG-UX
6395         elif $test -f /lib64/rld; then
6396                 nm_opt='-p'     # 64-bit Irix
6397         else
6398                 nm_opt=''
6399         fi;;
6400 esac
6401
6402 : nm options which may be necessary for shared libraries but illegal
6403 : for archive libraries.  Thank you, Linux.
6404 case "$nm_so_opt" in
6405 '')     case "$myuname" in
6406         *linux*|gnu*)
6407                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6408                         nm_so_opt='--dynamic'
6409                 fi
6410                 ;;
6411         esac
6412         ;;
6413 esac
6414
6415 : Figure out where the libc is located
6416 case "$runnm" in
6417 true)
6418 : get list of predefined functions in a handy place
6419 echo " "
6420 case "$libc" in
6421 '') libc=unknown
6422         case "$libs" in
6423         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6424         esac
6425         ;;
6426 esac
6427 case "$libs" in
6428 '') ;;
6429 *)  for thislib in $libs; do
6430         case "$thislib" in
6431         -lc|-lc_s)
6432                 : Handle C library specially below.
6433                 ;;
6434         -l*)
6435                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6436                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6437                         :
6438                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6439                         :
6440                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6441                         :
6442                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6443                         :
6444                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6445                         :
6446                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6447                         :
6448                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6449                         :
6450                 else
6451                         try=''
6452                 fi
6453                 libnames="$libnames $try"
6454                 ;;
6455         *) libnames="$libnames $thislib" ;;
6456         esac
6457         done
6458         ;;
6459 esac
6460 xxx=normal
6461 case "$libc" in
6462 unknown)
6463         set /lib/libc.$so
6464         for xxx in $libpth; do
6465                 $test -r $1 || set $xxx/libc.$so
6466                 : The messy sed command sorts on library version numbers.
6467                 $test -r $1 || \
6468                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6469                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6470                                 h
6471                                 s/[0-9][0-9]*/0000&/g
6472                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6473                                 G
6474                                 s/\n/ /' | \
6475                          $sort | $sed -e 's/^.* //'`
6476                 eval set \$$#
6477         done
6478         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6479         $test -r $1 || set $sysroot/lib/libsys_s$_a
6480         ;;
6481 *)
6482         set blurfl
6483         ;;
6484 esac
6485 if $test -r "$1"; then
6486         echo "Your (shared) C library seems to be in $1."
6487         libc="$1"
6488 elif $test -r /lib/libc && $test -r /lib/clib; then
6489         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6490         xxx=apollo
6491         libc='/lib/clib /lib/libc'
6492         if $test -r /lib/syslib; then
6493                 echo "(Your math library is in /lib/syslib.)"
6494                 libc="$libc /lib/syslib"
6495         fi
6496 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6497         echo "Your C library seems to be in $libc, as you said before."
6498 elif $test -r $incpath/usr/lib/libc$_a; then
6499         libc=$incpath/usr/lib/libc$_a;
6500         echo "Your C library seems to be in $libc.  That's fine."
6501 elif $test -r /lib/libc$_a; then
6502         libc=/lib/libc$_a;
6503         echo "Your C library seems to be in $libc.  You're normal."
6504 else
6505         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6506                 :
6507         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6508                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6509         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6510                 :
6511         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6512                 :
6513         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6514                 :
6515         else
6516                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6517         fi
6518         if $test -r "$tans"; then
6519                 echo "Your C library seems to be in $tans, of all places."
6520                 libc=$tans
6521         else
6522                 libc='blurfl'
6523         fi
6524 fi
6525 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6526         dflt="$libc"
6527         cat <<EOM
6528
6529 If the guess above is wrong (which it might be if you're using a strange
6530 compiler, or your machine supports multiple models), you can override it here.
6531
6532 EOM
6533 else
6534         dflt=''
6535         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6536         cat >&4 <<EOM
6537 I can't seem to find your C library.  I've looked in the following places:
6538
6539 EOM
6540         $sed 's/^/      /' libpath
6541         cat <<EOM
6542
6543 None of these seems to contain your C library. I need to get its name...
6544
6545 EOM
6546 fi
6547 fn=f
6548 rp='Where is your C library?'
6549 . ./getfile
6550 libc="$ans"
6551
6552 echo " "
6553 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6554 set X `cat libnames`
6555 shift
6556 xxx=files
6557 case $# in 1) xxx=file; esac
6558 echo "Extracting names from the following $xxx for later perusal:" >&4
6559 echo " "
6560 $sed 's/^/      /' libnames >&4
6561 echo " "
6562 $echo $n "This may take a while...$c" >&4
6563
6564 for file in $*; do
6565         case $file in
6566         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6567         *) $nm $nm_opt $file 2>/dev/null;;
6568         esac
6569 done >libc.tmp
6570
6571 $echo $n ".$c"
6572 $grep fprintf libc.tmp > libc.ptf
6573 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6574 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6575 xxx='[ADTSIWi]'
6576 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6577         eval $xscan;\
6578         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6579                 eval $xrun
6580 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6581         eval $xscan;\
6582         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6583                 eval $xrun
6584 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6585         eval $xscan;\
6586         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6587                 eval $xrun
6588 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6589         eval $xscan;\
6590         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6591                 eval $xrun
6592 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6593         eval $xscan;\
6594         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6595                 eval $xrun
6596 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6597         eval $xscan;\
6598         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6599                 eval $xrun
6600 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6601                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6602         eval $xscan;\
6603         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6604                 eval $xrun
6605 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6606         eval $xscan;\
6607         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6608                 eval $xrun
6609 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6610         eval $xscan;\
6611         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6612                 eval $xrun
6613 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6614         eval $xscan;\
6615         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6616                 eval $xrun
6617 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6618         eval $xscan;\
6619         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6620                 eval $xrun
6621 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\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/.*\.text n\ \ \ \.//p'";\
6626         eval $xscan;\
6627         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6628                 eval $xrun
6629 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6630         eval $xscan;\
6631         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6632                 eval $xrun
6633 else
6634         $nm -p $* 2>/dev/null >libc.tmp
6635         $grep fprintf libc.tmp > libc.ptf
6636         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6637                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6638         then
6639                 nm_opt='-p'
6640                 eval $xrun
6641         else
6642                 echo " "
6643                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6644                 com=''
6645                 if $ar t $libc > libc.tmp && \
6646                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6647                 then
6648                         for thisname in $libnames $libc; do
6649                                 $ar t $thisname >>libc.tmp
6650                         done
6651                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6652                         echo "Ok." >&4
6653                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6654                         for thisname in $libnames $libc; do
6655                                 $ar tv $thisname >>libc.tmp
6656                                 emximp -o tmp.imp $thisname \
6657                                     2>/dev/null && \
6658                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6659                                     < tmp.imp >>libc.tmp
6660                                 $rm -f tmp.imp
6661                         done
6662                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6663                         echo "Ok." >&4
6664                 else
6665                         echo "$ar didn't seem to work right." >&4
6666                         echo "Maybe this is a Cray...trying bld instead..." >&4
6667                         if  bld t $libc | \
6668                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6669                                 $test -s libc.list
6670                         then
6671                                 for thisname in $libnames; do
6672                                         bld t $libnames | \
6673                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6674                                         $ar t $thisname >>libc.tmp
6675                                 done
6676                                 echo "Ok." >&4
6677                         else
6678                                 echo "That didn't work either.  Giving up." >&4
6679                                 exit 1
6680                         fi
6681                 fi
6682         fi
6683 fi
6684 nm_extract="$com"
6685 case "$PASE" in
6686 define)
6687     echo " "
6688     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6689     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6690     ;;
6691 *)  if $test -f /lib/syscalls.exp; then
6692         echo " "
6693         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6694         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6695                 /lib/syscalls.exp >>libc.list
6696     fi
6697     ;;
6698 esac
6699 ;;
6700 esac
6701 $rm -f libnames libpath
6702
6703 : Check if we are using C++
6704 echo " "
6705 echo "Checking for C++..." >&4
6706 $cat >try.c <<'EOCP'
6707 #include <stdio.h>
6708 int main(void)
6709 {
6710 #ifdef __cplusplus
6711     return 0;
6712 #else
6713     return 1;
6714 #endif
6715 }
6716 EOCP
6717 set try
6718 if eval $compile_ok && $run ./try; then
6719         val="$define"
6720         echo "You are using a C++ compiler."
6721 else
6722         val="$undef"
6723         echo "You are not using a C++ compiler."
6724 fi
6725 $rm_try cplusplus$$
6726 set d_cplusplus
6727 eval $setvar
6728
6729 : is a C symbol defined?
6730 csym='tlook=$1;
6731 case "$3" in
6732 -v) tf=libc.tmp; tdc="";;
6733 -a) tf=libc.tmp; tdc="[]";;
6734 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6735 esac;
6736 case "$d_cplusplus" in
6737     $define)    extern_C="extern \"C\"" ;;
6738     *)          extern_C="extern"       ;;
6739 esac;
6740 tx=yes;
6741 case "$reuseval-$4" in
6742 true-) ;;
6743 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6744 esac;
6745 case "$tx" in
6746 yes)
6747         tval=false;
6748         if $test "$runnm" = true; then
6749                 if $contains $tlook $tf >/dev/null 2>&1; then
6750                         tval=true;
6751                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6752                         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;
6753                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6754                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6755                         $rm_try;
6756                 fi;
6757         else
6758                 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;
6759                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6760                 $rm_try;
6761         fi;
6762         ;;
6763 *)
6764         case "$tval" in
6765         $define) tval=true;;
6766         *) tval=false;;
6767         esac;
6768         ;;
6769 esac;
6770 eval "$2=$tval"'
6771
6772 : define an is-in-libc? function
6773 inlibc='echo " "; td=$define; tu=$undef;
6774 sym=$1; var=$2; eval "was=\$$2";
6775 tx=yes;
6776 case "$reuseval$was" in
6777 true) ;;
6778 true*) tx=no;;
6779 esac;
6780 case "$tx" in
6781 yes)
6782         set $sym tres -f;
6783         eval $csym;
6784         case "$tres" in
6785         true)
6786                 echo "$sym() found." >&4;
6787                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6788         *)
6789                 echo "$sym() NOT found." >&4;
6790                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6791         esac;;
6792 *)
6793         case "$was" in
6794         $define) echo "$sym() found." >&4;;
6795         *) echo "$sym() NOT found." >&4;;
6796         esac;;
6797 esac'
6798
6799 : check for length of double
6800 echo " "
6801 case "$doublesize" in
6802 '')
6803         echo "Checking to see how big your double precision numbers are..." >&4
6804         $cat >try.c <<EOCP
6805 #include <stdio.h>
6806 #$i_stdlib I_STDLIB
6807 #ifdef I_STDLIB
6808 #include <stdlib.h>
6809 #endif
6810 int main()
6811 {
6812     printf("%d\n", (int)sizeof(double));
6813     exit(0);
6814 }
6815 EOCP
6816         set try
6817         if eval $compile_ok; then
6818                 doublesize=`$run ./try`
6819                 echo "Your double is $doublesize bytes long."
6820         else
6821                 dflt='8'
6822                 echo "(I can't seem to compile the test program.  Guessing...)"
6823                 rp="What is the size of a double precision number (in bytes)?"
6824                 . ./myread
6825                 doublesize="$ans"
6826         fi
6827         ;;
6828 esac
6829 $rm_try
6830
6831 : see if this is a float.h system
6832 set float.h i_float
6833 eval $inhdr
6834
6835 : check for long doubles
6836 echo " "
6837 echo "Checking to see if you have long double..." >&4
6838 echo 'int main() { long double x = 7.0; }' > try.c
6839 set try
6840 if eval $compile; then
6841         val="$define"
6842         echo "You have long double."
6843 else
6844         val="$undef"
6845         echo "You do not have long double."
6846 fi
6847 $rm_try
6848 set d_longdbl
6849 eval $setvar
6850
6851 : see if ldexpl exists
6852 set ldexpl d_ldexpl
6853 eval $inlibc
6854
6855 : check for length of long double
6856 case "${d_longdbl}${longdblsize}" in
6857 $define)
6858         echo " "
6859         echo "Checking to see how big your long doubles are..." >&4
6860         $cat >try.c <<'EOCP'
6861 #include <stdio.h>
6862 int main()
6863 {
6864         printf("%d\n", sizeof(long double));
6865 }
6866 EOCP
6867         set try
6868         set try
6869         if eval $compile; then
6870                 longdblsize=`$run ./try`
6871                 echo "Your long doubles are $longdblsize bytes long."
6872         else
6873                 dflt='8'
6874                 echo " "
6875                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6876                 rp="What is the size of a long double (in bytes)?"
6877                 . ./myread
6878                 longdblsize="$ans"
6879         fi
6880         if $test "X$doublesize" = "X$longdblsize"; then
6881                 echo "That isn't any different from an ordinary double."
6882                 echo "I'll keep your setting anyway, but you may see some"
6883                 echo "harmless compilation warnings."
6884         fi
6885         ;;
6886 esac
6887 $rm_try
6888
6889 $echo "Checking the kind of long doubles you have..." >&4
6890 case "$d_longdbl" in
6891 define)
6892 $cat <<EOP >try.c
6893 #$i_float I_FLOAT
6894 #$i_stdlib I_STDLIB
6895 #define LONGDBLSIZE $longdblsize
6896 #define DOUBLESIZE $doublesize
6897 #ifdef I_FLOAT
6898 #include <float.h>
6899 #endif
6900 #ifdef I_STDLIB
6901 #include <stdlib.h>
6902 #endif
6903 #include <stdio.h>
6904 static const long double d = -0.1L;
6905 int main() {
6906   unsigned const char* b = (unsigned const char*)(&d);
6907 #if DOUBLESIZE == LONGDBLSIZE
6908   printf("0\n"); /* if it floats like double */
6909   exit(0);
6910 #endif
6911 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6912   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6913     /* IEEE 754 128-bit little-endian */
6914     printf("1\n");
6915     exit(0);
6916   }
6917   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6918     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6919     printf("2\n");
6920     exit(0);
6921   }
6922 #endif
6923 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6924  * while 64-bits platforms have it in 16 bytes. */
6925 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6926   if (b[0] == 0xCD && b[9] == 0xBF && b[10] == 0x00) {
6927     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6928      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6929      * Also known as "extended precision". */
6930     printf("3\n");
6931     exit(0);
6932   }
6933   if (b[0] == 0xBF && b[9] == 0xCD && b[10] == 0x00) {
6934     /* is there ever big-endian 80-bit, really? */
6935     printf("4\n");
6936     exit(0);
6937   }
6938 #endif
6939 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
6940   /* software "double double", the 106 is 53+53.
6941    * but irix thinks it is 107. */
6942   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
6943     /* double double 128-bit little-endian,
6944      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
6945     printf("5\n");
6946     exit(0);
6947   }
6948   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
6949     /* double double 128-bit big-endian, e.g. PPC/Power and MIPS:
6950      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
6951     printf("6\n");
6952     exit(0);
6953   }
6954 #endif
6955   printf("-1\n"); /* unknown */
6956   exit(0);
6957 }
6958 EOP
6959 set try
6960 if eval $compile; then
6961     longdblkind=`$run ./try`
6962 else
6963     longdblkind=-1
6964 fi
6965 ;;
6966 *) longdblkind=0 ;;
6967 esac
6968 case "$longdblkind" in
6969 0) echo "Your long doubles are doubles." >&4 ;;
6970 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
6971 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
6972 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
6973 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
6974 5) echo "You have 128-bit little-endian double-double long doubles." >& 4 ;;
6975 6) echo "You have 128-bit big-endian double-double long doubles." >& 4 ;;
6976 *) echo "Cannot figure out your long double." >&4 ;;
6977 esac
6978 $rm_try
6979
6980 : determine the architecture name
6981 echo " "
6982 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6983         tarch=`arch`"-$osname"
6984 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6985         if uname -m > tmparch 2>&1 ; then
6986                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6987                         -e 's/$/'"-$osname/" tmparch`
6988         else
6989                 tarch="$osname"
6990         fi
6991         $rm -f tmparch
6992 else
6993         tarch="$osname"
6994 fi
6995 case "$myarchname" in
6996 ''|"$tarch") ;;
6997 *)
6998         echo "(Your architecture name used to be $myarchname.)"
6999         archname=''
7000         ;;
7001 esac
7002 case "$targetarch" in
7003 '') ;;
7004 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7005 esac
7006 myarchname="$tarch"
7007 case "$archname" in
7008 '') dflt="$tarch";;
7009 *) dflt="$archname";;
7010 esac
7011 rp='What is your architecture name'
7012 . ./myread
7013 archname="$ans"
7014
7015 : optionally add API version to the architecture for versioned archlibs
7016 case "$useversionedarchname" in
7017 $define|true|[yY]*) dflt='y';;
7018 *)                  dflt='n';;
7019 esac
7020 rp='Add the Perl API version to your archname?'
7021 . ./myread
7022 case "$ans" in
7023 y|Y)    useversionedarchname="$define" ;;
7024 *)      useversionedarchname="$undef" ;;
7025 esac
7026 case "$useversionedarchname" in
7027 $define)
7028         case "$archname" in
7029         *-$api_versionstring)
7030                 echo "...and architecture name already has -$api_versionstring" >&4
7031                 ;;
7032         *)
7033                 archname="$archname-$api_versionstring"
7034                 echo "...setting architecture name to $archname." >&4
7035                 ;;
7036         esac
7037         ;;
7038 esac
7039
7040 case "$usethreads" in
7041 $define)
7042         echo "Threads selected." >&4
7043         case "$archname" in
7044         *-thread*) echo "...and architecture name already has -thread." >&4
7045                 ;;
7046         *)      archname="$archname-thread"
7047                 echo "...setting architecture name to $archname." >&4
7048                 ;;
7049         esac
7050         ;;
7051 esac
7052 case "$usemultiplicity" in
7053 $define)
7054         echo "Multiplicity selected." >&4
7055         case "$archname" in
7056         *-multi*) echo "...and architecture name already has -multi." >&4
7057                 ;;
7058         *)      archname="$archname-multi"
7059                 echo "...setting architecture name to $archname." >&4
7060                 ;;
7061         esac
7062         ;;
7063 esac
7064 case "$use64bitint$use64bitall" in
7065 *"$define"*)
7066         case "$archname64" in
7067         '')
7068                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7069                 ;;
7070         *)
7071                 case "$use64bitint" in
7072                 "$define") echo "64 bit integers selected." >&4 ;;
7073                 esac
7074                 case "$use64bitall" in
7075                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7076                 esac
7077                 case "$archname" in
7078                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7079                         ;;
7080                 *)      archname="$archname-$archname64"
7081                         echo "...setting architecture name to $archname." >&4
7082                         ;;
7083                 esac
7084                 ;;
7085         esac
7086 esac
7087 case "$uselongdouble" in
7088 $define)
7089         echo "Long doubles selected." >&4
7090         case "$longdblsize" in
7091         $doublesize)
7092                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7093                 ;;
7094         *)
7095                 case "$archname" in
7096                 *-ld*) echo "...and architecture name already has -ld." >&4
7097                         ;;
7098                 *)      archname="$archname-ld"
7099                         echo "...setting architecture name to $archname." >&4
7100                         ;;
7101                 esac
7102                 ;;
7103         esac
7104         ;;
7105 esac
7106 case "$usequadmath" in
7107 $define)
7108         echo "quadmath selected." >&4
7109         case "$archname" in
7110         *-ld*) echo "...and architecture name already has -quadmath." >&4
7111                 ;;
7112         *)      archname="$archname-quadmath"
7113                 echo "...setting architecture name to $archname." >&4
7114                 ;;
7115         esac
7116         ;;
7117 esac
7118 if $test -f archname.cbu; then
7119         echo "Your platform has some specific hints for architecture name, using them..."
7120         . ./archname.cbu
7121 fi
7122
7123 : set the prefixit variable, to compute a suitable default value
7124 prefixit='case "$3" in
7125 ""|none)
7126         case "$oldprefix" in
7127         "") eval "$1=\"\$$2\"";;
7128         *)
7129                 case "$3" in
7130                 "") eval "$1=";;
7131                 none)
7132                         eval "tp=\"\$$2\"";
7133                         case "$tp" in
7134                         ""|" ") eval "$1=\"\$$2\"";;
7135                         *) eval "$1=";;
7136                         esac;;
7137                 esac;;
7138         esac;;
7139 *)
7140         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7141         case "$tp" in
7142         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7143         /*-$oldprefix/*|\~*-$oldprefix/*)
7144                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7145         *) eval "$1=\"\$$2\"";;
7146         esac;;
7147 esac'
7148
7149 : determine installation style
7150 : For now, try to deduce it from prefix unless it is already set.
7151 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7152 case "$installstyle" in
7153 '')     case "$prefix" in
7154                 *perl*) dflt='lib';;
7155                 *) dflt='lib/perl5' ;;
7156         esac
7157         ;;
7158 *)      dflt="$installstyle" ;;
7159 esac
7160 : Probably not worth prompting for this since we prompt for all
7161 : the directories individually, and the prompt would be too long and
7162 : confusing anyway.
7163 installstyle=$dflt
7164
7165 : determine where public executables go
7166 echo " "
7167 set dflt bin bin
7168 eval $prefixit
7169 fn=d~
7170 rp='Pathname where the public executables will reside?'
7171 . ./getfile
7172 if $test "X$ansexp" != "X$binexp"; then
7173         installbin=''
7174 fi
7175 prefixvar=bin
7176 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7177 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7178 :     this via initialinstalllocation
7179 . ./setprefixvar
7180
7181 case "$userelocatableinc" in
7182 $define|true|[yY]*)     dflt='y' ;;
7183 *)                      dflt='n' ;;
7184 esac
7185 cat <<EOM
7186
7187 Would you like to build Perl so that the installation is relocatable, so that
7188 library paths in @INC are determined relative to the path of the perl binary?
7189 This is not advised for system Perl installs, or if you need to run setid
7190 scripts or scripts under taint mode.
7191
7192 If this doesn't make any sense to you, just accept the default '$dflt'.
7193 EOM
7194 rp='Use relocatable @INC?'
7195 . ./myread
7196 case "$ans" in
7197 y|Y)    val="$define" ;;
7198 *)      val="$undef"  ;;
7199 esac
7200 set userelocatableinc
7201 eval $setvar
7202
7203 initialinstalllocation="$binexp"
7204 : Default prefix is now "up one level from where the binaries are"
7205 case "$userelocatableinc" in
7206 $define|true|[yY]*)
7207     bin=".../"
7208     binexp=".../"
7209     prefix=".../.."
7210     prefixexp=".../.."
7211     installprefixexp=".../.."
7212     ;;
7213 esac
7214
7215 : determine where private library files go
7216 : Usual default is /usr/local/lib/perl5/$version.
7217 : Also allow things like /opt/perl/lib/$version, since
7218 : /opt/perl/lib/perl5... would be redundant.
7219 : The default "style" setting is made in installstyle.U
7220 case "$installstyle" in
7221 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7222 *)       set dflt privlib lib/$version ;;
7223 esac
7224 eval $prefixit
7225 $cat <<EOM
7226
7227 There are some auxiliary files for $package that need to be put into a
7228 private library directory that is accessible by everyone.
7229
7230 EOM
7231 fn=$binexp
7232 fn=d~+
7233 rp='Pathname where the private library files will reside?'
7234 . ./getfile
7235 prefixvar=privlib
7236 . ./setprefixvar
7237
7238 : set the prefixup variable, to restore leading tilda escape
7239 prefixup='case "$prefixexp" in
7240 "$prefix") ;;
7241 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7242 esac'
7243
7244 : determine where public architecture dependent libraries go
7245 set archlib archlib
7246 eval $prefixit
7247 : privlib default is /usr/local/lib/$package/$version
7248 : archlib default is /usr/local/lib/$package/$version/$archname
7249 : privlib may have an optional trailing /share.
7250 tdflt=`echo $privlib | $sed 's,/share$,,'`
7251 tdflt=$tdflt/$archname
7252 case "$archlib" in
7253 '')     dflt=$tdflt
7254         ;;
7255 *)      dflt="$archlib"
7256     ;;
7257 esac
7258 $cat <<EOM
7259
7260 $spackage contains architecture-dependent library files.  If you are
7261 sharing libraries in a heterogeneous environment, you might store
7262 these files in a separate location.  Otherwise, you can just include
7263 them with the rest of the public library files.
7264
7265 EOM
7266 fn=$binexp
7267 fn=d+~
7268 rp='Where do you want to put the public architecture-dependent libraries?'
7269 . ./getfile
7270 prefixvar=archlib
7271 . ./setprefixvar
7272 if $test X"$archlib" = X"$privlib"; then
7273         d_archlib="$undef"
7274 else
7275         d_archlib="$define"
7276 fi
7277
7278 : see if setuid scripts can be secure
7279 $cat <<EOM
7280
7281 Some kernels have a bug that prevents setuid #! scripts from being
7282 secure.  Some sites have disabled setuid #! scripts because of this.
7283
7284 First let's decide if your kernel supports secure setuid #! scripts.
7285 (If setuid #! scripts would be secure but have been disabled anyway,
7286 don't say that they are secure if asked.)
7287
7288 EOM
7289
7290 val="$undef"
7291 if $test -d /dev/fd; then
7292         echo "#!$ls" >reflect
7293         chmod +x,u+s reflect
7294         ./reflect >flect 2>&1
7295         if $contains "/dev/fd" flect >/dev/null; then
7296                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7297                 val="$define"
7298         else
7299                 $cat <<EOM
7300 If you are not sure if they are secure, I can check but I'll need a
7301 username and password different from the one you are using right now.
7302 If you don't have such a username or don't want me to test, simply
7303 enter 'none'.
7304
7305 EOM
7306                 rp='Other username to test security of setuid scripts with?'
7307                 dflt='none'
7308                 . ./myread
7309                 case "$ans" in
7310                 n|none)
7311                         case "$d_suidsafe" in
7312                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7313                                 dflt=n;;
7314                         "$undef")
7315                                 echo "Well, the $hint value is *not* secure." >&4
7316                                 dflt=n;;
7317                         *)      echo "Well, the $hint value *is* secure." >&4
7318                                 dflt=y;;
7319                         esac
7320                         ;;
7321                 *)
7322                         $rm -f reflect flect
7323                         echo "#!$ls" >reflect
7324                         chmod +x,u+s reflect
7325                         echo >flect
7326                         chmod a+w flect
7327                         echo '"su" will (probably) prompt you for '"$ans's password."
7328                         su $ans -c './reflect >flect'
7329                         if $contains "/dev/fd" flect >/dev/null; then
7330                                 echo "Okay, it looks like setuid scripts are secure." >&4
7331                                 dflt=y
7332                         else
7333                                 echo "I don't think setuid scripts are secure." >&4
7334                                 dflt=n
7335                         fi
7336                         ;;
7337                 esac
7338                 rp='Does your kernel have *secure* setuid scripts?'
7339                 . ./myread
7340                 case "$ans" in
7341                 [yY]*)  val="$define";;
7342                 *)      val="$undef";;
7343                 esac
7344         fi
7345 else
7346         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7347         echo "(That's for file descriptors, not floppy disks.)"
7348         val="$undef"
7349 fi
7350 set d_suidsafe
7351 eval $setvar
7352
7353 $rm -f reflect flect
7354
7355 : now see if they want to do setuid emulation
7356 if $test $patchlevel -lt 11; then
7357 echo " "
7358 val="$undef"
7359 case "$d_suidsafe" in
7360 "$define")
7361         val="$undef"
7362         echo "No need to emulate SUID scripts since they are secure here." >&4
7363         ;;
7364 *)
7365         $cat <<EOM
7366 Some systems have disabled setuid scripts, especially systems where
7367 setuid scripts cannot be secure.  On systems where setuid scripts have
7368 been disabled, the setuid/setgid bits on scripts are currently
7369 useless.  It is possible for $package to detect those bits and emulate
7370 setuid/setgid in a secure fashion.  This emulation will only work if
7371 setuid scripts have been disabled in your kernel.
7372
7373 EOM
7374         case "$d_dosuid" in
7375         "$define") dflt=y ;;
7376         *) dflt=n ;;
7377         esac
7378         rp="Do you want to do setuid/setgid emulation?"
7379         . ./myread
7380         case "$ans" in
7381         [yY]*)  val="$define";;
7382         *)      val="$undef";;
7383         esac
7384         ;;
7385 esac
7386 set d_dosuid
7387 eval $setvar
7388 else
7389     case "$d_dosuid" in
7390         "$define")
7391         cat >&4 <<EOH
7392
7393 SUID emulation has been removed for 5.12
7394 Please re-run Configure without -Dd_dosuid
7395
7396 EOH
7397         exit 1;
7398         ;;
7399     esac
7400     d_dosuid=undef
7401 fi
7402
7403 : Find perl5.005 or later.
7404 echo "Looking for a previously installed perl5.005 or later... "
7405 case "$perl5" in
7406 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7407                 : Check if this perl is recent and can load a simple module
7408                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7409                         perl5=$tdir/perl
7410                         break;
7411                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7412                         perl5=$tdir/perl5
7413                         break;
7414                 fi
7415         done
7416         ;;
7417 *)      perl5="$perl5"
7418         ;;
7419 esac
7420 case "$perl5" in
7421 '')     echo "None found.  That's ok.";;
7422 *)      echo "Using $perl5." ;;
7423 esac
7424
7425 : Set the siteprefix variables
7426 $cat <<EOM
7427
7428 After $package is installed, you may wish to install various
7429 add-on modules and utilities.  Typically, these add-ons will
7430 be installed under $prefix with the rest
7431 of this package.  However, you may wish to install such add-ons
7432 elsewhere under a different prefix.
7433
7434 If you do not wish to put everything under a single prefix, that's
7435 ok.  You will be prompted for the individual locations; this siteprefix
7436 is only used to suggest the defaults.
7437
7438 The default should be fine for most people.
7439
7440 EOM
7441 fn=d~+
7442 rp='Installation prefix to use for add-on modules and utilities?'
7443 : XXX Here might be another good place for an installstyle setting.
7444 case "$siteprefix" in
7445 '') dflt=$prefix ;;
7446 *)  dflt=$siteprefix ;;
7447 esac
7448 . ./getfile
7449 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7450 oldsiteprefix=''
7451 case "$siteprefix" in
7452 '') ;;
7453 *)      case "$ans" in
7454         "$prefix") ;;
7455         *) oldsiteprefix="$prefix";;
7456         esac
7457         ;;
7458 esac
7459 siteprefix="$ans"
7460 siteprefixexp="$ansexp"
7461
7462 : determine where site specific libraries go.
7463 : Usual default is /usr/local/lib/perl5/site_perl/$version
7464 : The default "style" setting is made in installstyle.U
7465 : XXX No longer works with Prefixit stuff.
7466 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7467 case "$sitelib" in
7468 '') case "$installstyle" in
7469         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7470         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7471         esac
7472         ;;
7473 *)      dflt="$sitelib"
7474         ;;
7475 esac
7476 $cat <<EOM
7477
7478 The installation process will create a directory for
7479 site-specific extensions and modules.  Most users find it convenient
7480 to place all site-specific files in this directory rather than in the
7481 main distribution directory.
7482
7483 EOM
7484 fn=d~+
7485 rp='Pathname for the site-specific library files?'
7486 . ./getfile
7487 prefixvar=sitelib
7488 . ./setprefixvar
7489 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7490
7491 : Determine list of previous versions to include in @INC
7492 $cat > getverlist <<EOPL
7493 #!$perl5 -w
7494 use File::Basename;
7495 \$api_versionstring = "$api_versionstring";
7496 \$version = "$version";
7497 \$stem = "$sitelib_stem";
7498 \$archname = "$archname";
7499 EOPL
7500         $cat >> getverlist <<'EOPL'
7501 # The list found is store twice for each entry: the original name, and
7502 # the binary broken down version as pack "sss", so sorting is easy and
7503 # unambiguous. This will work for all versions that have a maximum of
7504 # three digit groups, separate by '.'s or '_'s. Names are extended with
7505 # ".0.0" to ensure at least three elements for the pack.
7506 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7507
7508 # Can't have leading @ because metaconfig interprets it as a command!
7509 ;@inc_version_list=();
7510 # XXX Redo to do opendir/readdir?
7511 if (-d $stem) {
7512     chdir($stem);
7513     ;@candidates = map {
7514         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7515     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7516 }
7517 else {
7518     ;@candidates = ();
7519 }
7520
7521 ($pversion, $aversion, $vsn5005) = map {
7522     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7523 foreach $d (@candidates) {
7524     if ($d->[1] lt $pversion) {
7525         if ($d->[1] ge $aversion) {
7526             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7527         }
7528         elsif ($d->[1] ge $vsn5005) {
7529             unshift(@inc_version_list, grep { -d } $d->[0]);
7530         }
7531     }
7532     else {
7533         # Skip newer version.  I.e. don't look in
7534         # 5.7.0 if we're installing 5.6.1.
7535     }
7536 }
7537
7538 if (@inc_version_list) {
7539     print join(' ', @inc_version_list);
7540 }
7541 else {
7542     # Blank space to preserve value for next Configure run.
7543     print " ";
7544 }
7545 EOPL
7546 chmod +x getverlist
7547 case "$inc_version_list" in
7548 '')     if test -x "$perl5$exe_ext"; then
7549                 dflt=`$perl5 getverlist`
7550         else
7551                 dflt='none'
7552         fi
7553         ;;
7554 $undef) dflt='none' ;;
7555 *)  eval dflt=\"$inc_version_list\" ;;
7556 esac
7557 case "$dflt" in
7558 ''|' ') dflt=none ;;
7559 esac
7560 case "$dflt" in
7561 5.005) dflt=none ;;
7562 esac
7563 $cat <<EOM
7564
7565 In order to ease the process of upgrading, this version of perl
7566 can be configured to use modules built and installed with earlier
7567 versions of perl that were installed under $prefix.  Specify here
7568 the list of earlier versions that this version of perl should check.
7569 If Configure detected no earlier versions of perl installed under
7570 $prefix, then the list will be empty.  Answer 'none' to tell perl
7571 to not search earlier versions.
7572
7573 The default should almost always be sensible, so if you're not sure,
7574 just accept the default.
7575 EOM
7576
7577 rp='List of earlier versions to include in @INC?'
7578 . ./myread
7579 case "$ans" in
7580 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7581 *) inc_version_list="$ans" ;;
7582 esac
7583 case "$inc_version_list" in
7584 ''|' ')
7585         inc_version_list_init='0'
7586         d_inc_version_list="$undef"
7587         ;;
7588 *)      inc_version_list_init=`echo $inc_version_list |
7589                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7590         d_inc_version_list="$define"
7591         ;;
7592 esac
7593 $rm -f getverlist
7594
7595 : see if malloc/malloc.h has to be included
7596 set malloc/malloc.h i_mallocmalloc
7597 eval $inhdr
7598
7599 : see if this is a malloc.h system
7600 : we want a real compile instead of Inhdr because some systems have a
7601 : malloc.h that just gives a compile error saying to use stdlib.h instead
7602 echo " "
7603 $cat >try.c <<EOCP
7604 #include <stdlib.h>
7605 #include <malloc.h>
7606 #$i_mallocmalloc I_MALLOCMALLOC
7607 #ifdef I_MALLOCMALLOC
7608 # include <malloc/malloc.h>
7609 #endif
7610
7611 int main () { return 0; }
7612 EOCP
7613 set try
7614 if eval $compile; then
7615     echo "<malloc.h> found." >&4
7616     val="$define"
7617 else
7618     echo "<malloc.h> NOT found." >&4
7619     val="$undef"
7620 fi
7621 $rm_try
7622 set i_malloc
7623 eval $setvar
7624
7625 : check for length of pointer
7626 echo " "
7627 case "$ptrsize" in
7628 '')
7629         echo "Checking to see how big your pointers are..." >&4
7630         $cat >>try.c <<EOCP
7631 #include <stdio.h>
7632 #$i_stdlib I_STDLIB
7633 #ifdef I_STDLIB
7634 #include <stdlib.h>
7635 #endif
7636 int main()
7637 {
7638     printf("%d\n", (int)sizeof(void *));
7639     exit(0);
7640 }
7641 EOCP
7642         set try
7643         if eval $compile_ok; then
7644                 ptrsize=`$run ./try`
7645                 echo "Your pointers are $ptrsize bytes long."
7646         else
7647                 dflt='4'
7648                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7649                 rp="What is the size of a pointer (in bytes)?"
7650                 . ./myread
7651                 ptrsize="$ans"
7652         fi
7653         ;;
7654 esac
7655 $rm_try
7656 case "$use64bitall" in
7657 "$define"|true|[yY]*)
7658         case "$ptrsize" in
7659         4)      cat <<EOM >&4
7660
7661 *** You have chosen a maximally 64-bit build,
7662 *** but your pointers are only 4 bytes wide.
7663 *** Please rerun Configure without -Duse64bitall.
7664 EOM
7665                 case "$d_quad" in
7666                 define)
7667                         cat <<EOM >&4
7668 *** Since you have quads, you could possibly try with -Duse64bitint.
7669 EOM
7670                         ;;
7671                 esac
7672                 cat <<EOM >&4
7673 *** Cannot continue, aborting.
7674
7675 EOM
7676
7677                 exit 1
7678                 ;;
7679         esac
7680         ;;
7681 esac
7682
7683
7684 : determine whether to use malloc wrapping
7685 echo " "
7686 case "$usemallocwrap" in
7687 [yY]*|true|$define)     dflt='y' ;;
7688 [nN]*|false|$undef)     dflt='n' ;;
7689 *)      case "$usedevel" in
7690         [yY]*|true|$define)     dflt='y' ;;
7691         *) dflt='n' ;;
7692         esac
7693         ;;
7694 esac
7695 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7696 . ./myread
7697 usemallocwrap="$ans"
7698 case "$ans" in
7699 y*|true)
7700         usemallocwrap="$define" ;;
7701 *)
7702         usemallocwrap="$undef" ;;
7703 esac
7704
7705 : determine which malloc to compile in
7706 echo " "
7707 case "$usemymalloc" in
7708 [yY]*|true|$define)     dflt='y' ;;
7709 [nN]*|false|$undef)     dflt='n' ;;
7710 *)      case "$ptrsize" in
7711         4) dflt='y' ;;
7712         *) dflt='n' ;;
7713         esac
7714         if test "$useithreads" = "$define"; then dflt='n'; fi
7715         ;;
7716 esac
7717 rp="Do you wish to attempt to use the malloc that comes with $package?"
7718 . ./myread
7719 usemymalloc="$ans"
7720 case "$ans" in
7721 y*|true)
7722         usemymalloc='y'
7723         mallocsrc='malloc.c'
7724         mallocobj="malloc$_o"
7725         d_mymalloc="$define"
7726         case "$libs" in
7727         *-lmalloc*)
7728                 : Remove malloc from list of libraries to use
7729                 echo "Removing unneeded -lmalloc from library list" >&4
7730                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7731                 shift
7732                 libs="$*"
7733                 echo "libs = $libs" >&4
7734                 ;;
7735         esac
7736         ;;
7737 *)
7738         usemymalloc='n'
7739         mallocsrc=''
7740         mallocobj=''
7741         d_mymalloc="$undef"
7742         ;;
7743 esac
7744
7745 : compute the return types of malloc and free
7746 echo " "
7747 $cat >malloc.c <<END
7748 #$i_malloc I_MALLOC
7749 #$i_stdlib I_STDLIB
7750 #include <stdio.h>
7751 #include <sys/types.h>
7752 #ifdef I_MALLOC
7753 #include <malloc.h>
7754 #endif
7755 #ifdef I_STDLIB
7756 #include <stdlib.h>
7757 #endif
7758 #ifdef TRY_MALLOC
7759 void *malloc();
7760 #endif
7761 #ifdef TRY_FREE
7762 void free();
7763 #endif
7764 END
7765 case "$malloctype" in
7766 '')
7767         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7768                 malloctype='void *'
7769         else
7770                 malloctype='char *'
7771         fi
7772         ;;
7773 esac
7774 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7775
7776 case "$freetype" in
7777 '')
7778         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7779                 freetype='void'
7780         else
7781                 freetype='int'
7782         fi
7783         ;;
7784 esac
7785 echo "Your system uses $freetype free(), it would seem." >&4
7786 $rm -f malloc.[co]
7787 : determine where site specific architecture-dependent libraries go.
7788 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7789 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7790 : sitelib may have an optional trailing /share.
7791 case "$sitearch" in
7792 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7793         dflt="$dflt/$archname"
7794         ;;
7795 *)      dflt="$sitearch"
7796         ;;
7797 esac
7798 set sitearch sitearch none
7799 eval $prefixit
7800 $cat <<EOM
7801
7802 The installation process will also create a directory for
7803 architecture-dependent site-specific extensions and modules.
7804
7805 EOM
7806 fn=d~+
7807 rp='Pathname for the site-specific architecture-dependent library files?'
7808 . ./getfile
7809 prefixvar=sitearch
7810 . ./setprefixvar
7811 if $test X"$sitearch" = X"$sitelib"; then
7812         d_sitearch="$undef"
7813 else
7814         d_sitearch="$define"
7815 fi
7816
7817 : Set the vendorprefix variables
7818 $cat <<EOM
7819
7820 The installation process will also create a directory for
7821 vendor-supplied add-ons.  Vendors who supply perl with their system
7822 may find it convenient to place all vendor-supplied files in this
7823 directory rather than in the main distribution directory.  This will
7824 ease upgrades between binary-compatible maintenance versions of perl.
7825
7826 Of course you may also use these directories in whatever way you see
7827 fit.  For example, you might use them to access modules shared over a
7828 company-wide network.
7829
7830 The default answer should be fine for most people.
7831 This causes further questions about vendor add-ons to be skipped
7832 and no vendor-specific directories will be configured for perl.
7833
7834 EOM
7835 rp='Do you want to configure vendor-specific add-on directories?'
7836 case "$usevendorprefix" in
7837 define|true|[yY]*) dflt=y ;;
7838 *)      : User may have set vendorprefix directly on Configure command line.
7839         case "$vendorprefix" in
7840         ''|' ') dflt=n ;;
7841         *)      dflt=y ;;
7842         esac
7843         ;;
7844 esac
7845 . ./myread
7846 case "$ans" in
7847 [yY]*)  fn=d~+
7848         rp='Installation prefix to use for vendor-supplied add-ons?'
7849         case "$vendorprefix" in
7850         '') dflt="$prefix" ;;
7851         *)  dflt=$vendorprefix ;;
7852         esac
7853         . ./getfile
7854         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7855         oldvendorprefix=''
7856         case "$vendorprefix" in
7857         '') ;;
7858         *)      case "$ans" in
7859                 "$prefix") ;;
7860                 *) oldvendorprefix="$prefix";;
7861                 esac
7862                 ;;
7863         esac
7864         usevendorprefix="$define"
7865         vendorprefix="$ans"
7866         vendorprefixexp="$ansexp"
7867         ;;
7868 *)      usevendorprefix="$undef"
7869         vendorprefix=''
7870         vendorprefixexp=''
7871         ;;
7872 esac
7873
7874 : Set the vendorlib variables
7875 case "$vendorprefix" in
7876 '')     d_vendorlib="$undef"
7877         vendorlib=''
7878         vendorlibexp=''
7879         ;;
7880 *)      d_vendorlib="$define"
7881         : determine where vendor-supplied modules go.
7882         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7883         case "$vendorlib" in
7884         '')
7885                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7886                 case "$installstyle" in
7887                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7888                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7889                 esac
7890                 ;;
7891         *)      dflt="$vendorlib"
7892                 ;;
7893         esac
7894         fn=d~+
7895         rp='Pathname for the vendor-supplied library files?'
7896         . ./getfile
7897         vendorlib="$ans"
7898         vendorlibexp="$ansexp"
7899         ;;
7900 esac
7901 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7902 prefixvar=vendorlib
7903 . ./installprefix
7904
7905 : Set the vendorarch variables
7906 case "$vendorprefix" in
7907 '')     d_vendorarch="$undef"
7908         vendorarch=''
7909         vendorarchexp=''
7910         ;;
7911 *)      d_vendorarch="$define"
7912         : determine where vendor-supplied architecture-dependent libraries go.
7913         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7914         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7915         : vendorlib may have an optional trailing /share.
7916         case "$vendorarch" in
7917         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7918                 dflt="$dflt/$archname"
7919                 ;;
7920         *)      dflt="$vendorarch" ;;
7921         esac
7922         fn=d~+
7923         rp='Pathname for vendor-supplied architecture-dependent files?'
7924         . ./getfile
7925         vendorarch="$ans"
7926         vendorarchexp="$ansexp"
7927         ;;
7928 esac
7929 prefixvar=vendorarch
7930 . ./installprefix
7931 if $test X"$vendorarch" = X"$vendorlib"; then
7932         d_vendorarch="$undef"
7933 else
7934         d_vendorarch="$define"
7935 fi
7936
7937 : Final catch-all directories to search
7938 $cat <<EOM
7939
7940 Lastly, you can have perl look in other directories for extensions and
7941 modules in addition to those already specified.
7942 These directories will be searched after
7943         $sitearch
7944         $sitelib
7945 EOM
7946 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7947 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7948 echo ' '
7949 case "$otherlibdirs" in
7950 ''|' ') dflt='none' ;;
7951 *)      dflt="$otherlibdirs" ;;
7952 esac
7953 $cat <<EOM
7954 Enter a colon-separated set of extra paths to include in perl's @INC
7955 search path, or enter 'none' for no extra paths.
7956
7957 EOM
7958
7959 rp='Colon-separated list of additional directories for perl to search?'
7960 . ./myread
7961 case "$ans" in
7962 ' '|''|none)    otherlibdirs=' ' ;;
7963 *)      otherlibdirs="$ans" ;;
7964 esac
7965 case "$otherlibdirs" in
7966 ' ') val=$undef ;;
7967 *)      val=$define ;;
7968 esac
7969 set d_perl_otherlibdirs
7970 eval $setvar
7971
7972 : Cruising for prototypes
7973 echo " "
7974 echo "Checking out function prototypes..." >&4
7975 $cat >prototype.c <<EOCP
7976 #$i_stdlib I_STDLIB
7977 #ifdef I_STDLIB
7978 #include <stdlib.h>
7979 #endif
7980 int main(int argc, char *argv[]) {
7981         exit(0);}
7982 EOCP
7983 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7984         echo "Your C compiler appears to support function prototypes."
7985         val="$define"
7986 else
7987         echo "Your C compiler doesn't seem to understand function prototypes."
7988         val="$undef"
7989 fi
7990 set prototype
7991 eval $setvar
7992 $rm -f prototype*
7993
7994 : Check if ansi2knr is required
7995 case "$prototype" in
7996 "$define") ;;
7997 *)      ansi2knr='ansi2knr'
7998         echo " "
7999         cat <<EOM >&4
8000
8001 $me:  FATAL ERROR:
8002 This version of $package can only be compiled by a compiler that
8003 understands function prototypes.  Unfortunately, your C compiler
8004         $cc $ccflags
8005 doesn't seem to understand them.  Sorry about that.
8006
8007 If GNU cc is available for your system, perhaps you could try that instead.
8008
8009 Eventually, we hope to support building Perl with pre-ANSI compilers.
8010 If you would like to help in that effort, please contact <perlbug@perl.org>.
8011
8012 Aborting Configure now.
8013 EOM
8014         exit 2
8015         ;;
8016 esac
8017
8018 : DTrace support
8019 dflt_dtrace='/usr/sbin/dtrace'
8020 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8021
8022 cat <<EOM
8023
8024 Perl can be built to support DTrace on platforms that support it.
8025 DTrace is a diagnosis and performance analysis tool from Sun.
8026
8027 If this doesn't make any sense to you, just accept the default '$dflt'.
8028 EOM
8029
8030 while $test 1 ; do
8031         case "$usedtrace" in
8032         $define|true|[yY]*)
8033                 dflt='y'
8034                 ;;
8035         ?*)
8036                 dflt='y'
8037                 dflt_dtrace=$usedtrace
8038                 ;;
8039         *)
8040                 dflt='n'
8041                 ;;
8042         esac
8043
8044         rp='Support DTrace if available?'
8045         . ./myread
8046         case "$ans" in
8047         y|Y)    val="$define" ;;
8048         *)      val="$undef" ;;
8049         esac
8050         set usedtrace
8051         eval $setvar
8052
8053         test "X$usedtrace" != "X$define" && break
8054
8055         echo " "
8056         rp='Where is the dtrace executable?'
8057         dflt=$dflt_dtrace
8058         . ./getfile
8059         val="$ans"
8060         set dtrace
8061         eval $setvar
8062
8063         if $test -f $dtrace
8064         then
8065                 if $dtrace -h -s ../perldtrace.d \
8066                         -o perldtrace.tmp >/dev/null 2>&1 \
8067                         && rm -f perldtrace.tmp
8068                 then
8069                         echo " "
8070                         echo "Good: your $dtrace knows about the -h flag."
8071                 else
8072                         cat >&2 <<EOM
8073
8074 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8075 ***
8076 *** Your installed dtrace doesn't support the -h switch to compile a D
8077 *** program into a C header. Can't continue.
8078
8079 EOM
8080                         exit 1
8081                 fi
8082                 break;
8083         fi
8084
8085         case "$fastread" in
8086         yes)
8087                 cat >&2 <<EOM
8088
8089 *** $me:  Fatal Error:  $dtrace not found.
8090 *** Can't continue.
8091
8092 EOM
8093                 exit 1
8094                 ;;
8095         *)
8096                 echo "*** $dtrace was not found."
8097                 echo " "
8098                 ;;
8099         esac
8100 done
8101
8102 : See if we want extra modules installed
8103 echo " "
8104 case "$extras" in
8105 '') dflt='n';;
8106 *) dflt='y';;
8107 esac
8108 cat <<EOM
8109 Perl can be built with extra modules or bundles of modules which
8110 will be fetched from the CPAN and installed alongside Perl.
8111
8112 Notice that you will need access to the CPAN; either via the Internet,
8113 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8114 be asked later to configure the CPAN.pm module which will in turn do
8115 the installation of the rest of the extra modules or bundles.)
8116
8117 Notice also that if the modules require any external software such as
8118 libraries and headers (the libz library and the zlib.h header for the
8119 Compress::Zlib module, for example) you MUST have any such software
8120 already installed, this configuration process will NOT install such
8121 things for you.
8122
8123 If this doesn't make any sense to you, just accept the default '$dflt'.
8124 EOM
8125 rp='Install any extra modules (y or n)?'
8126 . ./myread
8127 case "$ans" in
8128 y|Y)
8129         cat <<EOM
8130
8131 Please list any extra modules or bundles to be installed from CPAN,
8132 with spaces between the names.  The names can be in any format the
8133 'install' command of CPAN.pm will understand.  (Answer 'none',
8134 without the quotes, to install no extra modules or bundles.)
8135 EOM
8136         rp='Extras?'
8137         dflt="$extras"
8138         . ./myread
8139         extras="$ans"
8140 esac
8141 case "$extras" in
8142 ''|'none')
8143         val=''
8144         $rm -f ../extras.lst
8145         ;;
8146 *)      echo "(Saving the list of extras for later...)"
8147         echo "$extras" > ../extras.lst
8148         val="'$extras'"
8149         ;;
8150 esac
8151 set extras
8152 eval $setvar
8153 echo " "
8154
8155 : determine where html pages for programs go
8156 set html1dir html1dir none
8157 eval $prefixit
8158 $cat <<EOM
8159
8160 If you wish to install html files for programs in $spackage, indicate
8161 the appropriate directory here.  To skip installing html files,
8162 answer "none".
8163 EOM
8164 case "$html1dir" in
8165 ''|none|$undef|' ') dflt=none ;;
8166 *) dflt=$html1dir ;;
8167 esac
8168 fn=dn+~
8169 rp="Directory for the main $spackage html pages?"
8170 . ./getfile
8171 prefixvar=html1dir
8172 . ./setprefixvar
8173 : Use ' ' for none so value is preserved next time through Configure
8174 $test X"$html1dir" = "X" && html1dir=' '
8175
8176 : determine where html pages for libraries and modules go
8177 set html3dir html3dir none
8178 eval $prefixit
8179 $cat <<EOM
8180
8181 If you wish to install html files for modules associated with $spackage,
8182 indicate the appropriate directory here.  To skip installing html files,
8183 answer "none".
8184 EOM
8185 : There is no obvious default.  If they have specified html1dir, then
8186 : try to key off that, possibly changing .../html1 into .../html3.
8187 case "$html3dir" in
8188 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8189 *) dflt=$html3dir ;;
8190 esac
8191 fn=dn+~
8192 rp="Directory for the $spackage module html pages?"
8193 . ./getfile
8194 prefixvar=html3dir
8195 . ./setprefixvar
8196 : Use ' ' for none so value is preserved next time through Configure
8197 $test X"$html3dir" = "X" && html3dir=' '
8198
8199 : determine whether to install perl also as /usr/bin/perl
8200
8201 echo " "
8202 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8203         $cat <<EOM
8204 Many scripts expect perl to be installed as /usr/bin/perl.
8205
8206 If you want to, I can install the perl you are about to compile
8207 as /usr/bin/perl (in addition to $bin/perl).
8208 EOM
8209         if test -f /usr/bin/perl; then
8210             $cat <<EOM
8211
8212 However, please note that because you already have a /usr/bin/perl,
8213 overwriting that with a new Perl would very probably cause problems.
8214 Therefore I'm assuming you don't want to do that (unless you insist).
8215
8216 EOM
8217             case "$installusrbinperl" in
8218             "$define"|[yY]*)    dflt='y';;
8219             *)                  dflt='n';;
8220             esac
8221         else
8222             $cat <<EOM
8223
8224 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8225
8226 EOM
8227             case "$installusrbinperl" in
8228             "$undef"|[nN]*)     dflt='n';;
8229             *)                  dflt='y';;
8230             esac
8231         fi
8232         rp="Do you want to install perl as /usr/bin/perl?"
8233         . ./myread
8234         case "$ans" in
8235         [yY]*)  val="$define";;
8236         *)      val="$undef" ;;
8237         esac
8238 else
8239         val="$undef"
8240 fi
8241 set installusrbinperl
8242 eval $setvar
8243
8244 : see if dlopen exists
8245 xxx_runnm="$runnm"
8246 xxx_ccflags="$ccflags"
8247 runnm=false
8248 : with g++ one needs -shared to get is-in-libc to work for dlopen
8249 case "$gccversion" in
8250 '')     ;;
8251 *)      case "$d_cplusplus" in
8252         "$define") ccflags="$ccflags -shared" ;;
8253         esac
8254         ;;
8255 esac
8256 set dlopen d_dlopen
8257 eval $inlibc
8258 runnm="$xxx_runnm"
8259 ccflags="$xxx_ccflags"
8260
8261 : see if this is a unistd.h system
8262 set unistd.h i_unistd
8263 eval $inhdr
8264
8265 : determine which dynamic loading, if any, to compile in
8266 echo " "
8267 dldir="ext/DynaLoader"
8268 case "$usedl" in
8269     $define|y|true)
8270         dflt='y'
8271         usedl="$define"
8272         ;;
8273     $undef|n|false)
8274         dflt='n'
8275         usedl="$undef"
8276         ;;
8277     *)
8278         dflt='n'
8279         case "$d_dlopen" in
8280             $define) dflt='y' ;;
8281         esac
8282         : Does a dl_xxx.xs file exist for this operating system
8283         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8284         ;;
8285 esac
8286 rp="Do you wish to use dynamic loading?"
8287 . ./myread
8288 usedl="$ans"
8289 bin_ELF="$undef"
8290 case "$ans" in
8291     y*) usedl="$define"
8292         case "$dlsrc" in
8293             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8294                     dflt="$dldir/dl_${osname}.xs"
8295                 elif $test "$d_dlopen" = "$define" ; then
8296                     dflt="$dldir/dl_dlopen.xs"
8297                 else
8298                     dflt=''
8299                 fi
8300                 ;;
8301             *)  dflt="$dldir/$dlsrc"
8302                 ;;
8303         esac
8304         echo "The following dynamic loading files are available:"
8305         : Can not go over to $dldir because getfile has path hard-coded in.
8306         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8307         rp="Source file to use for dynamic loading"
8308         fn="fne"
8309         gfpth="$src"
8310         . ./getfile
8311         usedl="$define"
8312         : emulate basename
8313         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8314
8315         $cat << EOM
8316
8317 Some systems may require passing special flags to $cc -c to
8318 compile modules that will be used to create a shared library.
8319 To use no flags, say "none".
8320
8321 EOM
8322         case "$cccdlflags" in
8323             '') case "$gccversion" in
8324                 '') case "$osname" in
8325                         hpux)   dflt='+z' ;;
8326                         irix*)  dflt='-KPIC' ;;
8327                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8328                         sunos)  dflt='-pic' ;;
8329                         *)      dflt='none' ;;
8330                     esac
8331                     ;;
8332                 *)  case "$osname" in
8333                         darwin) dflt='none' ;;
8334                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8335                         *)      dflt='-fpic' ;;
8336                     esac ;;
8337                 esac ;;
8338             ' ') dflt='none' ;;
8339             *)   dflt="$cccdlflags" ;;
8340         esac
8341
8342         case "$dflt" in
8343             none) dflt='' ;;
8344         esac
8345
8346         # If -Dsysroot was specified, now's the time to add it
8347         # to cccdlflags
8348         if test "X$sysroot" != X; then
8349             case "$gccversion" in
8350                 '') ;;
8351                 *)  case "$dflt" in
8352                         *sysroot*) ;;
8353                         'undef'|*)
8354                             dflt="$dflt --sysroot=$sysroot" ;;
8355                     esac
8356                     ;;
8357             esac
8358         fi
8359
8360         case "$dflt" in
8361             '') dflt='none';;
8362         esac
8363
8364         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8365         . ./myread
8366         case "$ans" in
8367             none) cccdlflags=' ' ;;
8368             *)    cccdlflags="$ans" ;;
8369         esac
8370
8371         cat << EOM
8372
8373 Some systems use ld to create libraries that can be dynamically loaded,
8374 while other systems (such as those using ELF) use $cc.
8375
8376 EOM
8377
8378 : Determine if this is ELF
8379         $cat >try.c <<EOM
8380 /* Test for whether ELF binaries are produced */
8381 #include <fcntl.h>
8382 #$i_stdlib I_STDLIB
8383 #ifdef I_STDLIB
8384 #include <stdlib.h>
8385 #endif
8386 #$i_unistd I_UNISTD
8387 #ifdef I_UNISTD
8388 #include <unistd.h>
8389 #endif
8390 int main() {
8391     char b[4];
8392     int i = open("a.out",O_RDONLY);
8393     if(i == -1)
8394         exit(1); /* fail */
8395     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8396         exit(0); /* succeed (yes, it is ELF) */
8397     exit(1); /* fail */
8398 }
8399 EOM
8400         if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8401             bin_ELF="$define"
8402         fi
8403         $rm_try
8404
8405         case "$ld" in
8406             '') if $test $bin_ELF = "$define"; then
8407                     cat <<EOM
8408 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8409 EOM
8410                     dflt="$cc"
8411                 else
8412                     echo "I'll use ld to build dynamic libraries."
8413                     dflt='ld'
8414                 fi
8415                 ;;
8416             *)  dflt="$ld"
8417                 ;;
8418         esac
8419
8420         rp="What command should be used to create dynamic libraries?"
8421         . ./myread
8422         ld="$ans"
8423
8424         cat << EOM
8425
8426 Some systems may require passing special flags to $ld to create a
8427 library that can be dynamically loaded.  If your ld flags include
8428 -L/other/path options to locate libraries outside your loader's normal
8429 search path, you may need to specify those -L options here as well.  To
8430 use no flags, say "none".
8431
8432 EOM
8433         case "$lddlflags" in
8434             '') case "$osname" in
8435                     haiku) dflt='-shared' ;;
8436                     hpux) dflt='-b';
8437                           case "$gccversion" in
8438                               '') dflt="$dflt +vnocompatwarnings" ;;
8439                           esac
8440                           ;;
8441                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8442                     solaris) # See [perl #66604].
8443                             # On Solaris 11, gcc -m64 on amd64
8444                             # appears not to understand -G.  gcc versions at
8445                             # least as old as 3.4.3 support -shared, so just
8446                             # use that with Solaris 11 and later, but keep
8447                             # the old behavior for older Solaris versions.
8448                             case "$gccversion" in
8449                                 '') dflt='-G' ;;
8450                                 *)  case "$osvers" in
8451                                         2.?|2.10) dflt='-G' ;;
8452                                         *) dflt='-shared' ;;
8453                                     esac
8454                                     ;;
8455                             esac
8456                             ;;
8457                     sunos) dflt='-assert nodefinitions' ;;
8458                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8459                     *)     dflt='none' ;;
8460                 esac
8461                 ;;
8462             *) dflt="$lddlflags" ;;
8463         esac
8464
8465         : Only do this for gcc, since, for example, qcc has no concept
8466         : of --sysroot.
8467         if $test "X$sysroot" != X; then
8468             case "$gccversion" in
8469                 '') ;;
8470                 *)  dflt="$dflt --sysroot $sysroot" ;;
8471             esac
8472         fi
8473
8474         : Try to guess additional flags to pick up local libraries.
8475         : Be careful not to append to a plain 'none'
8476         case "$dflt" in
8477             none) dflt='' ;;
8478         esac
8479         for thisflag in $ldflags; do
8480             case "$thisflag" in
8481                 -L*|-R*|-Wl,-R*)
8482                     case " $dflt " in
8483                         *" $thisflag "*) ;;
8484                         *) dflt="$dflt $thisflag" ;;
8485                     esac
8486                     ;;
8487             esac
8488         done
8489
8490         case "$dflt" in
8491             ''|' ') dflt='none' ;;
8492         esac
8493
8494         case "$ldflags" in
8495             *-fstack-protector-strong*)
8496                 case "$dflt" in
8497                     *-fstack-protector-strong*) ;; # Don't add it again
8498                     *) dflt="$dflt -fstack-protector-strong" ;;
8499                 esac
8500                 ;;
8501             *-fstack-protector*)
8502                 case "$dflt" in
8503                     *-fstack-protector*) ;; # Don't add it again
8504                     *) dflt="$dflt -fstack-protector" ;;
8505                 esac
8506                 ;;
8507         esac
8508
8509         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8510         . ./myread
8511         case "$ans" in
8512             none) lddlflags=' ' ;;
8513             *) lddlflags="$ans" ;;
8514         esac
8515
8516         cat <<EOM
8517
8518 Some systems may require passing special flags to $cc to indicate that
8519 the resulting executable will use dynamic linking.  To use no flags,
8520 say "none".
8521
8522 EOM
8523         case "$ccdlflags" in
8524             '') case "$osname" in
8525                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8526                     sunos)             dflt='none'   ;;
8527                     *)                 dflt='none'   ;;
8528                 esac ;;
8529             ' ') dflt='none' ;;
8530             *)   dflt="$ccdlflags" ;;
8531         esac
8532         rp="Any special flags to pass to $cc to use dynamic linking?"
8533         . ./myread
8534         case "$ans" in
8535             none) ccdlflags=' ' ;;
8536             *)    ccdlflags="$ans" ;;
8537         esac
8538         ;;
8539
8540     *)  usedl="$undef"
8541         ld='ld'
8542         dlsrc='dl_none.xs'
8543         lddlflags=''
8544         ccdlflags=''
8545         ;;
8546 esac
8547
8548 ld_can_script="$undef"
8549 case "$bin_ELF$usedl" in
8550     $define$define)
8551         # Abuse try.h and a.out names for neat cleanup
8552         $cat >try.c <<EOM
8553 void foo() {}
8554 void bar() {}
8555 EOM
8556         $cat >try.h <<EOM
8557 LIBTEST_42 {
8558  global:
8559   foo;
8560  local: *;
8561  };
8562 EOM
8563         if $cc $cccdlflags $ccdlflags $ccflags \
8564                $ldflags $lddlflags -o a.out try.c \
8565                -Wl,--version-script=try.h >/dev/null 2>&1 \
8566            &&  $test -s a.out ; then
8567             echo "ld supports scripting" >&4
8568             ld_can_script="$define"
8569         else
8570             echo "ld does not support scripting" >&4
8571         fi
8572         $rm_try
8573         ;;
8574 esac
8575
8576 : Do we want a shared libperl?
8577 also=''
8578 case "$usedl" in
8579 $undef)
8580         # No dynamic loading being used, so don't bother even to prompt.
8581         useshrplib='false'
8582         ;;
8583 *)      case "$useshrplib" in
8584         '')     case "$osname" in
8585                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8586                         dflt=y
8587                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8588                         ;;
8589                 *)      dflt=n
8590                         ;;
8591                 esac
8592                 ;;
8593         $define|true|[Yy]*)
8594                 dflt=y
8595                 ;;
8596         *)      dflt=n
8597                 ;;
8598         esac
8599         $cat << EOM
8600
8601 The perl executable is normally obtained by linking perlmain.c with
8602 libperl${_a}, any static extensions (usually just DynaLoader), and
8603 any other libraries needed on this system (such as -lm, etc.).  Since
8604 your system supports dynamic loading, it is probably possible to build
8605 a shared libperl.$so.  If you will have more than one executable linked
8606 to libperl.$so, this will significantly reduce the size of each
8607 executable, but it may have a noticeable effect on performance.  The
8608 default is probably sensible for your system.
8609 $also
8610
8611 EOM
8612         rp="Build a shared libperl.$so (y/n)"
8613         . ./myread
8614         case "$ans" in
8615         true|$define|[Yy]*)
8616                 useshrplib='true'  ;;
8617         *)      useshrplib='false' ;;
8618         esac
8619         ;;
8620 esac
8621
8622 case "$useshrplib" in
8623 true)
8624         case "$userelocatableinc" in
8625         true|define)
8626                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8627                 echo "See INSTALL for an explanation why that won't work." >&4
8628                 exit 4
8629                 ;;
8630         esac
8631         case "$libperl" in
8632         '')
8633                 # Figure out a good name for libperl.so.  Since it gets stored in
8634                 # a version-specific architecture-dependent library, the version
8635                 # number isn't really that important, except for making cc/ld happy.
8636                 #
8637                 # A name such as libperl.so.10.1
8638                 majmin="libperl.$so.$patchlevel.$subversion"
8639                 # A name such as libperl.so.100
8640                 majonly=`echo $patchlevel $subversion |
8641                         $awk '{printf "%d%02d", $1, $2}'`
8642                 majonly=libperl.$so.$majonly
8643                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8644                 # rely on figuring it out from the naming of libc.
8645                 case "${osname}${osvers}" in
8646                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8647                         dflt=libperl.$so
8648                         ;;
8649                 cygwin*) # ld links now against the dll directly
8650                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8651                         majonly=`echo $patchlevel $subversion |
8652                                 $awk '{printf "%03d%03d", $1, $2}'`
8653                         majonly=cygperl5.$majonly.$so
8654                         dflt=$majmin
8655                         ;;
8656                 *)      # Try to guess based on whether libc has major.minor.
8657                         case "$libc" in
8658                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8659                         *libc.$so.[0-9]*) dflt=$majonly ;;
8660                         *)      dflt=libperl.$so ;;
8661                         esac
8662                         ;;
8663                 esac
8664                 ;;
8665         *)      dflt=$libperl
8666                 ;;
8667         esac
8668         cat << EOM
8669
8670 I need to select a good name for the shared libperl.  If your system uses
8671 library names with major and minor numbers, then you might want something
8672 like $majmin.  Alternatively, if your system uses a single version
8673 number for shared libraries, then you might want to use $majonly.
8674 Or, your system might be quite happy with a simple libperl.$so.
8675
8676 Since the shared libperl will get installed into a version-specific
8677 architecture-dependent directory, the version number of the shared perl
8678 library probably isn't important, so the default should be o.k.
8679
8680 EOM
8681         rp='What name do you want to give to the shared libperl?'
8682         . ./myread
8683         libperl=$ans
8684         echo "Ok, I'll use $libperl"
8685         ;;
8686 *)
8687         libperl="libperl${_a}"
8688         ;;
8689 esac
8690
8691 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8692 case "$shrpdir" in
8693 '') ;;
8694 *)      $cat >&4 <<EOM
8695 WARNING:  Use of the shrpdir variable for the installation location of
8696 the shared $libperl is not supported.  It was never documented and
8697 will not work in this version.  Let me (perlbug@perl.org)
8698 know of any problems this may cause.
8699
8700 EOM
8701         case "$shrpdir" in
8702         "$archlibexp/CORE")
8703                 $cat >&4 <<EOM
8704 But your current setting of $shrpdir is
8705 the default anyway, so it's harmless.
8706 EOM
8707                 ;;
8708         *)
8709                 $cat >&4 <<EOM
8710 Further, your current attempted setting of $shrpdir
8711 conflicts with the value of $archlibexp/CORE
8712 that installperl will use.
8713 EOM
8714                 ;;
8715         esac
8716         ;;
8717 esac
8718
8719 # How will the perl executable find the installed shared $libperl?
8720 # Add $xxx to ccdlflags.
8721 # If we can't figure out a command-line option, use $shrpenv to
8722 # set env LD_RUN_PATH.  The main perl makefile uses this.
8723 shrpdir=$archlibexp/CORE
8724 xxx=''
8725 tmp_shrpenv=''
8726 if "$useshrplib"; then
8727     case "$osname" in
8728         aix)
8729                 # We'll set it in Makefile.SH...
8730                 ;;
8731         solaris)
8732                 xxx="-R $shrpdir"
8733                 ;;
8734         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8735                 xxx="-Wl,-R$shrpdir"
8736                 ;;
8737         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8738                 xxx="-Wl,-rpath,$shrpdir"
8739                 ;;
8740         hpux*)
8741                 # hpux doesn't like the default, either.
8742                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8743                 ;;
8744         cygwin)
8745                 # cygwin needs only ldlibpth
8746                 ;;
8747         *)
8748                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8749                 ;;
8750         esac
8751         case "$xxx" in
8752         '') ;;
8753         *)
8754                 # Only add $xxx if it isn't already in ccdlflags.
8755                 case " $ccdlflags " in
8756                 *" $xxx "*)     ;;
8757                 *)      ccdlflags="$ccdlflags $xxx"
8758                         cat <<EOM >&4
8759
8760 Adding $xxx to the flags
8761 passed to $ld so that the perl executable will find the
8762 installed shared $libperl.
8763
8764 EOM
8765                         ;;
8766                 esac
8767                 ;;
8768         esac
8769 fi
8770 # Fix ccdlflags in AIX for building external extensions.
8771 # (For building Perl itself bare -bE:perl.exp is needed,
8772 #  Makefile.SH takes care of this.)
8773 case "$osname" in
8774 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8775 esac
8776 # Respect a hint or command-line value.
8777 case "$shrpenv" in
8778 '') shrpenv="$tmp_shrpenv" ;;
8779 esac
8780 case "$ldlibpthname" in
8781 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8782 none)   ldlibpthname='' ;;
8783 esac
8784
8785 : determine where manual pages are on this system
8786 echo " "
8787 case "$sysman" in
8788 '')
8789         syspath='/usr/share/man/man1 /usr/man/man1'
8790         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8791         syspath="$syspath /usr/man/u_man/man1"
8792         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8793         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8794         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8795         sysman=`./loc . /usr/man/man1 $syspath`
8796         ;;
8797 esac
8798 if $test -d "$sysman"; then
8799         echo "System manual is in $sysman." >&4
8800 else
8801         echo "Could not find manual pages in source form." >&4
8802 fi
8803
8804 : determine where manual pages go
8805 set man1dir man1dir none
8806 eval $prefixit
8807 $cat <<EOM
8808
8809 $spackage has manual pages available in source form.
8810 EOM
8811 case "$nroff" in
8812 nroff)
8813         echo "However, you don't have nroff, so they're probably useless to you."
8814         case "$man1dir" in
8815         '') man1dir="none";;
8816         esac;;
8817 esac
8818 echo "If you don't want the manual sources installed, answer 'none'."
8819 case "$man1dir" in
8820 ' ') dflt=none
8821         ;;
8822 '')
8823         lookpath="$prefixexp/share/man/man1"
8824         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8825         lookpath="$lookpath $prefixexp/man/p_man/man1"
8826         lookpath="$lookpath $prefixexp/man/u_man/man1"
8827         lookpath="$lookpath $prefixexp/man/man.1"
8828         case "$sysman" in
8829         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8830         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8831         esac
8832         set dflt
8833         eval $prefixup
8834         ;;
8835 *)  dflt="$man1dir"
8836         ;;
8837 esac
8838 echo " "
8839 fn=dn+~
8840 rp="Where do the main $spackage manual pages (source) go?"
8841 . ./getfile
8842 if $test "X$man1direxp" != "X$ansexp"; then
8843         installman1dir=''
8844 fi
8845 prefixvar=man1dir
8846 . ./setprefixvar
8847
8848 case "$man1dir" in
8849 '')     man1dir=' '
8850         installman1dir='';;
8851 esac
8852
8853 : What suffix to use on installed man pages
8854
8855 case "$man1dir" in
8856 ' ')
8857         man1ext='0'
8858         ;;
8859 *)
8860         rp="What suffix should be used for the main $spackage man pages?"
8861         case "$man1ext" in
8862         '')     case "$man1dir" in
8863                 *1)  dflt=1 ;;
8864                 *1p) dflt=1p ;;
8865                 *1pm) dflt=1pm ;;
8866                 *l) dflt=l;;
8867                 *n) dflt=n;;
8868                 *o) dflt=o;;
8869                 *p) dflt=p;;
8870                 *C) dflt=C;;
8871                 *L) dflt=L;;
8872                 *L1) dflt=L1;;
8873                 *) dflt=1;;
8874                 esac
8875                 ;;
8876         *)      dflt="$man1ext";;
8877         esac
8878         . ./myread
8879         man1ext="$ans"
8880         ;;
8881 esac
8882
8883 : see if we can have long filenames
8884 echo " "
8885 first=123456789abcdef
8886 $rm -f $first
8887 if (echo hi >$first) 2>/dev/null; then
8888         if $test -f 123456789abcde; then
8889                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8890                 val="$undef"
8891         else
8892                 echo 'You can have filenames longer than 14 characters.'>&4
8893                 val="$define"
8894         fi
8895 else
8896         $cat <<'EOM'
8897 You can't have filenames longer than 14 chars.
8898 You can't even think about them!
8899 EOM
8900         val="$undef"
8901 fi
8902 set d_flexfnam
8903 eval $setvar
8904 $rm -rf 123456789abcde*
8905
8906 : determine where library module manual pages go
8907 set man3dir man3dir none
8908 eval $prefixit
8909 $cat <<EOM
8910
8911 $spackage has manual pages for many of the library modules.
8912 EOM
8913
8914 case "$nroff" in
8915 nroff)
8916         $cat <<'EOM'
8917 However, you don't have nroff, so they're probably useless to you.
8918 EOM
8919         case "$man3dir" in
8920         '') man3dir="none";;
8921         esac;;
8922 esac
8923
8924 case "$d_flexfnam" in
8925 undef)
8926         $cat <<'EOM'
8927 However, your system can't handle the long file names like File::Basename.3.
8928 EOM
8929         case "$man3dir" in
8930         '') man3dir="none";;
8931         esac;;
8932 esac
8933
8934 echo "If you don't want the manual sources installed, answer 'none'."
8935 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8936 case "$man3dir" in
8937 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8938         if $test -d "$privlib/man/man3"; then
8939                 cat <<EOM >&4
8940
8941 WARNING:  Previous versions of perl installed man3 pages into
8942 $privlib/man/man3.  This version will suggest a
8943 new default of $dflt.
8944 EOM
8945                 tdflt=$dflt
8946                 dflt='n'
8947                 rp='Do you wish to preserve the old behavior?(y/n)'
8948                 . ./myread
8949                 case "$ans" in
8950                 y*) dflt="$privlib/man/man3" ;;
8951                 *)  dflt=$tdflt ;;
8952                 esac
8953     fi
8954         ;;
8955 *)      dflt="$man3dir" ;;
8956 esac
8957 case "$dflt" in
8958 ' ') dflt=none ;;
8959 esac
8960 echo " "
8961 fn=dn+~
8962 rp="Where do the $package library man pages (source) go?"
8963 . ./getfile
8964 prefixvar=man3dir
8965 . ./setprefixvar
8966
8967 case "$man3dir" in
8968 '')     man3dir=' '
8969         installman3dir='';;
8970 esac
8971
8972 : What suffix to use on installed man pages
8973 case "$man3dir" in
8974 ' ')
8975         man3ext='0'
8976         ;;
8977 *)
8978         rp="What suffix should be used for the $package library man pages?"
8979         case "$man3ext" in
8980         '')     case "$man3dir" in
8981                 *3)  dflt=3 ;;
8982                 *3p) dflt=3p ;;
8983                 *3pm) dflt=3pm ;;
8984                 *l) dflt=l;;
8985                 *n) dflt=n;;
8986                 *o) dflt=o;;
8987                 *p) dflt=p;;
8988                 *C) dflt=C;;
8989                 *L) dflt=L;;
8990                 *L3) dflt=L3;;
8991                 *) dflt=3;;
8992                 esac
8993                 ;;
8994         *)      dflt="$man3ext";;
8995         esac
8996         . ./myread
8997         man3ext="$ans"
8998         ;;
8999 esac
9000
9001 : see if we have to deal with yellow pages, now NIS.
9002 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9003         case "$hostcat" in
9004         nidump*) ;;
9005         *)
9006                 case "$hostcat" in
9007                 *ypcat*) dflt=y;;
9008                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9009                                 dflt=y
9010                         else
9011                                 dflt=n
9012                         fi;;
9013                 *) dflt=n;;
9014                 esac
9015                 echo " "
9016                 rp='Are you getting the hosts file via yellow pages?'
9017                 . ./myread
9018                 case "$ans" in
9019                 y*) hostcat='ypcat hosts';;
9020                 *) hostcat='cat /etc/hosts';;
9021                 esac
9022                 ;;
9023         esac
9024 fi
9025 case "$hostcat" in
9026 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9027 esac
9028 case "$groupcat" in
9029 '') test -f /etc/group && groupcat='cat /etc/group';;
9030 esac
9031 case "$passcat" in
9032 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9033 esac
9034
9035 : now get the host name
9036 echo " "
9037 echo "Figuring out host name..." >&4
9038 case "$myhostname" in
9039 '') cont=true
9040         echo 'Maybe "hostname" will work...'
9041         if tans=`sh -c hostname 2>&1` ; then
9042                 myhostname=$tans
9043                 phostname=hostname
9044                 cont=''
9045         fi
9046         ;;
9047 *) cont='';;
9048 esac
9049 if $test "$cont"; then
9050         if ./xenix; then
9051                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9052                 if tans=`cat /etc/systemid 2>&1` ; then
9053                         myhostname=$tans
9054                         phostname='cat /etc/systemid'
9055                         echo "Whadyaknow.  Xenix always was a bit strange..."
9056                         cont=''
9057                 fi
9058         elif $test -r /etc/systemid; then
9059                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9060         fi
9061 fi
9062 if $test "$cont"; then
9063         echo 'No, maybe "uuname -l" will work...'
9064         if tans=`sh -c 'uuname -l' 2>&1` ; then
9065                 myhostname=$tans
9066                 phostname='uuname -l'
9067         else
9068                 echo 'Strange.  Maybe "uname -n" will work...'
9069                 if tans=`sh -c 'uname -n' 2>&1` ; then
9070                         myhostname=$tans
9071                         phostname='uname -n'
9072                 else
9073                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9074                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9075                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9076                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9077                         else
9078                                 case "$myhostname" in
9079                                 '') echo "Does this machine have an identity crisis or something?"
9080                                         phostname='';;
9081                                 *)
9082                                         echo "Well, you said $myhostname before..."
9083                                         phostname='echo $myhostname';;
9084                                 esac
9085                         fi
9086                 fi
9087         fi
9088 fi
9089 case "$myhostname" in
9090 '') myhostname=noname ;;
9091 esac
9092 : you do not want to know about this
9093 set $myhostname
9094 myhostname=$1
9095
9096 : verify guess
9097 if $test "$myhostname" ; then
9098         dflt=y
9099         rp='Your host name appears to be "'$myhostname'".'" Right?"
9100         . ./myread
9101         case "$ans" in
9102         y*) ;;
9103         *) myhostname='';;
9104         esac
9105 fi
9106
9107 : bad guess or no guess
9108 while $test "X$myhostname" = X ; do
9109         dflt=''
9110         rp="Please type the (one word) name of your host:"
9111         . ./myread
9112         myhostname="$ans"
9113 done
9114
9115 : translate upper to lower if necessary
9116 case "$myhostname" in
9117 *[A-Z]*)
9118         echo "(Normalizing case in your host name)"
9119         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9120         ;;
9121 esac
9122
9123 case "$myhostname" in
9124 *.*)
9125         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9126         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9127         echo "(Trimming domain name from host name--host name is now $myhostname)"
9128         ;;
9129 *) case "$mydomain" in
9130         '')
9131                 {
9132                         test "X$hostcat" = "Xypcat hosts" &&
9133                         ypmatch "$myhostname" hosts 2>/dev/null |\
9134                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9135                         $test -s hosts
9136                 } || {
9137                         test "X$hostcat" != "X" &&
9138                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9139                                         /[       ]$myhostname[  . ]/p" > hosts
9140                 }
9141                 tmp_re="[       . ]"
9142                 if $test -f hosts; then
9143                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9144                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9145                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9146                                 hosts | $sort | $uniq | \
9147                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9148                         case `$echo X$dflt` in
9149                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9150                                 dflt=.
9151                                 ;;
9152                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9153                                 ;;
9154                         esac
9155                 else
9156                         echo "(I cannot locate a hosts database anywhere)"
9157                         dflt=.
9158                 fi
9159                 case "$dflt" in
9160                 .)
9161                         tans=`./loc resolv.conf X /etc /usr/etc`
9162                         if $test -f "$tans"; then
9163                                 echo "(Attempting domain name extraction from $tans)"
9164                                 dflt=.`$sed -n -e 's/   / /g' \
9165                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9166                                   -e 1q 2>/dev/null`
9167                                 case "$dflt" in
9168                                 .) dflt=.`$sed -n -e 's/        / /g' \
9169                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9170                                      -e 1q 2>/dev/null`
9171                                         ;;
9172                                 esac
9173                         fi
9174                         ;;
9175                 esac
9176                 case "$dflt" in
9177                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9178                         dflt=.`sh -c domainname 2>/dev/null`
9179                         case "$dflt" in
9180                         '') dflt='.';;
9181                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9182                         esac
9183                         ;;
9184                 esac
9185                 case "$dflt$osname" in
9186                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9187                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9188                         ;;
9189                 esac
9190                 case "$dflt" in
9191                 .) echo "(Lost all hope -- silly guess then)"
9192                         dflt='.nonet'
9193                         ;;
9194                 esac
9195                 $rm -f hosts
9196                 ;;
9197         *) dflt="$mydomain";;
9198         esac;;
9199 esac
9200 echo " "
9201 rp="What is your domain name?"
9202 . ./myread
9203 tans="$ans"
9204 case "$ans" in
9205 '') ;;
9206 .*) ;;
9207 *) tans=".$tans";;
9208 esac
9209 mydomain="$tans"
9210
9211 : translate upper to lower if necessary
9212 case "$mydomain" in
9213 *[A-Z]*)
9214         echo "(Normalizing case in your domain name)"
9215         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9216         ;;
9217 esac
9218
9219 : a little sanity check here
9220 case "$phostname" in
9221 '') ;;
9222 *)
9223         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9224         $myhostname$mydomain|$myhostname) ;;
9225         *)
9226                 case "$phostname" in
9227                 sed*)
9228                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9229                         ;;
9230                 *)
9231                         echo "(That doesn't agree with your $phostname command, by the way.)"
9232                         ;;
9233                 esac
9234         ;;
9235         esac
9236         ;;
9237 esac
9238
9239 : determine the e-mail address of the user who is running us
9240 $cat <<EOM
9241
9242 I need to get your e-mail address in Internet format if possible, i.e.
9243 something like user@host.domain. Please answer accurately since I have
9244 no easy means to double check it. The default value provided below
9245 is most probably close to reality but may not be valid from outside
9246 your organization...
9247
9248 EOM
9249 cont=x
9250 while test "$cont"; do
9251         case "$MAILDOMAIN" in
9252         '')
9253                 if $test -s /etc/mailname; then
9254                         maildomain=`$cat /etc/mailname`
9255                 else
9256                         maildomain="$myhostname$mydomain"
9257                 fi
9258                 ;;
9259         *)  maildomain="$MAILDOMAIN";;
9260         esac
9261         case "$cf_email" in
9262         '') dflt="$cf_by@$maildomain";;
9263         *)  dflt="$cf_email";;
9264         esac
9265         rp='What is your e-mail address?'
9266         . ./myread
9267         cf_email="$ans"
9268         case "$cf_email" in
9269         *@*.*) cont='' ;;
9270         *)
9271                 rp='Address does not look like an Internet one.  Use it anyway?'
9272                 case "$fastread" in
9273                 yes) dflt=y ;;
9274                 *) dflt=n ;;
9275                 esac
9276                 . ./myread
9277                 case "$ans" in
9278                 y*) cont='' ;;
9279                 *) echo " " ;;
9280                 esac
9281                 ;;
9282         esac
9283 done
9284
9285 : Ask e-mail of administrator
9286 $cat <<EOM
9287
9288 If you or somebody else will be maintaining perl at your site, please
9289 fill in the correct e-mail address here so that they may be contacted
9290 if necessary. Currently, the "perlbug" program included with perl
9291 will send mail to this address in addition to perlbug@perl.org. You may
9292 enter "none" for no administrator.
9293
9294 EOM
9295 case "$perladmin" in
9296 '') dflt="$cf_email";;
9297 *) dflt="$perladmin";;
9298 esac
9299 rp='Perl administrator e-mail address'
9300 . ./myread
9301 perladmin="$ans"
9302
9303 : determine whether to only install version-specific parts.
9304 echo " "
9305 $cat <<EOM
9306 Do you want to install only the version-specific parts of the perl
9307 distribution?  Usually you do *not* want to do this.
9308 EOM
9309 case "$versiononly" in
9310 "$define"|[Yy]*|true) dflt='y' ;;
9311 *) dflt='n';
9312 esac
9313 rp="Do you want to install only the version-specific parts of perl?"
9314 . ./myread
9315 case "$ans" in
9316 [yY]*)  val="$define";;
9317 *)      val="$undef" ;;
9318 esac
9319 set versiononly
9320 eval $setvar
9321
9322 case "$versiononly" in
9323 "$define") inc_version_list=''
9324            inc_version_list_init=0
9325            ;;
9326 esac
9327
9328 : figure out how to guarantee perl startup
9329 : XXX Note that this currently takes advantage of the bug that binexp ignores
9330 :     the Configure -Dinstallprefix setting, which in turn means that under
9331 :     relocatable @INC, initialinstalllocation is what binexp started as.
9332 case "$startperl" in
9333 '')
9334         case "$sharpbang" in
9335         *!)
9336                 $cat <<EOH
9337
9338 I can use the #! construct to start perl on your system. This will
9339 make startup of perl scripts faster, but may cause problems if you
9340 want to share those scripts and perl is not in a standard place
9341 ($initialinstalllocation/perl) on all your platforms. The alternative
9342 is to force a shell by starting the script with a single ':' character.
9343
9344 EOH
9345                 case "$versiononly" in
9346                 "$define")      dflt="$initialinstalllocation/perl$version";;
9347                 *)              dflt="$initialinstalllocation/perl";;
9348                 esac
9349                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9350                 . ./myread
9351                 case "$ans" in
9352                 none)   startperl=": # use perl";;
9353                 *)      startperl="#!$ans"
9354                         if $test 30 -lt `echo "$ans" | wc -c`; then
9355                                 $cat >&4 <<EOM
9356
9357 WARNING:  Some systems limit the #! command to 32 characters.
9358 If you experience difficulty running Perl scripts with #!, try
9359 installing Perl in a directory with a shorter pathname.
9360
9361 EOM
9362                         fi ;;
9363                 esac
9364                 ;;
9365         *) startperl=": # use perl"
9366                 ;;
9367         esac
9368         ;;
9369 esac
9370 echo "I'll use $startperl to start perl scripts."
9371
9372 : figure best path for perl in scripts
9373 case "$perlpath" in
9374 '')
9375         case "$versiononly" in
9376         "$define")      perlpath="$initialinstalllocation/perl$version";;
9377         *)              perlpath="$initialinstalllocation/perl";;
9378         esac
9379         case "$startperl" in
9380         *!*) ;;
9381         *)
9382                 $cat <<EOH
9383
9384 I will use the "eval 'exec'" idiom to start Perl on your system.
9385 I can use the full path of your Perl binary for this purpose, but
9386 doing so may cause problems if you want to share those scripts and
9387 Perl is not always in a standard place ($initialinstalllocation/perl).
9388
9389 EOH
9390                 dflt="$initialinstalllocation/perl"
9391                 rp="What path shall I use in \"eval 'exec'\"?"
9392                 . ./myread
9393                 perlpath="$ans"
9394                 ;;
9395         esac
9396         ;;
9397 esac
9398 case "$startperl" in
9399 *!*)    ;;
9400 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9401 esac
9402
9403 : determine where public executable scripts go
9404 set scriptdir scriptdir
9405 eval $prefixit
9406 case "$scriptdir" in
9407 '')
9408         dflt="$bin"
9409         : guess some guesses
9410         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9411         $test -d /usr/share/bin     && dflt=/usr/share/bin
9412         $test -d /usr/local/script  && dflt=/usr/local/script
9413         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9414         $test -d $prefixexp/script  && dflt=$prefixexp/script
9415         set dflt
9416         eval $prefixup
9417         ;;
9418 *)  dflt="$scriptdir"
9419         ;;
9420 esac
9421 $cat <<EOM
9422
9423 Some installations have a separate directory just for executable scripts so
9424 that they can mount it across multiple architectures but keep the scripts in
9425 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9426 Or you might just lump your scripts in with all your other executables.
9427
9428 EOM
9429 fn=d~
9430 rp='Where do you keep publicly executable scripts?'
9431 . ./getfile
9432 if $test "X$ansexp" != "X$scriptdirexp"; then
9433         installscript=''
9434 fi
9435 installscriptdir=''
9436 prefixvar=scriptdir
9437 . ./setprefixvar
9438 : A little fix up for an irregularly named variable.
9439 installscript="$installscriptdir"
9440
9441 : determine where add-on public executables go
9442 case "$sitebin" in
9443 '')     dflt=$siteprefix/bin ;;
9444 *)      dflt=$sitebin ;;
9445 esac
9446 fn=d~
9447 rp='Pathname where the add-on public executables should be installed?'
9448 . ./getfile
9449 prefixvar=sitebin
9450 . ./setprefixvar
9451
9452 : determine where add-on html pages go
9453 : There is no standard location, so try to copy the previously-selected
9454 : directory structure for the core html pages.
9455 case "$sitehtml1dir" in
9456 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9457 *)     dflt=$sitehtml1dir ;;
9458 esac
9459 case "$dflt" in
9460 ''|' ') dflt=none ;;
9461 esac
9462 fn=dn+~
9463 rp='Pathname where the site-specific html pages should be installed?'
9464 . ./getfile
9465 prefixvar=sitehtml1dir
9466 . ./setprefixvar
9467
9468 : determine where add-on library html pages go
9469 : There is no standard location, so try to copy the previously-selected
9470 : directory structure for the core html pages.
9471 case "$sitehtml3dir" in
9472 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9473 *)     dflt=$sitehtml3dir ;;
9474 esac
9475 case "$dflt" in
9476 ''|' ') dflt=none ;;
9477 esac
9478 fn=dn+~
9479 rp='Pathname where the site-specific library html pages should be installed?'
9480 . ./getfile
9481 prefixvar=sitehtml3dir
9482 . ./setprefixvar
9483
9484 : determine where add-on manual pages go
9485 case "$siteman1dir" in
9486 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9487 *)      dflt=$siteman1dir ;;
9488 esac
9489 case "$dflt" in
9490 ''|' ') dflt=none ;;
9491 esac
9492 fn=dn+~
9493 rp='Pathname where the site-specific manual pages should be installed?'
9494 . ./getfile
9495 prefixvar=siteman1dir
9496 . ./setprefixvar
9497
9498 : determine where add-on library man pages go
9499 case "$siteman3dir" in
9500 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9501 *)      dflt=$siteman3dir ;;
9502 esac
9503 case "$dflt" in
9504 ''|' ') dflt=none ;;
9505 esac
9506 fn=dn+~
9507 rp='Pathname where the site-specific library manual pages should be installed?'
9508 . ./getfile
9509 prefixvar=siteman3dir
9510 . ./setprefixvar
9511
9512 : determine where add-on public executable scripts go
9513 case "$sitescript" in
9514 '')     dflt=$siteprefix/script
9515         $test -d $dflt || dflt=$sitebin ;;
9516 *)  dflt="$sitescript" ;;
9517 esac
9518 fn=d~+
9519 rp='Pathname where add-on public executable scripts should be installed?'
9520 . ./getfile
9521 prefixvar=sitescript
9522 . ./setprefixvar
9523
9524 : see if backtrace exists
9525 set backtrace d_backtrace
9526 eval $inlibc
9527
9528 : add flags if using c backtrace
9529 case "$usecbacktrace" in
9530   "") usecbacktrace=$undef ;;
9531   [yY]*|true|$define)
9532     case "$d_backtrace" in
9533       [yY]*|true|$define)
9534         case " $ccflags " in
9535           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9536           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9537           esac
9538         ;;
9539       *)
9540         echo "This system does not support backtrace" >&4
9541         usecbacktrace=$undef
9542         ;;
9543       esac
9544     ;;
9545   esac
9546
9547 : Check if faststdio is requested and available
9548 case "$usefaststdio" in
9549 $define|true|[yY]*|'')
9550         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9551         case "$xversion" in
9552         [68])   dflt='y' ;;
9553         *)      dflt='n' ;;
9554         esac
9555         ;;
9556 *) dflt='n';;
9557 esac
9558 cat <<EOM
9559
9560 Perl can be built to use 'fast stdio', which means using the stdio
9561 library but also directly manipulating the stdio buffers to enable
9562 faster I/O.  Using stdio is better for backward compatibility (especially
9563 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9564 interface has been preferred instead of stdio.
9565
9566 If this doesn't make any sense to you, just accept the default '$dflt'.
9567 EOM
9568 rp='Use the "fast stdio" if available?'
9569 . ./myread
9570 case "$ans" in
9571 y|Y)    val="$define" ;;
9572 *)      val="$undef" ;;
9573 esac
9574 set usefaststdio
9575 eval $setvar
9576
9577
9578 : define an is-a-typedef? function
9579 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9580 case "$inclist" in
9581 "") inclist="sys/types.h";;
9582 esac;
9583 eval "varval=\$$var";
9584 case "$varval" in
9585 "")
9586         $rm -f temp.c;
9587         for inc in $inclist; do
9588                 echo "#include <$inc>" >>temp.c;
9589         done;
9590         echo "#ifdef $type" >> temp.c;
9591         echo "printf(\"We have $type\");" >> temp.c;
9592         echo "#endif" >> temp.c;
9593         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9594         if $contains $type temp.E >/dev/null 2>&1; then
9595                 eval "$var=\$type";
9596         else
9597                 eval "$var=\$def";
9598         fi;
9599         $rm -f temp.?;;
9600 *) eval "$var=\$varval";;
9601 esac'
9602
9603 : define an is-a-typedef? function that prompts if the type is not available.
9604 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9605 case "$inclist" in
9606 "") inclist="sys/types.h";;
9607 esac;
9608 eval "varval=\$$var";
9609 case "$varval" in
9610 "")
9611         $rm -f temp.c;
9612         for inc in $inclist; do
9613                 echo "#include <$inc>" >>temp.c;
9614         done;
9615         echo "#ifdef $type" >> temp.c;
9616         echo "printf(\"We have $type\");" >> temp.c;
9617         echo "#endif" >> temp.c;
9618         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9619         echo " " ;
9620         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9621         if $contains $type temp.E >/dev/null 2>&1; then
9622                 echo "$type found." >&4;
9623                 eval "$var=\$type";
9624         else
9625                 echo "$type NOT found." >&4;
9626                 dflt="$def";
9627                 . ./myread ;
9628                 eval "$var=\$ans";
9629         fi;
9630         $rm -f temp.?;;
9631 *) eval "$var=\$varval";;
9632 esac'
9633
9634 : see what type lseek is declared as in the kernel
9635 rp="What is the type used for lseek's offset on this system?"
9636 set off_t lseektype long stdio.h sys/types.h
9637 eval $typedef_ask
9638
9639 echo " "
9640 echo "Checking to see how big your file offsets are..." >&4
9641 $cat >try.c <<EOCP
9642 #include <sys/types.h>
9643 #include <stdio.h>
9644 int main()
9645 {
9646     printf("%d\n", (int)sizeof($lseektype));
9647     return(0);
9648 }
9649 EOCP
9650 set try
9651 if eval $compile_ok; then
9652         lseeksize=`$run ./try`
9653         echo "Your file offsets are $lseeksize bytes long."
9654 else
9655         dflt=$longsize
9656         echo " "
9657         echo "(I can't seem to compile the test program.  Guessing...)"
9658         rp="What is the size of your file offsets (in bytes)?"
9659         . ./myread
9660         lseeksize="$ans"
9661 fi
9662 $rm_try
9663
9664 : see what type file positions are declared as in the library
9665 rp="What is the type for file position used by fsetpos()?"
9666 set fpos_t fpostype long stdio.h sys/types.h
9667 eval $typedef_ask
9668
9669 : Check size for Fpos_t
9670 echo " "
9671 case "$fpostype" in
9672 *_t) zzz="$fpostype"    ;;
9673 *)   zzz="fpos_t"       ;;
9674 esac
9675 echo "Checking the size of $zzz..." >&4
9676 cat > try.c <<EOCP
9677 #include <sys/types.h>
9678 #include <stdio.h>
9679 #$i_stdlib I_STDLIB
9680 #ifdef I_STDLIB
9681 #include <stdlib.h>
9682 #endif
9683 int main() {
9684     printf("%d\n", (int)sizeof($fpostype));
9685     exit(0);
9686 }
9687 EOCP
9688 set try
9689 if eval $compile_ok; then
9690         yyy=`$run ./try`
9691         case "$yyy" in
9692         '')     fpossize=4
9693                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9694                 ;;
9695         *)      fpossize=$yyy
9696                 echo "Your $zzz is $fpossize bytes long."
9697                 ;;
9698         esac
9699 else
9700         dflt="$longsize"
9701         echo " " >&4
9702         echo "(I can't compile the test program.  Guessing...)" >&4
9703         rp="What is the size of your file positions (in bytes)?"
9704         . ./myread
9705         fpossize="$ans"
9706 fi
9707
9708 : Check for large file support
9709 # Backward compatibility (uselfs is deprecated).
9710 case "$uselfs" in
9711 "$define"|true|[yY]*)
9712         cat <<EOM >&4
9713
9714 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9715 EOM
9716         uselargefiles="$define"
9717         ;;
9718 esac
9719
9720 case "$lseeksize:$fpossize" in
9721 8:8) cat <<EOM
9722
9723 You can have files larger than 2 gigabytes.
9724 EOM
9725    val="$define" ;;
9726 *)    case "$uselargefiles" in
9727    "$undef"|false|[nN]*) dflt='n' ;;
9728    *)   dflt='y' ;;
9729    esac
9730    cat <<EOM
9731
9732 Perl can be built to understand large files (files larger than 2 gigabytes)
9733 on some systems.  To do so, Configure can be run with -Duselargefiles.
9734
9735 If this doesn't make any sense to you, just accept the default '$dflt'.
9736 EOM
9737    rp='Try to understand large files, if available?'
9738    . ./myread
9739    case "$ans" in
9740    y|Y)         val="$define" ;;
9741    *)           val="$undef"  ;;
9742    esac
9743    ;;
9744 esac
9745 set uselargefiles
9746 eval $setvar
9747 : Look for a hint-file generated 'call-back-unit'.  If the
9748 : user has specified that a large files perl is to be built,
9749 : we may need to set or change some other defaults.
9750 if $test -f uselargefiles.cbu; then
9751         echo "Your platform has some specific hints regarding large file builds, using them..."
9752         . ./uselargefiles.cbu
9753 fi
9754 case "$uselargefiles" in
9755 "$define")
9756         if $test -f uselargefiles.cbu; then
9757                 echo " "
9758                 echo "Rechecking to see how big your file offsets are..." >&4
9759                 $cat >try.c <<EOCP
9760 #include <sys/types.h>
9761 #include <stdio.h>
9762 int main()
9763 {
9764     printf("%d\n", (int)sizeof($lseektype));
9765     return(0);
9766 }
9767 EOCP
9768                 set try
9769                 if eval $compile_ok; then
9770                         lseeksize=`$run ./try`
9771                         $echo "Your file offsets are now $lseeksize bytes long."
9772                 else
9773                         dflt="$lseeksize"
9774                         echo " "
9775                         echo "(I can't seem to compile the test program.  Guessing...)"
9776                         rp="What is the size of your file offsets (in bytes)?"
9777                         . ./myread
9778                         lseeksize="$ans"
9779                 fi
9780                 case "$fpostype" in
9781                 *_t) zzz="$fpostype"    ;;
9782                 *)   zzz="fpos_t"       ;;
9783                 esac
9784                 $echo $n "Rechecking the size of $zzz...$c" >&4
9785                 $cat > try.c <<EOCP
9786 #include <sys/types.h>
9787 #include <stdio.h>
9788 #$i_stdlib I_STDLIB
9789 #ifdef I_STDLIB
9790 #include <stdlib.h>
9791 #endif
9792 int main() {
9793     printf("%d\n", (int)sizeof($fpostype));
9794     return(0);
9795 }
9796 EOCP
9797                 set try
9798                 if eval $compile_ok; then
9799                         yyy=`$run ./try`
9800                         dflt="$lseeksize"
9801                         case "$yyy" in
9802                         '')     echo " "
9803                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9804                                 ;;
9805                         *)      fpossize=$yyy
9806                                 echo " $fpossize bytes." >&4
9807                                 ;;
9808                         esac
9809                 else
9810                         dflt="$fpossize"
9811                         echo " "
9812                         echo "(I can't compile the test program.  Guessing...)" >&4
9813                         rp="What is the size of your file positions (in bytes)?"
9814                         . ./myread
9815                         fpossize="$ans"
9816                 fi
9817                 $rm_try
9818         fi
9819         ;;
9820 esac
9821
9822 : Check if we want perlio
9823 useperlio="$define"
9824
9825 : Set the vendorbin variables
9826 case "$vendorprefix" in
9827 '')     d_vendorbin="$undef"
9828         vendorbin=''
9829         vendorbinexp=''
9830         ;;
9831 *)      d_vendorbin="$define"
9832         : determine where vendor-supplied executables go.
9833         case "$vendorbin" in
9834         '') dflt=$vendorprefix/bin ;;
9835         *)      dflt="$vendorbin" ;;
9836         esac
9837         fn=d~+
9838         rp='Pathname for the vendor-supplied executables directory?'
9839         . ./getfile
9840         vendorbin="$ans"
9841         vendorbinexp="$ansexp"
9842         ;;
9843 esac
9844 prefixvar=vendorbin
9845 . ./installprefix
9846
9847 : Set the vendorhtml1dir variables
9848 case "$vendorprefix" in
9849 '')     vendorhtml1dir=''
9850         vendorhtml1direxp=''
9851         ;;
9852 *)      : determine where vendor-supplied html pages go.
9853         : There is no standard location, so try to copy the previously-selected
9854         : directory structure for the core html pages.
9855         : XXX Better default suggestions would be welcome.
9856         case "$vendorhtml1dir" in
9857         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9858         *)      dflt=$vendorhtml1dir ;;
9859         esac
9860         case "$dflt" in
9861         ''|' ') dflt=none ;;
9862         esac
9863         fn=dn+~
9864         rp='Pathname for the vendor-supplied html pages?'
9865         . ./getfile
9866         vendorhtml1dir="$ans"
9867         vendorhtml1direxp="$ansexp"
9868         ;;
9869 esac
9870 : Use ' ' for none so value is preserved next time through Configure
9871 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9872 prefixvar=vendorhtml1dir
9873 . ./installprefix
9874
9875 : Set the vendorhtml3dir variables
9876 case "$vendorprefix" in
9877 '')     vendorhtml3dir=''
9878         vendorhtml3direxp=''
9879         ;;
9880 *)      : determine where vendor-supplied module html pages go.
9881         : There is no standard location, so try to copy the previously-selected
9882         : directory structure for the core html pages.
9883         : XXX Better default suggestions would be welcome.
9884         case "$vendorhtml3dir" in
9885         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9886         *)      dflt=$vendorhtml3dir ;;
9887         esac
9888         case "$dflt" in
9889         ''|' ') dflt=none ;;
9890         esac
9891         fn=dn+~
9892         rp='Pathname for the vendor-supplied html pages?'
9893         . ./getfile
9894         vendorhtml3dir="$ans"
9895         vendorhtml3direxp="$ansexp"
9896         ;;
9897 esac
9898 : Use ' ' for none so value is preserved next time through Configure
9899 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9900 prefixvar=vendorhtml3dir
9901 . ./installprefix
9902
9903 : Set the vendorman1dir variables
9904 case "$vendorprefix" in
9905 '')     vendorman1dir=''
9906         vendorman1direxp=''
9907         ;;
9908 *)      : determine where vendor-supplied manual pages go.
9909         case "$vendorman1dir" in
9910         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9911         *)      dflt=$vendorman1dir ;;
9912         esac
9913         case "$dflt" in
9914         ''|' ') dflt=none ;;
9915         esac
9916         fn=nd~+
9917         rp='Pathname for the vendor-supplied manual section 1 pages?'
9918         . ./getfile
9919         vendorman1dir="$ans"
9920         vendorman1direxp="$ansexp"
9921         ;;
9922 esac
9923 : Use ' ' for none so value is preserved next time through Configure
9924 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9925 prefixvar=vendorman1dir
9926 . ./installprefix
9927
9928 : Set the vendorman3dir variables
9929 case "$vendorprefix" in
9930 '')     vendorman3dir=''
9931         vendorman3direxp=''
9932         ;;
9933 *)      : determine where vendor-supplied module manual pages go.
9934         case "$vendorman3dir" in
9935         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9936         *)      dflt=$vendorman3dir ;;
9937         esac
9938         case "$dflt" in
9939         ''|' ') dflt=none ;;
9940         esac
9941         fn=nd~+
9942         rp='Pathname for the vendor-supplied manual section 3 pages?'
9943         . ./getfile
9944         vendorman3dir="$ans"
9945         vendorman3direxp="$ansexp"
9946         ;;
9947 esac
9948 : Use ' ' for none so value is preserved next time through Configure
9949 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9950 prefixvar=vendorman3dir
9951 . ./installprefix
9952
9953 : Set the vendorscript variables
9954 case "$vendorprefix" in
9955 '')     d_vendorscript="$undef"
9956         vendorscript=''
9957         vendorscriptexp=''
9958         ;;
9959 *)      d_vendorscript="$define"
9960         : determine where vendor-supplied scripts go.
9961         case "$vendorscript" in
9962         '')     dflt=$vendorprefix/script
9963                 $test -d $dflt || dflt=$vendorbin ;;
9964         *)  dflt="$vendorscript" ;;
9965         esac
9966         $cat <<EOM
9967
9968 The installation process will create a directory for
9969 vendor-supplied scripts.
9970
9971 EOM
9972         fn=d~+
9973         rp='Pathname for the vendor-supplied scripts directory?'
9974         . ./getfile
9975         vendorscript="$ans"
9976         vendorscriptexp="$ansexp"
9977         ;;
9978 esac
9979 prefixvar=vendorscript
9980 . ./installprefix
9981
9982 : script used to emit important warnings
9983 cat >warn <<EOS
9984 $startsh
9985 if test \$# -gt 0; then
9986         echo "\$@" >msg
9987 else
9988         cat >msg
9989 fi
9990 echo "*** WARNING:" >&4
9991 sed -e 's/^/*** /' <msg >&4
9992 echo "*** " >&4
9993 cat msg >>config.msg
9994 echo " " >>config.msg
9995 rm -f msg
9996 EOS
9997 chmod +x warn
9998 $eunicefix warn
9999
10000 : see which of string.h or strings.h is needed
10001 echo " "
10002 strings=`./findhdr string.h`
10003 if $test "$strings" && $test -r "$strings"; then
10004         echo "Using <string.h> instead of <strings.h>." >&4
10005         val="$define"
10006 else
10007         val="$undef"
10008         strings=`./findhdr strings.h`
10009         if $test "$strings" && $test -r "$strings"; then
10010                 echo "Using <strings.h> instead of <string.h>." >&4
10011         else
10012                 ./warn "No string header found -- You'll surely have problems."
10013         fi
10014 fi
10015 set i_string
10016 eval $setvar
10017 case "$i_string" in
10018 "$undef") strings=`./findhdr strings.h`;;
10019 *)        strings=`./findhdr string.h`;;
10020 esac
10021
10022 : see if qgcvt exists
10023 set qgcvt d_qgcvt
10024 eval $inlibc
10025
10026 : Check what kind of doubles your system has
10027 $echo "Checking the kind of doubles you have..." >&4
10028 $cat >try.c <<EOP
10029 #$i_stdlib I_STDLIB
10030 #define DOUBLESIZE $doublesize
10031 #ifdef I_STDLIB
10032 #include <stdlib.h>
10033 #endif
10034 #include <stdio.h>
10035 static const double d = -0.1;
10036 int main() {
10037   unsigned const char* b = (unsigned const char*)(&d);
10038 #if DOUBLESIZE == 4
10039   if (b[0] == 0xCD && b[3] == 0xBD) {
10040     /* IEEE 754 32-bit little-endian */
10041     printf("1\n");
10042     exit(0);
10043   }
10044   if (b[0] == 0xBD && b[3] == 0xCD) {
10045     /* IEEE 754 32-bit big-endian */
10046     printf("2\n");
10047     exit(0);
10048   }
10049 #endif
10050 #if DOUBLESIZE == 8
10051   if (b[0] == 0x9A && b[7] == 0xBF) {
10052     /* IEEE 754 64-bit little-endian */
10053     printf("3\n");
10054     exit(0);
10055   }
10056   if (b[0] == 0xBF && b[7] == 0x9A) {
10057     /* IEEE 754 64-bit big-endian */
10058     printf("4\n");
10059     exit(0);
10060   }
10061   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10062    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10063     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10064     * 99 99 b9 bf 9a 99 99 99 */
10065     printf("7\n");
10066     exit(0);
10067   }
10068   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10069    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10070     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10071     * 99 99 99 9a bf b9 99 99 */
10072     printf("8\n");
10073     exit(0);
10074   }
10075 #endif
10076 #if DOUBLESIZE == 16
10077   if (b[0] == 0x9A && b[15] == 0xBF) {
10078     /* IEEE 754 128-bit little-endian */
10079     printf("5\n");
10080     exit(0);
10081   }
10082   if (b[0] == 0xBF && b[15] == 0x9A) {
10083     /* IEEE 754 128-bit big-endian */
10084     printf("6\n");
10085     exit(0);
10086   }
10087 #endif
10088   /* Then there are old mainframe/miniframe formats like VAX, IBM, and CRAY.
10089    * Whether those environments can still build Perl is debatable. */
10090   printf("-1\n"); /* unknown */
10091   exit(0);
10092 }
10093 EOP
10094 set try
10095 if eval $compile; then
10096     doublekind=`$run ./try`
10097 else
10098     doublekind=-1
10099 fi
10100 case "$doublekind" in
10101 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10102 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10103 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10104 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10105 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10106 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10107 *) echo "Cannot figure out your double.  You VAX, or something?" >&4 ;;
10108 esac
10109 $rm_try
10110
10111 : Check print/scan long double stuff
10112 echo " "
10113
10114 if $test X"$d_longdbl" = X"$define"; then
10115
10116 echo "Checking how to print long doubles..." >&4
10117
10118 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10119         $cat >try.c <<'EOCP'
10120 #include <sys/types.h>
10121 #include <stdio.h>
10122 int main() {
10123   double d = 123.456;
10124   printf("%.3f\n", d);
10125 }
10126 EOCP
10127         set try
10128         if eval $compile; then
10129                 yyy=`$run ./try`
10130                 case "$yyy" in
10131                 123.456)
10132                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10133                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10134                         echo "We will use %f."
10135                         ;;
10136                 esac
10137         fi
10138 fi
10139
10140 if $test X"$sPRIfldbl" = X; then
10141         $cat >try.c <<'EOCP'
10142 #include <sys/types.h>
10143 #include <stdio.h>
10144 int main() {
10145   long double d = 123.456;
10146   printf("%.3Lf\n", d);
10147 }
10148 EOCP
10149         set try
10150         if eval $compile; then
10151                 yyy=`$run ./try`
10152                 case "$yyy" in
10153                 123.456)
10154                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10155                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10156                         echo "We will use %Lf."
10157                         ;;
10158                 esac
10159         fi
10160 fi
10161
10162 if $test X"$sPRIfldbl" = X; then
10163         $cat >try.c <<'EOCP'
10164 #include <sys/types.h>
10165 #include <stdio.h>
10166 int main() {
10167   long double d = 123.456;
10168   printf("%.3llf\n", d);
10169 }
10170 EOCP
10171         set try
10172         if eval $compile; then
10173                 yyy=`$run ./try`
10174                 case "$yyy" in
10175                 123.456)
10176                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10177                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10178                         echo "We will use %llf."
10179                         ;;
10180                 esac
10181         fi
10182 fi
10183
10184 if $test X"$sPRIfldbl" = X; then
10185         $cat >try.c <<'EOCP'
10186 #include <sys/types.h>
10187 #include <stdio.h>
10188 int main() {
10189   long double d = 123.456;
10190   printf("%.3lf\n", d);
10191 }
10192 EOCP
10193         set try
10194         if eval $compile; then
10195                 yyy=`$run ./try`
10196                 case "$yyy" in
10197                 123.456)
10198                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10199                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10200                         echo "We will use %lf."
10201                         ;;
10202                 esac
10203         fi
10204 fi
10205
10206 if $test X"$sPRIfldbl" = X; then
10207         echo "Cannot figure out how to print long doubles." >&4
10208 else
10209         sSCNfldbl=$sPRIfldbl    # expect consistency
10210 fi
10211
10212 $rm_try
10213
10214 fi # d_longdbl
10215
10216 case "$sPRIfldbl" in
10217 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10218         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10219         d_SCNfldbl="$undef";
10220         ;;
10221 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10222         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10223         d_SCNfldbl="$define";
10224         ;;
10225 esac
10226
10227 : Before committing on uselongdouble, see whether that looks sane.
10228 if $test "$uselongdouble" = "$define"; then
10229     message=""
10230     echo " "
10231     echo "Checking if your long double math functions work right..." >&4
10232     $cat > try.c <<EOF
10233 #include <math.h>
10234 #include <stdio.h>
10235 int main() {
10236   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10237 }
10238 EOF
10239     case "$osname:$gccversion" in
10240     aix:)       saveccflags="$ccflags"
10241                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10242     esac
10243     set try
10244     if eval $compile_ok; then
10245       yyy=`$run ./try`
10246     fi
10247     case "$yyy" in
10248     3) echo "Your long double math functions are working correctly." >&4 ;;
10249     *) echo "Your long double math functions are broken, not using long doubles." >&4
10250        uselongdouble=$undef
10251        ;;
10252     esac
10253     $rm_try
10254     case "$osname:$gccversion" in
10255     aix:)       ccflags="$saveccflags" ;; # restore
10256     esac
10257 fi
10258
10259 : Check how to convert floats to strings.
10260
10261 if test "X$d_Gconvert" = X; then
10262
10263 echo " "
10264 echo "Checking for an efficient way to convert floats to strings."
10265 echo " " > try.c
10266 case "$uselongdouble" in
10267 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10268 esac
10269 case "$d_longdbl" in
10270 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10271 esac
10272 case "$d_PRIgldbl" in
10273 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10274 esac
10275 $cat >>try.c <<EOP
10276 #ifdef TRY_gconvert
10277 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10278 char *myname = "gconvert";
10279 #endif
10280 #ifdef TRY_gcvt
10281 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10282 char *myname = "gcvt";
10283 #endif
10284 #ifdef TRY_qgcvt
10285 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10286 char *myname = "qgcvt";
10287 #define DOUBLETYPE long double
10288 #endif
10289 #ifdef TRY_sprintf
10290 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10291 #ifdef HAS_PRIgldbl
10292 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10293 #else
10294 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10295 #endif
10296 #else
10297 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10298 #endif
10299 char *myname = "sprintf";
10300 #endif
10301
10302 #ifndef DOUBLETYPE
10303 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10304 #define DOUBLETYPE long double
10305 #else
10306 #define DOUBLETYPE double
10307 #endif
10308 #endif
10309
10310 #include <stdio.h>
10311
10312 #$i_stdlib I_STDLIB
10313 #ifdef I_STDLIB
10314 #include <stdlib.h>
10315 #endif
10316 #$i_string I_STRING
10317 #ifdef I_STRING
10318 #  include <string.h>
10319 #else
10320 #  include <strings.h>
10321 #endif
10322
10323 int checkit(char *expect, char *got)
10324 {
10325     if (strcmp(expect, got)) {
10326                 printf("%s oddity:  Expected %s, got %s\n",
10327                         myname, expect, got);
10328                 exit(1);
10329         }
10330 }
10331
10332 int main()
10333 {
10334         char buf[64];
10335         buf[63] = '\0';
10336
10337         /* This must be 1st test on (which?) platform */
10338         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10339         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10340         checkit("0.1", buf);
10341
10342         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10343         checkit("0.01", buf);
10344
10345         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10346         checkit("0.001", buf);
10347
10348         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10349         checkit("0.0001", buf);
10350
10351         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10352         if (strlen(buf) > 5)
10353             checkit("9e-005", buf); /* for Microsoft ?? */
10354         else
10355             checkit("9e-05", buf);
10356
10357         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10358         checkit("1", buf);
10359
10360         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10361         checkit("1.1", buf);
10362
10363         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10364         checkit("1.01", buf);
10365
10366         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10367         checkit("1.001", buf);
10368
10369         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10370         checkit("1.0001", buf);
10371
10372         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10373         checkit("1.00001", buf);
10374
10375         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10376         checkit("1.000001", buf);
10377
10378         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10379         checkit("0", buf);
10380
10381         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10382         checkit("-1", buf);
10383
10384         /* Some Linux gcvt's give 1.e+5 here. */
10385         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10386         checkit("100000", 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         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10393         checkit("123.456", buf);
10394
10395         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10396         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10397         /* 34 should be enough to scare even long double
10398          * places into using the e notation. */
10399         if (strlen(buf) > 5)
10400             checkit("1e+034", buf); /* for Microsoft */
10401         else
10402             checkit("1e+34", buf);
10403
10404         /* For Perl, if you add additional tests here, also add them to
10405          * t/base/num.t for benefit of platforms not using Configure or
10406          * overriding d_Gconvert */
10407
10408         exit(0);
10409 }
10410 EOP
10411 : first add preferred functions to our list
10412 xxx_list=""
10413 for xxx_convert in $gconvert_preference; do
10414     case $xxx_convert in
10415     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10416     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10417     esac
10418 done
10419 : then add any others
10420 for xxx_convert in gconvert gcvt sprintf; do
10421     case "$xxx_list" in
10422     *$xxx_convert*) ;;
10423     *) xxx_list="$xxx_list $xxx_convert" ;;
10424     esac
10425 done
10426
10427 case "$d_longdbl$uselongdouble" in
10428 "$define$define")
10429     : again, add preferred functions to our list first
10430     xxx_ld_list=""
10431     for xxx_convert in $gconvert_ld_preference; do
10432         case $xxx_convert in
10433         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10434         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10435         esac
10436     done
10437     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10438     for xxx_convert in qgcvt sprintf $xxx_list; do
10439         case "$xxx_ld_list" in
10440         $xxx_convert*|*" $xxx_convert"*) ;;
10441         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10442         esac
10443     done
10444     : if sprintf cannot do long doubles, move it to the end
10445     if test "$d_PRIgldbl" != "$define"; then
10446         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10447     fi
10448     : if no qgcvt, remove it
10449     if test "$d_qgcvt" != "$define"; then
10450         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10451     fi
10452     : use the ld_list
10453     xxx_list="$xxx_ld_list"
10454     ;;
10455 esac
10456
10457 for xxx_convert in $xxx_list; do
10458         echo "Trying $xxx_convert..."
10459         $rm -f try try$_o core
10460         set try -DTRY_$xxx_convert
10461         if eval $compile; then
10462                 echo "$xxx_convert() found." >&4
10463                 if $run ./try; then
10464                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10465                         break;
10466                 else
10467                         echo "...But $xxx_convert didn't work as I expected."
10468                         xxx_convert=''
10469                 fi
10470         else
10471                 echo "$xxx_convert NOT found." >&4
10472         fi
10473 done
10474
10475 if test X$xxx_convert = X; then
10476     echo "*** WHOA THERE!!! ***" >&4
10477     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10478     xxx_convert=sprintf
10479 fi
10480
10481 case "$xxx_convert" in
10482 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10483 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10484 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10485 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10486    "$define$define$define")
10487       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10488    "$define$define$undef")
10489       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10490    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10491    esac
10492    ;;
10493 esac
10494
10495 fi
10496 $rm_try
10497
10498 : see if _fwalk exists
10499 set fwalk d__fwalk
10500 eval $inlibc
10501
10502 : Initialize h_fcntl
10503 h_fcntl=false
10504
10505 : Initialize h_sysfile
10506 h_sysfile=false
10507
10508 : access call always available on UNIX
10509 set access d_access
10510 eval $inlibc
10511
10512 : locate the flags for 'access()'
10513 case "$d_access" in
10514 "$define")
10515         echo " "
10516         $cat >access.c <<EOCP
10517 #include <sys/types.h>
10518 #ifdef I_FCNTL
10519 #include <fcntl.h>
10520 #endif
10521 #ifdef I_SYS_FILE
10522 #include <sys/file.h>
10523 #endif
10524 #ifdef I_UNISTD
10525 #include <unistd.h>
10526 #endif
10527 #$i_stdlib I_STDLIB
10528 #ifdef I_STDLIB
10529 #include <stdlib.h>
10530 #endif
10531 int main() {
10532         exit(R_OK);
10533 }
10534 EOCP
10535         : check sys/file.h first, no particular reason here
10536         if $test `./findhdr sys/file.h` && \
10537                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10538                 h_sysfile=true;
10539                 echo "<sys/file.h> defines the *_OK access constants." >&4
10540         elif $test `./findhdr fcntl.h` && \
10541                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10542                 h_fcntl=true;
10543                 echo "<fcntl.h> defines the *_OK access constants." >&4
10544         elif $test `./findhdr unistd.h` && \
10545                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10546                 echo "<unistd.h> defines the *_OK access constants." >&4
10547         else
10548                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10549         fi
10550         ;;
10551 esac
10552 $rm -f access*
10553
10554 : see if accessx exists
10555 set accessx d_accessx
10556 eval $inlibc
10557
10558 : see if acosh exists
10559 set acosh d_acosh
10560 eval $inlibc
10561
10562 : see if aintl exists
10563 set aintl d_aintl
10564 eval $inlibc
10565
10566 : see if alarm exists
10567 set alarm d_alarm
10568 eval $inlibc
10569
10570 : see if 64bit time functions exists
10571
10572 set ctime64 d_ctime64
10573 eval $inlibc
10574
10575 set localtime64 d_localtime64
10576 eval $inlibc
10577
10578 set gmtime64 d_gmtime64
10579 eval $inlibc
10580
10581 set mktime64 d_mktime64
10582 eval $inlibc
10583
10584 set difftime64 d_difftime64
10585 eval $inlibc
10586
10587 set asctime64 d_asctime64
10588 eval $inlibc
10589
10590 : see if POSIX threads are available
10591 set pthread.h i_pthread
10592 eval $inhdr
10593
10594 : define a function to check prototypes
10595 $cat > protochk <<EOSH
10596 $startsh
10597 cc="$cc"
10598 optimize="$optimize"
10599 ccflags="$ccflags"
10600 prototype="$prototype"
10601 define="$define"
10602 rm_try="$rm_try"
10603 usethreads=$usethreads
10604 i_pthread=$i_pthread
10605 pthread_h_first=$pthread_h_first
10606 EOSH
10607
10608 $cat >> protochk <<'EOSH'
10609
10610 $rm_try
10611 foo="$1"
10612 shift
10613 while test $# -ge 2; do
10614         case "$1" in
10615                 $define) echo "#include <$2>" >> try.c ;;
10616                 literal) echo "$2" >> try.c ;;
10617         esac
10618     # Extra magic for the benefit of systems that need pthread.h
10619     # to be included early to correctly detect threadsafe functions.
10620     # Such functions must guarantee themselves, though, that the usethreads
10621     # and i_pthread have been defined, before calling protochk.
10622     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10623         echo "#include <pthread.h>" >> try.c
10624         pthread_h_done=yes
10625     fi
10626     shift 2
10627 done
10628 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10629 cat >> try.c <<'EOCP'
10630 #ifdef CAN_PROTOTYPE
10631 #define _(args) args
10632 #else
10633 #define _(args) ()
10634 #endif
10635 EOCP
10636 echo "$foo" >> try.c
10637 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10638 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10639 status=$?
10640 $rm_try
10641 exit $status
10642 EOSH
10643 chmod +x protochk
10644 $eunicefix protochk
10645
10646 : Define hasproto macro for Configure internal use
10647 hasproto='varname=$1; func=$2; shift; shift;
10648 while $test $# -ge 2; do
10649         case "$1" in
10650         $define) echo "#include <$2>";;
10651         esac ;
10652     shift 2;
10653 done > try.c;
10654 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10655 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10656         echo "$func() prototype found.";
10657         val="$define";
10658 else
10659         echo "$func() prototype NOT found.";
10660         val="$undef";
10661 fi;
10662 set $varname;
10663 eval $setvar;
10664 $rm_try tryout.c'
10665
10666 : see if sys/types.h has to be included
10667 set sys/types.h i_systypes
10668 eval $inhdr
10669
10670 : see if sys/select.h has to be included
10671 set sys/select.h i_sysselct
10672 eval $inhdr
10673
10674 : Define hasfield macro for Configure internal use
10675 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10676 while $test $# -ge 2; do
10677         case "$1" in
10678         $define) echo "#include <$2>";;
10679         esac ;
10680     shift 2;
10681 done > try.c;
10682 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10683 set try;
10684 if eval $compile; then
10685         val="$define";
10686 else
10687         val="$undef";
10688 fi;
10689 set $varname;
10690 eval $setvar;
10691 $rm_try'
10692
10693 : see if we should include time.h, sys/time.h, or both
10694 echo " "
10695 if test "X$timeincl" = X; then
10696         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10697         $echo $n "I'm now running the test program...$c"
10698         $cat >try.c <<EOCP
10699 #include <sys/types.h>
10700 #ifdef I_TIME
10701 #include <time.h>
10702 #endif
10703 #ifdef I_SYSTIME
10704 #ifdef SYSTIMEKERNEL
10705 #define KERNEL
10706 #endif
10707 #include <sys/time.h>
10708 #endif
10709 #ifdef I_SYSSELECT
10710 #include <sys/select.h>
10711 #endif
10712 #$i_stdlib I_STDLIB
10713 #ifdef I_STDLIB
10714 #include <stdlib.h>
10715 #endif
10716 int main()
10717 {
10718         struct tm foo;
10719 #ifdef S_TIMEVAL
10720         struct timeval bar;
10721 #endif
10722 #ifdef S_TIMEZONE
10723         struct timezone tzp;
10724 #endif
10725         if (foo.tm_sec == foo.tm_sec)
10726                 exit(0);
10727 #ifdef S_TIMEVAL
10728         if (bar.tv_sec == bar.tv_sec)
10729                 exit(0);
10730 #endif
10731         exit(1);
10732 }
10733 EOCP
10734         flags=''
10735         for s_timezone in '-DS_TIMEZONE' ''; do
10736         sysselect=''
10737         for s_timeval in '-DS_TIMEVAL' ''; do
10738         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10739         for i_time in '' '-DI_TIME'; do
10740         for i_systime in '-DI_SYSTIME' ''; do
10741                 case "$flags" in
10742                 '') $echo $n ".$c"
10743                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10744                         if eval $compile; then
10745                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10746                                 shift
10747                                 flags="$*"
10748                                 echo " "
10749                                 $echo $n "Succeeded with $flags$c"
10750                         fi
10751                         ;;
10752                 esac
10753         done
10754         done
10755         done
10756         done
10757         done
10758         timeincl=''
10759         echo " "
10760         case "$flags" in
10761         *SYSTIMEKERNEL*) i_systimek="$define"
10762                 timeincl=`./findhdr sys/time.h`
10763                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10764         *) i_systimek="$undef";;
10765         esac
10766         case "$flags" in
10767         *I_TIME*) i_time="$define"
10768                 timeincl=`./findhdr time.h`" $timeincl"
10769                 echo "We'll include <time.h>." >&4;;
10770         *) i_time="$undef";;
10771         esac
10772         case "$flags" in
10773         *I_SYSTIME*) i_systime="$define"
10774                 timeincl=`./findhdr sys/time.h`" $timeincl"
10775                 echo "We'll include <sys/time.h>." >&4;;
10776         *) i_systime="$undef";;
10777         esac
10778         $rm_try
10779 fi
10780 : see if struct tm knows about tm_zone
10781 case "$i_systime$i_time" in
10782 *$define*)
10783         echo " "
10784         echo "Checking to see if your struct tm has tm_zone field..." >&4
10785         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10786         eval $hasfield
10787         ;;
10788 *)      val="$undef"
10789         set d_tm_tm_zone
10790         eval $setvar
10791         ;;
10792 esac
10793 case "$d_tm_tm_zone" in
10794 "$define")      echo "Yes, it does."   ;;
10795 *)              echo "No, it doesn't." ;;
10796 esac
10797 : see if struct tm knows about tm_gmtoff
10798 case "$i_systime$i_time" in
10799 *$define*)
10800         echo " "
10801         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10802         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10803         eval $hasfield
10804         ;;
10805 *)      val="$undef"
10806         set d_tm_tm_gmtoff
10807         eval $setvar
10808         ;;
10809 esac
10810 case "$d_tm_tm_gmtoff" in
10811 "$define")      echo "Yes, it does."   ;;
10812 *)              echo "No, it doesn't." ;;
10813 esac
10814
10815 : see if asctime_r exists
10816 set asctime_r d_asctime_r
10817 eval $inlibc
10818 case "$d_asctime_r" in
10819 "$define")
10820         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10821         case "$d_asctime_r_proto:$usethreads" in
10822         ":define")      d_asctime_r_proto=define
10823                 set d_asctime_r_proto asctime_r $hdrs
10824                 eval $hasproto ;;
10825         *)      ;;
10826         esac
10827         case "$d_asctime_r_proto" in
10828         define)
10829         case "$asctime_r_proto" in
10830         ''|0) try='char* asctime_r(const struct tm*, char*);'
10831         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10832         esac
10833         case "$asctime_r_proto" in
10834         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10835         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10836         esac
10837         case "$asctime_r_proto" in
10838         ''|0) try='int asctime_r(const struct tm*, char*);'
10839         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10840         esac
10841         case "$asctime_r_proto" in
10842         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10843         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10844         esac
10845         case "$asctime_r_proto" in
10846         ''|0)   d_asctime_r=undef
10847                 asctime_r_proto=0
10848                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10849         * )     case "$asctime_r_proto" in
10850                 REENTRANT_PROTO*) ;;
10851                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10852                 esac
10853                 echo "Prototype: $try" ;;
10854         esac
10855         ;;
10856         *)      case "$usethreads" in
10857                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10858                 esac
10859                 d_asctime_r=undef
10860                 asctime_r_proto=0
10861                 ;;
10862         esac
10863         ;;
10864 *)      asctime_r_proto=0
10865         ;;
10866 esac
10867
10868 : see if asinh exists
10869 set asinh d_asinh
10870 eval $inlibc
10871
10872 : see if atanh exists
10873 set atanh d_atanh
10874 eval $inlibc
10875
10876 : see if atolf exists
10877 set atolf d_atolf
10878 eval $inlibc
10879
10880 : see if atoll exists
10881 set atoll d_atoll
10882 eval $inlibc
10883
10884 : Look for GCC-style attribute format
10885 case "$d_attribute_format" in
10886 '')
10887 echo " "
10888 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10889 $cat >attrib.c <<'EOCP'
10890 #include <stdio.h>
10891 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10892 EOCP
10893 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10894         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10895                 echo "Your C compiler doesn't support __attribute__((format))."
10896                 val="$undef"
10897         else
10898                 echo "Your C compiler supports __attribute__((format))."
10899                 val="$define"
10900         fi
10901 else
10902         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10903         val="$undef"
10904 fi
10905 ;;
10906 *) val="$d_attribute_format" ;;
10907 esac
10908 set d_attribute_format
10909 eval $setvar
10910 $rm -f attrib*
10911
10912 : Look for GCC-style attribute format with null format allowed
10913 case "$d_printf_format_null" in
10914 '') case "$d_attribute_format" in
10915     $define)
10916         echo " "
10917         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10918 $cat >attrib.c <<EOCP
10919 #include <stdio.h>
10920 #$i_stdlib I_STDLIB
10921 #ifdef I_STDLIB
10922 #include <stdlib.h>
10923 #endif
10924 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10925 int null_printf (char* pat,...) { return (int)pat; }
10926 int main () { exit(null_printf(NULL)); }
10927 EOCP
10928         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10929             : run the executable in case it produces a run-time warning
10930             if $run ./attrib >>attrib.out 2>&1; then
10931                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10932                     echo "Your C compiler doesn't allow __printf__ format to be null."
10933                     val="$undef"
10934                 else
10935                     echo "Your C compiler allows __printf__ format to be null."
10936                     val="$define"
10937                 fi
10938             else
10939             echo "Your C compiler executable failed with __printf__ format null."
10940             val="$undef"
10941         fi
10942     else
10943         echo "Your C compiler fails with __printf__ format null."
10944         val="$undef"
10945     fi
10946     ;;
10947     *)  val="$undef" ;;
10948     esac
10949 ;;
10950 *)  val="$d_printf_format_null" ;;
10951 esac
10952 set d_printf_format_null
10953 eval $setvar
10954 $rm -f attrib*
10955
10956 : Look for GCC-style attribute malloc
10957 case "$d_attribute_malloc" in
10958 '')
10959 echo " "
10960 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10961 $cat >attrib.c <<'EOCP'
10962 #include <stdio.h>
10963 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10964 EOCP
10965 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10966         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10967                 echo "Your C compiler doesn't support __attribute__((malloc))."
10968                 val="$undef"
10969         else
10970                 echo "Your C compiler supports __attribute__((malloc))."
10971                 val="$define"
10972         fi
10973 else
10974         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10975         val="$undef"
10976 fi
10977 ;;
10978 *) val="$d_attribute_malloc" ;;
10979 esac
10980 set d_attribute_malloc
10981 eval $setvar
10982 $rm -f attrib*
10983
10984 : Look for GCC-style attribute nonnull
10985 case "$d_attribute_nonnull" in
10986 '')
10987 echo " "
10988 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10989 $cat >attrib.c <<'EOCP'
10990 #include <stdio.h>
10991 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10992 EOCP
10993 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10994         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10995                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10996                 val="$undef"
10997         else
10998                 echo "Your C compiler supports __attribute__((nonnull))."
10999                 val="$define"
11000         fi
11001 else
11002         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11003         val="$undef"
11004 fi
11005 ;;
11006 *) val="$d_attribute_nonnull" ;;
11007 esac
11008 set d_attribute_nonnull
11009 eval $setvar
11010 $rm -f attrib*
11011
11012 : Look for GCC-style attribute noreturn
11013 case "$d_attribute_noreturn" in
11014 '')
11015 echo " "
11016 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11017 $cat >attrib.c <<'EOCP'
11018 #include <stdio.h>
11019 void fall_over_dead( void ) __attribute__((noreturn));
11020 EOCP
11021 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11022         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11023                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11024                 val="$undef"
11025         else
11026                 echo "Your C compiler supports __attribute__((noreturn))."
11027                 val="$define"
11028         fi
11029 else
11030         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11031         val="$undef"
11032 fi
11033 ;;
11034 *) val="$d_attribute_noreturn" ;;
11035 esac
11036 set d_attribute_noreturn
11037 eval $setvar
11038 $rm -f attrib*
11039
11040 : Look for GCC-style attribute pure
11041 case "$d_attribute_pure" in
11042 '')
11043 echo " "
11044 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11045 $cat >attrib.c <<'EOCP'
11046 #include <stdio.h>
11047 int square( int n ) __attribute__((pure));
11048 EOCP
11049 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11050         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11051                 echo "Your C compiler doesn't support __attribute__((pure))."
11052                 val="$undef"
11053         else
11054                 echo "Your C compiler supports __attribute__((pure))."
11055                 val="$define"
11056         fi
11057 else
11058         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11059         val="$undef"
11060 fi
11061 ;;
11062 *) val="$d_attribute_pure" ;;
11063 esac
11064 set d_attribute_pure
11065 eval $setvar
11066 $rm -f attrib*
11067
11068 : Look for GCC-style attribute unused
11069 case "$d_attribute_unused" in
11070 '')
11071 echo " "
11072 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11073 $cat >attrib.c <<'EOCP'
11074 #include <stdio.h>
11075 int do_something( int dummy __attribute__((unused)), int n );
11076 EOCP
11077 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11078         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11079                 echo "Your C compiler doesn't support __attribute__((unused))."
11080                 val="$undef"
11081         else
11082                 echo "Your C compiler supports __attribute__((unused))."
11083                 val="$define"
11084         fi
11085 else
11086         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11087         val="$undef"
11088 fi
11089 ;;
11090 *) val="$d_attribute_unused" ;;
11091 esac
11092 set d_attribute_unused
11093 eval $setvar
11094 $rm -f attrib*
11095
11096 : Look for GCC-style attribute deprecated
11097 case "$d_attribute_deprecated" in
11098 '')
11099 echo " "
11100 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11101 $cat >attrib.c <<'EOCP'
11102 #include <stdio.h>
11103 int I_am_deprecated(void) __attribute__((deprecated));
11104 EOCP
11105 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11106         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11107                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11108                 val="$undef"
11109         else
11110                 echo "Your C compiler supports __attribute__((deprecated))."
11111                 val="$define"
11112         fi
11113 else
11114         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11115         val="$undef"
11116 fi
11117 ;;
11118 *) val="$d_attribute_deprecated" ;;
11119 esac
11120 set d_attribute_deprecated
11121 eval $setvar
11122 $rm -f attrib*
11123
11124 : Look for GCC-style attribute warn_unused_result
11125 case "$d_attribute_warn_unused_result" in
11126 '')
11127 echo " "
11128 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11129 $cat >attrib.c <<'EOCP'
11130 #include <stdio.h>
11131 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11132 EOCP
11133 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11134         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11135                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11136                 val="$undef"
11137         else
11138                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11139                 val="$define"
11140         fi
11141 else
11142         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11143         val="$undef"
11144 fi
11145 ;;
11146 *) val="$d_attribute_warn_unused_result" ;;
11147 esac
11148 set d_attribute_warn_unused_result
11149 eval $setvar
11150 $rm -f attrib*
11151
11152 : see if bcmp exists
11153 set bcmp d_bcmp
11154 eval $inlibc
11155
11156 : see if bcopy exists
11157 set bcopy d_bcopy
11158 eval $inlibc
11159
11160 : see if getpgrp exists
11161 set getpgrp d_getpgrp
11162 eval $inlibc
11163
11164 case "$d_getpgrp" in
11165 "$define")
11166         echo " "
11167         echo "Checking to see which flavor of getpgrp is in use..."
11168         $cat >try.c <<EOP
11169 #$i_unistd I_UNISTD
11170 #include <sys/types.h>
11171 #ifdef I_UNISTD
11172 #  include <unistd.h>
11173 #endif
11174 #$i_stdlib I_STDLIB
11175 #ifdef I_STDLIB
11176 #include <stdlib.h>
11177 #endif
11178 int main()
11179 {
11180         if (getuid() == 0) {
11181                 printf("(I see you are running Configure as super-user...)\n");
11182                 setuid(1);
11183         }
11184 #ifdef TRY_BSD_PGRP
11185         if (getpgrp(1) == 0)
11186                 exit(0);
11187 #else
11188         if (getpgrp() > 0)
11189                 exit(0);
11190 #endif
11191         exit(1);
11192 }
11193 EOP
11194         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11195                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11196                 val="$define"
11197         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11198                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11199                 val="$undef"
11200         else
11201                 echo "I can't seem to compile and run the test program."
11202                 if ./usg; then
11203                         xxx="a USG one, i.e. you use getpgrp()."
11204                 else
11205                         # SVR4 systems can appear rather BSD-ish.
11206                         case "$i_unistd" in
11207                         $undef)
11208                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11209                                 val="$define"
11210                                 ;;
11211                         $define)
11212                                 xxx="probably a USG one, i.e. you use getpgrp()."
11213                                 val="$undef"
11214                                 ;;
11215                         esac
11216                 fi
11217                 echo "Assuming your getpgrp is $xxx" >&4
11218         fi
11219         ;;
11220 *) val="$undef";;
11221 esac
11222 set d_bsdgetpgrp
11223 eval $setvar
11224 $rm_try
11225
11226 : see if setpgrp exists
11227 set setpgrp d_setpgrp
11228 eval $inlibc
11229
11230 case "$d_setpgrp" in
11231 "$define")
11232         echo " "
11233         echo "Checking to see which flavor of setpgrp is in use..."
11234         $cat >try.c <<EOP
11235 #$i_unistd I_UNISTD
11236 #include <sys/types.h>
11237 #ifdef I_UNISTD
11238 #  include <unistd.h>
11239 #endif
11240 #$i_stdlib I_STDLIB
11241 #ifdef I_STDLIB
11242 #include <stdlib.h>
11243 #endif
11244 int main()
11245 {
11246         if (getuid() == 0) {
11247                 printf("(I see you are running Configure as super-user...)\n");
11248                 setuid(1);
11249         }
11250 #ifdef TRY_BSD_PGRP
11251         if (-1 == setpgrp(1, 1))
11252                 exit(0);
11253 #else
11254         if (setpgrp() != -1)
11255                 exit(0);
11256 #endif
11257         exit(1);
11258 }
11259 EOP
11260         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11261                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11262                 val="$define"
11263         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11264                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11265                 val="$undef"
11266         else
11267                 echo "(I can't seem to compile and run the test program.)"
11268                 if ./usg; then
11269                         xxx="a USG one, i.e. you use setpgrp()."
11270                 else
11271                         # SVR4 systems can appear rather BSD-ish.
11272                         case "$i_unistd" in
11273                         $undef)
11274                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11275                                 val="$define"
11276                                 ;;
11277                         $define)
11278                                 xxx="probably a USG one, i.e. you use setpgrp()."
11279                                 val="$undef"
11280                                 ;;
11281                         esac
11282                 fi
11283                 echo "Assuming your setpgrp is $xxx" >&4
11284         fi
11285         ;;
11286 *) val="$undef";;
11287 esac
11288 set d_bsdsetpgrp
11289 eval $setvar
11290 $rm_try
11291
11292 : Look for GCC-style __builtin_choose_expr
11293 case "$d_builtin_choose_expr" in
11294 '')
11295     echo " "
11296     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11297     $cat >try.c <<'EOCP'
11298 #include <assert.h>
11299 #include <stdlib.h>
11300 #include <stdio.h>
11301
11302 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11303
11304 int main(void) {
11305     assert( SYRINX(1) == 2112 );
11306     assert( SYRINX(1) != 5150 );
11307     assert( SYRINX(0) == 5150 );
11308     assert( SYRINX(0) != 2112 );
11309     puts( "All good!" );
11310     exit(0);
11311 }
11312
11313 EOCP
11314     set try
11315     if eval $compile && $run ./try; then
11316         echo "Your C compiler supports __builtin_choose_expr."
11317         val="$define"
11318     else
11319         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11320         val="$undef"
11321     fi
11322 ;;
11323 *) val="$d_builtin_choose_expr" ;;
11324 esac
11325
11326 set d_builtin_choose_expr
11327 eval $setvar
11328 $rm_try
11329
11330 : Look for GCC-style __builtin_expect
11331 case "$d_builtin_expect" in
11332 '')
11333     echo " "
11334     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11335     $cat >try.c <<'EOCP'
11336 int main(void) {
11337     int n = 50;
11338     if ( __builtin_expect(n, 0) ) n = 1;
11339     /* Remember shell exit code truth is 0, C truth is non-zero */
11340     return !(n == 1);
11341 }
11342 EOCP
11343     set try
11344     if eval $compile && $run ./try; then
11345         echo "Your C compiler supports __builtin_expect."
11346         val="$define"
11347     else
11348         echo "Your C compiler doesn't seem to understand __builtin_expect."
11349         val="$undef"
11350     fi
11351     ;;
11352 *) val="$d_builtin_expect" ;;
11353 esac
11354
11355 set d_builtin_expect
11356 eval $setvar
11357 $rm_try
11358
11359 : see if bzero exists
11360 set bzero d_bzero
11361 eval $inlibc
11362
11363 : see if stdarg is available
11364 echo " "
11365 if $test `./findhdr stdarg.h`; then
11366         echo "<stdarg.h> found." >&4
11367         valstd="$define"
11368 else
11369         echo "<stdarg.h> NOT found." >&4
11370         valstd="$undef"
11371 fi
11372
11373 : see if varargs is available
11374 echo " "
11375 if $test `./findhdr varargs.h`; then
11376         echo "<varargs.h> found." >&4
11377 else
11378         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11379 fi
11380
11381 : set up the varargs testing programs
11382 $cat > varargs.c <<EOP
11383 #ifdef I_STDARG
11384 #include <stdarg.h>
11385 #endif
11386 #ifdef I_VARARGS
11387 #include <varargs.h>
11388 #endif
11389
11390 #ifdef I_STDARG
11391 int f(char *p, ...)
11392 #else
11393 int f(va_alist)
11394 va_dcl
11395 #endif
11396 {
11397         va_list ap;
11398 #ifndef I_STDARG
11399         char *p;
11400 #endif
11401 #ifdef I_STDARG
11402         va_start(ap,p);
11403 #else
11404         va_start(ap);
11405         p = va_arg(ap, char *);
11406 #endif
11407         va_end(ap);
11408         return 0;
11409 }
11410 EOP
11411 $cat > varargs <<EOP
11412 $startsh
11413 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11414         echo "true"
11415 else
11416         echo "false"
11417 fi
11418 $rm -f varargs$_o
11419 EOP
11420 chmod +x varargs
11421
11422 : now check which varargs header should be included
11423 echo " "
11424 i_varhdr=''
11425 val=''
11426 case "$valstd" in
11427 "$define")
11428         if `./varargs I_STDARG`; then
11429                 val='stdarg.h'
11430         elif `./varargs I_VARARGS`; then
11431                 val='varargs.h'
11432         fi
11433         ;;
11434 *)
11435         if `./varargs I_VARARGS`; then
11436                 val='varargs.h'
11437         fi
11438         ;;
11439 esac
11440 case "$val" in
11441 '')
11442         echo " "
11443         echo "*** WHOA THERE!!! ***" >&4
11444         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
11445         case "$knowitall" in
11446         '')
11447         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
11448                 exit 1
11449                 ;;
11450         esac
11451 echo "I could not find the definition for va_dcl... You have problems..." >&4
11452         val="$undef"; set i_stdarg; eval $setvar
11453         val="$undef"; set i_varargs; eval $setvar
11454         ;;
11455 *)
11456         set i_varhdr
11457         eval $setvar
11458         case "$i_varhdr" in
11459         stdarg.h)
11460                 val="$define"; set i_stdarg; eval $setvar
11461                 val="$undef"; set i_varargs; eval $setvar
11462                 ;;
11463         varargs.h)
11464                 val="$undef"; set i_stdarg; eval $setvar
11465                 val="$define"; set i_varargs; eval $setvar
11466                 ;;
11467         esac
11468         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11469 esac
11470 $rm -f varargs*
11471
11472 : see if the Compiler supports C99 variadic macros
11473 case "$i_stdarg$i_stdlib" in
11474     "$define$define")
11475     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11476     $cat >try.c <<EOCP
11477 #include <stdio.h>
11478 #include <stdarg.h>
11479
11480 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11481
11482 int main() {
11483   char buf[20];
11484   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11485   puts(buf);
11486   return 0;
11487 }
11488 EOCP
11489     set try
11490     if eval $compile && $run ./try 2>&1 >/dev/null; then
11491         case "`$run ./try`" in
11492             "123 456 789")
11493             echo "You have C99 variadic macros." >&4
11494             d_c99_variadic_macros="$define"
11495             ;;
11496             *)
11497             echo "You don't have functional C99 variadic macros." >&4
11498             d_c99_variadic_macros="$undef"
11499             ;;
11500         esac
11501     else
11502         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11503         d_c99_variadic_macros="$undef"
11504     fi
11505     $rm_try
11506     ;;
11507     *)
11508     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11509     d_c99_variadic_macros="$undef"
11510     ;;
11511 esac
11512
11513 : see if signal is declared as pointer to function returning int or void
11514 echo " "
11515 xxx=`./findhdr signal.h`
11516 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11517 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11518         echo "You have int (*signal())() instead of void." >&4
11519         val="$undef"
11520 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11521         echo "You have void (*signal())()." >&4
11522         val="$define"
11523 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11524         echo "You have int (*signal())() instead of void." >&4
11525         val="$undef"
11526 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11527         echo "You have void (*signal())()." >&4
11528         val="$define"
11529 else
11530         case "$d_voidsig" in
11531         '')
11532         echo "I can't determine whether signal handler returns void or int..." >&4
11533                 dflt=void
11534                 rp="What type does your signal handler return?"
11535                 . ./myread
11536                 case "$ans" in
11537                 v*) val="$define";;
11538                 *) val="$undef";;
11539                 esac;;
11540         "$define")
11541                 echo "As you already told me, signal handler returns void." >&4
11542                 val="$define"
11543                 ;;
11544         *)      echo "As you already told me, signal handler returns int." >&4
11545                 val="$undef"
11546                 ;;
11547         esac
11548 fi
11549 set d_voidsig
11550 eval $setvar
11551 case "$d_voidsig" in
11552 "$define") signal_t="void";;
11553 *) signal_t="int";;
11554 esac
11555 $rm -f $$.tmp
11556
11557 : check for ability to cast large floats to 32-bit ints.
11558 echo " "
11559 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11560 if $test "$intsize" -ge 4; then
11561         xxx=int
11562 else
11563         xxx=long
11564 fi
11565 $cat >try.c <<EOCP
11566 #include <stdio.h>
11567 #$i_stdlib I_STDLIB
11568 #ifdef I_STDLIB
11569 #include <stdlib.h>
11570 #endif
11571 #include <sys/types.h>
11572 #include <signal.h>
11573 $signal_t blech(int s) { exit(3); }
11574 int main()
11575 {
11576         $xxx i32;
11577         double f, g;
11578         int result = 0;
11579         char str[16];
11580         signal(SIGFPE, blech);
11581
11582         /* Don't let compiler optimize the test away.  Store the number
11583            in a writable string for gcc to pass to sscanf under HP-UX.
11584         */
11585         sprintf(str, "2147483647");
11586         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11587         g = 10 * f;
11588         i32  = ($xxx) g;
11589
11590         /* x86 processors will probably give 0x8000 0000, which is a
11591            sign change.  We don't want that.  We want to mimic SPARC
11592            behavior here, which is to preserve the sign and give
11593            back 0x7fff ffff.
11594         */
11595         if (i32 != ($xxx) f)
11596                 result |= 1;
11597         exit(result);
11598 }
11599 EOCP
11600 set try
11601 if eval $compile_ok; then
11602         $run ./try 2>/dev/null
11603         yyy=$?
11604 else
11605         echo "(I can't seem to compile the test program--assuming it can't)"
11606         yyy=1
11607 fi
11608 case "$yyy" in
11609 0)      val="$define"
11610         echo "Yup, it can."
11611         ;;
11612 *)      val="$undef"
11613         echo "Nope, it can't."
11614         ;;
11615 esac
11616 set d_casti32
11617 eval $setvar
11618 $rm_try
11619
11620 : check for ability to cast negative floats to unsigned
11621 echo " "
11622 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11623 $cat >try.c <<EOCP
11624 #include <stdio.h>
11625 #$i_stdlib I_STDLIB
11626 #ifdef I_STDLIB
11627 #include <stdlib.h>
11628 #endif
11629 #include <sys/types.h>
11630 #include <signal.h>
11631 $signal_t blech(int s) { exit(7); }
11632 $signal_t blech_in_list(int s) { exit(4); }
11633 unsigned long dummy_long(unsigned long p) { return p; }
11634 unsigned int dummy_int(unsigned int p) { return p; }
11635 unsigned short dummy_short(unsigned short p) { return p; }
11636 int main()
11637 {
11638         double f;
11639         unsigned long along;
11640         unsigned int aint;
11641         unsigned short ashort;
11642         int result = 0;
11643         char str[16];
11644
11645         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11646            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11647            optimized the whole file away
11648         */
11649         /* Store the number in a writable string for gcc to pass to
11650            sscanf under HP-UX.
11651         */
11652         sprintf(str, "-123");
11653         sscanf(str, "%lf", &f);  /* f = -123.; */
11654
11655         signal(SIGFPE, blech);
11656         along = (unsigned long)f;
11657         aint = (unsigned int)f;
11658         ashort = (unsigned short)f;
11659         if (along != (unsigned long)-123)
11660                 result |= 1;
11661         if (aint != (unsigned int)-123)
11662                 result |= 1;
11663         if (ashort != (unsigned short)-123)
11664                 result |= 1;
11665         sprintf(str, "1073741824.");
11666         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11667         f = f + f;
11668         along = 0;
11669         along = (unsigned long)f;
11670         if (along != 0x80000000)
11671                 result |= 2;
11672         f -= 1.;
11673         along = 0;
11674         along = (unsigned long)f;
11675         if (along != 0x7fffffff)
11676                 result |= 1;
11677         f += 2.;
11678         along = 0;
11679         along = (unsigned long)f;
11680         if (along != 0x80000001)
11681                 result |= 2;
11682         if (result)
11683                 exit(result);
11684         signal(SIGFPE, blech_in_list);
11685         sprintf(str, "123.");
11686         sscanf(str, "%lf", &f);  /* f = 123.; */
11687         along = dummy_long((unsigned long)f);
11688         aint = dummy_int((unsigned int)f);
11689         ashort = dummy_short((unsigned short)f);
11690         if (along != (unsigned long)123)
11691                 result |= 4;
11692         if (aint != (unsigned int)123)
11693                 result |= 4;
11694         if (ashort != (unsigned short)123)
11695                 result |= 4;
11696         exit(result);
11697
11698 }
11699 EOCP
11700 set try
11701 if eval $compile_ok; then
11702         $run ./try 2>/dev/null
11703         castflags=$?
11704 else
11705         echo "(I can't seem to compile the test program--assuming it can't)"
11706         castflags=7
11707 fi
11708 case "$castflags" in
11709 0)      val="$define"
11710         echo "Yup, it can."
11711         ;;
11712 *)      val="$undef"
11713         echo "Nope, it can't."
11714         ;;
11715 esac
11716 set d_castneg
11717 eval $setvar
11718 $rm_try
11719
11720 : see if cbrt exists
11721 set cbrt d_cbrt
11722 eval $inlibc
11723
11724 : see if vprintf exists
11725 echo " "
11726 if set vprintf val -f d_vprintf; eval $csym; $val; then
11727         echo 'vprintf() found.' >&4
11728         val="$define"
11729         $cat >try.c <<EOF
11730 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11731 #$i_varargs I_VARARGS
11732
11733 #$i_stdlib I_STDLIB
11734 #$i_unistd I_UNISTD
11735
11736 #ifdef I_STDARG
11737 #  include <stdarg.h>
11738 #else /* I_VARARGS */
11739 #  include <varargs.h>
11740 #endif
11741
11742 #ifdef I_UNISTD
11743 #  include <unistd.h>
11744 #endif
11745
11746 #ifdef I_STDLIB
11747 #  include <stdlib.h>
11748 #endif
11749
11750 #include <stdio.h> /* vsprintf prototype */
11751
11752 #ifdef I_STDARG
11753 void xxx(int n, ...)
11754 {
11755     va_list args;
11756     char buf[10];
11757     va_start(args, n);
11758     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11759 }
11760 int main() { xxx(1, "foo"); }
11761
11762 #else /* I_VARARGS */
11763
11764 xxx(va_alist)
11765 va_dcl
11766 {
11767     va_list args;
11768     char buf[10];
11769     va_start(args);
11770     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11771 }
11772 int main() { xxx("foo"); }
11773
11774 #endif
11775
11776 EOF
11777         set try
11778         if eval $compile_ok; then
11779                 if $run ./try; then
11780                         echo "Your vsprintf() returns (int)." >&4
11781                         val2="$undef"
11782                 else
11783                         echo "Your vsprintf() returns (char*)." >&4
11784                         val2="$define"
11785                 fi
11786         else
11787                 echo 'I am unable to compile the vsprintf() test program.' >&4
11788                 # We shouldn't get here.  If we do, assume the standard signature,
11789                 # not the old BSD one.
11790                 echo 'Guessing that vsprintf() returns (int).' >&4
11791                 val2="$undef"
11792         fi
11793 else
11794         echo 'vprintf() NOT found.' >&4
11795         val="$undef"
11796         val2="$undef"
11797 fi
11798 $rm_try
11799 set d_vprintf
11800 eval $setvar
11801 val=$val2
11802 set d_charvspr
11803 eval $setvar
11804
11805 : see if chown exists
11806 set chown d_chown
11807 eval $inlibc
11808
11809 : see if chroot exists
11810 set chroot d_chroot
11811 eval $inlibc
11812
11813 : see if chsize exists
11814 set chsize d_chsize
11815 eval $inlibc
11816
11817 : see if class exists
11818 set class d_class
11819 eval $inlibc
11820
11821 : see if clearenv exists
11822 set clearenv d_clearenv
11823 eval $inlibc
11824
11825 : Define hasstruct macro for Configure internal use
11826 hasstruct='varname=$1; struct=$2; shift; shift;
11827 while $test $# -ge 2; do
11828         case "$1" in
11829         $define) echo "#include <$2>";;
11830         esac ;
11831     shift 2;
11832 done > try.c;
11833 echo "int main () { struct $struct foo; }" >> try.c;
11834 set try;
11835 if eval $compile; then
11836         val="$define";
11837 else
11838         val="$undef";
11839 fi;
11840 set $varname;
11841 eval $setvar;
11842 $rm_try'
11843
11844 : see whether socket exists
11845 socketlib=''
11846 sockethdr=''
11847 echo " "
11848 $echo $n "Hmm... $c" >&4
11849 if set socket val -f d_socket; eval $csym; $val; then
11850     echo "Looks like you have Berkeley networking support." >&4
11851     d_socket="$define"
11852     if set setsockopt val -f; eval $csym; $val; then
11853         d_oldsock="$undef"
11854     else
11855         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11856         d_oldsock="$define"
11857     fi
11858 else
11859     if $contains socklib libc.list >/dev/null 2>&1; then
11860         echo "Looks like you have Berkeley networking support." >&4
11861         d_socket="$define"
11862         : we will have to assume that it supports the 4.2 BSD interface
11863         d_oldsock="$undef"
11864     else
11865         echo "You don't have Berkeley networking in libc$_a..." >&4
11866         if test "X$d_socket" = "X$define"; then
11867             echo "...but you seem to believe that you have sockets." >&4
11868         else
11869             for net in net socket
11870             do
11871                 if test -f $sysroot/usr/lib/lib$net$_a; then
11872                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11873                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11874                     if $contains socket libc.list >/dev/null 2>&1; then
11875                         d_socket="$define"
11876                         socketlib="-l$net"
11877                         case "$net" in
11878                         net)
11879                             echo "...but the Wollongong group seems to have hacked it in." >&4
11880                             sockethdr="-I$sysroot/usr/netinclude"
11881                             ;;
11882                         esac
11883                         echo "Found Berkeley sockets interface in lib$net." >&4
11884                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11885                             d_oldsock="$undef"
11886                         else
11887                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11888                             d_oldsock="$define"
11889                         fi
11890                         break
11891                     fi
11892                 fi
11893             done
11894             if test "X$d_socket" != "X$define"; then
11895                echo "or anywhere else I see." >&4
11896                d_socket="$undef"
11897                d_oldsock="$undef"
11898             fi
11899         fi
11900     fi
11901 fi
11902
11903 : see if socketpair exists
11904 set socketpair d_sockpair
11905 eval $inlibc
11906
11907
11908 echo " "
11909 echo "Checking the availability sa_len in the sock struct ..." >&4
11910 $cat >try.c <<EOF
11911 #include <sys/types.h>
11912 #include <sys/socket.h>
11913 int main() {
11914 struct sockaddr sa;
11915 return (sa.sa_len);
11916 }
11917 EOF
11918 val="$undef"
11919 set try; if eval $compile; then
11920     val="$define"
11921 fi
11922 set d_sockaddr_sa_len; eval $setvar
11923 $rm_try
11924
11925 echo " "
11926 echo "Checking the availability struct sockaddr_in6 ..." >&4
11927 $cat >try.c <<EOF
11928 #include <sys/types.h>
11929 #include <sys/socket.h>
11930 #include <netinet/in.h>
11931 int main() {
11932 struct sockaddr_in6 sin6;
11933 return (sin6.sin6_family);
11934 }
11935 EOF
11936 val="$undef"
11937 set try; if eval $compile; then
11938     val="$define"
11939 fi
11940 set d_sockaddr_in6; eval $setvar
11941 $rm_try
11942
11943 echo " "
11944 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11945 $cat >try.c <<EOF
11946 #include <sys/types.h>
11947 #include <sys/socket.h>
11948 #include <netinet/in.h>
11949 int main() {
11950 struct sockaddr_in6 sin6;
11951 return (sin6.sin6_scope_id);
11952 }
11953 EOF
11954 val="$undef"
11955 set try; if eval $compile; then
11956     val="$define"
11957 fi
11958 set d_sin6_scope_id; eval $setvar
11959 $rm_try
11960
11961 echo " "
11962 echo "Checking the availability struct ip_mreq ..." >&4
11963 $cat >try.c <<EOF
11964 #include <sys/types.h>
11965 #include <sys/socket.h>
11966 #include <netinet/in.h>
11967 int main() {
11968 struct ip_mreq mreq;
11969 return (mreq.imr_multiaddr.s_addr);
11970 }
11971 EOF
11972 val="$undef"
11973 set try; if eval $compile; then
11974        val="$define"
11975 fi
11976 set d_ip_mreq; eval $setvar
11977 $rm_try
11978
11979 echo " "
11980 echo "Checking the availability struct ip_mreq_source ..." >&4
11981 $cat >try.c <<EOF
11982 #include <sys/types.h>
11983 #include <sys/socket.h>
11984 #include <netinet/in.h>
11985 int main() {
11986 struct ip_mreq_source mreq;
11987 return (mreq.imr_multiaddr.s_addr);
11988 }
11989 EOF
11990 val="$undef"
11991 set try; if eval $compile; then
11992        val="$define"
11993 fi
11994 set d_ip_mreq_source; eval $setvar
11995 $rm_try
11996
11997 echo " "
11998 echo "Checking the availability struct ipv6_mreq ..." >&4
11999 $cat >try.c <<EOF
12000 #include <sys/types.h>
12001 #include <sys/socket.h>
12002 #include <netinet/in.h>
12003 int main() {
12004 struct ipv6_mreq mreq;
12005 return (mreq.ipv6mr_interface);
12006 }
12007 EOF
12008 val="$undef"
12009 set try; if eval $compile; then
12010     val="$define"
12011 fi
12012 set d_ipv6_mreq; eval $setvar
12013 $rm_try
12014
12015 echo " "
12016 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12017 $cat >try.c <<EOF
12018 #include <sys/types.h>
12019 #include <sys/socket.h>
12020 #include <netinet/in.h>
12021 int main() {
12022 struct ipv6_mreq_source mreq;
12023 return (mreq.imr_multiaddr.s_addr);
12024 }
12025 EOF
12026 val="$undef"
12027 set try; if eval $compile; then
12028        val="$define"
12029 fi
12030 set d_ipv6_mreq_source; eval $setvar
12031 $rm_try
12032
12033 echo " "
12034 echo "Checking the availability of certain socket constants..." >&4
12035 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12036     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12037     $cat >try.c <<EOF
12038 #include <sys/types.h>
12039 #include <sys/socket.h>
12040 int main() {
12041     int i = $ENUM;
12042 }
12043 EOF
12044     val="$undef"
12045     set try; if eval $compile; then
12046         val="$define"
12047     fi
12048     set d_${enum}; eval $setvar
12049     $rm_try
12050 done
12051
12052 : see if this is a sys/uio.h system
12053 set sys/uio.h i_sysuio
12054 eval $inhdr
12055
12056 : Check for cmsghdr support
12057 echo " "
12058 echo "Checking to see if your system supports struct cmsghdr..." >&4
12059 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12060 eval $hasstruct
12061 case "$d_cmsghdr_s" in
12062 "$define")      echo "Yes, it does."   ;;
12063 *)              echo "No, it doesn't." ;;
12064 esac
12065
12066
12067 : check for const keyword
12068 echo " "
12069 echo 'Checking to see if your C compiler knows about "const"...' >&4
12070 $cat >const.c <<'EOCP'
12071 typedef struct spug { int drokk; } spug;
12072 int main()
12073 {
12074         const char *foo;
12075         const spug y = { 0 };
12076 }
12077 EOCP
12078 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
12079         val="$define"
12080         echo "Yup, it does."
12081 else
12082         val="$undef"
12083         echo "Nope, it doesn't."
12084 fi
12085 set d_const
12086 eval $setvar
12087
12088 : see if copysign exists
12089 set copysign d_copysign
12090 eval $inlibc
12091
12092 : see if copysignl exists
12093 set copysignl d_copysignl
12094 eval $inlibc
12095
12096 : see if crypt exists
12097 echo " "
12098 set crypt d_crypt
12099 eval $inlibc
12100 case "$d_crypt" in
12101 $define) cryptlib='' ;;
12102 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12103                 echo 'crypt() found.' >&4
12104                 val="$define"
12105                 cryptlib=''
12106         else
12107                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12108                 if $test -z "$cryptlib"; then
12109                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12110                 else
12111                         cryptlib=-lcrypt
12112                 fi
12113                 if $test -z "$cryptlib"; then
12114                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12115                 else
12116                         cryptlib=-lcrypt
12117                 fi
12118                 if $test -z "$cryptlib"; then
12119                         cryptlib=`./loc libcrypt$_a "" $libpth`
12120                 else
12121                         cryptlib=-lcrypt
12122                 fi
12123                 if $test -z "$cryptlib"; then
12124                         echo 'crypt() NOT found.' >&4
12125                         val="$undef"
12126                 else
12127                         val="$define"
12128                 fi
12129         fi
12130         set d_crypt
12131         eval $setvar
12132         ;;
12133 esac
12134
12135 : see if this is a crypt.h system
12136 set crypt.h i_crypt
12137 eval $inhdr
12138
12139 : see if crypt_r exists
12140 set crypt_r d_crypt_r
12141 eval $inlibc
12142 case "$d_crypt_r" in
12143 "$define")
12144         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12145         case "$d_crypt_r_proto:$usethreads" in
12146         ":define")      d_crypt_r_proto=define
12147                 set d_crypt_r_proto crypt_r $hdrs
12148                 eval $hasproto ;;
12149         *)      ;;
12150         esac
12151         case "$d_crypt_r_proto" in
12152         define)
12153         case "$crypt_r_proto" in
12154         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12155         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12156         esac
12157         case "$crypt_r_proto" in
12158         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12159         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12160         esac
12161         case "$crypt_r_proto" in
12162         ''|0)   d_crypt_r=undef
12163                 crypt_r_proto=0
12164                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12165         * )     case "$crypt_r_proto" in
12166                 REENTRANT_PROTO*) ;;
12167                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12168                 esac
12169                 echo "Prototype: $try" ;;
12170         esac
12171         ;;
12172         *)      case "$usethreads" in
12173                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12174                 esac
12175                 d_crypt_r=undef
12176                 crypt_r_proto=0
12177                 ;;
12178         esac
12179         ;;
12180 *)      crypt_r_proto=0
12181         ;;
12182 esac
12183
12184 : get csh whereabouts
12185 case "$csh" in
12186 'csh') val="$undef" ;;
12187 *) val="$define" ;;
12188 esac
12189 set d_csh
12190 eval $setvar
12191 : Respect a hint or command line value for full_csh.
12192 case "$full_csh" in
12193 '') full_csh=$csh ;;
12194 esac
12195
12196 : see if ctermid exists
12197 set ctermid d_ctermid
12198 eval $inlibc
12199
12200 : see if ctermid_r exists
12201 set ctermid_r d_ctermid_r
12202 eval $inlibc
12203 case "$d_ctermid_r" in
12204 "$define")
12205         hdrs="$i_systypes sys/types.h define stdio.h "
12206         case "$d_ctermid_r_proto:$usethreads" in
12207         ":define")      d_ctermid_r_proto=define
12208                 set d_ctermid_r_proto ctermid_r $hdrs
12209                 eval $hasproto ;;
12210         *)      ;;
12211         esac
12212         case "$d_ctermid_r_proto" in
12213         define)
12214         case "$ctermid_r_proto" in
12215         ''|0) try='char* ctermid_r(char*);'
12216         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12217         esac
12218         case "$ctermid_r_proto" in
12219         ''|0)   d_ctermid_r=undef
12220                 ctermid_r_proto=0
12221                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12222         * )     case "$ctermid_r_proto" in
12223                 REENTRANT_PROTO*) ;;
12224                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12225                 esac
12226                 echo "Prototype: $try" ;;
12227         esac
12228         ;;
12229         *)      case "$usethreads" in
12230                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12231                 esac
12232                 d_ctermid_r=undef
12233                 ctermid_r_proto=0
12234                 ;;
12235         esac
12236         ;;
12237 *)      ctermid_r_proto=0
12238         ;;
12239 esac
12240
12241 : see if ctime_r exists
12242 set ctime_r d_ctime_r
12243 eval $inlibc
12244 case "$d_ctime_r" in
12245 "$define")
12246         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12247         case "$d_ctime_r_proto:$usethreads" in
12248         ":define")      d_ctime_r_proto=define
12249                 set d_ctime_r_proto ctime_r $hdrs
12250                 eval $hasproto ;;
12251         *)      ;;
12252         esac
12253         case "$d_ctime_r_proto" in
12254         define)
12255         case "$ctime_r_proto" in
12256         ''|0) try='char* ctime_r(const time_t*, char*);'
12257         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12258         esac
12259         case "$ctime_r_proto" in
12260         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12261         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12262         esac
12263         case "$ctime_r_proto" in
12264         ''|0) try='int ctime_r(const time_t*, char*);'
12265         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12266         esac
12267         case "$ctime_r_proto" in
12268         ''|0) try='int ctime_r(const time_t*, char*, int);'
12269         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12270         esac
12271         case "$ctime_r_proto" in
12272         ''|0)   d_ctime_r=undef
12273                 ctime_r_proto=0
12274                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12275         * )     case "$ctime_r_proto" in
12276                 REENTRANT_PROTO*) ;;
12277                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12278                 esac
12279                 echo "Prototype: $try" ;;
12280         esac
12281         ;;
12282         *)      case "$usethreads" in
12283                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12284                 esac
12285                 d_ctime_r=undef
12286                 ctime_r_proto=0
12287                 ;;
12288         esac
12289         ;;
12290 *)      ctime_r_proto=0
12291         ;;
12292 esac
12293
12294 : see if cuserid exists
12295 set cuserid d_cuserid
12296 eval $inlibc
12297
12298 : see if this is a limits.h system
12299 set limits.h i_limits
12300 eval $inhdr
12301
12302 : See if number of significant digits in a double precision number is known
12303 echo " "
12304 $cat >dbl_dig.c <<EOM
12305 #$i_limits I_LIMITS
12306 #$i_float I_FLOAT
12307 #ifdef I_LIMITS
12308 #include <limits.h>
12309 #endif
12310 #ifdef I_FLOAT
12311 #include <float.h>
12312 #endif
12313 #ifdef DBL_DIG
12314 printf("Contains DBL_DIG");
12315 #endif
12316 EOM
12317 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
12318 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
12319         echo "DBL_DIG found." >&4
12320         val="$define"
12321 else
12322         echo "DBL_DIG NOT found." >&4
12323         val="$undef"
12324 fi
12325 $rm -f dbl_dig.?
12326 set d_dbl_dig
12327 eval $setvar
12328
12329 : see if dbm.h is available
12330 : see if dbmclose exists
12331 set dbmclose d_dbmclose
12332 eval $inlibc
12333
12334 case "$d_dbmclose" in
12335 $define)
12336         set dbm.h i_dbm
12337         eval $inhdr
12338         case "$i_dbm" in
12339         $define)
12340                 val="$undef"
12341                 set i_rpcsvcdbm
12342                 eval $setvar
12343                 ;;
12344         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12345                 eval $inhdr
12346                 ;;
12347         esac
12348         ;;
12349 *)      echo "We won't be including <dbm.h>"
12350         val="$undef"
12351         set i_dbm
12352         eval $setvar
12353         val="$undef"
12354         set i_rpcsvcdbm
12355         eval $setvar
12356         ;;
12357 esac
12358
12359 : see if prototype for dbminit is available
12360 echo " "
12361 set d_dbminitproto dbminit $i_dbm dbm.h
12362 eval $hasproto
12363
12364 : see if difftime exists
12365 set difftime d_difftime
12366 eval $inlibc
12367
12368 : see if this is a dirent system
12369 echo " "
12370 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12371         val="$define"
12372         echo "<dirent.h> found." >&4
12373 else
12374         val="$undef"
12375         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12376                 echo "<sys/dir.h> found." >&4
12377                 echo " "
12378         else
12379                 xinc=`./findhdr sys/ndir.h`
12380         fi
12381         echo "<dirent.h> NOT found." >&4
12382 fi
12383 set i_dirent
12384 eval $setvar
12385
12386 : Look for type of directory structure.
12387 echo " "
12388 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12389
12390 case "$direntrytype" in
12391 ''|' ')
12392         case "$i_dirent" in
12393         $define) guess1='struct dirent' ;;
12394         *) guess1='struct direct'  ;;
12395         esac
12396         ;;
12397 *)      guess1="$direntrytype"
12398         ;;
12399 esac
12400
12401 case "$guess1" in
12402 'struct dirent') guess2='struct direct' ;;
12403 *) guess2='struct dirent' ;;
12404 esac
12405
12406 if $contains "$guess1" try.c >/dev/null 2>&1; then
12407         direntrytype="$guess1"
12408         echo "Your directory entries are $direntrytype." >&4
12409 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12410         direntrytype="$guess2"
12411         echo "Your directory entries seem to be $direntrytype." >&4
12412 else
12413         echo "I don't recognize your system's directory entries." >&4
12414         rp="What type is used for directory entries on this system?"
12415         dflt="$guess1"
12416         . ./myread
12417         direntrytype="$ans"
12418 fi
12419 $rm_try
12420
12421 : see if the directory entry stores field length
12422 echo " "
12423 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12424 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12425         echo "Good, your directory entry keeps length information in d_namlen." >&4
12426         val="$define"
12427 else
12428         echo "Your directory entry does not know about the d_namlen field." >&4
12429         val="$undef"
12430 fi
12431 set d_dirnamlen
12432 eval $setvar
12433 $rm_try
12434
12435 : Look for DIR.dd_fd
12436 case "$i_dirent" in
12437 "$define")
12438     echo "Checking to see if DIR has a dd_fd member variable" >&4
12439     $cat >try.c <<EOCP
12440 #$i_stdlib I_STDLIB
12441 #ifdef I_STDLIB
12442 #include <stdlib.h>
12443 #endif
12444 #include <dirent.h>
12445
12446 int main() {
12447     DIR dir;
12448     dir.dd_fd = 1;
12449     return 0;
12450 }
12451 EOCP
12452     val=$undef
12453     set try
12454     if eval $compile; then
12455         echo "Yes, it does."
12456         val="$define"
12457     else
12458         echo "No, it does not."
12459         val="$undef"
12460     fi
12461     ;;
12462 *)
12463     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12464     val="$undef"
12465     ;;
12466 esac
12467 set d_dir_dd_fd
12468 eval $setvar
12469 $rm_try
12470
12471 : see if this is an sysdir system
12472 set sys/dir.h i_sysdir
12473 eval $inhdr
12474
12475 : see if this is an sysndir system
12476 set sys/ndir.h i_sysndir
12477 eval $inhdr
12478
12479 : Look for dirfd
12480 echo " "
12481 $cat >dirfd.c <<EOM
12482 #include <stdio.h>
12483 #$i_stdlib I_STDLIB
12484 #ifdef I_STDLIB
12485 #include <stdlib.h>
12486 #endif
12487 #$i_dirent I_DIRENT             /**/
12488 #$i_sysdir I_SYS_DIR            /**/
12489 #$i_sysndir I_SYS_NDIR          /**/
12490 #$i_systypes I_SYS_TYPES        /**/
12491 #if defined(I_SYS_TYPES)
12492 #include <sys/types.h>
12493 #endif
12494 #if defined(I_DIRENT)
12495 #include <dirent.h>
12496 #else
12497 #ifdef I_SYS_NDIR
12498 #include <sys/ndir.h>
12499 #else
12500 #ifdef I_SYS_DIR
12501 #ifdef hp9000s500
12502 #include <ndir.h>       /* may be wrong in the future */
12503 #else
12504 #include <sys/dir.h>
12505 #endif
12506 #endif
12507 #endif
12508 #endif
12509 int main() {
12510         DIR *dirp = opendir(".");
12511         if (dirfd(dirp) >= 0)
12512                 exit(0);
12513         else
12514                 exit(1);
12515 }
12516 EOM
12517 val=$undef
12518 set dirfd
12519 if eval $compile; then
12520         val="$define"
12521 fi
12522 case "$val" in
12523 $define)        echo "dirfd() found." >&4       ;;
12524 *)              echo "dirfd() NOT found." >&4   ;;
12525 esac
12526 set d_dirfd
12527 eval $setvar
12528 $rm -f dirfd*
12529
12530 : see if dladdr exists
12531 set dladdr d_dladdr
12532 eval $inlibc
12533
12534 : see if dlerror exists
12535 xxx_runnm="$runnm"
12536 runnm=false
12537 set dlerror d_dlerror
12538 eval $inlibc
12539 runnm="$xxx_runnm"
12540
12541 : see if dlfcn is available
12542 set dlfcn.h i_dlfcn
12543 eval $inhdr
12544
12545 : Check what extension to use for shared libs
12546 case "$usedl" in
12547 $define|y|true)
12548         $cat << EOM
12549
12550 On a few systems, the dynamically loaded modules that perl generates and uses
12551 will need a different extension than shared libs. The default will probably
12552 be appropriate.
12553
12554 EOM
12555         case "$dlext" in
12556         '')     dflt="$so" ;;
12557         *)      dflt="$dlext" ;;
12558         esac
12559         rp='What is the extension of dynamically loaded modules'
12560         . ./myread
12561         dlext="$ans"
12562         ;;
12563 *)
12564         dlext="none"
12565         ;;
12566 esac
12567
12568 : Check if dlsym need a leading underscore
12569 echo " "
12570 val="$undef"
12571
12572 case "$dlsrc" in
12573 dl_dlopen.xs)
12574         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12575         $cat >dyna.c <<'EOM'
12576 fred () { }
12577 EOM
12578
12579 $cat >fred.c<<EOM
12580
12581 #include <stdio.h>
12582 #$i_stdlib I_STDLIB
12583 #ifdef I_STDLIB
12584 #include <stdlib.h>
12585 #endif
12586 #$i_dlfcn I_DLFCN
12587 #ifdef I_DLFCN
12588 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12589 #else
12590 #include <sys/types.h>
12591 #include <nlist.h>
12592 #include <link.h>
12593 #endif
12594
12595 extern int fred() ;
12596
12597 int main()
12598 {
12599     void * handle ;
12600     void * symbol ;
12601 #ifndef RTLD_LAZY
12602     int mode = 1 ;
12603 #else
12604     int mode = RTLD_LAZY ;
12605 #endif
12606     handle = dlopen("./dyna.$dlext", mode) ;
12607     if (handle == NULL) {
12608         printf ("1\n") ;
12609         fflush (stdout) ;
12610         exit(0);
12611     }
12612     symbol = dlsym(handle, "fred") ;
12613     if (symbol == NULL) {
12614         /* try putting a leading underscore */
12615         symbol = dlsym(handle, "_fred") ;
12616         if (symbol == NULL) {
12617             printf ("2\n") ;
12618             fflush (stdout) ;
12619             exit(0);
12620         }
12621         printf ("3\n") ;
12622     }
12623     else
12624         printf ("4\n") ;
12625     fflush (stdout) ;
12626     exit(0);
12627 }
12628 EOM
12629         : Call the object file tmp-dyna.o in case dlext=o.
12630         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12631                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12632                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12633                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12634                 xxx=`$run ./fred`
12635                 case $xxx in
12636                 1)      echo "Test program failed using dlopen." >&4
12637                         echo "Perhaps you should not use dynamic loading." >&4;;
12638                 2)      echo "Test program failed using dlsym." >&4
12639                         echo "Perhaps you should not use dynamic loading." >&4;;
12640                 3)      echo "dlsym needs a leading underscore" >&4
12641                         val="$define" ;;
12642                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12643                 esac
12644         else
12645                 echo "I can't compile and run the test program." >&4
12646                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12647         fi
12648         ;;
12649 esac
12650
12651 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12652
12653 set d_dlsymun
12654 eval $setvar
12655
12656 : see if drand48_r exists
12657 set drand48_r d_drand48_r
12658 eval $inlibc
12659 case "$d_drand48_r" in
12660 "$define")
12661         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12662         case "$d_drand48_r_proto:$usethreads" in
12663         ":define")      d_drand48_r_proto=define
12664                 set d_drand48_r_proto drand48_r $hdrs
12665                 eval $hasproto ;;
12666         *)      ;;
12667         esac
12668         case "$d_drand48_r_proto" in
12669         define)
12670         case "$drand48_r_proto" in
12671         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12672         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12673         esac
12674         case "$drand48_r_proto" in
12675         ''|0)   d_drand48_r=undef
12676                 drand48_r_proto=0
12677                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12678         * )     case "$drand48_r_proto" in
12679                 REENTRANT_PROTO*) ;;
12680                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12681                 esac
12682                 echo "Prototype: $try" ;;
12683         esac
12684         ;;
12685         *)      case "$usethreads" in
12686                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12687                 esac
12688                 d_drand48_r=undef
12689                 drand48_r_proto=0
12690                 ;;
12691         esac
12692         ;;
12693 *)      drand48_r_proto=0
12694         ;;
12695 esac
12696
12697 : see if prototype for drand48 is available
12698 echo " "
12699 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12700 eval $hasproto
12701
12702 : see if dup2 exists
12703 set dup2 d_dup2
12704 eval $inlibc
12705
12706 : see if eaccess exists
12707 set eaccess d_eaccess
12708 eval $inlibc
12709
12710 : see if endgrent exists
12711 set endgrent d_endgrent
12712 eval $inlibc
12713
12714 : see if this is an grp system
12715 set grp.h i_grp
12716 eval $inhdr
12717
12718 case "$i_grp" in
12719 $define)
12720         xxx=`./findhdr grp.h`
12721         $cppstdin $cppflags $cppminus < $xxx >$$.h
12722
12723         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12724                 val="$define"
12725         else
12726                 val="$undef"
12727         fi
12728         set d_grpasswd
12729         eval $setvar
12730
12731         $rm -f $$.h
12732         ;;
12733 *)
12734         val="$undef";
12735         set d_grpasswd; eval $setvar
12736         ;;
12737 esac
12738
12739 : see if endgrent_r exists
12740 set endgrent_r d_endgrent_r
12741 eval $inlibc
12742 case "$d_endgrent_r" in
12743 "$define")
12744         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12745         case "$d_endgrent_r_proto:$usethreads" in
12746         ":define")      d_endgrent_r_proto=define
12747                 set d_endgrent_r_proto endgrent_r $hdrs
12748                 eval $hasproto ;;
12749         *)      ;;
12750         esac
12751         case "$d_endgrent_r_proto" in
12752         define)
12753         case "$endgrent_r_proto" in
12754         ''|0) try='int endgrent_r(FILE**);'
12755         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12756         esac
12757         case "$endgrent_r_proto" in
12758         ''|0) try='void endgrent_r(FILE**);'
12759         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12760         esac
12761         case "$endgrent_r_proto" in
12762         ''|0)   d_endgrent_r=undef
12763                 endgrent_r_proto=0
12764                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12765         * )     case "$endgrent_r_proto" in
12766                 REENTRANT_PROTO*) ;;
12767                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12768                 esac
12769                 echo "Prototype: $try" ;;
12770         esac
12771         ;;
12772         *)      case "$usethreads" in
12773                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12774                 esac
12775                 d_endgrent_r=undef
12776                 endgrent_r_proto=0
12777                 ;;
12778         esac
12779         ;;
12780 *)      endgrent_r_proto=0
12781         ;;
12782 esac
12783
12784 : see if endhostent exists
12785 set endhostent d_endhent
12786 eval $inlibc
12787
12788 : see if this is a netdb.h system
12789 set netdb.h i_netdb
12790 eval $inhdr
12791
12792 : see if endhostent_r exists
12793 set endhostent_r d_endhostent_r
12794 eval $inlibc
12795 case "$d_endhostent_r" in
12796 "$define")
12797         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12798         case "$d_endhostent_r_proto:$usethreads" in
12799         ":define")      d_endhostent_r_proto=define
12800                 set d_endhostent_r_proto endhostent_r $hdrs
12801                 eval $hasproto ;;
12802         *)      ;;
12803         esac
12804         case "$d_endhostent_r_proto" in
12805         define)
12806         case "$endhostent_r_proto" in
12807         ''|0) try='int endhostent_r(struct hostent_data*);'
12808         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12809         esac
12810         case "$endhostent_r_proto" in
12811         ''|0) try='void endhostent_r(struct hostent_data*);'
12812         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12813         esac
12814         case "$endhostent_r_proto" in
12815         ''|0)   d_endhostent_r=undef
12816                 endhostent_r_proto=0
12817                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12818         * )     case "$endhostent_r_proto" in
12819                 REENTRANT_PROTO*) ;;
12820                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12821                 esac
12822                 echo "Prototype: $try" ;;
12823         esac
12824         ;;
12825         *)      case "$usethreads" in
12826                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12827                 esac
12828                 d_endhostent_r=undef
12829                 endhostent_r_proto=0
12830                 ;;
12831         esac
12832         ;;
12833 *)      endhostent_r_proto=0
12834         ;;
12835 esac
12836
12837 : see if endnetent exists
12838 set endnetent d_endnent
12839 eval $inlibc
12840
12841 : see if endnetent_r exists
12842 set endnetent_r d_endnetent_r
12843 eval $inlibc
12844 case "$d_endnetent_r" in
12845 "$define")
12846         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12847         case "$d_endnetent_r_proto:$usethreads" in
12848         ":define")      d_endnetent_r_proto=define
12849                 set d_endnetent_r_proto endnetent_r $hdrs
12850                 eval $hasproto ;;
12851         *)      ;;
12852         esac
12853         case "$d_endnetent_r_proto" in
12854         define)
12855         case "$endnetent_r_proto" in
12856         ''|0) try='int endnetent_r(struct netent_data*);'
12857         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12858         esac
12859         case "$endnetent_r_proto" in
12860         ''|0) try='void endnetent_r(struct netent_data*);'
12861         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12862         esac
12863         case "$endnetent_r_proto" in
12864         ''|0)   d_endnetent_r=undef
12865                 endnetent_r_proto=0
12866                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12867         * )     case "$endnetent_r_proto" in
12868                 REENTRANT_PROTO*) ;;
12869                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12870                 esac
12871                 echo "Prototype: $try" ;;
12872         esac
12873         ;;
12874         *)      case "$usethreads" in
12875                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12876                 esac
12877                 d_endnetent_r=undef
12878                 endnetent_r_proto=0
12879                 ;;
12880         esac
12881         ;;
12882 *)      endnetent_r_proto=0
12883         ;;
12884 esac
12885
12886 : see if endprotoent exists
12887 set endprotoent d_endpent
12888 eval $inlibc
12889
12890 : see if endprotoent_r exists
12891 set endprotoent_r d_endprotoent_r
12892 eval $inlibc
12893 case "$d_endprotoent_r" in
12894 "$define")
12895         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12896         case "$d_endprotoent_r_proto:$usethreads" in
12897         ":define")      d_endprotoent_r_proto=define
12898                 set d_endprotoent_r_proto endprotoent_r $hdrs
12899                 eval $hasproto ;;
12900         *)      ;;
12901         esac
12902         case "$d_endprotoent_r_proto" in
12903         define)
12904         case "$endprotoent_r_proto" in
12905         ''|0) try='int endprotoent_r(struct protoent_data*);'
12906         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12907         esac
12908         case "$endprotoent_r_proto" in
12909         ''|0) try='void endprotoent_r(struct protoent_data*);'
12910         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12911         esac
12912         case "$endprotoent_r_proto" in
12913         ''|0)   d_endprotoent_r=undef
12914                 endprotoent_r_proto=0
12915                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12916         * )     case "$endprotoent_r_proto" in
12917                 REENTRANT_PROTO*) ;;
12918                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12919                 esac
12920                 echo "Prototype: $try" ;;
12921         esac
12922         ;;
12923         *)      case "$usethreads" in
12924                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12925                 esac
12926                 d_endprotoent_r=undef
12927                 endprotoent_r_proto=0
12928                 ;;
12929         esac
12930         ;;
12931 *)      endprotoent_r_proto=0
12932         ;;
12933 esac
12934
12935 : see if endpwent exists
12936 set endpwent d_endpwent
12937 eval $inlibc
12938
12939 : see if this is a pwd.h system
12940 set pwd.h i_pwd
12941 eval $inhdr
12942
12943 case "$i_pwd" in
12944 $define)
12945         xxx=`./findhdr pwd.h`
12946         $cppstdin $cppflags $cppminus < $xxx >$$.h
12947
12948         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12949                 val="$define"
12950         else
12951                 val="$undef"
12952         fi
12953         set d_pwquota
12954         eval $setvar
12955
12956         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12957                 val="$define"
12958         else
12959                 val="$undef"
12960         fi
12961         set d_pwage
12962         eval $setvar
12963
12964         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12965                 val="$define"
12966         else
12967                 val="$undef"
12968         fi
12969         set d_pwchange
12970         eval $setvar
12971
12972         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12973                 val="$define"
12974         else
12975                 val="$undef"
12976         fi
12977         set d_pwclass
12978         eval $setvar
12979
12980         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12981                 val="$define"
12982         else
12983                 val="$undef"
12984         fi
12985         set d_pwexpire
12986         eval $setvar
12987
12988         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12989                 val="$define"
12990         else
12991                 val="$undef"
12992         fi
12993         set d_pwcomment
12994         eval $setvar
12995
12996         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12997                 val="$define"
12998         else
12999                 val="$undef"
13000         fi
13001         set d_pwgecos
13002         eval $setvar
13003
13004         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
13005                 val="$define"
13006         else
13007                 val="$undef"
13008         fi
13009         set d_pwpasswd
13010         eval $setvar
13011
13012         $rm -f $$.h
13013         ;;
13014 *)
13015         val="$undef";
13016         set d_pwquota; eval $setvar
13017         set d_pwage; eval $setvar
13018         set d_pwchange; eval $setvar
13019         set d_pwclass; eval $setvar
13020         set d_pwexpire; eval $setvar
13021         set d_pwcomment; eval $setvar
13022         set d_pwgecos; eval $setvar
13023         set d_pwpasswd; eval $setvar
13024         ;;
13025 esac
13026
13027 : see if endpwent_r exists
13028 set endpwent_r d_endpwent_r
13029 eval $inlibc
13030 case "$d_endpwent_r" in
13031 "$define")
13032         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13033         case "$d_endpwent_r_proto:$usethreads" in
13034         ":define")      d_endpwent_r_proto=define
13035                 set d_endpwent_r_proto endpwent_r $hdrs
13036                 eval $hasproto ;;
13037         *)      ;;
13038         esac
13039         case "$d_endpwent_r_proto" in
13040         define)
13041         case "$endpwent_r_proto" in
13042         ''|0) try='int endpwent_r(FILE**);'
13043         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13044         esac
13045         case "$endpwent_r_proto" in
13046         ''|0) try='void endpwent_r(FILE**);'
13047         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13048         esac
13049         case "$endpwent_r_proto" in
13050         ''|0)   d_endpwent_r=undef
13051                 endpwent_r_proto=0
13052                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13053         * )     case "$endpwent_r_proto" in
13054                 REENTRANT_PROTO*) ;;
13055                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13056                 esac
13057                 echo "Prototype: $try" ;;
13058         esac
13059         ;;
13060         *)      case "$usethreads" in
13061                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13062                 esac
13063                 d_endpwent_r=undef
13064                 endpwent_r_proto=0
13065                 ;;
13066         esac
13067         ;;
13068 *)      endpwent_r_proto=0
13069         ;;
13070 esac
13071
13072 : see if endservent exists
13073 set endservent d_endsent
13074 eval $inlibc
13075
13076 : see if endservent_r exists
13077 set endservent_r d_endservent_r
13078 eval $inlibc
13079 case "$d_endservent_r" in
13080 "$define")
13081         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13082         case "$d_endservent_r_proto:$usethreads" in
13083         ":define")      d_endservent_r_proto=define
13084                 set d_endservent_r_proto endservent_r $hdrs
13085                 eval $hasproto ;;
13086         *)      ;;
13087         esac
13088         case "$d_endservent_r_proto" in
13089         define)
13090         case "$endservent_r_proto" in
13091         ''|0) try='int endservent_r(struct servent_data*);'
13092         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13093         esac
13094         case "$endservent_r_proto" in
13095         ''|0) try='void endservent_r(struct servent_data*);'
13096         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13097         esac
13098         case "$endservent_r_proto" in
13099         ''|0)   d_endservent_r=undef
13100                 endservent_r_proto=0
13101                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13102         * )     case "$endservent_r_proto" in
13103                 REENTRANT_PROTO*) ;;
13104                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13105                 esac
13106                 echo "Prototype: $try" ;;
13107         esac
13108         ;;
13109         *)      case "$usethreads" in
13110                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13111                 esac
13112                 d_endservent_r=undef
13113                 endservent_r_proto=0
13114                 ;;
13115         esac
13116         ;;
13117 *)      endservent_r_proto=0
13118         ;;
13119 esac
13120
13121 : Locate the flags for 'open()'
13122 echo " "
13123 $cat >try.c <<EOCP
13124 #include <sys/types.h>
13125 #ifdef I_FCNTL
13126 #include <fcntl.h>
13127 #endif
13128 #ifdef I_SYS_FILE
13129 #include <sys/file.h>
13130 #endif
13131 #$i_stdlib I_STDLIB
13132 #ifdef I_STDLIB
13133 #include <stdlib.h>
13134 #endif
13135 int main() {
13136         if(O_RDONLY);
13137 #ifdef O_TRUNC
13138         exit(0);
13139 #else
13140         exit(1);
13141 #endif
13142 }
13143 EOCP
13144 : check sys/file.h first to get FREAD on Sun
13145 if $test `./findhdr sys/file.h` && \
13146                 set try -DI_SYS_FILE && eval $compile; then
13147         h_sysfile=true;
13148         echo "<sys/file.h> defines the O_* constants..." >&4
13149         if $run ./try; then
13150                 echo "and you have the 3 argument form of open()." >&4
13151                 val="$define"
13152         else
13153                 echo "but not the 3 argument form of open().  Oh, well." >&4
13154                 val="$undef"
13155         fi
13156 elif $test `./findhdr fcntl.h` && \
13157                 set try -DI_FCNTL && eval $compile; then
13158         h_fcntl=true;
13159         echo "<fcntl.h> defines the O_* constants..." >&4
13160         if $run ./try; then
13161                 echo "and you have the 3 argument form of open()." >&4
13162                 val="$define"
13163         else
13164                 echo "but not the 3 argument form of open().  Oh, well." >&4
13165                 val="$undef"
13166         fi
13167 else
13168         val="$undef"
13169         echo "I can't find the O_* constant definitions!  You got problems." >&4
13170 fi
13171 set d_open3
13172 eval $setvar
13173 $rm_try
13174
13175 : see if this is a sys/file.h system
13176 val=''
13177 set sys/file.h val
13178 eval $inhdr
13179
13180 : do we need to include sys/file.h ?
13181 case "$val" in
13182 "$define")
13183         echo " "
13184         if $h_sysfile; then
13185                 val="$define"
13186                 echo "We'll be including <sys/file.h>." >&4
13187         else
13188                 val="$undef"
13189                 echo "We won't be including <sys/file.h>." >&4
13190         fi
13191         ;;
13192 *)
13193         h_sysfile=false
13194         ;;
13195 esac
13196 set i_sysfile
13197 eval $setvar
13198
13199 : see if fcntl.h is there
13200 val=''
13201 set fcntl.h val
13202 eval $inhdr
13203
13204 : see if we can include fcntl.h
13205 case "$val" in
13206 "$define")
13207         echo " "
13208         if $h_fcntl; then
13209                 val="$define"
13210                 echo "We'll be including <fcntl.h>." >&4
13211         else
13212                 val="$undef"
13213                 if $h_sysfile; then
13214         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13215                 else
13216                         echo "We won't be including <fcntl.h>." >&4
13217                 fi
13218         fi
13219         ;;
13220 *)
13221         h_fcntl=false
13222         val="$undef"
13223         ;;
13224 esac
13225 set i_fcntl
13226 eval $setvar
13227
13228 : see if fork exists
13229 set fork d_fork
13230 eval $inlibc
13231
13232 : see if pipe exists
13233 set pipe d_pipe
13234 eval $inlibc
13235
13236 : check for non-blocking I/O stuff
13237 case "$h_sysfile" in
13238 true) echo "#include <sys/file.h>" > head.c;;
13239 *)
13240        case "$h_fcntl" in
13241        true) echo "#include <fcntl.h>" > head.c;;
13242        *) echo "#include <sys/fcntl.h>" > head.c;;
13243        esac
13244        ;;
13245 esac
13246 echo " "
13247 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13248 case "$o_nonblock" in
13249 '')
13250         $cat head.c > try.c
13251         $cat >>try.c <<EOCP
13252 #include <stdio.h>
13253 #$i_stdlib I_STDLIB
13254 #ifdef I_STDLIB
13255 #include <stdlib.h>
13256 #endif
13257 #$i_fcntl I_FCNTL
13258 #ifdef I_FCNTL
13259 #include <fcntl.h>
13260 #endif
13261 int main() {
13262 #ifdef O_NONBLOCK
13263         printf("O_NONBLOCK\n");
13264         exit(0);
13265 #endif
13266 #ifdef O_NDELAY
13267         printf("O_NDELAY\n");
13268         exit(0);
13269 #endif
13270 #ifdef FNDELAY
13271         printf("FNDELAY\n");
13272         exit(0);
13273 #endif
13274         exit(0);
13275 }
13276 EOCP
13277         set try
13278         if eval $compile_ok; then
13279                 o_nonblock=`$run ./try`
13280                 case "$o_nonblock" in
13281                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13282                 *) echo "Seems like we can use $o_nonblock.";;
13283                 esac
13284         else
13285                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13286         fi
13287         ;;
13288 *) echo "Using $hint value $o_nonblock.";;
13289 esac
13290 $rm_try
13291
13292 echo " "
13293 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13294 case "$eagain" in
13295 '')
13296         case "$d_fork:$d_pipe" in
13297         define:define)
13298         $cat head.c > try.c
13299         $cat >>try.c <<EOCP
13300 #include <errno.h>
13301 #include <sys/types.h>
13302 #include <signal.h>
13303 #include <stdio.h>
13304 #$i_stdlib I_STDLIB
13305 #ifdef I_STDLIB
13306 #include <stdlib.h>
13307 #endif
13308 #$i_fcntl I_FCNTL
13309 #ifdef I_FCNTL
13310 #include <fcntl.h>
13311 #endif
13312 #define MY_O_NONBLOCK $o_nonblock
13313 #ifndef errno  /* XXX need better Configure test */
13314 extern int errno;
13315 #endif
13316 #$i_unistd I_UNISTD
13317 #ifdef I_UNISTD
13318 #include <unistd.h>
13319 #endif
13320 #$i_string I_STRING
13321 #ifdef I_STRING
13322 #include <string.h>
13323 #else
13324 #include <strings.h>
13325 #endif
13326 $signal_t blech(int x) { exit(3); }
13327 EOCP
13328         $cat >> try.c <<'EOCP'
13329 int main()
13330 {
13331         int pd[2];
13332         int pu[2];
13333         char buf[1];
13334         char string[100];
13335         int ret;
13336
13337         ret = pipe(pd); /* Down: child -> parent */
13338         if (ret != 0)
13339                 exit(3);
13340         ret = pipe(pu); /* Up: parent -> child */
13341         if (ret != 0)
13342                 exit(3);
13343         if (0 != fork()) {
13344                 close(pd[1]);   /* Parent reads from pd[0] */
13345                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13346 #ifdef F_SETFL
13347                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13348                         exit(1);
13349 #else
13350                 exit(4);
13351 #endif
13352                 signal(SIGALRM, blech);
13353                 alarm(5);
13354                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13355                         exit(2);
13356                 sprintf(string, "%d\n", ret);
13357                 ret = write(2, string, strlen(string));
13358                 if (ret != strlen(string))
13359                         exit(3);
13360                 alarm(0);
13361 #ifdef EAGAIN
13362                 if (errno == EAGAIN) {
13363                         printf("EAGAIN\n");
13364                         goto ok;
13365                 }
13366 #endif
13367 #ifdef EWOULDBLOCK
13368                 if (errno == EWOULDBLOCK)
13369                         printf("EWOULDBLOCK\n");
13370 #endif
13371         ok:
13372                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13373                 if (ret != 1)
13374                         exit(3);
13375                 sleep(2);                               /* Give it time to close our pipe */
13376                 alarm(5);
13377                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13378                 alarm(0);
13379                 sprintf(string, "%d\n", ret);
13380                 ret = write(4, string, strlen(string));
13381                 if (ret != strlen(string))
13382                         exit(3);
13383                 exit(0);
13384         }
13385
13386         close(pd[0]);                   /* We write to pd[1] */
13387         close(pu[1]);                   /* We read from pu[0] */
13388         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13389         if (ret != 1)
13390                 exit(3);
13391         close(pd[1]);                   /* Pipe pd is now fully closed! */
13392         exit(0);                                /* Bye bye, thank you for playing! */
13393 }
13394 EOCP
13395         set try
13396         if eval $compile_ok; then
13397                 echo "$startsh" >mtry
13398                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13399                 chmod +x mtry
13400                 $run ./mtry >/dev/null 2>&1
13401                 case $? in
13402                 0) eagain=`$cat try.out`;;
13403                 1) echo "Could not perform non-blocking setting!";;
13404                 2) echo "I did a successful read() for something that was not there!";;
13405                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13406                 4) echo "Could not find F_SETFL!";;
13407                 *) echo "Something terribly wrong happened during testing.";;
13408                 esac
13409                 rd_nodata=`$cat try.ret`
13410                 echo "A read() system call with no data present returns $rd_nodata."
13411                 case "$rd_nodata" in
13412                 0|-1) ;;
13413                 *)
13414                         echo "(That's peculiar, fixing that to be -1.)"
13415                         rd_nodata=-1
13416                         ;;
13417                 esac
13418                 case "$eagain" in
13419                 '')
13420                         echo "Forcing errno EAGAIN on read() with no data available."
13421                         eagain=EAGAIN
13422                         ;;
13423                 *)
13424                         echo "Your read() sets errno to $eagain when no data is available."
13425                         ;;
13426                 esac
13427                 status=`$cat try.err`
13428                 case "$status" in
13429                 0) echo "And it correctly returns 0 to signal EOF.";;
13430                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13431                 *) echo "However, your read() returns '$status' on EOF??";;
13432                 esac
13433                 val="$define"
13434                 if test "$status" = "$rd_nodata"; then
13435                         echo "WARNING: you can't distinguish between EOF and no data!"
13436                         val="$undef"
13437                 fi
13438         else
13439                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13440                 eagain=EAGAIN
13441         fi
13442         ;;
13443         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13444                 eagain=EAGAIN
13445                 val="$define"
13446                 ;;
13447         esac
13448         set d_eofnblk
13449         eval $setvar
13450         ;;
13451 *)
13452         echo "Using $hint value $eagain."
13453         echo "Your read() returns $rd_nodata when no data is present."
13454         case "$d_eofnblk" in
13455         "$define") echo "And you can see EOF because read() returns 0.";;
13456         "$undef") echo "But you can't see EOF status from read() returned value.";;
13457         *)
13458                 echo "(Assuming you can't see EOF status from read anyway.)"
13459                 d_eofnblk=$undef
13460                 ;;
13461         esac
13462         ;;
13463 esac
13464 $rm_try head.c mtry
13465
13466 : see if erf exists
13467 set erf d_erf
13468 eval $inlibc
13469
13470 : see if erfc exists
13471 set erfc d_erfc
13472 eval $inlibc
13473
13474 : see if exp2 exists
13475 set exp2 d_exp2
13476 eval $inlibc
13477
13478 : see if expm1 exists
13479 set expm1 d_expm1
13480 eval $inlibc
13481
13482 : see if _ptr and _cnt from stdio act std
13483 echo " "
13484
13485 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13486         echo "(Looks like you have stdio.h from BSD.)"
13487         case "$stdio_ptr" in
13488         '') stdio_ptr='((fp)->_p)'
13489                 ptr_lval=$define
13490                 ;;
13491         *)      ptr_lval=$d_stdio_ptr_lval;;
13492         esac
13493         case "$stdio_cnt" in
13494         '') stdio_cnt='((fp)->_r)'
13495                 cnt_lval=$define
13496                 ;;
13497         *)      cnt_lval=$d_stdio_cnt_lval;;
13498         esac
13499         case "$stdio_base" in
13500         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13501         esac
13502         case "$stdio_bufsiz" in
13503         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13504         esac
13505 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13506         echo "(Looks like you have stdio.h from Linux.)"
13507         case "$stdio_ptr" in
13508         '') stdio_ptr='((fp)->_IO_read_ptr)'
13509                 ptr_lval=$define
13510                 ;;
13511         *)      ptr_lval=$d_stdio_ptr_lval;;
13512         esac
13513         case "$stdio_cnt" in
13514         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13515                 cnt_lval=$undef
13516                 ;;
13517         *)      cnt_lval=$d_stdio_cnt_lval;;
13518         esac
13519         case "$stdio_base" in
13520         '') stdio_base='((fp)->_IO_read_base)';;
13521         esac
13522         case "$stdio_bufsiz" in
13523         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13524         esac
13525 else
13526         case "$stdio_ptr" in
13527         '') stdio_ptr='((fp)->_ptr)'
13528                 ptr_lval=$define
13529                 ;;
13530         *)      ptr_lval=$d_stdio_ptr_lval;;
13531         esac
13532         case "$stdio_cnt" in
13533         '') stdio_cnt='((fp)->_cnt)'
13534                 cnt_lval=$define
13535                 ;;
13536         *)      cnt_lval=$d_stdio_cnt_lval;;
13537         esac
13538         case "$stdio_base" in
13539         '') stdio_base='((fp)->_base)';;
13540         esac
13541         case "$stdio_bufsiz" in
13542         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13543         esac
13544 fi
13545
13546 : test whether _ptr and _cnt really work
13547 echo "Checking how std your stdio is..." >&4
13548 $cat >try.c <<EOP
13549 #include <stdio.h>
13550 #$i_stdlib I_STDLIB
13551 #ifdef I_STDLIB
13552 #include <stdlib.h>
13553 #endif
13554 #define FILE_ptr(fp)    $stdio_ptr
13555 #define FILE_cnt(fp)    $stdio_cnt
13556 int main() {
13557         FILE *fp = fopen("try.c", "r");
13558         char c = getc(fp);
13559         if (
13560                 18 <= FILE_cnt(fp) &&
13561                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13562         )
13563                 exit(0);
13564         exit(1);
13565 }
13566 EOP
13567 val="$undef"
13568 set try
13569 if eval $compile && $to try.c; then
13570         if $run ./try; then
13571                 echo "Your stdio acts pretty std."
13572                 val="$define"
13573         else
13574                 echo "Your stdio isn't very std."
13575         fi
13576 else
13577         echo "Your stdio doesn't appear very std."
13578 fi
13579 $rm_try
13580
13581 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13582 # direct buffer manipulation no longer works.  The Configure tests
13583 # should be changed to correctly detect this, but until then,
13584 # the following check should at least let perl compile and run.
13585 # (This quick fix should be updated before 5.8.1.)
13586 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13587 # A. Dougherty, June 3, 2002.
13588 case "$d_gnulibc" in
13589 $define)
13590         case "$gnulibc_version" in
13591         2.[01]*)  ;;
13592         2.2) ;;
13593         2.2.[0-9]) ;;
13594         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13595                 val="$undef"
13596                 ;;
13597         esac
13598         ;;
13599 esac
13600 set d_stdstdio
13601 eval $setvar
13602
13603 : Can _ptr be used as an lvalue?
13604 case "$d_stdstdio$ptr_lval" in
13605 $define$define) val=$define ;;
13606 *) val=$undef ;;
13607 esac
13608 set d_stdio_ptr_lval
13609 eval $setvar
13610
13611 : Can _cnt be used as an lvalue?
13612 case "$d_stdstdio$cnt_lval" in
13613 $define$define) val=$define ;;
13614 *) val=$undef ;;
13615 esac
13616 set d_stdio_cnt_lval
13617 eval $setvar
13618
13619
13620 : test whether setting _ptr sets _cnt as a side effect
13621 d_stdio_ptr_lval_sets_cnt="$undef"
13622 d_stdio_ptr_lval_nochange_cnt="$undef"
13623 case "$d_stdio_ptr_lval$d_stdstdio" in
13624 $define$define)
13625         echo "Checking to see what happens if we set the stdio ptr..." >&4
13626 $cat >try.c <<EOP
13627 #include <stdio.h>
13628 /* Can we scream? */
13629 /* Eat dust sed :-) */
13630 /* In the buffer space, no one can hear you scream. */
13631 #$i_stdlib I_STDLIB
13632 #ifdef I_STDLIB
13633 #include <stdlib.h>
13634 #endif
13635 #define FILE_ptr(fp)    $stdio_ptr
13636 #define FILE_cnt(fp)    $stdio_cnt
13637 #include <sys/types.h>
13638 int main() {
13639         FILE *fp = fopen("try.c", "r");
13640         int c;
13641         char *ptr;
13642         size_t cnt;
13643         if (!fp) {
13644             puts("Fail even to read");
13645             exit(1);
13646         }
13647         c = getc(fp); /* Read away the first # */
13648         if (c == EOF) {
13649             puts("Fail even to read");
13650             exit(1);
13651         }
13652         if (!(
13653                 18 <= FILE_cnt(fp) &&
13654                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13655         )) {
13656                 puts("Fail even to read");
13657                 exit (1);
13658         }
13659         ptr = (char*) FILE_ptr(fp);
13660         cnt = (size_t)FILE_cnt(fp);
13661
13662         FILE_ptr(fp) += 42;
13663
13664         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13665                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13666                 exit (1);
13667         }
13668         if (FILE_cnt(fp) <= 20) {
13669                 printf ("Fail (<20 chars to test)");
13670                 exit (1);
13671         }
13672         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13673                 puts("Fail compare");
13674                 exit (1);
13675         }
13676         if (cnt == FILE_cnt(fp)) {
13677                 puts("Pass_unchanged");
13678                 exit (0);
13679         }
13680         if (FILE_cnt(fp) == (cnt - 42)) {
13681                 puts("Pass_changed");
13682                 exit (0);
13683         }
13684         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13685         return 1;
13686
13687 }
13688 EOP
13689         set try
13690         if eval $compile && $to try.c; then
13691                 case `$run ./try` in
13692                 Pass_changed)
13693                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13694                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13695                 Pass_unchanged)
13696                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13697                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13698                 Fail*)
13699                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13700                 *)
13701                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13702         esac
13703         else
13704                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13705         fi
13706         $rm_try
13707         ;;
13708 esac
13709
13710 : see if _base is also standard
13711 val="$undef"
13712 case "$d_stdstdio" in
13713 $define)
13714         $cat >try.c <<EOP
13715 #include <stdio.h>
13716 #$i_stdlib I_STDLIB
13717 #ifdef I_STDLIB
13718 #include <stdlib.h>
13719 #endif
13720 #define FILE_base(fp)   $stdio_base
13721 #define FILE_bufsiz(fp) $stdio_bufsiz
13722 int main() {
13723         FILE *fp = fopen("try.c", "r");
13724         char c = getc(fp);
13725         if (
13726                 19 <= FILE_bufsiz(fp) &&
13727                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13728         )
13729                 exit(0);
13730         exit(1);
13731 }
13732 EOP
13733         set try
13734         if eval $compile && $to try.c; then
13735                 if $run ./try; then
13736                         echo "And its _base field acts std."
13737                         val="$define"
13738                 else
13739                         echo "But its _base field isn't std."
13740                 fi
13741         else
13742                 echo "However, it seems to be lacking the _base field."
13743         fi
13744         $rm_try
13745         ;;
13746 esac
13747 set d_stdiobase
13748 eval $setvar
13749
13750 : see if fast_stdio exists
13751 val="$undef"
13752 case "$d_stdstdio:$d_stdio_ptr_lval" in
13753 "$define:$define")
13754         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13755         *$define*)
13756                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13757                 val="$define"
13758                 ;;
13759         esac
13760         ;;
13761 esac
13762 set d_faststdio
13763 eval $setvar
13764
13765
13766
13767 : see if fchdir exists
13768 set fchdir d_fchdir
13769 eval $inlibc
13770
13771 : see if fchmod exists
13772 set fchmod d_fchmod
13773 eval $inlibc
13774
13775 : see if fchown exists
13776 set fchown d_fchown
13777 eval $inlibc
13778
13779 : see if this is an fcntl system
13780 set fcntl d_fcntl
13781 eval $inlibc
13782
13783 : See if fcntl-based locking works.
13784 echo " "
13785 $cat >try.c <<EOCP
13786 #$i_stdlib I_STDLIB
13787 #ifdef I_STDLIB
13788 #include <stdlib.h>
13789 #endif
13790 #include <unistd.h>
13791 #include <fcntl.h>
13792 #include <signal.h>
13793 $signal_t blech(int x) { exit(3); }
13794 int main() {
13795 #if defined(F_SETLK) && defined(F_SETLKW)
13796      struct flock flock;
13797      int retval, fd;
13798      fd = open("try.c", O_RDONLY);
13799      flock.l_type = F_RDLCK;
13800      flock.l_whence = SEEK_SET;
13801      flock.l_start = flock.l_len = 0;
13802      signal(SIGALRM, blech);
13803      alarm(10);
13804      retval = fcntl(fd, F_SETLK, &flock);
13805      close(fd);
13806      (retval < 0 ? exit(2) : exit(0));
13807 #else
13808      exit(2);
13809 #endif
13810 }
13811 EOCP
13812 echo "Checking if fcntl-based file locking works... "
13813 case "$d_fcntl" in
13814 "$define")
13815         set try
13816         if eval $compile_ok; then
13817                 if $run ./try; then
13818                         echo "Yes, it seems to work."
13819                         val="$define"
13820                 else
13821                         echo "Nope, it didn't work."
13822                         val="$undef"
13823                         case "$?" in
13824                         3) $cat >&4 <<EOM
13825 ***
13826 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13827 *** This is (almost) impossible.
13828 *** If your NFS lock daemons are not feeling well, something like
13829 *** this may happen, please investigate.  Cannot continue, aborting.
13830 ***
13831 EOM
13832                                 exit 1
13833                                 ;;
13834                         esac
13835                 fi
13836         else
13837                 echo "I'm unable to compile the test program, so I'll assume not."
13838                 val="$undef"
13839         fi
13840         ;;
13841 *) val="$undef";
13842         echo "Nope, since you don't even have fcntl()."
13843         ;;
13844 esac
13845 set d_fcntl_can_lock
13846 eval $setvar
13847 $rm_try
13848
13849 : check for fd_set items
13850 $cat <<EOM
13851
13852 Checking to see how well your C compiler handles fd_set and friends ...
13853 EOM
13854 $cat >try.c <<EOCP
13855 #$i_stdlib I_STDLIB
13856 #ifdef I_STDLIB
13857 #include <stdlib.h>
13858 #endif
13859 #$i_systime I_SYS_TIME
13860 #$i_sysselct I_SYS_SELECT
13861 #$d_socket HAS_SOCKET
13862 #include <sys/types.h>
13863 #ifdef HAS_SOCKET
13864 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13865 #endif
13866 #ifdef I_SYS_TIME
13867 #include <sys/time.h>
13868 #endif
13869 #ifdef I_SYS_SELECT
13870 #include <sys/select.h>
13871 #endif
13872 int main() {
13873         fd_set fds;
13874
13875 #ifdef TRYBITS
13876         if(fds.fds_bits);
13877 #endif
13878
13879 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13880         exit(0);
13881 #else
13882         exit(1);
13883 #endif
13884 }
13885 EOCP
13886 set try -DTRYBITS
13887 if eval $compile; then
13888         d_fds_bits="$define"
13889         d_fd_set="$define"
13890         echo "Well, your system knows about the normal fd_set typedef..." >&4
13891         if $run ./try; then
13892                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13893                 d_fd_macros="$define"
13894         else
13895                 $cat >&4 <<'EOM'
13896 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13897 EOM
13898                 d_fd_macros="$undef"
13899         fi
13900 else
13901         $cat <<'EOM'
13902 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13903 EOM
13904         set try
13905         if eval $compile; then
13906                 d_fds_bits="$undef"
13907                 d_fd_set="$define"
13908                 echo "Well, your system has some sort of fd_set available..." >&4
13909                 if $run ./try; then
13910                         echo "and you have the normal fd_set macros." >&4
13911                         d_fd_macros="$define"
13912                 else
13913                         $cat <<'EOM'
13914 but not the normal fd_set macros!  Gross!  More work for me...
13915 EOM
13916                         d_fd_macros="$undef"
13917                 fi
13918         else
13919         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13920                 d_fd_set="$undef"
13921                 d_fds_bits="$undef"
13922                 d_fd_macros="$undef"
13923         fi
13924 fi
13925 $rm_try
13926
13927 : see if fdim exists
13928 set fdim d_fdim
13929 eval $inlibc
13930
13931 : see if fegetround exists
13932 set fegetround d_fegetround
13933 eval $inlibc
13934
13935 : see if fgetpos exists
13936 set fgetpos d_fgetpos
13937 eval $inlibc
13938
13939 : see if finite exists
13940 set finite d_finite
13941 eval $inlibc
13942
13943 : see if finitel exists
13944 set finitel d_finitel
13945 eval $inlibc
13946
13947 : see if flock exists
13948 set flock d_flock
13949 eval $inlibc
13950
13951 : see if prototype for flock is available
13952 echo " "
13953 set d_flockproto flock $i_sysfile sys/file.h
13954 eval $hasproto
13955
13956 : see if fma exists
13957 set fma d_fma
13958 eval $inlibc
13959
13960 : see if fmax exists
13961 set fmax d_fmax
13962 eval $inlibc
13963
13964 : see if fmin exists
13965 set fmin d_fmin
13966 eval $inlibc
13967
13968 : see if fp_class exists
13969 set fp_class d_fp_class
13970 eval $inlibc
13971
13972 : see if this is a math.h system
13973 set math.h i_math
13974 eval $inhdr
13975
13976 : check for fpclassify
13977 echo "Checking to see if you have fpclassify..." >&4
13978 $cat >try.c <<EOCP
13979 #$i_math I_MATH
13980 #ifdef I_MATH
13981 #include <math.h>
13982 #endif
13983 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
13984 EOCP
13985 set try
13986 if eval $compile; then
13987         val="$define"
13988         echo "You have fpclassify."
13989 else
13990         val="$undef"
13991         echo "You do not have fpclassify."
13992 fi
13993 $rm_try
13994 set d_fpclassify
13995 eval $setvar
13996
13997 : see if fp_classify exists
13998 set fp_classify d_fp_classify
13999 eval $inlibc
14000
14001 : see if fp_classl exists
14002 set fp_classl d_fp_classl
14003 eval $inlibc
14004
14005 : see if pathconf exists
14006 set pathconf d_pathconf
14007 eval $inlibc
14008
14009 : see if fpathconf exists
14010 set fpathconf d_fpathconf
14011 eval $inlibc
14012
14013 : see if fpclass exists
14014 set fpclass d_fpclass
14015 eval $inlibc
14016
14017 : see if fpclassl exists
14018 set fpclassl d_fpclassl
14019 eval $inlibc
14020
14021 : see if fpgetround exists
14022 set fpgetround d_fpgetround
14023 eval $inlibc
14024
14025 : check for fpos64_t
14026 echo " "
14027 echo "Checking to see if you have fpos64_t..." >&4
14028 $cat >try.c <<EOCP
14029 #include <stdio.h>
14030 int main() { fpos64_t x = 7; }
14031 EOCP
14032 set try
14033 if eval $compile; then
14034         val="$define"
14035         echo "You have fpos64_t."
14036 else
14037         val="$undef"
14038         echo "You do not have fpos64_t."
14039         case "$fpossize" in
14040         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14041         esac
14042 fi
14043 $rm_try
14044 set d_fpos64_t
14045 eval $setvar
14046
14047 : see if frexpl exists
14048 set frexpl d_frexpl
14049 eval $inlibc
14050
14051 : see if this is a sys/param system
14052 set sys/param.h i_sysparam
14053 eval $inhdr
14054
14055 : see if this is a sys/mount.h system
14056 set sys/mount.h i_sysmount
14057 eval $inhdr
14058
14059 : Check for fs_data_s
14060 echo " "
14061 echo "Checking to see if your system supports struct fs_data..." >&4
14062 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14063 eval $hasstruct
14064 case "$d_fs_data_s" in
14065 "$define")      echo "Yes, it does."   ;;
14066 *)              echo "No, it doesn't." ;;
14067 esac
14068
14069 : see if fseeko exists
14070 set fseeko d_fseeko
14071 eval $inlibc
14072 case "$longsize" in
14073 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14074 esac
14075
14076 : see if fsetpos exists
14077 set fsetpos d_fsetpos
14078 eval $inlibc
14079
14080 : see if fstatfs exists
14081 set fstatfs d_fstatfs
14082 eval $inlibc
14083
14084 : see if statvfs exists
14085 set statvfs d_statvfs
14086 eval $inlibc
14087
14088 : see if fstatvfs exists
14089 set fstatvfs d_fstatvfs
14090 eval $inlibc
14091
14092
14093 : see if fsync exists
14094 set fsync d_fsync
14095 eval $inlibc
14096
14097 : see if ftello exists
14098 set ftello d_ftello
14099 eval $inlibc
14100 case "$longsize" in
14101 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14102 esac
14103
14104 : check for a working futimes
14105 d_futimes="$undef"
14106 echo " "
14107 echo "Checking if you have a working futimes()" >&4
14108 $cat >try.c <<EOCP
14109 #include <stdio.h>
14110 #include <sys/time.h>
14111 #include <errno.h>
14112 #include <fcntl.h>
14113
14114 int main ()
14115 {
14116     int fd, rv;
14117     fd = open ("try.c", O_RDWR);
14118     if (-1 == fd) exit (1);
14119     rv = futimes (fd, NULL);
14120     exit (rv == -1 ? errno : 0);
14121 }
14122 EOCP
14123 set try
14124 if eval $compile; then
14125     `$run ./try`
14126     rc=$?
14127     case "$rc" in
14128         0)  echo "Yes, you have" >&4
14129             d_futimes="$define"
14130             ;;
14131         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14132             ;;
14133     esac
14134 else
14135     echo "No, it does not (probably harmless)" >&4
14136 fi
14137 $rm_try
14138
14139 : see if ndbm.h is available
14140 set ndbm.h i_ndbm
14141 eval $inhdr
14142 : Compatibility location for RedHat 7.1
14143 set gdbm/ndbm.h i_gdbmndbm
14144 eval $inhdr
14145 : Compatibility location for Debian 4.0
14146 set gdbm-ndbm.h i_gdbm_ndbm
14147 eval $inhdr
14148
14149 val="$undef"
14150 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14151         : see if dbm_open exists
14152         set dbm_open d_dbm_open
14153         eval $inlibc
14154         case "$d_dbm_open" in
14155         $undef)
14156                 i_ndbm="$undef"
14157                 i_gdbmndbm="$undef"
14158                 i_gdbm_ndbm="$undef"
14159                 echo "We won't be including <ndbm.h>"
14160                 val="$undef"
14161                 ;;
14162         *) val="$define"
14163            ;;
14164         esac
14165 fi
14166 set d_ndbm
14167 eval $setvar
14168
14169 ndbm_hdr_protochk='name=$1; hdr=$2;
14170 eval "ihdr=\$""i_$name";
14171 val="$undef";
14172 if $test "$ihdr" = "$define"; then
14173         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14174         case "$d_cplusplus" in
14175         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14176         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14177         esac;
14178         case "$val" in
14179         $define) $echo "Your <$hdr> seems to have prototypes";;
14180         *) $echo "Your <$hdr> does not seem to have prototypes";;
14181         esac;
14182 fi;
14183 set "d_${name}_h_uses_prototypes";
14184 eval $setvar'
14185
14186 set ndbm ndbm.h
14187 eval $ndbm_hdr_protochk
14188 set gdbmndbm gdbm/ndbm.h
14189 eval $ndbm_hdr_protochk
14190 set gdbm_ndbm gdbm-ndbm.h
14191 eval $ndbm_hdr_protochk
14192
14193 : see if getaddrinfo exists
14194 set getaddrinfo d_getaddrinfo
14195 eval $inlibc
14196
14197 : see if getcwd exists
14198 set getcwd d_getcwd
14199 eval $inlibc
14200
14201 : see if getespwnam exists
14202 set getespwnam d_getespwnam
14203 eval $inlibc
14204
14205 : see if getfsstat exists
14206 set getfsstat d_getfsstat
14207 eval $inlibc
14208
14209 : see if getgrent exists
14210 set getgrent d_getgrent
14211 eval $inlibc
14212
14213 : see if getgrent_r exists
14214 set getgrent_r d_getgrent_r
14215 eval $inlibc
14216 case "$d_getgrent_r" in
14217 "$define")
14218         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14219         case "$d_getgrent_r_proto:$usethreads" in
14220         ":define")      d_getgrent_r_proto=define
14221                 set d_getgrent_r_proto getgrent_r $hdrs
14222                 eval $hasproto ;;
14223         *)      ;;
14224         esac
14225         case "$d_getgrent_r_proto" in
14226         define)
14227         case "$getgrent_r_proto" in
14228         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14229         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14230         esac
14231         case "$getgrent_r_proto" in
14232         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14233         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14234         esac
14235         case "$getgrent_r_proto" in
14236         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14237         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14238         esac
14239         case "$getgrent_r_proto" in
14240         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14241         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14242         esac
14243         case "$getgrent_r_proto" in
14244         ''|0) try='int getgrent_r(struct group*, char*, int);'
14245         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14246         esac
14247         case "$getgrent_r_proto" in
14248         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14249         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14250         esac
14251         case "$getgrent_r_proto" in
14252         ''|0)   d_getgrent_r=undef
14253                 getgrent_r_proto=0
14254                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14255         * )     case "$getgrent_r_proto" in
14256                 REENTRANT_PROTO*) ;;
14257                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14258                 esac
14259                 echo "Prototype: $try" ;;
14260         esac
14261         ;;
14262         *)      case "$usethreads" in
14263                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14264                 esac
14265                 d_getgrent_r=undef
14266                 getgrent_r_proto=0
14267                 ;;
14268         esac
14269         ;;
14270 *)      getgrent_r_proto=0
14271         ;;
14272 esac
14273
14274 : see if getgrgid_r exists
14275 set getgrgid_r d_getgrgid_r
14276 eval $inlibc
14277 case "$d_getgrgid_r" in
14278 "$define")
14279         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14280         case "$d_getgrgid_r_proto:$usethreads" in
14281         ":define")      d_getgrgid_r_proto=define
14282                 set d_getgrgid_r_proto getgrgid_r $hdrs
14283                 eval $hasproto ;;
14284         *)      ;;
14285         esac
14286         case "$d_getgrgid_r_proto" in
14287         define)
14288         case "$getgrgid_r_proto" in
14289         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14290         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14291         esac
14292         case "$getgrgid_r_proto" in
14293         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14294         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14295         esac
14296         case "$getgrgid_r_proto" in
14297         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14298         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14299         esac
14300         case "$getgrgid_r_proto" in
14301         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14302         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14303         esac
14304         case "$getgrgid_r_proto" in
14305         ''|0)   d_getgrgid_r=undef
14306                 getgrgid_r_proto=0
14307                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14308         * )     case "$getgrgid_r_proto" in
14309                 REENTRANT_PROTO*) ;;
14310                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14311                 esac
14312                 echo "Prototype: $try" ;;
14313         esac
14314         ;;
14315         *)      case "$usethreads" in
14316                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14317                 esac
14318                 d_getgrgid_r=undef
14319                 getgrgid_r_proto=0
14320                 ;;
14321         esac
14322         ;;
14323 *)      getgrgid_r_proto=0
14324         ;;
14325 esac
14326
14327 : see if getgrnam_r exists
14328 set getgrnam_r d_getgrnam_r
14329 eval $inlibc
14330 case "$d_getgrnam_r" in
14331 "$define")
14332         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14333         case "$d_getgrnam_r_proto:$usethreads" in
14334         ":define")      d_getgrnam_r_proto=define
14335                 set d_getgrnam_r_proto getgrnam_r $hdrs
14336                 eval $hasproto ;;
14337         *)      ;;
14338         esac
14339         case "$d_getgrnam_r_proto" in
14340         define)
14341         case "$getgrnam_r_proto" in
14342         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14343         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14344         esac
14345         case "$getgrnam_r_proto" in
14346         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14347         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14348         esac
14349         case "$getgrnam_r_proto" in
14350         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14351         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14352         esac
14353         case "$getgrnam_r_proto" in
14354         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14355         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14356         esac
14357         case "$getgrnam_r_proto" in
14358         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14359         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14360         esac
14361         case "$getgrnam_r_proto" in
14362         ''|0)   d_getgrnam_r=undef
14363                 getgrnam_r_proto=0
14364                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14365         * )     case "$getgrnam_r_proto" in
14366                 REENTRANT_PROTO*) ;;
14367                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14368                 esac
14369                 echo "Prototype: $try" ;;
14370         esac
14371         ;;
14372         *)      case "$usethreads" in
14373                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14374                 esac
14375                 d_getgrnam_r=undef
14376                 getgrnam_r_proto=0
14377                 ;;
14378         esac
14379         ;;
14380 *)      getgrnam_r_proto=0
14381         ;;
14382 esac
14383
14384 : see if gethostbyaddr exists
14385 set gethostbyaddr d_gethbyaddr
14386 eval $inlibc
14387
14388 : see if gethostbyname exists
14389 set gethostbyname d_gethbyname
14390 eval $inlibc
14391
14392 : see if gethostent exists
14393 set gethostent d_gethent
14394 eval $inlibc
14395
14396 : see how we will look up host name
14397 echo " "
14398 call=''
14399 if set gethostname val -f d_gethname; eval $csym; $val; then
14400         echo 'gethostname() found.' >&4
14401         d_gethname="$define"
14402         call=gethostname
14403 fi
14404 if set uname val -f d_uname; eval $csym; $val; then
14405         if ./xenix; then
14406                 $cat <<'EOM'
14407 uname() was found, but you're running xenix, and older versions of xenix
14408 have a broken uname(). If you don't really know whether your xenix is old
14409 enough to have a broken system call, use the default answer.
14410
14411 EOM
14412                 dflt=y
14413                 case "$d_uname" in
14414                 "$define") dflt=n;;
14415                 esac
14416                 rp='Is your uname() broken?'
14417                 . ./myread
14418                 case "$ans" in
14419                 n*) d_uname="$define"; call=uname;;
14420                 esac
14421         else
14422                 echo 'uname() found.' >&4
14423                 d_uname="$define"
14424                 case "$call" in
14425                 '') call=uname ;;
14426                 esac
14427         fi
14428 fi
14429 case "$d_gethname" in
14430 '') d_gethname="$undef";;
14431 esac
14432 case "$d_uname" in
14433 '') d_uname="$undef";;
14434 esac
14435 case "$d_uname$d_gethname" in
14436 *define*)
14437         dflt=n
14438         cat <<EOM
14439
14440 Every now and then someone has a $call() that lies about the hostname
14441 but can't be fixed for political or economic reasons.  If you wish, I can
14442 pretend $call() isn't there and maybe compute hostname at run-time
14443 thanks to the '$phostname' command.
14444
14445 EOM
14446         rp="Shall I ignore $call() from now on?"
14447         . ./myread
14448         case "$ans" in
14449         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14450         esac;;
14451 esac
14452 case "$phostname" in
14453 '') aphostname='';;
14454 *) case "$aphostname" in
14455         /*) ;;
14456         *) set X $phostname
14457                 shift
14458                 file=$1
14459                 shift
14460                 file=`./loc $file $file $pth`
14461                 aphostname=`echo $file $*`
14462                 ;;
14463         esac
14464         ;;
14465 esac
14466 case "$d_uname$d_gethname" in
14467 *define*) ;;
14468 *)
14469         case "$phostname" in
14470         '')
14471                 echo "There will be no way for $package to get your hostname." >&4;;
14472         *)
14473         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14474                 ;;
14475         esac;;
14476 esac
14477 case "$d_phostname" in
14478 '') d_phostname="$undef";;
14479 esac
14480
14481 : see if gethostbyaddr_r exists
14482 set gethostbyaddr_r d_gethostbyaddr_r
14483 eval $inlibc
14484 case "$d_gethostbyaddr_r" in
14485 "$define")
14486         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14487         case "$d_gethostbyaddr_r_proto:$usethreads" in
14488         ":define")      d_gethostbyaddr_r_proto=define
14489                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14490                 eval $hasproto ;;
14491         *)      ;;
14492         esac
14493         case "$d_gethostbyaddr_r_proto" in
14494         define)
14495         case "$gethostbyaddr_r_proto" in
14496         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14497         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14498         esac
14499         case "$gethostbyaddr_r_proto" in
14500         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14501         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14502         esac
14503         case "$gethostbyaddr_r_proto" in
14504         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14505         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14506         esac
14507         case "$gethostbyaddr_r_proto" in
14508         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14509         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14510         esac
14511         case "$gethostbyaddr_r_proto" in
14512         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14513         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14514         esac
14515         case "$gethostbyaddr_r_proto" in
14516         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14517         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14518         esac
14519         case "$gethostbyaddr_r_proto" in
14520         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14521         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14522         esac
14523         case "$gethostbyaddr_r_proto" in
14524         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14525         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14526         esac
14527         case "$gethostbyaddr_r_proto" in
14528         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14529         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14530         esac
14531         case "$gethostbyaddr_r_proto" in
14532         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14533         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14534         esac
14535         case "$gethostbyaddr_r_proto" in
14536         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14537         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14538         esac
14539         case "$gethostbyaddr_r_proto" in
14540         ''|0)   d_gethostbyaddr_r=undef
14541                 gethostbyaddr_r_proto=0
14542                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14543         * )     case "$gethostbyaddr_r_proto" in
14544                 REENTRANT_PROTO*) ;;
14545                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14546                 esac
14547                 echo "Prototype: $try" ;;
14548         esac
14549         ;;
14550         *)      case "$usethreads" in
14551                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14552                 esac
14553                 d_gethostbyaddr_r=undef
14554                 gethostbyaddr_r_proto=0
14555                 ;;
14556         esac
14557         ;;
14558 *)      gethostbyaddr_r_proto=0
14559         ;;
14560 esac
14561
14562 : see if gethostbyname_r exists
14563 set gethostbyname_r d_gethostbyname_r
14564 eval $inlibc
14565 case "$d_gethostbyname_r" in
14566 "$define")
14567         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14568         case "$d_gethostbyname_r_proto:$usethreads" in
14569         ":define")      d_gethostbyname_r_proto=define
14570                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14571                 eval $hasproto ;;
14572         *)      ;;
14573         esac
14574         case "$d_gethostbyname_r_proto" in
14575         define)
14576         case "$gethostbyname_r_proto" in
14577         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14578         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14579         esac
14580         case "$gethostbyname_r_proto" in
14581         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14582         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14583         esac
14584         case "$gethostbyname_r_proto" in
14585         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14586         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14587         esac
14588         case "$gethostbyname_r_proto" in
14589         ''|0)   d_gethostbyname_r=undef
14590                 gethostbyname_r_proto=0
14591                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14592         * )     case "$gethostbyname_r_proto" in
14593                 REENTRANT_PROTO*) ;;
14594                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14595                 esac
14596                 echo "Prototype: $try" ;;
14597         esac
14598         ;;
14599         *)      case "$usethreads" in
14600                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14601                 esac
14602                 d_gethostbyname_r=undef
14603                 gethostbyname_r_proto=0
14604                 ;;
14605         esac
14606         ;;
14607 *)      gethostbyname_r_proto=0
14608         ;;
14609 esac
14610
14611 : see if gethostent_r exists
14612 set gethostent_r d_gethostent_r
14613 eval $inlibc
14614 case "$d_gethostent_r" in
14615 "$define")
14616         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14617         case "$d_gethostent_r_proto:$usethreads" in
14618         ":define")      d_gethostent_r_proto=define
14619                 set d_gethostent_r_proto gethostent_r $hdrs
14620                 eval $hasproto ;;
14621         *)      ;;
14622         esac
14623         case "$d_gethostent_r_proto" in
14624         define)
14625         case "$gethostent_r_proto" in
14626         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14627         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14628         esac
14629         case "$gethostent_r_proto" in
14630         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14631         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14632         esac
14633         case "$gethostent_r_proto" in
14634         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14635         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14636         esac
14637         case "$gethostent_r_proto" in
14638         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14639         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14640         esac
14641         case "$gethostent_r_proto" in
14642         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14643         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14644         esac
14645         case "$gethostent_r_proto" in
14646         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14647         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14648         esac
14649         case "$gethostent_r_proto" in
14650         ''|0)   d_gethostent_r=undef
14651                 gethostent_r_proto=0
14652                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14653         * )     case "$gethostent_r_proto" in
14654                 REENTRANT_PROTO*) ;;
14655                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14656                 esac
14657                 echo "Prototype: $try" ;;
14658         esac
14659         ;;
14660         *)      case "$usethreads" in
14661                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14662                 esac
14663                 d_gethostent_r=undef
14664                 gethostent_r_proto=0
14665                 ;;
14666         esac
14667         ;;
14668 *)      gethostent_r_proto=0
14669         ;;
14670 esac
14671
14672 : see if prototypes for various gethostxxx netdb.h functions are available
14673 echo " "
14674 set d_gethostprotos gethostent $i_netdb netdb.h
14675 eval $hasproto
14676
14677 : see if getitimer exists
14678 set getitimer d_getitimer
14679 eval $inlibc
14680
14681 : see if getlogin exists
14682 set getlogin d_getlogin
14683 eval $inlibc
14684
14685 : see if getlogin_r exists
14686 set getlogin_r d_getlogin_r
14687 eval $inlibc
14688 case "$d_getlogin_r" in
14689 "$define")
14690         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14691         case "$d_getlogin_r_proto:$usethreads" in
14692         ":define")      d_getlogin_r_proto=define
14693                 set d_getlogin_r_proto getlogin_r $hdrs
14694                 eval $hasproto ;;
14695         *)      ;;
14696         esac
14697         case "$d_getlogin_r_proto" in
14698         define)
14699         case "$getlogin_r_proto" in
14700         ''|0) try='int getlogin_r(char*, size_t);'
14701         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14702         esac
14703         case "$getlogin_r_proto" in
14704         ''|0) try='int getlogin_r(char*, int);'
14705         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14706         esac
14707         case "$getlogin_r_proto" in
14708         ''|0) try='char* getlogin_r(char*, size_t);'
14709         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14710         esac
14711         case "$getlogin_r_proto" in
14712         ''|0) try='char* getlogin_r(char*, int);'
14713         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14714         esac
14715         case "$getlogin_r_proto" in
14716         ''|0)   d_getlogin_r=undef
14717                 getlogin_r_proto=0
14718                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14719         * )     case "$getlogin_r_proto" in
14720                 REENTRANT_PROTO*) ;;
14721                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14722                 esac
14723                 echo "Prototype: $try" ;;
14724         esac
14725         ;;
14726         *)      case "$usethreads" in
14727                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14728                 esac
14729                 d_getlogin_r=undef
14730                 getlogin_r_proto=0
14731                 ;;
14732         esac
14733         ;;
14734 *)      getlogin_r_proto=0
14735         ;;
14736 esac
14737
14738 : see if getmnt exists
14739 set getmnt d_getmnt
14740 eval $inlibc
14741
14742 : see if getmntent exists
14743 set getmntent d_getmntent
14744 eval $inlibc
14745
14746 : see if getnameinfo exists
14747 set getnameinfo d_getnameinfo
14748 eval $inlibc
14749
14750 : see if getnetbyaddr exists
14751 set getnetbyaddr d_getnbyaddr
14752 eval $inlibc
14753
14754 : see if getnetbyname exists
14755 set getnetbyname d_getnbyname
14756 eval $inlibc
14757
14758 : see if getnetent exists
14759 set getnetent d_getnent
14760 eval $inlibc
14761
14762 : see if getnetbyaddr_r exists
14763 set getnetbyaddr_r d_getnetbyaddr_r
14764 eval $inlibc
14765 case "$d_getnetbyaddr_r" in
14766 "$define")
14767         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14768         case "$d_getnetbyaddr_r_proto:$usethreads" in
14769         ":define")      d_getnetbyaddr_r_proto=define
14770                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14771                 eval $hasproto ;;
14772         *)      ;;
14773         esac
14774         case "$d_getnetbyaddr_r_proto" in
14775         define)
14776         case "$getnetbyaddr_r_proto" in
14777         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14778         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14779         esac
14780         case "$getnetbyaddr_r_proto" in
14781         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14782         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14783         esac
14784         case "$getnetbyaddr_r_proto" in
14785         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14786         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14787         esac
14788         case "$getnetbyaddr_r_proto" in
14789         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14790         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14791         esac
14792         case "$getnetbyaddr_r_proto" in
14793         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14794         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14795         esac
14796         case "$getnetbyaddr_r_proto" in
14797         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14798         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14799         esac
14800         case "$getnetbyaddr_r_proto" in
14801         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14802         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14803         esac
14804         case "$getnetbyaddr_r_proto" in
14805         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14806         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14807         esac
14808         case "$getnetbyaddr_r_proto" in
14809         ''|0)   d_getnetbyaddr_r=undef
14810                 getnetbyaddr_r_proto=0
14811                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14812         * )     case "$getnetbyaddr_r_proto" in
14813                 REENTRANT_PROTO*) ;;
14814                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14815                 esac
14816                 echo "Prototype: $try" ;;
14817         esac
14818         ;;
14819         *)      case "$usethreads" in
14820                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14821                 esac
14822                 d_getnetbyaddr_r=undef
14823                 getnetbyaddr_r_proto=0
14824                 ;;
14825         esac
14826         ;;
14827 *)      getnetbyaddr_r_proto=0
14828         ;;
14829 esac
14830
14831 : see if getnetbyname_r exists
14832 set getnetbyname_r d_getnetbyname_r
14833 eval $inlibc
14834 case "$d_getnetbyname_r" in
14835 "$define")
14836         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14837         case "$d_getnetbyname_r_proto:$usethreads" in
14838         ":define")      d_getnetbyname_r_proto=define
14839                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14840                 eval $hasproto ;;
14841         *)      ;;
14842         esac
14843         case "$d_getnetbyname_r_proto" in
14844         define)
14845         case "$getnetbyname_r_proto" in
14846         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14847         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14848         esac
14849         case "$getnetbyname_r_proto" in
14850         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14851         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14852         esac
14853         case "$getnetbyname_r_proto" in
14854         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14855         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14856         esac
14857         case "$getnetbyname_r_proto" in
14858         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14859         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14860         esac
14861         case "$getnetbyname_r_proto" in
14862         ''|0)   d_getnetbyname_r=undef
14863                 getnetbyname_r_proto=0
14864                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14865         * )     case "$getnetbyname_r_proto" in
14866                 REENTRANT_PROTO*) ;;
14867                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14868                 esac
14869                 echo "Prototype: $try" ;;
14870         esac
14871         ;;
14872         *)      case "$usethreads" in
14873                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14874                 esac
14875                 d_getnetbyname_r=undef
14876                 getnetbyname_r_proto=0
14877                 ;;
14878         esac
14879         ;;
14880 *)      getnetbyname_r_proto=0
14881         ;;
14882 esac
14883
14884 : see if getnetent_r exists
14885 set getnetent_r d_getnetent_r
14886 eval $inlibc
14887 case "$d_getnetent_r" in
14888 "$define")
14889         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14890         case "$d_getnetent_r_proto:$usethreads" in
14891         ":define")      d_getnetent_r_proto=define
14892                 set d_getnetent_r_proto getnetent_r $hdrs
14893                 eval $hasproto ;;
14894         *)      ;;
14895         esac
14896         case "$d_getnetent_r_proto" in
14897         define)
14898         case "$getnetent_r_proto" in
14899         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14900         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14901         esac
14902         case "$getnetent_r_proto" in
14903         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14904         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14905         esac
14906         case "$getnetent_r_proto" in
14907         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14908         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14909         esac
14910         case "$getnetent_r_proto" in
14911         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14912         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14913         esac
14914         case "$getnetent_r_proto" in
14915         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14916         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14917         esac
14918         case "$getnetent_r_proto" in
14919         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14920         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14921         esac
14922         case "$getnetent_r_proto" in
14923         ''|0)   d_getnetent_r=undef
14924                 getnetent_r_proto=0
14925                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14926         * )     case "$getnetent_r_proto" in
14927                 REENTRANT_PROTO*) ;;
14928                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14929                 esac
14930                 echo "Prototype: $try" ;;
14931         esac
14932         ;;
14933         *)      case "$usethreads" in
14934                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14935                 esac
14936                 d_getnetent_r=undef
14937                 getnetent_r_proto=0
14938                 ;;
14939         esac
14940         ;;
14941 *)      getnetent_r_proto=0
14942         ;;
14943 esac
14944
14945 : see if prototypes for various getnetxxx netdb.h functions are available
14946 echo " "
14947 set d_getnetprotos getnetent $i_netdb netdb.h
14948 eval $hasproto
14949
14950 : see if getpagesize exists
14951 set getpagesize d_getpagsz
14952 eval $inlibc
14953
14954 : Optional checks for getprotobyname and getprotobynumber
14955
14956 : see if getprotobyname exists
14957 set getprotobyname d_getpbyname
14958 eval $inlibc
14959
14960 : see if getprotobynumber exists
14961 set getprotobynumber d_getpbynumber
14962 eval $inlibc
14963
14964 : see if getprotoent exists
14965 set getprotoent d_getpent
14966 eval $inlibc
14967
14968 : see if getpgid exists
14969 set getpgid d_getpgid
14970 eval $inlibc
14971
14972 : see if getpgrp2 exists
14973 set getpgrp2 d_getpgrp2
14974 eval $inlibc
14975
14976 : see if getppid exists
14977 set getppid d_getppid
14978 eval $inlibc
14979
14980 : see if getpriority exists
14981 set getpriority d_getprior
14982 eval $inlibc
14983
14984 : see if getprotobyname_r exists
14985 set getprotobyname_r d_getprotobyname_r
14986 eval $inlibc
14987 case "$d_getprotobyname_r" in
14988 "$define")
14989         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14990         case "$d_getprotobyname_r_proto:$usethreads" in
14991         ":define")      d_getprotobyname_r_proto=define
14992                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14993                 eval $hasproto ;;
14994         *)      ;;
14995         esac
14996         case "$d_getprotobyname_r_proto" in
14997         define)
14998         case "$getprotobyname_r_proto" in
14999         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15000         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15001         esac
15002         case "$getprotobyname_r_proto" in
15003         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15004         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15005         esac
15006         case "$getprotobyname_r_proto" in
15007         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15008         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15009         esac
15010         case "$getprotobyname_r_proto" in
15011         ''|0)   d_getprotobyname_r=undef
15012                 getprotobyname_r_proto=0
15013                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15014         * )     case "$getprotobyname_r_proto" in
15015                 REENTRANT_PROTO*) ;;
15016                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15017                 esac
15018                 echo "Prototype: $try" ;;
15019         esac
15020         ;;
15021         *)      case "$usethreads" in
15022                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15023                 esac
15024                 d_getprotobyname_r=undef
15025                 getprotobyname_r_proto=0
15026                 ;;
15027         esac
15028         ;;
15029 *)      getprotobyname_r_proto=0
15030         ;;
15031 esac
15032
15033 : see if getprotobynumber_r exists
15034 set getprotobynumber_r d_getprotobynumber_r
15035 eval $inlibc
15036 case "$d_getprotobynumber_r" in
15037 "$define")
15038         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15039         case "$d_getprotobynumber_r_proto:$usethreads" in
15040         ":define")      d_getprotobynumber_r_proto=define
15041                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15042                 eval $hasproto ;;
15043         *)      ;;
15044         esac
15045         case "$d_getprotobynumber_r_proto" in
15046         define)
15047         case "$getprotobynumber_r_proto" in
15048         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15049         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15050         esac
15051         case "$getprotobynumber_r_proto" in
15052         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15053         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15054         esac
15055         case "$getprotobynumber_r_proto" in
15056         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15057         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15058         esac
15059         case "$getprotobynumber_r_proto" in
15060         ''|0)   d_getprotobynumber_r=undef
15061                 getprotobynumber_r_proto=0
15062                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15063         * )     case "$getprotobynumber_r_proto" in
15064                 REENTRANT_PROTO*) ;;
15065                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15066                 esac
15067                 echo "Prototype: $try" ;;
15068         esac
15069         ;;
15070         *)      case "$usethreads" in
15071                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15072                 esac
15073                 d_getprotobynumber_r=undef
15074                 getprotobynumber_r_proto=0
15075                 ;;
15076         esac
15077         ;;
15078 *)      getprotobynumber_r_proto=0
15079         ;;
15080 esac
15081
15082 : see if getprotoent_r exists
15083 set getprotoent_r d_getprotoent_r
15084 eval $inlibc
15085 case "$d_getprotoent_r" in
15086 "$define")
15087         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15088         case "$d_getprotoent_r_proto:$usethreads" in
15089         ":define")      d_getprotoent_r_proto=define
15090                 set d_getprotoent_r_proto getprotoent_r $hdrs
15091                 eval $hasproto ;;
15092         *)      ;;
15093         esac
15094         case "$d_getprotoent_r_proto" in
15095         define)
15096         case "$getprotoent_r_proto" in
15097         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15098         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15099         esac
15100         case "$getprotoent_r_proto" in
15101         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15102         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15103         esac
15104         case "$getprotoent_r_proto" in
15105         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15106         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15107         esac
15108         case "$getprotoent_r_proto" in
15109         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15110         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15111         esac
15112         case "$getprotoent_r_proto" in
15113         ''|0)   d_getprotoent_r=undef
15114                 getprotoent_r_proto=0
15115                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15116         * )     case "$getprotoent_r_proto" in
15117                 REENTRANT_PROTO*) ;;
15118                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15119                 esac
15120                 echo "Prototype: $try" ;;
15121         esac
15122         ;;
15123         *)      case "$usethreads" in
15124                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15125                 esac
15126                 d_getprotoent_r=undef
15127                 getprotoent_r_proto=0
15128                 ;;
15129         esac
15130         ;;
15131 *)      getprotoent_r_proto=0
15132         ;;
15133 esac
15134
15135 : see if prototypes for various getprotoxxx netdb.h functions are available
15136 echo " "
15137 set d_getprotoprotos getprotoent $i_netdb netdb.h
15138 eval $hasproto
15139
15140 : see if getprpwnam exists
15141 set getprpwnam d_getprpwnam
15142 eval $inlibc
15143
15144 : see if getpwent exists
15145 set getpwent d_getpwent
15146 eval $inlibc
15147
15148 : see if getpwent_r exists
15149 set getpwent_r d_getpwent_r
15150 eval $inlibc
15151 case "$d_getpwent_r" in
15152 "$define")
15153         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15154         case "$d_getpwent_r_proto:$usethreads" in
15155         ":define")      d_getpwent_r_proto=define
15156                 set d_getpwent_r_proto getpwent_r $hdrs
15157                 eval $hasproto ;;
15158         *)      ;;
15159         esac
15160         case "$d_getpwent_r_proto" in
15161         define)
15162         case "$getpwent_r_proto" in
15163         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15164         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15165         esac
15166         case "$getpwent_r_proto" in
15167         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15168         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15169         esac
15170         case "$getpwent_r_proto" in
15171         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15172         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15173         esac
15174         case "$getpwent_r_proto" in
15175         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15176         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15177         esac
15178         case "$getpwent_r_proto" in
15179         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15180         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15181         esac
15182         case "$getpwent_r_proto" in
15183         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15184         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15185         esac
15186         case "$getpwent_r_proto" in
15187         ''|0)   d_getpwent_r=undef
15188                 getpwent_r_proto=0
15189                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15190         * )     case "$getpwent_r_proto" in
15191                 REENTRANT_PROTO*) ;;
15192                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15193                 esac
15194                 echo "Prototype: $try" ;;
15195         esac
15196         ;;
15197         *)      case "$usethreads" in
15198                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15199                 esac
15200                 d_getpwent_r=undef
15201                 getpwent_r_proto=0
15202                 ;;
15203         esac
15204         ;;
15205 *)      getpwent_r_proto=0
15206         ;;
15207 esac
15208
15209 : see if getpwnam_r exists
15210 set getpwnam_r d_getpwnam_r
15211 eval $inlibc
15212 case "$d_getpwnam_r" in
15213 "$define")
15214         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15215         case "$d_getpwnam_r_proto:$usethreads" in
15216         ":define")      d_getpwnam_r_proto=define
15217                 set d_getpwnam_r_proto getpwnam_r $hdrs
15218                 eval $hasproto ;;
15219         *)      ;;
15220         esac
15221         case "$d_getpwnam_r_proto" in
15222         define)
15223         case "$getpwnam_r_proto" in
15224         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15225         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15226         esac
15227         case "$getpwnam_r_proto" in
15228         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15229         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15230         esac
15231         case "$getpwnam_r_proto" in
15232         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15233         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15234         esac
15235         case "$getpwnam_r_proto" in
15236         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15237         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15238         esac
15239         case "$getpwnam_r_proto" in
15240         ''|0)   d_getpwnam_r=undef
15241                 getpwnam_r_proto=0
15242                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15243         * )     case "$getpwnam_r_proto" in
15244                 REENTRANT_PROTO*) ;;
15245                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15246                 esac
15247                 echo "Prototype: $try" ;;
15248         esac
15249         ;;
15250         *)      case "$usethreads" in
15251                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15252                 esac
15253                 d_getpwnam_r=undef
15254                 getpwnam_r_proto=0
15255                 ;;
15256         esac
15257         ;;
15258 *)      getpwnam_r_proto=0
15259         ;;
15260 esac
15261
15262 : see if getpwuid_r exists
15263 set getpwuid_r d_getpwuid_r
15264 eval $inlibc
15265 case "$d_getpwuid_r" in
15266 "$define")
15267         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15268         case "$d_getpwuid_r_proto:$usethreads" in
15269         ":define")      d_getpwuid_r_proto=define
15270                 set d_getpwuid_r_proto getpwuid_r $hdrs
15271                 eval $hasproto ;;
15272         *)      ;;
15273         esac
15274         case "$d_getpwuid_r_proto" in
15275         define)
15276         case "$getpwuid_r_proto" in
15277         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15278         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15279         esac
15280         case "$getpwuid_r_proto" in
15281         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15282         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15283         esac
15284         case "$getpwuid_r_proto" in
15285         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15286         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15287         esac
15288         case "$getpwuid_r_proto" in
15289         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15290         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15291         esac
15292         case "$getpwuid_r_proto" in
15293         ''|0)   d_getpwuid_r=undef
15294                 getpwuid_r_proto=0
15295                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15296         * )     case "$getpwuid_r_proto" in
15297                 REENTRANT_PROTO*) ;;
15298                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15299                 esac
15300                 echo "Prototype: $try" ;;
15301         esac
15302         ;;
15303         *)      case "$usethreads" in
15304                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15305                 esac
15306                 d_getpwuid_r=undef
15307                 getpwuid_r_proto=0
15308                 ;;
15309         esac
15310         ;;
15311 *)      getpwuid_r_proto=0
15312         ;;
15313 esac
15314
15315 : Optional checks for getsbyname and getsbyport
15316
15317 : see if getservbyname exists
15318 set getservbyname d_getsbyname
15319 eval $inlibc
15320
15321 : see if getservbyport exists
15322 set getservbyport d_getsbyport
15323 eval $inlibc
15324
15325 : see if getservent exists
15326 set getservent d_getsent
15327 eval $inlibc
15328
15329 : see if getservbyname_r exists
15330 set getservbyname_r d_getservbyname_r
15331 eval $inlibc
15332 case "$d_getservbyname_r" in
15333 "$define")
15334         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15335         case "$d_getservbyname_r_proto:$usethreads" in
15336         ":define")      d_getservbyname_r_proto=define
15337                 set d_getservbyname_r_proto getservbyname_r $hdrs
15338                 eval $hasproto ;;
15339         *)      ;;
15340         esac
15341         case "$d_getservbyname_r_proto" in
15342         define)
15343         case "$getservbyname_r_proto" in
15344         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15345         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15346         esac
15347         case "$getservbyname_r_proto" in
15348         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15349         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15350         esac
15351         case "$getservbyname_r_proto" in
15352         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15353         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15354         esac
15355         case "$getservbyname_r_proto" in
15356         ''|0)   d_getservbyname_r=undef
15357                 getservbyname_r_proto=0
15358                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15359         * )     case "$getservbyname_r_proto" in
15360                 REENTRANT_PROTO*) ;;
15361                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15362                 esac
15363                 echo "Prototype: $try" ;;
15364         esac
15365         ;;
15366         *)      case "$usethreads" in
15367                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15368                 esac
15369                 d_getservbyname_r=undef
15370                 getservbyname_r_proto=0
15371                 ;;
15372         esac
15373         ;;
15374 *)      getservbyname_r_proto=0
15375         ;;
15376 esac
15377
15378 : see if getservbyport_r exists
15379 set getservbyport_r d_getservbyport_r
15380 eval $inlibc
15381 case "$d_getservbyport_r" in
15382 "$define")
15383         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15384         case "$d_getservbyport_r_proto:$usethreads" in
15385         ":define")      d_getservbyport_r_proto=define
15386                 set d_getservbyport_r_proto getservbyport_r $hdrs
15387                 eval $hasproto ;;
15388         *)      ;;
15389         esac
15390         case "$d_getservbyport_r_proto" in
15391         define)
15392         case "$getservbyport_r_proto" in
15393         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15394         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15395         esac
15396         case "$getservbyport_r_proto" in
15397         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15398         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15399         esac
15400         case "$getservbyport_r_proto" in
15401         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15402         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15403         esac
15404         case "$getservbyport_r_proto" in
15405         ''|0)   d_getservbyport_r=undef
15406                 getservbyport_r_proto=0
15407                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15408         * )     case "$getservbyport_r_proto" in
15409                 REENTRANT_PROTO*) ;;
15410                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15411                 esac
15412                 echo "Prototype: $try" ;;
15413         esac
15414         ;;
15415         *)      case "$usethreads" in
15416                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15417                 esac
15418                 d_getservbyport_r=undef
15419                 getservbyport_r_proto=0
15420                 ;;
15421         esac
15422         ;;
15423 *)      getservbyport_r_proto=0
15424         ;;
15425 esac
15426
15427 : see if getservent_r exists
15428 set getservent_r d_getservent_r
15429 eval $inlibc
15430 case "$d_getservent_r" in
15431 "$define")
15432         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15433         case "$d_getservent_r_proto:$usethreads" in
15434         ":define")      d_getservent_r_proto=define
15435                 set d_getservent_r_proto getservent_r $hdrs
15436                 eval $hasproto ;;
15437         *)      ;;
15438         esac
15439         case "$d_getservent_r_proto" in
15440         define)
15441         case "$getservent_r_proto" in
15442         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15443         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15444         esac
15445         case "$getservent_r_proto" in
15446         ''|0) try='int getservent_r(struct servent*, char*, int);'
15447         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15448         esac
15449         case "$getservent_r_proto" in
15450         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15451         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15452         esac
15453         case "$getservent_r_proto" in
15454         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15455         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15456         esac
15457         case "$getservent_r_proto" in
15458         ''|0)   d_getservent_r=undef
15459                 getservent_r_proto=0
15460                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15461         * )     case "$getservent_r_proto" in
15462                 REENTRANT_PROTO*) ;;
15463                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15464                 esac
15465                 echo "Prototype: $try" ;;
15466         esac
15467         ;;
15468         *)      case "$usethreads" in
15469                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15470                 esac
15471                 d_getservent_r=undef
15472                 getservent_r_proto=0
15473                 ;;
15474         esac
15475         ;;
15476 *)      getservent_r_proto=0
15477         ;;
15478 esac
15479
15480 : see if prototypes for various getservxxx netdb.h functions are available
15481 echo " "
15482 set d_getservprotos getservent $i_netdb netdb.h
15483 eval $hasproto
15484
15485 : see if getspnam exists
15486 set getspnam d_getspnam
15487 eval $inlibc
15488
15489 : see if this is a shadow.h system
15490 set shadow.h i_shadow
15491 eval $inhdr
15492
15493 : see if getspnam_r exists
15494 set getspnam_r d_getspnam_r
15495 eval $inlibc
15496 case "$d_getspnam_r" in
15497 "$define")
15498         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15499         case "$d_getspnam_r_proto:$usethreads" in
15500         ":define")      d_getspnam_r_proto=define
15501                 set d_getspnam_r_proto getspnam_r $hdrs
15502                 eval $hasproto ;;
15503         *)      ;;
15504         esac
15505         case "$d_getspnam_r_proto" in
15506         define)
15507         case "$getspnam_r_proto" in
15508         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15509         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15510         esac
15511         case "$getspnam_r_proto" in
15512         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15513         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15514         esac
15515         case "$getspnam_r_proto" in
15516         ''|0)   d_getspnam_r=undef
15517                 getspnam_r_proto=0
15518                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15519         * )     case "$getspnam_r_proto" in
15520                 REENTRANT_PROTO*) ;;
15521                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15522                 esac
15523                 echo "Prototype: $try" ;;
15524         esac
15525         ;;
15526         *)      case "$usethreads" in
15527                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15528                 esac
15529                 d_getspnam_r=undef
15530                 getspnam_r_proto=0
15531                 ;;
15532         esac
15533         ;;
15534 *)      getspnam_r_proto=0
15535         ;;
15536 esac
15537
15538 : see if gettimeofday or ftime exists
15539 set gettimeofday d_gettimeod
15540 eval $inlibc
15541 case "$d_gettimeod" in
15542 "$undef")
15543         set ftime d_ftime 
15544         eval $inlibc
15545         ;;
15546 *)
15547         val="$undef"; set d_ftime; eval $setvar
15548         ;;
15549 esac
15550 case "$d_gettimeod$d_ftime" in
15551 "$undef$undef")
15552         echo " "
15553         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15554         ;;
15555 esac
15556
15557 : see if gmtime_r exists
15558 set gmtime_r d_gmtime_r
15559 eval $inlibc
15560 case "$d_gmtime_r" in
15561 "$define")
15562         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15563         case "$d_gmtime_r_proto:$usethreads" in
15564         ":define")      d_gmtime_r_proto=define
15565                 set d_gmtime_r_proto gmtime_r $hdrs
15566                 eval $hasproto ;;
15567         *)      ;;
15568         esac
15569         case "$d_gmtime_r_proto" in
15570         define)
15571         case "$gmtime_r_proto" in
15572         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15573         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15574         esac
15575         case "$gmtime_r_proto" in
15576         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15577         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15578         esac
15579         case "$gmtime_r_proto" in
15580         ''|0)   d_gmtime_r=undef
15581                 gmtime_r_proto=0
15582                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15583         * )     case "$gmtime_r_proto" in
15584                 REENTRANT_PROTO*) ;;
15585                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15586                 esac
15587                 echo "Prototype: $try" ;;
15588         esac
15589         ;;
15590         *)      case "$usethreads" in
15591                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15592                 esac
15593                 d_gmtime_r=undef
15594                 gmtime_r_proto=0
15595                 ;;
15596         esac
15597         ;;
15598 *)      gmtime_r_proto=0
15599         ;;
15600 esac
15601
15602 : see if hasmntopt exists
15603 set hasmntopt d_hasmntopt
15604 eval $inlibc
15605
15606 : see if this is a netinet/in.h or sys/in.h system
15607 set netinet/in.h i_niin sys/in.h i_sysin
15608 eval $inhdr
15609
15610 : see if arpa/inet.h has to be included
15611 set arpa/inet.h i_arpainet
15612 eval $inhdr
15613
15614 : see if htonl --and friends-- exists
15615 val=''
15616 set htonl val
15617 eval $inlibc
15618
15619 : Maybe they are macros.
15620 case "$val" in
15621 $undef)
15622         $cat >htonl.c <<EOM
15623 #include <stdio.h>
15624 #include <sys/types.h>
15625 #$i_niin I_NETINET_IN
15626 #$i_sysin I_SYS_IN
15627 #$i_arpainet I_ARPA_INET
15628 #ifdef I_NETINET_IN
15629 #include <netinet/in.h>
15630 #endif
15631 #ifdef I_SYS_IN
15632 #include <sys/in.h>
15633 #endif
15634 #ifdef I_ARPA_INET
15635 #include <arpa/inet.h>
15636 #endif
15637 #ifdef htonl
15638 printf("Defined as a macro.");
15639 #endif
15640 EOM
15641         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15642         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15643                 val="$define"
15644                 echo "But it seems to be defined as a macro." >&4
15645         fi
15646         $rm -f htonl.?
15647         ;;
15648 esac
15649 set d_htonl
15650 eval $setvar
15651
15652 : see if hypot exists
15653 set hypot d_hypot
15654 eval $inlibc
15655
15656 : see if ilogb exists
15657 set ilogb d_ilogb
15658 eval $inlibc
15659
15660 : see if ilogbl exists
15661 set ilogbl d_ilogbl
15662 eval $inlibc
15663
15664 : index or strchr
15665 echo " "
15666 if set index val -f; eval $csym; $val; then
15667         if set strchr val -f d_strchr; eval $csym; $val; then
15668                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15669                         val="$define"
15670                         vali="$undef"
15671                         echo "strchr() found." >&4
15672                 else
15673                         val="$undef"
15674                         vali="$define"
15675                         echo "index() found." >&4
15676                 fi
15677         else
15678                 val="$undef"
15679                 vali="$define"
15680                 echo "index() found." >&4
15681         fi
15682 else
15683         if set strchr val -f d_strchr; eval $csym; $val; then
15684                 val="$define"
15685                 vali="$undef"
15686                 echo "strchr() found." >&4
15687         else
15688                 echo "No index() or strchr() found!" >&4
15689                 val="$undef"
15690                 vali="$undef"
15691         fi
15692 fi
15693 set d_strchr; eval $setvar
15694 val="$vali"
15695 set d_index; eval $setvar
15696
15697 : check whether inet_aton exists
15698 set inet_aton d_inetaton
15699 eval $inlibc
15700
15701 : see if inet_ntop exists
15702 set inet_ntop d_inetntop
15703 eval $inlibc
15704
15705 : see if inet_pton exists
15706 set inet_pton d_inetpton
15707 eval $inlibc
15708
15709 : Look for isascii
15710 echo " "
15711 $cat >isascii.c <<EOCP
15712 #include <stdio.h>
15713 #include <ctype.h>
15714 #$i_stdlib I_STDLIB
15715 #ifdef I_STDLIB
15716 #include <stdlib.h>
15717 #endif
15718 int main() {
15719         int c = 'A';
15720         if (isascii(c))
15721                 exit(0);
15722         else
15723                 exit(1);
15724 }
15725 EOCP
15726 set isascii
15727 if eval $compile; then
15728         echo "isascii() found." >&4
15729         val="$define"
15730 else
15731         echo "isascii() NOT found." >&4
15732         val="$undef"
15733 fi
15734 set d_isascii
15735 eval $setvar
15736 $rm -f isascii*
15737
15738 : Look for isblank
15739 echo " "
15740 $cat >isblank.c <<'EOCP'
15741 #include <stdio.h>
15742 #include <ctype.h>
15743 int main() {
15744         int c = ' ';
15745         if (isblank(c))
15746                 return 0 ;
15747         else
15748                 return 1 ;
15749 }
15750 EOCP
15751 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15752         echo "isblank() found." >&4
15753         val="$define"
15754 else
15755         echo "isblank() NOT found." >&4
15756         val="$undef"
15757 fi
15758 set d_isblank
15759 eval $setvar
15760 $rm -f isblank*
15761
15762 : check for isfinite
15763 echo "Checking to see if you have isfinite..." >&4
15764 $cat >try.c <<EOCP
15765 #$i_math I_MATH
15766 #ifdef I_MATH
15767 #include <math.h>
15768 #endif
15769 int main() { return isfinite(0.0); }
15770 EOCP
15771 set try
15772 if eval $compile; then
15773         val="$define"
15774         echo "You have isfinite."
15775 else
15776         val="$undef"
15777         echo "You do not have isfinite."
15778 fi
15779 $rm_try
15780 set d_isfinite
15781 eval $setvar
15782
15783 : see if isfinitel exists
15784 set isfinitel d_isfinitel
15785 eval $inlibc
15786
15787 : check for isinf
15788 echo "Checking to see if you have isinf..." >&4
15789 $cat >try.c <<EOCP
15790 #$i_math I_MATH
15791 #ifdef I_MATH
15792 #include <math.h>
15793 #endif
15794 int main() { return isinf(0.0); }
15795 EOCP
15796 set try
15797 if eval $compile; then
15798         val="$define"
15799         echo "You have isinf."
15800 else
15801         val="$undef"
15802         echo "You do not have isinf."
15803 fi
15804 $rm_try
15805 set d_isinf
15806 eval $setvar
15807
15808 : see if isinfl exists
15809 set isinfl d_isinfl
15810 eval $inlibc
15811
15812 : check for isless
15813 echo "Checking to see if you have isless..." >&4
15814 $cat >try.c <<EOCP
15815 #$i_math I_MATH
15816 #ifdef I_MATH
15817 #include <math.h>
15818 #endif
15819 int main() { return isless(0.0); }
15820 EOCP
15821 set try
15822 if eval $compile; then
15823         val="$define"
15824         echo "You have isless."
15825 else
15826         val="$undef"
15827         echo "You do not have isless."
15828 fi
15829 $rm_try
15830 set d_isless
15831 eval $setvar
15832
15833 : check for isnan
15834 echo "Checking to see if you have isnan..." >&4
15835 $cat >try.c <<EOCP
15836 #$i_math I_MATH
15837 #ifdef I_MATH
15838 #include <math.h>
15839 #endif
15840 int main() { return isnan(0.0); }
15841 EOCP
15842 set try
15843 if eval $compile; then
15844         val="$define"
15845         echo "You have isnan."
15846 else
15847         val="$undef"
15848         echo "You do not have isnan."
15849 fi
15850 $rm_try
15851 set d_isnan
15852 eval $setvar
15853
15854 : see if isnanl exists
15855 set isnanl d_isnanl
15856 eval $inlibc
15857
15858 : check for isnormal
15859 echo "Checking to see if you have isnormal..." >&4
15860 $cat >try.c <<EOCP
15861 #$i_math I_MATH
15862 #ifdef I_MATH
15863 #include <math.h>
15864 #endif
15865 int main() { return isnormal(0.0); }
15866 EOCP
15867 set try
15868 if eval $compile; then
15869         val="$define"
15870         echo "You have isnormal."
15871 else
15872         val="$undef"
15873         echo "You do not have isnormal."
15874 fi
15875 $rm_try
15876 set d_isnormal
15877 eval $setvar
15878
15879 : see if j0 exists
15880 set j0 d_j0
15881 eval $inlibc
15882
15883 : see if j0l exists
15884 set j0l d_j0l
15885 eval $inlibc
15886
15887 : see if killpg exists
15888 set killpg d_killpg
15889 eval $inlibc
15890
15891 : see if localeconv exists
15892 set localeconv d_locconv
15893 eval $inlibc
15894
15895 : see if libc has the POSIX.1-2008 currency locale rules
15896 case "$d_locconv:$d_lc_monetary_2008" in
15897 $define:)
15898         $cat >try.c <<EOCP
15899 #include <locale.h>
15900 int main() {
15901         struct lconv *lc = localeconv();
15902         char int_p_cs_precedes = lc->int_p_cs_precedes;
15903         return 0;
15904 }
15905 EOCP
15906         set try
15907         if eval $compile; then
15908                 d_lc_monetary_2008="$define"
15909         else
15910                 d_lc_monetary_2008="$undef"
15911         fi;
15912         $rm_try
15913         ;;
15914 esac
15915
15916 : see if lchown exists
15917 echo " "
15918 $cat > try.c <<'EOCP'
15919 /* System header to define __stub macros and hopefully few prototypes,
15920     which can conflict with char lchown(); below.  */
15921 #include <assert.h>
15922 /* Override any gcc2 internal prototype to avoid an error.  */
15923 /* We use char because int might match the return type of a gcc2
15924    builtin and then its argument prototype would still apply.  */
15925 char lchown();
15926 int main() {
15927     /*  The GNU C library defines this for functions which it implements
15928         to always fail with ENOSYS.  Some functions are actually named
15929         something starting with __ and the normal name is an alias.  */
15930 #if defined (__stub_lchown) || defined (__stub___lchown)
15931 choke me
15932 #else
15933 lchown();
15934 #endif
15935 ; return 0; }
15936 EOCP
15937 set try
15938 if eval $compile; then
15939     $echo "lchown() found." >&4
15940     val="$define"
15941 else
15942     $echo "lchown() NOT found." >&4
15943     val="$undef"
15944 fi
15945 set d_lchown
15946 eval $setvar
15947
15948 : See if number of significant digits in a double precision number is known
15949 echo " "
15950 $cat >ldbl_dig.c <<EOM
15951 #$i_limits I_LIMITS
15952 #$i_float I_FLOAT
15953 #ifdef I_LIMITS
15954 #include <limits.h>
15955 #endif
15956 #ifdef I_FLOAT
15957 #include <float.h>
15958 #endif
15959 #ifdef LDBL_DIG
15960 printf("Contains LDBL_DIG");
15961 #endif
15962 EOM
15963 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15964 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15965         echo "LDBL_DIG found." >&4
15966         val="$define"
15967 else
15968         echo "LDBL_DIG NOT found." >&4
15969         val="$undef"
15970 fi
15971 $rm -f ldbl_dig.?
15972 set d_ldbl_dig
15973 eval $setvar
15974
15975 : see if lgamma exists
15976 set lgamma d_lgamma
15977 eval $inlibc
15978
15979 : see if lgamma_r exists
15980 set lgamma_r d_lgamma_r
15981 eval $inlibc
15982
15983 : check to see if math.h defines _LIB_VERSION
15984 d_libm_lib_version="$undef"
15985 case $i_math in
15986     $define)
15987         echo " "
15988         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15989         $cat >try.c <<EOCP
15990 #include <unistd.h>
15991 #include <math.h>
15992 int main (int argc, char *argv[])
15993 {
15994     printf ("%d\n", _LIB_VERSION);
15995     return (0);
15996     } /* main */
15997 EOCP
15998         set try
15999         if eval $compile; then
16000             foo=`$run ./try`
16001             echo "Yes, it does ($foo)" >&4
16002             d_libm_lib_version="$define"
16003         else
16004             echo "No, it does not (probably harmless)" >&4
16005             fi
16006         $rm_try
16007         ;;
16008
16009     esac
16010
16011 : see if link exists
16012 set link d_link
16013 eval $inlibc
16014
16015 : see if llrint exists
16016 set llrint d_llrint
16017 eval $inlibc
16018
16019 : see if llround exists
16020 set llround d_llround
16021 eval $inlibc
16022
16023 : see if localtime_r exists
16024 set localtime_r d_localtime_r
16025 eval $inlibc
16026 case "$d_localtime_r" in
16027 "$define")
16028         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16029         case "$d_localtime_r_proto:$usethreads" in
16030         ":define")      d_localtime_r_proto=define
16031                 set d_localtime_r_proto localtime_r $hdrs
16032                 eval $hasproto ;;
16033         *)      ;;
16034         esac
16035         case "$d_localtime_r_proto" in
16036         define)
16037         case "$localtime_r_proto" in
16038         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16039         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16040         esac
16041         case "$localtime_r_proto" in
16042         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16043         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16044         esac
16045         case "$localtime_r_proto" in
16046         ''|0)   d_localtime_r=undef
16047                 localtime_r_proto=0
16048                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16049         * )     case "$localtime_r_proto" in
16050                 REENTRANT_PROTO*) ;;
16051                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16052                 esac
16053                 echo "Prototype: $try" ;;
16054         esac
16055         ;;
16056         *)      case "$usethreads" in
16057                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16058                 esac
16059                 d_localtime_r=undef
16060                 localtime_r_proto=0
16061                 ;;
16062         esac
16063         ;;
16064 *)      localtime_r_proto=0
16065         ;;
16066 esac
16067
16068 : see if localtime_r calls tzset
16069 case "$localtime_r_proto" in
16070 REENTRANT_PROTO*)
16071         $cat >try.c <<EOCP
16072 /*  Does our libc's localtime_r call tzset ?
16073  *  return 0 if so, 1 otherwise.
16074  */
16075 #$i_systypes    I_SYS_TYPES
16076 #$i_unistd      I_UNISTD
16077 #$i_time        I_TIME
16078 #$i_stdlib      I_STDLIB
16079 #$i_string      I_STRING
16080 #$i_malloc      I_MALLOC
16081 #ifdef I_SYS_TYPES
16082 #  include <sys/types.h>
16083 #endif
16084 #ifdef I_UNISTD
16085 #  include <unistd.h>
16086 #endif
16087 #ifdef I_TIME
16088 #  include <time.h>
16089 #endif
16090 #ifdef I_STDLIB
16091 #include <stdlib.h>
16092 #endif
16093 #ifdef I_STRING
16094 #  include <string.h>
16095 #else
16096 #  include <strings.h>
16097 #endif
16098 #ifdef I_MALLOC
16099 #  include <malloc.h>
16100 #endif
16101 int main()
16102 {
16103     time_t t = time(0L);
16104     char w_tz[]="TZ" "=GMT+5",
16105          e_tz[]="TZ" "=GMT-5",
16106         *tz_e = (char*)malloc(16),
16107         *tz_w = (char*)malloc(16);
16108     struct tm tm_e, tm_w;
16109     memset(&tm_e,'\0',sizeof(struct tm));
16110     memset(&tm_w,'\0',sizeof(struct tm));
16111     strcpy(tz_e,e_tz);
16112     strcpy(tz_w,w_tz);
16113
16114     putenv(tz_e);
16115     localtime_r(&t, &tm_e);
16116
16117     putenv(tz_w);
16118     localtime_r(&t, &tm_w);
16119
16120     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16121         return 1;
16122     return 0;
16123 }
16124 EOCP
16125         set try
16126         if eval $compile; then
16127             if $run ./try; then
16128                 d_localtime_r_needs_tzset=undef;
16129             else
16130                 d_localtime_r_needs_tzset=define;
16131             fi;
16132         else
16133             d_localtime_r_needs_tzset=undef;
16134         fi;
16135      ;;
16136   *)
16137      d_localtime_r_needs_tzset=undef;
16138      ;;
16139 esac
16140 $rm_try
16141
16142 : see if lockf exists
16143 set lockf d_lockf
16144 eval $inlibc
16145
16146 : see if log1p exists
16147 set log1p d_log1p
16148 eval $inlibc
16149
16150 : see if log2 exists
16151 set log2 d_log2
16152 eval $inlibc
16153
16154 : see if logb exists
16155 set logb d_logb
16156 eval $inlibc
16157
16158 : see if lrint exists
16159 set lrint d_lrint
16160 eval $inlibc
16161
16162 : see if lround exists
16163 set lround d_lround
16164 eval $inlibc
16165
16166 : see if prototype for lseek is available
16167 echo " "
16168 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16169 eval $hasproto
16170
16171 : see if lstat exists
16172 set lstat d_lstat
16173 eval $inlibc
16174
16175 : see if madvise exists
16176 set madvise d_madvise
16177 eval $inlibc
16178
16179 : see if malloc_size exists
16180 set malloc_size d_malloc_size
16181 eval $inlibc
16182
16183 : see if malloc_size_good exists
16184 set malloc_good_size d_malloc_good_size
16185 eval $inlibc
16186
16187 : see if mblen exists
16188 set mblen d_mblen
16189 eval $inlibc
16190
16191 : see if mbstowcs exists
16192 set mbstowcs d_mbstowcs
16193 eval $inlibc
16194
16195 : see if mbtowc exists
16196 set mbtowc d_mbtowc
16197 eval $inlibc
16198
16199 : see if memchr exists
16200 set memchr d_memchr
16201 eval $inlibc
16202
16203 : see if memcmp exists
16204 set memcmp d_memcmp
16205 eval $inlibc
16206
16207 : see if memcpy exists
16208 set memcpy d_memcpy
16209 eval $inlibc
16210
16211 : see if memmove exists
16212 set memmove d_memmove
16213 eval $inlibc
16214
16215 : see if memset exists
16216 set memset d_memset
16217 eval $inlibc
16218
16219 : see if mkdir exists
16220 set mkdir d_mkdir
16221 eval $inlibc
16222
16223 : see if mkdtemp exists
16224 set mkdtemp d_mkdtemp
16225 eval $inlibc
16226
16227 : see if mkfifo exists
16228 set mkfifo d_mkfifo
16229 eval $inlibc
16230
16231 : see if mkstemp exists
16232 set mkstemp d_mkstemp
16233 eval $inlibc
16234
16235 : see if mkstemps exists
16236 set mkstemps d_mkstemps
16237 eval $inlibc
16238
16239 : see if mktime exists
16240 set mktime d_mktime
16241 eval $inlibc
16242
16243 : see if this is a sys/mman.h system
16244 set sys/mman.h i_sysmman
16245 eval $inhdr
16246
16247 : see if mmap exists
16248 set mmap d_mmap
16249 eval $inlibc
16250 : see what shmat returns
16251 : default to something harmless
16252 mmaptype='void *'
16253 case "$i_sysmman$d_mmap" in
16254 "$define$define")
16255         $cat >mmap.c <<'END'
16256 #include <sys/mman.h>
16257 void *mmap();
16258 END
16259         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16260                 mmaptype='void *'
16261         else
16262                 mmaptype='caddr_t'
16263         fi
16264         echo "and it returns ($mmaptype)." >&4
16265         ;;
16266 esac
16267
16268
16269
16270 : see if sqrtl exists
16271 set sqrtl d_sqrtl
16272 eval $inlibc
16273
16274 : see if scalbnl exists
16275 set scalbnl d_scalbnl
16276 eval $inlibc
16277
16278 : see if truncl exists
16279 set truncl d_truncl
16280 eval $inlibc
16281
16282 : see if modfl exists
16283 set modfl d_modfl
16284 eval $inlibc
16285
16286 : see if prototype for modfl is available
16287 echo " "
16288 set d_modflproto modfl $i_math math.h
16289 eval $hasproto
16290
16291 d_modfl_pow32_bug="$undef"
16292
16293 case "$d_longdbl$d_modfl" in
16294 $define$define)
16295         $cat <<EOM
16296 Checking to see whether your modfl() is okay for large values...
16297 EOM
16298 $cat >try.c <<EOCP
16299 #include <math.h>
16300 #include <stdio.h>
16301 EOCP
16302 if $test "X$d_modflproto" != "X$define"; then
16303         $cat >>try.c <<EOCP
16304 /* Sigh. many current glibcs provide the function, but do not prototype it. */
16305 long double modfl (long double, long double *);
16306 EOCP
16307 fi
16308 $cat >>try.c <<EOCP
16309 int main() {
16310     long double nv = 4294967303.15;
16311     long double v, w;
16312     v = modfl(nv, &w);
16313 #ifdef __GLIBC__
16314     printf("glibc");
16315 #endif
16316     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
16317     return 0;
16318 }
16319 EOCP
16320         case "$osname:$gccversion" in
16321         aix:)   saveccflags="$ccflags"
16322                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
16323         esac
16324         set try
16325         if eval $compile; then
16326                 foo=`$run ./try`
16327                 case "$foo" in
16328                 *" 4294967303.150000 1.150000 4294967302.000000")
16329                         echo >&4 "Your modfl() is broken for large values."
16330                         d_modfl_pow32_bug="$define"
16331                         case "$foo" in
16332                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
16333                         ;;
16334                         esac
16335                         ;;
16336                 *" 4294967303.150000 0.150000 4294967303.000000")
16337                         echo >&4 "Your modfl() seems okay for large values."
16338                         ;;
16339                 *)      echo >&4 "I don't understand your modfl() at all."
16340                         d_modfl="$undef"
16341                         ;;
16342                 esac
16343                 $rm_try
16344         else
16345                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
16346                 d_modfl="$undef"
16347         fi
16348         case "$osname:$gccversion" in
16349         aix:)   ccflags="$saveccflags" ;; # restore
16350         esac
16351         ;;
16352 esac
16353
16354 if $test "$uselongdouble" = "$define"; then
16355     message=""
16356     if $test "$d_sqrtl" != "$define"; then
16357         message="$message sqrtl"
16358     fi
16359     if $test "$d_modfl" != "$define"; then
16360         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16361             echo "You have both truncl and copysignl, so I can emulate modfl."
16362         else
16363             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16364                 echo "You have both aintl and copysignl, so I can emulate modfl."
16365             else
16366                 message="$message modfl"
16367             fi
16368         fi
16369     fi
16370     if $test "$d_frexpl" != "$define"; then
16371         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16372             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16373         else
16374             message="$message frexpl"
16375         fi
16376     fi
16377     if $test "$d_ldexpl" != "$define"; then
16378         message="$message ldexpl"
16379     fi
16380
16381     if $test "$message" != ""; then
16382         $cat <<EOM >&4
16383
16384 *** You requested the use of long doubles but you do not seem to have
16385 *** the following mathematical functions needed for long double support:
16386 ***    $message
16387 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16388 *** Cannot continue, aborting.
16389
16390 EOM
16391
16392         exit 1
16393     fi
16394 fi
16395
16396 : see if mprotect exists
16397 set mprotect d_mprotect
16398 eval $inlibc
16399
16400 : see if msgctl exists
16401 set msgctl d_msgctl
16402 eval $inlibc
16403
16404 : see if msgget exists
16405 set msgget d_msgget
16406 eval $inlibc
16407
16408 : see if msgsnd exists
16409 set msgsnd d_msgsnd
16410 eval $inlibc
16411
16412 : see if msgrcv exists
16413 set msgrcv d_msgrcv
16414 eval $inlibc
16415
16416 : see how much of the 'msg*(2)' library is present.
16417 h_msg=true
16418 echo " "
16419 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16420 *"$undef"*) h_msg=false;;
16421 esac
16422 case "$osname" in
16423 freebsd)
16424     case "`ipcs 2>&1`" in
16425     "SVID messages"*"not configured"*)
16426         echo "Your $osname does not have the msg*(2) configured." >&4
16427         h_msg=false
16428         val="$undef"
16429         set msgctl d_msgctl
16430         eval $setvar
16431         set msgget d_msgget
16432         eval $setvar
16433         set msgsnd d_msgsnd
16434         eval $setvar
16435         set msgrcv d_msgrcv
16436         eval $setvar
16437         ;;
16438     esac
16439     ;;
16440 esac
16441 : we could also check for sys/ipc.h ...
16442 if $h_msg && $test `./findhdr sys/msg.h`; then
16443         echo "You have the full msg*(2) library." >&4
16444         val="$define"
16445 else
16446         echo "You don't have the full msg*(2) library." >&4
16447         val="$undef"
16448 fi
16449 set d_msg
16450 eval $setvar
16451
16452 : Check for msghdr_s
16453 echo " "
16454 echo "Checking to see if your system supports struct msghdr..." >&4
16455 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16456 eval $hasstruct
16457 case "$d_msghdr_s" in
16458 "$define")      echo "Yes, it does."   ;;
16459 *)              echo "No, it doesn't." ;;
16460 esac
16461
16462
16463 : see if msync exists
16464 set msync d_msync
16465 eval $inlibc
16466
16467 : see if munmap exists
16468 set munmap d_munmap
16469 eval $inlibc
16470
16471 : see if nan exists
16472 set nan d_nan
16473 eval $inlibc
16474
16475 : see if nearbyint exists
16476 set nearbyint d_nearbyint
16477 eval $inlibc
16478
16479 : see if nextafter exists
16480 set nextafter d_nextafter
16481 eval $inlibc
16482
16483 : see if nexttoward exists
16484 set nexttoward d_nexttoward
16485 eval $inlibc
16486
16487 : see if nice exists
16488 set nice d_nice
16489 eval $inlibc
16490
16491 : see if this is a langinfo.h system
16492 set langinfo.h i_langinfo
16493 eval $inhdr
16494
16495 : see if nl_langinfo exists
16496 set nl_langinfo d_nl_langinfo
16497 eval $inlibc
16498
16499 : see if this is a quadmath.h system
16500 set quadmath.h i_quadmath
16501 eval $inhdr
16502
16503 : check for volatile keyword
16504 echo " "
16505 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
16506 $cat >try.c <<'EOCP'
16507 int main()
16508 {
16509         typedef struct _goo_struct goo_struct;
16510         goo_struct * volatile goo = ((goo_struct *)0);
16511         struct _goo_struct {
16512                 long long_int;
16513                 int reg_int;
16514                 char char_var;
16515         };
16516         typedef unsigned short foo_t;
16517         char *volatile foo;
16518         volatile int bar;
16519         volatile foo_t blech;
16520         foo = foo;
16521 }
16522 EOCP
16523 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
16524         val="$define"
16525         echo "Yup, it does."
16526 else
16527         val="$undef"
16528         echo "Nope, it doesn't."
16529 fi
16530 set d_volatile
16531 eval $setvar
16532 $rm_try
16533
16534 : Check basic sizes
16535 echo " "
16536 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16537
16538 case "$use64bitint:$d_quad:$quadtype" in
16539 define:define:?*)
16540         ivtype="$quadtype"
16541         uvtype="$uquadtype"
16542         ivsize=8
16543         uvsize=8
16544         ;;
16545 *)      ivtype="long"
16546         uvtype="unsigned long"
16547         ivsize=$longsize
16548         uvsize=$longsize
16549         ;;
16550 esac
16551
16552 case "$uselongdouble:$d_longdbl" in
16553 define:define)
16554         nvtype="long double"
16555         nvsize=$longdblsize
16556         ;;
16557 *)      nvtype=double
16558         nvsize=$doublesize
16559         ;;
16560 esac
16561
16562 case "$usequadmath:$i_quadmath" in
16563 define:define)
16564   nvtype="__float128"
16565   nvsize=16
16566   case "$libs" in
16567   *quadmath*) ;;
16568   *) $cat <<EOM >&4
16569
16570 *** You requested the use of the quadmath library, but you
16571 *** do not seem to have the quadmath library installed.
16572 *** Cannot continue, aborting.
16573 EOM
16574     exit 1
16575     ;;
16576   esac
16577   ;;
16578 define:*) $cat <<EOM >&4
16579
16580 *** You requested the use of the quadmath library, but you
16581 *** do not seem to have the required header, <quadmath.h>.
16582 EOM
16583   case "$gccversion" in
16584   [23].*|4.[0-5]*)
16585    $cat <<EOM >&4
16586 *** Your gcc looks a bit old:
16587 *** $gccversion
16588 EOM
16589     ;;
16590   '')
16591    $cat <<EOM >&4
16592 *** You are not running a gcc.
16593 EOM
16594     ;;
16595   esac
16596   $cat <<EOM >&4
16597 *** For the quadmath library you need at least gcc 4.6.
16598 *** Cannot continue, aborting.
16599 EOM
16600   exit 1
16601   ;;
16602 esac
16603
16604 $echo "(IV will be "$ivtype", $ivsize bytes)"
16605 $echo "(UV will be "$uvtype", $uvsize bytes)"
16606 $echo "(NV will be "$nvtype", $nvsize bytes)"
16607
16608 $cat >try.c <<EOCP
16609 #$i_inttypes I_INTTYPES
16610 #ifdef I_INTTYPES
16611 #include <inttypes.h>
16612 #endif
16613 #include <stdio.h>
16614 int main() {
16615 #ifdef INT8
16616    int8_t i =  INT8_MAX;
16617   uint8_t u = UINT8_MAX;
16618   printf("int8_t\n");
16619 #endif
16620 #ifdef INT16
16621    int16_t i =  INT16_MAX;
16622   uint16_t u = UINT16_MAX;
16623   printf("int16_t\n");
16624 #endif
16625 #ifdef INT32
16626    int32_t i =  INT32_MAX;
16627   uint32_t u = UINT32_MAX;
16628   printf("int32_t\n");
16629 #endif
16630 }
16631 EOCP
16632
16633 i8type="signed char"
16634 u8type="unsigned char"
16635 i8size=1
16636 u8size=1
16637
16638 case "$i16type" in
16639 '')     case "$shortsize" in
16640         2)      i16type=short
16641                 u16type="unsigned short"
16642                 i16size=$shortsize
16643                 u16size=$shortsize
16644                 ;;
16645         esac
16646         ;;
16647 esac
16648 case "$i16type" in
16649 '')     set try -DINT16
16650         if eval $compile; then
16651                 case "`$run ./try`" in
16652                 int16_t)
16653                         i16type=int16_t
16654                         u16type=uint16_t
16655                         i16size=2
16656                         u16size=2
16657                         ;;
16658                 esac
16659         fi
16660         ;;
16661 esac
16662 case "$i16type" in
16663 '')     if $test $shortsize -ge 2; then
16664                 i16type=short
16665                 u16type="unsigned short"
16666                 i16size=$shortsize
16667                 u16size=$shortsize
16668         fi
16669         ;;
16670 esac
16671
16672 case "$i32type" in
16673 '')     case "$longsize" in
16674         4)      i32type=long
16675                 u32type="unsigned long"
16676                 i32size=$longsize
16677                 u32size=$longsize
16678                 ;;
16679         *)      case "$intsize" in
16680                 4)      i32type=int
16681                         u32type="unsigned int"
16682                         i32size=$intsize
16683                         u32size=$intsize
16684                         ;;
16685                 esac
16686                 ;;
16687         esac
16688         ;;
16689 esac
16690 case "$i32type" in
16691 '')     set try -DINT32
16692         if eval $compile; then
16693                 case "`$run ./try`" in
16694                 int32_t)
16695                         i32type=int32_t
16696                         u32type=uint32_t
16697                         i32size=4
16698                         u32size=4
16699                         ;;
16700                 esac
16701         fi
16702         ;;
16703 esac
16704 case "$i32type" in
16705 '')     if $test $intsize -ge 4; then
16706                 i32type=int
16707                 u32type="unsigned int"
16708                 i32size=$intsize
16709                 u32size=$intsize
16710         fi
16711         ;;
16712 esac
16713
16714 case "$i64type" in
16715 '')     case "$d_quad:$quadtype" in
16716         define:?*)
16717                 i64type="$quadtype"
16718                 u64type="$uquadtype"
16719                 i64size=8
16720                 u64size=8
16721                 ;;
16722         esac
16723         ;;
16724 esac
16725
16726 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16727 : volatile so that the compiler has to store it out to memory.
16728 if test X"$d_volatile" = X"$define"; then
16729         volatile=volatile
16730 fi
16731 $cat <<EOP >try.c
16732 #include <stdio.h>
16733 #$i_stdlib I_STDLIB
16734 #ifdef I_STDLIB
16735 #include <stdlib.h>
16736 #endif
16737 #include <sys/types.h>
16738 #include <signal.h>
16739 #ifdef SIGFPE
16740 $volatile int bletched = 0;
16741 $signal_t blech(int s) { bletched = 1; }
16742 #endif
16743 int main() {
16744     $uvtype u = 0;
16745     $nvtype d;
16746     int     n = 8 * $uvsize;
16747     int     i;
16748 #ifdef SIGFPE
16749     signal(SIGFPE, blech);
16750 #endif
16751
16752     for (i = 0; i < n; i++) {
16753       u = u << 1 | ($uvtype)1;
16754       d = ($nvtype)u;
16755       if (($uvtype)d != u)
16756         break;
16757       if (d <= 0)
16758         break;
16759       d = ($nvtype)(u - 1);
16760       if (($uvtype)d != (u - 1))
16761         break;
16762 #ifdef SIGFPE
16763       if (bletched)
16764         break;
16765 #endif
16766     }
16767     printf("%d\n", ((i == n) ? -n : i));
16768     exit(0);
16769 }
16770 EOP
16771 set try
16772
16773 d_nv_preserves_uv="$undef"
16774 if eval $compile; then
16775         nv_preserves_uv_bits="`$run ./try`"
16776 fi
16777 case "$nv_preserves_uv_bits" in
16778 \-[1-9]*)
16779         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16780         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16781         d_nv_preserves_uv="$define"
16782         ;;
16783 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16784         d_nv_preserves_uv="$undef" ;;
16785 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16786         nv_preserves_uv_bits="0" ;;
16787 esac
16788 $rm_try
16789
16790 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16791 : volatile so that the compiler has to store it out to memory.
16792 if test X"$d_volatile" = X"$define"; then
16793         volatile=volatile
16794 fi
16795 $cat <<EOP >try.c
16796 #include <stdio.h>
16797
16798 typedef $nvtype NV;
16799
16800 int
16801 main() {
16802   NV value = 2;
16803   int count = 1;
16804
16805   while(count < 256) {
16806     $volatile NV up = value + 1.0;
16807     $volatile NV negated = -value;
16808     $volatile NV down = negated - 1.0;
16809     $volatile NV got_up = up - value;
16810     int up_good = got_up == 1.0;
16811     int got_down = down - negated;
16812     int down_good = got_down == -1.0;
16813
16814     if (down_good != up_good) {
16815       fprintf(stderr,
16816               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16817               up_good, (double) got_up, down_good, (double) got_down,
16818               count, (double) value);
16819       return 1;
16820     }
16821     if (!up_good) {
16822       while (1) {
16823         if (count > 8) {
16824           count -= 8;
16825           fputs("256.0", stdout);
16826         } else {
16827           count--;
16828           fputs("2.0", stdout);
16829         }
16830         if (!count) {
16831           puts("");
16832           return 0;
16833         }
16834         fputs("*", stdout);
16835       }
16836     }
16837     value *= 2;
16838     ++count;
16839   }
16840   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16841           count, (double) value);
16842   return 1;
16843 }
16844 EOP
16845 set try
16846
16847 nv_overflows_integers_at='0'
16848 if eval $compile; then
16849     xxx="`$run ./try`"
16850     case "$?" in
16851         0)
16852             case "$xxx" in
16853                 2*)  cat >&4 <<EOM
16854 The largest integer your NVs can preserve is equal to $xxx
16855 EOM
16856                     nv_overflows_integers_at="$xxx"
16857                     ;;
16858                 *)  cat >&4 <<EOM
16859 Cannot determine the largest integer value your NVs can hold, unexpected output
16860 '$xxx'
16861 EOM
16862                     ;;
16863             esac
16864             ;;
16865         *)  cat >&4 <<EOM
16866 Cannot determine the largest integer value your NVs can hold
16867 EOM
16868             ;;
16869     esac
16870 fi
16871 $rm_try
16872
16873 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16874 : volatile so that the compiler has to store it out to memory.
16875 if test X"$d_volatile" = X"$define"; then
16876         volatile=volatile
16877 fi
16878 $cat <<EOP >try.c
16879 #include <stdio.h>
16880 #$i_stdlib I_STDLIB
16881 #ifdef I_STDLIB
16882 #include <stdlib.h>
16883 #endif
16884 #$i_string I_STRING
16885 #ifdef I_STRING
16886 #  include <string.h>
16887 #else
16888 #  include <strings.h>
16889 #endif
16890 #include <sys/types.h>
16891 #include <signal.h>
16892 #ifdef SIGFPE
16893 $volatile int bletched = 0;
16894 $signal_t blech(int s) { bletched = 1; }
16895 #endif
16896
16897 int checkit($nvtype d, char *where) {
16898     unsigned char *p = (char *)&d;
16899     unsigned char *end = p + sizeof(d);
16900     int fail = 0;
16901
16902     while (p < end)
16903         fail += *p++;
16904
16905     if (!fail)
16906         return 0;
16907
16908     p = (char *)&d;
16909     printf("No - %s: 0x", where);
16910     while (p < end)
16911         printf ("%02X", *p++);
16912     printf("\n");
16913     return 1;
16914 }
16915
16916 int main(int argc, char **argv) {
16917     $nvtype d = 0.0;
16918     int fail = 0;
16919     fail += checkit(d, "0.0");
16920
16921     /* The compiler shouldn't be assuming that bletched is 0  */
16922     d = bletched;
16923
16924     fail += checkit(d, "bleched");
16925
16926 #ifdef SIGFPE
16927     signal(SIGFPE, blech);
16928 #endif
16929
16930     /* Paranoia - the compiler should have no way of knowing that ANSI says
16931        that argv[argc] will always be NULL.  Actually, if it did assume this it
16932        would be buggy, as this is C and main() can be called from elsewhere in
16933        the program.  */
16934     d = argv[argc] ? 1 : 0;
16935
16936     if (d) {
16937         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16938     }
16939
16940     fail += checkit(d, "ternary");
16941
16942     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16943
16944     if (d != 0.0) {
16945         printf("No - memset doesn't give 0.0\n");
16946         /* This might just blow up:  */
16947         printf("(gives %g)\n", d);
16948         return 1;
16949     }
16950
16951 #ifdef SIGFPE
16952     if (bletched) {
16953         printf("No - something bleched\n");
16954         return 1;
16955     }
16956 #endif
16957     if (fail) {
16958       printf("No - %d fail(s)\n", fail);
16959       return 1;
16960     }
16961     printf("Yes\n");
16962     return 0;
16963 }
16964 EOP
16965 set try
16966
16967 d_nv_zero_is_allbits_zero="$undef"
16968 if eval $compile; then
16969     xxx="`$run ./try`"
16970     case "$?" in
16971         0)
16972             case "$xxx" in
16973                 Yes)  cat >&4 <<EOM
16974 0.0 is represented as all bits zero in memory
16975 EOM
16976                     d_nv_zero_is_allbits_zero="$define"
16977                     ;;
16978                 *)  cat >&4 <<EOM
16979 0.0 is not represented as all bits zero in memory
16980 EOM
16981                     d_nv_zero_is_allbits_zero="$undef"
16982                     ;;
16983             esac
16984             ;;
16985         *)  cat >&4 <<EOM
16986 0.0 is not represented as all bits zero in memory
16987 EOM
16988             d_nv_zero_is_allbits_zero="$undef"
16989             ;;
16990     esac
16991 fi
16992 $rm_try
16993
16994 : check for off64_t
16995 echo " "
16996 echo "Checking to see if you have off64_t..." >&4
16997 $cat >try.c <<EOCP
16998 #include <sys/types.h>
16999 #include <unistd.h>
17000 int main() { off64_t x = 7; }
17001 EOCP
17002 set try
17003 if eval $compile; then
17004         val="$define"
17005         echo "You have off64_t."
17006 else
17007         val="$undef"
17008         echo "You do not have off64_t."
17009         case "$lseeksize" in
17010         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
17011         esac
17012 fi
17013 $rm_try
17014 set d_off64_t
17015 eval $setvar
17016
17017 : how to create joinable pthreads
17018 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
17019         echo " "
17020         echo "Checking what constant to use for creating joinable pthreads..." >&4
17021         $cat >try.c <<'EOCP'
17022 #include <pthread.h>
17023 int main() {
17024     int detachstate = JOINABLE;
17025 }
17026 EOCP
17027         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
17028         if eval $compile; then
17029                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
17030                 val="$undef" # Yes, undef.
17031                 set d_old_pthread_create_joinable
17032                 eval $setvar
17033                 val=""
17034                 set old_pthread_create_joinable
17035                 eval $setvar
17036         else
17037                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
17038                 if eval $compile; then
17039                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
17040                         val="$define"
17041                         set d_old_pthread_create_joinable
17042                         eval $setvar
17043                         val=PTHREAD_CREATE_UNDETACHED
17044                         set old_pthread_create_joinable
17045                         eval $setvar
17046                 else
17047                         set try -DJOINABLE=__UNDETACHED
17048                         if eval $compile; then
17049                                 echo "You seem to use __UNDETACHED." >&4
17050                                 val="$define"
17051                                 set d_old_pthread_create_joinable
17052                                 eval $setvar
17053                                 val=__UNDETACHED
17054                                 set old_pthread_create_joinable
17055                                 eval $setvar
17056                         else
17057                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
17058                                 val="$define"
17059                                 set d_old_pthread_create_joinable
17060                                 eval $setvar
17061                                 val=0
17062                                 set old_pthread_create_joinable
17063                                 eval $setvar
17064                         fi
17065                 fi
17066         fi
17067         $rm_try
17068 else
17069     d_old_pthread_create_joinable="$undef"
17070     old_pthread_create_joinable=""
17071 fi
17072
17073 : see if pause exists
17074 set pause d_pause
17075 eval $inlibc
17076
17077 : see if poll exists
17078 set poll d_poll
17079 eval $inlibc
17080
17081 : see if prctl exists
17082 set prctl d_prctl
17083 eval $inlibc
17084
17085 : see if prctl supports PR_SET_NAME
17086 d_prctl_set_name=$undef
17087 case $d_prctl in
17088     $define)
17089         $cat >try.c <<EOM
17090 #ifdef __ANDROID__
17091 #include <unistd.h>
17092 #endif
17093 #include <sys/prctl.h>
17094
17095 int main (int argc, char *argv[])
17096 {
17097     return (prctl (PR_SET_NAME, "Test"));
17098     } /* main */
17099 EOM
17100         set try
17101         if eval $compile_ok && $run ./try; then
17102             echo "Your prctl (PR_SET_NAME, ...) works"
17103             d_prctl_set_name=$define
17104             fi
17105         $rm_try
17106         ;;
17107     esac
17108
17109 : see if readlink exists
17110 set readlink d_readlink
17111 eval $inlibc
17112
17113 : Check if exe is symlink to abs path of executing program
17114 echo " "
17115 procselfexe=''
17116 val="$undef"
17117 case "$d_readlink" in
17118     "$define")
17119         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
17120         : more tidy to avoid an extra level of symlink
17121         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17122         while test $# -gt 0; do
17123             type=$1; try=$2
17124             shift; shift
17125             if $issymlink $try; then
17126                 $ls -l $try > reflect
17127                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17128                     echo "You have $type-like $try."
17129                     procselfexe='"'$try'"'
17130                     val="$define"
17131                     : This will break out of the loop
17132                     set X; shift
17133                 fi
17134             fi
17135         done
17136         ;;
17137 esac
17138 $rm -f reflect
17139 set d_procselfexe
17140 eval $setvar
17141
17142 : backward compatibility for d_hvfork
17143 if test X$d_hvfork != X; then
17144         d_vfork="$d_hvfork"
17145         d_hvfork=''
17146 fi
17147 : see if there is a vfork
17148 val=''
17149 set vfork val
17150 eval $inlibc
17151
17152 d_pseudofork=$undef
17153
17154 : Ok, but do we want to use it. vfork is reportedly unreliable in
17155 : perl on Solaris 2.x, and probably elsewhere.
17156 case "$val" in
17157 $define)
17158         echo " "
17159         case "$usevfork" in
17160         false) dflt='n';;
17161         *) dflt='y';;
17162         esac
17163         cat <<'EOM'
17164
17165 Perl can only use a vfork() that doesn't suffer from strict
17166 restrictions on calling functions or modifying global data in
17167 the child.  For example, glibc-2.1 contains such a vfork()
17168 that is unsuitable.  If your system provides a proper fork()
17169 call, chances are that you do NOT want perl to use vfork().
17170
17171 EOM
17172         rp="Do you still want to use vfork()?"
17173         . ./myread
17174         case "$ans" in
17175         y|Y) ;;
17176         *)
17177                 echo "Ok, we won't use vfork()."
17178                 val="$undef"
17179                 ;;
17180         esac
17181         ;;
17182 esac
17183 set d_vfork
17184 eval $setvar
17185 case "$d_vfork" in
17186 $define) usevfork='true';;
17187 *) usevfork='false';;
17188 esac
17189
17190 : see whether the pthread_atfork exists
17191 $cat >try.c <<EOP
17192 #include <pthread.h>
17193 #include <stdio.h>
17194 int main() {
17195 #ifdef  PTHREAD_ATFORK
17196         pthread_atfork(NULL,NULL,NULL);
17197 #endif
17198 }
17199 EOP
17200
17201 : see if pthread_atfork exists
17202 set try -DPTHREAD_ATFORK
17203 if eval $compile; then
17204     val="$define"
17205 else
17206     val="$undef"
17207 fi
17208 case "$usethreads" in
17209 $define)
17210         case "$val" in
17211         $define) echo 'pthread_atfork found.' >&4        ;;
17212         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17213         esac
17214 esac
17215 set d_pthread_atfork
17216 eval $setvar
17217
17218 : see if pthread_attr_setscope exists
17219 set pthread_attr_setscope d_pthread_attr_setscope
17220 eval $inlibc
17221
17222 : see whether the various POSIXish _yields exist
17223 $cat >try.c <<EOP
17224 #include <pthread.h>
17225 #include <stdio.h>
17226 int main() {
17227 #ifdef SCHED_YIELD
17228         sched_yield();
17229 #else
17230 #ifdef PTHREAD_YIELD
17231         pthread_yield();
17232 #else
17233 #ifdef PTHREAD_YIELD_NULL
17234         pthread_yield(NULL);
17235 #endif
17236 #endif
17237 #endif
17238 }
17239 EOP
17240 : see if sched_yield exists
17241 set try -DSCHED_YIELD
17242 if eval $compile; then
17243     val="$define"
17244     sched_yield='sched_yield()'
17245 else
17246     val="$undef"
17247 fi
17248 case "$usethreads" in
17249 $define)
17250         case "$val" in
17251         $define) echo 'sched_yield() found.' >&4        ;;
17252         *)       echo 'sched_yield() NOT found.' >&4    ;;
17253         esac
17254 esac
17255 set d_sched_yield
17256 eval $setvar
17257
17258 : see if pthread_yield exists
17259 set try -DPTHREAD_YIELD
17260 if eval $compile; then
17261     val="$define"
17262     case "$sched_yield" in
17263     '') sched_yield='pthread_yield()' ;;
17264     esac
17265 else
17266     set try -DPTHREAD_YIELD_NULL
17267     if eval $compile; then
17268         val="$define"
17269         case "$sched_yield" in
17270         '') sched_yield='pthread_yield(NULL)' ;;
17271         esac
17272     else
17273         val="$undef"
17274     fi
17275 fi
17276 case "$usethreads" in
17277 $define)
17278         case "$val" in
17279         $define) echo 'pthread_yield() found.' >&4      ;;
17280         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17281         esac
17282         ;;
17283 esac
17284 set d_pthread_yield
17285 eval $setvar
17286 case "$sched_yield" in
17287 '') sched_yield=undef ;;
17288 esac
17289 $rm_try
17290
17291 : check for ptrdiff_t
17292 echo " "
17293 echo "Checking to see if you have ptrdiff_t..." >&4
17294 $cat >try.c <<EOCP
17295 #include <stddef.h>
17296 int main() { ptrdiff_t x = 7; }
17297 EOCP
17298 set try
17299 if eval $compile; then
17300         val="$define"
17301         echo "You have ptrdiff_t."
17302 else
17303         val="$undef"
17304         echo "You do not have ptrdiff_t."
17305 fi
17306 $rm_try
17307 set d_ptrdiff_t
17308 eval $setvar
17309
17310 : see if random_r exists
17311 set random_r d_random_r
17312 eval $inlibc
17313 case "$d_random_r" in
17314 "$define")
17315         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17316         case "$d_random_r_proto:$usethreads" in
17317         ":define")      d_random_r_proto=define
17318                 set d_random_r_proto random_r $hdrs
17319                 eval $hasproto ;;
17320         *)      ;;
17321         esac
17322         case "$d_random_r_proto" in
17323         define)
17324         case "$random_r_proto" in
17325         ''|0) try='int random_r(int*, struct random_data*);'
17326         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17327         esac
17328         case "$random_r_proto" in
17329         ''|0) try='int random_r(long*, struct random_data*);'
17330         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17331         esac
17332         case "$random_r_proto" in
17333         ''|0) try='int random_r(struct random_data*, int32_t*);'
17334         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17335         esac
17336         case "$random_r_proto" in
17337         ''|0)   d_random_r=undef
17338                 random_r_proto=0
17339                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17340         * )     case "$random_r_proto" in
17341                 REENTRANT_PROTO*) ;;
17342                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17343                 esac
17344                 echo "Prototype: $try" ;;
17345         esac
17346         ;;
17347         *)      case "$usethreads" in
17348                 define) echo "random_r has no prototype, not using it." >&4 ;;
17349                 esac
17350                 d_random_r=undef
17351                 random_r_proto=0
17352                 ;;
17353         esac
17354         ;;
17355 *)      random_r_proto=0
17356         ;;
17357 esac
17358
17359 : see if readdir and friends exist
17360 set readdir d_readdir
17361 eval $inlibc
17362 set seekdir d_seekdir
17363 eval $inlibc
17364 set telldir d_telldir
17365 eval $inlibc
17366 set rewinddir d_rewinddir
17367 eval $inlibc
17368
17369 : see if readdir64_r exists
17370 set readdir64_r d_readdir64_r
17371 eval $inlibc
17372 case "$d_readdir64_r" in
17373 "$define")
17374         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17375         case "$d_readdir64_r_proto:$usethreads" in
17376         ":define")      d_readdir64_r_proto=define
17377                 set d_readdir64_r_proto readdir64_r $hdrs
17378                 eval $hasproto ;;
17379         *)      ;;
17380         esac
17381         case "$d_readdir64_r_proto" in
17382         define)
17383         case "$readdir64_r_proto" in
17384         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17385         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17386         esac
17387         case "$readdir64_r_proto" in
17388         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17389         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17390         esac
17391         case "$readdir64_r_proto" in
17392         ''|0)   d_readdir64_r=undef
17393                 readdir64_r_proto=0
17394                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17395         * )     case "$readdir64_r_proto" in
17396                 REENTRANT_PROTO*) ;;
17397                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17398                 esac
17399                 echo "Prototype: $try" ;;
17400         esac
17401         ;;
17402         *)      case "$usethreads" in
17403                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17404                 esac
17405                 d_readdir64_r=undef
17406                 readdir64_r_proto=0
17407                 ;;
17408         esac
17409         ;;
17410 *)      readdir64_r_proto=0
17411         ;;
17412 esac
17413
17414 : see if readdir_r exists
17415 set readdir_r d_readdir_r
17416 eval $inlibc
17417 case "$d_readdir_r" in
17418 "$define")
17419         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17420         case "$d_readdir_r_proto:$usethreads" in
17421         ":define")      d_readdir_r_proto=define
17422                 set d_readdir_r_proto readdir_r $hdrs
17423                 eval $hasproto ;;
17424         *)      ;;
17425         esac
17426         case "$d_readdir_r_proto" in
17427         define)
17428         case "$readdir_r_proto" in
17429         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17430         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17431         esac
17432         case "$readdir_r_proto" in
17433         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17434         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17435         esac
17436         case "$readdir_r_proto" in
17437         ''|0)   d_readdir_r=undef
17438                 readdir_r_proto=0
17439                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17440         * )     case "$readdir_r_proto" in
17441                 REENTRANT_PROTO*) ;;
17442                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17443                 esac
17444                 echo "Prototype: $try" ;;
17445         esac
17446         ;;
17447         *)      case "$usethreads" in
17448                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17449                 esac
17450                 d_readdir_r=undef
17451                 readdir_r_proto=0
17452                 ;;
17453         esac
17454         ;;
17455 *)      readdir_r_proto=0
17456         ;;
17457 esac
17458
17459 : see if readv exists
17460 set readv d_readv
17461 eval $inlibc
17462
17463 : see if recvmsg exists
17464 set recvmsg d_recvmsg
17465 eval $inlibc
17466
17467 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17468 echo " "
17469 if set regcomp val -f d_regcomp; eval $csym; $val; then
17470         echo 'regcomp() found.' >&4
17471         d_regcomp="$define"
17472         d_regcmp="$undef"
17473         d_re_comp="$undef"
17474 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17475         echo 'regcmp() found.' >&4
17476         d_regcmp="$define"
17477         d_regcomp="$undef"
17478         d_re_comp="$undef"
17479 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17480         echo 're_comp() found, assuming re_exec() also exists.' >&4
17481         d_re_comp="$define"
17482         d_regcomp="$undef"
17483         d_regcmp="$undef"
17484 else
17485         $cat >&4 <<EOM
17486 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17487 EOM
17488         d_regcmp="$undef"
17489         d_re_comp="$undef"
17490         d_regcomp="$undef"
17491 fi
17492
17493 : see if remainder exists
17494 set remainder d_remainder
17495 eval $inlibc
17496
17497 : see if remquo exists
17498 set remquo d_remquo
17499 eval $inlibc
17500
17501 : see if rename exists
17502 set rename d_rename
17503 eval $inlibc
17504
17505 : see if rint exists
17506 set rint d_rint
17507 eval $inlibc
17508
17509 : see if rmdir exists
17510 set rmdir d_rmdir
17511 eval $inlibc
17512
17513 : see if round exists
17514 set round d_round
17515 eval $inlibc
17516
17517 : see if memory.h is available.
17518 val=''
17519 set memory.h val
17520 eval $inhdr
17521
17522 : See if it conflicts with string.h
17523 case "$val" in
17524 $define)
17525         case "$strings" in
17526         '') ;;
17527         *)
17528                 $cppstdin $cppflags $cppminus < $strings > mem.h
17529                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
17530                         echo " "
17531                         echo "We won't be including <memory.h>."
17532                         val="$undef"
17533                 fi
17534                 $rm -f mem.h
17535                 ;;
17536         esac
17537 esac
17538 set i_memory
17539 eval $setvar
17540
17541 : can bcopy handle overlapping blocks?
17542 echo " "
17543 val="$undef"
17544 case "$d_memmove" in
17545 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
17546 *)      case "$d_bcopy" in
17547         "$define")
17548                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
17549                 $cat >try.c <<EOCP
17550 #$i_memory I_MEMORY
17551 #$i_stdlib I_STDLIB
17552 #$i_string I_STRING
17553 #$i_unistd I_UNISTD
17554 EOCP
17555         $cat >>try.c <<'EOCP'
17556 #include <stdio.h>
17557 #ifdef I_MEMORY
17558 #  include <memory.h>
17559 #endif
17560 #ifdef I_STDLIB
17561 #  include <stdlib.h>
17562 #endif
17563 #ifdef I_STRING
17564 #  include <string.h>
17565 #else
17566 #  include <strings.h>
17567 #endif
17568 #ifdef I_UNISTD
17569 #  include <unistd.h>  /* Needed for NetBSD */
17570 #endif
17571 int main()
17572 {
17573 char buf[128], abc[128];
17574 char *b;
17575 int len;
17576 int off;
17577 int align;
17578
17579 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17580    try to store the string in read-only memory. */
17581 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
17582
17583 for (align = 7; align >= 0; align--) {
17584         for (len = 36; len; len--) {
17585                 b = buf+align;
17586                 bcopy(abc, b, len);
17587                 for (off = 1; off <= len; off++) {
17588                         bcopy(b, b+off, len);
17589                         bcopy(b+off, b, len);
17590                         if (bcmp(b, abc, len))
17591                                 exit(1);
17592                 }
17593         }
17594 }
17595 exit(0);
17596 }
17597 EOCP
17598                 set try
17599                 if eval $compile_ok; then
17600                         if $run ./try 2>/dev/null; then
17601                                 echo "Yes, it can."
17602                                 val="$define"
17603                         else
17604                                 echo "It can't, sorry."
17605                         fi
17606                 else
17607                         echo "(I can't compile the test program, so we'll assume not...)"
17608                 fi
17609                 ;;
17610         esac
17611         $rm_try
17612         ;;
17613 esac
17614 set d_safebcpy
17615 eval $setvar
17616
17617 : can memcpy handle overlapping blocks?
17618 echo " "
17619 val="$undef"
17620 case "$d_memmove" in
17621 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
17622 *)      case "$d_memcpy" in
17623         "$define")
17624                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
17625                 $cat >try.c <<EOCP
17626 #$i_memory I_MEMORY
17627 #$i_stdlib I_STDLIB
17628 #$i_string I_STRING
17629 #$i_unistd I_UNISTD
17630 EOCP
17631         $cat >>try.c <<'EOCP'
17632 #include <stdio.h>
17633 #ifdef I_MEMORY
17634 #  include <memory.h>
17635 #endif
17636 #ifdef I_STDLIB
17637 #  include <stdlib.h>
17638 #endif
17639 #ifdef I_STRING
17640 #  include <string.h>
17641 #else
17642 #  include <strings.h>
17643 #endif
17644 #ifdef I_UNISTD
17645 #  include <unistd.h>  /* Needed for NetBSD */
17646 #endif
17647 int main()
17648 {
17649 char buf[128], abc[128];
17650 char *b;
17651 int len;
17652 int off;
17653 int align;
17654
17655 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17656    try to store the string in read-only memory. */
17657 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
17658
17659 for (align = 7; align >= 0; align--) {
17660         for (len = 36; len; len--) {
17661                 b = buf+align;
17662                 memcpy(b, abc, len);
17663                 for (off = 1; off <= len; off++) {
17664                         memcpy(b+off, b, len);
17665                         memcpy(b, b+off, len);
17666                         if (memcmp(b, abc, len))
17667                                 exit(1);
17668                 }
17669         }
17670 }
17671 exit(0);
17672 }
17673 EOCP
17674                 set try
17675                 if eval $compile_ok; then
17676                         if $run ./try 2>/dev/null; then
17677                                 echo "Yes, it can."
17678                                 val="$define"
17679                         else
17680                                 echo "It can't, sorry."
17681                         fi
17682                 else
17683                         echo "(I can't compile the test program, so we'll assume not...)"
17684                 fi
17685                 ;;
17686         esac
17687         $rm_try
17688         ;;
17689 esac
17690 set d_safemcpy
17691 eval $setvar
17692
17693 : can memcmp be trusted to compare relative magnitude?
17694 val="$undef"
17695 case "$d_memcmp" in
17696 "$define")
17697         echo " "
17698         echo "Checking if your memcmp() can compare relative magnitude..." >&4
17699         $cat >try.c <<EOCP
17700 #$i_memory I_MEMORY
17701 #$i_stdlib I_STDLIB
17702 #$i_string I_STRING
17703 #$i_unistd I_UNISTD
17704 EOCP
17705         $cat >>try.c <<'EOCP'
17706 #include <stdio.h>
17707 #ifdef I_MEMORY
17708 #  include <memory.h>
17709 #endif
17710 #ifdef I_STDLIB
17711 #  include <stdlib.h>
17712 #endif
17713 #ifdef I_STRING
17714 #  include <string.h>
17715 #else
17716 #  include <strings.h>
17717 #endif
17718 #ifdef I_UNISTD
17719 #  include <unistd.h>  /* Needed for NetBSD */
17720 #endif
17721 int main()
17722 {
17723 char a = -1;
17724 char b = 0;
17725 if ((a < b) && memcmp(&a, &b, 1) < 0)
17726         exit(1);
17727 exit(0);
17728 }
17729 EOCP
17730         set try
17731         if eval $compile_ok; then
17732                 if $run ./try 2>/dev/null; then
17733                         echo "Yes, it can."
17734                         val="$define"
17735                 else
17736                         echo "No, it can't (it uses signed chars)."
17737                 fi
17738         else
17739                 echo "(I can't compile the test program, so we'll assume not...)"
17740         fi
17741         ;;
17742 esac
17743 $rm_try
17744 set d_sanemcmp
17745 eval $setvar
17746
17747 : see if prototype for sbrk is available
17748 echo " "
17749 set d_sbrkproto sbrk $i_unistd unistd.h
17750 eval $hasproto
17751
17752 : see if scalbn exists
17753 set scalbn d_scalbn
17754 eval $inlibc
17755
17756 : see if select exists
17757 set select d_select
17758 eval $inlibc
17759
17760 : see if semctl exists
17761 set semctl d_semctl
17762 eval $inlibc
17763
17764 : see if semget exists
17765 set semget d_semget
17766 eval $inlibc
17767
17768 : see if semop exists
17769 set semop d_semop
17770 eval $inlibc
17771
17772 : see how much of the 'sem*(2)' library is present.
17773 h_sem=true
17774 echo " "
17775 case "$d_semctl$d_semget$d_semop" in
17776 *"$undef"*) h_sem=false;;
17777 esac
17778 case "$osname" in
17779 freebsd)
17780     case "`ipcs 2>&1`" in
17781     "SVID messages"*"not configured"*)
17782         echo "Your $osname does not have the sem*(2) configured." >&4
17783         h_sem=false
17784         val="$undef"
17785         set semctl d_semctl
17786         eval $setvar
17787         set semget d_semget
17788         eval $setvar
17789         set semop d_semop
17790         eval $setvar
17791         ;;
17792     esac
17793     ;;
17794 esac
17795 : we could also check for sys/ipc.h ...
17796 if $h_sem && $test `./findhdr sys/sem.h`; then
17797         echo "You have the full sem*(2) library." >&4
17798         val="$define"
17799 else
17800         echo "You don't have the full sem*(2) library." >&4
17801         val="$undef"
17802 fi
17803 set d_sem
17804 eval $setvar
17805
17806 : see whether sys/sem.h defines union semun
17807 echo " "
17808 $cat > try.c <<'END'
17809 #include <sys/types.h>
17810 #include <sys/ipc.h>
17811 #include <sys/sem.h>
17812 int main () { union semun semun; semun.buf = 0; }
17813 END
17814 set try
17815 if eval $compile; then
17816     echo "You have union semun in <sys/sem.h>." >&4
17817     val="$define"
17818 else
17819     echo "You do not have union semun in <sys/sem.h>." >&4
17820     val="$undef"
17821 fi
17822 $rm_try
17823 set d_union_semun
17824 eval $setvar
17825
17826 : see how to do semctl IPC_STAT
17827 case "$d_sem" in
17828 $define)
17829     echo " "
17830     $cat > tryh.h <<END
17831 #ifndef S_IRUSR
17832 #   ifdef S_IREAD
17833 #       define S_IRUSR S_IREAD
17834 #       define S_IWUSR S_IWRITE
17835 #       define S_IXUSR S_IEXEC
17836 #   else
17837 #       define S_IRUSR 0400
17838 #       define S_IWUSR 0200
17839 #       define S_IXUSR 0100
17840 #   endif
17841 #   define S_IRGRP (S_IRUSR>>3)
17842 #   define S_IWGRP (S_IWUSR>>3)
17843 #   define S_IXGRP (S_IXUSR>>3)
17844 #   define S_IROTH (S_IRUSR>>6)
17845 #   define S_IWOTH (S_IWUSR>>6)
17846 #   define S_IXOTH (S_IXUSR>>6)
17847 #endif
17848 #ifndef S_IRWXU
17849 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17850 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17851 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17852 #endif
17853 END
17854     : see whether semctl IPC_STAT can use union semun
17855     case "$d_semctl_semun" in
17856     '')
17857       val="$undef"
17858       $cat > try.c <<END
17859 #include <sys/types.h>
17860 #include <sys/ipc.h>
17861 #include <sys/sem.h>
17862 #include <sys/stat.h>
17863 #include <stdio.h>
17864 #include <errno.h>
17865 #include "tryh.h"
17866 #ifndef errno
17867 extern int errno;
17868 #endif
17869 #$d_union_semun HAS_UNION_SEMUN
17870 int main() {
17871     union semun
17872 #ifndef HAS_UNION_SEMUN
17873     {
17874         int val;
17875         struct semid_ds *buf;
17876         unsigned short *array;
17877     }
17878 #endif
17879     arg;
17880     int sem, st;
17881
17882 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17883     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17884     if (sem > -1) {
17885         struct semid_ds argbuf;
17886         arg.buf = &argbuf;
17887 #       ifdef IPC_STAT
17888         st = semctl(sem, 0, IPC_STAT, arg);
17889         if (st == 0)
17890             printf("semun\n");
17891         else
17892 #       endif /* IPC_STAT */
17893             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17894 #       ifdef IPC_RMID
17895         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17896 #       endif /* IPC_RMID */
17897             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17898     } else
17899 #endif /* IPC_PRIVATE && ... */
17900         printf("semget failed: errno = %d\n", errno);
17901   return 0;
17902 }
17903 END
17904       set try
17905       if eval $compile; then
17906           xxx=`$run ./try`
17907           case "$xxx" in
17908           semun) val="$define" ;;
17909           esac
17910       fi
17911       $rm_try
17912       set d_semctl_semun
17913       eval $setvar
17914       ;;
17915     esac
17916     case "$d_semctl_semun" in
17917     $define)
17918         echo "You can use union semun for semctl IPC_STAT." >&4
17919         also='also'
17920         ;;
17921     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17922         also=''
17923         ;;
17924     esac
17925
17926     : see whether semctl IPC_STAT can use struct semid_ds pointer
17927     case "$d_semctl_semid_ds" in
17928     '')
17929       val="$undef"
17930       $cat > try.c <<'END'
17931 #include <sys/types.h>
17932 #include <sys/ipc.h>
17933 #include <sys/sem.h>
17934 #include <sys/stat.h>
17935 #include "tryh.h"
17936 #include <stdio.h>
17937 #include <errno.h>
17938 #ifndef errno
17939 extern int errno;
17940 #endif
17941 int main() {
17942     struct semid_ds arg;
17943     int sem, st;
17944
17945 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17946     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17947     if (sem > -1) {
17948 #       ifdef IPC_STAT
17949         st = semctl(sem, 0, IPC_STAT, &arg);
17950         if (st == 0)
17951             printf("semid_ds\n");
17952         else
17953 #       endif /* IPC_STAT */
17954             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17955 #       ifdef IPC_RMID
17956         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
17957 #       endif /* IPC_RMID */
17958             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17959     } else
17960 #endif /* IPC_PRIVATE && ... */
17961         printf("semget failed: errno = %d\n", errno);
17962
17963     return 0;
17964 }
17965 END
17966       set try
17967       if eval $compile; then
17968           xxx=`$run ./try`
17969           case "$xxx" in
17970           semid_ds) val="$define" ;;
17971           esac
17972       fi
17973       $rm_try
17974       set d_semctl_semid_ds
17975       eval $setvar
17976       ;;
17977     esac
17978     case "$d_semctl_semid_ds" in
17979     $define)
17980         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17981         ;;
17982     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17983         ;;
17984     esac
17985     ;;
17986 *)  val="$undef"
17987
17988     # We do not have the full sem*(2) library, so assume we can not
17989     # use either.
17990
17991     set d_semctl_semun
17992     eval $setvar
17993
17994     set d_semctl_semid_ds
17995     eval $setvar
17996     ;;
17997 esac
17998 $rm_try tryh.h
17999
18000 : see if sendmsg exists
18001 set sendmsg d_sendmsg
18002 eval $inlibc
18003
18004 : see if setegid exists
18005 set setegid d_setegid
18006 eval $inlibc
18007
18008 : see if seteuid exists
18009 set seteuid d_seteuid
18010 eval $inlibc
18011
18012 : see if setgrent exists
18013 set setgrent d_setgrent
18014 eval $inlibc
18015
18016 : see if setgrent_r exists
18017 set setgrent_r d_setgrent_r
18018 eval $inlibc
18019 case "$d_setgrent_r" in
18020 "$define")
18021         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
18022         case "$d_setgrent_r_proto:$usethreads" in
18023         ":define")      d_setgrent_r_proto=define
18024                 set d_setgrent_r_proto setgrent_r $hdrs
18025                 eval $hasproto ;;
18026         *)      ;;
18027         esac
18028         case "$d_setgrent_r_proto" in
18029         define)
18030         case "$setgrent_r_proto" in
18031         ''|0) try='int setgrent_r(FILE**);'
18032         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
18033         esac
18034         case "$setgrent_r_proto" in
18035         ''|0) try='void setgrent_r(FILE**);'
18036         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
18037         esac
18038         case "$setgrent_r_proto" in
18039         ''|0)   d_setgrent_r=undef
18040                 setgrent_r_proto=0
18041                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
18042         * )     case "$setgrent_r_proto" in
18043                 REENTRANT_PROTO*) ;;
18044                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
18045                 esac
18046                 echo "Prototype: $try" ;;
18047         esac
18048         ;;
18049         *)      case "$usethreads" in
18050                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
18051                 esac
18052                 d_setgrent_r=undef
18053                 setgrent_r_proto=0
18054                 ;;
18055         esac
18056         ;;
18057 *)      setgrent_r_proto=0
18058         ;;
18059 esac
18060
18061 : see if sethostent exists
18062 set sethostent d_sethent
18063 eval $inlibc
18064
18065 : see if sethostent_r exists
18066 set sethostent_r d_sethostent_r
18067 eval $inlibc
18068 case "$d_sethostent_r" in
18069 "$define")
18070         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18071         case "$d_sethostent_r_proto:$usethreads" in
18072         ":define")      d_sethostent_r_proto=define
18073                 set d_sethostent_r_proto sethostent_r $hdrs
18074                 eval $hasproto ;;
18075         *)      ;;
18076         esac
18077         case "$d_sethostent_r_proto" in
18078         define)
18079         case "$sethostent_r_proto" in
18080         ''|0) try='int sethostent_r(int, struct hostent_data*);'
18081         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
18082         esac
18083         case "$sethostent_r_proto" in
18084         ''|0) try='void sethostent_r(int, struct hostent_data*);'
18085         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
18086         esac
18087         case "$sethostent_r_proto" in
18088         ''|0)   d_sethostent_r=undef
18089                 sethostent_r_proto=0
18090                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
18091         * )     case "$sethostent_r_proto" in
18092                 REENTRANT_PROTO*) ;;
18093                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
18094                 esac
18095                 echo "Prototype: $try" ;;
18096         esac
18097         ;;
18098         *)      case "$usethreads" in
18099                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
18100                 esac
18101                 d_sethostent_r=undef
18102                 sethostent_r_proto=0
18103                 ;;
18104         esac
18105         ;;
18106 *)      sethostent_r_proto=0
18107         ;;
18108 esac
18109
18110 : see if setitimer exists
18111 set setitimer d_setitimer
18112 eval $inlibc
18113
18114 : see if setlinebuf exists
18115 set setlinebuf d_setlinebuf
18116 eval $inlibc
18117
18118 : see if setlocale exists
18119 set setlocale d_setlocale
18120 eval $inlibc
18121
18122 : see if locale.h is available
18123 set locale.h i_locale
18124 eval $inhdr
18125
18126 : see if setlocale_r exists
18127 set setlocale_r d_setlocale_r
18128 eval $inlibc
18129 case "$d_setlocale_r" in
18130 "$define")
18131         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18132         case "$d_setlocale_r_proto:$usethreads" in
18133         ":define")      d_setlocale_r_proto=define
18134                 set d_setlocale_r_proto setlocale_r $hdrs
18135                 eval $hasproto ;;
18136         *)      ;;
18137         esac
18138         case "$d_setlocale_r_proto" in
18139         define)
18140         case "$setlocale_r_proto" in
18141         ''|0) try='int setlocale_r(int, const char*, char*, int);'
18142         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18143         esac
18144         case "$setlocale_r_proto" in
18145         ''|0)   d_setlocale_r=undef
18146                 setlocale_r_proto=0
18147                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18148         * )     case "$setlocale_r_proto" in
18149                 REENTRANT_PROTO*) ;;
18150                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18151                 esac
18152                 echo "Prototype: $try" ;;
18153         esac
18154         ;;
18155         *)      case "$usethreads" in
18156                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18157                 esac
18158                 d_setlocale_r=undef
18159                 setlocale_r_proto=0
18160                 ;;
18161         esac
18162         ;;
18163 *)      setlocale_r_proto=0
18164         ;;
18165 esac
18166
18167 : see if setnetent exists
18168 set setnetent d_setnent
18169 eval $inlibc
18170
18171 : see if setnetent_r exists
18172 set setnetent_r d_setnetent_r
18173 eval $inlibc
18174 case "$d_setnetent_r" in
18175 "$define")
18176         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18177         case "$d_setnetent_r_proto:$usethreads" in
18178         ":define")      d_setnetent_r_proto=define
18179                 set d_setnetent_r_proto setnetent_r $hdrs
18180                 eval $hasproto ;;
18181         *)      ;;
18182         esac
18183         case "$d_setnetent_r_proto" in
18184         define)
18185         case "$setnetent_r_proto" in
18186         ''|0) try='int setnetent_r(int, struct netent_data*);'
18187         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18188         esac
18189         case "$setnetent_r_proto" in
18190         ''|0) try='void setnetent_r(int, struct netent_data*);'
18191         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18192         esac
18193         case "$setnetent_r_proto" in
18194         ''|0)   d_setnetent_r=undef
18195                 setnetent_r_proto=0
18196                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18197         * )     case "$setnetent_r_proto" in
18198                 REENTRANT_PROTO*) ;;
18199                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18200                 esac
18201                 echo "Prototype: $try" ;;
18202         esac
18203         ;;
18204         *)      case "$usethreads" in
18205                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18206                 esac
18207                 d_setnetent_r=undef
18208                 setnetent_r_proto=0
18209                 ;;
18210         esac
18211         ;;
18212 *)      setnetent_r_proto=0
18213         ;;
18214 esac
18215
18216 : see if setprotoent exists
18217 set setprotoent d_setpent
18218 eval $inlibc
18219
18220 : see if setpgid exists
18221 set setpgid d_setpgid
18222 eval $inlibc
18223
18224 : see if setpgrp2 exists
18225 set setpgrp2 d_setpgrp2
18226 eval $inlibc
18227
18228 : see if setpriority exists
18229 set setpriority d_setprior
18230 eval $inlibc
18231
18232 : see if setproctitle exists
18233 set setproctitle d_setproctitle
18234 eval $inlibc
18235
18236 : see if setprotoent_r exists
18237 set setprotoent_r d_setprotoent_r
18238 eval $inlibc
18239 case "$d_setprotoent_r" in
18240 "$define")
18241         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18242         case "$d_setprotoent_r_proto:$usethreads" in
18243         ":define")      d_setprotoent_r_proto=define
18244                 set d_setprotoent_r_proto setprotoent_r $hdrs
18245                 eval $hasproto ;;
18246         *)      ;;
18247         esac
18248         case "$d_setprotoent_r_proto" in
18249         define)
18250         case "$setprotoent_r_proto" in
18251         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18252         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18253         esac
18254         case "$setprotoent_r_proto" in
18255         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18256         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18257         esac
18258         case "$setprotoent_r_proto" in
18259         ''|0)   d_setprotoent_r=undef
18260                 setprotoent_r_proto=0
18261                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18262         * )     case "$setprotoent_r_proto" in
18263                 REENTRANT_PROTO*) ;;
18264                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18265                 esac
18266                 echo "Prototype: $try" ;;
18267         esac
18268         ;;
18269         *)      case "$usethreads" in
18270                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18271                 esac
18272                 d_setprotoent_r=undef
18273                 setprotoent_r_proto=0
18274                 ;;
18275         esac
18276         ;;
18277 *)      setprotoent_r_proto=0
18278         ;;
18279 esac
18280
18281 : see if setpwent exists
18282 set setpwent d_setpwent
18283 eval $inlibc
18284
18285 : see if setpwent_r exists
18286 set setpwent_r d_setpwent_r
18287 eval $inlibc
18288 case "$d_setpwent_r" in
18289 "$define")
18290         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18291         case "$d_setpwent_r_proto:$usethreads" in
18292         ":define")      d_setpwent_r_proto=define
18293                 set d_setpwent_r_proto setpwent_r $hdrs
18294                 eval $hasproto ;;
18295         *)      ;;
18296         esac
18297         case "$d_setpwent_r_proto" in
18298         define)
18299         case "$setpwent_r_proto" in
18300         ''|0) try='int setpwent_r(FILE**);'
18301         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18302         esac
18303         case "$setpwent_r_proto" in
18304         ''|0) try='void setpwent_r(FILE**);'
18305         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18306         esac
18307         case "$setpwent_r_proto" in
18308         ''|0)   d_setpwent_r=undef
18309                 setpwent_r_proto=0
18310                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18311         * )     case "$setpwent_r_proto" in
18312                 REENTRANT_PROTO*) ;;
18313                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18314                 esac
18315                 echo "Prototype: $try" ;;
18316         esac
18317         ;;
18318         *)      case "$usethreads" in
18319                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18320                 esac
18321                 d_setpwent_r=undef
18322                 setpwent_r_proto=0
18323                 ;;
18324         esac
18325         ;;
18326 *)      setpwent_r_proto=0
18327         ;;
18328 esac
18329
18330 : see if setregid exists
18331 set setregid d_setregid
18332 eval $inlibc
18333 set setresgid d_setresgid
18334 eval $inlibc
18335
18336 : see if setreuid exists
18337 set setreuid d_setreuid
18338 eval $inlibc
18339 set setresuid d_setresuid
18340 eval $inlibc
18341
18342 : see if setrgid exists
18343 set setrgid d_setrgid
18344 eval $inlibc
18345
18346 : see if setruid exists
18347 set setruid d_setruid
18348 eval $inlibc
18349
18350 : see if setservent exists
18351 set setservent d_setsent
18352 eval $inlibc
18353
18354 : see if setservent_r exists
18355 set setservent_r d_setservent_r
18356 eval $inlibc
18357 case "$d_setservent_r" in
18358 "$define")
18359         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18360         case "$d_setservent_r_proto:$usethreads" in
18361         ":define")      d_setservent_r_proto=define
18362                 set d_setservent_r_proto setservent_r $hdrs
18363                 eval $hasproto ;;
18364         *)      ;;
18365         esac
18366         case "$d_setservent_r_proto" in
18367         define)
18368         case "$setservent_r_proto" in
18369         ''|0) try='int setservent_r(int, struct servent_data*);'
18370         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18371         esac
18372         case "$setservent_r_proto" in
18373         ''|0) try='void setservent_r(int, struct servent_data*);'
18374         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18375         esac
18376         case "$setservent_r_proto" in
18377         ''|0)   d_setservent_r=undef
18378                 setservent_r_proto=0
18379                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18380         * )     case "$setservent_r_proto" in
18381                 REENTRANT_PROTO*) ;;
18382                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18383                 esac
18384                 echo "Prototype: $try" ;;
18385         esac
18386         ;;
18387         *)      case "$usethreads" in
18388                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18389                 esac
18390                 d_setservent_r=undef
18391                 setservent_r_proto=0
18392                 ;;
18393         esac
18394         ;;
18395 *)      setservent_r_proto=0
18396         ;;
18397 esac
18398
18399 : see if setsid exists
18400 set setsid d_setsid
18401 eval $inlibc
18402
18403 : see if setvbuf exists
18404 set setvbuf d_setvbuf
18405 eval $inlibc
18406
18407 : see if shmctl exists
18408 set shmctl d_shmctl
18409 eval $inlibc
18410
18411 : see if shmget exists
18412 set shmget d_shmget
18413 eval $inlibc
18414
18415 : see if shmat exists
18416 set shmat d_shmat
18417 eval $inlibc
18418 : see what shmat returns
18419 case "$d_shmat" in
18420 "$define")
18421         $cat >shmat.c <<'END'
18422 #include <sys/shm.h>
18423 void *shmat();
18424 END
18425         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18426                 shmattype='void *'
18427         else
18428                 shmattype='char *'
18429         fi
18430         echo "and it returns ($shmattype)." >&4
18431         : see if a prototype for shmat is available
18432         xxx=`./findhdr sys/shm.h`
18433         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18434         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18435                 val="$define"
18436         else
18437                 val="$undef"
18438         fi
18439         $rm -f shmat.[co]
18440         ;;
18441 *)
18442         val="$undef"
18443         ;;
18444 esac
18445 set d_shmatprototype
18446 eval $setvar
18447
18448 : see if shmdt exists
18449 set shmdt d_shmdt
18450 eval $inlibc
18451
18452 : see how much of the 'shm*(2)' library is present.
18453 h_shm=true
18454 echo " "
18455 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18456 *"$undef"*) h_shm=false;;
18457 esac
18458 case "$osname" in
18459 freebsd)
18460     case "`ipcs 2>&1`" in
18461     "SVID shared memory"*"not configured"*)
18462         echo "Your $osname does not have the shm*(2) configured." >&4
18463         h_shm=false
18464         val="$undef"
18465         set shmctl d_shmctl
18466         eval $setvar
18467         set shmget d_shmget
18468         eval $setvar
18469         set shmat d_shmat
18470         eval $setvar
18471         set shmdt d_shmdt
18472         eval $setvar
18473         ;;
18474     esac
18475     ;;
18476 esac
18477 : we could also check for sys/ipc.h ...
18478 if $h_shm && $test `./findhdr sys/shm.h`; then
18479         echo "You have the full shm*(2) library." >&4
18480         val="$define"
18481 else
18482         echo "You don't have the full shm*(2) library." >&4
18483         val="$undef"
18484 fi
18485 set d_shm
18486 eval $setvar
18487
18488 : see if we have sigaction
18489 echo " "
18490 if set sigaction val -f d_sigaction; eval $csym; $val; then
18491         echo 'sigaction() found.' >&4
18492         $cat > try.c <<EOP
18493 #include <stdio.h>
18494 #include <sys/types.h>
18495 #include <signal.h>
18496 #$i_stdlib I_STDLIB
18497 #ifdef I_STDLIB
18498 #include <stdlib.h>
18499 #endif
18500 int main()
18501 {
18502     struct sigaction act, oact;
18503     act.sa_flags = 0;
18504     oact.sa_handler = 0;
18505     /* so that act and oact are used */
18506     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18507 }
18508 EOP
18509         set try
18510         if eval $compile_ok; then
18511                 val="$define"
18512         else
18513                 echo "But you don't seem to have a usable struct sigaction." >&4
18514                 val="$undef"
18515         fi
18516 else
18517         echo 'sigaction NOT found.' >&4
18518         val="$undef"
18519 fi
18520 set d_sigaction; eval $setvar
18521 $rm_try
18522
18523 : see if this is a sunmath.h system
18524 set sunmath.h i_sunmath
18525 eval $inhdr
18526
18527 : see if signbit exists
18528 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18529 $cat >try.c <<EOCP
18530 #$i_math I_MATH
18531 #$i_sunmath I_SUNMATH
18532 #ifdef I_MATH
18533 #  include <math.h>
18534 #endif
18535 #ifdef I_SUNMATH  /* Solaris special math library */
18536 #  include <sunmath.h>
18537 #endif
18538 #define NV $nvtype
18539 int main(int argc, char **argv)
18540 {
18541     NV x = 0.0;
18542     NV y = -0.0;
18543     if ((signbit(x) == 0) && (signbit(y) != 0))
18544         return 0;
18545     else
18546         return 1;
18547 }
18548 EOCP
18549 val="$undef"
18550 set try
18551 if eval $compile; then
18552     if $run ./try; then
18553         $echo "Yes." >&4
18554         val="$define"
18555     else
18556         $echo "Signbit seems to be available, but doesn't work as I expected."
18557         $echo "I won't use it." >&4
18558         val="$undef"
18559     fi
18560 else
18561     $echo "Nope." >&4
18562     dflt="$undef"
18563 fi
18564 set d_signbit
18565 eval $setvar
18566 $rm_try
18567
18568 : see if sigprocmask exists
18569 set sigprocmask d_sigprocmask
18570 eval $inlibc
18571
18572 : see if sigsetjmp exists
18573 echo " "
18574 case "$d_sigsetjmp" in
18575 '')
18576         $cat >try.c <<EOP
18577 #include <setjmp.h>
18578 #$i_stdlib I_STDLIB
18579 #ifdef I_STDLIB
18580 #include <stdlib.h>
18581 #endif
18582 sigjmp_buf env;
18583 int set = 1;
18584 int main()
18585 {
18586         if (sigsetjmp(env,1))
18587                 exit(set);
18588         set = 0;
18589         siglongjmp(env, 1);
18590         exit(1);
18591 }
18592 EOP
18593         set try
18594         if eval $compile; then
18595                 if $run ./try >/dev/null 2>&1; then
18596                         echo "POSIX sigsetjmp found." >&4
18597                         val="$define"
18598                 else
18599                         $cat >&4 <<EOM
18600 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18601 I'll ignore them.
18602 EOM
18603                         val="$undef"
18604                 fi
18605         else
18606                 echo "sigsetjmp not found." >&4
18607                 val="$undef"
18608         fi
18609         ;;
18610 *) val="$d_sigsetjmp"
18611         case "$d_sigsetjmp" in
18612         $define) echo "POSIX sigsetjmp found." >&4;;
18613         $undef) echo "sigsetjmp not found." >&4;;
18614         esac
18615         ;;
18616 esac
18617 set d_sigsetjmp
18618 eval $setvar
18619 $rm_try
18620
18621 : see if snprintf exists
18622 set snprintf d_snprintf
18623 eval $inlibc
18624
18625 : see if vsnprintf exists
18626 set vsnprintf d_vsnprintf
18627 eval $inlibc
18628
18629 case "$d_snprintf-$d_vsnprintf" in
18630 "$define-$define")
18631     $cat <<EOM
18632 Checking whether your snprintf() and vsnprintf() work okay...
18633 EOM
18634     $cat >try.c <<'EOCP'
18635 /* v?snprintf testing logic courtesy of Russ Allbery.
18636  * According to C99:
18637  * - if the buffer is too short it still must be \0-terminated
18638  * - if the buffer is too short the potentially required length
18639  *   must be returned and not -1
18640  * - if the buffer is NULL the potentially required length
18641  *   must be returned and not -1 or core dump
18642  */
18643 #include <stdio.h>
18644 #include <stdarg.h>
18645
18646 char buf[2];
18647
18648 int test (char *format, ...)
18649 {
18650     va_list args;
18651     int count;
18652
18653     va_start (args, format);
18654     count = vsnprintf (buf, sizeof buf, format, args);
18655     va_end (args);
18656     return count;
18657 }
18658
18659 int main ()
18660 {
18661     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18662              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18663 }
18664 EOCP
18665     set try
18666     if eval $compile; then
18667         `$run ./try`
18668         case "$?" in
18669         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18670         *) cat <<EOM >&4
18671 Your snprintf() and snprintf() don't seem to be working okay.
18672 EOM
18673            d_snprintf="$undef"
18674            d_vsnprintf="$undef"
18675            ;;
18676         esac
18677     else
18678         echo "(I can't seem to compile the test program--assuming they don't)"
18679         d_snprintf="$undef"
18680         d_vsnprintf="$undef"
18681     fi
18682     $rm_try
18683     ;;
18684 esac
18685
18686 : see if sockatmark exists
18687 set sockatmark d_sockatmark
18688 eval $inlibc
18689
18690 : see if prototype for sockatmark is available
18691 echo " "
18692 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18693 eval $hasproto
18694
18695 : see if socks5_init exists
18696 set socks5_init d_socks5_init
18697 eval $inlibc
18698
18699 : see if sprintf returns the length of the string in the buffer as per ANSI
18700 $echo "Checking whether sprintf returns the length of the string..." >&4
18701 $cat <<EOP >try.c
18702 #include <stdio.h>
18703 #$i_stdlib I_STDLIB
18704 #ifdef I_STDLIB
18705 #include <stdlib.h>
18706 #endif
18707 #$i_string I_STRING
18708 #ifdef I_STRING
18709 #  include <string.h>
18710 #else
18711 #  include <strings.h>
18712 #endif
18713 #$i_math I_MATH
18714 #ifdef I_MATH
18715 #include <math.h>
18716 #endif
18717
18718 char buffer[256];
18719
18720 int check (size_t expect, int test) {
18721   size_t got = strlen(buffer);
18722   if (expect == got)
18723     return 0;
18724
18725   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
18726        test, buffer);
18727   exit (test);
18728 }
18729
18730 int main(int argc, char **argv) {
18731   int test = 0;
18732
18733   check(sprintf(buffer, ""), ++test);
18734   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
18735   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
18736
18737   return 0;
18738 }
18739 EOP
18740 set try
18741
18742 if eval $compile; then
18743     xxx="`$run ./try`"
18744     case "$?" in
18745         0) cat >&4 <<EOM
18746 sprintf returns the length of the string (as ANSI says it should)
18747 EOM
18748         d_sprintf_returns_strlen="$define"
18749         ;;
18750         *) cat >&4 <<EOM
18751 sprintf does not return the length of the string (how old is this system?)
18752 EOM
18753         d_sprintf_returns_strlen="$undef"
18754         ;;
18755     esac
18756 else
18757     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
18758     d_sprintf_returns_strlen="$undef"
18759 fi
18760 $rm_try
18761
18762 : see if srand48_r exists
18763 set srand48_r d_srand48_r
18764 eval $inlibc
18765 case "$d_srand48_r" in
18766 "$define")
18767         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18768         case "$d_srand48_r_proto:$usethreads" in
18769         ":define")      d_srand48_r_proto=define
18770                 set d_srand48_r_proto srand48_r $hdrs
18771                 eval $hasproto ;;
18772         *)      ;;
18773         esac
18774         case "$d_srand48_r_proto" in
18775         define)
18776         case "$srand48_r_proto" in
18777         ''|0) try='int srand48_r(long, struct drand48_data*);'
18778         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18779         esac
18780         case "$srand48_r_proto" in
18781         ''|0)   d_srand48_r=undef
18782                 srand48_r_proto=0
18783                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18784         * )     case "$srand48_r_proto" in
18785                 REENTRANT_PROTO*) ;;
18786                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18787                 esac
18788                 echo "Prototype: $try" ;;
18789         esac
18790         ;;
18791         *)      case "$usethreads" in
18792                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18793                 esac
18794                 d_srand48_r=undef
18795                 srand48_r_proto=0
18796                 ;;
18797         esac
18798         ;;
18799 *)      srand48_r_proto=0
18800         ;;
18801 esac
18802
18803 : see if srandom_r exists
18804 set srandom_r d_srandom_r
18805 eval $inlibc
18806 case "$d_srandom_r" in
18807 "$define")
18808         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18809         case "$d_srandom_r_proto:$usethreads" in
18810         ":define")      d_srandom_r_proto=define
18811                 set d_srandom_r_proto srandom_r $hdrs
18812                 eval $hasproto ;;
18813         *)      ;;
18814         esac
18815         case "$d_srandom_r_proto" in
18816         define)
18817         case "$srandom_r_proto" in
18818         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18819         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18820         esac
18821         case "$srandom_r_proto" in
18822         ''|0)   d_srandom_r=undef
18823                 srandom_r_proto=0
18824                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18825         * )     case "$srandom_r_proto" in
18826                 REENTRANT_PROTO*) ;;
18827                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18828                 esac
18829                 echo "Prototype: $try" ;;
18830         esac
18831         ;;
18832         *)      case "$usethreads" in
18833                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18834                 esac
18835                 d_srandom_r=undef
18836                 srandom_r_proto=0
18837                 ;;
18838         esac
18839         ;;
18840 *)      srandom_r_proto=0
18841         ;;
18842 esac
18843
18844 : see if prototype for setresgid is available
18845 echo " "
18846 set d_sresgproto setresgid $i_unistd unistd.h
18847 eval $hasproto
18848
18849 : see if prototype for setresuid is available
18850 echo " "
18851 set d_sresuproto setresuid $i_unistd unistd.h
18852 eval $hasproto
18853
18854 : see if stat exists
18855 set stat d_stat
18856 eval $inlibc
18857
18858 : see if sys/stat.h is available
18859 set sys/stat.h i_sysstat
18860 eval $inhdr
18861
18862 : see if stat knows about block sizes
18863 echo " "
18864 echo "Checking to see if your struct stat has st_blocks field..." >&4
18865 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18866 eval $hasfield
18867
18868 : see if this is a sys/vfs.h system
18869 set sys/vfs.h i_sysvfs
18870 eval $inhdr
18871
18872 : see if this is a sys/statfs.h system
18873 set sys/statfs.h i_sysstatfs
18874 eval $inhdr
18875
18876 : Check for statfs_s
18877 echo " "
18878 echo "Checking to see if your system supports struct statfs..." >&4
18879 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
18880 eval $hasstruct
18881 case "$d_statfs_s" in
18882 "$define")      echo "Yes, it does."   ;;
18883 *)              echo "No, it doesn't." ;;
18884 esac
18885
18886
18887 : see if struct statfs knows about f_flags
18888 case "$d_statfs_s" in
18889 define)
18890         echo " "
18891         echo "Checking to see if your struct statfs has f_flags field..." >&4
18892         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
18893         eval $hasfield
18894         ;;
18895 *)      val="$undef"
18896         set d_statfs_f_flags
18897         eval $setvar
18898         ;;
18899 esac
18900 case "$d_statfs_f_flags" in
18901 "$define")      echo "Yes, it does."   ;;
18902 *)              echo "No, it doesn't." ;;
18903 esac
18904
18905 : see what flavor, if any, of static inline is supported
18906 echo " "
18907 echo "Checking to see if your system supports static inline..."
18908 $cat > try.c <<'EOCP'
18909 #include <stdlib.h>
18910 extern int f_via_a(int x);
18911 extern int f_via_b(int x);
18912 int main(int argc, char **argv)
18913 {
18914     int y;
18915
18916     y = f_via_a(0);
18917 #ifdef USE_B
18918     y = f_via_b(0);
18919 #endif
18920     if (y == 42) {
18921         return EXIT_SUCCESS;
18922     }
18923     else {
18924         return EXIT_FAILURE;
18925     }
18926 }
18927 EOCP
18928 $cat > a.c <<'EOCP'
18929 static INLINE int f(int x) {
18930     int y;
18931     y = x + 42;
18932     return y;
18933 }
18934
18935 int f_via_a(int x)
18936 {
18937     return f(x);
18938 }
18939 EOCP
18940 $cat > b.c <<'EOCP'
18941 extern int f(int x);
18942
18943 int f_via_b(int x)
18944 {
18945     return f(x);
18946 }
18947 EOCP
18948
18949 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18950 case "$perl_static_inline" in
18951 '')     # Check the various possibilities, and break out on success.
18952         # For gcc, prefer __inline__, which will still permit
18953         # cflags.SH to add in -ansi.
18954         case "$gccversion" in
18955                 '') xxx="inline __inline__ __inline _inline";;
18956                 *)  xxx="__inline__ inline __inline _inline";;
18957         esac
18958         for inline in $xxx; do
18959                 set try -DINLINE=$inline a.c
18960                 if eval $compile && $run ./try; then
18961                         # Now make sure there is no external linkage of static
18962                         # functions
18963                         set try -DINLINE=$inline -DUSE_B a.c b.c
18964                         if eval $compile && $run ./try; then
18965                                 $echo "Your compiler supports static $inline, " >&4
18966                                 $echo "but it also creates an external definition," >&4
18967                                 $echo "so I won't use it." >&4
18968                                 val=$undef
18969                         else
18970                                 $echo "Your compiler supports static $inline." >&4
18971                                 val=$define
18972                                 perl_static_inline="static $inline";
18973                                 break;
18974                         fi
18975                 else
18976                         $echo "Your compiler does NOT support static $inline." >&4
18977                         val="$undef"
18978                 fi
18979         done
18980         ;;
18981 *inline*) # Some variant of inline exists.
18982         echo "Keeping your $hint value of $perl_static_inline."
18983         val=$define
18984         ;;
18985 static)  # No inline capabilities
18986         echo "Keeping your $hint value of $perl_static_inline."
18987         val=$undef
18988         ;;
18989 *)  # Unrecognized previous value -- blindly trust the supplied
18990         # value and hope it makes sense.  Use old value for
18991         # d_static_inline, if there is one.
18992         echo "Keeping your $hint value of $perl_static_inline."
18993         case "$d_static_inline" in
18994                 '') val=$define ;;
18995                 *)  val=$d_static_inline ;;
18996         esac
18997         ;;
18998 esac
18999 # Fallback to plain 'static' if nothing worked.
19000 case "$perl_static_inline" in
19001 '')
19002         perl_static_inline="static"
19003         val=$undef
19004         ;;
19005 esac
19006 set d_static_inline
19007 eval $setvar
19008 $rm -f a.[co] b.[co]
19009 $rm_try
19010
19011 : Check stream access
19012 $cat >&4 <<EOM
19013 Checking how to access stdio streams by file descriptor number...
19014 EOM
19015 case "$stdio_stream_array" in
19016 '')     $cat >try.c <<EOCP
19017 #include <stdio.h>
19018 int main() {
19019   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
19020     printf("yes\n");
19021 }
19022 EOCP
19023         for s in _iob __iob __sF
19024         do
19025                 set try -DSTDIO_STREAM_ARRAY=$s
19026                 if eval $compile; then
19027                         case "`$run ./try`" in
19028                         yes)    stdio_stream_array=$s; break ;;
19029                         esac
19030                 fi
19031         done
19032         $rm_try
19033 esac
19034 case "$stdio_stream_array" in
19035 '')     $cat >&4 <<EOM
19036 I can't figure out how to access stdio streams by file descriptor number.
19037 EOM
19038         d_stdio_stream_array="$undef"
19039         ;;
19040 *)      $cat >&4 <<EOM
19041 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
19042 EOM
19043         d_stdio_stream_array="$define"
19044         ;;
19045 esac
19046
19047 : see if strcoll exists
19048 set strcoll d_strcoll
19049 eval $inlibc
19050
19051 : check for structure copying
19052 echo " "
19053 echo "Checking to see if your C compiler can copy structs..." >&4
19054 $cat >try.c <<'EOCP'
19055 int main()
19056 {
19057         struct blurfl {
19058                 int dyick;
19059         } foo, bar;
19060
19061         foo = bar;
19062 }
19063 EOCP
19064 if $cc -c try.c >/dev/null 2>&1 ; then
19065         val="$define"
19066         echo "Yup, it can."
19067 else
19068         val="$undef"
19069         echo "Nope, it can't."
19070 fi
19071 set d_strctcpy
19072 eval $setvar
19073 $rm_try
19074
19075 : see if strerror and/or sys_errlist[] exist
19076 echo " "
19077 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
19078     if set strerror val -f d_strerror; eval $csym; $val; then
19079                 echo 'strerror() found.' >&4
19080                 d_strerror="$define"
19081                 d_strerrm='strerror(e)'
19082                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19083                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
19084                         d_syserrlst="$define"
19085                 else
19086                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
19087                         d_syserrlst="$undef"
19088                 fi
19089     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
19090                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
19091                 echo 'strerror() found in string header.' >&4
19092                 d_strerror="$define"
19093                 d_strerrm='strerror(e)'
19094                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19095                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
19096                                 d_syserrlst="$define"
19097                 else
19098                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
19099                         d_syserrlst="$undef"
19100                 fi
19101     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19102                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
19103                 d_strerror="$undef"
19104                 d_syserrlst="$define"
19105                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
19106     else
19107                 echo 'strerror() and sys_errlist[] NOT found.' >&4
19108                 d_strerror="$undef"
19109                 d_syserrlst="$undef"
19110                 d_strerrm='"unknown"'
19111     fi
19112 fi
19113
19114 : see if strerror_r exists
19115 set strerror_r d_strerror_r
19116 eval $inlibc
19117 case "$d_strerror_r" in
19118 "$define")
19119         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
19120         case "$d_strerror_r_proto:$usethreads" in
19121         ":define")      d_strerror_r_proto=define
19122                 set d_strerror_r_proto strerror_r $hdrs
19123                 eval $hasproto ;;
19124         *)      ;;
19125         esac
19126         case "$d_strerror_r_proto" in
19127         define)
19128         case "$strerror_r_proto" in
19129         ''|0) try='int strerror_r(int, char*, size_t);'
19130         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
19131         esac
19132         case "$strerror_r_proto" in
19133         ''|0) try='int strerror_r(int, char*, int);'
19134         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
19135         esac
19136         case "$strerror_r_proto" in
19137         ''|0) try='char* strerror_r(int, char*, size_t);'
19138         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
19139         esac
19140         case "$strerror_r_proto" in
19141         ''|0)   d_strerror_r=undef
19142                 strerror_r_proto=0
19143                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19144         * )     case "$strerror_r_proto" in
19145                 REENTRANT_PROTO*) ;;
19146                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19147                 esac
19148                 echo "Prototype: $try" ;;
19149         esac
19150         ;;
19151         *)      case "$usethreads" in
19152                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
19153                 esac
19154                 d_strerror_r=undef
19155                 strerror_r_proto=0
19156                 ;;
19157         esac
19158         ;;
19159 *)      strerror_r_proto=0
19160         ;;
19161 esac
19162
19163 : see if strftime exists
19164 set strftime d_strftime
19165 eval $inlibc
19166
19167 : see if strlcat exists
19168 set strlcat d_strlcat
19169 eval $inlibc
19170
19171 : see if strlcpy exists
19172 set strlcpy d_strlcpy
19173 eval $inlibc
19174
19175 : see if strtod exists
19176 set strtod d_strtod
19177 eval $inlibc
19178
19179 : see if strtol exists
19180 set strtol d_strtol
19181 eval $inlibc
19182
19183 : see if strtold exists
19184 set strtold d_strtold
19185 eval $inlibc
19186
19187 : see if strtoll exists
19188 set strtoll d_strtoll
19189 eval $inlibc
19190
19191 case "$d_longlong-$d_strtoll" in
19192 "$define-$define")
19193         $cat <<EOM
19194 Checking whether your strtoll() works okay...
19195 EOM
19196         $cat >try.c <<'EOCP'
19197 #include <errno.h>
19198 #ifdef __hpux
19199 #define strtoll __strtoll
19200 #endif
19201 #ifdef __EMX__
19202 #define strtoll _strtoll
19203 #endif
19204 #include <stdio.h>
19205 extern long long int strtoll(char *s, char **, int);
19206 static int bad = 0;
19207 int check(char *s, long long ell, int een) {
19208         long long gll;
19209         errno = 0;
19210         gll = strtoll(s, 0, 10);
19211         if (!((gll == ell) && (errno == een)))
19212                 bad++;
19213 }
19214 int main() {
19215         check(" 1",                                      1LL, 0);
19216         check(" 0",                                      0LL, 0);
19217         check("-1",                                     -1LL, 0);
19218         check("-9223372036854775808", -9223372036854775808LL, 0);
19219         check("-9223372036854775808", -9223372036854775808LL, 0);
19220         check(" 9223372036854775807",  9223372036854775807LL, 0);
19221         check("-9223372036854775808", -9223372036854775808LL, 0);
19222         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19223         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19224         if (!bad)
19225                 printf("ok\n");
19226 }
19227 EOCP
19228         set try
19229         if eval $compile; then
19230                 yyy=`$run ./try`
19231                 case "$yyy" in
19232                 ok) echo "Your strtoll() seems to be working okay." ;;
19233                 *) cat <<EOM >&4
19234 Your strtoll() doesn't seem to be working okay.
19235 EOM
19236                    d_strtoll="$undef"
19237                    ;;
19238                 esac
19239         else
19240                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19241                 d_strtoll="$undef"
19242         fi
19243         ;;
19244 esac
19245
19246 : see if strtoq exists
19247 set strtoq d_strtoq
19248 eval $inlibc
19249
19250 : see if strtoul exists
19251 set strtoul d_strtoul
19252 eval $inlibc
19253
19254 case "$d_strtoul" in
19255 "$define")
19256         $cat <<EOM
19257 Checking whether your strtoul() works okay...
19258 EOM
19259         $cat >try.c <<'EOCP'
19260 #include <errno.h>
19261 #include <stdio.h>
19262 extern unsigned long int strtoul(char *s, char **, int);
19263 static int bad = 0;
19264 void check(char *s, unsigned long eul, int een) {
19265         unsigned long gul;
19266         errno = 0;
19267         gul = strtoul(s, 0, 10);
19268         if (!((gul == eul) && (errno == een)))
19269                 bad++;
19270 }
19271 int main() {
19272         check(" 1", 1L, 0);
19273         check(" 0", 0L, 0);
19274 EOCP
19275         case "$longsize" in
19276         8)
19277             $cat >>try.c <<'EOCP'
19278         check("18446744073709551615", 18446744073709551615UL, 0);
19279         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19280 #if 0 /* strtoul() for /^-/ strings is undefined. */
19281         check("-1", 18446744073709551615UL, 0);
19282         check("-18446744073709551614", 2, 0);
19283         check("-18446744073709551615", 1, 0);
19284         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19285         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19286 #endif
19287 EOCP
19288                 ;;
19289         4)
19290                     $cat >>try.c <<'EOCP'
19291         check("4294967295", 4294967295UL, 0);
19292         check("4294967296", 4294967295UL, ERANGE);
19293 #if 0 /* strtoul() for /^-/ strings is undefined. */
19294         check("-1", 4294967295UL, 0);
19295         check("-4294967294", 2, 0);
19296         check("-4294967295", 1, 0);
19297         check("-4294967296", 4294967295UL, ERANGE);
19298         check("-4294967297", 4294967295UL, ERANGE);
19299 #endif
19300 EOCP
19301                 ;;
19302         *)
19303 : Should we write these tests to be more portable by sprintf-ing
19304 : ~0 and then manipulating that char string as input for strtol?
19305                 ;;
19306         esac
19307         $cat >>try.c <<'EOCP'
19308         if (!bad)
19309                 printf("ok\n");
19310         return 0;
19311 }
19312 EOCP
19313         set try
19314         if eval $compile; then
19315                 case "`$run ./try`" in
19316                 ok) echo "Your strtoul() seems to be working okay." ;;
19317                 *) cat <<EOM >&4
19318 Your strtoul() doesn't seem to be working okay.
19319 EOM
19320                    d_strtoul="$undef"
19321                    ;;
19322                 esac
19323         else
19324                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19325                 d_strtoul="$undef"
19326         fi
19327         ;;
19328 esac
19329
19330 : see if strtoull exists
19331 set strtoull d_strtoull
19332 eval $inlibc
19333
19334 case "$d_longlong-$d_strtoull" in
19335 "$define-$define")
19336         $cat <<EOM
19337 Checking whether your strtoull() works okay...
19338 EOM
19339         $cat >try.c <<'EOCP'
19340 #include <errno.h>
19341 #ifdef __hpux
19342 #define strtoull __strtoull
19343 #endif
19344 #include <stdio.h>
19345 extern unsigned long long int strtoull(char *s, char **, int);
19346 static int bad = 0;
19347 int check(char *s, long long eull, int een) {
19348         long long gull;
19349         errno = 0;
19350         gull = strtoull(s, 0, 10);
19351         if (!((gull == eull) && (errno == een)))
19352                 bad++;
19353 }
19354 int main() {
19355         check(" 1",                                        1LL, 0);
19356         check(" 0",                                        0LL, 0);
19357         check("18446744073709551615",  18446744073709551615ULL, 0);
19358         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19359 #if 0 /* strtoull() for /^-/ strings is undefined. */
19360         check("-1",                    18446744073709551615ULL, 0);
19361         check("-18446744073709551614",                     2LL, 0);
19362         check("-18446744073709551615",                     1LL, 0);
19363         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19364         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19365 #endif
19366         if (!bad)
19367                 printf("ok\n");
19368 }
19369 EOCP
19370         set try
19371         if eval $compile; then
19372                 case "`$run ./try`" in
19373                 ok) echo "Your strtoull() seems to be working okay." ;;
19374                 *) cat <<EOM >&4
19375 Your strtoull() doesn't seem to be working okay.
19376 EOM
19377                    d_strtoull="$undef"
19378                    ;;
19379                 esac
19380         else
19381                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19382                 d_strtoull="$undef"
19383         fi
19384         ;;
19385 esac
19386
19387 : see if strtouq exists
19388 set strtouq d_strtouq
19389 eval $inlibc
19390
19391 case "$d_strtouq" in
19392 "$define")
19393         $cat <<EOM
19394 Checking whether your strtouq() works okay...
19395 EOM
19396         $cat >try.c <<'EOCP'
19397 #include <errno.h>
19398 #include <stdio.h>
19399 extern unsigned long long int strtouq(char *s, char **, int);
19400 static int bad = 0;
19401 void check(char *s, unsigned long long eull, int een) {
19402         unsigned long long gull;
19403         errno = 0;
19404         gull = strtouq(s, 0, 10);
19405         if (!((gull == eull) && (errno == een)))
19406                 bad++;
19407 }
19408 int main() {
19409         check(" 1",                                        1LL, 0);
19410         check(" 0",                                        0LL, 0);
19411         check("18446744073709551615",  18446744073709551615ULL, 0);
19412         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19413 #if 0 /* strtouq() for /^-/ strings is undefined. */
19414         check("-1",                    18446744073709551615ULL, 0);
19415         check("-18446744073709551614",                     2LL, 0);
19416         check("-18446744073709551615",                     1LL, 0);
19417         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19418         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19419 #endif
19420         if (!bad)
19421                 printf("ok\n");
19422         return 0;
19423 }
19424 EOCP
19425         set try
19426         if eval $compile; then
19427                 case "`$run ./try`" in
19428                 ok) echo "Your strtouq() seems to be working okay." ;;
19429                 *) cat <<EOM >&4
19430 Your strtouq() doesn't seem to be working okay.
19431 EOM
19432                    d_strtouq="$undef"
19433                    ;;
19434                 esac
19435         else
19436                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19437                 d_strtouq="$undef"
19438         fi
19439         ;;
19440 esac
19441
19442 : see if strxfrm exists
19443 set strxfrm d_strxfrm
19444 eval $inlibc
19445
19446 : see if symlink exists
19447 set symlink d_symlink
19448 eval $inlibc
19449
19450 : see if syscall exists
19451 set syscall d_syscall
19452 eval $inlibc
19453
19454 : see if prototype for syscall is available
19455 echo " "
19456 set d_syscallproto syscall $i_unistd unistd.h
19457 eval $hasproto
19458
19459 : see if sysconf exists
19460 set sysconf d_sysconf
19461 eval $inlibc
19462
19463 : see if system exists
19464 set system d_system
19465 eval $inlibc
19466
19467 : see if tcgetpgrp exists
19468 set tcgetpgrp d_tcgetpgrp
19469 eval $inlibc
19470
19471 : see if tcsetpgrp exists
19472 set tcsetpgrp d_tcsetpgrp
19473 eval $inlibc
19474
19475 : see if prototype for telldir is available
19476 echo " "
19477 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19478 eval $hasproto
19479
19480 : see if tgamma exists
19481 set tgamma d_tgamma
19482 eval $inlibc
19483
19484 : see if time exists
19485 echo " "
19486 if test "X$d_time" = X -o X"$timetype" = X; then
19487     if set time val -f d_time; eval $csym; $val; then
19488                 echo 'time() found.' >&4
19489                 val="$define"
19490                 rp="What is the type returned by time() on this system?"
19491                 set time_t timetype long stdio.h sys/types.h
19492                 eval $typedef_ask
19493     else
19494                 echo 'time() not found, hope that will do.' >&4
19495                 val="$undef"
19496                 timetype='int';
19497     fi
19498     set d_time
19499     eval $setvar
19500 fi
19501
19502 : see if timegm exists
19503 set timegm d_timegm
19504 eval $inlibc
19505
19506 : see if this is a sys/times.h system
19507 set sys/times.h i_systimes
19508 eval $inhdr
19509
19510 : see if times exists
19511 echo " "
19512 if set times val -f d_times; eval $csym; $val; then
19513         echo 'times() found.' >&4
19514         d_times="$define"
19515         inc=''
19516         case "$i_systimes" in
19517         "$define") inc='sys/times.h';;
19518         esac
19519         rp="What is the type returned by times() on this system?"
19520         set clock_t clocktype long stdio.h sys/types.h $inc
19521         eval $typedef_ask
19522 else
19523         echo 'times() NOT found, hope that will do.' >&4
19524         d_times="$undef"
19525         clocktype='int'
19526 fi
19527
19528 : see if tmpnam_r exists
19529 set tmpnam_r d_tmpnam_r
19530 eval $inlibc
19531 case "$d_tmpnam_r" in
19532 "$define")
19533         hdrs="$i_systypes sys/types.h define stdio.h "
19534         case "$d_tmpnam_r_proto:$usethreads" in
19535         ":define")      d_tmpnam_r_proto=define
19536                 set d_tmpnam_r_proto tmpnam_r $hdrs
19537                 eval $hasproto ;;
19538         *)      ;;
19539         esac
19540         case "$d_tmpnam_r_proto" in
19541         define)
19542         case "$tmpnam_r_proto" in
19543         ''|0) try='char* tmpnam_r(char*);'
19544         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19545         esac
19546         case "$tmpnam_r_proto" in
19547         ''|0)   d_tmpnam_r=undef
19548                 tmpnam_r_proto=0
19549                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19550         * )     case "$tmpnam_r_proto" in
19551                 REENTRANT_PROTO*) ;;
19552                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19553                 esac
19554                 echo "Prototype: $try" ;;
19555         esac
19556         ;;
19557         *)      case "$usethreads" in
19558                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19559                 esac
19560                 d_tmpnam_r=undef
19561                 tmpnam_r_proto=0
19562                 ;;
19563         esac
19564         ;;
19565 *)      tmpnam_r_proto=0
19566         ;;
19567 esac
19568
19569 : see if trunc exists
19570 set trunc d_trunc
19571 eval $inlibc
19572
19573 : see if truncate exists
19574 set truncate d_truncate
19575 eval $inlibc
19576
19577 : see if ttyname_r exists
19578 set ttyname_r d_ttyname_r
19579 eval $inlibc
19580 case "$d_ttyname_r" in
19581 "$define")
19582         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19583         case "$d_ttyname_r_proto:$usethreads" in
19584         ":define")      d_ttyname_r_proto=define
19585                 set d_ttyname_r_proto ttyname_r $hdrs
19586                 eval $hasproto ;;
19587         *)      ;;
19588         esac
19589         case "$d_ttyname_r_proto" in
19590         define)
19591         case "$ttyname_r_proto" in
19592         ''|0) try='int ttyname_r(int, char*, size_t);'
19593         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19594         esac
19595         case "$ttyname_r_proto" in
19596         ''|0) try='int ttyname_r(int, char*, int);'
19597         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19598         esac
19599         case "$ttyname_r_proto" in
19600         ''|0) try='char* ttyname_r(int, char*, int);'
19601         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19602         esac
19603         case "$ttyname_r_proto" in
19604         ''|0)   d_ttyname_r=undef
19605                 ttyname_r_proto=0
19606                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19607         * )     case "$ttyname_r_proto" in
19608                 REENTRANT_PROTO*) ;;
19609                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19610                 esac
19611                 echo "Prototype: $try" ;;
19612         esac
19613         ;;
19614         *)      case "$usethreads" in
19615                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19616                 esac
19617                 d_ttyname_r=undef
19618                 ttyname_r_proto=0
19619                 ;;
19620         esac
19621         ;;
19622 *)      ttyname_r_proto=0
19623         ;;
19624 esac
19625
19626 : see if tzname[] exists
19627 echo " "
19628 if set tzname val -a d_tzname; eval $csym; $val; then
19629         val="$define"
19630         echo 'tzname[] found.' >&4
19631 else
19632         val="$undef"
19633         echo 'tzname[] NOT found.' >&4
19634 fi
19635 set d_tzname
19636 eval $setvar
19637
19638 : Check if is a multiplatform env
19639 case "$osname" in
19640 darwin) multiarch="$define" ;;
19641 esac
19642 case "$multiarch" in
19643 ''|[nN]*) multiarch="$undef" ;;
19644 esac
19645
19646 : check for ordering of bytes in a UV
19647 echo " "
19648 case "$multiarch" in
19649 *$define*)
19650         $cat <<EOM
19651 You seem to be doing a multiarchitecture build,
19652 skipping the byteorder check.
19653
19654 EOM
19655         byteorder='ffff'
19656         ;;
19657 *)
19658         case "$byteorder" in
19659         '')
19660                 $cat <<'EOM'
19661 In the following, larger digits indicate more significance.  A big-endian
19662 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19663 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19664 machines may have weird orders like 3412.  A Cray will report 87654321,
19665 an Alpha will report 12345678. If the test program works the default is
19666 probably right.
19667 I'm now running the test program...
19668 EOM
19669                 $cat >try.c <<EOCP
19670 #include <stdio.h>
19671 #$i_stdlib I_STDLIB
19672 #ifdef I_STDLIB
19673 #include <stdlib.h>
19674 #endif
19675 #include <sys/types.h>
19676 typedef $uvtype UV;
19677 int main()
19678 {
19679         int i;
19680         union {
19681                 UV l;
19682                 char c[$uvsize];
19683         } u;
19684
19685         if ($uvsize > 4)
19686                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19687         else
19688                 u.l = (UV)0x04030201;
19689         for (i = 0; i < $uvsize; i++)
19690                 printf("%c", u.c[i]+'0');
19691         printf("\n");
19692         exit(0);
19693 }
19694 EOCP
19695                 xxx_prompt=y
19696                 set try
19697                 if eval $compile && $run ./try > /dev/null; then
19698                         dflt=`$run ./try`
19699                         case "$dflt" in
19700                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19701                                 echo "(The test program ran ok.)"
19702                                 echo "byteorder=$dflt"
19703                                 xxx_prompt=n
19704                         ;;
19705                         ????|????????) echo "(The test program ran ok.)" ;;
19706                         *) echo "(The test program didn't run right for some reason.)" ;;
19707                         esac
19708                 else
19709                         dflt='4321'
19710                         cat <<'EOM'
19711 (I can't seem to compile the test program.  Guessing big-endian...)
19712 EOM
19713                 fi
19714                 case "$xxx_prompt" in
19715                 y)
19716                         rp="What is the order of bytes in $uvtype?"
19717                         . ./myread
19718                         byteorder="$ans"
19719                         ;;
19720                 *)      byteorder=$dflt
19721                         ;;
19722                 esac
19723                 ;;
19724         esac
19725         $rm_try
19726         ;;
19727 esac
19728
19729 : Checking 32bit alignedness
19730 $cat <<EOM
19731
19732 Checking to see whether you can access character data unalignedly...
19733 EOM
19734 case "$d_u32align" in
19735 '')   $cat >try.c <<EOCP
19736 #include <stdio.h>
19737 #$i_stdlib I_STDLIB
19738 #ifdef I_STDLIB
19739 #include <stdlib.h>
19740 #endif
19741 #define U32 $u32type
19742 #define BYTEORDER 0x$byteorder
19743 #define U8 $u8type
19744 #include <signal.h>
19745 #ifdef SIGBUS
19746 $signal_t bletch(int s) { exit(4); }
19747 #endif
19748 int main() {
19749 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19750     volatile U8 buf[8];
19751     volatile U32 *up;
19752     int i;
19753
19754     if (sizeof(U32) != 4) {
19755         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19756         exit(1);
19757     }
19758
19759     fflush(stdout);
19760
19761 #ifdef SIGBUS
19762     signal(SIGBUS, bletch);
19763 #endif
19764
19765     buf[0] = 0;
19766     buf[1] = 0;
19767     buf[2] = 0;
19768     buf[3] = 1;
19769     buf[4] = 0;
19770     buf[5] = 0;
19771     buf[6] = 0;
19772     buf[7] = 1;
19773
19774     for (i = 0; i < 4; i++) {
19775         up = (U32*)(buf + i);
19776         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19777                (*up == 1 << (8*(3-i)))  /* little-endian */
19778               )
19779            )
19780         {
19781             printf("read failed (%x)\n", *up);
19782             exit(2);
19783         }
19784     }
19785
19786     /* write test */
19787     for (i = 0; i < 4; i++) {
19788         up = (U32*)(buf + i);
19789         *up = 0xBeef;
19790         if (*up != 0xBeef) {
19791             printf("write failed (%x)\n", *up);
19792             exit(3);
19793         }
19794     }
19795
19796     exit(0);
19797 #else
19798     printf("1\n");
19799     exit(1);
19800 #endif
19801     return 0;
19802 }
19803 EOCP
19804 set try
19805 if eval $compile_ok; then
19806         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19807         $run ./try 2>&1 >/dev/null
19808         case "$?" in
19809         0)      cat >&4 <<EOM
19810 You can access character data pretty unalignedly.
19811 EOM
19812                 d_u32align="$undef"
19813                 ;;
19814         *)      cat >&4 <<EOM
19815 It seems that you must access character data in an aligned manner.
19816 EOM
19817                 d_u32align="$define"
19818                 ;;
19819         esac
19820 else
19821         rp='Can you access character data at unaligned addresses?'
19822         dflt='n'
19823         . ./myread
19824         case "$ans" in
19825         [yY]*)  d_u32align="$undef"  ;;
19826         *)      d_u32align="$define" ;;
19827         esac
19828 fi
19829 $rm_try
19830 ;;
19831 esac
19832
19833 : see if ualarm exists
19834 set ualarm d_ualarm
19835 eval $inlibc
19836
19837 : see if umask exists
19838 set umask d_umask
19839 eval $inlibc
19840
19841 : see if unordered exists
19842 set unordered d_unordered
19843 eval $inlibc
19844
19845 : see if unsetenv exists
19846 set unsetenv d_unsetenv
19847 eval $inlibc
19848
19849 : see if usleep exists
19850 set usleep d_usleep
19851 eval $inlibc
19852
19853 : see if prototype for usleep is available
19854 echo " "
19855 set d_usleepproto usleep $i_unistd unistd.h
19856 eval $hasproto
19857
19858 : see if ustat exists
19859 set ustat d_ustat
19860 eval $inlibc
19861
19862 : see if closedir exists
19863 set closedir d_closedir
19864 eval $inlibc
19865
19866 case "$d_closedir" in
19867 "$define")
19868         echo " "
19869         echo "Checking whether closedir() returns a status..." >&4
19870         cat > try.c <<EOM
19871 #$i_dirent I_DIRENT             /**/
19872 #$i_sysdir I_SYS_DIR            /**/
19873 #$i_sysndir I_SYS_NDIR          /**/
19874 #$i_systypes I_SYS_TYPES        /**/
19875
19876 #if defined(I_SYS_TYPES)
19877 #include <sys/types.h>
19878 #endif
19879 #if defined(I_DIRENT)
19880 #include <dirent.h>
19881 #else
19882 #ifdef I_SYS_NDIR
19883 #include <sys/ndir.h>
19884 #else
19885 #ifdef I_SYS_DIR
19886 #ifdef hp9000s500
19887 #include <ndir.h>       /* may be wrong in the future */
19888 #else
19889 #include <sys/dir.h>
19890 #endif
19891 #endif
19892 #endif
19893 #endif
19894 int main() { return closedir(opendir(".")); }
19895 EOM
19896         set try
19897         if eval $compile_ok; then
19898                 if $run ./try > /dev/null 2>&1 ; then
19899                         echo "Yes, it does."
19900                         val="$undef"
19901                 else
19902                         echo "No, it doesn't."
19903                         val="$define"
19904                 fi
19905         else
19906                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19907                 val="$define"
19908         fi
19909         ;;
19910 *)
19911         val="$undef";
19912         ;;
19913 esac
19914 set d_void_closedir
19915 eval $setvar
19916 $rm_try
19917
19918 : see if there is a wait4
19919 set wait4 d_wait4
19920 eval $inlibc
19921
19922 : see if waitpid exists
19923 set waitpid d_waitpid
19924 eval $inlibc
19925
19926 : look for wcscmp
19927 echo " "
19928 $cat >try.c <<'EOCP'
19929 #include <stdio.h>
19930 #include <wchar.h>
19931 int main ()
19932 {
19933     wchar_t *s = L" ";
19934     return (wcscmp (s, s) ? 1 : 0);
19935     }
19936 EOCP
19937 set try
19938 val="$undef"
19939 if eval $compile; then
19940     `$run ./try`
19941     case "$?" in
19942         0)  echo "A working wcscmp() found." >&4
19943             val="$define" ;;
19944         *)  echo "wcscmp() found, but it doesn't work" >&4
19945             ;;
19946         esac
19947 else
19948     echo "wcscmp() NOT found." >&4
19949     fi
19950 set d_wcscmp
19951 eval $setvar
19952 $rm_try
19953
19954 : see if wcstombs exists
19955 set wcstombs d_wcstombs
19956 eval $inlibc
19957
19958 : look for wcsxfrm
19959 echo " "
19960 $cat >try.c <<'EOCP'
19961 #include <errno.h>
19962 #include <wchar.h>
19963 int main ()
19964 {
19965     wchar_t dst[4], *src = L" ";
19966     errno = 0;
19967     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
19968     }
19969 EOCP
19970 set try
19971 val="$undef"
19972 if eval $compile; then
19973     `$run ./try`
19974     case "$?" in
19975         0)  echo "A working wcsxfrm() found." >&4
19976             val="$define" ;;
19977         *)  echo "wcsxfrm() found, but it doesn't work" >&4
19978             ;;
19979         esac
19980 else
19981     echo "wcsxfrm() NOT found." >&4
19982     fi
19983 set d_wcsxfrm
19984 eval $setvar
19985 $rm_try
19986
19987 : see if wctomb exists
19988 set wctomb d_wctomb
19989 eval $inlibc
19990
19991 : see if writev exists
19992 set writev d_writev
19993 eval $inlibc
19994
19995 : check for alignment requirements
19996 echo " "
19997 case "$alignbytes" in
19998     '') echo "Checking alignment constraints..." >&4
19999         if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
20000             $cat >try.c <<'EOCP'
20001 typedef long double NV;
20002 EOCP
20003         else
20004             $cat >try.c <<'EOCP'
20005 typedef double NV;
20006 EOCP
20007         fi
20008         $cat >>try.c <<'EOCP'
20009 #include <stdio.h>
20010 struct foobar {
20011     char foo;
20012     NV bar;
20013 } try_algn;
20014 int main()
20015 {
20016     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20017     return(0);
20018 }
20019 EOCP
20020         set try
20021         if eval $compile_ok; then
20022             dflt=`$run ./try`
20023         else
20024             dflt='8'
20025             echo "(I can't seem to compile the test program...)"
20026         fi
20027         case "$multiarch" in
20028             *$define*)
20029                 : The usual safe value is 8, but Darwin with -Duselongdouble
20030                 : needs 16.  Hence, we will take 8 as a minimum, but allow
20031                 : Configure to pick a larger value if needed.
20032                 if $test "$dflt" -lt 8; then
20033                     dflt='8'
20034                     echo "Setting alignment to 8 for multiarch support.">&4
20035                 fi
20036                 ;;
20037         esac
20038         ;;
20039     *) dflt="$alignbytes"
20040         ;;
20041 esac
20042 rp="Doubles must be aligned on a how-many-byte boundary?"
20043 . ./myread
20044 alignbytes="$ans"
20045 $rm_try
20046
20047 : set the base revision
20048 baserev=5.0
20049
20050 : length of character in bytes. Is always 1, otherwise it is not C
20051 : This used to be a test using sizeof
20052 charsize=1
20053
20054 : Check for the number of bits in a character
20055 case "$charbits" in
20056 '')     echo "Checking how long a character is (in bits)..." >&4
20057         $cat >try.c <<EOCP
20058 #include <stdio.h>
20059 int main ()
20060 {
20061     int n;
20062     unsigned char c;
20063     for (c = 1, n = 0; c; c <<= 1, n++) ;
20064     printf ("%d\n", n);
20065     return (0);
20066     }
20067 EOCP
20068         set try
20069         if eval $compile_ok; then
20070                 dflt=`$run ./try`
20071         else
20072                 dflt='8'
20073                 echo "(I can't seem to compile the test program.  Guessing...)"
20074         fi
20075         ;;
20076 *)
20077         dflt="$charbits"
20078         ;;
20079 esac
20080 rp="What is the length of a character (in bits)?"
20081 . ./myread
20082 charbits="$ans"
20083 $rm_try
20084 case "$charbits" in
20085 8)      ;;
20086 *)      cat >&4 << EOM
20087 Your system has an unsigned character size of $charbits bits, which
20088 is rather unusual (normally it is 8 bits).  Perl likely will not work
20089 correctly on your system, with subtle bugs in various places.
20090 EOM
20091         rp='Do you really want to continue?'
20092         dflt='n'
20093         . ./myread
20094         case "$ans" in
20095                 [yY])   echo >&4 "Okay, continuing."    ;;
20096                 *)      exit 1                          ;;
20097         esac
20098 esac
20099
20100 : how do we concatenate cpp tokens here?
20101 echo " "
20102 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20103 $cat >cpp_stuff.c <<'EOCP'
20104 #define RCAT(a,b)a/**/b
20105 #define ACAT(a,b)a ## b
20106 RCAT(Rei,ser)
20107 ACAT(Cir,cus)
20108 EOCP
20109 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20110 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20111         echo "Oh!  Smells like ANSI's been here." >&4
20112         echo "We can catify or stringify, separately or together!"
20113         cpp_stuff=42
20114 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20115         echo "Ah, yes!  The good old days!" >&4
20116         echo "However, in the good old days we don't know how to stringify and"
20117         echo "catify at the same time."
20118         cpp_stuff=1
20119 else
20120         $cat >&4 <<EOM
20121 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20122 You're going to have to edit the values of CAT[2-5] in config.h...
20123 EOM
20124         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20125 fi
20126 $rm -f cpp_stuff.*
20127
20128 : see if this is a db.h system
20129 set db.h i_db
20130 eval $inhdr
20131
20132 case "$i_db" in
20133 $define)
20134         : Check db version.
20135         echo " "
20136         echo "Checking Berkeley DB version ..." >&4
20137         $cat >try.c <<EOCP
20138 #$d_const HASCONST
20139 #ifndef HASCONST
20140 #define const
20141 #endif
20142 #include <sys/types.h>
20143 #include <stdio.h>
20144 #$i_stdlib I_STDLIB
20145 #ifdef I_STDLIB
20146 #include <stdlib.h>
20147 #endif
20148 #include <db.h>
20149 int main(int argc, char *argv[])
20150 {
20151 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20152     int Major, Minor, Patch ;
20153     unsigned long Version ;
20154     (void)db_version(&Major, &Minor, &Patch) ;
20155     if (argc == 2) {
20156         printf("%d %d %d %d %d %d\n",
20157                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20158                Major, Minor, Patch);
20159         exit(0);
20160     }
20161     printf("You have Berkeley DB Version 2 or greater.\n");
20162
20163     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20164                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20165     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20166                 Major, Minor, Patch) ;
20167
20168     /* check that db.h & libdb are compatible */
20169     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20170         printf("db.h and libdb are incompatible.\n") ;
20171         exit(3);
20172     }
20173
20174     printf("db.h and libdb are compatible.\n") ;
20175
20176     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20177                 + DB_VERSION_PATCH ;
20178
20179     /* needs to be >= 2.3.4 */
20180     if (Version < 2003004) {
20181     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20182         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20183         exit(2);
20184     }
20185
20186     exit(0);
20187 #else
20188 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20189     if (argc == 2) {
20190         printf("1 0 0\n");
20191         exit(0);
20192     }
20193     printf("You have Berkeley DB Version 1.\n");
20194     exit(0);    /* DB version < 2: the coast is clear. */
20195 #else
20196     exit(1);    /* <db.h> not Berkeley DB? */
20197 #endif
20198 #endif
20199 }
20200 EOCP
20201         set try
20202         if eval $compile_ok && $run ./try; then
20203                 echo 'Looks OK.' >&4
20204                 set `$run ./try 1`
20205                 db_version_major=$1
20206                 db_version_minor=$2
20207                 db_version_patch=$3
20208         else
20209                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20210                 i_db=$undef
20211                 case " $libs " in
20212                 *"-ldb "*)
20213                         : Remove db from list of libraries to use
20214                         echo "Removing unusable -ldb from library list" >&4
20215                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20216                         shift
20217                         libs="$*"
20218                         echo "libs = $libs" >&4
20219                         ;;
20220                 esac
20221         fi
20222         $rm_try
20223         ;;
20224 esac
20225
20226 case "$i_db" in
20227 define)
20228         : Check the return type needed for hash
20229         echo " "
20230         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20231         $cat >try.c <<EOCP
20232 #$d_const HASCONST
20233 #ifndef HASCONST
20234 #define const
20235 #endif
20236 #include <sys/types.h>
20237 #include <db.h>
20238
20239 #ifndef DB_VERSION_MAJOR
20240 u_int32_t hash_cb (const void* ptr, size_t size)
20241 {
20242 }
20243 HASHINFO info;
20244 int main()
20245 {
20246         info.hash = hash_cb;
20247 }
20248 #endif
20249 EOCP
20250         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20251                 if $contains warning try.out >>/dev/null 2>&1 ; then
20252                         db_hashtype='int'
20253                 else
20254                         db_hashtype='u_int32_t'
20255                 fi
20256         else
20257                 : XXX Maybe we should just give up here.
20258                 db_hashtype=u_int32_t
20259                 $cat try.out >&4
20260                 echo "Help:  I can't seem to compile the db test program." >&4
20261                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20262         fi
20263         $rm_try
20264         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20265         ;;
20266 *)      db_hashtype=u_int32_t
20267         ;;
20268 esac
20269 case "$i_db" in
20270 define)
20271         : Check the return type needed for prefix
20272         echo " "
20273         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20274         cat >try.c <<EOCP
20275 #$d_const HASCONST
20276 #ifndef HASCONST
20277 #define const
20278 #endif
20279 #include <sys/types.h>
20280 #include <db.h>
20281
20282 #ifndef DB_VERSION_MAJOR
20283 size_t prefix_cb (const DBT *key1, const DBT *key2)
20284 {
20285 }
20286 BTREEINFO info;
20287 int main()
20288 {
20289         info.prefix = prefix_cb;
20290 }
20291 #endif
20292 EOCP
20293         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20294                 if $contains warning try.out >>/dev/null 2>&1 ; then
20295                         db_prefixtype='int'
20296                 else
20297                         db_prefixtype='size_t'
20298                 fi
20299         else
20300                 db_prefixtype='size_t'
20301                 : XXX Maybe we should just give up here.
20302                 $cat try.out >&4
20303                 echo "Help:  I can't seem to compile the db test program." >&4
20304                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20305         fi
20306         $rm_try
20307         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20308         ;;
20309 *)      db_prefixtype='size_t'
20310         ;;
20311 esac
20312
20313 : How can we generate normalized random numbers ?
20314 echo " "
20315 echo "Using our internal random number implementation..." >&4
20316
20317 case "$ccflags" in
20318 *-Dmy_rand=*|*-Dmy_srand=*)
20319         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20320         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20321         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20322         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20323         ;;
20324 esac
20325
20326 randfunc=Perl_drand48
20327 drand01="Perl_drand48()"
20328 seedfunc="Perl_drand48_init"
20329 randbits=48
20330 randseedtype=U32
20331
20332 : Determine if this is an EBCDIC system
20333 echo " "
20334 echo "Determining whether or not we are on an EBCDIC system..." >&4
20335 $cat >try.c <<'EOM'
20336 int main()
20337 {
20338   if ('M'==0xd4) return 0;
20339   return 1;
20340 }
20341 EOM
20342
20343 val=$undef
20344 set try
20345 if eval $compile_ok; then
20346         if $run ./try; then
20347                 echo "You seem to speak EBCDIC." >&4
20348                 val="$define"
20349         else
20350                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20351         fi
20352 else
20353         echo "I'm unable to compile the test program." >&4
20354         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20355 fi
20356 $rm_try
20357 set ebcdic
20358 eval $setvar
20359
20360 : Check how to flush
20361 echo " "
20362 $cat >&4 <<EOM
20363 Checking how to flush all pending stdio output...
20364 EOM
20365 # I only know how to find the first 32 possibly open files on SunOS.
20366 # See also hints/sunos_4_1.sh and util.c  --AD
20367 case "$osname" in
20368 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20369 esac
20370 $cat >>try.c <<EOCP
20371 #include <stdio.h>
20372 #$i_stdlib I_STDLIB
20373 #ifdef I_STDLIB
20374 #include <stdlib.h>
20375 #endif
20376 #$i_unistd I_UNISTD
20377 #ifdef I_UNISTD
20378 # include <unistd.h>
20379 #endif
20380 #$d_sysconf HAS_SYSCONF
20381 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20382 #ifdef HAS_STDIO_STREAM_ARRAY
20383 # define STDIO_STREAM_ARRAY $stdio_stream_array
20384 #endif
20385 int main() {
20386   FILE* p;
20387   unlink("try.out");
20388   p = fopen("try.out", "w");
20389 #ifdef TRY_FPUTC
20390   fputc('x', p);
20391 #else
20392 # ifdef TRY_FPRINTF
20393   fprintf(p, "x");
20394 # endif
20395 #endif
20396 #ifdef TRY_FFLUSH_NULL
20397   fflush(NULL);
20398 #endif
20399 #ifdef TRY_FFLUSH_ALL
20400   {
20401     long open_max = -1;
20402 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20403     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20404 # else
20405 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20406     open_max = sysconf(_SC_OPEN_MAX);
20407 #  else
20408 #   ifdef FOPEN_MAX
20409     open_max = FOPEN_MAX;
20410 #   else
20411 #    ifdef OPEN_MAX
20412     open_max = OPEN_MAX;
20413 #    else
20414 #     ifdef _NFILE
20415     open_max = _NFILE;
20416 #     endif
20417 #    endif
20418 #   endif
20419 #  endif
20420 # endif
20421 # ifdef HAS_STDIO_STREAM_ARRAY
20422     if (open_max > 0) {
20423       long i;
20424       for (i = 0; i < open_max; i++)
20425             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20426                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20427                 STDIO_STREAM_ARRAY[i]._flag)
20428                 fflush(&STDIO_STREAM_ARRAY[i]);
20429     }
20430   }
20431 # endif
20432 #endif
20433   _exit(42);
20434 }
20435 EOCP
20436 : first we have to find out how _not_ to flush
20437 $to try.c
20438 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20439     output=''
20440     set try -DTRY_FPUTC
20441     if eval $compile; then
20442             $run ./try 2>/dev/null
20443             code="$?"
20444             $from try.out
20445             if $test ! -s try.out -a "X$code" = X42; then
20446                 output=-DTRY_FPUTC
20447             fi
20448     fi
20449     case "$output" in
20450     '')
20451             set try -DTRY_FPRINTF
20452             if eval $compile; then
20453                     $run ./try 2>/dev/null
20454                     code="$?"
20455                     $from try.out
20456                     if $test ! -s try.out -a "X$code" = X42; then
20457                         output=-DTRY_FPRINTF
20458                     fi
20459             fi
20460         ;;
20461     esac
20462 fi
20463 : check for fflush NULL behavior
20464 case "$fflushNULL" in
20465 '')     set try -DTRY_FFLUSH_NULL $output
20466         if eval $compile; then
20467                 $run ./try 2>/dev/null
20468                 code="$?"
20469                 $from try.out
20470                 if $test -s try.out -a "X$code" = X42; then
20471                         fflushNULL="`$cat try.out`"
20472                 else
20473                         if $test "X$code" != X42; then
20474                                 $cat >&4 <<EOM
20475 (If this test failed, don't worry, we'll try another method shortly.)
20476 EOM
20477                         fi
20478                 fi
20479         fi
20480         $rm -f core try.core core.try.*
20481         case "$fflushNULL" in
20482         x)      $cat >&4 <<EOM
20483 Your fflush(NULL) works okay for output streams.
20484 Let's see if it clobbers input pipes...
20485 EOM
20486 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20487 # bug that improperly flushes the input end of pipes.  So we avoid the
20488 # autoflush on fork/system/exec support for now. :-(
20489 $cat >tryp.c <<EOCP
20490 #include <stdio.h>
20491 int
20492 main(int argc, char **argv)
20493 {
20494     char buf[1024];
20495     int i;
20496     char *bp = buf;
20497     while (1) {
20498         while ((i = getc(stdin)) != -1
20499                && (*bp++ = i) != '\n'
20500                && bp < &buf[1024])
20501         /* DO NOTHING */ ;
20502         *bp = '\0';
20503         fprintf(stdout, "%s", buf);
20504         fflush(NULL);
20505         if (i == -1)
20506             return 0;
20507         bp = buf;
20508     }
20509 }
20510 EOCP
20511                 fflushNULL="$define"
20512                 set tryp
20513                 if eval $compile; then
20514                     $rm -f tryp.out
20515                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20516                     if $test "X$targethost" != X; then
20517                         $to tryp.c
20518                         $to tryp
20519                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20520                     else
20521                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20522                     fi
20523                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20524                        $cat >&4 <<EOM
20525 fflush(NULL) seems to behave okay with input streams.
20526 EOM
20527                         fflushNULL="$define"
20528                     else
20529                         $cat >&4 <<EOM
20530 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20531 EOM
20532                         fflushNULL="$undef"
20533                     fi
20534                 fi
20535                 $rm -f core tryp.c tryp.core core.tryp.*
20536                 ;;
20537         '')     $cat >&4 <<EOM
20538 Your fflush(NULL) isn't working (contrary to ANSI C).
20539 EOM
20540                 fflushNULL="$undef"
20541                 ;;
20542         *)      $cat >&4 <<EOM
20543 Cannot figure out whether your fflush(NULL) works or not.
20544 I'm assuming it doesn't (contrary to ANSI C).
20545 EOM
20546                 fflushNULL="$undef"
20547                 ;;
20548         esac
20549         ;;
20550 $define|true|[yY]*)
20551         fflushNULL="$define"
20552         ;;
20553 *)
20554         fflushNULL="$undef"
20555         ;;
20556 esac
20557 : check explicit looping only if NULL did not work, and if the pipe
20558 : bug does not show up on an explicit flush too
20559 case "$fflushNULL" in
20560 "$undef")
20561         $cat >tryp.c <<EOCP
20562 #include <stdio.h>
20563 int
20564 main(int argc, char **argv)
20565 {
20566     char buf[1024];
20567     int i;
20568     char *bp = buf;
20569     while (1) {
20570         while ((i = getc(stdin)) != -1
20571                && (*bp++ = i) != '\n'
20572                && bp < &buf[1024])
20573         /* DO NOTHING */ ;
20574         *bp = '\0';
20575         fprintf(stdout, "%s", buf);
20576         fflush(stdin);
20577         if (i == -1)
20578             return 0;
20579         bp = buf;
20580     }
20581 }
20582 EOCP
20583         set tryp
20584         if eval $compile; then
20585             $rm -f tryp.out
20586             if $test "X$targethost" != X; then
20587                 $to tryp.c
20588                 $to tryp
20589                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20590             else
20591                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20592             fi
20593             if cmp tryp.c tryp.out >/dev/null 2>&1; then
20594                $cat >&4 <<EOM
20595 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20596 EOM
20597                 : now check for fflushall behaviour
20598                 case "$fflushall" in
20599                 '')     set try -DTRY_FFLUSH_ALL $output
20600                         if eval $compile; then
20601                                 $cat >&4 <<EOM
20602 (Now testing the other method--but note that this also may fail.)
20603 EOM
20604                                 $run ./try 2>/dev/null
20605                                 code=$?
20606                                 $from try.out
20607                                 if $test -s try.out -a "X$code" = X42; then
20608                                         fflushall="`$cat try.out`"
20609                                 fi
20610                         fi
20611                         $rm_try
20612                         case "$fflushall" in
20613                         x)      $cat >&4 <<EOM
20614 Whew. Flushing explicitly all the stdio streams works.
20615 EOM
20616                                 fflushall="$define"
20617                                 ;;
20618                         '')     $cat >&4 <<EOM
20619 Sigh. Flushing explicitly all the stdio streams doesn't work.
20620 EOM
20621                                 fflushall="$undef"
20622                                 ;;
20623                         *)      $cat >&4 <<EOM
20624 Cannot figure out whether flushing stdio streams explicitly works or not.
20625 I'm assuming it doesn't.
20626 EOM
20627                                 fflushall="$undef"
20628                                 ;;
20629                         esac
20630                         ;;
20631                 "$define"|true|[yY]*)
20632                         fflushall="$define"
20633                         ;;
20634                 *)
20635                         fflushall="$undef"
20636                         ;;
20637                 esac
20638             else
20639                 $cat >&4 <<EOM
20640 All is futile.  Even fflush(stdin) clobbers input pipes!
20641 EOM
20642                 fflushall="$undef"
20643             fi
20644         else
20645             fflushall="$undef"
20646         fi
20647         $rm -f core tryp.c tryp.core core.tryp.*
20648         ;;
20649 *)      fflushall="$undef"
20650         ;;
20651 esac
20652
20653 case "$fflushNULL$fflushall" in
20654 undefundef)
20655         $cat <<EOM
20656 OK, I give up.  I cannot figure out how to flush pending stdio output.
20657 We won't be flushing handles at all before fork/exec/popen.
20658 EOM
20659         ;;
20660 esac
20661 $rm_try tryp
20662
20663 : Store the full pathname to the ar program for use in the C program
20664 : Respect a hint or command line value for full_ar.
20665 case "$full_ar" in
20666 '') full_ar=$ar ;;
20667 esac
20668
20669 : Store the full pathname to the sed program for use in the C program
20670 full_sed=$sed
20671
20672 : see what type gids are declared as in the kernel
20673 echo " "
20674 echo "Looking for the type for group ids returned by getgid()."
20675 set gid_t gidtype xxx stdio.h sys/types.h
20676 eval $typedef
20677 case "$gidtype" in
20678 xxx)
20679         xxx=`./findhdr sys/user.h`
20680         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
20681         case $1 in
20682         unsigned) dflt="$1 $2" ;;
20683         *) dflt="$1" ;;
20684         esac
20685         ;;
20686 *) dflt="$gidtype";;
20687 esac
20688 case "$gidtype" in
20689 gid_t) echo "gid_t found." ;;
20690 *)      rp="What is the type for group ids returned by getgid()?"
20691         . ./myread
20692         gidtype="$ans"
20693         ;;
20694 esac
20695
20696 : Check the size of GID
20697 echo " "
20698 case "$gidtype" in
20699 *_t) zzz="$gidtype"     ;;
20700 *)   zzz="gid"          ;;
20701 esac
20702 echo "Checking the size of $zzz..." >&4
20703 cat > try.c <<EOCP
20704 #include <sys/types.h>
20705 #include <stdio.h>
20706 #$i_stdlib I_STDLIB
20707 #ifdef I_STDLIB
20708 #include <stdlib.h>
20709 #endif
20710 int main() {
20711     printf("%d\n", (int)sizeof($gidtype));
20712     exit(0);
20713 }
20714 EOCP
20715 set try
20716 if eval $compile_ok; then
20717         yyy=`$run ./try`
20718         case "$yyy" in
20719         '')     gidsize=4
20720                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
20721                 ;;
20722         *)      gidsize=$yyy
20723                 echo "Your $zzz is $gidsize bytes long."
20724                 ;;
20725         esac
20726 else
20727         gidsize=4
20728         echo "(I can't compile the test program--guessing $gidsize.)" >&4
20729 fi
20730
20731
20732 : Check if GID is signed
20733 echo " "
20734 case "$gidtype" in
20735 *_t) zzz="$gidtype"     ;;
20736 *)   zzz="gid"          ;;
20737 esac
20738 echo "Checking the sign of $zzz..." >&4
20739 cat > try.c <<EOCP
20740 #include <sys/types.h>
20741 #include <stdio.h>
20742 int main() {
20743         $gidtype foo = -1;
20744         if (foo < 0)
20745                 printf("-1\n");
20746         else
20747                 printf("1\n");
20748 }
20749 EOCP
20750 set try
20751 if eval $compile; then
20752         yyy=`$run ./try`
20753         case "$yyy" in
20754         '')     gidsign=1
20755                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20756                 ;;
20757         *)      gidsign=$yyy
20758                 case "$gidsign" in
20759                  1) echo "Your $zzz is unsigned." ;;
20760                 -1) echo "Your $zzz is signed."   ;;
20761                 esac
20762                 ;;
20763         esac
20764 else
20765         gidsign=1
20766         echo "(I can't compile the test program--guessing unsigned.)" >&4
20767 fi
20768
20769
20770 : Check 64bit sizes
20771 echo " "
20772
20773 if $test X"$quadtype" != X; then
20774
20775 echo "Checking how to print 64-bit integers..." >&4
20776
20777 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
20778         $cat >try.c <<'EOCP'
20779 #include <sys/types.h>
20780 #include <stdio.h>
20781 int main() {
20782   int q = 12345678901;
20783   printf("%ld\n", q);
20784 }
20785 EOCP
20786         set try
20787         if eval $compile; then
20788                 yyy=`$run ./try`
20789                 case "$yyy" in
20790                 12345678901)
20791                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
20792                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
20793                         echo "We will use %d."
20794                         ;;
20795                 esac
20796         fi
20797 fi
20798
20799 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
20800         $cat >try.c <<'EOCP'
20801 #include <sys/types.h>
20802 #include <stdio.h>
20803 int main() {
20804   long q = 12345678901;
20805   printf("%ld\n", q);
20806 }
20807 EOCP
20808         set try
20809         if eval $compile; then
20810                 yyy=`$run ./try`
20811                 case "$yyy" in
20812                 12345678901)
20813                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
20814                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
20815                         echo "We will use %ld."
20816                         ;;
20817                 esac
20818         fi
20819 fi
20820
20821 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
20822         $cat >try.c <<'EOCP'
20823 #include <sys/types.h>
20824 #include <inttypes.h>
20825 #include <stdio.h>
20826 int main() {
20827   int64_t q = 12345678901;
20828   printf("%" PRId64 "\n", q);
20829 }
20830 EOCP
20831         set try
20832         if eval $compile; then
20833                 yyy=`$run ./try`
20834                 case "$yyy" in
20835                 12345678901)
20836                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
20837                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
20838                         echo "We will use the C9X style."
20839                         ;;
20840                 esac
20841         fi
20842 fi
20843
20844 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20845         $cat >try.c <<EOCP
20846 #include <sys/types.h>
20847 #include <stdio.h>
20848 int main() {
20849   $quadtype q = 12345678901;
20850   printf("%Ld\n", q);
20851 }
20852 EOCP
20853         set try
20854         if eval $compile; then
20855                 yyy=`$run ./try`
20856                 case "$yyy" in
20857                 12345678901)
20858                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
20859                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20860                         echo "We will use %Ld."
20861                         ;;
20862                 esac
20863         fi
20864 fi
20865
20866 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20867         $cat >try.c <<'EOCP'
20868 #include <sys/types.h>
20869 #include <stdio.h>
20870 int main() {
20871   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20872   printf("%lld\n", q);
20873 }
20874 EOCP
20875         set try
20876         if eval $compile; then
20877                 yyy=`$run ./try`
20878                 case "$yyy" in
20879                 12345678901)
20880                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20881                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20882                         echo "We will use the %lld style."
20883                         ;;
20884                 esac
20885         fi
20886 fi
20887
20888 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20889         $cat >try.c <<EOCP
20890 #include <sys/types.h>
20891 #include <stdio.h>
20892 int main() {
20893   $quadtype q = 12345678901;
20894   printf("%qd\n", q);
20895 }
20896 EOCP
20897         set try
20898         if eval $compile; then
20899                 yyy=`$run ./try`
20900                 case "$yyy" in
20901                 12345678901)
20902                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20903                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20904                         echo "We will use %qd."
20905                         ;;
20906                 esac
20907         fi
20908 fi
20909
20910 if $test X"$sPRId64" = X; then
20911         echo "Cannot figure out how to print 64-bit integers." >&4
20912 fi
20913 $rm_try
20914
20915 fi
20916
20917 case "$sPRId64" in
20918 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20919         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20920         ;;
20921 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20922         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20923         ;;
20924 esac
20925
20926 : Check format strings for internal types
20927 echo " "
20928 $echo "Checking the format strings to be used for Perl's internal types..." >&4
20929
20930 if $test X"$ivsize" = X8; then
20931         ivdformat="$sPRId64"
20932         uvuformat="$sPRIu64"
20933         uvoformat="$sPRIo64"
20934         uvxformat="$sPRIx64"
20935         uvXUformat="$sPRIXU64"
20936 else
20937         if $test X"$ivsize" = X"$longsize"; then
20938                 ivdformat='"ld"'
20939                 uvuformat='"lu"'
20940                 uvoformat='"lo"'
20941                 uvxformat='"lx"'
20942                 uvXUformat='"lX"'
20943         else
20944                 if $test X"$ivsize" = X"$intsize"; then
20945                         ivdformat='"d"'
20946                         uvuformat='"u"'
20947                         uvoformat='"o"'
20948                         uvxformat='"x"'
20949                         uvXUformat='"X"'
20950                 else
20951                         : far out
20952                         if $test X"$ivsize" = X"$shortsize"; then
20953                                 ivdformat='"hd"'
20954                                 uvuformat='"hu"'
20955                                 uvoformat='"ho"'
20956                                 uvxformat='"hx"'
20957                                 uvXUformat='"hX"'
20958                         fi
20959                 fi
20960         fi
20961 fi
20962
20963 if $test X"$usequadmath" = X"$define"; then
20964     nveformat='"Qe"'
20965     nvfformat='"Qf"'
20966     nvgformat='"Qg"'
20967     nvEUformat='"QE"'
20968     nvFUformat='"QF"'
20969     nvGUformat='"QG"'
20970 else
20971     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20972         nveformat="$sPRIeldbl"
20973         nvfformat="$sPRIfldbl"
20974         nvgformat="$sPRIgldbl"
20975         nvEUformat="$sPRIEUldbl"
20976         nvFUformat="$sPRIFUldbl"
20977         nvGUformat="$sPRIGUldbl"
20978     else
20979         nveformat='"e"'
20980         nvfformat='"f"'
20981         nvgformat='"g"'
20982         nvEUformat='"E"'
20983         nvFUformat='"F"'
20984         nvGUformat='"G"'
20985     fi
20986 fi
20987
20988 case "$ivdformat" in
20989 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20990     exit 1
20991     ;;
20992 esac
20993
20994 : Check format string for GID
20995
20996 echo " "
20997 $echo "Checking the format string to be used for gids..." >&4
20998
20999 case "$gidsign" in
21000 -1)     if $test X"$gidsize" = X"$ivsize"; then
21001                 gidformat="$ivdformat"
21002         else
21003                 if $test X"$gidsize" = X"$longsize"; then
21004                         gidformat='"ld"'
21005                 else
21006                         if $test X"$gidsize" = X"$intsize"; then
21007                                 gidformat='"d"'
21008                         else
21009                                 if $test X"$gidsize" = X"$shortsize"; then
21010                                         gidformat='"hd"'
21011                                 fi
21012                         fi
21013                 fi
21014         fi
21015         ;;
21016 *)      if $test X"$gidsize" = X"$uvsize"; then
21017                 gidformat="$uvuformat"
21018         else
21019                 if $test X"$gidsize" = X"$longsize"; then
21020                         gidformat='"lu"'
21021                 else
21022                         if $test X"$gidsize" = X"$intsize"; then
21023                                 gidformat='"u"'
21024                         else
21025                                 if $test X"$gidsize" = X"$shortsize"; then
21026                                         gidformat='"hu"'
21027                                 fi
21028                         fi
21029                 fi
21030         fi
21031         ;;
21032 esac
21033
21034 : see if getgroups exists
21035 set getgroups d_getgrps
21036 eval $inlibc
21037
21038 : see if setgroups exists
21039 set setgroups d_setgrps
21040 eval $inlibc
21041
21042 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21043 echo " "
21044 case "$d_getgrps$d_setgrps" in
21045 *define*)
21046         case "$groupstype" in
21047         '') dflt="$gidtype" ;;
21048         *)  dflt="$groupstype" ;;
21049         esac
21050         $cat <<EOM
21051 What type of pointer is the second argument to getgroups() and setgroups()?
21052 Usually this is the same as group ids, $gidtype, but not always.
21053
21054 EOM
21055         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21056         . ./myread
21057         groupstype="$ans"
21058         ;;
21059 *)  groupstype="$gidtype";;
21060 esac
21061
21062 : check whether make sets MAKE
21063 echo " "
21064 echo "Checking if your $make program sets \$(MAKE)..." >&4
21065 case "$make_set_make" in
21066 '')
21067         $sed 's/^X //' > testmake.mak << 'EOF'
21068 Xall:
21069 X       @echo 'maketemp="$(MAKE)"'
21070 EOF
21071         case "`$make -f testmake.mak 2>/dev/null`" in
21072         *maketemp=*) make_set_make='#' ;;
21073         *)      make_set_make="MAKE=$make" ;;
21074         esac
21075         $rm -f testmake.mak
21076         ;;
21077 esac
21078 case "$make_set_make" in
21079 '#') echo "Yup, it does.";;
21080 *) echo "Nope, it doesn't.";;
21081 esac
21082
21083 : see what type is used for mode_t
21084 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21085 set mode_t modetype int stdio.h sys/types.h
21086 eval $typedef_ask
21087
21088 : see if we need va_copy
21089 echo " "
21090 case "$i_stdarg" in
21091 "$define")
21092         $cat >try.c <<EOCP
21093 #include <stdarg.h>
21094 #include <stdio.h>
21095 #$i_stdlib I_STDLIB
21096 #ifdef I_STDLIB
21097 #include <stdlib.h>
21098 #endif
21099 #include <signal.h>
21100
21101 int
21102 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21103 {
21104   return vfprintf(f, fmt, *valp);
21105 }
21106
21107 int
21108 myvfprintf(FILE *f, const  char *fmt, va_list val)
21109 {
21110   return ivfprintf(f, fmt, &val);
21111 }
21112
21113 int
21114 myprintf(char *fmt, ...)
21115 {
21116   va_list val;
21117   va_start(val, fmt);
21118   return myvfprintf(stdout, fmt, val);
21119 }
21120
21121 int
21122 main(int ac, char **av)
21123 {
21124   signal(SIGSEGV, exit);
21125
21126   myprintf("%s%cs all right, then\n", "that", '\'');
21127   exit(0);
21128 }
21129 EOCP
21130         set try
21131         if eval $compile && $run ./try 2>&1 >/dev/null; then
21132                 case "`$run ./try`" in
21133                 "that's all right, then")
21134                         okay=yes
21135                         ;;
21136                 esac
21137         fi
21138         case "$okay" in
21139         yes)    echo "It seems that you don't need va_copy()." >&4
21140                 need_va_copy="$undef"
21141                 ;;
21142         *)      echo "It seems that va_copy() or similar will be needed." >&4
21143                 need_va_copy="$define"
21144                 ;;
21145         esac
21146         $rm_try
21147         ;;
21148 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
21149         need_va_copy="$undef"
21150         ;;
21151 esac
21152
21153 : see what type is used for size_t
21154 rp="What is the type used for the length parameter for string functions?"
21155 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21156 eval $typedef_ask
21157
21158 : check for type of arguments to gethostbyaddr.
21159 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21160         case "$d_gethbyaddr" in
21161         $define)
21162                 $cat <<EOM
21163
21164 Checking to see what type of arguments are accepted by gethostbyaddr().
21165 EOM
21166                 hdrs="$define sys/types.h
21167                         $d_socket sys/socket.h
21168                         $i_niin netinet/in.h
21169                         $i_netdb netdb.h
21170                         $i_unistd unistd.h"
21171                 : The first arg can 'char *' or 'void *'
21172                 : The second arg is some of integral type
21173                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21174                         for yyy in size_t long int; do
21175                                 case "$netdb_host_type" in
21176                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21177                                         if ./protochk "$try" $hdrs; then
21178                                                 echo "Your system accepts $xxx for the first arg."
21179                                                 echo "...and $yyy for the second arg."
21180                                                 netdb_host_type="$xxx"
21181                                                 netdb_hlen_type="$yyy"
21182                                         fi
21183                                         ;;
21184                                 esac
21185                         done
21186                 done
21187                 : In case none of those worked, prompt the user.
21188                 case "$netdb_host_type" in
21189                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21190                         dflt='char *'
21191                         . ./myread
21192                         netdb_host_type=$ans
21193                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21194                         dflt="$sizetype"
21195                         . ./myread
21196                         netdb_hlen_type=$ans
21197                         ;;
21198                 esac
21199                 ;;
21200         *)      : no gethostbyaddr, so pick harmless defaults
21201                 netdb_host_type='char *'
21202                 netdb_hlen_type="$sizetype"
21203                 ;;
21204         esac
21205         # Remove the "const" if needed. -- but then we'll have a
21206         # prototype clash!
21207         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21208 fi
21209
21210 : check for type of argument to gethostbyname.
21211 if test "X$netdb_name_type" = X ; then
21212         case "$d_gethbyname" in
21213         $define)
21214                 $cat <<EOM
21215
21216 Checking to see what type of argument is accepted by gethostbyname().
21217 EOM
21218                 hdrs="$define sys/types.h
21219                         $d_socket sys/socket.h
21220                         $i_niin netinet/in.h
21221                         $i_netdb netdb.h
21222                         $i_unistd unistd.h"
21223                 for xxx in "const char *" "char *"; do
21224                         case "$netdb_name_type" in
21225                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21226                                 if ./protochk "$try" $hdrs; then
21227                                         echo "Your system accepts $xxx."
21228                                         netdb_name_type="$xxx"
21229                                 fi
21230                                 ;;
21231                         esac
21232                 done
21233                 : In case none of those worked, prompt the user.
21234                 case "$netdb_name_type" in
21235                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21236                         dflt='char *'
21237                         . ./myread
21238                         netdb_name_type=$ans
21239                         ;;
21240                 esac
21241                 ;;
21242         *)      : no gethostbyname, so pick harmless default
21243                 netdb_name_type='char *'
21244                 ;;
21245         esac
21246 fi
21247
21248 : check for type of 1st argument to getnetbyaddr.
21249 if test "X$netdb_net_type" = X ; then
21250         case "$d_getnbyaddr" in
21251         $define)
21252                 $cat <<EOM
21253
21254 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21255 EOM
21256                 hdrs="$define sys/types.h
21257                         $d_socket sys/socket.h
21258                         $i_niin netinet/in.h
21259                         $i_netdb netdb.h
21260                         $i_unistd unistd.h"
21261                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21262                         case "$netdb_net_type" in
21263                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21264                                 if ./protochk "$try" $hdrs; then
21265                                         echo "Your system accepts $xxx."
21266                                         netdb_net_type="$xxx"
21267                                 fi
21268                                 ;;
21269                         esac
21270                 done
21271                 : In case none of those worked, prompt the user.
21272                 case "$netdb_net_type" in
21273                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21274                         dflt='long'
21275                         . ./myread
21276                         netdb_net_type=$ans
21277                         ;;
21278                 esac
21279                 ;;
21280         *)      : no getnetbyaddr, so pick harmless default
21281                 netdb_net_type='long'
21282                 ;;
21283         esac
21284 fi
21285 : locate the preferred pager for this system
21286 fn=f/
21287 case "$pager" in
21288 '')
21289         dflt=''
21290         case "$pg" in
21291         /*) dflt=$pg;;
21292         [a-zA-Z]:/*) dflt=$pg;;
21293         esac
21294         case "$more" in
21295         /*) dflt=$more;;
21296         [a-zA-Z]:/*) dflt=$more;;
21297         esac
21298         case "$less" in
21299         /*) dflt=$less;;
21300         [a-zA-Z]:/*) dflt=$less;;
21301         esac
21302         case "$dflt" in
21303         '') dflt=/usr/ucb/more;;
21304         esac
21305         ;;
21306 *)      dflt="$pager"
21307         ;;
21308 esac
21309 fn="f/($dflt)"
21310 echo " "
21311 rp='What pager is used on your system?'
21312 . ./getfile
21313 pager="$ans"
21314
21315 : see what type pids are declared as in the kernel
21316 rp="What is the type of process ids on this system?"
21317 set pid_t pidtype int stdio.h sys/types.h
21318 eval $typedef_ask
21319
21320 : see if ar generates random libraries by itself
21321 echo " "
21322 echo "Checking how to generate random libraries on your machine..." >&4
21323 echo 'int bar1() { return bar2(); }' > bar1.c
21324 echo 'int bar2() { return 2; }' > bar2.c
21325 $cat > foo.c <<EOP
21326 #$i_stdlib I_STDLIB
21327 #ifdef I_STDLIB
21328 #include <stdlib.h>
21329 #endif
21330 int main() { printf("%d\n", bar1()); exit(0); }
21331 EOP
21332 $cc $ccflags -c bar1.c >/dev/null 2>&1
21333 $cc $ccflags -c bar2.c >/dev/null 2>&1
21334 $cc $ccflags -c foo.c >/dev/null 2>&1
21335 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21336 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21337         $run ./foobar >/dev/null 2>&1; then
21338         echo "$ar appears to generate random libraries itself."
21339         orderlib=false
21340         if [ "X$ranlib" = "X" ]; then
21341             ranlib=":"
21342         fi
21343 elif $ar s bar$_a >/dev/null 2>&1 &&
21344         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21345         $run ./foobar >/dev/null 2>&1; then
21346                 echo "a table of contents needs to be added with '$ar s'."
21347                 orderlib=false
21348                 ranlib="$ar s"
21349 elif $ar ts bar$_a >/dev/null 2>&1 &&
21350         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21351         $run ./foobar >/dev/null 2>&1; then
21352                 echo "a table of contents needs to be added with '$ar ts'."
21353                 orderlib=false
21354                 ranlib="$ar ts"
21355 else
21356         case "$ranlib" in
21357         :) ranlib='';;
21358         '')
21359                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21360                 $test -f $ranlib || ranlib=''
21361                 ;;
21362         esac
21363         if $test -n "$ranlib"; then
21364                 echo "your system has '$ranlib'; we'll use that."
21365                 orderlib=false
21366         else
21367                 echo "your system doesn't seem to support random libraries"
21368                 echo "so we'll use lorder and tsort to order the libraries."
21369                 orderlib=true
21370                 ranlib=":"
21371         fi
21372 fi
21373 $rm -f foo* bar*
21374
21375 : see if this is a values.h system
21376 set values.h i_values
21377 eval $inhdr
21378
21379 : Check the max offset that gmtime and localtime accept
21380 echo "Checking max offsets that gmtime () accepts"
21381
21382 case $i_values in
21383     define) yyy="#include <values.h>" ;;
21384     *)      yyy="" ;;
21385     esac
21386
21387 case "$sGMTIME_min/$sGMTIME_max" in
21388     0/0|/)
21389         $cat >try.c <<EOCP
21390 #include <sys/types.h>
21391 #include <stdio.h>
21392 #include <time.h>
21393 $yyy
21394
21395 int i;
21396 struct tm *tmp;
21397 time_t pt;
21398
21399 void gm_check (time_t t, int min_year, int max_year)
21400 {
21401     tmp = gmtime (&t);
21402     if ( tmp == NULL ||
21403         /* Check tm_year overflow */
21404          tmp->tm_year < min_year || tmp->tm_year > max_year)
21405         tmp = NULL;
21406     else
21407         pt = t;
21408     } /* gm_check */
21409
21410 int check_max ()
21411 {
21412     tmp = NULL;
21413     pt  = 0;
21414 #ifdef MAXLONG
21415     gm_check (MAXLONG, 69, 0x7fffffff);
21416 #endif
21417     if (tmp == NULL || tmp->tm_year < 0) {
21418         for (i = 63; i >= 0; i--) {
21419             time_t x = pt | ((time_t)1 << i);
21420             if (x < 0 || x < pt) continue;
21421             gm_check (x, 69, 0x7fffffff);
21422             }
21423         }
21424     printf ("sGMTIME_max=%ld\n", pt);
21425     return (0);
21426     } /* check_max */
21427
21428 int check_min ()
21429 {
21430     tmp = NULL;
21431     pt  = 0;
21432 #ifdef MINLONG
21433     gm_check (MINLONG, -1900, 70);
21434 #endif
21435     if (tmp == NULL) {
21436         for (i = 36; i >= 0; i--) {
21437             time_t x = pt - ((time_t)1 << i);
21438             if (x > 0) continue;
21439             gm_check (x, -1900, 70);
21440             }
21441         }
21442     printf ("sGMTIME_min=%ld\n", pt);
21443     return (0);
21444     } /* check_min */
21445
21446 int main (int argc, char *argv[])
21447 {
21448     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21449     check_max ();
21450     check_min ();
21451     return (0);
21452     } /* main */
21453 EOCP
21454         set try
21455         if eval $compile; then
21456             eval `$run ./try 2>/dev/null`
21457         else
21458             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21459             fi
21460         $rm_try
21461         ;;
21462     esac
21463
21464 echo "Checking max offsets that localtime () accepts"
21465
21466 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21467     0/0|/)
21468         $cat >try.c <<EOCP
21469 #include <sys/types.h>
21470 #include <stdio.h>
21471 #include <time.h>
21472 $yyy
21473
21474 int i;
21475 struct tm *tmp;
21476 time_t pt;
21477
21478 void local_check (time_t t, int min_year, int max_year)
21479 {
21480     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21481         tmp = NULL;
21482     else
21483         tmp = localtime (&t);
21484     if ( tmp == NULL ||
21485         /* Check tm_year overflow */
21486          tmp->tm_year < min_year || tmp->tm_year > max_year)
21487         tmp = NULL;
21488     else
21489         pt = t;
21490     } /* local_check */
21491
21492 int check_max ()
21493 {
21494     tmp = NULL;
21495     pt  = 0;
21496 #ifdef MAXLONG
21497     local_check (MAXLONG, 69, 0x7fffffff);
21498 #endif
21499     if (tmp == NULL || tmp->tm_year < 0) {
21500         for (i = 63; i >= 0; i--) {
21501             time_t x = pt | ((time_t)1 << i);
21502             if (x < 0 || x < pt) continue;
21503             local_check (x, 69, 0x7fffffff);
21504             }
21505         }
21506     printf ("sLOCALTIME_max=%ld\n", pt);
21507     return (0);
21508    } /* check_max */
21509
21510 int check_min ()
21511 {
21512     tmp = NULL;
21513     pt  = 0;
21514 #ifdef MINLONG
21515     local_check (MINLONG, -1900, 70);
21516 #endif
21517     if (tmp == NULL) {
21518         for (i = 36; i >= 0; i--) {
21519             time_t x = pt - ((time_t)1 << i);
21520             if (x > 0) continue;
21521             local_check (x, -1900, 70);
21522             }
21523         }
21524     printf ("sLOCALTIME_min=%ld\n", pt);
21525     return (0);
21526     } /* check_min */
21527
21528 int main (int argc, char *argv[])
21529 {
21530     check_max ();
21531     check_min ();
21532     return (0);
21533     } /* main */
21534 EOCP
21535         set try
21536         if eval $compile; then
21537             eval `$run ./try 2>/dev/null`
21538         else
21539             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21540             fi
21541         $rm_try
21542         ;;
21543     esac
21544
21545 : check for type of arguments to select.
21546 case "$selecttype" in
21547 '') case "$d_select" in
21548         $define)
21549                 echo " "
21550                 $cat <<EOM
21551 Checking to see what type of arguments are accepted by select().
21552 EOM
21553                 hdrs="$define sys/types.h
21554                         $i_systime sys/time.h
21555                         $i_sysselct sys/select.h
21556                         $d_socket sys/socket.h"
21557                 : The first arg can be int, unsigned, or size_t
21558                 : The last arg may or may not be 'const'
21559                 val=''
21560                 : void pointer has been seen but using that
21561                 : breaks the selectminbits test
21562                 for xxx in 'fd_set *' 'int *'; do
21563                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21564                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
21565                                         case "$val" in
21566                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21567                                                 if ./protochk "$try" $hdrs; then
21568                                                         echo "Your system accepts $xxx."
21569                                                         val="$xxx"
21570                                                 fi
21571                                                 ;;
21572                                         esac
21573                                 done
21574                         done
21575                 done
21576                 case "$val" in
21577                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21578                         case "$d_fd_set" in
21579                                 $define) dflt="fd_set *" ;;
21580                                 *)              dflt="int *" ;;
21581                         esac
21582                         . ./myread
21583                         val=$ans
21584                         ;;
21585                 esac
21586                 selecttype="$val"
21587                 ;;
21588         *)      : no select, so pick a harmless default
21589                 selecttype='int *'
21590                 ;;
21591         esac
21592         ;;
21593 esac
21594
21595 : check for the select 'width'
21596 case "$selectminbits" in
21597 '') safebits=`expr $ptrsize \* 8`
21598     case "$d_select" in
21599         $define)
21600                 $cat <<EOM
21601
21602 Checking to see on how many bits at a time your select() operates...
21603 EOM
21604                 $cat >try.c <<EOCP
21605 #include <sys/types.h>
21606 #$i_time I_TIME
21607 #$i_systime I_SYS_TIME
21608 #$i_systimek I_SYS_TIME_KERNEL
21609 #ifdef I_TIME
21610 #   include <time.h>
21611 #endif
21612 #ifdef I_SYS_TIME
21613 #   ifdef I_SYS_TIME_KERNEL
21614 #       define KERNEL
21615 #   endif
21616 #   include <sys/time.h>
21617 #   ifdef I_SYS_TIME_KERNEL
21618 #       undef KERNEL
21619 #   endif
21620 #endif
21621 #$i_sysselct I_SYS_SELECT
21622 #ifdef I_SYS_SELECT
21623 #include <sys/select.h>
21624 #endif
21625 #$d_socket HAS_SOCKET
21626 #ifdef HAS_SOCKET
21627 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21628 #endif
21629 #include <stdio.h>
21630 #$i_stdlib I_STDLIB
21631 #ifdef I_STDLIB
21632 #include <stdlib.h>
21633 #endif
21634 $selecttype b;
21635 #define S sizeof(*(b))
21636 #define MINBITS 64
21637 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21638 #define NBITS  (NBYTES * 8)
21639 int main() {
21640     char *s = (char *)malloc(NBYTES);
21641     struct timeval t;
21642     int i;
21643     FILE* fp;
21644     int fd;
21645
21646     if (!s)
21647         exit(1);
21648     fclose(stdin);
21649     fp = fopen("try.c", "r");
21650     if (fp == 0)
21651       exit(2);
21652     fd = fileno(fp);
21653     if (fd < 0)
21654       exit(3);
21655     b = ($selecttype)s;
21656     for (i = 0; i < NBITS; i++)
21657         FD_SET(i, b);
21658     t.tv_sec  = 0;
21659     t.tv_usec = 0;
21660     select(fd + 1, b, 0, 0, &t);
21661     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
21662     free(s);
21663     printf("%d\n", i + 1);
21664     return 0;
21665 }
21666 EOCP
21667                 set try
21668                 if eval $compile_ok; then
21669                         selectminbits=`$run ./try 2>/dev/null`
21670                         case "$selectminbits" in
21671                         '')     cat >&4 <<EOM
21672 Cannot figure out on how many bits at a time your select() operates.
21673 I'll play safe and guess it is $safebits bits.
21674 EOM
21675                                 selectminbits=$safebits
21676                                 bits="$safebits bits"
21677                                 ;;
21678                         1)      bits="1 bit" ;;
21679                         *)      bits="$selectminbits bits" ;;
21680                         esac
21681                         echo "Your select() operates on $bits at a time." >&4
21682                 else
21683                         rp='What is the minimum number of bits your select() operates on?'
21684                         case "$byteorder" in
21685                         12345678)       dflt=64 ;;
21686                         1234)           dflt=32 ;;
21687                         *)              dflt=1  ;;
21688                         esac
21689                         . ./myread
21690                         val=$ans
21691                         selectminbits="$val"
21692                 fi
21693                 $rm_try
21694                 ;;
21695         *)      : no select, so pick a harmless default
21696                 selectminbits=$safebits
21697                 ;;
21698         esac
21699         ;;
21700 esac
21701
21702 : Trace out the files included by signal.h, then look for SIGxxx names.
21703 if [ "X$fieldn" = X ]; then
21704         : Just make some guesses.  We check them later.
21705         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
21706 else
21707         xxx=`echo '#include <signal.h>' |
21708         $cppstdin $cppminus $cppflags 2>/dev/null |
21709         $grep '^[       ]*#.*include' |
21710         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
21711                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
21712 fi
21713 xxxfiles=''
21714 for xx in $xxx /dev/null ; do
21715         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
21716 done
21717 case "$xxxfiles" in
21718 '')     xxxfiles=`./findhdr signal.h` ;;
21719 esac
21720 xxx=`awk '
21721 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
21722         print substr($2, 4, 20)
21723 }
21724 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
21725         print substr($3, 4, 20)
21726 }' $xxxfiles`
21727 : Append some common names just in case the awk scan failed.
21728 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
21729 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
21730 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
21731 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
21732 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
21733
21734 : generate a few handy files for later
21735 $cat > signal.c <<EOCP
21736 #include <sys/types.h>
21737 #include <signal.h>
21738 #$i_stdlib I_STDLIB
21739 #ifdef I_STDLIB
21740 #include <stdlib.h>
21741 #endif
21742 #include <stdio.h>
21743 int main() {
21744
21745 /* Strange style to avoid deeply-nested #if/#else/#endif */
21746 #ifndef NSIG
21747 #  ifdef _NSIG
21748 #    define NSIG (_NSIG)
21749 #  endif
21750 #endif
21751
21752 #ifndef NSIG
21753 #  ifdef SIGMAX
21754 #    define NSIG (SIGMAX+1)
21755 #  endif
21756 #endif
21757
21758 #ifndef NSIG
21759 #  ifdef SIG_MAX
21760 #    define NSIG (SIG_MAX+1)
21761 #  endif
21762 #endif
21763
21764 #ifndef NSIG
21765 #  ifdef _SIG_MAX
21766 #    define NSIG (_SIG_MAX+1)
21767 #  endif
21768 #endif
21769
21770 #ifndef NSIG
21771 #  ifdef MAXSIG
21772 #    define NSIG (MAXSIG+1)
21773 #  endif
21774 #endif
21775
21776 #ifndef NSIG
21777 #  ifdef MAX_SIG
21778 #    define NSIG (MAX_SIG+1)
21779 #  endif
21780 #endif
21781
21782 #ifndef NSIG
21783 #  ifdef SIGARRAYSIZE
21784 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
21785 #  endif
21786 #endif
21787
21788 #ifndef NSIG
21789 #  ifdef _sys_nsig
21790 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
21791 #  endif
21792 #endif
21793
21794 /* Default to some arbitrary number that's big enough to get most
21795    of the common signals.
21796 */
21797 #ifndef NSIG
21798 #    define NSIG 50
21799 #endif
21800
21801 printf("NSIG %d\n", NSIG);
21802
21803 #ifndef JUST_NSIG
21804
21805 EOCP
21806
21807 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
21808 {
21809         printf "#ifdef SIG"; printf $1; printf "\n"
21810         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
21811         printf $1; printf ");\n"
21812         printf "#endif\n"
21813 }
21814 END {
21815         printf "#endif /* JUST_NSIG */\n";
21816         printf "exit(0);\n}\n";
21817 }
21818 ' >>signal.c
21819 $cat >signal.awk <<'EOP'
21820 BEGIN { ndups = 0 }
21821 $1 ~ /^NSIG$/ { nsig = $2 }
21822 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
21823     if ($2 > maxsig) { maxsig = $2 }
21824     if (sig_name[$2]) {
21825         dup_name[ndups] = $1
21826         dup_num[ndups] = $2
21827         ndups++
21828     }
21829     else {
21830         sig_name[$2] = $1
21831         sig_num[$2] = $2
21832     }
21833 }
21834 END {
21835     if (nsig == 0) {
21836         nsig = maxsig + 1
21837     }
21838     printf("NSIG %d\n", nsig);
21839     for (n = 1; n < nsig; n++) {
21840         if (sig_name[n]) {
21841             printf("%s %d\n", sig_name[n], sig_num[n])
21842         }
21843         else {
21844             printf("NUM%d %d\n", n, n)
21845         }
21846     }
21847     for (n = 0; n < ndups; n++) {
21848         printf("%s %d\n", dup_name[n], dup_num[n])
21849     }
21850 }
21851 EOP
21852 $cat >signal_cmd <<EOS
21853 $startsh
21854 if $test -s signal.lst; then
21855     echo "Using your existing signal.lst file"
21856         exit 0
21857 fi
21858 xxx="$xxx"
21859 EOS
21860 $cat >>signal_cmd <<'EOS'
21861
21862 set signal
21863 if eval $compile_ok; then
21864         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21865                 $uniq | $awk -f signal.awk >signal.lst
21866 else
21867         echo "(I can't seem be able to compile the whole test program)" >&4
21868         echo "(I'll try it in little pieces.)" >&4
21869         set signal -DJUST_NSIG
21870         if eval $compile_ok; then
21871                 $run ./signal$_exe > signal.nsg
21872                 $cat signal.nsg
21873         else
21874                 echo "I can't seem to figure out how many signals you have." >&4
21875                 echo "Guessing 50." >&4
21876                 echo 'NSIG 50' > signal.nsg
21877         fi
21878         : Now look at all the signal names, one at a time.
21879         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21880                 $cat > signal.c <<EOCP
21881 #include <sys/types.h>
21882 #include <signal.h>
21883 #include <stdio.h>
21884 int main() {
21885 printf("$xx %d\n", SIG${xx});
21886 return 0;
21887 }
21888 EOCP
21889                 set signal
21890                 if eval $compile; then
21891                         echo "SIG${xx} found."
21892                         $run ./signal$_exe  >> signal.ls1
21893                 else
21894                         echo "SIG${xx} NOT found."
21895                 fi
21896         done
21897         if $test -s signal.ls1; then
21898                 $cat signal.nsg signal.ls1 |
21899                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
21900         fi
21901
21902 fi
21903 if $test -s signal.lst; then
21904         :
21905 else
21906         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21907         echo 'kill -l' >signal
21908         set X `csh -f <signal`
21909         $rm -f signal
21910         shift
21911         case $# in
21912         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21913         esac
21914         echo $@ | $tr ' ' $trnl | \
21915             $awk '{ printf "%s %d\n", $1, ++s; }
21916                   END { printf "NSIG %d\n", ++s }' >signal.lst
21917 fi
21918 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21919 EOS
21920 chmod a+x signal_cmd
21921 $eunicefix signal_cmd
21922
21923 : generate list of signal names
21924 echo " "
21925 case "$sig_name_init" in
21926 '') doinit=yes ;;
21927 *)  case "$sig_num_init" in
21928     ''|*,*) doinit=yes ;;
21929     esac ;;
21930 esac
21931 case "$doinit" in
21932 yes)
21933         echo "Generating a list of signal names and numbers..." >&4
21934         . ./signal_cmd
21935         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21936         sig_name=`$awk 'BEGIN { printf "ZERO " }
21937                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21938         sig_num=`$awk  'BEGIN { printf "0 " }
21939                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21940         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
21941                              !/^NSIG/   { printf "\"%s\", ", $1 }
21942                              END        { printf "0\n" }' signal.lst`
21943         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21944                              !/^NSIG/   { printf "%d, ", $2}
21945                              END        { printf "0\n"}' signal.lst`
21946         ;;
21947 esac
21948 echo "The following $sig_count signals are available:"
21949 echo " "
21950 echo $sig_name | $awk \
21951 'BEGIN { linelen = 0 }
21952 {
21953         for (i = 1; i <= NF; i++) {
21954                 name = "SIG" $i " "
21955                 linelen = linelen + length(name)
21956                 if (linelen > 70) {
21957                         printf "\n"
21958                         linelen = length(name)
21959                 }
21960                 printf "%s", name
21961         }
21962         printf "\n"
21963 }'
21964 sig_size=`echo $sig_name | awk '{print NF}'`
21965 $rm -f signal signal.c signal.awk signal.lst signal_cmd
21966
21967 : Check size of size
21968 echo " "
21969 case "$sizetype" in
21970 *_t) zzz="$sizetype"    ;;
21971 *)   zzz="filesize"     ;;
21972 esac
21973 echo "Checking the size of $zzz..." >&4
21974 cat > try.c <<EOCP
21975 #include <sys/types.h>
21976 #include <stdio.h>
21977 #$i_stdlib I_STDLIB
21978 #ifdef I_STDLIB
21979 #include <stdlib.h>
21980 #endif
21981 int main() {
21982     printf("%d\n", (int)sizeof($sizetype));
21983     exit(0);
21984 }
21985 EOCP
21986 set try
21987 if eval $compile_ok; then
21988         yyy=`$run ./try`
21989         case "$yyy" in
21990         '')     sizesize=4
21991                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21992                 ;;
21993         *)      sizesize=$yyy
21994                 echo "Your $zzz size is $sizesize bytes."
21995                 ;;
21996         esac
21997 else
21998         sizesize=4
21999         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22000 fi
22001
22002
22003 : check for socklen_t
22004 echo " "
22005 echo "Checking to see if you have socklen_t..." >&4
22006 $cat >try.c <<EOCP
22007 #include <sys/types.h>
22008 #$d_socket HAS_SOCKET
22009 #ifdef HAS_SOCKET
22010 #include <sys/socket.h>
22011 #endif
22012 int main() { socklen_t x = 16; }
22013 EOCP
22014 set try
22015 if eval $compile; then
22016         val="$define"
22017         echo "You have socklen_t."
22018 else
22019         val="$undef"
22020         echo "You do not have socklen_t."
22021         case "$sizetype" in
22022         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22023         esac
22024 fi
22025 $rm_try
22026 set d_socklen_t
22027 eval $setvar
22028
22029 : see if this is a socks.h system
22030 set socks.h i_socks
22031 eval $inhdr
22032
22033 : check for type of the size argument to socket calls
22034 case "$d_socket" in
22035 "$define")
22036         $cat <<EOM
22037
22038 Checking to see what type is the last argument of accept().
22039 EOM
22040         yyy=''
22041         case "$d_socklen_t" in
22042         "$define") yyy="$yyy socklen_t"
22043         esac
22044         yyy="$yyy $sizetype int long unsigned"
22045         for xxx in $yyy; do
22046                 case "$socksizetype" in
22047                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22048                         case "$usesocks" in
22049                         "$define")
22050                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22051                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22052                                         socksizetype="$xxx"
22053                                 fi
22054                                 ;;
22055                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22056                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22057                                         socksizetype="$xxx"
22058                                 fi
22059                                 ;;
22060                         esac
22061                         ;;
22062                 esac
22063         done
22064 : In case none of those worked, prompt the user.
22065         case "$socksizetype" in
22066         '')     rp='What is the type for socket address structure sizes?'
22067                 dflt='int'
22068                 . ./myread
22069                 socksizetype=$ans
22070                 ;;
22071         esac
22072         ;;
22073 *)      : no sockets, so pick relatively harmless default
22074         socksizetype='int'
22075         ;;
22076 esac
22077
22078 : see what type is used for signed size_t
22079 set ssize_t ssizetype int stdio.h sys/types.h
22080 eval $typedef
22081 dflt="$ssizetype"
22082 $cat > try.c <<EOM
22083 #include <stdio.h>
22084 #$i_stdlib I_STDLIB
22085 #ifdef I_STDLIB
22086 #include <stdlib.h>
22087 #endif
22088 #include <sys/types.h>
22089 #define Size_t $sizetype
22090 #define SSize_t $dflt
22091 int main()
22092 {
22093         if (sizeof(Size_t) == sizeof(SSize_t))
22094                 printf("$dflt\n");
22095         else if (sizeof(Size_t) == sizeof(int))
22096                 printf("int\n");
22097         else
22098                 printf("long\n");
22099         exit(0);
22100 }
22101 EOM
22102 echo " "
22103 set try
22104 if eval $compile_ok && $run ./try > /dev/null; then
22105         ssizetype=`$run ./try`
22106         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22107 else
22108         $cat >&4 <<EOM
22109 Help! I can't compile and run the ssize_t test program: please enlighten me!
22110 (This is probably a misconfiguration in your system or libraries, and
22111 you really ought to fix it.  Still, I'll try anyway.)
22112
22113 I need a type that is the same size as $sizetype, but is guaranteed to
22114 be signed.  Common values are ssize_t, int and long.
22115
22116 EOM
22117         rp="What signed type is the same size as $sizetype?"
22118         . ./myread
22119         ssizetype="$ans"
22120 fi
22121 $rm_try
22122
22123 : Check the size of st_ino
22124 $echo " "
22125 $echo "Checking the size of st_ino..." >&4
22126 $cat > try.c <<EOCP
22127 #include <sys/stat.h>
22128 #include <stdio.h>
22129 #$i_stdlib I_STDLIB
22130 #ifdef I_STDLIB
22131 #include <stdlib.h>
22132 #endif
22133 int main() {
22134     struct stat st;
22135     printf("%d\n", (int)sizeof(st.st_ino));
22136     exit(0);
22137 }
22138 EOCP
22139 set try
22140 if eval $compile_ok; then
22141         val=`$run ./try`
22142         case "$val" in
22143         '')     st_ino_size=4
22144                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22145                 ;;
22146         *)      st_ino_size=$val
22147                 $echo "Your st_ino is $st_ino_size bytes long."
22148                 ;;
22149         esac
22150 else
22151         st_ino_size=4
22152         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22153 fi
22154 $rm_try
22155
22156 : Check if st_ino is signed
22157 $echo " "
22158 $echo "Checking the sign of st_ino..." >&4
22159 $cat > try.c <<EOCP
22160 #include <sys/stat.h>
22161 #include <stdio.h>
22162 int main() {
22163         struct stat foo;
22164         foo.st_ino = -1;
22165         if (foo.st_ino < 0)
22166                 printf("-1\n");
22167         else
22168                 printf("1\n");
22169 }
22170 EOCP
22171 set try
22172 if eval $compile; then
22173         val=`$run ./try`
22174         case "$val" in
22175         '')     st_ino_sign=1
22176                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22177                 ;;
22178         *)      st_ino_sign=$val
22179                 case "$st_ino_sign" in
22180                  1) $echo "Your st_ino is unsigned." ;;
22181                 -1) $echo "Your st_ino is signed."   ;;
22182                 esac
22183                 ;;
22184         esac
22185 else
22186         st_ino_sign=1
22187         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22188 fi
22189 $rm_try
22190
22191 : see what type of char stdio uses.
22192 echo " "
22193 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22194 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22195         echo "Your stdio uses unsigned chars." >&4
22196         stdchar="unsigned char"
22197 else
22198         echo "Your stdio uses signed chars." >&4
22199         stdchar="char"
22200 fi
22201 $rm -f stdioh
22202
22203 : see what type uids are declared as in the kernel
22204 echo " "
22205 echo "Looking for the type for user ids returned by getuid()."
22206 set uid_t uidtype xxx stdio.h sys/types.h
22207 eval $typedef
22208 case "$uidtype" in
22209 xxx)
22210         xxx=`./findhdr sys/user.h`
22211         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
22212         case $1 in
22213         unsigned) dflt="$1 $2" ;;
22214         *) dflt="$1" ;;
22215         esac
22216         ;;
22217 *) dflt="$uidtype";;
22218 esac
22219 case "$uidtype" in
22220 uid_t)  echo "uid_t found." ;;
22221 *)      rp="What is the type for user ids returned by getuid()?"
22222         . ./myread
22223         uidtype="$ans"
22224         ;;
22225 esac
22226
22227 : Check size of UID
22228 echo " "
22229 case "$uidtype" in
22230 *_t) zzz="$uidtype"     ;;
22231 *)   zzz="uid"          ;;
22232 esac
22233 echo "Checking the size of $zzz..." >&4
22234 cat > try.c <<EOCP
22235 #include <sys/types.h>
22236 #include <stdio.h>
22237 #$i_stdlib I_STDLIB
22238 #ifdef I_STDLIB
22239 #include <stdlib.h>
22240 #endif
22241 int main() {
22242     printf("%d\n", (int)sizeof($uidtype));
22243     exit(0);
22244 }
22245 EOCP
22246 set try
22247 if eval $compile_ok; then
22248         yyy=`$run ./try`
22249         case "$yyy" in
22250         '')     uidsize=4
22251                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22252                 ;;
22253         *)      uidsize=$yyy
22254                 echo "Your $zzz is $uidsize bytes long."
22255                 ;;
22256         esac
22257 else
22258         uidsize=4
22259         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22260 fi
22261
22262 : Check if UID is signed
22263 echo " "
22264 case "$uidtype" in
22265 *_t) zzz="$uidtype"     ;;
22266 *)   zzz="uid"          ;;
22267 esac
22268 echo "Checking the sign of $zzz..." >&4
22269 cat > try.c <<EOCP
22270 #include <sys/types.h>
22271 #include <stdio.h>
22272 int main() {
22273         $uidtype foo = -1;
22274         if (foo < 0)
22275                 printf("-1\n");
22276         else
22277                 printf("1\n");
22278 }
22279 EOCP
22280 set try
22281 if eval $compile; then
22282         yyy=`$run ./try`
22283         case "$yyy" in
22284         '')     uidsign=1
22285                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22286                 ;;
22287         *)      uidsign=$yyy
22288                 case "$uidsign" in
22289                  1) echo "Your $zzz is unsigned." ;;
22290                 -1) echo "Your $zzz is signed."   ;;
22291                 esac
22292                 ;;
22293         esac
22294 else
22295         uidsign=1
22296         echo "(I can't compile the test program--guessing unsigned.)" >&4
22297 fi
22298
22299
22300 : Check format string for UID
22301 echo " "
22302 $echo "Checking the format string to be used for uids..." >&4
22303
22304 case "$uidsign" in
22305 -1)     if $test X"$uidsize" = X"$ivsize"; then
22306                 uidformat="$ivdformat"
22307         else
22308                 if $test X"$uidsize" = X"$longsize"; then
22309                         uidformat='"ld"'
22310                 else
22311                         if $test X"$uidsize" = X"$intsize"; then
22312                                 uidformat='"d"'
22313                         else
22314                                 if $test X"$uidsize" = X"$shortsize"; then
22315                                         uidformat='"hd"'
22316                                 fi
22317                         fi
22318                 fi
22319         fi
22320         ;;
22321 *)      if $test X"$uidsize" = X"$uvsize"; then
22322                 uidformat="$uvuformat"
22323         else
22324                 if $test X"$uidsize" = X"$longsize"; then
22325                         uidformat='"lu"'
22326                 else
22327                         if $test X"$uidsize" = X"$intsize"; then
22328                                 uidformat='"u"'
22329                         else
22330                                 if $test X"$uidsize" = X"$shortsize"; then
22331                                         uidformat='"hu"'
22332                                 fi
22333                         fi
22334                 fi
22335         fi
22336         ;;
22337 esac
22338
22339 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22340 echo " "
22341 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22342 $cat >try.c <<'EOM'
22343 /* Intentionally a long probe as I'd like to sanity check that the exact
22344    approach is going to work, as thinking it will work, but only having it
22345    part working at runtime is worse than not having it.  */
22346
22347 #include <sys/types.h>
22348 #include <sys/sysctl.h>
22349 #include <sys/param.h>
22350 #include <stdio.h>
22351 #include <string.h>
22352 #include <stdlib.h>
22353 #include <unistd.h>
22354
22355 int
22356 main(int argc, char **argv) {
22357     char *buffer;
22358     char *argv_leaf = strrchr(argv[0], '/');
22359     char *buffer_leaf;
22360     size_t size = 0;
22361     int mib[4];
22362
22363     mib[0] = CTL_KERN;
22364     mib[1] = KERN_PROC;
22365     mib[2] = KERN_PROC_PATHNAME;
22366     mib[3] = -1;
22367
22368     if (!argv_leaf) {
22369         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22370         return 1;
22371     }
22372
22373     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22374         perror("sysctl");
22375         return 2;
22376     }
22377
22378     if (size < strlen(argv_leaf) + 1) {
22379         fprintf(stderr, "size %lu is too short for a path\n",
22380                 (unsigned long) size);
22381         return 3;
22382     }
22383
22384     if (size > MAXPATHLEN * MAXPATHLEN) {
22385         fprintf(stderr, "size %lu is too long for a path\n",
22386                 (unsigned long) size);
22387         return 4;
22388     }
22389
22390     buffer = malloc(size);
22391     if (!buffer) {
22392         perror("malloc");
22393         return 5;
22394     }
22395
22396     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22397         perror("sysctl");
22398         return 6;
22399     }
22400
22401     if (strlen(buffer) + 1 != size) {
22402         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22403                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22404         return 7;
22405     }
22406
22407
22408     if (*buffer != '/') {
22409         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22410         return 8;
22411     }
22412
22413     if (strstr(buffer, "/./")) {
22414         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22415         return 9;
22416     }
22417
22418     if (strstr(buffer, "/../")) {
22419         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22420         return 10;
22421     }
22422
22423     buffer_leaf = strrchr(buffer, '/');
22424     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22425         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22426         return 11;
22427     }
22428
22429     free(buffer);
22430
22431     return 0;
22432 }
22433 EOM
22434
22435 val=$undef
22436 set try
22437 if eval $compile; then
22438         if $run ./try; then
22439                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22440                 val="$define"
22441         else
22442                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22443                 val="$undef"
22444         fi
22445 else
22446         echo "I'm unable to compile the test program." >&4
22447         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22448         val="$undef"
22449 fi
22450 $rm_try
22451 set usekernprocpathname
22452 eval $setvar
22453
22454 : Determine if we can use _NSGetExecutablePath to find executing program
22455 echo " "
22456 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22457 $cat >try.c <<'EOM'
22458 /* Intentionally a long probe as I'd like to sanity check that the exact
22459    approach is going to work, as thinking it will work, but only having it
22460    part working at runtime is worse than not having it.  */
22461 #include <mach-o/dyld.h>
22462 #include <stdio.h>
22463 #include <stdlib.h>
22464 #include <sys/param.h>
22465 #include <string.h>
22466
22467 int
22468 main(int argc, char **argv) {
22469     char buf[1];
22470     uint32_t size = sizeof(buf);
22471     int result;
22472     char *buffer;
22473     char *tidied;
22474     char *argv_leaf = strrchr(argv[0], '/');
22475     char *tidied_leaf;
22476
22477     if (!argv_leaf) {
22478         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22479         return 1;
22480     }
22481
22482     _NSGetExecutablePath(buf, &size);
22483     if (size > MAXPATHLEN * MAXPATHLEN) {
22484         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22485                 (unsigned int) size);
22486         return 2;
22487     }
22488
22489     buffer = malloc(size);
22490     if (!buffer) {
22491         perror("malloc");
22492         return 3;
22493     }
22494
22495     result = _NSGetExecutablePath(buffer, &size);
22496     if (result != 0) {
22497         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22498                 result, (unsigned int) size);
22499         return 4;
22500     }
22501
22502     tidied = realpath(buffer, NULL);
22503     if (!tidied) {
22504         perror("realpath");
22505         return 5;
22506     }
22507
22508     free(buffer);
22509
22510     if (*tidied != '/') {
22511         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22512         return 6;
22513     }
22514
22515     if (strstr(tidied, "/./")) {
22516         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22517         return 7;
22518     }
22519
22520     if (strstr(tidied, "/../")) {
22521         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22522         return 8;
22523     }
22524
22525     tidied_leaf = strrchr(tidied, '/');
22526     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22527         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22528         return 9;
22529     }
22530
22531     free(tidied);
22532
22533     return 0;
22534 }
22535 EOM
22536
22537 val=$undef
22538 set try
22539 if eval $compile; then
22540         if $run ./try; then
22541                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22542                 val="$define"
22543         else
22544                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22545         fi
22546 else
22547         echo "I'm unable to compile the test program." >&4
22548         echo "I'll assume no _NSGetExecutablePath here." >&4
22549 fi
22550 $rm_try
22551 set usensgetexecutablepath
22552 eval $setvar
22553
22554 : Check if site customization support was requested
22555 case "$usesitecustomize" in
22556     $define|true|[Yy]*)
22557         usesitecustomize="$define"
22558         ;;
22559     *)
22560         usesitecustomize="$undef"
22561         ;;
22562     esac
22563
22564 : see if prototypes support variable argument declarations
22565 echo " "
22566 case "$prototype$i_stdarg" in
22567 $define$define)
22568         echo "It appears we'll be able to prototype varargs functions." >&4
22569         val="$define"
22570         ;;
22571 *)
22572         echo "Too bad... We won't be using prototyped varargs functions..." >&4
22573         val="$undef"
22574         ;;
22575 esac
22576 set vaproto
22577 eval $setvar
22578
22579 : determine compiler compiler
22580 case "$yacc" in
22581 '')
22582         dflt=yacc;;
22583 *)
22584         dflt="$yacc";;
22585 esac
22586 echo " "
22587 comp='yacc'
22588 if $test -f "$byacc$_exe"; then
22589         dflt="$byacc"
22590         comp="byacc or $comp"
22591 fi
22592 if $test -f "$bison$_exe"; then
22593         comp="$comp or bison -y"
22594 fi
22595 rp="Which compiler compiler ($comp) shall I use?"
22596 . ./myread
22597 yacc="$ans"
22598 case "$yacc" in
22599 *bis*)
22600         case "$yacc" in
22601         *-y*) ;;
22602         *)
22603                 yacc="$yacc -y"
22604                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22605                 ;;
22606         esac
22607         ;;
22608 esac
22609
22610 : see if this is a assert.h system
22611 set assert.h i_assert
22612 eval $inhdr
22613
22614 : see if this is a bfd.h system
22615 set bfd.h i_bfd
22616 eval $inhdr
22617
22618 : see if this is an execinfo.h system
22619 set execinfo.h i_execinfo
22620 eval $inhdr
22621
22622 : see if this is a fenv.h system
22623 set fenv.h i_fenv
22624 eval $inhdr
22625
22626 : see if this is a fp.h system
22627 set fp.h i_fp
22628 eval $inhdr
22629
22630 : see if this is a fp_class.h system
22631 set fp_class.h i_fp_class
22632 eval $inhdr
22633
22634 : see if gdbm.h is available
22635 set gdbm.h t_gdbm
22636 eval $inhdr
22637 case "$t_gdbm" in
22638 $define)
22639         : see if gdbm_open exists
22640         set gdbm_open d_gdbm_open
22641         eval $inlibc
22642         case "$d_gdbm_open" in
22643         $undef)
22644                 t_gdbm="$undef"
22645                 echo "We won't be including <gdbm.h>"
22646                 ;;
22647         esac
22648         ;;
22649 esac
22650 val="$t_gdbm"
22651 set i_gdbm
22652 eval $setvar
22653
22654 : see if this is a ieeefp.h system
22655 case "$i_ieeefp" in
22656 '' ) set ieeefp.h i_ieeefp
22657      eval $inhdr
22658      ;;
22659 esac
22660
22661 : see if this is a libutil.h system
22662 set libutil.h i_libutil
22663 eval $inhdr
22664
22665 : see if mach cthreads are available
22666 if test "X$usethreads" = "X$define"; then
22667         set mach/cthreads.h i_machcthr
22668         eval $inhdr
22669 else
22670         i_machcthr="$undef"
22671 fi
22672
22673 : see if this is a mntent.h system
22674 set mntent.h i_mntent
22675 eval $inhdr
22676
22677 : see if net/errno.h is available
22678 val=''
22679 set net/errno.h val
22680 eval $inhdr
22681
22682 : Unfortunately, it causes problems on some systems.  Arrgh.
22683 case "$val" in
22684 $define)
22685         cat > try.c <<'EOM'
22686 #include <stdio.h>
22687 #include <errno.h>
22688 #include <net/errno.h>
22689 int func()
22690 {
22691         return ENOTSOCK;
22692 }
22693 EOM
22694         if $cc $ccflags -c try.c >/dev/null 2>&1; then
22695                 echo "We'll be including <net/errno.h>." >&4
22696         else
22697                 echo "We won't be including <net/errno.h>." >&4
22698                 val="$undef"
22699         fi
22700         $rm_try
22701         ;;
22702 esac
22703 set i_neterrno
22704 eval $setvar
22705
22706 : see if netinet/tcp.h is available
22707 set netinet/tcp.h i_netinettcp
22708 eval $inhdr
22709
22710 : see if this is a poll.h system
22711 set poll.h i_poll
22712 eval $inhdr
22713
22714 : see if this is a prot.h system
22715 set prot.h i_prot
22716 eval $inhdr
22717
22718 : Preprocessor symbols
22719 echo " "
22720 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
22721 $cat <<'EOSH' > Cppsym.know
22722 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
22723 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
22724 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
22725 arch_pwr ardent ARM ARM32 atarist att386 att3b
22726 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
22727 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
22728 byteorder byte_order
22729 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
22730 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
22731 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
22732 ELF encore EPI EXTENSIONS
22733 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
22734 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
22735 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
22736 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
22737 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400 hp9000s500
22738 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
22739 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
22740 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
22741 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
22742 ksr1
22743 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
22744 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
22745 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
22746 luna88k Lynx
22747 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
22748 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
22749 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
22750 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
22751 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
22752 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
22753 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
22754 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
22755 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
22756 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
22757 ns32000 ns32016 ns32332 ns32k nsc32000
22758 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
22759 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
22760 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
22761 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
22762 QK_USER QNX
22763 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
22764 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
22765 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
22766 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
22767 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
22768 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
22769 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
22770 SYSV4 SYSV5 sysV68 sysV88
22771 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
22772 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
22773 tower32_800 tower32_850 tss
22774 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
22775 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
22776 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
22777 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
22778 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
22779 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
22780 uxpm uxps
22781 vax venix VMESA vms
22782 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
22783 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
22784 z8000 zarch
22785 EOSH
22786 # Maybe put other stuff here too.
22787 ./tr '-' '_' <<EOSH >>Cppsym.know
22788 $osname
22789 EOSH
22790 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
22791 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
22792 $cat Cppsym.know > Cppsym.c
22793 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
22794 $rm -f Cppsym.a Cppsym.b Cppsym.c
22795 cat <<EOSH > Cppsym
22796 $startsh
22797 if $test \$# -gt 0; then
22798     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
22799     if $test -s Cppsym.got; then
22800         $rm -f Cppsym.got
22801         exit 0
22802     fi
22803     $rm -f Cppsym.got
22804     exit 1
22805 else
22806     $tr " " "$trnl" | ./Cppsym.try
22807     exit 0
22808 fi
22809 EOSH
22810 chmod +x Cppsym
22811 $eunicefix Cppsym
22812 cat <<EOSH > Cppsym.try
22813 $startsh
22814 cat <<'EOCP' > try.c
22815 #include <stdio.h>
22816 #if cpp_stuff == 1
22817 #define STRINGIFY(a)    "a"
22818 #endif
22819 #if cpp_stuff == 42
22820 #define StGiFy(a)  #a
22821 #define STRINGIFY(a)    StGiFy(a)
22822 #endif
22823 #if $cpp_stuff != 1 && $cpp_stuff != 42
22824 #   include "Bletch: How does this C preprocessor stringify macros?"
22825 #endif
22826 int main() {
22827 EOCP
22828 $awk \\
22829 EOSH
22830 cat <<'EOSH' >> Cppsym.try
22831 'length($1) > 0 {
22832     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
22833     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
22834     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
22835     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
22836 }'       >> try.c
22837 echo 'return 0;}' >> try.c
22838 EOSH
22839 cat <<EOSH >> Cppsym.try
22840 ccflags="$ccflags"
22841 case "$osname-$gccversion" in
22842 irix-) ccflags="\$ccflags -woff 1178" ;;
22843 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
22844 esac
22845 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
22846 EOSH
22847 chmod +x Cppsym.try
22848 $eunicefix Cppsym.try
22849 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
22850 : Add in any Linux cpp "predefined macros":
22851 case "$osname::$gccversion" in
22852   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
22853     tHdrH=_tmpHdr
22854     rm -f $tHdrH'.h' $tHdrH
22855     touch $tHdrH'.h'
22856     # Filter out macro arguments, such as Linux's __INT8_C(c)
22857     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
22858        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
22859        if [ -s $tHdrH'_cppsym.real' ]; then
22860           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22861        fi
22862     fi
22863     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22864   ;;
22865 esac
22866 : now check the C compiler for additional symbols
22867 postprocess_cc_v=''
22868 case "$osname" in
22869 aix) postprocess_cc_v="|$tr , ' '" ;;
22870 esac
22871 $cat >ccsym <<EOS
22872 $startsh
22873 $cat >tmp.c <<EOF
22874 extern int foo;
22875 EOF
22876 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22877 do
22878         case "\$i" in
22879         -D*) echo "\$i" | $sed 's/^-D//';;
22880         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22881         esac
22882 done
22883 $rm_try
22884 EOS
22885 postprocess_cc_v=''
22886 chmod +x ccsym
22887 $eunicefix ccsym
22888 ./ccsym > ccsym1.raw
22889 if $test -s ccsym1.raw; then
22890     $sort ccsym1.raw | $uniq >ccsym.raw
22891 else
22892     mv ccsym1.raw ccsym.raw
22893 fi
22894
22895 $awk '/\=/ { print $0; next }
22896         { print $0"=1" }' ccsym.raw >ccsym.list
22897 $comm -13 Cppsym.true ccsym.list >ccsym.own
22898 $comm -12 Cppsym.true ccsym.list >ccsym.com
22899 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
22900 also=''
22901 if $test -z ccsym.raw; then
22902         echo "Your C compiler doesn't seem to define any symbols!" >&4
22903         echo " "
22904         echo "However, your C preprocessor defines the following symbols:"
22905         $cat Cppsym.true
22906         ccsymbols=''
22907         cppsymbols=`$cat Cppsym.true`
22908         cppsymbols=`echo $cppsymbols`
22909         cppccsymbols="$cppsymbols"
22910 else
22911         if $test -s ccsym.com; then
22912                 echo "Your C compiler and pre-processor define these symbols:"
22913                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22914                 also='also '
22915                 symbols='ones'
22916                 cppccsymbols=`$cat ccsym.com`
22917                 cppccsymbols=`echo $cppccsymbols`
22918                 $test "$silent" || sleep 1
22919         fi
22920         if $test -s ccsym.cpp; then
22921                 $test "$also" && echo " "
22922                 echo "Your C pre-processor ${also}defines the following symbols:"
22923                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22924                 also='further '
22925                 cppsymbols=`$cat ccsym.cpp`
22926                 cppsymbols=`echo $cppsymbols`
22927                 $test "$silent" || sleep 1
22928         fi
22929         if $test -s ccsym.own; then
22930                 $test "$also" && echo " "
22931                 echo "Your C compiler ${also}defines the following cpp symbols:"
22932                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22933                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22934                 ccsymbols=`$cat ccsym.own`
22935                 ccsymbols=`echo $ccsymbols`
22936                 $test "$silent" || sleep 1
22937         fi
22938 fi
22939
22940 : add -D_FORTIFY_SOURCE if feasible and not already there
22941 case "$gccversion" in
22942 4.*)    case "$optimize$ccflags" in
22943         *-O*)   case "$ccflags$cppsymbols" in
22944                 *_FORTIFY_SOURCE=*) # Don't add it again.
22945                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
22946                         ;;
22947                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
22948                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
22949                         ;;
22950                 esac
22951                 ;;
22952         *)      echo "You have gcc 4.* but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
22953                 ;;
22954         esac
22955         ;;
22956 *)      echo "You seem not to have gcc 4.*, not adding -D_FORTIFY_SOURCE." >&4
22957         ;;
22958 esac
22959
22960 : see if this is a termio system
22961 val="$undef"
22962 val2="$undef"
22963 val3="$undef"
22964 if $test `./findhdr termios.h`; then
22965     set tcsetattr i_termios
22966     eval $inlibc
22967     val3="$i_termios"
22968 fi
22969 echo " "
22970 case "$val3" in
22971     "$define") echo "You have POSIX termios.h... good!" >&4;;
22972     *)  if ./Cppsym pyr; then
22973             case "`$run /bin/universe`" in
22974                 ucb) if $test `./findhdr sgtty.h`; then
22975                         val2="$define"
22976                         echo "<sgtty.h> found." >&4
22977                     else
22978                         echo "System is pyramid with BSD universe."
22979                         ./warn "<sgtty.h> not found--you could have problems."
22980                     fi;;
22981                 *)  if $test `./findhdr termio.h`; then
22982                         val="$define"
22983                         echo "<termio.h> found." >&4
22984                     else
22985                         echo "System is pyramid with USG universe."
22986                         ./warn "<termio.h> not found--you could have problems."
22987                     fi;;
22988             esac
22989         elif ./usg; then
22990             if $test `./findhdr termio.h`; then
22991                 echo "<termio.h> found." >&4
22992                 val="$define"
22993             elif $test `./findhdr sgtty.h`; then
22994                 echo "<sgtty.h> found." >&4
22995                 val2="$define"
22996             else
22997                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
22998             fi
22999         else
23000             if $test `./findhdr sgtty.h`; then
23001                 echo "<sgtty.h> found." >&4
23002                 val2="$define"
23003             elif $test `./findhdr termio.h`; then
23004                 echo "<termio.h> found." >&4
23005                 val="$define"
23006             else
23007                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23008             fi
23009         fi;;
23010 esac
23011 set i_termio; eval $setvar
23012 val=$val2; set i_sgtty; eval $setvar
23013 val=$val3; set i_termios; eval $setvar
23014
23015 : see if stdbool is available
23016 : we want a real compile instead of Inhdr because some Solaris systems
23017 : have stdbool.h, but it can only be used if the compiler indicates it
23018 : is sufficiently c99-compliant.
23019 echo " "
23020 $cat >try.c <<EOCP
23021 #include <stdio.h>
23022 #include <stdbool.h>
23023 int func(bool x)
23024 {
23025     return x ? 1 : 0;
23026 }
23027 int main(int argc, char **argv)
23028 {
23029     return func(0);
23030 }
23031 EOCP
23032 set try
23033 if eval $compile; then
23034         echo "<stdbool.h> found." >&4
23035         val="$define"
23036 else
23037         echo "<stdbool.h> NOT found." >&4
23038         val="$undef"
23039 fi
23040 $rm_try
23041 set i_stdbool
23042 eval $setvar
23043
23044 : see if stddef is available
23045 set stddef.h i_stddef
23046 eval $inhdr
23047
23048 : see if stdint is available
23049 set stdint.h i_stdint
23050 eval $inhdr
23051
23052 : see if sys/access.h is available
23053 set sys/access.h i_sysaccess
23054 eval $inhdr
23055
23056 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23057 set sys/filio.h i_sysfilio
23058 eval $inhdr
23059 echo " "
23060 if $test `./findhdr sys/ioctl.h`; then
23061         val="$define"
23062         echo '<sys/ioctl.h> found.' >&4
23063 else
23064         val="$undef"
23065         if $test $i_sysfilio = "$define"; then
23066             echo '<sys/ioctl.h> NOT found.' >&4
23067         else
23068                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23069                 $test $i_termio = "$define" && xxx="termio.h"
23070                 $test $i_termios = "$define" && xxx="termios.h"
23071 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23072         fi
23073 fi
23074 set i_sysioctl
23075 eval $setvar
23076
23077 : see if socket ioctl defs are in sys/sockio.h
23078 echo " "
23079 xxx=`./findhdr sys/sockio.h`
23080 if $test "$xxx"; then
23081         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23082                 val="$define"
23083                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23084         else
23085                 val="$undef"
23086                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23087         fi
23088 else
23089         val="$undef"
23090         $cat <<EOM
23091 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23092 EOM
23093 fi
23094 set i_syssockio
23095 eval $setvar
23096
23097 : see if this is a syslog.h system
23098 set syslog.h i_syslog
23099 eval $inhdr
23100
23101 : see if this is a sys/mode.h system
23102 set sys/mode.h i_sysmode
23103 eval $inhdr
23104
23105 : see if there is a sys/poll.h file
23106 set sys/poll.h i_syspoll
23107 eval $inhdr
23108
23109 : see if sys/resource.h has to be included
23110 set sys/resource.h i_sysresrc
23111 eval $inhdr
23112
23113 : see if sys/security.h is available
23114 set sys/security.h i_syssecrt
23115 eval $inhdr
23116
23117 : see if this is a sys/statvfs.h system
23118 set sys/statvfs.h i_sysstatvfs
23119 eval $inhdr
23120
23121 : see if this is a sys/un.h system
23122 set sys/un.h i_sysun
23123 eval $inhdr
23124
23125 : see if this is a sys/utsname.h system
23126 set sys/utsname.h i_sysutsname
23127 eval $inhdr
23128
23129 : see if this is a syswait system
23130 set sys/wait.h i_syswait
23131 eval $inhdr
23132
23133 : see if this is a ustat.h system
23134 set ustat.h i_ustat
23135 eval $inhdr
23136
23137 : see if this is an utime system
23138 set utime.h i_utime
23139 eval $inhdr
23140
23141 : see if this is a vfork system
23142 case "$d_vfork" in
23143 "$define")
23144         set vfork.h i_vfork
23145         eval $inhdr
23146         ;;
23147 *)
23148         i_vfork="$undef"
23149         ;;
23150 esac
23151
23152 : Check extensions
23153 echo " "
23154 echo "Looking for extensions..." >&4
23155 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23156 : contain old or inaccurate or duplicate values.
23157 nonxs_extensions=''
23158 xs_extensions=''
23159 : We do not use find because it might not be available.
23160 : We do not just use MANIFEST because the user may have dropped
23161 : some additional extensions into the source tree and expect them
23162 : to be built.
23163
23164 : Function to recursively find available extensions, ignoring DynaLoader
23165 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23166 : In 5.10.1 and later, extensions are stored in directories
23167 : like File-Glob instead of the older File/Glob/.
23168 find_extensions='
23169     for xxx in *; do
23170         case "$xxx" in
23171             DynaLoader|dynaload) ;;
23172             *)
23173             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
23174             case "$this_ext" in
23175                 Scalar/List/Utils) this_ext="List/Util" ;;
23176                 PathTools)         this_ext="Cwd"       ;;
23177             esac;
23178             echo " $xs_extensions $nonxs_extensions" > $tdir/$$.tmp;
23179             if $contains " $this_ext " $tdir/$$.tmp; then
23180                 echo >&4;
23181                 echo "Duplicate directories detected for extension $xxx" >&4;
23182                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23183                 case "$knowitall" in
23184                 "") dflt=y;;
23185                 *) dflt=n;;
23186                 esac;
23187                 . ../UU/myread;
23188                 case "$ans" in
23189                 n*|N*) ;;
23190                 *) echo >&4;
23191                     echo "Ok.  Stopping Configure." >&4;
23192                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23193                     exit 1;;
23194                 esac;
23195                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23196             fi;
23197             $ls -1 $xxx > $tdir/$$.tmp;
23198             if   $contains "\.xs$" $tdir/$$.tmp > /dev/null 2>&1; then
23199                 xs_extensions="$xs_extensions $this_ext";
23200             elif $contains "\.c$"  $tdir/$$.tmp > /dev/null 2>&1; then
23201                 xs_extensions="$xs_extensions $this_ext";
23202             elif $test -d $xxx; then
23203                 nonxs_extensions="$nonxs_extensions $this_ext";
23204             fi;
23205             $rm -f $tdir/$$.tmp;
23206             ;;
23207         esac;
23208     done'
23209 tdir=`pwd`
23210 cd "$rsrc/cpan"
23211 set X
23212 shift
23213 eval $find_extensions
23214 cd "$rsrc/dist"
23215 set X
23216 shift
23217 eval $find_extensions
23218 cd "$rsrc/ext"
23219 set X
23220 shift
23221 eval $find_extensions
23222 set X $xs_extensions
23223 shift
23224 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23225 set X $nonxs_extensions
23226 shift
23227 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23228 cd "$tdir"
23229 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23230
23231 : Now see which are supported on this system.
23232 avail_ext=''
23233 for xxx in $xs_extensions ; do
23234         case "$xxx" in
23235         DB_File|db_file)
23236                 case "$i_db" in
23237                 $define) avail_ext="$avail_ext $xxx" ;;
23238                 esac
23239                 ;;
23240         GDBM_File|gdbm_fil)
23241                 case "$i_gdbm" in
23242                 $define) avail_ext="$avail_ext $xxx" ;;
23243                 esac
23244                 ;;
23245         I18N/Langinfo|i18n_lan)
23246                 case "$i_langinfo$d_nl_langinfo" in
23247                 $define$define) avail_ext="$avail_ext $xxx" ;;
23248                 esac
23249                 ;;
23250         IPC/SysV|ipc/sysv)
23251                 : XXX Do we need a useipcsysv variable here
23252                 case "${d_msg}${d_sem}${d_shm}" in
23253                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23254                 esac
23255                 ;;
23256         NDBM_File|ndbm_fil)
23257                 case "$d_ndbm" in
23258                 $define)
23259                     case "$osname-$use64bitint" in
23260                     hpux-define)
23261                         case "$libs" in
23262                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23263                         esac
23264                         ;;
23265                     *) avail_ext="$avail_ext $xxx" ;;
23266                     esac
23267                     ;;
23268                 esac
23269                 ;;
23270         ODBM_File|odbm_fil)
23271                 case "${i_dbm}${i_rpcsvcdbm}" in
23272                 *"${define}"*)
23273                     case "$d_cplusplus" in
23274                     define) ;; # delete as a function name will not work
23275                     *)  case "$osname-$use64bitint" in
23276                         hpux-define)
23277                             case "$libs" in
23278                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23279                             esac
23280                             ;;
23281                         *) avail_ext="$avail_ext $xxx" ;;
23282                         esac
23283                         ;;
23284                     esac
23285                     ;;
23286                 esac
23287                 ;;
23288         Opcode|opcode)
23289                 case "$useopcode" in
23290                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23291                 esac
23292                 ;;
23293         POSIX|posix)
23294                 case "$useposix" in
23295                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23296                 esac
23297                 ;;
23298         Socket|socket)
23299                 case "$d_socket" in
23300                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23301                 esac
23302                 ;;
23303         Sys/Syslog|sys/syslog)
23304                 : XXX syslog requires socket
23305                 case "$d_socket" in
23306                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23307                 esac
23308                 ;;
23309         Thread|thread)
23310                 case "$usethreads" in
23311                 true|$define|y)
23312                         case "$use5005threads" in
23313                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23314                         esac
23315                 esac
23316                 ;;
23317         threads|threads/shared)
23318                 # threads and threads::shared are special cases.
23319                 # To stop people from asking "Perl 5.8.0 was supposed
23320                 # to have this new fancy threads implementation but my
23321                 # perl doesn't have it" and from people trying to
23322                 # (re)install the threads module using CPAN.pm and
23323                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23324                 # the threads.pm and threads/shared.pm will always be
23325                 # there, croaking informatively ("you need to rebuild
23326                 # all of Perl with threads, sorry") when threads haven't
23327                 # been compiled in.
23328                 # --jhi
23329                 avail_ext="$avail_ext $xxx"
23330                 ;;
23331         VMS*)
23332                 ;;
23333         Win32*)
23334                 case "$osname" in
23335                 cygwin) avail_ext="$avail_ext $xxx" ;;
23336                 esac
23337                 ;;
23338         XS/APItest|xs/apitest)
23339                 # This is just for testing.  Skip it unless we have dynamic loading.
23340
23341                 case "$usedl" in
23342                 $define) avail_ext="$avail_ext $xxx" ;;
23343                 esac
23344                 ;;
23345         XS/Typemap|xs/typemap)
23346                 # This is just for testing.  Skip it unless we have dynamic loading.
23347                 case "$usedl" in
23348                 $define) avail_ext="$avail_ext $xxx" ;;
23349                 esac
23350                 ;;
23351         *)      avail_ext="$avail_ext $xxx"
23352                 ;;
23353         esac
23354 done
23355
23356 set X $avail_ext
23357 shift
23358 avail_ext="$*"
23359
23360 case "$onlyextensions" in
23361 '') ;;
23362 *)  keepextensions=''
23363     echo "You have requested that only certain extensions be included..." >&4
23364     for i in $onlyextensions; do
23365         case " $avail_ext " in
23366         *" $i "*)
23367             echo "Keeping extension $i."
23368             keepextensions="$keepextensions $i"
23369             ;;
23370         *) echo "Ignoring extension $i." ;;
23371         esac
23372     done
23373     avail_ext="$keepextensions"
23374     ;;
23375 esac
23376
23377 case "$noextensions" in
23378 '') ;;
23379 *)  keepextensions=''
23380     echo "You have requested that certain extensions be ignored..." >&4
23381     for i in $avail_ext; do
23382         case " $noextensions " in
23383         *" $i "*) echo "Ignoring extension $i." ;;
23384         *) echo "Keeping extension $i.";
23385            keepextensions="$keepextensions $i"
23386            ;;
23387         esac
23388     done
23389     avail_ext="$keepextensions"
23390     ;;
23391 esac
23392
23393 : Now see which nonxs extensions are supported on this system.
23394 : For now assume all are.
23395 nonxs_ext=''
23396 for xxx in $nonxs_extensions ; do
23397         case "$xxx" in
23398         VMS*)
23399                 ;;
23400         *)      nonxs_ext="$nonxs_ext $xxx"
23401                 ;;
23402         esac
23403 done
23404
23405 set X $nonxs_ext
23406 shift
23407 nonxs_ext="$*"
23408
23409 case $usedl in
23410 $define)
23411         $cat <<EOM
23412 A number of extensions are supplied with $package.  You may choose to
23413 compile these extensions for dynamic loading (the default), compile
23414 them into the $package executable (static loading), or not include
23415 them at all.  Answer "none" to include no extensions.
23416 Note that DynaLoader is always built and need not be mentioned here.
23417
23418 EOM
23419         case "$dynamic_ext" in
23420         '')
23421                 : Exclude those listed in static_ext
23422                 dflt=''
23423                 for xxx in $avail_ext; do
23424                         case " $static_ext " in
23425                         *" $xxx "*) ;;
23426                         *) dflt="$dflt $xxx" ;;
23427                         esac
23428                 done
23429                 set X $dflt
23430                 shift
23431                 dflt="$*"
23432                 ;;
23433         *)      dflt="$dynamic_ext"
23434                 # Perhaps we are reusing an old out-of-date config.sh.
23435                 case "$hint" in
23436                 previous)
23437                         if test X"$dynamic_ext" != X"$avail_ext"; then
23438                                 $cat <<EOM
23439 NOTICE:  Your previous config.sh list may be incorrect.
23440 The extensions now available to you are
23441         ${avail_ext}
23442 but the default list from your previous config.sh is
23443         ${dynamic_ext}
23444
23445 EOM
23446                         fi
23447                         ;;
23448                 esac
23449                 ;;
23450         esac
23451         case "$dflt" in
23452         '')     dflt=none;;
23453         esac
23454         rp="What extensions do you wish to load dynamically?"
23455         . ./myread
23456         case "$ans" in
23457         none) dynamic_ext=' ' ;;
23458         *) dynamic_ext="$ans" ;;
23459         esac
23460
23461         case "$static_ext" in
23462         '')
23463                 : Exclude those already listed in dynamic linking
23464                 dflt=''
23465                 for xxx in $avail_ext; do
23466                         case " $dynamic_ext " in
23467                         *" $xxx "*) ;;
23468                         *) dflt="$dflt $xxx" ;;
23469                         esac
23470                 done
23471                 set X $dflt
23472                 shift
23473                 dflt="$*"
23474                 ;;
23475         *)  dflt="$static_ext"
23476                 ;;
23477         esac
23478
23479         case "$dflt" in
23480         '')     dflt=none;;
23481         esac
23482         rp="What extensions do you wish to load statically?"
23483         . ./myread
23484         case "$ans" in
23485         none) static_ext=' ' ;;
23486         *) static_ext="$ans" ;;
23487         esac
23488         ;;
23489 *)
23490         $cat <<EOM
23491 A number of extensions are supplied with $package.  Answer "none"
23492 to include no extensions.
23493 Note that DynaLoader is always built and need not be mentioned here.
23494
23495 EOM
23496         case "$static_ext" in
23497         '') dflt="$avail_ext" ;;
23498         *)      dflt="$static_ext"
23499                 # Perhaps we are reusing an old out-of-date config.sh.
23500                 case "$hint" in
23501                 previous)
23502                         if test X"$static_ext" != X"$avail_ext"; then
23503                                 $cat <<EOM
23504 NOTICE:  Your previous config.sh list may be incorrect.
23505 The extensions now available to you are
23506         ${avail_ext}
23507 but the default list from your previous config.sh is
23508         ${static_ext}
23509
23510 EOM
23511                         fi
23512                         ;;
23513                 esac
23514                 ;;
23515         esac
23516         : Exclude those that are not xs extensions
23517         case "$dflt" in
23518         '')     dflt=none;;
23519         esac
23520         rp="What extensions do you wish to include?"
23521         . ./myread
23522         case "$ans" in
23523         none) static_ext=' ' ;;
23524         *) static_ext="$ans" ;;
23525         esac
23526         ;;
23527 esac
23528 #
23529 # Encode is a special case.  If we are building Encode as a static
23530 # extension, we need to explicitly list its subextensions as well.
23531 # For other nested extensions, this is handled automatically by
23532 # the appropriate Makefile.PL.
23533 case " $static_ext " in
23534         *" Encode "*) # Add the subextensions of Encode
23535         cd "$rsrc/cpan"
23536         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23537                 static_ext="$static_ext Encode/$xxx"
23538                 known_extensions="$known_extensions Encode/$xxx"
23539         done
23540         cd "$tdir"
23541         ;;
23542 esac
23543
23544 set X $dynamic_ext $static_ext $nonxs_ext
23545 shift
23546 extensions="$*"
23547
23548 # Sanity check:  We require an extension suitable for use with
23549 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23550 # should show up as failures in the test suite, but it's helpful to
23551 # catch them now.) The 'extensions' list is normally sorted
23552 # alphabetically, so we need to accept either
23553 #    DB_File ... Fcntl ... IO  ....
23554 # or something like
23555 #    Fcntl ... NDBM_File ... IO  ....
23556 case " $extensions"  in
23557 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
23558 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23559 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23560 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23561    echo "WARNING: The Perl you are building will be quite crippled." >& 4
23562    ;;
23563 esac
23564
23565 : Remove libraries needed only for extensions
23566 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23567 : The exception is SunOS 4.x, which needs them.
23568 case "${osname}X${osvers}" in
23569 sunos*X4*)
23570     perllibs="$libs"
23571     ;;
23572 *) case "$usedl" in
23573     $define|true|[yY]*)
23574             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23575             shift
23576             perllibs="$*"
23577             ;;
23578     *)  perllibs="$libs"
23579             ;;
23580     esac
23581     ;;
23582 esac
23583
23584 : Remove build directory name from cppstdin so it can be used from
23585 : either the present location or the final installed location.
23586 echo " "
23587 : Get out of the UU directory to get correct path name.
23588 cd ..
23589 case "$cppstdin" in
23590 `pwd`/cppstdin)
23591         echo "Stripping down cppstdin path name"
23592         cppstdin=cppstdin
23593         ;;
23594 esac
23595 cd UU
23596
23597 : end of configuration questions
23598 echo " "
23599 echo "End of configuration questions."
23600 echo " "
23601
23602 : back to where it started
23603 if test -d ../UU; then
23604         cd ..
23605 fi
23606
23607 : configuration may be unconditionally patched via a 'config.arch' file
23608 if $test -f config.arch; then
23609         echo "I see a config.arch file, loading it." >&4
23610         . ./config.arch
23611 fi
23612
23613 : configuration may be patched via a 'config.over' file
23614 if $test -f config.over; then
23615         echo " "
23616         dflt=y
23617         rp='I see a config.over file.  Do you wish to load it?'
23618         . UU/myread
23619         case "$ans" in
23620         n*) echo "OK, I'll ignore it.";;
23621         *)      . ./config.over
23622                 echo "Configuration override changes have been loaded."
23623                 ;;
23624         esac
23625 fi
23626
23627 : in case they want portability, strip down executable paths
23628 case "$d_portable" in
23629 "$define")
23630         echo " "
23631         echo "Stripping down executable paths..." >&4
23632         for file in $loclist $trylist; do
23633                 eval temp=\$$file
23634                 eval $file=`basename $temp`
23635         done
23636         ;;
23637 esac
23638
23639 : create config.sh file
23640 echo " "
23641 echo "Creating config.sh..." >&4
23642 $spitshell <<EOT >config.sh
23643 $startsh
23644 #
23645 # This file was produced by running the Configure script. It holds all the
23646 # definitions figured out by Configure. Should you modify one of these values,
23647 # do not forget to propagate your changes by running "Configure -der". You may
23648 # instead choose to run each of the .SH files by yourself, or "Configure -S".
23649 #
23650
23651 # Package name      : $package
23652 # Source directory  : $src
23653 # Configuration time: $cf_time
23654 # Configured by     : $cf_by
23655 # Target system     : $myuname
23656
23657 EOT
23658 : Add in command line options if available
23659 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23660
23661 $spitshell <<EOT >>config.sh
23662
23663 Author='$Author'
23664 Date='$Date'
23665 Header='$Header'
23666 Id='$Id'
23667 Locker='$Locker'
23668 Log='$Log'
23669 RCSfile='$RCSfile'
23670 Revision='$Revision'
23671 Source='$Source'
23672 State='$State'
23673 _a='$_a'
23674 _exe='$_exe'
23675 _o='$_o'
23676 afs='$afs'
23677 afsroot='$afsroot'
23678 alignbytes='$alignbytes'
23679 ansi2knr='$ansi2knr'
23680 aphostname='$aphostname'
23681 api_revision='$api_revision'
23682 api_subversion='$api_subversion'
23683 api_version='$api_version'
23684 api_versionstring='$api_versionstring'
23685 ar='$ar'
23686 archlib='$archlib'
23687 archlibexp='$archlibexp'
23688 archname64='$archname64'
23689 archname='$archname'
23690 archobjs='$archobjs'
23691 asctime_r_proto='$asctime_r_proto'
23692 awk='$awk'
23693 baserev='$baserev'
23694 bash='$bash'
23695 bin='$bin'
23696 bin_ELF='$bin_ELF'
23697 binexp='$binexp'
23698 bison='$bison'
23699 byacc='$byacc'
23700 byteorder='$byteorder'
23701 c='$c'
23702 castflags='$castflags'
23703 cat='$cat'
23704 cc='$cc'
23705 cccdlflags='$cccdlflags'
23706 ccdlflags='$ccdlflags'
23707 ccflags='$ccflags'
23708 ccflags_uselargefiles='$ccflags_uselargefiles'
23709 ccname='$ccname'
23710 ccsymbols='$ccsymbols'
23711 ccversion='$ccversion'
23712 cf_by='$cf_by'
23713 cf_email='$cf_email'
23714 cf_time='$cf_time'
23715 charbits='$charbits'
23716 charsize='$charsize'
23717 chgrp='$chgrp'
23718 chmod='$chmod'
23719 chown='$chown'
23720 clocktype='$clocktype'
23721 comm='$comm'
23722 compress='$compress'
23723 contains='$contains'
23724 cp='$cp'
23725 cpio='$cpio'
23726 cpp='$cpp'
23727 cpp_stuff='$cpp_stuff'
23728 cppccsymbols='$cppccsymbols'
23729 cppflags='$cppflags'
23730 cpplast='$cpplast'
23731 cppminus='$cppminus'
23732 cpprun='$cpprun'
23733 cppstdin='$cppstdin'
23734 cppsymbols='$cppsymbols'
23735 crypt_r_proto='$crypt_r_proto'
23736 cryptlib='$cryptlib'
23737 csh='$csh'
23738 ctermid_r_proto='$ctermid_r_proto'
23739 ctime_r_proto='$ctime_r_proto'
23740 d_Gconvert='$d_Gconvert'
23741 d_PRIEUldbl='$d_PRIEUldbl'
23742 d_PRIFUldbl='$d_PRIFUldbl'
23743 d_PRIGUldbl='$d_PRIGUldbl'
23744 d_PRIXU64='$d_PRIXU64'
23745 d_PRId64='$d_PRId64'
23746 d_PRIeldbl='$d_PRIeldbl'
23747 d_PRIfldbl='$d_PRIfldbl'
23748 d_PRIgldbl='$d_PRIgldbl'
23749 d_PRIi64='$d_PRIi64'
23750 d_PRIo64='$d_PRIo64'
23751 d_PRIu64='$d_PRIu64'
23752 d_PRIx64='$d_PRIx64'
23753 d_SCNfldbl='$d_SCNfldbl'
23754 d__fwalk='$d__fwalk'
23755 d_access='$d_access'
23756 d_accessx='$d_accessx'
23757 d_acosh='$d_acosh'
23758 d_aintl='$d_aintl'
23759 d_alarm='$d_alarm'
23760 d_archlib='$d_archlib'
23761 d_asctime64='$d_asctime64'
23762 d_asctime_r='$d_asctime_r'
23763 d_asinh='$d_asinh'
23764 d_atanh='$d_atanh'
23765 d_atolf='$d_atolf'
23766 d_atoll='$d_atoll'
23767 d_attribute_deprecated='$d_attribute_deprecated'
23768 d_attribute_format='$d_attribute_format'
23769 d_attribute_malloc='$d_attribute_malloc'
23770 d_attribute_nonnull='$d_attribute_nonnull'
23771 d_attribute_noreturn='$d_attribute_noreturn'
23772 d_attribute_pure='$d_attribute_pure'
23773 d_attribute_unused='$d_attribute_unused'
23774 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
23775 d_backtrace='$d_backtrace'
23776 d_bcmp='$d_bcmp'
23777 d_bcopy='$d_bcopy'
23778 d_bsd='$d_bsd'
23779 d_bsdgetpgrp='$d_bsdgetpgrp'
23780 d_bsdsetpgrp='$d_bsdsetpgrp'
23781 d_builtin_choose_expr='$d_builtin_choose_expr'
23782 d_builtin_expect='$d_builtin_expect'
23783 d_bzero='$d_bzero'
23784 d_c99_variadic_macros='$d_c99_variadic_macros'
23785 d_casti32='$d_casti32'
23786 d_castneg='$d_castneg'
23787 d_cbrt='$d_cbrt'
23788 d_charvspr='$d_charvspr'
23789 d_chown='$d_chown'
23790 d_chroot='$d_chroot'
23791 d_chsize='$d_chsize'
23792 d_class='$d_class'
23793 d_clearenv='$d_clearenv'
23794 d_closedir='$d_closedir'
23795 d_cmsghdr_s='$d_cmsghdr_s'
23796 d_const='$d_const'
23797 d_copysign='$d_copysign'
23798 d_copysignl='$d_copysignl'
23799 d_cplusplus='$d_cplusplus'
23800 d_crypt='$d_crypt'
23801 d_crypt_r='$d_crypt_r'
23802 d_csh='$d_csh'
23803 d_ctermid='$d_ctermid'
23804 d_ctermid_r='$d_ctermid_r'
23805 d_ctime64='$d_ctime64'
23806 d_ctime_r='$d_ctime_r'
23807 d_cuserid='$d_cuserid'
23808 d_dbl_dig='$d_dbl_dig'
23809 d_dbminitproto='$d_dbminitproto'
23810 d_difftime64='$d_difftime64'
23811 d_difftime='$d_difftime'
23812 d_dir_dd_fd='$d_dir_dd_fd'
23813 d_dirfd='$d_dirfd'
23814 d_dirnamlen='$d_dirnamlen'
23815 d_dladdr='$d_dladdr'
23816 d_dlerror='$d_dlerror'
23817 d_dlopen='$d_dlopen'
23818 d_dlsymun='$d_dlsymun'
23819 d_dosuid='$d_dosuid'
23820 d_drand48_r='$d_drand48_r'
23821 d_drand48proto='$d_drand48proto'
23822 d_dup2='$d_dup2'
23823 d_eaccess='$d_eaccess'
23824 d_endgrent='$d_endgrent'
23825 d_endgrent_r='$d_endgrent_r'
23826 d_endhent='$d_endhent'
23827 d_endhostent_r='$d_endhostent_r'
23828 d_endnent='$d_endnent'
23829 d_endnetent_r='$d_endnetent_r'
23830 d_endpent='$d_endpent'
23831 d_endprotoent_r='$d_endprotoent_r'
23832 d_endpwent='$d_endpwent'
23833 d_endpwent_r='$d_endpwent_r'
23834 d_endsent='$d_endsent'
23835 d_endservent_r='$d_endservent_r'
23836 d_eofnblk='$d_eofnblk'
23837 d_erf='$d_erf'
23838 d_erfc='$d_erfc'
23839 d_eunice='$d_eunice'
23840 d_exp2='$d_exp2'
23841 d_expm1='$d_expm1'
23842 d_faststdio='$d_faststdio'
23843 d_fchdir='$d_fchdir'
23844 d_fchmod='$d_fchmod'
23845 d_fchown='$d_fchown'
23846 d_fcntl='$d_fcntl'
23847 d_fcntl_can_lock='$d_fcntl_can_lock'
23848 d_fd_macros='$d_fd_macros'
23849 d_fd_set='$d_fd_set'
23850 d_fdim='$d_fdim'
23851 d_fds_bits='$d_fds_bits'
23852 d_fegetround='$d_fegetround'
23853 d_fgetpos='$d_fgetpos'
23854 d_finite='$d_finite'
23855 d_finitel='$d_finitel'
23856 d_flexfnam='$d_flexfnam'
23857 d_flock='$d_flock'
23858 d_flockproto='$d_flockproto'
23859 d_fma='$d_fma'
23860 d_fmax='$d_fmax'
23861 d_fmin='$d_fmin'
23862 d_fork='$d_fork'
23863 d_fp_class='$d_fp_class'
23864 d_fp_classify='$d_fp_classify'
23865 d_fp_classl='$d_fp_classl'
23866 d_fpathconf='$d_fpathconf'
23867 d_fpclass='$d_fpclass'
23868 d_fpclassify='$d_fpclassify'
23869 d_fpclassl='$d_fpclassl'
23870 d_fpgetround='$d_fpgetround'
23871 d_fpos64_t='$d_fpos64_t'
23872 d_frexpl='$d_frexpl'
23873 d_fs_data_s='$d_fs_data_s'
23874 d_fseeko='$d_fseeko'
23875 d_fsetpos='$d_fsetpos'
23876 d_fstatfs='$d_fstatfs'
23877 d_fstatvfs='$d_fstatvfs'
23878 d_fsync='$d_fsync'
23879 d_ftello='$d_ftello'
23880 d_ftime='$d_ftime'
23881 d_futimes='$d_futimes'
23882 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23883 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
23884 d_getaddrinfo='$d_getaddrinfo'
23885 d_getcwd='$d_getcwd'
23886 d_getespwnam='$d_getespwnam'
23887 d_getfsstat='$d_getfsstat'
23888 d_getgrent='$d_getgrent'
23889 d_getgrent_r='$d_getgrent_r'
23890 d_getgrgid_r='$d_getgrgid_r'
23891 d_getgrnam_r='$d_getgrnam_r'
23892 d_getgrps='$d_getgrps'
23893 d_gethbyaddr='$d_gethbyaddr'
23894 d_gethbyname='$d_gethbyname'
23895 d_gethent='$d_gethent'
23896 d_gethname='$d_gethname'
23897 d_gethostbyaddr_r='$d_gethostbyaddr_r'
23898 d_gethostbyname_r='$d_gethostbyname_r'
23899 d_gethostent_r='$d_gethostent_r'
23900 d_gethostprotos='$d_gethostprotos'
23901 d_getitimer='$d_getitimer'
23902 d_getlogin='$d_getlogin'
23903 d_getlogin_r='$d_getlogin_r'
23904 d_getmnt='$d_getmnt'
23905 d_getmntent='$d_getmntent'
23906 d_getnameinfo='$d_getnameinfo'
23907 d_getnbyaddr='$d_getnbyaddr'
23908 d_getnbyname='$d_getnbyname'
23909 d_getnent='$d_getnent'
23910 d_getnetbyaddr_r='$d_getnetbyaddr_r'
23911 d_getnetbyname_r='$d_getnetbyname_r'
23912 d_getnetent_r='$d_getnetent_r'
23913 d_getnetprotos='$d_getnetprotos'
23914 d_getpagsz='$d_getpagsz'
23915 d_getpbyname='$d_getpbyname'
23916 d_getpbynumber='$d_getpbynumber'
23917 d_getpent='$d_getpent'
23918 d_getpgid='$d_getpgid'
23919 d_getpgrp2='$d_getpgrp2'
23920 d_getpgrp='$d_getpgrp'
23921 d_getppid='$d_getppid'
23922 d_getprior='$d_getprior'
23923 d_getprotobyname_r='$d_getprotobyname_r'
23924 d_getprotobynumber_r='$d_getprotobynumber_r'
23925 d_getprotoent_r='$d_getprotoent_r'
23926 d_getprotoprotos='$d_getprotoprotos'
23927 d_getprpwnam='$d_getprpwnam'
23928 d_getpwent='$d_getpwent'
23929 d_getpwent_r='$d_getpwent_r'
23930 d_getpwnam_r='$d_getpwnam_r'
23931 d_getpwuid_r='$d_getpwuid_r'
23932 d_getsbyname='$d_getsbyname'
23933 d_getsbyport='$d_getsbyport'
23934 d_getsent='$d_getsent'
23935 d_getservbyname_r='$d_getservbyname_r'
23936 d_getservbyport_r='$d_getservbyport_r'
23937 d_getservent_r='$d_getservent_r'
23938 d_getservprotos='$d_getservprotos'
23939 d_getspnam='$d_getspnam'
23940 d_getspnam_r='$d_getspnam_r'
23941 d_gettimeod='$d_gettimeod'
23942 d_gmtime64='$d_gmtime64'
23943 d_gmtime_r='$d_gmtime_r'
23944 d_gnulibc='$d_gnulibc'
23945 d_grpasswd='$d_grpasswd'
23946 d_hasmntopt='$d_hasmntopt'
23947 d_htonl='$d_htonl'
23948 d_hypot='$d_hypot'
23949 d_ilogb='$d_ilogb'
23950 d_ilogbl='$d_ilogbl'
23951 d_inc_version_list='$d_inc_version_list'
23952 d_index='$d_index'
23953 d_inetaton='$d_inetaton'
23954 d_inetntop='$d_inetntop'
23955 d_inetpton='$d_inetpton'
23956 d_int64_t='$d_int64_t'
23957 d_ip_mreq='$d_ip_mreq'
23958 d_ip_mreq_source='$d_ip_mreq_source'
23959 d_ipv6_mreq='$d_ipv6_mreq'
23960 d_ipv6_mreq_source='$d_ipv6_mreq_source'
23961 d_isascii='$d_isascii'
23962 d_isblank='$d_isblank'
23963 d_isfinite='$d_isfinite'
23964 d_isfinitel='$d_isfinitel'
23965 d_isinf='$d_isinf'
23966 d_isinfl='$d_isinfl'
23967 d_isless='$d_isless'
23968 d_isnan='$d_isnan'
23969 d_isnanl='$d_isnanl'
23970 d_isnormal='$d_isnormal'
23971 d_j0='$d_j0'
23972 d_j0l='$d_j0l'
23973 d_killpg='$d_killpg'
23974 d_lc_monetary_2008='$d_lc_monetary_2008'
23975 d_lchown='$d_lchown'
23976 d_ldbl_dig='$d_ldbl_dig'
23977 d_ldexpl='$d_ldexpl'
23978 d_lgamma='$d_lgamma'
23979 d_lgamma_r='$d_lgamma_r'
23980 d_libm_lib_version='$d_libm_lib_version'
23981 d_libname_unique='$d_libname_unique'
23982 d_link='$d_link'
23983 d_llrint='$d_llrint'
23984 d_llround='$d_llround'
23985 d_localtime64='$d_localtime64'
23986 d_localtime_r='$d_localtime_r'
23987 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
23988 d_locconv='$d_locconv'
23989 d_lockf='$d_lockf'
23990 d_log1p='$d_log1p'
23991 d_log2='$d_log2'
23992 d_logb='$d_logb'
23993 d_longdbl='$d_longdbl'
23994 d_longlong='$d_longlong'
23995 d_lrint='$d_lrint'
23996 d_lround='$d_lround'
23997 d_lseekproto='$d_lseekproto'
23998 d_lstat='$d_lstat'
23999 d_madvise='$d_madvise'
24000 d_malloc_good_size='$d_malloc_good_size'
24001 d_malloc_size='$d_malloc_size'
24002 d_mblen='$d_mblen'
24003 d_mbstowcs='$d_mbstowcs'
24004 d_mbtowc='$d_mbtowc'
24005 d_memchr='$d_memchr'
24006 d_memcmp='$d_memcmp'
24007 d_memcpy='$d_memcpy'
24008 d_memmove='$d_memmove'
24009 d_memset='$d_memset'
24010 d_mkdir='$d_mkdir'
24011 d_mkdtemp='$d_mkdtemp'
24012 d_mkfifo='$d_mkfifo'
24013 d_mkstemp='$d_mkstemp'
24014 d_mkstemps='$d_mkstemps'
24015 d_mktime64='$d_mktime64'
24016 d_mktime='$d_mktime'
24017 d_mmap='$d_mmap'
24018 d_modfl='$d_modfl'
24019 d_modfl_pow32_bug='$d_modfl_pow32_bug'
24020 d_modflproto='$d_modflproto'
24021 d_mprotect='$d_mprotect'
24022 d_msg='$d_msg'
24023 d_msg_ctrunc='$d_msg_ctrunc'
24024 d_msg_dontroute='$d_msg_dontroute'
24025 d_msg_oob='$d_msg_oob'
24026 d_msg_peek='$d_msg_peek'
24027 d_msg_proxy='$d_msg_proxy'
24028 d_msgctl='$d_msgctl'
24029 d_msgget='$d_msgget'
24030 d_msghdr_s='$d_msghdr_s'
24031 d_msgrcv='$d_msgrcv'
24032 d_msgsnd='$d_msgsnd'
24033 d_msync='$d_msync'
24034 d_munmap='$d_munmap'
24035 d_mymalloc='$d_mymalloc'
24036 d_nan='$d_nan'
24037 d_ndbm='$d_ndbm'
24038 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24039 d_nearbyint='$d_nearbyint'
24040 d_nextafter='$d_nextafter'
24041 d_nexttoward='$d_nexttoward'
24042 d_nice='$d_nice'
24043 d_nl_langinfo='$d_nl_langinfo'
24044 d_nv_preserves_uv='$d_nv_preserves_uv'
24045 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24046 d_off64_t='$d_off64_t'
24047 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24048 d_oldpthreads='$d_oldpthreads'
24049 d_oldsock='$d_oldsock'
24050 d_open3='$d_open3'
24051 d_pathconf='$d_pathconf'
24052 d_pause='$d_pause'
24053 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24054 d_phostname='$d_phostname'
24055 d_pipe='$d_pipe'
24056 d_poll='$d_poll'
24057 d_portable='$d_portable'
24058 d_prctl='$d_prctl'
24059 d_prctl_set_name='$d_prctl_set_name'
24060 d_printf_format_null='$d_printf_format_null'
24061 d_procselfexe='$d_procselfexe'
24062 d_pseudofork='$d_pseudofork'
24063 d_pthread_atfork='$d_pthread_atfork'
24064 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24065 d_pthread_yield='$d_pthread_yield'
24066 d_ptrdiff_t='$d_ptrdiff_t'
24067 d_pwage='$d_pwage'
24068 d_pwchange='$d_pwchange'
24069 d_pwclass='$d_pwclass'
24070 d_pwcomment='$d_pwcomment'
24071 d_pwexpire='$d_pwexpire'
24072 d_pwgecos='$d_pwgecos'
24073 d_pwpasswd='$d_pwpasswd'
24074 d_pwquota='$d_pwquota'
24075 d_qgcvt='$d_qgcvt'
24076 d_quad='$d_quad'
24077 d_random_r='$d_random_r'
24078 d_re_comp='$d_re_comp'
24079 d_readdir64_r='$d_readdir64_r'
24080 d_readdir='$d_readdir'
24081 d_readdir_r='$d_readdir_r'
24082 d_readlink='$d_readlink'
24083 d_readv='$d_readv'
24084 d_recvmsg='$d_recvmsg'
24085 d_regcmp='$d_regcmp'
24086 d_regcomp='$d_regcomp'
24087 d_remainder='$d_remainder'
24088 d_remquo='$d_remquo'
24089 d_rename='$d_rename'
24090 d_rewinddir='$d_rewinddir'
24091 d_rint='$d_rint'
24092 d_rmdir='$d_rmdir'
24093 d_round='$d_round'
24094 d_safebcpy='$d_safebcpy'
24095 d_safemcpy='$d_safemcpy'
24096 d_sanemcmp='$d_sanemcmp'
24097 d_sbrkproto='$d_sbrkproto'
24098 d_scalbn='$d_scalbn'
24099 d_scalbnl='$d_scalbnl'
24100 d_sched_yield='$d_sched_yield'
24101 d_scm_rights='$d_scm_rights'
24102 d_seekdir='$d_seekdir'
24103 d_select='$d_select'
24104 d_sem='$d_sem'
24105 d_semctl='$d_semctl'
24106 d_semctl_semid_ds='$d_semctl_semid_ds'
24107 d_semctl_semun='$d_semctl_semun'
24108 d_semget='$d_semget'
24109 d_semop='$d_semop'
24110 d_sendmsg='$d_sendmsg'
24111 d_setegid='$d_setegid'
24112 d_seteuid='$d_seteuid'
24113 d_setgrent='$d_setgrent'
24114 d_setgrent_r='$d_setgrent_r'
24115 d_setgrps='$d_setgrps'
24116 d_sethent='$d_sethent'
24117 d_sethostent_r='$d_sethostent_r'
24118 d_setitimer='$d_setitimer'
24119 d_setlinebuf='$d_setlinebuf'
24120 d_setlocale='$d_setlocale'
24121 d_setlocale_r='$d_setlocale_r'
24122 d_setnent='$d_setnent'
24123 d_setnetent_r='$d_setnetent_r'
24124 d_setpent='$d_setpent'
24125 d_setpgid='$d_setpgid'
24126 d_setpgrp2='$d_setpgrp2'
24127 d_setpgrp='$d_setpgrp'
24128 d_setprior='$d_setprior'
24129 d_setproctitle='$d_setproctitle'
24130 d_setprotoent_r='$d_setprotoent_r'
24131 d_setpwent='$d_setpwent'
24132 d_setpwent_r='$d_setpwent_r'
24133 d_setregid='$d_setregid'
24134 d_setresgid='$d_setresgid'
24135 d_setresuid='$d_setresuid'
24136 d_setreuid='$d_setreuid'
24137 d_setrgid='$d_setrgid'
24138 d_setruid='$d_setruid'
24139 d_setsent='$d_setsent'
24140 d_setservent_r='$d_setservent_r'
24141 d_setsid='$d_setsid'
24142 d_setvbuf='$d_setvbuf'
24143 d_shm='$d_shm'
24144 d_shmat='$d_shmat'
24145 d_shmatprototype='$d_shmatprototype'
24146 d_shmctl='$d_shmctl'
24147 d_shmdt='$d_shmdt'
24148 d_shmget='$d_shmget'
24149 d_sigaction='$d_sigaction'
24150 d_signbit='$d_signbit'
24151 d_sigprocmask='$d_sigprocmask'
24152 d_sigsetjmp='$d_sigsetjmp'
24153 d_sin6_scope_id='$d_sin6_scope_id'
24154 d_sitearch='$d_sitearch'
24155 d_snprintf='$d_snprintf'
24156 d_sockaddr_in6='$d_sockaddr_in6'
24157 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24158 d_sockatmark='$d_sockatmark'
24159 d_sockatmarkproto='$d_sockatmarkproto'
24160 d_socket='$d_socket'
24161 d_socklen_t='$d_socklen_t'
24162 d_sockpair='$d_sockpair'
24163 d_socks5_init='$d_socks5_init'
24164 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
24165 d_sqrtl='$d_sqrtl'
24166 d_srand48_r='$d_srand48_r'
24167 d_srandom_r='$d_srandom_r'
24168 d_sresgproto='$d_sresgproto'
24169 d_sresuproto='$d_sresuproto'
24170 d_stat='$d_stat'
24171 d_statblks='$d_statblks'
24172 d_statfs_f_flags='$d_statfs_f_flags'
24173 d_statfs_s='$d_statfs_s'
24174 d_static_inline='$d_static_inline'
24175 d_statvfs='$d_statvfs'
24176 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24177 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24178 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24179 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24180 d_stdio_stream_array='$d_stdio_stream_array'
24181 d_stdiobase='$d_stdiobase'
24182 d_stdstdio='$d_stdstdio'
24183 d_strchr='$d_strchr'
24184 d_strcoll='$d_strcoll'
24185 d_strctcpy='$d_strctcpy'
24186 d_strerrm='$d_strerrm'
24187 d_strerror='$d_strerror'
24188 d_strerror_r='$d_strerror_r'
24189 d_strftime='$d_strftime'
24190 d_strlcat='$d_strlcat'
24191 d_strlcpy='$d_strlcpy'
24192 d_strtod='$d_strtod'
24193 d_strtol='$d_strtol'
24194 d_strtold='$d_strtold'
24195 d_strtoll='$d_strtoll'
24196 d_strtoq='$d_strtoq'
24197 d_strtoul='$d_strtoul'
24198 d_strtoull='$d_strtoull'
24199 d_strtouq='$d_strtouq'
24200 d_strxfrm='$d_strxfrm'
24201 d_suidsafe='$d_suidsafe'
24202 d_symlink='$d_symlink'
24203 d_syscall='$d_syscall'
24204 d_syscallproto='$d_syscallproto'
24205 d_sysconf='$d_sysconf'
24206 d_sysernlst='$d_sysernlst'
24207 d_syserrlst='$d_syserrlst'
24208 d_system='$d_system'
24209 d_tcgetpgrp='$d_tcgetpgrp'
24210 d_tcsetpgrp='$d_tcsetpgrp'
24211 d_telldir='$d_telldir'
24212 d_telldirproto='$d_telldirproto'
24213 d_tgamma='$d_tgamma'
24214 d_time='$d_time'
24215 d_timegm='$d_timegm'
24216 d_times='$d_times'
24217 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24218 d_tm_tm_zone='$d_tm_tm_zone'
24219 d_tmpnam_r='$d_tmpnam_r'
24220 d_trunc='$d_trunc'
24221 d_truncate='$d_truncate'
24222 d_truncl='$d_truncl'
24223 d_ttyname_r='$d_ttyname_r'
24224 d_tzname='$d_tzname'
24225 d_u32align='$d_u32align'
24226 d_ualarm='$d_ualarm'
24227 d_umask='$d_umask'
24228 d_uname='$d_uname'
24229 d_union_semun='$d_union_semun'
24230 d_unordered='$d_unordered'
24231 d_unsetenv='$d_unsetenv'
24232 d_usleep='$d_usleep'
24233 d_usleepproto='$d_usleepproto'
24234 d_ustat='$d_ustat'
24235 d_vendorarch='$d_vendorarch'
24236 d_vendorbin='$d_vendorbin'
24237 d_vendorlib='$d_vendorlib'
24238 d_vendorscript='$d_vendorscript'
24239 d_vfork='$d_vfork'
24240 d_void_closedir='$d_void_closedir'
24241 d_voidsig='$d_voidsig'
24242 d_voidtty='$d_voidtty'
24243 d_volatile='$d_volatile'
24244 d_vprintf='$d_vprintf'
24245 d_vsnprintf='$d_vsnprintf'
24246 d_wait4='$d_wait4'
24247 d_waitpid='$d_waitpid'
24248 d_wcscmp='$d_wcscmp'
24249 d_wcstombs='$d_wcstombs'
24250 d_wcsxfrm='$d_wcsxfrm'
24251 d_wctomb='$d_wctomb'
24252 d_writev='$d_writev'
24253 d_xenix='$d_xenix'
24254 date='$date'
24255 db_hashtype='$db_hashtype'
24256 db_prefixtype='$db_prefixtype'
24257 db_version_major='$db_version_major'
24258 db_version_minor='$db_version_minor'
24259 db_version_patch='$db_version_patch'
24260 direntrytype='$direntrytype'
24261 dlext='$dlext'
24262 dlsrc='$dlsrc'
24263 doublekind='$doublekind'
24264 doublesize='$doublesize'
24265 drand01='$drand01'
24266 drand48_r_proto='$drand48_r_proto'
24267 dtrace='$dtrace'
24268 dynamic_ext='$dynamic_ext'
24269 eagain='$eagain'
24270 ebcdic='$ebcdic'
24271 echo='$echo'
24272 egrep='$egrep'
24273 emacs='$emacs'
24274 endgrent_r_proto='$endgrent_r_proto'
24275 endhostent_r_proto='$endhostent_r_proto'
24276 endnetent_r_proto='$endnetent_r_proto'
24277 endprotoent_r_proto='$endprotoent_r_proto'
24278 endpwent_r_proto='$endpwent_r_proto'
24279 endservent_r_proto='$endservent_r_proto'
24280 eunicefix='$eunicefix'
24281 exe_ext='$exe_ext'
24282 expr='$expr'
24283 extensions='$extensions'
24284 extern_C='$extern_C'
24285 extras='$extras'
24286 fflushNULL='$fflushNULL'
24287 fflushall='$fflushall'
24288 find='$find'
24289 firstmakefile='$firstmakefile'
24290 flex='$flex'
24291 fpossize='$fpossize'
24292 fpostype='$fpostype'
24293 freetype='$freetype'
24294 from='$from'
24295 full_ar='$full_ar'
24296 full_csh='$full_csh'
24297 full_sed='$full_sed'
24298 gccansipedantic='$gccansipedantic'
24299 gccosandvers='$gccosandvers'
24300 gccversion='$gccversion'
24301 getgrent_r_proto='$getgrent_r_proto'
24302 getgrgid_r_proto='$getgrgid_r_proto'
24303 getgrnam_r_proto='$getgrnam_r_proto'
24304 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24305 gethostbyname_r_proto='$gethostbyname_r_proto'
24306 gethostent_r_proto='$gethostent_r_proto'
24307 getlogin_r_proto='$getlogin_r_proto'
24308 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24309 getnetbyname_r_proto='$getnetbyname_r_proto'
24310 getnetent_r_proto='$getnetent_r_proto'
24311 getprotobyname_r_proto='$getprotobyname_r_proto'
24312 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24313 getprotoent_r_proto='$getprotoent_r_proto'
24314 getpwent_r_proto='$getpwent_r_proto'
24315 getpwnam_r_proto='$getpwnam_r_proto'
24316 getpwuid_r_proto='$getpwuid_r_proto'
24317 getservbyname_r_proto='$getservbyname_r_proto'
24318 getservbyport_r_proto='$getservbyport_r_proto'
24319 getservent_r_proto='$getservent_r_proto'
24320 getspnam_r_proto='$getspnam_r_proto'
24321 gidformat='$gidformat'
24322 gidsign='$gidsign'
24323 gidsize='$gidsize'
24324 gidtype='$gidtype'
24325 glibpth='$glibpth'
24326 gmake='$gmake'
24327 gmtime_r_proto='$gmtime_r_proto'
24328 gnulibc_version='$gnulibc_version'
24329 grep='$grep'
24330 groupcat='$groupcat'
24331 groupstype='$groupstype'
24332 gzip='$gzip'
24333 h_fcntl='$h_fcntl'
24334 h_sysfile='$h_sysfile'
24335 hint='$hint'
24336 hostcat='$hostcat'
24337 hostgenerate='$hostgenerate'
24338 hostosname='$hostosname'
24339 hostperl='$hostperl'
24340 html1dir='$html1dir'
24341 html1direxp='$html1direxp'
24342 html3dir='$html3dir'
24343 html3direxp='$html3direxp'
24344 i16size='$i16size'
24345 i16type='$i16type'
24346 i32size='$i32size'
24347 i32type='$i32type'
24348 i64size='$i64size'
24349 i64type='$i64type'
24350 i8size='$i8size'
24351 i8type='$i8type'
24352 i_arpainet='$i_arpainet'
24353 i_assert='$i_assert'
24354 i_bfd='$i_bfd'
24355 i_bsdioctl='$i_bsdioctl'
24356 i_crypt='$i_crypt'
24357 i_db='$i_db'
24358 i_dbm='$i_dbm'
24359 i_dirent='$i_dirent'
24360 i_dlfcn='$i_dlfcn'
24361 i_execinfo='$i_execinfo'
24362 i_fcntl='$i_fcntl'
24363 i_fenv='$i_fenv'
24364 i_float='$i_float'
24365 i_fp='$i_fp'
24366 i_fp_class='$i_fp_class'
24367 i_gdbm='$i_gdbm'
24368 i_gdbm_ndbm='$i_gdbm_ndbm'
24369 i_gdbmndbm='$i_gdbmndbm'
24370 i_grp='$i_grp'
24371 i_ieeefp='$i_ieeefp'
24372 i_inttypes='$i_inttypes'
24373 i_langinfo='$i_langinfo'
24374 i_libutil='$i_libutil'
24375 i_limits='$i_limits'
24376 i_locale='$i_locale'
24377 i_machcthr='$i_machcthr'
24378 i_malloc='$i_malloc'
24379 i_mallocmalloc='$i_mallocmalloc'
24380 i_math='$i_math'
24381 i_memory='$i_memory'
24382 i_mntent='$i_mntent'
24383 i_ndbm='$i_ndbm'
24384 i_netdb='$i_netdb'
24385 i_neterrno='$i_neterrno'
24386 i_netinettcp='$i_netinettcp'
24387 i_niin='$i_niin'
24388 i_poll='$i_poll'
24389 i_prot='$i_prot'
24390 i_pthread='$i_pthread'
24391 i_pwd='$i_pwd'
24392 i_quadmath='$i_quadmath'
24393 i_rpcsvcdbm='$i_rpcsvcdbm'
24394 i_sgtty='$i_sgtty'
24395 i_shadow='$i_shadow'
24396 i_socks='$i_socks'
24397 i_stdarg='$i_stdarg'
24398 i_stdbool='$i_stdbool'
24399 i_stddef='$i_stddef'
24400 i_stdint='$i_stdint'
24401 i_stdlib='$i_stdlib'
24402 i_string='$i_string'
24403 i_sunmath='$i_sunmath'
24404 i_sysaccess='$i_sysaccess'
24405 i_sysdir='$i_sysdir'
24406 i_sysfile='$i_sysfile'
24407 i_sysfilio='$i_sysfilio'
24408 i_sysin='$i_sysin'
24409 i_sysioctl='$i_sysioctl'
24410 i_syslog='$i_syslog'
24411 i_sysmman='$i_sysmman'
24412 i_sysmode='$i_sysmode'
24413 i_sysmount='$i_sysmount'
24414 i_sysndir='$i_sysndir'
24415 i_sysparam='$i_sysparam'
24416 i_syspoll='$i_syspoll'
24417 i_sysresrc='$i_sysresrc'
24418 i_syssecrt='$i_syssecrt'
24419 i_sysselct='$i_sysselct'
24420 i_syssockio='$i_syssockio'
24421 i_sysstat='$i_sysstat'
24422 i_sysstatfs='$i_sysstatfs'
24423 i_sysstatvfs='$i_sysstatvfs'
24424 i_systime='$i_systime'
24425 i_systimek='$i_systimek'
24426 i_systimes='$i_systimes'
24427 i_systypes='$i_systypes'
24428 i_sysuio='$i_sysuio'
24429 i_sysun='$i_sysun'
24430 i_sysutsname='$i_sysutsname'
24431 i_sysvfs='$i_sysvfs'
24432 i_syswait='$i_syswait'
24433 i_termio='$i_termio'
24434 i_termios='$i_termios'
24435 i_time='$i_time'
24436 i_unistd='$i_unistd'
24437 i_ustat='$i_ustat'
24438 i_utime='$i_utime'
24439 i_values='$i_values'
24440 i_varargs='$i_varargs'
24441 i_varhdr='$i_varhdr'
24442 i_vfork='$i_vfork'
24443 ignore_versioned_solibs='$ignore_versioned_solibs'
24444 inc_version_list='$inc_version_list'
24445 inc_version_list_init='$inc_version_list_init'
24446 incpath='$incpath'
24447 incpth='$incpth'
24448 inews='$inews'
24449 initialinstalllocation='$initialinstalllocation'
24450 installarchlib='$installarchlib'
24451 installbin='$installbin'
24452 installhtml1dir='$installhtml1dir'
24453 installhtml3dir='$installhtml3dir'
24454 installman1dir='$installman1dir'
24455 installman3dir='$installman3dir'
24456 installprefix='$installprefix'
24457 installprefixexp='$installprefixexp'
24458 installprivlib='$installprivlib'
24459 installscript='$installscript'
24460 installsitearch='$installsitearch'
24461 installsitebin='$installsitebin'
24462 installsitehtml1dir='$installsitehtml1dir'
24463 installsitehtml3dir='$installsitehtml3dir'
24464 installsitelib='$installsitelib'
24465 installsiteman1dir='$installsiteman1dir'
24466 installsiteman3dir='$installsiteman3dir'
24467 installsitescript='$installsitescript'
24468 installstyle='$installstyle'
24469 installusrbinperl='$installusrbinperl'
24470 installvendorarch='$installvendorarch'
24471 installvendorbin='$installvendorbin'
24472 installvendorhtml1dir='$installvendorhtml1dir'
24473 installvendorhtml3dir='$installvendorhtml3dir'
24474 installvendorlib='$installvendorlib'
24475 installvendorman1dir='$installvendorman1dir'
24476 installvendorman3dir='$installvendorman3dir'
24477 installvendorscript='$installvendorscript'
24478 intsize='$intsize'
24479 issymlink='$issymlink'
24480 ivdformat='$ivdformat'
24481 ivsize='$ivsize'
24482 ivtype='$ivtype'
24483 known_extensions='$known_extensions'
24484 ksh='$ksh'
24485 ld='$ld'
24486 ld_can_script='$ld_can_script'
24487 lddlflags='$lddlflags'
24488 ldflags='$ldflags'
24489 ldflags_uselargefiles='$ldflags_uselargefiles'
24490 ldlibpthname='$ldlibpthname'
24491 less='$less'
24492 lib_ext='$lib_ext'
24493 libc='$libc'
24494 libperl='$libperl'
24495 libpth='$libpth'
24496 libs='$libs'
24497 libsdirs='$libsdirs'
24498 libsfiles='$libsfiles'
24499 libsfound='$libsfound'
24500 libspath='$libspath'
24501 libswanted='$libswanted'
24502 libswanted_uselargefiles='$libswanted_uselargefiles'
24503 line='$line'
24504 lint='$lint'
24505 lkflags='$lkflags'
24506 ln='$ln'
24507 lns='$lns'
24508 localtime_r_proto='$localtime_r_proto'
24509 locincpth='$locincpth'
24510 loclibpth='$loclibpth'
24511 longdblkind='$longdblkind'
24512 longdblsize='$longdblsize'
24513 longlongsize='$longlongsize'
24514 longsize='$longsize'
24515 lp='$lp'
24516 lpr='$lpr'
24517 ls='$ls'
24518 lseeksize='$lseeksize'
24519 lseektype='$lseektype'
24520 mail='$mail'
24521 mailx='$mailx'
24522 make='$make'
24523 make_set_make='$make_set_make'
24524 mallocobj='$mallocobj'
24525 mallocsrc='$mallocsrc'
24526 malloctype='$malloctype'
24527 man1dir='$man1dir'
24528 man1direxp='$man1direxp'
24529 man1ext='$man1ext'
24530 man3dir='$man3dir'
24531 man3direxp='$man3direxp'
24532 man3ext='$man3ext'
24533 mips_type='$mips_type'
24534 mistrustnm='$mistrustnm'
24535 mkdir='$mkdir'
24536 mmaptype='$mmaptype'
24537 modetype='$modetype'
24538 more='$more'
24539 multiarch='$multiarch'
24540 mv='$mv'
24541 myarchname='$myarchname'
24542 mydomain='$mydomain'
24543 myhostname='$myhostname'
24544 myuname='$myuname'
24545 n='$n'
24546 need_va_copy='$need_va_copy'
24547 netdb_hlen_type='$netdb_hlen_type'
24548 netdb_host_type='$netdb_host_type'
24549 netdb_name_type='$netdb_name_type'
24550 netdb_net_type='$netdb_net_type'
24551 nm='$nm'
24552 nm_opt='$nm_opt'
24553 nm_so_opt='$nm_so_opt'
24554 nonxs_ext='$nonxs_ext'
24555 nroff='$nroff'
24556 nvEUformat='$nvEUformat'
24557 nvFUformat='$nvFUformat'
24558 nvGUformat='$nvGUformat'
24559 nv_overflows_integers_at='$nv_overflows_integers_at'
24560 nv_preserves_uv_bits='$nv_preserves_uv_bits'
24561 nveformat='$nveformat'
24562 nvfformat='$nvfformat'
24563 nvgformat='$nvgformat'
24564 nvsize='$nvsize'
24565 nvtype='$nvtype'
24566 o_nonblock='$o_nonblock'
24567 obj_ext='$obj_ext'
24568 old_pthread_create_joinable='$old_pthread_create_joinable'
24569 optimize='$optimize'
24570 orderlib='$orderlib'
24571 osname='$osname'
24572 osvers='$osvers'
24573 otherlibdirs='$otherlibdirs'
24574 package='$package'
24575 pager='$pager'
24576 passcat='$passcat'
24577 patchlevel='$patchlevel'
24578 path_sep='$path_sep'
24579 perl5='$perl5'
24580 perl='$perl'
24581 perl_patchlevel='$perl_patchlevel'
24582 perl_static_inline='$perl_static_inline'
24583 perladmin='$perladmin'
24584 perllibs='$perllibs'
24585 perlpath='$perlpath'
24586 pg='$pg'
24587 phostname='$phostname'
24588 pidtype='$pidtype'
24589 plibpth='$plibpth'
24590 pmake='$pmake'
24591 pr='$pr'
24592 prefix='$prefix'
24593 prefixexp='$prefixexp'
24594 privlib='$privlib'
24595 privlibexp='$privlibexp'
24596 procselfexe='$procselfexe'
24597 prototype='$prototype'
24598 ptrsize='$ptrsize'
24599 quadkind='$quadkind'
24600 quadtype='$quadtype'
24601 randbits='$randbits'
24602 randfunc='$randfunc'
24603 random_r_proto='$random_r_proto'
24604 randseedtype='$randseedtype'
24605 ranlib='$ranlib'
24606 rd_nodata='$rd_nodata'
24607 readdir64_r_proto='$readdir64_r_proto'
24608 readdir_r_proto='$readdir_r_proto'
24609 revision='$revision'
24610 rm='$rm'
24611 rm_try='$rm_try'
24612 rmail='$rmail'
24613 run='$run'
24614 runnm='$runnm'
24615 sGMTIME_max='$sGMTIME_max'
24616 sGMTIME_min='$sGMTIME_min'
24617 sLOCALTIME_max='$sLOCALTIME_max'
24618 sLOCALTIME_min='$sLOCALTIME_min'
24619 sPRIEUldbl='$sPRIEUldbl'
24620 sPRIFUldbl='$sPRIFUldbl'
24621 sPRIGUldbl='$sPRIGUldbl'
24622 sPRIXU64='$sPRIXU64'
24623 sPRId64='$sPRId64'
24624 sPRIeldbl='$sPRIeldbl'
24625 sPRIfldbl='$sPRIfldbl'
24626 sPRIgldbl='$sPRIgldbl'
24627 sPRIi64='$sPRIi64'
24628 sPRIo64='$sPRIo64'
24629 sPRIu64='$sPRIu64'
24630 sPRIx64='$sPRIx64'
24631 sSCNfldbl='$sSCNfldbl'
24632 sched_yield='$sched_yield'
24633 scriptdir='$scriptdir'
24634 scriptdirexp='$scriptdirexp'
24635 sed='$sed'
24636 seedfunc='$seedfunc'
24637 selectminbits='$selectminbits'
24638 selecttype='$selecttype'
24639 sendmail='$sendmail'
24640 setgrent_r_proto='$setgrent_r_proto'
24641 sethostent_r_proto='$sethostent_r_proto'
24642 setlocale_r_proto='$setlocale_r_proto'
24643 setnetent_r_proto='$setnetent_r_proto'
24644 setprotoent_r_proto='$setprotoent_r_proto'
24645 setpwent_r_proto='$setpwent_r_proto'
24646 setservent_r_proto='$setservent_r_proto'
24647 sh='$sh'
24648 shar='$shar'
24649 sharpbang='$sharpbang'
24650 shmattype='$shmattype'
24651 shortsize='$shortsize'
24652 shrpenv='$shrpenv'
24653 shsharp='$shsharp'
24654 sig_count='$sig_count'
24655 sig_name='$sig_name'
24656 sig_name_init='$sig_name_init'
24657 sig_num='$sig_num'
24658 sig_num_init='$sig_num_init'
24659 sig_size='$sig_size'
24660 signal_t='$signal_t'
24661 sitearch='$sitearch'
24662 sitearchexp='$sitearchexp'
24663 sitebin='$sitebin'
24664 sitebinexp='$sitebinexp'
24665 sitehtml1dir='$sitehtml1dir'
24666 sitehtml1direxp='$sitehtml1direxp'
24667 sitehtml3dir='$sitehtml3dir'
24668 sitehtml3direxp='$sitehtml3direxp'
24669 sitelib='$sitelib'
24670 sitelib_stem='$sitelib_stem'
24671 sitelibexp='$sitelibexp'
24672 siteman1dir='$siteman1dir'
24673 siteman1direxp='$siteman1direxp'
24674 siteman3dir='$siteman3dir'
24675 siteman3direxp='$siteman3direxp'
24676 siteprefix='$siteprefix'
24677 siteprefixexp='$siteprefixexp'
24678 sitescript='$sitescript'
24679 sitescriptexp='$sitescriptexp'
24680 sizesize='$sizesize'
24681 sizetype='$sizetype'
24682 sleep='$sleep'
24683 smail='$smail'
24684 so='$so'
24685 sockethdr='$sockethdr'
24686 socketlib='$socketlib'
24687 socksizetype='$socksizetype'
24688 sort='$sort'
24689 spackage='$spackage'
24690 spitshell='$spitshell'
24691 srand48_r_proto='$srand48_r_proto'
24692 srandom_r_proto='$srandom_r_proto'
24693 src='$src'
24694 ssizetype='$ssizetype'
24695 st_ino_sign='$st_ino_sign'
24696 st_ino_size='$st_ino_size'
24697 startperl='$startperl'
24698 startsh='$startsh'
24699 static_ext='$static_ext'
24700 stdchar='$stdchar'
24701 stdio_base='$stdio_base'
24702 stdio_bufsiz='$stdio_bufsiz'
24703 stdio_cnt='$stdio_cnt'
24704 stdio_filbuf='$stdio_filbuf'
24705 stdio_ptr='$stdio_ptr'
24706 stdio_stream_array='$stdio_stream_array'
24707 strerror_r_proto='$strerror_r_proto'
24708 strings='$strings'
24709 submit='$submit'
24710 subversion='$subversion'
24711 sysman='$sysman'
24712 sysroot='$sysroot'
24713 tail='$tail'
24714 tar='$tar'
24715 targetarch='$targetarch'
24716 targetdir='$targetdir'
24717 targetenv='$targetenv'
24718 targethost='$targethost'
24719 targetmkdir='$targetmkdir'
24720 targetport='$targetport'
24721 targetsh='$targetsh'
24722 tbl='$tbl'
24723 tee='$tee'
24724 test='$test'
24725 timeincl='$timeincl'
24726 timetype='$timetype'
24727 tmpnam_r_proto='$tmpnam_r_proto'
24728 to='$to'
24729 touch='$touch'
24730 tr='$tr'
24731 trnl='$trnl'
24732 troff='$troff'
24733 ttyname_r_proto='$ttyname_r_proto'
24734 u16size='$u16size'
24735 u16type='$u16type'
24736 u32size='$u32size'
24737 u32type='$u32type'
24738 u64size='$u64size'
24739 u64type='$u64type'
24740 u8size='$u8size'
24741 u8type='$u8type'
24742 uidformat='$uidformat'
24743 uidsign='$uidsign'
24744 uidsize='$uidsize'
24745 uidtype='$uidtype'
24746 uname='$uname'
24747 uniq='$uniq'
24748 uquadtype='$uquadtype'
24749 use5005threads='$use5005threads'
24750 use64bitall='$use64bitall'
24751 use64bitint='$use64bitint'
24752 usecbacktrace='$usecbacktrace'
24753 usecrosscompile='$usecrosscompile'
24754 usedevel='$usedevel'
24755 usedl='$usedl'
24756 usedtrace='$usedtrace'
24757 usefaststdio='$usefaststdio'
24758 useithreads='$useithreads'
24759 usekernprocpathname='$usekernprocpathname'
24760 uselargefiles='$uselargefiles'
24761 uselongdouble='$uselongdouble'
24762 usemallocwrap='$usemallocwrap'
24763 usemorebits='$usemorebits'
24764 usemultiplicity='$usemultiplicity'
24765 usemymalloc='$usemymalloc'
24766 usenm='$usenm'
24767 usensgetexecutablepath='$usensgetexecutablepath'
24768 useopcode='$useopcode'
24769 useperlio='$useperlio'
24770 useposix='$useposix'
24771 usequadmath='$usequadmath'
24772 usereentrant='$usereentrant'
24773 userelocatableinc='$userelocatableinc'
24774 useshrplib='$useshrplib'
24775 usesitecustomize='$usesitecustomize'
24776 usesocks='$usesocks'
24777 usethreads='$usethreads'
24778 usevendorprefix='$usevendorprefix'
24779 useversionedarchname='$useversionedarchname'
24780 usevfork='$usevfork'
24781 usrinc='$usrinc'
24782 uuname='$uuname'
24783 uvXUformat='$uvXUformat'
24784 uvoformat='$uvoformat'
24785 uvsize='$uvsize'
24786 uvtype='$uvtype'
24787 uvuformat='$uvuformat'
24788 uvxformat='$uvxformat'
24789 vaproto='$vaproto'
24790 vendorarch='$vendorarch'
24791 vendorarchexp='$vendorarchexp'
24792 vendorbin='$vendorbin'
24793 vendorbinexp='$vendorbinexp'
24794 vendorhtml1dir='$vendorhtml1dir'
24795 vendorhtml1direxp='$vendorhtml1direxp'
24796 vendorhtml3dir='$vendorhtml3dir'
24797 vendorhtml3direxp='$vendorhtml3direxp'
24798 vendorlib='$vendorlib'
24799 vendorlib_stem='$vendorlib_stem'
24800 vendorlibexp='$vendorlibexp'
24801 vendorman1dir='$vendorman1dir'
24802 vendorman1direxp='$vendorman1direxp'
24803 vendorman3dir='$vendorman3dir'
24804 vendorman3direxp='$vendorman3direxp'
24805 vendorprefix='$vendorprefix'
24806 vendorprefixexp='$vendorprefixexp'
24807 vendorscript='$vendorscript'
24808 vendorscriptexp='$vendorscriptexp'
24809 version='$version'
24810 version_patchlevel_string='$version_patchlevel_string'
24811 versiononly='$versiononly'
24812 vi='$vi'
24813 xlibpth='$xlibpth'
24814 yacc='$yacc'
24815 yaccflags='$yaccflags'
24816 zcat='$zcat'
24817 zip='$zip'
24818 EOT
24819
24820 : add special variables
24821 $test -f $src/patchlevel.h && \
24822 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
24823 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
24824 echo "PERL_CONFIG_SH=true" >>config.sh
24825
24826 : propagate old symbols
24827 if $test -f UU/config.sh; then
24828         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
24829         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
24830                 config.sh config.sh UU/oldconfig.sh |\
24831                 $sort | $uniq -u >UU/oldsyms
24832         set X `$cat UU/oldsyms`
24833         shift
24834         case $# in
24835         0) ;;
24836         *)
24837                 $cat <<EOM
24838 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
24839 EOM
24840                 echo ": Variables propagated from previous config.sh file." >>config.sh
24841                 for sym in `$cat UU/oldsyms`; do
24842                         echo "    Propagating $hint variable "'$'"$sym..."
24843                         eval 'tmp="$'"${sym}"'"'
24844                         echo "$tmp" | \
24845                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
24846                 done
24847                 ;;
24848         esac
24849 fi
24850
24851 : preserve RCS keywords in files with variable substitution, grrr
24852 Id='$Id'
24853
24854 : Finish up by extracting the .SH files
24855 case "$alldone" in
24856 exit)
24857         $rm -rf UU
24858         echo "Extraction done."
24859         exit 0
24860         ;;
24861 cont)
24862         ;;
24863 '')
24864         dflt=''
24865         nostick=true
24866         $cat <<EOM
24867
24868 If you'd like to make any changes to the config.sh file before I begin
24869 to configure things, do it as a shell escape now (e.g. !vi config.sh).
24870
24871 EOM
24872         rp="Press return or use a shell escape to edit config.sh:"
24873         . UU/myread
24874         nostick=''
24875         case "$ans" in
24876         '') ;;
24877         *) : in case they cannot read
24878                 sh 1>&4 -c "$ans";;
24879         esac
24880         ;;
24881 esac
24882
24883 : if this fails, just run all the .SH files by hand
24884 . ./config.sh
24885
24886 echo " "
24887 exec 1>&4
24888 pwd=`pwd`
24889 . ./UU/extract
24890 cd "$pwd"
24891
24892 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
24893         dflt=y
24894         case "$silent" in
24895         true) ;;
24896         *)
24897                 $cat <<EOM
24898
24899 Now you need to generate make dependencies by running "$make depend".
24900 You might prefer to run it in background: "$make depend > makedepend.out &"
24901 It can take a while, so you might not want to run it right now.
24902
24903 EOM
24904                 ;;
24905         esac
24906         rp="Run $make depend now?"
24907         . UU/myread
24908         case "$ans" in
24909         y*)
24910                 $make depend && echo "Now you must run '$make'."
24911                 ;;
24912         *)
24913                 echo "You must run '$make depend' then '$make'."
24914                 ;;
24915         esac
24916 elif test -f [Mm]akefile; then
24917         echo " "
24918         echo "Now you must run a $make."
24919 else
24920         echo "Configure done."
24921 fi
24922
24923 if $test -f Policy.sh; then
24924     $cat <<EOM
24925
24926 If you compile $package on a different machine or from a different object
24927 directory, copy the Policy.sh file from this object directory to the
24928 new one before you run Configure -- this will help you with most of
24929 the policy defaults.
24930
24931 EOM
24932 fi
24933 if $test -f config.msg; then
24934     echo "Hmm.  I also noted the following information while running:"
24935     echo " "
24936     $cat config.msg >&4
24937     $rm -f config.msg
24938 fi
24939 $rm -f kit*isdone ark*isdone
24940 $rm -rf UU
24941
24942 : End of Configure
24943