This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Rely on C89 <stdlib.h>
[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 should use metaconfig. Perl uses a modified version of this
17 # tool, and this, together with the metaconfig units, are available
18 # in the git repository:
19 #    $ git clone https://github.com/perl5-metaconfig/metaconfig metaconfig
20 # The original dist package (including metaconfig) is available on github:
21 #    $ git clone https://github.com/rmanfredi/dist.git dist-git
22 #
23 # Though this script was generated by metaconfig from metaunits, it is
24 # OK to send patches against Configure itself (but not to commit them
25 # to blead). It's up to
26 # the Configure maintainers to backport the patch to the metaunits if it
27 # is accepted. Exceptions to this rule, and more information, is in
28 # Porting/pumpkin.pod.
29
30 # Generated using [metaconfig 3.5 PL0]
31 # (with additional metaconfig patches by perlbug@perl.org)
32
33 cat >c1$$ <<EOF
34 ARGGGHHHH!!!!!
35
36 SCO csh still thinks true is false.  Write to SCO today and tell them that next
37 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
38
39 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
40 we'd have to do is go in and swap the && and || tokens, wherever they are.)
41
42 [End of diatribe. We now return you to your regularly scheduled programming...]
43 EOF
44 cat >c2$$ <<EOF
45
46 OOPS!  You naughty creature!  You didn't run Configure with sh!
47 I will attempt to remedy the situation by running sh for you...
48 EOF
49
50 true || cat c1$$ c2$$
51 true || exec sh $0 $argv:q
52
53 (exit $?0) || cat c2$$
54 (exit $?0) || exec sh $0 $argv:q
55 rm -f c1$$ c2$$
56
57 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
58         cat <<EOF
59 ***
60 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
61 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
62 *** Please read the README.plan9 for further instructions.
63 *** Cannot continue, aborting.
64 ***
65 EOF
66         exit 1
67 fi
68
69 if test -f /sys/utilities/MultiView ; then
70         # AmigaOS, test -c for /dev/null is not useful
71         :
72 elif 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 archlib=''
340 archlibexp=''
341 d_archlib=''
342 installarchlib=''
343 archname=''
344 myarchname=''
345 useversionedarchname=''
346 d_atolf=''
347 d_atoll=''
348 baserev=''
349 bin=''
350 binexp=''
351 initialinstalllocation=''
352 installbin=''
353 userelocatableinc=''
354 byteorder=''
355 cc=''
356 ccflags=''
357 cppflags=''
358 ldflags=''
359 lkflags=''
360 locincpth=''
361 optimize=''
362 cf_email=''
363 cf_by=''
364 cf_time=''
365 charbits=''
366 charsize=''
367 contains=''
368 cpp_stuff=''
369 cpplast=''
370 cppminus=''
371 cpprun=''
372 cppstdin=''
373 d__fwalk=''
374 d_access=''
375 d_accessx=''
376 d_acosh=''
377 d_aintl=''
378 d_alarm=''
379 asctime_r_proto=''
380 d_asctime_r=''
381 d_asinh=''
382 d_atanh=''
383 d_attribute_deprecated=''
384 d_attribute_format=''
385 d_attribute_malloc=''
386 d_attribute_nonnull=''
387 d_attribute_noreturn=''
388 d_attribute_pure=''
389 d_attribute_unused=''
390 d_attribute_warn_unused_result=''
391 d_printf_format_null=''
392 d_backtrace=''
393 d_builtin_choose_expr=''
394 d_builtin_expect=''
395 d_builtin_add_overflow=''
396 d_builtin_mul_overflow=''
397 d_builtin_sub_overflow=''
398 d_c99_variadic_macros=''
399 d_casti32=''
400 castflags=''
401 d_castneg=''
402 d_cbrt=''
403 d_chown=''
404 d_chroot=''
405 d_chsize=''
406 d_class=''
407 d_clearenv=''
408 d_closedir=''
409 d_void_closedir=''
410 d_cmsghdr_s=''
411 d_const=''
412 d_copysign=''
413 d_copysignl=''
414 d_cplusplus=''
415 cryptlib=''
416 d_crypt=''
417 crypt_r_proto=''
418 d_crypt_r=''
419 d_csh=''
420 full_csh=''
421 d_ctermid=''
422 ctermid_r_proto=''
423 d_ctermid_r=''
424 ctime_r_proto=''
425 d_ctime_r=''
426 d_cuserid=''
427 d_dbl_dig=''
428 d_dbminitproto=''
429 d_difftime=''
430 d_dir_dd_fd=''
431 d_dirfd=''
432 d_dladdr=''
433 d_dlerror=''
434 d_dlopen=''
435 d_dlsymun=''
436 d_dosuid=''
437 d_suidsafe=''
438 d_drand48_r=''
439 drand48_r_proto=''
440 d_drand48proto=''
441 d_dup2=''
442 d_eaccess=''
443 d_endgrent=''
444 d_endgrent_r=''
445 endgrent_r_proto=''
446 d_endhent=''
447 d_endhostent_r=''
448 endhostent_r_proto=''
449 d_endnent=''
450 d_endnetent_r=''
451 endnetent_r_proto=''
452 d_endpent=''
453 d_endprotoent_r=''
454 endprotoent_r_proto=''
455 d_endpwent=''
456 d_endpwent_r=''
457 endpwent_r_proto=''
458 d_endsent=''
459 d_endservent_r=''
460 endservent_r_proto=''
461 d_erf=''
462 d_erfc=''
463 d_exp2=''
464 d_expm1=''
465 d_faststdio=''
466 d_fchdir=''
467 d_fchmod=''
468 d_fchown=''
469 d_fcntl=''
470 d_fcntl_can_lock=''
471 d_fd_macros=''
472 d_fd_set=''
473 d_fds_bits=''
474 d_fdclose=''
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_fchmodat=''
498 d_linkat=''
499 d_openat=''
500 d_renameat=''
501 d_unlinkat=''
502 d_fseeko=''
503 d_fsetpos=''
504 d_fstatfs=''
505 d_fsync=''
506 d_ftello=''
507 d_ftime=''
508 d_gettimeod=''
509 d_futimes=''
510 d_gai_strerror=''
511 d_Gconvert=''
512 d_getaddrinfo=''
513 d_getcwd=''
514 d_getespwnam=''
515 d_getfsstat=''
516 d_getgrent=''
517 d_getgrent_r=''
518 getgrent_r_proto=''
519 d_getgrgid_r=''
520 getgrgid_r_proto=''
521 d_getgrnam_r=''
522 getgrnam_r_proto=''
523 d_getgrps=''
524 d_gethbyaddr=''
525 d_gethbyname=''
526 d_gethent=''
527 aphostname=''
528 d_gethname=''
529 d_phostname=''
530 d_uname=''
531 d_gethostbyaddr_r=''
532 gethostbyaddr_r_proto=''
533 d_gethostbyname_r=''
534 gethostbyname_r_proto=''
535 d_gethostent_r=''
536 gethostent_r_proto=''
537 d_gethostprotos=''
538 d_getitimer=''
539 d_getlogin=''
540 d_getlogin_r=''
541 getlogin_r_proto=''
542 d_getmnt=''
543 d_getmntent=''
544 d_getnameinfo=''
545 d_getnbyaddr=''
546 d_getnbyname=''
547 d_getnent=''
548 d_getnetbyaddr_r=''
549 getnetbyaddr_r_proto=''
550 d_getnetbyname_r=''
551 getnetbyname_r_proto=''
552 d_getnetent_r=''
553 getnetent_r_proto=''
554 d_getnetprotos=''
555 d_getpagsz=''
556 d_getpent=''
557 d_getpgid=''
558 d_getpgrp2=''
559 d_bsdgetpgrp=''
560 d_getpgrp=''
561 d_getppid=''
562 d_getprior=''
563 d_getpbyname=''
564 d_getpbynumber=''
565 d_getprotobyname_r=''
566 getprotobyname_r_proto=''
567 d_getprotobynumber_r=''
568 getprotobynumber_r_proto=''
569 d_getprotoent_r=''
570 getprotoent_r_proto=''
571 d_getprotoprotos=''
572 d_getprpwnam=''
573 d_getpwent=''
574 d_getpwent_r=''
575 getpwent_r_proto=''
576 d_getpwnam_r=''
577 getpwnam_r_proto=''
578 d_getpwuid_r=''
579 getpwuid_r_proto=''
580 d_getsent=''
581 d_getservbyname_r=''
582 getservbyname_r_proto=''
583 d_getservbyport_r=''
584 getservbyport_r_proto=''
585 d_getservent_r=''
586 getservent_r_proto=''
587 d_getservprotos=''
588 d_getspnam=''
589 d_getspnam_r=''
590 getspnam_r_proto=''
591 d_getsbyname=''
592 d_getsbyport=''
593 d_gmtime_r=''
594 gmtime_r_proto=''
595 d_gnulibc=''
596 gnulibc_version=''
597 d_hasmntopt=''
598 d_htonl=''
599 d_hypot=''
600 d_ilogb=''
601 d_ilogbl=''
602 d_inetaton=''
603 d_inetntop=''
604 d_inetpton=''
605 d_int64_t=''
606 d_isascii=''
607 d_isblank=''
608 d_isfinite=''
609 d_isfinitel=''
610 d_isinf=''
611 d_isinfl=''
612 d_isless=''
613 d_isnan=''
614 d_isnanl=''
615 d_isnormal=''
616 d_j0=''
617 d_j0l=''
618 d_killpg=''
619 d_lc_monetary_2008=''
620 d_lchown=''
621 d_ldbl_dig=''
622 d_lgamma=''
623 d_lgamma_r=''
624 d_libm_lib_version=''
625 d_link=''
626 d_llrint=''
627 d_llrintl=''
628 d_llround=''
629 d_llroundl=''
630 d_localeconv_l=''
631 d_localtime_r=''
632 d_localtime_r_needs_tzset=''
633 localtime_r_proto=''
634 d_locconv=''
635 d_lockf=''
636 d_log1p=''
637 d_log2=''
638 d_logb=''
639 d_ldexpl=''
640 d_long_double_style_ieee=''
641 d_long_double_style_ieee_doubledouble=''
642 d_long_double_style_ieee_extended=''
643 d_long_double_style_ieee_std=''
644 d_long_double_style_vax=''
645 d_longdbl=''
646 longdblkind=''
647 longdblsize=''
648 d_longlong=''
649 longlongsize=''
650 d_lrint=''
651 d_lrintl=''
652 d_lround=''
653 d_lroundl=''
654 d_lseekproto=''
655 d_lstat=''
656 d_madvise=''
657 d_malloc_good_size=''
658 d_malloc_size=''
659 d_mblen=''
660 d_mbrlen=''
661 d_mbrtowc=''
662 d_mbstowcs=''
663 d_mbtowc=''
664 d_memmem=''
665 d_memrchr=''
666 d_mkdir=''
667 d_mkdtemp=''
668 d_mkfifo=''
669 d_mkstemp=''
670 d_mkstemps=''
671 d_mktime=''
672 d_mmap=''
673 mmaptype=''
674 d_modfl=''
675 d_modflproto=''
676 d_mprotect=''
677 d_msg=''
678 d_msgctl=''
679 d_msgget=''
680 d_msghdr_s=''
681 d_msgrcv=''
682 d_msgsnd=''
683 d_msync=''
684 d_munmap=''
685 d_nan=''
686 d_nanosleep=''
687 d_nearbyint=''
688 d_duplocale=''
689 d_freelocale=''
690 d_newlocale=''
691 d_querylocale=''
692 d_uselocale=''
693 i_xlocale=''
694 d_nextafter=''
695 d_nexttoward=''
696 d_nice=''
697 d_nl_langinfo=''
698 d_thread_safe_nl_langinfo_l=''
699 d_off64_t=''
700 d_open3=''
701 d_fpathconf=''
702 d_pathconf=''
703 d_pause=''
704 d_pipe=''
705 d_poll=''
706 d_portable=''
707 d_prctl=''
708 d_prctl_set_name=''
709 d_procselfexe=''
710 procselfexe=''
711 d_old_pthread_create_joinable=''
712 old_pthread_create_joinable=''
713 d_pthread_atfork=''
714 d_pthread_attr_setscope=''
715 d_pthread_yield=''
716 d_sched_yield=''
717 sched_yield=''
718 d_ptrdiff_t=''
719 d_qgcvt=''
720 d_random_r=''
721 random_r_proto=''
722 d_readdir64_r=''
723 readdir64_r_proto=''
724 d_readdir=''
725 d_rewinddir=''
726 d_seekdir=''
727 d_telldir=''
728 d_readdir_r=''
729 readdir_r_proto=''
730 d_readlink=''
731 d_readv=''
732 d_recvmsg=''
733 d_re_comp=''
734 d_regcmp=''
735 d_regcomp=''
736 d_remainder=''
737 d_remquo=''
738 d_rename=''
739 d_rint=''
740 d_rmdir=''
741 d_round=''
742 d_sbrkproto=''
743 d_scalbn=''
744 d_scalbnl=''
745 d_select=''
746 d_sem=''
747 d_semctl=''
748 d_semget=''
749 d_semop=''
750 d_sendmsg=''
751 d_setegid=''
752 d_seteuid=''
753 d_setgrent=''
754 d_setgrent_r=''
755 setgrent_r_proto=''
756 d_setgrps=''
757 d_sethent=''
758 d_sethostent_r=''
759 sethostent_r_proto=''
760 d_setitimer=''
761 d_setlinebuf=''
762 d_setlocale=''
763 d_setlocale_r=''
764 setlocale_r_proto=''
765 d_setnent=''
766 d_setnetent_r=''
767 setnetent_r_proto=''
768 d_setpent=''
769 d_setpgid=''
770 d_setpgrp2=''
771 d_bsdsetpgrp=''
772 d_setpgrp=''
773 d_setprior=''
774 d_setproctitle=''
775 d_setprotoent_r=''
776 setprotoent_r_proto=''
777 d_setpwent=''
778 d_setpwent_r=''
779 setpwent_r_proto=''
780 d_setregid=''
781 d_setresgid=''
782 d_setresuid=''
783 d_setreuid=''
784 d_setrgid=''
785 d_setruid=''
786 d_setsent=''
787 d_setservent_r=''
788 setservent_r_proto=''
789 d_setsid=''
790 d_setvbuf=''
791 d_shm=''
792 d_shmat=''
793 d_shmatprototype=''
794 shmattype=''
795 d_shmctl=''
796 d_shmdt=''
797 d_shmget=''
798 d_sigaction=''
799 d_siginfo_si_addr=''
800 d_siginfo_si_band=''
801 d_siginfo_si_errno=''
802 d_siginfo_si_fd=''
803 d_siginfo_si_pid=''
804 d_siginfo_si_status=''
805 d_siginfo_si_uid=''
806 d_siginfo_si_value=''
807 d_signbit=''
808 d_sigprocmask=''
809 d_sigsetjmp=''
810 usesitecustomize=''
811 d_sockatmark=''
812 d_sockatmarkproto=''
813 d_ip_mreq=''
814 d_ip_mreq_source=''
815 d_ipv6_mreq=''
816 d_ipv6_mreq_source=''
817 d_msg_ctrunc=''
818 d_msg_dontroute=''
819 d_msg_oob=''
820 d_msg_peek=''
821 d_msg_proxy=''
822 d_oldsock=''
823 d_scm_rights=''
824 d_sin6_scope_id=''
825 d_sockaddr_in6=''
826 d_sockaddr_sa_len=''
827 d_socket=''
828 d_sockpair=''
829 sockethdr=''
830 socketlib=''
831 d_socklen_t=''
832 d_socks5_init=''
833 d_sprintf_returns_strlen=''
834 d_sqrtl=''
835 d_srand48_r=''
836 srand48_r_proto=''
837 d_srandom_r=''
838 srandom_r_proto=''
839 d_sresgproto=''
840 d_sresuproto=''
841 d_stat=''
842 d_statblks=''
843 d_statfs_f_flags=''
844 d_statfs_s=''
845 d_static_inline=''
846 perl_static_inline=''
847 d_fstatvfs=''
848 d_statvfs=''
849 d_stdio_cnt_lval=''
850 d_stdio_ptr_lval=''
851 d_stdio_ptr_lval_nochange_cnt=''
852 d_stdio_ptr_lval_sets_cnt=''
853 d_stdiobase=''
854 d_stdstdio=''
855 stdio_base=''
856 stdio_bufsiz=''
857 stdio_cnt=''
858 stdio_filbuf=''
859 stdio_ptr=''
860 d_index=''
861 d_strchr=''
862 d_strcoll=''
863 d_strerrm=''
864 d_strerror=''
865 d_sysernlst=''
866 d_syserrlst=''
867 d_strerror_l=''
868 d_strerror_r=''
869 strerror_r_proto=''
870 d_strftime=''
871 d_strlcat=''
872 d_strlcpy=''
873 d_strnlen=''
874 d_strtod=''
875 d_strtol=''
876 d_strtold=''
877 d_strtold_l=''
878 d_strtoll=''
879 d_strtoq=''
880 d_strtoul=''
881 d_strtoull=''
882 d_strtouq=''
883 d_strxfrm=''
884 d_symlink=''
885 d_syscall=''
886 d_syscallproto=''
887 d_sysconf=''
888 d_system=''
889 d_tcgetpgrp=''
890 d_tcsetpgrp=''
891 d_telldirproto=''
892 d_tgamma=''
893 d_time=''
894 timetype=''
895 d_asctime64=''
896 d_ctime64=''
897 d_difftime64=''
898 d_gmtime64=''
899 d_localtime64=''
900 d_mktime64=''
901 d_timegm=''
902 clocktype=''
903 d_times=''
904 d_tmpnam_r=''
905 tmpnam_r_proto=''
906 d_trunc=''
907 d_truncate=''
908 d_truncl=''
909 d_ttyname_r=''
910 ttyname_r_proto=''
911 d_tzname=''
912 d_u32align=''
913 d_ualarm=''
914 d_umask=''
915 d_semctl_semid_ds=''
916 d_semctl_semun=''
917 d_union_semun=''
918 d_unordered=''
919 d_unsetenv=''
920 d_usleep=''
921 d_usleepproto=''
922 d_ustat=''
923 d_pseudofork=''
924 d_vfork=''
925 usevfork=''
926 d_voidsig=''
927 signal_t=''
928 d_wait4=''
929 d_waitpid=''
930 d_wcscmp=''
931 d_wcstombs=''
932 d_wcsxfrm=''
933 d_wctomb=''
934 d_writev=''
935 default_inc_excludes_dot=''
936 dlext=''
937 bin_ELF=''
938 cccdlflags=''
939 ccdlflags=''
940 dlsrc=''
941 ld=''
942 ld_can_script=''
943 lddlflags=''
944 usedl=''
945 doublesize=''
946 dtraceobject=''
947 dtracexnolibs=''
948 ebcdic=''
949 fflushNULL=''
950 fflushall=''
951 fpossize=''
952 fpostype=''
953 gccansipedantic=''
954 gccosandvers=''
955 gccversion=''
956 gidformat=''
957 gidsign=''
958 gidsize=''
959 gidtype=''
960 groupstype=''
961 h_fcntl=''
962 h_sysfile=''
963 html1dir=''
964 html1direxp=''
965 installhtml1dir=''
966 html3dir=''
967 html3direxp=''
968 installhtml3dir=''
969 i_arpainet=''
970 i_assert=''
971 i_bfd=''
972 i_crypt=''
973 db_hashtype=''
974 db_prefixtype=''
975 db_version_major=''
976 db_version_minor=''
977 db_version_patch=''
978 i_db=''
979 i_dbm=''
980 i_rpcsvcdbm=''
981 d_dirnamlen=''
982 direntrytype=''
983 i_dirent=''
984 i_dlfcn=''
985 i_execinfo=''
986 i_fcntl=''
987 i_fenv=''
988 i_float=''
989 i_fp=''
990 i_fp_class=''
991 i_gdbm=''
992 d_grpasswd=''
993 i_grp=''
994 i_ieeefp=''
995 i_inttypes=''
996 i_langinfo=''
997 i_libutil=''
998 i_limits=''
999 i_locale=''
1000 i_machcthr=''
1001 i_malloc=''
1002 i_mallocmalloc=''
1003 i_math=''
1004 i_memory=''
1005 i_mntent=''
1006 d_gdbm_ndbm_h_uses_prototypes=''
1007 d_gdbmndbm_h_uses_prototypes=''
1008 d_ndbm=''
1009 d_ndbm_h_uses_prototypes=''
1010 i_gdbm_ndbm=''
1011 i_gdbmndbm=''
1012 i_ndbm=''
1013 i_netdb=''
1014 i_neterrno=''
1015 i_netinettcp=''
1016 i_niin=''
1017 i_sysin=''
1018 i_poll=''
1019 i_prot=''
1020 i_pthread=''
1021 d_pwage=''
1022 d_pwchange=''
1023 d_pwclass=''
1024 d_pwcomment=''
1025 d_pwexpire=''
1026 d_pwgecos=''
1027 d_pwpasswd=''
1028 d_pwquota=''
1029 i_pwd=''
1030 i_quadmath=''
1031 i_shadow=''
1032 i_socks=''
1033 i_stdbool=''
1034 i_stddef=''
1035 i_stdint=''
1036 i_stdlib=''
1037 i_string=''
1038 strings=''
1039 i_sunmath=''
1040 i_sysaccess=''
1041 i_sysdir=''
1042 i_sysfile=''
1043 d_voidtty=''
1044 i_bsdioctl=''
1045 i_sysfilio=''
1046 i_sysioctl=''
1047 i_syssockio=''
1048 i_syslog=''
1049 i_sysmman=''
1050 i_sysmode=''
1051 i_sysmount=''
1052 i_sysndir=''
1053 i_sysparam=''
1054 i_syspoll=''
1055 i_sysresrc=''
1056 i_syssecrt=''
1057 i_sysselct=''
1058 i_sysstat=''
1059 i_sysstatfs=''
1060 i_sysstatvfs=''
1061 i_systimes=''
1062 i_systypes=''
1063 i_sysuio=''
1064 i_sysun=''
1065 i_sysutsname=''
1066 i_sysvfs=''
1067 i_syswait=''
1068 i_sgtty=''
1069 i_termio=''
1070 i_termios=''
1071 d_tm_tm_gmtoff=''
1072 d_tm_tm_zone=''
1073 i_systime=''
1074 i_systimek=''
1075 i_time=''
1076 timeincl=''
1077 i_unistd=''
1078 i_ustat=''
1079 i_utime=''
1080 i_values=''
1081 i_vfork=''
1082 i_wchar=''
1083 d_inc_version_list=''
1084 inc_version_list=''
1085 inc_version_list_init=''
1086 doubleinfbytes=''
1087 doublenanbytes=''
1088 longdblinfbytes=''
1089 longdblnanbytes=''
1090 installprefix=''
1091 installprefixexp=''
1092 installstyle=''
1093 installusrbinperl=''
1094 intsize=''
1095 longsize=''
1096 shortsize=''
1097 issymlink=''
1098 libc=''
1099 ldlibpthname=''
1100 libperl=''
1101 shrpenv=''
1102 useshrplib=''
1103 glibpth=''
1104 incpth=''
1105 libpth=''
1106 loclibpth=''
1107 plibpth=''
1108 xlibpth=''
1109 ignore_versioned_solibs=''
1110 libs=''
1111 libsdirs=''
1112 libsfiles=''
1113 libsfound=''
1114 libspath=''
1115 lns=''
1116 d_PRIEUldbl=''
1117 d_PRIFUldbl=''
1118 d_PRIGUldbl=''
1119 d_PRIeldbl=''
1120 d_PRIfldbl=''
1121 d_PRIgldbl=''
1122 d_SCNfldbl=''
1123 d_double_has_inf=''
1124 d_double_has_nan=''
1125 d_double_has_negative_zero=''
1126 d_double_has_subnormals=''
1127 d_double_style_cray=''
1128 d_double_style_ibm=''
1129 d_double_style_ieee=''
1130 d_double_style_vax=''
1131 doublekind=''
1132 sPRIEUldbl=''
1133 sPRIFUldbl=''
1134 sPRIGUldbl=''
1135 sPRIeldbl=''
1136 sPRIfldbl=''
1137 sPRIgldbl=''
1138 sSCNfldbl=''
1139 lseeksize=''
1140 lseektype=''
1141 make_set_make=''
1142 d_mymalloc=''
1143 freetype=''
1144 mallocobj=''
1145 mallocsrc=''
1146 malloctype=''
1147 usemallocwrap=''
1148 usemymalloc=''
1149 installman1dir=''
1150 man1dir=''
1151 man1direxp=''
1152 man1ext=''
1153 installman3dir=''
1154 man3dir=''
1155 man3direxp=''
1156 man3ext=''
1157 doublemantbits=''
1158 longdblmantbits=''
1159 nvmantbits=''
1160 modetype=''
1161 multiarch=''
1162 mydomain=''
1163 myhostname=''
1164 phostname=''
1165 c=''
1166 n=''
1167 d_eofnblk=''
1168 eagain=''
1169 o_nonblock=''
1170 rd_nodata=''
1171 need_va_copy=''
1172 netdb_hlen_type=''
1173 netdb_host_type=''
1174 netdb_name_type=''
1175 netdb_net_type=''
1176 groupcat=''
1177 hostcat=''
1178 passcat=''
1179 orderlib=''
1180 ranlib=''
1181 d_perl_otherlibdirs=''
1182 otherlibdirs=''
1183 package=''
1184 spackage=''
1185 pager=''
1186 api_revision=''
1187 api_subversion=''
1188 api_version=''
1189 api_versionstring=''
1190 patchlevel=''
1191 perl_patchlevel=''
1192 revision=''
1193 subversion=''
1194 version=''
1195 version_patchlevel_string=''
1196 perl5=''
1197 perladmin=''
1198 perlpath=''
1199 d_nv_preserves_uv=''
1200 d_nv_zero_is_allbits_zero=''
1201 i16size=''
1202 i16type=''
1203 i32size=''
1204 i32type=''
1205 i64size=''
1206 i64type=''
1207 i8size=''
1208 i8type=''
1209 ivsize=''
1210 ivtype=''
1211 nv_overflows_integers_at=''
1212 nv_preserves_uv_bits=''
1213 nvsize=''
1214 nvtype=''
1215 u16size=''
1216 u16type=''
1217 u32size=''
1218 u32type=''
1219 u64size=''
1220 u64type=''
1221 u8size=''
1222 u8type=''
1223 uvsize=''
1224 uvtype=''
1225 ivdformat=''
1226 nvEUformat=''
1227 nvFUformat=''
1228 nvGUformat=''
1229 nveformat=''
1230 nvfformat=''
1231 nvgformat=''
1232 uvXUformat=''
1233 uvoformat=''
1234 uvuformat=''
1235 uvxformat=''
1236 pidtype=''
1237 prefix=''
1238 prefixexp=''
1239 installprivlib=''
1240 privlib=''
1241 privlibexp=''
1242 ptrsize=''
1243 d_PRIXU64=''
1244 d_PRId64=''
1245 d_PRIi64=''
1246 d_PRIo64=''
1247 d_PRIu64=''
1248 d_PRIx64=''
1249 sPRIXU64=''
1250 sPRId64=''
1251 sPRIi64=''
1252 sPRIo64=''
1253 sPRIu64=''
1254 sPRIx64=''
1255 d_quad=''
1256 quadkind=''
1257 quadtype=''
1258 uquadtype=''
1259 drand01=''
1260 randbits=''
1261 randfunc=''
1262 randseedtype=''
1263 seedfunc=''
1264 installscript=''
1265 scriptdir=''
1266 scriptdirexp=''
1267 selectminbits=''
1268 selecttype=''
1269 sh=''
1270 targetsh=''
1271 sig_count=''
1272 sig_name=''
1273 sig_name_init=''
1274 sig_num=''
1275 sig_num_init=''
1276 sig_size=''
1277 d_sitearch=''
1278 installsitearch=''
1279 sitearch=''
1280 sitearchexp=''
1281 installsitebin=''
1282 sitebin=''
1283 sitebinexp=''
1284 installsitehtml1dir=''
1285 sitehtml1dir=''
1286 sitehtml1direxp=''
1287 installsitehtml3dir=''
1288 sitehtml3dir=''
1289 sitehtml3direxp=''
1290 installsitelib=''
1291 sitelib=''
1292 sitelib_stem=''
1293 sitelibexp=''
1294 installsiteman1dir=''
1295 siteman1dir=''
1296 siteman1direxp=''
1297 installsiteman3dir=''
1298 siteman3dir=''
1299 siteman3direxp=''
1300 siteprefix=''
1301 siteprefixexp=''
1302 installsitescript=''
1303 sitescript=''
1304 sitescriptexp=''
1305 sizesize=''
1306 sizetype=''
1307 d_libname_unique=''
1308 so=''
1309 socksizetype=''
1310 sharpbang=''
1311 shsharp=''
1312 spitshell=''
1313 src=''
1314 ssizetype=''
1315 st_ino_sign=''
1316 st_ino_size=''
1317 startperl=''
1318 startsh=''
1319 stdchar=''
1320 d_stdio_stream_array=''
1321 stdio_stream_array=''
1322 sysman=''
1323 sGMTIME_max=''
1324 sGMTIME_min=''
1325 sLOCALTIME_max=''
1326 sLOCALTIME_min=''
1327 trnl=''
1328 uidformat=''
1329 uidsign=''
1330 uidsize=''
1331 uidtype=''
1332 archname64=''
1333 use64bitall=''
1334 use64bitint=''
1335 usecbacktrace=''
1336 dtrace=''
1337 usedtrace=''
1338 usefaststdio=''
1339 usekernprocpathname=''
1340 ccflags_uselargefiles=''
1341 ldflags_uselargefiles=''
1342 libswanted_uselargefiles=''
1343 uselargefiles=''
1344 uselongdouble=''
1345 usemorebits=''
1346 usemultiplicity=''
1347 nm_opt=''
1348 nm_so_opt=''
1349 runnm=''
1350 usenm=''
1351 usensgetexecutablepath=''
1352 useperlio=''
1353 usequadmath=''
1354 usesocks=''
1355 d_oldpthreads=''
1356 use5005threads=''
1357 useithreads=''
1358 usereentrant=''
1359 usethreads=''
1360 incpath=''
1361 mips_type=''
1362 usrinc=''
1363 d_vendorarch=''
1364 installvendorarch=''
1365 vendorarch=''
1366 vendorarchexp=''
1367 d_vendorbin=''
1368 installvendorbin=''
1369 vendorbin=''
1370 vendorbinexp=''
1371 installvendorhtml1dir=''
1372 vendorhtml1dir=''
1373 vendorhtml1direxp=''
1374 installvendorhtml3dir=''
1375 vendorhtml3dir=''
1376 vendorhtml3direxp=''
1377 d_vendorlib=''
1378 installvendorlib=''
1379 vendorlib=''
1380 vendorlib_stem=''
1381 vendorlibexp=''
1382 installvendorman1dir=''
1383 vendorman1dir=''
1384 vendorman1direxp=''
1385 installvendorman3dir=''
1386 vendorman3dir=''
1387 vendorman3direxp=''
1388 usevendorprefix=''
1389 vendorprefix=''
1390 vendorprefixexp=''
1391 d_vendorscript=''
1392 installvendorscript=''
1393 vendorscript=''
1394 vendorscriptexp=''
1395 versiononly=''
1396 yacc=''
1397 yaccflags=''
1398 CONFIG=''
1399
1400 : Detect odd OSs
1401 define='define'
1402 undef='undef'
1403 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1404 rmlist=''
1405
1406 : We must find out about Eunice early
1407 eunicefix=':'
1408 if test -f /etc/unixtovms; then
1409         eunicefix=/etc/unixtovms
1410 fi
1411 if test -f /etc/unixtovms.exe; then
1412         eunicefix=/etc/unixtovms.exe
1413 fi
1414
1415 : Set executable suffix now -- needed before hints available
1416 if test -f "/libs/version.library"; then
1417 : Amiga OS
1418     _exe=""
1419 elif test -f "/system/gnu_library/bin/ar.pm"; then
1420 : Stratus VOS
1421     _exe=".pm"
1422 elif test -n "$DJGPP"; then
1423 : DOS DJGPP
1424     _exe=".exe"
1425 elif test -f /kern/cookiejar; then
1426 : MiNT
1427     _exe=""
1428 elif test -d c:/. -o -n "$is_os2" ; then
1429 : OS/2 or cygwin
1430     _exe=".exe"
1431 fi
1432
1433 groupstype=''
1434 i_whoami=''
1435 : Possible local include directories to search.
1436 : Set locincpth to "" in a hint file to defeat local include searches.
1437 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1438 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1439 :
1440 : no include file wanted by default
1441 inclwanted=''
1442
1443 : Enable -DEBUGGING and -DDEBUGGING from the command line
1444 EBUGGING=''
1445 DEBUGGING=''
1446
1447 : Trailing extension.  Override this in a hint file, if needed.
1448 : Extra object files, if any, needed on this platform.
1449 archobjs=''
1450 libnames=''
1451 : change the next line if compiling for Xenix/286 on Xenix/386
1452 xlibpth='/usr/lib/386 /lib/386'
1453 : Possible local library directories to search.
1454 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1455 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1456
1457 : general looking path for locating libraries
1458 glibpth="/lib /usr/lib $xlibpth"
1459 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1460 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1461 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1462 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1463
1464 : Private path used by Configure to find libraries.  Its value
1465 : is prepended to libpth. This variable takes care of special
1466 : machines, like the mips.  Usually, it should be empty.
1467 plibpth=''
1468
1469 : default library list
1470 libswanted=''
1471 : some systems want to use only the non-versioned libso:s
1472 ignore_versioned_solibs=''
1473 ccname=''
1474 ccversion=''
1475 perllibs=''
1476 : set useposix=false in your hint file to disable the POSIX extension.
1477 useposix=true
1478 : set useopcode=false in your hint file to disable the Opcode extension.
1479 useopcode=true
1480 archname64=''
1481 ccflags_uselargefiles=''
1482 ldflags_uselargefiles=''
1483 libswanted_uselargefiles=''
1484 : set usemultiplicity on the Configure command line to enable multiplicity.
1485 : set usesocks on the Configure command line to enable socks.
1486 archname=''
1487 : set usethreads on the Configure command line to enable threads.
1488 usereentrant='undef'
1489 : List of libraries we want.
1490 : If anyone needs extra -lxxx, put those in a hint file.
1491 libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
1492 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1493 : We probably want to search /usr/shlib before most other libraries.
1494 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1495 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1496 glibpth="/usr/shlib $glibpth"
1497 : Do not use vfork unless overridden by a hint file.
1498 usevfork=false
1499
1500 : Find the basic shell for Bourne shell scripts
1501 case "$sh" in
1502 '')
1503         case "$SYSTYPE" in
1504         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1505         *) xxx='/bin/sh';;
1506         esac
1507         if test -f "$xxx"; then
1508                 sh="$xxx"
1509         else
1510                 : Build up a list and do a single loop so we can 'break' out.
1511                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1512                 for xxx in sh bash ksh pdksh ash; do
1513                         for p in $pth; do
1514                                 try="$try ${p}/${xxx}"
1515                         done
1516                 done
1517                 for xxx in $try; do
1518                         if test -f "$xxx"; then
1519                                 sh="$xxx";
1520                                 break
1521                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1522                                 sh="$xxx";
1523                                 break
1524                         elif test -f "$xxx.exe"; then
1525                                 sh="$xxx";
1526                                 break
1527                         fi
1528                 done
1529         fi
1530         ;;
1531 esac
1532
1533 case "$sh" in
1534 '')     cat >&2 <<EOM
1535 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1536
1537 Usually it's in /bin/sh.  How did you even get this far?
1538 Please contact me (Perl Maintainers) at perlbug@perl.org and
1539 we'll try to straighten this all out.
1540 EOM
1541         exit 1
1542         ;;
1543 esac
1544
1545 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1546 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1547 targetsh=$sh
1548
1549 : see if sh knows # comments
1550 if `$sh -c '#' >/dev/null 2>&1`; then
1551         shsharp=true
1552         spitshell=cat
1553         xcat=/bin/cat
1554         test -f $xcat$_exe || xcat=/usr/bin/cat
1555         if test ! -f $xcat$_exe; then
1556                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1557                         if test -f $p/cat$_exe; then
1558                                 xcat=$p/cat
1559                                 break
1560                         fi
1561                 done
1562                 if test ! -f $xcat$_exe; then
1563                         echo "Can't find cat anywhere!"
1564                         exit 1
1565                 fi
1566         fi
1567         echo "#!$xcat" >sharp
1568         $eunicefix sharp
1569         chmod +x sharp
1570         ./sharp > today 2>/dev/null
1571         if test -s today; then
1572                 sharpbang='#!'
1573         else
1574                 echo "#! $xcat" > sharp
1575                 $eunicefix sharp
1576                 chmod +x sharp
1577                 ./sharp > today 2>/dev/null
1578                 if test -s today; then
1579                         sharpbang='#! '
1580                 else
1581                         sharpbang=': use '
1582                 fi
1583         fi
1584 else
1585         echo " "
1586         echo "Your $sh doesn't grok # comments--I will strip them later on."
1587         shsharp=false
1588         cd ..
1589         echo "exec grep -v '^[  ]*#'" >spitshell
1590         chmod +x spitshell
1591         $eunicefix spitshell
1592         spitshell=`pwd`/spitshell
1593         cd UU
1594         echo "I presume that if # doesn't work, #! won't work either!"
1595         sharpbang=': use '
1596 fi
1597 rm -f sharp today
1598
1599 : figure out how to guarantee sh startup
1600 case "$startsh" in
1601 '') startsh=${sharpbang}${sh} ;;
1602 *)
1603 esac
1604 cat >sharp <<EOSS
1605 $startsh
1606 set abc
1607 test "$?abc" != 1
1608 EOSS
1609
1610 chmod +x sharp
1611 $eunicefix sharp
1612 if ./sharp; then
1613         : echo "Yup, it does."
1614 else
1615         echo "Hmm... '$startsh' does not guarantee sh startup..."
1616         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1617 fi
1618 rm -f sharp
1619
1620 : Save command line options in file UU/cmdline.opt for later use in
1621 : generating config.sh.
1622 cat > cmdline.opt <<EOSH
1623 : Configure command line arguments.
1624 config_arg0='$0'
1625 config_args='$*'
1626 config_argc=$#
1627 EOSH
1628 argn=1
1629 args_exp=''
1630 args_sep=''
1631 for arg in "$@"; do
1632         cat >>cmdline.opt <<EOSH
1633 config_arg$argn='$arg'
1634 EOSH
1635         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1636 $arg
1637 EOC
1638         arg_exp=`cat cmdl.opt`
1639         args_exp="$args_exp$args_sep'$arg_exp'"
1640         argn=`expr $argn + 1`
1641         args_sep=' '
1642 done
1643 rm -f cmdl.opt
1644
1645 : produce awk script to parse command line options
1646 cat >options.awk <<'EOF'
1647 BEGIN {
1648         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1649
1650         len = length(optstr);
1651         for (i = 1; i <= len; i++) {
1652                 c = substr(optstr, i, 1);
1653                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1654                 if (a == ":") {
1655                         arg[c] = 1;
1656                         i++;
1657                 }
1658                 opt[c] = 1;
1659         }
1660 }
1661 {
1662         expect = 0;
1663         str = $0;
1664         if (substr(str, 1, 1) != "-") {
1665                 printf("'%s'\n", str);
1666                 next;
1667         }
1668         len = length($0);
1669         for (i = 2; i <= len; i++) {
1670                 c = substr(str, i, 1);
1671                 if (!opt[c]) {
1672                         printf("-%s\n", substr(str, i));
1673                         next;
1674                 }
1675                 printf("-%s\n", c);
1676                 if (arg[c]) {
1677                         if (i < len)
1678                                 printf("'%s'\n", substr(str, i + 1));
1679                         else
1680                                 expect = 1;
1681                         next;
1682                 }
1683         }
1684 }
1685 END {
1686         if (expect)
1687                 print "?";
1688 }
1689 EOF
1690
1691 : process the command line options
1692 set X `for arg in "$@"; do echo "X$arg"; done |
1693         sed -e s/X// | awk -f options.awk`
1694 eval "set $*"
1695 shift
1696 rm -f options.awk
1697
1698 : set up default values
1699 fastread=''
1700 reuseval=false
1701 config_sh=''
1702 alldone=''
1703 error=''
1704 silent=''
1705 extractsh=''
1706 knowitall=''
1707 rm -f optdef.sh posthint.sh
1708 cat >optdef.sh <<EOS
1709 $startsh
1710 EOS
1711
1712
1713 : option parsing
1714 while test $# -gt 0; do
1715         case "$1" in
1716         -d) shift; fastread=yes;;
1717         -e) shift; alldone=cont;;
1718         -f)
1719                 shift
1720                 cd ..
1721                 if test -r "$1"; then
1722                         config_sh="$1"
1723                 else
1724                         echo "$me: cannot read config file $1." >&2
1725                         error=true
1726                 fi
1727                 cd UU
1728                 shift;;
1729         --help|\
1730         -h) shift; error=true;;
1731         -r) shift; reuseval=true;;
1732         -s) shift; silent=true; realsilent=true;;
1733         -E) shift; alldone=exit;;
1734         -K) shift; knowitall=true;;
1735         -O) shift;;
1736         -S) shift; silent=true; extractsh=true;;
1737         -D)
1738                 shift
1739                 case "$1" in
1740                 *=)
1741                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1742                         echo "$me: ignoring -D $1" >&2
1743                         ;;
1744                 *=*) echo "$1" | \
1745                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1746                 *) echo "$1='define'" >> optdef.sh;;
1747                 esac
1748                 shift
1749                 ;;
1750         -U)
1751                 shift
1752                 case "$1" in
1753                 *=) echo "$1" >> optdef.sh;;
1754                 *=*)
1755                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1756                         echo "$me: ignoring -U $1" >&2
1757                         ;;
1758                 *) echo "$1='undef'" >> optdef.sh;;
1759                 esac
1760                 shift
1761                 ;;
1762         -A)
1763             shift
1764             xxx=''
1765             yyy="$1"
1766             zzz=''
1767             uuu=undef
1768             case "$yyy" in
1769             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1770                  case "$zzz" in
1771                  *:*) zzz='' ;;
1772                  *)   xxx=append
1773                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1774                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1775                  esac
1776                  ;;
1777             esac
1778             case "$xxx" in
1779             '')  case "$yyy" in
1780                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1781                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1782                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1783                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1784                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1785                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1786                  esac
1787                  ;;
1788             esac
1789             case "$xxx" in
1790             append)
1791                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1792             clear)
1793                 echo "$yyy=''"                  >> posthint.sh ;;
1794             define)
1795                 case "$zzz" in
1796                 '') zzz=define ;;
1797                 esac
1798                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1799             eval)
1800                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1801             prepend)
1802                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1803             undef)
1804                 case "$zzz" in
1805                 '') zzz="$uuu" ;;
1806                 esac
1807                 echo "$yyy=$zzz"                >> posthint.sh ;;
1808             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1809             esac
1810             shift
1811             ;;
1812         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1813             exit 0;;
1814         --) break;;
1815         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1816         *) break;;
1817         esac
1818 done
1819
1820 case "$error" in
1821 true)
1822         cat >&2 <<EOM
1823 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1824                  [-U symbol] [-U symbol=] [-A command:symbol...]
1825   -d : use defaults for all answers.
1826   -e : go on without questioning past the production of config.sh.
1827   -f : specify an alternate default configuration file.
1828   -h : print this help message and exit (with an error status).
1829   -r : reuse C symbols value if possible (skips costly nm extraction).
1830   -s : silent mode, only echoes questions and essential information.
1831   -D : define symbol to have some value:
1832          -D symbol         symbol gets the value 'define'
1833          -D symbol=value   symbol gets the value 'value'
1834        common used examples (see INSTALL for more info):
1835          -Duse64bitint            use 64bit integers
1836          -Duse64bitall            use 64bit integers and pointers
1837          -Dusethreads             use thread support
1838          -Dinc_version_list=none  do not include older perl trees in @INC
1839          -DEBUGGING=none          DEBUGGING options
1840          -Dcc=gcc                 choose your compiler
1841          -Dprefix=/opt/perl5      choose your destination
1842   -E : stop at the end of questions, after having produced config.sh.
1843   -K : do not use unless you know what you are doing.
1844   -O : ignored for backward compatibility
1845   -S : perform variable substitutions on all .SH files (can mix with -f)
1846   -U : undefine symbol:
1847          -U symbol    symbol gets the value 'undef'
1848          -U symbol=   symbol gets completely empty
1849        e.g.:  -Uversiononly
1850   -A : manipulate symbol after the platform specific hints have been applied:
1851          -A append:symbol=value   append value to symbol
1852          -A symbol=value          like append:, but with a separating space
1853          -A define:symbol=value   define symbol to have value
1854          -A clear:symbol          define symbol to be ''
1855          -A define:symbol         define symbol to be 'define'
1856          -A eval:symbol=value     define symbol to be eval of value
1857          -A prepend:symbol=value  prepend value to symbol
1858          -A undef:symbol          define symbol to be 'undef'
1859          -A undef:symbol=         define symbol to be ''
1860        e.g.:  -A prepend:libswanted='cl pthread '
1861               -A ccflags=-DSOME_MACRO
1862   -V : print version number and exit (with a zero status).
1863 EOM
1864         exit 1
1865         ;;
1866 esac
1867
1868 : Sanity checks
1869 case "$fastread$alldone" in
1870 yescont|yesexit) ;;
1871 *)
1872         case "$extractsh" in
1873         true) ;;
1874         *)
1875                 if test ! -t 0; then
1876                         echo "Say 'sh Configure', not 'sh <Configure'"
1877                         exit 1
1878                 fi
1879                 ;;
1880         esac
1881         ;;
1882 esac
1883
1884 exec 4>&1
1885 case "$silent" in
1886 true) exec 1>/dev/null;;
1887 esac
1888
1889 : run the defines and the undefines, if any, but leave the file out there...
1890 touch optdef.sh
1891 grep '\\' optdef.sh >/dev/null 2>&1
1892 if test $? = 0; then
1893     echo "Configure does not support \\ in -D arguments"
1894     exit 1
1895 fi
1896 . ./optdef.sh
1897 : create the posthint manipulation script and leave the file out there...
1898 touch posthint.sh
1899
1900 : set package name
1901 package='perl5'
1902 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1903 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1904 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1905 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1906 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1907 esac
1908
1909 : Some greps do not return status, grrr.
1910 echo "grimblepritz" >grimble
1911 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1912         contains=contains
1913 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1914         contains=grep
1915 else
1916         contains=contains
1917 fi
1918 rm -f grimble
1919 : the following should work in any shell
1920 case "$contains" in
1921 contains*)
1922         echo " "
1923         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1924         cat >contains <<'EOSS'
1925 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1926 EOSS
1927 chmod +x contains
1928 esac
1929
1930 : Find the path to the source tree
1931 case "$src" in
1932 '') case "$0" in
1933     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1934          case "$src" in
1935          /*)    ;;
1936          .)     ;;
1937          *)     src=`cd ../$src && pwd` ;;
1938          esac
1939          ;;
1940     *)   src='.';;
1941     esac;;
1942 esac
1943 case "$src" in
1944 '')     src=/
1945         rsrc=/
1946         ;;
1947 /*)     rsrc="$src";;
1948 *)      rsrc="../$src";;
1949 esac
1950 if test -f $rsrc/Configure && \
1951         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1952 then
1953    : found it, so we are ok.
1954 else
1955         rsrc=''
1956         for src in . .. ../.. ../../.. ../../../..; do
1957                 if test -f ../$src/Configure && \
1958                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1959                 then
1960                         rsrc=../$src
1961                         break
1962                 fi
1963         done
1964 fi
1965 case "$rsrc" in
1966 '')
1967         cat <<EOM >&4
1968
1969 Sorry, I can't seem to locate the source dir for $package.  Please start
1970 Configure with an explicit path -- i.e. /some/path/Configure.
1971
1972 EOM
1973         exit 1
1974         ;;
1975 ../.)   rsrc='..';;
1976 *)
1977         echo " "
1978         echo "Sources for $package found in \"$src\"." >&4
1979         ;;
1980 esac
1981
1982 : script used to extract .SH files with variable substitutions
1983 cat >extract <<'EOS'
1984 PERL_CONFIG_SH=true
1985 echo "Doing variable substitutions on .SH files..."
1986 if test -f MANIFEST; then
1987         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1988 else
1989         echo "(Looking for .SH files under the source directory.)"
1990         set x `(cd "$src"; find . -name "*.SH" -print)`
1991 fi
1992 shift
1993 case $# in
1994 0) set x `(cd "$src"; echo *.SH)`; shift;;
1995 esac
1996 if test ! -f "$src/$1"; then
1997         shift
1998 fi
1999 mkdir_p='
2000 name=$1;
2001 create="";
2002 while test $name; do
2003         if test ! -d "$name"; then
2004                 create="$name $create";
2005                 name=`echo $name | sed -e "s|^[^/]*$||"`;
2006                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
2007         else
2008                 name="";
2009         fi;
2010 done;
2011 for file in $create; do
2012         mkdir $file;
2013 done
2014 '
2015 for file in $*; do
2016         case "$src" in
2017         ".")
2018                 case "$file" in
2019                 */*)
2020                         dir=`expr X$file : 'X\(.*\)/'`
2021                         file=`expr X$file : 'X.*/\(.*\)'`
2022                         (cd "$dir" && . ./$file)
2023                         ;;
2024                 *)
2025                         . ./$file
2026                         ;;
2027                 esac
2028                 ;;
2029         *)
2030                 case "$file" in
2031                 */*)
2032                         dir=`expr X$file : 'X\(.*\)/'`
2033                         file=`expr X$file : 'X.*/\(.*\)'`
2034                         (set x $dir; shift; eval $mkdir_p)
2035                         sh <"$src/$dir/$file"
2036                         ;;
2037                 *)
2038                         sh <"$src/$file"
2039                         ;;
2040                 esac
2041                 ;;
2042         esac
2043 done
2044 if test -f "$src/config_h.SH"; then
2045         if test ! -f config.h; then
2046         : oops, they left it out of MANIFEST, probably, so do it anyway.
2047         . "$src/config_h.SH"
2048         fi
2049 fi
2050 EOS
2051
2052 : extract files and exit if asked to do so
2053 case "$extractsh" in
2054 true)
2055         case "$realsilent" in
2056         true) ;;
2057         *) exec 1>&4;;
2058         esac
2059         case "$config_sh" in
2060         '') config_sh='config.sh';;
2061         esac
2062         echo " "
2063         echo "Fetching answers from $config_sh..."
2064         cd ..
2065         . $config_sh
2066         . UU/optdef.sh
2067         echo " "
2068         . UU/extract
2069         rm -rf UU
2070         echo "Extraction done."
2071         exit 0
2072         ;;
2073 esac
2074
2075 : Eunice requires " " instead of "", can you believe it
2076 echo " "
2077 : Here we go...
2078 echo "Beginning of configuration questions for $package."
2079
2080 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2081
2082 : first determine how to suppress newline on echo command
2083 echo " "
2084 echo "Checking echo to see how to suppress newlines..."
2085 (echo "hi there\c" ; echo " ") >.echotmp
2086 if $contains c .echotmp >/dev/null 2>&1 ; then
2087         echo "...using -n."
2088         n='-n'
2089         c=''
2090 else
2091         cat <<'EOM'
2092 ...using \c
2093 EOM
2094         n=''
2095         c='\c'
2096 fi
2097 echo $n "The star should be here-->$c"
2098 echo '*'
2099 rm -f .echotmp
2100
2101 : Now test for existence of everything in MANIFEST
2102 echo " "
2103 if test -f "$rsrc/MANIFEST"; then
2104         echo "First let's make sure your kit is complete.  Checking..." >&4
2105         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2106                 (split -l 50 2>/dev/null || split -50)
2107         rm -f missing
2108         tmppwd=`pwd`
2109         for filelist in x??; do
2110                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2111                         >/dev/null 2>>"$tmppwd/missing")
2112         done
2113         if test -s missing; then
2114                 cat missing >&4
2115                 cat >&4 <<'EOM'
2116
2117 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2118
2119 You have the option of continuing the configuration process, despite the
2120 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2121 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2122 and contact the author (perlbug@perl.org).
2123
2124 EOM
2125                 echo $n "Continue? [n] $c" >&4
2126                 read ans
2127                 case "$ans" in
2128                 y*)
2129                         echo "Continuing..." >&4
2130                         rm -f missing
2131                         ;;
2132                 *)
2133                         echo "ABORTING..." >&4
2134                         kill $$
2135                         ;;
2136                 esac
2137         else
2138                 echo "Looks good..."
2139         fi
2140 else
2141         echo "There is no MANIFEST file.  I hope your kit is complete !"
2142 fi
2143 rm -f missing x??
2144
2145 : Find the appropriate value for a newline for tr
2146 if test -n "$DJGPP"; then
2147        trnl='\012'
2148 fi
2149 if test X"$trnl" = X; then
2150         case "`echo foo | tr '\n' x 2>/dev/null`" in
2151         foox) trnl='\n' ;;
2152         esac
2153 fi
2154 if test X"$trnl" = X; then
2155         case "`echo foo | tr '\012' x 2>/dev/null`" in
2156         foox) trnl='\012' ;;
2157         esac
2158 fi
2159 if test X"$trnl" = X; then
2160        case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
2161        fooxy) trnl='\n\r' ;;
2162        esac
2163 fi
2164 if test X"$trnl" = X; then
2165         cat <<EOM >&2
2166
2167 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2168
2169 EOM
2170         exit 1
2171 fi
2172
2173 : compute the number of columns on the terminal for proper question formatting
2174 case "$COLUMNS" in
2175 '') COLUMNS='80';;
2176 esac
2177
2178 : set up the echo used in my read
2179 myecho="case \"\$xxxm\" in
2180 '') echo $n \"\$rp $c\" >&4;;
2181 *) case \"\$rp\" in
2182         '') echo $n \"[\$xxxm] $c\";;
2183         *)
2184                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2185                         echo \"\$rp\" >&4
2186                         echo $n \"[\$xxxm] $c\" >&4
2187                 else
2188                         echo $n \"\$rp [\$xxxm] $c\" >&4
2189                 fi
2190                 ;;
2191         esac;;
2192 esac"
2193
2194 : now set up to do reads with possible shell escape and default assignment
2195 cat <<EOSC >myread
2196 $startsh
2197 xxxm=\$dflt
2198 $myecho
2199 ans='!'
2200 case "\$fastread" in
2201 yes) case "\$dflt" in
2202         '') ;;
2203         *) ans='';
2204                 case "\$silent-\$rp" in
2205                 true-) ;;
2206                 *) echo " " >&4;;
2207                 esac;;
2208         esac;;
2209 *) case "\$silent" in
2210         true) case "\$rp" in
2211                 '') ans='';;
2212                 esac;;
2213         esac;;
2214 esac
2215 while expr "X\$ans" : "X!" >/dev/null; do
2216         read answ
2217         set x \$xxxm
2218         shift
2219         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2220         case  "\$answ" in
2221         "!")
2222                 sh 1>&4
2223                 echo " "
2224                 $myecho
2225                 ;;
2226         !*)
2227                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2228                 shift
2229                 sh 1>&4 -c "\$*"
2230                 echo " "
2231                 $myecho
2232                 ;;
2233         "\$ans")
2234                 case "\$ans" in
2235                 \\&*)
2236                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2237                         shift
2238                         case "\$1" in
2239                         -d)
2240                                 fastread=yes
2241                                 echo "(OK, I'll run with -d after this question.)" >&4
2242                                 ;;
2243                         -*)
2244                                 echo "*** Sorry, \$1 not supported yet." >&4
2245                                 ;;
2246                         esac
2247                         $myecho
2248                         ans=!
2249                         ;;
2250                 esac;;
2251         *)
2252                 case "\$aok" in
2253                 y)
2254                         echo "*** Substitution done -- please confirm."
2255                         xxxm="\$ans"
2256                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2257                         xxxm="\$ans"
2258                         ans=!
2259                         ;;
2260                 *)
2261                         echo "*** Error -- try again."
2262                         ans=!
2263                         ;;
2264                 esac
2265                 $myecho
2266                 ;;
2267         esac
2268         case "\$ans\$xxxm\$nostick" in
2269         '')
2270                 ans=!
2271                 $myecho
2272                 ;;
2273         esac
2274 done
2275 case "\$ans" in
2276 '') ans="\$xxxm";;
2277 esac
2278 EOSC
2279
2280 : create .config dir to save info across Configure sessions
2281 test -d ../.config || mkdir ../.config
2282 cat >../.config/README <<EOF
2283 This directory created by Configure to save information that should
2284 persist across sessions for $package.
2285
2286 You may safely delete it if you wish.
2287 EOF
2288
2289 : See if we are using a devel version and want that
2290 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2291 case "$usedevel" in
2292 $define|true|[yY]*)
2293     usedevel="$define" ;;
2294 *) case "$xversion" in
2295    *[13579])
2296         cat >&4 <<EOH
2297 *** WHOA THERE!!! ***
2298
2299     This is an UNSTABLE DEVELOPMENT release.
2300     The version of this $package distribution is $xversion, that is, odd,
2301     (as opposed to even) and that signifies a development release.
2302     If you want a maintenance release, you want an even-numbered version.
2303
2304     Do ***NOT*** install this into production use.
2305     Data corruption and crashes are possible.
2306
2307     It is most seriously suggested that you do not continue any further
2308     unless you want to help in developing and debugging Perl.
2309
2310     If you *still* want to build perl, you can answer 'y' now,
2311     or pass -Dusedevel to Configure.
2312
2313 EOH
2314         rp='Do you really want to continue?'
2315         dflt='n'
2316         . ./myread
2317         case "$ans" in
2318         [yY]) echo >&4 "Okay, continuing."
2319               usedevel="$define" ;;
2320         *) echo >&4 "Okay, bye."
2321            exit 1
2322            ;;
2323         esac
2324         ;;
2325     esac
2326     usedevel="$undef"
2327     ;;
2328 esac
2329 case "$usedevel" in
2330 $define|true|[yY]*)
2331         case "$versiononly" in
2332         '') versiononly="$define" ;;
2333         esac
2334         case "$installusrbinperl" in
2335         '') installusrbinperl="$undef" ;;
2336         esac
2337         ;;
2338 esac
2339
2340 : general instructions
2341 needman=true
2342 firsttime=true
2343 user=`(logname) 2>/dev/null`
2344 case "$user" in
2345 '') user=`whoami 2>&1`;;
2346 esac
2347 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2348         firsttime=false
2349         echo " "
2350         rp='Would you like to see the instructions?'
2351         dflt=n
2352         . ./myread
2353         case "$ans" in
2354         [yY]*) ;;
2355         *) needman=false;;
2356         esac
2357 fi
2358 if $needman; then
2359         cat <<EOH
2360
2361 This installation shell script will examine your system and ask you questions
2362 to determine how the perl5 package should be installed. If you get
2363 stuck on a question, you may use a ! shell escape to start a subshell or
2364 execute a command.  Many of the questions will have default answers in square
2365 brackets; typing carriage return will give you the default.
2366
2367 On some of the questions which ask for file or directory names you are allowed
2368 to use the ~name construct to specify the login directory belonging to "name",
2369 even if you don't have a shell which knows about that.  Questions where this is
2370 allowed will be marked "(~name ok)".
2371
2372 EOH
2373         rp=''
2374         dflt='Type carriage return to continue'
2375         . ./myread
2376         cat <<'EOH'
2377
2378 The prompter used in this script allows you to use shell variables and
2379 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2380 in the default answer, as if the default line was a set of arguments given to a
2381 script shell.  This means you may also use $* to repeat the whole default line,
2382 so you do not have to re-type everything to add something to the default.
2383
2384 Every time there is a substitution, you will have to confirm.  If there is an
2385 error (e.g. an unmatched backtick), the default answer will remain unchanged
2386 and you will be prompted again.
2387
2388 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2389 the questions and use the computed defaults (or the previous answers if there
2390 was already a config.sh file). Type 'Configure -h' for a list of options.
2391 You may also start interactively and then answer '& -d' at any prompt to turn
2392 on the non-interactive behaviour for the remainder of the execution.
2393
2394 EOH
2395         . ./myread
2396         cat <<EOH
2397
2398 Much effort has been expended to ensure that this shell script will run on any
2399 Unix system.  If despite that it blows up on yours, your best bet is to edit
2400 Configure and run it again.  If you can't run Configure for some reason,
2401 you'll have to generate a config.sh file by hand.  Whatever problems you
2402 have, let me (perlbug@perl.org) know how I blew it.
2403
2404 This installation script affects things in two ways:
2405
2406 1) it may do direct variable substitutions on some of the files included
2407    in this kit.
2408 2) it builds a config.h file for inclusion in C programs.  You may edit
2409    any of these files as the need arises after running this script.
2410
2411 If you make a mistake on a question, there is no easy way to back up to it
2412 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2413 files.  Configure will offer to let you do this before it runs the SH files.
2414
2415 EOH
2416         dflt='Type carriage return to continue'
2417         . ./myread
2418         case "$firsttime" in
2419         true) echo $user >>../.config/instruct;;
2420         esac
2421 fi
2422
2423 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2424 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2425 if test "X$sysroot" = X; then
2426     sysroot=""
2427 else
2428     case "$cc" in
2429         *gcc*|*g++*)
2430             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2431             # _sysroot is used in places where we need --sysroot=foo
2432             # but using the rest of the flags could cause issues.
2433             _sysroot="--sysroot=$sysroot";
2434             case "$ccflags" in
2435                 *sysroot*) ;;
2436                 'undef'|*)
2437                 ccflags="$ccflags $_sysroot"
2438             esac
2439             case "$ldflags" in
2440                 *sysroot*) ;;
2441                 'undef'|*)
2442                 ldflags="$ldflags $_sysroot"
2443             esac
2444             case "$cppflags" in
2445                 *sysroot*) ;;
2446                 'undef'|*)
2447                 cppflags="$cppflags $_sysroot"
2448             esac
2449             # lddlflags updated below in lddlflags section;
2450             # same with cccdlflags
2451             ;;
2452     esac
2453
2454     # Adjust some defaults to also use $sysroot
2455     for var in xlibpth loclibpth locincpth glibpth; do
2456         eval xxx=\$$var
2457         eval $var=''
2458         for path in $xxx; do
2459             eval $var=\"\$$var $sysroot$path\"
2460         done
2461     done
2462
2463 fi
2464
2465 : find out where common programs are
2466 echo " "
2467 echo "Locating common programs..." >&4
2468 cat <<EOSC >loc
2469 $startsh
2470 case \$# in
2471 0) exit 1;;
2472 esac
2473 thing=\$1
2474 shift
2475 dflt=\$1
2476 shift
2477 for dir in \$*; do
2478         case "\$thing" in
2479         .)
2480         if test -d \$dir/\$thing; then
2481                 echo \$dir
2482                 exit 0
2483         fi
2484         ;;
2485         *)
2486         for thisthing in \$dir/\$thing; do
2487                 : just loop through to pick last item
2488         done
2489         if test -f \$thisthing; then
2490                 echo \$thisthing
2491                 exit 0
2492         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2493                 echo \$thisthing
2494                 exit 0
2495         elif test -f \$dir/\$thing.exe; then
2496                 if test -n "$DJGPP"; then
2497                         echo \$dir/\$thing.exe
2498                 elif test "$eunicefix" != ":"; then
2499                         : on Eunice apparently
2500                         echo \$dir/\$thing
2501                 fi
2502                 exit 0
2503         fi
2504         ;;
2505         esac
2506 done
2507 echo \$dflt
2508 exit 1
2509 EOSC
2510 chmod +x loc
2511 $eunicefix loc
2512 loclist="
2513 awk
2514 cat
2515 chmod
2516 comm
2517 cp
2518 echo
2519 expr
2520 grep
2521 ls
2522 mkdir
2523 rm
2524 sed
2525 sort
2526 touch
2527 tr
2528 uniq
2529 "
2530 trylist="
2531 ar
2532 bison
2533 byacc
2534 cpp
2535 csh
2536 date
2537 egrep
2538 gmake
2539 gzip
2540 less
2541 ln
2542 make
2543 more
2544 nm
2545 nroff
2546 perl
2547 pg
2548 test
2549 uname
2550 zip
2551 "
2552 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2553 pth="$pth $sysroot/lib $sysroot/usr/lib"
2554 for file in $loclist; do
2555         eval xxx=\$$file
2556         case "$xxx" in
2557         /*|?:[\\/]*)
2558                 if test -f "$xxx"; then
2559                         : ok
2560                 else
2561                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2562                         xxx=`./loc $file $file $pth`
2563                 fi
2564                 ;;
2565         '') xxx=`./loc $file $file $pth`;;
2566         *) xxx=`./loc $xxx $xxx $pth`;;
2567         esac
2568         eval $file=$xxx$_exe
2569         eval _$file=$xxx
2570         case "$xxx" in
2571         /*)
2572                 echo $file is in $xxx.
2573                 ;;
2574         ?:[\\/]*)
2575                 echo $file is in $xxx.
2576                 ;;
2577         *)
2578                 echo "I don't know where '$file' is, and my life depends on it." >&4
2579                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2580                 exit 1
2581                 ;;
2582         esac
2583 done
2584 echo " "
2585 echo "Don't worry if any of the following aren't found..."
2586 say=offhand
2587 for file in $trylist; do
2588         eval xxx=\$$file
2589         case "$xxx" in
2590         /*|?:[\\/]*)
2591                 if test -f "$xxx"; then
2592                         : ok
2593                 else
2594                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2595                         xxx=`./loc $file $file $pth`
2596                 fi
2597                 ;;
2598         '') xxx=`./loc $file $file $pth`;;
2599         *) xxx=`./loc $xxx $xxx $pth`;;
2600         esac
2601         eval $file=$xxx$_exe
2602         eval _$file=$xxx
2603         case "$xxx" in
2604         /*)
2605                 echo $file is in $xxx.
2606                 ;;
2607         ?:[\\/]*)
2608                 echo $file is in $xxx.
2609                 ;;
2610         *)
2611                 echo "I don't see $file out there, $say."
2612                 say=either
2613                 ;;
2614         esac
2615 done
2616 case "$egrep" in
2617 egrep)
2618         echo "Substituting grep for egrep."
2619         egrep=$grep
2620         _egrep=$grep
2621         ;;
2622 esac
2623 case "$less" in
2624 '')     ;;
2625 *)      if $less -R </dev/null >/dev/null 2>&1; then
2626                echo "Substituting less -R for less."
2627                less="$less -R"
2628                _less=$less
2629         fi
2630         ;;
2631 esac
2632 case "$ln" in
2633 ln)
2634         echo "Substituting cp for ln."
2635         ln=$cp
2636         _ln=$cp
2637         ;;
2638 esac
2639 case "$make" in
2640 make)
2641         case "$gmake" in
2642         gmake)
2643         echo "I can't find make or gmake, and my life depends on it." >&4
2644         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2645         exit 1
2646         ;;
2647         esac
2648         ;;
2649 esac
2650 case "$gmake" in
2651 gmake)  ;;
2652 *)      # We can't have osname yet.
2653         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2654                 # Assume that gmake, if found, is definitely GNU make
2655                 # and prefer it over the system make.
2656                 echo "Substituting gmake for make."
2657                 make=$gmake
2658                 _make=$gmake
2659         fi
2660         ;;
2661 esac
2662 case "$test" in
2663 test)
2664         echo "Hopefully test is built into your sh."
2665         ;;
2666 *)
2667         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2668                 echo "Using the test built into your sh."
2669                 test=test
2670                 _test=test
2671         fi
2672         ;;
2673 esac
2674 case "$echo" in
2675 echo)
2676         echo "Hopefully echo is built into your sh."
2677         ;;
2678 '') ;;
2679 *)
2680         echo " "
2681 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2682         $echo $n "hi there$c" >foo1
2683         echo $n "hi there$c" >foo2
2684         if cmp foo1 foo2 >/dev/null 2>&1; then
2685                 echo "They are compatible.  In fact, they may be identical."
2686         else
2687                 case "$n" in
2688                 '-n') n='' c='\c';;
2689                 *) n='-n' c='';;
2690                 esac
2691                 cat <<FOO
2692 They are not compatible!  You are probably running ksh on a non-USG system.
2693 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2694 have echo built in and we may have to run some Bourne shell scripts.  That
2695 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2696
2697 FOO
2698                 $echo $n "The star should be here-->$c"
2699                 $echo "*"
2700         fi
2701         $rm -f foo1 foo2
2702         ;;
2703 esac
2704
2705 # This question was auctioned at YAPC::Europe-2007 in Vienna
2706 # I never promised you could answer it. I only auctioned the question.
2707 cat <<FOO
2708 The following message is sponsored by
2709
2710   Dresden.pm<--The stars should be here.
2711
2712 Dear Perl user, system administrator or package
2713 maintainer, the Perl community sends greetings to
2714 you. Do you (emblematical) greet back [Y/n]? n
2715
2716 FOO
2717
2718 : Check what type of C compiler we use
2719 cat <<EOS >trygcc
2720 $startsh
2721 EOS
2722 cat <<'EOSC' >>trygcc
2723 case "$cc" in
2724 '') ;;
2725 *)  $rm -f try try.*
2726     $cat >try.c <<EOM
2727 int main(int argc, char *argv[]) {
2728   return 0;
2729 }
2730 EOM
2731     if $cc -o try $ccflags $ldflags try.c; then
2732        :
2733     else
2734         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2735         despair=yes
2736         trygcc=yes
2737         case "$cc" in
2738         *gcc*) trygcc=no ;;
2739         esac
2740         # Skip this test because it gives a false match on output like:
2741         #    ./trygcc: line 23: cc: command not found
2742         # case "`$cc -v -c try.c 2>&1`" in
2743         # *gcc*) trygcc=no ;;
2744         # esac
2745         if $test X"$trygcc" = Xyes; then
2746             if gcc -o try -c try.c; then
2747                 echo " "
2748                 echo "You seem to have a working gcc, though." >&4
2749                 # Switching compilers may undo the work of hints files.
2750                 # The most common problem is -D_REENTRANT for threads.
2751                 # This heuristic catches that case, but gets false positives
2752                 # if -Dusethreads was not actually specified.  Better to
2753                 # bail out here with a useful message than fail
2754                 # mysteriously later. Should we perhaps just try to
2755                 # re-invoke Configure -Dcc=gcc config_args ?
2756                 if $test -f usethreads.cbu; then
2757                         $cat >&4 <<EOM
2758
2759 *** However, any setting of the C compiler flags (e.g. for thread support)
2760 *** will be lost.  It may be necessary for you to restart Configure and
2761 *** add -Dcc=gcc to your Configure command line.
2762
2763 EOM
2764                         rp="Would you like to go ahead and try gcc anyway?"
2765                         dflt=n
2766                 else
2767                         rp="Would you like to use it?"
2768                         dflt=y
2769                 fi
2770                 if $test -f myread; then
2771                     . ./myread
2772                 else
2773                     if $test -f UU/myread; then
2774                         . ./UU/myread
2775                     else
2776                         echo "Cannot find myread, sorry.  Aborting." >&2
2777                         exit 1
2778                     fi
2779                 fi
2780                 case "$ans" in
2781                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2782                 esac
2783             fi
2784         fi
2785     fi
2786     $rm -f try try.*
2787     ;;
2788 esac
2789 EOSC
2790
2791 cat <<EOS >checkcc
2792 $startsh
2793 EOS
2794 cat <<'EOSC' >>checkcc
2795 case "$cc" in
2796 '') ;;
2797 *)  $rm -f try try.*
2798     $cat >try.c <<EOM
2799 int main(int argc, char *argv[]) {
2800   return 0;
2801 }
2802 EOM
2803     if $cc -o try $ccflags $ldflags try.c; then
2804        :
2805     else
2806         if $test X"$despair" = Xyes; then
2807            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2808         fi
2809         $cat >&4 <<EOM
2810 You need to find a working C compiler.
2811 Either (purchase and) install the C compiler supplied by your OS vendor,
2812 or for a free C compiler try http://gcc.gnu.org/
2813 I cannot continue any further, aborting.
2814 EOM
2815         exit 1
2816     fi
2817     $rm -f try try.*
2818     ;;
2819 esac
2820 EOSC
2821
2822 : determine whether symbolic links are supported
2823 echo " "
2824 $touch blurfl
2825 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2826         echo "Symbolic links are supported." >&4
2827         lns="$ln -s"
2828 else
2829         echo "Symbolic links are NOT supported." >&4
2830         lns="$ln"
2831 fi
2832 $rm -f blurfl sym
2833
2834 : determine whether symbolic links are supported
2835 echo " "
2836 case "$lns" in
2837 *"ln"*" -s")
2838         echo "Checking how to test for symbolic links..." >&4
2839         $lns blurfl sym
2840         if $test "X$issymlink" = X; then
2841                 case "$newsh" in
2842                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2843                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2844                 esac
2845                 if test $? = 0; then
2846                         issymlink="test -h"
2847                 else
2848                         echo "Your builtin 'test -h' may be broken." >&4
2849                         case "$test" in
2850                         /*)     ;;
2851                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2852                                 for p in $pth
2853                                 do
2854                                         if test -f "$p/$test"; then
2855                                                 test="$p/$test"
2856                                                 break
2857                                         fi
2858                                 done
2859                                 ;;
2860                         esac
2861                         case "$test" in
2862                         /*)
2863                                 echo "Trying external '$test -h'." >&4
2864                                 issymlink="$test -h"
2865                                 if $test ! -h sym >/dev/null 2>&1; then
2866                                         echo "External '$test -h' is broken, too." >&4
2867                                         issymlink=''
2868                                 fi
2869                                 ;;
2870                         *)      issymlink='' ;;
2871                         esac
2872                 fi
2873         fi
2874         if $test "X$issymlink" = X; then
2875                 if $test -L sym 2>/dev/null; then
2876                         issymlink="$test -L"
2877                         echo "The builtin '$test -L' worked." >&4
2878                 fi
2879         fi
2880         if $test "X$issymlink" != X; then
2881                 echo "You can test for symbolic links with '$issymlink'." >&4
2882         else
2883                 echo "I do not know how you can test for symbolic links." >&4
2884         fi
2885         $rm -f blurfl sym
2886         ;;
2887 *)      echo "No symbolic links, so not testing for their testing..." >&4
2888         ;;
2889 esac
2890
2891 : Make symlinks util
2892 case "$mksymlinks" in
2893 $define|true|[yY]*)
2894         case "$src" in
2895         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2896                 exit 1
2897                 ;;
2898         *)      case "$lns:$issymlink" in
2899                 *"ln"*" -s:"*"test -"?)
2900                         echo "Creating the symbolic links..." >&4
2901                         cd ..
2902                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2903                         awk 'NF == 1 {
2904                                 dir=".";
2905                                 file=$1 "";
2906                              }
2907                              NF == 2 {
2908                                 dir=$1 "";
2909                                 file=$2 "";
2910                              }
2911                              {
2912                                  print "# dir = ", dir, "file = ", file
2913                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2914                              } END {
2915                                  for (d in mf) {
2916                                      if (d != ".") { print("mkdir -p "d) }
2917                                      print("ln -sf "mf[d]" "d);
2918                                  }
2919                              }' source="$src" > UU/mksymlinks.$$
2920                         sh UU/mksymlinks.$$
2921                         rm UU/mksymlinks.$$
2922                         # Sanity check 1.
2923                         if test ! -d t/base; then
2924                                 echo "Failed to create the subdirectories.  Aborting." >&4
2925                                 exit 1
2926                         fi
2927                         # Sanity check 2.
2928                         if test ! -f t/base/lex.t; then
2929                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2930                                 exit 1
2931                         fi
2932                         if test ! -f win32/win32.c; then
2933                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2934                                 exit 1
2935                         fi
2936                         cd UU
2937                         ;;
2938                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2939                         ;;
2940                 esac
2941                 ;;
2942         esac
2943         ;;
2944 esac
2945
2946 : Check for Cross-Compilation
2947 if $test "X$targethost" = "X"; then
2948     targethost=""
2949 fi
2950 if $test "X$targetenv" = "X"; then
2951     targetenv=""
2952 fi
2953 case "$usecrosscompile" in
2954 $define|true|[yY]*)
2955         $echo "Cross-compiling..."
2956         croak=''
2957         case "$cc" in
2958         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2959             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2960             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2961             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2962             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2963             # leave out ld, choosing it is more complex
2964             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2965             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2966             # We are in a weird spot. Just before us, some values
2967             # were 'saved', to be restored after the hints are
2968             # run.  This means that the changes we made to ar,
2969             # nm and ranlib will get reverted.
2970             # To avoid that, we hijack the saving mechanism and
2971             # have it save our new values.
2972             for file in ar nm ranlib; do
2973                 eval xxx=\$$file
2974                 eval $file=$xxx$_exe
2975                 eval _$file=$xxx
2976             done
2977         ;;
2978         esac
2979         case "$targetarch" in
2980         '') echo "Targetarch not defined." >&4; croak=y ;;
2981         *)  echo "Using targetarch $targetarch." >&4 ;;
2982         esac
2983         case "$targethost" in
2984         '') echo "Targethost not defined." >&4; croak=n ;;
2985         *)  echo "Using targethost $targethost." >&4
2986         esac
2987         locincpth=' '
2988         loclibpth=' '
2989         case "$croak" in
2990         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2991         esac
2992     : compile a host miniperl and generate_uudmap, unless we got passed them
2993     if $test "X$hostperl" = X; then
2994       echo "Building host miniperl and generate_uudmap binaries" >&4
2995       before_host=`pwd`
2996       cd ..
2997       cd $src
2998       src=`pwd`
2999       rm -rf $src/host
3000       mkdir $src/host
3001       cd $src/host
3002       $src/Configure -des -Dusedevel -Dmksymlinks
3003       $make miniperl
3004       case "$hostgenerate" in
3005       '') $make generate_uudmap
3006           hostgenerate=$src/host/generate_uudmap
3007           ;;
3008        "$undef") hostgenerate=''
3009           ;;
3010       esac
3011       hostperl=$src/host/miniperl
3012       cd $before_host
3013     fi
3014     hostosname=`$hostperl -le 'print $^O'`
3015     ;;
3016 *)
3017     usecrosscompile="$undef"
3018     ;;
3019 esac
3020
3021 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3022 case "$targethost" in
3023     '') echo "Checking for cross-compile" >&4
3024     case "$usecrosscompile$multiarch" in
3025        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3026          if [ -f Makefile ]; then
3027            echo " "
3028            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3029          else
3030            echo "Configure done."
3031          fi
3032        exit 0
3033        ;;
3034      *) echo "No targethost for running compiler tests against defined, running locally" >&4
3035         run=''
3036         to=:
3037         from=:
3038         ;;
3039     esac
3040     ;;
3041     *) echo "Using targethost $targethost." >&4
3042         case "$src" in
3043         /*) run=$src/Cross/run
3044             targetmkdir=$src/Cross/mkdir
3045             to=$src/Cross/to
3046             from=$src/Cross/from
3047             ;;
3048         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3049             run=$pwd/Cross/run
3050             targetmkdir=$pwd/Cross/mkdir
3051             to=$pwd/Cross/to
3052             from=$pwd/Cross/from
3053             ;;
3054         esac
3055         case "$targetrun" in
3056         '') targetrun=ssh ;;
3057         esac
3058         case "$targetto" in
3059         '') targetto=scp ;;
3060         esac
3061         case "$targetfrom" in
3062         '') targetfrom=scp ;;
3063         esac
3064         run=$run-$targetrun
3065         to=$to-$targetto
3066         from=$from-$targetfrom
3067         case "$targetdir" in
3068         '')  targetdir=/tmp
3069              echo "Guessing targetdir $targetdir." >&4
3070              ;;
3071         esac
3072         case "$targetuser" in
3073         '')  targetuser=root
3074              echo "Guessing targetuser $targetuser." >&4
3075              ;;
3076         esac
3077         case "$targetport" in
3078         '')  targetport=22
3079              echo "Guessing targetport $targetport." >&4
3080              ;;
3081         esac
3082         case "$targetfrom" in
3083         scp)    q=-q ;;
3084         *)      q='' ;;
3085         esac
3086         case "$targetrun" in
3087         ssh|rsh)
3088             cat >$run <<EOF
3089 #!/bin/sh
3090 env=''
3091 case "\$1" in
3092 -cwd)
3093   shift
3094   cwd=\$1
3095   shift
3096   ;;
3097 esac
3098 case "\$1" in
3099 -env)
3100   shift
3101   env=\$1
3102   shift
3103   ;;
3104 esac
3105 case "\$cwd" in
3106 '') cwd=$targetdir ;;
3107 esac
3108 exe=\$1
3109 shift
3110 $to \$exe
3111 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3112 EOF
3113             ;;
3114         adb)
3115             $touch $run
3116             ;;
3117         *)  echo "Unknown targetrun '$targetrun'" >&4
3118             exit 1
3119             ;;
3120         esac
3121         case "$targetmkdir" in
3122         */Cross/mkdir)
3123             cat >$targetmkdir <<EOF
3124 #!/bin/sh
3125 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3126 EOF
3127             $chmod a+rx $targetmkdir
3128             ;;
3129         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3130             exit 1
3131             ;;
3132         esac
3133         case "$targetto" in
3134         scp|rcp)
3135             cat >$to <<EOF
3136 #!/bin/sh
3137 for f in \$@
3138 do
3139   case "\$f" in
3140   /*)
3141     $targetmkdir \`dirname \$f\`
3142     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3143     ;;
3144   *)
3145     $targetmkdir $targetdir/\`dirname \$f\`
3146     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3147     ;;
3148   esac
3149 done
3150 exit 0
3151 EOF
3152             ;;
3153         cp) cat >$to <<EOF
3154 #!/bin/sh
3155 for f in \$@
3156 do
3157   case "\$f" in
3158   /*)
3159     $mkdir -p $targetdir/\`dirname \$f\`
3160     $cp \$f $targetdir/\$f || exit 1
3161     ;;
3162   *)
3163     $targetmkdir $targetdir/\`dirname \$f\`
3164     $cp \$f $targetdir/\$f || exit 1
3165     ;;
3166   esac
3167 done
3168 exit 0
3169 EOF
3170             ;;
3171         *)  echo "Unknown targetto '$targetto'" >&4
3172             exit 1
3173             ;;
3174         esac
3175         case "$targetfrom" in
3176         scp|rcp)
3177           cat >$from <<EOF
3178 #!/bin/sh
3179 for f in \$@
3180 do
3181   $rm -f \$f
3182   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3183 done
3184 exit 0
3185 EOF
3186             ;;
3187         cp) cat >$from <<EOF
3188 #!/bin/sh
3189 for f in \$@
3190 do
3191   $rm -f \$f
3192   cp $targetdir/\$f . || exit 1
3193 done
3194 exit 0
3195 EOF
3196             ;;
3197         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3198             exit 1
3199             ;;
3200         esac
3201         if $test ! -f $run; then
3202             echo "Target 'run' script '$run' not found." >&4
3203         else
3204             $chmod a+rx $run
3205         fi
3206         if $test ! -f $to; then
3207             echo "Target 'to' script '$to' not found." >&4
3208         else
3209             $chmod a+rx $to
3210         fi
3211         if $test ! -f $from; then
3212             echo "Target 'from' script '$from' not found." >&4
3213         else
3214             $chmod a+rx $from
3215         fi
3216         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3217             exit 1
3218         fi
3219         cat >&4 <<EOF
3220 Using '$run' for remote execution,
3221 and '$from' and '$to'
3222 for remote file transfer.
3223 EOF
3224         ;;
3225 *)      run=''
3226         to=:
3227         from=:
3228         usecrosscompile="$undef"
3229         targetarch=''
3230         ;;
3231 esac
3232
3233 : see whether [:lower:] and [:upper:] are supported character classes
3234 echo " "
3235 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3236 ABYZ-abyz)
3237         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3238         up='[:upper:]'
3239         low='[:lower:]'
3240         ;;
3241 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3242         # (0xd9 and 0xe2), therefore that is a nice testing point.
3243         if test "X$up" = X -o "X$low" = X; then
3244             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3245             rs) up='[A-Z]'
3246                 low='[a-z]'
3247                 ;;
3248             esac
3249         fi
3250         if test "X$up" = X -o "X$low" = X; then
3251             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3252             rs) up='A-Z'
3253                 low='a-z'
3254                 ;;
3255             esac
3256         fi
3257         if test "X$up" = X -o "X$low" = X; then
3258             case "`echo RS | od -x 2>/dev/null`" in
3259             *D9E2*|*d9e2*)
3260                 echo "Hey, this might be EBCDIC." >&4
3261                 if test "X$up" = X -o "X$low" = X; then
3262                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3263                     rs) up='[A-IJ-RS-Z]'
3264                         low='[a-ij-rs-z]'
3265                         ;;
3266                     esac
3267                 fi
3268                 if test "X$up" = X -o "X$low" = X; then
3269                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3270                     rs) up='A-IJ-RS-Z'
3271                         low='a-ij-rs-z'
3272                         ;;
3273                     esac
3274                 fi
3275                 ;;
3276             esac
3277         fi
3278 esac
3279 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3280 rs)
3281     echo "Using $up and $low to convert case." >&4
3282     ;;
3283 *)
3284     echo "I don't know how to translate letters from upper to lower case." >&4
3285     echo "Your tr is not acting any way I know of." >&4
3286     exit 1
3287     ;;
3288 esac
3289 : set up the translation script tr, must be called with ./tr of course
3290 cat >tr <<EOSC
3291 $startsh
3292 case "\$1\$2" in
3293 '[A-Z][a-z]') exec $tr '$up' '$low';;
3294 '[a-z][A-Z]') exec $tr '$low' '$up';;
3295 esac
3296 exec $tr "\$@"
3297 EOSC
3298 chmod +x tr
3299 $eunicefix tr
3300
3301 : Try to determine whether config.sh was made on this system
3302 case "$config_sh" in
3303 '')
3304 myuname=`$uname -a 2>/dev/null`
3305 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3306 # Downcase everything to avoid ambiguity.
3307 # Remove slashes and single quotes so we can use parts of this in
3308 # directory and file names.
3309 # Remove newlines so myuname is sane to use elsewhere.
3310 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3311 # because the A-Z/a-z are not consecutive.
3312 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3313         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3314 newmyuname="$myuname"
3315 dflt=n
3316 case "$knowitall" in
3317 '')
3318         if test -f ../config.sh; then
3319                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3320                         eval "`grep myuname= ../config.sh`"
3321                 fi
3322                 if test "X$myuname" = "X$newmyuname"; then
3323                         dflt=y
3324                 fi
3325         fi
3326         ;;
3327 *) dflt=y;;
3328 esac
3329
3330 : Get old answers from old config file if Configure was run on the
3331 : same system, otherwise use the hints.
3332 hint=default
3333 cd ..
3334 if test -f config.sh; then
3335         echo " "
3336         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3337         . UU/myread
3338         case "$ans" in
3339         n*|N*) echo "OK, I'll ignore it."
3340                 mv config.sh config.sh.old
3341                 myuname="$newmyuname"
3342                 ;;
3343         *)  echo "Fetching default answers from your old config.sh file..." >&4
3344                 tmp_n="$n"
3345                 tmp_c="$c"
3346                 tmp_sh="$sh"
3347                 . ./config.sh
3348                 cp config.sh UU
3349                 n="$tmp_n"
3350                 c="$tmp_c"
3351                 : Older versions did not always set $sh.  Catch re-use of such
3352                 : an old config.sh.
3353                 case "$sh" in
3354                 '') sh="$tmp_sh" ;;
3355                 esac
3356                 hint=previous
3357                 ;;
3358         esac
3359 fi
3360 . ./UU/checkcc
3361 if test ! -f config.sh; then
3362         $cat <<EOM
3363
3364 First time through, eh?  I have some defaults handy for some systems
3365 that need some extra help getting the Configure answers right:
3366
3367 EOM
3368         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3369         dflt=''
3370         : Half the following guesses are probably wrong... If you have better
3371         : tests or hints, please send them to perlbug@perl.org
3372         : The metaconfig authors would also appreciate a copy...
3373         $test -f /irix && osname=irix
3374         $test -f /xenix && osname=sco_xenix
3375         $test -f /dynix && osname=dynix
3376         $test -f /dnix && osname=dnix
3377         $test -f /lynx.os && osname=lynxos
3378         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3379         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3380         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3381         $test -f /bin/mips && /bin/mips && osname=mips
3382         $test -d /usr/apollo/bin && osname=apollo
3383         $test -f /etc/saf/_sactab && osname=svr4
3384         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3385         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3386         $test -f /sys/utilities/MultiView && osname=amigaos
3387         if $test -d /MachTen -o -d /MachTen_Folder; then
3388                 osname=machten
3389                 if $test -x /sbin/version; then
3390                         osvers=`/sbin/version | $awk '{print $2}' |
3391                         $sed -e 's/[A-Za-z]$//'`
3392                 elif $test -x /usr/etc/version; then
3393                         osvers=`/usr/etc/version | $awk '{print $2}' |
3394                         $sed -e 's/[A-Za-z]$//'`
3395                 else
3396                         osvers="$2.$3"
3397                 fi
3398         fi
3399
3400         $test -f /sys/posix.dll &&
3401                 $test -f /usr/bin/what &&
3402                 set X `/usr/bin/what /sys/posix.dll` &&
3403                 $test "$3" = UWIN &&
3404                 osname=uwin &&
3405                 osvers="$5"
3406
3407         if $test -f $uname; then
3408                 set X $myuname
3409                 shift
3410
3411                 case "$5" in
3412                 fps*) osname=fps ;;
3413                 mips*)
3414                         case "$4" in
3415                         umips) osname=umips ;;
3416                         *) osname=mips ;;
3417                         esac;;
3418                 [23]100) osname=mips ;;
3419                 i386*)
3420                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3421                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3422                                 osname='sco'
3423                                 osvers=$tmp
3424                         elif $test -f /etc/kconfig; then
3425                                 osname=isc
3426                                 if test "$lns" = "$ln -s"; then
3427                                         osvers=4
3428                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3429                                         osvers=3
3430                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3431                                         osvers=2
3432                                 fi
3433                         fi
3434                         tmp=''
3435                         ;;
3436                 pc*)
3437                         if test -n "$DJGPP"; then
3438                                 osname=dos
3439                                 osvers=djgpp
3440                         fi
3441                         ;;
3442                 esac
3443
3444                 case "$1" in
3445                 aix) osname=aix
3446                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3447                         case "$tmp" in
3448                         # oslevel can fail with:
3449                         # oslevel: Unable to acquire lock.
3450                         *not\ found) osvers="$4"."$3" ;;
3451                         '<3240'|'<>3240') osvers=3.2.0 ;;
3452                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3453                         '=3250'|'>3250') osvers=3.2.5 ;;
3454                         *) osvers=$tmp;;
3455                         esac
3456                         ;;
3457                 bitrig) osname=bitrig
3458                         osvers="$3"
3459                         ;;
3460                 bsd386) osname=bsd386
3461                         osvers=`$uname -r`
3462                         ;;
3463                 cygwin*) osname=cygwin
3464                         osvers="$3"
3465                         ;;
3466                 *dc.osx) osname=dcosx
3467                         osvers="$3"
3468                         ;;
3469                 dnix) osname=dnix
3470                         osvers="$3"
3471                         ;;
3472                 domainos) osname=apollo
3473                         osvers="$3"
3474                         ;;
3475                 dgux)   osname=dgux
3476                         osvers="$3"
3477                         ;;
3478                 dragonfly) osname=dragonfly
3479                         osvers="$3"
3480                         ;;
3481                 dynixptx*) osname=dynixptx
3482                         osvers=`echo "$4"|sed 's/^v//'`
3483                         ;;
3484                 freebsd) osname=freebsd
3485                         osvers="$3" ;;
3486                 genix)  osname=genix ;;
3487                 gnu)    osname=gnu
3488                         osvers="$3" ;;
3489                 hp*)    osname=hpux
3490                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3491                         ;;
3492                 irix*)  osname=irix
3493                         case "$3" in
3494                         4*) osvers=4 ;;
3495                         5*) osvers=5 ;;
3496                         *)      osvers="$3" ;;
3497                         esac
3498                         ;;
3499                 linux)  osname=linux
3500                         case "$3" in
3501                         *)      osvers="$3" ;;
3502                         esac
3503                         $test -f /system/lib/libandroid.so && osname=linux-android
3504                         ;;
3505                 MiNT)   osname=mint
3506                         ;;
3507                 netbsd*) osname=netbsd
3508                         osvers="$3"
3509                         ;;
3510                 news-os) osvers="$3"
3511                         case "$3" in
3512                         4*) osname=newsos4 ;;
3513                         *) osname=newsos ;;
3514                         esac
3515                         ;;
3516                 nonstop-ux) osname=nonstopux ;;
3517                 openbsd) osname=openbsd
3518                         osvers="$3"
3519                         ;;
3520                 os2)    osname=os2
3521                         osvers="$4"
3522                         ;;
3523                 POSIX-BC | posix-bc ) osname=posix-bc
3524                         osvers="$3"
3525                         ;;
3526                 powerux | power_ux | powermax_os | powermaxos | \
3527                 powerunix | power_unix) osname=powerux
3528                         osvers="$3"
3529                         ;;
3530                 qnx) osname=qnx
3531                         osvers="$4"
3532                         ;;
3533                 solaris) osname=solaris
3534                         case "$3" in
3535                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3536                         *)      osvers="$3" ;;
3537                         esac
3538                         ;;
3539                 sunos) osname=sunos
3540                         case "$3" in
3541                         5*) osname=solaris
3542                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3543                         *)      osvers="$3" ;;
3544                         esac
3545                         ;;
3546                 titanos) osname=titanos
3547                         case "$3" in
3548                         1*) osvers=1 ;;
3549                         2*) osvers=2 ;;
3550                         3*) osvers=3 ;;
3551                         4*) osvers=4 ;;
3552                         *)      osvers="$3" ;;
3553                         esac
3554                         ;;
3555                 ultrix) osname=ultrix
3556                         osvers="$3"
3557                         ;;
3558                 osf1|mls+)      case "$5" in
3559                                 alpha)
3560                                         osname=dec_osf
3561                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3562                                         case "$osvers" in
3563                                         [1-9].[0-9]*) ;;
3564                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3565                                         esac
3566                                         ;;
3567                         hp*)    osname=hp_osf1  ;;
3568                         mips)   osname=mips_osf1 ;;
3569                         esac
3570                         ;;
3571                 # UnixWare 7.1.2 is known as Open UNIX 8
3572                 openunix|unixware) osname=svr5
3573                         osvers="$4"
3574                         ;;
3575                 uts)    osname=uts
3576                         osvers="$3"
3577                         ;;
3578                 vos) osvers="$3"
3579                         ;;
3580                 $2) case "$osname" in
3581                         *isc*) ;;
3582                         *freebsd*) ;;
3583                         svr*)
3584                                 : svr4.x or possibly later
3585                                 case "svr$3" in
3586                                 ${osname}*)
3587                                         osname=svr$3
3588                                         osvers=$4
3589                                         ;;
3590                                 esac
3591                                 case "$osname" in
3592                                 svr4.0)
3593                                         : Check for ESIX
3594                                         if test -f /stand/boot ; then
3595                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3596                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3597                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3598                                                         if test -n "$isesix"; then
3599                                                                 osname=esix4
3600                                                         fi
3601                                                 fi
3602                                         fi
3603                                         ;;
3604                                 esac
3605                                 ;;
3606                         *)      if test -f /etc/systemid; then
3607                                         osname=sco
3608                                         set `echo $3 | $sed 's/\./ /g'` $4
3609                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3610                                                 osvers=$1.$2.$3
3611                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3612                                                 osvers=$1.$2
3613                                         elif $test -f $src/hints/sco_$1.sh; then
3614                                                 osvers=$1
3615                                         fi
3616                                 else
3617                                         case "$osname" in
3618                                         '') : Still unknown.  Probably a generic Sys V.
3619                                                 osname="sysv"
3620                                                 osvers="$3"
3621                                                 ;;
3622                                         esac
3623                                 fi
3624                                 ;;
3625                         esac
3626                         ;;
3627                 *)      case "$osname" in
3628                         '') : Still unknown.  Probably a generic BSD.
3629                                 osname="$1"
3630                                 osvers="$3"
3631                                 ;;
3632                         esac
3633                         ;;
3634                 esac
3635         else
3636                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3637                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3638                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3639                                 osname=news_os
3640                         fi
3641                         $rm -f UU/kernel.what
3642                 elif test -d c:/. -o -n "$is_os2" ; then
3643                         set X $myuname
3644                         osname=os2
3645                         osvers="$5"
3646                 fi
3647         fi
3648
3649         case "$targetarch" in
3650         '') ;;
3651         *)  hostarch=$osname
3652             case "$targetarch" in
3653                 nto*|*-nto-*)
3654                     # Will load qnx.sh, which should change osname to nto
3655                     osname=qnx
3656                     osvers=''
3657                     ;;
3658                 *linux-android*)
3659                     # Catch arm-linux-androideabi, mipsel-linux-android,
3660                     # and i686-linux-android
3661                     osname=linux-android
3662                     osvers=''
3663                     ;;
3664                 *linux*)
3665                     # Something like arm-linux-gnueabihf is really just
3666                     # plain linux.
3667                     osname=linux
3668                     osvers=''
3669                     ;;
3670                 *solaris*|*sunos*)
3671                     osname=solaris
3672                     # XXX perhaps we should just assume
3673                     # osvers to be 2, or maybe take the value
3674                     # from targetarch. Using $run before the
3675                     # hints are run is somewhat icky.
3676                     set X `$run $uname -a 2>/dev/null`
3677                     shift
3678                     case "$3" in
3679                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3680                         *)  osvers="$3" ;;
3681                     esac
3682                     ;;
3683                 *)
3684                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3685                     osvers=''
3686                 ;;
3687             esac
3688             ;;
3689         esac
3690
3691         : Now look for a hint file osname_osvers, unless one has been
3692         : specified already.
3693         case "$hintfile" in
3694         ''|' ')
3695                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3696                 : Also try without trailing minor version numbers.
3697                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3698                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3699                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3700                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3701                 case "$file" in
3702                 '') dflt=none ;;
3703                 *)  case "$osvers" in
3704                         '') dflt=$file
3705                                 ;;
3706                         *)  if $test -f $src/hints/$file.sh ; then
3707                                         dflt=$file
3708                                 elif $test -f $src/hints/$xfile.sh ; then
3709                                         dflt=$xfile
3710                                 elif $test -f $src/hints/$xxfile.sh ; then
3711                                         dflt=$xxfile
3712                                 elif $test -f $src/hints/$xxxfile.sh ; then
3713                                         dflt=$xxxfile
3714                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3715                                         dflt=$xxxxfile
3716                                 elif $test -f "$src/hints/${osname}.sh" ; then
3717                                         dflt="${osname}"
3718                                 else
3719                                         dflt=none
3720                                 fi
3721                                 ;;
3722                         esac
3723                         ;;
3724                 esac
3725                 if $test -f Policy.sh ; then
3726                         case "$dflt" in
3727                         *Policy*) ;;
3728                         none) dflt="Policy" ;;
3729                         *) dflt="Policy $dflt" ;;
3730                         esac
3731                 fi
3732                 ;;
3733         *)
3734                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3735                 ;;
3736         esac
3737
3738         if $test -f Policy.sh ; then
3739                 $cat <<EOM
3740
3741 There's also a Policy hint file available, which should make the
3742 site-specific (policy) questions easier to answer.
3743 EOM
3744
3745         fi
3746
3747         $cat <<EOM
3748
3749 You may give one or more space-separated answers, or "none" if appropriate.
3750 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3751 previous run of Configure, you may specify it as well as or instead of
3752 OS-specific hints.  If hints are provided for your OS, you should use them:
3753 although Perl can probably be built without hints on many platforms, using
3754 hints often improve performance and may enable features that Configure can't
3755 set up on its own. If there are no hints that match your OS, specify "none";
3756 DO NOT give a wrong version or a wrong OS.
3757
3758 EOM
3759
3760         rp="Which of these apply, if any?"
3761         . UU/myread
3762         tans=$ans
3763         for file in $tans; do
3764                 if $test X$file = XPolicy -a -f Policy.sh; then
3765                         . Policy.sh
3766                         $cat Policy.sh >> UU/config.sh
3767                 elif $test -f $src/hints/$file.sh; then
3768                         . $src/hints/$file.sh
3769                         $cat $src/hints/$file.sh >> UU/config.sh
3770                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3771                         : nothing
3772                 else
3773                         : Give one chance to correct a possible typo.
3774                         echo "$file.sh does not exist"
3775                         dflt=$file
3776                         rp="hint to use instead?"
3777                         . UU/myread
3778                         for file in $ans; do
3779                                 if $test -f "$src/hints/$file.sh"; then
3780                                         . $src/hints/$file.sh
3781                                         $cat $src/hints/$file.sh >> UU/config.sh
3782                                 elif $test X$ans = X -o X$ans = Xnone ; then
3783                                         : nothing
3784                                 else
3785                                         echo "$file.sh does not exist -- ignored."
3786                                 fi
3787                         done
3788                 fi
3789         done
3790
3791         hint=recommended
3792         : Remember our hint file for later.
3793         if $test -f "$src/hints/$file.sh" ; then
3794                 hintfile="$file"
3795         else
3796                 hintfile=''
3797         fi
3798 fi
3799 cd UU
3800 ;;
3801 *)
3802         echo " "
3803         echo "Fetching default answers from $config_sh..." >&4
3804         tmp_n="$n"
3805         tmp_c="$c"
3806         cd ..
3807         cp $config_sh config.sh 2>/dev/null
3808         chmod +w config.sh
3809         . ./config.sh
3810         cd UU
3811         cp ../config.sh .
3812         n="$tmp_n"
3813         c="$tmp_c"
3814         hint=previous
3815         ;;
3816 esac
3817 . ./optdef.sh
3818
3819 : Restore computed paths
3820 for file in $loclist $trylist; do
3821         eval $file="\$_$file"
3822 done
3823
3824 cat << EOM
3825
3826 Configure uses the operating system name and version to set some defaults.
3827 The default value is probably right if the name rings a bell. Otherwise,
3828 since spelling matters for me, either accept the default or answer "none"
3829 to leave it blank.
3830
3831 EOM
3832 case "$osname" in
3833         ''|' ')
3834                 case "$hintfile" in
3835                 ''|' '|none) dflt=none ;;
3836                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3837                 esac
3838                 ;;
3839         *) dflt="$osname" ;;
3840 esac
3841 rp="Operating system name?"
3842 . ./myread
3843 case "$ans" in
3844 none)  osname='' ;;
3845 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3846 esac
3847 echo " "
3848 case "$osvers" in
3849         ''|' ')
3850                 case "$hintfile" in
3851                 ''|' '|none) dflt=none ;;
3852                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3853                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3854                         case "$dflt" in
3855                         ''|' ') dflt=none ;;
3856                         esac
3857                         ;;
3858                 esac
3859                 ;;
3860         *) dflt="$osvers" ;;
3861 esac
3862 rp="Operating system version?"
3863 . ./myread
3864 case "$ans" in
3865 none)  osvers='' ;;
3866 *) osvers="$ans" ;;
3867 esac
3868
3869
3870 . ./posthint.sh
3871
3872 : who configured the system
3873 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3874 case "$cf_by" in
3875 "")
3876         cf_by=`(logname) 2>/dev/null`
3877         case "$cf_by" in
3878         "")
3879                 cf_by=`(whoami) 2>/dev/null`
3880                 case "$cf_by" in
3881                 "") cf_by=unknown ;;
3882                 esac ;;
3883         esac ;;
3884 esac
3885
3886 : decide how portable to be.  Allow command line overrides.
3887 case "$d_portable" in
3888 "$undef") ;;
3889 *)      d_portable="$define" ;;
3890 esac
3891
3892 : set up shell script to do ~ expansion
3893 cat >filexp <<EOSS
3894 $startsh
3895 : expand filename
3896 case "\$1" in
3897  \~/*|\~)
3898         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3899         ;;
3900  \~*)
3901         if $test -f /bin/csh; then
3902                 /bin/csh -f -c "glob \$1"
3903                 failed=\$?
3904                 echo ""
3905                 exit \$failed
3906         else
3907                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3908                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3909                 if $test ! -d "\$dir"; then
3910                         me=\`basename \$0\`
3911                         echo "\$me: can't locate home directory for: \$name" >&2
3912                         exit 1
3913                 fi
3914                 case "\$1" in
3915                 */*)
3916                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3917                         ;;
3918                 *)
3919                         echo \$dir
3920                         ;;
3921                 esac
3922         fi
3923         ;;
3924 *)
3925         echo \$1
3926         ;;
3927 esac
3928 EOSS
3929 chmod +x filexp
3930 $eunicefix filexp
3931
3932 : now set up to get a file name
3933 cat <<EOS >getfile
3934 $startsh
3935 EOS
3936 cat <<'EOSC' >>getfile
3937 tilde=''
3938 fullpath=''
3939 already=''
3940 skip=''
3941 none_ok=''
3942 exp_file=''
3943 nopath_ok=''
3944 orig_rp="$rp"
3945 orig_dflt="$dflt"
3946 case "$gfpth" in
3947 '') gfpth='.' ;;
3948 esac
3949
3950 case "$fn" in
3951 *\(*)
3952         : getfile will accept an answer from the comma-separated list
3953         : enclosed in parentheses even if it does not meet other criteria.
3954         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3955         fn=`echo $fn | sed 's/(.*)//'`
3956         ;;
3957 esac
3958
3959 case "$fn" in
3960 *:*)
3961         loc_file=`expr $fn : '.*:\(.*\)'`
3962         fn=`expr $fn : '\(.*\):.*'`
3963         ;;
3964 esac
3965
3966 case "$fn" in
3967 *~*) tilde=true;;
3968 esac
3969 case "$fn" in
3970 */*) fullpath=true;;
3971 esac
3972 case "$fn" in
3973 *+*) skip=true;;
3974 esac
3975 case "$fn" in
3976 *n*) none_ok=true;;
3977 esac
3978 case "$fn" in
3979 *e*) exp_file=true;;
3980 esac
3981 case "$fn" in
3982 *p*) nopath_ok=true;;
3983 esac
3984
3985 case "$fn" in
3986 *f*) type='File';;
3987 *d*) type='Directory';;
3988 *l*) type='Locate';;
3989 esac
3990
3991 what="$type"
3992 case "$what" in
3993 Locate) what='File';;
3994 esac
3995
3996 case "$exp_file" in
3997 '')
3998         case "$d_portable" in
3999         "$define") ;;
4000         *) exp_file=true;;
4001         esac
4002         ;;
4003 esac
4004
4005 cd ..
4006 while test "$type"; do
4007         redo=''
4008         rp="$orig_rp"
4009         dflt="$orig_dflt"
4010         case "$tilde" in
4011         true) rp="$rp (~name ok)";;
4012         esac
4013         . UU/myread
4014         if test -f UU/getfile.ok && \
4015                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4016         then
4017                 value="$ans"
4018                 ansexp="$ans"
4019                 break
4020         fi
4021         case "$ans" in
4022         none)
4023                 value=''
4024                 ansexp=''
4025                 case "$none_ok" in
4026                 true) type='';;
4027                 esac
4028                 ;;
4029         *)
4030                 case "$tilde" in
4031                 '') value="$ans"
4032                         ansexp="$ans";;
4033                 *)
4034                         value=`UU/filexp $ans`
4035                         case $? in
4036                         0)
4037                                 if test "$ans" != "$value"; then
4038                                         echo "(That expands to $value on this system.)"
4039                                 fi
4040                                 ;;
4041                         *) value="$ans";;
4042                         esac
4043                         ansexp="$value"
4044                         case "$exp_file" in
4045                         '') value="$ans";;
4046                         esac
4047                         ;;
4048                 esac
4049                 case "$fullpath" in
4050                 true)
4051                         case "$ansexp" in
4052                         /*) value="$ansexp" ;;
4053                         [a-zA-Z]:/*) value="$ansexp" ;;
4054                         *)
4055                                 redo=true
4056                                 case "$already" in
4057                                 true)
4058                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4059                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4060                                         ;;
4061                                 *)
4062                                 echo "Please give a full path name, starting with slash." >&4
4063                                         case "$tilde" in
4064                                         true)
4065                                 echo "Note that using ~name is ok provided it expands well." >&4
4066                                                 already=true
4067                                                 ;;
4068                                         esac
4069                                 esac
4070                                 ;;
4071                         esac
4072                         ;;
4073                 esac
4074                 case "$redo" in
4075                 '')
4076                         case "$type" in
4077                         File)
4078                                 for fp in $gfpth; do
4079                                         if test "X$fp" = X.; then
4080                                             pf="$ansexp"
4081                                         else    
4082                                             pf="$fp/$ansexp"
4083                                         fi
4084                                         if test -f "$pf"; then
4085                                                 type=''
4086                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4087                                         then
4088                                                 echo "($value is not a plain file, but that's ok.)"
4089                                                 type=''
4090                                         fi
4091                                         if test X"$type" = X; then
4092                                             value="$pf"
4093                                             break
4094                                         fi
4095                                 done
4096                                 ;;
4097                         Directory)
4098                                 for fp in $gfpth; do
4099                                         if test "X$fp" = X.; then
4100                                             dir="$ans"
4101                                             direxp="$ansexp"
4102                                         else    
4103                                             dir="$fp/$ansexp"
4104                                             direxp="$fp/$ansexp"
4105                                         fi
4106                                         if test -d "$direxp"; then
4107                                                 type=''
4108                                                 value="$dir"
4109                                                 break
4110                                         fi
4111                                 done
4112                                 ;;
4113                         Locate)
4114                                 if test -d "$ansexp"; then
4115                                         echo "(Looking for $loc_file in directory $value.)"
4116                                         value="$value/$loc_file"
4117                                         ansexp="$ansexp/$loc_file"
4118                                 fi
4119                                 if test -f "$ansexp"; then
4120                                         type=''
4121                                 fi
4122                                 case "$nopath_ok" in
4123                                 true)   case "$value" in
4124                                         */*) ;;
4125                                         *)      echo "Assuming $value will be in people's path."
4126                                                 type=''
4127                                                 ;;
4128                                         esac
4129                                         ;;
4130                                 esac
4131                                 ;;
4132                         esac
4133
4134                         case "$skip" in
4135                         true) type='';
4136                         esac
4137
4138                         case "$type" in
4139                         '') ;;
4140                         *)
4141                                 if test "$fastread" = yes; then
4142                                         dflt=y
4143                                 else
4144                                         dflt=n
4145                                 fi
4146                                 rp="$what $value doesn't exist.  Use that name anyway?"
4147                                 . UU/myread
4148                                 dflt=''
4149                                 case "$ans" in
4150                                 y*) type='';;
4151                                 *) echo " ";;
4152                                 esac
4153                                 ;;
4154                         esac
4155                         ;;
4156                 esac
4157                 ;;
4158         esac
4159 done
4160 cd UU
4161 ans="$value"
4162 rp="$orig_rp"
4163 dflt="$orig_dflt"
4164 rm -f getfile.ok
4165 test "X$gfpthkeep" != Xy && gfpth=""
4166 EOSC
4167
4168 : determine root of directory hierarchy where package will be installed.
4169 case "$prefix" in
4170 '')
4171         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4172         ;;
4173 *?/)
4174         dflt=`echo "$prefix" | sed 's/.$//'`
4175         ;;
4176 *)
4177         dflt="$prefix"
4178         ;;
4179 esac
4180 $cat <<EOM
4181
4182 By default, $package will be installed in $dflt/bin, manual pages
4183 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4184 installation directories. Typically this is something like /usr/local.
4185 If you wish to have binaries under /usr/bin but other parts of the
4186 installation under /usr/local, that's ok: you will be prompted
4187 separately for each of the installation directories, the prefix being
4188 only used to set the defaults.
4189
4190 EOM
4191 fn=d~
4192 rp='Installation prefix to use?'
4193 . ./getfile
4194 oldprefix=''
4195 case "$prefix" in
4196 '') ;;
4197 *)
4198         case "$ans" in
4199         "$prefix") ;;
4200         *) oldprefix="$prefix";;
4201         esac
4202         ;;
4203 esac
4204 prefix="$ans"
4205 prefixexp="$ansexp"
4206
4207 : allow them to override the AFS root
4208 case "$afsroot" in
4209 '')     afsroot=/afs ;;
4210 *)      afsroot=$afsroot ;;
4211 esac
4212
4213 : is AFS running?
4214 echo " "
4215 case "$afs" in
4216 $define|true)   afs=true ;;
4217 $undef|false)   afs=false ;;
4218 *)      if $test -d $afsroot; then
4219                 afs=true
4220         else
4221                 afs=false
4222         fi
4223         ;;
4224 esac
4225 if $afs; then
4226         echo "AFS may be running... I'll be extra cautious then..." >&4
4227 else
4228         echo "AFS does not seem to be running..." >&4
4229 fi
4230
4231 : determine installation prefix for where package is to be installed.
4232 if $afs; then
4233 $cat <<EOM
4234
4235 Since you are running AFS, I need to distinguish the directory in which
4236 files will reside from the directory in which they are installed (and from
4237 which they are presumably copied to the former directory by occult means).
4238
4239 EOM
4240         case "$installprefix" in
4241         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4242         *) dflt="$installprefix";;
4243         esac
4244 else
4245 $cat <<EOM
4246
4247 In some special cases, particularly when building $package for distribution,
4248 it is convenient to distinguish the directory in which files should be
4249 installed from the directory ($prefix) in which they will
4250 eventually reside.  For most users, these two directories are the same.
4251
4252 EOM
4253         case "$installprefix" in
4254         '') dflt=$prefix ;;
4255         *) dflt=$installprefix;;
4256         esac
4257 fi
4258 fn=d~
4259 rp='What installation prefix should I use for installing files?'
4260 . ./getfile
4261 installprefix="$ans"
4262 installprefixexp="$ansexp"
4263
4264 : Perform the prefixexp/installprefixexp correction if necessary
4265 cat <<EOS >installprefix
4266 $startsh
4267 EOS
4268 cat <<'EOSC' >>installprefix
4269 : Change installation prefix, if necessary.
4270 if $test X"$prefix" != X"$installprefix"; then
4271     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4272 else
4273     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4274 fi
4275 EOSC
4276 chmod +x installprefix
4277 $eunicefix installprefix
4278
4279 : Set variables such as privlib and privlibexp from the output of ./getfile
4280 : performing the prefixexp/installprefixexp correction if necessary.
4281 cat <<EOS >setprefixvar
4282 $startsh
4283 EOS
4284 cat <<'EOSC' >>setprefixvar
4285 eval "${prefixvar}=\"\$ans\""
4286 eval "${prefixvar}exp=\"\$ansexp\""
4287 . ./installprefix
4288 EOSC
4289 chmod +x setprefixvar
4290 $eunicefix setprefixvar
4291
4292 : set up the script used to warn in case of inconsistency
4293 cat <<EOS >whoa
4294 $startsh
4295 EOS
4296 cat <<'EOSC' >>whoa
4297 dflt=y
4298 case "$hint" in
4299     recommended)
4300         case "$hintfile" in
4301         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4302                 ;;
4303         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4304                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4305                 ;;
4306         esac
4307         ;;
4308     *)  echo " "
4309         echo "*** WHOA THERE!!! ***" >&4
4310         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4311         ;;
4312 esac
4313 rp="    Keep the $hint value?"
4314 . ./myread
4315 case "$ans" in
4316 y) td=$was; tu=$was;;
4317 esac
4318 EOSC
4319
4320 : function used to set '$1' to '$val'
4321 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4322 case "$val$was" in
4323 $define$undef) . ./whoa; eval "$var=\$td";;
4324 $undef$define) . ./whoa; eval "$var=\$tu";;
4325 *) eval "$var=$val";;
4326 esac'
4327
4328 : get the patchlevel
4329 echo " "
4330 echo "Getting the current patchlevel..." >&4
4331 if $test -r $rsrc/patchlevel.h;then
4332         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4333         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4334         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4335         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4336         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4337         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4338         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4339 else
4340         revision=0
4341         patchlevel=0
4342         subversion=0
4343         api_revision=0
4344         api_version=0
4345         api_subversion=0
4346         perl_patchlevel=0
4347         $echo "(You do not have patchlevel.h.  Eek.)"
4348 fi
4349 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4350 version_patchlevel_string="version $patchlevel subversion $subversion"
4351 case "$perl_patchlevel" in
4352 0|'') ;;
4353 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4354     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4355     ;;
4356 esac
4357
4358 $echo "(You have $package $version_patchlevel_string.)"
4359
4360 case "$osname" in
4361 dos|vms)
4362         : XXX Should be a Configure test for double-dots in filenames.
4363         version=`echo $revision $patchlevel $subversion | \
4364                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4365         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4366                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4367         ;;
4368 *)
4369         version=`echo $revision $patchlevel $subversion | \
4370                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4371         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4372                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4373         ;;
4374 esac
4375 : Special case the 5.005_xx maintenance series, which used 5.005
4376 : without any subversion label as a subdirectory in $sitelib
4377 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4378         api_versionstring='5.005'
4379 fi
4380
4381 : Do we want threads support and if so, what type
4382 case "$usethreads" in
4383 $define|true|[yY]*)     dflt='y';;
4384 *)     # Catch case where user specified ithreads or 5005threads but
4385        # forgot -Dusethreads (A.D. 4/2002)
4386        case "$useithreads$use5005threads" in
4387        *$define*)       dflt='y';;
4388        *)               dflt='n';;
4389        esac
4390        ;;
4391 esac
4392 cat <<EOM
4393
4394 Perl can be built to offer a form of threading support on some systems
4395 To do so, Configure can be run with -Dusethreads.
4396
4397 Note that Perl built with threading support runs slightly slower
4398 and uses slightly more memory than plain Perl.
4399
4400 If this doesn't make any sense to you, just accept the default '$dflt'.
4401 EOM
4402 rp='Build a threading Perl?'
4403 . ./myread
4404 case "$ans" in
4405 y|Y)    val="$define" ;;
4406 *)      val="$undef" ;;
4407 esac
4408 set usethreads
4409 eval $setvar
4410
4411 if $test $patchlevel -lt 9; then
4412     case "$usethreads" in
4413     $define)
4414         : Default to ithreads unless overridden on command line or with
4415         : old config.sh
4416         dflt='y'
4417         case "$use5005threads" in
4418                 $define|true|[yY]*)
4419                         echo "5.005 threads are no longer supported"
4420                         exit 1
4421                 ;;
4422         esac
4423         case "$useithreads" in
4424                 $undef|false|[nN]*) dflt='n';;
4425         esac
4426         rp='Use the newer interpreter-based ithreads?'
4427         . ./myread
4428         case "$ans" in
4429         y|Y)    val="$define" ;;
4430         *)      val="$undef" ;;
4431         esac
4432         set useithreads
4433         eval $setvar
4434         : Now set use5005threads to the opposite value.
4435         case "$useithreads" in
4436         $define) val="$undef" ;;
4437         *) val="$define" ;;
4438         esac
4439         set use5005threads
4440         eval $setvar
4441         ;;
4442     *)
4443         useithreads="$undef"
4444         use5005threads="$undef"
4445         ;;
4446     esac
4447
4448     case "$useithreads$use5005threads" in
4449     "$define$define")
4450         $cat >&4 <<EOM
4451
4452 You cannot have both the ithreads and the 5.005 threads enabled
4453 at the same time.  Disabling the 5.005 threads since they are
4454 much less stable than the ithreads.
4455
4456 EOM
4457         use5005threads="$undef"
4458         ;;
4459     esac
4460
4461 else
4462 : perl-5.9.x and later
4463
4464     if test X"$usethreads" = "X$define"; then
4465         case "$use5005threads" in
4466             $define|true|[yY]*)
4467                 $cat >&4 <<EOM
4468
4469 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4470
4471 EOM
4472             ;;
4473         esac
4474     fi
4475
4476     use5005threads="$undef"
4477     useithreads="$usethreads"
4478 fi
4479
4480 case "$d_oldpthreads" in
4481 '')     : Configure tests would be welcome here.  For now, assume undef.
4482         val="$undef" ;;
4483 *)      val="$d_oldpthreads" ;;
4484 esac
4485 set d_oldpthreads
4486 eval $setvar
4487
4488
4489 : Look for a hint-file generated 'call-back-unit'.  If the
4490 : user has specified that a threading perl is to be built,
4491 : we may need to set or change some other defaults.
4492 if $test -f usethreads.cbu; then
4493     echo "Your platform has some specific hints regarding threaded builds, using them..."
4494     . ./usethreads.cbu
4495 else
4496     case "$usethreads" in
4497         "$define"|true|[yY]*)
4498                 $cat <<EOM
4499 (Your platform does not have any specific hints for threaded builds.
4500  Assuming POSIX threads, then.)
4501 EOM
4502         ;;
4503     esac
4504 fi
4505
4506 : Check if multiplicity is required
4507 cat <<EOM
4508
4509 Perl can be built so that multiple Perl interpreters can coexist
4510 within the same Perl executable.
4511 EOM
4512
4513 case "$useithreads" in
4514 $define)
4515         cat <<EOM
4516 This multiple interpreter support is required for interpreter-based threads.
4517 EOM
4518         val="$define"
4519         ;;
4520 *)      case "$usemultiplicity" in
4521         $define|true|[yY]*)     dflt='y';;
4522         *) dflt='n';;
4523         esac
4524         echo " "
4525         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4526         rp='Build Perl for multiplicity?'
4527         . ./myread
4528         case "$ans" in
4529         y|Y)    val="$define" ;;
4530         *)      val="$undef" ;;
4531         esac
4532         ;;
4533 esac
4534 set usemultiplicity
4535 eval $setvar
4536
4537 : Check if morebits is requested
4538 case "$usemorebits" in
4539 "$define"|true|[yY]*)
4540         use64bitint="$define"
4541         uselongdouble="$define"
4542         usemorebits="$define"
4543         ;;
4544 *)      usemorebits="$undef"
4545         ;;
4546 esac
4547
4548 : Determine the C compiler to be used
4549 echo " "
4550 case "$cc" in
4551 '') dflt=cc;;
4552 *) dflt="$cc";;
4553 esac
4554 rp="Use which C compiler?"
4555 . ./myread
4556 cc="$ans"
4557
4558 : See whether they have no cc but they do have gcc
4559 . ./trygcc
4560 if $test -f cc.cbu; then
4561     . ./cc.cbu
4562 fi
4563 . ./checkcc
4564
4565 : make some quick guesses about what we are up against
4566 echo " "
4567 $echo $n "Hmm...  $c"
4568 echo exit 1 >bsd
4569 echo exit 1 >usg
4570 echo exit 1 >v7
4571 echo exit 1 >osf1
4572 echo exit 1 >eunice
4573 echo exit 1 >xenix
4574 echo exit 1 >venix
4575 echo exit 1 >os2
4576 d_bsd="$undef"
4577 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4578 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4579 then
4580         echo "Looks kind of like an OSF/1 system, but we'll see..."
4581         echo exit 0 >osf1
4582 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4583         xxx=`./loc addbib blurfl $pth`
4584         if $test -f $xxx; then
4585         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4586                 echo exit 0 >bsd
4587                 echo exit 0 >usg
4588         else
4589                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4590                         echo "Looks kind of like an extended USG system, but we'll see..."
4591                 else
4592                         echo "Looks kind of like a USG system, but we'll see..."
4593                 fi
4594                 echo exit 0 >usg
4595         fi
4596 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4597         echo "Looks kind of like a BSD system, but we'll see..."
4598         d_bsd="$define"
4599         echo exit 0 >bsd
4600 else
4601         echo "Looks kind of like a Version 7 system, but we'll see..."
4602         echo exit 0 >v7
4603 fi
4604 case "$eunicefix" in
4605 *unixtovms*)
4606         $cat <<'EOI'
4607 There is, however, a strange, musty smell in the air that reminds me of
4608 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4609 EOI
4610         echo exit 0 >eunice
4611         d_eunice="$define"
4612 : it so happens the Eunice I know will not run shell scripts in Unix format
4613         ;;
4614 *)
4615         echo " "
4616         echo "Congratulations.  You aren't running Eunice."
4617         d_eunice="$undef"
4618         ;;
4619 esac
4620 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4621 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4622 : semicolon as a patch separator
4623 case "$p_" in
4624 :) ;;
4625 *)
4626         $cat <<'EOI'
4627 I have the feeling something is not exactly right, however...don't tell me...
4628 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4629 (Or you may be running DOS with DJGPP.)
4630 EOI
4631         echo exit 0 >os2
4632         ;;
4633 esac
4634 if test -f /xenix; then
4635         echo "Actually, this looks more like a XENIX system..."
4636         echo exit 0 >xenix
4637         d_xenix="$define"
4638 else
4639         echo " "
4640         echo "It's not Xenix..."
4641         d_xenix="$undef"
4642 fi
4643 chmod +x xenix
4644 $eunicefix xenix
4645 if test -f /venix; then
4646         echo "Actually, this looks more like a VENIX system..."
4647         echo exit 0 >venix
4648 else
4649         echo " "
4650         if ./xenix; then
4651                 : null
4652         else
4653                 echo "Nor is it Venix..."
4654         fi
4655 fi
4656 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4657 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4658 $rm -f foo
4659
4660 : Check if we are using GNU gcc and what its version is
4661 echo " "
4662 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4663 $cat >try.c <<EOM
4664 #include <stdio.h>
4665 int main() {
4666 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4667 #ifdef __VERSION__
4668         printf("%s\n", __VERSION__);
4669 #else
4670         printf("%s\n", "1");
4671 #endif
4672 #endif
4673         return(0);
4674 }
4675 EOM
4676 if $cc -o try $ccflags $ldflags try.c; then
4677         gccversion=`$run ./try`
4678         case "$gccversion" in
4679         '') echo "You are not using GNU cc." ;;
4680         *)  echo "You are using GNU cc $gccversion."
4681             ccname=gcc
4682             ;;
4683         esac
4684 else
4685         echo " "
4686         echo "*** WHOA THERE!!! ***" >&4
4687         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4688         case "$knowitall" in
4689         '')
4690         echo "    You'd better start hunting for one and let me know about it." >&4
4691                 exit 1
4692                 ;;
4693         esac
4694 fi
4695 $rm -f try try.*
4696 case "$gccversion" in
4697 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4698 esac
4699 case "$gccversion" in
4700 '') gccosandvers='' ;;
4701 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4702    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4703    gccshortvers=''
4704    case "$gccosandvers" in
4705    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4706    $osname$osvers) ;; # looking good
4707    $osname*) cat <<EOM >&4
4708
4709 *** WHOA THERE!!! ***
4710
4711     Your gcc has not been compiled for the exact release of
4712     your operating system ($gccosandvers versus $osname$osvers).
4713
4714     In general it is a good idea to keep gcc synchronized with
4715     the operating system because otherwise serious problems
4716     may ensue when trying to compile software, like Perl.
4717
4718     I'm trying to be optimistic here, though, and will continue.
4719     If later during the configuration and build icky compilation
4720     problems appear (headerfile conflicts being the most common
4721     manifestation), I suggest reinstalling the gcc to match
4722     your operating system release.
4723
4724 EOM
4725       ;;
4726    *) gccosandvers='' ;; # failed to parse, better be silent
4727    esac
4728    ;;
4729 esac
4730 case "$ccname" in
4731 '') ccname="$cc" ;;
4732 esac
4733
4734 # gcc 3.* complain about adding -Idirectories that they already know about,
4735 # so we will take those off from locincpth.
4736 case "$gccversion" in
4737 3*)
4738     echo "main(){}">try.c
4739     for incdir in $locincpth; do
4740        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4741              grep '^c[cp]p*[01]: warning: changing search order '`
4742        if test "X$warn" != X; then
4743            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4744        fi
4745     done
4746     $rm -f try try.*
4747 esac
4748
4749 # gcc 4.9 by default does some optimizations that break perl.
4750 # see ticket 121505.
4751 #
4752 # The -fwrapv disables those optimizations (and probably others,) so
4753 # for gcc 4.9 (and later, since the optimizations probably won't go
4754 # away), add -fwrapv unless the user requests -fno-wrapv, which
4755 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4756 # which turns the overflows -fwrapv ignores into runtime errors.
4757 case "$gccversion" in
4758 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4759     case "$ccflags" in
4760     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4761     *) ccflags="$ccflags -fwrapv" ;;
4762     esac
4763 esac
4764
4765 : What should the include directory be ?
4766 : Use sysroot if set, so findhdr looks in the right place.
4767 echo " "
4768 $echo $n "Hmm...  $c"
4769 dflt="$sysroot/usr/include"
4770 incpath=''
4771 mips_type=''
4772 if $test -f /bin/mips && /bin/mips; then
4773         echo "Looks like a MIPS system..."
4774         $cat >usr.c <<'EOCP'
4775 #ifdef SYSTYPE_BSD43
4776 /bsd43
4777 #endif
4778 EOCP
4779         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4780                 dflt='/bsd43/usr/include'
4781                 incpath='/bsd43'
4782                 mips_type='BSD 4.3'
4783         else
4784                 mips_type='System V'
4785         fi
4786         $rm -f usr.c usr.out
4787         echo "and you're compiling with the $mips_type compiler and libraries."
4788         xxx_prompt=y
4789         echo "exit 0" >mips
4790 else
4791         echo "Doesn't look like a MIPS system."
4792         xxx_prompt=n
4793         echo "exit 1" >mips
4794 fi
4795 chmod +x mips
4796 $eunicefix mips
4797 case "$usrinc" in
4798 '') ;;
4799 *) dflt="$usrinc";;
4800 esac
4801 case "$xxx_prompt" in
4802 y)      fn=d/
4803         echo " "
4804         rp='Where are the include files you want to use?'
4805         . ./getfile
4806         usrinc="$ans"
4807         ;;
4808 *)      usrinc="$dflt"
4809         ;;
4810 esac
4811
4812 : see how we invoke the C preprocessor
4813 echo " "
4814 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4815 cat <<'EOT' >testcpp.c
4816 #define ABC abc
4817 #define XYZ xyz
4818 ABC.XYZ
4819 EOT
4820 cd ..
4821 if test ! -f cppstdin; then
4822         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4823                 # AIX cc -E doesn't show the absolute headerfile
4824                 # locations but we'll cheat by using the -M flag.
4825                 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
4826         else
4827                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4828         fi
4829 else
4830         echo "Keeping your $hint cppstdin wrapper."
4831 fi
4832 chmod 755 cppstdin
4833 wrapper=`pwd`/cppstdin
4834 ok='false'
4835 cd UU
4836
4837 if $test "X$cppstdin" != "X" && \
4838         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4839         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4840 then
4841         echo "You used to use $cppstdin $cppminus so we'll use that again."
4842         case "$cpprun" in
4843         '') echo "But let's see if we can live without a wrapper..." ;;
4844         *)
4845                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4846                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4847                 then
4848                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4849                         ok='true'
4850                 else
4851                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4852                 fi
4853                 ;;
4854         esac
4855 else
4856         case "$cppstdin" in
4857         '') ;;
4858         *)
4859                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4860                 ;;
4861         esac
4862 fi
4863
4864 if $ok; then
4865         : nothing
4866 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4867         $cc -E <testcpp.c >testcpp.out 2>&1; \
4868         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4869         echo "Yup, it does."
4870         x_cpp="$cc $cppflags -E"
4871         x_minus='';
4872 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4873         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4874         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4875         echo "Yup, it does."
4876         x_cpp="$cc $cppflags -E"
4877         x_minus='-';
4878 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4879         $cc -P <testcpp.c >testcpp.out 2>&1; \
4880         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4881         echo "Yipee, that works!"
4882         x_cpp="$cc $cppflags -P"
4883         x_minus='';
4884 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4885         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4886         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4887         echo "At long last!"
4888         x_cpp="$cc $cppflags -P"
4889         x_minus='-';
4890 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4891         $cpp <testcpp.c >testcpp.out 2>&1; \
4892         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4893         echo "It works!"
4894         x_cpp="$cpp $cppflags"
4895         x_minus='';
4896 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4897         $cpp - <testcpp.c >testcpp.out 2>&1; \
4898         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4899         echo "Hooray, it works!  I was beginning to wonder."
4900         x_cpp="$cpp $cppflags"
4901         x_minus='-';
4902 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4903         $wrapper <testcpp.c >testcpp.out 2>&1; \
4904         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4905         x_cpp="$wrapper"
4906         x_minus=''
4907         echo "Eureka!"
4908 else
4909         dflt=''
4910         rp="No dice.  I can't find a C preprocessor.  Name one:"
4911         . ./myread
4912         x_cpp="$ans"
4913         x_minus=''
4914         $x_cpp <testcpp.c >testcpp.out 2>&1
4915         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4916                 echo "OK, that will do." >&4
4917         else
4918 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4919                 exit 1
4920         fi
4921 fi
4922
4923 case "$ok" in
4924 false)
4925         cppstdin="$x_cpp"
4926         cppminus="$x_minus"
4927         cpprun="$x_cpp"
4928         cpplast="$x_minus"
4929         set X $x_cpp
4930         shift
4931         case "$1" in
4932         "$cpp")
4933                 echo "Perhaps can we force $cc -E using a wrapper..."
4934                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4935                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4936                 then
4937                         echo "Yup, we can."
4938                         cppstdin="$wrapper"
4939                         cppminus='';
4940                 else
4941                         echo "Nope, we'll have to live without it..."
4942                 fi
4943                 ;;
4944         esac
4945         case "$cpprun" in
4946         "$wrapper")
4947                 cpprun=''
4948                 cpplast=''
4949                 ;;
4950         esac
4951         ;;
4952 esac
4953
4954 case "$cppstdin" in
4955 "$wrapper"|'cppstdin') ;;
4956 *) $rm -f $wrapper;;
4957 esac
4958 $rm -f testcpp.c testcpp.out
4959
4960 : Adjust cppfilter for path component separator
4961 case "$osname" in
4962 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4963 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4964 *)   cppfilter='' ;;
4965 esac
4966
4967 : Use gcc to determine libpth and incpth
4968 # If using gcc or clang, we can get better values for libpth, incpth
4969 # and usrinc directly from the compiler.
4970 # Note that ccname for clang is also gcc.
4971 case "$ccname" in
4972     gcc)
4973         $echo 'extern int foo;' > try.c
4974         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4975         shift
4976         if $test $# -gt 0; then
4977             incpth="$incpth $*"
4978             incpth="`$echo $incpth|$sed 's/^ //'`"
4979             for i in $*; do
4980                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4981                 if $test -d $j; then
4982                     libpth="$libpth $j"
4983                 fi
4984             done
4985             libpth="`$echo $libpth|$sed 's/^ //'`"
4986             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4987                 if $test -d $xxx; then
4988                     case " $libpth " in
4989                     *" $xxx "*) ;;
4990                     *) libpth="$libpth $xxx";;
4991                     esac
4992                 fi
4993             done
4994         fi
4995         $rm -f try.c
4996         case "$usrinc" in
4997         '') for i in $incpth; do
4998                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4999                     usrinc="$i"
5000                     break
5001                 fi
5002             done
5003             ;;
5004         esac
5005
5006         case "$usecrosscompile" in
5007         $define|true|[yY]*)
5008             case "$incpth" in
5009                 '') echo "Incpth not defined." >&4; croak=y ;;
5010                 *)  echo "Using incpth '$incpth'." >&4 ;;
5011             esac
5012             case "$libpth" in
5013                 '') echo "Libpth not defined." >&4; croak=y ;;
5014                 *)  echo "Using libpth '$libpth'." >&4 ;;
5015             esac
5016             case "$usrinc" in
5017                 '') echo "Usrinc not defined." >&4; croak=y ;;
5018                 *)  echo "Using usrinc $usrinc." >&4 ;;
5019             esac
5020             case "$croak" in
5021                 y)
5022                 if test "X$sysroot" = X; then
5023                     echo "Cannot continue, aborting." >&4; exit 1
5024                 else
5025                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5026                 fi
5027                 ;;
5028             esac
5029             ;;
5030         esac
5031     ;;
5032 esac
5033
5034 : Default value for incpth is just usrinc
5035 case "$incpth" in
5036 '') incpth="$usrinc";;
5037 esac
5038
5039 : Set private lib path
5040 case "$plibpth" in
5041 '') if ./mips; then
5042         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5043     fi;;
5044 esac
5045 case "$libpth" in
5046 ' ') dlist='';;
5047 '') dlist="$loclibpth $plibpth $glibpth";;
5048 *) dlist="$libpth";;
5049 esac
5050
5051 : Now check and see which directories actually exist, avoiding duplicates
5052 for xxx in $dlist
5053 do
5054     if $test -d $xxx; then
5055                 case " $libpth " in
5056                 *" $xxx "*) ;;
5057                 *) libpth="$libpth $xxx";;
5058                 esac
5059     fi
5060 done
5061 $cat <<'EOM'
5062
5063 Some systems have incompatible or broken versions of libraries.  Among
5064 the directories listed in the question below, please remove any you
5065 know not to be holding relevant libraries, and add any that are needed.
5066 Say "none" for none.
5067
5068 EOM
5069
5070 if test "X$sysroot" != X; then
5071     $cat <<EOM
5072 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5073
5074 EOM
5075 fi
5076
5077 case "$libpth" in
5078 '') dflt='none';;
5079 *)
5080         set X $libpth
5081         shift
5082         dflt=${1+"$@"}
5083         ;;
5084 esac
5085 rp="Directories to use for library searches?"
5086 . ./myread
5087 case "$ans" in
5088 none) libpth=' ';;
5089 *) libpth="$ans";;
5090 esac
5091
5092 : compute shared library extension
5093 case "$so" in
5094 '')
5095         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5096                 dflt='sl'
5097         else
5098                 dflt='so'
5099         fi
5100         ;;
5101 *) dflt="$so";;
5102 esac
5103 $cat <<EOM
5104
5105 On some systems, shared libraries may be available.  Answer 'none' if
5106 you want to suppress searching of shared libraries for the remainder
5107 of this configuration.
5108
5109 EOM
5110 rp='What is the file extension used for shared libraries?'
5111 . ./myread
5112 so="$ans"
5113
5114 : Does target system insist that shared library basenames are unique
5115 $cat << EOM
5116
5117 Some dynamic loaders assume that the *basename* of shared library filenames
5118 are globally unique.  We'll default this to undef as we assume your system
5119 is not this weird. Set to defined if you're on one of them.
5120
5121 EOM
5122
5123 dflt='n'
5124 rp='Make shared library basenames unique?'
5125 . ./myread
5126 case "$ans" in
5127 y|Y) val="$define" ;;
5128 *)   val="$undef"  ;;
5129 esac
5130 set d_libname_unique
5131 eval $setvar
5132
5133 : Define several unixisms.
5134 : Hints files or command line option can be used to override them.
5135 : The convoluted testing is in case hints files set either the old
5136 : or the new name.
5137 case "$_exe" in
5138 '')     case "$exe_ext" in
5139         '')     ;;
5140         *)      _exe="$exe_ext" ;;
5141         esac
5142         ;;
5143 esac
5144 case "$_a" in
5145 '')     case "$lib_ext" in
5146     '') _a='.a';;
5147         *)      _a="$lib_ext" ;;
5148         esac
5149         ;;
5150 esac
5151 case "$_o" in
5152 '') case "$obj_ext" in
5153         '')     _o='.o';;
5154         *)      _o="$obj_ext";;
5155         esac
5156         ;;
5157 esac
5158 case "$p_" in
5159 '') case "$path_sep" in
5160         '')     p_=':';;
5161         *)      p_="$path_sep";;
5162         esac
5163         ;;
5164 esac
5165 exe_ext=$_exe
5166 lib_ext=$_a
5167 obj_ext=$_o
5168 path_sep=$p_
5169
5170 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5171
5172 : Which makefile gets called first.  This is used by make depend.
5173 case "$firstmakefile" in
5174 '') firstmakefile='makefile';;
5175 esac
5176
5177 : Check is we will use socks
5178 case "$usesocks" in
5179 $define|true|[yY]*)     dflt='y';;
5180 *) dflt='n';;
5181 esac
5182 cat <<EOM
5183
5184 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5185 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5186 to use the PerlIO abstraction layer, this will be implicitly selected.
5187
5188 If this doesn't make any sense to you, just accept the default '$dflt'.
5189 EOM
5190 rp='Build Perl for SOCKS?'
5191 . ./myread
5192 case "$ans" in
5193 y|Y)    val="$define" ;;
5194 *)      val="$undef" ;;
5195 esac
5196 set usesocks
5197 eval $setvar
5198
5199 : Check for uselongdouble support
5200 case "$ccflags" in
5201 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5202 esac
5203
5204 case "$uselongdouble" in
5205 $define|true|[yY]*)     dflt='y';;
5206 *) dflt='n';;
5207 esac
5208 cat <<EOM
5209
5210 Perl can be built to take advantage of long doubles which
5211 (if available) may give more accuracy and range for floating point numbers.
5212
5213 If this doesn't make any sense to you, just accept the default '$dflt'.
5214 EOM
5215 rp='Try to use long doubles if available?'
5216 . ./myread
5217 case "$ans" in
5218 y|Y)    val="$define"   ;;
5219 *)      val="$undef"    ;;
5220 esac
5221 set uselongdouble
5222 eval $setvar
5223
5224 case "$uselongdouble" in
5225 true|[yY]*) uselongdouble="$define" ;;
5226 esac
5227
5228 : Look for a hint-file generated 'call-back-unit'.  If the
5229 : user has specified that long doubles should be used,
5230 : we may need to set or change some other defaults.
5231 if $test -f uselongdouble.cbu; then
5232     echo "Your platform has some specific hints regarding long doubles, using them..."
5233     . ./uselongdouble.cbu
5234 else
5235     case "$uselongdouble" in
5236         $define)
5237                 $cat <<EOM
5238 (Your platform does not have any specific hints for long doubles.)
5239 EOM
5240         ;;
5241     esac
5242 fi
5243
5244 : Check if quadmath is requested
5245 case "$usequadmath" in
5246 "$define"|true|[yY]*) usequadmath="$define" ;;
5247 *)                    usequadmath="$undef"  ;;
5248 esac
5249
5250 : Fail if both uselongdouble and usequadmath are requested
5251 case "$usequadmath:$uselongdouble" in
5252 define:define)
5253         $cat <<EOM >&4
5254
5255 *** You requested the use of the quadmath library and use
5256 *** of long doubles.
5257 ***
5258 *** Please select one or the other.
5259 EOM
5260         exit 1
5261         ;;
5262 esac
5263
5264 : Looking for optional libraries
5265 echo " "
5266 echo "Checking for optional libraries..." >&4
5267 case "$libs" in
5268 ' '|'') dflt='';;
5269 *) dflt="$libs";;
5270 esac
5271 case "$libswanted" in
5272 '') libswanted='c_s';;
5273 esac
5274 case "$usesocks" in
5275 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5276 esac
5277 case "$usecbacktrace" in
5278 "$define") libswanted="$libswanted bfd" ;;
5279 esac
5280 case "$usequadmath" in
5281 "$define") libswanted="$libswanted quadmath" ;;
5282 esac
5283 libsfound=''
5284 libsfiles=''
5285 libsdirs=''
5286 libspath=''
5287 for thisdir in $libpth $xlibpth; do
5288   test -d $thisdir && libspath="$libspath $thisdir"
5289 done
5290 for thislib in $libswanted; do
5291         for thisdir in $libspath; do
5292             xxx=''
5293             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5294                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5295                 $test -f "$xxx" && eval $libscheck
5296                 $test -f "$xxx" && libstyle=shared
5297                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5298                 $test -f "$xxx" && eval $libscheck
5299                 $test -f "$xxx" && libstyle=shared
5300             fi
5301             if test ! -f "$xxx"; then
5302                 xxx=$thisdir/lib$thislib.$so
5303                 $test -f "$xxx" && eval $libscheck
5304                 $test -f "$xxx" && libstyle=shared
5305             fi
5306             if test ! -f "$xxx"; then
5307                 xxx=$thisdir/lib$thislib$_a
5308                 $test -f "$xxx" && eval $libscheck
5309                 $test -f "$xxx" && libstyle=static
5310             fi
5311             if test ! -f "$xxx"; then
5312                 xxx=$thisdir/$thislib$_a
5313                 $test -f "$xxx" && eval $libscheck
5314                 $test -f "$xxx" && libstyle=static
5315             fi
5316             if test ! -f "$xxx"; then
5317                 xxx=$thisdir/lib${thislib}_s$_a
5318                 $test -f "$xxx" && eval $libscheck
5319                 $test -f "$xxx" && libstyle=static
5320                 $test -f "$xxx" && thislib=${thislib}_s
5321             fi
5322             if test ! -f "$xxx"; then
5323                 xxx=$thisdir/Slib$thislib$_a
5324                 $test -f "$xxx" && eval $libscheck
5325                 $test -f "$xxx" && libstyle=static
5326             fi
5327             if $test -f "$xxx"; then
5328                 case "$libstyle" in
5329                 shared) echo "Found -l$thislib (shared)." ;;
5330                 static) echo "Found -l$thislib." ;;
5331                 *)      echo "Found -l$thislib ($libstyle)." ;;
5332                 esac
5333                 case " $dflt " in
5334                 *"-l$thislib "*);;
5335                 *) dflt="$dflt -l$thislib"
5336                    libsfound="$libsfound $xxx"
5337                    yyy=`basename $xxx`
5338                    libsfiles="$libsfiles $yyy"
5339                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5340                    case " $libsdirs " in
5341                    *" $yyy "*) ;;
5342                    *) libsdirs="$libsdirs $yyy" ;;
5343                    esac
5344                    ;;
5345                 esac
5346                 break
5347             fi
5348         done
5349         if $test ! -f "$xxx"; then
5350             echo "No -l$thislib."
5351         fi
5352 done
5353 set X $dflt
5354 shift
5355 dflt="$*"
5356 case "$libs" in
5357 '') dflt="$dflt";;
5358 *) dflt="$libs";;
5359 esac
5360 case "$dflt" in
5361 ' '|'') dflt='none';;
5362 esac
5363
5364 $cat <<EOM
5365
5366 In order to compile $package on your machine, a number of libraries
5367 are usually needed.  Include any other special libraries here as well.
5368 Say "none" for none.  The default list is almost always right.
5369 EOM
5370
5371 echo " "
5372 rp="What libraries to use?"
5373 . ./myread
5374 case "$ans" in
5375 none) libs=' ';;
5376 *) libs="$ans";;
5377 esac
5378
5379 : determine optimization, if desired, or use for debug flag also
5380 case "$optimize" in
5381 ' '|$undef) dflt='none';;
5382 '') dflt='-O';;
5383 *) dflt="$optimize";;
5384 esac
5385 $cat <<EOH
5386
5387 By default, $package compiles with the -O flag to use the optimizer.
5388 Alternately, you might want to use the symbolic debugger, which uses
5389 the -g flag (on traditional Unix systems).  Either flag can be
5390 specified here.  To use neither flag, specify the word "none".
5391
5392 EOH
5393 rp="What optimizer/debugger flag should be used?"
5394 . ./myread
5395 optimize="$ans"
5396 case "$optimize" in
5397 'none') optimize=" ";;
5398 esac
5399
5400 : Check what DEBUGGING is required from the command line
5401 : -DEBUGGING      or -DDEBUGGING or
5402 : -DEBUGGING=both                       = -g + -DDEBUGGING
5403 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5404 : -DEBUGGING=none or -UDEBUGGING        =
5405 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5406 case "$EBUGGING" in
5407 '')     ;;
5408 *)      DEBUGGING=$EBUGGING ;;
5409 esac
5410
5411 case "$DEBUGGING" in
5412 -g|both|$define)
5413     case "$optimize" in
5414         *-g*) ;;
5415         *)    optimize="$optimize -g" ;;
5416     esac ;;
5417 none|$undef)
5418     case "$optimize" in
5419         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5420                 shift
5421                 optimize="$*"
5422                 ;;
5423     esac ;;
5424 esac
5425
5426 dflt=''
5427 case "$DEBUGGING" in
5428 both|$define) dflt='-DDEBUGGING'
5429 esac
5430
5431 : argument order is deliberate, as the flag will start with - which set could
5432 : think is an option
5433 checkccflag='check=$1; flag=$2; callback=$3;
5434 echo " ";
5435 echo "Checking if your compiler accepts $flag" 2>&1;
5436 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5437 echo "int main(void) { return 0; }" > gcctest.c;
5438 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5439     echo "Yes, it does." 2>&1;
5440     if $test -s gcctest.out ; then
5441         echo "But your platform does not like it:";
5442         cat gcctest.out;
5443     else
5444         case "$ccflags" in
5445         *$check*)
5446             echo "Leaving current flags $ccflags alone." 2>&1
5447             ;;
5448         *) dflt="$dflt $flag";
5449             eval $callback
5450             ;;
5451         esac
5452     fi
5453 else
5454     echo "Nope, it does not, but that is ok." 2>&1;
5455 fi
5456 '
5457
5458 : We will not override a previous value, but we might want to
5459 : augment a hint file
5460 case "$hint" in
5461 default|recommended)
5462         case "$gccversion" in
5463         1*) dflt="$dflt -fpcc-struct-return" ;;
5464         esac
5465         case "$optimize:$DEBUGGING" in
5466         *-g*:old) dflt="$dflt -DDEBUGGING";;
5467         esac
5468         case "$gccversion" in
5469         2*) if $test -d /etc/conf/kconfig.d &&
5470                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5471                 then
5472                         # Interactive Systems (ISC) POSIX mode.
5473                         dflt="$dflt -posix"
5474                 fi
5475                 ;;
5476         esac
5477         case "$gccversion" in
5478         1*) ;;
5479         2.[0-8]*) ;;
5480         ?*)     set strict-aliasing -fno-strict-aliasing
5481                 eval $checkccflag
5482                 ;;
5483         esac
5484         # For gcc, adding -pipe speeds up compilations for some, but apparently
5485         # some assemblers can't read from stdin.  (It also slows down compilations
5486         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5487         case "$gccversion" in
5488         ?*)     set pipe -pipe
5489                 eval $checkccflag
5490                 ;;
5491         esac
5492
5493         # on x86_64 (at least) we require an extra library (libssp) in the
5494         # link command line. This library is not named, so I infer that it is
5495         # an implementation detail that may change. Hence the safest approach
5496         # is to add the flag to the flags passed to the compiler at link time,
5497         # as that way the compiler can do the right implementation dependant
5498         # thing. (NWC)
5499         case "$osname" in
5500         amigaos) ;; # -fstack-protector builds but doesn't work
5501         *)      case "$gccversion" in
5502                 ?*)     set stack-protector-strong -fstack-protector-strong
5503                         eval $checkccflag
5504                         case "$dflt" in
5505                         *-fstack-protector-strong*) ;; # It got added.
5506                         *) # Try the plain/older -fstack-protector.
5507                            set stack-protector -fstack-protector
5508                            eval $checkccflag
5509                            ;;
5510                         esac
5511                         ;;
5512                 esac
5513                 ;;
5514         esac
5515         ;;
5516 esac
5517
5518 case "$mips_type" in
5519 *BSD*|'') inclwanted="$locincpth $usrinc";;
5520 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5521 esac
5522 for thisincl in $inclwanted; do
5523         if $test -d $thisincl; then
5524                 if $test x$thisincl != x$usrinc; then
5525                         case "$dflt" in
5526                         *" -I$thisincl "*);;
5527                         *) dflt="$dflt -I$thisincl ";;
5528                         esac
5529                 fi
5530         fi
5531 done
5532
5533 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5534         xxx=true;
5535 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5536         xxx=true;
5537 else
5538         xxx=false;
5539 fi;
5540 if $xxx; then
5541         case "$dflt" in
5542         *$2*);;
5543         *) dflt="$dflt -D$2";;
5544         esac;
5545 fi'
5546
5547 set signal.h LANGUAGE_C; eval $inctest
5548
5549 case "$usesocks" in
5550 $define)
5551         ccflags="$ccflags -DSOCKS"
5552         ;;
5553 esac
5554
5555 case "$hint" in
5556 default|recommended) dflt="$ccflags $dflt" ;;
5557 *) dflt="$ccflags";;
5558 esac
5559
5560 case "$dflt" in
5561 ''|' ') dflt=none;;
5562 esac
5563
5564 $cat <<EOH
5565
5566 Your C compiler may want other flags.  For this question you should include
5567 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5568 but you should NOT include libraries or ld flags like -lwhatever.  If you
5569 want $package to honor its debug switch, you should include -DDEBUGGING here.
5570 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5571
5572 To use no flags, specify the word "none".
5573
5574 EOH
5575 set X $dflt
5576 shift
5577 dflt=${1+"$@"}
5578 rp="Any additional cc flags?"
5579 . ./myread
5580 case "$ans" in
5581 none) ccflags='';;
5582 *) ccflags="$ans";;
5583 esac
5584
5585 : the following weeds options from ccflags that are of no interest to cpp
5586 case "$cppflags" in
5587 '') cppflags="$ccflags" ;;
5588 *)  set X $ccflags; shift
5589     case " $cppflags " in
5590     *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5591     *) cppflags="$cppflags $ccflags" ;;
5592     esac
5593     ;;
5594 esac
5595 case "$gccversion" in
5596 1*) cppflags="$cppflags -D__GNUC__"
5597 esac
5598 case "$mips_type" in
5599 '');;
5600 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5601 esac
5602 case "$cppflags" in
5603 '');;
5604 *)
5605         echo " "
5606         echo "Let me guess what the preprocessor flags are..." >&4
5607         set X $cppflags
5608         shift
5609         cppflags=''
5610         $cat >cpp.c <<'EOM'
5611 #define BLURFL foo
5612
5613 BLURFL xx LFRULB
5614 EOM
5615         previous=''
5616         for flag in $*
5617         do
5618                 case "$flag" in
5619                 -*) ftry="$flag";;
5620                 *) ftry="$previous $flag";;
5621                 esac
5622                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5623                         >cpp1.out 2>/dev/null && \
5624                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5625                         >cpp2.out 2>/dev/null && \
5626                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5627                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5628                 then
5629                         cppflags="$cppflags $ftry"
5630                         previous=''
5631                 else
5632                         previous="$flag"
5633                 fi
5634         done
5635         set X $cppflags
5636         shift
5637         cppflags=${1+"$@"}
5638         case "$cppflags" in
5639         *-*)  echo "They appear to be: $cppflags";;
5640         esac
5641         $rm -f cpp.c cpp?.out
5642         ;;
5643 esac
5644
5645 : flags used in final linking phase
5646 case "$ldflags" in
5647 '') if ./venix; then
5648                 dflt='-i -z'
5649         else
5650                 dflt=''
5651         fi
5652         case "$ccflags" in
5653         *-posix*) dflt="$dflt -posix" ;;
5654         esac
5655         ;;
5656 *) dflt="$ldflags";;
5657 esac
5658 # See note above about -fstack-protector
5659 case "$ccflags" in
5660 *-fstack-protector-strong*)
5661         case "$dflt" in
5662         *-fstack-protector-strong*) ;; # Don't add it again
5663         *) dflt="$dflt -fstack-protector-strong" ;;
5664         esac
5665         ;;
5666 *-fstack-protector*)
5667         case "$dflt" in
5668         *-fstack-protector*) ;; # Don't add it again
5669         *) dflt="$dflt -fstack-protector" ;;
5670         esac
5671         ;;
5672 esac
5673
5674 : Try to guess additional flags to pick up local libraries.
5675 for thislibdir in $libpth; do
5676         case " $loclibpth " in
5677         *" $thislibdir "*)
5678                 case "$dflt " in
5679                 *"-L$thislibdir "*) ;;
5680                 *)  dflt="$dflt -L$thislibdir" ;;
5681                 esac
5682                 ;;
5683         esac
5684 done
5685
5686 case "$dflt" in
5687 '') dflt='none' ;;
5688 esac
5689
5690 $cat <<EOH
5691
5692 Your C linker may need flags.  For this question you should
5693 include -L/whatever and any other flags used by the C linker, but you
5694 should NOT include libraries like -lwhatever.
5695
5696 Make sure you include the appropriate -L/path flags if your C linker
5697 does not normally search all of the directories you specified above,
5698 namely
5699         $libpth
5700 To use no flags, specify the word "none".
5701
5702 EOH
5703
5704 rp="Any additional ld flags (NOT including libraries)?"
5705 . ./myread
5706 case "$ans" in
5707 none) ldflags='';;
5708 *) ldflags="$ans";;
5709 esac
5710 rmlist="$rmlist pdp11"
5711
5712 : coherency check
5713 echo " "
5714 echo "Checking your choice of C compiler and flags for coherency..." >&4
5715 $cat > try.c <<'EOF'
5716 #include <stdio.h>
5717 int main() { printf("Ok\n"); return(0); }
5718 EOF
5719 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5720 shift
5721 $cat >try.msg <<'EOM'
5722 I've tried to compile and run the following simple program:
5723
5724 EOM
5725 $cat try.c >> try.msg
5726
5727 $cat >> try.msg <<EOM
5728
5729 I used the command:
5730
5731         $*
5732         $run ./try
5733
5734 and I got the following output:
5735
5736 EOM
5737 dflt=y
5738 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5739         if $sh -c "$run ./try " >>try.msg 2>&1; then
5740                 xxx=`$run ./try`
5741                 case "$xxx" in
5742                 "Ok") dflt=n ;;
5743                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5744                 esac
5745         else
5746                 echo "The program compiled OK, but exited with status $?." >>try.msg
5747                 rp="You have a problem.  Shall I abort Configure"
5748                 dflt=y
5749         fi
5750 else
5751         echo "I can't compile the test program." >>try.msg
5752         rp="You have a BIG problem.  Shall I abort Configure"
5753         dflt=y
5754 fi
5755 case "$dflt" in
5756 y)
5757         $cat try.msg >&4
5758         case "$knowitall" in
5759         '')
5760                 echo "(The supplied flags or libraries might be incorrect.)"
5761                 ;;
5762         *) dflt=n;;
5763         esac
5764         echo " "
5765         . ./myread
5766         case "$ans" in
5767         n*|N*) ;;
5768         *)      echo "Ok.  Stopping Configure." >&4
5769                 exit 1
5770                 ;;
5771         esac
5772         ;;
5773 n) echo "OK, that should do.";;
5774 esac
5775 $rm_try gcctest gcctest.out
5776
5777 : define a shorthand compile call
5778 compile='
5779 mc_file=$1;
5780 shift;
5781 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5782 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5783 exit 1;
5784 fi;
5785 esac;
5786 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5787 : define a shorthand compile call for compilations that should be ok.
5788 compile_ok='
5789 mc_file=$1;
5790 shift;
5791 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5792
5793 : stub, used only to satisfy other units
5794 i_stdlib='define'
5795
5796 : check for lengths of integral types
5797 echo " "
5798 case "$intsize" in
5799 '')
5800         echo "Checking to see how big your integers are..." >&4
5801         $cat >try.c <<EOCP
5802 #include <stdio.h>
5803 #$i_stdlib I_STDLIB
5804 #ifdef I_STDLIB
5805 #include <stdlib.h>
5806 #endif
5807 int main()
5808 {
5809         printf("intsize=%d;\n", (int)sizeof(int));
5810         printf("longsize=%d;\n", (int)sizeof(long));
5811         printf("shortsize=%d;\n", (int)sizeof(short));
5812         exit(0);
5813 }
5814 EOCP
5815         set try
5816         if eval $compile_ok && $run ./try > /dev/null; then
5817                 eval `$run ./try`
5818                 echo "Your integers are $intsize bytes long."
5819                 echo "Your long integers are $longsize bytes long."
5820                 echo "Your short integers are $shortsize bytes long."
5821         else
5822                 $cat >&4 <<EOM
5823 !
5824 Help! I can't compile and run the intsize test program: please enlighten me!
5825 (This is probably a misconfiguration in your system or libraries, and
5826 you really ought to fix it.  Still, I'll try anyway.)
5827 !
5828 EOM
5829                 dflt=4
5830                 rp="What is the size of an integer (in bytes)?"
5831                 . ./myread
5832                 intsize="$ans"
5833                 dflt=$intsize
5834                 rp="What is the size of a long integer (in bytes)?"
5835                 . ./myread
5836                 longsize="$ans"
5837                 dflt=2
5838                 rp="What is the size of a short integer (in bytes)?"
5839                 . ./myread
5840                 shortsize="$ans"
5841         fi
5842         ;;
5843 esac
5844 $rm_try
5845
5846 : check for long long
5847 echo " "
5848 echo "Checking to see if you have long long..." >&4
5849 echo 'int main() { long long x = 7; return 0; }' > try.c
5850 set try
5851 if eval $compile; then
5852         val="$define"
5853         echo "You have long long."
5854 else
5855         val="$undef"
5856         echo "You do not have long long."
5857 fi
5858 $rm_try
5859 set d_longlong
5860 eval $setvar
5861
5862 : check for length of long long
5863 case "${d_longlong}${longlongsize}" in
5864 $define)
5865         echo " "
5866         echo "Checking to see how big your long longs are..." >&4
5867         $cat >try.c <<'EOCP'
5868 #include <stdio.h>
5869 int main()
5870 {
5871     printf("%d\n", (int)sizeof(long long));
5872     return(0);
5873 }
5874 EOCP
5875         set try
5876         if eval $compile_ok; then
5877                 longlongsize=`$run ./try`
5878                 echo "Your long longs are $longlongsize bytes long."
5879         else
5880                 dflt='8'
5881                 echo " "
5882                 echo "(I can't seem to compile the test program.  Guessing...)"
5883                 rp="What is the size of a long long (in bytes)?"
5884                 . ./myread
5885                 longlongsize="$ans"
5886         fi
5887         if $test "X$longsize" = "X$longlongsize"; then
5888                 echo "(That isn't any different from an ordinary long.)"
5889         fi
5890         ;;
5891 esac
5892 $rm_try
5893
5894 : determine filename position in cpp output
5895 echo " "
5896 echo "Computing filename position in cpp output for #include directives..." >&4
5897 case "$osname" in
5898 amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5899 esac
5900 case "$fieldn" in
5901 '')
5902 case "$osname" in
5903 vos) testaccess=-e ;;
5904 *)   testaccess=-r ;;
5905 esac
5906 echo '#include <stdio.h>' > foo.c
5907 $cat >fieldn <<EOF
5908 $startsh
5909 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5910 $grep '^[       ]*#.*stdio\.h' | \
5911 while read cline; do
5912         pos=1
5913         set \$cline
5914         while $test \$# -gt 0; do
5915                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5916                         echo "\$pos"
5917                         exit 0
5918                 fi
5919                 shift
5920                 pos=\`expr \$pos + 1\`
5921         done
5922 done
5923 EOF
5924 chmod +x fieldn
5925 fieldn=`./fieldn`
5926 $rm -f foo.c fieldn
5927 ;;
5928 esac
5929 case $fieldn in
5930 '') pos='???';;
5931 1) pos=first;;
5932 2) pos=second;;
5933 3) pos=third;;
5934 *) pos="${fieldn}th";;
5935 esac
5936 echo "Your cpp writes the filename in the $pos field of the line."
5937
5938 : locate header file
5939 $cat >findhdr <<EOF
5940 $startsh
5941 wanted=\$1
5942 name=''
5943 for usrincdir in $incpth
5944 do
5945         if test -f \$usrincdir/\$wanted; then
5946                 echo "\$usrincdir/\$wanted"
5947                 exit 0
5948         fi
5949 done
5950 awkprg='{ print \$$fieldn }'
5951 echo "#include <\$wanted>" > foo\$\$.c
5952 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5953 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5954 while read cline; do
5955         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5956         case "\$name" in
5957         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5958         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5959         *) exit 2;;
5960         esac;
5961 done;
5962 #
5963 # status = 0: grep returned 0 lines, case statement not executed
5964 # status = 1: headerfile found
5965 # status = 2: while loop executed, no headerfile found
5966 #
5967 status=\$?
5968 $rm -f foo\$\$.c;
5969 if test \$status -eq 1; then
5970         exit 0;
5971 fi
5972 exit 1
5973 EOF
5974 chmod +x findhdr
5975
5976 : define an alternate in-header-list? function
5977 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5978 cont=true; xxf="echo \"<\$1> found.\" >&4";
5979 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5980 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5981 esac;
5982 case $# in 4) instead=instead;; *) instead="at last";; esac;
5983 while $test "$cont"; do
5984         xxx=`./findhdr $1`
5985         var=$2; eval "was=\$$2";
5986         if $test "$xxx" && $test -r "$xxx";
5987         then eval $xxf;
5988         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5989                 cont="";
5990         else eval $xxnf;
5991         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5992         set $yyy; shift; shift; yyy=$@;
5993         case $# in 0) cont="";;
5994         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5995                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5996         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5997                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5998         esac;
5999 done;
6000 while $test "$yyy";
6001 do set $yyy; var=$2; eval "was=\$$2";
6002         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
6003         set $yyy; shift; shift; yyy=$@;
6004 done'
6005
6006 : see if inttypes.h is available
6007 : we want a real compile instead of Inhdr because some systems
6008 : have an inttypes.h which includes non-existent headers
6009 echo " "
6010 $cat >try.c <<EOCP
6011 #include <inttypes.h>
6012 int main() {
6013         static int32_t foo32 = 0x12345678;
6014 }
6015 EOCP
6016 set try
6017 if eval $compile; then
6018         echo "<inttypes.h> found." >&4
6019         val="$define"
6020 else
6021         echo "<inttypes.h> NOT found." >&4
6022         val="$undef"
6023 fi
6024 $rm_try
6025 set i_inttypes
6026 eval $setvar
6027
6028 : check for int64_t
6029 echo " "
6030 echo "Checking to see if you have int64_t..." >&4
6031 $cat >try.c <<EOCP
6032 #include <sys/types.h>
6033 #$i_inttypes I_INTTYPES
6034 #ifdef I_INTTYPES
6035 #include <inttypes.h>
6036 #endif
6037 int main() { int64_t x = 7; }
6038 EOCP
6039 set try
6040 if eval $compile; then
6041         val="$define"
6042         echo "You have int64_t."
6043 else
6044         val="$undef"
6045         echo "You do not have int64_t."
6046 fi
6047 $rm_try
6048 set d_int64_t
6049 eval $setvar
6050
6051 : Check if 64bit ints have a quad type
6052 echo " "
6053 echo "Checking which 64-bit integer type we could use..." >&4
6054
6055 case "$intsize" in
6056 8) val=int
6057    set quadtype
6058    eval $setvar
6059    val='"unsigned int"'
6060    set uquadtype
6061    eval $setvar
6062    quadkind=1
6063    ;;
6064 *) case "$longsize" in
6065    8) val=long
6066       set quadtype
6067       eval $setvar
6068       val='"unsigned long"'
6069       set uquadtype
6070       eval $setvar
6071       quadkind=2
6072       ;;
6073    *) case "$d_longlong:$longlongsize" in
6074       define:8)
6075         val='"long long"'
6076         set quadtype
6077         eval $setvar
6078         val='"unsigned long long"'
6079         set uquadtype
6080         eval $setvar
6081         quadkind=3
6082         ;;
6083       *) case "$d_int64_t" in
6084          define)
6085            val=int64_t
6086            set quadtype
6087            eval $setvar
6088            val=uint64_t
6089            set uquadtype
6090            eval $setvar
6091            quadkind=4
6092            ;;
6093          esac
6094          ;;
6095       esac
6096       ;;
6097    esac
6098    ;;
6099 esac
6100
6101 case "$quadtype" in
6102 '')     echo "Alas, no 64-bit integer types in sight." >&4
6103         d_quad="$undef"
6104         ;;
6105 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6106         d_quad="$define"
6107         ;;
6108 esac
6109
6110 : Do we want 64bit support
6111 case "$uselonglong" in
6112 "$define"|true|[yY]*)
6113         cat <<EOM >&4
6114
6115 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6116 EOM
6117         use64bitint="$define"
6118         ;;
6119 esac
6120 case "$use64bits" in
6121 "$define"|true|[yY]*)
6122         cat <<EOM >&4
6123
6124 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6125 EOM
6126         use64bitint="$define"
6127         ;;
6128 esac
6129 case "$use64bitints" in
6130 "$define"|true|[yY]*)
6131         cat <<EOM >&4
6132
6133 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6134 EOM
6135         use64bitint="$define"
6136         ;;
6137 esac
6138 case "$use64bitsint" in
6139 "$define"|true|[yY]*)
6140         cat <<EOM >&4
6141
6142 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6143 EOM
6144         use64bitint="$define"
6145         ;;
6146 esac
6147 case "$uselonglongs" in
6148 "$define"|true|[yY]*)
6149         cat <<EOM >&4
6150
6151 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6152 EOM
6153         use64bitint="$define"
6154         ;;
6155 esac
6156 case "$use64bitsall" in
6157 "$define"|true|[yY]*)
6158         cat <<EOM >&4
6159
6160 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6161 EOM
6162         use64bitall="$define"
6163         ;;
6164 esac
6165
6166 case "$ccflags" in
6167 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6168 esac
6169 case "$use64bitall" in
6170 "$define"|true|[yY]*) use64bitint="$define" ;;
6171 esac
6172
6173 case "$longsize" in
6174 8) cat <<EOM
6175
6176 You have natively 64-bit long integers.
6177 EOM
6178    val="$define"
6179    ;;
6180 *) case "$use64bitint" in
6181    "$define"|true|[yY]*) dflt='y';;
6182    *) dflt='n';;
6183    esac
6184    case "$d_quad" in
6185    "$define") ;;
6186    *) dflt='n' ;;
6187    esac
6188    cat <<EOM
6189
6190 Perl can be built to take advantage of 64-bit integer types
6191 on some systems.  To do so, Configure can be run with -Duse64bitint.
6192 Choosing this option will most probably introduce binary incompatibilities.
6193
6194 If this doesn't make any sense to you, just accept the default '$dflt'.
6195 (The default has been chosen based on your configuration.)
6196 EOM
6197    rp='Try to use 64-bit integers, if available?'
6198    . ./myread
6199    case "$ans" in
6200    [yY]*) val="$define" ;;
6201    *)     val="$undef"  ;;
6202    esac
6203    ;;
6204 esac
6205 set use64bitint
6206 eval $setvar
6207
6208 case "$use64bitall" in
6209 "$define"|true|[yY]*) dflt='y' ;;
6210 *) case "$longsize" in
6211    8) dflt='y' ;;
6212    *) dflt='n' ;;
6213    esac
6214    ;;
6215 esac
6216 cat <<EOM
6217
6218 You may also choose to try maximal 64-bitness.  It means using as much
6219 64-bitness as possible on the platform.  This in turn means even more
6220 binary incompatibilities.  On the other hand, your platform may not
6221 have any more 64-bitness available than what you already have chosen.
6222
6223 If this doesn't make any sense to you, just accept the default '$dflt'.
6224 (The default has been chosen based on your configuration.)
6225 EOM
6226 rp='Try to use maximal 64-bit support, if available?'
6227 . ./myread
6228 case "$ans" in
6229 [yY]*) val="$define" ;;
6230 *)     val="$undef"  ;;
6231 esac
6232 set use64bitall
6233 eval $setvar
6234 case "$use64bitall" in
6235 "$define")
6236         case "$use64bitint" in
6237         "$undef")
6238                 cat <<EOM
6239
6240 Since you have chosen a maximally 64-bit build, I'm also turning on
6241 the use of 64-bit integers.
6242 EOM
6243                 use64bitint="$define" ;;
6244         esac
6245         ;;
6246 esac
6247
6248 : Look for a hint-file generated 'call-back-unit'.  If the
6249 : user has specified that a 64-bit perl is to be built,
6250 : we may need to set or change some other defaults.
6251 if $test -f use64bitint.cbu; then
6252         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6253         . ./use64bitint.cbu
6254 fi
6255 case "$use64bitint" in
6256 "$define"|true|[yY]*)
6257         : This test was common to all the OpenBSD forks, and seems harmless for
6258         : other platforms:
6259         echo " "
6260         echo "Checking if your C library has broken 64-bit functions..." >&4
6261         cat >try.c <<EOCP
6262 #include <stdio.h>
6263 typedef $uquadtype myULL;
6264 int main (void)
6265 {
6266     struct {
6267         double d;
6268         myULL  u;
6269     } *p, test[] = {
6270         {4294967303.15, 4294967303ULL},
6271         {4294967294.2,  4294967294ULL},
6272         {4294967295.7,  4294967295ULL},
6273         {0.0, 0ULL}
6274     };
6275     for (p = test; p->u; p++) {
6276         myULL x = (myULL)p->d;
6277         if (x != p->u) {
6278             printf("buggy\n");
6279             return 0;
6280         }
6281     }
6282     printf("ok\n");
6283     return 0;
6284 }
6285 EOCP
6286         set try
6287         if eval $compile_ok; then
6288             libcquad=`$run ./try`
6289             echo "Your C library's 64-bit functions are $libcquad."
6290         else
6291             echo "(I can't seem to compile the test program.)"
6292             echo "Assuming that your C library's 64-bit functions are ok."
6293             libcquad="ok"
6294         fi
6295         $rm_try
6296
6297         case "$libcquad" in
6298             buggy*)
6299                 cat >&4 <<EOM
6300
6301 *** You have a C library with broken 64-bit functions.
6302 *** 64-bit support does not work reliably in this configuration.
6303 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6304 *** Cannot continue, aborting.
6305
6306 EOM
6307                 exit 1
6308                 ;;
6309         esac
6310         case "$longsize" in
6311         4) case "$archname64" in
6312            '') archname64=64int ;;
6313            esac
6314            ;;
6315         esac
6316         ;;
6317 esac
6318
6319 : Look for a hint-file generated 'call-back-unit'.  If the
6320 : user has specified that a maximally 64-bit perl is to be built,
6321 : we may need to set or change some other defaults.
6322 if $test -f use64bitall.cbu; then
6323         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6324         . ./use64bitall.cbu
6325 fi
6326 case "$use64bitall" in
6327 "$define"|true|[yY]*)
6328         case "$longsize" in
6329         4) case "$archname64" in
6330            ''|64int) archname64=64all ;;
6331            esac
6332            ;;
6333         esac
6334         ;;
6335 esac
6336
6337 case "$d_quad:$use64bitint" in
6338 $undef:$define)
6339         cat >&4 <<EOF
6340
6341 *** You have chosen to use 64-bit integers,
6342 *** but none can be found.
6343 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6344 *** Cannot continue, aborting.
6345
6346 EOF
6347         exit 1
6348         ;;
6349 esac
6350
6351 : Check if we are using the GNU C library
6352 echo " "
6353 echo "Checking for GNU C Library..." >&4
6354 cat >try.c <<'EOCP'
6355 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6356    alone are insufficient to distinguish different versions, such as
6357    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6358    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6359 */
6360 #include <stdio.h>
6361 int main(void)
6362 {
6363 #ifdef __GLIBC__
6364 #   ifdef __GLIBC_MINOR__
6365 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6366 #           include <gnu/libc-version.h>
6367             printf("%s\n",  gnu_get_libc_version());
6368 #       else
6369             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6370 #       endif
6371 #   else
6372         printf("%d\n",  __GLIBC__);
6373 #   endif
6374     return 0;
6375 #else
6376     return 1;
6377 #endif
6378 }
6379 EOCP
6380 set try
6381 if eval $compile_ok && $run ./try > glibc.ver; then
6382         val="$define"
6383         gnulibc_version=`$cat glibc.ver`
6384         echo "You are using the GNU C Library version $gnulibc_version"
6385 else
6386         val="$undef"
6387         gnulibc_version=''
6388         echo "You are not using the GNU C Library"
6389 fi
6390 $rm_try glibc.ver
6391 set d_gnulibc
6392 eval $setvar
6393
6394 : see if nm is to be used to determine whether a symbol is defined or not
6395 case "$usenm" in
6396 '')
6397         dflt=''
6398         case "$d_gnulibc" in
6399         "$define")
6400                 echo " "
6401                 echo "nm probably won't work on the GNU C Library." >&4
6402                 dflt=n
6403                 ;;
6404         esac
6405         case "$dflt" in
6406         '')
6407                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6408                         echo " "
6409                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6410                         echo "'nm' won't be sufficient on this system." >&4
6411                         dflt=n
6412                 fi
6413                 ;;
6414         esac
6415         case "$dflt" in
6416         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6417                 if $test $dflt -gt 20; then
6418                         dflt=y
6419                 else
6420                         dflt=n
6421                 fi
6422                 ;;
6423         esac
6424         ;;
6425 *)
6426         case "$usenm" in
6427         true|$define) dflt=y;;
6428         *) dflt=n;;
6429         esac
6430         ;;
6431 esac
6432 $cat <<EOM
6433
6434 I can use $nm to extract the symbols from your C libraries. This
6435 is a time consuming task which may generate huge output on the disk (up
6436 to 3 megabytes) but that should make the symbols extraction faster. The
6437 alternative is to skip the 'nm' extraction part and to compile a small
6438 test program instead to determine whether each symbol is present. If
6439 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6440 this may be the best solution.
6441
6442 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6443
6444 EOM
6445 rp="Shall I use $nm to extract C symbols from the libraries?"
6446 . ./myread
6447 case "$ans" in
6448 [Nn]*) usenm=false;;
6449 *) usenm=true;;
6450 esac
6451
6452 runnm=$usenm
6453 case "$reuseval" in
6454 true) runnm=false;;
6455 esac
6456
6457 : nm options which may be necessary
6458 case "$nm_opt" in
6459 '') if $test -f /mach_boot; then
6460                 nm_opt=''       # Mach
6461         elif $test -d /usr/ccs/lib; then
6462                 nm_opt='-p'     # Solaris (and SunOS?)
6463         elif $test -f /dgux; then
6464                 nm_opt='-p'     # DG-UX
6465         elif $test -f /lib64/rld; then
6466                 nm_opt='-p'     # 64-bit Irix
6467         else
6468                 nm_opt=''
6469         fi;;
6470 esac
6471
6472 : nm options which may be necessary for shared libraries but illegal
6473 : for archive libraries.  Thank you, Linux.
6474 case "$nm_so_opt" in
6475 '')     case "$myuname" in
6476         *linux*|gnu*)
6477                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6478                         nm_so_opt='--dynamic'
6479                 fi
6480                 ;;
6481         esac
6482         ;;
6483 esac
6484
6485 : Figure out where the libc is located
6486 case "$runnm" in
6487 true)
6488 : get list of predefined functions in a handy place
6489 echo " "
6490 case "$libc" in
6491 '') libc=unknown
6492         case "$libs" in
6493         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6494         esac
6495         ;;
6496 esac
6497 case "$libs" in
6498 '') ;;
6499 *)  for thislib in $libs; do
6500         case "$thislib" in
6501         -lc|-lc_s)
6502                 : Handle C library specially below.
6503                 ;;
6504         -l*)
6505                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6506                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6507                         :
6508                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6509                         :
6510                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6511                         :
6512                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6513                         :
6514                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6515                         :
6516                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6517                         :
6518                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6519                         :
6520                 else
6521                         try=''
6522                 fi
6523                 libnames="$libnames $try"
6524                 ;;
6525         *) libnames="$libnames $thislib" ;;
6526         esac
6527         done
6528         ;;
6529 esac
6530 xxx=normal
6531 case "$libc" in
6532 unknown)
6533         set /lib/libc.$so
6534         for xxx in $libpth; do
6535                 $test -r $1 || set $xxx/libc.$so
6536                 : The messy sed command sorts on library version numbers.
6537                 $test -r $1 || \
6538                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6539                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6540                                 h
6541                                 s/[0-9][0-9]*/0000&/g
6542                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6543                                 G
6544                                 s/\n/ /' | \
6545                          $sort | $sed -e 's/^.* //'`
6546                 eval set \$$#
6547         done
6548         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6549         $test -r $1 || set $sysroot/lib/libsys_s$_a
6550         ;;
6551 *)
6552         set blurfl
6553         ;;
6554 esac
6555 if $test -r "$1"; then
6556         echo "Your (shared) C library seems to be in $1."
6557         libc="$1"
6558 elif $test -r /lib/libc && $test -r /lib/clib; then
6559         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6560         xxx=apollo
6561         libc='/lib/clib /lib/libc'
6562         if $test -r /lib/syslib; then
6563                 echo "(Your math library is in /lib/syslib.)"
6564                 libc="$libc /lib/syslib"
6565         fi
6566 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6567         echo "Your C library seems to be in $libc, as you said before."
6568 elif $test -r $incpath/usr/lib/libc$_a; then
6569         libc=$incpath/usr/lib/libc$_a;
6570         echo "Your C library seems to be in $libc.  That's fine."
6571 elif $test -r /lib/libc$_a; then
6572         libc=/lib/libc$_a;
6573         echo "Your C library seems to be in $libc.  You're normal."
6574 else
6575         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6576                 :
6577         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6578                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6579         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6580                 :
6581         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6582                 :
6583         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6584                 :
6585         else
6586                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6587         fi
6588         if $test -r "$tans"; then
6589                 echo "Your C library seems to be in $tans, of all places."
6590                 libc=$tans
6591         else
6592                 libc='blurfl'
6593         fi
6594 fi
6595 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6596         dflt="$libc"
6597         cat <<EOM
6598
6599 If the guess above is wrong (which it might be if you're using a strange
6600 compiler, or your machine supports multiple models), you can override it here.
6601
6602 EOM
6603 else
6604         dflt=''
6605         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6606         cat >&4 <<EOM
6607 I can't seem to find your C library.  I've looked in the following places:
6608
6609 EOM
6610         $sed 's/^/      /' libpath
6611         cat <<EOM
6612
6613 None of these seems to contain your C library. I need to get its name...
6614
6615 EOM
6616 fi
6617 fn=f
6618 rp='Where is your C library?'
6619 . ./getfile
6620 libc="$ans"
6621
6622 echo " "
6623 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6624 set X `cat libnames`
6625 shift
6626 xxx=files
6627 case $# in 1) xxx=file; esac
6628 echo "Extracting names from the following $xxx for later perusal:" >&4
6629 echo " "
6630 $sed 's/^/      /' libnames >&4
6631 echo " "
6632 $echo $n "This may take a while...$c" >&4
6633
6634 for file in $*; do
6635         case $file in
6636         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6637         *) $nm $nm_opt $file 2>/dev/null;;
6638         esac
6639 done >libc.tmp
6640
6641 $echo $n ".$c"
6642 $grep fprintf libc.tmp > libc.ptf
6643 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6644 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6645 xxx='[ADTSIWi]'
6646 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6647         eval $xscan;\
6648         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6649                 eval $xrun
6650 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6651         eval $xscan;\
6652         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6653                 eval $xrun
6654 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6655         eval $xscan;\
6656         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6657                 eval $xrun
6658 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6659         eval $xscan;\
6660         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6661                 eval $xrun
6662 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6663         eval $xscan;\
6664         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6665                 eval $xrun
6666 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6667         eval $xscan;\
6668         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6669                 eval $xrun
6670 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6671                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6672         eval $xscan;\
6673         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6674                 eval $xrun
6675 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6676         eval $xscan;\
6677         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6678                 eval $xrun
6679 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6680         eval $xscan;\
6681         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6682                 eval $xrun
6683 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6684         eval $xscan;\
6685         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6686                 eval $xrun
6687 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6688         eval $xscan;\
6689         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6690                 eval $xrun
6691 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6692         eval $xscan;\
6693         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6694                 eval $xrun
6695 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6696         eval $xscan;\
6697         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6698                 eval $xrun
6699 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6700         eval $xscan;\
6701         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6702                 eval $xrun
6703 else
6704         $nm -p $* 2>/dev/null >libc.tmp
6705         $grep fprintf libc.tmp > libc.ptf
6706         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6707                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6708         then
6709                 nm_opt='-p'
6710                 eval $xrun
6711         else
6712                 echo " "
6713                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6714                 com=''
6715                 if $ar t $libc > libc.tmp && \
6716                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6717                 then
6718                         for thisname in $libnames $libc; do
6719                                 $ar t $thisname >>libc.tmp
6720                         done
6721                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6722                         echo "Ok." >&4
6723                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6724                         for thisname in $libnames $libc; do
6725                                 $ar tv $thisname >>libc.tmp
6726                                 emximp -o tmp.imp $thisname \
6727                                     2>/dev/null && \
6728                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6729                                     < tmp.imp >>libc.tmp
6730                                 $rm -f tmp.imp
6731                         done
6732                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6733                         echo "Ok." >&4
6734                 else
6735                         echo "$ar didn't seem to work right." >&4
6736                         echo "Maybe this is a Cray...trying bld instead..." >&4
6737                         if  bld t $libc | \
6738                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6739                                 $test -s libc.list
6740                         then
6741                                 for thisname in $libnames; do
6742                                         bld t $libnames | \
6743                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6744                                         $ar t $thisname >>libc.tmp
6745                                 done
6746                                 echo "Ok." >&4
6747                         else
6748                                 echo "That didn't work either.  Giving up." >&4
6749                                 exit 1
6750                         fi
6751                 fi
6752         fi
6753 fi
6754 nm_extract="$com"
6755 case "$PASE" in
6756 define)
6757     echo " "
6758     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6759     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6760     ;;
6761 *)  if $test -f /lib/syscalls.exp; then
6762         echo " "
6763         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6764         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6765                 /lib/syscalls.exp >>libc.list
6766     fi
6767     ;;
6768 esac
6769 ;;
6770 esac
6771 $rm -f libnames libpath
6772
6773 : Check if we are using C++
6774 echo " "
6775 echo "Checking for C++..." >&4
6776 $cat >try.c <<'EOCP'
6777 #include <stdio.h>
6778 int main(void)
6779 {
6780 #ifdef __cplusplus
6781     return 0;
6782 #else
6783     return 1;
6784 #endif
6785 }
6786 EOCP
6787 set try
6788 if eval $compile_ok && $run ./try; then
6789         val="$define"
6790         echo "You are using a C++ compiler."
6791 else
6792         val="$undef"
6793         echo "You are not using a C++ compiler."
6794 fi
6795 $rm_try cplusplus$$
6796 set d_cplusplus
6797 eval $setvar
6798
6799 : is a C symbol defined?
6800 csym='tlook=$1;
6801 case "$3" in
6802 -v) tf=libc.tmp; tdc="";;
6803 -a) tf=libc.tmp; tdc="[]";;
6804 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6805 esac;
6806 case "$d_cplusplus" in
6807     $define)    extern_C="extern \"C\"" ;;
6808     *)          extern_C="extern"       ;;
6809 esac;
6810 tx=yes;
6811 case "$reuseval-$4" in
6812 true-) ;;
6813 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6814 esac;
6815 case "$tx" in
6816 yes)
6817         tval=false;
6818         if $test "$runnm" = true; then
6819                 if $contains $tlook $tf >/dev/null 2>&1; then
6820                         tval=true;
6821                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6822                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main(int argc, char **argv) { if(p() && p() != (void *)argv[0]) return(0); else return(1); }"> try.c;
6823                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6824                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6825                         $rm_try;
6826                 fi;
6827         else
6828                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main(int argc, char **argv) { if(p() && p() != (void *)argv[0]) return(0); else return(1); }"> try.c;
6829                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6830                 $rm_try;
6831         fi;
6832         ;;
6833 *)
6834         case "$tval" in
6835         $define) tval=true;;
6836         *) tval=false;;
6837         esac;
6838         ;;
6839 esac;
6840 eval "$2=$tval"'
6841
6842 : define an is-in-libc? function
6843 inlibc='echo " "; td=$define; tu=$undef;
6844 sym=$1; var=$2; eval "was=\$$2";
6845 tx=yes;
6846 case "$reuseval$was" in
6847 true) ;;
6848 true*) tx=no;;
6849 esac;
6850 case "$tx" in
6851 yes)
6852         set $sym tres -f;
6853         eval $csym;
6854         case "$tres" in
6855         true)
6856                 echo "$sym() found." >&4;
6857                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6858         *)
6859                 echo "$sym() NOT found." >&4;
6860                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6861         esac;;
6862 *)
6863         case "$was" in
6864         $define) echo "$sym() found." >&4;;
6865         *) echo "$sym() NOT found." >&4;;
6866         esac;;
6867 esac'
6868
6869 : check for length of double
6870 echo " "
6871 case "$doublesize" in
6872 '')
6873         echo "Checking to see how big your double precision numbers are..." >&4
6874         $cat >try.c <<EOCP
6875 #include <stdio.h>
6876 #$i_stdlib I_STDLIB
6877 #ifdef I_STDLIB
6878 #include <stdlib.h>
6879 #endif
6880 int main()
6881 {
6882     printf("%d\n", (int)sizeof(double));
6883     exit(0);
6884 }
6885 EOCP
6886         set try
6887         if eval $compile_ok; then
6888                 doublesize=`$run ./try`
6889                 echo "Your double is $doublesize bytes long."
6890         else
6891                 dflt='8'
6892                 echo "(I can't seem to compile the test program.  Guessing...)"
6893                 rp="What is the size of a double precision number (in bytes)?"
6894                 . ./myread
6895                 doublesize="$ans"
6896         fi
6897         ;;
6898 esac
6899 $rm_try
6900
6901 : see if this is a float.h system
6902 set float.h i_float
6903 eval $inhdr
6904
6905 : check for long doubles
6906 echo " "
6907 echo "Checking to see if you have long double..." >&4
6908 echo 'int main() { long double x = 7.0; }' > try.c
6909 set try
6910 if eval $compile; then
6911         val="$define"
6912         echo "You have long double."
6913 else
6914         val="$undef"
6915         echo "You do not have long double."
6916 fi
6917 $rm_try
6918 set d_longdbl
6919 eval $setvar
6920
6921 : see if ldexpl exists
6922 set ldexpl d_ldexpl
6923 eval $inlibc
6924
6925 : check for length of long double
6926 case "${d_longdbl}${longdblsize}" in
6927 $define)
6928         echo " "
6929         echo "Checking to see how big your long doubles are..." >&4
6930         $cat >try.c <<'EOCP'
6931 #include <stdio.h>
6932 int main()
6933 {
6934         printf("%d\n", sizeof(long double));
6935 }
6936 EOCP
6937         set try
6938         set try
6939         if eval $compile; then
6940                 longdblsize=`$run ./try`
6941                 echo "Your long doubles are $longdblsize bytes long."
6942         else
6943                 dflt='8'
6944                 echo " "
6945                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6946                 rp="What is the size of a long double (in bytes)?"
6947                 . ./myread
6948                 longdblsize="$ans"
6949         fi
6950         if $test "X$doublesize" = "X$longdblsize"; then
6951                 echo "That isn't any different from an ordinary double."
6952                 echo "I'll keep your setting anyway, but you may see some"
6953                 echo "harmless compilation warnings."
6954         fi
6955         ;;
6956 esac
6957 $rm_try
6958
6959 $echo "Checking the kind of long doubles you have..." >&4
6960 case "$d_longdbl" in
6961 define)
6962 $cat <<EOP >try.c
6963 #$i_float I_FLOAT
6964 #$i_stdlib I_STDLIB
6965 #define LONGDBLSIZE $longdblsize
6966 #define DOUBLESIZE $doublesize
6967 #ifdef I_FLOAT
6968 #include <float.h>
6969 #endif
6970 #ifdef I_STDLIB
6971 #include <stdlib.h>
6972 #endif
6973 #include <stdio.h>
6974 static const long double d = -0.1L;
6975 int main() {
6976   unsigned const char* b = (unsigned const char*)(&d);
6977 #if DOUBLESIZE == LONGDBLSIZE
6978   printf("0\n"); /* if it floats like double */
6979   exit(0);
6980 #endif
6981 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6982   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6983     /* IEEE 754 128-bit little-endian */
6984     printf("1\n");
6985     exit(0);
6986   }
6987   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6988     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6989     printf("2\n");
6990     exit(0);
6991   }
6992 #endif
6993 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6994  * while 64-bits platforms have it in 16 bytes.  The trailing bytes
6995  * cannot be trusted. */
6996 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6997   if (b[0] == 0xCD && b[9] == 0xBF) {
6998     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6999      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
7000      * Also known as "extended precision". */
7001     printf("3\n");
7002     exit(0);
7003   }
7004   if (b[0] == 0xBF && b[9] == 0xCD) {
7005     /* Is there ever big-endian 80-bit, really?
7006      *
7007      * The Motorola 68881 had another "extended precision" format:
7008      * sign:1 exp:15 zero:16 integer:1 mantissa:63
7009      * for total of 96 bits of bytes.  The zero bits were unused.
7010      * See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL" for more details.
7011      * If it ever becomes relevant, this format should be allocated
7012      * a new doublekind code since it's quite different from the Intel x87.
7013      */
7014     printf("4\n");
7015     exit(0);
7016   }
7017 #endif
7018 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
7019   /* software "double double", the 106 is 53+53.
7020    * but irix thinks it is 107. */
7021   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
7022     /* double double 128-bit fully little-endian,
7023      * little-endian doubles in little-endian order,
7024      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
7025     printf("5\n");
7026     exit(0);
7027   }
7028   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7029     /* double double 128-bit fully big-endian,
7030      * big-endian doubles in big-endian order,
7031      * e.g. PPC/Power and MIPS:
7032      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7033     printf("6\n");
7034     exit(0);
7035   }
7036   if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7037     /* double double 128-bit mixed endian.
7038      * little-endian doubles in big-endian order,
7039      * e.g. ppc64el,
7040      * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7041     printf("7\n");
7042     exit(0);
7043   }
7044   if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7045     /* double double 128-bit mixed endian,
7046      * big-endian doubles in little-endian order,
7047      * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7048     printf("8\n");
7049     exit(0);
7050   }
7051 #endif
7052 /* We are largely making this up because it may well be
7053  * that the VAX format H was never made available to C,
7054  * only to Fortran. */
7055 #if LONGDBLSIZE == 16 && defined(__vax__)
7056   if (b[0] == 0xFD && b[15] == 0x99) {
7057     /* VAX format H, PDP-11 mixed endian. */
7058     printf("9\n");
7059     exit(0);
7060   }
7061 #endif
7062   printf("-1\n"); /* unknown */
7063   exit(0);
7064 }
7065 EOP
7066 set try
7067 if eval $compile; then
7068     longdblkind=`$run ./try`
7069 else
7070     longdblkind=-1
7071 fi
7072 ;;
7073 *) longdblkind=0 ;;
7074 esac
7075 case "$longdblkind" in
7076 0) echo "Your long doubles are doubles." >&4 ;;
7077 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7078 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7079 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
7080 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
7081 5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >& 4 ;;
7082 6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >& 4 ;;
7083 7) echo "You have 128-bit mixed-endian double-double long doubles (64-bit LEs in BE)." >& 4 ;;
7084 8) echo "You have 128-bit mixed-endian double-double long doubles (64-bit BEs in LE)." >& 4 ;;
7085 9) echo "You have 128-bit PDP-style mixed-endian long doubles (VAX format H)." >& 4 ;;
7086 *) echo "Cannot figure out your long double." >&4 ;;
7087 esac
7088 d_long_double_style_ieee=$undef
7089 d_long_double_style_ieee_std=$undef
7090 d_long_double_style_ieee_extended=$undef
7091 d_long_double_style_ieee_doubledouble=$undef
7092 d_long_double_style_vax=$undef
7093 case "$longdblkind" in
7094 1|2|3|4|5|6|7|8) d_long_double_style_ieee=$define ;;
7095 esac
7096 case "$longdblkind" in
7097 1|2) d_long_double_style_ieee_std=$define ;;
7098 esac
7099 case "$longdblkind" in
7100 3|4) d_long_double_style_ieee_extended=$define ;;
7101 esac
7102 case "$longdblkind" in
7103 5|6|7|8) d_long_double_style_ieee_doubledouble=$define ;;
7104 esac
7105 case "$longdblkind" in
7106 9) d_long_double_style_vax=$define ;;
7107 esac
7108 $rm_try
7109
7110 : determine the architecture name
7111 echo " "
7112 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7113         tarch=`arch`"-$osname"
7114 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7115         if uname -m > tmparch 2>&1 ; then
7116                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7117                         -e 's/$/'"-$osname/" tmparch`
7118         else
7119                 tarch="$osname"
7120         fi
7121         $rm -f tmparch
7122 else
7123         tarch="$osname"
7124 fi
7125 case "$myarchname" in
7126 ''|"$tarch") ;;
7127 *)
7128         echo "(Your architecture name used to be $myarchname.)"
7129         archname=''
7130         ;;
7131 esac
7132 case "$targetarch" in
7133 '') ;;
7134 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7135 esac
7136 myarchname="$tarch"
7137 case "$archname" in
7138 '') dflt="$tarch";;
7139 *) dflt="$archname";;
7140 esac
7141 rp='What is your architecture name'
7142 . ./myread
7143 archname="$ans"
7144
7145 : optionally add API version to the architecture for versioned archlibs
7146 case "$useversionedarchname" in
7147 $define|true|[yY]*) dflt='y';;
7148 *)                  dflt='n';;
7149 esac
7150 rp='Add the Perl API version to your archname?'
7151 . ./myread
7152 case "$ans" in
7153 y|Y)    useversionedarchname="$define" ;;
7154 *)      useversionedarchname="$undef" ;;
7155 esac
7156 case "$useversionedarchname" in
7157 $define)
7158         case "$archname" in
7159         *-$api_versionstring)
7160                 echo "...and architecture name already has -$api_versionstring" >&4
7161                 ;;
7162         *)
7163                 archname="$archname-$api_versionstring"
7164                 echo "...setting architecture name to $archname." >&4
7165                 ;;
7166         esac
7167         ;;
7168 esac
7169
7170 case "$usethreads" in
7171 $define)
7172         echo "Threads selected." >&4
7173         case "$archname" in
7174         *-thread*) echo "...and architecture name already has -thread." >&4
7175                 ;;
7176         *)      archname="$archname-thread"
7177                 echo "...setting architecture name to $archname." >&4
7178                 ;;
7179         esac
7180         ;;
7181 esac
7182 case "$usemultiplicity" in
7183 $define)
7184         echo "Multiplicity selected." >&4
7185         case "$archname" in
7186         *-multi*) echo "...and architecture name already has -multi." >&4
7187                 ;;
7188         *)      archname="$archname-multi"
7189                 echo "...setting architecture name to $archname." >&4
7190                 ;;
7191         esac
7192         ;;
7193 esac
7194 case "$use64bitint$use64bitall" in
7195 *"$define"*)
7196         case "$archname64" in
7197         '')
7198                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7199                 ;;
7200         *)
7201                 case "$use64bitint" in
7202                 "$define") echo "64 bit integers selected." >&4 ;;
7203                 esac
7204                 case "$use64bitall" in
7205                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7206                 esac
7207                 case "$archname" in
7208                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7209                         ;;
7210                 *)      archname="$archname-$archname64"
7211                         echo "...setting architecture name to $archname." >&4
7212                         ;;
7213                 esac
7214                 ;;
7215         esac
7216 esac
7217 case "$uselongdouble" in
7218 $define)
7219         echo "Long doubles selected." >&4
7220         case "$longdblsize" in
7221         $doublesize)
7222                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7223                 ;;
7224         *)
7225                 case "$archname" in
7226                 *-ld*) echo "...and architecture name already has -ld." >&4
7227                         ;;
7228                 *)      archname="$archname-ld"
7229                         echo "...setting architecture name to $archname." >&4
7230                         ;;
7231                 esac
7232                 ;;
7233         esac
7234         ;;
7235 esac
7236 case "$usequadmath" in
7237 $define)
7238         echo "quadmath selected." >&4
7239         case "$archname" in
7240         *-quadmath*) echo "...and architecture name already has -quadmath." >&4
7241                 ;;
7242         *)      archname="$archname-quadmath"
7243                 echo "...setting architecture name to $archname." >&4
7244                 ;;
7245         esac
7246         ;;
7247 esac
7248 if $test -f archname.cbu; then
7249         echo "Your platform has some specific hints for architecture name, using them..."
7250         . ./archname.cbu
7251 fi
7252
7253 : set the prefixit variable, to compute a suitable default value
7254 prefixit='case "$3" in
7255 ""|none)
7256         case "$oldprefix" in
7257         "") eval "$1=\"\$$2\"";;
7258         *)
7259                 case "$3" in
7260                 "") eval "$1=";;
7261                 none)
7262                         eval "tp=\"\$$2\"";
7263                         case "$tp" in
7264                         ""|" ") eval "$1=\"\$$2\"";;
7265                         *) eval "$1=";;
7266                         esac;;
7267                 esac;;
7268         esac;;
7269 *)
7270         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7271         case "$tp" in
7272         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7273         /*-$oldprefix/*|\~*-$oldprefix/*)
7274                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7275         *) eval "$1=\"\$$2\"";;
7276         esac;;
7277 esac'
7278
7279 : determine installation style
7280 : For now, try to deduce it from prefix unless it is already set.
7281 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7282 case "$installstyle" in
7283 '')     case "$prefix" in
7284                 *perl*) dflt='lib';;
7285                 *) dflt='lib/perl5' ;;
7286         esac
7287         ;;
7288 *)      dflt="$installstyle" ;;
7289 esac
7290 : Probably not worth prompting for this since we prompt for all
7291 : the directories individually, and the prompt would be too long and
7292 : confusing anyway.
7293 installstyle=$dflt
7294
7295 : determine where public executables go
7296 echo " "
7297 set dflt bin bin
7298 eval $prefixit
7299 fn=d~
7300 rp='Pathname where the public executables will reside?'
7301 . ./getfile
7302 if $test "X$ansexp" != "X$binexp"; then
7303         installbin=''
7304 fi
7305 prefixvar=bin
7306 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7307 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7308 :     this via initialinstalllocation
7309 . ./setprefixvar
7310
7311 case "$userelocatableinc" in
7312 $define|true|[yY]*)     dflt='y' ;;
7313 *)                      dflt='n' ;;
7314 esac
7315 cat <<EOM
7316
7317 Would you like to build Perl so that the installation is relocatable, so that
7318 library paths in @INC are determined relative to the path of the perl binary?
7319 This is not advised for system Perl installs, or if you need to run setid
7320 scripts or scripts under taint mode.
7321
7322 If this doesn't make any sense to you, just accept the default '$dflt'.
7323 EOM
7324 rp='Use relocatable @INC?'
7325 . ./myread
7326 case "$ans" in
7327 y|Y)    val="$define" ;;
7328 *)      val="$undef"  ;;
7329 esac
7330 set userelocatableinc
7331 eval $setvar
7332
7333 initialinstalllocation="$binexp"
7334 : Default prefix is now "up one level from where the binaries are"
7335 case "$userelocatableinc" in
7336 $define|true|[yY]*)
7337     bin=".../"
7338     binexp=".../"
7339     prefix=".../.."
7340     prefixexp=".../.."
7341     installprefixexp=".../.."
7342     ;;
7343 esac
7344
7345 : determine where private library files go
7346 : Usual default is /usr/local/lib/perl5/$version.
7347 : Also allow things like /opt/perl/lib/$version, since
7348 : /opt/perl/lib/perl5... would be redundant.
7349 : The default "style" setting is made in installstyle.U
7350 case "$installstyle" in
7351 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7352 *)       set dflt privlib lib/$version ;;
7353 esac
7354 eval $prefixit
7355 $cat <<EOM
7356
7357 There are some auxiliary files for $package that need to be put into a
7358 private library directory that is accessible by everyone.
7359
7360 EOM
7361 fn=$binexp
7362 fn=d~+
7363 rp='Pathname where the private library files will reside?'
7364 . ./getfile
7365 prefixvar=privlib
7366 . ./setprefixvar
7367
7368 : set the prefixup variable, to restore leading tilda escape
7369 prefixup='case "$prefixexp" in
7370 "$prefix") ;;
7371 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7372 esac'
7373
7374 : determine where public architecture dependent libraries go
7375 set archlib archlib
7376 eval $prefixit
7377 : privlib default is /usr/local/lib/$package/$version
7378 : archlib default is /usr/local/lib/$package/$version/$archname
7379 : privlib may have an optional trailing /share.
7380 tdflt=`echo $privlib | $sed 's,/share$,,'`
7381 tdflt=$tdflt/$archname
7382 case "$archlib" in
7383 '')     dflt=$tdflt
7384         ;;
7385 *)      dflt="$archlib"
7386     ;;
7387 esac
7388 $cat <<EOM
7389
7390 $spackage contains architecture-dependent library files.  If you are
7391 sharing libraries in a heterogeneous environment, you might store
7392 these files in a separate location.  Otherwise, you can just include
7393 them with the rest of the public library files.
7394
7395 EOM
7396 fn=$binexp
7397 fn=d+~
7398 rp='Where do you want to put the public architecture-dependent libraries?'
7399 . ./getfile
7400 prefixvar=archlib
7401 . ./setprefixvar
7402 if $test X"$archlib" = X"$privlib"; then
7403         d_archlib="$undef"
7404 else
7405         d_archlib="$define"
7406 fi
7407
7408 : see if setuid scripts can be secure
7409 $cat <<EOM
7410
7411 Some kernels have a bug that prevents setuid #! scripts from being
7412 secure.  Some sites have disabled setuid #! scripts because of this.
7413
7414 First let's decide if your kernel supports secure setuid #! scripts.
7415 (If setuid #! scripts would be secure but have been disabled anyway,
7416 don't say that they are secure if asked.)
7417
7418 EOM
7419
7420 val="$undef"
7421 if $test -d /dev/fd; then
7422         echo "#!$ls" >reflect
7423         chmod +x,u+s reflect
7424         ./reflect >flect 2>&1
7425         if $contains "/dev/fd" flect >/dev/null; then
7426                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7427                 val="$define"
7428         else
7429                 $cat <<EOM
7430 If you are not sure if they are secure, I can check but I'll need a
7431 username and password different from the one you are using right now.
7432 If you don't have such a username or don't want me to test, simply
7433 enter 'none'.
7434
7435 EOM
7436                 rp='Other username to test security of setuid scripts with?'
7437                 dflt='none'
7438                 . ./myread
7439                 case "$ans" in
7440                 n|none)
7441                         case "$d_suidsafe" in
7442                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7443                                 dflt=n;;
7444                         "$undef")
7445                                 echo "Well, the $hint value is *not* secure." >&4
7446                                 dflt=n;;
7447                         *)      echo "Well, the $hint value *is* secure." >&4
7448                                 dflt=y;;
7449                         esac
7450                         ;;
7451                 *)
7452                         $rm -f reflect flect
7453                         echo "#!$ls" >reflect
7454                         chmod +x,u+s reflect
7455                         echo >flect
7456                         chmod a+w flect
7457                         echo '"su" will (probably) prompt you for '"$ans's password."
7458                         su $ans -c './reflect >flect'
7459                         if $contains "/dev/fd" flect >/dev/null; then
7460                                 echo "Okay, it looks like setuid scripts are secure." >&4
7461                                 dflt=y
7462                         else
7463                                 echo "I don't think setuid scripts are secure." >&4
7464                                 dflt=n
7465                         fi
7466                         ;;
7467                 esac
7468                 rp='Does your kernel have *secure* setuid scripts?'
7469                 . ./myread
7470                 case "$ans" in
7471                 [yY]*)  val="$define";;
7472                 *)      val="$undef";;
7473                 esac
7474         fi
7475 else
7476         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7477         echo "(That's for file descriptors, not floppy disks.)"
7478         val="$undef"
7479 fi
7480 set d_suidsafe
7481 eval $setvar
7482
7483 $rm -f reflect flect
7484
7485 : now see if they want to do setuid emulation
7486 if $test $patchlevel -lt 11; then
7487 echo " "
7488 val="$undef"
7489 case "$d_suidsafe" in
7490 "$define")
7491         val="$undef"
7492         echo "No need to emulate SUID scripts since they are secure here." >&4
7493         ;;
7494 *)
7495         $cat <<EOM
7496 Some systems have disabled setuid scripts, especially systems where
7497 setuid scripts cannot be secure.  On systems where setuid scripts have
7498 been disabled, the setuid/setgid bits on scripts are currently
7499 useless.  It is possible for $package to detect those bits and emulate
7500 setuid/setgid in a secure fashion.  This emulation will only work if
7501 setuid scripts have been disabled in your kernel.
7502
7503 EOM
7504         case "$d_dosuid" in
7505         "$define") dflt=y ;;
7506         *) dflt=n ;;
7507         esac
7508         rp="Do you want to do setuid/setgid emulation?"
7509         . ./myread
7510         case "$ans" in
7511         [yY]*)  val="$define";;
7512         *)      val="$undef";;
7513         esac
7514         ;;
7515 esac
7516 set d_dosuid
7517 eval $setvar
7518 else
7519     case "$d_dosuid" in
7520         "$define")
7521         cat >&4 <<EOH
7522
7523 SUID emulation has been removed for 5.12
7524 Please re-run Configure without -Dd_dosuid
7525
7526 EOH
7527         exit 1;
7528         ;;
7529     esac
7530     d_dosuid=undef
7531 fi
7532
7533 : Find perl5.005 or later.
7534 echo "Looking for a previously installed perl5.005 or later... "
7535 case "$perl5" in
7536 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7537                 : Check if this perl is recent and can load a simple module
7538                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7539                         perl5=$tdir/perl
7540                         break;
7541                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7542                         perl5=$tdir/perl5
7543                         break;
7544                 fi
7545         done
7546         ;;
7547 *)      perl5="$perl5"
7548         ;;
7549 esac
7550 case "$perl5" in
7551 '')     echo "None found.  That's ok.";;
7552 *)      echo "Using $perl5." ;;
7553 esac
7554
7555 : Set the siteprefix variables
7556 $cat <<EOM
7557
7558 After $package is installed, you may wish to install various
7559 add-on modules and utilities.  Typically, these add-ons will
7560 be installed under $prefix with the rest
7561 of this package.  However, you may wish to install such add-ons
7562 elsewhere under a different prefix.
7563
7564 If you do not wish to put everything under a single prefix, that's
7565 ok.  You will be prompted for the individual locations; this siteprefix
7566 is only used to suggest the defaults.
7567
7568 The default should be fine for most people.
7569
7570 EOM
7571 fn=d~+
7572 rp='Installation prefix to use for add-on modules and utilities?'
7573 : XXX Here might be another good place for an installstyle setting.
7574 case "$siteprefix" in
7575 '') dflt=$prefix ;;
7576 *)  dflt=$siteprefix ;;
7577 esac
7578 . ./getfile
7579 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7580 oldsiteprefix=''
7581 case "$siteprefix" in
7582 '') ;;
7583 *)      case "$ans" in
7584         "$prefix") ;;
7585         *) oldsiteprefix="$prefix";;
7586         esac
7587         ;;
7588 esac
7589 siteprefix="$ans"
7590 siteprefixexp="$ansexp"
7591
7592 : determine where site specific libraries go.
7593 : Usual default is /usr/local/lib/perl5/site_perl/$version
7594 : The default "style" setting is made in installstyle.U
7595 : XXX No longer works with Prefixit stuff.
7596 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7597 case "$sitelib" in
7598 '') case "$installstyle" in
7599         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7600         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7601         esac
7602         ;;
7603 *)      dflt="$sitelib"
7604         ;;
7605 esac
7606 $cat <<EOM
7607
7608 The installation process will create a directory for
7609 site-specific extensions and modules.  Most users find it convenient
7610 to place all site-specific files in this directory rather than in the
7611 main distribution directory.
7612
7613 EOM
7614 fn=d~+
7615 rp='Pathname for the site-specific library files?'
7616 . ./getfile
7617 prefixvar=sitelib
7618 . ./setprefixvar
7619 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7620
7621 : Determine list of previous versions to include in @INC
7622 $cat > getverlist <<EOPL
7623 #!$perl5 -w
7624 use File::Basename;
7625 \$api_versionstring = "$api_versionstring";
7626 \$version = "$version";
7627 \$stem = "$sitelib_stem";
7628 \$archname = "$archname";
7629 EOPL
7630         $cat >> getverlist <<'EOPL'
7631 # The list found is store twice for each entry: the original name, and
7632 # the binary broken down version as pack "sss", so sorting is easy and
7633 # unambiguous. This will work for all versions that have a maximum of
7634 # three digit groups, separate by '.'s or '_'s. Names are extended with
7635 # ".0.0" to ensure at least three elements for the pack.
7636 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7637
7638 # Can't have leading @ because metaconfig interprets it as a command!
7639 ;@inc_version_list=();
7640 # XXX Redo to do opendir/readdir?
7641 if (-d $stem) {
7642     chdir($stem);
7643     ;@candidates = map {
7644         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7645     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7646 }
7647 else {
7648     ;@candidates = ();
7649 }
7650
7651 ($pversion, $aversion, $vsn5005) = map {
7652     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7653 foreach $d (@candidates) {
7654     if ($d->[1] lt $pversion) {
7655         if ($d->[1] ge $aversion) {
7656             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7657         }
7658         elsif ($d->[1] ge $vsn5005) {
7659             unshift(@inc_version_list, grep { -d } $d->[0]);
7660         }
7661     }
7662     else {
7663         # Skip newer version.  I.e. don't look in
7664         # 5.7.0 if we're installing 5.6.1.
7665     }
7666 }
7667
7668 if (@inc_version_list) {
7669     print join(' ', @inc_version_list);
7670 }
7671 else {
7672     # Blank space to preserve value for next Configure run.
7673     print " ";
7674 }
7675 EOPL
7676 chmod +x getverlist
7677 case "$inc_version_list" in
7678 '')     if test -x "$perl5$exe_ext"; then
7679                 dflt=`$perl5 getverlist`
7680         else
7681                 dflt='none'
7682         fi
7683         ;;
7684 $undef) dflt='none' ;;
7685 *)  eval dflt=\"$inc_version_list\" ;;
7686 esac
7687 case "$dflt" in
7688 ''|' ') dflt=none ;;
7689 esac
7690 case "$dflt" in
7691 5.005) dflt=none ;;
7692 esac
7693 $cat <<EOM
7694
7695 In order to ease the process of upgrading, this version of perl
7696 can be configured to use modules built and installed with earlier
7697 versions of perl that were installed under $prefix.  Specify here
7698 the list of earlier versions that this version of perl should check.
7699 If Configure detected no earlier versions of perl installed under
7700 $prefix, then the list will be empty.  Answer 'none' to tell perl
7701 to not search earlier versions.
7702
7703 The default should almost always be sensible, so if you're not sure,
7704 just accept the default.
7705 EOM
7706
7707 rp='List of earlier versions to include in @INC?'
7708 . ./myread
7709 case "$ans" in
7710 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7711 *) inc_version_list="$ans" ;;
7712 esac
7713 case "$inc_version_list" in
7714 ''|' ')
7715         inc_version_list_init='0'
7716         d_inc_version_list="$undef"
7717         ;;
7718 *)      inc_version_list_init=`echo $inc_version_list |
7719                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7720         d_inc_version_list="$define"
7721         ;;
7722 esac
7723 $rm -f getverlist
7724
7725 : see if malloc/malloc.h has to be included
7726 set malloc/malloc.h i_mallocmalloc
7727 eval $inhdr
7728
7729 : see if this is a malloc.h system
7730 : we want a real compile instead of Inhdr because some systems have a
7731 : malloc.h that just gives a compile error saying to use stdlib.h instead
7732 echo " "
7733 $cat >try.c <<EOCP
7734 #include <stdlib.h>
7735 #include <malloc.h>
7736 #$i_mallocmalloc I_MALLOCMALLOC
7737 #ifdef I_MALLOCMALLOC
7738 # include <malloc/malloc.h>
7739 #endif
7740
7741 int main () { return 0; }
7742 EOCP
7743 set try
7744 if eval $compile; then
7745     echo "<malloc.h> found." >&4
7746     val="$define"
7747 else
7748     echo "<malloc.h> NOT found." >&4
7749     val="$undef"
7750 fi
7751 $rm_try
7752 set i_malloc
7753 eval $setvar
7754
7755 : check for length of pointer
7756 echo " "
7757 case "$ptrsize" in
7758 '')
7759         echo "Checking to see how big your pointers are..." >&4
7760         $cat >try.c <<EOCP
7761 #include <stdio.h>
7762 #$i_stdlib I_STDLIB
7763 #ifdef I_STDLIB
7764 #include <stdlib.h>
7765 #endif
7766 int main()
7767 {
7768     printf("%d\n", (int)sizeof(void *));
7769     exit(0);
7770 }
7771 EOCP
7772         set try
7773         if eval $compile_ok; then
7774                 ptrsize=`$run ./try`
7775                 echo "Your pointers are $ptrsize bytes long."
7776         else
7777                 dflt='4'
7778                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7779                 rp="What is the size of a pointer (in bytes)?"
7780                 . ./myread
7781                 ptrsize="$ans"
7782         fi
7783         ;;
7784 esac
7785 $rm_try
7786 case "$use64bitall" in
7787 "$define"|true|[yY]*)
7788         case "$ptrsize" in
7789         4)      cat <<EOM >&4
7790
7791 *** You have chosen a maximally 64-bit build,
7792 *** but your pointers are only 4 bytes wide.
7793 *** Please rerun Configure without -Duse64bitall.
7794 EOM
7795                 case "$d_quad" in
7796                 define)
7797                         cat <<EOM >&4
7798 *** Since you have quads, you could possibly try with -Duse64bitint.
7799 EOM
7800                         ;;
7801                 esac
7802                 cat <<EOM >&4
7803 *** Cannot continue, aborting.
7804
7805 EOM
7806
7807                 exit 1
7808                 ;;
7809         esac
7810         ;;
7811 esac
7812
7813
7814 : determine whether to use malloc wrapping
7815 echo " "
7816 case "$usemallocwrap" in
7817 [yY]*|true|$define)     dflt='y' ;;
7818 [nN]*|false|$undef)     dflt='n' ;;
7819 *)      case "$usedevel" in
7820         [yY]*|true|$define)     dflt='y' ;;
7821         *) dflt='n' ;;
7822         esac
7823         ;;
7824 esac
7825 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7826 . ./myread
7827 usemallocwrap="$ans"
7828 case "$ans" in
7829 y*|true)
7830         usemallocwrap="$define" ;;
7831 *)
7832         usemallocwrap="$undef" ;;
7833 esac
7834
7835 : determine which malloc to compile in
7836 echo " "
7837 case "$usemymalloc" in
7838 [yY]*|true|$define)     dflt='y' ;;
7839 [nN]*|false|$undef)     dflt='n' ;;
7840 *)      case "$ptrsize" in
7841         4) dflt='y' ;;
7842         *) dflt='n' ;;
7843         esac
7844         if test "$useithreads" = "$define"; then dflt='n'; fi
7845         ;;
7846 esac
7847 rp="Do you wish to attempt to use the malloc that comes with $package?"
7848 . ./myread
7849 usemymalloc="$ans"
7850 case "$ans" in
7851 y*|true)
7852         usemymalloc='y'
7853         mallocsrc='malloc.c'
7854         mallocobj="malloc$_o"
7855         d_mymalloc="$define"
7856         case "$libs" in
7857         *-lmalloc*)
7858                 : Remove malloc from list of libraries to use
7859                 echo "Removing unneeded -lmalloc from library list" >&4
7860                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7861                 shift
7862                 libs="$*"
7863                 echo "libs = $libs" >&4
7864                 ;;
7865         esac
7866         ;;
7867 *)
7868         usemymalloc='n'
7869         mallocsrc=''
7870         mallocobj=''
7871         d_mymalloc="$undef"
7872         ;;
7873 esac
7874
7875 : compute the return types of malloc and free
7876 echo " "
7877 $cat >malloc.c <<END
7878 #$i_malloc I_MALLOC
7879 #$i_stdlib I_STDLIB
7880 #include <stdio.h>
7881 #include <sys/types.h>
7882 #ifdef I_MALLOC
7883 #include <malloc.h>
7884 #endif
7885 #ifdef I_STDLIB
7886 #include <stdlib.h>
7887 #endif
7888 #ifdef TRY_MALLOC
7889 void *malloc();
7890 #endif
7891 #ifdef TRY_FREE
7892 void free();
7893 #endif
7894 END
7895 case "$malloctype" in
7896 '')
7897         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7898                 malloctype='void *'
7899         else
7900                 malloctype='char *'
7901         fi
7902         ;;
7903 esac
7904 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7905
7906 case "$freetype" in
7907 '')
7908         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7909                 freetype='void'
7910         else
7911                 freetype='int'
7912         fi
7913         ;;
7914 esac
7915 echo "Your system uses $freetype free(), it would seem." >&4
7916 $rm -f malloc.[co]
7917 : determine where site specific architecture-dependent libraries go.
7918 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7919 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7920 : sitelib may have an optional trailing /share.
7921 case "$sitearch" in
7922 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7923         dflt="$dflt/$archname"
7924         ;;
7925 *)      dflt="$sitearch"
7926         ;;
7927 esac
7928 set sitearch sitearch none
7929 eval $prefixit
7930 $cat <<EOM
7931
7932 The installation process will also create a directory for
7933 architecture-dependent site-specific extensions and modules.
7934
7935 EOM
7936 fn=d~+
7937 rp='Pathname for the site-specific architecture-dependent library files?'
7938 . ./getfile
7939 prefixvar=sitearch
7940 . ./setprefixvar
7941 if $test X"$sitearch" = X"$sitelib"; then
7942         d_sitearch="$undef"
7943 else
7944         d_sitearch="$define"
7945 fi
7946
7947 : Set the vendorprefix variables
7948 $cat <<EOM
7949
7950 The installation process will also create a directory for
7951 vendor-supplied add-ons.  Vendors who supply perl with their system
7952 may find it convenient to place all vendor-supplied files in this
7953 directory rather than in the main distribution directory.  This will
7954 ease upgrades between binary-compatible maintenance versions of perl.
7955
7956 Of course you may also use these directories in whatever way you see
7957 fit.  For example, you might use them to access modules shared over a
7958 company-wide network.
7959
7960 The default answer should be fine for most people.
7961 This causes further questions about vendor add-ons to be skipped
7962 and no vendor-specific directories will be configured for perl.
7963
7964 EOM
7965 rp='Do you want to configure vendor-specific add-on directories?'
7966 case "$usevendorprefix" in
7967 define|true|[yY]*) dflt=y ;;
7968 *)      : User may have set vendorprefix directly on Configure command line.
7969         case "$vendorprefix" in
7970         ''|' ') dflt=n ;;
7971         *)      dflt=y ;;
7972         esac
7973         ;;
7974 esac
7975 . ./myread
7976 case "$ans" in
7977 [yY]*)  fn=d~+
7978         rp='Installation prefix to use for vendor-supplied add-ons?'
7979         case "$vendorprefix" in
7980         '') dflt="$prefix" ;;
7981         *)  dflt=$vendorprefix ;;
7982         esac
7983         . ./getfile
7984         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7985         oldvendorprefix=''
7986         case "$vendorprefix" in
7987         '') ;;
7988         *)      case "$ans" in
7989                 "$prefix") ;;
7990                 *) oldvendorprefix="$prefix";;
7991                 esac
7992                 ;;
7993         esac
7994         usevendorprefix="$define"
7995         vendorprefix="$ans"
7996         vendorprefixexp="$ansexp"
7997         ;;
7998 *)      usevendorprefix="$undef"
7999         vendorprefix=''
8000         vendorprefixexp=''
8001         ;;
8002 esac
8003
8004 : Set the vendorlib variables
8005 case "$vendorprefix" in
8006 '')     d_vendorlib="$undef"
8007         vendorlib=''
8008         vendorlibexp=''
8009         ;;
8010 *)      d_vendorlib="$define"
8011         : determine where vendor-supplied modules go.
8012         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
8013         case "$vendorlib" in
8014         '')
8015                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8016                 case "$installstyle" in
8017                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
8018                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
8019                 esac
8020                 ;;
8021         *)      dflt="$vendorlib"
8022                 ;;
8023         esac
8024         fn=d~+
8025         rp='Pathname for the vendor-supplied library files?'
8026         . ./getfile
8027         vendorlib="$ans"
8028         vendorlibexp="$ansexp"
8029         ;;
8030 esac
8031 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
8032 prefixvar=vendorlib
8033 . ./installprefix
8034
8035 : Set the vendorarch variables
8036 case "$vendorprefix" in
8037 '')     d_vendorarch="$undef"
8038         vendorarch=''
8039         vendorarchexp=''
8040         ;;
8041 *)      d_vendorarch="$define"
8042         : determine where vendor-supplied architecture-dependent libraries go.
8043         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
8044         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
8045         : vendorlib may have an optional trailing /share.
8046         case "$vendorarch" in
8047         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
8048                 dflt="$dflt/$archname"
8049                 ;;
8050         *)      dflt="$vendorarch" ;;
8051         esac
8052         fn=d~+
8053         rp='Pathname for vendor-supplied architecture-dependent files?'
8054         . ./getfile
8055         vendorarch="$ans"
8056         vendorarchexp="$ansexp"
8057         ;;
8058 esac
8059 prefixvar=vendorarch
8060 . ./installprefix
8061 if $test X"$vendorarch" = X"$vendorlib"; then
8062         d_vendorarch="$undef"
8063 else
8064         d_vendorarch="$define"
8065 fi
8066
8067 : Final catch-all directories to search
8068 $cat <<EOM
8069
8070 Lastly, you can have perl look in other directories for extensions and
8071 modules in addition to those already specified.
8072 These directories will be searched after
8073         $sitearch
8074         $sitelib
8075 EOM
8076 test X"$vendorlib" != "X" && echo '     ' $vendorlib
8077 test X"$vendorarch" != "X" && echo '    ' $vendorarch
8078 echo ' '
8079 case "$otherlibdirs" in
8080 ''|' ') dflt='none' ;;
8081 *)      dflt="$otherlibdirs" ;;
8082 esac
8083 $cat <<EOM
8084 Enter a colon-separated set of extra paths to include in perl's @INC
8085 search path, or enter 'none' for no extra paths.
8086
8087 EOM
8088
8089 rp='Colon-separated list of additional directories for perl to search?'
8090 . ./myread
8091 case "$ans" in
8092 ' '|''|none)    otherlibdirs=' ' ;;
8093 *)      otherlibdirs="$ans" ;;
8094 esac
8095 case "$otherlibdirs" in
8096 ' ') val=$undef ;;
8097 *)      val=$define ;;
8098 esac
8099 set d_perl_otherlibdirs
8100 eval $setvar
8101
8102 : DTrace support
8103 dflt_dtrace='/usr/sbin/dtrace'
8104 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8105
8106 cat <<EOM
8107
8108 Perl can be built to support DTrace on platforms that support it.
8109 DTrace is a diagnosis and performance analysis tool from Sun.
8110
8111 If this doesn't make any sense to you, just accept the default.
8112 EOM
8113
8114 while $test 1 ; do
8115         case "$usedtrace" in
8116         $define|true|[yY]*)
8117                 dflt='y'
8118                 ;;
8119         ?*)
8120                 dflt='y'
8121                 dflt_dtrace=$usedtrace
8122                 ;;
8123         *)
8124                 dflt='n'
8125                 ;;
8126         esac
8127
8128         rp='Support DTrace if available?'
8129         . ./myread
8130         case "$ans" in
8131         y|Y)    val="$define" ;;
8132         *)      val="$undef" ;;
8133         esac
8134         set usedtrace
8135         eval $setvar
8136
8137         test "X$usedtrace" != "X$define" && break
8138
8139         echo " "
8140         rp='Where is the dtrace executable?'
8141         dflt=$dflt_dtrace
8142         . ./getfile
8143         val="$ans"
8144         set dtrace
8145         eval $setvar
8146
8147         if $test -f $dtrace
8148         then
8149                 if $dtrace -h -s ../perldtrace.d \
8150                         -o perldtrace.tmp >/dev/null 2>&1 \
8151                         && rm -f perldtrace.tmp
8152                 then
8153                         echo " "
8154                         echo "Good: your $dtrace knows about the -h flag."
8155                 else
8156                         cat >&2 <<EOM
8157
8158 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8159 ***
8160 *** Your installed dtrace doesn't support the -h switch to compile a D
8161 *** program into a C header. Can't continue.
8162
8163 EOM
8164                         exit 1
8165                 fi
8166                 break;
8167         fi
8168
8169         case "$fastread" in
8170         yes)
8171                 cat >&2 <<EOM
8172
8173 *** $me:  Fatal Error:  $dtrace not found.
8174 *** Can't continue.
8175
8176 EOM
8177                 exit 1
8178                 ;;
8179         *)
8180                 echo "*** $dtrace was not found."
8181                 echo " "
8182                 ;;
8183         esac
8184 done
8185
8186 : See if we want extra modules installed
8187 echo " "
8188 case "$extras" in
8189 '') dflt='n';;
8190 *) dflt='y';;
8191 esac
8192 cat <<EOM
8193 Perl can be built with extra modules or bundles of modules which
8194 will be fetched from the CPAN and installed alongside Perl.
8195
8196 Notice that you will need access to the CPAN; either via the Internet,
8197 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8198 be asked later to configure the CPAN.pm module which will in turn do
8199 the installation of the rest of the extra modules or bundles.)
8200
8201 Notice also that if the modules require any external software such as
8202 libraries and headers (the libz library and the zlib.h header for the
8203 Compress::Zlib module, for example) you MUST have any such software
8204 already installed, this configuration process will NOT install such
8205 things for you.
8206
8207 If this doesn't make any sense to you, just accept the default '$dflt'.
8208 EOM
8209 rp='Install any extra modules (y or n)?'
8210 . ./myread
8211 case "$ans" in
8212 y|Y)
8213         cat <<EOM
8214
8215 Please list any extra modules or bundles to be installed from CPAN,
8216 with spaces between the names.  The names can be in any format the
8217 'install' command of CPAN.pm will understand.  (Answer 'none',
8218 without the quotes, to install no extra modules or bundles.)
8219 EOM
8220         rp='Extras?'
8221         dflt="$extras"
8222         . ./myread
8223         extras="$ans"
8224 esac
8225 case "$extras" in
8226 ''|'none')
8227         val=''
8228         $rm -f ../extras.lst
8229         ;;
8230 *)      echo "(Saving the list of extras for later...)"
8231         echo "$extras" > ../extras.lst
8232         val="'$extras'"
8233         ;;
8234 esac
8235 set extras
8236 eval $setvar
8237 echo " "
8238
8239 : determine where html pages for programs go
8240 set html1dir html1dir none
8241 eval $prefixit
8242 $cat <<EOM
8243
8244 If you wish to install html files for programs in $spackage, indicate
8245 the appropriate directory here.  To skip installing html files,
8246 answer "none".
8247 EOM
8248 case "$html1dir" in
8249 ''|none|$undef|' ') dflt=none ;;
8250 *) dflt=$html1dir ;;
8251 esac
8252 fn=dn+~
8253 rp="Directory for the main $spackage html pages?"
8254 . ./getfile
8255 prefixvar=html1dir
8256 . ./setprefixvar
8257 : Use ' ' for none so value is preserved next time through Configure
8258 $test X"$html1dir" = "X" && html1dir=' '
8259
8260 : determine where html pages for libraries and modules go
8261 set html3dir html3dir none
8262 eval $prefixit
8263 $cat <<EOM
8264
8265 If you wish to install html files for modules associated with $spackage,
8266 indicate the appropriate directory here.  To skip installing html files,
8267 answer "none".
8268 EOM
8269 : There is no obvious default.  If they have specified html1dir, then
8270 : try to key off that, possibly changing .../html1 into .../html3.
8271 case "$html3dir" in
8272 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8273 *) dflt=$html3dir ;;
8274 esac
8275 fn=dn+~
8276 rp="Directory for the $spackage module html pages?"
8277 . ./getfile
8278 prefixvar=html3dir
8279 . ./setprefixvar
8280 : Use ' ' for none so value is preserved next time through Configure
8281 $test X"$html3dir" = "X" && html3dir=' '
8282
8283 : determine whether to install perl also as /usr/bin/perl
8284
8285 echo " "
8286 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8287         $cat <<EOM
8288 Many scripts expect perl to be installed as /usr/bin/perl.
8289
8290 If you want to, I can install the perl you are about to compile
8291 as /usr/bin/perl (in addition to $bin/perl).
8292 EOM
8293         if test -f /usr/bin/perl; then
8294             $cat <<EOM
8295
8296 However, please note that because you already have a /usr/bin/perl,
8297 overwriting that with a new Perl would very probably cause problems.
8298 Therefore I'm assuming you don't want to do that (unless you insist).
8299
8300 EOM
8301             case "$installusrbinperl" in
8302             "$define"|[yY]*)    dflt='y';;
8303             *)                  dflt='n';;
8304             esac
8305         else
8306             $cat <<EOM
8307
8308 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8309
8310 EOM
8311             case "$installusrbinperl" in
8312             "$undef"|[nN]*)     dflt='n';;
8313             *)                  dflt='y';;
8314             esac
8315         fi
8316         rp="Do you want to install perl as /usr/bin/perl?"
8317         . ./myread
8318         case "$ans" in
8319         [yY]*)  val="$define";;
8320         *)      val="$undef" ;;
8321         esac
8322 else
8323         val="$undef"
8324 fi
8325 set installusrbinperl
8326 eval $setvar
8327
8328 : see if dlopen exists
8329 xxx_runnm="$runnm"
8330 xxx_ccflags="$ccflags"
8331 runnm=false
8332 : with g++ one needs -shared to get is-in-libc to work for dlopen
8333 case "$gccversion" in
8334 '')     ;;
8335 *Clang*)        ;;
8336 *)      case "$d_cplusplus" in
8337         "$define") ccflags="$ccflags -shared" ;;
8338         esac
8339         ;;
8340 esac
8341 set dlopen d_dlopen
8342 eval $inlibc
8343 runnm="$xxx_runnm"
8344 ccflags="$xxx_ccflags"
8345
8346 : see if this is a unistd.h system
8347 set unistd.h i_unistd
8348 eval $inhdr
8349
8350 : determine which dynamic loading, if any, to compile in
8351 echo " "
8352 dldir="ext/DynaLoader"
8353 case "$usedl" in
8354     $define|y|true)
8355         dflt='y'
8356         usedl="$define"
8357         ;;
8358     $undef|n|false)
8359         dflt='n'
8360         usedl="$undef"
8361         ;;
8362     *)
8363         dflt='n'
8364         case "$d_dlopen" in
8365             $define) dflt='y' ;;
8366         esac
8367         : Does a dl_xxx.xs file exist for this operating system
8368         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8369         ;;
8370 esac
8371 rp="Do you wish to use dynamic loading?"
8372 . ./myread
8373 usedl="$ans"
8374 bin_ELF="$undef"
8375 case "$ans" in
8376     y*) usedl="$define"
8377         case "$dlsrc" in
8378             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8379                     dflt="$dldir/dl_${osname}.xs"
8380                 elif $test "$d_dlopen" = "$define" ; then
8381                     dflt="$dldir/dl_dlopen.xs"
8382                 else
8383                     dflt=''
8384                 fi
8385                 ;;
8386             *)  dflt="$dldir/$dlsrc"
8387                 ;;
8388         esac
8389         echo "The following dynamic loading files are available:"
8390         : Can not go over to $dldir because getfile has path hard-coded in.
8391         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8392         rp="Source file to use for dynamic loading"
8393         fn="fne"
8394         gfpth="$src"
8395         . ./getfile
8396         usedl="$define"
8397         : emulate basename
8398         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8399
8400         $cat << EOM
8401
8402 Some systems may require passing special flags to $cc -c to
8403 compile modules that will be used to create a shared library.
8404 To use no flags, say "none".
8405
8406 EOM
8407         case "$cccdlflags" in
8408             '') case "$gccversion" in
8409                 '') case "$osname" in
8410                         hpux)   dflt='+z' ;;
8411                         irix*)  dflt='-KPIC' ;;
8412                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8413                         sunos)  dflt='-pic' ;;
8414                         *)      dflt='none' ;;
8415                     esac
8416                     ;;
8417                 *)  case "$osname" in
8418                         darwin) dflt='none' ;;
8419                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8420                         *)      dflt='-fpic' ;;
8421                     esac ;;
8422                 esac ;;
8423             ' ') dflt='none' ;;
8424             *)   dflt="$cccdlflags" ;;
8425         esac
8426
8427         case "$dflt" in
8428             none) dflt='' ;;
8429         esac
8430
8431         # If -Dsysroot was specified, now's the time to add it
8432         # to cccdlflags
8433         if test "X$sysroot" != X; then
8434             case "$gccversion" in
8435                 '') ;;
8436                 *)  case "$dflt" in
8437                         *sysroot*) ;;
8438                         'undef'|*)
8439                             dflt="$dflt --sysroot=$sysroot" ;;
8440                     esac
8441                     ;;
8442             esac
8443         fi
8444
8445         case "$dflt" in
8446             '') dflt='none';;
8447         esac
8448
8449         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8450         . ./myread
8451         case "$ans" in
8452             none) cccdlflags=' ' ;;
8453             *)    cccdlflags="$ans" ;;
8454         esac
8455
8456         cat << EOM
8457
8458 Some systems use ld to create libraries that can be dynamically loaded,
8459 while other systems (such as those using ELF) use $cc.
8460
8461 EOM
8462
8463 : Determine if this is ELF
8464         $cat >try.c <<EOM
8465 /* Test for whether ELF binaries are produced */
8466 #include <fcntl.h>
8467 #$i_stdlib I_STDLIB
8468 #ifdef I_STDLIB
8469 #include <stdlib.h>
8470 #endif
8471 #$i_unistd I_UNISTD
8472 #ifdef I_UNISTD
8473 #include <unistd.h>
8474 #endif
8475 int main() {
8476     char b[4];
8477     int i = open("a.out",O_RDONLY);
8478     if(i == -1)
8479         exit(1); /* fail */
8480     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8481         exit(0); /* succeed (yes, it is ELF) */
8482     exit(1); /* fail */
8483 }
8484 EOM
8485         if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8486             bin_ELF="$define"
8487         fi
8488         $rm_try
8489
8490         case "$ld" in
8491             '') if $test $bin_ELF = "$define"; then
8492                     cat <<EOM
8493 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8494 EOM
8495                     dflt="$cc"
8496                 else
8497                     echo "I'll use ld to build dynamic libraries."
8498                     dflt='ld'
8499                 fi
8500                 ;;
8501             *)  dflt="$ld"
8502                 ;;
8503         esac
8504
8505         rp="What command should be used to create dynamic libraries?"
8506         . ./myread
8507         ld="$ans"
8508
8509         cat << EOM
8510
8511 Some systems may require passing special flags to $ld to create a
8512 library that can be dynamically loaded.  If your ld flags include
8513 -L/other/path options to locate libraries outside your loader's normal
8514 search path, you may need to specify those -L options here as well.  To
8515 use no flags, say "none".
8516
8517 EOM
8518         case "$lddlflags" in
8519             '') case "$osname" in
8520                     haiku) dflt='-shared' ;;
8521                     hpux) dflt='-b';
8522                           case "$gccversion" in
8523                               '') dflt="$dflt +vnocompatwarnings" ;;
8524                           esac
8525                           ;;
8526                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8527                     solaris) # See [perl #66604].
8528                             # On Solaris 11, gcc -m64 on amd64
8529                             # appears not to understand -G.  gcc versions at
8530                             # least as old as 3.4.3 support -shared, so just
8531                             # use that with Solaris 11 and later, but keep
8532                             # the old behavior for older Solaris versions.
8533                             case "$gccversion" in
8534                                 '') dflt='-G' ;;
8535                                 *)  case "$osvers" in
8536                                         2.?|2.10) dflt='-G' ;;
8537                                         *) dflt='-shared' ;;
8538                                     esac
8539                                     ;;
8540                             esac
8541                             ;;
8542                     sunos) dflt='-assert nodefinitions' ;;
8543                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8544                     *)     dflt='none' ;;
8545                 esac
8546                 ;;
8547             *) dflt="$lddlflags" ;;
8548         esac
8549
8550         : Only do this for gcc, since, for example, qcc has no concept
8551         : of --sysroot.
8552         if $test "X$sysroot" != X; then
8553             case "$gccversion" in
8554                 '') ;;
8555                 *)  dflt="$dflt --sysroot $sysroot" ;;
8556             esac
8557         fi
8558
8559         : Try to guess additional flags to pick up local libraries.
8560         : Be careful not to append to a plain 'none'
8561         case "$dflt" in
8562             none) dflt='' ;;
8563         esac
8564         for thisflag in $ldflags; do
8565             case "$thisflag" in
8566                 -L*|-R*|-Wl,-R*)
8567                     case " $dflt " in
8568                         *" $thisflag "*) ;;
8569                         *) dflt="$dflt $thisflag" ;;
8570                     esac
8571                     ;;
8572             esac
8573         done
8574
8575         case "$dflt" in
8576             ''|' ') dflt='none' ;;
8577         esac
8578
8579         case "$ldflags" in
8580             *-fstack-protector-strong*)
8581                 case "$dflt" in
8582                     *-fstack-protector-strong*) ;; # Don't add it again
8583                     *) dflt="$dflt -fstack-protector-strong" ;;
8584                 esac
8585                 ;;
8586             *-fstack-protector*)
8587                 case "$dflt" in
8588                     *-fstack-protector*) ;; # Don't add it again
8589                     *) dflt="$dflt -fstack-protector" ;;
8590                 esac
8591                 ;;
8592         esac
8593
8594         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8595         . ./myread
8596         case "$ans" in
8597             none) lddlflags=' ' ;;
8598             *) lddlflags="$ans" ;;
8599         esac
8600
8601         cat <<EOM
8602
8603 Some systems may require passing special flags to $cc to indicate that
8604 the resulting executable will use dynamic linking.  To use no flags,
8605 say "none".
8606
8607 EOM
8608         case "$ccdlflags" in
8609             '') case "$osname" in
8610                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8611                     sunos)             dflt='none'   ;;
8612                     *)                 dflt='none'   ;;
8613                 esac ;;
8614             ' ') dflt='none' ;;
8615             *)   dflt="$ccdlflags" ;;
8616         esac
8617         rp="Any special flags to pass to $cc to use dynamic linking?"
8618         . ./myread
8619         case "$ans" in
8620             none) ccdlflags=' ' ;;
8621             *)    ccdlflags="$ans" ;;
8622         esac
8623         ;;
8624
8625     *)  usedl="$undef"
8626         ld='ld'
8627         dlsrc='dl_none.xs'
8628         lddlflags=''
8629         ccdlflags=''
8630         ;;
8631 esac
8632
8633 ld_can_script="$undef"
8634 case "$bin_ELF$usedl" in
8635     $define$define)
8636         # Abuse try.h and a.out names for neat cleanup
8637         $cat >try.c <<EOM
8638 void foo() {}
8639 void bar() {}
8640 EOM
8641         $cat >try.h <<EOM
8642 LIBTEST_42 {
8643  global:
8644   foo;
8645  local: *;
8646  };
8647 EOM
8648         if $cc $cccdlflags $ccdlflags $ccflags \
8649                $ldflags $lddlflags -o a.out try.c \
8650                -Wl,--version-script=try.h >/dev/null 2>&1 \
8651            &&  $test -s a.out ; then
8652             echo "ld supports scripting" >&4
8653             ld_can_script="$define"
8654         else
8655             echo "ld does not support scripting" >&4
8656         fi
8657         $rm_try
8658         ;;
8659 esac
8660
8661 : Do we want a shared libperl?
8662 also=''
8663 case "$usedl" in
8664 $undef)
8665         # No dynamic loading being used, so don't bother even to prompt.
8666         useshrplib='false'
8667         ;;
8668 *)      case "$useshrplib" in
8669         '')     case "$osname" in
8670                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8671                         dflt=y
8672                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8673                         ;;
8674                 *)      dflt=n
8675                         ;;
8676                 esac
8677                 ;;
8678         $define|true|[Yy]*)
8679                 dflt=y
8680                 ;;
8681         *)      dflt=n
8682                 ;;
8683         esac
8684         $cat << EOM
8685
8686 The perl executable is normally obtained by linking perlmain.c with
8687 libperl${_a}, any static extensions (usually just DynaLoader), and
8688 any other libraries needed on this system (such as -lm, etc.).  Since
8689 your system supports dynamic loading, it is probably possible to build
8690 a shared libperl.$so.  If you will have more than one executable linked
8691 to libperl.$so, this will significantly reduce the size of each
8692 executable, but it may have a noticeable effect on performance.  The
8693 default is probably sensible for your system.
8694 $also
8695
8696 EOM
8697         rp="Build a shared libperl.$so (y/n)"
8698         . ./myread
8699         case "$ans" in
8700         true|$define|[Yy]*)
8701                 useshrplib='true'  ;;
8702         *)      useshrplib='false' ;;
8703         esac
8704         ;;
8705 esac
8706
8707 case "$useshrplib" in
8708 true)
8709         case "$userelocatableinc" in
8710         true|define)
8711                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8712                 echo "See INSTALL for an explanation why that won't work." >&4
8713                 exit 4
8714                 ;;
8715         esac
8716         case "$libperl" in
8717         '')
8718                 # Figure out a good name for libperl.so.  Since it gets stored in
8719                 # a version-specific architecture-dependent library, the version
8720                 # number isn't really that important, except for making cc/ld happy.
8721                 #
8722                 # A name such as libperl.so.10.1
8723                 majmin="libperl.$so.$patchlevel.$subversion"
8724                 # A name such as libperl.so.100
8725                 majonly=`echo $patchlevel $subversion |
8726                         $awk '{printf "%d%02d", $1, $2}'`
8727                 majonly=libperl.$so.$majonly
8728                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8729                 # rely on figuring it out from the naming of libc.
8730                 case "${osname}${osvers}" in
8731                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8732                         dflt=libperl.$so
8733                         ;;
8734                 cygwin*) # ld links now against the dll directly
8735                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8736                         majonly=`echo $patchlevel $subversion |
8737                                 $awk '{printf "%03d%03d", $1, $2}'`
8738                         majonly=cygperl5.$majonly.$so
8739                         dflt=$majmin
8740                         ;;
8741                 *)      # Try to guess based on whether libc has major.minor.
8742                         case "$libc" in
8743                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8744                         *libc.$so.[0-9]*) dflt=$majonly ;;
8745                         *)      dflt=libperl.$so ;;
8746                         esac
8747                         ;;
8748                 esac
8749                 ;;
8750         *)      dflt=$libperl
8751                 ;;
8752         esac
8753         cat << EOM
8754
8755 I need to select a good name for the shared libperl.  If your system uses
8756 library names with major and minor numbers, then you might want something
8757 like $majmin.  Alternatively, if your system uses a single version
8758 number for shared libraries, then you might want to use $majonly.
8759 Or, your system might be quite happy with a simple libperl.$so.
8760
8761 Since the shared libperl will get installed into a version-specific
8762 architecture-dependent directory, the version number of the shared perl
8763 library probably isn't important, so the default should be o.k.
8764
8765 EOM
8766         rp='What name do you want to give to the shared libperl?'
8767         . ./myread
8768         libperl=$ans
8769         echo "Ok, I'll use $libperl"
8770         ;;
8771 *)
8772         libperl="libperl${_a}"
8773         ;;
8774 esac
8775
8776 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8777 case "$shrpdir" in
8778 '') ;;
8779 *)      $cat >&4 <<EOM
8780 WARNING:  Use of the shrpdir variable for the installation location of
8781 the shared $libperl is not supported.  It was never documented and
8782 will not work in this version.  Let me (perlbug@perl.org)
8783 know of any problems this may cause.
8784
8785 EOM
8786         case "$shrpdir" in
8787         "$archlibexp/CORE")
8788                 $cat >&4 <<EOM
8789 But your current setting of $shrpdir is
8790 the default anyway, so it's harmless.
8791 EOM
8792                 ;;
8793         *)
8794                 $cat >&4 <<EOM
8795 Further, your current attempted setting of $shrpdir
8796 conflicts with the value of $archlibexp/CORE
8797 that installperl will use.
8798 EOM
8799                 ;;
8800         esac
8801         ;;
8802 esac
8803
8804 # How will the perl executable find the installed shared $libperl?
8805 # Add $xxx to ccdlflags.
8806 # If we can't figure out a command-line option, use $shrpenv to
8807 # set env LD_RUN_PATH.  The main perl makefile uses this.
8808 shrpdir=$archlibexp/CORE
8809 xxx=''
8810 tmp_shrpenv=''
8811 if "$useshrplib"; then
8812     case "$osname" in
8813         aix)
8814                 # We'll set it in Makefile.SH...
8815                 ;;
8816         solaris)
8817                 xxx="-R $shrpdir"
8818                 ;;
8819         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8820                 xxx="-Wl,-R$shrpdir"
8821                 ;;
8822         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8823                 xxx="-Wl,-rpath,$shrpdir"
8824                 ;;
8825         hpux*)
8826                 # hpux doesn't like the default, either.
8827                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8828                 ;;
8829         cygwin)
8830                 # cygwin needs only ldlibpth
8831                 ;;
8832         *)
8833                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8834                 ;;
8835         esac
8836         case "$xxx" in
8837         '') ;;
8838         *)
8839                 # Only add $xxx if it isn't already in ccdlflags.
8840                 case " $ccdlflags " in
8841                 *" $xxx "*)     ;;
8842                 *)      ccdlflags="$ccdlflags $xxx"
8843                         cat <<EOM >&4
8844
8845 Adding $xxx to the flags
8846 passed to $ld so that the perl executable will find the
8847 installed shared $libperl.
8848
8849 EOM
8850                         ;;
8851                 esac
8852                 ;;
8853         esac
8854 fi
8855 # Fix ccdlflags in AIX for building external extensions.
8856 # (For building Perl itself bare -bE:perl.exp is needed,
8857 #  Makefile.SH takes care of this.)
8858 case "$osname" in
8859 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8860 esac
8861 # Respect a hint or command-line value.
8862 case "$shrpenv" in
8863 '') shrpenv="$tmp_shrpenv" ;;
8864 esac
8865 case "$ldlibpthname" in
8866 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8867 none)   ldlibpthname='' ;;
8868 esac
8869
8870 : determine where manual pages are on this system
8871 echo " "
8872 case "$sysman" in
8873 '')
8874         syspath='/usr/share/man/man1 /usr/man/man1'
8875         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8876         syspath="$syspath /usr/man/u_man/man1"
8877         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8878         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8879         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8880         sysman=`./loc . /usr/man/man1 $syspath`
8881         ;;
8882 esac
8883 if $test -d "$sysman"; then
8884         echo "System manual is in $sysman." >&4
8885 else
8886         echo "Could not find manual pages in source form." >&4
8887 fi
8888
8889 : determine where manual pages go
8890 set man1dir man1dir none
8891 eval $prefixit
8892 $cat <<EOM
8893
8894 $spackage has manual pages available in source form.
8895 EOM
8896 case "$nroff" in
8897 nroff)
8898         echo "However, you don't have nroff, so they're probably useless to you."
8899         case "$man1dir" in
8900         '') man1dir="none";;
8901         esac;;
8902 esac
8903 echo "If you don't want the manual sources installed, answer 'none'."
8904 case "$man1dir" in
8905 ' ') dflt=none
8906         ;;
8907 '')
8908         lookpath="$prefixexp/share/man/man1"
8909         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8910         lookpath="$lookpath $prefixexp/man/p_man/man1"
8911         lookpath="$lookpath $prefixexp/man/u_man/man1"
8912         lookpath="$lookpath $prefixexp/man/man.1"
8913         case "$sysman" in
8914         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8915         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8916         esac
8917         set dflt
8918         eval $prefixup
8919         ;;
8920 *)  dflt="$man1dir"
8921         ;;
8922 esac
8923 echo " "
8924 fn=dn+~
8925 rp="Where do the main $spackage manual pages (source) go?"
8926 . ./getfile
8927 if $test "X$man1direxp" != "X$ansexp"; then
8928         installman1dir=''
8929 fi
8930 prefixvar=man1dir
8931 . ./setprefixvar
8932
8933 case "$man1dir" in
8934 '')     man1dir=' '
8935         installman1dir='';;
8936 esac
8937
8938 : What suffix to use on installed man pages
8939
8940 case "$man1dir" in
8941 ' ')
8942         man1ext='0'
8943         ;;
8944 *)
8945         rp="What suffix should be used for the main $spackage man pages?"
8946         case "$man1ext" in
8947         '')     case "$man1dir" in
8948                 *1)  dflt=1 ;;
8949                 *1p) dflt=1p ;;
8950                 *1pm) dflt=1pm ;;
8951                 *l) dflt=l;;
8952                 *n) dflt=n;;
8953                 *o) dflt=o;;
8954                 *p) dflt=p;;
8955                 *C) dflt=C;;
8956                 *L) dflt=L;;
8957                 *L1) dflt=L1;;
8958                 *) dflt=1;;
8959                 esac
8960                 ;;
8961         *)      dflt="$man1ext";;
8962         esac
8963         . ./myread
8964         man1ext="$ans"
8965         ;;
8966 esac
8967
8968 : see if we can have long filenames
8969 echo " "
8970 first=123456789abcdef
8971 $rm -f $first
8972 if (echo hi >$first) 2>/dev/null; then
8973         if $test -f 123456789abcde; then
8974                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8975                 val="$undef"
8976         else
8977                 echo 'You can have filenames longer than 14 characters.'>&4
8978                 val="$define"
8979         fi
8980 else
8981         $cat <<'EOM'
8982 You can't have filenames longer than 14 chars.
8983 You can't even think about them!
8984 EOM
8985         val="$undef"
8986 fi
8987 set d_flexfnam
8988 eval $setvar
8989 $rm -rf 123456789abcde*
8990
8991 : determine where library module manual pages go
8992 set man3dir man3dir none
8993 eval $prefixit
8994 $cat <<EOM
8995
8996 $spackage has manual pages for many of the library modules.
8997 EOM
8998
8999 case "$nroff" in
9000 nroff)
9001         $cat <<'EOM'
9002 However, you don't have nroff, so they're probably useless to you.
9003 EOM
9004         case "$man3dir" in
9005         '') man3dir="none";;
9006         esac;;
9007 esac
9008
9009 case "$d_flexfnam" in
9010 undef)
9011         $cat <<'EOM'
9012 However, your system can't handle the long file names like File::Basename.3.
9013 EOM
9014         case "$man3dir" in
9015         '') man3dir="none";;
9016         esac;;
9017 esac
9018
9019 echo "If you don't want the manual sources installed, answer 'none'."
9020 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9021 case "$man3dir" in
9022 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9023         if $test -d "$privlib/man/man3"; then
9024                 cat <<EOM >&4
9025
9026 WARNING:  Previous versions of perl installed man3 pages into
9027 $privlib/man/man3.  This version will suggest a
9028 new default of $dflt.
9029 EOM
9030                 tdflt=$dflt
9031                 dflt='n'
9032                 rp='Do you wish to preserve the old behavior?(y/n)'
9033                 . ./myread
9034                 case "$ans" in
9035                 y*) dflt="$privlib/man/man3" ;;
9036                 *)  dflt=$tdflt ;;
9037                 esac
9038     fi
9039         ;;
9040 *)      dflt="$man3dir" ;;
9041 esac
9042 case "$dflt" in
9043 ' ') dflt=none ;;
9044 esac
9045 echo " "
9046 fn=dn+~
9047 rp="Where do the $package library man pages (source) go?"
9048 . ./getfile
9049 prefixvar=man3dir
9050 . ./setprefixvar
9051
9052 case "$man3dir" in
9053 '')     man3dir=' '
9054         installman3dir='';;
9055 esac
9056
9057 : What suffix to use on installed man pages
9058 case "$man3dir" in
9059 ' ')
9060         man3ext='0'
9061         ;;
9062 *)
9063         rp="What suffix should be used for the $package library man pages?"
9064         case "$man3ext" in
9065         '')     case "$man3dir" in
9066                 *3)  dflt=3 ;;
9067                 *3p) dflt=3p ;;
9068                 *3pm) dflt=3pm ;;
9069                 *l) dflt=l;;
9070                 *n) dflt=n;;
9071                 *o) dflt=o;;
9072                 *p) dflt=p;;
9073                 *C) dflt=C;;
9074                 *L) dflt=L;;
9075                 *L3) dflt=L3;;
9076                 *) dflt=3;;
9077                 esac
9078                 ;;
9079         *)      dflt="$man3ext";;
9080         esac
9081         . ./myread
9082         man3ext="$ans"
9083         ;;
9084 esac
9085
9086 : see if we have to deal with yellow pages, now NIS.
9087 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9088         case "$hostcat" in
9089         nidump*) ;;
9090         *)
9091                 case "$hostcat" in
9092                 *ypcat*) dflt=y;;
9093                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9094                                 dflt=y
9095                         else
9096                                 dflt=n
9097                         fi;;
9098                 *) dflt=n;;
9099                 esac
9100                 echo " "
9101                 rp='Are you getting the hosts file via yellow pages?'
9102                 . ./myread
9103                 case "$ans" in
9104                 y*) hostcat='ypcat hosts';;
9105                 *) hostcat='cat /etc/hosts';;
9106                 esac
9107                 ;;
9108         esac
9109 fi
9110 case "$hostcat" in
9111 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9112 esac
9113 case "$groupcat" in
9114 '') test -f /etc/group && groupcat='cat /etc/group';;
9115 esac
9116 case "$passcat" in
9117 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9118 esac
9119
9120 : now get the host name
9121 echo " "
9122 echo "Figuring out host name..." >&4
9123 case "$myhostname" in
9124 '') cont=true
9125         echo 'Maybe "hostname" will work...'
9126         if tans=`sh -c hostname 2>&1` ; then
9127                 myhostname=$tans
9128                 phostname=hostname
9129                 cont=''
9130         fi
9131         ;;
9132 *) cont='';;
9133 esac
9134 if $test "$cont"; then
9135         if ./xenix; then
9136                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9137                 if tans=`cat /etc/systemid 2>&1` ; then
9138                         myhostname=$tans
9139                         phostname='cat /etc/systemid'
9140                         echo "Whadyaknow.  Xenix always was a bit strange..."
9141                         cont=''
9142                 fi
9143         elif $test -r /etc/systemid; then
9144                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9145         fi
9146 fi
9147 if $test "$cont"; then
9148         echo 'No, maybe "uuname -l" will work...'
9149         if tans=`sh -c 'uuname -l' 2>&1` ; then
9150                 myhostname=$tans
9151                 phostname='uuname -l'
9152         else
9153                 echo 'Strange.  Maybe "uname -n" will work...'
9154                 if tans=`sh -c 'uname -n' 2>&1` ; then
9155                         myhostname=$tans
9156                         phostname='uname -n'
9157                 else
9158                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9159                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9160                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9161                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9162                         else
9163                                 case "$myhostname" in
9164                                 '') echo "Does this machine have an identity crisis or something?"
9165                                         phostname='';;
9166                                 *)
9167                                         echo "Well, you said $myhostname before..."
9168                                         phostname='echo $myhostname';;
9169                                 esac
9170                         fi
9171                 fi
9172         fi
9173 fi
9174 case "$myhostname" in
9175 '') myhostname=noname ;;
9176 esac
9177 : you do not want to know about this
9178 set $myhostname
9179 myhostname=$1
9180
9181 : verify guess
9182 if $test "$myhostname" ; then
9183         dflt=y
9184         rp='Your host name appears to be "'$myhostname'".'" Right?"
9185         . ./myread
9186         case "$ans" in
9187         y*) ;;
9188         *) myhostname='';;
9189         esac
9190 fi
9191
9192 : bad guess or no guess
9193 while $test "X$myhostname" = X ; do
9194         dflt=''
9195         rp="Please type the (one word) name of your host:"
9196         . ./myread
9197         myhostname="$ans"
9198 done
9199
9200 : translate upper to lower if necessary
9201 case "$myhostname" in
9202 *[A-Z]*)
9203         echo "(Normalizing case in your host name)"
9204         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9205         ;;
9206 esac
9207
9208 case "$myhostname" in
9209 *.*)
9210         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9211         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9212         echo "(Trimming domain name from host name--host name is now $myhostname)"
9213         ;;
9214 *) case "$mydomain" in
9215         '')
9216                 {
9217                         test "X$hostcat" = "Xypcat hosts" &&
9218                         ypmatch "$myhostname" hosts 2>/dev/null |\
9219                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9220                         $test -s hosts
9221                 } || {
9222                         test "X$hostcat" != "X" &&
9223                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9224                                         /[       ]$myhostname[  . ]/p" > hosts
9225                 }
9226                 tmp_re="[       . ]"
9227                 if $test -f hosts; then
9228                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9229                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9230                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9231                                 hosts | $sort | $uniq | \
9232                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9233                         case `$echo X$dflt` in
9234                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9235                                 dflt=.
9236                                 ;;
9237                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9238                                 ;;
9239                         esac
9240                 else
9241                         echo "(I cannot locate a hosts database anywhere)"
9242                         dflt=.
9243                 fi
9244                 case "$dflt" in
9245                 .)
9246                         tans=`./loc resolv.conf X /etc /usr/etc`
9247                         if $test -f "$tans"; then
9248                                 echo "(Attempting domain name extraction from $tans)"
9249                                 dflt=.`$sed -n -e 's/   / /g' \
9250                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9251                                   -e 1q 2>/dev/null`
9252                                 case "$dflt" in
9253                                 .) dflt=.`$sed -n -e 's/        / /g' \
9254                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9255                                      -e 1q 2>/dev/null`
9256                                         ;;
9257                                 esac
9258                         fi
9259                         ;;
9260                 esac
9261                 case "$dflt" in
9262                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9263                         dflt=.`sh -c domainname 2>/dev/null`
9264                         case "$dflt" in
9265                         '') dflt='.';;
9266                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9267                         esac
9268                         ;;
9269                 esac
9270                 case "$dflt$osname" in
9271                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9272                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9273                         ;;
9274                 esac
9275                 case "$dflt" in
9276                 .) echo "(Lost all hope -- silly guess then)"
9277                         dflt='.nonet'
9278                         ;;
9279                 esac
9280                 $rm -f hosts
9281                 ;;
9282         *) dflt="$mydomain";;
9283         esac;;
9284 esac
9285 echo " "
9286 rp="What is your domain name?"
9287 . ./myread
9288 tans="$ans"
9289 case "$ans" in
9290 '') ;;
9291 .*) ;;
9292 *) tans=".$tans";;
9293 esac
9294 mydomain="$tans"
9295
9296 : translate upper to lower if necessary
9297 case "$mydomain" in
9298 *[A-Z]*)
9299         echo "(Normalizing case in your domain name)"
9300         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9301         ;;
9302 esac
9303
9304 : a little sanity check here
9305 case "$phostname" in
9306 '') ;;
9307 *)
9308         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9309         $myhostname$mydomain|$myhostname) ;;
9310         *)
9311                 case "$phostname" in
9312                 sed*)
9313                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9314                         ;;
9315                 *)
9316                         echo "(That doesn't agree with your $phostname command, by the way.)"
9317                         ;;
9318                 esac
9319         ;;
9320         esac
9321         ;;
9322 esac
9323
9324 : determine the e-mail address of the user who is running us
9325 $cat <<EOM
9326
9327 I need to get your e-mail address in Internet format if possible, i.e.
9328 something like user@host.domain. Please answer accurately since I have
9329 no easy means to double check it. The default value provided below
9330 is most probably close to reality but may not be valid from outside
9331 your organization...
9332
9333 EOM
9334 cont=x
9335 while test "$cont"; do
9336         case "$MAILDOMAIN" in
9337         '')
9338                 if $test -s /etc/mailname; then
9339                         maildomain=`$cat /etc/mailname`
9340                 else
9341                         maildomain="$myhostname$mydomain"
9342                 fi
9343                 ;;
9344         *)  maildomain="$MAILDOMAIN";;
9345         esac
9346         case "$cf_email" in
9347         '') dflt="$cf_by@$maildomain";;
9348         *)  dflt="$cf_email";;
9349         esac
9350         rp='What is your e-mail address?'
9351         . ./myread
9352         cf_email="$ans"
9353         case "$cf_email" in
9354         *@*.*) cont='' ;;
9355         *)
9356                 rp='Address does not look like an Internet one.  Use it anyway?'
9357                 case "$fastread" in
9358                 yes) dflt=y ;;
9359                 *) dflt=n ;;
9360                 esac
9361                 . ./myread
9362                 case "$ans" in
9363                 y*) cont='' ;;
9364                 *) echo " " ;;
9365                 esac
9366                 ;;
9367         esac
9368 done
9369
9370 : Ask e-mail of administrator
9371 $cat <<EOM
9372
9373 If you or somebody else will be maintaining perl at your site, please
9374 fill in the correct e-mail address here so that they may be contacted
9375 if necessary. Currently, the "perlbug" program included with perl
9376 will send mail to this address in addition to perlbug@perl.org. You may
9377 enter "none" for no administrator.
9378
9379 EOM
9380 case "$perladmin" in
9381 '') dflt="$cf_email";;
9382 *) dflt="$perladmin";;
9383 esac
9384 rp='Perl administrator e-mail address'
9385 . ./myread
9386 perladmin="$ans"
9387
9388 : determine whether to use a version number suffix for installed binaries
9389 echo " "
9390 $cat <<EOM
9391 Do you want to use a version number suffix for installed binaries? This
9392 will install 'perl$version' instead of 'perl', and likewise for other
9393 binaries like 'perldoc' and 'cpan'. This allows many versions of perl
9394 to be installed side-by-side. Unless you are a developer, you probably
9395 do *not* want to do this.
9396 EOM
9397 case "$versiononly" in
9398 "$define"|[Yy]*|true) dflt='y' ;;
9399 *) dflt='n';
9400 esac
9401 rp="Do you want to use a version number suffix for installed binaries?"
9402 . ./myread
9403 case "$ans" in
9404 [yY]*)  val="$define";;
9405 *)      val="$undef" ;;
9406 esac
9407 set versiononly
9408 eval $setvar
9409
9410 case "$versiononly" in
9411 "$define") inc_version_list=''
9412            inc_version_list_init=0
9413            ;;
9414 esac
9415
9416 : figure out how to guarantee perl startup
9417 : XXX Note that this currently takes advantage of the bug that binexp ignores
9418 :     the Configure -Dinstallprefix setting, which in turn means that under
9419 :     relocatable @INC, initialinstalllocation is what binexp started as.
9420 case "$startperl" in
9421 '')
9422         case "$sharpbang" in
9423         *!)
9424                 $cat <<EOH
9425
9426 I can use the #! construct to start perl on your system. This will
9427 make startup of perl scripts faster, but may cause problems if you
9428 want to share those scripts and perl is not in a standard place
9429 ($initialinstalllocation/perl) on all your platforms. The alternative
9430 is to force a shell by starting the script with a single ':' character.
9431
9432 EOH
9433                 case "$versiononly" in
9434                 "$define")      dflt="$initialinstalllocation/perl$version";;
9435                 *)              dflt="$initialinstalllocation/perl";;
9436                 esac
9437                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9438                 . ./myread
9439                 case "$ans" in
9440                 none)   startperl=": # use perl";;
9441                 *)      startperl="#!$ans"
9442                         if $test 30 -lt `echo "$ans" | wc -c`; then
9443                                 $cat >&4 <<EOM
9444
9445 WARNING:  Some systems limit the #! command to 32 characters.
9446 If you experience difficulty running Perl scripts with #!, try
9447 installing Perl in a directory with a shorter pathname.
9448
9449 EOM
9450                         fi ;;
9451                 esac
9452                 ;;
9453         *) startperl=": # use perl"
9454                 ;;
9455         esac
9456         ;;
9457 esac
9458 echo "I'll use $startperl to start perl scripts."
9459
9460 : figure best path for perl in scripts
9461 case "$perlpath" in
9462 '')
9463         case "$versiononly" in
9464         "$define")      perlpath="$initialinstalllocation/perl$version";;
9465         *)              perlpath="$initialinstalllocation/perl";;
9466         esac
9467         case "$startperl" in
9468         *!*) ;;
9469         *)
9470                 $cat <<EOH
9471
9472 I will use the "eval 'exec'" idiom to start Perl on your system.
9473 I can use the full path of your Perl binary for this purpose, but
9474 doing so may cause problems if you want to share those scripts and
9475 Perl is not always in a standard place ($initialinstalllocation/perl).
9476
9477 EOH
9478                 dflt="$initialinstalllocation/perl"
9479                 rp="What path shall I use in \"eval 'exec'\"?"
9480                 . ./myread
9481                 perlpath="$ans"
9482                 ;;
9483         esac
9484         ;;
9485 esac
9486 case "$startperl" in
9487 *!*)    ;;
9488 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9489 esac
9490
9491 : determine where public executable scripts go
9492 set scriptdir scriptdir
9493 eval $prefixit
9494 case "$scriptdir" in
9495 '')
9496         dflt="$bin"
9497         : guess some guesses
9498         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9499         $test -d /usr/share/bin     && dflt=/usr/share/bin
9500         $test -d /usr/local/script  && dflt=/usr/local/script
9501         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9502         $test -d $prefixexp/script  && dflt=$prefixexp/script
9503         set dflt
9504         eval $prefixup
9505         ;;
9506 *)  dflt="$scriptdir"
9507         ;;
9508 esac
9509 $cat <<EOM
9510
9511 Some installations have a separate directory just for executable scripts so
9512 that they can mount it across multiple architectures but keep the scripts in
9513 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9514 Or you might just lump your scripts in with all your other executables.
9515
9516 EOM
9517 fn=d~
9518 rp='Where do you keep publicly executable scripts?'
9519 . ./getfile
9520 if $test "X$ansexp" != "X$scriptdirexp"; then
9521         installscript=''
9522 fi
9523 installscriptdir=''
9524 prefixvar=scriptdir
9525 . ./setprefixvar
9526 : A little fix up for an irregularly named variable.
9527 installscript="$installscriptdir"
9528
9529 : determine where add-on public executables go
9530 case "$sitebin" in
9531 '')     dflt=$siteprefix/bin ;;
9532 *)      dflt=$sitebin ;;
9533 esac
9534 fn=d~
9535 rp='Pathname where the add-on public executables should be installed?'
9536 . ./getfile
9537 prefixvar=sitebin
9538 . ./setprefixvar
9539
9540 : determine where add-on html pages go
9541 : There is no standard location, so try to copy the previously-selected
9542 : directory structure for the core html pages.
9543 case "$sitehtml1dir" in
9544 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9545 *)     dflt=$sitehtml1dir ;;
9546 esac
9547 case "$dflt" in
9548 ''|' ') dflt=none ;;
9549 esac
9550 fn=dn+~
9551 rp='Pathname where the site-specific html pages should be installed?'
9552 . ./getfile
9553 prefixvar=sitehtml1dir
9554 . ./setprefixvar
9555
9556 : determine where add-on library html pages go
9557 : There is no standard location, so try to copy the previously-selected
9558 : directory structure for the core html pages.
9559 case "$sitehtml3dir" in
9560 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9561 *)     dflt=$sitehtml3dir ;;
9562 esac
9563 case "$dflt" in
9564 ''|' ') dflt=none ;;
9565 esac
9566 fn=dn+~
9567 rp='Pathname where the site-specific library html pages should be installed?'
9568 . ./getfile
9569 prefixvar=sitehtml3dir
9570 . ./setprefixvar
9571
9572 : determine where add-on manual pages go
9573 case "$siteman1dir" in
9574 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9575 *)      dflt=$siteman1dir ;;
9576 esac
9577 case "$dflt" in
9578 ''|' ') dflt=none ;;
9579 esac
9580 fn=dn+~
9581 rp='Pathname where the site-specific manual pages should be installed?'
9582 . ./getfile
9583 prefixvar=siteman1dir
9584 . ./setprefixvar
9585
9586 : determine where add-on library man pages go
9587 case "$siteman3dir" in
9588 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9589 *)      dflt=$siteman3dir ;;
9590 esac
9591 case "$dflt" in
9592 ''|' ') dflt=none ;;
9593 esac
9594 fn=dn+~
9595 rp='Pathname where the site-specific library manual pages should be installed?'
9596 . ./getfile
9597 prefixvar=siteman3dir
9598 . ./setprefixvar
9599
9600 : determine where add-on public executable scripts go
9601 case "$sitescript" in
9602 '')     dflt=$siteprefix/script
9603         $test -d $dflt || dflt=$sitebin ;;
9604 *)  dflt="$sitescript" ;;
9605 esac
9606 fn=d~+
9607 rp='Pathname where add-on public executable scripts should be installed?'
9608 . ./getfile
9609 prefixvar=sitescript
9610 . ./setprefixvar
9611
9612 : see if backtrace exists
9613 set backtrace d_backtrace
9614 eval $inlibc
9615
9616 : add flags if using c backtrace
9617 case "$usecbacktrace" in
9618   "") usecbacktrace=$undef ;;
9619   [yY]*|true|$define)
9620     case "$d_backtrace" in
9621       [yY]*|true|$define)
9622         case " $ccflags " in
9623           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9624           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9625           esac
9626         ;;
9627       *)
9628         echo "This system does not support backtrace" >&4
9629         usecbacktrace=$undef
9630         ;;
9631       esac
9632     ;;
9633   esac
9634
9635 : Check if faststdio is requested and available
9636 case "$usefaststdio" in
9637 $define|true|[yY]*|'')
9638         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9639         case "$xversion" in
9640         [68])   dflt='y' ;;
9641         *)      dflt='n' ;;
9642         esac
9643         ;;
9644 *) dflt='n';;
9645 esac
9646 cat <<EOM
9647
9648 Perl can be built to use 'fast stdio', which means using the stdio
9649 library but also directly manipulating the stdio buffers to enable
9650 faster I/O.  Using stdio is better for backward compatibility (especially
9651 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9652 interface has been preferred instead of stdio.
9653
9654 If this doesn't make any sense to you, just accept the default '$dflt'.
9655 EOM
9656 rp='Use the "fast stdio" if available?'
9657 . ./myread
9658 case "$ans" in
9659 y|Y)    val="$define" ;;
9660 *)      val="$undef" ;;
9661 esac
9662 set usefaststdio
9663 eval $setvar
9664
9665
9666 : define an is-a-typedef? function
9667 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9668 case "$inclist" in
9669 "") inclist="sys/types.h";;
9670 esac;
9671 eval "varval=\$$var";
9672 case "$varval" in
9673 "")
9674         $rm -f temp.c;
9675         for inc in $inclist; do
9676                 echo "#include <$inc>" >>temp.c;
9677         done;
9678         echo "#ifdef $type" >> temp.c;
9679         echo "printf(\"We have $type\");" >> temp.c;
9680         echo "#endif" >> temp.c;
9681         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9682         if $contains $type temp.E >/dev/null 2>&1; then
9683                 eval "$var=\$type";
9684         else
9685                 eval "$var=\$def";
9686         fi;
9687         $rm -f temp.?;;
9688 *) eval "$var=\$varval";;
9689 esac'
9690
9691 : define an is-a-typedef? function that prompts if the type is not available.
9692 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9693 case "$inclist" in
9694 "") inclist="sys/types.h";;
9695 esac;
9696 eval "varval=\$$var";
9697 case "$varval" in
9698 "")
9699         $rm -f temp.c;
9700         for inc in $inclist; do
9701                 echo "#include <$inc>" >>temp.c;
9702         done;
9703         echo "#ifdef $type" >> temp.c;
9704         echo "printf(\"We have $type\");" >> temp.c;
9705         echo "#endif" >> temp.c;
9706         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9707         echo " " ;
9708         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9709         if $contains $type temp.E >/dev/null 2>&1; then
9710                 echo "$type found." >&4;
9711                 eval "$var=\$type";
9712         else
9713                 echo "$type NOT found." >&4;
9714                 dflt="$def";
9715                 . ./myread ;
9716                 eval "$var=\$ans";
9717         fi;
9718         $rm -f temp.?;;
9719 *) eval "$var=\$varval";;
9720 esac'
9721
9722 : see what type lseek is declared as in the kernel
9723 rp="What is the type used for lseek's offset on this system?"
9724 set off_t lseektype long stdio.h sys/types.h
9725 eval $typedef_ask
9726
9727 echo " "
9728 echo "Checking to see how big your file offsets are..." >&4
9729 $cat >try.c <<EOCP
9730 #include <sys/types.h>
9731 #include <stdio.h>
9732 int main()
9733 {
9734     printf("%d\n", (int)sizeof($lseektype));
9735     return(0);
9736 }
9737 EOCP
9738 set try
9739 if eval $compile_ok; then
9740         lseeksize=`$run ./try`
9741         echo "Your file offsets are $lseeksize bytes long."
9742 else
9743         dflt=$longsize
9744         echo " "
9745         echo "(I can't seem to compile the test program.  Guessing...)"
9746         rp="What is the size of your file offsets (in bytes)?"
9747         . ./myread
9748         lseeksize="$ans"
9749 fi
9750 $rm_try
9751
9752 : see what type file positions are declared as in the library
9753 rp="What is the type for file position used by fsetpos()?"
9754 set fpos_t fpostype long stdio.h sys/types.h
9755 eval $typedef_ask
9756
9757 : Check size for Fpos_t
9758 echo " "
9759 case "$fpostype" in
9760 *_t) zzz="$fpostype"    ;;
9761 *)   zzz="fpos_t"       ;;
9762 esac
9763 echo "Checking the size of $zzz..." >&4
9764 cat > try.c <<EOCP
9765 #include <sys/types.h>
9766 #include <stdio.h>
9767 #$i_stdlib I_STDLIB
9768 #ifdef I_STDLIB
9769 #include <stdlib.h>
9770 #endif
9771 int main() {
9772     printf("%d\n", (int)sizeof($fpostype));
9773     exit(0);
9774 }
9775 EOCP
9776 set try
9777 if eval $compile_ok; then
9778         yyy=`$run ./try`
9779         case "$yyy" in
9780         '')     fpossize=4
9781                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9782                 ;;
9783         *)      fpossize=$yyy
9784                 echo "Your $zzz is $fpossize bytes long."
9785                 ;;
9786         esac
9787 else
9788         dflt="$longsize"
9789         echo " " >&4
9790         echo "(I can't compile the test program.  Guessing...)" >&4
9791         rp="What is the size of your file positions (in bytes)?"
9792         . ./myread
9793         fpossize="$ans"
9794 fi
9795
9796 : Check for large file support
9797 # Backward compatibility (uselfs is deprecated).
9798 case "$uselfs" in
9799 "$define"|true|[yY]*)
9800         cat <<EOM >&4
9801
9802 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9803 EOM
9804         uselargefiles="$define"
9805         ;;
9806 esac
9807
9808 case "$lseeksize:$fpossize" in
9809 8:8) cat <<EOM
9810
9811 You can have files larger than 2 gigabytes.
9812 EOM
9813    val="$define" ;;
9814 *)    case "$uselargefiles" in
9815    "$undef"|false|[nN]*) dflt='n' ;;
9816    *)   dflt='y' ;;
9817    esac
9818    cat <<EOM
9819
9820 Perl can be built to understand large files (files larger than 2 gigabytes)
9821 on some systems.  To do so, Configure can be run with -Duselargefiles.
9822
9823 If this doesn't make any sense to you, just accept the default '$dflt'.
9824 EOM
9825    rp='Try to understand large files, if available?'
9826    . ./myread
9827    case "$ans" in
9828    y|Y)         val="$define" ;;
9829    *)           val="$undef"  ;;
9830    esac
9831    ;;
9832 esac
9833 set uselargefiles
9834 eval $setvar
9835 : Look for a hint-file generated 'call-back-unit'.  If the
9836 : user has specified that a large files perl is to be built,
9837 : we may need to set or change some other defaults.
9838 if $test -f uselargefiles.cbu; then
9839         echo "Your platform has some specific hints regarding large file builds, using them..."
9840         . ./uselargefiles.cbu
9841 fi
9842 case "$uselargefiles" in
9843 "$define")
9844         if $test -f uselargefiles.cbu; then
9845                 echo " "
9846                 echo "Rechecking to see how big your file offsets are..." >&4
9847                 $cat >try.c <<EOCP
9848 #include <sys/types.h>
9849 #include <stdio.h>
9850 int main()
9851 {
9852     printf("%d\n", (int)sizeof($lseektype));
9853     return(0);
9854 }
9855 EOCP
9856                 set try
9857                 if eval $compile_ok; then
9858                         lseeksize=`$run ./try`
9859                         $echo "Your file offsets are now $lseeksize bytes long."
9860                 else
9861                         dflt="$lseeksize"
9862                         echo " "
9863                         echo "(I can't seem to compile the test program.  Guessing...)"
9864                         rp="What is the size of your file offsets (in bytes)?"
9865                         . ./myread
9866                         lseeksize="$ans"
9867                 fi
9868                 case "$fpostype" in
9869                 *_t) zzz="$fpostype"    ;;
9870                 *)   zzz="fpos_t"       ;;
9871                 esac
9872                 $echo $n "Rechecking the size of $zzz...$c" >&4
9873                 $cat > try.c <<EOCP
9874 #include <sys/types.h>
9875 #include <stdio.h>
9876 #$i_stdlib I_STDLIB
9877 #ifdef I_STDLIB
9878 #include <stdlib.h>
9879 #endif
9880 int main() {
9881     printf("%d\n", (int)sizeof($fpostype));
9882     return(0);
9883 }
9884 EOCP
9885                 set try
9886                 if eval $compile_ok; then
9887                         yyy=`$run ./try`
9888                         dflt="$lseeksize"
9889                         case "$yyy" in
9890                         '')     echo " "
9891                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9892                                 ;;
9893                         *)      fpossize=$yyy
9894                                 echo " $fpossize bytes." >&4
9895                                 ;;
9896                         esac
9897                 else
9898                         dflt="$fpossize"
9899                         echo " "
9900                         echo "(I can't compile the test program.  Guessing...)" >&4
9901                         rp="What is the size of your file positions (in bytes)?"
9902                         . ./myread
9903                         fpossize="$ans"
9904                 fi
9905                 $rm_try
9906         fi
9907         ;;
9908 esac
9909
9910 : Check if we want perlio
9911 useperlio="$define"
9912
9913 : Set the vendorbin variables
9914 case "$vendorprefix" in
9915 '')     d_vendorbin="$undef"
9916         vendorbin=''
9917         vendorbinexp=''
9918         ;;
9919 *)      d_vendorbin="$define"
9920         : determine where vendor-supplied executables go.
9921         case "$vendorbin" in
9922         '') dflt=$vendorprefix/bin ;;
9923         *)      dflt="$vendorbin" ;;
9924         esac
9925         fn=d~+
9926         rp='Pathname for the vendor-supplied executables directory?'
9927         . ./getfile
9928         vendorbin="$ans"
9929         vendorbinexp="$ansexp"
9930         ;;
9931 esac
9932 prefixvar=vendorbin
9933 . ./installprefix
9934
9935 : Set the vendorhtml1dir variables
9936 case "$vendorprefix" in
9937 '')     vendorhtml1dir=''
9938         vendorhtml1direxp=''
9939         ;;
9940 *)      : determine where vendor-supplied html pages go.
9941         : There is no standard location, so try to copy the previously-selected
9942         : directory structure for the core html pages.
9943         : XXX Better default suggestions would be welcome.
9944         case "$vendorhtml1dir" in
9945         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9946         *)      dflt=$vendorhtml1dir ;;
9947         esac
9948         case "$dflt" in
9949         ''|' ') dflt=none ;;
9950         esac
9951         fn=dn+~
9952         rp='Pathname for the vendor-supplied html pages?'
9953         . ./getfile
9954         vendorhtml1dir="$ans"
9955         vendorhtml1direxp="$ansexp"
9956         ;;
9957 esac
9958 : Use ' ' for none so value is preserved next time through Configure
9959 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9960 prefixvar=vendorhtml1dir
9961 . ./installprefix
9962
9963 : Set the vendorhtml3dir variables
9964 case "$vendorprefix" in
9965 '')     vendorhtml3dir=''
9966         vendorhtml3direxp=''
9967         ;;
9968 *)      : determine where vendor-supplied module html pages go.
9969         : There is no standard location, so try to copy the previously-selected
9970         : directory structure for the core html pages.
9971         : XXX Better default suggestions would be welcome.
9972         case "$vendorhtml3dir" in
9973         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9974         *)      dflt=$vendorhtml3dir ;;
9975         esac
9976         case "$dflt" in
9977         ''|' ') dflt=none ;;
9978         esac
9979         fn=dn+~
9980         rp='Pathname for the vendor-supplied html pages?'
9981         . ./getfile
9982         vendorhtml3dir="$ans"
9983         vendorhtml3direxp="$ansexp"
9984         ;;
9985 esac
9986 : Use ' ' for none so value is preserved next time through Configure
9987 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9988 prefixvar=vendorhtml3dir
9989 . ./installprefix
9990
9991 : Set the vendorman1dir variables
9992 case "$vendorprefix" in
9993 '')     vendorman1dir=''
9994         vendorman1direxp=''
9995         ;;
9996 *)      : determine where vendor-supplied manual pages go.
9997         case "$vendorman1dir" in
9998         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9999         *)      dflt=$vendorman1dir ;;
10000         esac
10001         case "$dflt" in
10002         ''|' ') dflt=none ;;
10003         esac
10004         fn=nd~+
10005         rp='Pathname for the vendor-supplied manual section 1 pages?'
10006         . ./getfile
10007         vendorman1dir="$ans"
10008         vendorman1direxp="$ansexp"
10009         ;;
10010 esac
10011 : Use ' ' for none so value is preserved next time through Configure
10012 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
10013 prefixvar=vendorman1dir
10014 . ./installprefix
10015
10016 : Set the vendorman3dir variables
10017 case "$vendorprefix" in
10018 '')     vendorman3dir=''
10019         vendorman3direxp=''
10020         ;;
10021 *)      : determine where vendor-supplied module manual pages go.
10022         case "$vendorman3dir" in
10023         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10024         *)      dflt=$vendorman3dir ;;
10025         esac
10026         case "$dflt" in
10027         ''|' ') dflt=none ;;
10028         esac
10029         fn=nd~+
10030         rp='Pathname for the vendor-supplied manual section 3 pages?'
10031         . ./getfile
10032         vendorman3dir="$ans"
10033         vendorman3direxp="$ansexp"
10034         ;;
10035 esac
10036 : Use ' ' for none so value is preserved next time through Configure
10037 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
10038 prefixvar=vendorman3dir
10039 . ./installprefix
10040
10041 : Set the vendorscript variables
10042 case "$vendorprefix" in
10043 '')     d_vendorscript="$undef"
10044         vendorscript=''
10045         vendorscriptexp=''
10046         ;;
10047 *)      d_vendorscript="$define"
10048         : determine where vendor-supplied scripts go.
10049         case "$vendorscript" in
10050         '')     dflt=$vendorprefix/script
10051                 $test -d $dflt || dflt=$vendorbin ;;
10052         *)  dflt="$vendorscript" ;;
10053         esac
10054         $cat <<EOM
10055
10056 The installation process will create a directory for
10057 vendor-supplied scripts.
10058
10059 EOM
10060         fn=d~+
10061         rp='Pathname for the vendor-supplied scripts directory?'
10062         . ./getfile
10063         vendorscript="$ans"
10064         vendorscriptexp="$ansexp"
10065         ;;
10066 esac
10067 prefixvar=vendorscript
10068 . ./installprefix
10069
10070 : script used to emit important warnings
10071 cat >warn <<EOS
10072 $startsh
10073 if test \$# -gt 0; then
10074         echo "\$@" >msg
10075 else
10076         cat >msg
10077 fi
10078 echo "*** WARNING:" >&4
10079 sed -e 's/^/*** /' <msg >&4
10080 echo "*** " >&4
10081 cat msg >>config.msg
10082 echo " " >>config.msg
10083 rm -f msg
10084 EOS
10085 chmod +x warn
10086 $eunicefix warn
10087
10088 : see which of string.h or strings.h is needed
10089 echo " "
10090 strings=`./findhdr string.h`
10091 if $test "$strings" && $test -r "$strings"; then
10092         echo "Using <string.h> instead of <strings.h>." >&4
10093         val="$define"
10094 else
10095         val="$undef"
10096         strings=`./findhdr strings.h`
10097         if $test "$strings" && $test -r "$strings"; then
10098                 echo "Using <strings.h> instead of <string.h>." >&4
10099         else
10100                 ./warn "No string header found -- You'll surely have problems."
10101         fi
10102 fi
10103 set i_string
10104 eval $setvar
10105 case "$i_string" in
10106 "$undef") strings=`./findhdr strings.h`;;
10107 *)        strings=`./findhdr string.h`;;
10108 esac
10109
10110 : see if qgcvt exists
10111 set qgcvt d_qgcvt
10112 eval $inlibc
10113
10114 : Check what kind of doubles your system has
10115 $echo "Checking the kind of doubles you have..." >&4
10116 $cat >try.c <<EOP
10117 #$i_stdlib I_STDLIB
10118 #define DOUBLESIZE $doublesize
10119 #ifdef I_STDLIB
10120 #include <stdlib.h>
10121 #endif
10122 #include <stdio.h>
10123 static const double d = -0.1;
10124 int main() {
10125   unsigned const char* b = (unsigned const char*)(&d);
10126 #if DOUBLESIZE == 4
10127   if (b[0] == 0xCD && b[3] == 0xBD) {
10128     /* IEEE 754 32-bit little-endian */
10129     printf("1\n");
10130     exit(0);
10131   }
10132   if (b[0] == 0xBD && b[3] == 0xCD) {
10133     /* IEEE 754 32-bit big-endian */
10134     printf("2\n");
10135     exit(0);
10136   }
10137   if (b[0] == 0xCC && b[3] == 0xCC) {
10138     /* VAX format F, 32-bit PDP-style mixed endian. */
10139     printf("9\n");
10140     exit(0);
10141   }
10142   if (b[0] == 0xC0 && b[3] == 0x9A) {
10143     /* IBM single 32-bit */
10144     printf("12\n");
10145     exit(0);
10146   }
10147 #endif
10148 #if DOUBLESIZE == 8
10149   if (b[0] == 0x9A && b[7] == 0xBF) {
10150     /* IEEE 754 64-bit little-endian */
10151     printf("3\n");
10152     exit(0);
10153   }
10154   if (b[0] == 0xBF && b[7] == 0x9A) {
10155     /* IEEE 754 64-bit big-endian */
10156     printf("4\n");
10157     exit(0);
10158   }
10159   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10160    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10161     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10162     * 99 99 b9 bf 9a 99 99 99 */
10163     printf("7\n");
10164     exit(0);
10165   }
10166   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10167    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10168     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10169     * 99 99 99 9a bf b9 99 99 */
10170     printf("8\n");
10171     exit(0);
10172   }
10173   if (b[0] == 0xCC && b[7] == 0xCC) {
10174    /* VAX format D, 64-bit PDP-style mixed endian. */
10175     printf("10\n");
10176     exit(0);
10177   }
10178   if (b[0] == 0xD9 && b[7] == 0x99) {
10179    /* VAX format G, 64-bit PDP-style mixed endian. */
10180     printf("11\n");
10181     exit(0);
10182   }
10183   if (b[0] == 0xC0 && b[7] == 0x9A) {
10184     /* IBM double 64-bit */
10185     printf("13\n");
10186     exit(0);
10187   }
10188   if (b[0] == 0xBF && b[7] == 0xCD) {
10189     /* CRAY single 64-bit */
10190     printf("14\n");
10191     exit(0);
10192   }
10193 #endif
10194 #if DOUBLESIZE == 16
10195   if (b[0] == 0x9A && b[15] == 0xBF) {
10196     /* IEEE 754 128-bit little-endian */
10197     printf("5\n");
10198     exit(0);
10199   }
10200   if (b[0] == 0xBF && b[15] == 0x9A) {
10201     /* IEEE 754 128-bit big-endian */
10202     printf("6\n");
10203     exit(0);
10204   }
10205 #endif
10206   /* Then there are old mainframe/miniframe formats like IBM and CRAY.
10207    * Whether those environments can still build Perl is debatable. */
10208   printf("-1\n"); /* unknown */
10209   exit(0);
10210 }
10211 EOP
10212 set try
10213 if eval $compile; then
10214     doublekind=`$run ./try`
10215 else
10216     doublekind=-1
10217 fi
10218 case "$doublekind" in
10219 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10220 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10221 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10222 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10223 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10224 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10225 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10226 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10227 9) echo "You have VAX format F 32-bit PDP-style mixed endian doubles." >&4 ;;
10228 10) echo "You have VAX format D 64-bit PDP-style mixed endian doubles." >&4 ;;
10229 11) echo "You have VAX format G 64-bit PDP-style mixed endian doubles." >&4 ;;
10230 12) echo "You have IBM short 32-bit doubles." >&4 ;;
10231 13) echo "You have IBM long 64-bit doubles." >&4 ;;
10232 14) echo "You have Cray single 64-bit doubles." >&4 ;;
10233 *) echo "Cannot figure out your double.  You Cyber, or something?" >&4 ;;
10234 esac
10235 d_double_style_ieee=$undef
10236 d_double_style_vax=$undef
10237 d_double_style_ibm=$undef
10238 d_double_style_cray=$undef
10239 case "$doublekind" in
10240 1|2|3|4|5|6|7|8) d_double_style_ieee=$define ;;
10241 9|10|11) d_double_style_vax=$define ;;
10242 12|13) d_double_style_ibm=$define ;;
10243 14) d_double_style_cray=$define ;;
10244 esac
10245 case "$d_double_style_ieee" in
10246 $define)
10247     d_double_has_inf=$define
10248     d_double_has_nan=$define
10249     d_double_has_negative_zero=$define
10250     d_double_has_subnormals=$define
10251     ;;
10252 *)
10253     d_double_has_inf=$undef
10254     d_double_has_nan=$undef
10255     d_double_has_negative_zero=$undef
10256     d_double_has_subnormals=$undef
10257     ;;
10258 esac
10259 $rm_try
10260
10261 : Check print/scan long double stuff
10262 echo " "
10263
10264 if $test X"$d_longdbl" = X"$define"; then
10265
10266 echo "Checking how to print long doubles..." >&4
10267
10268 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10269         $cat >try.c <<'EOCP'
10270 #include <sys/types.h>
10271 #include <stdio.h>
10272 int main() {
10273   double d = 123.456;
10274   printf("%.3f\n", d);
10275 }
10276 EOCP
10277         set try
10278         if eval $compile; then
10279                 yyy=`$run ./try`
10280                 case "$yyy" in
10281                 123.456)
10282                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10283                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10284                         echo "We will use %f."
10285                         ;;
10286                 esac
10287         fi
10288 fi
10289
10290 if $test X"$sPRIfldbl" = X; then
10291         $cat >try.c <<'EOCP'
10292 #include <sys/types.h>
10293 #include <stdio.h>
10294 int main() {
10295   long double d = 123.456;
10296   printf("%.3Lf\n", d);
10297 }
10298 EOCP
10299         set try
10300         if eval $compile; then
10301                 yyy=`$run ./try`
10302                 case "$yyy" in
10303                 123.456)
10304                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10305                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10306                         echo "We will use %Lf."
10307                         ;;
10308                 esac
10309         fi
10310 fi
10311
10312 if $test X"$sPRIfldbl" = X; then
10313         $cat >try.c <<'EOCP'
10314 #include <sys/types.h>
10315 #include <stdio.h>
10316 int main() {
10317   long double d = 123.456;
10318   printf("%.3llf\n", d);
10319 }
10320 EOCP
10321         set try
10322         if eval $compile; then
10323                 yyy=`$run ./try`
10324                 case "$yyy" in
10325                 123.456)
10326                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10327                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10328                         echo "We will use %llf."
10329                         ;;
10330                 esac
10331         fi
10332 fi
10333
10334 if $test X"$sPRIfldbl" = X; then
10335         $cat >try.c <<'EOCP'
10336 #include <sys/types.h>
10337 #include <stdio.h>
10338 int main() {
10339   long double d = 123.456;
10340   printf("%.3lf\n", d);
10341 }
10342 EOCP
10343         set try
10344         if eval $compile; then
10345                 yyy=`$run ./try`
10346                 case "$yyy" in
10347                 123.456)
10348                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10349                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10350                         echo "We will use %lf."
10351                         ;;
10352                 esac
10353         fi
10354 fi
10355
10356 if $test X"$sPRIfldbl" = X; then
10357         echo "Cannot figure out how to print long doubles." >&4
10358 else
10359         sSCNfldbl=$sPRIfldbl    # expect consistency
10360 fi
10361
10362 $rm_try
10363
10364 fi # d_longdbl
10365
10366 case "$sPRIfldbl" in
10367 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10368         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10369         d_SCNfldbl="$undef";
10370         ;;
10371 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10372         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10373         d_SCNfldbl="$define";
10374         ;;
10375 esac
10376
10377 : Before committing on uselongdouble, see whether that looks sane.
10378 if $test "$uselongdouble" = "$define"; then
10379     message=""
10380     echo " "
10381     echo "Checking if your long double math functions work right..." >&4
10382     $cat > try.c <<EOF
10383 #include <math.h>
10384 #include <stdio.h>
10385 int main() {
10386   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10387 }
10388 EOF
10389     case "$osname:$gccversion" in
10390     aix:)       saveccflags="$ccflags"
10391                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10392     esac
10393     set try
10394     if eval $compile_ok; then
10395       yyy=`$run ./try`
10396     fi
10397     case "$yyy" in
10398     3) echo "Your long double math functions are working correctly." >&4 ;;
10399     *) echo "Your long double math functions are broken, not using long doubles." >&4
10400        uselongdouble=$undef
10401        ;;
10402     esac
10403     $rm_try
10404     case "$osname:$gccversion" in
10405     aix:)       ccflags="$saveccflags" ;; # restore
10406     esac
10407 fi
10408
10409 : Check how to convert floats to strings.
10410
10411 if test "X$d_Gconvert" = X; then
10412
10413 echo " "
10414 echo "Checking for an efficient way to convert floats to strings."
10415 echo " " > try.c
10416 case "$uselongdouble" in
10417 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10418 esac
10419 case "$d_longdbl" in
10420 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10421 esac
10422 case "$d_PRIgldbl" in
10423 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10424 esac
10425 $cat >>try.c <<EOP
10426 #ifdef TRY_gconvert
10427 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10428 char *myname = "gconvert";
10429 #endif
10430 #ifdef TRY_gcvt
10431 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10432 char *myname = "gcvt";
10433 #endif
10434 #ifdef TRY_qgcvt
10435 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10436 char *myname = "qgcvt";
10437 #define DOUBLETYPE long double
10438 #endif
10439 #ifdef TRY_sprintf
10440 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10441 #ifdef HAS_PRIgldbl
10442 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10443 #else
10444 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10445 #endif
10446 #else
10447 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10448 #endif
10449 char *myname = "sprintf";
10450 #endif
10451
10452 #ifndef DOUBLETYPE
10453 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10454 #define DOUBLETYPE long double
10455 #else
10456 #define DOUBLETYPE double
10457 #endif
10458 #endif
10459
10460 #include <stdio.h>
10461
10462 #$i_stdlib I_STDLIB
10463 #ifdef I_STDLIB
10464 #include <stdlib.h>
10465 #endif
10466 #$i_string I_STRING
10467 #ifdef I_STRING
10468 #  include <string.h>
10469 #else
10470 #  include <strings.h>
10471 #endif
10472
10473 int checkit(char *expect, char *got)
10474 {
10475     if (strcmp(expect, got)) {
10476                 printf("%s oddity:  Expected %s, got %s\n",
10477                         myname, expect, got);
10478                 exit(1);
10479         }
10480 }
10481
10482 int main()
10483 {
10484         char buf[64];
10485         buf[63] = '\0';
10486
10487         /* This must be 1st test on (which?) platform */
10488         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10489         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10490         checkit("0.1", buf);
10491
10492         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10493         checkit("0.01", buf);
10494
10495         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10496         checkit("0.001", buf);
10497
10498         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10499         checkit("0.0001", buf);
10500
10501         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10502         if (strlen(buf) > 5)
10503             checkit("9e-005", buf); /* for Microsoft ?? */
10504         else
10505             checkit("9e-05", buf);
10506
10507         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10508         checkit("1", buf);
10509
10510         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10511         checkit("1.1", buf);
10512
10513         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10514         checkit("1.01", buf);
10515
10516         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10517         checkit("1.001", buf);
10518
10519         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10520         checkit("1.0001", buf);
10521
10522         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10523         checkit("1.00001", buf);
10524
10525         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10526         checkit("1.000001", buf);
10527
10528         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10529         checkit("0", buf);
10530
10531         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10532         checkit("-1", buf);
10533
10534         /* Some Linux gcvt's give 1.e+5 here. */
10535         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10536         checkit("100000", buf);
10537
10538         /* Some Linux gcvt's give -1.e+5 here. */
10539         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10540         checkit("-100000", buf);
10541
10542         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10543         checkit("123.456", buf);
10544
10545         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10546         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10547         /* 34 should be enough to scare even long double
10548          * places into using the e notation. */
10549         if (strlen(buf) > 5)
10550             checkit("1e+034", buf); /* for Microsoft */
10551         else
10552             checkit("1e+34", buf);
10553
10554         /* For Perl, if you add additional tests here, also add them to
10555          * t/base/num.t for benefit of platforms not using Configure or
10556          * overriding d_Gconvert */
10557
10558         exit(0);
10559 }
10560 EOP
10561 : first add preferred functions to our list
10562 xxx_list=""
10563 for xxx_convert in $gconvert_preference; do
10564     case $xxx_convert in
10565     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10566     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10567     esac
10568 done
10569 : then add any others
10570 for xxx_convert in gconvert gcvt sprintf; do
10571     case "$xxx_list" in
10572     *$xxx_convert*) ;;
10573     *) xxx_list="$xxx_list $xxx_convert" ;;
10574     esac
10575 done
10576
10577 case "$d_longdbl$uselongdouble" in
10578 "$define$define")
10579     : again, add preferred functions to our list first
10580     xxx_ld_list=""
10581     for xxx_convert in $gconvert_ld_preference; do
10582         case $xxx_convert in
10583         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10584         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10585         esac
10586     done
10587     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10588     for xxx_convert in qgcvt sprintf $xxx_list; do
10589         case "$xxx_ld_list" in
10590         $xxx_convert*|*" $xxx_convert"*) ;;
10591         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10592         esac
10593     done
10594     : if sprintf cannot do long doubles, move it to the end
10595     if test "$d_PRIgldbl" != "$define"; then
10596         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10597     fi
10598     : if no qgcvt, remove it
10599     if test "$d_qgcvt" != "$define"; then
10600         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10601     fi
10602     : use the ld_list
10603     xxx_list="$xxx_ld_list"
10604     ;;
10605 esac
10606
10607 for xxx_convert in $xxx_list; do
10608         echo "Trying $xxx_convert..."
10609         $rm -f try try$_o core
10610         set try -DTRY_$xxx_convert
10611         if eval $compile; then
10612                 echo "$xxx_convert() found." >&4
10613                 if $run ./try; then
10614                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10615                         break;
10616                 else
10617                         echo "...But $xxx_convert didn't work as I expected."
10618                         xxx_convert=''
10619                 fi
10620         else
10621                 echo "$xxx_convert NOT found." >&4
10622         fi
10623 done
10624
10625 if test X$xxx_convert = X; then
10626     echo "*** WHOA THERE!!! ***" >&4
10627     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10628     xxx_convert=sprintf
10629 fi
10630
10631 case "$xxx_convert" in
10632 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10633 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10634 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10635 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10636    "$define$define$define")
10637       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10638    "$define$define$undef")
10639       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10640    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10641    esac
10642    ;;
10643 esac
10644
10645 fi
10646 $rm_try
10647
10648 : see if _fwalk exists
10649 set fwalk d__fwalk
10650 eval $inlibc
10651
10652 : Initialize h_fcntl
10653 h_fcntl=false
10654
10655 : Initialize h_sysfile
10656 h_sysfile=false
10657
10658 : access call always available on UNIX
10659 set access d_access
10660 eval $inlibc
10661
10662 : locate the flags for 'access()'
10663 case "$d_access" in
10664 "$define")
10665         echo " "
10666         $cat >access.c <<EOCP
10667 #include <sys/types.h>
10668 #ifdef I_FCNTL
10669 #include <fcntl.h>
10670 #endif
10671 #ifdef I_SYS_FILE
10672 #include <sys/file.h>
10673 #endif
10674 #ifdef I_UNISTD
10675 #include <unistd.h>
10676 #endif
10677 #$i_stdlib I_STDLIB
10678 #ifdef I_STDLIB
10679 #include <stdlib.h>
10680 #endif
10681 int main() {
10682         exit(R_OK);
10683 }
10684 EOCP
10685         : check sys/file.h first, no particular reason here
10686         if $test `./findhdr sys/file.h` && \
10687                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10688                 h_sysfile=true;
10689                 echo "<sys/file.h> defines the *_OK access constants." >&4
10690         elif $test `./findhdr fcntl.h` && \
10691                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10692                 h_fcntl=true;
10693                 echo "<fcntl.h> defines the *_OK access constants." >&4
10694         elif $test `./findhdr unistd.h` && \
10695                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10696                 echo "<unistd.h> defines the *_OK access constants." >&4
10697         else
10698                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10699         fi
10700         ;;
10701 esac
10702 $rm -f access*
10703
10704 : see if accessx exists
10705 set accessx d_accessx
10706 eval $inlibc
10707
10708 : see if acosh exists
10709 set acosh d_acosh
10710 eval $inlibc
10711
10712 : see if aintl exists
10713 set aintl d_aintl
10714 eval $inlibc
10715
10716 : see if alarm exists
10717 set alarm d_alarm
10718 eval $inlibc
10719
10720 : see if 64bit time functions exists
10721
10722 set ctime64 d_ctime64
10723 eval $inlibc
10724
10725 set localtime64 d_localtime64
10726 eval $inlibc
10727
10728 set gmtime64 d_gmtime64
10729 eval $inlibc
10730
10731 set mktime64 d_mktime64
10732 eval $inlibc
10733
10734 set difftime64 d_difftime64
10735 eval $inlibc
10736
10737 set asctime64 d_asctime64
10738 eval $inlibc
10739
10740 : see if POSIX threads are available
10741 set pthread.h i_pthread
10742 eval $inhdr
10743
10744 : define a function to check prototypes
10745 $cat > protochk <<EOSH
10746 $startsh
10747 cc="$cc"
10748 optimize="$optimize"
10749 ccflags="$ccflags"
10750 define="$define"
10751 rm_try="$rm_try"
10752 usethreads=$usethreads
10753 i_pthread=$i_pthread
10754 pthread_h_first=$pthread_h_first
10755 EOSH
10756
10757 $cat >> protochk <<'EOSH'
10758
10759 $rm_try
10760 foo="$1"
10761 shift
10762 while test $# -ge 2; do
10763         case "$1" in
10764                 $define) echo "#include <$2>" >> try.c ;;
10765                 literal) echo "$2" >> try.c ;;
10766         esac
10767     # Extra magic for the benefit of systems that need pthread.h
10768     # to be included early to correctly detect threadsafe functions.
10769     # Such functions must guarantee themselves, though, that the usethreads
10770     # and i_pthread have been defined, before calling protochk.
10771     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10772         echo "#include <pthread.h>" >> try.c
10773         pthread_h_done=yes
10774     fi
10775     shift 2
10776 done
10777 cat >> try.c <<'EOCP'
10778 #define _(args) args
10779 EOCP
10780 echo "$foo" >> try.c
10781 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10782 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10783 status=$?
10784 $rm_try
10785 exit $status
10786 EOSH
10787 chmod +x protochk
10788 $eunicefix protochk
10789
10790 : Define hasproto macro for Configure internal use
10791 hasproto='varname=$1; func=$2; shift; shift;
10792 while $test $# -ge 2; do
10793         case "$1" in
10794         $define) echo "#include <$2>";;
10795         esac ;
10796     shift 2;
10797 done > try.c;
10798 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10799 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10800         echo "$func() prototype found.";
10801         val="$define";
10802 else
10803         echo "$func() prototype NOT found.";
10804         val="$undef";
10805 fi;
10806 set $varname;
10807 eval $setvar;
10808 $rm_try tryout.c'
10809
10810 : see if sys/types.h has to be included
10811 set sys/types.h i_systypes
10812 eval $inhdr
10813
10814 : see if sys/select.h has to be included
10815 set sys/select.h i_sysselct
10816 eval $inhdr
10817
10818 : Define hasfield macro for Configure internal use
10819 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10820 while $test $# -ge 2; do
10821         case "$1" in
10822         $define) echo "#include <$2>";;
10823         esac ;
10824     shift 2;
10825 done > try.c;
10826 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10827 set try;
10828 if eval $compile; then
10829         val="$define";
10830 else
10831         val="$undef";
10832 fi;
10833 set $varname;
10834 eval $setvar;
10835 $rm_try'
10836
10837 : see if we should include time.h, sys/time.h, or both
10838 echo " "
10839 if test "X$timeincl" = X; then
10840         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10841         $echo $n "I'm now running the test program...$c"
10842         $cat >try.c <<EOCP
10843 #include <sys/types.h>
10844 #ifdef I_TIME
10845 #include <time.h>
10846 #endif
10847 #ifdef I_SYSTIME
10848 #ifdef SYSTIMEKERNEL
10849 #define KERNEL
10850 #endif
10851 #include <sys/time.h>
10852 #endif
10853 #ifdef I_SYSSELECT
10854 #include <sys/select.h>
10855 #endif
10856 #$i_stdlib I_STDLIB
10857 #ifdef I_STDLIB
10858 #include <stdlib.h>
10859 #endif
10860 int main()
10861 {
10862         struct tm foo;
10863 #ifdef S_TIMEVAL
10864         struct timeval bar;
10865 #endif
10866 #ifdef S_TIMEZONE
10867         struct timezone tzp;
10868 #endif
10869         if (foo.tm_sec == foo.tm_sec)
10870                 exit(0);
10871 #ifdef S_TIMEVAL
10872         if (bar.tv_sec == bar.tv_sec)
10873                 exit(0);
10874 #endif
10875         exit(1);
10876 }
10877 EOCP
10878         flags=''
10879         for s_timezone in '-DS_TIMEZONE' ''; do
10880         sysselect=''
10881         for s_timeval in '-DS_TIMEVAL' ''; do
10882         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10883         for i_time in '' '-DI_TIME'; do
10884         for i_systime in '-DI_SYSTIME' ''; do
10885                 case "$flags" in
10886                 '') $echo $n ".$c"
10887                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10888                         if eval $compile; then
10889                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10890                                 shift
10891                                 flags="$*"
10892                                 echo " "
10893                                 $echo $n "Succeeded with $flags$c"
10894                         fi
10895                         ;;
10896                 esac
10897         done
10898         done
10899         done
10900         done
10901         done
10902         timeincl=''
10903         echo " "
10904         case "$flags" in
10905         *SYSTIMEKERNEL*) i_systimek="$define"
10906                 timeincl=`./findhdr sys/time.h`
10907                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10908         *) i_systimek="$undef";;
10909         esac
10910         case "$flags" in
10911         *I_TIME*) i_time="$define"
10912                 timeincl=`./findhdr time.h`" $timeincl"
10913                 echo "We'll include <time.h>." >&4;;
10914         *) i_time="$undef";;
10915         esac
10916         case "$flags" in
10917         *I_SYSTIME*) i_systime="$define"
10918                 timeincl=`./findhdr sys/time.h`" $timeincl"
10919                 echo "We'll include <sys/time.h>." >&4;;
10920         *) i_systime="$undef";;
10921         esac
10922         $rm_try
10923 fi
10924 : see if struct tm knows about tm_zone
10925 case "$i_systime$i_time" in
10926 *$define*)
10927         echo " "
10928         echo "Checking to see if your struct tm has tm_zone field..." >&4
10929         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10930         eval $hasfield
10931         ;;
10932 *)      val="$undef"
10933         set d_tm_tm_zone
10934         eval $setvar
10935         ;;
10936 esac
10937 case "$d_tm_tm_zone" in
10938 "$define")      echo "Yes, it does."   ;;
10939 *)              echo "No, it doesn't." ;;
10940 esac
10941 : see if struct tm knows about tm_gmtoff
10942 case "$i_systime$i_time" in
10943 *$define*)
10944         echo " "
10945         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10946         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10947         eval $hasfield
10948         ;;
10949 *)      val="$undef"
10950         set d_tm_tm_gmtoff
10951         eval $setvar
10952         ;;
10953 esac
10954 case "$d_tm_tm_gmtoff" in
10955 "$define")      echo "Yes, it does."   ;;
10956 *)              echo "No, it doesn't." ;;
10957 esac
10958
10959 : see if asctime_r exists
10960 set asctime_r d_asctime_r
10961 eval $inlibc
10962 case "$d_asctime_r" in
10963 "$define")
10964         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10965         case "$d_asctime_r_proto:$usethreads" in
10966         ":define")      d_asctime_r_proto=define
10967                 set d_asctime_r_proto asctime_r $hdrs
10968                 eval $hasproto ;;
10969         *)      ;;
10970         esac
10971         case "$d_asctime_r_proto" in
10972         define)
10973         case "$asctime_r_proto" in
10974         ''|0) try='char* asctime_r(const struct tm*, char*);'
10975         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10976         esac
10977         case "$asctime_r_proto" in
10978         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10979         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10980         esac
10981         case "$asctime_r_proto" in
10982         ''|0) try='int asctime_r(const struct tm*, char*);'
10983         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10984         esac
10985         case "$asctime_r_proto" in
10986         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10987         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10988         esac
10989         case "$asctime_r_proto" in
10990         ''|0)   d_asctime_r=undef
10991                 asctime_r_proto=0
10992                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10993         * )     case "$asctime_r_proto" in
10994                 REENTRANT_PROTO*) ;;
10995                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10996                 esac
10997                 echo "Prototype: $try" ;;
10998         esac
10999         ;;
11000         *)      case "$usethreads" in
11001                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
11002                 esac
11003                 d_asctime_r=undef
11004                 asctime_r_proto=0
11005                 ;;
11006         esac
11007         ;;
11008 *)      asctime_r_proto=0
11009         ;;
11010 esac
11011
11012 : see if asinh exists
11013 set asinh d_asinh
11014 eval $inlibc
11015
11016 : see if atanh exists
11017 set atanh d_atanh
11018 eval $inlibc
11019
11020 : see if atolf exists
11021 set atolf d_atolf
11022 eval $inlibc
11023
11024 : see if atoll exists
11025 set atoll d_atoll
11026 eval $inlibc
11027
11028 : Look for GCC-style attribute format
11029 case "$d_attribute_format" in
11030 '')
11031 echo " "
11032 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
11033 $cat >attrib.c <<'EOCP'
11034 #include <stdio.h>
11035 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
11036 EOCP
11037 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11038         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11039                 echo "Your C compiler doesn't support __attribute__((format))."
11040                 val="$undef"
11041         else
11042                 echo "Your C compiler supports __attribute__((format))."
11043                 val="$define"
11044         fi
11045 else
11046         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11047         val="$undef"
11048 fi
11049 ;;
11050 *) val="$d_attribute_format" ;;
11051 esac
11052 set d_attribute_format
11053 eval $setvar
11054 $rm -f attrib*
11055
11056 : Look for GCC-style attribute format with null format allowed
11057 case "$d_printf_format_null" in
11058 '') case "$d_attribute_format" in
11059     $define)
11060         echo " "
11061         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
11062 $cat >attrib.c <<EOCP
11063 #include <stdio.h>
11064 #$i_stdlib I_STDLIB
11065 #ifdef I_STDLIB
11066 #include <stdlib.h>
11067 #endif
11068 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
11069 int null_printf (char* pat,...) { return (int)pat; }
11070 int main () { exit(null_printf(NULL)); }
11071 EOCP
11072         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
11073             : run the executable in case it produces a run-time warning
11074             if $run ./attrib >>attrib.out 2>&1; then
11075                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11076                     echo "Your C compiler doesn't allow __printf__ format to be null."
11077                     val="$undef"
11078                 else
11079                     echo "Your C compiler allows __printf__ format to be null."
11080                     val="$define"
11081                 fi
11082             else
11083             echo "Your C compiler executable failed with __printf__ format null."
11084             val="$undef"
11085         fi
11086     else
11087         echo "Your C compiler fails with __printf__ format null."
11088         val="$undef"
11089     fi
11090     ;;
11091     *)  val="$undef" ;;
11092     esac
11093 ;;
11094 *)  val="$d_printf_format_null" ;;
11095 esac
11096 set d_printf_format_null
11097 eval $setvar
11098 $rm -f attrib*
11099
11100 : Look for GCC-style attribute malloc
11101 case "$d_attribute_malloc" in
11102 '')
11103 echo " "
11104 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11105 $cat >attrib.c <<'EOCP'
11106 #include <stdio.h>
11107 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11108 EOCP
11109 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11110         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11111                 echo "Your C compiler doesn't support __attribute__((malloc))."
11112                 val="$undef"
11113         else
11114                 echo "Your C compiler supports __attribute__((malloc))."
11115                 val="$define"
11116         fi
11117 else
11118         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11119         val="$undef"
11120 fi
11121 ;;
11122 *) val="$d_attribute_malloc" ;;
11123 esac
11124 set d_attribute_malloc
11125 eval $setvar
11126 $rm -f attrib*
11127
11128 : Look for GCC-style attribute nonnull
11129 case "$d_attribute_nonnull" in
11130 '')
11131 echo " "
11132 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11133 $cat >attrib.c <<'EOCP'
11134 #include <stdio.h>
11135 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11136 EOCP
11137 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11138         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11139                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11140                 val="$undef"
11141         else
11142                 echo "Your C compiler supports __attribute__((nonnull))."
11143                 val="$define"
11144         fi
11145 else
11146         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11147         val="$undef"
11148 fi
11149 ;;
11150 *) val="$d_attribute_nonnull" ;;
11151 esac
11152 set d_attribute_nonnull
11153 eval $setvar
11154 $rm -f attrib*
11155
11156 : Look for GCC-style attribute noreturn
11157 case "$d_attribute_noreturn" in
11158 '')
11159 echo " "
11160 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11161 $cat >attrib.c <<'EOCP'
11162 #include <stdio.h>
11163 void fall_over_dead( void ) __attribute__((noreturn));
11164 EOCP
11165 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11166         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11167                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11168                 val="$undef"
11169         else
11170                 echo "Your C compiler supports __attribute__((noreturn))."
11171                 val="$define"
11172         fi
11173 else
11174         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11175         val="$undef"
11176 fi
11177 ;;
11178 *) val="$d_attribute_noreturn" ;;
11179 esac
11180 set d_attribute_noreturn
11181 eval $setvar
11182 $rm -f attrib*
11183
11184 : Look for GCC-style attribute pure
11185 case "$d_attribute_pure" in
11186 '')
11187 echo " "
11188 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11189 $cat >attrib.c <<'EOCP'
11190 #include <stdio.h>
11191 int square( int n ) __attribute__((pure));
11192 EOCP
11193 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11194         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11195                 echo "Your C compiler doesn't support __attribute__((pure))."
11196                 val="$undef"
11197         else
11198                 echo "Your C compiler supports __attribute__((pure))."
11199                 val="$define"
11200         fi
11201 else
11202         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11203         val="$undef"
11204 fi
11205 ;;
11206 *) val="$d_attribute_pure" ;;
11207 esac
11208 set d_attribute_pure
11209 eval $setvar
11210 $rm -f attrib*
11211
11212 : Look for GCC-style attribute unused
11213 case "$d_attribute_unused" in
11214 '')
11215 echo " "
11216 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11217 $cat >attrib.c <<'EOCP'
11218 #include <stdio.h>
11219 int do_something( int dummy __attribute__((unused)), int n );
11220 EOCP
11221 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11222         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11223                 echo "Your C compiler doesn't support __attribute__((unused))."
11224                 val="$undef"
11225         else
11226                 echo "Your C compiler supports __attribute__((unused))."
11227                 val="$define"
11228         fi
11229 else
11230         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11231         val="$undef"
11232 fi
11233 ;;
11234 *) val="$d_attribute_unused" ;;
11235 esac
11236 set d_attribute_unused
11237 eval $setvar
11238 $rm -f attrib*
11239
11240 : Look for GCC-style attribute deprecated
11241 case "$d_attribute_deprecated" in
11242 '')
11243 echo " "
11244 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11245 $cat >attrib.c <<'EOCP'
11246 #include <stdio.h>
11247 int I_am_deprecated(void) __attribute__((deprecated));
11248 EOCP
11249 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11250         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11251                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11252                 val="$undef"
11253         else
11254                 echo "Your C compiler supports __attribute__((deprecated))."
11255                 val="$define"
11256         fi
11257 else
11258         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11259         val="$undef"
11260 fi
11261 ;;
11262 *) val="$d_attribute_deprecated" ;;
11263 esac
11264 set d_attribute_deprecated
11265 eval $setvar
11266 $rm -f attrib*
11267
11268 : Look for GCC-style attribute warn_unused_result
11269 case "$d_attribute_warn_unused_result" in
11270 '')
11271 echo " "
11272 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11273 $cat >attrib.c <<'EOCP'
11274 #include <stdio.h>
11275 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11276 EOCP
11277 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11278         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11279                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11280                 val="$undef"
11281         else
11282                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11283                 val="$define"
11284         fi
11285 else
11286         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11287         val="$undef"
11288 fi
11289 ;;
11290 *) val="$d_attribute_warn_unused_result" ;;
11291 esac
11292 set d_attribute_warn_unused_result
11293 eval $setvar
11294 $rm -f attrib*
11295
11296 : see if getpgrp exists
11297 set getpgrp d_getpgrp
11298 eval $inlibc
11299
11300 case "$d_getpgrp" in
11301 "$define")
11302         echo " "
11303         echo "Checking to see which flavor of getpgrp is in use..."
11304         $cat >try.c <<EOP
11305 #$i_unistd I_UNISTD
11306 #include <sys/types.h>
11307 #ifdef I_UNISTD
11308 #  include <unistd.h>
11309 #endif
11310 #$i_stdlib I_STDLIB
11311 #ifdef I_STDLIB
11312 #include <stdlib.h>
11313 #endif
11314 int main()
11315 {
11316         if (getuid() == 0) {
11317                 printf("(I see you are running Configure as super-user...)\n");
11318                 setuid(1);
11319         }
11320 #ifdef TRY_BSD_PGRP
11321         if (getpgrp(1) == 0)
11322                 exit(0);
11323 #else
11324         if (getpgrp() > 0)
11325                 exit(0);
11326 #endif
11327         exit(1);
11328 }
11329 EOP
11330         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11331                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11332                 val="$define"
11333         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11334                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11335                 val="$undef"
11336         else
11337                 echo "I can't seem to compile and run the test program."
11338                 if ./usg; then
11339                         xxx="a USG one, i.e. you use getpgrp()."
11340                 else
11341                         # SVR4 systems can appear rather BSD-ish.
11342                         case "$i_unistd" in
11343                         $undef)
11344                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11345                                 val="$define"
11346                                 ;;
11347                         $define)
11348                                 xxx="probably a USG one, i.e. you use getpgrp()."
11349                                 val="$undef"
11350                                 ;;
11351                         esac
11352                 fi
11353                 echo "Assuming your getpgrp is $xxx" >&4
11354         fi
11355         ;;
11356 *) val="$undef";;
11357 esac
11358 set d_bsdgetpgrp
11359 eval $setvar
11360 $rm_try
11361
11362 : see if setpgrp exists
11363 set setpgrp d_setpgrp
11364 eval $inlibc
11365
11366 case "$d_setpgrp" in
11367 "$define")
11368         echo " "
11369         echo "Checking to see which flavor of setpgrp is in use..."
11370         $cat >try.c <<EOP
11371 #$i_unistd I_UNISTD
11372 #include <sys/types.h>
11373 #ifdef I_UNISTD
11374 #  include <unistd.h>
11375 #endif
11376 #$i_stdlib I_STDLIB
11377 #ifdef I_STDLIB
11378 #include <stdlib.h>
11379 #endif
11380 int main()
11381 {
11382         if (getuid() == 0) {
11383                 printf("(I see you are running Configure as super-user...)\n");
11384                 setuid(1);
11385         }
11386 #ifdef TRY_BSD_PGRP
11387         if (-1 == setpgrp(1, 1))
11388                 exit(0);
11389 #else
11390         if (setpgrp() != -1)
11391                 exit(0);
11392 #endif
11393         exit(1);
11394 }
11395 EOP
11396         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11397                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11398                 val="$define"
11399         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11400                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11401                 val="$undef"
11402         else
11403                 echo "(I can't seem to compile and run the test program.)"
11404                 if ./usg; then
11405                         xxx="a USG one, i.e. you use setpgrp()."
11406                 else
11407                         # SVR4 systems can appear rather BSD-ish.
11408                         case "$i_unistd" in
11409                         $undef)
11410                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11411                                 val="$define"
11412                                 ;;
11413                         $define)
11414                                 xxx="probably a USG one, i.e. you use setpgrp()."
11415                                 val="$undef"
11416                                 ;;
11417                         esac
11418                 fi
11419                 echo "Assuming your setpgrp is $xxx" >&4
11420         fi
11421         ;;
11422 *) val="$undef";;
11423 esac
11424 set d_bsdsetpgrp
11425 eval $setvar
11426 $rm_try
11427
11428 : Look for GCC-style __builtin_add_overflow
11429 case "$d_builtin_add_overflow" in
11430 '')
11431     echo " "
11432     echo "Checking whether your compiler can handle __builtin_add_overflow ..." >&4
11433     $cat >try.c <<'EOCP'
11434 int main(void) {
11435     const unsigned int uint_max = ~0u;
11436     int target_int = 0;
11437     if (__builtin_add_overflow(1, 2, &target_int) || target_int != 3) {
11438         return 1;
11439     }
11440     if (!__builtin_add_overflow((int)(uint_max >> 1), 1, &target_int)) {
11441         return 1;
11442     }
11443     if (!__builtin_add_overflow(uint_max, -1, &target_int)) {
11444         return 1;
11445     }
11446     return 0;
11447 }
11448 EOCP
11449     set try
11450     if eval $compile && $run ./try; then
11451         echo "Your C compiler supports __builtin_add_overflow."
11452         val="$define"
11453     else
11454         echo "Your C compiler doesn't seem to understand __builtin_add_overflow."
11455         val="$undef"
11456     fi
11457     ;;
11458 *) val="$d_builtin_add_overflow" ;;
11459 esac
11460
11461 set d_builtin_add_overflow
11462 eval $setvar
11463 $rm_try
11464
11465 : Look for GCC-style __builtin_sub_overflow
11466 case "$d_builtin_sub_overflow" in
11467 '')
11468     echo " "
11469     echo "Checking whether your compiler can handle __builtin_sub_overflow ..." >&4
11470     $cat >try.c <<'EOCP'
11471 int main(void) {
11472     const unsigned int uint_max = ~0u;
11473     int target_int = 0;
11474     if (__builtin_sub_overflow(1, -2, &target_int) || target_int != 3) {
11475         return 1;
11476     }
11477     if (!__builtin_sub_overflow(-(int)(uint_max >> 1), 2, &target_int)) {
11478         return 1;
11479     }
11480     if (!__builtin_sub_overflow(uint_max, 1, &target_int)) {
11481         return 1;
11482     }
11483     return 0;
11484 }
11485 EOCP
11486     set try
11487     if eval $compile && $run ./try; then
11488         echo "Your C compiler supports __builtin_sub_overflow."
11489         val="$define"
11490     else
11491         echo "Your C compiler doesn't seem to understand __builtin_sub_overflow."
11492         val="$undef"
11493     fi
11494     ;;
11495 *) val="$d_builtin_sub_overflow" ;;
11496 esac
11497
11498 set d_builtin_sub_overflow
11499 eval $setvar
11500 $rm_try
11501
11502 : Look for GCC-style __builtin_mul_overflow
11503 case "$d_builtin_mul_overflow" in
11504 '')
11505     echo " "
11506     echo "Checking whether your compiler can handle __builtin_mul_overflow ..." >&4
11507     $cat >try.c <<'EOCP'
11508 int main(void) {
11509     const unsigned int uint_max = ~0u;
11510     int target_int = 0;
11511     if (__builtin_mul_overflow(2, 3, &target_int) || target_int != 6) {
11512         return 1;
11513     }
11514     if (!__builtin_mul_overflow((int)(uint_max >> 1), 2, &target_int)) {
11515         return 1;
11516     }
11517     if (!__builtin_mul_overflow(uint_max, 1, &target_int)) {
11518         return 1;
11519     }
11520     return 0;
11521 }
11522 EOCP
11523     set try
11524     if eval $compile && $run ./try; then
11525         echo "Your C compiler supports __builtin_mul_overflow."
11526         val="$define"
11527     else
11528         echo "Your C compiler doesn't seem to understand __builtin_mul_overflow."
11529         val="$undef"
11530     fi
11531     ;;
11532 *) val="$d_builtin_mul_overflow" ;;
11533 esac
11534
11535 set d_builtin_mul_overflow
11536 eval $setvar
11537 $rm_try
11538
11539 : Look for GCC-style __builtin_choose_expr
11540 case "$d_builtin_choose_expr" in
11541 '')
11542     echo " "
11543     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11544     $cat >try.c <<'EOCP'
11545 #include <assert.h>
11546 #include <stdlib.h>
11547 #include <stdio.h>
11548
11549 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11550
11551 int main(void) {
11552     assert( SYRINX(1) == 2112 );
11553     assert( SYRINX(1) != 5150 );
11554     assert( SYRINX(0) == 5150 );
11555     assert( SYRINX(0) != 2112 );
11556     puts( "All good!" );
11557     exit(0);
11558 }
11559
11560 EOCP
11561     set try
11562     if eval $compile && $run ./try; then
11563         echo "Your C compiler supports __builtin_choose_expr."
11564         val="$define"
11565     else
11566         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11567         val="$undef"
11568     fi
11569 ;;
11570 *) val="$d_builtin_choose_expr" ;;
11571 esac
11572
11573 set d_builtin_choose_expr
11574 eval $setvar
11575 $rm_try
11576
11577 : Look for GCC-style __builtin_expect
11578 case "$d_builtin_expect" in
11579 '')
11580     echo " "
11581     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11582     $cat >try.c <<'EOCP'
11583 int main(void) {
11584     int n = 50;
11585     if ( __builtin_expect(n, 0) ) n = 1;
11586     /* Remember shell exit code truth is 0, C truth is non-zero */
11587     return !(n == 1);
11588 }
11589 EOCP
11590     set try
11591     if eval $compile && $run ./try; then
11592         echo "Your C compiler supports __builtin_expect."
11593         val="$define"
11594     else
11595         echo "Your C compiler doesn't seem to understand __builtin_expect."
11596         val="$undef"
11597     fi
11598     ;;
11599 *) val="$d_builtin_expect" ;;
11600 esac
11601
11602 set d_builtin_expect
11603 eval $setvar
11604 $rm_try
11605
11606 : see if the Compiler supports C99 variadic macros
11607 echo "Checking for C99 variadic macros." >&4
11608 $cat >try.c <<EOCP
11609 #include <stdio.h>
11610 #include <stdarg.h>
11611
11612 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11613
11614 int main() {
11615   char buf[20];
11616   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11617   puts(buf);
11618   return 0;
11619 }
11620 EOCP
11621 set try
11622 if eval $compile && $run ./try 2>&1 >/dev/null; then
11623     case "`$run ./try`" in
11624         "123 456 789")
11625         echo "You have C99 variadic macros." >&4
11626         d_c99_variadic_macros="$define"
11627         ;;
11628         *)
11629         echo "You don't have functional C99 variadic macros." >&4
11630         d_c99_variadic_macros="$undef"
11631         ;;
11632     esac
11633 else
11634     echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11635     d_c99_variadic_macros="$undef"
11636 fi
11637 $rm_try
11638
11639 : see if signal is declared as pointer to function returning int or void
11640 echo " "
11641 xxx=`./findhdr signal.h`
11642 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11643 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11644         echo "You have int (*signal())() instead of void." >&4
11645         val="$undef"
11646 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11647         echo "You have void (*signal())()." >&4
11648         val="$define"
11649 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11650         echo "You have int (*signal())() instead of void." >&4
11651         val="$undef"
11652 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11653         echo "You have void (*signal())()." >&4
11654         val="$define"
11655 else
11656         case "$d_voidsig" in
11657         '')
11658         echo "I can't determine whether signal handler returns void or int..." >&4
11659                 dflt=void
11660                 rp="What type does your signal handler return?"
11661                 . ./myread
11662                 case "$ans" in
11663                 v*) val="$define";;
11664                 *) val="$undef";;
11665                 esac;;
11666         "$define")
11667                 echo "As you already told me, signal handler returns void." >&4
11668                 val="$define"
11669                 ;;
11670         *)      echo "As you already told me, signal handler returns int." >&4
11671                 val="$undef"
11672                 ;;
11673         esac
11674 fi
11675 set d_voidsig
11676 eval $setvar
11677 case "$d_voidsig" in
11678 "$define") signal_t="void";;
11679 *) signal_t="int";;
11680 esac
11681 $rm -f $$.tmp
11682
11683 : check for ability to cast large floats to 32-bit ints.
11684 echo " "
11685 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11686 if $test "$intsize" -ge 4; then
11687         xxx=int
11688 else
11689         xxx=long
11690 fi
11691 $cat >try.c <<EOCP
11692 #include <stdio.h>
11693 #$i_stdlib I_STDLIB
11694 #ifdef I_STDLIB
11695 #include <stdlib.h>
11696 #endif
11697 #include <sys/types.h>
11698 #include <signal.h>
11699 $signal_t blech(int s) { exit(3); }
11700 int main()
11701 {
11702         $xxx i32;
11703         double f, g;
11704         int result = 0;
11705         char str[16];
11706         signal(SIGFPE, blech);
11707
11708         /* Don't let compiler optimize the test away.  Store the number
11709            in a writable string for gcc to pass to sscanf under HP-UX.
11710         */
11711         sprintf(str, "2147483647");
11712         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11713         g = 10 * f;
11714         i32  = ($xxx) g;
11715
11716         /* x86 processors will probably give 0x8000 0000, which is a
11717            sign change.  We don't want that.  We want to mimic SPARC
11718            behavior here, which is to preserve the sign and give
11719            back 0x7fff ffff.
11720         */
11721         if (i32 != ($xxx) f)
11722                 result |= 1;
11723         exit(result);
11724 }
11725 EOCP
11726 set try
11727 if eval $compile_ok; then
11728         $run ./try 2>/dev/null
11729         yyy=$?
11730 else
11731         echo "(I can't seem to compile the test program--assuming it can't)"
11732         yyy=1
11733 fi
11734 case "$yyy" in
11735 0)      val="$define"
11736         echo "Yup, it can."
11737         ;;
11738 *)      val="$undef"
11739         echo "Nope, it can't."
11740         ;;
11741 esac
11742 set d_casti32
11743 eval $setvar
11744 $rm_try
11745
11746 : check for ability to cast negative floats to unsigned
11747 echo " "
11748 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11749 $cat >try.c <<EOCP
11750 #include <stdio.h>
11751 #$i_stdlib I_STDLIB
11752 #ifdef I_STDLIB
11753 #include <stdlib.h>
11754 #endif
11755 #include <sys/types.h>
11756 #include <signal.h>
11757 $signal_t blech(int s) { exit(7); }
11758 $signal_t blech_in_list(int s) { exit(4); }
11759 unsigned long dummy_long(unsigned long p) { return p; }
11760 unsigned int dummy_int(unsigned int p) { return p; }
11761 unsigned short dummy_short(unsigned short p) { return p; }
11762 int main()
11763 {
11764         double f;
11765         unsigned long along;
11766         unsigned int aint;
11767         unsigned short ashort;
11768         int result = 0;
11769         char str[16];
11770
11771         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11772            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11773            optimized the whole file away
11774         */
11775         /* Store the number in a writable string for gcc to pass to
11776            sscanf under HP-UX.
11777         */
11778         sprintf(str, "-123");
11779         sscanf(str, "%lf", &f);  /* f = -123.; */
11780
11781         signal(SIGFPE, blech);
11782         along = (unsigned long)f;
11783         aint = (unsigned int)f;
11784         ashort = (unsigned short)f;
11785         if (along != (unsigned long)-123)
11786                 result |= 1;
11787         if (aint != (unsigned int)-123)
11788                 result |= 1;
11789         if (ashort != (unsigned short)-123)
11790                 result |= 1;
11791         sprintf(str, "1073741824.");
11792         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11793         f = f + f;
11794         along = 0;
11795         along = (unsigned long)f;
11796         if (along != 0x80000000)
11797                 result |= 2;
11798         f -= 1.;
11799         along = 0;
11800         along = (unsigned long)f;
11801         if (along != 0x7fffffff)
11802                 result |= 1;
11803         f += 2.;
11804         along = 0;
11805         along = (unsigned long)f;
11806         if (along != 0x80000001)
11807                 result |= 2;
11808         if (result)
11809                 exit(result);
11810         signal(SIGFPE, blech_in_list);
11811         sprintf(str, "123.");
11812         sscanf(str, "%lf", &f);  /* f = 123.; */
11813         along = dummy_long((unsigned long)f);
11814         aint = dummy_int((unsigned int)f);
11815         ashort = dummy_short((unsigned short)f);
11816         if (along != (unsigned long)123)
11817                 result |= 4;
11818         if (aint != (unsigned int)123)
11819                 result |= 4;
11820         if (ashort != (unsigned short)123)
11821                 result |= 4;
11822         exit(result);
11823
11824 }
11825 EOCP
11826 set try
11827 if eval $compile_ok; then
11828         $run ./try 2>/dev/null
11829         castflags=$?
11830 else
11831         echo "(I can't seem to compile the test program--assuming it can't)"
11832         castflags=7
11833 fi
11834 case "$castflags" in
11835 0)      val="$define"
11836         echo "Yup, it can."
11837         ;;
11838 *)      val="$undef"
11839         echo "Nope, it can't."
11840         ;;
11841 esac
11842 set d_castneg
11843 eval $setvar
11844 $rm_try
11845
11846 : see if cbrt exists
11847 set cbrt d_cbrt
11848 eval $inlibc
11849
11850 : see if chown exists
11851 set chown d_chown
11852 eval $inlibc
11853
11854 : see if chroot exists
11855 set chroot d_chroot
11856 eval $inlibc
11857
11858 : see if chsize exists
11859 set chsize d_chsize
11860 eval $inlibc
11861
11862 : see if class exists
11863 set class d_class
11864 eval $inlibc
11865
11866 : see if clearenv exists
11867 set clearenv d_clearenv
11868 eval $inlibc
11869
11870 : Define hasstruct macro for Configure internal use
11871 hasstruct='varname=$1; struct=$2; shift; shift;
11872 while $test $# -ge 2; do
11873         case "$1" in
11874         $define) echo "#include <$2>";;
11875         esac ;
11876     shift 2;
11877 done > try.c;
11878 echo "int main () { struct $struct foo; }" >> try.c;
11879 set try;
11880 if eval $compile; then
11881         val="$define";
11882 else
11883         val="$undef";
11884 fi;
11885 set $varname;
11886 eval $setvar;
11887 $rm_try'
11888
11889 : see whether socket exists
11890 socketlib=''
11891 sockethdr=''
11892 echo " "
11893 $echo $n "Hmm... $c" >&4
11894 if set socket val -f d_socket; eval $csym; $val; then
11895     echo "Looks like you have Berkeley networking support." >&4
11896     d_socket="$define"
11897     if set setsockopt val -f; eval $csym; $val; then
11898         d_oldsock="$undef"
11899     else
11900         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11901         d_oldsock="$define"
11902     fi
11903 else
11904     if $contains socklib libc.list >/dev/null 2>&1; then
11905         echo "Looks like you have Berkeley networking support." >&4
11906         d_socket="$define"
11907         : we will have to assume that it supports the 4.2 BSD interface
11908         d_oldsock="$undef"
11909     else
11910         echo "You don't have Berkeley networking in libc$_a..." >&4
11911         if test "X$d_socket" = "X$define"; then
11912             echo "...but you seem to believe that you have sockets." >&4
11913         else
11914             for net in net socket
11915             do
11916                 if test -f $sysroot/usr/lib/lib$net$_a; then
11917                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11918                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11919                     if $contains socket libc.list >/dev/null 2>&1; then
11920                         d_socket="$define"
11921                         socketlib="-l$net"
11922                         case "$net" in
11923                         net)
11924                             echo "...but the Wollongong group seems to have hacked it in." >&4
11925                             sockethdr="-I$sysroot/usr/netinclude"
11926                             ;;
11927                         esac
11928                         echo "Found Berkeley sockets interface in lib$net." >&4
11929                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11930                             d_oldsock="$undef"
11931                         else
11932                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11933                             d_oldsock="$define"
11934                         fi
11935                         break
11936                     fi
11937                 fi
11938             done
11939             if test "X$d_socket" != "X$define"; then
11940                echo "or anywhere else I see." >&4
11941                d_socket="$undef"
11942                d_oldsock="$undef"
11943             fi
11944         fi
11945     fi
11946 fi
11947
11948 : see if socketpair exists
11949 set socketpair d_sockpair
11950 eval $inlibc
11951
11952
11953 echo " "
11954 echo "Checking the availability sa_len in the sock struct ..." >&4
11955 $cat >try.c <<EOF
11956 #include <sys/types.h>
11957 #include <sys/socket.h>
11958 int main() {
11959 struct sockaddr sa;
11960 return (sa.sa_len);
11961 }
11962 EOF
11963 val="$undef"
11964 set try; if eval $compile; then
11965     val="$define"
11966 fi
11967 set d_sockaddr_sa_len; eval $setvar
11968 $rm_try
11969
11970 echo " "
11971 echo "Checking the availability struct sockaddr_in6 ..." >&4
11972 $cat >try.c <<EOF
11973 #include <sys/types.h>
11974 #include <sys/socket.h>
11975 #include <netinet/in.h>
11976 int main() {
11977 struct sockaddr_in6 sin6;
11978 return (sin6.sin6_family);
11979 }
11980 EOF
11981 val="$undef"
11982 set try; if eval $compile; then
11983     val="$define"
11984 fi
11985 set d_sockaddr_in6; eval $setvar
11986 $rm_try
11987
11988 echo " "
11989 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11990 $cat >try.c <<EOF
11991 #include <sys/types.h>
11992 #include <sys/socket.h>
11993 #include <netinet/in.h>
11994 int main() {
11995 struct sockaddr_in6 sin6;
11996 return (sin6.sin6_scope_id);
11997 }
11998 EOF
11999 val="$undef"
12000 set try; if eval $compile; then
12001     val="$define"
12002 fi
12003 set d_sin6_scope_id; eval $setvar
12004 $rm_try
12005
12006 echo " "
12007 echo "Checking the availability struct ip_mreq ..." >&4
12008 $cat >try.c <<EOF
12009 #include <sys/types.h>
12010 #include <sys/socket.h>
12011 #include <netinet/in.h>
12012 int main() {
12013 struct ip_mreq mreq;
12014 return (mreq.imr_multiaddr.s_addr);
12015 }
12016 EOF
12017 val="$undef"
12018 set try; if eval $compile; then
12019        val="$define"
12020 fi
12021 set d_ip_mreq; eval $setvar
12022 $rm_try
12023
12024 echo " "
12025 echo "Checking the availability struct ip_mreq_source ..." >&4
12026 $cat >try.c <<EOF
12027 #include <sys/types.h>
12028 #include <sys/socket.h>
12029 #include <netinet/in.h>
12030 int main() {
12031 struct ip_mreq_source mreq;
12032 return (mreq.imr_multiaddr.s_addr);
12033 }
12034 EOF
12035 val="$undef"
12036 set try; if eval $compile; then
12037        val="$define"
12038 fi
12039 set d_ip_mreq_source; eval $setvar
12040 $rm_try
12041
12042 echo " "
12043 echo "Checking the availability struct ipv6_mreq ..." >&4
12044 $cat >try.c <<EOF
12045 #include <sys/types.h>
12046 #include <sys/socket.h>
12047 #include <netinet/in.h>
12048 int main() {
12049 struct ipv6_mreq mreq;
12050 return (mreq.ipv6mr_interface);
12051 }
12052 EOF
12053 val="$undef"
12054 set try; if eval $compile; then
12055     val="$define"
12056 fi
12057 set d_ipv6_mreq; eval $setvar
12058 $rm_try
12059
12060 echo " "
12061 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12062 $cat >try.c <<EOF
12063 #include <sys/types.h>
12064 #include <sys/socket.h>
12065 #include <netinet/in.h>
12066 int main() {
12067 struct ipv6_mreq_source mreq;
12068 return (mreq.imr_multiaddr.s_addr);
12069 }
12070 EOF
12071 val="$undef"
12072 set try; if eval $compile; then
12073        val="$define"
12074 fi
12075 set d_ipv6_mreq_source; eval $setvar
12076 $rm_try
12077
12078 echo " "
12079 echo "Checking the availability of certain socket constants..." >&4
12080 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12081     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12082     $cat >try.c <<EOF
12083 #include <sys/types.h>
12084 #include <sys/socket.h>
12085 int main() {
12086     int i = $ENUM;
12087 }
12088 EOF
12089     val="$undef"
12090     set try; if eval $compile; then
12091         val="$define"
12092     fi
12093     set d_${enum}; eval $setvar
12094     $rm_try
12095 done
12096
12097 : see if this is a sys/uio.h system
12098 set sys/uio.h i_sysuio
12099 eval $inhdr
12100
12101 : Check for cmsghdr support
12102 echo " "
12103 echo "Checking to see if your system supports struct cmsghdr..." >&4
12104 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12105 eval $hasstruct
12106 case "$d_cmsghdr_s" in
12107 "$define")      echo "Yes, it does."   ;;
12108 *)              echo "No, it doesn't." ;;
12109 esac
12110
12111
12112 : check for const keyword
12113 echo " "
12114 echo 'Checking to see if your C compiler knows about "const"...' >&4
12115 $cat >const.c <<'EOCP'
12116 typedef struct spug { int drokk; } spug;
12117 int main()
12118 {
12119         const char *foo;
12120         const spug y = { 0 };
12121 }
12122 EOCP
12123 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
12124         val="$define"
12125         echo "Yup, it does."
12126 else
12127         val="$undef"
12128         echo "Nope, it doesn't."
12129 fi
12130 set d_const
12131 eval $setvar
12132
12133 : see if copysign exists
12134 set copysign d_copysign
12135 eval $inlibc
12136
12137 : see if copysignl exists
12138 set copysignl d_copysignl
12139 eval $inlibc
12140
12141 : see if crypt exists
12142 echo " "
12143 set crypt d_crypt
12144 eval $inlibc
12145 case "$d_crypt" in
12146 $define) cryptlib='' ;;
12147 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12148                 echo 'crypt() found.' >&4
12149                 val="$define"
12150                 cryptlib=''
12151         else
12152                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12153                 if $test -z "$cryptlib"; then
12154                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12155                 else
12156                         cryptlib=-lcrypt
12157                 fi
12158                 if $test -z "$cryptlib"; then
12159                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12160                 else
12161                         cryptlib=-lcrypt
12162                 fi
12163                 if $test -z "$cryptlib"; then
12164                         cryptlib=`./loc libcrypt$_a "" $libpth`
12165                 else
12166                         cryptlib=-lcrypt
12167                 fi
12168                 if $test -z "$cryptlib"; then
12169                         echo 'crypt() NOT found.' >&4
12170                         val="$undef"
12171                 else
12172                         val="$define"
12173                 fi
12174         fi
12175         set d_crypt
12176         eval $setvar
12177         ;;
12178 esac
12179
12180 : see if this is a crypt.h system
12181 set crypt.h i_crypt
12182 eval $inhdr
12183
12184 : see if crypt_r exists
12185 set crypt_r d_crypt_r
12186 eval $inlibc
12187 case "$d_crypt_r" in
12188 "$define")
12189         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12190         case "$d_crypt_r_proto:$usethreads" in
12191         ":define")      d_crypt_r_proto=define
12192                 set d_crypt_r_proto crypt_r $hdrs
12193                 eval $hasproto ;;
12194         *)      ;;
12195         esac
12196         case "$d_crypt_r_proto" in
12197         define)
12198         case "$crypt_r_proto" in
12199         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12200         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12201         esac
12202         case "$crypt_r_proto" in
12203         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12204         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12205         esac
12206         case "$crypt_r_proto" in
12207         ''|0)   d_crypt_r=undef
12208                 crypt_r_proto=0
12209                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12210         * )     case "$crypt_r_proto" in
12211                 REENTRANT_PROTO*) ;;
12212                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12213                 esac
12214                 echo "Prototype: $try" ;;
12215         esac
12216         ;;
12217         *)      case "$usethreads" in
12218                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12219                 esac
12220                 d_crypt_r=undef
12221                 crypt_r_proto=0
12222                 ;;
12223         esac
12224         ;;
12225 *)      crypt_r_proto=0
12226         ;;
12227 esac
12228
12229 : get csh whereabouts
12230 case "$csh" in
12231 'csh') val="$undef" ;;
12232 *) val="$define" ;;
12233 esac
12234 set d_csh
12235 eval $setvar
12236 : Respect a hint or command line value for full_csh.
12237 case "$full_csh" in
12238 '') full_csh=$csh ;;
12239 esac
12240
12241 : see if ctermid exists
12242 set ctermid d_ctermid
12243 eval $inlibc
12244
12245 : see if ctermid_r exists
12246 set ctermid_r d_ctermid_r
12247 eval $inlibc
12248 case "$d_ctermid_r" in
12249 "$define")
12250         hdrs="$i_systypes sys/types.h define stdio.h "
12251         case "$d_ctermid_r_proto:$usethreads" in
12252         ":define")      d_ctermid_r_proto=define
12253                 set d_ctermid_r_proto ctermid_r $hdrs
12254                 eval $hasproto ;;
12255         *)      ;;
12256         esac
12257         case "$d_ctermid_r_proto" in
12258         define)
12259         case "$ctermid_r_proto" in
12260         ''|0) try='char* ctermid_r(char*);'
12261         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12262         esac
12263         case "$ctermid_r_proto" in
12264         ''|0)   d_ctermid_r=undef
12265                 ctermid_r_proto=0
12266                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12267         * )     case "$ctermid_r_proto" in
12268                 REENTRANT_PROTO*) ;;
12269                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12270                 esac
12271                 echo "Prototype: $try" ;;
12272         esac
12273         ;;
12274         *)      case "$usethreads" in
12275                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12276                 esac
12277                 d_ctermid_r=undef
12278                 ctermid_r_proto=0
12279                 ;;
12280         esac
12281         ;;
12282 *)      ctermid_r_proto=0
12283         ;;
12284 esac
12285
12286 : see if ctime_r exists
12287 set ctime_r d_ctime_r
12288 eval $inlibc
12289 case "$d_ctime_r" in
12290 "$define")
12291         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12292         case "$d_ctime_r_proto:$usethreads" in
12293         ":define")      d_ctime_r_proto=define
12294                 set d_ctime_r_proto ctime_r $hdrs
12295                 eval $hasproto ;;
12296         *)      ;;
12297         esac
12298         case "$d_ctime_r_proto" in
12299         define)
12300         case "$ctime_r_proto" in
12301         ''|0) try='char* ctime_r(const time_t*, char*);'
12302         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12303         esac
12304         case "$ctime_r_proto" in
12305         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12306         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12307         esac
12308         case "$ctime_r_proto" in
12309         ''|0) try='int ctime_r(const time_t*, char*);'
12310         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12311         esac
12312         case "$ctime_r_proto" in
12313         ''|0) try='int ctime_r(const time_t*, char*, int);'
12314         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12315         esac
12316         case "$ctime_r_proto" in
12317         ''|0)   d_ctime_r=undef
12318                 ctime_r_proto=0
12319                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12320         * )     case "$ctime_r_proto" in
12321                 REENTRANT_PROTO*) ;;
12322                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12323                 esac
12324                 echo "Prototype: $try" ;;
12325         esac
12326         ;;
12327         *)      case "$usethreads" in
12328                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12329                 esac
12330                 d_ctime_r=undef
12331                 ctime_r_proto=0
12332                 ;;
12333         esac
12334         ;;
12335 *)      ctime_r_proto=0
12336         ;;
12337 esac
12338
12339 : see if cuserid exists
12340 set cuserid d_cuserid
12341 eval $inlibc
12342
12343 : see if this is a limits.h system
12344 set limits.h i_limits
12345 eval $inhdr
12346
12347 : See if number of significant digits in a double precision number is known
12348 echo " "
12349 $cat >dbl_dig.c <<EOM
12350 #$i_limits I_LIMITS
12351 #$i_float I_FLOAT
12352 #ifdef I_LIMITS
12353 #include <limits.h>
12354 #endif
12355 #ifdef I_FLOAT
12356 #include <float.h>
12357 #endif
12358 #ifdef DBL_DIG
12359 printf("Contains DBL_DIG");
12360 #endif
12361 EOM
12362 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
12363 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
12364         echo "DBL_DIG found." >&4
12365         val="$define"
12366 else
12367         echo "DBL_DIG NOT found." >&4
12368         val="$undef"
12369 fi
12370 $rm -f dbl_dig.?
12371 set d_dbl_dig
12372 eval $setvar
12373
12374 : see if dbm.h is available
12375 : see if dbmclose exists
12376 set dbmclose d_dbmclose
12377 eval $inlibc
12378
12379 case "$d_dbmclose" in
12380 $define)
12381         set dbm.h i_dbm
12382         eval $inhdr
12383         case "$i_dbm" in
12384         $define)
12385                 val="$undef"
12386                 set i_rpcsvcdbm
12387                 eval $setvar
12388                 ;;
12389         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12390                 eval $inhdr
12391                 ;;
12392         esac
12393         ;;
12394 *)      echo "We won't be including <dbm.h>"
12395         val="$undef"
12396         set i_dbm
12397         eval $setvar
12398         val="$undef"
12399         set i_rpcsvcdbm
12400         eval $setvar
12401         ;;
12402 esac
12403
12404 : see if prototype for dbminit is available
12405 echo " "
12406 set d_dbminitproto dbminit $i_dbm dbm.h
12407 eval $hasproto
12408
12409 : see if difftime exists
12410 set difftime d_difftime
12411 eval $inlibc
12412
12413 : see if this is a dirent system
12414 echo " "
12415 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12416         val="$define"
12417         echo "<dirent.h> found." >&4
12418 else
12419         val="$undef"
12420         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12421                 echo "<sys/dir.h> found." >&4
12422                 echo " "
12423         else
12424                 xinc=`./findhdr sys/ndir.h`
12425         fi
12426         echo "<dirent.h> NOT found." >&4
12427 fi
12428 set i_dirent
12429 eval $setvar
12430
12431 : Look for type of directory structure.
12432 echo " "
12433 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12434
12435 case "$direntrytype" in
12436 ''|' ')
12437         case "$i_dirent" in
12438         $define) guess1='struct dirent' ;;
12439         *) guess1='struct direct'  ;;
12440         esac
12441         ;;
12442 *)      guess1="$direntrytype"
12443         ;;
12444 esac
12445
12446 case "$guess1" in
12447 'struct dirent') guess2='struct direct' ;;
12448 *) guess2='struct dirent' ;;
12449 esac
12450
12451 if $contains "$guess1" try.c >/dev/null 2>&1; then
12452         direntrytype="$guess1"
12453         echo "Your directory entries are $direntrytype." >&4
12454 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12455         direntrytype="$guess2"
12456         echo "Your directory entries seem to be $direntrytype." >&4
12457 else
12458         echo "I don't recognize your system's directory entries." >&4
12459         rp="What type is used for directory entries on this system?"
12460         dflt="$guess1"
12461         . ./myread
12462         direntrytype="$ans"
12463 fi
12464 $rm_try
12465
12466 : see if the directory entry stores field length
12467 echo " "
12468 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12469 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12470         echo "Good, your directory entry keeps length information in d_namlen." >&4
12471         val="$define"
12472 else
12473         echo "Your directory entry does not know about the d_namlen field." >&4
12474         val="$undef"
12475 fi
12476 set d_dirnamlen
12477 eval $setvar
12478 $rm_try
12479
12480 : Look for DIR.dd_fd
12481 case "$i_dirent" in
12482 "$define")
12483     echo "Checking to see if DIR has a dd_fd member variable" >&4
12484     $cat >try.c <<EOCP
12485 #$i_stdlib I_STDLIB
12486 #ifdef I_STDLIB
12487 #include <stdlib.h>
12488 #endif
12489 #include <dirent.h>
12490
12491 int main() {
12492     DIR dir;
12493     dir.dd_fd = 1;
12494     return 0;
12495 }
12496 EOCP
12497     val=$undef
12498     set try
12499     if eval $compile; then
12500         echo "Yes, it does."
12501         val="$define"
12502     else
12503         echo "No, it does not."
12504         val="$undef"
12505     fi
12506     ;;
12507 *)
12508     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12509     val="$undef"
12510     ;;
12511 esac
12512 set d_dir_dd_fd
12513 eval $setvar
12514 $rm_try
12515
12516 : see if this is an sysdir system
12517 set sys/dir.h i_sysdir
12518 eval $inhdr
12519
12520 : see if this is an sysndir system
12521 set sys/ndir.h i_sysndir
12522 eval $inhdr
12523
12524 : Look for dirfd
12525 echo " "
12526 $cat >dirfd.c <<EOM
12527 #include <stdio.h>
12528 #$i_stdlib I_STDLIB
12529 #ifdef I_STDLIB
12530 #include <stdlib.h>
12531 #endif
12532 #$i_dirent I_DIRENT             /**/
12533 #$i_sysdir I_SYS_DIR            /**/
12534 #$i_sysndir I_SYS_NDIR          /**/
12535 #$i_systypes I_SYS_TYPES        /**/
12536 #if defined(I_SYS_TYPES)
12537 #include <sys/types.h>
12538 #endif
12539 #if defined(I_DIRENT)
12540 #include <dirent.h>
12541 #else
12542 #ifdef I_SYS_NDIR
12543 #include <sys/ndir.h>
12544 #else
12545 #ifdef I_SYS_DIR
12546 #ifdef hp9000s500
12547 #include <ndir.h>       /* may be wrong in the future */
12548 #else
12549 #include <sys/dir.h>
12550 #endif
12551 #endif
12552 #endif
12553 #endif
12554 int main() {
12555         DIR *dirp = opendir(".");
12556         if (dirfd(dirp) >= 0)
12557                 exit(0);
12558         else
12559                 exit(1);
12560 }
12561 EOM
12562 val=$undef
12563 set dirfd
12564 if eval $compile; then
12565         val="$define"
12566 fi
12567 case "$val" in
12568 $define)        echo "dirfd() found." >&4       ;;
12569 *)              echo "dirfd() NOT found." >&4   ;;
12570 esac
12571 set d_dirfd
12572 eval $setvar
12573 $rm -f dirfd*
12574
12575 : see if dladdr exists
12576 set dladdr d_dladdr
12577 eval $inlibc
12578
12579 : see if dlerror exists
12580 xxx_runnm="$runnm"
12581 runnm=false
12582 set dlerror d_dlerror
12583 eval $inlibc
12584 runnm="$xxx_runnm"
12585
12586 : see if dlfcn is available
12587 set dlfcn.h i_dlfcn
12588 eval $inhdr
12589
12590 : Check what extension to use for shared libs
12591 case "$usedl" in
12592 $define|y|true)
12593         $cat << EOM
12594
12595 On a few systems, the dynamically loaded modules that perl generates and uses
12596 will need a different extension than shared libs. The default will probably
12597 be appropriate.
12598
12599 EOM
12600         case "$dlext" in
12601         '')     dflt="$so" ;;
12602         *)      dflt="$dlext" ;;
12603         esac
12604         rp='What is the extension of dynamically loaded modules'
12605         . ./myread
12606         dlext="$ans"
12607         ;;
12608 *)
12609         dlext="none"
12610         ;;
12611 esac
12612
12613 : Check if dlsym need a leading underscore
12614 echo " "
12615 val="$undef"
12616
12617 case "$dlsrc" in
12618 dl_dlopen.xs)
12619         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12620         $cat >dyna.c <<'EOM'
12621 fred () { }
12622 EOM
12623
12624 $cat >fred.c<<EOM
12625
12626 #include <stdio.h>
12627 #$i_stdlib I_STDLIB
12628 #ifdef I_STDLIB
12629 #include <stdlib.h>
12630 #endif
12631 #$i_dlfcn I_DLFCN
12632 #ifdef I_DLFCN
12633 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12634 #else
12635 #include <sys/types.h>
12636 #include <nlist.h>
12637 #include <link.h>
12638 #endif
12639
12640 extern int fred() ;
12641
12642 int main()
12643 {
12644     void * handle ;
12645     void * symbol ;
12646 #ifndef RTLD_LAZY
12647     int mode = 1 ;
12648 #else
12649     int mode = RTLD_LAZY ;
12650 #endif
12651     handle = dlopen("./dyna.$dlext", mode) ;
12652     if (handle == NULL) {
12653         printf ("1\n") ;
12654         fflush (stdout) ;
12655         exit(0);
12656     }
12657     symbol = dlsym(handle, "fred") ;
12658     if (symbol == NULL) {
12659         /* try putting a leading underscore */
12660         symbol = dlsym(handle, "_fred") ;
12661         if (symbol == NULL) {
12662             printf ("2\n") ;
12663             fflush (stdout) ;
12664             exit(0);
12665         }
12666         printf ("3\n") ;
12667     }
12668     else
12669         printf ("4\n") ;
12670     fflush (stdout) ;
12671     exit(0);
12672 }
12673 EOM
12674         : Call the object file tmp-dyna.o in case dlext=o.
12675         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12676                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12677                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12678                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12679                 xxx=`$run ./fred`
12680                 case $xxx in
12681                 1)      echo "Test program failed using dlopen." >&4
12682                         echo "Perhaps you should not use dynamic loading." >&4;;
12683                 2)      echo "Test program failed using dlsym." >&4
12684                         echo "Perhaps you should not use dynamic loading." >&4;;
12685                 3)      echo "dlsym needs a leading underscore" >&4
12686                         val="$define" ;;
12687                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12688                 esac
12689         else
12690                 echo "I can't compile and run the test program." >&4
12691                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12692         fi
12693         ;;
12694 esac
12695
12696 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12697
12698 set d_dlsymun
12699 eval $setvar
12700
12701 : see if drand48_r exists
12702 set drand48_r d_drand48_r
12703 eval $inlibc
12704 case "$d_drand48_r" in
12705 "$define")
12706         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12707         case "$d_drand48_r_proto:$usethreads" in
12708         ":define")      d_drand48_r_proto=define
12709                 set d_drand48_r_proto drand48_r $hdrs
12710                 eval $hasproto ;;
12711         *)      ;;
12712         esac
12713         case "$d_drand48_r_proto" in
12714         define)
12715         case "$drand48_r_proto" in
12716         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12717         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12718         esac
12719         case "$drand48_r_proto" in
12720         ''|0)   d_drand48_r=undef
12721                 drand48_r_proto=0
12722                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12723         * )     case "$drand48_r_proto" in
12724                 REENTRANT_PROTO*) ;;
12725                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12726                 esac
12727                 echo "Prototype: $try" ;;
12728         esac
12729         ;;
12730         *)      case "$usethreads" in
12731                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12732                 esac
12733                 d_drand48_r=undef
12734                 drand48_r_proto=0
12735                 ;;
12736         esac
12737         ;;
12738 *)      drand48_r_proto=0
12739         ;;
12740 esac
12741
12742 : see if prototype for drand48 is available
12743 echo " "
12744 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12745 eval $hasproto
12746
12747 : see if dup2 exists
12748 set dup2 d_dup2
12749 eval $inlibc
12750
12751 : see if eaccess exists
12752 set eaccess d_eaccess
12753 eval $inlibc
12754
12755 : see if endgrent exists
12756 set endgrent d_endgrent
12757 eval $inlibc
12758
12759 : see if this is an grp system
12760 set grp.h i_grp
12761 eval $inhdr
12762
12763 case "$i_grp" in
12764 $define)
12765         xxx=`./findhdr grp.h`
12766         $cppstdin $cppflags $cppminus < $xxx >$$.h
12767
12768         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12769                 val="$define"
12770         else
12771                 val="$undef"
12772         fi
12773         set d_grpasswd
12774         eval $setvar
12775
12776         $rm -f $$.h
12777         ;;
12778 *)
12779         val="$undef";
12780         set d_grpasswd; eval $setvar
12781         ;;
12782 esac
12783
12784 : see if endgrent_r exists
12785 set endgrent_r d_endgrent_r
12786 eval $inlibc
12787 case "$d_endgrent_r" in
12788 "$define")
12789         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12790         case "$d_endgrent_r_proto:$usethreads" in
12791         ":define")      d_endgrent_r_proto=define
12792                 set d_endgrent_r_proto endgrent_r $hdrs
12793                 eval $hasproto ;;
12794         *)      ;;
12795         esac
12796         case "$d_endgrent_r_proto" in
12797         define)
12798         case "$endgrent_r_proto" in
12799         ''|0) try='int endgrent_r(FILE**);'
12800         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12801         esac
12802         case "$endgrent_r_proto" in
12803         ''|0) try='void endgrent_r(FILE**);'
12804         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12805         esac
12806         case "$endgrent_r_proto" in
12807         ''|0)   d_endgrent_r=undef
12808                 endgrent_r_proto=0
12809                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12810         * )     case "$endgrent_r_proto" in
12811                 REENTRANT_PROTO*) ;;
12812                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12813                 esac
12814                 echo "Prototype: $try" ;;
12815         esac
12816         ;;
12817         *)      case "$usethreads" in
12818                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12819                 esac
12820                 d_endgrent_r=undef
12821                 endgrent_r_proto=0
12822                 ;;
12823         esac
12824         ;;
12825 *)      endgrent_r_proto=0
12826         ;;
12827 esac
12828
12829 : see if endhostent exists
12830 set endhostent d_endhent
12831 eval $inlibc
12832
12833 : see if this is a netdb.h system
12834 set netdb.h i_netdb
12835 eval $inhdr
12836
12837 : see if endhostent_r exists
12838 set endhostent_r d_endhostent_r
12839 eval $inlibc
12840 case "$d_endhostent_r" in
12841 "$define")
12842         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12843         case "$d_endhostent_r_proto:$usethreads" in
12844         ":define")      d_endhostent_r_proto=define
12845                 set d_endhostent_r_proto endhostent_r $hdrs
12846                 eval $hasproto ;;
12847         *)      ;;
12848         esac
12849         case "$d_endhostent_r_proto" in
12850         define)
12851         case "$endhostent_r_proto" in
12852         ''|0) try='int endhostent_r(struct hostent_data*);'
12853         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12854         esac
12855         case "$endhostent_r_proto" in
12856         ''|0) try='void endhostent_r(struct hostent_data*);'
12857         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12858         esac
12859         case "$endhostent_r_proto" in
12860         ''|0)   d_endhostent_r=undef
12861                 endhostent_r_proto=0
12862                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12863         * )     case "$endhostent_r_proto" in
12864                 REENTRANT_PROTO*) ;;
12865                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12866                 esac
12867                 echo "Prototype: $try" ;;
12868         esac
12869         ;;
12870         *)      case "$usethreads" in
12871                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12872                 esac
12873                 d_endhostent_r=undef
12874                 endhostent_r_proto=0
12875                 ;;
12876         esac
12877         ;;
12878 *)      endhostent_r_proto=0
12879         ;;
12880 esac
12881
12882 : see if endnetent exists
12883 set endnetent d_endnent
12884 eval $inlibc
12885
12886 : see if endnetent_r exists
12887 set endnetent_r d_endnetent_r
12888 eval $inlibc
12889 case "$d_endnetent_r" in
12890 "$define")
12891         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12892         case "$d_endnetent_r_proto:$usethreads" in
12893         ":define")      d_endnetent_r_proto=define
12894                 set d_endnetent_r_proto endnetent_r $hdrs
12895                 eval $hasproto ;;
12896         *)      ;;
12897         esac
12898         case "$d_endnetent_r_proto" in
12899         define)
12900         case "$endnetent_r_proto" in
12901         ''|0) try='int endnetent_r(struct netent_data*);'
12902         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12903         esac
12904         case "$endnetent_r_proto" in
12905         ''|0) try='void endnetent_r(struct netent_data*);'
12906         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12907         esac
12908         case "$endnetent_r_proto" in
12909         ''|0)   d_endnetent_r=undef
12910                 endnetent_r_proto=0
12911                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12912         * )     case "$endnetent_r_proto" in
12913                 REENTRANT_PROTO*) ;;
12914                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12915                 esac
12916                 echo "Prototype: $try" ;;
12917         esac
12918         ;;
12919         *)      case "$usethreads" in
12920                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12921                 esac
12922                 d_endnetent_r=undef
12923                 endnetent_r_proto=0
12924                 ;;
12925         esac
12926         ;;
12927 *)      endnetent_r_proto=0
12928         ;;
12929 esac
12930
12931 : see if endprotoent exists
12932 set endprotoent d_endpent
12933 eval $inlibc
12934
12935 : see if endprotoent_r exists
12936 set endprotoent_r d_endprotoent_r
12937 eval $inlibc
12938 case "$d_endprotoent_r" in
12939 "$define")
12940         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12941         case "$d_endprotoent_r_proto:$usethreads" in
12942         ":define")      d_endprotoent_r_proto=define
12943                 set d_endprotoent_r_proto endprotoent_r $hdrs
12944                 eval $hasproto ;;
12945         *)      ;;
12946         esac
12947         case "$d_endprotoent_r_proto" in
12948         define)
12949         case "$endprotoent_r_proto" in
12950         ''|0) try='int endprotoent_r(struct protoent_data*);'
12951         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12952         esac
12953         case "$endprotoent_r_proto" in
12954         ''|0) try='void endprotoent_r(struct protoent_data*);'
12955         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12956         esac
12957         case "$endprotoent_r_proto" in
12958         ''|0)   d_endprotoent_r=undef
12959                 endprotoent_r_proto=0
12960                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12961         * )     case "$endprotoent_r_proto" in
12962                 REENTRANT_PROTO*) ;;
12963                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12964                 esac
12965                 echo "Prototype: $try" ;;
12966         esac
12967         ;;
12968         *)      case "$usethreads" in
12969                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12970                 esac
12971                 d_endprotoent_r=undef
12972                 endprotoent_r_proto=0
12973                 ;;
12974         esac
12975         ;;
12976 *)      endprotoent_r_proto=0
12977         ;;
12978 esac
12979
12980 : see if endpwent exists
12981 set endpwent d_endpwent
12982 eval $inlibc
12983
12984 : see if this is a pwd.h system
12985 set pwd.h i_pwd
12986 eval $inhdr
12987
12988 case "$i_pwd" in
12989 $define)
12990         xxx=`./findhdr pwd.h`
12991         $cppstdin $cppflags $cppminus < $xxx >$$.h
12992
12993         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12994                 val="$define"
12995         else
12996                 val="$undef"
12997         fi
12998         set d_pwquota
12999         eval $setvar
13000
13001         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
13002                 val="$define"
13003         else
13004                 val="$undef"
13005         fi
13006         set d_pwage
13007         eval $setvar
13008
13009         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
13010                 val="$define"
13011         else
13012                 val="$undef"
13013         fi
13014         set d_pwchange
13015         eval $setvar
13016
13017         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
13018                 val="$define"
13019         else
13020                 val="$undef"
13021         fi
13022         set d_pwclass
13023         eval $setvar
13024
13025         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
13026                 val="$define"
13027         else
13028                 val="$undef"
13029         fi
13030         set d_pwexpire
13031         eval $setvar
13032
13033         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
13034                 val="$define"
13035         else
13036                 val="$undef"
13037         fi
13038         set d_pwcomment
13039         eval $setvar
13040
13041         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
13042                 val="$define"
13043         else
13044                 val="$undef"
13045         fi
13046         set d_pwgecos
13047         eval $setvar
13048
13049         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
13050                 val="$define"
13051         else
13052                 val="$undef"
13053         fi
13054         set d_pwpasswd
13055         eval $setvar
13056
13057         $rm -f $$.h
13058         ;;
13059 *)
13060         val="$undef";
13061         set d_pwquota; eval $setvar
13062         set d_pwage; eval $setvar
13063         set d_pwchange; eval $setvar
13064         set d_pwclass; eval $setvar
13065         set d_pwexpire; eval $setvar
13066         set d_pwcomment; eval $setvar
13067         set d_pwgecos; eval $setvar
13068         set d_pwpasswd; eval $setvar
13069         ;;
13070 esac
13071
13072 : see if endpwent_r exists
13073 set endpwent_r d_endpwent_r
13074 eval $inlibc
13075 case "$d_endpwent_r" in
13076 "$define")
13077         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13078         case "$d_endpwent_r_proto:$usethreads" in
13079         ":define")      d_endpwent_r_proto=define
13080                 set d_endpwent_r_proto endpwent_r $hdrs
13081                 eval $hasproto ;;
13082         *)      ;;
13083         esac
13084         case "$d_endpwent_r_proto" in
13085         define)
13086         case "$endpwent_r_proto" in
13087         ''|0) try='int endpwent_r(FILE**);'
13088         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13089         esac
13090         case "$endpwent_r_proto" in
13091         ''|0) try='void endpwent_r(FILE**);'
13092         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13093         esac
13094         case "$endpwent_r_proto" in
13095         ''|0)   d_endpwent_r=undef
13096                 endpwent_r_proto=0
13097                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13098         * )     case "$endpwent_r_proto" in
13099                 REENTRANT_PROTO*) ;;
13100                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13101                 esac
13102                 echo "Prototype: $try" ;;
13103         esac
13104         ;;
13105         *)      case "$usethreads" in
13106                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13107                 esac
13108                 d_endpwent_r=undef
13109                 endpwent_r_proto=0
13110                 ;;
13111         esac
13112         ;;
13113 *)      endpwent_r_proto=0
13114         ;;
13115 esac
13116
13117 : see if endservent exists
13118 set endservent d_endsent
13119 eval $inlibc
13120
13121 : see if endservent_r exists
13122 set endservent_r d_endservent_r
13123 eval $inlibc
13124 case "$d_endservent_r" in
13125 "$define")
13126         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13127         case "$d_endservent_r_proto:$usethreads" in
13128         ":define")      d_endservent_r_proto=define
13129                 set d_endservent_r_proto endservent_r $hdrs
13130                 eval $hasproto ;;
13131         *)      ;;
13132         esac
13133         case "$d_endservent_r_proto" in
13134         define)
13135         case "$endservent_r_proto" in
13136         ''|0) try='int endservent_r(struct servent_data*);'
13137         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13138         esac
13139         case "$endservent_r_proto" in
13140         ''|0) try='void endservent_r(struct servent_data*);'
13141         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13142         esac
13143         case "$endservent_r_proto" in
13144         ''|0)   d_endservent_r=undef
13145                 endservent_r_proto=0
13146                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13147         * )     case "$endservent_r_proto" in
13148                 REENTRANT_PROTO*) ;;
13149                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13150                 esac
13151                 echo "Prototype: $try" ;;
13152         esac
13153         ;;
13154         *)      case "$usethreads" in
13155                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13156                 esac
13157                 d_endservent_r=undef
13158                 endservent_r_proto=0
13159                 ;;
13160         esac
13161         ;;
13162 *)      endservent_r_proto=0
13163         ;;
13164 esac
13165
13166 : Locate the flags for 'open()'
13167 echo " "
13168 $cat >try.c <<EOCP
13169 #include <sys/types.h>
13170 #ifdef I_FCNTL
13171 #include <fcntl.h>
13172 #endif
13173 #ifdef I_SYS_FILE
13174 #include <sys/file.h>
13175 #endif
13176 #$i_stdlib I_STDLIB
13177 #ifdef I_STDLIB
13178 #include <stdlib.h>
13179 #endif
13180 int main() {
13181         if(O_RDONLY);
13182 #ifdef O_TRUNC
13183         exit(0);
13184 #else
13185         exit(1);
13186 #endif
13187 }
13188 EOCP
13189 : check sys/file.h first to get FREAD on Sun
13190 if $test `./findhdr sys/file.h` && \
13191                 set try -DI_SYS_FILE && eval $compile; then
13192         h_sysfile=true;
13193         echo "<sys/file.h> defines the O_* constants..." >&4
13194         if $run ./try; then
13195                 echo "and you have the 3 argument form of open()." >&4
13196                 val="$define"
13197         else
13198                 echo "but not the 3 argument form of open().  Oh, well." >&4
13199                 val="$undef"
13200         fi
13201 elif $test `./findhdr fcntl.h` && \
13202                 set try -DI_FCNTL && eval $compile; then
13203         h_fcntl=true;
13204         echo "<fcntl.h> defines the O_* constants..." >&4
13205         if $run ./try; then
13206                 echo "and you have the 3 argument form of open()." >&4
13207                 val="$define"
13208         else
13209                 echo "but not the 3 argument form of open().  Oh, well." >&4
13210                 val="$undef"
13211         fi
13212 else
13213         val="$undef"
13214         echo "I can't find the O_* constant definitions!  You got problems." >&4
13215 fi
13216 set d_open3
13217 eval $setvar
13218 $rm_try
13219
13220 : see if this is a sys/file.h system
13221 val=''
13222 set sys/file.h val
13223 eval $inhdr
13224
13225 : do we need to include sys/file.h ?
13226 case "$val" in
13227 "$define")
13228         echo " "
13229         if $h_sysfile; then
13230                 val="$define"
13231                 echo "We'll be including <sys/file.h>." >&4
13232         else
13233                 val="$undef"
13234                 echo "We won't be including <sys/file.h>." >&4
13235         fi
13236         ;;
13237 *)
13238         h_sysfile=false
13239         ;;
13240 esac
13241 set i_sysfile
13242 eval $setvar
13243
13244 : see if fcntl.h is there
13245 val=''
13246 set fcntl.h val
13247 eval $inhdr
13248
13249 : see if we can include fcntl.h
13250 case "$val" in
13251 "$define")
13252         echo " "
13253         if $h_fcntl; then
13254                 val="$define"
13255                 echo "We'll be including <fcntl.h>." >&4
13256         else
13257                 val="$undef"
13258                 if $h_sysfile; then
13259         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13260                 else
13261                         echo "We won't be including <fcntl.h>." >&4
13262                 fi
13263         fi
13264         ;;
13265 *)
13266         h_fcntl=false
13267         val="$undef"
13268         ;;
13269 esac
13270 set i_fcntl
13271 eval $setvar
13272
13273 : see if fork exists
13274 set fork d_fork
13275 eval $inlibc
13276
13277 : see if pipe exists
13278 set pipe d_pipe
13279 eval $inlibc
13280
13281 : check for non-blocking I/O stuff
13282 case "$h_sysfile" in
13283 true) echo "#include <sys/file.h>" > head.c;;
13284 *)
13285        case "$h_fcntl" in
13286        true) echo "#include <fcntl.h>" > head.c;;
13287        *) echo "#include <sys/fcntl.h>" > head.c;;
13288        esac
13289        ;;
13290 esac
13291 echo " "
13292 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13293 case "$o_nonblock" in
13294 '')
13295         $cat head.c > try.c
13296         $cat >>try.c <<EOCP
13297 #include <stdio.h>
13298 #$i_stdlib I_STDLIB
13299 #ifdef I_STDLIB
13300 #include <stdlib.h>
13301 #endif
13302 #$i_fcntl I_FCNTL
13303 #ifdef I_FCNTL
13304 #include <fcntl.h>
13305 #endif
13306 int main() {
13307 #ifdef O_NONBLOCK
13308         printf("O_NONBLOCK\n");
13309         exit(0);
13310 #endif
13311 #ifdef O_NDELAY
13312         printf("O_NDELAY\n");
13313         exit(0);
13314 #endif
13315 #ifdef FNDELAY
13316         printf("FNDELAY\n");
13317         exit(0);
13318 #endif
13319         exit(0);
13320 }
13321 EOCP
13322         set try
13323         if eval $compile_ok; then
13324                 o_nonblock=`$run ./try`
13325                 case "$o_nonblock" in
13326                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13327                 *) echo "Seems like we can use $o_nonblock.";;
13328                 esac
13329         else
13330                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13331         fi
13332         ;;
13333 *) echo "Using $hint value $o_nonblock.";;
13334 esac
13335 $rm_try
13336
13337 echo " "
13338 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13339 case "$eagain" in
13340 '')
13341         case "$d_fork:$d_pipe:$d_alarm" in
13342         define:define:define)
13343         $cat head.c > try.c
13344         $cat >>try.c <<EOCP
13345 #include <errno.h>
13346 #include <sys/types.h>
13347 #include <signal.h>
13348 #include <stdio.h>
13349 #$i_stdlib I_STDLIB
13350 #ifdef I_STDLIB
13351 #include <stdlib.h>
13352 #endif
13353 #$i_fcntl I_FCNTL
13354 #ifdef I_FCNTL
13355 #include <fcntl.h>
13356 #endif
13357 #define MY_O_NONBLOCK $o_nonblock
13358 #ifndef errno  /* XXX need better Configure test */
13359 extern int errno;
13360 #endif
13361 #$i_unistd I_UNISTD
13362 #ifdef I_UNISTD
13363 #include <unistd.h>
13364 #endif
13365 #$i_string I_STRING
13366 #ifdef I_STRING
13367 #include <string.h>
13368 #else
13369 #include <strings.h>
13370 #endif
13371 $signal_t blech(int x) { exit(3); }
13372 EOCP
13373         $cat >> try.c <<'EOCP'
13374 int main()
13375 {
13376         int pd[2];
13377         int pu[2];
13378         char buf[1];
13379         char string[100];
13380         int ret;
13381
13382         ret = pipe(pd); /* Down: child -> parent */
13383         if (ret != 0)
13384                 exit(3);
13385         ret = pipe(pu); /* Up: parent -> child */
13386         if (ret != 0)
13387                 exit(3);
13388         if (0 != fork()) {
13389                 close(pd[1]);   /* Parent reads from pd[0] */
13390                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13391 #ifdef F_SETFL
13392                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13393                         exit(1);
13394 #else
13395                 exit(4);
13396 #endif
13397                 signal(SIGALRM, blech);
13398                 alarm(5);
13399                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13400                         exit(2);
13401                 sprintf(string, "%d\n", ret);
13402                 ret = write(2, string, strlen(string));
13403                 if (ret != strlen(string))
13404                         exit(3);
13405                 alarm(0);
13406 #ifdef EAGAIN
13407                 if (errno == EAGAIN) {
13408                         printf("EAGAIN\n");
13409                         goto ok;
13410                 }
13411 #endif
13412 #ifdef EWOULDBLOCK
13413                 if (errno == EWOULDBLOCK)
13414                         printf("EWOULDBLOCK\n");
13415 #endif
13416         ok:
13417                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13418                 if (ret != 1)
13419                         exit(3);
13420                 sleep(2);                               /* Give it time to close our pipe */
13421                 alarm(5);
13422                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13423                 alarm(0);
13424                 sprintf(string, "%d\n", ret);
13425                 ret = write(4, string, strlen(string));
13426                 if (ret != strlen(string))
13427                         exit(3);
13428                 exit(0);
13429         }
13430
13431         close(pd[0]);                   /* We write to pd[1] */
13432         close(pu[1]);                   /* We read from pu[0] */
13433         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13434         if (ret != 1)
13435                 exit(3);
13436         close(pd[1]);                   /* Pipe pd is now fully closed! */
13437         exit(0);                                /* Bye bye, thank you for playing! */
13438 }
13439 EOCP
13440         set try
13441         if eval $compile_ok; then
13442                 echo "$startsh" >mtry
13443                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13444                 chmod +x mtry
13445                 $run ./mtry >/dev/null 2>&1
13446                 case $? in
13447                 0) eagain=`$cat try.out`;;
13448                 1) echo "Could not perform non-blocking setting!";;
13449                 2) echo "I did a successful read() for something that was not there!";;
13450                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13451                 4) echo "Could not find F_SETFL!";;
13452                 *) echo "Something terribly wrong happened during testing.";;
13453                 esac
13454                 rd_nodata=`$cat try.ret`
13455                 echo "A read() system call with no data present returns $rd_nodata."
13456                 case "$rd_nodata" in
13457                 0|-1) ;;
13458                 *)
13459                         echo "(That's peculiar, fixing that to be -1.)"
13460                         rd_nodata=-1
13461                         ;;
13462                 esac
13463                 case "$eagain" in
13464                 '')
13465                         echo "Forcing errno EAGAIN on read() with no data available."
13466                         eagain=EAGAIN
13467                         ;;
13468                 *)
13469                         echo "Your read() sets errno to $eagain when no data is available."
13470                         ;;
13471                 esac
13472                 status=`$cat try.err`
13473                 case "$status" in
13474                 0) echo "And it correctly returns 0 to signal EOF.";;
13475                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13476                 *) echo "However, your read() returns '$status' on EOF??";;
13477                 esac
13478                 val="$define"
13479                 if test "$status" = "$rd_nodata"; then
13480                         echo "WARNING: you can't distinguish between EOF and no data!"
13481                         val="$undef"
13482                 fi
13483         else
13484                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13485                 eagain=EAGAIN
13486         fi
13487         ;;
13488         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13489                 eagain=EAGAIN
13490                 val="$define"
13491                 ;;
13492         esac
13493         set d_eofnblk
13494         eval $setvar
13495         ;;
13496 *)
13497         echo "Using $hint value $eagain."
13498         echo "Your read() returns $rd_nodata when no data is present."
13499         case "$d_eofnblk" in
13500         "$define") echo "And you can see EOF because read() returns 0.";;
13501         "$undef") echo "But you can't see EOF status from read() returned value.";;
13502         *)
13503                 echo "(Assuming you can't see EOF status from read anyway.)"
13504                 d_eofnblk=$undef
13505                 ;;
13506         esac
13507         ;;
13508 esac
13509 $rm_try head.c mtry
13510
13511 : see if erf exists
13512 set erf d_erf
13513 eval $inlibc
13514
13515 : see if erfc exists
13516 set erfc d_erfc
13517 eval $inlibc
13518
13519 : see if exp2 exists
13520 set exp2 d_exp2
13521 eval $inlibc
13522
13523 : see if expm1 exists
13524 set expm1 d_expm1
13525 eval $inlibc
13526
13527 : see if _ptr and _cnt from stdio act std
13528 echo " "
13529
13530 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13531         echo "(Looks like you have stdio.h from BSD.)"
13532         case "$stdio_ptr" in
13533         '') stdio_ptr='((fp)->_p)'
13534                 ptr_lval=$define
13535                 ;;
13536         *)      ptr_lval=$d_stdio_ptr_lval;;
13537         esac
13538         case "$stdio_cnt" in
13539         '') stdio_cnt='((fp)->_r)'
13540                 cnt_lval=$define
13541                 ;;
13542         *)      cnt_lval=$d_stdio_cnt_lval;;
13543         esac
13544         case "$stdio_base" in
13545         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13546         esac
13547         case "$stdio_bufsiz" in
13548         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13549         esac
13550 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13551         echo "(Looks like you have stdio.h from Linux.)"
13552         case "$stdio_ptr" in
13553         '') stdio_ptr='((fp)->_IO_read_ptr)'
13554                 ptr_lval=$define
13555                 ;;
13556         *)      ptr_lval=$d_stdio_ptr_lval;;
13557         esac
13558         case "$stdio_cnt" in
13559         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13560                 cnt_lval=$undef
13561                 ;;
13562         *)      cnt_lval=$d_stdio_cnt_lval;;
13563         esac
13564         case "$stdio_base" in
13565         '') stdio_base='((fp)->_IO_read_base)';;
13566         esac
13567         case "$stdio_bufsiz" in
13568         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13569         esac
13570 else
13571         case "$stdio_ptr" in
13572         '') stdio_ptr='((fp)->_ptr)'
13573                 ptr_lval=$define
13574                 ;;
13575         *)      ptr_lval=$d_stdio_ptr_lval;;
13576         esac
13577         case "$stdio_cnt" in
13578         '') stdio_cnt='((fp)->_cnt)'
13579                 cnt_lval=$define
13580                 ;;
13581         *)      cnt_lval=$d_stdio_cnt_lval;;
13582         esac
13583         case "$stdio_base" in
13584         '') stdio_base='((fp)->_base)';;
13585         esac
13586         case "$stdio_bufsiz" in
13587         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13588         esac
13589 fi
13590
13591 : test whether _ptr and _cnt really work
13592 echo "Checking how std your stdio is..." >&4
13593 $cat >try.c <<EOP
13594 #include <stdio.h>
13595 #$i_stdlib I_STDLIB
13596 #ifdef I_STDLIB
13597 #include <stdlib.h>
13598 #endif
13599 #define FILE_ptr(fp)    $stdio_ptr
13600 #define FILE_cnt(fp)    $stdio_cnt
13601 int main() {
13602         FILE *fp = fopen("try.c", "r");
13603         char c = getc(fp);
13604         if (
13605                 18 <= FILE_cnt(fp) &&
13606                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13607         )
13608                 exit(0);
13609         exit(1);
13610 }
13611 EOP
13612 val="$undef"
13613 set try
13614 if eval $compile && $to try.c; then
13615         if $run ./try; then
13616                 echo "Your stdio acts pretty std."
13617                 val="$define"
13618         else
13619                 echo "Your stdio isn't very std."
13620         fi
13621 else
13622         echo "Your stdio doesn't appear very std."
13623 fi
13624 $rm_try
13625
13626 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13627 # direct buffer manipulation no longer works.  The Configure tests
13628 # should be changed to correctly detect this, but until then,
13629 # the following check should at least let perl compile and run.
13630 # (This quick fix should be updated before 5.8.1.)
13631 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13632 # A. Dougherty, June 3, 2002.
13633 case "$d_gnulibc" in
13634 $define)
13635         case "$gnulibc_version" in
13636         2.[01]*)  ;;
13637         2.2) ;;
13638         2.2.[0-9]) ;;
13639         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13640                 val="$undef"
13641                 ;;
13642         esac
13643         ;;
13644 esac
13645 set d_stdstdio
13646 eval $setvar
13647
13648 : Can _ptr be used as an lvalue?
13649 case "$d_stdstdio$ptr_lval" in
13650 $define$define) val=$define ;;
13651 *) val=$undef ;;
13652 esac
13653 set d_stdio_ptr_lval
13654 eval $setvar
13655
13656 : Can _cnt be used as an lvalue?
13657 case "$d_stdstdio$cnt_lval" in
13658 $define$define) val=$define ;;
13659 *) val=$undef ;;
13660 esac
13661 set d_stdio_cnt_lval
13662 eval $setvar
13663
13664
13665 : test whether setting _ptr sets _cnt as a side effect
13666 d_stdio_ptr_lval_sets_cnt="$undef"
13667 d_stdio_ptr_lval_nochange_cnt="$undef"
13668 case "$d_stdio_ptr_lval$d_stdstdio" in
13669 $define$define)
13670         echo "Checking to see what happens if we set the stdio ptr..." >&4
13671 $cat >try.c <<EOP
13672 #include <stdio.h>
13673 /* Can we scream? */
13674 /* Eat dust sed :-) */
13675 /* In the buffer space, no one can hear you scream. */
13676 #$i_stdlib I_STDLIB
13677 #ifdef I_STDLIB
13678 #include <stdlib.h>
13679 #endif
13680 #define FILE_ptr(fp)    $stdio_ptr
13681 #define FILE_cnt(fp)    $stdio_cnt
13682 #include <sys/types.h>
13683 int main() {
13684         FILE *fp = fopen("try.c", "r");
13685         int c;
13686         char *ptr;
13687         size_t cnt;
13688         if (!fp) {
13689             puts("Fail even to read");
13690             exit(1);
13691         }
13692         c = getc(fp); /* Read away the first # */
13693         if (c == EOF) {
13694             puts("Fail even to read");
13695             exit(1);
13696         }
13697         if (!(
13698                 18 <= FILE_cnt(fp) &&
13699                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13700         )) {
13701                 puts("Fail even to read");
13702                 exit (1);
13703         }
13704         ptr = (char*) FILE_ptr(fp);
13705         cnt = (size_t)FILE_cnt(fp);
13706
13707         FILE_ptr(fp) += 42;
13708
13709         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13710                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13711                 exit (1);
13712         }
13713         if (FILE_cnt(fp) <= 20) {
13714                 printf ("Fail (<20 chars to test)");
13715                 exit (1);
13716         }
13717         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13718                 puts("Fail compare");
13719                 exit (1);
13720         }
13721         if (cnt == FILE_cnt(fp)) {
13722                 puts("Pass_unchanged");
13723                 exit (0);
13724         }
13725         if (FILE_cnt(fp) == (cnt - 42)) {
13726                 puts("Pass_changed");
13727                 exit (0);
13728         }
13729         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13730         return 1;
13731
13732 }
13733 EOP
13734         set try
13735         if eval $compile && $to try.c; then
13736                 case `$run ./try` in
13737                 Pass_changed)
13738                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13739                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13740                 Pass_unchanged)
13741                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13742                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13743                 Fail*)
13744                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13745                 *)
13746                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13747         esac
13748         else
13749                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13750         fi
13751         $rm_try
13752         ;;
13753 esac
13754
13755 : see if _base is also standard
13756 val="$undef"
13757 case "$d_stdstdio" in
13758 $define)
13759         $cat >try.c <<EOP
13760 #include <stdio.h>
13761 #$i_stdlib I_STDLIB
13762 #ifdef I_STDLIB
13763 #include <stdlib.h>
13764 #endif
13765 #define FILE_base(fp)   $stdio_base
13766 #define FILE_bufsiz(fp) $stdio_bufsiz
13767 int main() {
13768         FILE *fp = fopen("try.c", "r");
13769         char c = getc(fp);
13770         if (
13771                 19 <= FILE_bufsiz(fp) &&
13772                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13773         )
13774                 exit(0);
13775         exit(1);
13776 }
13777 EOP
13778         set try
13779         if eval $compile && $to try.c; then
13780                 if $run ./try; then
13781                         echo "And its _base field acts std."
13782                         val="$define"
13783                 else
13784                         echo "But its _base field isn't std."
13785                 fi
13786         else
13787                 echo "However, it seems to be lacking the _base field."
13788         fi
13789         $rm_try
13790         ;;
13791 esac
13792 set d_stdiobase
13793 eval $setvar
13794
13795 : see if fast_stdio exists
13796 val="$undef"
13797 case "$d_stdstdio:$d_stdio_ptr_lval" in
13798 "$define:$define")
13799         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13800         *$define*)
13801                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13802                 val="$define"
13803                 ;;
13804         esac
13805         ;;
13806 esac
13807 set d_faststdio
13808 eval $setvar
13809
13810
13811
13812 : see if fchdir exists
13813 set fchdir d_fchdir
13814 eval $inlibc
13815
13816 : see if fchmod exists
13817 set fchmod d_fchmod
13818 eval $inlibc
13819
13820 : check for openat, unlinkat, renameat, linkat, fchmodat
13821 set openat d_openat
13822 eval $inlibc
13823
13824 set unlinkat d_unlinkat
13825 eval $inlibc
13826
13827 set renameat d_renameat
13828 eval $inlibc
13829
13830 set linkat d_linkat
13831 eval $inlibc
13832
13833 set fchmodat d_fchmodat
13834 eval $inlibc
13835
13836 : see if fchown exists
13837 set fchown d_fchown
13838 eval $inlibc
13839
13840 : see if this is an fcntl system
13841 set fcntl d_fcntl
13842 eval $inlibc
13843
13844 : See if fcntl-based locking works.
13845 echo " "
13846 $cat >try.c <<EOCP
13847 #$i_stdlib I_STDLIB
13848 #ifdef I_STDLIB
13849 #include <stdlib.h>
13850 #endif
13851 #include <unistd.h>
13852 #include <fcntl.h>
13853 #include <signal.h>
13854 $signal_t blech(int x) { exit(3); }
13855 int main() {
13856 #if defined(F_SETLK) && defined(F_SETLKW)
13857      struct flock flock;
13858      int retval, fd;
13859      fd = open("try.c", O_RDONLY);
13860      flock.l_type = F_RDLCK;
13861      flock.l_whence = SEEK_SET;
13862      flock.l_start = flock.l_len = 0;
13863      signal(SIGALRM, blech);
13864      alarm(10);
13865      retval = fcntl(fd, F_SETLK, &flock);
13866      close(fd);
13867      (retval < 0 ? exit(2) : exit(0));
13868 #else
13869      exit(2);
13870 #endif
13871 }
13872 EOCP
13873 echo "Checking if fcntl-based file locking works... "
13874 case "$d_fcntl" in
13875 "$define")
13876         set try
13877         if eval $compile_ok; then
13878                 if $run ./try; then
13879                         echo "Yes, it seems to work."
13880                         val="$define"
13881                 else
13882                         echo "Nope, it didn't work."
13883                         val="$undef"
13884                         case "$?" in
13885                         3) $cat >&4 <<EOM
13886 ***
13887 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13888 *** This is (almost) impossible.
13889 *** If your NFS lock daemons are not feeling well, something like
13890 *** this may happen, please investigate.  Cannot continue, aborting.
13891 ***
13892 EOM
13893                                 exit 1
13894                                 ;;
13895                         esac
13896                 fi
13897         else
13898                 echo "I'm unable to compile the test program, so I'll assume not."
13899                 val="$undef"
13900         fi
13901         ;;
13902 *) val="$undef";
13903         echo "Nope, since you don't even have fcntl()."
13904         ;;
13905 esac
13906 set d_fcntl_can_lock
13907 eval $setvar
13908 $rm_try
13909
13910 : check for fd_set items
13911 $cat <<EOM
13912
13913 Checking to see how well your C compiler handles fd_set and friends ...
13914 EOM
13915 $cat >try.c <<EOCP
13916 #$i_stdlib I_STDLIB
13917 #ifdef I_STDLIB
13918 #include <stdlib.h>
13919 #endif
13920 #$i_systime I_SYS_TIME
13921 #$i_sysselct I_SYS_SELECT
13922 #$d_socket HAS_SOCKET
13923 #include <sys/types.h>
13924 #ifdef HAS_SOCKET
13925 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13926 #endif
13927 #ifdef I_SYS_TIME
13928 #include <sys/time.h>
13929 #endif
13930 #ifdef I_SYS_SELECT
13931 #include <sys/select.h>
13932 #endif
13933 int main() {
13934         fd_set fds;
13935
13936 #ifdef TRYBITS
13937         if(fds.fds_bits);
13938 #endif
13939
13940 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13941         exit(0);
13942 #else
13943         exit(1);
13944 #endif
13945 }
13946 EOCP
13947 set try -DTRYBITS
13948 if eval $compile; then
13949         d_fds_bits="$define"
13950         d_fd_set="$define"
13951         echo "Well, your system knows about the normal fd_set typedef..." >&4
13952         if $run ./try; then
13953                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13954                 d_fd_macros="$define"
13955         else
13956                 $cat >&4 <<'EOM'
13957 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13958 EOM
13959                 d_fd_macros="$undef"
13960         fi
13961 else
13962         $cat <<'EOM'
13963 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13964 EOM
13965         set try
13966         if eval $compile; then
13967                 d_fds_bits="$undef"
13968                 d_fd_set="$define"
13969                 echo "Well, your system has some sort of fd_set available..." >&4
13970                 if $run ./try; then
13971                         echo "and you have the normal fd_set macros." >&4
13972                         d_fd_macros="$define"
13973                 else
13974                         $cat <<'EOM'
13975 but not the normal fd_set macros!  Gross!  More work for me...
13976 EOM
13977                         d_fd_macros="$undef"
13978                 fi
13979         else
13980         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13981                 d_fd_set="$undef"
13982                 d_fds_bits="$undef"
13983                 d_fd_macros="$undef"
13984         fi
13985 fi
13986 $rm_try
13987
13988 : see if fdclose exists
13989 set fdclose d_fdclose
13990 eval $inlibc
13991
13992 : see if fdim exists
13993 set fdim d_fdim
13994 eval $inlibc
13995
13996 : see if fegetround exists
13997 set fegetround d_fegetround
13998 eval $inlibc
13999
14000 : see if fgetpos exists
14001 set fgetpos d_fgetpos
14002 eval $inlibc
14003
14004 : see if finite exists
14005 set finite d_finite
14006 eval $inlibc
14007
14008 : see if finitel exists
14009 set finitel d_finitel
14010 eval $inlibc
14011
14012 : see if flock exists
14013 set flock d_flock
14014 eval $inlibc
14015
14016 : see if prototype for flock is available
14017 echo " "
14018 set d_flockproto flock $i_sysfile sys/file.h
14019 eval $hasproto
14020
14021 : see if fma exists
14022 set fma d_fma
14023 eval $inlibc
14024
14025 : see if fmax exists
14026 set fmax d_fmax
14027 eval $inlibc
14028
14029 : see if fmin exists
14030 set fmin d_fmin
14031 eval $inlibc
14032
14033 : see if fp_class exists
14034 set fp_class d_fp_class
14035 eval $inlibc
14036
14037 : see if this is a math.h system
14038 set math.h i_math
14039 eval $inhdr
14040
14041 : check for fpclassify
14042 echo "Checking to see if you have fpclassify..." >&4
14043 $cat >try.c <<EOCP
14044 #$i_math I_MATH
14045 #ifdef I_MATH
14046 #include <math.h>
14047 #endif
14048 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
14049 EOCP
14050 set try
14051 if eval $compile; then
14052         val="$define"
14053         echo "You have fpclassify."
14054 else
14055         val="$undef"
14056         echo "You do not have fpclassify."
14057 fi
14058 $rm_try
14059 set d_fpclassify
14060 eval $setvar
14061
14062 : see if fp_classify exists
14063 set fp_classify d_fp_classify
14064 eval $inlibc
14065
14066 : see if fp_classl exists
14067 set fp_classl d_fp_classl
14068 eval $inlibc
14069
14070 : see if pathconf exists
14071 set pathconf d_pathconf
14072 eval $inlibc
14073
14074 : see if fpathconf exists
14075 set fpathconf d_fpathconf
14076 eval $inlibc
14077
14078 : see if fpclass exists
14079 set fpclass d_fpclass
14080 eval $inlibc
14081
14082 : see if fpclassl exists
14083 set fpclassl d_fpclassl
14084 eval $inlibc
14085
14086 : see if fpgetround exists
14087 set fpgetround d_fpgetround
14088 eval $inlibc
14089
14090 : check for fpos64_t
14091 echo " "
14092 echo "Checking to see if you have fpos64_t..." >&4
14093 $cat >try.c <<EOCP
14094 #include <stdio.h>
14095 int main() { fpos64_t x = 7; }
14096 EOCP
14097 set try
14098 if eval $compile; then
14099         val="$define"
14100         echo "You have fpos64_t."
14101 else
14102         val="$undef"
14103         echo "You do not have fpos64_t."
14104         case "$fpossize" in
14105         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14106         esac
14107 fi
14108 $rm_try
14109 set d_fpos64_t
14110 eval $setvar
14111
14112 : see if this is an xlocale.h system
14113 set xlocale.h i_xlocale
14114 eval $inhdr
14115
14116 : see if newlocale exists
14117 set newlocale d_newlocale
14118 eval $inlibc
14119
14120 : see if freelocale exists
14121 set freelocale d_freelocale
14122 eval $inlibc
14123
14124 : see if uselocale exists
14125 set uselocale d_uselocale
14126 eval $inlibc
14127
14128 : see if duplocale exists
14129 set duplocale d_duplocale
14130 eval $inlibc
14131
14132 : see if querylocale exists
14133 set querylocale d_querylocale
14134 eval $inlibc
14135
14136 : see if frexpl exists
14137 set frexpl d_frexpl
14138 eval $inlibc
14139
14140 : see if this is a sys/param system
14141 set sys/param.h i_sysparam
14142 eval $inhdr
14143
14144 : see if this is a sys/mount.h system
14145 set sys/mount.h i_sysmount
14146 eval $inhdr
14147
14148 : Check for fs_data_s
14149 echo " "
14150 echo "Checking to see if your system supports struct fs_data..." >&4
14151 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14152 eval $hasstruct
14153 case "$d_fs_data_s" in
14154 "$define")      echo "Yes, it does."   ;;
14155 *)              echo "No, it doesn't." ;;
14156 esac
14157
14158 : see if fseeko exists
14159 set fseeko d_fseeko
14160 eval $inlibc
14161 case "$longsize" in
14162 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14163 esac
14164
14165 : see if fsetpos exists
14166 set fsetpos d_fsetpos
14167 eval $inlibc
14168
14169 : see if fstatfs exists
14170 set fstatfs d_fstatfs
14171 eval $inlibc
14172
14173 : see if statvfs exists
14174 set statvfs d_statvfs
14175 eval $inlibc
14176
14177 : see if fstatvfs exists
14178 set fstatvfs d_fstatvfs
14179 eval $inlibc
14180
14181
14182 : see if fsync exists
14183 set fsync d_fsync
14184 eval $inlibc
14185
14186 : see if ftello exists
14187 set ftello d_ftello
14188 eval $inlibc
14189 case "$longsize" in
14190 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14191 esac
14192
14193 : check for a working futimes
14194 d_futimes="$undef"
14195 echo " "
14196 echo "Checking if you have a working futimes()" >&4
14197 $cat >try.c <<EOCP
14198 #include <stdio.h>
14199 #include <sys/time.h>
14200 #include <errno.h>
14201 #include <fcntl.h>
14202
14203 int main ()
14204 {
14205     int fd, rv;
14206     fd = open ("try.c", O_RDWR);
14207     if (-1 == fd) exit (1);
14208     rv = futimes (fd, NULL);
14209     exit (rv == -1 ? errno : 0);
14210 }
14211 EOCP
14212 set try
14213 if eval $compile; then
14214     `$run ./try`
14215     rc=$?
14216     case "$rc" in
14217         0)  echo "Yes, you have" >&4
14218             d_futimes="$define"
14219             ;;
14220         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14221             ;;
14222     esac
14223 else
14224     echo "No, it does not (probably harmless)" >&4
14225 fi
14226 $rm_try
14227
14228 : look for gai_strerror
14229 echo " "
14230 $cat >try.c <<'EOCP'
14231 #include <sys/types.h>
14232 #include <sys/socket.h>
14233 #include <netdb.h>
14234 int main ()
14235 {
14236     return (gai_strerror (0) ? 0 : 1);
14237     }
14238 EOCP
14239 set try
14240 val="$undef"
14241 if eval $compile; then
14242     `$run ./try`
14243     case "$?" in
14244         0)  echo "A working gai_strerror() found." >&4
14245             val="$define" ;;
14246         *)  echo "gai_strerror() found, but it doesn't work" >&4
14247             ;;
14248         esac
14249 else
14250     echo "gai_strerror() NOT found." >&4
14251     fi
14252 set d_gai_strerror
14253 eval $setvar
14254 $rm_try
14255
14256 : see if ndbm.h is available
14257 set ndbm.h i_ndbm
14258 eval $inhdr
14259 : Compatibility location for RedHat 7.1
14260 set gdbm/ndbm.h i_gdbmndbm
14261 eval $inhdr
14262 : Compatibility location for Debian 4.0
14263 set gdbm-ndbm.h i_gdbm_ndbm
14264 eval $inhdr
14265
14266 val="$undef"
14267 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14268         : see if dbm_open exists
14269         set dbm_open d_dbm_open
14270         eval $inlibc
14271         case "$d_dbm_open" in
14272         $undef)
14273                 i_ndbm="$undef"
14274                 i_gdbmndbm="$undef"
14275                 i_gdbm_ndbm="$undef"
14276                 echo "We won't be including <ndbm.h>"
14277                 val="$undef"
14278                 ;;
14279         *) val="$define"
14280            ;;
14281         esac
14282 fi
14283 set d_ndbm
14284 eval $setvar
14285
14286 ndbm_hdr_protochk='name=$1; hdr=$2;
14287 eval "ihdr=\$""i_$name";
14288 val="$undef";
14289 if $test "$ihdr" = "$define"; then
14290         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14291         case "$d_cplusplus" in
14292         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14293         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14294         esac;
14295         case "$val" in
14296         $define) $echo "Your <$hdr> seems to have prototypes";;
14297         *) $echo "Your <$hdr> does not seem to have prototypes";;
14298         esac;
14299 fi;
14300 set "d_${name}_h_uses_prototypes";
14301 eval $setvar'
14302
14303 set ndbm ndbm.h
14304 eval $ndbm_hdr_protochk
14305 set gdbmndbm gdbm/ndbm.h
14306 eval $ndbm_hdr_protochk
14307 set gdbm_ndbm gdbm-ndbm.h
14308 eval $ndbm_hdr_protochk
14309
14310 : see if getaddrinfo exists
14311 set getaddrinfo d_getaddrinfo
14312 eval $inlibc
14313
14314 : see if getcwd exists
14315 set getcwd d_getcwd
14316 eval $inlibc
14317
14318 : see if getespwnam exists
14319 set getespwnam d_getespwnam
14320 eval $inlibc
14321
14322 : see if getfsstat exists
14323 set getfsstat d_getfsstat
14324 eval $inlibc
14325
14326 : see if getgrent exists
14327 set getgrent d_getgrent
14328 eval $inlibc
14329
14330 : see if getgrent_r exists
14331 set getgrent_r d_getgrent_r
14332 eval $inlibc
14333 case "$d_getgrent_r" in
14334 "$define")
14335         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14336         case "$d_getgrent_r_proto:$usethreads" in
14337         ":define")      d_getgrent_r_proto=define
14338                 set d_getgrent_r_proto getgrent_r $hdrs
14339                 eval $hasproto ;;
14340         *)      ;;
14341         esac
14342         case "$d_getgrent_r_proto" in
14343         define)
14344         case "$getgrent_r_proto" in
14345         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14346         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14347         esac
14348         case "$getgrent_r_proto" in
14349         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14350         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14351         esac
14352         case "$getgrent_r_proto" in
14353         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14354         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14355         esac
14356         case "$getgrent_r_proto" in
14357         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14358         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14359         esac
14360         case "$getgrent_r_proto" in
14361         ''|0) try='int getgrent_r(struct group*, char*, int);'
14362         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14363         esac
14364         case "$getgrent_r_proto" in
14365         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14366         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14367         esac
14368         case "$getgrent_r_proto" in
14369         ''|0)   d_getgrent_r=undef
14370                 getgrent_r_proto=0
14371                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14372         * )     case "$getgrent_r_proto" in
14373                 REENTRANT_PROTO*) ;;
14374                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14375                 esac
14376                 echo "Prototype: $try" ;;
14377         esac
14378         ;;
14379         *)      case "$usethreads" in
14380                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14381                 esac
14382                 d_getgrent_r=undef
14383                 getgrent_r_proto=0
14384                 ;;
14385         esac
14386         ;;
14387 *)      getgrent_r_proto=0
14388         ;;
14389 esac
14390
14391 : see if getgrgid_r exists
14392 set getgrgid_r d_getgrgid_r
14393 eval $inlibc
14394 case "$d_getgrgid_r" in
14395 "$define")
14396         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14397         case "$d_getgrgid_r_proto:$usethreads" in
14398         ":define")      d_getgrgid_r_proto=define
14399                 set d_getgrgid_r_proto getgrgid_r $hdrs
14400                 eval $hasproto ;;
14401         *)      ;;
14402         esac
14403         case "$d_getgrgid_r_proto" in
14404         define)
14405         case "$getgrgid_r_proto" in
14406         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14407         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14408         esac
14409         case "$getgrgid_r_proto" in
14410         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14411         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14412         esac
14413         case "$getgrgid_r_proto" in
14414         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14415         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14416         esac
14417         case "$getgrgid_r_proto" in
14418         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14419         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14420         esac
14421         case "$getgrgid_r_proto" in
14422         ''|0)   d_getgrgid_r=undef
14423                 getgrgid_r_proto=0
14424                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14425         * )     case "$getgrgid_r_proto" in
14426                 REENTRANT_PROTO*) ;;
14427                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14428                 esac
14429                 echo "Prototype: $try" ;;
14430         esac
14431         ;;
14432         *)      case "$usethreads" in
14433                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14434                 esac
14435                 d_getgrgid_r=undef
14436                 getgrgid_r_proto=0
14437                 ;;
14438         esac
14439         ;;
14440 *)      getgrgid_r_proto=0
14441         ;;
14442 esac
14443
14444 : see if getgrnam_r exists
14445 set getgrnam_r d_getgrnam_r
14446 eval $inlibc
14447 case "$d_getgrnam_r" in
14448 "$define")
14449         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14450         case "$d_getgrnam_r_proto:$usethreads" in
14451         ":define")      d_getgrnam_r_proto=define
14452                 set d_getgrnam_r_proto getgrnam_r $hdrs
14453                 eval $hasproto ;;
14454         *)      ;;
14455         esac
14456         case "$d_getgrnam_r_proto" in
14457         define)
14458         case "$getgrnam_r_proto" in
14459         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14460         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14461         esac
14462         case "$getgrnam_r_proto" in
14463         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14464         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14465         esac
14466         case "$getgrnam_r_proto" in
14467         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14468         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14469         esac
14470         case "$getgrnam_r_proto" in
14471         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14472         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14473         esac
14474         case "$getgrnam_r_proto" in
14475         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14476         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14477         esac
14478         case "$getgrnam_r_proto" in
14479         ''|0)   d_getgrnam_r=undef
14480                 getgrnam_r_proto=0
14481                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14482         * )     case "$getgrnam_r_proto" in
14483                 REENTRANT_PROTO*) ;;
14484                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14485                 esac
14486                 echo "Prototype: $try" ;;
14487         esac
14488         ;;
14489         *)      case "$usethreads" in
14490                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14491                 esac
14492                 d_getgrnam_r=undef
14493                 getgrnam_r_proto=0
14494                 ;;
14495         esac
14496         ;;
14497 *)      getgrnam_r_proto=0
14498         ;;
14499 esac
14500
14501 : see if gethostbyaddr exists
14502 set gethostbyaddr d_gethbyaddr
14503 eval $inlibc
14504
14505 : see if gethostbyname exists
14506 set gethostbyname d_gethbyname
14507 eval $inlibc
14508
14509 : see if gethostent exists
14510 set gethostent d_gethent
14511 eval $inlibc
14512
14513 : see how we will look up host name
14514 echo " "
14515 call=''
14516 if set gethostname val -f d_gethname; eval $csym; $val; then
14517         echo 'gethostname() found.' >&4
14518         d_gethname="$define"
14519         call=gethostname
14520 fi
14521 if set uname val -f d_uname; eval $csym; $val; then
14522         if ./xenix; then
14523                 $cat <<'EOM'
14524 uname() was found, but you're running xenix, and older versions of xenix
14525 have a broken uname(). If you don't really know whether your xenix is old
14526 enough to have a broken system call, use the default answer.
14527
14528 EOM
14529                 dflt=y
14530                 case "$d_uname" in
14531                 "$define") dflt=n;;
14532                 esac
14533                 rp='Is your uname() broken?'
14534                 . ./myread
14535                 case "$ans" in
14536                 n*) d_uname="$define"; call=uname;;
14537                 esac
14538         else
14539                 echo 'uname() found.' >&4
14540                 d_uname="$define"
14541                 case "$call" in
14542                 '') call=uname ;;
14543                 esac
14544         fi
14545 fi
14546 case "$d_gethname" in
14547 '') d_gethname="$undef";;
14548 esac
14549 case "$d_uname" in
14550 '') d_uname="$undef";;
14551 esac
14552 case "$d_uname$d_gethname" in
14553 *define*)
14554         dflt=n
14555         cat <<EOM
14556
14557 Every now and then someone has a $call() that lies about the hostname
14558 but can't be fixed for political or economic reasons.  If you wish, I can
14559 pretend $call() isn't there and maybe compute hostname at run-time
14560 thanks to the '$phostname' command.
14561
14562 EOM
14563         rp="Shall I ignore $call() from now on?"
14564         . ./myread
14565         case "$ans" in
14566         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14567         esac;;
14568 esac
14569 case "$phostname" in
14570 '') aphostname='';;
14571 *) case "$aphostname" in
14572         /*) ;;
14573         *) set X $phostname
14574                 shift
14575                 file=$1
14576                 shift
14577                 file=`./loc $file $file $pth`
14578                 aphostname=`echo $file $*`
14579                 ;;
14580         esac
14581         ;;
14582 esac
14583 case "$d_uname$d_gethname" in
14584 *define*) ;;
14585 *)
14586         case "$phostname" in
14587         '')
14588                 echo "There will be no way for $package to get your hostname." >&4;;
14589         *)
14590         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14591                 ;;
14592         esac;;
14593 esac
14594 case "$d_phostname" in
14595 '') d_phostname="$undef";;
14596 esac
14597
14598 : see if gethostbyaddr_r exists
14599 set gethostbyaddr_r d_gethostbyaddr_r
14600 eval $inlibc
14601 case "$d_gethostbyaddr_r" in
14602 "$define")
14603         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14604         case "$d_gethostbyaddr_r_proto:$usethreads" in
14605         ":define")      d_gethostbyaddr_r_proto=define
14606                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14607                 eval $hasproto ;;
14608         *)      ;;
14609         esac
14610         case "$d_gethostbyaddr_r_proto" in
14611         define)
14612         case "$gethostbyaddr_r_proto" in
14613         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14614         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14615         esac
14616         case "$gethostbyaddr_r_proto" in
14617         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14618         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14619         esac
14620         case "$gethostbyaddr_r_proto" in
14621         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14622         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14623         esac
14624         case "$gethostbyaddr_r_proto" in
14625         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14626         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14627         esac
14628         case "$gethostbyaddr_r_proto" in
14629         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14630         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14631         esac
14632         case "$gethostbyaddr_r_proto" in
14633         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14634         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14635         esac
14636         case "$gethostbyaddr_r_proto" in
14637         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14638         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14639         esac
14640         case "$gethostbyaddr_r_proto" in
14641         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14642         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14643         esac
14644         case "$gethostbyaddr_r_proto" in
14645         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14646         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14647         esac
14648         case "$gethostbyaddr_r_proto" in
14649         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14650         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14651         esac
14652         case "$gethostbyaddr_r_proto" in
14653         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14654         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14655         esac
14656         case "$gethostbyaddr_r_proto" in
14657         ''|0)   d_gethostbyaddr_r=undef
14658                 gethostbyaddr_r_proto=0
14659                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14660         * )     case "$gethostbyaddr_r_proto" in
14661                 REENTRANT_PROTO*) ;;
14662                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14663                 esac
14664                 echo "Prototype: $try" ;;
14665         esac
14666         ;;
14667         *)      case "$usethreads" in
14668                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14669                 esac
14670                 d_gethostbyaddr_r=undef
14671                 gethostbyaddr_r_proto=0
14672                 ;;
14673         esac
14674         ;;
14675 *)      gethostbyaddr_r_proto=0
14676         ;;
14677 esac
14678
14679 : see if gethostbyname_r exists
14680 set gethostbyname_r d_gethostbyname_r
14681 eval $inlibc
14682 case "$d_gethostbyname_r" in
14683 "$define")
14684         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14685         case "$d_gethostbyname_r_proto:$usethreads" in
14686         ":define")      d_gethostbyname_r_proto=define
14687                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14688                 eval $hasproto ;;
14689         *)      ;;
14690         esac
14691         case "$d_gethostbyname_r_proto" in
14692         define)
14693         case "$gethostbyname_r_proto" in
14694         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14695         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14696         esac
14697         case "$gethostbyname_r_proto" in
14698         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14699         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14700         esac
14701         case "$gethostbyname_r_proto" in
14702         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14703         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14704         esac
14705         case "$gethostbyname_r_proto" in
14706         ''|0)   d_gethostbyname_r=undef
14707                 gethostbyname_r_proto=0
14708                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14709         * )     case "$gethostbyname_r_proto" in
14710                 REENTRANT_PROTO*) ;;
14711                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14712                 esac
14713                 echo "Prototype: $try" ;;
14714         esac
14715         ;;
14716         *)      case "$usethreads" in
14717                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14718                 esac
14719                 d_gethostbyname_r=undef
14720                 gethostbyname_r_proto=0
14721                 ;;
14722         esac
14723         ;;
14724 *)      gethostbyname_r_proto=0
14725         ;;
14726 esac
14727
14728 : see if gethostent_r exists
14729 set gethostent_r d_gethostent_r
14730 eval $inlibc
14731 case "$d_gethostent_r" in
14732 "$define")
14733         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14734         case "$d_gethostent_r_proto:$usethreads" in
14735         ":define")      d_gethostent_r_proto=define
14736                 set d_gethostent_r_proto gethostent_r $hdrs
14737                 eval $hasproto ;;
14738         *)      ;;
14739         esac
14740         case "$d_gethostent_r_proto" in
14741         define)
14742         case "$gethostent_r_proto" in
14743         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14744         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14745         esac
14746         case "$gethostent_r_proto" in
14747         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14748         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14749         esac
14750         case "$gethostent_r_proto" in
14751         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14752         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14753         esac
14754         case "$gethostent_r_proto" in
14755         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14756         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14757         esac
14758         case "$gethostent_r_proto" in
14759         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14760         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14761         esac
14762         case "$gethostent_r_proto" in
14763         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14764         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14765         esac
14766         case "$gethostent_r_proto" in
14767         ''|0)   d_gethostent_r=undef
14768                 gethostent_r_proto=0
14769                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14770         * )     case "$gethostent_r_proto" in
14771                 REENTRANT_PROTO*) ;;
14772                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14773                 esac
14774                 echo "Prototype: $try" ;;
14775         esac
14776         ;;
14777         *)      case "$usethreads" in
14778                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14779                 esac
14780                 d_gethostent_r=undef
14781                 gethostent_r_proto=0
14782                 ;;
14783         esac
14784         ;;
14785 *)      gethostent_r_proto=0
14786         ;;
14787 esac
14788
14789 : see if prototypes for various gethostxxx netdb.h functions are available
14790 echo " "
14791 set d_gethostprotos gethostent $i_netdb netdb.h
14792 eval $hasproto
14793
14794 : see if getitimer exists
14795 set getitimer d_getitimer
14796 eval $inlibc
14797
14798 : see if getlogin exists
14799 set getlogin d_getlogin
14800 eval $inlibc
14801
14802 : see if getlogin_r exists
14803 set getlogin_r d_getlogin_r
14804 eval $inlibc
14805 case "$d_getlogin_r" in
14806 "$define")
14807         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14808         case "$d_getlogin_r_proto:$usethreads" in
14809         ":define")      d_getlogin_r_proto=define
14810                 set d_getlogin_r_proto getlogin_r $hdrs
14811                 eval $hasproto ;;
14812         *)      ;;
14813         esac
14814         case "$d_getlogin_r_proto" in
14815         define)
14816         case "$getlogin_r_proto" in
14817         ''|0) try='int getlogin_r(char*, size_t);'
14818         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14819         esac
14820         case "$getlogin_r_proto" in
14821         ''|0) try='int getlogin_r(char*, int);'
14822         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14823         esac
14824         case "$getlogin_r_proto" in
14825         ''|0) try='char* getlogin_r(char*, size_t);'
14826         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14827         esac
14828         case "$getlogin_r_proto" in
14829         ''|0) try='char* getlogin_r(char*, int);'
14830         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14831         esac
14832         case "$getlogin_r_proto" in
14833         ''|0)   d_getlogin_r=undef
14834                 getlogin_r_proto=0
14835                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14836         * )     case "$getlogin_r_proto" in
14837                 REENTRANT_PROTO*) ;;
14838                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14839                 esac
14840                 echo "Prototype: $try" ;;
14841         esac
14842         ;;
14843         *)      case "$usethreads" in
14844                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14845                 esac
14846                 d_getlogin_r=undef
14847                 getlogin_r_proto=0
14848                 ;;
14849         esac
14850         ;;
14851 *)      getlogin_r_proto=0
14852         ;;
14853 esac
14854
14855 : see if getmnt exists
14856 set getmnt d_getmnt
14857 eval $inlibc
14858
14859 : see if getmntent exists
14860 set getmntent d_getmntent
14861 eval $inlibc
14862
14863 : see if getnameinfo exists
14864 set getnameinfo d_getnameinfo
14865 eval $inlibc
14866
14867 : see if getnetbyaddr exists
14868 set getnetbyaddr d_getnbyaddr
14869 eval $inlibc
14870
14871 : see if getnetbyname exists
14872 set getnetbyname d_getnbyname
14873 eval $inlibc
14874
14875 : see if getnetent exists
14876 set getnetent d_getnent
14877 eval $inlibc
14878
14879 : see if getnetbyaddr_r exists
14880 set getnetbyaddr_r d_getnetbyaddr_r
14881 eval $inlibc
14882 case "$d_getnetbyaddr_r" in
14883 "$define")
14884         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14885         case "$d_getnetbyaddr_r_proto:$usethreads" in
14886         ":define")      d_getnetbyaddr_r_proto=define
14887                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14888                 eval $hasproto ;;
14889         *)      ;;
14890         esac
14891         case "$d_getnetbyaddr_r_proto" in
14892         define)
14893         case "$getnetbyaddr_r_proto" in
14894         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14895         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14896         esac
14897         case "$getnetbyaddr_r_proto" in
14898         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14899         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14900         esac
14901         case "$getnetbyaddr_r_proto" in
14902         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14903         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14904         esac
14905         case "$getnetbyaddr_r_proto" in
14906         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14907         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14908         esac
14909         case "$getnetbyaddr_r_proto" in
14910         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14911         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14912         esac
14913         case "$getnetbyaddr_r_proto" in
14914         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14915         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14916         esac
14917         case "$getnetbyaddr_r_proto" in
14918         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14919         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14920         esac
14921         case "$getnetbyaddr_r_proto" in
14922         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14923         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14924         esac
14925         case "$getnetbyaddr_r_proto" in
14926         ''|0)   d_getnetbyaddr_r=undef
14927                 getnetbyaddr_r_proto=0
14928                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14929         * )     case "$getnetbyaddr_r_proto" in
14930                 REENTRANT_PROTO*) ;;
14931                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14932                 esac
14933                 echo "Prototype: $try" ;;
14934         esac
14935         ;;
14936         *)      case "$usethreads" in
14937                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14938                 esac
14939                 d_getnetbyaddr_r=undef
14940                 getnetbyaddr_r_proto=0
14941                 ;;
14942         esac
14943         ;;
14944 *)      getnetbyaddr_r_proto=0
14945         ;;
14946 esac
14947
14948 : see if getnetbyname_r exists
14949 set getnetbyname_r d_getnetbyname_r
14950 eval $inlibc
14951 case "$d_getnetbyname_r" in
14952 "$define")
14953         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14954         case "$d_getnetbyname_r_proto:$usethreads" in
14955         ":define")      d_getnetbyname_r_proto=define
14956                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14957                 eval $hasproto ;;
14958         *)      ;;
14959         esac
14960         case "$d_getnetbyname_r_proto" in
14961         define)
14962         case "$getnetbyname_r_proto" in
14963         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14964         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14965         esac
14966         case "$getnetbyname_r_proto" in
14967         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14968         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14969         esac
14970         case "$getnetbyname_r_proto" in
14971         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14972         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14973         esac
14974         case "$getnetbyname_r_proto" in
14975         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14976         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14977         esac
14978         case "$getnetbyname_r_proto" in
14979         ''|0)   d_getnetbyname_r=undef
14980                 getnetbyname_r_proto=0
14981                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14982         * )     case "$getnetbyname_r_proto" in
14983                 REENTRANT_PROTO*) ;;
14984                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14985                 esac
14986                 echo "Prototype: $try" ;;
14987         esac
14988         ;;
14989         *)      case "$usethreads" in
14990                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14991                 esac
14992                 d_getnetbyname_r=undef
14993                 getnetbyname_r_proto=0
14994                 ;;
14995         esac
14996         ;;
14997 *)      getnetbyname_r_proto=0
14998         ;;
14999 esac
15000
15001 : see if getnetent_r exists
15002 set getnetent_r d_getnetent_r
15003 eval $inlibc
15004 case "$d_getnetent_r" in
15005 "$define")
15006         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15007         case "$d_getnetent_r_proto:$usethreads" in
15008         ":define")      d_getnetent_r_proto=define
15009                 set d_getnetent_r_proto getnetent_r $hdrs
15010                 eval $hasproto ;;
15011         *)      ;;
15012         esac
15013         case "$d_getnetent_r_proto" in
15014         define)
15015         case "$getnetent_r_proto" in
15016         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
15017         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
15018         esac
15019         case "$getnetent_r_proto" in
15020         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
15021         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
15022         esac
15023         case "$getnetent_r_proto" in
15024         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
15025         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
15026         esac
15027         case "$getnetent_r_proto" in
15028         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
15029         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
15030         esac
15031         case "$getnetent_r_proto" in
15032         ''|0) try='int getnetent_r(struct netent*, char*, int);'
15033         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
15034         esac
15035         case "$getnetent_r_proto" in
15036         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
15037         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
15038         esac
15039         case "$getnetent_r_proto" in
15040         ''|0)   d_getnetent_r=undef
15041                 getnetent_r_proto=0
15042                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
15043         * )     case "$getnetent_r_proto" in
15044                 REENTRANT_PROTO*) ;;
15045                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
15046                 esac
15047                 echo "Prototype: $try" ;;
15048         esac
15049         ;;
15050         *)      case "$usethreads" in
15051                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
15052                 esac
15053                 d_getnetent_r=undef
15054                 getnetent_r_proto=0
15055                 ;;
15056         esac
15057         ;;
15058 *)      getnetent_r_proto=0
15059         ;;
15060 esac
15061
15062 : see if prototypes for various getnetxxx netdb.h functions are available
15063 echo " "
15064 set d_getnetprotos getnetent $i_netdb netdb.h
15065 eval $hasproto
15066
15067 : see if getpagesize exists
15068 set getpagesize d_getpagsz
15069 eval $inlibc
15070
15071 : Optional checks for getprotobyname and getprotobynumber
15072
15073 : see if getprotobyname exists
15074 set getprotobyname d_getpbyname
15075 eval $inlibc
15076
15077 : see if getprotobynumber exists
15078 set getprotobynumber d_getpbynumber
15079 eval $inlibc
15080
15081 : see if getprotoent exists
15082 set getprotoent d_getpent
15083 eval $inlibc
15084
15085 : see if getpgid exists
15086 set getpgid d_getpgid
15087 eval $inlibc
15088
15089 : see if getpgrp2 exists
15090 set getpgrp2 d_getpgrp2
15091 eval $inlibc
15092
15093 : see if getppid exists
15094 set getppid d_getppid
15095 eval $inlibc
15096
15097 : see if getpriority exists
15098 set getpriority d_getprior
15099 eval $inlibc
15100
15101 : see if getprotobyname_r exists
15102 set getprotobyname_r d_getprotobyname_r
15103 eval $inlibc
15104 case "$d_getprotobyname_r" in
15105 "$define")
15106         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15107         case "$d_getprotobyname_r_proto:$usethreads" in
15108         ":define")      d_getprotobyname_r_proto=define
15109                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
15110                 eval $hasproto ;;
15111         *)      ;;
15112         esac
15113         case "$d_getprotobyname_r_proto" in
15114         define)
15115         case "$getprotobyname_r_proto" in
15116         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15117         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15118         esac
15119         case "$getprotobyname_r_proto" in
15120         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15121         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15122         esac
15123         case "$getprotobyname_r_proto" in
15124         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15125         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15126         esac
15127         case "$getprotobyname_r_proto" in
15128         ''|0)   d_getprotobyname_r=undef
15129                 getprotobyname_r_proto=0
15130                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15131         * )     case "$getprotobyname_r_proto" in
15132                 REENTRANT_PROTO*) ;;
15133                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15134                 esac
15135                 echo "Prototype: $try" ;;
15136         esac
15137         ;;
15138         *)      case "$usethreads" in
15139                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15140                 esac
15141                 d_getprotobyname_r=undef
15142                 getprotobyname_r_proto=0
15143                 ;;
15144         esac
15145         ;;
15146 *)      getprotobyname_r_proto=0
15147         ;;
15148 esac
15149
15150 : see if getprotobynumber_r exists
15151 set getprotobynumber_r d_getprotobynumber_r
15152 eval $inlibc
15153 case "$d_getprotobynumber_r" in
15154 "$define")
15155         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15156         case "$d_getprotobynumber_r_proto:$usethreads" in
15157         ":define")      d_getprotobynumber_r_proto=define
15158                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15159                 eval $hasproto ;;
15160         *)      ;;
15161         esac
15162         case "$d_getprotobynumber_r_proto" in
15163         define)
15164         case "$getprotobynumber_r_proto" in
15165         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15166         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15167         esac
15168         case "$getprotobynumber_r_proto" in
15169         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15170         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15171         esac
15172         case "$getprotobynumber_r_proto" in
15173         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15174         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15175         esac
15176         case "$getprotobynumber_r_proto" in
15177         ''|0)   d_getprotobynumber_r=undef
15178                 getprotobynumber_r_proto=0
15179                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15180         * )     case "$getprotobynumber_r_proto" in
15181                 REENTRANT_PROTO*) ;;
15182                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15183                 esac
15184                 echo "Prototype: $try" ;;
15185         esac
15186         ;;
15187         *)      case "$usethreads" in
15188                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15189                 esac
15190                 d_getprotobynumber_r=undef
15191                 getprotobynumber_r_proto=0
15192                 ;;
15193         esac
15194         ;;
15195 *)      getprotobynumber_r_proto=0
15196         ;;
15197 esac
15198
15199 : see if getprotoent_r exists
15200 set getprotoent_r d_getprotoent_r
15201 eval $inlibc
15202 case "$d_getprotoent_r" in
15203 "$define")
15204         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15205         case "$d_getprotoent_r_proto:$usethreads" in
15206         ":define")      d_getprotoent_r_proto=define
15207                 set d_getprotoent_r_proto getprotoent_r $hdrs
15208                 eval $hasproto ;;
15209         *)      ;;
15210         esac
15211         case "$d_getprotoent_r_proto" in
15212         define)
15213         case "$getprotoent_r_proto" in
15214         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15215         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15216         esac
15217         case "$getprotoent_r_proto" in
15218         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15219         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15220         esac
15221         case "$getprotoent_r_proto" in
15222         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15223         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15224         esac
15225         case "$getprotoent_r_proto" in
15226         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15227         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15228         esac
15229         case "$getprotoent_r_proto" in
15230         ''|0)   d_getprotoent_r=undef
15231                 getprotoent_r_proto=0
15232                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15233         * )     case "$getprotoent_r_proto" in
15234                 REENTRANT_PROTO*) ;;
15235                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15236                 esac
15237                 echo "Prototype: $try" ;;
15238         esac
15239         ;;
15240         *)      case "$usethreads" in
15241                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15242                 esac
15243                 d_getprotoent_r=undef
15244                 getprotoent_r_proto=0
15245                 ;;
15246         esac
15247         ;;
15248 *)      getprotoent_r_proto=0
15249         ;;
15250 esac
15251
15252 : see if prototypes for various getprotoxxx netdb.h functions are available
15253 echo " "
15254 set d_getprotoprotos getprotoent $i_netdb netdb.h
15255 eval $hasproto
15256
15257 : see if getprpwnam exists
15258 set getprpwnam d_getprpwnam
15259 eval $inlibc
15260
15261 : see if getpwent exists
15262 set getpwent d_getpwent
15263 eval $inlibc
15264
15265 : see if getpwent_r exists
15266 set getpwent_r d_getpwent_r
15267 eval $inlibc
15268 case "$d_getpwent_r" in
15269 "$define")
15270         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15271         case "$d_getpwent_r_proto:$usethreads" in
15272         ":define")      d_getpwent_r_proto=define
15273                 set d_getpwent_r_proto getpwent_r $hdrs
15274                 eval $hasproto ;;
15275         *)      ;;
15276         esac
15277         case "$d_getpwent_r_proto" in
15278         define)
15279         case "$getpwent_r_proto" in
15280         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15281         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15282         esac
15283         case "$getpwent_r_proto" in
15284         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15285         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15286         esac
15287         case "$getpwent_r_proto" in
15288         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15289         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15290         esac
15291         case "$getpwent_r_proto" in
15292         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15293         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15294         esac
15295         case "$getpwent_r_proto" in
15296         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15297         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15298         esac
15299         case "$getpwent_r_proto" in
15300         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15301         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15302         esac
15303         case "$getpwent_r_proto" in
15304         ''|0)   d_getpwent_r=undef
15305                 getpwent_r_proto=0
15306                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15307         * )     case "$getpwent_r_proto" in
15308                 REENTRANT_PROTO*) ;;
15309                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15310                 esac
15311                 echo "Prototype: $try" ;;
15312         esac
15313         ;;
15314         *)      case "$usethreads" in
15315                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15316                 esac
15317                 d_getpwent_r=undef
15318                 getpwent_r_proto=0
15319                 ;;
15320         esac
15321         ;;
15322 *)      getpwent_r_proto=0
15323         ;;
15324 esac
15325
15326 : see if getpwnam_r exists
15327 set getpwnam_r d_getpwnam_r
15328 eval $inlibc
15329 case "$d_getpwnam_r" in
15330 "$define")
15331         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15332         case "$d_getpwnam_r_proto:$usethreads" in
15333         ":define")      d_getpwnam_r_proto=define
15334                 set d_getpwnam_r_proto getpwnam_r $hdrs
15335                 eval $hasproto ;;
15336         *)      ;;
15337         esac
15338         case "$d_getpwnam_r_proto" in
15339         define)
15340         case "$getpwnam_r_proto" in
15341         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15342         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15343         esac
15344         case "$getpwnam_r_proto" in
15345         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15346         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15347         esac
15348         case "$getpwnam_r_proto" in
15349         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15350         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15351         esac
15352         case "$getpwnam_r_proto" in
15353         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15354         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15355         esac
15356         case "$getpwnam_r_proto" in
15357         ''|0)   d_getpwnam_r=undef
15358                 getpwnam_r_proto=0
15359                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15360         * )     case "$getpwnam_r_proto" in
15361                 REENTRANT_PROTO*) ;;
15362                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15363                 esac
15364                 echo "Prototype: $try" ;;
15365         esac
15366         ;;
15367         *)      case "$usethreads" in
15368                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15369                 esac
15370                 d_getpwnam_r=undef
15371                 getpwnam_r_proto=0
15372                 ;;
15373         esac
15374         ;;
15375 *)      getpwnam_r_proto=0
15376         ;;
15377 esac
15378
15379 : see if getpwuid_r exists
15380 set getpwuid_r d_getpwuid_r
15381 eval $inlibc
15382 case "$d_getpwuid_r" in
15383 "$define")
15384         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15385         case "$d_getpwuid_r_proto:$usethreads" in
15386         ":define")      d_getpwuid_r_proto=define
15387                 set d_getpwuid_r_proto getpwuid_r $hdrs
15388                 eval $hasproto ;;
15389         *)      ;;
15390         esac
15391         case "$d_getpwuid_r_proto" in
15392         define)
15393         case "$getpwuid_r_proto" in
15394         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15395         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15396         esac
15397         case "$getpwuid_r_proto" in
15398         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15399         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15400         esac
15401         case "$getpwuid_r_proto" in
15402         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15403         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15404         esac
15405         case "$getpwuid_r_proto" in
15406         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15407         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15408         esac
15409         case "$getpwuid_r_proto" in
15410         ''|0)   d_getpwuid_r=undef
15411                 getpwuid_r_proto=0
15412                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15413         * )     case "$getpwuid_r_proto" in
15414                 REENTRANT_PROTO*) ;;
15415                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15416                 esac
15417                 echo "Prototype: $try" ;;
15418         esac
15419         ;;
15420         *)      case "$usethreads" in
15421                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15422                 esac
15423                 d_getpwuid_r=undef
15424                 getpwuid_r_proto=0
15425                 ;;
15426         esac
15427         ;;
15428 *)      getpwuid_r_proto=0
15429         ;;
15430 esac
15431
15432 : Optional checks for getsbyname and getsbyport
15433
15434 : see if getservbyname exists
15435 set getservbyname d_getsbyname
15436 eval $inlibc
15437
15438 : see if getservbyport exists
15439 set getservbyport d_getsbyport
15440 eval $inlibc
15441
15442 : see if getservent exists
15443 set getservent d_getsent
15444 eval $inlibc
15445
15446 : see if getservbyname_r exists
15447 set getservbyname_r d_getservbyname_r
15448 eval $inlibc
15449 case "$d_getservbyname_r" in
15450 "$define")
15451         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15452         case "$d_getservbyname_r_proto:$usethreads" in
15453         ":define")      d_getservbyname_r_proto=define
15454                 set d_getservbyname_r_proto getservbyname_r $hdrs
15455                 eval $hasproto ;;
15456         *)      ;;
15457         esac
15458         case "$d_getservbyname_r_proto" in
15459         define)
15460         case "$getservbyname_r_proto" in
15461         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15462         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15463         esac
15464         case "$getservbyname_r_proto" in
15465         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15466         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15467         esac
15468         case "$getservbyname_r_proto" in
15469         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15470         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15471         esac
15472         case "$getservbyname_r_proto" in
15473         ''|0)   d_getservbyname_r=undef
15474                 getservbyname_r_proto=0
15475                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15476         * )     case "$getservbyname_r_proto" in
15477                 REENTRANT_PROTO*) ;;
15478                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15479                 esac
15480                 echo "Prototype: $try" ;;
15481         esac
15482         ;;
15483         *)      case "$usethreads" in
15484                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15485                 esac
15486                 d_getservbyname_r=undef
15487                 getservbyname_r_proto=0
15488                 ;;
15489         esac
15490         ;;
15491 *)      getservbyname_r_proto=0
15492         ;;
15493 esac
15494
15495 : see if getservbyport_r exists
15496 set getservbyport_r d_getservbyport_r
15497 eval $inlibc
15498 case "$d_getservbyport_r" in
15499 "$define")
15500         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15501         case "$d_getservbyport_r_proto:$usethreads" in
15502         ":define")      d_getservbyport_r_proto=define
15503                 set d_getservbyport_r_proto getservbyport_r $hdrs
15504                 eval $hasproto ;;
15505         *)      ;;
15506         esac
15507         case "$d_getservbyport_r_proto" in
15508         define)
15509         case "$getservbyport_r_proto" in
15510         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15511         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15512         esac
15513         case "$getservbyport_r_proto" in
15514         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15515         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15516         esac
15517         case "$getservbyport_r_proto" in
15518         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15519         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15520         esac
15521         case "$getservbyport_r_proto" in
15522         ''|0)   d_getservbyport_r=undef
15523                 getservbyport_r_proto=0
15524                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15525         * )     case "$getservbyport_r_proto" in
15526                 REENTRANT_PROTO*) ;;
15527                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15528                 esac
15529                 echo "Prototype: $try" ;;
15530         esac
15531         ;;
15532         *)      case "$usethreads" in
15533                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15534                 esac
15535                 d_getservbyport_r=undef
15536                 getservbyport_r_proto=0
15537                 ;;
15538         esac
15539         ;;
15540 *)      getservbyport_r_proto=0
15541         ;;
15542 esac
15543
15544 : see if getservent_r exists
15545 set getservent_r d_getservent_r
15546 eval $inlibc
15547 case "$d_getservent_r" in
15548 "$define")
15549         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15550         case "$d_getservent_r_proto:$usethreads" in
15551         ":define")      d_getservent_r_proto=define
15552                 set d_getservent_r_proto getservent_r $hdrs
15553                 eval $hasproto ;;
15554         *)      ;;
15555         esac
15556         case "$d_getservent_r_proto" in
15557         define)
15558         case "$getservent_r_proto" in
15559         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15560         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15561         esac
15562         case "$getservent_r_proto" in
15563         ''|0) try='int getservent_r(struct servent*, char*, int);'
15564         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15565         esac
15566         case "$getservent_r_proto" in
15567         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15568         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15569         esac
15570         case "$getservent_r_proto" in
15571         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15572         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15573         esac
15574         case "$getservent_r_proto" in
15575         ''|0)   d_getservent_r=undef
15576                 getservent_r_proto=0
15577                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15578         * )     case "$getservent_r_proto" in
15579                 REENTRANT_PROTO*) ;;
15580                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15581                 esac
15582                 echo "Prototype: $try" ;;
15583         esac
15584         ;;
15585         *)      case "$usethreads" in
15586                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15587                 esac
15588                 d_getservent_r=undef
15589                 getservent_r_proto=0
15590                 ;;
15591         esac
15592         ;;
15593 *)      getservent_r_proto=0
15594         ;;
15595 esac
15596
15597 : see if prototypes for various getservxxx netdb.h functions are available
15598 echo " "
15599 set d_getservprotos getservent $i_netdb netdb.h
15600 eval $hasproto
15601
15602 : see if getspnam exists
15603 set getspnam d_getspnam
15604 eval $inlibc
15605
15606 : see if this is a shadow.h system
15607 set shadow.h i_shadow
15608 eval $inhdr
15609
15610 : see if getspnam_r exists
15611 set getspnam_r d_getspnam_r
15612 eval $inlibc
15613 case "$d_getspnam_r" in
15614 "$define")
15615         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15616         case "$d_getspnam_r_proto:$usethreads" in
15617         ":define")      d_getspnam_r_proto=define
15618                 set d_getspnam_r_proto getspnam_r $hdrs
15619                 eval $hasproto ;;
15620         *)      ;;
15621         esac
15622         case "$d_getspnam_r_proto" in
15623         define)
15624         case "$getspnam_r_proto" in
15625         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15626         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15627         esac
15628         case "$getspnam_r_proto" in
15629         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15630         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15631         esac
15632         case "$getspnam_r_proto" in
15633         ''|0)   d_getspnam_r=undef
15634                 getspnam_r_proto=0
15635                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15636         * )     case "$getspnam_r_proto" in
15637                 REENTRANT_PROTO*) ;;
15638                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15639                 esac
15640                 echo "Prototype: $try" ;;
15641         esac
15642         ;;
15643         *)      case "$usethreads" in
15644                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15645                 esac
15646                 d_getspnam_r=undef
15647                 getspnam_r_proto=0
15648                 ;;
15649         esac
15650         ;;
15651 *)      getspnam_r_proto=0
15652         ;;
15653 esac
15654
15655 : see if gettimeofday or ftime exists
15656 set gettimeofday d_gettimeod
15657 eval $inlibc
15658 case "$d_gettimeod" in
15659 "$undef")
15660         set ftime d_ftime 
15661         eval $inlibc
15662         ;;
15663 *)
15664         val="$undef"; set d_ftime; eval $setvar
15665         ;;
15666 esac
15667 case "$d_gettimeod$d_ftime" in
15668 "$undef$undef")
15669         echo " "
15670         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15671         ;;
15672 esac
15673
15674 : see if gmtime_r exists
15675 set gmtime_r d_gmtime_r
15676 eval $inlibc
15677 case "$d_gmtime_r" in
15678 "$define")
15679         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15680         case "$d_gmtime_r_proto:$usethreads" in
15681         ":define")      d_gmtime_r_proto=define
15682                 set d_gmtime_r_proto gmtime_r $hdrs
15683                 eval $hasproto ;;
15684         *)      ;;
15685         esac
15686         case "$d_gmtime_r_proto" in
15687         define)
15688         case "$gmtime_r_proto" in
15689         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15690         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15691         esac
15692         case "$gmtime_r_proto" in
15693         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15694         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15695         esac
15696         case "$gmtime_r_proto" in
15697         ''|0)   d_gmtime_r=undef
15698                 gmtime_r_proto=0
15699                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15700         * )     case "$gmtime_r_proto" in
15701                 REENTRANT_PROTO*) ;;
15702                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15703                 esac
15704                 echo "Prototype: $try" ;;
15705         esac
15706         ;;
15707         *)      case "$usethreads" in
15708                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15709                 esac
15710                 d_gmtime_r=undef
15711                 gmtime_r_proto=0
15712                 ;;
15713         esac
15714         ;;
15715 *)      gmtime_r_proto=0
15716         ;;
15717 esac
15718
15719 : see if hasmntopt exists
15720 set hasmntopt d_hasmntopt
15721 eval $inlibc
15722
15723 : see if this is a netinet/in.h or sys/in.h system
15724 set netinet/in.h i_niin sys/in.h i_sysin
15725 eval $inhdr
15726
15727 : see if arpa/inet.h has to be included
15728 set arpa/inet.h i_arpainet
15729 eval $inhdr
15730
15731 : see if htonl --and friends-- exists
15732 val=''
15733 set htonl val
15734 eval $inlibc
15735
15736 : Maybe they are macros.
15737 case "$val" in
15738 $undef)
15739         $cat >htonl.c <<EOM
15740 #include <stdio.h>
15741 #include <sys/types.h>
15742 #$i_niin I_NETINET_IN
15743 #$i_sysin I_SYS_IN
15744 #$i_arpainet I_ARPA_INET
15745 #ifdef I_NETINET_IN
15746 #include <netinet/in.h>
15747 #endif
15748 #ifdef I_SYS_IN
15749 #include <sys/in.h>
15750 #endif
15751 #ifdef I_ARPA_INET
15752 #include <arpa/inet.h>
15753 #endif
15754 #ifdef htonl
15755 printf("Defined as a macro.");
15756 #endif
15757 EOM
15758         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15759         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15760                 val="$define"
15761                 echo "But it seems to be defined as a macro." >&4
15762         fi
15763         $rm -f htonl.?
15764         ;;
15765 esac
15766 set d_htonl
15767 eval $setvar
15768
15769 : see if hypot exists
15770 set hypot d_hypot
15771 eval $inlibc
15772
15773 : see if ilogb exists
15774 set ilogb d_ilogb
15775 eval $inlibc
15776
15777 : see if ilogbl exists
15778 set ilogbl d_ilogbl
15779 eval $inlibc
15780
15781 : index or strchr
15782 echo " "
15783 if set index val -f; eval $csym; $val; then
15784         if set strchr val -f d_strchr; eval $csym; $val; then
15785                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15786                         val="$define"
15787                         vali="$undef"
15788                         echo "strchr() found." >&4
15789                 else
15790                         val="$undef"
15791                         vali="$define"
15792                         echo "index() found." >&4
15793                 fi
15794         else
15795                 val="$undef"
15796                 vali="$define"
15797                 echo "index() found." >&4
15798         fi
15799 else
15800         if set strchr val -f d_strchr; eval $csym; $val; then
15801                 val="$define"
15802                 vali="$undef"
15803                 echo "strchr() found." >&4
15804         else
15805                 echo "No index() or strchr() found!" >&4
15806                 val="$undef"
15807                 vali="$undef"
15808         fi
15809 fi
15810 set d_strchr; eval $setvar
15811 val="$vali"
15812 set d_index; eval $setvar
15813
15814 : check whether inet_aton exists
15815 set inet_aton d_inetaton
15816 eval $inlibc
15817
15818 : see if inet_ntop exists
15819 set inet_ntop d_inetntop
15820 eval $inlibc
15821
15822 : see if inet_pton exists
15823 set inet_pton d_inetpton
15824 eval $inlibc
15825
15826 : Look for isascii
15827 echo " "
15828 $cat >isascii.c <<EOCP
15829 #include <stdio.h>
15830 #include <ctype.h>
15831 #$i_stdlib I_STDLIB
15832 #ifdef I_STDLIB
15833 #include <stdlib.h>
15834 #endif
15835 int main() {
15836         int c = 'A';
15837         if (isascii(c))
15838                 exit(0);
15839         else
15840                 exit(1);
15841 }
15842 EOCP
15843 set isascii
15844 if eval $compile; then
15845         echo "isascii() found." >&4
15846         val="$define"
15847 else
15848         echo "isascii() NOT found." >&4
15849         val="$undef"
15850 fi
15851 set d_isascii
15852 eval $setvar
15853 $rm -f isascii*
15854
15855 : Look for isblank
15856 echo " "
15857 $cat >isblank.c <<'EOCP'
15858 #include <stdio.h>
15859 #include <ctype.h>
15860 int main() {
15861         int c = ' ';
15862         if (isblank(c))
15863                 return 0 ;
15864         else
15865                 return 1 ;
15866 }
15867 EOCP
15868 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15869         echo "isblank() found." >&4
15870         val="$define"
15871 else
15872         echo "isblank() NOT found." >&4
15873         val="$undef"
15874 fi
15875 set d_isblank
15876 eval $setvar
15877 $rm -f isblank*
15878
15879 : check for isfinite
15880 echo "Checking to see if you have isfinite..." >&4
15881 $cat >try.c <<EOCP
15882 #$i_math I_MATH
15883 #ifdef I_MATH
15884 #include <math.h>
15885 #endif
15886 int main() { return isfinite(0.0); }
15887 EOCP
15888 set try
15889 if eval $compile; then
15890         val="$define"
15891         echo "You have isfinite."
15892 else
15893         val="$undef"
15894         echo "You do not have isfinite."
15895 fi
15896 $rm_try
15897 set d_isfinite
15898 eval $setvar
15899
15900 : see if isfinitel exists
15901 set isfinitel d_isfinitel
15902 eval $inlibc
15903
15904 : check for isinf
15905 echo "Checking to see if you have isinf..." >&4
15906 $cat >try.c <<EOCP
15907 #$i_math I_MATH
15908 #ifdef I_MATH
15909 #include <math.h>
15910 #endif
15911 int main() { return isinf(0.0); }
15912 EOCP
15913 set try
15914 if eval $compile; then
15915         val="$define"
15916         echo "You have isinf."
15917 else
15918         val="$undef"
15919         echo "You do not have isinf."
15920 fi
15921 $rm_try
15922 set d_isinf
15923 eval $setvar
15924
15925 : see if isinfl exists
15926 set isinfl d_isinfl
15927 eval $inlibc
15928
15929 : check for isless
15930 echo "Checking to see if you have isless..." >&4
15931 $cat >try.c <<EOCP
15932 #$i_math I_MATH
15933 #ifdef I_MATH
15934 #include <math.h>
15935 #endif
15936 int main() { return isless(0.0); }
15937 EOCP
15938 set try
15939 if eval $compile; then
15940         val="$define"
15941         echo "You have isless."
15942 else
15943         val="$undef"
15944         echo "You do not have isless."
15945 fi
15946 $rm_try
15947 set d_isless
15948 eval $setvar
15949
15950 : check for isnan
15951 echo "Checking to see if you have isnan..." >&4
15952 $cat >try.c <<EOCP
15953 #$i_math I_MATH
15954 #ifdef I_MATH
15955 #include <math.h>
15956 #endif
15957 int main() { return isnan(0.0); }
15958 EOCP
15959 set try
15960 if eval $compile; then
15961         val="$define"
15962         echo "You have isnan."
15963 else
15964         val="$undef"
15965         echo "You do not have isnan."
15966 fi
15967 $rm_try
15968 set d_isnan
15969 eval $setvar
15970
15971 : see if isnanl exists
15972 set isnanl d_isnanl
15973 eval $inlibc
15974
15975 : check for isnormal
15976 echo "Checking to see if you have isnormal..." >&4
15977 $cat >try.c <<EOCP
15978 #$i_math I_MATH
15979 #ifdef I_MATH
15980 #include <math.h>
15981 #endif
15982 int main() { return isnormal(0.0); }
15983 EOCP
15984 set try
15985 if eval $compile; then
15986         val="$define"
15987         echo "You have isnormal."
15988 else
15989         val="$undef"
15990         echo "You do not have isnormal."
15991 fi
15992 $rm_try
15993 set d_isnormal
15994 eval $setvar
15995
15996 : see if j0 exists
15997 set j0 d_j0
15998 eval $inlibc
15999
16000 : see if j0l exists
16001 set j0l d_j0l
16002 eval $inlibc
16003
16004 : see if killpg exists
16005 set killpg d_killpg
16006 eval $inlibc
16007
16008 : see if localeconv exists
16009 set localeconv d_locconv
16010 eval $inlibc
16011
16012 : see if libc has the POSIX.1-2008 currency locale rules
16013 case "$d_locconv:$d_lc_monetary_2008" in
16014 $define:)
16015         $cat >try.c <<EOCP
16016 #include <locale.h>
16017 int main() {
16018         struct lconv *lc = localeconv();
16019         char int_p_cs_precedes = lc->int_p_cs_precedes;
16020         return 0;
16021 }
16022 EOCP
16023         set try
16024         if eval $compile; then
16025                 d_lc_monetary_2008="$define"
16026         else
16027                 d_lc_monetary_2008="$undef"
16028         fi;
16029         $rm_try
16030         ;;
16031 esac
16032
16033 : see if lchown exists
16034 echo " "
16035 $cat > try.c <<'EOCP'
16036 /* System header to define __stub macros and hopefully few prototypes,
16037     which can conflict with char lchown(); below.  */
16038 #include <assert.h>
16039 /* Override any gcc2 internal prototype to avoid an error.  */
16040 /* We use char because int might match the return type of a gcc2
16041    builtin and then its argument prototype would still apply.  */
16042 char lchown();
16043 int main() {
16044     /*  The GNU C library defines this for functions which it implements
16045         to always fail with ENOSYS.  Some functions are actually named
16046         something starting with __ and the normal name is an alias.  */
16047 #if defined (__stub_lchown) || defined (__stub___lchown)
16048 choke me
16049 #else
16050 lchown();
16051 #endif
16052 ; return 0; }
16053 EOCP
16054 set try
16055 if eval $compile; then
16056     $echo "lchown() found." >&4
16057     val="$define"
16058 else
16059     $echo "lchown() NOT found." >&4
16060     val="$undef"
16061 fi
16062 set d_lchown
16063 eval $setvar
16064
16065 : See if number of significant digits in a double precision number is known
16066 echo " "
16067 $cat >ldbl_dig.c <<EOM
16068 #$i_limits I_LIMITS
16069 #$i_float I_FLOAT
16070 #ifdef I_LIMITS
16071 #include <limits.h>
16072 #endif
16073 #ifdef I_FLOAT
16074 #include <float.h>
16075 #endif
16076 #ifdef LDBL_DIG
16077 printf("Contains LDBL_DIG");
16078 #endif
16079 EOM
16080 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
16081 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
16082         echo "LDBL_DIG found." >&4
16083         val="$define"
16084 else
16085         echo "LDBL_DIG NOT found." >&4
16086         val="$undef"
16087 fi
16088 $rm -f ldbl_dig.?
16089 set d_ldbl_dig
16090 eval $setvar
16091
16092 : see if lgamma exists
16093 set lgamma d_lgamma
16094 eval $inlibc
16095
16096 : see if lgamma_r exists
16097 set lgamma_r d_lgamma_r
16098 eval $inlibc
16099
16100 : check to see if math.h defines _LIB_VERSION
16101 d_libm_lib_version="$undef"
16102 case $i_math in
16103     $define)
16104         echo " "
16105         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
16106         $cat >try.c <<EOCP
16107 #include <unistd.h>
16108 #include <math.h>
16109 int main (int argc, char *argv[])
16110 {
16111     printf ("%d\n", _LIB_VERSION);
16112     return (0);
16113     } /* main */
16114 EOCP
16115         set try
16116         if eval $compile; then
16117             foo=`$run ./try`
16118             echo "Yes, it does ($foo)" >&4
16119             d_libm_lib_version="$define"
16120         else
16121             echo "No, it does not (probably harmless)" >&4
16122             fi
16123         $rm_try
16124         ;;
16125
16126     esac
16127
16128 : see if link exists
16129 set link d_link
16130 eval $inlibc
16131
16132 : see if llrint exists
16133 set llrint d_llrint
16134 eval $inlibc
16135
16136 : see if llrintl exists
16137 set llrintl d_llrintl
16138 eval $inlibc
16139
16140 : see if llround exists
16141 set llround d_llround
16142 eval $inlibc
16143
16144 : see if llroundl exists
16145 set llroundl d_llroundl
16146 eval $inlibc
16147
16148 : see if localeconv_l exists
16149 set localeconv_l d_localeconv_l
16150 eval $inlibc
16151
16152 : see if localtime_r exists
16153 set localtime_r d_localtime_r
16154 eval $inlibc
16155 case "$d_localtime_r" in
16156 "$define")
16157         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16158         case "$d_localtime_r_proto:$usethreads" in
16159         ":define")      d_localtime_r_proto=define
16160                 set d_localtime_r_proto localtime_r $hdrs
16161                 eval $hasproto ;;
16162         *)      ;;
16163         esac
16164         case "$d_localtime_r_proto" in
16165         define)
16166         case "$localtime_r_proto" in
16167         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16168         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16169         esac
16170         case "$localtime_r_proto" in
16171         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16172         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16173         esac
16174         case "$localtime_r_proto" in
16175         ''|0)   d_localtime_r=undef
16176                 localtime_r_proto=0
16177                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16178         * )     case "$localtime_r_proto" in
16179                 REENTRANT_PROTO*) ;;
16180                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16181                 esac
16182                 echo "Prototype: $try" ;;
16183         esac
16184         ;;
16185         *)      case "$usethreads" in
16186                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16187                 esac
16188                 d_localtime_r=undef
16189                 localtime_r_proto=0
16190                 ;;
16191         esac
16192         ;;
16193 *)      localtime_r_proto=0
16194         ;;
16195 esac
16196
16197 : see if localtime_r calls tzset
16198 case "$localtime_r_proto" in
16199 REENTRANT_PROTO*)
16200         $cat >try.c <<EOCP
16201 /*  Does our libc's localtime_r call tzset ?
16202  *  return 0 if so, 1 otherwise.
16203  */
16204 #$i_systypes    I_SYS_TYPES
16205 #$i_unistd      I_UNISTD
16206 #$i_time        I_TIME
16207 #$i_stdlib      I_STDLIB
16208 #$i_string      I_STRING
16209 #$i_malloc      I_MALLOC
16210 #ifdef I_SYS_TYPES
16211 #  include <sys/types.h>
16212 #endif
16213 #ifdef I_UNISTD
16214 #  include <unistd.h>
16215 #endif
16216 #ifdef I_TIME
16217 #  include <time.h>
16218 #endif
16219 #ifdef I_STDLIB
16220 #include <stdlib.h>
16221 #endif
16222 #ifdef I_STRING
16223 #  include <string.h>
16224 #else
16225 #  include <strings.h>
16226 #endif
16227 #ifdef I_MALLOC
16228 #  include <malloc.h>
16229 #endif
16230 int main()
16231 {
16232     time_t t = time(0L);
16233     char w_tz[]="TZ" "=GMT+5",
16234          e_tz[]="TZ" "=GMT-5",
16235         *tz_e = (char*)malloc(16),
16236         *tz_w = (char*)malloc(16);
16237     struct tm tm_e, tm_w;
16238     memset(&tm_e,'\0',sizeof(struct tm));
16239     memset(&tm_w,'\0',sizeof(struct tm));
16240     strcpy(tz_e,e_tz);
16241     strcpy(tz_w,w_tz);
16242
16243     putenv(tz_e);
16244     localtime_r(&t, &tm_e);
16245
16246     putenv(tz_w);
16247     localtime_r(&t, &tm_w);
16248
16249     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16250         return 1;
16251     return 0;
16252 }
16253 EOCP
16254         set try
16255         if eval $compile; then
16256             if $run ./try; then
16257                 d_localtime_r_needs_tzset=undef;
16258             else
16259                 d_localtime_r_needs_tzset=define;
16260             fi;
16261         else
16262             d_localtime_r_needs_tzset=undef;
16263         fi;
16264      ;;
16265   *)
16266      d_localtime_r_needs_tzset=undef;
16267      ;;
16268 esac
16269 $rm_try
16270
16271 : see if lockf exists
16272 set lockf d_lockf
16273 eval $inlibc
16274
16275 : see if log1p exists
16276 set log1p d_log1p
16277 eval $inlibc
16278
16279 : see if log2 exists
16280 set log2 d_log2
16281 eval $inlibc
16282
16283 : see if logb exists
16284 set logb d_logb
16285 eval $inlibc
16286
16287 : see if lrint exists
16288 set lrint d_lrint
16289 eval $inlibc
16290
16291 : see if lrintl exists
16292 set lrintl d_lrintl
16293 eval $inlibc
16294
16295 : see if lround exists
16296 set lround d_lround
16297 eval $inlibc
16298
16299 : see if lroundl exists
16300 set lroundl d_lroundl
16301 eval $inlibc
16302
16303 : see if prototype for lseek is available
16304 echo " "
16305 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16306 eval $hasproto
16307
16308 : see if lstat exists
16309 set lstat d_lstat
16310 eval $inlibc
16311
16312 : see if madvise exists
16313 set madvise d_madvise
16314 eval $inlibc
16315
16316 : see if malloc_size exists
16317 set malloc_size d_malloc_size
16318 eval $inlibc
16319
16320 : see if malloc_size_good exists
16321 set malloc_good_size d_malloc_good_size
16322 eval $inlibc
16323
16324 : see if mblen exists
16325 set mblen d_mblen
16326 eval $inlibc
16327
16328 : see if mbrlen exists
16329 set mbrlen d_mbrlen
16330 eval $inlibc
16331
16332 : see if mbrtowc exists
16333 set mbrtowc d_mbrtowc
16334 eval $inlibc
16335
16336 : see if mbstowcs exists
16337 set mbstowcs d_mbstowcs
16338 eval $inlibc
16339
16340 : see if mbtowc exists
16341 set mbtowc d_mbtowc
16342 eval $inlibc
16343
16344 : see if memmem exists
16345 set memmem d_memmem
16346 eval $inlibc
16347
16348 : see if memrchr exists
16349 set memrchr d_memrchr
16350 eval $inlibc
16351
16352 : see if mkdir exists
16353 set mkdir d_mkdir
16354 eval $inlibc
16355
16356 : see if mkdtemp exists
16357 set mkdtemp d_mkdtemp
16358 eval $inlibc
16359
16360 : see if mkfifo exists
16361 set mkfifo d_mkfifo
16362 eval $inlibc
16363
16364 : see if mkstemp exists
16365 set mkstemp d_mkstemp
16366 eval $inlibc
16367
16368 : see if mkstemps exists
16369 set mkstemps d_mkstemps
16370 eval $inlibc
16371
16372 : see if mktime exists
16373 set mktime d_mktime
16374 eval $inlibc
16375
16376 : see if this is a sys/mman.h system
16377 set sys/mman.h i_sysmman
16378 eval $inhdr
16379
16380 : see if mmap exists
16381 set mmap d_mmap
16382 eval $inlibc
16383 : see what shmat returns
16384 : default to something harmless
16385 mmaptype='void *'
16386 case "$i_sysmman$d_mmap" in
16387 "$define$define")
16388         $cat >mmap.c <<'END'
16389 #include <sys/mman.h>
16390 void *mmap();
16391 END
16392         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16393                 mmaptype='void *'
16394         else
16395                 mmaptype='caddr_t'
16396         fi
16397         echo "and it returns ($mmaptype)." >&4
16398         ;;
16399 esac
16400
16401
16402
16403 : see if sqrtl exists
16404 set sqrtl d_sqrtl
16405 eval $inlibc
16406
16407 : see if scalbnl exists
16408 set scalbnl d_scalbnl
16409 eval $inlibc
16410
16411 : see if truncl exists
16412 set truncl d_truncl
16413 eval $inlibc
16414
16415 : see if modfl exists
16416 set modfl d_modfl
16417 eval $inlibc
16418
16419 : see if prototype for modfl is available
16420 echo " "
16421 set d_modflproto modfl $i_math math.h
16422 eval $hasproto
16423
16424 if $test "$uselongdouble" = "$define"; then
16425     message=""
16426     if $test "$d_sqrtl" != "$define"; then
16427         message="$message sqrtl"
16428     fi
16429     if $test "$d_modfl" != "$define"; then
16430         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16431             echo "You have both truncl and copysignl, so I can emulate modfl."
16432         else
16433             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16434                 echo "You have both aintl and copysignl, so I can emulate modfl."
16435             else
16436                 message="$message modfl"
16437             fi
16438         fi
16439     fi
16440     if $test "$d_frexpl" != "$define"; then
16441         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16442             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16443         else
16444             message="$message frexpl"
16445         fi
16446     fi
16447     if $test "$d_ldexpl" != "$define"; then
16448         message="$message ldexpl"
16449     fi
16450
16451     if $test "$message" != ""; then
16452         $cat <<EOM >&4
16453
16454 *** You requested the use of long doubles but you do not seem to have
16455 *** the following mathematical functions needed for long double support:
16456 ***    $message
16457 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16458 *** Cannot continue, aborting.
16459
16460 EOM
16461
16462         exit 1
16463     fi
16464 fi
16465
16466 : see if mprotect exists
16467 set mprotect d_mprotect
16468 eval $inlibc
16469
16470 : see if msgctl exists
16471 set msgctl d_msgctl
16472 eval $inlibc
16473
16474 : see if msgget exists
16475 set msgget d_msgget
16476 eval $inlibc
16477
16478 : see if msgsnd exists
16479 set msgsnd d_msgsnd
16480 eval $inlibc
16481
16482 : see if msgrcv exists
16483 set msgrcv d_msgrcv
16484 eval $inlibc
16485
16486 : see how much of the 'msg*(2)' library is present.
16487 h_msg=true
16488 echo " "
16489 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16490 *"$undef"*) h_msg=false;;
16491 esac
16492 case "$osname" in
16493 freebsd)
16494     case "`ipcs 2>&1`" in
16495     "SVID messages"*"not configured"*)
16496         echo "Your $osname does not have the msg*(2) configured." >&4
16497         h_msg=false
16498         val="$undef"
16499         set msgctl d_msgctl
16500         eval $setvar
16501         set msgget d_msgget
16502         eval $setvar
16503         set msgsnd d_msgsnd
16504         eval $setvar
16505         set msgrcv d_msgrcv
16506         eval $setvar
16507         ;;
16508     esac
16509     ;;
16510 esac
16511 : we could also check for sys/ipc.h ...
16512 if $h_msg && $test `./findhdr sys/msg.h`; then
16513         echo "You have the full msg*(2) library." >&4
16514         val="$define"
16515 else
16516         echo "You don't have the full msg*(2) library." >&4
16517         val="$undef"
16518 fi
16519 set d_msg
16520 eval $setvar
16521
16522 : Check for msghdr_s
16523 echo " "
16524 echo "Checking to see if your system supports struct msghdr..." >&4
16525 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16526 eval $hasstruct
16527 case "$d_msghdr_s" in
16528 "$define")      echo "Yes, it does."   ;;
16529 *)              echo "No, it doesn't." ;;
16530 esac
16531
16532
16533 : see if msync exists
16534 set msync d_msync
16535 eval $inlibc
16536
16537 : see if munmap exists
16538 set munmap d_munmap
16539 eval $inlibc
16540
16541 : see if nan exists
16542 set nan d_nan
16543 eval $inlibc
16544
16545 : see if nanosleep exists
16546 set nanosleep d_nanosleep
16547 eval $inlibc
16548
16549 : see if nearbyint exists
16550 set nearbyint d_nearbyint
16551 eval $inlibc
16552
16553 : see if nextafter exists
16554 set nextafter d_nextafter
16555 eval $inlibc
16556
16557 : see if nexttoward exists
16558 set nexttoward d_nexttoward
16559 eval $inlibc
16560
16561 : see if nice exists
16562 set nice d_nice
16563 eval $inlibc
16564
16565 : see if this is a langinfo.h system
16566 set langinfo.h i_langinfo
16567 eval $inhdr
16568
16569 : see if nl_langinfo exists
16570 set nl_langinfo d_nl_langinfo
16571 eval $inlibc
16572
16573 : see if this is a quadmath.h system
16574 set quadmath.h i_quadmath
16575 eval $inhdr
16576
16577 : Check basic sizes
16578 echo " "
16579 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16580
16581 case "$use64bitint:$d_quad:$quadtype" in
16582 define:define:?*)
16583         ivtype="$quadtype"
16584         uvtype="$uquadtype"
16585         ivsize=8
16586         uvsize=8
16587         ;;
16588 *)      ivtype="long"
16589         uvtype="unsigned long"
16590         ivsize=$longsize
16591         uvsize=$longsize
16592         ;;
16593 esac
16594
16595 case "$uselongdouble:$d_longdbl" in
16596 define:define)
16597         nvtype="long double"
16598         nvsize=$longdblsize
16599         ;;
16600 *)      nvtype=double
16601         nvsize=$doublesize
16602         ;;
16603 esac
16604
16605 case "$usequadmath:$i_quadmath" in
16606 define:define)
16607   nvtype="__float128"
16608   nvsize=16
16609   case "$libs" in
16610   *quadmath*) ;;
16611   *) $cat <<EOM >&4
16612
16613 *** You requested the use of the quadmath library, but you
16614 *** do not seem to have the quadmath library installed.
16615 *** Cannot continue, aborting.
16616 EOM
16617     exit 1
16618     ;;
16619   esac
16620   ;;
16621 define:*) $cat <<EOM >&4
16622
16623 *** You requested the use of the quadmath library, but you
16624 *** do not seem to have the required header, <quadmath.h>.
16625 EOM
16626   case "$gccversion" in
16627   [23].*|4.[0-5]*)
16628    $cat <<EOM >&4
16629 *** Your gcc looks a bit old:
16630 *** $gccversion
16631 EOM
16632     ;;
16633   '')
16634    $cat <<EOM >&4
16635 *** You are not running a gcc.
16636 EOM
16637     ;;
16638   esac
16639   $cat <<EOM >&4
16640 *** For the quadmath library you need at least gcc 4.6.
16641 *** Cannot continue, aborting.
16642 EOM
16643   exit 1
16644   ;;
16645 esac
16646
16647 $echo "(IV will be "$ivtype", $ivsize bytes)"
16648 $echo "(UV will be "$uvtype", $uvsize bytes)"
16649 $echo "(NV will be "$nvtype", $nvsize bytes)"
16650
16651 $cat >try.c <<EOCP
16652 #$i_inttypes I_INTTYPES
16653 #ifdef I_INTTYPES
16654 #include <inttypes.h>
16655 #endif
16656 #include <stdio.h>
16657 int main() {
16658 #ifdef INT8
16659    int8_t i =  INT8_MAX;
16660   uint8_t u = UINT8_MAX;
16661   printf("int8_t\n");
16662 #endif
16663 #ifdef INT16
16664    int16_t i =  INT16_MAX;
16665   uint16_t u = UINT16_MAX;
16666   printf("int16_t\n");
16667 #endif
16668 #ifdef INT32
16669    int32_t i =  INT32_MAX;
16670   uint32_t u = UINT32_MAX;
16671   printf("int32_t\n");
16672 #endif
16673 }
16674 EOCP
16675
16676 i8type="signed char"
16677 u8type="unsigned char"
16678 i8size=1
16679 u8size=1
16680
16681 case "$i16type" in
16682 '')     case "$shortsize" in
16683         2)      i16type=short
16684                 u16type="unsigned short"
16685                 i16size=$shortsize
16686                 u16size=$shortsize
16687                 ;;
16688         esac
16689         ;;
16690 esac
16691 case "$i16type" in
16692 '')     set try -DINT16
16693         if eval $compile; then
16694                 case "`$run ./try`" in
16695                 int16_t)
16696                         i16type=int16_t
16697                         u16type=uint16_t
16698                         i16size=2
16699                         u16size=2
16700                         ;;
16701                 esac
16702         fi
16703         ;;
16704 esac
16705 case "$i16type" in
16706 '')     if $test $shortsize -ge 2; then
16707                 i16type=short
16708                 u16type="unsigned short"
16709                 i16size=$shortsize
16710                 u16size=$shortsize
16711         fi
16712         ;;
16713 esac
16714
16715 case "$i32type" in
16716 '')     case "$longsize" in
16717         4)      i32type=long
16718                 u32type="unsigned long"
16719                 i32size=$longsize
16720                 u32size=$longsize
16721                 ;;
16722         *)      case "$intsize" in
16723                 4)      i32type=int
16724                         u32type="unsigned int"
16725                         i32size=$intsize
16726                         u32size=$intsize
16727                         ;;
16728                 esac
16729                 ;;
16730         esac
16731         ;;
16732 esac
16733 case "$i32type" in
16734 '')     set try -DINT32
16735         if eval $compile; then
16736                 case "`$run ./try`" in
16737                 int32_t)
16738                         i32type=int32_t
16739                         u32type=uint32_t
16740                         i32size=4
16741                         u32size=4
16742                         ;;
16743                 esac
16744         fi
16745         ;;
16746 esac
16747 case "$i32type" in
16748 '')     if $test $intsize -ge 4; then
16749                 i32type=int
16750                 u32type="unsigned int"
16751                 i32size=$intsize
16752                 u32size=$intsize
16753         fi
16754         ;;
16755 esac
16756
16757 case "$i64type" in
16758 '')     case "$d_quad:$quadtype" in
16759         define:?*)
16760                 i64type="$quadtype"
16761                 u64type="$uquadtype"
16762                 i64size=8
16763                 u64size=8
16764                 ;;
16765         esac
16766         ;;
16767 esac
16768
16769 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16770 $cat <<EOP >try.c
16771 #include <stdio.h>
16772 #$i_stdlib I_STDLIB
16773 #ifdef I_STDLIB
16774 #include <stdlib.h>
16775 #endif
16776 #include <sys/types.h>
16777 #include <signal.h>
16778 #ifdef SIGFPE
16779 /* volatile so that the compiler has to store it out to memory */
16780 volatile int bletched = 0;
16781 $signal_t blech(int s) { bletched = 1; }
16782 #endif
16783 int main() {
16784     $uvtype u = 0;
16785     $nvtype d;
16786     int     n = 8 * $uvsize;
16787     int     i;
16788 #ifdef SIGFPE
16789     signal(SIGFPE, blech);
16790 #endif
16791
16792     for (i = 0; i < n; i++) {
16793       u = u << 1 | ($uvtype)1;
16794       d = ($nvtype)u;
16795       if (($uvtype)d != u)
16796         break;
16797       if (d <= 0)
16798         break;
16799       d = ($nvtype)(u - 1);
16800       if (($uvtype)d != (u - 1))
16801         break;
16802 #ifdef SIGFPE
16803       if (bletched)
16804         break;
16805 #endif
16806     }
16807     printf("%d\n", ((i == n) ? -n : i));
16808     exit(0);
16809 }
16810 EOP
16811 set try
16812
16813 d_nv_preserves_uv="$undef"
16814 if eval $compile; then
16815         nv_preserves_uv_bits="`$run ./try`"
16816 fi
16817 case "$nv_preserves_uv_bits" in
16818 \-[1-9]*)
16819         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16820         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16821         d_nv_preserves_uv="$define"
16822         ;;
16823 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16824         d_nv_preserves_uv="$undef" ;;
16825 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16826         nv_preserves_uv_bits="0" ;;
16827 esac
16828 $rm_try
16829
16830 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16831 $cat <<EOP >try.c
16832 #include <stdio.h>
16833
16834 typedef $nvtype NV;
16835
16836 int
16837 main() {
16838   NV value = 2;
16839   int count = 1;
16840
16841   while(count < 256) {
16842     /* volatile so that the compiler has to store it out to memory */
16843     volatile NV up = value + 1.0;
16844     volatile NV negated = -value;
16845     volatile NV down = negated - 1.0;
16846     volatile NV got_up = up - value;
16847     int up_good = got_up == 1.0;
16848     int got_down = down - negated;
16849     int down_good = got_down == -1.0;
16850
16851     if (down_good != up_good) {
16852       fprintf(stderr,
16853               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16854               up_good, (double) got_up, down_good, (double) got_down,
16855               count, (double) value);
16856       return 1;
16857     }
16858     if (!up_good) {
16859       while (1) {
16860         if (count > 8) {
16861           count -= 8;
16862           fputs("256.0", stdout);
16863         } else {
16864           count--;
16865           fputs("2.0", stdout);
16866         }
16867         if (!count) {
16868           puts("");
16869           return 0;
16870         }
16871         fputs("*", stdout);
16872       }
16873     }
16874     value *= 2;
16875     ++count;
16876   }
16877   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16878           count, (double) value);
16879   return 1;
16880 }
16881 EOP
16882 set try
16883
16884 nv_overflows_integers_at='0'
16885 if eval $compile; then
16886     xxx="`$run ./try`"
16887     case "$?" in
16888         0)
16889             case "$xxx" in
16890                 2*)  cat >&4 <<EOM
16891 The largest integer your NVs can preserve is equal to $xxx
16892 EOM
16893                     nv_overflows_integers_at="$xxx"
16894                     ;;
16895                 *)  cat >&4 <<EOM
16896 Cannot determine the largest integer value your NVs can hold, unexpected output
16897 '$xxx'
16898 EOM
16899                     ;;
16900             esac
16901             ;;
16902         *)  cat >&4 <<EOM
16903 Cannot determine the largest integer value your NVs can hold
16904 EOM
16905             ;;
16906     esac
16907 fi
16908 $rm_try
16909
16910 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16911 $cat <<EOP >try.c
16912 #include <stdio.h>
16913 #$i_stdlib I_STDLIB
16914 #ifdef I_STDLIB
16915 #include <stdlib.h>
16916 #endif
16917 #$i_string I_STRING
16918 #ifdef I_STRING
16919 #  include <string.h>
16920 #else
16921 #  include <strings.h>
16922 #endif
16923 #include <sys/types.h>
16924 #include <signal.h>
16925 #ifdef SIGFPE
16926 /* volatile so that the compiler has to store it out to memory */
16927 volatile int bletched = 0;
16928 $signal_t blech(int s) { bletched = 1; }
16929 #endif
16930
16931 int checkit($nvtype d, const char *where) {
16932     void *v = &d;
16933     unsigned char *p = (unsigned char *)v;
16934     unsigned char *end = p + sizeof(d);
16935     int fail = 0;
16936
16937     while (p < end)
16938         fail += *p++;
16939
16940     if (!fail)
16941         return 0;
16942
16943     p = (unsigned char *)v;
16944     printf("No - %s: 0x", where);
16945     while (p < end)
16946         printf ("%02X", *p++);
16947     printf("\n");
16948     return 1;
16949 }
16950
16951 int main(int argc, char **argv) {
16952     $nvtype d = 0.0;
16953     int fail = 0;
16954     fail += checkit(d, "0.0");
16955
16956     /* The compiler shouldn't be assuming that bletched is 0  */
16957     d = bletched;
16958
16959     fail += checkit(d, "bleched");
16960
16961 #ifdef SIGFPE
16962     signal(SIGFPE, blech);
16963 #endif
16964
16965     /* Paranoia - the compiler should have no way of knowing that ANSI says
16966        that argv[argc] will always be NULL.  Actually, if it did assume this it
16967        would be buggy, as this is C and main() can be called from elsewhere in
16968        the program.  */
16969     d = argv[argc] ? 1 : 0;
16970
16971     if (d) {
16972         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16973     }
16974
16975     fail += checkit(d, "ternary");
16976
16977     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16978
16979     if (d != 0.0) {
16980         printf("No - memset doesn't give 0.0\n");
16981         /* This might just blow up:  */
16982         printf("(gives %g)\n", d);
16983         return 1;
16984     }
16985
16986 #ifdef SIGFPE
16987     if (bletched) {
16988         printf("No - something bleched\n");
16989         return 1;
16990     }
16991 #endif
16992     if (fail) {
16993       printf("No - %d fail(s)\n", fail);
16994       return 1;
16995     }
16996     printf("Yes\n");
16997     return 0;
16998 }
16999 EOP
17000 set try
17001
17002 d_nv_zero_is_allbits_zero="$undef"
17003 if eval $compile; then
17004     xxx="`$run ./try`"
17005     case "$?" in
17006         0)
17007             case "$xxx" in
17008                 Yes)  cat >&4 <<EOM
17009 0.0 is represented as all bits zero in memory
17010 EOM
17011                     d_nv_zero_is_allbits_zero="$define"
17012                     ;;
17013                 *)  cat >&4 <<EOM
17014 0.0 is not represented as all bits zero in memory
17015 EOM
17016                     d_nv_zero_is_allbits_zero="$undef"
17017                     ;;
17018             esac
17019             ;;
17020         *)  cat >&4 <<EOM
17021 0.0 is not represented as all bits zero in memory
17022 EOM
17023             d_nv_zero_is_allbits_zero="$undef"
17024             ;;
17025     esac
17026 fi
17027 $rm_try
17028
17029 : check for off64_t
17030 echo " "
17031 echo "Checking to see if you have off64_t..." >&4
17032 $cat >try.c <<EOCP
17033 #include <sys/types.h>
17034 #include <unistd.h>
17035 int main() { off64_t x = 7; }
17036 EOCP
17037 set try
17038 if eval $compile; then
17039         val="$define"
17040         echo "You have off64_t."
17041 else
17042         val="$undef"
17043         echo "You do not have off64_t."
17044         case "$lseeksize" in
17045         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
17046         esac
17047 fi
17048 $rm_try
17049 set d_off64_t
17050 eval $setvar
17051
17052 : how to create joinable pthreads
17053 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
17054         echo " "
17055         echo "Checking what constant to use for creating joinable pthreads..." >&4
17056         $cat >try.c <<'EOCP'
17057 #include <pthread.h>
17058 int main() {
17059     int detachstate = JOINABLE;
17060 }
17061 EOCP
17062         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
17063         if eval $compile; then
17064                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
17065                 val="$undef" # Yes, undef.
17066                 set d_old_pthread_create_joinable
17067                 eval $setvar
17068                 val=""
17069                 set old_pthread_create_joinable
17070                 eval $setvar
17071         else
17072                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
17073                 if eval $compile; then
17074                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
17075                         val="$define"
17076                         set d_old_pthread_create_joinable
17077                         eval $setvar
17078                         val=PTHREAD_CREATE_UNDETACHED
17079                         set old_pthread_create_joinable
17080                         eval $setvar
17081                 else
17082                         set try -DJOINABLE=__UNDETACHED
17083                         if eval $compile; then
17084                                 echo "You seem to use __UNDETACHED." >&4
17085                                 val="$define"
17086                                 set d_old_pthread_create_joinable
17087                                 eval $setvar
17088                                 val=__UNDETACHED
17089                                 set old_pthread_create_joinable
17090                                 eval $setvar
17091                         else
17092                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
17093                                 val="$define"
17094                                 set d_old_pthread_create_joinable
17095                                 eval $setvar
17096                                 val=0
17097                                 set old_pthread_create_joinable
17098                                 eval $setvar
17099                         fi
17100                 fi
17101         fi
17102         $rm_try
17103 else
17104     d_old_pthread_create_joinable="$undef"
17105     old_pthread_create_joinable=""
17106 fi
17107
17108 : see if pause exists
17109 set pause d_pause
17110 eval $inlibc
17111
17112 : see if poll exists
17113 set poll d_poll
17114 eval $inlibc
17115
17116 : see if prctl exists
17117 set prctl d_prctl
17118 eval $inlibc
17119
17120 : see if prctl supports PR_SET_NAME
17121 d_prctl_set_name=$undef
17122 case $d_prctl in
17123     $define)
17124         $cat >try.c <<EOM
17125 #ifdef __ANDROID__
17126 #include <unistd.h>
17127 #endif
17128 #include <sys/prctl.h>
17129
17130 int main (int argc, char *argv[])
17131 {
17132     return (prctl (PR_SET_NAME, "Test"));
17133     } /* main */
17134 EOM
17135         set try
17136         if eval $compile_ok && $run ./try; then
17137             echo "Your prctl (PR_SET_NAME, ...) works"
17138             d_prctl_set_name=$define
17139             fi
17140         $rm_try
17141         ;;
17142     esac
17143
17144 : see if readlink exists
17145 set readlink d_readlink
17146 eval $inlibc
17147
17148 : Check if there is a /proc symlink to the abs path of
17149 : the executing program.  We will honor hints of d_procselfexe=$undef
17150 : or procselfexe being non-empty, otherwise will try to determine both
17151 : if we have readlink.
17152 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
17153 : referenced, and AmigaOS does not have a proc filesystem anyway.
17154 echo " "
17155 val="$undef"
17156 if $test "X$d_procselfexe" = Xundef; then
17157         procselfexe=''
17158 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
17159         val="$define"
17160 elif $test "X$d_readlink" = Xdefine; then
17161         : NetBSD first as /proc/self is a symlink to /proc/curproc,
17162         : and it feels more tidy to avoid an extra level of symlink
17163         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17164         while test $# -gt 0; do
17165             type=$1; try=$2
17166             shift; shift
17167             if $issymlink $try; then
17168                 $ls -l $try > reflect
17169                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17170                     echo "You have $type-like $try."
17171                     procselfexe='"'$try'"'
17172                     val="$define"
17173                     : This will break out of the loop
17174                     set X; shift
17175                 fi
17176             fi
17177         done
17178 fi
17179 $rm -f reflect
17180 set d_procselfexe
17181 eval $setvar
17182
17183 : backward compatibility for d_hvfork
17184 if test X$d_hvfork != X; then
17185         d_vfork="$d_hvfork"
17186         d_hvfork=''
17187 fi
17188 : see if there is a vfork
17189 val=''
17190 set vfork val
17191 eval $inlibc
17192
17193 d_pseudofork=$undef
17194
17195 : Ok, but do we want to use it. vfork is reportedly unreliable in
17196 : perl on Solaris 2.x, and probably elsewhere.
17197 case "$val" in
17198 $define)
17199         echo " "
17200         case "$usevfork" in
17201         false) dflt='n';;
17202         *) dflt='y';;
17203         esac
17204         cat <<'EOM'
17205
17206 Perl can only use a vfork() that doesn't suffer from strict
17207 restrictions on calling functions or modifying global data in
17208 the child.  For example, glibc-2.1 contains such a vfork()
17209 that is unsuitable.  If your system provides a proper fork()
17210 call, chances are that you do NOT want perl to use vfork().
17211
17212 EOM
17213         rp="Do you still want to use vfork()?"
17214         . ./myread
17215         case "$ans" in
17216         y|Y) ;;
17217         *)
17218                 echo "Ok, we won't use vfork()."
17219                 val="$undef"
17220                 ;;
17221         esac
17222         ;;
17223 esac
17224 set d_vfork
17225 eval $setvar
17226 case "$d_vfork" in
17227 $define) usevfork='true';;
17228 *) usevfork='false';;
17229 esac
17230
17231 : see whether the pthread_atfork exists
17232 $cat >try.c <<EOP
17233 #include <pthread.h>
17234 #include <stdio.h>
17235 int main() {
17236 #ifdef  PTHREAD_ATFORK
17237         pthread_atfork(NULL,NULL,NULL);
17238 #endif
17239 }
17240 EOP
17241
17242 : see if pthread_atfork exists
17243 set try -DPTHREAD_ATFORK
17244 if eval $compile; then
17245     val="$define"
17246 else
17247     val="$undef"
17248 fi
17249 case "$usethreads" in
17250 $define)
17251         case "$val" in
17252         $define) echo 'pthread_atfork found.' >&4        ;;
17253         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17254         esac
17255 esac
17256 set d_pthread_atfork
17257 eval $setvar
17258
17259 : see if pthread_attr_setscope exists
17260 set pthread_attr_setscope d_pthread_attr_setscope
17261 eval $inlibc
17262
17263 : see whether the various POSIXish _yields exist
17264 $cat >try.c <<EOP
17265 #include <pthread.h>
17266 #include <stdio.h>
17267 int main() {
17268 #ifdef SCHED_YIELD
17269         sched_yield();
17270 #else
17271 #ifdef PTHREAD_YIELD
17272         pthread_yield();
17273 #else
17274 #ifdef PTHREAD_YIELD_NULL
17275         pthread_yield(NULL);
17276 #endif
17277 #endif
17278 #endif
17279 }
17280 EOP
17281 : see if sched_yield exists
17282 set try -DSCHED_YIELD
17283 if eval $compile; then
17284     val="$define"
17285     sched_yield='sched_yield()'
17286 else
17287     val="$undef"
17288 fi
17289 case "$usethreads" in
17290 $define)
17291         case "$val" in
17292         $define) echo 'sched_yield() found.' >&4        ;;
17293         *)       echo 'sched_yield() NOT found.' >&4    ;;
17294         esac
17295 esac
17296 set d_sched_yield
17297 eval $setvar
17298
17299 : see if pthread_yield exists
17300 set try -DPTHREAD_YIELD
17301 if eval $compile; then
17302     val="$define"
17303     case "$sched_yield" in
17304     '') sched_yield='pthread_yield()' ;;
17305     esac
17306 else
17307     set try -DPTHREAD_YIELD_NULL
17308     if eval $compile; then
17309         val="$define"
17310         case "$sched_yield" in
17311         '') sched_yield='pthread_yield(NULL)' ;;
17312         esac
17313     else
17314         val="$undef"
17315     fi
17316 fi
17317 case "$usethreads" in
17318 $define)
17319         case "$val" in
17320         $define) echo 'pthread_yield() found.' >&4      ;;
17321         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17322         esac
17323         ;;
17324 esac
17325 set d_pthread_yield
17326 eval $setvar
17327 case "$sched_yield" in
17328 '') sched_yield=undef ;;
17329 esac
17330 $rm_try
17331
17332 : check for ptrdiff_t
17333 echo " "
17334 echo "Checking to see if you have ptrdiff_t..." >&4
17335 $cat >try.c <<EOCP
17336 #include <stddef.h>
17337 int main() { ptrdiff_t x = 7; }
17338 EOCP
17339 set try
17340 if eval $compile; then
17341         val="$define"
17342         echo "You have ptrdiff_t."
17343 else
17344         val="$undef"
17345         echo "You do not have ptrdiff_t."
17346 fi
17347 $rm_try
17348 set d_ptrdiff_t
17349 eval $setvar
17350
17351 : see if random_r exists
17352 set random_r d_random_r
17353 eval $inlibc
17354 case "$d_random_r" in
17355 "$define")
17356         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17357         case "$d_random_r_proto:$usethreads" in
17358         ":define")      d_random_r_proto=define
17359                 set d_random_r_proto random_r $hdrs
17360                 eval $hasproto ;;
17361         *)      ;;
17362         esac
17363         case "$d_random_r_proto" in
17364         define)
17365         case "$random_r_proto" in
17366         ''|0) try='int random_r(int*, struct random_data*);'
17367         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17368         esac
17369         case "$random_r_proto" in
17370         ''|0) try='int random_r(long*, struct random_data*);'
17371         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17372         esac
17373         case "$random_r_proto" in
17374         ''|0) try='int random_r(struct random_data*, int32_t*);'
17375         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17376         esac
17377         case "$random_r_proto" in
17378         ''|0)   d_random_r=undef
17379                 random_r_proto=0
17380                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17381         * )     case "$random_r_proto" in
17382                 REENTRANT_PROTO*) ;;
17383                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17384                 esac
17385                 echo "Prototype: $try" ;;
17386         esac
17387         ;;
17388         *)      case "$usethreads" in
17389                 define) echo "random_r has no prototype, not using it." >&4 ;;
17390                 esac
17391                 d_random_r=undef
17392                 random_r_proto=0
17393                 ;;
17394         esac
17395         ;;
17396 *)      random_r_proto=0
17397         ;;
17398 esac
17399
17400 : see if readdir and friends exist
17401 set readdir d_readdir
17402 eval $inlibc
17403 set seekdir d_seekdir
17404 eval $inlibc
17405 set telldir d_telldir
17406 eval $inlibc
17407 set rewinddir d_rewinddir
17408 eval $inlibc
17409
17410 : see if readdir64_r exists
17411 set readdir64_r d_readdir64_r
17412 eval $inlibc
17413 case "$d_readdir64_r" in
17414 "$define")
17415         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17416         case "$d_readdir64_r_proto:$usethreads" in
17417         ":define")      d_readdir64_r_proto=define
17418                 set d_readdir64_r_proto readdir64_r $hdrs
17419                 eval $hasproto ;;
17420         *)      ;;
17421         esac
17422         case "$d_readdir64_r_proto" in
17423         define)
17424         case "$readdir64_r_proto" in
17425         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17426         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17427         esac
17428         case "$readdir64_r_proto" in
17429         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17430         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17431         esac
17432         case "$readdir64_r_proto" in
17433         ''|0)   d_readdir64_r=undef
17434                 readdir64_r_proto=0
17435                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17436         * )     case "$readdir64_r_proto" in
17437                 REENTRANT_PROTO*) ;;
17438                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17439                 esac
17440                 echo "Prototype: $try" ;;
17441         esac
17442         ;;
17443         *)      case "$usethreads" in
17444                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17445                 esac
17446                 d_readdir64_r=undef
17447                 readdir64_r_proto=0
17448                 ;;
17449         esac
17450         ;;
17451 *)      readdir64_r_proto=0
17452         ;;
17453 esac
17454
17455 : see if readdir_r exists
17456 set readdir_r d_readdir_r
17457 eval $inlibc
17458 case "$d_readdir_r" in
17459 "$define")
17460         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17461         case "$d_readdir_r_proto:$usethreads" in
17462         ":define")      d_readdir_r_proto=define
17463                 set d_readdir_r_proto readdir_r $hdrs
17464                 eval $hasproto ;;
17465         *)      ;;
17466         esac
17467         case "$d_readdir_r_proto" in
17468         define)
17469         case "$readdir_r_proto" in
17470         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17471         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17472         esac
17473         case "$readdir_r_proto" in
17474         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17475         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17476         esac
17477         case "$readdir_r_proto" in
17478         ''|0)   d_readdir_r=undef
17479                 readdir_r_proto=0
17480                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17481         * )     case "$readdir_r_proto" in
17482                 REENTRANT_PROTO*) ;;
17483                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17484                 esac
17485                 echo "Prototype: $try" ;;
17486         esac
17487         ;;
17488         *)      case "$usethreads" in
17489                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17490                 esac
17491                 d_readdir_r=undef
17492                 readdir_r_proto=0
17493                 ;;
17494         esac
17495         ;;
17496 *)      readdir_r_proto=0
17497         ;;
17498 esac
17499
17500 : see if readv exists
17501 set readv d_readv
17502 eval $inlibc
17503
17504 : see if recvmsg exists
17505 set recvmsg d_recvmsg
17506 eval $inlibc
17507
17508 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17509 echo " "
17510 if set regcomp val -f d_regcomp; eval $csym; $val; then
17511         echo 'regcomp() found.' >&4
17512         d_regcomp="$define"
17513         d_regcmp="$undef"
17514         d_re_comp="$undef"
17515 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17516         echo 'regcmp() found.' >&4
17517         d_regcmp="$define"
17518         d_regcomp="$undef"
17519         d_re_comp="$undef"
17520 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17521         echo 're_comp() found, assuming re_exec() also exists.' >&4
17522         d_re_comp="$define"
17523         d_regcomp="$undef"
17524         d_regcmp="$undef"
17525 else
17526         $cat >&4 <<EOM
17527 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17528 EOM
17529         d_regcmp="$undef"
17530         d_re_comp="$undef"
17531         d_regcomp="$undef"
17532 fi
17533
17534 : see if remainder exists
17535 set remainder d_remainder
17536 eval $inlibc
17537
17538 : see if remquo exists
17539 set remquo d_remquo
17540 eval $inlibc
17541
17542 : see if rename exists
17543 set rename d_rename
17544 eval $inlibc
17545
17546 : see if rint exists
17547 set rint d_rint
17548 eval $inlibc
17549
17550 : see if rmdir exists
17551 set rmdir d_rmdir
17552 eval $inlibc
17553
17554 : see if round exists
17555 set round d_round
17556 eval $inlibc
17557
17558 : see if prototype for sbrk is available
17559 echo " "
17560 set d_sbrkproto sbrk $i_unistd unistd.h
17561 eval $hasproto
17562
17563 : see if scalbn exists
17564 set scalbn d_scalbn
17565 eval $inlibc
17566
17567 : see if select exists
17568 set select d_select
17569 eval $inlibc
17570
17571 : see if semctl exists
17572 set semctl d_semctl
17573 eval $inlibc
17574
17575 : see if semget exists
17576 set semget d_semget
17577 eval $inlibc
17578
17579 : see if semop exists
17580 set semop d_semop
17581 eval $inlibc
17582
17583 : see how much of the 'sem*(2)' library is present.
17584 h_sem=true
17585 echo " "
17586 case "$d_semctl$d_semget$d_semop" in
17587 *"$undef"*) h_sem=false;;
17588 esac
17589 case "$osname" in
17590 freebsd)
17591     case "`ipcs 2>&1`" in
17592     "SVID messages"*"not configured"*)
17593         echo "Your $osname does not have the sem*(2) configured." >&4
17594         h_sem=false
17595         val="$undef"
17596         set semctl d_semctl
17597         eval $setvar
17598         set semget d_semget
17599         eval $setvar
17600         set semop d_semop
17601         eval $setvar
17602         ;;
17603     esac
17604     ;;
17605 esac
17606 : we could also check for sys/ipc.h ...
17607 if $h_sem && $test `./findhdr sys/sem.h`; then
17608         echo "You have the full sem*(2) library." >&4
17609         val="$define"
17610 else
17611         echo "You don't have the full sem*(2) library." >&4
17612         val="$undef"
17613 fi
17614 set d_sem
17615 eval $setvar
17616
17617 : see whether sys/sem.h defines union semun
17618 echo " "
17619 $cat > try.c <<'END'
17620 #include <sys/types.h>
17621 #include <sys/ipc.h>
17622 #include <sys/sem.h>
17623 int main () { union semun semun; semun.buf = 0; }
17624 END
17625 set try
17626 if eval $compile; then
17627     echo "You have union semun in <sys/sem.h>." >&4
17628     val="$define"
17629 else
17630     echo "You do not have union semun in <sys/sem.h>." >&4
17631     val="$undef"
17632 fi
17633 $rm_try
17634 set d_union_semun
17635 eval $setvar
17636
17637 : see how to do semctl IPC_STAT
17638 case "$d_sem" in
17639 $define)
17640     echo " "
17641     $cat > tryh.h <<END
17642 #ifndef S_IRUSR
17643 #   ifdef S_IREAD
17644 #       define S_IRUSR S_IREAD
17645 #       define S_IWUSR S_IWRITE
17646 #       define S_IXUSR S_IEXEC
17647 #   else
17648 #       define S_IRUSR 0400
17649 #       define S_IWUSR 0200
17650 #       define S_IXUSR 0100
17651 #   endif
17652 #   define S_IRGRP (S_IRUSR>>3)
17653 #   define S_IWGRP (S_IWUSR>>3)
17654 #   define S_IXGRP (S_IXUSR>>3)
17655 #   define S_IROTH (S_IRUSR>>6)
17656 #   define S_IWOTH (S_IWUSR>>6)
17657 #   define S_IXOTH (S_IXUSR>>6)
17658 #endif
17659 #ifndef S_IRWXU
17660 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17661 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17662 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17663 #endif
17664 END
17665     : see whether semctl IPC_STAT can use union semun
17666     case "$d_semctl_semun" in
17667     '')
17668       val="$undef"
17669       $cat > try.c <<END
17670 #include <sys/types.h>
17671 #include <sys/ipc.h>
17672 #include <sys/sem.h>
17673 #include <sys/stat.h>
17674 #include <stdio.h>
17675 #include <errno.h>
17676 #include "tryh.h"
17677 #ifndef errno
17678 extern int errno;
17679 #endif
17680 #$d_union_semun HAS_UNION_SEMUN
17681 int main() {
17682     union semun
17683 #ifndef HAS_UNION_SEMUN
17684     {
17685         int val;
17686         struct semid_ds *buf;
17687         unsigned short *array;
17688     }
17689 #endif
17690     arg;
17691     int sem, st;
17692
17693 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17694     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17695     if (sem > -1) {
17696         struct semid_ds argbuf;
17697         arg.buf = &argbuf;
17698 #       ifdef IPC_STAT
17699         st = semctl(sem, 0, IPC_STAT, arg);
17700         if (st == 0)
17701             printf("semun\n");
17702         else
17703 #       endif /* IPC_STAT */
17704             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17705 #       ifdef IPC_RMID
17706         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17707 #       endif /* IPC_RMID */
17708             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17709     } else
17710 #endif /* IPC_PRIVATE && ... */
17711         printf("semget failed: errno = %d\n", errno);
17712   return 0;
17713 }
17714 END
17715       set try
17716       if eval $compile; then
17717           xxx=`$run ./try`
17718           case "$xxx" in
17719           semun) val="$define" ;;
17720           esac
17721       fi
17722       $rm_try
17723       set d_semctl_semun
17724       eval $setvar
17725       ;;
17726     esac
17727     case "$d_semctl_semun" in
17728     $define)
17729         echo "You can use union semun for semctl IPC_STAT." >&4
17730         also='also'
17731         ;;
17732     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17733         also=''
17734         ;;
17735     esac
17736
17737     : see whether semctl IPC_STAT can use struct semid_ds pointer
17738     case "$d_semctl_semid_ds" in
17739     '')
17740       val="$undef"
17741       $cat > try.c <<'END'
17742 #include <sys/types.h>
17743 #include <sys/ipc.h>
17744 #include <sys/sem.h>
17745 #include <sys/stat.h>
17746 #include "tryh.h"
17747 #include <stdio.h>
17748 #include <errno.h>
17749 #ifndef errno
17750 extern int errno;
17751 #endif
17752 int main() {
17753     struct semid_ds arg;
17754     int sem, st;
17755
17756 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17757     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17758     if (sem > -1) {
17759 #       ifdef IPC_STAT
17760         st = semctl(sem, 0, IPC_STAT, &arg);
17761         if (st == 0)
17762             printf("semid_ds\n");
17763         else
17764 #       endif /* IPC_STAT */
17765             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17766 #       ifdef IPC_RMID
17767         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
17768 #       endif /* IPC_RMID */
17769             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17770     } else
17771 #endif /* IPC_PRIVATE && ... */
17772         printf("semget failed: errno = %d\n", errno);
17773
17774     return 0;
17775 }
17776 END
17777       set try
17778       if eval $compile; then
17779           xxx=`$run ./try`
17780           case "$xxx" in
17781           semid_ds) val="$define" ;;
17782           esac
17783       fi
17784       $rm_try
17785       set d_semctl_semid_ds
17786       eval $setvar
17787       ;;
17788     esac
17789     case "$d_semctl_semid_ds" in
17790     $define)
17791         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17792         ;;
17793     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17794         ;;
17795     esac
17796     ;;
17797 *)  val="$undef"
17798
17799     # We do not have the full sem*(2) library, so assume we can not
17800     # use either.
17801
17802     set d_semctl_semun
17803     eval $setvar
17804
17805     set d_semctl_semid_ds
17806     eval $setvar
17807     ;;
17808 esac
17809 $rm_try tryh.h
17810
17811 : see if sendmsg exists
17812 set sendmsg d_sendmsg
17813 eval $inlibc
17814
17815 : see if setegid exists
17816 set setegid d_setegid
17817 eval $inlibc
17818
17819 : see if seteuid exists
17820 set seteuid d_seteuid
17821 eval $inlibc
17822
17823 : see if setgrent exists
17824 set setgrent d_setgrent
17825 eval $inlibc
17826
17827 : see if setgrent_r exists
17828 set setgrent_r d_setgrent_r
17829 eval $inlibc
17830 case "$d_setgrent_r" in
17831 "$define")
17832         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17833         case "$d_setgrent_r_proto:$usethreads" in
17834         ":define")      d_setgrent_r_proto=define
17835                 set d_setgrent_r_proto setgrent_r $hdrs
17836                 eval $hasproto ;;
17837         *)      ;;
17838         esac
17839         case "$d_setgrent_r_proto" in
17840         define)
17841         case "$setgrent_r_proto" in
17842         ''|0) try='int setgrent_r(FILE**);'
17843         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17844         esac
17845         case "$setgrent_r_proto" in
17846         ''|0) try='void setgrent_r(FILE**);'
17847         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17848         esac
17849         case "$setgrent_r_proto" in
17850         ''|0)   d_setgrent_r=undef
17851                 setgrent_r_proto=0
17852                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17853         * )     case "$setgrent_r_proto" in
17854                 REENTRANT_PROTO*) ;;
17855                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17856                 esac
17857                 echo "Prototype: $try" ;;
17858         esac
17859         ;;
17860         *)      case "$usethreads" in
17861                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17862                 esac
17863                 d_setgrent_r=undef
17864                 setgrent_r_proto=0
17865                 ;;
17866         esac
17867         ;;
17868 *)      setgrent_r_proto=0
17869         ;;
17870 esac
17871
17872 : see if sethostent exists
17873 set sethostent d_sethent
17874 eval $inlibc
17875
17876 : see if sethostent_r exists
17877 set sethostent_r d_sethostent_r
17878 eval $inlibc
17879 case "$d_sethostent_r" in
17880 "$define")
17881         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17882         case "$d_sethostent_r_proto:$usethreads" in
17883         ":define")      d_sethostent_r_proto=define
17884                 set d_sethostent_r_proto sethostent_r $hdrs
17885                 eval $hasproto ;;
17886         *)      ;;
17887         esac
17888         case "$d_sethostent_r_proto" in
17889         define)
17890         case "$sethostent_r_proto" in
17891         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17892         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17893         esac
17894         case "$sethostent_r_proto" in
17895         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17896         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17897         esac
17898         case "$sethostent_r_proto" in
17899         ''|0)   d_sethostent_r=undef
17900                 sethostent_r_proto=0
17901                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17902         * )     case "$sethostent_r_proto" in
17903                 REENTRANT_PROTO*) ;;
17904                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17905                 esac
17906                 echo "Prototype: $try" ;;
17907         esac
17908         ;;
17909         *)      case "$usethreads" in
17910                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17911                 esac
17912                 d_sethostent_r=undef
17913                 sethostent_r_proto=0
17914                 ;;
17915         esac
17916         ;;
17917 *)      sethostent_r_proto=0
17918         ;;
17919 esac
17920
17921 : see if setitimer exists
17922 set setitimer d_setitimer
17923 eval $inlibc
17924
17925 : see if setlinebuf exists
17926 set setlinebuf d_setlinebuf
17927 eval $inlibc
17928
17929 : see if setlocale exists
17930 set setlocale d_setlocale
17931 eval $inlibc
17932
17933 : see if locale.h is available
17934 set locale.h i_locale
17935 eval $inhdr
17936
17937 : see if setlocale_r exists
17938 set setlocale_r d_setlocale_r
17939 eval $inlibc
17940 case "$d_setlocale_r" in
17941 "$define")
17942         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17943         case "$d_setlocale_r_proto:$usethreads" in
17944         ":define")      d_setlocale_r_proto=define
17945                 set d_setlocale_r_proto setlocale_r $hdrs
17946                 eval $hasproto ;;
17947         *)      ;;
17948         esac
17949         case "$d_setlocale_r_proto" in
17950         define)
17951         case "$setlocale_r_proto" in
17952         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17953         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17954         esac
17955         case "$setlocale_r_proto" in
17956         ''|0)   d_setlocale_r=undef
17957                 setlocale_r_proto=0
17958                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17959         * )     case "$setlocale_r_proto" in
17960                 REENTRANT_PROTO*) ;;
17961                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17962                 esac
17963                 echo "Prototype: $try" ;;
17964         esac
17965         ;;
17966         *)      case "$usethreads" in
17967                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17968                 esac
17969                 d_setlocale_r=undef
17970                 setlocale_r_proto=0
17971                 ;;
17972         esac
17973         ;;
17974 *)      setlocale_r_proto=0
17975         ;;
17976 esac
17977
17978 : see if setnetent exists
17979 set setnetent d_setnent
17980 eval $inlibc
17981
17982 : see if setnetent_r exists
17983 set setnetent_r d_setnetent_r
17984 eval $inlibc
17985 case "$d_setnetent_r" in
17986 "$define")
17987         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17988         case "$d_setnetent_r_proto:$usethreads" in
17989         ":define")      d_setnetent_r_proto=define
17990                 set d_setnetent_r_proto setnetent_r $hdrs
17991                 eval $hasproto ;;
17992         *)      ;;
17993         esac
17994         case "$d_setnetent_r_proto" in
17995         define)
17996         case "$setnetent_r_proto" in
17997         ''|0) try='int setnetent_r(int, struct netent_data*);'
17998         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17999         esac
18000         case "$setnetent_r_proto" in
18001         ''|0) try='void setnetent_r(int, struct netent_data*);'
18002         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18003         esac
18004         case "$setnetent_r_proto" in
18005         ''|0)   d_setnetent_r=undef
18006                 setnetent_r_proto=0
18007                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18008         * )     case "$setnetent_r_proto" in
18009                 REENTRANT_PROTO*) ;;
18010                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18011                 esac
18012                 echo "Prototype: $try" ;;
18013         esac
18014         ;;
18015         *)      case "$usethreads" in
18016                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18017                 esac
18018                 d_setnetent_r=undef
18019                 setnetent_r_proto=0
18020                 ;;
18021         esac
18022         ;;
18023 *)      setnetent_r_proto=0
18024         ;;
18025 esac
18026
18027 : see if setprotoent exists
18028 set setprotoent d_setpent
18029 eval $inlibc
18030
18031 : see if setpgid exists
18032 set setpgid d_setpgid
18033 eval $inlibc
18034
18035 : see if setpgrp2 exists
18036 set setpgrp2 d_setpgrp2
18037 eval $inlibc
18038
18039 : see if setpriority exists
18040 set setpriority d_setprior
18041 eval $inlibc
18042
18043 : see if setproctitle exists
18044 set setproctitle d_setproctitle
18045 eval $inlibc
18046
18047 : see if setprotoent_r exists
18048 set setprotoent_r d_setprotoent_r
18049 eval $inlibc
18050 case "$d_setprotoent_r" in
18051 "$define")
18052         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18053         case "$d_setprotoent_r_proto:$usethreads" in
18054         ":define")      d_setprotoent_r_proto=define
18055                 set d_setprotoent_r_proto setprotoent_r $hdrs
18056                 eval $hasproto ;;
18057         *)      ;;
18058         esac
18059         case "$d_setprotoent_r_proto" in
18060         define)
18061         case "$setprotoent_r_proto" in
18062         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18063         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18064         esac
18065         case "$setprotoent_r_proto" in
18066         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18067         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18068         esac
18069         case "$setprotoent_r_proto" in
18070         ''|0)   d_setprotoent_r=undef
18071                 setprotoent_r_proto=0
18072                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18073         * )     case "$setprotoent_r_proto" in
18074                 REENTRANT_PROTO*) ;;
18075                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18076                 esac
18077                 echo "Prototype: $try" ;;
18078         esac
18079         ;;
18080         *)      case "$usethreads" in
18081                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18082                 esac
18083                 d_setprotoent_r=undef
18084                 setprotoent_r_proto=0
18085                 ;;
18086         esac
18087         ;;
18088 *)      setprotoent_r_proto=0
18089         ;;
18090 esac
18091
18092 : see if setpwent exists
18093 set setpwent d_setpwent
18094 eval $inlibc
18095
18096 : see if setpwent_r exists
18097 set setpwent_r d_setpwent_r
18098 eval $inlibc
18099 case "$d_setpwent_r" in
18100 "$define")
18101         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18102         case "$d_setpwent_r_proto:$usethreads" in
18103         ":define")      d_setpwent_r_proto=define
18104                 set d_setpwent_r_proto setpwent_r $hdrs
18105                 eval $hasproto ;;
18106         *)      ;;
18107         esac
18108         case "$d_setpwent_r_proto" in
18109         define)
18110         case "$setpwent_r_proto" in
18111         ''|0) try='int setpwent_r(FILE**);'
18112         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18113         esac
18114         case "$setpwent_r_proto" in
18115         ''|0) try='void setpwent_r(FILE**);'
18116         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18117         esac
18118         case "$setpwent_r_proto" in
18119         ''|0)   d_setpwent_r=undef
18120                 setpwent_r_proto=0
18121                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18122         * )     case "$setpwent_r_proto" in
18123                 REENTRANT_PROTO*) ;;
18124                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18125                 esac
18126                 echo "Prototype: $try" ;;
18127         esac
18128         ;;
18129         *)      case "$usethreads" in
18130                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18131                 esac
18132                 d_setpwent_r=undef
18133                 setpwent_r_proto=0
18134                 ;;
18135         esac
18136         ;;
18137 *)      setpwent_r_proto=0
18138         ;;
18139 esac
18140
18141 : see if setregid exists
18142 set setregid d_setregid
18143 eval $inlibc
18144 set setresgid d_setresgid
18145 eval $inlibc
18146
18147 : see if setreuid exists
18148 set setreuid d_setreuid
18149 eval $inlibc
18150 set setresuid d_setresuid
18151 eval $inlibc
18152
18153 : see if setrgid exists
18154 set setrgid d_setrgid
18155 eval $inlibc
18156
18157 : see if setruid exists
18158 set setruid d_setruid
18159 eval $inlibc
18160
18161 : see if setservent exists
18162 set setservent d_setsent
18163 eval $inlibc
18164
18165 : see if setservent_r exists
18166 set setservent_r d_setservent_r
18167 eval $inlibc
18168 case "$d_setservent_r" in
18169 "$define")
18170         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18171         case "$d_setservent_r_proto:$usethreads" in
18172         ":define")      d_setservent_r_proto=define
18173                 set d_setservent_r_proto setservent_r $hdrs
18174                 eval $hasproto ;;
18175         *)      ;;
18176         esac
18177         case "$d_setservent_r_proto" in
18178         define)
18179         case "$setservent_r_proto" in
18180         ''|0) try='int setservent_r(int, struct servent_data*);'
18181         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18182         esac
18183         case "$setservent_r_proto" in
18184         ''|0) try='void setservent_r(int, struct servent_data*);'
18185         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18186         esac
18187         case "$setservent_r_proto" in
18188         ''|0)   d_setservent_r=undef
18189                 setservent_r_proto=0
18190                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18191         * )     case "$setservent_r_proto" in
18192                 REENTRANT_PROTO*) ;;
18193                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18194                 esac
18195                 echo "Prototype: $try" ;;
18196         esac
18197         ;;
18198         *)      case "$usethreads" in
18199                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18200                 esac
18201                 d_setservent_r=undef
18202                 setservent_r_proto=0
18203                 ;;
18204         esac
18205         ;;
18206 *)      setservent_r_proto=0
18207         ;;
18208 esac
18209
18210 : see if setsid exists
18211 set setsid d_setsid
18212 eval $inlibc
18213
18214 : see if setvbuf exists
18215 set setvbuf d_setvbuf
18216 eval $inlibc
18217
18218 : see if shmctl exists
18219 set shmctl d_shmctl
18220 eval $inlibc
18221
18222 : see if shmget exists
18223 set shmget d_shmget
18224 eval $inlibc
18225
18226 : see if shmat exists
18227 set shmat d_shmat
18228 eval $inlibc
18229 : see what shmat returns
18230 case "$d_shmat" in
18231 "$define")
18232         $cat >shmat.c <<'END'
18233 #include <sys/shm.h>
18234 void *shmat();
18235 END
18236         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18237                 shmattype='void *'
18238         else
18239                 shmattype='char *'
18240         fi
18241         echo "and it returns ($shmattype)." >&4
18242         : see if a prototype for shmat is available
18243         xxx=`./findhdr sys/shm.h`
18244         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18245         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18246                 val="$define"
18247         else
18248                 val="$undef"
18249         fi
18250         $rm -f shmat.[co]
18251         ;;
18252 *)
18253         val="$undef"
18254         ;;
18255 esac
18256 set d_shmatprototype
18257 eval $setvar
18258
18259 : see if shmdt exists
18260 set shmdt d_shmdt
18261 eval $inlibc
18262
18263 : see how much of the 'shm*(2)' library is present.
18264 h_shm=true
18265 echo " "
18266 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18267 *"$undef"*) h_shm=false;;
18268 esac
18269 case "$osname" in
18270 freebsd)
18271     case "`ipcs 2>&1`" in
18272     "SVID shared memory"*"not configured"*)
18273         echo "Your $osname does not have the shm*(2) configured." >&4
18274         h_shm=false
18275         val="$undef"
18276         set shmctl d_shmctl
18277         eval $setvar
18278         set shmget d_shmget
18279         eval $setvar
18280         set shmat d_shmat
18281         eval $setvar
18282         set shmdt d_shmdt
18283         eval $setvar
18284         ;;
18285     esac
18286     ;;
18287 esac
18288 : we could also check for sys/ipc.h ...
18289 if $h_shm && $test `./findhdr sys/shm.h`; then
18290         echo "You have the full shm*(2) library." >&4
18291         val="$define"
18292 else
18293         echo "You don't have the full shm*(2) library." >&4
18294         val="$undef"
18295 fi
18296 set d_shm
18297 eval $setvar
18298
18299 : see if we have sigaction
18300 echo " "
18301 if set sigaction val -f d_sigaction; eval $csym; $val; then
18302         echo 'sigaction() found.' >&4
18303         $cat > try.c <<EOP
18304 #include <stdio.h>
18305 #include <sys/types.h>
18306 #include <signal.h>
18307 #$i_stdlib I_STDLIB
18308 #ifdef I_STDLIB
18309 #include <stdlib.h>
18310 #endif
18311 int main()
18312 {
18313     struct sigaction act, oact;
18314     act.sa_flags = 0;
18315     oact.sa_handler = 0;
18316     /* so that act and oact are used */
18317     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18318 }
18319 EOP
18320         set try
18321         if eval $compile_ok; then
18322                 val="$define"
18323         else
18324                 echo "But you don't seem to have a usable struct sigaction." >&4
18325                 val="$undef"
18326         fi
18327 else
18328         echo 'sigaction NOT found.' >&4
18329         val="$undef"
18330 fi
18331 set d_sigaction; eval $setvar
18332 $rm_try
18333
18334 : see what type pids are declared as in the kernel
18335 rp="What is the type of process ids on this system?"
18336 set pid_t pidtype int stdio.h sys/types.h
18337 eval $typedef_ask
18338
18339 : see what type uids are declared as in the kernel
18340 echo " "
18341 echo "Looking for the type for user ids returned by getuid()."
18342 set uid_t uidtype xxx stdio.h sys/types.h
18343 eval $typedef
18344 case "$uidtype" in
18345 xxx)
18346         xxx=`./findhdr sys/user.h`
18347         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18348         case $1 in
18349         unsigned) dflt="$1 $2" ;;
18350         *) dflt="$1" ;;
18351         esac
18352         ;;
18353 *) dflt="$uidtype";;
18354 esac
18355 case "$uidtype" in
18356 uid_t)  echo "uid_t found." ;;
18357 *)      rp="What is the type for user ids returned by getuid()?"
18358         . ./myread
18359         uidtype="$ans"
18360         ;;
18361 esac
18362
18363 : Define hasfield_t macro for Configure internal use
18364 hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
18365 while $test $# -ge 2; do
18366     case "$1" in
18367         $define) echo "#include <$2>";;
18368     esac ;
18369     shift 2;
18370 done > try.c;
18371 echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
18372 set try;
18373 if eval $compile; then
18374         val="$define";
18375 else
18376         val="$undef";
18377 fi;
18378 set $varname;
18379 eval $setvar;
18380 $rm_try'
18381
18382 : see what siginfo fields we have
18383 case "$d_sigaction" in
18384 "$define")
18385         echo "Checking if your siginfo_t has si_errno field...">&4
18386         set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
18387         eval $hasfield_t;
18388
18389         echo "Checking if your siginfo_t has si_pid field...">&4
18390         set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
18391         eval $hasfield_t;
18392
18393         echo "Checking if your siginfo_t has si_uid field...">&4
18394         set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
18395         eval $hasfield_t;
18396
18397         echo "Checking if your siginfo_t has si_addr field...">&4
18398         set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
18399         eval $hasfield_t;
18400
18401         echo "Checking if your siginfo_t has si_status field...">&4
18402         set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
18403         eval $hasfield_t;
18404
18405         echo "Checking if your siginfo_t has si_band field...">&4
18406         set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
18407         eval $hasfield_t;
18408
18409         echo "Checking if your siginfo_t has si_value field...">&4
18410         set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
18411         eval $hasfield_t;
18412
18413         echo "Checking if your siginfo_t has si_fd field...">&4
18414         set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
18415         eval $hasfield_t;
18416
18417         ;;
18418 *)
18419         d_siginfo_si_errno="$undef"
18420         d_siginfo_si_pid="$undef"
18421         d_siginfo_si_uid="$undef"
18422         d_siginfo_si_addr="$undef"
18423         d_siginfo_si_status="$undef"
18424         d_siginfo_si_band="$undef"
18425         d_siginfo_si_value="$undef"
18426         d_siginfo_si_fd="$undef"
18427         ;;
18428 esac
18429
18430 : see if this is a sunmath.h system
18431 set sunmath.h i_sunmath
18432 eval $inhdr
18433
18434 : see if signbit exists
18435 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18436 $cat >try.c <<EOCP
18437 #$i_math I_MATH
18438 #$i_sunmath I_SUNMATH
18439 #ifdef I_MATH
18440 #  include <math.h>
18441 #endif
18442 #ifdef I_SUNMATH  /* Solaris special math library */
18443 #  include <sunmath.h>
18444 #endif
18445 #define NV $nvtype
18446 int main(int argc, char **argv)
18447 {
18448     NV x = 0.0;
18449     NV y = -1.0;
18450     if ((signbit(x) == 0) && (signbit(y) != 0))
18451         return 0;
18452     else
18453         return 1;
18454 }
18455 EOCP
18456 val="$undef"
18457 set try
18458 if eval $compile; then
18459     if $run ./try; then
18460         $echo "Yes." >&4
18461         val="$define"
18462     else
18463         $echo "Signbit seems to be available, but doesn't work as I expected."
18464         $echo "I won't use it." >&4
18465         val="$undef"
18466     fi
18467 else
18468     $echo "Nope." >&4
18469     dflt="$undef"
18470 fi
18471 set d_signbit
18472 eval $setvar
18473 $rm_try
18474
18475 : see if sigprocmask exists
18476 set sigprocmask d_sigprocmask
18477 eval $inlibc
18478
18479 : see if sigsetjmp exists
18480 echo " "
18481 case "$d_sigsetjmp" in
18482 '')
18483         $cat >try.c <<EOP
18484 #include <setjmp.h>
18485 #$i_stdlib I_STDLIB
18486 #ifdef I_STDLIB
18487 #include <stdlib.h>
18488 #endif
18489 sigjmp_buf env;
18490 int set = 1;
18491 int main()
18492 {
18493         if (sigsetjmp(env,1))
18494                 exit(set);
18495         set = 0;
18496         siglongjmp(env, 1);
18497         exit(1);
18498 }
18499 EOP
18500         set try
18501         if eval $compile; then
18502                 if $run ./try >/dev/null 2>&1; then
18503                         echo "POSIX sigsetjmp found." >&4
18504                         val="$define"
18505                 else
18506                         $cat >&4 <<EOM
18507 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18508 I'll ignore them.
18509 EOM
18510                         val="$undef"
18511                 fi
18512         else
18513                 echo "sigsetjmp not found." >&4
18514                 val="$undef"
18515         fi
18516         ;;
18517 *) val="$d_sigsetjmp"
18518         case "$d_sigsetjmp" in
18519         $define) echo "POSIX sigsetjmp found." >&4;;
18520         $undef) echo "sigsetjmp not found." >&4;;
18521         esac
18522         ;;
18523 esac
18524 set d_sigsetjmp
18525 eval $setvar
18526 $rm_try
18527
18528 : see if sockatmark exists
18529 set sockatmark d_sockatmark
18530 eval $inlibc
18531
18532 : see if prototype for sockatmark is available
18533 echo " "
18534 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18535 eval $hasproto
18536
18537 : see if socks5_init exists
18538 set socks5_init d_socks5_init
18539 eval $inlibc
18540
18541 : see if sprintf returns the length of the string in the buffer as per ANSI
18542 $echo "Checking whether sprintf returns the length of the string..." >&4
18543 $cat <<EOP >try.c
18544 #include <stdio.h>
18545 #$i_stdlib I_STDLIB
18546 #ifdef I_STDLIB
18547 #include <stdlib.h>
18548 #endif
18549 #$i_string I_STRING
18550 #ifdef I_STRING
18551 #  include <string.h>
18552 #else
18553 #  include <strings.h>
18554 #endif
18555 #$i_math I_MATH
18556 #ifdef I_MATH
18557 #include <math.h>
18558 #endif
18559
18560 char buffer[256];
18561
18562 int check (size_t expect, int test) {
18563   size_t got = strlen(buffer);
18564   if (expect == got)
18565     return 0;
18566
18567   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
18568        test, buffer);
18569   exit (test);
18570 }
18571
18572 int main(int argc, char **argv) {
18573   int test = 0;
18574
18575   check(sprintf(buffer, ""), ++test);
18576   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
18577   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
18578
18579   return 0;
18580 }
18581 EOP
18582 set try
18583
18584 if eval $compile; then
18585     xxx="`$run ./try`"
18586     case "$?" in
18587         0) cat >&4 <<EOM
18588 sprintf returns the length of the string (as ANSI says it should)
18589 EOM
18590         d_sprintf_returns_strlen="$define"
18591         ;;
18592         *) cat >&4 <<EOM
18593 sprintf does not return the length of the string (how old is this system?)
18594 EOM
18595         d_sprintf_returns_strlen="$undef"
18596         ;;
18597     esac
18598 else
18599     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
18600     d_sprintf_returns_strlen="$undef"
18601 fi
18602 $rm_try
18603
18604 : see if srand48_r exists
18605 set srand48_r d_srand48_r
18606 eval $inlibc
18607 case "$d_srand48_r" in
18608 "$define")
18609         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18610         case "$d_srand48_r_proto:$usethreads" in
18611         ":define")      d_srand48_r_proto=define
18612                 set d_srand48_r_proto srand48_r $hdrs
18613                 eval $hasproto ;;
18614         *)      ;;
18615         esac
18616         case "$d_srand48_r_proto" in
18617         define)
18618         case "$srand48_r_proto" in
18619         ''|0) try='int srand48_r(long, struct drand48_data*);'
18620         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18621         esac
18622         case "$srand48_r_proto" in
18623         ''|0)   d_srand48_r=undef
18624                 srand48_r_proto=0
18625                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18626         * )     case "$srand48_r_proto" in
18627                 REENTRANT_PROTO*) ;;
18628                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18629                 esac
18630                 echo "Prototype: $try" ;;
18631         esac
18632         ;;
18633         *)      case "$usethreads" in
18634                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18635                 esac
18636                 d_srand48_r=undef
18637                 srand48_r_proto=0
18638                 ;;
18639         esac
18640         ;;
18641 *)      srand48_r_proto=0
18642         ;;
18643 esac
18644
18645 : see if srandom_r exists
18646 set srandom_r d_srandom_r
18647 eval $inlibc
18648 case "$d_srandom_r" in
18649 "$define")
18650         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18651         case "$d_srandom_r_proto:$usethreads" in
18652         ":define")      d_srandom_r_proto=define
18653                 set d_srandom_r_proto srandom_r $hdrs
18654                 eval $hasproto ;;
18655         *)      ;;
18656         esac
18657         case "$d_srandom_r_proto" in
18658         define)
18659         case "$srandom_r_proto" in
18660         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18661         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18662         esac
18663         case "$srandom_r_proto" in
18664         ''|0)   d_srandom_r=undef
18665                 srandom_r_proto=0
18666                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18667         * )     case "$srandom_r_proto" in
18668                 REENTRANT_PROTO*) ;;
18669                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18670                 esac
18671                 echo "Prototype: $try" ;;
18672         esac
18673         ;;
18674         *)      case "$usethreads" in
18675                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18676                 esac
18677                 d_srandom_r=undef
18678                 srandom_r_proto=0
18679                 ;;
18680         esac
18681         ;;
18682 *)      srandom_r_proto=0
18683         ;;
18684 esac
18685
18686 : see if prototype for setresgid is available
18687 echo " "
18688 set d_sresgproto setresgid $i_unistd unistd.h
18689 eval $hasproto
18690
18691 : see if prototype for setresuid is available
18692 echo " "
18693 set d_sresuproto setresuid $i_unistd unistd.h
18694 eval $hasproto
18695
18696 : see if stat exists
18697 set stat d_stat
18698 eval $inlibc
18699
18700 : see if sys/stat.h is available
18701 set sys/stat.h i_sysstat
18702 eval $inhdr
18703
18704 : see if stat knows about block sizes
18705 echo " "
18706 echo "Checking to see if your struct stat has st_blocks field..." >&4
18707 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18708 eval $hasfield
18709
18710 : see if this is a sys/vfs.h system
18711 set sys/vfs.h i_sysvfs
18712 eval $inhdr
18713
18714 : see if this is a sys/statfs.h system
18715 set sys/statfs.h i_sysstatfs
18716 eval $inhdr
18717
18718 : Check for statfs_s
18719 echo " "
18720 echo "Checking to see if your system supports struct statfs..." >&4
18721 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
18722 eval $hasstruct
18723 case "$d_statfs_s" in
18724 "$define")      echo "Yes, it does."   ;;
18725 *)              echo "No, it doesn't." ;;
18726 esac
18727
18728
18729 : see if struct statfs knows about f_flags
18730 case "$d_statfs_s" in
18731 define)
18732         echo " "
18733         echo "Checking to see if your struct statfs has f_flags field..." >&4
18734         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
18735         eval $hasfield
18736         ;;
18737 *)      val="$undef"
18738         set d_statfs_f_flags
18739         eval $setvar
18740         ;;
18741 esac
18742 case "$d_statfs_f_flags" in
18743 "$define")      echo "Yes, it does."   ;;
18744 *)              echo "No, it doesn't." ;;
18745 esac
18746
18747 : see what flavor, if any, of static inline is supported
18748 echo " "
18749 echo "Checking to see if your system supports static inline..."
18750 $cat > try.c <<'EOCP'
18751 #include <stdlib.h>
18752 extern int f_via_a(int x);
18753 extern int f_via_b(int x);
18754 int main(int argc, char **argv)
18755 {
18756     int y;
18757
18758     y = f_via_a(0);
18759 #ifdef USE_B
18760     y = f_via_b(0);
18761 #endif
18762     if (y == 42) {
18763         return EXIT_SUCCESS;
18764     }
18765     else {
18766         return EXIT_FAILURE;
18767     }
18768 }
18769 EOCP
18770 $cat > a.c <<'EOCP'
18771 static INLINE int f(int x) {
18772     int y;
18773     y = x + 42;
18774     return y;
18775 }
18776
18777 int f_via_a(int x)
18778 {
18779     return f(x);
18780 }
18781 EOCP
18782 $cat > b.c <<'EOCP'
18783 extern int f(int x);
18784
18785 int f_via_b(int x)
18786 {
18787     return f(x);
18788 }
18789 EOCP
18790
18791 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18792 case "$perl_static_inline" in
18793 '')     # Check the various possibilities, and break out on success.
18794         # For gcc, prefer __inline__, which will still permit
18795         # cflags.SH to add in -ansi.
18796         case "$gccversion" in
18797                 '') xxx="inline __inline__ __inline _inline";;
18798                 *)  xxx="__inline__ inline __inline _inline";;
18799         esac
18800         for inline in $xxx; do
18801                 set try -DINLINE=$inline a.c
18802                 if eval $compile && $run ./try; then
18803                         # Now make sure there is no external linkage of static
18804                         # functions
18805                         set try -DINLINE=$inline -DUSE_B a.c b.c
18806                         if eval $compile && $run ./try; then
18807                                 $echo "Your compiler supports static $inline, " >&4
18808                                 $echo "but it also creates an external definition," >&4
18809                                 $echo "so I won't use it." >&4
18810                                 val=$undef
18811                         else
18812                                 $echo "Your compiler supports static $inline." >&4
18813                                 val=$define
18814                                 perl_static_inline="static $inline";
18815                                 break;
18816                         fi
18817                 else
18818                         $echo "Your compiler does NOT support static $inline." >&4
18819                         val="$undef"
18820                 fi
18821         done
18822         ;;
18823 *inline*) # Some variant of inline exists.
18824         echo "Keeping your $hint value of $perl_static_inline."
18825         val=$define
18826         ;;
18827 static)  # No inline capabilities
18828         echo "Keeping your $hint value of $perl_static_inline."
18829         val=$undef
18830         ;;
18831 *)  # Unrecognized previous value -- blindly trust the supplied
18832         # value and hope it makes sense.  Use old value for
18833         # d_static_inline, if there is one.
18834         echo "Keeping your $hint value of $perl_static_inline."
18835         case "$d_static_inline" in
18836                 '') val=$define ;;
18837                 *)  val=$d_static_inline ;;
18838         esac
18839         ;;
18840 esac
18841 # Fallback to plain 'static' if nothing worked.
18842 case "$perl_static_inline" in
18843 '')
18844         perl_static_inline="static"
18845         val=$undef
18846         ;;
18847 esac
18848 set d_static_inline
18849 eval $setvar
18850 $rm -f a.[co] b.[co]
18851 $rm_try
18852
18853 : Check stream access
18854 $cat >&4 <<EOM
18855 Checking how to access stdio streams by file descriptor number...
18856 EOM
18857 case "$stdio_stream_array" in
18858 '')     $cat >try.c <<EOCP
18859 #include <stdio.h>
18860 int main() {
18861   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18862     printf("yes\n");
18863 }
18864 EOCP
18865         for s in _iob __iob __sF
18866         do
18867                 set try -DSTDIO_STREAM_ARRAY=$s
18868                 if eval $compile; then
18869                         case "`$run ./try`" in
18870                         yes)    stdio_stream_array=$s; break ;;
18871                         esac
18872                 fi
18873         done
18874         $rm_try
18875 esac
18876 case "$stdio_stream_array" in
18877 '')     $cat >&4 <<EOM
18878 I can't figure out how to access stdio streams by file descriptor number.
18879 EOM
18880         d_stdio_stream_array="$undef"
18881         ;;
18882 *)      $cat >&4 <<EOM
18883 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18884 EOM
18885         d_stdio_stream_array="$define"
18886         ;;
18887 esac
18888
18889 : see if strcoll exists
18890 set strcoll d_strcoll
18891 eval $inlibc
18892
18893 : see if strerror and/or sys_errlist[] exist
18894 echo " "
18895 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18896     if set strerror val -f d_strerror; eval $csym; $val; then
18897                 echo 'strerror() found.' >&4
18898                 d_strerror="$define"
18899                 d_strerrm='strerror(e)'
18900                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18901                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
18902                         d_syserrlst="$define"
18903                 else
18904                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
18905                         d_syserrlst="$undef"
18906                 fi
18907     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18908                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18909                 echo 'strerror() found in string header.' >&4
18910                 d_strerror="$define"
18911                 d_strerrm='strerror(e)'
18912                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18913                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18914                                 d_syserrlst="$define"
18915                 else
18916                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18917                         d_syserrlst="$undef"
18918                 fi
18919     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18920                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18921                 d_strerror="$undef"
18922                 d_syserrlst="$define"
18923                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18924     else
18925                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18926                 d_strerror="$undef"
18927                 d_syserrlst="$undef"
18928                 d_strerrm='"unknown"'
18929     fi
18930 fi
18931
18932 : see if strerror_l exists
18933 set strerror_l d_strerror_l
18934 eval $inlibc
18935
18936 : see if strerror_r exists
18937 set strerror_r d_strerror_r
18938 eval $inlibc
18939 case "$d_strerror_r" in
18940 "$define")
18941         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18942         case "$d_strerror_r_proto:$usethreads" in
18943         ":define")      d_strerror_r_proto=define
18944                 set d_strerror_r_proto strerror_r $hdrs
18945                 eval $hasproto ;;
18946         *)      ;;
18947         esac
18948         case "$d_strerror_r_proto" in
18949         define)
18950         case "$strerror_r_proto" in
18951         ''|0) try='int strerror_r(int, char*, size_t);'
18952         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18953         esac
18954         case "$strerror_r_proto" in
18955         ''|0) try='int strerror_r(int, char*, int);'
18956         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18957         esac
18958         case "$strerror_r_proto" in
18959         ''|0) try='char* strerror_r(int, char*, size_t);'
18960         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18961         esac
18962         case "$strerror_r_proto" in
18963         ''|0)   d_strerror_r=undef
18964                 strerror_r_proto=0
18965                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18966         * )     case "$strerror_r_proto" in
18967                 REENTRANT_PROTO*) ;;
18968                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18969                 esac
18970                 echo "Prototype: $try" ;;
18971         esac
18972         ;;
18973         *)      case "$usethreads" in
18974                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18975                 esac
18976                 d_strerror_r=undef
18977                 strerror_r_proto=0
18978                 ;;
18979         esac
18980         ;;
18981 *)      strerror_r_proto=0
18982         ;;
18983 esac
18984
18985 : see if strftime exists
18986 set strftime d_strftime
18987 eval $inlibc
18988
18989 : see if strlcat exists
18990 set strlcat d_strlcat
18991 eval $inlibc
18992
18993 : see if strlcpy exists
18994 set strlcpy d_strlcpy
18995 eval $inlibc
18996
18997 : see if strnlen exists
18998 set strnlen d_strnlen
18999 eval $inlibc
19000
19001 : see if strtod exists
19002 set strtod d_strtod
19003 eval $inlibc
19004
19005 : see if strtol exists
19006 set strtol d_strtol
19007 eval $inlibc
19008
19009 : see if strtold exists
19010 set strtold d_strtold
19011 eval $inlibc
19012
19013 : see if strtold_l exists
19014 set strtold_l d_strtold_l
19015 eval $inlibc
19016
19017 : see if strtoll exists
19018 set strtoll d_strtoll
19019 eval $inlibc
19020
19021 case "$d_longlong-$d_strtoll" in
19022 "$define-$define")
19023         $cat <<EOM
19024 Checking whether your strtoll() works okay...
19025 EOM
19026         $cat >try.c <<'EOCP'
19027 #include <errno.h>
19028 #ifdef __hpux
19029 #define strtoll __strtoll
19030 #endif
19031 #ifdef __EMX__
19032 #define strtoll _strtoll
19033 #endif
19034 #include <stdio.h>
19035 extern long long int strtoll(char *s, char **, int);
19036 static int bad = 0;
19037 int check(char *s, long long ell, int een) {
19038         long long gll;
19039         errno = 0;
19040         gll = strtoll(s, 0, 10);
19041         if (!((gll == ell) && (errno == een)))
19042                 bad++;
19043 }
19044 int main() {
19045         check(" 1",                                      1LL, 0);
19046         check(" 0",                                      0LL, 0);
19047         check("-1",                                     -1LL, 0);
19048         check("-9223372036854775808", -9223372036854775808LL, 0);
19049         check("-9223372036854775808", -9223372036854775808LL, 0);
19050         check(" 9223372036854775807",  9223372036854775807LL, 0);
19051         check("-9223372036854775808", -9223372036854775808LL, 0);
19052         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19053         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19054         if (!bad)
19055                 printf("ok\n");
19056 }
19057 EOCP
19058         set try
19059         if eval $compile; then
19060                 yyy=`$run ./try`
19061                 case "$yyy" in
19062                 ok) echo "Your strtoll() seems to be working okay." ;;
19063                 *) cat <<EOM >&4
19064 Your strtoll() doesn't seem to be working okay.
19065 EOM
19066                    d_strtoll="$undef"
19067                    ;;
19068                 esac
19069         else
19070                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19071                 d_strtoll="$undef"
19072         fi
19073         ;;
19074 esac
19075
19076 : see if strtoq exists
19077 set strtoq d_strtoq
19078 eval $inlibc
19079
19080 : see if strtoul exists
19081 set strtoul d_strtoul
19082 eval $inlibc
19083
19084 case "$d_strtoul" in
19085 "$define")
19086         $cat <<EOM
19087 Checking whether your strtoul() works okay...
19088 EOM
19089         $cat >try.c <<'EOCP'
19090 #include <errno.h>
19091 #include <stdio.h>
19092 extern unsigned long int strtoul(char *s, char **, int);
19093 static int bad = 0;
19094 void check(char *s, unsigned long eul, int een) {
19095         unsigned long gul;
19096         errno = 0;
19097         gul = strtoul(s, 0, 10);
19098         if (!((gul == eul) && (errno == een)))
19099                 bad++;
19100 }
19101 int main() {
19102         check(" 1", 1L, 0);
19103         check(" 0", 0L, 0);
19104 EOCP
19105         case "$longsize" in
19106         8)
19107             $cat >>try.c <<'EOCP'
19108         check("18446744073709551615", 18446744073709551615UL, 0);
19109         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19110 #if 0 /* strtoul() for /^-/ strings is undefined. */
19111         check("-1", 18446744073709551615UL, 0);
19112         check("-18446744073709551614", 2, 0);
19113         check("-18446744073709551615", 1, 0);
19114         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19115         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19116 #endif
19117 EOCP
19118                 ;;
19119         4)
19120                     $cat >>try.c <<'EOCP'
19121         check("4294967295", 4294967295UL, 0);
19122         check("4294967296", 4294967295UL, ERANGE);
19123 #if 0 /* strtoul() for /^-/ strings is undefined. */
19124         check("-1", 4294967295UL, 0);
19125         check("-4294967294", 2, 0);
19126         check("-4294967295", 1, 0);
19127         check("-4294967296", 4294967295UL, ERANGE);
19128         check("-4294967297", 4294967295UL, ERANGE);
19129 #endif
19130 EOCP
19131                 ;;
19132         *)
19133 : Should we write these tests to be more portable by sprintf-ing
19134 : ~0 and then manipulating that char string as input for strtol?
19135                 ;;
19136         esac
19137         $cat >>try.c <<'EOCP'
19138         if (!bad)
19139                 printf("ok\n");
19140         return 0;
19141 }
19142 EOCP
19143         set try
19144         if eval $compile; then
19145                 case "`$run ./try`" in
19146                 ok) echo "Your strtoul() seems to be working okay." ;;
19147                 *) cat <<EOM >&4
19148 Your strtoul() doesn't seem to be working okay.
19149 EOM
19150                    d_strtoul="$undef"
19151                    ;;
19152                 esac
19153         else
19154                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19155                 d_strtoul="$undef"
19156         fi
19157         ;;
19158 esac
19159
19160 : see if strtoull exists
19161 set strtoull d_strtoull
19162 eval $inlibc
19163
19164 case "$d_longlong-$d_strtoull" in
19165 "$define-$define")
19166         $cat <<EOM
19167 Checking whether your strtoull() works okay...
19168 EOM
19169         $cat >try.c <<'EOCP'
19170 #include <errno.h>
19171 #ifdef __hpux
19172 #define strtoull __strtoull
19173 #endif
19174 #include <stdio.h>
19175 extern unsigned long long int strtoull(char *s, char **, int);
19176 static int bad = 0;
19177 int check(char *s, long long eull, int een) {
19178         long long gull;
19179         errno = 0;
19180         gull = strtoull(s, 0, 10);
19181         if (!((gull == eull) && (errno == een)))
19182                 bad++;
19183 }
19184 int main() {
19185         check(" 1",                                        1LL, 0);
19186         check(" 0",                                        0LL, 0);
19187         check("18446744073709551615",  18446744073709551615ULL, 0);
19188         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19189 #if 0 /* strtoull() for /^-/ strings is undefined. */
19190         check("-1",                    18446744073709551615ULL, 0);
19191         check("-18446744073709551614",                     2LL, 0);
19192         check("-18446744073709551615",                     1LL, 0);
19193         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19194         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19195 #endif
19196         if (!bad)
19197                 printf("ok\n");
19198 }
19199 EOCP
19200         set try
19201         if eval $compile; then
19202                 case "`$run ./try`" in
19203                 ok) echo "Your strtoull() seems to be working okay." ;;
19204                 *) cat <<EOM >&4
19205 Your strtoull() doesn't seem to be working okay.
19206 EOM
19207                    d_strtoull="$undef"
19208                    ;;
19209                 esac
19210         else
19211                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19212                 d_strtoull="$undef"
19213         fi
19214         ;;
19215 esac
19216
19217 : see if strtouq exists
19218 set strtouq d_strtouq
19219 eval $inlibc
19220
19221 case "$d_strtouq" in
19222 "$define")
19223         $cat <<EOM
19224 Checking whether your strtouq() works okay...
19225 EOM
19226         $cat >try.c <<'EOCP'
19227 #include <errno.h>
19228 #include <stdio.h>
19229 extern unsigned long long int strtouq(char *s, char **, int);
19230 static int bad = 0;
19231 void check(char *s, unsigned long long eull, int een) {
19232         unsigned long long gull;
19233         errno = 0;
19234         gull = strtouq(s, 0, 10);
19235         if (!((gull == eull) && (errno == een)))
19236                 bad++;
19237 }
19238 int main() {
19239         check(" 1",                                        1LL, 0);
19240         check(" 0",                                        0LL, 0);
19241         check("18446744073709551615",  18446744073709551615ULL, 0);
19242         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19243 #if 0 /* strtouq() for /^-/ strings is undefined. */
19244         check("-1",                    18446744073709551615ULL, 0);
19245         check("-18446744073709551614",                     2LL, 0);
19246         check("-18446744073709551615",                     1LL, 0);
19247         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19248         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19249 #endif
19250         if (!bad)
19251                 printf("ok\n");
19252         return 0;
19253 }
19254 EOCP
19255         set try
19256         if eval $compile; then
19257                 case "`$run ./try`" in
19258                 ok) echo "Your strtouq() seems to be working okay." ;;
19259                 *) cat <<EOM >&4
19260 Your strtouq() doesn't seem to be working okay.
19261 EOM
19262                    d_strtouq="$undef"
19263                    ;;
19264                 esac
19265         else
19266                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19267                 d_strtouq="$undef"
19268         fi
19269         ;;
19270 esac
19271
19272 : see if strxfrm exists
19273 set strxfrm d_strxfrm
19274 eval $inlibc
19275
19276 : see if symlink exists
19277 set symlink d_symlink
19278 eval $inlibc
19279
19280 : see if syscall exists
19281 set syscall d_syscall
19282 eval $inlibc
19283
19284 : see if prototype for syscall is available
19285 echo " "
19286 set d_syscallproto syscall $i_unistd unistd.h
19287 eval $hasproto
19288
19289 : see if sysconf exists
19290 set sysconf d_sysconf
19291 eval $inlibc
19292
19293 : see if system exists
19294 set system d_system
19295 eval $inlibc
19296
19297 : see if tcgetpgrp exists
19298 set tcgetpgrp d_tcgetpgrp
19299 eval $inlibc
19300
19301 : see if tcsetpgrp exists
19302 set tcsetpgrp d_tcsetpgrp
19303 eval $inlibc
19304
19305 : see if prototype for telldir is available
19306 echo " "
19307 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19308 eval $hasproto
19309
19310 : see if tgamma exists
19311 set tgamma d_tgamma
19312 eval $inlibc
19313
19314 : check for thread_safe_nl_langinfo_l item
19315 $cat <<EOM
19316
19317 Checking to see if you have nl_langinfo_l() and that it is thread-safe
19318 EOM
19319 $cat >try.c <<EOCP
19320 #$i_stdlib I_STDLIB
19321 #ifdef I_STDLIB
19322 #  include <stdlib.h>
19323 #endif
19324 #$i_string I_STRING
19325 #ifdef I_STRING
19326 #  include <string.h>
19327 #endif
19328 #$i_langinfo I_LANGINFO
19329 #ifdef I_LANGINFO
19330 #  include <langinfo.h>
19331 #endif
19332 #$i_pthread I_PTHREAD
19333 #ifdef I_PTHREAD
19334 #  include <pthread.h>
19335 #endif
19336 #$i_locale I_LOCALE
19337 #ifdef I_LOCALE
19338 #  include <locale.h>
19339 #endif
19340
19341 void *
19342 thread_start(void * arg)
19343 {
19344     nl_langinfo(RADIXCHAR);
19345 }
19346
19347 int main() {
19348         char * main_buffer;
19349         char save_main_buffer[1000];
19350         pthread_t subthread;
19351         pthread_attr_t attr;
19352         
19353         main_buffer = nl_langinfo_l(CODESET, newlocale(LC_ALL_MASK, "C", 0));
19354
19355         /* If too large for our generous allowance, just assume we don't have
19356          * it. */
19357         if (strlen(main_buffer) >= sizeof(save_main_buffer)) {
19358             exit(1);
19359         }
19360
19361         strcpy(save_main_buffer, main_buffer);
19362
19363         if (pthread_attr_init(&attr) != 0) {
19364             exit(1);
19365         }
19366
19367         if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) {
19368             exit(1);
19369         }
19370
19371         if (pthread_join(subthread, NULL) != 0) {
19372             exit(1);
19373         }
19374
19375         exit(! (strcmp(main_buffer, save_main_buffer) == 0));
19376 }
19377 EOCP
19378 case "$usethreads" in
19379     define)
19380         set try
19381         if eval $compile; then
19382                 echo "Your system has nl_langinfo_l()..." >&4
19383                 if $run ./try; then
19384                     echo "and it is thread-safe (just as I'd hoped)." >&4
19385                     d_thread_safe_nl_langinfo_l="$define"
19386                     echo "$d_thread_safe_nl_langinfo_l" >&4
19387                 else
19388                     echo "but it isn't thread-safe, so we won't use it." >&4
19389                 fi
19390         else
19391                 echo "your system does not have nl_langinfo_l()" >&4
19392         fi
19393         ;;
19394     *) echo "Since threads aren't selected, we won't bother looking for nl_langinfo_l()" >&4
19395 esac
19396 if test X"$d_thread_safe_nl_langinfo_l" = X; then
19397         d_thread_safe_nl_langinfo_l="$undef"
19398 fi
19399 $rm_try
19400
19401 : see if time exists
19402 echo " "
19403 if test "X$d_time" = X -o X"$timetype" = X; then
19404     if set time val -f d_time; eval $csym; $val; then
19405                 echo 'time() found.' >&4
19406                 val="$define"
19407                 rp="What is the type returned by time() on this system?"
19408                 set time_t timetype long stdio.h sys/types.h
19409                 eval $typedef_ask
19410     else
19411                 echo 'time() not found, hope that will do.' >&4
19412                 val="$undef"
19413                 timetype='int';
19414     fi
19415     set d_time
19416     eval $setvar
19417 fi
19418
19419 : see if timegm exists
19420 set timegm d_timegm
19421 eval $inlibc
19422
19423 : see if this is a sys/times.h system
19424 set sys/times.h i_systimes
19425 eval $inhdr
19426
19427 : see if times exists
19428 echo " "
19429 if set times val -f d_times; eval $csym; $val; then
19430         echo 'times() found.' >&4
19431         d_times="$define"
19432         inc=''
19433         case "$i_systimes" in
19434         "$define") inc='sys/times.h';;
19435         esac
19436         rp="What is the type returned by times() on this system?"
19437         set clock_t clocktype long stdio.h sys/types.h $inc
19438         eval $typedef_ask
19439 else
19440         echo 'times() NOT found, hope that will do.' >&4
19441         d_times="$undef"
19442         clocktype='int'
19443 fi
19444
19445 : see if tmpnam_r exists
19446 set tmpnam_r d_tmpnam_r
19447 eval $inlibc
19448 case "$d_tmpnam_r" in
19449 "$define")
19450         hdrs="$i_systypes sys/types.h define stdio.h "
19451         case "$d_tmpnam_r_proto:$usethreads" in
19452         ":define")      d_tmpnam_r_proto=define
19453                 set d_tmpnam_r_proto tmpnam_r $hdrs
19454                 eval $hasproto ;;
19455         *)      ;;
19456         esac
19457         case "$d_tmpnam_r_proto" in
19458         define)
19459         case "$tmpnam_r_proto" in
19460         ''|0) try='char* tmpnam_r(char*);'
19461         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19462         esac
19463         case "$tmpnam_r_proto" in
19464         ''|0)   d_tmpnam_r=undef
19465                 tmpnam_r_proto=0
19466                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19467         * )     case "$tmpnam_r_proto" in
19468                 REENTRANT_PROTO*) ;;
19469                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19470                 esac
19471                 echo "Prototype: $try" ;;
19472         esac
19473         ;;
19474         *)      case "$usethreads" in
19475                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19476                 esac
19477                 d_tmpnam_r=undef
19478                 tmpnam_r_proto=0
19479                 ;;
19480         esac
19481         ;;
19482 *)      tmpnam_r_proto=0
19483         ;;
19484 esac
19485
19486 : see if trunc exists
19487 set trunc d_trunc
19488 eval $inlibc
19489
19490 : see if truncate exists
19491 set truncate d_truncate
19492 eval $inlibc
19493
19494 : see if ttyname_r exists
19495 set ttyname_r d_ttyname_r
19496 eval $inlibc
19497 case "$d_ttyname_r" in
19498 "$define")
19499         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19500         case "$d_ttyname_r_proto:$usethreads" in
19501         ":define")      d_ttyname_r_proto=define
19502                 set d_ttyname_r_proto ttyname_r $hdrs
19503                 eval $hasproto ;;
19504         *)      ;;
19505         esac
19506         case "$d_ttyname_r_proto" in
19507         define)
19508         case "$ttyname_r_proto" in
19509         ''|0) try='int ttyname_r(int, char*, size_t);'
19510         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19511         esac
19512         case "$ttyname_r_proto" in
19513         ''|0) try='int ttyname_r(int, char*, int);'
19514         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19515         esac
19516         case "$ttyname_r_proto" in
19517         ''|0) try='char* ttyname_r(int, char*, int);'
19518         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19519         esac
19520         case "$ttyname_r_proto" in
19521         ''|0)   d_ttyname_r=undef
19522                 ttyname_r_proto=0
19523                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19524         * )     case "$ttyname_r_proto" in
19525                 REENTRANT_PROTO*) ;;
19526                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19527                 esac
19528                 echo "Prototype: $try" ;;
19529         esac
19530         ;;
19531         *)      case "$usethreads" in
19532                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19533                 esac
19534                 d_ttyname_r=undef
19535                 ttyname_r_proto=0
19536                 ;;
19537         esac
19538         ;;
19539 *)      ttyname_r_proto=0
19540         ;;
19541 esac
19542
19543 : see if tzname[] exists
19544 echo " "
19545 if set tzname val -a d_tzname; eval $csym; $val; then
19546         val="$define"
19547         echo 'tzname[] found.' >&4
19548 else
19549         val="$undef"
19550         echo 'tzname[] NOT found.' >&4
19551 fi
19552 set d_tzname
19553 eval $setvar
19554
19555 : Check if is a multiplatform env
19556 case "$osname" in
19557 darwin) multiarch="$define" ;;
19558 esac
19559 case "$multiarch" in
19560 ''|[nN]*) multiarch="$undef" ;;
19561 esac
19562
19563 : check for ordering of bytes in a UV
19564 echo " "
19565 case "$multiarch" in
19566 *$define*)
19567         $cat <<EOM
19568 You seem to be doing a multiarchitecture build,
19569 skipping the byteorder check.
19570
19571 EOM
19572         byteorder='ffff'
19573         ;;
19574 *)
19575         case "$byteorder" in
19576         '')
19577                 $cat <<'EOM'
19578 In the following, larger digits indicate more significance.  A big-endian
19579 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19580 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19581 machines may have weird orders like 3412.  A Cray will report 87654321,
19582 an Alpha will report 12345678. If the test program works the default is
19583 probably right.
19584 I'm now running the test program...
19585 EOM
19586                 $cat >try.c <<EOCP
19587 #include <stdio.h>
19588 #$i_stdlib I_STDLIB
19589 #ifdef I_STDLIB
19590 #include <stdlib.h>
19591 #endif
19592 #include <sys/types.h>
19593 typedef $uvtype UV;
19594 int main()
19595 {
19596         int i;
19597         union {
19598                 UV l;
19599                 char c[$uvsize];
19600         } u;
19601
19602         if ($uvsize > 4)
19603                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19604         else
19605                 u.l = (UV)0x04030201;
19606         for (i = 0; i < $uvsize; i++)
19607                 printf("%c", u.c[i]+'0');
19608         printf("\n");
19609         exit(0);
19610 }
19611 EOCP
19612                 xxx_prompt=y
19613                 set try
19614                 if eval $compile && $run ./try > /dev/null; then
19615                         dflt=`$run ./try`
19616                         case "$dflt" in
19617                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19618                                 echo "(The test program ran ok.)"
19619                                 echo "byteorder=$dflt"
19620                                 xxx_prompt=n
19621                         ;;
19622                         ????|????????) echo "(The test program ran ok.)" ;;
19623                         *) echo "(The test program didn't run right for some reason.)" ;;
19624                         esac
19625                 else
19626                         dflt='4321'
19627                         cat <<'EOM'
19628 (I can't seem to compile the test program.  Guessing big-endian...)
19629 EOM
19630                 fi
19631                 case "$xxx_prompt" in
19632                 y)
19633                         rp="What is the order of bytes in $uvtype?"
19634                         . ./myread
19635                         byteorder="$ans"
19636                         ;;
19637                 *)      byteorder=$dflt
19638                         ;;
19639                 esac
19640                 ;;
19641         esac
19642         $rm_try
19643         ;;
19644 esac
19645
19646 : Checking 32bit alignedness
19647 $cat <<EOM
19648
19649 Checking to see whether you can access character data unalignedly...
19650 EOM
19651 case "$d_u32align" in
19652 '')   $cat >try.c <<EOCP
19653 #include <stdio.h>
19654 #$i_stdlib I_STDLIB
19655 #ifdef I_STDLIB
19656 #include <stdlib.h>
19657 #endif
19658 #define U32 $u32type
19659 #define BYTEORDER 0x$byteorder
19660 #define U8 $u8type
19661 #include <signal.h>
19662 #ifdef SIGBUS
19663 $signal_t bletch(int s) { exit(4); }
19664 #endif
19665 int main() {
19666 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19667     volatile U8 buf[8];
19668     volatile U32 *up;
19669     int i;
19670
19671     if (sizeof(U32) != 4) {
19672         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19673         exit(1);
19674     }
19675
19676     fflush(stdout);
19677
19678 #ifdef SIGBUS
19679     signal(SIGBUS, bletch);
19680 #endif
19681
19682     buf[0] = 0;
19683     buf[1] = 0;
19684     buf[2] = 0;
19685     buf[3] = 1;
19686     buf[4] = 0;
19687     buf[5] = 0;
19688     buf[6] = 0;
19689     buf[7] = 1;
19690
19691     for (i = 0; i < 4; i++) {
19692         up = (U32*)(buf + i);
19693         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19694                (*up == 1 << (8*(3-i)))  /* little-endian */
19695               )
19696            )
19697         {
19698             printf("read failed (%x)\n", *up);
19699             exit(2);
19700         }
19701     }
19702
19703     /* write test */
19704     for (i = 0; i < 4; i++) {
19705         up = (U32*)(buf + i);
19706         *up = 0xBeef;
19707         if (*up != 0xBeef) {
19708             printf("write failed (%x)\n", *up);
19709             exit(3);
19710         }
19711     }
19712
19713     exit(0);
19714 #else
19715     printf("1\n");
19716     exit(1);
19717 #endif
19718     return 0;
19719 }
19720 EOCP
19721 set try
19722 if eval $compile_ok; then
19723         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19724         $run ./try 2>&1 >/dev/null
19725         case "$?" in
19726         0)      cat >&4 <<EOM
19727 You can access character data pretty unalignedly.
19728 EOM
19729                 d_u32align="$undef"
19730                 ;;
19731         *)      cat >&4 <<EOM
19732 It seems that you must access character data in an aligned manner.
19733 EOM
19734                 d_u32align="$define"
19735                 ;;
19736         esac
19737 else
19738         rp='Can you access character data at unaligned addresses?'
19739         dflt='n'
19740         . ./myread
19741         case "$ans" in
19742         [yY]*)  d_u32align="$undef"  ;;
19743         *)      d_u32align="$define" ;;
19744         esac
19745 fi
19746 $rm_try
19747 ;;
19748 esac
19749
19750 : see if ualarm exists
19751 set ualarm d_ualarm
19752 eval $inlibc
19753
19754 : see if umask exists
19755 set umask d_umask
19756 eval $inlibc
19757
19758 : see if unordered exists
19759 set unordered d_unordered
19760 eval $inlibc
19761
19762 : see if unsetenv exists
19763 set unsetenv d_unsetenv
19764 eval $inlibc
19765
19766 : see if usleep exists
19767 set usleep d_usleep
19768 eval $inlibc
19769
19770 : see if prototype for usleep is available
19771 echo " "
19772 set d_usleepproto usleep $i_unistd unistd.h
19773 eval $hasproto
19774
19775 : see if ustat exists
19776 set ustat d_ustat
19777 eval $inlibc
19778
19779 : see if closedir exists
19780 set closedir d_closedir
19781 eval $inlibc
19782
19783 case "$d_closedir" in
19784 "$define")
19785         echo " "
19786         echo "Checking whether closedir() returns a status..." >&4
19787         cat > try.c <<EOM
19788 #$i_dirent I_DIRENT             /**/
19789 #$i_sysdir I_SYS_DIR            /**/
19790 #$i_sysndir I_SYS_NDIR          /**/
19791 #$i_systypes I_SYS_TYPES        /**/
19792
19793 #if defined(I_SYS_TYPES)
19794 #include <sys/types.h>
19795 #endif
19796 #if defined(I_DIRENT)
19797 #include <dirent.h>
19798 #else
19799 #ifdef I_SYS_NDIR
19800 #include <sys/ndir.h>
19801 #else
19802 #ifdef I_SYS_DIR
19803 #ifdef hp9000s500
19804 #include <ndir.h>       /* may be wrong in the future */
19805 #else
19806 #include <sys/dir.h>
19807 #endif
19808 #endif
19809 #endif
19810 #endif
19811 int main() { return closedir(opendir(".")); }
19812 EOM
19813         set try
19814         if eval $compile_ok; then
19815                 if $run ./try > /dev/null 2>&1 ; then
19816                         echo "Yes, it does."
19817                         val="$undef"
19818                 else
19819                         echo "No, it doesn't."
19820                         val="$define"
19821                 fi
19822         else
19823                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19824                 val="$define"
19825         fi
19826         ;;
19827 *)
19828         val="$undef";
19829         ;;
19830 esac
19831 set d_void_closedir
19832 eval $setvar
19833 $rm_try
19834
19835 : see if there is a wait4
19836 set wait4 d_wait4
19837 eval $inlibc
19838
19839 : see if waitpid exists
19840 set waitpid d_waitpid
19841 eval $inlibc
19842
19843 : look for wcscmp
19844 echo " "
19845 $cat >try.c <<'EOCP'
19846 #include <stdio.h>
19847 #include <wchar.h>
19848 int main ()
19849 {
19850     wchar_t *s = L" ";
19851     return (wcscmp (s, s) ? 1 : 0);
19852     }
19853 EOCP
19854 set try
19855 val="$undef"
19856 if eval $compile; then
19857     `$run ./try`
19858     case "$?" in
19859         0)  echo "A working wcscmp() found." >&4
19860             val="$define" ;;
19861         *)  echo "wcscmp() found, but it doesn't work" >&4
19862             ;;
19863         esac
19864 else
19865     echo "wcscmp() NOT found." >&4
19866     fi
19867 set d_wcscmp
19868 eval $setvar
19869 $rm_try
19870
19871 : see if wcstombs exists
19872 set wcstombs d_wcstombs
19873 eval $inlibc
19874
19875 : look for wcsxfrm
19876 echo " "
19877 $cat >try.c <<'EOCP'
19878 #include <errno.h>
19879 #include <wchar.h>
19880 int main ()
19881 {
19882     wchar_t dst[4], *src = L" ";
19883     errno = 0;
19884     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
19885     }
19886 EOCP
19887 set try
19888 val="$undef"
19889 if eval $compile; then
19890     `$run ./try`
19891     case "$?" in
19892         0)  echo "A working wcsxfrm() found." >&4
19893             val="$define" ;;
19894         *)  echo "wcsxfrm() found, but it doesn't work" >&4
19895             ;;
19896         esac
19897 else
19898     echo "wcsxfrm() NOT found." >&4
19899     fi
19900 set d_wcsxfrm
19901 eval $setvar
19902 $rm_try
19903
19904 : see if wctomb exists
19905 set wctomb d_wctomb
19906 eval $inlibc
19907
19908 : see if writev exists
19909 set writev d_writev
19910 eval $inlibc
19911
19912 : check for alignment requirements
19913 echo " "
19914 case "$alignbytes" in
19915     '') echo "Checking alignment constraints..." >&4
19916         $cat >try.c <<EOCP
19917 #include <stdio.h>
19918 struct foobar {
19919     char foo;
19920     $nvtype bar;
19921 } try_algn;
19922 int main()
19923 {
19924     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19925     return(0);
19926 }
19927 EOCP
19928         set try
19929         if eval $compile_ok; then
19930             dflt=`$run ./try`
19931         else
19932             dflt='8'
19933             echo "(I can't seem to compile the test program...)"
19934         fi
19935         case "$multiarch" in
19936             *$define*)
19937                 : The usual safe value is 8, but Darwin with -Duselongdouble
19938                 : needs 16.  Hence, we will take 8 as a minimum, but allow
19939                 : Configure to pick a larger value if needed.
19940                 if $test "$dflt" -lt 8; then
19941                     dflt='8'
19942                     echo "Setting alignment to 8 for multiarch support.">&4
19943                 fi
19944                 ;;
19945         esac
19946         ;;
19947     *) dflt="$alignbytes"
19948         ;;
19949 esac
19950 rp="Doubles must be aligned on a how-many-byte boundary?"
19951 . ./myread
19952 alignbytes="$ans"
19953 $rm_try
19954
19955 : set the base revision
19956 baserev=5.0
19957
19958 : length of character in bytes. Is always 1, otherwise it is not C
19959 : This used to be a test using sizeof
19960 charsize=1
19961
19962 : Check for the number of bits in a character
19963 case "$charbits" in
19964 '')     echo "Checking how long a character is (in bits)..." >&4
19965         $cat >try.c <<EOCP
19966 #include <stdio.h>
19967 int main ()
19968 {
19969     int n;
19970     unsigned char c;
19971     for (c = 1, n = 0; c; c <<= 1, n++) ;
19972     printf ("%d\n", n);
19973     return (0);
19974     }
19975 EOCP
19976         set try
19977         if eval $compile_ok; then
19978                 dflt=`$run ./try`
19979         else
19980                 dflt='8'
19981                 echo "(I can't seem to compile the test program.  Guessing...)"
19982         fi
19983         ;;
19984 *)
19985         dflt="$charbits"
19986         ;;
19987 esac
19988 rp="What is the length of a character (in bits)?"
19989 . ./myread
19990 charbits="$ans"
19991 $rm_try
19992 case "$charbits" in
19993 8)      ;;
19994 *)      cat >&4 << EOM
19995 Your system has an unsigned character size of $charbits bits, which
19996 is rather unusual (normally it is 8 bits).  Perl likely will not work
19997 correctly on your system, with subtle bugs in various places.
19998 EOM
19999         rp='Do you really want to continue?'
20000         dflt='n'
20001         . ./myread
20002         case "$ans" in
20003                 [yY])   echo >&4 "Okay, continuing."    ;;
20004                 *)      exit 1                          ;;
20005         esac
20006 esac
20007
20008 : how do we concatenate cpp tokens here?
20009 echo " "
20010 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20011 $cat >cpp_stuff.c <<'EOCP'
20012 #define RCAT(a,b)a/**/b
20013 #define ACAT(a,b)a ## b
20014 RCAT(Rei,ser)
20015 ACAT(Cir,cus)
20016 EOCP
20017 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20018 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20019         echo "Oh!  Smells like ANSI's been here." >&4
20020         echo "We can catify or stringify, separately or together!"
20021         cpp_stuff=42
20022 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20023         echo "Ah, yes!  The good old days!" >&4
20024         echo "However, in the good old days we don't know how to stringify and"
20025         echo "catify at the same time."
20026         cpp_stuff=1
20027 else
20028         $cat >&4 <<EOM
20029 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20030 You're going to have to edit the values of CAT[2-5] in config.h...
20031 EOM
20032         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20033 fi
20034 $rm -f cpp_stuff.*
20035
20036 : see if this is a db.h system
20037 set db.h i_db
20038 eval $inhdr
20039
20040 case "$i_db" in
20041 $define)
20042         : Check db version.
20043         echo " "
20044         echo "Checking Berkeley DB version ..." >&4
20045         $cat >try.c <<EOCP
20046 #$d_const HASCONST
20047 #ifndef HASCONST
20048 #define const
20049 #endif
20050 #include <sys/types.h>
20051 #include <stdio.h>
20052 #$i_stdlib I_STDLIB
20053 #ifdef I_STDLIB
20054 #include <stdlib.h>
20055 #endif
20056 #include <db.h>
20057 int main(int argc, char *argv[])
20058 {
20059 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20060     int Major, Minor, Patch ;
20061     unsigned long Version ;
20062     (void)db_version(&Major, &Minor, &Patch) ;
20063     if (argc == 2) {
20064         printf("%d %d %d %d %d %d\n",
20065                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20066                Major, Minor, Patch);
20067         exit(0);
20068     }
20069     printf("You have Berkeley DB Version 2 or greater.\n");
20070
20071     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20072                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20073     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20074                 Major, Minor, Patch) ;
20075
20076     /* check that db.h & libdb are compatible */
20077     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20078         printf("db.h and libdb are incompatible.\n") ;
20079         exit(3);
20080     }
20081
20082     printf("db.h and libdb are compatible.\n") ;
20083
20084     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20085                 + DB_VERSION_PATCH ;
20086
20087     /* needs to be >= 2.3.4 */
20088     if (Version < 2003004) {
20089     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20090         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20091         exit(2);
20092     }
20093
20094     exit(0);
20095 #else
20096 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20097     if (argc == 2) {
20098         printf("1 0 0\n");
20099         exit(0);
20100     }
20101     printf("You have Berkeley DB Version 1.\n");
20102     exit(0);    /* DB version < 2: the coast is clear. */
20103 #else
20104     exit(1);    /* <db.h> not Berkeley DB? */
20105 #endif
20106 #endif
20107 }
20108 EOCP
20109         set try
20110         if eval $compile_ok && $run ./try; then
20111                 echo 'Looks OK.' >&4
20112                 set `$run ./try 1`
20113                 db_version_major=$1
20114                 db_version_minor=$2
20115                 db_version_patch=$3
20116         else
20117                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20118                 i_db=$undef
20119                 case " $libs " in
20120                 *"-ldb "*)
20121                         : Remove db from list of libraries to use
20122                         echo "Removing unusable -ldb from library list" >&4
20123                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20124                         shift
20125                         libs="$*"
20126                         echo "libs = $libs" >&4
20127                         ;;
20128                 esac
20129         fi
20130         $rm_try
20131         ;;
20132 esac
20133
20134 case "$i_db" in
20135 define)
20136         : Check the return type needed for hash
20137         echo " "
20138         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20139         $cat >try.c <<EOCP
20140 #$d_const HASCONST
20141 #ifndef HASCONST
20142 #define const
20143 #endif
20144 #include <sys/types.h>
20145 #include <db.h>
20146
20147 #ifndef DB_VERSION_MAJOR
20148 u_int32_t hash_cb (const void* ptr, size_t size)
20149 {
20150 }
20151 HASHINFO info;
20152 int main()
20153 {
20154         info.hash = hash_cb;
20155 }
20156 #endif
20157 EOCP
20158         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20159                 if $contains warning try.out >>/dev/null 2>&1 ; then
20160                         db_hashtype='int'
20161                 else
20162                         db_hashtype='u_int32_t'
20163                 fi
20164         else
20165                 : XXX Maybe we should just give up here.
20166                 db_hashtype=u_int32_t
20167                 $cat try.out >&4
20168                 echo "Help:  I can't seem to compile the db test program." >&4
20169                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20170         fi
20171         $rm_try
20172         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20173         ;;
20174 *)      db_hashtype=u_int32_t
20175         ;;
20176 esac
20177 case "$i_db" in
20178 define)
20179         : Check the return type needed for prefix
20180         echo " "
20181         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20182         cat >try.c <<EOCP
20183 #$d_const HASCONST
20184 #ifndef HASCONST
20185 #define const
20186 #endif
20187 #include <sys/types.h>
20188 #include <db.h>
20189
20190 #ifndef DB_VERSION_MAJOR
20191 size_t prefix_cb (const DBT *key1, const DBT *key2)
20192 {
20193 }
20194 BTREEINFO info;
20195 int main()
20196 {
20197         info.prefix = prefix_cb;
20198 }
20199 #endif
20200 EOCP
20201         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20202                 if $contains warning try.out >>/dev/null 2>&1 ; then
20203                         db_prefixtype='int'
20204                 else
20205                         db_prefixtype='size_t'
20206                 fi
20207         else
20208                 db_prefixtype='size_t'
20209                 : XXX Maybe we should just give up here.
20210                 $cat try.out >&4
20211                 echo "Help:  I can't seem to compile the db test program." >&4
20212                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20213         fi
20214         $rm_try
20215         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20216         ;;
20217 *)      db_prefixtype='size_t'
20218         ;;
20219 esac
20220
20221 : Include . in @INC
20222 $cat <<EOM
20223
20224 Historically Perl has provided a final fallback of the current working
20225 directory '.' when searching for a library. This, however, can lead to
20226 problems when a Perl program which loads optional modules is called from
20227 a shared directory. This can lead to executing unexpected code.
20228
20229 EOM
20230
20231 # When changing to exclude by default:
20232 case "$default_inc_excludes_dot" in
20233     $undef|false|[nN]*) dflt="n" ;;
20234     *)                  dflt="y" ;;
20235 esac
20236 # To turn exclude off by default:
20237 #case "$default_inc_excludes_dot" in
20238 #    $define|true|[yY]*) dflt="y" ;;
20239 #    *)                  dflt="n" ;;
20240 #esac
20241
20242 rp='Exclude '.' from @INC by default? '
20243 . ./myread
20244 case "$ans" in
20245     [nN]|undef) default_inc_excludes_dot="$undef"  ;;
20246     *)          default_inc_excludes_dot="$define" ;;
20247 esac
20248
20249 : Check what kind of inf/nan your system has
20250 $echo "Checking the kind of infinities and nans you have..." >&4
20251 $echo "(The following tests may crash.  That's okay.)" >&4
20252 $cat >try.c <<EOP
20253 #define DOUBLESIZE $doublesize
20254 #$d_longdbl HAS_LONG_DOUBLE
20255 #ifdef HAS_LONG_DOUBLE
20256 #define LONG_DOUBLESIZE $longdblsize
20257 #define LONG_DOUBLEKIND $longdblkind
20258 #endif
20259 #$i_math I_MATH
20260 #$i_string I_STRING
20261 #ifdef I_MATH
20262 #include <math.h>
20263 #endif
20264 #ifdef I_STRING
20265 #  include <string.h>
20266 #endif
20267 #include <stdio.h>
20268 /* Note that whether the sign bit is on or off
20269  * for NaN depends on the CPU/FPU, and possibly
20270  * can be affected by the build toolchain.
20271  *
20272  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20273  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20274  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20275  * (respectively) as opposed to the more usual
20276  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20277  *
20278  * Pre-IEEE-754 floating point format do not even have inf/nan support
20279  * at all.  They might have a "max" value (DBL_MAX), which may be deadly
20280  * to even mention, causing immediate SIGFPE or equivalent: this is
20281  * the case with VAX floating point, for example.
20282  */
20283 static void bytes(void *v, unsigned int n) {
20284   unsigned char *p = (unsigned char *)v;
20285   int i;
20286   for (i = 0; i < n; i++) {
20287     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20288   }
20289 }
20290 int main(int argc, char *argv[]) {
20291    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20292     * because some compilers are 'smart' and not only warn but refuse to
20293     * compile such 'illegal' values. */
20294    double dinf = exp(1e9);
20295    double dnan = sqrt(-1.0);
20296 #ifdef HAS_LONG_DOUBLE
20297    long double ldinf = (long double)exp(1e9);
20298    long double ldnan = (long double)sqrt(-1.0);
20299 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20300 /* the 80-bit long doubles might have garbage in their excess bytes */
20301     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20302     memset((char *)&ldnan + 10, '\0', LONG_DOUBLESIZE - 10);
20303 # endif
20304   if (argc == 2) {
20305     switch (argv[1][0]) {
20306     case '1': bytes(&dinf, sizeof(dinf)); break;
20307     case '2': bytes(&dnan, sizeof(dnan)); break;
20308     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20309     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20310 #endif
20311     }
20312   }
20313   return 0;
20314 }
20315 EOP
20316 set try
20317 if eval $compile; then
20318     doubleinfbytes=`$run ./try 1`
20319     doublenanbytes=`$run ./try 2`
20320     case "$d_longdbl" in
20321     $define)
20322       longdblinfbytes=`$run ./try 3`
20323       longdblnanbytes=`$run ./try 4`
20324       ;;
20325     esac
20326 else
20327     # Defaults in case the above test program failed.
20328     case "$doublekind" in
20329     1) # IEEE 754 32-bit LE
20330        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20331        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20332        ;;
20333     2) # IEEE 754 32-bit BE
20334        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20335        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20336        ;;
20337     3) # IEEE 754 64-bit LE
20338        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20339        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20340        ;;
20341     4) # IEEE 754 64-bit BE
20342        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20343        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20344        ;;
20345     5) # IEEE 754 128-bit LE
20346        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20347        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20348        ;;
20349     6) # IEEE 754 128-bit BE
20350        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20351        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20352        ;;
20353     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20354        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20355        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20356        ;;
20357     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20358        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20359        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20360        ;;
20361     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20362        doubleinfbytes=$undef
20363        doublenanbytes=$undef
20364        ;;
20365     *) # No idea.
20366        doubleinfbytes=$undef
20367        doublenanbytes=$undef
20368        ;;
20369     esac
20370     case "$longdblkind" in
20371     1) # IEEE 754 128-bit LE
20372        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20373        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20374        ;;
20375     2) # IEEE 754 128-bit BE
20376        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20377        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20378        ;;
20379     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20380        case "$longdblsize" in
20381        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20382            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20383            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20384            ;;
20385        16) # x86_64
20386            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20387            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20388            ;;
20389        *)  # No idea.
20390            longdblinfbytes=$undef
20391            longdblnanbytes=$undef
20392        ;;
20393        esac
20394        ;;
20395     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20396        case "$longdblsize" in
20397        12) # 32-bit system
20398            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20399            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20400            ;;
20401        16) # 64-bit system
20402            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20403            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20404            ;;
20405        *)  # No idea.
20406            longdblinfbytes=$undef
20407            longdblnanbytes=$undef
20408        ;;
20409        esac
20410        ;;
20411     5) # 128-bit LE-LE "double double"
20412        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20413        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20414        ;;
20415     6) # 128-bit BE-BE "double double"
20416        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20417        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20418        ;;
20419     7) # 128-bit LE-BE "double double"
20420        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20421        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20422        ;;
20423     8) # 128-bit BE-LE "double double"
20424        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20425        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20426        ;;
20427     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20428        longdblinfbytes=$undef
20429        longdblnanbytes=$undef
20430        ;;
20431     *) # No idea.
20432        longdblinfbytes=$undef
20433        longdblnanbytes=$undef
20434        ;;
20435     esac
20436 fi
20437 # In case the program crashed the values are empty, turn them undef.
20438 case "$doubleinfbytes" in
20439 '') doubleinfbytes=$undef ;;
20440 esac
20441 case "$doublenanbytes" in
20442 '') doublenanbytes=$undef ;;
20443 esac
20444 case "$longdblinfbytes" in
20445 '') longdblinfbytes=$undef ;;
20446 esac
20447 case "$longdblnanbytes" in
20448 '') longdblnanbytes=$undef ;;
20449 esac
20450 $rm_try
20451
20452 : Check the length of the double mantissa
20453 $echo "Checking how many mantissa bits your doubles have..." >&4
20454 $cat >try.c <<EOP
20455 #$i_float I_FLOAT
20456 #$i_sunmath I_SUNMATH
20457 #ifdef I_FLOAT
20458 # include <float.h>
20459 #endif
20460 #ifdef I_SUNMATH
20461 # include <sunmath.h>
20462 #endif
20463 #ifdef DBL_MANT_DIG
20464 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20465 #endif
20466 #include <stdio.h>
20467 int main(int argc, char *argv[]) {
20468 #ifdef BITS
20469   printf("%d\n", BITS);
20470 #endif
20471   return 0;
20472 }
20473 EOP
20474 set try
20475 if eval $compile; then
20476     doublemantbits=`$run ./try`
20477 else
20478     doublemantbits="$undef"
20479 fi
20480 $rm_try
20481
20482 : Check the length of the longdouble mantissa
20483 $echo "Checking how many mantissa bits your long doubles have..." >&4
20484 $cat >try.c <<EOP
20485 #$i_float I_FLOAT
20486 #$i_sunmath I_SUNMATH
20487 #ifdef I_FLOAT
20488 # include <float.h>
20489 #endif
20490 #ifdef I_SUNMATH
20491 # include <sunmath.h>
20492 #endif
20493 #$d_longdbl HAS_LONG_DOUBLE
20494 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20495 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20496 /* This format has no implicit bit.  Beware, however, that for
20497  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20498  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20499  * and the top bit must have been one since 387, zero is plain invalid.
20500  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20501 #  define BITS LDBL_MANT_DIG
20502 # elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
20503 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20504  * reason e.g. Irix thinks 107.  But in any case, we want only
20505  * the number of real bits, the implicit bits are of no interest.  */
20506 #  define BITS 2 * (DBL_MANT_DIG - 1)
20507 # else
20508 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20509 # endif
20510 #endif
20511 #include <stdio.h>
20512 int main(int argc, char *argv[]) {
20513 #ifdef BITS
20514   printf("%d\n", BITS);
20515 #endif
20516   return 0;
20517 }
20518 EOP
20519 set try
20520 if eval $compile; then
20521     longdblmantbits=`$run ./try`
20522 else
20523     longdblmantbits="$undef"
20524 fi
20525 $rm_try
20526
20527 : Check the length of the NV mantissa
20528 $echo "Checking how many mantissa bits your NVs have..." >&4
20529 if test "X$usequadmath" = "X$define"; then
20530   nvmantbits=112 # 128-1-15
20531 else
20532   if test "X$nvsize" = "X$doublesize"; then
20533     nvmantbits="$doublemantbits"
20534   else
20535      if test "X$nvsize" = "X$longdblsize"; then
20536        nvmantbits="$longdblmantbits"
20537      else
20538        nvmantbits="$undef"
20539      fi
20540   fi
20541 fi
20542
20543 : How can we generate normalized random numbers ?
20544 echo " "
20545 echo "Using our internal random number implementation..." >&4
20546
20547 case "$ccflags" in
20548 *-Dmy_rand=*|*-Dmy_srand=*)
20549         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20550         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20551         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20552         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20553         ;;
20554 esac
20555
20556 randfunc=Perl_drand48
20557 drand01="Perl_drand48()"
20558 seedfunc="Perl_drand48_init"
20559 randbits=48
20560 randseedtype=U32
20561
20562 : Probe whether dtrace builds an object, as newer Illumos requires an input
20563 : object file that uses at least one of the probes defined in the .d file
20564 case "$usedtrace" in
20565 $define)
20566     case "$dtracexnolibs" in
20567     $define|true|[yY]*)
20568         dtracexnolibs=$define
20569         $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h
20570         ;;
20571     ' '|'')
20572         if $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20573              dtracexnolibs=$define
20574              echo "Your dtrace accepts -xnolibs"
20575         elif $dtrace -h -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20576              dtracexnolibs=$undef
20577              echo "Your dtrace doesn't accept -xnolibs"
20578         else
20579              echo "Your dtrace doesn't work at all, try building without dtrace support" >&4
20580              exit 1
20581         fi
20582         ;;
20583     *)
20584         dtracexnolibs=$undef
20585         $dtrace -h -s ../perldtrace.d -o perldtrace.h
20586         ;;
20587     esac
20588     case $dtracexnolibs in
20589     $define) xnolibs=-xnolibs ;;
20590     *) xnolibs= ;;
20591     esac
20592
20593     case "$dtraceobject" in
20594     $define|true|[yY]*)
20595         dtraceobject=$define
20596         ;;
20597     ' '|'')
20598         $cat >try.c <<EOM
20599 #include "perldtrace.h"
20600 int main(void) {
20601     PERL_LOADED_FILE("dummy");
20602     return 0;
20603 }
20604 EOM
20605         dtraceobject=$undef
20606         if $cc -c -o try.o $optimize $ccflags try.c \
20607                     && $dtrace -G $xnolibs -s ../perldtrace.d try.o >/dev/null 2>&1; then
20608                 dtraceobject=$define
20609             echo "Your dtrace builds an object file"
20610         fi
20611         ;;
20612     *) dtraceobject=$undef ;;
20613     esac
20614     $rm_try perldtrace.o perldtrace.h
20615 esac
20616
20617 : Determine if this is an EBCDIC system
20618 echo " "
20619 echo "Determining whether or not we are on an EBCDIC system..." >&4
20620 $cat >try.c <<'EOM'
20621 int main()
20622 {
20623   if ('M'==0xd4) return 0;
20624   return 1;
20625 }
20626 EOM
20627
20628 val=$undef
20629 set try
20630 if eval $compile_ok; then
20631         if $run ./try; then
20632                 echo "You seem to speak EBCDIC." >&4
20633                 val="$define"
20634         else
20635                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20636         fi
20637 else
20638         echo "I'm unable to compile the test program." >&4
20639         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20640 fi
20641 $rm_try
20642 set ebcdic
20643 eval $setvar
20644
20645 : Check how to flush
20646 echo " "
20647 $cat >&4 <<EOM
20648 Checking how to flush all pending stdio output...
20649 EOM
20650 # I only know how to find the first 32 possibly open files on SunOS.
20651 # See also hints/sunos_4_1.sh and util.c  --AD
20652 case "$osname" in
20653 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20654 esac
20655 $cat >>try.c <<EOCP
20656 #include <stdio.h>
20657 #$i_stdlib I_STDLIB
20658 #ifdef I_STDLIB
20659 #include <stdlib.h>
20660 #endif
20661 #$i_unistd I_UNISTD
20662 #ifdef I_UNISTD
20663 # include <unistd.h>
20664 #endif
20665 #$d_sysconf HAS_SYSCONF
20666 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20667 #ifdef HAS_STDIO_STREAM_ARRAY
20668 # define STDIO_STREAM_ARRAY $stdio_stream_array
20669 #endif
20670 int main() {
20671   FILE* p;
20672   unlink("try.out");
20673   p = fopen("try.out", "w");
20674 #ifdef TRY_FPUTC
20675   fputc('x', p);
20676 #else
20677 # ifdef TRY_FPRINTF
20678   fprintf(p, "x");
20679 # endif
20680 #endif
20681 #ifdef TRY_FFLUSH_NULL
20682   fflush(NULL);
20683 #endif
20684 #ifdef TRY_FFLUSH_ALL
20685   {
20686     long open_max = -1;
20687 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20688     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20689 # else
20690 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20691     open_max = sysconf(_SC_OPEN_MAX);
20692 #  else
20693 #   ifdef FOPEN_MAX
20694     open_max = FOPEN_MAX;
20695 #   else
20696 #    ifdef OPEN_MAX
20697     open_max = OPEN_MAX;
20698 #    else
20699 #     ifdef _NFILE
20700     open_max = _NFILE;
20701 #     endif
20702 #    endif
20703 #   endif
20704 #  endif
20705 # endif
20706 # ifdef HAS_STDIO_STREAM_ARRAY
20707     if (open_max > 0) {
20708       long i;
20709       for (i = 0; i < open_max; i++)
20710             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20711                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20712                 STDIO_STREAM_ARRAY[i]._flag)
20713                 fflush(&STDIO_STREAM_ARRAY[i]);
20714     }
20715   }
20716 # endif
20717 #endif
20718   _exit(42);
20719 }
20720 EOCP
20721 : first we have to find out how _not_ to flush
20722 $to try.c
20723 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20724     output=''
20725     set try -DTRY_FPUTC
20726     if eval $compile; then
20727             $run ./try 2>/dev/null
20728             code="$?"
20729             $from try.out
20730             if $test ! -s try.out -a "X$code" = X42; then
20731                 output=-DTRY_FPUTC
20732             fi
20733     fi
20734     case "$output" in
20735     '')
20736             set try -DTRY_FPRINTF
20737             if eval $compile; then
20738                     $run ./try 2>/dev/null
20739                     code="$?"
20740                     $from try.out
20741                     if $test ! -s try.out -a "X$code" = X42; then
20742                         output=-DTRY_FPRINTF
20743                     fi
20744             fi
20745         ;;
20746     esac
20747 fi
20748 : check for fflush NULL behavior
20749 case "$fflushNULL" in
20750 '')     set try -DTRY_FFLUSH_NULL $output
20751         if eval $compile; then
20752                 $run ./try 2>/dev/null
20753                 code="$?"
20754                 $from try.out
20755                 if $test -s try.out -a "X$code" = X42; then
20756                         fflushNULL="`$cat try.out`"
20757                 else
20758                         if $test "X$code" != X42; then
20759                                 $cat >&4 <<EOM
20760 (If this test failed, don't worry, we'll try another method shortly.)
20761 EOM
20762                         fi
20763                 fi
20764         fi
20765         $rm -f core try.core core.try.*
20766         case "$fflushNULL" in
20767         x)      $cat >&4 <<EOM
20768 Your fflush(NULL) works okay for output streams.
20769 Let's see if it clobbers input pipes...
20770 EOM
20771 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20772 # bug that improperly flushes the input end of pipes.  So we avoid the
20773 # autoflush on fork/system/exec support for now. :-(
20774 $cat >tryp.c <<EOCP
20775 #include <stdio.h>
20776 int
20777 main(int argc, char **argv)
20778 {
20779     char buf[1024];
20780     int i;
20781     char *bp = buf;
20782     while (1) {
20783         while ((i = getc(stdin)) != -1
20784                && (*bp++ = i) != '\n'
20785                && bp < &buf[1024])
20786         /* DO NOTHING */ ;
20787         *bp = '\0';
20788         fprintf(stdout, "%s", buf);
20789         fflush(NULL);
20790         if (i == -1)
20791             return 0;
20792         bp = buf;
20793     }
20794 }
20795 EOCP
20796                 fflushNULL="$define"
20797                 set tryp
20798                 if eval $compile; then
20799                     $rm -f tryp.out
20800                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20801                     if $test "X$targethost" != X; then
20802                         $to tryp.c
20803                         $to tryp
20804                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20805                     else
20806                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20807                     fi
20808                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20809                        $cat >&4 <<EOM
20810 fflush(NULL) seems to behave okay with input streams.
20811 EOM
20812                         fflushNULL="$define"
20813                     else
20814                         $cat >&4 <<EOM
20815 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20816 EOM
20817                         fflushNULL="$undef"
20818                     fi
20819                 fi
20820                 $rm -f core tryp.c tryp.core core.tryp.*
20821                 ;;
20822         '')     $cat >&4 <<EOM
20823 Your fflush(NULL) isn't working (contrary to ANSI C).
20824 EOM
20825                 fflushNULL="$undef"
20826                 ;;
20827         *)      $cat >&4 <<EOM
20828 Cannot figure out whether your fflush(NULL) works or not.
20829 I'm assuming it doesn't (contrary to ANSI C).
20830 EOM
20831                 fflushNULL="$undef"
20832                 ;;
20833         esac
20834         ;;
20835 $define|true|[yY]*)
20836         fflushNULL="$define"
20837         ;;
20838 *)
20839         fflushNULL="$undef"
20840         ;;
20841 esac
20842 : check explicit looping only if NULL did not work, and if the pipe
20843 : bug does not show up on an explicit flush too
20844 case "$fflushNULL" in
20845 "$undef")
20846         $cat >tryp.c <<EOCP
20847 #include <stdio.h>
20848 int
20849 main(int argc, char **argv)
20850 {
20851     char buf[1024];
20852     int i;
20853     char *bp = buf;
20854     while (1) {
20855         while ((i = getc(stdin)) != -1
20856                && (*bp++ = i) != '\n'
20857                && bp < &buf[1024])
20858         /* DO NOTHING */ ;
20859         *bp = '\0';
20860         fprintf(stdout, "%s", buf);
20861         fflush(stdin);
20862         if (i == -1)
20863             return 0;
20864         bp = buf;
20865     }
20866 }
20867 EOCP
20868         set tryp
20869         if eval $compile; then
20870             $rm -f tryp.out
20871             if $test "X$targethost" != X; then
20872                 $to tryp.c
20873                 $to tryp
20874                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20875             else
20876                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20877             fi
20878             if cmp tryp.c tryp.out >/dev/null 2>&1; then
20879                $cat >&4 <<EOM
20880 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20881 EOM
20882                 : now check for fflushall behaviour
20883                 case "$fflushall" in
20884                 '')     set try -DTRY_FFLUSH_ALL $output
20885                         if eval $compile; then
20886                                 $cat >&4 <<EOM
20887 (Now testing the other method--but note that this also may fail.)
20888 EOM
20889                                 $run ./try 2>/dev/null
20890                                 code=$?
20891                                 $from try.out
20892                                 if $test -s try.out -a "X$code" = X42; then
20893                                         fflushall="`$cat try.out`"
20894                                 fi
20895                         fi
20896                         $rm_try
20897                         case "$fflushall" in
20898                         x)      $cat >&4 <<EOM
20899 Whew. Flushing explicitly all the stdio streams works.
20900 EOM
20901                                 fflushall="$define"
20902                                 ;;
20903                         '')     $cat >&4 <<EOM
20904 Sigh. Flushing explicitly all the stdio streams doesn't work.
20905 EOM
20906                                 fflushall="$undef"
20907                                 ;;
20908                         *)      $cat >&4 <<EOM
20909 Cannot figure out whether flushing stdio streams explicitly works or not.
20910 I'm assuming it doesn't.
20911 EOM
20912                                 fflushall="$undef"
20913                                 ;;
20914                         esac
20915                         ;;
20916                 "$define"|true|[yY]*)
20917                         fflushall="$define"
20918                         ;;
20919                 *)
20920                         fflushall="$undef"
20921                         ;;
20922                 esac
20923             else
20924                 $cat >&4 <<EOM
20925 All is futile.  Even fflush(stdin) clobbers input pipes!
20926 EOM
20927                 fflushall="$undef"
20928             fi
20929         else
20930             fflushall="$undef"
20931         fi
20932         $rm -f core tryp.c tryp.core core.tryp.*
20933         ;;
20934 *)      fflushall="$undef"
20935         ;;
20936 esac
20937
20938 case "$fflushNULL$fflushall" in
20939 undefundef)
20940         $cat <<EOM
20941 OK, I give up.  I cannot figure out how to flush pending stdio output.
20942 We won't be flushing handles at all before fork/exec/popen.
20943 EOM
20944         ;;
20945 esac
20946 $rm_try tryp
20947
20948 : Store the full pathname to the ar program for use in the C program
20949 : Respect a hint or command line value for full_ar.
20950 case "$full_ar" in
20951 '') full_ar=$ar ;;
20952 esac
20953
20954 : Store the full pathname to the sed program for use in the C program
20955 full_sed=$sed
20956
20957 : see what type gids are declared as in the kernel
20958 echo " "
20959 echo "Looking for the type for group ids returned by getgid()."
20960 set gid_t gidtype xxx stdio.h sys/types.h
20961 eval $typedef
20962 case "$gidtype" in
20963 xxx)
20964         xxx=`./findhdr sys/user.h`
20965         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
20966         case $1 in
20967         unsigned) dflt="$1 $2" ;;
20968         *) dflt="$1" ;;
20969         esac
20970         ;;
20971 *) dflt="$gidtype";;
20972 esac
20973 case "$gidtype" in
20974 gid_t) echo "gid_t found." ;;
20975 *)      rp="What is the type for group ids returned by getgid()?"
20976         . ./myread
20977         gidtype="$ans"
20978         ;;
20979 esac
20980
20981 : Check the size of GID
20982 echo " "
20983 case "$gidtype" in
20984 *_t) zzz="$gidtype"     ;;
20985 *)   zzz="gid"          ;;
20986 esac
20987 echo "Checking the size of $zzz..." >&4
20988 cat > try.c <<EOCP
20989 #include <sys/types.h>
20990 #include <stdio.h>
20991 #$i_stdlib I_STDLIB
20992 #ifdef I_STDLIB
20993 #include <stdlib.h>
20994 #endif
20995 int main() {
20996     printf("%d\n", (int)sizeof($gidtype));
20997     exit(0);
20998 }
20999 EOCP
21000 set try
21001 if eval $compile_ok; then
21002         yyy=`$run ./try`
21003         case "$yyy" in
21004         '')     gidsize=4
21005                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
21006                 ;;
21007         *)      gidsize=$yyy
21008                 echo "Your $zzz is $gidsize bytes long."
21009                 ;;
21010         esac
21011 else
21012         gidsize=4
21013         echo "(I can't compile the test program--guessing $gidsize.)" >&4
21014 fi
21015
21016
21017 : Check if GID is signed
21018 echo " "
21019 case "$gidtype" in
21020 *_t) zzz="$gidtype"     ;;
21021 *)   zzz="gid"          ;;
21022 esac
21023 echo "Checking the sign of $zzz..." >&4
21024 cat > try.c <<EOCP
21025 #include <sys/types.h>
21026 #include <stdio.h>
21027 int main() {
21028         $gidtype foo = -1;
21029         if (foo < 0)
21030                 printf("-1\n");
21031         else
21032                 printf("1\n");
21033 }
21034 EOCP
21035 set try
21036 if eval $compile; then
21037         yyy=`$run ./try`
21038         case "$yyy" in
21039         '')     gidsign=1
21040                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21041                 ;;
21042         *)      gidsign=$yyy
21043                 case "$gidsign" in
21044                  1) echo "Your $zzz is unsigned." ;;
21045                 -1) echo "Your $zzz is signed."   ;;
21046                 esac
21047                 ;;
21048         esac
21049 else
21050         gidsign=1
21051         echo "(I can't compile the test program--guessing unsigned.)" >&4
21052 fi
21053
21054
21055 : Check 64bit sizes
21056 echo " "
21057
21058 if $test X"$quadtype" != X; then
21059
21060 echo "Checking how to print 64-bit integers..." >&4
21061
21062 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21063         $cat >try.c <<'EOCP'
21064 #include <sys/types.h>
21065 #include <stdio.h>
21066 int main() {
21067   int q = 12345678901;
21068   printf("%ld\n", q);
21069 }
21070 EOCP
21071         set try
21072         if eval $compile; then
21073                 yyy=`$run ./try`
21074                 case "$yyy" in
21075                 12345678901)
21076                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21077                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21078                         echo "We will use %d."
21079                         ;;
21080                 esac
21081         fi
21082 fi
21083
21084 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21085         $cat >try.c <<'EOCP'
21086 #include <sys/types.h>
21087 #include <stdio.h>
21088 int main() {
21089   long q = 12345678901;
21090   printf("%ld\n", q);
21091 }
21092 EOCP
21093         set try
21094         if eval $compile; then
21095                 yyy=`$run ./try`
21096                 case "$yyy" in
21097                 12345678901)
21098                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21099                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21100                         echo "We will use %ld."
21101                         ;;
21102                 esac
21103         fi
21104 fi
21105
21106 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21107         $cat >try.c <<'EOCP'
21108 #include <sys/types.h>
21109 #include <inttypes.h>
21110 #include <stdio.h>
21111 int main() {
21112   int64_t q = 12345678901;
21113   printf("%" PRId64 "\n", q);
21114 }
21115 EOCP
21116         set try
21117         if eval $compile; then
21118                 yyy=`$run ./try`
21119                 case "$yyy" in
21120                 12345678901)
21121                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21122                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
21123                         echo "We will use the C9X style."
21124                         ;;
21125                 esac
21126         fi
21127 fi
21128
21129 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21130         $cat >try.c <<EOCP
21131 #include <sys/types.h>
21132 #include <stdio.h>
21133 int main() {
21134   $quadtype q = 12345678901;
21135   printf("%Ld\n", q);
21136 }
21137 EOCP
21138         set try
21139         if eval $compile; then
21140                 yyy=`$run ./try`
21141                 case "$yyy" in
21142                 12345678901)
21143                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21144                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21145                         echo "We will use %Ld."
21146                         ;;
21147                 esac
21148         fi
21149 fi
21150
21151 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21152         $cat >try.c <<'EOCP'
21153 #include <sys/types.h>
21154 #include <stdio.h>
21155 int main() {
21156   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21157   printf("%lld\n", q);
21158 }
21159 EOCP
21160         set try
21161         if eval $compile; then
21162                 yyy=`$run ./try`
21163                 case "$yyy" in
21164                 12345678901)
21165                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21166                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21167                         echo "We will use the %lld style."
21168                         ;;
21169                 esac
21170         fi
21171 fi
21172
21173 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21174         $cat >try.c <<EOCP
21175 #include <sys/types.h>
21176 #include <stdio.h>
21177 int main() {
21178   $quadtype q = 12345678901;
21179   printf("%qd\n", q);
21180 }
21181 EOCP
21182         set try
21183         if eval $compile; then
21184                 yyy=`$run ./try`
21185                 case "$yyy" in
21186                 12345678901)
21187                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21188                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21189                         echo "We will use %qd."
21190                         ;;
21191                 esac
21192         fi
21193 fi
21194
21195 if $test X"$sPRId64" = X; then
21196         echo "Cannot figure out how to print 64-bit integers." >&4
21197 fi
21198 $rm_try
21199
21200 fi
21201
21202 case "$sPRId64" in
21203 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21204         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21205         ;;
21206 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21207         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21208         ;;
21209 esac
21210
21211 : Check format strings for internal types
21212 echo " "
21213 $echo "Checking the format strings to be used for Perl's internal types..." >&4
21214
21215 if $test X"$ivsize" = X8; then
21216         ivdformat="$sPRId64"
21217         uvuformat="$sPRIu64"
21218         uvoformat="$sPRIo64"
21219         uvxformat="$sPRIx64"
21220         uvXUformat="$sPRIXU64"
21221 else
21222         if $test X"$ivsize" = X"$longsize"; then
21223                 ivdformat='"ld"'
21224                 uvuformat='"lu"'
21225                 uvoformat='"lo"'
21226                 uvxformat='"lx"'
21227                 uvXUformat='"lX"'
21228         else
21229                 if $test X"$ivsize" = X"$intsize"; then
21230                         ivdformat='"d"'
21231                         uvuformat='"u"'
21232                         uvoformat='"o"'
21233                         uvxformat='"x"'
21234                         uvXUformat='"X"'
21235                 else
21236                         : far out
21237                         if $test X"$ivsize" = X"$shortsize"; then
21238                                 ivdformat='"hd"'
21239                                 uvuformat='"hu"'
21240                                 uvoformat='"ho"'
21241                                 uvxformat='"hx"'
21242                                 uvXUformat='"hX"'
21243                         fi
21244                 fi
21245         fi
21246 fi
21247
21248 if $test X"$usequadmath" = X"$define"; then
21249     nveformat='"Qe"'
21250     nvfformat='"Qf"'
21251     nvgformat='"Qg"'
21252     nvEUformat='"QE"'
21253     nvFUformat='"QF"'
21254     nvGUformat='"QG"'
21255 else
21256     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21257         nveformat="$sPRIeldbl"
21258         nvfformat="$sPRIfldbl"
21259         nvgformat="$sPRIgldbl"
21260         nvEUformat="$sPRIEUldbl"
21261         nvFUformat="$sPRIFUldbl"
21262         nvGUformat="$sPRIGUldbl"
21263     else
21264         nveformat='"e"'
21265         nvfformat='"f"'
21266         nvgformat='"g"'
21267         nvEUformat='"E"'
21268         nvFUformat='"F"'
21269         nvGUformat='"G"'
21270     fi
21271 fi
21272
21273 case "$ivdformat" in
21274 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21275     exit 1
21276     ;;
21277 esac
21278
21279 : Check format string for GID
21280
21281 echo " "
21282 $echo "Checking the format string to be used for gids..." >&4
21283
21284 case "$gidsign" in
21285 -1)     if $test X"$gidsize" = X"$ivsize"; then
21286                 gidformat="$ivdformat"
21287         else
21288                 if $test X"$gidsize" = X"$longsize"; then
21289                         gidformat='"ld"'
21290                 else
21291                         if $test X"$gidsize" = X"$intsize"; then
21292                                 gidformat='"d"'
21293                         else
21294                                 if $test X"$gidsize" = X"$shortsize"; then
21295                                         gidformat='"hd"'
21296                                 fi
21297                         fi
21298                 fi
21299         fi
21300         ;;
21301 *)      if $test X"$gidsize" = X"$uvsize"; then
21302                 gidformat="$uvuformat"
21303         else
21304                 if $test X"$gidsize" = X"$longsize"; then
21305                         gidformat='"lu"'
21306                 else
21307                         if $test X"$gidsize" = X"$intsize"; then
21308                                 gidformat='"u"'
21309                         else
21310                                 if $test X"$gidsize" = X"$shortsize"; then
21311                                         gidformat='"hu"'
21312                                 fi
21313                         fi
21314                 fi
21315         fi
21316         ;;
21317 esac
21318
21319 : see if getgroups exists
21320 set getgroups d_getgrps
21321 eval $inlibc
21322
21323 : see if setgroups exists
21324 set setgroups d_setgrps
21325 eval $inlibc
21326
21327 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21328 echo " "
21329 case "$d_getgrps$d_setgrps" in
21330 *define*)
21331         case "$groupstype" in
21332         '') dflt="$gidtype" ;;
21333         *)  dflt="$groupstype" ;;
21334         esac
21335         $cat <<EOM
21336 What type of pointer is the second argument to getgroups() and setgroups()?
21337 Usually this is the same as group ids, $gidtype, but not always.
21338
21339 EOM
21340         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21341         . ./myread
21342         groupstype="$ans"
21343         ;;
21344 *)  groupstype="$gidtype";;
21345 esac
21346
21347 : check whether make sets MAKE
21348 echo " "
21349 echo "Checking if your $make program sets \$(MAKE)..." >&4
21350 case "$make_set_make" in
21351 '')
21352         $sed 's/^X //' > testmake.mak << 'EOF'
21353 Xall:
21354 X       @echo 'maketemp="$(MAKE)"'
21355 EOF
21356         case "`$make -f testmake.mak 2>/dev/null`" in
21357         *maketemp=*) make_set_make='#' ;;
21358         *)      make_set_make="MAKE=$make" ;;
21359         esac
21360         $rm -f testmake.mak
21361         ;;
21362 esac
21363 case "$make_set_make" in
21364 '#') echo "Yup, it does.";;
21365 *) echo "Nope, it doesn't.";;
21366 esac
21367
21368 : see what type is used for mode_t
21369 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21370 set mode_t modetype int stdio.h sys/types.h
21371 eval $typedef_ask
21372
21373 : see if we need va_copy
21374 echo " "
21375 $cat >try.c <<EOCP
21376 #include <stdarg.h>
21377 #include <stdio.h>
21378 #include <stdlib.h>
21379 #include <signal.h>
21380
21381 int
21382 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21383 {
21384   return vfprintf(f, fmt, *valp);
21385 }
21386
21387 int
21388 myvfprintf(FILE *f, const  char *fmt, va_list val)
21389 {
21390   return ivfprintf(f, fmt, &val);
21391 }
21392
21393 int
21394 myprintf(char *fmt, ...)
21395 {
21396   va_list val;
21397   va_start(val, fmt);
21398   return myvfprintf(stdout, fmt, val);
21399 }
21400
21401 int
21402 main(int ac, char **av)
21403 {
21404   signal(SIGSEGV, exit);
21405
21406   myprintf("%s%cs all right, then\n", "that", '\'');
21407   exit(0);
21408 }
21409 EOCP
21410 set try
21411 if eval $compile && $run ./try 2>&1 >/dev/null; then
21412         case "`$run ./try`" in
21413         "that's all right, then")
21414                 okay=yes
21415                 ;;
21416         esac
21417 fi
21418 case "$okay" in
21419 yes)    echo "It seems that you don't need va_copy()." >&4
21420         need_va_copy="$undef"
21421         ;;
21422 *)      echo "It seems that va_copy() or similar will be needed." >&4
21423         need_va_copy="$define"
21424         ;;
21425 esac
21426 $rm_try
21427
21428 : see what type is used for size_t
21429 rp="What is the type used for the length parameter for string functions?"
21430 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21431 eval $typedef_ask
21432
21433 : check for type of arguments to gethostbyaddr.
21434 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21435         case "$d_gethbyaddr" in
21436         $define)
21437                 $cat <<EOM
21438
21439 Checking to see what type of arguments are accepted by gethostbyaddr().
21440 EOM
21441                 hdrs="$define sys/types.h
21442                         $d_socket sys/socket.h
21443                         $i_niin netinet/in.h
21444                         $i_netdb netdb.h
21445                         $i_unistd unistd.h"
21446                 : The first arg can 'char *' or 'void *'
21447                 : The second arg is some of integral type
21448                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21449                         for yyy in size_t long int; do
21450                                 case "$netdb_host_type" in
21451                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21452                                         if ./protochk "$try" $hdrs; then
21453                                                 echo "Your system accepts $xxx for the first arg."
21454                                                 echo "...and $yyy for the second arg."
21455                                                 netdb_host_type="$xxx"
21456                                                 netdb_hlen_type="$yyy"
21457                                         fi
21458                                         ;;
21459                                 esac
21460                         done
21461                 done
21462                 : In case none of those worked, prompt the user.
21463                 case "$netdb_host_type" in
21464                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21465                         dflt='char *'
21466                         . ./myread
21467                         netdb_host_type=$ans
21468                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21469                         dflt="$sizetype"
21470                         . ./myread
21471                         netdb_hlen_type=$ans
21472                         ;;
21473                 esac
21474                 ;;
21475         *)      : no gethostbyaddr, so pick harmless defaults
21476                 netdb_host_type='char *'
21477                 netdb_hlen_type="$sizetype"
21478                 ;;
21479         esac
21480         # Remove the "const" if needed. -- but then we'll have a
21481         # prototype clash!
21482         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21483 fi
21484
21485 : check for type of argument to gethostbyname.
21486 if test "X$netdb_name_type" = X ; then
21487         case "$d_gethbyname" in
21488         $define)
21489                 $cat <<EOM
21490
21491 Checking to see what type of argument is accepted by gethostbyname().
21492 EOM
21493                 hdrs="$define sys/types.h
21494                         $d_socket sys/socket.h
21495                         $i_niin netinet/in.h
21496                         $i_netdb netdb.h
21497                         $i_unistd unistd.h"
21498                 for xxx in "const char *" "char *"; do
21499                         case "$netdb_name_type" in
21500                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21501                                 if ./protochk "$try" $hdrs; then
21502                                         echo "Your system accepts $xxx."
21503                                         netdb_name_type="$xxx"
21504                                 fi
21505                                 ;;
21506                         esac
21507                 done
21508                 : In case none of those worked, prompt the user.
21509                 case "$netdb_name_type" in
21510                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21511                         dflt='char *'
21512                         . ./myread
21513                         netdb_name_type=$ans
21514                         ;;
21515                 esac
21516                 ;;
21517         *)      : no gethostbyname, so pick harmless default
21518                 netdb_name_type='char *'
21519                 ;;
21520         esac
21521 fi
21522
21523 : check for type of 1st argument to getnetbyaddr.
21524 if test "X$netdb_net_type" = X ; then
21525         case "$d_getnbyaddr" in
21526         $define)
21527                 $cat <<EOM
21528
21529 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21530 EOM
21531                 hdrs="$define sys/types.h
21532                         $d_socket sys/socket.h
21533                         $i_niin netinet/in.h
21534                         $i_netdb netdb.h
21535                         $i_unistd unistd.h"
21536                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21537                         case "$netdb_net_type" in
21538                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21539                                 if ./protochk "$try" $hdrs; then
21540                                         echo "Your system accepts $xxx."
21541                                         netdb_net_type="$xxx"
21542                                 fi
21543                                 ;;
21544                         esac
21545                 done
21546                 : In case none of those worked, prompt the user.
21547                 case "$netdb_net_type" in
21548                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21549                         dflt='long'
21550                         . ./myread
21551                         netdb_net_type=$ans
21552                         ;;
21553                 esac
21554                 ;;
21555         *)      : no getnetbyaddr, so pick harmless default
21556                 netdb_net_type='long'
21557                 ;;
21558         esac
21559 fi
21560 : locate the preferred pager for this system
21561 fn=f/
21562 case "$pager" in
21563 '')
21564         dflt=''
21565         case "$pg" in
21566         /*) dflt=$pg;;
21567         [a-zA-Z]:/*) dflt=$pg;;
21568         esac
21569         case "$more" in
21570         /*) dflt=$more;;
21571         [a-zA-Z]:/*) dflt=$more;;
21572         esac
21573         case "$less" in
21574         /*) dflt=$less;;
21575         [a-zA-Z]:/*) dflt=$less;;
21576         esac
21577         case "$dflt" in
21578         '') dflt=/usr/ucb/more;;
21579         esac
21580         ;;
21581 *)      dflt="$pager"
21582         ;;
21583 esac
21584 fn="f/($dflt)"
21585 echo " "
21586 rp='What pager is used on your system?'
21587 . ./getfile
21588 pager="$ans"
21589
21590 : see if ar generates random libraries by itself
21591 echo " "
21592 echo "Checking how to generate random libraries on your machine..." >&4
21593 echo 'int bar1() { return bar2(); }' > bar1.c
21594 echo 'int bar2() { return 2; }' > bar2.c
21595 $cat > foo.c <<EOP
21596 #$i_stdlib I_STDLIB
21597 #ifdef I_STDLIB
21598 #include <stdlib.h>
21599 #endif
21600 int main() { printf("%d\n", bar1()); exit(0); }
21601 EOP
21602 $cc $ccflags -c bar1.c >/dev/null 2>&1
21603 $cc $ccflags -c bar2.c >/dev/null 2>&1
21604 $cc $ccflags -c foo.c >/dev/null 2>&1
21605 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21606 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21607         $run ./foobar >/dev/null 2>&1; then
21608         echo "$ar appears to generate random libraries itself."
21609         orderlib=false
21610         if [ "X$ranlib" = "X" ]; then
21611             ranlib=":"
21612         fi
21613 elif $ar s bar$_a >/dev/null 2>&1 &&
21614         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21615         $run ./foobar >/dev/null 2>&1; then
21616                 echo "a table of contents needs to be added with '$ar s'."
21617                 orderlib=false
21618                 ranlib="$ar s"
21619 elif $ar ts bar$_a >/dev/null 2>&1 &&
21620         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21621         $run ./foobar >/dev/null 2>&1; then
21622                 echo "a table of contents needs to be added with '$ar ts'."
21623                 orderlib=false
21624                 ranlib="$ar ts"
21625 else
21626         case "$ranlib" in
21627         :) ranlib='';;
21628         '')
21629                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21630                 $test -f $ranlib || ranlib=''
21631                 ;;
21632         esac
21633         if $test -n "$ranlib"; then
21634                 echo "your system has '$ranlib'; we'll use that."
21635                 orderlib=false
21636         else
21637                 echo "your system doesn't seem to support random libraries"
21638                 echo "so we'll use lorder and tsort to order the libraries."
21639                 orderlib=true
21640                 ranlib=":"
21641         fi
21642 fi
21643 $rm -f foo* bar*
21644
21645 : see if this is a values.h system
21646 set values.h i_values
21647 eval $inhdr
21648
21649 : Check the max offset that gmtime and localtime accept
21650 echo "Checking max offsets that gmtime () accepts"
21651
21652 case $i_values in
21653     define) yyy="#include <values.h>" ;;
21654     *)      yyy="" ;;
21655     esac
21656
21657 case "$sGMTIME_min/$sGMTIME_max" in
21658     0/0|/)
21659         $cat >try.c <<EOCP
21660 #include <sys/types.h>
21661 #include <stdio.h>
21662 #include <time.h>
21663 $yyy
21664
21665 int i;
21666 struct tm *tmp;
21667 time_t pt;
21668
21669 void gm_check (time_t t, int min_year, int max_year)
21670 {
21671     tmp = gmtime (&t);
21672     if ( tmp == NULL ||
21673         /* Check tm_year overflow */
21674          tmp->tm_year < min_year || tmp->tm_year > max_year)
21675         tmp = NULL;
21676     else
21677         pt = t;
21678     } /* gm_check */
21679
21680 int check_max ()
21681 {
21682     tmp = NULL;
21683     pt  = 0;
21684 #ifdef MAXLONG
21685     gm_check (MAXLONG, 69, 0x7fffffff);
21686 #endif
21687     if (tmp == NULL || tmp->tm_year < 0) {
21688         for (i = 63; i >= 0; i--) {
21689             time_t x = pt | ((time_t)1 << i);
21690             if (x < 0 || x < pt) continue;
21691             gm_check (x, 69, 0x7fffffff);
21692             }
21693         }
21694     printf ("sGMTIME_max=%ld\n", pt);
21695     return (0);
21696     } /* check_max */
21697
21698 int check_min ()
21699 {
21700     tmp = NULL;
21701     pt  = 0;
21702 #ifdef MINLONG
21703     gm_check (MINLONG, -1900, 70);
21704 #endif
21705     if (tmp == NULL) {
21706         for (i = 36; i >= 0; i--) {
21707             time_t x = pt - ((time_t)1 << i);
21708             if (x > 0) continue;
21709             gm_check (x, -1900, 70);
21710             }
21711         }
21712     printf ("sGMTIME_min=%ld\n", pt);
21713     return (0);
21714     } /* check_min */
21715
21716 int main (int argc, char *argv[])
21717 {
21718     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21719     check_max ();
21720     check_min ();
21721     return (0);
21722     } /* main */
21723 EOCP
21724         set try
21725         if eval $compile; then
21726             eval `$run ./try 2>/dev/null`
21727         else
21728             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21729             fi
21730         $rm_try
21731         ;;
21732     esac
21733
21734 echo "Checking max offsets that localtime () accepts"
21735
21736 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21737     0/0|/)
21738         $cat >try.c <<EOCP
21739 #include <sys/types.h>
21740 #include <stdio.h>
21741 #include <time.h>
21742 $yyy
21743
21744 int i;
21745 struct tm *tmp;
21746 time_t pt;
21747
21748 void local_check (time_t t, int min_year, int max_year)
21749 {
21750     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21751         tmp = NULL;
21752     else
21753         tmp = localtime (&t);
21754     if ( tmp == NULL ||
21755         /* Check tm_year overflow */
21756          tmp->tm_year < min_year || tmp->tm_year > max_year)
21757         tmp = NULL;
21758     else
21759         pt = t;
21760     } /* local_check */
21761
21762 int check_max ()
21763 {
21764     tmp = NULL;
21765     pt  = 0;
21766 #ifdef MAXLONG
21767     local_check (MAXLONG, 69, 0x7fffffff);
21768 #endif
21769     if (tmp == NULL || tmp->tm_year < 0) {
21770         for (i = 63; i >= 0; i--) {
21771             time_t x = pt | ((time_t)1 << i);
21772             if (x < 0 || x < pt) continue;
21773             local_check (x, 69, 0x7fffffff);
21774             }
21775         }
21776     printf ("sLOCALTIME_max=%ld\n", pt);
21777     return (0);
21778    } /* check_max */
21779
21780 int check_min ()
21781 {
21782     tmp = NULL;
21783     pt  = 0;
21784 #ifdef MINLONG
21785     local_check (MINLONG, -1900, 70);
21786 #endif
21787     if (tmp == NULL) {
21788         for (i = 36; i >= 0; i--) {
21789             time_t x = pt - ((time_t)1 << i);
21790             if (x > 0) continue;
21791             local_check (x, -1900, 70);
21792             }
21793         }
21794     printf ("sLOCALTIME_min=%ld\n", pt);
21795     return (0);
21796     } /* check_min */
21797
21798 int main (int argc, char *argv[])
21799 {
21800     check_max ();
21801     check_min ();
21802     return (0);
21803     } /* main */
21804 EOCP
21805         set try
21806         if eval $compile; then
21807             eval `$run ./try 2>/dev/null`
21808         else
21809             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21810             fi
21811         $rm_try
21812         ;;
21813     esac
21814
21815 : check for type of arguments to select.
21816 case "$selecttype" in
21817 '') case "$d_select" in
21818         $define)
21819                 echo " "
21820                 $cat <<EOM
21821 Checking to see what type of arguments are accepted by select().
21822 EOM
21823                 hdrs="$define sys/types.h
21824                         $i_systime sys/time.h
21825                         $i_sysselct sys/select.h
21826                         $d_socket sys/socket.h"
21827                 : The first arg can be int, unsigned, or size_t
21828                 : The last arg may or may not be 'const'
21829                 val=''
21830                 : void pointer has been seen but using that
21831                 : breaks the selectminbits test
21832                 for xxx in 'fd_set *' 'int *'; do
21833                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21834                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
21835                                         case "$val" in
21836                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21837                                                 if ./protochk "$try" $hdrs; then
21838                                                         echo "Your system accepts $xxx."
21839                                                         val="$xxx"
21840                                                 fi
21841                                                 ;;
21842                                         esac
21843                                 done
21844                         done
21845                 done
21846                 case "$val" in
21847                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21848                         case "$d_fd_set" in
21849                                 $define) dflt="fd_set *" ;;
21850                                 *)              dflt="int *" ;;
21851                         esac
21852                         . ./myread
21853                         val=$ans
21854                         ;;
21855                 esac
21856                 selecttype="$val"
21857                 ;;
21858         *)      : no select, so pick a harmless default
21859                 selecttype='int *'
21860                 ;;
21861         esac
21862         ;;
21863 esac
21864
21865 : check for the select 'width'
21866 case "$selectminbits" in
21867 '') safebits=`expr $ptrsize \* 8`
21868     case "$d_select" in
21869         $define)
21870                 $cat <<EOM
21871
21872 Checking to see on how many bits at a time your select() operates...
21873 EOM
21874                 $cat >try.c <<EOCP
21875 #include <sys/types.h>
21876 #$i_time I_TIME
21877 #$i_systime I_SYS_TIME
21878 #$i_systimek I_SYS_TIME_KERNEL
21879 #ifdef I_TIME
21880 #   include <time.h>
21881 #endif
21882 #ifdef I_SYS_TIME
21883 #   ifdef I_SYS_TIME_KERNEL
21884 #       define KERNEL
21885 #   endif
21886 #   include <sys/time.h>
21887 #   ifdef I_SYS_TIME_KERNEL
21888 #       undef KERNEL
21889 #   endif
21890 #endif
21891 #$i_sysselct I_SYS_SELECT
21892 #ifdef I_SYS_SELECT
21893 #include <sys/select.h>
21894 #endif
21895 #$d_socket HAS_SOCKET
21896 #ifdef HAS_SOCKET
21897 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21898 #endif
21899 #include <stdio.h>
21900 #$i_stdlib I_STDLIB
21901 #ifdef I_STDLIB
21902 #include <stdlib.h>
21903 #endif
21904 $selecttype b;
21905 #define S sizeof(*(b))
21906 #define MINBITS 64
21907 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21908 #define NBITS  (NBYTES * 8)
21909 int main() {
21910     char *s = (char *)malloc(NBYTES);
21911     struct timeval t;
21912     int i;
21913     FILE* fp;
21914     int fd;
21915
21916     if (!s)
21917         exit(1);
21918     fclose(stdin);
21919     fp = fopen("try.c", "r");
21920     if (fp == 0)
21921       exit(2);
21922     fd = fileno(fp);
21923     if (fd < 0)
21924       exit(3);
21925     b = ($selecttype)s;
21926     for (i = 0; i < NBITS; i++)
21927         FD_SET(i, b);
21928     t.tv_sec  = 0;
21929     t.tv_usec = 0;
21930     select(fd + 1, b, 0, 0, &t);
21931     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
21932     free(s);
21933     printf("%d\n", i + 1);
21934     return 0;
21935 }
21936 EOCP
21937                 set try
21938                 if eval $compile_ok; then
21939                         selectminbits=`$run ./try 2>/dev/null`
21940                         case "$selectminbits" in
21941                         '')     cat >&4 <<EOM
21942 Cannot figure out on how many bits at a time your select() operates.
21943 I'll play safe and guess it is $safebits bits.
21944 EOM
21945                                 selectminbits=$safebits
21946                                 bits="$safebits bits"
21947                                 ;;
21948                         1)      bits="1 bit" ;;
21949                         *)      bits="$selectminbits bits" ;;
21950                         esac
21951                         echo "Your select() operates on $bits at a time." >&4
21952                 else
21953                         rp='What is the minimum number of bits your select() operates on?'
21954                         case "$byteorder" in
21955                         12345678)       dflt=64 ;;
21956                         1234)           dflt=32 ;;
21957                         *)              dflt=1  ;;
21958                         esac
21959                         . ./myread
21960                         val=$ans
21961                         selectminbits="$val"
21962                 fi
21963                 $rm_try
21964                 ;;
21965         *)      : no select, so pick a harmless default
21966                 selectminbits=$safebits
21967                 ;;
21968         esac
21969         ;;
21970 esac
21971
21972 : Trace out the files included by signal.h, then look for SIGxxx names.
21973 case "$sig_num_init" in
21974 '')
21975 if [ "X$fieldn" = X ]; then
21976         : Just make some guesses.  We check them later.
21977         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
21978 else
21979         xxx=`echo '#include <signal.h>' |
21980         $cppstdin $cppminus $cppflags 2>/dev/null |
21981         $grep '^[       ]*#.*include' |
21982         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
21983                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
21984 fi
21985 xxxfiles=''
21986 for xx in $xxx /dev/null ; do
21987         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
21988 done
21989 case "$xxxfiles" in
21990 '')     xxxfiles=`./findhdr signal.h` ;;
21991 esac
21992 xxx=`awk '
21993 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
21994         print substr($2, 4, 20)
21995 }
21996 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
21997         print substr($3, 4, 20)
21998 }' $xxxfiles`
21999 : Append some common names just in case the awk scan failed.
22000 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22001 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22002 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22003 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22004 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22005
22006 : generate a few handy files for later
22007 $cat > signal.c <<EOCP
22008 #include <sys/types.h>
22009 #include <signal.h>
22010 #$i_stdlib I_STDLIB
22011 #ifdef I_STDLIB
22012 #include <stdlib.h>
22013 #endif
22014 #include <stdio.h>
22015 int main() {
22016
22017 /* Strange style to avoid deeply-nested #if/#else/#endif */
22018 #ifndef NSIG
22019 #  ifdef _NSIG
22020 #    define NSIG (_NSIG)
22021 #  endif
22022 #endif
22023
22024 #ifndef NSIG
22025 #  ifdef SIGMAX
22026 #    define NSIG (SIGMAX+1)
22027 #  endif
22028 #endif
22029
22030 #ifndef NSIG
22031 #  ifdef SIG_MAX
22032 #    define NSIG (SIG_MAX+1)
22033 #  endif
22034 #endif
22035
22036 #ifndef NSIG
22037 #  ifdef _SIG_MAX
22038 #    define NSIG (_SIG_MAX+1)
22039 #  endif
22040 #endif
22041
22042 #ifndef NSIG
22043 #  ifdef MAXSIG
22044 #    define NSIG (MAXSIG+1)
22045 #  endif
22046 #endif
22047
22048 #ifndef NSIG
22049 #  ifdef MAX_SIG
22050 #    define NSIG (MAX_SIG+1)
22051 #  endif
22052 #endif
22053
22054 #ifndef NSIG
22055 #  ifdef SIGARRAYSIZE
22056 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22057 #  endif
22058 #endif
22059
22060 #ifndef NSIG
22061 #  ifdef _sys_nsig
22062 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
22063 #  endif
22064 #endif
22065
22066 /* Default to some arbitrary number that's big enough to get most
22067    of the common signals.
22068 */
22069 #ifndef NSIG
22070 #    define NSIG 50
22071 #endif
22072
22073 printf("NSIG %d\n", NSIG);
22074
22075 #ifndef JUST_NSIG
22076
22077 EOCP
22078
22079 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22080 {
22081         printf "#ifdef SIG"; printf $1; printf "\n"
22082         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22083         printf $1; printf ");\n"
22084         printf "#endif\n"
22085 }
22086 END {
22087         printf "#endif /* JUST_NSIG */\n";
22088         printf "exit(0);\n}\n";
22089 }
22090 ' >>signal.c
22091 $cat >signal.awk <<'EOP'
22092 BEGIN { ndups = 0 }
22093 $1 ~ /^NSIG$/ { nsig = $2 }
22094 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22095     if ($2 > maxsig) { maxsig = $2 }
22096     if (sig_name[$2]) {
22097         dup_name[ndups] = $1
22098         dup_num[ndups] = $2
22099         ndups++
22100     }
22101     else {
22102         sig_name[$2] = $1
22103         sig_num[$2] = $2
22104     }
22105 }
22106 END {
22107     if (nsig == 0) {
22108         nsig = maxsig + 1
22109     }
22110     printf("NSIG %d\n", nsig);
22111     for (n = 1; n < nsig; n++) {
22112         if (sig_name[n]) {
22113             printf("%s %d\n", sig_name[n], sig_num[n])
22114         }
22115         else {
22116             printf("NUM%d %d\n", n, n)
22117         }
22118     }
22119     for (n = 0; n < ndups; n++) {
22120         printf("%s %d\n", dup_name[n], dup_num[n])
22121     }
22122 }
22123 EOP
22124 $cat >signal_cmd <<EOS
22125 $startsh
22126 if $test -s signal.lst; then
22127     echo "Using your existing signal.lst file"
22128         exit 0
22129 fi
22130 xxx="$xxx"
22131 EOS
22132 $cat >>signal_cmd <<'EOS'
22133
22134 set signal
22135 if eval $compile_ok; then
22136         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22137                 $uniq | $awk -f signal.awk >signal.lst
22138 else
22139         echo "(I can't seem be able to compile the whole test program)" >&4
22140         echo "(I'll try it in little pieces.)" >&4
22141         set signal -DJUST_NSIG
22142         if eval $compile_ok; then
22143                 $run ./signal$_exe > signal.nsg
22144                 $cat signal.nsg
22145         else
22146                 echo "I can't seem to figure out how many signals you have." >&4
22147                 echo "Guessing 50." >&4
22148                 echo 'NSIG 50' > signal.nsg
22149         fi
22150         : Now look at all the signal names, one at a time.
22151         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22152                 $cat > signal.c <<EOCP
22153 #include <sys/types.h>
22154 #include <signal.h>
22155 #include <stdio.h>
22156 int main() {
22157 printf("$xx %d\n", SIG${xx});
22158 return 0;
22159 }
22160 EOCP
22161                 set signal
22162                 if eval $compile; then
22163                         echo "SIG${xx} found."
22164                         $run ./signal$_exe  >> signal.ls1
22165                 else
22166                         echo "SIG${xx} NOT found."
22167                 fi
22168         done
22169         if $test -s signal.ls1; then
22170                 $cat signal.nsg signal.ls1 |
22171                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
22172         fi
22173
22174 fi
22175 if $test -s signal.lst; then
22176         :
22177 else
22178         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
22179         echo 'kill -l' >signal
22180         set X `csh -f <signal`
22181         $rm -f signal
22182         shift
22183         case $# in
22184         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
22185         esac
22186         echo $@ | $tr ' ' $trnl | \
22187             $awk '{ printf "%s %d\n", $1, ++s; }
22188                   END { printf "NSIG %d\n", ++s }' >signal.lst
22189 fi
22190 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
22191 EOS
22192 chmod a+x signal_cmd
22193 $eunicefix signal_cmd
22194 ;;
22195 esac
22196
22197 : generate list of signal names
22198 case "$sig_num_init" in
22199 '')
22200 echo " "
22201 case "$sig_name_init" in
22202 '') doinit=yes ;;
22203 *)  case "$sig_num_init" in
22204     ''|*,*) doinit=yes ;;
22205     esac ;;
22206 esac
22207 case "$doinit" in
22208 yes)
22209         echo "Generating a list of signal names and numbers..." >&4
22210         . ./signal_cmd
22211         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22212         sig_name=`$awk 'BEGIN { printf "ZERO " }
22213                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
22214         sig_num=`$awk  'BEGIN { printf "0 " }
22215                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
22216         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
22217                              !/^NSIG/   { printf "\"%s\", ", $1 }
22218                              END        { printf "0\n" }' signal.lst`
22219         sig_num_init=`$awk  'BEGIN      { printf "0, " }
22220                              !/^NSIG/   { printf "%d, ", $2}
22221                              END        { printf "0\n"}' signal.lst`
22222         ;;
22223 esac
22224 echo "The following $sig_count signals are available:"
22225 echo " "
22226 echo $sig_name | $awk \
22227 'BEGIN { linelen = 0 }
22228 {
22229         for (i = 1; i <= NF; i++) {
22230                 name = "SIG" $i " "
22231                 linelen = linelen + length(name)
22232                 if (linelen > 70) {
22233                         printf "\n"
22234                         linelen = length(name)
22235                 }
22236                 printf "%s", name
22237         }
22238         printf "\n"
22239 }'
22240 sig_size=`echo $sig_name | awk '{print NF}'`
22241 $rm -f signal signal.c signal.awk signal.lst signal_cmd
22242 ;;
22243 esac
22244
22245 : Check size of size
22246 echo " "
22247 case "$sizetype" in
22248 *_t) zzz="$sizetype"    ;;
22249 *)   zzz="filesize"     ;;
22250 esac
22251 echo "Checking the size of $zzz..." >&4
22252 cat > try.c <<EOCP
22253 #include <sys/types.h>
22254 #include <stdio.h>
22255 #$i_stdlib I_STDLIB
22256 #ifdef I_STDLIB
22257 #include <stdlib.h>
22258 #endif
22259 int main() {
22260     printf("%d\n", (int)sizeof($sizetype));
22261     exit(0);
22262 }
22263 EOCP
22264 set try
22265 if eval $compile_ok; then
22266         yyy=`$run ./try`
22267         case "$yyy" in
22268         '')     sizesize=4
22269                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22270                 ;;
22271         *)      sizesize=$yyy
22272                 echo "Your $zzz size is $sizesize bytes."
22273                 ;;
22274         esac
22275 else
22276         sizesize=4
22277         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22278 fi
22279
22280
22281 : check for socklen_t
22282 echo " "
22283 echo "Checking to see if you have socklen_t..." >&4
22284 $cat >try.c <<EOCP
22285 #include <sys/types.h>
22286 #$d_socket HAS_SOCKET
22287 #ifdef HAS_SOCKET
22288 #include <sys/socket.h>
22289 #endif
22290 int main() { socklen_t x = 16; }
22291 EOCP
22292 set try
22293 if eval $compile; then
22294         val="$define"
22295         echo "You have socklen_t."
22296 else
22297         val="$undef"
22298         echo "You do not have socklen_t."
22299         case "$sizetype" in
22300         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22301         esac
22302 fi
22303 $rm_try
22304 set d_socklen_t
22305 eval $setvar
22306
22307 : see if this is a socks.h system
22308 set socks.h i_socks
22309 eval $inhdr
22310
22311 : check for type of the size argument to socket calls
22312 case "$d_socket" in
22313 "$define")
22314         $cat <<EOM
22315
22316 Checking to see what type is the last argument of accept().
22317 EOM
22318         yyy=''
22319         case "$d_socklen_t" in
22320         "$define") yyy="$yyy socklen_t"
22321         esac
22322         yyy="$yyy $sizetype int long unsigned"
22323         for xxx in $yyy; do
22324                 case "$socksizetype" in
22325                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22326                         case "$usesocks" in
22327                         "$define")
22328                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22329                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22330                                         socksizetype="$xxx"
22331                                 fi
22332                                 ;;
22333                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22334                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22335                                         socksizetype="$xxx"
22336                                 fi
22337                                 ;;
22338                         esac
22339                         ;;
22340                 esac
22341         done
22342 : In case none of those worked, prompt the user.
22343         case "$socksizetype" in
22344         '')     rp='What is the type for socket address structure sizes?'
22345                 dflt='int'
22346                 . ./myread
22347                 socksizetype=$ans
22348                 ;;
22349         esac
22350         ;;
22351 *)      : no sockets, so pick relatively harmless default
22352         socksizetype='int'
22353         ;;
22354 esac
22355
22356 : see what type is used for signed size_t
22357 set ssize_t ssizetype int stdio.h sys/types.h
22358 eval $typedef
22359 dflt="$ssizetype"
22360 $cat > try.c <<EOM
22361 #include <stdio.h>
22362 #$i_stdlib I_STDLIB
22363 #ifdef I_STDLIB
22364 #include <stdlib.h>
22365 #endif
22366 #include <sys/types.h>
22367 #define Size_t $sizetype
22368 #define SSize_t $dflt
22369 int main()
22370 {
22371         if (sizeof(Size_t) == sizeof(SSize_t))
22372                 printf("$dflt\n");
22373         else if (sizeof(Size_t) == sizeof(int))
22374                 printf("int\n");
22375         else
22376                 printf("long\n");
22377         exit(0);
22378 }
22379 EOM
22380 echo " "
22381 set try
22382 if eval $compile_ok && $run ./try > /dev/null; then
22383         ssizetype=`$run ./try`
22384         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22385 else
22386         $cat >&4 <<EOM
22387 Help! I can't compile and run the ssize_t test program: please enlighten me!
22388 (This is probably a misconfiguration in your system or libraries, and
22389 you really ought to fix it.  Still, I'll try anyway.)
22390
22391 I need a type that is the same size as $sizetype, but is guaranteed to
22392 be signed.  Common values are ssize_t, int and long.
22393
22394 EOM
22395         rp="What signed type is the same size as $sizetype?"
22396         . ./myread
22397         ssizetype="$ans"
22398 fi
22399 $rm_try
22400
22401 : Check the size of st_ino
22402 $echo " "
22403 $echo "Checking the size of st_ino..." >&4
22404 $cat > try.c <<EOCP
22405 #include <sys/stat.h>
22406 #include <stdio.h>
22407 #$i_stdlib I_STDLIB
22408 #ifdef I_STDLIB
22409 #include <stdlib.h>
22410 #endif
22411 int main() {
22412     struct stat st;
22413     printf("%d\n", (int)sizeof(st.st_ino));
22414     exit(0);
22415 }
22416 EOCP
22417 set try
22418 if eval $compile_ok; then
22419         val=`$run ./try`
22420         case "$val" in
22421         '')     st_ino_size=4
22422                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22423                 ;;
22424         *)      st_ino_size=$val
22425                 $echo "Your st_ino is $st_ino_size bytes long."
22426                 ;;
22427         esac
22428 else
22429         st_ino_size=4
22430         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22431 fi
22432 $rm_try
22433
22434 : Check if st_ino is signed
22435 $echo " "
22436 $echo "Checking the sign of st_ino..." >&4
22437 $cat > try.c <<EOCP
22438 #include <sys/stat.h>
22439 #include <stdio.h>
22440 int main() {
22441         struct stat foo;
22442         foo.st_ino = -1;
22443         if (foo.st_ino < 0)
22444                 printf("-1\n");
22445         else
22446                 printf("1\n");
22447 }
22448 EOCP
22449 set try
22450 if eval $compile; then
22451         val=`$run ./try`
22452         case "$val" in
22453         '')     st_ino_sign=1
22454                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22455                 ;;
22456         *)      st_ino_sign=$val
22457                 case "$st_ino_sign" in
22458                  1) $echo "Your st_ino is unsigned." ;;
22459                 -1) $echo "Your st_ino is signed."   ;;
22460                 esac
22461                 ;;
22462         esac
22463 else
22464         st_ino_sign=1
22465         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22466 fi
22467 $rm_try
22468
22469 : see what type of char stdio uses.
22470 echo " "
22471 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22472 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22473         echo "Your stdio uses unsigned chars." >&4
22474         stdchar="unsigned char"
22475 else
22476         echo "Your stdio uses signed chars." >&4
22477         stdchar="char"
22478 fi
22479 $rm -f stdioh
22480
22481 : Check size of UID
22482 echo " "
22483 case "$uidtype" in
22484 *_t) zzz="$uidtype"     ;;
22485 *)   zzz="uid"          ;;
22486 esac
22487 echo "Checking the size of $zzz..." >&4
22488 cat > try.c <<EOCP
22489 #include <sys/types.h>
22490 #include <stdio.h>
22491 #$i_stdlib I_STDLIB
22492 #ifdef I_STDLIB
22493 #include <stdlib.h>
22494 #endif
22495 int main() {
22496     printf("%d\n", (int)sizeof($uidtype));
22497     exit(0);
22498 }
22499 EOCP
22500 set try
22501 if eval $compile_ok; then
22502         yyy=`$run ./try`
22503         case "$yyy" in
22504         '')     uidsize=4
22505                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22506                 ;;
22507         *)      uidsize=$yyy
22508                 echo "Your $zzz is $uidsize bytes long."
22509                 ;;
22510         esac
22511 else
22512         uidsize=4
22513         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22514 fi
22515
22516 : Check if UID is signed
22517 echo " "
22518 case "$uidtype" in
22519 *_t) zzz="$uidtype"     ;;
22520 *)   zzz="uid"          ;;
22521 esac
22522 echo "Checking the sign of $zzz..." >&4
22523 cat > try.c <<EOCP
22524 #include <sys/types.h>
22525 #include <stdio.h>
22526 int main() {
22527         $uidtype foo = -1;
22528         if (foo < 0)
22529                 printf("-1\n");
22530         else
22531                 printf("1\n");
22532 }
22533 EOCP
22534 set try
22535 if eval $compile; then
22536         yyy=`$run ./try`
22537         case "$yyy" in
22538         '')     uidsign=1
22539                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22540                 ;;
22541         *)      uidsign=$yyy
22542                 case "$uidsign" in
22543                  1) echo "Your $zzz is unsigned." ;;
22544                 -1) echo "Your $zzz is signed."   ;;
22545                 esac
22546                 ;;
22547         esac
22548 else
22549         uidsign=1
22550         echo "(I can't compile the test program--guessing unsigned.)" >&4
22551 fi
22552
22553
22554 : Check format string for UID
22555 echo " "
22556 $echo "Checking the format string to be used for uids..." >&4
22557
22558 case "$uidsign" in
22559 -1)     if $test X"$uidsize" = X"$ivsize"; then
22560                 uidformat="$ivdformat"
22561         else
22562                 if $test X"$uidsize" = X"$longsize"; then
22563                         uidformat='"ld"'
22564                 else
22565                         if $test X"$uidsize" = X"$intsize"; then
22566                                 uidformat='"d"'
22567                         else
22568                                 if $test X"$uidsize" = X"$shortsize"; then
22569                                         uidformat='"hd"'
22570                                 fi
22571                         fi
22572                 fi
22573         fi
22574         ;;
22575 *)      if $test X"$uidsize" = X"$uvsize"; then
22576                 uidformat="$uvuformat"
22577         else
22578                 if $test X"$uidsize" = X"$longsize"; then
22579                         uidformat='"lu"'
22580                 else
22581                         if $test X"$uidsize" = X"$intsize"; then
22582                                 uidformat='"u"'
22583                         else
22584                                 if $test X"$uidsize" = X"$shortsize"; then
22585                                         uidformat='"hu"'
22586                                 fi
22587                         fi
22588                 fi
22589         fi
22590         ;;
22591 esac
22592
22593 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22594 echo " "
22595 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22596 $cat >try.c <<'EOM'
22597 /* Intentionally a long probe as I'd like to sanity check that the exact
22598    approach is going to work, as thinking it will work, but only having it
22599    part working at runtime is worse than not having it.  */
22600
22601 #include <sys/types.h>
22602 #include <sys/sysctl.h>
22603 #include <sys/param.h>
22604 #include <stdio.h>
22605 #include <string.h>
22606 #include <stdlib.h>
22607 #include <unistd.h>
22608
22609 int
22610 main(int argc, char **argv) {
22611     char *buffer;
22612     char *argv_leaf = strrchr(argv[0], '/');
22613     char *buffer_leaf;
22614     size_t size = 0;
22615     int mib[4];
22616
22617     mib[0] = CTL_KERN;
22618     mib[1] = KERN_PROC;
22619     mib[2] = KERN_PROC_PATHNAME;
22620     mib[3] = -1;
22621
22622     if (!argv_leaf) {
22623         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22624         return 1;
22625     }
22626
22627     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22628         perror("sysctl");
22629         return 2;
22630     }
22631
22632     if (size < strlen(argv_leaf) + 1) {
22633         fprintf(stderr, "size %lu is too short for a path\n",
22634                 (unsigned long) size);
22635         return 3;
22636     }
22637
22638     if (size > MAXPATHLEN * MAXPATHLEN) {
22639         fprintf(stderr, "size %lu is too long for a path\n",
22640                 (unsigned long) size);
22641         return 4;
22642     }
22643
22644     buffer = (char *)malloc(size);
22645     if (!buffer) {
22646         perror("malloc");
22647         return 5;
22648     }
22649
22650     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22651         perror("sysctl");
22652         return 6;
22653     }
22654
22655     if (strlen(buffer) + 1 != size) {
22656         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22657                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22658         return 7;
22659     }
22660
22661
22662     if (*buffer != '/') {
22663         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22664         return 8;
22665     }
22666
22667     if (strstr(buffer, "/./")) {
22668         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22669         return 9;
22670     }
22671
22672     if (strstr(buffer, "/../")) {
22673         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22674         return 10;
22675     }
22676
22677     buffer_leaf = strrchr(buffer, '/');
22678     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22679         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22680         return 11;
22681     }
22682
22683     free(buffer);
22684
22685     return 0;
22686 }
22687 EOM
22688
22689 val=$undef
22690 set try
22691 if eval $compile; then
22692         if $run ./try; then
22693                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22694                 val="$define"
22695         else
22696                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22697                 val="$undef"
22698         fi
22699 else
22700         echo "I'm unable to compile the test program." >&4
22701         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22702         val="$undef"
22703 fi
22704 $rm_try
22705 set usekernprocpathname
22706 eval $setvar
22707
22708 : Determine if we can use _NSGetExecutablePath to find executing program
22709 echo " "
22710 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22711 $cat >try.c <<'EOM'
22712 /* Intentionally a long probe as I'd like to sanity check that the exact
22713    approach is going to work, as thinking it will work, but only having it
22714    part working at runtime is worse than not having it.  */
22715 #include <mach-o/dyld.h>
22716 #include <stdio.h>
22717 #include <stdlib.h>
22718 #include <sys/param.h>
22719 #include <string.h>
22720
22721 int
22722 main(int argc, char **argv) {
22723     char buf[1];
22724     uint32_t size = sizeof(buf);
22725     int result;
22726     char *buffer;
22727     char *tidied;
22728     char *argv_leaf = strrchr(argv[0], '/');
22729     char *tidied_leaf;
22730
22731     if (!argv_leaf) {
22732         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22733         return 1;
22734     }
22735
22736     _NSGetExecutablePath(buf, &size);
22737     if (size > MAXPATHLEN * MAXPATHLEN) {
22738         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22739                 (unsigned int) size);
22740         return 2;
22741     }
22742
22743     buffer = (char *)malloc(size);
22744     if (!buffer) {
22745         perror("malloc");
22746         return 3;
22747     }
22748
22749     result = _NSGetExecutablePath(buffer, &size);
22750     if (result != 0) {
22751         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22752                 result, (unsigned int) size);
22753         return 4;
22754     }
22755
22756     tidied = realpath(buffer, NULL);
22757     if (!tidied) {
22758         perror("realpath");
22759         return 5;
22760     }
22761
22762     free(buffer);
22763
22764     if (*tidied != '/') {
22765         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22766         return 6;
22767     }
22768
22769     if (strstr(tidied, "/./")) {
22770         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22771         return 7;
22772     }
22773
22774     if (strstr(tidied, "/../")) {
22775         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22776         return 8;
22777     }
22778
22779     tidied_leaf = strrchr(tidied, '/');
22780     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22781         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22782         return 9;
22783     }
22784
22785     free(tidied);
22786
22787     return 0;
22788 }
22789 EOM
22790
22791 val=$undef
22792 set try
22793 if eval $compile; then
22794         if $run ./try; then
22795                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22796                 val="$define"
22797         else
22798                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22799         fi
22800 else
22801         echo "I'm unable to compile the test program." >&4
22802         echo "I'll assume no _NSGetExecutablePath here." >&4
22803 fi
22804 $rm_try
22805 set usensgetexecutablepath
22806 eval $setvar
22807
22808 : Check if site customization support was requested
22809 case "$usesitecustomize" in
22810     $define|true|[Yy]*)
22811         usesitecustomize="$define"
22812         ;;
22813     *)
22814         usesitecustomize="$undef"
22815         ;;
22816     esac
22817
22818 : determine compiler compiler
22819 case "$yacc" in
22820 '')
22821         dflt=yacc;;
22822 *)
22823         dflt="$yacc";;
22824 esac
22825 echo " "
22826 comp='yacc'
22827 if $test -f "$byacc$_exe"; then
22828         dflt="$byacc"
22829         comp="byacc or $comp"
22830 fi
22831 if $test -f "$bison$_exe"; then
22832         comp="$comp or bison -y"
22833 fi
22834 rp="Which compiler compiler ($comp) shall I use?"
22835 . ./myread
22836 yacc="$ans"
22837 case "$yacc" in
22838 *bis*)
22839         case "$yacc" in
22840         *-y*) ;;
22841         *)
22842                 yacc="$yacc -y"
22843                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22844                 ;;
22845         esac
22846         ;;
22847 esac
22848
22849 : see if this is a assert.h system
22850 set assert.h i_assert
22851 eval $inhdr
22852
22853 : see if this is a bfd.h system
22854 set bfd.h i_bfd
22855 eval $inhdr
22856
22857 : see if this is an execinfo.h system
22858 set execinfo.h i_execinfo
22859 eval $inhdr
22860
22861 : see if this is a fenv.h system
22862 set fenv.h i_fenv
22863 eval $inhdr
22864
22865 : see if this is a fp.h system
22866 set fp.h i_fp
22867 eval $inhdr
22868
22869 : see if this is a fp_class.h system
22870 set fp_class.h i_fp_class
22871 eval $inhdr
22872
22873 : see if gdbm.h is available
22874 set gdbm.h t_gdbm
22875 eval $inhdr
22876 case "$t_gdbm" in
22877 $define)
22878         : see if gdbm_open exists
22879         set gdbm_open d_gdbm_open
22880         eval $inlibc
22881         case "$d_gdbm_open" in
22882         $undef)
22883                 t_gdbm="$undef"
22884                 echo "We won't be including <gdbm.h>"
22885                 ;;
22886         esac
22887         ;;
22888 esac
22889 val="$t_gdbm"
22890 set i_gdbm
22891 eval $setvar
22892
22893 : see if this is a ieeefp.h system
22894 case "$i_ieeefp" in
22895 '' ) set ieeefp.h i_ieeefp
22896      eval $inhdr
22897      ;;
22898 esac
22899
22900 : see if this is a libutil.h system
22901 set libutil.h i_libutil
22902 eval $inhdr
22903
22904 : see if mach cthreads are available
22905 if test "X$usethreads" = "X$define"; then
22906         set mach/cthreads.h i_machcthr
22907         eval $inhdr
22908 else
22909         i_machcthr="$undef"
22910 fi
22911
22912 : see if memory.h is available.
22913 val=''
22914 set memory.h val
22915 eval $inhdr
22916
22917 : See if it conflicts with string.h
22918 case "$val" in
22919 $define)
22920         case "$strings" in
22921         '') ;;
22922         *)
22923                 $cppstdin $cppflags $cppminus < $strings > mem.h
22924                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
22925                         echo " "
22926                         echo "We won't be including <memory.h>."
22927                         val="$undef"
22928                 fi
22929                 $rm -f mem.h
22930                 ;;
22931         esac
22932 esac
22933 set i_memory
22934 eval $setvar
22935
22936 : see if this is a mntent.h system
22937 set mntent.h i_mntent
22938 eval $inhdr
22939
22940 : see if net/errno.h is available
22941 val=''
22942 set net/errno.h val
22943 eval $inhdr
22944
22945 : Unfortunately, it causes problems on some systems.  Arrgh.
22946 case "$val" in
22947 $define)
22948         cat > try.c <<'EOM'
22949 #include <stdio.h>
22950 #include <errno.h>
22951 #include <net/errno.h>
22952 int func()
22953 {
22954         return ENOTSOCK;
22955 }
22956 EOM
22957         if $cc $ccflags -c try.c >/dev/null 2>&1; then
22958                 echo "We'll be including <net/errno.h>." >&4
22959         else
22960                 echo "We won't be including <net/errno.h>." >&4
22961                 val="$undef"
22962         fi
22963         $rm_try
22964         ;;
22965 esac
22966 set i_neterrno
22967 eval $setvar
22968
22969 : see if netinet/tcp.h is available
22970 set netinet/tcp.h i_netinettcp
22971 eval $inhdr
22972
22973 : see if this is a poll.h system
22974 set poll.h i_poll
22975 eval $inhdr
22976
22977 : see if this is a prot.h system
22978 set prot.h i_prot
22979 eval $inhdr
22980
22981 : Preprocessor symbols
22982 echo " "
22983 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
22984 $cat <<'EOSH' > Cppsym.know
22985 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
22986 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
22987 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
22988 arch_pwr ardent ARM ARM32 atarist att386 att3b
22989 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
22990 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
22991 byteorder byte_order
22992 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
22993 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
22994 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
22995 ELF encore EPI EXTENSIONS
22996 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
22997 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
22998 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
22999 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
23000 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400 hp9000s500
23001 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
23002 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
23003 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
23004 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
23005 ksr1
23006 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
23007 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
23008 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
23009 luna88k Lynx
23010 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
23011 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
23012 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
23013 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
23014 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
23015 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
23016 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
23017 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
23018 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
23019 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
23020 ns32000 ns32016 ns32332 ns32k nsc32000
23021 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23022 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23023 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23024 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23025 QK_USER QNX
23026 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23027 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23028 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23029 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23030 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23031 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23032 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23033 SYSV4 SYSV5 sysV68 sysV88
23034 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23035 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23036 tower32_800 tower32_850 tss
23037 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23038 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23039 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23040 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23041 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23042 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23043 uxpm uxps
23044 vax venix VMESA vms
23045 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23046 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23047 z8000 zarch
23048 EOSH
23049 # Maybe put other stuff here too.
23050 ./tr '-' '_' <<EOSH >>Cppsym.know
23051 $osname
23052 EOSH
23053 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23054 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23055 $cat Cppsym.know > Cppsym.c
23056 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23057 $rm -f Cppsym.a Cppsym.b Cppsym.c
23058 cat <<EOSH > Cppsym
23059 $startsh
23060 if $test \$# -gt 0; then
23061     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23062     if $test -s Cppsym.got; then
23063         $rm -f Cppsym.got
23064         exit 0
23065     fi
23066     $rm -f Cppsym.got
23067     exit 1
23068 else
23069     $tr " " "$trnl" | ./Cppsym.try
23070     exit 0
23071 fi
23072 EOSH
23073 chmod +x Cppsym
23074 $eunicefix Cppsym
23075 cat <<EOSH > Cppsym.try
23076 $startsh
23077 cat <<'EOCP' > try.c
23078 #include <stdio.h>
23079 #if cpp_stuff == 1
23080 #define STRINGIFY(a)    "a"
23081 #endif
23082 #if cpp_stuff == 42
23083 #define StGiFy(a)  #a
23084 #define STRINGIFY(a)    StGiFy(a)
23085 #endif
23086 #if $cpp_stuff != 1 && $cpp_stuff != 42
23087 #   include "Bletch: How does this C preprocessor stringify macros?"
23088 #endif
23089 int main() {
23090 EOCP
23091 $awk \\
23092 EOSH
23093 cat <<'EOSH' >> Cppsym.try
23094 'length($1) > 0 {
23095     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23096     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23097     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23098     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23099 }'       >> try.c
23100 echo 'return 0;}' >> try.c
23101 EOSH
23102 cat <<EOSH >> Cppsym.try
23103 ccflags="$ccflags"
23104 case "$osname-$gccversion" in
23105 irix-) ccflags="\$ccflags -woff 1178" ;;
23106 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
23107 esac
23108 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
23109 EOSH
23110 chmod +x Cppsym.try
23111 $eunicefix Cppsym.try
23112 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
23113 : Add in any Linux cpp "predefined macros":
23114 case "$osname::$gccversion" in
23115   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
23116     tHdrH=_tmpHdr
23117     rm -f $tHdrH'.h' $tHdrH
23118     touch $tHdrH'.h'
23119     # Filter out macro arguments, such as Linux's __INT8_C(c)
23120     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
23121        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
23122        if [ -s $tHdrH'_cppsym.real' ]; then
23123           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
23124        fi
23125     fi
23126     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
23127   ;;
23128 esac
23129 : now check the C compiler for additional symbols
23130 postprocess_cc_v=''
23131 case "$osname" in
23132 aix) postprocess_cc_v="|$tr , ' '" ;;
23133 esac
23134 $cat >ccsym <<EOS
23135 $startsh
23136 $cat >tmp.c <<EOF
23137 extern int foo;
23138 EOF
23139 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
23140 do
23141         case "\$i" in
23142         -D*) echo "\$i" | $sed 's/^-D//';;
23143         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
23144         esac
23145 done
23146 $rm_try
23147 EOS
23148 postprocess_cc_v=''
23149 chmod +x ccsym
23150 $eunicefix ccsym
23151 ./ccsym > ccsym1.raw
23152 if $test -s ccsym1.raw; then
23153     $sort ccsym1.raw | $uniq >ccsym.raw
23154 else
23155     mv ccsym1.raw ccsym.raw
23156 fi
23157
23158 $awk '/\=/ { print $0; next }
23159         { print $0"=1" }' ccsym.raw >ccsym.list
23160 $comm -13 Cppsym.true ccsym.list >ccsym.own
23161 $comm -12 Cppsym.true ccsym.list >ccsym.com
23162 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
23163 also=''
23164 if $test -z ccsym.raw; then
23165         echo "Your C compiler doesn't seem to define any symbols!" >&4
23166         echo " "
23167         echo "However, your C preprocessor defines the following symbols:"
23168         $cat Cppsym.true
23169         ccsymbols=''
23170         cppsymbols=`$cat Cppsym.true`
23171         cppsymbols=`echo $cppsymbols`
23172         cppccsymbols="$cppsymbols"
23173 else
23174         if $test -s ccsym.com; then
23175                 echo "Your C compiler and pre-processor define these symbols:"
23176                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
23177                 also='also '
23178                 symbols='ones'
23179                 cppccsymbols=`$cat ccsym.com`
23180                 cppccsymbols=`echo $cppccsymbols`
23181                 $test "$silent" || sleep 1
23182         fi
23183         if $test -s ccsym.cpp; then
23184                 $test "$also" && echo " "
23185                 echo "Your C pre-processor ${also}defines the following symbols:"
23186                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
23187                 also='further '
23188                 cppsymbols=`$cat ccsym.cpp`
23189                 cppsymbols=`echo $cppsymbols`
23190                 $test "$silent" || sleep 1
23191         fi
23192         if $test -s ccsym.own; then
23193                 $test "$also" && echo " "
23194                 echo "Your C compiler ${also}defines the following cpp symbols:"
23195                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
23196                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
23197                 ccsymbols=`$cat ccsym.own`
23198                 ccsymbols=`echo $ccsymbols`
23199                 $test "$silent" || sleep 1
23200         fi
23201 fi
23202
23203 : add -D_FORTIFY_SOURCE if feasible and not already there
23204 case "$gccversion" in
23205 [4567].*)       case "$optimize$ccflags" in
23206         *-O*)   case "$ccflags$cppsymbols" in
23207                 *_FORTIFY_SOURCE=*) # Don't add it again.
23208                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
23209                         ;;
23210                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
23211                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
23212                         ;;
23213                 esac
23214                 ;;
23215         *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
23216                 ;;
23217         esac
23218         ;;
23219 *)      echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
23220         ;;
23221 esac
23222
23223 : see if this is a termio system
23224 val="$undef"
23225 val2="$undef"
23226 val3="$undef"
23227 if $test `./findhdr termios.h`; then
23228     set tcsetattr i_termios
23229     eval $inlibc
23230     val3="$i_termios"
23231 fi
23232 echo " "
23233 case "$val3" in
23234     "$define") echo "You have POSIX termios.h... good!" >&4;;
23235     *)  if ./Cppsym pyr; then
23236             case "`$run /bin/universe`" in
23237                 ucb) if $test `./findhdr sgtty.h`; then
23238                         val2="$define"
23239                         echo "<sgtty.h> found." >&4
23240                     else
23241                         echo "System is pyramid with BSD universe."
23242                         ./warn "<sgtty.h> not found--you could have problems."
23243                     fi;;
23244                 *)  if $test `./findhdr termio.h`; then
23245                         val="$define"
23246                         echo "<termio.h> found." >&4
23247                     else
23248                         echo "System is pyramid with USG universe."
23249                         ./warn "<termio.h> not found--you could have problems."
23250                     fi;;
23251             esac
23252         elif ./usg; then
23253             if $test `./findhdr termio.h`; then
23254                 echo "<termio.h> found." >&4
23255                 val="$define"
23256             elif $test `./findhdr sgtty.h`; then
23257                 echo "<sgtty.h> found." >&4
23258                 val2="$define"
23259             else
23260                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23261             fi
23262         else
23263             if $test `./findhdr sgtty.h`; then
23264                 echo "<sgtty.h> found." >&4
23265                 val2="$define"
23266             elif $test `./findhdr termio.h`; then
23267                 echo "<termio.h> found." >&4
23268                 val="$define"
23269             else
23270                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23271             fi
23272         fi;;
23273 esac
23274 set i_termio; eval $setvar
23275 val=$val2; set i_sgtty; eval $setvar
23276 val=$val3; set i_termios; eval $setvar
23277
23278 : see if stdbool is available
23279 : we want a real compile instead of Inhdr because some Solaris systems
23280 : have stdbool.h, but it can only be used if the compiler indicates it
23281 : is sufficiently c99-compliant.
23282 echo " "
23283 $cat >try.c <<EOCP
23284 #include <stdio.h>
23285 #include <stdbool.h>
23286 int func(bool x)
23287 {
23288     return x ? 1 : 0;
23289 }
23290 int main(int argc, char **argv)
23291 {
23292     return func(0);
23293 }
23294 EOCP
23295 set try
23296 if eval $compile; then
23297         echo "<stdbool.h> found." >&4
23298         val="$define"
23299 else
23300         echo "<stdbool.h> NOT found." >&4
23301         val="$undef"
23302 fi
23303 $rm_try
23304 set i_stdbool
23305 eval $setvar
23306
23307 : see if stddef is available
23308 set stddef.h i_stddef
23309 eval $inhdr
23310
23311 : see if stdint is available
23312 set stdint.h i_stdint
23313 eval $inhdr
23314
23315 : see if sys/access.h is available
23316 set sys/access.h i_sysaccess
23317 eval $inhdr
23318
23319 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23320 set sys/filio.h i_sysfilio
23321 eval $inhdr
23322 echo " "
23323 if $test `./findhdr sys/ioctl.h`; then
23324         val="$define"
23325         echo '<sys/ioctl.h> found.' >&4
23326 else
23327         val="$undef"
23328         if $test $i_sysfilio = "$define"; then
23329             echo '<sys/ioctl.h> NOT found.' >&4
23330         else
23331                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23332                 $test $i_termio = "$define" && xxx="termio.h"
23333                 $test $i_termios = "$define" && xxx="termios.h"
23334 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23335         fi
23336 fi
23337 set i_sysioctl
23338 eval $setvar
23339
23340 : see if socket ioctl defs are in sys/sockio.h
23341 echo " "
23342 xxx=`./findhdr sys/sockio.h`
23343 if $test "$xxx"; then
23344         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23345                 val="$define"
23346                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23347         else
23348                 val="$undef"
23349                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23350         fi
23351 else
23352         val="$undef"
23353         $cat <<EOM
23354 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23355 EOM
23356 fi
23357 set i_syssockio
23358 eval $setvar
23359
23360 : see if this is a syslog.h system
23361 set syslog.h i_syslog
23362 eval $inhdr
23363
23364 : see if this is a sys/mode.h system
23365 set sys/mode.h i_sysmode
23366 eval $inhdr
23367
23368 : see if there is a sys/poll.h file
23369 set sys/poll.h i_syspoll
23370 eval $inhdr
23371
23372 : see if sys/resource.h has to be included
23373 set sys/resource.h i_sysresrc
23374 eval $inhdr
23375
23376 : see if sys/security.h is available
23377 set sys/security.h i_syssecrt
23378 eval $inhdr
23379
23380 : see if this is a sys/statvfs.h system
23381 set sys/statvfs.h i_sysstatvfs
23382 eval $inhdr
23383
23384 : see if this is a sys/un.h system
23385 set sys/un.h i_sysun
23386 eval $inhdr
23387
23388 : see if this is a sys/utsname.h system
23389 set sys/utsname.h i_sysutsname
23390 eval $inhdr
23391
23392 : see if this is a syswait system
23393 set sys/wait.h i_syswait
23394 eval $inhdr
23395
23396 : see if this is a ustat.h system
23397 set ustat.h i_ustat
23398 eval $inhdr
23399
23400 : see if this is an utime system
23401 set utime.h i_utime
23402 eval $inhdr
23403
23404 : see if this is a vfork system
23405 case "$d_vfork" in
23406 "$define")
23407         set vfork.h i_vfork
23408         eval $inhdr
23409         ;;
23410 *)
23411         i_vfork="$undef"
23412         ;;
23413 esac
23414
23415 : see if wchar.h is present
23416 set wchar.h i_wchar
23417 eval $inhdr
23418
23419 : Check extensions
23420 echo " "
23421 echo "Looking for extensions..." >&4
23422 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23423 : contain old or inaccurate or duplicate values.
23424 nonxs_extensions=''
23425 xs_extensions=''
23426 : We do not use find because it might not be available.
23427 : We do not just use MANIFEST because the user may have dropped
23428 : some additional extensions into the source tree and expect them
23429 : to be built.
23430
23431 : Function to recursively find available extensions, ignoring DynaLoader
23432 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23433 : In 5.10.1 and later, extensions are stored in directories
23434 : like File-Glob instead of the older File/Glob/.
23435 find_extensions='
23436     for xxx in *; do
23437         case "$xxx" in
23438             DynaLoader|dynaload) ;;
23439             *)
23440             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23441             case "$this_ext" in
23442                 Scalar/List/Utils) this_ext="List/Util" ;;
23443                 PathTools)         this_ext="Cwd"       ;;
23444             esac;
23445             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23446             if $contains " $this_ext " "$tdir/$$.tmp"; then
23447                 echo >&4;
23448                 echo "Duplicate directories detected for extension $xxx" >&4;
23449                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23450                 case "$knowitall" in
23451                 "") dflt=y;;
23452                 *) dflt=n;;
23453                 esac;
23454                 . ../UU/myread;
23455                 case "$ans" in
23456                 n*|N*) ;;
23457                 *) echo >&4;
23458                     echo "Ok.  Stopping Configure." >&4;
23459                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23460                     exit 1;;
23461                 esac;
23462                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23463             fi;
23464             $ls -1 "$xxx" > "$tdir/$$.tmp";
23465             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23466                 xs_extensions="$xs_extensions $this_ext";
23467             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
23468                 xs_extensions="$xs_extensions $this_ext";
23469             elif $test -d "$xxx"; then
23470                 nonxs_extensions="$nonxs_extensions $this_ext";
23471             fi;
23472             $rm -f "$tdir/$$.tmp";
23473             ;;
23474         esac;
23475     done'
23476 tdir=`pwd`
23477 cd "$rsrc/cpan"
23478 set X
23479 shift
23480 eval $find_extensions
23481 cd "$rsrc/dist"
23482 set X
23483 shift
23484 eval $find_extensions
23485 cd "$rsrc/ext"
23486 set X
23487 shift
23488 eval $find_extensions
23489 set X $xs_extensions
23490 shift
23491 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23492 set X $nonxs_extensions
23493 shift
23494 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23495 cd "$tdir"
23496 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23497
23498 : Now see which are supported on this system.
23499 avail_ext=''
23500 for xxx in $xs_extensions ; do
23501         case "$xxx" in
23502         Amiga*)
23503                 case "$osname" in
23504                 amigaos) avail_ext="$avail_ext $xxx" ;;
23505                 esac
23506                 ;;
23507         DB_File|db_file)
23508                 case "$i_db" in
23509                 $define) avail_ext="$avail_ext $xxx" ;;
23510                 esac
23511                 ;;
23512         GDBM_File|gdbm_fil)
23513                 case "$i_gdbm" in
23514                 $define) avail_ext="$avail_ext $xxx" ;;
23515                 esac
23516                 ;;
23517         I18N/Langinfo|i18n_lan)
23518                 case "$i_langinfo$d_nl_langinfo" in
23519                 $define$define) avail_ext="$avail_ext $xxx" ;;
23520                 esac
23521                 ;;
23522         IPC/SysV|ipc/sysv)
23523                 : XXX Do we need a useipcsysv variable here
23524                 case "${d_msg}${d_sem}${d_shm}" in
23525                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23526                 esac
23527                 ;;
23528         NDBM_File|ndbm_fil)
23529                 case "$d_ndbm" in
23530                 $define)
23531                     case "$osname-$use64bitint" in
23532                     hpux-define)
23533                         case "$libs" in
23534                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23535                         esac
23536                         ;;
23537                     *) avail_ext="$avail_ext $xxx" ;;
23538                     esac
23539                     ;;
23540                 esac
23541                 ;;
23542         ODBM_File|odbm_fil)
23543                 case "${i_dbm}${i_rpcsvcdbm}" in
23544                 *"${define}"*)
23545                     case "$d_cplusplus" in
23546                     define) ;; # delete as a function name will not work
23547                     *)  case "$osname-$use64bitint" in
23548                         hpux-define)
23549                             case "$libs" in
23550                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23551                             esac
23552                             ;;
23553                         *) avail_ext="$avail_ext $xxx" ;;
23554                         esac
23555                         ;;
23556                     esac
23557                     ;;
23558                 esac
23559                 ;;
23560         Opcode|opcode)
23561                 case "$useopcode" in
23562                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23563                 esac
23564                 ;;
23565         POSIX|posix)
23566                 case "$useposix" in
23567                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23568                 esac
23569                 ;;
23570         Socket|socket)
23571                 case "$d_socket" in
23572                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23573                 esac
23574                 ;;
23575         Sys/Syslog|sys/syslog)
23576                 case $osname in
23577                         amigaos) ;; # not really very useful on AmigaOS
23578                         *)
23579                         : XXX syslog requires socket
23580                         case "$d_socket" in
23581                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
23582                         esac
23583                         ;;
23584                 esac
23585                 ;;
23586         Thread|thread)
23587                 case "$usethreads" in
23588                 true|$define|y)
23589                         case "$use5005threads" in
23590                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23591                         esac
23592                 esac
23593                 ;;
23594         threads|threads/shared)
23595                 # threads and threads::shared are special cases.
23596                 # To stop people from asking "Perl 5.8.0 was supposed
23597                 # to have this new fancy threads implementation but my
23598                 # perl doesn't have it" and from people trying to
23599                 # (re)install the threads module using CPAN.pm and
23600                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23601                 # the threads.pm and threads/shared.pm will always be
23602                 # there, croaking informatively ("you need to rebuild
23603                 # all of Perl with threads, sorry") when threads haven't
23604                 # been compiled in.
23605                 # --jhi
23606                 avail_ext="$avail_ext $xxx"
23607                 ;;
23608         VMS*)
23609                 ;;
23610         Win32*)
23611                 case "$osname" in
23612                 cygwin) avail_ext="$avail_ext $xxx" ;;
23613                 esac
23614                 ;;
23615         XS/APItest|xs/apitest)
23616                 # This is just for testing.  Skip it unless we have dynamic loading.
23617
23618                 case "$usedl" in
23619                 $define) avail_ext="$avail_ext $xxx" ;;
23620                 esac
23621                 ;;
23622         XS/Typemap|xs/typemap)
23623                 # This is just for testing.  Skip it unless we have dynamic loading.
23624                 case "$usedl" in
23625                 $define) avail_ext="$avail_ext $xxx" ;;
23626                 esac
23627                 ;;
23628         *)      avail_ext="$avail_ext $xxx"
23629                 ;;
23630         esac
23631 done
23632
23633 set X $avail_ext
23634 shift
23635 avail_ext="$*"
23636
23637 case "$onlyextensions" in
23638 '') ;;
23639 *)  keepextensions=''
23640     echo "You have requested that only certain extensions be included..." >&4
23641     for i in $onlyextensions; do
23642         case " $avail_ext " in
23643         *" $i "*)
23644             echo "Keeping extension $i."
23645             keepextensions="$keepextensions $i"
23646             ;;
23647         *) echo "Ignoring extension $i." ;;
23648         esac
23649     done
23650     avail_ext="$keepextensions"
23651     ;;
23652 esac
23653
23654 case "$noextensions" in
23655 '') ;;
23656 *)  keepextensions=''
23657     echo "You have requested that certain extensions be ignored..." >&4
23658     for i in $avail_ext; do
23659         case " $noextensions " in
23660         *" $i "*) echo "Ignoring extension $i." ;;
23661         *) echo "Keeping extension $i.";
23662            keepextensions="$keepextensions $i"
23663            ;;
23664         esac
23665     done
23666     avail_ext="$keepextensions"
23667     ;;
23668 esac
23669
23670 : Now see which nonxs extensions are supported on this system.
23671 : For now assume all are.
23672 nonxs_ext=''
23673 for xxx in $nonxs_extensions ; do
23674         case "$xxx" in
23675         VMS*)
23676                 ;;
23677         *)      nonxs_ext="$nonxs_ext $xxx"
23678                 ;;
23679         esac
23680 done
23681
23682 set X $nonxs_ext
23683 shift
23684 nonxs_ext="$*"
23685
23686 case $usedl in
23687 $define)
23688         $cat <<EOM
23689 A number of extensions are supplied with $package.  You may choose to
23690 compile these extensions for dynamic loading (the default), compile
23691 them into the $package executable (static loading), or not include
23692 them at all.  Answer "none" to include no extensions.
23693 Note that DynaLoader is always built and need not be mentioned here.
23694
23695 EOM
23696         case "$dynamic_ext" in
23697         '')
23698                 : Exclude those listed in static_ext
23699                 dflt=''
23700                 for xxx in $avail_ext; do
23701                         case " $static_ext " in
23702                         *" $xxx "*) ;;
23703                         *) dflt="$dflt $xxx" ;;
23704                         esac
23705                 done
23706                 set X $dflt
23707                 shift
23708                 dflt="$*"
23709                 ;;
23710         *)      dflt="$dynamic_ext"
23711                 # Perhaps we are reusing an old out-of-date config.sh.
23712                 case "$hint" in
23713                 previous)
23714                         if test X"$dynamic_ext" != X"$avail_ext"; then
23715                                 $cat <<EOM
23716 NOTICE:  Your previous config.sh list may be incorrect.
23717 The extensions now available to you are
23718         ${avail_ext}
23719 but the default list from your previous config.sh is
23720         ${dynamic_ext}
23721
23722 EOM
23723                         fi
23724                         ;;
23725                 esac
23726                 ;;
23727         esac
23728         case "$dflt" in
23729         '')     dflt=none;;
23730         esac
23731         rp="What extensions do you wish to load dynamically?"
23732         . ./myread
23733         case "$ans" in
23734         none) dynamic_ext=' ' ;;
23735         *) dynamic_ext="$ans" ;;
23736         esac
23737
23738         case "$static_ext" in
23739         '')
23740                 : Exclude those already listed in dynamic linking
23741                 dflt=''
23742                 for xxx in $avail_ext; do
23743                         case " $dynamic_ext " in
23744                         *" $xxx "*) ;;
23745                         *) dflt="$dflt $xxx" ;;
23746                         esac
23747                 done
23748                 set X $dflt
23749                 shift
23750                 dflt="$*"
23751                 ;;
23752         *)  dflt="$static_ext"
23753                 ;;
23754         esac
23755
23756         case "$dflt" in
23757         '')     dflt=none;;
23758         esac
23759         rp="What extensions do you wish to load statically?"
23760         . ./myread
23761         case "$ans" in
23762         none) static_ext=' ' ;;
23763         *) static_ext="$ans" ;;
23764         esac
23765         ;;
23766 *)
23767         $cat <<EOM
23768 A number of extensions are supplied with $package.  Answer "none"
23769 to include no extensions.
23770 Note that DynaLoader is always built and need not be mentioned here.
23771
23772 EOM
23773         case "$static_ext" in
23774         '') dflt="$avail_ext" ;;
23775         *)      dflt="$static_ext"
23776                 # Perhaps we are reusing an old out-of-date config.sh.
23777                 case "$hint" in
23778                 previous)
23779                         if test X"$static_ext" != X"$avail_ext"; then
23780                                 $cat <<EOM
23781 NOTICE:  Your previous config.sh list may be incorrect.
23782 The extensions now available to you are
23783         ${avail_ext}
23784 but the default list from your previous config.sh is
23785         ${static_ext}
23786
23787 EOM
23788                         fi
23789                         ;;
23790                 esac
23791                 ;;
23792         esac
23793         : Exclude those that are not xs extensions
23794         case "$dflt" in
23795         '')     dflt=none;;
23796         esac
23797         rp="What extensions do you wish to include?"
23798         . ./myread
23799         case "$ans" in
23800         none) static_ext=' ' ;;
23801         *) static_ext="$ans" ;;
23802         esac
23803         ;;
23804 esac
23805 #
23806 # Encode is a special case.  If we are building Encode as a static
23807 # extension, we need to explicitly list its subextensions as well.
23808 # For other nested extensions, this is handled automatically by
23809 # the appropriate Makefile.PL.
23810 case " $static_ext " in
23811         *" Encode "*) # Add the subextensions of Encode
23812         cd "$rsrc/cpan"
23813         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23814                 static_ext="$static_ext Encode/$xxx"
23815                 known_extensions="$known_extensions Encode/$xxx"
23816         done
23817         cd "$tdir"
23818         ;;
23819 esac
23820
23821 set X $dynamic_ext $static_ext $nonxs_ext
23822 shift
23823 extensions="$*"
23824
23825 # Sanity check:  We require an extension suitable for use with
23826 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23827 # should show up as failures in the test suite, but it's helpful to
23828 # catch them now.) The 'extensions' list is normally sorted
23829 # alphabetically, so we need to accept either
23830 #    DB_File ... Fcntl ... IO  ....
23831 # or something like
23832 #    Fcntl ... NDBM_File ... IO  ....
23833 case " $extensions"  in
23834 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
23835 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23836 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23837 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23838    echo "WARNING: The Perl you are building will be quite crippled." >& 4
23839    ;;
23840 esac
23841
23842 : Remove libraries needed only for extensions
23843 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23844 : The exception is SunOS 4.x, which needs them.
23845 case "${osname}X${osvers}" in
23846 sunos*X4*)
23847     perllibs="$libs"
23848     ;;
23849 *) case "$usedl" in
23850     $define|true|[yY]*)
23851             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23852             shift
23853             perllibs="$*"
23854             ;;
23855     *)  perllibs="$libs"
23856             ;;
23857     esac
23858     ;;
23859 esac
23860
23861 : Remove build directory name from cppstdin so it can be used from
23862 : either the present location or the final installed location.
23863 echo " "
23864 : Get out of the UU directory to get correct path name.
23865 cd ..
23866 case "$cppstdin" in
23867 `pwd`/cppstdin)
23868         echo "Stripping down cppstdin path name"
23869         cppstdin=cppstdin
23870         ;;
23871 esac
23872 cd UU
23873
23874 : end of configuration questions
23875 echo " "
23876 echo "End of configuration questions."
23877 echo " "
23878
23879 : back to where it started
23880 if test -d ../UU; then
23881         cd ..
23882 fi
23883
23884 : configuration may be unconditionally patched via a 'config.arch' file
23885 if $test -f config.arch; then
23886         echo "I see a config.arch file, loading it." >&4
23887         . ./config.arch
23888 fi
23889
23890 : configuration may be patched via a 'config.over' file
23891 if $test -f config.over; then
23892         echo " "
23893         dflt=y
23894         rp='I see a config.over file.  Do you wish to load it?'
23895         . UU/myread
23896         case "$ans" in
23897         n*) echo "OK, I'll ignore it.";;
23898         *)      . ./config.over
23899                 echo "Configuration override changes have been loaded."
23900                 ;;
23901         esac
23902 fi
23903
23904 : in case they want portability, strip down executable paths
23905 case "$d_portable" in
23906 "$define")
23907         echo " "
23908         echo "Stripping down executable paths..." >&4
23909         for file in $loclist $trylist; do
23910                 eval temp=\$$file
23911                 eval $file=`basename $temp`
23912         done
23913         ;;
23914 esac
23915
23916 : create config.sh file
23917 echo " "
23918 echo "Creating config.sh..." >&4
23919 $spitshell <<EOT >config.sh
23920 $startsh
23921 #
23922 # This file was produced by running the Configure script. It holds all the
23923 # definitions figured out by Configure. Should you modify one of these values,
23924 # do not forget to propagate your changes by running "Configure -der". You may
23925 # instead choose to run each of the .SH files by yourself, or "Configure -S".
23926 #
23927
23928 # Package name      : $package
23929 # Source directory  : $src
23930 # Configuration time: $cf_time
23931 # Configured by     : $cf_by
23932 # Target system     : $myuname
23933
23934 EOT
23935 : Add in command line options if available
23936 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23937
23938 $spitshell <<EOT >>config.sh
23939
23940 Author='$Author'
23941 Date='$Date'
23942 Header='$Header'
23943 Id='$Id'
23944 Locker='$Locker'
23945 Log='$Log'
23946 RCSfile='$RCSfile'
23947 Revision='$Revision'
23948 Source='$Source'
23949 State='$State'
23950 _a='$_a'
23951 _exe='$_exe'
23952 _o='$_o'
23953 afs='$afs'
23954 afsroot='$afsroot'
23955 alignbytes='$alignbytes'
23956 aphostname='$aphostname'
23957 api_revision='$api_revision'
23958 api_subversion='$api_subversion'
23959 api_version='$api_version'
23960 api_versionstring='$api_versionstring'
23961 ar='$ar'
23962 archlib='$archlib'
23963 archlibexp='$archlibexp'
23964 archname64='$archname64'
23965 archname='$archname'
23966 archobjs='$archobjs'
23967 asctime_r_proto='$asctime_r_proto'
23968 awk='$awk'
23969 baserev='$baserev'
23970 bash='$bash'
23971 bin='$bin'
23972 bin_ELF='$bin_ELF'
23973 binexp='$binexp'
23974 bison='$bison'
23975 byacc='$byacc'
23976 byteorder='$byteorder'
23977 c='$c'
23978 castflags='$castflags'
23979 cat='$cat'
23980 cc='$cc'
23981 cccdlflags='$cccdlflags'
23982 ccdlflags='$ccdlflags'
23983 ccflags='$ccflags'
23984 ccflags_uselargefiles='$ccflags_uselargefiles'
23985 ccname='$ccname'
23986 ccsymbols='$ccsymbols'
23987 ccversion='$ccversion'
23988 cf_by='$cf_by'
23989 cf_email='$cf_email'
23990 cf_time='$cf_time'
23991 charbits='$charbits'
23992 charsize='$charsize'
23993 chgrp='$chgrp'
23994 chmod='$chmod'
23995 chown='$chown'
23996 clocktype='$clocktype'
23997 comm='$comm'
23998 compress='$compress'
23999 contains='$contains'
24000 cp='$cp'
24001 cpio='$cpio'
24002 cpp='$cpp'
24003 cpp_stuff='$cpp_stuff'
24004 cppccsymbols='$cppccsymbols'
24005 cppflags='$cppflags'
24006 cpplast='$cpplast'
24007 cppminus='$cppminus'
24008 cpprun='$cpprun'
24009 cppstdin='$cppstdin'
24010 cppsymbols='$cppsymbols'
24011 crypt_r_proto='$crypt_r_proto'
24012 cryptlib='$cryptlib'
24013 csh='$csh'
24014 ctermid_r_proto='$ctermid_r_proto'
24015 ctime_r_proto='$ctime_r_proto'
24016 d_Gconvert='$d_Gconvert'
24017 d_PRIEUldbl='$d_PRIEUldbl'
24018 d_PRIFUldbl='$d_PRIFUldbl'
24019 d_PRIGUldbl='$d_PRIGUldbl'
24020 d_PRIXU64='$d_PRIXU64'
24021 d_PRId64='$d_PRId64'
24022 d_PRIeldbl='$d_PRIeldbl'
24023 d_PRIfldbl='$d_PRIfldbl'
24024 d_PRIgldbl='$d_PRIgldbl'
24025 d_PRIi64='$d_PRIi64'
24026 d_PRIo64='$d_PRIo64'
24027 d_PRIu64='$d_PRIu64'
24028 d_PRIx64='$d_PRIx64'
24029 d_SCNfldbl='$d_SCNfldbl'
24030 d__fwalk='$d__fwalk'
24031 d_access='$d_access'
24032 d_accessx='$d_accessx'
24033 d_acosh='$d_acosh'
24034 d_aintl='$d_aintl'
24035 d_alarm='$d_alarm'
24036 d_archlib='$d_archlib'
24037 d_asctime64='$d_asctime64'
24038 d_asctime_r='$d_asctime_r'
24039 d_asinh='$d_asinh'
24040 d_atanh='$d_atanh'
24041 d_atolf='$d_atolf'
24042 d_atoll='$d_atoll'
24043 d_attribute_deprecated='$d_attribute_deprecated'
24044 d_attribute_format='$d_attribute_format'
24045 d_attribute_malloc='$d_attribute_malloc'
24046 d_attribute_nonnull='$d_attribute_nonnull'
24047 d_attribute_noreturn='$d_attribute_noreturn'
24048 d_attribute_pure='$d_attribute_pure'
24049 d_attribute_unused='$d_attribute_unused'
24050 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24051 d_backtrace='$d_backtrace'
24052 d_bsd='$d_bsd'
24053 d_bsdgetpgrp='$d_bsdgetpgrp'
24054 d_bsdsetpgrp='$d_bsdsetpgrp'
24055 d_builtin_add_overflow='$d_builtin_add_overflow'
24056 d_builtin_choose_expr='$d_builtin_choose_expr'
24057 d_builtin_expect='$d_builtin_expect'
24058 d_builtin_mul_overflow='$d_builtin_mul_overflow'
24059 d_builtin_sub_overflow='$d_builtin_sub_overflow'
24060 d_c99_variadic_macros='$d_c99_variadic_macros'
24061 d_casti32='$d_casti32'
24062 d_castneg='$d_castneg'
24063 d_cbrt='$d_cbrt'
24064 d_chown='$d_chown'
24065 d_chroot='$d_chroot'
24066 d_chsize='$d_chsize'
24067 d_class='$d_class'
24068 d_clearenv='$d_clearenv'
24069 d_closedir='$d_closedir'
24070 d_cmsghdr_s='$d_cmsghdr_s'
24071 d_const='$d_const'
24072 d_copysign='$d_copysign'
24073 d_copysignl='$d_copysignl'
24074 d_cplusplus='$d_cplusplus'
24075 d_crypt='$d_crypt'
24076 d_crypt_r='$d_crypt_r'
24077 d_csh='$d_csh'
24078 d_ctermid='$d_ctermid'
24079 d_ctermid_r='$d_ctermid_r'
24080 d_ctime64='$d_ctime64'
24081 d_ctime_r='$d_ctime_r'
24082 d_cuserid='$d_cuserid'
24083 d_dbl_dig='$d_dbl_dig'
24084 d_dbminitproto='$d_dbminitproto'
24085 d_difftime64='$d_difftime64'
24086 d_difftime='$d_difftime'
24087 d_dir_dd_fd='$d_dir_dd_fd'
24088 d_dirfd='$d_dirfd'
24089 d_dirnamlen='$d_dirnamlen'
24090 d_dladdr='$d_dladdr'
24091 d_dlerror='$d_dlerror'
24092 d_dlopen='$d_dlopen'
24093 d_dlsymun='$d_dlsymun'
24094 d_dosuid='$d_dosuid'
24095 d_double_has_inf='$d_double_has_inf'
24096 d_double_has_nan='$d_double_has_nan'
24097 d_double_has_negative_zero='$d_double_has_negative_zero'
24098 d_double_has_subnormals='$d_double_has_subnormals'
24099 d_double_style_cray='$d_double_style_cray'
24100 d_double_style_ibm='$d_double_style_ibm'
24101 d_double_style_ieee='$d_double_style_ieee'
24102 d_double_style_vax='$d_double_style_vax'
24103 d_drand48_r='$d_drand48_r'
24104 d_drand48proto='$d_drand48proto'
24105 d_dup2='$d_dup2'
24106 d_duplocale='$d_duplocale'
24107 d_eaccess='$d_eaccess'
24108 d_endgrent='$d_endgrent'
24109 d_endgrent_r='$d_endgrent_r'
24110 d_endhent='$d_endhent'
24111 d_endhostent_r='$d_endhostent_r'
24112 d_endnent='$d_endnent'
24113 d_endnetent_r='$d_endnetent_r'
24114 d_endpent='$d_endpent'
24115 d_endprotoent_r='$d_endprotoent_r'
24116 d_endpwent='$d_endpwent'
24117 d_endpwent_r='$d_endpwent_r'
24118 d_endsent='$d_endsent'
24119 d_endservent_r='$d_endservent_r'
24120 d_eofnblk='$d_eofnblk'
24121 d_erf='$d_erf'
24122 d_erfc='$d_erfc'
24123 d_eunice='$d_eunice'
24124 d_exp2='$d_exp2'
24125 d_expm1='$d_expm1'
24126 d_faststdio='$d_faststdio'
24127 d_fchdir='$d_fchdir'
24128 d_fchmod='$d_fchmod'
24129 d_fchmodat='$d_fchmodat'
24130 d_fchown='$d_fchown'
24131 d_fcntl='$d_fcntl'
24132 d_fcntl_can_lock='$d_fcntl_can_lock'
24133 d_fd_macros='$d_fd_macros'
24134 d_fd_set='$d_fd_set'
24135 d_fdclose='$d_fdclose'
24136 d_fdim='$d_fdim'
24137 d_fds_bits='$d_fds_bits'
24138 d_fegetround='$d_fegetround'
24139 d_fgetpos='$d_fgetpos'
24140 d_finite='$d_finite'
24141 d_finitel='$d_finitel'
24142 d_flexfnam='$d_flexfnam'
24143 d_flock='$d_flock'
24144 d_flockproto='$d_flockproto'
24145 d_fma='$d_fma'
24146 d_fmax='$d_fmax'
24147 d_fmin='$d_fmin'
24148 d_fork='$d_fork'
24149 d_fp_class='$d_fp_class'
24150 d_fp_classify='$d_fp_classify'
24151 d_fp_classl='$d_fp_classl'
24152 d_fpathconf='$d_fpathconf'
24153 d_fpclass='$d_fpclass'
24154 d_fpclassify='$d_fpclassify'
24155 d_fpclassl='$d_fpclassl'
24156 d_fpgetround='$d_fpgetround'
24157 d_fpos64_t='$d_fpos64_t'
24158 d_freelocale='$d_freelocale'
24159 d_frexpl='$d_frexpl'
24160 d_fs_data_s='$d_fs_data_s'
24161 d_fseeko='$d_fseeko'
24162 d_fsetpos='$d_fsetpos'
24163 d_fstatfs='$d_fstatfs'
24164 d_fstatvfs='$d_fstatvfs'
24165 d_fsync='$d_fsync'
24166 d_ftello='$d_ftello'
24167 d_ftime='$d_ftime'
24168 d_futimes='$d_futimes'
24169 d_gai_strerror='$d_gai_strerror'
24170 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
24171 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
24172 d_getaddrinfo='$d_getaddrinfo'
24173 d_getcwd='$d_getcwd'
24174 d_getespwnam='$d_getespwnam'
24175 d_getfsstat='$d_getfsstat'
24176 d_getgrent='$d_getgrent'
24177 d_getgrent_r='$d_getgrent_r'
24178 d_getgrgid_r='$d_getgrgid_r'
24179 d_getgrnam_r='$d_getgrnam_r'
24180 d_getgrps='$d_getgrps'
24181 d_gethbyaddr='$d_gethbyaddr'
24182 d_gethbyname='$d_gethbyname'
24183 d_gethent='$d_gethent'
24184 d_gethname='$d_gethname'
24185 d_gethostbyaddr_r='$d_gethostbyaddr_r'
24186 d_gethostbyname_r='$d_gethostbyname_r'
24187 d_gethostent_r='$d_gethostent_r'
24188 d_gethostprotos='$d_gethostprotos'
24189 d_getitimer='$d_getitimer'
24190 d_getlogin='$d_getlogin'
24191 d_getlogin_r='$d_getlogin_r'
24192 d_getmnt='$d_getmnt'
24193 d_getmntent='$d_getmntent'
24194 d_getnameinfo='$d_getnameinfo'
24195 d_getnbyaddr='$d_getnbyaddr'
24196 d_getnbyname='$d_getnbyname'
24197 d_getnent='$d_getnent'
24198 d_getnetbyaddr_r='$d_getnetbyaddr_r'
24199 d_getnetbyname_r='$d_getnetbyname_r'
24200 d_getnetent_r='$d_getnetent_r'
24201 d_getnetprotos='$d_getnetprotos'
24202 d_getpagsz='$d_getpagsz'
24203 d_getpbyname='$d_getpbyname'
24204 d_getpbynumber='$d_getpbynumber'
24205 d_getpent='$d_getpent'
24206 d_getpgid='$d_getpgid'
24207 d_getpgrp2='$d_getpgrp2'
24208 d_getpgrp='$d_getpgrp'
24209 d_getppid='$d_getppid'
24210 d_getprior='$d_getprior'
24211 d_getprotobyname_r='$d_getprotobyname_r'
24212 d_getprotobynumber_r='$d_getprotobynumber_r'
24213 d_getprotoent_r='$d_getprotoent_r'
24214 d_getprotoprotos='$d_getprotoprotos'
24215 d_getprpwnam='$d_getprpwnam'
24216 d_getpwent='$d_getpwent'
24217 d_getpwent_r='$d_getpwent_r'
24218 d_getpwnam_r='$d_getpwnam_r'
24219 d_getpwuid_r='$d_getpwuid_r'
24220 d_getsbyname='$d_getsbyname'
24221 d_getsbyport='$d_getsbyport'
24222 d_getsent='$d_getsent'
24223 d_getservbyname_r='$d_getservbyname_r'
24224 d_getservbyport_r='$d_getservbyport_r'
24225 d_getservent_r='$d_getservent_r'
24226 d_getservprotos='$d_getservprotos'
24227 d_getspnam='$d_getspnam'
24228 d_getspnam_r='$d_getspnam_r'
24229 d_gettimeod='$d_gettimeod'
24230 d_gmtime64='$d_gmtime64'
24231 d_gmtime_r='$d_gmtime_r'
24232 d_gnulibc='$d_gnulibc'
24233 d_grpasswd='$d_grpasswd'
24234 d_hasmntopt='$d_hasmntopt'
24235 d_htonl='$d_htonl'
24236 d_hypot='$d_hypot'
24237 d_ilogb='$d_ilogb'
24238 d_ilogbl='$d_ilogbl'
24239 d_inc_version_list='$d_inc_version_list'
24240 d_index='$d_index'
24241 d_inetaton='$d_inetaton'
24242 d_inetntop='$d_inetntop'
24243 d_inetpton='$d_inetpton'
24244 d_int64_t='$d_int64_t'
24245 d_ip_mreq='$d_ip_mreq'
24246 d_ip_mreq_source='$d_ip_mreq_source'
24247 d_ipv6_mreq='$d_ipv6_mreq'
24248 d_ipv6_mreq_source='$d_ipv6_mreq_source'
24249 d_isascii='$d_isascii'
24250 d_isblank='$d_isblank'
24251 d_isfinite='$d_isfinite'
24252 d_isfinitel='$d_isfinitel'
24253 d_isinf='$d_isinf'
24254 d_isinfl='$d_isinfl'
24255 d_isless='$d_isless'
24256 d_isnan='$d_isnan'
24257 d_isnanl='$d_isnanl'
24258 d_isnormal='$d_isnormal'
24259 d_j0='$d_j0'
24260 d_j0l='$d_j0l'
24261 d_killpg='$d_killpg'
24262 d_lc_monetary_2008='$d_lc_monetary_2008'
24263 d_lchown='$d_lchown'
24264 d_ldbl_dig='$d_ldbl_dig'
24265 d_ldexpl='$d_ldexpl'
24266 d_lgamma='$d_lgamma'
24267 d_lgamma_r='$d_lgamma_r'
24268 d_libm_lib_version='$d_libm_lib_version'
24269 d_libname_unique='$d_libname_unique'
24270 d_link='$d_link'
24271 d_linkat='$d_linkat'
24272 d_llrint='$d_llrint'
24273 d_llrintl='$d_llrintl'
24274 d_llround='$d_llround'
24275 d_llroundl='$d_llroundl'
24276 d_localeconv_l='$d_localeconv_l'
24277 d_localtime64='$d_localtime64'
24278 d_localtime_r='$d_localtime_r'
24279 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24280 d_locconv='$d_locconv'
24281 d_lockf='$d_lockf'
24282 d_log1p='$d_log1p'
24283 d_log2='$d_log2'
24284 d_logb='$d_logb'
24285 d_long_double_style_ieee='$d_long_double_style_ieee'
24286 d_long_double_style_ieee_doubledouble='$d_long_double_style_ieee_doubledouble'
24287 d_long_double_style_ieee_extended='$d_long_double_style_ieee_extended'
24288 d_long_double_style_ieee_std='$d_long_double_style_ieee_std'
24289 d_long_double_style_vax='$d_long_double_style_vax'
24290 d_longdbl='$d_longdbl'
24291 d_longlong='$d_longlong'
24292 d_lrint='$d_lrint'
24293 d_lrintl='$d_lrintl'
24294 d_lround='$d_lround'
24295 d_lroundl='$d_lroundl'
24296 d_lseekproto='$d_lseekproto'
24297 d_lstat='$d_lstat'
24298 d_madvise='$d_madvise'
24299 d_malloc_good_size='$d_malloc_good_size'
24300 d_malloc_size='$d_malloc_size'
24301 d_mblen='$d_mblen'
24302 d_mbrlen='$d_mbrlen'
24303 d_mbrtowc='$d_mbrtowc'
24304 d_mbstowcs='$d_mbstowcs'
24305 d_mbtowc='$d_mbtowc'
24306 d_memmem='$d_memmem'
24307 d_memrchr='$d_memrchr'
24308 d_mkdir='$d_mkdir'
24309 d_mkdtemp='$d_mkdtemp'
24310 d_mkfifo='$d_mkfifo'
24311 d_mkstemp='$d_mkstemp'
24312 d_mkstemps='$d_mkstemps'
24313 d_mktime64='$d_mktime64'
24314 d_mktime='$d_mktime'
24315 d_mmap='$d_mmap'
24316 d_modfl='$d_modfl'
24317 d_modflproto='$d_modflproto'
24318 d_mprotect='$d_mprotect'
24319 d_msg='$d_msg'
24320 d_msg_ctrunc='$d_msg_ctrunc'
24321 d_msg_dontroute='$d_msg_dontroute'
24322 d_msg_oob='$d_msg_oob'
24323 d_msg_peek='$d_msg_peek'
24324 d_msg_proxy='$d_msg_proxy'
24325 d_msgctl='$d_msgctl'
24326 d_msgget='$d_msgget'
24327 d_msghdr_s='$d_msghdr_s'
24328 d_msgrcv='$d_msgrcv'
24329 d_msgsnd='$d_msgsnd'
24330 d_msync='$d_msync'
24331 d_munmap='$d_munmap'
24332 d_mymalloc='$d_mymalloc'
24333 d_nan='$d_nan'
24334 d_nanosleep='$d_nanosleep'
24335 d_ndbm='$d_ndbm'
24336 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24337 d_nearbyint='$d_nearbyint'
24338 d_newlocale='$d_newlocale'
24339 d_nextafter='$d_nextafter'
24340 d_nexttoward='$d_nexttoward'
24341 d_nice='$d_nice'
24342 d_nl_langinfo='$d_nl_langinfo'
24343 d_nv_preserves_uv='$d_nv_preserves_uv'
24344 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24345 d_off64_t='$d_off64_t'
24346 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24347 d_oldpthreads='$d_oldpthreads'
24348 d_oldsock='$d_oldsock'
24349 d_open3='$d_open3'
24350 d_openat='$d_openat'
24351 d_pathconf='$d_pathconf'
24352 d_pause='$d_pause'
24353 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24354 d_phostname='$d_phostname'
24355 d_pipe='$d_pipe'
24356 d_poll='$d_poll'
24357 d_portable='$d_portable'
24358 d_prctl='$d_prctl'
24359 d_prctl_set_name='$d_prctl_set_name'
24360 d_printf_format_null='$d_printf_format_null'
24361 d_procselfexe='$d_procselfexe'
24362 d_pseudofork='$d_pseudofork'
24363 d_pthread_atfork='$d_pthread_atfork'
24364 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24365 d_pthread_yield='$d_pthread_yield'
24366 d_ptrdiff_t='$d_ptrdiff_t'
24367 d_pwage='$d_pwage'
24368 d_pwchange='$d_pwchange'
24369 d_pwclass='$d_pwclass'
24370 d_pwcomment='$d_pwcomment'
24371 d_pwexpire='$d_pwexpire'
24372 d_pwgecos='$d_pwgecos'
24373 d_pwpasswd='$d_pwpasswd'
24374 d_pwquota='$d_pwquota'
24375 d_qgcvt='$d_qgcvt'
24376 d_quad='$d_quad'
24377 d_querylocale='$d_querylocale'
24378 d_random_r='$d_random_r'
24379 d_re_comp='$d_re_comp'
24380 d_readdir64_r='$d_readdir64_r'
24381 d_readdir='$d_readdir'
24382 d_readdir_r='$d_readdir_r'
24383 d_readlink='$d_readlink'
24384 d_readv='$d_readv'
24385 d_recvmsg='$d_recvmsg'
24386 d_regcmp='$d_regcmp'
24387 d_regcomp='$d_regcomp'
24388 d_remainder='$d_remainder'
24389 d_remquo='$d_remquo'
24390 d_rename='$d_rename'
24391 d_renameat='$d_renameat'
24392 d_rewinddir='$d_rewinddir'
24393 d_rint='$d_rint'
24394 d_rmdir='$d_rmdir'
24395 d_round='$d_round'
24396 d_sbrkproto='$d_sbrkproto'
24397 d_scalbn='$d_scalbn'
24398 d_scalbnl='$d_scalbnl'
24399 d_sched_yield='$d_sched_yield'
24400 d_scm_rights='$d_scm_rights'
24401 d_seekdir='$d_seekdir'
24402 d_select='$d_select'
24403 d_sem='$d_sem'
24404 d_semctl='$d_semctl'
24405 d_semctl_semid_ds='$d_semctl_semid_ds'
24406 d_semctl_semun='$d_semctl_semun'
24407 d_semget='$d_semget'
24408 d_semop='$d_semop'
24409 d_sendmsg='$d_sendmsg'
24410 d_setegid='$d_setegid'
24411 d_seteuid='$d_seteuid'
24412 d_setgrent='$d_setgrent'
24413 d_setgrent_r='$d_setgrent_r'
24414 d_setgrps='$d_setgrps'
24415 d_sethent='$d_sethent'
24416 d_sethostent_r='$d_sethostent_r'
24417 d_setitimer='$d_setitimer'
24418 d_setlinebuf='$d_setlinebuf'
24419 d_setlocale='$d_setlocale'
24420 d_setlocale_r='$d_setlocale_r'
24421 d_setnent='$d_setnent'
24422 d_setnetent_r='$d_setnetent_r'
24423 d_setpent='$d_setpent'
24424 d_setpgid='$d_setpgid'
24425 d_setpgrp2='$d_setpgrp2'
24426 d_setpgrp='$d_setpgrp'
24427 d_setprior='$d_setprior'
24428 d_setproctitle='$d_setproctitle'
24429 d_setprotoent_r='$d_setprotoent_r'
24430 d_setpwent='$d_setpwent'
24431 d_setpwent_r='$d_setpwent_r'
24432 d_setregid='$d_setregid'
24433 d_setresgid='$d_setresgid'
24434 d_setresuid='$d_setresuid'
24435 d_setreuid='$d_setreuid'
24436 d_setrgid='$d_setrgid'
24437 d_setruid='$d_setruid'
24438 d_setsent='$d_setsent'
24439 d_setservent_r='$d_setservent_r'
24440 d_setsid='$d_setsid'
24441 d_setvbuf='$d_setvbuf'
24442 d_shm='$d_shm'
24443 d_shmat='$d_shmat'
24444 d_shmatprototype='$d_shmatprototype'
24445 d_shmctl='$d_shmctl'
24446 d_shmdt='$d_shmdt'
24447 d_shmget='$d_shmget'
24448 d_sigaction='$d_sigaction'
24449 d_siginfo_si_addr='$d_siginfo_si_addr'
24450 d_siginfo_si_band='$d_siginfo_si_band'
24451 d_siginfo_si_errno='$d_siginfo_si_errno'
24452 d_siginfo_si_fd='$d_siginfo_si_fd'
24453 d_siginfo_si_pid='$d_siginfo_si_pid'
24454 d_siginfo_si_status='$d_siginfo_si_status'
24455 d_siginfo_si_uid='$d_siginfo_si_uid'
24456 d_siginfo_si_value='$d_siginfo_si_value'
24457 d_signbit='$d_signbit'
24458 d_sigprocmask='$d_sigprocmask'
24459 d_sigsetjmp='$d_sigsetjmp'
24460 d_sin6_scope_id='$d_sin6_scope_id'
24461 d_sitearch='$d_sitearch'
24462 d_sockaddr_in6='$d_sockaddr_in6'
24463 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24464 d_sockatmark='$d_sockatmark'
24465 d_sockatmarkproto='$d_sockatmarkproto'
24466 d_socket='$d_socket'
24467 d_socklen_t='$d_socklen_t'
24468 d_sockpair='$d_sockpair'
24469 d_socks5_init='$d_socks5_init'
24470 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
24471 d_sqrtl='$d_sqrtl'
24472 d_srand48_r='$d_srand48_r'
24473 d_srandom_r='$d_srandom_r'
24474 d_sresgproto='$d_sresgproto'
24475 d_sresuproto='$d_sresuproto'
24476 d_stat='$d_stat'
24477 d_statblks='$d_statblks'
24478 d_statfs_f_flags='$d_statfs_f_flags'
24479 d_statfs_s='$d_statfs_s'
24480 d_static_inline='$d_static_inline'
24481 d_statvfs='$d_statvfs'
24482 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24483 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24484 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24485 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24486 d_stdio_stream_array='$d_stdio_stream_array'
24487 d_stdiobase='$d_stdiobase'
24488 d_stdstdio='$d_stdstdio'
24489 d_strchr='$d_strchr'
24490 d_strcoll='$d_strcoll'
24491 d_strerrm='$d_strerrm'
24492 d_strerror='$d_strerror'
24493 d_strerror_l='$d_strerror_l'
24494 d_strerror_r='$d_strerror_r'
24495 d_strftime='$d_strftime'
24496 d_strlcat='$d_strlcat'
24497 d_strlcpy='$d_strlcpy'
24498 d_strnlen='$d_strnlen'
24499 d_strtod='$d_strtod'
24500 d_strtol='$d_strtol'
24501 d_strtold='$d_strtold'
24502 d_strtold_l='$d_strtold_l'
24503 d_strtoll='$d_strtoll'
24504 d_strtoq='$d_strtoq'
24505 d_strtoul='$d_strtoul'
24506 d_strtoull='$d_strtoull'
24507 d_strtouq='$d_strtouq'
24508 d_strxfrm='$d_strxfrm'
24509 d_suidsafe='$d_suidsafe'
24510 d_symlink='$d_symlink'
24511 d_syscall='$d_syscall'
24512 d_syscallproto='$d_syscallproto'
24513 d_sysconf='$d_sysconf'
24514 d_sysernlst='$d_sysernlst'
24515 d_syserrlst='$d_syserrlst'
24516 d_system='$d_system'
24517 d_tcgetpgrp='$d_tcgetpgrp'
24518 d_tcsetpgrp='$d_tcsetpgrp'
24519 d_telldir='$d_telldir'
24520 d_telldirproto='$d_telldirproto'
24521 d_tgamma='$d_tgamma'
24522 d_thread_safe_nl_langinfo_l='$d_thread_safe_nl_langinfo_l'
24523 d_time='$d_time'
24524 d_timegm='$d_timegm'
24525 d_times='$d_times'
24526 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24527 d_tm_tm_zone='$d_tm_tm_zone'
24528 d_tmpnam_r='$d_tmpnam_r'
24529 d_trunc='$d_trunc'
24530 d_truncate='$d_truncate'
24531 d_truncl='$d_truncl'
24532 d_ttyname_r='$d_ttyname_r'
24533 d_tzname='$d_tzname'
24534 d_u32align='$d_u32align'
24535 d_ualarm='$d_ualarm'
24536 d_umask='$d_umask'
24537 d_uname='$d_uname'
24538 d_union_semun='$d_union_semun'
24539 d_unlinkat='$d_unlinkat'
24540 d_unordered='$d_unordered'
24541 d_unsetenv='$d_unsetenv'
24542 d_uselocale='$d_uselocale'
24543 d_usleep='$d_usleep'
24544 d_usleepproto='$d_usleepproto'
24545 d_ustat='$d_ustat'
24546 d_vendorarch='$d_vendorarch'
24547 d_vendorbin='$d_vendorbin'
24548 d_vendorlib='$d_vendorlib'
24549 d_vendorscript='$d_vendorscript'
24550 d_vfork='$d_vfork'
24551 d_void_closedir='$d_void_closedir'
24552 d_voidsig='$d_voidsig'
24553 d_voidtty='$d_voidtty'
24554 d_wait4='$d_wait4'
24555 d_waitpid='$d_waitpid'
24556 d_wcscmp='$d_wcscmp'
24557 d_wcstombs='$d_wcstombs'
24558 d_wcsxfrm='$d_wcsxfrm'
24559 d_wctomb='$d_wctomb'
24560 d_writev='$d_writev'
24561 d_xenix='$d_xenix'
24562 date='$date'
24563 db_hashtype='$db_hashtype'
24564 db_prefixtype='$db_prefixtype'
24565 db_version_major='$db_version_major'
24566 db_version_minor='$db_version_minor'
24567 db_version_patch='$db_version_patch'
24568 default_inc_excludes_dot='$default_inc_excludes_dot'
24569 direntrytype='$direntrytype'
24570 dlext='$dlext'
24571 dlsrc='$dlsrc'
24572 doubleinfbytes='$doubleinfbytes'
24573 doublekind='$doublekind'
24574 doublemantbits='$doublemantbits'
24575 doublenanbytes='$doublenanbytes'
24576 doublesize='$doublesize'
24577 drand01='$drand01'
24578 drand48_r_proto='$drand48_r_proto'
24579 dtrace='$dtrace'
24580 dtraceobject='$dtraceobject'
24581 dtracexnolibs='$dtracexnolibs'
24582 dynamic_ext='$dynamic_ext'
24583 eagain='$eagain'
24584 ebcdic='$ebcdic'
24585 echo='$echo'
24586 egrep='$egrep'
24587 emacs='$emacs'
24588 endgrent_r_proto='$endgrent_r_proto'
24589 endhostent_r_proto='$endhostent_r_proto'
24590 endnetent_r_proto='$endnetent_r_proto'
24591 endprotoent_r_proto='$endprotoent_r_proto'
24592 endpwent_r_proto='$endpwent_r_proto'
24593 endservent_r_proto='$endservent_r_proto'
24594 eunicefix='$eunicefix'
24595 exe_ext='$exe_ext'
24596 expr='$expr'
24597 extensions='$extensions'
24598 extern_C='$extern_C'
24599 extras='$extras'
24600 fflushNULL='$fflushNULL'
24601 fflushall='$fflushall'
24602 find='$find'
24603 firstmakefile='$firstmakefile'
24604 flex='$flex'
24605 fpossize='$fpossize'
24606 fpostype='$fpostype'
24607 freetype='$freetype'
24608 from='$from'
24609 full_ar='$full_ar'
24610 full_csh='$full_csh'
24611 full_sed='$full_sed'
24612 gccansipedantic='$gccansipedantic'
24613 gccosandvers='$gccosandvers'
24614 gccversion='$gccversion'
24615 getgrent_r_proto='$getgrent_r_proto'
24616 getgrgid_r_proto='$getgrgid_r_proto'
24617 getgrnam_r_proto='$getgrnam_r_proto'
24618 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24619 gethostbyname_r_proto='$gethostbyname_r_proto'
24620 gethostent_r_proto='$gethostent_r_proto'
24621 getlogin_r_proto='$getlogin_r_proto'
24622 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24623 getnetbyname_r_proto='$getnetbyname_r_proto'
24624 getnetent_r_proto='$getnetent_r_proto'
24625 getprotobyname_r_proto='$getprotobyname_r_proto'
24626 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24627 getprotoent_r_proto='$getprotoent_r_proto'
24628 getpwent_r_proto='$getpwent_r_proto'
24629 getpwnam_r_proto='$getpwnam_r_proto'
24630 getpwuid_r_proto='$getpwuid_r_proto'
24631 getservbyname_r_proto='$getservbyname_r_proto'
24632 getservbyport_r_proto='$getservbyport_r_proto'
24633 getservent_r_proto='$getservent_r_proto'
24634 getspnam_r_proto='$getspnam_r_proto'
24635 gidformat='$gidformat'
24636 gidsign='$gidsign'
24637 gidsize='$gidsize'
24638 gidtype='$gidtype'
24639 glibpth='$glibpth'
24640 gmake='$gmake'
24641 gmtime_r_proto='$gmtime_r_proto'
24642 gnulibc_version='$gnulibc_version'
24643 grep='$grep'
24644 groupcat='$groupcat'
24645 groupstype='$groupstype'
24646 gzip='$gzip'
24647 h_fcntl='$h_fcntl'
24648 h_sysfile='$h_sysfile'
24649 hint='$hint'
24650 hostcat='$hostcat'
24651 hostgenerate='$hostgenerate'
24652 hostosname='$hostosname'
24653 hostperl='$hostperl'
24654 html1dir='$html1dir'
24655 html1direxp='$html1direxp'
24656 html3dir='$html3dir'
24657 html3direxp='$html3direxp'
24658 i16size='$i16size'
24659 i16type='$i16type'
24660 i32size='$i32size'
24661 i32type='$i32type'
24662 i64size='$i64size'
24663 i64type='$i64type'
24664 i8size='$i8size'
24665 i8type='$i8type'
24666 i_arpainet='$i_arpainet'
24667 i_assert='$i_assert'
24668 i_bfd='$i_bfd'
24669 i_bsdioctl='$i_bsdioctl'
24670 i_crypt='$i_crypt'
24671 i_db='$i_db'
24672 i_dbm='$i_dbm'
24673 i_dirent='$i_dirent'
24674 i_dlfcn='$i_dlfcn'
24675 i_execinfo='$i_execinfo'
24676 i_fcntl='$i_fcntl'
24677 i_fenv='$i_fenv'
24678 i_float='$i_float'
24679 i_fp='$i_fp'
24680 i_fp_class='$i_fp_class'
24681 i_gdbm='$i_gdbm'
24682 i_gdbm_ndbm='$i_gdbm_ndbm'
24683 i_gdbmndbm='$i_gdbmndbm'
24684 i_grp='$i_grp'
24685 i_ieeefp='$i_ieeefp'
24686 i_inttypes='$i_inttypes'
24687 i_langinfo='$i_langinfo'
24688 i_libutil='$i_libutil'
24689 i_limits='$i_limits'
24690 i_locale='$i_locale'
24691 i_machcthr='$i_machcthr'
24692 i_malloc='$i_malloc'
24693 i_mallocmalloc='$i_mallocmalloc'
24694 i_math='$i_math'
24695 i_memory='$i_memory'
24696 i_mntent='$i_mntent'
24697 i_ndbm='$i_ndbm'
24698 i_netdb='$i_netdb'
24699 i_neterrno='$i_neterrno'
24700 i_netinettcp='$i_netinettcp'
24701 i_niin='$i_niin'
24702 i_poll='$i_poll'
24703 i_prot='$i_prot'
24704 i_pthread='$i_pthread'
24705 i_pwd='$i_pwd'
24706 i_quadmath='$i_quadmath'
24707 i_rpcsvcdbm='$i_rpcsvcdbm'
24708 i_sgtty='$i_sgtty'
24709 i_shadow='$i_shadow'
24710 i_socks='$i_socks'
24711 i_stdbool='$i_stdbool'
24712 i_stddef='$i_stddef'
24713 i_stdint='$i_stdint'
24714 i_stdlib='$i_stdlib'
24715 i_string='$i_string'
24716 i_sunmath='$i_sunmath'
24717 i_sysaccess='$i_sysaccess'
24718 i_sysdir='$i_sysdir'
24719 i_sysfile='$i_sysfile'
24720 i_sysfilio='$i_sysfilio'
24721 i_sysin='$i_sysin'
24722 i_sysioctl='$i_sysioctl'
24723 i_syslog='$i_syslog'
24724 i_sysmman='$i_sysmman'
24725 i_sysmode='$i_sysmode'
24726 i_sysmount='$i_sysmount'
24727 i_sysndir='$i_sysndir'
24728 i_sysparam='$i_sysparam'
24729 i_syspoll='$i_syspoll'
24730 i_sysresrc='$i_sysresrc'
24731 i_syssecrt='$i_syssecrt'
24732 i_sysselct='$i_sysselct'
24733 i_syssockio='$i_syssockio'
24734 i_sysstat='$i_sysstat'
24735 i_sysstatfs='$i_sysstatfs'
24736 i_sysstatvfs='$i_sysstatvfs'
24737 i_systime='$i_systime'
24738 i_systimek='$i_systimek'
24739 i_systimes='$i_systimes'
24740 i_systypes='$i_systypes'
24741 i_sysuio='$i_sysuio'
24742 i_sysun='$i_sysun'
24743 i_sysutsname='$i_sysutsname'
24744 i_sysvfs='$i_sysvfs'
24745 i_syswait='$i_syswait'
24746 i_termio='$i_termio'
24747 i_termios='$i_termios'
24748 i_time='$i_time'
24749 i_unistd='$i_unistd'
24750 i_ustat='$i_ustat'
24751 i_utime='$i_utime'
24752 i_values='$i_values'
24753 i_vfork='$i_vfork'
24754 i_wchar='$i_wchar'
24755 i_xlocale='$i_xlocale'
24756 ignore_versioned_solibs='$ignore_versioned_solibs'
24757 inc_version_list='$inc_version_list'
24758 inc_version_list_init='$inc_version_list_init'
24759 incpath='$incpath'
24760 incpth='$incpth'
24761 inews='$inews'
24762 initialinstalllocation='$initialinstalllocation'
24763 installarchlib='$installarchlib'
24764 installbin='$installbin'
24765 installhtml1dir='$installhtml1dir'
24766 installhtml3dir='$installhtml3dir'
24767 installman1dir='$installman1dir'
24768 installman3dir='$installman3dir'
24769 installprefix='$installprefix'
24770 installprefixexp='$installprefixexp'
24771 installprivlib='$installprivlib'
24772 installscript='$installscript'
24773 installsitearch='$installsitearch'
24774 installsitebin='$installsitebin'
24775 installsitehtml1dir='$installsitehtml1dir'
24776 installsitehtml3dir='$installsitehtml3dir'
24777 installsitelib='$installsitelib'
24778 installsiteman1dir='$installsiteman1dir'
24779 installsiteman3dir='$installsiteman3dir'
24780 installsitescript='$installsitescript'
24781 installstyle='$installstyle'
24782 installusrbinperl='$installusrbinperl'
24783 installvendorarch='$installvendorarch'
24784 installvendorbin='$installvendorbin'
24785 installvendorhtml1dir='$installvendorhtml1dir'
24786 installvendorhtml3dir='$installvendorhtml3dir'
24787 installvendorlib='$installvendorlib'
24788 installvendorman1dir='$installvendorman1dir'
24789 installvendorman3dir='$installvendorman3dir'
24790 installvendorscript='$installvendorscript'
24791 intsize='$intsize'
24792 issymlink='$issymlink'
24793 ivdformat='$ivdformat'
24794 ivsize='$ivsize'
24795 ivtype='$ivtype'
24796 known_extensions='$known_extensions'
24797 ksh='$ksh'
24798 ld='$ld'
24799 ld_can_script='$ld_can_script'
24800 lddlflags='$lddlflags'
24801 ldflags='$ldflags'
24802 ldflags_uselargefiles='$ldflags_uselargefiles'
24803 ldlibpthname='$ldlibpthname'
24804 less='$less'
24805 lib_ext='$lib_ext'
24806 libc='$libc'
24807 libperl='$libperl'
24808 libpth='$libpth'
24809 libs='$libs'
24810 libsdirs='$libsdirs'
24811 libsfiles='$libsfiles'
24812 libsfound='$libsfound'
24813 libspath='$libspath'
24814 libswanted='$libswanted'
24815 libswanted_uselargefiles='$libswanted_uselargefiles'
24816 line='$line'
24817 lint='$lint'
24818 lkflags='$lkflags'
24819 ln='$ln'
24820 lns='$lns'
24821 localtime_r_proto='$localtime_r_proto'
24822 locincpth='$locincpth'
24823 loclibpth='$loclibpth'
24824 longdblinfbytes='$longdblinfbytes'
24825 longdblkind='$longdblkind'
24826 longdblmantbits='$longdblmantbits'
24827 longdblnanbytes='$longdblnanbytes'
24828 longdblsize='$longdblsize'
24829 longlongsize='$longlongsize'
24830 longsize='$longsize'
24831 lp='$lp'
24832 lpr='$lpr'
24833 ls='$ls'
24834 lseeksize='$lseeksize'
24835 lseektype='$lseektype'
24836 mail='$mail'
24837 mailx='$mailx'
24838 make='$make'
24839 make_set_make='$make_set_make'
24840 mallocobj='$mallocobj'
24841 mallocsrc='$mallocsrc'
24842 malloctype='$malloctype'
24843 man1dir='$man1dir'
24844 man1direxp='$man1direxp'
24845 man1ext='$man1ext'
24846 man3dir='$man3dir'
24847 man3direxp='$man3direxp'
24848 man3ext='$man3ext'
24849 mips_type='$mips_type'
24850 mistrustnm='$mistrustnm'
24851 mkdir='$mkdir'
24852 mmaptype='$mmaptype'
24853 modetype='$modetype'
24854 more='$more'
24855 multiarch='$multiarch'
24856 mv='$mv'
24857 myarchname='$myarchname'
24858 mydomain='$mydomain'
24859 myhostname='$myhostname'
24860 myuname='$myuname'
24861 n='$n'
24862 need_va_copy='$need_va_copy'
24863 netdb_hlen_type='$netdb_hlen_type'
24864 netdb_host_type='$netdb_host_type'
24865 netdb_name_type='$netdb_name_type'
24866 netdb_net_type='$netdb_net_type'
24867 nm='$nm'
24868 nm_opt='$nm_opt'
24869 nm_so_opt='$nm_so_opt'
24870 nonxs_ext='$nonxs_ext'
24871 nroff='$nroff'
24872 nvEUformat='$nvEUformat'
24873 nvFUformat='$nvFUformat'
24874 nvGUformat='$nvGUformat'
24875 nv_overflows_integers_at='$nv_overflows_integers_at'
24876 nv_preserves_uv_bits='$nv_preserves_uv_bits'
24877 nveformat='$nveformat'
24878 nvfformat='$nvfformat'
24879 nvgformat='$nvgformat'
24880 nvmantbits='$nvmantbits'
24881 nvsize='$nvsize'
24882 nvtype='$nvtype'
24883 o_nonblock='$o_nonblock'
24884 obj_ext='$obj_ext'
24885 old_pthread_create_joinable='$old_pthread_create_joinable'
24886 optimize='$optimize'
24887 orderlib='$orderlib'
24888 osname='$osname'
24889 osvers='$osvers'
24890 otherlibdirs='$otherlibdirs'
24891 package='$package'
24892 pager='$pager'
24893 passcat='$passcat'
24894 patchlevel='$patchlevel'
24895 path_sep='$path_sep'
24896 perl5='$perl5'
24897 perl='$perl'
24898 perl_patchlevel='$perl_patchlevel'
24899 perl_static_inline='$perl_static_inline'
24900 perladmin='$perladmin'
24901 perllibs='$perllibs'
24902 perlpath='$perlpath'
24903 pg='$pg'
24904 phostname='$phostname'
24905 pidtype='$pidtype'
24906 plibpth='$plibpth'
24907 pmake='$pmake'
24908 pr='$pr'
24909 prefix='$prefix'
24910 prefixexp='$prefixexp'
24911 privlib='$privlib'
24912 privlibexp='$privlibexp'
24913 procselfexe='$procselfexe'
24914 ptrsize='$ptrsize'
24915 quadkind='$quadkind'
24916 quadtype='$quadtype'
24917 randbits='$randbits'
24918 randfunc='$randfunc'
24919 random_r_proto='$random_r_proto'
24920 randseedtype='$randseedtype'
24921 ranlib='$ranlib'
24922 rd_nodata='$rd_nodata'
24923 readdir64_r_proto='$readdir64_r_proto'
24924 readdir_r_proto='$readdir_r_proto'
24925 revision='$revision'
24926 rm='$rm'
24927 rm_try='$rm_try'
24928 rmail='$rmail'
24929 run='$run'
24930 runnm='$runnm'
24931 sGMTIME_max='$sGMTIME_max'
24932 sGMTIME_min='$sGMTIME_min'
24933 sLOCALTIME_max='$sLOCALTIME_max'
24934 sLOCALTIME_min='$sLOCALTIME_min'
24935 sPRIEUldbl='$sPRIEUldbl'
24936 sPRIFUldbl='$sPRIFUldbl'
24937 sPRIGUldbl='$sPRIGUldbl'
24938 sPRIXU64='$sPRIXU64'
24939 sPRId64='$sPRId64'
24940 sPRIeldbl='$sPRIeldbl'
24941 sPRIfldbl='$sPRIfldbl'
24942 sPRIgldbl='$sPRIgldbl'
24943 sPRIi64='$sPRIi64'
24944 sPRIo64='$sPRIo64'
24945 sPRIu64='$sPRIu64'
24946 sPRIx64='$sPRIx64'
24947 sSCNfldbl='$sSCNfldbl'
24948 sched_yield='$sched_yield'
24949 scriptdir='$scriptdir'
24950 scriptdirexp='$scriptdirexp'
24951 sed='$sed'
24952 seedfunc='$seedfunc'
24953 selectminbits='$selectminbits'
24954 selecttype='$selecttype'
24955 sendmail='$sendmail'
24956 setgrent_r_proto='$setgrent_r_proto'
24957 sethostent_r_proto='$sethostent_r_proto'
24958 setlocale_r_proto='$setlocale_r_proto'
24959 setnetent_r_proto='$setnetent_r_proto'
24960 setprotoent_r_proto='$setprotoent_r_proto'
24961 setpwent_r_proto='$setpwent_r_proto'
24962 setservent_r_proto='$setservent_r_proto'
24963 sh='$sh'
24964 shar='$shar'
24965 sharpbang='$sharpbang'
24966 shmattype='$shmattype'
24967 shortsize='$shortsize'
24968 shrpenv='$shrpenv'
24969 shsharp='$shsharp'
24970 sig_count='$sig_count'
24971 sig_name='$sig_name'
24972 sig_name_init='$sig_name_init'
24973 sig_num='$sig_num'
24974 sig_num_init='$sig_num_init'
24975 sig_size='$sig_size'
24976 signal_t='$signal_t'
24977 sitearch='$sitearch'
24978 sitearchexp='$sitearchexp'
24979 sitebin='$sitebin'
24980 sitebinexp='$sitebinexp'
24981 sitehtml1dir='$sitehtml1dir'
24982 sitehtml1direxp='$sitehtml1direxp'
24983 sitehtml3dir='$sitehtml3dir'
24984 sitehtml3direxp='$sitehtml3direxp'
24985 sitelib='$sitelib'
24986 sitelib_stem='$sitelib_stem'
24987 sitelibexp='$sitelibexp'
24988 siteman1dir='$siteman1dir'
24989 siteman1direxp='$siteman1direxp'
24990 siteman3dir='$siteman3dir'
24991 siteman3direxp='$siteman3direxp'
24992 siteprefix='$siteprefix'
24993 siteprefixexp='$siteprefixexp'
24994 sitescript='$sitescript'
24995 sitescriptexp='$sitescriptexp'
24996 sizesize='$sizesize'
24997 sizetype='$sizetype'
24998 sleep='$sleep'
24999 smail='$smail'
25000 so='$so'
25001 sockethdr='$sockethdr'
25002 socketlib='$socketlib'
25003 socksizetype='$socksizetype'
25004 sort='$sort'
25005 spackage='$spackage'
25006 spitshell='$spitshell'
25007 srand48_r_proto='$srand48_r_proto'
25008 srandom_r_proto='$srandom_r_proto'
25009 src='$src'
25010 ssizetype='$ssizetype'
25011 st_ino_sign='$st_ino_sign'
25012 st_ino_size='$st_ino_size'
25013 startperl='$startperl'
25014 startsh='$startsh'
25015 static_ext='$static_ext'
25016 stdchar='$stdchar'
25017 stdio_base='$stdio_base'
25018 stdio_bufsiz='$stdio_bufsiz'
25019 stdio_cnt='$stdio_cnt'
25020 stdio_filbuf='$stdio_filbuf'
25021 stdio_ptr='$stdio_ptr'
25022 stdio_stream_array='$stdio_stream_array'
25023 strerror_r_proto='$strerror_r_proto'
25024 strings='$strings'
25025 submit='$submit'
25026 subversion='$subversion'
25027 sysman='$sysman'
25028 sysroot='$sysroot'
25029 tail='$tail'
25030 tar='$tar'
25031 targetarch='$targetarch'
25032 targetdir='$targetdir'
25033 targetenv='$targetenv'
25034 targethost='$targethost'
25035 targetmkdir='$targetmkdir'
25036 targetport='$targetport'
25037 targetsh='$targetsh'
25038 tbl='$tbl'
25039 tee='$tee'
25040 test='$test'
25041 timeincl='$timeincl'
25042 timetype='$timetype'
25043 tmpnam_r_proto='$tmpnam_r_proto'
25044 to='$to'
25045 touch='$touch'
25046 tr='$tr'
25047 trnl='$trnl'
25048 troff='$troff'
25049 ttyname_r_proto='$ttyname_r_proto'
25050 u16size='$u16size'
25051 u16type='$u16type'
25052 u32size='$u32size'
25053 u32type='$u32type'
25054 u64size='$u64size'
25055 u64type='$u64type'
25056 u8size='$u8size'
25057 u8type='$u8type'
25058 uidformat='$uidformat'
25059 uidsign='$uidsign'
25060 uidsize='$uidsize'
25061 uidtype='$uidtype'
25062 uname='$uname'
25063 uniq='$uniq'
25064 uquadtype='$uquadtype'
25065 use5005threads='$use5005threads'
25066 use64bitall='$use64bitall'
25067 use64bitint='$use64bitint'
25068 usecbacktrace='$usecbacktrace'
25069 usecrosscompile='$usecrosscompile'
25070 usedevel='$usedevel'
25071 usedl='$usedl'
25072 usedtrace='$usedtrace'
25073 usefaststdio='$usefaststdio'
25074 useithreads='$useithreads'
25075 usekernprocpathname='$usekernprocpathname'
25076 uselargefiles='$uselargefiles'
25077 uselongdouble='$uselongdouble'
25078 usemallocwrap='$usemallocwrap'
25079 usemorebits='$usemorebits'
25080 usemultiplicity='$usemultiplicity'
25081 usemymalloc='$usemymalloc'
25082 usenm='$usenm'
25083 usensgetexecutablepath='$usensgetexecutablepath'
25084 useopcode='$useopcode'
25085 useperlio='$useperlio'
25086 useposix='$useposix'
25087 usequadmath='$usequadmath'
25088 usereentrant='$usereentrant'
25089 userelocatableinc='$userelocatableinc'
25090 useshrplib='$useshrplib'
25091 usesitecustomize='$usesitecustomize'
25092 usesocks='$usesocks'
25093 usethreads='$usethreads'
25094 usevendorprefix='$usevendorprefix'
25095 useversionedarchname='$useversionedarchname'
25096 usevfork='$usevfork'
25097 usrinc='$usrinc'
25098 uuname='$uuname'
25099 uvXUformat='$uvXUformat'
25100 uvoformat='$uvoformat'
25101 uvsize='$uvsize'
25102 uvtype='$uvtype'
25103 uvuformat='$uvuformat'
25104 uvxformat='$uvxformat'
25105 vendorarch='$vendorarch'
25106 vendorarchexp='$vendorarchexp'
25107 vendorbin='$vendorbin'
25108 vendorbinexp='$vendorbinexp'
25109 vendorhtml1dir='$vendorhtml1dir'
25110 vendorhtml1direxp='$vendorhtml1direxp'
25111 vendorhtml3dir='$vendorhtml3dir'
25112 vendorhtml3direxp='$vendorhtml3direxp'
25113 vendorlib='$vendorlib'
25114 vendorlib_stem='$vendorlib_stem'
25115 vendorlibexp='$vendorlibexp'
25116 vendorman1dir='$vendorman1dir'
25117 vendorman1direxp='$vendorman1direxp'
25118 vendorman3dir='$vendorman3dir'
25119 vendorman3direxp='$vendorman3direxp'
25120 vendorprefix='$vendorprefix'
25121 vendorprefixexp='$vendorprefixexp'
25122 vendorscript='$vendorscript'
25123 vendorscriptexp='$vendorscriptexp'
25124 version='$version'
25125 version_patchlevel_string='$version_patchlevel_string'
25126 versiononly='$versiononly'
25127 vi='$vi'
25128 xlibpth='$xlibpth'
25129 yacc='$yacc'
25130 yaccflags='$yaccflags'
25131 zcat='$zcat'
25132 zip='$zip'
25133 EOT
25134
25135 : add special variables
25136 $test -f $src/patchlevel.h && \
25137 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
25138 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
25139 echo "PERL_CONFIG_SH=true" >>config.sh
25140
25141 : propagate old symbols
25142 if $test -f UU/config.sh; then
25143         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
25144         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
25145                 config.sh config.sh UU/oldconfig.sh |\
25146                 $sort | $uniq -u >UU/oldsyms
25147         set X `$cat UU/oldsyms`
25148         shift
25149         case $# in
25150         0) ;;
25151         *)
25152                 $cat <<EOM
25153 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
25154 EOM
25155                 echo ": Variables propagated from previous config.sh file." >>config.sh
25156                 for sym in `$cat UU/oldsyms`; do
25157                         echo "    Propagating $hint variable "'$'"$sym..."
25158                         eval 'tmp="$'"${sym}"'"'
25159                         echo "$tmp" | \
25160                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
25161                 done
25162                 ;;
25163         esac
25164 fi
25165
25166 : preserve RCS keywords in files with variable substitution, grrr
25167 Id='$Id'
25168
25169 : Finish up by extracting the .SH files
25170 case "$alldone" in
25171 exit)
25172         echo "Stopping at your request, leaving temporary files around."
25173         exit 0
25174         ;;
25175 cont)
25176         ;;
25177 '')
25178         dflt=''
25179         nostick=true
25180         $cat <<EOM
25181
25182 If you'd like to make any changes to the config.sh file before I begin
25183 to configure things, do it as a shell escape now (e.g. !vi config.sh).
25184
25185 EOM
25186         rp="Press return or use a shell escape to edit config.sh:"
25187         . UU/myread
25188         nostick=''
25189         case "$ans" in
25190         '') ;;
25191         *) : in case they cannot read
25192                 sh 1>&4 -c "$ans";;
25193         esac
25194         ;;
25195 esac
25196
25197 : if this fails, just run all the .SH files by hand
25198 . ./config.sh
25199
25200 echo " "
25201 exec 1>&4
25202 pwd=`pwd`
25203 . ./UU/extract
25204 cd "$pwd"
25205
25206 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
25207         dflt=y
25208         case "$silent" in
25209         true) ;;
25210         *)
25211                 $cat <<EOM
25212
25213 Now you need to generate make dependencies by running "$make depend".
25214 You might prefer to run it in background: "$make depend > makedepend.out &"
25215 It can take a while, so you might not want to run it right now.
25216
25217 EOM
25218                 ;;
25219         esac
25220         rp="Run $make depend now?"
25221         . UU/myread
25222         case "$ans" in
25223         y*)
25224                 $make depend && echo "Now you must run '$make'."
25225                 ;;
25226         *)
25227                 echo "You must run '$make depend' then '$make'."
25228                 ;;
25229         esac
25230 elif test -f [Mm]akefile; then
25231         echo " "
25232         echo "Now you must run a $make."
25233 else
25234         echo "Configure done."
25235 fi
25236
25237 if $test -f Policy.sh; then
25238     $cat <<EOM
25239
25240 If you compile $package on a different machine or from a different object
25241 directory, copy the Policy.sh file from this object directory to the
25242 new one before you run Configure -- this will help you with most of
25243 the policy defaults.
25244
25245 EOM
25246 fi
25247 if $test -f UU/config.msg; then
25248     echo "Hmm.  I also noted the following information while running:"
25249     echo " "
25250     $cat UU/config.msg >&4
25251 fi
25252 $rm -f kit*isdone ark*isdone
25253 $rm -rf UU
25254
25255 : End of Configure
25256