This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
multiconcat: don't fold adjacent constants
[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_dbminitproto=''
428 d_difftime=''
429 d_dir_dd_fd=''
430 d_dirfd=''
431 d_dladdr=''
432 d_dlerror=''
433 d_dlopen=''
434 d_dlsymun=''
435 d_dosuid=''
436 d_suidsafe=''
437 d_drand48_r=''
438 drand48_r_proto=''
439 d_drand48proto=''
440 d_dup2=''
441 d_eaccess=''
442 d_endgrent=''
443 d_endgrent_r=''
444 endgrent_r_proto=''
445 d_endhent=''
446 d_endhostent_r=''
447 endhostent_r_proto=''
448 d_endnent=''
449 d_endnetent_r=''
450 endnetent_r_proto=''
451 d_endpent=''
452 d_endprotoent_r=''
453 endprotoent_r_proto=''
454 d_endpwent=''
455 d_endpwent_r=''
456 endpwent_r_proto=''
457 d_endsent=''
458 d_endservent_r=''
459 endservent_r_proto=''
460 d_erf=''
461 d_erfc=''
462 d_exp2=''
463 d_expm1=''
464 d_faststdio=''
465 d_fchdir=''
466 d_fchmod=''
467 d_fchown=''
468 d_fcntl=''
469 d_fcntl_can_lock=''
470 d_fd_macros=''
471 d_fd_set=''
472 d_fds_bits=''
473 d_fdclose=''
474 d_fdim=''
475 d_fegetround=''
476 d_fgetpos=''
477 d_finite=''
478 d_finitel=''
479 d_flexfnam=''
480 d_flock=''
481 d_flockproto=''
482 d_fma=''
483 d_fmax=''
484 d_fmin=''
485 d_fork=''
486 d_fp_class=''
487 d_fp_classl=''
488 d_fpclass=''
489 d_fp_classify=''
490 d_fpclassify=''
491 d_fpclassl=''
492 d_fpgetround=''
493 d_fpos64_t=''
494 d_frexpl=''
495 d_fs_data_s=''
496 d_fchmodat=''
497 d_linkat=''
498 d_openat=''
499 d_renameat=''
500 d_unlinkat=''
501 d_fseeko=''
502 d_fsetpos=''
503 d_fstatfs=''
504 d_fsync=''
505 d_ftello=''
506 d_ftime=''
507 d_gettimeod=''
508 d_futimes=''
509 d_gai_strerror=''
510 d_Gconvert=''
511 d_getaddrinfo=''
512 d_getcwd=''
513 d_getespwnam=''
514 d_getfsstat=''
515 d_getgrent=''
516 d_getgrent_r=''
517 getgrent_r_proto=''
518 d_getgrgid_r=''
519 getgrgid_r_proto=''
520 d_getgrnam_r=''
521 getgrnam_r_proto=''
522 d_getgrps=''
523 d_gethbyaddr=''
524 d_gethbyname=''
525 d_gethent=''
526 aphostname=''
527 d_gethname=''
528 d_phostname=''
529 d_uname=''
530 d_gethostbyaddr_r=''
531 gethostbyaddr_r_proto=''
532 d_gethostbyname_r=''
533 gethostbyname_r_proto=''
534 d_gethostent_r=''
535 gethostent_r_proto=''
536 d_gethostprotos=''
537 d_getitimer=''
538 d_getlogin=''
539 d_getlogin_r=''
540 getlogin_r_proto=''
541 d_getmnt=''
542 d_getmntent=''
543 d_getnameinfo=''
544 d_getnbyaddr=''
545 d_getnbyname=''
546 d_getnent=''
547 d_getnetbyaddr_r=''
548 getnetbyaddr_r_proto=''
549 d_getnetbyname_r=''
550 getnetbyname_r_proto=''
551 d_getnetent_r=''
552 getnetent_r_proto=''
553 d_getnetprotos=''
554 d_getpagsz=''
555 d_getpent=''
556 d_getpgid=''
557 d_getpgrp2=''
558 d_bsdgetpgrp=''
559 d_getpgrp=''
560 d_getppid=''
561 d_getprior=''
562 d_getpbyname=''
563 d_getpbynumber=''
564 d_getprotobyname_r=''
565 getprotobyname_r_proto=''
566 d_getprotobynumber_r=''
567 getprotobynumber_r_proto=''
568 d_getprotoent_r=''
569 getprotoent_r_proto=''
570 d_getprotoprotos=''
571 d_getprpwnam=''
572 d_getpwent=''
573 d_getpwent_r=''
574 getpwent_r_proto=''
575 d_getpwnam_r=''
576 getpwnam_r_proto=''
577 d_getpwuid_r=''
578 getpwuid_r_proto=''
579 d_getsent=''
580 d_getservbyname_r=''
581 getservbyname_r_proto=''
582 d_getservbyport_r=''
583 getservbyport_r_proto=''
584 d_getservent_r=''
585 getservent_r_proto=''
586 d_getservprotos=''
587 d_getspnam=''
588 d_getspnam_r=''
589 getspnam_r_proto=''
590 d_getsbyname=''
591 d_getsbyport=''
592 d_gmtime_r=''
593 gmtime_r_proto=''
594 d_gnulibc=''
595 gnulibc_version=''
596 d_hasmntopt=''
597 d_htonl=''
598 d_hypot=''
599 d_ilogb=''
600 d_ilogbl=''
601 d_inetaton=''
602 d_inetntop=''
603 d_inetpton=''
604 d_int64_t=''
605 d_isascii=''
606 d_isblank=''
607 d_isfinite=''
608 d_isfinitel=''
609 d_isinf=''
610 d_isinfl=''
611 d_isless=''
612 d_isnan=''
613 d_isnanl=''
614 d_isnormal=''
615 d_j0=''
616 d_j0l=''
617 d_killpg=''
618 d_lc_monetary_2008=''
619 d_lchown=''
620 d_ldbl_dig=''
621 d_lgamma=''
622 d_lgamma_r=''
623 d_libm_lib_version=''
624 d_link=''
625 d_llrint=''
626 d_llrintl=''
627 d_llround=''
628 d_llroundl=''
629 d_localeconv_l=''
630 d_localtime_r=''
631 d_localtime_r_needs_tzset=''
632 localtime_r_proto=''
633 d_locconv=''
634 d_lockf=''
635 d_log1p=''
636 d_log2=''
637 d_logb=''
638 d_ldexpl=''
639 d_long_double_style_ieee=''
640 d_long_double_style_ieee_doubledouble=''
641 d_long_double_style_ieee_extended=''
642 d_long_double_style_ieee_std=''
643 d_long_double_style_vax=''
644 d_longdbl=''
645 longdblkind=''
646 longdblsize=''
647 d_longlong=''
648 longlongsize=''
649 d_lrint=''
650 d_lrintl=''
651 d_lround=''
652 d_lroundl=''
653 d_lseekproto=''
654 d_lstat=''
655 d_madvise=''
656 d_malloc_good_size=''
657 d_malloc_size=''
658 d_mblen=''
659 d_mbrlen=''
660 d_mbrtowc=''
661 d_mbstowcs=''
662 d_mbtowc=''
663 d_memmem=''
664 d_memrchr=''
665 d_mkdir=''
666 d_mkdtemp=''
667 d_mkfifo=''
668 d_mkstemp=''
669 d_mkstemps=''
670 d_mktime=''
671 d_mmap=''
672 mmaptype=''
673 d_modfl=''
674 d_modflproto=''
675 d_mprotect=''
676 d_msg=''
677 d_msgctl=''
678 d_msgget=''
679 d_msghdr_s=''
680 d_msgrcv=''
681 d_msgsnd=''
682 d_msync=''
683 d_munmap=''
684 d_nan=''
685 d_nanosleep=''
686 d_nearbyint=''
687 d_duplocale=''
688 d_freelocale=''
689 d_newlocale=''
690 d_querylocale=''
691 d_uselocale=''
692 i_xlocale=''
693 d_nextafter=''
694 d_nexttoward=''
695 d_nice=''
696 d_nl_langinfo=''
697 d_thread_safe_nl_langinfo_l=''
698 d_off64_t=''
699 d_open3=''
700 d_fpathconf=''
701 d_pathconf=''
702 d_pause=''
703 d_pipe=''
704 d_poll=''
705 d_portable=''
706 d_prctl=''
707 d_prctl_set_name=''
708 d_procselfexe=''
709 procselfexe=''
710 d_old_pthread_create_joinable=''
711 old_pthread_create_joinable=''
712 d_pthread_atfork=''
713 d_pthread_attr_setscope=''
714 d_pthread_yield=''
715 d_sched_yield=''
716 sched_yield=''
717 d_ptrdiff_t=''
718 d_qgcvt=''
719 d_random_r=''
720 random_r_proto=''
721 d_readdir64_r=''
722 readdir64_r_proto=''
723 d_readdir=''
724 d_rewinddir=''
725 d_seekdir=''
726 d_telldir=''
727 d_readdir_r=''
728 readdir_r_proto=''
729 d_readlink=''
730 d_readv=''
731 d_recvmsg=''
732 d_re_comp=''
733 d_regcmp=''
734 d_regcomp=''
735 d_remainder=''
736 d_remquo=''
737 d_rename=''
738 d_rint=''
739 d_rmdir=''
740 d_round=''
741 d_sbrkproto=''
742 d_scalbn=''
743 d_scalbnl=''
744 d_select=''
745 d_sem=''
746 d_semctl=''
747 d_semget=''
748 d_semop=''
749 d_sendmsg=''
750 d_setegid=''
751 d_seteuid=''
752 d_setgrent=''
753 d_setgrent_r=''
754 setgrent_r_proto=''
755 d_setgrps=''
756 d_sethent=''
757 d_sethostent_r=''
758 sethostent_r_proto=''
759 d_setitimer=''
760 d_setlinebuf=''
761 d_setlocale=''
762 d_setlocale_r=''
763 setlocale_r_proto=''
764 d_setnent=''
765 d_setnetent_r=''
766 setnetent_r_proto=''
767 d_setpent=''
768 d_setpgid=''
769 d_setpgrp2=''
770 d_bsdsetpgrp=''
771 d_setpgrp=''
772 d_setprior=''
773 d_setproctitle=''
774 d_setprotoent_r=''
775 setprotoent_r_proto=''
776 d_setpwent=''
777 d_setpwent_r=''
778 setpwent_r_proto=''
779 d_setregid=''
780 d_setresgid=''
781 d_setresuid=''
782 d_setreuid=''
783 d_setrgid=''
784 d_setruid=''
785 d_setsent=''
786 d_setservent_r=''
787 setservent_r_proto=''
788 d_setsid=''
789 d_setvbuf=''
790 d_shm=''
791 d_shmat=''
792 d_shmatprototype=''
793 shmattype=''
794 d_shmctl=''
795 d_shmdt=''
796 d_shmget=''
797 d_sigaction=''
798 d_siginfo_si_addr=''
799 d_siginfo_si_band=''
800 d_siginfo_si_errno=''
801 d_siginfo_si_fd=''
802 d_siginfo_si_pid=''
803 d_siginfo_si_status=''
804 d_siginfo_si_uid=''
805 d_siginfo_si_value=''
806 d_signbit=''
807 d_sigprocmask=''
808 d_sigsetjmp=''
809 usesitecustomize=''
810 d_snprintf=''
811 d_vsnprintf=''
812 d_sockatmark=''
813 d_sockatmarkproto=''
814 d_ip_mreq=''
815 d_ip_mreq_source=''
816 d_ipv6_mreq=''
817 d_ipv6_mreq_source=''
818 d_msg_ctrunc=''
819 d_msg_dontroute=''
820 d_msg_oob=''
821 d_msg_peek=''
822 d_msg_proxy=''
823 d_oldsock=''
824 d_scm_rights=''
825 d_sin6_scope_id=''
826 d_sockaddr_in6=''
827 d_sockaddr_sa_len=''
828 d_socket=''
829 d_sockpair=''
830 sockethdr=''
831 socketlib=''
832 d_socklen_t=''
833 d_socks5_init=''
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_strcoll=''
861 d_sysernlst=''
862 d_syserrlst=''
863 d_strerror_l=''
864 d_strerror_r=''
865 strerror_r_proto=''
866 d_strftime=''
867 d_strlcat=''
868 d_strlcpy=''
869 d_strnlen=''
870 d_strtod=''
871 d_strtol=''
872 d_strtold=''
873 d_strtold_l=''
874 d_strtoll=''
875 d_strtoq=''
876 d_strtoul=''
877 d_strtoull=''
878 d_strtouq=''
879 d_strxfrm=''
880 d_symlink=''
881 d_syscall=''
882 d_syscallproto=''
883 d_sysconf=''
884 d_system=''
885 d_tcgetpgrp=''
886 d_tcsetpgrp=''
887 d_telldirproto=''
888 d_tgamma=''
889 d_time=''
890 timetype=''
891 d_asctime64=''
892 d_ctime64=''
893 d_difftime64=''
894 d_gmtime64=''
895 d_localtime64=''
896 d_mktime64=''
897 d_timegm=''
898 clocktype=''
899 d_times=''
900 d_tmpnam_r=''
901 tmpnam_r_proto=''
902 d_trunc=''
903 d_truncate=''
904 d_truncl=''
905 d_ttyname_r=''
906 ttyname_r_proto=''
907 d_tzname=''
908 d_u32align=''
909 d_ualarm=''
910 d_umask=''
911 d_semctl_semid_ds=''
912 d_semctl_semun=''
913 d_union_semun=''
914 d_unordered=''
915 d_unsetenv=''
916 d_usleep=''
917 d_usleepproto=''
918 d_ustat=''
919 d_pseudofork=''
920 d_vfork=''
921 usevfork=''
922 d_voidsig=''
923 signal_t=''
924 d_wait4=''
925 d_waitpid=''
926 d_wcscmp=''
927 d_wcstombs=''
928 d_wcsxfrm=''
929 d_wctomb=''
930 d_writev=''
931 default_inc_excludes_dot=''
932 dlext=''
933 bin_ELF=''
934 cccdlflags=''
935 ccdlflags=''
936 dlsrc=''
937 ld=''
938 ld_can_script=''
939 lddlflags=''
940 usedl=''
941 doublesize=''
942 dtraceobject=''
943 dtracexnolibs=''
944 ebcdic=''
945 fflushNULL=''
946 fflushall=''
947 fpossize=''
948 fpostype=''
949 gccansipedantic=''
950 gccosandvers=''
951 gccversion=''
952 gidformat=''
953 gidsign=''
954 gidsize=''
955 gidtype=''
956 groupstype=''
957 h_fcntl=''
958 h_sysfile=''
959 html1dir=''
960 html1direxp=''
961 installhtml1dir=''
962 html3dir=''
963 html3direxp=''
964 installhtml3dir=''
965 i_arpainet=''
966 i_bfd=''
967 i_crypt=''
968 db_hashtype=''
969 db_prefixtype=''
970 db_version_major=''
971 db_version_minor=''
972 db_version_patch=''
973 i_db=''
974 i_dbm=''
975 i_rpcsvcdbm=''
976 d_dirnamlen=''
977 direntrytype=''
978 i_dirent=''
979 i_dlfcn=''
980 i_execinfo=''
981 i_fcntl=''
982 i_fenv=''
983 i_fp=''
984 i_fp_class=''
985 i_gdbm=''
986 d_grpasswd=''
987 i_grp=''
988 i_ieeefp=''
989 i_inttypes=''
990 i_langinfo=''
991 i_libutil=''
992 i_locale=''
993 i_machcthr=''
994 i_malloc=''
995 i_mallocmalloc=''
996 i_mntent=''
997 d_gdbm_ndbm_h_uses_prototypes=''
998 d_gdbmndbm_h_uses_prototypes=''
999 d_ndbm=''
1000 d_ndbm_h_uses_prototypes=''
1001 i_gdbm_ndbm=''
1002 i_gdbmndbm=''
1003 i_ndbm=''
1004 i_netdb=''
1005 i_neterrno=''
1006 i_netinettcp=''
1007 i_niin=''
1008 i_sysin=''
1009 i_poll=''
1010 i_prot=''
1011 i_pthread=''
1012 d_pwage=''
1013 d_pwchange=''
1014 d_pwclass=''
1015 d_pwcomment=''
1016 d_pwexpire=''
1017 d_pwgecos=''
1018 d_pwpasswd=''
1019 d_pwquota=''
1020 i_pwd=''
1021 i_quadmath=''
1022 i_shadow=''
1023 i_socks=''
1024 i_stdbool=''
1025 i_stdint=''
1026 i_stdlib=''
1027 i_sunmath=''
1028 i_sysaccess=''
1029 i_sysdir=''
1030 i_sysfile=''
1031 d_voidtty=''
1032 i_bsdioctl=''
1033 i_sysfilio=''
1034 i_sysioctl=''
1035 i_syssockio=''
1036 i_syslog=''
1037 i_sysmman=''
1038 i_sysmode=''
1039 i_sysmount=''
1040 i_sysndir=''
1041 i_sysparam=''
1042 i_syspoll=''
1043 i_sysresrc=''
1044 i_syssecrt=''
1045 i_sysselct=''
1046 i_sysstat=''
1047 i_sysstatfs=''
1048 i_sysstatvfs=''
1049 i_systimes=''
1050 i_systypes=''
1051 i_sysuio=''
1052 i_sysun=''
1053 i_sysutsname=''
1054 i_sysvfs=''
1055 i_syswait=''
1056 i_sgtty=''
1057 i_termio=''
1058 i_termios=''
1059 d_tm_tm_gmtoff=''
1060 d_tm_tm_zone=''
1061 i_systime=''
1062 i_systimek=''
1063 i_time=''
1064 timeincl=''
1065 i_unistd=''
1066 i_ustat=''
1067 i_utime=''
1068 i_vfork=''
1069 i_wchar=''
1070 d_inc_version_list=''
1071 inc_version_list=''
1072 inc_version_list_init=''
1073 doubleinfbytes=''
1074 doublenanbytes=''
1075 longdblinfbytes=''
1076 longdblnanbytes=''
1077 installprefix=''
1078 installprefixexp=''
1079 installstyle=''
1080 installusrbinperl=''
1081 intsize=''
1082 longsize=''
1083 shortsize=''
1084 issymlink=''
1085 libc=''
1086 ldlibpthname=''
1087 libperl=''
1088 shrpenv=''
1089 useshrplib=''
1090 glibpth=''
1091 incpth=''
1092 libpth=''
1093 loclibpth=''
1094 plibpth=''
1095 xlibpth=''
1096 ignore_versioned_solibs=''
1097 libs=''
1098 libsdirs=''
1099 libsfiles=''
1100 libsfound=''
1101 libspath=''
1102 lns=''
1103 d_PRIEUldbl=''
1104 d_PRIFUldbl=''
1105 d_PRIGUldbl=''
1106 d_PRIeldbl=''
1107 d_PRIfldbl=''
1108 d_PRIgldbl=''
1109 d_SCNfldbl=''
1110 d_double_has_inf=''
1111 d_double_has_nan=''
1112 d_double_has_negative_zero=''
1113 d_double_has_subnormals=''
1114 d_double_style_cray=''
1115 d_double_style_ibm=''
1116 d_double_style_ieee=''
1117 d_double_style_vax=''
1118 doublekind=''
1119 sPRIEUldbl=''
1120 sPRIFUldbl=''
1121 sPRIGUldbl=''
1122 sPRIeldbl=''
1123 sPRIfldbl=''
1124 sPRIgldbl=''
1125 sSCNfldbl=''
1126 lseeksize=''
1127 lseektype=''
1128 make_set_make=''
1129 d_mymalloc=''
1130 freetype=''
1131 mallocobj=''
1132 mallocsrc=''
1133 malloctype=''
1134 usemallocwrap=''
1135 usemymalloc=''
1136 installman1dir=''
1137 man1dir=''
1138 man1direxp=''
1139 man1ext=''
1140 installman3dir=''
1141 man3dir=''
1142 man3direxp=''
1143 man3ext=''
1144 doublemantbits=''
1145 longdblmantbits=''
1146 nvmantbits=''
1147 modetype=''
1148 multiarch=''
1149 mydomain=''
1150 myhostname=''
1151 phostname=''
1152 c=''
1153 n=''
1154 d_eofnblk=''
1155 eagain=''
1156 o_nonblock=''
1157 rd_nodata=''
1158 need_va_copy=''
1159 netdb_hlen_type=''
1160 netdb_host_type=''
1161 netdb_name_type=''
1162 netdb_net_type=''
1163 groupcat=''
1164 hostcat=''
1165 passcat=''
1166 orderlib=''
1167 ranlib=''
1168 d_perl_otherlibdirs=''
1169 otherlibdirs=''
1170 package=''
1171 spackage=''
1172 pager=''
1173 api_revision=''
1174 api_subversion=''
1175 api_version=''
1176 api_versionstring=''
1177 patchlevel=''
1178 perl_patchlevel=''
1179 revision=''
1180 subversion=''
1181 version=''
1182 version_patchlevel_string=''
1183 perl5=''
1184 perladmin=''
1185 perlpath=''
1186 d_nv_preserves_uv=''
1187 d_nv_zero_is_allbits_zero=''
1188 i16size=''
1189 i16type=''
1190 i32size=''
1191 i32type=''
1192 i64size=''
1193 i64type=''
1194 i8size=''
1195 i8type=''
1196 ivsize=''
1197 ivtype=''
1198 nv_overflows_integers_at=''
1199 nv_preserves_uv_bits=''
1200 nvsize=''
1201 nvtype=''
1202 u16size=''
1203 u16type=''
1204 u32size=''
1205 u32type=''
1206 u64size=''
1207 u64type=''
1208 u8size=''
1209 u8type=''
1210 uvsize=''
1211 uvtype=''
1212 ivdformat=''
1213 nvEUformat=''
1214 nvFUformat=''
1215 nvGUformat=''
1216 nveformat=''
1217 nvfformat=''
1218 nvgformat=''
1219 uvXUformat=''
1220 uvoformat=''
1221 uvuformat=''
1222 uvxformat=''
1223 pidtype=''
1224 prefix=''
1225 prefixexp=''
1226 installprivlib=''
1227 privlib=''
1228 privlibexp=''
1229 ptrsize=''
1230 d_PRIXU64=''
1231 d_PRId64=''
1232 d_PRIi64=''
1233 d_PRIo64=''
1234 d_PRIu64=''
1235 d_PRIx64=''
1236 sPRIXU64=''
1237 sPRId64=''
1238 sPRIi64=''
1239 sPRIo64=''
1240 sPRIu64=''
1241 sPRIx64=''
1242 d_quad=''
1243 quadkind=''
1244 quadtype=''
1245 uquadtype=''
1246 drand01=''
1247 randbits=''
1248 randfunc=''
1249 randseedtype=''
1250 seedfunc=''
1251 installscript=''
1252 scriptdir=''
1253 scriptdirexp=''
1254 selectminbits=''
1255 selecttype=''
1256 sh=''
1257 targetsh=''
1258 sig_count=''
1259 sig_name=''
1260 sig_name_init=''
1261 sig_num=''
1262 sig_num_init=''
1263 sig_size=''
1264 d_sitearch=''
1265 installsitearch=''
1266 sitearch=''
1267 sitearchexp=''
1268 installsitebin=''
1269 sitebin=''
1270 sitebinexp=''
1271 installsitehtml1dir=''
1272 sitehtml1dir=''
1273 sitehtml1direxp=''
1274 installsitehtml3dir=''
1275 sitehtml3dir=''
1276 sitehtml3direxp=''
1277 installsitelib=''
1278 sitelib=''
1279 sitelib_stem=''
1280 sitelibexp=''
1281 installsiteman1dir=''
1282 siteman1dir=''
1283 siteman1direxp=''
1284 installsiteman3dir=''
1285 siteman3dir=''
1286 siteman3direxp=''
1287 siteprefix=''
1288 siteprefixexp=''
1289 installsitescript=''
1290 sitescript=''
1291 sitescriptexp=''
1292 sizesize=''
1293 sizetype=''
1294 d_libname_unique=''
1295 so=''
1296 socksizetype=''
1297 sharpbang=''
1298 shsharp=''
1299 spitshell=''
1300 src=''
1301 ssizetype=''
1302 st_ino_sign=''
1303 st_ino_size=''
1304 startperl=''
1305 startsh=''
1306 stdchar=''
1307 d_stdio_stream_array=''
1308 stdio_stream_array=''
1309 sysman=''
1310 sGMTIME_max=''
1311 sGMTIME_min=''
1312 sLOCALTIME_max=''
1313 sLOCALTIME_min=''
1314 trnl=''
1315 uidformat=''
1316 uidsign=''
1317 uidsize=''
1318 uidtype=''
1319 archname64=''
1320 use64bitall=''
1321 use64bitint=''
1322 usecbacktrace=''
1323 dtrace=''
1324 usedtrace=''
1325 usefaststdio=''
1326 usekernprocpathname=''
1327 ccflags_uselargefiles=''
1328 ldflags_uselargefiles=''
1329 libswanted_uselargefiles=''
1330 uselargefiles=''
1331 uselongdouble=''
1332 usemorebits=''
1333 usemultiplicity=''
1334 nm_opt=''
1335 nm_so_opt=''
1336 runnm=''
1337 usenm=''
1338 usensgetexecutablepath=''
1339 useperlio=''
1340 usequadmath=''
1341 usesocks=''
1342 d_oldpthreads=''
1343 use5005threads=''
1344 useithreads=''
1345 usereentrant=''
1346 usethreads=''
1347 incpath=''
1348 mips_type=''
1349 usrinc=''
1350 d_vendorarch=''
1351 installvendorarch=''
1352 vendorarch=''
1353 vendorarchexp=''
1354 d_vendorbin=''
1355 installvendorbin=''
1356 vendorbin=''
1357 vendorbinexp=''
1358 installvendorhtml1dir=''
1359 vendorhtml1dir=''
1360 vendorhtml1direxp=''
1361 installvendorhtml3dir=''
1362 vendorhtml3dir=''
1363 vendorhtml3direxp=''
1364 d_vendorlib=''
1365 installvendorlib=''
1366 vendorlib=''
1367 vendorlib_stem=''
1368 vendorlibexp=''
1369 installvendorman1dir=''
1370 vendorman1dir=''
1371 vendorman1direxp=''
1372 installvendorman3dir=''
1373 vendorman3dir=''
1374 vendorman3direxp=''
1375 usevendorprefix=''
1376 vendorprefix=''
1377 vendorprefixexp=''
1378 d_vendorscript=''
1379 installvendorscript=''
1380 vendorscript=''
1381 vendorscriptexp=''
1382 versiononly=''
1383 yacc=''
1384 yaccflags=''
1385 CONFIG=''
1386
1387 : Detect odd OSs
1388 define='define'
1389 undef='undef'
1390 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1391 rmlist=''
1392
1393 : We must find out about Eunice early
1394 eunicefix=':'
1395 if test -f /etc/unixtovms; then
1396         eunicefix=/etc/unixtovms
1397 fi
1398 if test -f /etc/unixtovms.exe; then
1399         eunicefix=/etc/unixtovms.exe
1400 fi
1401
1402 : Set executable suffix now -- needed before hints available
1403 if test -f "/libs/version.library"; then
1404 : Amiga OS
1405     _exe=""
1406 elif test -f "/system/gnu_library/bin/ar.pm"; then
1407 : Stratus VOS
1408     _exe=".pm"
1409 elif test -n "$DJGPP"; then
1410 : DOS DJGPP
1411     _exe=".exe"
1412 elif test -f /kern/cookiejar; then
1413 : MiNT
1414     _exe=""
1415 elif test -d c:/. -o -n "$is_os2" ; then
1416 : OS/2 or cygwin
1417     _exe=".exe"
1418 fi
1419
1420 groupstype=''
1421 i_whoami=''
1422 : Possible local include directories to search.
1423 : Set locincpth to "" in a hint file to defeat local include searches.
1424 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1425 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1426 :
1427 : no include file wanted by default
1428 inclwanted=''
1429
1430 : Enable -DEBUGGING and -DDEBUGGING from the command line
1431 EBUGGING=''
1432 DEBUGGING=''
1433
1434 : Trailing extension.  Override this in a hint file, if needed.
1435 : Extra object files, if any, needed on this platform.
1436 archobjs=''
1437 libnames=''
1438 : change the next line if compiling for Xenix/286 on Xenix/386
1439 xlibpth='/usr/lib/386 /lib/386'
1440 : Possible local library directories to search.
1441 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1442 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1443
1444 : general looking path for locating libraries
1445 glibpth="/lib /usr/lib $xlibpth"
1446 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1447 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1448 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1449 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1450
1451 : Private path used by Configure to find libraries.  Its value
1452 : is prepended to libpth. This variable takes care of special
1453 : machines, like the mips.  Usually, it should be empty.
1454 plibpth=''
1455
1456 : default library list
1457 libswanted=''
1458 : some systems want to use only the non-versioned libso:s
1459 ignore_versioned_solibs=''
1460 ccname=''
1461 ccversion=''
1462 perllibs=''
1463 : set useposix=false in your hint file to disable the POSIX extension.
1464 useposix=true
1465 : set useopcode=false in your hint file to disable the Opcode extension.
1466 useopcode=true
1467 archname64=''
1468 ccflags_uselargefiles=''
1469 ldflags_uselargefiles=''
1470 libswanted_uselargefiles=''
1471 : set usemultiplicity on the Configure command line to enable multiplicity.
1472 : set usesocks on the Configure command line to enable socks.
1473 archname=''
1474 : set usethreads on the Configure command line to enable threads.
1475 usereentrant='undef'
1476 : List of libraries we want.
1477 : If anyone needs extra -lxxx, put those in a hint file.
1478 libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
1479 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1480 : We probably want to search /usr/shlib before most other libraries.
1481 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1482 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1483 glibpth="/usr/shlib $glibpth"
1484 : Do not use vfork unless overridden by a hint file.
1485 usevfork=false
1486
1487 : Find the basic shell for Bourne shell scripts
1488 case "$sh" in
1489 '')
1490         case "$SYSTYPE" in
1491         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1492         *) xxx='/bin/sh';;
1493         esac
1494         if test -f "$xxx"; then
1495                 sh="$xxx"
1496         else
1497                 : Build up a list and do a single loop so we can 'break' out.
1498                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1499                 for xxx in sh bash ksh pdksh ash; do
1500                         for p in $pth; do
1501                                 try="$try ${p}/${xxx}"
1502                         done
1503                 done
1504                 for xxx in $try; do
1505                         if test -f "$xxx"; then
1506                                 sh="$xxx";
1507                                 break
1508                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1509                                 sh="$xxx";
1510                                 break
1511                         elif test -f "$xxx.exe"; then
1512                                 sh="$xxx";
1513                                 break
1514                         fi
1515                 done
1516         fi
1517         ;;
1518 esac
1519
1520 case "$sh" in
1521 '')     cat >&2 <<EOM
1522 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1523
1524 Usually it's in /bin/sh.  How did you even get this far?
1525 Please contact me (Perl Maintainers) at perlbug@perl.org and
1526 we'll try to straighten this all out.
1527 EOM
1528         exit 1
1529         ;;
1530 esac
1531
1532 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1533 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1534 targetsh=$sh
1535
1536 : see if sh knows # comments
1537 if `$sh -c '#' >/dev/null 2>&1`; then
1538         shsharp=true
1539         spitshell=cat
1540         xcat=/bin/cat
1541         test -f $xcat$_exe || xcat=/usr/bin/cat
1542         if test ! -f $xcat$_exe; then
1543                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1544                         if test -f $p/cat$_exe; then
1545                                 xcat=$p/cat
1546                                 break
1547                         fi
1548                 done
1549                 if test ! -f $xcat$_exe; then
1550                         echo "Can't find cat anywhere!"
1551                         exit 1
1552                 fi
1553         fi
1554         echo "#!$xcat" >sharp
1555         $eunicefix sharp
1556         chmod +x sharp
1557         ./sharp > today 2>/dev/null
1558         if test -s today; then
1559                 sharpbang='#!'
1560         else
1561                 echo "#! $xcat" > sharp
1562                 $eunicefix sharp
1563                 chmod +x sharp
1564                 ./sharp > today 2>/dev/null
1565                 if test -s today; then
1566                         sharpbang='#! '
1567                 else
1568                         sharpbang=': use '
1569                 fi
1570         fi
1571 else
1572         echo " "
1573         echo "Your $sh doesn't grok # comments--I will strip them later on."
1574         shsharp=false
1575         cd ..
1576         echo "exec grep -v '^[  ]*#'" >spitshell
1577         chmod +x spitshell
1578         $eunicefix spitshell
1579         spitshell=`pwd`/spitshell
1580         cd UU
1581         echo "I presume that if # doesn't work, #! won't work either!"
1582         sharpbang=': use '
1583 fi
1584 rm -f sharp today
1585
1586 : figure out how to guarantee sh startup
1587 case "$startsh" in
1588 '') startsh=${sharpbang}${sh} ;;
1589 *)
1590 esac
1591 cat >sharp <<EOSS
1592 $startsh
1593 set abc
1594 test "$?abc" != 1
1595 EOSS
1596
1597 chmod +x sharp
1598 $eunicefix sharp
1599 if ./sharp; then
1600         : echo "Yup, it does."
1601 else
1602         echo "Hmm... '$startsh' does not guarantee sh startup..."
1603         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1604 fi
1605 rm -f sharp
1606
1607 : Save command line options in file UU/cmdline.opt for later use in
1608 : generating config.sh.
1609 cat > cmdline.opt <<EOSH
1610 : Configure command line arguments.
1611 config_arg0='$0'
1612 config_args='$*'
1613 config_argc=$#
1614 EOSH
1615 argn=1
1616 args_exp=''
1617 args_sep=''
1618 for arg in "$@"; do
1619         cat >>cmdline.opt <<EOSH
1620 config_arg$argn='$arg'
1621 EOSH
1622         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1623 $arg
1624 EOC
1625         arg_exp=`cat cmdl.opt`
1626         args_exp="$args_exp$args_sep'$arg_exp'"
1627         argn=`expr $argn + 1`
1628         args_sep=' '
1629 done
1630 rm -f cmdl.opt
1631
1632 : produce awk script to parse command line options
1633 cat >options.awk <<'EOF'
1634 BEGIN {
1635         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1636
1637         len = length(optstr);
1638         for (i = 1; i <= len; i++) {
1639                 c = substr(optstr, i, 1);
1640                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1641                 if (a == ":") {
1642                         arg[c] = 1;
1643                         i++;
1644                 }
1645                 opt[c] = 1;
1646         }
1647 }
1648 {
1649         expect = 0;
1650         str = $0;
1651         if (substr(str, 1, 1) != "-") {
1652                 printf("'%s'\n", str);
1653                 next;
1654         }
1655         len = length($0);
1656         for (i = 2; i <= len; i++) {
1657                 c = substr(str, i, 1);
1658                 if (!opt[c]) {
1659                         printf("-%s\n", substr(str, i));
1660                         next;
1661                 }
1662                 printf("-%s\n", c);
1663                 if (arg[c]) {
1664                         if (i < len)
1665                                 printf("'%s'\n", substr(str, i + 1));
1666                         else
1667                                 expect = 1;
1668                         next;
1669                 }
1670         }
1671 }
1672 END {
1673         if (expect)
1674                 print "?";
1675 }
1676 EOF
1677
1678 : process the command line options
1679 set X `for arg in "$@"; do echo "X$arg"; done |
1680         sed -e s/X// | awk -f options.awk`
1681 eval "set $*"
1682 shift
1683 rm -f options.awk
1684
1685 : set up default values
1686 fastread=''
1687 reuseval=false
1688 config_sh=''
1689 alldone=''
1690 error=''
1691 silent=''
1692 extractsh=''
1693 knowitall=''
1694 rm -f optdef.sh posthint.sh
1695 cat >optdef.sh <<EOS
1696 $startsh
1697 EOS
1698
1699
1700 : option parsing
1701 while test $# -gt 0; do
1702         case "$1" in
1703         -d) shift; fastread=yes;;
1704         -e) shift; alldone=cont;;
1705         -f)
1706                 shift
1707                 cd ..
1708                 if test -r "$1"; then
1709                         config_sh="$1"
1710                 else
1711                         echo "$me: cannot read config file $1." >&2
1712                         error=true
1713                 fi
1714                 cd UU
1715                 shift;;
1716         --help|\
1717         -h) shift; error=true;;
1718         -r) shift; reuseval=true;;
1719         -s) shift; silent=true; realsilent=true;;
1720         -E) shift; alldone=exit;;
1721         -K) shift; knowitall=true;;
1722         -O) shift;;
1723         -S) shift; silent=true; extractsh=true;;
1724         -D)
1725                 shift
1726                 case "$1" in
1727                 *=)
1728                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1729                         echo "$me: ignoring -D $1" >&2
1730                         ;;
1731                 *=*) echo "$1" | \
1732                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1733                 *) echo "$1='define'" >> optdef.sh;;
1734                 esac
1735                 shift
1736                 ;;
1737         -U)
1738                 shift
1739                 case "$1" in
1740                 *=) echo "$1" >> optdef.sh;;
1741                 *=*)
1742                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1743                         echo "$me: ignoring -U $1" >&2
1744                         ;;
1745                 *) echo "$1='undef'" >> optdef.sh;;
1746                 esac
1747                 shift
1748                 ;;
1749         -A)
1750             shift
1751             xxx=''
1752             yyy="$1"
1753             zzz=''
1754             uuu=undef
1755             case "$yyy" in
1756             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1757                  case "$zzz" in
1758                  *:*) zzz='' ;;
1759                  *)   xxx=append
1760                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1761                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1762                  esac
1763                  ;;
1764             esac
1765             case "$xxx" in
1766             '')  case "$yyy" in
1767                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1768                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1769                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1770                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1771                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1772                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1773                  esac
1774                  ;;
1775             esac
1776             case "$xxx" in
1777             append)
1778                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1779             clear)
1780                 echo "$yyy=''"                  >> posthint.sh ;;
1781             define)
1782                 case "$zzz" in
1783                 '') zzz=define ;;
1784                 esac
1785                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1786             eval)
1787                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1788             prepend)
1789                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1790             undef)
1791                 case "$zzz" in
1792                 '') zzz="$uuu" ;;
1793                 esac
1794                 echo "$yyy=$zzz"                >> posthint.sh ;;
1795             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1796             esac
1797             shift
1798             ;;
1799         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1800             exit 0;;
1801         --) break;;
1802         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1803         *) break;;
1804         esac
1805 done
1806
1807 case "$error" in
1808 true)
1809         cat >&2 <<EOM
1810 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1811                  [-U symbol] [-U symbol=] [-A command:symbol...]
1812   -d : use defaults for all answers.
1813   -e : go on without questioning past the production of config.sh.
1814   -f : specify an alternate default configuration file.
1815   -h : print this help message and exit (with an error status).
1816   -r : reuse C symbols value if possible (skips costly nm extraction).
1817   -s : silent mode, only echoes questions and essential information.
1818   -D : define symbol to have some value:
1819          -D symbol         symbol gets the value 'define'
1820          -D symbol=value   symbol gets the value 'value'
1821        common used examples (see INSTALL for more info):
1822          -Duse64bitint            use 64bit integers
1823          -Duse64bitall            use 64bit integers and pointers
1824          -Dusethreads             use thread support
1825          -Dinc_version_list=none  do not include older perl trees in @INC
1826          -DEBUGGING=none          DEBUGGING options
1827          -Dcc=gcc                 choose your compiler
1828          -Dprefix=/opt/perl5      choose your destination
1829   -E : stop at the end of questions, after having produced config.sh.
1830   -K : do not use unless you know what you are doing.
1831   -O : ignored for backward compatibility
1832   -S : perform variable substitutions on all .SH files (can mix with -f)
1833   -U : undefine symbol:
1834          -U symbol    symbol gets the value 'undef'
1835          -U symbol=   symbol gets completely empty
1836        e.g.:  -Uversiononly
1837   -A : manipulate symbol after the platform specific hints have been applied:
1838          -A append:symbol=value   append value to symbol
1839          -A symbol=value          like append:, but with a separating space
1840          -A define:symbol=value   define symbol to have value
1841          -A clear:symbol          define symbol to be ''
1842          -A define:symbol         define symbol to be 'define'
1843          -A eval:symbol=value     define symbol to be eval of value
1844          -A prepend:symbol=value  prepend value to symbol
1845          -A undef:symbol          define symbol to be 'undef'
1846          -A undef:symbol=         define symbol to be ''
1847        e.g.:  -A prepend:libswanted='cl pthread '
1848               -A ccflags=-DSOME_MACRO
1849   -V : print version number and exit (with a zero status).
1850 EOM
1851         exit 1
1852         ;;
1853 esac
1854
1855 : Sanity checks
1856 case "$fastread$alldone" in
1857 yescont|yesexit) ;;
1858 *)
1859         case "$extractsh" in
1860         true) ;;
1861         *)
1862                 if test ! -t 0; then
1863                         echo "Say 'sh Configure', not 'sh <Configure'"
1864                         exit 1
1865                 fi
1866                 ;;
1867         esac
1868         ;;
1869 esac
1870
1871 exec 4>&1
1872 case "$silent" in
1873 true) exec 1>/dev/null;;
1874 esac
1875
1876 : run the defines and the undefines, if any, but leave the file out there...
1877 touch optdef.sh
1878 grep '\\' optdef.sh >/dev/null 2>&1
1879 if test $? = 0; then
1880     echo "Configure does not support \\ in -D arguments"
1881     exit 1
1882 fi
1883 . ./optdef.sh
1884 : create the posthint manipulation script and leave the file out there...
1885 touch posthint.sh
1886
1887 : set package name
1888 package='perl5'
1889 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1890 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1891 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1892 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1893 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1894 esac
1895
1896 : Some greps do not return status, grrr.
1897 echo "grimblepritz" >grimble
1898 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1899         contains=contains
1900 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1901         contains=grep
1902 else
1903         contains=contains
1904 fi
1905 rm -f grimble
1906 : the following should work in any shell
1907 case "$contains" in
1908 contains*)
1909         echo " "
1910         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1911         cat >contains <<'EOSS'
1912 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1913 EOSS
1914 chmod +x contains
1915 esac
1916
1917 : Find the path to the source tree
1918 case "$src" in
1919 '') case "$0" in
1920     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1921          case "$src" in
1922          /*)    ;;
1923          .)     ;;
1924          *)     src=`cd ../$src && pwd` ;;
1925          esac
1926          ;;
1927     *)   src='.';;
1928     esac;;
1929 esac
1930 case "$src" in
1931 '')     src=/
1932         rsrc=/
1933         ;;
1934 /*)     rsrc="$src";;
1935 *)      rsrc="../$src";;
1936 esac
1937 if test -f $rsrc/Configure && \
1938         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1939 then
1940    : found it, so we are ok.
1941 else
1942         rsrc=''
1943         for src in . .. ../.. ../../.. ../../../..; do
1944                 if test -f ../$src/Configure && \
1945                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1946                 then
1947                         rsrc=../$src
1948                         break
1949                 fi
1950         done
1951 fi
1952 case "$rsrc" in
1953 '')
1954         cat <<EOM >&4
1955
1956 Sorry, I can't seem to locate the source dir for $package.  Please start
1957 Configure with an explicit path -- i.e. /some/path/Configure.
1958
1959 EOM
1960         exit 1
1961         ;;
1962 ../.)   rsrc='..';;
1963 *)
1964         echo " "
1965         echo "Sources for $package found in \"$src\"." >&4
1966         ;;
1967 esac
1968
1969 : script used to extract .SH files with variable substitutions
1970 cat >extract <<'EOS'
1971 PERL_CONFIG_SH=true
1972 echo "Doing variable substitutions on .SH files..."
1973 if test -f MANIFEST; then
1974         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1975 else
1976         echo "(Looking for .SH files under the source directory.)"
1977         set x `(cd "$src"; find . -name "*.SH" -print)`
1978 fi
1979 shift
1980 case $# in
1981 0) set x `(cd "$src"; echo *.SH)`; shift;;
1982 esac
1983 if test ! -f "$src/$1"; then
1984         shift
1985 fi
1986 mkdir_p='
1987 name=$1;
1988 create="";
1989 while test $name; do
1990         if test ! -d "$name"; then
1991                 create="$name $create";
1992                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1993                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1994         else
1995                 name="";
1996         fi;
1997 done;
1998 for file in $create; do
1999         mkdir $file;
2000 done
2001 '
2002 for file in $*; do
2003         case "$src" in
2004         ".")
2005                 case "$file" in
2006                 */*)
2007                         dir=`expr X$file : 'X\(.*\)/'`
2008                         file=`expr X$file : 'X.*/\(.*\)'`
2009                         (cd "$dir" && . ./$file)
2010                         ;;
2011                 *)
2012                         . ./$file
2013                         ;;
2014                 esac
2015                 ;;
2016         *)
2017                 case "$file" in
2018                 */*)
2019                         dir=`expr X$file : 'X\(.*\)/'`
2020                         file=`expr X$file : 'X.*/\(.*\)'`
2021                         (set x $dir; shift; eval $mkdir_p)
2022                         sh <"$src/$dir/$file"
2023                         ;;
2024                 *)
2025                         sh <"$src/$file"
2026                         ;;
2027                 esac
2028                 ;;
2029         esac
2030 done
2031 if test -f "$src/config_h.SH"; then
2032         if test ! -f config.h; then
2033         : oops, they left it out of MANIFEST, probably, so do it anyway.
2034         . "$src/config_h.SH"
2035         fi
2036 fi
2037 EOS
2038
2039 : extract files and exit if asked to do so
2040 case "$extractsh" in
2041 true)
2042         case "$realsilent" in
2043         true) ;;
2044         *) exec 1>&4;;
2045         esac
2046         case "$config_sh" in
2047         '') config_sh='config.sh';;
2048         esac
2049         echo " "
2050         echo "Fetching answers from $config_sh..."
2051         cd ..
2052         . $config_sh
2053         . UU/optdef.sh
2054         echo " "
2055         . UU/extract
2056         rm -rf UU
2057         echo "Extraction done."
2058         exit 0
2059         ;;
2060 esac
2061
2062 : Eunice requires " " instead of "", can you believe it
2063 echo " "
2064 : Here we go...
2065 echo "Beginning of configuration questions for $package."
2066
2067 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2068
2069 : first determine how to suppress newline on echo command
2070 echo " "
2071 echo "Checking echo to see how to suppress newlines..."
2072 (echo "hi there\c" ; echo " ") >.echotmp
2073 if $contains c .echotmp >/dev/null 2>&1 ; then
2074         echo "...using -n."
2075         n='-n'
2076         c=''
2077 else
2078         cat <<'EOM'
2079 ...using \c
2080 EOM
2081         n=''
2082         c='\c'
2083 fi
2084 echo $n "The star should be here-->$c"
2085 echo '*'
2086 rm -f .echotmp
2087
2088 : Now test for existence of everything in MANIFEST
2089 echo " "
2090 if test -f "$rsrc/MANIFEST"; then
2091         echo "First let's make sure your kit is complete.  Checking..." >&4
2092         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2093                 (split -l 50 2>/dev/null || split -50)
2094         rm -f missing
2095         tmppwd=`pwd`
2096         for filelist in x??; do
2097                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2098                         >/dev/null 2>>"$tmppwd/missing")
2099         done
2100         if test -s missing; then
2101                 cat missing >&4
2102                 cat >&4 <<'EOM'
2103
2104 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2105
2106 You have the option of continuing the configuration process, despite the
2107 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2108 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2109 and contact the author (perlbug@perl.org).
2110
2111 EOM
2112                 echo $n "Continue? [n] $c" >&4
2113                 read ans
2114                 case "$ans" in
2115                 y*)
2116                         echo "Continuing..." >&4
2117                         rm -f missing
2118                         ;;
2119                 *)
2120                         echo "ABORTING..." >&4
2121                         kill $$
2122                         ;;
2123                 esac
2124         else
2125                 echo "Looks good..."
2126         fi
2127 else
2128         echo "There is no MANIFEST file.  I hope your kit is complete !"
2129 fi
2130 rm -f missing x??
2131
2132 : Find the appropriate value for a newline for tr
2133 if test -n "$DJGPP"; then
2134        trnl='\012'
2135 fi
2136 if test X"$trnl" = X; then
2137         case "`echo foo | tr '\n' x 2>/dev/null`" in
2138         foox) trnl='\n' ;;
2139         esac
2140 fi
2141 if test X"$trnl" = X; then
2142         case "`echo foo | tr '\012' x 2>/dev/null`" in
2143         foox) trnl='\012' ;;
2144         esac
2145 fi
2146 if test X"$trnl" = X; then
2147        case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
2148        fooxy) trnl='\n\r' ;;
2149        esac
2150 fi
2151 if test X"$trnl" = X; then
2152         cat <<EOM >&2
2153
2154 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2155
2156 EOM
2157         exit 1
2158 fi
2159
2160 : compute the number of columns on the terminal for proper question formatting
2161 case "$COLUMNS" in
2162 '') COLUMNS='80';;
2163 esac
2164
2165 : set up the echo used in my read
2166 myecho="case \"\$xxxm\" in
2167 '') echo $n \"\$rp $c\" >&4;;
2168 *) case \"\$rp\" in
2169         '') echo $n \"[\$xxxm] $c\";;
2170         *)
2171                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2172                         echo \"\$rp\" >&4
2173                         echo $n \"[\$xxxm] $c\" >&4
2174                 else
2175                         echo $n \"\$rp [\$xxxm] $c\" >&4
2176                 fi
2177                 ;;
2178         esac;;
2179 esac"
2180
2181 : now set up to do reads with possible shell escape and default assignment
2182 cat <<EOSC >myread
2183 $startsh
2184 xxxm=\$dflt
2185 $myecho
2186 ans='!'
2187 case "\$fastread" in
2188 yes) case "\$dflt" in
2189         '') ;;
2190         *) ans='';
2191                 case "\$silent-\$rp" in
2192                 true-) ;;
2193                 *) echo " " >&4;;
2194                 esac;;
2195         esac;;
2196 *) case "\$silent" in
2197         true) case "\$rp" in
2198                 '') ans='';;
2199                 esac;;
2200         esac;;
2201 esac
2202 while expr "X\$ans" : "X!" >/dev/null; do
2203         read answ
2204         set x \$xxxm
2205         shift
2206         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2207         case  "\$answ" in
2208         "!")
2209                 sh 1>&4
2210                 echo " "
2211                 $myecho
2212                 ;;
2213         !*)
2214                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2215                 shift
2216                 sh 1>&4 -c "\$*"
2217                 echo " "
2218                 $myecho
2219                 ;;
2220         "\$ans")
2221                 case "\$ans" in
2222                 \\&*)
2223                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2224                         shift
2225                         case "\$1" in
2226                         -d)
2227                                 fastread=yes
2228                                 echo "(OK, I'll run with -d after this question.)" >&4
2229                                 ;;
2230                         -*)
2231                                 echo "*** Sorry, \$1 not supported yet." >&4
2232                                 ;;
2233                         esac
2234                         $myecho
2235                         ans=!
2236                         ;;
2237                 esac;;
2238         *)
2239                 case "\$aok" in
2240                 y)
2241                         echo "*** Substitution done -- please confirm."
2242                         xxxm="\$ans"
2243                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2244                         xxxm="\$ans"
2245                         ans=!
2246                         ;;
2247                 *)
2248                         echo "*** Error -- try again."
2249                         ans=!
2250                         ;;
2251                 esac
2252                 $myecho
2253                 ;;
2254         esac
2255         case "\$ans\$xxxm\$nostick" in
2256         '')
2257                 ans=!
2258                 $myecho
2259                 ;;
2260         esac
2261 done
2262 case "\$ans" in
2263 '') ans="\$xxxm";;
2264 esac
2265 EOSC
2266
2267 : create .config dir to save info across Configure sessions
2268 test -d ../.config || mkdir ../.config
2269 cat >../.config/README <<EOF
2270 This directory created by Configure to save information that should
2271 persist across sessions for $package.
2272
2273 You may safely delete it if you wish.
2274 EOF
2275
2276 : See if we are using a devel version and want that
2277 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2278 case "$usedevel" in
2279 $define|true|[yY]*)
2280     usedevel="$define" ;;
2281 *) case "$xversion" in
2282    *[13579])
2283         cat >&4 <<EOH
2284 *** WHOA THERE!!! ***
2285
2286     This is an UNSTABLE DEVELOPMENT release.
2287     The version of this $package distribution is $xversion, that is, odd,
2288     (as opposed to even) and that signifies a development release.
2289     If you want a maintenance release, you want an even-numbered version.
2290
2291     Do ***NOT*** install this into production use.
2292     Data corruption and crashes are possible.
2293
2294     It is most seriously suggested that you do not continue any further
2295     unless you want to help in developing and debugging Perl.
2296
2297     If you *still* want to build perl, you can answer 'y' now,
2298     or pass -Dusedevel to Configure.
2299
2300 EOH
2301         rp='Do you really want to continue?'
2302         dflt='n'
2303         . ./myread
2304         case "$ans" in
2305         [yY]) echo >&4 "Okay, continuing."
2306               usedevel="$define" ;;
2307         *) echo >&4 "Okay, bye."
2308            exit 1
2309            ;;
2310         esac
2311         ;;
2312     esac
2313     usedevel="$undef"
2314     ;;
2315 esac
2316 case "$usedevel" in
2317 $define|true|[yY]*)
2318         case "$versiononly" in
2319         '') versiononly="$define" ;;
2320         esac
2321         case "$installusrbinperl" in
2322         '') installusrbinperl="$undef" ;;
2323         esac
2324         ;;
2325 esac
2326
2327 : general instructions
2328 needman=true
2329 firsttime=true
2330 user=`(logname) 2>/dev/null`
2331 case "$user" in
2332 '') user=`whoami 2>&1`;;
2333 esac
2334 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2335         firsttime=false
2336         echo " "
2337         rp='Would you like to see the instructions?'
2338         dflt=n
2339         . ./myread
2340         case "$ans" in
2341         [yY]*) ;;
2342         *) needman=false;;
2343         esac
2344 fi
2345 if $needman; then
2346         cat <<EOH
2347
2348 This installation shell script will examine your system and ask you questions
2349 to determine how the perl5 package should be installed. If you get
2350 stuck on a question, you may use a ! shell escape to start a subshell or
2351 execute a command.  Many of the questions will have default answers in square
2352 brackets; typing carriage return will give you the default.
2353
2354 On some of the questions which ask for file or directory names you are allowed
2355 to use the ~name construct to specify the login directory belonging to "name",
2356 even if you don't have a shell which knows about that.  Questions where this is
2357 allowed will be marked "(~name ok)".
2358
2359 EOH
2360         rp=''
2361         dflt='Type carriage return to continue'
2362         . ./myread
2363         cat <<'EOH'
2364
2365 The prompter used in this script allows you to use shell variables and
2366 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2367 in the default answer, as if the default line was a set of arguments given to a
2368 script shell.  This means you may also use $* to repeat the whole default line,
2369 so you do not have to re-type everything to add something to the default.
2370
2371 Every time there is a substitution, you will have to confirm.  If there is an
2372 error (e.g. an unmatched backtick), the default answer will remain unchanged
2373 and you will be prompted again.
2374
2375 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2376 the questions and use the computed defaults (or the previous answers if there
2377 was already a config.sh file). Type 'Configure -h' for a list of options.
2378 You may also start interactively and then answer '& -d' at any prompt to turn
2379 on the non-interactive behaviour for the remainder of the execution.
2380
2381 EOH
2382         . ./myread
2383         cat <<EOH
2384
2385 Much effort has been expended to ensure that this shell script will run on any
2386 Unix system.  If despite that it blows up on yours, your best bet is to edit
2387 Configure and run it again.  If you can't run Configure for some reason,
2388 you'll have to generate a config.sh file by hand.  Whatever problems you
2389 have, let me (perlbug@perl.org) know how I blew it.
2390
2391 This installation script affects things in two ways:
2392
2393 1) it may do direct variable substitutions on some of the files included
2394    in this kit.
2395 2) it builds a config.h file for inclusion in C programs.  You may edit
2396    any of these files as the need arises after running this script.
2397
2398 If you make a mistake on a question, there is no easy way to back up to it
2399 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2400 files.  Configure will offer to let you do this before it runs the SH files.
2401
2402 EOH
2403         dflt='Type carriage return to continue'
2404         . ./myread
2405         case "$firsttime" in
2406         true) echo $user >>../.config/instruct;;
2407         esac
2408 fi
2409
2410 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2411 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2412 if test "X$sysroot" = X; then
2413     sysroot=""
2414 else
2415     case "$cc" in
2416         *gcc*|*g++*)
2417             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2418             # _sysroot is used in places where we need --sysroot=foo
2419             # but using the rest of the flags could cause issues.
2420             _sysroot="--sysroot=$sysroot";
2421             case "$ccflags" in
2422                 *sysroot*) ;;
2423                 'undef'|*)
2424                 ccflags="$ccflags $_sysroot"
2425             esac
2426             case "$ldflags" in
2427                 *sysroot*) ;;
2428                 'undef'|*)
2429                 ldflags="$ldflags $_sysroot"
2430             esac
2431             case "$cppflags" in
2432                 *sysroot*) ;;
2433                 'undef'|*)
2434                 cppflags="$cppflags $_sysroot"
2435             esac
2436             # lddlflags updated below in lddlflags section;
2437             # same with cccdlflags
2438             ;;
2439     esac
2440
2441     # Adjust some defaults to also use $sysroot
2442     for var in xlibpth loclibpth locincpth glibpth; do
2443         eval xxx=\$$var
2444         eval $var=''
2445         for path in $xxx; do
2446             eval $var=\"\$$var $sysroot$path\"
2447         done
2448     done
2449
2450 fi
2451
2452 : find out where common programs are
2453 echo " "
2454 echo "Locating common programs..." >&4
2455 cat <<EOSC >loc
2456 $startsh
2457 case \$# in
2458 0) exit 1;;
2459 esac
2460 thing=\$1
2461 shift
2462 dflt=\$1
2463 shift
2464 for dir in \$*; do
2465         case "\$thing" in
2466         .)
2467         if test -d \$dir/\$thing; then
2468                 echo \$dir
2469                 exit 0
2470         fi
2471         ;;
2472         *)
2473         for thisthing in \$dir/\$thing; do
2474                 : just loop through to pick last item
2475         done
2476         if test -f \$thisthing; then
2477                 echo \$thisthing
2478                 exit 0
2479         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2480                 echo \$thisthing
2481                 exit 0
2482         elif test -f \$dir/\$thing.exe; then
2483                 if test -n "$DJGPP"; then
2484                         echo \$dir/\$thing.exe
2485                 elif test "$eunicefix" != ":"; then
2486                         : on Eunice apparently
2487                         echo \$dir/\$thing
2488                 fi
2489                 exit 0
2490         fi
2491         ;;
2492         esac
2493 done
2494 echo \$dflt
2495 exit 1
2496 EOSC
2497 chmod +x loc
2498 $eunicefix loc
2499 loclist="
2500 awk
2501 cat
2502 chmod
2503 comm
2504 cp
2505 echo
2506 expr
2507 grep
2508 ls
2509 mkdir
2510 rm
2511 sed
2512 sort
2513 touch
2514 tr
2515 uniq
2516 "
2517 trylist="
2518 ar
2519 bison
2520 byacc
2521 cpp
2522 csh
2523 date
2524 egrep
2525 gmake
2526 gzip
2527 less
2528 ln
2529 make
2530 more
2531 nm
2532 nroff
2533 perl
2534 pg
2535 test
2536 uname
2537 zip
2538 "
2539 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2540 pth="$pth $sysroot/lib $sysroot/usr/lib"
2541 for file in $loclist; do
2542         eval xxx=\$$file
2543         case "$xxx" in
2544         /*|?:[\\/]*)
2545                 if test -f "$xxx"; then
2546                         : ok
2547                 else
2548                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2549                         xxx=`./loc $file $file $pth`
2550                 fi
2551                 ;;
2552         '') xxx=`./loc $file $file $pth`;;
2553         *) xxx=`./loc $xxx $xxx $pth`;;
2554         esac
2555         eval $file=$xxx$_exe
2556         eval _$file=$xxx
2557         case "$xxx" in
2558         /*)
2559                 echo $file is in $xxx.
2560                 ;;
2561         ?:[\\/]*)
2562                 echo $file is in $xxx.
2563                 ;;
2564         *)
2565                 echo "I don't know where '$file' is, and my life depends on it." >&4
2566                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2567                 exit 1
2568                 ;;
2569         esac
2570 done
2571 echo " "
2572 echo "Don't worry if any of the following aren't found..."
2573 say=offhand
2574 for file in $trylist; do
2575         eval xxx=\$$file
2576         case "$xxx" in
2577         /*|?:[\\/]*)
2578                 if test -f "$xxx"; then
2579                         : ok
2580                 else
2581                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2582                         xxx=`./loc $file $file $pth`
2583                 fi
2584                 ;;
2585         '') xxx=`./loc $file $file $pth`;;
2586         *) xxx=`./loc $xxx $xxx $pth`;;
2587         esac
2588         eval $file=$xxx$_exe
2589         eval _$file=$xxx
2590         case "$xxx" in
2591         /*)
2592                 echo $file is in $xxx.
2593                 ;;
2594         ?:[\\/]*)
2595                 echo $file is in $xxx.
2596                 ;;
2597         *)
2598                 echo "I don't see $file out there, $say."
2599                 say=either
2600                 ;;
2601         esac
2602 done
2603 case "$egrep" in
2604 egrep)
2605         echo "Substituting grep for egrep."
2606         egrep=$grep
2607         _egrep=$grep
2608         ;;
2609 esac
2610 case "$less" in
2611 '')     ;;
2612 *)      if $less -R </dev/null >/dev/null 2>&1; then
2613                echo "Substituting less -R for less."
2614                less="$less -R"
2615                _less=$less
2616         fi
2617         ;;
2618 esac
2619 case "$ln" in
2620 ln)
2621         echo "Substituting cp for ln."
2622         ln=$cp
2623         _ln=$cp
2624         ;;
2625 esac
2626 case "$make" in
2627 make)
2628         case "$gmake" in
2629         gmake)
2630         echo "I can't find make or gmake, and my life depends on it." >&4
2631         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2632         exit 1
2633         ;;
2634         esac
2635         ;;
2636 esac
2637 case "$gmake" in
2638 gmake)  ;;
2639 *)      # We can't have osname yet.
2640         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2641                 # Assume that gmake, if found, is definitely GNU make
2642                 # and prefer it over the system make.
2643                 echo "Substituting gmake for make."
2644                 make=$gmake
2645                 _make=$gmake
2646         fi
2647         ;;
2648 esac
2649 case "$test" in
2650 test)
2651         echo "Hopefully test is built into your sh."
2652         ;;
2653 *)
2654         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2655                 echo "Using the test built into your sh."
2656                 test=test
2657                 _test=test
2658         fi
2659         ;;
2660 esac
2661 case "$echo" in
2662 echo)
2663         echo "Hopefully echo is built into your sh."
2664         ;;
2665 '') ;;
2666 *)
2667         echo " "
2668 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2669         $echo $n "hi there$c" >foo1
2670         echo $n "hi there$c" >foo2
2671         if cmp foo1 foo2 >/dev/null 2>&1; then
2672                 echo "They are compatible.  In fact, they may be identical."
2673         else
2674                 case "$n" in
2675                 '-n') n='' c='\c';;
2676                 *) n='-n' c='';;
2677                 esac
2678                 cat <<FOO
2679 They are not compatible!  You are probably running ksh on a non-USG system.
2680 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2681 have echo built in and we may have to run some Bourne shell scripts.  That
2682 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2683
2684 FOO
2685                 $echo $n "The star should be here-->$c"
2686                 $echo "*"
2687         fi
2688         $rm -f foo1 foo2
2689         ;;
2690 esac
2691
2692 # This question was auctioned at YAPC::Europe-2007 in Vienna
2693 # I never promised you could answer it. I only auctioned the question.
2694 cat <<FOO
2695 The following message is sponsored by
2696
2697   Dresden.pm<--The stars should be here.
2698
2699 Dear Perl user, system administrator or package
2700 maintainer, the Perl community sends greetings to
2701 you. Do you (emblematical) greet back [Y/n]? n
2702
2703 FOO
2704
2705 : Check what type of C compiler we use
2706 cat <<EOS >trygcc
2707 $startsh
2708 EOS
2709 cat <<'EOSC' >>trygcc
2710 case "$cc" in
2711 '') ;;
2712 *)  $rm -f try try.*
2713     $cat >try.c <<EOM
2714 int main(int argc, char *argv[]) {
2715   return 0;
2716 }
2717 EOM
2718     if $cc -o try $ccflags $ldflags try.c; then
2719        :
2720     else
2721         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2722         despair=yes
2723         trygcc=yes
2724         case "$cc" in
2725         *gcc*) trygcc=no ;;
2726         esac
2727         # Skip this test because it gives a false match on output like:
2728         #    ./trygcc: line 23: cc: command not found
2729         # case "`$cc -v -c try.c 2>&1`" in
2730         # *gcc*) trygcc=no ;;
2731         # esac
2732         if $test X"$trygcc" = Xyes; then
2733             if gcc -o try -c try.c; then
2734                 echo " "
2735                 echo "You seem to have a working gcc, though." >&4
2736                 # Switching compilers may undo the work of hints files.
2737                 # The most common problem is -D_REENTRANT for threads.
2738                 # This heuristic catches that case, but gets false positives
2739                 # if -Dusethreads was not actually specified.  Better to
2740                 # bail out here with a useful message than fail
2741                 # mysteriously later. Should we perhaps just try to
2742                 # re-invoke Configure -Dcc=gcc config_args ?
2743                 if $test -f usethreads.cbu; then
2744                         $cat >&4 <<EOM
2745
2746 *** However, any setting of the C compiler flags (e.g. for thread support)
2747 *** will be lost.  It may be necessary for you to restart Configure and
2748 *** add -Dcc=gcc to your Configure command line.
2749
2750 EOM
2751                         rp="Would you like to go ahead and try gcc anyway?"
2752                         dflt=n
2753                 else
2754                         rp="Would you like to use it?"
2755                         dflt=y
2756                 fi
2757                 if $test -f myread; then
2758                     . ./myread
2759                 else
2760                     if $test -f UU/myread; then
2761                         . ./UU/myread
2762                     else
2763                         echo "Cannot find myread, sorry.  Aborting." >&2
2764                         exit 1
2765                     fi
2766                 fi
2767                 case "$ans" in
2768                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2769                 esac
2770             fi
2771         fi
2772     fi
2773     $rm -f try try.*
2774     ;;
2775 esac
2776 EOSC
2777
2778 cat <<EOS >checkcc
2779 $startsh
2780 EOS
2781 cat <<'EOSC' >>checkcc
2782 case "$cc" in
2783 '') ;;
2784 *)  $rm -f try try.*
2785     $cat >try.c <<EOM
2786 int main(int argc, char *argv[]) {
2787   return 0;
2788 }
2789 EOM
2790     if $cc -o try $ccflags $ldflags try.c; then
2791        :
2792     else
2793         if $test X"$despair" = Xyes; then
2794            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2795         fi
2796         $cat >&4 <<EOM
2797 You need to find a working C compiler.
2798 Either (purchase and) install the C compiler supplied by your OS vendor,
2799 or for a free C compiler try http://gcc.gnu.org/
2800 I cannot continue any further, aborting.
2801 EOM
2802         exit 1
2803     fi
2804     $rm -f try try.*
2805     ;;
2806 esac
2807 EOSC
2808
2809 : determine whether symbolic links are supported
2810 echo " "
2811 $touch blurfl
2812 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2813         echo "Symbolic links are supported." >&4
2814         lns="$ln -s"
2815 else
2816         echo "Symbolic links are NOT supported." >&4
2817         lns="$ln"
2818 fi
2819 $rm -f blurfl sym
2820
2821 : determine whether symbolic links are supported
2822 echo " "
2823 case "$lns" in
2824 *"ln"*" -s")
2825         echo "Checking how to test for symbolic links..." >&4
2826         $lns blurfl sym
2827         if $test "X$issymlink" = X; then
2828                 case "$newsh" in
2829                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2830                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2831                 esac
2832                 if test $? = 0; then
2833                         issymlink="test -h"
2834                 else
2835                         echo "Your builtin 'test -h' may be broken." >&4
2836                         case "$test" in
2837                         /*)     ;;
2838                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2839                                 for p in $pth
2840                                 do
2841                                         if test -f "$p/$test"; then
2842                                                 test="$p/$test"
2843                                                 break
2844                                         fi
2845                                 done
2846                                 ;;
2847                         esac
2848                         case "$test" in
2849                         /*)
2850                                 echo "Trying external '$test -h'." >&4
2851                                 issymlink="$test -h"
2852                                 if $test ! -h sym >/dev/null 2>&1; then
2853                                         echo "External '$test -h' is broken, too." >&4
2854                                         issymlink=''
2855                                 fi
2856                                 ;;
2857                         *)      issymlink='' ;;
2858                         esac
2859                 fi
2860         fi
2861         if $test "X$issymlink" = X; then
2862                 if $test -L sym 2>/dev/null; then
2863                         issymlink="$test -L"
2864                         echo "The builtin '$test -L' worked." >&4
2865                 fi
2866         fi
2867         if $test "X$issymlink" != X; then
2868                 echo "You can test for symbolic links with '$issymlink'." >&4
2869         else
2870                 echo "I do not know how you can test for symbolic links." >&4
2871         fi
2872         $rm -f blurfl sym
2873         ;;
2874 *)      echo "No symbolic links, so not testing for their testing..." >&4
2875         ;;
2876 esac
2877
2878 : Make symlinks util
2879 case "$mksymlinks" in
2880 $define|true|[yY]*)
2881         case "$src" in
2882         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2883                 exit 1
2884                 ;;
2885         *)      case "$lns:$issymlink" in
2886                 *"ln"*" -s:"*"test -"?)
2887                         echo "Creating the symbolic links..." >&4
2888                         cd ..
2889                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2890                         awk 'NF == 1 {
2891                                 dir=".";
2892                                 file=$1 "";
2893                              }
2894                              NF == 2 {
2895                                 dir=$1 "";
2896                                 file=$2 "";
2897                              }
2898                              {
2899                                  print "# dir = ", dir, "file = ", file
2900                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2901                              } END {
2902                                  for (d in mf) {
2903                                      if (d != ".") { print("mkdir -p "d) }
2904                                      print("ln -sf "mf[d]" "d);
2905                                  }
2906                              }' source="$src" > UU/mksymlinks.$$
2907                         sh UU/mksymlinks.$$
2908                         rm UU/mksymlinks.$$
2909                         # Sanity check 1.
2910                         if test ! -d t/base; then
2911                                 echo "Failed to create the subdirectories.  Aborting." >&4
2912                                 exit 1
2913                         fi
2914                         # Sanity check 2.
2915                         if test ! -f t/base/lex.t; then
2916                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2917                                 exit 1
2918                         fi
2919                         if test ! -f win32/win32.c; then
2920                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2921                                 exit 1
2922                         fi
2923                         cd UU
2924                         ;;
2925                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2926                         ;;
2927                 esac
2928                 ;;
2929         esac
2930         ;;
2931 esac
2932
2933 : Check for Cross-Compilation
2934 if $test "X$targethost" = "X"; then
2935     targethost=""
2936 fi
2937 if $test "X$targetenv" = "X"; then
2938     targetenv=""
2939 fi
2940 case "$usecrosscompile" in
2941 $define|true|[yY]*)
2942         $echo "Cross-compiling..."
2943         croak=''
2944         case "$cc" in
2945         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2946             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2947             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2948             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2949             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2950             # leave out ld, choosing it is more complex
2951             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2952             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2953             # We are in a weird spot. Just before us, some values
2954             # were 'saved', to be restored after the hints are
2955             # run.  This means that the changes we made to ar,
2956             # nm and ranlib will get reverted.
2957             # To avoid that, we hijack the saving mechanism and
2958             # have it save our new values.
2959             for file in ar nm ranlib; do
2960                 eval xxx=\$$file
2961                 eval $file=$xxx$_exe
2962                 eval _$file=$xxx
2963             done
2964         ;;
2965         esac
2966         case "$targetarch" in
2967         '') echo "Targetarch not defined." >&4; croak=y ;;
2968         *)  echo "Using targetarch $targetarch." >&4 ;;
2969         esac
2970         case "$targethost" in
2971         '') echo "Targethost not defined." >&4; croak=n ;;
2972         *)  echo "Using targethost $targethost." >&4
2973         esac
2974         locincpth=' '
2975         loclibpth=' '
2976         case "$croak" in
2977         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2978         esac
2979     : compile a host miniperl and generate_uudmap, unless we got passed them
2980     if $test "X$hostperl" = X; then
2981       echo "Building host miniperl and generate_uudmap binaries" >&4
2982       before_host=`pwd`
2983       cd ..
2984       cd $src
2985       src=`pwd`
2986       rm -rf $src/host
2987       mkdir $src/host
2988       cd $src/host
2989       $src/Configure -des -Dusedevel -Dmksymlinks
2990       $make miniperl
2991       case "$hostgenerate" in
2992       '') $make generate_uudmap
2993           hostgenerate=$src/host/generate_uudmap
2994           ;;
2995        "$undef") hostgenerate=''
2996           ;;
2997       esac
2998       hostperl=$src/host/miniperl
2999       cd $before_host
3000     fi
3001     hostosname=`$hostperl -le 'print $^O'`
3002     ;;
3003 *)
3004     usecrosscompile="$undef"
3005     ;;
3006 esac
3007
3008 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3009 case "$targethost" in
3010     '') echo "Checking for cross-compile" >&4
3011     case "$usecrosscompile$multiarch" in
3012        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3013          if [ -f Makefile ]; then
3014            echo " "
3015            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3016          else
3017            echo "Configure done."
3018          fi
3019        exit 0
3020        ;;
3021      *) echo "No targethost for running compiler tests against defined, running locally" >&4
3022         run=''
3023         to=:
3024         from=:
3025         ;;
3026     esac
3027     ;;
3028     *) echo "Using targethost $targethost." >&4
3029         case "$src" in
3030         /*) run=$src/Cross/run
3031             targetmkdir=$src/Cross/mkdir
3032             to=$src/Cross/to
3033             from=$src/Cross/from
3034             ;;
3035         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3036             run=$pwd/Cross/run
3037             targetmkdir=$pwd/Cross/mkdir
3038             to=$pwd/Cross/to
3039             from=$pwd/Cross/from
3040             ;;
3041         esac
3042         case "$targetrun" in
3043         '') targetrun=ssh ;;
3044         esac
3045         case "$targetto" in
3046         '') targetto=scp ;;
3047         esac
3048         case "$targetfrom" in
3049         '') targetfrom=scp ;;
3050         esac
3051         run=$run-$targetrun
3052         to=$to-$targetto
3053         from=$from-$targetfrom
3054         case "$targetdir" in
3055         '')  targetdir=/tmp
3056              echo "Guessing targetdir $targetdir." >&4
3057              ;;
3058         esac
3059         case "$targetuser" in
3060         '')  targetuser=root
3061              echo "Guessing targetuser $targetuser." >&4
3062              ;;
3063         esac
3064         case "$targetport" in
3065         '')  targetport=22
3066              echo "Guessing targetport $targetport." >&4
3067              ;;
3068         esac
3069         case "$targetfrom" in
3070         scp)    q=-q ;;
3071         *)      q='' ;;
3072         esac
3073         case "$targetrun" in
3074         ssh|rsh)
3075             cat >$run <<EOF
3076 #!/bin/sh
3077 env=''
3078 case "\$1" in
3079 -cwd)
3080   shift
3081   cwd=\$1
3082   shift
3083   ;;
3084 esac
3085 case "\$1" in
3086 -env)
3087   shift
3088   env=\$1
3089   shift
3090   ;;
3091 esac
3092 case "\$cwd" in
3093 '') cwd=$targetdir ;;
3094 esac
3095 exe=\$1
3096 shift
3097 $to \$exe
3098 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3099 EOF
3100             ;;
3101         adb)
3102             $touch $run
3103             ;;
3104         *)  echo "Unknown targetrun '$targetrun'" >&4
3105             exit 1
3106             ;;
3107         esac
3108         case "$targetmkdir" in
3109         */Cross/mkdir)
3110             cat >$targetmkdir <<EOF
3111 #!/bin/sh
3112 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3113 EOF
3114             $chmod a+rx $targetmkdir
3115             ;;
3116         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3117             exit 1
3118             ;;
3119         esac
3120         case "$targetto" in
3121         scp|rcp)
3122             cat >$to <<EOF
3123 #!/bin/sh
3124 for f in \$@
3125 do
3126   case "\$f" in
3127   /*)
3128     $targetmkdir \`dirname \$f\`
3129     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3130     ;;
3131   *)
3132     $targetmkdir $targetdir/\`dirname \$f\`
3133     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3134     ;;
3135   esac
3136 done
3137 exit 0
3138 EOF
3139             ;;
3140         cp) cat >$to <<EOF
3141 #!/bin/sh
3142 for f in \$@
3143 do
3144   case "\$f" in
3145   /*)
3146     $mkdir -p $targetdir/\`dirname \$f\`
3147     $cp \$f $targetdir/\$f || exit 1
3148     ;;
3149   *)
3150     $targetmkdir $targetdir/\`dirname \$f\`
3151     $cp \$f $targetdir/\$f || exit 1
3152     ;;
3153   esac
3154 done
3155 exit 0
3156 EOF
3157             ;;
3158         *)  echo "Unknown targetto '$targetto'" >&4
3159             exit 1
3160             ;;
3161         esac
3162         case "$targetfrom" in
3163         scp|rcp)
3164           cat >$from <<EOF
3165 #!/bin/sh
3166 for f in \$@
3167 do
3168   $rm -f \$f
3169   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3170 done
3171 exit 0
3172 EOF
3173             ;;
3174         cp) cat >$from <<EOF
3175 #!/bin/sh
3176 for f in \$@
3177 do
3178   $rm -f \$f
3179   cp $targetdir/\$f . || exit 1
3180 done
3181 exit 0
3182 EOF
3183             ;;
3184         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3185             exit 1
3186             ;;
3187         esac
3188         if $test ! -f $run; then
3189             echo "Target 'run' script '$run' not found." >&4
3190         else
3191             $chmod a+rx $run
3192         fi
3193         if $test ! -f $to; then
3194             echo "Target 'to' script '$to' not found." >&4
3195         else
3196             $chmod a+rx $to
3197         fi
3198         if $test ! -f $from; then
3199             echo "Target 'from' script '$from' not found." >&4
3200         else
3201             $chmod a+rx $from
3202         fi
3203         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3204             exit 1
3205         fi
3206         cat >&4 <<EOF
3207 Using '$run' for remote execution,
3208 and '$from' and '$to'
3209 for remote file transfer.
3210 EOF
3211         ;;
3212 *)      run=''
3213         to=:
3214         from=:
3215         usecrosscompile="$undef"
3216         targetarch=''
3217         ;;
3218 esac
3219
3220 : see whether [:lower:] and [:upper:] are supported character classes
3221 echo " "
3222 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3223 ABYZ-abyz)
3224         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3225         up='[:upper:]'
3226         low='[:lower:]'
3227         ;;
3228 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3229         # (0xd9 and 0xe2), therefore that is a nice testing point.
3230         if test "X$up" = X -o "X$low" = X; then
3231             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3232             rs) up='[A-Z]'
3233                 low='[a-z]'
3234                 ;;
3235             esac
3236         fi
3237         if test "X$up" = X -o "X$low" = X; then
3238             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3239             rs) up='A-Z'
3240                 low='a-z'
3241                 ;;
3242             esac
3243         fi
3244         if test "X$up" = X -o "X$low" = X; then
3245             case "`echo RS | od -x 2>/dev/null`" in
3246             *D9E2*|*d9e2*)
3247                 echo "Hey, this might be EBCDIC." >&4
3248                 if test "X$up" = X -o "X$low" = X; then
3249                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3250                     rs) up='[A-IJ-RS-Z]'
3251                         low='[a-ij-rs-z]'
3252                         ;;
3253                     esac
3254                 fi
3255                 if test "X$up" = X -o "X$low" = X; then
3256                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3257                     rs) up='A-IJ-RS-Z'
3258                         low='a-ij-rs-z'
3259                         ;;
3260                     esac
3261                 fi
3262                 ;;
3263             esac
3264         fi
3265 esac
3266 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3267 rs)
3268     echo "Using $up and $low to convert case." >&4
3269     ;;
3270 *)
3271     echo "I don't know how to translate letters from upper to lower case." >&4
3272     echo "Your tr is not acting any way I know of." >&4
3273     exit 1
3274     ;;
3275 esac
3276 : set up the translation script tr, must be called with ./tr of course
3277 cat >tr <<EOSC
3278 $startsh
3279 case "\$1\$2" in
3280 '[A-Z][a-z]') exec $tr '$up' '$low';;
3281 '[a-z][A-Z]') exec $tr '$low' '$up';;
3282 esac
3283 exec $tr "\$@"
3284 EOSC
3285 chmod +x tr
3286 $eunicefix tr
3287
3288 : Try to determine whether config.sh was made on this system
3289 case "$config_sh" in
3290 '')
3291 myuname=`$uname -a 2>/dev/null`
3292 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3293 # Downcase everything to avoid ambiguity.
3294 # Remove slashes and single quotes so we can use parts of this in
3295 # directory and file names.
3296 # Remove newlines so myuname is sane to use elsewhere.
3297 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3298 # because the A-Z/a-z are not consecutive.
3299 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3300         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3301 newmyuname="$myuname"
3302 dflt=n
3303 case "$knowitall" in
3304 '')
3305         if test -f ../config.sh; then
3306                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3307                         eval "`grep myuname= ../config.sh`"
3308                 fi
3309                 if test "X$myuname" = "X$newmyuname"; then
3310                         dflt=y
3311                 fi
3312         fi
3313         ;;
3314 *) dflt=y;;
3315 esac
3316
3317 : Get old answers from old config file if Configure was run on the
3318 : same system, otherwise use the hints.
3319 hint=default
3320 cd ..
3321 if test -f config.sh; then
3322         echo " "
3323         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3324         . UU/myread
3325         case "$ans" in
3326         n*|N*) echo "OK, I'll ignore it."
3327                 mv config.sh config.sh.old
3328                 myuname="$newmyuname"
3329                 ;;
3330         *)  echo "Fetching default answers from your old config.sh file..." >&4
3331                 tmp_n="$n"
3332                 tmp_c="$c"
3333                 tmp_sh="$sh"
3334                 . ./config.sh
3335                 cp config.sh UU
3336                 n="$tmp_n"
3337                 c="$tmp_c"
3338                 : Older versions did not always set $sh.  Catch re-use of such
3339                 : an old config.sh.
3340                 case "$sh" in
3341                 '') sh="$tmp_sh" ;;
3342                 esac
3343                 hint=previous
3344                 ;;
3345         esac
3346 fi
3347 . ./UU/checkcc
3348 if test ! -f config.sh; then
3349         $cat <<EOM
3350
3351 First time through, eh?  I have some defaults handy for some systems
3352 that need some extra help getting the Configure answers right:
3353
3354 EOM
3355         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3356         dflt=''
3357         : Half the following guesses are probably wrong... If you have better
3358         : tests or hints, please send them to perlbug@perl.org
3359         : The metaconfig authors would also appreciate a copy...
3360         $test -f /irix && osname=irix
3361         $test -f /xenix && osname=sco_xenix
3362         $test -f /dynix && osname=dynix
3363         $test -f /dnix && osname=dnix
3364         $test -f /lynx.os && osname=lynxos
3365         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3366         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3367         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3368         $test -f /bin/mips && /bin/mips && osname=mips
3369         $test -d /usr/apollo/bin && osname=apollo
3370         $test -f /etc/saf/_sactab && osname=svr4
3371         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3372         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3373         $test -f /sys/utilities/MultiView && osname=amigaos
3374         if $test -d /MachTen -o -d /MachTen_Folder; then
3375                 osname=machten
3376                 if $test -x /sbin/version; then
3377                         osvers=`/sbin/version | $awk '{print $2}' |
3378                         $sed -e 's/[A-Za-z]$//'`
3379                 elif $test -x /usr/etc/version; then
3380                         osvers=`/usr/etc/version | $awk '{print $2}' |
3381                         $sed -e 's/[A-Za-z]$//'`
3382                 else
3383                         osvers="$2.$3"
3384                 fi
3385         fi
3386
3387         $test -f /sys/posix.dll &&
3388                 $test -f /usr/bin/what &&
3389                 set X `/usr/bin/what /sys/posix.dll` &&
3390                 $test "$3" = UWIN &&
3391                 osname=uwin &&
3392                 osvers="$5"
3393
3394         if $test -f $uname; then
3395                 set X $myuname
3396                 shift
3397
3398                 case "$5" in
3399                 fps*) osname=fps ;;
3400                 mips*)
3401                         case "$4" in
3402                         umips) osname=umips ;;
3403                         *) osname=mips ;;
3404                         esac;;
3405                 [23]100) osname=mips ;;
3406                 i386*)
3407                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3408                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3409                                 osname='sco'
3410                                 osvers=$tmp
3411                         elif $test -f /etc/kconfig; then
3412                                 osname=isc
3413                                 if test "$lns" = "$ln -s"; then
3414                                         osvers=4
3415                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3416                                         osvers=3
3417                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3418                                         osvers=2
3419                                 fi
3420                         fi
3421                         tmp=''
3422                         ;;
3423                 pc*)
3424                         if test -n "$DJGPP"; then
3425                                 osname=dos
3426                                 osvers=djgpp
3427                         fi
3428                         ;;
3429                 esac
3430
3431                 case "$1" in
3432                 aix) osname=aix
3433                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3434                         case "$tmp" in
3435                         # oslevel can fail with:
3436                         # oslevel: Unable to acquire lock.
3437                         *not\ found) osvers="$4"."$3" ;;
3438                         '<3240'|'<>3240') osvers=3.2.0 ;;
3439                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3440                         '=3250'|'>3250') osvers=3.2.5 ;;
3441                         *) osvers=$tmp;;
3442                         esac
3443                         ;;
3444                 bitrig) osname=bitrig
3445                         osvers="$3"
3446                         ;;
3447                 bsd386) osname=bsd386
3448                         osvers=`$uname -r`
3449                         ;;
3450                 cygwin*) osname=cygwin
3451                         osvers="$3"
3452                         ;;
3453                 *dc.osx) osname=dcosx
3454                         osvers="$3"
3455                         ;;
3456                 dnix) osname=dnix
3457                         osvers="$3"
3458                         ;;
3459                 domainos) osname=apollo
3460                         osvers="$3"
3461                         ;;
3462                 dgux)   osname=dgux
3463                         osvers="$3"
3464                         ;;
3465                 dragonfly) osname=dragonfly
3466                         osvers="$3"
3467                         ;;
3468                 dynixptx*) osname=dynixptx
3469                         osvers=`echo "$4"|sed 's/^v//'`
3470                         ;;
3471                 freebsd) osname=freebsd
3472                         osvers="$3" ;;
3473                 genix)  osname=genix ;;
3474                 gnu)    osname=gnu
3475                         osvers="$3" ;;
3476                 hp*)    osname=hpux
3477                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3478                         ;;
3479                 irix*)  osname=irix
3480                         case "$3" in
3481                         4*) osvers=4 ;;
3482                         5*) osvers=5 ;;
3483                         *)      osvers="$3" ;;
3484                         esac
3485                         ;;
3486                 linux)  osname=linux
3487                         case "$3" in
3488                         *)      osvers="$3" ;;
3489                         esac
3490                         $test -f /system/lib/libandroid.so && osname=linux-android
3491                         ;;
3492                 MiNT)   osname=mint
3493                         ;;
3494                 netbsd*) osname=netbsd
3495                         osvers="$3"
3496                         ;;
3497                 news-os) osvers="$3"
3498                         case "$3" in
3499                         4*) osname=newsos4 ;;
3500                         *) osname=newsos ;;
3501                         esac
3502                         ;;
3503                 nonstop-ux) osname=nonstopux ;;
3504                 openbsd) osname=openbsd
3505                         osvers="$3"
3506                         ;;
3507                 os2)    osname=os2
3508                         osvers="$4"
3509                         ;;
3510                 POSIX-BC | posix-bc ) osname=posix-bc
3511                         osvers="$3"
3512                         ;;
3513                 powerux | power_ux | powermax_os | powermaxos | \
3514                 powerunix | power_unix) osname=powerux
3515                         osvers="$3"
3516                         ;;
3517                 qnx) osname=qnx
3518                         osvers="$4"
3519                         ;;
3520                 solaris) osname=solaris
3521                         case "$3" in
3522                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3523                         *)      osvers="$3" ;;
3524                         esac
3525                         ;;
3526                 sunos) osname=sunos
3527                         case "$3" in
3528                         5*) osname=solaris
3529                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3530                         *)      osvers="$3" ;;
3531                         esac
3532                         ;;
3533                 titanos) osname=titanos
3534                         case "$3" in
3535                         1*) osvers=1 ;;
3536                         2*) osvers=2 ;;
3537                         3*) osvers=3 ;;
3538                         4*) osvers=4 ;;
3539                         *)      osvers="$3" ;;
3540                         esac
3541                         ;;
3542                 ultrix) osname=ultrix
3543                         osvers="$3"
3544                         ;;
3545                 osf1|mls+)      case "$5" in
3546                                 alpha)
3547                                         osname=dec_osf
3548                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3549                                         case "$osvers" in
3550                                         [1-9].[0-9]*) ;;
3551                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3552                                         esac
3553                                         ;;
3554                         hp*)    osname=hp_osf1  ;;
3555                         mips)   osname=mips_osf1 ;;
3556                         esac
3557                         ;;
3558                 # UnixWare 7.1.2 is known as Open UNIX 8
3559                 openunix|unixware) osname=svr5
3560                         osvers="$4"
3561                         ;;
3562                 uts)    osname=uts
3563                         osvers="$3"
3564                         ;;
3565                 vos) osvers="$3"
3566                         ;;
3567                 $2) case "$osname" in
3568                         *isc*) ;;
3569                         *freebsd*) ;;
3570                         svr*)
3571                                 : svr4.x or possibly later
3572                                 case "svr$3" in
3573                                 ${osname}*)
3574                                         osname=svr$3
3575                                         osvers=$4
3576                                         ;;
3577                                 esac
3578                                 case "$osname" in
3579                                 svr4.0)
3580                                         : Check for ESIX
3581                                         if test -f /stand/boot ; then
3582                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3583                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3584                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3585                                                         if test -n "$isesix"; then
3586                                                                 osname=esix4
3587                                                         fi
3588                                                 fi
3589                                         fi
3590                                         ;;
3591                                 esac
3592                                 ;;
3593                         *)      if test -f /etc/systemid; then
3594                                         osname=sco
3595                                         set `echo $3 | $sed 's/\./ /g'` $4
3596                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3597                                                 osvers=$1.$2.$3
3598                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3599                                                 osvers=$1.$2
3600                                         elif $test -f $src/hints/sco_$1.sh; then
3601                                                 osvers=$1
3602                                         fi
3603                                 else
3604                                         case "$osname" in
3605                                         '') : Still unknown.  Probably a generic Sys V.
3606                                                 osname="sysv"
3607                                                 osvers="$3"
3608                                                 ;;
3609                                         esac
3610                                 fi
3611                                 ;;
3612                         esac
3613                         ;;
3614                 *)      case "$osname" in
3615                         '') : Still unknown.  Probably a generic BSD.
3616                                 osname="$1"
3617                                 osvers="$3"
3618                                 ;;
3619                         esac
3620                         ;;
3621                 esac
3622         else
3623                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3624                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3625                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3626                                 osname=news_os
3627                         fi
3628                         $rm -f UU/kernel.what
3629                 elif test -d c:/. -o -n "$is_os2" ; then
3630                         set X $myuname
3631                         osname=os2
3632                         osvers="$5"
3633                 fi
3634         fi
3635
3636         case "$targetarch" in
3637         '') ;;
3638         *)  hostarch=$osname
3639             case "$targetarch" in
3640                 nto*|*-nto-*)
3641                     # Will load qnx.sh, which should change osname to nto
3642                     osname=qnx
3643                     osvers=''
3644                     ;;
3645                 *linux-android*)
3646                     # Catch arm-linux-androideabi, mipsel-linux-android,
3647                     # and i686-linux-android
3648                     osname=linux-android
3649                     osvers=''
3650                     ;;
3651                 *linux*)
3652                     # Something like arm-linux-gnueabihf is really just
3653                     # plain linux.
3654                     osname=linux
3655                     osvers=''
3656                     ;;
3657                 *solaris*|*sunos*)
3658                     osname=solaris
3659                     # XXX perhaps we should just assume
3660                     # osvers to be 2, or maybe take the value
3661                     # from targetarch. Using $run before the
3662                     # hints are run is somewhat icky.
3663                     set X `$run $uname -a 2>/dev/null`
3664                     shift
3665                     case "$3" in
3666                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3667                         *)  osvers="$3" ;;
3668                     esac
3669                     ;;
3670                 *)
3671                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3672                     osvers=''
3673                 ;;
3674             esac
3675             ;;
3676         esac
3677
3678         : Now look for a hint file osname_osvers, unless one has been
3679         : specified already.
3680         case "$hintfile" in
3681         ''|' ')
3682                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3683                 : Also try without trailing minor version numbers.
3684                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3685                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3686                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3687                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3688                 case "$file" in
3689                 '') dflt=none ;;
3690                 *)  case "$osvers" in
3691                         '') dflt=$file
3692                                 ;;
3693                         *)  if $test -f $src/hints/$file.sh ; then
3694                                         dflt=$file
3695                                 elif $test -f $src/hints/$xfile.sh ; then
3696                                         dflt=$xfile
3697                                 elif $test -f $src/hints/$xxfile.sh ; then
3698                                         dflt=$xxfile
3699                                 elif $test -f $src/hints/$xxxfile.sh ; then
3700                                         dflt=$xxxfile
3701                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3702                                         dflt=$xxxxfile
3703                                 elif $test -f "$src/hints/${osname}.sh" ; then
3704                                         dflt="${osname}"
3705                                 else
3706                                         dflt=none
3707                                 fi
3708                                 ;;
3709                         esac
3710                         ;;
3711                 esac
3712                 if $test -f Policy.sh ; then
3713                         case "$dflt" in
3714                         *Policy*) ;;
3715                         none) dflt="Policy" ;;
3716                         *) dflt="Policy $dflt" ;;
3717                         esac
3718                 fi
3719                 ;;
3720         *)
3721                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3722                 ;;
3723         esac
3724
3725         if $test -f Policy.sh ; then
3726                 $cat <<EOM
3727
3728 There's also a Policy hint file available, which should make the
3729 site-specific (policy) questions easier to answer.
3730 EOM
3731
3732         fi
3733
3734         $cat <<EOM
3735
3736 You may give one or more space-separated answers, or "none" if appropriate.
3737 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3738 previous run of Configure, you may specify it as well as or instead of
3739 OS-specific hints.  If hints are provided for your OS, you should use them:
3740 although Perl can probably be built without hints on many platforms, using
3741 hints often improve performance and may enable features that Configure can't
3742 set up on its own. If there are no hints that match your OS, specify "none";
3743 DO NOT give a wrong version or a wrong OS.
3744
3745 EOM
3746
3747         rp="Which of these apply, if any?"
3748         . UU/myread
3749         tans=$ans
3750         for file in $tans; do
3751                 if $test X$file = XPolicy -a -f Policy.sh; then
3752                         . Policy.sh
3753                         $cat Policy.sh >> UU/config.sh
3754                 elif $test -f $src/hints/$file.sh; then
3755                         . $src/hints/$file.sh
3756                         $cat $src/hints/$file.sh >> UU/config.sh
3757                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3758                         : nothing
3759                 else
3760                         : Give one chance to correct a possible typo.
3761                         echo "$file.sh does not exist"
3762                         dflt=$file
3763                         rp="hint to use instead?"
3764                         . UU/myread
3765                         for file in $ans; do
3766                                 if $test -f "$src/hints/$file.sh"; then
3767                                         . $src/hints/$file.sh
3768                                         $cat $src/hints/$file.sh >> UU/config.sh
3769                                 elif $test X$ans = X -o X$ans = Xnone ; then
3770                                         : nothing
3771                                 else
3772                                         echo "$file.sh does not exist -- ignored."
3773                                 fi
3774                         done
3775                 fi
3776         done
3777
3778         hint=recommended
3779         : Remember our hint file for later.
3780         if $test -f "$src/hints/$file.sh" ; then
3781                 hintfile="$file"
3782         else
3783                 hintfile=''
3784         fi
3785 fi
3786 cd UU
3787 ;;
3788 *)
3789         echo " "
3790         echo "Fetching default answers from $config_sh..." >&4
3791         tmp_n="$n"
3792         tmp_c="$c"
3793         cd ..
3794         cp $config_sh config.sh 2>/dev/null
3795         chmod +w config.sh
3796         . ./config.sh
3797         cd UU
3798         cp ../config.sh .
3799         n="$tmp_n"
3800         c="$tmp_c"
3801         hint=previous
3802         ;;
3803 esac
3804 . ./optdef.sh
3805
3806 : Restore computed paths
3807 for file in $loclist $trylist; do
3808         eval $file="\$_$file"
3809 done
3810
3811 cat << EOM
3812
3813 Configure uses the operating system name and version to set some defaults.
3814 The default value is probably right if the name rings a bell. Otherwise,
3815 since spelling matters for me, either accept the default or answer "none"
3816 to leave it blank.
3817
3818 EOM
3819 case "$osname" in
3820         ''|' ')
3821                 case "$hintfile" in
3822                 ''|' '|none) dflt=none ;;
3823                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3824                 esac
3825                 ;;
3826         *) dflt="$osname" ;;
3827 esac
3828 rp="Operating system name?"
3829 . ./myread
3830 case "$ans" in
3831 none)  osname='' ;;
3832 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3833 esac
3834 echo " "
3835 case "$osvers" in
3836         ''|' ')
3837                 case "$hintfile" in
3838                 ''|' '|none) dflt=none ;;
3839                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3840                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3841                         case "$dflt" in
3842                         ''|' ') dflt=none ;;
3843                         esac
3844                         ;;
3845                 esac
3846                 ;;
3847         *) dflt="$osvers" ;;
3848 esac
3849 rp="Operating system version?"
3850 . ./myread
3851 case "$ans" in
3852 none)  osvers='' ;;
3853 *) osvers="$ans" ;;
3854 esac
3855
3856
3857 . ./posthint.sh
3858
3859 : who configured the system
3860 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3861 case "$cf_by" in
3862 "")
3863         cf_by=`(logname) 2>/dev/null`
3864         case "$cf_by" in
3865         "")
3866                 cf_by=`(whoami) 2>/dev/null`
3867                 case "$cf_by" in
3868                 "") cf_by=unknown ;;
3869                 esac ;;
3870         esac ;;
3871 esac
3872
3873 : decide how portable to be.  Allow command line overrides.
3874 case "$d_portable" in
3875 "$undef") ;;
3876 *)      d_portable="$define" ;;
3877 esac
3878
3879 : set up shell script to do ~ expansion
3880 cat >filexp <<EOSS
3881 $startsh
3882 : expand filename
3883 case "\$1" in
3884  \~/*|\~)
3885         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3886         ;;
3887  \~*)
3888         if $test -f /bin/csh; then
3889                 /bin/csh -f -c "glob \$1"
3890                 failed=\$?
3891                 echo ""
3892                 exit \$failed
3893         else
3894                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3895                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3896                 if $test ! -d "\$dir"; then
3897                         me=\`basename \$0\`
3898                         echo "\$me: can't locate home directory for: \$name" >&2
3899                         exit 1
3900                 fi
3901                 case "\$1" in
3902                 */*)
3903                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3904                         ;;
3905                 *)
3906                         echo \$dir
3907                         ;;
3908                 esac
3909         fi
3910         ;;
3911 *)
3912         echo \$1
3913         ;;
3914 esac
3915 EOSS
3916 chmod +x filexp
3917 $eunicefix filexp
3918
3919 : now set up to get a file name
3920 cat <<EOS >getfile
3921 $startsh
3922 EOS
3923 cat <<'EOSC' >>getfile
3924 tilde=''
3925 fullpath=''
3926 already=''
3927 skip=''
3928 none_ok=''
3929 exp_file=''
3930 nopath_ok=''
3931 orig_rp="$rp"
3932 orig_dflt="$dflt"
3933 case "$gfpth" in
3934 '') gfpth='.' ;;
3935 esac
3936
3937 case "$fn" in
3938 *\(*)
3939         : getfile will accept an answer from the comma-separated list
3940         : enclosed in parentheses even if it does not meet other criteria.
3941         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3942         fn=`echo $fn | sed 's/(.*)//'`
3943         ;;
3944 esac
3945
3946 case "$fn" in
3947 *:*)
3948         loc_file=`expr $fn : '.*:\(.*\)'`
3949         fn=`expr $fn : '\(.*\):.*'`
3950         ;;
3951 esac
3952
3953 case "$fn" in
3954 *~*) tilde=true;;
3955 esac
3956 case "$fn" in
3957 */*) fullpath=true;;
3958 esac
3959 case "$fn" in
3960 *+*) skip=true;;
3961 esac
3962 case "$fn" in
3963 *n*) none_ok=true;;
3964 esac
3965 case "$fn" in
3966 *e*) exp_file=true;;
3967 esac
3968 case "$fn" in
3969 *p*) nopath_ok=true;;
3970 esac
3971
3972 case "$fn" in
3973 *f*) type='File';;
3974 *d*) type='Directory';;
3975 *l*) type='Locate';;
3976 esac
3977
3978 what="$type"
3979 case "$what" in
3980 Locate) what='File';;
3981 esac
3982
3983 case "$exp_file" in
3984 '')
3985         case "$d_portable" in
3986         "$define") ;;
3987         *) exp_file=true;;
3988         esac
3989         ;;
3990 esac
3991
3992 cd ..
3993 while test "$type"; do
3994         redo=''
3995         rp="$orig_rp"
3996         dflt="$orig_dflt"
3997         case "$tilde" in
3998         true) rp="$rp (~name ok)";;
3999         esac
4000         . UU/myread
4001         if test -f UU/getfile.ok && \
4002                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4003         then
4004                 value="$ans"
4005                 ansexp="$ans"
4006                 break
4007         fi
4008         case "$ans" in
4009         none)
4010                 value=''
4011                 ansexp=''
4012                 case "$none_ok" in
4013                 true) type='';;
4014                 esac
4015                 ;;
4016         *)
4017                 case "$tilde" in
4018                 '') value="$ans"
4019                         ansexp="$ans";;
4020                 *)
4021                         value=`UU/filexp $ans`
4022                         case $? in
4023                         0)
4024                                 if test "$ans" != "$value"; then
4025                                         echo "(That expands to $value on this system.)"
4026                                 fi
4027                                 ;;
4028                         *) value="$ans";;
4029                         esac
4030                         ansexp="$value"
4031                         case "$exp_file" in
4032                         '') value="$ans";;
4033                         esac
4034                         ;;
4035                 esac
4036                 case "$fullpath" in
4037                 true)
4038                         case "$ansexp" in
4039                         /*) value="$ansexp" ;;
4040                         [a-zA-Z]:/*) value="$ansexp" ;;
4041                         *)
4042                                 redo=true
4043                                 case "$already" in
4044                                 true)
4045                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4046                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4047                                         ;;
4048                                 *)
4049                                 echo "Please give a full path name, starting with slash." >&4
4050                                         case "$tilde" in
4051                                         true)
4052                                 echo "Note that using ~name is ok provided it expands well." >&4
4053                                                 already=true
4054                                                 ;;
4055                                         esac
4056                                 esac
4057                                 ;;
4058                         esac
4059                         ;;
4060                 esac
4061                 case "$redo" in
4062                 '')
4063                         case "$type" in
4064                         File)
4065                                 for fp in $gfpth; do
4066                                         if test "X$fp" = X.; then
4067                                             pf="$ansexp"
4068                                         else    
4069                                             pf="$fp/$ansexp"
4070                                         fi
4071                                         if test -f "$pf"; then
4072                                                 type=''
4073                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4074                                         then
4075                                                 echo "($value is not a plain file, but that's ok.)"
4076                                                 type=''
4077                                         fi
4078                                         if test X"$type" = X; then
4079                                             value="$pf"
4080                                             break
4081                                         fi
4082                                 done
4083                                 ;;
4084                         Directory)
4085                                 for fp in $gfpth; do
4086                                         if test "X$fp" = X.; then
4087                                             dir="$ans"
4088                                             direxp="$ansexp"
4089                                         else    
4090                                             dir="$fp/$ansexp"
4091                                             direxp="$fp/$ansexp"
4092                                         fi
4093                                         if test -d "$direxp"; then
4094                                                 type=''
4095                                                 value="$dir"
4096                                                 break
4097                                         fi
4098                                 done
4099                                 ;;
4100                         Locate)
4101                                 if test -d "$ansexp"; then
4102                                         echo "(Looking for $loc_file in directory $value.)"
4103                                         value="$value/$loc_file"
4104                                         ansexp="$ansexp/$loc_file"
4105                                 fi
4106                                 if test -f "$ansexp"; then
4107                                         type=''
4108                                 fi
4109                                 case "$nopath_ok" in
4110                                 true)   case "$value" in
4111                                         */*) ;;
4112                                         *)      echo "Assuming $value will be in people's path."
4113                                                 type=''
4114                                                 ;;
4115                                         esac
4116                                         ;;
4117                                 esac
4118                                 ;;
4119                         esac
4120
4121                         case "$skip" in
4122                         true) type='';
4123                         esac
4124
4125                         case "$type" in
4126                         '') ;;
4127                         *)
4128                                 if test "$fastread" = yes; then
4129                                         dflt=y
4130                                 else
4131                                         dflt=n
4132                                 fi
4133                                 rp="$what $value doesn't exist.  Use that name anyway?"
4134                                 . UU/myread
4135                                 dflt=''
4136                                 case "$ans" in
4137                                 y*) type='';;
4138                                 *) echo " ";;
4139                                 esac
4140                                 ;;
4141                         esac
4142                         ;;
4143                 esac
4144                 ;;
4145         esac
4146 done
4147 cd UU
4148 ans="$value"
4149 rp="$orig_rp"
4150 dflt="$orig_dflt"
4151 rm -f getfile.ok
4152 test "X$gfpthkeep" != Xy && gfpth=""
4153 EOSC
4154
4155 : determine root of directory hierarchy where package will be installed.
4156 case "$prefix" in
4157 '')
4158         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4159         ;;
4160 *?/)
4161         dflt=`echo "$prefix" | sed 's/.$//'`
4162         ;;
4163 *)
4164         dflt="$prefix"
4165         ;;
4166 esac
4167 $cat <<EOM
4168
4169 By default, $package will be installed in $dflt/bin, manual pages
4170 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4171 installation directories. Typically this is something like /usr/local.
4172 If you wish to have binaries under /usr/bin but other parts of the
4173 installation under /usr/local, that's ok: you will be prompted
4174 separately for each of the installation directories, the prefix being
4175 only used to set the defaults.
4176
4177 EOM
4178 fn=d~
4179 rp='Installation prefix to use?'
4180 . ./getfile
4181 oldprefix=''
4182 case "$prefix" in
4183 '') ;;
4184 *)
4185         case "$ans" in
4186         "$prefix") ;;
4187         *) oldprefix="$prefix";;
4188         esac
4189         ;;
4190 esac
4191 prefix="$ans"
4192 prefixexp="$ansexp"
4193
4194 : allow them to override the AFS root
4195 case "$afsroot" in
4196 '')     afsroot=/afs ;;
4197 *)      afsroot=$afsroot ;;
4198 esac
4199
4200 : is AFS running?
4201 echo " "
4202 case "$afs" in
4203 $define|true)   afs=true ;;
4204 $undef|false)   afs=false ;;
4205 *)      if $test -d $afsroot; then
4206                 afs=true
4207         else
4208                 afs=false
4209         fi
4210         ;;
4211 esac
4212 if $afs; then
4213         echo "AFS may be running... I'll be extra cautious then..." >&4
4214 else
4215         echo "AFS does not seem to be running..." >&4
4216 fi
4217
4218 : determine installation prefix for where package is to be installed.
4219 if $afs; then
4220 $cat <<EOM
4221
4222 Since you are running AFS, I need to distinguish the directory in which
4223 files will reside from the directory in which they are installed (and from
4224 which they are presumably copied to the former directory by occult means).
4225
4226 EOM
4227         case "$installprefix" in
4228         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4229         *) dflt="$installprefix";;
4230         esac
4231 else
4232 $cat <<EOM
4233
4234 In some special cases, particularly when building $package for distribution,
4235 it is convenient to distinguish the directory in which files should be
4236 installed from the directory ($prefix) in which they will
4237 eventually reside.  For most users, these two directories are the same.
4238
4239 EOM
4240         case "$installprefix" in
4241         '') dflt=$prefix ;;
4242         *) dflt=$installprefix;;
4243         esac
4244 fi
4245 fn=d~
4246 rp='What installation prefix should I use for installing files?'
4247 . ./getfile
4248 installprefix="$ans"
4249 installprefixexp="$ansexp"
4250
4251 : Perform the prefixexp/installprefixexp correction if necessary
4252 cat <<EOS >installprefix
4253 $startsh
4254 EOS
4255 cat <<'EOSC' >>installprefix
4256 : Change installation prefix, if necessary.
4257 if $test X"$prefix" != X"$installprefix"; then
4258     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4259 else
4260     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4261 fi
4262 EOSC
4263 chmod +x installprefix
4264 $eunicefix installprefix
4265
4266 : Set variables such as privlib and privlibexp from the output of ./getfile
4267 : performing the prefixexp/installprefixexp correction if necessary.
4268 cat <<EOS >setprefixvar
4269 $startsh
4270 EOS
4271 cat <<'EOSC' >>setprefixvar
4272 eval "${prefixvar}=\"\$ans\""
4273 eval "${prefixvar}exp=\"\$ansexp\""
4274 . ./installprefix
4275 EOSC
4276 chmod +x setprefixvar
4277 $eunicefix setprefixvar
4278
4279 : set up the script used to warn in case of inconsistency
4280 cat <<EOS >whoa
4281 $startsh
4282 EOS
4283 cat <<'EOSC' >>whoa
4284 dflt=y
4285 case "$hint" in
4286     recommended)
4287         case "$hintfile" in
4288         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4289                 ;;
4290         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4291                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4292                 ;;
4293         esac
4294         ;;
4295     *)  echo " "
4296         echo "*** WHOA THERE!!! ***" >&4
4297         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4298         ;;
4299 esac
4300 rp="    Keep the $hint value?"
4301 . ./myread
4302 case "$ans" in
4303 y) td=$was; tu=$was;;
4304 esac
4305 EOSC
4306
4307 : function used to set '$1' to '$val'
4308 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4309 case "$val$was" in
4310 $define$undef) . ./whoa; eval "$var=\$td";;
4311 $undef$define) . ./whoa; eval "$var=\$tu";;
4312 *) eval "$var=$val";;
4313 esac'
4314
4315 : get the patchlevel
4316 echo " "
4317 echo "Getting the current patchlevel..." >&4
4318 if $test -r $rsrc/patchlevel.h;then
4319         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4320         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4321         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4322         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4323         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4324         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4325         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4326 else
4327         revision=0
4328         patchlevel=0
4329         subversion=0
4330         api_revision=0
4331         api_version=0
4332         api_subversion=0
4333         perl_patchlevel=0
4334         $echo "(You do not have patchlevel.h.  Eek.)"
4335 fi
4336 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4337 version_patchlevel_string="version $patchlevel subversion $subversion"
4338 case "$perl_patchlevel" in
4339 0|'') ;;
4340 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4341     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4342     ;;
4343 esac
4344
4345 $echo "(You have $package $version_patchlevel_string.)"
4346
4347 case "$osname" in
4348 dos|vms)
4349         : XXX Should be a Configure test for double-dots in filenames.
4350         version=`echo $revision $patchlevel $subversion | \
4351                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4352         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4353                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4354         ;;
4355 *)
4356         version=`echo $revision $patchlevel $subversion | \
4357                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4358         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4359                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4360         ;;
4361 esac
4362 : Special case the 5.005_xx maintenance series, which used 5.005
4363 : without any subversion label as a subdirectory in $sitelib
4364 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4365         api_versionstring='5.005'
4366 fi
4367
4368 : Do we want threads support and if so, what type
4369 case "$usethreads" in
4370 $define|true|[yY]*)     dflt='y';;
4371 *)     # Catch case where user specified ithreads or 5005threads but
4372        # forgot -Dusethreads (A.D. 4/2002)
4373        case "$useithreads$use5005threads" in
4374        *$define*)       dflt='y';;
4375        *)               dflt='n';;
4376        esac
4377        ;;
4378 esac
4379 cat <<EOM
4380
4381 Perl can be built to offer a form of threading support on some systems
4382 To do so, Configure can be run with -Dusethreads.
4383
4384 Note that Perl built with threading support runs slightly slower
4385 and uses slightly more memory than plain Perl.
4386
4387 If this doesn't make any sense to you, just accept the default '$dflt'.
4388 EOM
4389 rp='Build a threading Perl?'
4390 . ./myread
4391 case "$ans" in
4392 y|Y)    val="$define" ;;
4393 *)      val="$undef" ;;
4394 esac
4395 set usethreads
4396 eval $setvar
4397
4398 if $test $patchlevel -lt 9; then
4399     case "$usethreads" in
4400     $define)
4401         : Default to ithreads unless overridden on command line or with
4402         : old config.sh
4403         dflt='y'
4404         case "$use5005threads" in
4405                 $define|true|[yY]*)
4406                         echo "5.005 threads are no longer supported"
4407                         exit 1
4408                 ;;
4409         esac
4410         case "$useithreads" in
4411                 $undef|false|[nN]*) dflt='n';;
4412         esac
4413         rp='Use the newer interpreter-based ithreads?'
4414         . ./myread
4415         case "$ans" in
4416         y|Y)    val="$define" ;;
4417         *)      val="$undef" ;;
4418         esac
4419         set useithreads
4420         eval $setvar
4421         : Now set use5005threads to the opposite value.
4422         case "$useithreads" in
4423         $define) val="$undef" ;;
4424         *) val="$define" ;;
4425         esac
4426         set use5005threads
4427         eval $setvar
4428         ;;
4429     *)
4430         useithreads="$undef"
4431         use5005threads="$undef"
4432         ;;
4433     esac
4434
4435     case "$useithreads$use5005threads" in
4436     "$define$define")
4437         $cat >&4 <<EOM
4438
4439 You cannot have both the ithreads and the 5.005 threads enabled
4440 at the same time.  Disabling the 5.005 threads since they are
4441 much less stable than the ithreads.
4442
4443 EOM
4444         use5005threads="$undef"
4445         ;;
4446     esac
4447
4448 else
4449 : perl-5.9.x and later
4450
4451     if test X"$usethreads" = "X$define"; then
4452         case "$use5005threads" in
4453             $define|true|[yY]*)
4454                 $cat >&4 <<EOM
4455
4456 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4457
4458 EOM
4459             ;;
4460         esac
4461     fi
4462
4463     use5005threads="$undef"
4464     useithreads="$usethreads"
4465 fi
4466
4467 case "$d_oldpthreads" in
4468 '')     : Configure tests would be welcome here.  For now, assume undef.
4469         val="$undef" ;;
4470 *)      val="$d_oldpthreads" ;;
4471 esac
4472 set d_oldpthreads
4473 eval $setvar
4474
4475
4476 : Look for a hint-file generated 'call-back-unit'.  If the
4477 : user has specified that a threading perl is to be built,
4478 : we may need to set or change some other defaults.
4479 if $test -f usethreads.cbu; then
4480     echo "Your platform has some specific hints regarding threaded builds, using them..."
4481     . ./usethreads.cbu
4482 else
4483     case "$usethreads" in
4484         "$define"|true|[yY]*)
4485                 $cat <<EOM
4486 (Your platform does not have any specific hints for threaded builds.
4487  Assuming POSIX threads, then.)
4488 EOM
4489         ;;
4490     esac
4491 fi
4492
4493 : Check if multiplicity is required
4494 cat <<EOM
4495
4496 Perl can be built so that multiple Perl interpreters can coexist
4497 within the same Perl executable.
4498 EOM
4499
4500 case "$useithreads" in
4501 $define)
4502         cat <<EOM
4503 This multiple interpreter support is required for interpreter-based threads.
4504 EOM
4505         val="$define"
4506         ;;
4507 *)      case "$usemultiplicity" in
4508         $define|true|[yY]*)     dflt='y';;
4509         *) dflt='n';;
4510         esac
4511         echo " "
4512         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4513         rp='Build Perl for multiplicity?'
4514         . ./myread
4515         case "$ans" in
4516         y|Y)    val="$define" ;;
4517         *)      val="$undef" ;;
4518         esac
4519         ;;
4520 esac
4521 set usemultiplicity
4522 eval $setvar
4523
4524 : Check if morebits is requested
4525 case "$usemorebits" in
4526 "$define"|true|[yY]*)
4527         use64bitint="$define"
4528         uselongdouble="$define"
4529         usemorebits="$define"
4530         ;;
4531 *)      usemorebits="$undef"
4532         ;;
4533 esac
4534
4535 : Determine the C compiler to be used
4536 echo " "
4537 case "$cc" in
4538 '') dflt=cc;;
4539 *) dflt="$cc";;
4540 esac
4541 rp="Use which C compiler?"
4542 . ./myread
4543 cc="$ans"
4544
4545 : See whether they have no cc but they do have gcc
4546 . ./trygcc
4547 if $test -f cc.cbu; then
4548     . ./cc.cbu
4549 fi
4550 . ./checkcc
4551
4552 : make some quick guesses about what we are up against
4553 echo " "
4554 $echo $n "Hmm...  $c"
4555 echo exit 1 >bsd
4556 echo exit 1 >usg
4557 echo exit 1 >v7
4558 echo exit 1 >osf1
4559 echo exit 1 >eunice
4560 echo exit 1 >xenix
4561 echo exit 1 >venix
4562 echo exit 1 >os2
4563 d_bsd="$undef"
4564 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4565 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4566 then
4567         echo "Looks kind of like an OSF/1 system, but we'll see..."
4568         echo exit 0 >osf1
4569 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4570         xxx=`./loc addbib blurfl $pth`
4571         if $test -f $xxx; then
4572         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4573                 echo exit 0 >bsd
4574                 echo exit 0 >usg
4575         else
4576                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4577                         echo "Looks kind of like an extended USG system, but we'll see..."
4578                 else
4579                         echo "Looks kind of like a USG system, but we'll see..."
4580                 fi
4581                 echo exit 0 >usg
4582         fi
4583 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4584         echo "Looks kind of like a BSD system, but we'll see..."
4585         d_bsd="$define"
4586         echo exit 0 >bsd
4587 else
4588         echo "Looks kind of like a Version 7 system, but we'll see..."
4589         echo exit 0 >v7
4590 fi
4591 case "$eunicefix" in
4592 *unixtovms*)
4593         $cat <<'EOI'
4594 There is, however, a strange, musty smell in the air that reminds me of
4595 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4596 EOI
4597         echo exit 0 >eunice
4598         d_eunice="$define"
4599 : it so happens the Eunice I know will not run shell scripts in Unix format
4600         ;;
4601 *)
4602         echo " "
4603         echo "Congratulations.  You aren't running Eunice."
4604         d_eunice="$undef"
4605         ;;
4606 esac
4607 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4608 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4609 : semicolon as a patch separator
4610 case "$p_" in
4611 :) ;;
4612 *)
4613         $cat <<'EOI'
4614 I have the feeling something is not exactly right, however...don't tell me...
4615 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4616 (Or you may be running DOS with DJGPP.)
4617 EOI
4618         echo exit 0 >os2
4619         ;;
4620 esac
4621 if test -f /xenix; then
4622         echo "Actually, this looks more like a XENIX system..."
4623         echo exit 0 >xenix
4624         d_xenix="$define"
4625 else
4626         echo " "
4627         echo "It's not Xenix..."
4628         d_xenix="$undef"
4629 fi
4630 chmod +x xenix
4631 $eunicefix xenix
4632 if test -f /venix; then
4633         echo "Actually, this looks more like a VENIX system..."
4634         echo exit 0 >venix
4635 else
4636         echo " "
4637         if ./xenix; then
4638                 : null
4639         else
4640                 echo "Nor is it Venix..."
4641         fi
4642 fi
4643 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4644 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4645 $rm -f foo
4646
4647 : Check if we are using GNU gcc and what its version is
4648 echo " "
4649 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4650 $cat >try.c <<EOM
4651 #include <stdio.h>
4652 int main() {
4653 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4654 #ifdef __VERSION__
4655         printf("%s\n", __VERSION__);
4656 #else
4657         printf("%s\n", "1");
4658 #endif
4659 #endif
4660         return(0);
4661 }
4662 EOM
4663 if $cc -o try $ccflags $ldflags try.c; then
4664         gccversion=`$run ./try`
4665         case "$gccversion" in
4666         '') echo "You are not using GNU cc." ;;
4667         *)  echo "You are using GNU cc $gccversion."
4668             ccname=gcc
4669             ;;
4670         esac
4671 else
4672         echo " "
4673         echo "*** WHOA THERE!!! ***" >&4
4674         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4675         case "$knowitall" in
4676         '')
4677         echo "    You'd better start hunting for one and let me know about it." >&4
4678                 exit 1
4679                 ;;
4680         esac
4681 fi
4682 $rm -f try try.*
4683 case "$gccversion" in
4684 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4685 esac
4686 case "$gccversion" in
4687 '') gccosandvers='' ;;
4688 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4689    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4690    gccshortvers=''
4691    case "$gccosandvers" in
4692    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4693    $osname$osvers) ;; # looking good
4694    $osname*) cat <<EOM >&4
4695
4696 *** WHOA THERE!!! ***
4697
4698     Your gcc has not been compiled for the exact release of
4699     your operating system ($gccosandvers versus $osname$osvers).
4700
4701     In general it is a good idea to keep gcc synchronized with
4702     the operating system because otherwise serious problems
4703     may ensue when trying to compile software, like Perl.
4704
4705     I'm trying to be optimistic here, though, and will continue.
4706     If later during the configuration and build icky compilation
4707     problems appear (headerfile conflicts being the most common
4708     manifestation), I suggest reinstalling the gcc to match
4709     your operating system release.
4710
4711 EOM
4712       ;;
4713    *) gccosandvers='' ;; # failed to parse, better be silent
4714    esac
4715    ;;
4716 esac
4717 case "$ccname" in
4718 '') ccname="$cc" ;;
4719 esac
4720
4721 # gcc 3.* complain about adding -Idirectories that they already know about,
4722 # so we will take those off from locincpth.
4723 case "$gccversion" in
4724 3*)
4725     echo "main(){}">try.c
4726     for incdir in $locincpth; do
4727        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4728              grep '^c[cp]p*[01]: warning: changing search order '`
4729        if test "X$warn" != X; then
4730            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4731        fi
4732     done
4733     $rm -f try try.*
4734 esac
4735
4736 # gcc 4.9 by default does some optimizations that break perl.
4737 # see ticket 121505.
4738 #
4739 # The -fwrapv disables those optimizations (and probably others,) so
4740 # for gcc 4.9 (and later, since the optimizations probably won't go
4741 # away), add -fwrapv unless the user requests -fno-wrapv, which
4742 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4743 # which turns the overflows -fwrapv ignores into runtime errors.
4744 case "$gccversion" in
4745 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4746     case "$ccflags" in
4747     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4748     *) ccflags="$ccflags -fwrapv" ;;
4749     esac
4750 esac
4751
4752 : What should the include directory be ?
4753 : Use sysroot if set, so findhdr looks in the right place.
4754 echo " "
4755 $echo $n "Hmm...  $c"
4756 dflt="$sysroot/usr/include"
4757 incpath=''
4758 mips_type=''
4759 if $test -f /bin/mips && /bin/mips; then
4760         echo "Looks like a MIPS system..."
4761         $cat >usr.c <<'EOCP'
4762 #ifdef SYSTYPE_BSD43
4763 /bsd43
4764 #endif
4765 EOCP
4766         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4767                 dflt='/bsd43/usr/include'
4768                 incpath='/bsd43'
4769                 mips_type='BSD 4.3'
4770         else
4771                 mips_type='System V'
4772         fi
4773         $rm -f usr.c usr.out
4774         echo "and you're compiling with the $mips_type compiler and libraries."
4775         xxx_prompt=y
4776         echo "exit 0" >mips
4777 else
4778         echo "Doesn't look like a MIPS system."
4779         xxx_prompt=n
4780         echo "exit 1" >mips
4781 fi
4782 chmod +x mips
4783 $eunicefix mips
4784 case "$usrinc" in
4785 '') ;;
4786 *) dflt="$usrinc";;
4787 esac
4788 case "$xxx_prompt" in
4789 y)      fn=d/
4790         echo " "
4791         rp='Where are the include files you want to use?'
4792         . ./getfile
4793         usrinc="$ans"
4794         ;;
4795 *)      usrinc="$dflt"
4796         ;;
4797 esac
4798
4799 : see how we invoke the C preprocessor
4800 echo " "
4801 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4802 cat <<'EOT' >testcpp.c
4803 #define ABC abc
4804 #define XYZ xyz
4805 ABC.XYZ
4806 EOT
4807 cd ..
4808 if test ! -f cppstdin; then
4809         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4810                 # AIX cc -E doesn't show the absolute headerfile
4811                 # locations but we'll cheat by using the -M flag.
4812                 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
4813         else
4814                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4815         fi
4816 else
4817         echo "Keeping your $hint cppstdin wrapper."
4818 fi
4819 chmod 755 cppstdin
4820 wrapper=`pwd`/cppstdin
4821 ok='false'
4822 cd UU
4823
4824 if $test "X$cppstdin" != "X" && \
4825         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4826         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4827 then
4828         echo "You used to use $cppstdin $cppminus so we'll use that again."
4829         case "$cpprun" in
4830         '') echo "But let's see if we can live without a wrapper..." ;;
4831         *)
4832                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4833                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4834                 then
4835                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4836                         ok='true'
4837                 else
4838                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4839                 fi
4840                 ;;
4841         esac
4842 else
4843         case "$cppstdin" in
4844         '') ;;
4845         *)
4846                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4847                 ;;
4848         esac
4849 fi
4850
4851 if $ok; then
4852         : nothing
4853 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4854         $cc -E <testcpp.c >testcpp.out 2>&1; \
4855         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4856         echo "Yup, it does."
4857         x_cpp="$cc $cppflags -E"
4858         x_minus='';
4859 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4860         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4861         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4862         echo "Yup, it does."
4863         x_cpp="$cc $cppflags -E"
4864         x_minus='-';
4865 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4866         $cc -P <testcpp.c >testcpp.out 2>&1; \
4867         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4868         echo "Yipee, that works!"
4869         x_cpp="$cc $cppflags -P"
4870         x_minus='';
4871 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4872         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4873         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4874         echo "At long last!"
4875         x_cpp="$cc $cppflags -P"
4876         x_minus='-';
4877 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4878         $cpp <testcpp.c >testcpp.out 2>&1; \
4879         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4880         echo "It works!"
4881         x_cpp="$cpp $cppflags"
4882         x_minus='';
4883 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4884         $cpp - <testcpp.c >testcpp.out 2>&1; \
4885         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4886         echo "Hooray, it works!  I was beginning to wonder."
4887         x_cpp="$cpp $cppflags"
4888         x_minus='-';
4889 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4890         $wrapper <testcpp.c >testcpp.out 2>&1; \
4891         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4892         x_cpp="$wrapper"
4893         x_minus=''
4894         echo "Eureka!"
4895 else
4896         dflt=''
4897         rp="No dice.  I can't find a C preprocessor.  Name one:"
4898         . ./myread
4899         x_cpp="$ans"
4900         x_minus=''
4901         $x_cpp <testcpp.c >testcpp.out 2>&1
4902         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4903                 echo "OK, that will do." >&4
4904         else
4905 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4906                 exit 1
4907         fi
4908 fi
4909
4910 case "$ok" in
4911 false)
4912         cppstdin="$x_cpp"
4913         cppminus="$x_minus"
4914         cpprun="$x_cpp"
4915         cpplast="$x_minus"
4916         set X $x_cpp
4917         shift
4918         case "$1" in
4919         "$cpp")
4920                 echo "Perhaps can we force $cc -E using a wrapper..."
4921                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4922                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4923                 then
4924                         echo "Yup, we can."
4925                         cppstdin="$wrapper"
4926                         cppminus='';
4927                 else
4928                         echo "Nope, we'll have to live without it..."
4929                 fi
4930                 ;;
4931         esac
4932         case "$cpprun" in
4933         "$wrapper")
4934                 cpprun=''
4935                 cpplast=''
4936                 ;;
4937         esac
4938         ;;
4939 esac
4940
4941 case "$cppstdin" in
4942 "$wrapper"|'cppstdin') ;;
4943 *) $rm -f $wrapper;;
4944 esac
4945 $rm -f testcpp.c testcpp.out
4946
4947 : Adjust cppfilter for path component separator
4948 case "$osname" in
4949 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4950 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4951 *)   cppfilter='' ;;
4952 esac
4953
4954 : Use gcc to determine libpth and incpth
4955 # If using gcc or clang, we can get better values for libpth, incpth
4956 # and usrinc directly from the compiler.
4957 # Note that ccname for clang is also gcc.
4958 case "$ccname" in
4959     gcc)
4960         $echo 'extern int foo;' > try.c
4961         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4962         shift
4963         if $test $# -gt 0; then
4964             incpth="$incpth $*"
4965             incpth="`$echo $incpth|$sed 's/^ //'`"
4966             for i in $*; do
4967                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4968                 if $test -d $j; then
4969                     libpth="$libpth $j"
4970                 fi
4971             done
4972             libpth="`$echo $libpth|$sed 's/^ //'`"
4973             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4974                 if $test -d $xxx; then
4975                     case " $libpth " in
4976                     *" $xxx "*) ;;
4977                     *) libpth="$libpth $xxx";;
4978                     esac
4979                 fi
4980             done
4981         fi
4982         $rm -f try.c
4983         case "$usrinc" in
4984         '') for i in $incpth; do
4985                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4986                     usrinc="$i"
4987                     break
4988                 fi
4989             done
4990             ;;
4991         esac
4992
4993         case "$usecrosscompile" in
4994         $define|true|[yY]*)
4995             case "$incpth" in
4996                 '') echo "Incpth not defined." >&4; croak=y ;;
4997                 *)  echo "Using incpth '$incpth'." >&4 ;;
4998             esac
4999             case "$libpth" in
5000                 '') echo "Libpth not defined." >&4; croak=y ;;
5001                 *)  echo "Using libpth '$libpth'." >&4 ;;
5002             esac
5003             case "$usrinc" in
5004                 '') echo "Usrinc not defined." >&4; croak=y ;;
5005                 *)  echo "Using usrinc $usrinc." >&4 ;;
5006             esac
5007             case "$croak" in
5008                 y)
5009                 if test "X$sysroot" = X; then
5010                     echo "Cannot continue, aborting." >&4; exit 1
5011                 else
5012                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5013                 fi
5014                 ;;
5015             esac
5016             ;;
5017         esac
5018     ;;
5019 esac
5020
5021 : Default value for incpth is just usrinc
5022 case "$incpth" in
5023 '') incpth="$usrinc";;
5024 esac
5025
5026 : Set private lib path
5027 case "$plibpth" in
5028 '') if ./mips; then
5029         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5030     fi;;
5031 esac
5032 case "$libpth" in
5033 ' ') dlist='';;
5034 '') dlist="$loclibpth $plibpth $glibpth";;
5035 *) dlist="$libpth";;
5036 esac
5037
5038 : Now check and see which directories actually exist, avoiding duplicates
5039 for xxx in $dlist
5040 do
5041     if $test -d $xxx; then
5042                 case " $libpth " in
5043                 *" $xxx "*) ;;
5044                 *) libpth="$libpth $xxx";;
5045                 esac
5046     fi
5047 done
5048 $cat <<'EOM'
5049
5050 Some systems have incompatible or broken versions of libraries.  Among
5051 the directories listed in the question below, please remove any you
5052 know not to be holding relevant libraries, and add any that are needed.
5053 Say "none" for none.
5054
5055 EOM
5056
5057 if test "X$sysroot" != X; then
5058     $cat <<EOM
5059 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5060
5061 EOM
5062 fi
5063
5064 case "$libpth" in
5065 '') dflt='none';;
5066 *)
5067         set X $libpth
5068         shift
5069         dflt=${1+"$@"}
5070         ;;
5071 esac
5072 rp="Directories to use for library searches?"
5073 . ./myread
5074 case "$ans" in
5075 none) libpth=' ';;
5076 *) libpth="$ans";;
5077 esac
5078
5079 : compute shared library extension
5080 case "$so" in
5081 '')
5082         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5083                 dflt='sl'
5084         else
5085                 dflt='so'
5086         fi
5087         ;;
5088 *) dflt="$so";;
5089 esac
5090 $cat <<EOM
5091
5092 On some systems, shared libraries may be available.  Answer 'none' if
5093 you want to suppress searching of shared libraries for the remainder
5094 of this configuration.
5095
5096 EOM
5097 rp='What is the file extension used for shared libraries?'
5098 . ./myread
5099 so="$ans"
5100
5101 : Does target system insist that shared library basenames are unique
5102 $cat << EOM
5103
5104 Some dynamic loaders assume that the *basename* of shared library filenames
5105 are globally unique.  We'll default this to undef as we assume your system
5106 is not this weird. Set to defined if you're on one of them.
5107
5108 EOM
5109
5110 dflt='n'
5111 rp='Make shared library basenames unique?'
5112 . ./myread
5113 case "$ans" in
5114 y|Y) val="$define" ;;
5115 *)   val="$undef"  ;;
5116 esac
5117 set d_libname_unique
5118 eval $setvar
5119
5120 : Define several unixisms.
5121 : Hints files or command line option can be used to override them.
5122 : The convoluted testing is in case hints files set either the old
5123 : or the new name.
5124 case "$_exe" in
5125 '')     case "$exe_ext" in
5126         '')     ;;
5127         *)      _exe="$exe_ext" ;;
5128         esac
5129         ;;
5130 esac
5131 case "$_a" in
5132 '')     case "$lib_ext" in
5133     '') _a='.a';;
5134         *)      _a="$lib_ext" ;;
5135         esac
5136         ;;
5137 esac
5138 case "$_o" in
5139 '') case "$obj_ext" in
5140         '')     _o='.o';;
5141         *)      _o="$obj_ext";;
5142         esac
5143         ;;
5144 esac
5145 case "$p_" in
5146 '') case "$path_sep" in
5147         '')     p_=':';;
5148         *)      p_="$path_sep";;
5149         esac
5150         ;;
5151 esac
5152 exe_ext=$_exe
5153 lib_ext=$_a
5154 obj_ext=$_o
5155 path_sep=$p_
5156
5157 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5158
5159 : Which makefile gets called first.  This is used by make depend.
5160 case "$firstmakefile" in
5161 '') firstmakefile='makefile';;
5162 esac
5163
5164 : Check is we will use socks
5165 case "$usesocks" in
5166 $define|true|[yY]*)     dflt='y';;
5167 *) dflt='n';;
5168 esac
5169 cat <<EOM
5170
5171 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5172 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5173 to use the PerlIO abstraction layer, this will be implicitly selected.
5174
5175 If this doesn't make any sense to you, just accept the default '$dflt'.
5176 EOM
5177 rp='Build Perl for SOCKS?'
5178 . ./myread
5179 case "$ans" in
5180 y|Y)    val="$define" ;;
5181 *)      val="$undef" ;;
5182 esac
5183 set usesocks
5184 eval $setvar
5185
5186 : Check for uselongdouble support
5187 case "$ccflags" in
5188 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5189 esac
5190
5191 case "$uselongdouble" in
5192 $define|true|[yY]*)     dflt='y';;
5193 *) dflt='n';;
5194 esac
5195 cat <<EOM
5196
5197 Perl can be built to take advantage of long doubles which
5198 (if available) may give more accuracy and range for floating point numbers.
5199
5200 If this doesn't make any sense to you, just accept the default '$dflt'.
5201 EOM
5202 rp='Try to use long doubles if available?'
5203 . ./myread
5204 case "$ans" in
5205 y|Y)    val="$define"   ;;
5206 *)      val="$undef"    ;;
5207 esac
5208 set uselongdouble
5209 eval $setvar
5210
5211 case "$uselongdouble" in
5212 true|[yY]*) uselongdouble="$define" ;;
5213 esac
5214
5215 : Look for a hint-file generated 'call-back-unit'.  If the
5216 : user has specified that long doubles should be used,
5217 : we may need to set or change some other defaults.
5218 if $test -f uselongdouble.cbu; then
5219     echo "Your platform has some specific hints regarding long doubles, using them..."
5220     . ./uselongdouble.cbu
5221 else
5222     case "$uselongdouble" in
5223         $define)
5224                 $cat <<EOM
5225 (Your platform does not have any specific hints for long doubles.)
5226 EOM
5227         ;;
5228     esac
5229 fi
5230
5231 : Check if quadmath is requested
5232 case "$usequadmath" in
5233 "$define"|true|[yY]*) usequadmath="$define" ;;
5234 *)                    usequadmath="$undef"  ;;
5235 esac
5236
5237 : Fail if both uselongdouble and usequadmath are requested
5238 case "$usequadmath:$uselongdouble" in
5239 define:define)
5240         $cat <<EOM >&4
5241
5242 *** You requested the use of the quadmath library and use
5243 *** of long doubles.
5244 ***
5245 *** Please select one or the other.
5246 EOM
5247         exit 1
5248         ;;
5249 esac
5250
5251 : Looking for optional libraries
5252 echo " "
5253 echo "Checking for optional libraries..." >&4
5254 case "$libs" in
5255 ' '|'') dflt='';;
5256 *) dflt="$libs";;
5257 esac
5258 case "$libswanted" in
5259 '') libswanted='c_s';;
5260 esac
5261 case "$usesocks" in
5262 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5263 esac
5264 case "$usecbacktrace" in
5265 "$define") libswanted="$libswanted bfd" ;;
5266 esac
5267 case "$usequadmath" in
5268 "$define") libswanted="$libswanted quadmath" ;;
5269 esac
5270 libsfound=''
5271 libsfiles=''
5272 libsdirs=''
5273 libspath=''
5274 for thisdir in $libpth $xlibpth; do
5275   test -d $thisdir && libspath="$libspath $thisdir"
5276 done
5277 for thislib in $libswanted; do
5278         for thisdir in $libspath; do
5279             xxx=''
5280             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5281                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5282                 $test -f "$xxx" && eval $libscheck
5283                 $test -f "$xxx" && libstyle=shared
5284                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5285                 $test -f "$xxx" && eval $libscheck
5286                 $test -f "$xxx" && libstyle=shared
5287             fi
5288             if test ! -f "$xxx"; then
5289                 xxx=$thisdir/lib$thislib.$so
5290                 $test -f "$xxx" && eval $libscheck
5291                 $test -f "$xxx" && libstyle=shared
5292             fi
5293             if test ! -f "$xxx"; then
5294                 xxx=$thisdir/lib$thislib$_a
5295                 $test -f "$xxx" && eval $libscheck
5296                 $test -f "$xxx" && libstyle=static
5297             fi
5298             if test ! -f "$xxx"; then
5299                 xxx=$thisdir/$thislib$_a
5300                 $test -f "$xxx" && eval $libscheck
5301                 $test -f "$xxx" && libstyle=static
5302             fi
5303             if test ! -f "$xxx"; then
5304                 xxx=$thisdir/lib${thislib}_s$_a
5305                 $test -f "$xxx" && eval $libscheck
5306                 $test -f "$xxx" && libstyle=static
5307                 $test -f "$xxx" && thislib=${thislib}_s
5308             fi
5309             if test ! -f "$xxx"; then
5310                 xxx=$thisdir/Slib$thislib$_a
5311                 $test -f "$xxx" && eval $libscheck
5312                 $test -f "$xxx" && libstyle=static
5313             fi
5314             if $test -f "$xxx"; then
5315                 case "$libstyle" in
5316                 shared) echo "Found -l$thislib (shared)." ;;
5317                 static) echo "Found -l$thislib." ;;
5318                 *)      echo "Found -l$thislib ($libstyle)." ;;
5319                 esac
5320                 case " $dflt " in
5321                 *"-l$thislib "*);;
5322                 *) dflt="$dflt -l$thislib"
5323                    libsfound="$libsfound $xxx"
5324                    yyy=`basename $xxx`
5325                    libsfiles="$libsfiles $yyy"
5326                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5327                    case " $libsdirs " in
5328                    *" $yyy "*) ;;
5329                    *) libsdirs="$libsdirs $yyy" ;;
5330                    esac
5331                    ;;
5332                 esac
5333                 break
5334             fi
5335         done
5336         if $test ! -f "$xxx"; then
5337             echo "No -l$thislib."
5338         fi
5339 done
5340 set X $dflt
5341 shift
5342 dflt="$*"
5343 case "$libs" in
5344 '') dflt="$dflt";;
5345 *) dflt="$libs";;
5346 esac
5347 case "$dflt" in
5348 ' '|'') dflt='none';;
5349 esac
5350
5351 $cat <<EOM
5352
5353 In order to compile $package on your machine, a number of libraries
5354 are usually needed.  Include any other special libraries here as well.
5355 Say "none" for none.  The default list is almost always right.
5356 EOM
5357
5358 echo " "
5359 rp="What libraries to use?"
5360 . ./myread
5361 case "$ans" in
5362 none) libs=' ';;
5363 *) libs="$ans";;
5364 esac
5365
5366 : determine optimization, if desired, or use for debug flag also
5367 case "$optimize" in
5368 ' '|$undef) dflt='none';;
5369 '') dflt='-O';;
5370 *) dflt="$optimize";;
5371 esac
5372 $cat <<EOH
5373
5374 By default, $package compiles with the -O flag to use the optimizer.
5375 Alternately, you might want to use the symbolic debugger, which uses
5376 the -g flag (on traditional Unix systems).  Either flag can be
5377 specified here.  To use neither flag, specify the word "none".
5378
5379 EOH
5380 rp="What optimizer/debugger flag should be used?"
5381 . ./myread
5382 optimize="$ans"
5383 case "$optimize" in
5384 'none') optimize=" ";;
5385 esac
5386
5387 : Check what DEBUGGING is required from the command line
5388 : -DEBUGGING      or -DDEBUGGING or
5389 : -DEBUGGING=both                       = -g + -DDEBUGGING
5390 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5391 : -DEBUGGING=none or -UDEBUGGING        =
5392 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5393 case "$EBUGGING" in
5394 '')     ;;
5395 *)      DEBUGGING=$EBUGGING ;;
5396 esac
5397
5398 case "$DEBUGGING" in
5399 -g|both|$define)
5400     case "$optimize" in
5401         *-g*) ;;
5402         *)    optimize="$optimize -g" ;;
5403     esac ;;
5404 none|$undef)
5405     case "$optimize" in
5406         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5407                 shift
5408                 optimize="$*"
5409                 ;;
5410     esac ;;
5411 esac
5412
5413 dflt=''
5414 case "$DEBUGGING" in
5415 both|$define) dflt='-DDEBUGGING'
5416 esac
5417
5418 : argument order is deliberate, as the flag will start with - which set could
5419 : think is an option
5420 checkccflag='check=$1; flag=$2; callback=$3;
5421 echo " ";
5422 echo "Checking if your compiler accepts $flag" 2>&1;
5423 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5424 echo "int main(void) { return 0; }" > gcctest.c;
5425 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5426     echo "Yes, it does." 2>&1;
5427     if $test -s gcctest.out ; then
5428         echo "But your platform does not like it:";
5429         cat gcctest.out;
5430     else
5431         case "$ccflags" in
5432         *$check*)
5433             echo "Leaving current flags $ccflags alone." 2>&1
5434             ;;
5435         *) dflt="$dflt $flag";
5436             eval $callback
5437             ;;
5438         esac
5439     fi
5440 else
5441     echo "Nope, it does not, but that is ok." 2>&1;
5442 fi
5443 '
5444
5445 : We will not override a previous value, but we might want to
5446 : augment a hint file
5447 case "$hint" in
5448 default|recommended)
5449         case "$gccversion" in
5450         1*) dflt="$dflt -fpcc-struct-return" ;;
5451         esac
5452         case "$optimize:$DEBUGGING" in
5453         *-g*:old) dflt="$dflt -DDEBUGGING";;
5454         esac
5455         case "$gccversion" in
5456         2*) if $test -d /etc/conf/kconfig.d &&
5457                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5458                 then
5459                         # Interactive Systems (ISC) POSIX mode.
5460                         dflt="$dflt -posix"
5461                 fi
5462                 ;;
5463         esac
5464         case "$gccversion" in
5465         1*) ;;
5466         2.[0-8]*) ;;
5467         ?*)     set strict-aliasing -fno-strict-aliasing
5468                 eval $checkccflag
5469                 ;;
5470         esac
5471         # For gcc, adding -pipe speeds up compilations for some, but apparently
5472         # some assemblers can't read from stdin.  (It also slows down compilations
5473         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5474         case "$gccversion" in
5475         ?*)     set pipe -pipe
5476                 eval $checkccflag
5477                 ;;
5478         esac
5479
5480         # on x86_64 (at least) we require an extra library (libssp) in the
5481         # link command line. This library is not named, so I infer that it is
5482         # an implementation detail that may change. Hence the safest approach
5483         # is to add the flag to the flags passed to the compiler at link time,
5484         # as that way the compiler can do the right implementation dependant
5485         # thing. (NWC)
5486         case "$osname" in
5487         amigaos) ;; # -fstack-protector builds but doesn't work
5488         *)      case "$gccversion" in
5489                 ?*)     set stack-protector-strong -fstack-protector-strong
5490                         eval $checkccflag
5491                         case "$dflt" in
5492                         *-fstack-protector-strong*) ;; # It got added.
5493                         *) # Try the plain/older -fstack-protector.
5494                            set stack-protector -fstack-protector
5495                            eval $checkccflag
5496                            ;;
5497                         esac
5498                         ;;
5499                 esac
5500                 ;;
5501         esac
5502         ;;
5503 esac
5504
5505 case "$mips_type" in
5506 *BSD*|'') inclwanted="$locincpth $usrinc";;
5507 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5508 esac
5509 for thisincl in $inclwanted; do
5510         if $test -d $thisincl; then
5511                 if $test x$thisincl != x$usrinc; then
5512                         case "$dflt" in
5513                         *" -I$thisincl "*);;
5514                         *) dflt="$dflt -I$thisincl ";;
5515                         esac
5516                 fi
5517         fi
5518 done
5519
5520 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5521         xxx=true;
5522 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5523         xxx=true;
5524 else
5525         xxx=false;
5526 fi;
5527 if $xxx; then
5528         case "$dflt" in
5529         *$2*);;
5530         *) dflt="$dflt -D$2";;
5531         esac;
5532 fi'
5533
5534 set signal.h LANGUAGE_C; eval $inctest
5535
5536 case "$usesocks" in
5537 $define)
5538         ccflags="$ccflags -DSOCKS"
5539         ;;
5540 esac
5541
5542 case "$hint" in
5543 default|recommended) dflt="$ccflags $dflt" ;;
5544 *) dflt="$ccflags";;
5545 esac
5546
5547 case "$dflt" in
5548 ''|' ') dflt=none;;
5549 esac
5550
5551 $cat <<EOH
5552
5553 Your C compiler may want other flags.  For this question you should include
5554 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5555 but you should NOT include libraries or ld flags like -lwhatever.  If you
5556 want $package to honor its debug switch, you should include -DDEBUGGING here.
5557 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5558
5559 To use no flags, specify the word "none".
5560
5561 EOH
5562 set X $dflt
5563 shift
5564 dflt=${1+"$@"}
5565 rp="Any additional cc flags?"
5566 . ./myread
5567 case "$ans" in
5568 none) ccflags='';;
5569 *) ccflags="$ans";;
5570 esac
5571
5572 : the following weeds options from ccflags that are of no interest to cpp
5573 case "$cppflags" in
5574 '') cppflags="$ccflags" ;;
5575 *)  set X $ccflags; shift
5576     case " $cppflags " in
5577     *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5578     *) cppflags="$cppflags $ccflags" ;;
5579     esac
5580     ;;
5581 esac
5582 case "$gccversion" in
5583 1*) cppflags="$cppflags -D__GNUC__"
5584 esac
5585 case "$mips_type" in
5586 '');;
5587 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5588 esac
5589 case "$cppflags" in
5590 '');;
5591 *)
5592         echo " "
5593         echo "Let me guess what the preprocessor flags are..." >&4
5594         set X $cppflags
5595         shift
5596         cppflags=''
5597         $cat >cpp.c <<'EOM'
5598 #define BLURFL foo
5599
5600 BLURFL xx LFRULB
5601 EOM
5602         previous=''
5603         for flag in $*
5604         do
5605                 case "$flag" in
5606                 -*) ftry="$flag";;
5607                 *) ftry="$previous $flag";;
5608                 esac
5609                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5610                         >cpp1.out 2>/dev/null && \
5611                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5612                         >cpp2.out 2>/dev/null && \
5613                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5614                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5615                 then
5616                         cppflags="$cppflags $ftry"
5617                         previous=''
5618                 else
5619                         previous="$flag"
5620                 fi
5621         done
5622         set X $cppflags
5623         shift
5624         cppflags=${1+"$@"}
5625         case "$cppflags" in
5626         *-*)  echo "They appear to be: $cppflags";;
5627         esac
5628         $rm -f cpp.c cpp?.out
5629         ;;
5630 esac
5631
5632 : flags used in final linking phase
5633 case "$ldflags" in
5634 '') if ./venix; then
5635                 dflt='-i -z'
5636         else
5637                 dflt=''
5638         fi
5639         case "$ccflags" in
5640         *-posix*) dflt="$dflt -posix" ;;
5641         esac
5642         ;;
5643 *) dflt="$ldflags";;
5644 esac
5645 # See note above about -fstack-protector
5646 case "$ccflags" in
5647 *-fstack-protector-strong*)
5648         case "$dflt" in
5649         *-fstack-protector-strong*) ;; # Don't add it again
5650         *) dflt="$dflt -fstack-protector-strong" ;;
5651         esac
5652         ;;
5653 *-fstack-protector*)
5654         case "$dflt" in
5655         *-fstack-protector*) ;; # Don't add it again
5656         *) dflt="$dflt -fstack-protector" ;;
5657         esac
5658         ;;
5659 esac
5660
5661 : Try to guess additional flags to pick up local libraries.
5662 for thislibdir in $libpth; do
5663         case " $loclibpth " in
5664         *" $thislibdir "*)
5665                 case "$dflt " in
5666                 *"-L$thislibdir "*) ;;
5667                 *)  dflt="$dflt -L$thislibdir" ;;
5668                 esac
5669                 ;;
5670         esac
5671 done
5672
5673 case "$dflt" in
5674 '') dflt='none' ;;
5675 esac
5676
5677 $cat <<EOH
5678
5679 Your C linker may need flags.  For this question you should
5680 include -L/whatever and any other flags used by the C linker, but you
5681 should NOT include libraries like -lwhatever.
5682
5683 Make sure you include the appropriate -L/path flags if your C linker
5684 does not normally search all of the directories you specified above,
5685 namely
5686         $libpth
5687 To use no flags, specify the word "none".
5688
5689 EOH
5690
5691 rp="Any additional ld flags (NOT including libraries)?"
5692 . ./myread
5693 case "$ans" in
5694 none) ldflags='';;
5695 *) ldflags="$ans";;
5696 esac
5697 rmlist="$rmlist pdp11"
5698
5699 : coherency check
5700 echo " "
5701 echo "Checking your choice of C compiler and flags for coherency..." >&4
5702 $cat > try.c <<'EOF'
5703 #include <stdio.h>
5704 int main() { printf("Ok\n"); return(0); }
5705 EOF
5706 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5707 shift
5708 $cat >try.msg <<'EOM'
5709 I've tried to compile and run the following simple program:
5710
5711 EOM
5712 $cat try.c >> try.msg
5713
5714 $cat >> try.msg <<EOM
5715
5716 I used the command:
5717
5718         $*
5719         $run ./try
5720
5721 and I got the following output:
5722
5723 EOM
5724 dflt=y
5725 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5726         if $sh -c "$run ./try " >>try.msg 2>&1; then
5727                 xxx=`$run ./try`
5728                 case "$xxx" in
5729                 "Ok") dflt=n ;;
5730                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5731                 esac
5732         else
5733                 echo "The program compiled OK, but exited with status $?." >>try.msg
5734                 rp="You have a problem.  Shall I abort Configure"
5735                 dflt=y
5736         fi
5737 else
5738         echo "I can't compile the test program." >>try.msg
5739         rp="You have a BIG problem.  Shall I abort Configure"
5740         dflt=y
5741 fi
5742 case "$dflt" in
5743 y)
5744         $cat try.msg >&4
5745         case "$knowitall" in
5746         '')
5747                 echo "(The supplied flags or libraries might be incorrect.)"
5748                 ;;
5749         *) dflt=n;;
5750         esac
5751         echo " "
5752         . ./myread
5753         case "$ans" in
5754         n*|N*) ;;
5755         *)      echo "Ok.  Stopping Configure." >&4
5756                 exit 1
5757                 ;;
5758         esac
5759         ;;
5760 n) echo "OK, that should do.";;
5761 esac
5762 $rm_try gcctest gcctest.out
5763
5764 : define a shorthand compile call
5765 compile='
5766 mc_file=$1;
5767 shift;
5768 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5769 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5770 exit 1;
5771 fi;
5772 esac;
5773 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5774 : define a shorthand compile call for compilations that should be ok.
5775 compile_ok='
5776 mc_file=$1;
5777 shift;
5778 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5779
5780 : stub, used only to satisfy other units
5781 i_stdlib='define'
5782
5783 : check for lengths of integral types
5784 echo " "
5785 case "$intsize" in
5786 '')
5787         echo "Checking to see how big your integers are..." >&4
5788         $cat >try.c <<EOCP
5789 #include <stdio.h>
5790 #$i_stdlib I_STDLIB
5791 #ifdef I_STDLIB
5792 #include <stdlib.h>
5793 #endif
5794 int main()
5795 {
5796         printf("intsize=%d;\n", (int)sizeof(int));
5797         printf("longsize=%d;\n", (int)sizeof(long));
5798         printf("shortsize=%d;\n", (int)sizeof(short));
5799         exit(0);
5800 }
5801 EOCP
5802         set try
5803         if eval $compile_ok && $run ./try > /dev/null; then
5804                 eval `$run ./try`
5805                 echo "Your integers are $intsize bytes long."
5806                 echo "Your long integers are $longsize bytes long."
5807                 echo "Your short integers are $shortsize bytes long."
5808         else
5809                 $cat >&4 <<EOM
5810 !
5811 Help! I can't compile and run the intsize test program: please enlighten me!
5812 (This is probably a misconfiguration in your system or libraries, and
5813 you really ought to fix it.  Still, I'll try anyway.)
5814 !
5815 EOM
5816                 dflt=4
5817                 rp="What is the size of an integer (in bytes)?"
5818                 . ./myread
5819                 intsize="$ans"
5820                 dflt=$intsize
5821                 rp="What is the size of a long integer (in bytes)?"
5822                 . ./myread
5823                 longsize="$ans"
5824                 dflt=2
5825                 rp="What is the size of a short integer (in bytes)?"
5826                 . ./myread
5827                 shortsize="$ans"
5828         fi
5829         ;;
5830 esac
5831 $rm_try
5832
5833 : check for long long
5834 echo " "
5835 echo "Checking to see if you have long long..." >&4
5836 echo 'int main() { long long x = 7; return 0; }' > try.c
5837 set try
5838 if eval $compile; then
5839         val="$define"
5840         echo "You have long long."
5841 else
5842         val="$undef"
5843         echo "You do not have long long."
5844 fi
5845 $rm_try
5846 set d_longlong
5847 eval $setvar
5848
5849 : check for length of long long
5850 case "${d_longlong}${longlongsize}" in
5851 $define)
5852         echo " "
5853         echo "Checking to see how big your long longs are..." >&4
5854         $cat >try.c <<'EOCP'
5855 #include <stdio.h>
5856 int main()
5857 {
5858     printf("%d\n", (int)sizeof(long long));
5859     return(0);
5860 }
5861 EOCP
5862         set try
5863         if eval $compile_ok; then
5864                 longlongsize=`$run ./try`
5865                 echo "Your long longs are $longlongsize bytes long."
5866         else
5867                 dflt='8'
5868                 echo " "
5869                 echo "(I can't seem to compile the test program.  Guessing...)"
5870                 rp="What is the size of a long long (in bytes)?"
5871                 . ./myread
5872                 longlongsize="$ans"
5873         fi
5874         if $test "X$longsize" = "X$longlongsize"; then
5875                 echo "(That isn't any different from an ordinary long.)"
5876         fi
5877         ;;
5878 esac
5879 $rm_try
5880
5881 : determine filename position in cpp output
5882 echo " "
5883 echo "Computing filename position in cpp output for #include directives..." >&4
5884 case "$osname" in
5885 amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5886 esac
5887 case "$fieldn" in
5888 '')
5889 case "$osname" in
5890 vos) testaccess=-e ;;
5891 *)   testaccess=-r ;;
5892 esac
5893 echo '#include <stdio.h>' > foo.c
5894 $cat >fieldn <<EOF
5895 $startsh
5896 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5897 $grep '^[       ]*#.*stdio\.h' | \
5898 while read cline; do
5899         pos=1
5900         set \$cline
5901         while $test \$# -gt 0; do
5902                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5903                         echo "\$pos"
5904                         exit 0
5905                 fi
5906                 shift
5907                 pos=\`expr \$pos + 1\`
5908         done
5909 done
5910 EOF
5911 chmod +x fieldn
5912 fieldn=`./fieldn`
5913 $rm -f foo.c fieldn
5914 ;;
5915 esac
5916 case $fieldn in
5917 '') pos='???';;
5918 1) pos=first;;
5919 2) pos=second;;
5920 3) pos=third;;
5921 *) pos="${fieldn}th";;
5922 esac
5923 echo "Your cpp writes the filename in the $pos field of the line."
5924
5925 : locate header file
5926 $cat >findhdr <<EOF
5927 $startsh
5928 wanted=\$1
5929 name=''
5930 for usrincdir in $incpth
5931 do
5932         if test -f \$usrincdir/\$wanted; then
5933                 echo "\$usrincdir/\$wanted"
5934                 exit 0
5935         fi
5936 done
5937 awkprg='{ print \$$fieldn }'
5938 echo "#include <\$wanted>" > foo\$\$.c
5939 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5940 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5941 while read cline; do
5942         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5943         case "\$name" in
5944         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5945         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5946         *) exit 2;;
5947         esac;
5948 done;
5949 #
5950 # status = 0: grep returned 0 lines, case statement not executed
5951 # status = 1: headerfile found
5952 # status = 2: while loop executed, no headerfile found
5953 #
5954 status=\$?
5955 $rm -f foo\$\$.c;
5956 if test \$status -eq 1; then
5957         exit 0;
5958 fi
5959 exit 1
5960 EOF
5961 chmod +x findhdr
5962
5963 : define an alternate in-header-list? function
5964 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5965 cont=true; xxf="echo \"<\$1> found.\" >&4";
5966 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5967 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5968 esac;
5969 case $# in 4) instead=instead;; *) instead="at last";; esac;
5970 while $test "$cont"; do
5971         xxx=`./findhdr $1`
5972         var=$2; eval "was=\$$2";
5973         if $test "$xxx" && $test -r "$xxx";
5974         then eval $xxf;
5975         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5976                 cont="";
5977         else eval $xxnf;
5978         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5979         set $yyy; shift; shift; yyy=$@;
5980         case $# in 0) cont="";;
5981         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5982                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5983         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5984                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5985         esac;
5986 done;
5987 while $test "$yyy";
5988 do set $yyy; var=$2; eval "was=\$$2";
5989         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5990         set $yyy; shift; shift; yyy=$@;
5991 done'
5992
5993 : see if inttypes.h is available
5994 : we want a real compile instead of Inhdr because some systems
5995 : have an inttypes.h which includes non-existent headers
5996 echo " "
5997 $cat >try.c <<EOCP
5998 #include <inttypes.h>
5999 int main() {
6000         static int32_t foo32 = 0x12345678;
6001 }
6002 EOCP
6003 set try
6004 if eval $compile; then
6005         echo "<inttypes.h> found." >&4
6006         val="$define"
6007 else
6008         echo "<inttypes.h> NOT found." >&4
6009         val="$undef"
6010 fi
6011 $rm_try
6012 set i_inttypes
6013 eval $setvar
6014
6015 : check for int64_t
6016 echo " "
6017 echo "Checking to see if you have int64_t..." >&4
6018 $cat >try.c <<EOCP
6019 #include <sys/types.h>
6020 #$i_inttypes I_INTTYPES
6021 #ifdef I_INTTYPES
6022 #include <inttypes.h>
6023 #endif
6024 int main() { int64_t x = 7; }
6025 EOCP
6026 set try
6027 if eval $compile; then
6028         val="$define"
6029         echo "You have int64_t."
6030 else
6031         val="$undef"
6032         echo "You do not have int64_t."
6033 fi
6034 $rm_try
6035 set d_int64_t
6036 eval $setvar
6037
6038 : Check if 64bit ints have a quad type
6039 echo " "
6040 echo "Checking which 64-bit integer type we could use..." >&4
6041
6042 case "$intsize" in
6043 8) val=int
6044    set quadtype
6045    eval $setvar
6046    val='"unsigned int"'
6047    set uquadtype
6048    eval $setvar
6049    quadkind=1
6050    ;;
6051 *) case "$longsize" in
6052    8) val=long
6053       set quadtype
6054       eval $setvar
6055       val='"unsigned long"'
6056       set uquadtype
6057       eval $setvar
6058       quadkind=2
6059       ;;
6060    *) case "$d_longlong:$longlongsize" in
6061       define:8)
6062         val='"long long"'
6063         set quadtype
6064         eval $setvar
6065         val='"unsigned long long"'
6066         set uquadtype
6067         eval $setvar
6068         quadkind=3
6069         ;;
6070       *) case "$d_int64_t" in
6071          define)
6072            val=int64_t
6073            set quadtype
6074            eval $setvar
6075            val=uint64_t
6076            set uquadtype
6077            eval $setvar
6078            quadkind=4
6079            ;;
6080          esac
6081          ;;
6082       esac
6083       ;;
6084    esac
6085    ;;
6086 esac
6087
6088 case "$quadtype" in
6089 '')     echo "Alas, no 64-bit integer types in sight." >&4
6090         d_quad="$undef"
6091         ;;
6092 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6093         d_quad="$define"
6094         ;;
6095 esac
6096
6097 : Do we want 64bit support
6098 case "$uselonglong" in
6099 "$define"|true|[yY]*)
6100         cat <<EOM >&4
6101
6102 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6103 EOM
6104         use64bitint="$define"
6105         ;;
6106 esac
6107 case "$use64bits" in
6108 "$define"|true|[yY]*)
6109         cat <<EOM >&4
6110
6111 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6112 EOM
6113         use64bitint="$define"
6114         ;;
6115 esac
6116 case "$use64bitints" in
6117 "$define"|true|[yY]*)
6118         cat <<EOM >&4
6119
6120 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6121 EOM
6122         use64bitint="$define"
6123         ;;
6124 esac
6125 case "$use64bitsint" in
6126 "$define"|true|[yY]*)
6127         cat <<EOM >&4
6128
6129 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6130 EOM
6131         use64bitint="$define"
6132         ;;
6133 esac
6134 case "$uselonglongs" in
6135 "$define"|true|[yY]*)
6136         cat <<EOM >&4
6137
6138 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6139 EOM
6140         use64bitint="$define"
6141         ;;
6142 esac
6143 case "$use64bitsall" in
6144 "$define"|true|[yY]*)
6145         cat <<EOM >&4
6146
6147 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6148 EOM
6149         use64bitall="$define"
6150         ;;
6151 esac
6152
6153 case "$ccflags" in
6154 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6155 esac
6156 case "$use64bitall" in
6157 "$define"|true|[yY]*) use64bitint="$define" ;;
6158 esac
6159
6160 case "$longsize" in
6161 8) cat <<EOM
6162
6163 You have natively 64-bit long integers.
6164 EOM
6165    val="$define"
6166    ;;
6167 *) case "$use64bitint" in
6168    "$define"|true|[yY]*) dflt='y';;
6169    *) dflt='n';;
6170    esac
6171    case "$d_quad" in
6172    "$define") ;;
6173    *) dflt='n' ;;
6174    esac
6175    cat <<EOM
6176
6177 Perl can be built to take advantage of 64-bit integer types
6178 on some systems.  To do so, Configure can be run with -Duse64bitint.
6179 Choosing this option will most probably introduce binary incompatibilities.
6180
6181 If this doesn't make any sense to you, just accept the default '$dflt'.
6182 (The default has been chosen based on your configuration.)
6183 EOM
6184    rp='Try to use 64-bit integers, if available?'
6185    . ./myread
6186    case "$ans" in
6187    [yY]*) val="$define" ;;
6188    *)     val="$undef"  ;;
6189    esac
6190    ;;
6191 esac
6192 set use64bitint
6193 eval $setvar
6194
6195 case "$use64bitall" in
6196 "$define"|true|[yY]*) dflt='y' ;;
6197 *) case "$longsize" in
6198    8) dflt='y' ;;
6199    *) dflt='n' ;;
6200    esac
6201    ;;
6202 esac
6203 cat <<EOM
6204
6205 You may also choose to try maximal 64-bitness.  It means using as much
6206 64-bitness as possible on the platform.  This in turn means even more
6207 binary incompatibilities.  On the other hand, your platform may not
6208 have any more 64-bitness available than what you already have chosen.
6209
6210 If this doesn't make any sense to you, just accept the default '$dflt'.
6211 (The default has been chosen based on your configuration.)
6212 EOM
6213 rp='Try to use maximal 64-bit support, if available?'
6214 . ./myread
6215 case "$ans" in
6216 [yY]*) val="$define" ;;
6217 *)     val="$undef"  ;;
6218 esac
6219 set use64bitall
6220 eval $setvar
6221 case "$use64bitall" in
6222 "$define")
6223         case "$use64bitint" in
6224         "$undef")
6225                 cat <<EOM
6226
6227 Since you have chosen a maximally 64-bit build, I'm also turning on
6228 the use of 64-bit integers.
6229 EOM
6230                 use64bitint="$define" ;;
6231         esac
6232         ;;
6233 esac
6234
6235 : Look for a hint-file generated 'call-back-unit'.  If the
6236 : user has specified that a 64-bit perl is to be built,
6237 : we may need to set or change some other defaults.
6238 if $test -f use64bitint.cbu; then
6239         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6240         . ./use64bitint.cbu
6241 fi
6242 case "$use64bitint" in
6243 "$define"|true|[yY]*)
6244         : This test was common to all the OpenBSD forks, and seems harmless for
6245         : other platforms:
6246         echo " "
6247         echo "Checking if your C library has broken 64-bit functions..." >&4
6248         cat >try.c <<EOCP
6249 #include <stdio.h>
6250 typedef $uquadtype myULL;
6251 int main (void)
6252 {
6253     struct {
6254         double d;
6255         myULL  u;
6256     } *p, test[] = {
6257         {4294967303.15, 4294967303ULL},
6258         {4294967294.2,  4294967294ULL},
6259         {4294967295.7,  4294967295ULL},
6260         {0.0, 0ULL}
6261     };
6262     for (p = test; p->u; p++) {
6263         myULL x = (myULL)p->d;
6264         if (x != p->u) {
6265             printf("buggy\n");
6266             return 0;
6267         }
6268     }
6269     printf("ok\n");
6270     return 0;
6271 }
6272 EOCP
6273         set try
6274         if eval $compile_ok; then
6275             libcquad=`$run ./try`
6276             echo "Your C library's 64-bit functions are $libcquad."
6277         else
6278             echo "(I can't seem to compile the test program.)"
6279             echo "Assuming that your C library's 64-bit functions are ok."
6280             libcquad="ok"
6281         fi
6282         $rm_try
6283
6284         case "$libcquad" in
6285             buggy*)
6286                 cat >&4 <<EOM
6287
6288 *** You have a C library with broken 64-bit functions.
6289 *** 64-bit support does not work reliably in this configuration.
6290 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6291 *** Cannot continue, aborting.
6292
6293 EOM
6294                 exit 1
6295                 ;;
6296         esac
6297         case "$longsize" in
6298         4) case "$archname64" in
6299            '') archname64=64int ;;
6300            esac
6301            ;;
6302         esac
6303         ;;
6304 esac
6305
6306 : Look for a hint-file generated 'call-back-unit'.  If the
6307 : user has specified that a maximally 64-bit perl is to be built,
6308 : we may need to set or change some other defaults.
6309 if $test -f use64bitall.cbu; then
6310         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6311         . ./use64bitall.cbu
6312 fi
6313 case "$use64bitall" in
6314 "$define"|true|[yY]*)
6315         case "$longsize" in
6316         4) case "$archname64" in
6317            ''|64int) archname64=64all ;;
6318            esac
6319            ;;
6320         esac
6321         ;;
6322 esac
6323
6324 case "$d_quad:$use64bitint" in
6325 $undef:$define)
6326         cat >&4 <<EOF
6327
6328 *** You have chosen to use 64-bit integers,
6329 *** but none can be found.
6330 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6331 *** Cannot continue, aborting.
6332
6333 EOF
6334         exit 1
6335         ;;
6336 esac
6337
6338 : Check if we are using the GNU C library
6339 echo " "
6340 echo "Checking for GNU C Library..." >&4
6341 cat >try.c <<'EOCP'
6342 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6343    alone are insufficient to distinguish different versions, such as
6344    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6345    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6346 */
6347 #include <stdio.h>
6348 int main(void)
6349 {
6350 #ifdef __GLIBC__
6351 #   ifdef __GLIBC_MINOR__
6352 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6353 #           include <gnu/libc-version.h>
6354             printf("%s\n",  gnu_get_libc_version());
6355 #       else
6356             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6357 #       endif
6358 #   else
6359         printf("%d\n",  __GLIBC__);
6360 #   endif
6361     return 0;
6362 #else
6363     return 1;
6364 #endif
6365 }
6366 EOCP
6367 set try
6368 if eval $compile_ok && $run ./try > glibc.ver; then
6369         val="$define"
6370         gnulibc_version=`$cat glibc.ver`
6371         echo "You are using the GNU C Library version $gnulibc_version"
6372 else
6373         val="$undef"
6374         gnulibc_version=''
6375         echo "You are not using the GNU C Library"
6376 fi
6377 $rm_try glibc.ver
6378 set d_gnulibc
6379 eval $setvar
6380
6381 : see if nm is to be used to determine whether a symbol is defined or not
6382 case "$usenm" in
6383 '')
6384         dflt=''
6385         case "$d_gnulibc" in
6386         "$define")
6387                 echo " "
6388                 echo "nm probably won't work on the GNU C Library." >&4
6389                 dflt=n
6390                 ;;
6391         esac
6392         case "$dflt" in
6393         '')
6394                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6395                         echo " "
6396                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6397                         echo "'nm' won't be sufficient on this system." >&4
6398                         dflt=n
6399                 fi
6400                 ;;
6401         esac
6402         case "$dflt" in
6403         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6404                 if $test $dflt -gt 20; then
6405                         dflt=y
6406                 else
6407                         dflt=n
6408                 fi
6409                 ;;
6410         esac
6411         ;;
6412 *)
6413         case "$usenm" in
6414         true|$define) dflt=y;;
6415         *) dflt=n;;
6416         esac
6417         ;;
6418 esac
6419 $cat <<EOM
6420
6421 I can use $nm to extract the symbols from your C libraries. This
6422 is a time consuming task which may generate huge output on the disk (up
6423 to 3 megabytes) but that should make the symbols extraction faster. The
6424 alternative is to skip the 'nm' extraction part and to compile a small
6425 test program instead to determine whether each symbol is present. If
6426 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6427 this may be the best solution.
6428
6429 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6430
6431 EOM
6432 rp="Shall I use $nm to extract C symbols from the libraries?"
6433 . ./myread
6434 case "$ans" in
6435 [Nn]*) usenm=false;;
6436 *) usenm=true;;
6437 esac
6438
6439 runnm=$usenm
6440 case "$reuseval" in
6441 true) runnm=false;;
6442 esac
6443
6444 : nm options which may be necessary
6445 case "$nm_opt" in
6446 '') if $test -f /mach_boot; then
6447                 nm_opt=''       # Mach
6448         elif $test -d /usr/ccs/lib; then
6449                 nm_opt='-p'     # Solaris (and SunOS?)
6450         elif $test -f /dgux; then
6451                 nm_opt='-p'     # DG-UX
6452         elif $test -f /lib64/rld; then
6453                 nm_opt='-p'     # 64-bit Irix
6454         else
6455                 nm_opt=''
6456         fi;;
6457 esac
6458
6459 : nm options which may be necessary for shared libraries but illegal
6460 : for archive libraries.  Thank you, Linux.
6461 case "$nm_so_opt" in
6462 '')     case "$myuname" in
6463         *linux*|gnu*)
6464                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6465                         nm_so_opt='--dynamic'
6466                 fi
6467                 ;;
6468         esac
6469         ;;
6470 esac
6471
6472 : Figure out where the libc is located
6473 case "$runnm" in
6474 true)
6475 : get list of predefined functions in a handy place
6476 echo " "
6477 case "$libc" in
6478 '') libc=unknown
6479         case "$libs" in
6480         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6481         esac
6482         ;;
6483 esac
6484 case "$libs" in
6485 '') ;;
6486 *)  for thislib in $libs; do
6487         case "$thislib" in
6488         -lc|-lc_s)
6489                 : Handle C library specially below.
6490                 ;;
6491         -l*)
6492                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6493                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6494                         :
6495                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6496                         :
6497                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6498                         :
6499                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6500                         :
6501                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6502                         :
6503                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6504                         :
6505                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6506                         :
6507                 else
6508                         try=''
6509                 fi
6510                 libnames="$libnames $try"
6511                 ;;
6512         *) libnames="$libnames $thislib" ;;
6513         esac
6514         done
6515         ;;
6516 esac
6517 xxx=normal
6518 case "$libc" in
6519 unknown)
6520         set /lib/libc.$so
6521         for xxx in $libpth; do
6522                 $test -r $1 || set $xxx/libc.$so
6523                 : The messy sed command sorts on library version numbers.
6524                 $test -r $1 || \
6525                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6526                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6527                                 h
6528                                 s/[0-9][0-9]*/0000&/g
6529                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6530                                 G
6531                                 s/\n/ /' | \
6532                          $sort | $sed -e 's/^.* //'`
6533                 eval set \$$#
6534         done
6535         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6536         $test -r $1 || set $sysroot/lib/libsys_s$_a
6537         ;;
6538 *)
6539         set blurfl
6540         ;;
6541 esac
6542 if $test -r "$1"; then
6543         echo "Your (shared) C library seems to be in $1."
6544         libc="$1"
6545 elif $test -r /lib/libc && $test -r /lib/clib; then
6546         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6547         xxx=apollo
6548         libc='/lib/clib /lib/libc'
6549         if $test -r /lib/syslib; then
6550                 echo "(Your math library is in /lib/syslib.)"
6551                 libc="$libc /lib/syslib"
6552         fi
6553 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6554         echo "Your C library seems to be in $libc, as you said before."
6555 elif $test -r $incpath/usr/lib/libc$_a; then
6556         libc=$incpath/usr/lib/libc$_a;
6557         echo "Your C library seems to be in $libc.  That's fine."
6558 elif $test -r /lib/libc$_a; then
6559         libc=/lib/libc$_a;
6560         echo "Your C library seems to be in $libc.  You're normal."
6561 else
6562         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6563                 :
6564         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6565                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6566         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6567                 :
6568         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6569                 :
6570         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6571                 :
6572         else
6573                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6574         fi
6575         if $test -r "$tans"; then
6576                 echo "Your C library seems to be in $tans, of all places."
6577                 libc=$tans
6578         else
6579                 libc='blurfl'
6580         fi
6581 fi
6582 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6583         dflt="$libc"
6584         cat <<EOM
6585
6586 If the guess above is wrong (which it might be if you're using a strange
6587 compiler, or your machine supports multiple models), you can override it here.
6588
6589 EOM
6590 else
6591         dflt=''
6592         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6593         cat >&4 <<EOM
6594 I can't seem to find your C library.  I've looked in the following places:
6595
6596 EOM
6597         $sed 's/^/      /' libpath
6598         cat <<EOM
6599
6600 None of these seems to contain your C library. I need to get its name...
6601
6602 EOM
6603 fi
6604 fn=f
6605 rp='Where is your C library?'
6606 . ./getfile
6607 libc="$ans"
6608
6609 echo " "
6610 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6611 set X `cat libnames`
6612 shift
6613 xxx=files
6614 case $# in 1) xxx=file; esac
6615 echo "Extracting names from the following $xxx for later perusal:" >&4
6616 echo " "
6617 $sed 's/^/      /' libnames >&4
6618 echo " "
6619 $echo $n "This may take a while...$c" >&4
6620
6621 for file in $*; do
6622         case $file in
6623         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6624         *) $nm $nm_opt $file 2>/dev/null;;
6625         esac
6626 done >libc.tmp
6627
6628 $echo $n ".$c"
6629 $grep fprintf libc.tmp > libc.ptf
6630 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6631 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6632 xxx='[ADTSIWi]'
6633 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6634         eval $xscan;\
6635         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6636                 eval $xrun
6637 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6638         eval $xscan;\
6639         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6640                 eval $xrun
6641 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6642         eval $xscan;\
6643         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6644                 eval $xrun
6645 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6646         eval $xscan;\
6647         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6648                 eval $xrun
6649 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6650         eval $xscan;\
6651         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6652                 eval $xrun
6653 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6654         eval $xscan;\
6655         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6656                 eval $xrun
6657 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6658                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6659         eval $xscan;\
6660         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6661                 eval $xrun
6662 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6663         eval $xscan;\
6664         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6665                 eval $xrun
6666 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6667         eval $xscan;\
6668         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6669                 eval $xrun
6670 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6671         eval $xscan;\
6672         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6673                 eval $xrun
6674 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6675         eval $xscan;\
6676         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6677                 eval $xrun
6678 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6679         eval $xscan;\
6680         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6681                 eval $xrun
6682 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6683         eval $xscan;\
6684         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6685                 eval $xrun
6686 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6687         eval $xscan;\
6688         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6689                 eval $xrun
6690 else
6691         $nm -p $* 2>/dev/null >libc.tmp
6692         $grep fprintf libc.tmp > libc.ptf
6693         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6694                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6695         then
6696                 nm_opt='-p'
6697                 eval $xrun
6698         else
6699                 echo " "
6700                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6701                 com=''
6702                 if $ar t $libc > libc.tmp && \
6703                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6704                 then
6705                         for thisname in $libnames $libc; do
6706                                 $ar t $thisname >>libc.tmp
6707                         done
6708                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6709                         echo "Ok." >&4
6710                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6711                         for thisname in $libnames $libc; do
6712                                 $ar tv $thisname >>libc.tmp
6713                                 emximp -o tmp.imp $thisname \
6714                                     2>/dev/null && \
6715                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6716                                     < tmp.imp >>libc.tmp
6717                                 $rm -f tmp.imp
6718                         done
6719                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6720                         echo "Ok." >&4
6721                 else
6722                         echo "$ar didn't seem to work right." >&4
6723                         echo "Maybe this is a Cray...trying bld instead..." >&4
6724                         if  bld t $libc | \
6725                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6726                                 $test -s libc.list
6727                         then
6728                                 for thisname in $libnames; do
6729                                         bld t $libnames | \
6730                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6731                                         $ar t $thisname >>libc.tmp
6732                                 done
6733                                 echo "Ok." >&4
6734                         else
6735                                 echo "That didn't work either.  Giving up." >&4
6736                                 exit 1
6737                         fi
6738                 fi
6739         fi
6740 fi
6741 nm_extract="$com"
6742 case "$PASE" in
6743 define)
6744     echo " "
6745     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6746     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6747     ;;
6748 *)  if $test -f /lib/syscalls.exp; then
6749         echo " "
6750         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6751         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6752                 /lib/syscalls.exp >>libc.list
6753     fi
6754     ;;
6755 esac
6756 ;;
6757 esac
6758 $rm -f libnames libpath
6759
6760 : Check if we are using C++
6761 echo " "
6762 echo "Checking for C++..." >&4
6763 $cat >try.c <<'EOCP'
6764 #include <stdio.h>
6765 int main(void)
6766 {
6767 #ifdef __cplusplus
6768     return 0;
6769 #else
6770     return 1;
6771 #endif
6772 }
6773 EOCP
6774 set try
6775 if eval $compile_ok && $run ./try; then
6776         val="$define"
6777         echo "You are using a C++ compiler."
6778 else
6779         val="$undef"
6780         echo "You are not using a C++ compiler."
6781 fi
6782 $rm_try cplusplus$$
6783 set d_cplusplus
6784 eval $setvar
6785
6786 : is a C symbol defined?
6787 csym='tlook=$1;
6788 case "$3" in
6789 -v) tf=libc.tmp; tdc="";;
6790 -a) tf=libc.tmp; tdc="[]";;
6791 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6792 esac;
6793 case "$d_cplusplus" in
6794     $define)    extern_C="extern \"C\"" ;;
6795     *)          extern_C="extern"       ;;
6796 esac;
6797 tx=yes;
6798 case "$reuseval-$4" in
6799 true-) ;;
6800 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6801 esac;
6802 case "$tx" in
6803 yes)
6804         tval=false;
6805         if $test "$runnm" = true; then
6806                 if $contains $tlook $tf >/dev/null 2>&1; then
6807                         tval=true;
6808                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6809                         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;
6810                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6811                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6812                         $rm_try;
6813                 fi;
6814         else
6815                 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;
6816                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6817                 $rm_try;
6818         fi;
6819         ;;
6820 *)
6821         case "$tval" in
6822         $define) tval=true;;
6823         *) tval=false;;
6824         esac;
6825         ;;
6826 esac;
6827 eval "$2=$tval"'
6828
6829 : define an is-in-libc? function
6830 inlibc='echo " "; td=$define; tu=$undef;
6831 sym=$1; var=$2; eval "was=\$$2";
6832 tx=yes;
6833 case "$reuseval$was" in
6834 true) ;;
6835 true*) tx=no;;
6836 esac;
6837 case "$tx" in
6838 yes)
6839         set $sym tres -f;
6840         eval $csym;
6841         case "$tres" in
6842         true)
6843                 echo "$sym() found." >&4;
6844                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6845         *)
6846                 echo "$sym() NOT found." >&4;
6847                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6848         esac;;
6849 *)
6850         case "$was" in
6851         $define) echo "$sym() found." >&4;;
6852         *) echo "$sym() NOT found." >&4;;
6853         esac;;
6854 esac'
6855
6856 : check for length of double
6857 echo " "
6858 case "$doublesize" in
6859 '')
6860         echo "Checking to see how big your double precision numbers are..." >&4
6861         $cat >try.c <<EOCP
6862 #include <stdio.h>
6863 #$i_stdlib I_STDLIB
6864 #ifdef I_STDLIB
6865 #include <stdlib.h>
6866 #endif
6867 int main()
6868 {
6869     printf("%d\n", (int)sizeof(double));
6870     exit(0);
6871 }
6872 EOCP
6873         set try
6874         if eval $compile_ok; then
6875                 doublesize=`$run ./try`
6876                 echo "Your double is $doublesize bytes long."
6877         else
6878                 dflt='8'
6879                 echo "(I can't seem to compile the test program.  Guessing...)"
6880                 rp="What is the size of a double precision number (in bytes)?"
6881                 . ./myread
6882                 doublesize="$ans"
6883         fi
6884         ;;
6885 esac
6886 $rm_try
6887
6888 : check for long doubles
6889 echo " "
6890 echo "Checking to see if you have long double..." >&4
6891 echo 'int main() { long double x = 7.0; }' > try.c
6892 set try
6893 if eval $compile; then
6894         val="$define"
6895         echo "You have long double."
6896 else
6897         val="$undef"
6898         echo "You do not have long double."
6899 fi
6900 $rm_try
6901 set d_longdbl
6902 eval $setvar
6903
6904 : see if ldexpl exists
6905 set ldexpl d_ldexpl
6906 eval $inlibc
6907
6908 : check for length of long double
6909 case "${d_longdbl}${longdblsize}" in
6910 $define)
6911         echo " "
6912         echo "Checking to see how big your long doubles are..." >&4
6913         $cat >try.c <<'EOCP'
6914 #include <stdio.h>
6915 int main()
6916 {
6917         printf("%d\n", sizeof(long double));
6918 }
6919 EOCP
6920         set try
6921         set try
6922         if eval $compile; then
6923                 longdblsize=`$run ./try`
6924                 echo "Your long doubles are $longdblsize bytes long."
6925         else
6926                 dflt='8'
6927                 echo " "
6928                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6929                 rp="What is the size of a long double (in bytes)?"
6930                 . ./myread
6931                 longdblsize="$ans"
6932         fi
6933         if $test "X$doublesize" = "X$longdblsize"; then
6934                 echo "That isn't any different from an ordinary double."
6935                 echo "I'll keep your setting anyway, but you may see some"
6936                 echo "harmless compilation warnings."
6937         fi
6938         ;;
6939 esac
6940 $rm_try
6941
6942 $echo "Checking the kind of long doubles you have..." >&4
6943 case "$d_longdbl" in
6944 define)
6945 $cat <<EOP >try.c
6946 #$i_stdlib I_STDLIB
6947 #define LONGDBLSIZE $longdblsize
6948 #define DOUBLESIZE $doublesize
6949 #include <float.h>
6950 #ifdef I_STDLIB
6951 #include <stdlib.h>
6952 #endif
6953 #include <stdio.h>
6954 static const long double d = -0.1L;
6955 int main() {
6956   unsigned const char* b = (unsigned const char*)(&d);
6957 #if DOUBLESIZE == LONGDBLSIZE
6958   printf("0\n"); /* if it floats like double */
6959   exit(0);
6960 #endif
6961 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6962   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6963     /* IEEE 754 128-bit little-endian */
6964     printf("1\n");
6965     exit(0);
6966   }
6967   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6968     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6969     printf("2\n");
6970     exit(0);
6971   }
6972 #endif
6973 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6974  * while 64-bits platforms have it in 16 bytes.  The trailing bytes
6975  * cannot be trusted. */
6976 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6977   if (b[0] == 0xCD && b[9] == 0xBF) {
6978     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6979      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6980      * Also known as "extended precision". */
6981     printf("3\n");
6982     exit(0);
6983   }
6984   if (b[0] == 0xBF && b[9] == 0xCD) {
6985     /* Is there ever big-endian 80-bit, really?
6986      *
6987      * The Motorola 68881 had another "extended precision" format:
6988      * sign:1 exp:15 zero:16 integer:1 mantissa:63
6989      * for total of 96 bits of bytes.  The zero bits were unused.
6990      * See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL" for more details.
6991      * If it ever becomes relevant, this format should be allocated
6992      * a new doublekind code since it's quite different from the Intel x87.
6993      */
6994     printf("4\n");
6995     exit(0);
6996   }
6997 #endif
6998 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
6999   /* software "double double", the 106 is 53+53.
7000    * but irix thinks it is 107. */
7001   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
7002     /* double double 128-bit fully little-endian,
7003      * little-endian doubles in little-endian order,
7004      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
7005     printf("5\n");
7006     exit(0);
7007   }
7008   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7009     /* double double 128-bit fully big-endian,
7010      * big-endian doubles in big-endian order,
7011      * e.g. PPC/Power and MIPS:
7012      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7013     printf("6\n");
7014     exit(0);
7015   }
7016   if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7017     /* double double 128-bit mixed endian.
7018      * little-endian doubles in big-endian order,
7019      * e.g. ppc64el,
7020      * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7021     printf("7\n");
7022     exit(0);
7023   }
7024   if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7025     /* double double 128-bit mixed endian,
7026      * big-endian doubles in little-endian order,
7027      * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7028     printf("8\n");
7029     exit(0);
7030   }
7031 #endif
7032 /* We are largely making this up because it may well be
7033  * that the VAX format H was never made available to C,
7034  * only to Fortran. */
7035 #if LONGDBLSIZE == 16 && defined(__vax__)
7036   if (b[0] == 0xFD && b[15] == 0x99) {
7037     /* VAX format H, PDP-11 mixed endian. */
7038     printf("9\n");
7039     exit(0);
7040   }
7041 #endif
7042   printf("-1\n"); /* unknown */
7043   exit(0);
7044 }
7045 EOP
7046 set try
7047 if eval $compile; then
7048     longdblkind=`$run ./try`
7049 else
7050     longdblkind=-1
7051 fi
7052 ;;
7053 *) longdblkind=0 ;;
7054 esac
7055 case "$longdblkind" in
7056 0) echo "Your long doubles are doubles." >&4 ;;
7057 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7058 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7059 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
7060 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
7061 5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >& 4 ;;
7062 6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >& 4 ;;
7063 7) echo "You have 128-bit mixed-endian double-double long doubles (64-bit LEs in BE)." >& 4 ;;
7064 8) echo "You have 128-bit mixed-endian double-double long doubles (64-bit BEs in LE)." >& 4 ;;
7065 9) echo "You have 128-bit PDP-style mixed-endian long doubles (VAX format H)." >& 4 ;;
7066 *) echo "Cannot figure out your long double." >&4 ;;
7067 esac
7068 d_long_double_style_ieee=$undef
7069 d_long_double_style_ieee_std=$undef
7070 d_long_double_style_ieee_extended=$undef
7071 d_long_double_style_ieee_doubledouble=$undef
7072 d_long_double_style_vax=$undef
7073 case "$longdblkind" in
7074 1|2|3|4|5|6|7|8) d_long_double_style_ieee=$define ;;
7075 esac
7076 case "$longdblkind" in
7077 1|2) d_long_double_style_ieee_std=$define ;;
7078 esac
7079 case "$longdblkind" in
7080 3|4) d_long_double_style_ieee_extended=$define ;;
7081 esac
7082 case "$longdblkind" in
7083 5|6|7|8) d_long_double_style_ieee_doubledouble=$define ;;
7084 esac
7085 case "$longdblkind" in
7086 9) d_long_double_style_vax=$define ;;
7087 esac
7088 $rm_try
7089
7090 : determine the architecture name
7091 echo " "
7092 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7093         tarch=`arch`"-$osname"
7094 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7095         if uname -m > tmparch 2>&1 ; then
7096                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7097                         -e 's/$/'"-$osname/" tmparch`
7098         else
7099                 tarch="$osname"
7100         fi
7101         $rm -f tmparch
7102 else
7103         tarch="$osname"
7104 fi
7105 case "$myarchname" in
7106 ''|"$tarch") ;;
7107 *)
7108         echo "(Your architecture name used to be $myarchname.)"
7109         archname=''
7110         ;;
7111 esac
7112 case "$targetarch" in
7113 '') ;;
7114 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7115 esac
7116 myarchname="$tarch"
7117 case "$archname" in
7118 '') dflt="$tarch";;
7119 *) dflt="$archname";;
7120 esac
7121 rp='What is your architecture name'
7122 . ./myread
7123 archname="$ans"
7124
7125 : optionally add API version to the architecture for versioned archlibs
7126 case "$useversionedarchname" in
7127 $define|true|[yY]*) dflt='y';;
7128 *)                  dflt='n';;
7129 esac
7130 rp='Add the Perl API version to your archname?'
7131 . ./myread
7132 case "$ans" in
7133 y|Y)    useversionedarchname="$define" ;;
7134 *)      useversionedarchname="$undef" ;;
7135 esac
7136 case "$useversionedarchname" in
7137 $define)
7138         case "$archname" in
7139         *-$api_versionstring)
7140                 echo "...and architecture name already has -$api_versionstring" >&4
7141                 ;;
7142         *)
7143                 archname="$archname-$api_versionstring"
7144                 echo "...setting architecture name to $archname." >&4
7145                 ;;
7146         esac
7147         ;;
7148 esac
7149
7150 case "$usethreads" in
7151 $define)
7152         echo "Threads selected." >&4
7153         case "$archname" in
7154         *-thread*) echo "...and architecture name already has -thread." >&4
7155                 ;;
7156         *)      archname="$archname-thread"
7157                 echo "...setting architecture name to $archname." >&4
7158                 ;;
7159         esac
7160         ;;
7161 esac
7162 case "$usemultiplicity" in
7163 $define)
7164         echo "Multiplicity selected." >&4
7165         case "$archname" in
7166         *-multi*) echo "...and architecture name already has -multi." >&4
7167                 ;;
7168         *)      archname="$archname-multi"
7169                 echo "...setting architecture name to $archname." >&4
7170                 ;;
7171         esac
7172         ;;
7173 esac
7174 case "$use64bitint$use64bitall" in
7175 *"$define"*)
7176         case "$archname64" in
7177         '')
7178                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7179                 ;;
7180         *)
7181                 case "$use64bitint" in
7182                 "$define") echo "64 bit integers selected." >&4 ;;
7183                 esac
7184                 case "$use64bitall" in
7185                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7186                 esac
7187                 case "$archname" in
7188                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7189                         ;;
7190                 *)      archname="$archname-$archname64"
7191                         echo "...setting architecture name to $archname." >&4
7192                         ;;
7193                 esac
7194                 ;;
7195         esac
7196 esac
7197 case "$uselongdouble" in
7198 $define)
7199         echo "Long doubles selected." >&4
7200         case "$longdblsize" in
7201         $doublesize)
7202                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7203                 ;;
7204         *)
7205                 case "$archname" in
7206                 *-ld*) echo "...and architecture name already has -ld." >&4
7207                         ;;
7208                 *)      archname="$archname-ld"
7209                         echo "...setting architecture name to $archname." >&4
7210                         ;;
7211                 esac
7212                 ;;
7213         esac
7214         ;;
7215 esac
7216 case "$usequadmath" in
7217 $define)
7218         echo "quadmath selected." >&4
7219         case "$archname" in
7220         *-quadmath*) echo "...and architecture name already has -quadmath." >&4
7221                 ;;
7222         *)      archname="$archname-quadmath"
7223                 echo "...setting architecture name to $archname." >&4
7224                 ;;
7225         esac
7226         ;;
7227 esac
7228 if $test -f archname.cbu; then
7229         echo "Your platform has some specific hints for architecture name, using them..."
7230         . ./archname.cbu
7231 fi
7232
7233 : set the prefixit variable, to compute a suitable default value
7234 prefixit='case "$3" in
7235 ""|none)
7236         case "$oldprefix" in
7237         "") eval "$1=\"\$$2\"";;
7238         *)
7239                 case "$3" in
7240                 "") eval "$1=";;
7241                 none)
7242                         eval "tp=\"\$$2\"";
7243                         case "$tp" in
7244                         ""|" ") eval "$1=\"\$$2\"";;
7245                         *) eval "$1=";;
7246                         esac;;
7247                 esac;;
7248         esac;;
7249 *)
7250         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7251         case "$tp" in
7252         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7253         /*-$oldprefix/*|\~*-$oldprefix/*)
7254                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7255         *) eval "$1=\"\$$2\"";;
7256         esac;;
7257 esac'
7258
7259 : determine installation style
7260 : For now, try to deduce it from prefix unless it is already set.
7261 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7262 case "$installstyle" in
7263 '')     case "$prefix" in
7264                 *perl*) dflt='lib';;
7265                 *) dflt='lib/perl5' ;;
7266         esac
7267         ;;
7268 *)      dflt="$installstyle" ;;
7269 esac
7270 : Probably not worth prompting for this since we prompt for all
7271 : the directories individually, and the prompt would be too long and
7272 : confusing anyway.
7273 installstyle=$dflt
7274
7275 : determine where public executables go
7276 echo " "
7277 set dflt bin bin
7278 eval $prefixit
7279 fn=d~
7280 rp='Pathname where the public executables will reside?'
7281 . ./getfile
7282 if $test "X$ansexp" != "X$binexp"; then
7283         installbin=''
7284 fi
7285 prefixvar=bin
7286 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7287 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7288 :     this via initialinstalllocation
7289 . ./setprefixvar
7290
7291 case "$userelocatableinc" in
7292 $define|true|[yY]*)     dflt='y' ;;
7293 *)                      dflt='n' ;;
7294 esac
7295 cat <<EOM
7296
7297 Would you like to build Perl so that the installation is relocatable, so that
7298 library paths in @INC are determined relative to the path of the perl binary?
7299 This is not advised for system Perl installs, or if you need to run setid
7300 scripts or scripts under taint mode.
7301
7302 If this doesn't make any sense to you, just accept the default '$dflt'.
7303 EOM
7304 rp='Use relocatable @INC?'
7305 . ./myread
7306 case "$ans" in
7307 y|Y)    val="$define" ;;
7308 *)      val="$undef"  ;;
7309 esac
7310 set userelocatableinc
7311 eval $setvar
7312
7313 initialinstalllocation="$binexp"
7314 : Default prefix is now "up one level from where the binaries are"
7315 case "$userelocatableinc" in
7316 $define|true|[yY]*)
7317     bin=".../"
7318     binexp=".../"
7319     prefix=".../.."
7320     prefixexp=".../.."
7321     installprefixexp=".../.."
7322     ;;
7323 esac
7324
7325 : determine where private library files go
7326 : Usual default is /usr/local/lib/perl5/$version.
7327 : Also allow things like /opt/perl/lib/$version, since
7328 : /opt/perl/lib/perl5... would be redundant.
7329 : The default "style" setting is made in installstyle.U
7330 case "$installstyle" in
7331 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7332 *)       set dflt privlib lib/$version ;;
7333 esac
7334 eval $prefixit
7335 $cat <<EOM
7336
7337 There are some auxiliary files for $package that need to be put into a
7338 private library directory that is accessible by everyone.
7339
7340 EOM
7341 fn=$binexp
7342 fn=d~+
7343 rp='Pathname where the private library files will reside?'
7344 . ./getfile
7345 prefixvar=privlib
7346 . ./setprefixvar
7347
7348 : set the prefixup variable, to restore leading tilda escape
7349 prefixup='case "$prefixexp" in
7350 "$prefix") ;;
7351 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7352 esac'
7353
7354 : determine where public architecture dependent libraries go
7355 set archlib archlib
7356 eval $prefixit
7357 : privlib default is /usr/local/lib/$package/$version
7358 : archlib default is /usr/local/lib/$package/$version/$archname
7359 : privlib may have an optional trailing /share.
7360 tdflt=`echo $privlib | $sed 's,/share$,,'`
7361 tdflt=$tdflt/$archname
7362 case "$archlib" in
7363 '')     dflt=$tdflt
7364         ;;
7365 *)      dflt="$archlib"
7366     ;;
7367 esac
7368 $cat <<EOM
7369
7370 $spackage contains architecture-dependent library files.  If you are
7371 sharing libraries in a heterogeneous environment, you might store
7372 these files in a separate location.  Otherwise, you can just include
7373 them with the rest of the public library files.
7374
7375 EOM
7376 fn=$binexp
7377 fn=d+~
7378 rp='Where do you want to put the public architecture-dependent libraries?'
7379 . ./getfile
7380 prefixvar=archlib
7381 . ./setprefixvar
7382 if $test X"$archlib" = X"$privlib"; then
7383         d_archlib="$undef"
7384 else
7385         d_archlib="$define"
7386 fi
7387
7388 : see if setuid scripts can be secure
7389 $cat <<EOM
7390
7391 Some kernels have a bug that prevents setuid #! scripts from being
7392 secure.  Some sites have disabled setuid #! scripts because of this.
7393
7394 First let's decide if your kernel supports secure setuid #! scripts.
7395 (If setuid #! scripts would be secure but have been disabled anyway,
7396 don't say that they are secure if asked.)
7397
7398 EOM
7399
7400 val="$undef"
7401 if $test -d /dev/fd; then
7402         echo "#!$ls" >reflect
7403         chmod +x,u+s reflect
7404         ./reflect >flect 2>&1
7405         if $contains "/dev/fd" flect >/dev/null; then
7406                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7407                 val="$define"
7408         else
7409                 $cat <<EOM
7410 If you are not sure if they are secure, I can check but I'll need a
7411 username and password different from the one you are using right now.
7412 If you don't have such a username or don't want me to test, simply
7413 enter 'none'.
7414
7415 EOM
7416                 rp='Other username to test security of setuid scripts with?'
7417                 dflt='none'
7418                 . ./myread
7419                 case "$ans" in
7420                 n|none)
7421                         case "$d_suidsafe" in
7422                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7423                                 dflt=n;;
7424                         "$undef")
7425                                 echo "Well, the $hint value is *not* secure." >&4
7426                                 dflt=n;;
7427                         *)      echo "Well, the $hint value *is* secure." >&4
7428                                 dflt=y;;
7429                         esac
7430                         ;;
7431                 *)
7432                         $rm -f reflect flect
7433                         echo "#!$ls" >reflect
7434                         chmod +x,u+s reflect
7435                         echo >flect
7436                         chmod a+w flect
7437                         echo '"su" will (probably) prompt you for '"$ans's password."
7438                         su $ans -c './reflect >flect'
7439                         if $contains "/dev/fd" flect >/dev/null; then
7440                                 echo "Okay, it looks like setuid scripts are secure." >&4
7441                                 dflt=y
7442                         else
7443                                 echo "I don't think setuid scripts are secure." >&4
7444                                 dflt=n
7445                         fi
7446                         ;;
7447                 esac
7448                 rp='Does your kernel have *secure* setuid scripts?'
7449                 . ./myread
7450                 case "$ans" in
7451                 [yY]*)  val="$define";;
7452                 *)      val="$undef";;
7453                 esac
7454         fi
7455 else
7456         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7457         echo "(That's for file descriptors, not floppy disks.)"
7458         val="$undef"
7459 fi
7460 set d_suidsafe
7461 eval $setvar
7462
7463 $rm -f reflect flect
7464
7465 : now see if they want to do setuid emulation
7466 if $test $patchlevel -lt 11; then
7467 echo " "
7468 val="$undef"
7469 case "$d_suidsafe" in
7470 "$define")
7471         val="$undef"
7472         echo "No need to emulate SUID scripts since they are secure here." >&4
7473         ;;
7474 *)
7475         $cat <<EOM
7476 Some systems have disabled setuid scripts, especially systems where
7477 setuid scripts cannot be secure.  On systems where setuid scripts have
7478 been disabled, the setuid/setgid bits on scripts are currently
7479 useless.  It is possible for $package to detect those bits and emulate
7480 setuid/setgid in a secure fashion.  This emulation will only work if
7481 setuid scripts have been disabled in your kernel.
7482
7483 EOM
7484         case "$d_dosuid" in
7485         "$define") dflt=y ;;
7486         *) dflt=n ;;
7487         esac
7488         rp="Do you want to do setuid/setgid emulation?"
7489         . ./myread
7490         case "$ans" in
7491         [yY]*)  val="$define";;
7492         *)      val="$undef";;
7493         esac
7494         ;;
7495 esac
7496 set d_dosuid
7497 eval $setvar
7498 else
7499     case "$d_dosuid" in
7500         "$define")
7501         cat >&4 <<EOH
7502
7503 SUID emulation has been removed for 5.12
7504 Please re-run Configure without -Dd_dosuid
7505
7506 EOH
7507         exit 1;
7508         ;;
7509     esac
7510     d_dosuid=undef
7511 fi
7512
7513 : Find perl5.005 or later.
7514 echo "Looking for a previously installed perl5.005 or later... "
7515 case "$perl5" in
7516 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7517                 : Check if this perl is recent and can load a simple module
7518                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7519                         perl5=$tdir/perl
7520                         break;
7521                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7522                         perl5=$tdir/perl5
7523                         break;
7524                 fi
7525         done
7526         ;;
7527 *)      perl5="$perl5"
7528         ;;
7529 esac
7530 case "$perl5" in
7531 '')     echo "None found.  That's ok.";;
7532 *)      echo "Using $perl5." ;;
7533 esac
7534
7535 : Set the siteprefix variables
7536 $cat <<EOM
7537
7538 After $package is installed, you may wish to install various
7539 add-on modules and utilities.  Typically, these add-ons will
7540 be installed under $prefix with the rest
7541 of this package.  However, you may wish to install such add-ons
7542 elsewhere under a different prefix.
7543
7544 If you do not wish to put everything under a single prefix, that's
7545 ok.  You will be prompted for the individual locations; this siteprefix
7546 is only used to suggest the defaults.
7547
7548 The default should be fine for most people.
7549
7550 EOM
7551 fn=d~+
7552 rp='Installation prefix to use for add-on modules and utilities?'
7553 : XXX Here might be another good place for an installstyle setting.
7554 case "$siteprefix" in
7555 '') dflt=$prefix ;;
7556 *)  dflt=$siteprefix ;;
7557 esac
7558 . ./getfile
7559 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7560 oldsiteprefix=''
7561 case "$siteprefix" in
7562 '') ;;
7563 *)      case "$ans" in
7564         "$prefix") ;;
7565         *) oldsiteprefix="$prefix";;
7566         esac
7567         ;;
7568 esac
7569 siteprefix="$ans"
7570 siteprefixexp="$ansexp"
7571
7572 : determine where site specific libraries go.
7573 : Usual default is /usr/local/lib/perl5/site_perl/$version
7574 : The default "style" setting is made in installstyle.U
7575 : XXX No longer works with Prefixit stuff.
7576 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7577 case "$sitelib" in
7578 '') case "$installstyle" in
7579         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7580         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7581         esac
7582         ;;
7583 *)      dflt="$sitelib"
7584         ;;
7585 esac
7586 $cat <<EOM
7587
7588 The installation process will create a directory for
7589 site-specific extensions and modules.  Most users find it convenient
7590 to place all site-specific files in this directory rather than in the
7591 main distribution directory.
7592
7593 EOM
7594 fn=d~+
7595 rp='Pathname for the site-specific library files?'
7596 . ./getfile
7597 prefixvar=sitelib
7598 . ./setprefixvar
7599 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7600
7601 : Determine list of previous versions to include in @INC
7602 $cat > getverlist <<EOPL
7603 #!$perl5 -w
7604 use File::Basename;
7605 \$api_versionstring = "$api_versionstring";
7606 \$version = "$version";
7607 \$stem = "$sitelib_stem";
7608 \$archname = "$archname";
7609 EOPL
7610         $cat >> getverlist <<'EOPL'
7611 # The list found is store twice for each entry: the original name, and
7612 # the binary broken down version as pack "sss", so sorting is easy and
7613 # unambiguous. This will work for all versions that have a maximum of
7614 # three digit groups, separate by '.'s or '_'s. Names are extended with
7615 # ".0.0" to ensure at least three elements for the pack.
7616 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7617
7618 # Can't have leading @ because metaconfig interprets it as a command!
7619 ;@inc_version_list=();
7620 # XXX Redo to do opendir/readdir?
7621 if (-d $stem) {
7622     chdir($stem);
7623     ;@candidates = map {
7624         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7625     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7626 }
7627 else {
7628     ;@candidates = ();
7629 }
7630
7631 ($pversion, $aversion, $vsn5005) = map {
7632     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7633 foreach $d (@candidates) {
7634     if ($d->[1] lt $pversion) {
7635         if ($d->[1] ge $aversion) {
7636             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7637         }
7638         elsif ($d->[1] ge $vsn5005) {
7639             unshift(@inc_version_list, grep { -d } $d->[0]);
7640         }
7641     }
7642     else {
7643         # Skip newer version.  I.e. don't look in
7644         # 5.7.0 if we're installing 5.6.1.
7645     }
7646 }
7647
7648 if (@inc_version_list) {
7649     print join(' ', @inc_version_list);
7650 }
7651 else {
7652     # Blank space to preserve value for next Configure run.
7653     print " ";
7654 }
7655 EOPL
7656 chmod +x getverlist
7657 case "$inc_version_list" in
7658 '')     if test -x "$perl5$exe_ext"; then
7659                 dflt=`$perl5 getverlist`
7660         else
7661                 dflt='none'
7662         fi
7663         ;;
7664 $undef) dflt='none' ;;
7665 *)  eval dflt=\"$inc_version_list\" ;;
7666 esac
7667 case "$dflt" in
7668 ''|' ') dflt=none ;;
7669 esac
7670 case "$dflt" in
7671 5.005) dflt=none ;;
7672 esac
7673 $cat <<EOM
7674
7675 In order to ease the process of upgrading, this version of perl
7676 can be configured to use modules built and installed with earlier
7677 versions of perl that were installed under $prefix.  Specify here
7678 the list of earlier versions that this version of perl should check.
7679 If Configure detected no earlier versions of perl installed under
7680 $prefix, then the list will be empty.  Answer 'none' to tell perl
7681 to not search earlier versions.
7682
7683 The default should almost always be sensible, so if you're not sure,
7684 just accept the default.
7685 EOM
7686
7687 rp='List of earlier versions to include in @INC?'
7688 . ./myread
7689 case "$ans" in
7690 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7691 *) inc_version_list="$ans" ;;
7692 esac
7693 case "$inc_version_list" in
7694 ''|' ')
7695         inc_version_list_init='0'
7696         d_inc_version_list="$undef"
7697         ;;
7698 *)      inc_version_list_init=`echo $inc_version_list |
7699                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7700         d_inc_version_list="$define"
7701         ;;
7702 esac
7703 $rm -f getverlist
7704
7705 : see if malloc/malloc.h has to be included
7706 set malloc/malloc.h i_mallocmalloc
7707 eval $inhdr
7708
7709 : see if this is a malloc.h system
7710 : we want a real compile instead of Inhdr because some systems have a
7711 : malloc.h that just gives a compile error saying to use stdlib.h instead
7712 echo " "
7713 $cat >try.c <<EOCP
7714 #include <stdlib.h>
7715 #include <malloc.h>
7716 #$i_mallocmalloc I_MALLOCMALLOC
7717 #ifdef I_MALLOCMALLOC
7718 # include <malloc/malloc.h>
7719 #endif
7720
7721 int main () { return 0; }
7722 EOCP
7723 set try
7724 if eval $compile; then
7725     echo "<malloc.h> found." >&4
7726     val="$define"
7727 else
7728     echo "<malloc.h> NOT found." >&4
7729     val="$undef"
7730 fi
7731 $rm_try
7732 set i_malloc
7733 eval $setvar
7734
7735 : check for length of pointer
7736 echo " "
7737 case "$ptrsize" in
7738 '')
7739         echo "Checking to see how big your pointers are..." >&4
7740         $cat >try.c <<EOCP
7741 #include <stdio.h>
7742 #$i_stdlib I_STDLIB
7743 #ifdef I_STDLIB
7744 #include <stdlib.h>
7745 #endif
7746 int main()
7747 {
7748     printf("%d\n", (int)sizeof(void *));
7749     exit(0);
7750 }
7751 EOCP
7752         set try
7753         if eval $compile_ok; then
7754                 ptrsize=`$run ./try`
7755                 echo "Your pointers are $ptrsize bytes long."
7756         else
7757                 dflt='4'
7758                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7759                 rp="What is the size of a pointer (in bytes)?"
7760                 . ./myread
7761                 ptrsize="$ans"
7762         fi
7763         ;;
7764 esac
7765 $rm_try
7766 case "$use64bitall" in
7767 "$define"|true|[yY]*)
7768         case "$ptrsize" in
7769         4)      cat <<EOM >&4
7770
7771 *** You have chosen a maximally 64-bit build,
7772 *** but your pointers are only 4 bytes wide.
7773 *** Please rerun Configure without -Duse64bitall.
7774 EOM
7775                 case "$d_quad" in
7776                 define)
7777                         cat <<EOM >&4
7778 *** Since you have quads, you could possibly try with -Duse64bitint.
7779 EOM
7780                         ;;
7781                 esac
7782                 cat <<EOM >&4
7783 *** Cannot continue, aborting.
7784
7785 EOM
7786
7787                 exit 1
7788                 ;;
7789         esac
7790         ;;
7791 esac
7792
7793
7794 : determine whether to use malloc wrapping
7795 echo " "
7796 case "$usemallocwrap" in
7797 [yY]*|true|$define)     dflt='y' ;;
7798 [nN]*|false|$undef)     dflt='n' ;;
7799 *)      case "$usedevel" in
7800         [yY]*|true|$define)     dflt='y' ;;
7801         *) dflt='n' ;;
7802         esac
7803         ;;
7804 esac
7805 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7806 . ./myread
7807 usemallocwrap="$ans"
7808 case "$ans" in
7809 y*|true)
7810         usemallocwrap="$define" ;;
7811 *)
7812         usemallocwrap="$undef" ;;
7813 esac
7814
7815 : determine which malloc to compile in
7816 echo " "
7817 case "$usemymalloc" in
7818 [yY]*|true|$define)     dflt='y' ;;
7819 [nN]*|false|$undef)     dflt='n' ;;
7820 *)      case "$ptrsize" in
7821         4) dflt='y' ;;
7822         *) dflt='n' ;;
7823         esac
7824         if test "$useithreads" = "$define"; then dflt='n'; fi
7825         ;;
7826 esac
7827 rp="Do you wish to attempt to use the malloc that comes with $package?"
7828 . ./myread
7829 usemymalloc="$ans"
7830 case "$ans" in
7831 y*|true)
7832         usemymalloc='y'
7833         mallocsrc='malloc.c'
7834         mallocobj="malloc$_o"
7835         d_mymalloc="$define"
7836         case "$libs" in
7837         *-lmalloc*)
7838                 : Remove malloc from list of libraries to use
7839                 echo "Removing unneeded -lmalloc from library list" >&4
7840                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7841                 shift
7842                 libs="$*"
7843                 echo "libs = $libs" >&4
7844                 ;;
7845         esac
7846         ;;
7847 *)
7848         usemymalloc='n'
7849         mallocsrc=''
7850         mallocobj=''
7851         d_mymalloc="$undef"
7852         ;;
7853 esac
7854
7855 : compute the return types of malloc and free
7856 echo " "
7857 $cat >malloc.c <<END
7858 #$i_malloc I_MALLOC
7859 #$i_stdlib I_STDLIB
7860 #include <stdio.h>
7861 #include <sys/types.h>
7862 #ifdef I_MALLOC
7863 #include <malloc.h>
7864 #endif
7865 #ifdef I_STDLIB
7866 #include <stdlib.h>
7867 #endif
7868 #ifdef TRY_MALLOC
7869 void *malloc();
7870 #endif
7871 #ifdef TRY_FREE
7872 void free();
7873 #endif
7874 END
7875 case "$malloctype" in
7876 '')
7877         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7878                 malloctype='void *'
7879         else
7880                 malloctype='char *'
7881         fi
7882         ;;
7883 esac
7884 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7885
7886 case "$freetype" in
7887 '')
7888         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7889                 freetype='void'
7890         else
7891                 freetype='int'
7892         fi
7893         ;;
7894 esac
7895 echo "Your system uses $freetype free(), it would seem." >&4
7896 $rm -f malloc.[co]
7897 : determine where site specific architecture-dependent libraries go.
7898 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7899 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7900 : sitelib may have an optional trailing /share.
7901 case "$sitearch" in
7902 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7903         dflt="$dflt/$archname"
7904         ;;
7905 *)      dflt="$sitearch"
7906         ;;
7907 esac
7908 set sitearch sitearch none
7909 eval $prefixit
7910 $cat <<EOM
7911
7912 The installation process will also create a directory for
7913 architecture-dependent site-specific extensions and modules.
7914
7915 EOM
7916 fn=d~+
7917 rp='Pathname for the site-specific architecture-dependent library files?'
7918 . ./getfile
7919 prefixvar=sitearch
7920 . ./setprefixvar
7921 if $test X"$sitearch" = X"$sitelib"; then
7922         d_sitearch="$undef"
7923 else
7924         d_sitearch="$define"
7925 fi
7926
7927 : Set the vendorprefix variables
7928 $cat <<EOM
7929
7930 The installation process will also create a directory for
7931 vendor-supplied add-ons.  Vendors who supply perl with their system
7932 may find it convenient to place all vendor-supplied files in this
7933 directory rather than in the main distribution directory.  This will
7934 ease upgrades between binary-compatible maintenance versions of perl.
7935
7936 Of course you may also use these directories in whatever way you see
7937 fit.  For example, you might use them to access modules shared over a
7938 company-wide network.
7939
7940 The default answer should be fine for most people.
7941 This causes further questions about vendor add-ons to be skipped
7942 and no vendor-specific directories will be configured for perl.
7943
7944 EOM
7945 rp='Do you want to configure vendor-specific add-on directories?'
7946 case "$usevendorprefix" in
7947 define|true|[yY]*) dflt=y ;;
7948 *)      : User may have set vendorprefix directly on Configure command line.
7949         case "$vendorprefix" in
7950         ''|' ') dflt=n ;;
7951         *)      dflt=y ;;
7952         esac
7953         ;;
7954 esac
7955 . ./myread
7956 case "$ans" in
7957 [yY]*)  fn=d~+
7958         rp='Installation prefix to use for vendor-supplied add-ons?'
7959         case "$vendorprefix" in
7960         '') dflt="$prefix" ;;
7961         *)  dflt=$vendorprefix ;;
7962         esac
7963         . ./getfile
7964         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7965         oldvendorprefix=''
7966         case "$vendorprefix" in
7967         '') ;;
7968         *)      case "$ans" in
7969                 "$prefix") ;;
7970                 *) oldvendorprefix="$prefix";;
7971                 esac
7972                 ;;
7973         esac
7974         usevendorprefix="$define"
7975         vendorprefix="$ans"
7976         vendorprefixexp="$ansexp"
7977         ;;
7978 *)      usevendorprefix="$undef"
7979         vendorprefix=''
7980         vendorprefixexp=''
7981         ;;
7982 esac
7983
7984 : Set the vendorlib variables
7985 case "$vendorprefix" in
7986 '')     d_vendorlib="$undef"
7987         vendorlib=''
7988         vendorlibexp=''
7989         ;;
7990 *)      d_vendorlib="$define"
7991         : determine where vendor-supplied modules go.
7992         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7993         case "$vendorlib" in
7994         '')
7995                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7996                 case "$installstyle" in
7997                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7998                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7999                 esac
8000                 ;;
8001         *)      dflt="$vendorlib"
8002                 ;;
8003         esac
8004         fn=d~+
8005         rp='Pathname for the vendor-supplied library files?'
8006         . ./getfile
8007         vendorlib="$ans"
8008         vendorlibexp="$ansexp"
8009         ;;
8010 esac
8011 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
8012 prefixvar=vendorlib
8013 . ./installprefix
8014
8015 : Set the vendorarch variables
8016 case "$vendorprefix" in
8017 '')     d_vendorarch="$undef"
8018         vendorarch=''
8019         vendorarchexp=''
8020         ;;
8021 *)      d_vendorarch="$define"
8022         : determine where vendor-supplied architecture-dependent libraries go.
8023         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
8024         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
8025         : vendorlib may have an optional trailing /share.
8026         case "$vendorarch" in
8027         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
8028                 dflt="$dflt/$archname"
8029                 ;;
8030         *)      dflt="$vendorarch" ;;
8031         esac
8032         fn=d~+
8033         rp='Pathname for vendor-supplied architecture-dependent files?'
8034         . ./getfile
8035         vendorarch="$ans"
8036         vendorarchexp="$ansexp"
8037         ;;
8038 esac
8039 prefixvar=vendorarch
8040 . ./installprefix
8041 if $test X"$vendorarch" = X"$vendorlib"; then
8042         d_vendorarch="$undef"
8043 else
8044         d_vendorarch="$define"
8045 fi
8046
8047 : Final catch-all directories to search
8048 $cat <<EOM
8049
8050 Lastly, you can have perl look in other directories for extensions and
8051 modules in addition to those already specified.
8052 These directories will be searched after
8053         $sitearch
8054         $sitelib
8055 EOM
8056 test X"$vendorlib" != "X" && echo '     ' $vendorlib
8057 test X"$vendorarch" != "X" && echo '    ' $vendorarch
8058 echo ' '
8059 case "$otherlibdirs" in
8060 ''|' ') dflt='none' ;;
8061 *)      dflt="$otherlibdirs" ;;
8062 esac
8063 $cat <<EOM
8064 Enter a colon-separated set of extra paths to include in perl's @INC
8065 search path, or enter 'none' for no extra paths.
8066
8067 EOM
8068
8069 rp='Colon-separated list of additional directories for perl to search?'
8070 . ./myread
8071 case "$ans" in
8072 ' '|''|none)    otherlibdirs=' ' ;;
8073 *)      otherlibdirs="$ans" ;;
8074 esac
8075 case "$otherlibdirs" in
8076 ' ') val=$undef ;;
8077 *)      val=$define ;;
8078 esac
8079 set d_perl_otherlibdirs
8080 eval $setvar
8081
8082 : DTrace support
8083 dflt_dtrace='/usr/sbin/dtrace'
8084 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8085
8086 cat <<EOM
8087
8088 Perl can be built to support DTrace on platforms that support it.
8089 DTrace is a diagnosis and performance analysis tool from Sun.
8090
8091 If this doesn't make any sense to you, just accept the default.
8092 EOM
8093
8094 while $test 1 ; do
8095         case "$usedtrace" in
8096         $define|true|[yY]*)
8097                 dflt='y'
8098                 ;;
8099         ?*)
8100                 dflt='y'
8101                 dflt_dtrace=$usedtrace
8102                 ;;
8103         *)
8104                 dflt='n'
8105                 ;;
8106         esac
8107
8108         rp='Support DTrace if available?'
8109         . ./myread
8110         case "$ans" in
8111         y|Y)    val="$define" ;;
8112         *)      val="$undef" ;;
8113         esac
8114         set usedtrace
8115         eval $setvar
8116
8117         test "X$usedtrace" != "X$define" && break
8118
8119         echo " "
8120         rp='Where is the dtrace executable?'
8121         dflt=$dflt_dtrace
8122         . ./getfile
8123         val="$ans"
8124         set dtrace
8125         eval $setvar
8126
8127         if $test -f $dtrace
8128         then
8129                 if $dtrace -h -s ../perldtrace.d \
8130                         -o perldtrace.tmp >/dev/null 2>&1 \
8131                         && rm -f perldtrace.tmp
8132                 then
8133                         echo " "
8134                         echo "Good: your $dtrace knows about the -h flag."
8135                 else
8136                         cat >&2 <<EOM
8137
8138 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8139 ***
8140 *** Your installed dtrace doesn't support the -h switch to compile a D
8141 *** program into a C header. Can't continue.
8142
8143 EOM
8144                         exit 1
8145                 fi
8146                 break;
8147         fi
8148
8149         case "$fastread" in
8150         yes)
8151                 cat >&2 <<EOM
8152
8153 *** $me:  Fatal Error:  $dtrace not found.
8154 *** Can't continue.
8155
8156 EOM
8157                 exit 1
8158                 ;;
8159         *)
8160                 echo "*** $dtrace was not found."
8161                 echo " "
8162                 ;;
8163         esac
8164 done
8165
8166 : See if we want extra modules installed
8167 echo " "
8168 case "$extras" in
8169 '') dflt='n';;
8170 *) dflt='y';;
8171 esac
8172 cat <<EOM
8173 Perl can be built with extra modules or bundles of modules which
8174 will be fetched from the CPAN and installed alongside Perl.
8175
8176 Notice that you will need access to the CPAN; either via the Internet,
8177 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8178 be asked later to configure the CPAN.pm module which will in turn do
8179 the installation of the rest of the extra modules or bundles.)
8180
8181 Notice also that if the modules require any external software such as
8182 libraries and headers (the libz library and the zlib.h header for the
8183 Compress::Zlib module, for example) you MUST have any such software
8184 already installed, this configuration process will NOT install such
8185 things for you.
8186
8187 If this doesn't make any sense to you, just accept the default '$dflt'.
8188 EOM
8189 rp='Install any extra modules (y or n)?'
8190 . ./myread
8191 case "$ans" in
8192 y|Y)
8193         cat <<EOM
8194
8195 Please list any extra modules or bundles to be installed from CPAN,
8196 with spaces between the names.  The names can be in any format the
8197 'install' command of CPAN.pm will understand.  (Answer 'none',
8198 without the quotes, to install no extra modules or bundles.)
8199 EOM
8200         rp='Extras?'
8201         dflt="$extras"
8202         . ./myread
8203         extras="$ans"
8204 esac
8205 case "$extras" in
8206 ''|'none')
8207         val=''
8208         $rm -f ../extras.lst
8209         ;;
8210 *)      echo "(Saving the list of extras for later...)"
8211         echo "$extras" > ../extras.lst
8212         val="'$extras'"
8213         ;;
8214 esac
8215 set extras
8216 eval $setvar
8217 echo " "
8218
8219 : determine where html pages for programs go
8220 set html1dir html1dir none
8221 eval $prefixit
8222 $cat <<EOM
8223
8224 If you wish to install html files for programs in $spackage, indicate
8225 the appropriate directory here.  To skip installing html files,
8226 answer "none".
8227 EOM
8228 case "$html1dir" in
8229 ''|none|$undef|' ') dflt=none ;;
8230 *) dflt=$html1dir ;;
8231 esac
8232 fn=dn+~
8233 rp="Directory for the main $spackage html pages?"
8234 . ./getfile
8235 prefixvar=html1dir
8236 . ./setprefixvar
8237 : Use ' ' for none so value is preserved next time through Configure
8238 $test X"$html1dir" = "X" && html1dir=' '
8239
8240 : determine where html pages for libraries and modules go
8241 set html3dir html3dir none
8242 eval $prefixit
8243 $cat <<EOM
8244
8245 If you wish to install html files for modules associated with $spackage,
8246 indicate the appropriate directory here.  To skip installing html files,
8247 answer "none".
8248 EOM
8249 : There is no obvious default.  If they have specified html1dir, then
8250 : try to key off that, possibly changing .../html1 into .../html3.
8251 case "$html3dir" in
8252 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8253 *) dflt=$html3dir ;;
8254 esac
8255 fn=dn+~
8256 rp="Directory for the $spackage module html pages?"
8257 . ./getfile
8258 prefixvar=html3dir
8259 . ./setprefixvar
8260 : Use ' ' for none so value is preserved next time through Configure
8261 $test X"$html3dir" = "X" && html3dir=' '
8262
8263 : determine whether to install perl also as /usr/bin/perl
8264
8265 echo " "
8266 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8267         $cat <<EOM
8268 Many scripts expect perl to be installed as /usr/bin/perl.
8269
8270 If you want to, I can install the perl you are about to compile
8271 as /usr/bin/perl (in addition to $bin/perl).
8272 EOM
8273         if test -f /usr/bin/perl; then
8274             $cat <<EOM
8275
8276 However, please note that because you already have a /usr/bin/perl,
8277 overwriting that with a new Perl would very probably cause problems.
8278 Therefore I'm assuming you don't want to do that (unless you insist).
8279
8280 EOM
8281             case "$installusrbinperl" in
8282             "$define"|[yY]*)    dflt='y';;
8283             *)                  dflt='n';;
8284             esac
8285         else
8286             $cat <<EOM
8287
8288 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8289
8290 EOM
8291             case "$installusrbinperl" in
8292             "$undef"|[nN]*)     dflt='n';;
8293             *)                  dflt='y';;
8294             esac
8295         fi
8296         rp="Do you want to install perl as /usr/bin/perl?"
8297         . ./myread
8298         case "$ans" in
8299         [yY]*)  val="$define";;
8300         *)      val="$undef" ;;
8301         esac
8302 else
8303         val="$undef"
8304 fi
8305 set installusrbinperl
8306 eval $setvar
8307
8308 : see if dlopen exists
8309 xxx_runnm="$runnm"
8310 xxx_ccflags="$ccflags"
8311 runnm=false
8312 : with g++ one needs -shared to get is-in-libc to work for dlopen
8313 case "$gccversion" in
8314 '')     ;;
8315 *Clang*)        ;;
8316 *)      case "$d_cplusplus" in
8317         "$define") ccflags="$ccflags -shared" ;;
8318         esac
8319         ;;
8320 esac
8321 set dlopen d_dlopen
8322 eval $inlibc
8323 runnm="$xxx_runnm"
8324 ccflags="$xxx_ccflags"
8325
8326 : see if this is a unistd.h system
8327 set unistd.h i_unistd
8328 eval $inhdr
8329
8330 : determine which dynamic loading, if any, to compile in
8331 echo " "
8332 dldir="ext/DynaLoader"
8333 case "$usedl" in
8334     $define|y|true)
8335         dflt='y'
8336         usedl="$define"
8337         ;;
8338     $undef|n|false)
8339         dflt='n'
8340         usedl="$undef"
8341         ;;
8342     *)
8343         dflt='n'
8344         case "$d_dlopen" in
8345             $define) dflt='y' ;;
8346         esac
8347         : Does a dl_xxx.xs file exist for this operating system
8348         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8349         ;;
8350 esac
8351 rp="Do you wish to use dynamic loading?"
8352 . ./myread
8353 usedl="$ans"
8354 bin_ELF="$undef"
8355 case "$ans" in
8356     y*) usedl="$define"
8357         case "$dlsrc" in
8358             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8359                     dflt="$dldir/dl_${osname}.xs"
8360                 elif $test "$d_dlopen" = "$define" ; then
8361                     dflt="$dldir/dl_dlopen.xs"
8362                 else
8363                     dflt=''
8364                 fi
8365                 ;;
8366             *)  dflt="$dldir/$dlsrc"
8367                 ;;
8368         esac
8369         echo "The following dynamic loading files are available:"
8370         : Can not go over to $dldir because getfile has path hard-coded in.
8371         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8372         rp="Source file to use for dynamic loading"
8373         fn="fne"
8374         gfpth="$src"
8375         . ./getfile
8376         usedl="$define"
8377         : emulate basename
8378         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8379
8380         $cat << EOM
8381
8382 Some systems may require passing special flags to $cc -c to
8383 compile modules that will be used to create a shared library.
8384 To use no flags, say "none".
8385
8386 EOM
8387         case "$cccdlflags" in
8388             '') case "$gccversion" in
8389                 '') case "$osname" in
8390                         hpux)   dflt='+z' ;;
8391                         irix*)  dflt='-KPIC' ;;
8392                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8393                         sunos)  dflt='-pic' ;;
8394                         *)      dflt='none' ;;
8395                     esac
8396                     ;;
8397                 *)  case "$osname" in
8398                         darwin) dflt='none' ;;
8399                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8400                         *)      dflt='-fpic' ;;
8401                     esac ;;
8402                 esac ;;
8403             ' ') dflt='none' ;;
8404             *)   dflt="$cccdlflags" ;;
8405         esac
8406
8407         case "$dflt" in
8408             none) dflt='' ;;
8409         esac
8410
8411         # If -Dsysroot was specified, now's the time to add it
8412         # to cccdlflags
8413         if test "X$sysroot" != X; then
8414             case "$gccversion" in
8415                 '') ;;
8416                 *)  case "$dflt" in
8417                         *sysroot*) ;;
8418                         'undef'|*)
8419                             dflt="$dflt --sysroot=$sysroot" ;;
8420                     esac
8421                     ;;
8422             esac
8423         fi
8424
8425         case "$dflt" in
8426             '') dflt='none';;
8427         esac
8428
8429         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8430         . ./myread
8431         case "$ans" in
8432             none) cccdlflags=' ' ;;
8433             *)    cccdlflags="$ans" ;;
8434         esac
8435
8436         cat << EOM
8437
8438 Some systems use ld to create libraries that can be dynamically loaded,
8439 while other systems (such as those using ELF) use $cc.
8440
8441 EOM
8442
8443 : Determine if this is ELF
8444         $cat >try.c <<EOM
8445 /* Test for whether ELF binaries are produced */
8446 #include <fcntl.h>
8447 #$i_stdlib I_STDLIB
8448 #ifdef I_STDLIB
8449 #include <stdlib.h>
8450 #endif
8451 #$i_unistd I_UNISTD
8452 #ifdef I_UNISTD
8453 #include <unistd.h>
8454 #endif
8455 int main() {
8456     char b[4];
8457     int i = open("a.out",O_RDONLY);
8458     if(i == -1)
8459         exit(1); /* fail */
8460     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8461         exit(0); /* succeed (yes, it is ELF) */
8462     exit(1); /* fail */
8463 }
8464 EOM
8465         if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8466             bin_ELF="$define"
8467         fi
8468         $rm_try
8469
8470         case "$ld" in
8471             '') if $test $bin_ELF = "$define"; then
8472                     cat <<EOM
8473 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8474 EOM
8475                     dflt="$cc"
8476                 else
8477                     echo "I'll use ld to build dynamic libraries."
8478                     dflt='ld'
8479                 fi
8480                 ;;
8481             *)  dflt="$ld"
8482                 ;;
8483         esac
8484
8485         rp="What command should be used to create dynamic libraries?"
8486         . ./myread
8487         ld="$ans"
8488
8489         cat << EOM
8490
8491 Some systems may require passing special flags to $ld to create a
8492 library that can be dynamically loaded.  If your ld flags include
8493 -L/other/path options to locate libraries outside your loader's normal
8494 search path, you may need to specify those -L options here as well.  To
8495 use no flags, say "none".
8496
8497 EOM
8498         case "$lddlflags" in
8499             '') case "$osname" in
8500                     haiku) dflt='-shared' ;;
8501                     hpux) dflt='-b';
8502                           case "$gccversion" in
8503                               '') dflt="$dflt +vnocompatwarnings" ;;
8504                           esac
8505                           ;;
8506                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8507                     solaris) # See [perl #66604].
8508                             # On Solaris 11, gcc -m64 on amd64
8509                             # appears not to understand -G.  gcc versions at
8510                             # least as old as 3.4.3 support -shared, so just
8511                             # use that with Solaris 11 and later, but keep
8512                             # the old behavior for older Solaris versions.
8513                             case "$gccversion" in
8514                                 '') dflt='-G' ;;
8515                                 *)  case "$osvers" in
8516                                         2.?|2.10) dflt='-G' ;;
8517                                         *) dflt='-shared' ;;
8518                                     esac
8519                                     ;;
8520                             esac
8521                             ;;
8522                     sunos) dflt='-assert nodefinitions' ;;
8523                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8524                     *)     dflt='none' ;;
8525                 esac
8526                 ;;
8527             *) dflt="$lddlflags" ;;
8528         esac
8529
8530         : Only do this for gcc, since, for example, qcc has no concept
8531         : of --sysroot.
8532         if $test "X$sysroot" != X; then
8533             case "$gccversion" in
8534                 '') ;;
8535                 *)  dflt="$dflt --sysroot $sysroot" ;;
8536             esac
8537         fi
8538
8539         : Try to guess additional flags to pick up local libraries.
8540         : Be careful not to append to a plain 'none'
8541         case "$dflt" in
8542             none) dflt='' ;;
8543         esac
8544         for thisflag in $ldflags; do
8545             case "$thisflag" in
8546                 -L*|-R*|-Wl,-R*)
8547                     case " $dflt " in
8548                         *" $thisflag "*) ;;
8549                         *) dflt="$dflt $thisflag" ;;
8550                     esac
8551                     ;;
8552             esac
8553         done
8554
8555         case "$dflt" in
8556             ''|' ') dflt='none' ;;
8557         esac
8558
8559         case "$ldflags" in
8560             *-fstack-protector-strong*)
8561                 case "$dflt" in
8562                     *-fstack-protector-strong*) ;; # Don't add it again
8563                     *) dflt="$dflt -fstack-protector-strong" ;;
8564                 esac
8565                 ;;
8566             *-fstack-protector*)
8567                 case "$dflt" in
8568                     *-fstack-protector*) ;; # Don't add it again
8569                     *) dflt="$dflt -fstack-protector" ;;
8570                 esac
8571                 ;;
8572         esac
8573
8574         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8575         . ./myread
8576         case "$ans" in
8577             none) lddlflags=' ' ;;
8578             *) lddlflags="$ans" ;;
8579         esac
8580
8581         cat <<EOM
8582
8583 Some systems may require passing special flags to $cc to indicate that
8584 the resulting executable will use dynamic linking.  To use no flags,
8585 say "none".
8586
8587 EOM
8588         case "$ccdlflags" in
8589             '') case "$osname" in
8590                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8591                     sunos)             dflt='none'   ;;
8592                     *)                 dflt='none'   ;;
8593                 esac ;;
8594             ' ') dflt='none' ;;
8595             *)   dflt="$ccdlflags" ;;
8596         esac
8597         rp="Any special flags to pass to $cc to use dynamic linking?"
8598         . ./myread
8599         case "$ans" in
8600             none) ccdlflags=' ' ;;
8601             *)    ccdlflags="$ans" ;;
8602         esac
8603         ;;
8604
8605     *)  usedl="$undef"
8606         ld='ld'
8607         dlsrc='dl_none.xs'
8608         lddlflags=''
8609         ccdlflags=''
8610         ;;
8611 esac
8612
8613 ld_can_script="$undef"
8614 case "$bin_ELF$usedl" in
8615     $define$define)
8616         # Abuse try.h and a.out names for neat cleanup
8617         $cat >try.c <<EOM
8618 void foo() {}
8619 void bar() {}
8620 EOM
8621         $cat >try.h <<EOM
8622 LIBTEST_42 {
8623  global:
8624   foo;
8625  local: *;
8626  };
8627 EOM
8628         if $cc $cccdlflags $ccdlflags $ccflags \
8629                $ldflags $lddlflags -o a.out try.c \
8630                -Wl,--version-script=try.h >/dev/null 2>&1 \
8631            &&  $test -s a.out ; then
8632             echo "ld supports scripting" >&4
8633             ld_can_script="$define"
8634         else
8635             echo "ld does not support scripting" >&4
8636         fi
8637         $rm_try
8638         ;;
8639 esac
8640
8641 : Do we want a shared libperl?
8642 also=''
8643 case "$usedl" in
8644 $undef)
8645         # No dynamic loading being used, so don't bother even to prompt.
8646         useshrplib='false'
8647         ;;
8648 *)      case "$useshrplib" in
8649         '')     case "$osname" in
8650                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8651                         dflt=y
8652                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8653                         ;;
8654                 *)      dflt=n
8655                         ;;
8656                 esac
8657                 ;;
8658         $define|true|[Yy]*)
8659                 dflt=y
8660                 ;;
8661         *)      dflt=n
8662                 ;;
8663         esac
8664         $cat << EOM
8665
8666 The perl executable is normally obtained by linking perlmain.c with
8667 libperl${_a}, any static extensions (usually just DynaLoader), and
8668 any other libraries needed on this system (such as -lm, etc.).  Since
8669 your system supports dynamic loading, it is probably possible to build
8670 a shared libperl.$so.  If you will have more than one executable linked
8671 to libperl.$so, this will significantly reduce the size of each
8672 executable, but it may have a noticeable effect on performance.  The
8673 default is probably sensible for your system.
8674 $also
8675
8676 EOM
8677         rp="Build a shared libperl.$so (y/n)"
8678         . ./myread
8679         case "$ans" in
8680         true|$define|[Yy]*)
8681                 useshrplib='true'  ;;
8682         *)      useshrplib='false' ;;
8683         esac
8684         ;;
8685 esac
8686
8687 case "$useshrplib" in
8688 true)
8689         case "$userelocatableinc" in
8690         true|define)
8691                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8692                 echo "See INSTALL for an explanation why that won't work." >&4
8693                 exit 4
8694                 ;;
8695         esac
8696         case "$libperl" in
8697         '')
8698                 # Figure out a good name for libperl.so.  Since it gets stored in
8699                 # a version-specific architecture-dependent library, the version
8700                 # number isn't really that important, except for making cc/ld happy.
8701                 #
8702                 # A name such as libperl.so.10.1
8703                 majmin="libperl.$so.$patchlevel.$subversion"
8704                 # A name such as libperl.so.100
8705                 majonly=`echo $patchlevel $subversion |
8706                         $awk '{printf "%d%02d", $1, $2}'`
8707                 majonly=libperl.$so.$majonly
8708                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8709                 # rely on figuring it out from the naming of libc.
8710                 case "${osname}${osvers}" in
8711                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8712                         dflt=libperl.$so
8713                         ;;
8714                 cygwin*) # ld links now against the dll directly
8715                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8716                         majonly=`echo $patchlevel $subversion |
8717                                 $awk '{printf "%03d%03d", $1, $2}'`
8718                         majonly=cygperl5.$majonly.$so
8719                         dflt=$majmin
8720                         ;;
8721                 *)      # Try to guess based on whether libc has major.minor.
8722                         case "$libc" in
8723                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8724                         *libc.$so.[0-9]*) dflt=$majonly ;;
8725                         *)      dflt=libperl.$so ;;
8726                         esac
8727                         ;;
8728                 esac
8729                 ;;
8730         *)      dflt=$libperl
8731                 ;;
8732         esac
8733         cat << EOM
8734
8735 I need to select a good name for the shared libperl.  If your system uses
8736 library names with major and minor numbers, then you might want something
8737 like $majmin.  Alternatively, if your system uses a single version
8738 number for shared libraries, then you might want to use $majonly.
8739 Or, your system might be quite happy with a simple libperl.$so.
8740
8741 Since the shared libperl will get installed into a version-specific
8742 architecture-dependent directory, the version number of the shared perl
8743 library probably isn't important, so the default should be o.k.
8744
8745 EOM
8746         rp='What name do you want to give to the shared libperl?'
8747         . ./myread
8748         libperl=$ans
8749         echo "Ok, I'll use $libperl"
8750         ;;
8751 *)
8752         libperl="libperl${_a}"
8753         ;;
8754 esac
8755
8756 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8757 case "$shrpdir" in
8758 '') ;;
8759 *)      $cat >&4 <<EOM
8760 WARNING:  Use of the shrpdir variable for the installation location of
8761 the shared $libperl is not supported.  It was never documented and
8762 will not work in this version.  Let me (perlbug@perl.org)
8763 know of any problems this may cause.
8764
8765 EOM
8766         case "$shrpdir" in
8767         "$archlibexp/CORE")
8768                 $cat >&4 <<EOM
8769 But your current setting of $shrpdir is
8770 the default anyway, so it's harmless.
8771 EOM
8772                 ;;
8773         *)
8774                 $cat >&4 <<EOM
8775 Further, your current attempted setting of $shrpdir
8776 conflicts with the value of $archlibexp/CORE
8777 that installperl will use.
8778 EOM
8779                 ;;
8780         esac
8781         ;;
8782 esac
8783
8784 # How will the perl executable find the installed shared $libperl?
8785 # Add $xxx to ccdlflags.
8786 # If we can't figure out a command-line option, use $shrpenv to
8787 # set env LD_RUN_PATH.  The main perl makefile uses this.
8788 shrpdir=$archlibexp/CORE
8789 xxx=''
8790 tmp_shrpenv=''
8791 if "$useshrplib"; then
8792     case "$osname" in
8793         aix)
8794                 # We'll set it in Makefile.SH...
8795                 ;;
8796         solaris)
8797                 xxx="-R $shrpdir"
8798                 ;;
8799         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8800                 xxx="-Wl,-R$shrpdir"
8801                 ;;
8802         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8803                 xxx="-Wl,-rpath,$shrpdir"
8804                 ;;
8805         hpux*)
8806                 # hpux doesn't like the default, either.
8807                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8808                 ;;
8809         cygwin)
8810                 # cygwin needs only ldlibpth
8811                 ;;
8812         *)
8813                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8814                 ;;
8815         esac
8816         case "$xxx" in
8817         '') ;;
8818         *)
8819                 # Only add $xxx if it isn't already in ccdlflags.
8820                 case " $ccdlflags " in
8821                 *" $xxx "*)     ;;
8822                 *)      ccdlflags="$ccdlflags $xxx"
8823                         cat <<EOM >&4
8824
8825 Adding $xxx to the flags
8826 passed to $ld so that the perl executable will find the
8827 installed shared $libperl.
8828
8829 EOM
8830                         ;;
8831                 esac
8832                 ;;
8833         esac
8834 fi
8835 # Fix ccdlflags in AIX for building external extensions.
8836 # (For building Perl itself bare -bE:perl.exp is needed,
8837 #  Makefile.SH takes care of this.)
8838 case "$osname" in
8839 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8840 esac
8841 # Respect a hint or command-line value.
8842 case "$shrpenv" in
8843 '') shrpenv="$tmp_shrpenv" ;;
8844 esac
8845 case "$ldlibpthname" in
8846 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8847 none)   ldlibpthname='' ;;
8848 esac
8849
8850 : determine where manual pages are on this system
8851 echo " "
8852 case "$sysman" in
8853 '')
8854         syspath='/usr/share/man/man1 /usr/man/man1'
8855         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8856         syspath="$syspath /usr/man/u_man/man1"
8857         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8858         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8859         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8860         sysman=`./loc . /usr/man/man1 $syspath`
8861         ;;
8862 esac
8863 if $test -d "$sysman"; then
8864         echo "System manual is in $sysman." >&4
8865 else
8866         echo "Could not find manual pages in source form." >&4
8867 fi
8868
8869 : determine where manual pages go
8870 set man1dir man1dir none
8871 eval $prefixit
8872 $cat <<EOM
8873
8874 $spackage has manual pages available in source form.
8875 EOM
8876 case "$nroff" in
8877 nroff)
8878         echo "However, you don't have nroff, so they're probably useless to you."
8879         case "$man1dir" in
8880         '') man1dir="none";;
8881         esac;;
8882 esac
8883 echo "If you don't want the manual sources installed, answer 'none'."
8884 case "$man1dir" in
8885 ' ') dflt=none
8886         ;;
8887 '')
8888         lookpath="$prefixexp/share/man/man1"
8889         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8890         lookpath="$lookpath $prefixexp/man/p_man/man1"
8891         lookpath="$lookpath $prefixexp/man/u_man/man1"
8892         lookpath="$lookpath $prefixexp/man/man.1"
8893         case "$sysman" in
8894         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8895         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8896         esac
8897         set dflt
8898         eval $prefixup
8899         ;;
8900 *)  dflt="$man1dir"
8901         ;;
8902 esac
8903 echo " "
8904 fn=dn+~
8905 rp="Where do the main $spackage manual pages (source) go?"
8906 . ./getfile
8907 if $test "X$man1direxp" != "X$ansexp"; then
8908         installman1dir=''
8909 fi
8910 prefixvar=man1dir
8911 . ./setprefixvar
8912
8913 case "$man1dir" in
8914 '')     man1dir=' '
8915         installman1dir='';;
8916 esac
8917
8918 : What suffix to use on installed man pages
8919
8920 case "$man1dir" in
8921 ' ')
8922         man1ext='0'
8923         ;;
8924 *)
8925         rp="What suffix should be used for the main $spackage man pages?"
8926         case "$man1ext" in
8927         '')     case "$man1dir" in
8928                 *1)  dflt=1 ;;
8929                 *1p) dflt=1p ;;
8930                 *1pm) dflt=1pm ;;
8931                 *l) dflt=l;;
8932                 *n) dflt=n;;
8933                 *o) dflt=o;;
8934                 *p) dflt=p;;
8935                 *C) dflt=C;;
8936                 *L) dflt=L;;
8937                 *L1) dflt=L1;;
8938                 *) dflt=1;;
8939                 esac
8940                 ;;
8941         *)      dflt="$man1ext";;
8942         esac
8943         . ./myread
8944         man1ext="$ans"
8945         ;;
8946 esac
8947
8948 : see if we can have long filenames
8949 echo " "
8950 first=123456789abcdef
8951 $rm -f $first
8952 if (echo hi >$first) 2>/dev/null; then
8953         if $test -f 123456789abcde; then
8954                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8955                 val="$undef"
8956         else
8957                 echo 'You can have filenames longer than 14 characters.'>&4
8958                 val="$define"
8959         fi
8960 else
8961         $cat <<'EOM'
8962 You can't have filenames longer than 14 chars.
8963 You can't even think about them!
8964 EOM
8965         val="$undef"
8966 fi
8967 set d_flexfnam
8968 eval $setvar
8969 $rm -rf 123456789abcde*
8970
8971 : determine where library module manual pages go
8972 set man3dir man3dir none
8973 eval $prefixit
8974 $cat <<EOM
8975
8976 $spackage has manual pages for many of the library modules.
8977 EOM
8978
8979 case "$nroff" in
8980 nroff)
8981         $cat <<'EOM'
8982 However, you don't have nroff, so they're probably useless to you.
8983 EOM
8984         case "$man3dir" in
8985         '') man3dir="none";;
8986         esac;;
8987 esac
8988
8989 case "$d_flexfnam" in
8990 undef)
8991         $cat <<'EOM'
8992 However, your system can't handle the long file names like File::Basename.3.
8993 EOM
8994         case "$man3dir" in
8995         '') man3dir="none";;
8996         esac;;
8997 esac
8998
8999 echo "If you don't want the manual sources installed, answer 'none'."
9000 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9001 case "$man3dir" in
9002 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9003         if $test -d "$privlib/man/man3"; then
9004                 cat <<EOM >&4
9005
9006 WARNING:  Previous versions of perl installed man3 pages into
9007 $privlib/man/man3.  This version will suggest a
9008 new default of $dflt.
9009 EOM
9010                 tdflt=$dflt
9011                 dflt='n'
9012                 rp='Do you wish to preserve the old behavior?(y/n)'
9013                 . ./myread
9014                 case "$ans" in
9015                 y*) dflt="$privlib/man/man3" ;;
9016                 *)  dflt=$tdflt ;;
9017                 esac
9018     fi
9019         ;;
9020 *)      dflt="$man3dir" ;;
9021 esac
9022 case "$dflt" in
9023 ' ') dflt=none ;;
9024 esac
9025 echo " "
9026 fn=dn+~
9027 rp="Where do the $package library man pages (source) go?"
9028 . ./getfile
9029 prefixvar=man3dir
9030 . ./setprefixvar
9031
9032 case "$man3dir" in
9033 '')     man3dir=' '
9034         installman3dir='';;
9035 esac
9036
9037 : What suffix to use on installed man pages
9038 case "$man3dir" in
9039 ' ')
9040         man3ext='0'
9041         ;;
9042 *)
9043         rp="What suffix should be used for the $package library man pages?"
9044         case "$man3ext" in
9045         '')     case "$man3dir" in
9046                 *3)  dflt=3 ;;
9047                 *3p) dflt=3p ;;
9048                 *3pm) dflt=3pm ;;
9049                 *l) dflt=l;;
9050                 *n) dflt=n;;
9051                 *o) dflt=o;;
9052                 *p) dflt=p;;
9053                 *C) dflt=C;;
9054                 *L) dflt=L;;
9055                 *L3) dflt=L3;;
9056                 *) dflt=3;;
9057                 esac
9058                 ;;
9059         *)      dflt="$man3ext";;
9060         esac
9061         . ./myread
9062         man3ext="$ans"
9063         ;;
9064 esac
9065
9066 : see if we have to deal with yellow pages, now NIS.
9067 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9068         case "$hostcat" in
9069         nidump*) ;;
9070         *)
9071                 case "$hostcat" in
9072                 *ypcat*) dflt=y;;
9073                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9074                                 dflt=y
9075                         else
9076                                 dflt=n
9077                         fi;;
9078                 *) dflt=n;;
9079                 esac
9080                 echo " "
9081                 rp='Are you getting the hosts file via yellow pages?'
9082                 . ./myread
9083                 case "$ans" in
9084                 y*) hostcat='ypcat hosts';;
9085                 *) hostcat='cat /etc/hosts';;
9086                 esac
9087                 ;;
9088         esac
9089 fi
9090 case "$hostcat" in
9091 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9092 esac
9093 case "$groupcat" in
9094 '') test -f /etc/group && groupcat='cat /etc/group';;
9095 esac
9096 case "$passcat" in
9097 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9098 esac
9099
9100 : now get the host name
9101 echo " "
9102 echo "Figuring out host name..." >&4
9103 case "$myhostname" in
9104 '') cont=true
9105         echo 'Maybe "hostname" will work...'
9106         if tans=`sh -c hostname 2>&1` ; then
9107                 myhostname=$tans
9108                 phostname=hostname
9109                 cont=''
9110         fi
9111         ;;
9112 *) cont='';;
9113 esac
9114 if $test "$cont"; then
9115         if ./xenix; then
9116                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9117                 if tans=`cat /etc/systemid 2>&1` ; then
9118                         myhostname=$tans
9119                         phostname='cat /etc/systemid'
9120                         echo "Whadyaknow.  Xenix always was a bit strange..."
9121                         cont=''
9122                 fi
9123         elif $test -r /etc/systemid; then
9124                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9125         fi
9126 fi
9127 if $test "$cont"; then
9128         echo 'No, maybe "uuname -l" will work...'
9129         if tans=`sh -c 'uuname -l' 2>&1` ; then
9130                 myhostname=$tans
9131                 phostname='uuname -l'
9132         else
9133                 echo 'Strange.  Maybe "uname -n" will work...'
9134                 if tans=`sh -c 'uname -n' 2>&1` ; then
9135                         myhostname=$tans
9136                         phostname='uname -n'
9137                 else
9138                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9139                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9140                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9141                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9142                         else
9143                                 case "$myhostname" in
9144                                 '') echo "Does this machine have an identity crisis or something?"
9145                                         phostname='';;
9146                                 *)
9147                                         echo "Well, you said $myhostname before..."
9148                                         phostname='echo $myhostname';;
9149                                 esac
9150                         fi
9151                 fi
9152         fi
9153 fi
9154 case "$myhostname" in
9155 '') myhostname=noname ;;
9156 esac
9157 : you do not want to know about this
9158 set $myhostname
9159 myhostname=$1
9160
9161 : verify guess
9162 if $test "$myhostname" ; then
9163         dflt=y
9164         rp='Your host name appears to be "'$myhostname'".'" Right?"
9165         . ./myread
9166         case "$ans" in
9167         y*) ;;
9168         *) myhostname='';;
9169         esac
9170 fi
9171
9172 : bad guess or no guess
9173 while $test "X$myhostname" = X ; do
9174         dflt=''
9175         rp="Please type the (one word) name of your host:"
9176         . ./myread
9177         myhostname="$ans"
9178 done
9179
9180 : translate upper to lower if necessary
9181 case "$myhostname" in
9182 *[A-Z]*)
9183         echo "(Normalizing case in your host name)"
9184         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9185         ;;
9186 esac
9187
9188 case "$myhostname" in
9189 *.*)
9190         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9191         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9192         echo "(Trimming domain name from host name--host name is now $myhostname)"
9193         ;;
9194 *) case "$mydomain" in
9195         '')
9196                 {
9197                         test "X$hostcat" = "Xypcat hosts" &&
9198                         ypmatch "$myhostname" hosts 2>/dev/null |\
9199                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9200                         $test -s hosts
9201                 } || {
9202                         test "X$hostcat" != "X" &&
9203                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9204                                         /[       ]$myhostname[  . ]/p" > hosts
9205                 }
9206                 tmp_re="[       . ]"
9207                 if $test -f hosts; then
9208                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9209                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9210                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9211                                 hosts | $sort | $uniq | \
9212                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9213                         case `$echo X$dflt` in
9214                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9215                                 dflt=.
9216                                 ;;
9217                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9218                                 ;;
9219                         esac
9220                 else
9221                         echo "(I cannot locate a hosts database anywhere)"
9222                         dflt=.
9223                 fi
9224                 case "$dflt" in
9225                 .)
9226                         tans=`./loc resolv.conf X /etc /usr/etc`
9227                         if $test -f "$tans"; then
9228                                 echo "(Attempting domain name extraction from $tans)"
9229                                 dflt=.`$sed -n -e 's/   / /g' \
9230                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9231                                   -e 1q 2>/dev/null`
9232                                 case "$dflt" in
9233                                 .) dflt=.`$sed -n -e 's/        / /g' \
9234                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9235                                      -e 1q 2>/dev/null`
9236                                         ;;
9237                                 esac
9238                         fi
9239                         ;;
9240                 esac
9241                 case "$dflt" in
9242                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9243                         dflt=.`sh -c domainname 2>/dev/null`
9244                         case "$dflt" in
9245                         '') dflt='.';;
9246                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9247                         esac
9248                         ;;
9249                 esac
9250                 case "$dflt$osname" in
9251                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9252                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9253                         ;;
9254                 esac
9255                 case "$dflt" in
9256                 .) echo "(Lost all hope -- silly guess then)"
9257                         dflt='.nonet'
9258                         ;;
9259                 esac
9260                 $rm -f hosts
9261                 ;;
9262         *) dflt="$mydomain";;
9263         esac;;
9264 esac
9265 echo " "
9266 rp="What is your domain name?"
9267 . ./myread
9268 tans="$ans"
9269 case "$ans" in
9270 '') ;;
9271 .*) ;;
9272 *) tans=".$tans";;
9273 esac
9274 mydomain="$tans"
9275
9276 : translate upper to lower if necessary
9277 case "$mydomain" in
9278 *[A-Z]*)
9279         echo "(Normalizing case in your domain name)"
9280         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9281         ;;
9282 esac
9283
9284 : a little sanity check here
9285 case "$phostname" in
9286 '') ;;
9287 *)
9288         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9289         $myhostname$mydomain|$myhostname) ;;
9290         *)
9291                 case "$phostname" in
9292                 sed*)
9293                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9294                         ;;
9295                 *)
9296                         echo "(That doesn't agree with your $phostname command, by the way.)"
9297                         ;;
9298                 esac
9299         ;;
9300         esac
9301         ;;
9302 esac
9303
9304 : determine the e-mail address of the user who is running us
9305 $cat <<EOM
9306
9307 I need to get your e-mail address in Internet format if possible, i.e.
9308 something like user@host.domain. Please answer accurately since I have
9309 no easy means to double check it. The default value provided below
9310 is most probably close to reality but may not be valid from outside
9311 your organization...
9312
9313 EOM
9314 cont=x
9315 while test "$cont"; do
9316         case "$MAILDOMAIN" in
9317         '')
9318                 if $test -s /etc/mailname; then
9319                         maildomain=`$cat /etc/mailname`
9320                 else
9321                         maildomain="$myhostname$mydomain"
9322                 fi
9323                 ;;
9324         *)  maildomain="$MAILDOMAIN";;
9325         esac
9326         case "$cf_email" in
9327         '') dflt="$cf_by@$maildomain";;
9328         *)  dflt="$cf_email";;
9329         esac
9330         rp='What is your e-mail address?'
9331         . ./myread
9332         cf_email="$ans"
9333         case "$cf_email" in
9334         *@*.*) cont='' ;;
9335         *)
9336                 rp='Address does not look like an Internet one.  Use it anyway?'
9337                 case "$fastread" in
9338                 yes) dflt=y ;;
9339                 *) dflt=n ;;
9340                 esac
9341                 . ./myread
9342                 case "$ans" in
9343                 y*) cont='' ;;
9344                 *) echo " " ;;
9345                 esac
9346                 ;;
9347         esac
9348 done
9349
9350 : Ask e-mail of administrator
9351 $cat <<EOM
9352
9353 If you or somebody else will be maintaining perl at your site, please
9354 fill in the correct e-mail address here so that they may be contacted
9355 if necessary. Currently, the "perlbug" program included with perl
9356 will send mail to this address in addition to perlbug@perl.org. You may
9357 enter "none" for no administrator.
9358
9359 EOM
9360 case "$perladmin" in
9361 '') dflt="$cf_email";;
9362 *) dflt="$perladmin";;
9363 esac
9364 rp='Perl administrator e-mail address'
9365 . ./myread
9366 perladmin="$ans"
9367
9368 : determine whether to use a version number suffix for installed binaries
9369 echo " "
9370 $cat <<EOM
9371 Do you want to use a version number suffix for installed binaries? This
9372 will install 'perl$version' instead of 'perl', and likewise for other
9373 binaries like 'perldoc' and 'cpan'. This allows many versions of perl
9374 to be installed side-by-side. Unless you are a developer, you probably
9375 do *not* want to do this.
9376 EOM
9377 case "$versiononly" in
9378 "$define"|[Yy]*|true) dflt='y' ;;
9379 *) dflt='n';
9380 esac
9381 rp="Do you want to use a version number suffix for installed binaries?"
9382 . ./myread
9383 case "$ans" in
9384 [yY]*)  val="$define";;
9385 *)      val="$undef" ;;
9386 esac
9387 set versiononly
9388 eval $setvar
9389
9390 case "$versiononly" in
9391 "$define") inc_version_list=''
9392            inc_version_list_init=0
9393            ;;
9394 esac
9395
9396 : figure out how to guarantee perl startup
9397 : XXX Note that this currently takes advantage of the bug that binexp ignores
9398 :     the Configure -Dinstallprefix setting, which in turn means that under
9399 :     relocatable @INC, initialinstalllocation is what binexp started as.
9400 case "$startperl" in
9401 '')
9402         case "$sharpbang" in
9403         *!)
9404                 $cat <<EOH
9405
9406 I can use the #! construct to start perl on your system. This will
9407 make startup of perl scripts faster, but may cause problems if you
9408 want to share those scripts and perl is not in a standard place
9409 ($initialinstalllocation/perl) on all your platforms. The alternative
9410 is to force a shell by starting the script with a single ':' character.
9411
9412 EOH
9413                 case "$versiononly" in
9414                 "$define")      dflt="$initialinstalllocation/perl$version";;
9415                 *)              dflt="$initialinstalllocation/perl";;
9416                 esac
9417                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9418                 . ./myread
9419                 case "$ans" in
9420                 none)   startperl=": # use perl";;
9421                 *)      startperl="#!$ans"
9422                         if $test 30 -lt `echo "$ans" | wc -c`; then
9423                                 $cat >&4 <<EOM
9424
9425 WARNING:  Some systems limit the #! command to 32 characters.
9426 If you experience difficulty running Perl scripts with #!, try
9427 installing Perl in a directory with a shorter pathname.
9428
9429 EOM
9430                         fi ;;
9431                 esac
9432                 ;;
9433         *) startperl=": # use perl"
9434                 ;;
9435         esac
9436         ;;
9437 esac
9438 echo "I'll use $startperl to start perl scripts."
9439
9440 : figure best path for perl in scripts
9441 case "$perlpath" in
9442 '')
9443         case "$versiononly" in
9444         "$define")      perlpath="$initialinstalllocation/perl$version";;
9445         *)              perlpath="$initialinstalllocation/perl";;
9446         esac
9447         case "$startperl" in
9448         *!*) ;;
9449         *)
9450                 $cat <<EOH
9451
9452 I will use the "eval 'exec'" idiom to start Perl on your system.
9453 I can use the full path of your Perl binary for this purpose, but
9454 doing so may cause problems if you want to share those scripts and
9455 Perl is not always in a standard place ($initialinstalllocation/perl).
9456
9457 EOH
9458                 dflt="$initialinstalllocation/perl"
9459                 rp="What path shall I use in \"eval 'exec'\"?"
9460                 . ./myread
9461                 perlpath="$ans"
9462                 ;;
9463         esac
9464         ;;
9465 esac
9466 case "$startperl" in
9467 *!*)    ;;
9468 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9469 esac
9470
9471 : determine where public executable scripts go
9472 set scriptdir scriptdir
9473 eval $prefixit
9474 case "$scriptdir" in
9475 '')
9476         dflt="$bin"
9477         : guess some guesses
9478         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9479         $test -d /usr/share/bin     && dflt=/usr/share/bin
9480         $test -d /usr/local/script  && dflt=/usr/local/script
9481         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9482         $test -d $prefixexp/script  && dflt=$prefixexp/script
9483         set dflt
9484         eval $prefixup
9485         ;;
9486 *)  dflt="$scriptdir"
9487         ;;
9488 esac
9489 $cat <<EOM
9490
9491 Some installations have a separate directory just for executable scripts so
9492 that they can mount it across multiple architectures but keep the scripts in
9493 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9494 Or you might just lump your scripts in with all your other executables.
9495
9496 EOM
9497 fn=d~
9498 rp='Where do you keep publicly executable scripts?'
9499 . ./getfile
9500 if $test "X$ansexp" != "X$scriptdirexp"; then
9501         installscript=''
9502 fi
9503 installscriptdir=''
9504 prefixvar=scriptdir
9505 . ./setprefixvar
9506 : A little fix up for an irregularly named variable.
9507 installscript="$installscriptdir"
9508
9509 : determine where add-on public executables go
9510 case "$sitebin" in
9511 '')     dflt=$siteprefix/bin ;;
9512 *)      dflt=$sitebin ;;
9513 esac
9514 fn=d~
9515 rp='Pathname where the add-on public executables should be installed?'
9516 . ./getfile
9517 prefixvar=sitebin
9518 . ./setprefixvar
9519
9520 : determine where add-on html pages go
9521 : There is no standard location, so try to copy the previously-selected
9522 : directory structure for the core html pages.
9523 case "$sitehtml1dir" in
9524 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9525 *)     dflt=$sitehtml1dir ;;
9526 esac
9527 case "$dflt" in
9528 ''|' ') dflt=none ;;
9529 esac
9530 fn=dn+~
9531 rp='Pathname where the site-specific html pages should be installed?'
9532 . ./getfile
9533 prefixvar=sitehtml1dir
9534 . ./setprefixvar
9535
9536 : determine where add-on library html pages go
9537 : There is no standard location, so try to copy the previously-selected
9538 : directory structure for the core html pages.
9539 case "$sitehtml3dir" in
9540 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9541 *)     dflt=$sitehtml3dir ;;
9542 esac
9543 case "$dflt" in
9544 ''|' ') dflt=none ;;
9545 esac
9546 fn=dn+~
9547 rp='Pathname where the site-specific library html pages should be installed?'
9548 . ./getfile
9549 prefixvar=sitehtml3dir
9550 . ./setprefixvar
9551
9552 : determine where add-on manual pages go
9553 case "$siteman1dir" in
9554 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9555 *)      dflt=$siteman1dir ;;
9556 esac
9557 case "$dflt" in
9558 ''|' ') dflt=none ;;
9559 esac
9560 fn=dn+~
9561 rp='Pathname where the site-specific manual pages should be installed?'
9562 . ./getfile
9563 prefixvar=siteman1dir
9564 . ./setprefixvar
9565
9566 : determine where add-on library man pages go
9567 case "$siteman3dir" in
9568 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9569 *)      dflt=$siteman3dir ;;
9570 esac
9571 case "$dflt" in
9572 ''|' ') dflt=none ;;
9573 esac
9574 fn=dn+~
9575 rp='Pathname where the site-specific library manual pages should be installed?'
9576 . ./getfile
9577 prefixvar=siteman3dir
9578 . ./setprefixvar
9579
9580 : determine where add-on public executable scripts go
9581 case "$sitescript" in
9582 '')     dflt=$siteprefix/script
9583         $test -d $dflt || dflt=$sitebin ;;
9584 *)  dflt="$sitescript" ;;
9585 esac
9586 fn=d~+
9587 rp='Pathname where add-on public executable scripts should be installed?'
9588 . ./getfile
9589 prefixvar=sitescript
9590 . ./setprefixvar
9591
9592 : see if backtrace exists
9593 set backtrace d_backtrace
9594 eval $inlibc
9595
9596 : add flags if using c backtrace
9597 case "$usecbacktrace" in
9598   "") usecbacktrace=$undef ;;
9599   [yY]*|true|$define)
9600     case "$d_backtrace" in
9601       [yY]*|true|$define)
9602         case " $ccflags " in
9603           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9604           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9605           esac
9606         ;;
9607       *)
9608         echo "This system does not support backtrace" >&4
9609         usecbacktrace=$undef
9610         ;;
9611       esac
9612     ;;
9613   esac
9614
9615 : Check if faststdio is requested and available
9616 case "$usefaststdio" in
9617 $define|true|[yY]*|'')
9618         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9619         case "$xversion" in
9620         [68])   dflt='y' ;;
9621         *)      dflt='n' ;;
9622         esac
9623         ;;
9624 *) dflt='n';;
9625 esac
9626 cat <<EOM
9627
9628 Perl can be built to use 'fast stdio', which means using the stdio
9629 library but also directly manipulating the stdio buffers to enable
9630 faster I/O.  Using stdio is better for backward compatibility (especially
9631 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9632 interface has been preferred instead of stdio.
9633
9634 If this doesn't make any sense to you, just accept the default '$dflt'.
9635 EOM
9636 rp='Use the "fast stdio" if available?'
9637 . ./myread
9638 case "$ans" in
9639 y|Y)    val="$define" ;;
9640 *)      val="$undef" ;;
9641 esac
9642 set usefaststdio
9643 eval $setvar
9644
9645
9646 : define an is-a-typedef? function
9647 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9648 case "$inclist" in
9649 "") inclist="sys/types.h";;
9650 esac;
9651 eval "varval=\$$var";
9652 case "$varval" in
9653 "")
9654         $rm -f temp.c;
9655         for inc in $inclist; do
9656                 echo "#include <$inc>" >>temp.c;
9657         done;
9658         echo "#ifdef $type" >> temp.c;
9659         echo "printf(\"We have $type\");" >> temp.c;
9660         echo "#endif" >> temp.c;
9661         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9662         if $contains $type temp.E >/dev/null 2>&1; then
9663                 eval "$var=\$type";
9664         else
9665                 eval "$var=\$def";
9666         fi;
9667         $rm -f temp.?;;
9668 *) eval "$var=\$varval";;
9669 esac'
9670
9671 : define an is-a-typedef? function that prompts if the type is not available.
9672 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9673 case "$inclist" in
9674 "") inclist="sys/types.h";;
9675 esac;
9676 eval "varval=\$$var";
9677 case "$varval" in
9678 "")
9679         $rm -f temp.c;
9680         for inc in $inclist; do
9681                 echo "#include <$inc>" >>temp.c;
9682         done;
9683         echo "#ifdef $type" >> temp.c;
9684         echo "printf(\"We have $type\");" >> temp.c;
9685         echo "#endif" >> temp.c;
9686         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9687         echo " " ;
9688         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9689         if $contains $type temp.E >/dev/null 2>&1; then
9690                 echo "$type found." >&4;
9691                 eval "$var=\$type";
9692         else
9693                 echo "$type NOT found." >&4;
9694                 dflt="$def";
9695                 . ./myread ;
9696                 eval "$var=\$ans";
9697         fi;
9698         $rm -f temp.?;;
9699 *) eval "$var=\$varval";;
9700 esac'
9701
9702 : see what type lseek is declared as in the kernel
9703 rp="What is the type used for lseek's offset on this system?"
9704 set off_t lseektype long stdio.h sys/types.h
9705 eval $typedef_ask
9706
9707 echo " "
9708 echo "Checking to see how big your file offsets are..." >&4
9709 $cat >try.c <<EOCP
9710 #include <sys/types.h>
9711 #include <stdio.h>
9712 int main()
9713 {
9714     printf("%d\n", (int)sizeof($lseektype));
9715     return(0);
9716 }
9717 EOCP
9718 set try
9719 if eval $compile_ok; then
9720         lseeksize=`$run ./try`
9721         echo "Your file offsets are $lseeksize bytes long."
9722 else
9723         dflt=$longsize
9724         echo " "
9725         echo "(I can't seem to compile the test program.  Guessing...)"
9726         rp="What is the size of your file offsets (in bytes)?"
9727         . ./myread
9728         lseeksize="$ans"
9729 fi
9730 $rm_try
9731
9732 : see what type file positions are declared as in the library
9733 rp="What is the type for file position used by fsetpos()?"
9734 set fpos_t fpostype long stdio.h sys/types.h
9735 eval $typedef_ask
9736
9737 : Check size for Fpos_t
9738 echo " "
9739 case "$fpostype" in
9740 *_t) zzz="$fpostype"    ;;
9741 *)   zzz="fpos_t"       ;;
9742 esac
9743 echo "Checking the size of $zzz..." >&4
9744 cat > try.c <<EOCP
9745 #include <sys/types.h>
9746 #include <stdio.h>
9747 #$i_stdlib I_STDLIB
9748 #ifdef I_STDLIB
9749 #include <stdlib.h>
9750 #endif
9751 int main() {
9752     printf("%d\n", (int)sizeof($fpostype));
9753     exit(0);
9754 }
9755 EOCP
9756 set try
9757 if eval $compile_ok; then
9758         yyy=`$run ./try`
9759         case "$yyy" in
9760         '')     fpossize=4
9761                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9762                 ;;
9763         *)      fpossize=$yyy
9764                 echo "Your $zzz is $fpossize bytes long."
9765                 ;;
9766         esac
9767 else
9768         dflt="$longsize"
9769         echo " " >&4
9770         echo "(I can't compile the test program.  Guessing...)" >&4
9771         rp="What is the size of your file positions (in bytes)?"
9772         . ./myread
9773         fpossize="$ans"
9774 fi
9775
9776 : Check for large file support
9777 # Backward compatibility (uselfs is deprecated).
9778 case "$uselfs" in
9779 "$define"|true|[yY]*)
9780         cat <<EOM >&4
9781
9782 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9783 EOM
9784         uselargefiles="$define"
9785         ;;
9786 esac
9787
9788 case "$lseeksize:$fpossize" in
9789 8:8) cat <<EOM
9790
9791 You can have files larger than 2 gigabytes.
9792 EOM
9793    val="$define" ;;
9794 *)    case "$uselargefiles" in
9795    "$undef"|false|[nN]*) dflt='n' ;;
9796    *)   dflt='y' ;;
9797    esac
9798    cat <<EOM
9799
9800 Perl can be built to understand large files (files larger than 2 gigabytes)
9801 on some systems.  To do so, Configure can be run with -Duselargefiles.
9802
9803 If this doesn't make any sense to you, just accept the default '$dflt'.
9804 EOM
9805    rp='Try to understand large files, if available?'
9806    . ./myread
9807    case "$ans" in
9808    y|Y)         val="$define" ;;
9809    *)           val="$undef"  ;;
9810    esac
9811    ;;
9812 esac
9813 set uselargefiles
9814 eval $setvar
9815 : Look for a hint-file generated 'call-back-unit'.  If the
9816 : user has specified that a large files perl is to be built,
9817 : we may need to set or change some other defaults.
9818 if $test -f uselargefiles.cbu; then
9819         echo "Your platform has some specific hints regarding large file builds, using them..."
9820         . ./uselargefiles.cbu
9821 fi
9822 case "$uselargefiles" in
9823 "$define")
9824         if $test -f uselargefiles.cbu; then
9825                 echo " "
9826                 echo "Rechecking to see how big your file offsets are..." >&4
9827                 $cat >try.c <<EOCP
9828 #include <sys/types.h>
9829 #include <stdio.h>
9830 int main()
9831 {
9832     printf("%d\n", (int)sizeof($lseektype));
9833     return(0);
9834 }
9835 EOCP
9836                 set try
9837                 if eval $compile_ok; then
9838                         lseeksize=`$run ./try`
9839                         $echo "Your file offsets are now $lseeksize bytes long."
9840                 else
9841                         dflt="$lseeksize"
9842                         echo " "
9843                         echo "(I can't seem to compile the test program.  Guessing...)"
9844                         rp="What is the size of your file offsets (in bytes)?"
9845                         . ./myread
9846                         lseeksize="$ans"
9847                 fi
9848                 case "$fpostype" in
9849                 *_t) zzz="$fpostype"    ;;
9850                 *)   zzz="fpos_t"       ;;
9851                 esac
9852                 $echo $n "Rechecking the size of $zzz...$c" >&4
9853                 $cat > try.c <<EOCP
9854 #include <sys/types.h>
9855 #include <stdio.h>
9856 #$i_stdlib I_STDLIB
9857 #ifdef I_STDLIB
9858 #include <stdlib.h>
9859 #endif
9860 int main() {
9861     printf("%d\n", (int)sizeof($fpostype));
9862     return(0);
9863 }
9864 EOCP
9865                 set try
9866                 if eval $compile_ok; then
9867                         yyy=`$run ./try`
9868                         dflt="$lseeksize"
9869                         case "$yyy" in
9870                         '')     echo " "
9871                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9872                                 ;;
9873                         *)      fpossize=$yyy
9874                                 echo " $fpossize bytes." >&4
9875                                 ;;
9876                         esac
9877                 else
9878                         dflt="$fpossize"
9879                         echo " "
9880                         echo "(I can't compile the test program.  Guessing...)" >&4
9881                         rp="What is the size of your file positions (in bytes)?"
9882                         . ./myread
9883                         fpossize="$ans"
9884                 fi
9885                 $rm_try
9886         fi
9887         ;;
9888 esac
9889
9890 : Check if we want perlio
9891 useperlio="$define"
9892
9893 : Set the vendorbin variables
9894 case "$vendorprefix" in
9895 '')     d_vendorbin="$undef"
9896         vendorbin=''
9897         vendorbinexp=''
9898         ;;
9899 *)      d_vendorbin="$define"
9900         : determine where vendor-supplied executables go.
9901         case "$vendorbin" in
9902         '') dflt=$vendorprefix/bin ;;
9903         *)      dflt="$vendorbin" ;;
9904         esac
9905         fn=d~+
9906         rp='Pathname for the vendor-supplied executables directory?'
9907         . ./getfile
9908         vendorbin="$ans"
9909         vendorbinexp="$ansexp"
9910         ;;
9911 esac
9912 prefixvar=vendorbin
9913 . ./installprefix
9914
9915 : Set the vendorhtml1dir variables
9916 case "$vendorprefix" in
9917 '')     vendorhtml1dir=''
9918         vendorhtml1direxp=''
9919         ;;
9920 *)      : determine where vendor-supplied html pages go.
9921         : There is no standard location, so try to copy the previously-selected
9922         : directory structure for the core html pages.
9923         : XXX Better default suggestions would be welcome.
9924         case "$vendorhtml1dir" in
9925         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9926         *)      dflt=$vendorhtml1dir ;;
9927         esac
9928         case "$dflt" in
9929         ''|' ') dflt=none ;;
9930         esac
9931         fn=dn+~
9932         rp='Pathname for the vendor-supplied html pages?'
9933         . ./getfile
9934         vendorhtml1dir="$ans"
9935         vendorhtml1direxp="$ansexp"
9936         ;;
9937 esac
9938 : Use ' ' for none so value is preserved next time through Configure
9939 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9940 prefixvar=vendorhtml1dir
9941 . ./installprefix
9942
9943 : Set the vendorhtml3dir variables
9944 case "$vendorprefix" in
9945 '')     vendorhtml3dir=''
9946         vendorhtml3direxp=''
9947         ;;
9948 *)      : determine where vendor-supplied module html pages go.
9949         : There is no standard location, so try to copy the previously-selected
9950         : directory structure for the core html pages.
9951         : XXX Better default suggestions would be welcome.
9952         case "$vendorhtml3dir" in
9953         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9954         *)      dflt=$vendorhtml3dir ;;
9955         esac
9956         case "$dflt" in
9957         ''|' ') dflt=none ;;
9958         esac
9959         fn=dn+~
9960         rp='Pathname for the vendor-supplied html pages?'
9961         . ./getfile
9962         vendorhtml3dir="$ans"
9963         vendorhtml3direxp="$ansexp"
9964         ;;
9965 esac
9966 : Use ' ' for none so value is preserved next time through Configure
9967 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9968 prefixvar=vendorhtml3dir
9969 . ./installprefix
9970
9971 : Set the vendorman1dir variables
9972 case "$vendorprefix" in
9973 '')     vendorman1dir=''
9974         vendorman1direxp=''
9975         ;;
9976 *)      : determine where vendor-supplied manual pages go.
9977         case "$vendorman1dir" in
9978         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9979         *)      dflt=$vendorman1dir ;;
9980         esac
9981         case "$dflt" in
9982         ''|' ') dflt=none ;;
9983         esac
9984         fn=nd~+
9985         rp='Pathname for the vendor-supplied manual section 1 pages?'
9986         . ./getfile
9987         vendorman1dir="$ans"
9988         vendorman1direxp="$ansexp"
9989         ;;
9990 esac
9991 : Use ' ' for none so value is preserved next time through Configure
9992 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9993 prefixvar=vendorman1dir
9994 . ./installprefix
9995
9996 : Set the vendorman3dir variables
9997 case "$vendorprefix" in
9998 '')     vendorman3dir=''
9999         vendorman3direxp=''
10000         ;;
10001 *)      : determine where vendor-supplied module manual pages go.
10002         case "$vendorman3dir" in
10003         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10004         *)      dflt=$vendorman3dir ;;
10005         esac
10006         case "$dflt" in
10007         ''|' ') dflt=none ;;
10008         esac
10009         fn=nd~+
10010         rp='Pathname for the vendor-supplied manual section 3 pages?'
10011         . ./getfile
10012         vendorman3dir="$ans"
10013         vendorman3direxp="$ansexp"
10014         ;;
10015 esac
10016 : Use ' ' for none so value is preserved next time through Configure
10017 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
10018 prefixvar=vendorman3dir
10019 . ./installprefix
10020
10021 : Set the vendorscript variables
10022 case "$vendorprefix" in
10023 '')     d_vendorscript="$undef"
10024         vendorscript=''
10025         vendorscriptexp=''
10026         ;;
10027 *)      d_vendorscript="$define"
10028         : determine where vendor-supplied scripts go.
10029         case "$vendorscript" in
10030         '')     dflt=$vendorprefix/script
10031                 $test -d $dflt || dflt=$vendorbin ;;
10032         *)  dflt="$vendorscript" ;;
10033         esac
10034         $cat <<EOM
10035
10036 The installation process will create a directory for
10037 vendor-supplied scripts.
10038
10039 EOM
10040         fn=d~+
10041         rp='Pathname for the vendor-supplied scripts directory?'
10042         . ./getfile
10043         vendorscript="$ans"
10044         vendorscriptexp="$ansexp"
10045         ;;
10046 esac
10047 prefixvar=vendorscript
10048 . ./installprefix
10049
10050 : see if qgcvt exists
10051 set qgcvt d_qgcvt
10052 eval $inlibc
10053
10054 : Check what kind of doubles your system has
10055 $echo "Checking the kind of doubles you have..." >&4
10056 $cat >try.c <<EOP
10057 #$i_stdlib I_STDLIB
10058 #define DOUBLESIZE $doublesize
10059 #ifdef I_STDLIB
10060 #include <stdlib.h>
10061 #endif
10062 #include <stdio.h>
10063 static const double d = -0.1;
10064 int main() {
10065   unsigned const char* b = (unsigned const char*)(&d);
10066 #if DOUBLESIZE == 4
10067   if (b[0] == 0xCD && b[3] == 0xBD) {
10068     /* IEEE 754 32-bit little-endian */
10069     printf("1\n");
10070     exit(0);
10071   }
10072   if (b[0] == 0xBD && b[3] == 0xCD) {
10073     /* IEEE 754 32-bit big-endian */
10074     printf("2\n");
10075     exit(0);
10076   }
10077   if (b[0] == 0xCC && b[3] == 0xCC) {
10078     /* VAX format F, 32-bit PDP-style mixed endian. */
10079     printf("9\n");
10080     exit(0);
10081   }
10082   if (b[0] == 0xC0 && b[3] == 0x9A) {
10083     /* IBM single 32-bit */
10084     printf("12\n");
10085     exit(0);
10086   }
10087 #endif
10088 #if DOUBLESIZE == 8
10089   if (b[0] == 0x9A && b[7] == 0xBF) {
10090     /* IEEE 754 64-bit little-endian */
10091     printf("3\n");
10092     exit(0);
10093   }
10094   if (b[0] == 0xBF && b[7] == 0x9A) {
10095     /* IEEE 754 64-bit big-endian */
10096     printf("4\n");
10097     exit(0);
10098   }
10099   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10100    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10101     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10102     * 99 99 b9 bf 9a 99 99 99 */
10103     printf("7\n");
10104     exit(0);
10105   }
10106   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10107    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10108     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10109     * 99 99 99 9a bf b9 99 99 */
10110     printf("8\n");
10111     exit(0);
10112   }
10113   if (b[0] == 0xCC && b[7] == 0xCC) {
10114    /* VAX format D, 64-bit PDP-style mixed endian. */
10115     printf("10\n");
10116     exit(0);
10117   }
10118   if (b[0] == 0xD9 && b[7] == 0x99) {
10119    /* VAX format G, 64-bit PDP-style mixed endian. */
10120     printf("11\n");
10121     exit(0);
10122   }
10123   if (b[0] == 0xC0 && b[7] == 0x9A) {
10124     /* IBM double 64-bit */
10125     printf("13\n");
10126     exit(0);
10127   }
10128   if (b[0] == 0xBF && b[7] == 0xCD) {
10129     /* CRAY single 64-bit */
10130     printf("14\n");
10131     exit(0);
10132   }
10133 #endif
10134 #if DOUBLESIZE == 16
10135   if (b[0] == 0x9A && b[15] == 0xBF) {
10136     /* IEEE 754 128-bit little-endian */
10137     printf("5\n");
10138     exit(0);
10139   }
10140   if (b[0] == 0xBF && b[15] == 0x9A) {
10141     /* IEEE 754 128-bit big-endian */
10142     printf("6\n");
10143     exit(0);
10144   }
10145 #endif
10146   /* Then there are old mainframe/miniframe formats like IBM and CRAY.
10147    * Whether those environments can still build Perl is debatable. */
10148   printf("-1\n"); /* unknown */
10149   exit(0);
10150 }
10151 EOP
10152 set try
10153 if eval $compile; then
10154     doublekind=`$run ./try`
10155 else
10156     doublekind=-1
10157 fi
10158 case "$doublekind" in
10159 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10160 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10161 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10162 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10163 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10164 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10165 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10166 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10167 9) echo "You have VAX format F 32-bit PDP-style mixed endian doubles." >&4 ;;
10168 10) echo "You have VAX format D 64-bit PDP-style mixed endian doubles." >&4 ;;
10169 11) echo "You have VAX format G 64-bit PDP-style mixed endian doubles." >&4 ;;
10170 12) echo "You have IBM short 32-bit doubles." >&4 ;;
10171 13) echo "You have IBM long 64-bit doubles." >&4 ;;
10172 14) echo "You have Cray single 64-bit doubles." >&4 ;;
10173 *) echo "Cannot figure out your double.  You Cyber, or something?" >&4 ;;
10174 esac
10175 d_double_style_ieee=$undef
10176 d_double_style_vax=$undef
10177 d_double_style_ibm=$undef
10178 d_double_style_cray=$undef
10179 case "$doublekind" in
10180 1|2|3|4|5|6|7|8) d_double_style_ieee=$define ;;
10181 9|10|11) d_double_style_vax=$define ;;
10182 12|13) d_double_style_ibm=$define ;;
10183 14) d_double_style_cray=$define ;;
10184 esac
10185 case "$d_double_style_ieee" in
10186 $define)
10187     d_double_has_inf=$define
10188     d_double_has_nan=$define
10189     d_double_has_negative_zero=$define
10190     d_double_has_subnormals=$define
10191     ;;
10192 *)
10193     d_double_has_inf=$undef
10194     d_double_has_nan=$undef
10195     d_double_has_negative_zero=$undef
10196     d_double_has_subnormals=$undef
10197     ;;
10198 esac
10199 $rm_try
10200
10201 : Check print/scan long double stuff
10202 echo " "
10203
10204 if $test X"$d_longdbl" = X"$define"; then
10205
10206 echo "Checking how to print long doubles..." >&4
10207
10208 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10209         $cat >try.c <<'EOCP'
10210 #include <sys/types.h>
10211 #include <stdio.h>
10212 int main() {
10213   double d = 123.456;
10214   printf("%.3f\n", d);
10215 }
10216 EOCP
10217         set try
10218         if eval $compile; then
10219                 yyy=`$run ./try`
10220                 case "$yyy" in
10221                 123.456)
10222                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10223                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10224                         echo "We will use %f."
10225                         ;;
10226                 esac
10227         fi
10228 fi
10229
10230 if $test X"$sPRIfldbl" = X; then
10231         $cat >try.c <<'EOCP'
10232 #include <sys/types.h>
10233 #include <stdio.h>
10234 int main() {
10235   long double d = 123.456;
10236   printf("%.3Lf\n", d);
10237 }
10238 EOCP
10239         set try
10240         if eval $compile; then
10241                 yyy=`$run ./try`
10242                 case "$yyy" in
10243                 123.456)
10244                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10245                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10246                         echo "We will use %Lf."
10247                         ;;
10248                 esac
10249         fi
10250 fi
10251
10252 if $test X"$sPRIfldbl" = X; then
10253         $cat >try.c <<'EOCP'
10254 #include <sys/types.h>
10255 #include <stdio.h>
10256 int main() {
10257   long double d = 123.456;
10258   printf("%.3llf\n", d);
10259 }
10260 EOCP
10261         set try
10262         if eval $compile; then
10263                 yyy=`$run ./try`
10264                 case "$yyy" in
10265                 123.456)
10266                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10267                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10268                         echo "We will use %llf."
10269                         ;;
10270                 esac
10271         fi
10272 fi
10273
10274 if $test X"$sPRIfldbl" = X; then
10275         $cat >try.c <<'EOCP'
10276 #include <sys/types.h>
10277 #include <stdio.h>
10278 int main() {
10279   long double d = 123.456;
10280   printf("%.3lf\n", d);
10281 }
10282 EOCP
10283         set try
10284         if eval $compile; then
10285                 yyy=`$run ./try`
10286                 case "$yyy" in
10287                 123.456)
10288                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10289                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10290                         echo "We will use %lf."
10291                         ;;
10292                 esac
10293         fi
10294 fi
10295
10296 if $test X"$sPRIfldbl" = X; then
10297         echo "Cannot figure out how to print long doubles." >&4
10298 else
10299         sSCNfldbl=$sPRIfldbl    # expect consistency
10300 fi
10301
10302 $rm_try
10303
10304 fi # d_longdbl
10305
10306 case "$sPRIfldbl" in
10307 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10308         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10309         d_SCNfldbl="$undef";
10310         ;;
10311 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10312         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10313         d_SCNfldbl="$define";
10314         ;;
10315 esac
10316
10317 : Before committing on uselongdouble, see whether that looks sane.
10318 if $test "$uselongdouble" = "$define"; then
10319     message=""
10320     echo " "
10321     echo "Checking if your long double math functions work right..." >&4
10322     $cat > try.c <<EOF
10323 #include <math.h>
10324 #include <stdio.h>
10325 int main() {
10326   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10327 }
10328 EOF
10329     case "$osname:$gccversion" in
10330     aix:)       saveccflags="$ccflags"
10331                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10332     esac
10333     set try
10334     if eval $compile_ok; then
10335       yyy=`$run ./try`
10336     fi
10337     case "$yyy" in
10338     3) echo "Your long double math functions are working correctly." >&4 ;;
10339     *) echo "Your long double math functions are broken, not using long doubles." >&4
10340        uselongdouble=$undef
10341        ;;
10342     esac
10343     $rm_try
10344     case "$osname:$gccversion" in
10345     aix:)       ccflags="$saveccflags" ;; # restore
10346     esac
10347 fi
10348
10349 : Check how to convert floats to strings.
10350
10351 if test "X$d_Gconvert" = X; then
10352
10353 echo " "
10354 echo "Checking for an efficient way to convert floats to strings."
10355 echo " " > try.c
10356 case "$uselongdouble" in
10357 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10358 esac
10359 case "$d_longdbl" in
10360 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10361 esac
10362 case "$d_PRIgldbl" in
10363 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10364 esac
10365 $cat >>try.c <<EOP
10366 #ifdef TRY_gconvert
10367 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10368 char *myname = "gconvert";
10369 #endif
10370 #ifdef TRY_gcvt
10371 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10372 char *myname = "gcvt";
10373 #endif
10374 #ifdef TRY_qgcvt
10375 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10376 char *myname = "qgcvt";
10377 #define DOUBLETYPE long double
10378 #endif
10379 #ifdef TRY_sprintf
10380 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10381 #ifdef HAS_PRIgldbl
10382 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10383 #else
10384 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10385 #endif
10386 #else
10387 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10388 #endif
10389 char *myname = "sprintf";
10390 #endif
10391
10392 #ifndef DOUBLETYPE
10393 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10394 #define DOUBLETYPE long double
10395 #else
10396 #define DOUBLETYPE double
10397 #endif
10398 #endif
10399
10400 #include <stdio.h>
10401
10402 #$i_stdlib I_STDLIB
10403 #ifdef I_STDLIB
10404 #include <stdlib.h>
10405 #endif
10406 #include <string.h>
10407
10408 int checkit(char *expect, char *got)
10409 {
10410     if (strcmp(expect, got)) {
10411                 printf("%s oddity:  Expected %s, got %s\n",
10412                         myname, expect, got);
10413                 exit(1);
10414         }
10415 }
10416
10417 int main()
10418 {
10419         char buf[64];
10420         buf[63] = '\0';
10421
10422         /* This must be 1st test on (which?) platform */
10423         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10424         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10425         checkit("0.1", buf);
10426
10427         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10428         checkit("0.01", buf);
10429
10430         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10431         checkit("0.001", buf);
10432
10433         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10434         checkit("0.0001", buf);
10435
10436         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10437         if (strlen(buf) > 5)
10438             checkit("9e-005", buf); /* for Microsoft ?? */
10439         else
10440             checkit("9e-05", buf);
10441
10442         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10443         checkit("1", buf);
10444
10445         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10446         checkit("1.1", buf);
10447
10448         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10449         checkit("1.01", buf);
10450
10451         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10452         checkit("1.001", buf);
10453
10454         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10455         checkit("1.0001", buf);
10456
10457         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10458         checkit("1.00001", buf);
10459
10460         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10461         checkit("1.000001", buf);
10462
10463         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10464         checkit("0", buf);
10465
10466         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10467         checkit("-1", buf);
10468
10469         /* Some Linux gcvt's give 1.e+5 here. */
10470         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10471         checkit("100000", buf);
10472
10473         /* Some Linux gcvt's give -1.e+5 here. */
10474         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10475         checkit("-100000", buf);
10476
10477         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10478         checkit("123.456", buf);
10479
10480         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10481         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10482         /* 34 should be enough to scare even long double
10483          * places into using the e notation. */
10484         if (strlen(buf) > 5)
10485             checkit("1e+034", buf); /* for Microsoft */
10486         else
10487             checkit("1e+34", buf);
10488
10489         /* For Perl, if you add additional tests here, also add them to
10490          * t/base/num.t for benefit of platforms not using Configure or
10491          * overriding d_Gconvert */
10492
10493         exit(0);
10494 }
10495 EOP
10496 : first add preferred functions to our list
10497 xxx_list=""
10498 for xxx_convert in $gconvert_preference; do
10499     case $xxx_convert in
10500     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10501     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10502     esac
10503 done
10504 : then add any others
10505 for xxx_convert in gconvert gcvt sprintf; do
10506     case "$xxx_list" in
10507     *$xxx_convert*) ;;
10508     *) xxx_list="$xxx_list $xxx_convert" ;;
10509     esac
10510 done
10511
10512 case "$d_longdbl$uselongdouble" in
10513 "$define$define")
10514     : again, add preferred functions to our list first
10515     xxx_ld_list=""
10516     for xxx_convert in $gconvert_ld_preference; do
10517         case $xxx_convert in
10518         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10519         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10520         esac
10521     done
10522     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10523     for xxx_convert in qgcvt sprintf $xxx_list; do
10524         case "$xxx_ld_list" in
10525         $xxx_convert*|*" $xxx_convert"*) ;;
10526         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10527         esac
10528     done
10529     : if sprintf cannot do long doubles, move it to the end
10530     if test "$d_PRIgldbl" != "$define"; then
10531         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10532     fi
10533     : if no qgcvt, remove it
10534     if test "$d_qgcvt" != "$define"; then
10535         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10536     fi
10537     : use the ld_list
10538     xxx_list="$xxx_ld_list"
10539     ;;
10540 esac
10541
10542 for xxx_convert in $xxx_list; do
10543         echo "Trying $xxx_convert..."
10544         $rm -f try try$_o core
10545         set try -DTRY_$xxx_convert
10546         if eval $compile; then
10547                 echo "$xxx_convert() found." >&4
10548                 if $run ./try; then
10549                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10550                         break;
10551                 else
10552                         echo "...But $xxx_convert didn't work as I expected."
10553                         xxx_convert=''
10554                 fi
10555         else
10556                 echo "$xxx_convert NOT found." >&4
10557         fi
10558 done
10559
10560 if test X$xxx_convert = X; then
10561     echo "*** WHOA THERE!!! ***" >&4
10562     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10563     xxx_convert=sprintf
10564 fi
10565
10566 case "$xxx_convert" in
10567 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10568 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10569 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10570 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10571    "$define$define$define")
10572       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10573    "$define$define$undef")
10574       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10575    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10576    esac
10577    ;;
10578 esac
10579
10580 fi
10581 $rm_try
10582
10583 : see if _fwalk exists
10584 set fwalk d__fwalk
10585 eval $inlibc
10586
10587 : Initialize h_fcntl
10588 h_fcntl=false
10589
10590 : Initialize h_sysfile
10591 h_sysfile=false
10592
10593 : access call always available on UNIX
10594 set access d_access
10595 eval $inlibc
10596
10597 : locate the flags for 'access()'
10598 case "$d_access" in
10599 "$define")
10600         echo " "
10601         $cat >access.c <<EOCP
10602 #include <sys/types.h>
10603 #ifdef I_FCNTL
10604 #include <fcntl.h>
10605 #endif
10606 #ifdef I_SYS_FILE
10607 #include <sys/file.h>
10608 #endif
10609 #ifdef I_UNISTD
10610 #include <unistd.h>
10611 #endif
10612 #$i_stdlib I_STDLIB
10613 #ifdef I_STDLIB
10614 #include <stdlib.h>
10615 #endif
10616 int main() {
10617         exit(R_OK);
10618 }
10619 EOCP
10620         : check sys/file.h first, no particular reason here
10621         if $test `./findhdr sys/file.h` && \
10622                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10623                 h_sysfile=true;
10624                 echo "<sys/file.h> defines the *_OK access constants." >&4
10625         elif $test `./findhdr fcntl.h` && \
10626                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10627                 h_fcntl=true;
10628                 echo "<fcntl.h> defines the *_OK access constants." >&4
10629         elif $test `./findhdr unistd.h` && \
10630                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10631                 echo "<unistd.h> defines the *_OK access constants." >&4
10632         else
10633                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10634         fi
10635         ;;
10636 esac
10637 $rm -f access*
10638
10639 : see if accessx exists
10640 set accessx d_accessx
10641 eval $inlibc
10642
10643 : see if acosh exists
10644 set acosh d_acosh
10645 eval $inlibc
10646
10647 : see if aintl exists
10648 set aintl d_aintl
10649 eval $inlibc
10650
10651 : see if alarm exists
10652 set alarm d_alarm
10653 eval $inlibc
10654
10655 : see if 64bit time functions exists
10656
10657 set ctime64 d_ctime64
10658 eval $inlibc
10659
10660 set localtime64 d_localtime64
10661 eval $inlibc
10662
10663 set gmtime64 d_gmtime64
10664 eval $inlibc
10665
10666 set mktime64 d_mktime64
10667 eval $inlibc
10668
10669 set difftime64 d_difftime64
10670 eval $inlibc
10671
10672 set asctime64 d_asctime64
10673 eval $inlibc
10674
10675 : see if POSIX threads are available
10676 set pthread.h i_pthread
10677 eval $inhdr
10678
10679 : define a function to check prototypes
10680 $cat > protochk <<EOSH
10681 $startsh
10682 cc="$cc"
10683 optimize="$optimize"
10684 ccflags="$ccflags"
10685 define="$define"
10686 rm_try="$rm_try"
10687 usethreads=$usethreads
10688 i_pthread=$i_pthread
10689 pthread_h_first=$pthread_h_first
10690 EOSH
10691
10692 $cat >> protochk <<'EOSH'
10693
10694 $rm_try
10695 foo="$1"
10696 shift
10697 while test $# -ge 2; do
10698         case "$1" in
10699                 $define) echo "#include <$2>" >> try.c ;;
10700                 literal) echo "$2" >> try.c ;;
10701         esac
10702     # Extra magic for the benefit of systems that need pthread.h
10703     # to be included early to correctly detect threadsafe functions.
10704     # Such functions must guarantee themselves, though, that the usethreads
10705     # and i_pthread have been defined, before calling protochk.
10706     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10707         echo "#include <pthread.h>" >> try.c
10708         pthread_h_done=yes
10709     fi
10710     shift 2
10711 done
10712 cat >> try.c <<'EOCP'
10713 #define _(args) args
10714 EOCP
10715 echo "$foo" >> try.c
10716 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10717 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10718 status=$?
10719 $rm_try
10720 exit $status
10721 EOSH
10722 chmod +x protochk
10723 $eunicefix protochk
10724
10725 : Define hasproto macro for Configure internal use
10726 hasproto='varname=$1; func=$2; shift; shift;
10727 while $test $# -ge 2; do
10728         case "$1" in
10729         $define) echo "#include <$2>";;
10730         esac ;
10731     shift 2;
10732 done > try.c;
10733 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10734 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10735         echo "$func() prototype found.";
10736         val="$define";
10737 else
10738         echo "$func() prototype NOT found.";
10739         val="$undef";
10740 fi;
10741 set $varname;
10742 eval $setvar;
10743 $rm_try tryout.c'
10744
10745 : see if sys/types.h has to be included
10746 set sys/types.h i_systypes
10747 eval $inhdr
10748
10749 : see if sys/select.h has to be included
10750 set sys/select.h i_sysselct
10751 eval $inhdr
10752
10753 : Define hasfield macro for Configure internal use
10754 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10755 while $test $# -ge 2; do
10756         case "$1" in
10757         $define) echo "#include <$2>";;
10758         esac ;
10759     shift 2;
10760 done > try.c;
10761 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10762 set try;
10763 if eval $compile; then
10764         val="$define";
10765 else
10766         val="$undef";
10767 fi;
10768 set $varname;
10769 eval $setvar;
10770 $rm_try'
10771
10772 : see if we should include sys/time.h
10773 echo " "
10774 i_time='define'
10775 if test "X$timeincl" = X; then
10776         echo "Testing to see if we should include <sys/time.h>." >&4
10777         $echo $n "I'm now running the test program...$c"
10778         $cat >try.c <<EOCP
10779 #include <sys/types.h>
10780 #include <time.h>
10781 #ifdef I_SYSTIME
10782 #ifdef SYSTIMEKERNEL
10783 #define KERNEL
10784 #endif
10785 #include <sys/time.h>
10786 #endif
10787 #ifdef I_SYSSELECT
10788 #include <sys/select.h>
10789 #endif
10790 #$i_stdlib I_STDLIB
10791 #ifdef I_STDLIB
10792 #include <stdlib.h>
10793 #endif
10794 int main()
10795 {
10796         struct tm foo;
10797 #ifdef S_TIMEVAL
10798         struct timeval bar;
10799 #endif
10800 #ifdef S_TIMEZONE
10801         struct timezone tzp;
10802 #endif
10803         if (foo.tm_sec == foo.tm_sec)
10804                 exit(0);
10805 #ifdef S_TIMEVAL
10806         if (bar.tv_sec == bar.tv_sec)
10807                 exit(0);
10808 #endif
10809         exit(1);
10810 }
10811 EOCP
10812         flags=''
10813         for s_timezone in '-DS_TIMEZONE' ''; do
10814         sysselect=''
10815         for s_timeval in '-DS_TIMEVAL' ''; do
10816         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10817         for i_systime in '-DI_SYSTIME' ''; do
10818                 case "$flags" in
10819                 '') $echo $n ".$c"
10820                         set try $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10821                         if eval $compile; then
10822                                 set X $i_systime $i_systimek $sysselect $s_timeval
10823                                 shift
10824                                 flags="$*"
10825                                 echo " "
10826                                 $echo $n "Succeeded with $flags$c"
10827                         fi
10828                         ;;
10829                 esac
10830         done
10831         done
10832         done
10833         done
10834         timeincl=''
10835         echo " "
10836         case "$flags" in
10837         *SYSTIMEKERNEL*) i_systimek="$define"
10838                 timeincl=`./findhdr sys/time.h`
10839                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10840         *) i_systimek="$undef";;
10841         esac
10842         case "$flags" in
10843         *I_SYSTIME*) i_systime="$define"
10844                 timeincl=`./findhdr sys/time.h`" $timeincl"
10845                 echo "We'll include <sys/time.h>." >&4;;
10846         *) i_systime="$undef";;
10847         esac
10848         $rm_try
10849 fi
10850 : see if struct tm knows about tm_zone
10851 case "$i_systime$i_time" in
10852 *$define*)
10853         echo " "
10854         echo "Checking to see if your struct tm has tm_zone field..." >&4
10855         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10856         eval $hasfield
10857         ;;
10858 *)      val="$undef"
10859         set d_tm_tm_zone
10860         eval $setvar
10861         ;;
10862 esac
10863 case "$d_tm_tm_zone" in
10864 "$define")      echo "Yes, it does."   ;;
10865 *)              echo "No, it doesn't." ;;
10866 esac
10867 : see if struct tm knows about tm_gmtoff
10868 case "$i_systime$i_time" in
10869 *$define*)
10870         echo " "
10871         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10872         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10873         eval $hasfield
10874         ;;
10875 *)      val="$undef"
10876         set d_tm_tm_gmtoff
10877         eval $setvar
10878         ;;
10879 esac
10880 case "$d_tm_tm_gmtoff" in
10881 "$define")      echo "Yes, it does."   ;;
10882 *)              echo "No, it doesn't." ;;
10883 esac
10884
10885 : see if asctime_r exists
10886 set asctime_r d_asctime_r
10887 eval $inlibc
10888 case "$d_asctime_r" in
10889 "$define")
10890         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10891         case "$d_asctime_r_proto:$usethreads" in
10892         ":define")      d_asctime_r_proto=define
10893                 set d_asctime_r_proto asctime_r $hdrs
10894                 eval $hasproto ;;
10895         *)      ;;
10896         esac
10897         case "$d_asctime_r_proto" in
10898         define)
10899         case "$asctime_r_proto" in
10900         ''|0) try='char* asctime_r(const struct tm*, char*);'
10901         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10902         esac
10903         case "$asctime_r_proto" in
10904         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10905         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10906         esac
10907         case "$asctime_r_proto" in
10908         ''|0) try='int asctime_r(const struct tm*, char*);'
10909         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10910         esac
10911         case "$asctime_r_proto" in
10912         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10913         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10914         esac
10915         case "$asctime_r_proto" in
10916         ''|0)   d_asctime_r=undef
10917                 asctime_r_proto=0
10918                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10919         * )     case "$asctime_r_proto" in
10920                 REENTRANT_PROTO*) ;;
10921                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10922                 esac
10923                 echo "Prototype: $try" ;;
10924         esac
10925         ;;
10926         *)      case "$usethreads" in
10927                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10928                 esac
10929                 d_asctime_r=undef
10930                 asctime_r_proto=0
10931                 ;;
10932         esac
10933         ;;
10934 *)      asctime_r_proto=0
10935         ;;
10936 esac
10937
10938 : see if asinh exists
10939 set asinh d_asinh
10940 eval $inlibc
10941
10942 : see if atanh exists
10943 set atanh d_atanh
10944 eval $inlibc
10945
10946 : see if atolf exists
10947 set atolf d_atolf
10948 eval $inlibc
10949
10950 : see if atoll exists
10951 set atoll d_atoll
10952 eval $inlibc
10953
10954 : Look for GCC-style attribute format
10955 case "$d_attribute_format" in
10956 '')
10957 echo " "
10958 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10959 $cat >attrib.c <<'EOCP'
10960 #include <stdio.h>
10961 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10962 EOCP
10963 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10964         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10965                 echo "Your C compiler doesn't support __attribute__((format))."
10966                 val="$undef"
10967         else
10968                 echo "Your C compiler supports __attribute__((format))."
10969                 val="$define"
10970         fi
10971 else
10972         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10973         val="$undef"
10974 fi
10975 ;;
10976 *) val="$d_attribute_format" ;;
10977 esac
10978 set d_attribute_format
10979 eval $setvar
10980 $rm -f attrib*
10981
10982 : Look for GCC-style attribute format with null format allowed
10983 case "$d_printf_format_null" in
10984 '') case "$d_attribute_format" in
10985     $define)
10986         echo " "
10987         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10988 $cat >attrib.c <<EOCP
10989 #include <stdio.h>
10990 #$i_stdlib I_STDLIB
10991 #ifdef I_STDLIB
10992 #include <stdlib.h>
10993 #endif
10994 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10995 int null_printf (char* pat,...) { return (int)pat; }
10996 int main () { exit(null_printf(NULL)); }
10997 EOCP
10998         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10999             : run the executable in case it produces a run-time warning
11000             if $run ./attrib >>attrib.out 2>&1; then
11001                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11002                     echo "Your C compiler doesn't allow __printf__ format to be null."
11003                     val="$undef"
11004                 else
11005                     echo "Your C compiler allows __printf__ format to be null."
11006                     val="$define"
11007                 fi
11008             else
11009             echo "Your C compiler executable failed with __printf__ format null."
11010             val="$undef"
11011         fi
11012     else
11013         echo "Your C compiler fails with __printf__ format null."
11014         val="$undef"
11015     fi
11016     ;;
11017     *)  val="$undef" ;;
11018     esac
11019 ;;
11020 *)  val="$d_printf_format_null" ;;
11021 esac
11022 set d_printf_format_null
11023 eval $setvar
11024 $rm -f attrib*
11025
11026 : Look for GCC-style attribute malloc
11027 case "$d_attribute_malloc" in
11028 '')
11029 echo " "
11030 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11031 $cat >attrib.c <<'EOCP'
11032 #include <stdio.h>
11033 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11034 EOCP
11035 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11036         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11037                 echo "Your C compiler doesn't support __attribute__((malloc))."
11038                 val="$undef"
11039         else
11040                 echo "Your C compiler supports __attribute__((malloc))."
11041                 val="$define"
11042         fi
11043 else
11044         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11045         val="$undef"
11046 fi
11047 ;;
11048 *) val="$d_attribute_malloc" ;;
11049 esac
11050 set d_attribute_malloc
11051 eval $setvar
11052 $rm -f attrib*
11053
11054 : Look for GCC-style attribute nonnull
11055 case "$d_attribute_nonnull" in
11056 '')
11057 echo " "
11058 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11059 $cat >attrib.c <<'EOCP'
11060 #include <stdio.h>
11061 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11062 EOCP
11063 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11064         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11065                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11066                 val="$undef"
11067         else
11068                 echo "Your C compiler supports __attribute__((nonnull))."
11069                 val="$define"
11070         fi
11071 else
11072         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11073         val="$undef"
11074 fi
11075 ;;
11076 *) val="$d_attribute_nonnull" ;;
11077 esac
11078 set d_attribute_nonnull
11079 eval $setvar
11080 $rm -f attrib*
11081
11082 : Look for GCC-style attribute noreturn
11083 case "$d_attribute_noreturn" in
11084 '')
11085 echo " "
11086 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11087 $cat >attrib.c <<'EOCP'
11088 #include <stdio.h>
11089 void fall_over_dead( void ) __attribute__((noreturn));
11090 EOCP
11091 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11092         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11093                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11094                 val="$undef"
11095         else
11096                 echo "Your C compiler supports __attribute__((noreturn))."
11097                 val="$define"
11098         fi
11099 else
11100         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11101         val="$undef"
11102 fi
11103 ;;
11104 *) val="$d_attribute_noreturn" ;;
11105 esac
11106 set d_attribute_noreturn
11107 eval $setvar
11108 $rm -f attrib*
11109
11110 : Look for GCC-style attribute pure
11111 case "$d_attribute_pure" in
11112 '')
11113 echo " "
11114 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11115 $cat >attrib.c <<'EOCP'
11116 #include <stdio.h>
11117 int square( int n ) __attribute__((pure));
11118 EOCP
11119 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11120         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11121                 echo "Your C compiler doesn't support __attribute__((pure))."
11122                 val="$undef"
11123         else
11124                 echo "Your C compiler supports __attribute__((pure))."
11125                 val="$define"
11126         fi
11127 else
11128         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11129         val="$undef"
11130 fi
11131 ;;
11132 *) val="$d_attribute_pure" ;;
11133 esac
11134 set d_attribute_pure
11135 eval $setvar
11136 $rm -f attrib*
11137
11138 : Look for GCC-style attribute unused
11139 case "$d_attribute_unused" in
11140 '')
11141 echo " "
11142 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11143 $cat >attrib.c <<'EOCP'
11144 #include <stdio.h>
11145 int do_something( int dummy __attribute__((unused)), int n );
11146 EOCP
11147 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11148         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11149                 echo "Your C compiler doesn't support __attribute__((unused))."
11150                 val="$undef"
11151         else
11152                 echo "Your C compiler supports __attribute__((unused))."
11153                 val="$define"
11154         fi
11155 else
11156         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11157         val="$undef"
11158 fi
11159 ;;
11160 *) val="$d_attribute_unused" ;;
11161 esac
11162 set d_attribute_unused
11163 eval $setvar
11164 $rm -f attrib*
11165
11166 : Look for GCC-style attribute deprecated
11167 case "$d_attribute_deprecated" in
11168 '')
11169 echo " "
11170 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11171 $cat >attrib.c <<'EOCP'
11172 #include <stdio.h>
11173 int I_am_deprecated(void) __attribute__((deprecated));
11174 EOCP
11175 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11176         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11177                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11178                 val="$undef"
11179         else
11180                 echo "Your C compiler supports __attribute__((deprecated))."
11181                 val="$define"
11182         fi
11183 else
11184         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11185         val="$undef"
11186 fi
11187 ;;
11188 *) val="$d_attribute_deprecated" ;;
11189 esac
11190 set d_attribute_deprecated
11191 eval $setvar
11192 $rm -f attrib*
11193
11194 : Look for GCC-style attribute warn_unused_result
11195 case "$d_attribute_warn_unused_result" in
11196 '')
11197 echo " "
11198 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11199 $cat >attrib.c <<'EOCP'
11200 #include <stdio.h>
11201 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11202 EOCP
11203 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11204         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11205                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11206                 val="$undef"
11207         else
11208                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11209                 val="$define"
11210         fi
11211 else
11212         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11213         val="$undef"
11214 fi
11215 ;;
11216 *) val="$d_attribute_warn_unused_result" ;;
11217 esac
11218 set d_attribute_warn_unused_result
11219 eval $setvar
11220 $rm -f attrib*
11221
11222 : see if getpgrp exists
11223 set getpgrp d_getpgrp
11224 eval $inlibc
11225
11226 case "$d_getpgrp" in
11227 "$define")
11228         echo " "
11229         echo "Checking to see which flavor of getpgrp is in use..."
11230         $cat >try.c <<EOP
11231 #$i_unistd I_UNISTD
11232 #include <sys/types.h>
11233 #ifdef I_UNISTD
11234 #  include <unistd.h>
11235 #endif
11236 #$i_stdlib I_STDLIB
11237 #ifdef I_STDLIB
11238 #include <stdlib.h>
11239 #endif
11240 int main()
11241 {
11242         if (getuid() == 0) {
11243                 printf("(I see you are running Configure as super-user...)\n");
11244                 setuid(1);
11245         }
11246 #ifdef TRY_BSD_PGRP
11247         if (getpgrp(1) == 0)
11248                 exit(0);
11249 #else
11250         if (getpgrp() > 0)
11251                 exit(0);
11252 #endif
11253         exit(1);
11254 }
11255 EOP
11256         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11257                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11258                 val="$define"
11259         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11260                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11261                 val="$undef"
11262         else
11263                 echo "I can't seem to compile and run the test program."
11264                 if ./usg; then
11265                         xxx="a USG one, i.e. you use getpgrp()."
11266                 else
11267                         # SVR4 systems can appear rather BSD-ish.
11268                         case "$i_unistd" in
11269                         $undef)
11270                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11271                                 val="$define"
11272                                 ;;
11273                         $define)
11274                                 xxx="probably a USG one, i.e. you use getpgrp()."
11275                                 val="$undef"
11276                                 ;;
11277                         esac
11278                 fi
11279                 echo "Assuming your getpgrp is $xxx" >&4
11280         fi
11281         ;;
11282 *) val="$undef";;
11283 esac
11284 set d_bsdgetpgrp
11285 eval $setvar
11286 $rm_try
11287
11288 : see if setpgrp exists
11289 set setpgrp d_setpgrp
11290 eval $inlibc
11291
11292 case "$d_setpgrp" in
11293 "$define")
11294         echo " "
11295         echo "Checking to see which flavor of setpgrp is in use..."
11296         $cat >try.c <<EOP
11297 #$i_unistd I_UNISTD
11298 #include <sys/types.h>
11299 #ifdef I_UNISTD
11300 #  include <unistd.h>
11301 #endif
11302 #$i_stdlib I_STDLIB
11303 #ifdef I_STDLIB
11304 #include <stdlib.h>
11305 #endif
11306 int main()
11307 {
11308         if (getuid() == 0) {
11309                 printf("(I see you are running Configure as super-user...)\n");
11310                 setuid(1);
11311         }
11312 #ifdef TRY_BSD_PGRP
11313         if (-1 == setpgrp(1, 1))
11314                 exit(0);
11315 #else
11316         if (setpgrp() != -1)
11317                 exit(0);
11318 #endif
11319         exit(1);
11320 }
11321 EOP
11322         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11323                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11324                 val="$define"
11325         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11326                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11327                 val="$undef"
11328         else
11329                 echo "(I can't seem to compile and run the test program.)"
11330                 if ./usg; then
11331                         xxx="a USG one, i.e. you use setpgrp()."
11332                 else
11333                         # SVR4 systems can appear rather BSD-ish.
11334                         case "$i_unistd" in
11335                         $undef)
11336                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11337                                 val="$define"
11338                                 ;;
11339                         $define)
11340                                 xxx="probably a USG one, i.e. you use setpgrp()."
11341                                 val="$undef"
11342                                 ;;
11343                         esac
11344                 fi
11345                 echo "Assuming your setpgrp is $xxx" >&4
11346         fi
11347         ;;
11348 *) val="$undef";;
11349 esac
11350 set d_bsdsetpgrp
11351 eval $setvar
11352 $rm_try
11353
11354 : Look for GCC-style __builtin_add_overflow
11355 case "$d_builtin_add_overflow" in
11356 '')
11357     echo " "
11358     echo "Checking whether your compiler can handle __builtin_add_overflow ..." >&4
11359     $cat >try.c <<'EOCP'
11360 int main(void) {
11361     const unsigned int uint_max = ~0u;
11362     int target_int = 0;
11363     if (__builtin_add_overflow(1, 2, &target_int) || target_int != 3) {
11364         return 1;
11365     }
11366     if (!__builtin_add_overflow((int)(uint_max >> 1), 1, &target_int)) {
11367         return 1;
11368     }
11369     if (!__builtin_add_overflow(uint_max, -1, &target_int)) {
11370         return 1;
11371     }
11372     return 0;
11373 }
11374 EOCP
11375     set try
11376     if eval $compile && $run ./try; then
11377         echo "Your C compiler supports __builtin_add_overflow."
11378         val="$define"
11379     else
11380         echo "Your C compiler doesn't seem to understand __builtin_add_overflow."
11381         val="$undef"
11382     fi
11383     ;;
11384 *) val="$d_builtin_add_overflow" ;;
11385 esac
11386
11387 set d_builtin_add_overflow
11388 eval $setvar
11389 $rm_try
11390
11391 : Look for GCC-style __builtin_sub_overflow
11392 case "$d_builtin_sub_overflow" in
11393 '')
11394     echo " "
11395     echo "Checking whether your compiler can handle __builtin_sub_overflow ..." >&4
11396     $cat >try.c <<'EOCP'
11397 int main(void) {
11398     const unsigned int uint_max = ~0u;
11399     int target_int = 0;
11400     if (__builtin_sub_overflow(1, -2, &target_int) || target_int != 3) {
11401         return 1;
11402     }
11403     if (!__builtin_sub_overflow(-(int)(uint_max >> 1), 2, &target_int)) {
11404         return 1;
11405     }
11406     if (!__builtin_sub_overflow(uint_max, 1, &target_int)) {
11407         return 1;
11408     }
11409     return 0;
11410 }
11411 EOCP
11412     set try
11413     if eval $compile && $run ./try; then
11414         echo "Your C compiler supports __builtin_sub_overflow."
11415         val="$define"
11416     else
11417         echo "Your C compiler doesn't seem to understand __builtin_sub_overflow."
11418         val="$undef"
11419     fi
11420     ;;
11421 *) val="$d_builtin_sub_overflow" ;;
11422 esac
11423
11424 set d_builtin_sub_overflow
11425 eval $setvar
11426 $rm_try
11427
11428 : Look for GCC-style __builtin_mul_overflow
11429 case "$d_builtin_mul_overflow" in
11430 '')
11431     echo " "
11432     echo "Checking whether your compiler can handle __builtin_mul_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_mul_overflow(2, 3, &target_int) || target_int != 6) {
11438         return 1;
11439     }
11440     if (!__builtin_mul_overflow((int)(uint_max >> 1), 2, &target_int)) {
11441         return 1;
11442     }
11443     if (!__builtin_mul_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_mul_overflow."
11452         val="$define"
11453     else
11454         echo "Your C compiler doesn't seem to understand __builtin_mul_overflow."
11455         val="$undef"
11456     fi
11457     ;;
11458 *) val="$d_builtin_mul_overflow" ;;
11459 esac
11460
11461 set d_builtin_mul_overflow
11462 eval $setvar
11463 $rm_try
11464
11465 : Look for GCC-style __builtin_choose_expr
11466 case "$d_builtin_choose_expr" in
11467 '')
11468     echo " "
11469     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11470     $cat >try.c <<'EOCP'
11471 #include <assert.h>
11472 #include <stdlib.h>
11473 #include <stdio.h>
11474
11475 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11476
11477 int main(void) {
11478     assert( SYRINX(1) == 2112 );
11479     assert( SYRINX(1) != 5150 );
11480     assert( SYRINX(0) == 5150 );
11481     assert( SYRINX(0) != 2112 );
11482     puts( "All good!" );
11483     exit(0);
11484 }
11485
11486 EOCP
11487     set try
11488     if eval $compile && $run ./try; then
11489         echo "Your C compiler supports __builtin_choose_expr."
11490         val="$define"
11491     else
11492         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11493         val="$undef"
11494     fi
11495 ;;
11496 *) val="$d_builtin_choose_expr" ;;
11497 esac
11498
11499 set d_builtin_choose_expr
11500 eval $setvar
11501 $rm_try
11502
11503 : Look for GCC-style __builtin_expect
11504 case "$d_builtin_expect" in
11505 '')
11506     echo " "
11507     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11508     $cat >try.c <<'EOCP'
11509 int main(void) {
11510     int n = 50;
11511     if ( __builtin_expect(n, 0) ) n = 1;
11512     /* Remember shell exit code truth is 0, C truth is non-zero */
11513     return !(n == 1);
11514 }
11515 EOCP
11516     set try
11517     if eval $compile && $run ./try; then
11518         echo "Your C compiler supports __builtin_expect."
11519         val="$define"
11520     else
11521         echo "Your C compiler doesn't seem to understand __builtin_expect."
11522         val="$undef"
11523     fi
11524     ;;
11525 *) val="$d_builtin_expect" ;;
11526 esac
11527
11528 set d_builtin_expect
11529 eval $setvar
11530 $rm_try
11531
11532 : see if the Compiler supports C99 variadic macros
11533 echo "Checking for C99 variadic macros." >&4
11534 $cat >try.c <<EOCP
11535 #include <stdio.h>
11536 #include <stdarg.h>
11537
11538 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11539
11540 int main() {
11541   char buf[20];
11542   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11543   puts(buf);
11544   return 0;
11545 }
11546 EOCP
11547 set try
11548 if eval $compile && $run ./try 2>&1 >/dev/null; then
11549     case "`$run ./try`" in
11550         "123 456 789")
11551         echo "You have C99 variadic macros." >&4
11552         d_c99_variadic_macros="$define"
11553         ;;
11554         *)
11555         echo "You don't have functional C99 variadic macros." >&4
11556         d_c99_variadic_macros="$undef"
11557         ;;
11558     esac
11559 else
11560     echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11561     d_c99_variadic_macros="$undef"
11562 fi
11563 $rm_try
11564
11565 : see if signal is declared as pointer to function returning int or void
11566 echo " "
11567 xxx=`./findhdr signal.h`
11568 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11569 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11570         echo "You have int (*signal())() instead of void." >&4
11571         val="$undef"
11572 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11573         echo "You have void (*signal())()." >&4
11574         val="$define"
11575 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11576         echo "You have int (*signal())() instead of void." >&4
11577         val="$undef"
11578 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11579         echo "You have void (*signal())()." >&4
11580         val="$define"
11581 else
11582         case "$d_voidsig" in
11583         '')
11584         echo "I can't determine whether signal handler returns void or int..." >&4
11585                 dflt=void
11586                 rp="What type does your signal handler return?"
11587                 . ./myread
11588                 case "$ans" in
11589                 v*) val="$define";;
11590                 *) val="$undef";;
11591                 esac;;
11592         "$define")
11593                 echo "As you already told me, signal handler returns void." >&4
11594                 val="$define"
11595                 ;;
11596         *)      echo "As you already told me, signal handler returns int." >&4
11597                 val="$undef"
11598                 ;;
11599         esac
11600 fi
11601 set d_voidsig
11602 eval $setvar
11603 case "$d_voidsig" in
11604 "$define") signal_t="void";;
11605 *) signal_t="int";;
11606 esac
11607 $rm -f $$.tmp
11608
11609 : check for ability to cast large floats to 32-bit ints.
11610 echo " "
11611 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11612 if $test "$intsize" -ge 4; then
11613         xxx=int
11614 else
11615         xxx=long
11616 fi
11617 $cat >try.c <<EOCP
11618 #include <stdio.h>
11619 #$i_stdlib I_STDLIB
11620 #ifdef I_STDLIB
11621 #include <stdlib.h>
11622 #endif
11623 #include <sys/types.h>
11624 #include <signal.h>
11625 $signal_t blech(int s) { exit(3); }
11626 int main()
11627 {
11628         $xxx i32;
11629         double f, g;
11630         int result = 0;
11631         char str[16];
11632         signal(SIGFPE, blech);
11633
11634         /* Don't let compiler optimize the test away.  Store the number
11635            in a writable string for gcc to pass to sscanf under HP-UX.
11636         */
11637         sprintf(str, "2147483647");
11638         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11639         g = 10 * f;
11640         i32  = ($xxx) g;
11641
11642         /* x86 processors will probably give 0x8000 0000, which is a
11643            sign change.  We don't want that.  We want to mimic SPARC
11644            behavior here, which is to preserve the sign and give
11645            back 0x7fff ffff.
11646         */
11647         if (i32 != ($xxx) f)
11648                 result |= 1;
11649         exit(result);
11650 }
11651 EOCP
11652 set try
11653 if eval $compile_ok; then
11654         $run ./try 2>/dev/null
11655         yyy=$?
11656 else
11657         echo "(I can't seem to compile the test program--assuming it can't)"
11658         yyy=1
11659 fi
11660 case "$yyy" in
11661 0)      val="$define"
11662         echo "Yup, it can."
11663         ;;
11664 *)      val="$undef"
11665         echo "Nope, it can't."
11666         ;;
11667 esac
11668 set d_casti32
11669 eval $setvar
11670 $rm_try
11671
11672 : check for ability to cast negative floats to unsigned
11673 echo " "
11674 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11675 $cat >try.c <<EOCP
11676 #include <stdio.h>
11677 #$i_stdlib I_STDLIB
11678 #ifdef I_STDLIB
11679 #include <stdlib.h>
11680 #endif
11681 #include <sys/types.h>
11682 #include <signal.h>
11683 $signal_t blech(int s) { exit(7); }
11684 $signal_t blech_in_list(int s) { exit(4); }
11685 unsigned long dummy_long(unsigned long p) { return p; }
11686 unsigned int dummy_int(unsigned int p) { return p; }
11687 unsigned short dummy_short(unsigned short p) { return p; }
11688 int main()
11689 {
11690         double f;
11691         unsigned long along;
11692         unsigned int aint;
11693         unsigned short ashort;
11694         int result = 0;
11695         char str[16];
11696
11697         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11698            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11699            optimized the whole file away
11700         */
11701         /* Store the number in a writable string for gcc to pass to
11702            sscanf under HP-UX.
11703         */
11704         sprintf(str, "-123");
11705         sscanf(str, "%lf", &f);  /* f = -123.; */
11706
11707         signal(SIGFPE, blech);
11708         along = (unsigned long)f;
11709         aint = (unsigned int)f;
11710         ashort = (unsigned short)f;
11711         if (along != (unsigned long)-123)
11712                 result |= 1;
11713         if (aint != (unsigned int)-123)
11714                 result |= 1;
11715         if (ashort != (unsigned short)-123)
11716                 result |= 1;
11717         sprintf(str, "1073741824.");
11718         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11719         f = f + f;
11720         along = 0;
11721         along = (unsigned long)f;
11722         if (along != 0x80000000)
11723                 result |= 2;
11724         f -= 1.;
11725         along = 0;
11726         along = (unsigned long)f;
11727         if (along != 0x7fffffff)
11728                 result |= 1;
11729         f += 2.;
11730         along = 0;
11731         along = (unsigned long)f;
11732         if (along != 0x80000001)
11733                 result |= 2;
11734         if (result)
11735                 exit(result);
11736         signal(SIGFPE, blech_in_list);
11737         sprintf(str, "123.");
11738         sscanf(str, "%lf", &f);  /* f = 123.; */
11739         along = dummy_long((unsigned long)f);
11740         aint = dummy_int((unsigned int)f);
11741         ashort = dummy_short((unsigned short)f);
11742         if (along != (unsigned long)123)
11743                 result |= 4;
11744         if (aint != (unsigned int)123)
11745                 result |= 4;
11746         if (ashort != (unsigned short)123)
11747                 result |= 4;
11748         exit(result);
11749
11750 }
11751 EOCP
11752 set try
11753 if eval $compile_ok; then
11754         $run ./try 2>/dev/null
11755         castflags=$?
11756 else
11757         echo "(I can't seem to compile the test program--assuming it can't)"
11758         castflags=7
11759 fi
11760 case "$castflags" in
11761 0)      val="$define"
11762         echo "Yup, it can."
11763         ;;
11764 *)      val="$undef"
11765         echo "Nope, it can't."
11766         ;;
11767 esac
11768 set d_castneg
11769 eval $setvar
11770 $rm_try
11771
11772 : see if cbrt exists
11773 set cbrt d_cbrt
11774 eval $inlibc
11775
11776 : see if chown exists
11777 set chown d_chown
11778 eval $inlibc
11779
11780 : see if chroot exists
11781 set chroot d_chroot
11782 eval $inlibc
11783
11784 : see if chsize exists
11785 set chsize d_chsize
11786 eval $inlibc
11787
11788 : see if class exists
11789 set class d_class
11790 eval $inlibc
11791
11792 : see if clearenv exists
11793 set clearenv d_clearenv
11794 eval $inlibc
11795
11796 : Define hasstruct macro for Configure internal use
11797 hasstruct='varname=$1; struct=$2; shift; shift;
11798 while $test $# -ge 2; do
11799         case "$1" in
11800         $define) echo "#include <$2>";;
11801         esac ;
11802     shift 2;
11803 done > try.c;
11804 echo "int main () { struct $struct foo; }" >> try.c;
11805 set try;
11806 if eval $compile; then
11807         val="$define";
11808 else
11809         val="$undef";
11810 fi;
11811 set $varname;
11812 eval $setvar;
11813 $rm_try'
11814
11815 : see whether socket exists
11816 socketlib=''
11817 sockethdr=''
11818 echo " "
11819 $echo $n "Hmm... $c" >&4
11820 if set socket val -f d_socket; eval $csym; $val; then
11821     echo "Looks like you have Berkeley networking support." >&4
11822     d_socket="$define"
11823     if set setsockopt val -f; eval $csym; $val; then
11824         d_oldsock="$undef"
11825     else
11826         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11827         d_oldsock="$define"
11828     fi
11829 else
11830     if $contains socklib libc.list >/dev/null 2>&1; then
11831         echo "Looks like you have Berkeley networking support." >&4
11832         d_socket="$define"
11833         : we will have to assume that it supports the 4.2 BSD interface
11834         d_oldsock="$undef"
11835     else
11836         echo "You don't have Berkeley networking in libc$_a..." >&4
11837         if test "X$d_socket" = "X$define"; then
11838             echo "...but you seem to believe that you have sockets." >&4
11839         else
11840             for net in net socket
11841             do
11842                 if test -f $sysroot/usr/lib/lib$net$_a; then
11843                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11844                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11845                     if $contains socket libc.list >/dev/null 2>&1; then
11846                         d_socket="$define"
11847                         socketlib="-l$net"
11848                         case "$net" in
11849                         net)
11850                             echo "...but the Wollongong group seems to have hacked it in." >&4
11851                             sockethdr="-I$sysroot/usr/netinclude"
11852                             ;;
11853                         esac
11854                         echo "Found Berkeley sockets interface in lib$net." >&4
11855                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11856                             d_oldsock="$undef"
11857                         else
11858                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11859                             d_oldsock="$define"
11860                         fi
11861                         break
11862                     fi
11863                 fi
11864             done
11865             if test "X$d_socket" != "X$define"; then
11866                echo "or anywhere else I see." >&4
11867                d_socket="$undef"
11868                d_oldsock="$undef"
11869             fi
11870         fi
11871     fi
11872 fi
11873
11874 : see if socketpair exists
11875 set socketpair d_sockpair
11876 eval $inlibc
11877
11878
11879 echo " "
11880 echo "Checking the availability sa_len in the sock struct ..." >&4
11881 $cat >try.c <<EOF
11882 #include <sys/types.h>
11883 #include <sys/socket.h>
11884 int main() {
11885 struct sockaddr sa;
11886 return (sa.sa_len);
11887 }
11888 EOF
11889 val="$undef"
11890 set try; if eval $compile; then
11891     val="$define"
11892 fi
11893 set d_sockaddr_sa_len; eval $setvar
11894 $rm_try
11895
11896 echo " "
11897 echo "Checking the availability struct sockaddr_in6 ..." >&4
11898 $cat >try.c <<EOF
11899 #include <sys/types.h>
11900 #include <sys/socket.h>
11901 #include <netinet/in.h>
11902 int main() {
11903 struct sockaddr_in6 sin6;
11904 return (sin6.sin6_family);
11905 }
11906 EOF
11907 val="$undef"
11908 set try; if eval $compile; then
11909     val="$define"
11910 fi
11911 set d_sockaddr_in6; eval $setvar
11912 $rm_try
11913
11914 echo " "
11915 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11916 $cat >try.c <<EOF
11917 #include <sys/types.h>
11918 #include <sys/socket.h>
11919 #include <netinet/in.h>
11920 int main() {
11921 struct sockaddr_in6 sin6;
11922 return (sin6.sin6_scope_id);
11923 }
11924 EOF
11925 val="$undef"
11926 set try; if eval $compile; then
11927     val="$define"
11928 fi
11929 set d_sin6_scope_id; eval $setvar
11930 $rm_try
11931
11932 echo " "
11933 echo "Checking the availability struct ip_mreq ..." >&4
11934 $cat >try.c <<EOF
11935 #include <sys/types.h>
11936 #include <sys/socket.h>
11937 #include <netinet/in.h>
11938 int main() {
11939 struct ip_mreq mreq;
11940 return (mreq.imr_multiaddr.s_addr);
11941 }
11942 EOF
11943 val="$undef"
11944 set try; if eval $compile; then
11945        val="$define"
11946 fi
11947 set d_ip_mreq; eval $setvar
11948 $rm_try
11949
11950 echo " "
11951 echo "Checking the availability struct ip_mreq_source ..." >&4
11952 $cat >try.c <<EOF
11953 #include <sys/types.h>
11954 #include <sys/socket.h>
11955 #include <netinet/in.h>
11956 int main() {
11957 struct ip_mreq_source mreq;
11958 return (mreq.imr_multiaddr.s_addr);
11959 }
11960 EOF
11961 val="$undef"
11962 set try; if eval $compile; then
11963        val="$define"
11964 fi
11965 set d_ip_mreq_source; eval $setvar
11966 $rm_try
11967
11968 echo " "
11969 echo "Checking the availability struct ipv6_mreq ..." >&4
11970 $cat >try.c <<EOF
11971 #include <sys/types.h>
11972 #include <sys/socket.h>
11973 #include <netinet/in.h>
11974 int main() {
11975 struct ipv6_mreq mreq;
11976 return (mreq.ipv6mr_interface);
11977 }
11978 EOF
11979 val="$undef"
11980 set try; if eval $compile; then
11981     val="$define"
11982 fi
11983 set d_ipv6_mreq; eval $setvar
11984 $rm_try
11985
11986 echo " "
11987 echo "Checking the availability struct ipv6_mreq_source ..." >&4
11988 $cat >try.c <<EOF
11989 #include <sys/types.h>
11990 #include <sys/socket.h>
11991 #include <netinet/in.h>
11992 int main() {
11993 struct ipv6_mreq_source mreq;
11994 return (mreq.imr_multiaddr.s_addr);
11995 }
11996 EOF
11997 val="$undef"
11998 set try; if eval $compile; then
11999        val="$define"
12000 fi
12001 set d_ipv6_mreq_source; eval $setvar
12002 $rm_try
12003
12004 echo " "
12005 echo "Checking the availability of certain socket constants..." >&4
12006 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12007     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12008     $cat >try.c <<EOF
12009 #include <sys/types.h>
12010 #include <sys/socket.h>
12011 int main() {
12012     int i = $ENUM;
12013 }
12014 EOF
12015     val="$undef"
12016     set try; if eval $compile; then
12017         val="$define"
12018     fi
12019     set d_${enum}; eval $setvar
12020     $rm_try
12021 done
12022
12023 : see if this is a sys/uio.h system
12024 set sys/uio.h i_sysuio
12025 eval $inhdr
12026
12027 : Check for cmsghdr support
12028 echo " "
12029 echo "Checking to see if your system supports struct cmsghdr..." >&4
12030 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12031 eval $hasstruct
12032 case "$d_cmsghdr_s" in
12033 "$define")      echo "Yes, it does."   ;;
12034 *)              echo "No, it doesn't." ;;
12035 esac
12036
12037
12038 : check for const keyword
12039 echo " "
12040 echo 'Checking to see if your C compiler knows about "const"...' >&4
12041 $cat >const.c <<'EOCP'
12042 typedef struct spug { int drokk; } spug;
12043 int main()
12044 {
12045         const char *foo;
12046         const spug y = { 0 };
12047 }
12048 EOCP
12049 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
12050         val="$define"
12051         echo "Yup, it does."
12052 else
12053         val="$undef"
12054         echo "Nope, it doesn't."
12055 fi
12056 set d_const
12057 eval $setvar
12058
12059 : see if copysign exists
12060 set copysign d_copysign
12061 eval $inlibc
12062
12063 : see if copysignl exists
12064 set copysignl d_copysignl
12065 eval $inlibc
12066
12067 : see if crypt exists
12068 echo " "
12069 set crypt d_crypt
12070 eval $inlibc
12071 case "$d_crypt" in
12072 $define) cryptlib='' ;;
12073 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12074                 echo 'crypt() found.' >&4
12075                 val="$define"
12076                 cryptlib=''
12077         else
12078                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12079                 if $test -z "$cryptlib"; then
12080                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12081                 else
12082                         cryptlib=-lcrypt
12083                 fi
12084                 if $test -z "$cryptlib"; then
12085                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12086                 else
12087                         cryptlib=-lcrypt
12088                 fi
12089                 if $test -z "$cryptlib"; then
12090                         cryptlib=`./loc libcrypt$_a "" $libpth`
12091                 else
12092                         cryptlib=-lcrypt
12093                 fi
12094                 if $test -z "$cryptlib"; then
12095                         echo 'crypt() NOT found.' >&4
12096                         val="$undef"
12097                 else
12098                         val="$define"
12099                 fi
12100         fi
12101         set d_crypt
12102         eval $setvar
12103         ;;
12104 esac
12105
12106 : see if this is a crypt.h system
12107 set crypt.h i_crypt
12108 eval $inhdr
12109
12110 : see if crypt_r exists
12111 set crypt_r d_crypt_r
12112 eval $inlibc
12113 case "$d_crypt_r" in
12114 "$define")
12115         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12116         case "$d_crypt_r_proto:$usethreads" in
12117         ":define")      d_crypt_r_proto=define
12118                 set d_crypt_r_proto crypt_r $hdrs
12119                 eval $hasproto ;;
12120         *)      ;;
12121         esac
12122         case "$d_crypt_r_proto" in
12123         define)
12124         case "$crypt_r_proto" in
12125         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12126         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12127         esac
12128         case "$crypt_r_proto" in
12129         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12130         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12131         esac
12132         case "$crypt_r_proto" in
12133         ''|0)   d_crypt_r=undef
12134                 crypt_r_proto=0
12135                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12136         * )     case "$crypt_r_proto" in
12137                 REENTRANT_PROTO*) ;;
12138                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12139                 esac
12140                 echo "Prototype: $try" ;;
12141         esac
12142         ;;
12143         *)      case "$usethreads" in
12144                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12145                 esac
12146                 d_crypt_r=undef
12147                 crypt_r_proto=0
12148                 ;;
12149         esac
12150         ;;
12151 *)      crypt_r_proto=0
12152         ;;
12153 esac
12154
12155 : get csh whereabouts
12156 case "$csh" in
12157 'csh') val="$undef" ;;
12158 *) val="$define" ;;
12159 esac
12160 set d_csh
12161 eval $setvar
12162 : Respect a hint or command line value for full_csh.
12163 case "$full_csh" in
12164 '') full_csh=$csh ;;
12165 esac
12166
12167 : see if ctermid exists
12168 set ctermid d_ctermid
12169 eval $inlibc
12170
12171 : see if ctermid_r exists
12172 set ctermid_r d_ctermid_r
12173 eval $inlibc
12174 case "$d_ctermid_r" in
12175 "$define")
12176         hdrs="$i_systypes sys/types.h define stdio.h "
12177         case "$d_ctermid_r_proto:$usethreads" in
12178         ":define")      d_ctermid_r_proto=define
12179                 set d_ctermid_r_proto ctermid_r $hdrs
12180                 eval $hasproto ;;
12181         *)      ;;
12182         esac
12183         case "$d_ctermid_r_proto" in
12184         define)
12185         case "$ctermid_r_proto" in
12186         ''|0) try='char* ctermid_r(char*);'
12187         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12188         esac
12189         case "$ctermid_r_proto" in
12190         ''|0)   d_ctermid_r=undef
12191                 ctermid_r_proto=0
12192                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12193         * )     case "$ctermid_r_proto" in
12194                 REENTRANT_PROTO*) ;;
12195                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12196                 esac
12197                 echo "Prototype: $try" ;;
12198         esac
12199         ;;
12200         *)      case "$usethreads" in
12201                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12202                 esac
12203                 d_ctermid_r=undef
12204                 ctermid_r_proto=0
12205                 ;;
12206         esac
12207         ;;
12208 *)      ctermid_r_proto=0
12209         ;;
12210 esac
12211
12212 : see if ctime_r exists
12213 set ctime_r d_ctime_r
12214 eval $inlibc
12215 case "$d_ctime_r" in
12216 "$define")
12217         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12218         case "$d_ctime_r_proto:$usethreads" in
12219         ":define")      d_ctime_r_proto=define
12220                 set d_ctime_r_proto ctime_r $hdrs
12221                 eval $hasproto ;;
12222         *)      ;;
12223         esac
12224         case "$d_ctime_r_proto" in
12225         define)
12226         case "$ctime_r_proto" in
12227         ''|0) try='char* ctime_r(const time_t*, char*);'
12228         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12229         esac
12230         case "$ctime_r_proto" in
12231         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12232         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12233         esac
12234         case "$ctime_r_proto" in
12235         ''|0) try='int ctime_r(const time_t*, char*);'
12236         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12237         esac
12238         case "$ctime_r_proto" in
12239         ''|0) try='int ctime_r(const time_t*, char*, int);'
12240         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12241         esac
12242         case "$ctime_r_proto" in
12243         ''|0)   d_ctime_r=undef
12244                 ctime_r_proto=0
12245                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12246         * )     case "$ctime_r_proto" in
12247                 REENTRANT_PROTO*) ;;
12248                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12249                 esac
12250                 echo "Prototype: $try" ;;
12251         esac
12252         ;;
12253         *)      case "$usethreads" in
12254                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12255                 esac
12256                 d_ctime_r=undef
12257                 ctime_r_proto=0
12258                 ;;
12259         esac
12260         ;;
12261 *)      ctime_r_proto=0
12262         ;;
12263 esac
12264
12265 : see if cuserid exists
12266 set cuserid d_cuserid
12267 eval $inlibc
12268
12269 : see if dbm.h is available
12270 : see if dbmclose exists
12271 set dbmclose d_dbmclose
12272 eval $inlibc
12273
12274 case "$d_dbmclose" in
12275 $define)
12276         set dbm.h i_dbm
12277         eval $inhdr
12278         case "$i_dbm" in
12279         $define)
12280                 val="$undef"
12281                 set i_rpcsvcdbm
12282                 eval $setvar
12283                 ;;
12284         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12285                 eval $inhdr
12286                 ;;
12287         esac
12288         ;;
12289 *)      echo "We won't be including <dbm.h>"
12290         val="$undef"
12291         set i_dbm
12292         eval $setvar
12293         val="$undef"
12294         set i_rpcsvcdbm
12295         eval $setvar
12296         ;;
12297 esac
12298
12299 : see if prototype for dbminit is available
12300 echo " "
12301 set d_dbminitproto dbminit $i_dbm dbm.h
12302 eval $hasproto
12303
12304 : see if difftime exists
12305 set difftime d_difftime
12306 eval $inlibc
12307
12308 : see if this is a dirent system
12309 echo " "
12310 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12311         val="$define"
12312         echo "<dirent.h> found." >&4
12313 else
12314         val="$undef"
12315         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12316                 echo "<sys/dir.h> found." >&4
12317                 echo " "
12318         else
12319                 xinc=`./findhdr sys/ndir.h`
12320         fi
12321         echo "<dirent.h> NOT found." >&4
12322 fi
12323 set i_dirent
12324 eval $setvar
12325
12326 : Look for type of directory structure.
12327 echo " "
12328 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12329
12330 case "$direntrytype" in
12331 ''|' ')
12332         case "$i_dirent" in
12333         $define) guess1='struct dirent' ;;
12334         *) guess1='struct direct'  ;;
12335         esac
12336         ;;
12337 *)      guess1="$direntrytype"
12338         ;;
12339 esac
12340
12341 case "$guess1" in
12342 'struct dirent') guess2='struct direct' ;;
12343 *) guess2='struct dirent' ;;
12344 esac
12345
12346 if $contains "$guess1" try.c >/dev/null 2>&1; then
12347         direntrytype="$guess1"
12348         echo "Your directory entries are $direntrytype." >&4
12349 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12350         direntrytype="$guess2"
12351         echo "Your directory entries seem to be $direntrytype." >&4
12352 else
12353         echo "I don't recognize your system's directory entries." >&4
12354         rp="What type is used for directory entries on this system?"
12355         dflt="$guess1"
12356         . ./myread
12357         direntrytype="$ans"
12358 fi
12359 $rm_try
12360
12361 : see if the directory entry stores field length
12362 echo " "
12363 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12364 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12365         echo "Good, your directory entry keeps length information in d_namlen." >&4
12366         val="$define"
12367 else
12368         echo "Your directory entry does not know about the d_namlen field." >&4
12369         val="$undef"
12370 fi
12371 set d_dirnamlen
12372 eval $setvar
12373 $rm_try
12374
12375 : Look for DIR.dd_fd
12376 case "$i_dirent" in
12377 "$define")
12378     echo "Checking to see if DIR has a dd_fd member variable" >&4
12379     $cat >try.c <<EOCP
12380 #$i_stdlib I_STDLIB
12381 #ifdef I_STDLIB
12382 #include <stdlib.h>
12383 #endif
12384 #include <dirent.h>
12385
12386 int main() {
12387     DIR dir;
12388     dir.dd_fd = 1;
12389     return 0;
12390 }
12391 EOCP
12392     val=$undef
12393     set try
12394     if eval $compile; then
12395         echo "Yes, it does."
12396         val="$define"
12397     else
12398         echo "No, it does not."
12399         val="$undef"
12400     fi
12401     ;;
12402 *)
12403     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12404     val="$undef"
12405     ;;
12406 esac
12407 set d_dir_dd_fd
12408 eval $setvar
12409 $rm_try
12410
12411 : see if this is an sysdir system
12412 set sys/dir.h i_sysdir
12413 eval $inhdr
12414
12415 : see if this is an sysndir system
12416 set sys/ndir.h i_sysndir
12417 eval $inhdr
12418
12419 : Look for dirfd
12420 echo " "
12421 $cat >dirfd.c <<EOM
12422 #include <stdio.h>
12423 #$i_stdlib I_STDLIB
12424 #ifdef I_STDLIB
12425 #include <stdlib.h>
12426 #endif
12427 #$i_dirent I_DIRENT             /**/
12428 #$i_sysdir I_SYS_DIR            /**/
12429 #$i_sysndir I_SYS_NDIR          /**/
12430 #$i_systypes I_SYS_TYPES        /**/
12431 #if defined(I_SYS_TYPES)
12432 #include <sys/types.h>
12433 #endif
12434 #if defined(I_DIRENT)
12435 #include <dirent.h>
12436 #else
12437 #ifdef I_SYS_NDIR
12438 #include <sys/ndir.h>
12439 #else
12440 #ifdef I_SYS_DIR
12441 #include <sys/dir.h>
12442 #endif
12443 #endif
12444 #endif
12445 int main() {
12446         DIR *dirp = opendir(".");
12447         if (dirfd(dirp) >= 0)
12448                 exit(0);
12449         else
12450                 exit(1);
12451 }
12452 EOM
12453 val=$undef
12454 set dirfd
12455 if eval $compile; then
12456         val="$define"
12457 fi
12458 case "$val" in
12459 $define)        echo "dirfd() found." >&4       ;;
12460 *)              echo "dirfd() NOT found." >&4   ;;
12461 esac
12462 set d_dirfd
12463 eval $setvar
12464 $rm -f dirfd*
12465
12466 : see if dladdr exists
12467 set dladdr d_dladdr
12468 eval $inlibc
12469
12470 : see if dlerror exists
12471 xxx_runnm="$runnm"
12472 runnm=false
12473 set dlerror d_dlerror
12474 eval $inlibc
12475 runnm="$xxx_runnm"
12476
12477 : see if dlfcn is available
12478 set dlfcn.h i_dlfcn
12479 eval $inhdr
12480
12481 : Check what extension to use for shared libs
12482 case "$usedl" in
12483 $define|y|true)
12484         $cat << EOM
12485
12486 On a few systems, the dynamically loaded modules that perl generates and uses
12487 will need a different extension than shared libs. The default will probably
12488 be appropriate.
12489
12490 EOM
12491         case "$dlext" in
12492         '')     dflt="$so" ;;
12493         *)      dflt="$dlext" ;;
12494         esac
12495         rp='What is the extension of dynamically loaded modules'
12496         . ./myread
12497         dlext="$ans"
12498         ;;
12499 *)
12500         dlext="none"
12501         ;;
12502 esac
12503
12504 : Check if dlsym need a leading underscore
12505 echo " "
12506 val="$undef"
12507
12508 case "$dlsrc" in
12509 dl_dlopen.xs)
12510         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12511         $cat >dyna.c <<'EOM'
12512 fred () { }
12513 EOM
12514
12515 $cat >fred.c<<EOM
12516
12517 #include <stdio.h>
12518 #$i_stdlib I_STDLIB
12519 #ifdef I_STDLIB
12520 #include <stdlib.h>
12521 #endif
12522 #$i_dlfcn I_DLFCN
12523 #ifdef I_DLFCN
12524 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12525 #else
12526 #include <sys/types.h>
12527 #include <nlist.h>
12528 #include <link.h>
12529 #endif
12530
12531 extern int fred() ;
12532
12533 int main()
12534 {
12535     void * handle ;
12536     void * symbol ;
12537 #ifndef RTLD_LAZY
12538     int mode = 1 ;
12539 #else
12540     int mode = RTLD_LAZY ;
12541 #endif
12542     handle = dlopen("./dyna.$dlext", mode) ;
12543     if (handle == NULL) {
12544         printf ("1\n") ;
12545         fflush (stdout) ;
12546         exit(0);
12547     }
12548     symbol = dlsym(handle, "fred") ;
12549     if (symbol == NULL) {
12550         /* try putting a leading underscore */
12551         symbol = dlsym(handle, "_fred") ;
12552         if (symbol == NULL) {
12553             printf ("2\n") ;
12554             fflush (stdout) ;
12555             exit(0);
12556         }
12557         printf ("3\n") ;
12558     }
12559     else
12560         printf ("4\n") ;
12561     fflush (stdout) ;
12562     exit(0);
12563 }
12564 EOM
12565         : Call the object file tmp-dyna.o in case dlext=o.
12566         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12567                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12568                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12569                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12570                 xxx=`$run ./fred`
12571                 case $xxx in
12572                 1)      echo "Test program failed using dlopen." >&4
12573                         echo "Perhaps you should not use dynamic loading." >&4;;
12574                 2)      echo "Test program failed using dlsym." >&4
12575                         echo "Perhaps you should not use dynamic loading." >&4;;
12576                 3)      echo "dlsym needs a leading underscore" >&4
12577                         val="$define" ;;
12578                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12579                 esac
12580         else
12581                 echo "I can't compile and run the test program." >&4
12582                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12583         fi
12584         ;;
12585 esac
12586
12587 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12588
12589 set d_dlsymun
12590 eval $setvar
12591
12592 : see if drand48_r exists
12593 set drand48_r d_drand48_r
12594 eval $inlibc
12595 case "$d_drand48_r" in
12596 "$define")
12597         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12598         case "$d_drand48_r_proto:$usethreads" in
12599         ":define")      d_drand48_r_proto=define
12600                 set d_drand48_r_proto drand48_r $hdrs
12601                 eval $hasproto ;;
12602         *)      ;;
12603         esac
12604         case "$d_drand48_r_proto" in
12605         define)
12606         case "$drand48_r_proto" in
12607         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12608         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12609         esac
12610         case "$drand48_r_proto" in
12611         ''|0)   d_drand48_r=undef
12612                 drand48_r_proto=0
12613                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12614         * )     case "$drand48_r_proto" in
12615                 REENTRANT_PROTO*) ;;
12616                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12617                 esac
12618                 echo "Prototype: $try" ;;
12619         esac
12620         ;;
12621         *)      case "$usethreads" in
12622                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12623                 esac
12624                 d_drand48_r=undef
12625                 drand48_r_proto=0
12626                 ;;
12627         esac
12628         ;;
12629 *)      drand48_r_proto=0
12630         ;;
12631 esac
12632
12633 : see if prototype for drand48 is available
12634 echo " "
12635 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12636 eval $hasproto
12637
12638 : see if dup2 exists
12639 set dup2 d_dup2
12640 eval $inlibc
12641
12642 : see if eaccess exists
12643 set eaccess d_eaccess
12644 eval $inlibc
12645
12646 : see if endgrent exists
12647 set endgrent d_endgrent
12648 eval $inlibc
12649
12650 : see if this is an grp system
12651 set grp.h i_grp
12652 eval $inhdr
12653
12654 case "$i_grp" in
12655 $define)
12656         xxx=`./findhdr grp.h`
12657         $cppstdin $cppflags $cppminus < $xxx >$$.h
12658
12659         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12660                 val="$define"
12661         else
12662                 val="$undef"
12663         fi
12664         set d_grpasswd
12665         eval $setvar
12666
12667         $rm -f $$.h
12668         ;;
12669 *)
12670         val="$undef";
12671         set d_grpasswd; eval $setvar
12672         ;;
12673 esac
12674
12675 : see if endgrent_r exists
12676 set endgrent_r d_endgrent_r
12677 eval $inlibc
12678 case "$d_endgrent_r" in
12679 "$define")
12680         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12681         case "$d_endgrent_r_proto:$usethreads" in
12682         ":define")      d_endgrent_r_proto=define
12683                 set d_endgrent_r_proto endgrent_r $hdrs
12684                 eval $hasproto ;;
12685         *)      ;;
12686         esac
12687         case "$d_endgrent_r_proto" in
12688         define)
12689         case "$endgrent_r_proto" in
12690         ''|0) try='int endgrent_r(FILE**);'
12691         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12692         esac
12693         case "$endgrent_r_proto" in
12694         ''|0) try='void endgrent_r(FILE**);'
12695         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12696         esac
12697         case "$endgrent_r_proto" in
12698         ''|0)   d_endgrent_r=undef
12699                 endgrent_r_proto=0
12700                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12701         * )     case "$endgrent_r_proto" in
12702                 REENTRANT_PROTO*) ;;
12703                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12704                 esac
12705                 echo "Prototype: $try" ;;
12706         esac
12707         ;;
12708         *)      case "$usethreads" in
12709                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12710                 esac
12711                 d_endgrent_r=undef
12712                 endgrent_r_proto=0
12713                 ;;
12714         esac
12715         ;;
12716 *)      endgrent_r_proto=0
12717         ;;
12718 esac
12719
12720 : see if endhostent exists
12721 set endhostent d_endhent
12722 eval $inlibc
12723
12724 : see if this is a netdb.h system
12725 set netdb.h i_netdb
12726 eval $inhdr
12727
12728 : see if endhostent_r exists
12729 set endhostent_r d_endhostent_r
12730 eval $inlibc
12731 case "$d_endhostent_r" in
12732 "$define")
12733         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12734         case "$d_endhostent_r_proto:$usethreads" in
12735         ":define")      d_endhostent_r_proto=define
12736                 set d_endhostent_r_proto endhostent_r $hdrs
12737                 eval $hasproto ;;
12738         *)      ;;
12739         esac
12740         case "$d_endhostent_r_proto" in
12741         define)
12742         case "$endhostent_r_proto" in
12743         ''|0) try='int endhostent_r(struct hostent_data*);'
12744         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12745         esac
12746         case "$endhostent_r_proto" in
12747         ''|0) try='void endhostent_r(struct hostent_data*);'
12748         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12749         esac
12750         case "$endhostent_r_proto" in
12751         ''|0)   d_endhostent_r=undef
12752                 endhostent_r_proto=0
12753                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12754         * )     case "$endhostent_r_proto" in
12755                 REENTRANT_PROTO*) ;;
12756                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12757                 esac
12758                 echo "Prototype: $try" ;;
12759         esac
12760         ;;
12761         *)      case "$usethreads" in
12762                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12763                 esac
12764                 d_endhostent_r=undef
12765                 endhostent_r_proto=0
12766                 ;;
12767         esac
12768         ;;
12769 *)      endhostent_r_proto=0
12770         ;;
12771 esac
12772
12773 : see if endnetent exists
12774 set endnetent d_endnent
12775 eval $inlibc
12776
12777 : see if endnetent_r exists
12778 set endnetent_r d_endnetent_r
12779 eval $inlibc
12780 case "$d_endnetent_r" in
12781 "$define")
12782         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12783         case "$d_endnetent_r_proto:$usethreads" in
12784         ":define")      d_endnetent_r_proto=define
12785                 set d_endnetent_r_proto endnetent_r $hdrs
12786                 eval $hasproto ;;
12787         *)      ;;
12788         esac
12789         case "$d_endnetent_r_proto" in
12790         define)
12791         case "$endnetent_r_proto" in
12792         ''|0) try='int endnetent_r(struct netent_data*);'
12793         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12794         esac
12795         case "$endnetent_r_proto" in
12796         ''|0) try='void endnetent_r(struct netent_data*);'
12797         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12798         esac
12799         case "$endnetent_r_proto" in
12800         ''|0)   d_endnetent_r=undef
12801                 endnetent_r_proto=0
12802                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12803         * )     case "$endnetent_r_proto" in
12804                 REENTRANT_PROTO*) ;;
12805                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12806                 esac
12807                 echo "Prototype: $try" ;;
12808         esac
12809         ;;
12810         *)      case "$usethreads" in
12811                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12812                 esac
12813                 d_endnetent_r=undef
12814                 endnetent_r_proto=0
12815                 ;;
12816         esac
12817         ;;
12818 *)      endnetent_r_proto=0
12819         ;;
12820 esac
12821
12822 : see if endprotoent exists
12823 set endprotoent d_endpent
12824 eval $inlibc
12825
12826 : see if endprotoent_r exists
12827 set endprotoent_r d_endprotoent_r
12828 eval $inlibc
12829 case "$d_endprotoent_r" in
12830 "$define")
12831         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12832         case "$d_endprotoent_r_proto:$usethreads" in
12833         ":define")      d_endprotoent_r_proto=define
12834                 set d_endprotoent_r_proto endprotoent_r $hdrs
12835                 eval $hasproto ;;
12836         *)      ;;
12837         esac
12838         case "$d_endprotoent_r_proto" in
12839         define)
12840         case "$endprotoent_r_proto" in
12841         ''|0) try='int endprotoent_r(struct protoent_data*);'
12842         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12843         esac
12844         case "$endprotoent_r_proto" in
12845         ''|0) try='void endprotoent_r(struct protoent_data*);'
12846         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12847         esac
12848         case "$endprotoent_r_proto" in
12849         ''|0)   d_endprotoent_r=undef
12850                 endprotoent_r_proto=0
12851                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12852         * )     case "$endprotoent_r_proto" in
12853                 REENTRANT_PROTO*) ;;
12854                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12855                 esac
12856                 echo "Prototype: $try" ;;
12857         esac
12858         ;;
12859         *)      case "$usethreads" in
12860                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12861                 esac
12862                 d_endprotoent_r=undef
12863                 endprotoent_r_proto=0
12864                 ;;
12865         esac
12866         ;;
12867 *)      endprotoent_r_proto=0
12868         ;;
12869 esac
12870
12871 : see if endpwent exists
12872 set endpwent d_endpwent
12873 eval $inlibc
12874
12875 : see if this is a pwd.h system
12876 set pwd.h i_pwd
12877 eval $inhdr
12878
12879 case "$i_pwd" in
12880 $define)
12881         xxx=`./findhdr pwd.h`
12882         $cppstdin $cppflags $cppminus < $xxx >$$.h
12883
12884         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12885                 val="$define"
12886         else
12887                 val="$undef"
12888         fi
12889         set d_pwquota
12890         eval $setvar
12891
12892         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12893                 val="$define"
12894         else
12895                 val="$undef"
12896         fi
12897         set d_pwage
12898         eval $setvar
12899
12900         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12901                 val="$define"
12902         else
12903                 val="$undef"
12904         fi
12905         set d_pwchange
12906         eval $setvar
12907
12908         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12909                 val="$define"
12910         else
12911                 val="$undef"
12912         fi
12913         set d_pwclass
12914         eval $setvar
12915
12916         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12917                 val="$define"
12918         else
12919                 val="$undef"
12920         fi
12921         set d_pwexpire
12922         eval $setvar
12923
12924         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12925                 val="$define"
12926         else
12927                 val="$undef"
12928         fi
12929         set d_pwcomment
12930         eval $setvar
12931
12932         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12933                 val="$define"
12934         else
12935                 val="$undef"
12936         fi
12937         set d_pwgecos
12938         eval $setvar
12939
12940         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12941                 val="$define"
12942         else
12943                 val="$undef"
12944         fi
12945         set d_pwpasswd
12946         eval $setvar
12947
12948         $rm -f $$.h
12949         ;;
12950 *)
12951         val="$undef";
12952         set d_pwquota; eval $setvar
12953         set d_pwage; eval $setvar
12954         set d_pwchange; eval $setvar
12955         set d_pwclass; eval $setvar
12956         set d_pwexpire; eval $setvar
12957         set d_pwcomment; eval $setvar
12958         set d_pwgecos; eval $setvar
12959         set d_pwpasswd; eval $setvar
12960         ;;
12961 esac
12962
12963 : see if endpwent_r exists
12964 set endpwent_r d_endpwent_r
12965 eval $inlibc
12966 case "$d_endpwent_r" in
12967 "$define")
12968         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12969         case "$d_endpwent_r_proto:$usethreads" in
12970         ":define")      d_endpwent_r_proto=define
12971                 set d_endpwent_r_proto endpwent_r $hdrs
12972                 eval $hasproto ;;
12973         *)      ;;
12974         esac
12975         case "$d_endpwent_r_proto" in
12976         define)
12977         case "$endpwent_r_proto" in
12978         ''|0) try='int endpwent_r(FILE**);'
12979         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12980         esac
12981         case "$endpwent_r_proto" in
12982         ''|0) try='void endpwent_r(FILE**);'
12983         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12984         esac
12985         case "$endpwent_r_proto" in
12986         ''|0)   d_endpwent_r=undef
12987                 endpwent_r_proto=0
12988                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12989         * )     case "$endpwent_r_proto" in
12990                 REENTRANT_PROTO*) ;;
12991                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12992                 esac
12993                 echo "Prototype: $try" ;;
12994         esac
12995         ;;
12996         *)      case "$usethreads" in
12997                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12998                 esac
12999                 d_endpwent_r=undef
13000                 endpwent_r_proto=0
13001                 ;;
13002         esac
13003         ;;
13004 *)      endpwent_r_proto=0
13005         ;;
13006 esac
13007
13008 : see if endservent exists
13009 set endservent d_endsent
13010 eval $inlibc
13011
13012 : see if endservent_r exists
13013 set endservent_r d_endservent_r
13014 eval $inlibc
13015 case "$d_endservent_r" in
13016 "$define")
13017         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13018         case "$d_endservent_r_proto:$usethreads" in
13019         ":define")      d_endservent_r_proto=define
13020                 set d_endservent_r_proto endservent_r $hdrs
13021                 eval $hasproto ;;
13022         *)      ;;
13023         esac
13024         case "$d_endservent_r_proto" in
13025         define)
13026         case "$endservent_r_proto" in
13027         ''|0) try='int endservent_r(struct servent_data*);'
13028         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13029         esac
13030         case "$endservent_r_proto" in
13031         ''|0) try='void endservent_r(struct servent_data*);'
13032         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13033         esac
13034         case "$endservent_r_proto" in
13035         ''|0)   d_endservent_r=undef
13036                 endservent_r_proto=0
13037                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13038         * )     case "$endservent_r_proto" in
13039                 REENTRANT_PROTO*) ;;
13040                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13041                 esac
13042                 echo "Prototype: $try" ;;
13043         esac
13044         ;;
13045         *)      case "$usethreads" in
13046                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13047                 esac
13048                 d_endservent_r=undef
13049                 endservent_r_proto=0
13050                 ;;
13051         esac
13052         ;;
13053 *)      endservent_r_proto=0
13054         ;;
13055 esac
13056
13057 : Locate the flags for 'open()'
13058 echo " "
13059 $cat >try.c <<EOCP
13060 #include <sys/types.h>
13061 #ifdef I_FCNTL
13062 #include <fcntl.h>
13063 #endif
13064 #ifdef I_SYS_FILE
13065 #include <sys/file.h>
13066 #endif
13067 #$i_stdlib I_STDLIB
13068 #ifdef I_STDLIB
13069 #include <stdlib.h>
13070 #endif
13071 int main() {
13072         if(O_RDONLY);
13073 #ifdef O_TRUNC
13074         exit(0);
13075 #else
13076         exit(1);
13077 #endif
13078 }
13079 EOCP
13080 : check sys/file.h first to get FREAD on Sun
13081 if $test `./findhdr sys/file.h` && \
13082                 set try -DI_SYS_FILE && eval $compile; then
13083         h_sysfile=true;
13084         echo "<sys/file.h> defines the O_* constants..." >&4
13085         if $run ./try; then
13086                 echo "and you have the 3 argument form of open()." >&4
13087                 val="$define"
13088         else
13089                 echo "but not the 3 argument form of open().  Oh, well." >&4
13090                 val="$undef"
13091         fi
13092 elif $test `./findhdr fcntl.h` && \
13093                 set try -DI_FCNTL && eval $compile; then
13094         h_fcntl=true;
13095         echo "<fcntl.h> defines the O_* constants..." >&4
13096         if $run ./try; then
13097                 echo "and you have the 3 argument form of open()." >&4
13098                 val="$define"
13099         else
13100                 echo "but not the 3 argument form of open().  Oh, well." >&4
13101                 val="$undef"
13102         fi
13103 else
13104         val="$undef"
13105         echo "I can't find the O_* constant definitions!  You got problems." >&4
13106 fi
13107 set d_open3
13108 eval $setvar
13109 $rm_try
13110
13111 : see if this is a sys/file.h system
13112 val=''
13113 set sys/file.h val
13114 eval $inhdr
13115
13116 : do we need to include sys/file.h ?
13117 case "$val" in
13118 "$define")
13119         echo " "
13120         if $h_sysfile; then
13121                 val="$define"
13122                 echo "We'll be including <sys/file.h>." >&4
13123         else
13124                 val="$undef"
13125                 echo "We won't be including <sys/file.h>." >&4
13126         fi
13127         ;;
13128 *)
13129         h_sysfile=false
13130         ;;
13131 esac
13132 set i_sysfile
13133 eval $setvar
13134
13135 : see if fcntl.h is there
13136 val=''
13137 set fcntl.h val
13138 eval $inhdr
13139
13140 : see if we can include fcntl.h
13141 case "$val" in
13142 "$define")
13143         echo " "
13144         if $h_fcntl; then
13145                 val="$define"
13146                 echo "We'll be including <fcntl.h>." >&4
13147         else
13148                 val="$undef"
13149                 if $h_sysfile; then
13150         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13151                 else
13152                         echo "We won't be including <fcntl.h>." >&4
13153                 fi
13154         fi
13155         ;;
13156 *)
13157         h_fcntl=false
13158         val="$undef"
13159         ;;
13160 esac
13161 set i_fcntl
13162 eval $setvar
13163
13164 : see if fork exists
13165 set fork d_fork
13166 eval $inlibc
13167
13168 : see if pipe exists
13169 set pipe d_pipe
13170 eval $inlibc
13171
13172 : check for non-blocking I/O stuff
13173 case "$h_sysfile" in
13174 true) echo "#include <sys/file.h>" > head.c;;
13175 *)
13176        case "$h_fcntl" in
13177        true) echo "#include <fcntl.h>" > head.c;;
13178        *) echo "#include <sys/fcntl.h>" > head.c;;
13179        esac
13180        ;;
13181 esac
13182 echo " "
13183 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13184 case "$o_nonblock" in
13185 '')
13186         $cat head.c > try.c
13187         $cat >>try.c <<EOCP
13188 #include <stdio.h>
13189 #$i_stdlib I_STDLIB
13190 #ifdef I_STDLIB
13191 #include <stdlib.h>
13192 #endif
13193 #$i_fcntl I_FCNTL
13194 #ifdef I_FCNTL
13195 #include <fcntl.h>
13196 #endif
13197 int main() {
13198 #ifdef O_NONBLOCK
13199         printf("O_NONBLOCK\n");
13200         exit(0);
13201 #endif
13202 #ifdef O_NDELAY
13203         printf("O_NDELAY\n");
13204         exit(0);
13205 #endif
13206 #ifdef FNDELAY
13207         printf("FNDELAY\n");
13208         exit(0);
13209 #endif
13210         exit(0);
13211 }
13212 EOCP
13213         set try
13214         if eval $compile_ok; then
13215                 o_nonblock=`$run ./try`
13216                 case "$o_nonblock" in
13217                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13218                 *) echo "Seems like we can use $o_nonblock.";;
13219                 esac
13220         else
13221                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13222         fi
13223         ;;
13224 *) echo "Using $hint value $o_nonblock.";;
13225 esac
13226 $rm_try
13227
13228 echo " "
13229 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13230 case "$eagain" in
13231 '')
13232         case "$d_fork:$d_pipe:$d_alarm" in
13233         define:define:define)
13234         $cat head.c > try.c
13235         $cat >>try.c <<EOCP
13236 #include <errno.h>
13237 #include <sys/types.h>
13238 #include <signal.h>
13239 #include <stdio.h>
13240 #$i_stdlib I_STDLIB
13241 #ifdef I_STDLIB
13242 #include <stdlib.h>
13243 #endif
13244 #$i_fcntl I_FCNTL
13245 #ifdef I_FCNTL
13246 #include <fcntl.h>
13247 #endif
13248 #define MY_O_NONBLOCK $o_nonblock
13249 #ifndef errno  /* XXX need better Configure test */
13250 extern int errno;
13251 #endif
13252 #$i_unistd I_UNISTD
13253 #ifdef I_UNISTD
13254 #include <unistd.h>
13255 #endif
13256 #include <string.h>
13257 $signal_t blech(int x) { exit(3); }
13258 EOCP
13259         $cat >> try.c <<'EOCP'
13260 int main()
13261 {
13262         int pd[2];
13263         int pu[2];
13264         char buf[1];
13265         char string[100];
13266         int ret;
13267
13268         ret = pipe(pd); /* Down: child -> parent */
13269         if (ret != 0)
13270                 exit(3);
13271         ret = pipe(pu); /* Up: parent -> child */
13272         if (ret != 0)
13273                 exit(3);
13274         if (0 != fork()) {
13275                 close(pd[1]);   /* Parent reads from pd[0] */
13276                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13277 #ifdef F_SETFL
13278                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13279                         exit(1);
13280 #else
13281                 exit(4);
13282 #endif
13283                 signal(SIGALRM, blech);
13284                 alarm(5);
13285                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13286                         exit(2);
13287                 sprintf(string, "%d\n", ret);
13288                 ret = write(2, string, strlen(string));
13289                 if (ret != strlen(string))
13290                         exit(3);
13291                 alarm(0);
13292 #ifdef EAGAIN
13293                 if (errno == EAGAIN) {
13294                         printf("EAGAIN\n");
13295                         goto ok;
13296                 }
13297 #endif
13298 #ifdef EWOULDBLOCK
13299                 if (errno == EWOULDBLOCK)
13300                         printf("EWOULDBLOCK\n");
13301 #endif
13302         ok:
13303                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13304                 if (ret != 1)
13305                         exit(3);
13306                 sleep(2);                               /* Give it time to close our pipe */
13307                 alarm(5);
13308                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13309                 alarm(0);
13310                 sprintf(string, "%d\n", ret);
13311                 ret = write(4, string, strlen(string));
13312                 if (ret != strlen(string))
13313                         exit(3);
13314                 exit(0);
13315         }
13316
13317         close(pd[0]);                   /* We write to pd[1] */
13318         close(pu[1]);                   /* We read from pu[0] */
13319         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13320         if (ret != 1)
13321                 exit(3);
13322         close(pd[1]);                   /* Pipe pd is now fully closed! */
13323         exit(0);                                /* Bye bye, thank you for playing! */
13324 }
13325 EOCP
13326         set try
13327         if eval $compile_ok; then
13328                 echo "$startsh" >mtry
13329                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13330                 chmod +x mtry
13331                 $run ./mtry >/dev/null 2>&1
13332                 case $? in
13333                 0) eagain=`$cat try.out`;;
13334                 1) echo "Could not perform non-blocking setting!";;
13335                 2) echo "I did a successful read() for something that was not there!";;
13336                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13337                 4) echo "Could not find F_SETFL!";;
13338                 *) echo "Something terribly wrong happened during testing.";;
13339                 esac
13340                 rd_nodata=`$cat try.ret`
13341                 echo "A read() system call with no data present returns $rd_nodata."
13342                 case "$rd_nodata" in
13343                 0|-1) ;;
13344                 *)
13345                         echo "(That's peculiar, fixing that to be -1.)"
13346                         rd_nodata=-1
13347                         ;;
13348                 esac
13349                 case "$eagain" in
13350                 '')
13351                         echo "Forcing errno EAGAIN on read() with no data available."
13352                         eagain=EAGAIN
13353                         ;;
13354                 *)
13355                         echo "Your read() sets errno to $eagain when no data is available."
13356                         ;;
13357                 esac
13358                 status=`$cat try.err`
13359                 case "$status" in
13360                 0) echo "And it correctly returns 0 to signal EOF.";;
13361                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13362                 *) echo "However, your read() returns '$status' on EOF??";;
13363                 esac
13364                 val="$define"
13365                 if test "$status" = "$rd_nodata"; then
13366                         echo "WARNING: you can't distinguish between EOF and no data!"
13367                         val="$undef"
13368                 fi
13369         else
13370                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13371                 eagain=EAGAIN
13372         fi
13373         ;;
13374         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13375                 eagain=EAGAIN
13376                 val="$define"
13377                 ;;
13378         esac
13379         set d_eofnblk
13380         eval $setvar
13381         ;;
13382 *)
13383         echo "Using $hint value $eagain."
13384         echo "Your read() returns $rd_nodata when no data is present."
13385         case "$d_eofnblk" in
13386         "$define") echo "And you can see EOF because read() returns 0.";;
13387         "$undef") echo "But you can't see EOF status from read() returned value.";;
13388         *)
13389                 echo "(Assuming you can't see EOF status from read anyway.)"
13390                 d_eofnblk=$undef
13391                 ;;
13392         esac
13393         ;;
13394 esac
13395 $rm_try head.c mtry
13396
13397 : see if erf exists
13398 set erf d_erf
13399 eval $inlibc
13400
13401 : see if erfc exists
13402 set erfc d_erfc
13403 eval $inlibc
13404
13405 : see if exp2 exists
13406 set exp2 d_exp2
13407 eval $inlibc
13408
13409 : see if expm1 exists
13410 set expm1 d_expm1
13411 eval $inlibc
13412
13413 : see if _ptr and _cnt from stdio act std
13414 echo " "
13415
13416 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13417         echo "(Looks like you have stdio.h from BSD.)"
13418         case "$stdio_ptr" in
13419         '') stdio_ptr='((fp)->_p)'
13420                 ptr_lval=$define
13421                 ;;
13422         *)      ptr_lval=$d_stdio_ptr_lval;;
13423         esac
13424         case "$stdio_cnt" in
13425         '') stdio_cnt='((fp)->_r)'
13426                 cnt_lval=$define
13427                 ;;
13428         *)      cnt_lval=$d_stdio_cnt_lval;;
13429         esac
13430         case "$stdio_base" in
13431         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13432         esac
13433         case "$stdio_bufsiz" in
13434         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13435         esac
13436 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13437         echo "(Looks like you have stdio.h from Linux.)"
13438         case "$stdio_ptr" in
13439         '') stdio_ptr='((fp)->_IO_read_ptr)'
13440                 ptr_lval=$define
13441                 ;;
13442         *)      ptr_lval=$d_stdio_ptr_lval;;
13443         esac
13444         case "$stdio_cnt" in
13445         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13446                 cnt_lval=$undef
13447                 ;;
13448         *)      cnt_lval=$d_stdio_cnt_lval;;
13449         esac
13450         case "$stdio_base" in
13451         '') stdio_base='((fp)->_IO_read_base)';;
13452         esac
13453         case "$stdio_bufsiz" in
13454         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13455         esac
13456 else
13457         case "$stdio_ptr" in
13458         '') stdio_ptr='((fp)->_ptr)'
13459                 ptr_lval=$define
13460                 ;;
13461         *)      ptr_lval=$d_stdio_ptr_lval;;
13462         esac
13463         case "$stdio_cnt" in
13464         '') stdio_cnt='((fp)->_cnt)'
13465                 cnt_lval=$define
13466                 ;;
13467         *)      cnt_lval=$d_stdio_cnt_lval;;
13468         esac
13469         case "$stdio_base" in
13470         '') stdio_base='((fp)->_base)';;
13471         esac
13472         case "$stdio_bufsiz" in
13473         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13474         esac
13475 fi
13476
13477 : test whether _ptr and _cnt really work
13478 echo "Checking how std your stdio is..." >&4
13479 $cat >try.c <<EOP
13480 #include <stdio.h>
13481 #$i_stdlib I_STDLIB
13482 #ifdef I_STDLIB
13483 #include <stdlib.h>
13484 #endif
13485 #define FILE_ptr(fp)    $stdio_ptr
13486 #define FILE_cnt(fp)    $stdio_cnt
13487 int main() {
13488         FILE *fp = fopen("try.c", "r");
13489         char c = getc(fp);
13490         if (
13491                 18 <= FILE_cnt(fp) &&
13492                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13493         )
13494                 exit(0);
13495         exit(1);
13496 }
13497 EOP
13498 val="$undef"
13499 set try
13500 if eval $compile && $to try.c; then
13501         if $run ./try; then
13502                 echo "Your stdio acts pretty std."
13503                 val="$define"
13504         else
13505                 echo "Your stdio isn't very std."
13506         fi
13507 else
13508         echo "Your stdio doesn't appear very std."
13509 fi
13510 $rm_try
13511
13512 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13513 # direct buffer manipulation no longer works.  The Configure tests
13514 # should be changed to correctly detect this, but until then,
13515 # the following check should at least let perl compile and run.
13516 # (This quick fix should be updated before 5.8.1.)
13517 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13518 # A. Dougherty, June 3, 2002.
13519 case "$d_gnulibc" in
13520 $define)
13521         case "$gnulibc_version" in
13522         2.[01]*)  ;;
13523         2.2) ;;
13524         2.2.[0-9]) ;;
13525         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13526                 val="$undef"
13527                 ;;
13528         esac
13529         ;;
13530 esac
13531 set d_stdstdio
13532 eval $setvar
13533
13534 : Can _ptr be used as an lvalue?
13535 case "$d_stdstdio$ptr_lval" in
13536 $define$define) val=$define ;;
13537 *) val=$undef ;;
13538 esac
13539 set d_stdio_ptr_lval
13540 eval $setvar
13541
13542 : Can _cnt be used as an lvalue?
13543 case "$d_stdstdio$cnt_lval" in
13544 $define$define) val=$define ;;
13545 *) val=$undef ;;
13546 esac
13547 set d_stdio_cnt_lval
13548 eval $setvar
13549
13550
13551 : test whether setting _ptr sets _cnt as a side effect
13552 d_stdio_ptr_lval_sets_cnt="$undef"
13553 d_stdio_ptr_lval_nochange_cnt="$undef"
13554 case "$d_stdio_ptr_lval$d_stdstdio" in
13555 $define$define)
13556         echo "Checking to see what happens if we set the stdio ptr..." >&4
13557 $cat >try.c <<EOP
13558 #include <stdio.h>
13559 /* Can we scream? */
13560 /* Eat dust sed :-) */
13561 /* In the buffer space, no one can hear you scream. */
13562 #$i_stdlib I_STDLIB
13563 #ifdef I_STDLIB
13564 #include <stdlib.h>
13565 #endif
13566 #define FILE_ptr(fp)    $stdio_ptr
13567 #define FILE_cnt(fp)    $stdio_cnt
13568 #include <sys/types.h>
13569 int main() {
13570         FILE *fp = fopen("try.c", "r");
13571         int c;
13572         char *ptr;
13573         size_t cnt;
13574         if (!fp) {
13575             puts("Fail even to read");
13576             exit(1);
13577         }
13578         c = getc(fp); /* Read away the first # */
13579         if (c == EOF) {
13580             puts("Fail even to read");
13581             exit(1);
13582         }
13583         if (!(
13584                 18 <= FILE_cnt(fp) &&
13585                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13586         )) {
13587                 puts("Fail even to read");
13588                 exit (1);
13589         }
13590         ptr = (char*) FILE_ptr(fp);
13591         cnt = (size_t)FILE_cnt(fp);
13592
13593         FILE_ptr(fp) += 42;
13594
13595         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13596                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13597                 exit (1);
13598         }
13599         if (FILE_cnt(fp) <= 20) {
13600                 printf ("Fail (<20 chars to test)");
13601                 exit (1);
13602         }
13603         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13604                 puts("Fail compare");
13605                 exit (1);
13606         }
13607         if (cnt == FILE_cnt(fp)) {
13608                 puts("Pass_unchanged");
13609                 exit (0);
13610         }
13611         if (FILE_cnt(fp) == (cnt - 42)) {
13612                 puts("Pass_changed");
13613                 exit (0);
13614         }
13615         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13616         return 1;
13617
13618 }
13619 EOP
13620         set try
13621         if eval $compile && $to try.c; then
13622                 case `$run ./try` in
13623                 Pass_changed)
13624                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13625                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13626                 Pass_unchanged)
13627                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13628                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13629                 Fail*)
13630                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13631                 *)
13632                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13633         esac
13634         else
13635                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13636         fi
13637         $rm_try
13638         ;;
13639 esac
13640
13641 : see if _base is also standard
13642 val="$undef"
13643 case "$d_stdstdio" in
13644 $define)
13645         $cat >try.c <<EOP
13646 #include <stdio.h>
13647 #$i_stdlib I_STDLIB
13648 #ifdef I_STDLIB
13649 #include <stdlib.h>
13650 #endif
13651 #define FILE_base(fp)   $stdio_base
13652 #define FILE_bufsiz(fp) $stdio_bufsiz
13653 int main() {
13654         FILE *fp = fopen("try.c", "r");
13655         char c = getc(fp);
13656         if (
13657                 19 <= FILE_bufsiz(fp) &&
13658                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13659         )
13660                 exit(0);
13661         exit(1);
13662 }
13663 EOP
13664         set try
13665         if eval $compile && $to try.c; then
13666                 if $run ./try; then
13667                         echo "And its _base field acts std."
13668                         val="$define"
13669                 else
13670                         echo "But its _base field isn't std."
13671                 fi
13672         else
13673                 echo "However, it seems to be lacking the _base field."
13674         fi
13675         $rm_try
13676         ;;
13677 esac
13678 set d_stdiobase
13679 eval $setvar
13680
13681 : see if fast_stdio exists
13682 val="$undef"
13683 case "$d_stdstdio:$d_stdio_ptr_lval" in
13684 "$define:$define")
13685         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13686         *$define*)
13687                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13688                 val="$define"
13689                 ;;
13690         esac
13691         ;;
13692 esac
13693 set d_faststdio
13694 eval $setvar
13695
13696
13697
13698 : see if fchdir exists
13699 set fchdir d_fchdir
13700 eval $inlibc
13701
13702 : see if fchmod exists
13703 set fchmod d_fchmod
13704 eval $inlibc
13705
13706 : check for openat, unlinkat, renameat, linkat, fchmodat
13707 set openat d_openat
13708 eval $inlibc
13709
13710 set unlinkat d_unlinkat
13711 eval $inlibc
13712
13713 set renameat d_renameat
13714 eval $inlibc
13715
13716 set linkat d_linkat
13717 eval $inlibc
13718
13719 set fchmodat d_fchmodat
13720 eval $inlibc
13721
13722 : see if fchown exists
13723 set fchown d_fchown
13724 eval $inlibc
13725
13726 : see if this is an fcntl system
13727 set fcntl d_fcntl
13728 eval $inlibc
13729
13730 : See if fcntl-based locking works.
13731 echo " "
13732 $cat >try.c <<EOCP
13733 #$i_stdlib I_STDLIB
13734 #ifdef I_STDLIB
13735 #include <stdlib.h>
13736 #endif
13737 #include <unistd.h>
13738 #include <fcntl.h>
13739 #include <signal.h>
13740 $signal_t blech(int x) { exit(3); }
13741 int main() {
13742 #if defined(F_SETLK) && defined(F_SETLKW)
13743      struct flock flock;
13744      int retval, fd;
13745      fd = open("try.c", O_RDONLY);
13746      flock.l_type = F_RDLCK;
13747      flock.l_whence = SEEK_SET;
13748      flock.l_start = flock.l_len = 0;
13749      signal(SIGALRM, blech);
13750      alarm(10);
13751      retval = fcntl(fd, F_SETLK, &flock);
13752      close(fd);
13753      (retval < 0 ? exit(2) : exit(0));
13754 #else
13755      exit(2);
13756 #endif
13757 }
13758 EOCP
13759 echo "Checking if fcntl-based file locking works... "
13760 case "$d_fcntl" in
13761 "$define")
13762         set try
13763         if eval $compile_ok; then
13764                 if $run ./try; then
13765                         echo "Yes, it seems to work."
13766                         val="$define"
13767                 else
13768                         echo "Nope, it didn't work."
13769                         val="$undef"
13770                         case "$?" in
13771                         3) $cat >&4 <<EOM
13772 ***
13773 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13774 *** This is (almost) impossible.
13775 *** If your NFS lock daemons are not feeling well, something like
13776 *** this may happen, please investigate.  Cannot continue, aborting.
13777 ***
13778 EOM
13779                                 exit 1
13780                                 ;;
13781                         esac
13782                 fi
13783         else
13784                 echo "I'm unable to compile the test program, so I'll assume not."
13785                 val="$undef"
13786         fi
13787         ;;
13788 *) val="$undef";
13789         echo "Nope, since you don't even have fcntl()."
13790         ;;
13791 esac
13792 set d_fcntl_can_lock
13793 eval $setvar
13794 $rm_try
13795
13796 : check for fd_set items
13797 $cat <<EOM
13798
13799 Checking to see how well your C compiler handles fd_set and friends ...
13800 EOM
13801 $cat >try.c <<EOCP
13802 #$i_stdlib I_STDLIB
13803 #ifdef I_STDLIB
13804 #include <stdlib.h>
13805 #endif
13806 #$i_systime I_SYS_TIME
13807 #$i_sysselct I_SYS_SELECT
13808 #$d_socket HAS_SOCKET
13809 #include <sys/types.h>
13810 #ifdef HAS_SOCKET
13811 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13812 #endif
13813 #ifdef I_SYS_TIME
13814 #include <sys/time.h>
13815 #endif
13816 #ifdef I_SYS_SELECT
13817 #include <sys/select.h>
13818 #endif
13819 int main() {
13820         fd_set fds;
13821
13822 #ifdef TRYBITS
13823         if(fds.fds_bits);
13824 #endif
13825
13826 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13827         exit(0);
13828 #else
13829         exit(1);
13830 #endif
13831 }
13832 EOCP
13833 set try -DTRYBITS
13834 if eval $compile; then
13835         d_fds_bits="$define"
13836         d_fd_set="$define"
13837         echo "Well, your system knows about the normal fd_set typedef..." >&4
13838         if $run ./try; then
13839                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13840                 d_fd_macros="$define"
13841         else
13842                 $cat >&4 <<'EOM'
13843 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13844 EOM
13845                 d_fd_macros="$undef"
13846         fi
13847 else
13848         $cat <<'EOM'
13849 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13850 EOM
13851         set try
13852         if eval $compile; then
13853                 d_fds_bits="$undef"
13854                 d_fd_set="$define"
13855                 echo "Well, your system has some sort of fd_set available..." >&4
13856                 if $run ./try; then
13857                         echo "and you have the normal fd_set macros." >&4
13858                         d_fd_macros="$define"
13859                 else
13860                         $cat <<'EOM'
13861 but not the normal fd_set macros!  Gross!  More work for me...
13862 EOM
13863                         d_fd_macros="$undef"
13864                 fi
13865         else
13866         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13867                 d_fd_set="$undef"
13868                 d_fds_bits="$undef"
13869                 d_fd_macros="$undef"
13870         fi
13871 fi
13872 $rm_try
13873
13874 : see if fdclose exists
13875 set fdclose d_fdclose
13876 eval $inlibc
13877
13878 : see if fdim exists
13879 set fdim d_fdim
13880 eval $inlibc
13881
13882 : see if fegetround exists
13883 set fegetround d_fegetround
13884 eval $inlibc
13885
13886 : see if fgetpos exists
13887 set fgetpos d_fgetpos
13888 eval $inlibc
13889
13890 : see if finite exists
13891 set finite d_finite
13892 eval $inlibc
13893
13894 : see if finitel exists
13895 set finitel d_finitel
13896 eval $inlibc
13897
13898 : see if flock exists
13899 set flock d_flock
13900 eval $inlibc
13901
13902 : see if prototype for flock is available
13903 echo " "
13904 set d_flockproto flock $i_sysfile sys/file.h
13905 eval $hasproto
13906
13907 : see if fma exists
13908 set fma d_fma
13909 eval $inlibc
13910
13911 : see if fmax exists
13912 set fmax d_fmax
13913 eval $inlibc
13914
13915 : see if fmin exists
13916 set fmin d_fmin
13917 eval $inlibc
13918
13919 : see if fp_class exists
13920 set fp_class d_fp_class
13921 eval $inlibc
13922
13923 : check for fpclassify
13924 echo "Checking to see if you have fpclassify..." >&4
13925 $cat >try.c <<EOCP
13926 #include <math.h>
13927 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
13928 EOCP
13929 set try
13930 if eval $compile; then
13931         val="$define"
13932         echo "You have fpclassify."
13933 else
13934         val="$undef"
13935         echo "You do not have fpclassify."
13936 fi
13937 $rm_try
13938 set d_fpclassify
13939 eval $setvar
13940
13941 : see if fp_classify exists
13942 set fp_classify d_fp_classify
13943 eval $inlibc
13944
13945 : see if fp_classl exists
13946 set fp_classl d_fp_classl
13947 eval $inlibc
13948
13949 : see if pathconf exists
13950 set pathconf d_pathconf
13951 eval $inlibc
13952
13953 : see if fpathconf exists
13954 set fpathconf d_fpathconf
13955 eval $inlibc
13956
13957 : see if fpclass exists
13958 set fpclass d_fpclass
13959 eval $inlibc
13960
13961 : see if fpclassl exists
13962 set fpclassl d_fpclassl
13963 eval $inlibc
13964
13965 : see if fpgetround exists
13966 set fpgetround d_fpgetround
13967 eval $inlibc
13968
13969 : check for fpos64_t
13970 echo " "
13971 echo "Checking to see if you have fpos64_t..." >&4
13972 $cat >try.c <<EOCP
13973 #include <stdio.h>
13974 int main() { fpos64_t x = 7; }
13975 EOCP
13976 set try
13977 if eval $compile; then
13978         val="$define"
13979         echo "You have fpos64_t."
13980 else
13981         val="$undef"
13982         echo "You do not have fpos64_t."
13983         case "$fpossize" in
13984         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13985         esac
13986 fi
13987 $rm_try
13988 set d_fpos64_t
13989 eval $setvar
13990
13991 : see if this is an xlocale.h system
13992 set xlocale.h i_xlocale
13993 eval $inhdr
13994
13995 : see if newlocale exists
13996 set newlocale d_newlocale
13997 eval $inlibc
13998
13999 : see if freelocale exists
14000 set freelocale d_freelocale
14001 eval $inlibc
14002
14003 : see if uselocale exists
14004 set uselocale d_uselocale
14005 eval $inlibc
14006
14007 : see if duplocale exists
14008 set duplocale d_duplocale
14009 eval $inlibc
14010
14011 : see if querylocale exists
14012 set querylocale d_querylocale
14013 eval $inlibc
14014
14015 : see if frexpl exists
14016 set frexpl d_frexpl
14017 eval $inlibc
14018
14019 : see if this is a sys/param system
14020 set sys/param.h i_sysparam
14021 eval $inhdr
14022
14023 : see if this is a sys/mount.h system
14024 set sys/mount.h i_sysmount
14025 eval $inhdr
14026
14027 : Check for fs_data_s
14028 echo " "
14029 echo "Checking to see if your system supports struct fs_data..." >&4
14030 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14031 eval $hasstruct
14032 case "$d_fs_data_s" in
14033 "$define")      echo "Yes, it does."   ;;
14034 *)              echo "No, it doesn't." ;;
14035 esac
14036
14037 : see if fseeko exists
14038 set fseeko d_fseeko
14039 eval $inlibc
14040 case "$longsize" in
14041 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14042 esac
14043
14044 : see if fsetpos exists
14045 set fsetpos d_fsetpos
14046 eval $inlibc
14047
14048 : see if fstatfs exists
14049 set fstatfs d_fstatfs
14050 eval $inlibc
14051
14052 : see if statvfs exists
14053 set statvfs d_statvfs
14054 eval $inlibc
14055
14056 : see if fstatvfs exists
14057 set fstatvfs d_fstatvfs
14058 eval $inlibc
14059
14060
14061 : see if fsync exists
14062 set fsync d_fsync
14063 eval $inlibc
14064
14065 : see if ftello exists
14066 set ftello d_ftello
14067 eval $inlibc
14068 case "$longsize" in
14069 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14070 esac
14071
14072 : check for a working futimes
14073 d_futimes="$undef"
14074 echo " "
14075 echo "Checking if you have a working futimes()" >&4
14076 $cat >try.c <<EOCP
14077 #include <stdio.h>
14078 #include <sys/time.h>
14079 #include <errno.h>
14080 #include <fcntl.h>
14081
14082 int main ()
14083 {
14084     int fd, rv;
14085     fd = open ("try.c", O_RDWR);
14086     if (-1 == fd) exit (1);
14087     rv = futimes (fd, NULL);
14088     exit (rv == -1 ? errno : 0);
14089 }
14090 EOCP
14091 set try
14092 if eval $compile; then
14093     `$run ./try`
14094     rc=$?
14095     case "$rc" in
14096         0)  echo "Yes, you have" >&4
14097             d_futimes="$define"
14098             ;;
14099         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14100             ;;
14101     esac
14102 else
14103     echo "No, it does not (probably harmless)" >&4
14104 fi
14105 $rm_try
14106
14107 : look for gai_strerror
14108 echo " "
14109 $cat >try.c <<'EOCP'
14110 #include <sys/types.h>
14111 #include <sys/socket.h>
14112 #include <netdb.h>
14113 int main ()
14114 {
14115     return (gai_strerror (0) ? 0 : 1);
14116     }
14117 EOCP
14118 set try
14119 val="$undef"
14120 if eval $compile; then
14121     `$run ./try`
14122     case "$?" in
14123         0)  echo "A working gai_strerror() found." >&4
14124             val="$define" ;;
14125         *)  echo "gai_strerror() found, but it doesn't work" >&4
14126             ;;
14127         esac
14128 else
14129     echo "gai_strerror() NOT found." >&4
14130     fi
14131 set d_gai_strerror
14132 eval $setvar
14133 $rm_try
14134
14135 : see if ndbm.h is available
14136 set ndbm.h i_ndbm
14137 eval $inhdr
14138 : Compatibility location for RedHat 7.1
14139 set gdbm/ndbm.h i_gdbmndbm
14140 eval $inhdr
14141 : Compatibility location for Debian 4.0
14142 set gdbm-ndbm.h i_gdbm_ndbm
14143 eval $inhdr
14144
14145 val="$undef"
14146 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14147         : see if dbm_open exists
14148         set dbm_open d_dbm_open
14149         eval $inlibc
14150         case "$d_dbm_open" in
14151         $undef)
14152                 i_ndbm="$undef"
14153                 i_gdbmndbm="$undef"
14154                 i_gdbm_ndbm="$undef"
14155                 echo "We won't be including <ndbm.h>"
14156                 val="$undef"
14157                 ;;
14158         *) val="$define"
14159            ;;
14160         esac
14161 fi
14162 set d_ndbm
14163 eval $setvar
14164
14165 ndbm_hdr_protochk='name=$1; hdr=$2;
14166 eval "ihdr=\$""i_$name";
14167 val="$undef";
14168 if $test "$ihdr" = "$define"; then
14169         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14170         case "$d_cplusplus" in
14171         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14172         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14173         esac;
14174         case "$val" in
14175         $define) $echo "Your <$hdr> seems to have prototypes";;
14176         *) $echo "Your <$hdr> does not seem to have prototypes";;
14177         esac;
14178 fi;
14179 set "d_${name}_h_uses_prototypes";
14180 eval $setvar'
14181
14182 set ndbm ndbm.h
14183 eval $ndbm_hdr_protochk
14184 set gdbmndbm gdbm/ndbm.h
14185 eval $ndbm_hdr_protochk
14186 set gdbm_ndbm gdbm-ndbm.h
14187 eval $ndbm_hdr_protochk
14188
14189 : see if getaddrinfo exists
14190 set getaddrinfo d_getaddrinfo
14191 eval $inlibc
14192
14193 : see if getcwd exists
14194 set getcwd d_getcwd
14195 eval $inlibc
14196
14197 : see if getespwnam exists
14198 set getespwnam d_getespwnam
14199 eval $inlibc
14200
14201 : see if getfsstat exists
14202 set getfsstat d_getfsstat
14203 eval $inlibc
14204
14205 : see if getgrent exists
14206 set getgrent d_getgrent
14207 eval $inlibc
14208
14209 : see if getgrent_r exists
14210 set getgrent_r d_getgrent_r
14211 eval $inlibc
14212 case "$d_getgrent_r" in
14213 "$define")
14214         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14215         case "$d_getgrent_r_proto:$usethreads" in
14216         ":define")      d_getgrent_r_proto=define
14217                 set d_getgrent_r_proto getgrent_r $hdrs
14218                 eval $hasproto ;;
14219         *)      ;;
14220         esac
14221         case "$d_getgrent_r_proto" in
14222         define)
14223         case "$getgrent_r_proto" in
14224         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14225         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14226         esac
14227         case "$getgrent_r_proto" in
14228         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14229         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14230         esac
14231         case "$getgrent_r_proto" in
14232         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14233         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14234         esac
14235         case "$getgrent_r_proto" in
14236         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14237         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14238         esac
14239         case "$getgrent_r_proto" in
14240         ''|0) try='int getgrent_r(struct group*, char*, int);'
14241         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14242         esac
14243         case "$getgrent_r_proto" in
14244         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14245         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14246         esac
14247         case "$getgrent_r_proto" in
14248         ''|0)   d_getgrent_r=undef
14249                 getgrent_r_proto=0
14250                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14251         * )     case "$getgrent_r_proto" in
14252                 REENTRANT_PROTO*) ;;
14253                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14254                 esac
14255                 echo "Prototype: $try" ;;
14256         esac
14257         ;;
14258         *)      case "$usethreads" in
14259                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14260                 esac
14261                 d_getgrent_r=undef
14262                 getgrent_r_proto=0
14263                 ;;
14264         esac
14265         ;;
14266 *)      getgrent_r_proto=0
14267         ;;
14268 esac
14269
14270 : see if getgrgid_r exists
14271 set getgrgid_r d_getgrgid_r
14272 eval $inlibc
14273 case "$d_getgrgid_r" in
14274 "$define")
14275         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14276         case "$d_getgrgid_r_proto:$usethreads" in
14277         ":define")      d_getgrgid_r_proto=define
14278                 set d_getgrgid_r_proto getgrgid_r $hdrs
14279                 eval $hasproto ;;
14280         *)      ;;
14281         esac
14282         case "$d_getgrgid_r_proto" in
14283         define)
14284         case "$getgrgid_r_proto" in
14285         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14286         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14287         esac
14288         case "$getgrgid_r_proto" in
14289         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14290         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14291         esac
14292         case "$getgrgid_r_proto" in
14293         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14294         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14295         esac
14296         case "$getgrgid_r_proto" in
14297         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14298         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14299         esac
14300         case "$getgrgid_r_proto" in
14301         ''|0)   d_getgrgid_r=undef
14302                 getgrgid_r_proto=0
14303                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14304         * )     case "$getgrgid_r_proto" in
14305                 REENTRANT_PROTO*) ;;
14306                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14307                 esac
14308                 echo "Prototype: $try" ;;
14309         esac
14310         ;;
14311         *)      case "$usethreads" in
14312                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14313                 esac
14314                 d_getgrgid_r=undef
14315                 getgrgid_r_proto=0
14316                 ;;
14317         esac
14318         ;;
14319 *)      getgrgid_r_proto=0
14320         ;;
14321 esac
14322
14323 : see if getgrnam_r exists
14324 set getgrnam_r d_getgrnam_r
14325 eval $inlibc
14326 case "$d_getgrnam_r" in
14327 "$define")
14328         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14329         case "$d_getgrnam_r_proto:$usethreads" in
14330         ":define")      d_getgrnam_r_proto=define
14331                 set d_getgrnam_r_proto getgrnam_r $hdrs
14332                 eval $hasproto ;;
14333         *)      ;;
14334         esac
14335         case "$d_getgrnam_r_proto" in
14336         define)
14337         case "$getgrnam_r_proto" in
14338         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14339         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14340         esac
14341         case "$getgrnam_r_proto" in
14342         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14343         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14344         esac
14345         case "$getgrnam_r_proto" in
14346         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14347         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14348         esac
14349         case "$getgrnam_r_proto" in
14350         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14351         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14352         esac
14353         case "$getgrnam_r_proto" in
14354         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14355         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14356         esac
14357         case "$getgrnam_r_proto" in
14358         ''|0)   d_getgrnam_r=undef
14359                 getgrnam_r_proto=0
14360                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14361         * )     case "$getgrnam_r_proto" in
14362                 REENTRANT_PROTO*) ;;
14363                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14364                 esac
14365                 echo "Prototype: $try" ;;
14366         esac
14367         ;;
14368         *)      case "$usethreads" in
14369                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14370                 esac
14371                 d_getgrnam_r=undef
14372                 getgrnam_r_proto=0
14373                 ;;
14374         esac
14375         ;;
14376 *)      getgrnam_r_proto=0
14377         ;;
14378 esac
14379
14380 : see if gethostbyaddr exists
14381 set gethostbyaddr d_gethbyaddr
14382 eval $inlibc
14383
14384 : see if gethostbyname exists
14385 set gethostbyname d_gethbyname
14386 eval $inlibc
14387
14388 : see if gethostent exists
14389 set gethostent d_gethent
14390 eval $inlibc
14391
14392 : see how we will look up host name
14393 echo " "
14394 call=''
14395 if set gethostname val -f d_gethname; eval $csym; $val; then
14396         echo 'gethostname() found.' >&4
14397         d_gethname="$define"
14398         call=gethostname
14399 fi
14400 if set uname val -f d_uname; eval $csym; $val; then
14401         if ./xenix; then
14402                 $cat <<'EOM'
14403 uname() was found, but you're running xenix, and older versions of xenix
14404 have a broken uname(). If you don't really know whether your xenix is old
14405 enough to have a broken system call, use the default answer.
14406
14407 EOM
14408                 dflt=y
14409                 case "$d_uname" in
14410                 "$define") dflt=n;;
14411                 esac
14412                 rp='Is your uname() broken?'
14413                 . ./myread
14414                 case "$ans" in
14415                 n*) d_uname="$define"; call=uname;;
14416                 esac
14417         else
14418                 echo 'uname() found.' >&4
14419                 d_uname="$define"
14420                 case "$call" in
14421                 '') call=uname ;;
14422                 esac
14423         fi
14424 fi
14425 case "$d_gethname" in
14426 '') d_gethname="$undef";;
14427 esac
14428 case "$d_uname" in
14429 '') d_uname="$undef";;
14430 esac
14431 case "$d_uname$d_gethname" in
14432 *define*)
14433         dflt=n
14434         cat <<EOM
14435
14436 Every now and then someone has a $call() that lies about the hostname
14437 but can't be fixed for political or economic reasons.  If you wish, I can
14438 pretend $call() isn't there and maybe compute hostname at run-time
14439 thanks to the '$phostname' command.
14440
14441 EOM
14442         rp="Shall I ignore $call() from now on?"
14443         . ./myread
14444         case "$ans" in
14445         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14446         esac;;
14447 esac
14448 case "$phostname" in
14449 '') aphostname='';;
14450 *) case "$aphostname" in
14451         /*) ;;
14452         *) set X $phostname
14453                 shift
14454                 file=$1
14455                 shift
14456                 file=`./loc $file $file $pth`
14457                 aphostname=`echo $file $*`
14458                 ;;
14459         esac
14460         ;;
14461 esac
14462 case "$d_uname$d_gethname" in
14463 *define*) ;;
14464 *)
14465         case "$phostname" in
14466         '')
14467                 echo "There will be no way for $package to get your hostname." >&4;;
14468         *)
14469         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14470                 ;;
14471         esac;;
14472 esac
14473 case "$d_phostname" in
14474 '') d_phostname="$undef";;
14475 esac
14476
14477 : see if gethostbyaddr_r exists
14478 set gethostbyaddr_r d_gethostbyaddr_r
14479 eval $inlibc
14480 case "$d_gethostbyaddr_r" in
14481 "$define")
14482         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14483         case "$d_gethostbyaddr_r_proto:$usethreads" in
14484         ":define")      d_gethostbyaddr_r_proto=define
14485                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14486                 eval $hasproto ;;
14487         *)      ;;
14488         esac
14489         case "$d_gethostbyaddr_r_proto" in
14490         define)
14491         case "$gethostbyaddr_r_proto" in
14492         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14493         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14494         esac
14495         case "$gethostbyaddr_r_proto" in
14496         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14497         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14498         esac
14499         case "$gethostbyaddr_r_proto" in
14500         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14501         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14502         esac
14503         case "$gethostbyaddr_r_proto" in
14504         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14505         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14506         esac
14507         case "$gethostbyaddr_r_proto" in
14508         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14509         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14510         esac
14511         case "$gethostbyaddr_r_proto" in
14512         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14513         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14514         esac
14515         case "$gethostbyaddr_r_proto" in
14516         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14517         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14518         esac
14519         case "$gethostbyaddr_r_proto" in
14520         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14521         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14522         esac
14523         case "$gethostbyaddr_r_proto" in
14524         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14525         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14526         esac
14527         case "$gethostbyaddr_r_proto" in
14528         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14529         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14530         esac
14531         case "$gethostbyaddr_r_proto" in
14532         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14533         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14534         esac
14535         case "$gethostbyaddr_r_proto" in
14536         ''|0)   d_gethostbyaddr_r=undef
14537                 gethostbyaddr_r_proto=0
14538                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14539         * )     case "$gethostbyaddr_r_proto" in
14540                 REENTRANT_PROTO*) ;;
14541                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14542                 esac
14543                 echo "Prototype: $try" ;;
14544         esac
14545         ;;
14546         *)      case "$usethreads" in
14547                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14548                 esac
14549                 d_gethostbyaddr_r=undef
14550                 gethostbyaddr_r_proto=0
14551                 ;;
14552         esac
14553         ;;
14554 *)      gethostbyaddr_r_proto=0
14555         ;;
14556 esac
14557
14558 : see if gethostbyname_r exists
14559 set gethostbyname_r d_gethostbyname_r
14560 eval $inlibc
14561 case "$d_gethostbyname_r" in
14562 "$define")
14563         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14564         case "$d_gethostbyname_r_proto:$usethreads" in
14565         ":define")      d_gethostbyname_r_proto=define
14566                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14567                 eval $hasproto ;;
14568         *)      ;;
14569         esac
14570         case "$d_gethostbyname_r_proto" in
14571         define)
14572         case "$gethostbyname_r_proto" in
14573         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14574         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14575         esac
14576         case "$gethostbyname_r_proto" in
14577         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14578         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14579         esac
14580         case "$gethostbyname_r_proto" in
14581         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14582         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14583         esac
14584         case "$gethostbyname_r_proto" in
14585         ''|0)   d_gethostbyname_r=undef
14586                 gethostbyname_r_proto=0
14587                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14588         * )     case "$gethostbyname_r_proto" in
14589                 REENTRANT_PROTO*) ;;
14590                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14591                 esac
14592                 echo "Prototype: $try" ;;
14593         esac
14594         ;;
14595         *)      case "$usethreads" in
14596                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14597                 esac
14598                 d_gethostbyname_r=undef
14599                 gethostbyname_r_proto=0
14600                 ;;
14601         esac
14602         ;;
14603 *)      gethostbyname_r_proto=0
14604         ;;
14605 esac
14606
14607 : see if gethostent_r exists
14608 set gethostent_r d_gethostent_r
14609 eval $inlibc
14610 case "$d_gethostent_r" in
14611 "$define")
14612         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14613         case "$d_gethostent_r_proto:$usethreads" in
14614         ":define")      d_gethostent_r_proto=define
14615                 set d_gethostent_r_proto gethostent_r $hdrs
14616                 eval $hasproto ;;
14617         *)      ;;
14618         esac
14619         case "$d_gethostent_r_proto" in
14620         define)
14621         case "$gethostent_r_proto" in
14622         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14623         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14624         esac
14625         case "$gethostent_r_proto" in
14626         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14627         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14628         esac
14629         case "$gethostent_r_proto" in
14630         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14631         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14632         esac
14633         case "$gethostent_r_proto" in
14634         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14635         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14636         esac
14637         case "$gethostent_r_proto" in
14638         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14639         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14640         esac
14641         case "$gethostent_r_proto" in
14642         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14643         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14644         esac
14645         case "$gethostent_r_proto" in
14646         ''|0)   d_gethostent_r=undef
14647                 gethostent_r_proto=0
14648                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14649         * )     case "$gethostent_r_proto" in
14650                 REENTRANT_PROTO*) ;;
14651                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14652                 esac
14653                 echo "Prototype: $try" ;;
14654         esac
14655         ;;
14656         *)      case "$usethreads" in
14657                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14658                 esac
14659                 d_gethostent_r=undef
14660                 gethostent_r_proto=0
14661                 ;;
14662         esac
14663         ;;
14664 *)      gethostent_r_proto=0
14665         ;;
14666 esac
14667
14668 : see if prototypes for various gethostxxx netdb.h functions are available
14669 echo " "
14670 set d_gethostprotos gethostent $i_netdb netdb.h
14671 eval $hasproto
14672
14673 : see if getitimer exists
14674 set getitimer d_getitimer
14675 eval $inlibc
14676
14677 : see if getlogin exists
14678 set getlogin d_getlogin
14679 eval $inlibc
14680
14681 : see if getlogin_r exists
14682 set getlogin_r d_getlogin_r
14683 eval $inlibc
14684 case "$d_getlogin_r" in
14685 "$define")
14686         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14687         case "$d_getlogin_r_proto:$usethreads" in
14688         ":define")      d_getlogin_r_proto=define
14689                 set d_getlogin_r_proto getlogin_r $hdrs
14690                 eval $hasproto ;;
14691         *)      ;;
14692         esac
14693         case "$d_getlogin_r_proto" in
14694         define)
14695         case "$getlogin_r_proto" in
14696         ''|0) try='int getlogin_r(char*, size_t);'
14697         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14698         esac
14699         case "$getlogin_r_proto" in
14700         ''|0) try='int getlogin_r(char*, int);'
14701         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14702         esac
14703         case "$getlogin_r_proto" in
14704         ''|0) try='char* getlogin_r(char*, size_t);'
14705         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14706         esac
14707         case "$getlogin_r_proto" in
14708         ''|0) try='char* getlogin_r(char*, int);'
14709         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14710         esac
14711         case "$getlogin_r_proto" in
14712         ''|0)   d_getlogin_r=undef
14713                 getlogin_r_proto=0
14714                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14715         * )     case "$getlogin_r_proto" in
14716                 REENTRANT_PROTO*) ;;
14717                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14718                 esac
14719                 echo "Prototype: $try" ;;
14720         esac
14721         ;;
14722         *)      case "$usethreads" in
14723                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14724                 esac
14725                 d_getlogin_r=undef
14726                 getlogin_r_proto=0
14727                 ;;
14728         esac
14729         ;;
14730 *)      getlogin_r_proto=0
14731         ;;
14732 esac
14733
14734 : see if getmnt exists
14735 set getmnt d_getmnt
14736 eval $inlibc
14737
14738 : see if getmntent exists
14739 set getmntent d_getmntent
14740 eval $inlibc
14741
14742 : see if getnameinfo exists
14743 set getnameinfo d_getnameinfo
14744 eval $inlibc
14745
14746 : see if getnetbyaddr exists
14747 set getnetbyaddr d_getnbyaddr
14748 eval $inlibc
14749
14750 : see if getnetbyname exists
14751 set getnetbyname d_getnbyname
14752 eval $inlibc
14753
14754 : see if getnetent exists
14755 set getnetent d_getnent
14756 eval $inlibc
14757
14758 : see if getnetbyaddr_r exists
14759 set getnetbyaddr_r d_getnetbyaddr_r
14760 eval $inlibc
14761 case "$d_getnetbyaddr_r" in
14762 "$define")
14763         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14764         case "$d_getnetbyaddr_r_proto:$usethreads" in
14765         ":define")      d_getnetbyaddr_r_proto=define
14766                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14767                 eval $hasproto ;;
14768         *)      ;;
14769         esac
14770         case "$d_getnetbyaddr_r_proto" in
14771         define)
14772         case "$getnetbyaddr_r_proto" in
14773         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14774         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14775         esac
14776         case "$getnetbyaddr_r_proto" in
14777         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14778         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14779         esac
14780         case "$getnetbyaddr_r_proto" in
14781         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14782         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14783         esac
14784         case "$getnetbyaddr_r_proto" in
14785         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14786         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14787         esac
14788         case "$getnetbyaddr_r_proto" in
14789         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14790         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14791         esac
14792         case "$getnetbyaddr_r_proto" in
14793         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14794         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14795         esac
14796         case "$getnetbyaddr_r_proto" in
14797         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14798         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14799         esac
14800         case "$getnetbyaddr_r_proto" in
14801         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14802         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14803         esac
14804         case "$getnetbyaddr_r_proto" in
14805         ''|0)   d_getnetbyaddr_r=undef
14806                 getnetbyaddr_r_proto=0
14807                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14808         * )     case "$getnetbyaddr_r_proto" in
14809                 REENTRANT_PROTO*) ;;
14810                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14811                 esac
14812                 echo "Prototype: $try" ;;
14813         esac
14814         ;;
14815         *)      case "$usethreads" in
14816                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14817                 esac
14818                 d_getnetbyaddr_r=undef
14819                 getnetbyaddr_r_proto=0
14820                 ;;
14821         esac
14822         ;;
14823 *)      getnetbyaddr_r_proto=0
14824         ;;
14825 esac
14826
14827 : see if getnetbyname_r exists
14828 set getnetbyname_r d_getnetbyname_r
14829 eval $inlibc
14830 case "$d_getnetbyname_r" in
14831 "$define")
14832         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14833         case "$d_getnetbyname_r_proto:$usethreads" in
14834         ":define")      d_getnetbyname_r_proto=define
14835                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14836                 eval $hasproto ;;
14837         *)      ;;
14838         esac
14839         case "$d_getnetbyname_r_proto" in
14840         define)
14841         case "$getnetbyname_r_proto" in
14842         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14843         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14844         esac
14845         case "$getnetbyname_r_proto" in
14846         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14847         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14848         esac
14849         case "$getnetbyname_r_proto" in
14850         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14851         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14852         esac
14853         case "$getnetbyname_r_proto" in
14854         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14855         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14856         esac
14857         case "$getnetbyname_r_proto" in
14858         ''|0)   d_getnetbyname_r=undef
14859                 getnetbyname_r_proto=0
14860                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14861         * )     case "$getnetbyname_r_proto" in
14862                 REENTRANT_PROTO*) ;;
14863                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14864                 esac
14865                 echo "Prototype: $try" ;;
14866         esac
14867         ;;
14868         *)      case "$usethreads" in
14869                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14870                 esac
14871                 d_getnetbyname_r=undef
14872                 getnetbyname_r_proto=0
14873                 ;;
14874         esac
14875         ;;
14876 *)      getnetbyname_r_proto=0
14877         ;;
14878 esac
14879
14880 : see if getnetent_r exists
14881 set getnetent_r d_getnetent_r
14882 eval $inlibc
14883 case "$d_getnetent_r" in
14884 "$define")
14885         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14886         case "$d_getnetent_r_proto:$usethreads" in
14887         ":define")      d_getnetent_r_proto=define
14888                 set d_getnetent_r_proto getnetent_r $hdrs
14889                 eval $hasproto ;;
14890         *)      ;;
14891         esac
14892         case "$d_getnetent_r_proto" in
14893         define)
14894         case "$getnetent_r_proto" in
14895         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14896         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14897         esac
14898         case "$getnetent_r_proto" in
14899         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14900         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14901         esac
14902         case "$getnetent_r_proto" in
14903         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14904         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14905         esac
14906         case "$getnetent_r_proto" in
14907         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14908         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14909         esac
14910         case "$getnetent_r_proto" in
14911         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14912         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14913         esac
14914         case "$getnetent_r_proto" in
14915         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14916         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14917         esac
14918         case "$getnetent_r_proto" in
14919         ''|0)   d_getnetent_r=undef
14920                 getnetent_r_proto=0
14921                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14922         * )     case "$getnetent_r_proto" in
14923                 REENTRANT_PROTO*) ;;
14924                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14925                 esac
14926                 echo "Prototype: $try" ;;
14927         esac
14928         ;;
14929         *)      case "$usethreads" in
14930                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14931                 esac
14932                 d_getnetent_r=undef
14933                 getnetent_r_proto=0
14934                 ;;
14935         esac
14936         ;;
14937 *)      getnetent_r_proto=0
14938         ;;
14939 esac
14940
14941 : see if prototypes for various getnetxxx netdb.h functions are available
14942 echo " "
14943 set d_getnetprotos getnetent $i_netdb netdb.h
14944 eval $hasproto
14945
14946 : see if getpagesize exists
14947 set getpagesize d_getpagsz
14948 eval $inlibc
14949
14950 : Optional checks for getprotobyname and getprotobynumber
14951
14952 : see if getprotobyname exists
14953 set getprotobyname d_getpbyname
14954 eval $inlibc
14955
14956 : see if getprotobynumber exists
14957 set getprotobynumber d_getpbynumber
14958 eval $inlibc
14959
14960 : see if getprotoent exists
14961 set getprotoent d_getpent
14962 eval $inlibc
14963
14964 : see if getpgid exists
14965 set getpgid d_getpgid
14966 eval $inlibc
14967
14968 : see if getpgrp2 exists
14969 set getpgrp2 d_getpgrp2
14970 eval $inlibc
14971
14972 : see if getppid exists
14973 set getppid d_getppid
14974 eval $inlibc
14975
14976 : see if getpriority exists
14977 set getpriority d_getprior
14978 eval $inlibc
14979
14980 : see if getprotobyname_r exists
14981 set getprotobyname_r d_getprotobyname_r
14982 eval $inlibc
14983 case "$d_getprotobyname_r" in
14984 "$define")
14985         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14986         case "$d_getprotobyname_r_proto:$usethreads" in
14987         ":define")      d_getprotobyname_r_proto=define
14988                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14989                 eval $hasproto ;;
14990         *)      ;;
14991         esac
14992         case "$d_getprotobyname_r_proto" in
14993         define)
14994         case "$getprotobyname_r_proto" in
14995         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14996         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14997         esac
14998         case "$getprotobyname_r_proto" in
14999         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15000         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15001         esac
15002         case "$getprotobyname_r_proto" in
15003         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15004         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15005         esac
15006         case "$getprotobyname_r_proto" in
15007         ''|0)   d_getprotobyname_r=undef
15008                 getprotobyname_r_proto=0
15009                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15010         * )     case "$getprotobyname_r_proto" in
15011                 REENTRANT_PROTO*) ;;
15012                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15013                 esac
15014                 echo "Prototype: $try" ;;
15015         esac
15016         ;;
15017         *)      case "$usethreads" in
15018                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15019                 esac
15020                 d_getprotobyname_r=undef
15021                 getprotobyname_r_proto=0
15022                 ;;
15023         esac
15024         ;;
15025 *)      getprotobyname_r_proto=0
15026         ;;
15027 esac
15028
15029 : see if getprotobynumber_r exists
15030 set getprotobynumber_r d_getprotobynumber_r
15031 eval $inlibc
15032 case "$d_getprotobynumber_r" in
15033 "$define")
15034         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15035         case "$d_getprotobynumber_r_proto:$usethreads" in
15036         ":define")      d_getprotobynumber_r_proto=define
15037                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15038                 eval $hasproto ;;
15039         *)      ;;
15040         esac
15041         case "$d_getprotobynumber_r_proto" in
15042         define)
15043         case "$getprotobynumber_r_proto" in
15044         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15045         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15046         esac
15047         case "$getprotobynumber_r_proto" in
15048         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15049         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15050         esac
15051         case "$getprotobynumber_r_proto" in
15052         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15053         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15054         esac
15055         case "$getprotobynumber_r_proto" in
15056         ''|0)   d_getprotobynumber_r=undef
15057                 getprotobynumber_r_proto=0
15058                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15059         * )     case "$getprotobynumber_r_proto" in
15060                 REENTRANT_PROTO*) ;;
15061                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15062                 esac
15063                 echo "Prototype: $try" ;;
15064         esac
15065         ;;
15066         *)      case "$usethreads" in
15067                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15068                 esac
15069                 d_getprotobynumber_r=undef
15070                 getprotobynumber_r_proto=0
15071                 ;;
15072         esac
15073         ;;
15074 *)      getprotobynumber_r_proto=0
15075         ;;
15076 esac
15077
15078 : see if getprotoent_r exists
15079 set getprotoent_r d_getprotoent_r
15080 eval $inlibc
15081 case "$d_getprotoent_r" in
15082 "$define")
15083         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15084         case "$d_getprotoent_r_proto:$usethreads" in
15085         ":define")      d_getprotoent_r_proto=define
15086                 set d_getprotoent_r_proto getprotoent_r $hdrs
15087                 eval $hasproto ;;
15088         *)      ;;
15089         esac
15090         case "$d_getprotoent_r_proto" in
15091         define)
15092         case "$getprotoent_r_proto" in
15093         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15094         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15095         esac
15096         case "$getprotoent_r_proto" in
15097         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15098         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15099         esac
15100         case "$getprotoent_r_proto" in
15101         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15102         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15103         esac
15104         case "$getprotoent_r_proto" in
15105         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15106         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15107         esac
15108         case "$getprotoent_r_proto" in
15109         ''|0)   d_getprotoent_r=undef
15110                 getprotoent_r_proto=0
15111                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15112         * )     case "$getprotoent_r_proto" in
15113                 REENTRANT_PROTO*) ;;
15114                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15115                 esac
15116                 echo "Prototype: $try" ;;
15117         esac
15118         ;;
15119         *)      case "$usethreads" in
15120                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15121                 esac
15122                 d_getprotoent_r=undef
15123                 getprotoent_r_proto=0
15124                 ;;
15125         esac
15126         ;;
15127 *)      getprotoent_r_proto=0
15128         ;;
15129 esac
15130
15131 : see if prototypes for various getprotoxxx netdb.h functions are available
15132 echo " "
15133 set d_getprotoprotos getprotoent $i_netdb netdb.h
15134 eval $hasproto
15135
15136 : see if getprpwnam exists
15137 set getprpwnam d_getprpwnam
15138 eval $inlibc
15139
15140 : see if getpwent exists
15141 set getpwent d_getpwent
15142 eval $inlibc
15143
15144 : see if getpwent_r exists
15145 set getpwent_r d_getpwent_r
15146 eval $inlibc
15147 case "$d_getpwent_r" in
15148 "$define")
15149         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15150         case "$d_getpwent_r_proto:$usethreads" in
15151         ":define")      d_getpwent_r_proto=define
15152                 set d_getpwent_r_proto getpwent_r $hdrs
15153                 eval $hasproto ;;
15154         *)      ;;
15155         esac
15156         case "$d_getpwent_r_proto" in
15157         define)
15158         case "$getpwent_r_proto" in
15159         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15160         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15161         esac
15162         case "$getpwent_r_proto" in
15163         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15164         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15165         esac
15166         case "$getpwent_r_proto" in
15167         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15168         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15169         esac
15170         case "$getpwent_r_proto" in
15171         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15172         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15173         esac
15174         case "$getpwent_r_proto" in
15175         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15176         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15177         esac
15178         case "$getpwent_r_proto" in
15179         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15180         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15181         esac
15182         case "$getpwent_r_proto" in
15183         ''|0)   d_getpwent_r=undef
15184                 getpwent_r_proto=0
15185                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15186         * )     case "$getpwent_r_proto" in
15187                 REENTRANT_PROTO*) ;;
15188                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15189                 esac
15190                 echo "Prototype: $try" ;;
15191         esac
15192         ;;
15193         *)      case "$usethreads" in
15194                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15195                 esac
15196                 d_getpwent_r=undef
15197                 getpwent_r_proto=0
15198                 ;;
15199         esac
15200         ;;
15201 *)      getpwent_r_proto=0
15202         ;;
15203 esac
15204
15205 : see if getpwnam_r exists
15206 set getpwnam_r d_getpwnam_r
15207 eval $inlibc
15208 case "$d_getpwnam_r" in
15209 "$define")
15210         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15211         case "$d_getpwnam_r_proto:$usethreads" in
15212         ":define")      d_getpwnam_r_proto=define
15213                 set d_getpwnam_r_proto getpwnam_r $hdrs
15214                 eval $hasproto ;;
15215         *)      ;;
15216         esac
15217         case "$d_getpwnam_r_proto" in
15218         define)
15219         case "$getpwnam_r_proto" in
15220         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15221         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15222         esac
15223         case "$getpwnam_r_proto" in
15224         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15225         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15226         esac
15227         case "$getpwnam_r_proto" in
15228         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15229         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15230         esac
15231         case "$getpwnam_r_proto" in
15232         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15233         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15234         esac
15235         case "$getpwnam_r_proto" in
15236         ''|0)   d_getpwnam_r=undef
15237                 getpwnam_r_proto=0
15238                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15239         * )     case "$getpwnam_r_proto" in
15240                 REENTRANT_PROTO*) ;;
15241                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15242                 esac
15243                 echo "Prototype: $try" ;;
15244         esac
15245         ;;
15246         *)      case "$usethreads" in
15247                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15248                 esac
15249                 d_getpwnam_r=undef
15250                 getpwnam_r_proto=0
15251                 ;;
15252         esac
15253         ;;
15254 *)      getpwnam_r_proto=0
15255         ;;
15256 esac
15257
15258 : see if getpwuid_r exists
15259 set getpwuid_r d_getpwuid_r
15260 eval $inlibc
15261 case "$d_getpwuid_r" in
15262 "$define")
15263         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15264         case "$d_getpwuid_r_proto:$usethreads" in
15265         ":define")      d_getpwuid_r_proto=define
15266                 set d_getpwuid_r_proto getpwuid_r $hdrs
15267                 eval $hasproto ;;
15268         *)      ;;
15269         esac
15270         case "$d_getpwuid_r_proto" in
15271         define)
15272         case "$getpwuid_r_proto" in
15273         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15274         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15275         esac
15276         case "$getpwuid_r_proto" in
15277         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15278         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15279         esac
15280         case "$getpwuid_r_proto" in
15281         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15282         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15283         esac
15284         case "$getpwuid_r_proto" in
15285         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15286         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15287         esac
15288         case "$getpwuid_r_proto" in
15289         ''|0)   d_getpwuid_r=undef
15290                 getpwuid_r_proto=0
15291                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15292         * )     case "$getpwuid_r_proto" in
15293                 REENTRANT_PROTO*) ;;
15294                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15295                 esac
15296                 echo "Prototype: $try" ;;
15297         esac
15298         ;;
15299         *)      case "$usethreads" in
15300                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15301                 esac
15302                 d_getpwuid_r=undef
15303                 getpwuid_r_proto=0
15304                 ;;
15305         esac
15306         ;;
15307 *)      getpwuid_r_proto=0
15308         ;;
15309 esac
15310
15311 : Optional checks for getsbyname and getsbyport
15312
15313 : see if getservbyname exists
15314 set getservbyname d_getsbyname
15315 eval $inlibc
15316
15317 : see if getservbyport exists
15318 set getservbyport d_getsbyport
15319 eval $inlibc
15320
15321 : see if getservent exists
15322 set getservent d_getsent
15323 eval $inlibc
15324
15325 : see if getservbyname_r exists
15326 set getservbyname_r d_getservbyname_r
15327 eval $inlibc
15328 case "$d_getservbyname_r" in
15329 "$define")
15330         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15331         case "$d_getservbyname_r_proto:$usethreads" in
15332         ":define")      d_getservbyname_r_proto=define
15333                 set d_getservbyname_r_proto getservbyname_r $hdrs
15334                 eval $hasproto ;;
15335         *)      ;;
15336         esac
15337         case "$d_getservbyname_r_proto" in
15338         define)
15339         case "$getservbyname_r_proto" in
15340         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15341         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15342         esac
15343         case "$getservbyname_r_proto" in
15344         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15345         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15346         esac
15347         case "$getservbyname_r_proto" in
15348         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15349         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15350         esac
15351         case "$getservbyname_r_proto" in
15352         ''|0)   d_getservbyname_r=undef
15353                 getservbyname_r_proto=0
15354                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15355         * )     case "$getservbyname_r_proto" in
15356                 REENTRANT_PROTO*) ;;
15357                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15358                 esac
15359                 echo "Prototype: $try" ;;
15360         esac
15361         ;;
15362         *)      case "$usethreads" in
15363                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15364                 esac
15365                 d_getservbyname_r=undef
15366                 getservbyname_r_proto=0
15367                 ;;
15368         esac
15369         ;;
15370 *)      getservbyname_r_proto=0
15371         ;;
15372 esac
15373
15374 : see if getservbyport_r exists
15375 set getservbyport_r d_getservbyport_r
15376 eval $inlibc
15377 case "$d_getservbyport_r" in
15378 "$define")
15379         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15380         case "$d_getservbyport_r_proto:$usethreads" in
15381         ":define")      d_getservbyport_r_proto=define
15382                 set d_getservbyport_r_proto getservbyport_r $hdrs
15383                 eval $hasproto ;;
15384         *)      ;;
15385         esac
15386         case "$d_getservbyport_r_proto" in
15387         define)
15388         case "$getservbyport_r_proto" in
15389         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15390         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15391         esac
15392         case "$getservbyport_r_proto" in
15393         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15394         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15395         esac
15396         case "$getservbyport_r_proto" in
15397         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15398         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15399         esac
15400         case "$getservbyport_r_proto" in
15401         ''|0)   d_getservbyport_r=undef
15402                 getservbyport_r_proto=0
15403                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15404         * )     case "$getservbyport_r_proto" in
15405                 REENTRANT_PROTO*) ;;
15406                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15407                 esac
15408                 echo "Prototype: $try" ;;
15409         esac
15410         ;;
15411         *)      case "$usethreads" in
15412                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15413                 esac
15414                 d_getservbyport_r=undef
15415                 getservbyport_r_proto=0
15416                 ;;
15417         esac
15418         ;;
15419 *)      getservbyport_r_proto=0
15420         ;;
15421 esac
15422
15423 : see if getservent_r exists
15424 set getservent_r d_getservent_r
15425 eval $inlibc
15426 case "$d_getservent_r" in
15427 "$define")
15428         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15429         case "$d_getservent_r_proto:$usethreads" in
15430         ":define")      d_getservent_r_proto=define
15431                 set d_getservent_r_proto getservent_r $hdrs
15432                 eval $hasproto ;;
15433         *)      ;;
15434         esac
15435         case "$d_getservent_r_proto" in
15436         define)
15437         case "$getservent_r_proto" in
15438         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15439         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15440         esac
15441         case "$getservent_r_proto" in
15442         ''|0) try='int getservent_r(struct servent*, char*, int);'
15443         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15444         esac
15445         case "$getservent_r_proto" in
15446         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15447         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15448         esac
15449         case "$getservent_r_proto" in
15450         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15451         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15452         esac
15453         case "$getservent_r_proto" in
15454         ''|0)   d_getservent_r=undef
15455                 getservent_r_proto=0
15456                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15457         * )     case "$getservent_r_proto" in
15458                 REENTRANT_PROTO*) ;;
15459                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15460                 esac
15461                 echo "Prototype: $try" ;;
15462         esac
15463         ;;
15464         *)      case "$usethreads" in
15465                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15466                 esac
15467                 d_getservent_r=undef
15468                 getservent_r_proto=0
15469                 ;;
15470         esac
15471         ;;
15472 *)      getservent_r_proto=0
15473         ;;
15474 esac
15475
15476 : see if prototypes for various getservxxx netdb.h functions are available
15477 echo " "
15478 set d_getservprotos getservent $i_netdb netdb.h
15479 eval $hasproto
15480
15481 : see if getspnam exists
15482 set getspnam d_getspnam
15483 eval $inlibc
15484
15485 : see if this is a shadow.h system
15486 set shadow.h i_shadow
15487 eval $inhdr
15488
15489 : see if getspnam_r exists
15490 set getspnam_r d_getspnam_r
15491 eval $inlibc
15492 case "$d_getspnam_r" in
15493 "$define")
15494         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15495         case "$d_getspnam_r_proto:$usethreads" in
15496         ":define")      d_getspnam_r_proto=define
15497                 set d_getspnam_r_proto getspnam_r $hdrs
15498                 eval $hasproto ;;
15499         *)      ;;
15500         esac
15501         case "$d_getspnam_r_proto" in
15502         define)
15503         case "$getspnam_r_proto" in
15504         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15505         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15506         esac
15507         case "$getspnam_r_proto" in
15508         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15509         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15510         esac
15511         case "$getspnam_r_proto" in
15512         ''|0)   d_getspnam_r=undef
15513                 getspnam_r_proto=0
15514                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15515         * )     case "$getspnam_r_proto" in
15516                 REENTRANT_PROTO*) ;;
15517                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15518                 esac
15519                 echo "Prototype: $try" ;;
15520         esac
15521         ;;
15522         *)      case "$usethreads" in
15523                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15524                 esac
15525                 d_getspnam_r=undef
15526                 getspnam_r_proto=0
15527                 ;;
15528         esac
15529         ;;
15530 *)      getspnam_r_proto=0
15531         ;;
15532 esac
15533
15534 : see if gettimeofday or ftime exists
15535 set gettimeofday d_gettimeod
15536 eval $inlibc
15537 case "$d_gettimeod" in
15538 "$undef")
15539         set ftime d_ftime 
15540         eval $inlibc
15541         ;;
15542 *)
15543         val="$undef"; set d_ftime; eval $setvar
15544         ;;
15545 esac
15546 case "$d_gettimeod$d_ftime" in
15547 "$undef$undef")
15548         echo " "
15549         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15550         ;;
15551 esac
15552
15553 : see if gmtime_r exists
15554 set gmtime_r d_gmtime_r
15555 eval $inlibc
15556 case "$d_gmtime_r" in
15557 "$define")
15558         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15559         case "$d_gmtime_r_proto:$usethreads" in
15560         ":define")      d_gmtime_r_proto=define
15561                 set d_gmtime_r_proto gmtime_r $hdrs
15562                 eval $hasproto ;;
15563         *)      ;;
15564         esac
15565         case "$d_gmtime_r_proto" in
15566         define)
15567         case "$gmtime_r_proto" in
15568         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15569         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15570         esac
15571         case "$gmtime_r_proto" in
15572         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15573         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15574         esac
15575         case "$gmtime_r_proto" in
15576         ''|0)   d_gmtime_r=undef
15577                 gmtime_r_proto=0
15578                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15579         * )     case "$gmtime_r_proto" in
15580                 REENTRANT_PROTO*) ;;
15581                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15582                 esac
15583                 echo "Prototype: $try" ;;
15584         esac
15585         ;;
15586         *)      case "$usethreads" in
15587                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15588                 esac
15589                 d_gmtime_r=undef
15590                 gmtime_r_proto=0
15591                 ;;
15592         esac
15593         ;;
15594 *)      gmtime_r_proto=0
15595         ;;
15596 esac
15597
15598 : see if hasmntopt exists
15599 set hasmntopt d_hasmntopt
15600 eval $inlibc
15601
15602 : see if this is a netinet/in.h or sys/in.h system
15603 set netinet/in.h i_niin sys/in.h i_sysin
15604 eval $inhdr
15605
15606 : see if arpa/inet.h has to be included
15607 set arpa/inet.h i_arpainet
15608 eval $inhdr
15609
15610 : see if htonl --and friends-- exists
15611 val=''
15612 set htonl val
15613 eval $inlibc
15614
15615 : Maybe they are macros.
15616 case "$val" in
15617 $undef)
15618         $cat >htonl.c <<EOM
15619 #include <stdio.h>
15620 #include <sys/types.h>
15621 #$i_niin I_NETINET_IN
15622 #$i_sysin I_SYS_IN
15623 #$i_arpainet I_ARPA_INET
15624 #ifdef I_NETINET_IN
15625 #include <netinet/in.h>
15626 #endif
15627 #ifdef I_SYS_IN
15628 #include <sys/in.h>
15629 #endif
15630 #ifdef I_ARPA_INET
15631 #include <arpa/inet.h>
15632 #endif
15633 #ifdef htonl
15634 printf("Defined as a macro.");
15635 #endif
15636 EOM
15637         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15638         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15639                 val="$define"
15640                 echo "But it seems to be defined as a macro." >&4
15641         fi
15642         $rm -f htonl.?
15643         ;;
15644 esac
15645 set d_htonl
15646 eval $setvar
15647
15648 : see if hypot exists
15649 set hypot d_hypot
15650 eval $inlibc
15651
15652 : see if ilogb exists
15653 set ilogb d_ilogb
15654 eval $inlibc
15655
15656 : see if ilogbl exists
15657 set ilogbl d_ilogbl
15658 eval $inlibc
15659
15660 : check whether inet_aton exists
15661 set inet_aton d_inetaton
15662 eval $inlibc
15663
15664 : see if inet_ntop exists
15665 set inet_ntop d_inetntop
15666 eval $inlibc
15667
15668 : see if inet_pton exists
15669 set inet_pton d_inetpton
15670 eval $inlibc
15671
15672 : Look for isascii
15673 echo " "
15674 $cat >isascii.c <<EOCP
15675 #include <stdio.h>
15676 #include <ctype.h>
15677 #$i_stdlib I_STDLIB
15678 #ifdef I_STDLIB
15679 #include <stdlib.h>
15680 #endif
15681 int main() {
15682         int c = 'A';
15683         if (isascii(c))
15684                 exit(0);
15685         else
15686                 exit(1);
15687 }
15688 EOCP
15689 set isascii
15690 if eval $compile; then
15691         echo "isascii() found." >&4
15692         val="$define"
15693 else
15694         echo "isascii() NOT found." >&4
15695         val="$undef"
15696 fi
15697 set d_isascii
15698 eval $setvar
15699 $rm -f isascii*
15700
15701 : Look for isblank
15702 echo " "
15703 $cat >isblank.c <<'EOCP'
15704 #include <stdio.h>
15705 #include <ctype.h>
15706 int main() {
15707         int c = ' ';
15708         if (isblank(c))
15709                 return 0 ;
15710         else
15711                 return 1 ;
15712 }
15713 EOCP
15714 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15715         echo "isblank() found." >&4
15716         val="$define"
15717 else
15718         echo "isblank() NOT found." >&4
15719         val="$undef"
15720 fi
15721 set d_isblank
15722 eval $setvar
15723 $rm -f isblank*
15724
15725 : check for isfinite
15726 echo "Checking to see if you have isfinite..." >&4
15727 $cat >try.c <<EOCP
15728 #include <math.h>
15729 int main() { return isfinite(0.0); }
15730 EOCP
15731 set try
15732 if eval $compile; then
15733         val="$define"
15734         echo "You have isfinite."
15735 else
15736         val="$undef"
15737         echo "You do not have isfinite."
15738 fi
15739 $rm_try
15740 set d_isfinite
15741 eval $setvar
15742
15743 : see if isfinitel exists
15744 set isfinitel d_isfinitel
15745 eval $inlibc
15746
15747 : check for isinf
15748 echo "Checking to see if you have isinf..." >&4
15749 $cat >try.c <<EOCP
15750 #include <math.h>
15751 int main() { return isinf(0.0); }
15752 EOCP
15753 set try
15754 if eval $compile; then
15755         val="$define"
15756         echo "You have isinf."
15757 else
15758         val="$undef"
15759         echo "You do not have isinf."
15760 fi
15761 $rm_try
15762 set d_isinf
15763 eval $setvar
15764
15765 : see if isinfl exists
15766 set isinfl d_isinfl
15767 eval $inlibc
15768
15769 : check for isless
15770 echo "Checking to see if you have isless..." >&4
15771 $cat >try.c <<EOCP
15772 #include <math.h>
15773 int main() { return isless(0.0); }
15774 EOCP
15775 set try
15776 if eval $compile; then
15777         val="$define"
15778         echo "You have isless."
15779 else
15780         val="$undef"
15781         echo "You do not have isless."
15782 fi
15783 $rm_try
15784 set d_isless
15785 eval $setvar
15786
15787 : check for isnan
15788 echo "Checking to see if you have isnan..." >&4
15789 $cat >try.c <<EOCP
15790 #include <math.h>
15791 int main() { return isnan(0.0); }
15792 EOCP
15793 set try
15794 if eval $compile; then
15795         val="$define"
15796         echo "You have isnan."
15797 else
15798         val="$undef"
15799         echo "You do not have isnan."
15800 fi
15801 $rm_try
15802 set d_isnan
15803 eval $setvar
15804
15805 : see if isnanl exists
15806 set isnanl d_isnanl
15807 eval $inlibc
15808
15809 : check for isnormal
15810 echo "Checking to see if you have isnormal..." >&4
15811 $cat >try.c <<EOCP
15812 #include <math.h>
15813 int main() { return isnormal(0.0); }
15814 EOCP
15815 set try
15816 if eval $compile; then
15817         val="$define"
15818         echo "You have isnormal."
15819 else
15820         val="$undef"
15821         echo "You do not have isnormal."
15822 fi
15823 $rm_try
15824 set d_isnormal
15825 eval $setvar
15826
15827 : see if j0 exists
15828 set j0 d_j0
15829 eval $inlibc
15830
15831 : see if j0l exists
15832 set j0l d_j0l
15833 eval $inlibc
15834
15835 : see if killpg exists
15836 set killpg d_killpg
15837 eval $inlibc
15838
15839 : see if localeconv exists
15840 set localeconv d_locconv
15841 eval $inlibc
15842
15843 : see if libc has the POSIX.1-2008 currency locale rules
15844 case "$d_locconv:$d_lc_monetary_2008" in
15845 $define:)
15846         $cat >try.c <<EOCP
15847 #include <locale.h>
15848 int main() {
15849         struct lconv *lc = localeconv();
15850         char int_p_cs_precedes = lc->int_p_cs_precedes;
15851         return 0;
15852 }
15853 EOCP
15854         set try
15855         if eval $compile; then
15856                 d_lc_monetary_2008="$define"
15857         else
15858                 d_lc_monetary_2008="$undef"
15859         fi;
15860         $rm_try
15861         ;;
15862 esac
15863
15864 : see if lchown exists
15865 echo " "
15866 $cat > try.c <<'EOCP'
15867 /* System header to define __stub macros and hopefully few prototypes,
15868     which can conflict with char lchown(); below.  */
15869 #include <assert.h>
15870 /* Override any gcc2 internal prototype to avoid an error.  */
15871 /* We use char because int might match the return type of a gcc2
15872    builtin and then its argument prototype would still apply.  */
15873 char lchown();
15874 int main() {
15875     /*  The GNU C library defines this for functions which it implements
15876         to always fail with ENOSYS.  Some functions are actually named
15877         something starting with __ and the normal name is an alias.  */
15878 #if defined (__stub_lchown) || defined (__stub___lchown)
15879 choke me
15880 #else
15881 lchown();
15882 #endif
15883 ; return 0; }
15884 EOCP
15885 set try
15886 if eval $compile; then
15887     $echo "lchown() found." >&4
15888     val="$define"
15889 else
15890     $echo "lchown() NOT found." >&4
15891     val="$undef"
15892 fi
15893 set d_lchown
15894 eval $setvar
15895
15896 : See if number of significant digits in a double precision number is known
15897 echo " "
15898 $cat >ldbl_dig.c <<EOM
15899 #include <limits.h>
15900 #include <float.h>
15901 #ifdef LDBL_DIG
15902 printf("Contains LDBL_DIG");
15903 #endif
15904 EOM
15905 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15906 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15907         echo "LDBL_DIG found." >&4
15908         val="$define"
15909 else
15910         echo "LDBL_DIG NOT found." >&4
15911         val="$undef"
15912 fi
15913 $rm -f ldbl_dig.?
15914 set d_ldbl_dig
15915 eval $setvar
15916
15917 : see if lgamma exists
15918 set lgamma d_lgamma
15919 eval $inlibc
15920
15921 : see if lgamma_r exists
15922 set lgamma_r d_lgamma_r
15923 eval $inlibc
15924
15925 : check to see if math.h defines _LIB_VERSION
15926 d_libm_lib_version="$undef"
15927 echo " "
15928 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15929 $cat >try.c <<EOCP
15930 #include <unistd.h>
15931 #include <math.h>
15932 int main (int argc, char *argv[])
15933 {
15934     printf ("%d\n", _LIB_VERSION);
15935     return (0);
15936     } /* main */
15937 EOCP
15938 set try
15939 if eval $compile; then
15940     foo=`$run ./try`
15941     echo "Yes, it does ($foo)" >&4
15942     d_libm_lib_version="$define"
15943 else
15944     echo "No, it does not (probably harmless)" >&4
15945     fi
15946 $rm_try
15947
15948 : see if link exists
15949 set link d_link
15950 eval $inlibc
15951
15952 : see if llrint exists
15953 set llrint d_llrint
15954 eval $inlibc
15955
15956 : see if llrintl exists
15957 set llrintl d_llrintl
15958 eval $inlibc
15959
15960 : see if llround exists
15961 set llround d_llround
15962 eval $inlibc
15963
15964 : see if llroundl exists
15965 set llroundl d_llroundl
15966 eval $inlibc
15967
15968 : see if localeconv_l exists
15969 set localeconv_l d_localeconv_l
15970 eval $inlibc
15971
15972 : see if localtime_r exists
15973 set localtime_r d_localtime_r
15974 eval $inlibc
15975 case "$d_localtime_r" in
15976 "$define")
15977         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15978         case "$d_localtime_r_proto:$usethreads" in
15979         ":define")      d_localtime_r_proto=define
15980                 set d_localtime_r_proto localtime_r $hdrs
15981                 eval $hasproto ;;
15982         *)      ;;
15983         esac
15984         case "$d_localtime_r_proto" in
15985         define)
15986         case "$localtime_r_proto" in
15987         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15988         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15989         esac
15990         case "$localtime_r_proto" in
15991         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15992         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15993         esac
15994         case "$localtime_r_proto" in
15995         ''|0)   d_localtime_r=undef
15996                 localtime_r_proto=0
15997                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15998         * )     case "$localtime_r_proto" in
15999                 REENTRANT_PROTO*) ;;
16000                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16001                 esac
16002                 echo "Prototype: $try" ;;
16003         esac
16004         ;;
16005         *)      case "$usethreads" in
16006                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16007                 esac
16008                 d_localtime_r=undef
16009                 localtime_r_proto=0
16010                 ;;
16011         esac
16012         ;;
16013 *)      localtime_r_proto=0
16014         ;;
16015 esac
16016
16017 : see if localtime_r calls tzset
16018 case "$localtime_r_proto" in
16019 REENTRANT_PROTO*)
16020         $cat >try.c <<EOCP
16021 /*  Does our libc's localtime_r call tzset ?
16022  *  return 0 if so, 1 otherwise.
16023  */
16024 #$i_systypes    I_SYS_TYPES
16025 #$i_unistd      I_UNISTD
16026 #$i_time        I_TIME
16027 #$i_stdlib      I_STDLIB
16028 #$i_malloc      I_MALLOC
16029 #ifdef I_SYS_TYPES
16030 #  include <sys/types.h>
16031 #endif
16032 #ifdef I_UNISTD
16033 #  include <unistd.h>
16034 #endif
16035 #ifdef I_TIME
16036 #  include <time.h>
16037 #endif
16038 #ifdef I_STDLIB
16039 #include <stdlib.h>
16040 #endif
16041 #include <string.h>
16042 #ifdef I_MALLOC
16043 #  include <malloc.h>
16044 #endif
16045 int main()
16046 {
16047     time_t t = time(0L);
16048     char w_tz[]="TZ" "=GMT+5",
16049          e_tz[]="TZ" "=GMT-5",
16050         *tz_e = (char*)malloc(16),
16051         *tz_w = (char*)malloc(16);
16052     struct tm tm_e, tm_w;
16053     memset(&tm_e,'\0',sizeof(struct tm));
16054     memset(&tm_w,'\0',sizeof(struct tm));
16055     strcpy(tz_e,e_tz);
16056     strcpy(tz_w,w_tz);
16057
16058     putenv(tz_e);
16059     localtime_r(&t, &tm_e);
16060
16061     putenv(tz_w);
16062     localtime_r(&t, &tm_w);
16063
16064     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16065         return 1;
16066     return 0;
16067 }
16068 EOCP
16069         set try
16070         if eval $compile; then
16071             if $run ./try; then
16072                 d_localtime_r_needs_tzset=undef;
16073             else
16074                 d_localtime_r_needs_tzset=define;
16075             fi;
16076         else
16077             d_localtime_r_needs_tzset=undef;
16078         fi;
16079      ;;
16080   *)
16081      d_localtime_r_needs_tzset=undef;
16082      ;;
16083 esac
16084 $rm_try
16085
16086 : see if lockf exists
16087 set lockf d_lockf
16088 eval $inlibc
16089
16090 : see if log1p exists
16091 set log1p d_log1p
16092 eval $inlibc
16093
16094 : see if log2 exists
16095 set log2 d_log2
16096 eval $inlibc
16097
16098 : see if logb exists
16099 set logb d_logb
16100 eval $inlibc
16101
16102 : see if lrint exists
16103 set lrint d_lrint
16104 eval $inlibc
16105
16106 : see if lrintl exists
16107 set lrintl d_lrintl
16108 eval $inlibc
16109
16110 : see if lround exists
16111 set lround d_lround
16112 eval $inlibc
16113
16114 : see if lroundl exists
16115 set lroundl d_lroundl
16116 eval $inlibc
16117
16118 : see if prototype for lseek is available
16119 echo " "
16120 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16121 eval $hasproto
16122
16123 : see if lstat exists
16124 set lstat d_lstat
16125 eval $inlibc
16126
16127 : see if madvise exists
16128 set madvise d_madvise
16129 eval $inlibc
16130
16131 : see if malloc_size exists
16132 set malloc_size d_malloc_size
16133 eval $inlibc
16134
16135 : see if malloc_size_good exists
16136 set malloc_good_size d_malloc_good_size
16137 eval $inlibc
16138
16139 : see if mblen exists
16140 set mblen d_mblen
16141 eval $inlibc
16142
16143 : see if mbrlen exists
16144 set mbrlen d_mbrlen
16145 eval $inlibc
16146
16147 : see if mbrtowc exists
16148 set mbrtowc d_mbrtowc
16149 eval $inlibc
16150
16151 : see if mbstowcs exists
16152 set mbstowcs d_mbstowcs
16153 eval $inlibc
16154
16155 : see if mbtowc exists
16156 set mbtowc d_mbtowc
16157 eval $inlibc
16158
16159 : see if memmem exists
16160 set memmem d_memmem
16161 eval $inlibc
16162
16163 : see if memrchr exists
16164 set memrchr d_memrchr
16165 eval $inlibc
16166
16167 : see if mkdir exists
16168 set mkdir d_mkdir
16169 eval $inlibc
16170
16171 : see if mkdtemp exists
16172 set mkdtemp d_mkdtemp
16173 eval $inlibc
16174
16175 : see if mkfifo exists
16176 set mkfifo d_mkfifo
16177 eval $inlibc
16178
16179 : see if mkstemp exists
16180 set mkstemp d_mkstemp
16181 eval $inlibc
16182
16183 : see if mkstemps exists
16184 set mkstemps d_mkstemps
16185 eval $inlibc
16186
16187 : see if mktime exists
16188 set mktime d_mktime
16189 eval $inlibc
16190
16191 : see if sys/mman.h has to be included
16192 set sys/mman.h i_sysmman
16193 eval $inhdr
16194
16195 : see if mmap exists
16196 set mmap d_mmap
16197 eval $inlibc
16198 : see what shmat returns
16199 : default to something harmless
16200 mmaptype='void *'
16201 case "$i_sysmman$d_mmap" in
16202 "$define$define")
16203         $cat >mmap.c <<'END'
16204 #include <sys/mman.h>
16205 void *mmap();
16206 END
16207         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16208                 mmaptype='void *'
16209         else
16210                 mmaptype='caddr_t'
16211         fi
16212         echo "and it returns ($mmaptype)." >&4
16213         ;;
16214 esac
16215
16216
16217
16218 : see if sqrtl exists
16219 set sqrtl d_sqrtl
16220 eval $inlibc
16221
16222 : see if scalbnl exists
16223 set scalbnl d_scalbnl
16224 eval $inlibc
16225
16226 : see if truncl exists
16227 set truncl d_truncl
16228 eval $inlibc
16229
16230 : see if modfl exists
16231 set modfl d_modfl
16232 eval $inlibc
16233
16234 : see if prototype for modfl is available
16235 echo " "
16236 set d_modflproto modfl define math.h
16237 eval $hasproto
16238
16239 if $test "$uselongdouble" = "$define"; then
16240     message=""
16241     if $test "$d_sqrtl" != "$define"; then
16242         message="$message sqrtl"
16243     fi
16244     if $test "$d_modfl" != "$define"; then
16245         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16246             echo "You have both truncl and copysignl, so I can emulate modfl."
16247         else
16248             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16249                 echo "You have both aintl and copysignl, so I can emulate modfl."
16250             else
16251                 message="$message modfl"
16252             fi
16253         fi
16254     fi
16255     if $test "$d_frexpl" != "$define"; then
16256         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16257             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16258         else
16259             message="$message frexpl"
16260         fi
16261     fi
16262     if $test "$d_ldexpl" != "$define"; then
16263         message="$message ldexpl"
16264     fi
16265
16266     if $test "$message" != ""; then
16267         $cat <<EOM >&4
16268
16269 *** You requested the use of long doubles but you do not seem to have
16270 *** the following mathematical functions needed for long double support:
16271 ***    $message
16272 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16273 *** Cannot continue, aborting.
16274
16275 EOM
16276
16277         exit 1
16278     fi
16279 fi
16280
16281 : see if mprotect exists
16282 set mprotect d_mprotect
16283 eval $inlibc
16284
16285 : see if msgctl exists
16286 set msgctl d_msgctl
16287 eval $inlibc
16288
16289 : see if msgget exists
16290 set msgget d_msgget
16291 eval $inlibc
16292
16293 : see if msgsnd exists
16294 set msgsnd d_msgsnd
16295 eval $inlibc
16296
16297 : see if msgrcv exists
16298 set msgrcv d_msgrcv
16299 eval $inlibc
16300
16301 : see how much of the 'msg*(2)' library is present.
16302 h_msg=true
16303 echo " "
16304 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16305 *"$undef"*) h_msg=false;;
16306 esac
16307 case "$osname" in
16308 freebsd)
16309     case "`ipcs 2>&1`" in
16310     "SVID messages"*"not configured"*)
16311         echo "Your $osname does not have the msg*(2) configured." >&4
16312         h_msg=false
16313         val="$undef"
16314         set msgctl d_msgctl
16315         eval $setvar
16316         set msgget d_msgget
16317         eval $setvar
16318         set msgsnd d_msgsnd
16319         eval $setvar
16320         set msgrcv d_msgrcv
16321         eval $setvar
16322         ;;
16323     esac
16324     ;;
16325 esac
16326 : we could also check for sys/ipc.h ...
16327 if $h_msg && $test `./findhdr sys/msg.h`; then
16328         echo "You have the full msg*(2) library." >&4
16329         val="$define"
16330 else
16331         echo "You don't have the full msg*(2) library." >&4
16332         val="$undef"
16333 fi
16334 set d_msg
16335 eval $setvar
16336
16337 : Check for msghdr_s
16338 echo " "
16339 echo "Checking to see if your system supports struct msghdr..." >&4
16340 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16341 eval $hasstruct
16342 case "$d_msghdr_s" in
16343 "$define")      echo "Yes, it does."   ;;
16344 *)              echo "No, it doesn't." ;;
16345 esac
16346
16347
16348 : see if msync exists
16349 set msync d_msync
16350 eval $inlibc
16351
16352 : see if munmap exists
16353 set munmap d_munmap
16354 eval $inlibc
16355
16356 : see if nan exists
16357 set nan d_nan
16358 eval $inlibc
16359
16360 : see if nanosleep exists
16361 set nanosleep d_nanosleep
16362 eval $inlibc
16363
16364 : see if nearbyint exists
16365 set nearbyint d_nearbyint
16366 eval $inlibc
16367
16368 : see if nextafter exists
16369 set nextafter d_nextafter
16370 eval $inlibc
16371
16372 : see if nexttoward exists
16373 set nexttoward d_nexttoward
16374 eval $inlibc
16375
16376 : see if nice exists
16377 set nice d_nice
16378 eval $inlibc
16379
16380 : see if this is a langinfo.h system
16381 set langinfo.h i_langinfo
16382 eval $inhdr
16383
16384 : see if nl_langinfo exists
16385 set nl_langinfo d_nl_langinfo
16386 eval $inlibc
16387
16388 : see if this is a quadmath.h system
16389 set quadmath.h i_quadmath
16390 eval $inhdr
16391
16392 : Check basic sizes
16393 echo " "
16394 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16395
16396 case "$use64bitint:$d_quad:$quadtype" in
16397 define:define:?*)
16398         ivtype="$quadtype"
16399         uvtype="$uquadtype"
16400         ivsize=8
16401         uvsize=8
16402         ;;
16403 *)      ivtype="long"
16404         uvtype="unsigned long"
16405         ivsize=$longsize
16406         uvsize=$longsize
16407         ;;
16408 esac
16409
16410 case "$uselongdouble:$d_longdbl" in
16411 define:define)
16412         nvtype="long double"
16413         nvsize=$longdblsize
16414         ;;
16415 *)      nvtype=double
16416         nvsize=$doublesize
16417         ;;
16418 esac
16419
16420 case "$usequadmath:$i_quadmath" in
16421 define:define)
16422   nvtype="__float128"
16423   nvsize=16
16424   case "$libs" in
16425   *quadmath*) ;;
16426   *) $cat <<EOM >&4
16427
16428 *** You requested the use of the quadmath library, but you
16429 *** do not seem to have the quadmath library installed.
16430 *** Cannot continue, aborting.
16431 EOM
16432     exit 1
16433     ;;
16434   esac
16435   ;;
16436 define:*) $cat <<EOM >&4
16437
16438 *** You requested the use of the quadmath library, but you
16439 *** do not seem to have the required header, <quadmath.h>.
16440 EOM
16441   case "$gccversion" in
16442   [23].*|4.[0-5]*)
16443    $cat <<EOM >&4
16444 *** Your gcc looks a bit old:
16445 *** $gccversion
16446 EOM
16447     ;;
16448   '')
16449    $cat <<EOM >&4
16450 *** You are not running a gcc.
16451 EOM
16452     ;;
16453   esac
16454   $cat <<EOM >&4
16455 *** For the quadmath library you need at least gcc 4.6.
16456 *** Cannot continue, aborting.
16457 EOM
16458   exit 1
16459   ;;
16460 esac
16461
16462 $echo "(IV will be "$ivtype", $ivsize bytes)"
16463 $echo "(UV will be "$uvtype", $uvsize bytes)"
16464 $echo "(NV will be "$nvtype", $nvsize bytes)"
16465
16466 $cat >try.c <<EOCP
16467 #$i_inttypes I_INTTYPES
16468 #ifdef I_INTTYPES
16469 #include <inttypes.h>
16470 #endif
16471 #include <stdio.h>
16472 int main() {
16473 #ifdef INT8
16474    int8_t i =  INT8_MAX;
16475   uint8_t u = UINT8_MAX;
16476   printf("int8_t\n");
16477 #endif
16478 #ifdef INT16
16479    int16_t i =  INT16_MAX;
16480   uint16_t u = UINT16_MAX;
16481   printf("int16_t\n");
16482 #endif
16483 #ifdef INT32
16484    int32_t i =  INT32_MAX;
16485   uint32_t u = UINT32_MAX;
16486   printf("int32_t\n");
16487 #endif
16488 }
16489 EOCP
16490
16491 i8type="signed char"
16492 u8type="unsigned char"
16493 i8size=1
16494 u8size=1
16495
16496 case "$i16type" in
16497 '')     case "$shortsize" in
16498         2)      i16type=short
16499                 u16type="unsigned short"
16500                 i16size=$shortsize
16501                 u16size=$shortsize
16502                 ;;
16503         esac
16504         ;;
16505 esac
16506 case "$i16type" in
16507 '')     set try -DINT16
16508         if eval $compile; then
16509                 case "`$run ./try`" in
16510                 int16_t)
16511                         i16type=int16_t
16512                         u16type=uint16_t
16513                         i16size=2
16514                         u16size=2
16515                         ;;
16516                 esac
16517         fi
16518         ;;
16519 esac
16520 case "$i16type" in
16521 '')     if $test $shortsize -ge 2; then
16522                 i16type=short
16523                 u16type="unsigned short"
16524                 i16size=$shortsize
16525                 u16size=$shortsize
16526         fi
16527         ;;
16528 esac
16529
16530 case "$i32type" in
16531 '')     case "$longsize" in
16532         4)      i32type=long
16533                 u32type="unsigned long"
16534                 i32size=$longsize
16535                 u32size=$longsize
16536                 ;;
16537         *)      case "$intsize" in
16538                 4)      i32type=int
16539                         u32type="unsigned int"
16540                         i32size=$intsize
16541                         u32size=$intsize
16542                         ;;
16543                 esac
16544                 ;;
16545         esac
16546         ;;
16547 esac
16548 case "$i32type" in
16549 '')     set try -DINT32
16550         if eval $compile; then
16551                 case "`$run ./try`" in
16552                 int32_t)
16553                         i32type=int32_t
16554                         u32type=uint32_t
16555                         i32size=4
16556                         u32size=4
16557                         ;;
16558                 esac
16559         fi
16560         ;;
16561 esac
16562 case "$i32type" in
16563 '')     if $test $intsize -ge 4; then
16564                 i32type=int
16565                 u32type="unsigned int"
16566                 i32size=$intsize
16567                 u32size=$intsize
16568         fi
16569         ;;
16570 esac
16571
16572 case "$i64type" in
16573 '')     case "$d_quad:$quadtype" in
16574         define:?*)
16575                 i64type="$quadtype"
16576                 u64type="$uquadtype"
16577                 i64size=8
16578                 u64size=8
16579                 ;;
16580         esac
16581         ;;
16582 esac
16583
16584 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16585 $cat <<EOP >try.c
16586 #include <stdio.h>
16587 #$i_stdlib I_STDLIB
16588 #ifdef I_STDLIB
16589 #include <stdlib.h>
16590 #endif
16591 #include <sys/types.h>
16592 #include <signal.h>
16593 #ifdef SIGFPE
16594 /* volatile so that the compiler has to store it out to memory */
16595 volatile int bletched = 0;
16596 $signal_t blech(int s) { bletched = 1; }
16597 #endif
16598 int main() {
16599     $uvtype u = 0;
16600     $nvtype d;
16601     int     n = 8 * $uvsize;
16602     int     i;
16603 #ifdef SIGFPE
16604     signal(SIGFPE, blech);
16605 #endif
16606
16607     for (i = 0; i < n; i++) {
16608       u = u << 1 | ($uvtype)1;
16609       d = ($nvtype)u;
16610       if (($uvtype)d != u)
16611         break;
16612       if (d <= 0)
16613         break;
16614       d = ($nvtype)(u - 1);
16615       if (($uvtype)d != (u - 1))
16616         break;
16617 #ifdef SIGFPE
16618       if (bletched)
16619         break;
16620 #endif
16621     }
16622     printf("%d\n", ((i == n) ? -n : i));
16623     exit(0);
16624 }
16625 EOP
16626 set try
16627
16628 d_nv_preserves_uv="$undef"
16629 if eval $compile; then
16630         nv_preserves_uv_bits="`$run ./try`"
16631 fi
16632 case "$nv_preserves_uv_bits" in
16633 \-[1-9]*)
16634         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16635         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16636         d_nv_preserves_uv="$define"
16637         ;;
16638 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16639         d_nv_preserves_uv="$undef" ;;
16640 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16641         nv_preserves_uv_bits="0" ;;
16642 esac
16643 $rm_try
16644
16645 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16646 $cat <<EOP >try.c
16647 #include <stdio.h>
16648
16649 typedef $nvtype NV;
16650
16651 int
16652 main() {
16653   NV value = 2;
16654   int count = 1;
16655
16656   while(count < 256) {
16657     /* volatile so that the compiler has to store it out to memory */
16658     volatile NV up = value + 1.0;
16659     volatile NV negated = -value;
16660     volatile NV down = negated - 1.0;
16661     volatile NV got_up = up - value;
16662     int up_good = got_up == 1.0;
16663     int got_down = down - negated;
16664     int down_good = got_down == -1.0;
16665
16666     if (down_good != up_good) {
16667       fprintf(stderr,
16668               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16669               up_good, (double) got_up, down_good, (double) got_down,
16670               count, (double) value);
16671       return 1;
16672     }
16673     if (!up_good) {
16674       while (1) {
16675         if (count > 8) {
16676           count -= 8;
16677           fputs("256.0", stdout);
16678         } else {
16679           count--;
16680           fputs("2.0", stdout);
16681         }
16682         if (!count) {
16683           puts("");
16684           return 0;
16685         }
16686         fputs("*", stdout);
16687       }
16688     }
16689     value *= 2;
16690     ++count;
16691   }
16692   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16693           count, (double) value);
16694   return 1;
16695 }
16696 EOP
16697 set try
16698
16699 nv_overflows_integers_at='0'
16700 if eval $compile; then
16701     xxx="`$run ./try`"
16702     case "$?" in
16703         0)
16704             case "$xxx" in
16705                 2*)  cat >&4 <<EOM
16706 The largest integer your NVs can preserve is equal to $xxx
16707 EOM
16708                     nv_overflows_integers_at="$xxx"
16709                     ;;
16710                 *)  cat >&4 <<EOM
16711 Cannot determine the largest integer value your NVs can hold, unexpected output
16712 '$xxx'
16713 EOM
16714                     ;;
16715             esac
16716             ;;
16717         *)  cat >&4 <<EOM
16718 Cannot determine the largest integer value your NVs can hold
16719 EOM
16720             ;;
16721     esac
16722 fi
16723 $rm_try
16724
16725 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16726 $cat <<EOP >try.c
16727 #include <stdio.h>
16728 #$i_stdlib I_STDLIB
16729 #ifdef I_STDLIB
16730 #include <stdlib.h>
16731 #endif
16732 #include <string.h>
16733 #include <sys/types.h>
16734 #include <signal.h>
16735 #ifdef SIGFPE
16736 /* volatile so that the compiler has to store it out to memory */
16737 volatile int bletched = 0;
16738 $signal_t blech(int s) { bletched = 1; }
16739 #endif
16740
16741 int checkit($nvtype d, const char *where) {
16742     void *v = &d;
16743     unsigned char *p = (unsigned char *)v;
16744     unsigned char *end = p + sizeof(d);
16745     int fail = 0;
16746
16747     while (p < end)
16748         fail += *p++;
16749
16750     if (!fail)
16751         return 0;
16752
16753     p = (unsigned char *)v;
16754     printf("No - %s: 0x", where);
16755     while (p < end)
16756         printf ("%02X", *p++);
16757     printf("\n");
16758     return 1;
16759 }
16760
16761 int main(int argc, char **argv) {
16762     $nvtype d = 0.0;
16763     int fail = 0;
16764     fail += checkit(d, "0.0");
16765
16766     /* The compiler shouldn't be assuming that bletched is 0  */
16767     d = bletched;
16768
16769     fail += checkit(d, "bleched");
16770
16771 #ifdef SIGFPE
16772     signal(SIGFPE, blech);
16773 #endif
16774
16775     /* Paranoia - the compiler should have no way of knowing that ANSI says
16776        that argv[argc] will always be NULL.  Actually, if it did assume this it
16777        would be buggy, as this is C and main() can be called from elsewhere in
16778        the program.  */
16779     d = argv[argc] ? 1 : 0;
16780
16781     if (d) {
16782         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16783     }
16784
16785     fail += checkit(d, "ternary");
16786
16787     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16788
16789     if (d != 0.0) {
16790         printf("No - memset doesn't give 0.0\n");
16791         /* This might just blow up:  */
16792         printf("(gives %g)\n", d);
16793         return 1;
16794     }
16795
16796 #ifdef SIGFPE
16797     if (bletched) {
16798         printf("No - something bleched\n");
16799         return 1;
16800     }
16801 #endif
16802     if (fail) {
16803       printf("No - %d fail(s)\n", fail);
16804       return 1;
16805     }
16806     printf("Yes\n");
16807     return 0;
16808 }
16809 EOP
16810 set try
16811
16812 d_nv_zero_is_allbits_zero="$undef"
16813 if eval $compile; then
16814     xxx="`$run ./try`"
16815     case "$?" in
16816         0)
16817             case "$xxx" in
16818                 Yes)  cat >&4 <<EOM
16819 0.0 is represented as all bits zero in memory
16820 EOM
16821                     d_nv_zero_is_allbits_zero="$define"
16822                     ;;
16823                 *)  cat >&4 <<EOM
16824 0.0 is not represented as all bits zero in memory
16825 EOM
16826                     d_nv_zero_is_allbits_zero="$undef"
16827                     ;;
16828             esac
16829             ;;
16830         *)  cat >&4 <<EOM
16831 0.0 is not represented as all bits zero in memory
16832 EOM
16833             d_nv_zero_is_allbits_zero="$undef"
16834             ;;
16835     esac
16836 fi
16837 $rm_try
16838
16839 : check for off64_t
16840 echo " "
16841 echo "Checking to see if you have off64_t..." >&4
16842 $cat >try.c <<EOCP
16843 #include <sys/types.h>
16844 #include <unistd.h>
16845 int main() { off64_t x = 7; }
16846 EOCP
16847 set try
16848 if eval $compile; then
16849         val="$define"
16850         echo "You have off64_t."
16851 else
16852         val="$undef"
16853         echo "You do not have off64_t."
16854         case "$lseeksize" in
16855         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16856         esac
16857 fi
16858 $rm_try
16859 set d_off64_t
16860 eval $setvar
16861
16862 : how to create joinable pthreads
16863 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16864         echo " "
16865         echo "Checking what constant to use for creating joinable pthreads..." >&4
16866         $cat >try.c <<'EOCP'
16867 #include <pthread.h>
16868 int main() {
16869     int detachstate = JOINABLE;
16870 }
16871 EOCP
16872         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16873         if eval $compile; then
16874                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16875                 val="$undef" # Yes, undef.
16876                 set d_old_pthread_create_joinable
16877                 eval $setvar
16878                 val=""
16879                 set old_pthread_create_joinable
16880                 eval $setvar
16881         else
16882                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16883                 if eval $compile; then
16884                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16885                         val="$define"
16886                         set d_old_pthread_create_joinable
16887                         eval $setvar
16888                         val=PTHREAD_CREATE_UNDETACHED
16889                         set old_pthread_create_joinable
16890                         eval $setvar
16891                 else
16892                         set try -DJOINABLE=__UNDETACHED
16893                         if eval $compile; then
16894                                 echo "You seem to use __UNDETACHED." >&4
16895                                 val="$define"
16896                                 set d_old_pthread_create_joinable
16897                                 eval $setvar
16898                                 val=__UNDETACHED
16899                                 set old_pthread_create_joinable
16900                                 eval $setvar
16901                         else
16902                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16903                                 val="$define"
16904                                 set d_old_pthread_create_joinable
16905                                 eval $setvar
16906                                 val=0
16907                                 set old_pthread_create_joinable
16908                                 eval $setvar
16909                         fi
16910                 fi
16911         fi
16912         $rm_try
16913 else
16914     d_old_pthread_create_joinable="$undef"
16915     old_pthread_create_joinable=""
16916 fi
16917
16918 : see if pause exists
16919 set pause d_pause
16920 eval $inlibc
16921
16922 : see if poll exists
16923 set poll d_poll
16924 eval $inlibc
16925
16926 : see if prctl exists
16927 set prctl d_prctl
16928 eval $inlibc
16929
16930 : see if prctl supports PR_SET_NAME
16931 d_prctl_set_name=$undef
16932 case $d_prctl in
16933     $define)
16934         $cat >try.c <<EOM
16935 #ifdef __ANDROID__
16936 #include <unistd.h>
16937 #endif
16938 #include <sys/prctl.h>
16939
16940 int main (int argc, char *argv[])
16941 {
16942     return (prctl (PR_SET_NAME, "Test"));
16943     } /* main */
16944 EOM
16945         set try
16946         if eval $compile_ok && $run ./try; then
16947             echo "Your prctl (PR_SET_NAME, ...) works"
16948             d_prctl_set_name=$define
16949             fi
16950         $rm_try
16951         ;;
16952     esac
16953
16954 : see if readlink exists
16955 set readlink d_readlink
16956 eval $inlibc
16957
16958 : Check if there is a /proc symlink to the abs path of
16959 : the executing program.  We will honor hints of d_procselfexe=$undef
16960 : or procselfexe being non-empty, otherwise will try to determine both
16961 : if we have readlink.
16962 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
16963 : referenced, and AmigaOS does not have a proc filesystem anyway.
16964 echo " "
16965 val="$undef"
16966 if $test "X$d_procselfexe" = Xundef; then
16967         procselfexe=''
16968 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
16969         val="$define"
16970 elif $test "X$d_readlink" = Xdefine; then
16971         : NetBSD first as /proc/self is a symlink to /proc/curproc,
16972         : and it feels more tidy to avoid an extra level of symlink
16973         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16974         while test $# -gt 0; do
16975             type=$1; try=$2
16976             shift; shift
16977             if $issymlink $try; then
16978                 $ls -l $try > reflect
16979                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16980                     echo "You have $type-like $try."
16981                     procselfexe='"'$try'"'
16982                     val="$define"
16983                     : This will break out of the loop
16984                     set X; shift
16985                 fi
16986             fi
16987         done
16988 fi
16989 $rm -f reflect
16990 set d_procselfexe
16991 eval $setvar
16992
16993 : backward compatibility for d_hvfork
16994 if test X$d_hvfork != X; then
16995         d_vfork="$d_hvfork"
16996         d_hvfork=''
16997 fi
16998 : see if there is a vfork
16999 val=''
17000 set vfork val
17001 eval $inlibc
17002
17003 d_pseudofork=$undef
17004
17005 : Ok, but do we want to use it. vfork is reportedly unreliable in
17006 : perl on Solaris 2.x, and probably elsewhere.
17007 case "$val" in
17008 $define)
17009         echo " "
17010         case "$usevfork" in
17011         false) dflt='n';;
17012         *) dflt='y';;
17013         esac
17014         cat <<'EOM'
17015
17016 Perl can only use a vfork() that doesn't suffer from strict
17017 restrictions on calling functions or modifying global data in
17018 the child.  For example, glibc-2.1 contains such a vfork()
17019 that is unsuitable.  If your system provides a proper fork()
17020 call, chances are that you do NOT want perl to use vfork().
17021
17022 EOM
17023         rp="Do you still want to use vfork()?"
17024         . ./myread
17025         case "$ans" in
17026         y|Y) ;;
17027         *)
17028                 echo "Ok, we won't use vfork()."
17029                 val="$undef"
17030                 ;;
17031         esac
17032         ;;
17033 esac
17034 set d_vfork
17035 eval $setvar
17036 case "$d_vfork" in
17037 $define) usevfork='true';;
17038 *) usevfork='false';;
17039 esac
17040
17041 : see whether the pthread_atfork exists
17042 $cat >try.c <<EOP
17043 #include <pthread.h>
17044 #include <stdio.h>
17045 int main() {
17046 #ifdef  PTHREAD_ATFORK
17047         pthread_atfork(NULL,NULL,NULL);
17048 #endif
17049 }
17050 EOP
17051
17052 : see if pthread_atfork exists
17053 set try -DPTHREAD_ATFORK
17054 if eval $compile; then
17055     val="$define"
17056 else
17057     val="$undef"
17058 fi
17059 case "$usethreads" in
17060 $define)
17061         case "$val" in
17062         $define) echo 'pthread_atfork found.' >&4        ;;
17063         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17064         esac
17065 esac
17066 set d_pthread_atfork
17067 eval $setvar
17068
17069 : see if pthread_attr_setscope exists
17070 set pthread_attr_setscope d_pthread_attr_setscope
17071 eval $inlibc
17072
17073 : see whether the various POSIXish _yields exist
17074 $cat >try.c <<EOP
17075 #include <pthread.h>
17076 #include <stdio.h>
17077 int main() {
17078 #ifdef SCHED_YIELD
17079         sched_yield();
17080 #else
17081 #ifdef PTHREAD_YIELD
17082         pthread_yield();
17083 #else
17084 #ifdef PTHREAD_YIELD_NULL
17085         pthread_yield(NULL);
17086 #endif
17087 #endif
17088 #endif
17089 }
17090 EOP
17091 : see if sched_yield exists
17092 set try -DSCHED_YIELD
17093 if eval $compile; then
17094     val="$define"
17095     sched_yield='sched_yield()'
17096 else
17097     val="$undef"
17098 fi
17099 case "$usethreads" in
17100 $define)
17101         case "$val" in
17102         $define) echo 'sched_yield() found.' >&4        ;;
17103         *)       echo 'sched_yield() NOT found.' >&4    ;;
17104         esac
17105 esac
17106 set d_sched_yield
17107 eval $setvar
17108
17109 : see if pthread_yield exists
17110 set try -DPTHREAD_YIELD
17111 if eval $compile; then
17112     val="$define"
17113     case "$sched_yield" in
17114     '') sched_yield='pthread_yield()' ;;
17115     esac
17116 else
17117     set try -DPTHREAD_YIELD_NULL
17118     if eval $compile; then
17119         val="$define"
17120         case "$sched_yield" in
17121         '') sched_yield='pthread_yield(NULL)' ;;
17122         esac
17123     else
17124         val="$undef"
17125     fi
17126 fi
17127 case "$usethreads" in
17128 $define)
17129         case "$val" in
17130         $define) echo 'pthread_yield() found.' >&4      ;;
17131         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17132         esac
17133         ;;
17134 esac
17135 set d_pthread_yield
17136 eval $setvar
17137 case "$sched_yield" in
17138 '') sched_yield=undef ;;
17139 esac
17140 $rm_try
17141
17142 : check for ptrdiff_t
17143 echo " "
17144 echo "Checking to see if you have ptrdiff_t..." >&4
17145 $cat >try.c <<EOCP
17146 #include <stddef.h>
17147 int main() { ptrdiff_t x = 7; }
17148 EOCP
17149 set try
17150 if eval $compile; then
17151         val="$define"
17152         echo "You have ptrdiff_t."
17153 else
17154         val="$undef"
17155         echo "You do not have ptrdiff_t."
17156 fi
17157 $rm_try
17158 set d_ptrdiff_t
17159 eval $setvar
17160
17161 : see if random_r exists
17162 set random_r d_random_r
17163 eval $inlibc
17164 case "$d_random_r" in
17165 "$define")
17166         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17167         case "$d_random_r_proto:$usethreads" in
17168         ":define")      d_random_r_proto=define
17169                 set d_random_r_proto random_r $hdrs
17170                 eval $hasproto ;;
17171         *)      ;;
17172         esac
17173         case "$d_random_r_proto" in
17174         define)
17175         case "$random_r_proto" in
17176         ''|0) try='int random_r(int*, struct random_data*);'
17177         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17178         esac
17179         case "$random_r_proto" in
17180         ''|0) try='int random_r(long*, struct random_data*);'
17181         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17182         esac
17183         case "$random_r_proto" in
17184         ''|0) try='int random_r(struct random_data*, int32_t*);'
17185         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17186         esac
17187         case "$random_r_proto" in
17188         ''|0)   d_random_r=undef
17189                 random_r_proto=0
17190                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17191         * )     case "$random_r_proto" in
17192                 REENTRANT_PROTO*) ;;
17193                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17194                 esac
17195                 echo "Prototype: $try" ;;
17196         esac
17197         ;;
17198         *)      case "$usethreads" in
17199                 define) echo "random_r has no prototype, not using it." >&4 ;;
17200                 esac
17201                 d_random_r=undef
17202                 random_r_proto=0
17203                 ;;
17204         esac
17205         ;;
17206 *)      random_r_proto=0
17207         ;;
17208 esac
17209
17210 : see if readdir and friends exist
17211 set readdir d_readdir
17212 eval $inlibc
17213 set seekdir d_seekdir
17214 eval $inlibc
17215 set telldir d_telldir
17216 eval $inlibc
17217 set rewinddir d_rewinddir
17218 eval $inlibc
17219
17220 : see if readdir64_r exists
17221 set readdir64_r d_readdir64_r
17222 eval $inlibc
17223 case "$d_readdir64_r" in
17224 "$define")
17225         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17226         case "$d_readdir64_r_proto:$usethreads" in
17227         ":define")      d_readdir64_r_proto=define
17228                 set d_readdir64_r_proto readdir64_r $hdrs
17229                 eval $hasproto ;;
17230         *)      ;;
17231         esac
17232         case "$d_readdir64_r_proto" in
17233         define)
17234         case "$readdir64_r_proto" in
17235         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17236         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17237         esac
17238         case "$readdir64_r_proto" in
17239         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17240         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17241         esac
17242         case "$readdir64_r_proto" in
17243         ''|0)   d_readdir64_r=undef
17244                 readdir64_r_proto=0
17245                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17246         * )     case "$readdir64_r_proto" in
17247                 REENTRANT_PROTO*) ;;
17248                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17249                 esac
17250                 echo "Prototype: $try" ;;
17251         esac
17252         ;;
17253         *)      case "$usethreads" in
17254                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17255                 esac
17256                 d_readdir64_r=undef
17257                 readdir64_r_proto=0
17258                 ;;
17259         esac
17260         ;;
17261 *)      readdir64_r_proto=0
17262         ;;
17263 esac
17264
17265 : see if readdir_r exists
17266 set readdir_r d_readdir_r
17267 eval $inlibc
17268 case "$d_readdir_r" in
17269 "$define")
17270         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17271         case "$d_readdir_r_proto:$usethreads" in
17272         ":define")      d_readdir_r_proto=define
17273                 set d_readdir_r_proto readdir_r $hdrs
17274                 eval $hasproto ;;
17275         *)      ;;
17276         esac
17277         case "$d_readdir_r_proto" in
17278         define)
17279         case "$readdir_r_proto" in
17280         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17281         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17282         esac
17283         case "$readdir_r_proto" in
17284         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17285         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17286         esac
17287         case "$readdir_r_proto" in
17288         ''|0)   d_readdir_r=undef
17289                 readdir_r_proto=0
17290                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17291         * )     case "$readdir_r_proto" in
17292                 REENTRANT_PROTO*) ;;
17293                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17294                 esac
17295                 echo "Prototype: $try" ;;
17296         esac
17297         ;;
17298         *)      case "$usethreads" in
17299                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17300                 esac
17301                 d_readdir_r=undef
17302                 readdir_r_proto=0
17303                 ;;
17304         esac
17305         ;;
17306 *)      readdir_r_proto=0
17307         ;;
17308 esac
17309
17310 : see if readv exists
17311 set readv d_readv
17312 eval $inlibc
17313
17314 : see if recvmsg exists
17315 set recvmsg d_recvmsg
17316 eval $inlibc
17317
17318 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17319 echo " "
17320 if set regcomp val -f d_regcomp; eval $csym; $val; then
17321         echo 'regcomp() found.' >&4
17322         d_regcomp="$define"
17323         d_regcmp="$undef"
17324         d_re_comp="$undef"
17325 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17326         echo 'regcmp() found.' >&4
17327         d_regcmp="$define"
17328         d_regcomp="$undef"
17329         d_re_comp="$undef"
17330 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17331         echo 're_comp() found, assuming re_exec() also exists.' >&4
17332         d_re_comp="$define"
17333         d_regcomp="$undef"
17334         d_regcmp="$undef"
17335 else
17336         $cat >&4 <<EOM
17337 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17338 EOM
17339         d_regcmp="$undef"
17340         d_re_comp="$undef"
17341         d_regcomp="$undef"
17342 fi
17343
17344 : see if remainder exists
17345 set remainder d_remainder
17346 eval $inlibc
17347
17348 : see if remquo exists
17349 set remquo d_remquo
17350 eval $inlibc
17351
17352 : see if rename exists
17353 set rename d_rename
17354 eval $inlibc
17355
17356 : see if rint exists
17357 set rint d_rint
17358 eval $inlibc
17359
17360 : see if rmdir exists
17361 set rmdir d_rmdir
17362 eval $inlibc
17363
17364 : see if round exists
17365 set round d_round
17366 eval $inlibc
17367
17368 : see if prototype for sbrk is available
17369 echo " "
17370 set d_sbrkproto sbrk $i_unistd unistd.h
17371 eval $hasproto
17372
17373 : see if scalbn exists
17374 set scalbn d_scalbn
17375 eval $inlibc
17376
17377 : see if select exists
17378 set select d_select
17379 eval $inlibc
17380
17381 : see if semctl exists
17382 set semctl d_semctl
17383 eval $inlibc
17384
17385 : see if semget exists
17386 set semget d_semget
17387 eval $inlibc
17388
17389 : see if semop exists
17390 set semop d_semop
17391 eval $inlibc
17392
17393 : see how much of the 'sem*(2)' library is present.
17394 h_sem=true
17395 echo " "
17396 case "$d_semctl$d_semget$d_semop" in
17397 *"$undef"*) h_sem=false;;
17398 esac
17399 case "$osname" in
17400 freebsd)
17401     case "`ipcs 2>&1`" in
17402     "SVID messages"*"not configured"*)
17403         echo "Your $osname does not have the sem*(2) configured." >&4
17404         h_sem=false
17405         val="$undef"
17406         set semctl d_semctl
17407         eval $setvar
17408         set semget d_semget
17409         eval $setvar
17410         set semop d_semop
17411         eval $setvar
17412         ;;
17413     esac
17414     ;;
17415 esac
17416 : we could also check for sys/ipc.h ...
17417 if $h_sem && $test `./findhdr sys/sem.h`; then
17418         echo "You have the full sem*(2) library." >&4
17419         val="$define"
17420 else
17421         echo "You don't have the full sem*(2) library." >&4
17422         val="$undef"
17423 fi
17424 set d_sem
17425 eval $setvar
17426
17427 : see whether sys/sem.h defines union semun
17428 echo " "
17429 $cat > try.c <<'END'
17430 #include <sys/types.h>
17431 #include <sys/ipc.h>
17432 #include <sys/sem.h>
17433 int main () { union semun semun; semun.buf = 0; }
17434 END
17435 set try
17436 if eval $compile; then
17437     echo "You have union semun in <sys/sem.h>." >&4
17438     val="$define"
17439 else
17440     echo "You do not have union semun in <sys/sem.h>." >&4
17441     val="$undef"
17442 fi
17443 $rm_try
17444 set d_union_semun
17445 eval $setvar
17446
17447 : see how to do semctl IPC_STAT
17448 case "$d_sem" in
17449 $define)
17450     echo " "
17451     $cat > tryh.h <<END
17452 #ifndef S_IRUSR
17453 #   ifdef S_IREAD
17454 #       define S_IRUSR S_IREAD
17455 #       define S_IWUSR S_IWRITE
17456 #       define S_IXUSR S_IEXEC
17457 #   else
17458 #       define S_IRUSR 0400
17459 #       define S_IWUSR 0200
17460 #       define S_IXUSR 0100
17461 #   endif
17462 #   define S_IRGRP (S_IRUSR>>3)
17463 #   define S_IWGRP (S_IWUSR>>3)
17464 #   define S_IXGRP (S_IXUSR>>3)
17465 #   define S_IROTH (S_IRUSR>>6)
17466 #   define S_IWOTH (S_IWUSR>>6)
17467 #   define S_IXOTH (S_IXUSR>>6)
17468 #endif
17469 #ifndef S_IRWXU
17470 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17471 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17472 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17473 #endif
17474 END
17475     : see whether semctl IPC_STAT can use union semun
17476     case "$d_semctl_semun" in
17477     '')
17478       val="$undef"
17479       $cat > try.c <<END
17480 #include <sys/types.h>
17481 #include <sys/ipc.h>
17482 #include <sys/sem.h>
17483 #include <sys/stat.h>
17484 #include <stdio.h>
17485 #include <errno.h>
17486 #include "tryh.h"
17487 #ifndef errno
17488 extern int errno;
17489 #endif
17490 #$d_union_semun HAS_UNION_SEMUN
17491 int main() {
17492     union semun
17493 #ifndef HAS_UNION_SEMUN
17494     {
17495         int val;
17496         struct semid_ds *buf;
17497         unsigned short *array;
17498     }
17499 #endif
17500     arg;
17501     int sem, st;
17502
17503 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17504     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17505     if (sem > -1) {
17506         struct semid_ds argbuf;
17507         arg.buf = &argbuf;
17508 #       ifdef IPC_STAT
17509         st = semctl(sem, 0, IPC_STAT, arg);
17510         if (st == 0)
17511             printf("semun\n");
17512         else
17513 #       endif /* IPC_STAT */
17514             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17515 #       ifdef IPC_RMID
17516         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17517 #       endif /* IPC_RMID */
17518             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17519     } else
17520 #endif /* IPC_PRIVATE && ... */
17521         printf("semget failed: errno = %d\n", errno);
17522   return 0;
17523 }
17524 END
17525       set try
17526       if eval $compile; then
17527           xxx=`$run ./try`
17528           case "$xxx" in
17529           semun) val="$define" ;;
17530           esac
17531       fi
17532       $rm_try
17533       set d_semctl_semun
17534       eval $setvar
17535       ;;
17536     esac
17537     case "$d_semctl_semun" in
17538     $define)
17539         echo "You can use union semun for semctl IPC_STAT." >&4
17540         also='also'
17541         ;;
17542     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17543         also=''
17544         ;;
17545     esac
17546
17547     : see whether semctl IPC_STAT can use struct semid_ds pointer
17548     case "$d_semctl_semid_ds" in
17549     '')
17550       val="$undef"
17551       $cat > try.c <<'END'
17552 #include <sys/types.h>
17553 #include <sys/ipc.h>
17554 #include <sys/sem.h>
17555 #include <sys/stat.h>
17556 #include "tryh.h"
17557 #include <stdio.h>
17558 #include <errno.h>
17559 #ifndef errno
17560 extern int errno;
17561 #endif
17562 int main() {
17563     struct semid_ds arg;
17564     int sem, st;
17565
17566 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17567     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17568     if (sem > -1) {
17569 #       ifdef IPC_STAT
17570         st = semctl(sem, 0, IPC_STAT, &arg);
17571         if (st == 0)
17572             printf("semid_ds\n");
17573         else
17574 #       endif /* IPC_STAT */
17575             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17576 #       ifdef IPC_RMID
17577         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
17578 #       endif /* IPC_RMID */
17579             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17580     } else
17581 #endif /* IPC_PRIVATE && ... */
17582         printf("semget failed: errno = %d\n", errno);
17583
17584     return 0;
17585 }
17586 END
17587       set try
17588       if eval $compile; then
17589           xxx=`$run ./try`
17590           case "$xxx" in
17591           semid_ds) val="$define" ;;
17592           esac
17593       fi
17594       $rm_try
17595       set d_semctl_semid_ds
17596       eval $setvar
17597       ;;
17598     esac
17599     case "$d_semctl_semid_ds" in
17600     $define)
17601         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17602         ;;
17603     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17604         ;;
17605     esac
17606     ;;
17607 *)  val="$undef"
17608
17609     # We do not have the full sem*(2) library, so assume we can not
17610     # use either.
17611
17612     set d_semctl_semun
17613     eval $setvar
17614
17615     set d_semctl_semid_ds
17616     eval $setvar
17617     ;;
17618 esac
17619 $rm_try tryh.h
17620
17621 : see if sendmsg exists
17622 set sendmsg d_sendmsg
17623 eval $inlibc
17624
17625 : see if setegid exists
17626 set setegid d_setegid
17627 eval $inlibc
17628
17629 : see if seteuid exists
17630 set seteuid d_seteuid
17631 eval $inlibc
17632
17633 : see if setgrent exists
17634 set setgrent d_setgrent
17635 eval $inlibc
17636
17637 : see if setgrent_r exists
17638 set setgrent_r d_setgrent_r
17639 eval $inlibc
17640 case "$d_setgrent_r" in
17641 "$define")
17642         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17643         case "$d_setgrent_r_proto:$usethreads" in
17644         ":define")      d_setgrent_r_proto=define
17645                 set d_setgrent_r_proto setgrent_r $hdrs
17646                 eval $hasproto ;;
17647         *)      ;;
17648         esac
17649         case "$d_setgrent_r_proto" in
17650         define)
17651         case "$setgrent_r_proto" in
17652         ''|0) try='int setgrent_r(FILE**);'
17653         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17654         esac
17655         case "$setgrent_r_proto" in
17656         ''|0) try='void setgrent_r(FILE**);'
17657         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17658         esac
17659         case "$setgrent_r_proto" in
17660         ''|0)   d_setgrent_r=undef
17661                 setgrent_r_proto=0
17662                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17663         * )     case "$setgrent_r_proto" in
17664                 REENTRANT_PROTO*) ;;
17665                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17666                 esac
17667                 echo "Prototype: $try" ;;
17668         esac
17669         ;;
17670         *)      case "$usethreads" in
17671                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17672                 esac
17673                 d_setgrent_r=undef
17674                 setgrent_r_proto=0
17675                 ;;
17676         esac
17677         ;;
17678 *)      setgrent_r_proto=0
17679         ;;
17680 esac
17681
17682 : see if sethostent exists
17683 set sethostent d_sethent
17684 eval $inlibc
17685
17686 : see if sethostent_r exists
17687 set sethostent_r d_sethostent_r
17688 eval $inlibc
17689 case "$d_sethostent_r" in
17690 "$define")
17691         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17692         case "$d_sethostent_r_proto:$usethreads" in
17693         ":define")      d_sethostent_r_proto=define
17694                 set d_sethostent_r_proto sethostent_r $hdrs
17695                 eval $hasproto ;;
17696         *)      ;;
17697         esac
17698         case "$d_sethostent_r_proto" in
17699         define)
17700         case "$sethostent_r_proto" in
17701         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17702         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17703         esac
17704         case "$sethostent_r_proto" in
17705         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17706         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17707         esac
17708         case "$sethostent_r_proto" in
17709         ''|0)   d_sethostent_r=undef
17710                 sethostent_r_proto=0
17711                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17712         * )     case "$sethostent_r_proto" in
17713                 REENTRANT_PROTO*) ;;
17714                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17715                 esac
17716                 echo "Prototype: $try" ;;
17717         esac
17718         ;;
17719         *)      case "$usethreads" in
17720                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17721                 esac
17722                 d_sethostent_r=undef
17723                 sethostent_r_proto=0
17724                 ;;
17725         esac
17726         ;;
17727 *)      sethostent_r_proto=0
17728         ;;
17729 esac
17730
17731 : see if setitimer exists
17732 set setitimer d_setitimer
17733 eval $inlibc
17734
17735 : see if setlinebuf exists
17736 set setlinebuf d_setlinebuf
17737 eval $inlibc
17738
17739 : see if setlocale exists
17740 set setlocale d_setlocale
17741 eval $inlibc
17742
17743 : see if locale.h is available
17744 set locale.h i_locale
17745 eval $inhdr
17746
17747 : see if setlocale_r exists
17748 set setlocale_r d_setlocale_r
17749 eval $inlibc
17750 case "$d_setlocale_r" in
17751 "$define")
17752         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17753         case "$d_setlocale_r_proto:$usethreads" in
17754         ":define")      d_setlocale_r_proto=define
17755                 set d_setlocale_r_proto setlocale_r $hdrs
17756                 eval $hasproto ;;
17757         *)      ;;
17758         esac
17759         case "$d_setlocale_r_proto" in
17760         define)
17761         case "$setlocale_r_proto" in
17762         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17763         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17764         esac
17765         case "$setlocale_r_proto" in
17766         ''|0)   d_setlocale_r=undef
17767                 setlocale_r_proto=0
17768                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17769         * )     case "$setlocale_r_proto" in
17770                 REENTRANT_PROTO*) ;;
17771                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17772                 esac
17773                 echo "Prototype: $try" ;;
17774         esac
17775         ;;
17776         *)      case "$usethreads" in
17777                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17778                 esac
17779                 d_setlocale_r=undef
17780                 setlocale_r_proto=0
17781                 ;;
17782         esac
17783         ;;
17784 *)      setlocale_r_proto=0
17785         ;;
17786 esac
17787
17788 : see if setnetent exists
17789 set setnetent d_setnent
17790 eval $inlibc
17791
17792 : see if setnetent_r exists
17793 set setnetent_r d_setnetent_r
17794 eval $inlibc
17795 case "$d_setnetent_r" in
17796 "$define")
17797         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17798         case "$d_setnetent_r_proto:$usethreads" in
17799         ":define")      d_setnetent_r_proto=define
17800                 set d_setnetent_r_proto setnetent_r $hdrs
17801                 eval $hasproto ;;
17802         *)      ;;
17803         esac
17804         case "$d_setnetent_r_proto" in
17805         define)
17806         case "$setnetent_r_proto" in
17807         ''|0) try='int setnetent_r(int, struct netent_data*);'
17808         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17809         esac
17810         case "$setnetent_r_proto" in
17811         ''|0) try='void setnetent_r(int, struct netent_data*);'
17812         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17813         esac
17814         case "$setnetent_r_proto" in
17815         ''|0)   d_setnetent_r=undef
17816                 setnetent_r_proto=0
17817                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17818         * )     case "$setnetent_r_proto" in
17819                 REENTRANT_PROTO*) ;;
17820                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17821                 esac
17822                 echo "Prototype: $try" ;;
17823         esac
17824         ;;
17825         *)      case "$usethreads" in
17826                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17827                 esac
17828                 d_setnetent_r=undef
17829                 setnetent_r_proto=0
17830                 ;;
17831         esac
17832         ;;
17833 *)      setnetent_r_proto=0
17834         ;;
17835 esac
17836
17837 : see if setprotoent exists
17838 set setprotoent d_setpent
17839 eval $inlibc
17840
17841 : see if setpgid exists
17842 set setpgid d_setpgid
17843 eval $inlibc
17844
17845 : see if setpgrp2 exists
17846 set setpgrp2 d_setpgrp2
17847 eval $inlibc
17848
17849 : see if setpriority exists
17850 set setpriority d_setprior
17851 eval $inlibc
17852
17853 : see if setproctitle exists
17854 set setproctitle d_setproctitle
17855 eval $inlibc
17856
17857 : see if setprotoent_r exists
17858 set setprotoent_r d_setprotoent_r
17859 eval $inlibc
17860 case "$d_setprotoent_r" in
17861 "$define")
17862         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17863         case "$d_setprotoent_r_proto:$usethreads" in
17864         ":define")      d_setprotoent_r_proto=define
17865                 set d_setprotoent_r_proto setprotoent_r $hdrs
17866                 eval $hasproto ;;
17867         *)      ;;
17868         esac
17869         case "$d_setprotoent_r_proto" in
17870         define)
17871         case "$setprotoent_r_proto" in
17872         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17873         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17874         esac
17875         case "$setprotoent_r_proto" in
17876         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17877         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17878         esac
17879         case "$setprotoent_r_proto" in
17880         ''|0)   d_setprotoent_r=undef
17881                 setprotoent_r_proto=0
17882                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17883         * )     case "$setprotoent_r_proto" in
17884                 REENTRANT_PROTO*) ;;
17885                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17886                 esac
17887                 echo "Prototype: $try" ;;
17888         esac
17889         ;;
17890         *)      case "$usethreads" in
17891                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17892                 esac
17893                 d_setprotoent_r=undef
17894                 setprotoent_r_proto=0
17895                 ;;
17896         esac
17897         ;;
17898 *)      setprotoent_r_proto=0
17899         ;;
17900 esac
17901
17902 : see if setpwent exists
17903 set setpwent d_setpwent
17904 eval $inlibc
17905
17906 : see if setpwent_r exists
17907 set setpwent_r d_setpwent_r
17908 eval $inlibc
17909 case "$d_setpwent_r" in
17910 "$define")
17911         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17912         case "$d_setpwent_r_proto:$usethreads" in
17913         ":define")      d_setpwent_r_proto=define
17914                 set d_setpwent_r_proto setpwent_r $hdrs
17915                 eval $hasproto ;;
17916         *)      ;;
17917         esac
17918         case "$d_setpwent_r_proto" in
17919         define)
17920         case "$setpwent_r_proto" in
17921         ''|0) try='int setpwent_r(FILE**);'
17922         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17923         esac
17924         case "$setpwent_r_proto" in
17925         ''|0) try='void setpwent_r(FILE**);'
17926         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17927         esac
17928         case "$setpwent_r_proto" in
17929         ''|0)   d_setpwent_r=undef
17930                 setpwent_r_proto=0
17931                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17932         * )     case "$setpwent_r_proto" in
17933                 REENTRANT_PROTO*) ;;
17934                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17935                 esac
17936                 echo "Prototype: $try" ;;
17937         esac
17938         ;;
17939         *)      case "$usethreads" in
17940                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17941                 esac
17942                 d_setpwent_r=undef
17943                 setpwent_r_proto=0
17944                 ;;
17945         esac
17946         ;;
17947 *)      setpwent_r_proto=0
17948         ;;
17949 esac
17950
17951 : see if setregid exists
17952 set setregid d_setregid
17953 eval $inlibc
17954 set setresgid d_setresgid
17955 eval $inlibc
17956
17957 : see if setreuid exists
17958 set setreuid d_setreuid
17959 eval $inlibc
17960 set setresuid d_setresuid
17961 eval $inlibc
17962
17963 : see if setrgid exists
17964 set setrgid d_setrgid
17965 eval $inlibc
17966
17967 : see if setruid exists
17968 set setruid d_setruid
17969 eval $inlibc
17970
17971 : see if setservent exists
17972 set setservent d_setsent
17973 eval $inlibc
17974
17975 : see if setservent_r exists
17976 set setservent_r d_setservent_r
17977 eval $inlibc
17978 case "$d_setservent_r" in
17979 "$define")
17980         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17981         case "$d_setservent_r_proto:$usethreads" in
17982         ":define")      d_setservent_r_proto=define
17983                 set d_setservent_r_proto setservent_r $hdrs
17984                 eval $hasproto ;;
17985         *)      ;;
17986         esac
17987         case "$d_setservent_r_proto" in
17988         define)
17989         case "$setservent_r_proto" in
17990         ''|0) try='int setservent_r(int, struct servent_data*);'
17991         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17992         esac
17993         case "$setservent_r_proto" in
17994         ''|0) try='void setservent_r(int, struct servent_data*);'
17995         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17996         esac
17997         case "$setservent_r_proto" in
17998         ''|0)   d_setservent_r=undef
17999                 setservent_r_proto=0
18000                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18001         * )     case "$setservent_r_proto" in
18002                 REENTRANT_PROTO*) ;;
18003                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18004                 esac
18005                 echo "Prototype: $try" ;;
18006         esac
18007         ;;
18008         *)      case "$usethreads" in
18009                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18010                 esac
18011                 d_setservent_r=undef
18012                 setservent_r_proto=0
18013                 ;;
18014         esac
18015         ;;
18016 *)      setservent_r_proto=0
18017         ;;
18018 esac
18019
18020 : see if setsid exists
18021 set setsid d_setsid
18022 eval $inlibc
18023
18024 : see if setvbuf exists
18025 set setvbuf d_setvbuf
18026 eval $inlibc
18027
18028 : see if shmctl exists
18029 set shmctl d_shmctl
18030 eval $inlibc
18031
18032 : see if shmget exists
18033 set shmget d_shmget
18034 eval $inlibc
18035
18036 : see if shmat exists
18037 set shmat d_shmat
18038 eval $inlibc
18039 : see what shmat returns
18040 case "$d_shmat" in
18041 "$define")
18042         $cat >shmat.c <<'END'
18043 #include <sys/shm.h>
18044 void *shmat();
18045 END
18046         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18047                 shmattype='void *'
18048         else
18049                 shmattype='char *'
18050         fi
18051         echo "and it returns ($shmattype)." >&4
18052         : see if a prototype for shmat is available
18053         xxx=`./findhdr sys/shm.h`
18054         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18055         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18056                 val="$define"
18057         else
18058                 val="$undef"
18059         fi
18060         $rm -f shmat.[co]
18061         ;;
18062 *)
18063         val="$undef"
18064         ;;
18065 esac
18066 set d_shmatprototype
18067 eval $setvar
18068
18069 : see if shmdt exists
18070 set shmdt d_shmdt
18071 eval $inlibc
18072
18073 : see how much of the 'shm*(2)' library is present.
18074 h_shm=true
18075 echo " "
18076 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18077 *"$undef"*) h_shm=false;;
18078 esac
18079 case "$osname" in
18080 freebsd)
18081     case "`ipcs 2>&1`" in
18082     "SVID shared memory"*"not configured"*)
18083         echo "Your $osname does not have the shm*(2) configured." >&4
18084         h_shm=false
18085         val="$undef"
18086         set shmctl d_shmctl
18087         eval $setvar
18088         set shmget d_shmget
18089         eval $setvar
18090         set shmat d_shmat
18091         eval $setvar
18092         set shmdt d_shmdt
18093         eval $setvar
18094         ;;
18095     esac
18096     ;;
18097 esac
18098 : we could also check for sys/ipc.h ...
18099 if $h_shm && $test `./findhdr sys/shm.h`; then
18100         echo "You have the full shm*(2) library." >&4
18101         val="$define"
18102 else
18103         echo "You don't have the full shm*(2) library." >&4
18104         val="$undef"
18105 fi
18106 set d_shm
18107 eval $setvar
18108
18109 : see if we have sigaction
18110 echo " "
18111 if set sigaction val -f d_sigaction; eval $csym; $val; then
18112         echo 'sigaction() found.' >&4
18113         $cat > try.c <<EOP
18114 #include <stdio.h>
18115 #include <sys/types.h>
18116 #include <signal.h>
18117 #$i_stdlib I_STDLIB
18118 #ifdef I_STDLIB
18119 #include <stdlib.h>
18120 #endif
18121 int main()
18122 {
18123     struct sigaction act, oact;
18124     act.sa_flags = 0;
18125     oact.sa_handler = 0;
18126     /* so that act and oact are used */
18127     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18128 }
18129 EOP
18130         set try
18131         if eval $compile_ok; then
18132                 val="$define"
18133         else
18134                 echo "But you don't seem to have a usable struct sigaction." >&4
18135                 val="$undef"
18136         fi
18137 else
18138         echo 'sigaction NOT found.' >&4
18139         val="$undef"
18140 fi
18141 set d_sigaction; eval $setvar
18142 $rm_try
18143
18144 : see what type pids are declared as in the kernel
18145 rp="What is the type of process ids on this system?"
18146 set pid_t pidtype int stdio.h sys/types.h
18147 eval $typedef_ask
18148
18149 : see what type uids are declared as in the kernel
18150 echo " "
18151 echo "Looking for the type for user ids returned by getuid()."
18152 set uid_t uidtype xxx stdio.h sys/types.h
18153 eval $typedef
18154 case "$uidtype" in
18155 xxx)
18156         xxx=`./findhdr sys/user.h`
18157         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18158         case $1 in
18159         unsigned) dflt="$1 $2" ;;
18160         *) dflt="$1" ;;
18161         esac
18162         ;;
18163 *) dflt="$uidtype";;
18164 esac
18165 case "$uidtype" in
18166 uid_t)  echo "uid_t found." ;;
18167 *)      rp="What is the type for user ids returned by getuid()?"
18168         . ./myread
18169         uidtype="$ans"
18170         ;;
18171 esac
18172
18173 : Define hasfield_t macro for Configure internal use
18174 hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
18175 while $test $# -ge 2; do
18176     case "$1" in
18177         $define) echo "#include <$2>";;
18178     esac ;
18179     shift 2;
18180 done > try.c;
18181 echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
18182 set try;
18183 if eval $compile; then
18184         val="$define";
18185 else
18186         val="$undef";
18187 fi;
18188 set $varname;
18189 eval $setvar;
18190 $rm_try'
18191
18192 : see what siginfo fields we have
18193 case "$d_sigaction" in
18194 "$define")
18195         echo "Checking if your siginfo_t has si_errno field...">&4
18196         set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
18197         eval $hasfield_t;
18198
18199         echo "Checking if your siginfo_t has si_pid field...">&4
18200         set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
18201         eval $hasfield_t;
18202
18203         echo "Checking if your siginfo_t has si_uid field...">&4
18204         set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
18205         eval $hasfield_t;
18206
18207         echo "Checking if your siginfo_t has si_addr field...">&4
18208         set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
18209         eval $hasfield_t;
18210
18211         echo "Checking if your siginfo_t has si_status field...">&4
18212         set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
18213         eval $hasfield_t;
18214
18215         echo "Checking if your siginfo_t has si_band field...">&4
18216         set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
18217         eval $hasfield_t;
18218
18219         echo "Checking if your siginfo_t has si_value field...">&4
18220         set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
18221         eval $hasfield_t;
18222
18223         echo "Checking if your siginfo_t has si_fd field...">&4
18224         set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
18225         eval $hasfield_t;
18226
18227         ;;
18228 *)
18229         d_siginfo_si_errno="$undef"
18230         d_siginfo_si_pid="$undef"
18231         d_siginfo_si_uid="$undef"
18232         d_siginfo_si_addr="$undef"
18233         d_siginfo_si_status="$undef"
18234         d_siginfo_si_band="$undef"
18235         d_siginfo_si_value="$undef"
18236         d_siginfo_si_fd="$undef"
18237         ;;
18238 esac
18239
18240 : see if this is a sunmath.h system
18241 set sunmath.h i_sunmath
18242 eval $inhdr
18243
18244 : see if signbit exists
18245 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18246 $cat >try.c <<EOCP
18247 #$i_sunmath I_SUNMATH
18248 #include <math.h>
18249 #ifdef I_SUNMATH  /* Solaris special math library */
18250 #  include <sunmath.h>
18251 #endif
18252 #define NV $nvtype
18253 int main(int argc, char **argv)
18254 {
18255     NV x = 0.0;
18256     NV y = -1.0;
18257     if ((signbit(x) == 0) && (signbit(y) != 0))
18258         return 0;
18259     else
18260         return 1;
18261 }
18262 EOCP
18263 val="$undef"
18264 set try
18265 if eval $compile; then
18266     if $run ./try; then
18267         $echo "Yes." >&4
18268         val="$define"
18269     else
18270         $echo "Signbit seems to be available, but doesn't work as I expected."
18271         $echo "I won't use it." >&4
18272         val="$undef"
18273     fi
18274 else
18275     $echo "Nope." >&4
18276     dflt="$undef"
18277 fi
18278 set d_signbit
18279 eval $setvar
18280 $rm_try
18281
18282 : see if sigprocmask exists
18283 set sigprocmask d_sigprocmask
18284 eval $inlibc
18285
18286 : see if sigsetjmp exists
18287 echo " "
18288 case "$d_sigsetjmp" in
18289 '')
18290         $cat >try.c <<EOP
18291 #include <setjmp.h>
18292 #$i_stdlib I_STDLIB
18293 #ifdef I_STDLIB
18294 #include <stdlib.h>
18295 #endif
18296 sigjmp_buf env;
18297 int set = 1;
18298 int main()
18299 {
18300         if (sigsetjmp(env,1))
18301                 exit(set);
18302         set = 0;
18303         siglongjmp(env, 1);
18304         exit(1);
18305 }
18306 EOP
18307         set try
18308         if eval $compile; then
18309                 if $run ./try >/dev/null 2>&1; then
18310                         echo "POSIX sigsetjmp found." >&4
18311                         val="$define"
18312                 else
18313                         $cat >&4 <<EOM
18314 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18315 I'll ignore them.
18316 EOM
18317                         val="$undef"
18318                 fi
18319         else
18320                 echo "sigsetjmp not found." >&4
18321                 val="$undef"
18322         fi
18323         ;;
18324 *) val="$d_sigsetjmp"
18325         case "$d_sigsetjmp" in
18326         $define) echo "POSIX sigsetjmp found." >&4;;
18327         $undef) echo "sigsetjmp not found." >&4;;
18328         esac
18329         ;;
18330 esac
18331 set d_sigsetjmp
18332 eval $setvar
18333 $rm_try
18334
18335 : see if snprintf exists
18336 set snprintf d_snprintf
18337 eval $inlibc
18338
18339 : see if vsnprintf exists
18340 set vsnprintf d_vsnprintf
18341 eval $inlibc
18342
18343 case "$d_snprintf-$d_vsnprintf" in
18344 "$define-$define")
18345     $cat <<EOM
18346 Checking whether your snprintf() and vsnprintf() work okay...
18347 EOM
18348     $cat >try.c <<'EOCP'
18349 /* v?snprintf testing logic courtesy of Russ Allbery.
18350  * According to C99:
18351  * - if the buffer is too short it still must be \0-terminated
18352  * - if the buffer is too short the potentially required length
18353  *   must be returned and not -1
18354  * - if the buffer is NULL the potentially required length
18355  *   must be returned and not -1 or core dump
18356  */
18357 #include <stdio.h>
18358 #include <stdarg.h>
18359
18360 char buf[2];
18361
18362 int test (char *format, ...)
18363 {
18364     va_list args;
18365     int count;
18366
18367     va_start (args, format);
18368     count = vsnprintf (buf, sizeof buf, format, args);
18369     va_end (args);
18370     return count;
18371 }
18372
18373 int main ()
18374 {
18375     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18376              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18377 }
18378 EOCP
18379     set try
18380     if eval $compile; then
18381         `$run ./try`
18382         case "$?" in
18383         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18384         *) cat <<EOM >&4
18385 Your snprintf() and snprintf() don't seem to be working okay.
18386 EOM
18387            d_snprintf="$undef"
18388            d_vsnprintf="$undef"
18389            ;;
18390         esac
18391     else
18392         echo "(I can't seem to compile the test program--assuming they don't)"
18393         d_snprintf="$undef"
18394         d_vsnprintf="$undef"
18395     fi
18396     $rm_try
18397     ;;
18398 esac
18399
18400 : see if sockatmark exists
18401 set sockatmark d_sockatmark
18402 eval $inlibc
18403
18404 : see if prototype for sockatmark is available
18405 echo " "
18406 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18407 eval $hasproto
18408
18409 : see if socks5_init exists
18410 set socks5_init d_socks5_init
18411 eval $inlibc
18412
18413 : see if srand48_r exists
18414 set srand48_r d_srand48_r
18415 eval $inlibc
18416 case "$d_srand48_r" in
18417 "$define")
18418         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18419         case "$d_srand48_r_proto:$usethreads" in
18420         ":define")      d_srand48_r_proto=define
18421                 set d_srand48_r_proto srand48_r $hdrs
18422                 eval $hasproto ;;
18423         *)      ;;
18424         esac
18425         case "$d_srand48_r_proto" in
18426         define)
18427         case "$srand48_r_proto" in
18428         ''|0) try='int srand48_r(long, struct drand48_data*);'
18429         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18430         esac
18431         case "$srand48_r_proto" in
18432         ''|0)   d_srand48_r=undef
18433                 srand48_r_proto=0
18434                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18435         * )     case "$srand48_r_proto" in
18436                 REENTRANT_PROTO*) ;;
18437                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18438                 esac
18439                 echo "Prototype: $try" ;;
18440         esac
18441         ;;
18442         *)      case "$usethreads" in
18443                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18444                 esac
18445                 d_srand48_r=undef
18446                 srand48_r_proto=0
18447                 ;;
18448         esac
18449         ;;
18450 *)      srand48_r_proto=0
18451         ;;
18452 esac
18453
18454 : see if srandom_r exists
18455 set srandom_r d_srandom_r
18456 eval $inlibc
18457 case "$d_srandom_r" in
18458 "$define")
18459         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18460         case "$d_srandom_r_proto:$usethreads" in
18461         ":define")      d_srandom_r_proto=define
18462                 set d_srandom_r_proto srandom_r $hdrs
18463                 eval $hasproto ;;
18464         *)      ;;
18465         esac
18466         case "$d_srandom_r_proto" in
18467         define)
18468         case "$srandom_r_proto" in
18469         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18470         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18471         esac
18472         case "$srandom_r_proto" in
18473         ''|0)   d_srandom_r=undef
18474                 srandom_r_proto=0
18475                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18476         * )     case "$srandom_r_proto" in
18477                 REENTRANT_PROTO*) ;;
18478                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18479                 esac
18480                 echo "Prototype: $try" ;;
18481         esac
18482         ;;
18483         *)      case "$usethreads" in
18484                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18485                 esac
18486                 d_srandom_r=undef
18487                 srandom_r_proto=0
18488                 ;;
18489         esac
18490         ;;
18491 *)      srandom_r_proto=0
18492         ;;
18493 esac
18494
18495 : see if prototype for setresgid is available
18496 echo " "
18497 set d_sresgproto setresgid $i_unistd unistd.h
18498 eval $hasproto
18499
18500 : see if prototype for setresuid is available
18501 echo " "
18502 set d_sresuproto setresuid $i_unistd unistd.h
18503 eval $hasproto
18504
18505 : see if stat exists
18506 set stat d_stat
18507 eval $inlibc
18508
18509 : see if sys/stat.h is available
18510 set sys/stat.h i_sysstat
18511 eval $inhdr
18512
18513 : see if stat knows about block sizes
18514 echo " "
18515 echo "Checking to see if your struct stat has st_blocks field..." >&4
18516 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18517 eval $hasfield
18518
18519 : see if this is a sys/vfs.h system
18520 set sys/vfs.h i_sysvfs
18521 eval $inhdr
18522
18523 : see if this is a sys/statfs.h system
18524 set sys/statfs.h i_sysstatfs
18525 eval $inhdr
18526
18527 : Check for statfs_s
18528 echo " "
18529 echo "Checking to see if your system supports struct statfs..." >&4
18530 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
18531 eval $hasstruct
18532 case "$d_statfs_s" in
18533 "$define")      echo "Yes, it does."   ;;
18534 *)              echo "No, it doesn't." ;;
18535 esac
18536
18537
18538 : see if struct statfs knows about f_flags
18539 case "$d_statfs_s" in
18540 define)
18541         echo " "
18542         echo "Checking to see if your struct statfs has f_flags field..." >&4
18543         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
18544         eval $hasfield
18545         ;;
18546 *)      val="$undef"
18547         set d_statfs_f_flags
18548         eval $setvar
18549         ;;
18550 esac
18551 case "$d_statfs_f_flags" in
18552 "$define")      echo "Yes, it does."   ;;
18553 *)              echo "No, it doesn't." ;;
18554 esac
18555
18556 : see what flavor, if any, of static inline is supported
18557 echo " "
18558 echo "Checking to see if your system supports static inline..."
18559 $cat > try.c <<'EOCP'
18560 #include <stdlib.h>
18561 extern int f_via_a(int x);
18562 extern int f_via_b(int x);
18563 int main(int argc, char **argv)
18564 {
18565     int y;
18566
18567     y = f_via_a(0);
18568 #ifdef USE_B
18569     y = f_via_b(0);
18570 #endif
18571     if (y == 42) {
18572         return EXIT_SUCCESS;
18573     }
18574     else {
18575         return EXIT_FAILURE;
18576     }
18577 }
18578 EOCP
18579 $cat > a.c <<'EOCP'
18580 static INLINE int f(int x) {
18581     int y;
18582     y = x + 42;
18583     return y;
18584 }
18585
18586 int f_via_a(int x)
18587 {
18588     return f(x);
18589 }
18590 EOCP
18591 $cat > b.c <<'EOCP'
18592 extern int f(int x);
18593
18594 int f_via_b(int x)
18595 {
18596     return f(x);
18597 }
18598 EOCP
18599
18600 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18601 case "$perl_static_inline" in
18602 '')     # Check the various possibilities, and break out on success.
18603         # For gcc, prefer __inline__, which will still permit
18604         # cflags.SH to add in -ansi.
18605         case "$gccversion" in
18606                 '') xxx="inline __inline__ __inline _inline";;
18607                 *)  xxx="__inline__ inline __inline _inline";;
18608         esac
18609         for inline in $xxx; do
18610                 set try -DINLINE=$inline a.c
18611                 if eval $compile && $run ./try; then
18612                         # Now make sure there is no external linkage of static
18613                         # functions
18614                         set try -DINLINE=$inline -DUSE_B a.c b.c
18615                         if eval $compile && $run ./try; then
18616                                 $echo "Your compiler supports static $inline, " >&4
18617                                 $echo "but it also creates an external definition," >&4
18618                                 $echo "so I won't use it." >&4
18619                                 val=$undef
18620                         else
18621                                 $echo "Your compiler supports static $inline." >&4
18622                                 val=$define
18623                                 perl_static_inline="static $inline";
18624                                 break;
18625                         fi
18626                 else
18627                         $echo "Your compiler does NOT support static $inline." >&4
18628                         val="$undef"
18629                 fi
18630         done
18631         ;;
18632 *inline*) # Some variant of inline exists.
18633         echo "Keeping your $hint value of $perl_static_inline."
18634         val=$define
18635         ;;
18636 static)  # No inline capabilities
18637         echo "Keeping your $hint value of $perl_static_inline."
18638         val=$undef
18639         ;;
18640 *)  # Unrecognized previous value -- blindly trust the supplied
18641         # value and hope it makes sense.  Use old value for
18642         # d_static_inline, if there is one.
18643         echo "Keeping your $hint value of $perl_static_inline."
18644         case "$d_static_inline" in
18645                 '') val=$define ;;
18646                 *)  val=$d_static_inline ;;
18647         esac
18648         ;;
18649 esac
18650 # Fallback to plain 'static' if nothing worked.
18651 case "$perl_static_inline" in
18652 '')
18653         perl_static_inline="static"
18654         val=$undef
18655         ;;
18656 esac
18657 set d_static_inline
18658 eval $setvar
18659 $rm -f a.[co] b.[co]
18660 $rm_try
18661
18662 : Check stream access
18663 $cat >&4 <<EOM
18664 Checking how to access stdio streams by file descriptor number...
18665 EOM
18666 case "$stdio_stream_array" in
18667 '')     $cat >try.c <<EOCP
18668 #include <stdio.h>
18669 int main() {
18670   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18671     printf("yes\n");
18672 }
18673 EOCP
18674         for s in _iob __iob __sF
18675         do
18676                 set try -DSTDIO_STREAM_ARRAY=$s
18677                 if eval $compile; then
18678                         case "`$run ./try`" in
18679                         yes)    stdio_stream_array=$s; break ;;
18680                         esac
18681                 fi
18682         done
18683         $rm_try
18684 esac
18685 case "$stdio_stream_array" in
18686 '')     $cat >&4 <<EOM
18687 I can't figure out how to access stdio streams by file descriptor number.
18688 EOM
18689         d_stdio_stream_array="$undef"
18690         ;;
18691 *)      $cat >&4 <<EOM
18692 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18693 EOM
18694         d_stdio_stream_array="$define"
18695         ;;
18696 esac
18697
18698 : see if strcoll exists
18699 set strcoll d_strcoll
18700 eval $inlibc
18701
18702 : see if strerror_l exists
18703 set strerror_l d_strerror_l
18704 eval $inlibc
18705
18706 : see if strerror_r exists
18707 set strerror_r d_strerror_r
18708 eval $inlibc
18709 case "$d_strerror_r" in
18710 "$define")
18711         hdrs="$i_systypes sys/types.h define stdio.h define string.h"
18712         case "$d_strerror_r_proto:$usethreads" in
18713         ":define")      d_strerror_r_proto=define
18714                 set d_strerror_r_proto strerror_r $hdrs
18715                 eval $hasproto ;;
18716         *)      ;;
18717         esac
18718         case "$d_strerror_r_proto" in
18719         define)
18720         case "$strerror_r_proto" in
18721         ''|0) try='int strerror_r(int, char*, size_t);'
18722         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18723         esac
18724         case "$strerror_r_proto" in
18725         ''|0) try='int strerror_r(int, char*, int);'
18726         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18727         esac
18728         case "$strerror_r_proto" in
18729         ''|0) try='char* strerror_r(int, char*, size_t);'
18730         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18731         esac
18732         case "$strerror_r_proto" in
18733         ''|0)   d_strerror_r=undef
18734                 strerror_r_proto=0
18735                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18736         * )     case "$strerror_r_proto" in
18737                 REENTRANT_PROTO*) ;;
18738                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18739                 esac
18740                 echo "Prototype: $try" ;;
18741         esac
18742         ;;
18743         *)      case "$usethreads" in
18744                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18745                 esac
18746                 d_strerror_r=undef
18747                 strerror_r_proto=0
18748                 ;;
18749         esac
18750         ;;
18751 *)      strerror_r_proto=0
18752         ;;
18753 esac
18754
18755 : see if strftime exists
18756 set strftime d_strftime
18757 eval $inlibc
18758
18759 : see if strlcat exists
18760 set strlcat d_strlcat
18761 eval $inlibc
18762
18763 : see if strlcpy exists
18764 set strlcpy d_strlcpy
18765 eval $inlibc
18766
18767 : see if strnlen exists
18768 set strnlen d_strnlen
18769 eval $inlibc
18770
18771 : see if strtod exists
18772 set strtod d_strtod
18773 eval $inlibc
18774
18775 : see if strtol exists
18776 set strtol d_strtol
18777 eval $inlibc
18778
18779 : see if strtold exists
18780 set strtold d_strtold
18781 eval $inlibc
18782
18783 : see if strtold_l exists
18784 set strtold_l d_strtold_l
18785 eval $inlibc
18786
18787 : see if strtoll exists
18788 set strtoll d_strtoll
18789 eval $inlibc
18790
18791 case "$d_longlong-$d_strtoll" in
18792 "$define-$define")
18793         $cat <<EOM
18794 Checking whether your strtoll() works okay...
18795 EOM
18796         $cat >try.c <<'EOCP'
18797 #include <errno.h>
18798 #ifdef __hpux
18799 #define strtoll __strtoll
18800 #endif
18801 #ifdef __EMX__
18802 #define strtoll _strtoll
18803 #endif
18804 #include <stdio.h>
18805 extern long long int strtoll(char *s, char **, int);
18806 static int bad = 0;
18807 int check(char *s, long long ell, int een) {
18808         long long gll;
18809         errno = 0;
18810         gll = strtoll(s, 0, 10);
18811         if (!((gll == ell) && (errno == een)))
18812                 bad++;
18813 }
18814 int main() {
18815         check(" 1",                                      1LL, 0);
18816         check(" 0",                                      0LL, 0);
18817         check("-1",                                     -1LL, 0);
18818         check("-9223372036854775808", -9223372036854775808LL, 0);
18819         check("-9223372036854775808", -9223372036854775808LL, 0);
18820         check(" 9223372036854775807",  9223372036854775807LL, 0);
18821         check("-9223372036854775808", -9223372036854775808LL, 0);
18822         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18823         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18824         if (!bad)
18825                 printf("ok\n");
18826 }
18827 EOCP
18828         set try
18829         if eval $compile; then
18830                 yyy=`$run ./try`
18831                 case "$yyy" in
18832                 ok) echo "Your strtoll() seems to be working okay." ;;
18833                 *) cat <<EOM >&4
18834 Your strtoll() doesn't seem to be working okay.
18835 EOM
18836                    d_strtoll="$undef"
18837                    ;;
18838                 esac
18839         else
18840                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18841                 d_strtoll="$undef"
18842         fi
18843         ;;
18844 esac
18845
18846 : see if strtoq exists
18847 set strtoq d_strtoq
18848 eval $inlibc
18849
18850 : see if strtoul exists
18851 set strtoul d_strtoul
18852 eval $inlibc
18853
18854 case "$d_strtoul" in
18855 "$define")
18856         $cat <<EOM
18857 Checking whether your strtoul() works okay...
18858 EOM
18859         $cat >try.c <<'EOCP'
18860 #include <errno.h>
18861 #include <stdio.h>
18862 extern unsigned long int strtoul(char *s, char **, int);
18863 static int bad = 0;
18864 void check(char *s, unsigned long eul, int een) {
18865         unsigned long gul;
18866         errno = 0;
18867         gul = strtoul(s, 0, 10);
18868         if (!((gul == eul) && (errno == een)))
18869                 bad++;
18870 }
18871 int main() {
18872         check(" 1", 1L, 0);
18873         check(" 0", 0L, 0);
18874 EOCP
18875         case "$longsize" in
18876         8)
18877             $cat >>try.c <<'EOCP'
18878         check("18446744073709551615", 18446744073709551615UL, 0);
18879         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18880 #if 0 /* strtoul() for /^-/ strings is undefined. */
18881         check("-1", 18446744073709551615UL, 0);
18882         check("-18446744073709551614", 2, 0);
18883         check("-18446744073709551615", 1, 0);
18884         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18885         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18886 #endif
18887 EOCP
18888                 ;;
18889         4)
18890                     $cat >>try.c <<'EOCP'
18891         check("4294967295", 4294967295UL, 0);
18892         check("4294967296", 4294967295UL, ERANGE);
18893 #if 0 /* strtoul() for /^-/ strings is undefined. */
18894         check("-1", 4294967295UL, 0);
18895         check("-4294967294", 2, 0);
18896         check("-4294967295", 1, 0);
18897         check("-4294967296", 4294967295UL, ERANGE);
18898         check("-4294967297", 4294967295UL, ERANGE);
18899 #endif
18900 EOCP
18901                 ;;
18902         *)
18903 : Should we write these tests to be more portable by sprintf-ing
18904 : ~0 and then manipulating that char string as input for strtol?
18905                 ;;
18906         esac
18907         $cat >>try.c <<'EOCP'
18908         if (!bad)
18909                 printf("ok\n");
18910         return 0;
18911 }
18912 EOCP
18913         set try
18914         if eval $compile; then
18915                 case "`$run ./try`" in
18916                 ok) echo "Your strtoul() seems to be working okay." ;;
18917                 *) cat <<EOM >&4
18918 Your strtoul() doesn't seem to be working okay.
18919 EOM
18920                    d_strtoul="$undef"
18921                    ;;
18922                 esac
18923         else
18924                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18925                 d_strtoul="$undef"
18926         fi
18927         ;;
18928 esac
18929
18930 : see if strtoull exists
18931 set strtoull d_strtoull
18932 eval $inlibc
18933
18934 case "$d_longlong-$d_strtoull" in
18935 "$define-$define")
18936         $cat <<EOM
18937 Checking whether your strtoull() works okay...
18938 EOM
18939         $cat >try.c <<'EOCP'
18940 #include <errno.h>
18941 #ifdef __hpux
18942 #define strtoull __strtoull
18943 #endif
18944 #include <stdio.h>
18945 extern unsigned long long int strtoull(char *s, char **, int);
18946 static int bad = 0;
18947 int check(char *s, long long eull, int een) {
18948         long long gull;
18949         errno = 0;
18950         gull = strtoull(s, 0, 10);
18951         if (!((gull == eull) && (errno == een)))
18952                 bad++;
18953 }
18954 int main() {
18955         check(" 1",                                        1LL, 0);
18956         check(" 0",                                        0LL, 0);
18957         check("18446744073709551615",  18446744073709551615ULL, 0);
18958         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18959 #if 0 /* strtoull() for /^-/ strings is undefined. */
18960         check("-1",                    18446744073709551615ULL, 0);
18961         check("-18446744073709551614",                     2LL, 0);
18962         check("-18446744073709551615",                     1LL, 0);
18963         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18964         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18965 #endif
18966         if (!bad)
18967                 printf("ok\n");
18968 }
18969 EOCP
18970         set try
18971         if eval $compile; then
18972                 case "`$run ./try`" in
18973                 ok) echo "Your strtoull() seems to be working okay." ;;
18974                 *) cat <<EOM >&4
18975 Your strtoull() doesn't seem to be working okay.
18976 EOM
18977                    d_strtoull="$undef"
18978                    ;;
18979                 esac
18980         else
18981                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18982                 d_strtoull="$undef"
18983         fi
18984         ;;
18985 esac
18986
18987 : see if strtouq exists
18988 set strtouq d_strtouq
18989 eval $inlibc
18990
18991 case "$d_strtouq" in
18992 "$define")
18993         $cat <<EOM
18994 Checking whether your strtouq() works okay...
18995 EOM
18996         $cat >try.c <<'EOCP'
18997 #include <errno.h>
18998 #include <stdio.h>
18999 extern unsigned long long int strtouq(char *s, char **, int);
19000 static int bad = 0;
19001 void check(char *s, unsigned long long eull, int een) {
19002         unsigned long long gull;
19003         errno = 0;
19004         gull = strtouq(s, 0, 10);
19005         if (!((gull == eull) && (errno == een)))
19006                 bad++;
19007 }
19008 int main() {
19009         check(" 1",                                        1LL, 0);
19010         check(" 0",                                        0LL, 0);
19011         check("18446744073709551615",  18446744073709551615ULL, 0);
19012         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19013 #if 0 /* strtouq() for /^-/ strings is undefined. */
19014         check("-1",                    18446744073709551615ULL, 0);
19015         check("-18446744073709551614",                     2LL, 0);
19016         check("-18446744073709551615",                     1LL, 0);
19017         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19018         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19019 #endif
19020         if (!bad)
19021                 printf("ok\n");
19022         return 0;
19023 }
19024 EOCP
19025         set try
19026         if eval $compile; then
19027                 case "`$run ./try`" in
19028                 ok) echo "Your strtouq() seems to be working okay." ;;
19029                 *) cat <<EOM >&4
19030 Your strtouq() doesn't seem to be working okay.
19031 EOM
19032                    d_strtouq="$undef"
19033                    ;;
19034                 esac
19035         else
19036                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19037                 d_strtouq="$undef"
19038         fi
19039         ;;
19040 esac
19041
19042 : see if strxfrm exists
19043 set strxfrm d_strxfrm
19044 eval $inlibc
19045
19046 : see if symlink exists
19047 set symlink d_symlink
19048 eval $inlibc
19049
19050 : see if syscall exists
19051 set syscall d_syscall
19052 eval $inlibc
19053
19054 : see if prototype for syscall is available
19055 echo " "
19056 set d_syscallproto syscall $i_unistd unistd.h
19057 eval $hasproto
19058
19059 : see if sysconf exists
19060 set sysconf d_sysconf
19061 eval $inlibc
19062
19063 : see if sys_errlist[] exists
19064 echo " "
19065 if test "X$d_syserrlst" = X; then
19066         if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19067                 echo "You have sys_errlist[], so we could roll our own strerror."
19068                 d_syserrlst="$define"
19069         else
19070                 echo "You don't have sys_errlist[], so strerror() is welcome."
19071                 d_syserrlst="$undef"
19072         fi
19073 fi
19074
19075 : see if system exists
19076 set system d_system
19077 eval $inlibc
19078
19079 : see if tcgetpgrp exists
19080 set tcgetpgrp d_tcgetpgrp
19081 eval $inlibc
19082
19083 : see if tcsetpgrp exists
19084 set tcsetpgrp d_tcsetpgrp
19085 eval $inlibc
19086
19087 : see if prototype for telldir is available
19088 echo " "
19089 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19090 eval $hasproto
19091
19092 : see if tgamma exists
19093 set tgamma d_tgamma
19094 eval $inlibc
19095
19096 : check for thread_safe_nl_langinfo_l item
19097 $cat <<EOM
19098
19099 Checking to see if you have nl_langinfo_l() and that it is thread-safe
19100 EOM
19101 $cat >try.c <<EOCP
19102 #$i_stdlib I_STDLIB
19103 #ifdef I_STDLIB
19104 #  include <stdlib.h>
19105 #endif
19106 #include <string.h>
19107 #$i_langinfo I_LANGINFO
19108 #ifdef I_LANGINFO
19109 #  include <langinfo.h>
19110 #endif
19111 #$i_pthread I_PTHREAD
19112 #ifdef I_PTHREAD
19113 #  include <pthread.h>
19114 #endif
19115 #$i_locale I_LOCALE
19116 #ifdef I_LOCALE
19117 #  include <locale.h>
19118 #endif
19119
19120 void *
19121 thread_start(void * arg)
19122 {
19123     nl_langinfo(RADIXCHAR);
19124 }
19125
19126 int main() {
19127     char * main_buffer;
19128     char save_main_buffer[1000];
19129     pthread_t subthread;
19130     pthread_attr_t attr;
19131
19132     main_buffer = nl_langinfo_l(CODESET, newlocale(LC_ALL_MASK, "C", 0));
19133
19134     /* If too large for our generous allowance, just assume we don't have
19135      * it. */
19136     if (strlen(main_buffer) >= sizeof(save_main_buffer)) {
19137         exit(1);
19138     }
19139
19140     strcpy(save_main_buffer, main_buffer);
19141
19142     if (pthread_attr_init(&attr) != 0) {
19143         exit(1);
19144     }
19145
19146     if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) {
19147         exit(1);
19148     }
19149
19150     if (pthread_join(subthread, NULL) != 0) {
19151         exit(1);
19152     }
19153
19154     exit(! (strcmp(main_buffer, save_main_buffer) == 0));
19155 }
19156 EOCP
19157 case "$usethreads" in
19158     define)
19159         set try
19160         if eval $compile; then
19161             echo "Your system has nl_langinfo_l()..." >&4
19162             if $run ./try; then
19163                 echo "and it is thread-safe (just as I'd hoped)." >&4
19164                 d_thread_safe_nl_langinfo_l="$define"
19165                 echo "$d_thread_safe_nl_langinfo_l" >&4
19166             else
19167                 echo "but it isn't thread-safe, so we won't use it." >&4
19168             fi
19169         else
19170             echo "your system does not have nl_langinfo_l()" >&4
19171         fi
19172         ;;
19173     *) echo "Since threads aren't selected, we won't bother looking for nl_langinfo_l()" >&4
19174 esac
19175 if test X"$d_thread_safe_nl_langinfo_l" = X; then
19176         d_thread_safe_nl_langinfo_l="$undef"
19177 fi
19178 $rm_try
19179
19180 : see if time exists
19181 echo " "
19182 if test "X$d_time" = X -o X"$timetype" = X; then
19183     if set time val -f d_time; eval $csym; $val; then
19184                 echo 'time() found.' >&4
19185                 val="$define"
19186                 rp="What is the type returned by time() on this system?"
19187                 set time_t timetype long stdio.h sys/types.h
19188                 eval $typedef_ask
19189     else
19190                 echo 'time() not found, hope that will do.' >&4
19191                 val="$undef"
19192                 timetype='int';
19193     fi
19194     set d_time
19195     eval $setvar
19196 fi
19197
19198 : see if timegm exists
19199 set timegm d_timegm
19200 eval $inlibc
19201
19202 : see if this is a sys/times.h system
19203 set sys/times.h i_systimes
19204 eval $inhdr
19205
19206 : see if times exists
19207 echo " "
19208 if set times val -f d_times; eval $csym; $val; then
19209         echo 'times() found.' >&4
19210         d_times="$define"
19211         inc=''
19212         case "$i_systimes" in
19213         "$define") inc='sys/times.h';;
19214         esac
19215         rp="What is the type returned by times() on this system?"
19216         set clock_t clocktype long stdio.h sys/types.h $inc
19217         eval $typedef_ask
19218 else
19219         echo 'times() NOT found, hope that will do.' >&4
19220         d_times="$undef"
19221         clocktype='int'
19222 fi
19223
19224 : see if tmpnam_r exists
19225 set tmpnam_r d_tmpnam_r
19226 eval $inlibc
19227 case "$d_tmpnam_r" in
19228 "$define")
19229         hdrs="$i_systypes sys/types.h define stdio.h "
19230         case "$d_tmpnam_r_proto:$usethreads" in
19231         ":define")      d_tmpnam_r_proto=define
19232                 set d_tmpnam_r_proto tmpnam_r $hdrs
19233                 eval $hasproto ;;
19234         *)      ;;
19235         esac
19236         case "$d_tmpnam_r_proto" in
19237         define)
19238         case "$tmpnam_r_proto" in
19239         ''|0) try='char* tmpnam_r(char*);'
19240         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19241         esac
19242         case "$tmpnam_r_proto" in
19243         ''|0)   d_tmpnam_r=undef
19244                 tmpnam_r_proto=0
19245                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19246         * )     case "$tmpnam_r_proto" in
19247                 REENTRANT_PROTO*) ;;
19248                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19249                 esac
19250                 echo "Prototype: $try" ;;
19251         esac
19252         ;;
19253         *)      case "$usethreads" in
19254                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19255                 esac
19256                 d_tmpnam_r=undef
19257                 tmpnam_r_proto=0
19258                 ;;
19259         esac
19260         ;;
19261 *)      tmpnam_r_proto=0
19262         ;;
19263 esac
19264
19265 : see if trunc exists
19266 set trunc d_trunc
19267 eval $inlibc
19268
19269 : see if truncate exists
19270 set truncate d_truncate
19271 eval $inlibc
19272
19273 : see if ttyname_r exists
19274 set ttyname_r d_ttyname_r
19275 eval $inlibc
19276 case "$d_ttyname_r" in
19277 "$define")
19278         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19279         case "$d_ttyname_r_proto:$usethreads" in
19280         ":define")      d_ttyname_r_proto=define
19281                 set d_ttyname_r_proto ttyname_r $hdrs
19282                 eval $hasproto ;;
19283         *)      ;;
19284         esac
19285         case "$d_ttyname_r_proto" in
19286         define)
19287         case "$ttyname_r_proto" in
19288         ''|0) try='int ttyname_r(int, char*, size_t);'
19289         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19290         esac
19291         case "$ttyname_r_proto" in
19292         ''|0) try='int ttyname_r(int, char*, int);'
19293         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19294         esac
19295         case "$ttyname_r_proto" in
19296         ''|0) try='char* ttyname_r(int, char*, int);'
19297         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19298         esac
19299         case "$ttyname_r_proto" in
19300         ''|0)   d_ttyname_r=undef
19301                 ttyname_r_proto=0
19302                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19303         * )     case "$ttyname_r_proto" in
19304                 REENTRANT_PROTO*) ;;
19305                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19306                 esac
19307                 echo "Prototype: $try" ;;
19308         esac
19309         ;;
19310         *)      case "$usethreads" in
19311                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19312                 esac
19313                 d_ttyname_r=undef
19314                 ttyname_r_proto=0
19315                 ;;
19316         esac
19317         ;;
19318 *)      ttyname_r_proto=0
19319         ;;
19320 esac
19321
19322 : see if tzname[] exists
19323 echo " "
19324 if set tzname val -a d_tzname; eval $csym; $val; then
19325         val="$define"
19326         echo 'tzname[] found.' >&4
19327 else
19328         val="$undef"
19329         echo 'tzname[] NOT found.' >&4
19330 fi
19331 set d_tzname
19332 eval $setvar
19333
19334 : Check if is a multiplatform env
19335 case "$osname" in
19336 darwin) multiarch="$define" ;;
19337 esac
19338 case "$multiarch" in
19339 ''|[nN]*) multiarch="$undef" ;;
19340 esac
19341
19342 : check for ordering of bytes in a UV
19343 echo " "
19344 case "$multiarch" in
19345 *$define*)
19346         $cat <<EOM
19347 You seem to be doing a multiarchitecture build,
19348 skipping the byteorder check.
19349
19350 EOM
19351         byteorder='ffff'
19352         ;;
19353 *)
19354         case "$byteorder" in
19355         '')
19356                 $cat <<'EOM'
19357 In the following, larger digits indicate more significance.  A big-endian
19358 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19359 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19360 machines may have weird orders like 3412.  A Cray will report 87654321,
19361 an Alpha will report 12345678. If the test program works the default is
19362 probably right.
19363 I'm now running the test program...
19364 EOM
19365                 $cat >try.c <<EOCP
19366 #include <stdio.h>
19367 #$i_stdlib I_STDLIB
19368 #ifdef I_STDLIB
19369 #include <stdlib.h>
19370 #endif
19371 #include <sys/types.h>
19372 typedef $uvtype UV;
19373 int main()
19374 {
19375         int i;
19376         union {
19377                 UV l;
19378                 char c[$uvsize];
19379         } u;
19380
19381         if ($uvsize > 4)
19382                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19383         else
19384                 u.l = (UV)0x04030201;
19385         for (i = 0; i < $uvsize; i++)
19386                 printf("%c", u.c[i]+'0');
19387         printf("\n");
19388         exit(0);
19389 }
19390 EOCP
19391                 xxx_prompt=y
19392                 set try
19393                 if eval $compile && $run ./try > /dev/null; then
19394                         dflt=`$run ./try`
19395                         case "$dflt" in
19396                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19397                                 echo "(The test program ran ok.)"
19398                                 echo "byteorder=$dflt"
19399                                 xxx_prompt=n
19400                         ;;
19401                         ????|????????) echo "(The test program ran ok.)" ;;
19402                         *) echo "(The test program didn't run right for some reason.)" ;;
19403                         esac
19404                 else
19405                         dflt='4321'
19406                         cat <<'EOM'
19407 (I can't seem to compile the test program.  Guessing big-endian...)
19408 EOM
19409                 fi
19410                 case "$xxx_prompt" in
19411                 y)
19412                         rp="What is the order of bytes in $uvtype?"
19413                         . ./myread
19414                         byteorder="$ans"
19415                         ;;
19416                 *)      byteorder=$dflt
19417                         ;;
19418                 esac
19419                 ;;
19420         esac
19421         $rm_try
19422         ;;
19423 esac
19424
19425 : Checking 32bit alignedness
19426 $cat <<EOM
19427
19428 Checking to see whether you can access character data unalignedly...
19429 EOM
19430 case "$d_u32align" in
19431 '')   $cat >try.c <<EOCP
19432 #include <stdio.h>
19433 #$i_stdlib I_STDLIB
19434 #ifdef I_STDLIB
19435 #include <stdlib.h>
19436 #endif
19437 #define U32 $u32type
19438 #define BYTEORDER 0x$byteorder
19439 #define U8 $u8type
19440 #include <signal.h>
19441 #ifdef SIGBUS
19442 $signal_t bletch(int s) { exit(4); }
19443 #endif
19444 int main() {
19445 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19446     volatile U8 buf[8];
19447     volatile U32 *up;
19448     int i;
19449
19450     if (sizeof(U32) != 4) {
19451         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19452         exit(1);
19453     }
19454
19455     fflush(stdout);
19456
19457 #ifdef SIGBUS
19458     signal(SIGBUS, bletch);
19459 #endif
19460
19461     buf[0] = 0;
19462     buf[1] = 0;
19463     buf[2] = 0;
19464     buf[3] = 1;
19465     buf[4] = 0;
19466     buf[5] = 0;
19467     buf[6] = 0;
19468     buf[7] = 1;
19469
19470     for (i = 0; i < 4; i++) {
19471         up = (U32*)(buf + i);
19472         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19473                (*up == 1 << (8*(3-i)))  /* little-endian */
19474               )
19475            )
19476         {
19477             printf("read failed (%x)\n", *up);
19478             exit(2);
19479         }
19480     }
19481
19482     /* write test */
19483     for (i = 0; i < 4; i++) {
19484         up = (U32*)(buf + i);
19485         *up = 0xBeef;
19486         if (*up != 0xBeef) {
19487             printf("write failed (%x)\n", *up);
19488             exit(3);
19489         }
19490     }
19491
19492     exit(0);
19493 #else
19494     printf("1\n");
19495     exit(1);
19496 #endif
19497     return 0;
19498 }
19499 EOCP
19500 set try
19501 if eval $compile_ok; then
19502         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19503         $run ./try 2>&1 >/dev/null
19504         case "$?" in
19505         0)      cat >&4 <<EOM
19506 You can access character data pretty unalignedly.
19507 EOM
19508                 d_u32align="$undef"
19509                 ;;
19510         *)      cat >&4 <<EOM
19511 It seems that you must access character data in an aligned manner.
19512 EOM
19513                 d_u32align="$define"
19514                 ;;
19515         esac
19516 else
19517         rp='Can you access character data at unaligned addresses?'
19518         dflt='n'
19519         . ./myread
19520         case "$ans" in
19521         [yY]*)  d_u32align="$undef"  ;;
19522         *)      d_u32align="$define" ;;
19523         esac
19524 fi
19525 $rm_try
19526 ;;
19527 esac
19528
19529 : see if ualarm exists
19530 set ualarm d_ualarm
19531 eval $inlibc
19532
19533 : see if umask exists
19534 set umask d_umask
19535 eval $inlibc
19536
19537 : see if unordered exists
19538 set unordered d_unordered
19539 eval $inlibc
19540
19541 : see if unsetenv exists
19542 set unsetenv d_unsetenv
19543 eval $inlibc
19544
19545 : see if usleep exists
19546 set usleep d_usleep
19547 eval $inlibc
19548
19549 : see if prototype for usleep is available
19550 echo " "
19551 set d_usleepproto usleep $i_unistd unistd.h
19552 eval $hasproto
19553
19554 : see if ustat exists
19555 set ustat d_ustat
19556 eval $inlibc
19557
19558 : see if closedir exists
19559 set closedir d_closedir
19560 eval $inlibc
19561
19562 case "$d_closedir" in
19563 "$define")
19564         echo " "
19565         echo "Checking whether closedir() returns a status..." >&4
19566         cat > try.c <<EOM
19567 #$i_dirent I_DIRENT             /**/
19568 #$i_sysdir I_SYS_DIR            /**/
19569 #$i_sysndir I_SYS_NDIR          /**/
19570 #$i_systypes I_SYS_TYPES        /**/
19571
19572 #if defined(I_SYS_TYPES)
19573 #include <sys/types.h>
19574 #endif
19575 #if defined(I_DIRENT)
19576 #include <dirent.h>
19577 #else
19578 #ifdef I_SYS_NDIR
19579 #include <sys/ndir.h>
19580 #else
19581 #ifdef I_SYS_DIR
19582 #include <sys/dir.h>
19583 #endif
19584 #endif
19585 #endif
19586 int main() { return closedir(opendir(".")); }
19587 EOM
19588         set try
19589         if eval $compile_ok; then
19590                 if $run ./try > /dev/null 2>&1 ; then
19591                         echo "Yes, it does."
19592                         val="$undef"
19593                 else
19594                         echo "No, it doesn't."
19595                         val="$define"
19596                 fi
19597         else
19598                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19599                 val="$define"
19600         fi
19601         ;;
19602 *)
19603         val="$undef";
19604         ;;
19605 esac
19606 set d_void_closedir
19607 eval $setvar
19608 $rm_try
19609
19610 : see if there is a wait4
19611 set wait4 d_wait4
19612 eval $inlibc
19613
19614 : see if waitpid exists
19615 set waitpid d_waitpid
19616 eval $inlibc
19617
19618 : look for wcscmp
19619 echo " "
19620 $cat >try.c <<'EOCP'
19621 #include <stdio.h>
19622 #include <wchar.h>
19623 int main ()
19624 {
19625     wchar_t *s = L" ";
19626     return (wcscmp (s, s) ? 1 : 0);
19627     }
19628 EOCP
19629 set try
19630 val="$undef"
19631 if eval $compile; then
19632     `$run ./try`
19633     case "$?" in
19634         0)  echo "A working wcscmp() found." >&4
19635             val="$define" ;;
19636         *)  echo "wcscmp() found, but it doesn't work" >&4
19637             ;;
19638         esac
19639 else
19640     echo "wcscmp() NOT found." >&4
19641     fi
19642 set d_wcscmp
19643 eval $setvar
19644 $rm_try
19645
19646 : see if wcstombs exists
19647 set wcstombs d_wcstombs
19648 eval $inlibc
19649
19650 : look for wcsxfrm
19651 echo " "
19652 $cat >try.c <<'EOCP'
19653 #include <errno.h>
19654 #include <wchar.h>
19655 int main ()
19656 {
19657     wchar_t dst[4], *src = L" ";
19658     errno = 0;
19659     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
19660     }
19661 EOCP
19662 set try
19663 val="$undef"
19664 if eval $compile; then
19665     `$run ./try`
19666     case "$?" in
19667         0)  echo "A working wcsxfrm() found." >&4
19668             val="$define" ;;
19669         *)  echo "wcsxfrm() found, but it doesn't work" >&4
19670             ;;
19671         esac
19672 else
19673     echo "wcsxfrm() NOT found." >&4
19674     fi
19675 set d_wcsxfrm
19676 eval $setvar
19677 $rm_try
19678
19679 : see if wctomb exists
19680 set wctomb d_wctomb
19681 eval $inlibc
19682
19683 : see if writev exists
19684 set writev d_writev
19685 eval $inlibc
19686
19687 : check for alignment requirements
19688 echo " "
19689 case "$alignbytes" in
19690     '') echo "Checking alignment constraints..." >&4
19691         $cat >try.c <<EOCP
19692 #include <stdio.h>
19693 struct foobar {
19694     char foo;
19695     $nvtype bar;
19696 } try_algn;
19697 int main()
19698 {
19699     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19700     return(0);
19701 }
19702 EOCP
19703         set try
19704         if eval $compile_ok; then
19705             dflt=`$run ./try`
19706         else
19707             dflt='8'
19708             echo "(I can't seem to compile the test program...)"
19709         fi
19710         case "$multiarch" in
19711             *$define*)
19712                 : The usual safe value is 8, but Darwin with -Duselongdouble
19713                 : needs 16.  Hence, we will take 8 as a minimum, but allow
19714                 : Configure to pick a larger value if needed.
19715                 if $test "$dflt" -lt 8; then
19716                     dflt='8'
19717                     echo "Setting alignment to 8 for multiarch support.">&4
19718                 fi
19719                 ;;
19720         esac
19721         ;;
19722     *) dflt="$alignbytes"
19723         ;;
19724 esac
19725 rp="Doubles must be aligned on a how-many-byte boundary?"
19726 . ./myread
19727 alignbytes="$ans"
19728 $rm_try
19729
19730 : set the base revision
19731 baserev=5.0
19732
19733 : length of character in bytes. Is always 1, otherwise it is not C
19734 : This used to be a test using sizeof
19735 charsize=1
19736
19737 : Check for the number of bits in a character
19738 case "$charbits" in
19739 '')     echo "Checking how long a character is (in bits)..." >&4
19740         $cat >try.c <<EOCP
19741 #include <stdio.h>
19742 int main ()
19743 {
19744     int n;
19745     unsigned char c;
19746     for (c = 1, n = 0; c; c <<= 1, n++) ;
19747     printf ("%d\n", n);
19748     return (0);
19749     }
19750 EOCP
19751         set try
19752         if eval $compile_ok; then
19753                 dflt=`$run ./try`
19754         else
19755                 dflt='8'
19756                 echo "(I can't seem to compile the test program.  Guessing...)"
19757         fi
19758         ;;
19759 *)
19760         dflt="$charbits"
19761         ;;
19762 esac
19763 rp="What is the length of a character (in bits)?"
19764 . ./myread
19765 charbits="$ans"
19766 $rm_try
19767 case "$charbits" in
19768 8)      ;;
19769 *)      cat >&4 << EOM
19770 Your system has an unsigned character size of $charbits bits, which
19771 is rather unusual (normally it is 8 bits).  Perl likely will not work
19772 correctly on your system, with subtle bugs in various places.
19773 EOM
19774         rp='Do you really want to continue?'
19775         dflt='n'
19776         . ./myread
19777         case "$ans" in
19778                 [yY])   echo >&4 "Okay, continuing."    ;;
19779                 *)      exit 1                          ;;
19780         esac
19781 esac
19782
19783 : how do we concatenate cpp tokens here?
19784 echo " "
19785 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19786 $cat >cpp_stuff.c <<'EOCP'
19787 #define RCAT(a,b)a/**/b
19788 #define ACAT(a,b)a ## b
19789 RCAT(Rei,ser)
19790 ACAT(Cir,cus)
19791 EOCP
19792 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19793 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19794         echo "Oh!  Smells like ANSI's been here." >&4
19795         echo "We can catify or stringify, separately or together!"
19796         cpp_stuff=42
19797 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19798         echo "Ah, yes!  The good old days!" >&4
19799         echo "However, in the good old days we don't know how to stringify and"
19800         echo "catify at the same time."
19801         cpp_stuff=1
19802 else
19803         $cat >&4 <<EOM
19804 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19805 You're going to have to edit the values of CAT[2-5] in config.h...
19806 EOM
19807         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19808 fi
19809 $rm -f cpp_stuff.*
19810
19811 : see if this is a db.h system
19812 set db.h i_db
19813 eval $inhdr
19814
19815 case "$i_db" in
19816 $define)
19817         : Check db version.
19818         echo " "
19819         echo "Checking Berkeley DB version ..." >&4
19820         $cat >try.c <<EOCP
19821 #$d_const HASCONST
19822 #ifndef HASCONST
19823 #define const
19824 #endif
19825 #include <sys/types.h>
19826 #include <stdio.h>
19827 #$i_stdlib I_STDLIB
19828 #ifdef I_STDLIB
19829 #include <stdlib.h>
19830 #endif
19831 #include <db.h>
19832 int main(int argc, char *argv[])
19833 {
19834 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19835     int Major, Minor, Patch ;
19836     unsigned long Version ;
19837     (void)db_version(&Major, &Minor, &Patch) ;
19838     if (argc == 2) {
19839         printf("%d %d %d %d %d %d\n",
19840                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19841                Major, Minor, Patch);
19842         exit(0);
19843     }
19844     printf("You have Berkeley DB Version 2 or greater.\n");
19845
19846     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19847                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19848     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19849                 Major, Minor, Patch) ;
19850
19851     /* check that db.h & libdb are compatible */
19852     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19853         printf("db.h and libdb are incompatible.\n") ;
19854         exit(3);
19855     }
19856
19857     printf("db.h and libdb are compatible.\n") ;
19858
19859     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19860                 + DB_VERSION_PATCH ;
19861
19862     /* needs to be >= 2.3.4 */
19863     if (Version < 2003004) {
19864     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19865         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19866         exit(2);
19867     }
19868
19869     exit(0);
19870 #else
19871 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19872     if (argc == 2) {
19873         printf("1 0 0\n");
19874         exit(0);
19875     }
19876     printf("You have Berkeley DB Version 1.\n");
19877     exit(0);    /* DB version < 2: the coast is clear. */
19878 #else
19879     exit(1);    /* <db.h> not Berkeley DB? */
19880 #endif
19881 #endif
19882 }
19883 EOCP
19884         set try
19885         if eval $compile_ok && $run ./try; then
19886                 echo 'Looks OK.' >&4
19887                 set `$run ./try 1`
19888                 db_version_major=$1
19889                 db_version_minor=$2
19890                 db_version_patch=$3
19891         else
19892                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19893                 i_db=$undef
19894                 case " $libs " in
19895                 *"-ldb "*)
19896                         : Remove db from list of libraries to use
19897                         echo "Removing unusable -ldb from library list" >&4
19898                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19899                         shift
19900                         libs="$*"
19901                         echo "libs = $libs" >&4
19902                         ;;
19903                 esac
19904         fi
19905         $rm_try
19906         ;;
19907 esac
19908
19909 case "$i_db" in
19910 define)
19911         : Check the return type needed for hash
19912         echo " "
19913         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19914         $cat >try.c <<EOCP
19915 #$d_const HASCONST
19916 #ifndef HASCONST
19917 #define const
19918 #endif
19919 #include <sys/types.h>
19920 #include <db.h>
19921
19922 #ifndef DB_VERSION_MAJOR
19923 u_int32_t hash_cb (const void* ptr, size_t size)
19924 {
19925 }
19926 HASHINFO info;
19927 int main()
19928 {
19929         info.hash = hash_cb;
19930 }
19931 #endif
19932 EOCP
19933         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19934                 if $contains warning try.out >>/dev/null 2>&1 ; then
19935                         db_hashtype='int'
19936                 else
19937                         db_hashtype='u_int32_t'
19938                 fi
19939         else
19940                 : XXX Maybe we should just give up here.
19941                 db_hashtype=u_int32_t
19942                 $cat try.out >&4
19943                 echo "Help:  I can't seem to compile the db test program." >&4
19944                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19945         fi
19946         $rm_try
19947         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19948         ;;
19949 *)      db_hashtype=u_int32_t
19950         ;;
19951 esac
19952 case "$i_db" in
19953 define)
19954         : Check the return type needed for prefix
19955         echo " "
19956         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19957         cat >try.c <<EOCP
19958 #$d_const HASCONST
19959 #ifndef HASCONST
19960 #define const
19961 #endif
19962 #include <sys/types.h>
19963 #include <db.h>
19964
19965 #ifndef DB_VERSION_MAJOR
19966 size_t prefix_cb (const DBT *key1, const DBT *key2)
19967 {
19968 }
19969 BTREEINFO info;
19970 int main()
19971 {
19972         info.prefix = prefix_cb;
19973 }
19974 #endif
19975 EOCP
19976         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19977                 if $contains warning try.out >>/dev/null 2>&1 ; then
19978                         db_prefixtype='int'
19979                 else
19980                         db_prefixtype='size_t'
19981                 fi
19982         else
19983                 db_prefixtype='size_t'
19984                 : XXX Maybe we should just give up here.
19985                 $cat try.out >&4
19986                 echo "Help:  I can't seem to compile the db test program." >&4
19987                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19988         fi
19989         $rm_try
19990         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19991         ;;
19992 *)      db_prefixtype='size_t'
19993         ;;
19994 esac
19995
19996 : Include . in @INC
19997 $cat <<EOM
19998
19999 Historically Perl has provided a final fallback of the current working
20000 directory '.' when searching for a library. This, however, can lead to
20001 problems when a Perl program which loads optional modules is called from
20002 a shared directory. This can lead to executing unexpected code.
20003
20004 EOM
20005
20006 # When changing to exclude by default:
20007 case "$default_inc_excludes_dot" in
20008     $undef|false|[nN]*) dflt="n" ;;
20009     *)                  dflt="y" ;;
20010 esac
20011 # To turn exclude off by default:
20012 #case "$default_inc_excludes_dot" in
20013 #    $define|true|[yY]*) dflt="y" ;;
20014 #    *)                  dflt="n" ;;
20015 #esac
20016
20017 rp='Exclude '.' from @INC by default? '
20018 . ./myread
20019 case "$ans" in
20020     [nN]|undef) default_inc_excludes_dot="$undef"  ;;
20021     *)          default_inc_excludes_dot="$define" ;;
20022 esac
20023
20024 : Check what kind of inf/nan your system has
20025 $echo "Checking the kind of infinities and nans you have..." >&4
20026 $echo "(The following tests may crash.  That's okay.)" >&4
20027 $cat >try.c <<EOP
20028 #define DOUBLESIZE $doublesize
20029 #$d_longdbl HAS_LONG_DOUBLE
20030 #ifdef HAS_LONG_DOUBLE
20031 #define LONG_DOUBLESIZE $longdblsize
20032 #define LONG_DOUBLEKIND $longdblkind
20033 #endif
20034 #include <math.h>
20035 #include <string.h>
20036 #include <stdio.h>
20037 /* Note that whether the sign bit is on or off
20038  * for NaN depends on the CPU/FPU, and possibly
20039  * can be affected by the build toolchain.
20040  *
20041  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20042  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20043  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20044  * (respectively) as opposed to the more usual
20045  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20046  *
20047  * Pre-IEEE-754 floating point format do not even have inf/nan support
20048  * at all.  They might have a "max" value (DBL_MAX), which may be deadly
20049  * to even mention, causing immediate SIGFPE or equivalent: this is
20050  * the case with VAX floating point, for example.
20051  */
20052 static void bytes(void *v, unsigned int n) {
20053   unsigned char *p = (unsigned char *)v;
20054   int i;
20055   for (i = 0; i < n; i++) {
20056     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20057   }
20058 }
20059 int main(int argc, char *argv[]) {
20060    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20061     * because some compilers are 'smart' and not only warn but refuse to
20062     * compile such 'illegal' values. */
20063    double dinf = exp(1e9);
20064    double dnan = sqrt(-1.0);
20065 #ifdef HAS_LONG_DOUBLE
20066    long double ldinf = (long double)exp(1e9);
20067    long double ldnan = (long double)sqrt(-1.0);
20068 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20069 /* the 80-bit long doubles might have garbage in their excess bytes */
20070     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20071     memset((char *)&ldnan + 10, '\0', LONG_DOUBLESIZE - 10);
20072 # endif
20073   if (argc == 2) {
20074     switch (argv[1][0]) {
20075     case '1': bytes(&dinf, sizeof(dinf)); break;
20076     case '2': bytes(&dnan, sizeof(dnan)); break;
20077     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20078     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20079 #endif
20080     }
20081   }
20082   return 0;
20083 }
20084 EOP
20085 set try
20086 if eval $compile; then
20087     doubleinfbytes=`$run ./try 1`
20088     doublenanbytes=`$run ./try 2`
20089     case "$d_longdbl" in
20090     $define)
20091       longdblinfbytes=`$run ./try 3`
20092       longdblnanbytes=`$run ./try 4`
20093       ;;
20094     esac
20095 else
20096     # Defaults in case the above test program failed.
20097     case "$doublekind" in
20098     1) # IEEE 754 32-bit LE
20099        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20100        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20101        ;;
20102     2) # IEEE 754 32-bit BE
20103        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20104        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20105        ;;
20106     3) # IEEE 754 64-bit LE
20107        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20108        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20109        ;;
20110     4) # IEEE 754 64-bit BE
20111        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20112        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20113        ;;
20114     5) # IEEE 754 128-bit LE
20115        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20116        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20117        ;;
20118     6) # IEEE 754 128-bit BE
20119        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20120        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20121        ;;
20122     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20123        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20124        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20125        ;;
20126     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20127        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20128        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20129        ;;
20130     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20131        doubleinfbytes=$undef
20132        doublenanbytes=$undef
20133        ;;
20134     *) # No idea.
20135        doubleinfbytes=$undef
20136        doublenanbytes=$undef
20137        ;;
20138     esac
20139     case "$longdblkind" in
20140     1) # IEEE 754 128-bit LE
20141        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20142        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20143        ;;
20144     2) # IEEE 754 128-bit BE
20145        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20146        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20147        ;;
20148     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20149        case "$longdblsize" in
20150        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20151            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20152            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20153            ;;
20154        16) # x86_64
20155            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20156            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20157            ;;
20158        *)  # No idea.
20159            longdblinfbytes=$undef
20160            longdblnanbytes=$undef
20161        ;;
20162        esac
20163        ;;
20164     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20165        case "$longdblsize" in
20166        12) # 32-bit system
20167            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20168            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20169            ;;
20170        16) # 64-bit system
20171            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20172            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20173            ;;
20174        *)  # No idea.
20175            longdblinfbytes=$undef
20176            longdblnanbytes=$undef
20177        ;;
20178        esac
20179        ;;
20180     5) # 128-bit LE-LE "double double"
20181        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20182        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20183        ;;
20184     6) # 128-bit BE-BE "double double"
20185        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20186        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20187        ;;
20188     7) # 128-bit LE-BE "double double"
20189        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20190        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20191        ;;
20192     8) # 128-bit BE-LE "double double"
20193        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20194        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20195        ;;
20196     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20197        longdblinfbytes=$undef
20198        longdblnanbytes=$undef
20199        ;;
20200     *) # No idea.
20201        longdblinfbytes=$undef
20202        longdblnanbytes=$undef
20203        ;;
20204     esac
20205 fi
20206 # In case the program crashed the values are empty, turn them undef.
20207 case "$doubleinfbytes" in
20208 '') doubleinfbytes=$undef ;;
20209 esac
20210 case "$doublenanbytes" in
20211 '') doublenanbytes=$undef ;;
20212 esac
20213 case "$longdblinfbytes" in
20214 '') longdblinfbytes=$undef ;;
20215 esac
20216 case "$longdblnanbytes" in
20217 '') longdblnanbytes=$undef ;;
20218 esac
20219 $rm_try
20220
20221 : Check the length of the double mantissa
20222 $echo "Checking how many mantissa bits your doubles have..." >&4
20223 $cat >try.c <<EOP
20224 #$i_sunmath I_SUNMATH
20225 #include <float.h>
20226 #ifdef I_SUNMATH
20227 # include <sunmath.h>
20228 #endif
20229 #ifdef DBL_MANT_DIG
20230 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20231 #endif
20232 #include <stdio.h>
20233 int main(int argc, char *argv[]) {
20234 #ifdef BITS
20235   printf("%d\n", BITS);
20236 #endif
20237   return 0;
20238 }
20239 EOP
20240 set try
20241 if eval $compile; then
20242     doublemantbits=`$run ./try`
20243 else
20244     doublemantbits="$undef"
20245 fi
20246 $rm_try
20247
20248 : Check the length of the longdouble mantissa
20249 $echo "Checking how many mantissa bits your long doubles have..." >&4
20250 $cat >try.c <<EOP
20251 #$i_sunmath I_SUNMATH
20252 #include <float.h>
20253 #ifdef I_SUNMATH
20254 # include <sunmath.h>
20255 #endif
20256 #$d_longdbl HAS_LONG_DOUBLE
20257 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20258 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20259 /* This format has no implicit bit.  Beware, however, that for
20260  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20261  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20262  * and the top bit must have been one since 387, zero is plain invalid.
20263  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20264 #  define BITS LDBL_MANT_DIG
20265 # elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
20266 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20267  * reason e.g. Irix thinks 107.  But in any case, we want only
20268  * the number of real bits, the implicit bits are of no interest.  */
20269 #  define BITS 2 * (DBL_MANT_DIG - 1)
20270 # else
20271 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20272 # endif
20273 #endif
20274 #include <stdio.h>
20275 int main(int argc, char *argv[]) {
20276 #ifdef BITS
20277   printf("%d\n", BITS);
20278 #endif
20279   return 0;
20280 }
20281 EOP
20282 set try
20283 if eval $compile; then
20284     longdblmantbits=`$run ./try`
20285 else
20286     longdblmantbits="$undef"
20287 fi
20288 $rm_try
20289
20290 : Check the length of the NV mantissa
20291 $echo "Checking how many mantissa bits your NVs have..." >&4
20292 if test "X$usequadmath" = "X$define"; then
20293   nvmantbits=112 # 128-1-15
20294 else
20295   if test "X$nvsize" = "X$doublesize"; then
20296     nvmantbits="$doublemantbits"
20297   else
20298      if test "X$nvsize" = "X$longdblsize"; then
20299        nvmantbits="$longdblmantbits"
20300      else
20301        nvmantbits="$undef"
20302      fi
20303   fi
20304 fi
20305
20306 : How can we generate normalized random numbers ?
20307 echo " "
20308 echo "Using our internal random number implementation..." >&4
20309
20310 case "$ccflags" in
20311 *-Dmy_rand=*|*-Dmy_srand=*)
20312         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20313         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20314         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20315         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20316         ;;
20317 esac
20318
20319 randfunc=Perl_drand48
20320 drand01="Perl_drand48()"
20321 seedfunc="Perl_drand48_init"
20322 randbits=48
20323 randseedtype=U32
20324
20325 : Probe whether dtrace builds an object, as newer Illumos requires an input
20326 : object file that uses at least one of the probes defined in the .d file
20327 case "$usedtrace" in
20328 $define)
20329     case "$dtracexnolibs" in
20330     $define|true|[yY]*)
20331         dtracexnolibs=$define
20332         $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h
20333         ;;
20334     ' '|'')
20335         if $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20336              dtracexnolibs=$define
20337              echo "Your dtrace accepts -xnolibs"
20338         elif $dtrace -h -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20339              dtracexnolibs=$undef
20340              echo "Your dtrace doesn't accept -xnolibs"
20341         else
20342              echo "Your dtrace doesn't work at all, try building without dtrace support" >&4
20343              exit 1
20344         fi
20345         ;;
20346     *)
20347         dtracexnolibs=$undef
20348         $dtrace -h -s ../perldtrace.d -o perldtrace.h
20349         ;;
20350     esac
20351     case $dtracexnolibs in
20352     $define) xnolibs=-xnolibs ;;
20353     *) xnolibs= ;;
20354     esac
20355
20356     case "$dtraceobject" in
20357     $define|true|[yY]*)
20358         dtraceobject=$define
20359         ;;
20360     ' '|'')
20361         $cat >try.c <<EOM
20362 #include "perldtrace.h"
20363 int main(void) {
20364     PERL_LOADED_FILE("dummy");
20365     return 0;
20366 }
20367 EOM
20368         dtraceobject=$undef
20369         if $cc -c -o try.o $optimize $ccflags try.c \
20370                     && $dtrace -G $xnolibs -s ../perldtrace.d try.o >/dev/null 2>&1; then
20371                 dtraceobject=$define
20372             echo "Your dtrace builds an object file"
20373         fi
20374         ;;
20375     *) dtraceobject=$undef ;;
20376     esac
20377     $rm_try perldtrace.o perldtrace.h
20378 esac
20379
20380 : Determine if this is an EBCDIC system
20381 echo " "
20382 echo "Determining whether or not we are on an EBCDIC system..." >&4
20383 $cat >try.c <<'EOM'
20384 int main()
20385 {
20386   if ('M'==0xd4) return 0;
20387   return 1;
20388 }
20389 EOM
20390
20391 val=$undef
20392 set try
20393 if eval $compile_ok; then
20394         if $run ./try; then
20395                 echo "You seem to speak EBCDIC." >&4
20396                 val="$define"
20397         else
20398                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20399         fi
20400 else
20401         echo "I'm unable to compile the test program." >&4
20402         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20403 fi
20404 $rm_try
20405 set ebcdic
20406 eval $setvar
20407
20408 : Check how to flush
20409 echo " "
20410 $cat >&4 <<EOM
20411 Checking how to flush all pending stdio output...
20412 EOM
20413 # I only know how to find the first 32 possibly open files on SunOS.
20414 # See also hints/sunos_4_1.sh and util.c  --AD
20415 case "$osname" in
20416 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20417 esac
20418 $cat >>try.c <<EOCP
20419 #include <stdio.h>
20420 #$i_stdlib I_STDLIB
20421 #ifdef I_STDLIB
20422 #include <stdlib.h>
20423 #endif
20424 #$i_unistd I_UNISTD
20425 #ifdef I_UNISTD
20426 # include <unistd.h>
20427 #endif
20428 #$d_sysconf HAS_SYSCONF
20429 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20430 #ifdef HAS_STDIO_STREAM_ARRAY
20431 # define STDIO_STREAM_ARRAY $stdio_stream_array
20432 #endif
20433 int main() {
20434   FILE* p;
20435   unlink("try.out");
20436   p = fopen("try.out", "w");
20437 #ifdef TRY_FPUTC
20438   fputc('x', p);
20439 #else
20440 # ifdef TRY_FPRINTF
20441   fprintf(p, "x");
20442 # endif
20443 #endif
20444 #ifdef TRY_FFLUSH_NULL
20445   fflush(NULL);
20446 #endif
20447 #ifdef TRY_FFLUSH_ALL
20448   {
20449     long open_max = -1;
20450 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20451     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20452 # else
20453 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20454     open_max = sysconf(_SC_OPEN_MAX);
20455 #  else
20456 #   ifdef FOPEN_MAX
20457     open_max = FOPEN_MAX;
20458 #   else
20459 #    ifdef OPEN_MAX
20460     open_max = OPEN_MAX;
20461 #    else
20462 #     ifdef _NFILE
20463     open_max = _NFILE;
20464 #     endif
20465 #    endif
20466 #   endif
20467 #  endif
20468 # endif
20469 # ifdef HAS_STDIO_STREAM_ARRAY
20470     if (open_max > 0) {
20471       long i;
20472       for (i = 0; i < open_max; i++)
20473             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20474                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20475                 STDIO_STREAM_ARRAY[i]._flag)
20476                 fflush(&STDIO_STREAM_ARRAY[i]);
20477     }
20478   }
20479 # endif
20480 #endif
20481   _exit(42);
20482 }
20483 EOCP
20484 : first we have to find out how _not_ to flush
20485 $to try.c
20486 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20487     output=''
20488     set try -DTRY_FPUTC
20489     if eval $compile; then
20490             $run ./try 2>/dev/null
20491             code="$?"
20492             $from try.out
20493             if $test ! -s try.out -a "X$code" = X42; then
20494                 output=-DTRY_FPUTC
20495             fi
20496     fi
20497     case "$output" in
20498     '')
20499             set try -DTRY_FPRINTF
20500             if eval $compile; then
20501                     $run ./try 2>/dev/null
20502                     code="$?"
20503                     $from try.out
20504                     if $test ! -s try.out -a "X$code" = X42; then
20505                         output=-DTRY_FPRINTF
20506                     fi
20507             fi
20508         ;;
20509     esac
20510 fi
20511 : check for fflush NULL behavior
20512 case "$fflushNULL" in
20513 '')     set try -DTRY_FFLUSH_NULL $output
20514         if eval $compile; then
20515                 $run ./try 2>/dev/null
20516                 code="$?"
20517                 $from try.out
20518                 if $test -s try.out -a "X$code" = X42; then
20519                         fflushNULL="`$cat try.out`"
20520                 else
20521                         if $test "X$code" != X42; then
20522                                 $cat >&4 <<EOM
20523 (If this test failed, don't worry, we'll try another method shortly.)
20524 EOM
20525                         fi
20526                 fi
20527         fi
20528         $rm -f core try.core core.try.*
20529         case "$fflushNULL" in
20530         x)      $cat >&4 <<EOM
20531 Your fflush(NULL) works okay for output streams.
20532 Let's see if it clobbers input pipes...
20533 EOM
20534 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20535 # bug that improperly flushes the input end of pipes.  So we avoid the
20536 # autoflush on fork/system/exec support for now. :-(
20537 $cat >tryp.c <<EOCP
20538 #include <stdio.h>
20539 int
20540 main(int argc, char **argv)
20541 {
20542     char buf[1024];
20543     int i;
20544     char *bp = buf;
20545     while (1) {
20546         while ((i = getc(stdin)) != -1
20547                && (*bp++ = i) != '\n'
20548                && bp < &buf[1024])
20549         /* DO NOTHING */ ;
20550         *bp = '\0';
20551         fprintf(stdout, "%s", buf);
20552         fflush(NULL);
20553         if (i == -1)
20554             return 0;
20555         bp = buf;
20556     }
20557 }
20558 EOCP
20559                 fflushNULL="$define"
20560                 set tryp
20561                 if eval $compile; then
20562                     $rm -f tryp.out
20563                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20564                     if $test "X$targethost" != X; then
20565                         $to tryp.c
20566                         $to tryp
20567                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20568                     else
20569                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20570                     fi
20571                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20572                        $cat >&4 <<EOM
20573 fflush(NULL) seems to behave okay with input streams.
20574 EOM
20575                         fflushNULL="$define"
20576                     else
20577                         $cat >&4 <<EOM
20578 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20579 EOM
20580                         fflushNULL="$undef"
20581                     fi
20582                 fi
20583                 $rm -f core tryp.c tryp.core core.tryp.*
20584                 ;;
20585         '')     $cat >&4 <<EOM
20586 Your fflush(NULL) isn't working (contrary to ANSI C).
20587 EOM
20588                 fflushNULL="$undef"
20589                 ;;
20590         *)      $cat >&4 <<EOM
20591 Cannot figure out whether your fflush(NULL) works or not.
20592 I'm assuming it doesn't (contrary to ANSI C).
20593 EOM
20594                 fflushNULL="$undef"
20595                 ;;
20596         esac
20597         ;;
20598 $define|true|[yY]*)
20599         fflushNULL="$define"
20600         ;;
20601 *)
20602         fflushNULL="$undef"
20603         ;;
20604 esac
20605 : check explicit looping only if NULL did not work, and if the pipe
20606 : bug does not show up on an explicit flush too
20607 case "$fflushNULL" in
20608 "$undef")
20609         $cat >tryp.c <<EOCP
20610 #include <stdio.h>
20611 int
20612 main(int argc, char **argv)
20613 {
20614     char buf[1024];
20615     int i;
20616     char *bp = buf;
20617     while (1) {
20618         while ((i = getc(stdin)) != -1
20619                && (*bp++ = i) != '\n'
20620                && bp < &buf[1024])
20621         /* DO NOTHING */ ;
20622         *bp = '\0';
20623         fprintf(stdout, "%s", buf);
20624         fflush(stdin);
20625         if (i == -1)
20626             return 0;
20627         bp = buf;
20628     }
20629 }
20630 EOCP
20631         set tryp
20632         if eval $compile; then
20633             $rm -f tryp.out
20634             if $test "X$targethost" != X; then
20635                 $to tryp.c
20636                 $to tryp
20637                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20638             else
20639                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20640             fi
20641             if cmp tryp.c tryp.out >/dev/null 2>&1; then
20642                $cat >&4 <<EOM
20643 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20644 EOM
20645                 : now check for fflushall behaviour
20646                 case "$fflushall" in
20647                 '')     set try -DTRY_FFLUSH_ALL $output
20648                         if eval $compile; then
20649                                 $cat >&4 <<EOM
20650 (Now testing the other method--but note that this also may fail.)
20651 EOM
20652                                 $run ./try 2>/dev/null
20653                                 code=$?
20654                                 $from try.out
20655                                 if $test -s try.out -a "X$code" = X42; then
20656                                         fflushall="`$cat try.out`"
20657                                 fi
20658                         fi
20659                         $rm_try
20660                         case "$fflushall" in
20661                         x)      $cat >&4 <<EOM
20662 Whew. Flushing explicitly all the stdio streams works.
20663 EOM
20664                                 fflushall="$define"
20665                                 ;;
20666                         '')     $cat >&4 <<EOM
20667 Sigh. Flushing explicitly all the stdio streams doesn't work.
20668 EOM
20669                                 fflushall="$undef"
20670                                 ;;
20671                         *)      $cat >&4 <<EOM
20672 Cannot figure out whether flushing stdio streams explicitly works or not.
20673 I'm assuming it doesn't.
20674 EOM
20675                                 fflushall="$undef"
20676                                 ;;
20677                         esac
20678                         ;;
20679                 "$define"|true|[yY]*)
20680                         fflushall="$define"
20681                         ;;
20682                 *)
20683                         fflushall="$undef"
20684                         ;;
20685                 esac
20686             else
20687                 $cat >&4 <<EOM
20688 All is futile.  Even fflush(stdin) clobbers input pipes!
20689 EOM
20690                 fflushall="$undef"
20691             fi
20692         else
20693             fflushall="$undef"
20694         fi
20695         $rm -f core tryp.c tryp.core core.tryp.*
20696         ;;
20697 *)      fflushall="$undef"
20698         ;;
20699 esac
20700
20701 case "$fflushNULL$fflushall" in
20702 undefundef)
20703         $cat <<EOM
20704 OK, I give up.  I cannot figure out how to flush pending stdio output.
20705 We won't be flushing handles at all before fork/exec/popen.
20706 EOM
20707         ;;
20708 esac
20709 $rm_try tryp
20710
20711 : Store the full pathname to the ar program for use in the C program
20712 : Respect a hint or command line value for full_ar.
20713 case "$full_ar" in
20714 '') full_ar=$ar ;;
20715 esac
20716
20717 : Store the full pathname to the sed program for use in the C program
20718 full_sed=$sed
20719
20720 : see what type gids are declared as in the kernel
20721 echo " "
20722 echo "Looking for the type for group ids returned by getgid()."
20723 set gid_t gidtype xxx stdio.h sys/types.h
20724 eval $typedef
20725 case "$gidtype" in
20726 xxx)
20727         xxx=`./findhdr sys/user.h`
20728         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
20729         case $1 in
20730         unsigned) dflt="$1 $2" ;;
20731         *) dflt="$1" ;;
20732         esac
20733         ;;
20734 *) dflt="$gidtype";;
20735 esac
20736 case "$gidtype" in
20737 gid_t) echo "gid_t found." ;;
20738 *)      rp="What is the type for group ids returned by getgid()?"
20739         . ./myread
20740         gidtype="$ans"
20741         ;;
20742 esac
20743
20744 : Check the size of GID
20745 echo " "
20746 case "$gidtype" in
20747 *_t) zzz="$gidtype"     ;;
20748 *)   zzz="gid"          ;;
20749 esac
20750 echo "Checking the size of $zzz..." >&4
20751 cat > try.c <<EOCP
20752 #include <sys/types.h>
20753 #include <stdio.h>
20754 #$i_stdlib I_STDLIB
20755 #ifdef I_STDLIB
20756 #include <stdlib.h>
20757 #endif
20758 int main() {
20759     printf("%d\n", (int)sizeof($gidtype));
20760     exit(0);
20761 }
20762 EOCP
20763 set try
20764 if eval $compile_ok; then
20765         yyy=`$run ./try`
20766         case "$yyy" in
20767         '')     gidsize=4
20768                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
20769                 ;;
20770         *)      gidsize=$yyy
20771                 echo "Your $zzz is $gidsize bytes long."
20772                 ;;
20773         esac
20774 else
20775         gidsize=4
20776         echo "(I can't compile the test program--guessing $gidsize.)" >&4
20777 fi
20778
20779
20780 : Check if GID is signed
20781 echo " "
20782 case "$gidtype" in
20783 *_t) zzz="$gidtype"     ;;
20784 *)   zzz="gid"          ;;
20785 esac
20786 echo "Checking the sign of $zzz..." >&4
20787 cat > try.c <<EOCP
20788 #include <sys/types.h>
20789 #include <stdio.h>
20790 int main() {
20791         $gidtype foo = -1;
20792         if (foo < 0)
20793                 printf("-1\n");
20794         else
20795                 printf("1\n");
20796 }
20797 EOCP
20798 set try
20799 if eval $compile; then
20800         yyy=`$run ./try`
20801         case "$yyy" in
20802         '')     gidsign=1
20803                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20804                 ;;
20805         *)      gidsign=$yyy
20806                 case "$gidsign" in
20807                  1) echo "Your $zzz is unsigned." ;;
20808                 -1) echo "Your $zzz is signed."   ;;
20809                 esac
20810                 ;;
20811         esac
20812 else
20813         gidsign=1
20814         echo "(I can't compile the test program--guessing unsigned.)" >&4
20815 fi
20816
20817
20818 : Check 64bit sizes
20819 echo " "
20820
20821 if $test X"$quadtype" != X; then
20822
20823 echo "Checking how to print 64-bit integers..." >&4
20824
20825 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
20826         $cat >try.c <<'EOCP'
20827 #include <sys/types.h>
20828 #include <stdio.h>
20829 int main() {
20830   int q = 12345678901;
20831   printf("%ld\n", q);
20832 }
20833 EOCP
20834         set try
20835         if eval $compile; then
20836                 yyy=`$run ./try`
20837                 case "$yyy" in
20838                 12345678901)
20839                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
20840                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
20841                         echo "We will use %d."
20842                         ;;
20843                 esac
20844         fi
20845 fi
20846
20847 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
20848         $cat >try.c <<'EOCP'
20849 #include <sys/types.h>
20850 #include <stdio.h>
20851 int main() {
20852   long q = 12345678901;
20853   printf("%ld\n", q);
20854 }
20855 EOCP
20856         set try
20857         if eval $compile; then
20858                 yyy=`$run ./try`
20859                 case "$yyy" in
20860                 12345678901)
20861                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
20862                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
20863                         echo "We will use %ld."
20864                         ;;
20865                 esac
20866         fi
20867 fi
20868
20869 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
20870         $cat >try.c <<'EOCP'
20871 #include <sys/types.h>
20872 #include <inttypes.h>
20873 #include <stdio.h>
20874 int main() {
20875   int64_t q = 12345678901;
20876   printf("%" PRId64 "\n", q);
20877 }
20878 EOCP
20879         set try
20880         if eval $compile; then
20881                 yyy=`$run ./try`
20882                 case "$yyy" in
20883                 12345678901)
20884                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
20885                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
20886                         echo "We will use the C9X style."
20887                         ;;
20888                 esac
20889         fi
20890 fi
20891
20892 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20893         $cat >try.c <<EOCP
20894 #include <sys/types.h>
20895 #include <stdio.h>
20896 int main() {
20897   $quadtype q = 12345678901;
20898   printf("%Ld\n", q);
20899 }
20900 EOCP
20901         set try
20902         if eval $compile; then
20903                 yyy=`$run ./try`
20904                 case "$yyy" in
20905                 12345678901)
20906                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
20907                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20908                         echo "We will use %Ld."
20909                         ;;
20910                 esac
20911         fi
20912 fi
20913
20914 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20915         $cat >try.c <<'EOCP'
20916 #include <sys/types.h>
20917 #include <stdio.h>
20918 int main() {
20919   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20920   printf("%lld\n", q);
20921 }
20922 EOCP
20923         set try
20924         if eval $compile; then
20925                 yyy=`$run ./try`
20926                 case "$yyy" in
20927                 12345678901)
20928                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20929                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20930                         echo "We will use the %lld style."
20931                         ;;
20932                 esac
20933         fi
20934 fi
20935
20936 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20937         $cat >try.c <<EOCP
20938 #include <sys/types.h>
20939 #include <stdio.h>
20940 int main() {
20941   $quadtype q = 12345678901;
20942   printf("%qd\n", q);
20943 }
20944 EOCP
20945         set try
20946         if eval $compile; then
20947                 yyy=`$run ./try`
20948                 case "$yyy" in
20949                 12345678901)
20950                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20951                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20952                         echo "We will use %qd."
20953                         ;;
20954                 esac
20955         fi
20956 fi
20957
20958 if $test X"$sPRId64" = X; then
20959         echo "Cannot figure out how to print 64-bit integers." >&4
20960 fi
20961 $rm_try
20962
20963 fi
20964
20965 case "$sPRId64" in
20966 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20967         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20968         ;;
20969 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20970         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20971         ;;
20972 esac
20973
20974 : Check format strings for internal types
20975 echo " "
20976 $echo "Checking the format strings to be used for Perl's internal types..." >&4
20977
20978 if $test X"$ivsize" = X8; then
20979         ivdformat="$sPRId64"
20980         uvuformat="$sPRIu64"
20981         uvoformat="$sPRIo64"
20982         uvxformat="$sPRIx64"
20983         uvXUformat="$sPRIXU64"
20984 else
20985         if $test X"$ivsize" = X"$longsize"; then
20986                 ivdformat='"ld"'
20987                 uvuformat='"lu"'
20988                 uvoformat='"lo"'
20989                 uvxformat='"lx"'
20990                 uvXUformat='"lX"'
20991         else
20992                 if $test X"$ivsize" = X"$intsize"; then
20993                         ivdformat='"d"'
20994                         uvuformat='"u"'
20995                         uvoformat='"o"'
20996                         uvxformat='"x"'
20997                         uvXUformat='"X"'
20998                 else
20999                         : far out
21000                         if $test X"$ivsize" = X"$shortsize"; then
21001                                 ivdformat='"hd"'
21002                                 uvuformat='"hu"'
21003                                 uvoformat='"ho"'
21004                                 uvxformat='"hx"'
21005                                 uvXUformat='"hX"'
21006                         fi
21007                 fi
21008         fi
21009 fi
21010
21011 if $test X"$usequadmath" = X"$define"; then
21012     nveformat='"Qe"'
21013     nvfformat='"Qf"'
21014     nvgformat='"Qg"'
21015     nvEUformat='"QE"'
21016     nvFUformat='"QF"'
21017     nvGUformat='"QG"'
21018 else
21019     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21020         nveformat="$sPRIeldbl"
21021         nvfformat="$sPRIfldbl"
21022         nvgformat="$sPRIgldbl"
21023         nvEUformat="$sPRIEUldbl"
21024         nvFUformat="$sPRIFUldbl"
21025         nvGUformat="$sPRIGUldbl"
21026     else
21027         nveformat='"e"'
21028         nvfformat='"f"'
21029         nvgformat='"g"'
21030         nvEUformat='"E"'
21031         nvFUformat='"F"'
21032         nvGUformat='"G"'
21033     fi
21034 fi
21035
21036 case "$ivdformat" in
21037 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21038     exit 1
21039     ;;
21040 esac
21041
21042 : Check format string for GID
21043
21044 echo " "
21045 $echo "Checking the format string to be used for gids..." >&4
21046
21047 case "$gidsign" in
21048 -1)     if $test X"$gidsize" = X"$ivsize"; then
21049                 gidformat="$ivdformat"
21050         else
21051                 if $test X"$gidsize" = X"$longsize"; then
21052                         gidformat='"ld"'
21053                 else
21054                         if $test X"$gidsize" = X"$intsize"; then
21055                                 gidformat='"d"'
21056                         else
21057                                 if $test X"$gidsize" = X"$shortsize"; then
21058                                         gidformat='"hd"'
21059                                 fi
21060                         fi
21061                 fi
21062         fi
21063         ;;
21064 *)      if $test X"$gidsize" = X"$uvsize"; then
21065                 gidformat="$uvuformat"
21066         else
21067                 if $test X"$gidsize" = X"$longsize"; then
21068                         gidformat='"lu"'
21069                 else
21070                         if $test X"$gidsize" = X"$intsize"; then
21071                                 gidformat='"u"'
21072                         else
21073                                 if $test X"$gidsize" = X"$shortsize"; then
21074                                         gidformat='"hu"'
21075                                 fi
21076                         fi
21077                 fi
21078         fi
21079         ;;
21080 esac
21081
21082 : see if getgroups exists
21083 set getgroups d_getgrps
21084 eval $inlibc
21085
21086 : see if setgroups exists
21087 set setgroups d_setgrps
21088 eval $inlibc
21089
21090 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21091 echo " "
21092 case "$d_getgrps$d_setgrps" in
21093 *define*)
21094         case "$groupstype" in
21095         '') dflt="$gidtype" ;;
21096         *)  dflt="$groupstype" ;;
21097         esac
21098         $cat <<EOM
21099 What type of pointer is the second argument to getgroups() and setgroups()?
21100 Usually this is the same as group ids, $gidtype, but not always.
21101
21102 EOM
21103         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21104         . ./myread
21105         groupstype="$ans"
21106         ;;
21107 *)  groupstype="$gidtype";;
21108 esac
21109
21110 : check whether make sets MAKE
21111 echo " "
21112 echo "Checking if your $make program sets \$(MAKE)..." >&4
21113 case "$make_set_make" in
21114 '')
21115         $sed 's/^X //' > testmake.mak << 'EOF'
21116 Xall:
21117 X       @echo 'maketemp="$(MAKE)"'
21118 EOF
21119         case "`$make -f testmake.mak 2>/dev/null`" in
21120         *maketemp=*) make_set_make='#' ;;
21121         *)      make_set_make="MAKE=$make" ;;
21122         esac
21123         $rm -f testmake.mak
21124         ;;
21125 esac
21126 case "$make_set_make" in
21127 '#') echo "Yup, it does.";;
21128 *) echo "Nope, it doesn't.";;
21129 esac
21130
21131 : see what type is used for mode_t
21132 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21133 set mode_t modetype int stdio.h sys/types.h
21134 eval $typedef_ask
21135
21136 : see if we need va_copy
21137 echo " "
21138 $cat >try.c <<EOCP
21139 #include <stdarg.h>
21140 #include <stdio.h>
21141 #include <stdlib.h>
21142 #include <signal.h>
21143
21144 int
21145 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21146 {
21147   return vfprintf(f, fmt, *valp);
21148 }
21149
21150 int
21151 myvfprintf(FILE *f, const  char *fmt, va_list val)
21152 {
21153   return ivfprintf(f, fmt, &val);
21154 }
21155
21156 int
21157 myprintf(char *fmt, ...)
21158 {
21159   va_list val;
21160   va_start(val, fmt);
21161   return myvfprintf(stdout, fmt, val);
21162 }
21163
21164 int
21165 main(int ac, char **av)
21166 {
21167   signal(SIGSEGV, exit);
21168
21169   myprintf("%s%cs all right, then\n", "that", '\'');
21170   exit(0);
21171 }
21172 EOCP
21173 set try
21174 if eval $compile && $run ./try 2>&1 >/dev/null; then
21175         case "`$run ./try`" in
21176         "that's all right, then")
21177                 okay=yes
21178                 ;;
21179         esac
21180 fi
21181 case "$okay" in
21182 yes)    echo "It seems that you don't need va_copy()." >&4
21183         need_va_copy="$undef"
21184         ;;
21185 *)      echo "It seems that va_copy() or similar will be needed." >&4
21186         need_va_copy="$define"
21187         ;;
21188 esac
21189 $rm_try
21190
21191 : see what type is used for size_t
21192 rp="What is the type used for the length parameter for string functions?"
21193 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21194 eval $typedef_ask
21195
21196 : check for type of arguments to gethostbyaddr.
21197 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21198         case "$d_gethbyaddr" in
21199         $define)
21200                 $cat <<EOM
21201
21202 Checking to see what type of arguments are accepted by gethostbyaddr().
21203 EOM
21204                 hdrs="$define sys/types.h
21205                         $d_socket sys/socket.h
21206                         $i_niin netinet/in.h
21207                         $i_netdb netdb.h
21208                         $i_unistd unistd.h"
21209                 : The first arg can 'char *' or 'void *'
21210                 : The second arg is some of integral type
21211                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21212                         for yyy in size_t long int; do
21213                                 case "$netdb_host_type" in
21214                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21215                                         if ./protochk "$try" $hdrs; then
21216                                                 echo "Your system accepts $xxx for the first arg."
21217                                                 echo "...and $yyy for the second arg."
21218                                                 netdb_host_type="$xxx"
21219                                                 netdb_hlen_type="$yyy"
21220                                         fi
21221                                         ;;
21222                                 esac
21223                         done
21224                 done
21225                 : In case none of those worked, prompt the user.
21226                 case "$netdb_host_type" in
21227                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21228                         dflt='char *'
21229                         . ./myread
21230                         netdb_host_type=$ans
21231                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21232                         dflt="$sizetype"
21233                         . ./myread
21234                         netdb_hlen_type=$ans
21235                         ;;
21236                 esac
21237                 ;;
21238         *)      : no gethostbyaddr, so pick harmless defaults
21239                 netdb_host_type='char *'
21240                 netdb_hlen_type="$sizetype"
21241                 ;;
21242         esac
21243         # Remove the "const" if needed. -- but then we'll have a
21244         # prototype clash!
21245         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21246 fi
21247
21248 : check for type of argument to gethostbyname.
21249 if test "X$netdb_name_type" = X ; then
21250         case "$d_gethbyname" in
21251         $define)
21252                 $cat <<EOM
21253
21254 Checking to see what type of argument is accepted by gethostbyname().
21255 EOM
21256                 hdrs="$define sys/types.h
21257                         $d_socket sys/socket.h
21258                         $i_niin netinet/in.h
21259                         $i_netdb netdb.h
21260                         $i_unistd unistd.h"
21261                 for xxx in "const char *" "char *"; do
21262                         case "$netdb_name_type" in
21263                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21264                                 if ./protochk "$try" $hdrs; then
21265                                         echo "Your system accepts $xxx."
21266                                         netdb_name_type="$xxx"
21267                                 fi
21268                                 ;;
21269                         esac
21270                 done
21271                 : In case none of those worked, prompt the user.
21272                 case "$netdb_name_type" in
21273                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21274                         dflt='char *'
21275                         . ./myread
21276                         netdb_name_type=$ans
21277                         ;;
21278                 esac
21279                 ;;
21280         *)      : no gethostbyname, so pick harmless default
21281                 netdb_name_type='char *'
21282                 ;;
21283         esac
21284 fi
21285
21286 : check for type of 1st argument to getnetbyaddr.
21287 if test "X$netdb_net_type" = X ; then
21288         case "$d_getnbyaddr" in
21289         $define)
21290                 $cat <<EOM
21291
21292 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21293 EOM
21294                 hdrs="$define sys/types.h
21295                         $d_socket sys/socket.h
21296                         $i_niin netinet/in.h
21297                         $i_netdb netdb.h
21298                         $i_unistd unistd.h"
21299                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21300                         case "$netdb_net_type" in
21301                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21302                                 if ./protochk "$try" $hdrs; then
21303                                         echo "Your system accepts $xxx."
21304                                         netdb_net_type="$xxx"
21305                                 fi
21306                                 ;;
21307                         esac
21308                 done
21309                 : In case none of those worked, prompt the user.
21310                 case "$netdb_net_type" in
21311                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21312                         dflt='long'
21313                         . ./myread
21314                         netdb_net_type=$ans
21315                         ;;
21316                 esac
21317                 ;;
21318         *)      : no getnetbyaddr, so pick harmless default
21319                 netdb_net_type='long'
21320                 ;;
21321         esac
21322 fi
21323 : locate the preferred pager for this system
21324 fn=f/
21325 case "$pager" in
21326 '')
21327         dflt=''
21328         case "$pg" in
21329         /*) dflt=$pg;;
21330         [a-zA-Z]:/*) dflt=$pg;;
21331         esac
21332         case "$more" in
21333         /*) dflt=$more;;
21334         [a-zA-Z]:/*) dflt=$more;;
21335         esac
21336         case "$less" in
21337         /*) dflt=$less;;
21338         [a-zA-Z]:/*) dflt=$less;;
21339         esac
21340         case "$dflt" in
21341         '') dflt=/usr/ucb/more;;
21342         esac
21343         ;;
21344 *)      dflt="$pager"
21345         ;;
21346 esac
21347 fn="f/($dflt)"
21348 echo " "
21349 rp='What pager is used on your system?'
21350 . ./getfile
21351 pager="$ans"
21352
21353 : see if ar generates random libraries by itself
21354 echo " "
21355 echo "Checking how to generate random libraries on your machine..." >&4
21356 echo 'int bar1() { return bar2(); }' > bar1.c
21357 echo 'int bar2() { return 2; }' > bar2.c
21358 $cat > foo.c <<EOP
21359 #$i_stdlib I_STDLIB
21360 #ifdef I_STDLIB
21361 #include <stdlib.h>
21362 #endif
21363 int main() { printf("%d\n", bar1()); exit(0); }
21364 EOP
21365 $cc $ccflags -c bar1.c >/dev/null 2>&1
21366 $cc $ccflags -c bar2.c >/dev/null 2>&1
21367 $cc $ccflags -c foo.c >/dev/null 2>&1
21368 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21369 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21370         $run ./foobar >/dev/null 2>&1; then
21371         echo "$ar appears to generate random libraries itself."
21372         orderlib=false
21373         if [ "X$ranlib" = "X" ]; then
21374             ranlib=":"
21375         fi
21376 elif $ar s bar$_a >/dev/null 2>&1 &&
21377         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21378         $run ./foobar >/dev/null 2>&1; then
21379                 echo "a table of contents needs to be added with '$ar s'."
21380                 orderlib=false
21381                 ranlib="$ar s"
21382 elif $ar ts bar$_a >/dev/null 2>&1 &&
21383         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21384         $run ./foobar >/dev/null 2>&1; then
21385                 echo "a table of contents needs to be added with '$ar ts'."
21386                 orderlib=false
21387                 ranlib="$ar ts"
21388 else
21389         case "$ranlib" in
21390         :) ranlib='';;
21391         '')
21392                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21393                 $test -f $ranlib || ranlib=''
21394                 ;;
21395         esac
21396         if $test -n "$ranlib"; then
21397                 echo "your system has '$ranlib'; we'll use that."
21398                 orderlib=false
21399         else
21400                 echo "your system doesn't seem to support random libraries"
21401                 echo "so we'll use lorder and tsort to order the libraries."
21402                 orderlib=true
21403                 ranlib=":"
21404         fi
21405 fi
21406 $rm -f foo* bar*
21407
21408 : Check the max offset that gmtime and localtime accept
21409 echo "Checking max offsets that gmtime () accepts"
21410
21411 case "$sGMTIME_min/$sGMTIME_max" in
21412     0/0|/)
21413         $cat >try.c <<EOCP
21414 #include <sys/types.h>
21415 #include <stdio.h>
21416 #include <time.h>
21417
21418 int i;
21419 struct tm *tmp;
21420 time_t pt;
21421
21422 void gm_check (time_t t, int min_year, int max_year)
21423 {
21424     tmp = gmtime (&t);
21425     if ( tmp == NULL ||
21426         /* Check tm_year overflow */
21427          tmp->tm_year < min_year || tmp->tm_year > max_year)
21428         tmp = NULL;
21429     else
21430         pt = t;
21431     } /* gm_check */
21432
21433 int check_max ()
21434 {
21435     tmp = NULL;
21436     pt  = 0;
21437 #ifdef MAXLONG
21438     gm_check (MAXLONG, 69, 0x7fffffff);
21439 #endif
21440     if (tmp == NULL || tmp->tm_year < 0) {
21441         for (i = 63; i >= 0; i--) {
21442             time_t x = pt | ((time_t)1 << i);
21443             if (x < 0 || x < pt) continue;
21444             gm_check (x, 69, 0x7fffffff);
21445             }
21446         }
21447     printf ("sGMTIME_max=%ld\n", pt);
21448     return (0);
21449     } /* check_max */
21450
21451 int check_min ()
21452 {
21453     tmp = NULL;
21454     pt  = 0;
21455 #ifdef MINLONG
21456     gm_check (MINLONG, -1900, 70);
21457 #endif
21458     if (tmp == NULL) {
21459         for (i = 36; i >= 0; i--) {
21460             time_t x = pt - ((time_t)1 << i);
21461             if (x > 0) continue;
21462             gm_check (x, -1900, 70);
21463             }
21464         }
21465     printf ("sGMTIME_min=%ld\n", pt);
21466     return (0);
21467     } /* check_min */
21468
21469 int main (int argc, char *argv[])
21470 {
21471     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21472     check_max ();
21473     check_min ();
21474     return (0);
21475     } /* main */
21476 EOCP
21477         set try
21478         if eval $compile; then
21479             eval `$run ./try 2>/dev/null`
21480         else
21481             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21482             fi
21483         $rm_try
21484         ;;
21485     esac
21486
21487 echo "Checking max offsets that localtime () accepts"
21488
21489 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21490     0/0|/)
21491         $cat >try.c <<EOCP
21492 #include <sys/types.h>
21493 #include <stdio.h>
21494 #include <time.h>
21495
21496 int i;
21497 struct tm *tmp;
21498 time_t pt;
21499
21500 void local_check (time_t t, int min_year, int max_year)
21501 {
21502     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21503         tmp = NULL;
21504     else
21505         tmp = localtime (&t);
21506     if ( tmp == NULL ||
21507         /* Check tm_year overflow */
21508          tmp->tm_year < min_year || tmp->tm_year > max_year)
21509         tmp = NULL;
21510     else
21511         pt = t;
21512     } /* local_check */
21513
21514 int check_max ()
21515 {
21516     tmp = NULL;
21517     pt  = 0;
21518 #ifdef MAXLONG
21519     local_check (MAXLONG, 69, 0x7fffffff);
21520 #endif
21521     if (tmp == NULL || tmp->tm_year < 0) {
21522         for (i = 63; i >= 0; i--) {
21523             time_t x = pt | ((time_t)1 << i);
21524             if (x < 0 || x < pt) continue;
21525             local_check (x, 69, 0x7fffffff);
21526             }
21527         }
21528     printf ("sLOCALTIME_max=%ld\n", pt);
21529     return (0);
21530    } /* check_max */
21531
21532 int check_min ()
21533 {
21534     tmp = NULL;
21535     pt  = 0;
21536 #ifdef MINLONG
21537     local_check (MINLONG, -1900, 70);
21538 #endif
21539     if (tmp == NULL) {
21540         for (i = 36; i >= 0; i--) {
21541             time_t x = pt - ((time_t)1 << i);
21542             if (x > 0) continue;
21543             local_check (x, -1900, 70);
21544             }
21545         }
21546     printf ("sLOCALTIME_min=%ld\n", pt);
21547     return (0);
21548     } /* check_min */
21549
21550 int main (int argc, char *argv[])
21551 {
21552     check_max ();
21553     check_min ();
21554     return (0);
21555     } /* main */
21556 EOCP
21557         set try
21558         if eval $compile; then
21559             eval `$run ./try 2>/dev/null`
21560         else
21561             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21562             fi
21563         $rm_try
21564         ;;
21565     esac
21566
21567 : check for type of arguments to select.
21568 case "$selecttype" in
21569 '') case "$d_select" in
21570         $define)
21571                 echo " "
21572                 $cat <<EOM
21573 Checking to see what type of arguments are accepted by select().
21574 EOM
21575                 hdrs="$define sys/types.h
21576                         $i_systime sys/time.h
21577                         $i_sysselct sys/select.h
21578                         $d_socket sys/socket.h"
21579                 : The first arg can be int, unsigned, or size_t
21580                 : The last arg may or may not be 'const'
21581                 val=''
21582                 : void pointer has been seen but using that
21583                 : breaks the selectminbits test
21584                 for xxx in 'fd_set *' 'int *'; do
21585                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21586                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
21587                                         case "$val" in
21588                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21589                                                 if ./protochk "$try" $hdrs; then
21590                                                         echo "Your system accepts $xxx."
21591                                                         val="$xxx"
21592                                                 fi
21593                                                 ;;
21594                                         esac
21595                                 done
21596                         done
21597                 done
21598                 case "$val" in
21599                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21600                         case "$d_fd_set" in
21601                                 $define) dflt="fd_set *" ;;
21602                                 *)              dflt="int *" ;;
21603                         esac
21604                         . ./myread
21605                         val=$ans
21606                         ;;
21607                 esac
21608                 selecttype="$val"
21609                 ;;
21610         *)      : no select, so pick a harmless default
21611                 selecttype='int *'
21612                 ;;
21613         esac
21614         ;;
21615 esac
21616
21617 : check for the select 'width'
21618 case "$selectminbits" in
21619 '') safebits=`expr $ptrsize \* 8`
21620     case "$d_select" in
21621         $define)
21622                 $cat <<EOM
21623
21624 Checking to see on how many bits at a time your select() operates...
21625 EOM
21626                 $cat >try.c <<EOCP
21627 #include <sys/types.h>
21628 #$i_time I_TIME
21629 #$i_systime I_SYS_TIME
21630 #$i_systimek I_SYS_TIME_KERNEL
21631 #ifdef I_TIME
21632 #   include <time.h>
21633 #endif
21634 #ifdef I_SYS_TIME
21635 #   ifdef I_SYS_TIME_KERNEL
21636 #       define KERNEL
21637 #   endif
21638 #   include <sys/time.h>
21639 #   ifdef I_SYS_TIME_KERNEL
21640 #       undef KERNEL
21641 #   endif
21642 #endif
21643 #$i_sysselct I_SYS_SELECT
21644 #ifdef I_SYS_SELECT
21645 #include <sys/select.h>
21646 #endif
21647 #$d_socket HAS_SOCKET
21648 #ifdef HAS_SOCKET
21649 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21650 #endif
21651 #include <stdio.h>
21652 #$i_stdlib I_STDLIB
21653 #ifdef I_STDLIB
21654 #include <stdlib.h>
21655 #endif
21656 $selecttype b;
21657 #define S sizeof(*(b))
21658 #define MINBITS 64
21659 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21660 #define NBITS  (NBYTES * 8)
21661 int main() {
21662     char *s = (char *)malloc(NBYTES);
21663     struct timeval t;
21664     int i;
21665     FILE* fp;
21666     int fd;
21667
21668     if (!s)
21669         exit(1);
21670     fclose(stdin);
21671     fp = fopen("try.c", "r");
21672     if (fp == 0)
21673       exit(2);
21674     fd = fileno(fp);
21675     if (fd < 0)
21676       exit(3);
21677     b = ($selecttype)s;
21678     for (i = 0; i < NBITS; i++)
21679         FD_SET(i, b);
21680     t.tv_sec  = 0;
21681     t.tv_usec = 0;
21682     select(fd + 1, b, 0, 0, &t);
21683     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
21684     free(s);
21685     printf("%d\n", i + 1);
21686     return 0;
21687 }
21688 EOCP
21689                 set try
21690                 if eval $compile_ok; then
21691                         selectminbits=`$run ./try 2>/dev/null`
21692                         case "$selectminbits" in
21693                         '')     cat >&4 <<EOM
21694 Cannot figure out on how many bits at a time your select() operates.
21695 I'll play safe and guess it is $safebits bits.
21696 EOM
21697                                 selectminbits=$safebits
21698                                 bits="$safebits bits"
21699                                 ;;
21700                         1)      bits="1 bit" ;;
21701                         *)      bits="$selectminbits bits" ;;
21702                         esac
21703                         echo "Your select() operates on $bits at a time." >&4
21704                 else
21705                         rp='What is the minimum number of bits your select() operates on?'
21706                         case "$byteorder" in
21707                         12345678)       dflt=64 ;;
21708                         1234)           dflt=32 ;;
21709                         *)              dflt=1  ;;
21710                         esac
21711                         . ./myread
21712                         val=$ans
21713                         selectminbits="$val"
21714                 fi
21715                 $rm_try
21716                 ;;
21717         *)      : no select, so pick a harmless default
21718                 selectminbits=$safebits
21719                 ;;
21720         esac
21721         ;;
21722 esac
21723
21724 : Trace out the files included by signal.h, then look for SIGxxx names.
21725 case "$sig_num_init" in
21726 '')
21727 if [ "X$fieldn" = X ]; then
21728         : Just make some guesses.  We check them later.
21729         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
21730 else
21731         xxx=`echo '#include <signal.h>' |
21732         $cppstdin $cppminus $cppflags 2>/dev/null |
21733         $grep '^[       ]*#.*include' |
21734         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
21735                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
21736 fi
21737 xxxfiles=''
21738 for xx in $xxx /dev/null ; do
21739         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
21740 done
21741 case "$xxxfiles" in
21742 '')     xxxfiles=`./findhdr signal.h` ;;
21743 esac
21744 xxx=`awk '
21745 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
21746         print substr($2, 4, 20)
21747 }
21748 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
21749         print substr($3, 4, 20)
21750 }' $xxxfiles`
21751 : Append some common names just in case the awk scan failed.
21752 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
21753 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
21754 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
21755 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
21756 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
21757
21758 : generate a few handy files for later
21759 $cat > signal.c <<EOCP
21760 #include <sys/types.h>
21761 #include <signal.h>
21762 #$i_stdlib I_STDLIB
21763 #ifdef I_STDLIB
21764 #include <stdlib.h>
21765 #endif
21766 #include <stdio.h>
21767 int main() {
21768
21769 /* Strange style to avoid deeply-nested #if/#else/#endif */
21770 #ifndef NSIG
21771 #  ifdef _NSIG
21772 #    define NSIG (_NSIG)
21773 #  endif
21774 #endif
21775
21776 #ifndef NSIG
21777 #  ifdef SIGMAX
21778 #    define NSIG (SIGMAX+1)
21779 #  endif
21780 #endif
21781
21782 #ifndef NSIG
21783 #  ifdef SIG_MAX
21784 #    define NSIG (SIG_MAX+1)
21785 #  endif
21786 #endif
21787
21788 #ifndef NSIG
21789 #  ifdef _SIG_MAX
21790 #    define NSIG (_SIG_MAX+1)
21791 #  endif
21792 #endif
21793
21794 #ifndef NSIG
21795 #  ifdef MAXSIG
21796 #    define NSIG (MAXSIG+1)
21797 #  endif
21798 #endif
21799
21800 #ifndef NSIG
21801 #  ifdef MAX_SIG
21802 #    define NSIG (MAX_SIG+1)
21803 #  endif
21804 #endif
21805
21806 #ifndef NSIG
21807 #  ifdef SIGARRAYSIZE
21808 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
21809 #  endif
21810 #endif
21811
21812 #ifndef NSIG
21813 #  ifdef _sys_nsig
21814 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
21815 #  endif
21816 #endif
21817
21818 /* Default to some arbitrary number that's big enough to get most
21819    of the common signals.
21820 */
21821 #ifndef NSIG
21822 #    define NSIG 50
21823 #endif
21824
21825 printf("NSIG %d\n", NSIG);
21826
21827 #ifndef JUST_NSIG
21828
21829 EOCP
21830
21831 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
21832 {
21833         printf "#ifdef SIG"; printf $1; printf "\n"
21834         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
21835         printf $1; printf ");\n"
21836         printf "#endif\n"
21837 }
21838 END {
21839         printf "#endif /* JUST_NSIG */\n";
21840         printf "exit(0);\n}\n";
21841 }
21842 ' >>signal.c
21843 $cat >signal.awk <<'EOP'
21844 BEGIN { ndups = 0 }
21845 $1 ~ /^NSIG$/ { nsig = $2 }
21846 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
21847     if ($2 > maxsig) { maxsig = $2 }
21848     if (sig_name[$2]) {
21849         dup_name[ndups] = $1
21850         dup_num[ndups] = $2
21851         ndups++
21852     }
21853     else {
21854         sig_name[$2] = $1
21855         sig_num[$2] = $2
21856     }
21857 }
21858 END {
21859     if (nsig == 0) {
21860         nsig = maxsig + 1
21861     }
21862     printf("NSIG %d\n", nsig);
21863     for (n = 1; n < nsig; n++) {
21864         if (sig_name[n]) {
21865             printf("%s %d\n", sig_name[n], sig_num[n])
21866         }
21867         else {
21868             printf("NUM%d %d\n", n, n)
21869         }
21870     }
21871     for (n = 0; n < ndups; n++) {
21872         printf("%s %d\n", dup_name[n], dup_num[n])
21873     }
21874 }
21875 EOP
21876 $cat >signal_cmd <<EOS
21877 $startsh
21878 if $test -s signal.lst; then
21879     echo "Using your existing signal.lst file"
21880         exit 0
21881 fi
21882 xxx="$xxx"
21883 EOS
21884 $cat >>signal_cmd <<'EOS'
21885
21886 set signal
21887 if eval $compile_ok; then
21888         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21889                 $uniq | $awk -f signal.awk >signal.lst
21890 else
21891         echo "(I can't seem be able to compile the whole test program)" >&4
21892         echo "(I'll try it in little pieces.)" >&4
21893         set signal -DJUST_NSIG
21894         if eval $compile_ok; then
21895                 $run ./signal$_exe > signal.nsg
21896                 $cat signal.nsg
21897         else
21898                 echo "I can't seem to figure out how many signals you have." >&4
21899                 echo "Guessing 50." >&4
21900                 echo 'NSIG 50' > signal.nsg
21901         fi
21902         : Now look at all the signal names, one at a time.
21903         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21904                 $cat > signal.c <<EOCP
21905 #include <sys/types.h>
21906 #include <signal.h>
21907 #include <stdio.h>
21908 int main() {
21909 printf("$xx %d\n", SIG${xx});
21910 return 0;
21911 }
21912 EOCP
21913                 set signal
21914                 if eval $compile; then
21915                         echo "SIG${xx} found."
21916                         $run ./signal$_exe  >> signal.ls1
21917                 else
21918                         echo "SIG${xx} NOT found."
21919                 fi
21920         done
21921         if $test -s signal.ls1; then
21922                 $cat signal.nsg signal.ls1 |
21923                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
21924         fi
21925
21926 fi
21927 if $test -s signal.lst; then
21928         :
21929 else
21930         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21931         echo 'kill -l' >signal
21932         set X `csh -f <signal`
21933         $rm -f signal
21934         shift
21935         case $# in
21936         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21937         esac
21938         echo $@ | $tr ' ' $trnl | \
21939             $awk '{ printf "%s %d\n", $1, ++s; }
21940                   END { printf "NSIG %d\n", ++s }' >signal.lst
21941 fi
21942 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21943 EOS
21944 chmod a+x signal_cmd
21945 $eunicefix signal_cmd
21946 ;;
21947 esac
21948
21949 : generate list of signal names
21950 case "$sig_num_init" in
21951 '')
21952 echo " "
21953 case "$sig_name_init" in
21954 '') doinit=yes ;;
21955 *)  case "$sig_num_init" in
21956     ''|*,*) doinit=yes ;;
21957     esac ;;
21958 esac
21959 case "$doinit" in
21960 yes)
21961         echo "Generating a list of signal names and numbers..." >&4
21962         . ./signal_cmd
21963         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21964         sig_name=`$awk 'BEGIN { printf "ZERO " }
21965                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21966         sig_num=`$awk  'BEGIN { printf "0 " }
21967                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21968         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
21969                              !/^NSIG/   { printf "\"%s\", ", $1 }
21970                              END        { printf "0\n" }' signal.lst`
21971         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21972                              !/^NSIG/   { printf "%d, ", $2}
21973                              END        { printf "0\n"}' signal.lst`
21974         ;;
21975 esac
21976 echo "The following $sig_count signals are available:"
21977 echo " "
21978 echo $sig_name | $awk \
21979 'BEGIN { linelen = 0 }
21980 {
21981         for (i = 1; i <= NF; i++) {
21982                 name = "SIG" $i " "
21983                 linelen = linelen + length(name)
21984                 if (linelen > 70) {
21985                         printf "\n"
21986                         linelen = length(name)
21987                 }
21988                 printf "%s", name
21989         }
21990         printf "\n"
21991 }'
21992 sig_size=`echo $sig_name | awk '{print NF}'`
21993 $rm -f signal signal.c signal.awk signal.lst signal_cmd
21994 ;;
21995 esac
21996
21997 : Check size of size
21998 echo " "
21999 case "$sizetype" in
22000 *_t) zzz="$sizetype"    ;;
22001 *)   zzz="filesize"     ;;
22002 esac
22003 echo "Checking the size of $zzz..." >&4
22004 cat > try.c <<EOCP
22005 #include <sys/types.h>
22006 #include <stdio.h>
22007 #$i_stdlib I_STDLIB
22008 #ifdef I_STDLIB
22009 #include <stdlib.h>
22010 #endif
22011 int main() {
22012     printf("%d\n", (int)sizeof($sizetype));
22013     exit(0);
22014 }
22015 EOCP
22016 set try
22017 if eval $compile_ok; then
22018         yyy=`$run ./try`
22019         case "$yyy" in
22020         '')     sizesize=4
22021                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22022                 ;;
22023         *)      sizesize=$yyy
22024                 echo "Your $zzz size is $sizesize bytes."
22025                 ;;
22026         esac
22027 else
22028         sizesize=4
22029         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22030 fi
22031
22032
22033 : check for socklen_t
22034 echo " "
22035 echo "Checking to see if you have socklen_t..." >&4
22036 $cat >try.c <<EOCP
22037 #include <sys/types.h>
22038 #$d_socket HAS_SOCKET
22039 #ifdef HAS_SOCKET
22040 #include <sys/socket.h>
22041 #endif
22042 int main() { socklen_t x = 16; }
22043 EOCP
22044 set try
22045 if eval $compile; then
22046         val="$define"
22047         echo "You have socklen_t."
22048 else
22049         val="$undef"
22050         echo "You do not have socklen_t."
22051         case "$sizetype" in
22052         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22053         esac
22054 fi
22055 $rm_try
22056 set d_socklen_t
22057 eval $setvar
22058
22059 : see if this is a socks.h system
22060 set socks.h i_socks
22061 eval $inhdr
22062
22063 : check for type of the size argument to socket calls
22064 case "$d_socket" in
22065 "$define")
22066         $cat <<EOM
22067
22068 Checking to see what type is the last argument of accept().
22069 EOM
22070         yyy=''
22071         case "$d_socklen_t" in
22072         "$define") yyy="$yyy socklen_t"
22073         esac
22074         yyy="$yyy $sizetype int long unsigned"
22075         for xxx in $yyy; do
22076                 case "$socksizetype" in
22077                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22078                         case "$usesocks" in
22079                         "$define")
22080                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22081                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22082                                         socksizetype="$xxx"
22083                                 fi
22084                                 ;;
22085                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22086                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22087                                         socksizetype="$xxx"
22088                                 fi
22089                                 ;;
22090                         esac
22091                         ;;
22092                 esac
22093         done
22094 : In case none of those worked, prompt the user.
22095         case "$socksizetype" in
22096         '')     rp='What is the type for socket address structure sizes?'
22097                 dflt='int'
22098                 . ./myread
22099                 socksizetype=$ans
22100                 ;;
22101         esac
22102         ;;
22103 *)      : no sockets, so pick relatively harmless default
22104         socksizetype='int'
22105         ;;
22106 esac
22107
22108 : see what type is used for signed size_t
22109 set ssize_t ssizetype int stdio.h sys/types.h
22110 eval $typedef
22111 dflt="$ssizetype"
22112 $cat > try.c <<EOM
22113 #include <stdio.h>
22114 #$i_stdlib I_STDLIB
22115 #ifdef I_STDLIB
22116 #include <stdlib.h>
22117 #endif
22118 #include <sys/types.h>
22119 #define Size_t $sizetype
22120 #define SSize_t $dflt
22121 int main()
22122 {
22123         if (sizeof(Size_t) == sizeof(SSize_t))
22124                 printf("$dflt\n");
22125         else if (sizeof(Size_t) == sizeof(int))
22126                 printf("int\n");
22127         else
22128                 printf("long\n");
22129         exit(0);
22130 }
22131 EOM
22132 echo " "
22133 set try
22134 if eval $compile_ok && $run ./try > /dev/null; then
22135         ssizetype=`$run ./try`
22136         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22137 else
22138         $cat >&4 <<EOM
22139 Help! I can't compile and run the ssize_t test program: please enlighten me!
22140 (This is probably a misconfiguration in your system or libraries, and
22141 you really ought to fix it.  Still, I'll try anyway.)
22142
22143 I need a type that is the same size as $sizetype, but is guaranteed to
22144 be signed.  Common values are ssize_t, int and long.
22145
22146 EOM
22147         rp="What signed type is the same size as $sizetype?"
22148         . ./myread
22149         ssizetype="$ans"
22150 fi
22151 $rm_try
22152
22153 : Check the size of st_ino
22154 $echo " "
22155 $echo "Checking the size of st_ino..." >&4
22156 $cat > try.c <<EOCP
22157 #include <sys/stat.h>
22158 #include <stdio.h>
22159 #$i_stdlib I_STDLIB
22160 #ifdef I_STDLIB
22161 #include <stdlib.h>
22162 #endif
22163 int main() {
22164     struct stat st;
22165     printf("%d\n", (int)sizeof(st.st_ino));
22166     exit(0);
22167 }
22168 EOCP
22169 set try
22170 if eval $compile_ok; then
22171         val=`$run ./try`
22172         case "$val" in
22173         '')     st_ino_size=4
22174                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22175                 ;;
22176         *)      st_ino_size=$val
22177                 $echo "Your st_ino is $st_ino_size bytes long."
22178                 ;;
22179         esac
22180 else
22181         st_ino_size=4
22182         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22183 fi
22184 $rm_try
22185
22186 : Check if st_ino is signed
22187 $echo " "
22188 $echo "Checking the sign of st_ino..." >&4
22189 $cat > try.c <<EOCP
22190 #include <sys/stat.h>
22191 #include <stdio.h>
22192 int main() {
22193         struct stat foo;
22194         foo.st_ino = -1;
22195         if (foo.st_ino < 0)
22196                 printf("-1\n");
22197         else
22198                 printf("1\n");
22199 }
22200 EOCP
22201 set try
22202 if eval $compile; then
22203         val=`$run ./try`
22204         case "$val" in
22205         '')     st_ino_sign=1
22206                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22207                 ;;
22208         *)      st_ino_sign=$val
22209                 case "$st_ino_sign" in
22210                  1) $echo "Your st_ino is unsigned." ;;
22211                 -1) $echo "Your st_ino is signed."   ;;
22212                 esac
22213                 ;;
22214         esac
22215 else
22216         st_ino_sign=1
22217         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22218 fi
22219 $rm_try
22220
22221 : see what type of char stdio uses.
22222 echo " "
22223 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22224 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22225         echo "Your stdio uses unsigned chars." >&4
22226         stdchar="unsigned char"
22227 else
22228         echo "Your stdio uses signed chars." >&4
22229         stdchar="char"
22230 fi
22231 $rm -f stdioh
22232
22233 : Check size of UID
22234 echo " "
22235 case "$uidtype" in
22236 *_t) zzz="$uidtype"     ;;
22237 *)   zzz="uid"          ;;
22238 esac
22239 echo "Checking the size of $zzz..." >&4
22240 cat > try.c <<EOCP
22241 #include <sys/types.h>
22242 #include <stdio.h>
22243 #$i_stdlib I_STDLIB
22244 #ifdef I_STDLIB
22245 #include <stdlib.h>
22246 #endif
22247 int main() {
22248     printf("%d\n", (int)sizeof($uidtype));
22249     exit(0);
22250 }
22251 EOCP
22252 set try
22253 if eval $compile_ok; then
22254         yyy=`$run ./try`
22255         case "$yyy" in
22256         '')     uidsize=4
22257                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22258                 ;;
22259         *)      uidsize=$yyy
22260                 echo "Your $zzz is $uidsize bytes long."
22261                 ;;
22262         esac
22263 else
22264         uidsize=4
22265         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22266 fi
22267
22268 : Check if UID is signed
22269 echo " "
22270 case "$uidtype" in
22271 *_t) zzz="$uidtype"     ;;
22272 *)   zzz="uid"          ;;
22273 esac
22274 echo "Checking the sign of $zzz..." >&4
22275 cat > try.c <<EOCP
22276 #include <sys/types.h>
22277 #include <stdio.h>
22278 int main() {
22279         $uidtype foo = -1;
22280         if (foo < 0)
22281                 printf("-1\n");
22282         else
22283                 printf("1\n");
22284 }
22285 EOCP
22286 set try
22287 if eval $compile; then
22288         yyy=`$run ./try`
22289         case "$yyy" in
22290         '')     uidsign=1
22291                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22292                 ;;
22293         *)      uidsign=$yyy
22294                 case "$uidsign" in
22295                  1) echo "Your $zzz is unsigned." ;;
22296                 -1) echo "Your $zzz is signed."   ;;
22297                 esac
22298                 ;;
22299         esac
22300 else
22301         uidsign=1
22302         echo "(I can't compile the test program--guessing unsigned.)" >&4
22303 fi
22304
22305
22306 : Check format string for UID
22307 echo " "
22308 $echo "Checking the format string to be used for uids..." >&4
22309
22310 case "$uidsign" in
22311 -1)     if $test X"$uidsize" = X"$ivsize"; then
22312                 uidformat="$ivdformat"
22313         else
22314                 if $test X"$uidsize" = X"$longsize"; then
22315                         uidformat='"ld"'
22316                 else
22317                         if $test X"$uidsize" = X"$intsize"; then
22318                                 uidformat='"d"'
22319                         else
22320                                 if $test X"$uidsize" = X"$shortsize"; then
22321                                         uidformat='"hd"'
22322                                 fi
22323                         fi
22324                 fi
22325         fi
22326         ;;
22327 *)      if $test X"$uidsize" = X"$uvsize"; then
22328                 uidformat="$uvuformat"
22329         else
22330                 if $test X"$uidsize" = X"$longsize"; then
22331                         uidformat='"lu"'
22332                 else
22333                         if $test X"$uidsize" = X"$intsize"; then
22334                                 uidformat='"u"'
22335                         else
22336                                 if $test X"$uidsize" = X"$shortsize"; then
22337                                         uidformat='"hu"'
22338                                 fi
22339                         fi
22340                 fi
22341         fi
22342         ;;
22343 esac
22344
22345 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22346 echo " "
22347 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22348 $cat >try.c <<'EOM'
22349 /* Intentionally a long probe as I'd like to sanity check that the exact
22350    approach is going to work, as thinking it will work, but only having it
22351    part working at runtime is worse than not having it.  */
22352
22353 #include <sys/types.h>
22354 #include <sys/sysctl.h>
22355 #include <sys/param.h>
22356 #include <stdio.h>
22357 #include <string.h>
22358 #include <stdlib.h>
22359 #include <unistd.h>
22360
22361 int
22362 main(int argc, char **argv) {
22363     char *buffer;
22364     char *argv_leaf = strrchr(argv[0], '/');
22365     char *buffer_leaf;
22366     size_t size = 0;
22367     int mib[4];
22368
22369     mib[0] = CTL_KERN;
22370     mib[1] = KERN_PROC;
22371     mib[2] = KERN_PROC_PATHNAME;
22372     mib[3] = -1;
22373
22374     if (!argv_leaf) {
22375         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22376         return 1;
22377     }
22378
22379     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22380         perror("sysctl");
22381         return 2;
22382     }
22383
22384     if (size < strlen(argv_leaf) + 1) {
22385         fprintf(stderr, "size %lu is too short for a path\n",
22386                 (unsigned long) size);
22387         return 3;
22388     }
22389
22390     if (size > MAXPATHLEN * MAXPATHLEN) {
22391         fprintf(stderr, "size %lu is too long for a path\n",
22392                 (unsigned long) size);
22393         return 4;
22394     }
22395
22396     buffer = (char *)malloc(size);
22397     if (!buffer) {
22398         perror("malloc");
22399         return 5;
22400     }
22401
22402     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22403         perror("sysctl");
22404         return 6;
22405     }
22406
22407     if (strlen(buffer) + 1 != size) {
22408         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22409                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22410         return 7;
22411     }
22412
22413
22414     if (*buffer != '/') {
22415         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22416         return 8;
22417     }
22418
22419     if (strstr(buffer, "/./")) {
22420         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22421         return 9;
22422     }
22423
22424     if (strstr(buffer, "/../")) {
22425         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22426         return 10;
22427     }
22428
22429     buffer_leaf = strrchr(buffer, '/');
22430     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22431         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22432         return 11;
22433     }
22434
22435     free(buffer);
22436
22437     return 0;
22438 }
22439 EOM
22440
22441 val=$undef
22442 set try
22443 if eval $compile; then
22444         if $run ./try; then
22445                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22446                 val="$define"
22447         else
22448                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22449                 val="$undef"
22450         fi
22451 else
22452         echo "I'm unable to compile the test program." >&4
22453         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22454         val="$undef"
22455 fi
22456 $rm_try
22457 set usekernprocpathname
22458 eval $setvar
22459
22460 : Determine if we can use _NSGetExecutablePath to find executing program
22461 echo " "
22462 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22463 $cat >try.c <<'EOM'
22464 /* Intentionally a long probe as I'd like to sanity check that the exact
22465    approach is going to work, as thinking it will work, but only having it
22466    part working at runtime is worse than not having it.  */
22467 #include <mach-o/dyld.h>
22468 #include <stdio.h>
22469 #include <stdlib.h>
22470 #include <sys/param.h>
22471 #include <string.h>
22472
22473 int
22474 main(int argc, char **argv) {
22475     char buf[1];
22476     uint32_t size = sizeof(buf);
22477     int result;
22478     char *buffer;
22479     char *tidied;
22480     char *argv_leaf = strrchr(argv[0], '/');
22481     char *tidied_leaf;
22482
22483     if (!argv_leaf) {
22484         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22485         return 1;
22486     }
22487
22488     _NSGetExecutablePath(buf, &size);
22489     if (size > MAXPATHLEN * MAXPATHLEN) {
22490         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22491                 (unsigned int) size);
22492         return 2;
22493     }
22494
22495     buffer = (char *)malloc(size);
22496     if (!buffer) {
22497         perror("malloc");
22498         return 3;
22499     }
22500
22501     result = _NSGetExecutablePath(buffer, &size);
22502     if (result != 0) {
22503         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22504                 result, (unsigned int) size);
22505         return 4;
22506     }
22507
22508     tidied = realpath(buffer, NULL);
22509     if (!tidied) {
22510         perror("realpath");
22511         return 5;
22512     }
22513
22514     free(buffer);
22515
22516     if (*tidied != '/') {
22517         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22518         return 6;
22519     }
22520
22521     if (strstr(tidied, "/./")) {
22522         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22523         return 7;
22524     }
22525
22526     if (strstr(tidied, "/../")) {
22527         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22528         return 8;
22529     }
22530
22531     tidied_leaf = strrchr(tidied, '/');
22532     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22533         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22534         return 9;
22535     }
22536
22537     free(tidied);
22538
22539     return 0;
22540 }
22541 EOM
22542
22543 val=$undef
22544 set try
22545 if eval $compile; then
22546         if $run ./try; then
22547                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22548                 val="$define"
22549         else
22550                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22551         fi
22552 else
22553         echo "I'm unable to compile the test program." >&4
22554         echo "I'll assume no _NSGetExecutablePath here." >&4
22555 fi
22556 $rm_try
22557 set usensgetexecutablepath
22558 eval $setvar
22559
22560 : Check if site customization support was requested
22561 case "$usesitecustomize" in
22562     $define|true|[Yy]*)
22563         usesitecustomize="$define"
22564         ;;
22565     *)
22566         usesitecustomize="$undef"
22567         ;;
22568     esac
22569
22570 : determine compiler compiler
22571 case "$yacc" in
22572 '')
22573         dflt=yacc;;
22574 *)
22575         dflt="$yacc";;
22576 esac
22577 echo " "
22578 comp='yacc'
22579 if $test -f "$byacc$_exe"; then
22580         dflt="$byacc"
22581         comp="byacc or $comp"
22582 fi
22583 if $test -f "$bison$_exe"; then
22584         comp="$comp or bison -y"
22585 fi
22586 rp="Which compiler compiler ($comp) shall I use?"
22587 . ./myread
22588 yacc="$ans"
22589 case "$yacc" in
22590 *bis*)
22591         case "$yacc" in
22592         *-y*) ;;
22593         *)
22594                 yacc="$yacc -y"
22595                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22596                 ;;
22597         esac
22598         ;;
22599 esac
22600
22601 : see if this is a bfd.h system
22602 set bfd.h i_bfd
22603 eval $inhdr
22604
22605 : see if this is an execinfo.h system
22606 set execinfo.h i_execinfo
22607 eval $inhdr
22608
22609 : see if this is a fenv.h system
22610 set fenv.h i_fenv
22611 eval $inhdr
22612
22613 : see if this is a fp.h system
22614 set fp.h i_fp
22615 eval $inhdr
22616
22617 : see if this is a fp_class.h system
22618 set fp_class.h i_fp_class
22619 eval $inhdr
22620
22621 : see if gdbm.h is available
22622 set gdbm.h t_gdbm
22623 eval $inhdr
22624 case "$t_gdbm" in
22625 $define)
22626         : see if gdbm_open exists
22627         set gdbm_open d_gdbm_open
22628         eval $inlibc
22629         case "$d_gdbm_open" in
22630         $undef)
22631                 t_gdbm="$undef"
22632                 echo "We won't be including <gdbm.h>"
22633                 ;;
22634         esac
22635         ;;
22636 esac
22637 val="$t_gdbm"
22638 set i_gdbm
22639 eval $setvar
22640
22641 : see if this is a ieeefp.h system
22642 case "$i_ieeefp" in
22643 '' ) set ieeefp.h i_ieeefp
22644      eval $inhdr
22645      ;;
22646 esac
22647
22648 : see if this is a libutil.h system
22649 set libutil.h i_libutil
22650 eval $inhdr
22651
22652 : see if mach cthreads are available
22653 if test "X$usethreads" = "X$define"; then
22654         set mach/cthreads.h i_machcthr
22655         eval $inhdr
22656 else
22657         i_machcthr="$undef"
22658 fi
22659
22660 : see if this is a mntent.h system
22661 set mntent.h i_mntent
22662 eval $inhdr
22663
22664 : see if net/errno.h is available
22665 val=''
22666 set net/errno.h val
22667 eval $inhdr
22668
22669 : Unfortunately, it causes problems on some systems.  Arrgh.
22670 case "$val" in
22671 $define)
22672         cat > try.c <<'EOM'
22673 #include <stdio.h>
22674 #include <errno.h>
22675 #include <net/errno.h>
22676 int func()
22677 {
22678         return ENOTSOCK;
22679 }
22680 EOM
22681         if $cc $ccflags -c try.c >/dev/null 2>&1; then
22682                 echo "We'll be including <net/errno.h>." >&4
22683         else
22684                 echo "We won't be including <net/errno.h>." >&4
22685                 val="$undef"
22686         fi
22687         $rm_try
22688         ;;
22689 esac
22690 set i_neterrno
22691 eval $setvar
22692
22693 : see if netinet/tcp.h is available
22694 set netinet/tcp.h i_netinettcp
22695 eval $inhdr
22696
22697 : see if this is a poll.h system
22698 set poll.h i_poll
22699 eval $inhdr
22700
22701 : see if this is a prot.h system
22702 set prot.h i_prot
22703 eval $inhdr
22704
22705 : Preprocessor symbols
22706 echo " "
22707 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
22708 $cat <<'EOSH' > Cppsym.know
22709 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
22710 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
22711 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
22712 arch_pwr ardent ARM ARM32 atarist att386 att3b
22713 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
22714 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
22715 byteorder byte_order
22716 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
22717 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
22718 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
22719 ELF encore EPI EXTENSIONS
22720 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
22721 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
22722 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
22723 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
22724 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400
22725 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
22726 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
22727 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
22728 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
22729 ksr1
22730 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
22731 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
22732 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
22733 luna88k Lynx
22734 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
22735 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
22736 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
22737 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
22738 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
22739 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
22740 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
22741 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
22742 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
22743 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
22744 ns32000 ns32016 ns32332 ns32k nsc32000
22745 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
22746 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
22747 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
22748 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
22749 QK_USER QNX
22750 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
22751 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
22752 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
22753 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
22754 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
22755 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
22756 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
22757 SYSV4 SYSV5 sysV68 sysV88
22758 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
22759 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
22760 tower32_800 tower32_850 tss
22761 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
22762 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
22763 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
22764 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
22765 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
22766 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
22767 uxpm uxps
22768 vax venix VMESA vms
22769 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
22770 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
22771 z8000 zarch
22772 EOSH
22773 # Maybe put other stuff here too.
22774 ./tr '-' '_' <<EOSH >>Cppsym.know
22775 $osname
22776 EOSH
22777 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
22778 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
22779 $cat Cppsym.know > Cppsym.c
22780 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
22781 $rm -f Cppsym.a Cppsym.b Cppsym.c
22782 cat <<EOSH > Cppsym
22783 $startsh
22784 if $test \$# -gt 0; then
22785     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
22786     if $test -s Cppsym.got; then
22787         $rm -f Cppsym.got
22788         exit 0
22789     fi
22790     $rm -f Cppsym.got
22791     exit 1
22792 else
22793     $tr " " "$trnl" | ./Cppsym.try
22794     exit 0
22795 fi
22796 EOSH
22797 chmod +x Cppsym
22798 $eunicefix Cppsym
22799 cat <<EOSH > Cppsym.try
22800 $startsh
22801 cat <<'EOCP' > try.c
22802 #include <stdio.h>
22803 #if cpp_stuff == 1
22804 #define STRINGIFY(a)    "a"
22805 #endif
22806 #if cpp_stuff == 42
22807 #define StGiFy(a)  #a
22808 #define STRINGIFY(a)    StGiFy(a)
22809 #endif
22810 #if $cpp_stuff != 1 && $cpp_stuff != 42
22811 #   include "Bletch: How does this C preprocessor stringify macros?"
22812 #endif
22813 int main() {
22814 EOCP
22815 $awk \\
22816 EOSH
22817 cat <<'EOSH' >> Cppsym.try
22818 'length($1) > 0 {
22819     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
22820     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
22821     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
22822     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
22823 }'       >> try.c
22824 echo 'return 0;}' >> try.c
22825 EOSH
22826 cat <<EOSH >> Cppsym.try
22827 ccflags="$ccflags"
22828 case "$osname-$gccversion" in
22829 irix-) ccflags="\$ccflags -woff 1178" ;;
22830 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
22831 esac
22832 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
22833 EOSH
22834 chmod +x Cppsym.try
22835 $eunicefix Cppsym.try
22836 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
22837 : Add in any Linux cpp "predefined macros":
22838 case "$osname::$gccversion" in
22839   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
22840     tHdrH=_tmpHdr
22841     rm -f $tHdrH'.h' $tHdrH
22842     touch $tHdrH'.h'
22843     # Filter out macro arguments, such as Linux's __INT8_C(c)
22844     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
22845        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
22846        if [ -s $tHdrH'_cppsym.real' ]; then
22847           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22848        fi
22849     fi
22850     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22851   ;;
22852 esac
22853 : now check the C compiler for additional symbols
22854 postprocess_cc_v=''
22855 case "$osname" in
22856 aix) postprocess_cc_v="|$tr , ' '" ;;
22857 esac
22858 $cat >ccsym <<EOS
22859 $startsh
22860 $cat >tmp.c <<EOF
22861 extern int foo;
22862 EOF
22863 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22864 do
22865         case "\$i" in
22866         -D*) echo "\$i" | $sed 's/^-D//';;
22867         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22868         esac
22869 done
22870 $rm_try
22871 EOS
22872 postprocess_cc_v=''
22873 chmod +x ccsym
22874 $eunicefix ccsym
22875 ./ccsym > ccsym1.raw
22876 if $test -s ccsym1.raw; then
22877     $sort ccsym1.raw | $uniq >ccsym.raw
22878 else
22879     mv ccsym1.raw ccsym.raw
22880 fi
22881
22882 $awk '/\=/ { print $0; next }
22883         { print $0"=1" }' ccsym.raw >ccsym.list
22884 $comm -13 Cppsym.true ccsym.list >ccsym.own
22885 $comm -12 Cppsym.true ccsym.list >ccsym.com
22886 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
22887 also=''
22888 if $test -z ccsym.raw; then
22889         echo "Your C compiler doesn't seem to define any symbols!" >&4
22890         echo " "
22891         echo "However, your C preprocessor defines the following symbols:"
22892         $cat Cppsym.true
22893         ccsymbols=''
22894         cppsymbols=`$cat Cppsym.true`
22895         cppsymbols=`echo $cppsymbols`
22896         cppccsymbols="$cppsymbols"
22897 else
22898         if $test -s ccsym.com; then
22899                 echo "Your C compiler and pre-processor define these symbols:"
22900                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22901                 also='also '
22902                 symbols='ones'
22903                 cppccsymbols=`$cat ccsym.com`
22904                 cppccsymbols=`echo $cppccsymbols`
22905                 $test "$silent" || sleep 1
22906         fi
22907         if $test -s ccsym.cpp; then
22908                 $test "$also" && echo " "
22909                 echo "Your C pre-processor ${also}defines the following symbols:"
22910                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22911                 also='further '
22912                 cppsymbols=`$cat ccsym.cpp`
22913                 cppsymbols=`echo $cppsymbols`
22914                 $test "$silent" || sleep 1
22915         fi
22916         if $test -s ccsym.own; then
22917                 $test "$also" && echo " "
22918                 echo "Your C compiler ${also}defines the following cpp symbols:"
22919                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22920                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22921                 ccsymbols=`$cat ccsym.own`
22922                 ccsymbols=`echo $ccsymbols`
22923                 $test "$silent" || sleep 1
22924         fi
22925 fi
22926
22927 : add -D_FORTIFY_SOURCE if feasible and not already there
22928 case "$gccversion" in
22929 [4567].*)       case "$optimize$ccflags" in
22930         *-O*)   case "$ccflags$cppsymbols" in
22931                 *_FORTIFY_SOURCE=*) # Don't add it again.
22932                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
22933                         ;;
22934                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
22935                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
22936                         ;;
22937                 esac
22938                 ;;
22939         *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
22940                 ;;
22941         esac
22942         ;;
22943 *)      echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
22944         ;;
22945 esac
22946
22947 : script used to emit important warnings
22948 cat >warn <<EOS
22949 $startsh
22950 if test \$# -gt 0; then
22951         echo "\$@" >msg
22952 else
22953         cat >msg
22954 fi
22955 echo "*** WARNING:" >&4
22956 sed -e 's/^/*** /' <msg >&4
22957 echo "*** " >&4
22958 cat msg >>config.msg
22959 echo " " >>config.msg
22960 rm -f msg
22961 EOS
22962 chmod +x warn
22963 $eunicefix warn
22964
22965 : see if this is a termio system
22966 val="$undef"
22967 val2="$undef"
22968 val3="$undef"
22969 if $test `./findhdr termios.h`; then
22970     set tcsetattr i_termios
22971     eval $inlibc
22972     val3="$i_termios"
22973 fi
22974 echo " "
22975 case "$val3" in
22976     "$define") echo "You have POSIX termios.h... good!" >&4;;
22977     *)  if ./Cppsym pyr; then
22978             case "`$run /bin/universe`" in
22979                 ucb) if $test `./findhdr sgtty.h`; then
22980                         val2="$define"
22981                         echo "<sgtty.h> found." >&4
22982                     else
22983                         echo "System is pyramid with BSD universe."
22984                         ./warn "<sgtty.h> not found--you could have problems."
22985                     fi;;
22986                 *)  if $test `./findhdr termio.h`; then
22987                         val="$define"
22988                         echo "<termio.h> found." >&4
22989                     else
22990                         echo "System is pyramid with USG universe."
22991                         ./warn "<termio.h> not found--you could have problems."
22992                     fi;;
22993             esac
22994         elif ./usg; then
22995             if $test `./findhdr termio.h`; then
22996                 echo "<termio.h> found." >&4
22997                 val="$define"
22998             elif $test `./findhdr sgtty.h`; then
22999                 echo "<sgtty.h> found." >&4
23000                 val2="$define"
23001             else
23002                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23003             fi
23004         else
23005             if $test `./findhdr sgtty.h`; then
23006                 echo "<sgtty.h> found." >&4
23007                 val2="$define"
23008             elif $test `./findhdr termio.h`; then
23009                 echo "<termio.h> found." >&4
23010                 val="$define"
23011             else
23012                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23013             fi
23014         fi;;
23015 esac
23016 set i_termio; eval $setvar
23017 val=$val2; set i_sgtty; eval $setvar
23018 val=$val3; set i_termios; eval $setvar
23019
23020 : see if stdbool is available
23021 : we want a real compile instead of Inhdr because some Solaris systems
23022 : have stdbool.h, but it can only be used if the compiler indicates it
23023 : is sufficiently c99-compliant.
23024 echo " "
23025 $cat >try.c <<EOCP
23026 #include <stdio.h>
23027 #include <stdbool.h>
23028 int func(bool x)
23029 {
23030     return x ? 1 : 0;
23031 }
23032 int main(int argc, char **argv)
23033 {
23034     return func(0);
23035 }
23036 EOCP
23037 set try
23038 if eval $compile; then
23039         echo "<stdbool.h> found." >&4
23040         val="$define"
23041 else
23042         echo "<stdbool.h> NOT found." >&4
23043         val="$undef"
23044 fi
23045 $rm_try
23046 set i_stdbool
23047 eval $setvar
23048
23049 : see if stdint is available
23050 set stdint.h i_stdint
23051 eval $inhdr
23052
23053 : see if sys/access.h is available
23054 set sys/access.h i_sysaccess
23055 eval $inhdr
23056
23057 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23058 set sys/filio.h i_sysfilio
23059 eval $inhdr
23060 echo " "
23061 if $test `./findhdr sys/ioctl.h`; then
23062         val="$define"
23063         echo '<sys/ioctl.h> found.' >&4
23064 else
23065         val="$undef"
23066         if $test $i_sysfilio = "$define"; then
23067             echo '<sys/ioctl.h> NOT found.' >&4
23068         else
23069                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23070                 $test $i_termio = "$define" && xxx="termio.h"
23071                 $test $i_termios = "$define" && xxx="termios.h"
23072 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23073         fi
23074 fi
23075 set i_sysioctl
23076 eval $setvar
23077
23078 : see if socket ioctl defs are in sys/sockio.h
23079 echo " "
23080 xxx=`./findhdr sys/sockio.h`
23081 if $test "$xxx"; then
23082         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23083                 val="$define"
23084                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23085         else
23086                 val="$undef"
23087                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23088         fi
23089 else
23090         val="$undef"
23091         $cat <<EOM
23092 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23093 EOM
23094 fi
23095 set i_syssockio
23096 eval $setvar
23097
23098 : see if this is a syslog.h system
23099 set syslog.h i_syslog
23100 eval $inhdr
23101
23102 : see if this is a sys/mode.h system
23103 set sys/mode.h i_sysmode
23104 eval $inhdr
23105
23106 : see if there is a sys/poll.h file
23107 set sys/poll.h i_syspoll
23108 eval $inhdr
23109
23110 : see if sys/resource.h has to be included
23111 set sys/resource.h i_sysresrc
23112 eval $inhdr
23113
23114 : see if sys/security.h is available
23115 set sys/security.h i_syssecrt
23116 eval $inhdr
23117
23118 : see if this is a sys/statvfs.h system
23119 set sys/statvfs.h i_sysstatvfs
23120 eval $inhdr
23121
23122 : see if this is a sys/un.h system
23123 set sys/un.h i_sysun
23124 eval $inhdr
23125
23126 : see if this is a sys/utsname.h system
23127 set sys/utsname.h i_sysutsname
23128 eval $inhdr
23129
23130 : see if this is a syswait system
23131 set sys/wait.h i_syswait
23132 eval $inhdr
23133
23134 : see if this is a ustat.h system
23135 set ustat.h i_ustat
23136 eval $inhdr
23137
23138 : see if this is an utime system
23139 set utime.h i_utime
23140 eval $inhdr
23141
23142 : see if this is a vfork system
23143 case "$d_vfork" in
23144 "$define")
23145         set vfork.h i_vfork
23146         eval $inhdr
23147         ;;
23148 *)
23149         i_vfork="$undef"
23150         ;;
23151 esac
23152
23153 : see if wchar.h is present
23154 set wchar.h i_wchar
23155 eval $inhdr
23156
23157 : Check extensions
23158 echo " "
23159 echo "Looking for extensions..." >&4
23160 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23161 : contain old or inaccurate or duplicate values.
23162 nonxs_extensions=''
23163 xs_extensions=''
23164 : We do not use find because it might not be available.
23165 : We do not just use MANIFEST because the user may have dropped
23166 : some additional extensions into the source tree and expect them
23167 : to be built.
23168
23169 : Function to recursively find available extensions, ignoring DynaLoader
23170 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23171 : In 5.10.1 and later, extensions are stored in directories
23172 : like File-Glob instead of the older File/Glob/.
23173 find_extensions='
23174     for xxx in *; do
23175         case "$xxx" in
23176             DynaLoader|dynaload) ;;
23177             *)
23178             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23179             case "$this_ext" in
23180                 Scalar/List/Utils) this_ext="List/Util" ;;
23181                 PathTools)         this_ext="Cwd"       ;;
23182             esac;
23183             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23184             if $contains " $this_ext " "$tdir/$$.tmp"; then
23185                 echo >&4;
23186                 echo "Duplicate directories detected for extension $xxx" >&4;
23187                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23188                 case "$knowitall" in
23189                 "") dflt=y;;
23190                 *) dflt=n;;
23191                 esac;
23192                 . ../UU/myread;
23193                 case "$ans" in
23194                 n*|N*) ;;
23195                 *) echo >&4;
23196                     echo "Ok.  Stopping Configure." >&4;
23197                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23198                     exit 1;;
23199                 esac;
23200                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23201             fi;
23202             $ls -1 "$xxx" > "$tdir/$$.tmp";
23203             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23204                 xs_extensions="$xs_extensions $this_ext";
23205             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
23206                 xs_extensions="$xs_extensions $this_ext";
23207             elif $test -d "$xxx"; then
23208                 nonxs_extensions="$nonxs_extensions $this_ext";
23209             fi;
23210             $rm -f "$tdir/$$.tmp";
23211             ;;
23212         esac;
23213     done'
23214 tdir=`pwd`
23215 cd "$rsrc/cpan"
23216 set X
23217 shift
23218 eval $find_extensions
23219 cd "$rsrc/dist"
23220 set X
23221 shift
23222 eval $find_extensions
23223 cd "$rsrc/ext"
23224 set X
23225 shift
23226 eval $find_extensions
23227 set X $xs_extensions
23228 shift
23229 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23230 set X $nonxs_extensions
23231 shift
23232 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23233 cd "$tdir"
23234 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23235
23236 : Now see which are supported on this system.
23237 avail_ext=''
23238 for xxx in $xs_extensions ; do
23239         case "$xxx" in
23240         Amiga*)
23241                 case "$osname" in
23242                 amigaos) avail_ext="$avail_ext $xxx" ;;
23243                 esac
23244                 ;;
23245         DB_File|db_file)
23246                 case "$i_db" in
23247                 $define) avail_ext="$avail_ext $xxx" ;;
23248                 esac
23249                 ;;
23250         GDBM_File|gdbm_fil)
23251                 case "$i_gdbm" in
23252                 $define) avail_ext="$avail_ext $xxx" ;;
23253                 esac
23254                 ;;
23255         I18N/Langinfo|i18n_lan)
23256                 case "$i_langinfo$d_nl_langinfo" in
23257                 $define$define) avail_ext="$avail_ext $xxx" ;;
23258                 esac
23259                 ;;
23260         IPC/SysV|ipc/sysv)
23261                 : XXX Do we need a useipcsysv variable here
23262                 case "${d_msg}${d_sem}${d_shm}" in
23263                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23264                 esac
23265                 ;;
23266         NDBM_File|ndbm_fil)
23267                 case "$d_ndbm" in
23268                 $define)
23269                     case "$osname-$use64bitint" in
23270                     hpux-define)
23271                         case "$libs" in
23272                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23273                         esac
23274                         ;;
23275                     *) avail_ext="$avail_ext $xxx" ;;
23276                     esac
23277                     ;;
23278                 esac
23279                 ;;
23280         ODBM_File|odbm_fil)
23281                 case "${i_dbm}${i_rpcsvcdbm}" in
23282                 *"${define}"*)
23283                     case "$d_cplusplus" in
23284                     define) ;; # delete as a function name will not work
23285                     *)  case "$osname-$use64bitint" in
23286                         hpux-define)
23287                             case "$libs" in
23288                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23289                             esac
23290                             ;;
23291                         *) avail_ext="$avail_ext $xxx" ;;
23292                         esac
23293                         ;;
23294                     esac
23295                     ;;
23296                 esac
23297                 ;;
23298         Opcode|opcode)
23299                 case "$useopcode" in
23300                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23301                 esac
23302                 ;;
23303         POSIX|posix)
23304                 case "$useposix" in
23305                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23306                 esac
23307                 ;;
23308         Socket|socket)
23309                 case "$d_socket" in
23310                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23311                 esac
23312                 ;;
23313         Sys/Syslog|sys/syslog)
23314                 case $osname in
23315                         amigaos) ;; # not really very useful on AmigaOS
23316                         *)
23317                         : XXX syslog requires socket
23318                         case "$d_socket" in
23319                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
23320                         esac
23321                         ;;
23322                 esac
23323                 ;;
23324         Thread|thread)
23325                 case "$usethreads" in
23326                 true|$define|y)
23327                         case "$use5005threads" in
23328                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23329                         esac
23330                 esac
23331                 ;;
23332         threads|threads/shared)
23333                 # threads and threads::shared are special cases.
23334                 # To stop people from asking "Perl 5.8.0 was supposed
23335                 # to have this new fancy threads implementation but my
23336                 # perl doesn't have it" and from people trying to
23337                 # (re)install the threads module using CPAN.pm and
23338                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23339                 # the threads.pm and threads/shared.pm will always be
23340                 # there, croaking informatively ("you need to rebuild
23341                 # all of Perl with threads, sorry") when threads haven't
23342                 # been compiled in.
23343                 # --jhi
23344                 avail_ext="$avail_ext $xxx"
23345                 ;;
23346         VMS*)
23347                 ;;
23348         Win32*)
23349                 case "$osname" in
23350                 cygwin) avail_ext="$avail_ext $xxx" ;;
23351                 esac
23352                 ;;
23353         XS/APItest|xs/apitest)
23354                 # This is just for testing.  Skip it unless we have dynamic loading.
23355
23356                 case "$usedl" in
23357                 $define) avail_ext="$avail_ext $xxx" ;;
23358                 esac
23359                 ;;
23360         XS/Typemap|xs/typemap)
23361                 # This is just for testing.  Skip it unless we have dynamic loading.
23362                 case "$usedl" in
23363                 $define) avail_ext="$avail_ext $xxx" ;;
23364                 esac
23365                 ;;
23366         *)      avail_ext="$avail_ext $xxx"
23367                 ;;
23368         esac
23369 done
23370
23371 set X $avail_ext
23372 shift
23373 avail_ext="$*"
23374
23375 case "$onlyextensions" in
23376 '') ;;
23377 *)  keepextensions=''
23378     echo "You have requested that only certain extensions be included..." >&4
23379     for i in $onlyextensions; do
23380         case " $avail_ext " in
23381         *" $i "*)
23382             echo "Keeping extension $i."
23383             keepextensions="$keepextensions $i"
23384             ;;
23385         *) echo "Ignoring extension $i." ;;
23386         esac
23387     done
23388     avail_ext="$keepextensions"
23389     ;;
23390 esac
23391
23392 case "$noextensions" in
23393 '') ;;
23394 *)  keepextensions=''
23395     echo "You have requested that certain extensions be ignored..." >&4
23396     for i in $avail_ext; do
23397         case " $noextensions " in
23398         *" $i "*) echo "Ignoring extension $i." ;;
23399         *) echo "Keeping extension $i.";
23400            keepextensions="$keepextensions $i"
23401            ;;
23402         esac
23403     done
23404     avail_ext="$keepextensions"
23405     ;;
23406 esac
23407
23408 : Now see which nonxs extensions are supported on this system.
23409 : For now assume all are.
23410 nonxs_ext=''
23411 for xxx in $nonxs_extensions ; do
23412         case "$xxx" in
23413         VMS*)
23414                 ;;
23415         *)      nonxs_ext="$nonxs_ext $xxx"
23416                 ;;
23417         esac
23418 done
23419
23420 set X $nonxs_ext
23421 shift
23422 nonxs_ext="$*"
23423
23424 case $usedl in
23425 $define)
23426         $cat <<EOM
23427 A number of extensions are supplied with $package.  You may choose to
23428 compile these extensions for dynamic loading (the default), compile
23429 them into the $package executable (static loading), or not include
23430 them at all.  Answer "none" to include no extensions.
23431 Note that DynaLoader is always built and need not be mentioned here.
23432
23433 EOM
23434         case "$dynamic_ext" in
23435         '')
23436                 : Exclude those listed in static_ext
23437                 dflt=''
23438                 for xxx in $avail_ext; do
23439                         case " $static_ext " in
23440                         *" $xxx "*) ;;
23441                         *) dflt="$dflt $xxx" ;;
23442                         esac
23443                 done
23444                 set X $dflt
23445                 shift
23446                 dflt="$*"
23447                 ;;
23448         *)      dflt="$dynamic_ext"
23449                 # Perhaps we are reusing an old out-of-date config.sh.
23450                 case "$hint" in
23451                 previous)
23452                         if test X"$dynamic_ext" != X"$avail_ext"; then
23453                                 $cat <<EOM
23454 NOTICE:  Your previous config.sh list may be incorrect.
23455 The extensions now available to you are
23456         ${avail_ext}
23457 but the default list from your previous config.sh is
23458         ${dynamic_ext}
23459
23460 EOM
23461                         fi
23462                         ;;
23463                 esac
23464                 ;;
23465         esac
23466         case "$dflt" in
23467         '')     dflt=none;;
23468         esac
23469         rp="What extensions do you wish to load dynamically?"
23470         . ./myread
23471         case "$ans" in
23472         none) dynamic_ext=' ' ;;
23473         *) dynamic_ext="$ans" ;;
23474         esac
23475
23476         case "$static_ext" in
23477         '')
23478                 : Exclude those already listed in dynamic linking
23479                 dflt=''
23480                 for xxx in $avail_ext; do
23481                         case " $dynamic_ext " in
23482                         *" $xxx "*) ;;
23483                         *) dflt="$dflt $xxx" ;;
23484                         esac
23485                 done
23486                 set X $dflt
23487                 shift
23488                 dflt="$*"
23489                 ;;
23490         *)  dflt="$static_ext"
23491                 ;;
23492         esac
23493
23494         case "$dflt" in
23495         '')     dflt=none;;
23496         esac
23497         rp="What extensions do you wish to load statically?"
23498         . ./myread
23499         case "$ans" in
23500         none) static_ext=' ' ;;
23501         *) static_ext="$ans" ;;
23502         esac
23503         ;;
23504 *)
23505         $cat <<EOM
23506 A number of extensions are supplied with $package.  Answer "none"
23507 to include no extensions.
23508 Note that DynaLoader is always built and need not be mentioned here.
23509
23510 EOM
23511         case "$static_ext" in
23512         '') dflt="$avail_ext" ;;
23513         *)      dflt="$static_ext"
23514                 # Perhaps we are reusing an old out-of-date config.sh.
23515                 case "$hint" in
23516                 previous)
23517                         if test X"$static_ext" != X"$avail_ext"; then
23518                                 $cat <<EOM
23519 NOTICE:  Your previous config.sh list may be incorrect.
23520 The extensions now available to you are
23521         ${avail_ext}
23522 but the default list from your previous config.sh is
23523         ${static_ext}
23524
23525 EOM
23526                         fi
23527                         ;;
23528                 esac
23529                 ;;
23530         esac
23531         : Exclude those that are not xs extensions
23532         case "$dflt" in
23533         '')     dflt=none;;
23534         esac
23535         rp="What extensions do you wish to include?"
23536         . ./myread
23537         case "$ans" in
23538         none) static_ext=' ' ;;
23539         *) static_ext="$ans" ;;
23540         esac
23541         ;;
23542 esac
23543 #
23544 # Encode is a special case.  If we are building Encode as a static
23545 # extension, we need to explicitly list its subextensions as well.
23546 # For other nested extensions, this is handled automatically by
23547 # the appropriate Makefile.PL.
23548 case " $static_ext " in
23549         *" Encode "*) # Add the subextensions of Encode
23550         cd "$rsrc/cpan"
23551         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23552                 static_ext="$static_ext Encode/$xxx"
23553                 known_extensions="$known_extensions Encode/$xxx"
23554         done
23555         cd "$tdir"
23556         ;;
23557 esac
23558
23559 set X $dynamic_ext $static_ext $nonxs_ext
23560 shift
23561 extensions="$*"
23562
23563 # Sanity check:  We require an extension suitable for use with
23564 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23565 # should show up as failures in the test suite, but it's helpful to
23566 # catch them now.) The 'extensions' list is normally sorted
23567 # alphabetically, so we need to accept either
23568 #    DB_File ... Fcntl ... IO  ....
23569 # or something like
23570 #    Fcntl ... NDBM_File ... IO  ....
23571 case " $extensions"  in
23572 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
23573 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23574 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23575 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23576    echo "WARNING: The Perl you are building will be quite crippled." >& 4
23577    ;;
23578 esac
23579
23580 : Remove libraries needed only for extensions
23581 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23582 : The exception is SunOS 4.x, which needs them.
23583 case "${osname}X${osvers}" in
23584 sunos*X4*)
23585     perllibs="$libs"
23586     ;;
23587 *) case "$usedl" in
23588     $define|true|[yY]*)
23589             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23590             shift
23591             perllibs="$*"
23592             ;;
23593     *)  perllibs="$libs"
23594             ;;
23595     esac
23596     ;;
23597 esac
23598
23599 : Remove build directory name from cppstdin so it can be used from
23600 : either the present location or the final installed location.
23601 echo " "
23602 : Get out of the UU directory to get correct path name.
23603 cd ..
23604 case "$cppstdin" in
23605 `pwd`/cppstdin)
23606         echo "Stripping down cppstdin path name"
23607         cppstdin=cppstdin
23608         ;;
23609 esac
23610 cd UU
23611
23612 : end of configuration questions
23613 echo " "
23614 echo "End of configuration questions."
23615 echo " "
23616
23617 : back to where it started
23618 if test -d ../UU; then
23619         cd ..
23620 fi
23621
23622 : configuration may be unconditionally patched via a 'config.arch' file
23623 if $test -f config.arch; then
23624         echo "I see a config.arch file, loading it." >&4
23625         . ./config.arch
23626 fi
23627
23628 : configuration may be patched via a 'config.over' file
23629 if $test -f config.over; then
23630         echo " "
23631         dflt=y
23632         rp='I see a config.over file.  Do you wish to load it?'
23633         . UU/myread
23634         case "$ans" in
23635         n*) echo "OK, I'll ignore it.";;
23636         *)      . ./config.over
23637                 echo "Configuration override changes have been loaded."
23638                 ;;
23639         esac
23640 fi
23641
23642 : in case they want portability, strip down executable paths
23643 case "$d_portable" in
23644 "$define")
23645         echo " "
23646         echo "Stripping down executable paths..." >&4
23647         for file in $loclist $trylist; do
23648                 eval temp=\$$file
23649                 eval $file=`basename $temp`
23650         done
23651         ;;
23652 esac
23653
23654 : create config.sh file
23655 echo " "
23656 echo "Creating config.sh..." >&4
23657 $spitshell <<EOT >config.sh
23658 $startsh
23659 #
23660 # This file was produced by running the Configure script. It holds all the
23661 # definitions figured out by Configure. Should you modify one of these values,
23662 # do not forget to propagate your changes by running "Configure -der". You may
23663 # instead choose to run each of the .SH files by yourself, or "Configure -S".
23664 #
23665
23666 # Package name      : $package
23667 # Source directory  : $src
23668 # Configuration time: $cf_time
23669 # Configured by     : $cf_by
23670 # Target system     : $myuname
23671
23672 EOT
23673 : Add in command line options if available
23674 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23675
23676 $spitshell <<EOT >>config.sh
23677
23678 Author='$Author'
23679 Date='$Date'
23680 Header='$Header'
23681 Id='$Id'
23682 Locker='$Locker'
23683 Log='$Log'
23684 RCSfile='$RCSfile'
23685 Revision='$Revision'
23686 Source='$Source'
23687 State='$State'
23688 _a='$_a'
23689 _exe='$_exe'
23690 _o='$_o'
23691 afs='$afs'
23692 afsroot='$afsroot'
23693 alignbytes='$alignbytes'
23694 aphostname='$aphostname'
23695 api_revision='$api_revision'
23696 api_subversion='$api_subversion'
23697 api_version='$api_version'
23698 api_versionstring='$api_versionstring'
23699 ar='$ar'
23700 archlib='$archlib'
23701 archlibexp='$archlibexp'
23702 archname64='$archname64'
23703 archname='$archname'
23704 archobjs='$archobjs'
23705 asctime_r_proto='$asctime_r_proto'
23706 awk='$awk'
23707 baserev='$baserev'
23708 bash='$bash'
23709 bin='$bin'
23710 bin_ELF='$bin_ELF'
23711 binexp='$binexp'
23712 bison='$bison'
23713 byacc='$byacc'
23714 byteorder='$byteorder'
23715 c='$c'
23716 castflags='$castflags'
23717 cat='$cat'
23718 cc='$cc'
23719 cccdlflags='$cccdlflags'
23720 ccdlflags='$ccdlflags'
23721 ccflags='$ccflags'
23722 ccflags_uselargefiles='$ccflags_uselargefiles'
23723 ccname='$ccname'
23724 ccsymbols='$ccsymbols'
23725 ccversion='$ccversion'
23726 cf_by='$cf_by'
23727 cf_email='$cf_email'
23728 cf_time='$cf_time'
23729 charbits='$charbits'
23730 charsize='$charsize'
23731 chgrp='$chgrp'
23732 chmod='$chmod'
23733 chown='$chown'
23734 clocktype='$clocktype'
23735 comm='$comm'
23736 compress='$compress'
23737 contains='$contains'
23738 cp='$cp'
23739 cpio='$cpio'
23740 cpp='$cpp'
23741 cpp_stuff='$cpp_stuff'
23742 cppccsymbols='$cppccsymbols'
23743 cppflags='$cppflags'
23744 cpplast='$cpplast'
23745 cppminus='$cppminus'
23746 cpprun='$cpprun'
23747 cppstdin='$cppstdin'
23748 cppsymbols='$cppsymbols'
23749 crypt_r_proto='$crypt_r_proto'
23750 cryptlib='$cryptlib'
23751 csh='$csh'
23752 ctermid_r_proto='$ctermid_r_proto'
23753 ctime_r_proto='$ctime_r_proto'
23754 d_Gconvert='$d_Gconvert'
23755 d_PRIEUldbl='$d_PRIEUldbl'
23756 d_PRIFUldbl='$d_PRIFUldbl'
23757 d_PRIGUldbl='$d_PRIGUldbl'
23758 d_PRIXU64='$d_PRIXU64'
23759 d_PRId64='$d_PRId64'
23760 d_PRIeldbl='$d_PRIeldbl'
23761 d_PRIfldbl='$d_PRIfldbl'
23762 d_PRIgldbl='$d_PRIgldbl'
23763 d_PRIi64='$d_PRIi64'
23764 d_PRIo64='$d_PRIo64'
23765 d_PRIu64='$d_PRIu64'
23766 d_PRIx64='$d_PRIx64'
23767 d_SCNfldbl='$d_SCNfldbl'
23768 d__fwalk='$d__fwalk'
23769 d_access='$d_access'
23770 d_accessx='$d_accessx'
23771 d_acosh='$d_acosh'
23772 d_aintl='$d_aintl'
23773 d_alarm='$d_alarm'
23774 d_archlib='$d_archlib'
23775 d_asctime64='$d_asctime64'
23776 d_asctime_r='$d_asctime_r'
23777 d_asinh='$d_asinh'
23778 d_atanh='$d_atanh'
23779 d_atolf='$d_atolf'
23780 d_atoll='$d_atoll'
23781 d_attribute_deprecated='$d_attribute_deprecated'
23782 d_attribute_format='$d_attribute_format'
23783 d_attribute_malloc='$d_attribute_malloc'
23784 d_attribute_nonnull='$d_attribute_nonnull'
23785 d_attribute_noreturn='$d_attribute_noreturn'
23786 d_attribute_pure='$d_attribute_pure'
23787 d_attribute_unused='$d_attribute_unused'
23788 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
23789 d_backtrace='$d_backtrace'
23790 d_bsd='$d_bsd'
23791 d_bsdgetpgrp='$d_bsdgetpgrp'
23792 d_bsdsetpgrp='$d_bsdsetpgrp'
23793 d_builtin_add_overflow='$d_builtin_add_overflow'
23794 d_builtin_choose_expr='$d_builtin_choose_expr'
23795 d_builtin_expect='$d_builtin_expect'
23796 d_builtin_mul_overflow='$d_builtin_mul_overflow'
23797 d_builtin_sub_overflow='$d_builtin_sub_overflow'
23798 d_c99_variadic_macros='$d_c99_variadic_macros'
23799 d_casti32='$d_casti32'
23800 d_castneg='$d_castneg'
23801 d_cbrt='$d_cbrt'
23802 d_chown='$d_chown'
23803 d_chroot='$d_chroot'
23804 d_chsize='$d_chsize'
23805 d_class='$d_class'
23806 d_clearenv='$d_clearenv'
23807 d_closedir='$d_closedir'
23808 d_cmsghdr_s='$d_cmsghdr_s'
23809 d_const='$d_const'
23810 d_copysign='$d_copysign'
23811 d_copysignl='$d_copysignl'
23812 d_cplusplus='$d_cplusplus'
23813 d_crypt='$d_crypt'
23814 d_crypt_r='$d_crypt_r'
23815 d_csh='$d_csh'
23816 d_ctermid='$d_ctermid'
23817 d_ctermid_r='$d_ctermid_r'
23818 d_ctime64='$d_ctime64'
23819 d_ctime_r='$d_ctime_r'
23820 d_cuserid='$d_cuserid'
23821 d_dbminitproto='$d_dbminitproto'
23822 d_difftime64='$d_difftime64'
23823 d_difftime='$d_difftime'
23824 d_dir_dd_fd='$d_dir_dd_fd'
23825 d_dirfd='$d_dirfd'
23826 d_dirnamlen='$d_dirnamlen'
23827 d_dladdr='$d_dladdr'
23828 d_dlerror='$d_dlerror'
23829 d_dlopen='$d_dlopen'
23830 d_dlsymun='$d_dlsymun'
23831 d_dosuid='$d_dosuid'
23832 d_double_has_inf='$d_double_has_inf'
23833 d_double_has_nan='$d_double_has_nan'
23834 d_double_has_negative_zero='$d_double_has_negative_zero'
23835 d_double_has_subnormals='$d_double_has_subnormals'
23836 d_double_style_cray='$d_double_style_cray'
23837 d_double_style_ibm='$d_double_style_ibm'
23838 d_double_style_ieee='$d_double_style_ieee'
23839 d_double_style_vax='$d_double_style_vax'
23840 d_drand48_r='$d_drand48_r'
23841 d_drand48proto='$d_drand48proto'
23842 d_dup2='$d_dup2'
23843 d_duplocale='$d_duplocale'
23844 d_eaccess='$d_eaccess'
23845 d_endgrent='$d_endgrent'
23846 d_endgrent_r='$d_endgrent_r'
23847 d_endhent='$d_endhent'
23848 d_endhostent_r='$d_endhostent_r'
23849 d_endnent='$d_endnent'
23850 d_endnetent_r='$d_endnetent_r'
23851 d_endpent='$d_endpent'
23852 d_endprotoent_r='$d_endprotoent_r'
23853 d_endpwent='$d_endpwent'
23854 d_endpwent_r='$d_endpwent_r'
23855 d_endsent='$d_endsent'
23856 d_endservent_r='$d_endservent_r'
23857 d_eofnblk='$d_eofnblk'
23858 d_erf='$d_erf'
23859 d_erfc='$d_erfc'
23860 d_eunice='$d_eunice'
23861 d_exp2='$d_exp2'
23862 d_expm1='$d_expm1'
23863 d_faststdio='$d_faststdio'
23864 d_fchdir='$d_fchdir'
23865 d_fchmod='$d_fchmod'
23866 d_fchmodat='$d_fchmodat'
23867 d_fchown='$d_fchown'
23868 d_fcntl='$d_fcntl'
23869 d_fcntl_can_lock='$d_fcntl_can_lock'
23870 d_fd_macros='$d_fd_macros'
23871 d_fd_set='$d_fd_set'
23872 d_fdclose='$d_fdclose'
23873 d_fdim='$d_fdim'
23874 d_fds_bits='$d_fds_bits'
23875 d_fegetround='$d_fegetround'
23876 d_fgetpos='$d_fgetpos'
23877 d_finite='$d_finite'
23878 d_finitel='$d_finitel'
23879 d_flexfnam='$d_flexfnam'
23880 d_flock='$d_flock'
23881 d_flockproto='$d_flockproto'
23882 d_fma='$d_fma'
23883 d_fmax='$d_fmax'
23884 d_fmin='$d_fmin'
23885 d_fork='$d_fork'
23886 d_fp_class='$d_fp_class'
23887 d_fp_classify='$d_fp_classify'
23888 d_fp_classl='$d_fp_classl'
23889 d_fpathconf='$d_fpathconf'
23890 d_fpclass='$d_fpclass'
23891 d_fpclassify='$d_fpclassify'
23892 d_fpclassl='$d_fpclassl'
23893 d_fpgetround='$d_fpgetround'
23894 d_fpos64_t='$d_fpos64_t'
23895 d_freelocale='$d_freelocale'
23896 d_frexpl='$d_frexpl'
23897 d_fs_data_s='$d_fs_data_s'
23898 d_fseeko='$d_fseeko'
23899 d_fsetpos='$d_fsetpos'
23900 d_fstatfs='$d_fstatfs'
23901 d_fstatvfs='$d_fstatvfs'
23902 d_fsync='$d_fsync'
23903 d_ftello='$d_ftello'
23904 d_ftime='$d_ftime'
23905 d_futimes='$d_futimes'
23906 d_gai_strerror='$d_gai_strerror'
23907 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23908 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
23909 d_getaddrinfo='$d_getaddrinfo'
23910 d_getcwd='$d_getcwd'
23911 d_getespwnam='$d_getespwnam'
23912 d_getfsstat='$d_getfsstat'
23913 d_getgrent='$d_getgrent'
23914 d_getgrent_r='$d_getgrent_r'
23915 d_getgrgid_r='$d_getgrgid_r'
23916 d_getgrnam_r='$d_getgrnam_r'
23917 d_getgrps='$d_getgrps'
23918 d_gethbyaddr='$d_gethbyaddr'
23919 d_gethbyname='$d_gethbyname'
23920 d_gethent='$d_gethent'
23921 d_gethname='$d_gethname'
23922 d_gethostbyaddr_r='$d_gethostbyaddr_r'
23923 d_gethostbyname_r='$d_gethostbyname_r'
23924 d_gethostent_r='$d_gethostent_r'
23925 d_gethostprotos='$d_gethostprotos'
23926 d_getitimer='$d_getitimer'
23927 d_getlogin='$d_getlogin'
23928 d_getlogin_r='$d_getlogin_r'
23929 d_getmnt='$d_getmnt'
23930 d_getmntent='$d_getmntent'
23931 d_getnameinfo='$d_getnameinfo'
23932 d_getnbyaddr='$d_getnbyaddr'
23933 d_getnbyname='$d_getnbyname'
23934 d_getnent='$d_getnent'
23935 d_getnetbyaddr_r='$d_getnetbyaddr_r'
23936 d_getnetbyname_r='$d_getnetbyname_r'
23937 d_getnetent_r='$d_getnetent_r'
23938 d_getnetprotos='$d_getnetprotos'
23939 d_getpagsz='$d_getpagsz'
23940 d_getpbyname='$d_getpbyname'
23941 d_getpbynumber='$d_getpbynumber'
23942 d_getpent='$d_getpent'
23943 d_getpgid='$d_getpgid'
23944 d_getpgrp2='$d_getpgrp2'
23945 d_getpgrp='$d_getpgrp'
23946 d_getppid='$d_getppid'
23947 d_getprior='$d_getprior'
23948 d_getprotobyname_r='$d_getprotobyname_r'
23949 d_getprotobynumber_r='$d_getprotobynumber_r'
23950 d_getprotoent_r='$d_getprotoent_r'
23951 d_getprotoprotos='$d_getprotoprotos'
23952 d_getprpwnam='$d_getprpwnam'
23953 d_getpwent='$d_getpwent'
23954 d_getpwent_r='$d_getpwent_r'
23955 d_getpwnam_r='$d_getpwnam_r'
23956 d_getpwuid_r='$d_getpwuid_r'
23957 d_getsbyname='$d_getsbyname'
23958 d_getsbyport='$d_getsbyport'
23959 d_getsent='$d_getsent'
23960 d_getservbyname_r='$d_getservbyname_r'
23961 d_getservbyport_r='$d_getservbyport_r'
23962 d_getservent_r='$d_getservent_r'
23963 d_getservprotos='$d_getservprotos'
23964 d_getspnam='$d_getspnam'
23965 d_getspnam_r='$d_getspnam_r'
23966 d_gettimeod='$d_gettimeod'
23967 d_gmtime64='$d_gmtime64'
23968 d_gmtime_r='$d_gmtime_r'
23969 d_gnulibc='$d_gnulibc'
23970 d_grpasswd='$d_grpasswd'
23971 d_hasmntopt='$d_hasmntopt'
23972 d_htonl='$d_htonl'
23973 d_hypot='$d_hypot'
23974 d_ilogb='$d_ilogb'
23975 d_ilogbl='$d_ilogbl'
23976 d_inc_version_list='$d_inc_version_list'
23977 d_inetaton='$d_inetaton'
23978 d_inetntop='$d_inetntop'
23979 d_inetpton='$d_inetpton'
23980 d_int64_t='$d_int64_t'
23981 d_ip_mreq='$d_ip_mreq'
23982 d_ip_mreq_source='$d_ip_mreq_source'
23983 d_ipv6_mreq='$d_ipv6_mreq'
23984 d_ipv6_mreq_source='$d_ipv6_mreq_source'
23985 d_isascii='$d_isascii'
23986 d_isblank='$d_isblank'
23987 d_isfinite='$d_isfinite'
23988 d_isfinitel='$d_isfinitel'
23989 d_isinf='$d_isinf'
23990 d_isinfl='$d_isinfl'
23991 d_isless='$d_isless'
23992 d_isnan='$d_isnan'
23993 d_isnanl='$d_isnanl'
23994 d_isnormal='$d_isnormal'
23995 d_j0='$d_j0'
23996 d_j0l='$d_j0l'
23997 d_killpg='$d_killpg'
23998 d_lc_monetary_2008='$d_lc_monetary_2008'
23999 d_lchown='$d_lchown'
24000 d_ldbl_dig='$d_ldbl_dig'
24001 d_ldexpl='$d_ldexpl'
24002 d_lgamma='$d_lgamma'
24003 d_lgamma_r='$d_lgamma_r'
24004 d_libm_lib_version='$d_libm_lib_version'
24005 d_libname_unique='$d_libname_unique'
24006 d_link='$d_link'
24007 d_linkat='$d_linkat'
24008 d_llrint='$d_llrint'
24009 d_llrintl='$d_llrintl'
24010 d_llround='$d_llround'
24011 d_llroundl='$d_llroundl'
24012 d_localeconv_l='$d_localeconv_l'
24013 d_localtime64='$d_localtime64'
24014 d_localtime_r='$d_localtime_r'
24015 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24016 d_locconv='$d_locconv'
24017 d_lockf='$d_lockf'
24018 d_log1p='$d_log1p'
24019 d_log2='$d_log2'
24020 d_logb='$d_logb'
24021 d_long_double_style_ieee='$d_long_double_style_ieee'
24022 d_long_double_style_ieee_doubledouble='$d_long_double_style_ieee_doubledouble'
24023 d_long_double_style_ieee_extended='$d_long_double_style_ieee_extended'
24024 d_long_double_style_ieee_std='$d_long_double_style_ieee_std'
24025 d_long_double_style_vax='$d_long_double_style_vax'
24026 d_longdbl='$d_longdbl'
24027 d_longlong='$d_longlong'
24028 d_lrint='$d_lrint'
24029 d_lrintl='$d_lrintl'
24030 d_lround='$d_lround'
24031 d_lroundl='$d_lroundl'
24032 d_lseekproto='$d_lseekproto'
24033 d_lstat='$d_lstat'
24034 d_madvise='$d_madvise'
24035 d_malloc_good_size='$d_malloc_good_size'
24036 d_malloc_size='$d_malloc_size'
24037 d_mblen='$d_mblen'
24038 d_mbrlen='$d_mbrlen'
24039 d_mbrtowc='$d_mbrtowc'
24040 d_mbstowcs='$d_mbstowcs'
24041 d_mbtowc='$d_mbtowc'
24042 d_memmem='$d_memmem'
24043 d_memrchr='$d_memrchr'
24044 d_mkdir='$d_mkdir'
24045 d_mkdtemp='$d_mkdtemp'
24046 d_mkfifo='$d_mkfifo'
24047 d_mkstemp='$d_mkstemp'
24048 d_mkstemps='$d_mkstemps'
24049 d_mktime64='$d_mktime64'
24050 d_mktime='$d_mktime'
24051 d_mmap='$d_mmap'
24052 d_modfl='$d_modfl'
24053 d_modflproto='$d_modflproto'
24054 d_mprotect='$d_mprotect'
24055 d_msg='$d_msg'
24056 d_msg_ctrunc='$d_msg_ctrunc'
24057 d_msg_dontroute='$d_msg_dontroute'
24058 d_msg_oob='$d_msg_oob'
24059 d_msg_peek='$d_msg_peek'
24060 d_msg_proxy='$d_msg_proxy'
24061 d_msgctl='$d_msgctl'
24062 d_msgget='$d_msgget'
24063 d_msghdr_s='$d_msghdr_s'
24064 d_msgrcv='$d_msgrcv'
24065 d_msgsnd='$d_msgsnd'
24066 d_msync='$d_msync'
24067 d_munmap='$d_munmap'
24068 d_mymalloc='$d_mymalloc'
24069 d_nan='$d_nan'
24070 d_nanosleep='$d_nanosleep'
24071 d_ndbm='$d_ndbm'
24072 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24073 d_nearbyint='$d_nearbyint'
24074 d_newlocale='$d_newlocale'
24075 d_nextafter='$d_nextafter'
24076 d_nexttoward='$d_nexttoward'
24077 d_nice='$d_nice'
24078 d_nl_langinfo='$d_nl_langinfo'
24079 d_nv_preserves_uv='$d_nv_preserves_uv'
24080 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24081 d_off64_t='$d_off64_t'
24082 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24083 d_oldpthreads='$d_oldpthreads'
24084 d_oldsock='$d_oldsock'
24085 d_open3='$d_open3'
24086 d_openat='$d_openat'
24087 d_pathconf='$d_pathconf'
24088 d_pause='$d_pause'
24089 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24090 d_phostname='$d_phostname'
24091 d_pipe='$d_pipe'
24092 d_poll='$d_poll'
24093 d_portable='$d_portable'
24094 d_prctl='$d_prctl'
24095 d_prctl_set_name='$d_prctl_set_name'
24096 d_printf_format_null='$d_printf_format_null'
24097 d_procselfexe='$d_procselfexe'
24098 d_pseudofork='$d_pseudofork'
24099 d_pthread_atfork='$d_pthread_atfork'
24100 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24101 d_pthread_yield='$d_pthread_yield'
24102 d_ptrdiff_t='$d_ptrdiff_t'
24103 d_pwage='$d_pwage'
24104 d_pwchange='$d_pwchange'
24105 d_pwclass='$d_pwclass'
24106 d_pwcomment='$d_pwcomment'
24107 d_pwexpire='$d_pwexpire'
24108 d_pwgecos='$d_pwgecos'
24109 d_pwpasswd='$d_pwpasswd'
24110 d_pwquota='$d_pwquota'
24111 d_qgcvt='$d_qgcvt'
24112 d_quad='$d_quad'
24113 d_querylocale='$d_querylocale'
24114 d_random_r='$d_random_r'
24115 d_re_comp='$d_re_comp'
24116 d_readdir64_r='$d_readdir64_r'
24117 d_readdir='$d_readdir'
24118 d_readdir_r='$d_readdir_r'
24119 d_readlink='$d_readlink'
24120 d_readv='$d_readv'
24121 d_recvmsg='$d_recvmsg'
24122 d_regcmp='$d_regcmp'
24123 d_regcomp='$d_regcomp'
24124 d_remainder='$d_remainder'
24125 d_remquo='$d_remquo'
24126 d_rename='$d_rename'
24127 d_renameat='$d_renameat'
24128 d_rewinddir='$d_rewinddir'
24129 d_rint='$d_rint'
24130 d_rmdir='$d_rmdir'
24131 d_round='$d_round'
24132 d_sbrkproto='$d_sbrkproto'
24133 d_scalbn='$d_scalbn'
24134 d_scalbnl='$d_scalbnl'
24135 d_sched_yield='$d_sched_yield'
24136 d_scm_rights='$d_scm_rights'
24137 d_seekdir='$d_seekdir'
24138 d_select='$d_select'
24139 d_sem='$d_sem'
24140 d_semctl='$d_semctl'
24141 d_semctl_semid_ds='$d_semctl_semid_ds'
24142 d_semctl_semun='$d_semctl_semun'
24143 d_semget='$d_semget'
24144 d_semop='$d_semop'
24145 d_sendmsg='$d_sendmsg'
24146 d_setegid='$d_setegid'
24147 d_seteuid='$d_seteuid'
24148 d_setgrent='$d_setgrent'
24149 d_setgrent_r='$d_setgrent_r'
24150 d_setgrps='$d_setgrps'
24151 d_sethent='$d_sethent'
24152 d_sethostent_r='$d_sethostent_r'
24153 d_setitimer='$d_setitimer'
24154 d_setlinebuf='$d_setlinebuf'
24155 d_setlocale='$d_setlocale'
24156 d_setlocale_r='$d_setlocale_r'
24157 d_setnent='$d_setnent'
24158 d_setnetent_r='$d_setnetent_r'
24159 d_setpent='$d_setpent'
24160 d_setpgid='$d_setpgid'
24161 d_setpgrp2='$d_setpgrp2'
24162 d_setpgrp='$d_setpgrp'
24163 d_setprior='$d_setprior'
24164 d_setproctitle='$d_setproctitle'
24165 d_setprotoent_r='$d_setprotoent_r'
24166 d_setpwent='$d_setpwent'
24167 d_setpwent_r='$d_setpwent_r'
24168 d_setregid='$d_setregid'
24169 d_setresgid='$d_setresgid'
24170 d_setresuid='$d_setresuid'
24171 d_setreuid='$d_setreuid'
24172 d_setrgid='$d_setrgid'
24173 d_setruid='$d_setruid'
24174 d_setsent='$d_setsent'
24175 d_setservent_r='$d_setservent_r'
24176 d_setsid='$d_setsid'
24177 d_setvbuf='$d_setvbuf'
24178 d_shm='$d_shm'
24179 d_shmat='$d_shmat'
24180 d_shmatprototype='$d_shmatprototype'
24181 d_shmctl='$d_shmctl'
24182 d_shmdt='$d_shmdt'
24183 d_shmget='$d_shmget'
24184 d_sigaction='$d_sigaction'
24185 d_siginfo_si_addr='$d_siginfo_si_addr'
24186 d_siginfo_si_band='$d_siginfo_si_band'
24187 d_siginfo_si_errno='$d_siginfo_si_errno'
24188 d_siginfo_si_fd='$d_siginfo_si_fd'
24189 d_siginfo_si_pid='$d_siginfo_si_pid'
24190 d_siginfo_si_status='$d_siginfo_si_status'
24191 d_siginfo_si_uid='$d_siginfo_si_uid'
24192 d_siginfo_si_value='$d_siginfo_si_value'
24193 d_signbit='$d_signbit'
24194 d_sigprocmask='$d_sigprocmask'
24195 d_sigsetjmp='$d_sigsetjmp'
24196 d_sin6_scope_id='$d_sin6_scope_id'
24197 d_sitearch='$d_sitearch'
24198 d_snprintf='$d_snprintf'
24199 d_sockaddr_in6='$d_sockaddr_in6'
24200 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24201 d_sockatmark='$d_sockatmark'
24202 d_sockatmarkproto='$d_sockatmarkproto'
24203 d_socket='$d_socket'
24204 d_socklen_t='$d_socklen_t'
24205 d_sockpair='$d_sockpair'
24206 d_socks5_init='$d_socks5_init'
24207 d_sqrtl='$d_sqrtl'
24208 d_srand48_r='$d_srand48_r'
24209 d_srandom_r='$d_srandom_r'
24210 d_sresgproto='$d_sresgproto'
24211 d_sresuproto='$d_sresuproto'
24212 d_stat='$d_stat'
24213 d_statblks='$d_statblks'
24214 d_statfs_f_flags='$d_statfs_f_flags'
24215 d_statfs_s='$d_statfs_s'
24216 d_static_inline='$d_static_inline'
24217 d_statvfs='$d_statvfs'
24218 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24219 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24220 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24221 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24222 d_stdio_stream_array='$d_stdio_stream_array'
24223 d_stdiobase='$d_stdiobase'
24224 d_stdstdio='$d_stdstdio'
24225 d_strcoll='$d_strcoll'
24226 d_strerror_l='$d_strerror_l'
24227 d_strerror_r='$d_strerror_r'
24228 d_strftime='$d_strftime'
24229 d_strlcat='$d_strlcat'
24230 d_strlcpy='$d_strlcpy'
24231 d_strnlen='$d_strnlen'
24232 d_strtod='$d_strtod'
24233 d_strtol='$d_strtol'
24234 d_strtold='$d_strtold'
24235 d_strtold_l='$d_strtold_l'
24236 d_strtoll='$d_strtoll'
24237 d_strtoq='$d_strtoq'
24238 d_strtoul='$d_strtoul'
24239 d_strtoull='$d_strtoull'
24240 d_strtouq='$d_strtouq'
24241 d_strxfrm='$d_strxfrm'
24242 d_suidsafe='$d_suidsafe'
24243 d_symlink='$d_symlink'
24244 d_syscall='$d_syscall'
24245 d_syscallproto='$d_syscallproto'
24246 d_sysconf='$d_sysconf'
24247 d_sysernlst='$d_sysernlst'
24248 d_syserrlst='$d_syserrlst'
24249 d_system='$d_system'
24250 d_tcgetpgrp='$d_tcgetpgrp'
24251 d_tcsetpgrp='$d_tcsetpgrp'
24252 d_telldir='$d_telldir'
24253 d_telldirproto='$d_telldirproto'
24254 d_tgamma='$d_tgamma'
24255 d_thread_safe_nl_langinfo_l='$d_thread_safe_nl_langinfo_l'
24256 d_time='$d_time'
24257 d_timegm='$d_timegm'
24258 d_times='$d_times'
24259 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24260 d_tm_tm_zone='$d_tm_tm_zone'
24261 d_tmpnam_r='$d_tmpnam_r'
24262 d_trunc='$d_trunc'
24263 d_truncate='$d_truncate'
24264 d_truncl='$d_truncl'
24265 d_ttyname_r='$d_ttyname_r'
24266 d_tzname='$d_tzname'
24267 d_u32align='$d_u32align'
24268 d_ualarm='$d_ualarm'
24269 d_umask='$d_umask'
24270 d_uname='$d_uname'
24271 d_union_semun='$d_union_semun'
24272 d_unlinkat='$d_unlinkat'
24273 d_unordered='$d_unordered'
24274 d_unsetenv='$d_unsetenv'
24275 d_uselocale='$d_uselocale'
24276 d_usleep='$d_usleep'
24277 d_usleepproto='$d_usleepproto'
24278 d_ustat='$d_ustat'
24279 d_vendorarch='$d_vendorarch'
24280 d_vendorbin='$d_vendorbin'
24281 d_vendorlib='$d_vendorlib'
24282 d_vendorscript='$d_vendorscript'
24283 d_vfork='$d_vfork'
24284 d_void_closedir='$d_void_closedir'
24285 d_voidsig='$d_voidsig'
24286 d_voidtty='$d_voidtty'
24287 d_vsnprintf='$d_vsnprintf'
24288 d_wait4='$d_wait4'
24289 d_waitpid='$d_waitpid'
24290 d_wcscmp='$d_wcscmp'
24291 d_wcstombs='$d_wcstombs'
24292 d_wcsxfrm='$d_wcsxfrm'
24293 d_wctomb='$d_wctomb'
24294 d_writev='$d_writev'
24295 d_xenix='$d_xenix'
24296 date='$date'
24297 db_hashtype='$db_hashtype'
24298 db_prefixtype='$db_prefixtype'
24299 db_version_major='$db_version_major'
24300 db_version_minor='$db_version_minor'
24301 db_version_patch='$db_version_patch'
24302 default_inc_excludes_dot='$default_inc_excludes_dot'
24303 direntrytype='$direntrytype'
24304 dlext='$dlext'
24305 dlsrc='$dlsrc'
24306 doubleinfbytes='$doubleinfbytes'
24307 doublekind='$doublekind'
24308 doublemantbits='$doublemantbits'
24309 doublenanbytes='$doublenanbytes'
24310 doublesize='$doublesize'
24311 drand01='$drand01'
24312 drand48_r_proto='$drand48_r_proto'
24313 dtrace='$dtrace'
24314 dtraceobject='$dtraceobject'
24315 dtracexnolibs='$dtracexnolibs'
24316 dynamic_ext='$dynamic_ext'
24317 eagain='$eagain'
24318 ebcdic='$ebcdic'
24319 echo='$echo'
24320 egrep='$egrep'
24321 emacs='$emacs'
24322 endgrent_r_proto='$endgrent_r_proto'
24323 endhostent_r_proto='$endhostent_r_proto'
24324 endnetent_r_proto='$endnetent_r_proto'
24325 endprotoent_r_proto='$endprotoent_r_proto'
24326 endpwent_r_proto='$endpwent_r_proto'
24327 endservent_r_proto='$endservent_r_proto'
24328 eunicefix='$eunicefix'
24329 exe_ext='$exe_ext'
24330 expr='$expr'
24331 extensions='$extensions'
24332 extern_C='$extern_C'
24333 extras='$extras'
24334 fflushNULL='$fflushNULL'
24335 fflushall='$fflushall'
24336 find='$find'
24337 firstmakefile='$firstmakefile'
24338 flex='$flex'
24339 fpossize='$fpossize'
24340 fpostype='$fpostype'
24341 freetype='$freetype'
24342 from='$from'
24343 full_ar='$full_ar'
24344 full_csh='$full_csh'
24345 full_sed='$full_sed'
24346 gccansipedantic='$gccansipedantic'
24347 gccosandvers='$gccosandvers'
24348 gccversion='$gccversion'
24349 getgrent_r_proto='$getgrent_r_proto'
24350 getgrgid_r_proto='$getgrgid_r_proto'
24351 getgrnam_r_proto='$getgrnam_r_proto'
24352 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24353 gethostbyname_r_proto='$gethostbyname_r_proto'
24354 gethostent_r_proto='$gethostent_r_proto'
24355 getlogin_r_proto='$getlogin_r_proto'
24356 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24357 getnetbyname_r_proto='$getnetbyname_r_proto'
24358 getnetent_r_proto='$getnetent_r_proto'
24359 getprotobyname_r_proto='$getprotobyname_r_proto'
24360 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24361 getprotoent_r_proto='$getprotoent_r_proto'
24362 getpwent_r_proto='$getpwent_r_proto'
24363 getpwnam_r_proto='$getpwnam_r_proto'
24364 getpwuid_r_proto='$getpwuid_r_proto'
24365 getservbyname_r_proto='$getservbyname_r_proto'
24366 getservbyport_r_proto='$getservbyport_r_proto'
24367 getservent_r_proto='$getservent_r_proto'
24368 getspnam_r_proto='$getspnam_r_proto'
24369 gidformat='$gidformat'
24370 gidsign='$gidsign'
24371 gidsize='$gidsize'
24372 gidtype='$gidtype'
24373 glibpth='$glibpth'
24374 gmake='$gmake'
24375 gmtime_r_proto='$gmtime_r_proto'
24376 gnulibc_version='$gnulibc_version'
24377 grep='$grep'
24378 groupcat='$groupcat'
24379 groupstype='$groupstype'
24380 gzip='$gzip'
24381 h_fcntl='$h_fcntl'
24382 h_sysfile='$h_sysfile'
24383 hint='$hint'
24384 hostcat='$hostcat'
24385 hostgenerate='$hostgenerate'
24386 hostosname='$hostosname'
24387 hostperl='$hostperl'
24388 html1dir='$html1dir'
24389 html1direxp='$html1direxp'
24390 html3dir='$html3dir'
24391 html3direxp='$html3direxp'
24392 i16size='$i16size'
24393 i16type='$i16type'
24394 i32size='$i32size'
24395 i32type='$i32type'
24396 i64size='$i64size'
24397 i64type='$i64type'
24398 i8size='$i8size'
24399 i8type='$i8type'
24400 i_arpainet='$i_arpainet'
24401 i_bfd='$i_bfd'
24402 i_bsdioctl='$i_bsdioctl'
24403 i_crypt='$i_crypt'
24404 i_db='$i_db'
24405 i_dbm='$i_dbm'
24406 i_dirent='$i_dirent'
24407 i_dlfcn='$i_dlfcn'
24408 i_execinfo='$i_execinfo'
24409 i_fcntl='$i_fcntl'
24410 i_fenv='$i_fenv'
24411 i_fp='$i_fp'
24412 i_fp_class='$i_fp_class'
24413 i_gdbm='$i_gdbm'
24414 i_gdbm_ndbm='$i_gdbm_ndbm'
24415 i_gdbmndbm='$i_gdbmndbm'
24416 i_grp='$i_grp'
24417 i_ieeefp='$i_ieeefp'
24418 i_inttypes='$i_inttypes'
24419 i_langinfo='$i_langinfo'
24420 i_libutil='$i_libutil'
24421 i_locale='$i_locale'
24422 i_machcthr='$i_machcthr'
24423 i_malloc='$i_malloc'
24424 i_mallocmalloc='$i_mallocmalloc'
24425 i_mntent='$i_mntent'
24426 i_ndbm='$i_ndbm'
24427 i_netdb='$i_netdb'
24428 i_neterrno='$i_neterrno'
24429 i_netinettcp='$i_netinettcp'
24430 i_niin='$i_niin'
24431 i_poll='$i_poll'
24432 i_prot='$i_prot'
24433 i_pthread='$i_pthread'
24434 i_pwd='$i_pwd'
24435 i_quadmath='$i_quadmath'
24436 i_rpcsvcdbm='$i_rpcsvcdbm'
24437 i_sgtty='$i_sgtty'
24438 i_shadow='$i_shadow'
24439 i_socks='$i_socks'
24440 i_stdbool='$i_stdbool'
24441 i_stdint='$i_stdint'
24442 i_stdlib='$i_stdlib'
24443 i_sunmath='$i_sunmath'
24444 i_sysaccess='$i_sysaccess'
24445 i_sysdir='$i_sysdir'
24446 i_sysfile='$i_sysfile'
24447 i_sysfilio='$i_sysfilio'
24448 i_sysin='$i_sysin'
24449 i_sysioctl='$i_sysioctl'
24450 i_syslog='$i_syslog'
24451 i_sysmman='$i_sysmman'
24452 i_sysmode='$i_sysmode'
24453 i_sysmount='$i_sysmount'
24454 i_sysndir='$i_sysndir'
24455 i_sysparam='$i_sysparam'
24456 i_syspoll='$i_syspoll'
24457 i_sysresrc='$i_sysresrc'
24458 i_syssecrt='$i_syssecrt'
24459 i_sysselct='$i_sysselct'
24460 i_syssockio='$i_syssockio'
24461 i_sysstat='$i_sysstat'
24462 i_sysstatfs='$i_sysstatfs'
24463 i_sysstatvfs='$i_sysstatvfs'
24464 i_systime='$i_systime'
24465 i_systimek='$i_systimek'
24466 i_systimes='$i_systimes'
24467 i_systypes='$i_systypes'
24468 i_sysuio='$i_sysuio'
24469 i_sysun='$i_sysun'
24470 i_sysutsname='$i_sysutsname'
24471 i_sysvfs='$i_sysvfs'
24472 i_syswait='$i_syswait'
24473 i_termio='$i_termio'
24474 i_termios='$i_termios'
24475 i_time='$i_time'
24476 i_unistd='$i_unistd'
24477 i_ustat='$i_ustat'
24478 i_utime='$i_utime'
24479 i_vfork='$i_vfork'
24480 i_wchar='$i_wchar'
24481 i_xlocale='$i_xlocale'
24482 ignore_versioned_solibs='$ignore_versioned_solibs'
24483 inc_version_list='$inc_version_list'
24484 inc_version_list_init='$inc_version_list_init'
24485 incpath='$incpath'
24486 incpth='$incpth'
24487 inews='$inews'
24488 initialinstalllocation='$initialinstalllocation'
24489 installarchlib='$installarchlib'
24490 installbin='$installbin'
24491 installhtml1dir='$installhtml1dir'
24492 installhtml3dir='$installhtml3dir'
24493 installman1dir='$installman1dir'
24494 installman3dir='$installman3dir'
24495 installprefix='$installprefix'
24496 installprefixexp='$installprefixexp'
24497 installprivlib='$installprivlib'
24498 installscript='$installscript'
24499 installsitearch='$installsitearch'
24500 installsitebin='$installsitebin'
24501 installsitehtml1dir='$installsitehtml1dir'
24502 installsitehtml3dir='$installsitehtml3dir'
24503 installsitelib='$installsitelib'
24504 installsiteman1dir='$installsiteman1dir'
24505 installsiteman3dir='$installsiteman3dir'
24506 installsitescript='$installsitescript'
24507 installstyle='$installstyle'
24508 installusrbinperl='$installusrbinperl'
24509 installvendorarch='$installvendorarch'
24510 installvendorbin='$installvendorbin'
24511 installvendorhtml1dir='$installvendorhtml1dir'
24512 installvendorhtml3dir='$installvendorhtml3dir'
24513 installvendorlib='$installvendorlib'
24514 installvendorman1dir='$installvendorman1dir'
24515 installvendorman3dir='$installvendorman3dir'
24516 installvendorscript='$installvendorscript'
24517 intsize='$intsize'
24518 issymlink='$issymlink'
24519 ivdformat='$ivdformat'
24520 ivsize='$ivsize'
24521 ivtype='$ivtype'
24522 known_extensions='$known_extensions'
24523 ksh='$ksh'
24524 ld='$ld'
24525 ld_can_script='$ld_can_script'
24526 lddlflags='$lddlflags'
24527 ldflags='$ldflags'
24528 ldflags_uselargefiles='$ldflags_uselargefiles'
24529 ldlibpthname='$ldlibpthname'
24530 less='$less'
24531 lib_ext='$lib_ext'
24532 libc='$libc'
24533 libperl='$libperl'
24534 libpth='$libpth'
24535 libs='$libs'
24536 libsdirs='$libsdirs'
24537 libsfiles='$libsfiles'
24538 libsfound='$libsfound'
24539 libspath='$libspath'
24540 libswanted='$libswanted'
24541 libswanted_uselargefiles='$libswanted_uselargefiles'
24542 line='$line'
24543 lint='$lint'
24544 lkflags='$lkflags'
24545 ln='$ln'
24546 lns='$lns'
24547 localtime_r_proto='$localtime_r_proto'
24548 locincpth='$locincpth'
24549 loclibpth='$loclibpth'
24550 longdblinfbytes='$longdblinfbytes'
24551 longdblkind='$longdblkind'
24552 longdblmantbits='$longdblmantbits'
24553 longdblnanbytes='$longdblnanbytes'
24554 longdblsize='$longdblsize'
24555 longlongsize='$longlongsize'
24556 longsize='$longsize'
24557 lp='$lp'
24558 lpr='$lpr'
24559 ls='$ls'
24560 lseeksize='$lseeksize'
24561 lseektype='$lseektype'
24562 mail='$mail'
24563 mailx='$mailx'
24564 make='$make'
24565 make_set_make='$make_set_make'
24566 mallocobj='$mallocobj'
24567 mallocsrc='$mallocsrc'
24568 malloctype='$malloctype'
24569 man1dir='$man1dir'
24570 man1direxp='$man1direxp'
24571 man1ext='$man1ext'
24572 man3dir='$man3dir'
24573 man3direxp='$man3direxp'
24574 man3ext='$man3ext'
24575 mips_type='$mips_type'
24576 mistrustnm='$mistrustnm'
24577 mkdir='$mkdir'
24578 mmaptype='$mmaptype'
24579 modetype='$modetype'
24580 more='$more'
24581 multiarch='$multiarch'
24582 mv='$mv'
24583 myarchname='$myarchname'
24584 mydomain='$mydomain'
24585 myhostname='$myhostname'
24586 myuname='$myuname'
24587 n='$n'
24588 need_va_copy='$need_va_copy'
24589 netdb_hlen_type='$netdb_hlen_type'
24590 netdb_host_type='$netdb_host_type'
24591 netdb_name_type='$netdb_name_type'
24592 netdb_net_type='$netdb_net_type'
24593 nm='$nm'
24594 nm_opt='$nm_opt'
24595 nm_so_opt='$nm_so_opt'
24596 nonxs_ext='$nonxs_ext'
24597 nroff='$nroff'
24598 nvEUformat='$nvEUformat'
24599 nvFUformat='$nvFUformat'
24600 nvGUformat='$nvGUformat'
24601 nv_overflows_integers_at='$nv_overflows_integers_at'
24602 nv_preserves_uv_bits='$nv_preserves_uv_bits'
24603 nveformat='$nveformat'
24604 nvfformat='$nvfformat'
24605 nvgformat='$nvgformat'
24606 nvmantbits='$nvmantbits'
24607 nvsize='$nvsize'
24608 nvtype='$nvtype'
24609 o_nonblock='$o_nonblock'
24610 obj_ext='$obj_ext'
24611 old_pthread_create_joinable='$old_pthread_create_joinable'
24612 optimize='$optimize'
24613 orderlib='$orderlib'
24614 osname='$osname'
24615 osvers='$osvers'
24616 otherlibdirs='$otherlibdirs'
24617 package='$package'
24618 pager='$pager'
24619 passcat='$passcat'
24620 patchlevel='$patchlevel'
24621 path_sep='$path_sep'
24622 perl5='$perl5'
24623 perl='$perl'
24624 perl_patchlevel='$perl_patchlevel'
24625 perl_static_inline='$perl_static_inline'
24626 perladmin='$perladmin'
24627 perllibs='$perllibs'
24628 perlpath='$perlpath'
24629 pg='$pg'
24630 phostname='$phostname'
24631 pidtype='$pidtype'
24632 plibpth='$plibpth'
24633 pmake='$pmake'
24634 pr='$pr'
24635 prefix='$prefix'
24636 prefixexp='$prefixexp'
24637 privlib='$privlib'
24638 privlibexp='$privlibexp'
24639 procselfexe='$procselfexe'
24640 ptrsize='$ptrsize'
24641 quadkind='$quadkind'
24642 quadtype='$quadtype'
24643 randbits='$randbits'
24644 randfunc='$randfunc'
24645 random_r_proto='$random_r_proto'
24646 randseedtype='$randseedtype'
24647 ranlib='$ranlib'
24648 rd_nodata='$rd_nodata'
24649 readdir64_r_proto='$readdir64_r_proto'
24650 readdir_r_proto='$readdir_r_proto'
24651 revision='$revision'
24652 rm='$rm'
24653 rm_try='$rm_try'
24654 rmail='$rmail'
24655 run='$run'
24656 runnm='$runnm'
24657 sGMTIME_max='$sGMTIME_max'
24658 sGMTIME_min='$sGMTIME_min'
24659 sLOCALTIME_max='$sLOCALTIME_max'
24660 sLOCALTIME_min='$sLOCALTIME_min'
24661 sPRIEUldbl='$sPRIEUldbl'
24662 sPRIFUldbl='$sPRIFUldbl'
24663 sPRIGUldbl='$sPRIGUldbl'
24664 sPRIXU64='$sPRIXU64'
24665 sPRId64='$sPRId64'
24666 sPRIeldbl='$sPRIeldbl'
24667 sPRIfldbl='$sPRIfldbl'
24668 sPRIgldbl='$sPRIgldbl'
24669 sPRIi64='$sPRIi64'
24670 sPRIo64='$sPRIo64'
24671 sPRIu64='$sPRIu64'
24672 sPRIx64='$sPRIx64'
24673 sSCNfldbl='$sSCNfldbl'
24674 sched_yield='$sched_yield'
24675 scriptdir='$scriptdir'
24676 scriptdirexp='$scriptdirexp'
24677 sed='$sed'
24678 seedfunc='$seedfunc'
24679 selectminbits='$selectminbits'
24680 selecttype='$selecttype'
24681 sendmail='$sendmail'
24682 setgrent_r_proto='$setgrent_r_proto'
24683 sethostent_r_proto='$sethostent_r_proto'
24684 setlocale_r_proto='$setlocale_r_proto'
24685 setnetent_r_proto='$setnetent_r_proto'
24686 setprotoent_r_proto='$setprotoent_r_proto'
24687 setpwent_r_proto='$setpwent_r_proto'
24688 setservent_r_proto='$setservent_r_proto'
24689 sh='$sh'
24690 shar='$shar'
24691 sharpbang='$sharpbang'
24692 shmattype='$shmattype'
24693 shortsize='$shortsize'
24694 shrpenv='$shrpenv'
24695 shsharp='$shsharp'
24696 sig_count='$sig_count'
24697 sig_name='$sig_name'
24698 sig_name_init='$sig_name_init'
24699 sig_num='$sig_num'
24700 sig_num_init='$sig_num_init'
24701 sig_size='$sig_size'
24702 signal_t='$signal_t'
24703 sitearch='$sitearch'
24704 sitearchexp='$sitearchexp'
24705 sitebin='$sitebin'
24706 sitebinexp='$sitebinexp'
24707 sitehtml1dir='$sitehtml1dir'
24708 sitehtml1direxp='$sitehtml1direxp'
24709 sitehtml3dir='$sitehtml3dir'
24710 sitehtml3direxp='$sitehtml3direxp'
24711 sitelib='$sitelib'
24712 sitelib_stem='$sitelib_stem'
24713 sitelibexp='$sitelibexp'
24714 siteman1dir='$siteman1dir'
24715 siteman1direxp='$siteman1direxp'
24716 siteman3dir='$siteman3dir'
24717 siteman3direxp='$siteman3direxp'
24718 siteprefix='$siteprefix'
24719 siteprefixexp='$siteprefixexp'
24720 sitescript='$sitescript'
24721 sitescriptexp='$sitescriptexp'
24722 sizesize='$sizesize'
24723 sizetype='$sizetype'
24724 sleep='$sleep'
24725 smail='$smail'
24726 so='$so'
24727 sockethdr='$sockethdr'
24728 socketlib='$socketlib'
24729 socksizetype='$socksizetype'
24730 sort='$sort'
24731 spackage='$spackage'
24732 spitshell='$spitshell'
24733 srand48_r_proto='$srand48_r_proto'
24734 srandom_r_proto='$srandom_r_proto'
24735 src='$src'
24736 ssizetype='$ssizetype'
24737 st_ino_sign='$st_ino_sign'
24738 st_ino_size='$st_ino_size'
24739 startperl='$startperl'
24740 startsh='$startsh'
24741 static_ext='$static_ext'
24742 stdchar='$stdchar'
24743 stdio_base='$stdio_base'
24744 stdio_bufsiz='$stdio_bufsiz'
24745 stdio_cnt='$stdio_cnt'
24746 stdio_filbuf='$stdio_filbuf'
24747 stdio_ptr='$stdio_ptr'
24748 stdio_stream_array='$stdio_stream_array'
24749 strerror_r_proto='$strerror_r_proto'
24750 submit='$submit'
24751 subversion='$subversion'
24752 sysman='$sysman'
24753 sysroot='$sysroot'
24754 tail='$tail'
24755 tar='$tar'
24756 targetarch='$targetarch'
24757 targetdir='$targetdir'
24758 targetenv='$targetenv'
24759 targethost='$targethost'
24760 targetmkdir='$targetmkdir'
24761 targetport='$targetport'
24762 targetsh='$targetsh'
24763 tbl='$tbl'
24764 tee='$tee'
24765 test='$test'
24766 timeincl='$timeincl'
24767 timetype='$timetype'
24768 tmpnam_r_proto='$tmpnam_r_proto'
24769 to='$to'
24770 touch='$touch'
24771 tr='$tr'
24772 trnl='$trnl'
24773 troff='$troff'
24774 ttyname_r_proto='$ttyname_r_proto'
24775 u16size='$u16size'
24776 u16type='$u16type'
24777 u32size='$u32size'
24778 u32type='$u32type'
24779 u64size='$u64size'
24780 u64type='$u64type'
24781 u8size='$u8size'
24782 u8type='$u8type'
24783 uidformat='$uidformat'
24784 uidsign='$uidsign'
24785 uidsize='$uidsize'
24786 uidtype='$uidtype'
24787 uname='$uname'
24788 uniq='$uniq'
24789 uquadtype='$uquadtype'
24790 use5005threads='$use5005threads'
24791 use64bitall='$use64bitall'
24792 use64bitint='$use64bitint'
24793 usecbacktrace='$usecbacktrace'
24794 usecrosscompile='$usecrosscompile'
24795 usedevel='$usedevel'
24796 usedl='$usedl'
24797 usedtrace='$usedtrace'
24798 usefaststdio='$usefaststdio'
24799 useithreads='$useithreads'
24800 usekernprocpathname='$usekernprocpathname'
24801 uselargefiles='$uselargefiles'
24802 uselongdouble='$uselongdouble'
24803 usemallocwrap='$usemallocwrap'
24804 usemorebits='$usemorebits'
24805 usemultiplicity='$usemultiplicity'
24806 usemymalloc='$usemymalloc'
24807 usenm='$usenm'
24808 usensgetexecutablepath='$usensgetexecutablepath'
24809 useopcode='$useopcode'
24810 useperlio='$useperlio'
24811 useposix='$useposix'
24812 usequadmath='$usequadmath'
24813 usereentrant='$usereentrant'
24814 userelocatableinc='$userelocatableinc'
24815 useshrplib='$useshrplib'
24816 usesitecustomize='$usesitecustomize'
24817 usesocks='$usesocks'
24818 usethreads='$usethreads'
24819 usevendorprefix='$usevendorprefix'
24820 useversionedarchname='$useversionedarchname'
24821 usevfork='$usevfork'
24822 usrinc='$usrinc'
24823 uuname='$uuname'
24824 uvXUformat='$uvXUformat'
24825 uvoformat='$uvoformat'
24826 uvsize='$uvsize'
24827 uvtype='$uvtype'
24828 uvuformat='$uvuformat'
24829 uvxformat='$uvxformat'
24830 vendorarch='$vendorarch'
24831 vendorarchexp='$vendorarchexp'
24832 vendorbin='$vendorbin'
24833 vendorbinexp='$vendorbinexp'
24834 vendorhtml1dir='$vendorhtml1dir'
24835 vendorhtml1direxp='$vendorhtml1direxp'
24836 vendorhtml3dir='$vendorhtml3dir'
24837 vendorhtml3direxp='$vendorhtml3direxp'
24838 vendorlib='$vendorlib'
24839 vendorlib_stem='$vendorlib_stem'
24840 vendorlibexp='$vendorlibexp'
24841 vendorman1dir='$vendorman1dir'
24842 vendorman1direxp='$vendorman1direxp'
24843 vendorman3dir='$vendorman3dir'
24844 vendorman3direxp='$vendorman3direxp'
24845 vendorprefix='$vendorprefix'
24846 vendorprefixexp='$vendorprefixexp'
24847 vendorscript='$vendorscript'
24848 vendorscriptexp='$vendorscriptexp'
24849 version='$version'
24850 version_patchlevel_string='$version_patchlevel_string'
24851 versiononly='$versiononly'
24852 vi='$vi'
24853 xlibpth='$xlibpth'
24854 yacc='$yacc'
24855 yaccflags='$yaccflags'
24856 zcat='$zcat'
24857 zip='$zip'
24858 EOT
24859
24860 : add special variables
24861 $test -f $src/patchlevel.h && \
24862 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
24863 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
24864 echo "PERL_CONFIG_SH=true" >>config.sh
24865
24866 : propagate old symbols
24867 if $test -f UU/config.sh; then
24868         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
24869         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
24870                 config.sh config.sh UU/oldconfig.sh |\
24871                 $sort | $uniq -u >UU/oldsyms
24872         set X `$cat UU/oldsyms`
24873         shift
24874         case $# in
24875         0) ;;
24876         *)
24877                 $cat <<EOM
24878 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
24879 EOM
24880                 echo ": Variables propagated from previous config.sh file." >>config.sh
24881                 for sym in `$cat UU/oldsyms`; do
24882                         echo "    Propagating $hint variable "'$'"$sym..."
24883                         eval 'tmp="$'"${sym}"'"'
24884                         echo "$tmp" | \
24885                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
24886                 done
24887                 ;;
24888         esac
24889 fi
24890
24891 : preserve RCS keywords in files with variable substitution, grrr
24892 Id='$Id'
24893
24894 : Finish up by extracting the .SH files
24895 case "$alldone" in
24896 exit)
24897         echo "Stopping at your request, leaving temporary files around."
24898         exit 0
24899         ;;
24900 cont)
24901         ;;
24902 '')
24903         dflt=''
24904         nostick=true
24905         $cat <<EOM
24906
24907 If you'd like to make any changes to the config.sh file before I begin
24908 to configure things, do it as a shell escape now (e.g. !vi config.sh).
24909
24910 EOM
24911         rp="Press return or use a shell escape to edit config.sh:"
24912         . UU/myread
24913         nostick=''
24914         case "$ans" in
24915         '') ;;
24916         *) : in case they cannot read
24917                 sh 1>&4 -c "$ans";;
24918         esac
24919         ;;
24920 esac
24921
24922 : if this fails, just run all the .SH files by hand
24923 . ./config.sh
24924
24925 echo " "
24926 exec 1>&4
24927 pwd=`pwd`
24928 . ./UU/extract
24929 cd "$pwd"
24930
24931 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
24932         dflt=y
24933         case "$silent" in
24934         true) ;;
24935         *)
24936                 $cat <<EOM
24937
24938 Now you need to generate make dependencies by running "$make depend".
24939 You might prefer to run it in background: "$make depend > makedepend.out &"
24940 It can take a while, so you might not want to run it right now.
24941
24942 EOM
24943                 ;;
24944         esac
24945         rp="Run $make depend now?"
24946         . UU/myread
24947         case "$ans" in
24948         y*)
24949                 $make depend && echo "Now you must run '$make'."
24950                 ;;
24951         *)
24952                 echo "You must run '$make depend' then '$make'."
24953                 ;;
24954         esac
24955 elif test -f [Mm]akefile; then
24956         echo " "
24957         echo "Now you must run a $make."
24958 else
24959         echo "Configure done."
24960 fi
24961
24962 if $test -f Policy.sh; then
24963     $cat <<EOM
24964
24965 If you compile $package on a different machine or from a different object
24966 directory, copy the Policy.sh file from this object directory to the
24967 new one before you run Configure -- this will help you with most of
24968 the policy defaults.
24969
24970 EOM
24971 fi
24972 if $test -f UU/config.msg; then
24973     echo "Hmm.  I also noted the following information while running:"
24974     echo " "
24975     $cat UU/config.msg >&4
24976 fi
24977 $rm -f kit*isdone ark*isdone
24978 $rm -rf UU
24979
24980 : End of Configure
24981