This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
0a405d39fafd7ff9071d2031eab69646fd3a3a09
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # Note: this Configure script was generated automatically by the tool
15 # called "metaconfig". Rather than working with this copy of Configure,
16 # you may wish to get metaconfig. Perl uses a modified version of this
17 # tool, available in the "dist" folder in the checkout of the git repo
18 #    $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
19 # The original dist package (including metaconfig) is available via SVN:
20 #    $ svn co https://svn.code.sf.net/p/dist/code/trunk/dist
21 #
22 # Though this script was generated by metaconfig from metaunits, it is
23 # OK to send patches against Configure itself. It's up to the Configure
24 # pumpkin to backport the patch to the metaunits if it is accepted.
25 # For more information on patching Configure, see pod/perlhack.pod
26 #
27 # The metaunits are also available from the public git repository:
28 #     http://perl5.git.perl.org/metaconfig.git/ or
29 #     $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
30 #
31 # See Porting/pumpkin.pod for more information on metaconfig.
32
33 # Generated using [metaconfig 3.5 PL0]
34 # (with additional metaconfig patches by perlbug@perl.org)
35
36 cat >c1$$ <<EOF
37 ARGGGHHHH!!!!!
38
39 SCO csh still thinks true is false.  Write to SCO today and tell them that next
40 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
41
42 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
43 we'd have to do is go in and swap the && and || tokens, wherever they are.)
44
45 [End of diatribe. We now return you to your regularly scheduled programming...]
46 EOF
47 cat >c2$$ <<EOF
48
49 OOPS!  You naughty creature!  You didn't run Configure with sh!
50 I will attempt to remedy the situation by running sh for you...
51 EOF
52
53 true || cat c1$$ c2$$
54 true || exec sh $0 $argv:q
55
56 (exit $?0) || cat c2$$
57 (exit $?0) || exec sh $0 $argv:q
58 rm -f c1$$ c2$$
59
60 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
61         cat <<EOF
62 ***
63 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
64 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
65 *** Please read the README.plan9 for further instructions.
66 *** Cannot continue, aborting.
67 ***
68 EOF
69         exit 1
70 fi
71
72 if test ! -c /dev/null ; then
73         cat <<EOF
74 ***
75 *** I'm sorry, but /dev/null appears to be a file rather than a device.
76 *** Please consult your operating sytem's notes for making a device
77 *** in /dev.
78 *** Cannot continue, aborting.
79 ***
80 EOF
81         exit 1
82 fi
83
84 : compute my invocation name
85 me=$0
86 case "$0" in
87 */*)
88         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
89         test "$me" || me=$0
90         ;;
91 esac
92
93 : Proper separator for the PATH environment variable
94 p_=:
95 : On OS/2 this directory should exist if this is not floppy only system ":-]"
96 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' 2>&1 ) 2>&1 >/dev/null ; then
97         if test -n "$OS2_SHELL"; then
98                 p_=\;
99                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
100                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
101                 is_os2=yes
102         elif test -n "$DJGPP"; then
103                 case "X${MACHTYPE:-nonesuchmach}" in
104                 *cygwin|*msys) ;;
105                 *) p_=\; ;;
106                 esac
107         fi
108 fi
109
110 : Proper PATH setting
111 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
112 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
113 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
114 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
115 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
116 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
117 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
118 paths="$paths /sbin /usr/sbin /usr/libexec"
119 paths="$paths /system/gnu_library/bin"
120
121 for p in $paths
122 do
123         case "$p_$PATH$p_" in
124         *$p_$p$p_*) ;;
125         *) test -d $p && PATH=$PATH$p_$p ;;
126         esac
127 done
128
129 PATH=.$p_$PATH
130 export PATH
131
132 : shall we be using ksh?
133 inksh=''
134 needksh=''
135 avoidksh=''
136 newsh=/bin/ksh
137 changesh=''
138 if (PATH=.; alias -x) >/dev/null 2>&1; then
139                 inksh=true
140 fi
141 if test -f /hp-ux -a -f /bin/ksh; then
142         needksh='to avoid sh bug in "here document" expansion'
143 fi
144 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
145         if test X`/usr/bin/uname -v` = X4; then
146                 avoidksh="to avoid AIX 4's /bin/sh"
147                 newsh=/usr/bin/bsh
148         fi
149 fi
150 if test -f /osf_boot -a -f /usr/sbin/setld; then
151         if test X`/usr/bin/uname -s` = XOSF1; then
152                 avoidksh="to avoid Digital UNIX' ksh"
153                 newsh=/bin/sh
154                 unset BIN_SH
155         fi
156 fi
157 case "$inksh/$needksh" in
158 /[a-z]*)
159                 ENV=''
160                 changesh=true
161                 reason="$needksh"
162         ;;
163 esac
164 case "$inksh/$avoidksh" in
165 true/[a-z]*)
166         changesh=true
167         reason="$avoidksh"
168         ;;
169 esac
170 case "$inksh/$needksh-$avoidksh-" in
171 true/--)
172                 cat <<EOM
173 (I see you are using the Korn shell.  Some ksh's blow up on $me,
174 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
175 EOM
176         ;;
177 esac
178 case "$changesh" in
179 true)
180         export newsh
181         echo "(Feeding myself to $newsh $reason.)"
182         case "$0" in
183         Configure|*/Configure) exec $newsh $0 "$@";;
184         *) exec $newsh Configure "$@";;
185         esac
186         ;;
187 esac
188 test -x "${newsh}" || unset newsh
189
190 : if needed, set CDPATH to a harmless value that is not chatty
191 : avoid bash 2.02 problems with empty CDPATH.
192 case "$CDPATH" in
193 '')     ;;
194 *)      case "$SHELL" in
195         *bash*) CDPATH='.' ;;
196         *) CDPATH='' ;;
197         esac
198         ;;
199 esac
200
201 : Configure runs within the UU subdirectory
202 test -d UU || mkdir UU
203 cd UU && rm -f ./*
204
205 ccname=''
206 ccversion=''
207 ccsymbols=''
208 cppccsymbols=''
209 cppsymbols=''
210 from=''
211 hostgenerate=''
212 hostosname=''
213 hostperl=''
214 run=''
215 targetarch=''
216 targetdir=''
217 targetenv=''
218 targethost=''
219 targetmkdir=''
220 targetport=''
221 to=''
222 usecrosscompile=''
223 extern_C=''
224 mistrustnm=''
225 usedevel=''
226 perllibs=''
227 dynamic_ext=''
228 extensions=''
229 known_extensions=''
230 nonxs_ext=''
231 static_ext=''
232 useopcode=''
233 useposix=''
234 extras=''
235 d_bsd=''
236 d_eunice=''
237 d_xenix=''
238 eunicefix=''
239 ar=''
240 awk=''
241 bash=''
242 bison=''
243 byacc=''
244 cat=''
245 chgrp=''
246 chmod=''
247 chown=''
248 comm=''
249 compress=''
250 cp=''
251 cpio=''
252 cpp=''
253 csh=''
254 date=''
255 echo=''
256 egrep=''
257 emacs=''
258 expr=''
259 find=''
260 flex=''
261 gmake=''
262 grep=''
263 gzip=''
264 inews=''
265 ksh=''
266 less=''
267 line=''
268 lint=''
269 ln=''
270 lp=''
271 lpr=''
272 ls=''
273 mail=''
274 mailx=''
275 make=''
276 mkdir=''
277 more=''
278 mv=''
279 nm=''
280 nroff=''
281 perl=''
282 pg=''
283 pmake=''
284 pr=''
285 rm=''
286 rmail=''
287 sed=''
288 sendmail=''
289 shar=''
290 sleep=''
291 smail=''
292 sort=''
293 submit=''
294 tail=''
295 tar=''
296 tbl=''
297 tee=''
298 test=''
299 touch=''
300 tr=''
301 troff=''
302 uname=''
303 uniq=''
304 uuname=''
305 vi=''
306 zcat=''
307 zip=''
308 full_ar=''
309 full_sed=''
310 libswanted=''
311 hint=''
312 myuname=''
313 osname=''
314 osvers=''
315 Author=''
316 Date=''
317 Header=''
318 Id=''
319 Locker=''
320 Log=''
321 RCSfile=''
322 Revision=''
323 Source=''
324 State=''
325 sysroot=''
326 _a=''
327 _exe=''
328 _o=''
329 archobjs=''
330 exe_ext=''
331 firstmakefile=''
332 lib_ext=''
333 obj_ext=''
334 path_sep=''
335 rm_try=''
336 afs=''
337 afsroot=''
338 alignbytes=''
339 ansi2knr=''
340 archlib=''
341 archlibexp=''
342 d_archlib=''
343 installarchlib=''
344 archname=''
345 myarchname=''
346 useversionedarchname=''
347 d_atolf=''
348 d_atoll=''
349 baserev=''
350 bin=''
351 binexp=''
352 initialinstalllocation=''
353 installbin=''
354 userelocatableinc=''
355 byteorder=''
356 cc=''
357 ccflags=''
358 cppflags=''
359 ldflags=''
360 lkflags=''
361 locincpth=''
362 optimize=''
363 cf_email=''
364 cf_by=''
365 cf_time=''
366 charbits=''
367 charsize=''
368 contains=''
369 cpp_stuff=''
370 cpplast=''
371 cppminus=''
372 cpprun=''
373 cppstdin=''
374 d__fwalk=''
375 d_access=''
376 d_accessx=''
377 d_acosh=''
378 d_aintl=''
379 d_alarm=''
380 asctime_r_proto=''
381 d_asctime_r=''
382 d_asinh=''
383 d_atanh=''
384 d_attribute_deprecated=''
385 d_attribute_format=''
386 d_attribute_malloc=''
387 d_attribute_nonnull=''
388 d_attribute_noreturn=''
389 d_attribute_pure=''
390 d_attribute_unused=''
391 d_attribute_warn_unused_result=''
392 d_printf_format_null=''
393 d_backtrace=''
394 d_bcmp=''
395 d_bcopy=''
396 d_builtin_choose_expr=''
397 d_builtin_expect=''
398 d_bzero=''
399 d_c99_variadic_macros=''
400 d_casti32=''
401 castflags=''
402 d_castneg=''
403 d_cbrt=''
404 d_chown=''
405 d_chroot=''
406 d_chsize=''
407 d_class=''
408 d_clearenv=''
409 d_closedir=''
410 d_void_closedir=''
411 d_cmsghdr_s=''
412 d_const=''
413 d_copysign=''
414 d_copysignl=''
415 d_cplusplus=''
416 cryptlib=''
417 d_crypt=''
418 crypt_r_proto=''
419 d_crypt_r=''
420 d_csh=''
421 full_csh=''
422 d_ctermid=''
423 ctermid_r_proto=''
424 d_ctermid_r=''
425 ctime_r_proto=''
426 d_ctime_r=''
427 d_cuserid=''
428 d_dbl_dig=''
429 d_dbminitproto=''
430 d_difftime=''
431 d_dir_dd_fd=''
432 d_dirfd=''
433 d_dladdr=''
434 d_dlerror=''
435 d_dlopen=''
436 d_dlsymun=''
437 d_dosuid=''
438 d_suidsafe=''
439 d_drand48_r=''
440 drand48_r_proto=''
441 d_drand48proto=''
442 d_dup2=''
443 d_eaccess=''
444 d_endgrent=''
445 d_endgrent_r=''
446 endgrent_r_proto=''
447 d_endhent=''
448 d_endhostent_r=''
449 endhostent_r_proto=''
450 d_endnent=''
451 d_endnetent_r=''
452 endnetent_r_proto=''
453 d_endpent=''
454 d_endprotoent_r=''
455 endprotoent_r_proto=''
456 d_endpwent=''
457 d_endpwent_r=''
458 endpwent_r_proto=''
459 d_endsent=''
460 d_endservent_r=''
461 endservent_r_proto=''
462 d_erf=''
463 d_erfc=''
464 d_exp2=''
465 d_expm1=''
466 d_faststdio=''
467 d_fchdir=''
468 d_fchmod=''
469 d_fchown=''
470 d_fcntl=''
471 d_fcntl_can_lock=''
472 d_fd_macros=''
473 d_fd_set=''
474 d_fds_bits=''
475 d_fdim=''
476 d_fegetround=''
477 d_fgetpos=''
478 d_finite=''
479 d_finitel=''
480 d_flexfnam=''
481 d_flock=''
482 d_flockproto=''
483 d_fma=''
484 d_fmax=''
485 d_fmin=''
486 d_fork=''
487 d_fp_class=''
488 d_fp_classl=''
489 d_fpclass=''
490 d_fp_classify=''
491 d_fpclassify=''
492 d_fpclassl=''
493 d_fpgetround=''
494 d_fpos64_t=''
495 d_frexpl=''
496 d_fs_data_s=''
497 d_fseeko=''
498 d_fsetpos=''
499 d_fstatfs=''
500 d_fsync=''
501 d_ftello=''
502 d_ftime=''
503 d_gettimeod=''
504 d_futimes=''
505 d_Gconvert=''
506 d_getaddrinfo=''
507 d_getcwd=''
508 d_getespwnam=''
509 d_getfsstat=''
510 d_getgrent=''
511 d_getgrent_r=''
512 getgrent_r_proto=''
513 d_getgrgid_r=''
514 getgrgid_r_proto=''
515 d_getgrnam_r=''
516 getgrnam_r_proto=''
517 d_getgrps=''
518 d_gethbyaddr=''
519 d_gethbyname=''
520 d_gethent=''
521 aphostname=''
522 d_gethname=''
523 d_phostname=''
524 d_uname=''
525 d_gethostbyaddr_r=''
526 gethostbyaddr_r_proto=''
527 d_gethostbyname_r=''
528 gethostbyname_r_proto=''
529 d_gethostent_r=''
530 gethostent_r_proto=''
531 d_gethostprotos=''
532 d_getitimer=''
533 d_getlogin=''
534 d_getlogin_r=''
535 getlogin_r_proto=''
536 d_getmnt=''
537 d_getmntent=''
538 d_getnameinfo=''
539 d_getnbyaddr=''
540 d_getnbyname=''
541 d_getnent=''
542 d_getnetbyaddr_r=''
543 getnetbyaddr_r_proto=''
544 d_getnetbyname_r=''
545 getnetbyname_r_proto=''
546 d_getnetent_r=''
547 getnetent_r_proto=''
548 d_getnetprotos=''
549 d_getpagsz=''
550 d_getpent=''
551 d_getpgid=''
552 d_getpgrp2=''
553 d_bsdgetpgrp=''
554 d_getpgrp=''
555 d_getppid=''
556 d_getprior=''
557 d_getpbyname=''
558 d_getpbynumber=''
559 d_getprotobyname_r=''
560 getprotobyname_r_proto=''
561 d_getprotobynumber_r=''
562 getprotobynumber_r_proto=''
563 d_getprotoent_r=''
564 getprotoent_r_proto=''
565 d_getprotoprotos=''
566 d_getprpwnam=''
567 d_getpwent=''
568 d_getpwent_r=''
569 getpwent_r_proto=''
570 d_getpwnam_r=''
571 getpwnam_r_proto=''
572 d_getpwuid_r=''
573 getpwuid_r_proto=''
574 d_getsent=''
575 d_getservbyname_r=''
576 getservbyname_r_proto=''
577 d_getservbyport_r=''
578 getservbyport_r_proto=''
579 d_getservent_r=''
580 getservent_r_proto=''
581 d_getservprotos=''
582 d_getspnam=''
583 d_getspnam_r=''
584 getspnam_r_proto=''
585 d_getsbyname=''
586 d_getsbyport=''
587 d_gmtime_r=''
588 gmtime_r_proto=''
589 d_gnulibc=''
590 gnulibc_version=''
591 d_hasmntopt=''
592 d_htonl=''
593 d_hypot=''
594 d_ilogb=''
595 d_ilogbl=''
596 d_inetaton=''
597 d_inetntop=''
598 d_inetpton=''
599 d_int64_t=''
600 d_isascii=''
601 d_isblank=''
602 d_isfinite=''
603 d_isfinitel=''
604 d_isinf=''
605 d_isinfl=''
606 d_isless=''
607 d_isnan=''
608 d_isnanl=''
609 d_isnormal=''
610 d_j0=''
611 d_j0l=''
612 d_killpg=''
613 d_lc_monetary_2008=''
614 d_lchown=''
615 d_ldbl_dig=''
616 d_lgamma=''
617 d_lgamma_r=''
618 d_libm_lib_version=''
619 d_link=''
620 d_llrint=''
621 d_llrintl=''
622 d_llround=''
623 d_llroundl=''
624 d_localtime_r=''
625 d_localtime_r_needs_tzset=''
626 localtime_r_proto=''
627 d_locconv=''
628 d_lockf=''
629 d_log1p=''
630 d_log2=''
631 d_logb=''
632 d_ldexpl=''
633 d_longdbl=''
634 longdblkind=''
635 longdblsize=''
636 d_longlong=''
637 longlongsize=''
638 d_lrint=''
639 d_lrintl=''
640 d_lround=''
641 d_lroundl=''
642 d_lseekproto=''
643 d_lstat=''
644 d_madvise=''
645 d_malloc_good_size=''
646 d_malloc_size=''
647 d_mblen=''
648 d_mbstowcs=''
649 d_mbtowc=''
650 d_memchr=''
651 d_memcmp=''
652 d_memcpy=''
653 d_memmove=''
654 d_memset=''
655 d_mkdir=''
656 d_mkdtemp=''
657 d_mkfifo=''
658 d_mkstemp=''
659 d_mkstemps=''
660 d_mktime=''
661 d_mmap=''
662 mmaptype=''
663 d_modfl=''
664 d_modfl_pow32_bug=''
665 d_modflproto=''
666 d_mprotect=''
667 d_msg=''
668 d_msgctl=''
669 d_msgget=''
670 d_msghdr_s=''
671 d_msgrcv=''
672 d_msgsnd=''
673 d_msync=''
674 d_munmap=''
675 d_nan=''
676 d_nearbyint=''
677 d_nextafter=''
678 d_nexttoward=''
679 d_nice=''
680 d_nl_langinfo=''
681 d_off64_t=''
682 d_open3=''
683 d_fpathconf=''
684 d_pathconf=''
685 d_pause=''
686 d_pipe=''
687 d_poll=''
688 d_portable=''
689 d_prctl=''
690 d_prctl_set_name=''
691 d_procselfexe=''
692 procselfexe=''
693 d_old_pthread_create_joinable=''
694 old_pthread_create_joinable=''
695 d_pthread_atfork=''
696 d_pthread_attr_setscope=''
697 d_pthread_yield=''
698 d_sched_yield=''
699 sched_yield=''
700 d_ptrdiff_t=''
701 d_qgcvt=''
702 d_random_r=''
703 random_r_proto=''
704 d_readdir64_r=''
705 readdir64_r_proto=''
706 d_readdir=''
707 d_rewinddir=''
708 d_seekdir=''
709 d_telldir=''
710 d_readdir_r=''
711 readdir_r_proto=''
712 d_readlink=''
713 d_readv=''
714 d_recvmsg=''
715 d_re_comp=''
716 d_regcmp=''
717 d_regcomp=''
718 d_remainder=''
719 d_remquo=''
720 d_rename=''
721 d_rint=''
722 d_rmdir=''
723 d_round=''
724 d_safebcpy=''
725 d_safemcpy=''
726 d_sanemcmp=''
727 d_sbrkproto=''
728 d_scalbn=''
729 d_scalbnl=''
730 d_select=''
731 d_sem=''
732 d_semctl=''
733 d_semget=''
734 d_semop=''
735 d_sendmsg=''
736 d_setegid=''
737 d_seteuid=''
738 d_setgrent=''
739 d_setgrent_r=''
740 setgrent_r_proto=''
741 d_setgrps=''
742 d_sethent=''
743 d_sethostent_r=''
744 sethostent_r_proto=''
745 d_setitimer=''
746 d_setlinebuf=''
747 d_setlocale=''
748 d_setlocale_r=''
749 setlocale_r_proto=''
750 d_setnent=''
751 d_setnetent_r=''
752 setnetent_r_proto=''
753 d_setpent=''
754 d_setpgid=''
755 d_setpgrp2=''
756 d_bsdsetpgrp=''
757 d_setpgrp=''
758 d_setprior=''
759 d_setproctitle=''
760 d_setprotoent_r=''
761 setprotoent_r_proto=''
762 d_setpwent=''
763 d_setpwent_r=''
764 setpwent_r_proto=''
765 d_setregid=''
766 d_setresgid=''
767 d_setresuid=''
768 d_setreuid=''
769 d_setrgid=''
770 d_setruid=''
771 d_setsent=''
772 d_setservent_r=''
773 setservent_r_proto=''
774 d_setsid=''
775 d_setvbuf=''
776 d_shm=''
777 d_shmat=''
778 d_shmatprototype=''
779 shmattype=''
780 d_shmctl=''
781 d_shmdt=''
782 d_shmget=''
783 d_sigaction=''
784 d_signbit=''
785 d_sigprocmask=''
786 d_sigsetjmp=''
787 usesitecustomize=''
788 d_snprintf=''
789 d_vsnprintf=''
790 d_sockatmark=''
791 d_sockatmarkproto=''
792 d_ip_mreq=''
793 d_ip_mreq_source=''
794 d_ipv6_mreq=''
795 d_ipv6_mreq_source=''
796 d_msg_ctrunc=''
797 d_msg_dontroute=''
798 d_msg_oob=''
799 d_msg_peek=''
800 d_msg_proxy=''
801 d_oldsock=''
802 d_scm_rights=''
803 d_sin6_scope_id=''
804 d_sockaddr_in6=''
805 d_sockaddr_sa_len=''
806 d_socket=''
807 d_sockpair=''
808 sockethdr=''
809 socketlib=''
810 d_socklen_t=''
811 d_socks5_init=''
812 d_sprintf_returns_strlen=''
813 d_sqrtl=''
814 d_srand48_r=''
815 srand48_r_proto=''
816 d_srandom_r=''
817 srandom_r_proto=''
818 d_sresgproto=''
819 d_sresuproto=''
820 d_stat=''
821 d_statblks=''
822 d_statfs_f_flags=''
823 d_statfs_s=''
824 d_static_inline=''
825 perl_static_inline=''
826 d_fstatvfs=''
827 d_statvfs=''
828 d_stdio_cnt_lval=''
829 d_stdio_ptr_lval=''
830 d_stdio_ptr_lval_nochange_cnt=''
831 d_stdio_ptr_lval_sets_cnt=''
832 d_stdiobase=''
833 d_stdstdio=''
834 stdio_base=''
835 stdio_bufsiz=''
836 stdio_cnt=''
837 stdio_filbuf=''
838 stdio_ptr=''
839 d_index=''
840 d_strchr=''
841 d_strcoll=''
842 d_strctcpy=''
843 d_strerrm=''
844 d_strerror=''
845 d_sysernlst=''
846 d_syserrlst=''
847 d_strerror_r=''
848 strerror_r_proto=''
849 d_strftime=''
850 d_strlcat=''
851 d_strlcpy=''
852 d_strtod=''
853 d_strtol=''
854 d_strtold=''
855 d_strtoll=''
856 d_strtoq=''
857 d_strtoul=''
858 d_strtoull=''
859 d_strtouq=''
860 d_strxfrm=''
861 d_symlink=''
862 d_syscall=''
863 d_syscallproto=''
864 d_sysconf=''
865 d_system=''
866 d_tcgetpgrp=''
867 d_tcsetpgrp=''
868 d_telldirproto=''
869 d_tgamma=''
870 d_time=''
871 timetype=''
872 d_asctime64=''
873 d_ctime64=''
874 d_difftime64=''
875 d_gmtime64=''
876 d_localtime64=''
877 d_mktime64=''
878 d_timegm=''
879 clocktype=''
880 d_times=''
881 d_tmpnam_r=''
882 tmpnam_r_proto=''
883 d_trunc=''
884 d_truncate=''
885 d_truncl=''
886 d_ttyname_r=''
887 ttyname_r_proto=''
888 d_tzname=''
889 d_u32align=''
890 d_ualarm=''
891 d_umask=''
892 d_semctl_semid_ds=''
893 d_semctl_semun=''
894 d_union_semun=''
895 d_unordered=''
896 d_unsetenv=''
897 d_usleep=''
898 d_usleepproto=''
899 d_ustat=''
900 d_pseudofork=''
901 d_vfork=''
902 usevfork=''
903 d_voidsig=''
904 signal_t=''
905 d_volatile=''
906 d_charvspr=''
907 d_vprintf=''
908 d_wait4=''
909 d_waitpid=''
910 d_wcscmp=''
911 d_wcstombs=''
912 d_wcsxfrm=''
913 d_wctomb=''
914 d_writev=''
915 dlext=''
916 bin_ELF=''
917 cccdlflags=''
918 ccdlflags=''
919 dlsrc=''
920 ld=''
921 ld_can_script=''
922 lddlflags=''
923 usedl=''
924 doublesize=''
925 ebcdic=''
926 fflushNULL=''
927 fflushall=''
928 fpossize=''
929 fpostype=''
930 gccansipedantic=''
931 gccosandvers=''
932 gccversion=''
933 gidformat=''
934 gidsign=''
935 gidsize=''
936 gidtype=''
937 groupstype=''
938 h_fcntl=''
939 h_sysfile=''
940 html1dir=''
941 html1direxp=''
942 installhtml1dir=''
943 html3dir=''
944 html3direxp=''
945 installhtml3dir=''
946 i_arpainet=''
947 i_assert=''
948 i_bfd=''
949 i_crypt=''
950 db_hashtype=''
951 db_prefixtype=''
952 db_version_major=''
953 db_version_minor=''
954 db_version_patch=''
955 i_db=''
956 i_dbm=''
957 i_rpcsvcdbm=''
958 d_dirnamlen=''
959 direntrytype=''
960 i_dirent=''
961 i_dlfcn=''
962 i_execinfo=''
963 i_fcntl=''
964 i_fenv=''
965 i_float=''
966 i_fp=''
967 i_fp_class=''
968 i_gdbm=''
969 d_grpasswd=''
970 i_grp=''
971 i_ieeefp=''
972 i_inttypes=''
973 i_langinfo=''
974 i_libutil=''
975 i_limits=''
976 i_locale=''
977 i_machcthr=''
978 i_malloc=''
979 i_mallocmalloc=''
980 i_math=''
981 i_memory=''
982 i_mntent=''
983 d_gdbm_ndbm_h_uses_prototypes=''
984 d_gdbmndbm_h_uses_prototypes=''
985 d_ndbm=''
986 d_ndbm_h_uses_prototypes=''
987 i_gdbm_ndbm=''
988 i_gdbmndbm=''
989 i_ndbm=''
990 i_netdb=''
991 i_neterrno=''
992 i_netinettcp=''
993 i_niin=''
994 i_sysin=''
995 i_poll=''
996 i_prot=''
997 i_pthread=''
998 d_pwage=''
999 d_pwchange=''
1000 d_pwclass=''
1001 d_pwcomment=''
1002 d_pwexpire=''
1003 d_pwgecos=''
1004 d_pwpasswd=''
1005 d_pwquota=''
1006 i_pwd=''
1007 i_quadmath=''
1008 i_shadow=''
1009 i_socks=''
1010 i_stdbool=''
1011 i_stddef=''
1012 i_stdint=''
1013 i_stdlib=''
1014 i_string=''
1015 strings=''
1016 i_sunmath=''
1017 i_sysaccess=''
1018 i_sysdir=''
1019 i_sysfile=''
1020 d_voidtty=''
1021 i_bsdioctl=''
1022 i_sysfilio=''
1023 i_sysioctl=''
1024 i_syssockio=''
1025 i_syslog=''
1026 i_sysmman=''
1027 i_sysmode=''
1028 i_sysmount=''
1029 i_sysndir=''
1030 i_sysparam=''
1031 i_syspoll=''
1032 i_sysresrc=''
1033 i_syssecrt=''
1034 i_sysselct=''
1035 i_sysstat=''
1036 i_sysstatfs=''
1037 i_sysstatvfs=''
1038 i_systimes=''
1039 i_systypes=''
1040 i_sysuio=''
1041 i_sysun=''
1042 i_sysutsname=''
1043 i_sysvfs=''
1044 i_syswait=''
1045 i_sgtty=''
1046 i_termio=''
1047 i_termios=''
1048 d_tm_tm_gmtoff=''
1049 d_tm_tm_zone=''
1050 i_systime=''
1051 i_systimek=''
1052 i_time=''
1053 timeincl=''
1054 i_unistd=''
1055 i_ustat=''
1056 i_utime=''
1057 i_values=''
1058 i_stdarg=''
1059 i_varargs=''
1060 i_varhdr=''
1061 i_vfork=''
1062 d_inc_version_list=''
1063 inc_version_list=''
1064 inc_version_list_init=''
1065 installprefix=''
1066 installprefixexp=''
1067 installstyle=''
1068 installusrbinperl=''
1069 intsize=''
1070 longsize=''
1071 shortsize=''
1072 issymlink=''
1073 libc=''
1074 ldlibpthname=''
1075 libperl=''
1076 shrpenv=''
1077 useshrplib=''
1078 glibpth=''
1079 incpth=''
1080 libpth=''
1081 loclibpth=''
1082 plibpth=''
1083 xlibpth=''
1084 ignore_versioned_solibs=''
1085 libs=''
1086 libsdirs=''
1087 libsfiles=''
1088 libsfound=''
1089 libspath=''
1090 lns=''
1091 d_PRIEUldbl=''
1092 d_PRIFUldbl=''
1093 d_PRIGUldbl=''
1094 d_PRIeldbl=''
1095 d_PRIfldbl=''
1096 d_PRIgldbl=''
1097 d_SCNfldbl=''
1098 doublekind=''
1099 sPRIEUldbl=''
1100 sPRIFUldbl=''
1101 sPRIGUldbl=''
1102 sPRIeldbl=''
1103 sPRIfldbl=''
1104 sPRIgldbl=''
1105 sSCNfldbl=''
1106 lseeksize=''
1107 lseektype=''
1108 make_set_make=''
1109 d_mymalloc=''
1110 freetype=''
1111 mallocobj=''
1112 mallocsrc=''
1113 malloctype=''
1114 usemallocwrap=''
1115 usemymalloc=''
1116 installman1dir=''
1117 man1dir=''
1118 man1direxp=''
1119 man1ext=''
1120 installman3dir=''
1121 man3dir=''
1122 man3direxp=''
1123 man3ext=''
1124 modetype=''
1125 multiarch=''
1126 mydomain=''
1127 myhostname=''
1128 phostname=''
1129 c=''
1130 n=''
1131 d_eofnblk=''
1132 eagain=''
1133 o_nonblock=''
1134 rd_nodata=''
1135 need_va_copy=''
1136 netdb_hlen_type=''
1137 netdb_host_type=''
1138 netdb_name_type=''
1139 netdb_net_type=''
1140 groupcat=''
1141 hostcat=''
1142 passcat=''
1143 orderlib=''
1144 ranlib=''
1145 d_perl_otherlibdirs=''
1146 otherlibdirs=''
1147 package=''
1148 spackage=''
1149 pager=''
1150 api_revision=''
1151 api_subversion=''
1152 api_version=''
1153 api_versionstring=''
1154 patchlevel=''
1155 perl_patchlevel=''
1156 revision=''
1157 subversion=''
1158 version=''
1159 version_patchlevel_string=''
1160 perl5=''
1161 perladmin=''
1162 perlpath=''
1163 d_nv_preserves_uv=''
1164 d_nv_zero_is_allbits_zero=''
1165 i16size=''
1166 i16type=''
1167 i32size=''
1168 i32type=''
1169 i64size=''
1170 i64type=''
1171 i8size=''
1172 i8type=''
1173 ivsize=''
1174 ivtype=''
1175 nv_overflows_integers_at=''
1176 nv_preserves_uv_bits=''
1177 nvsize=''
1178 nvtype=''
1179 u16size=''
1180 u16type=''
1181 u32size=''
1182 u32type=''
1183 u64size=''
1184 u64type=''
1185 u8size=''
1186 u8type=''
1187 uvsize=''
1188 uvtype=''
1189 ivdformat=''
1190 nvEUformat=''
1191 nvFUformat=''
1192 nvGUformat=''
1193 nveformat=''
1194 nvfformat=''
1195 nvgformat=''
1196 uvXUformat=''
1197 uvoformat=''
1198 uvuformat=''
1199 uvxformat=''
1200 pidtype=''
1201 prefix=''
1202 prefixexp=''
1203 installprivlib=''
1204 privlib=''
1205 privlibexp=''
1206 prototype=''
1207 ptrsize=''
1208 d_PRIXU64=''
1209 d_PRId64=''
1210 d_PRIi64=''
1211 d_PRIo64=''
1212 d_PRIu64=''
1213 d_PRIx64=''
1214 sPRIXU64=''
1215 sPRId64=''
1216 sPRIi64=''
1217 sPRIo64=''
1218 sPRIu64=''
1219 sPRIx64=''
1220 d_quad=''
1221 quadkind=''
1222 quadtype=''
1223 uquadtype=''
1224 drand01=''
1225 randbits=''
1226 randfunc=''
1227 randseedtype=''
1228 seedfunc=''
1229 installscript=''
1230 scriptdir=''
1231 scriptdirexp=''
1232 selectminbits=''
1233 selecttype=''
1234 sh=''
1235 targetsh=''
1236 sig_count=''
1237 sig_name=''
1238 sig_name_init=''
1239 sig_num=''
1240 sig_num_init=''
1241 sig_size=''
1242 d_sitearch=''
1243 installsitearch=''
1244 sitearch=''
1245 sitearchexp=''
1246 installsitebin=''
1247 sitebin=''
1248 sitebinexp=''
1249 installsitehtml1dir=''
1250 sitehtml1dir=''
1251 sitehtml1direxp=''
1252 installsitehtml3dir=''
1253 sitehtml3dir=''
1254 sitehtml3direxp=''
1255 installsitelib=''
1256 sitelib=''
1257 sitelib_stem=''
1258 sitelibexp=''
1259 installsiteman1dir=''
1260 siteman1dir=''
1261 siteman1direxp=''
1262 installsiteman3dir=''
1263 siteman3dir=''
1264 siteman3direxp=''
1265 siteprefix=''
1266 siteprefixexp=''
1267 installsitescript=''
1268 sitescript=''
1269 sitescriptexp=''
1270 sizesize=''
1271 sizetype=''
1272 d_libname_unique=''
1273 so=''
1274 socksizetype=''
1275 sharpbang=''
1276 shsharp=''
1277 spitshell=''
1278 src=''
1279 ssizetype=''
1280 st_ino_sign=''
1281 st_ino_size=''
1282 startperl=''
1283 startsh=''
1284 stdchar=''
1285 d_stdio_stream_array=''
1286 stdio_stream_array=''
1287 sysman=''
1288 sGMTIME_max=''
1289 sGMTIME_min=''
1290 sLOCALTIME_max=''
1291 sLOCALTIME_min=''
1292 trnl=''
1293 uidformat=''
1294 uidsign=''
1295 uidsize=''
1296 uidtype=''
1297 archname64=''
1298 use64bitall=''
1299 use64bitint=''
1300 usecbacktrace=''
1301 dtrace=''
1302 usedtrace=''
1303 usefaststdio=''
1304 usekernprocpathname=''
1305 ccflags_uselargefiles=''
1306 ldflags_uselargefiles=''
1307 libswanted_uselargefiles=''
1308 uselargefiles=''
1309 uselongdouble=''
1310 usemorebits=''
1311 usemultiplicity=''
1312 nm_opt=''
1313 nm_so_opt=''
1314 runnm=''
1315 usenm=''
1316 usensgetexecutablepath=''
1317 useperlio=''
1318 usequadmath=''
1319 usesocks=''
1320 d_oldpthreads=''
1321 use5005threads=''
1322 useithreads=''
1323 usereentrant=''
1324 usethreads=''
1325 incpath=''
1326 mips_type=''
1327 usrinc=''
1328 vaproto=''
1329 d_vendorarch=''
1330 installvendorarch=''
1331 vendorarch=''
1332 vendorarchexp=''
1333 d_vendorbin=''
1334 installvendorbin=''
1335 vendorbin=''
1336 vendorbinexp=''
1337 installvendorhtml1dir=''
1338 vendorhtml1dir=''
1339 vendorhtml1direxp=''
1340 installvendorhtml3dir=''
1341 vendorhtml3dir=''
1342 vendorhtml3direxp=''
1343 d_vendorlib=''
1344 installvendorlib=''
1345 vendorlib=''
1346 vendorlib_stem=''
1347 vendorlibexp=''
1348 installvendorman1dir=''
1349 vendorman1dir=''
1350 vendorman1direxp=''
1351 installvendorman3dir=''
1352 vendorman3dir=''
1353 vendorman3direxp=''
1354 usevendorprefix=''
1355 vendorprefix=''
1356 vendorprefixexp=''
1357 d_vendorscript=''
1358 installvendorscript=''
1359 vendorscript=''
1360 vendorscriptexp=''
1361 versiononly=''
1362 yacc=''
1363 yaccflags=''
1364 CONFIG=''
1365
1366 : Detect odd OSs
1367 define='define'
1368 undef='undef'
1369 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1370 rmlist=''
1371
1372 : We must find out about Eunice early
1373 eunicefix=':'
1374 if test -f /etc/unixtovms; then
1375         eunicefix=/etc/unixtovms
1376 fi
1377 if test -f /etc/unixtovms.exe; then
1378         eunicefix=/etc/unixtovms.exe
1379 fi
1380
1381 : Set executable suffix now -- needed before hints available
1382 if test -f "/libs/version.library"; then
1383 : Amiga OS
1384     _exe=""
1385 elif test -f "/system/gnu_library/bin/ar.pm"; then
1386 : Stratus VOS
1387     _exe=".pm"
1388 elif test -n "$DJGPP"; then
1389 : DOS DJGPP
1390     _exe=".exe"
1391 elif test -f /kern/cookiejar; then
1392 : MiNT
1393     _exe=""
1394 elif test -d c:/. -o -n "$is_os2" ; then
1395 : OS/2 or cygwin
1396     _exe=".exe"
1397 fi
1398
1399 groupstype=''
1400 i_whoami=''
1401 : Trailing extension.  Override this in a hint file, if needed.
1402 : Extra object files, if any, needed on this platform.
1403 archobjs=''
1404 archname=''
1405 : Possible local include directories to search.
1406 : Set locincpth to "" in a hint file to defeat local include searches.
1407 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1408 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1409 :
1410 : no include file wanted by default
1411 inclwanted=''
1412
1413 : Enable -DEBUGGING and -DDEBUGGING from the command line
1414 EBUGGING=''
1415 DEBUGGING=''
1416
1417 libnames=''
1418 : change the next line if compiling for Xenix/286 on Xenix/386
1419 xlibpth='/usr/lib/386 /lib/386'
1420 : Possible local library directories to search.
1421 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1422 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1423
1424 : general looking path for locating libraries
1425 glibpth="/lib /usr/lib $xlibpth"
1426 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1427 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1428 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1429 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1430
1431 : Private path used by Configure to find libraries.  Its value
1432 : is prepended to libpth. This variable takes care of special
1433 : machines, like the mips.  Usually, it should be empty.
1434 plibpth=''
1435
1436 : default library list
1437 libswanted=''
1438 : some systems want to use only the non-versioned libso:s
1439 ignore_versioned_solibs=''
1440 : set usethreads on the Configure command line to enable threads.
1441 usereentrant='undef'
1442 ccname=''
1443 ccversion=''
1444 perllibs=''
1445 : set useposix=false in your hint file to disable the POSIX extension.
1446 useposix=true
1447 : set useopcode=false in your hint file to disable the Opcode extension.
1448 useopcode=true
1449 archname64=''
1450 ccflags_uselargefiles=''
1451 ldflags_uselargefiles=''
1452 libswanted_uselargefiles=''
1453 : set usemultiplicity on the Configure command line to enable multiplicity.
1454 : set usesocks on the Configure command line to enable socks.
1455 : List of libraries we want.
1456 : If anyone needs extra -lxxx, put those in a hint file.
1457 libswanted="cl pthread socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld"
1458 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1459 : We probably want to search /usr/shlib before most other libraries.
1460 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1461 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1462 glibpth="/usr/shlib $glibpth"
1463 : Do not use vfork unless overridden by a hint file.
1464 usevfork=false
1465
1466 : Find the basic shell for Bourne shell scripts
1467 case "$sh" in
1468 '')
1469         case "$SYSTYPE" in
1470         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1471         *) xxx='/bin/sh';;
1472         esac
1473         if test -f "$xxx"; then
1474                 sh="$xxx"
1475         else
1476                 : Build up a list and do a single loop so we can 'break' out.
1477                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1478                 for xxx in sh bash ksh pdksh ash; do
1479                         for p in $pth; do
1480                                 try="$try ${p}/${xxx}"
1481                         done
1482                 done
1483                 for xxx in $try; do
1484                         if test -f "$xxx"; then
1485                                 sh="$xxx";
1486                                 break
1487                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1488                                 sh="$xxx";
1489                                 break
1490                         elif test -f "$xxx.exe"; then
1491                                 sh="$xxx";
1492                                 break
1493                         fi
1494                 done
1495         fi
1496         ;;
1497 esac
1498
1499 case "$sh" in
1500 '')     cat >&2 <<EOM
1501 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1502
1503 Usually it's in /bin/sh.  How did you even get this far?
1504 Please contact me (Perl Maintainers) at perlbug@perl.org and
1505 we'll try to straighten this all out.
1506 EOM
1507         exit 1
1508         ;;
1509 esac
1510
1511 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1512 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1513 targetsh=$sh
1514
1515 : see if sh knows # comments
1516 if `$sh -c '#' >/dev/null 2>&1`; then
1517         shsharp=true
1518         spitshell=cat
1519         xcat=/bin/cat
1520         test -f $xcat$_exe || xcat=/usr/bin/cat
1521         if test ! -f $xcat$_exe; then
1522                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1523                         if test -f $p/cat$_exe; then
1524                                 xcat=$p/cat
1525                                 break
1526                         fi
1527                 done
1528                 if test ! -f $xcat$_exe; then
1529                         echo "Can't find cat anywhere!"
1530                         exit 1
1531                 fi
1532         fi
1533         echo "#!$xcat" >sharp
1534         $eunicefix sharp
1535         chmod +x sharp
1536         ./sharp > today 2>/dev/null
1537         if test -s today; then
1538                 sharpbang='#!'
1539         else
1540                 echo "#! $xcat" > sharp
1541                 $eunicefix sharp
1542                 chmod +x sharp
1543                 ./sharp > today 2>/dev/null
1544                 if test -s today; then
1545                         sharpbang='#! '
1546                 else
1547                         sharpbang=': use '
1548                 fi
1549         fi
1550 else
1551         echo " "
1552         echo "Your $sh doesn't grok # comments--I will strip them later on."
1553         shsharp=false
1554         cd ..
1555         echo "exec grep -v '^[  ]*#'" >spitshell
1556         chmod +x spitshell
1557         $eunicefix spitshell
1558         spitshell=`pwd`/spitshell
1559         cd UU
1560         echo "I presume that if # doesn't work, #! won't work either!"
1561         sharpbang=': use '
1562 fi
1563 rm -f sharp today
1564
1565 : figure out how to guarantee sh startup
1566 case "$startsh" in
1567 '') startsh=${sharpbang}${sh} ;;
1568 *)
1569 esac
1570 cat >sharp <<EOSS
1571 $startsh
1572 set abc
1573 test "$?abc" != 1
1574 EOSS
1575
1576 chmod +x sharp
1577 $eunicefix sharp
1578 if ./sharp; then
1579         : echo "Yup, it does."
1580 else
1581         echo "Hmm... '$startsh' does not guarantee sh startup..."
1582         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1583 fi
1584 rm -f sharp
1585
1586 : Save command line options in file UU/cmdline.opt for later use in
1587 : generating config.sh.
1588 cat > cmdline.opt <<EOSH
1589 : Configure command line arguments.
1590 config_arg0='$0'
1591 config_args='$*'
1592 config_argc=$#
1593 EOSH
1594 argn=1
1595 args_exp=''
1596 args_sep=''
1597 for arg in "$@"; do
1598         cat >>cmdline.opt <<EOSH
1599 config_arg$argn='$arg'
1600 EOSH
1601         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1602 $arg
1603 EOC
1604         arg_exp=`cat cmdl.opt`
1605         args_exp="$args_exp$args_sep'$arg_exp'"
1606         argn=`expr $argn + 1`
1607         args_sep=' '
1608 done
1609 rm -f cmdl.opt
1610
1611 : produce awk script to parse command line options
1612 cat >options.awk <<'EOF'
1613 BEGIN {
1614         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1615
1616         len = length(optstr);
1617         for (i = 1; i <= len; i++) {
1618                 c = substr(optstr, i, 1);
1619                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1620                 if (a == ":") {
1621                         arg[c] = 1;
1622                         i++;
1623                 }
1624                 opt[c] = 1;
1625         }
1626 }
1627 {
1628         expect = 0;
1629         str = $0;
1630         if (substr(str, 1, 1) != "-") {
1631                 printf("'%s'\n", str);
1632                 next;
1633         }
1634         len = length($0);
1635         for (i = 2; i <= len; i++) {
1636                 c = substr(str, i, 1);
1637                 if (!opt[c]) {
1638                         printf("-%s\n", substr(str, i));
1639                         next;
1640                 }
1641                 printf("-%s\n", c);
1642                 if (arg[c]) {
1643                         if (i < len)
1644                                 printf("'%s'\n", substr(str, i + 1));
1645                         else
1646                                 expect = 1;
1647                         next;
1648                 }
1649         }
1650 }
1651 END {
1652         if (expect)
1653                 print "?";
1654 }
1655 EOF
1656
1657 : process the command line options
1658 set X `for arg in "$@"; do echo "X$arg"; done |
1659         sed -e s/X// | awk -f options.awk`
1660 eval "set $*"
1661 shift
1662 rm -f options.awk
1663
1664 : set up default values
1665 fastread=''
1666 reuseval=false
1667 config_sh=''
1668 alldone=''
1669 error=''
1670 silent=''
1671 extractsh=''
1672 override=''
1673 knowitall=''
1674 rm -f optdef.sh posthint.sh
1675 cat >optdef.sh <<EOS
1676 $startsh
1677 EOS
1678
1679
1680 : option parsing
1681 while test $# -gt 0; do
1682         case "$1" in
1683         -d) shift; fastread=yes;;
1684         -e) shift; alldone=cont;;
1685         -f)
1686                 shift
1687                 cd ..
1688                 if test -r "$1"; then
1689                         config_sh="$1"
1690                 else
1691                         echo "$me: cannot read config file $1." >&2
1692                         error=true
1693                 fi
1694                 cd UU
1695                 shift;;
1696         --help|\
1697         -h) shift; error=true;;
1698         -r) shift; reuseval=true;;
1699         -s) shift; silent=true; realsilent=true;;
1700         -E) shift; alldone=exit;;
1701         -K) shift; knowitall=true;;
1702         -O) shift; override=true;;
1703         -S) shift; silent=true; extractsh=true;;
1704         -D)
1705                 shift
1706                 case "$1" in
1707                 *=)
1708                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1709                         echo "$me: ignoring -D $1" >&2
1710                         ;;
1711                 *=*) echo "$1" | \
1712                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1713                 *) echo "$1='define'" >> optdef.sh;;
1714                 esac
1715                 shift
1716                 ;;
1717         -U)
1718                 shift
1719                 case "$1" in
1720                 *=) echo "$1" >> optdef.sh;;
1721                 *=*)
1722                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1723                         echo "$me: ignoring -U $1" >&2
1724                         ;;
1725                 *) echo "$1='undef'" >> optdef.sh;;
1726                 esac
1727                 shift
1728                 ;;
1729         -A)
1730             shift
1731             xxx=''
1732             yyy="$1"
1733             zzz=''
1734             uuu=undef
1735             case "$yyy" in
1736             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1737                  case "$zzz" in
1738                  *:*) zzz='' ;;
1739                  *)   xxx=append
1740                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1741                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1742                  esac
1743                  ;;
1744             esac
1745             case "$xxx" in
1746             '')  case "$yyy" in
1747                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1748                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1749                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1750                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1751                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1752                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1753                  esac
1754                  ;;
1755             esac
1756             case "$xxx" in
1757             append)
1758                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1759             clear)
1760                 echo "$yyy=''"                  >> posthint.sh ;;
1761             define)
1762                 case "$zzz" in
1763                 '') zzz=define ;;
1764                 esac
1765                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1766             eval)
1767                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1768             prepend)
1769                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1770             undef)
1771                 case "$zzz" in
1772                 '') zzz="$uuu" ;;
1773                 esac
1774                 echo "$yyy=$zzz"                >> posthint.sh ;;
1775             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1776             esac
1777             shift
1778             ;;
1779         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1780             exit 0;;
1781         --) break;;
1782         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1783         *) break;;
1784         esac
1785 done
1786
1787 case "$error" in
1788 true)
1789         cat >&2 <<EOM
1790 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1791                  [-U symbol] [-U symbol=] [-A command:symbol...]
1792   -d : use defaults for all answers.
1793   -e : go on without questioning past the production of config.sh.
1794   -f : specify an alternate default configuration file.
1795   -h : print this help message and exit (with an error status).
1796   -r : reuse C symbols value if possible (skips costly nm extraction).
1797   -s : silent mode, only echoes questions and essential information.
1798   -D : define symbol to have some value:
1799          -D symbol         symbol gets the value 'define'
1800          -D symbol=value   symbol gets the value 'value'
1801        common used examples (see INSTALL for more info):
1802          -Duse64bitint            use 64bit integers
1803          -Duse64bitall            use 64bit integers and pointers
1804          -Dusethreads             use thread support
1805          -Dinc_version_list=none  do not include older perl trees in @INC
1806          -DEBUGGING=none          DEBUGGING options
1807          -Dcc=gcc                 choose your compiler
1808          -Dprefix=/opt/perl5      choose your destination
1809   -E : stop at the end of questions, after having produced config.sh.
1810   -K : do not use unless you know what you are doing.
1811   -O : let -D and -U override definitions from loaded configuration file.
1812   -S : perform variable substitutions on all .SH files (can mix with -f)
1813   -U : undefine symbol:
1814          -U symbol    symbol gets the value 'undef'
1815          -U symbol=   symbol gets completely empty
1816        e.g.:  -Uversiononly
1817   -A : manipulate symbol after the platform specific hints have been applied:
1818          -A append:symbol=value   append value to symbol
1819          -A symbol=value          like append:, but with a separating space
1820          -A define:symbol=value   define symbol to have value
1821          -A clear:symbol          define symbol to be ''
1822          -A define:symbol         define symbol to be 'define'
1823          -A eval:symbol=value     define symbol to be eval of value
1824          -A prepend:symbol=value  prepend value to symbol
1825          -A undef:symbol          define symbol to be 'undef'
1826          -A undef:symbol=         define symbol to be ''
1827        e.g.:  -A prepend:libswanted='cl pthread '
1828               -A ccflags=-DSOME_MACRO
1829   -V : print version number and exit (with a zero status).
1830 EOM
1831         exit 1
1832         ;;
1833 esac
1834
1835 : Sanity checks
1836 case "$fastread$alldone" in
1837 yescont|yesexit) ;;
1838 *)
1839         case "$extractsh" in
1840         true) ;;
1841         *)
1842                 if test ! -t 0; then
1843                         echo "Say 'sh Configure', not 'sh <Configure'"
1844                         exit 1
1845                 fi
1846                 ;;
1847         esac
1848         ;;
1849 esac
1850
1851 exec 4>&1
1852 case "$silent" in
1853 true) exec 1>/dev/null;;
1854 esac
1855
1856 : run the defines and the undefines, if any, but leave the file out there...
1857 touch optdef.sh
1858 . ./optdef.sh
1859 : create the posthint manipulation script and leave the file out there...
1860 touch posthint.sh
1861
1862 : set package name
1863 package='perl5'
1864 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1865 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1866 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1867 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1868 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1869 esac
1870
1871 : Some greps do not return status, grrr.
1872 echo "grimblepritz" >grimble
1873 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1874         contains=contains
1875 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1876         contains=grep
1877 else
1878         contains=contains
1879 fi
1880 rm -f grimble
1881 : the following should work in any shell
1882 case "$contains" in
1883 contains*)
1884         echo " "
1885         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1886         cat >contains <<'EOSS'
1887 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1888 EOSS
1889 chmod +x contains
1890 esac
1891
1892 : Find the path to the source tree
1893 case "$src" in
1894 '') case "$0" in
1895     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1896          case "$src" in
1897          /*)    ;;
1898          .)     ;;
1899          *)     src=`cd ../$src && pwd` ;;
1900          esac
1901          ;;
1902     *)   src='.';;
1903     esac;;
1904 esac
1905 case "$src" in
1906 '')     src=/
1907         rsrc=/
1908         ;;
1909 /*)     rsrc="$src";;
1910 *)      rsrc="../$src";;
1911 esac
1912 if test -f $rsrc/Configure && \
1913         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1914 then
1915    : found it, so we are ok.
1916 else
1917         rsrc=''
1918         for src in . .. ../.. ../../.. ../../../..; do
1919                 if test -f ../$src/Configure && \
1920                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1921                 then
1922                         rsrc=../$src
1923                         break
1924                 fi
1925         done
1926 fi
1927 case "$rsrc" in
1928 '')
1929         cat <<EOM >&4
1930
1931 Sorry, I can't seem to locate the source dir for $package.  Please start
1932 Configure with an explicit path -- i.e. /some/path/Configure.
1933
1934 EOM
1935         exit 1
1936         ;;
1937 ../.)   rsrc='..';;
1938 *)
1939         echo " "
1940         echo "Sources for $package found in \"$src\"." >&4
1941         ;;
1942 esac
1943
1944 : script used to extract .SH files with variable substitutions
1945 cat >extract <<'EOS'
1946 PERL_CONFIG_SH=true
1947 echo "Doing variable substitutions on .SH files..."
1948 if test -f MANIFEST; then
1949         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1950 else
1951         echo "(Looking for .SH files under the source directory.)"
1952         set x `(cd "$src"; find . -name "*.SH" -print)`
1953 fi
1954 shift
1955 case $# in
1956 0) set x `(cd "$src"; echo *.SH)`; shift;;
1957 esac
1958 if test ! -f "$src/$1"; then
1959         shift
1960 fi
1961 mkdir_p='
1962 name=$1;
1963 create="";
1964 while test $name; do
1965         if test ! -d "$name"; then
1966                 create="$name $create";
1967                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1968                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1969         else
1970                 name="";
1971         fi;
1972 done;
1973 for file in $create; do
1974         mkdir $file;
1975 done
1976 '
1977 for file in $*; do
1978         case "$src" in
1979         ".")
1980                 case "$file" in
1981                 */*)
1982                         dir=`expr X$file : 'X\(.*\)/'`
1983                         file=`expr X$file : 'X.*/\(.*\)'`
1984                         (cd "$dir" && . ./$file)
1985                         ;;
1986                 *)
1987                         . ./$file
1988                         ;;
1989                 esac
1990                 ;;
1991         *)
1992                 case "$file" in
1993                 */*)
1994                         dir=`expr X$file : 'X\(.*\)/'`
1995                         file=`expr X$file : 'X.*/\(.*\)'`
1996                         (set x $dir; shift; eval $mkdir_p)
1997                         sh <"$src/$dir/$file"
1998                         ;;
1999                 *)
2000                         sh <"$src/$file"
2001                         ;;
2002                 esac
2003                 ;;
2004         esac
2005 done
2006 if test -f "$src/config_h.SH"; then
2007         if test ! -f config.h; then
2008         : oops, they left it out of MANIFEST, probably, so do it anyway.
2009         . "$src/config_h.SH"
2010         fi
2011 fi
2012 EOS
2013
2014 : extract files and exit if asked to do so
2015 case "$extractsh" in
2016 true)
2017         case "$realsilent" in
2018         true) ;;
2019         *) exec 1>&4;;
2020         esac
2021         case "$config_sh" in
2022         '') config_sh='config.sh';;
2023         esac
2024         echo " "
2025         echo "Fetching answers from $config_sh..."
2026         cd ..
2027         . $config_sh
2028         test "$override" && . ./optdef.sh
2029         echo " "
2030         . UU/extract
2031         rm -rf UU
2032         echo "Extraction done."
2033         exit 0
2034         ;;
2035 esac
2036
2037 : Eunice requires " " instead of "", can you believe it
2038 echo " "
2039 : Here we go...
2040 echo "Beginning of configuration questions for $package."
2041
2042 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2043
2044 : first determine how to suppress newline on echo command
2045 echo " "
2046 echo "Checking echo to see how to suppress newlines..."
2047 (echo "hi there\c" ; echo " ") >.echotmp
2048 if $contains c .echotmp >/dev/null 2>&1 ; then
2049         echo "...using -n."
2050         n='-n'
2051         c=''
2052 else
2053         cat <<'EOM'
2054 ...using \c
2055 EOM
2056         n=''
2057         c='\c'
2058 fi
2059 echo $n "The star should be here-->$c"
2060 echo '*'
2061 rm -f .echotmp
2062
2063 : Now test for existence of everything in MANIFEST
2064 echo " "
2065 if test -f "$rsrc/MANIFEST"; then
2066         echo "First let's make sure your kit is complete.  Checking..." >&4
2067         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2068                 (split -l 50 2>/dev/null || split -50)
2069         rm -f missing
2070         tmppwd=`pwd`
2071         for filelist in x??; do
2072                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2073                         >/dev/null 2>>"$tmppwd/missing")
2074         done
2075         if test -s missing; then
2076                 cat missing >&4
2077                 cat >&4 <<'EOM'
2078
2079 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2080
2081 You have the option of continuing the configuration process, despite the
2082 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2083 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2084 and contact the author (perlbug@perl.org).
2085
2086 EOM
2087                 echo $n "Continue? [n] $c" >&4
2088                 read ans
2089                 case "$ans" in
2090                 y*)
2091                         echo "Continuing..." >&4
2092                         rm -f missing
2093                         ;;
2094                 *)
2095                         echo "ABORTING..." >&4
2096                         kill $$
2097                         ;;
2098                 esac
2099         else
2100                 echo "Looks good..."
2101         fi
2102 else
2103         echo "There is no MANIFEST file.  I hope your kit is complete !"
2104 fi
2105 rm -f missing x??
2106
2107 : Find the appropriate value for a newline for tr
2108 echo " "
2109 if test -n "$DJGPP"; then
2110        trnl='\012'
2111 fi
2112 if test X"$trnl" = X; then
2113         case "`echo foo|tr '\n' x 2>/dev/null`" in
2114         foox) trnl='\n' ;;
2115         esac
2116 fi
2117 if test X"$trnl" = X; then
2118         case "`echo foo|tr '\012' x 2>/dev/null`" in
2119         foox) trnl='\012' ;;
2120         esac
2121 fi
2122 if test X"$trnl" = X; then
2123        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2124        fooxy) trnl='\n\r' ;;
2125        esac
2126 fi
2127 if test X"$trnl" = X; then
2128         cat <<EOM >&2
2129
2130 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2131
2132 EOM
2133         exit 1
2134 fi
2135
2136 : compute the number of columns on the terminal for proper question formatting
2137 case "$COLUMNS" in
2138 '') COLUMNS='80';;
2139 esac
2140
2141 : set up the echo used in my read
2142 myecho="case \"\$xxxm\" in
2143 '') echo $n \"\$rp $c\" >&4;;
2144 *) case \"\$rp\" in
2145         '') echo $n \"[\$xxxm] $c\";;
2146         *)
2147                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2148                         echo \"\$rp\" >&4
2149                         echo $n \"[\$xxxm] $c\" >&4
2150                 else
2151                         echo $n \"\$rp [\$xxxm] $c\" >&4
2152                 fi
2153                 ;;
2154         esac;;
2155 esac"
2156
2157 : now set up to do reads with possible shell escape and default assignment
2158 cat <<EOSC >myread
2159 $startsh
2160 xxxm=\$dflt
2161 $myecho
2162 ans='!'
2163 case "\$fastread" in
2164 yes) case "\$dflt" in
2165         '') ;;
2166         *) ans='';
2167                 case "\$silent-\$rp" in
2168                 true-) ;;
2169                 *) echo " " >&4;;
2170                 esac;;
2171         esac;;
2172 *) case "\$silent" in
2173         true) case "\$rp" in
2174                 '') ans='';;
2175                 esac;;
2176         esac;;
2177 esac
2178 while expr "X\$ans" : "X!" >/dev/null; do
2179         read answ
2180         set x \$xxxm
2181         shift
2182         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2183         case  "\$answ" in
2184         "!")
2185                 sh 1>&4
2186                 echo " "
2187                 $myecho
2188                 ;;
2189         !*)
2190                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2191                 shift
2192                 sh 1>&4 -c "\$*"
2193                 echo " "
2194                 $myecho
2195                 ;;
2196         "\$ans")
2197                 case "\$ans" in
2198                 \\&*)
2199                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2200                         shift
2201                         case "\$1" in
2202                         -d)
2203                                 fastread=yes
2204                                 echo "(OK, I'll run with -d after this question.)" >&4
2205                                 ;;
2206                         -*)
2207                                 echo "*** Sorry, \$1 not supported yet." >&4
2208                                 ;;
2209                         esac
2210                         $myecho
2211                         ans=!
2212                         ;;
2213                 esac;;
2214         *)
2215                 case "\$aok" in
2216                 y)
2217                         echo "*** Substitution done -- please confirm."
2218                         xxxm="\$ans"
2219                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2220                         xxxm="\$ans"
2221                         ans=!
2222                         ;;
2223                 *)
2224                         echo "*** Error -- try again."
2225                         ans=!
2226                         ;;
2227                 esac
2228                 $myecho
2229                 ;;
2230         esac
2231         case "\$ans\$xxxm\$nostick" in
2232         '')
2233                 ans=!
2234                 $myecho
2235                 ;;
2236         esac
2237 done
2238 case "\$ans" in
2239 '') ans="\$xxxm";;
2240 esac
2241 EOSC
2242
2243 : create .config dir to save info across Configure sessions
2244 test -d ../.config || mkdir ../.config
2245 cat >../.config/README <<EOF
2246 This directory created by Configure to save information that should
2247 persist across sessions for $package.
2248
2249 You may safely delete it if you wish.
2250 EOF
2251
2252 : See if we are using a devel version and want that
2253 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2254 case "$usedevel" in
2255 $define|true|[yY]*)
2256     usedevel="$define" ;;
2257 *) case "$xversion" in
2258    *[13579])
2259         cat >&4 <<EOH
2260 *** WHOA THERE!!! ***
2261
2262     This is an UNSTABLE DEVELOPMENT release.
2263     The version of this $package distribution is $xversion, that is, odd,
2264     (as opposed to even) and that signifies a development release.
2265     If you want a maintenance release, you want an even-numbered version.
2266
2267     Do ***NOT*** install this into production use.
2268     Data corruption and crashes are possible.
2269
2270     It is most seriously suggested that you do not continue any further
2271     unless you want to help in developing and debugging Perl.
2272
2273     If you *still* want to build perl, you can answer 'y' now,
2274     or pass -Dusedevel to Configure.
2275
2276 EOH
2277         rp='Do you really want to continue?'
2278         dflt='n'
2279         . ./myread
2280         case "$ans" in
2281         [yY]) echo >&4 "Okay, continuing."
2282               usedevel="$define" ;;
2283         *) echo >&4 "Okay, bye."
2284            exit 1
2285            ;;
2286         esac
2287         ;;
2288     esac
2289     usedevel="$undef"
2290     ;;
2291 esac
2292 case "$usedevel" in
2293 $define|true|[yY]*)
2294         case "$versiononly" in
2295         '') versiononly="$define" ;;
2296         esac
2297         case "$installusrbinperl" in
2298         '') installusrbinperl="$undef" ;;
2299         esac
2300         ;;
2301 esac
2302
2303 : general instructions
2304 needman=true
2305 firsttime=true
2306 user=`(logname) 2>/dev/null`
2307 case "$user" in
2308 '') user=`whoami 2>&1`;;
2309 esac
2310 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2311         firsttime=false
2312         echo " "
2313         rp='Would you like to see the instructions?'
2314         dflt=n
2315         . ./myread
2316         case "$ans" in
2317         [yY]*) ;;
2318         *) needman=false;;
2319         esac
2320 fi
2321 if $needman; then
2322         cat <<EOH
2323
2324 This installation shell script will examine your system and ask you questions
2325 to determine how the perl5 package should be installed. If you get
2326 stuck on a question, you may use a ! shell escape to start a subshell or
2327 execute a command.  Many of the questions will have default answers in square
2328 brackets; typing carriage return will give you the default.
2329
2330 On some of the questions which ask for file or directory names you are allowed
2331 to use the ~name construct to specify the login directory belonging to "name",
2332 even if you don't have a shell which knows about that.  Questions where this is
2333 allowed will be marked "(~name ok)".
2334
2335 EOH
2336         rp=''
2337         dflt='Type carriage return to continue'
2338         . ./myread
2339         cat <<'EOH'
2340
2341 The prompter used in this script allows you to use shell variables and
2342 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2343 in the default answer, as if the default line was a set of arguments given to a
2344 script shell.  This means you may also use $* to repeat the whole default line,
2345 so you do not have to re-type everything to add something to the default.
2346
2347 Every time there is a substitution, you will have to confirm.  If there is an
2348 error (e.g. an unmatched backtick), the default answer will remain unchanged
2349 and you will be prompted again.
2350
2351 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2352 the questions and use the computed defaults (or the previous answers if there
2353 was already a config.sh file). Type 'Configure -h' for a list of options.
2354 You may also start interactively and then answer '& -d' at any prompt to turn
2355 on the non-interactive behaviour for the remainder of the execution.
2356
2357 EOH
2358         . ./myread
2359         cat <<EOH
2360
2361 Much effort has been expended to ensure that this shell script will run on any
2362 Unix system.  If despite that it blows up on yours, your best bet is to edit
2363 Configure and run it again.  If you can't run Configure for some reason,
2364 you'll have to generate a config.sh file by hand.  Whatever problems you
2365 have, let me (perlbug@perl.org) know how I blew it.
2366
2367 This installation script affects things in two ways:
2368
2369 1) it may do direct variable substitutions on some of the files included
2370    in this kit.
2371 2) it builds a config.h file for inclusion in C programs.  You may edit
2372    any of these files as the need arises after running this script.
2373
2374 If you make a mistake on a question, there is no easy way to back up to it
2375 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2376 files.  Configure will offer to let you do this before it runs the SH files.
2377
2378 EOH
2379         dflt='Type carriage return to continue'
2380         . ./myread
2381         case "$firsttime" in
2382         true) echo $user >>../.config/instruct;;
2383         esac
2384 fi
2385
2386 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2387 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2388 if test "X$sysroot" = X; then
2389     sysroot=""
2390 else
2391     case "$cc" in
2392         *gcc*|*g++*)
2393             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2394             # _sysroot is used in places where we need --sysroot=foo
2395             # but using the rest of the flags could cause issues.
2396             _sysroot="--sysroot=$sysroot";
2397             case "$ccflags" in
2398                 *sysroot*) ;;
2399                 'undef'|*)
2400                 ccflags="$ccflags $_sysroot"
2401             esac
2402             case "$ldflags" in
2403                 *sysroot*) ;;
2404                 'undef'|*)
2405                 ldflags="$ldflags $_sysroot"
2406             esac
2407             case "$cppflags" in
2408                 *sysroot*) ;;
2409                 'undef'|*)
2410                 cppflags="$cppflags $_sysroot"
2411             esac
2412             # lddlflags updated below in lddlflags section;
2413             # same with cccdlflags
2414             ;;
2415     esac
2416
2417     # Adjust some defaults to also use $sysroot
2418     for var in xlibpth loclibpth locincpth glibpth; do
2419         eval xxx=\$$var
2420         eval $var=''
2421         for path in $xxx; do
2422             eval $var=\"\$$var $sysroot$path\"
2423         done
2424     done
2425
2426 fi
2427
2428 : find out where common programs are
2429 echo " "
2430 echo "Locating common programs..." >&4
2431 cat <<EOSC >loc
2432 $startsh
2433 case \$# in
2434 0) exit 1;;
2435 esac
2436 thing=\$1
2437 shift
2438 dflt=\$1
2439 shift
2440 for dir in \$*; do
2441         case "\$thing" in
2442         .)
2443         if test -d \$dir/\$thing; then
2444                 echo \$dir
2445                 exit 0
2446         fi
2447         ;;
2448         *)
2449         for thisthing in \$dir/\$thing; do
2450                 : just loop through to pick last item
2451         done
2452         if test -f \$thisthing; then
2453                 echo \$thisthing
2454                 exit 0
2455         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2456                 echo \$thisthing
2457                 exit 0
2458         elif test -f \$dir/\$thing.exe; then
2459                 if test -n "$DJGPP"; then
2460                         echo \$dir/\$thing.exe
2461                 elif test "$eunicefix" != ":"; then
2462                         : on Eunice apparently
2463                         echo \$dir/\$thing
2464                 fi
2465                 exit 0
2466         fi
2467         ;;
2468         esac
2469 done
2470 echo \$dflt
2471 exit 1
2472 EOSC
2473 chmod +x loc
2474 $eunicefix loc
2475 loclist="
2476 awk
2477 cat
2478 chmod
2479 comm
2480 cp
2481 echo
2482 expr
2483 grep
2484 ls
2485 mkdir
2486 rm
2487 sed
2488 sort
2489 touch
2490 tr
2491 uniq
2492 "
2493 trylist="
2494 ar
2495 bison
2496 byacc
2497 cpp
2498 csh
2499 date
2500 egrep
2501 gmake
2502 gzip
2503 less
2504 ln
2505 make
2506 more
2507 nm
2508 nroff
2509 perl
2510 pg
2511 test
2512 uname
2513 zip
2514 "
2515 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2516 pth="$pth $sysroot/lib $sysroot/usr/lib"
2517 for file in $loclist; do
2518         eval xxx=\$$file
2519         case "$xxx" in
2520         /*|?:[\\/]*)
2521                 if test -f "$xxx"; then
2522                         : ok
2523                 else
2524                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2525                         xxx=`./loc $file $file $pth`
2526                 fi
2527                 ;;
2528         '') xxx=`./loc $file $file $pth`;;
2529         *) xxx=`./loc $xxx $xxx $pth`;;
2530         esac
2531         eval $file=$xxx$_exe
2532         eval _$file=$xxx
2533         case "$xxx" in
2534         /*)
2535                 echo $file is in $xxx.
2536                 ;;
2537         ?:[\\/]*)
2538                 echo $file is in $xxx.
2539                 ;;
2540         *)
2541                 echo "I don't know where '$file' is, and my life depends on it." >&4
2542                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2543                 exit 1
2544                 ;;
2545         esac
2546 done
2547 echo " "
2548 echo "Don't worry if any of the following aren't found..."
2549 say=offhand
2550 for file in $trylist; do
2551         eval xxx=\$$file
2552         case "$xxx" in
2553         /*|?:[\\/]*)
2554                 if test -f "$xxx"; then
2555                         : ok
2556                 else
2557                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2558                         xxx=`./loc $file $file $pth`
2559                 fi
2560                 ;;
2561         '') xxx=`./loc $file $file $pth`;;
2562         *) xxx=`./loc $xxx $xxx $pth`;;
2563         esac
2564         eval $file=$xxx$_exe
2565         eval _$file=$xxx
2566         case "$xxx" in
2567         /*)
2568                 echo $file is in $xxx.
2569                 ;;
2570         ?:[\\/]*)
2571                 echo $file is in $xxx.
2572                 ;;
2573         *)
2574                 echo "I don't see $file out there, $say."
2575                 say=either
2576                 ;;
2577         esac
2578 done
2579 case "$egrep" in
2580 egrep)
2581         echo "Substituting grep for egrep."
2582         egrep=$grep
2583         _egrep=$grep
2584         ;;
2585 esac
2586 case "$less" in
2587 '')     ;;
2588 *)      if $less -R </dev/null >/dev/null 2>&1; then
2589                echo "Substituting less -R for less."
2590                less="$less -R"
2591                _less=$less
2592         fi
2593         ;;
2594 esac
2595 case "$ln" in
2596 ln)
2597         echo "Substituting cp for ln."
2598         ln=$cp
2599         _ln=$cp
2600         ;;
2601 esac
2602 case "$make" in
2603 make)
2604         case "$gmake" in
2605         gmake)
2606         echo "I can't find make or gmake, and my life depends on it." >&4
2607         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2608         exit 1
2609         ;;
2610         esac
2611         ;;
2612 esac
2613 case "$gmake" in
2614 gmake)  ;;
2615 *)      # We can't have osname yet.
2616         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2617                 # Assume that gmake, if found, is definitely GNU make
2618                 # and prefer it over the system make.
2619                 echo "Substituting gmake for make."
2620                 make=$gmake
2621                 _make=$gmake
2622         fi
2623         ;;
2624 esac
2625 case "$test" in
2626 test)
2627         echo "Hopefully test is built into your sh."
2628         ;;
2629 *)
2630         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2631                 echo "Using the test built into your sh."
2632                 test=test
2633                 _test=test
2634         fi
2635         ;;
2636 esac
2637 case "$echo" in
2638 echo)
2639         echo "Hopefully echo is built into your sh."
2640         ;;
2641 '') ;;
2642 *)
2643         echo " "
2644 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2645         $echo $n "hi there$c" >foo1
2646         echo $n "hi there$c" >foo2
2647         if cmp foo1 foo2 >/dev/null 2>&1; then
2648                 echo "They are compatible.  In fact, they may be identical."
2649         else
2650                 case "$n" in
2651                 '-n') n='' c='\c';;
2652                 *) n='-n' c='';;
2653                 esac
2654                 cat <<FOO
2655 They are not compatible!  You are probably running ksh on a non-USG system.
2656 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2657 have echo built in and we may have to run some Bourne shell scripts.  That
2658 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2659
2660 FOO
2661                 $echo $n "The star should be here-->$c"
2662                 $echo "*"
2663         fi
2664         $rm -f foo1 foo2
2665         ;;
2666 esac
2667
2668 # This question was auctioned at YAPC::Europe-2007 in Vienna
2669 # I never promised you could answer it. I only auctioned the question.
2670 cat <<FOO
2671 The following message is sponsored by
2672
2673   Dresden.pm<--The stars should be here.
2674
2675 Dear Perl user, system administrator or package
2676 maintainer, the Perl community sends greetings to
2677 you. Do you (emblematical) greet back [Y/n]? n
2678
2679 FOO
2680
2681 : Check what type of C compiler we use
2682 cat <<EOS >trygcc
2683 $startsh
2684 EOS
2685 cat <<'EOSC' >>trygcc
2686 case "$cc" in
2687 '') ;;
2688 *)  $rm -f try try.*
2689     $cat >try.c <<EOM
2690 int main(int argc, char *argv[]) {
2691   return 0;
2692 }
2693 EOM
2694     if $cc -o try $ccflags $ldflags try.c; then
2695        :
2696     else
2697         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2698         despair=yes
2699         trygcc=yes
2700         case "$cc" in
2701         *gcc*) trygcc=no ;;
2702         esac
2703         # Skip this test because it gives a false match on output like:
2704         #    ./trygcc: line 23: cc: command not found
2705         # case "`$cc -v -c try.c 2>&1`" in
2706         # *gcc*) trygcc=no ;;
2707         # esac
2708         if $test X"$trygcc" = Xyes; then
2709             if gcc -o try -c try.c; then
2710                 echo " "
2711                 echo "You seem to have a working gcc, though." >&4
2712                 # Switching compilers may undo the work of hints files.
2713                 # The most common problem is -D_REENTRANT for threads.
2714                 # This heuristic catches that case, but gets false positives
2715                 # if -Dusethreads was not actually specified.  Better to
2716                 # bail out here with a useful message than fail
2717                 # mysteriously later. Should we perhaps just try to
2718                 # re-invoke Configure -Dcc=gcc config_args ?
2719                 if $test -f usethreads.cbu; then
2720                         $cat >&4 <<EOM
2721
2722 *** However, any setting of the C compiler flags (e.g. for thread support)
2723 *** will be lost.  It may be necessary for you to restart Configure and
2724 *** add -Dcc=gcc to your Configure command line.
2725
2726 EOM
2727                         rp="Would you like to go ahead and try gcc anyway?"
2728                         dflt=n
2729                 else
2730                         rp="Would you like to use it?"
2731                         dflt=y
2732                 fi
2733                 if $test -f myread; then
2734                     . ./myread
2735                 else
2736                     if $test -f UU/myread; then
2737                         . ./UU/myread
2738                     else
2739                         echo "Cannot find myread, sorry.  Aborting." >&2
2740                         exit 1
2741                     fi
2742                 fi
2743                 case "$ans" in
2744                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2745                 esac
2746             fi
2747         fi
2748     fi
2749     $rm -f try try.*
2750     ;;
2751 esac
2752 EOSC
2753
2754 cat <<EOS >checkcc
2755 $startsh
2756 EOS
2757 cat <<'EOSC' >>checkcc
2758 case "$cc" in
2759 '') ;;
2760 *)  $rm -f try try.*
2761     $cat >try.c <<EOM
2762 int main(int argc, char *argv[]) {
2763   return 0;
2764 }
2765 EOM
2766     if $cc -o try $ccflags $ldflags try.c; then
2767        :
2768     else
2769         if $test X"$despair" = Xyes; then
2770            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2771         fi
2772         $cat >&4 <<EOM
2773 You need to find a working C compiler.
2774 Either (purchase and) install the C compiler supplied by your OS vendor,
2775 or for a free C compiler try http://gcc.gnu.org/
2776 I cannot continue any further, aborting.
2777 EOM
2778         exit 1
2779     fi
2780     $rm -f try try.*
2781     ;;
2782 esac
2783 EOSC
2784
2785 : determine whether symbolic links are supported
2786 echo " "
2787 $touch blurfl
2788 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2789         echo "Symbolic links are supported." >&4
2790         lns="$ln -s"
2791 else
2792         echo "Symbolic links are NOT supported." >&4
2793         lns="$ln"
2794 fi
2795 $rm -f blurfl sym
2796
2797 : determine whether symbolic links are supported
2798 echo " "
2799 case "$lns" in
2800 *"ln"*" -s")
2801         echo "Checking how to test for symbolic links..." >&4
2802         $lns blurfl sym
2803         if $test "X$issymlink" = X; then
2804                 case "$newsh" in
2805                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2806                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2807                 esac
2808                 if test $? = 0; then
2809                         issymlink="test -h"
2810                 else
2811                         echo "Your builtin 'test -h' may be broken." >&4
2812                         case "$test" in
2813                         /*)     ;;
2814                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2815                                 for p in $pth
2816                                 do
2817                                         if test -f "$p/$test"; then
2818                                                 test="$p/$test"
2819                                                 break
2820                                         fi
2821                                 done
2822                                 ;;
2823                         esac
2824                         case "$test" in
2825                         /*)
2826                                 echo "Trying external '$test -h'." >&4
2827                                 issymlink="$test -h"
2828                                 if $test ! -h sym >/dev/null 2>&1; then
2829                                         echo "External '$test -h' is broken, too." >&4
2830                                         issymlink=''
2831                                 fi
2832                                 ;;
2833                         *)      issymlink='' ;;
2834                         esac
2835                 fi
2836         fi
2837         if $test "X$issymlink" = X; then
2838                 if $test -L sym 2>/dev/null; then
2839                         issymlink="$test -L"
2840                         echo "The builtin '$test -L' worked." >&4
2841                 fi
2842         fi
2843         if $test "X$issymlink" != X; then
2844                 echo "You can test for symbolic links with '$issymlink'." >&4
2845         else
2846                 echo "I do not know how you can test for symbolic links." >&4
2847         fi
2848         $rm -f blurfl sym
2849         ;;
2850 *)      echo "No symbolic links, so not testing for their testing..." >&4
2851         ;;
2852 esac
2853 echo " "
2854
2855 : Make symlinks util
2856 case "$mksymlinks" in
2857 $define|true|[yY]*)
2858         case "$src" in
2859         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2860                 exit 1
2861                 ;;
2862         *)      case "$lns:$issymlink" in
2863                 *"ln"*" -s:"*"test -"?)
2864                         echo "Creating the symbolic links..." >&4
2865                         cd ..
2866                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2867                         awk 'NF == 1 {
2868                                 dir=".";
2869                                 file=$1 "";
2870                              }
2871                              NF == 2 {
2872                                 dir=$1 "";
2873                                 file=$2 "";
2874                              }
2875                              {
2876                                  print "# dir = ", dir, "file = ", file
2877                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2878                              } END {
2879                                  for (d in mf) {
2880                                      if (d != ".") { print("mkdir -p "d) }
2881                                      print("ln -sf "mf[d]" "d);
2882                                  }
2883                              }' source="$src" > UU/mksymlinks.$$
2884                         sh UU/mksymlinks.$$
2885                         rm UU/mksymlinks.$$
2886                         # Sanity check 1.
2887                         if test ! -d t/base; then
2888                                 echo "Failed to create the subdirectories.  Aborting." >&4
2889                                 exit 1
2890                         fi
2891                         # Sanity check 2.
2892                         if test ! -f t/base/lex.t; then
2893                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2894                                 exit 1
2895                         fi
2896                         if test ! -f win32/win32.c; then
2897                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2898                                 exit 1
2899                         fi
2900                         cd UU
2901                         ;;
2902                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2903                         ;;
2904                 esac
2905                 ;;
2906         esac
2907         ;;
2908 esac
2909
2910 : Check for Cross-Compilation
2911 if $test "X$targethost" = "X"; then
2912     targethost=""
2913 fi
2914 if $test "X$targetenv" = "X"; then
2915     targetenv=""
2916 fi
2917 case "$usecrosscompile" in
2918 $define|true|[yY]*)
2919         $echo "Cross-compiling..."
2920         croak=''
2921         case "$cc" in
2922         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2923             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2924             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2925             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2926             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2927             # leave out ld, choosing it is more complex
2928             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2929             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2930             # We are in a weird spot. Just before us, some values
2931             # were 'saved', to be restored after the hints are
2932             # run.  This means that the changes we made to ar,
2933             # nm and ranlib will get reverted.
2934             # To avoid that, we hijack the saving mechanism and
2935             # have it save our new values.
2936             for file in ar nm ranlib; do
2937                 eval xxx=\$$file
2938                 eval $file=$xxx$_exe
2939                 eval _$file=$xxx
2940             done
2941         ;;
2942         esac
2943         case "$targetarch" in
2944         '') echo "Targetarch not defined." >&4; croak=y ;;
2945         *)  echo "Using targetarch $targetarch." >&4 ;;
2946         esac
2947         case "$targethost" in
2948         '') echo "Targethost not defined." >&4; croak=y ;;
2949         *)  echo "Using targethost $targethost." >&4
2950         esac
2951         locincpth=' '
2952         loclibpth=' '
2953         case "$croak" in
2954         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2955         esac
2956     : compile a host miniperl and generate_uudmap, unless we got passed them
2957     if $test "X$hostperl" = X; then
2958       echo "Building host miniperl and generate_uudmap binaries" >&4
2959       before_host=`pwd`
2960       cd ..
2961       cd $src
2962       src=`pwd`
2963       rm -rf $src/host
2964       mkdir $src/host
2965       cd $src/host
2966       $src/Configure -des -Dusedevel -Dmksymlinks
2967       $make miniperl
2968       case "$hostgenerate" in
2969       '') $make generate_uudmap
2970           hostgenerate=$src/host/generate_uudmap
2971           ;;
2972        "$undef") hostgenerate=''
2973           ;;
2974       esac
2975       hostperl=$src/host/miniperl
2976       cd $before_host
2977     fi
2978     hostosname=`$hostperl -le 'print $^O'`
2979     ;;
2980 *)
2981     usecrosscompile="$undef"
2982     ;;
2983 esac
2984
2985 : Define -Dtargethost=somecomputer to run compiled tests on another machine
2986 case "$targethost" in
2987     '') echo "Checking for cross-compile" >&4
2988     case "$usecrosscompile$multiarch" in
2989        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
2990          if [ -f Makefile ]; then
2991            echo " "
2992            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
2993          else
2994            echo "Configure done."
2995          fi
2996        exit 0
2997        ;;
2998      *) echo "No targethost for running compiler tests against defined, running locally" >&4
2999         run=''
3000         to=:
3001         from=:
3002         ;;
3003     esac
3004     ;;
3005     *) echo "Using targethost $targethost." >&4
3006         case "$src" in
3007         /*) run=$src/Cross/run
3008             targetmkdir=$src/Cross/mkdir
3009             to=$src/Cross/to
3010             from=$src/Cross/from
3011             ;;
3012         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3013             run=$pwd/Cross/run
3014             targetmkdir=$pwd/Cross/mkdir
3015             to=$pwd/Cross/to
3016             from=$pwd/Cross/from
3017             ;;
3018         esac
3019         case "$targetrun" in
3020         '') targetrun=ssh ;;
3021         esac
3022         case "$targetto" in
3023         '') targetto=scp ;;
3024         esac
3025         case "$targetfrom" in
3026         '') targetfrom=scp ;;
3027         esac
3028         run=$run-$targetrun
3029         to=$to-$targetto
3030         from=$from-$targetfrom
3031         case "$targetdir" in
3032         '')  targetdir=/tmp
3033              echo "Guessing targetdir $targetdir." >&4
3034              ;;
3035         esac
3036         case "$targetuser" in
3037         '')  targetuser=root
3038              echo "Guessing targetuser $targetuser." >&4
3039              ;;
3040         esac
3041         case "$targetport" in
3042         '')  targetport=22
3043              echo "Guessing targetport $targetport." >&4
3044              ;;
3045         esac
3046         case "$targetfrom" in
3047         scp)    q=-q ;;
3048         *)      q='' ;;
3049         esac
3050         case "$targetrun" in
3051         ssh|rsh)
3052             cat >$run <<EOF
3053 #!/bin/sh
3054 env=''
3055 case "\$1" in
3056 -cwd)
3057   shift
3058   cwd=\$1
3059   shift
3060   ;;
3061 esac
3062 case "\$1" in
3063 -env)
3064   shift
3065   env=\$1
3066   shift
3067   ;;
3068 esac
3069 case "\$cwd" in
3070 '') cwd=$targetdir ;;
3071 esac
3072 exe=\$1
3073 shift
3074 $to \$exe
3075 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3076 EOF
3077             ;;
3078         adb)
3079             $touch $run
3080             ;;
3081         *)  echo "Unknown targetrun '$targetrun'" >&4
3082             exit 1
3083             ;;
3084         esac
3085         case "$targetmkdir" in
3086         */Cross/mkdir)
3087             cat >$targetmkdir <<EOF
3088 #!/bin/sh
3089 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3090 EOF
3091             $chmod a+rx $targetmkdir
3092             ;;
3093         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3094             exit 1
3095             ;;
3096         esac
3097         case "$targetto" in
3098         scp|rcp)
3099             cat >$to <<EOF
3100 #!/bin/sh
3101 for f in \$@
3102 do
3103   case "\$f" in
3104   /*)
3105     $targetmkdir \`dirname \$f\`
3106     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3107     ;;
3108   *)
3109     $targetmkdir $targetdir/\`dirname \$f\`
3110     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3111     ;;
3112   esac
3113 done
3114 exit 0
3115 EOF
3116             ;;
3117         cp) cat >$to <<EOF
3118 #!/bin/sh
3119 for f in \$@
3120 do
3121   case "\$f" in
3122   /*)
3123     $mkdir -p $targetdir/\`dirname \$f\`
3124     $cp \$f $targetdir/\$f || exit 1
3125     ;;
3126   *)
3127     $targetmkdir $targetdir/\`dirname \$f\`
3128     $cp \$f $targetdir/\$f || exit 1
3129     ;;
3130   esac
3131 done
3132 exit 0
3133 EOF
3134             ;;
3135         *)  echo "Unknown targetto '$targetto'" >&4
3136             exit 1
3137             ;;
3138         esac
3139         case "$targetfrom" in
3140         scp|rcp)
3141           cat >$from <<EOF
3142 #!/bin/sh
3143 for f in \$@
3144 do
3145   $rm -f \$f
3146   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3147 done
3148 exit 0
3149 EOF
3150             ;;
3151         cp) cat >$from <<EOF
3152 #!/bin/sh
3153 for f in \$@
3154 do
3155   $rm -f \$f
3156   cp $targetdir/\$f . || exit 1
3157 done
3158 exit 0
3159 EOF
3160             ;;
3161         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3162             exit 1
3163             ;;
3164         esac
3165         if $test ! -f $run; then
3166             echo "Target 'run' script '$run' not found." >&4
3167         else
3168             $chmod a+rx $run
3169         fi
3170         if $test ! -f $to; then
3171             echo "Target 'to' script '$to' not found." >&4
3172         else
3173             $chmod a+rx $to
3174         fi
3175         if $test ! -f $from; then
3176             echo "Target 'from' script '$from' not found." >&4
3177         else
3178             $chmod a+rx $from
3179         fi
3180         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3181             exit 1
3182         fi
3183         cat >&4 <<EOF
3184 Using '$run' for remote execution,
3185 and '$from' and '$to'
3186 for remote file transfer.
3187 EOF
3188         ;;
3189 *)      run=''
3190         to=:
3191         from=:
3192         usecrosscompile="$undef"
3193         targetarch=''
3194         ;;
3195 esac
3196
3197 : see whether [:lower:] and [:upper:] are supported character classes
3198 echo " "
3199 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3200 ABYZ)
3201         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3202         up='[:upper:]'
3203         low='[:lower:]'
3204         ;;
3205 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3206         # (0xd9 and 0xe2), therefore that is a nice testing point.
3207         if test "X$up" = X -o "X$low" = X; then
3208             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3209             rs) up='[A-Z]'
3210                 low='[a-z]'
3211                 ;;
3212             esac
3213         fi
3214         if test "X$up" = X -o "X$low" = X; then
3215             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3216             rs) up='A-Z'
3217                 low='a-z'
3218                 ;;
3219             esac
3220         fi
3221         if test "X$up" = X -o "X$low" = X; then
3222             case "`echo RS | od -x 2>/dev/null`" in
3223             *D9E2*|*d9e2*)
3224                 echo "Hey, this might be EBCDIC." >&4
3225                 if test "X$up" = X -o "X$low" = X; then
3226                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3227                     rs) up='[A-IJ-RS-Z]'
3228                         low='[a-ij-rs-z]'
3229                         ;;
3230                     esac
3231                 fi
3232                 if test "X$up" = X -o "X$low" = X; then
3233                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3234                     rs) up='A-IJ-RS-Z'
3235                         low='a-ij-rs-z'
3236                         ;;
3237                     esac
3238                 fi
3239                 ;;
3240             esac
3241         fi
3242 esac
3243 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3244 rs)
3245     echo "Using $up and $low to convert case." >&4
3246     ;;
3247 *)
3248     echo "I don't know how to translate letters from upper to lower case." >&4
3249     echo "Your tr is not acting any way I know of." >&4
3250     exit 1
3251     ;;
3252 esac
3253 : set up the translation script tr, must be called with ./tr of course
3254 cat >tr <<EOSC
3255 $startsh
3256 case "\$1\$2" in
3257 '[A-Z][a-z]') exec $tr '$up' '$low';;
3258 '[a-z][A-Z]') exec $tr '$low' '$up';;
3259 esac
3260 exec $tr "\$@"
3261 EOSC
3262 chmod +x tr
3263 $eunicefix tr
3264
3265 : Try to determine whether config.sh was made on this system
3266 case "$config_sh" in
3267 '')
3268 myuname=`$uname -a 2>/dev/null`
3269 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3270 # Downcase everything to avoid ambiguity.
3271 # Remove slashes and single quotes so we can use parts of this in
3272 # directory and file names.
3273 # Remove newlines so myuname is sane to use elsewhere.
3274 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3275 # because the A-Z/a-z are not consecutive.
3276 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3277         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3278 newmyuname="$myuname"
3279 dflt=n
3280 case "$knowitall" in
3281 '')
3282         if test -f ../config.sh; then
3283                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3284                         eval "`grep myuname= ../config.sh`"
3285                 fi
3286                 if test "X$myuname" = "X$newmyuname"; then
3287                         dflt=y
3288                 fi
3289         fi
3290         ;;
3291 *) dflt=y;;
3292 esac
3293
3294 : Get old answers from old config file if Configure was run on the
3295 : same system, otherwise use the hints.
3296 hint=default
3297 cd ..
3298 if test -f config.sh; then
3299         echo " "
3300         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3301         . UU/myread
3302         case "$ans" in
3303         n*|N*) echo "OK, I'll ignore it."
3304                 mv config.sh config.sh.old
3305                 myuname="$newmyuname"
3306                 ;;
3307         *)  echo "Fetching default answers from your old config.sh file..." >&4
3308                 tmp_n="$n"
3309                 tmp_c="$c"
3310                 tmp_sh="$sh"
3311                 . ./config.sh
3312                 cp config.sh UU
3313                 n="$tmp_n"
3314                 c="$tmp_c"
3315                 : Older versions did not always set $sh.  Catch re-use of such
3316                 : an old config.sh.
3317                 case "$sh" in
3318                 '') sh="$tmp_sh" ;;
3319                 esac
3320                 hint=previous
3321                 ;;
3322         esac
3323 fi
3324 . ./UU/checkcc
3325 if test ! -f config.sh; then
3326         $cat <<EOM
3327
3328 First time through, eh?  I have some defaults handy for some systems
3329 that need some extra help getting the Configure answers right:
3330
3331 EOM
3332         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3333         dflt=''
3334         : Half the following guesses are probably wrong... If you have better
3335         : tests or hints, please send them to perlbug@perl.org
3336         : The metaconfig authors would also appreciate a copy...
3337         $test -f /irix && osname=irix
3338         $test -f /xenix && osname=sco_xenix
3339         $test -f /dynix && osname=dynix
3340         $test -f /dnix && osname=dnix
3341         $test -f /lynx.os && osname=lynxos
3342         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3343         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3344         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3345         $test -f /bin/mips && /bin/mips && osname=mips
3346         $test -d /usr/apollo/bin && osname=apollo
3347         $test -f /etc/saf/_sactab && osname=svr4
3348         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3349         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3350         if $test -d /MachTen -o -d /MachTen_Folder; then
3351                 osname=machten
3352                 if $test -x /sbin/version; then
3353                         osvers=`/sbin/version | $awk '{print $2}' |
3354                         $sed -e 's/[A-Za-z]$//'`
3355                 elif $test -x /usr/etc/version; then
3356                         osvers=`/usr/etc/version | $awk '{print $2}' |
3357                         $sed -e 's/[A-Za-z]$//'`
3358                 else
3359                         osvers="$2.$3"
3360                 fi
3361         fi
3362
3363         $test -f /sys/posix.dll &&
3364                 $test -f /usr/bin/what &&
3365                 set X `/usr/bin/what /sys/posix.dll` &&
3366                 $test "$3" = UWIN &&
3367                 osname=uwin &&
3368                 osvers="$5"
3369
3370         if $test -f $uname; then
3371                 set X $myuname
3372                 shift
3373
3374                 case "$5" in
3375                 fps*) osname=fps ;;
3376                 mips*)
3377                         case "$4" in
3378                         umips) osname=umips ;;
3379                         *) osname=mips ;;
3380                         esac;;
3381                 [23]100) osname=mips ;;
3382                 i386*)
3383                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3384                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3385                                 osname='sco'
3386                                 osvers=$tmp
3387                         elif $test -f /etc/kconfig; then
3388                                 osname=isc
3389                                 if test "$lns" = "$ln -s"; then
3390                                         osvers=4
3391                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3392                                         osvers=3
3393                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3394                                         osvers=2
3395                                 fi
3396                         fi
3397                         tmp=''
3398                         ;;
3399                 pc*)
3400                         if test -n "$DJGPP"; then
3401                                 osname=dos
3402                                 osvers=djgpp
3403                         fi
3404                         ;;
3405                 esac
3406
3407                 case "$1" in
3408                 aix) osname=aix
3409                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3410                         case "$tmp" in
3411                         # oslevel can fail with:
3412                         # oslevel: Unable to acquire lock.
3413                         *not\ found) osvers="$4"."$3" ;;
3414                         '<3240'|'<>3240') osvers=3.2.0 ;;
3415                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3416                         '=3250'|'>3250') osvers=3.2.5 ;;
3417                         *) osvers=$tmp;;
3418                         esac
3419                         ;;
3420                 bitrig) osname=bitrig
3421                         osvers="$3"
3422                         ;;
3423                 bsd386) osname=bsd386
3424                         osvers=`$uname -r`
3425                         ;;
3426                 cygwin*) osname=cygwin
3427                         osvers="$3"
3428                         ;;
3429                 *dc.osx) osname=dcosx
3430                         osvers="$3"
3431                         ;;
3432                 dnix) osname=dnix
3433                         osvers="$3"
3434                         ;;
3435                 domainos) osname=apollo
3436                         osvers="$3"
3437                         ;;
3438                 dgux)   osname=dgux
3439                         osvers="$3"
3440                         ;;
3441                 dragonfly) osname=dragonfly
3442                         osvers="$3"
3443                         ;;
3444                 dynixptx*) osname=dynixptx
3445                         osvers=`echo "$4"|sed 's/^v//'`
3446                         ;;
3447                 freebsd) osname=freebsd
3448                         osvers="$3" ;;
3449                 genix)  osname=genix ;;
3450                 gnu)    osname=gnu
3451                         osvers="$3" ;;
3452                 hp*)    osname=hpux
3453                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3454                         ;;
3455                 irix*)  osname=irix
3456                         case "$3" in
3457                         4*) osvers=4 ;;
3458                         5*) osvers=5 ;;
3459                         *)      osvers="$3" ;;
3460                         esac
3461                         ;;
3462                 linux)  osname=linux
3463                         case "$3" in
3464                         *)      osvers="$3" ;;
3465                         esac
3466                         $test -f /system/lib/libandroid.so && osname=linux-android
3467                         ;;
3468                 MiNT)   osname=mint
3469                         ;;
3470                 netbsd*) osname=netbsd
3471                         osvers="$3"
3472                         ;;
3473                 news-os) osvers="$3"
3474                         case "$3" in
3475                         4*) osname=newsos4 ;;
3476                         *) osname=newsos ;;
3477                         esac
3478                         ;;
3479                 nonstop-ux) osname=nonstopux ;;
3480                 openbsd) osname=openbsd
3481                         osvers="$3"
3482                         ;;
3483                 os2)    osname=os2
3484                         osvers="$4"
3485                         ;;
3486                 POSIX-BC | posix-bc ) osname=posix-bc
3487                         osvers="$3"
3488                         ;;
3489                 powerux | power_ux | powermax_os | powermaxos | \
3490                 powerunix | power_unix) osname=powerux
3491                         osvers="$3"
3492                         ;;
3493                 qnx) osname=qnx
3494                         osvers="$4"
3495                         ;;
3496                 solaris) osname=solaris
3497                         case "$3" in
3498                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3499                         *)      osvers="$3" ;;
3500                         esac
3501                         ;;
3502                 sunos) osname=sunos
3503                         case "$3" in
3504                         5*) osname=solaris
3505                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3506                         *)      osvers="$3" ;;
3507                         esac
3508                         ;;
3509                 titanos) osname=titanos
3510                         case "$3" in
3511                         1*) osvers=1 ;;
3512                         2*) osvers=2 ;;
3513                         3*) osvers=3 ;;
3514                         4*) osvers=4 ;;
3515                         *)      osvers="$3" ;;
3516                         esac
3517                         ;;
3518                 ultrix) osname=ultrix
3519                         osvers="$3"
3520                         ;;
3521                 osf1|mls+)      case "$5" in
3522                                 alpha)
3523                                         osname=dec_osf
3524                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3525                                         case "$osvers" in
3526                                         [1-9].[0-9]*) ;;
3527                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3528                                         esac
3529                                         ;;
3530                         hp*)    osname=hp_osf1  ;;
3531                         mips)   osname=mips_osf1 ;;
3532                         esac
3533                         ;;
3534                 # UnixWare 7.1.2 is known as Open UNIX 8
3535                 openunix|unixware) osname=svr5
3536                         osvers="$4"
3537                         ;;
3538                 uts)    osname=uts
3539                         osvers="$3"
3540                         ;;
3541                 vos) osvers="$3"
3542                         ;;
3543                 $2) case "$osname" in
3544                         *isc*) ;;
3545                         *freebsd*) ;;
3546                         svr*)
3547                                 : svr4.x or possibly later
3548                                 case "svr$3" in
3549                                 ${osname}*)
3550                                         osname=svr$3
3551                                         osvers=$4
3552                                         ;;
3553                                 esac
3554                                 case "$osname" in
3555                                 svr4.0)
3556                                         : Check for ESIX
3557                                         if test -f /stand/boot ; then
3558                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3559                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3560                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3561                                                         if test -n "$isesix"; then
3562                                                                 osname=esix4
3563                                                         fi
3564                                                 fi
3565                                         fi
3566                                         ;;
3567                                 esac
3568                                 ;;
3569                         *)      if test -f /etc/systemid; then
3570                                         osname=sco
3571                                         set `echo $3 | $sed 's/\./ /g'` $4
3572                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3573                                                 osvers=$1.$2.$3
3574                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3575                                                 osvers=$1.$2
3576                                         elif $test -f $src/hints/sco_$1.sh; then
3577                                                 osvers=$1
3578                                         fi
3579                                 else
3580                                         case "$osname" in
3581                                         '') : Still unknown.  Probably a generic Sys V.
3582                                                 osname="sysv"
3583                                                 osvers="$3"
3584                                                 ;;
3585                                         esac
3586                                 fi
3587                                 ;;
3588                         esac
3589                         ;;
3590                 *)      case "$osname" in
3591                         '') : Still unknown.  Probably a generic BSD.
3592                                 osname="$1"
3593                                 osvers="$3"
3594                                 ;;
3595                         esac
3596                         ;;
3597                 esac
3598         else
3599                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3600                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3601                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3602                                 osname=news_os
3603                         fi
3604                         $rm -f UU/kernel.what
3605                 elif test -d c:/. -o -n "$is_os2" ; then
3606                         set X $myuname
3607                         osname=os2
3608                         osvers="$5"
3609                 fi
3610         fi
3611
3612         case "$targetarch" in
3613         '') ;;
3614         *)  hostarch=$osname
3615             case "$targetarch" in
3616                 nto*|*-nto-*)
3617                     # Will load qnx.sh, which should change osname to nto
3618                     osname=qnx
3619                     osvers=''
3620                     ;;
3621                 *linux-android*)
3622                     # Catch arm-linux-androideabi, mipsel-linux-android,
3623                     # and i686-linux-android
3624                     osname=linux-android
3625                     osvers=''
3626                     ;;
3627                 *linux*)
3628                     # Something like arm-linux-gnueabihf is really just
3629                     # plain linux.
3630                     osname=linux
3631                     osvers=''
3632                     ;;
3633                 *solaris*|*sunos*)
3634                     osname=solaris
3635                     # XXX perhaps we should just assume
3636                     # osvers to be 2, or maybe take the value
3637                     # from targetarch. Using $run before the
3638                     # hints are run is somewhat icky.
3639                     set X `$run $uname -a 2>/dev/null`
3640                     shift
3641                     case "$3" in
3642                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3643                         *)  osvers="$3" ;;
3644                     esac
3645                     ;;
3646                 *)
3647                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3648                     osvers=''
3649                 ;;
3650             esac
3651             ;;
3652         esac
3653
3654         : Now look for a hint file osname_osvers, unless one has been
3655         : specified already.
3656         case "$hintfile" in
3657         ''|' ')
3658                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3659                 : Also try without trailing minor version numbers.
3660                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3661                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3662                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3663                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3664                 case "$file" in
3665                 '') dflt=none ;;
3666                 *)  case "$osvers" in
3667                         '') dflt=$file
3668                                 ;;
3669                         *)  if $test -f $src/hints/$file.sh ; then
3670                                         dflt=$file
3671                                 elif $test -f $src/hints/$xfile.sh ; then
3672                                         dflt=$xfile
3673                                 elif $test -f $src/hints/$xxfile.sh ; then
3674                                         dflt=$xxfile
3675                                 elif $test -f $src/hints/$xxxfile.sh ; then
3676                                         dflt=$xxxfile
3677                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3678                                         dflt=$xxxxfile
3679                                 elif $test -f "$src/hints/${osname}.sh" ; then
3680                                         dflt="${osname}"
3681                                 else
3682                                         dflt=none
3683                                 fi
3684                                 ;;
3685                         esac
3686                         ;;
3687                 esac
3688                 if $test -f Policy.sh ; then
3689                         case "$dflt" in
3690                         *Policy*) ;;
3691                         none) dflt="Policy" ;;
3692                         *) dflt="Policy $dflt" ;;
3693                         esac
3694                 fi
3695                 ;;
3696         *)
3697                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3698                 ;;
3699         esac
3700
3701         if $test -f Policy.sh ; then
3702                 $cat <<EOM
3703
3704 There's also a Policy hint file available, which should make the
3705 site-specific (policy) questions easier to answer.
3706 EOM
3707
3708         fi
3709
3710         $cat <<EOM
3711
3712 You may give one or more space-separated answers, or "none" if appropriate.
3713 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3714 previous run of Configure, you may specify it as well as or instead of
3715 OS-specific hints.  If hints are provided for your OS, you should use them:
3716 although Perl can probably be built without hints on many platforms, using
3717 hints often improve performance and may enable features that Configure can't
3718 set up on its own. If there are no hints that match your OS, specify "none";
3719 DO NOT give a wrong version or a wrong OS.
3720
3721 EOM
3722
3723         rp="Which of these apply, if any?"
3724         . UU/myread
3725         tans=$ans
3726         for file in $tans; do
3727                 if $test X$file = XPolicy -a -f Policy.sh; then
3728                         . Policy.sh
3729                         $cat Policy.sh >> UU/config.sh
3730                 elif $test -f $src/hints/$file.sh; then
3731                         . $src/hints/$file.sh
3732                         $cat $src/hints/$file.sh >> UU/config.sh
3733                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3734                         : nothing
3735                 else
3736                         : Give one chance to correct a possible typo.
3737                         echo "$file.sh does not exist"
3738                         dflt=$file
3739                         rp="hint to use instead?"
3740                         . UU/myread
3741                         for file in $ans; do
3742                                 if $test -f "$src/hints/$file.sh"; then
3743                                         . $src/hints/$file.sh
3744                                         $cat $src/hints/$file.sh >> UU/config.sh
3745                                 elif $test X$ans = X -o X$ans = Xnone ; then
3746                                         : nothing
3747                                 else
3748                                         echo "$file.sh does not exist -- ignored."
3749                                 fi
3750                         done
3751                 fi
3752         done
3753
3754         hint=recommended
3755         : Remember our hint file for later.
3756         if $test -f "$src/hints/$file.sh" ; then
3757                 hintfile="$file"
3758         else
3759                 hintfile=''
3760         fi
3761 fi
3762 cd UU
3763 ;;
3764 *)
3765         echo " "
3766         echo "Fetching default answers from $config_sh..." >&4
3767         tmp_n="$n"
3768         tmp_c="$c"
3769         cd ..
3770         cp $config_sh config.sh 2>/dev/null
3771         chmod +w config.sh
3772         . ./config.sh
3773         cd UU
3774         cp ../config.sh .
3775         n="$tmp_n"
3776         c="$tmp_c"
3777         hint=previous
3778         ;;
3779 esac
3780 test "$override" && . ./optdef.sh
3781
3782 : Restore computed paths
3783 for file in $loclist $trylist; do
3784         eval $file="\$_$file"
3785 done
3786
3787 cat << EOM
3788
3789 Configure uses the operating system name and version to set some defaults.
3790 The default value is probably right if the name rings a bell. Otherwise,
3791 since spelling matters for me, either accept the default or answer "none"
3792 to leave it blank.
3793
3794 EOM
3795 case "$osname" in
3796         ''|' ')
3797                 case "$hintfile" in
3798                 ''|' '|none) dflt=none ;;
3799                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3800                 esac
3801                 ;;
3802         *) dflt="$osname" ;;
3803 esac
3804 rp="Operating system name?"
3805 . ./myread
3806 case "$ans" in
3807 none)  osname='' ;;
3808 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3809 esac
3810 echo " "
3811 case "$osvers" in
3812         ''|' ')
3813                 case "$hintfile" in
3814                 ''|' '|none) dflt=none ;;
3815                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3816                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3817                         case "$dflt" in
3818                         ''|' ') dflt=none ;;
3819                         esac
3820                         ;;
3821                 esac
3822                 ;;
3823         *) dflt="$osvers" ;;
3824 esac
3825 rp="Operating system version?"
3826 . ./myread
3827 case "$ans" in
3828 none)  osvers='' ;;
3829 *) osvers="$ans" ;;
3830 esac
3831
3832
3833 . ./posthint.sh
3834
3835 : who configured the system
3836 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3837 case "$cf_by" in
3838 "")
3839         cf_by=`(logname) 2>/dev/null`
3840         case "$cf_by" in
3841         "")
3842                 cf_by=`(whoami) 2>/dev/null`
3843                 case "$cf_by" in
3844                 "") cf_by=unknown ;;
3845                 esac ;;
3846         esac ;;
3847 esac
3848
3849 : decide how portable to be.  Allow command line overrides.
3850 case "$d_portable" in
3851 "$undef") ;;
3852 *)      d_portable="$define" ;;
3853 esac
3854
3855 : set up shell script to do ~ expansion
3856 cat >filexp <<EOSS
3857 $startsh
3858 : expand filename
3859 case "\$1" in
3860  \~/*|\~)
3861         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3862         ;;
3863  \~*)
3864         if $test -f /bin/csh; then
3865                 /bin/csh -f -c "glob \$1"
3866                 failed=\$?
3867                 echo ""
3868                 exit \$failed
3869         else
3870                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3871                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3872                 if $test ! -d "\$dir"; then
3873                         me=\`basename \$0\`
3874                         echo "\$me: can't locate home directory for: \$name" >&2
3875                         exit 1
3876                 fi
3877                 case "\$1" in
3878                 */*)
3879                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3880                         ;;
3881                 *)
3882                         echo \$dir
3883                         ;;
3884                 esac
3885         fi
3886         ;;
3887 *)
3888         echo \$1
3889         ;;
3890 esac
3891 EOSS
3892 chmod +x filexp
3893 $eunicefix filexp
3894
3895 : now set up to get a file name
3896 cat <<EOS >getfile
3897 $startsh
3898 EOS
3899 cat <<'EOSC' >>getfile
3900 tilde=''
3901 fullpath=''
3902 already=''
3903 skip=''
3904 none_ok=''
3905 exp_file=''
3906 nopath_ok=''
3907 orig_rp="$rp"
3908 orig_dflt="$dflt"
3909 case "$gfpth" in
3910 '') gfpth='.' ;;
3911 esac
3912
3913 case "$fn" in
3914 *\(*)
3915         : getfile will accept an answer from the comma-separated list
3916         : enclosed in parentheses even if it does not meet other criteria.
3917         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3918         fn=`echo $fn | sed 's/(.*)//'`
3919         ;;
3920 esac
3921
3922 case "$fn" in
3923 *:*)
3924         loc_file=`expr $fn : '.*:\(.*\)'`
3925         fn=`expr $fn : '\(.*\):.*'`
3926         ;;
3927 esac
3928
3929 case "$fn" in
3930 *~*) tilde=true;;
3931 esac
3932 case "$fn" in
3933 */*) fullpath=true;;
3934 esac
3935 case "$fn" in
3936 *+*) skip=true;;
3937 esac
3938 case "$fn" in
3939 *n*) none_ok=true;;
3940 esac
3941 case "$fn" in
3942 *e*) exp_file=true;;
3943 esac
3944 case "$fn" in
3945 *p*) nopath_ok=true;;
3946 esac
3947
3948 case "$fn" in
3949 *f*) type='File';;
3950 *d*) type='Directory';;
3951 *l*) type='Locate';;
3952 esac
3953
3954 what="$type"
3955 case "$what" in
3956 Locate) what='File';;
3957 esac
3958
3959 case "$exp_file" in
3960 '')
3961         case "$d_portable" in
3962         "$define") ;;
3963         *) exp_file=true;;
3964         esac
3965         ;;
3966 esac
3967
3968 cd ..
3969 while test "$type"; do
3970         redo=''
3971         rp="$orig_rp"
3972         dflt="$orig_dflt"
3973         case "$tilde" in
3974         true) rp="$rp (~name ok)";;
3975         esac
3976         . UU/myread
3977         if test -f UU/getfile.ok && \
3978                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3979         then
3980                 value="$ans"
3981                 ansexp="$ans"
3982                 break
3983         fi
3984         case "$ans" in
3985         none)
3986                 value=''
3987                 ansexp=''
3988                 case "$none_ok" in
3989                 true) type='';;
3990                 esac
3991                 ;;
3992         *)
3993                 case "$tilde" in
3994                 '') value="$ans"
3995                         ansexp="$ans";;
3996                 *)
3997                         value=`UU/filexp $ans`
3998                         case $? in
3999                         0)
4000                                 if test "$ans" != "$value"; then
4001                                         echo "(That expands to $value on this system.)"
4002                                 fi
4003                                 ;;
4004                         *) value="$ans";;
4005                         esac
4006                         ansexp="$value"
4007                         case "$exp_file" in
4008                         '') value="$ans";;
4009                         esac
4010                         ;;
4011                 esac
4012                 case "$fullpath" in
4013                 true)
4014                         case "$ansexp" in
4015                         /*) value="$ansexp" ;;
4016                         [a-zA-Z]:/*) value="$ansexp" ;;
4017                         *)
4018                                 redo=true
4019                                 case "$already" in
4020                                 true)
4021                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4022                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4023                                         ;;
4024                                 *)
4025                                 echo "Please give a full path name, starting with slash." >&4
4026                                         case "$tilde" in
4027                                         true)
4028                                 echo "Note that using ~name is ok provided it expands well." >&4
4029                                                 already=true
4030                                                 ;;
4031                                         esac
4032                                 esac
4033                                 ;;
4034                         esac
4035                         ;;
4036                 esac
4037                 case "$redo" in
4038                 '')
4039                         case "$type" in
4040                         File)
4041                                 for fp in $gfpth; do
4042                                         if test "X$fp" = X.; then
4043                                             pf="$ansexp"
4044                                         else    
4045                                             pf="$fp/$ansexp"
4046                                         fi
4047                                         if test -f "$pf"; then
4048                                                 type=''
4049                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4050                                         then
4051                                                 echo "($value is not a plain file, but that's ok.)"
4052                                                 type=''
4053                                         fi
4054                                         if test X"$type" = X; then
4055                                             value="$pf"
4056                                             break
4057                                         fi
4058                                 done
4059                                 ;;
4060                         Directory)
4061                                 for fp in $gfpth; do
4062                                         if test "X$fp" = X.; then
4063                                             dir="$ans"
4064                                             direxp="$ansexp"
4065                                         else    
4066                                             dir="$fp/$ansexp"
4067                                             direxp="$fp/$ansexp"
4068                                         fi
4069                                         if test -d "$direxp"; then
4070                                                 type=''
4071                                                 value="$dir"
4072                                                 break
4073                                         fi
4074                                 done
4075                                 ;;
4076                         Locate)
4077                                 if test -d "$ansexp"; then
4078                                         echo "(Looking for $loc_file in directory $value.)"
4079                                         value="$value/$loc_file"
4080                                         ansexp="$ansexp/$loc_file"
4081                                 fi
4082                                 if test -f "$ansexp"; then
4083                                         type=''
4084                                 fi
4085                                 case "$nopath_ok" in
4086                                 true)   case "$value" in
4087                                         */*) ;;
4088                                         *)      echo "Assuming $value will be in people's path."
4089                                                 type=''
4090                                                 ;;
4091                                         esac
4092                                         ;;
4093                                 esac
4094                                 ;;
4095                         esac
4096
4097                         case "$skip" in
4098                         true) type='';
4099                         esac
4100
4101                         case "$type" in
4102                         '') ;;
4103                         *)
4104                                 if test "$fastread" = yes; then
4105                                         dflt=y
4106                                 else
4107                                         dflt=n
4108                                 fi
4109                                 rp="$what $value doesn't exist.  Use that name anyway?"
4110                                 . UU/myread
4111                                 dflt=''
4112                                 case "$ans" in
4113                                 y*) type='';;
4114                                 *) echo " ";;
4115                                 esac
4116                                 ;;
4117                         esac
4118                         ;;
4119                 esac
4120                 ;;
4121         esac
4122 done
4123 cd UU
4124 ans="$value"
4125 rp="$orig_rp"
4126 dflt="$orig_dflt"
4127 rm -f getfile.ok
4128 test "X$gfpthkeep" != Xy && gfpth=""
4129 EOSC
4130
4131 : determine root of directory hierarchy where package will be installed.
4132 case "$prefix" in
4133 '')
4134         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4135         ;;
4136 *?/)
4137         dflt=`echo "$prefix" | sed 's/.$//'`
4138         ;;
4139 *)
4140         dflt="$prefix"
4141         ;;
4142 esac
4143 $cat <<EOM
4144
4145 By default, $package will be installed in $dflt/bin, manual pages
4146 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4147 installation directories. Typically this is something like /usr/local.
4148 If you wish to have binaries under /usr/bin but other parts of the
4149 installation under /usr/local, that's ok: you will be prompted
4150 separately for each of the installation directories, the prefix being
4151 only used to set the defaults.
4152
4153 EOM
4154 fn=d~
4155 rp='Installation prefix to use?'
4156 . ./getfile
4157 oldprefix=''
4158 case "$prefix" in
4159 '') ;;
4160 *)
4161         case "$ans" in
4162         "$prefix") ;;
4163         *) oldprefix="$prefix";;
4164         esac
4165         ;;
4166 esac
4167 prefix="$ans"
4168 prefixexp="$ansexp"
4169
4170 : allow them to override the AFS root
4171 case "$afsroot" in
4172 '')     afsroot=/afs ;;
4173 *)      afsroot=$afsroot ;;
4174 esac
4175
4176 : is AFS running?
4177 echo " "
4178 case "$afs" in
4179 $define|true)   afs=true ;;
4180 $undef|false)   afs=false ;;
4181 *)      if $test -d $afsroot; then
4182                 afs=true
4183         else
4184                 afs=false
4185         fi
4186         ;;
4187 esac
4188 if $afs; then
4189         echo "AFS may be running... I'll be extra cautious then..." >&4
4190 else
4191         echo "AFS does not seem to be running..." >&4
4192 fi
4193
4194 : determine installation prefix for where package is to be installed.
4195 if $afs; then
4196 $cat <<EOM
4197
4198 Since you are running AFS, I need to distinguish the directory in which
4199 files will reside from the directory in which they are installed (and from
4200 which they are presumably copied to the former directory by occult means).
4201
4202 EOM
4203         case "$installprefix" in
4204         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4205         *) dflt="$installprefix";;
4206         esac
4207 else
4208 $cat <<EOM
4209
4210 In some special cases, particularly when building $package for distribution,
4211 it is convenient to distinguish the directory in which files should be
4212 installed from the directory ($prefix) in which they will
4213 eventually reside.  For most users, these two directories are the same.
4214
4215 EOM
4216         case "$installprefix" in
4217         '') dflt=$prefix ;;
4218         *) dflt=$installprefix;;
4219         esac
4220 fi
4221 fn=d~
4222 rp='What installation prefix should I use for installing files?'
4223 . ./getfile
4224 installprefix="$ans"
4225 installprefixexp="$ansexp"
4226
4227 : Perform the prefixexp/installprefixexp correction if necessary
4228 cat <<EOS >installprefix
4229 $startsh
4230 EOS
4231 cat <<'EOSC' >>installprefix
4232 : Change installation prefix, if necessary.
4233 if $test X"$prefix" != X"$installprefix"; then
4234     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4235 else
4236     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4237 fi
4238 EOSC
4239 chmod +x installprefix
4240 $eunicefix installprefix
4241
4242 : Set variables such as privlib and privlibexp from the output of ./getfile
4243 : performing the prefixexp/installprefixexp correction if necessary.
4244 cat <<EOS >setprefixvar
4245 $startsh
4246 EOS
4247 cat <<'EOSC' >>setprefixvar
4248 eval "${prefixvar}=\"\$ans\""
4249 eval "${prefixvar}exp=\"\$ansexp\""
4250 . ./installprefix
4251 EOSC
4252 chmod +x setprefixvar
4253 $eunicefix setprefixvar
4254
4255 : set up the script used to warn in case of inconsistency
4256 cat <<EOS >whoa
4257 $startsh
4258 EOS
4259 cat <<'EOSC' >>whoa
4260 dflt=y
4261 case "$hint" in
4262     recommended)
4263         case "$hintfile" in
4264         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4265                 ;;
4266         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4267                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4268                 ;;
4269         esac
4270         ;;
4271     *)  echo " "
4272         echo "*** WHOA THERE!!! ***" >&4
4273         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4274         ;;
4275 esac
4276 rp="    Keep the $hint value?"
4277 . ./myread
4278 case "$ans" in
4279 y) td=$was; tu=$was;;
4280 esac
4281 EOSC
4282
4283 : function used to set '$1' to '$val'
4284 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4285 case "$val$was" in
4286 $define$undef) . ./whoa; eval "$var=\$td";;
4287 $undef$define) . ./whoa; eval "$var=\$tu";;
4288 *) eval "$var=$val";;
4289 esac'
4290
4291 : get the patchlevel
4292 echo " "
4293 echo "Getting the current patchlevel..." >&4
4294 if $test -r $rsrc/patchlevel.h;then
4295         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4296         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4297         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4298         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4299         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4300         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4301         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4302 else
4303         revision=0
4304         patchlevel=0
4305         subversion=0
4306         api_revision=0
4307         api_version=0
4308         api_subversion=0
4309         perl_patchlevel=0
4310         $echo "(You do not have patchlevel.h.  Eek.)"
4311 fi
4312 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4313 version_patchlevel_string="version $patchlevel subversion $subversion"
4314 case "$perl_patchlevel" in
4315 0|'') ;;
4316 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4317     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4318     ;;
4319 esac
4320
4321 $echo "(You have $package $version_patchlevel_string.)"
4322
4323 case "$osname" in
4324 dos|vms)
4325         : XXX Should be a Configure test for double-dots in filenames.
4326         version=`echo $revision $patchlevel $subversion | \
4327                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4328         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4329                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4330         ;;
4331 *)
4332         version=`echo $revision $patchlevel $subversion | \
4333                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4334         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4335                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4336         ;;
4337 esac
4338 : Special case the 5.005_xx maintenance series, which used 5.005
4339 : without any subversion label as a subdirectory in $sitelib
4340 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4341         api_versionstring='5.005'
4342 fi
4343
4344 : Do we want threads support and if so, what type
4345 case "$usethreads" in
4346 $define|true|[yY]*)     dflt='y';;
4347 *)     # Catch case where user specified ithreads or 5005threads but
4348        # forgot -Dusethreads (A.D. 4/2002)
4349        case "$useithreads$use5005threads" in
4350        *$define*)       dflt='y';;
4351        *)               dflt='n';;
4352        esac
4353        ;;
4354 esac
4355 cat <<EOM
4356
4357 Perl can be built to offer a form of threading support on some systems
4358 To do so, Configure can be run with -Dusethreads.
4359
4360 Note that Perl built with threading support runs slightly slower
4361 and uses slightly more memory than plain Perl.
4362
4363 If this doesn't make any sense to you, just accept the default '$dflt'.
4364 EOM
4365 rp='Build a threading Perl?'
4366 . ./myread
4367 case "$ans" in
4368 y|Y)    val="$define" ;;
4369 *)      val="$undef" ;;
4370 esac
4371 set usethreads
4372 eval $setvar
4373
4374 if $test $patchlevel -lt 9; then
4375     case "$usethreads" in
4376     $define)
4377         : Default to ithreads unless overridden on command line or with
4378         : old config.sh
4379         dflt='y'
4380         case "$use5005threads" in
4381                 $define|true|[yY]*)
4382                         echo "5.005 threads are no longer supported"
4383                         exit 1
4384                 ;;
4385         esac
4386         case "$useithreads" in
4387                 $undef|false|[nN]*) dflt='n';;
4388         esac
4389         rp='Use the newer interpreter-based ithreads?'
4390         . ./myread
4391         case "$ans" in
4392         y|Y)    val="$define" ;;
4393         *)      val="$undef" ;;
4394         esac
4395         set useithreads
4396         eval $setvar
4397         : Now set use5005threads to the opposite value.
4398         case "$useithreads" in
4399         $define) val="$undef" ;;
4400         *) val="$define" ;;
4401         esac
4402         set use5005threads
4403         eval $setvar
4404         ;;
4405     *)
4406         useithreads="$undef"
4407         use5005threads="$undef"
4408         ;;
4409     esac
4410
4411     case "$useithreads$use5005threads" in
4412     "$define$define")
4413         $cat >&4 <<EOM
4414
4415 You cannot have both the ithreads and the 5.005 threads enabled
4416 at the same time.  Disabling the 5.005 threads since they are
4417 much less stable than the ithreads.
4418
4419 EOM
4420         use5005threads="$undef"
4421         ;;
4422     esac
4423
4424 else
4425 : perl-5.9.x and later
4426
4427     if test X"$usethreads" = "X$define"; then
4428         case "$use5005threads" in
4429             $define|true|[yY]*)
4430                 $cat >&4 <<EOM
4431
4432 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4433
4434 EOM
4435             ;;
4436         esac
4437     fi
4438
4439     use5005threads="$undef"
4440     useithreads="$usethreads"
4441 fi
4442
4443 case "$d_oldpthreads" in
4444 '')     : Configure tests would be welcome here.  For now, assume undef.
4445         val="$undef" ;;
4446 *)      val="$d_oldpthreads" ;;
4447 esac
4448 set d_oldpthreads
4449 eval $setvar
4450
4451
4452 : Look for a hint-file generated 'call-back-unit'.  If the
4453 : user has specified that a threading perl is to be built,
4454 : we may need to set or change some other defaults.
4455 if $test -f usethreads.cbu; then
4456     echo "Your platform has some specific hints regarding threaded builds, using them..."
4457     . ./usethreads.cbu
4458 else
4459     case "$usethreads" in
4460         "$define"|true|[yY]*)
4461                 $cat <<EOM
4462 (Your platform does not have any specific hints for threaded builds.
4463  Assuming POSIX threads, then.)
4464 EOM
4465         ;;
4466     esac
4467 fi
4468
4469 : Check if multiplicity is required
4470 cat <<EOM
4471
4472 Perl can be built so that multiple Perl interpreters can coexist
4473 within the same Perl executable.
4474 EOM
4475
4476 case "$useithreads" in
4477 $define)
4478         cat <<EOM
4479 This multiple interpreter support is required for interpreter-based threads.
4480 EOM
4481         val="$define"
4482         ;;
4483 *)      case "$usemultiplicity" in
4484         $define|true|[yY]*)     dflt='y';;
4485         *) dflt='n';;
4486         esac
4487         echo " "
4488         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4489         rp='Build Perl for multiplicity?'
4490         . ./myread
4491         case "$ans" in
4492         y|Y)    val="$define" ;;
4493         *)      val="$undef" ;;
4494         esac
4495         ;;
4496 esac
4497 set usemultiplicity
4498 eval $setvar
4499
4500 : Check if morebits is requested
4501 case "$usemorebits" in
4502 "$define"|true|[yY]*)
4503         use64bitint="$define"
4504         uselongdouble="$define"
4505         usemorebits="$define"
4506         ;;
4507 *)      usemorebits="$undef"
4508         ;;
4509 esac
4510
4511 : Determine the C compiler to be used
4512 echo " "
4513 case "$cc" in
4514 '') dflt=cc;;
4515 *) dflt="$cc";;
4516 esac
4517 rp="Use which C compiler?"
4518 . ./myread
4519 cc="$ans"
4520
4521 : See whether they have no cc but they do have gcc
4522 . ./trygcc
4523 if $test -f cc.cbu; then
4524     . ./cc.cbu
4525 fi
4526 . ./checkcc
4527
4528 : make some quick guesses about what we are up against
4529 echo " "
4530 $echo $n "Hmm...  $c"
4531 echo exit 1 >bsd
4532 echo exit 1 >usg
4533 echo exit 1 >v7
4534 echo exit 1 >osf1
4535 echo exit 1 >eunice
4536 echo exit 1 >xenix
4537 echo exit 1 >venix
4538 echo exit 1 >os2
4539 d_bsd="$undef"
4540 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4541 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4542 then
4543         echo "Looks kind of like an OSF/1 system, but we'll see..."
4544         echo exit 0 >osf1
4545 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4546         xxx=`./loc addbib blurfl $pth`
4547         if $test -f $xxx; then
4548         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4549                 echo exit 0 >bsd
4550                 echo exit 0 >usg
4551         else
4552                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4553                         echo "Looks kind of like an extended USG system, but we'll see..."
4554                 else
4555                         echo "Looks kind of like a USG system, but we'll see..."
4556                 fi
4557                 echo exit 0 >usg
4558         fi
4559 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4560         echo "Looks kind of like a BSD system, but we'll see..."
4561         d_bsd="$define"
4562         echo exit 0 >bsd
4563 else
4564         echo "Looks kind of like a Version 7 system, but we'll see..."
4565         echo exit 0 >v7
4566 fi
4567 case "$eunicefix" in
4568 *unixtovms*)
4569         $cat <<'EOI'
4570 There is, however, a strange, musty smell in the air that reminds me of
4571 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4572 EOI
4573         echo exit 0 >eunice
4574         d_eunice="$define"
4575 : it so happens the Eunice I know will not run shell scripts in Unix format
4576         ;;
4577 *)
4578         echo " "
4579         echo "Congratulations.  You aren't running Eunice."
4580         d_eunice="$undef"
4581         ;;
4582 esac
4583 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4584 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4585 : semicolon as a patch separator
4586 case "$p_" in
4587 :) ;;
4588 *)
4589         $cat <<'EOI'
4590 I have the feeling something is not exactly right, however...don't tell me...
4591 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4592 (Or you may be running DOS with DJGPP.)
4593 EOI
4594         echo exit 0 >os2
4595         ;;
4596 esac
4597 if test -f /xenix; then
4598         echo "Actually, this looks more like a XENIX system..."
4599         echo exit 0 >xenix
4600         d_xenix="$define"
4601 else
4602         echo " "
4603         echo "It's not Xenix..."
4604         d_xenix="$undef"
4605 fi
4606 chmod +x xenix
4607 $eunicefix xenix
4608 if test -f /venix; then
4609         echo "Actually, this looks more like a VENIX system..."
4610         echo exit 0 >venix
4611 else
4612         echo " "
4613         if ./xenix; then
4614                 : null
4615         else
4616                 echo "Nor is it Venix..."
4617         fi
4618 fi
4619 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4620 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4621 $rm -f foo
4622
4623 : Check if we are using GNU gcc and what its version is
4624 echo " "
4625 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4626 $cat >try.c <<EOM
4627 #include <stdio.h>
4628 int main() {
4629 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4630 #ifdef __VERSION__
4631         printf("%s\n", __VERSION__);
4632 #else
4633         printf("%s\n", "1");
4634 #endif
4635 #endif
4636         return(0);
4637 }
4638 EOM
4639 if $cc -o try $ccflags $ldflags try.c; then
4640         gccversion=`$run ./try`
4641         case "$gccversion" in
4642         '') echo "You are not using GNU cc." ;;
4643         *)  echo "You are using GNU cc $gccversion."
4644             ccname=gcc
4645             ;;
4646         esac
4647 else
4648         echo " "
4649         echo "*** WHOA THERE!!! ***" >&4
4650         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4651         case "$knowitall" in
4652         '')
4653         echo "    You'd better start hunting for one and let me know about it." >&4
4654                 exit 1
4655                 ;;
4656         esac
4657 fi
4658 $rm -f try try.*
4659 case "$gccversion" in
4660 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4661 esac
4662 case "$gccversion" in
4663 '') gccosandvers='' ;;
4664 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4665    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4666    gccshortvers=''
4667    case "$gccosandvers" in
4668    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4669    $osname$osvers) ;; # looking good
4670    $osname*) cat <<EOM >&4
4671
4672 *** WHOA THERE!!! ***
4673
4674     Your gcc has not been compiled for the exact release of
4675     your operating system ($gccosandvers versus $osname$osvers).
4676
4677     In general it is a good idea to keep gcc synchronized with
4678     the operating system because otherwise serious problems
4679     may ensue when trying to compile software, like Perl.
4680
4681     I'm trying to be optimistic here, though, and will continue.
4682     If later during the configuration and build icky compilation
4683     problems appear (headerfile conflicts being the most common
4684     manifestation), I suggest reinstalling the gcc to match
4685     your operating system release.
4686
4687 EOM
4688       ;;
4689    *) gccosandvers='' ;; # failed to parse, better be silent
4690    esac
4691    ;;
4692 esac
4693 case "$ccname" in
4694 '') ccname="$cc" ;;
4695 esac
4696
4697 # gcc 3.* complain about adding -Idirectories that they already know about,
4698 # so we will take those off from locincpth.
4699 case "$gccversion" in
4700 3*)
4701     echo "main(){}">try.c
4702     for incdir in $locincpth; do
4703        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4704              grep '^c[cp]p*[01]: warning: changing search order '`
4705        if test "X$warn" != X; then
4706            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4707        fi
4708     done
4709     $rm -f try try.*
4710 esac
4711
4712 # gcc 4.9 by default does some optimizations that break perl.
4713 # see ticket 121505.
4714 #
4715 # The -fwrapv disables those optimizations (and probably others,) so
4716 # for gcc 4.9 (and later, since the optimizations probably won't go
4717 # away), add -fwrapv unless the user requests -fno-wrapv, which
4718 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4719 # which turns the overflows -fwrapv ignores into runtime errors.
4720 case "$gccversion" in
4721 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4722     case "$ccflags" in
4723     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4724     *) ccflags="$ccflags -fwrapv" ;;
4725     esac
4726 esac
4727
4728 : What should the include directory be ?
4729 : Use sysroot if set, so findhdr looks in the right place.
4730 echo " "
4731 $echo $n "Hmm...  $c"
4732 dflt="$sysroot/usr/include"
4733 incpath=''
4734 mips_type=''
4735 if $test -f /bin/mips && /bin/mips; then
4736         echo "Looks like a MIPS system..."
4737         $cat >usr.c <<'EOCP'
4738 #ifdef SYSTYPE_BSD43
4739 /bsd43
4740 #endif
4741 EOCP
4742         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4743                 dflt='/bsd43/usr/include'
4744                 incpath='/bsd43'
4745                 mips_type='BSD 4.3'
4746         else
4747                 mips_type='System V'
4748         fi
4749         $rm -f usr.c usr.out
4750         echo "and you're compiling with the $mips_type compiler and libraries."
4751         xxx_prompt=y
4752         echo "exit 0" >mips
4753 else
4754         echo "Doesn't look like a MIPS system."
4755         xxx_prompt=n
4756         echo "exit 1" >mips
4757 fi
4758 chmod +x mips
4759 $eunicefix mips
4760 case "$usrinc" in
4761 '') ;;
4762 *) dflt="$usrinc";;
4763 esac
4764 case "$xxx_prompt" in
4765 y)      fn=d/
4766         echo " "
4767         rp='Where are the include files you want to use?'
4768         . ./getfile
4769         usrinc="$ans"
4770         ;;
4771 *)      usrinc="$dflt"
4772         ;;
4773 esac
4774
4775 : see how we invoke the C preprocessor
4776 echo " "
4777 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4778 cat <<'EOT' >testcpp.c
4779 #define ABC abc
4780 #define XYZ xyz
4781 ABC.XYZ
4782 EOT
4783 cd ..
4784 if test ! -f cppstdin; then
4785         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4786                 # AIX cc -E doesn't show the absolute headerfile
4787                 # locations but we'll cheat by using the -M flag.
4788                 echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; test -s .$$.u && awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' > cppstdin
4789         else
4790                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4791         fi
4792 else
4793         echo "Keeping your $hint cppstdin wrapper."
4794 fi
4795 chmod 755 cppstdin
4796 wrapper=`pwd`/cppstdin
4797 ok='false'
4798 cd UU
4799
4800 if $test "X$cppstdin" != "X" && \
4801         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4802         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4803 then
4804         echo "You used to use $cppstdin $cppminus so we'll use that again."
4805         case "$cpprun" in
4806         '') echo "But let's see if we can live without a wrapper..." ;;
4807         *)
4808                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4809                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4810                 then
4811                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4812                         ok='true'
4813                 else
4814                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4815                 fi
4816                 ;;
4817         esac
4818 else
4819         case "$cppstdin" in
4820         '') ;;
4821         *)
4822                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4823                 ;;
4824         esac
4825 fi
4826
4827 if $ok; then
4828         : nothing
4829 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4830         $cc -E <testcpp.c >testcpp.out 2>&1; \
4831         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4832         echo "Yup, it does."
4833         x_cpp="$cc $cppflags -E"
4834         x_minus='';
4835 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4836         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4837         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4838         echo "Yup, it does."
4839         x_cpp="$cc $cppflags -E"
4840         x_minus='-';
4841 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4842         $cc -P <testcpp.c >testcpp.out 2>&1; \
4843         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4844         echo "Yipee, that works!"
4845         x_cpp="$cc $cppflags -P"
4846         x_minus='';
4847 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4848         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4849         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4850         echo "At long last!"
4851         x_cpp="$cc $cppflags -P"
4852         x_minus='-';
4853 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4854         $cpp <testcpp.c >testcpp.out 2>&1; \
4855         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4856         echo "It works!"
4857         x_cpp="$cpp $cppflags"
4858         x_minus='';
4859 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4860         $cpp - <testcpp.c >testcpp.out 2>&1; \
4861         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4862         echo "Hooray, it works!  I was beginning to wonder."
4863         x_cpp="$cpp $cppflags"
4864         x_minus='-';
4865 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4866         $wrapper <testcpp.c >testcpp.out 2>&1; \
4867         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4868         x_cpp="$wrapper"
4869         x_minus=''
4870         echo "Eureka!"
4871 else
4872         dflt=''
4873         rp="No dice.  I can't find a C preprocessor.  Name one:"
4874         . ./myread
4875         x_cpp="$ans"
4876         x_minus=''
4877         $x_cpp <testcpp.c >testcpp.out 2>&1
4878         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4879                 echo "OK, that will do." >&4
4880         else
4881 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4882                 exit 1
4883         fi
4884 fi
4885
4886 case "$ok" in
4887 false)
4888         cppstdin="$x_cpp"
4889         cppminus="$x_minus"
4890         cpprun="$x_cpp"
4891         cpplast="$x_minus"
4892         set X $x_cpp
4893         shift
4894         case "$1" in
4895         "$cpp")
4896                 echo "Perhaps can we force $cc -E using a wrapper..."
4897                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4898                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4899                 then
4900                         echo "Yup, we can."
4901                         cppstdin="$wrapper"
4902                         cppminus='';
4903                 else
4904                         echo "Nope, we'll have to live without it..."
4905                 fi
4906                 ;;
4907         esac
4908         case "$cpprun" in
4909         "$wrapper")
4910                 cpprun=''
4911                 cpplast=''
4912                 ;;
4913         esac
4914         ;;
4915 esac
4916
4917 case "$cppstdin" in
4918 "$wrapper"|'cppstdin') ;;
4919 *) $rm -f $wrapper;;
4920 esac
4921 $rm -f testcpp.c testcpp.out
4922
4923 : Adjust cppfilter for path component separator
4924 case "$osname" in
4925 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4926 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4927 *)   cppfilter='' ;;
4928 esac
4929
4930 : Use gcc to determine libpth and incpth
4931 # If using gcc or clang, we can get better values for libpth, incpth
4932 # and usrinc directly from the compiler.
4933 # Note that ccname for clang is also gcc.
4934 case "$ccname" in
4935     gcc)
4936         $echo 'extern int foo;' > try.c
4937         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4938         shift
4939         if $test $# -gt 0; then
4940             incpth="$incpth $*"
4941             incpth="`$echo $incpth|$sed 's/^ //'`"
4942             for i in $*; do
4943                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4944                 if $test -d $j; then
4945                     libpth="$libpth $j"
4946                 fi
4947             done
4948             libpth="`$echo $libpth|$sed 's/^ //'`"
4949             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4950                 if $test -d $xxx; then
4951                     case " $libpth " in
4952                     *" $xxx "*) ;;
4953                     *) libpth="$libpth $xxx";;
4954                     esac
4955                 fi
4956             done
4957         fi
4958         $rm -f try.c
4959         case "$usrinc" in
4960         '') for i in $incpth; do
4961                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4962                     usrinc="$i"
4963                     break
4964                 fi
4965             done
4966             ;;
4967         esac
4968
4969         case "$usecrosscompile" in
4970         $define|true|[yY]*)
4971             case "$incpth" in
4972                 '') echo "Incpth not defined." >&4; croak=y ;;
4973                 *)  echo "Using incpth '$incpth'." >&4 ;;
4974             esac
4975             case "$libpth" in
4976                 '') echo "Libpth not defined." >&4; croak=y ;;
4977                 *)  echo "Using libpth '$libpth'." >&4 ;;
4978             esac
4979             case "$usrinc" in
4980                 '') echo "Usrinc not defined." >&4; croak=y ;;
4981                 *)  echo "Using usrinc $usrinc." >&4 ;;
4982             esac
4983             case "$croak" in
4984                 y)
4985                 if test "X$sysroot" = X; then
4986                     echo "Cannot continue, aborting." >&4; exit 1
4987                 else
4988                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
4989                 fi
4990                 ;;
4991             esac
4992             ;;
4993         esac
4994     ;;
4995 esac
4996
4997 : Default value for incpth is just usrinc
4998 case "$incpth" in
4999 '') incpth="$usrinc";;
5000 esac
5001
5002 : Set private lib path
5003 case "$plibpth" in
5004 '') if ./mips; then
5005         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5006     fi;;
5007 esac
5008 case "$libpth" in
5009 ' ') dlist='';;
5010 '') dlist="$loclibpth $plibpth $glibpth";;
5011 *) dlist="$libpth";;
5012 esac
5013
5014 : Now check and see which directories actually exist, avoiding duplicates
5015 for xxx in $dlist
5016 do
5017     if $test -d $xxx; then
5018                 case " $libpth " in
5019                 *" $xxx "*) ;;
5020                 *) libpth="$libpth $xxx";;
5021                 esac
5022     fi
5023 done
5024 $cat <<'EOM'
5025
5026 Some systems have incompatible or broken versions of libraries.  Among
5027 the directories listed in the question below, please remove any you
5028 know not to be holding relevant libraries, and add any that are needed.
5029 Say "none" for none.
5030
5031 EOM
5032
5033 if test "X$sysroot" != X; then
5034     $cat <<EOM
5035 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5036
5037 EOM
5038 fi
5039
5040 case "$libpth" in
5041 '') dflt='none';;
5042 *)
5043         set X $libpth
5044         shift
5045         dflt=${1+"$@"}
5046         ;;
5047 esac
5048 rp="Directories to use for library searches?"
5049 . ./myread
5050 case "$ans" in
5051 none) libpth=' ';;
5052 *) libpth="$ans";;
5053 esac
5054
5055 : compute shared library extension
5056 case "$so" in
5057 '')
5058         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5059                 dflt='sl'
5060         else
5061                 dflt='so'
5062         fi
5063         ;;
5064 *) dflt="$so";;
5065 esac
5066 $cat <<EOM
5067
5068 On some systems, shared libraries may be available.  Answer 'none' if
5069 you want to suppress searching of shared libraries for the remainder
5070 of this configuration.
5071
5072 EOM
5073 rp='What is the file extension used for shared libraries?'
5074 . ./myread
5075 so="$ans"
5076
5077 : Does target system insist that shared library basenames are unique
5078 $cat << EOM
5079
5080 Some dynamic loaders assume that the *basename* of shared library filenames
5081 are globally unique.  We'll default this to undef as we assume your system
5082 is not this weird. Set to defined if you're on one of them.
5083
5084 EOM
5085
5086 dflt='n'
5087 rp='Make shared library basenames unique?'
5088 . ./myread
5089 case "$ans" in
5090 y|Y) val="$define" ;;
5091 *)   val="$undef"  ;;
5092 esac
5093 set d_libname_unique
5094 eval $setvar
5095
5096 : Define several unixisms.
5097 : Hints files or command line option can be used to override them.
5098 : The convoluted testing is in case hints files set either the old
5099 : or the new name.
5100 case "$_exe" in
5101 '')     case "$exe_ext" in
5102         '')     ;;
5103         *)      _exe="$exe_ext" ;;
5104         esac
5105         ;;
5106 esac
5107 case "$_a" in
5108 '')     case "$lib_ext" in
5109     '') _a='.a';;
5110         *)      _a="$lib_ext" ;;
5111         esac
5112         ;;
5113 esac
5114 case "$_o" in
5115 '') case "$obj_ext" in
5116         '')     _o='.o';;
5117         *)      _o="$obj_ext";;
5118         esac
5119         ;;
5120 esac
5121 case "$p_" in
5122 '') case "$path_sep" in
5123         '')     p_=':';;
5124         *)      p_="$path_sep";;
5125         esac
5126         ;;
5127 esac
5128 exe_ext=$_exe
5129 lib_ext=$_a
5130 obj_ext=$_o
5131 path_sep=$p_
5132
5133 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5134
5135 : Which makefile gets called first.  This is used by make depend.
5136 case "$firstmakefile" in
5137 '') firstmakefile='makefile';;
5138 esac
5139
5140 : Check is we will use socks
5141 case "$usesocks" in
5142 $define|true|[yY]*)     dflt='y';;
5143 *) dflt='n';;
5144 esac
5145 cat <<EOM
5146
5147 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5148 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5149 to use the PerlIO abstraction layer, this will be implicitly selected.
5150
5151 If this doesn't make any sense to you, just accept the default '$dflt'.
5152 EOM
5153 rp='Build Perl for SOCKS?'
5154 . ./myread
5155 case "$ans" in
5156 y|Y)    val="$define" ;;
5157 *)      val="$undef" ;;
5158 esac
5159 set usesocks
5160 eval $setvar
5161
5162 : Check for uselongdouble support
5163 case "$ccflags" in
5164 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5165 esac
5166
5167 case "$uselongdouble" in
5168 $define|true|[yY]*)     dflt='y';;
5169 *) dflt='n';;
5170 esac
5171 cat <<EOM
5172
5173 Perl can be built to take advantage of long doubles which
5174 (if available) may give more accuracy and range for floating point numbers.
5175
5176 If this doesn't make any sense to you, just accept the default '$dflt'.
5177 EOM
5178 rp='Try to use long doubles if available?'
5179 . ./myread
5180 case "$ans" in
5181 y|Y)    val="$define"   ;;
5182 *)      val="$undef"    ;;
5183 esac
5184 set uselongdouble
5185 eval $setvar
5186
5187 case "$uselongdouble" in
5188 true|[yY]*) uselongdouble="$define" ;;
5189 esac
5190
5191 : Look for a hint-file generated 'call-back-unit'.  If the
5192 : user has specified that long doubles should be used,
5193 : we may need to set or change some other defaults.
5194 if $test -f uselongdouble.cbu; then
5195     echo "Your platform has some specific hints regarding long doubles, using them..."
5196     . ./uselongdouble.cbu
5197 else
5198     case "$uselongdouble" in
5199         $define)
5200                 $cat <<EOM
5201 (Your platform does not have any specific hints for long doubles.)
5202 EOM
5203         ;;
5204     esac
5205 fi
5206
5207 : Check if quadmath is requested
5208 case "$usequadmath" in
5209 "$define"|true|[yY]*) usequadmath="$define" ;;
5210 *)                    usequadmath="$undef"  ;;
5211 esac
5212
5213 : Looking for optional libraries
5214 echo " "
5215 echo "Checking for optional libraries..." >&4
5216 case "$libs" in
5217 ' '|'') dflt='';;
5218 *) dflt="$libs";;
5219 esac
5220 case "$libswanted" in
5221 '') libswanted='c_s';;
5222 esac
5223 case "$usesocks" in
5224 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5225 esac
5226 case "$usecbacktrace" in
5227 "$define") libswanted="$libswanted bfd" ;;
5228 esac
5229 case "$usequadmath" in
5230 "$define") libswanted="$libswanted quadmath" ;;
5231 esac
5232 libsfound=''
5233 libsfiles=''
5234 libsdirs=''
5235 libspath=''
5236 for thisdir in $libpth $xlibpth; do
5237   test -d $thisdir && libspath="$libspath $thisdir"
5238 done
5239 for thislib in $libswanted; do
5240         for thisdir in $libspath; do
5241             xxx=''
5242             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5243                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5244                 $test -f "$xxx" && eval $libscheck
5245                 $test -f "$xxx" && libstyle=shared
5246                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5247                 $test -f "$xxx" && eval $libscheck
5248                 $test -f "$xxx" && libstyle=shared
5249             fi
5250             if test ! -f "$xxx"; then
5251                 xxx=$thisdir/lib$thislib.$so
5252                 $test -f "$xxx" && eval $libscheck
5253                 $test -f "$xxx" && libstyle=shared
5254             fi
5255             if test ! -f "$xxx"; then
5256                 xxx=$thisdir/lib$thislib$_a
5257                 $test -f "$xxx" && eval $libscheck
5258                 $test -f "$xxx" && libstyle=static
5259             fi
5260             if test ! -f "$xxx"; then
5261                 xxx=$thisdir/$thislib$_a
5262                 $test -f "$xxx" && eval $libscheck
5263                 $test -f "$xxx" && libstyle=static
5264             fi
5265             if test ! -f "$xxx"; then
5266                 xxx=$thisdir/lib${thislib}_s$_a
5267                 $test -f "$xxx" && eval $libscheck
5268                 $test -f "$xxx" && libstyle=static
5269                 $test -f "$xxx" && thislib=${thislib}_s
5270             fi
5271             if test ! -f "$xxx"; then
5272                 xxx=$thisdir/Slib$thislib$_a
5273                 $test -f "$xxx" && eval $libscheck
5274                 $test -f "$xxx" && libstyle=static
5275             fi
5276             if $test -f "$xxx"; then
5277                 case "$libstyle" in
5278                 shared) echo "Found -l$thislib (shared)." ;;
5279                 static) echo "Found -l$thislib." ;;
5280                 *)      echo "Found -l$thislib ($libstyle)." ;;
5281                 esac
5282                 case " $dflt " in
5283                 *"-l$thislib "*);;
5284                 *) dflt="$dflt -l$thislib"
5285                    libsfound="$libsfound $xxx"
5286                    yyy=`basename $xxx`
5287                    libsfiles="$libsfiles $yyy"
5288                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5289                    case " $libsdirs " in
5290                    *" $yyy "*) ;;
5291                    *) libsdirs="$libsdirs $yyy" ;;
5292                    esac
5293                    ;;
5294                 esac
5295                 break
5296             fi
5297         done
5298         if $test ! -f "$xxx"; then
5299             echo "No -l$thislib."
5300         fi
5301 done
5302 set X $dflt
5303 shift
5304 dflt="$*"
5305 case "$libs" in
5306 '') dflt="$dflt";;
5307 *) dflt="$libs";;
5308 esac
5309 case "$dflt" in
5310 ' '|'') dflt='none';;
5311 esac
5312
5313 $cat <<EOM
5314
5315 In order to compile $package on your machine, a number of libraries
5316 are usually needed.  Include any other special libraries here as well.
5317 Say "none" for none.  The default list is almost always right.
5318 EOM
5319
5320 echo " "
5321 rp="What libraries to use?"
5322 . ./myread
5323 case "$ans" in
5324 none) libs=' ';;
5325 *) libs="$ans";;
5326 esac
5327
5328 : determine optimization, if desired, or use for debug flag also
5329 case "$optimize" in
5330 ' '|$undef) dflt='none';;
5331 '') dflt='-O';;
5332 *) dflt="$optimize";;
5333 esac
5334 $cat <<EOH
5335
5336 By default, $package compiles with the -O flag to use the optimizer.
5337 Alternately, you might want to use the symbolic debugger, which uses
5338 the -g flag (on traditional Unix systems).  Either flag can be
5339 specified here.  To use neither flag, specify the word "none".
5340
5341 EOH
5342 rp="What optimizer/debugger flag should be used?"
5343 . ./myread
5344 optimize="$ans"
5345 case "$optimize" in
5346 'none') optimize=" ";;
5347 esac
5348
5349 : Check what DEBUGGING is required from the command line
5350 : -DEBUGGING      or -DDEBUGGING or
5351 : -DEBUGGING=both                       = -g + -DDEBUGGING
5352 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5353 : -DEBUGGING=none or -UDEBUGGING        =
5354 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5355 case "$EBUGGING" in
5356 '')     ;;
5357 *)      DEBUGGING=$EBUGGING ;;
5358 esac
5359
5360 case "$DEBUGGING" in
5361 -g|both|$define)
5362     case "$optimize" in
5363         *-g*) ;;
5364         *)    optimize="$optimize -g" ;;
5365     esac ;;
5366 none|$undef)
5367     case "$optimize" in
5368         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5369                 shift
5370                 optimize="$*"
5371                 ;;
5372     esac ;;
5373 esac
5374
5375 dflt=''
5376 case "$DEBUGGING" in
5377 both|$define) dflt='-DDEBUGGING'
5378 esac
5379
5380 : argument order is deliberate, as the flag will start with - which set could
5381 : think is an option
5382 checkccflag='check=$1; flag=$2; callback=$3;
5383 echo " ";
5384 echo "Checking if your compiler accepts $flag" 2>&1;
5385 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5386 echo "int main(void) { return 0; }" > gcctest.c;
5387 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5388     echo "Yes, it does." 2>&1;
5389     if $test -s gcctest.out ; then
5390         echo "But your platform does not like it:";
5391         cat gcctest.out;
5392     else
5393         case "$ccflags" in
5394         *$check*)
5395             echo "Leaving current flags $ccflags alone." 2>&1
5396             ;;
5397         *) dflt="$dflt $flag";
5398             eval $callback
5399             ;;
5400         esac
5401     fi
5402 else
5403     echo "Nope, it does not, but that is ok." 2>&1;
5404 fi
5405 '
5406
5407 : We will not override a previous value, but we might want to
5408 : augment a hint file
5409 case "$hint" in
5410 default|recommended)
5411         case "$gccversion" in
5412         1*) dflt="$dflt -fpcc-struct-return" ;;
5413         esac
5414         case "$optimize:$DEBUGGING" in
5415         *-g*:old) dflt="$dflt -DDEBUGGING";;
5416         esac
5417         case "$gccversion" in
5418         2*) if $test -d /etc/conf/kconfig.d &&
5419                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5420                 then
5421                         # Interactive Systems (ISC) POSIX mode.
5422                         dflt="$dflt -posix"
5423                 fi
5424                 ;;
5425         esac
5426         case "$gccversion" in
5427         1*) ;;
5428         2.[0-8]*) ;;
5429         ?*)     set strict-aliasing -fno-strict-aliasing
5430                 eval $checkccflag
5431                 ;;
5432         esac
5433         # For gcc, adding -pipe speeds up compilations for some, but apparently
5434         # some assemblers can't read from stdin.  (It also slows down compilations
5435         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5436         case "$gccversion" in
5437         ?*)     set pipe -pipe
5438                 eval $checkccflag
5439                 ;;
5440         esac
5441
5442         # on x86_64 (at least) we require an extra library (libssp) in the
5443         # link command line. This library is not named, so I infer that it is
5444         # an implementation detail that may change. Hence the safest approach
5445         # is to add the flag to the flags passed to the compiler at link time,
5446         # as that way the compiler can do the right implementation dependant
5447         # thing. (NWC)
5448         case "$gccversion" in
5449         ?*)     set stack-protector-strong -fstack-protector-strong
5450                 eval $checkccflag
5451                 case "$dflt" in
5452                 *-fstack-protector-strong*) ;; # It got added.
5453                 *) # Try the plain/older -fstack-protector.
5454                    set stack-protector -fstack-protector
5455                    eval $checkccflag
5456                    ;;
5457                 esac
5458                 ;;
5459         esac
5460         ;;
5461 esac
5462
5463 case "$mips_type" in
5464 *BSD*|'') inclwanted="$locincpth $usrinc";;
5465 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5466 esac
5467 for thisincl in $inclwanted; do
5468         if $test -d $thisincl; then
5469                 if $test x$thisincl != x$usrinc; then
5470                         case "$dflt" in
5471                         *" -I$thisincl "*);;
5472                         *) dflt="$dflt -I$thisincl ";;
5473                         esac
5474                 fi
5475         fi
5476 done
5477
5478 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5479         xxx=true;
5480 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5481         xxx=true;
5482 else
5483         xxx=false;
5484 fi;
5485 if $xxx; then
5486         case "$dflt" in
5487         *$2*);;
5488         *) dflt="$dflt -D$2";;
5489         esac;
5490 fi'
5491
5492 set signal.h LANGUAGE_C; eval $inctest
5493
5494 case "$usesocks" in
5495 $define)
5496         ccflags="$ccflags -DSOCKS"
5497         ;;
5498 esac
5499
5500 case "$hint" in
5501 default|recommended) dflt="$ccflags $dflt" ;;
5502 *) dflt="$ccflags";;
5503 esac
5504
5505 case "$dflt" in
5506 ''|' ') dflt=none;;
5507 esac
5508
5509 $cat <<EOH
5510
5511 Your C compiler may want other flags.  For this question you should include
5512 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5513 but you should NOT include libraries or ld flags like -lwhatever.  If you
5514 want $package to honor its debug switch, you should include -DDEBUGGING here.
5515 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5516
5517 To use no flags, specify the word "none".
5518
5519 EOH
5520 set X $dflt
5521 shift
5522 dflt=${1+"$@"}
5523 rp="Any additional cc flags?"
5524 . ./myread
5525 case "$ans" in
5526 none) ccflags='';;
5527 *) ccflags="$ans";;
5528 esac
5529
5530 : the following weeds options from ccflags that are of no interest to cpp
5531 case "$cppflags" in
5532 '') cppflags="$ccflags" ;;
5533 *)  cppflags="$cppflags $ccflags" ;;
5534 esac
5535 case "$gccversion" in
5536 1*) cppflags="$cppflags -D__GNUC__"
5537 esac
5538 case "$mips_type" in
5539 '');;
5540 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5541 esac
5542 case "$cppflags" in
5543 '');;
5544 *)
5545         echo " "
5546         echo "Let me guess what the preprocessor flags are..." >&4
5547         set X $cppflags
5548         shift
5549         cppflags=''
5550         $cat >cpp.c <<'EOM'
5551 #define BLURFL foo
5552
5553 BLURFL xx LFRULB
5554 EOM
5555         previous=''
5556         for flag in $*
5557         do
5558                 case "$flag" in
5559                 -*) ftry="$flag";;
5560                 *) ftry="$previous $flag";;
5561                 esac
5562                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5563                         >cpp1.out 2>/dev/null && \
5564                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5565                         >cpp2.out 2>/dev/null && \
5566                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5567                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5568                 then
5569                         cppflags="$cppflags $ftry"
5570                         previous=''
5571                 else
5572                         previous="$flag"
5573                 fi
5574         done
5575         set X $cppflags
5576         shift
5577         cppflags=${1+"$@"}
5578         case "$cppflags" in
5579         *-*)  echo "They appear to be: $cppflags";;
5580         esac
5581         $rm -f cpp.c cpp?.out
5582         ;;
5583 esac
5584
5585 : flags used in final linking phase
5586 case "$ldflags" in
5587 '') if ./venix; then
5588                 dflt='-i -z'
5589         else
5590                 dflt=''
5591         fi
5592         case "$ccflags" in
5593         *-posix*) dflt="$dflt -posix" ;;
5594         esac
5595         ;;
5596 *) dflt="$ldflags";;
5597 esac
5598 # See note above about -fstack-protector
5599 case "$ccflags" in
5600 *-fstack-protector-strong*)
5601         case "$dflt" in
5602         *-fstack-protector-strong*) ;; # Don't add it again
5603         *) dflt="$dflt -fstack-protector-strong" ;;
5604         esac
5605         ;;
5606 *-fstack-protector*)
5607         case "$dflt" in
5608         *-fstack-protector*) ;; # Don't add it again
5609         *) dflt="$dflt -fstack-protector" ;;
5610         esac
5611         ;;
5612 esac
5613
5614 : Try to guess additional flags to pick up local libraries.
5615 for thislibdir in $libpth; do
5616         case " $loclibpth " in
5617         *" $thislibdir "*)
5618                 case "$dflt " in
5619                 *"-L$thislibdir "*) ;;
5620                 *)  dflt="$dflt -L$thislibdir" ;;
5621                 esac
5622                 ;;
5623         esac
5624 done
5625
5626 case "$dflt" in
5627 '') dflt='none' ;;
5628 esac
5629
5630 $cat <<EOH
5631
5632 Your C linker may need flags.  For this question you should
5633 include -L/whatever and any other flags used by the C linker, but you
5634 should NOT include libraries like -lwhatever.
5635
5636 Make sure you include the appropriate -L/path flags if your C linker
5637 does not normally search all of the directories you specified above,
5638 namely
5639         $libpth
5640 To use no flags, specify the word "none".
5641
5642 EOH
5643
5644 rp="Any additional ld flags (NOT including libraries)?"
5645 . ./myread
5646 case "$ans" in
5647 none) ldflags='';;
5648 *) ldflags="$ans";;
5649 esac
5650 rmlist="$rmlist pdp11"
5651
5652 : coherency check
5653 echo " "
5654 echo "Checking your choice of C compiler and flags for coherency..." >&4
5655 $cat > try.c <<'EOF'
5656 #include <stdio.h>
5657 int main() { printf("Ok\n"); return(0); }
5658 EOF
5659 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5660 shift
5661 $cat >try.msg <<'EOM'
5662 I've tried to compile and run the following simple program:
5663
5664 EOM
5665 $cat try.c >> try.msg
5666
5667 $cat >> try.msg <<EOM
5668
5669 I used the command:
5670
5671         $*
5672         $run ./try
5673
5674 and I got the following output:
5675
5676 EOM
5677 dflt=y
5678 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5679         if $sh -c "$run ./try " >>try.msg 2>&1; then
5680                 xxx=`$run ./try`
5681                 case "$xxx" in
5682                 "Ok") dflt=n ;;
5683                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5684                 esac
5685         else
5686                 echo "The program compiled OK, but exited with status $?." >>try.msg
5687                 rp="You have a problem.  Shall I abort Configure"
5688                 dflt=y
5689         fi
5690 else
5691         echo "I can't compile the test program." >>try.msg
5692         rp="You have a BIG problem.  Shall I abort Configure"
5693         dflt=y
5694 fi
5695 case "$dflt" in
5696 y)
5697         $cat try.msg >&4
5698         case "$knowitall" in
5699         '')
5700                 echo "(The supplied flags or libraries might be incorrect.)"
5701                 ;;
5702         *) dflt=n;;
5703         esac
5704         echo " "
5705         . ./myread
5706         case "$ans" in
5707         n*|N*) ;;
5708         *)      echo "Ok.  Stopping Configure." >&4
5709                 exit 1
5710                 ;;
5711         esac
5712         ;;
5713 n) echo "OK, that should do.";;
5714 esac
5715 $rm_try gcctest gcctest.out
5716
5717 : define a shorthand compile call
5718 compile='
5719 mc_file=$1;
5720 shift;
5721 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5722 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5723 exit 1;
5724 fi;
5725 esac;
5726 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5727 : define a shorthand compile call for compilations that should be ok.
5728 compile_ok='
5729 mc_file=$1;
5730 shift;
5731 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5732
5733 : determine filename position in cpp output
5734 echo " "
5735 echo "Computing filename position in cpp output for #include directives..." >&4
5736 case "$osname" in
5737 vos) testaccess=-e ;;
5738 *)   testaccess=-r ;;
5739 esac
5740 echo '#include <stdio.h>' > foo.c
5741 $cat >fieldn <<EOF
5742 $startsh
5743 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5744 $grep '^[       ]*#.*stdio\.h' | \
5745 while read cline; do
5746         pos=1
5747         set \$cline
5748         while $test \$# -gt 0; do
5749                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5750                         echo "\$pos"
5751                         exit 0
5752                 fi
5753                 shift
5754                 pos=\`expr \$pos + 1\`
5755         done
5756 done
5757 EOF
5758 chmod +x fieldn
5759 fieldn=`./fieldn`
5760 $rm -f foo.c fieldn
5761 case $fieldn in
5762 '') pos='???';;
5763 1) pos=first;;
5764 2) pos=second;;
5765 3) pos=third;;
5766 *) pos="${fieldn}th";;
5767 esac
5768 echo "Your cpp writes the filename in the $pos field of the line."
5769
5770 : locate header file
5771 $cat >findhdr <<EOF
5772 $startsh
5773 wanted=\$1
5774 name=''
5775 for usrincdir in $incpth
5776 do
5777         if test -f \$usrincdir/\$wanted; then
5778                 echo "\$usrincdir/\$wanted"
5779                 exit 0
5780         fi
5781 done
5782 awkprg='{ print \$$fieldn }'
5783 echo "#include <\$wanted>" > foo\$\$.c
5784 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5785 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5786 while read cline; do
5787         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5788         case "\$name" in
5789         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5790         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5791         *) exit 2;;
5792         esac;
5793 done;
5794 #
5795 # status = 0: grep returned 0 lines, case statement not executed
5796 # status = 1: headerfile found
5797 # status = 2: while loop executed, no headerfile found
5798 #
5799 status=\$?
5800 $rm -f foo\$\$.c;
5801 if test \$status -eq 1; then
5802         exit 0;
5803 fi
5804 exit 1
5805 EOF
5806 chmod +x findhdr
5807
5808 : define an alternate in-header-list? function
5809 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5810 cont=true; xxf="echo \"<\$1> found.\" >&4";
5811 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5812 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5813 esac;
5814 case $# in 4) instead=instead;; *) instead="at last";; esac;
5815 while $test "$cont"; do
5816         xxx=`./findhdr $1`
5817         var=$2; eval "was=\$$2";
5818         if $test "$xxx" && $test -r "$xxx";
5819         then eval $xxf;
5820         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5821                 cont="";
5822         else eval $xxnf;
5823         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5824         set $yyy; shift; shift; yyy=$@;
5825         case $# in 0) cont="";;
5826         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5827                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5828         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5829                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5830         esac;
5831 done;
5832 while $test "$yyy";
5833 do set $yyy; var=$2; eval "was=\$$2";
5834         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5835         set $yyy; shift; shift; yyy=$@;
5836 done'
5837
5838 : see if stdlib is available
5839 set stdlib.h i_stdlib
5840 eval $inhdr
5841
5842 : check for lengths of integral types
5843 echo " "
5844 case "$intsize" in
5845 '')
5846         echo "Checking to see how big your integers are..." >&4
5847         $cat >try.c <<EOCP
5848 #include <stdio.h>
5849 #$i_stdlib I_STDLIB
5850 #ifdef I_STDLIB
5851 #include <stdlib.h>
5852 #endif
5853 int main()
5854 {
5855         printf("intsize=%d;\n", (int)sizeof(int));
5856         printf("longsize=%d;\n", (int)sizeof(long));
5857         printf("shortsize=%d;\n", (int)sizeof(short));
5858         exit(0);
5859 }
5860 EOCP
5861         set try
5862         if eval $compile_ok && $run ./try > /dev/null; then
5863                 eval `$run ./try`
5864                 echo "Your integers are $intsize bytes long."
5865                 echo "Your long integers are $longsize bytes long."
5866                 echo "Your short integers are $shortsize bytes long."
5867         else
5868                 $cat >&4 <<EOM
5869 !
5870 Help! I can't compile and run the intsize test program: please enlighten me!
5871 (This is probably a misconfiguration in your system or libraries, and
5872 you really ought to fix it.  Still, I'll try anyway.)
5873 !
5874 EOM
5875                 dflt=4
5876                 rp="What is the size of an integer (in bytes)?"
5877                 . ./myread
5878                 intsize="$ans"
5879                 dflt=$intsize
5880                 rp="What is the size of a long integer (in bytes)?"
5881                 . ./myread
5882                 longsize="$ans"
5883                 dflt=2
5884                 rp="What is the size of a short integer (in bytes)?"
5885                 . ./myread
5886                 shortsize="$ans"
5887         fi
5888         ;;
5889 esac
5890 $rm_try
5891
5892 : check for long long
5893 echo " "
5894 echo "Checking to see if you have long long..." >&4
5895 echo 'int main() { long long x = 7; return 0; }' > try.c
5896 set try
5897 if eval $compile; then
5898         val="$define"
5899         echo "You have long long."
5900 else
5901         val="$undef"
5902         echo "You do not have long long."
5903 fi
5904 $rm_try
5905 set d_longlong
5906 eval $setvar
5907
5908 : check for length of long long
5909 case "${d_longlong}${longlongsize}" in
5910 $define)
5911         echo " "
5912         echo "Checking to see how big your long longs are..." >&4
5913         $cat >try.c <<'EOCP'
5914 #include <stdio.h>
5915 int main()
5916 {
5917     printf("%d\n", (int)sizeof(long long));
5918     return(0);
5919 }
5920 EOCP
5921         set try
5922         if eval $compile_ok; then
5923                 longlongsize=`$run ./try`
5924                 echo "Your long longs are $longlongsize bytes long."
5925         else
5926                 dflt='8'
5927                 echo " "
5928                 echo "(I can't seem to compile the test program.  Guessing...)"
5929                 rp="What is the size of a long long (in bytes)?"
5930                 . ./myread
5931                 longlongsize="$ans"
5932         fi
5933         if $test "X$longsize" = "X$longlongsize"; then
5934                 echo "(That isn't any different from an ordinary long.)"
5935         fi
5936         ;;
5937 esac
5938 $rm_try
5939
5940 : see if inttypes.h is available
5941 : we want a real compile instead of Inhdr because some systems
5942 : have an inttypes.h which includes non-existent headers
5943 echo " "
5944 $cat >try.c <<EOCP
5945 #include <inttypes.h>
5946 int main() {
5947         static int32_t foo32 = 0x12345678;
5948 }
5949 EOCP
5950 set try
5951 if eval $compile; then
5952         echo "<inttypes.h> found." >&4
5953         val="$define"
5954 else
5955         echo "<inttypes.h> NOT found." >&4
5956         val="$undef"
5957 fi
5958 $rm_try
5959 set i_inttypes
5960 eval $setvar
5961
5962 : check for int64_t
5963 echo " "
5964 echo "Checking to see if you have int64_t..." >&4
5965 $cat >try.c <<EOCP
5966 #include <sys/types.h>
5967 #$i_inttypes I_INTTYPES
5968 #ifdef I_INTTYPES
5969 #include <inttypes.h>
5970 #endif
5971 int main() { int64_t x = 7; }
5972 EOCP
5973 set try
5974 if eval $compile; then
5975         val="$define"
5976         echo "You have int64_t."
5977 else
5978         val="$undef"
5979         echo "You do not have int64_t."
5980 fi
5981 $rm_try
5982 set d_int64_t
5983 eval $setvar
5984
5985 : Check if 64bit ints have a quad type
5986 echo " "
5987 echo "Checking which 64-bit integer type we could use..." >&4
5988
5989 case "$intsize" in
5990 8) val=int
5991    set quadtype
5992    eval $setvar
5993    val='"unsigned int"'
5994    set uquadtype
5995    eval $setvar
5996    quadkind=1
5997    ;;
5998 *) case "$longsize" in
5999    8) val=long
6000       set quadtype
6001       eval $setvar
6002       val='"unsigned long"'
6003       set uquadtype
6004       eval $setvar
6005       quadkind=2
6006       ;;
6007    *) case "$d_longlong:$longlongsize" in
6008       define:8)
6009         val='"long long"'
6010         set quadtype
6011         eval $setvar
6012         val='"unsigned long long"'
6013         set uquadtype
6014         eval $setvar
6015         quadkind=3
6016         ;;
6017       *) case "$d_int64_t" in
6018          define)
6019            val=int64_t
6020            set quadtype
6021            eval $setvar
6022            val=uint64_t
6023            set uquadtype
6024            eval $setvar
6025            quadkind=4
6026            ;;
6027          esac
6028          ;;
6029       esac
6030       ;;
6031    esac
6032    ;;
6033 esac
6034
6035 case "$quadtype" in
6036 '')     echo "Alas, no 64-bit integer types in sight." >&4
6037         d_quad="$undef"
6038         ;;
6039 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6040         d_quad="$define"
6041         ;;
6042 esac
6043
6044 : Do we want 64bit support
6045 case "$uselonglong" in
6046 "$define"|true|[yY]*)
6047         cat <<EOM >&4
6048
6049 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6050 EOM
6051         use64bitint="$define"
6052         ;;
6053 esac
6054 case "$use64bits" in
6055 "$define"|true|[yY]*)
6056         cat <<EOM >&4
6057
6058 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6059 EOM
6060         use64bitint="$define"
6061         ;;
6062 esac
6063 case "$use64bitints" in
6064 "$define"|true|[yY]*)
6065         cat <<EOM >&4
6066
6067 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6068 EOM
6069         use64bitint="$define"
6070         ;;
6071 esac
6072 case "$use64bitsint" in
6073 "$define"|true|[yY]*)
6074         cat <<EOM >&4
6075
6076 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6077 EOM
6078         use64bitint="$define"
6079         ;;
6080 esac
6081 case "$uselonglongs" in
6082 "$define"|true|[yY]*)
6083         cat <<EOM >&4
6084
6085 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6086 EOM
6087         use64bitint="$define"
6088         ;;
6089 esac
6090 case "$use64bitsall" in
6091 "$define"|true|[yY]*)
6092         cat <<EOM >&4
6093
6094 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6095 EOM
6096         use64bitall="$define"
6097         ;;
6098 esac
6099
6100 case "$ccflags" in
6101 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6102 esac
6103 case "$use64bitall" in
6104 "$define"|true|[yY]*) use64bitint="$define" ;;
6105 esac
6106
6107 case "$longsize" in
6108 8) cat <<EOM
6109
6110 You have natively 64-bit long integers.
6111 EOM
6112    val="$define"
6113    ;;
6114 *) case "$use64bitint" in
6115    "$define"|true|[yY]*) dflt='y';;
6116    *) dflt='n';;
6117    esac
6118    case "$d_quad" in
6119    "$define") ;;
6120    *) dflt='n' ;;
6121    esac
6122    cat <<EOM
6123
6124 Perl can be built to take advantage of 64-bit integer types
6125 on some systems.  To do so, Configure can be run with -Duse64bitint.
6126 Choosing this option will most probably introduce binary incompatibilities.
6127
6128 If this doesn't make any sense to you, just accept the default '$dflt'.
6129 (The default has been chosen based on your configuration.)
6130 EOM
6131    rp='Try to use 64-bit integers, if available?'
6132    . ./myread
6133    case "$ans" in
6134    [yY]*) val="$define" ;;
6135    *)     val="$undef"  ;;
6136    esac
6137    ;;
6138 esac
6139 set use64bitint
6140 eval $setvar
6141
6142 case "$use64bitall" in
6143 "$define"|true|[yY]*) dflt='y' ;;
6144 *) case "$longsize" in
6145    8) dflt='y' ;;
6146    *) dflt='n' ;;
6147    esac
6148    ;;
6149 esac
6150 cat <<EOM
6151
6152 You may also choose to try maximal 64-bitness.  It means using as much
6153 64-bitness as possible on the platform.  This in turn means even more
6154 binary incompatibilities.  On the other hand, your platform may not
6155 have any more 64-bitness available than what you already have chosen.
6156
6157 If this doesn't make any sense to you, just accept the default '$dflt'.
6158 (The default has been chosen based on your configuration.)
6159 EOM
6160 rp='Try to use maximal 64-bit support, if available?'
6161 . ./myread
6162 case "$ans" in
6163 [yY]*) val="$define" ;;
6164 *)     val="$undef"  ;;
6165 esac
6166 set use64bitall
6167 eval $setvar
6168 case "$use64bitall" in
6169 "$define")
6170         case "$use64bitint" in
6171         "$undef")
6172                 cat <<EOM
6173
6174 Since you have chosen a maximally 64-bit build, I'm also turning on
6175 the use of 64-bit integers.
6176 EOM
6177                 use64bitint="$define" ;;
6178         esac
6179         ;;
6180 esac
6181
6182 : Look for a hint-file generated 'call-back-unit'.  If the
6183 : user has specified that a 64-bit perl is to be built,
6184 : we may need to set or change some other defaults.
6185 if $test -f use64bitint.cbu; then
6186         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6187         . ./use64bitint.cbu
6188 fi
6189 case "$use64bitint" in
6190 "$define"|true|[yY]*)
6191         : This test was common to all the OpenBSD forks, and seems harmless for
6192         : other platforms:
6193         echo " "
6194         echo "Checking if your C library has broken 64-bit functions..." >&4
6195         cat >try.c <<EOCP
6196 #include <stdio.h>
6197 typedef $uquadtype myULL;
6198 int main (void)
6199 {
6200     struct {
6201         double d;
6202         myULL  u;
6203     } *p, test[] = {
6204         {4294967303.15, 4294967303ULL},
6205         {4294967294.2,  4294967294ULL},
6206         {4294967295.7,  4294967295ULL},
6207         {0.0, 0ULL}
6208     };
6209     for (p = test; p->u; p++) {
6210         myULL x = (myULL)p->d;
6211         if (x != p->u) {
6212             printf("buggy\n");
6213             return 0;
6214         }
6215     }
6216     printf("ok\n");
6217     return 0;
6218 }
6219 EOCP
6220         set try
6221         if eval $compile_ok; then
6222             libcquad=`$run ./try`
6223             echo "Your C library's 64-bit functions are $libcquad."
6224         else
6225             echo "(I can't seem to compile the test program.)"
6226             echo "Assuming that your C library's 64-bit functions are ok."
6227             libcquad="ok"
6228         fi
6229         $rm_try
6230
6231         case "$libcquad" in
6232             buggy*)
6233                 cat >&4 <<EOM
6234
6235 *** You have a C library with broken 64-bit functions.
6236 *** 64-bit support does not work reliably in this configuration.
6237 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6238 *** Cannot continue, aborting.
6239
6240 EOM
6241                 exit 1
6242                 ;;
6243         esac
6244         case "$longsize" in
6245         4) case "$archname64" in
6246            '') archname64=64int ;;
6247            esac
6248            ;;
6249         esac
6250         ;;
6251 esac
6252
6253 : Look for a hint-file generated 'call-back-unit'.  If the
6254 : user has specified that a maximally 64-bit perl is to be built,
6255 : we may need to set or change some other defaults.
6256 if $test -f use64bitall.cbu; then
6257         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6258         . ./use64bitall.cbu
6259 fi
6260 case "$use64bitall" in
6261 "$define"|true|[yY]*)
6262         case "$longsize" in
6263         4) case "$archname64" in
6264            ''|64int) archname64=64all ;;
6265            esac
6266            ;;
6267         esac
6268         ;;
6269 esac
6270
6271 case "$d_quad:$use64bitint" in
6272 $undef:$define)
6273         cat >&4 <<EOF
6274
6275 *** You have chosen to use 64-bit integers,
6276 *** but none can be found.
6277 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6278 *** Cannot continue, aborting.
6279
6280 EOF
6281         exit 1
6282         ;;
6283 esac
6284
6285 : Check if we are using the GNU C library
6286 echo " "
6287 echo "Checking for GNU C Library..." >&4
6288 cat >try.c <<'EOCP'
6289 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6290    alone are insufficient to distinguish different versions, such as
6291    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6292    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6293 */
6294 #include <stdio.h>
6295 int main(void)
6296 {
6297 #ifdef __GLIBC__
6298 #   ifdef __GLIBC_MINOR__
6299 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6300 #           include <gnu/libc-version.h>
6301             printf("%s\n",  gnu_get_libc_version());
6302 #       else
6303             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6304 #       endif
6305 #   else
6306         printf("%d\n",  __GLIBC__);
6307 #   endif
6308     return 0;
6309 #else
6310     return 1;
6311 #endif
6312 }
6313 EOCP
6314 set try
6315 if eval $compile_ok && $run ./try > glibc.ver; then
6316         val="$define"
6317         gnulibc_version=`$cat glibc.ver`
6318         echo "You are using the GNU C Library version $gnulibc_version"
6319 else
6320         val="$undef"
6321         gnulibc_version=''
6322         echo "You are not using the GNU C Library"
6323 fi
6324 $rm_try glibc.ver
6325 set d_gnulibc
6326 eval $setvar
6327
6328 : see if nm is to be used to determine whether a symbol is defined or not
6329 case "$usenm" in
6330 '')
6331         dflt=''
6332         case "$d_gnulibc" in
6333         "$define")
6334                 echo " "
6335                 echo "nm probably won't work on the GNU C Library." >&4
6336                 dflt=n
6337                 ;;
6338         esac
6339         case "$dflt" in
6340         '')
6341                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6342                         echo " "
6343                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6344                         echo "'nm' won't be sufficient on this system." >&4
6345                         dflt=n
6346                 fi
6347                 ;;
6348         esac
6349         case "$dflt" in
6350         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6351                 if $test $dflt -gt 20; then
6352                         dflt=y
6353                 else
6354                         dflt=n
6355                 fi
6356                 ;;
6357         esac
6358         ;;
6359 *)
6360         case "$usenm" in
6361         true|$define) dflt=y;;
6362         *) dflt=n;;
6363         esac
6364         ;;
6365 esac
6366 $cat <<EOM
6367
6368 I can use $nm to extract the symbols from your C libraries. This
6369 is a time consuming task which may generate huge output on the disk (up
6370 to 3 megabytes) but that should make the symbols extraction faster. The
6371 alternative is to skip the 'nm' extraction part and to compile a small
6372 test program instead to determine whether each symbol is present. If
6373 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6374 this may be the best solution.
6375
6376 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6377
6378 EOM
6379 rp="Shall I use $nm to extract C symbols from the libraries?"
6380 . ./myread
6381 case "$ans" in
6382 [Nn]*) usenm=false;;
6383 *) usenm=true;;
6384 esac
6385
6386 runnm=$usenm
6387 case "$reuseval" in
6388 true) runnm=false;;
6389 esac
6390
6391 : nm options which may be necessary
6392 case "$nm_opt" in
6393 '') if $test -f /mach_boot; then
6394                 nm_opt=''       # Mach
6395         elif $test -d /usr/ccs/lib; then
6396                 nm_opt='-p'     # Solaris (and SunOS?)
6397         elif $test -f /dgux; then
6398                 nm_opt='-p'     # DG-UX
6399         elif $test -f /lib64/rld; then
6400                 nm_opt='-p'     # 64-bit Irix
6401         else
6402                 nm_opt=''
6403         fi;;
6404 esac
6405
6406 : nm options which may be necessary for shared libraries but illegal
6407 : for archive libraries.  Thank you, Linux.
6408 case "$nm_so_opt" in
6409 '')     case "$myuname" in
6410         *linux*|gnu*)
6411                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6412                         nm_so_opt='--dynamic'
6413                 fi
6414                 ;;
6415         esac
6416         ;;
6417 esac
6418
6419 : Figure out where the libc is located
6420 case "$runnm" in
6421 true)
6422 : get list of predefined functions in a handy place
6423 echo " "
6424 case "$libc" in
6425 '') libc=unknown
6426         case "$libs" in
6427         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6428         esac
6429         ;;
6430 esac
6431 case "$libs" in
6432 '') ;;
6433 *)  for thislib in $libs; do
6434         case "$thislib" in
6435         -lc|-lc_s)
6436                 : Handle C library specially below.
6437                 ;;
6438         -l*)
6439                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6440                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6441                         :
6442                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6443                         :
6444                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6445                         :
6446                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6447                         :
6448                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6449                         :
6450                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6451                         :
6452                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6453                         :
6454                 else
6455                         try=''
6456                 fi
6457                 libnames="$libnames $try"
6458                 ;;
6459         *) libnames="$libnames $thislib" ;;
6460         esac
6461         done
6462         ;;
6463 esac
6464 xxx=normal
6465 case "$libc" in
6466 unknown)
6467         set /lib/libc.$so
6468         for xxx in $libpth; do
6469                 $test -r $1 || set $xxx/libc.$so
6470                 : The messy sed command sorts on library version numbers.
6471                 $test -r $1 || \
6472                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6473                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6474                                 h
6475                                 s/[0-9][0-9]*/0000&/g
6476                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6477                                 G
6478                                 s/\n/ /' | \
6479                          $sort | $sed -e 's/^.* //'`
6480                 eval set \$$#
6481         done
6482         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6483         $test -r $1 || set $sysroot/lib/libsys_s$_a
6484         ;;
6485 *)
6486         set blurfl
6487         ;;
6488 esac
6489 if $test -r "$1"; then
6490         echo "Your (shared) C library seems to be in $1."
6491         libc="$1"
6492 elif $test -r /lib/libc && $test -r /lib/clib; then
6493         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6494         xxx=apollo
6495         libc='/lib/clib /lib/libc'
6496         if $test -r /lib/syslib; then
6497                 echo "(Your math library is in /lib/syslib.)"
6498                 libc="$libc /lib/syslib"
6499         fi
6500 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6501         echo "Your C library seems to be in $libc, as you said before."
6502 elif $test -r $incpath/usr/lib/libc$_a; then
6503         libc=$incpath/usr/lib/libc$_a;
6504         echo "Your C library seems to be in $libc.  That's fine."
6505 elif $test -r /lib/libc$_a; then
6506         libc=/lib/libc$_a;
6507         echo "Your C library seems to be in $libc.  You're normal."
6508 else
6509         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6510                 :
6511         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6512                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6513         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6514                 :
6515         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6516                 :
6517         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6518                 :
6519         else
6520                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6521         fi
6522         if $test -r "$tans"; then
6523                 echo "Your C library seems to be in $tans, of all places."
6524                 libc=$tans
6525         else
6526                 libc='blurfl'
6527         fi
6528 fi
6529 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6530         dflt="$libc"
6531         cat <<EOM
6532
6533 If the guess above is wrong (which it might be if you're using a strange
6534 compiler, or your machine supports multiple models), you can override it here.
6535
6536 EOM
6537 else
6538         dflt=''
6539         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6540         cat >&4 <<EOM
6541 I can't seem to find your C library.  I've looked in the following places:
6542
6543 EOM
6544         $sed 's/^/      /' libpath
6545         cat <<EOM
6546
6547 None of these seems to contain your C library. I need to get its name...
6548
6549 EOM
6550 fi
6551 fn=f
6552 rp='Where is your C library?'
6553 . ./getfile
6554 libc="$ans"
6555
6556 echo " "
6557 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6558 set X `cat libnames`
6559 shift
6560 xxx=files
6561 case $# in 1) xxx=file; esac
6562 echo "Extracting names from the following $xxx for later perusal:" >&4
6563 echo " "
6564 $sed 's/^/      /' libnames >&4
6565 echo " "
6566 $echo $n "This may take a while...$c" >&4
6567
6568 for file in $*; do
6569         case $file in
6570         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6571         *) $nm $nm_opt $file 2>/dev/null;;
6572         esac
6573 done >libc.tmp
6574
6575 $echo $n ".$c"
6576 $grep fprintf libc.tmp > libc.ptf
6577 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6578 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6579 xxx='[ADTSIWi]'
6580 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6581         eval $xscan;\
6582         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6583                 eval $xrun
6584 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6585         eval $xscan;\
6586         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6587                 eval $xrun
6588 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6589         eval $xscan;\
6590         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6591                 eval $xrun
6592 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6593         eval $xscan;\
6594         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6595                 eval $xrun
6596 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6597         eval $xscan;\
6598         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6599                 eval $xrun
6600 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6601         eval $xscan;\
6602         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6603                 eval $xrun
6604 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6605                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6606         eval $xscan;\
6607         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6608                 eval $xrun
6609 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6610         eval $xscan;\
6611         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6612                 eval $xrun
6613 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6614         eval $xscan;\
6615         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6616                 eval $xrun
6617 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6618         eval $xscan;\
6619         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6620                 eval $xrun
6621 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6622         eval $xscan;\
6623         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6624                 eval $xrun
6625 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6626         eval $xscan;\
6627         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6628                 eval $xrun
6629 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6630         eval $xscan;\
6631         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6632                 eval $xrun
6633 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6634         eval $xscan;\
6635         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6636                 eval $xrun
6637 else
6638         $nm -p $* 2>/dev/null >libc.tmp
6639         $grep fprintf libc.tmp > libc.ptf
6640         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6641                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6642         then
6643                 nm_opt='-p'
6644                 eval $xrun
6645         else
6646                 echo " "
6647                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6648                 com=''
6649                 if $ar t $libc > libc.tmp && \
6650                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6651                 then
6652                         for thisname in $libnames $libc; do
6653                                 $ar t $thisname >>libc.tmp
6654                         done
6655                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6656                         echo "Ok." >&4
6657                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6658                         for thisname in $libnames $libc; do
6659                                 $ar tv $thisname >>libc.tmp
6660                                 emximp -o tmp.imp $thisname \
6661                                     2>/dev/null && \
6662                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6663                                     < tmp.imp >>libc.tmp
6664                                 $rm -f tmp.imp
6665                         done
6666                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6667                         echo "Ok." >&4
6668                 else
6669                         echo "$ar didn't seem to work right." >&4
6670                         echo "Maybe this is a Cray...trying bld instead..." >&4
6671                         if  bld t $libc | \
6672                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6673                                 $test -s libc.list
6674                         then
6675                                 for thisname in $libnames; do
6676                                         bld t $libnames | \
6677                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6678                                         $ar t $thisname >>libc.tmp
6679                                 done
6680                                 echo "Ok." >&4
6681                         else
6682                                 echo "That didn't work either.  Giving up." >&4
6683                                 exit 1
6684                         fi
6685                 fi
6686         fi
6687 fi
6688 nm_extract="$com"
6689 case "$PASE" in
6690 define)
6691     echo " "
6692     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6693     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6694     ;;
6695 *)  if $test -f /lib/syscalls.exp; then
6696         echo " "
6697         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6698         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6699                 /lib/syscalls.exp >>libc.list
6700     fi
6701     ;;
6702 esac
6703 ;;
6704 esac
6705 $rm -f libnames libpath
6706
6707 : Check if we are using C++
6708 echo " "
6709 echo "Checking for C++..." >&4
6710 $cat >try.c <<'EOCP'
6711 #include <stdio.h>
6712 int main(void)
6713 {
6714 #ifdef __cplusplus
6715     return 0;
6716 #else
6717     return 1;
6718 #endif
6719 }
6720 EOCP
6721 set try
6722 if eval $compile_ok && $run ./try; then
6723         val="$define"
6724         echo "You are using a C++ compiler."
6725 else
6726         val="$undef"
6727         echo "You are not using a C++ compiler."
6728 fi
6729 $rm_try cplusplus$$
6730 set d_cplusplus
6731 eval $setvar
6732
6733 : is a C symbol defined?
6734 csym='tlook=$1;
6735 case "$3" in
6736 -v) tf=libc.tmp; tdc="";;
6737 -a) tf=libc.tmp; tdc="[]";;
6738 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6739 esac;
6740 case "$d_cplusplus" in
6741     $define)    extern_C="extern \"C\"" ;;
6742     *)          extern_C="extern"       ;;
6743 esac;
6744 tx=yes;
6745 case "$reuseval-$4" in
6746 true-) ;;
6747 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6748 esac;
6749 case "$tx" in
6750 yes)
6751         tval=false;
6752         if $test "$runnm" = true; then
6753                 if $contains $tlook $tf >/dev/null 2>&1; then
6754                         tval=true;
6755                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6756                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p() && p() != (void *)main) return(0); else return(1); }"> try.c;
6757                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6758                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6759                         $rm_try;
6760                 fi;
6761         else
6762                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p() && p() != (void *)main) return(0); else return(1); }"> try.c;
6763                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6764                 $rm_try;
6765         fi;
6766         ;;
6767 *)
6768         case "$tval" in
6769         $define) tval=true;;
6770         *) tval=false;;
6771         esac;
6772         ;;
6773 esac;
6774 eval "$2=$tval"'
6775
6776 : define an is-in-libc? function
6777 inlibc='echo " "; td=$define; tu=$undef;
6778 sym=$1; var=$2; eval "was=\$$2";
6779 tx=yes;
6780 case "$reuseval$was" in
6781 true) ;;
6782 true*) tx=no;;
6783 esac;
6784 case "$tx" in
6785 yes)
6786         set $sym tres -f;
6787         eval $csym;
6788         case "$tres" in
6789         true)
6790                 echo "$sym() found." >&4;
6791                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6792         *)
6793                 echo "$sym() NOT found." >&4;
6794                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6795         esac;;
6796 *)
6797         case "$was" in
6798         $define) echo "$sym() found." >&4;;
6799         *) echo "$sym() NOT found." >&4;;
6800         esac;;
6801 esac'
6802
6803 : check for length of double
6804 echo " "
6805 case "$doublesize" in
6806 '')
6807         echo "Checking to see how big your double precision numbers are..." >&4
6808         $cat >try.c <<EOCP
6809 #include <stdio.h>
6810 #$i_stdlib I_STDLIB
6811 #ifdef I_STDLIB
6812 #include <stdlib.h>
6813 #endif
6814 int main()
6815 {
6816     printf("%d\n", (int)sizeof(double));
6817     exit(0);
6818 }
6819 EOCP
6820         set try
6821         if eval $compile_ok; then
6822                 doublesize=`$run ./try`
6823                 echo "Your double is $doublesize bytes long."
6824         else
6825                 dflt='8'
6826                 echo "(I can't seem to compile the test program.  Guessing...)"
6827                 rp="What is the size of a double precision number (in bytes)?"
6828                 . ./myread
6829                 doublesize="$ans"
6830         fi
6831         ;;
6832 esac
6833 $rm_try
6834
6835 : see if this is a float.h system
6836 set float.h i_float
6837 eval $inhdr
6838
6839 : check for long doubles
6840 echo " "
6841 echo "Checking to see if you have long double..." >&4
6842 echo 'int main() { long double x = 7.0; }' > try.c
6843 set try
6844 if eval $compile; then
6845         val="$define"
6846         echo "You have long double."
6847 else
6848         val="$undef"
6849         echo "You do not have long double."
6850 fi
6851 $rm_try
6852 set d_longdbl
6853 eval $setvar
6854
6855 : see if ldexpl exists
6856 set ldexpl d_ldexpl
6857 eval $inlibc
6858
6859 : check for length of long double
6860 case "${d_longdbl}${longdblsize}" in
6861 $define)
6862         echo " "
6863         echo "Checking to see how big your long doubles are..." >&4
6864         $cat >try.c <<'EOCP'
6865 #include <stdio.h>
6866 int main()
6867 {
6868         printf("%d\n", sizeof(long double));
6869 }
6870 EOCP
6871         set try
6872         set try
6873         if eval $compile; then
6874                 longdblsize=`$run ./try`
6875                 echo "Your long doubles are $longdblsize bytes long."
6876         else
6877                 dflt='8'
6878                 echo " "
6879                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6880                 rp="What is the size of a long double (in bytes)?"
6881                 . ./myread
6882                 longdblsize="$ans"
6883         fi
6884         if $test "X$doublesize" = "X$longdblsize"; then
6885                 echo "That isn't any different from an ordinary double."
6886                 echo "I'll keep your setting anyway, but you may see some"
6887                 echo "harmless compilation warnings."
6888         fi
6889         ;;
6890 esac
6891 $rm_try
6892
6893 $echo "Checking the kind of long doubles you have..." >&4
6894 case "$d_longdbl" in
6895 define)
6896 $cat <<EOP >try.c
6897 #$i_float I_FLOAT
6898 #$i_stdlib I_STDLIB
6899 #define LONGDBLSIZE $longdblsize
6900 #define DOUBLESIZE $doublesize
6901 #ifdef I_FLOAT
6902 #include <float.h>
6903 #endif
6904 #ifdef I_STDLIB
6905 #include <stdlib.h>
6906 #endif
6907 #include <stdio.h>
6908 static const long double d = -0.1L;
6909 int main() {
6910   unsigned const char* b = (unsigned const char*)(&d);
6911 #if DOUBLESIZE == LONGDBLSIZE
6912   printf("0\n"); /* if it floats like double */
6913   exit(0);
6914 #endif
6915 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6916   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6917     /* IEEE 754 128-bit little-endian */
6918     printf("1\n");
6919     exit(0);
6920   }
6921   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6922     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6923     printf("2\n");
6924     exit(0);
6925   }
6926 #endif
6927 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6928  * while 64-bits platforms have it in 16 bytes. */
6929 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6930   if (b[0] == 0xCD && b[9] == 0xBF && b[10] == 0x00) {
6931     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6932      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6933      * Also known as "extended precision". */
6934     printf("3\n");
6935     exit(0);
6936   }
6937   if (b[0] == 0xBF && b[9] == 0xCD && b[10] == 0x00) {
6938     /* is there ever big-endian 80-bit, really? */
6939     printf("4\n");
6940     exit(0);
6941   }
6942 #endif
6943 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
6944   /* software "double double", the 106 is 53+53.
6945    * but irix thinks it is 107. */
6946   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
6947     /* double double 128-bit little-endian,
6948      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
6949     printf("5\n");
6950     exit(0);
6951   }
6952   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
6953     /* double double 128-bit big-endian, e.g. PPC/Power and MIPS:
6954      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
6955     printf("6\n");
6956     exit(0);
6957   }
6958 #endif
6959   printf("-1\n"); /* unknown */
6960   exit(0);
6961 }
6962 EOP
6963 set try
6964 if eval $compile; then
6965     longdblkind=`$run ./try`
6966 else
6967     longdblkind=-1
6968 fi
6969 ;;
6970 *) longdblkind=0 ;;
6971 esac
6972 case "$longdblkind" in
6973 0) echo "Your long doubles are doubles." >&4 ;;
6974 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
6975 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
6976 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
6977 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
6978 5) echo "You have 128-bit little-endian double-double long doubles." >& 4 ;;
6979 6) echo "You have 128-bit big-endian double-double long doubles." >& 4 ;;
6980 *) echo "Cannot figure out your long double." >&4 ;;
6981 esac
6982 $rm_try
6983
6984 : determine the architecture name
6985 echo " "
6986 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6987         tarch=`arch`"-$osname"
6988 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6989         if uname -m > tmparch 2>&1 ; then
6990                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6991                         -e 's/$/'"-$osname/" tmparch`
6992         else
6993                 tarch="$osname"
6994         fi
6995         $rm -f tmparch
6996 else
6997         tarch="$osname"
6998 fi
6999 case "$myarchname" in
7000 ''|"$tarch") ;;
7001 *)
7002         echo "(Your architecture name used to be $myarchname.)"
7003         archname=''
7004         ;;
7005 esac
7006 case "$targetarch" in
7007 '') ;;
7008 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7009 esac
7010 myarchname="$tarch"
7011 case "$archname" in
7012 '') dflt="$tarch";;
7013 *) dflt="$archname";;
7014 esac
7015 rp='What is your architecture name'
7016 . ./myread
7017 archname="$ans"
7018
7019 : optionally add API version to the architecture for versioned archlibs
7020 case "$useversionedarchname" in
7021 $define|true|[yY]*) dflt='y';;
7022 *)                  dflt='n';;
7023 esac
7024 rp='Add the Perl API version to your archname?'
7025 . ./myread
7026 case "$ans" in
7027 y|Y)    useversionedarchname="$define" ;;
7028 *)      useversionedarchname="$undef" ;;
7029 esac
7030 case "$useversionedarchname" in
7031 $define)
7032         case "$archname" in
7033         *-$api_versionstring)
7034                 echo "...and architecture name already has -$api_versionstring" >&4
7035                 ;;
7036         *)
7037                 archname="$archname-$api_versionstring"
7038                 echo "...setting architecture name to $archname." >&4
7039                 ;;
7040         esac
7041         ;;
7042 esac
7043
7044 case "$usethreads" in
7045 $define)
7046         echo "Threads selected." >&4
7047         case "$archname" in
7048         *-thread*) echo "...and architecture name already has -thread." >&4
7049                 ;;
7050         *)      archname="$archname-thread"
7051                 echo "...setting architecture name to $archname." >&4
7052                 ;;
7053         esac
7054         ;;
7055 esac
7056 case "$usemultiplicity" in
7057 $define)
7058         echo "Multiplicity selected." >&4
7059         case "$archname" in
7060         *-multi*) echo "...and architecture name already has -multi." >&4
7061                 ;;
7062         *)      archname="$archname-multi"
7063                 echo "...setting architecture name to $archname." >&4
7064                 ;;
7065         esac
7066         ;;
7067 esac
7068 case "$use64bitint$use64bitall" in
7069 *"$define"*)
7070         case "$archname64" in
7071         '')
7072                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7073                 ;;
7074         *)
7075                 case "$use64bitint" in
7076                 "$define") echo "64 bit integers selected." >&4 ;;
7077                 esac
7078                 case "$use64bitall" in
7079                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7080                 esac
7081                 case "$archname" in
7082                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7083                         ;;
7084                 *)      archname="$archname-$archname64"
7085                         echo "...setting architecture name to $archname." >&4
7086                         ;;
7087                 esac
7088                 ;;
7089         esac
7090 esac
7091 case "$uselongdouble" in
7092 $define)
7093         echo "Long doubles selected." >&4
7094         case "$longdblsize" in
7095         $doublesize)
7096                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7097                 ;;
7098         *)
7099                 case "$archname" in
7100                 *-ld*) echo "...and architecture name already has -ld." >&4
7101                         ;;
7102                 *)      archname="$archname-ld"
7103                         echo "...setting architecture name to $archname." >&4
7104                         ;;
7105                 esac
7106                 ;;
7107         esac
7108         ;;
7109 esac
7110 case "$usequadmath" in
7111 $define)
7112         echo "quadmath selected." >&4
7113         case "$archname" in
7114         *-ld*) echo "...and architecture name already has -quadmath." >&4
7115                 ;;
7116         *)      archname="$archname-quadmath"
7117                 echo "...setting architecture name to $archname." >&4
7118                 ;;
7119         esac
7120         ;;
7121 esac
7122 if $test -f archname.cbu; then
7123         echo "Your platform has some specific hints for architecture name, using them..."
7124         . ./archname.cbu
7125 fi
7126
7127 : set the prefixit variable, to compute a suitable default value
7128 prefixit='case "$3" in
7129 ""|none)
7130         case "$oldprefix" in
7131         "") eval "$1=\"\$$2\"";;
7132         *)
7133                 case "$3" in
7134                 "") eval "$1=";;
7135                 none)
7136                         eval "tp=\"\$$2\"";
7137                         case "$tp" in
7138                         ""|" ") eval "$1=\"\$$2\"";;
7139                         *) eval "$1=";;
7140                         esac;;
7141                 esac;;
7142         esac;;
7143 *)
7144         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7145         case "$tp" in
7146         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7147         /*-$oldprefix/*|\~*-$oldprefix/*)
7148                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7149         *) eval "$1=\"\$$2\"";;
7150         esac;;
7151 esac'
7152
7153 : determine installation style
7154 : For now, try to deduce it from prefix unless it is already set.
7155 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7156 case "$installstyle" in
7157 '')     case "$prefix" in
7158                 *perl*) dflt='lib';;
7159                 *) dflt='lib/perl5' ;;
7160         esac
7161         ;;
7162 *)      dflt="$installstyle" ;;
7163 esac
7164 : Probably not worth prompting for this since we prompt for all
7165 : the directories individually, and the prompt would be too long and
7166 : confusing anyway.
7167 installstyle=$dflt
7168
7169 : determine where public executables go
7170 echo " "
7171 set dflt bin bin
7172 eval $prefixit
7173 fn=d~
7174 rp='Pathname where the public executables will reside?'
7175 . ./getfile
7176 if $test "X$ansexp" != "X$binexp"; then
7177         installbin=''
7178 fi
7179 prefixvar=bin
7180 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7181 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7182 :     this via initialinstalllocation
7183 . ./setprefixvar
7184
7185 case "$userelocatableinc" in
7186 $define|true|[yY]*)     dflt='y' ;;
7187 *)                      dflt='n' ;;
7188 esac
7189 cat <<EOM
7190
7191 Would you like to build Perl so that the installation is relocatable, so that
7192 library paths in @INC are determined relative to the path of the perl binary?
7193 This is not advised for system Perl installs, or if you need to run setid
7194 scripts or scripts under taint mode.
7195
7196 If this doesn't make any sense to you, just accept the default '$dflt'.
7197 EOM
7198 rp='Use relocatable @INC?'
7199 . ./myread
7200 case "$ans" in
7201 y|Y)    val="$define" ;;
7202 *)      val="$undef"  ;;
7203 esac
7204 set userelocatableinc
7205 eval $setvar
7206
7207 initialinstalllocation="$binexp"
7208 : Default prefix is now "up one level from where the binaries are"
7209 case "$userelocatableinc" in
7210 $define|true|[yY]*)
7211     bin=".../"
7212     binexp=".../"
7213     prefix=".../.."
7214     prefixexp=".../.."
7215     installprefixexp=".../.."
7216     ;;
7217 esac
7218
7219 : determine where private library files go
7220 : Usual default is /usr/local/lib/perl5/$version.
7221 : Also allow things like /opt/perl/lib/$version, since
7222 : /opt/perl/lib/perl5... would be redundant.
7223 : The default "style" setting is made in installstyle.U
7224 case "$installstyle" in
7225 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7226 *)       set dflt privlib lib/$version ;;
7227 esac
7228 eval $prefixit
7229 $cat <<EOM
7230
7231 There are some auxiliary files for $package that need to be put into a
7232 private library directory that is accessible by everyone.
7233
7234 EOM
7235 fn=$binexp
7236 fn=d~+
7237 rp='Pathname where the private library files will reside?'
7238 . ./getfile
7239 prefixvar=privlib
7240 . ./setprefixvar
7241
7242 : set the prefixup variable, to restore leading tilda escape
7243 prefixup='case "$prefixexp" in
7244 "$prefix") ;;
7245 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7246 esac'
7247
7248 : determine where public architecture dependent libraries go
7249 set archlib archlib
7250 eval $prefixit
7251 : privlib default is /usr/local/lib/$package/$version
7252 : archlib default is /usr/local/lib/$package/$version/$archname
7253 : privlib may have an optional trailing /share.
7254 tdflt=`echo $privlib | $sed 's,/share$,,'`
7255 tdflt=$tdflt/$archname
7256 case "$archlib" in
7257 '')     dflt=$tdflt
7258         ;;
7259 *)      dflt="$archlib"
7260     ;;
7261 esac
7262 $cat <<EOM
7263
7264 $spackage contains architecture-dependent library files.  If you are
7265 sharing libraries in a heterogeneous environment, you might store
7266 these files in a separate location.  Otherwise, you can just include
7267 them with the rest of the public library files.
7268
7269 EOM
7270 fn=$binexp
7271 fn=d+~
7272 rp='Where do you want to put the public architecture-dependent libraries?'
7273 . ./getfile
7274 prefixvar=archlib
7275 . ./setprefixvar
7276 if $test X"$archlib" = X"$privlib"; then
7277         d_archlib="$undef"
7278 else
7279         d_archlib="$define"
7280 fi
7281
7282 : see if setuid scripts can be secure
7283 $cat <<EOM
7284
7285 Some kernels have a bug that prevents setuid #! scripts from being
7286 secure.  Some sites have disabled setuid #! scripts because of this.
7287
7288 First let's decide if your kernel supports secure setuid #! scripts.
7289 (If setuid #! scripts would be secure but have been disabled anyway,
7290 don't say that they are secure if asked.)
7291
7292 EOM
7293
7294 val="$undef"
7295 if $test -d /dev/fd; then
7296         echo "#!$ls" >reflect
7297         chmod +x,u+s reflect
7298         ./reflect >flect 2>&1
7299         if $contains "/dev/fd" flect >/dev/null; then
7300                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7301                 val="$define"
7302         else
7303                 $cat <<EOM
7304 If you are not sure if they are secure, I can check but I'll need a
7305 username and password different from the one you are using right now.
7306 If you don't have such a username or don't want me to test, simply
7307 enter 'none'.
7308
7309 EOM
7310                 rp='Other username to test security of setuid scripts with?'
7311                 dflt='none'
7312                 . ./myread
7313                 case "$ans" in
7314                 n|none)
7315                         case "$d_suidsafe" in
7316                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7317                                 dflt=n;;
7318                         "$undef")
7319                                 echo "Well, the $hint value is *not* secure." >&4
7320                                 dflt=n;;
7321                         *)      echo "Well, the $hint value *is* secure." >&4
7322                                 dflt=y;;
7323                         esac
7324                         ;;
7325                 *)
7326                         $rm -f reflect flect
7327                         echo "#!$ls" >reflect
7328                         chmod +x,u+s reflect
7329                         echo >flect
7330                         chmod a+w flect
7331                         echo '"su" will (probably) prompt you for '"$ans's password."
7332                         su $ans -c './reflect >flect'
7333                         if $contains "/dev/fd" flect >/dev/null; then
7334                                 echo "Okay, it looks like setuid scripts are secure." >&4
7335                                 dflt=y
7336                         else
7337                                 echo "I don't think setuid scripts are secure." >&4
7338                                 dflt=n
7339                         fi
7340                         ;;
7341                 esac
7342                 rp='Does your kernel have *secure* setuid scripts?'
7343                 . ./myread
7344                 case "$ans" in
7345                 [yY]*)  val="$define";;
7346                 *)      val="$undef";;
7347                 esac
7348         fi
7349 else
7350         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7351         echo "(That's for file descriptors, not floppy disks.)"
7352         val="$undef"
7353 fi
7354 set d_suidsafe
7355 eval $setvar
7356
7357 $rm -f reflect flect
7358
7359 : now see if they want to do setuid emulation
7360 if $test $patchlevel -lt 11; then
7361 echo " "
7362 val="$undef"
7363 case "$d_suidsafe" in
7364 "$define")
7365         val="$undef"
7366         echo "No need to emulate SUID scripts since they are secure here." >&4
7367         ;;
7368 *)
7369         $cat <<EOM
7370 Some systems have disabled setuid scripts, especially systems where
7371 setuid scripts cannot be secure.  On systems where setuid scripts have
7372 been disabled, the setuid/setgid bits on scripts are currently
7373 useless.  It is possible for $package to detect those bits and emulate
7374 setuid/setgid in a secure fashion.  This emulation will only work if
7375 setuid scripts have been disabled in your kernel.
7376
7377 EOM
7378         case "$d_dosuid" in
7379         "$define") dflt=y ;;
7380         *) dflt=n ;;
7381         esac
7382         rp="Do you want to do setuid/setgid emulation?"
7383         . ./myread
7384         case "$ans" in
7385         [yY]*)  val="$define";;
7386         *)      val="$undef";;
7387         esac
7388         ;;
7389 esac
7390 set d_dosuid
7391 eval $setvar
7392 else
7393     case "$d_dosuid" in
7394         "$define")
7395         cat >&4 <<EOH
7396
7397 SUID emulation has been removed for 5.12
7398 Please re-run Configure without -Dd_dosuid
7399
7400 EOH
7401         exit 1;
7402         ;;
7403     esac
7404     d_dosuid=undef
7405 fi
7406
7407 : Find perl5.005 or later.
7408 echo "Looking for a previously installed perl5.005 or later... "
7409 case "$perl5" in
7410 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7411                 : Check if this perl is recent and can load a simple module
7412                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7413                         perl5=$tdir/perl
7414                         break;
7415                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7416                         perl5=$tdir/perl5
7417                         break;
7418                 fi
7419         done
7420         ;;
7421 *)      perl5="$perl5"
7422         ;;
7423 esac
7424 case "$perl5" in
7425 '')     echo "None found.  That's ok.";;
7426 *)      echo "Using $perl5." ;;
7427 esac
7428
7429 : Set the siteprefix variables
7430 $cat <<EOM
7431
7432 After $package is installed, you may wish to install various
7433 add-on modules and utilities.  Typically, these add-ons will
7434 be installed under $prefix with the rest
7435 of this package.  However, you may wish to install such add-ons
7436 elsewhere under a different prefix.
7437
7438 If you do not wish to put everything under a single prefix, that's
7439 ok.  You will be prompted for the individual locations; this siteprefix
7440 is only used to suggest the defaults.
7441
7442 The default should be fine for most people.
7443
7444 EOM
7445 fn=d~+
7446 rp='Installation prefix to use for add-on modules and utilities?'
7447 : XXX Here might be another good place for an installstyle setting.
7448 case "$siteprefix" in
7449 '') dflt=$prefix ;;
7450 *)  dflt=$siteprefix ;;
7451 esac
7452 . ./getfile
7453 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7454 oldsiteprefix=''
7455 case "$siteprefix" in
7456 '') ;;
7457 *)      case "$ans" in
7458         "$prefix") ;;
7459         *) oldsiteprefix="$prefix";;
7460         esac
7461         ;;
7462 esac
7463 siteprefix="$ans"
7464 siteprefixexp="$ansexp"
7465
7466 : determine where site specific libraries go.
7467 : Usual default is /usr/local/lib/perl5/site_perl/$version
7468 : The default "style" setting is made in installstyle.U
7469 : XXX No longer works with Prefixit stuff.
7470 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7471 case "$sitelib" in
7472 '') case "$installstyle" in
7473         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7474         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7475         esac
7476         ;;
7477 *)      dflt="$sitelib"
7478         ;;
7479 esac
7480 $cat <<EOM
7481
7482 The installation process will create a directory for
7483 site-specific extensions and modules.  Most users find it convenient
7484 to place all site-specific files in this directory rather than in the
7485 main distribution directory.
7486
7487 EOM
7488 fn=d~+
7489 rp='Pathname for the site-specific library files?'
7490 . ./getfile
7491 prefixvar=sitelib
7492 . ./setprefixvar
7493 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7494
7495 : Determine list of previous versions to include in @INC
7496 $cat > getverlist <<EOPL
7497 #!$perl5 -w
7498 use File::Basename;
7499 \$api_versionstring = "$api_versionstring";
7500 \$version = "$version";
7501 \$stem = "$sitelib_stem";
7502 \$archname = "$archname";
7503 EOPL
7504         $cat >> getverlist <<'EOPL'
7505 # The list found is store twice for each entry: the original name, and
7506 # the binary broken down version as pack "sss", so sorting is easy and
7507 # unambiguous. This will work for all versions that have a maximum of
7508 # three digit groups, separate by '.'s or '_'s. Names are extended with
7509 # ".0.0" to ensure at least three elements for the pack.
7510 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7511
7512 # Can't have leading @ because metaconfig interprets it as a command!
7513 ;@inc_version_list=();
7514 # XXX Redo to do opendir/readdir?
7515 if (-d $stem) {
7516     chdir($stem);
7517     ;@candidates = map {
7518         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7519     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7520 }
7521 else {
7522     ;@candidates = ();
7523 }
7524
7525 ($pversion, $aversion, $vsn5005) = map {
7526     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7527 foreach $d (@candidates) {
7528     if ($d->[1] lt $pversion) {
7529         if ($d->[1] ge $aversion) {
7530             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7531         }
7532         elsif ($d->[1] ge $vsn5005) {
7533             unshift(@inc_version_list, grep { -d } $d->[0]);
7534         }
7535     }
7536     else {
7537         # Skip newer version.  I.e. don't look in
7538         # 5.7.0 if we're installing 5.6.1.
7539     }
7540 }
7541
7542 if (@inc_version_list) {
7543     print join(' ', @inc_version_list);
7544 }
7545 else {
7546     # Blank space to preserve value for next Configure run.
7547     print " ";
7548 }
7549 EOPL
7550 chmod +x getverlist
7551 case "$inc_version_list" in
7552 '')     if test -x "$perl5$exe_ext"; then
7553                 dflt=`$perl5 getverlist`
7554         else
7555                 dflt='none'
7556         fi
7557         ;;
7558 $undef) dflt='none' ;;
7559 *)  eval dflt=\"$inc_version_list\" ;;
7560 esac
7561 case "$dflt" in
7562 ''|' ') dflt=none ;;
7563 esac
7564 case "$dflt" in
7565 5.005) dflt=none ;;
7566 esac
7567 $cat <<EOM
7568
7569 In order to ease the process of upgrading, this version of perl
7570 can be configured to use modules built and installed with earlier
7571 versions of perl that were installed under $prefix.  Specify here
7572 the list of earlier versions that this version of perl should check.
7573 If Configure detected no earlier versions of perl installed under
7574 $prefix, then the list will be empty.  Answer 'none' to tell perl
7575 to not search earlier versions.
7576
7577 The default should almost always be sensible, so if you're not sure,
7578 just accept the default.
7579 EOM
7580
7581 rp='List of earlier versions to include in @INC?'
7582 . ./myread
7583 case "$ans" in
7584 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7585 *) inc_version_list="$ans" ;;
7586 esac
7587 case "$inc_version_list" in
7588 ''|' ')
7589         inc_version_list_init='0'
7590         d_inc_version_list="$undef"
7591         ;;
7592 *)      inc_version_list_init=`echo $inc_version_list |
7593                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7594         d_inc_version_list="$define"
7595         ;;
7596 esac
7597 $rm -f getverlist
7598
7599 : see if malloc/malloc.h has to be included
7600 set malloc/malloc.h i_mallocmalloc
7601 eval $inhdr
7602
7603 : see if this is a malloc.h system
7604 : we want a real compile instead of Inhdr because some systems have a
7605 : malloc.h that just gives a compile error saying to use stdlib.h instead
7606 echo " "
7607 $cat >try.c <<EOCP
7608 #include <stdlib.h>
7609 #include <malloc.h>
7610 #$i_mallocmalloc I_MALLOCMALLOC
7611 #ifdef I_MALLOCMALLOC
7612 # include <malloc/malloc.h>
7613 #endif
7614
7615 int main () { return 0; }
7616 EOCP
7617 set try
7618 if eval $compile; then
7619     echo "<malloc.h> found." >&4
7620     val="$define"
7621 else
7622     echo "<malloc.h> NOT found." >&4
7623     val="$undef"
7624 fi
7625 $rm_try
7626 set i_malloc
7627 eval $setvar
7628
7629 : check for length of pointer
7630 echo " "
7631 case "$ptrsize" in
7632 '')
7633         echo "Checking to see how big your pointers are..." >&4
7634         $cat >>try.c <<EOCP
7635 #include <stdio.h>
7636 #$i_stdlib I_STDLIB
7637 #ifdef I_STDLIB
7638 #include <stdlib.h>
7639 #endif
7640 int main()
7641 {
7642     printf("%d\n", (int)sizeof(void *));
7643     exit(0);
7644 }
7645 EOCP
7646         set try
7647         if eval $compile_ok; then
7648                 ptrsize=`$run ./try`
7649                 echo "Your pointers are $ptrsize bytes long."
7650         else
7651                 dflt='4'
7652                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7653                 rp="What is the size of a pointer (in bytes)?"
7654                 . ./myread
7655                 ptrsize="$ans"
7656         fi
7657         ;;
7658 esac
7659 $rm_try
7660 case "$use64bitall" in
7661 "$define"|true|[yY]*)
7662         case "$ptrsize" in
7663         4)      cat <<EOM >&4
7664
7665 *** You have chosen a maximally 64-bit build,
7666 *** but your pointers are only 4 bytes wide.
7667 *** Please rerun Configure without -Duse64bitall.
7668 EOM
7669                 case "$d_quad" in
7670                 define)
7671                         cat <<EOM >&4
7672 *** Since you have quads, you could possibly try with -Duse64bitint.
7673 EOM
7674                         ;;
7675                 esac
7676                 cat <<EOM >&4
7677 *** Cannot continue, aborting.
7678
7679 EOM
7680
7681                 exit 1
7682                 ;;
7683         esac
7684         ;;
7685 esac
7686
7687
7688 : determine whether to use malloc wrapping
7689 echo " "
7690 case "$usemallocwrap" in
7691 [yY]*|true|$define)     dflt='y' ;;
7692 [nN]*|false|$undef)     dflt='n' ;;
7693 *)      case "$usedevel" in
7694         [yY]*|true|$define)     dflt='y' ;;
7695         *) dflt='n' ;;
7696         esac
7697         ;;
7698 esac
7699 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7700 . ./myread
7701 usemallocwrap="$ans"
7702 case "$ans" in
7703 y*|true)
7704         usemallocwrap="$define" ;;
7705 *)
7706         usemallocwrap="$undef" ;;
7707 esac
7708
7709 : determine which malloc to compile in
7710 echo " "
7711 case "$usemymalloc" in
7712 [yY]*|true|$define)     dflt='y' ;;
7713 [nN]*|false|$undef)     dflt='n' ;;
7714 *)      case "$ptrsize" in
7715         4) dflt='y' ;;
7716         *) dflt='n' ;;
7717         esac
7718         if test "$useithreads" = "$define"; then dflt='n'; fi
7719         ;;
7720 esac
7721 rp="Do you wish to attempt to use the malloc that comes with $package?"
7722 . ./myread
7723 usemymalloc="$ans"
7724 case "$ans" in
7725 y*|true)
7726         usemymalloc='y'
7727         mallocsrc='malloc.c'
7728         mallocobj="malloc$_o"
7729         d_mymalloc="$define"
7730         case "$libs" in
7731         *-lmalloc*)
7732                 : Remove malloc from list of libraries to use
7733                 echo "Removing unneeded -lmalloc from library list" >&4
7734                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7735                 shift
7736                 libs="$*"
7737                 echo "libs = $libs" >&4
7738                 ;;
7739         esac
7740         ;;
7741 *)
7742         usemymalloc='n'
7743         mallocsrc=''
7744         mallocobj=''
7745         d_mymalloc="$undef"
7746         ;;
7747 esac
7748
7749 : compute the return types of malloc and free
7750 echo " "
7751 $cat >malloc.c <<END
7752 #$i_malloc I_MALLOC
7753 #$i_stdlib I_STDLIB
7754 #include <stdio.h>
7755 #include <sys/types.h>
7756 #ifdef I_MALLOC
7757 #include <malloc.h>
7758 #endif
7759 #ifdef I_STDLIB
7760 #include <stdlib.h>
7761 #endif
7762 #ifdef TRY_MALLOC
7763 void *malloc();
7764 #endif
7765 #ifdef TRY_FREE
7766 void free();
7767 #endif
7768 END
7769 case "$malloctype" in
7770 '')
7771         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7772                 malloctype='void *'
7773         else
7774                 malloctype='char *'
7775         fi
7776         ;;
7777 esac
7778 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7779
7780 case "$freetype" in
7781 '')
7782         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7783                 freetype='void'
7784         else
7785                 freetype='int'
7786         fi
7787         ;;
7788 esac
7789 echo "Your system uses $freetype free(), it would seem." >&4
7790 $rm -f malloc.[co]
7791 : determine where site specific architecture-dependent libraries go.
7792 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7793 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7794 : sitelib may have an optional trailing /share.
7795 case "$sitearch" in
7796 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7797         dflt="$dflt/$archname"
7798         ;;
7799 *)      dflt="$sitearch"
7800         ;;
7801 esac
7802 set sitearch sitearch none
7803 eval $prefixit
7804 $cat <<EOM
7805
7806 The installation process will also create a directory for
7807 architecture-dependent site-specific extensions and modules.
7808
7809 EOM
7810 fn=d~+
7811 rp='Pathname for the site-specific architecture-dependent library files?'
7812 . ./getfile
7813 prefixvar=sitearch
7814 . ./setprefixvar
7815 if $test X"$sitearch" = X"$sitelib"; then
7816         d_sitearch="$undef"
7817 else
7818         d_sitearch="$define"
7819 fi
7820
7821 : Set the vendorprefix variables
7822 $cat <<EOM
7823
7824 The installation process will also create a directory for
7825 vendor-supplied add-ons.  Vendors who supply perl with their system
7826 may find it convenient to place all vendor-supplied files in this
7827 directory rather than in the main distribution directory.  This will
7828 ease upgrades between binary-compatible maintenance versions of perl.
7829
7830 Of course you may also use these directories in whatever way you see
7831 fit.  For example, you might use them to access modules shared over a
7832 company-wide network.
7833
7834 The default answer should be fine for most people.
7835 This causes further questions about vendor add-ons to be skipped
7836 and no vendor-specific directories will be configured for perl.
7837
7838 EOM
7839 rp='Do you want to configure vendor-specific add-on directories?'
7840 case "$usevendorprefix" in
7841 define|true|[yY]*) dflt=y ;;
7842 *)      : User may have set vendorprefix directly on Configure command line.
7843         case "$vendorprefix" in
7844         ''|' ') dflt=n ;;
7845         *)      dflt=y ;;
7846         esac
7847         ;;
7848 esac
7849 . ./myread
7850 case "$ans" in
7851 [yY]*)  fn=d~+
7852         rp='Installation prefix to use for vendor-supplied add-ons?'
7853         case "$vendorprefix" in
7854         '') dflt="$prefix" ;;
7855         *)  dflt=$vendorprefix ;;
7856         esac
7857         . ./getfile
7858         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7859         oldvendorprefix=''
7860         case "$vendorprefix" in
7861         '') ;;
7862         *)      case "$ans" in
7863                 "$prefix") ;;
7864                 *) oldvendorprefix="$prefix";;
7865                 esac
7866                 ;;
7867         esac
7868         usevendorprefix="$define"
7869         vendorprefix="$ans"
7870         vendorprefixexp="$ansexp"
7871         ;;
7872 *)      usevendorprefix="$undef"
7873         vendorprefix=''
7874         vendorprefixexp=''
7875         ;;
7876 esac
7877
7878 : Set the vendorlib variables
7879 case "$vendorprefix" in
7880 '')     d_vendorlib="$undef"
7881         vendorlib=''
7882         vendorlibexp=''
7883         ;;
7884 *)      d_vendorlib="$define"
7885         : determine where vendor-supplied modules go.
7886         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7887         case "$vendorlib" in
7888         '')
7889                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7890                 case "$installstyle" in
7891                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7892                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7893                 esac
7894                 ;;
7895         *)      dflt="$vendorlib"
7896                 ;;
7897         esac
7898         fn=d~+
7899         rp='Pathname for the vendor-supplied library files?'
7900         . ./getfile
7901         vendorlib="$ans"
7902         vendorlibexp="$ansexp"
7903         ;;
7904 esac
7905 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7906 prefixvar=vendorlib
7907 . ./installprefix
7908
7909 : Set the vendorarch variables
7910 case "$vendorprefix" in
7911 '')     d_vendorarch="$undef"
7912         vendorarch=''
7913         vendorarchexp=''
7914         ;;
7915 *)      d_vendorarch="$define"
7916         : determine where vendor-supplied architecture-dependent libraries go.
7917         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7918         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7919         : vendorlib may have an optional trailing /share.
7920         case "$vendorarch" in
7921         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7922                 dflt="$dflt/$archname"
7923                 ;;
7924         *)      dflt="$vendorarch" ;;
7925         esac
7926         fn=d~+
7927         rp='Pathname for vendor-supplied architecture-dependent files?'
7928         . ./getfile
7929         vendorarch="$ans"
7930         vendorarchexp="$ansexp"
7931         ;;
7932 esac
7933 prefixvar=vendorarch
7934 . ./installprefix
7935 if $test X"$vendorarch" = X"$vendorlib"; then
7936         d_vendorarch="$undef"
7937 else
7938         d_vendorarch="$define"
7939 fi
7940
7941 : Final catch-all directories to search
7942 $cat <<EOM
7943
7944 Lastly, you can have perl look in other directories for extensions and
7945 modules in addition to those already specified.
7946 These directories will be searched after
7947         $sitearch
7948         $sitelib
7949 EOM
7950 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7951 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7952 echo ' '
7953 case "$otherlibdirs" in
7954 ''|' ') dflt='none' ;;
7955 *)      dflt="$otherlibdirs" ;;
7956 esac
7957 $cat <<EOM
7958 Enter a colon-separated set of extra paths to include in perl's @INC
7959 search path, or enter 'none' for no extra paths.
7960
7961 EOM
7962
7963 rp='Colon-separated list of additional directories for perl to search?'
7964 . ./myread
7965 case "$ans" in
7966 ' '|''|none)    otherlibdirs=' ' ;;
7967 *)      otherlibdirs="$ans" ;;
7968 esac
7969 case "$otherlibdirs" in
7970 ' ') val=$undef ;;
7971 *)      val=$define ;;
7972 esac
7973 set d_perl_otherlibdirs
7974 eval $setvar
7975
7976 : Cruising for prototypes
7977 echo " "
7978 echo "Checking out function prototypes..." >&4
7979 $cat >prototype.c <<EOCP
7980 #$i_stdlib I_STDLIB
7981 #ifdef I_STDLIB
7982 #include <stdlib.h>
7983 #endif
7984 int main(int argc, char *argv[]) {
7985         exit(0);}
7986 EOCP
7987 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7988         echo "Your C compiler appears to support function prototypes."
7989         val="$define"
7990 else
7991         echo "Your C compiler doesn't seem to understand function prototypes."
7992         val="$undef"
7993 fi
7994 set prototype
7995 eval $setvar
7996 $rm -f prototype*
7997
7998 : Check if ansi2knr is required
7999 case "$prototype" in
8000 "$define") ;;
8001 *)      ansi2knr='ansi2knr'
8002         echo " "
8003         cat <<EOM >&4
8004
8005 $me:  FATAL ERROR:
8006 This version of $package can only be compiled by a compiler that
8007 understands function prototypes.  Unfortunately, your C compiler
8008         $cc $ccflags
8009 doesn't seem to understand them.  Sorry about that.
8010
8011 If GNU cc is available for your system, perhaps you could try that instead.
8012
8013 Eventually, we hope to support building Perl with pre-ANSI compilers.
8014 If you would like to help in that effort, please contact <perlbug@perl.org>.
8015
8016 Aborting Configure now.
8017 EOM
8018         exit 2
8019         ;;
8020 esac
8021
8022 : DTrace support
8023 dflt_dtrace='/usr/sbin/dtrace'
8024 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8025
8026 cat <<EOM
8027
8028 Perl can be built to support DTrace on platforms that support it.
8029 DTrace is a diagnosis and performance analysis tool from Sun.
8030
8031 If this doesn't make any sense to you, just accept the default '$dflt'.
8032 EOM
8033
8034 while $test 1 ; do
8035         case "$usedtrace" in
8036         $define|true|[yY]*)
8037                 dflt='y'
8038                 ;;
8039         ?*)
8040                 dflt='y'
8041                 dflt_dtrace=$usedtrace
8042                 ;;
8043         *)
8044                 dflt='n'
8045                 ;;
8046         esac
8047
8048         rp='Support DTrace if available?'
8049         . ./myread
8050         case "$ans" in
8051         y|Y)    val="$define" ;;
8052         *)      val="$undef" ;;
8053         esac
8054         set usedtrace
8055         eval $setvar
8056
8057         test "X$usedtrace" != "X$define" && break
8058
8059         echo " "
8060         rp='Where is the dtrace executable?'
8061         dflt=$dflt_dtrace
8062         . ./getfile
8063         val="$ans"
8064         set dtrace
8065         eval $setvar
8066
8067         if $test -f $dtrace
8068         then
8069                 if $dtrace -h -s ../perldtrace.d \
8070                         -o perldtrace.tmp >/dev/null 2>&1 \
8071                         && rm -f perldtrace.tmp
8072                 then
8073                         echo " "
8074                         echo "Good: your $dtrace knows about the -h flag."
8075                 else
8076                         cat >&2 <<EOM
8077
8078 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8079 ***
8080 *** Your installed dtrace doesn't support the -h switch to compile a D
8081 *** program into a C header. Can't continue.
8082
8083 EOM
8084                         exit 1
8085                 fi
8086                 break;
8087         fi
8088
8089         case "$fastread" in
8090         yes)
8091                 cat >&2 <<EOM
8092
8093 *** $me:  Fatal Error:  $dtrace not found.
8094 *** Can't continue.
8095
8096 EOM
8097                 exit 1
8098                 ;;
8099         *)
8100                 echo "*** $dtrace was not found."
8101                 echo " "
8102                 ;;
8103         esac
8104 done
8105
8106 : See if we want extra modules installed
8107 echo " "
8108 case "$extras" in
8109 '') dflt='n';;
8110 *) dflt='y';;
8111 esac
8112 cat <<EOM
8113 Perl can be built with extra modules or bundles of modules which
8114 will be fetched from the CPAN and installed alongside Perl.
8115
8116 Notice that you will need access to the CPAN; either via the Internet,
8117 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8118 be asked later to configure the CPAN.pm module which will in turn do
8119 the installation of the rest of the extra modules or bundles.)
8120
8121 Notice also that if the modules require any external software such as
8122 libraries and headers (the libz library and the zlib.h header for the
8123 Compress::Zlib module, for example) you MUST have any such software
8124 already installed, this configuration process will NOT install such
8125 things for you.
8126
8127 If this doesn't make any sense to you, just accept the default '$dflt'.
8128 EOM
8129 rp='Install any extra modules (y or n)?'
8130 . ./myread
8131 case "$ans" in
8132 y|Y)
8133         cat <<EOM
8134
8135 Please list any extra modules or bundles to be installed from CPAN,
8136 with spaces between the names.  The names can be in any format the
8137 'install' command of CPAN.pm will understand.  (Answer 'none',
8138 without the quotes, to install no extra modules or bundles.)
8139 EOM
8140         rp='Extras?'
8141         dflt="$extras"
8142         . ./myread
8143         extras="$ans"
8144 esac
8145 case "$extras" in
8146 ''|'none')
8147         val=''
8148         $rm -f ../extras.lst
8149         ;;
8150 *)      echo "(Saving the list of extras for later...)"
8151         echo "$extras" > ../extras.lst
8152         val="'$extras'"
8153         ;;
8154 esac
8155 set extras
8156 eval $setvar
8157 echo " "
8158
8159 : determine where html pages for programs go
8160 set html1dir html1dir none
8161 eval $prefixit
8162 $cat <<EOM
8163
8164 If you wish to install html files for programs in $spackage, indicate
8165 the appropriate directory here.  To skip installing html files,
8166 answer "none".
8167 EOM
8168 case "$html1dir" in
8169 ''|none|$undef|' ') dflt=none ;;
8170 *) dflt=$html1dir ;;
8171 esac
8172 fn=dn+~
8173 rp="Directory for the main $spackage html pages?"
8174 . ./getfile
8175 prefixvar=html1dir
8176 . ./setprefixvar
8177 : Use ' ' for none so value is preserved next time through Configure
8178 $test X"$html1dir" = "X" && html1dir=' '
8179
8180 : determine where html pages for libraries and modules go
8181 set html3dir html3dir none
8182 eval $prefixit
8183 $cat <<EOM
8184
8185 If you wish to install html files for modules associated with $spackage,
8186 indicate the appropriate directory here.  To skip installing html files,
8187 answer "none".
8188 EOM
8189 : There is no obvious default.  If they have specified html1dir, then
8190 : try to key off that, possibly changing .../html1 into .../html3.
8191 case "$html3dir" in
8192 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8193 *) dflt=$html3dir ;;
8194 esac
8195 fn=dn+~
8196 rp="Directory for the $spackage module html pages?"
8197 . ./getfile
8198 prefixvar=html3dir
8199 . ./setprefixvar
8200 : Use ' ' for none so value is preserved next time through Configure
8201 $test X"$html3dir" = "X" && html3dir=' '
8202
8203 : determine whether to install perl also as /usr/bin/perl
8204
8205 echo " "
8206 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8207         $cat <<EOM
8208 Many scripts expect perl to be installed as /usr/bin/perl.
8209
8210 If you want to, I can install the perl you are about to compile
8211 as /usr/bin/perl (in addition to $bin/perl).
8212 EOM
8213         if test -f /usr/bin/perl; then
8214             $cat <<EOM
8215
8216 However, please note that because you already have a /usr/bin/perl,
8217 overwriting that with a new Perl would very probably cause problems.
8218 Therefore I'm assuming you don't want to do that (unless you insist).
8219
8220 EOM
8221             case "$installusrbinperl" in
8222             "$define"|[yY]*)    dflt='y';;
8223             *)                  dflt='n';;
8224             esac
8225         else
8226             $cat <<EOM
8227
8228 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8229
8230 EOM
8231             case "$installusrbinperl" in
8232             "$undef"|[nN]*)     dflt='n';;
8233             *)                  dflt='y';;
8234             esac
8235         fi
8236         rp="Do you want to install perl as /usr/bin/perl?"
8237         . ./myread
8238         case "$ans" in
8239         [yY]*)  val="$define";;
8240         *)      val="$undef" ;;
8241         esac
8242 else
8243         val="$undef"
8244 fi
8245 set installusrbinperl
8246 eval $setvar
8247
8248 : see if dlopen exists
8249 xxx_runnm="$runnm"
8250 xxx_ccflags="$ccflags"
8251 runnm=false
8252 : with g++ one needs -shared to get is-in-libc to work for dlopen
8253 case "$gccversion" in
8254 '')     ;;
8255 *)      case "$d_cplusplus" in
8256         "$define") ccflags="$ccflags -shared" ;;
8257         esac
8258         ;;
8259 esac
8260 set dlopen d_dlopen
8261 eval $inlibc
8262 runnm="$xxx_runnm"
8263 ccflags="$xxx_ccflags"
8264
8265 : see if this is a unistd.h system
8266 set unistd.h i_unistd
8267 eval $inhdr
8268
8269 : determine which dynamic loading, if any, to compile in
8270 echo " "
8271 dldir="ext/DynaLoader"
8272 case "$usedl" in
8273     $define|y|true)
8274         dflt='y'
8275         usedl="$define"
8276         ;;
8277     $undef|n|false)
8278         dflt='n'
8279         usedl="$undef"
8280         ;;
8281     *)
8282         dflt='n'
8283         case "$d_dlopen" in
8284             $define) dflt='y' ;;
8285         esac
8286         : Does a dl_xxx.xs file exist for this operating system
8287         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8288         ;;
8289 esac
8290 rp="Do you wish to use dynamic loading?"
8291 . ./myread
8292 usedl="$ans"
8293 bin_ELF="$undef"
8294 case "$ans" in
8295     y*) usedl="$define"
8296         case "$dlsrc" in
8297             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8298                     dflt="$dldir/dl_${osname}.xs"
8299                 elif $test "$d_dlopen" = "$define" ; then
8300                     dflt="$dldir/dl_dlopen.xs"
8301                 else
8302                     dflt=''
8303                 fi
8304                 ;;
8305             *)  dflt="$dldir/$dlsrc"
8306                 ;;
8307         esac
8308         echo "The following dynamic loading files are available:"
8309         : Can not go over to $dldir because getfile has path hard-coded in.
8310         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8311         rp="Source file to use for dynamic loading"
8312         fn="fne"
8313         gfpth="$src"
8314         . ./getfile
8315         usedl="$define"
8316         : emulate basename
8317         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8318
8319         $cat << EOM
8320
8321 Some systems may require passing special flags to $cc -c to
8322 compile modules that will be used to create a shared library.
8323 To use no flags, say "none".
8324
8325 EOM
8326         case "$cccdlflags" in
8327             '') case "$gccversion" in
8328                 '') case "$osname" in
8329                         hpux)   dflt='+z' ;;
8330                         irix*)  dflt='-KPIC' ;;
8331                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8332                         sunos)  dflt='-pic' ;;
8333                         *)      dflt='none' ;;
8334                     esac
8335                     ;;
8336                 *)  case "$osname" in
8337                         darwin) dflt='none' ;;
8338                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8339                         *)      dflt='-fpic' ;;
8340                     esac ;;
8341                 esac ;;
8342             ' ') dflt='none' ;;
8343             *)   dflt="$cccdlflags" ;;
8344         esac
8345
8346         case "$dflt" in
8347             none) dflt='' ;;
8348         esac
8349
8350         # If -Dsysroot was specified, now's the time to add it
8351         # to cccdlflags
8352         if test "X$sysroot" != X; then
8353             case "$gccversion" in
8354                 '') ;;
8355                 *)  case "$dflt" in
8356                         *sysroot*) ;;
8357                         'undef'|*)
8358                             dflt="$dflt --sysroot=$sysroot" ;;
8359                     esac
8360                     ;;
8361             esac
8362         fi
8363
8364         case "$dflt" in
8365             '') dflt='none';;
8366         esac
8367
8368         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8369         . ./myread
8370         case "$ans" in
8371             none) cccdlflags=' ' ;;
8372             *)    cccdlflags="$ans" ;;
8373         esac
8374
8375         cat << EOM
8376
8377 Some systems use ld to create libraries that can be dynamically loaded,
8378 while other systems (such as those using ELF) use $cc.
8379
8380 EOM
8381
8382 : Determine if this is ELF
8383         $cat >try.c <<EOM
8384 /* Test for whether ELF binaries are produced */
8385 #include <fcntl.h>
8386 #$i_stdlib I_STDLIB
8387 #ifdef I_STDLIB
8388 #include <stdlib.h>
8389 #endif
8390 #$i_unistd I_UNISTD
8391 #ifdef I_UNISTD
8392 #include <unistd.h>
8393 #endif
8394 int main() {
8395     char b[4];
8396     int i = open("a.out",O_RDONLY);
8397     if(i == -1)
8398         exit(1); /* fail */
8399     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8400         exit(0); /* succeed (yes, it is ELF) */
8401     exit(1); /* fail */
8402 }
8403 EOM
8404         if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8405             bin_ELF="$define"
8406         fi
8407         $rm_try
8408
8409         case "$ld" in
8410             '') if $test $bin_ELF = "$define"; then
8411                     cat <<EOM
8412 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8413 EOM
8414                     dflt="$cc"
8415                 else
8416                     echo "I'll use ld to build dynamic libraries."
8417                     dflt='ld'
8418                 fi
8419                 ;;
8420             *)  dflt="$ld"
8421                 ;;
8422         esac
8423
8424         rp="What command should be used to create dynamic libraries?"
8425         . ./myread
8426         ld="$ans"
8427
8428         cat << EOM
8429
8430 Some systems may require passing special flags to $ld to create a
8431 library that can be dynamically loaded.  If your ld flags include
8432 -L/other/path options to locate libraries outside your loader's normal
8433 search path, you may need to specify those -L options here as well.  To
8434 use no flags, say "none".
8435
8436 EOM
8437         case "$lddlflags" in
8438             '') case "$osname" in
8439                     haiku) dflt='-shared' ;;
8440                     hpux) dflt='-b';
8441                           case "$gccversion" in
8442                               '') dflt="$dflt +vnocompatwarnings" ;;
8443                           esac
8444                           ;;
8445                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8446                     solaris) # See [perl #66604].
8447                             # On Solaris 11, gcc -m64 on amd64
8448                             # appears not to understand -G.  gcc versions at
8449                             # least as old as 3.4.3 support -shared, so just
8450                             # use that with Solaris 11 and later, but keep
8451                             # the old behavior for older Solaris versions.
8452                             case "$gccversion" in
8453                                 '') dflt='-G' ;;
8454                                 *)  case "$osvers" in
8455                                         2.?|2.10) dflt='-G' ;;
8456                                         *) dflt='-shared' ;;
8457                                     esac
8458                                     ;;
8459                             esac
8460                             ;;
8461                     sunos) dflt='-assert nodefinitions' ;;
8462                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8463                     *)     dflt='none' ;;
8464                 esac
8465                 ;;
8466             *) dflt="$lddlflags" ;;
8467         esac
8468
8469         : Only do this for gcc, since, for example, qcc has no concept
8470         : of --sysroot.
8471         if $test "X$sysroot" != X; then
8472             case "$gccversion" in
8473                 '') ;;
8474                 *)  dflt="$dflt --sysroot $sysroot" ;;
8475             esac
8476         fi
8477
8478         : Try to guess additional flags to pick up local libraries.
8479         : Be careful not to append to a plain 'none'
8480         case "$dflt" in
8481             none) dflt='' ;;
8482         esac
8483         for thisflag in $ldflags; do
8484             case "$thisflag" in
8485                 -L*|-R*|-Wl,-R*)
8486                     case " $dflt " in
8487                         *" $thisflag "*) ;;
8488                         *) dflt="$dflt $thisflag" ;;
8489                     esac
8490                     ;;
8491             esac
8492         done
8493
8494         case "$dflt" in
8495             ''|' ') dflt='none' ;;
8496         esac
8497
8498         case "$ldflags" in
8499             *-fstack-protector-strong*)
8500                 case "$dflt" in
8501                     *-fstack-protector-strong*) ;; # Don't add it again
8502                     *) dflt="$dflt -fstack-protector-strong" ;;
8503                 esac
8504                 ;;
8505             *-fstack-protector*)
8506                 case "$dflt" in
8507                     *-fstack-protector*) ;; # Don't add it again
8508                     *) dflt="$dflt -fstack-protector" ;;
8509                 esac
8510                 ;;
8511         esac
8512
8513         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8514         . ./myread
8515         case "$ans" in
8516             none) lddlflags=' ' ;;
8517             *) lddlflags="$ans" ;;
8518         esac
8519
8520         cat <<EOM
8521
8522 Some systems may require passing special flags to $cc to indicate that
8523 the resulting executable will use dynamic linking.  To use no flags,
8524 say "none".
8525
8526 EOM
8527         case "$ccdlflags" in
8528             '') case "$osname" in
8529                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8530                     sunos)             dflt='none'   ;;
8531                     *)                 dflt='none'   ;;
8532                 esac ;;
8533             ' ') dflt='none' ;;
8534             *)   dflt="$ccdlflags" ;;
8535         esac
8536         rp="Any special flags to pass to $cc to use dynamic linking?"
8537         . ./myread
8538         case "$ans" in
8539             none) ccdlflags=' ' ;;
8540             *)    ccdlflags="$ans" ;;
8541         esac
8542         ;;
8543
8544     *)  usedl="$undef"
8545         ld='ld'
8546         dlsrc='dl_none.xs'
8547         lddlflags=''
8548         ccdlflags=''
8549         ;;
8550 esac
8551
8552 ld_can_script="$undef"
8553 case "$bin_ELF$usedl" in
8554     $define$define)
8555         # Abuse try.h and a.out names for neat cleanup
8556         $cat >try.c <<EOM
8557 void foo() {}
8558 void bar() {}
8559 EOM
8560         $cat >try.h <<EOM
8561 LIBTEST_42 {
8562  global:
8563   foo;
8564  local: *;
8565  };
8566 EOM
8567         if $cc $cccdlflags $ccdlflags $ccflags \
8568                $ldflags $lddlflags -o a.out try.c \
8569                -Wl,--version-script=try.h >/dev/null 2>&1 \
8570            &&  $test -s a.out ; then
8571             echo "ld supports scripting" >&4
8572             ld_can_script="$define"
8573         else
8574             echo "ld does not support scripting" >&4
8575         fi
8576         $rm_try
8577         ;;
8578 esac
8579
8580 : Do we want a shared libperl?
8581 also=''
8582 case "$usedl" in
8583 $undef)
8584         # No dynamic loading being used, so don't bother even to prompt.
8585         useshrplib='false'
8586         ;;
8587 *)      case "$useshrplib" in
8588         '')     case "$osname" in
8589                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8590                         dflt=y
8591                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8592                         ;;
8593                 *)      dflt=n
8594                         ;;
8595                 esac
8596                 ;;
8597         $define|true|[Yy]*)
8598                 dflt=y
8599                 ;;
8600         *)      dflt=n
8601                 ;;
8602         esac
8603         $cat << EOM
8604
8605 The perl executable is normally obtained by linking perlmain.c with
8606 libperl${_a}, any static extensions (usually just DynaLoader), and
8607 any other libraries needed on this system (such as -lm, etc.).  Since
8608 your system supports dynamic loading, it is probably possible to build
8609 a shared libperl.$so.  If you will have more than one executable linked
8610 to libperl.$so, this will significantly reduce the size of each
8611 executable, but it may have a noticeable effect on performance.  The
8612 default is probably sensible for your system.
8613 $also
8614
8615 EOM
8616         rp="Build a shared libperl.$so (y/n)"
8617         . ./myread
8618         case "$ans" in
8619         true|$define|[Yy]*)
8620                 useshrplib='true'  ;;
8621         *)      useshrplib='false' ;;
8622         esac
8623         ;;
8624 esac
8625
8626 case "$useshrplib" in
8627 true)
8628         case "$userelocatableinc" in
8629         true|define)
8630                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8631                 echo "See INSTALL for an explanation why that won't work." >&4
8632                 exit 4
8633                 ;;
8634         esac
8635         case "$libperl" in
8636         '')
8637                 # Figure out a good name for libperl.so.  Since it gets stored in
8638                 # a version-specific architecture-dependent library, the version
8639                 # number isn't really that important, except for making cc/ld happy.
8640                 #
8641                 # A name such as libperl.so.10.1
8642                 majmin="libperl.$so.$patchlevel.$subversion"
8643                 # A name such as libperl.so.100
8644                 majonly=`echo $patchlevel $subversion |
8645                         $awk '{printf "%d%02d", $1, $2}'`
8646                 majonly=libperl.$so.$majonly
8647                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8648                 # rely on figuring it out from the naming of libc.
8649                 case "${osname}${osvers}" in
8650                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8651                         dflt=libperl.$so
8652                         ;;
8653                 cygwin*) # ld links now against the dll directly
8654                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8655                         majonly=`echo $patchlevel $subversion |
8656                                 $awk '{printf "%03d%03d", $1, $2}'`
8657                         majonly=cygperl5.$majonly.$so
8658                         dflt=$majmin
8659                         ;;
8660                 *)      # Try to guess based on whether libc has major.minor.
8661                         case "$libc" in
8662                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8663                         *libc.$so.[0-9]*) dflt=$majonly ;;
8664                         *)      dflt=libperl.$so ;;
8665                         esac
8666                         ;;
8667                 esac
8668                 ;;
8669         *)      dflt=$libperl
8670                 ;;
8671         esac
8672         cat << EOM
8673
8674 I need to select a good name for the shared libperl.  If your system uses
8675 library names with major and minor numbers, then you might want something
8676 like $majmin.  Alternatively, if your system uses a single version
8677 number for shared libraries, then you might want to use $majonly.
8678 Or, your system might be quite happy with a simple libperl.$so.
8679
8680 Since the shared libperl will get installed into a version-specific
8681 architecture-dependent directory, the version number of the shared perl
8682 library probably isn't important, so the default should be o.k.
8683
8684 EOM
8685         rp='What name do you want to give to the shared libperl?'
8686         . ./myread
8687         libperl=$ans
8688         echo "Ok, I'll use $libperl"
8689         ;;
8690 *)
8691         libperl="libperl${_a}"
8692         ;;
8693 esac
8694
8695 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8696 case "$shrpdir" in
8697 '') ;;
8698 *)      $cat >&4 <<EOM
8699 WARNING:  Use of the shrpdir variable for the installation location of
8700 the shared $libperl is not supported.  It was never documented and
8701 will not work in this version.  Let me (perlbug@perl.org)
8702 know of any problems this may cause.
8703
8704 EOM
8705         case "$shrpdir" in
8706         "$archlibexp/CORE")
8707                 $cat >&4 <<EOM
8708 But your current setting of $shrpdir is
8709 the default anyway, so it's harmless.
8710 EOM
8711                 ;;
8712         *)
8713                 $cat >&4 <<EOM
8714 Further, your current attempted setting of $shrpdir
8715 conflicts with the value of $archlibexp/CORE
8716 that installperl will use.
8717 EOM
8718                 ;;
8719         esac
8720         ;;
8721 esac
8722
8723 # How will the perl executable find the installed shared $libperl?
8724 # Add $xxx to ccdlflags.
8725 # If we can't figure out a command-line option, use $shrpenv to
8726 # set env LD_RUN_PATH.  The main perl makefile uses this.
8727 shrpdir=$archlibexp/CORE
8728 xxx=''
8729 tmp_shrpenv=''
8730 if "$useshrplib"; then
8731     case "$osname" in
8732         aix)
8733                 # We'll set it in Makefile.SH...
8734                 ;;
8735         solaris)
8736                 xxx="-R $shrpdir"
8737                 ;;
8738         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8739                 xxx="-Wl,-R$shrpdir"
8740                 ;;
8741         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8742                 xxx="-Wl,-rpath,$shrpdir"
8743                 ;;
8744         hpux*)
8745                 # hpux doesn't like the default, either.
8746                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8747                 ;;
8748         cygwin)
8749                 # cygwin needs only ldlibpth
8750                 ;;
8751         *)
8752                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8753                 ;;
8754         esac
8755         case "$xxx" in
8756         '') ;;
8757         *)
8758                 # Only add $xxx if it isn't already in ccdlflags.
8759                 case " $ccdlflags " in
8760                 *" $xxx "*)     ;;
8761                 *)      ccdlflags="$ccdlflags $xxx"
8762                         cat <<EOM >&4
8763
8764 Adding $xxx to the flags
8765 passed to $ld so that the perl executable will find the
8766 installed shared $libperl.
8767
8768 EOM
8769                         ;;
8770                 esac
8771                 ;;
8772         esac
8773 fi
8774 # Fix ccdlflags in AIX for building external extensions.
8775 # (For building Perl itself bare -bE:perl.exp is needed,
8776 #  Makefile.SH takes care of this.)
8777 case "$osname" in
8778 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8779 esac
8780 # Respect a hint or command-line value.
8781 case "$shrpenv" in
8782 '') shrpenv="$tmp_shrpenv" ;;
8783 esac
8784 case "$ldlibpthname" in
8785 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8786 none)   ldlibpthname='' ;;
8787 esac
8788
8789 : determine where manual pages are on this system
8790 echo " "
8791 case "$sysman" in
8792 '')
8793         syspath='/usr/share/man/man1 /usr/man/man1'
8794         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8795         syspath="$syspath /usr/man/u_man/man1"
8796         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8797         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8798         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8799         sysman=`./loc . /usr/man/man1 $syspath`
8800         ;;
8801 esac
8802 if $test -d "$sysman"; then
8803         echo "System manual is in $sysman." >&4
8804 else
8805         echo "Could not find manual pages in source form." >&4
8806 fi
8807
8808 : determine where manual pages go
8809 set man1dir man1dir none
8810 eval $prefixit
8811 $cat <<EOM
8812
8813 $spackage has manual pages available in source form.
8814 EOM
8815 case "$nroff" in
8816 nroff)
8817         echo "However, you don't have nroff, so they're probably useless to you."
8818         case "$man1dir" in
8819         '') man1dir="none";;
8820         esac;;
8821 esac
8822 echo "If you don't want the manual sources installed, answer 'none'."
8823 case "$man1dir" in
8824 ' ') dflt=none
8825         ;;
8826 '')
8827         lookpath="$prefixexp/share/man/man1"
8828         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8829         lookpath="$lookpath $prefixexp/man/p_man/man1"
8830         lookpath="$lookpath $prefixexp/man/u_man/man1"
8831         lookpath="$lookpath $prefixexp/man/man.1"
8832         case "$sysman" in
8833         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8834         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8835         esac
8836         set dflt
8837         eval $prefixup
8838         ;;
8839 *)  dflt="$man1dir"
8840         ;;
8841 esac
8842 echo " "
8843 fn=dn+~
8844 rp="Where do the main $spackage manual pages (source) go?"
8845 . ./getfile
8846 if $test "X$man1direxp" != "X$ansexp"; then
8847         installman1dir=''
8848 fi
8849 prefixvar=man1dir
8850 . ./setprefixvar
8851
8852 case "$man1dir" in
8853 '')     man1dir=' '
8854         installman1dir='';;
8855 esac
8856
8857 : What suffix to use on installed man pages
8858
8859 case "$man1dir" in
8860 ' ')
8861         man1ext='0'
8862         ;;
8863 *)
8864         rp="What suffix should be used for the main $spackage man pages?"
8865         case "$man1ext" in
8866         '')     case "$man1dir" in
8867                 *1)  dflt=1 ;;
8868                 *1p) dflt=1p ;;
8869                 *1pm) dflt=1pm ;;
8870                 *l) dflt=l;;
8871                 *n) dflt=n;;
8872                 *o) dflt=o;;
8873                 *p) dflt=p;;
8874                 *C) dflt=C;;
8875                 *L) dflt=L;;
8876                 *L1) dflt=L1;;
8877                 *) dflt=1;;
8878                 esac
8879                 ;;
8880         *)      dflt="$man1ext";;
8881         esac
8882         . ./myread
8883         man1ext="$ans"
8884         ;;
8885 esac
8886
8887 : see if we can have long filenames
8888 echo " "
8889 first=123456789abcdef
8890 $rm -f $first
8891 if (echo hi >$first) 2>/dev/null; then
8892         if $test -f 123456789abcde; then
8893                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8894                 val="$undef"
8895         else
8896                 echo 'You can have filenames longer than 14 characters.'>&4
8897                 val="$define"
8898         fi
8899 else
8900         $cat <<'EOM'
8901 You can't have filenames longer than 14 chars.
8902 You can't even think about them!
8903 EOM
8904         val="$undef"
8905 fi
8906 set d_flexfnam
8907 eval $setvar
8908 $rm -rf 123456789abcde*
8909
8910 : determine where library module manual pages go
8911 set man3dir man3dir none
8912 eval $prefixit
8913 $cat <<EOM
8914
8915 $spackage has manual pages for many of the library modules.
8916 EOM
8917
8918 case "$nroff" in
8919 nroff)
8920         $cat <<'EOM'
8921 However, you don't have nroff, so they're probably useless to you.
8922 EOM
8923         case "$man3dir" in
8924         '') man3dir="none";;
8925         esac;;
8926 esac
8927
8928 case "$d_flexfnam" in
8929 undef)
8930         $cat <<'EOM'
8931 However, your system can't handle the long file names like File::Basename.3.
8932 EOM
8933         case "$man3dir" in
8934         '') man3dir="none";;
8935         esac;;
8936 esac
8937
8938 echo "If you don't want the manual sources installed, answer 'none'."
8939 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8940 case "$man3dir" in
8941 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8942         if $test -d "$privlib/man/man3"; then
8943                 cat <<EOM >&4
8944
8945 WARNING:  Previous versions of perl installed man3 pages into
8946 $privlib/man/man3.  This version will suggest a
8947 new default of $dflt.
8948 EOM
8949                 tdflt=$dflt
8950                 dflt='n'
8951                 rp='Do you wish to preserve the old behavior?(y/n)'
8952                 . ./myread
8953                 case "$ans" in
8954                 y*) dflt="$privlib/man/man3" ;;
8955                 *)  dflt=$tdflt ;;
8956                 esac
8957     fi
8958         ;;
8959 *)      dflt="$man3dir" ;;
8960 esac
8961 case "$dflt" in
8962 ' ') dflt=none ;;
8963 esac
8964 echo " "
8965 fn=dn+~
8966 rp="Where do the $package library man pages (source) go?"
8967 . ./getfile
8968 prefixvar=man3dir
8969 . ./setprefixvar
8970
8971 case "$man3dir" in
8972 '')     man3dir=' '
8973         installman3dir='';;
8974 esac
8975
8976 : What suffix to use on installed man pages
8977 case "$man3dir" in
8978 ' ')
8979         man3ext='0'
8980         ;;
8981 *)
8982         rp="What suffix should be used for the $package library man pages?"
8983         case "$man3ext" in
8984         '')     case "$man3dir" in
8985                 *3)  dflt=3 ;;
8986                 *3p) dflt=3p ;;
8987                 *3pm) dflt=3pm ;;
8988                 *l) dflt=l;;
8989                 *n) dflt=n;;
8990                 *o) dflt=o;;
8991                 *p) dflt=p;;
8992                 *C) dflt=C;;
8993                 *L) dflt=L;;
8994                 *L3) dflt=L3;;
8995                 *) dflt=3;;
8996                 esac
8997                 ;;
8998         *)      dflt="$man3ext";;
8999         esac
9000         . ./myread
9001         man3ext="$ans"
9002         ;;
9003 esac
9004
9005 : see if we have to deal with yellow pages, now NIS.
9006 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9007         case "$hostcat" in
9008         nidump*) ;;
9009         *)
9010                 case "$hostcat" in
9011                 *ypcat*) dflt=y;;
9012                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9013                                 dflt=y
9014                         else
9015                                 dflt=n
9016                         fi;;
9017                 *) dflt=n;;
9018                 esac
9019                 echo " "
9020                 rp='Are you getting the hosts file via yellow pages?'
9021                 . ./myread
9022                 case "$ans" in
9023                 y*) hostcat='ypcat hosts';;
9024                 *) hostcat='cat /etc/hosts';;
9025                 esac
9026                 ;;
9027         esac
9028 fi
9029 case "$hostcat" in
9030 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9031 esac
9032 case "$groupcat" in
9033 '') test -f /etc/group && groupcat='cat /etc/group';;
9034 esac
9035 case "$passcat" in
9036 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9037 esac
9038
9039 : now get the host name
9040 echo " "
9041 echo "Figuring out host name..." >&4
9042 case "$myhostname" in
9043 '') cont=true
9044         echo 'Maybe "hostname" will work...'
9045         if tans=`sh -c hostname 2>&1` ; then
9046                 myhostname=$tans
9047                 phostname=hostname
9048                 cont=''
9049         fi
9050         ;;
9051 *) cont='';;
9052 esac
9053 if $test "$cont"; then
9054         if ./xenix; then
9055                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9056                 if tans=`cat /etc/systemid 2>&1` ; then
9057                         myhostname=$tans
9058                         phostname='cat /etc/systemid'
9059                         echo "Whadyaknow.  Xenix always was a bit strange..."
9060                         cont=''
9061                 fi
9062         elif $test -r /etc/systemid; then
9063                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9064         fi
9065 fi
9066 if $test "$cont"; then
9067         echo 'No, maybe "uuname -l" will work...'
9068         if tans=`sh -c 'uuname -l' 2>&1` ; then
9069                 myhostname=$tans
9070                 phostname='uuname -l'
9071         else
9072                 echo 'Strange.  Maybe "uname -n" will work...'
9073                 if tans=`sh -c 'uname -n' 2>&1` ; then
9074                         myhostname=$tans
9075                         phostname='uname -n'
9076                 else
9077                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9078                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9079                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9080                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9081                         else
9082                                 case "$myhostname" in
9083                                 '') echo "Does this machine have an identity crisis or something?"
9084                                         phostname='';;
9085                                 *)
9086                                         echo "Well, you said $myhostname before..."
9087                                         phostname='echo $myhostname';;
9088                                 esac
9089                         fi
9090                 fi
9091         fi
9092 fi
9093 case "$myhostname" in
9094 '') myhostname=noname ;;
9095 esac
9096 : you do not want to know about this
9097 set $myhostname
9098 myhostname=$1
9099
9100 : verify guess
9101 if $test "$myhostname" ; then
9102         dflt=y
9103         rp='Your host name appears to be "'$myhostname'".'" Right?"
9104         . ./myread
9105         case "$ans" in
9106         y*) ;;
9107         *) myhostname='';;
9108         esac
9109 fi
9110
9111 : bad guess or no guess
9112 while $test "X$myhostname" = X ; do
9113         dflt=''
9114         rp="Please type the (one word) name of your host:"
9115         . ./myread
9116         myhostname="$ans"
9117 done
9118
9119 : translate upper to lower if necessary
9120 case "$myhostname" in
9121 *[A-Z]*)
9122         echo "(Normalizing case in your host name)"
9123         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9124         ;;
9125 esac
9126
9127 case "$myhostname" in
9128 *.*)
9129         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9130         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9131         echo "(Trimming domain name from host name--host name is now $myhostname)"
9132         ;;
9133 *) case "$mydomain" in
9134         '')
9135                 {
9136                         test "X$hostcat" = "Xypcat hosts" &&
9137                         ypmatch "$myhostname" hosts 2>/dev/null |\
9138                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9139                         $test -s hosts
9140                 } || {
9141                         test "X$hostcat" != "X" &&
9142                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9143                                         /[       ]$myhostname[  . ]/p" > hosts
9144                 }
9145                 tmp_re="[       . ]"
9146                 if $test -f hosts; then
9147                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9148                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9149                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9150                                 hosts | $sort | $uniq | \
9151                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9152                         case `$echo X$dflt` in
9153                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9154                                 dflt=.
9155                                 ;;
9156                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9157                                 ;;
9158                         esac
9159                 else
9160                         echo "(I cannot locate a hosts database anywhere)"
9161                         dflt=.
9162                 fi
9163                 case "$dflt" in
9164                 .)
9165                         tans=`./loc resolv.conf X /etc /usr/etc`
9166                         if $test -f "$tans"; then
9167                                 echo "(Attempting domain name extraction from $tans)"
9168                                 dflt=.`$sed -n -e 's/   / /g' \
9169                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9170                                   -e 1q 2>/dev/null`
9171                                 case "$dflt" in
9172                                 .) dflt=.`$sed -n -e 's/        / /g' \
9173                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9174                                      -e 1q 2>/dev/null`
9175                                         ;;
9176                                 esac
9177                         fi
9178                         ;;
9179                 esac
9180                 case "$dflt" in
9181                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9182                         dflt=.`sh -c domainname 2>/dev/null`
9183                         case "$dflt" in
9184                         '') dflt='.';;
9185                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9186                         esac
9187                         ;;
9188                 esac
9189                 case "$dflt$osname" in
9190                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9191                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9192                         ;;
9193                 esac
9194                 case "$dflt" in
9195                 .) echo "(Lost all hope -- silly guess then)"
9196                         dflt='.nonet'
9197                         ;;
9198                 esac
9199                 $rm -f hosts
9200                 ;;
9201         *) dflt="$mydomain";;
9202         esac;;
9203 esac
9204 echo " "
9205 rp="What is your domain name?"
9206 . ./myread
9207 tans="$ans"
9208 case "$ans" in
9209 '') ;;
9210 .*) ;;
9211 *) tans=".$tans";;
9212 esac
9213 mydomain="$tans"
9214
9215 : translate upper to lower if necessary
9216 case "$mydomain" in
9217 *[A-Z]*)
9218         echo "(Normalizing case in your domain name)"
9219         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9220         ;;
9221 esac
9222
9223 : a little sanity check here
9224 case "$phostname" in
9225 '') ;;
9226 *)
9227         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9228         $myhostname$mydomain|$myhostname) ;;
9229         *)
9230                 case "$phostname" in
9231                 sed*)
9232                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9233                         ;;
9234                 *)
9235                         echo "(That doesn't agree with your $phostname command, by the way.)"
9236                         ;;
9237                 esac
9238         ;;
9239         esac
9240         ;;
9241 esac
9242
9243 : determine the e-mail address of the user who is running us
9244 $cat <<EOM
9245
9246 I need to get your e-mail address in Internet format if possible, i.e.
9247 something like user@host.domain. Please answer accurately since I have
9248 no easy means to double check it. The default value provided below
9249 is most probably close to reality but may not be valid from outside
9250 your organization...
9251
9252 EOM
9253 cont=x
9254 while test "$cont"; do
9255         case "$MAILDOMAIN" in
9256         '')
9257                 if $test -s /etc/mailname; then
9258                         maildomain=`$cat /etc/mailname`
9259                 else
9260                         maildomain="$myhostname$mydomain"
9261                 fi
9262                 ;;
9263         *)  maildomain="$MAILDOMAIN";;
9264         esac
9265         case "$cf_email" in
9266         '') dflt="$cf_by@$maildomain";;
9267         *)  dflt="$cf_email";;
9268         esac
9269         rp='What is your e-mail address?'
9270         . ./myread
9271         cf_email="$ans"
9272         case "$cf_email" in
9273         *@*.*) cont='' ;;
9274         *)
9275                 rp='Address does not look like an Internet one.  Use it anyway?'
9276                 case "$fastread" in
9277                 yes) dflt=y ;;
9278                 *) dflt=n ;;
9279                 esac
9280                 . ./myread
9281                 case "$ans" in
9282                 y*) cont='' ;;
9283                 *) echo " " ;;
9284                 esac
9285                 ;;
9286         esac
9287 done
9288
9289 : Ask e-mail of administrator
9290 $cat <<EOM
9291
9292 If you or somebody else will be maintaining perl at your site, please
9293 fill in the correct e-mail address here so that they may be contacted
9294 if necessary. Currently, the "perlbug" program included with perl
9295 will send mail to this address in addition to perlbug@perl.org. You may
9296 enter "none" for no administrator.
9297
9298 EOM
9299 case "$perladmin" in
9300 '') dflt="$cf_email";;
9301 *) dflt="$perladmin";;
9302 esac
9303 rp='Perl administrator e-mail address'
9304 . ./myread
9305 perladmin="$ans"
9306
9307 : determine whether to only install version-specific parts.
9308 echo " "
9309 $cat <<EOM
9310 Do you want to install only the version-specific parts of the perl
9311 distribution?  Usually you do *not* want to do this.
9312 EOM
9313 case "$versiononly" in
9314 "$define"|[Yy]*|true) dflt='y' ;;
9315 *) dflt='n';
9316 esac
9317 rp="Do you want to install only the version-specific parts of perl?"
9318 . ./myread
9319 case "$ans" in
9320 [yY]*)  val="$define";;
9321 *)      val="$undef" ;;
9322 esac
9323 set versiononly
9324 eval $setvar
9325
9326 case "$versiononly" in
9327 "$define") inc_version_list=''
9328            inc_version_list_init=0
9329            ;;
9330 esac
9331
9332 : figure out how to guarantee perl startup
9333 : XXX Note that this currently takes advantage of the bug that binexp ignores
9334 :     the Configure -Dinstallprefix setting, which in turn means that under
9335 :     relocatable @INC, initialinstalllocation is what binexp started as.
9336 case "$startperl" in
9337 '')
9338         case "$sharpbang" in
9339         *!)
9340                 $cat <<EOH
9341
9342 I can use the #! construct to start perl on your system. This will
9343 make startup of perl scripts faster, but may cause problems if you
9344 want to share those scripts and perl is not in a standard place
9345 ($initialinstalllocation/perl) on all your platforms. The alternative
9346 is to force a shell by starting the script with a single ':' character.
9347
9348 EOH
9349                 case "$versiononly" in
9350                 "$define")      dflt="$initialinstalllocation/perl$version";;
9351                 *)              dflt="$initialinstalllocation/perl";;
9352                 esac
9353                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9354                 . ./myread
9355                 case "$ans" in
9356                 none)   startperl=": # use perl";;
9357                 *)      startperl="#!$ans"
9358                         if $test 30 -lt `echo "$ans" | wc -c`; then
9359                                 $cat >&4 <<EOM
9360
9361 WARNING:  Some systems limit the #! command to 32 characters.
9362 If you experience difficulty running Perl scripts with #!, try
9363 installing Perl in a directory with a shorter pathname.
9364
9365 EOM
9366                         fi ;;
9367                 esac
9368                 ;;
9369         *) startperl=": # use perl"
9370                 ;;
9371         esac
9372         ;;
9373 esac
9374 echo "I'll use $startperl to start perl scripts."
9375
9376 : figure best path for perl in scripts
9377 case "$perlpath" in
9378 '')
9379         case "$versiononly" in
9380         "$define")      perlpath="$initialinstalllocation/perl$version";;
9381         *)              perlpath="$initialinstalllocation/perl";;
9382         esac
9383         case "$startperl" in
9384         *!*) ;;
9385         *)
9386                 $cat <<EOH
9387
9388 I will use the "eval 'exec'" idiom to start Perl on your system.
9389 I can use the full path of your Perl binary for this purpose, but
9390 doing so may cause problems if you want to share those scripts and
9391 Perl is not always in a standard place ($initialinstalllocation/perl).
9392
9393 EOH
9394                 dflt="$initialinstalllocation/perl"
9395                 rp="What path shall I use in \"eval 'exec'\"?"
9396                 . ./myread
9397                 perlpath="$ans"
9398                 ;;
9399         esac
9400         ;;
9401 esac
9402 case "$startperl" in
9403 *!*)    ;;
9404 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9405 esac
9406
9407 : determine where public executable scripts go
9408 set scriptdir scriptdir
9409 eval $prefixit
9410 case "$scriptdir" in
9411 '')
9412         dflt="$bin"
9413         : guess some guesses
9414         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9415         $test -d /usr/share/bin     && dflt=/usr/share/bin
9416         $test -d /usr/local/script  && dflt=/usr/local/script
9417         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9418         $test -d $prefixexp/script  && dflt=$prefixexp/script
9419         set dflt
9420         eval $prefixup
9421         ;;
9422 *)  dflt="$scriptdir"
9423         ;;
9424 esac
9425 $cat <<EOM
9426
9427 Some installations have a separate directory just for executable scripts so
9428 that they can mount it across multiple architectures but keep the scripts in
9429 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9430 Or you might just lump your scripts in with all your other executables.
9431
9432 EOM
9433 fn=d~
9434 rp='Where do you keep publicly executable scripts?'
9435 . ./getfile
9436 if $test "X$ansexp" != "X$scriptdirexp"; then
9437         installscript=''
9438 fi
9439 installscriptdir=''
9440 prefixvar=scriptdir
9441 . ./setprefixvar
9442 : A little fix up for an irregularly named variable.
9443 installscript="$installscriptdir"
9444
9445 : determine where add-on public executables go
9446 case "$sitebin" in
9447 '')     dflt=$siteprefix/bin ;;
9448 *)      dflt=$sitebin ;;
9449 esac
9450 fn=d~
9451 rp='Pathname where the add-on public executables should be installed?'
9452 . ./getfile
9453 prefixvar=sitebin
9454 . ./setprefixvar
9455
9456 : determine where add-on html pages go
9457 : There is no standard location, so try to copy the previously-selected
9458 : directory structure for the core html pages.
9459 case "$sitehtml1dir" in
9460 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9461 *)     dflt=$sitehtml1dir ;;
9462 esac
9463 case "$dflt" in
9464 ''|' ') dflt=none ;;
9465 esac
9466 fn=dn+~
9467 rp='Pathname where the site-specific html pages should be installed?'
9468 . ./getfile
9469 prefixvar=sitehtml1dir
9470 . ./setprefixvar
9471
9472 : determine where add-on library html pages go
9473 : There is no standard location, so try to copy the previously-selected
9474 : directory structure for the core html pages.
9475 case "$sitehtml3dir" in
9476 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9477 *)     dflt=$sitehtml3dir ;;
9478 esac
9479 case "$dflt" in
9480 ''|' ') dflt=none ;;
9481 esac
9482 fn=dn+~
9483 rp='Pathname where the site-specific library html pages should be installed?'
9484 . ./getfile
9485 prefixvar=sitehtml3dir
9486 . ./setprefixvar
9487
9488 : determine where add-on manual pages go
9489 case "$siteman1dir" in
9490 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9491 *)      dflt=$siteman1dir ;;
9492 esac
9493 case "$dflt" in
9494 ''|' ') dflt=none ;;
9495 esac
9496 fn=dn+~
9497 rp='Pathname where the site-specific manual pages should be installed?'
9498 . ./getfile
9499 prefixvar=siteman1dir
9500 . ./setprefixvar
9501
9502 : determine where add-on library man pages go
9503 case "$siteman3dir" in
9504 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9505 *)      dflt=$siteman3dir ;;
9506 esac
9507 case "$dflt" in
9508 ''|' ') dflt=none ;;
9509 esac
9510 fn=dn+~
9511 rp='Pathname where the site-specific library manual pages should be installed?'
9512 . ./getfile
9513 prefixvar=siteman3dir
9514 . ./setprefixvar
9515
9516 : determine where add-on public executable scripts go
9517 case "$sitescript" in
9518 '')     dflt=$siteprefix/script
9519         $test -d $dflt || dflt=$sitebin ;;
9520 *)  dflt="$sitescript" ;;
9521 esac
9522 fn=d~+
9523 rp='Pathname where add-on public executable scripts should be installed?'
9524 . ./getfile
9525 prefixvar=sitescript
9526 . ./setprefixvar
9527
9528 : see if backtrace exists
9529 set backtrace d_backtrace
9530 eval $inlibc
9531
9532 : add flags if using c backtrace
9533 case "$usecbacktrace" in
9534   "") usecbacktrace=$undef ;;
9535   [yY]*|true|$define)
9536     case "$d_backtrace" in
9537       [yY]*|true|$define)
9538         case " $ccflags " in
9539           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9540           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9541           esac
9542         ;;
9543       *)
9544         echo "This system does not support backtrace" >&4
9545         usecbacktrace=$undef
9546         ;;
9547       esac
9548     ;;
9549   esac
9550
9551 : Check if faststdio is requested and available
9552 case "$usefaststdio" in
9553 $define|true|[yY]*|'')
9554         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9555         case "$xversion" in
9556         [68])   dflt='y' ;;
9557         *)      dflt='n' ;;
9558         esac
9559         ;;
9560 *) dflt='n';;
9561 esac
9562 cat <<EOM
9563
9564 Perl can be built to use 'fast stdio', which means using the stdio
9565 library but also directly manipulating the stdio buffers to enable
9566 faster I/O.  Using stdio is better for backward compatibility (especially
9567 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9568 interface has been preferred instead of stdio.
9569
9570 If this doesn't make any sense to you, just accept the default '$dflt'.
9571 EOM
9572 rp='Use the "fast stdio" if available?'
9573 . ./myread
9574 case "$ans" in
9575 y|Y)    val="$define" ;;
9576 *)      val="$undef" ;;
9577 esac
9578 set usefaststdio
9579 eval $setvar
9580
9581
9582 : define an is-a-typedef? function
9583 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9584 case "$inclist" in
9585 "") inclist="sys/types.h";;
9586 esac;
9587 eval "varval=\$$var";
9588 case "$varval" in
9589 "")
9590         $rm -f temp.c;
9591         for inc in $inclist; do
9592                 echo "#include <$inc>" >>temp.c;
9593         done;
9594         echo "#ifdef $type" >> temp.c;
9595         echo "printf(\"We have $type\");" >> temp.c;
9596         echo "#endif" >> temp.c;
9597         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9598         if $contains $type temp.E >/dev/null 2>&1; then
9599                 eval "$var=\$type";
9600         else
9601                 eval "$var=\$def";
9602         fi;
9603         $rm -f temp.?;;
9604 *) eval "$var=\$varval";;
9605 esac'
9606
9607 : define an is-a-typedef? function that prompts if the type is not available.
9608 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9609 case "$inclist" in
9610 "") inclist="sys/types.h";;
9611 esac;
9612 eval "varval=\$$var";
9613 case "$varval" in
9614 "")
9615         $rm -f temp.c;
9616         for inc in $inclist; do
9617                 echo "#include <$inc>" >>temp.c;
9618         done;
9619         echo "#ifdef $type" >> temp.c;
9620         echo "printf(\"We have $type\");" >> temp.c;
9621         echo "#endif" >> temp.c;
9622         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9623         echo " " ;
9624         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9625         if $contains $type temp.E >/dev/null 2>&1; then
9626                 echo "$type found." >&4;
9627                 eval "$var=\$type";
9628         else
9629                 echo "$type NOT found." >&4;
9630                 dflt="$def";
9631                 . ./myread ;
9632                 eval "$var=\$ans";
9633         fi;
9634         $rm -f temp.?;;
9635 *) eval "$var=\$varval";;
9636 esac'
9637
9638 : see what type lseek is declared as in the kernel
9639 rp="What is the type used for lseek's offset on this system?"
9640 set off_t lseektype long stdio.h sys/types.h
9641 eval $typedef_ask
9642
9643 echo " "
9644 echo "Checking to see how big your file offsets are..." >&4
9645 $cat >try.c <<EOCP
9646 #include <sys/types.h>
9647 #include <stdio.h>
9648 int main()
9649 {
9650     printf("%d\n", (int)sizeof($lseektype));
9651     return(0);
9652 }
9653 EOCP
9654 set try
9655 if eval $compile_ok; then
9656         lseeksize=`$run ./try`
9657         echo "Your file offsets are $lseeksize bytes long."
9658 else
9659         dflt=$longsize
9660         echo " "
9661         echo "(I can't seem to compile the test program.  Guessing...)"
9662         rp="What is the size of your file offsets (in bytes)?"
9663         . ./myread
9664         lseeksize="$ans"
9665 fi
9666 $rm_try
9667
9668 : see what type file positions are declared as in the library
9669 rp="What is the type for file position used by fsetpos()?"
9670 set fpos_t fpostype long stdio.h sys/types.h
9671 eval $typedef_ask
9672
9673 : Check size for Fpos_t
9674 echo " "
9675 case "$fpostype" in
9676 *_t) zzz="$fpostype"    ;;
9677 *)   zzz="fpos_t"       ;;
9678 esac
9679 echo "Checking the size of $zzz..." >&4
9680 cat > try.c <<EOCP
9681 #include <sys/types.h>
9682 #include <stdio.h>
9683 #$i_stdlib I_STDLIB
9684 #ifdef I_STDLIB
9685 #include <stdlib.h>
9686 #endif
9687 int main() {
9688     printf("%d\n", (int)sizeof($fpostype));
9689     exit(0);
9690 }
9691 EOCP
9692 set try
9693 if eval $compile_ok; then
9694         yyy=`$run ./try`
9695         case "$yyy" in
9696         '')     fpossize=4
9697                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9698                 ;;
9699         *)      fpossize=$yyy
9700                 echo "Your $zzz is $fpossize bytes long."
9701                 ;;
9702         esac
9703 else
9704         dflt="$longsize"
9705         echo " " >&4
9706         echo "(I can't compile the test program.  Guessing...)" >&4
9707         rp="What is the size of your file positions (in bytes)?"
9708         . ./myread
9709         fpossize="$ans"
9710 fi
9711
9712 : Check for large file support
9713 # Backward compatibility (uselfs is deprecated).
9714 case "$uselfs" in
9715 "$define"|true|[yY]*)
9716         cat <<EOM >&4
9717
9718 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9719 EOM
9720         uselargefiles="$define"
9721         ;;
9722 esac
9723
9724 case "$lseeksize:$fpossize" in
9725 8:8) cat <<EOM
9726
9727 You can have files larger than 2 gigabytes.
9728 EOM
9729    val="$define" ;;
9730 *)    case "$uselargefiles" in
9731    "$undef"|false|[nN]*) dflt='n' ;;
9732    *)   dflt='y' ;;
9733    esac
9734    cat <<EOM
9735
9736 Perl can be built to understand large files (files larger than 2 gigabytes)
9737 on some systems.  To do so, Configure can be run with -Duselargefiles.
9738
9739 If this doesn't make any sense to you, just accept the default '$dflt'.
9740 EOM
9741    rp='Try to understand large files, if available?'
9742    . ./myread
9743    case "$ans" in
9744    y|Y)         val="$define" ;;
9745    *)           val="$undef"  ;;
9746    esac
9747    ;;
9748 esac
9749 set uselargefiles
9750 eval $setvar
9751 : Look for a hint-file generated 'call-back-unit'.  If the
9752 : user has specified that a large files perl is to be built,
9753 : we may need to set or change some other defaults.
9754 if $test -f uselargefiles.cbu; then
9755         echo "Your platform has some specific hints regarding large file builds, using them..."
9756         . ./uselargefiles.cbu
9757 fi
9758 case "$uselargefiles" in
9759 "$define")
9760         if $test -f uselargefiles.cbu; then
9761                 echo " "
9762                 echo "Rechecking to see how big your file offsets are..." >&4
9763                 $cat >try.c <<EOCP
9764 #include <sys/types.h>
9765 #include <stdio.h>
9766 int main()
9767 {
9768     printf("%d\n", (int)sizeof($lseektype));
9769     return(0);
9770 }
9771 EOCP
9772                 set try
9773                 if eval $compile_ok; then
9774                         lseeksize=`$run ./try`
9775                         $echo "Your file offsets are now $lseeksize bytes long."
9776                 else
9777                         dflt="$lseeksize"
9778                         echo " "
9779                         echo "(I can't seem to compile the test program.  Guessing...)"
9780                         rp="What is the size of your file offsets (in bytes)?"
9781                         . ./myread
9782                         lseeksize="$ans"
9783                 fi
9784                 case "$fpostype" in
9785                 *_t) zzz="$fpostype"    ;;
9786                 *)   zzz="fpos_t"       ;;
9787                 esac
9788                 $echo $n "Rechecking the size of $zzz...$c" >&4
9789                 $cat > try.c <<EOCP
9790 #include <sys/types.h>
9791 #include <stdio.h>
9792 #$i_stdlib I_STDLIB
9793 #ifdef I_STDLIB
9794 #include <stdlib.h>
9795 #endif
9796 int main() {
9797     printf("%d\n", (int)sizeof($fpostype));
9798     return(0);
9799 }
9800 EOCP
9801                 set try
9802                 if eval $compile_ok; then
9803                         yyy=`$run ./try`
9804                         dflt="$lseeksize"
9805                         case "$yyy" in
9806                         '')     echo " "
9807                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9808                                 ;;
9809                         *)      fpossize=$yyy
9810                                 echo " $fpossize bytes." >&4
9811                                 ;;
9812                         esac
9813                 else
9814                         dflt="$fpossize"
9815                         echo " "
9816                         echo "(I can't compile the test program.  Guessing...)" >&4
9817                         rp="What is the size of your file positions (in bytes)?"
9818                         . ./myread
9819                         fpossize="$ans"
9820                 fi
9821                 $rm_try
9822         fi
9823         ;;
9824 esac
9825
9826 : Check if we want perlio
9827 useperlio="$define"
9828
9829 : Set the vendorbin variables
9830 case "$vendorprefix" in
9831 '')     d_vendorbin="$undef"
9832         vendorbin=''
9833         vendorbinexp=''
9834         ;;
9835 *)      d_vendorbin="$define"
9836         : determine where vendor-supplied executables go.
9837         case "$vendorbin" in
9838         '') dflt=$vendorprefix/bin ;;
9839         *)      dflt="$vendorbin" ;;
9840         esac
9841         fn=d~+
9842         rp='Pathname for the vendor-supplied executables directory?'
9843         . ./getfile
9844         vendorbin="$ans"
9845         vendorbinexp="$ansexp"
9846         ;;
9847 esac
9848 prefixvar=vendorbin
9849 . ./installprefix
9850
9851 : Set the vendorhtml1dir variables
9852 case "$vendorprefix" in
9853 '')     vendorhtml1dir=''
9854         vendorhtml1direxp=''
9855         ;;
9856 *)      : determine where vendor-supplied html pages go.
9857         : There is no standard location, so try to copy the previously-selected
9858         : directory structure for the core html pages.
9859         : XXX Better default suggestions would be welcome.
9860         case "$vendorhtml1dir" in
9861         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9862         *)      dflt=$vendorhtml1dir ;;
9863         esac
9864         case "$dflt" in
9865         ''|' ') dflt=none ;;
9866         esac
9867         fn=dn+~
9868         rp='Pathname for the vendor-supplied html pages?'
9869         . ./getfile
9870         vendorhtml1dir="$ans"
9871         vendorhtml1direxp="$ansexp"
9872         ;;
9873 esac
9874 : Use ' ' for none so value is preserved next time through Configure
9875 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9876 prefixvar=vendorhtml1dir
9877 . ./installprefix
9878
9879 : Set the vendorhtml3dir variables
9880 case "$vendorprefix" in
9881 '')     vendorhtml3dir=''
9882         vendorhtml3direxp=''
9883         ;;
9884 *)      : determine where vendor-supplied module html pages go.
9885         : There is no standard location, so try to copy the previously-selected
9886         : directory structure for the core html pages.
9887         : XXX Better default suggestions would be welcome.
9888         case "$vendorhtml3dir" in
9889         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9890         *)      dflt=$vendorhtml3dir ;;
9891         esac
9892         case "$dflt" in
9893         ''|' ') dflt=none ;;
9894         esac
9895         fn=dn+~
9896         rp='Pathname for the vendor-supplied html pages?'
9897         . ./getfile
9898         vendorhtml3dir="$ans"
9899         vendorhtml3direxp="$ansexp"
9900         ;;
9901 esac
9902 : Use ' ' for none so value is preserved next time through Configure
9903 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9904 prefixvar=vendorhtml3dir
9905 . ./installprefix
9906
9907 : Set the vendorman1dir variables
9908 case "$vendorprefix" in
9909 '')     vendorman1dir=''
9910         vendorman1direxp=''
9911         ;;
9912 *)      : determine where vendor-supplied manual pages go.
9913         case "$vendorman1dir" in
9914         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9915         *)      dflt=$vendorman1dir ;;
9916         esac
9917         case "$dflt" in
9918         ''|' ') dflt=none ;;
9919         esac
9920         fn=nd~+
9921         rp='Pathname for the vendor-supplied manual section 1 pages?'
9922         . ./getfile
9923         vendorman1dir="$ans"
9924         vendorman1direxp="$ansexp"
9925         ;;
9926 esac
9927 : Use ' ' for none so value is preserved next time through Configure
9928 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9929 prefixvar=vendorman1dir
9930 . ./installprefix
9931
9932 : Set the vendorman3dir variables
9933 case "$vendorprefix" in
9934 '')     vendorman3dir=''
9935         vendorman3direxp=''
9936         ;;
9937 *)      : determine where vendor-supplied module manual pages go.
9938         case "$vendorman3dir" in
9939         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9940         *)      dflt=$vendorman3dir ;;
9941         esac
9942         case "$dflt" in
9943         ''|' ') dflt=none ;;
9944         esac
9945         fn=nd~+
9946         rp='Pathname for the vendor-supplied manual section 3 pages?'
9947         . ./getfile
9948         vendorman3dir="$ans"
9949         vendorman3direxp="$ansexp"
9950         ;;
9951 esac
9952 : Use ' ' for none so value is preserved next time through Configure
9953 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9954 prefixvar=vendorman3dir
9955 . ./installprefix
9956
9957 : Set the vendorscript variables
9958 case "$vendorprefix" in
9959 '')     d_vendorscript="$undef"
9960         vendorscript=''
9961         vendorscriptexp=''
9962         ;;
9963 *)      d_vendorscript="$define"
9964         : determine where vendor-supplied scripts go.
9965         case "$vendorscript" in
9966         '')     dflt=$vendorprefix/script
9967                 $test -d $dflt || dflt=$vendorbin ;;
9968         *)  dflt="$vendorscript" ;;
9969         esac
9970         $cat <<EOM
9971
9972 The installation process will create a directory for
9973 vendor-supplied scripts.
9974
9975 EOM
9976         fn=d~+
9977         rp='Pathname for the vendor-supplied scripts directory?'
9978         . ./getfile
9979         vendorscript="$ans"
9980         vendorscriptexp="$ansexp"
9981         ;;
9982 esac
9983 prefixvar=vendorscript
9984 . ./installprefix
9985
9986 : script used to emit important warnings
9987 cat >warn <<EOS
9988 $startsh
9989 if test \$# -gt 0; then
9990         echo "\$@" >msg
9991 else
9992         cat >msg
9993 fi
9994 echo "*** WARNING:" >&4
9995 sed -e 's/^/*** /' <msg >&4
9996 echo "*** " >&4
9997 cat msg >>config.msg
9998 echo " " >>config.msg
9999 rm -f msg
10000 EOS
10001 chmod +x warn
10002 $eunicefix warn
10003
10004 : see which of string.h or strings.h is needed
10005 echo " "
10006 strings=`./findhdr string.h`
10007 if $test "$strings" && $test -r "$strings"; then
10008         echo "Using <string.h> instead of <strings.h>." >&4
10009         val="$define"
10010 else
10011         val="$undef"
10012         strings=`./findhdr strings.h`
10013         if $test "$strings" && $test -r "$strings"; then
10014                 echo "Using <strings.h> instead of <string.h>." >&4
10015         else
10016                 ./warn "No string header found -- You'll surely have problems."
10017         fi
10018 fi
10019 set i_string
10020 eval $setvar
10021 case "$i_string" in
10022 "$undef") strings=`./findhdr strings.h`;;
10023 *)        strings=`./findhdr string.h`;;
10024 esac
10025
10026 : see if qgcvt exists
10027 set qgcvt d_qgcvt
10028 eval $inlibc
10029
10030 : Check what kind of doubles your system has
10031 $echo "Checking the kind of doubles you have..." >&4
10032 $cat >try.c <<EOP
10033 #$i_stdlib I_STDLIB
10034 #define DOUBLESIZE $doublesize
10035 #ifdef I_STDLIB
10036 #include <stdlib.h>
10037 #endif
10038 #include <stdio.h>
10039 static const double d = -0.1;
10040 int main() {
10041   unsigned const char* b = (unsigned const char*)(&d);
10042 #if DOUBLESIZE == 4
10043   if (b[0] == 0xCD && b[3] == 0xBD) {
10044     /* IEEE 754 32-bit little-endian */
10045     printf("1\n");
10046     exit(0);
10047   }
10048   if (b[0] == 0xBD && b[3] == 0xCD) {
10049     /* IEEE 754 32-bit big-endian */
10050     printf("2\n");
10051     exit(0);
10052   }
10053 #endif
10054 #if DOUBLESIZE == 8
10055   if (b[0] == 0x9A && b[7] == 0xBF) {
10056     /* IEEE 754 64-bit little-endian */
10057     printf("3\n");
10058     exit(0);
10059   }
10060   if (b[0] == 0xBF && b[7] == 0x9A) {
10061     /* IEEE 754 64-bit big-endian */
10062     printf("4\n");
10063     exit(0);
10064   }
10065   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10066    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10067     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10068     * 99 99 b9 bf 9a 99 99 99 */
10069     printf("7\n");
10070     exit(0);
10071   }
10072   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10073    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10074     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10075     * 99 99 99 9a bf b9 99 99 */
10076     printf("8\n");
10077     exit(0);
10078   }
10079 #endif
10080 #if DOUBLESIZE == 16
10081   if (b[0] == 0x9A && b[15] == 0xBF) {
10082     /* IEEE 754 128-bit little-endian */
10083     printf("5\n");
10084     exit(0);
10085   }
10086   if (b[0] == 0xBF && b[15] == 0x9A) {
10087     /* IEEE 754 128-bit big-endian */
10088     printf("6\n");
10089     exit(0);
10090   }
10091 #endif
10092   /* Then there are old mainframe/miniframe formats like VAX, IBM, and CRAY.
10093    * Whether those environments can still build Perl is debatable. */
10094   printf("-1\n"); /* unknown */
10095   exit(0);
10096 }
10097 EOP
10098 set try
10099 if eval $compile; then
10100     doublekind=`$run ./try`
10101 else
10102     doublekind=-1
10103 fi
10104 case "$doublekind" in
10105 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10106 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10107 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10108 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10109 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10110 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10111 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10112 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10113 *) echo "Cannot figure out your double.  You VAX, or something?" >&4 ;;
10114 esac
10115 $rm_try
10116
10117 : Check print/scan long double stuff
10118 echo " "
10119
10120 if $test X"$d_longdbl" = X"$define"; then
10121
10122 echo "Checking how to print long doubles..." >&4
10123
10124 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10125         $cat >try.c <<'EOCP'
10126 #include <sys/types.h>
10127 #include <stdio.h>
10128 int main() {
10129   double d = 123.456;
10130   printf("%.3f\n", d);
10131 }
10132 EOCP
10133         set try
10134         if eval $compile; then
10135                 yyy=`$run ./try`
10136                 case "$yyy" in
10137                 123.456)
10138                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10139                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10140                         echo "We will use %f."
10141                         ;;
10142                 esac
10143         fi
10144 fi
10145
10146 if $test X"$sPRIfldbl" = X; then
10147         $cat >try.c <<'EOCP'
10148 #include <sys/types.h>
10149 #include <stdio.h>
10150 int main() {
10151   long double d = 123.456;
10152   printf("%.3Lf\n", d);
10153 }
10154 EOCP
10155         set try
10156         if eval $compile; then
10157                 yyy=`$run ./try`
10158                 case "$yyy" in
10159                 123.456)
10160                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10161                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10162                         echo "We will use %Lf."
10163                         ;;
10164                 esac
10165         fi
10166 fi
10167
10168 if $test X"$sPRIfldbl" = X; then
10169         $cat >try.c <<'EOCP'
10170 #include <sys/types.h>
10171 #include <stdio.h>
10172 int main() {
10173   long double d = 123.456;
10174   printf("%.3llf\n", d);
10175 }
10176 EOCP
10177         set try
10178         if eval $compile; then
10179                 yyy=`$run ./try`
10180                 case "$yyy" in
10181                 123.456)
10182                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10183                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10184                         echo "We will use %llf."
10185                         ;;
10186                 esac
10187         fi
10188 fi
10189
10190 if $test X"$sPRIfldbl" = X; then
10191         $cat >try.c <<'EOCP'
10192 #include <sys/types.h>
10193 #include <stdio.h>
10194 int main() {
10195   long double d = 123.456;
10196   printf("%.3lf\n", d);
10197 }
10198 EOCP
10199         set try
10200         if eval $compile; then
10201                 yyy=`$run ./try`
10202                 case "$yyy" in
10203                 123.456)
10204                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10205                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10206                         echo "We will use %lf."
10207                         ;;
10208                 esac
10209         fi
10210 fi
10211
10212 if $test X"$sPRIfldbl" = X; then
10213         echo "Cannot figure out how to print long doubles." >&4
10214 else
10215         sSCNfldbl=$sPRIfldbl    # expect consistency
10216 fi
10217
10218 $rm_try
10219
10220 fi # d_longdbl
10221
10222 case "$sPRIfldbl" in
10223 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10224         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10225         d_SCNfldbl="$undef";
10226         ;;
10227 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10228         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10229         d_SCNfldbl="$define";
10230         ;;
10231 esac
10232
10233 : Before committing on uselongdouble, see whether that looks sane.
10234 if $test "$uselongdouble" = "$define"; then
10235     message=""
10236     echo " "
10237     echo "Checking if your long double math functions work right..." >&4
10238     $cat > try.c <<EOF
10239 #include <math.h>
10240 #include <stdio.h>
10241 int main() {
10242   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10243 }
10244 EOF
10245     case "$osname:$gccversion" in
10246     aix:)       saveccflags="$ccflags"
10247                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10248     esac
10249     set try
10250     if eval $compile_ok; then
10251       yyy=`$run ./try`
10252     fi
10253     case "$yyy" in
10254     3) echo "Your long double math functions are working correctly." >&4 ;;
10255     *) echo "Your long double math functions are broken, not using long doubles." >&4
10256        uselongdouble=$undef
10257        ;;
10258     esac
10259     $rm_try
10260     case "$osname:$gccversion" in
10261     aix:)       ccflags="$saveccflags" ;; # restore
10262     esac
10263 fi
10264
10265 : Check how to convert floats to strings.
10266
10267 if test "X$d_Gconvert" = X; then
10268
10269 echo " "
10270 echo "Checking for an efficient way to convert floats to strings."
10271 echo " " > try.c
10272 case "$uselongdouble" in
10273 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10274 esac
10275 case "$d_longdbl" in
10276 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10277 esac
10278 case "$d_PRIgldbl" in
10279 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10280 esac
10281 $cat >>try.c <<EOP
10282 #ifdef TRY_gconvert
10283 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10284 char *myname = "gconvert";
10285 #endif
10286 #ifdef TRY_gcvt
10287 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10288 char *myname = "gcvt";
10289 #endif
10290 #ifdef TRY_qgcvt
10291 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10292 char *myname = "qgcvt";
10293 #define DOUBLETYPE long double
10294 #endif
10295 #ifdef TRY_sprintf
10296 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10297 #ifdef HAS_PRIgldbl
10298 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10299 #else
10300 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10301 #endif
10302 #else
10303 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10304 #endif
10305 char *myname = "sprintf";
10306 #endif
10307
10308 #ifndef DOUBLETYPE
10309 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10310 #define DOUBLETYPE long double
10311 #else
10312 #define DOUBLETYPE double
10313 #endif
10314 #endif
10315
10316 #include <stdio.h>
10317
10318 #$i_stdlib I_STDLIB
10319 #ifdef I_STDLIB
10320 #include <stdlib.h>
10321 #endif
10322 #$i_string I_STRING
10323 #ifdef I_STRING
10324 #  include <string.h>
10325 #else
10326 #  include <strings.h>
10327 #endif
10328
10329 int checkit(char *expect, char *got)
10330 {
10331     if (strcmp(expect, got)) {
10332                 printf("%s oddity:  Expected %s, got %s\n",
10333                         myname, expect, got);
10334                 exit(1);
10335         }
10336 }
10337
10338 int main()
10339 {
10340         char buf[64];
10341         buf[63] = '\0';
10342
10343         /* This must be 1st test on (which?) platform */
10344         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10345         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10346         checkit("0.1", buf);
10347
10348         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10349         checkit("0.01", buf);
10350
10351         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10352         checkit("0.001", buf);
10353
10354         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10355         checkit("0.0001", buf);
10356
10357         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10358         if (strlen(buf) > 5)
10359             checkit("9e-005", buf); /* for Microsoft ?? */
10360         else
10361             checkit("9e-05", buf);
10362
10363         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10364         checkit("1", buf);
10365
10366         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10367         checkit("1.1", buf);
10368
10369         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10370         checkit("1.01", buf);
10371
10372         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10373         checkit("1.001", buf);
10374
10375         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10376         checkit("1.0001", buf);
10377
10378         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10379         checkit("1.00001", buf);
10380
10381         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10382         checkit("1.000001", buf);
10383
10384         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10385         checkit("0", buf);
10386
10387         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10388         checkit("-1", buf);
10389
10390         /* Some Linux gcvt's give 1.e+5 here. */
10391         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10392         checkit("100000", buf);
10393
10394         /* Some Linux gcvt's give -1.e+5 here. */
10395         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10396         checkit("-100000", buf);
10397
10398         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10399         checkit("123.456", buf);
10400
10401         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10402         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10403         /* 34 should be enough to scare even long double
10404          * places into using the e notation. */
10405         if (strlen(buf) > 5)
10406             checkit("1e+034", buf); /* for Microsoft */
10407         else
10408             checkit("1e+34", buf);
10409
10410         /* For Perl, if you add additional tests here, also add them to
10411          * t/base/num.t for benefit of platforms not using Configure or
10412          * overriding d_Gconvert */
10413
10414         exit(0);
10415 }
10416 EOP
10417 : first add preferred functions to our list
10418 xxx_list=""
10419 for xxx_convert in $gconvert_preference; do
10420     case $xxx_convert in
10421     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10422     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10423     esac
10424 done
10425 : then add any others
10426 for xxx_convert in gconvert gcvt sprintf; do
10427     case "$xxx_list" in
10428     *$xxx_convert*) ;;
10429     *) xxx_list="$xxx_list $xxx_convert" ;;
10430     esac
10431 done
10432
10433 case "$d_longdbl$uselongdouble" in
10434 "$define$define")
10435     : again, add preferred functions to our list first
10436     xxx_ld_list=""
10437     for xxx_convert in $gconvert_ld_preference; do
10438         case $xxx_convert in
10439         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10440         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10441         esac
10442     done
10443     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10444     for xxx_convert in qgcvt sprintf $xxx_list; do
10445         case "$xxx_ld_list" in
10446         $xxx_convert*|*" $xxx_convert"*) ;;
10447         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10448         esac
10449     done
10450     : if sprintf cannot do long doubles, move it to the end
10451     if test "$d_PRIgldbl" != "$define"; then
10452         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10453     fi
10454     : if no qgcvt, remove it
10455     if test "$d_qgcvt" != "$define"; then
10456         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10457     fi
10458     : use the ld_list
10459     xxx_list="$xxx_ld_list"
10460     ;;
10461 esac
10462
10463 for xxx_convert in $xxx_list; do
10464         echo "Trying $xxx_convert..."
10465         $rm -f try try$_o core
10466         set try -DTRY_$xxx_convert
10467         if eval $compile; then
10468                 echo "$xxx_convert() found." >&4
10469                 if $run ./try; then
10470                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10471                         break;
10472                 else
10473                         echo "...But $xxx_convert didn't work as I expected."
10474                         xxx_convert=''
10475                 fi
10476         else
10477                 echo "$xxx_convert NOT found." >&4
10478         fi
10479 done
10480
10481 if test X$xxx_convert = X; then
10482     echo "*** WHOA THERE!!! ***" >&4
10483     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10484     xxx_convert=sprintf
10485 fi
10486
10487 case "$xxx_convert" in
10488 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10489 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10490 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10491 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10492    "$define$define$define")
10493       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10494    "$define$define$undef")
10495       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10496    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10497    esac
10498    ;;
10499 esac
10500
10501 fi
10502 $rm_try
10503
10504 : see if _fwalk exists
10505 set fwalk d__fwalk
10506 eval $inlibc
10507
10508 : Initialize h_fcntl
10509 h_fcntl=false
10510
10511 : Initialize h_sysfile
10512 h_sysfile=false
10513
10514 : access call always available on UNIX
10515 set access d_access
10516 eval $inlibc
10517
10518 : locate the flags for 'access()'
10519 case "$d_access" in
10520 "$define")
10521         echo " "
10522         $cat >access.c <<EOCP
10523 #include <sys/types.h>
10524 #ifdef I_FCNTL
10525 #include <fcntl.h>
10526 #endif
10527 #ifdef I_SYS_FILE
10528 #include <sys/file.h>
10529 #endif
10530 #ifdef I_UNISTD
10531 #include <unistd.h>
10532 #endif
10533 #$i_stdlib I_STDLIB
10534 #ifdef I_STDLIB
10535 #include <stdlib.h>
10536 #endif
10537 int main() {
10538         exit(R_OK);
10539 }
10540 EOCP
10541         : check sys/file.h first, no particular reason here
10542         if $test `./findhdr sys/file.h` && \
10543                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10544                 h_sysfile=true;
10545                 echo "<sys/file.h> defines the *_OK access constants." >&4
10546         elif $test `./findhdr fcntl.h` && \
10547                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10548                 h_fcntl=true;
10549                 echo "<fcntl.h> defines the *_OK access constants." >&4
10550         elif $test `./findhdr unistd.h` && \
10551                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10552                 echo "<unistd.h> defines the *_OK access constants." >&4
10553         else
10554                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10555         fi
10556         ;;
10557 esac
10558 $rm -f access*
10559
10560 : see if accessx exists
10561 set accessx d_accessx
10562 eval $inlibc
10563
10564 : see if acosh exists
10565 set acosh d_acosh
10566 eval $inlibc
10567
10568 : see if aintl exists
10569 set aintl d_aintl
10570 eval $inlibc
10571
10572 : see if alarm exists
10573 set alarm d_alarm
10574 eval $inlibc
10575
10576 : see if 64bit time functions exists
10577
10578 set ctime64 d_ctime64
10579 eval $inlibc
10580
10581 set localtime64 d_localtime64
10582 eval $inlibc
10583
10584 set gmtime64 d_gmtime64
10585 eval $inlibc
10586
10587 set mktime64 d_mktime64
10588 eval $inlibc
10589
10590 set difftime64 d_difftime64
10591 eval $inlibc
10592
10593 set asctime64 d_asctime64
10594 eval $inlibc
10595
10596 : see if POSIX threads are available
10597 set pthread.h i_pthread
10598 eval $inhdr
10599
10600 : define a function to check prototypes
10601 $cat > protochk <<EOSH
10602 $startsh
10603 cc="$cc"
10604 optimize="$optimize"
10605 ccflags="$ccflags"
10606 prototype="$prototype"
10607 define="$define"
10608 rm_try="$rm_try"
10609 usethreads=$usethreads
10610 i_pthread=$i_pthread
10611 pthread_h_first=$pthread_h_first
10612 EOSH
10613
10614 $cat >> protochk <<'EOSH'
10615
10616 $rm_try
10617 foo="$1"
10618 shift
10619 while test $# -ge 2; do
10620         case "$1" in
10621                 $define) echo "#include <$2>" >> try.c ;;
10622                 literal) echo "$2" >> try.c ;;
10623         esac
10624     # Extra magic for the benefit of systems that need pthread.h
10625     # to be included early to correctly detect threadsafe functions.
10626     # Such functions must guarantee themselves, though, that the usethreads
10627     # and i_pthread have been defined, before calling protochk.
10628     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10629         echo "#include <pthread.h>" >> try.c
10630         pthread_h_done=yes
10631     fi
10632     shift 2
10633 done
10634 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10635 cat >> try.c <<'EOCP'
10636 #ifdef CAN_PROTOTYPE
10637 #define _(args) args
10638 #else
10639 #define _(args) ()
10640 #endif
10641 EOCP
10642 echo "$foo" >> try.c
10643 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10644 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10645 status=$?
10646 $rm_try
10647 exit $status
10648 EOSH
10649 chmod +x protochk
10650 $eunicefix protochk
10651
10652 : Define hasproto macro for Configure internal use
10653 hasproto='varname=$1; func=$2; shift; shift;
10654 while $test $# -ge 2; do
10655         case "$1" in
10656         $define) echo "#include <$2>";;
10657         esac ;
10658     shift 2;
10659 done > try.c;
10660 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10661 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10662         echo "$func() prototype found.";
10663         val="$define";
10664 else
10665         echo "$func() prototype NOT found.";
10666         val="$undef";
10667 fi;
10668 set $varname;
10669 eval $setvar;
10670 $rm_try tryout.c'
10671
10672 : see if sys/types.h has to be included
10673 set sys/types.h i_systypes
10674 eval $inhdr
10675
10676 : see if sys/select.h has to be included
10677 set sys/select.h i_sysselct
10678 eval $inhdr
10679
10680 : Define hasfield macro for Configure internal use
10681 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10682 while $test $# -ge 2; do
10683         case "$1" in
10684         $define) echo "#include <$2>";;
10685         esac ;
10686     shift 2;
10687 done > try.c;
10688 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10689 set try;
10690 if eval $compile; then
10691         val="$define";
10692 else
10693         val="$undef";
10694 fi;
10695 set $varname;
10696 eval $setvar;
10697 $rm_try'
10698
10699 : see if we should include time.h, sys/time.h, or both
10700 echo " "
10701 if test "X$timeincl" = X; then
10702         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10703         $echo $n "I'm now running the test program...$c"
10704         $cat >try.c <<EOCP
10705 #include <sys/types.h>
10706 #ifdef I_TIME
10707 #include <time.h>
10708 #endif
10709 #ifdef I_SYSTIME
10710 #ifdef SYSTIMEKERNEL
10711 #define KERNEL
10712 #endif
10713 #include <sys/time.h>
10714 #endif
10715 #ifdef I_SYSSELECT
10716 #include <sys/select.h>
10717 #endif
10718 #$i_stdlib I_STDLIB
10719 #ifdef I_STDLIB
10720 #include <stdlib.h>
10721 #endif
10722 int main()
10723 {
10724         struct tm foo;
10725 #ifdef S_TIMEVAL
10726         struct timeval bar;
10727 #endif
10728 #ifdef S_TIMEZONE
10729         struct timezone tzp;
10730 #endif
10731         if (foo.tm_sec == foo.tm_sec)
10732                 exit(0);
10733 #ifdef S_TIMEVAL
10734         if (bar.tv_sec == bar.tv_sec)
10735                 exit(0);
10736 #endif
10737         exit(1);
10738 }
10739 EOCP
10740         flags=''
10741         for s_timezone in '-DS_TIMEZONE' ''; do
10742         sysselect=''
10743         for s_timeval in '-DS_TIMEVAL' ''; do
10744         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10745         for i_time in '' '-DI_TIME'; do
10746         for i_systime in '-DI_SYSTIME' ''; do
10747                 case "$flags" in
10748                 '') $echo $n ".$c"
10749                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10750                         if eval $compile; then
10751                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10752                                 shift
10753                                 flags="$*"
10754                                 echo " "
10755                                 $echo $n "Succeeded with $flags$c"
10756                         fi
10757                         ;;
10758                 esac
10759         done
10760         done
10761         done
10762         done
10763         done
10764         timeincl=''
10765         echo " "
10766         case "$flags" in
10767         *SYSTIMEKERNEL*) i_systimek="$define"
10768                 timeincl=`./findhdr sys/time.h`
10769                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10770         *) i_systimek="$undef";;
10771         esac
10772         case "$flags" in
10773         *I_TIME*) i_time="$define"
10774                 timeincl=`./findhdr time.h`" $timeincl"
10775                 echo "We'll include <time.h>." >&4;;
10776         *) i_time="$undef";;
10777         esac
10778         case "$flags" in
10779         *I_SYSTIME*) i_systime="$define"
10780                 timeincl=`./findhdr sys/time.h`" $timeincl"
10781                 echo "We'll include <sys/time.h>." >&4;;
10782         *) i_systime="$undef";;
10783         esac
10784         $rm_try
10785 fi
10786 : see if struct tm knows about tm_zone
10787 case "$i_systime$i_time" in
10788 *$define*)
10789         echo " "
10790         echo "Checking to see if your struct tm has tm_zone field..." >&4
10791         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10792         eval $hasfield
10793         ;;
10794 *)      val="$undef"
10795         set d_tm_tm_zone
10796         eval $setvar
10797         ;;
10798 esac
10799 case "$d_tm_tm_zone" in
10800 "$define")      echo "Yes, it does."   ;;
10801 *)              echo "No, it doesn't." ;;
10802 esac
10803 : see if struct tm knows about tm_gmtoff
10804 case "$i_systime$i_time" in
10805 *$define*)
10806         echo " "
10807         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10808         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10809         eval $hasfield
10810         ;;
10811 *)      val="$undef"
10812         set d_tm_tm_gmtoff
10813         eval $setvar
10814         ;;
10815 esac
10816 case "$d_tm_tm_gmtoff" in
10817 "$define")      echo "Yes, it does."   ;;
10818 *)              echo "No, it doesn't." ;;
10819 esac
10820
10821 : see if asctime_r exists
10822 set asctime_r d_asctime_r
10823 eval $inlibc
10824 case "$d_asctime_r" in
10825 "$define")
10826         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10827         case "$d_asctime_r_proto:$usethreads" in
10828         ":define")      d_asctime_r_proto=define
10829                 set d_asctime_r_proto asctime_r $hdrs
10830                 eval $hasproto ;;
10831         *)      ;;
10832         esac
10833         case "$d_asctime_r_proto" in
10834         define)
10835         case "$asctime_r_proto" in
10836         ''|0) try='char* asctime_r(const struct tm*, char*);'
10837         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10838         esac
10839         case "$asctime_r_proto" in
10840         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10841         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10842         esac
10843         case "$asctime_r_proto" in
10844         ''|0) try='int asctime_r(const struct tm*, char*);'
10845         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10846         esac
10847         case "$asctime_r_proto" in
10848         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10849         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10850         esac
10851         case "$asctime_r_proto" in
10852         ''|0)   d_asctime_r=undef
10853                 asctime_r_proto=0
10854                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10855         * )     case "$asctime_r_proto" in
10856                 REENTRANT_PROTO*) ;;
10857                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10858                 esac
10859                 echo "Prototype: $try" ;;
10860         esac
10861         ;;
10862         *)      case "$usethreads" in
10863                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10864                 esac
10865                 d_asctime_r=undef
10866                 asctime_r_proto=0
10867                 ;;
10868         esac
10869         ;;
10870 *)      asctime_r_proto=0
10871         ;;
10872 esac
10873
10874 : see if asinh exists
10875 set asinh d_asinh
10876 eval $inlibc
10877
10878 : see if atanh exists
10879 set atanh d_atanh
10880 eval $inlibc
10881
10882 : see if atolf exists
10883 set atolf d_atolf
10884 eval $inlibc
10885
10886 : see if atoll exists
10887 set atoll d_atoll
10888 eval $inlibc
10889
10890 : Look for GCC-style attribute format
10891 case "$d_attribute_format" in
10892 '')
10893 echo " "
10894 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10895 $cat >attrib.c <<'EOCP'
10896 #include <stdio.h>
10897 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10898 EOCP
10899 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10900         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10901                 echo "Your C compiler doesn't support __attribute__((format))."
10902                 val="$undef"
10903         else
10904                 echo "Your C compiler supports __attribute__((format))."
10905                 val="$define"
10906         fi
10907 else
10908         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10909         val="$undef"
10910 fi
10911 ;;
10912 *) val="$d_attribute_format" ;;
10913 esac
10914 set d_attribute_format
10915 eval $setvar
10916 $rm -f attrib*
10917
10918 : Look for GCC-style attribute format with null format allowed
10919 case "$d_printf_format_null" in
10920 '') case "$d_attribute_format" in
10921     $define)
10922         echo " "
10923         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10924 $cat >attrib.c <<EOCP
10925 #include <stdio.h>
10926 #$i_stdlib I_STDLIB
10927 #ifdef I_STDLIB
10928 #include <stdlib.h>
10929 #endif
10930 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10931 int null_printf (char* pat,...) { return (int)pat; }
10932 int main () { exit(null_printf(NULL)); }
10933 EOCP
10934         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10935             : run the executable in case it produces a run-time warning
10936             if $run ./attrib >>attrib.out 2>&1; then
10937                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10938                     echo "Your C compiler doesn't allow __printf__ format to be null."
10939                     val="$undef"
10940                 else
10941                     echo "Your C compiler allows __printf__ format to be null."
10942                     val="$define"
10943                 fi
10944             else
10945             echo "Your C compiler executable failed with __printf__ format null."
10946             val="$undef"
10947         fi
10948     else
10949         echo "Your C compiler fails with __printf__ format null."
10950         val="$undef"
10951     fi
10952     ;;
10953     *)  val="$undef" ;;
10954     esac
10955 ;;
10956 *)  val="$d_printf_format_null" ;;
10957 esac
10958 set d_printf_format_null
10959 eval $setvar
10960 $rm -f attrib*
10961
10962 : Look for GCC-style attribute malloc
10963 case "$d_attribute_malloc" in
10964 '')
10965 echo " "
10966 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10967 $cat >attrib.c <<'EOCP'
10968 #include <stdio.h>
10969 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10970 EOCP
10971 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10972         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10973                 echo "Your C compiler doesn't support __attribute__((malloc))."
10974                 val="$undef"
10975         else
10976                 echo "Your C compiler supports __attribute__((malloc))."
10977                 val="$define"
10978         fi
10979 else
10980         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10981         val="$undef"
10982 fi
10983 ;;
10984 *) val="$d_attribute_malloc" ;;
10985 esac
10986 set d_attribute_malloc
10987 eval $setvar
10988 $rm -f attrib*
10989
10990 : Look for GCC-style attribute nonnull
10991 case "$d_attribute_nonnull" in
10992 '')
10993 echo " "
10994 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10995 $cat >attrib.c <<'EOCP'
10996 #include <stdio.h>
10997 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10998 EOCP
10999 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11000         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11001                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11002                 val="$undef"
11003         else
11004                 echo "Your C compiler supports __attribute__((nonnull))."
11005                 val="$define"
11006         fi
11007 else
11008         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11009         val="$undef"
11010 fi
11011 ;;
11012 *) val="$d_attribute_nonnull" ;;
11013 esac
11014 set d_attribute_nonnull
11015 eval $setvar
11016 $rm -f attrib*
11017
11018 : Look for GCC-style attribute noreturn
11019 case "$d_attribute_noreturn" in
11020 '')
11021 echo " "
11022 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11023 $cat >attrib.c <<'EOCP'
11024 #include <stdio.h>
11025 void fall_over_dead( void ) __attribute__((noreturn));
11026 EOCP
11027 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11028         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11029                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11030                 val="$undef"
11031         else
11032                 echo "Your C compiler supports __attribute__((noreturn))."
11033                 val="$define"
11034         fi
11035 else
11036         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11037         val="$undef"
11038 fi
11039 ;;
11040 *) val="$d_attribute_noreturn" ;;
11041 esac
11042 set d_attribute_noreturn
11043 eval $setvar
11044 $rm -f attrib*
11045
11046 : Look for GCC-style attribute pure
11047 case "$d_attribute_pure" in
11048 '')
11049 echo " "
11050 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11051 $cat >attrib.c <<'EOCP'
11052 #include <stdio.h>
11053 int square( int n ) __attribute__((pure));
11054 EOCP
11055 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11056         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11057                 echo "Your C compiler doesn't support __attribute__((pure))."
11058                 val="$undef"
11059         else
11060                 echo "Your C compiler supports __attribute__((pure))."
11061                 val="$define"
11062         fi
11063 else
11064         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11065         val="$undef"
11066 fi
11067 ;;
11068 *) val="$d_attribute_pure" ;;
11069 esac
11070 set d_attribute_pure
11071 eval $setvar
11072 $rm -f attrib*
11073
11074 : Look for GCC-style attribute unused
11075 case "$d_attribute_unused" in
11076 '')
11077 echo " "
11078 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11079 $cat >attrib.c <<'EOCP'
11080 #include <stdio.h>
11081 int do_something( int dummy __attribute__((unused)), int n );
11082 EOCP
11083 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11084         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11085                 echo "Your C compiler doesn't support __attribute__((unused))."
11086                 val="$undef"
11087         else
11088                 echo "Your C compiler supports __attribute__((unused))."
11089                 val="$define"
11090         fi
11091 else
11092         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11093         val="$undef"
11094 fi
11095 ;;
11096 *) val="$d_attribute_unused" ;;
11097 esac
11098 set d_attribute_unused
11099 eval $setvar
11100 $rm -f attrib*
11101
11102 : Look for GCC-style attribute deprecated
11103 case "$d_attribute_deprecated" in
11104 '')
11105 echo " "
11106 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11107 $cat >attrib.c <<'EOCP'
11108 #include <stdio.h>
11109 int I_am_deprecated(void) __attribute__((deprecated));
11110 EOCP
11111 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11112         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11113                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11114                 val="$undef"
11115         else
11116                 echo "Your C compiler supports __attribute__((deprecated))."
11117                 val="$define"
11118         fi
11119 else
11120         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11121         val="$undef"
11122 fi
11123 ;;
11124 *) val="$d_attribute_deprecated" ;;
11125 esac
11126 set d_attribute_deprecated
11127 eval $setvar
11128 $rm -f attrib*
11129
11130 : Look for GCC-style attribute warn_unused_result
11131 case "$d_attribute_warn_unused_result" in
11132 '')
11133 echo " "
11134 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11135 $cat >attrib.c <<'EOCP'
11136 #include <stdio.h>
11137 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11138 EOCP
11139 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11140         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11141                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11142                 val="$undef"
11143         else
11144                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11145                 val="$define"
11146         fi
11147 else
11148         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11149         val="$undef"
11150 fi
11151 ;;
11152 *) val="$d_attribute_warn_unused_result" ;;
11153 esac
11154 set d_attribute_warn_unused_result
11155 eval $setvar
11156 $rm -f attrib*
11157
11158 : see if bcmp exists
11159 set bcmp d_bcmp
11160 eval $inlibc
11161
11162 : see if bcopy exists
11163 set bcopy d_bcopy
11164 eval $inlibc
11165
11166 : see if getpgrp exists
11167 set getpgrp d_getpgrp
11168 eval $inlibc
11169
11170 case "$d_getpgrp" in
11171 "$define")
11172         echo " "
11173         echo "Checking to see which flavor of getpgrp is in use..."
11174         $cat >try.c <<EOP
11175 #$i_unistd I_UNISTD
11176 #include <sys/types.h>
11177 #ifdef I_UNISTD
11178 #  include <unistd.h>
11179 #endif
11180 #$i_stdlib I_STDLIB
11181 #ifdef I_STDLIB
11182 #include <stdlib.h>
11183 #endif
11184 int main()
11185 {
11186         if (getuid() == 0) {
11187                 printf("(I see you are running Configure as super-user...)\n");
11188                 setuid(1);
11189         }
11190 #ifdef TRY_BSD_PGRP
11191         if (getpgrp(1) == 0)
11192                 exit(0);
11193 #else
11194         if (getpgrp() > 0)
11195                 exit(0);
11196 #endif
11197         exit(1);
11198 }
11199 EOP
11200         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11201                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11202                 val="$define"
11203         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11204                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11205                 val="$undef"
11206         else
11207                 echo "I can't seem to compile and run the test program."
11208                 if ./usg; then
11209                         xxx="a USG one, i.e. you use getpgrp()."
11210                 else
11211                         # SVR4 systems can appear rather BSD-ish.
11212                         case "$i_unistd" in
11213                         $undef)
11214                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11215                                 val="$define"
11216                                 ;;
11217                         $define)
11218                                 xxx="probably a USG one, i.e. you use getpgrp()."
11219                                 val="$undef"
11220                                 ;;
11221                         esac
11222                 fi
11223                 echo "Assuming your getpgrp is $xxx" >&4
11224         fi
11225         ;;
11226 *) val="$undef";;
11227 esac
11228 set d_bsdgetpgrp
11229 eval $setvar
11230 $rm_try
11231
11232 : see if setpgrp exists
11233 set setpgrp d_setpgrp
11234 eval $inlibc
11235
11236 case "$d_setpgrp" in
11237 "$define")
11238         echo " "
11239         echo "Checking to see which flavor of setpgrp is in use..."
11240         $cat >try.c <<EOP
11241 #$i_unistd I_UNISTD
11242 #include <sys/types.h>
11243 #ifdef I_UNISTD
11244 #  include <unistd.h>
11245 #endif
11246 #$i_stdlib I_STDLIB
11247 #ifdef I_STDLIB
11248 #include <stdlib.h>
11249 #endif
11250 int main()
11251 {
11252         if (getuid() == 0) {
11253                 printf("(I see you are running Configure as super-user...)\n");
11254                 setuid(1);
11255         }
11256 #ifdef TRY_BSD_PGRP
11257         if (-1 == setpgrp(1, 1))
11258                 exit(0);
11259 #else
11260         if (setpgrp() != -1)
11261                 exit(0);
11262 #endif
11263         exit(1);
11264 }
11265 EOP
11266         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11267                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11268                 val="$define"
11269         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11270                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11271                 val="$undef"
11272         else
11273                 echo "(I can't seem to compile and run the test program.)"
11274                 if ./usg; then
11275                         xxx="a USG one, i.e. you use setpgrp()."
11276                 else
11277                         # SVR4 systems can appear rather BSD-ish.
11278                         case "$i_unistd" in
11279                         $undef)
11280                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11281                                 val="$define"
11282                                 ;;
11283                         $define)
11284                                 xxx="probably a USG one, i.e. you use setpgrp()."
11285                                 val="$undef"
11286                                 ;;
11287                         esac
11288                 fi
11289                 echo "Assuming your setpgrp is $xxx" >&4
11290         fi
11291         ;;
11292 *) val="$undef";;
11293 esac
11294 set d_bsdsetpgrp
11295 eval $setvar
11296 $rm_try
11297
11298 : Look for GCC-style __builtin_choose_expr
11299 case "$d_builtin_choose_expr" in
11300 '')
11301     echo " "
11302     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11303     $cat >try.c <<'EOCP'
11304 #include <assert.h>
11305 #include <stdlib.h>
11306 #include <stdio.h>
11307
11308 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11309
11310 int main(void) {
11311     assert( SYRINX(1) == 2112 );
11312     assert( SYRINX(1) != 5150 );
11313     assert( SYRINX(0) == 5150 );
11314     assert( SYRINX(0) != 2112 );
11315     puts( "All good!" );
11316     exit(0);
11317 }
11318
11319 EOCP
11320     set try
11321     if eval $compile && $run ./try; then
11322         echo "Your C compiler supports __builtin_choose_expr."
11323         val="$define"
11324     else
11325         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11326         val="$undef"
11327     fi
11328 ;;
11329 *) val="$d_builtin_choose_expr" ;;
11330 esac
11331
11332 set d_builtin_choose_expr
11333 eval $setvar
11334 $rm_try
11335
11336 : Look for GCC-style __builtin_expect
11337 case "$d_builtin_expect" in
11338 '')
11339     echo " "
11340     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11341     $cat >try.c <<'EOCP'
11342 int main(void) {
11343     int n = 50;
11344     if ( __builtin_expect(n, 0) ) n = 1;
11345     /* Remember shell exit code truth is 0, C truth is non-zero */
11346     return !(n == 1);
11347 }
11348 EOCP
11349     set try
11350     if eval $compile && $run ./try; then
11351         echo "Your C compiler supports __builtin_expect."
11352         val="$define"
11353     else
11354         echo "Your C compiler doesn't seem to understand __builtin_expect."
11355         val="$undef"
11356     fi
11357     ;;
11358 *) val="$d_builtin_expect" ;;
11359 esac
11360
11361 set d_builtin_expect
11362 eval $setvar
11363 $rm_try
11364
11365 : see if bzero exists
11366 set bzero d_bzero
11367 eval $inlibc
11368
11369 : see if stdarg is available
11370 echo " "
11371 if $test `./findhdr stdarg.h`; then
11372         echo "<stdarg.h> found." >&4
11373         valstd="$define"
11374 else
11375         echo "<stdarg.h> NOT found." >&4
11376         valstd="$undef"
11377 fi
11378
11379 : see if varargs is available
11380 echo " "
11381 if $test `./findhdr varargs.h`; then
11382         echo "<varargs.h> found." >&4
11383 else
11384         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11385 fi
11386
11387 : set up the varargs testing programs
11388 $cat > varargs.c <<EOP
11389 #ifdef I_STDARG
11390 #include <stdarg.h>
11391 #endif
11392 #ifdef I_VARARGS
11393 #include <varargs.h>
11394 #endif
11395
11396 #ifdef I_STDARG
11397 int f(char *p, ...)
11398 #else
11399 int f(va_alist)
11400 va_dcl
11401 #endif
11402 {
11403         va_list ap;
11404 #ifndef I_STDARG
11405         char *p;
11406 #endif
11407 #ifdef I_STDARG
11408         va_start(ap,p);
11409 #else
11410         va_start(ap);
11411         p = va_arg(ap, char *);
11412 #endif
11413         va_end(ap);
11414         return 0;
11415 }
11416 EOP
11417 $cat > varargs <<EOP
11418 $startsh
11419 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11420         echo "true"
11421 else
11422         echo "false"
11423 fi
11424 $rm -f varargs$_o
11425 EOP
11426 chmod +x varargs
11427
11428 : now check which varargs header should be included
11429 echo " "
11430 i_varhdr=''
11431 val=''
11432 case "$valstd" in
11433 "$define")
11434         if `./varargs I_STDARG`; then
11435                 val='stdarg.h'
11436         elif `./varargs I_VARARGS`; then
11437                 val='varargs.h'
11438         fi
11439         ;;
11440 *)
11441         if `./varargs I_VARARGS`; then
11442                 val='varargs.h'
11443         fi
11444         ;;
11445 esac
11446 case "$val" in
11447 '')
11448         echo " "
11449         echo "*** WHOA THERE!!! ***" >&4
11450         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
11451         case "$knowitall" in
11452         '')
11453         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
11454                 exit 1
11455                 ;;
11456         esac
11457 echo "I could not find the definition for va_dcl... You have problems..." >&4
11458         val="$undef"; set i_stdarg; eval $setvar
11459         val="$undef"; set i_varargs; eval $setvar
11460         ;;
11461 *)
11462         set i_varhdr
11463         eval $setvar
11464         case "$i_varhdr" in
11465         stdarg.h)
11466                 val="$define"; set i_stdarg; eval $setvar
11467                 val="$undef"; set i_varargs; eval $setvar
11468                 ;;
11469         varargs.h)
11470                 val="$undef"; set i_stdarg; eval $setvar
11471                 val="$define"; set i_varargs; eval $setvar
11472                 ;;
11473         esac
11474         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11475 esac
11476 $rm -f varargs*
11477
11478 : see if the Compiler supports C99 variadic macros
11479 case "$i_stdarg$i_stdlib" in
11480     "$define$define")
11481     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11482     $cat >try.c <<EOCP
11483 #include <stdio.h>
11484 #include <stdarg.h>
11485
11486 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11487
11488 int main() {
11489   char buf[20];
11490   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11491   puts(buf);
11492   return 0;
11493 }
11494 EOCP
11495     set try
11496     if eval $compile && $run ./try 2>&1 >/dev/null; then
11497         case "`$run ./try`" in
11498             "123 456 789")
11499             echo "You have C99 variadic macros." >&4
11500             d_c99_variadic_macros="$define"
11501             ;;
11502             *)
11503             echo "You don't have functional C99 variadic macros." >&4
11504             d_c99_variadic_macros="$undef"
11505             ;;
11506         esac
11507     else
11508         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11509         d_c99_variadic_macros="$undef"
11510     fi
11511     $rm_try
11512     ;;
11513     *)
11514     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11515     d_c99_variadic_macros="$undef"
11516     ;;
11517 esac
11518
11519 : see if signal is declared as pointer to function returning int or void
11520 echo " "
11521 xxx=`./findhdr signal.h`
11522 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11523 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11524         echo "You have int (*signal())() instead of void." >&4
11525         val="$undef"
11526 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11527         echo "You have void (*signal())()." >&4
11528         val="$define"
11529 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11530         echo "You have int (*signal())() instead of void." >&4
11531         val="$undef"
11532 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11533         echo "You have void (*signal())()." >&4
11534         val="$define"
11535 else
11536         case "$d_voidsig" in
11537         '')
11538         echo "I can't determine whether signal handler returns void or int..." >&4
11539                 dflt=void
11540                 rp="What type does your signal handler return?"
11541                 . ./myread
11542                 case "$ans" in
11543                 v*) val="$define";;
11544                 *) val="$undef";;
11545                 esac;;
11546         "$define")
11547                 echo "As you already told me, signal handler returns void." >&4
11548                 val="$define"
11549                 ;;
11550         *)      echo "As you already told me, signal handler returns int." >&4
11551                 val="$undef"
11552                 ;;
11553         esac
11554 fi
11555 set d_voidsig
11556 eval $setvar
11557 case "$d_voidsig" in
11558 "$define") signal_t="void";;
11559 *) signal_t="int";;
11560 esac
11561 $rm -f $$.tmp
11562
11563 : check for ability to cast large floats to 32-bit ints.
11564 echo " "
11565 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11566 if $test "$intsize" -ge 4; then
11567         xxx=int
11568 else
11569         xxx=long
11570 fi
11571 $cat >try.c <<EOCP
11572 #include <stdio.h>
11573 #$i_stdlib I_STDLIB
11574 #ifdef I_STDLIB
11575 #include <stdlib.h>
11576 #endif
11577 #include <sys/types.h>
11578 #include <signal.h>
11579 $signal_t blech(int s) { exit(3); }
11580 int main()
11581 {
11582         $xxx i32;
11583         double f, g;
11584         int result = 0;
11585         char str[16];
11586         signal(SIGFPE, blech);
11587
11588         /* Don't let compiler optimize the test away.  Store the number
11589            in a writable string for gcc to pass to sscanf under HP-UX.
11590         */
11591         sprintf(str, "2147483647");
11592         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11593         g = 10 * f;
11594         i32  = ($xxx) g;
11595
11596         /* x86 processors will probably give 0x8000 0000, which is a
11597            sign change.  We don't want that.  We want to mimic SPARC
11598            behavior here, which is to preserve the sign and give
11599            back 0x7fff ffff.
11600         */
11601         if (i32 != ($xxx) f)
11602                 result |= 1;
11603         exit(result);
11604 }
11605 EOCP
11606 set try
11607 if eval $compile_ok; then
11608         $run ./try 2>/dev/null
11609         yyy=$?
11610 else
11611         echo "(I can't seem to compile the test program--assuming it can't)"
11612         yyy=1
11613 fi
11614 case "$yyy" in
11615 0)      val="$define"
11616         echo "Yup, it can."
11617         ;;
11618 *)      val="$undef"
11619         echo "Nope, it can't."
11620         ;;
11621 esac
11622 set d_casti32
11623 eval $setvar
11624 $rm_try
11625
11626 : check for ability to cast negative floats to unsigned
11627 echo " "
11628 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11629 $cat >try.c <<EOCP
11630 #include <stdio.h>
11631 #$i_stdlib I_STDLIB
11632 #ifdef I_STDLIB
11633 #include <stdlib.h>
11634 #endif
11635 #include <sys/types.h>
11636 #include <signal.h>
11637 $signal_t blech(int s) { exit(7); }
11638 $signal_t blech_in_list(int s) { exit(4); }
11639 unsigned long dummy_long(unsigned long p) { return p; }
11640 unsigned int dummy_int(unsigned int p) { return p; }
11641 unsigned short dummy_short(unsigned short p) { return p; }
11642 int main()
11643 {
11644         double f;
11645         unsigned long along;
11646         unsigned int aint;
11647         unsigned short ashort;
11648         int result = 0;
11649         char str[16];
11650
11651         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11652            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11653            optimized the whole file away
11654         */
11655         /* Store the number in a writable string for gcc to pass to
11656            sscanf under HP-UX.
11657         */
11658         sprintf(str, "-123");
11659         sscanf(str, "%lf", &f);  /* f = -123.; */
11660
11661         signal(SIGFPE, blech);
11662         along = (unsigned long)f;
11663         aint = (unsigned int)f;
11664         ashort = (unsigned short)f;
11665         if (along != (unsigned long)-123)
11666                 result |= 1;
11667         if (aint != (unsigned int)-123)
11668                 result |= 1;
11669         if (ashort != (unsigned short)-123)
11670                 result |= 1;
11671         sprintf(str, "1073741824.");
11672         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11673         f = f + f;
11674         along = 0;
11675         along = (unsigned long)f;
11676         if (along != 0x80000000)
11677                 result |= 2;
11678         f -= 1.;
11679         along = 0;
11680         along = (unsigned long)f;
11681         if (along != 0x7fffffff)
11682                 result |= 1;
11683         f += 2.;
11684         along = 0;
11685         along = (unsigned long)f;
11686         if (along != 0x80000001)
11687                 result |= 2;
11688         if (result)
11689                 exit(result);
11690         signal(SIGFPE, blech_in_list);
11691         sprintf(str, "123.");
11692         sscanf(str, "%lf", &f);  /* f = 123.; */
11693         along = dummy_long((unsigned long)f);
11694         aint = dummy_int((unsigned int)f);
11695         ashort = dummy_short((unsigned short)f);
11696         if (along != (unsigned long)123)
11697                 result |= 4;
11698         if (aint != (unsigned int)123)
11699                 result |= 4;
11700         if (ashort != (unsigned short)123)
11701                 result |= 4;
11702         exit(result);
11703
11704 }
11705 EOCP
11706 set try
11707 if eval $compile_ok; then
11708         $run ./try 2>/dev/null
11709         castflags=$?
11710 else
11711         echo "(I can't seem to compile the test program--assuming it can't)"
11712         castflags=7
11713 fi
11714 case "$castflags" in
11715 0)      val="$define"
11716         echo "Yup, it can."
11717         ;;
11718 *)      val="$undef"
11719         echo "Nope, it can't."
11720         ;;
11721 esac
11722 set d_castneg
11723 eval $setvar
11724 $rm_try
11725
11726 : see if cbrt exists
11727 set cbrt d_cbrt
11728 eval $inlibc
11729
11730 : see if vprintf exists
11731 echo " "
11732 if set vprintf val -f d_vprintf; eval $csym; $val; then
11733         echo 'vprintf() found.' >&4
11734         val="$define"
11735         $cat >try.c <<EOF
11736 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11737 #$i_varargs I_VARARGS
11738
11739 #$i_stdlib I_STDLIB
11740 #$i_unistd I_UNISTD
11741
11742 #ifdef I_STDARG
11743 #  include <stdarg.h>
11744 #else /* I_VARARGS */
11745 #  include <varargs.h>
11746 #endif
11747
11748 #ifdef I_UNISTD
11749 #  include <unistd.h>
11750 #endif
11751
11752 #ifdef I_STDLIB
11753 #  include <stdlib.h>
11754 #endif
11755
11756 #include <stdio.h> /* vsprintf prototype */
11757
11758 #ifdef I_STDARG
11759 void xxx(int n, ...)
11760 {
11761     va_list args;
11762     char buf[10];
11763     va_start(args, n);
11764     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11765 }
11766 int main() { xxx(1, "foo"); }
11767
11768 #else /* I_VARARGS */
11769
11770 xxx(va_alist)
11771 va_dcl
11772 {
11773     va_list args;
11774     char buf[10];
11775     va_start(args);
11776     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11777 }
11778 int main() { xxx("foo"); }
11779
11780 #endif
11781
11782 EOF
11783         set try
11784         if eval $compile_ok; then
11785                 if $run ./try; then
11786                         echo "Your vsprintf() returns (int)." >&4
11787                         val2="$undef"
11788                 else
11789                         echo "Your vsprintf() returns (char*)." >&4
11790                         val2="$define"
11791                 fi
11792         else
11793                 echo 'I am unable to compile the vsprintf() test program.' >&4
11794                 # We shouldn't get here.  If we do, assume the standard signature,
11795                 # not the old BSD one.
11796                 echo 'Guessing that vsprintf() returns (int).' >&4
11797                 val2="$undef"
11798         fi
11799 else
11800         echo 'vprintf() NOT found.' >&4
11801         val="$undef"
11802         val2="$undef"
11803 fi
11804 $rm_try
11805 set d_vprintf
11806 eval $setvar
11807 val=$val2
11808 set d_charvspr
11809 eval $setvar
11810
11811 : see if chown exists
11812 set chown d_chown
11813 eval $inlibc
11814
11815 : see if chroot exists
11816 set chroot d_chroot
11817 eval $inlibc
11818
11819 : see if chsize exists
11820 set chsize d_chsize
11821 eval $inlibc
11822
11823 : see if class exists
11824 set class d_class
11825 eval $inlibc
11826
11827 : see if clearenv exists
11828 set clearenv d_clearenv
11829 eval $inlibc
11830
11831 : Define hasstruct macro for Configure internal use
11832 hasstruct='varname=$1; struct=$2; shift; shift;
11833 while $test $# -ge 2; do
11834         case "$1" in
11835         $define) echo "#include <$2>";;
11836         esac ;
11837     shift 2;
11838 done > try.c;
11839 echo "int main () { struct $struct foo; }" >> try.c;
11840 set try;
11841 if eval $compile; then
11842         val="$define";
11843 else
11844         val="$undef";
11845 fi;
11846 set $varname;
11847 eval $setvar;
11848 $rm_try'
11849
11850 : see whether socket exists
11851 socketlib=''
11852 sockethdr=''
11853 echo " "
11854 $echo $n "Hmm... $c" >&4
11855 if set socket val -f d_socket; eval $csym; $val; then
11856     echo "Looks like you have Berkeley networking support." >&4
11857     d_socket="$define"
11858     if set setsockopt val -f; eval $csym; $val; then
11859         d_oldsock="$undef"
11860     else
11861         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11862         d_oldsock="$define"
11863     fi
11864 else
11865     if $contains socklib libc.list >/dev/null 2>&1; then
11866         echo "Looks like you have Berkeley networking support." >&4
11867         d_socket="$define"
11868         : we will have to assume that it supports the 4.2 BSD interface
11869         d_oldsock="$undef"
11870     else
11871         echo "You don't have Berkeley networking in libc$_a..." >&4
11872         if test "X$d_socket" = "X$define"; then
11873             echo "...but you seem to believe that you have sockets." >&4
11874         else
11875             for net in net socket
11876             do
11877                 if test -f $sysroot/usr/lib/lib$net$_a; then
11878                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11879                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11880                     if $contains socket libc.list >/dev/null 2>&1; then
11881                         d_socket="$define"
11882                         socketlib="-l$net"
11883                         case "$net" in
11884                         net)
11885                             echo "...but the Wollongong group seems to have hacked it in." >&4
11886                             sockethdr="-I$sysroot/usr/netinclude"
11887                             ;;
11888                         esac
11889                         echo "Found Berkeley sockets interface in lib$net." >&4
11890                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11891                             d_oldsock="$undef"
11892                         else
11893                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11894                             d_oldsock="$define"
11895                         fi
11896                         break
11897                     fi
11898                 fi
11899             done
11900             if test "X$d_socket" != "X$define"; then
11901                echo "or anywhere else I see." >&4
11902                d_socket="$undef"
11903                d_oldsock="$undef"
11904             fi
11905         fi
11906     fi
11907 fi
11908
11909 : see if socketpair exists
11910 set socketpair d_sockpair
11911 eval $inlibc
11912
11913
11914 echo " "
11915 echo "Checking the availability sa_len in the sock struct ..." >&4
11916 $cat >try.c <<EOF
11917 #include <sys/types.h>
11918 #include <sys/socket.h>
11919 int main() {
11920 struct sockaddr sa;
11921 return (sa.sa_len);
11922 }
11923 EOF
11924 val="$undef"
11925 set try; if eval $compile; then
11926     val="$define"
11927 fi
11928 set d_sockaddr_sa_len; eval $setvar
11929 $rm_try
11930
11931 echo " "
11932 echo "Checking the availability struct sockaddr_in6 ..." >&4
11933 $cat >try.c <<EOF
11934 #include <sys/types.h>
11935 #include <sys/socket.h>
11936 #include <netinet/in.h>
11937 int main() {
11938 struct sockaddr_in6 sin6;
11939 return (sin6.sin6_family);
11940 }
11941 EOF
11942 val="$undef"
11943 set try; if eval $compile; then
11944     val="$define"
11945 fi
11946 set d_sockaddr_in6; eval $setvar
11947 $rm_try
11948
11949 echo " "
11950 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11951 $cat >try.c <<EOF
11952 #include <sys/types.h>
11953 #include <sys/socket.h>
11954 #include <netinet/in.h>
11955 int main() {
11956 struct sockaddr_in6 sin6;
11957 return (sin6.sin6_scope_id);
11958 }
11959 EOF
11960 val="$undef"
11961 set try; if eval $compile; then
11962     val="$define"
11963 fi
11964 set d_sin6_scope_id; eval $setvar
11965 $rm_try
11966
11967 echo " "
11968 echo "Checking the availability struct ip_mreq ..." >&4
11969 $cat >try.c <<EOF
11970 #include <sys/types.h>
11971 #include <sys/socket.h>
11972 #include <netinet/in.h>
11973 int main() {
11974 struct ip_mreq mreq;
11975 return (mreq.imr_multiaddr.s_addr);
11976 }
11977 EOF
11978 val="$undef"
11979 set try; if eval $compile; then
11980        val="$define"
11981 fi
11982 set d_ip_mreq; eval $setvar
11983 $rm_try
11984
11985 echo " "
11986 echo "Checking the availability struct ip_mreq_source ..." >&4
11987 $cat >try.c <<EOF
11988 #include <sys/types.h>
11989 #include <sys/socket.h>
11990 #include <netinet/in.h>
11991 int main() {
11992 struct ip_mreq_source mreq;
11993 return (mreq.imr_multiaddr.s_addr);
11994 }
11995 EOF
11996 val="$undef"
11997 set try; if eval $compile; then
11998        val="$define"
11999 fi
12000 set d_ip_mreq_source; eval $setvar
12001 $rm_try
12002
12003 echo " "
12004 echo "Checking the availability struct ipv6_mreq ..." >&4
12005 $cat >try.c <<EOF
12006 #include <sys/types.h>
12007 #include <sys/socket.h>
12008 #include <netinet/in.h>
12009 int main() {
12010 struct ipv6_mreq mreq;
12011 return (mreq.ipv6mr_interface);
12012 }
12013 EOF
12014 val="$undef"
12015 set try; if eval $compile; then
12016     val="$define"
12017 fi
12018 set d_ipv6_mreq; eval $setvar
12019 $rm_try
12020
12021 echo " "
12022 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12023 $cat >try.c <<EOF
12024 #include <sys/types.h>
12025 #include <sys/socket.h>
12026 #include <netinet/in.h>
12027 int main() {
12028 struct ipv6_mreq_source mreq;
12029 return (mreq.imr_multiaddr.s_addr);
12030 }
12031 EOF
12032 val="$undef"
12033 set try; if eval $compile; then
12034        val="$define"
12035 fi
12036 set d_ipv6_mreq_source; eval $setvar
12037 $rm_try
12038
12039 echo " "
12040 echo "Checking the availability of certain socket constants..." >&4
12041 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12042     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12043     $cat >try.c <<EOF
12044 #include <sys/types.h>
12045 #include <sys/socket.h>
12046 int main() {
12047     int i = $ENUM;
12048 }
12049 EOF
12050     val="$undef"
12051     set try; if eval $compile; then
12052         val="$define"
12053     fi
12054     set d_${enum}; eval $setvar
12055     $rm_try
12056 done
12057
12058 : see if this is a sys/uio.h system
12059 set sys/uio.h i_sysuio
12060 eval $inhdr
12061
12062 : Check for cmsghdr support
12063 echo " "
12064 echo "Checking to see if your system supports struct cmsghdr..." >&4
12065 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12066 eval $hasstruct
12067 case "$d_cmsghdr_s" in
12068 "$define")      echo "Yes, it does."   ;;
12069 *)              echo "No, it doesn't." ;;
12070 esac
12071
12072
12073 : check for const keyword
12074 echo " "
12075 echo 'Checking to see if your C compiler knows about "const"...' >&4
12076 $cat >const.c <<'EOCP'
12077 typedef struct spug { int drokk; } spug;
12078 int main()
12079 {
12080         const char *foo;
12081         const spug y = { 0 };
12082 }
12083 EOCP
12084 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
12085         val="$define"
12086         echo "Yup, it does."
12087 else
12088         val="$undef"
12089         echo "Nope, it doesn't."
12090 fi
12091 set d_const
12092 eval $setvar
12093
12094 : see if copysign exists
12095 set copysign d_copysign
12096 eval $inlibc
12097
12098 : see if copysignl exists
12099 set copysignl d_copysignl
12100 eval $inlibc
12101
12102 : see if crypt exists
12103 echo " "
12104 set crypt d_crypt
12105 eval $inlibc
12106 case "$d_crypt" in
12107 $define) cryptlib='' ;;
12108 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12109                 echo 'crypt() found.' >&4
12110                 val="$define"
12111                 cryptlib=''
12112         else
12113                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12114                 if $test -z "$cryptlib"; then
12115                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12116                 else
12117                         cryptlib=-lcrypt
12118                 fi
12119                 if $test -z "$cryptlib"; then
12120                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12121                 else
12122                         cryptlib=-lcrypt
12123                 fi
12124                 if $test -z "$cryptlib"; then
12125                         cryptlib=`./loc libcrypt$_a "" $libpth`
12126                 else
12127                         cryptlib=-lcrypt
12128                 fi
12129                 if $test -z "$cryptlib"; then
12130                         echo 'crypt() NOT found.' >&4
12131                         val="$undef"
12132                 else
12133                         val="$define"
12134                 fi
12135         fi
12136         set d_crypt
12137         eval $setvar
12138         ;;
12139 esac
12140
12141 : see if this is a crypt.h system
12142 set crypt.h i_crypt
12143 eval $inhdr
12144
12145 : see if crypt_r exists
12146 set crypt_r d_crypt_r
12147 eval $inlibc
12148 case "$d_crypt_r" in
12149 "$define")
12150         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12151         case "$d_crypt_r_proto:$usethreads" in
12152         ":define")      d_crypt_r_proto=define
12153                 set d_crypt_r_proto crypt_r $hdrs
12154                 eval $hasproto ;;
12155         *)      ;;
12156         esac
12157         case "$d_crypt_r_proto" in
12158         define)
12159         case "$crypt_r_proto" in
12160         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12161         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12162         esac
12163         case "$crypt_r_proto" in
12164         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12165         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12166         esac
12167         case "$crypt_r_proto" in
12168         ''|0)   d_crypt_r=undef
12169                 crypt_r_proto=0
12170                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12171         * )     case "$crypt_r_proto" in
12172                 REENTRANT_PROTO*) ;;
12173                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12174                 esac
12175                 echo "Prototype: $try" ;;
12176         esac
12177         ;;
12178         *)      case "$usethreads" in
12179                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12180                 esac
12181                 d_crypt_r=undef
12182                 crypt_r_proto=0
12183                 ;;
12184         esac
12185         ;;
12186 *)      crypt_r_proto=0
12187         ;;
12188 esac
12189
12190 : get csh whereabouts
12191 case "$csh" in
12192 'csh') val="$undef" ;;
12193 *) val="$define" ;;
12194 esac
12195 set d_csh
12196 eval $setvar
12197 : Respect a hint or command line value for full_csh.
12198 case "$full_csh" in
12199 '') full_csh=$csh ;;
12200 esac
12201
12202 : see if ctermid exists
12203 set ctermid d_ctermid
12204 eval $inlibc
12205
12206 : see if ctermid_r exists
12207 set ctermid_r d_ctermid_r
12208 eval $inlibc
12209 case "$d_ctermid_r" in
12210 "$define")
12211         hdrs="$i_systypes sys/types.h define stdio.h "
12212         case "$d_ctermid_r_proto:$usethreads" in
12213         ":define")      d_ctermid_r_proto=define
12214                 set d_ctermid_r_proto ctermid_r $hdrs
12215                 eval $hasproto ;;
12216         *)      ;;
12217         esac
12218         case "$d_ctermid_r_proto" in
12219         define)
12220         case "$ctermid_r_proto" in
12221         ''|0) try='char* ctermid_r(char*);'
12222         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12223         esac
12224         case "$ctermid_r_proto" in
12225         ''|0)   d_ctermid_r=undef
12226                 ctermid_r_proto=0
12227                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12228         * )     case "$ctermid_r_proto" in
12229                 REENTRANT_PROTO*) ;;
12230                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12231                 esac
12232                 echo "Prototype: $try" ;;
12233         esac
12234         ;;
12235         *)      case "$usethreads" in
12236                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12237                 esac
12238                 d_ctermid_r=undef
12239                 ctermid_r_proto=0
12240                 ;;
12241         esac
12242         ;;
12243 *)      ctermid_r_proto=0
12244         ;;
12245 esac
12246
12247 : see if ctime_r exists
12248 set ctime_r d_ctime_r
12249 eval $inlibc
12250 case "$d_ctime_r" in
12251 "$define")
12252         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12253         case "$d_ctime_r_proto:$usethreads" in
12254         ":define")      d_ctime_r_proto=define
12255                 set d_ctime_r_proto ctime_r $hdrs
12256                 eval $hasproto ;;
12257         *)      ;;
12258         esac
12259         case "$d_ctime_r_proto" in
12260         define)
12261         case "$ctime_r_proto" in
12262         ''|0) try='char* ctime_r(const time_t*, char*);'
12263         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12264         esac
12265         case "$ctime_r_proto" in
12266         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12267         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12268         esac
12269         case "$ctime_r_proto" in
12270         ''|0) try='int ctime_r(const time_t*, char*);'
12271         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12272         esac
12273         case "$ctime_r_proto" in
12274         ''|0) try='int ctime_r(const time_t*, char*, int);'
12275         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12276         esac
12277         case "$ctime_r_proto" in
12278         ''|0)   d_ctime_r=undef
12279                 ctime_r_proto=0
12280                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12281         * )     case "$ctime_r_proto" in
12282                 REENTRANT_PROTO*) ;;
12283                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12284                 esac
12285                 echo "Prototype: $try" ;;
12286         esac
12287         ;;
12288         *)      case "$usethreads" in
12289                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12290                 esac
12291                 d_ctime_r=undef
12292                 ctime_r_proto=0
12293                 ;;
12294         esac
12295         ;;
12296 *)      ctime_r_proto=0
12297         ;;
12298 esac
12299
12300 : see if cuserid exists
12301 set cuserid d_cuserid
12302 eval $inlibc
12303
12304 : see if this is a limits.h system
12305 set limits.h i_limits
12306 eval $inhdr
12307
12308 : See if number of significant digits in a double precision number is known
12309 echo " "
12310 $cat >dbl_dig.c <<EOM
12311 #$i_limits I_LIMITS
12312 #$i_float I_FLOAT
12313 #ifdef I_LIMITS
12314 #include <limits.h>
12315 #endif
12316 #ifdef I_FLOAT
12317 #include <float.h>
12318 #endif
12319 #ifdef DBL_DIG
12320 printf("Contains DBL_DIG");
12321 #endif
12322 EOM
12323 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
12324 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
12325         echo "DBL_DIG found." >&4
12326         val="$define"
12327 else
12328         echo "DBL_DIG NOT found." >&4
12329         val="$undef"
12330 fi
12331 $rm -f dbl_dig.?
12332 set d_dbl_dig
12333 eval $setvar
12334
12335 : see if dbm.h is available
12336 : see if dbmclose exists
12337 set dbmclose d_dbmclose
12338 eval $inlibc
12339
12340 case "$d_dbmclose" in
12341 $define)
12342         set dbm.h i_dbm
12343         eval $inhdr
12344         case "$i_dbm" in
12345         $define)
12346                 val="$undef"
12347                 set i_rpcsvcdbm
12348                 eval $setvar
12349                 ;;
12350         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12351                 eval $inhdr
12352                 ;;
12353         esac
12354         ;;
12355 *)      echo "We won't be including <dbm.h>"
12356         val="$undef"
12357         set i_dbm
12358         eval $setvar
12359         val="$undef"
12360         set i_rpcsvcdbm
12361         eval $setvar
12362         ;;
12363 esac
12364
12365 : see if prototype for dbminit is available
12366 echo " "
12367 set d_dbminitproto dbminit $i_dbm dbm.h
12368 eval $hasproto
12369
12370 : see if difftime exists
12371 set difftime d_difftime
12372 eval $inlibc
12373
12374 : see if this is a dirent system
12375 echo " "
12376 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12377         val="$define"
12378         echo "<dirent.h> found." >&4
12379 else
12380         val="$undef"
12381         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12382                 echo "<sys/dir.h> found." >&4
12383                 echo " "
12384         else
12385                 xinc=`./findhdr sys/ndir.h`
12386         fi
12387         echo "<dirent.h> NOT found." >&4
12388 fi
12389 set i_dirent
12390 eval $setvar
12391
12392 : Look for type of directory structure.
12393 echo " "
12394 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12395
12396 case "$direntrytype" in
12397 ''|' ')
12398         case "$i_dirent" in
12399         $define) guess1='struct dirent' ;;
12400         *) guess1='struct direct'  ;;
12401         esac
12402         ;;
12403 *)      guess1="$direntrytype"
12404         ;;
12405 esac
12406
12407 case "$guess1" in
12408 'struct dirent') guess2='struct direct' ;;
12409 *) guess2='struct dirent' ;;
12410 esac
12411
12412 if $contains "$guess1" try.c >/dev/null 2>&1; then
12413         direntrytype="$guess1"
12414         echo "Your directory entries are $direntrytype." >&4
12415 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12416         direntrytype="$guess2"
12417         echo "Your directory entries seem to be $direntrytype." >&4
12418 else
12419         echo "I don't recognize your system's directory entries." >&4
12420         rp="What type is used for directory entries on this system?"
12421         dflt="$guess1"
12422         . ./myread
12423         direntrytype="$ans"
12424 fi
12425 $rm_try
12426
12427 : see if the directory entry stores field length
12428 echo " "
12429 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12430 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12431         echo "Good, your directory entry keeps length information in d_namlen." >&4
12432         val="$define"
12433 else
12434         echo "Your directory entry does not know about the d_namlen field." >&4
12435         val="$undef"
12436 fi
12437 set d_dirnamlen
12438 eval $setvar
12439 $rm_try
12440
12441 : Look for DIR.dd_fd
12442 case "$i_dirent" in
12443 "$define")
12444     echo "Checking to see if DIR has a dd_fd member variable" >&4
12445     $cat >try.c <<EOCP
12446 #$i_stdlib I_STDLIB
12447 #ifdef I_STDLIB
12448 #include <stdlib.h>
12449 #endif
12450 #include <dirent.h>
12451
12452 int main() {
12453     DIR dir;
12454     dir.dd_fd = 1;
12455     return 0;
12456 }
12457 EOCP
12458     val=$undef
12459     set try
12460     if eval $compile; then
12461         echo "Yes, it does."
12462         val="$define"
12463     else
12464         echo "No, it does not."
12465         val="$undef"
12466     fi
12467     ;;
12468 *)
12469     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12470     val="$undef"
12471     ;;
12472 esac
12473 set d_dir_dd_fd
12474 eval $setvar
12475 $rm_try
12476
12477 : see if this is an sysdir system
12478 set sys/dir.h i_sysdir
12479 eval $inhdr
12480
12481 : see if this is an sysndir system
12482 set sys/ndir.h i_sysndir
12483 eval $inhdr
12484
12485 : Look for dirfd
12486 echo " "
12487 $cat >dirfd.c <<EOM
12488 #include <stdio.h>
12489 #$i_stdlib I_STDLIB
12490 #ifdef I_STDLIB
12491 #include <stdlib.h>
12492 #endif
12493 #$i_dirent I_DIRENT             /**/
12494 #$i_sysdir I_SYS_DIR            /**/
12495 #$i_sysndir I_SYS_NDIR          /**/
12496 #$i_systypes I_SYS_TYPES        /**/
12497 #if defined(I_SYS_TYPES)
12498 #include <sys/types.h>
12499 #endif
12500 #if defined(I_DIRENT)
12501 #include <dirent.h>
12502 #else
12503 #ifdef I_SYS_NDIR
12504 #include <sys/ndir.h>
12505 #else
12506 #ifdef I_SYS_DIR
12507 #ifdef hp9000s500
12508 #include <ndir.h>       /* may be wrong in the future */
12509 #else
12510 #include <sys/dir.h>
12511 #endif
12512 #endif
12513 #endif
12514 #endif
12515 int main() {
12516         DIR *dirp = opendir(".");
12517         if (dirfd(dirp) >= 0)
12518                 exit(0);
12519         else
12520                 exit(1);
12521 }
12522 EOM
12523 val=$undef
12524 set dirfd
12525 if eval $compile; then
12526         val="$define"
12527 fi
12528 case "$val" in
12529 $define)        echo "dirfd() found." >&4       ;;
12530 *)              echo "dirfd() NOT found." >&4   ;;
12531 esac
12532 set d_dirfd
12533 eval $setvar
12534 $rm -f dirfd*
12535
12536 : see if dladdr exists
12537 set dladdr d_dladdr
12538 eval $inlibc
12539
12540 : see if dlerror exists
12541 xxx_runnm="$runnm"
12542 runnm=false
12543 set dlerror d_dlerror
12544 eval $inlibc
12545 runnm="$xxx_runnm"
12546
12547 : see if dlfcn is available
12548 set dlfcn.h i_dlfcn
12549 eval $inhdr
12550
12551 : Check what extension to use for shared libs
12552 case "$usedl" in
12553 $define|y|true)
12554         $cat << EOM
12555
12556 On a few systems, the dynamically loaded modules that perl generates and uses
12557 will need a different extension than shared libs. The default will probably
12558 be appropriate.
12559
12560 EOM
12561         case "$dlext" in
12562         '')     dflt="$so" ;;
12563         *)      dflt="$dlext" ;;
12564         esac
12565         rp='What is the extension of dynamically loaded modules'
12566         . ./myread
12567         dlext="$ans"
12568         ;;
12569 *)
12570         dlext="none"
12571         ;;
12572 esac
12573
12574 : Check if dlsym need a leading underscore
12575 echo " "
12576 val="$undef"
12577
12578 case "$dlsrc" in
12579 dl_dlopen.xs)
12580         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12581         $cat >dyna.c <<'EOM'
12582 fred () { }
12583 EOM
12584
12585 $cat >fred.c<<EOM
12586
12587 #include <stdio.h>
12588 #$i_stdlib I_STDLIB
12589 #ifdef I_STDLIB
12590 #include <stdlib.h>
12591 #endif
12592 #$i_dlfcn I_DLFCN
12593 #ifdef I_DLFCN
12594 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12595 #else
12596 #include <sys/types.h>
12597 #include <nlist.h>
12598 #include <link.h>
12599 #endif
12600
12601 extern int fred() ;
12602
12603 int main()
12604 {
12605     void * handle ;
12606     void * symbol ;
12607 #ifndef RTLD_LAZY
12608     int mode = 1 ;
12609 #else
12610     int mode = RTLD_LAZY ;
12611 #endif
12612     handle = dlopen("./dyna.$dlext", mode) ;
12613     if (handle == NULL) {
12614         printf ("1\n") ;
12615         fflush (stdout) ;
12616         exit(0);
12617     }
12618     symbol = dlsym(handle, "fred") ;
12619     if (symbol == NULL) {
12620         /* try putting a leading underscore */
12621         symbol = dlsym(handle, "_fred") ;
12622         if (symbol == NULL) {
12623             printf ("2\n") ;
12624             fflush (stdout) ;
12625             exit(0);
12626         }
12627         printf ("3\n") ;
12628     }
12629     else
12630         printf ("4\n") ;
12631     fflush (stdout) ;
12632     exit(0);
12633 }
12634 EOM
12635         : Call the object file tmp-dyna.o in case dlext=o.
12636         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12637                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12638                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12639                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12640                 xxx=`$run ./fred`
12641                 case $xxx in
12642                 1)      echo "Test program failed using dlopen." >&4
12643                         echo "Perhaps you should not use dynamic loading." >&4;;
12644                 2)      echo "Test program failed using dlsym." >&4
12645                         echo "Perhaps you should not use dynamic loading." >&4;;
12646                 3)      echo "dlsym needs a leading underscore" >&4
12647                         val="$define" ;;
12648                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12649                 esac
12650         else
12651                 echo "I can't compile and run the test program." >&4
12652                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12653         fi
12654         ;;
12655 esac
12656
12657 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12658
12659 set d_dlsymun
12660 eval $setvar
12661
12662 : see if drand48_r exists
12663 set drand48_r d_drand48_r
12664 eval $inlibc
12665 case "$d_drand48_r" in
12666 "$define")
12667         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12668         case "$d_drand48_r_proto:$usethreads" in
12669         ":define")      d_drand48_r_proto=define
12670                 set d_drand48_r_proto drand48_r $hdrs
12671                 eval $hasproto ;;
12672         *)      ;;
12673         esac
12674         case "$d_drand48_r_proto" in
12675         define)
12676         case "$drand48_r_proto" in
12677         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12678         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12679         esac
12680         case "$drand48_r_proto" in
12681         ''|0)   d_drand48_r=undef
12682                 drand48_r_proto=0
12683                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12684         * )     case "$drand48_r_proto" in
12685                 REENTRANT_PROTO*) ;;
12686                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12687                 esac
12688                 echo "Prototype: $try" ;;
12689         esac
12690         ;;
12691         *)      case "$usethreads" in
12692                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12693                 esac
12694                 d_drand48_r=undef
12695                 drand48_r_proto=0
12696                 ;;
12697         esac
12698         ;;
12699 *)      drand48_r_proto=0
12700         ;;
12701 esac
12702
12703 : see if prototype for drand48 is available
12704 echo " "
12705 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12706 eval $hasproto
12707
12708 : see if dup2 exists
12709 set dup2 d_dup2
12710 eval $inlibc
12711
12712 : see if eaccess exists
12713 set eaccess d_eaccess
12714 eval $inlibc
12715
12716 : see if endgrent exists
12717 set endgrent d_endgrent
12718 eval $inlibc
12719
12720 : see if this is an grp system
12721 set grp.h i_grp
12722 eval $inhdr
12723
12724 case "$i_grp" in
12725 $define)
12726         xxx=`./findhdr grp.h`
12727         $cppstdin $cppflags $cppminus < $xxx >$$.h
12728
12729         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12730                 val="$define"
12731         else
12732                 val="$undef"
12733         fi
12734         set d_grpasswd
12735         eval $setvar
12736
12737         $rm -f $$.h
12738         ;;
12739 *)
12740         val="$undef";
12741         set d_grpasswd; eval $setvar
12742         ;;
12743 esac
12744
12745 : see if endgrent_r exists
12746 set endgrent_r d_endgrent_r
12747 eval $inlibc
12748 case "$d_endgrent_r" in
12749 "$define")
12750         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12751         case "$d_endgrent_r_proto:$usethreads" in
12752         ":define")      d_endgrent_r_proto=define
12753                 set d_endgrent_r_proto endgrent_r $hdrs
12754                 eval $hasproto ;;
12755         *)      ;;
12756         esac
12757         case "$d_endgrent_r_proto" in
12758         define)
12759         case "$endgrent_r_proto" in
12760         ''|0) try='int endgrent_r(FILE**);'
12761         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12762         esac
12763         case "$endgrent_r_proto" in
12764         ''|0) try='void endgrent_r(FILE**);'
12765         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12766         esac
12767         case "$endgrent_r_proto" in
12768         ''|0)   d_endgrent_r=undef
12769                 endgrent_r_proto=0
12770                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12771         * )     case "$endgrent_r_proto" in
12772                 REENTRANT_PROTO*) ;;
12773                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12774                 esac
12775                 echo "Prototype: $try" ;;
12776         esac
12777         ;;
12778         *)      case "$usethreads" in
12779                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12780                 esac
12781                 d_endgrent_r=undef
12782                 endgrent_r_proto=0
12783                 ;;
12784         esac
12785         ;;
12786 *)      endgrent_r_proto=0
12787         ;;
12788 esac
12789
12790 : see if endhostent exists
12791 set endhostent d_endhent
12792 eval $inlibc
12793
12794 : see if this is a netdb.h system
12795 set netdb.h i_netdb
12796 eval $inhdr
12797
12798 : see if endhostent_r exists
12799 set endhostent_r d_endhostent_r
12800 eval $inlibc
12801 case "$d_endhostent_r" in
12802 "$define")
12803         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12804         case "$d_endhostent_r_proto:$usethreads" in
12805         ":define")      d_endhostent_r_proto=define
12806                 set d_endhostent_r_proto endhostent_r $hdrs
12807                 eval $hasproto ;;
12808         *)      ;;
12809         esac
12810         case "$d_endhostent_r_proto" in
12811         define)
12812         case "$endhostent_r_proto" in
12813         ''|0) try='int endhostent_r(struct hostent_data*);'
12814         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12815         esac
12816         case "$endhostent_r_proto" in
12817         ''|0) try='void endhostent_r(struct hostent_data*);'
12818         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12819         esac
12820         case "$endhostent_r_proto" in
12821         ''|0)   d_endhostent_r=undef
12822                 endhostent_r_proto=0
12823                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12824         * )     case "$endhostent_r_proto" in
12825                 REENTRANT_PROTO*) ;;
12826                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12827                 esac
12828                 echo "Prototype: $try" ;;
12829         esac
12830         ;;
12831         *)      case "$usethreads" in
12832                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12833                 esac
12834                 d_endhostent_r=undef
12835                 endhostent_r_proto=0
12836                 ;;
12837         esac
12838         ;;
12839 *)      endhostent_r_proto=0
12840         ;;
12841 esac
12842
12843 : see if endnetent exists
12844 set endnetent d_endnent
12845 eval $inlibc
12846
12847 : see if endnetent_r exists
12848 set endnetent_r d_endnetent_r
12849 eval $inlibc
12850 case "$d_endnetent_r" in
12851 "$define")
12852         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12853         case "$d_endnetent_r_proto:$usethreads" in
12854         ":define")      d_endnetent_r_proto=define
12855                 set d_endnetent_r_proto endnetent_r $hdrs
12856                 eval $hasproto ;;
12857         *)      ;;
12858         esac
12859         case "$d_endnetent_r_proto" in
12860         define)
12861         case "$endnetent_r_proto" in
12862         ''|0) try='int endnetent_r(struct netent_data*);'
12863         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12864         esac
12865         case "$endnetent_r_proto" in
12866         ''|0) try='void endnetent_r(struct netent_data*);'
12867         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12868         esac
12869         case "$endnetent_r_proto" in
12870         ''|0)   d_endnetent_r=undef
12871                 endnetent_r_proto=0
12872                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12873         * )     case "$endnetent_r_proto" in
12874                 REENTRANT_PROTO*) ;;
12875                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12876                 esac
12877                 echo "Prototype: $try" ;;
12878         esac
12879         ;;
12880         *)      case "$usethreads" in
12881                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12882                 esac
12883                 d_endnetent_r=undef
12884                 endnetent_r_proto=0
12885                 ;;
12886         esac
12887         ;;
12888 *)      endnetent_r_proto=0
12889         ;;
12890 esac
12891
12892 : see if endprotoent exists
12893 set endprotoent d_endpent
12894 eval $inlibc
12895
12896 : see if endprotoent_r exists
12897 set endprotoent_r d_endprotoent_r
12898 eval $inlibc
12899 case "$d_endprotoent_r" in
12900 "$define")
12901         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12902         case "$d_endprotoent_r_proto:$usethreads" in
12903         ":define")      d_endprotoent_r_proto=define
12904                 set d_endprotoent_r_proto endprotoent_r $hdrs
12905                 eval $hasproto ;;
12906         *)      ;;
12907         esac
12908         case "$d_endprotoent_r_proto" in
12909         define)
12910         case "$endprotoent_r_proto" in
12911         ''|0) try='int endprotoent_r(struct protoent_data*);'
12912         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12913         esac
12914         case "$endprotoent_r_proto" in
12915         ''|0) try='void endprotoent_r(struct protoent_data*);'
12916         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12917         esac
12918         case "$endprotoent_r_proto" in
12919         ''|0)   d_endprotoent_r=undef
12920                 endprotoent_r_proto=0
12921                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12922         * )     case "$endprotoent_r_proto" in
12923                 REENTRANT_PROTO*) ;;
12924                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12925                 esac
12926                 echo "Prototype: $try" ;;
12927         esac
12928         ;;
12929         *)      case "$usethreads" in
12930                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12931                 esac
12932                 d_endprotoent_r=undef
12933                 endprotoent_r_proto=0
12934                 ;;
12935         esac
12936         ;;
12937 *)      endprotoent_r_proto=0
12938         ;;
12939 esac
12940
12941 : see if endpwent exists
12942 set endpwent d_endpwent
12943 eval $inlibc
12944
12945 : see if this is a pwd.h system
12946 set pwd.h i_pwd
12947 eval $inhdr
12948
12949 case "$i_pwd" in
12950 $define)
12951         xxx=`./findhdr pwd.h`
12952         $cppstdin $cppflags $cppminus < $xxx >$$.h
12953
12954         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12955                 val="$define"
12956         else
12957                 val="$undef"
12958         fi
12959         set d_pwquota
12960         eval $setvar
12961
12962         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12963                 val="$define"
12964         else
12965                 val="$undef"
12966         fi
12967         set d_pwage
12968         eval $setvar
12969
12970         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12971                 val="$define"
12972         else
12973                 val="$undef"
12974         fi
12975         set d_pwchange
12976         eval $setvar
12977
12978         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12979                 val="$define"
12980         else
12981                 val="$undef"
12982         fi
12983         set d_pwclass
12984         eval $setvar
12985
12986         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12987                 val="$define"
12988         else
12989                 val="$undef"
12990         fi
12991         set d_pwexpire
12992         eval $setvar
12993
12994         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12995                 val="$define"
12996         else
12997                 val="$undef"
12998         fi
12999         set d_pwcomment
13000         eval $setvar
13001
13002         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
13003                 val="$define"
13004         else
13005                 val="$undef"
13006         fi
13007         set d_pwgecos
13008         eval $setvar
13009
13010         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
13011                 val="$define"
13012         else
13013                 val="$undef"
13014         fi
13015         set d_pwpasswd
13016         eval $setvar
13017
13018         $rm -f $$.h
13019         ;;
13020 *)
13021         val="$undef";
13022         set d_pwquota; eval $setvar
13023         set d_pwage; eval $setvar
13024         set d_pwchange; eval $setvar
13025         set d_pwclass; eval $setvar
13026         set d_pwexpire; eval $setvar
13027         set d_pwcomment; eval $setvar
13028         set d_pwgecos; eval $setvar
13029         set d_pwpasswd; eval $setvar
13030         ;;
13031 esac
13032
13033 : see if endpwent_r exists
13034 set endpwent_r d_endpwent_r
13035 eval $inlibc
13036 case "$d_endpwent_r" in
13037 "$define")
13038         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13039         case "$d_endpwent_r_proto:$usethreads" in
13040         ":define")      d_endpwent_r_proto=define
13041                 set d_endpwent_r_proto endpwent_r $hdrs
13042                 eval $hasproto ;;
13043         *)      ;;
13044         esac
13045         case "$d_endpwent_r_proto" in
13046         define)
13047         case "$endpwent_r_proto" in
13048         ''|0) try='int endpwent_r(FILE**);'
13049         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13050         esac
13051         case "$endpwent_r_proto" in
13052         ''|0) try='void endpwent_r(FILE**);'
13053         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13054         esac
13055         case "$endpwent_r_proto" in
13056         ''|0)   d_endpwent_r=undef
13057                 endpwent_r_proto=0
13058                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13059         * )     case "$endpwent_r_proto" in
13060                 REENTRANT_PROTO*) ;;
13061                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13062                 esac
13063                 echo "Prototype: $try" ;;
13064         esac
13065         ;;
13066         *)      case "$usethreads" in
13067                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13068                 esac
13069                 d_endpwent_r=undef
13070                 endpwent_r_proto=0
13071                 ;;
13072         esac
13073         ;;
13074 *)      endpwent_r_proto=0
13075         ;;
13076 esac
13077
13078 : see if endservent exists
13079 set endservent d_endsent
13080 eval $inlibc
13081
13082 : see if endservent_r exists
13083 set endservent_r d_endservent_r
13084 eval $inlibc
13085 case "$d_endservent_r" in
13086 "$define")
13087         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13088         case "$d_endservent_r_proto:$usethreads" in
13089         ":define")      d_endservent_r_proto=define
13090                 set d_endservent_r_proto endservent_r $hdrs
13091                 eval $hasproto ;;
13092         *)      ;;
13093         esac
13094         case "$d_endservent_r_proto" in
13095         define)
13096         case "$endservent_r_proto" in
13097         ''|0) try='int endservent_r(struct servent_data*);'
13098         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13099         esac
13100         case "$endservent_r_proto" in
13101         ''|0) try='void endservent_r(struct servent_data*);'
13102         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13103         esac
13104         case "$endservent_r_proto" in
13105         ''|0)   d_endservent_r=undef
13106                 endservent_r_proto=0
13107                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13108         * )     case "$endservent_r_proto" in
13109                 REENTRANT_PROTO*) ;;
13110                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13111                 esac
13112                 echo "Prototype: $try" ;;
13113         esac
13114         ;;
13115         *)      case "$usethreads" in
13116                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13117                 esac
13118                 d_endservent_r=undef
13119                 endservent_r_proto=0
13120                 ;;
13121         esac
13122         ;;
13123 *)      endservent_r_proto=0
13124         ;;
13125 esac
13126
13127 : Locate the flags for 'open()'
13128 echo " "
13129 $cat >try.c <<EOCP
13130 #include <sys/types.h>
13131 #ifdef I_FCNTL
13132 #include <fcntl.h>
13133 #endif
13134 #ifdef I_SYS_FILE
13135 #include <sys/file.h>
13136 #endif
13137 #$i_stdlib I_STDLIB
13138 #ifdef I_STDLIB
13139 #include <stdlib.h>
13140 #endif
13141 int main() {
13142         if(O_RDONLY);
13143 #ifdef O_TRUNC
13144         exit(0);
13145 #else
13146         exit(1);
13147 #endif
13148 }
13149 EOCP
13150 : check sys/file.h first to get FREAD on Sun
13151 if $test `./findhdr sys/file.h` && \
13152                 set try -DI_SYS_FILE && eval $compile; then
13153         h_sysfile=true;
13154         echo "<sys/file.h> defines the O_* constants..." >&4
13155         if $run ./try; then
13156                 echo "and you have the 3 argument form of open()." >&4
13157                 val="$define"
13158         else
13159                 echo "but not the 3 argument form of open().  Oh, well." >&4
13160                 val="$undef"
13161         fi
13162 elif $test `./findhdr fcntl.h` && \
13163                 set try -DI_FCNTL && eval $compile; then
13164         h_fcntl=true;
13165         echo "<fcntl.h> defines the O_* constants..." >&4
13166         if $run ./try; then
13167                 echo "and you have the 3 argument form of open()." >&4
13168                 val="$define"
13169         else
13170                 echo "but not the 3 argument form of open().  Oh, well." >&4
13171                 val="$undef"
13172         fi
13173 else
13174         val="$undef"
13175         echo "I can't find the O_* constant definitions!  You got problems." >&4
13176 fi
13177 set d_open3
13178 eval $setvar
13179 $rm_try
13180
13181 : see if this is a sys/file.h system
13182 val=''
13183 set sys/file.h val
13184 eval $inhdr
13185
13186 : do we need to include sys/file.h ?
13187 case "$val" in
13188 "$define")
13189         echo " "
13190         if $h_sysfile; then
13191                 val="$define"
13192                 echo "We'll be including <sys/file.h>." >&4
13193         else
13194                 val="$undef"
13195                 echo "We won't be including <sys/file.h>." >&4
13196         fi
13197         ;;
13198 *)
13199         h_sysfile=false
13200         ;;
13201 esac
13202 set i_sysfile
13203 eval $setvar
13204
13205 : see if fcntl.h is there
13206 val=''
13207 set fcntl.h val
13208 eval $inhdr
13209
13210 : see if we can include fcntl.h
13211 case "$val" in
13212 "$define")
13213         echo " "
13214         if $h_fcntl; then
13215                 val="$define"
13216                 echo "We'll be including <fcntl.h>." >&4
13217         else
13218                 val="$undef"
13219                 if $h_sysfile; then
13220         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13221                 else
13222                         echo "We won't be including <fcntl.h>." >&4
13223                 fi
13224         fi
13225         ;;
13226 *)
13227         h_fcntl=false
13228         val="$undef"
13229         ;;
13230 esac
13231 set i_fcntl
13232 eval $setvar
13233
13234 : see if fork exists
13235 set fork d_fork
13236 eval $inlibc
13237
13238 : see if pipe exists
13239 set pipe d_pipe
13240 eval $inlibc
13241
13242 : check for non-blocking I/O stuff
13243 case "$h_sysfile" in
13244 true) echo "#include <sys/file.h>" > head.c;;
13245 *)
13246        case "$h_fcntl" in
13247        true) echo "#include <fcntl.h>" > head.c;;
13248        *) echo "#include <sys/fcntl.h>" > head.c;;
13249        esac
13250        ;;
13251 esac
13252 echo " "
13253 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13254 case "$o_nonblock" in
13255 '')
13256         $cat head.c > try.c
13257         $cat >>try.c <<EOCP
13258 #include <stdio.h>
13259 #$i_stdlib I_STDLIB
13260 #ifdef I_STDLIB
13261 #include <stdlib.h>
13262 #endif
13263 #$i_fcntl I_FCNTL
13264 #ifdef I_FCNTL
13265 #include <fcntl.h>
13266 #endif
13267 int main() {
13268 #ifdef O_NONBLOCK
13269         printf("O_NONBLOCK\n");
13270         exit(0);
13271 #endif
13272 #ifdef O_NDELAY
13273         printf("O_NDELAY\n");
13274         exit(0);
13275 #endif
13276 #ifdef FNDELAY
13277         printf("FNDELAY\n");
13278         exit(0);
13279 #endif
13280         exit(0);
13281 }
13282 EOCP
13283         set try
13284         if eval $compile_ok; then
13285                 o_nonblock=`$run ./try`
13286                 case "$o_nonblock" in
13287                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13288                 *) echo "Seems like we can use $o_nonblock.";;
13289                 esac
13290         else
13291                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13292         fi
13293         ;;
13294 *) echo "Using $hint value $o_nonblock.";;
13295 esac
13296 $rm_try
13297
13298 echo " "
13299 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13300 case "$eagain" in
13301 '')
13302         case "$d_fork:$d_pipe" in
13303         define:define)
13304         $cat head.c > try.c
13305         $cat >>try.c <<EOCP
13306 #include <errno.h>
13307 #include <sys/types.h>
13308 #include <signal.h>
13309 #include <stdio.h>
13310 #$i_stdlib I_STDLIB
13311 #ifdef I_STDLIB
13312 #include <stdlib.h>
13313 #endif
13314 #$i_fcntl I_FCNTL
13315 #ifdef I_FCNTL
13316 #include <fcntl.h>
13317 #endif
13318 #define MY_O_NONBLOCK $o_nonblock
13319 #ifndef errno  /* XXX need better Configure test */
13320 extern int errno;
13321 #endif
13322 #$i_unistd I_UNISTD
13323 #ifdef I_UNISTD
13324 #include <unistd.h>
13325 #endif
13326 #$i_string I_STRING
13327 #ifdef I_STRING
13328 #include <string.h>
13329 #else
13330 #include <strings.h>
13331 #endif
13332 $signal_t blech(int x) { exit(3); }
13333 EOCP
13334         $cat >> try.c <<'EOCP'
13335 int main()
13336 {
13337         int pd[2];
13338         int pu[2];
13339         char buf[1];
13340         char string[100];
13341         int ret;
13342
13343         ret = pipe(pd); /* Down: child -> parent */
13344         if (ret != 0)
13345                 exit(3);
13346         ret = pipe(pu); /* Up: parent -> child */
13347         if (ret != 0)
13348                 exit(3);
13349         if (0 != fork()) {
13350                 close(pd[1]);   /* Parent reads from pd[0] */
13351                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13352 #ifdef F_SETFL
13353                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13354                         exit(1);
13355 #else
13356                 exit(4);
13357 #endif
13358                 signal(SIGALRM, blech);
13359                 alarm(5);
13360                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13361                         exit(2);
13362                 sprintf(string, "%d\n", ret);
13363                 ret = write(2, string, strlen(string));
13364                 if (ret != strlen(string))
13365                         exit(3);
13366                 alarm(0);
13367 #ifdef EAGAIN
13368                 if (errno == EAGAIN) {
13369                         printf("EAGAIN\n");
13370                         goto ok;
13371                 }
13372 #endif
13373 #ifdef EWOULDBLOCK
13374                 if (errno == EWOULDBLOCK)
13375                         printf("EWOULDBLOCK\n");
13376 #endif
13377         ok:
13378                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13379                 if (ret != 1)
13380                         exit(3);
13381                 sleep(2);                               /* Give it time to close our pipe */
13382                 alarm(5);
13383                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13384                 alarm(0);
13385                 sprintf(string, "%d\n", ret);
13386                 ret = write(4, string, strlen(string));
13387                 if (ret != strlen(string))
13388                         exit(3);
13389                 exit(0);
13390         }
13391
13392         close(pd[0]);                   /* We write to pd[1] */
13393         close(pu[1]);                   /* We read from pu[0] */
13394         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13395         if (ret != 1)
13396                 exit(3);
13397         close(pd[1]);                   /* Pipe pd is now fully closed! */
13398         exit(0);                                /* Bye bye, thank you for playing! */
13399 }
13400 EOCP
13401         set try
13402         if eval $compile_ok; then
13403                 echo "$startsh" >mtry
13404                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13405                 chmod +x mtry
13406                 $run ./mtry >/dev/null 2>&1
13407                 case $? in
13408                 0) eagain=`$cat try.out`;;
13409                 1) echo "Could not perform non-blocking setting!";;
13410                 2) echo "I did a successful read() for something that was not there!";;
13411                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13412                 4) echo "Could not find F_SETFL!";;
13413                 *) echo "Something terribly wrong happened during testing.";;
13414                 esac
13415                 rd_nodata=`$cat try.ret`
13416                 echo "A read() system call with no data present returns $rd_nodata."
13417                 case "$rd_nodata" in
13418                 0|-1) ;;
13419                 *)
13420                         echo "(That's peculiar, fixing that to be -1.)"
13421                         rd_nodata=-1
13422                         ;;
13423                 esac
13424                 case "$eagain" in
13425                 '')
13426                         echo "Forcing errno EAGAIN on read() with no data available."
13427                         eagain=EAGAIN
13428                         ;;
13429                 *)
13430                         echo "Your read() sets errno to $eagain when no data is available."
13431                         ;;
13432                 esac
13433                 status=`$cat try.err`
13434                 case "$status" in
13435                 0) echo "And it correctly returns 0 to signal EOF.";;
13436                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13437                 *) echo "However, your read() returns '$status' on EOF??";;
13438                 esac
13439                 val="$define"
13440                 if test "$status" = "$rd_nodata"; then
13441                         echo "WARNING: you can't distinguish between EOF and no data!"
13442                         val="$undef"
13443                 fi
13444         else
13445                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13446                 eagain=EAGAIN
13447         fi
13448         ;;
13449         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13450                 eagain=EAGAIN
13451                 val="$define"
13452                 ;;
13453         esac
13454         set d_eofnblk
13455         eval $setvar
13456         ;;
13457 *)
13458         echo "Using $hint value $eagain."
13459         echo "Your read() returns $rd_nodata when no data is present."
13460         case "$d_eofnblk" in
13461         "$define") echo "And you can see EOF because read() returns 0.";;
13462         "$undef") echo "But you can't see EOF status from read() returned value.";;
13463         *)
13464                 echo "(Assuming you can't see EOF status from read anyway.)"
13465                 d_eofnblk=$undef
13466                 ;;
13467         esac
13468         ;;
13469 esac
13470 $rm_try head.c mtry
13471
13472 : see if erf exists
13473 set erf d_erf
13474 eval $inlibc
13475
13476 : see if erfc exists
13477 set erfc d_erfc
13478 eval $inlibc
13479
13480 : see if exp2 exists
13481 set exp2 d_exp2
13482 eval $inlibc
13483
13484 : see if expm1 exists
13485 set expm1 d_expm1
13486 eval $inlibc
13487
13488 : see if _ptr and _cnt from stdio act std
13489 echo " "
13490
13491 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13492         echo "(Looks like you have stdio.h from BSD.)"
13493         case "$stdio_ptr" in
13494         '') stdio_ptr='((fp)->_p)'
13495                 ptr_lval=$define
13496                 ;;
13497         *)      ptr_lval=$d_stdio_ptr_lval;;
13498         esac
13499         case "$stdio_cnt" in
13500         '') stdio_cnt='((fp)->_r)'
13501                 cnt_lval=$define
13502                 ;;
13503         *)      cnt_lval=$d_stdio_cnt_lval;;
13504         esac
13505         case "$stdio_base" in
13506         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13507         esac
13508         case "$stdio_bufsiz" in
13509         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13510         esac
13511 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13512         echo "(Looks like you have stdio.h from Linux.)"
13513         case "$stdio_ptr" in
13514         '') stdio_ptr='((fp)->_IO_read_ptr)'
13515                 ptr_lval=$define
13516                 ;;
13517         *)      ptr_lval=$d_stdio_ptr_lval;;
13518         esac
13519         case "$stdio_cnt" in
13520         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13521                 cnt_lval=$undef
13522                 ;;
13523         *)      cnt_lval=$d_stdio_cnt_lval;;
13524         esac
13525         case "$stdio_base" in
13526         '') stdio_base='((fp)->_IO_read_base)';;
13527         esac
13528         case "$stdio_bufsiz" in
13529         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13530         esac
13531 else
13532         case "$stdio_ptr" in
13533         '') stdio_ptr='((fp)->_ptr)'
13534                 ptr_lval=$define
13535                 ;;
13536         *)      ptr_lval=$d_stdio_ptr_lval;;
13537         esac
13538         case "$stdio_cnt" in
13539         '') stdio_cnt='((fp)->_cnt)'
13540                 cnt_lval=$define
13541                 ;;
13542         *)      cnt_lval=$d_stdio_cnt_lval;;
13543         esac
13544         case "$stdio_base" in
13545         '') stdio_base='((fp)->_base)';;
13546         esac
13547         case "$stdio_bufsiz" in
13548         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13549         esac
13550 fi
13551
13552 : test whether _ptr and _cnt really work
13553 echo "Checking how std your stdio is..." >&4
13554 $cat >try.c <<EOP
13555 #include <stdio.h>
13556 #$i_stdlib I_STDLIB
13557 #ifdef I_STDLIB
13558 #include <stdlib.h>
13559 #endif
13560 #define FILE_ptr(fp)    $stdio_ptr
13561 #define FILE_cnt(fp)    $stdio_cnt
13562 int main() {
13563         FILE *fp = fopen("try.c", "r");
13564         char c = getc(fp);
13565         if (
13566                 18 <= FILE_cnt(fp) &&
13567                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13568         )
13569                 exit(0);
13570         exit(1);
13571 }
13572 EOP
13573 val="$undef"
13574 set try
13575 if eval $compile && $to try.c; then
13576         if $run ./try; then
13577                 echo "Your stdio acts pretty std."
13578                 val="$define"
13579         else
13580                 echo "Your stdio isn't very std."
13581         fi
13582 else
13583         echo "Your stdio doesn't appear very std."
13584 fi
13585 $rm_try
13586
13587 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13588 # direct buffer manipulation no longer works.  The Configure tests
13589 # should be changed to correctly detect this, but until then,
13590 # the following check should at least let perl compile and run.
13591 # (This quick fix should be updated before 5.8.1.)
13592 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13593 # A. Dougherty, June 3, 2002.
13594 case "$d_gnulibc" in
13595 $define)
13596         case "$gnulibc_version" in
13597         2.[01]*)  ;;
13598         2.2) ;;
13599         2.2.[0-9]) ;;
13600         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13601                 val="$undef"
13602                 ;;
13603         esac
13604         ;;
13605 esac
13606 set d_stdstdio
13607 eval $setvar
13608
13609 : Can _ptr be used as an lvalue?
13610 case "$d_stdstdio$ptr_lval" in
13611 $define$define) val=$define ;;
13612 *) val=$undef ;;
13613 esac
13614 set d_stdio_ptr_lval
13615 eval $setvar
13616
13617 : Can _cnt be used as an lvalue?
13618 case "$d_stdstdio$cnt_lval" in
13619 $define$define) val=$define ;;
13620 *) val=$undef ;;
13621 esac
13622 set d_stdio_cnt_lval
13623 eval $setvar
13624
13625
13626 : test whether setting _ptr sets _cnt as a side effect
13627 d_stdio_ptr_lval_sets_cnt="$undef"
13628 d_stdio_ptr_lval_nochange_cnt="$undef"
13629 case "$d_stdio_ptr_lval$d_stdstdio" in
13630 $define$define)
13631         echo "Checking to see what happens if we set the stdio ptr..." >&4
13632 $cat >try.c <<EOP
13633 #include <stdio.h>
13634 /* Can we scream? */
13635 /* Eat dust sed :-) */
13636 /* In the buffer space, no one can hear you scream. */
13637 #$i_stdlib I_STDLIB
13638 #ifdef I_STDLIB
13639 #include <stdlib.h>
13640 #endif
13641 #define FILE_ptr(fp)    $stdio_ptr
13642 #define FILE_cnt(fp)    $stdio_cnt
13643 #include <sys/types.h>
13644 int main() {
13645         FILE *fp = fopen("try.c", "r");
13646         int c;
13647         char *ptr;
13648         size_t cnt;
13649         if (!fp) {
13650             puts("Fail even to read");
13651             exit(1);
13652         }
13653         c = getc(fp); /* Read away the first # */
13654         if (c == EOF) {
13655             puts("Fail even to read");
13656             exit(1);
13657         }
13658         if (!(
13659                 18 <= FILE_cnt(fp) &&
13660                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13661         )) {
13662                 puts("Fail even to read");
13663                 exit (1);
13664         }
13665         ptr = (char*) FILE_ptr(fp);
13666         cnt = (size_t)FILE_cnt(fp);
13667
13668         FILE_ptr(fp) += 42;
13669
13670         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13671                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13672                 exit (1);
13673         }
13674         if (FILE_cnt(fp) <= 20) {
13675                 printf ("Fail (<20 chars to test)");
13676                 exit (1);
13677         }
13678         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13679                 puts("Fail compare");
13680                 exit (1);
13681         }
13682         if (cnt == FILE_cnt(fp)) {
13683                 puts("Pass_unchanged");
13684                 exit (0);
13685         }
13686         if (FILE_cnt(fp) == (cnt - 42)) {
13687                 puts("Pass_changed");
13688                 exit (0);
13689         }
13690         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13691         return 1;
13692
13693 }
13694 EOP
13695         set try
13696         if eval $compile && $to try.c; then
13697                 case `$run ./try` in
13698                 Pass_changed)
13699                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13700                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13701                 Pass_unchanged)
13702                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13703                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13704                 Fail*)
13705                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13706                 *)
13707                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13708         esac
13709         else
13710                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13711         fi
13712         $rm_try
13713         ;;
13714 esac
13715
13716 : see if _base is also standard
13717 val="$undef"
13718 case "$d_stdstdio" in
13719 $define)
13720         $cat >try.c <<EOP
13721 #include <stdio.h>
13722 #$i_stdlib I_STDLIB
13723 #ifdef I_STDLIB
13724 #include <stdlib.h>
13725 #endif
13726 #define FILE_base(fp)   $stdio_base
13727 #define FILE_bufsiz(fp) $stdio_bufsiz
13728 int main() {
13729         FILE *fp = fopen("try.c", "r");
13730         char c = getc(fp);
13731         if (
13732                 19 <= FILE_bufsiz(fp) &&
13733                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13734         )
13735                 exit(0);
13736         exit(1);
13737 }
13738 EOP
13739         set try
13740         if eval $compile && $to try.c; then
13741                 if $run ./try; then
13742                         echo "And its _base field acts std."
13743                         val="$define"
13744                 else
13745                         echo "But its _base field isn't std."
13746                 fi
13747         else
13748                 echo "However, it seems to be lacking the _base field."
13749         fi
13750         $rm_try
13751         ;;
13752 esac
13753 set d_stdiobase
13754 eval $setvar
13755
13756 : see if fast_stdio exists
13757 val="$undef"
13758 case "$d_stdstdio:$d_stdio_ptr_lval" in
13759 "$define:$define")
13760         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13761         *$define*)
13762                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13763                 val="$define"
13764                 ;;
13765         esac
13766         ;;
13767 esac
13768 set d_faststdio
13769 eval $setvar
13770
13771
13772
13773 : see if fchdir exists
13774 set fchdir d_fchdir
13775 eval $inlibc
13776
13777 : see if fchmod exists
13778 set fchmod d_fchmod
13779 eval $inlibc
13780
13781 : see if fchown exists
13782 set fchown d_fchown
13783 eval $inlibc
13784
13785 : see if this is an fcntl system
13786 set fcntl d_fcntl
13787 eval $inlibc
13788
13789 : See if fcntl-based locking works.
13790 echo " "
13791 $cat >try.c <<EOCP
13792 #$i_stdlib I_STDLIB
13793 #ifdef I_STDLIB
13794 #include <stdlib.h>
13795 #endif
13796 #include <unistd.h>
13797 #include <fcntl.h>
13798 #include <signal.h>
13799 $signal_t blech(int x) { exit(3); }
13800 int main() {
13801 #if defined(F_SETLK) && defined(F_SETLKW)
13802      struct flock flock;
13803      int retval, fd;
13804      fd = open("try.c", O_RDONLY);
13805      flock.l_type = F_RDLCK;
13806      flock.l_whence = SEEK_SET;
13807      flock.l_start = flock.l_len = 0;
13808      signal(SIGALRM, blech);
13809      alarm(10);
13810      retval = fcntl(fd, F_SETLK, &flock);
13811      close(fd);
13812      (retval < 0 ? exit(2) : exit(0));
13813 #else
13814      exit(2);
13815 #endif
13816 }
13817 EOCP
13818 echo "Checking if fcntl-based file locking works... "
13819 case "$d_fcntl" in
13820 "$define")
13821         set try
13822         if eval $compile_ok; then
13823                 if $run ./try; then
13824                         echo "Yes, it seems to work."
13825                         val="$define"
13826                 else
13827                         echo "Nope, it didn't work."
13828                         val="$undef"
13829                         case "$?" in
13830                         3) $cat >&4 <<EOM
13831 ***
13832 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13833 *** This is (almost) impossible.
13834 *** If your NFS lock daemons are not feeling well, something like
13835 *** this may happen, please investigate.  Cannot continue, aborting.
13836 ***
13837 EOM
13838                                 exit 1
13839                                 ;;
13840                         esac
13841                 fi
13842         else
13843                 echo "I'm unable to compile the test program, so I'll assume not."
13844                 val="$undef"
13845         fi
13846         ;;
13847 *) val="$undef";
13848         echo "Nope, since you don't even have fcntl()."
13849         ;;
13850 esac
13851 set d_fcntl_can_lock
13852 eval $setvar
13853 $rm_try
13854
13855 : check for fd_set items
13856 $cat <<EOM
13857
13858 Checking to see how well your C compiler handles fd_set and friends ...
13859 EOM
13860 $cat >try.c <<EOCP
13861 #$i_stdlib I_STDLIB
13862 #ifdef I_STDLIB
13863 #include <stdlib.h>
13864 #endif
13865 #$i_systime I_SYS_TIME
13866 #$i_sysselct I_SYS_SELECT
13867 #$d_socket HAS_SOCKET
13868 #include <sys/types.h>
13869 #ifdef HAS_SOCKET
13870 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13871 #endif
13872 #ifdef I_SYS_TIME
13873 #include <sys/time.h>
13874 #endif
13875 #ifdef I_SYS_SELECT
13876 #include <sys/select.h>
13877 #endif
13878 int main() {
13879         fd_set fds;
13880
13881 #ifdef TRYBITS
13882         if(fds.fds_bits);
13883 #endif
13884
13885 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13886         exit(0);
13887 #else
13888         exit(1);
13889 #endif
13890 }
13891 EOCP
13892 set try -DTRYBITS
13893 if eval $compile; then
13894         d_fds_bits="$define"
13895         d_fd_set="$define"
13896         echo "Well, your system knows about the normal fd_set typedef..." >&4
13897         if $run ./try; then
13898                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13899                 d_fd_macros="$define"
13900         else
13901                 $cat >&4 <<'EOM'
13902 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13903 EOM
13904                 d_fd_macros="$undef"
13905         fi
13906 else
13907         $cat <<'EOM'
13908 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13909 EOM
13910         set try
13911         if eval $compile; then
13912                 d_fds_bits="$undef"
13913                 d_fd_set="$define"
13914                 echo "Well, your system has some sort of fd_set available..." >&4
13915                 if $run ./try; then
13916                         echo "and you have the normal fd_set macros." >&4
13917                         d_fd_macros="$define"
13918                 else
13919                         $cat <<'EOM'
13920 but not the normal fd_set macros!  Gross!  More work for me...
13921 EOM
13922                         d_fd_macros="$undef"
13923                 fi
13924         else
13925         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13926                 d_fd_set="$undef"
13927                 d_fds_bits="$undef"
13928                 d_fd_macros="$undef"
13929         fi
13930 fi
13931 $rm_try
13932
13933 : see if fdim exists
13934 set fdim d_fdim
13935 eval $inlibc
13936
13937 : see if fegetround exists
13938 set fegetround d_fegetround
13939 eval $inlibc
13940
13941 : see if fgetpos exists
13942 set fgetpos d_fgetpos
13943 eval $inlibc
13944
13945 : see if finite exists
13946 set finite d_finite
13947 eval $inlibc
13948
13949 : see if finitel exists
13950 set finitel d_finitel
13951 eval $inlibc
13952
13953 : see if flock exists
13954 set flock d_flock
13955 eval $inlibc
13956
13957 : see if prototype for flock is available
13958 echo " "
13959 set d_flockproto flock $i_sysfile sys/file.h
13960 eval $hasproto
13961
13962 : see if fma exists
13963 set fma d_fma
13964 eval $inlibc
13965
13966 : see if fmax exists
13967 set fmax d_fmax
13968 eval $inlibc
13969
13970 : see if fmin exists
13971 set fmin d_fmin
13972 eval $inlibc
13973
13974 : see if fp_class exists
13975 set fp_class d_fp_class
13976 eval $inlibc
13977
13978 : see if this is a math.h system
13979 set math.h i_math
13980 eval $inhdr
13981
13982 : check for fpclassify
13983 echo "Checking to see if you have fpclassify..." >&4
13984 $cat >try.c <<EOCP
13985 #$i_math I_MATH
13986 #ifdef I_MATH
13987 #include <math.h>
13988 #endif
13989 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
13990 EOCP
13991 set try
13992 if eval $compile; then
13993         val="$define"
13994         echo "You have fpclassify."
13995 else
13996         val="$undef"
13997         echo "You do not have fpclassify."
13998 fi
13999 $rm_try
14000 set d_fpclassify
14001 eval $setvar
14002
14003 : see if fp_classify exists
14004 set fp_classify d_fp_classify
14005 eval $inlibc
14006
14007 : see if fp_classl exists
14008 set fp_classl d_fp_classl
14009 eval $inlibc
14010
14011 : see if pathconf exists
14012 set pathconf d_pathconf
14013 eval $inlibc
14014
14015 : see if fpathconf exists
14016 set fpathconf d_fpathconf
14017 eval $inlibc
14018
14019 : see if fpclass exists
14020 set fpclass d_fpclass
14021 eval $inlibc
14022
14023 : see if fpclassl exists
14024 set fpclassl d_fpclassl
14025 eval $inlibc
14026
14027 : see if fpgetround exists
14028 set fpgetround d_fpgetround
14029 eval $inlibc
14030
14031 : check for fpos64_t
14032 echo " "
14033 echo "Checking to see if you have fpos64_t..." >&4
14034 $cat >try.c <<EOCP
14035 #include <stdio.h>
14036 int main() { fpos64_t x = 7; }
14037 EOCP
14038 set try
14039 if eval $compile; then
14040         val="$define"
14041         echo "You have fpos64_t."
14042 else
14043         val="$undef"
14044         echo "You do not have fpos64_t."
14045         case "$fpossize" in
14046         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14047         esac
14048 fi
14049 $rm_try
14050 set d_fpos64_t
14051 eval $setvar
14052
14053 : see if frexpl exists
14054 set frexpl d_frexpl
14055 eval $inlibc
14056
14057 : see if this is a sys/param system
14058 set sys/param.h i_sysparam
14059 eval $inhdr
14060
14061 : see if this is a sys/mount.h system
14062 set sys/mount.h i_sysmount
14063 eval $inhdr
14064
14065 : Check for fs_data_s
14066 echo " "
14067 echo "Checking to see if your system supports struct fs_data..." >&4
14068 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14069 eval $hasstruct
14070 case "$d_fs_data_s" in
14071 "$define")      echo "Yes, it does."   ;;
14072 *)              echo "No, it doesn't." ;;
14073 esac
14074
14075 : see if fseeko exists
14076 set fseeko d_fseeko
14077 eval $inlibc
14078 case "$longsize" in
14079 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14080 esac
14081
14082 : see if fsetpos exists
14083 set fsetpos d_fsetpos
14084 eval $inlibc
14085
14086 : see if fstatfs exists
14087 set fstatfs d_fstatfs
14088 eval $inlibc
14089
14090 : see if statvfs exists
14091 set statvfs d_statvfs
14092 eval $inlibc
14093
14094 : see if fstatvfs exists
14095 set fstatvfs d_fstatvfs
14096 eval $inlibc
14097
14098
14099 : see if fsync exists
14100 set fsync d_fsync
14101 eval $inlibc
14102
14103 : see if ftello exists
14104 set ftello d_ftello
14105 eval $inlibc
14106 case "$longsize" in
14107 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14108 esac
14109
14110 : check for a working futimes
14111 d_futimes="$undef"
14112 echo " "
14113 echo "Checking if you have a working futimes()" >&4
14114 $cat >try.c <<EOCP
14115 #include <stdio.h>
14116 #include <sys/time.h>
14117 #include <errno.h>
14118 #include <fcntl.h>
14119
14120 int main ()
14121 {
14122     int fd, rv;
14123     fd = open ("try.c", O_RDWR);
14124     if (-1 == fd) exit (1);
14125     rv = futimes (fd, NULL);
14126     exit (rv == -1 ? errno : 0);
14127 }
14128 EOCP
14129 set try
14130 if eval $compile; then
14131     `$run ./try`
14132     rc=$?
14133     case "$rc" in
14134         0)  echo "Yes, you have" >&4
14135             d_futimes="$define"
14136             ;;
14137         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14138             ;;
14139     esac
14140 else
14141     echo "No, it does not (probably harmless)" >&4
14142 fi
14143 $rm_try
14144
14145 : see if ndbm.h is available
14146 set ndbm.h i_ndbm
14147 eval $inhdr
14148 : Compatibility location for RedHat 7.1
14149 set gdbm/ndbm.h i_gdbmndbm
14150 eval $inhdr
14151 : Compatibility location for Debian 4.0
14152 set gdbm-ndbm.h i_gdbm_ndbm
14153 eval $inhdr
14154
14155 val="$undef"
14156 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14157         : see if dbm_open exists
14158         set dbm_open d_dbm_open
14159         eval $inlibc
14160         case "$d_dbm_open" in
14161         $undef)
14162                 i_ndbm="$undef"
14163                 i_gdbmndbm="$undef"
14164                 i_gdbm_ndbm="$undef"
14165                 echo "We won't be including <ndbm.h>"
14166                 val="$undef"
14167                 ;;
14168         *) val="$define"
14169            ;;
14170         esac
14171 fi
14172 set d_ndbm
14173 eval $setvar
14174
14175 ndbm_hdr_protochk='name=$1; hdr=$2;
14176 eval "ihdr=\$""i_$name";
14177 val="$undef";
14178 if $test "$ihdr" = "$define"; then
14179         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14180         case "$d_cplusplus" in
14181         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14182         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14183         esac;
14184         case "$val" in
14185         $define) $echo "Your <$hdr> seems to have prototypes";;
14186         *) $echo "Your <$hdr> does not seem to have prototypes";;
14187         esac;
14188 fi;
14189 set "d_${name}_h_uses_prototypes";
14190 eval $setvar'
14191
14192 set ndbm ndbm.h
14193 eval $ndbm_hdr_protochk
14194 set gdbmndbm gdbm/ndbm.h
14195 eval $ndbm_hdr_protochk
14196 set gdbm_ndbm gdbm-ndbm.h
14197 eval $ndbm_hdr_protochk
14198
14199 : see if getaddrinfo exists
14200 set getaddrinfo d_getaddrinfo
14201 eval $inlibc
14202
14203 : see if getcwd exists
14204 set getcwd d_getcwd
14205 eval $inlibc
14206
14207 : see if getespwnam exists
14208 set getespwnam d_getespwnam
14209 eval $inlibc
14210
14211 : see if getfsstat exists
14212 set getfsstat d_getfsstat
14213 eval $inlibc
14214
14215 : see if getgrent exists
14216 set getgrent d_getgrent
14217 eval $inlibc
14218
14219 : see if getgrent_r exists
14220 set getgrent_r d_getgrent_r
14221 eval $inlibc
14222 case "$d_getgrent_r" in
14223 "$define")
14224         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14225         case "$d_getgrent_r_proto:$usethreads" in
14226         ":define")      d_getgrent_r_proto=define
14227                 set d_getgrent_r_proto getgrent_r $hdrs
14228                 eval $hasproto ;;
14229         *)      ;;
14230         esac
14231         case "$d_getgrent_r_proto" in
14232         define)
14233         case "$getgrent_r_proto" in
14234         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14235         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14236         esac
14237         case "$getgrent_r_proto" in
14238         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14239         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14240         esac
14241         case "$getgrent_r_proto" in
14242         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14243         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14244         esac
14245         case "$getgrent_r_proto" in
14246         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14247         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14248         esac
14249         case "$getgrent_r_proto" in
14250         ''|0) try='int getgrent_r(struct group*, char*, int);'
14251         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14252         esac
14253         case "$getgrent_r_proto" in
14254         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14255         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14256         esac
14257         case "$getgrent_r_proto" in
14258         ''|0)   d_getgrent_r=undef
14259                 getgrent_r_proto=0
14260                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14261         * )     case "$getgrent_r_proto" in
14262                 REENTRANT_PROTO*) ;;
14263                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14264                 esac
14265                 echo "Prototype: $try" ;;
14266         esac
14267         ;;
14268         *)      case "$usethreads" in
14269                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14270                 esac
14271                 d_getgrent_r=undef
14272                 getgrent_r_proto=0
14273                 ;;
14274         esac
14275         ;;
14276 *)      getgrent_r_proto=0
14277         ;;
14278 esac
14279
14280 : see if getgrgid_r exists
14281 set getgrgid_r d_getgrgid_r
14282 eval $inlibc
14283 case "$d_getgrgid_r" in
14284 "$define")
14285         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14286         case "$d_getgrgid_r_proto:$usethreads" in
14287         ":define")      d_getgrgid_r_proto=define
14288                 set d_getgrgid_r_proto getgrgid_r $hdrs
14289                 eval $hasproto ;;
14290         *)      ;;
14291         esac
14292         case "$d_getgrgid_r_proto" in
14293         define)
14294         case "$getgrgid_r_proto" in
14295         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14296         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14297         esac
14298         case "$getgrgid_r_proto" in
14299         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14300         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14301         esac
14302         case "$getgrgid_r_proto" in
14303         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14304         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14305         esac
14306         case "$getgrgid_r_proto" in
14307         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14308         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14309         esac
14310         case "$getgrgid_r_proto" in
14311         ''|0)   d_getgrgid_r=undef
14312                 getgrgid_r_proto=0
14313                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14314         * )     case "$getgrgid_r_proto" in
14315                 REENTRANT_PROTO*) ;;
14316                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14317                 esac
14318                 echo "Prototype: $try" ;;
14319         esac
14320         ;;
14321         *)      case "$usethreads" in
14322                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14323                 esac
14324                 d_getgrgid_r=undef
14325                 getgrgid_r_proto=0
14326                 ;;
14327         esac
14328         ;;
14329 *)      getgrgid_r_proto=0
14330         ;;
14331 esac
14332
14333 : see if getgrnam_r exists
14334 set getgrnam_r d_getgrnam_r
14335 eval $inlibc
14336 case "$d_getgrnam_r" in
14337 "$define")
14338         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14339         case "$d_getgrnam_r_proto:$usethreads" in
14340         ":define")      d_getgrnam_r_proto=define
14341                 set d_getgrnam_r_proto getgrnam_r $hdrs
14342                 eval $hasproto ;;
14343         *)      ;;
14344         esac
14345         case "$d_getgrnam_r_proto" in
14346         define)
14347         case "$getgrnam_r_proto" in
14348         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14349         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14350         esac
14351         case "$getgrnam_r_proto" in
14352         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14353         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14354         esac
14355         case "$getgrnam_r_proto" in
14356         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14357         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14358         esac
14359         case "$getgrnam_r_proto" in
14360         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14361         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14362         esac
14363         case "$getgrnam_r_proto" in
14364         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14365         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14366         esac
14367         case "$getgrnam_r_proto" in
14368         ''|0)   d_getgrnam_r=undef
14369                 getgrnam_r_proto=0
14370                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14371         * )     case "$getgrnam_r_proto" in
14372                 REENTRANT_PROTO*) ;;
14373                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14374                 esac
14375                 echo "Prototype: $try" ;;
14376         esac
14377         ;;
14378         *)      case "$usethreads" in
14379                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14380                 esac
14381                 d_getgrnam_r=undef
14382                 getgrnam_r_proto=0
14383                 ;;
14384         esac
14385         ;;
14386 *)      getgrnam_r_proto=0
14387         ;;
14388 esac
14389
14390 : see if gethostbyaddr exists
14391 set gethostbyaddr d_gethbyaddr
14392 eval $inlibc
14393
14394 : see if gethostbyname exists
14395 set gethostbyname d_gethbyname
14396 eval $inlibc
14397
14398 : see if gethostent exists
14399 set gethostent d_gethent
14400 eval $inlibc
14401
14402 : see how we will look up host name
14403 echo " "
14404 call=''
14405 if set gethostname val -f d_gethname; eval $csym; $val; then
14406         echo 'gethostname() found.' >&4
14407         d_gethname="$define"
14408         call=gethostname
14409 fi
14410 if set uname val -f d_uname; eval $csym; $val; then
14411         if ./xenix; then
14412                 $cat <<'EOM'
14413 uname() was found, but you're running xenix, and older versions of xenix
14414 have a broken uname(). If you don't really know whether your xenix is old
14415 enough to have a broken system call, use the default answer.
14416
14417 EOM
14418                 dflt=y
14419                 case "$d_uname" in
14420                 "$define") dflt=n;;
14421                 esac
14422                 rp='Is your uname() broken?'
14423                 . ./myread
14424                 case "$ans" in
14425                 n*) d_uname="$define"; call=uname;;
14426                 esac
14427         else
14428                 echo 'uname() found.' >&4
14429                 d_uname="$define"
14430                 case "$call" in
14431                 '') call=uname ;;
14432                 esac
14433         fi
14434 fi
14435 case "$d_gethname" in
14436 '') d_gethname="$undef";;
14437 esac
14438 case "$d_uname" in
14439 '') d_uname="$undef";;
14440 esac
14441 case "$d_uname$d_gethname" in
14442 *define*)
14443         dflt=n
14444         cat <<EOM
14445
14446 Every now and then someone has a $call() that lies about the hostname
14447 but can't be fixed for political or economic reasons.  If you wish, I can
14448 pretend $call() isn't there and maybe compute hostname at run-time
14449 thanks to the '$phostname' command.
14450
14451 EOM
14452         rp="Shall I ignore $call() from now on?"
14453         . ./myread
14454         case "$ans" in
14455         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14456         esac;;
14457 esac
14458 case "$phostname" in
14459 '') aphostname='';;
14460 *) case "$aphostname" in
14461         /*) ;;
14462         *) set X $phostname
14463                 shift
14464                 file=$1
14465                 shift
14466                 file=`./loc $file $file $pth`
14467                 aphostname=`echo $file $*`
14468                 ;;
14469         esac
14470         ;;
14471 esac
14472 case "$d_uname$d_gethname" in
14473 *define*) ;;
14474 *)
14475         case "$phostname" in
14476         '')
14477                 echo "There will be no way for $package to get your hostname." >&4;;
14478         *)
14479         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14480                 ;;
14481         esac;;
14482 esac
14483 case "$d_phostname" in
14484 '') d_phostname="$undef";;
14485 esac
14486
14487 : see if gethostbyaddr_r exists
14488 set gethostbyaddr_r d_gethostbyaddr_r
14489 eval $inlibc
14490 case "$d_gethostbyaddr_r" in
14491 "$define")
14492         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14493         case "$d_gethostbyaddr_r_proto:$usethreads" in
14494         ":define")      d_gethostbyaddr_r_proto=define
14495                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14496                 eval $hasproto ;;
14497         *)      ;;
14498         esac
14499         case "$d_gethostbyaddr_r_proto" in
14500         define)
14501         case "$gethostbyaddr_r_proto" in
14502         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14503         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14504         esac
14505         case "$gethostbyaddr_r_proto" in
14506         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14507         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14508         esac
14509         case "$gethostbyaddr_r_proto" in
14510         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14511         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14512         esac
14513         case "$gethostbyaddr_r_proto" in
14514         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14515         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14516         esac
14517         case "$gethostbyaddr_r_proto" in
14518         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14519         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14520         esac
14521         case "$gethostbyaddr_r_proto" in
14522         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14523         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14524         esac
14525         case "$gethostbyaddr_r_proto" in
14526         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14527         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14528         esac
14529         case "$gethostbyaddr_r_proto" in
14530         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14531         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14532         esac
14533         case "$gethostbyaddr_r_proto" in
14534         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14535         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14536         esac
14537         case "$gethostbyaddr_r_proto" in
14538         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14539         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14540         esac
14541         case "$gethostbyaddr_r_proto" in
14542         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14543         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14544         esac
14545         case "$gethostbyaddr_r_proto" in
14546         ''|0)   d_gethostbyaddr_r=undef
14547                 gethostbyaddr_r_proto=0
14548                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14549         * )     case "$gethostbyaddr_r_proto" in
14550                 REENTRANT_PROTO*) ;;
14551                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14552                 esac
14553                 echo "Prototype: $try" ;;
14554         esac
14555         ;;
14556         *)      case "$usethreads" in
14557                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14558                 esac
14559                 d_gethostbyaddr_r=undef
14560                 gethostbyaddr_r_proto=0
14561                 ;;
14562         esac
14563         ;;
14564 *)      gethostbyaddr_r_proto=0
14565         ;;
14566 esac
14567
14568 : see if gethostbyname_r exists
14569 set gethostbyname_r d_gethostbyname_r
14570 eval $inlibc
14571 case "$d_gethostbyname_r" in
14572 "$define")
14573         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14574         case "$d_gethostbyname_r_proto:$usethreads" in
14575         ":define")      d_gethostbyname_r_proto=define
14576                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14577                 eval $hasproto ;;
14578         *)      ;;
14579         esac
14580         case "$d_gethostbyname_r_proto" in
14581         define)
14582         case "$gethostbyname_r_proto" in
14583         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14584         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14585         esac
14586         case "$gethostbyname_r_proto" in
14587         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14588         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14589         esac
14590         case "$gethostbyname_r_proto" in
14591         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14592         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14593         esac
14594         case "$gethostbyname_r_proto" in
14595         ''|0)   d_gethostbyname_r=undef
14596                 gethostbyname_r_proto=0
14597                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14598         * )     case "$gethostbyname_r_proto" in
14599                 REENTRANT_PROTO*) ;;
14600                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14601                 esac
14602                 echo "Prototype: $try" ;;
14603         esac
14604         ;;
14605         *)      case "$usethreads" in
14606                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14607                 esac
14608                 d_gethostbyname_r=undef
14609                 gethostbyname_r_proto=0
14610                 ;;
14611         esac
14612         ;;
14613 *)      gethostbyname_r_proto=0
14614         ;;
14615 esac
14616
14617 : see if gethostent_r exists
14618 set gethostent_r d_gethostent_r
14619 eval $inlibc
14620 case "$d_gethostent_r" in
14621 "$define")
14622         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14623         case "$d_gethostent_r_proto:$usethreads" in
14624         ":define")      d_gethostent_r_proto=define
14625                 set d_gethostent_r_proto gethostent_r $hdrs
14626                 eval $hasproto ;;
14627         *)      ;;
14628         esac
14629         case "$d_gethostent_r_proto" in
14630         define)
14631         case "$gethostent_r_proto" in
14632         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14633         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14634         esac
14635         case "$gethostent_r_proto" in
14636         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14637         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14638         esac
14639         case "$gethostent_r_proto" in
14640         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14641         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14642         esac
14643         case "$gethostent_r_proto" in
14644         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14645         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14646         esac
14647         case "$gethostent_r_proto" in
14648         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14649         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14650         esac
14651         case "$gethostent_r_proto" in
14652         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14653         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14654         esac
14655         case "$gethostent_r_proto" in
14656         ''|0)   d_gethostent_r=undef
14657                 gethostent_r_proto=0
14658                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14659         * )     case "$gethostent_r_proto" in
14660                 REENTRANT_PROTO*) ;;
14661                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14662                 esac
14663                 echo "Prototype: $try" ;;
14664         esac
14665         ;;
14666         *)      case "$usethreads" in
14667                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14668                 esac
14669                 d_gethostent_r=undef
14670                 gethostent_r_proto=0
14671                 ;;
14672         esac
14673         ;;
14674 *)      gethostent_r_proto=0
14675         ;;
14676 esac
14677
14678 : see if prototypes for various gethostxxx netdb.h functions are available
14679 echo " "
14680 set d_gethostprotos gethostent $i_netdb netdb.h
14681 eval $hasproto
14682
14683 : see if getitimer exists
14684 set getitimer d_getitimer
14685 eval $inlibc
14686
14687 : see if getlogin exists
14688 set getlogin d_getlogin
14689 eval $inlibc
14690
14691 : see if getlogin_r exists
14692 set getlogin_r d_getlogin_r
14693 eval $inlibc
14694 case "$d_getlogin_r" in
14695 "$define")
14696         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14697         case "$d_getlogin_r_proto:$usethreads" in
14698         ":define")      d_getlogin_r_proto=define
14699                 set d_getlogin_r_proto getlogin_r $hdrs
14700                 eval $hasproto ;;
14701         *)      ;;
14702         esac
14703         case "$d_getlogin_r_proto" in
14704         define)
14705         case "$getlogin_r_proto" in
14706         ''|0) try='int getlogin_r(char*, size_t);'
14707         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14708         esac
14709         case "$getlogin_r_proto" in
14710         ''|0) try='int getlogin_r(char*, int);'
14711         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14712         esac
14713         case "$getlogin_r_proto" in
14714         ''|0) try='char* getlogin_r(char*, size_t);'
14715         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14716         esac
14717         case "$getlogin_r_proto" in
14718         ''|0) try='char* getlogin_r(char*, int);'
14719         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14720         esac
14721         case "$getlogin_r_proto" in
14722         ''|0)   d_getlogin_r=undef
14723                 getlogin_r_proto=0
14724                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14725         * )     case "$getlogin_r_proto" in
14726                 REENTRANT_PROTO*) ;;
14727                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14728                 esac
14729                 echo "Prototype: $try" ;;
14730         esac
14731         ;;
14732         *)      case "$usethreads" in
14733                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14734                 esac
14735                 d_getlogin_r=undef
14736                 getlogin_r_proto=0
14737                 ;;
14738         esac
14739         ;;
14740 *)      getlogin_r_proto=0
14741         ;;
14742 esac
14743
14744 : see if getmnt exists
14745 set getmnt d_getmnt
14746 eval $inlibc
14747
14748 : see if getmntent exists
14749 set getmntent d_getmntent
14750 eval $inlibc
14751
14752 : see if getnameinfo exists
14753 set getnameinfo d_getnameinfo
14754 eval $inlibc
14755
14756 : see if getnetbyaddr exists
14757 set getnetbyaddr d_getnbyaddr
14758 eval $inlibc
14759
14760 : see if getnetbyname exists
14761 set getnetbyname d_getnbyname
14762 eval $inlibc
14763
14764 : see if getnetent exists
14765 set getnetent d_getnent
14766 eval $inlibc
14767
14768 : see if getnetbyaddr_r exists
14769 set getnetbyaddr_r d_getnetbyaddr_r
14770 eval $inlibc
14771 case "$d_getnetbyaddr_r" in
14772 "$define")
14773         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14774         case "$d_getnetbyaddr_r_proto:$usethreads" in
14775         ":define")      d_getnetbyaddr_r_proto=define
14776                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14777                 eval $hasproto ;;
14778         *)      ;;
14779         esac
14780         case "$d_getnetbyaddr_r_proto" in
14781         define)
14782         case "$getnetbyaddr_r_proto" in
14783         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14784         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14785         esac
14786         case "$getnetbyaddr_r_proto" in
14787         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14788         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14789         esac
14790         case "$getnetbyaddr_r_proto" in
14791         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14792         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14793         esac
14794         case "$getnetbyaddr_r_proto" in
14795         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14796         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14797         esac
14798         case "$getnetbyaddr_r_proto" in
14799         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14800         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14801         esac
14802         case "$getnetbyaddr_r_proto" in
14803         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14804         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14805         esac
14806         case "$getnetbyaddr_r_proto" in
14807         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14808         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14809         esac
14810         case "$getnetbyaddr_r_proto" in
14811         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14812         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14813         esac
14814         case "$getnetbyaddr_r_proto" in
14815         ''|0)   d_getnetbyaddr_r=undef
14816                 getnetbyaddr_r_proto=0
14817                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14818         * )     case "$getnetbyaddr_r_proto" in
14819                 REENTRANT_PROTO*) ;;
14820                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14821                 esac
14822                 echo "Prototype: $try" ;;
14823         esac
14824         ;;
14825         *)      case "$usethreads" in
14826                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14827                 esac
14828                 d_getnetbyaddr_r=undef
14829                 getnetbyaddr_r_proto=0
14830                 ;;
14831         esac
14832         ;;
14833 *)      getnetbyaddr_r_proto=0
14834         ;;
14835 esac
14836
14837 : see if getnetbyname_r exists
14838 set getnetbyname_r d_getnetbyname_r
14839 eval $inlibc
14840 case "$d_getnetbyname_r" in
14841 "$define")
14842         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14843         case "$d_getnetbyname_r_proto:$usethreads" in
14844         ":define")      d_getnetbyname_r_proto=define
14845                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14846                 eval $hasproto ;;
14847         *)      ;;
14848         esac
14849         case "$d_getnetbyname_r_proto" in
14850         define)
14851         case "$getnetbyname_r_proto" in
14852         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14853         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14854         esac
14855         case "$getnetbyname_r_proto" in
14856         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14857         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14858         esac
14859         case "$getnetbyname_r_proto" in
14860         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14861         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14862         esac
14863         case "$getnetbyname_r_proto" in
14864         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14865         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14866         esac
14867         case "$getnetbyname_r_proto" in
14868         ''|0)   d_getnetbyname_r=undef
14869                 getnetbyname_r_proto=0
14870                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14871         * )     case "$getnetbyname_r_proto" in
14872                 REENTRANT_PROTO*) ;;
14873                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14874                 esac
14875                 echo "Prototype: $try" ;;
14876         esac
14877         ;;
14878         *)      case "$usethreads" in
14879                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14880                 esac
14881                 d_getnetbyname_r=undef
14882                 getnetbyname_r_proto=0
14883                 ;;
14884         esac
14885         ;;
14886 *)      getnetbyname_r_proto=0
14887         ;;
14888 esac
14889
14890 : see if getnetent_r exists
14891 set getnetent_r d_getnetent_r
14892 eval $inlibc
14893 case "$d_getnetent_r" in
14894 "$define")
14895         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14896         case "$d_getnetent_r_proto:$usethreads" in
14897         ":define")      d_getnetent_r_proto=define
14898                 set d_getnetent_r_proto getnetent_r $hdrs
14899                 eval $hasproto ;;
14900         *)      ;;
14901         esac
14902         case "$d_getnetent_r_proto" in
14903         define)
14904         case "$getnetent_r_proto" in
14905         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14906         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14907         esac
14908         case "$getnetent_r_proto" in
14909         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14910         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14911         esac
14912         case "$getnetent_r_proto" in
14913         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14914         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14915         esac
14916         case "$getnetent_r_proto" in
14917         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14918         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14919         esac
14920         case "$getnetent_r_proto" in
14921         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14922         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14923         esac
14924         case "$getnetent_r_proto" in
14925         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14926         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14927         esac
14928         case "$getnetent_r_proto" in
14929         ''|0)   d_getnetent_r=undef
14930                 getnetent_r_proto=0
14931                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14932         * )     case "$getnetent_r_proto" in
14933                 REENTRANT_PROTO*) ;;
14934                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14935                 esac
14936                 echo "Prototype: $try" ;;
14937         esac
14938         ;;
14939         *)      case "$usethreads" in
14940                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14941                 esac
14942                 d_getnetent_r=undef
14943                 getnetent_r_proto=0
14944                 ;;
14945         esac
14946         ;;
14947 *)      getnetent_r_proto=0
14948         ;;
14949 esac
14950
14951 : see if prototypes for various getnetxxx netdb.h functions are available
14952 echo " "
14953 set d_getnetprotos getnetent $i_netdb netdb.h
14954 eval $hasproto
14955
14956 : see if getpagesize exists
14957 set getpagesize d_getpagsz
14958 eval $inlibc
14959
14960 : Optional checks for getprotobyname and getprotobynumber
14961
14962 : see if getprotobyname exists
14963 set getprotobyname d_getpbyname
14964 eval $inlibc
14965
14966 : see if getprotobynumber exists
14967 set getprotobynumber d_getpbynumber
14968 eval $inlibc
14969
14970 : see if getprotoent exists
14971 set getprotoent d_getpent
14972 eval $inlibc
14973
14974 : see if getpgid exists
14975 set getpgid d_getpgid
14976 eval $inlibc
14977
14978 : see if getpgrp2 exists
14979 set getpgrp2 d_getpgrp2
14980 eval $inlibc
14981
14982 : see if getppid exists
14983 set getppid d_getppid
14984 eval $inlibc
14985
14986 : see if getpriority exists
14987 set getpriority d_getprior
14988 eval $inlibc
14989
14990 : see if getprotobyname_r exists
14991 set getprotobyname_r d_getprotobyname_r
14992 eval $inlibc
14993 case "$d_getprotobyname_r" in
14994 "$define")
14995         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14996         case "$d_getprotobyname_r_proto:$usethreads" in
14997         ":define")      d_getprotobyname_r_proto=define
14998                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14999                 eval $hasproto ;;
15000         *)      ;;
15001         esac
15002         case "$d_getprotobyname_r_proto" in
15003         define)
15004         case "$getprotobyname_r_proto" in
15005         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15006         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15007         esac
15008         case "$getprotobyname_r_proto" in
15009         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15010         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15011         esac
15012         case "$getprotobyname_r_proto" in
15013         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15014         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15015         esac
15016         case "$getprotobyname_r_proto" in
15017         ''|0)   d_getprotobyname_r=undef
15018                 getprotobyname_r_proto=0
15019                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15020         * )     case "$getprotobyname_r_proto" in
15021                 REENTRANT_PROTO*) ;;
15022                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15023                 esac
15024                 echo "Prototype: $try" ;;
15025         esac
15026         ;;
15027         *)      case "$usethreads" in
15028                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15029                 esac
15030                 d_getprotobyname_r=undef
15031                 getprotobyname_r_proto=0
15032                 ;;
15033         esac
15034         ;;
15035 *)      getprotobyname_r_proto=0
15036         ;;
15037 esac
15038
15039 : see if getprotobynumber_r exists
15040 set getprotobynumber_r d_getprotobynumber_r
15041 eval $inlibc
15042 case "$d_getprotobynumber_r" in
15043 "$define")
15044         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15045         case "$d_getprotobynumber_r_proto:$usethreads" in
15046         ":define")      d_getprotobynumber_r_proto=define
15047                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15048                 eval $hasproto ;;
15049         *)      ;;
15050         esac
15051         case "$d_getprotobynumber_r_proto" in
15052         define)
15053         case "$getprotobynumber_r_proto" in
15054         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15055         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15056         esac
15057         case "$getprotobynumber_r_proto" in
15058         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15059         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15060         esac
15061         case "$getprotobynumber_r_proto" in
15062         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15063         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15064         esac
15065         case "$getprotobynumber_r_proto" in
15066         ''|0)   d_getprotobynumber_r=undef
15067                 getprotobynumber_r_proto=0
15068                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15069         * )     case "$getprotobynumber_r_proto" in
15070                 REENTRANT_PROTO*) ;;
15071                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15072                 esac
15073                 echo "Prototype: $try" ;;
15074         esac
15075         ;;
15076         *)      case "$usethreads" in
15077                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15078                 esac
15079                 d_getprotobynumber_r=undef
15080                 getprotobynumber_r_proto=0
15081                 ;;
15082         esac
15083         ;;
15084 *)      getprotobynumber_r_proto=0
15085         ;;
15086 esac
15087
15088 : see if getprotoent_r exists
15089 set getprotoent_r d_getprotoent_r
15090 eval $inlibc
15091 case "$d_getprotoent_r" in
15092 "$define")
15093         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15094         case "$d_getprotoent_r_proto:$usethreads" in
15095         ":define")      d_getprotoent_r_proto=define
15096                 set d_getprotoent_r_proto getprotoent_r $hdrs
15097                 eval $hasproto ;;
15098         *)      ;;
15099         esac
15100         case "$d_getprotoent_r_proto" in
15101         define)
15102         case "$getprotoent_r_proto" in
15103         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15104         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15105         esac
15106         case "$getprotoent_r_proto" in
15107         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15108         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15109         esac
15110         case "$getprotoent_r_proto" in
15111         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15112         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15113         esac
15114         case "$getprotoent_r_proto" in
15115         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15116         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15117         esac
15118         case "$getprotoent_r_proto" in
15119         ''|0)   d_getprotoent_r=undef
15120                 getprotoent_r_proto=0
15121                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15122         * )     case "$getprotoent_r_proto" in
15123                 REENTRANT_PROTO*) ;;
15124                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15125                 esac
15126                 echo "Prototype: $try" ;;
15127         esac
15128         ;;
15129         *)      case "$usethreads" in
15130                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15131                 esac
15132                 d_getprotoent_r=undef
15133                 getprotoent_r_proto=0
15134                 ;;
15135         esac
15136         ;;
15137 *)      getprotoent_r_proto=0
15138         ;;
15139 esac
15140
15141 : see if prototypes for various getprotoxxx netdb.h functions are available
15142 echo " "
15143 set d_getprotoprotos getprotoent $i_netdb netdb.h
15144 eval $hasproto
15145
15146 : see if getprpwnam exists
15147 set getprpwnam d_getprpwnam
15148 eval $inlibc
15149
15150 : see if getpwent exists
15151 set getpwent d_getpwent
15152 eval $inlibc
15153
15154 : see if getpwent_r exists
15155 set getpwent_r d_getpwent_r
15156 eval $inlibc
15157 case "$d_getpwent_r" in
15158 "$define")
15159         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15160         case "$d_getpwent_r_proto:$usethreads" in
15161         ":define")      d_getpwent_r_proto=define
15162                 set d_getpwent_r_proto getpwent_r $hdrs
15163                 eval $hasproto ;;
15164         *)      ;;
15165         esac
15166         case "$d_getpwent_r_proto" in
15167         define)
15168         case "$getpwent_r_proto" in
15169         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15170         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15171         esac
15172         case "$getpwent_r_proto" in
15173         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15174         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15175         esac
15176         case "$getpwent_r_proto" in
15177         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15178         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15179         esac
15180         case "$getpwent_r_proto" in
15181         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15182         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15183         esac
15184         case "$getpwent_r_proto" in
15185         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15186         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15187         esac
15188         case "$getpwent_r_proto" in
15189         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15190         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15191         esac
15192         case "$getpwent_r_proto" in
15193         ''|0)   d_getpwent_r=undef
15194                 getpwent_r_proto=0
15195                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15196         * )     case "$getpwent_r_proto" in
15197                 REENTRANT_PROTO*) ;;
15198                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15199                 esac
15200                 echo "Prototype: $try" ;;
15201         esac
15202         ;;
15203         *)      case "$usethreads" in
15204                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15205                 esac
15206                 d_getpwent_r=undef
15207                 getpwent_r_proto=0
15208                 ;;
15209         esac
15210         ;;
15211 *)      getpwent_r_proto=0
15212         ;;
15213 esac
15214
15215 : see if getpwnam_r exists
15216 set getpwnam_r d_getpwnam_r
15217 eval $inlibc
15218 case "$d_getpwnam_r" in
15219 "$define")
15220         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15221         case "$d_getpwnam_r_proto:$usethreads" in
15222         ":define")      d_getpwnam_r_proto=define
15223                 set d_getpwnam_r_proto getpwnam_r $hdrs
15224                 eval $hasproto ;;
15225         *)      ;;
15226         esac
15227         case "$d_getpwnam_r_proto" in
15228         define)
15229         case "$getpwnam_r_proto" in
15230         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15231         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15232         esac
15233         case "$getpwnam_r_proto" in
15234         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15235         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15236         esac
15237         case "$getpwnam_r_proto" in
15238         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15239         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15240         esac
15241         case "$getpwnam_r_proto" in
15242         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15243         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15244         esac
15245         case "$getpwnam_r_proto" in
15246         ''|0)   d_getpwnam_r=undef
15247                 getpwnam_r_proto=0
15248                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15249         * )     case "$getpwnam_r_proto" in
15250                 REENTRANT_PROTO*) ;;
15251                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15252                 esac
15253                 echo "Prototype: $try" ;;
15254         esac
15255         ;;
15256         *)      case "$usethreads" in
15257                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15258                 esac
15259                 d_getpwnam_r=undef
15260                 getpwnam_r_proto=0
15261                 ;;
15262         esac
15263         ;;
15264 *)      getpwnam_r_proto=0
15265         ;;
15266 esac
15267
15268 : see if getpwuid_r exists
15269 set getpwuid_r d_getpwuid_r
15270 eval $inlibc
15271 case "$d_getpwuid_r" in
15272 "$define")
15273         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15274         case "$d_getpwuid_r_proto:$usethreads" in
15275         ":define")      d_getpwuid_r_proto=define
15276                 set d_getpwuid_r_proto getpwuid_r $hdrs
15277                 eval $hasproto ;;
15278         *)      ;;
15279         esac
15280         case "$d_getpwuid_r_proto" in
15281         define)
15282         case "$getpwuid_r_proto" in
15283         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15284         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15285         esac
15286         case "$getpwuid_r_proto" in
15287         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15288         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15289         esac
15290         case "$getpwuid_r_proto" in
15291         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15292         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15293         esac
15294         case "$getpwuid_r_proto" in
15295         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15296         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15297         esac
15298         case "$getpwuid_r_proto" in
15299         ''|0)   d_getpwuid_r=undef
15300                 getpwuid_r_proto=0
15301                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15302         * )     case "$getpwuid_r_proto" in
15303                 REENTRANT_PROTO*) ;;
15304                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15305                 esac
15306                 echo "Prototype: $try" ;;
15307         esac
15308         ;;
15309         *)      case "$usethreads" in
15310                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15311                 esac
15312                 d_getpwuid_r=undef
15313                 getpwuid_r_proto=0
15314                 ;;
15315         esac
15316         ;;
15317 *)      getpwuid_r_proto=0
15318         ;;
15319 esac
15320
15321 : Optional checks for getsbyname and getsbyport
15322
15323 : see if getservbyname exists
15324 set getservbyname d_getsbyname
15325 eval $inlibc
15326
15327 : see if getservbyport exists
15328 set getservbyport d_getsbyport
15329 eval $inlibc
15330
15331 : see if getservent exists
15332 set getservent d_getsent
15333 eval $inlibc
15334
15335 : see if getservbyname_r exists
15336 set getservbyname_r d_getservbyname_r
15337 eval $inlibc
15338 case "$d_getservbyname_r" in
15339 "$define")
15340         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15341         case "$d_getservbyname_r_proto:$usethreads" in
15342         ":define")      d_getservbyname_r_proto=define
15343                 set d_getservbyname_r_proto getservbyname_r $hdrs
15344                 eval $hasproto ;;
15345         *)      ;;
15346         esac
15347         case "$d_getservbyname_r_proto" in
15348         define)
15349         case "$getservbyname_r_proto" in
15350         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15351         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15352         esac
15353         case "$getservbyname_r_proto" in
15354         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15355         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15356         esac
15357         case "$getservbyname_r_proto" in
15358         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15359         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15360         esac
15361         case "$getservbyname_r_proto" in
15362         ''|0)   d_getservbyname_r=undef
15363                 getservbyname_r_proto=0
15364                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15365         * )     case "$getservbyname_r_proto" in
15366                 REENTRANT_PROTO*) ;;
15367                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15368                 esac
15369                 echo "Prototype: $try" ;;
15370         esac
15371         ;;
15372         *)      case "$usethreads" in
15373                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15374                 esac
15375                 d_getservbyname_r=undef
15376                 getservbyname_r_proto=0
15377                 ;;
15378         esac
15379         ;;
15380 *)      getservbyname_r_proto=0
15381         ;;
15382 esac
15383
15384 : see if getservbyport_r exists
15385 set getservbyport_r d_getservbyport_r
15386 eval $inlibc
15387 case "$d_getservbyport_r" in
15388 "$define")
15389         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15390         case "$d_getservbyport_r_proto:$usethreads" in
15391         ":define")      d_getservbyport_r_proto=define
15392                 set d_getservbyport_r_proto getservbyport_r $hdrs
15393                 eval $hasproto ;;
15394         *)      ;;
15395         esac
15396         case "$d_getservbyport_r_proto" in
15397         define)
15398         case "$getservbyport_r_proto" in
15399         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15400         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15401         esac
15402         case "$getservbyport_r_proto" in
15403         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15404         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15405         esac
15406         case "$getservbyport_r_proto" in
15407         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15408         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15409         esac
15410         case "$getservbyport_r_proto" in
15411         ''|0)   d_getservbyport_r=undef
15412                 getservbyport_r_proto=0
15413                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15414         * )     case "$getservbyport_r_proto" in
15415                 REENTRANT_PROTO*) ;;
15416                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15417                 esac
15418                 echo "Prototype: $try" ;;
15419         esac
15420         ;;
15421         *)      case "$usethreads" in
15422                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15423                 esac
15424                 d_getservbyport_r=undef
15425                 getservbyport_r_proto=0
15426                 ;;
15427         esac
15428         ;;
15429 *)      getservbyport_r_proto=0
15430         ;;
15431 esac
15432
15433 : see if getservent_r exists
15434 set getservent_r d_getservent_r
15435 eval $inlibc
15436 case "$d_getservent_r" in
15437 "$define")
15438         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15439         case "$d_getservent_r_proto:$usethreads" in
15440         ":define")      d_getservent_r_proto=define
15441                 set d_getservent_r_proto getservent_r $hdrs
15442                 eval $hasproto ;;
15443         *)      ;;
15444         esac
15445         case "$d_getservent_r_proto" in
15446         define)
15447         case "$getservent_r_proto" in
15448         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15449         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15450         esac
15451         case "$getservent_r_proto" in
15452         ''|0) try='int getservent_r(struct servent*, char*, int);'
15453         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15454         esac
15455         case "$getservent_r_proto" in
15456         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15457         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15458         esac
15459         case "$getservent_r_proto" in
15460         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15461         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15462         esac
15463         case "$getservent_r_proto" in
15464         ''|0)   d_getservent_r=undef
15465                 getservent_r_proto=0
15466                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15467         * )     case "$getservent_r_proto" in
15468                 REENTRANT_PROTO*) ;;
15469                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15470                 esac
15471                 echo "Prototype: $try" ;;
15472         esac
15473         ;;
15474         *)      case "$usethreads" in
15475                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15476                 esac
15477                 d_getservent_r=undef
15478                 getservent_r_proto=0
15479                 ;;
15480         esac
15481         ;;
15482 *)      getservent_r_proto=0
15483         ;;
15484 esac
15485
15486 : see if prototypes for various getservxxx netdb.h functions are available
15487 echo " "
15488 set d_getservprotos getservent $i_netdb netdb.h
15489 eval $hasproto
15490
15491 : see if getspnam exists
15492 set getspnam d_getspnam
15493 eval $inlibc
15494
15495 : see if this is a shadow.h system
15496 set shadow.h i_shadow
15497 eval $inhdr
15498
15499 : see if getspnam_r exists
15500 set getspnam_r d_getspnam_r
15501 eval $inlibc
15502 case "$d_getspnam_r" in
15503 "$define")
15504         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15505         case "$d_getspnam_r_proto:$usethreads" in
15506         ":define")      d_getspnam_r_proto=define
15507                 set d_getspnam_r_proto getspnam_r $hdrs
15508                 eval $hasproto ;;
15509         *)      ;;
15510         esac
15511         case "$d_getspnam_r_proto" in
15512         define)
15513         case "$getspnam_r_proto" in
15514         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15515         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15516         esac
15517         case "$getspnam_r_proto" in
15518         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15519         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15520         esac
15521         case "$getspnam_r_proto" in
15522         ''|0)   d_getspnam_r=undef
15523                 getspnam_r_proto=0
15524                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15525         * )     case "$getspnam_r_proto" in
15526                 REENTRANT_PROTO*) ;;
15527                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15528                 esac
15529                 echo "Prototype: $try" ;;
15530         esac
15531         ;;
15532         *)      case "$usethreads" in
15533                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15534                 esac
15535                 d_getspnam_r=undef
15536                 getspnam_r_proto=0
15537                 ;;
15538         esac
15539         ;;
15540 *)      getspnam_r_proto=0
15541         ;;
15542 esac
15543
15544 : see if gettimeofday or ftime exists
15545 set gettimeofday d_gettimeod
15546 eval $inlibc
15547 case "$d_gettimeod" in
15548 "$undef")
15549         set ftime d_ftime 
15550         eval $inlibc
15551         ;;
15552 *)
15553         val="$undef"; set d_ftime; eval $setvar
15554         ;;
15555 esac
15556 case "$d_gettimeod$d_ftime" in
15557 "$undef$undef")
15558         echo " "
15559         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15560         ;;
15561 esac
15562
15563 : see if gmtime_r exists
15564 set gmtime_r d_gmtime_r
15565 eval $inlibc
15566 case "$d_gmtime_r" in
15567 "$define")
15568         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15569         case "$d_gmtime_r_proto:$usethreads" in
15570         ":define")      d_gmtime_r_proto=define
15571                 set d_gmtime_r_proto gmtime_r $hdrs
15572                 eval $hasproto ;;
15573         *)      ;;
15574         esac
15575         case "$d_gmtime_r_proto" in
15576         define)
15577         case "$gmtime_r_proto" in
15578         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15579         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15580         esac
15581         case "$gmtime_r_proto" in
15582         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15583         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15584         esac
15585         case "$gmtime_r_proto" in
15586         ''|0)   d_gmtime_r=undef
15587                 gmtime_r_proto=0
15588                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15589         * )     case "$gmtime_r_proto" in
15590                 REENTRANT_PROTO*) ;;
15591                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15592                 esac
15593                 echo "Prototype: $try" ;;
15594         esac
15595         ;;
15596         *)      case "$usethreads" in
15597                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15598                 esac
15599                 d_gmtime_r=undef
15600                 gmtime_r_proto=0
15601                 ;;
15602         esac
15603         ;;
15604 *)      gmtime_r_proto=0
15605         ;;
15606 esac
15607
15608 : see if hasmntopt exists
15609 set hasmntopt d_hasmntopt
15610 eval $inlibc
15611
15612 : see if this is a netinet/in.h or sys/in.h system
15613 set netinet/in.h i_niin sys/in.h i_sysin
15614 eval $inhdr
15615
15616 : see if arpa/inet.h has to be included
15617 set arpa/inet.h i_arpainet
15618 eval $inhdr
15619
15620 : see if htonl --and friends-- exists
15621 val=''
15622 set htonl val
15623 eval $inlibc
15624
15625 : Maybe they are macros.
15626 case "$val" in
15627 $undef)
15628         $cat >htonl.c <<EOM
15629 #include <stdio.h>
15630 #include <sys/types.h>
15631 #$i_niin I_NETINET_IN
15632 #$i_sysin I_SYS_IN
15633 #$i_arpainet I_ARPA_INET
15634 #ifdef I_NETINET_IN
15635 #include <netinet/in.h>
15636 #endif
15637 #ifdef I_SYS_IN
15638 #include <sys/in.h>
15639 #endif
15640 #ifdef I_ARPA_INET
15641 #include <arpa/inet.h>
15642 #endif
15643 #ifdef htonl
15644 printf("Defined as a macro.");
15645 #endif
15646 EOM
15647         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15648         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15649                 val="$define"
15650                 echo "But it seems to be defined as a macro." >&4
15651         fi
15652         $rm -f htonl.?
15653         ;;
15654 esac
15655 set d_htonl
15656 eval $setvar
15657
15658 : see if hypot exists
15659 set hypot d_hypot
15660 eval $inlibc
15661
15662 : see if ilogb exists
15663 set ilogb d_ilogb
15664 eval $inlibc
15665
15666 : see if ilogbl exists
15667 set ilogbl d_ilogbl
15668 eval $inlibc
15669
15670 : index or strchr
15671 echo " "
15672 if set index val -f; eval $csym; $val; then
15673         if set strchr val -f d_strchr; eval $csym; $val; then
15674                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15675                         val="$define"
15676                         vali="$undef"
15677                         echo "strchr() found." >&4
15678                 else
15679                         val="$undef"
15680                         vali="$define"
15681                         echo "index() found." >&4
15682                 fi
15683         else
15684                 val="$undef"
15685                 vali="$define"
15686                 echo "index() found." >&4
15687         fi
15688 else
15689         if set strchr val -f d_strchr; eval $csym; $val; then
15690                 val="$define"
15691                 vali="$undef"
15692                 echo "strchr() found." >&4
15693         else
15694                 echo "No index() or strchr() found!" >&4
15695                 val="$undef"
15696                 vali="$undef"
15697         fi
15698 fi
15699 set d_strchr; eval $setvar
15700 val="$vali"
15701 set d_index; eval $setvar
15702
15703 : check whether inet_aton exists
15704 set inet_aton d_inetaton
15705 eval $inlibc
15706
15707 : see if inet_ntop exists
15708 set inet_ntop d_inetntop
15709 eval $inlibc
15710
15711 : see if inet_pton exists
15712 set inet_pton d_inetpton
15713 eval $inlibc
15714
15715 : Look for isascii
15716 echo " "
15717 $cat >isascii.c <<EOCP
15718 #include <stdio.h>
15719 #include <ctype.h>
15720 #$i_stdlib I_STDLIB
15721 #ifdef I_STDLIB
15722 #include <stdlib.h>
15723 #endif
15724 int main() {
15725         int c = 'A';
15726         if (isascii(c))
15727                 exit(0);
15728         else
15729                 exit(1);
15730 }
15731 EOCP
15732 set isascii
15733 if eval $compile; then
15734         echo "isascii() found." >&4
15735         val="$define"
15736 else
15737         echo "isascii() NOT found." >&4
15738         val="$undef"
15739 fi
15740 set d_isascii
15741 eval $setvar
15742 $rm -f isascii*
15743
15744 : Look for isblank
15745 echo " "
15746 $cat >isblank.c <<'EOCP'
15747 #include <stdio.h>
15748 #include <ctype.h>
15749 int main() {
15750         int c = ' ';
15751         if (isblank(c))
15752                 return 0 ;
15753         else
15754                 return 1 ;
15755 }
15756 EOCP
15757 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15758         echo "isblank() found." >&4
15759         val="$define"
15760 else
15761         echo "isblank() NOT found." >&4
15762         val="$undef"
15763 fi
15764 set d_isblank
15765 eval $setvar
15766 $rm -f isblank*
15767
15768 : check for isfinite
15769 echo "Checking to see if you have isfinite..." >&4
15770 $cat >try.c <<EOCP
15771 #$i_math I_MATH
15772 #ifdef I_MATH
15773 #include <math.h>
15774 #endif
15775 int main() { return isfinite(0.0); }
15776 EOCP
15777 set try
15778 if eval $compile; then
15779         val="$define"
15780         echo "You have isfinite."
15781 else
15782         val="$undef"
15783         echo "You do not have isfinite."
15784 fi
15785 $rm_try
15786 set d_isfinite
15787 eval $setvar
15788
15789 : see if isfinitel exists
15790 set isfinitel d_isfinitel
15791 eval $inlibc
15792
15793 : check for isinf
15794 echo "Checking to see if you have isinf..." >&4
15795 $cat >try.c <<EOCP
15796 #$i_math I_MATH
15797 #ifdef I_MATH
15798 #include <math.h>
15799 #endif
15800 int main() { return isinf(0.0); }
15801 EOCP
15802 set try
15803 if eval $compile; then
15804         val="$define"
15805         echo "You have isinf."
15806 else
15807         val="$undef"
15808         echo "You do not have isinf."
15809 fi
15810 $rm_try
15811 set d_isinf
15812 eval $setvar
15813
15814 : see if isinfl exists
15815 set isinfl d_isinfl
15816 eval $inlibc
15817
15818 : check for isless
15819 echo "Checking to see if you have isless..." >&4
15820 $cat >try.c <<EOCP
15821 #$i_math I_MATH
15822 #ifdef I_MATH
15823 #include <math.h>
15824 #endif
15825 int main() { return isless(0.0); }
15826 EOCP
15827 set try
15828 if eval $compile; then
15829         val="$define"
15830         echo "You have isless."
15831 else
15832         val="$undef"
15833         echo "You do not have isless."
15834 fi
15835 $rm_try
15836 set d_isless
15837 eval $setvar
15838
15839 : check for isnan
15840 echo "Checking to see if you have isnan..." >&4
15841 $cat >try.c <<EOCP
15842 #$i_math I_MATH
15843 #ifdef I_MATH
15844 #include <math.h>
15845 #endif
15846 int main() { return isnan(0.0); }
15847 EOCP
15848 set try
15849 if eval $compile; then
15850         val="$define"
15851         echo "You have isnan."
15852 else
15853         val="$undef"
15854         echo "You do not have isnan."
15855 fi
15856 $rm_try
15857 set d_isnan
15858 eval $setvar
15859
15860 : see if isnanl exists
15861 set isnanl d_isnanl
15862 eval $inlibc
15863
15864 : check for isnormal
15865 echo "Checking to see if you have isnormal..." >&4
15866 $cat >try.c <<EOCP
15867 #$i_math I_MATH
15868 #ifdef I_MATH
15869 #include <math.h>
15870 #endif
15871 int main() { return isnormal(0.0); }
15872 EOCP
15873 set try
15874 if eval $compile; then
15875         val="$define"
15876         echo "You have isnormal."
15877 else
15878         val="$undef"
15879         echo "You do not have isnormal."
15880 fi
15881 $rm_try
15882 set d_isnormal
15883 eval $setvar
15884
15885 : see if j0 exists
15886 set j0 d_j0
15887 eval $inlibc
15888
15889 : see if j0l exists
15890 set j0l d_j0l
15891 eval $inlibc
15892
15893 : see if killpg exists
15894 set killpg d_killpg
15895 eval $inlibc
15896
15897 : see if localeconv exists
15898 set localeconv d_locconv
15899 eval $inlibc
15900
15901 : see if libc has the POSIX.1-2008 currency locale rules
15902 case "$d_locconv:$d_lc_monetary_2008" in
15903 $define:)
15904         $cat >try.c <<EOCP
15905 #include <locale.h>
15906 int main() {
15907         struct lconv *lc = localeconv();
15908         char int_p_cs_precedes = lc->int_p_cs_precedes;
15909         return 0;
15910 }
15911 EOCP
15912         set try
15913         if eval $compile; then
15914                 d_lc_monetary_2008="$define"
15915         else
15916                 d_lc_monetary_2008="$undef"
15917         fi;
15918         $rm_try
15919         ;;
15920 esac
15921
15922 : see if lchown exists
15923 echo " "
15924 $cat > try.c <<'EOCP'
15925 /* System header to define __stub macros and hopefully few prototypes,
15926     which can conflict with char lchown(); below.  */
15927 #include <assert.h>
15928 /* Override any gcc2 internal prototype to avoid an error.  */
15929 /* We use char because int might match the return type of a gcc2
15930    builtin and then its argument prototype would still apply.  */
15931 char lchown();
15932 int main() {
15933     /*  The GNU C library defines this for functions which it implements
15934         to always fail with ENOSYS.  Some functions are actually named
15935         something starting with __ and the normal name is an alias.  */
15936 #if defined (__stub_lchown) || defined (__stub___lchown)
15937 choke me
15938 #else
15939 lchown();
15940 #endif
15941 ; return 0; }
15942 EOCP
15943 set try
15944 if eval $compile; then
15945     $echo "lchown() found." >&4
15946     val="$define"
15947 else
15948     $echo "lchown() NOT found." >&4
15949     val="$undef"
15950 fi
15951 set d_lchown
15952 eval $setvar
15953
15954 : See if number of significant digits in a double precision number is known
15955 echo " "
15956 $cat >ldbl_dig.c <<EOM
15957 #$i_limits I_LIMITS
15958 #$i_float I_FLOAT
15959 #ifdef I_LIMITS
15960 #include <limits.h>
15961 #endif
15962 #ifdef I_FLOAT
15963 #include <float.h>
15964 #endif
15965 #ifdef LDBL_DIG
15966 printf("Contains LDBL_DIG");
15967 #endif
15968 EOM
15969 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15970 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15971         echo "LDBL_DIG found." >&4
15972         val="$define"
15973 else
15974         echo "LDBL_DIG NOT found." >&4
15975         val="$undef"
15976 fi
15977 $rm -f ldbl_dig.?
15978 set d_ldbl_dig
15979 eval $setvar
15980
15981 : see if lgamma exists
15982 set lgamma d_lgamma
15983 eval $inlibc
15984
15985 : see if lgamma_r exists
15986 set lgamma_r d_lgamma_r
15987 eval $inlibc
15988
15989 : check to see if math.h defines _LIB_VERSION
15990 d_libm_lib_version="$undef"
15991 case $i_math in
15992     $define)
15993         echo " "
15994         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15995         $cat >try.c <<EOCP
15996 #include <unistd.h>
15997 #include <math.h>
15998 int main (int argc, char *argv[])
15999 {
16000     printf ("%d\n", _LIB_VERSION);
16001     return (0);
16002     } /* main */
16003 EOCP
16004         set try
16005         if eval $compile; then
16006             foo=`$run ./try`
16007             echo "Yes, it does ($foo)" >&4
16008             d_libm_lib_version="$define"
16009         else
16010             echo "No, it does not (probably harmless)" >&4
16011             fi
16012         $rm_try
16013         ;;
16014
16015     esac
16016
16017 : see if link exists
16018 set link d_link
16019 eval $inlibc
16020
16021 : see if llrint exists
16022 set llrint d_llrint
16023 eval $inlibc
16024
16025 : see if llrintl exists
16026 set llrintl d_llrintl
16027 eval $inlibc
16028
16029 : see if llround exists
16030 set llround d_llround
16031 eval $inlibc
16032
16033 : see if llroundl exists
16034 set llroundl d_llroundl
16035 eval $inlibc
16036
16037 : see if localtime_r exists
16038 set localtime_r d_localtime_r
16039 eval $inlibc
16040 case "$d_localtime_r" in
16041 "$define")
16042         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16043         case "$d_localtime_r_proto:$usethreads" in
16044         ":define")      d_localtime_r_proto=define
16045                 set d_localtime_r_proto localtime_r $hdrs
16046                 eval $hasproto ;;
16047         *)      ;;
16048         esac
16049         case "$d_localtime_r_proto" in
16050         define)
16051         case "$localtime_r_proto" in
16052         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16053         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16054         esac
16055         case "$localtime_r_proto" in
16056         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16057         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16058         esac
16059         case "$localtime_r_proto" in
16060         ''|0)   d_localtime_r=undef
16061                 localtime_r_proto=0
16062                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16063         * )     case "$localtime_r_proto" in
16064                 REENTRANT_PROTO*) ;;
16065                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16066                 esac
16067                 echo "Prototype: $try" ;;
16068         esac
16069         ;;
16070         *)      case "$usethreads" in
16071                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16072                 esac
16073                 d_localtime_r=undef
16074                 localtime_r_proto=0
16075                 ;;
16076         esac
16077         ;;
16078 *)      localtime_r_proto=0
16079         ;;
16080 esac
16081
16082 : see if localtime_r calls tzset
16083 case "$localtime_r_proto" in
16084 REENTRANT_PROTO*)
16085         $cat >try.c <<EOCP
16086 /*  Does our libc's localtime_r call tzset ?
16087  *  return 0 if so, 1 otherwise.
16088  */
16089 #$i_systypes    I_SYS_TYPES
16090 #$i_unistd      I_UNISTD
16091 #$i_time        I_TIME
16092 #$i_stdlib      I_STDLIB
16093 #$i_string      I_STRING
16094 #$i_malloc      I_MALLOC
16095 #ifdef I_SYS_TYPES
16096 #  include <sys/types.h>
16097 #endif
16098 #ifdef I_UNISTD
16099 #  include <unistd.h>
16100 #endif
16101 #ifdef I_TIME
16102 #  include <time.h>
16103 #endif
16104 #ifdef I_STDLIB
16105 #include <stdlib.h>
16106 #endif
16107 #ifdef I_STRING
16108 #  include <string.h>
16109 #else
16110 #  include <strings.h>
16111 #endif
16112 #ifdef I_MALLOC
16113 #  include <malloc.h>
16114 #endif
16115 int main()
16116 {
16117     time_t t = time(0L);
16118     char w_tz[]="TZ" "=GMT+5",
16119          e_tz[]="TZ" "=GMT-5",
16120         *tz_e = (char*)malloc(16),
16121         *tz_w = (char*)malloc(16);
16122     struct tm tm_e, tm_w;
16123     memset(&tm_e,'\0',sizeof(struct tm));
16124     memset(&tm_w,'\0',sizeof(struct tm));
16125     strcpy(tz_e,e_tz);
16126     strcpy(tz_w,w_tz);
16127
16128     putenv(tz_e);
16129     localtime_r(&t, &tm_e);
16130
16131     putenv(tz_w);
16132     localtime_r(&t, &tm_w);
16133
16134     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16135         return 1;
16136     return 0;
16137 }
16138 EOCP
16139         set try
16140         if eval $compile; then
16141             if $run ./try; then
16142                 d_localtime_r_needs_tzset=undef;
16143             else
16144                 d_localtime_r_needs_tzset=define;
16145             fi;
16146         else
16147             d_localtime_r_needs_tzset=undef;
16148         fi;
16149      ;;
16150   *)
16151      d_localtime_r_needs_tzset=undef;
16152      ;;
16153 esac
16154 $rm_try
16155
16156 : see if lockf exists
16157 set lockf d_lockf
16158 eval $inlibc
16159
16160 : see if log1p exists
16161 set log1p d_log1p
16162 eval $inlibc
16163
16164 : see if log2 exists
16165 set log2 d_log2
16166 eval $inlibc
16167
16168 : see if logb exists
16169 set logb d_logb
16170 eval $inlibc
16171
16172 : see if lrint exists
16173 set lrint d_lrint
16174 eval $inlibc
16175
16176 : see if lrintl exists
16177 set lrintl d_lrintl
16178 eval $inlibc
16179
16180 : see if lround exists
16181 set lround d_lround
16182 eval $inlibc
16183
16184 : see if lroundl exists
16185 set lroundl d_lroundl
16186 eval $inlibc
16187
16188 : see if prototype for lseek is available
16189 echo " "
16190 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16191 eval $hasproto
16192
16193 : see if lstat exists
16194 set lstat d_lstat
16195 eval $inlibc
16196
16197 : see if madvise exists
16198 set madvise d_madvise
16199 eval $inlibc
16200
16201 : see if malloc_size exists
16202 set malloc_size d_malloc_size
16203 eval $inlibc
16204
16205 : see if malloc_size_good exists
16206 set malloc_good_size d_malloc_good_size
16207 eval $inlibc
16208
16209 : see if mblen exists
16210 set mblen d_mblen
16211 eval $inlibc
16212
16213 : see if mbstowcs exists
16214 set mbstowcs d_mbstowcs
16215 eval $inlibc
16216
16217 : see if mbtowc exists
16218 set mbtowc d_mbtowc
16219 eval $inlibc
16220
16221 : see if memchr exists
16222 set memchr d_memchr
16223 eval $inlibc
16224
16225 : see if memcmp exists
16226 set memcmp d_memcmp
16227 eval $inlibc
16228
16229 : see if memcpy exists
16230 set memcpy d_memcpy
16231 eval $inlibc
16232
16233 : see if memmove exists
16234 set memmove d_memmove
16235 eval $inlibc
16236
16237 : see if memset exists
16238 set memset d_memset
16239 eval $inlibc
16240
16241 : see if mkdir exists
16242 set mkdir d_mkdir
16243 eval $inlibc
16244
16245 : see if mkdtemp exists
16246 set mkdtemp d_mkdtemp
16247 eval $inlibc
16248
16249 : see if mkfifo exists
16250 set mkfifo d_mkfifo
16251 eval $inlibc
16252
16253 : see if mkstemp exists
16254 set mkstemp d_mkstemp
16255 eval $inlibc
16256
16257 : see if mkstemps exists
16258 set mkstemps d_mkstemps
16259 eval $inlibc
16260
16261 : see if mktime exists
16262 set mktime d_mktime
16263 eval $inlibc
16264
16265 : see if this is a sys/mman.h system
16266 set sys/mman.h i_sysmman
16267 eval $inhdr
16268
16269 : see if mmap exists
16270 set mmap d_mmap
16271 eval $inlibc
16272 : see what shmat returns
16273 : default to something harmless
16274 mmaptype='void *'
16275 case "$i_sysmman$d_mmap" in
16276 "$define$define")
16277         $cat >mmap.c <<'END'
16278 #include <sys/mman.h>
16279 void *mmap();
16280 END
16281         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16282                 mmaptype='void *'
16283         else
16284                 mmaptype='caddr_t'
16285         fi
16286         echo "and it returns ($mmaptype)." >&4
16287         ;;
16288 esac
16289
16290
16291
16292 : see if sqrtl exists
16293 set sqrtl d_sqrtl
16294 eval $inlibc
16295
16296 : see if scalbnl exists
16297 set scalbnl d_scalbnl
16298 eval $inlibc
16299
16300 : see if truncl exists
16301 set truncl d_truncl
16302 eval $inlibc
16303
16304 : see if modfl exists
16305 set modfl d_modfl
16306 eval $inlibc
16307
16308 : see if prototype for modfl is available
16309 echo " "
16310 set d_modflproto modfl $i_math math.h
16311 eval $hasproto
16312
16313 d_modfl_pow32_bug="$undef"
16314
16315 case "$d_longdbl$d_modfl" in
16316 $define$define)
16317         $cat <<EOM
16318 Checking to see whether your modfl() is okay for large values...
16319 EOM
16320 $cat >try.c <<EOCP
16321 #include <math.h>
16322 #include <stdio.h>
16323 EOCP
16324 if $test "X$d_modflproto" != "X$define"; then
16325         $cat >>try.c <<EOCP
16326 /* Sigh. many current glibcs provide the function, but do not prototype it. */
16327 long double modfl (long double, long double *);
16328 EOCP
16329 fi
16330 $cat >>try.c <<EOCP
16331 int main() {
16332     long double nv = 4294967303.15;
16333     long double v, w;
16334     v = modfl(nv, &w);
16335 #ifdef __GLIBC__
16336     printf("glibc");
16337 #endif
16338     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
16339     return 0;
16340 }
16341 EOCP
16342         case "$osname:$gccversion" in
16343         aix:)   saveccflags="$ccflags"
16344                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
16345         esac
16346         set try
16347         if eval $compile; then
16348                 foo=`$run ./try`
16349                 case "$foo" in
16350                 *" 4294967303.150000 1.150000 4294967302.000000")
16351                         echo >&4 "Your modfl() is broken for large values."
16352                         d_modfl_pow32_bug="$define"
16353                         case "$foo" in
16354                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
16355                         ;;
16356                         esac
16357                         ;;
16358                 *" 4294967303.150000 0.150000 4294967303.000000")
16359                         echo >&4 "Your modfl() seems okay for large values."
16360                         ;;
16361                 *)      echo >&4 "I don't understand your modfl() at all."
16362                         d_modfl="$undef"
16363                         ;;
16364                 esac
16365                 $rm_try
16366         else
16367                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
16368                 d_modfl="$undef"
16369         fi
16370         case "$osname:$gccversion" in
16371         aix:)   ccflags="$saveccflags" ;; # restore
16372         esac
16373         ;;
16374 esac
16375
16376 if $test "$uselongdouble" = "$define"; then
16377     message=""
16378     if $test "$d_sqrtl" != "$define"; then
16379         message="$message sqrtl"
16380     fi
16381     if $test "$d_modfl" != "$define"; then
16382         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16383             echo "You have both truncl and copysignl, so I can emulate modfl."
16384         else
16385             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16386                 echo "You have both aintl and copysignl, so I can emulate modfl."
16387             else
16388                 message="$message modfl"
16389             fi
16390         fi
16391     fi
16392     if $test "$d_frexpl" != "$define"; then
16393         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16394             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16395         else
16396             message="$message frexpl"
16397         fi
16398     fi
16399     if $test "$d_ldexpl" != "$define"; then
16400         message="$message ldexpl"
16401     fi
16402
16403     if $test "$message" != ""; then
16404         $cat <<EOM >&4
16405
16406 *** You requested the use of long doubles but you do not seem to have
16407 *** the following mathematical functions needed for long double support:
16408 ***    $message
16409 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16410 *** Cannot continue, aborting.
16411
16412 EOM
16413
16414         exit 1
16415     fi
16416 fi
16417
16418 : see if mprotect exists
16419 set mprotect d_mprotect
16420 eval $inlibc
16421
16422 : see if msgctl exists
16423 set msgctl d_msgctl
16424 eval $inlibc
16425
16426 : see if msgget exists
16427 set msgget d_msgget
16428 eval $inlibc
16429
16430 : see if msgsnd exists
16431 set msgsnd d_msgsnd
16432 eval $inlibc
16433
16434 : see if msgrcv exists
16435 set msgrcv d_msgrcv
16436 eval $inlibc
16437
16438 : see how much of the 'msg*(2)' library is present.
16439 h_msg=true
16440 echo " "
16441 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16442 *"$undef"*) h_msg=false;;
16443 esac
16444 case "$osname" in
16445 freebsd)
16446     case "`ipcs 2>&1`" in
16447     "SVID messages"*"not configured"*)
16448         echo "Your $osname does not have the msg*(2) configured." >&4
16449         h_msg=false
16450         val="$undef"
16451         set msgctl d_msgctl
16452         eval $setvar
16453         set msgget d_msgget
16454         eval $setvar
16455         set msgsnd d_msgsnd
16456         eval $setvar
16457         set msgrcv d_msgrcv
16458         eval $setvar
16459         ;;
16460     esac
16461     ;;
16462 esac
16463 : we could also check for sys/ipc.h ...
16464 if $h_msg && $test `./findhdr sys/msg.h`; then
16465         echo "You have the full msg*(2) library." >&4
16466         val="$define"
16467 else
16468         echo "You don't have the full msg*(2) library." >&4
16469         val="$undef"
16470 fi
16471 set d_msg
16472 eval $setvar
16473
16474 : Check for msghdr_s
16475 echo " "
16476 echo "Checking to see if your system supports struct msghdr..." >&4
16477 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16478 eval $hasstruct
16479 case "$d_msghdr_s" in
16480 "$define")      echo "Yes, it does."   ;;
16481 *)              echo "No, it doesn't." ;;
16482 esac
16483
16484
16485 : see if msync exists
16486 set msync d_msync
16487 eval $inlibc
16488
16489 : see if munmap exists
16490 set munmap d_munmap
16491 eval $inlibc
16492
16493 : see if nan exists
16494 set nan d_nan
16495 eval $inlibc
16496
16497 : see if nearbyint exists
16498 set nearbyint d_nearbyint
16499 eval $inlibc
16500
16501 : see if nextafter exists
16502 set nextafter d_nextafter
16503 eval $inlibc
16504
16505 : see if nexttoward exists
16506 set nexttoward d_nexttoward
16507 eval $inlibc
16508
16509 : see if nice exists
16510 set nice d_nice
16511 eval $inlibc
16512
16513 : see if this is a langinfo.h system
16514 set langinfo.h i_langinfo
16515 eval $inhdr
16516
16517 : see if nl_langinfo exists
16518 set nl_langinfo d_nl_langinfo
16519 eval $inlibc
16520
16521 : see if this is a quadmath.h system
16522 set quadmath.h i_quadmath
16523 eval $inhdr
16524
16525 : check for volatile keyword
16526 echo " "
16527 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
16528 $cat >try.c <<'EOCP'
16529 int main()
16530 {
16531         typedef struct _goo_struct goo_struct;
16532         goo_struct * volatile goo = ((goo_struct *)0);
16533         struct _goo_struct {
16534                 long long_int;
16535                 int reg_int;
16536                 char char_var;
16537         };
16538         typedef unsigned short foo_t;
16539         char *volatile foo;
16540         volatile int bar;
16541         volatile foo_t blech;
16542         foo = foo;
16543 }
16544 EOCP
16545 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
16546         val="$define"
16547         echo "Yup, it does."
16548 else
16549         val="$undef"
16550         echo "Nope, it doesn't."
16551 fi
16552 set d_volatile
16553 eval $setvar
16554 $rm_try
16555
16556 : Check basic sizes
16557 echo " "
16558 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16559
16560 case "$use64bitint:$d_quad:$quadtype" in
16561 define:define:?*)
16562         ivtype="$quadtype"
16563         uvtype="$uquadtype"
16564         ivsize=8
16565         uvsize=8
16566         ;;
16567 *)      ivtype="long"
16568         uvtype="unsigned long"
16569         ivsize=$longsize
16570         uvsize=$longsize
16571         ;;
16572 esac
16573
16574 case "$uselongdouble:$d_longdbl" in
16575 define:define)
16576         nvtype="long double"
16577         nvsize=$longdblsize
16578         ;;
16579 *)      nvtype=double
16580         nvsize=$doublesize
16581         ;;
16582 esac
16583
16584 case "$usequadmath:$i_quadmath" in
16585 define:define)
16586   nvtype="__float128"
16587   nvsize=16
16588   case "$libs" in
16589   *quadmath*) ;;
16590   *) $cat <<EOM >&4
16591
16592 *** You requested the use of the quadmath library, but you
16593 *** do not seem to have the quadmath library installed.
16594 *** Cannot continue, aborting.
16595 EOM
16596     exit 1
16597     ;;
16598   esac
16599   ;;
16600 define:*) $cat <<EOM >&4
16601
16602 *** You requested the use of the quadmath library, but you
16603 *** do not seem to have the required header, <quadmath.h>.
16604 EOM
16605   case "$gccversion" in
16606   [23].*|4.[0-5]*)
16607    $cat <<EOM >&4
16608 *** Your gcc looks a bit old:
16609 *** $gccversion
16610 EOM
16611     ;;
16612   '')
16613    $cat <<EOM >&4
16614 *** You are not running a gcc.
16615 EOM
16616     ;;
16617   esac
16618   $cat <<EOM >&4
16619 *** For the quadmath library you need at least gcc 4.6.
16620 *** Cannot continue, aborting.
16621 EOM
16622   exit 1
16623   ;;
16624 esac
16625
16626 $echo "(IV will be "$ivtype", $ivsize bytes)"
16627 $echo "(UV will be "$uvtype", $uvsize bytes)"
16628 $echo "(NV will be "$nvtype", $nvsize bytes)"
16629
16630 $cat >try.c <<EOCP
16631 #$i_inttypes I_INTTYPES
16632 #ifdef I_INTTYPES
16633 #include <inttypes.h>
16634 #endif
16635 #include <stdio.h>
16636 int main() {
16637 #ifdef INT8
16638    int8_t i =  INT8_MAX;
16639   uint8_t u = UINT8_MAX;
16640   printf("int8_t\n");
16641 #endif
16642 #ifdef INT16
16643    int16_t i =  INT16_MAX;
16644   uint16_t u = UINT16_MAX;
16645   printf("int16_t\n");
16646 #endif
16647 #ifdef INT32
16648    int32_t i =  INT32_MAX;
16649   uint32_t u = UINT32_MAX;
16650   printf("int32_t\n");
16651 #endif
16652 }
16653 EOCP
16654
16655 i8type="signed char"
16656 u8type="unsigned char"
16657 i8size=1
16658 u8size=1
16659
16660 case "$i16type" in
16661 '')     case "$shortsize" in
16662         2)      i16type=short
16663                 u16type="unsigned short"
16664                 i16size=$shortsize
16665                 u16size=$shortsize
16666                 ;;
16667         esac
16668         ;;
16669 esac
16670 case "$i16type" in
16671 '')     set try -DINT16
16672         if eval $compile; then
16673                 case "`$run ./try`" in
16674                 int16_t)
16675                         i16type=int16_t
16676                         u16type=uint16_t
16677                         i16size=2
16678                         u16size=2
16679                         ;;
16680                 esac
16681         fi
16682         ;;
16683 esac
16684 case "$i16type" in
16685 '')     if $test $shortsize -ge 2; then
16686                 i16type=short
16687                 u16type="unsigned short"
16688                 i16size=$shortsize
16689                 u16size=$shortsize
16690         fi
16691         ;;
16692 esac
16693
16694 case "$i32type" in
16695 '')     case "$longsize" in
16696         4)      i32type=long
16697                 u32type="unsigned long"
16698                 i32size=$longsize
16699                 u32size=$longsize
16700                 ;;
16701         *)      case "$intsize" in
16702                 4)      i32type=int
16703                         u32type="unsigned int"
16704                         i32size=$intsize
16705                         u32size=$intsize
16706                         ;;
16707                 esac
16708                 ;;
16709         esac
16710         ;;
16711 esac
16712 case "$i32type" in
16713 '')     set try -DINT32
16714         if eval $compile; then
16715                 case "`$run ./try`" in
16716                 int32_t)
16717                         i32type=int32_t
16718                         u32type=uint32_t
16719                         i32size=4
16720                         u32size=4
16721                         ;;
16722                 esac
16723         fi
16724         ;;
16725 esac
16726 case "$i32type" in
16727 '')     if $test $intsize -ge 4; then
16728                 i32type=int
16729                 u32type="unsigned int"
16730                 i32size=$intsize
16731                 u32size=$intsize
16732         fi
16733         ;;
16734 esac
16735
16736 case "$i64type" in
16737 '')     case "$d_quad:$quadtype" in
16738         define:?*)
16739                 i64type="$quadtype"
16740                 u64type="$uquadtype"
16741                 i64size=8
16742                 u64size=8
16743                 ;;
16744         esac
16745         ;;
16746 esac
16747
16748 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16749 : volatile so that the compiler has to store it out to memory.
16750 if test X"$d_volatile" = X"$define"; then
16751         volatile=volatile
16752 fi
16753 $cat <<EOP >try.c
16754 #include <stdio.h>
16755 #$i_stdlib I_STDLIB
16756 #ifdef I_STDLIB
16757 #include <stdlib.h>
16758 #endif
16759 #include <sys/types.h>
16760 #include <signal.h>
16761 #ifdef SIGFPE
16762 $volatile int bletched = 0;
16763 $signal_t blech(int s) { bletched = 1; }
16764 #endif
16765 int main() {
16766     $uvtype u = 0;
16767     $nvtype d;
16768     int     n = 8 * $uvsize;
16769     int     i;
16770 #ifdef SIGFPE
16771     signal(SIGFPE, blech);
16772 #endif
16773
16774     for (i = 0; i < n; i++) {
16775       u = u << 1 | ($uvtype)1;
16776       d = ($nvtype)u;
16777       if (($uvtype)d != u)
16778         break;
16779       if (d <= 0)
16780         break;
16781       d = ($nvtype)(u - 1);
16782       if (($uvtype)d != (u - 1))
16783         break;
16784 #ifdef SIGFPE
16785       if (bletched)
16786         break;
16787 #endif
16788     }
16789     printf("%d\n", ((i == n) ? -n : i));
16790     exit(0);
16791 }
16792 EOP
16793 set try
16794
16795 d_nv_preserves_uv="$undef"
16796 if eval $compile; then
16797         nv_preserves_uv_bits="`$run ./try`"
16798 fi
16799 case "$nv_preserves_uv_bits" in
16800 \-[1-9]*)
16801         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16802         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16803         d_nv_preserves_uv="$define"
16804         ;;
16805 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16806         d_nv_preserves_uv="$undef" ;;
16807 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16808         nv_preserves_uv_bits="0" ;;
16809 esac
16810 $rm_try
16811
16812 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16813 : volatile so that the compiler has to store it out to memory.
16814 if test X"$d_volatile" = X"$define"; then
16815         volatile=volatile
16816 fi
16817 $cat <<EOP >try.c
16818 #include <stdio.h>
16819
16820 typedef $nvtype NV;
16821
16822 int
16823 main() {
16824   NV value = 2;
16825   int count = 1;
16826
16827   while(count < 256) {
16828     $volatile NV up = value + 1.0;
16829     $volatile NV negated = -value;
16830     $volatile NV down = negated - 1.0;
16831     $volatile NV got_up = up - value;
16832     int up_good = got_up == 1.0;
16833     int got_down = down - negated;
16834     int down_good = got_down == -1.0;
16835
16836     if (down_good != up_good) {
16837       fprintf(stderr,
16838               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16839               up_good, (double) got_up, down_good, (double) got_down,
16840               count, (double) value);
16841       return 1;
16842     }
16843     if (!up_good) {
16844       while (1) {
16845         if (count > 8) {
16846           count -= 8;
16847           fputs("256.0", stdout);
16848         } else {
16849           count--;
16850           fputs("2.0", stdout);
16851         }
16852         if (!count) {
16853           puts("");
16854           return 0;
16855         }
16856         fputs("*", stdout);
16857       }
16858     }
16859     value *= 2;
16860     ++count;
16861   }
16862   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16863           count, (double) value);
16864   return 1;
16865 }
16866 EOP
16867 set try
16868
16869 nv_overflows_integers_at='0'
16870 if eval $compile; then
16871     xxx="`$run ./try`"
16872     case "$?" in
16873         0)
16874             case "$xxx" in
16875                 2*)  cat >&4 <<EOM
16876 The largest integer your NVs can preserve is equal to $xxx
16877 EOM
16878                     nv_overflows_integers_at="$xxx"
16879                     ;;
16880                 *)  cat >&4 <<EOM
16881 Cannot determine the largest integer value your NVs can hold, unexpected output
16882 '$xxx'
16883 EOM
16884                     ;;
16885             esac
16886             ;;
16887         *)  cat >&4 <<EOM
16888 Cannot determine the largest integer value your NVs can hold
16889 EOM
16890             ;;
16891     esac
16892 fi
16893 $rm_try
16894
16895 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16896 : volatile so that the compiler has to store it out to memory.
16897 if test X"$d_volatile" = X"$define"; then
16898         volatile=volatile
16899 fi
16900 $cat <<EOP >try.c
16901 #include <stdio.h>
16902 #$i_stdlib I_STDLIB
16903 #ifdef I_STDLIB
16904 #include <stdlib.h>
16905 #endif
16906 #$i_string I_STRING
16907 #ifdef I_STRING
16908 #  include <string.h>
16909 #else
16910 #  include <strings.h>
16911 #endif
16912 #include <sys/types.h>
16913 #include <signal.h>
16914 #ifdef SIGFPE
16915 $volatile int bletched = 0;
16916 $signal_t blech(int s) { bletched = 1; }
16917 #endif
16918
16919 int checkit($nvtype d, char *where) {
16920     unsigned char *p = (char *)&d;
16921     unsigned char *end = p + sizeof(d);
16922     int fail = 0;
16923
16924     while (p < end)
16925         fail += *p++;
16926
16927     if (!fail)
16928         return 0;
16929
16930     p = (char *)&d;
16931     printf("No - %s: 0x", where);
16932     while (p < end)
16933         printf ("%02X", *p++);
16934     printf("\n");
16935     return 1;
16936 }
16937
16938 int main(int argc, char **argv) {
16939     $nvtype d = 0.0;
16940     int fail = 0;
16941     fail += checkit(d, "0.0");
16942
16943     /* The compiler shouldn't be assuming that bletched is 0  */
16944     d = bletched;
16945
16946     fail += checkit(d, "bleched");
16947
16948 #ifdef SIGFPE
16949     signal(SIGFPE, blech);
16950 #endif
16951
16952     /* Paranoia - the compiler should have no way of knowing that ANSI says
16953        that argv[argc] will always be NULL.  Actually, if it did assume this it
16954        would be buggy, as this is C and main() can be called from elsewhere in
16955        the program.  */
16956     d = argv[argc] ? 1 : 0;
16957
16958     if (d) {
16959         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16960     }
16961
16962     fail += checkit(d, "ternary");
16963
16964     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16965
16966     if (d != 0.0) {
16967         printf("No - memset doesn't give 0.0\n");
16968         /* This might just blow up:  */
16969         printf("(gives %g)\n", d);
16970         return 1;
16971     }
16972
16973 #ifdef SIGFPE
16974     if (bletched) {
16975         printf("No - something bleched\n");
16976         return 1;
16977     }
16978 #endif
16979     if (fail) {
16980       printf("No - %d fail(s)\n", fail);
16981       return 1;
16982     }
16983     printf("Yes\n");
16984     return 0;
16985 }
16986 EOP
16987 set try
16988
16989 d_nv_zero_is_allbits_zero="$undef"
16990 if eval $compile; then
16991     xxx="`$run ./try`"
16992     case "$?" in
16993         0)
16994             case "$xxx" in
16995                 Yes)  cat >&4 <<EOM
16996 0.0 is represented as all bits zero in memory
16997 EOM
16998                     d_nv_zero_is_allbits_zero="$define"
16999                     ;;
17000                 *)  cat >&4 <<EOM
17001 0.0 is not represented as all bits zero in memory
17002 EOM
17003                     d_nv_zero_is_allbits_zero="$undef"
17004                     ;;
17005             esac
17006             ;;
17007         *)  cat >&4 <<EOM
17008 0.0 is not represented as all bits zero in memory
17009 EOM
17010             d_nv_zero_is_allbits_zero="$undef"
17011             ;;
17012     esac
17013 fi
17014 $rm_try
17015
17016 : check for off64_t
17017 echo " "
17018 echo "Checking to see if you have off64_t..." >&4
17019 $cat >try.c <<EOCP
17020 #include <sys/types.h>
17021 #include <unistd.h>
17022 int main() { off64_t x = 7; }
17023 EOCP
17024 set try
17025 if eval $compile; then
17026         val="$define"
17027         echo "You have off64_t."
17028 else
17029         val="$undef"
17030         echo "You do not have off64_t."
17031         case "$lseeksize" in
17032         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
17033         esac
17034 fi
17035 $rm_try
17036 set d_off64_t
17037 eval $setvar
17038
17039 : how to create joinable pthreads
17040 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
17041         echo " "
17042         echo "Checking what constant to use for creating joinable pthreads..." >&4
17043         $cat >try.c <<'EOCP'
17044 #include <pthread.h>
17045 int main() {
17046     int detachstate = JOINABLE;
17047 }
17048 EOCP
17049         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
17050         if eval $compile; then
17051                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
17052                 val="$undef" # Yes, undef.
17053                 set d_old_pthread_create_joinable
17054                 eval $setvar
17055                 val=""
17056                 set old_pthread_create_joinable
17057                 eval $setvar
17058         else
17059                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
17060                 if eval $compile; then
17061                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
17062                         val="$define"
17063                         set d_old_pthread_create_joinable
17064                         eval $setvar
17065                         val=PTHREAD_CREATE_UNDETACHED
17066                         set old_pthread_create_joinable
17067                         eval $setvar
17068                 else
17069                         set try -DJOINABLE=__UNDETACHED
17070                         if eval $compile; then
17071                                 echo "You seem to use __UNDETACHED." >&4
17072                                 val="$define"
17073                                 set d_old_pthread_create_joinable
17074                                 eval $setvar
17075                                 val=__UNDETACHED
17076                                 set old_pthread_create_joinable
17077                                 eval $setvar
17078                         else
17079                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
17080                                 val="$define"
17081                                 set d_old_pthread_create_joinable
17082                                 eval $setvar
17083                                 val=0
17084                                 set old_pthread_create_joinable
17085                                 eval $setvar
17086                         fi
17087                 fi
17088         fi
17089         $rm_try
17090 else
17091     d_old_pthread_create_joinable="$undef"
17092     old_pthread_create_joinable=""
17093 fi
17094
17095 : see if pause exists
17096 set pause d_pause
17097 eval $inlibc
17098
17099 : see if poll exists
17100 set poll d_poll
17101 eval $inlibc
17102
17103 : see if prctl exists
17104 set prctl d_prctl
17105 eval $inlibc
17106
17107 : see if prctl supports PR_SET_NAME
17108 d_prctl_set_name=$undef
17109 case $d_prctl in
17110     $define)
17111         $cat >try.c <<EOM
17112 #ifdef __ANDROID__
17113 #include <unistd.h>
17114 #endif
17115 #include <sys/prctl.h>
17116
17117 int main (int argc, char *argv[])
17118 {
17119     return (prctl (PR_SET_NAME, "Test"));
17120     } /* main */
17121 EOM
17122         set try
17123         if eval $compile_ok && $run ./try; then
17124             echo "Your prctl (PR_SET_NAME, ...) works"
17125             d_prctl_set_name=$define
17126             fi
17127         $rm_try
17128         ;;
17129     esac
17130
17131 : see if readlink exists
17132 set readlink d_readlink
17133 eval $inlibc
17134
17135 : Check if exe is symlink to abs path of executing program
17136 echo " "
17137 procselfexe=''
17138 val="$undef"
17139 case "$d_readlink" in
17140     "$define")
17141         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
17142         : more tidy to avoid an extra level of symlink
17143         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17144         while test $# -gt 0; do
17145             type=$1; try=$2
17146             shift; shift
17147             if $issymlink $try; then
17148                 $ls -l $try > reflect
17149                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17150                     echo "You have $type-like $try."
17151                     procselfexe='"'$try'"'
17152                     val="$define"
17153                     : This will break out of the loop
17154                     set X; shift
17155                 fi
17156             fi
17157         done
17158         ;;
17159 esac
17160 $rm -f reflect
17161 set d_procselfexe
17162 eval $setvar
17163
17164 : backward compatibility for d_hvfork
17165 if test X$d_hvfork != X; then
17166         d_vfork="$d_hvfork"
17167         d_hvfork=''
17168 fi
17169 : see if there is a vfork
17170 val=''
17171 set vfork val
17172 eval $inlibc
17173
17174 d_pseudofork=$undef
17175
17176 : Ok, but do we want to use it. vfork is reportedly unreliable in
17177 : perl on Solaris 2.x, and probably elsewhere.
17178 case "$val" in
17179 $define)
17180         echo " "
17181         case "$usevfork" in
17182         false) dflt='n';;
17183         *) dflt='y';;
17184         esac
17185         cat <<'EOM'
17186
17187 Perl can only use a vfork() that doesn't suffer from strict
17188 restrictions on calling functions or modifying global data in
17189 the child.  For example, glibc-2.1 contains such a vfork()
17190 that is unsuitable.  If your system provides a proper fork()
17191 call, chances are that you do NOT want perl to use vfork().
17192
17193 EOM
17194         rp="Do you still want to use vfork()?"
17195         . ./myread
17196         case "$ans" in
17197         y|Y) ;;
17198         *)
17199                 echo "Ok, we won't use vfork()."
17200                 val="$undef"
17201                 ;;
17202         esac
17203         ;;
17204 esac
17205 set d_vfork
17206 eval $setvar
17207 case "$d_vfork" in
17208 $define) usevfork='true';;
17209 *) usevfork='false';;
17210 esac
17211
17212 : see whether the pthread_atfork exists
17213 $cat >try.c <<EOP
17214 #include <pthread.h>
17215 #include <stdio.h>
17216 int main() {
17217 #ifdef  PTHREAD_ATFORK
17218         pthread_atfork(NULL,NULL,NULL);
17219 #endif
17220 }
17221 EOP
17222
17223 : see if pthread_atfork exists
17224 set try -DPTHREAD_ATFORK
17225 if eval $compile; then
17226     val="$define"
17227 else
17228     val="$undef"
17229 fi
17230 case "$usethreads" in
17231 $define)
17232         case "$val" in
17233         $define) echo 'pthread_atfork found.' >&4        ;;
17234         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17235         esac
17236 esac
17237 set d_pthread_atfork
17238 eval $setvar
17239
17240 : see if pthread_attr_setscope exists
17241 set pthread_attr_setscope d_pthread_attr_setscope
17242 eval $inlibc
17243
17244 : see whether the various POSIXish _yields exist
17245 $cat >try.c <<EOP
17246 #include <pthread.h>
17247 #include <stdio.h>
17248 int main() {
17249 #ifdef SCHED_YIELD
17250         sched_yield();
17251 #else
17252 #ifdef PTHREAD_YIELD
17253         pthread_yield();
17254 #else
17255 #ifdef PTHREAD_YIELD_NULL
17256         pthread_yield(NULL);
17257 #endif
17258 #endif
17259 #endif
17260 }
17261 EOP
17262 : see if sched_yield exists
17263 set try -DSCHED_YIELD
17264 if eval $compile; then
17265     val="$define"
17266     sched_yield='sched_yield()'
17267 else
17268     val="$undef"
17269 fi
17270 case "$usethreads" in
17271 $define)
17272         case "$val" in
17273         $define) echo 'sched_yield() found.' >&4        ;;
17274         *)       echo 'sched_yield() NOT found.' >&4    ;;
17275         esac
17276 esac
17277 set d_sched_yield
17278 eval $setvar
17279
17280 : see if pthread_yield exists
17281 set try -DPTHREAD_YIELD
17282 if eval $compile; then
17283     val="$define"
17284     case "$sched_yield" in
17285     '') sched_yield='pthread_yield()' ;;
17286     esac
17287 else
17288     set try -DPTHREAD_YIELD_NULL
17289     if eval $compile; then
17290         val="$define"
17291         case "$sched_yield" in
17292         '') sched_yield='pthread_yield(NULL)' ;;
17293         esac
17294     else
17295         val="$undef"
17296     fi
17297 fi
17298 case "$usethreads" in
17299 $define)
17300         case "$val" in
17301         $define) echo 'pthread_yield() found.' >&4      ;;
17302         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17303         esac
17304         ;;
17305 esac
17306 set d_pthread_yield
17307 eval $setvar
17308 case "$sched_yield" in
17309 '') sched_yield=undef ;;
17310 esac
17311 $rm_try
17312
17313 : check for ptrdiff_t
17314 echo " "
17315 echo "Checking to see if you have ptrdiff_t..." >&4
17316 $cat >try.c <<EOCP
17317 #include <stddef.h>
17318 int main() { ptrdiff_t x = 7; }
17319 EOCP
17320 set try
17321 if eval $compile; then
17322         val="$define"
17323         echo "You have ptrdiff_t."
17324 else
17325         val="$undef"
17326         echo "You do not have ptrdiff_t."
17327 fi
17328 $rm_try
17329 set d_ptrdiff_t
17330 eval $setvar
17331
17332 : see if random_r exists
17333 set random_r d_random_r
17334 eval $inlibc
17335 case "$d_random_r" in
17336 "$define")
17337         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17338         case "$d_random_r_proto:$usethreads" in
17339         ":define")      d_random_r_proto=define
17340                 set d_random_r_proto random_r $hdrs
17341                 eval $hasproto ;;
17342         *)      ;;
17343         esac
17344         case "$d_random_r_proto" in
17345         define)
17346         case "$random_r_proto" in
17347         ''|0) try='int random_r(int*, struct random_data*);'
17348         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17349         esac
17350         case "$random_r_proto" in
17351         ''|0) try='int random_r(long*, struct random_data*);'
17352         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17353         esac
17354         case "$random_r_proto" in
17355         ''|0) try='int random_r(struct random_data*, int32_t*);'
17356         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17357         esac
17358         case "$random_r_proto" in
17359         ''|0)   d_random_r=undef
17360                 random_r_proto=0
17361                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17362         * )     case "$random_r_proto" in
17363                 REENTRANT_PROTO*) ;;
17364                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17365                 esac
17366                 echo "Prototype: $try" ;;
17367         esac
17368         ;;
17369         *)      case "$usethreads" in
17370                 define) echo "random_r has no prototype, not using it." >&4 ;;
17371                 esac
17372                 d_random_r=undef
17373                 random_r_proto=0
17374                 ;;
17375         esac
17376         ;;
17377 *)      random_r_proto=0
17378         ;;
17379 esac
17380
17381 : see if readdir and friends exist
17382 set readdir d_readdir
17383 eval $inlibc
17384 set seekdir d_seekdir
17385 eval $inlibc
17386 set telldir d_telldir
17387 eval $inlibc
17388 set rewinddir d_rewinddir
17389 eval $inlibc
17390
17391 : see if readdir64_r exists
17392 set readdir64_r d_readdir64_r
17393 eval $inlibc
17394 case "$d_readdir64_r" in
17395 "$define")
17396         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17397         case "$d_readdir64_r_proto:$usethreads" in
17398         ":define")      d_readdir64_r_proto=define
17399                 set d_readdir64_r_proto readdir64_r $hdrs
17400                 eval $hasproto ;;
17401         *)      ;;
17402         esac
17403         case "$d_readdir64_r_proto" in
17404         define)
17405         case "$readdir64_r_proto" in
17406         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17407         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17408         esac
17409         case "$readdir64_r_proto" in
17410         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17411         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17412         esac
17413         case "$readdir64_r_proto" in
17414         ''|0)   d_readdir64_r=undef
17415                 readdir64_r_proto=0
17416                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17417         * )     case "$readdir64_r_proto" in
17418                 REENTRANT_PROTO*) ;;
17419                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17420                 esac
17421                 echo "Prototype: $try" ;;
17422         esac
17423         ;;
17424         *)      case "$usethreads" in
17425                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17426                 esac
17427                 d_readdir64_r=undef
17428                 readdir64_r_proto=0
17429                 ;;
17430         esac
17431         ;;
17432 *)      readdir64_r_proto=0
17433         ;;
17434 esac
17435
17436 : see if readdir_r exists
17437 set readdir_r d_readdir_r
17438 eval $inlibc
17439 case "$d_readdir_r" in
17440 "$define")
17441         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17442         case "$d_readdir_r_proto:$usethreads" in
17443         ":define")      d_readdir_r_proto=define
17444                 set d_readdir_r_proto readdir_r $hdrs
17445                 eval $hasproto ;;
17446         *)      ;;
17447         esac
17448         case "$d_readdir_r_proto" in
17449         define)
17450         case "$readdir_r_proto" in
17451         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17452         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17453         esac
17454         case "$readdir_r_proto" in
17455         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17456         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17457         esac
17458         case "$readdir_r_proto" in
17459         ''|0)   d_readdir_r=undef
17460                 readdir_r_proto=0
17461                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17462         * )     case "$readdir_r_proto" in
17463                 REENTRANT_PROTO*) ;;
17464                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17465                 esac
17466                 echo "Prototype: $try" ;;
17467         esac
17468         ;;
17469         *)      case "$usethreads" in
17470                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17471                 esac
17472                 d_readdir_r=undef
17473                 readdir_r_proto=0
17474                 ;;
17475         esac
17476         ;;
17477 *)      readdir_r_proto=0
17478         ;;
17479 esac
17480
17481 : see if readv exists
17482 set readv d_readv
17483 eval $inlibc
17484
17485 : see if recvmsg exists
17486 set recvmsg d_recvmsg
17487 eval $inlibc
17488
17489 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17490 echo " "
17491 if set regcomp val -f d_regcomp; eval $csym; $val; then
17492         echo 'regcomp() found.' >&4
17493         d_regcomp="$define"
17494         d_regcmp="$undef"
17495         d_re_comp="$undef"
17496 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17497         echo 'regcmp() found.' >&4
17498         d_regcmp="$define"
17499         d_regcomp="$undef"
17500         d_re_comp="$undef"
17501 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17502         echo 're_comp() found, assuming re_exec() also exists.' >&4
17503         d_re_comp="$define"
17504         d_regcomp="$undef"
17505         d_regcmp="$undef"
17506 else
17507         $cat >&4 <<EOM
17508 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17509 EOM
17510         d_regcmp="$undef"
17511         d_re_comp="$undef"
17512         d_regcomp="$undef"
17513 fi
17514
17515 : see if remainder exists
17516 set remainder d_remainder
17517 eval $inlibc
17518
17519 : see if remquo exists
17520 set remquo d_remquo
17521 eval $inlibc
17522
17523 : see if rename exists
17524 set rename d_rename
17525 eval $inlibc
17526
17527 : see if rint exists
17528 set rint d_rint
17529 eval $inlibc
17530
17531 : see if rmdir exists
17532 set rmdir d_rmdir
17533 eval $inlibc
17534
17535 : see if round exists
17536 set round d_round
17537 eval $inlibc
17538
17539 : see if memory.h is available.
17540 val=''
17541 set memory.h val
17542 eval $inhdr
17543
17544 : See if it conflicts with string.h
17545 case "$val" in
17546 $define)
17547         case "$strings" in
17548         '') ;;
17549         *)
17550                 $cppstdin $cppflags $cppminus < $strings > mem.h
17551                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
17552                         echo " "
17553                         echo "We won't be including <memory.h>."
17554                         val="$undef"
17555                 fi
17556                 $rm -f mem.h
17557                 ;;
17558         esac
17559 esac
17560 set i_memory
17561 eval $setvar
17562
17563 : can bcopy handle overlapping blocks?
17564 echo " "
17565 val="$undef"
17566 case "$d_memmove" in
17567 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
17568 *)      case "$d_bcopy" in
17569         "$define")
17570                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
17571                 $cat >try.c <<EOCP
17572 #$i_memory I_MEMORY
17573 #$i_stdlib I_STDLIB
17574 #$i_string I_STRING
17575 #$i_unistd I_UNISTD
17576 EOCP
17577         $cat >>try.c <<'EOCP'
17578 #include <stdio.h>
17579 #ifdef I_MEMORY
17580 #  include <memory.h>
17581 #endif
17582 #ifdef I_STDLIB
17583 #  include <stdlib.h>
17584 #endif
17585 #ifdef I_STRING
17586 #  include <string.h>
17587 #else
17588 #  include <strings.h>
17589 #endif
17590 #ifdef I_UNISTD
17591 #  include <unistd.h>  /* Needed for NetBSD */
17592 #endif
17593 int main()
17594 {
17595 char buf[128], abc[128];
17596 char *b;
17597 int len;
17598 int off;
17599 int align;
17600
17601 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17602    try to store the string in read-only memory. */
17603 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
17604
17605 for (align = 7; align >= 0; align--) {
17606         for (len = 36; len; len--) {
17607                 b = buf+align;
17608                 bcopy(abc, b, len);
17609                 for (off = 1; off <= len; off++) {
17610                         bcopy(b, b+off, len);
17611                         bcopy(b+off, b, len);
17612                         if (bcmp(b, abc, len))
17613                                 exit(1);
17614                 }
17615         }
17616 }
17617 exit(0);
17618 }
17619 EOCP
17620                 set try
17621                 if eval $compile_ok; then
17622                         if $run ./try 2>/dev/null; then
17623                                 echo "Yes, it can."
17624                                 val="$define"
17625                         else
17626                                 echo "It can't, sorry."
17627                         fi
17628                 else
17629                         echo "(I can't compile the test program, so we'll assume not...)"
17630                 fi
17631                 ;;
17632         esac
17633         $rm_try
17634         ;;
17635 esac
17636 set d_safebcpy
17637 eval $setvar
17638
17639 : can memcpy handle overlapping blocks?
17640 echo " "
17641 val="$undef"
17642 case "$d_memmove" in
17643 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
17644 *)      case "$d_memcpy" in
17645         "$define")
17646                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
17647                 $cat >try.c <<EOCP
17648 #$i_memory I_MEMORY
17649 #$i_stdlib I_STDLIB
17650 #$i_string I_STRING
17651 #$i_unistd I_UNISTD
17652 EOCP
17653         $cat >>try.c <<'EOCP'
17654 #include <stdio.h>
17655 #ifdef I_MEMORY
17656 #  include <memory.h>
17657 #endif
17658 #ifdef I_STDLIB
17659 #  include <stdlib.h>
17660 #endif
17661 #ifdef I_STRING
17662 #  include <string.h>
17663 #else
17664 #  include <strings.h>
17665 #endif
17666 #ifdef I_UNISTD
17667 #  include <unistd.h>  /* Needed for NetBSD */
17668 #endif
17669 int main()
17670 {
17671 char buf[128], abc[128];
17672 char *b;
17673 int len;
17674 int off;
17675 int align;
17676
17677 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17678    try to store the string in read-only memory. */
17679 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
17680
17681 for (align = 7; align >= 0; align--) {
17682         for (len = 36; len; len--) {
17683                 b = buf+align;
17684                 memcpy(b, abc, len);
17685                 for (off = 1; off <= len; off++) {
17686                         memcpy(b+off, b, len);
17687                         memcpy(b, b+off, len);
17688                         if (memcmp(b, abc, len))
17689                                 exit(1);
17690                 }
17691         }
17692 }
17693 exit(0);
17694 }
17695 EOCP
17696                 set try
17697                 if eval $compile_ok; then
17698                         if $run ./try 2>/dev/null; then
17699                                 echo "Yes, it can."
17700                                 val="$define"
17701                         else
17702                                 echo "It can't, sorry."
17703                         fi
17704                 else
17705                         echo "(I can't compile the test program, so we'll assume not...)"
17706                 fi
17707                 ;;
17708         esac
17709         $rm_try
17710         ;;
17711 esac
17712 set d_safemcpy
17713 eval $setvar
17714
17715 : can memcmp be trusted to compare relative magnitude?
17716 val="$undef"
17717 case "$d_memcmp" in
17718 "$define")
17719         echo " "
17720         echo "Checking if your memcmp() can compare relative magnitude..." >&4
17721         $cat >try.c <<EOCP
17722 #$i_memory I_MEMORY
17723 #$i_stdlib I_STDLIB
17724 #$i_string I_STRING
17725 #$i_unistd I_UNISTD
17726 EOCP
17727         $cat >>try.c <<'EOCP'
17728 #include <stdio.h>
17729 #ifdef I_MEMORY
17730 #  include <memory.h>
17731 #endif
17732 #ifdef I_STDLIB
17733 #  include <stdlib.h>
17734 #endif
17735 #ifdef I_STRING
17736 #  include <string.h>
17737 #else
17738 #  include <strings.h>
17739 #endif
17740 #ifdef I_UNISTD
17741 #  include <unistd.h>  /* Needed for NetBSD */
17742 #endif
17743 int main()
17744 {
17745 char a = -1;
17746 char b = 0;
17747 if ((a < b) && memcmp(&a, &b, 1) < 0)
17748         exit(1);
17749 exit(0);
17750 }
17751 EOCP
17752         set try
17753         if eval $compile_ok; then
17754                 if $run ./try 2>/dev/null; then
17755                         echo "Yes, it can."
17756                         val="$define"
17757                 else
17758                         echo "No, it can't (it uses signed chars)."
17759                 fi
17760         else
17761                 echo "(I can't compile the test program, so we'll assume not...)"
17762         fi
17763         ;;
17764 esac
17765 $rm_try
17766 set d_sanemcmp
17767 eval $setvar
17768
17769 : see if prototype for sbrk is available
17770 echo " "
17771 set d_sbrkproto sbrk $i_unistd unistd.h
17772 eval $hasproto
17773
17774 : see if scalbn exists
17775 set scalbn d_scalbn
17776 eval $inlibc
17777
17778 : see if select exists
17779 set select d_select
17780 eval $inlibc
17781
17782 : see if semctl exists
17783 set semctl d_semctl
17784 eval $inlibc
17785
17786 : see if semget exists
17787 set semget d_semget
17788 eval $inlibc
17789
17790 : see if semop exists
17791 set semop d_semop
17792 eval $inlibc
17793
17794 : see how much of the 'sem*(2)' library is present.
17795 h_sem=true
17796 echo " "
17797 case "$d_semctl$d_semget$d_semop" in
17798 *"$undef"*) h_sem=false;;
17799 esac
17800 case "$osname" in
17801 freebsd)
17802     case "`ipcs 2>&1`" in
17803     "SVID messages"*"not configured"*)
17804         echo "Your $osname does not have the sem*(2) configured." >&4
17805         h_sem=false
17806         val="$undef"
17807         set semctl d_semctl
17808         eval $setvar
17809         set semget d_semget
17810         eval $setvar
17811         set semop d_semop
17812         eval $setvar
17813         ;;
17814     esac
17815     ;;
17816 esac
17817 : we could also check for sys/ipc.h ...
17818 if $h_sem && $test `./findhdr sys/sem.h`; then
17819         echo "You have the full sem*(2) library." >&4
17820         val="$define"
17821 else
17822         echo "You don't have the full sem*(2) library." >&4
17823         val="$undef"
17824 fi
17825 set d_sem
17826 eval $setvar
17827
17828 : see whether sys/sem.h defines union semun
17829 echo " "
17830 $cat > try.c <<'END'
17831 #include <sys/types.h>
17832 #include <sys/ipc.h>
17833 #include <sys/sem.h>
17834 int main () { union semun semun; semun.buf = 0; }
17835 END
17836 set try
17837 if eval $compile; then
17838     echo "You have union semun in <sys/sem.h>." >&4
17839     val="$define"
17840 else
17841     echo "You do not have union semun in <sys/sem.h>." >&4
17842     val="$undef"
17843 fi
17844 $rm_try
17845 set d_union_semun
17846 eval $setvar
17847
17848 : see how to do semctl IPC_STAT
17849 case "$d_sem" in
17850 $define)
17851     echo " "
17852     $cat > tryh.h <<END
17853 #ifndef S_IRUSR
17854 #   ifdef S_IREAD
17855 #       define S_IRUSR S_IREAD
17856 #       define S_IWUSR S_IWRITE
17857 #       define S_IXUSR S_IEXEC
17858 #   else
17859 #       define S_IRUSR 0400
17860 #       define S_IWUSR 0200
17861 #       define S_IXUSR 0100
17862 #   endif
17863 #   define S_IRGRP (S_IRUSR>>3)
17864 #   define S_IWGRP (S_IWUSR>>3)
17865 #   define S_IXGRP (S_IXUSR>>3)
17866 #   define S_IROTH (S_IRUSR>>6)
17867 #   define S_IWOTH (S_IWUSR>>6)
17868 #   define S_IXOTH (S_IXUSR>>6)
17869 #endif
17870 #ifndef S_IRWXU
17871 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17872 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17873 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17874 #endif
17875 END
17876     : see whether semctl IPC_STAT can use union semun
17877     case "$d_semctl_semun" in
17878     '')
17879       val="$undef"
17880       $cat > try.c <<END
17881 #include <sys/types.h>
17882 #include <sys/ipc.h>
17883 #include <sys/sem.h>
17884 #include <sys/stat.h>
17885 #include <stdio.h>
17886 #include <errno.h>
17887 #include "tryh.h"
17888 #ifndef errno
17889 extern int errno;
17890 #endif
17891 #$d_union_semun HAS_UNION_SEMUN
17892 int main() {
17893     union semun
17894 #ifndef HAS_UNION_SEMUN
17895     {
17896         int val;
17897         struct semid_ds *buf;
17898         unsigned short *array;
17899     }
17900 #endif
17901     arg;
17902     int sem, st;
17903
17904 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17905     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17906     if (sem > -1) {
17907         struct semid_ds argbuf;
17908         arg.buf = &argbuf;
17909 #       ifdef IPC_STAT
17910         st = semctl(sem, 0, IPC_STAT, arg);
17911         if (st == 0)
17912             printf("semun\n");
17913         else
17914 #       endif /* IPC_STAT */
17915             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17916 #       ifdef IPC_RMID
17917         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17918 #       endif /* IPC_RMID */
17919             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17920     } else
17921 #endif /* IPC_PRIVATE && ... */
17922         printf("semget failed: errno = %d\n", errno);
17923   return 0;
17924 }
17925 END
17926       set try
17927       if eval $compile; then
17928           xxx=`$run ./try`
17929           case "$xxx" in
17930           semun) val="$define" ;;
17931           esac
17932       fi
17933       $rm_try
17934       set d_semctl_semun
17935       eval $setvar
17936       ;;
17937     esac
17938     case "$d_semctl_semun" in
17939     $define)
17940         echo "You can use union semun for semctl IPC_STAT." >&4
17941         also='also'
17942         ;;
17943     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17944         also=''
17945         ;;
17946     esac
17947
17948     : see whether semctl IPC_STAT can use struct semid_ds pointer
17949     case "$d_semctl_semid_ds" in
17950     '')
17951       val="$undef"
17952       $cat > try.c <<'END'
17953 #include <sys/types.h>
17954 #include <sys/ipc.h>
17955 #include <sys/sem.h>
17956 #include <sys/stat.h>
17957 #include "tryh.h"
17958 #include <stdio.h>
17959 #include <errno.h>
17960 #ifndef errno
17961 extern int errno;
17962 #endif
17963 int main() {
17964     struct semid_ds arg;
17965     int sem, st;
17966
17967 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17968     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17969     if (sem > -1) {
17970 #       ifdef IPC_STAT
17971         st = semctl(sem, 0, IPC_STAT, &arg);
17972         if (st == 0)
17973             printf("semid_ds\n");
17974         else
17975 #       endif /* IPC_STAT */
17976             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17977 #       ifdef IPC_RMID
17978         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
17979 #       endif /* IPC_RMID */
17980             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17981     } else
17982 #endif /* IPC_PRIVATE && ... */
17983         printf("semget failed: errno = %d\n", errno);
17984
17985     return 0;
17986 }
17987 END
17988       set try
17989       if eval $compile; then
17990           xxx=`$run ./try`
17991           case "$xxx" in
17992           semid_ds) val="$define" ;;
17993           esac
17994       fi
17995       $rm_try
17996       set d_semctl_semid_ds
17997       eval $setvar
17998       ;;
17999     esac
18000     case "$d_semctl_semid_ds" in
18001     $define)
18002         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
18003         ;;
18004     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
18005         ;;
18006     esac
18007     ;;
18008 *)  val="$undef"
18009
18010     # We do not have the full sem*(2) library, so assume we can not
18011     # use either.
18012
18013     set d_semctl_semun
18014     eval $setvar
18015
18016     set d_semctl_semid_ds
18017     eval $setvar
18018     ;;
18019 esac
18020 $rm_try tryh.h
18021
18022 : see if sendmsg exists
18023 set sendmsg d_sendmsg
18024 eval $inlibc
18025
18026 : see if setegid exists
18027 set setegid d_setegid
18028 eval $inlibc
18029
18030 : see if seteuid exists
18031 set seteuid d_seteuid
18032 eval $inlibc
18033
18034 : see if setgrent exists
18035 set setgrent d_setgrent
18036 eval $inlibc
18037
18038 : see if setgrent_r exists
18039 set setgrent_r d_setgrent_r
18040 eval $inlibc
18041 case "$d_setgrent_r" in
18042 "$define")
18043         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
18044         case "$d_setgrent_r_proto:$usethreads" in
18045         ":define")      d_setgrent_r_proto=define
18046                 set d_setgrent_r_proto setgrent_r $hdrs
18047                 eval $hasproto ;;
18048         *)      ;;
18049         esac
18050         case "$d_setgrent_r_proto" in
18051         define)
18052         case "$setgrent_r_proto" in
18053         ''|0) try='int setgrent_r(FILE**);'
18054         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
18055         esac
18056         case "$setgrent_r_proto" in
18057         ''|0) try='void setgrent_r(FILE**);'
18058         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
18059         esac
18060         case "$setgrent_r_proto" in
18061         ''|0)   d_setgrent_r=undef
18062                 setgrent_r_proto=0
18063                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
18064         * )     case "$setgrent_r_proto" in
18065                 REENTRANT_PROTO*) ;;
18066                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
18067                 esac
18068                 echo "Prototype: $try" ;;
18069         esac
18070         ;;
18071         *)      case "$usethreads" in
18072                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
18073                 esac
18074                 d_setgrent_r=undef
18075                 setgrent_r_proto=0
18076                 ;;
18077         esac
18078         ;;
18079 *)      setgrent_r_proto=0
18080         ;;
18081 esac
18082
18083 : see if sethostent exists
18084 set sethostent d_sethent
18085 eval $inlibc
18086
18087 : see if sethostent_r exists
18088 set sethostent_r d_sethostent_r
18089 eval $inlibc
18090 case "$d_sethostent_r" in
18091 "$define")
18092         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18093         case "$d_sethostent_r_proto:$usethreads" in
18094         ":define")      d_sethostent_r_proto=define
18095                 set d_sethostent_r_proto sethostent_r $hdrs
18096                 eval $hasproto ;;
18097         *)      ;;
18098         esac
18099         case "$d_sethostent_r_proto" in
18100         define)
18101         case "$sethostent_r_proto" in
18102         ''|0) try='int sethostent_r(int, struct hostent_data*);'
18103         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
18104         esac
18105         case "$sethostent_r_proto" in
18106         ''|0) try='void sethostent_r(int, struct hostent_data*);'
18107         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
18108         esac
18109         case "$sethostent_r_proto" in
18110         ''|0)   d_sethostent_r=undef
18111                 sethostent_r_proto=0
18112                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
18113         * )     case "$sethostent_r_proto" in
18114                 REENTRANT_PROTO*) ;;
18115                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
18116                 esac
18117                 echo "Prototype: $try" ;;
18118         esac
18119         ;;
18120         *)      case "$usethreads" in
18121                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
18122                 esac
18123                 d_sethostent_r=undef
18124                 sethostent_r_proto=0
18125                 ;;
18126         esac
18127         ;;
18128 *)      sethostent_r_proto=0
18129         ;;
18130 esac
18131
18132 : see if setitimer exists
18133 set setitimer d_setitimer
18134 eval $inlibc
18135
18136 : see if setlinebuf exists
18137 set setlinebuf d_setlinebuf
18138 eval $inlibc
18139
18140 : see if setlocale exists
18141 set setlocale d_setlocale
18142 eval $inlibc
18143
18144 : see if locale.h is available
18145 set locale.h i_locale
18146 eval $inhdr
18147
18148 : see if setlocale_r exists
18149 set setlocale_r d_setlocale_r
18150 eval $inlibc
18151 case "$d_setlocale_r" in
18152 "$define")
18153         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18154         case "$d_setlocale_r_proto:$usethreads" in
18155         ":define")      d_setlocale_r_proto=define
18156                 set d_setlocale_r_proto setlocale_r $hdrs
18157                 eval $hasproto ;;
18158         *)      ;;
18159         esac
18160         case "$d_setlocale_r_proto" in
18161         define)
18162         case "$setlocale_r_proto" in
18163         ''|0) try='int setlocale_r(int, const char*, char*, int);'
18164         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18165         esac
18166         case "$setlocale_r_proto" in
18167         ''|0)   d_setlocale_r=undef
18168                 setlocale_r_proto=0
18169                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18170         * )     case "$setlocale_r_proto" in
18171                 REENTRANT_PROTO*) ;;
18172                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18173                 esac
18174                 echo "Prototype: $try" ;;
18175         esac
18176         ;;
18177         *)      case "$usethreads" in
18178                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18179                 esac
18180                 d_setlocale_r=undef
18181                 setlocale_r_proto=0
18182                 ;;
18183         esac
18184         ;;
18185 *)      setlocale_r_proto=0
18186         ;;
18187 esac
18188
18189 : see if setnetent exists
18190 set setnetent d_setnent
18191 eval $inlibc
18192
18193 : see if setnetent_r exists
18194 set setnetent_r d_setnetent_r
18195 eval $inlibc
18196 case "$d_setnetent_r" in
18197 "$define")
18198         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18199         case "$d_setnetent_r_proto:$usethreads" in
18200         ":define")      d_setnetent_r_proto=define
18201                 set d_setnetent_r_proto setnetent_r $hdrs
18202                 eval $hasproto ;;
18203         *)      ;;
18204         esac
18205         case "$d_setnetent_r_proto" in
18206         define)
18207         case "$setnetent_r_proto" in
18208         ''|0) try='int setnetent_r(int, struct netent_data*);'
18209         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18210         esac
18211         case "$setnetent_r_proto" in
18212         ''|0) try='void setnetent_r(int, struct netent_data*);'
18213         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18214         esac
18215         case "$setnetent_r_proto" in
18216         ''|0)   d_setnetent_r=undef
18217                 setnetent_r_proto=0
18218                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18219         * )     case "$setnetent_r_proto" in
18220                 REENTRANT_PROTO*) ;;
18221                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18222                 esac
18223                 echo "Prototype: $try" ;;
18224         esac
18225         ;;
18226         *)      case "$usethreads" in
18227                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18228                 esac
18229                 d_setnetent_r=undef
18230                 setnetent_r_proto=0
18231                 ;;
18232         esac
18233         ;;
18234 *)      setnetent_r_proto=0
18235         ;;
18236 esac
18237
18238 : see if setprotoent exists
18239 set setprotoent d_setpent
18240 eval $inlibc
18241
18242 : see if setpgid exists
18243 set setpgid d_setpgid
18244 eval $inlibc
18245
18246 : see if setpgrp2 exists
18247 set setpgrp2 d_setpgrp2
18248 eval $inlibc
18249
18250 : see if setpriority exists
18251 set setpriority d_setprior
18252 eval $inlibc
18253
18254 : see if setproctitle exists
18255 set setproctitle d_setproctitle
18256 eval $inlibc
18257
18258 : see if setprotoent_r exists
18259 set setprotoent_r d_setprotoent_r
18260 eval $inlibc
18261 case "$d_setprotoent_r" in
18262 "$define")
18263         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18264         case "$d_setprotoent_r_proto:$usethreads" in
18265         ":define")      d_setprotoent_r_proto=define
18266                 set d_setprotoent_r_proto setprotoent_r $hdrs
18267                 eval $hasproto ;;
18268         *)      ;;
18269         esac
18270         case "$d_setprotoent_r_proto" in
18271         define)
18272         case "$setprotoent_r_proto" in
18273         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18274         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18275         esac
18276         case "$setprotoent_r_proto" in
18277         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18278         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18279         esac
18280         case "$setprotoent_r_proto" in
18281         ''|0)   d_setprotoent_r=undef
18282                 setprotoent_r_proto=0
18283                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18284         * )     case "$setprotoent_r_proto" in
18285                 REENTRANT_PROTO*) ;;
18286                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18287                 esac
18288                 echo "Prototype: $try" ;;
18289         esac
18290         ;;
18291         *)      case "$usethreads" in
18292                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18293                 esac
18294                 d_setprotoent_r=undef
18295                 setprotoent_r_proto=0
18296                 ;;
18297         esac
18298         ;;
18299 *)      setprotoent_r_proto=0
18300         ;;
18301 esac
18302
18303 : see if setpwent exists
18304 set setpwent d_setpwent
18305 eval $inlibc
18306
18307 : see if setpwent_r exists
18308 set setpwent_r d_setpwent_r
18309 eval $inlibc
18310 case "$d_setpwent_r" in
18311 "$define")
18312         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18313         case "$d_setpwent_r_proto:$usethreads" in
18314         ":define")      d_setpwent_r_proto=define
18315                 set d_setpwent_r_proto setpwent_r $hdrs
18316                 eval $hasproto ;;
18317         *)      ;;
18318         esac
18319         case "$d_setpwent_r_proto" in
18320         define)
18321         case "$setpwent_r_proto" in
18322         ''|0) try='int setpwent_r(FILE**);'
18323         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18324         esac
18325         case "$setpwent_r_proto" in
18326         ''|0) try='void setpwent_r(FILE**);'
18327         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18328         esac
18329         case "$setpwent_r_proto" in
18330         ''|0)   d_setpwent_r=undef
18331                 setpwent_r_proto=0
18332                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18333         * )     case "$setpwent_r_proto" in
18334                 REENTRANT_PROTO*) ;;
18335                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18336                 esac
18337                 echo "Prototype: $try" ;;
18338         esac
18339         ;;
18340         *)      case "$usethreads" in
18341                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18342                 esac
18343                 d_setpwent_r=undef
18344                 setpwent_r_proto=0
18345                 ;;
18346         esac
18347         ;;
18348 *)      setpwent_r_proto=0
18349         ;;
18350 esac
18351
18352 : see if setregid exists
18353 set setregid d_setregid
18354 eval $inlibc
18355 set setresgid d_setresgid
18356 eval $inlibc
18357
18358 : see if setreuid exists
18359 set setreuid d_setreuid
18360 eval $inlibc
18361 set setresuid d_setresuid
18362 eval $inlibc
18363
18364 : see if setrgid exists
18365 set setrgid d_setrgid
18366 eval $inlibc
18367
18368 : see if setruid exists
18369 set setruid d_setruid
18370 eval $inlibc
18371
18372 : see if setservent exists
18373 set setservent d_setsent
18374 eval $inlibc
18375
18376 : see if setservent_r exists
18377 set setservent_r d_setservent_r
18378 eval $inlibc
18379 case "$d_setservent_r" in
18380 "$define")
18381         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18382         case "$d_setservent_r_proto:$usethreads" in
18383         ":define")      d_setservent_r_proto=define
18384                 set d_setservent_r_proto setservent_r $hdrs
18385                 eval $hasproto ;;
18386         *)      ;;
18387         esac
18388         case "$d_setservent_r_proto" in
18389         define)
18390         case "$setservent_r_proto" in
18391         ''|0) try='int setservent_r(int, struct servent_data*);'
18392         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18393         esac
18394         case "$setservent_r_proto" in
18395         ''|0) try='void setservent_r(int, struct servent_data*);'
18396         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18397         esac
18398         case "$setservent_r_proto" in
18399         ''|0)   d_setservent_r=undef
18400                 setservent_r_proto=0
18401                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18402         * )     case "$setservent_r_proto" in
18403                 REENTRANT_PROTO*) ;;
18404                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18405                 esac
18406                 echo "Prototype: $try" ;;
18407         esac
18408         ;;
18409         *)      case "$usethreads" in
18410                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18411                 esac
18412                 d_setservent_r=undef
18413                 setservent_r_proto=0
18414                 ;;
18415         esac
18416         ;;
18417 *)      setservent_r_proto=0
18418         ;;
18419 esac
18420
18421 : see if setsid exists
18422 set setsid d_setsid
18423 eval $inlibc
18424
18425 : see if setvbuf exists
18426 set setvbuf d_setvbuf
18427 eval $inlibc
18428
18429 : see if shmctl exists
18430 set shmctl d_shmctl
18431 eval $inlibc
18432
18433 : see if shmget exists
18434 set shmget d_shmget
18435 eval $inlibc
18436
18437 : see if shmat exists
18438 set shmat d_shmat
18439 eval $inlibc
18440 : see what shmat returns
18441 case "$d_shmat" in
18442 "$define")
18443         $cat >shmat.c <<'END'
18444 #include <sys/shm.h>
18445 void *shmat();
18446 END
18447         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18448                 shmattype='void *'
18449         else
18450                 shmattype='char *'
18451         fi
18452         echo "and it returns ($shmattype)." >&4
18453         : see if a prototype for shmat is available
18454         xxx=`./findhdr sys/shm.h`
18455         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18456         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18457                 val="$define"
18458         else
18459                 val="$undef"
18460         fi
18461         $rm -f shmat.[co]
18462         ;;
18463 *)
18464         val="$undef"
18465         ;;
18466 esac
18467 set d_shmatprototype
18468 eval $setvar
18469
18470 : see if shmdt exists
18471 set shmdt d_shmdt
18472 eval $inlibc
18473
18474 : see how much of the 'shm*(2)' library is present.
18475 h_shm=true
18476 echo " "
18477 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18478 *"$undef"*) h_shm=false;;
18479 esac
18480 case "$osname" in
18481 freebsd)
18482     case "`ipcs 2>&1`" in
18483     "SVID shared memory"*"not configured"*)
18484         echo "Your $osname does not have the shm*(2) configured." >&4
18485         h_shm=false
18486         val="$undef"
18487         set shmctl d_shmctl
18488         eval $setvar
18489         set shmget d_shmget
18490         eval $setvar
18491         set shmat d_shmat
18492         eval $setvar
18493         set shmdt d_shmdt
18494         eval $setvar
18495         ;;
18496     esac
18497     ;;
18498 esac
18499 : we could also check for sys/ipc.h ...
18500 if $h_shm && $test `./findhdr sys/shm.h`; then
18501         echo "You have the full shm*(2) library." >&4
18502         val="$define"
18503 else
18504         echo "You don't have the full shm*(2) library." >&4
18505         val="$undef"
18506 fi
18507 set d_shm
18508 eval $setvar
18509
18510 : see if we have sigaction
18511 echo " "
18512 if set sigaction val -f d_sigaction; eval $csym; $val; then
18513         echo 'sigaction() found.' >&4
18514         $cat > try.c <<EOP
18515 #include <stdio.h>
18516 #include <sys/types.h>
18517 #include <signal.h>
18518 #$i_stdlib I_STDLIB
18519 #ifdef I_STDLIB
18520 #include <stdlib.h>
18521 #endif
18522 int main()
18523 {
18524     struct sigaction act, oact;
18525     act.sa_flags = 0;
18526     oact.sa_handler = 0;
18527     /* so that act and oact are used */
18528     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18529 }
18530 EOP
18531         set try
18532         if eval $compile_ok; then
18533                 val="$define"
18534         else
18535                 echo "But you don't seem to have a usable struct sigaction." >&4
18536                 val="$undef"
18537         fi
18538 else
18539         echo 'sigaction NOT found.' >&4
18540         val="$undef"
18541 fi
18542 set d_sigaction; eval $setvar
18543 $rm_try
18544
18545 : see if this is a sunmath.h system
18546 set sunmath.h i_sunmath
18547 eval $inhdr
18548
18549 : see if signbit exists
18550 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18551 $cat >try.c <<EOCP
18552 #$i_math I_MATH
18553 #$i_sunmath I_SUNMATH
18554 #ifdef I_MATH
18555 #  include <math.h>
18556 #endif
18557 #ifdef I_SUNMATH  /* Solaris special math library */
18558 #  include <sunmath.h>
18559 #endif
18560 #define NV $nvtype
18561 int main(int argc, char **argv)
18562 {
18563     NV x = 0.0;
18564     NV y = -0.0;
18565     if ((signbit(x) == 0) && (signbit(y) != 0))
18566         return 0;
18567     else
18568         return 1;
18569 }
18570 EOCP
18571 val="$undef"
18572 set try
18573 if eval $compile; then
18574     if $run ./try; then
18575         $echo "Yes." >&4
18576         val="$define"
18577     else
18578         $echo "Signbit seems to be available, but doesn't work as I expected."
18579         $echo "I won't use it." >&4
18580         val="$undef"
18581     fi
18582 else
18583     $echo "Nope." >&4
18584     dflt="$undef"
18585 fi
18586 set d_signbit
18587 eval $setvar
18588 $rm_try
18589
18590 : see if sigprocmask exists
18591 set sigprocmask d_sigprocmask
18592 eval $inlibc
18593
18594 : see if sigsetjmp exists
18595 echo " "
18596 case "$d_sigsetjmp" in
18597 '')
18598         $cat >try.c <<EOP
18599 #include <setjmp.h>
18600 #$i_stdlib I_STDLIB
18601 #ifdef I_STDLIB
18602 #include <stdlib.h>
18603 #endif
18604 sigjmp_buf env;
18605 int set = 1;
18606 int main()
18607 {
18608         if (sigsetjmp(env,1))
18609                 exit(set);
18610         set = 0;
18611         siglongjmp(env, 1);
18612         exit(1);
18613 }
18614 EOP
18615         set try
18616         if eval $compile; then
18617                 if $run ./try >/dev/null 2>&1; then
18618                         echo "POSIX sigsetjmp found." >&4
18619                         val="$define"
18620                 else
18621                         $cat >&4 <<EOM
18622 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18623 I'll ignore them.
18624 EOM
18625                         val="$undef"
18626                 fi
18627         else
18628                 echo "sigsetjmp not found." >&4
18629                 val="$undef"
18630         fi
18631         ;;
18632 *) val="$d_sigsetjmp"
18633         case "$d_sigsetjmp" in
18634         $define) echo "POSIX sigsetjmp found." >&4;;
18635         $undef) echo "sigsetjmp not found." >&4;;
18636         esac
18637         ;;
18638 esac
18639 set d_sigsetjmp
18640 eval $setvar
18641 $rm_try
18642
18643 : see if snprintf exists
18644 set snprintf d_snprintf
18645 eval $inlibc
18646
18647 : see if vsnprintf exists
18648 set vsnprintf d_vsnprintf
18649 eval $inlibc
18650
18651 case "$d_snprintf-$d_vsnprintf" in
18652 "$define-$define")
18653     $cat <<EOM
18654 Checking whether your snprintf() and vsnprintf() work okay...
18655 EOM
18656     $cat >try.c <<'EOCP'
18657 /* v?snprintf testing logic courtesy of Russ Allbery.
18658  * According to C99:
18659  * - if the buffer is too short it still must be \0-terminated
18660  * - if the buffer is too short the potentially required length
18661  *   must be returned and not -1
18662  * - if the buffer is NULL the potentially required length
18663  *   must be returned and not -1 or core dump
18664  */
18665 #include <stdio.h>
18666 #include <stdarg.h>
18667
18668 char buf[2];
18669
18670 int test (char *format, ...)
18671 {
18672     va_list args;
18673     int count;
18674
18675     va_start (args, format);
18676     count = vsnprintf (buf, sizeof buf, format, args);
18677     va_end (args);
18678     return count;
18679 }
18680
18681 int main ()
18682 {
18683     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18684              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18685 }
18686 EOCP
18687     set try
18688     if eval $compile; then
18689         `$run ./try`
18690         case "$?" in
18691         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18692         *) cat <<EOM >&4
18693 Your snprintf() and snprintf() don't seem to be working okay.
18694 EOM
18695            d_snprintf="$undef"
18696            d_vsnprintf="$undef"
18697            ;;
18698         esac
18699     else
18700         echo "(I can't seem to compile the test program--assuming they don't)"
18701         d_snprintf="$undef"
18702         d_vsnprintf="$undef"
18703     fi
18704     $rm_try
18705     ;;
18706 esac
18707
18708 : see if sockatmark exists
18709 set sockatmark d_sockatmark
18710 eval $inlibc
18711
18712 : see if prototype for sockatmark is available
18713 echo " "
18714 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18715 eval $hasproto
18716
18717 : see if socks5_init exists
18718 set socks5_init d_socks5_init
18719 eval $inlibc
18720
18721 : see if sprintf returns the length of the string in the buffer as per ANSI
18722 $echo "Checking whether sprintf returns the length of the string..." >&4
18723 $cat <<EOP >try.c
18724 #include <stdio.h>
18725 #$i_stdlib I_STDLIB
18726 #ifdef I_STDLIB
18727 #include <stdlib.h>
18728 #endif
18729 #$i_string I_STRING
18730 #ifdef I_STRING
18731 #  include <string.h>
18732 #else
18733 #  include <strings.h>
18734 #endif
18735 #$i_math I_MATH
18736 #ifdef I_MATH
18737 #include <math.h>
18738 #endif
18739
18740 char buffer[256];
18741
18742 int check (size_t expect, int test) {
18743   size_t got = strlen(buffer);
18744   if (expect == got)
18745     return 0;
18746
18747   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
18748        test, buffer);
18749   exit (test);
18750 }
18751
18752 int main(int argc, char **argv) {
18753   int test = 0;
18754
18755   check(sprintf(buffer, ""), ++test);
18756   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
18757   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
18758
18759   return 0;
18760 }
18761 EOP
18762 set try
18763
18764 if eval $compile; then
18765     xxx="`$run ./try`"
18766     case "$?" in
18767         0) cat >&4 <<EOM
18768 sprintf returns the length of the string (as ANSI says it should)
18769 EOM
18770         d_sprintf_returns_strlen="$define"
18771         ;;
18772         *) cat >&4 <<EOM
18773 sprintf does not return the length of the string (how old is this system?)
18774 EOM
18775         d_sprintf_returns_strlen="$undef"
18776         ;;
18777     esac
18778 else
18779     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
18780     d_sprintf_returns_strlen="$undef"
18781 fi
18782 $rm_try
18783
18784 : see if srand48_r exists
18785 set srand48_r d_srand48_r
18786 eval $inlibc
18787 case "$d_srand48_r" in
18788 "$define")
18789         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18790         case "$d_srand48_r_proto:$usethreads" in
18791         ":define")      d_srand48_r_proto=define
18792                 set d_srand48_r_proto srand48_r $hdrs
18793                 eval $hasproto ;;
18794         *)      ;;
18795         esac
18796         case "$d_srand48_r_proto" in
18797         define)
18798         case "$srand48_r_proto" in
18799         ''|0) try='int srand48_r(long, struct drand48_data*);'
18800         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18801         esac
18802         case "$srand48_r_proto" in
18803         ''|0)   d_srand48_r=undef
18804                 srand48_r_proto=0
18805                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18806         * )     case "$srand48_r_proto" in
18807                 REENTRANT_PROTO*) ;;
18808                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18809                 esac
18810                 echo "Prototype: $try" ;;
18811         esac
18812         ;;
18813         *)      case "$usethreads" in
18814                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18815                 esac
18816                 d_srand48_r=undef
18817                 srand48_r_proto=0
18818                 ;;
18819         esac
18820         ;;
18821 *)      srand48_r_proto=0
18822         ;;
18823 esac
18824
18825 : see if srandom_r exists
18826 set srandom_r d_srandom_r
18827 eval $inlibc
18828 case "$d_srandom_r" in
18829 "$define")
18830         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18831         case "$d_srandom_r_proto:$usethreads" in
18832         ":define")      d_srandom_r_proto=define
18833                 set d_srandom_r_proto srandom_r $hdrs
18834                 eval $hasproto ;;
18835         *)      ;;
18836         esac
18837         case "$d_srandom_r_proto" in
18838         define)
18839         case "$srandom_r_proto" in
18840         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18841         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18842         esac
18843         case "$srandom_r_proto" in
18844         ''|0)   d_srandom_r=undef
18845                 srandom_r_proto=0
18846                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18847         * )     case "$srandom_r_proto" in
18848                 REENTRANT_PROTO*) ;;
18849                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18850                 esac
18851                 echo "Prototype: $try" ;;
18852         esac
18853         ;;
18854         *)      case "$usethreads" in
18855                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18856                 esac
18857                 d_srandom_r=undef
18858                 srandom_r_proto=0
18859                 ;;
18860         esac
18861         ;;
18862 *)      srandom_r_proto=0
18863         ;;
18864 esac
18865
18866 : see if prototype for setresgid is available
18867 echo " "
18868 set d_sresgproto setresgid $i_unistd unistd.h
18869 eval $hasproto
18870
18871 : see if prototype for setresuid is available
18872 echo " "
18873 set d_sresuproto setresuid $i_unistd unistd.h
18874 eval $hasproto
18875
18876 : see if stat exists
18877 set stat d_stat
18878 eval $inlibc
18879
18880 : see if sys/stat.h is available
18881 set sys/stat.h i_sysstat
18882 eval $inhdr
18883
18884 : see if stat knows about block sizes
18885 echo " "
18886 echo "Checking to see if your struct stat has st_blocks field..." >&4
18887 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18888 eval $hasfield
18889
18890 : see if this is a sys/vfs.h system
18891 set sys/vfs.h i_sysvfs
18892 eval $inhdr
18893
18894 : see if this is a sys/statfs.h system
18895 set sys/statfs.h i_sysstatfs
18896 eval $inhdr
18897
18898 : Check for statfs_s
18899 echo " "
18900 echo "Checking to see if your system supports struct statfs..." >&4
18901 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
18902 eval $hasstruct
18903 case "$d_statfs_s" in
18904 "$define")      echo "Yes, it does."   ;;
18905 *)              echo "No, it doesn't." ;;
18906 esac
18907
18908
18909 : see if struct statfs knows about f_flags
18910 case "$d_statfs_s" in
18911 define)
18912         echo " "
18913         echo "Checking to see if your struct statfs has f_flags field..." >&4
18914         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
18915         eval $hasfield
18916         ;;
18917 *)      val="$undef"
18918         set d_statfs_f_flags
18919         eval $setvar
18920         ;;
18921 esac
18922 case "$d_statfs_f_flags" in
18923 "$define")      echo "Yes, it does."   ;;
18924 *)              echo "No, it doesn't." ;;
18925 esac
18926
18927 : see what flavor, if any, of static inline is supported
18928 echo " "
18929 echo "Checking to see if your system supports static inline..."
18930 $cat > try.c <<'EOCP'
18931 #include <stdlib.h>
18932 extern int f_via_a(int x);
18933 extern int f_via_b(int x);
18934 int main(int argc, char **argv)
18935 {
18936     int y;
18937
18938     y = f_via_a(0);
18939 #ifdef USE_B
18940     y = f_via_b(0);
18941 #endif
18942     if (y == 42) {
18943         return EXIT_SUCCESS;
18944     }
18945     else {
18946         return EXIT_FAILURE;
18947     }
18948 }
18949 EOCP
18950 $cat > a.c <<'EOCP'
18951 static INLINE int f(int x) {
18952     int y;
18953     y = x + 42;
18954     return y;
18955 }
18956
18957 int f_via_a(int x)
18958 {
18959     return f(x);
18960 }
18961 EOCP
18962 $cat > b.c <<'EOCP'
18963 extern int f(int x);
18964
18965 int f_via_b(int x)
18966 {
18967     return f(x);
18968 }
18969 EOCP
18970
18971 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18972 case "$perl_static_inline" in
18973 '')     # Check the various possibilities, and break out on success.
18974         # For gcc, prefer __inline__, which will still permit
18975         # cflags.SH to add in -ansi.
18976         case "$gccversion" in
18977                 '') xxx="inline __inline__ __inline _inline";;
18978                 *)  xxx="__inline__ inline __inline _inline";;
18979         esac
18980         for inline in $xxx; do
18981                 set try -DINLINE=$inline a.c
18982                 if eval $compile && $run ./try; then
18983                         # Now make sure there is no external linkage of static
18984                         # functions
18985                         set try -DINLINE=$inline -DUSE_B a.c b.c
18986                         if eval $compile && $run ./try; then
18987                                 $echo "Your compiler supports static $inline, " >&4
18988                                 $echo "but it also creates an external definition," >&4
18989                                 $echo "so I won't use it." >&4
18990                                 val=$undef
18991                         else
18992                                 $echo "Your compiler supports static $inline." >&4
18993                                 val=$define
18994                                 perl_static_inline="static $inline";
18995                                 break;
18996                         fi
18997                 else
18998                         $echo "Your compiler does NOT support static $inline." >&4
18999                         val="$undef"
19000                 fi
19001         done
19002         ;;
19003 *inline*) # Some variant of inline exists.
19004         echo "Keeping your $hint value of $perl_static_inline."
19005         val=$define
19006         ;;
19007 static)  # No inline capabilities
19008         echo "Keeping your $hint value of $perl_static_inline."
19009         val=$undef
19010         ;;
19011 *)  # Unrecognized previous value -- blindly trust the supplied
19012         # value and hope it makes sense.  Use old value for
19013         # d_static_inline, if there is one.
19014         echo "Keeping your $hint value of $perl_static_inline."
19015         case "$d_static_inline" in
19016                 '') val=$define ;;
19017                 *)  val=$d_static_inline ;;
19018         esac
19019         ;;
19020 esac
19021 # Fallback to plain 'static' if nothing worked.
19022 case "$perl_static_inline" in
19023 '')
19024         perl_static_inline="static"
19025         val=$undef
19026         ;;
19027 esac
19028 set d_static_inline
19029 eval $setvar
19030 $rm -f a.[co] b.[co]
19031 $rm_try
19032
19033 : Check stream access
19034 $cat >&4 <<EOM
19035 Checking how to access stdio streams by file descriptor number...
19036 EOM
19037 case "$stdio_stream_array" in
19038 '')     $cat >try.c <<EOCP
19039 #include <stdio.h>
19040 int main() {
19041   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
19042     printf("yes\n");
19043 }
19044 EOCP
19045         for s in _iob __iob __sF
19046         do
19047                 set try -DSTDIO_STREAM_ARRAY=$s
19048                 if eval $compile; then
19049                         case "`$run ./try`" in
19050                         yes)    stdio_stream_array=$s; break ;;
19051                         esac
19052                 fi
19053         done
19054         $rm_try
19055 esac
19056 case "$stdio_stream_array" in
19057 '')     $cat >&4 <<EOM
19058 I can't figure out how to access stdio streams by file descriptor number.
19059 EOM
19060         d_stdio_stream_array="$undef"
19061         ;;
19062 *)      $cat >&4 <<EOM
19063 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
19064 EOM
19065         d_stdio_stream_array="$define"
19066         ;;
19067 esac
19068
19069 : see if strcoll exists
19070 set strcoll d_strcoll
19071 eval $inlibc
19072
19073 : check for structure copying
19074 echo " "
19075 echo "Checking to see if your C compiler can copy structs..." >&4
19076 $cat >try.c <<'EOCP'
19077 int main()
19078 {
19079         struct blurfl {
19080                 int dyick;
19081         } foo, bar;
19082
19083         foo = bar;
19084 }
19085 EOCP
19086 if $cc -c try.c >/dev/null 2>&1 ; then
19087         val="$define"
19088         echo "Yup, it can."
19089 else
19090         val="$undef"
19091         echo "Nope, it can't."
19092 fi
19093 set d_strctcpy
19094 eval $setvar
19095 $rm_try
19096
19097 : see if strerror and/or sys_errlist[] exist
19098 echo " "
19099 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
19100     if set strerror val -f d_strerror; eval $csym; $val; then
19101                 echo 'strerror() found.' >&4
19102                 d_strerror="$define"
19103                 d_strerrm='strerror(e)'
19104                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19105                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
19106                         d_syserrlst="$define"
19107                 else
19108                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
19109                         d_syserrlst="$undef"
19110                 fi
19111     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
19112                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
19113                 echo 'strerror() found in string header.' >&4
19114                 d_strerror="$define"
19115                 d_strerrm='strerror(e)'
19116                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19117                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
19118                                 d_syserrlst="$define"
19119                 else
19120                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
19121                         d_syserrlst="$undef"
19122                 fi
19123     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19124                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
19125                 d_strerror="$undef"
19126                 d_syserrlst="$define"
19127                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
19128     else
19129                 echo 'strerror() and sys_errlist[] NOT found.' >&4
19130                 d_strerror="$undef"
19131                 d_syserrlst="$undef"
19132                 d_strerrm='"unknown"'
19133     fi
19134 fi
19135
19136 : see if strerror_r exists
19137 set strerror_r d_strerror_r
19138 eval $inlibc
19139 case "$d_strerror_r" in
19140 "$define")
19141         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
19142         case "$d_strerror_r_proto:$usethreads" in
19143         ":define")      d_strerror_r_proto=define
19144                 set d_strerror_r_proto strerror_r $hdrs
19145                 eval $hasproto ;;
19146         *)      ;;
19147         esac
19148         case "$d_strerror_r_proto" in
19149         define)
19150         case "$strerror_r_proto" in
19151         ''|0) try='int strerror_r(int, char*, size_t);'
19152         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
19153         esac
19154         case "$strerror_r_proto" in
19155         ''|0) try='int strerror_r(int, char*, int);'
19156         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
19157         esac
19158         case "$strerror_r_proto" in
19159         ''|0) try='char* strerror_r(int, char*, size_t);'
19160         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
19161         esac
19162         case "$strerror_r_proto" in
19163         ''|0)   d_strerror_r=undef
19164                 strerror_r_proto=0
19165                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19166         * )     case "$strerror_r_proto" in
19167                 REENTRANT_PROTO*) ;;
19168                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19169                 esac
19170                 echo "Prototype: $try" ;;
19171         esac
19172         ;;
19173         *)      case "$usethreads" in
19174                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
19175                 esac
19176                 d_strerror_r=undef
19177                 strerror_r_proto=0
19178                 ;;
19179         esac
19180         ;;
19181 *)      strerror_r_proto=0
19182         ;;
19183 esac
19184
19185 : see if strftime exists
19186 set strftime d_strftime
19187 eval $inlibc
19188
19189 : see if strlcat exists
19190 set strlcat d_strlcat
19191 eval $inlibc
19192
19193 : see if strlcpy exists
19194 set strlcpy d_strlcpy
19195 eval $inlibc
19196
19197 : see if strtod exists
19198 set strtod d_strtod
19199 eval $inlibc
19200
19201 : see if strtol exists
19202 set strtol d_strtol
19203 eval $inlibc
19204
19205 : see if strtold exists
19206 set strtold d_strtold
19207 eval $inlibc
19208
19209 : see if strtoll exists
19210 set strtoll d_strtoll
19211 eval $inlibc
19212
19213 case "$d_longlong-$d_strtoll" in
19214 "$define-$define")
19215         $cat <<EOM
19216 Checking whether your strtoll() works okay...
19217 EOM
19218         $cat >try.c <<'EOCP'
19219 #include <errno.h>
19220 #ifdef __hpux
19221 #define strtoll __strtoll
19222 #endif
19223 #ifdef __EMX__
19224 #define strtoll _strtoll
19225 #endif
19226 #include <stdio.h>
19227 extern long long int strtoll(char *s, char **, int);
19228 static int bad = 0;
19229 int check(char *s, long long ell, int een) {
19230         long long gll;
19231         errno = 0;
19232         gll = strtoll(s, 0, 10);
19233         if (!((gll == ell) && (errno == een)))
19234                 bad++;
19235 }
19236 int main() {
19237         check(" 1",                                      1LL, 0);
19238         check(" 0",                                      0LL, 0);
19239         check("-1",                                     -1LL, 0);
19240         check("-9223372036854775808", -9223372036854775808LL, 0);
19241         check("-9223372036854775808", -9223372036854775808LL, 0);
19242         check(" 9223372036854775807",  9223372036854775807LL, 0);
19243         check("-9223372036854775808", -9223372036854775808LL, 0);
19244         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19245         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19246         if (!bad)
19247                 printf("ok\n");
19248 }
19249 EOCP
19250         set try
19251         if eval $compile; then
19252                 yyy=`$run ./try`
19253                 case "$yyy" in
19254                 ok) echo "Your strtoll() seems to be working okay." ;;
19255                 *) cat <<EOM >&4
19256 Your strtoll() doesn't seem to be working okay.
19257 EOM
19258                    d_strtoll="$undef"
19259                    ;;
19260                 esac
19261         else
19262                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19263                 d_strtoll="$undef"
19264         fi
19265         ;;
19266 esac
19267
19268 : see if strtoq exists
19269 set strtoq d_strtoq
19270 eval $inlibc
19271
19272 : see if strtoul exists
19273 set strtoul d_strtoul
19274 eval $inlibc
19275
19276 case "$d_strtoul" in
19277 "$define")
19278         $cat <<EOM
19279 Checking whether your strtoul() works okay...
19280 EOM
19281         $cat >try.c <<'EOCP'
19282 #include <errno.h>
19283 #include <stdio.h>
19284 extern unsigned long int strtoul(char *s, char **, int);
19285 static int bad = 0;
19286 void check(char *s, unsigned long eul, int een) {
19287         unsigned long gul;
19288         errno = 0;
19289         gul = strtoul(s, 0, 10);
19290         if (!((gul == eul) && (errno == een)))
19291                 bad++;
19292 }
19293 int main() {
19294         check(" 1", 1L, 0);
19295         check(" 0", 0L, 0);
19296 EOCP
19297         case "$longsize" in
19298         8)
19299             $cat >>try.c <<'EOCP'
19300         check("18446744073709551615", 18446744073709551615UL, 0);
19301         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19302 #if 0 /* strtoul() for /^-/ strings is undefined. */
19303         check("-1", 18446744073709551615UL, 0);
19304         check("-18446744073709551614", 2, 0);
19305         check("-18446744073709551615", 1, 0);
19306         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19307         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19308 #endif
19309 EOCP
19310                 ;;
19311         4)
19312                     $cat >>try.c <<'EOCP'
19313         check("4294967295", 4294967295UL, 0);
19314         check("4294967296", 4294967295UL, ERANGE);
19315 #if 0 /* strtoul() for /^-/ strings is undefined. */
19316         check("-1", 4294967295UL, 0);
19317         check("-4294967294", 2, 0);
19318         check("-4294967295", 1, 0);
19319         check("-4294967296", 4294967295UL, ERANGE);
19320         check("-4294967297", 4294967295UL, ERANGE);
19321 #endif
19322 EOCP
19323                 ;;
19324         *)
19325 : Should we write these tests to be more portable by sprintf-ing
19326 : ~0 and then manipulating that char string as input for strtol?
19327                 ;;
19328         esac
19329         $cat >>try.c <<'EOCP'
19330         if (!bad)
19331                 printf("ok\n");
19332         return 0;
19333 }
19334 EOCP
19335         set try
19336         if eval $compile; then
19337                 case "`$run ./try`" in
19338                 ok) echo "Your strtoul() seems to be working okay." ;;
19339                 *) cat <<EOM >&4
19340 Your strtoul() doesn't seem to be working okay.
19341 EOM
19342                    d_strtoul="$undef"
19343                    ;;
19344                 esac
19345         else
19346                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19347                 d_strtoul="$undef"
19348         fi
19349         ;;
19350 esac
19351
19352 : see if strtoull exists
19353 set strtoull d_strtoull
19354 eval $inlibc
19355
19356 case "$d_longlong-$d_strtoull" in
19357 "$define-$define")
19358         $cat <<EOM
19359 Checking whether your strtoull() works okay...
19360 EOM
19361         $cat >try.c <<'EOCP'
19362 #include <errno.h>
19363 #ifdef __hpux
19364 #define strtoull __strtoull
19365 #endif
19366 #include <stdio.h>
19367 extern unsigned long long int strtoull(char *s, char **, int);
19368 static int bad = 0;
19369 int check(char *s, long long eull, int een) {
19370         long long gull;
19371         errno = 0;
19372         gull = strtoull(s, 0, 10);
19373         if (!((gull == eull) && (errno == een)))
19374                 bad++;
19375 }
19376 int main() {
19377         check(" 1",                                        1LL, 0);
19378         check(" 0",                                        0LL, 0);
19379         check("18446744073709551615",  18446744073709551615ULL, 0);
19380         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19381 #if 0 /* strtoull() for /^-/ strings is undefined. */
19382         check("-1",                    18446744073709551615ULL, 0);
19383         check("-18446744073709551614",                     2LL, 0);
19384         check("-18446744073709551615",                     1LL, 0);
19385         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19386         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19387 #endif
19388         if (!bad)
19389                 printf("ok\n");
19390 }
19391 EOCP
19392         set try
19393         if eval $compile; then
19394                 case "`$run ./try`" in
19395                 ok) echo "Your strtoull() seems to be working okay." ;;
19396                 *) cat <<EOM >&4
19397 Your strtoull() doesn't seem to be working okay.
19398 EOM
19399                    d_strtoull="$undef"
19400                    ;;
19401                 esac
19402         else
19403                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19404                 d_strtoull="$undef"
19405         fi
19406         ;;
19407 esac
19408
19409 : see if strtouq exists
19410 set strtouq d_strtouq
19411 eval $inlibc
19412
19413 case "$d_strtouq" in
19414 "$define")
19415         $cat <<EOM
19416 Checking whether your strtouq() works okay...
19417 EOM
19418         $cat >try.c <<'EOCP'
19419 #include <errno.h>
19420 #include <stdio.h>
19421 extern unsigned long long int strtouq(char *s, char **, int);
19422 static int bad = 0;
19423 void check(char *s, unsigned long long eull, int een) {
19424         unsigned long long gull;
19425         errno = 0;
19426         gull = strtouq(s, 0, 10);
19427         if (!((gull == eull) && (errno == een)))
19428                 bad++;
19429 }
19430 int main() {
19431         check(" 1",                                        1LL, 0);
19432         check(" 0",                                        0LL, 0);
19433         check("18446744073709551615",  18446744073709551615ULL, 0);
19434         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19435 #if 0 /* strtouq() for /^-/ strings is undefined. */
19436         check("-1",                    18446744073709551615ULL, 0);
19437         check("-18446744073709551614",                     2LL, 0);
19438         check("-18446744073709551615",                     1LL, 0);
19439         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19440         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19441 #endif
19442         if (!bad)
19443                 printf("ok\n");
19444         return 0;
19445 }
19446 EOCP
19447         set try
19448         if eval $compile; then
19449                 case "`$run ./try`" in
19450                 ok) echo "Your strtouq() seems to be working okay." ;;
19451                 *) cat <<EOM >&4
19452 Your strtouq() doesn't seem to be working okay.
19453 EOM
19454                    d_strtouq="$undef"
19455                    ;;
19456                 esac
19457         else
19458                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19459                 d_strtouq="$undef"
19460         fi
19461         ;;
19462 esac
19463
19464 : see if strxfrm exists
19465 set strxfrm d_strxfrm
19466 eval $inlibc
19467
19468 : see if symlink exists
19469 set symlink d_symlink
19470 eval $inlibc
19471
19472 : see if syscall exists
19473 set syscall d_syscall
19474 eval $inlibc
19475
19476 : see if prototype for syscall is available
19477 echo " "
19478 set d_syscallproto syscall $i_unistd unistd.h
19479 eval $hasproto
19480
19481 : see if sysconf exists
19482 set sysconf d_sysconf
19483 eval $inlibc
19484
19485 : see if system exists
19486 set system d_system
19487 eval $inlibc
19488
19489 : see if tcgetpgrp exists
19490 set tcgetpgrp d_tcgetpgrp
19491 eval $inlibc
19492
19493 : see if tcsetpgrp exists
19494 set tcsetpgrp d_tcsetpgrp
19495 eval $inlibc
19496
19497 : see if prototype for telldir is available
19498 echo " "
19499 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19500 eval $hasproto
19501
19502 : see if tgamma exists
19503 set tgamma d_tgamma
19504 eval $inlibc
19505
19506 : see if time exists
19507 echo " "
19508 if test "X$d_time" = X -o X"$timetype" = X; then
19509     if set time val -f d_time; eval $csym; $val; then
19510                 echo 'time() found.' >&4
19511                 val="$define"
19512                 rp="What is the type returned by time() on this system?"
19513                 set time_t timetype long stdio.h sys/types.h
19514                 eval $typedef_ask
19515     else
19516                 echo 'time() not found, hope that will do.' >&4
19517                 val="$undef"
19518                 timetype='int';
19519     fi
19520     set d_time
19521     eval $setvar
19522 fi
19523
19524 : see if timegm exists
19525 set timegm d_timegm
19526 eval $inlibc
19527
19528 : see if this is a sys/times.h system
19529 set sys/times.h i_systimes
19530 eval $inhdr
19531
19532 : see if times exists
19533 echo " "
19534 if set times val -f d_times; eval $csym; $val; then
19535         echo 'times() found.' >&4
19536         d_times="$define"
19537         inc=''
19538         case "$i_systimes" in
19539         "$define") inc='sys/times.h';;
19540         esac
19541         rp="What is the type returned by times() on this system?"
19542         set clock_t clocktype long stdio.h sys/types.h $inc
19543         eval $typedef_ask
19544 else
19545         echo 'times() NOT found, hope that will do.' >&4
19546         d_times="$undef"
19547         clocktype='int'
19548 fi
19549
19550 : see if tmpnam_r exists
19551 set tmpnam_r d_tmpnam_r
19552 eval $inlibc
19553 case "$d_tmpnam_r" in
19554 "$define")
19555         hdrs="$i_systypes sys/types.h define stdio.h "
19556         case "$d_tmpnam_r_proto:$usethreads" in
19557         ":define")      d_tmpnam_r_proto=define
19558                 set d_tmpnam_r_proto tmpnam_r $hdrs
19559                 eval $hasproto ;;
19560         *)      ;;
19561         esac
19562         case "$d_tmpnam_r_proto" in
19563         define)
19564         case "$tmpnam_r_proto" in
19565         ''|0) try='char* tmpnam_r(char*);'
19566         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19567         esac
19568         case "$tmpnam_r_proto" in
19569         ''|0)   d_tmpnam_r=undef
19570                 tmpnam_r_proto=0
19571                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19572         * )     case "$tmpnam_r_proto" in
19573                 REENTRANT_PROTO*) ;;
19574                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19575                 esac
19576                 echo "Prototype: $try" ;;
19577         esac
19578         ;;
19579         *)      case "$usethreads" in
19580                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19581                 esac
19582                 d_tmpnam_r=undef
19583                 tmpnam_r_proto=0
19584                 ;;
19585         esac
19586         ;;
19587 *)      tmpnam_r_proto=0
19588         ;;
19589 esac
19590
19591 : see if trunc exists
19592 set trunc d_trunc
19593 eval $inlibc
19594
19595 : see if truncate exists
19596 set truncate d_truncate
19597 eval $inlibc
19598
19599 : see if ttyname_r exists
19600 set ttyname_r d_ttyname_r
19601 eval $inlibc
19602 case "$d_ttyname_r" in
19603 "$define")
19604         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19605         case "$d_ttyname_r_proto:$usethreads" in
19606         ":define")      d_ttyname_r_proto=define
19607                 set d_ttyname_r_proto ttyname_r $hdrs
19608                 eval $hasproto ;;
19609         *)      ;;
19610         esac
19611         case "$d_ttyname_r_proto" in
19612         define)
19613         case "$ttyname_r_proto" in
19614         ''|0) try='int ttyname_r(int, char*, size_t);'
19615         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19616         esac
19617         case "$ttyname_r_proto" in
19618         ''|0) try='int ttyname_r(int, char*, int);'
19619         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19620         esac
19621         case "$ttyname_r_proto" in
19622         ''|0) try='char* ttyname_r(int, char*, int);'
19623         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19624         esac
19625         case "$ttyname_r_proto" in
19626         ''|0)   d_ttyname_r=undef
19627                 ttyname_r_proto=0
19628                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19629         * )     case "$ttyname_r_proto" in
19630                 REENTRANT_PROTO*) ;;
19631                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19632                 esac
19633                 echo "Prototype: $try" ;;
19634         esac
19635         ;;
19636         *)      case "$usethreads" in
19637                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19638                 esac
19639                 d_ttyname_r=undef
19640                 ttyname_r_proto=0
19641                 ;;
19642         esac
19643         ;;
19644 *)      ttyname_r_proto=0
19645         ;;
19646 esac
19647
19648 : see if tzname[] exists
19649 echo " "
19650 if set tzname val -a d_tzname; eval $csym; $val; then
19651         val="$define"
19652         echo 'tzname[] found.' >&4
19653 else
19654         val="$undef"
19655         echo 'tzname[] NOT found.' >&4
19656 fi
19657 set d_tzname
19658 eval $setvar
19659
19660 : Check if is a multiplatform env
19661 case "$osname" in
19662 darwin) multiarch="$define" ;;
19663 esac
19664 case "$multiarch" in
19665 ''|[nN]*) multiarch="$undef" ;;
19666 esac
19667
19668 : check for ordering of bytes in a UV
19669 echo " "
19670 case "$multiarch" in
19671 *$define*)
19672         $cat <<EOM
19673 You seem to be doing a multiarchitecture build,
19674 skipping the byteorder check.
19675
19676 EOM
19677         byteorder='ffff'
19678         ;;
19679 *)
19680         case "$byteorder" in
19681         '')
19682                 $cat <<'EOM'
19683 In the following, larger digits indicate more significance.  A big-endian
19684 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19685 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19686 machines may have weird orders like 3412.  A Cray will report 87654321,
19687 an Alpha will report 12345678. If the test program works the default is
19688 probably right.
19689 I'm now running the test program...
19690 EOM
19691                 $cat >try.c <<EOCP
19692 #include <stdio.h>
19693 #$i_stdlib I_STDLIB
19694 #ifdef I_STDLIB
19695 #include <stdlib.h>
19696 #endif
19697 #include <sys/types.h>
19698 typedef $uvtype UV;
19699 int main()
19700 {
19701         int i;
19702         union {
19703                 UV l;
19704                 char c[$uvsize];
19705         } u;
19706
19707         if ($uvsize > 4)
19708                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19709         else
19710                 u.l = (UV)0x04030201;
19711         for (i = 0; i < $uvsize; i++)
19712                 printf("%c", u.c[i]+'0');
19713         printf("\n");
19714         exit(0);
19715 }
19716 EOCP
19717                 xxx_prompt=y
19718                 set try
19719                 if eval $compile && $run ./try > /dev/null; then
19720                         dflt=`$run ./try`
19721                         case "$dflt" in
19722                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19723                                 echo "(The test program ran ok.)"
19724                                 echo "byteorder=$dflt"
19725                                 xxx_prompt=n
19726                         ;;
19727                         ????|????????) echo "(The test program ran ok.)" ;;
19728                         *) echo "(The test program didn't run right for some reason.)" ;;
19729                         esac
19730                 else
19731                         dflt='4321'
19732                         cat <<'EOM'
19733 (I can't seem to compile the test program.  Guessing big-endian...)
19734 EOM
19735                 fi
19736                 case "$xxx_prompt" in
19737                 y)
19738                         rp="What is the order of bytes in $uvtype?"
19739                         . ./myread
19740                         byteorder="$ans"
19741                         ;;
19742                 *)      byteorder=$dflt
19743                         ;;
19744                 esac
19745                 ;;
19746         esac
19747         $rm_try
19748         ;;
19749 esac
19750
19751 : Checking 32bit alignedness
19752 $cat <<EOM
19753
19754 Checking to see whether you can access character data unalignedly...
19755 EOM
19756 case "$d_u32align" in
19757 '')   $cat >try.c <<EOCP
19758 #include <stdio.h>
19759 #$i_stdlib I_STDLIB
19760 #ifdef I_STDLIB
19761 #include <stdlib.h>
19762 #endif
19763 #define U32 $u32type
19764 #define BYTEORDER 0x$byteorder
19765 #define U8 $u8type
19766 #include <signal.h>
19767 #ifdef SIGBUS
19768 $signal_t bletch(int s) { exit(4); }
19769 #endif
19770 int main() {
19771 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19772     volatile U8 buf[8];
19773     volatile U32 *up;
19774     int i;
19775
19776     if (sizeof(U32) != 4) {
19777         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19778         exit(1);
19779     }
19780
19781     fflush(stdout);
19782
19783 #ifdef SIGBUS
19784     signal(SIGBUS, bletch);
19785 #endif
19786
19787     buf[0] = 0;
19788     buf[1] = 0;
19789     buf[2] = 0;
19790     buf[3] = 1;
19791     buf[4] = 0;
19792     buf[5] = 0;
19793     buf[6] = 0;
19794     buf[7] = 1;
19795
19796     for (i = 0; i < 4; i++) {
19797         up = (U32*)(buf + i);
19798         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19799                (*up == 1 << (8*(3-i)))  /* little-endian */
19800               )
19801            )
19802         {
19803             printf("read failed (%x)\n", *up);
19804             exit(2);
19805         }
19806     }
19807
19808     /* write test */
19809     for (i = 0; i < 4; i++) {
19810         up = (U32*)(buf + i);
19811         *up = 0xBeef;
19812         if (*up != 0xBeef) {
19813             printf("write failed (%x)\n", *up);
19814             exit(3);
19815         }
19816     }
19817
19818     exit(0);
19819 #else
19820     printf("1\n");
19821     exit(1);
19822 #endif
19823     return 0;
19824 }
19825 EOCP
19826 set try
19827 if eval $compile_ok; then
19828         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19829         $run ./try 2>&1 >/dev/null
19830         case "$?" in
19831         0)      cat >&4 <<EOM
19832 You can access character data pretty unalignedly.
19833 EOM
19834                 d_u32align="$undef"
19835                 ;;
19836         *)      cat >&4 <<EOM
19837 It seems that you must access character data in an aligned manner.
19838 EOM
19839                 d_u32align="$define"
19840                 ;;
19841         esac
19842 else
19843         rp='Can you access character data at unaligned addresses?'
19844         dflt='n'
19845         . ./myread
19846         case "$ans" in
19847         [yY]*)  d_u32align="$undef"  ;;
19848         *)      d_u32align="$define" ;;
19849         esac
19850 fi
19851 $rm_try
19852 ;;
19853 esac
19854
19855 : see if ualarm exists
19856 set ualarm d_ualarm
19857 eval $inlibc
19858
19859 : see if umask exists
19860 set umask d_umask
19861 eval $inlibc
19862
19863 : see if unordered exists
19864 set unordered d_unordered
19865 eval $inlibc
19866
19867 : see if unsetenv exists
19868 set unsetenv d_unsetenv
19869 eval $inlibc
19870
19871 : see if usleep exists
19872 set usleep d_usleep
19873 eval $inlibc
19874
19875 : see if prototype for usleep is available
19876 echo " "
19877 set d_usleepproto usleep $i_unistd unistd.h
19878 eval $hasproto
19879
19880 : see if ustat exists
19881 set ustat d_ustat
19882 eval $inlibc
19883
19884 : see if closedir exists
19885 set closedir d_closedir
19886 eval $inlibc
19887
19888 case "$d_closedir" in
19889 "$define")
19890         echo " "
19891         echo "Checking whether closedir() returns a status..." >&4
19892         cat > try.c <<EOM
19893 #$i_dirent I_DIRENT             /**/
19894 #$i_sysdir I_SYS_DIR            /**/
19895 #$i_sysndir I_SYS_NDIR          /**/
19896 #$i_systypes I_SYS_TYPES        /**/
19897
19898 #if defined(I_SYS_TYPES)
19899 #include <sys/types.h>
19900 #endif
19901 #if defined(I_DIRENT)
19902 #include <dirent.h>
19903 #else
19904 #ifdef I_SYS_NDIR
19905 #include <sys/ndir.h>
19906 #else
19907 #ifdef I_SYS_DIR
19908 #ifdef hp9000s500
19909 #include <ndir.h>       /* may be wrong in the future */
19910 #else
19911 #include <sys/dir.h>
19912 #endif
19913 #endif
19914 #endif
19915 #endif
19916 int main() { return closedir(opendir(".")); }
19917 EOM
19918         set try
19919         if eval $compile_ok; then
19920                 if $run ./try > /dev/null 2>&1 ; then
19921                         echo "Yes, it does."
19922                         val="$undef"
19923                 else
19924                         echo "No, it doesn't."
19925                         val="$define"
19926                 fi
19927         else
19928                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19929                 val="$define"
19930         fi
19931         ;;
19932 *)
19933         val="$undef";
19934         ;;
19935 esac
19936 set d_void_closedir
19937 eval $setvar
19938 $rm_try
19939
19940 : see if there is a wait4
19941 set wait4 d_wait4
19942 eval $inlibc
19943
19944 : see if waitpid exists
19945 set waitpid d_waitpid
19946 eval $inlibc
19947
19948 : look for wcscmp
19949 echo " "
19950 $cat >try.c <<'EOCP'
19951 #include <stdio.h>
19952 #include <wchar.h>
19953 int main ()
19954 {
19955     wchar_t *s = L" ";
19956     return (wcscmp (s, s) ? 1 : 0);
19957     }
19958 EOCP
19959 set try
19960 val="$undef"
19961 if eval $compile; then
19962     `$run ./try`
19963     case "$?" in
19964         0)  echo "A working wcscmp() found." >&4
19965             val="$define" ;;
19966         *)  echo "wcscmp() found, but it doesn't work" >&4
19967             ;;
19968         esac
19969 else
19970     echo "wcscmp() NOT found." >&4
19971     fi
19972 set d_wcscmp
19973 eval $setvar
19974 $rm_try
19975
19976 : see if wcstombs exists
19977 set wcstombs d_wcstombs
19978 eval $inlibc
19979
19980 : look for wcsxfrm
19981 echo " "
19982 $cat >try.c <<'EOCP'
19983 #include <errno.h>
19984 #include <wchar.h>
19985 int main ()
19986 {
19987     wchar_t dst[4], *src = L" ";
19988     errno = 0;
19989     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
19990     }
19991 EOCP
19992 set try
19993 val="$undef"
19994 if eval $compile; then
19995     `$run ./try`
19996     case "$?" in
19997         0)  echo "A working wcsxfrm() found." >&4
19998             val="$define" ;;
19999         *)  echo "wcsxfrm() found, but it doesn't work" >&4
20000             ;;
20001         esac
20002 else
20003     echo "wcsxfrm() NOT found." >&4
20004     fi
20005 set d_wcsxfrm
20006 eval $setvar
20007 $rm_try
20008
20009 : see if wctomb exists
20010 set wctomb d_wctomb
20011 eval $inlibc
20012
20013 : see if writev exists
20014 set writev d_writev
20015 eval $inlibc
20016
20017 : check for alignment requirements
20018 echo " "
20019 case "$alignbytes" in
20020     '') echo "Checking alignment constraints..." >&4
20021         if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
20022             $cat >try.c <<'EOCP'
20023 typedef long double NV;
20024 EOCP
20025         else
20026             $cat >try.c <<'EOCP'
20027 typedef double NV;
20028 EOCP
20029         fi
20030         $cat >>try.c <<'EOCP'
20031 #include <stdio.h>
20032 struct foobar {
20033     char foo;
20034     NV bar;
20035 } try_algn;
20036 int main()
20037 {
20038     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20039     return(0);
20040 }
20041 EOCP
20042         set try
20043         if eval $compile_ok; then
20044             dflt=`$run ./try`
20045         else
20046             dflt='8'
20047             echo "(I can't seem to compile the test program...)"
20048         fi
20049         case "$multiarch" in
20050             *$define*)
20051                 : The usual safe value is 8, but Darwin with -Duselongdouble
20052                 : needs 16.  Hence, we will take 8 as a minimum, but allow
20053                 : Configure to pick a larger value if needed.
20054                 if $test "$dflt" -lt 8; then
20055                     dflt='8'
20056                     echo "Setting alignment to 8 for multiarch support.">&4
20057                 fi
20058                 ;;
20059         esac
20060         ;;
20061     *) dflt="$alignbytes"
20062         ;;
20063 esac
20064 rp="Doubles must be aligned on a how-many-byte boundary?"
20065 . ./myread
20066 alignbytes="$ans"
20067 $rm_try
20068
20069 : set the base revision
20070 baserev=5.0
20071
20072 : length of character in bytes. Is always 1, otherwise it is not C
20073 : This used to be a test using sizeof
20074 charsize=1
20075
20076 : Check for the number of bits in a character
20077 case "$charbits" in
20078 '')     echo "Checking how long a character is (in bits)..." >&4
20079         $cat >try.c <<EOCP
20080 #include <stdio.h>
20081 int main ()
20082 {
20083     int n;
20084     unsigned char c;
20085     for (c = 1, n = 0; c; c <<= 1, n++) ;
20086     printf ("%d\n", n);
20087     return (0);
20088     }
20089 EOCP
20090         set try
20091         if eval $compile_ok; then
20092                 dflt=`$run ./try`
20093         else
20094                 dflt='8'
20095                 echo "(I can't seem to compile the test program.  Guessing...)"
20096         fi
20097         ;;
20098 *)
20099         dflt="$charbits"
20100         ;;
20101 esac
20102 rp="What is the length of a character (in bits)?"
20103 . ./myread
20104 charbits="$ans"
20105 $rm_try
20106 case "$charbits" in
20107 8)      ;;
20108 *)      cat >&4 << EOM
20109 Your system has an unsigned character size of $charbits bits, which
20110 is rather unusual (normally it is 8 bits).  Perl likely will not work
20111 correctly on your system, with subtle bugs in various places.
20112 EOM
20113         rp='Do you really want to continue?'
20114         dflt='n'
20115         . ./myread
20116         case "$ans" in
20117                 [yY])   echo >&4 "Okay, continuing."    ;;
20118                 *)      exit 1                          ;;
20119         esac
20120 esac
20121
20122 : how do we concatenate cpp tokens here?
20123 echo " "
20124 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20125 $cat >cpp_stuff.c <<'EOCP'
20126 #define RCAT(a,b)a/**/b
20127 #define ACAT(a,b)a ## b
20128 RCAT(Rei,ser)
20129 ACAT(Cir,cus)
20130 EOCP
20131 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20132 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20133         echo "Oh!  Smells like ANSI's been here." >&4
20134         echo "We can catify or stringify, separately or together!"
20135         cpp_stuff=42
20136 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20137         echo "Ah, yes!  The good old days!" >&4
20138         echo "However, in the good old days we don't know how to stringify and"
20139         echo "catify at the same time."
20140         cpp_stuff=1
20141 else
20142         $cat >&4 <<EOM
20143 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20144 You're going to have to edit the values of CAT[2-5] in config.h...
20145 EOM
20146         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20147 fi
20148 $rm -f cpp_stuff.*
20149
20150 : see if this is a db.h system
20151 set db.h i_db
20152 eval $inhdr
20153
20154 case "$i_db" in
20155 $define)
20156         : Check db version.
20157         echo " "
20158         echo "Checking Berkeley DB version ..." >&4
20159         $cat >try.c <<EOCP
20160 #$d_const HASCONST
20161 #ifndef HASCONST
20162 #define const
20163 #endif
20164 #include <sys/types.h>
20165 #include <stdio.h>
20166 #$i_stdlib I_STDLIB
20167 #ifdef I_STDLIB
20168 #include <stdlib.h>
20169 #endif
20170 #include <db.h>
20171 int main(int argc, char *argv[])
20172 {
20173 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20174     int Major, Minor, Patch ;
20175     unsigned long Version ;
20176     (void)db_version(&Major, &Minor, &Patch) ;
20177     if (argc == 2) {
20178         printf("%d %d %d %d %d %d\n",
20179                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20180                Major, Minor, Patch);
20181         exit(0);
20182     }
20183     printf("You have Berkeley DB Version 2 or greater.\n");
20184
20185     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20186                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20187     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20188                 Major, Minor, Patch) ;
20189
20190     /* check that db.h & libdb are compatible */
20191     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20192         printf("db.h and libdb are incompatible.\n") ;
20193         exit(3);
20194     }
20195
20196     printf("db.h and libdb are compatible.\n") ;
20197
20198     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20199                 + DB_VERSION_PATCH ;
20200
20201     /* needs to be >= 2.3.4 */
20202     if (Version < 2003004) {
20203     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20204         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20205         exit(2);
20206     }
20207
20208     exit(0);
20209 #else
20210 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20211     if (argc == 2) {
20212         printf("1 0 0\n");
20213         exit(0);
20214     }
20215     printf("You have Berkeley DB Version 1.\n");
20216     exit(0);    /* DB version < 2: the coast is clear. */
20217 #else
20218     exit(1);    /* <db.h> not Berkeley DB? */
20219 #endif
20220 #endif
20221 }
20222 EOCP
20223         set try
20224         if eval $compile_ok && $run ./try; then
20225                 echo 'Looks OK.' >&4
20226                 set `$run ./try 1`
20227                 db_version_major=$1
20228                 db_version_minor=$2
20229                 db_version_patch=$3
20230         else
20231                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20232                 i_db=$undef
20233                 case " $libs " in
20234                 *"-ldb "*)
20235                         : Remove db from list of libraries to use
20236                         echo "Removing unusable -ldb from library list" >&4
20237                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20238                         shift
20239                         libs="$*"
20240                         echo "libs = $libs" >&4
20241                         ;;
20242                 esac
20243         fi
20244         $rm_try
20245         ;;
20246 esac
20247
20248 case "$i_db" in
20249 define)
20250         : Check the return type needed for hash
20251         echo " "
20252         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20253         $cat >try.c <<EOCP
20254 #$d_const HASCONST
20255 #ifndef HASCONST
20256 #define const
20257 #endif
20258 #include <sys/types.h>
20259 #include <db.h>
20260
20261 #ifndef DB_VERSION_MAJOR
20262 u_int32_t hash_cb (const void* ptr, size_t size)
20263 {
20264 }
20265 HASHINFO info;
20266 int main()
20267 {
20268         info.hash = hash_cb;
20269 }
20270 #endif
20271 EOCP
20272         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20273                 if $contains warning try.out >>/dev/null 2>&1 ; then
20274                         db_hashtype='int'
20275                 else
20276                         db_hashtype='u_int32_t'
20277                 fi
20278         else
20279                 : XXX Maybe we should just give up here.
20280                 db_hashtype=u_int32_t
20281                 $cat try.out >&4
20282                 echo "Help:  I can't seem to compile the db test program." >&4
20283                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20284         fi
20285         $rm_try
20286         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20287         ;;
20288 *)      db_hashtype=u_int32_t
20289         ;;
20290 esac
20291 case "$i_db" in
20292 define)
20293         : Check the return type needed for prefix
20294         echo " "
20295         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20296         cat >try.c <<EOCP
20297 #$d_const HASCONST
20298 #ifndef HASCONST
20299 #define const
20300 #endif
20301 #include <sys/types.h>
20302 #include <db.h>
20303
20304 #ifndef DB_VERSION_MAJOR
20305 size_t prefix_cb (const DBT *key1, const DBT *key2)
20306 {
20307 }
20308 BTREEINFO info;
20309 int main()
20310 {
20311         info.prefix = prefix_cb;
20312 }
20313 #endif
20314 EOCP
20315         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20316                 if $contains warning try.out >>/dev/null 2>&1 ; then
20317                         db_prefixtype='int'
20318                 else
20319                         db_prefixtype='size_t'
20320                 fi
20321         else
20322                 db_prefixtype='size_t'
20323                 : XXX Maybe we should just give up here.
20324                 $cat try.out >&4
20325                 echo "Help:  I can't seem to compile the db test program." >&4
20326                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20327         fi
20328         $rm_try
20329         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20330         ;;
20331 *)      db_prefixtype='size_t'
20332         ;;
20333 esac
20334
20335 : How can we generate normalized random numbers ?
20336 echo " "
20337 echo "Using our internal random number implementation..." >&4
20338
20339 case "$ccflags" in
20340 *-Dmy_rand=*|*-Dmy_srand=*)
20341         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20342         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20343         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20344         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20345         ;;
20346 esac
20347
20348 randfunc=Perl_drand48
20349 drand01="Perl_drand48()"
20350 seedfunc="Perl_drand48_init"
20351 randbits=48
20352 randseedtype=U32
20353
20354 : Determine if this is an EBCDIC system
20355 echo " "
20356 echo "Determining whether or not we are on an EBCDIC system..." >&4
20357 $cat >try.c <<'EOM'
20358 int main()
20359 {
20360   if ('M'==0xd4) return 0;
20361   return 1;
20362 }
20363 EOM
20364
20365 val=$undef
20366 set try
20367 if eval $compile_ok; then
20368         if $run ./try; then
20369                 echo "You seem to speak EBCDIC." >&4
20370                 val="$define"
20371         else
20372                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20373         fi
20374 else
20375         echo "I'm unable to compile the test program." >&4
20376         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20377 fi
20378 $rm_try
20379 set ebcdic
20380 eval $setvar
20381
20382 : Check how to flush
20383 echo " "
20384 $cat >&4 <<EOM
20385 Checking how to flush all pending stdio output...
20386 EOM
20387 # I only know how to find the first 32 possibly open files on SunOS.
20388 # See also hints/sunos_4_1.sh and util.c  --AD
20389 case "$osname" in
20390 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20391 esac
20392 $cat >>try.c <<EOCP
20393 #include <stdio.h>
20394 #$i_stdlib I_STDLIB
20395 #ifdef I_STDLIB
20396 #include <stdlib.h>
20397 #endif
20398 #$i_unistd I_UNISTD
20399 #ifdef I_UNISTD
20400 # include <unistd.h>
20401 #endif
20402 #$d_sysconf HAS_SYSCONF
20403 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20404 #ifdef HAS_STDIO_STREAM_ARRAY
20405 # define STDIO_STREAM_ARRAY $stdio_stream_array
20406 #endif
20407 int main() {
20408   FILE* p;
20409   unlink("try.out");
20410   p = fopen("try.out", "w");
20411 #ifdef TRY_FPUTC
20412   fputc('x', p);
20413 #else
20414 # ifdef TRY_FPRINTF
20415   fprintf(p, "x");
20416 # endif
20417 #endif
20418 #ifdef TRY_FFLUSH_NULL
20419   fflush(NULL);
20420 #endif
20421 #ifdef TRY_FFLUSH_ALL
20422   {
20423     long open_max = -1;
20424 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20425     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20426 # else
20427 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20428     open_max = sysconf(_SC_OPEN_MAX);
20429 #  else
20430 #   ifdef FOPEN_MAX
20431     open_max = FOPEN_MAX;
20432 #   else
20433 #    ifdef OPEN_MAX
20434     open_max = OPEN_MAX;
20435 #    else
20436 #     ifdef _NFILE
20437     open_max = _NFILE;
20438 #     endif
20439 #    endif
20440 #   endif
20441 #  endif
20442 # endif
20443 # ifdef HAS_STDIO_STREAM_ARRAY
20444     if (open_max > 0) {
20445       long i;
20446       for (i = 0; i < open_max; i++)
20447             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20448                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20449                 STDIO_STREAM_ARRAY[i]._flag)
20450                 fflush(&STDIO_STREAM_ARRAY[i]);
20451     }
20452   }
20453 # endif
20454 #endif
20455   _exit(42);
20456 }
20457 EOCP
20458 : first we have to find out how _not_ to flush
20459 $to try.c
20460 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20461     output=''
20462     set try -DTRY_FPUTC
20463     if eval $compile; then
20464             $run ./try 2>/dev/null
20465             code="$?"
20466             $from try.out
20467             if $test ! -s try.out -a "X$code" = X42; then
20468                 output=-DTRY_FPUTC
20469             fi
20470     fi
20471     case "$output" in
20472     '')
20473             set try -DTRY_FPRINTF
20474             if eval $compile; then
20475                     $run ./try 2>/dev/null
20476                     code="$?"
20477                     $from try.out
20478                     if $test ! -s try.out -a "X$code" = X42; then
20479                         output=-DTRY_FPRINTF
20480                     fi
20481             fi
20482         ;;
20483     esac
20484 fi
20485 : check for fflush NULL behavior
20486 case "$fflushNULL" in
20487 '')     set try -DTRY_FFLUSH_NULL $output
20488         if eval $compile; then
20489                 $run ./try 2>/dev/null
20490                 code="$?"
20491                 $from try.out
20492                 if $test -s try.out -a "X$code" = X42; then
20493                         fflushNULL="`$cat try.out`"
20494                 else
20495                         if $test "X$code" != X42; then
20496                                 $cat >&4 <<EOM
20497 (If this test failed, don't worry, we'll try another method shortly.)
20498 EOM
20499                         fi
20500                 fi
20501         fi
20502         $rm -f core try.core core.try.*
20503         case "$fflushNULL" in
20504         x)      $cat >&4 <<EOM
20505 Your fflush(NULL) works okay for output streams.
20506 Let's see if it clobbers input pipes...
20507 EOM
20508 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20509 # bug that improperly flushes the input end of pipes.  So we avoid the
20510 # autoflush on fork/system/exec support for now. :-(
20511 $cat >tryp.c <<EOCP
20512 #include <stdio.h>
20513 int
20514 main(int argc, char **argv)
20515 {
20516     char buf[1024];
20517     int i;
20518     char *bp = buf;
20519     while (1) {
20520         while ((i = getc(stdin)) != -1
20521                && (*bp++ = i) != '\n'
20522                && bp < &buf[1024])
20523         /* DO NOTHING */ ;
20524         *bp = '\0';
20525         fprintf(stdout, "%s", buf);
20526         fflush(NULL);
20527         if (i == -1)
20528             return 0;
20529         bp = buf;
20530     }
20531 }
20532 EOCP
20533                 fflushNULL="$define"
20534                 set tryp
20535                 if eval $compile; then
20536                     $rm -f tryp.out
20537                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20538                     if $test "X$targethost" != X; then
20539                         $to tryp.c
20540                         $to tryp
20541                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20542                     else
20543                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20544                     fi
20545                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20546                        $cat >&4 <<EOM
20547 fflush(NULL) seems to behave okay with input streams.
20548 EOM
20549                         fflushNULL="$define"
20550                     else
20551                         $cat >&4 <<EOM
20552 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20553 EOM
20554                         fflushNULL="$undef"
20555                     fi
20556                 fi
20557                 $rm -f core tryp.c tryp.core core.tryp.*
20558                 ;;
20559         '')     $cat >&4 <<EOM
20560 Your fflush(NULL) isn't working (contrary to ANSI C).
20561 EOM
20562                 fflushNULL="$undef"
20563                 ;;
20564         *)      $cat >&4 <<EOM
20565 Cannot figure out whether your fflush(NULL) works or not.
20566 I'm assuming it doesn't (contrary to ANSI C).
20567 EOM
20568                 fflushNULL="$undef"
20569                 ;;
20570         esac
20571         ;;
20572 $define|true|[yY]*)
20573         fflushNULL="$define"
20574         ;;
20575 *)
20576         fflushNULL="$undef"
20577         ;;
20578 esac
20579 : check explicit looping only if NULL did not work, and if the pipe
20580 : bug does not show up on an explicit flush too
20581 case "$fflushNULL" in
20582 "$undef")
20583         $cat >tryp.c <<EOCP
20584 #include <stdio.h>
20585 int
20586 main(int argc, char **argv)
20587 {
20588     char buf[1024];
20589     int i;
20590     char *bp = buf;
20591     while (1) {
20592         while ((i = getc(stdin)) != -1
20593                && (*bp++ = i) != '\n'
20594                && bp < &buf[1024])
20595         /* DO NOTHING */ ;
20596         *bp = '\0';
20597         fprintf(stdout, "%s", buf);
20598         fflush(stdin);
20599         if (i == -1)
20600             return 0;
20601         bp = buf;
20602     }
20603 }
20604 EOCP
20605         set tryp
20606         if eval $compile; then
20607             $rm -f tryp.out
20608             if $test "X$targethost" != X; then
20609                 $to tryp.c
20610                 $to tryp
20611                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20612             else
20613                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20614             fi
20615             if cmp tryp.c tryp.out >/dev/null 2>&1; then
20616                $cat >&4 <<EOM
20617 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20618 EOM
20619                 : now check for fflushall behaviour
20620                 case "$fflushall" in
20621                 '')     set try -DTRY_FFLUSH_ALL $output
20622                         if eval $compile; then
20623                                 $cat >&4 <<EOM
20624 (Now testing the other method--but note that this also may fail.)
20625 EOM
20626                                 $run ./try 2>/dev/null
20627                                 code=$?
20628                                 $from try.out
20629                                 if $test -s try.out -a "X$code" = X42; then
20630                                         fflushall="`$cat try.out`"
20631                                 fi
20632                         fi
20633                         $rm_try
20634                         case "$fflushall" in
20635                         x)      $cat >&4 <<EOM
20636 Whew. Flushing explicitly all the stdio streams works.
20637 EOM
20638                                 fflushall="$define"
20639                                 ;;
20640                         '')     $cat >&4 <<EOM
20641 Sigh. Flushing explicitly all the stdio streams doesn't work.
20642 EOM
20643                                 fflushall="$undef"
20644                                 ;;
20645                         *)      $cat >&4 <<EOM
20646 Cannot figure out whether flushing stdio streams explicitly works or not.
20647 I'm assuming it doesn't.
20648 EOM
20649                                 fflushall="$undef"
20650                                 ;;
20651                         esac
20652                         ;;
20653                 "$define"|true|[yY]*)
20654                         fflushall="$define"
20655                         ;;
20656                 *)
20657                         fflushall="$undef"
20658                         ;;
20659                 esac
20660             else
20661                 $cat >&4 <<EOM
20662 All is futile.  Even fflush(stdin) clobbers input pipes!
20663 EOM
20664                 fflushall="$undef"
20665             fi
20666         else
20667             fflushall="$undef"
20668         fi
20669         $rm -f core tryp.c tryp.core core.tryp.*
20670         ;;
20671 *)      fflushall="$undef"
20672         ;;
20673 esac
20674
20675 case "$fflushNULL$fflushall" in
20676 undefundef)
20677         $cat <<EOM
20678 OK, I give up.  I cannot figure out how to flush pending stdio output.
20679 We won't be flushing handles at all before fork/exec/popen.
20680 EOM
20681         ;;
20682 esac
20683 $rm_try tryp
20684
20685 : Store the full pathname to the ar program for use in the C program
20686 : Respect a hint or command line value for full_ar.
20687 case "$full_ar" in
20688 '') full_ar=$ar ;;
20689 esac
20690
20691 : Store the full pathname to the sed program for use in the C program
20692 full_sed=$sed
20693
20694 : see what type gids are declared as in the kernel
20695 echo " "
20696 echo "Looking for the type for group ids returned by getgid()."
20697 set gid_t gidtype xxx stdio.h sys/types.h
20698 eval $typedef
20699 case "$gidtype" in
20700 xxx)
20701         xxx=`./findhdr sys/user.h`
20702         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
20703         case $1 in
20704         unsigned) dflt="$1 $2" ;;
20705         *) dflt="$1" ;;
20706         esac
20707         ;;
20708 *) dflt="$gidtype";;
20709 esac
20710 case "$gidtype" in
20711 gid_t) echo "gid_t found." ;;
20712 *)      rp="What is the type for group ids returned by getgid()?"
20713         . ./myread
20714         gidtype="$ans"
20715         ;;
20716 esac
20717
20718 : Check the size of GID
20719 echo " "
20720 case "$gidtype" in
20721 *_t) zzz="$gidtype"     ;;
20722 *)   zzz="gid"          ;;
20723 esac
20724 echo "Checking the size of $zzz..." >&4
20725 cat > try.c <<EOCP
20726 #include <sys/types.h>
20727 #include <stdio.h>
20728 #$i_stdlib I_STDLIB
20729 #ifdef I_STDLIB
20730 #include <stdlib.h>
20731 #endif
20732 int main() {
20733     printf("%d\n", (int)sizeof($gidtype));
20734     exit(0);
20735 }
20736 EOCP
20737 set try
20738 if eval $compile_ok; then
20739         yyy=`$run ./try`
20740         case "$yyy" in
20741         '')     gidsize=4
20742                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
20743                 ;;
20744         *)      gidsize=$yyy
20745                 echo "Your $zzz is $gidsize bytes long."
20746                 ;;
20747         esac
20748 else
20749         gidsize=4
20750         echo "(I can't compile the test program--guessing $gidsize.)" >&4
20751 fi
20752
20753
20754 : Check if GID is signed
20755 echo " "
20756 case "$gidtype" in
20757 *_t) zzz="$gidtype"     ;;
20758 *)   zzz="gid"          ;;
20759 esac
20760 echo "Checking the sign of $zzz..." >&4
20761 cat > try.c <<EOCP
20762 #include <sys/types.h>
20763 #include <stdio.h>
20764 int main() {
20765         $gidtype foo = -1;
20766         if (foo < 0)
20767                 printf("-1\n");
20768         else
20769                 printf("1\n");
20770 }
20771 EOCP
20772 set try
20773 if eval $compile; then
20774         yyy=`$run ./try`
20775         case "$yyy" in
20776         '')     gidsign=1
20777                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20778                 ;;
20779         *)      gidsign=$yyy
20780                 case "$gidsign" in
20781                  1) echo "Your $zzz is unsigned." ;;
20782                 -1) echo "Your $zzz is signed."   ;;
20783                 esac
20784                 ;;
20785         esac
20786 else
20787         gidsign=1
20788         echo "(I can't compile the test program--guessing unsigned.)" >&4
20789 fi
20790
20791
20792 : Check 64bit sizes
20793 echo " "
20794
20795 if $test X"$quadtype" != X; then
20796
20797 echo "Checking how to print 64-bit integers..." >&4
20798
20799 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
20800         $cat >try.c <<'EOCP'
20801 #include <sys/types.h>
20802 #include <stdio.h>
20803 int main() {
20804   int 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='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
20814                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
20815                         echo "We will use %d."
20816                         ;;
20817                 esac
20818         fi
20819 fi
20820
20821 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
20822         $cat >try.c <<'EOCP'
20823 #include <sys/types.h>
20824 #include <stdio.h>
20825 int main() {
20826   long q = 12345678901;
20827   printf("%ld\n", q);
20828 }
20829 EOCP
20830         set try
20831         if eval $compile; then
20832                 yyy=`$run ./try`
20833                 case "$yyy" in
20834                 12345678901)
20835                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
20836                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
20837                         echo "We will use %ld."
20838                         ;;
20839                 esac
20840         fi
20841 fi
20842
20843 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
20844         $cat >try.c <<'EOCP'
20845 #include <sys/types.h>
20846 #include <inttypes.h>
20847 #include <stdio.h>
20848 int main() {
20849   int64_t q = 12345678901;
20850   printf("%" PRId64 "\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=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
20859                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
20860                         echo "We will use the C9X style."
20861                         ;;
20862                 esac
20863         fi
20864 fi
20865
20866 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20867         $cat >try.c <<EOCP
20868 #include <sys/types.h>
20869 #include <stdio.h>
20870 int main() {
20871   $quadtype q = 12345678901;
20872   printf("%Ld\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='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
20881                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20882                         echo "We will use %Ld."
20883                         ;;
20884                 esac
20885         fi
20886 fi
20887
20888 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20889         $cat >try.c <<'EOCP'
20890 #include <sys/types.h>
20891 #include <stdio.h>
20892 int main() {
20893   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20894   printf("%lld\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='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20903                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20904                         echo "We will use the %lld style."
20905                         ;;
20906                 esac
20907         fi
20908 fi
20909
20910 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20911         $cat >try.c <<EOCP
20912 #include <sys/types.h>
20913 #include <stdio.h>
20914 int main() {
20915   $quadtype q = 12345678901;
20916   printf("%qd\n", q);
20917 }
20918 EOCP
20919         set try
20920         if eval $compile; then
20921                 yyy=`$run ./try`
20922                 case "$yyy" in
20923                 12345678901)
20924                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20925                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20926                         echo "We will use %qd."
20927                         ;;
20928                 esac
20929         fi
20930 fi
20931
20932 if $test X"$sPRId64" = X; then
20933         echo "Cannot figure out how to print 64-bit integers." >&4
20934 fi
20935 $rm_try
20936
20937 fi
20938
20939 case "$sPRId64" in
20940 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20941         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20942         ;;
20943 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20944         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20945         ;;
20946 esac
20947
20948 : Check format strings for internal types
20949 echo " "
20950 $echo "Checking the format strings to be used for Perl's internal types..." >&4
20951
20952 if $test X"$ivsize" = X8; then
20953         ivdformat="$sPRId64"
20954         uvuformat="$sPRIu64"
20955         uvoformat="$sPRIo64"
20956         uvxformat="$sPRIx64"
20957         uvXUformat="$sPRIXU64"
20958 else
20959         if $test X"$ivsize" = X"$longsize"; then
20960                 ivdformat='"ld"'
20961                 uvuformat='"lu"'
20962                 uvoformat='"lo"'
20963                 uvxformat='"lx"'
20964                 uvXUformat='"lX"'
20965         else
20966                 if $test X"$ivsize" = X"$intsize"; then
20967                         ivdformat='"d"'
20968                         uvuformat='"u"'
20969                         uvoformat='"o"'
20970                         uvxformat='"x"'
20971                         uvXUformat='"X"'
20972                 else
20973                         : far out
20974                         if $test X"$ivsize" = X"$shortsize"; then
20975                                 ivdformat='"hd"'
20976                                 uvuformat='"hu"'
20977                                 uvoformat='"ho"'
20978                                 uvxformat='"hx"'
20979                                 uvXUformat='"hX"'
20980                         fi
20981                 fi
20982         fi
20983 fi
20984
20985 if $test X"$usequadmath" = X"$define"; then
20986     nveformat='"Qe"'
20987     nvfformat='"Qf"'
20988     nvgformat='"Qg"'
20989     nvEUformat='"QE"'
20990     nvFUformat='"QF"'
20991     nvGUformat='"QG"'
20992 else
20993     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20994         nveformat="$sPRIeldbl"
20995         nvfformat="$sPRIfldbl"
20996         nvgformat="$sPRIgldbl"
20997         nvEUformat="$sPRIEUldbl"
20998         nvFUformat="$sPRIFUldbl"
20999         nvGUformat="$sPRIGUldbl"
21000     else
21001         nveformat='"e"'
21002         nvfformat='"f"'
21003         nvgformat='"g"'
21004         nvEUformat='"E"'
21005         nvFUformat='"F"'
21006         nvGUformat='"G"'
21007     fi
21008 fi
21009
21010 case "$ivdformat" in
21011 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21012     exit 1
21013     ;;
21014 esac
21015
21016 : Check format string for GID
21017
21018 echo " "
21019 $echo "Checking the format string to be used for gids..." >&4
21020
21021 case "$gidsign" in
21022 -1)     if $test X"$gidsize" = X"$ivsize"; then
21023                 gidformat="$ivdformat"
21024         else
21025                 if $test X"$gidsize" = X"$longsize"; then
21026                         gidformat='"ld"'
21027                 else
21028                         if $test X"$gidsize" = X"$intsize"; then
21029                                 gidformat='"d"'
21030                         else
21031                                 if $test X"$gidsize" = X"$shortsize"; then
21032                                         gidformat='"hd"'
21033                                 fi
21034                         fi
21035                 fi
21036         fi
21037         ;;
21038 *)      if $test X"$gidsize" = X"$uvsize"; then
21039                 gidformat="$uvuformat"
21040         else
21041                 if $test X"$gidsize" = X"$longsize"; then
21042                         gidformat='"lu"'
21043                 else
21044                         if $test X"$gidsize" = X"$intsize"; then
21045                                 gidformat='"u"'
21046                         else
21047                                 if $test X"$gidsize" = X"$shortsize"; then
21048                                         gidformat='"hu"'
21049                                 fi
21050                         fi
21051                 fi
21052         fi
21053         ;;
21054 esac
21055
21056 : see if getgroups exists
21057 set getgroups d_getgrps
21058 eval $inlibc
21059
21060 : see if setgroups exists
21061 set setgroups d_setgrps
21062 eval $inlibc
21063
21064 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21065 echo " "
21066 case "$d_getgrps$d_setgrps" in
21067 *define*)
21068         case "$groupstype" in
21069         '') dflt="$gidtype" ;;
21070         *)  dflt="$groupstype" ;;
21071         esac
21072         $cat <<EOM
21073 What type of pointer is the second argument to getgroups() and setgroups()?
21074 Usually this is the same as group ids, $gidtype, but not always.
21075
21076 EOM
21077         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21078         . ./myread
21079         groupstype="$ans"
21080         ;;
21081 *)  groupstype="$gidtype";;
21082 esac
21083
21084 : check whether make sets MAKE
21085 echo " "
21086 echo "Checking if your $make program sets \$(MAKE)..." >&4
21087 case "$make_set_make" in
21088 '')
21089         $sed 's/^X //' > testmake.mak << 'EOF'
21090 Xall:
21091 X       @echo 'maketemp="$(MAKE)"'
21092 EOF
21093         case "`$make -f testmake.mak 2>/dev/null`" in
21094         *maketemp=*) make_set_make='#' ;;
21095         *)      make_set_make="MAKE=$make" ;;
21096         esac
21097         $rm -f testmake.mak
21098         ;;
21099 esac
21100 case "$make_set_make" in
21101 '#') echo "Yup, it does.";;
21102 *) echo "Nope, it doesn't.";;
21103 esac
21104
21105 : see what type is used for mode_t
21106 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21107 set mode_t modetype int stdio.h sys/types.h
21108 eval $typedef_ask
21109
21110 : see if we need va_copy
21111 echo " "
21112 case "$i_stdarg" in
21113 "$define")
21114         $cat >try.c <<EOCP
21115 #include <stdarg.h>
21116 #include <stdio.h>
21117 #$i_stdlib I_STDLIB
21118 #ifdef I_STDLIB
21119 #include <stdlib.h>
21120 #endif
21121 #include <signal.h>
21122
21123 int
21124 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21125 {
21126   return vfprintf(f, fmt, *valp);
21127 }
21128
21129 int
21130 myvfprintf(FILE *f, const  char *fmt, va_list val)
21131 {
21132   return ivfprintf(f, fmt, &val);
21133 }
21134
21135 int
21136 myprintf(char *fmt, ...)
21137 {
21138   va_list val;
21139   va_start(val, fmt);
21140   return myvfprintf(stdout, fmt, val);
21141 }
21142
21143 int
21144 main(int ac, char **av)
21145 {
21146   signal(SIGSEGV, exit);
21147
21148   myprintf("%s%cs all right, then\n", "that", '\'');
21149   exit(0);
21150 }
21151 EOCP
21152         set try
21153         if eval $compile && $run ./try 2>&1 >/dev/null; then
21154                 case "`$run ./try`" in
21155                 "that's all right, then")
21156                         okay=yes
21157                         ;;
21158                 esac
21159         fi
21160         case "$okay" in
21161         yes)    echo "It seems that you don't need va_copy()." >&4
21162                 need_va_copy="$undef"
21163                 ;;
21164         *)      echo "It seems that va_copy() or similar will be needed." >&4
21165                 need_va_copy="$define"
21166                 ;;
21167         esac
21168         $rm_try
21169         ;;
21170 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
21171         need_va_copy="$undef"
21172         ;;
21173 esac
21174
21175 : see what type is used for size_t
21176 rp="What is the type used for the length parameter for string functions?"
21177 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21178 eval $typedef_ask
21179
21180 : check for type of arguments to gethostbyaddr.
21181 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21182         case "$d_gethbyaddr" in
21183         $define)
21184                 $cat <<EOM
21185
21186 Checking to see what type of arguments are accepted by gethostbyaddr().
21187 EOM
21188                 hdrs="$define sys/types.h
21189                         $d_socket sys/socket.h
21190                         $i_niin netinet/in.h
21191                         $i_netdb netdb.h
21192                         $i_unistd unistd.h"
21193                 : The first arg can 'char *' or 'void *'
21194                 : The second arg is some of integral type
21195                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21196                         for yyy in size_t long int; do
21197                                 case "$netdb_host_type" in
21198                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21199                                         if ./protochk "$try" $hdrs; then
21200                                                 echo "Your system accepts $xxx for the first arg."
21201                                                 echo "...and $yyy for the second arg."
21202                                                 netdb_host_type="$xxx"
21203                                                 netdb_hlen_type="$yyy"
21204                                         fi
21205                                         ;;
21206                                 esac
21207                         done
21208                 done
21209                 : In case none of those worked, prompt the user.
21210                 case "$netdb_host_type" in
21211                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21212                         dflt='char *'
21213                         . ./myread
21214                         netdb_host_type=$ans
21215                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21216                         dflt="$sizetype"
21217                         . ./myread
21218                         netdb_hlen_type=$ans
21219                         ;;
21220                 esac
21221                 ;;
21222         *)      : no gethostbyaddr, so pick harmless defaults
21223                 netdb_host_type='char *'
21224                 netdb_hlen_type="$sizetype"
21225                 ;;
21226         esac
21227         # Remove the "const" if needed. -- but then we'll have a
21228         # prototype clash!
21229         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21230 fi
21231
21232 : check for type of argument to gethostbyname.
21233 if test "X$netdb_name_type" = X ; then
21234         case "$d_gethbyname" in
21235         $define)
21236                 $cat <<EOM
21237
21238 Checking to see what type of argument is accepted by gethostbyname().
21239 EOM
21240                 hdrs="$define sys/types.h
21241                         $d_socket sys/socket.h
21242                         $i_niin netinet/in.h
21243                         $i_netdb netdb.h
21244                         $i_unistd unistd.h"
21245                 for xxx in "const char *" "char *"; do
21246                         case "$netdb_name_type" in
21247                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21248                                 if ./protochk "$try" $hdrs; then
21249                                         echo "Your system accepts $xxx."
21250                                         netdb_name_type="$xxx"
21251                                 fi
21252                                 ;;
21253                         esac
21254                 done
21255                 : In case none of those worked, prompt the user.
21256                 case "$netdb_name_type" in
21257                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21258                         dflt='char *'
21259                         . ./myread
21260                         netdb_name_type=$ans
21261                         ;;
21262                 esac
21263                 ;;
21264         *)      : no gethostbyname, so pick harmless default
21265                 netdb_name_type='char *'
21266                 ;;
21267         esac
21268 fi
21269
21270 : check for type of 1st argument to getnetbyaddr.
21271 if test "X$netdb_net_type" = X ; then
21272         case "$d_getnbyaddr" in
21273         $define)
21274                 $cat <<EOM
21275
21276 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21277 EOM
21278                 hdrs="$define sys/types.h
21279                         $d_socket sys/socket.h
21280                         $i_niin netinet/in.h
21281                         $i_netdb netdb.h
21282                         $i_unistd unistd.h"
21283                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21284                         case "$netdb_net_type" in
21285                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21286                                 if ./protochk "$try" $hdrs; then
21287                                         echo "Your system accepts $xxx."
21288                                         netdb_net_type="$xxx"
21289                                 fi
21290                                 ;;
21291                         esac
21292                 done
21293                 : In case none of those worked, prompt the user.
21294                 case "$netdb_net_type" in
21295                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21296                         dflt='long'
21297                         . ./myread
21298                         netdb_net_type=$ans
21299                         ;;
21300                 esac
21301                 ;;
21302         *)      : no getnetbyaddr, so pick harmless default
21303                 netdb_net_type='long'
21304                 ;;
21305         esac
21306 fi
21307 : locate the preferred pager for this system
21308 fn=f/
21309 case "$pager" in
21310 '')
21311         dflt=''
21312         case "$pg" in
21313         /*) dflt=$pg;;
21314         [a-zA-Z]:/*) dflt=$pg;;
21315         esac
21316         case "$more" in
21317         /*) dflt=$more;;
21318         [a-zA-Z]:/*) dflt=$more;;
21319         esac
21320         case "$less" in
21321         /*) dflt=$less;;
21322         [a-zA-Z]:/*) dflt=$less;;
21323         esac
21324         case "$dflt" in
21325         '') dflt=/usr/ucb/more;;
21326         esac
21327         ;;
21328 *)      dflt="$pager"
21329         ;;
21330 esac
21331 fn="f/($dflt)"
21332 echo " "
21333 rp='What pager is used on your system?'
21334 . ./getfile
21335 pager="$ans"
21336
21337 : see what type pids are declared as in the kernel
21338 rp="What is the type of process ids on this system?"
21339 set pid_t pidtype int stdio.h sys/types.h
21340 eval $typedef_ask
21341
21342 : see if ar generates random libraries by itself
21343 echo " "
21344 echo "Checking how to generate random libraries on your machine..." >&4
21345 echo 'int bar1() { return bar2(); }' > bar1.c
21346 echo 'int bar2() { return 2; }' > bar2.c
21347 $cat > foo.c <<EOP
21348 #$i_stdlib I_STDLIB
21349 #ifdef I_STDLIB
21350 #include <stdlib.h>
21351 #endif
21352 int main() { printf("%d\n", bar1()); exit(0); }
21353 EOP
21354 $cc $ccflags -c bar1.c >/dev/null 2>&1
21355 $cc $ccflags -c bar2.c >/dev/null 2>&1
21356 $cc $ccflags -c foo.c >/dev/null 2>&1
21357 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21358 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21359         $run ./foobar >/dev/null 2>&1; then
21360         echo "$ar appears to generate random libraries itself."
21361         orderlib=false
21362         if [ "X$ranlib" = "X" ]; then
21363             ranlib=":"
21364         fi
21365 elif $ar s bar$_a >/dev/null 2>&1 &&
21366         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21367         $run ./foobar >/dev/null 2>&1; then
21368                 echo "a table of contents needs to be added with '$ar s'."
21369                 orderlib=false
21370                 ranlib="$ar s"
21371 elif $ar ts bar$_a >/dev/null 2>&1 &&
21372         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21373         $run ./foobar >/dev/null 2>&1; then
21374                 echo "a table of contents needs to be added with '$ar ts'."
21375                 orderlib=false
21376                 ranlib="$ar ts"
21377 else
21378         case "$ranlib" in
21379         :) ranlib='';;
21380         '')
21381                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21382                 $test -f $ranlib || ranlib=''
21383                 ;;
21384         esac
21385         if $test -n "$ranlib"; then
21386                 echo "your system has '$ranlib'; we'll use that."
21387                 orderlib=false
21388         else
21389                 echo "your system doesn't seem to support random libraries"
21390                 echo "so we'll use lorder and tsort to order the libraries."
21391                 orderlib=true
21392                 ranlib=":"
21393         fi
21394 fi
21395 $rm -f foo* bar*
21396
21397 : see if this is a values.h system
21398 set values.h i_values
21399 eval $inhdr
21400
21401 : Check the max offset that gmtime and localtime accept
21402 echo "Checking max offsets that gmtime () accepts"
21403
21404 case $i_values in
21405     define) yyy="#include <values.h>" ;;
21406     *)      yyy="" ;;
21407     esac
21408
21409 case "$sGMTIME_min/$sGMTIME_max" in
21410     0/0|/)
21411         $cat >try.c <<EOCP
21412 #include <sys/types.h>
21413 #include <stdio.h>
21414 #include <time.h>
21415 $yyy
21416
21417 int i;
21418 struct tm *tmp;
21419 time_t pt;
21420
21421 void gm_check (time_t t, int min_year, int max_year)
21422 {
21423     tmp = gmtime (&t);
21424     if ( tmp == NULL ||
21425         /* Check tm_year overflow */
21426          tmp->tm_year < min_year || tmp->tm_year > max_year)
21427         tmp = NULL;
21428     else
21429         pt = t;
21430     } /* gm_check */
21431
21432 int check_max ()
21433 {
21434     tmp = NULL;
21435     pt  = 0;
21436 #ifdef MAXLONG
21437     gm_check (MAXLONG, 69, 0x7fffffff);
21438 #endif
21439     if (tmp == NULL || tmp->tm_year < 0) {
21440         for (i = 63; i >= 0; i--) {
21441             time_t x = pt | ((time_t)1 << i);
21442             if (x < 0 || x < pt) continue;
21443             gm_check (x, 69, 0x7fffffff);
21444             }
21445         }
21446     printf ("sGMTIME_max=%ld\n", pt);
21447     return (0);
21448     } /* check_max */
21449
21450 int check_min ()
21451 {
21452     tmp = NULL;
21453     pt  = 0;
21454 #ifdef MINLONG
21455     gm_check (MINLONG, -1900, 70);
21456 #endif
21457     if (tmp == NULL) {
21458         for (i = 36; i >= 0; i--) {
21459             time_t x = pt - ((time_t)1 << i);
21460             if (x > 0) continue;
21461             gm_check (x, -1900, 70);
21462             }
21463         }
21464     printf ("sGMTIME_min=%ld\n", pt);
21465     return (0);
21466     } /* check_min */
21467
21468 int main (int argc, char *argv[])
21469 {
21470     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21471     check_max ();
21472     check_min ();
21473     return (0);
21474     } /* main */
21475 EOCP
21476         set try
21477         if eval $compile; then
21478             eval `$run ./try 2>/dev/null`
21479         else
21480             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21481             fi
21482         $rm_try
21483         ;;
21484     esac
21485
21486 echo "Checking max offsets that localtime () accepts"
21487
21488 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21489     0/0|/)
21490         $cat >try.c <<EOCP
21491 #include <sys/types.h>
21492 #include <stdio.h>
21493 #include <time.h>
21494 $yyy
21495
21496 int i;
21497 struct tm *tmp;
21498 time_t pt;
21499
21500 void local_check (time_t t, int min_year, int max_year)
21501 {
21502     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21503         tmp = NULL;
21504     else
21505         tmp = localtime (&t);
21506     if ( tmp == NULL ||
21507         /* Check tm_year overflow */
21508          tmp->tm_year < min_year || tmp->tm_year > max_year)
21509         tmp = NULL;
21510     else
21511         pt = t;
21512     } /* local_check */
21513
21514 int check_max ()
21515 {
21516     tmp = NULL;
21517     pt  = 0;
21518 #ifdef MAXLONG
21519     local_check (MAXLONG, 69, 0x7fffffff);
21520 #endif
21521     if (tmp == NULL || tmp->tm_year < 0) {
21522         for (i = 63; i >= 0; i--) {
21523             time_t x = pt | ((time_t)1 << i);
21524             if (x < 0 || x < pt) continue;
21525             local_check (x, 69, 0x7fffffff);
21526             }
21527         }
21528     printf ("sLOCALTIME_max=%ld\n", pt);
21529     return (0);
21530    } /* check_max */
21531
21532 int check_min ()
21533 {
21534     tmp = NULL;
21535     pt  = 0;
21536 #ifdef MINLONG
21537     local_check (MINLONG, -1900, 70);
21538 #endif
21539     if (tmp == NULL) {
21540         for (i = 36; i >= 0; i--) {
21541             time_t x = pt - ((time_t)1 << i);
21542             if (x > 0) continue;
21543             local_check (x, -1900, 70);
21544             }
21545         }
21546     printf ("sLOCALTIME_min=%ld\n", pt);
21547     return (0);
21548     } /* check_min */
21549
21550 int main (int argc, char *argv[])
21551 {
21552     check_max ();
21553     check_min ();
21554     return (0);
21555     } /* main */
21556 EOCP
21557         set try
21558         if eval $compile; then
21559             eval `$run ./try 2>/dev/null`
21560         else
21561             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21562             fi
21563         $rm_try
21564         ;;
21565     esac
21566
21567 : check for type of arguments to select.
21568 case "$selecttype" in
21569 '') case "$d_select" in
21570         $define)
21571                 echo " "
21572                 $cat <<EOM
21573 Checking to see what type of arguments are accepted by select().
21574 EOM
21575                 hdrs="$define sys/types.h
21576                         $i_systime sys/time.h
21577                         $i_sysselct sys/select.h
21578                         $d_socket sys/socket.h"
21579                 : The first arg can be int, unsigned, or size_t
21580                 : The last arg may or may not be 'const'
21581                 val=''
21582                 : void pointer has been seen but using that
21583                 : breaks the selectminbits test
21584                 for xxx in 'fd_set *' 'int *'; do
21585                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21586                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
21587                                         case "$val" in
21588                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21589                                                 if ./protochk "$try" $hdrs; then
21590                                                         echo "Your system accepts $xxx."
21591                                                         val="$xxx"
21592                                                 fi
21593                                                 ;;
21594                                         esac
21595                                 done
21596                         done
21597                 done
21598                 case "$val" in
21599                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21600                         case "$d_fd_set" in
21601                                 $define) dflt="fd_set *" ;;
21602                                 *)              dflt="int *" ;;
21603                         esac
21604                         . ./myread
21605                         val=$ans
21606                         ;;
21607                 esac
21608                 selecttype="$val"
21609                 ;;
21610         *)      : no select, so pick a harmless default
21611                 selecttype='int *'
21612                 ;;
21613         esac
21614         ;;
21615 esac
21616
21617 : check for the select 'width'
21618 case "$selectminbits" in
21619 '') safebits=`expr $ptrsize \* 8`
21620     case "$d_select" in
21621         $define)
21622                 $cat <<EOM
21623
21624 Checking to see on how many bits at a time your select() operates...
21625 EOM
21626                 $cat >try.c <<EOCP
21627 #include <sys/types.h>
21628 #$i_time I_TIME
21629 #$i_systime I_SYS_TIME
21630 #$i_systimek I_SYS_TIME_KERNEL
21631 #ifdef I_TIME
21632 #   include <time.h>
21633 #endif
21634 #ifdef I_SYS_TIME
21635 #   ifdef I_SYS_TIME_KERNEL
21636 #       define KERNEL
21637 #   endif
21638 #   include <sys/time.h>
21639 #   ifdef I_SYS_TIME_KERNEL
21640 #       undef KERNEL
21641 #   endif
21642 #endif
21643 #$i_sysselct I_SYS_SELECT
21644 #ifdef I_SYS_SELECT
21645 #include <sys/select.h>
21646 #endif
21647 #$d_socket HAS_SOCKET
21648 #ifdef HAS_SOCKET
21649 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21650 #endif
21651 #include <stdio.h>
21652 #$i_stdlib I_STDLIB
21653 #ifdef I_STDLIB
21654 #include <stdlib.h>
21655 #endif
21656 $selecttype b;
21657 #define S sizeof(*(b))
21658 #define MINBITS 64
21659 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21660 #define NBITS  (NBYTES * 8)
21661 int main() {
21662     char *s = (char *)malloc(NBYTES);
21663     struct timeval t;
21664     int i;
21665     FILE* fp;
21666     int fd;
21667
21668     if (!s)
21669         exit(1);
21670     fclose(stdin);
21671     fp = fopen("try.c", "r");
21672     if (fp == 0)
21673       exit(2);
21674     fd = fileno(fp);
21675     if (fd < 0)
21676       exit(3);
21677     b = ($selecttype)s;
21678     for (i = 0; i < NBITS; i++)
21679         FD_SET(i, b);
21680     t.tv_sec  = 0;
21681     t.tv_usec = 0;
21682     select(fd + 1, b, 0, 0, &t);
21683     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
21684     free(s);
21685     printf("%d\n", i + 1);
21686     return 0;
21687 }
21688 EOCP
21689                 set try
21690                 if eval $compile_ok; then
21691                         selectminbits=`$run ./try 2>/dev/null`
21692                         case "$selectminbits" in
21693                         '')     cat >&4 <<EOM
21694 Cannot figure out on how many bits at a time your select() operates.
21695 I'll play safe and guess it is $safebits bits.
21696 EOM
21697                                 selectminbits=$safebits
21698                                 bits="$safebits bits"
21699                                 ;;
21700                         1)      bits="1 bit" ;;
21701                         *)      bits="$selectminbits bits" ;;
21702                         esac
21703                         echo "Your select() operates on $bits at a time." >&4
21704                 else
21705                         rp='What is the minimum number of bits your select() operates on?'
21706                         case "$byteorder" in
21707                         12345678)       dflt=64 ;;
21708                         1234)           dflt=32 ;;
21709                         *)              dflt=1  ;;
21710                         esac
21711                         . ./myread
21712                         val=$ans
21713                         selectminbits="$val"
21714                 fi
21715                 $rm_try
21716                 ;;
21717         *)      : no select, so pick a harmless default
21718                 selectminbits=$safebits
21719                 ;;
21720         esac
21721         ;;
21722 esac
21723
21724 : Trace out the files included by signal.h, then look for SIGxxx names.
21725 if [ "X$fieldn" = X ]; then
21726         : Just make some guesses.  We check them later.
21727         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
21728 else
21729         xxx=`echo '#include <signal.h>' |
21730         $cppstdin $cppminus $cppflags 2>/dev/null |
21731         $grep '^[       ]*#.*include' |
21732         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
21733                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
21734 fi
21735 xxxfiles=''
21736 for xx in $xxx /dev/null ; do
21737         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
21738 done
21739 case "$xxxfiles" in
21740 '')     xxxfiles=`./findhdr signal.h` ;;
21741 esac
21742 xxx=`awk '
21743 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
21744         print substr($2, 4, 20)
21745 }
21746 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
21747         print substr($3, 4, 20)
21748 }' $xxxfiles`
21749 : Append some common names just in case the awk scan failed.
21750 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
21751 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
21752 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
21753 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
21754 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
21755
21756 : generate a few handy files for later
21757 $cat > signal.c <<EOCP
21758 #include <sys/types.h>
21759 #include <signal.h>
21760 #$i_stdlib I_STDLIB
21761 #ifdef I_STDLIB
21762 #include <stdlib.h>
21763 #endif
21764 #include <stdio.h>
21765 int main() {
21766
21767 /* Strange style to avoid deeply-nested #if/#else/#endif */
21768 #ifndef NSIG
21769 #  ifdef _NSIG
21770 #    define NSIG (_NSIG)
21771 #  endif
21772 #endif
21773
21774 #ifndef NSIG
21775 #  ifdef SIGMAX
21776 #    define NSIG (SIGMAX+1)
21777 #  endif
21778 #endif
21779
21780 #ifndef NSIG
21781 #  ifdef SIG_MAX
21782 #    define NSIG (SIG_MAX+1)
21783 #  endif
21784 #endif
21785
21786 #ifndef NSIG
21787 #  ifdef _SIG_MAX
21788 #    define NSIG (_SIG_MAX+1)
21789 #  endif
21790 #endif
21791
21792 #ifndef NSIG
21793 #  ifdef MAXSIG
21794 #    define NSIG (MAXSIG+1)
21795 #  endif
21796 #endif
21797
21798 #ifndef NSIG
21799 #  ifdef MAX_SIG
21800 #    define NSIG (MAX_SIG+1)
21801 #  endif
21802 #endif
21803
21804 #ifndef NSIG
21805 #  ifdef SIGARRAYSIZE
21806 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
21807 #  endif
21808 #endif
21809
21810 #ifndef NSIG
21811 #  ifdef _sys_nsig
21812 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
21813 #  endif
21814 #endif
21815
21816 /* Default to some arbitrary number that's big enough to get most
21817    of the common signals.
21818 */
21819 #ifndef NSIG
21820 #    define NSIG 50
21821 #endif
21822
21823 printf("NSIG %d\n", NSIG);
21824
21825 #ifndef JUST_NSIG
21826
21827 EOCP
21828
21829 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
21830 {
21831         printf "#ifdef SIG"; printf $1; printf "\n"
21832         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
21833         printf $1; printf ");\n"
21834         printf "#endif\n"
21835 }
21836 END {
21837         printf "#endif /* JUST_NSIG */\n";
21838         printf "exit(0);\n}\n";
21839 }
21840 ' >>signal.c
21841 $cat >signal.awk <<'EOP'
21842 BEGIN { ndups = 0 }
21843 $1 ~ /^NSIG$/ { nsig = $2 }
21844 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
21845     if ($2 > maxsig) { maxsig = $2 }
21846     if (sig_name[$2]) {
21847         dup_name[ndups] = $1
21848         dup_num[ndups] = $2
21849         ndups++
21850     }
21851     else {
21852         sig_name[$2] = $1
21853         sig_num[$2] = $2
21854     }
21855 }
21856 END {
21857     if (nsig == 0) {
21858         nsig = maxsig + 1
21859     }
21860     printf("NSIG %d\n", nsig);
21861     for (n = 1; n < nsig; n++) {
21862         if (sig_name[n]) {
21863             printf("%s %d\n", sig_name[n], sig_num[n])
21864         }
21865         else {
21866             printf("NUM%d %d\n", n, n)
21867         }
21868     }
21869     for (n = 0; n < ndups; n++) {
21870         printf("%s %d\n", dup_name[n], dup_num[n])
21871     }
21872 }
21873 EOP
21874 $cat >signal_cmd <<EOS
21875 $startsh
21876 if $test -s signal.lst; then
21877     echo "Using your existing signal.lst file"
21878         exit 0
21879 fi
21880 xxx="$xxx"
21881 EOS
21882 $cat >>signal_cmd <<'EOS'
21883
21884 set signal
21885 if eval $compile_ok; then
21886         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21887                 $uniq | $awk -f signal.awk >signal.lst
21888 else
21889         echo "(I can't seem be able to compile the whole test program)" >&4
21890         echo "(I'll try it in little pieces.)" >&4
21891         set signal -DJUST_NSIG
21892         if eval $compile_ok; then
21893                 $run ./signal$_exe > signal.nsg
21894                 $cat signal.nsg
21895         else
21896                 echo "I can't seem to figure out how many signals you have." >&4
21897                 echo "Guessing 50." >&4
21898                 echo 'NSIG 50' > signal.nsg
21899         fi
21900         : Now look at all the signal names, one at a time.
21901         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21902                 $cat > signal.c <<EOCP
21903 #include <sys/types.h>
21904 #include <signal.h>
21905 #include <stdio.h>
21906 int main() {
21907 printf("$xx %d\n", SIG${xx});
21908 return 0;
21909 }
21910 EOCP
21911                 set signal
21912                 if eval $compile; then
21913                         echo "SIG${xx} found."
21914                         $run ./signal$_exe  >> signal.ls1
21915                 else
21916                         echo "SIG${xx} NOT found."
21917                 fi
21918         done
21919         if $test -s signal.ls1; then
21920                 $cat signal.nsg signal.ls1 |
21921                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
21922         fi
21923
21924 fi
21925 if $test -s signal.lst; then
21926         :
21927 else
21928         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21929         echo 'kill -l' >signal
21930         set X `csh -f <signal`
21931         $rm -f signal
21932         shift
21933         case $# in
21934         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21935         esac
21936         echo $@ | $tr ' ' $trnl | \
21937             $awk '{ printf "%s %d\n", $1, ++s; }
21938                   END { printf "NSIG %d\n", ++s }' >signal.lst
21939 fi
21940 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21941 EOS
21942 chmod a+x signal_cmd
21943 $eunicefix signal_cmd
21944
21945 : generate list of signal names
21946 echo " "
21947 case "$sig_name_init" in
21948 '') doinit=yes ;;
21949 *)  case "$sig_num_init" in
21950     ''|*,*) doinit=yes ;;
21951     esac ;;
21952 esac
21953 case "$doinit" in
21954 yes)
21955         echo "Generating a list of signal names and numbers..." >&4
21956         . ./signal_cmd
21957         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21958         sig_name=`$awk 'BEGIN { printf "ZERO " }
21959                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21960         sig_num=`$awk  'BEGIN { printf "0 " }
21961                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21962         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
21963                              !/^NSIG/   { printf "\"%s\", ", $1 }
21964                              END        { printf "0\n" }' signal.lst`
21965         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21966                              !/^NSIG/   { printf "%d, ", $2}
21967                              END        { printf "0\n"}' signal.lst`
21968         ;;
21969 esac
21970 echo "The following $sig_count signals are available:"
21971 echo " "
21972 echo $sig_name | $awk \
21973 'BEGIN { linelen = 0 }
21974 {
21975         for (i = 1; i <= NF; i++) {
21976                 name = "SIG" $i " "
21977                 linelen = linelen + length(name)
21978                 if (linelen > 70) {
21979                         printf "\n"
21980                         linelen = length(name)
21981                 }
21982                 printf "%s", name
21983         }
21984         printf "\n"
21985 }'
21986 sig_size=`echo $sig_name | awk '{print NF}'`
21987 $rm -f signal signal.c signal.awk signal.lst signal_cmd
21988
21989 : Check size of size
21990 echo " "
21991 case "$sizetype" in
21992 *_t) zzz="$sizetype"    ;;
21993 *)   zzz="filesize"     ;;
21994 esac
21995 echo "Checking the size of $zzz..." >&4
21996 cat > try.c <<EOCP
21997 #include <sys/types.h>
21998 #include <stdio.h>
21999 #$i_stdlib I_STDLIB
22000 #ifdef I_STDLIB
22001 #include <stdlib.h>
22002 #endif
22003 int main() {
22004     printf("%d\n", (int)sizeof($sizetype));
22005     exit(0);
22006 }
22007 EOCP
22008 set try
22009 if eval $compile_ok; then
22010         yyy=`$run ./try`
22011         case "$yyy" in
22012         '')     sizesize=4
22013                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22014                 ;;
22015         *)      sizesize=$yyy
22016                 echo "Your $zzz size is $sizesize bytes."
22017                 ;;
22018         esac
22019 else
22020         sizesize=4
22021         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22022 fi
22023
22024
22025 : check for socklen_t
22026 echo " "
22027 echo "Checking to see if you have socklen_t..." >&4
22028 $cat >try.c <<EOCP
22029 #include <sys/types.h>
22030 #$d_socket HAS_SOCKET
22031 #ifdef HAS_SOCKET
22032 #include <sys/socket.h>
22033 #endif
22034 int main() { socklen_t x = 16; }
22035 EOCP
22036 set try
22037 if eval $compile; then
22038         val="$define"
22039         echo "You have socklen_t."
22040 else
22041         val="$undef"
22042         echo "You do not have socklen_t."
22043         case "$sizetype" in
22044         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22045         esac
22046 fi
22047 $rm_try
22048 set d_socklen_t
22049 eval $setvar
22050
22051 : see if this is a socks.h system
22052 set socks.h i_socks
22053 eval $inhdr
22054
22055 : check for type of the size argument to socket calls
22056 case "$d_socket" in
22057 "$define")
22058         $cat <<EOM
22059
22060 Checking to see what type is the last argument of accept().
22061 EOM
22062         yyy=''
22063         case "$d_socklen_t" in
22064         "$define") yyy="$yyy socklen_t"
22065         esac
22066         yyy="$yyy $sizetype int long unsigned"
22067         for xxx in $yyy; do
22068                 case "$socksizetype" in
22069                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22070                         case "$usesocks" in
22071                         "$define")
22072                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22073                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22074                                         socksizetype="$xxx"
22075                                 fi
22076                                 ;;
22077                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22078                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22079                                         socksizetype="$xxx"
22080                                 fi
22081                                 ;;
22082                         esac
22083                         ;;
22084                 esac
22085         done
22086 : In case none of those worked, prompt the user.
22087         case "$socksizetype" in
22088         '')     rp='What is the type for socket address structure sizes?'
22089                 dflt='int'
22090                 . ./myread
22091                 socksizetype=$ans
22092                 ;;
22093         esac
22094         ;;
22095 *)      : no sockets, so pick relatively harmless default
22096         socksizetype='int'
22097         ;;
22098 esac
22099
22100 : see what type is used for signed size_t
22101 set ssize_t ssizetype int stdio.h sys/types.h
22102 eval $typedef
22103 dflt="$ssizetype"
22104 $cat > try.c <<EOM
22105 #include <stdio.h>
22106 #$i_stdlib I_STDLIB
22107 #ifdef I_STDLIB
22108 #include <stdlib.h>
22109 #endif
22110 #include <sys/types.h>
22111 #define Size_t $sizetype
22112 #define SSize_t $dflt
22113 int main()
22114 {
22115         if (sizeof(Size_t) == sizeof(SSize_t))
22116                 printf("$dflt\n");
22117         else if (sizeof(Size_t) == sizeof(int))
22118                 printf("int\n");
22119         else
22120                 printf("long\n");
22121         exit(0);
22122 }
22123 EOM
22124 echo " "
22125 set try
22126 if eval $compile_ok && $run ./try > /dev/null; then
22127         ssizetype=`$run ./try`
22128         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22129 else
22130         $cat >&4 <<EOM
22131 Help! I can't compile and run the ssize_t test program: please enlighten me!
22132 (This is probably a misconfiguration in your system or libraries, and
22133 you really ought to fix it.  Still, I'll try anyway.)
22134
22135 I need a type that is the same size as $sizetype, but is guaranteed to
22136 be signed.  Common values are ssize_t, int and long.
22137
22138 EOM
22139         rp="What signed type is the same size as $sizetype?"
22140         . ./myread
22141         ssizetype="$ans"
22142 fi
22143 $rm_try
22144
22145 : Check the size of st_ino
22146 $echo " "
22147 $echo "Checking the size of st_ino..." >&4
22148 $cat > try.c <<EOCP
22149 #include <sys/stat.h>
22150 #include <stdio.h>
22151 #$i_stdlib I_STDLIB
22152 #ifdef I_STDLIB
22153 #include <stdlib.h>
22154 #endif
22155 int main() {
22156     struct stat st;
22157     printf("%d\n", (int)sizeof(st.st_ino));
22158     exit(0);
22159 }
22160 EOCP
22161 set try
22162 if eval $compile_ok; then
22163         val=`$run ./try`
22164         case "$val" in
22165         '')     st_ino_size=4
22166                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22167                 ;;
22168         *)      st_ino_size=$val
22169                 $echo "Your st_ino is $st_ino_size bytes long."
22170                 ;;
22171         esac
22172 else
22173         st_ino_size=4
22174         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22175 fi
22176 $rm_try
22177
22178 : Check if st_ino is signed
22179 $echo " "
22180 $echo "Checking the sign of st_ino..." >&4
22181 $cat > try.c <<EOCP
22182 #include <sys/stat.h>
22183 #include <stdio.h>
22184 int main() {
22185         struct stat foo;
22186         foo.st_ino = -1;
22187         if (foo.st_ino < 0)
22188                 printf("-1\n");
22189         else
22190                 printf("1\n");
22191 }
22192 EOCP
22193 set try
22194 if eval $compile; then
22195         val=`$run ./try`
22196         case "$val" in
22197         '')     st_ino_sign=1
22198                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22199                 ;;
22200         *)      st_ino_sign=$val
22201                 case "$st_ino_sign" in
22202                  1) $echo "Your st_ino is unsigned." ;;
22203                 -1) $echo "Your st_ino is signed."   ;;
22204                 esac
22205                 ;;
22206         esac
22207 else
22208         st_ino_sign=1
22209         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22210 fi
22211 $rm_try
22212
22213 : see what type of char stdio uses.
22214 echo " "
22215 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22216 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22217         echo "Your stdio uses unsigned chars." >&4
22218         stdchar="unsigned char"
22219 else
22220         echo "Your stdio uses signed chars." >&4
22221         stdchar="char"
22222 fi
22223 $rm -f stdioh
22224
22225 : see what type uids are declared as in the kernel
22226 echo " "
22227 echo "Looking for the type for user ids returned by getuid()."
22228 set uid_t uidtype xxx stdio.h sys/types.h
22229 eval $typedef
22230 case "$uidtype" in
22231 xxx)
22232         xxx=`./findhdr sys/user.h`
22233         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
22234         case $1 in
22235         unsigned) dflt="$1 $2" ;;
22236         *) dflt="$1" ;;
22237         esac
22238         ;;
22239 *) dflt="$uidtype";;
22240 esac
22241 case "$uidtype" in
22242 uid_t)  echo "uid_t found." ;;
22243 *)      rp="What is the type for user ids returned by getuid()?"
22244         . ./myread
22245         uidtype="$ans"
22246         ;;
22247 esac
22248
22249 : Check size of UID
22250 echo " "
22251 case "$uidtype" in
22252 *_t) zzz="$uidtype"     ;;
22253 *)   zzz="uid"          ;;
22254 esac
22255 echo "Checking the size of $zzz..." >&4
22256 cat > try.c <<EOCP
22257 #include <sys/types.h>
22258 #include <stdio.h>
22259 #$i_stdlib I_STDLIB
22260 #ifdef I_STDLIB
22261 #include <stdlib.h>
22262 #endif
22263 int main() {
22264     printf("%d\n", (int)sizeof($uidtype));
22265     exit(0);
22266 }
22267 EOCP
22268 set try
22269 if eval $compile_ok; then
22270         yyy=`$run ./try`
22271         case "$yyy" in
22272         '')     uidsize=4
22273                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22274                 ;;
22275         *)      uidsize=$yyy
22276                 echo "Your $zzz is $uidsize bytes long."
22277                 ;;
22278         esac
22279 else
22280         uidsize=4
22281         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22282 fi
22283
22284 : Check if UID is signed
22285 echo " "
22286 case "$uidtype" in
22287 *_t) zzz="$uidtype"     ;;
22288 *)   zzz="uid"          ;;
22289 esac
22290 echo "Checking the sign of $zzz..." >&4
22291 cat > try.c <<EOCP
22292 #include <sys/types.h>
22293 #include <stdio.h>
22294 int main() {
22295         $uidtype foo = -1;
22296         if (foo < 0)
22297                 printf("-1\n");
22298         else
22299                 printf("1\n");
22300 }
22301 EOCP
22302 set try
22303 if eval $compile; then
22304         yyy=`$run ./try`
22305         case "$yyy" in
22306         '')     uidsign=1
22307                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22308                 ;;
22309         *)      uidsign=$yyy
22310                 case "$uidsign" in
22311                  1) echo "Your $zzz is unsigned." ;;
22312                 -1) echo "Your $zzz is signed."   ;;
22313                 esac
22314                 ;;
22315         esac
22316 else
22317         uidsign=1
22318         echo "(I can't compile the test program--guessing unsigned.)" >&4
22319 fi
22320
22321
22322 : Check format string for UID
22323 echo " "
22324 $echo "Checking the format string to be used for uids..." >&4
22325
22326 case "$uidsign" in
22327 -1)     if $test X"$uidsize" = X"$ivsize"; then
22328                 uidformat="$ivdformat"
22329         else
22330                 if $test X"$uidsize" = X"$longsize"; then
22331                         uidformat='"ld"'
22332                 else
22333                         if $test X"$uidsize" = X"$intsize"; then
22334                                 uidformat='"d"'
22335                         else
22336                                 if $test X"$uidsize" = X"$shortsize"; then
22337                                         uidformat='"hd"'
22338                                 fi
22339                         fi
22340                 fi
22341         fi
22342         ;;
22343 *)      if $test X"$uidsize" = X"$uvsize"; then
22344                 uidformat="$uvuformat"
22345         else
22346                 if $test X"$uidsize" = X"$longsize"; then
22347                         uidformat='"lu"'
22348                 else
22349                         if $test X"$uidsize" = X"$intsize"; then
22350                                 uidformat='"u"'
22351                         else
22352                                 if $test X"$uidsize" = X"$shortsize"; then
22353                                         uidformat='"hu"'
22354                                 fi
22355                         fi
22356                 fi
22357         fi
22358         ;;
22359 esac
22360
22361 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22362 echo " "
22363 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22364 $cat >try.c <<'EOM'
22365 /* Intentionally a long probe as I'd like to sanity check that the exact
22366    approach is going to work, as thinking it will work, but only having it
22367    part working at runtime is worse than not having it.  */
22368
22369 #include <sys/types.h>
22370 #include <sys/sysctl.h>
22371 #include <sys/param.h>
22372 #include <stdio.h>
22373 #include <string.h>
22374 #include <stdlib.h>
22375 #include <unistd.h>
22376
22377 int
22378 main(int argc, char **argv) {
22379     char *buffer;
22380     char *argv_leaf = strrchr(argv[0], '/');
22381     char *buffer_leaf;
22382     size_t size = 0;
22383     int mib[4];
22384
22385     mib[0] = CTL_KERN;
22386     mib[1] = KERN_PROC;
22387     mib[2] = KERN_PROC_PATHNAME;
22388     mib[3] = -1;
22389
22390     if (!argv_leaf) {
22391         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22392         return 1;
22393     }
22394
22395     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22396         perror("sysctl");
22397         return 2;
22398     }
22399
22400     if (size < strlen(argv_leaf) + 1) {
22401         fprintf(stderr, "size %lu is too short for a path\n",
22402                 (unsigned long) size);
22403         return 3;
22404     }
22405
22406     if (size > MAXPATHLEN * MAXPATHLEN) {
22407         fprintf(stderr, "size %lu is too long for a path\n",
22408                 (unsigned long) size);
22409         return 4;
22410     }
22411
22412     buffer = malloc(size);
22413     if (!buffer) {
22414         perror("malloc");
22415         return 5;
22416     }
22417
22418     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22419         perror("sysctl");
22420         return 6;
22421     }
22422
22423     if (strlen(buffer) + 1 != size) {
22424         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22425                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22426         return 7;
22427     }
22428
22429
22430     if (*buffer != '/') {
22431         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22432         return 8;
22433     }
22434
22435     if (strstr(buffer, "/./")) {
22436         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22437         return 9;
22438     }
22439
22440     if (strstr(buffer, "/../")) {
22441         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22442         return 10;
22443     }
22444
22445     buffer_leaf = strrchr(buffer, '/');
22446     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22447         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22448         return 11;
22449     }
22450
22451     free(buffer);
22452
22453     return 0;
22454 }
22455 EOM
22456
22457 val=$undef
22458 set try
22459 if eval $compile; then
22460         if $run ./try; then
22461                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22462                 val="$define"
22463         else
22464                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22465                 val="$undef"
22466         fi
22467 else
22468         echo "I'm unable to compile the test program." >&4
22469         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22470         val="$undef"
22471 fi
22472 $rm_try
22473 set usekernprocpathname
22474 eval $setvar
22475
22476 : Determine if we can use _NSGetExecutablePath to find executing program
22477 echo " "
22478 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22479 $cat >try.c <<'EOM'
22480 /* Intentionally a long probe as I'd like to sanity check that the exact
22481    approach is going to work, as thinking it will work, but only having it
22482    part working at runtime is worse than not having it.  */
22483 #include <mach-o/dyld.h>
22484 #include <stdio.h>
22485 #include <stdlib.h>
22486 #include <sys/param.h>
22487 #include <string.h>
22488
22489 int
22490 main(int argc, char **argv) {
22491     char buf[1];
22492     uint32_t size = sizeof(buf);
22493     int result;
22494     char *buffer;
22495     char *tidied;
22496     char *argv_leaf = strrchr(argv[0], '/');
22497     char *tidied_leaf;
22498
22499     if (!argv_leaf) {
22500         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22501         return 1;
22502     }
22503
22504     _NSGetExecutablePath(buf, &size);
22505     if (size > MAXPATHLEN * MAXPATHLEN) {
22506         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22507                 (unsigned int) size);
22508         return 2;
22509     }
22510
22511     buffer = malloc(size);
22512     if (!buffer) {
22513         perror("malloc");
22514         return 3;
22515     }
22516
22517     result = _NSGetExecutablePath(buffer, &size);
22518     if (result != 0) {
22519         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22520                 result, (unsigned int) size);
22521         return 4;
22522     }
22523
22524     tidied = realpath(buffer, NULL);
22525     if (!tidied) {
22526         perror("realpath");
22527         return 5;
22528     }
22529
22530     free(buffer);
22531
22532     if (*tidied != '/') {
22533         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22534         return 6;
22535     }
22536
22537     if (strstr(tidied, "/./")) {
22538         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22539         return 7;
22540     }
22541
22542     if (strstr(tidied, "/../")) {
22543         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22544         return 8;
22545     }
22546
22547     tidied_leaf = strrchr(tidied, '/');
22548     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22549         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22550         return 9;
22551     }
22552
22553     free(tidied);
22554
22555     return 0;
22556 }
22557 EOM
22558
22559 val=$undef
22560 set try
22561 if eval $compile; then
22562         if $run ./try; then
22563                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22564                 val="$define"
22565         else
22566                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22567         fi
22568 else
22569         echo "I'm unable to compile the test program." >&4
22570         echo "I'll assume no _NSGetExecutablePath here." >&4
22571 fi
22572 $rm_try
22573 set usensgetexecutablepath
22574 eval $setvar
22575
22576 : Check if site customization support was requested
22577 case "$usesitecustomize" in
22578     $define|true|[Yy]*)
22579         usesitecustomize="$define"
22580         ;;
22581     *)
22582         usesitecustomize="$undef"
22583         ;;
22584     esac
22585
22586 : see if prototypes support variable argument declarations
22587 echo " "
22588 case "$prototype$i_stdarg" in
22589 $define$define)
22590         echo "It appears we'll be able to prototype varargs functions." >&4
22591         val="$define"
22592         ;;
22593 *)
22594         echo "Too bad... We won't be using prototyped varargs functions..." >&4
22595         val="$undef"
22596         ;;
22597 esac
22598 set vaproto
22599 eval $setvar
22600
22601 : determine compiler compiler
22602 case "$yacc" in
22603 '')
22604         dflt=yacc;;
22605 *)
22606         dflt="$yacc";;
22607 esac
22608 echo " "
22609 comp='yacc'
22610 if $test -f "$byacc$_exe"; then
22611         dflt="$byacc"
22612         comp="byacc or $comp"
22613 fi
22614 if $test -f "$bison$_exe"; then
22615         comp="$comp or bison -y"
22616 fi
22617 rp="Which compiler compiler ($comp) shall I use?"
22618 . ./myread
22619 yacc="$ans"
22620 case "$yacc" in
22621 *bis*)
22622         case "$yacc" in
22623         *-y*) ;;
22624         *)
22625                 yacc="$yacc -y"
22626                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22627                 ;;
22628         esac
22629         ;;
22630 esac
22631
22632 : see if this is a assert.h system
22633 set assert.h i_assert
22634 eval $inhdr
22635
22636 : see if this is a bfd.h system
22637 set bfd.h i_bfd
22638 eval $inhdr
22639
22640 : see if this is an execinfo.h system
22641 set execinfo.h i_execinfo
22642 eval $inhdr
22643
22644 : see if this is a fenv.h system
22645 set fenv.h i_fenv
22646 eval $inhdr
22647
22648 : see if this is a fp.h system
22649 set fp.h i_fp
22650 eval $inhdr
22651
22652 : see if this is a fp_class.h system
22653 set fp_class.h i_fp_class
22654 eval $inhdr
22655
22656 : see if gdbm.h is available
22657 set gdbm.h t_gdbm
22658 eval $inhdr
22659 case "$t_gdbm" in
22660 $define)
22661         : see if gdbm_open exists
22662         set gdbm_open d_gdbm_open
22663         eval $inlibc
22664         case "$d_gdbm_open" in
22665         $undef)
22666                 t_gdbm="$undef"
22667                 echo "We won't be including <gdbm.h>"
22668                 ;;
22669         esac
22670         ;;
22671 esac
22672 val="$t_gdbm"
22673 set i_gdbm
22674 eval $setvar
22675
22676 : see if this is a ieeefp.h system
22677 case "$i_ieeefp" in
22678 '' ) set ieeefp.h i_ieeefp
22679      eval $inhdr
22680      ;;
22681 esac
22682
22683 : see if this is a libutil.h system
22684 set libutil.h i_libutil
22685 eval $inhdr
22686
22687 : see if mach cthreads are available
22688 if test "X$usethreads" = "X$define"; then
22689         set mach/cthreads.h i_machcthr
22690         eval $inhdr
22691 else
22692         i_machcthr="$undef"
22693 fi
22694
22695 : see if this is a mntent.h system
22696 set mntent.h i_mntent
22697 eval $inhdr
22698
22699 : see if net/errno.h is available
22700 val=''
22701 set net/errno.h val
22702 eval $inhdr
22703
22704 : Unfortunately, it causes problems on some systems.  Arrgh.
22705 case "$val" in
22706 $define)
22707         cat > try.c <<'EOM'
22708 #include <stdio.h>
22709 #include <errno.h>
22710 #include <net/errno.h>
22711 int func()
22712 {
22713         return ENOTSOCK;
22714 }
22715 EOM
22716         if $cc $ccflags -c try.c >/dev/null 2>&1; then
22717                 echo "We'll be including <net/errno.h>." >&4
22718         else
22719                 echo "We won't be including <net/errno.h>." >&4
22720                 val="$undef"
22721         fi
22722         $rm_try
22723         ;;
22724 esac
22725 set i_neterrno
22726 eval $setvar
22727
22728 : see if netinet/tcp.h is available
22729 set netinet/tcp.h i_netinettcp
22730 eval $inhdr
22731
22732 : see if this is a poll.h system
22733 set poll.h i_poll
22734 eval $inhdr
22735
22736 : see if this is a prot.h system
22737 set prot.h i_prot
22738 eval $inhdr
22739
22740 : Preprocessor symbols
22741 echo " "
22742 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
22743 $cat <<'EOSH' > Cppsym.know
22744 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
22745 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
22746 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
22747 arch_pwr ardent ARM ARM32 atarist att386 att3b
22748 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
22749 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
22750 byteorder byte_order
22751 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
22752 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
22753 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
22754 ELF encore EPI EXTENSIONS
22755 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
22756 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
22757 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
22758 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
22759 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400 hp9000s500
22760 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
22761 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
22762 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
22763 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
22764 ksr1
22765 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
22766 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
22767 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
22768 luna88k Lynx
22769 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
22770 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
22771 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
22772 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
22773 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
22774 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
22775 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
22776 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
22777 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
22778 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
22779 ns32000 ns32016 ns32332 ns32k nsc32000
22780 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
22781 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
22782 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
22783 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
22784 QK_USER QNX
22785 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
22786 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
22787 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
22788 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
22789 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
22790 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
22791 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
22792 SYSV4 SYSV5 sysV68 sysV88
22793 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
22794 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
22795 tower32_800 tower32_850 tss
22796 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
22797 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
22798 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
22799 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
22800 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
22801 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
22802 uxpm uxps
22803 vax venix VMESA vms
22804 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
22805 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
22806 z8000 zarch
22807 EOSH
22808 # Maybe put other stuff here too.
22809 ./tr '-' '_' <<EOSH >>Cppsym.know
22810 $osname
22811 EOSH
22812 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
22813 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
22814 $cat Cppsym.know > Cppsym.c
22815 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
22816 $rm -f Cppsym.a Cppsym.b Cppsym.c
22817 cat <<EOSH > Cppsym
22818 $startsh
22819 if $test \$# -gt 0; then
22820     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
22821     if $test -s Cppsym.got; then
22822         $rm -f Cppsym.got
22823         exit 0
22824     fi
22825     $rm -f Cppsym.got
22826     exit 1
22827 else
22828     $tr " " "$trnl" | ./Cppsym.try
22829     exit 0
22830 fi
22831 EOSH
22832 chmod +x Cppsym
22833 $eunicefix Cppsym
22834 cat <<EOSH > Cppsym.try
22835 $startsh
22836 cat <<'EOCP' > try.c
22837 #include <stdio.h>
22838 #if cpp_stuff == 1
22839 #define STRINGIFY(a)    "a"
22840 #endif
22841 #if cpp_stuff == 42
22842 #define StGiFy(a)  #a
22843 #define STRINGIFY(a)    StGiFy(a)
22844 #endif
22845 #if $cpp_stuff != 1 && $cpp_stuff != 42
22846 #   include "Bletch: How does this C preprocessor stringify macros?"
22847 #endif
22848 int main() {
22849 EOCP
22850 $awk \\
22851 EOSH
22852 cat <<'EOSH' >> Cppsym.try
22853 'length($1) > 0 {
22854     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
22855     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
22856     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
22857     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
22858 }'       >> try.c
22859 echo 'return 0;}' >> try.c
22860 EOSH
22861 cat <<EOSH >> Cppsym.try
22862 ccflags="$ccflags"
22863 case "$osname-$gccversion" in
22864 irix-) ccflags="\$ccflags -woff 1178" ;;
22865 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
22866 esac
22867 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
22868 EOSH
22869 chmod +x Cppsym.try
22870 $eunicefix Cppsym.try
22871 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
22872 : Add in any Linux cpp "predefined macros":
22873 case "$osname::$gccversion" in
22874   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
22875     tHdrH=_tmpHdr
22876     rm -f $tHdrH'.h' $tHdrH
22877     touch $tHdrH'.h'
22878     # Filter out macro arguments, such as Linux's __INT8_C(c)
22879     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
22880        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
22881        if [ -s $tHdrH'_cppsym.real' ]; then
22882           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22883        fi
22884     fi
22885     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22886   ;;
22887 esac
22888 : now check the C compiler for additional symbols
22889 postprocess_cc_v=''
22890 case "$osname" in
22891 aix) postprocess_cc_v="|$tr , ' '" ;;
22892 esac
22893 $cat >ccsym <<EOS
22894 $startsh
22895 $cat >tmp.c <<EOF
22896 extern int foo;
22897 EOF
22898 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22899 do
22900         case "\$i" in
22901         -D*) echo "\$i" | $sed 's/^-D//';;
22902         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22903         esac
22904 done
22905 $rm_try
22906 EOS
22907 postprocess_cc_v=''
22908 chmod +x ccsym
22909 $eunicefix ccsym
22910 ./ccsym > ccsym1.raw
22911 if $test -s ccsym1.raw; then
22912     $sort ccsym1.raw | $uniq >ccsym.raw
22913 else
22914     mv ccsym1.raw ccsym.raw
22915 fi
22916
22917 $awk '/\=/ { print $0; next }
22918         { print $0"=1" }' ccsym.raw >ccsym.list
22919 $comm -13 Cppsym.true ccsym.list >ccsym.own
22920 $comm -12 Cppsym.true ccsym.list >ccsym.com
22921 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
22922 also=''
22923 if $test -z ccsym.raw; then
22924         echo "Your C compiler doesn't seem to define any symbols!" >&4
22925         echo " "
22926         echo "However, your C preprocessor defines the following symbols:"
22927         $cat Cppsym.true
22928         ccsymbols=''
22929         cppsymbols=`$cat Cppsym.true`
22930         cppsymbols=`echo $cppsymbols`
22931         cppccsymbols="$cppsymbols"
22932 else
22933         if $test -s ccsym.com; then
22934                 echo "Your C compiler and pre-processor define these symbols:"
22935                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22936                 also='also '
22937                 symbols='ones'
22938                 cppccsymbols=`$cat ccsym.com`
22939                 cppccsymbols=`echo $cppccsymbols`
22940                 $test "$silent" || sleep 1
22941         fi
22942         if $test -s ccsym.cpp; then
22943                 $test "$also" && echo " "
22944                 echo "Your C pre-processor ${also}defines the following symbols:"
22945                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22946                 also='further '
22947                 cppsymbols=`$cat ccsym.cpp`
22948                 cppsymbols=`echo $cppsymbols`
22949                 $test "$silent" || sleep 1
22950         fi
22951         if $test -s ccsym.own; then
22952                 $test "$also" && echo " "
22953                 echo "Your C compiler ${also}defines the following cpp symbols:"
22954                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22955                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22956                 ccsymbols=`$cat ccsym.own`
22957                 ccsymbols=`echo $ccsymbols`
22958                 $test "$silent" || sleep 1
22959         fi
22960 fi
22961
22962 : add -D_FORTIFY_SOURCE if feasible and not already there
22963 case "$gccversion" in
22964 4.*)    case "$optimize$ccflags" in
22965         *-O*)   case "$ccflags$cppsymbols" in
22966                 *_FORTIFY_SOURCE=*) # Don't add it again.
22967                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
22968                         ;;
22969                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
22970                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
22971                         ;;
22972                 esac
22973                 ;;
22974         *)      echo "You have gcc 4.* but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
22975                 ;;
22976         esac
22977         ;;
22978 *)      echo "You seem not to have gcc 4.*, not adding -D_FORTIFY_SOURCE." >&4
22979         ;;
22980 esac
22981
22982 : see if this is a termio system
22983 val="$undef"
22984 val2="$undef"
22985 val3="$undef"
22986 if $test `./findhdr termios.h`; then
22987     set tcsetattr i_termios
22988     eval $inlibc
22989     val3="$i_termios"
22990 fi
22991 echo " "
22992 case "$val3" in
22993     "$define") echo "You have POSIX termios.h... good!" >&4;;
22994     *)  if ./Cppsym pyr; then
22995             case "`$run /bin/universe`" in
22996                 ucb) if $test `./findhdr sgtty.h`; then
22997                         val2="$define"
22998                         echo "<sgtty.h> found." >&4
22999                     else
23000                         echo "System is pyramid with BSD universe."
23001                         ./warn "<sgtty.h> not found--you could have problems."
23002                     fi;;
23003                 *)  if $test `./findhdr termio.h`; then
23004                         val="$define"
23005                         echo "<termio.h> found." >&4
23006                     else
23007                         echo "System is pyramid with USG universe."
23008                         ./warn "<termio.h> not found--you could have problems."
23009                     fi;;
23010             esac
23011         elif ./usg; then
23012             if $test `./findhdr termio.h`; then
23013                 echo "<termio.h> found." >&4
23014                 val="$define"
23015             elif $test `./findhdr sgtty.h`; then
23016                 echo "<sgtty.h> found." >&4
23017                 val2="$define"
23018             else
23019                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23020             fi
23021         else
23022             if $test `./findhdr sgtty.h`; then
23023                 echo "<sgtty.h> found." >&4
23024                 val2="$define"
23025             elif $test `./findhdr termio.h`; then
23026                 echo "<termio.h> found." >&4
23027                 val="$define"
23028             else
23029                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23030             fi
23031         fi;;
23032 esac
23033 set i_termio; eval $setvar
23034 val=$val2; set i_sgtty; eval $setvar
23035 val=$val3; set i_termios; eval $setvar
23036
23037 : see if stdbool is available
23038 : we want a real compile instead of Inhdr because some Solaris systems
23039 : have stdbool.h, but it can only be used if the compiler indicates it
23040 : is sufficiently c99-compliant.
23041 echo " "
23042 $cat >try.c <<EOCP
23043 #include <stdio.h>
23044 #include <stdbool.h>
23045 int func(bool x)
23046 {
23047     return x ? 1 : 0;
23048 }
23049 int main(int argc, char **argv)
23050 {
23051     return func(0);
23052 }
23053 EOCP
23054 set try
23055 if eval $compile; then
23056         echo "<stdbool.h> found." >&4
23057         val="$define"
23058 else
23059         echo "<stdbool.h> NOT found." >&4
23060         val="$undef"
23061 fi
23062 $rm_try
23063 set i_stdbool
23064 eval $setvar
23065
23066 : see if stddef is available
23067 set stddef.h i_stddef
23068 eval $inhdr
23069
23070 : see if stdint is available
23071 set stdint.h i_stdint
23072 eval $inhdr
23073
23074 : see if sys/access.h is available
23075 set sys/access.h i_sysaccess
23076 eval $inhdr
23077
23078 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23079 set sys/filio.h i_sysfilio
23080 eval $inhdr
23081 echo " "
23082 if $test `./findhdr sys/ioctl.h`; then
23083         val="$define"
23084         echo '<sys/ioctl.h> found.' >&4
23085 else
23086         val="$undef"
23087         if $test $i_sysfilio = "$define"; then
23088             echo '<sys/ioctl.h> NOT found.' >&4
23089         else
23090                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23091                 $test $i_termio = "$define" && xxx="termio.h"
23092                 $test $i_termios = "$define" && xxx="termios.h"
23093 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23094         fi
23095 fi
23096 set i_sysioctl
23097 eval $setvar
23098
23099 : see if socket ioctl defs are in sys/sockio.h
23100 echo " "
23101 xxx=`./findhdr sys/sockio.h`
23102 if $test "$xxx"; then
23103         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23104                 val="$define"
23105                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23106         else
23107                 val="$undef"
23108                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23109         fi
23110 else
23111         val="$undef"
23112         $cat <<EOM
23113 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23114 EOM
23115 fi
23116 set i_syssockio
23117 eval $setvar
23118
23119 : see if this is a syslog.h system
23120 set syslog.h i_syslog
23121 eval $inhdr
23122
23123 : see if this is a sys/mode.h system
23124 set sys/mode.h i_sysmode
23125 eval $inhdr
23126
23127 : see if there is a sys/poll.h file
23128 set sys/poll.h i_syspoll
23129 eval $inhdr
23130
23131 : see if sys/resource.h has to be included
23132 set sys/resource.h i_sysresrc
23133 eval $inhdr
23134
23135 : see if sys/security.h is available
23136 set sys/security.h i_syssecrt
23137 eval $inhdr
23138
23139 : see if this is a sys/statvfs.h system
23140 set sys/statvfs.h i_sysstatvfs
23141 eval $inhdr
23142
23143 : see if this is a sys/un.h system
23144 set sys/un.h i_sysun
23145 eval $inhdr
23146
23147 : see if this is a sys/utsname.h system
23148 set sys/utsname.h i_sysutsname
23149 eval $inhdr
23150
23151 : see if this is a syswait system
23152 set sys/wait.h i_syswait
23153 eval $inhdr
23154
23155 : see if this is a ustat.h system
23156 set ustat.h i_ustat
23157 eval $inhdr
23158
23159 : see if this is an utime system
23160 set utime.h i_utime
23161 eval $inhdr
23162
23163 : see if this is a vfork system
23164 case "$d_vfork" in
23165 "$define")
23166         set vfork.h i_vfork
23167         eval $inhdr
23168         ;;
23169 *)
23170         i_vfork="$undef"
23171         ;;
23172 esac
23173
23174 : Check extensions
23175 echo " "
23176 echo "Looking for extensions..." >&4
23177 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23178 : contain old or inaccurate or duplicate values.
23179 nonxs_extensions=''
23180 xs_extensions=''
23181 : We do not use find because it might not be available.
23182 : We do not just use MANIFEST because the user may have dropped
23183 : some additional extensions into the source tree and expect them
23184 : to be built.
23185
23186 : Function to recursively find available extensions, ignoring DynaLoader
23187 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23188 : In 5.10.1 and later, extensions are stored in directories
23189 : like File-Glob instead of the older File/Glob/.
23190 find_extensions='
23191     for xxx in *; do
23192         case "$xxx" in
23193             DynaLoader|dynaload) ;;
23194             *)
23195             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
23196             case "$this_ext" in
23197                 Scalar/List/Utils) this_ext="List/Util" ;;
23198                 PathTools)         this_ext="Cwd"       ;;
23199             esac;
23200             echo " $xs_extensions $nonxs_extensions" > $tdir/$$.tmp;
23201             if $contains " $this_ext " $tdir/$$.tmp; then
23202                 echo >&4;
23203                 echo "Duplicate directories detected for extension $xxx" >&4;
23204                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23205                 case "$knowitall" in
23206                 "") dflt=y;;
23207                 *) dflt=n;;
23208                 esac;
23209                 . ../UU/myread;
23210                 case "$ans" in
23211                 n*|N*) ;;
23212                 *) echo >&4;
23213                     echo "Ok.  Stopping Configure." >&4;
23214                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23215                     exit 1;;
23216                 esac;
23217                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23218             fi;
23219             $ls -1 $xxx > $tdir/$$.tmp;
23220             if   $contains "\.xs$" $tdir/$$.tmp > /dev/null 2>&1; then
23221                 xs_extensions="$xs_extensions $this_ext";
23222             elif $contains "\.c$"  $tdir/$$.tmp > /dev/null 2>&1; then
23223                 xs_extensions="$xs_extensions $this_ext";
23224             elif $test -d $xxx; then
23225                 nonxs_extensions="$nonxs_extensions $this_ext";
23226             fi;
23227             $rm -f $tdir/$$.tmp;
23228             ;;
23229         esac;
23230     done'
23231 tdir=`pwd`
23232 cd "$rsrc/cpan"
23233 set X
23234 shift
23235 eval $find_extensions
23236 cd "$rsrc/dist"
23237 set X
23238 shift
23239 eval $find_extensions
23240 cd "$rsrc/ext"
23241 set X
23242 shift
23243 eval $find_extensions
23244 set X $xs_extensions
23245 shift
23246 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23247 set X $nonxs_extensions
23248 shift
23249 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23250 cd "$tdir"
23251 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23252
23253 : Now see which are supported on this system.
23254 avail_ext=''
23255 for xxx in $xs_extensions ; do
23256         case "$xxx" in
23257         DB_File|db_file)
23258                 case "$i_db" in
23259                 $define) avail_ext="$avail_ext $xxx" ;;
23260                 esac
23261                 ;;
23262         GDBM_File|gdbm_fil)
23263                 case "$i_gdbm" in
23264                 $define) avail_ext="$avail_ext $xxx" ;;
23265                 esac
23266                 ;;
23267         I18N/Langinfo|i18n_lan)
23268                 case "$i_langinfo$d_nl_langinfo" in
23269                 $define$define) avail_ext="$avail_ext $xxx" ;;
23270                 esac
23271                 ;;
23272         IPC/SysV|ipc/sysv)
23273                 : XXX Do we need a useipcsysv variable here
23274                 case "${d_msg}${d_sem}${d_shm}" in
23275                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23276                 esac
23277                 ;;
23278         NDBM_File|ndbm_fil)
23279                 case "$d_ndbm" in
23280                 $define)
23281                     case "$osname-$use64bitint" in
23282                     hpux-define)
23283                         case "$libs" in
23284                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23285                         esac
23286                         ;;
23287                     *) avail_ext="$avail_ext $xxx" ;;
23288                     esac
23289                     ;;
23290                 esac
23291                 ;;
23292         ODBM_File|odbm_fil)
23293                 case "${i_dbm}${i_rpcsvcdbm}" in
23294                 *"${define}"*)
23295                     case "$d_cplusplus" in
23296                     define) ;; # delete as a function name will not work
23297                     *)  case "$osname-$use64bitint" in
23298                         hpux-define)
23299                             case "$libs" in
23300                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23301                             esac
23302                             ;;
23303                         *) avail_ext="$avail_ext $xxx" ;;
23304                         esac
23305                         ;;
23306                     esac
23307                     ;;
23308                 esac
23309                 ;;
23310         Opcode|opcode)
23311                 case "$useopcode" in
23312                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23313                 esac
23314                 ;;
23315         POSIX|posix)
23316                 case "$useposix" in
23317                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23318                 esac
23319                 ;;
23320         Socket|socket)
23321                 case "$d_socket" in
23322                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23323                 esac
23324                 ;;
23325         Sys/Syslog|sys/syslog)
23326                 : XXX syslog requires socket
23327                 case "$d_socket" in
23328                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23329                 esac
23330                 ;;
23331         Thread|thread)
23332                 case "$usethreads" in
23333                 true|$define|y)
23334                         case "$use5005threads" in
23335                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23336                         esac
23337                 esac
23338                 ;;
23339         threads|threads/shared)
23340                 # threads and threads::shared are special cases.
23341                 # To stop people from asking "Perl 5.8.0 was supposed
23342                 # to have this new fancy threads implementation but my
23343                 # perl doesn't have it" and from people trying to
23344                 # (re)install the threads module using CPAN.pm and
23345                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23346                 # the threads.pm and threads/shared.pm will always be
23347                 # there, croaking informatively ("you need to rebuild
23348                 # all of Perl with threads, sorry") when threads haven't
23349                 # been compiled in.
23350                 # --jhi
23351                 avail_ext="$avail_ext $xxx"
23352                 ;;
23353         VMS*)
23354                 ;;
23355         Win32*)
23356                 case "$osname" in
23357                 cygwin) avail_ext="$avail_ext $xxx" ;;
23358                 esac
23359                 ;;
23360         XS/APItest|xs/apitest)
23361                 # This is just for testing.  Skip it unless we have dynamic loading.
23362
23363                 case "$usedl" in
23364                 $define) avail_ext="$avail_ext $xxx" ;;
23365                 esac
23366                 ;;
23367         XS/Typemap|xs/typemap)
23368                 # This is just for testing.  Skip it unless we have dynamic loading.
23369                 case "$usedl" in
23370                 $define) avail_ext="$avail_ext $xxx" ;;
23371                 esac
23372                 ;;
23373         *)      avail_ext="$avail_ext $xxx"
23374                 ;;
23375         esac
23376 done
23377
23378 set X $avail_ext
23379 shift
23380 avail_ext="$*"
23381
23382 case "$onlyextensions" in
23383 '') ;;
23384 *)  keepextensions=''
23385     echo "You have requested that only certain extensions be included..." >&4
23386     for i in $onlyextensions; do
23387         case " $avail_ext " in
23388         *" $i "*)
23389             echo "Keeping extension $i."
23390             keepextensions="$keepextensions $i"
23391             ;;
23392         *) echo "Ignoring extension $i." ;;
23393         esac
23394     done
23395     avail_ext="$keepextensions"
23396     ;;
23397 esac
23398
23399 case "$noextensions" in
23400 '') ;;
23401 *)  keepextensions=''
23402     echo "You have requested that certain extensions be ignored..." >&4
23403     for i in $avail_ext; do
23404         case " $noextensions " in
23405         *" $i "*) echo "Ignoring extension $i." ;;
23406         *) echo "Keeping extension $i.";
23407            keepextensions="$keepextensions $i"
23408            ;;
23409         esac
23410     done
23411     avail_ext="$keepextensions"
23412     ;;
23413 esac
23414
23415 : Now see which nonxs extensions are supported on this system.
23416 : For now assume all are.
23417 nonxs_ext=''
23418 for xxx in $nonxs_extensions ; do
23419         case "$xxx" in
23420         VMS*)
23421                 ;;
23422         *)      nonxs_ext="$nonxs_ext $xxx"
23423                 ;;
23424         esac
23425 done
23426
23427 set X $nonxs_ext
23428 shift
23429 nonxs_ext="$*"
23430
23431 case $usedl in
23432 $define)
23433         $cat <<EOM
23434 A number of extensions are supplied with $package.  You may choose to
23435 compile these extensions for dynamic loading (the default), compile
23436 them into the $package executable (static loading), or not include
23437 them at all.  Answer "none" to include no extensions.
23438 Note that DynaLoader is always built and need not be mentioned here.
23439
23440 EOM
23441         case "$dynamic_ext" in
23442         '')
23443                 : Exclude those listed in static_ext
23444                 dflt=''
23445                 for xxx in $avail_ext; do
23446                         case " $static_ext " in
23447                         *" $xxx "*) ;;
23448                         *) dflt="$dflt $xxx" ;;
23449                         esac
23450                 done
23451                 set X $dflt
23452                 shift
23453                 dflt="$*"
23454                 ;;
23455         *)      dflt="$dynamic_ext"
23456                 # Perhaps we are reusing an old out-of-date config.sh.
23457                 case "$hint" in
23458                 previous)
23459                         if test X"$dynamic_ext" != X"$avail_ext"; then
23460                                 $cat <<EOM
23461 NOTICE:  Your previous config.sh list may be incorrect.
23462 The extensions now available to you are
23463         ${avail_ext}
23464 but the default list from your previous config.sh is
23465         ${dynamic_ext}
23466
23467 EOM
23468                         fi
23469                         ;;
23470                 esac
23471                 ;;
23472         esac
23473         case "$dflt" in
23474         '')     dflt=none;;
23475         esac
23476         rp="What extensions do you wish to load dynamically?"
23477         . ./myread
23478         case "$ans" in
23479         none) dynamic_ext=' ' ;;
23480         *) dynamic_ext="$ans" ;;
23481         esac
23482
23483         case "$static_ext" in
23484         '')
23485                 : Exclude those already listed in dynamic linking
23486                 dflt=''
23487                 for xxx in $avail_ext; do
23488                         case " $dynamic_ext " in
23489                         *" $xxx "*) ;;
23490                         *) dflt="$dflt $xxx" ;;
23491                         esac
23492                 done
23493                 set X $dflt
23494                 shift
23495                 dflt="$*"
23496                 ;;
23497         *)  dflt="$static_ext"
23498                 ;;
23499         esac
23500
23501         case "$dflt" in
23502         '')     dflt=none;;
23503         esac
23504         rp="What extensions do you wish to load statically?"
23505         . ./myread
23506         case "$ans" in
23507         none) static_ext=' ' ;;
23508         *) static_ext="$ans" ;;
23509         esac
23510         ;;
23511 *)
23512         $cat <<EOM
23513 A number of extensions are supplied with $package.  Answer "none"
23514 to include no extensions.
23515 Note that DynaLoader is always built and need not be mentioned here.
23516
23517 EOM
23518         case "$static_ext" in
23519         '') dflt="$avail_ext" ;;
23520         *)      dflt="$static_ext"
23521                 # Perhaps we are reusing an old out-of-date config.sh.
23522                 case "$hint" in
23523                 previous)
23524                         if test X"$static_ext" != X"$avail_ext"; then
23525                                 $cat <<EOM
23526 NOTICE:  Your previous config.sh list may be incorrect.
23527 The extensions now available to you are
23528         ${avail_ext}
23529 but the default list from your previous config.sh is
23530         ${static_ext}
23531
23532 EOM
23533                         fi
23534                         ;;
23535                 esac
23536                 ;;
23537         esac
23538         : Exclude those that are not xs extensions
23539         case "$dflt" in
23540         '')     dflt=none;;
23541         esac
23542         rp="What extensions do you wish to include?"
23543         . ./myread
23544         case "$ans" in
23545         none) static_ext=' ' ;;
23546         *) static_ext="$ans" ;;
23547         esac
23548         ;;
23549 esac
23550 #
23551 # Encode is a special case.  If we are building Encode as a static
23552 # extension, we need to explicitly list its subextensions as well.
23553 # For other nested extensions, this is handled automatically by
23554 # the appropriate Makefile.PL.
23555 case " $static_ext " in
23556         *" Encode "*) # Add the subextensions of Encode
23557         cd "$rsrc/cpan"
23558         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23559                 static_ext="$static_ext Encode/$xxx"
23560                 known_extensions="$known_extensions Encode/$xxx"
23561         done
23562         cd "$tdir"
23563         ;;
23564 esac
23565
23566 set X $dynamic_ext $static_ext $nonxs_ext
23567 shift
23568 extensions="$*"
23569
23570 # Sanity check:  We require an extension suitable for use with
23571 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23572 # should show up as failures in the test suite, but it's helpful to
23573 # catch them now.) The 'extensions' list is normally sorted
23574 # alphabetically, so we need to accept either
23575 #    DB_File ... Fcntl ... IO  ....
23576 # or something like
23577 #    Fcntl ... NDBM_File ... IO  ....
23578 case " $extensions"  in
23579 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
23580 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23581 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23582 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23583    echo "WARNING: The Perl you are building will be quite crippled." >& 4
23584    ;;
23585 esac
23586
23587 : Remove libraries needed only for extensions
23588 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23589 : The exception is SunOS 4.x, which needs them.
23590 case "${osname}X${osvers}" in
23591 sunos*X4*)
23592     perllibs="$libs"
23593     ;;
23594 *) case "$usedl" in
23595     $define|true|[yY]*)
23596             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23597             shift
23598             perllibs="$*"
23599             ;;
23600     *)  perllibs="$libs"
23601             ;;
23602     esac
23603     ;;
23604 esac
23605
23606 : Remove build directory name from cppstdin so it can be used from
23607 : either the present location or the final installed location.
23608 echo " "
23609 : Get out of the UU directory to get correct path name.
23610 cd ..
23611 case "$cppstdin" in
23612 `pwd`/cppstdin)
23613         echo "Stripping down cppstdin path name"
23614         cppstdin=cppstdin
23615         ;;
23616 esac
23617 cd UU
23618
23619 : end of configuration questions
23620 echo " "
23621 echo "End of configuration questions."
23622 echo " "
23623
23624 : back to where it started
23625 if test -d ../UU; then
23626         cd ..
23627 fi
23628
23629 : configuration may be unconditionally patched via a 'config.arch' file
23630 if $test -f config.arch; then
23631         echo "I see a config.arch file, loading it." >&4
23632         . ./config.arch
23633 fi
23634
23635 : configuration may be patched via a 'config.over' file
23636 if $test -f config.over; then
23637         echo " "
23638         dflt=y
23639         rp='I see a config.over file.  Do you wish to load it?'
23640         . UU/myread
23641         case "$ans" in
23642         n*) echo "OK, I'll ignore it.";;
23643         *)      . ./config.over
23644                 echo "Configuration override changes have been loaded."
23645                 ;;
23646         esac
23647 fi
23648
23649 : in case they want portability, strip down executable paths
23650 case "$d_portable" in
23651 "$define")
23652         echo " "
23653         echo "Stripping down executable paths..." >&4
23654         for file in $loclist $trylist; do
23655                 eval temp=\$$file
23656                 eval $file=`basename $temp`
23657         done
23658         ;;
23659 esac
23660
23661 : create config.sh file
23662 echo " "
23663 echo "Creating config.sh..." >&4
23664 $spitshell <<EOT >config.sh
23665 $startsh
23666 #
23667 # This file was produced by running the Configure script. It holds all the
23668 # definitions figured out by Configure. Should you modify one of these values,
23669 # do not forget to propagate your changes by running "Configure -der". You may
23670 # instead choose to run each of the .SH files by yourself, or "Configure -S".
23671 #
23672
23673 # Package name      : $package
23674 # Source directory  : $src
23675 # Configuration time: $cf_time
23676 # Configured by     : $cf_by
23677 # Target system     : $myuname
23678
23679 EOT
23680 : Add in command line options if available
23681 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23682
23683 $spitshell <<EOT >>config.sh
23684
23685 Author='$Author'
23686 Date='$Date'
23687 Header='$Header'
23688 Id='$Id'
23689 Locker='$Locker'
23690 Log='$Log'
23691 RCSfile='$RCSfile'
23692 Revision='$Revision'
23693 Source='$Source'
23694 State='$State'
23695 _a='$_a'
23696 _exe='$_exe'
23697 _o='$_o'
23698 afs='$afs'
23699 afsroot='$afsroot'
23700 alignbytes='$alignbytes'
23701 ansi2knr='$ansi2knr'
23702 aphostname='$aphostname'
23703 api_revision='$api_revision'
23704 api_subversion='$api_subversion'
23705 api_version='$api_version'
23706 api_versionstring='$api_versionstring'
23707 ar='$ar'
23708 archlib='$archlib'
23709 archlibexp='$archlibexp'
23710 archname64='$archname64'
23711 archname='$archname'
23712 archobjs='$archobjs'
23713 asctime_r_proto='$asctime_r_proto'
23714 awk='$awk'
23715 baserev='$baserev'
23716 bash='$bash'
23717 bin='$bin'
23718 bin_ELF='$bin_ELF'
23719 binexp='$binexp'
23720 bison='$bison'
23721 byacc='$byacc'
23722 byteorder='$byteorder'
23723 c='$c'
23724 castflags='$castflags'
23725 cat='$cat'
23726 cc='$cc'
23727 cccdlflags='$cccdlflags'
23728 ccdlflags='$ccdlflags'
23729 ccflags='$ccflags'
23730 ccflags_uselargefiles='$ccflags_uselargefiles'
23731 ccname='$ccname'
23732 ccsymbols='$ccsymbols'
23733 ccversion='$ccversion'
23734 cf_by='$cf_by'
23735 cf_email='$cf_email'
23736 cf_time='$cf_time'
23737 charbits='$charbits'
23738 charsize='$charsize'
23739 chgrp='$chgrp'
23740 chmod='$chmod'
23741 chown='$chown'
23742 clocktype='$clocktype'
23743 comm='$comm'
23744 compress='$compress'
23745 contains='$contains'
23746 cp='$cp'
23747 cpio='$cpio'
23748 cpp='$cpp'
23749 cpp_stuff='$cpp_stuff'
23750 cppccsymbols='$cppccsymbols'
23751 cppflags='$cppflags'
23752 cpplast='$cpplast'
23753 cppminus='$cppminus'
23754 cpprun='$cpprun'
23755 cppstdin='$cppstdin'
23756 cppsymbols='$cppsymbols'
23757 crypt_r_proto='$crypt_r_proto'
23758 cryptlib='$cryptlib'
23759 csh='$csh'
23760 ctermid_r_proto='$ctermid_r_proto'
23761 ctime_r_proto='$ctime_r_proto'
23762 d_Gconvert='$d_Gconvert'
23763 d_PRIEUldbl='$d_PRIEUldbl'
23764 d_PRIFUldbl='$d_PRIFUldbl'
23765 d_PRIGUldbl='$d_PRIGUldbl'
23766 d_PRIXU64='$d_PRIXU64'
23767 d_PRId64='$d_PRId64'
23768 d_PRIeldbl='$d_PRIeldbl'
23769 d_PRIfldbl='$d_PRIfldbl'
23770 d_PRIgldbl='$d_PRIgldbl'
23771 d_PRIi64='$d_PRIi64'
23772 d_PRIo64='$d_PRIo64'
23773 d_PRIu64='$d_PRIu64'
23774 d_PRIx64='$d_PRIx64'
23775 d_SCNfldbl='$d_SCNfldbl'
23776 d__fwalk='$d__fwalk'
23777 d_access='$d_access'
23778 d_accessx='$d_accessx'
23779 d_acosh='$d_acosh'
23780 d_aintl='$d_aintl'
23781 d_alarm='$d_alarm'
23782 d_archlib='$d_archlib'
23783 d_asctime64='$d_asctime64'
23784 d_asctime_r='$d_asctime_r'
23785 d_asinh='$d_asinh'
23786 d_atanh='$d_atanh'
23787 d_atolf='$d_atolf'
23788 d_atoll='$d_atoll'
23789 d_attribute_deprecated='$d_attribute_deprecated'
23790 d_attribute_format='$d_attribute_format'
23791 d_attribute_malloc='$d_attribute_malloc'
23792 d_attribute_nonnull='$d_attribute_nonnull'
23793 d_attribute_noreturn='$d_attribute_noreturn'
23794 d_attribute_pure='$d_attribute_pure'
23795 d_attribute_unused='$d_attribute_unused'
23796 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
23797 d_backtrace='$d_backtrace'
23798 d_bcmp='$d_bcmp'
23799 d_bcopy='$d_bcopy'
23800 d_bsd='$d_bsd'
23801 d_bsdgetpgrp='$d_bsdgetpgrp'
23802 d_bsdsetpgrp='$d_bsdsetpgrp'
23803 d_builtin_choose_expr='$d_builtin_choose_expr'
23804 d_builtin_expect='$d_builtin_expect'
23805 d_bzero='$d_bzero'
23806 d_c99_variadic_macros='$d_c99_variadic_macros'
23807 d_casti32='$d_casti32'
23808 d_castneg='$d_castneg'
23809 d_cbrt='$d_cbrt'
23810 d_charvspr='$d_charvspr'
23811 d_chown='$d_chown'
23812 d_chroot='$d_chroot'
23813 d_chsize='$d_chsize'
23814 d_class='$d_class'
23815 d_clearenv='$d_clearenv'
23816 d_closedir='$d_closedir'
23817 d_cmsghdr_s='$d_cmsghdr_s'
23818 d_const='$d_const'
23819 d_copysign='$d_copysign'
23820 d_copysignl='$d_copysignl'
23821 d_cplusplus='$d_cplusplus'
23822 d_crypt='$d_crypt'
23823 d_crypt_r='$d_crypt_r'
23824 d_csh='$d_csh'
23825 d_ctermid='$d_ctermid'
23826 d_ctermid_r='$d_ctermid_r'
23827 d_ctime64='$d_ctime64'
23828 d_ctime_r='$d_ctime_r'
23829 d_cuserid='$d_cuserid'
23830 d_dbl_dig='$d_dbl_dig'
23831 d_dbminitproto='$d_dbminitproto'
23832 d_difftime64='$d_difftime64'
23833 d_difftime='$d_difftime'
23834 d_dir_dd_fd='$d_dir_dd_fd'
23835 d_dirfd='$d_dirfd'
23836 d_dirnamlen='$d_dirnamlen'
23837 d_dladdr='$d_dladdr'
23838 d_dlerror='$d_dlerror'
23839 d_dlopen='$d_dlopen'
23840 d_dlsymun='$d_dlsymun'
23841 d_dosuid='$d_dosuid'
23842 d_drand48_r='$d_drand48_r'
23843 d_drand48proto='$d_drand48proto'
23844 d_dup2='$d_dup2'
23845 d_eaccess='$d_eaccess'
23846 d_endgrent='$d_endgrent'
23847 d_endgrent_r='$d_endgrent_r'
23848 d_endhent='$d_endhent'
23849 d_endhostent_r='$d_endhostent_r'
23850 d_endnent='$d_endnent'
23851 d_endnetent_r='$d_endnetent_r'
23852 d_endpent='$d_endpent'
23853 d_endprotoent_r='$d_endprotoent_r'
23854 d_endpwent='$d_endpwent'
23855 d_endpwent_r='$d_endpwent_r'
23856 d_endsent='$d_endsent'
23857 d_endservent_r='$d_endservent_r'
23858 d_eofnblk='$d_eofnblk'
23859 d_erf='$d_erf'
23860 d_erfc='$d_erfc'
23861 d_eunice='$d_eunice'
23862 d_exp2='$d_exp2'
23863 d_expm1='$d_expm1'
23864 d_faststdio='$d_faststdio'
23865 d_fchdir='$d_fchdir'
23866 d_fchmod='$d_fchmod'
23867 d_fchown='$d_fchown'
23868 d_fcntl='$d_fcntl'
23869 d_fcntl_can_lock='$d_fcntl_can_lock'
23870 d_fd_macros='$d_fd_macros'
23871 d_fd_set='$d_fd_set'
23872 d_fdim='$d_fdim'
23873 d_fds_bits='$d_fds_bits'
23874 d_fegetround='$d_fegetround'
23875 d_fgetpos='$d_fgetpos'
23876 d_finite='$d_finite'
23877 d_finitel='$d_finitel'
23878 d_flexfnam='$d_flexfnam'
23879 d_flock='$d_flock'
23880 d_flockproto='$d_flockproto'
23881 d_fma='$d_fma'
23882 d_fmax='$d_fmax'
23883 d_fmin='$d_fmin'
23884 d_fork='$d_fork'
23885 d_fp_class='$d_fp_class'
23886 d_fp_classify='$d_fp_classify'
23887 d_fp_classl='$d_fp_classl'
23888 d_fpathconf='$d_fpathconf'
23889 d_fpclass='$d_fpclass'
23890 d_fpclassify='$d_fpclassify'
23891 d_fpclassl='$d_fpclassl'
23892 d_fpgetround='$d_fpgetround'
23893 d_fpos64_t='$d_fpos64_t'
23894 d_frexpl='$d_frexpl'
23895 d_fs_data_s='$d_fs_data_s'
23896 d_fseeko='$d_fseeko'
23897 d_fsetpos='$d_fsetpos'
23898 d_fstatfs='$d_fstatfs'
23899 d_fstatvfs='$d_fstatvfs'
23900 d_fsync='$d_fsync'
23901 d_ftello='$d_ftello'
23902 d_ftime='$d_ftime'
23903 d_futimes='$d_futimes'
23904 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23905 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
23906 d_getaddrinfo='$d_getaddrinfo'
23907 d_getcwd='$d_getcwd'
23908 d_getespwnam='$d_getespwnam'
23909 d_getfsstat='$d_getfsstat'
23910 d_getgrent='$d_getgrent'
23911 d_getgrent_r='$d_getgrent_r'
23912 d_getgrgid_r='$d_getgrgid_r'
23913 d_getgrnam_r='$d_getgrnam_r'
23914 d_getgrps='$d_getgrps'
23915 d_gethbyaddr='$d_gethbyaddr'
23916 d_gethbyname='$d_gethbyname'
23917 d_gethent='$d_gethent'
23918 d_gethname='$d_gethname'
23919 d_gethostbyaddr_r='$d_gethostbyaddr_r'
23920 d_gethostbyname_r='$d_gethostbyname_r'
23921 d_gethostent_r='$d_gethostent_r'
23922 d_gethostprotos='$d_gethostprotos'
23923 d_getitimer='$d_getitimer'
23924 d_getlogin='$d_getlogin'
23925 d_getlogin_r='$d_getlogin_r'
23926 d_getmnt='$d_getmnt'
23927 d_getmntent='$d_getmntent'
23928 d_getnameinfo='$d_getnameinfo'
23929 d_getnbyaddr='$d_getnbyaddr'
23930 d_getnbyname='$d_getnbyname'
23931 d_getnent='$d_getnent'
23932 d_getnetbyaddr_r='$d_getnetbyaddr_r'
23933 d_getnetbyname_r='$d_getnetbyname_r'
23934 d_getnetent_r='$d_getnetent_r'
23935 d_getnetprotos='$d_getnetprotos'
23936 d_getpagsz='$d_getpagsz'
23937 d_getpbyname='$d_getpbyname'
23938 d_getpbynumber='$d_getpbynumber'
23939 d_getpent='$d_getpent'
23940 d_getpgid='$d_getpgid'
23941 d_getpgrp2='$d_getpgrp2'
23942 d_getpgrp='$d_getpgrp'
23943 d_getppid='$d_getppid'
23944 d_getprior='$d_getprior'
23945 d_getprotobyname_r='$d_getprotobyname_r'
23946 d_getprotobynumber_r='$d_getprotobynumber_r'
23947 d_getprotoent_r='$d_getprotoent_r'
23948 d_getprotoprotos='$d_getprotoprotos'
23949 d_getprpwnam='$d_getprpwnam'
23950 d_getpwent='$d_getpwent'
23951 d_getpwent_r='$d_getpwent_r'
23952 d_getpwnam_r='$d_getpwnam_r'
23953 d_getpwuid_r='$d_getpwuid_r'
23954 d_getsbyname='$d_getsbyname'
23955 d_getsbyport='$d_getsbyport'
23956 d_getsent='$d_getsent'
23957 d_getservbyname_r='$d_getservbyname_r'
23958 d_getservbyport_r='$d_getservbyport_r'
23959 d_getservent_r='$d_getservent_r'
23960 d_getservprotos='$d_getservprotos'
23961 d_getspnam='$d_getspnam'
23962 d_getspnam_r='$d_getspnam_r'
23963 d_gettimeod='$d_gettimeod'
23964 d_gmtime64='$d_gmtime64'
23965 d_gmtime_r='$d_gmtime_r'
23966 d_gnulibc='$d_gnulibc'
23967 d_grpasswd='$d_grpasswd'
23968 d_hasmntopt='$d_hasmntopt'
23969 d_htonl='$d_htonl'
23970 d_hypot='$d_hypot'
23971 d_ilogb='$d_ilogb'
23972 d_ilogbl='$d_ilogbl'
23973 d_inc_version_list='$d_inc_version_list'
23974 d_index='$d_index'
23975 d_inetaton='$d_inetaton'
23976 d_inetntop='$d_inetntop'
23977 d_inetpton='$d_inetpton'
23978 d_int64_t='$d_int64_t'
23979 d_ip_mreq='$d_ip_mreq'
23980 d_ip_mreq_source='$d_ip_mreq_source'
23981 d_ipv6_mreq='$d_ipv6_mreq'
23982 d_ipv6_mreq_source='$d_ipv6_mreq_source'
23983 d_isascii='$d_isascii'
23984 d_isblank='$d_isblank'
23985 d_isfinite='$d_isfinite'
23986 d_isfinitel='$d_isfinitel'
23987 d_isinf='$d_isinf'
23988 d_isinfl='$d_isinfl'
23989 d_isless='$d_isless'
23990 d_isnan='$d_isnan'
23991 d_isnanl='$d_isnanl'
23992 d_isnormal='$d_isnormal'
23993 d_j0='$d_j0'
23994 d_j0l='$d_j0l'
23995 d_killpg='$d_killpg'
23996 d_lc_monetary_2008='$d_lc_monetary_2008'
23997 d_lchown='$d_lchown'
23998 d_ldbl_dig='$d_ldbl_dig'
23999 d_ldexpl='$d_ldexpl'
24000 d_lgamma='$d_lgamma'
24001 d_lgamma_r='$d_lgamma_r'
24002 d_libm_lib_version='$d_libm_lib_version'
24003 d_libname_unique='$d_libname_unique'
24004 d_link='$d_link'
24005 d_llrint='$d_llrint'
24006 d_llrintl='$d_llrintl'
24007 d_llround='$d_llround'
24008 d_llroundl='$d_llroundl'
24009 d_localtime64='$d_localtime64'
24010 d_localtime_r='$d_localtime_r'
24011 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24012 d_locconv='$d_locconv'
24013 d_lockf='$d_lockf'
24014 d_log1p='$d_log1p'
24015 d_log2='$d_log2'
24016 d_logb='$d_logb'
24017 d_longdbl='$d_longdbl'
24018 d_longlong='$d_longlong'
24019 d_lrint='$d_lrint'
24020 d_lrintl='$d_lrintl'
24021 d_lround='$d_lround'
24022 d_lroundl='$d_lroundl'
24023 d_lseekproto='$d_lseekproto'
24024 d_lstat='$d_lstat'
24025 d_madvise='$d_madvise'
24026 d_malloc_good_size='$d_malloc_good_size'
24027 d_malloc_size='$d_malloc_size'
24028 d_mblen='$d_mblen'
24029 d_mbstowcs='$d_mbstowcs'
24030 d_mbtowc='$d_mbtowc'
24031 d_memchr='$d_memchr'
24032 d_memcmp='$d_memcmp'
24033 d_memcpy='$d_memcpy'
24034 d_memmove='$d_memmove'
24035 d_memset='$d_memset'
24036 d_mkdir='$d_mkdir'
24037 d_mkdtemp='$d_mkdtemp'
24038 d_mkfifo='$d_mkfifo'
24039 d_mkstemp='$d_mkstemp'
24040 d_mkstemps='$d_mkstemps'
24041 d_mktime64='$d_mktime64'
24042 d_mktime='$d_mktime'
24043 d_mmap='$d_mmap'
24044 d_modfl='$d_modfl'
24045 d_modfl_pow32_bug='$d_modfl_pow32_bug'
24046 d_modflproto='$d_modflproto'
24047 d_mprotect='$d_mprotect'
24048 d_msg='$d_msg'
24049 d_msg_ctrunc='$d_msg_ctrunc'
24050 d_msg_dontroute='$d_msg_dontroute'
24051 d_msg_oob='$d_msg_oob'
24052 d_msg_peek='$d_msg_peek'
24053 d_msg_proxy='$d_msg_proxy'
24054 d_msgctl='$d_msgctl'
24055 d_msgget='$d_msgget'
24056 d_msghdr_s='$d_msghdr_s'
24057 d_msgrcv='$d_msgrcv'
24058 d_msgsnd='$d_msgsnd'
24059 d_msync='$d_msync'
24060 d_munmap='$d_munmap'
24061 d_mymalloc='$d_mymalloc'
24062 d_nan='$d_nan'
24063 d_ndbm='$d_ndbm'
24064 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24065 d_nearbyint='$d_nearbyint'
24066 d_nextafter='$d_nextafter'
24067 d_nexttoward='$d_nexttoward'
24068 d_nice='$d_nice'
24069 d_nl_langinfo='$d_nl_langinfo'
24070 d_nv_preserves_uv='$d_nv_preserves_uv'
24071 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24072 d_off64_t='$d_off64_t'
24073 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24074 d_oldpthreads='$d_oldpthreads'
24075 d_oldsock='$d_oldsock'
24076 d_open3='$d_open3'
24077 d_pathconf='$d_pathconf'
24078 d_pause='$d_pause'
24079 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24080 d_phostname='$d_phostname'
24081 d_pipe='$d_pipe'
24082 d_poll='$d_poll'
24083 d_portable='$d_portable'
24084 d_prctl='$d_prctl'
24085 d_prctl_set_name='$d_prctl_set_name'
24086 d_printf_format_null='$d_printf_format_null'
24087 d_procselfexe='$d_procselfexe'
24088 d_pseudofork='$d_pseudofork'
24089 d_pthread_atfork='$d_pthread_atfork'
24090 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24091 d_pthread_yield='$d_pthread_yield'
24092 d_ptrdiff_t='$d_ptrdiff_t'
24093 d_pwage='$d_pwage'
24094 d_pwchange='$d_pwchange'
24095 d_pwclass='$d_pwclass'
24096 d_pwcomment='$d_pwcomment'
24097 d_pwexpire='$d_pwexpire'
24098 d_pwgecos='$d_pwgecos'
24099 d_pwpasswd='$d_pwpasswd'
24100 d_pwquota='$d_pwquota'
24101 d_qgcvt='$d_qgcvt'
24102 d_quad='$d_quad'
24103 d_random_r='$d_random_r'
24104 d_re_comp='$d_re_comp'
24105 d_readdir64_r='$d_readdir64_r'
24106 d_readdir='$d_readdir'
24107 d_readdir_r='$d_readdir_r'
24108 d_readlink='$d_readlink'
24109 d_readv='$d_readv'
24110 d_recvmsg='$d_recvmsg'
24111 d_regcmp='$d_regcmp'
24112 d_regcomp='$d_regcomp'
24113 d_remainder='$d_remainder'
24114 d_remquo='$d_remquo'
24115 d_rename='$d_rename'
24116 d_rewinddir='$d_rewinddir'
24117 d_rint='$d_rint'
24118 d_rmdir='$d_rmdir'
24119 d_round='$d_round'
24120 d_safebcpy='$d_safebcpy'
24121 d_safemcpy='$d_safemcpy'
24122 d_sanemcmp='$d_sanemcmp'
24123 d_sbrkproto='$d_sbrkproto'
24124 d_scalbn='$d_scalbn'
24125 d_scalbnl='$d_scalbnl'
24126 d_sched_yield='$d_sched_yield'
24127 d_scm_rights='$d_scm_rights'
24128 d_seekdir='$d_seekdir'
24129 d_select='$d_select'
24130 d_sem='$d_sem'
24131 d_semctl='$d_semctl'
24132 d_semctl_semid_ds='$d_semctl_semid_ds'
24133 d_semctl_semun='$d_semctl_semun'
24134 d_semget='$d_semget'
24135 d_semop='$d_semop'
24136 d_sendmsg='$d_sendmsg'
24137 d_setegid='$d_setegid'
24138 d_seteuid='$d_seteuid'
24139 d_setgrent='$d_setgrent'
24140 d_setgrent_r='$d_setgrent_r'
24141 d_setgrps='$d_setgrps'
24142 d_sethent='$d_sethent'
24143 d_sethostent_r='$d_sethostent_r'
24144 d_setitimer='$d_setitimer'
24145 d_setlinebuf='$d_setlinebuf'
24146 d_setlocale='$d_setlocale'
24147 d_setlocale_r='$d_setlocale_r'
24148 d_setnent='$d_setnent'
24149 d_setnetent_r='$d_setnetent_r'
24150 d_setpent='$d_setpent'
24151 d_setpgid='$d_setpgid'
24152 d_setpgrp2='$d_setpgrp2'
24153 d_setpgrp='$d_setpgrp'
24154 d_setprior='$d_setprior'
24155 d_setproctitle='$d_setproctitle'
24156 d_setprotoent_r='$d_setprotoent_r'
24157 d_setpwent='$d_setpwent'
24158 d_setpwent_r='$d_setpwent_r'
24159 d_setregid='$d_setregid'
24160 d_setresgid='$d_setresgid'
24161 d_setresuid='$d_setresuid'
24162 d_setreuid='$d_setreuid'
24163 d_setrgid='$d_setrgid'
24164 d_setruid='$d_setruid'
24165 d_setsent='$d_setsent'
24166 d_setservent_r='$d_setservent_r'
24167 d_setsid='$d_setsid'
24168 d_setvbuf='$d_setvbuf'
24169 d_shm='$d_shm'
24170 d_shmat='$d_shmat'
24171 d_shmatprototype='$d_shmatprototype'
24172 d_shmctl='$d_shmctl'
24173 d_shmdt='$d_shmdt'
24174 d_shmget='$d_shmget'
24175 d_sigaction='$d_sigaction'
24176 d_signbit='$d_signbit'
24177 d_sigprocmask='$d_sigprocmask'
24178 d_sigsetjmp='$d_sigsetjmp'
24179 d_sin6_scope_id='$d_sin6_scope_id'
24180 d_sitearch='$d_sitearch'
24181 d_snprintf='$d_snprintf'
24182 d_sockaddr_in6='$d_sockaddr_in6'
24183 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24184 d_sockatmark='$d_sockatmark'
24185 d_sockatmarkproto='$d_sockatmarkproto'
24186 d_socket='$d_socket'
24187 d_socklen_t='$d_socklen_t'
24188 d_sockpair='$d_sockpair'
24189 d_socks5_init='$d_socks5_init'
24190 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
24191 d_sqrtl='$d_sqrtl'
24192 d_srand48_r='$d_srand48_r'
24193 d_srandom_r='$d_srandom_r'
24194 d_sresgproto='$d_sresgproto'
24195 d_sresuproto='$d_sresuproto'
24196 d_stat='$d_stat'
24197 d_statblks='$d_statblks'
24198 d_statfs_f_flags='$d_statfs_f_flags'
24199 d_statfs_s='$d_statfs_s'
24200 d_static_inline='$d_static_inline'
24201 d_statvfs='$d_statvfs'
24202 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24203 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24204 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24205 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24206 d_stdio_stream_array='$d_stdio_stream_array'
24207 d_stdiobase='$d_stdiobase'
24208 d_stdstdio='$d_stdstdio'
24209 d_strchr='$d_strchr'
24210 d_strcoll='$d_strcoll'
24211 d_strctcpy='$d_strctcpy'
24212 d_strerrm='$d_strerrm'
24213 d_strerror='$d_strerror'
24214 d_strerror_r='$d_strerror_r'
24215 d_strftime='$d_strftime'
24216 d_strlcat='$d_strlcat'
24217 d_strlcpy='$d_strlcpy'
24218 d_strtod='$d_strtod'
24219 d_strtol='$d_strtol'
24220 d_strtold='$d_strtold'
24221 d_strtoll='$d_strtoll'
24222 d_strtoq='$d_strtoq'
24223 d_strtoul='$d_strtoul'
24224 d_strtoull='$d_strtoull'
24225 d_strtouq='$d_strtouq'
24226 d_strxfrm='$d_strxfrm'
24227 d_suidsafe='$d_suidsafe'
24228 d_symlink='$d_symlink'
24229 d_syscall='$d_syscall'
24230 d_syscallproto='$d_syscallproto'
24231 d_sysconf='$d_sysconf'
24232 d_sysernlst='$d_sysernlst'
24233 d_syserrlst='$d_syserrlst'
24234 d_system='$d_system'
24235 d_tcgetpgrp='$d_tcgetpgrp'
24236 d_tcsetpgrp='$d_tcsetpgrp'
24237 d_telldir='$d_telldir'
24238 d_telldirproto='$d_telldirproto'
24239 d_tgamma='$d_tgamma'
24240 d_time='$d_time'
24241 d_timegm='$d_timegm'
24242 d_times='$d_times'
24243 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24244 d_tm_tm_zone='$d_tm_tm_zone'
24245 d_tmpnam_r='$d_tmpnam_r'
24246 d_trunc='$d_trunc'
24247 d_truncate='$d_truncate'
24248 d_truncl='$d_truncl'
24249 d_ttyname_r='$d_ttyname_r'
24250 d_tzname='$d_tzname'
24251 d_u32align='$d_u32align'
24252 d_ualarm='$d_ualarm'
24253 d_umask='$d_umask'
24254 d_uname='$d_uname'
24255 d_union_semun='$d_union_semun'
24256 d_unordered='$d_unordered'
24257 d_unsetenv='$d_unsetenv'
24258 d_usleep='$d_usleep'
24259 d_usleepproto='$d_usleepproto'
24260 d_ustat='$d_ustat'
24261 d_vendorarch='$d_vendorarch'
24262 d_vendorbin='$d_vendorbin'
24263 d_vendorlib='$d_vendorlib'
24264 d_vendorscript='$d_vendorscript'
24265 d_vfork='$d_vfork'
24266 d_void_closedir='$d_void_closedir'
24267 d_voidsig='$d_voidsig'
24268 d_voidtty='$d_voidtty'
24269 d_volatile='$d_volatile'
24270 d_vprintf='$d_vprintf'
24271 d_vsnprintf='$d_vsnprintf'
24272 d_wait4='$d_wait4'
24273 d_waitpid='$d_waitpid'
24274 d_wcscmp='$d_wcscmp'
24275 d_wcstombs='$d_wcstombs'
24276 d_wcsxfrm='$d_wcsxfrm'
24277 d_wctomb='$d_wctomb'
24278 d_writev='$d_writev'
24279 d_xenix='$d_xenix'
24280 date='$date'
24281 db_hashtype='$db_hashtype'
24282 db_prefixtype='$db_prefixtype'
24283 db_version_major='$db_version_major'
24284 db_version_minor='$db_version_minor'
24285 db_version_patch='$db_version_patch'
24286 direntrytype='$direntrytype'
24287 dlext='$dlext'
24288 dlsrc='$dlsrc'
24289 doublekind='$doublekind'
24290 doublesize='$doublesize'
24291 drand01='$drand01'
24292 drand48_r_proto='$drand48_r_proto'
24293 dtrace='$dtrace'
24294 dynamic_ext='$dynamic_ext'
24295 eagain='$eagain'
24296 ebcdic='$ebcdic'
24297 echo='$echo'
24298 egrep='$egrep'
24299 emacs='$emacs'
24300 endgrent_r_proto='$endgrent_r_proto'
24301 endhostent_r_proto='$endhostent_r_proto'
24302 endnetent_r_proto='$endnetent_r_proto'
24303 endprotoent_r_proto='$endprotoent_r_proto'
24304 endpwent_r_proto='$endpwent_r_proto'
24305 endservent_r_proto='$endservent_r_proto'
24306 eunicefix='$eunicefix'
24307 exe_ext='$exe_ext'
24308 expr='$expr'
24309 extensions='$extensions'
24310 extern_C='$extern_C'
24311 extras='$extras'
24312 fflushNULL='$fflushNULL'
24313 fflushall='$fflushall'
24314 find='$find'
24315 firstmakefile='$firstmakefile'
24316 flex='$flex'
24317 fpossize='$fpossize'
24318 fpostype='$fpostype'
24319 freetype='$freetype'
24320 from='$from'
24321 full_ar='$full_ar'
24322 full_csh='$full_csh'
24323 full_sed='$full_sed'
24324 gccansipedantic='$gccansipedantic'
24325 gccosandvers='$gccosandvers'
24326 gccversion='$gccversion'
24327 getgrent_r_proto='$getgrent_r_proto'
24328 getgrgid_r_proto='$getgrgid_r_proto'
24329 getgrnam_r_proto='$getgrnam_r_proto'
24330 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24331 gethostbyname_r_proto='$gethostbyname_r_proto'
24332 gethostent_r_proto='$gethostent_r_proto'
24333 getlogin_r_proto='$getlogin_r_proto'
24334 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24335 getnetbyname_r_proto='$getnetbyname_r_proto'
24336 getnetent_r_proto='$getnetent_r_proto'
24337 getprotobyname_r_proto='$getprotobyname_r_proto'
24338 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24339 getprotoent_r_proto='$getprotoent_r_proto'
24340 getpwent_r_proto='$getpwent_r_proto'
24341 getpwnam_r_proto='$getpwnam_r_proto'
24342 getpwuid_r_proto='$getpwuid_r_proto'
24343 getservbyname_r_proto='$getservbyname_r_proto'
24344 getservbyport_r_proto='$getservbyport_r_proto'
24345 getservent_r_proto='$getservent_r_proto'
24346 getspnam_r_proto='$getspnam_r_proto'
24347 gidformat='$gidformat'
24348 gidsign='$gidsign'
24349 gidsize='$gidsize'
24350 gidtype='$gidtype'
24351 glibpth='$glibpth'
24352 gmake='$gmake'
24353 gmtime_r_proto='$gmtime_r_proto'
24354 gnulibc_version='$gnulibc_version'
24355 grep='$grep'
24356 groupcat='$groupcat'
24357 groupstype='$groupstype'
24358 gzip='$gzip'
24359 h_fcntl='$h_fcntl'
24360 h_sysfile='$h_sysfile'
24361 hint='$hint'
24362 hostcat='$hostcat'
24363 hostgenerate='$hostgenerate'
24364 hostosname='$hostosname'
24365 hostperl='$hostperl'
24366 html1dir='$html1dir'
24367 html1direxp='$html1direxp'
24368 html3dir='$html3dir'
24369 html3direxp='$html3direxp'
24370 i16size='$i16size'
24371 i16type='$i16type'
24372 i32size='$i32size'
24373 i32type='$i32type'
24374 i64size='$i64size'
24375 i64type='$i64type'
24376 i8size='$i8size'
24377 i8type='$i8type'
24378 i_arpainet='$i_arpainet'
24379 i_assert='$i_assert'
24380 i_bfd='$i_bfd'
24381 i_bsdioctl='$i_bsdioctl'
24382 i_crypt='$i_crypt'
24383 i_db='$i_db'
24384 i_dbm='$i_dbm'
24385 i_dirent='$i_dirent'
24386 i_dlfcn='$i_dlfcn'
24387 i_execinfo='$i_execinfo'
24388 i_fcntl='$i_fcntl'
24389 i_fenv='$i_fenv'
24390 i_float='$i_float'
24391 i_fp='$i_fp'
24392 i_fp_class='$i_fp_class'
24393 i_gdbm='$i_gdbm'
24394 i_gdbm_ndbm='$i_gdbm_ndbm'
24395 i_gdbmndbm='$i_gdbmndbm'
24396 i_grp='$i_grp'
24397 i_ieeefp='$i_ieeefp'
24398 i_inttypes='$i_inttypes'
24399 i_langinfo='$i_langinfo'
24400 i_libutil='$i_libutil'
24401 i_limits='$i_limits'
24402 i_locale='$i_locale'
24403 i_machcthr='$i_machcthr'
24404 i_malloc='$i_malloc'
24405 i_mallocmalloc='$i_mallocmalloc'
24406 i_math='$i_math'
24407 i_memory='$i_memory'
24408 i_mntent='$i_mntent'
24409 i_ndbm='$i_ndbm'
24410 i_netdb='$i_netdb'
24411 i_neterrno='$i_neterrno'
24412 i_netinettcp='$i_netinettcp'
24413 i_niin='$i_niin'
24414 i_poll='$i_poll'
24415 i_prot='$i_prot'
24416 i_pthread='$i_pthread'
24417 i_pwd='$i_pwd'
24418 i_quadmath='$i_quadmath'
24419 i_rpcsvcdbm='$i_rpcsvcdbm'
24420 i_sgtty='$i_sgtty'
24421 i_shadow='$i_shadow'
24422 i_socks='$i_socks'
24423 i_stdarg='$i_stdarg'
24424 i_stdbool='$i_stdbool'
24425 i_stddef='$i_stddef'
24426 i_stdint='$i_stdint'
24427 i_stdlib='$i_stdlib'
24428 i_string='$i_string'
24429 i_sunmath='$i_sunmath'
24430 i_sysaccess='$i_sysaccess'
24431 i_sysdir='$i_sysdir'
24432 i_sysfile='$i_sysfile'
24433 i_sysfilio='$i_sysfilio'
24434 i_sysin='$i_sysin'
24435 i_sysioctl='$i_sysioctl'
24436 i_syslog='$i_syslog'
24437 i_sysmman='$i_sysmman'
24438 i_sysmode='$i_sysmode'
24439 i_sysmount='$i_sysmount'
24440 i_sysndir='$i_sysndir'
24441 i_sysparam='$i_sysparam'
24442 i_syspoll='$i_syspoll'
24443 i_sysresrc='$i_sysresrc'
24444 i_syssecrt='$i_syssecrt'
24445 i_sysselct='$i_sysselct'
24446 i_syssockio='$i_syssockio'
24447 i_sysstat='$i_sysstat'
24448 i_sysstatfs='$i_sysstatfs'
24449 i_sysstatvfs='$i_sysstatvfs'
24450 i_systime='$i_systime'
24451 i_systimek='$i_systimek'
24452 i_systimes='$i_systimes'
24453 i_systypes='$i_systypes'
24454 i_sysuio='$i_sysuio'
24455 i_sysun='$i_sysun'
24456 i_sysutsname='$i_sysutsname'
24457 i_sysvfs='$i_sysvfs'
24458 i_syswait='$i_syswait'
24459 i_termio='$i_termio'
24460 i_termios='$i_termios'
24461 i_time='$i_time'
24462 i_unistd='$i_unistd'
24463 i_ustat='$i_ustat'
24464 i_utime='$i_utime'
24465 i_values='$i_values'
24466 i_varargs='$i_varargs'
24467 i_varhdr='$i_varhdr'
24468 i_vfork='$i_vfork'
24469 ignore_versioned_solibs='$ignore_versioned_solibs'
24470 inc_version_list='$inc_version_list'
24471 inc_version_list_init='$inc_version_list_init'
24472 incpath='$incpath'
24473 incpth='$incpth'
24474 inews='$inews'
24475 initialinstalllocation='$initialinstalllocation'
24476 installarchlib='$installarchlib'
24477 installbin='$installbin'
24478 installhtml1dir='$installhtml1dir'
24479 installhtml3dir='$installhtml3dir'
24480 installman1dir='$installman1dir'
24481 installman3dir='$installman3dir'
24482 installprefix='$installprefix'
24483 installprefixexp='$installprefixexp'
24484 installprivlib='$installprivlib'
24485 installscript='$installscript'
24486 installsitearch='$installsitearch'
24487 installsitebin='$installsitebin'
24488 installsitehtml1dir='$installsitehtml1dir'
24489 installsitehtml3dir='$installsitehtml3dir'
24490 installsitelib='$installsitelib'
24491 installsiteman1dir='$installsiteman1dir'
24492 installsiteman3dir='$installsiteman3dir'
24493 installsitescript='$installsitescript'
24494 installstyle='$installstyle'
24495 installusrbinperl='$installusrbinperl'
24496 installvendorarch='$installvendorarch'
24497 installvendorbin='$installvendorbin'
24498 installvendorhtml1dir='$installvendorhtml1dir'
24499 installvendorhtml3dir='$installvendorhtml3dir'
24500 installvendorlib='$installvendorlib'
24501 installvendorman1dir='$installvendorman1dir'
24502 installvendorman3dir='$installvendorman3dir'
24503 installvendorscript='$installvendorscript'
24504 intsize='$intsize'
24505 issymlink='$issymlink'
24506 ivdformat='$ivdformat'
24507 ivsize='$ivsize'
24508 ivtype='$ivtype'
24509 known_extensions='$known_extensions'
24510 ksh='$ksh'
24511 ld='$ld'
24512 ld_can_script='$ld_can_script'
24513 lddlflags='$lddlflags'
24514 ldflags='$ldflags'
24515 ldflags_uselargefiles='$ldflags_uselargefiles'
24516 ldlibpthname='$ldlibpthname'
24517 less='$less'
24518 lib_ext='$lib_ext'
24519 libc='$libc'
24520 libperl='$libperl'
24521 libpth='$libpth'
24522 libs='$libs'
24523 libsdirs='$libsdirs'
24524 libsfiles='$libsfiles'
24525 libsfound='$libsfound'
24526 libspath='$libspath'
24527 libswanted='$libswanted'
24528 libswanted_uselargefiles='$libswanted_uselargefiles'
24529 line='$line'
24530 lint='$lint'
24531 lkflags='$lkflags'
24532 ln='$ln'
24533 lns='$lns'
24534 localtime_r_proto='$localtime_r_proto'
24535 locincpth='$locincpth'
24536 loclibpth='$loclibpth'
24537 longdblkind='$longdblkind'
24538 longdblsize='$longdblsize'
24539 longlongsize='$longlongsize'
24540 longsize='$longsize'
24541 lp='$lp'
24542 lpr='$lpr'
24543 ls='$ls'
24544 lseeksize='$lseeksize'
24545 lseektype='$lseektype'
24546 mail='$mail'
24547 mailx='$mailx'
24548 make='$make'
24549 make_set_make='$make_set_make'
24550 mallocobj='$mallocobj'
24551 mallocsrc='$mallocsrc'
24552 malloctype='$malloctype'
24553 man1dir='$man1dir'
24554 man1direxp='$man1direxp'
24555 man1ext='$man1ext'
24556 man3dir='$man3dir'
24557 man3direxp='$man3direxp'
24558 man3ext='$man3ext'
24559 mips_type='$mips_type'
24560 mistrustnm='$mistrustnm'
24561 mkdir='$mkdir'
24562 mmaptype='$mmaptype'
24563 modetype='$modetype'
24564 more='$more'
24565 multiarch='$multiarch'
24566 mv='$mv'
24567 myarchname='$myarchname'
24568 mydomain='$mydomain'
24569 myhostname='$myhostname'
24570 myuname='$myuname'
24571 n='$n'
24572 need_va_copy='$need_va_copy'
24573 netdb_hlen_type='$netdb_hlen_type'
24574 netdb_host_type='$netdb_host_type'
24575 netdb_name_type='$netdb_name_type'
24576 netdb_net_type='$netdb_net_type'
24577 nm='$nm'
24578 nm_opt='$nm_opt'
24579 nm_so_opt='$nm_so_opt'
24580 nonxs_ext='$nonxs_ext'
24581 nroff='$nroff'
24582 nvEUformat='$nvEUformat'
24583 nvFUformat='$nvFUformat'
24584 nvGUformat='$nvGUformat'
24585 nv_overflows_integers_at='$nv_overflows_integers_at'
24586 nv_preserves_uv_bits='$nv_preserves_uv_bits'
24587 nveformat='$nveformat'
24588 nvfformat='$nvfformat'
24589 nvgformat='$nvgformat'
24590 nvsize='$nvsize'
24591 nvtype='$nvtype'
24592 o_nonblock='$o_nonblock'
24593 obj_ext='$obj_ext'
24594 old_pthread_create_joinable='$old_pthread_create_joinable'
24595 optimize='$optimize'
24596 orderlib='$orderlib'
24597 osname='$osname'
24598 osvers='$osvers'
24599 otherlibdirs='$otherlibdirs'
24600 package='$package'
24601 pager='$pager'
24602 passcat='$passcat'
24603 patchlevel='$patchlevel'
24604 path_sep='$path_sep'
24605 perl5='$perl5'
24606 perl='$perl'
24607 perl_patchlevel='$perl_patchlevel'
24608 perl_static_inline='$perl_static_inline'
24609 perladmin='$perladmin'
24610 perllibs='$perllibs'
24611 perlpath='$perlpath'
24612 pg='$pg'
24613 phostname='$phostname'
24614 pidtype='$pidtype'
24615 plibpth='$plibpth'
24616 pmake='$pmake'
24617 pr='$pr'
24618 prefix='$prefix'
24619 prefixexp='$prefixexp'
24620 privlib='$privlib'
24621 privlibexp='$privlibexp'
24622 procselfexe='$procselfexe'
24623 prototype='$prototype'
24624 ptrsize='$ptrsize'
24625 quadkind='$quadkind'
24626 quadtype='$quadtype'
24627 randbits='$randbits'
24628 randfunc='$randfunc'
24629 random_r_proto='$random_r_proto'
24630 randseedtype='$randseedtype'
24631 ranlib='$ranlib'
24632 rd_nodata='$rd_nodata'
24633 readdir64_r_proto='$readdir64_r_proto'
24634 readdir_r_proto='$readdir_r_proto'
24635 revision='$revision'
24636 rm='$rm'
24637 rm_try='$rm_try'
24638 rmail='$rmail'
24639 run='$run'
24640 runnm='$runnm'
24641 sGMTIME_max='$sGMTIME_max'
24642 sGMTIME_min='$sGMTIME_min'
24643 sLOCALTIME_max='$sLOCALTIME_max'
24644 sLOCALTIME_min='$sLOCALTIME_min'
24645 sPRIEUldbl='$sPRIEUldbl'
24646 sPRIFUldbl='$sPRIFUldbl'
24647 sPRIGUldbl='$sPRIGUldbl'
24648 sPRIXU64='$sPRIXU64'
24649 sPRId64='$sPRId64'
24650 sPRIeldbl='$sPRIeldbl'
24651 sPRIfldbl='$sPRIfldbl'
24652 sPRIgldbl='$sPRIgldbl'
24653 sPRIi64='$sPRIi64'
24654 sPRIo64='$sPRIo64'
24655 sPRIu64='$sPRIu64'
24656 sPRIx64='$sPRIx64'
24657 sSCNfldbl='$sSCNfldbl'
24658 sched_yield='$sched_yield'
24659 scriptdir='$scriptdir'
24660 scriptdirexp='$scriptdirexp'
24661 sed='$sed'
24662 seedfunc='$seedfunc'
24663 selectminbits='$selectminbits'
24664 selecttype='$selecttype'
24665 sendmail='$sendmail'
24666 setgrent_r_proto='$setgrent_r_proto'
24667 sethostent_r_proto='$sethostent_r_proto'
24668 setlocale_r_proto='$setlocale_r_proto'
24669 setnetent_r_proto='$setnetent_r_proto'
24670 setprotoent_r_proto='$setprotoent_r_proto'
24671 setpwent_r_proto='$setpwent_r_proto'
24672 setservent_r_proto='$setservent_r_proto'
24673 sh='$sh'
24674 shar='$shar'
24675 sharpbang='$sharpbang'
24676 shmattype='$shmattype'
24677 shortsize='$shortsize'
24678 shrpenv='$shrpenv'
24679 shsharp='$shsharp'
24680 sig_count='$sig_count'
24681 sig_name='$sig_name'
24682 sig_name_init='$sig_name_init'
24683 sig_num='$sig_num'
24684 sig_num_init='$sig_num_init'
24685 sig_size='$sig_size'
24686 signal_t='$signal_t'
24687 sitearch='$sitearch'
24688 sitearchexp='$sitearchexp'
24689 sitebin='$sitebin'
24690 sitebinexp='$sitebinexp'
24691 sitehtml1dir='$sitehtml1dir'
24692 sitehtml1direxp='$sitehtml1direxp'
24693 sitehtml3dir='$sitehtml3dir'
24694 sitehtml3direxp='$sitehtml3direxp'
24695 sitelib='$sitelib'
24696 sitelib_stem='$sitelib_stem'
24697 sitelibexp='$sitelibexp'
24698 siteman1dir='$siteman1dir'
24699 siteman1direxp='$siteman1direxp'
24700 siteman3dir='$siteman3dir'
24701 siteman3direxp='$siteman3direxp'
24702 siteprefix='$siteprefix'
24703 siteprefixexp='$siteprefixexp'
24704 sitescript='$sitescript'
24705 sitescriptexp='$sitescriptexp'
24706 sizesize='$sizesize'
24707 sizetype='$sizetype'
24708 sleep='$sleep'
24709 smail='$smail'
24710 so='$so'
24711 sockethdr='$sockethdr'
24712 socketlib='$socketlib'
24713 socksizetype='$socksizetype'
24714 sort='$sort'
24715 spackage='$spackage'
24716 spitshell='$spitshell'
24717 srand48_r_proto='$srand48_r_proto'
24718 srandom_r_proto='$srandom_r_proto'
24719 src='$src'
24720 ssizetype='$ssizetype'
24721 st_ino_sign='$st_ino_sign'
24722 st_ino_size='$st_ino_size'
24723 startperl='$startperl'
24724 startsh='$startsh'
24725 static_ext='$static_ext'
24726 stdchar='$stdchar'
24727 stdio_base='$stdio_base'
24728 stdio_bufsiz='$stdio_bufsiz'
24729 stdio_cnt='$stdio_cnt'
24730 stdio_filbuf='$stdio_filbuf'
24731 stdio_ptr='$stdio_ptr'
24732 stdio_stream_array='$stdio_stream_array'
24733 strerror_r_proto='$strerror_r_proto'
24734 strings='$strings'
24735 submit='$submit'
24736 subversion='$subversion'
24737 sysman='$sysman'
24738 sysroot='$sysroot'
24739 tail='$tail'
24740 tar='$tar'
24741 targetarch='$targetarch'
24742 targetdir='$targetdir'
24743 targetenv='$targetenv'
24744 targethost='$targethost'
24745 targetmkdir='$targetmkdir'
24746 targetport='$targetport'
24747 targetsh='$targetsh'
24748 tbl='$tbl'
24749 tee='$tee'
24750 test='$test'
24751 timeincl='$timeincl'
24752 timetype='$timetype'
24753 tmpnam_r_proto='$tmpnam_r_proto'
24754 to='$to'
24755 touch='$touch'
24756 tr='$tr'
24757 trnl='$trnl'
24758 troff='$troff'
24759 ttyname_r_proto='$ttyname_r_proto'
24760 u16size='$u16size'
24761 u16type='$u16type'
24762 u32size='$u32size'
24763 u32type='$u32type'
24764 u64size='$u64size'
24765 u64type='$u64type'
24766 u8size='$u8size'
24767 u8type='$u8type'
24768 uidformat='$uidformat'
24769 uidsign='$uidsign'
24770 uidsize='$uidsize'
24771 uidtype='$uidtype'
24772 uname='$uname'
24773 uniq='$uniq'
24774 uquadtype='$uquadtype'
24775 use5005threads='$use5005threads'
24776 use64bitall='$use64bitall'
24777 use64bitint='$use64bitint'
24778 usecbacktrace='$usecbacktrace'
24779 usecrosscompile='$usecrosscompile'
24780 usedevel='$usedevel'
24781 usedl='$usedl'
24782 usedtrace='$usedtrace'
24783 usefaststdio='$usefaststdio'
24784 useithreads='$useithreads'
24785 usekernprocpathname='$usekernprocpathname'
24786 uselargefiles='$uselargefiles'
24787 uselongdouble='$uselongdouble'
24788 usemallocwrap='$usemallocwrap'
24789 usemorebits='$usemorebits'
24790 usemultiplicity='$usemultiplicity'
24791 usemymalloc='$usemymalloc'
24792 usenm='$usenm'
24793 usensgetexecutablepath='$usensgetexecutablepath'
24794 useopcode='$useopcode'
24795 useperlio='$useperlio'
24796 useposix='$useposix'
24797 usequadmath='$usequadmath'
24798 usereentrant='$usereentrant'
24799 userelocatableinc='$userelocatableinc'
24800 useshrplib='$useshrplib'
24801 usesitecustomize='$usesitecustomize'
24802 usesocks='$usesocks'
24803 usethreads='$usethreads'
24804 usevendorprefix='$usevendorprefix'
24805 useversionedarchname='$useversionedarchname'
24806 usevfork='$usevfork'
24807 usrinc='$usrinc'
24808 uuname='$uuname'
24809 uvXUformat='$uvXUformat'
24810 uvoformat='$uvoformat'
24811 uvsize='$uvsize'
24812 uvtype='$uvtype'
24813 uvuformat='$uvuformat'
24814 uvxformat='$uvxformat'
24815 vaproto='$vaproto'
24816 vendorarch='$vendorarch'
24817 vendorarchexp='$vendorarchexp'
24818 vendorbin='$vendorbin'
24819 vendorbinexp='$vendorbinexp'
24820 vendorhtml1dir='$vendorhtml1dir'
24821 vendorhtml1direxp='$vendorhtml1direxp'
24822 vendorhtml3dir='$vendorhtml3dir'
24823 vendorhtml3direxp='$vendorhtml3direxp'
24824 vendorlib='$vendorlib'
24825 vendorlib_stem='$vendorlib_stem'
24826 vendorlibexp='$vendorlibexp'
24827 vendorman1dir='$vendorman1dir'
24828 vendorman1direxp='$vendorman1direxp'
24829 vendorman3dir='$vendorman3dir'
24830 vendorman3direxp='$vendorman3direxp'
24831 vendorprefix='$vendorprefix'
24832 vendorprefixexp='$vendorprefixexp'
24833 vendorscript='$vendorscript'
24834 vendorscriptexp='$vendorscriptexp'
24835 version='$version'
24836 version_patchlevel_string='$version_patchlevel_string'
24837 versiononly='$versiononly'
24838 vi='$vi'
24839 xlibpth='$xlibpth'
24840 yacc='$yacc'
24841 yaccflags='$yaccflags'
24842 zcat='$zcat'
24843 zip='$zip'
24844 EOT
24845
24846 : add special variables
24847 $test -f $src/patchlevel.h && \
24848 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
24849 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
24850 echo "PERL_CONFIG_SH=true" >>config.sh
24851
24852 : propagate old symbols
24853 if $test -f UU/config.sh; then
24854         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
24855         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
24856                 config.sh config.sh UU/oldconfig.sh |\
24857                 $sort | $uniq -u >UU/oldsyms
24858         set X `$cat UU/oldsyms`
24859         shift
24860         case $# in
24861         0) ;;
24862         *)
24863                 $cat <<EOM
24864 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
24865 EOM
24866                 echo ": Variables propagated from previous config.sh file." >>config.sh
24867                 for sym in `$cat UU/oldsyms`; do
24868                         echo "    Propagating $hint variable "'$'"$sym..."
24869                         eval 'tmp="$'"${sym}"'"'
24870                         echo "$tmp" | \
24871                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
24872                 done
24873                 ;;
24874         esac
24875 fi
24876
24877 : preserve RCS keywords in files with variable substitution, grrr
24878 Id='$Id'
24879
24880 : Finish up by extracting the .SH files
24881 case "$alldone" in
24882 exit)
24883         $rm -rf UU
24884         echo "Extraction done."
24885         exit 0
24886         ;;
24887 cont)
24888         ;;
24889 '')
24890         dflt=''
24891         nostick=true
24892         $cat <<EOM
24893
24894 If you'd like to make any changes to the config.sh file before I begin
24895 to configure things, do it as a shell escape now (e.g. !vi config.sh).
24896
24897 EOM
24898         rp="Press return or use a shell escape to edit config.sh:"
24899         . UU/myread
24900         nostick=''
24901         case "$ans" in
24902         '') ;;
24903         *) : in case they cannot read
24904                 sh 1>&4 -c "$ans";;
24905         esac
24906         ;;
24907 esac
24908
24909 : if this fails, just run all the .SH files by hand
24910 . ./config.sh
24911
24912 echo " "
24913 exec 1>&4
24914 pwd=`pwd`
24915 . ./UU/extract
24916 cd "$pwd"
24917
24918 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
24919         dflt=y
24920         case "$silent" in
24921         true) ;;
24922         *)
24923                 $cat <<EOM
24924
24925 Now you need to generate make dependencies by running "$make depend".
24926 You might prefer to run it in background: "$make depend > makedepend.out &"
24927 It can take a while, so you might not want to run it right now.
24928
24929 EOM
24930                 ;;
24931         esac
24932         rp="Run $make depend now?"
24933         . UU/myread
24934         case "$ans" in
24935         y*)
24936                 $make depend && echo "Now you must run '$make'."
24937                 ;;
24938         *)
24939                 echo "You must run '$make depend' then '$make'."
24940                 ;;
24941         esac
24942 elif test -f [Mm]akefile; then
24943         echo " "
24944         echo "Now you must run a $make."
24945 else
24946         echo "Configure done."
24947 fi
24948
24949 if $test -f Policy.sh; then
24950     $cat <<EOM
24951
24952 If you compile $package on a different machine or from a different object
24953 directory, copy the Policy.sh file from this object directory to the
24954 new one before you run Configure -- this will help you with most of
24955 the policy defaults.
24956
24957 EOM
24958 fi
24959 if $test -f config.msg; then
24960     echo "Hmm.  I also noted the following information while running:"
24961     echo " "
24962     $cat config.msg >&4
24963     $rm -f config.msg
24964 fi
24965 $rm -f kit*isdone ark*isdone
24966 $rm -rf UU
24967
24968 : End of Configure
24969