This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
add extra optimization phase
[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_sockatmark=''
811 d_sockatmarkproto=''
812 d_ip_mreq=''
813 d_ip_mreq_source=''
814 d_ipv6_mreq=''
815 d_ipv6_mreq_source=''
816 d_msg_ctrunc=''
817 d_msg_dontroute=''
818 d_msg_oob=''
819 d_msg_peek=''
820 d_msg_proxy=''
821 d_oldsock=''
822 d_scm_rights=''
823 d_sin6_scope_id=''
824 d_sockaddr_in6=''
825 d_sockaddr_sa_len=''
826 d_socket=''
827 d_sockpair=''
828 sockethdr=''
829 socketlib=''
830 d_socklen_t=''
831 d_socks5_init=''
832 d_sqrtl=''
833 d_srand48_r=''
834 srand48_r_proto=''
835 d_srandom_r=''
836 srandom_r_proto=''
837 d_sresgproto=''
838 d_sresuproto=''
839 d_stat=''
840 d_statblks=''
841 d_statfs_f_flags=''
842 d_statfs_s=''
843 d_static_inline=''
844 perl_static_inline=''
845 d_fstatvfs=''
846 d_statvfs=''
847 d_stdio_cnt_lval=''
848 d_stdio_ptr_lval=''
849 d_stdio_ptr_lval_nochange_cnt=''
850 d_stdio_ptr_lval_sets_cnt=''
851 d_stdiobase=''
852 d_stdstdio=''
853 stdio_base=''
854 stdio_bufsiz=''
855 stdio_cnt=''
856 stdio_filbuf=''
857 stdio_ptr=''
858 d_strcoll=''
859 d_sysernlst=''
860 d_syserrlst=''
861 d_strerror_l=''
862 d_strerror_r=''
863 strerror_r_proto=''
864 d_strftime=''
865 d_strlcat=''
866 d_strlcpy=''
867 d_strnlen=''
868 d_strtod=''
869 d_strtol=''
870 d_strtold=''
871 d_strtold_l=''
872 d_strtoll=''
873 d_strtoq=''
874 d_strtoul=''
875 d_strtoull=''
876 d_strtouq=''
877 d_strxfrm=''
878 d_symlink=''
879 d_syscall=''
880 d_syscallproto=''
881 d_sysconf=''
882 d_system=''
883 d_tcgetpgrp=''
884 d_tcsetpgrp=''
885 d_telldirproto=''
886 d_tgamma=''
887 d_time=''
888 timetype=''
889 d_asctime64=''
890 d_ctime64=''
891 d_difftime64=''
892 d_gmtime64=''
893 d_localtime64=''
894 d_mktime64=''
895 d_timegm=''
896 clocktype=''
897 d_times=''
898 d_tmpnam_r=''
899 tmpnam_r_proto=''
900 d_trunc=''
901 d_truncate=''
902 d_truncl=''
903 d_ttyname_r=''
904 ttyname_r_proto=''
905 d_tzname=''
906 d_u32align=''
907 d_ualarm=''
908 d_umask=''
909 d_semctl_semid_ds=''
910 d_semctl_semun=''
911 d_union_semun=''
912 d_unordered=''
913 d_unsetenv=''
914 d_usleep=''
915 d_usleepproto=''
916 d_ustat=''
917 d_pseudofork=''
918 d_vfork=''
919 usevfork=''
920 d_voidsig=''
921 signal_t=''
922 d_wait4=''
923 d_waitpid=''
924 d_wcscmp=''
925 d_wcstombs=''
926 d_wcsxfrm=''
927 d_wctomb=''
928 d_writev=''
929 default_inc_excludes_dot=''
930 dlext=''
931 bin_ELF=''
932 cccdlflags=''
933 ccdlflags=''
934 dlsrc=''
935 ld=''
936 ld_can_script=''
937 lddlflags=''
938 usedl=''
939 doublesize=''
940 dtraceobject=''
941 dtracexnolibs=''
942 ebcdic=''
943 fflushNULL=''
944 fflushall=''
945 fpossize=''
946 fpostype=''
947 gccansipedantic=''
948 gccosandvers=''
949 gccversion=''
950 gidformat=''
951 gidsign=''
952 gidsize=''
953 gidtype=''
954 groupstype=''
955 h_fcntl=''
956 h_sysfile=''
957 html1dir=''
958 html1direxp=''
959 installhtml1dir=''
960 html3dir=''
961 html3direxp=''
962 installhtml3dir=''
963 i_arpainet=''
964 i_bfd=''
965 i_crypt=''
966 db_hashtype=''
967 db_prefixtype=''
968 db_version_major=''
969 db_version_minor=''
970 db_version_patch=''
971 i_db=''
972 i_dbm=''
973 i_rpcsvcdbm=''
974 d_dirnamlen=''
975 direntrytype=''
976 i_dirent=''
977 i_dlfcn=''
978 i_execinfo=''
979 i_fcntl=''
980 i_fenv=''
981 i_fp=''
982 i_fp_class=''
983 i_gdbm=''
984 d_grpasswd=''
985 i_grp=''
986 i_ieeefp=''
987 i_inttypes=''
988 i_langinfo=''
989 i_libutil=''
990 i_locale=''
991 i_machcthr=''
992 i_malloc=''
993 i_mallocmalloc=''
994 i_mntent=''
995 d_gdbm_ndbm_h_uses_prototypes=''
996 d_gdbmndbm_h_uses_prototypes=''
997 d_ndbm=''
998 d_ndbm_h_uses_prototypes=''
999 i_gdbm_ndbm=''
1000 i_gdbmndbm=''
1001 i_ndbm=''
1002 i_netdb=''
1003 i_neterrno=''
1004 i_netinettcp=''
1005 i_niin=''
1006 i_sysin=''
1007 i_poll=''
1008 i_prot=''
1009 i_pthread=''
1010 d_pwage=''
1011 d_pwchange=''
1012 d_pwclass=''
1013 d_pwcomment=''
1014 d_pwexpire=''
1015 d_pwgecos=''
1016 d_pwpasswd=''
1017 d_pwquota=''
1018 i_pwd=''
1019 i_quadmath=''
1020 i_shadow=''
1021 i_socks=''
1022 i_stdbool=''
1023 i_stdint=''
1024 i_stdlib=''
1025 i_sunmath=''
1026 i_sysaccess=''
1027 i_sysdir=''
1028 i_sysfile=''
1029 d_voidtty=''
1030 i_bsdioctl=''
1031 i_sysfilio=''
1032 i_sysioctl=''
1033 i_syssockio=''
1034 i_syslog=''
1035 i_sysmman=''
1036 i_sysmode=''
1037 i_sysmount=''
1038 i_sysndir=''
1039 i_sysparam=''
1040 i_syspoll=''
1041 i_sysresrc=''
1042 i_syssecrt=''
1043 i_sysselct=''
1044 i_sysstat=''
1045 i_sysstatfs=''
1046 i_sysstatvfs=''
1047 i_systimes=''
1048 i_systypes=''
1049 i_sysuio=''
1050 i_sysun=''
1051 i_sysutsname=''
1052 i_sysvfs=''
1053 i_syswait=''
1054 i_sgtty=''
1055 i_termio=''
1056 i_termios=''
1057 d_tm_tm_gmtoff=''
1058 d_tm_tm_zone=''
1059 i_systime=''
1060 i_systimek=''
1061 i_time=''
1062 timeincl=''
1063 i_unistd=''
1064 i_ustat=''
1065 i_utime=''
1066 i_vfork=''
1067 i_wchar=''
1068 d_inc_version_list=''
1069 inc_version_list=''
1070 inc_version_list_init=''
1071 doubleinfbytes=''
1072 doublenanbytes=''
1073 longdblinfbytes=''
1074 longdblnanbytes=''
1075 installprefix=''
1076 installprefixexp=''
1077 installstyle=''
1078 installusrbinperl=''
1079 intsize=''
1080 longsize=''
1081 shortsize=''
1082 issymlink=''
1083 libc=''
1084 ldlibpthname=''
1085 libperl=''
1086 shrpenv=''
1087 useshrplib=''
1088 glibpth=''
1089 incpth=''
1090 libpth=''
1091 loclibpth=''
1092 plibpth=''
1093 xlibpth=''
1094 ignore_versioned_solibs=''
1095 libs=''
1096 libsdirs=''
1097 libsfiles=''
1098 libsfound=''
1099 libspath=''
1100 lns=''
1101 d_PRIEUldbl=''
1102 d_PRIFUldbl=''
1103 d_PRIGUldbl=''
1104 d_PRIeldbl=''
1105 d_PRIfldbl=''
1106 d_PRIgldbl=''
1107 d_SCNfldbl=''
1108 d_double_has_inf=''
1109 d_double_has_nan=''
1110 d_double_has_negative_zero=''
1111 d_double_has_subnormals=''
1112 d_double_style_cray=''
1113 d_double_style_ibm=''
1114 d_double_style_ieee=''
1115 d_double_style_vax=''
1116 doublekind=''
1117 sPRIEUldbl=''
1118 sPRIFUldbl=''
1119 sPRIGUldbl=''
1120 sPRIeldbl=''
1121 sPRIfldbl=''
1122 sPRIgldbl=''
1123 sSCNfldbl=''
1124 lseeksize=''
1125 lseektype=''
1126 make_set_make=''
1127 d_mymalloc=''
1128 freetype=''
1129 mallocobj=''
1130 mallocsrc=''
1131 malloctype=''
1132 usemallocwrap=''
1133 usemymalloc=''
1134 installman1dir=''
1135 man1dir=''
1136 man1direxp=''
1137 man1ext=''
1138 installman3dir=''
1139 man3dir=''
1140 man3direxp=''
1141 man3ext=''
1142 doublemantbits=''
1143 longdblmantbits=''
1144 nvmantbits=''
1145 modetype=''
1146 multiarch=''
1147 mydomain=''
1148 myhostname=''
1149 phostname=''
1150 c=''
1151 n=''
1152 d_eofnblk=''
1153 eagain=''
1154 o_nonblock=''
1155 rd_nodata=''
1156 need_va_copy=''
1157 netdb_hlen_type=''
1158 netdb_host_type=''
1159 netdb_name_type=''
1160 netdb_net_type=''
1161 groupcat=''
1162 hostcat=''
1163 passcat=''
1164 orderlib=''
1165 ranlib=''
1166 d_perl_otherlibdirs=''
1167 otherlibdirs=''
1168 package=''
1169 spackage=''
1170 pager=''
1171 api_revision=''
1172 api_subversion=''
1173 api_version=''
1174 api_versionstring=''
1175 patchlevel=''
1176 perl_patchlevel=''
1177 revision=''
1178 subversion=''
1179 version=''
1180 version_patchlevel_string=''
1181 perl5=''
1182 perladmin=''
1183 perlpath=''
1184 d_nv_preserves_uv=''
1185 d_nv_zero_is_allbits_zero=''
1186 i16size=''
1187 i16type=''
1188 i32size=''
1189 i32type=''
1190 i64size=''
1191 i64type=''
1192 i8size=''
1193 i8type=''
1194 ivsize=''
1195 ivtype=''
1196 nv_overflows_integers_at=''
1197 nv_preserves_uv_bits=''
1198 nvsize=''
1199 nvtype=''
1200 u16size=''
1201 u16type=''
1202 u32size=''
1203 u32type=''
1204 u64size=''
1205 u64type=''
1206 u8size=''
1207 u8type=''
1208 uvsize=''
1209 uvtype=''
1210 ivdformat=''
1211 nvEUformat=''
1212 nvFUformat=''
1213 nvGUformat=''
1214 nveformat=''
1215 nvfformat=''
1216 nvgformat=''
1217 uvXUformat=''
1218 uvoformat=''
1219 uvuformat=''
1220 uvxformat=''
1221 pidtype=''
1222 prefix=''
1223 prefixexp=''
1224 installprivlib=''
1225 privlib=''
1226 privlibexp=''
1227 ptrsize=''
1228 d_PRIXU64=''
1229 d_PRId64=''
1230 d_PRIi64=''
1231 d_PRIo64=''
1232 d_PRIu64=''
1233 d_PRIx64=''
1234 sPRIXU64=''
1235 sPRId64=''
1236 sPRIi64=''
1237 sPRIo64=''
1238 sPRIu64=''
1239 sPRIx64=''
1240 d_quad=''
1241 quadkind=''
1242 quadtype=''
1243 uquadtype=''
1244 drand01=''
1245 randbits=''
1246 randfunc=''
1247 randseedtype=''
1248 seedfunc=''
1249 installscript=''
1250 scriptdir=''
1251 scriptdirexp=''
1252 selectminbits=''
1253 selecttype=''
1254 sh=''
1255 targetsh=''
1256 sig_count=''
1257 sig_name=''
1258 sig_name_init=''
1259 sig_num=''
1260 sig_num_init=''
1261 sig_size=''
1262 d_sitearch=''
1263 installsitearch=''
1264 sitearch=''
1265 sitearchexp=''
1266 installsitebin=''
1267 sitebin=''
1268 sitebinexp=''
1269 installsitehtml1dir=''
1270 sitehtml1dir=''
1271 sitehtml1direxp=''
1272 installsitehtml3dir=''
1273 sitehtml3dir=''
1274 sitehtml3direxp=''
1275 installsitelib=''
1276 sitelib=''
1277 sitelib_stem=''
1278 sitelibexp=''
1279 installsiteman1dir=''
1280 siteman1dir=''
1281 siteman1direxp=''
1282 installsiteman3dir=''
1283 siteman3dir=''
1284 siteman3direxp=''
1285 siteprefix=''
1286 siteprefixexp=''
1287 installsitescript=''
1288 sitescript=''
1289 sitescriptexp=''
1290 sizesize=''
1291 sizetype=''
1292 d_libname_unique=''
1293 so=''
1294 socksizetype=''
1295 sharpbang=''
1296 shsharp=''
1297 spitshell=''
1298 src=''
1299 ssizetype=''
1300 st_ino_sign=''
1301 st_ino_size=''
1302 startperl=''
1303 startsh=''
1304 stdchar=''
1305 d_stdio_stream_array=''
1306 stdio_stream_array=''
1307 sysman=''
1308 sGMTIME_max=''
1309 sGMTIME_min=''
1310 sLOCALTIME_max=''
1311 sLOCALTIME_min=''
1312 trnl=''
1313 uidformat=''
1314 uidsign=''
1315 uidsize=''
1316 uidtype=''
1317 archname64=''
1318 use64bitall=''
1319 use64bitint=''
1320 usecbacktrace=''
1321 dtrace=''
1322 usedtrace=''
1323 usefaststdio=''
1324 usekernprocpathname=''
1325 ccflags_uselargefiles=''
1326 ldflags_uselargefiles=''
1327 libswanted_uselargefiles=''
1328 uselargefiles=''
1329 uselongdouble=''
1330 usemorebits=''
1331 usemultiplicity=''
1332 nm_opt=''
1333 nm_so_opt=''
1334 runnm=''
1335 usenm=''
1336 usensgetexecutablepath=''
1337 useperlio=''
1338 usequadmath=''
1339 usesocks=''
1340 d_oldpthreads=''
1341 use5005threads=''
1342 useithreads=''
1343 usereentrant=''
1344 usethreads=''
1345 incpath=''
1346 mips_type=''
1347 usrinc=''
1348 d_vendorarch=''
1349 installvendorarch=''
1350 vendorarch=''
1351 vendorarchexp=''
1352 d_vendorbin=''
1353 installvendorbin=''
1354 vendorbin=''
1355 vendorbinexp=''
1356 installvendorhtml1dir=''
1357 vendorhtml1dir=''
1358 vendorhtml1direxp=''
1359 installvendorhtml3dir=''
1360 vendorhtml3dir=''
1361 vendorhtml3direxp=''
1362 d_vendorlib=''
1363 installvendorlib=''
1364 vendorlib=''
1365 vendorlib_stem=''
1366 vendorlibexp=''
1367 installvendorman1dir=''
1368 vendorman1dir=''
1369 vendorman1direxp=''
1370 installvendorman3dir=''
1371 vendorman3dir=''
1372 vendorman3direxp=''
1373 usevendorprefix=''
1374 vendorprefix=''
1375 vendorprefixexp=''
1376 d_vendorscript=''
1377 installvendorscript=''
1378 vendorscript=''
1379 vendorscriptexp=''
1380 versiononly=''
1381 yacc=''
1382 yaccflags=''
1383 CONFIG=''
1384
1385 : Detect odd OSs
1386 define='define'
1387 undef='undef'
1388 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1389 rmlist=''
1390
1391 : We must find out about Eunice early
1392 eunicefix=':'
1393 if test -f /etc/unixtovms; then
1394         eunicefix=/etc/unixtovms
1395 fi
1396 if test -f /etc/unixtovms.exe; then
1397         eunicefix=/etc/unixtovms.exe
1398 fi
1399
1400 : Set executable suffix now -- needed before hints available
1401 if test -f "/libs/version.library"; then
1402 : Amiga OS
1403     _exe=""
1404 elif test -f "/system/gnu_library/bin/ar.pm"; then
1405 : Stratus VOS
1406     _exe=".pm"
1407 elif test -n "$DJGPP"; then
1408 : DOS DJGPP
1409     _exe=".exe"
1410 elif test -f /kern/cookiejar; then
1411 : MiNT
1412     _exe=""
1413 elif test -d c:/. -o -n "$is_os2" ; then
1414 : OS/2 or cygwin
1415     _exe=".exe"
1416 fi
1417
1418 groupstype=''
1419 i_whoami=''
1420 : Possible local include directories to search.
1421 : Set locincpth to "" in a hint file to defeat local include searches.
1422 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1423 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1424 :
1425 : no include file wanted by default
1426 inclwanted=''
1427
1428 : Enable -DEBUGGING and -DDEBUGGING from the command line
1429 EBUGGING=''
1430 DEBUGGING=''
1431
1432 : Trailing extension.  Override this in a hint file, if needed.
1433 : Extra object files, if any, needed on this platform.
1434 archobjs=''
1435 libnames=''
1436 : change the next line if compiling for Xenix/286 on Xenix/386
1437 xlibpth='/usr/lib/386 /lib/386'
1438 : Possible local library directories to search.
1439 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1440 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1441
1442 : general looking path for locating libraries
1443 glibpth="/lib /usr/lib $xlibpth"
1444 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1445 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1446 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1447 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1448
1449 : Private path used by Configure to find libraries.  Its value
1450 : is prepended to libpth. This variable takes care of special
1451 : machines, like the mips.  Usually, it should be empty.
1452 plibpth=''
1453
1454 : default library list
1455 libswanted=''
1456 : some systems want to use only the non-versioned libso:s
1457 ignore_versioned_solibs=''
1458 ccname=''
1459 ccversion=''
1460 perllibs=''
1461 : set useposix=false in your hint file to disable the POSIX extension.
1462 useposix=true
1463 : set useopcode=false in your hint file to disable the Opcode extension.
1464 useopcode=true
1465 archname64=''
1466 ccflags_uselargefiles=''
1467 ldflags_uselargefiles=''
1468 libswanted_uselargefiles=''
1469 : set usemultiplicity on the Configure command line to enable multiplicity.
1470 : set usesocks on the Configure command line to enable socks.
1471 archname=''
1472 : set usethreads on the Configure command line to enable threads.
1473 usereentrant='undef'
1474 : List of libraries we want.
1475 : If anyone needs extra -lxxx, put those in a hint file.
1476 libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
1477 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1478 : We probably want to search /usr/shlib before most other libraries.
1479 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1480 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1481 glibpth="/usr/shlib $glibpth"
1482 : Do not use vfork unless overridden by a hint file.
1483 usevfork=false
1484
1485 : Find the basic shell for Bourne shell scripts
1486 case "$sh" in
1487 '')
1488         case "$SYSTYPE" in
1489         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1490         *) xxx='/bin/sh';;
1491         esac
1492         if test -f "$xxx"; then
1493                 sh="$xxx"
1494         else
1495                 : Build up a list and do a single loop so we can 'break' out.
1496                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1497                 for xxx in sh bash ksh pdksh ash; do
1498                         for p in $pth; do
1499                                 try="$try ${p}/${xxx}"
1500                         done
1501                 done
1502                 for xxx in $try; do
1503                         if test -f "$xxx"; then
1504                                 sh="$xxx";
1505                                 break
1506                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1507                                 sh="$xxx";
1508                                 break
1509                         elif test -f "$xxx.exe"; then
1510                                 sh="$xxx";
1511                                 break
1512                         fi
1513                 done
1514         fi
1515         ;;
1516 esac
1517
1518 case "$sh" in
1519 '')     cat >&2 <<EOM
1520 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1521
1522 Usually it's in /bin/sh.  How did you even get this far?
1523 Please contact me (Perl Maintainers) at perlbug@perl.org and
1524 we'll try to straighten this all out.
1525 EOM
1526         exit 1
1527         ;;
1528 esac
1529
1530 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1531 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1532 targetsh=$sh
1533
1534 : see if sh knows # comments
1535 if `$sh -c '#' >/dev/null 2>&1`; then
1536         shsharp=true
1537         spitshell=cat
1538         xcat=/bin/cat
1539         test -f $xcat$_exe || xcat=/usr/bin/cat
1540         if test ! -f $xcat$_exe; then
1541                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1542                         if test -f $p/cat$_exe; then
1543                                 xcat=$p/cat
1544                                 break
1545                         fi
1546                 done
1547                 if test ! -f $xcat$_exe; then
1548                         echo "Can't find cat anywhere!"
1549                         exit 1
1550                 fi
1551         fi
1552         echo "#!$xcat" >sharp
1553         $eunicefix sharp
1554         chmod +x sharp
1555         ./sharp > today 2>/dev/null
1556         if test -s today; then
1557                 sharpbang='#!'
1558         else
1559                 echo "#! $xcat" > sharp
1560                 $eunicefix sharp
1561                 chmod +x sharp
1562                 ./sharp > today 2>/dev/null
1563                 if test -s today; then
1564                         sharpbang='#! '
1565                 else
1566                         sharpbang=': use '
1567                 fi
1568         fi
1569 else
1570         echo " "
1571         echo "Your $sh doesn't grok # comments--I will strip them later on."
1572         shsharp=false
1573         cd ..
1574         echo "exec grep -v '^[  ]*#'" >spitshell
1575         chmod +x spitshell
1576         $eunicefix spitshell
1577         spitshell=`pwd`/spitshell
1578         cd UU
1579         echo "I presume that if # doesn't work, #! won't work either!"
1580         sharpbang=': use '
1581 fi
1582 rm -f sharp today
1583
1584 : figure out how to guarantee sh startup
1585 case "$startsh" in
1586 '') startsh=${sharpbang}${sh} ;;
1587 *)
1588 esac
1589 cat >sharp <<EOSS
1590 $startsh
1591 set abc
1592 test "$?abc" != 1
1593 EOSS
1594
1595 chmod +x sharp
1596 $eunicefix sharp
1597 if ./sharp; then
1598         : echo "Yup, it does."
1599 else
1600         echo "Hmm... '$startsh' does not guarantee sh startup..."
1601         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1602 fi
1603 rm -f sharp
1604
1605 : Save command line options in file UU/cmdline.opt for later use in
1606 : generating config.sh.
1607 cat > cmdline.opt <<EOSH
1608 : Configure command line arguments.
1609 config_arg0='$0'
1610 config_args='$*'
1611 config_argc=$#
1612 EOSH
1613 argn=1
1614 args_exp=''
1615 args_sep=''
1616 for arg in "$@"; do
1617         cat >>cmdline.opt <<EOSH
1618 config_arg$argn='$arg'
1619 EOSH
1620         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1621 $arg
1622 EOC
1623         arg_exp=`cat cmdl.opt`
1624         args_exp="$args_exp$args_sep'$arg_exp'"
1625         argn=`expr $argn + 1`
1626         args_sep=' '
1627 done
1628 rm -f cmdl.opt
1629
1630 : produce awk script to parse command line options
1631 cat >options.awk <<'EOF'
1632 BEGIN {
1633         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1634
1635         len = length(optstr);
1636         for (i = 1; i <= len; i++) {
1637                 c = substr(optstr, i, 1);
1638                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1639                 if (a == ":") {
1640                         arg[c] = 1;
1641                         i++;
1642                 }
1643                 opt[c] = 1;
1644         }
1645 }
1646 {
1647         expect = 0;
1648         str = $0;
1649         if (substr(str, 1, 1) != "-") {
1650                 printf("'%s'\n", str);
1651                 next;
1652         }
1653         len = length($0);
1654         for (i = 2; i <= len; i++) {
1655                 c = substr(str, i, 1);
1656                 if (!opt[c]) {
1657                         printf("-%s\n", substr(str, i));
1658                         next;
1659                 }
1660                 printf("-%s\n", c);
1661                 if (arg[c]) {
1662                         if (i < len)
1663                                 printf("'%s'\n", substr(str, i + 1));
1664                         else
1665                                 expect = 1;
1666                         next;
1667                 }
1668         }
1669 }
1670 END {
1671         if (expect)
1672                 print "?";
1673 }
1674 EOF
1675
1676 : process the command line options
1677 set X `for arg in "$@"; do echo "X$arg"; done |
1678         sed -e s/X// | awk -f options.awk`
1679 eval "set $*"
1680 shift
1681 rm -f options.awk
1682
1683 : set up default values
1684 fastread=''
1685 reuseval=false
1686 config_sh=''
1687 alldone=''
1688 error=''
1689 silent=''
1690 extractsh=''
1691 knowitall=''
1692 rm -f optdef.sh posthint.sh
1693 cat >optdef.sh <<EOS
1694 $startsh
1695 EOS
1696
1697
1698 : option parsing
1699 while test $# -gt 0; do
1700         case "$1" in
1701         -d) shift; fastread=yes;;
1702         -e) shift; alldone=cont;;
1703         -f)
1704                 shift
1705                 cd ..
1706                 if test -r "$1"; then
1707                         config_sh="$1"
1708                 else
1709                         echo "$me: cannot read config file $1." >&2
1710                         error=true
1711                 fi
1712                 cd UU
1713                 shift;;
1714         --help|\
1715         -h) shift; error=true;;
1716         -r) shift; reuseval=true;;
1717         -s) shift; silent=true; realsilent=true;;
1718         -E) shift; alldone=exit;;
1719         -K) shift; knowitall=true;;
1720         -O) shift;;
1721         -S) shift; silent=true; extractsh=true;;
1722         -D)
1723                 shift
1724                 case "$1" in
1725                 *=)
1726                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1727                         echo "$me: ignoring -D $1" >&2
1728                         ;;
1729                 *=*) echo "$1" | \
1730                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1731                 *) echo "$1='define'" >> optdef.sh;;
1732                 esac
1733                 shift
1734                 ;;
1735         -U)
1736                 shift
1737                 case "$1" in
1738                 *=) echo "$1" >> optdef.sh;;
1739                 *=*)
1740                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1741                         echo "$me: ignoring -U $1" >&2
1742                         ;;
1743                 *) echo "$1='undef'" >> optdef.sh;;
1744                 esac
1745                 shift
1746                 ;;
1747         -A)
1748             shift
1749             xxx=''
1750             yyy="$1"
1751             zzz=''
1752             uuu=undef
1753             case "$yyy" in
1754             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1755                  case "$zzz" in
1756                  *:*) zzz='' ;;
1757                  *)   xxx=append
1758                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1759                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1760                  esac
1761                  ;;
1762             esac
1763             case "$xxx" in
1764             '')  case "$yyy" in
1765                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1766                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1767                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1768                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1769                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1770                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1771                  esac
1772                  ;;
1773             esac
1774             case "$xxx" in
1775             append)
1776                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1777             clear)
1778                 echo "$yyy=''"                  >> posthint.sh ;;
1779             define)
1780                 case "$zzz" in
1781                 '') zzz=define ;;
1782                 esac
1783                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1784             eval)
1785                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1786             prepend)
1787                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1788             undef)
1789                 case "$zzz" in
1790                 '') zzz="$uuu" ;;
1791                 esac
1792                 echo "$yyy=$zzz"                >> posthint.sh ;;
1793             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1794             esac
1795             shift
1796             ;;
1797         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1798             exit 0;;
1799         --) break;;
1800         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1801         *) break;;
1802         esac
1803 done
1804
1805 case "$error" in
1806 true)
1807         cat >&2 <<EOM
1808 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1809                  [-U symbol] [-U symbol=] [-A command:symbol...]
1810   -d : use defaults for all answers.
1811   -e : go on without questioning past the production of config.sh.
1812   -f : specify an alternate default configuration file.
1813   -h : print this help message and exit (with an error status).
1814   -r : reuse C symbols value if possible (skips costly nm extraction).
1815   -s : silent mode, only echoes questions and essential information.
1816   -D : define symbol to have some value:
1817          -D symbol         symbol gets the value 'define'
1818          -D symbol=value   symbol gets the value 'value'
1819        common used examples (see INSTALL for more info):
1820          -Duse64bitint            use 64bit integers
1821          -Duse64bitall            use 64bit integers and pointers
1822          -Dusethreads             use thread support
1823          -Dinc_version_list=none  do not include older perl trees in @INC
1824          -DEBUGGING=none          DEBUGGING options
1825          -Dcc=gcc                 choose your compiler
1826          -Dprefix=/opt/perl5      choose your destination
1827   -E : stop at the end of questions, after having produced config.sh.
1828   -K : do not use unless you know what you are doing.
1829   -O : ignored for backward compatibility
1830   -S : perform variable substitutions on all .SH files (can mix with -f)
1831   -U : undefine symbol:
1832          -U symbol    symbol gets the value 'undef'
1833          -U symbol=   symbol gets completely empty
1834        e.g.:  -Uversiononly
1835   -A : manipulate symbol after the platform specific hints have been applied:
1836          -A append:symbol=value   append value to symbol
1837          -A symbol=value          like append:, but with a separating space
1838          -A define:symbol=value   define symbol to have value
1839          -A clear:symbol          define symbol to be ''
1840          -A define:symbol         define symbol to be 'define'
1841          -A eval:symbol=value     define symbol to be eval of value
1842          -A prepend:symbol=value  prepend value to symbol
1843          -A undef:symbol          define symbol to be 'undef'
1844          -A undef:symbol=         define symbol to be ''
1845        e.g.:  -A prepend:libswanted='cl pthread '
1846               -A ccflags=-DSOME_MACRO
1847   -V : print version number and exit (with a zero status).
1848 EOM
1849         exit 1
1850         ;;
1851 esac
1852
1853 : Sanity checks
1854 case "$fastread$alldone" in
1855 yescont|yesexit) ;;
1856 *)
1857         case "$extractsh" in
1858         true) ;;
1859         *)
1860                 if test ! -t 0; then
1861                         echo "Say 'sh Configure', not 'sh <Configure'"
1862                         exit 1
1863                 fi
1864                 ;;
1865         esac
1866         ;;
1867 esac
1868
1869 exec 4>&1
1870 case "$silent" in
1871 true) exec 1>/dev/null;;
1872 esac
1873
1874 : run the defines and the undefines, if any, but leave the file out there...
1875 touch optdef.sh
1876 grep '\\' optdef.sh >/dev/null 2>&1
1877 if test $? = 0; then
1878     echo "Configure does not support \\ in -D arguments"
1879     exit 1
1880 fi
1881 . ./optdef.sh
1882 : create the posthint manipulation script and leave the file out there...
1883 touch posthint.sh
1884
1885 : set package name
1886 package='perl5'
1887 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1888 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1889 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1890 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1891 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1892 esac
1893
1894 : Some greps do not return status, grrr.
1895 echo "grimblepritz" >grimble
1896 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1897         contains=contains
1898 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1899         contains=grep
1900 else
1901         contains=contains
1902 fi
1903 rm -f grimble
1904 : the following should work in any shell
1905 case "$contains" in
1906 contains*)
1907         echo " "
1908         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1909         cat >contains <<'EOSS'
1910 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1911 EOSS
1912 chmod +x contains
1913 esac
1914
1915 : Find the path to the source tree
1916 case "$src" in
1917 '') case "$0" in
1918     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1919          case "$src" in
1920          /*)    ;;
1921          .)     ;;
1922          *)     src=`cd ../$src && pwd` ;;
1923          esac
1924          ;;
1925     *)   src='.';;
1926     esac;;
1927 esac
1928 case "$src" in
1929 '')     src=/
1930         rsrc=/
1931         ;;
1932 /*)     rsrc="$src";;
1933 *)      rsrc="../$src";;
1934 esac
1935 if test -f $rsrc/Configure && \
1936         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1937 then
1938    : found it, so we are ok.
1939 else
1940         rsrc=''
1941         for src in . .. ../.. ../../.. ../../../..; do
1942                 if test -f ../$src/Configure && \
1943                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1944                 then
1945                         rsrc=../$src
1946                         break
1947                 fi
1948         done
1949 fi
1950 case "$rsrc" in
1951 '')
1952         cat <<EOM >&4
1953
1954 Sorry, I can't seem to locate the source dir for $package.  Please start
1955 Configure with an explicit path -- i.e. /some/path/Configure.
1956
1957 EOM
1958         exit 1
1959         ;;
1960 ../.)   rsrc='..';;
1961 *)
1962         echo " "
1963         echo "Sources for $package found in \"$src\"." >&4
1964         ;;
1965 esac
1966
1967 : script used to extract .SH files with variable substitutions
1968 cat >extract <<'EOS'
1969 PERL_CONFIG_SH=true
1970 echo "Doing variable substitutions on .SH files..."
1971 if test -f MANIFEST; then
1972         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1973 else
1974         echo "(Looking for .SH files under the source directory.)"
1975         set x `(cd "$src"; find . -name "*.SH" -print)`
1976 fi
1977 shift
1978 case $# in
1979 0) set x `(cd "$src"; echo *.SH)`; shift;;
1980 esac
1981 if test ! -f "$src/$1"; then
1982         shift
1983 fi
1984 mkdir_p='
1985 name=$1;
1986 create="";
1987 while test $name; do
1988         if test ! -d "$name"; then
1989                 create="$name $create";
1990                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1991                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1992         else
1993                 name="";
1994         fi;
1995 done;
1996 for file in $create; do
1997         mkdir $file;
1998 done
1999 '
2000 for file in $*; do
2001         case "$src" in
2002         ".")
2003                 case "$file" in
2004                 */*)
2005                         dir=`expr X$file : 'X\(.*\)/'`
2006                         file=`expr X$file : 'X.*/\(.*\)'`
2007                         (cd "$dir" && . ./$file)
2008                         ;;
2009                 *)
2010                         . ./$file
2011                         ;;
2012                 esac
2013                 ;;
2014         *)
2015                 case "$file" in
2016                 */*)
2017                         dir=`expr X$file : 'X\(.*\)/'`
2018                         file=`expr X$file : 'X.*/\(.*\)'`
2019                         (set x $dir; shift; eval $mkdir_p)
2020                         sh <"$src/$dir/$file"
2021                         ;;
2022                 *)
2023                         sh <"$src/$file"
2024                         ;;
2025                 esac
2026                 ;;
2027         esac
2028 done
2029 if test -f "$src/config_h.SH"; then
2030         if test ! -f config.h; then
2031         : oops, they left it out of MANIFEST, probably, so do it anyway.
2032         . "$src/config_h.SH"
2033         fi
2034 fi
2035 EOS
2036
2037 : extract files and exit if asked to do so
2038 case "$extractsh" in
2039 true)
2040         case "$realsilent" in
2041         true) ;;
2042         *) exec 1>&4;;
2043         esac
2044         case "$config_sh" in
2045         '') config_sh='config.sh';;
2046         esac
2047         echo " "
2048         echo "Fetching answers from $config_sh..."
2049         cd ..
2050         . $config_sh
2051         . UU/optdef.sh
2052         echo " "
2053         . UU/extract
2054         rm -rf UU
2055         echo "Extraction done."
2056         exit 0
2057         ;;
2058 esac
2059
2060 : Eunice requires " " instead of "", can you believe it
2061 echo " "
2062 : Here we go...
2063 echo "Beginning of configuration questions for $package."
2064
2065 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2066
2067 : first determine how to suppress newline on echo command
2068 echo " "
2069 echo "Checking echo to see how to suppress newlines..."
2070 (echo "hi there\c" ; echo " ") >.echotmp
2071 if $contains c .echotmp >/dev/null 2>&1 ; then
2072         echo "...using -n."
2073         n='-n'
2074         c=''
2075 else
2076         cat <<'EOM'
2077 ...using \c
2078 EOM
2079         n=''
2080         c='\c'
2081 fi
2082 echo $n "The star should be here-->$c"
2083 echo '*'
2084 rm -f .echotmp
2085
2086 : Now test for existence of everything in MANIFEST
2087 echo " "
2088 if test -f "$rsrc/MANIFEST"; then
2089         echo "First let's make sure your kit is complete.  Checking..." >&4
2090         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2091                 (split -l 50 2>/dev/null || split -50)
2092         rm -f missing
2093         tmppwd=`pwd`
2094         for filelist in x??; do
2095                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2096                         >/dev/null 2>>"$tmppwd/missing")
2097         done
2098         if test -s missing; then
2099                 cat missing >&4
2100                 cat >&4 <<'EOM'
2101
2102 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2103
2104 You have the option of continuing the configuration process, despite the
2105 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2106 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2107 and contact the author (perlbug@perl.org).
2108
2109 EOM
2110                 echo $n "Continue? [n] $c" >&4
2111                 read ans
2112                 case "$ans" in
2113                 y*)
2114                         echo "Continuing..." >&4
2115                         rm -f missing
2116                         ;;
2117                 *)
2118                         echo "ABORTING..." >&4
2119                         kill $$
2120                         ;;
2121                 esac
2122         else
2123                 echo "Looks good..."
2124         fi
2125 else
2126         echo "There is no MANIFEST file.  I hope your kit is complete !"
2127 fi
2128 rm -f missing x??
2129
2130 : Find the appropriate value for a newline for tr
2131 if test -n "$DJGPP"; then
2132        trnl='\012'
2133 fi
2134 if test X"$trnl" = X; then
2135         case "`echo foo | tr '\n' x 2>/dev/null`" in
2136         foox) trnl='\n' ;;
2137         esac
2138 fi
2139 if test X"$trnl" = X; then
2140         case "`echo foo | tr '\012' x 2>/dev/null`" in
2141         foox) trnl='\012' ;;
2142         esac
2143 fi
2144 if test X"$trnl" = X; then
2145        case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
2146        fooxy) trnl='\n\r' ;;
2147        esac
2148 fi
2149 if test X"$trnl" = X; then
2150         cat <<EOM >&2
2151
2152 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2153
2154 EOM
2155         exit 1
2156 fi
2157
2158 : compute the number of columns on the terminal for proper question formatting
2159 case "$COLUMNS" in
2160 '') COLUMNS='80';;
2161 esac
2162
2163 : set up the echo used in my read
2164 myecho="case \"\$xxxm\" in
2165 '') echo $n \"\$rp $c\" >&4;;
2166 *) case \"\$rp\" in
2167         '') echo $n \"[\$xxxm] $c\";;
2168         *)
2169                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2170                         echo \"\$rp\" >&4
2171                         echo $n \"[\$xxxm] $c\" >&4
2172                 else
2173                         echo $n \"\$rp [\$xxxm] $c\" >&4
2174                 fi
2175                 ;;
2176         esac;;
2177 esac"
2178
2179 : now set up to do reads with possible shell escape and default assignment
2180 cat <<EOSC >myread
2181 $startsh
2182 xxxm=\$dflt
2183 $myecho
2184 ans='!'
2185 case "\$fastread" in
2186 yes) case "\$dflt" in
2187         '') ;;
2188         *) ans='';
2189                 case "\$silent-\$rp" in
2190                 true-) ;;
2191                 *) echo " " >&4;;
2192                 esac;;
2193         esac;;
2194 *) case "\$silent" in
2195         true) case "\$rp" in
2196                 '') ans='';;
2197                 esac;;
2198         esac;;
2199 esac
2200 while expr "X\$ans" : "X!" >/dev/null; do
2201         read answ
2202         set x \$xxxm
2203         shift
2204         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2205         case  "\$answ" in
2206         "!")
2207                 sh 1>&4
2208                 echo " "
2209                 $myecho
2210                 ;;
2211         !*)
2212                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2213                 shift
2214                 sh 1>&4 -c "\$*"
2215                 echo " "
2216                 $myecho
2217                 ;;
2218         "\$ans")
2219                 case "\$ans" in
2220                 \\&*)
2221                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2222                         shift
2223                         case "\$1" in
2224                         -d)
2225                                 fastread=yes
2226                                 echo "(OK, I'll run with -d after this question.)" >&4
2227                                 ;;
2228                         -*)
2229                                 echo "*** Sorry, \$1 not supported yet." >&4
2230                                 ;;
2231                         esac
2232                         $myecho
2233                         ans=!
2234                         ;;
2235                 esac;;
2236         *)
2237                 case "\$aok" in
2238                 y)
2239                         echo "*** Substitution done -- please confirm."
2240                         xxxm="\$ans"
2241                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2242                         xxxm="\$ans"
2243                         ans=!
2244                         ;;
2245                 *)
2246                         echo "*** Error -- try again."
2247                         ans=!
2248                         ;;
2249                 esac
2250                 $myecho
2251                 ;;
2252         esac
2253         case "\$ans\$xxxm\$nostick" in
2254         '')
2255                 ans=!
2256                 $myecho
2257                 ;;
2258         esac
2259 done
2260 case "\$ans" in
2261 '') ans="\$xxxm";;
2262 esac
2263 EOSC
2264
2265 : create .config dir to save info across Configure sessions
2266 test -d ../.config || mkdir ../.config
2267 cat >../.config/README <<EOF
2268 This directory created by Configure to save information that should
2269 persist across sessions for $package.
2270
2271 You may safely delete it if you wish.
2272 EOF
2273
2274 : See if we are using a devel version and want that
2275 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2276 case "$usedevel" in
2277 $define|true|[yY]*)
2278     usedevel="$define" ;;
2279 *) case "$xversion" in
2280    *[13579])
2281         cat >&4 <<EOH
2282 *** WHOA THERE!!! ***
2283
2284     This is an UNSTABLE DEVELOPMENT release.
2285     The version of this $package distribution is $xversion, that is, odd,
2286     (as opposed to even) and that signifies a development release.
2287     If you want a maintenance release, you want an even-numbered version.
2288
2289     Do ***NOT*** install this into production use.
2290     Data corruption and crashes are possible.
2291
2292     It is most seriously suggested that you do not continue any further
2293     unless you want to help in developing and debugging Perl.
2294
2295     If you *still* want to build perl, you can answer 'y' now,
2296     or pass -Dusedevel to Configure.
2297
2298 EOH
2299         rp='Do you really want to continue?'
2300         dflt='n'
2301         . ./myread
2302         case "$ans" in
2303         [yY]) echo >&4 "Okay, continuing."
2304               usedevel="$define" ;;
2305         *) echo >&4 "Okay, bye."
2306            exit 1
2307            ;;
2308         esac
2309         ;;
2310     esac
2311     usedevel="$undef"
2312     ;;
2313 esac
2314 case "$usedevel" in
2315 $define|true|[yY]*)
2316         case "$versiononly" in
2317         '') versiononly="$define" ;;
2318         esac
2319         case "$installusrbinperl" in
2320         '') installusrbinperl="$undef" ;;
2321         esac
2322         ;;
2323 esac
2324
2325 : general instructions
2326 needman=true
2327 firsttime=true
2328 user=`(logname) 2>/dev/null`
2329 case "$user" in
2330 '') user=`whoami 2>&1`;;
2331 esac
2332 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2333         firsttime=false
2334         echo " "
2335         rp='Would you like to see the instructions?'
2336         dflt=n
2337         . ./myread
2338         case "$ans" in
2339         [yY]*) ;;
2340         *) needman=false;;
2341         esac
2342 fi
2343 if $needman; then
2344         cat <<EOH
2345
2346 This installation shell script will examine your system and ask you questions
2347 to determine how the perl5 package should be installed. If you get
2348 stuck on a question, you may use a ! shell escape to start a subshell or
2349 execute a command.  Many of the questions will have default answers in square
2350 brackets; typing carriage return will give you the default.
2351
2352 On some of the questions which ask for file or directory names you are allowed
2353 to use the ~name construct to specify the login directory belonging to "name",
2354 even if you don't have a shell which knows about that.  Questions where this is
2355 allowed will be marked "(~name ok)".
2356
2357 EOH
2358         rp=''
2359         dflt='Type carriage return to continue'
2360         . ./myread
2361         cat <<'EOH'
2362
2363 The prompter used in this script allows you to use shell variables and
2364 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2365 in the default answer, as if the default line was a set of arguments given to a
2366 script shell.  This means you may also use $* to repeat the whole default line,
2367 so you do not have to re-type everything to add something to the default.
2368
2369 Every time there is a substitution, you will have to confirm.  If there is an
2370 error (e.g. an unmatched backtick), the default answer will remain unchanged
2371 and you will be prompted again.
2372
2373 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2374 the questions and use the computed defaults (or the previous answers if there
2375 was already a config.sh file). Type 'Configure -h' for a list of options.
2376 You may also start interactively and then answer '& -d' at any prompt to turn
2377 on the non-interactive behaviour for the remainder of the execution.
2378
2379 EOH
2380         . ./myread
2381         cat <<EOH
2382
2383 Much effort has been expended to ensure that this shell script will run on any
2384 Unix system.  If despite that it blows up on yours, your best bet is to edit
2385 Configure and run it again.  If you can't run Configure for some reason,
2386 you'll have to generate a config.sh file by hand.  Whatever problems you
2387 have, let me (perlbug@perl.org) know how I blew it.
2388
2389 This installation script affects things in two ways:
2390
2391 1) it may do direct variable substitutions on some of the files included
2392    in this kit.
2393 2) it builds a config.h file for inclusion in C programs.  You may edit
2394    any of these files as the need arises after running this script.
2395
2396 If you make a mistake on a question, there is no easy way to back up to it
2397 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2398 files.  Configure will offer to let you do this before it runs the SH files.
2399
2400 EOH
2401         dflt='Type carriage return to continue'
2402         . ./myread
2403         case "$firsttime" in
2404         true) echo $user >>../.config/instruct;;
2405         esac
2406 fi
2407
2408 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2409 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2410 if test "X$sysroot" = X; then
2411     sysroot=""
2412 else
2413     case "$cc" in
2414         *gcc*|*g++*)
2415             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2416             # _sysroot is used in places where we need --sysroot=foo
2417             # but using the rest of the flags could cause issues.
2418             _sysroot="--sysroot=$sysroot";
2419             case "$ccflags" in
2420                 *sysroot*) ;;
2421                 'undef'|*)
2422                 ccflags="$ccflags $_sysroot"
2423             esac
2424             case "$ldflags" in
2425                 *sysroot*) ;;
2426                 'undef'|*)
2427                 ldflags="$ldflags $_sysroot"
2428             esac
2429             case "$cppflags" in
2430                 *sysroot*) ;;
2431                 'undef'|*)
2432                 cppflags="$cppflags $_sysroot"
2433             esac
2434             # lddlflags updated below in lddlflags section;
2435             # same with cccdlflags
2436             ;;
2437     esac
2438
2439     # Adjust some defaults to also use $sysroot
2440     for var in xlibpth loclibpth locincpth glibpth; do
2441         eval xxx=\$$var
2442         eval $var=''
2443         for path in $xxx; do
2444             eval $var=\"\$$var $sysroot$path\"
2445         done
2446     done
2447
2448 fi
2449
2450 : find out where common programs are
2451 echo " "
2452 echo "Locating common programs..." >&4
2453 cat <<EOSC >loc
2454 $startsh
2455 case \$# in
2456 0) exit 1;;
2457 esac
2458 thing=\$1
2459 shift
2460 dflt=\$1
2461 shift
2462 for dir in \$*; do
2463         case "\$thing" in
2464         .)
2465         if test -d \$dir/\$thing; then
2466                 echo \$dir
2467                 exit 0
2468         fi
2469         ;;
2470         *)
2471         for thisthing in \$dir/\$thing; do
2472                 : just loop through to pick last item
2473         done
2474         if test -f \$thisthing; then
2475                 echo \$thisthing
2476                 exit 0
2477         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2478                 echo \$thisthing
2479                 exit 0
2480         elif test -f \$dir/\$thing.exe; then
2481                 if test -n "$DJGPP"; then
2482                         echo \$dir/\$thing.exe
2483                 elif test "$eunicefix" != ":"; then
2484                         : on Eunice apparently
2485                         echo \$dir/\$thing
2486                 fi
2487                 exit 0
2488         fi
2489         ;;
2490         esac
2491 done
2492 echo \$dflt
2493 exit 1
2494 EOSC
2495 chmod +x loc
2496 $eunicefix loc
2497 loclist="
2498 awk
2499 cat
2500 chmod
2501 comm
2502 cp
2503 echo
2504 expr
2505 grep
2506 ls
2507 mkdir
2508 rm
2509 sed
2510 sort
2511 touch
2512 tr
2513 uniq
2514 "
2515 trylist="
2516 ar
2517 bison
2518 byacc
2519 cpp
2520 csh
2521 date
2522 egrep
2523 gmake
2524 gzip
2525 less
2526 ln
2527 make
2528 more
2529 nm
2530 nroff
2531 perl
2532 pg
2533 test
2534 uname
2535 zip
2536 "
2537 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2538 pth="$pth $sysroot/lib $sysroot/usr/lib"
2539 for file in $loclist; do
2540         eval xxx=\$$file
2541         case "$xxx" in
2542         /*|?:[\\/]*)
2543                 if test -f "$xxx"; then
2544                         : ok
2545                 else
2546                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2547                         xxx=`./loc $file $file $pth`
2548                 fi
2549                 ;;
2550         '') xxx=`./loc $file $file $pth`;;
2551         *) xxx=`./loc $xxx $xxx $pth`;;
2552         esac
2553         eval $file=$xxx$_exe
2554         eval _$file=$xxx
2555         case "$xxx" in
2556         /*)
2557                 echo $file is in $xxx.
2558                 ;;
2559         ?:[\\/]*)
2560                 echo $file is in $xxx.
2561                 ;;
2562         *)
2563                 echo "I don't know where '$file' is, and my life depends on it." >&4
2564                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2565                 exit 1
2566                 ;;
2567         esac
2568 done
2569 echo " "
2570 echo "Don't worry if any of the following aren't found..."
2571 say=offhand
2572 for file in $trylist; do
2573         eval xxx=\$$file
2574         case "$xxx" in
2575         /*|?:[\\/]*)
2576                 if test -f "$xxx"; then
2577                         : ok
2578                 else
2579                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2580                         xxx=`./loc $file $file $pth`
2581                 fi
2582                 ;;
2583         '') xxx=`./loc $file $file $pth`;;
2584         *) xxx=`./loc $xxx $xxx $pth`;;
2585         esac
2586         eval $file=$xxx$_exe
2587         eval _$file=$xxx
2588         case "$xxx" in
2589         /*)
2590                 echo $file is in $xxx.
2591                 ;;
2592         ?:[\\/]*)
2593                 echo $file is in $xxx.
2594                 ;;
2595         *)
2596                 echo "I don't see $file out there, $say."
2597                 say=either
2598                 ;;
2599         esac
2600 done
2601 case "$egrep" in
2602 egrep)
2603         echo "Substituting grep for egrep."
2604         egrep=$grep
2605         _egrep=$grep
2606         ;;
2607 esac
2608 case "$less" in
2609 '')     ;;
2610 *)      if $less -R </dev/null >/dev/null 2>&1; then
2611                echo "Substituting less -R for less."
2612                less="$less -R"
2613                _less=$less
2614         fi
2615         ;;
2616 esac
2617 case "$ln" in
2618 ln)
2619         echo "Substituting cp for ln."
2620         ln=$cp
2621         _ln=$cp
2622         ;;
2623 esac
2624 case "$make" in
2625 make)
2626         case "$gmake" in
2627         gmake)
2628         echo "I can't find make or gmake, and my life depends on it." >&4
2629         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2630         exit 1
2631         ;;
2632         esac
2633         ;;
2634 esac
2635 case "$gmake" in
2636 gmake)  ;;
2637 *)      # We can't have osname yet.
2638         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2639                 # Assume that gmake, if found, is definitely GNU make
2640                 # and prefer it over the system make.
2641                 echo "Substituting gmake for make."
2642                 make=$gmake
2643                 _make=$gmake
2644         fi
2645         ;;
2646 esac
2647 case "$test" in
2648 test)
2649         echo "Hopefully test is built into your sh."
2650         ;;
2651 *)
2652         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2653                 echo "Using the test built into your sh."
2654                 test=test
2655                 _test=test
2656         fi
2657         ;;
2658 esac
2659 case "$echo" in
2660 echo)
2661         echo "Hopefully echo is built into your sh."
2662         ;;
2663 '') ;;
2664 *)
2665         echo " "
2666 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2667         $echo $n "hi there$c" >foo1
2668         echo $n "hi there$c" >foo2
2669         if cmp foo1 foo2 >/dev/null 2>&1; then
2670                 echo "They are compatible.  In fact, they may be identical."
2671         else
2672                 case "$n" in
2673                 '-n') n='' c='\c';;
2674                 *) n='-n' c='';;
2675                 esac
2676                 cat <<FOO
2677 They are not compatible!  You are probably running ksh on a non-USG system.
2678 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2679 have echo built in and we may have to run some Bourne shell scripts.  That
2680 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2681
2682 FOO
2683                 $echo $n "The star should be here-->$c"
2684                 $echo "*"
2685         fi
2686         $rm -f foo1 foo2
2687         ;;
2688 esac
2689
2690 # This question was auctioned at YAPC::Europe-2007 in Vienna
2691 # I never promised you could answer it. I only auctioned the question.
2692 cat <<FOO
2693 The following message is sponsored by
2694
2695   Dresden.pm<--The stars should be here.
2696
2697 Dear Perl user, system administrator or package
2698 maintainer, the Perl community sends greetings to
2699 you. Do you (emblematical) greet back [Y/n]? n
2700
2701 FOO
2702
2703 : Check what type of C compiler we use
2704 cat <<EOS >trygcc
2705 $startsh
2706 EOS
2707 cat <<'EOSC' >>trygcc
2708 case "$cc" in
2709 '') ;;
2710 *)  $rm -f try try.*
2711     $cat >try.c <<EOM
2712 int main(int argc, char *argv[]) {
2713   return 0;
2714 }
2715 EOM
2716     if $cc -o try $ccflags $ldflags try.c; then
2717        :
2718     else
2719         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2720         despair=yes
2721         trygcc=yes
2722         case "$cc" in
2723         *gcc*) trygcc=no ;;
2724         esac
2725         # Skip this test because it gives a false match on output like:
2726         #    ./trygcc: line 23: cc: command not found
2727         # case "`$cc -v -c try.c 2>&1`" in
2728         # *gcc*) trygcc=no ;;
2729         # esac
2730         if $test X"$trygcc" = Xyes; then
2731             if gcc -o try -c try.c; then
2732                 echo " "
2733                 echo "You seem to have a working gcc, though." >&4
2734                 # Switching compilers may undo the work of hints files.
2735                 # The most common problem is -D_REENTRANT for threads.
2736                 # This heuristic catches that case, but gets false positives
2737                 # if -Dusethreads was not actually specified.  Better to
2738                 # bail out here with a useful message than fail
2739                 # mysteriously later. Should we perhaps just try to
2740                 # re-invoke Configure -Dcc=gcc config_args ?
2741                 if $test -f usethreads.cbu; then
2742                         $cat >&4 <<EOM
2743
2744 *** However, any setting of the C compiler flags (e.g. for thread support)
2745 *** will be lost.  It may be necessary for you to restart Configure and
2746 *** add -Dcc=gcc to your Configure command line.
2747
2748 EOM
2749                         rp="Would you like to go ahead and try gcc anyway?"
2750                         dflt=n
2751                 else
2752                         rp="Would you like to use it?"
2753                         dflt=y
2754                 fi
2755                 if $test -f myread; then
2756                     . ./myread
2757                 else
2758                     if $test -f UU/myread; then
2759                         . ./UU/myread
2760                     else
2761                         echo "Cannot find myread, sorry.  Aborting." >&2
2762                         exit 1
2763                     fi
2764                 fi
2765                 case "$ans" in
2766                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2767                 esac
2768             fi
2769         fi
2770     fi
2771     $rm -f try try.*
2772     ;;
2773 esac
2774 EOSC
2775
2776 cat <<EOS >checkcc
2777 $startsh
2778 EOS
2779 cat <<'EOSC' >>checkcc
2780 case "$cc" in
2781 '') ;;
2782 *)  $rm -f try try.*
2783     $cat >try.c <<EOM
2784 int main(int argc, char *argv[]) {
2785   return 0;
2786 }
2787 EOM
2788     if $cc -o try $ccflags $ldflags try.c; then
2789        :
2790     else
2791         if $test X"$despair" = Xyes; then
2792            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2793         fi
2794         $cat >&4 <<EOM
2795 You need to find a working C compiler.
2796 Either (purchase and) install the C compiler supplied by your OS vendor,
2797 or for a free C compiler try http://gcc.gnu.org/
2798 I cannot continue any further, aborting.
2799 EOM
2800         exit 1
2801     fi
2802     $rm -f try try.*
2803     ;;
2804 esac
2805 EOSC
2806
2807 : determine whether symbolic links are supported
2808 echo " "
2809 $touch blurfl
2810 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2811         echo "Symbolic links are supported." >&4
2812         lns="$ln -s"
2813 else
2814         echo "Symbolic links are NOT supported." >&4
2815         lns="$ln"
2816 fi
2817 $rm -f blurfl sym
2818
2819 : determine whether symbolic links are supported
2820 echo " "
2821 case "$lns" in
2822 *"ln"*" -s")
2823         echo "Checking how to test for symbolic links..." >&4
2824         $lns blurfl sym
2825         if $test "X$issymlink" = X; then
2826                 case "$newsh" in
2827                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2828                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2829                 esac
2830                 if test $? = 0; then
2831                         issymlink="test -h"
2832                 else
2833                         echo "Your builtin 'test -h' may be broken." >&4
2834                         case "$test" in
2835                         /*)     ;;
2836                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2837                                 for p in $pth
2838                                 do
2839                                         if test -f "$p/$test"; then
2840                                                 test="$p/$test"
2841                                                 break
2842                                         fi
2843                                 done
2844                                 ;;
2845                         esac
2846                         case "$test" in
2847                         /*)
2848                                 echo "Trying external '$test -h'." >&4
2849                                 issymlink="$test -h"
2850                                 if $test ! -h sym >/dev/null 2>&1; then
2851                                         echo "External '$test -h' is broken, too." >&4
2852                                         issymlink=''
2853                                 fi
2854                                 ;;
2855                         *)      issymlink='' ;;
2856                         esac
2857                 fi
2858         fi
2859         if $test "X$issymlink" = X; then
2860                 if $test -L sym 2>/dev/null; then
2861                         issymlink="$test -L"
2862                         echo "The builtin '$test -L' worked." >&4
2863                 fi
2864         fi
2865         if $test "X$issymlink" != X; then
2866                 echo "You can test for symbolic links with '$issymlink'." >&4
2867         else
2868                 echo "I do not know how you can test for symbolic links." >&4
2869         fi
2870         $rm -f blurfl sym
2871         ;;
2872 *)      echo "No symbolic links, so not testing for their testing..." >&4
2873         ;;
2874 esac
2875
2876 : Make symlinks util
2877 case "$mksymlinks" in
2878 $define|true|[yY]*)
2879         case "$src" in
2880         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2881                 exit 1
2882                 ;;
2883         *)      case "$lns:$issymlink" in
2884                 *"ln"*" -s:"*"test -"?)
2885                         echo "Creating the symbolic links..." >&4
2886                         cd ..
2887                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2888                         awk 'NF == 1 {
2889                                 dir=".";
2890                                 file=$1 "";
2891                              }
2892                              NF == 2 {
2893                                 dir=$1 "";
2894                                 file=$2 "";
2895                              }
2896                              {
2897                                  print "# dir = ", dir, "file = ", file
2898                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2899                              } END {
2900                                  for (d in mf) {
2901                                      if (d != ".") { print("mkdir -p "d) }
2902                                      print("ln -sf "mf[d]" "d);
2903                                  }
2904                              }' source="$src" > UU/mksymlinks.$$
2905                         sh UU/mksymlinks.$$
2906                         rm UU/mksymlinks.$$
2907                         # Sanity check 1.
2908                         if test ! -d t/base; then
2909                                 echo "Failed to create the subdirectories.  Aborting." >&4
2910                                 exit 1
2911                         fi
2912                         # Sanity check 2.
2913                         if test ! -f t/base/lex.t; then
2914                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2915                                 exit 1
2916                         fi
2917                         if test ! -f win32/win32.c; then
2918                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2919                                 exit 1
2920                         fi
2921                         cd UU
2922                         ;;
2923                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2924                         ;;
2925                 esac
2926                 ;;
2927         esac
2928         ;;
2929 esac
2930
2931 : Check for Cross-Compilation
2932 if $test "X$targethost" = "X"; then
2933     targethost=""
2934 fi
2935 if $test "X$targetenv" = "X"; then
2936     targetenv=""
2937 fi
2938 case "$usecrosscompile" in
2939 $define|true|[yY]*)
2940         $echo "Cross-compiling..."
2941         croak=''
2942         case "$cc" in
2943         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2944             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2945             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2946             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2947             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2948             # leave out ld, choosing it is more complex
2949             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2950             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2951             # We are in a weird spot. Just before us, some values
2952             # were 'saved', to be restored after the hints are
2953             # run.  This means that the changes we made to ar,
2954             # nm and ranlib will get reverted.
2955             # To avoid that, we hijack the saving mechanism and
2956             # have it save our new values.
2957             for file in ar nm ranlib; do
2958                 eval xxx=\$$file
2959                 eval $file=$xxx$_exe
2960                 eval _$file=$xxx
2961             done
2962         ;;
2963         esac
2964         case "$targetarch" in
2965         '') echo "Targetarch not defined." >&4; croak=y ;;
2966         *)  echo "Using targetarch $targetarch." >&4 ;;
2967         esac
2968         case "$targethost" in
2969         '') echo "Targethost not defined." >&4; croak=n ;;
2970         *)  echo "Using targethost $targethost." >&4
2971         esac
2972         locincpth=' '
2973         loclibpth=' '
2974         case "$croak" in
2975         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2976         esac
2977     : compile a host miniperl and generate_uudmap, unless we got passed them
2978     if $test "X$hostperl" = X; then
2979       echo "Building host miniperl and generate_uudmap binaries" >&4
2980       before_host=`pwd`
2981       cd ..
2982       cd $src
2983       src=`pwd`
2984       rm -rf $src/host
2985       mkdir $src/host
2986       cd $src/host
2987       $src/Configure -des -Dusedevel -Dmksymlinks
2988       $make miniperl
2989       case "$hostgenerate" in
2990       '') $make generate_uudmap
2991           hostgenerate=$src/host/generate_uudmap
2992           ;;
2993        "$undef") hostgenerate=''
2994           ;;
2995       esac
2996       hostperl=$src/host/miniperl
2997       cd $before_host
2998     fi
2999     hostosname=`$hostperl -le 'print $^O'`
3000     ;;
3001 *)
3002     usecrosscompile="$undef"
3003     ;;
3004 esac
3005
3006 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3007 case "$targethost" in
3008     '') echo "Checking for cross-compile" >&4
3009     case "$usecrosscompile$multiarch" in
3010        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3011          if [ -f Makefile ]; then
3012            echo " "
3013            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3014          else
3015            echo "Configure done."
3016          fi
3017        exit 0
3018        ;;
3019      *) echo "No targethost for running compiler tests against defined, running locally" >&4
3020         run=''
3021         to=:
3022         from=:
3023         ;;
3024     esac
3025     ;;
3026     *) echo "Using targethost $targethost." >&4
3027         case "$src" in
3028         /*) run=$src/Cross/run
3029             targetmkdir=$src/Cross/mkdir
3030             to=$src/Cross/to
3031             from=$src/Cross/from
3032             ;;
3033         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3034             run=$pwd/Cross/run
3035             targetmkdir=$pwd/Cross/mkdir
3036             to=$pwd/Cross/to
3037             from=$pwd/Cross/from
3038             ;;
3039         esac
3040         case "$targetrun" in
3041         '') targetrun=ssh ;;
3042         esac
3043         case "$targetto" in
3044         '') targetto=scp ;;
3045         esac
3046         case "$targetfrom" in
3047         '') targetfrom=scp ;;
3048         esac
3049         run=$run-$targetrun
3050         to=$to-$targetto
3051         from=$from-$targetfrom
3052         case "$targetdir" in
3053         '')  targetdir=/tmp
3054              echo "Guessing targetdir $targetdir." >&4
3055              ;;
3056         esac
3057         case "$targetuser" in
3058         '')  targetuser=root
3059              echo "Guessing targetuser $targetuser." >&4
3060              ;;
3061         esac
3062         case "$targetport" in
3063         '')  targetport=22
3064              echo "Guessing targetport $targetport." >&4
3065              ;;
3066         esac
3067         case "$targetfrom" in
3068         scp)    q=-q ;;
3069         *)      q='' ;;
3070         esac
3071         case "$targetrun" in
3072         ssh|rsh)
3073             cat >$run <<EOF
3074 #!/bin/sh
3075 env=''
3076 case "\$1" in
3077 -cwd)
3078   shift
3079   cwd=\$1
3080   shift
3081   ;;
3082 esac
3083 case "\$1" in
3084 -env)
3085   shift
3086   env=\$1
3087   shift
3088   ;;
3089 esac
3090 case "\$cwd" in
3091 '') cwd=$targetdir ;;
3092 esac
3093 exe=\$1
3094 shift
3095 $to \$exe
3096 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3097 EOF
3098             ;;
3099         adb)
3100             $touch $run
3101             ;;
3102         *)  echo "Unknown targetrun '$targetrun'" >&4
3103             exit 1
3104             ;;
3105         esac
3106         case "$targetmkdir" in
3107         */Cross/mkdir)
3108             cat >$targetmkdir <<EOF
3109 #!/bin/sh
3110 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3111 EOF
3112             $chmod a+rx $targetmkdir
3113             ;;
3114         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3115             exit 1
3116             ;;
3117         esac
3118         case "$targetto" in
3119         scp|rcp)
3120             cat >$to <<EOF
3121 #!/bin/sh
3122 for f in \$@
3123 do
3124   case "\$f" in
3125   /*)
3126     $targetmkdir \`dirname \$f\`
3127     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3128     ;;
3129   *)
3130     $targetmkdir $targetdir/\`dirname \$f\`
3131     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3132     ;;
3133   esac
3134 done
3135 exit 0
3136 EOF
3137             ;;
3138         cp) cat >$to <<EOF
3139 #!/bin/sh
3140 for f in \$@
3141 do
3142   case "\$f" in
3143   /*)
3144     $mkdir -p $targetdir/\`dirname \$f\`
3145     $cp \$f $targetdir/\$f || exit 1
3146     ;;
3147   *)
3148     $targetmkdir $targetdir/\`dirname \$f\`
3149     $cp \$f $targetdir/\$f || exit 1
3150     ;;
3151   esac
3152 done
3153 exit 0
3154 EOF
3155             ;;
3156         *)  echo "Unknown targetto '$targetto'" >&4
3157             exit 1
3158             ;;
3159         esac
3160         case "$targetfrom" in
3161         scp|rcp)
3162           cat >$from <<EOF
3163 #!/bin/sh
3164 for f in \$@
3165 do
3166   $rm -f \$f
3167   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3168 done
3169 exit 0
3170 EOF
3171             ;;
3172         cp) cat >$from <<EOF
3173 #!/bin/sh
3174 for f in \$@
3175 do
3176   $rm -f \$f
3177   cp $targetdir/\$f . || exit 1
3178 done
3179 exit 0
3180 EOF
3181             ;;
3182         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3183             exit 1
3184             ;;
3185         esac
3186         if $test ! -f $run; then
3187             echo "Target 'run' script '$run' not found." >&4
3188         else
3189             $chmod a+rx $run
3190         fi
3191         if $test ! -f $to; then
3192             echo "Target 'to' script '$to' not found." >&4
3193         else
3194             $chmod a+rx $to
3195         fi
3196         if $test ! -f $from; then
3197             echo "Target 'from' script '$from' not found." >&4
3198         else
3199             $chmod a+rx $from
3200         fi
3201         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3202             exit 1
3203         fi
3204         cat >&4 <<EOF
3205 Using '$run' for remote execution,
3206 and '$from' and '$to'
3207 for remote file transfer.
3208 EOF
3209         ;;
3210 *)      run=''
3211         to=:
3212         from=:
3213         usecrosscompile="$undef"
3214         targetarch=''
3215         ;;
3216 esac
3217
3218 : see whether [:lower:] and [:upper:] are supported character classes
3219 echo " "
3220 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3221 ABYZ-abyz)
3222         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3223         up='[:upper:]'
3224         low='[:lower:]'
3225         ;;
3226 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3227         # (0xd9 and 0xe2), therefore that is a nice testing point.
3228         if test "X$up" = X -o "X$low" = X; then
3229             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3230             rs) up='[A-Z]'
3231                 low='[a-z]'
3232                 ;;
3233             esac
3234         fi
3235         if test "X$up" = X -o "X$low" = X; then
3236             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3237             rs) up='A-Z'
3238                 low='a-z'
3239                 ;;
3240             esac
3241         fi
3242         if test "X$up" = X -o "X$low" = X; then
3243             case "`echo RS | od -x 2>/dev/null`" in
3244             *D9E2*|*d9e2*)
3245                 echo "Hey, this might be EBCDIC." >&4
3246                 if test "X$up" = X -o "X$low" = X; then
3247                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3248                     rs) up='[A-IJ-RS-Z]'
3249                         low='[a-ij-rs-z]'
3250                         ;;
3251                     esac
3252                 fi
3253                 if test "X$up" = X -o "X$low" = X; then
3254                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3255                     rs) up='A-IJ-RS-Z'
3256                         low='a-ij-rs-z'
3257                         ;;
3258                     esac
3259                 fi
3260                 ;;
3261             esac
3262         fi
3263 esac
3264 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3265 rs)
3266     echo "Using $up and $low to convert case." >&4
3267     ;;
3268 *)
3269     echo "I don't know how to translate letters from upper to lower case." >&4
3270     echo "Your tr is not acting any way I know of." >&4
3271     exit 1
3272     ;;
3273 esac
3274 : set up the translation script tr, must be called with ./tr of course
3275 cat >tr <<EOSC
3276 $startsh
3277 case "\$1\$2" in
3278 '[A-Z][a-z]') exec $tr '$up' '$low';;
3279 '[a-z][A-Z]') exec $tr '$low' '$up';;
3280 esac
3281 exec $tr "\$@"
3282 EOSC
3283 chmod +x tr
3284 $eunicefix tr
3285
3286 : Try to determine whether config.sh was made on this system
3287 case "$config_sh" in
3288 '')
3289 myuname=`$uname -a 2>/dev/null`
3290 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3291 # Downcase everything to avoid ambiguity.
3292 # Remove slashes and single quotes so we can use parts of this in
3293 # directory and file names.
3294 # Remove newlines so myuname is sane to use elsewhere.
3295 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3296 # because the A-Z/a-z are not consecutive.
3297 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3298         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3299 newmyuname="$myuname"
3300 dflt=n
3301 case "$knowitall" in
3302 '')
3303         if test -f ../config.sh; then
3304                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3305                         eval "`grep myuname= ../config.sh`"
3306                 fi
3307                 if test "X$myuname" = "X$newmyuname"; then
3308                         dflt=y
3309                 fi
3310         fi
3311         ;;
3312 *) dflt=y;;
3313 esac
3314
3315 : Get old answers from old config file if Configure was run on the
3316 : same system, otherwise use the hints.
3317 hint=default
3318 cd ..
3319 if test -f config.sh; then
3320         echo " "
3321         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3322         . UU/myread
3323         case "$ans" in
3324         n*|N*) echo "OK, I'll ignore it."
3325                 mv config.sh config.sh.old
3326                 myuname="$newmyuname"
3327                 ;;
3328         *)  echo "Fetching default answers from your old config.sh file..." >&4
3329                 tmp_n="$n"
3330                 tmp_c="$c"
3331                 tmp_sh="$sh"
3332                 . ./config.sh
3333                 cp config.sh UU
3334                 n="$tmp_n"
3335                 c="$tmp_c"
3336                 : Older versions did not always set $sh.  Catch re-use of such
3337                 : an old config.sh.
3338                 case "$sh" in
3339                 '') sh="$tmp_sh" ;;
3340                 esac
3341                 hint=previous
3342                 ;;
3343         esac
3344 fi
3345 . ./UU/checkcc
3346 if test ! -f config.sh; then
3347         $cat <<EOM
3348
3349 First time through, eh?  I have some defaults handy for some systems
3350 that need some extra help getting the Configure answers right:
3351
3352 EOM
3353         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3354         dflt=''
3355         : Half the following guesses are probably wrong... If you have better
3356         : tests or hints, please send them to perlbug@perl.org
3357         : The metaconfig authors would also appreciate a copy...
3358         $test -f /irix && osname=irix
3359         $test -f /xenix && osname=sco_xenix
3360         $test -f /dynix && osname=dynix
3361         $test -f /dnix && osname=dnix
3362         $test -f /lynx.os && osname=lynxos
3363         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3364         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3365         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3366         $test -f /bin/mips && /bin/mips && osname=mips
3367         $test -d /usr/apollo/bin && osname=apollo
3368         $test -f /etc/saf/_sactab && osname=svr4
3369         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3370         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3371         $test -f /sys/utilities/MultiView && osname=amigaos
3372         if $test -d /MachTen -o -d /MachTen_Folder; then
3373                 osname=machten
3374                 if $test -x /sbin/version; then
3375                         osvers=`/sbin/version | $awk '{print $2}' |
3376                         $sed -e 's/[A-Za-z]$//'`
3377                 elif $test -x /usr/etc/version; then
3378                         osvers=`/usr/etc/version | $awk '{print $2}' |
3379                         $sed -e 's/[A-Za-z]$//'`
3380                 else
3381                         osvers="$2.$3"
3382                 fi
3383         fi
3384
3385         $test -f /sys/posix.dll &&
3386                 $test -f /usr/bin/what &&
3387                 set X `/usr/bin/what /sys/posix.dll` &&
3388                 $test "$3" = UWIN &&
3389                 osname=uwin &&
3390                 osvers="$5"
3391
3392         if $test -f $uname; then
3393                 set X $myuname
3394                 shift
3395
3396                 case "$5" in
3397                 fps*) osname=fps ;;
3398                 mips*)
3399                         case "$4" in
3400                         umips) osname=umips ;;
3401                         *) osname=mips ;;
3402                         esac;;
3403                 [23]100) osname=mips ;;
3404                 i386*)
3405                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3406                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3407                                 osname='sco'
3408                                 osvers=$tmp
3409                         elif $test -f /etc/kconfig; then
3410                                 osname=isc
3411                                 if test "$lns" = "$ln -s"; then
3412                                         osvers=4
3413                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3414                                         osvers=3
3415                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3416                                         osvers=2
3417                                 fi
3418                         fi
3419                         tmp=''
3420                         ;;
3421                 pc*)
3422                         if test -n "$DJGPP"; then
3423                                 osname=dos
3424                                 osvers=djgpp
3425                         fi
3426                         ;;
3427                 esac
3428
3429                 case "$1" in
3430                 aix) osname=aix
3431                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3432                         case "$tmp" in
3433                         # oslevel can fail with:
3434                         # oslevel: Unable to acquire lock.
3435                         *not\ found) osvers="$4"."$3" ;;
3436                         '<3240'|'<>3240') osvers=3.2.0 ;;
3437                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3438                         '=3250'|'>3250') osvers=3.2.5 ;;
3439                         *) osvers=$tmp;;
3440                         esac
3441                         ;;
3442                 bitrig) osname=bitrig
3443                         osvers="$3"
3444                         ;;
3445                 bsd386) osname=bsd386
3446                         osvers=`$uname -r`
3447                         ;;
3448                 cygwin*) osname=cygwin
3449                         osvers="$3"
3450                         ;;
3451                 *dc.osx) osname=dcosx
3452                         osvers="$3"
3453                         ;;
3454                 dnix) osname=dnix
3455                         osvers="$3"
3456                         ;;
3457                 domainos) osname=apollo
3458                         osvers="$3"
3459                         ;;
3460                 dgux)   osname=dgux
3461                         osvers="$3"
3462                         ;;
3463                 dragonfly) osname=dragonfly
3464                         osvers="$3"
3465                         ;;
3466                 dynixptx*) osname=dynixptx
3467                         osvers=`echo "$4"|sed 's/^v//'`
3468                         ;;
3469                 freebsd) osname=freebsd
3470                         osvers="$3" ;;
3471                 genix)  osname=genix ;;
3472                 gnu)    osname=gnu
3473                         osvers="$3" ;;
3474                 hp*)    osname=hpux
3475                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3476                         ;;
3477                 irix*)  osname=irix
3478                         case "$3" in
3479                         4*) osvers=4 ;;
3480                         5*) osvers=5 ;;
3481                         *)      osvers="$3" ;;
3482                         esac
3483                         ;;
3484                 linux)  osname=linux
3485                         case "$3" in
3486                         *)      osvers="$3" ;;
3487                         esac
3488                         $test -f /system/lib/libandroid.so && osname=linux-android
3489                         ;;
3490                 MiNT)   osname=mint
3491                         ;;
3492                 netbsd*) osname=netbsd
3493                         osvers="$3"
3494                         ;;
3495                 news-os) osvers="$3"
3496                         case "$3" in
3497                         4*) osname=newsos4 ;;
3498                         *) osname=newsos ;;
3499                         esac
3500                         ;;
3501                 nonstop-ux) osname=nonstopux ;;
3502                 openbsd) osname=openbsd
3503                         osvers="$3"
3504                         ;;
3505                 os2)    osname=os2
3506                         osvers="$4"
3507                         ;;
3508                 POSIX-BC | posix-bc ) osname=posix-bc
3509                         osvers="$3"
3510                         ;;
3511                 powerux | power_ux | powermax_os | powermaxos | \
3512                 powerunix | power_unix) osname=powerux
3513                         osvers="$3"
3514                         ;;
3515                 qnx) osname=qnx
3516                         osvers="$4"
3517                         ;;
3518                 solaris) osname=solaris
3519                         case "$3" in
3520                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3521                         *)      osvers="$3" ;;
3522                         esac
3523                         ;;
3524                 sunos) osname=sunos
3525                         case "$3" in
3526                         5*) osname=solaris
3527                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3528                         *)      osvers="$3" ;;
3529                         esac
3530                         ;;
3531                 titanos) osname=titanos
3532                         case "$3" in
3533                         1*) osvers=1 ;;
3534                         2*) osvers=2 ;;
3535                         3*) osvers=3 ;;
3536                         4*) osvers=4 ;;
3537                         *)      osvers="$3" ;;
3538                         esac
3539                         ;;
3540                 ultrix) osname=ultrix
3541                         osvers="$3"
3542                         ;;
3543                 osf1|mls+)      case "$5" in
3544                                 alpha)
3545                                         osname=dec_osf
3546                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3547                                         case "$osvers" in
3548                                         [1-9].[0-9]*) ;;
3549                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3550                                         esac
3551                                         ;;
3552                         hp*)    osname=hp_osf1  ;;
3553                         mips)   osname=mips_osf1 ;;
3554                         esac
3555                         ;;
3556                 # UnixWare 7.1.2 is known as Open UNIX 8
3557                 openunix|unixware) osname=svr5
3558                         osvers="$4"
3559                         ;;
3560                 uts)    osname=uts
3561                         osvers="$3"
3562                         ;;
3563                 vos) osvers="$3"
3564                         ;;
3565                 $2) case "$osname" in
3566                         *isc*) ;;
3567                         *freebsd*) ;;
3568                         svr*)
3569                                 : svr4.x or possibly later
3570                                 case "svr$3" in
3571                                 ${osname}*)
3572                                         osname=svr$3
3573                                         osvers=$4
3574                                         ;;
3575                                 esac
3576                                 case "$osname" in
3577                                 svr4.0)
3578                                         : Check for ESIX
3579                                         if test -f /stand/boot ; then
3580                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3581                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3582                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3583                                                         if test -n "$isesix"; then
3584                                                                 osname=esix4
3585                                                         fi
3586                                                 fi
3587                                         fi
3588                                         ;;
3589                                 esac
3590                                 ;;
3591                         *)      if test -f /etc/systemid; then
3592                                         osname=sco
3593                                         set `echo $3 | $sed 's/\./ /g'` $4
3594                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3595                                                 osvers=$1.$2.$3
3596                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3597                                                 osvers=$1.$2
3598                                         elif $test -f $src/hints/sco_$1.sh; then
3599                                                 osvers=$1
3600                                         fi
3601                                 else
3602                                         case "$osname" in
3603                                         '') : Still unknown.  Probably a generic Sys V.
3604                                                 osname="sysv"
3605                                                 osvers="$3"
3606                                                 ;;
3607                                         esac
3608                                 fi
3609                                 ;;
3610                         esac
3611                         ;;
3612                 *)      case "$osname" in
3613                         '') : Still unknown.  Probably a generic BSD.
3614                                 osname="$1"
3615                                 osvers="$3"
3616                                 ;;
3617                         esac
3618                         ;;
3619                 esac
3620         else
3621                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3622                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3623                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3624                                 osname=news_os
3625                         fi
3626                         $rm -f UU/kernel.what
3627                 elif test -d c:/. -o -n "$is_os2" ; then
3628                         set X $myuname
3629                         osname=os2
3630                         osvers="$5"
3631                 fi
3632         fi
3633
3634         case "$targetarch" in
3635         '') ;;
3636         *)  hostarch=$osname
3637             case "$targetarch" in
3638                 nto*|*-nto-*)
3639                     # Will load qnx.sh, which should change osname to nto
3640                     osname=qnx
3641                     osvers=''
3642                     ;;
3643                 *linux-android*)
3644                     # Catch arm-linux-androideabi, mipsel-linux-android,
3645                     # and i686-linux-android
3646                     osname=linux-android
3647                     osvers=''
3648                     ;;
3649                 *linux*)
3650                     # Something like arm-linux-gnueabihf is really just
3651                     # plain linux.
3652                     osname=linux
3653                     osvers=''
3654                     ;;
3655                 *solaris*|*sunos*)
3656                     osname=solaris
3657                     # XXX perhaps we should just assume
3658                     # osvers to be 2, or maybe take the value
3659                     # from targetarch. Using $run before the
3660                     # hints are run is somewhat icky.
3661                     set X `$run $uname -a 2>/dev/null`
3662                     shift
3663                     case "$3" in
3664                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3665                         *)  osvers="$3" ;;
3666                     esac
3667                     ;;
3668                 *)
3669                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3670                     osvers=''
3671                 ;;
3672             esac
3673             ;;
3674         esac
3675
3676         : Now look for a hint file osname_osvers, unless one has been
3677         : specified already.
3678         case "$hintfile" in
3679         ''|' ')
3680                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3681                 : Also try without trailing minor version numbers.
3682                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3683                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3684                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3685                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3686                 case "$file" in
3687                 '') dflt=none ;;
3688                 *)  case "$osvers" in
3689                         '') dflt=$file
3690                                 ;;
3691                         *)  if $test -f $src/hints/$file.sh ; then
3692                                         dflt=$file
3693                                 elif $test -f $src/hints/$xfile.sh ; then
3694                                         dflt=$xfile
3695                                 elif $test -f $src/hints/$xxfile.sh ; then
3696                                         dflt=$xxfile
3697                                 elif $test -f $src/hints/$xxxfile.sh ; then
3698                                         dflt=$xxxfile
3699                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3700                                         dflt=$xxxxfile
3701                                 elif $test -f "$src/hints/${osname}.sh" ; then
3702                                         dflt="${osname}"
3703                                 else
3704                                         dflt=none
3705                                 fi
3706                                 ;;
3707                         esac
3708                         ;;
3709                 esac
3710                 if $test -f Policy.sh ; then
3711                         case "$dflt" in
3712                         *Policy*) ;;
3713                         none) dflt="Policy" ;;
3714                         *) dflt="Policy $dflt" ;;
3715                         esac
3716                 fi
3717                 ;;
3718         *)
3719                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3720                 ;;
3721         esac
3722
3723         if $test -f Policy.sh ; then
3724                 $cat <<EOM
3725
3726 There's also a Policy hint file available, which should make the
3727 site-specific (policy) questions easier to answer.
3728 EOM
3729
3730         fi
3731
3732         $cat <<EOM
3733
3734 You may give one or more space-separated answers, or "none" if appropriate.
3735 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3736 previous run of Configure, you may specify it as well as or instead of
3737 OS-specific hints.  If hints are provided for your OS, you should use them:
3738 although Perl can probably be built without hints on many platforms, using
3739 hints often improve performance and may enable features that Configure can't
3740 set up on its own. If there are no hints that match your OS, specify "none";
3741 DO NOT give a wrong version or a wrong OS.
3742
3743 EOM
3744
3745         rp="Which of these apply, if any?"
3746         . UU/myread
3747         tans=$ans
3748         for file in $tans; do
3749                 if $test X$file = XPolicy -a -f Policy.sh; then
3750                         . Policy.sh
3751                         $cat Policy.sh >> UU/config.sh
3752                 elif $test -f $src/hints/$file.sh; then
3753                         . $src/hints/$file.sh
3754                         $cat $src/hints/$file.sh >> UU/config.sh
3755                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3756                         : nothing
3757                 else
3758                         : Give one chance to correct a possible typo.
3759                         echo "$file.sh does not exist"
3760                         dflt=$file
3761                         rp="hint to use instead?"
3762                         . UU/myread
3763                         for file in $ans; do
3764                                 if $test -f "$src/hints/$file.sh"; then
3765                                         . $src/hints/$file.sh
3766                                         $cat $src/hints/$file.sh >> UU/config.sh
3767                                 elif $test X$ans = X -o X$ans = Xnone ; then
3768                                         : nothing
3769                                 else
3770                                         echo "$file.sh does not exist -- ignored."
3771                                 fi
3772                         done
3773                 fi
3774         done
3775
3776         hint=recommended
3777         : Remember our hint file for later.
3778         if $test -f "$src/hints/$file.sh" ; then
3779                 hintfile="$file"
3780         else
3781                 hintfile=''
3782         fi
3783 fi
3784 cd UU
3785 ;;
3786 *)
3787         echo " "
3788         echo "Fetching default answers from $config_sh..." >&4
3789         tmp_n="$n"
3790         tmp_c="$c"
3791         cd ..
3792         cp $config_sh config.sh 2>/dev/null
3793         chmod +w config.sh
3794         . ./config.sh
3795         cd UU
3796         cp ../config.sh .
3797         n="$tmp_n"
3798         c="$tmp_c"
3799         hint=previous
3800         ;;
3801 esac
3802 . ./optdef.sh
3803
3804 : Restore computed paths
3805 for file in $loclist $trylist; do
3806         eval $file="\$_$file"
3807 done
3808
3809 cat << EOM
3810
3811 Configure uses the operating system name and version to set some defaults.
3812 The default value is probably right if the name rings a bell. Otherwise,
3813 since spelling matters for me, either accept the default or answer "none"
3814 to leave it blank.
3815
3816 EOM
3817 case "$osname" in
3818         ''|' ')
3819                 case "$hintfile" in
3820                 ''|' '|none) dflt=none ;;
3821                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3822                 esac
3823                 ;;
3824         *) dflt="$osname" ;;
3825 esac
3826 rp="Operating system name?"
3827 . ./myread
3828 case "$ans" in
3829 none)  osname='' ;;
3830 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3831 esac
3832 echo " "
3833 case "$osvers" in
3834         ''|' ')
3835                 case "$hintfile" in
3836                 ''|' '|none) dflt=none ;;
3837                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3838                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3839                         case "$dflt" in
3840                         ''|' ') dflt=none ;;
3841                         esac
3842                         ;;
3843                 esac
3844                 ;;
3845         *) dflt="$osvers" ;;
3846 esac
3847 rp="Operating system version?"
3848 . ./myread
3849 case "$ans" in
3850 none)  osvers='' ;;
3851 *) osvers="$ans" ;;
3852 esac
3853
3854
3855 . ./posthint.sh
3856
3857 : who configured the system
3858 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3859 case "$cf_by" in
3860 "")
3861         cf_by=`(logname) 2>/dev/null`
3862         case "$cf_by" in
3863         "")
3864                 cf_by=`(whoami) 2>/dev/null`
3865                 case "$cf_by" in
3866                 "") cf_by=unknown ;;
3867                 esac ;;
3868         esac ;;
3869 esac
3870
3871 : decide how portable to be.  Allow command line overrides.
3872 case "$d_portable" in
3873 "$undef") ;;
3874 *)      d_portable="$define" ;;
3875 esac
3876
3877 : set up shell script to do ~ expansion
3878 cat >filexp <<EOSS
3879 $startsh
3880 : expand filename
3881 case "\$1" in
3882  \~/*|\~)
3883         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3884         ;;
3885  \~*)
3886         if $test -f /bin/csh; then
3887                 /bin/csh -f -c "glob \$1"
3888                 failed=\$?
3889                 echo ""
3890                 exit \$failed
3891         else
3892                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3893                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3894                 if $test ! -d "\$dir"; then
3895                         me=\`basename \$0\`
3896                         echo "\$me: can't locate home directory for: \$name" >&2
3897                         exit 1
3898                 fi
3899                 case "\$1" in
3900                 */*)
3901                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3902                         ;;
3903                 *)
3904                         echo \$dir
3905                         ;;
3906                 esac
3907         fi
3908         ;;
3909 *)
3910         echo \$1
3911         ;;
3912 esac
3913 EOSS
3914 chmod +x filexp
3915 $eunicefix filexp
3916
3917 : now set up to get a file name
3918 cat <<EOS >getfile
3919 $startsh
3920 EOS
3921 cat <<'EOSC' >>getfile
3922 tilde=''
3923 fullpath=''
3924 already=''
3925 skip=''
3926 none_ok=''
3927 exp_file=''
3928 nopath_ok=''
3929 orig_rp="$rp"
3930 orig_dflt="$dflt"
3931 case "$gfpth" in
3932 '') gfpth='.' ;;
3933 esac
3934
3935 case "$fn" in
3936 *\(*)
3937         : getfile will accept an answer from the comma-separated list
3938         : enclosed in parentheses even if it does not meet other criteria.
3939         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3940         fn=`echo $fn | sed 's/(.*)//'`
3941         ;;
3942 esac
3943
3944 case "$fn" in
3945 *:*)
3946         loc_file=`expr $fn : '.*:\(.*\)'`
3947         fn=`expr $fn : '\(.*\):.*'`
3948         ;;
3949 esac
3950
3951 case "$fn" in
3952 *~*) tilde=true;;
3953 esac
3954 case "$fn" in
3955 */*) fullpath=true;;
3956 esac
3957 case "$fn" in
3958 *+*) skip=true;;
3959 esac
3960 case "$fn" in
3961 *n*) none_ok=true;;
3962 esac
3963 case "$fn" in
3964 *e*) exp_file=true;;
3965 esac
3966 case "$fn" in
3967 *p*) nopath_ok=true;;
3968 esac
3969
3970 case "$fn" in
3971 *f*) type='File';;
3972 *d*) type='Directory';;
3973 *l*) type='Locate';;
3974 esac
3975
3976 what="$type"
3977 case "$what" in
3978 Locate) what='File';;
3979 esac
3980
3981 case "$exp_file" in
3982 '')
3983         case "$d_portable" in
3984         "$define") ;;
3985         *) exp_file=true;;
3986         esac
3987         ;;
3988 esac
3989
3990 cd ..
3991 while test "$type"; do
3992         redo=''
3993         rp="$orig_rp"
3994         dflt="$orig_dflt"
3995         case "$tilde" in
3996         true) rp="$rp (~name ok)";;
3997         esac
3998         . UU/myread
3999         if test -f UU/getfile.ok && \
4000                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4001         then
4002                 value="$ans"
4003                 ansexp="$ans"
4004                 break
4005         fi
4006         case "$ans" in
4007         none)
4008                 value=''
4009                 ansexp=''
4010                 case "$none_ok" in
4011                 true) type='';;
4012                 esac
4013                 ;;
4014         *)
4015                 case "$tilde" in
4016                 '') value="$ans"
4017                         ansexp="$ans";;
4018                 *)
4019                         value=`UU/filexp $ans`
4020                         case $? in
4021                         0)
4022                                 if test "$ans" != "$value"; then
4023                                         echo "(That expands to $value on this system.)"
4024                                 fi
4025                                 ;;
4026                         *) value="$ans";;
4027                         esac
4028                         ansexp="$value"
4029                         case "$exp_file" in
4030                         '') value="$ans";;
4031                         esac
4032                         ;;
4033                 esac
4034                 case "$fullpath" in
4035                 true)
4036                         case "$ansexp" in
4037                         /*) value="$ansexp" ;;
4038                         [a-zA-Z]:/*) value="$ansexp" ;;
4039                         *)
4040                                 redo=true
4041                                 case "$already" in
4042                                 true)
4043                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4044                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4045                                         ;;
4046                                 *)
4047                                 echo "Please give a full path name, starting with slash." >&4
4048                                         case "$tilde" in
4049                                         true)
4050                                 echo "Note that using ~name is ok provided it expands well." >&4
4051                                                 already=true
4052                                                 ;;
4053                                         esac
4054                                 esac
4055                                 ;;
4056                         esac
4057                         ;;
4058                 esac
4059                 case "$redo" in
4060                 '')
4061                         case "$type" in
4062                         File)
4063                                 for fp in $gfpth; do
4064                                         if test "X$fp" = X.; then
4065                                             pf="$ansexp"
4066                                         else    
4067                                             pf="$fp/$ansexp"
4068                                         fi
4069                                         if test -f "$pf"; then
4070                                                 type=''
4071                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4072                                         then
4073                                                 echo "($value is not a plain file, but that's ok.)"
4074                                                 type=''
4075                                         fi
4076                                         if test X"$type" = X; then
4077                                             value="$pf"
4078                                             break
4079                                         fi
4080                                 done
4081                                 ;;
4082                         Directory)
4083                                 for fp in $gfpth; do
4084                                         if test "X$fp" = X.; then
4085                                             dir="$ans"
4086                                             direxp="$ansexp"
4087                                         else    
4088                                             dir="$fp/$ansexp"
4089                                             direxp="$fp/$ansexp"
4090                                         fi
4091                                         if test -d "$direxp"; then
4092                                                 type=''
4093                                                 value="$dir"
4094                                                 break
4095                                         fi
4096                                 done
4097                                 ;;
4098                         Locate)
4099                                 if test -d "$ansexp"; then
4100                                         echo "(Looking for $loc_file in directory $value.)"
4101                                         value="$value/$loc_file"
4102                                         ansexp="$ansexp/$loc_file"
4103                                 fi
4104                                 if test -f "$ansexp"; then
4105                                         type=''
4106                                 fi
4107                                 case "$nopath_ok" in
4108                                 true)   case "$value" in
4109                                         */*) ;;
4110                                         *)      echo "Assuming $value will be in people's path."
4111                                                 type=''
4112                                                 ;;
4113                                         esac
4114                                         ;;
4115                                 esac
4116                                 ;;
4117                         esac
4118
4119                         case "$skip" in
4120                         true) type='';
4121                         esac
4122
4123                         case "$type" in
4124                         '') ;;
4125                         *)
4126                                 if test "$fastread" = yes; then
4127                                         dflt=y
4128                                 else
4129                                         dflt=n
4130                                 fi
4131                                 rp="$what $value doesn't exist.  Use that name anyway?"
4132                                 . UU/myread
4133                                 dflt=''
4134                                 case "$ans" in
4135                                 y*) type='';;
4136                                 *) echo " ";;
4137                                 esac
4138                                 ;;
4139                         esac
4140                         ;;
4141                 esac
4142                 ;;
4143         esac
4144 done
4145 cd UU
4146 ans="$value"
4147 rp="$orig_rp"
4148 dflt="$orig_dflt"
4149 rm -f getfile.ok
4150 test "X$gfpthkeep" != Xy && gfpth=""
4151 EOSC
4152
4153 : determine root of directory hierarchy where package will be installed.
4154 case "$prefix" in
4155 '')
4156         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4157         ;;
4158 *?/)
4159         dflt=`echo "$prefix" | sed 's/.$//'`
4160         ;;
4161 *)
4162         dflt="$prefix"
4163         ;;
4164 esac
4165 $cat <<EOM
4166
4167 By default, $package will be installed in $dflt/bin, manual pages
4168 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4169 installation directories. Typically this is something like /usr/local.
4170 If you wish to have binaries under /usr/bin but other parts of the
4171 installation under /usr/local, that's ok: you will be prompted
4172 separately for each of the installation directories, the prefix being
4173 only used to set the defaults.
4174
4175 EOM
4176 fn=d~
4177 rp='Installation prefix to use?'
4178 . ./getfile
4179 oldprefix=''
4180 case "$prefix" in
4181 '') ;;
4182 *)
4183         case "$ans" in
4184         "$prefix") ;;
4185         *) oldprefix="$prefix";;
4186         esac
4187         ;;
4188 esac
4189 prefix="$ans"
4190 prefixexp="$ansexp"
4191
4192 : allow them to override the AFS root
4193 case "$afsroot" in
4194 '')     afsroot=/afs ;;
4195 *)      afsroot=$afsroot ;;
4196 esac
4197
4198 : is AFS running?
4199 echo " "
4200 case "$afs" in
4201 $define|true)   afs=true ;;
4202 $undef|false)   afs=false ;;
4203 *)      if $test -d $afsroot; then
4204                 afs=true
4205         else
4206                 afs=false
4207         fi
4208         ;;
4209 esac
4210 if $afs; then
4211         echo "AFS may be running... I'll be extra cautious then..." >&4
4212 else
4213         echo "AFS does not seem to be running..." >&4
4214 fi
4215
4216 : determine installation prefix for where package is to be installed.
4217 if $afs; then
4218 $cat <<EOM
4219
4220 Since you are running AFS, I need to distinguish the directory in which
4221 files will reside from the directory in which they are installed (and from
4222 which they are presumably copied to the former directory by occult means).
4223
4224 EOM
4225         case "$installprefix" in
4226         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4227         *) dflt="$installprefix";;
4228         esac
4229 else
4230 $cat <<EOM
4231
4232 In some special cases, particularly when building $package for distribution,
4233 it is convenient to distinguish the directory in which files should be
4234 installed from the directory ($prefix) in which they will
4235 eventually reside.  For most users, these two directories are the same.
4236
4237 EOM
4238         case "$installprefix" in
4239         '') dflt=$prefix ;;
4240         *) dflt=$installprefix;;
4241         esac
4242 fi
4243 fn=d~
4244 rp='What installation prefix should I use for installing files?'
4245 . ./getfile
4246 installprefix="$ans"
4247 installprefixexp="$ansexp"
4248
4249 : Perform the prefixexp/installprefixexp correction if necessary
4250 cat <<EOS >installprefix
4251 $startsh
4252 EOS
4253 cat <<'EOSC' >>installprefix
4254 : Change installation prefix, if necessary.
4255 if $test X"$prefix" != X"$installprefix"; then
4256     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4257 else
4258     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4259 fi
4260 EOSC
4261 chmod +x installprefix
4262 $eunicefix installprefix
4263
4264 : Set variables such as privlib and privlibexp from the output of ./getfile
4265 : performing the prefixexp/installprefixexp correction if necessary.
4266 cat <<EOS >setprefixvar
4267 $startsh
4268 EOS
4269 cat <<'EOSC' >>setprefixvar
4270 eval "${prefixvar}=\"\$ans\""
4271 eval "${prefixvar}exp=\"\$ansexp\""
4272 . ./installprefix
4273 EOSC
4274 chmod +x setprefixvar
4275 $eunicefix setprefixvar
4276
4277 : set up the script used to warn in case of inconsistency
4278 cat <<EOS >whoa
4279 $startsh
4280 EOS
4281 cat <<'EOSC' >>whoa
4282 dflt=y
4283 case "$hint" in
4284     recommended)
4285         case "$hintfile" in
4286         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4287                 ;;
4288         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4289                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4290                 ;;
4291         esac
4292         ;;
4293     *)  echo " "
4294         echo "*** WHOA THERE!!! ***" >&4
4295         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4296         ;;
4297 esac
4298 rp="    Keep the $hint value?"
4299 . ./myread
4300 case "$ans" in
4301 y) td=$was; tu=$was;;
4302 esac
4303 EOSC
4304
4305 : function used to set '$1' to '$val'
4306 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4307 case "$val$was" in
4308 $define$undef) . ./whoa; eval "$var=\$td";;
4309 $undef$define) . ./whoa; eval "$var=\$tu";;
4310 *) eval "$var=$val";;
4311 esac'
4312
4313 : get the patchlevel
4314 echo " "
4315 echo "Getting the current patchlevel..." >&4
4316 if $test -r $rsrc/patchlevel.h;then
4317         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4318         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4319         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4320         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4321         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4322         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4323         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4324 else
4325         revision=0
4326         patchlevel=0
4327         subversion=0
4328         api_revision=0
4329         api_version=0
4330         api_subversion=0
4331         perl_patchlevel=0
4332         $echo "(You do not have patchlevel.h.  Eek.)"
4333 fi
4334 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4335 version_patchlevel_string="version $patchlevel subversion $subversion"
4336 case "$perl_patchlevel" in
4337 0|'') ;;
4338 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4339     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4340     ;;
4341 esac
4342
4343 $echo "(You have $package $version_patchlevel_string.)"
4344
4345 case "$osname" in
4346 dos|vms)
4347         : XXX Should be a Configure test for double-dots in filenames.
4348         version=`echo $revision $patchlevel $subversion | \
4349                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4350         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4351                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4352         ;;
4353 *)
4354         version=`echo $revision $patchlevel $subversion | \
4355                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4356         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4357                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4358         ;;
4359 esac
4360 : Special case the 5.005_xx maintenance series, which used 5.005
4361 : without any subversion label as a subdirectory in $sitelib
4362 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4363         api_versionstring='5.005'
4364 fi
4365
4366 : Do we want threads support and if so, what type
4367 case "$usethreads" in
4368 $define|true|[yY]*)     dflt='y';;
4369 *)     # Catch case where user specified ithreads or 5005threads but
4370        # forgot -Dusethreads (A.D. 4/2002)
4371        case "$useithreads$use5005threads" in
4372        *$define*)       dflt='y';;
4373        *)               dflt='n';;
4374        esac
4375        ;;
4376 esac
4377 cat <<EOM
4378
4379 Perl can be built to offer a form of threading support on some systems
4380 To do so, Configure can be run with -Dusethreads.
4381
4382 Note that Perl built with threading support runs slightly slower
4383 and uses slightly more memory than plain Perl.
4384
4385 If this doesn't make any sense to you, just accept the default '$dflt'.
4386 EOM
4387 rp='Build a threading Perl?'
4388 . ./myread
4389 case "$ans" in
4390 y|Y)    val="$define" ;;
4391 *)      val="$undef" ;;
4392 esac
4393 set usethreads
4394 eval $setvar
4395
4396 if $test $patchlevel -lt 9; then
4397     case "$usethreads" in
4398     $define)
4399         : Default to ithreads unless overridden on command line or with
4400         : old config.sh
4401         dflt='y'
4402         case "$use5005threads" in
4403                 $define|true|[yY]*)
4404                         echo "5.005 threads are no longer supported"
4405                         exit 1
4406                 ;;
4407         esac
4408         case "$useithreads" in
4409                 $undef|false|[nN]*) dflt='n';;
4410         esac
4411         rp='Use the newer interpreter-based ithreads?'
4412         . ./myread
4413         case "$ans" in
4414         y|Y)    val="$define" ;;
4415         *)      val="$undef" ;;
4416         esac
4417         set useithreads
4418         eval $setvar
4419         : Now set use5005threads to the opposite value.
4420         case "$useithreads" in
4421         $define) val="$undef" ;;
4422         *) val="$define" ;;
4423         esac
4424         set use5005threads
4425         eval $setvar
4426         ;;
4427     *)
4428         useithreads="$undef"
4429         use5005threads="$undef"
4430         ;;
4431     esac
4432
4433     case "$useithreads$use5005threads" in
4434     "$define$define")
4435         $cat >&4 <<EOM
4436
4437 You cannot have both the ithreads and the 5.005 threads enabled
4438 at the same time.  Disabling the 5.005 threads since they are
4439 much less stable than the ithreads.
4440
4441 EOM
4442         use5005threads="$undef"
4443         ;;
4444     esac
4445
4446 else
4447 : perl-5.9.x and later
4448
4449     if test X"$usethreads" = "X$define"; then
4450         case "$use5005threads" in
4451             $define|true|[yY]*)
4452                 $cat >&4 <<EOM
4453
4454 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4455
4456 EOM
4457             ;;
4458         esac
4459     fi
4460
4461     use5005threads="$undef"
4462     useithreads="$usethreads"
4463 fi
4464
4465 case "$d_oldpthreads" in
4466 '')     : Configure tests would be welcome here.  For now, assume undef.
4467         val="$undef" ;;
4468 *)      val="$d_oldpthreads" ;;
4469 esac
4470 set d_oldpthreads
4471 eval $setvar
4472
4473
4474 : Look for a hint-file generated 'call-back-unit'.  If the
4475 : user has specified that a threading perl is to be built,
4476 : we may need to set or change some other defaults.
4477 if $test -f usethreads.cbu; then
4478     echo "Your platform has some specific hints regarding threaded builds, using them..."
4479     . ./usethreads.cbu
4480 else
4481     case "$usethreads" in
4482         "$define"|true|[yY]*)
4483                 $cat <<EOM
4484 (Your platform does not have any specific hints for threaded builds.
4485  Assuming POSIX threads, then.)
4486 EOM
4487         ;;
4488     esac
4489 fi
4490
4491 : Check if multiplicity is required
4492 cat <<EOM
4493
4494 Perl can be built so that multiple Perl interpreters can coexist
4495 within the same Perl executable.
4496 EOM
4497
4498 case "$useithreads" in
4499 $define)
4500         cat <<EOM
4501 This multiple interpreter support is required for interpreter-based threads.
4502 EOM
4503         val="$define"
4504         ;;
4505 *)      case "$usemultiplicity" in
4506         $define|true|[yY]*)     dflt='y';;
4507         *) dflt='n';;
4508         esac
4509         echo " "
4510         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4511         rp='Build Perl for multiplicity?'
4512         . ./myread
4513         case "$ans" in
4514         y|Y)    val="$define" ;;
4515         *)      val="$undef" ;;
4516         esac
4517         ;;
4518 esac
4519 set usemultiplicity
4520 eval $setvar
4521
4522 : Check if morebits is requested
4523 case "$usemorebits" in
4524 "$define"|true|[yY]*)
4525         use64bitint="$define"
4526         uselongdouble="$define"
4527         usemorebits="$define"
4528         ;;
4529 *)      usemorebits="$undef"
4530         ;;
4531 esac
4532
4533 : Determine the C compiler to be used
4534 echo " "
4535 case "$cc" in
4536 '') dflt=cc;;
4537 *) dflt="$cc";;
4538 esac
4539 rp="Use which C compiler?"
4540 . ./myread
4541 cc="$ans"
4542
4543 : See whether they have no cc but they do have gcc
4544 . ./trygcc
4545 if $test -f cc.cbu; then
4546     . ./cc.cbu
4547 fi
4548 . ./checkcc
4549
4550 : make some quick guesses about what we are up against
4551 echo " "
4552 $echo $n "Hmm...  $c"
4553 echo exit 1 >bsd
4554 echo exit 1 >usg
4555 echo exit 1 >v7
4556 echo exit 1 >osf1
4557 echo exit 1 >eunice
4558 echo exit 1 >xenix
4559 echo exit 1 >venix
4560 echo exit 1 >os2
4561 d_bsd="$undef"
4562 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4563 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4564 then
4565         echo "Looks kind of like an OSF/1 system, but we'll see..."
4566         echo exit 0 >osf1
4567 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4568         xxx=`./loc addbib blurfl $pth`
4569         if $test -f $xxx; then
4570         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4571                 echo exit 0 >bsd
4572                 echo exit 0 >usg
4573         else
4574                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4575                         echo "Looks kind of like an extended USG system, but we'll see..."
4576                 else
4577                         echo "Looks kind of like a USG system, but we'll see..."
4578                 fi
4579                 echo exit 0 >usg
4580         fi
4581 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4582         echo "Looks kind of like a BSD system, but we'll see..."
4583         d_bsd="$define"
4584         echo exit 0 >bsd
4585 else
4586         echo "Looks kind of like a Version 7 system, but we'll see..."
4587         echo exit 0 >v7
4588 fi
4589 case "$eunicefix" in
4590 *unixtovms*)
4591         $cat <<'EOI'
4592 There is, however, a strange, musty smell in the air that reminds me of
4593 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4594 EOI
4595         echo exit 0 >eunice
4596         d_eunice="$define"
4597 : it so happens the Eunice I know will not run shell scripts in Unix format
4598         ;;
4599 *)
4600         echo " "
4601         echo "Congratulations.  You aren't running Eunice."
4602         d_eunice="$undef"
4603         ;;
4604 esac
4605 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4606 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4607 : semicolon as a patch separator
4608 case "$p_" in
4609 :) ;;
4610 *)
4611         $cat <<'EOI'
4612 I have the feeling something is not exactly right, however...don't tell me...
4613 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4614 (Or you may be running DOS with DJGPP.)
4615 EOI
4616         echo exit 0 >os2
4617         ;;
4618 esac
4619 if test -f /xenix; then
4620         echo "Actually, this looks more like a XENIX system..."
4621         echo exit 0 >xenix
4622         d_xenix="$define"
4623 else
4624         echo " "
4625         echo "It's not Xenix..."
4626         d_xenix="$undef"
4627 fi
4628 chmod +x xenix
4629 $eunicefix xenix
4630 if test -f /venix; then
4631         echo "Actually, this looks more like a VENIX system..."
4632         echo exit 0 >venix
4633 else
4634         echo " "
4635         if ./xenix; then
4636                 : null
4637         else
4638                 echo "Nor is it Venix..."
4639         fi
4640 fi
4641 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4642 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4643 $rm -f foo
4644
4645 : Check if we are using GNU gcc and what its version is
4646 echo " "
4647 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4648 $cat >try.c <<EOM
4649 #include <stdio.h>
4650 int main() {
4651 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4652 #ifdef __VERSION__
4653         printf("%s\n", __VERSION__);
4654 #else
4655         printf("%s\n", "1");
4656 #endif
4657 #endif
4658         return(0);
4659 }
4660 EOM
4661 if $cc -o try $ccflags $ldflags try.c; then
4662         gccversion=`$run ./try`
4663         case "$gccversion" in
4664         '') echo "You are not using GNU cc." ;;
4665         *)  echo "You are using GNU cc $gccversion."
4666             ccname=gcc
4667             ;;
4668         esac
4669 else
4670         echo " "
4671         echo "*** WHOA THERE!!! ***" >&4
4672         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4673         case "$knowitall" in
4674         '')
4675         echo "    You'd better start hunting for one and let me know about it." >&4
4676                 exit 1
4677                 ;;
4678         esac
4679 fi
4680 $rm -f try try.*
4681 case "$gccversion" in
4682 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4683 esac
4684 case "$gccversion" in
4685 '') gccosandvers='' ;;
4686 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4687    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4688    gccshortvers=''
4689    case "$gccosandvers" in
4690    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4691    $osname$osvers) ;; # looking good
4692    $osname*) cat <<EOM >&4
4693
4694 *** WHOA THERE!!! ***
4695
4696     Your gcc has not been compiled for the exact release of
4697     your operating system ($gccosandvers versus $osname$osvers).
4698
4699     In general it is a good idea to keep gcc synchronized with
4700     the operating system because otherwise serious problems
4701     may ensue when trying to compile software, like Perl.
4702
4703     I'm trying to be optimistic here, though, and will continue.
4704     If later during the configuration and build icky compilation
4705     problems appear (headerfile conflicts being the most common
4706     manifestation), I suggest reinstalling the gcc to match
4707     your operating system release.
4708
4709 EOM
4710       ;;
4711    *) gccosandvers='' ;; # failed to parse, better be silent
4712    esac
4713    ;;
4714 esac
4715 case "$ccname" in
4716 '') ccname="$cc" ;;
4717 esac
4718
4719 # gcc 3.* complain about adding -Idirectories that they already know about,
4720 # so we will take those off from locincpth.
4721 case "$gccversion" in
4722 3*)
4723     echo "main(){}">try.c
4724     for incdir in $locincpth; do
4725        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4726              grep '^c[cp]p*[01]: warning: changing search order '`
4727        if test "X$warn" != X; then
4728            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4729        fi
4730     done
4731     $rm -f try try.*
4732 esac
4733
4734 # gcc 4.9 by default does some optimizations that break perl.
4735 # see ticket 121505.
4736 #
4737 # The -fwrapv disables those optimizations (and probably others,) so
4738 # for gcc 4.9 (and later, since the optimizations probably won't go
4739 # away), add -fwrapv unless the user requests -fno-wrapv, which
4740 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4741 # which turns the overflows -fwrapv ignores into runtime errors.
4742 case "$gccversion" in
4743 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4744     case "$ccflags" in
4745     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4746     *) ccflags="$ccflags -fwrapv" ;;
4747     esac
4748 esac
4749
4750 : What should the include directory be ?
4751 : Use sysroot if set, so findhdr looks in the right place.
4752 echo " "
4753 $echo $n "Hmm...  $c"
4754 dflt="$sysroot/usr/include"
4755 incpath=''
4756 mips_type=''
4757 if $test -f /bin/mips && /bin/mips; then
4758         echo "Looks like a MIPS system..."
4759         $cat >usr.c <<'EOCP'
4760 #ifdef SYSTYPE_BSD43
4761 /bsd43
4762 #endif
4763 EOCP
4764         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4765                 dflt='/bsd43/usr/include'
4766                 incpath='/bsd43'
4767                 mips_type='BSD 4.3'
4768         else
4769                 mips_type='System V'
4770         fi
4771         $rm -f usr.c usr.out
4772         echo "and you're compiling with the $mips_type compiler and libraries."
4773         xxx_prompt=y
4774         echo "exit 0" >mips
4775 else
4776         echo "Doesn't look like a MIPS system."
4777         xxx_prompt=n
4778         echo "exit 1" >mips
4779 fi
4780 chmod +x mips
4781 $eunicefix mips
4782 case "$usrinc" in
4783 '') ;;
4784 *) dflt="$usrinc";;
4785 esac
4786 case "$xxx_prompt" in
4787 y)      fn=d/
4788         echo " "
4789         rp='Where are the include files you want to use?'
4790         . ./getfile
4791         usrinc="$ans"
4792         ;;
4793 *)      usrinc="$dflt"
4794         ;;
4795 esac
4796
4797 : see how we invoke the C preprocessor
4798 echo " "
4799 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4800 cat <<'EOT' >testcpp.c
4801 #define ABC abc
4802 #define XYZ xyz
4803 ABC.XYZ
4804 EOT
4805 cd ..
4806 if test ! -f cppstdin; then
4807         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4808                 # AIX cc -E doesn't show the absolute headerfile
4809                 # locations but we'll cheat by using the -M flag.
4810                 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
4811         else
4812                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4813         fi
4814 else
4815         echo "Keeping your $hint cppstdin wrapper."
4816 fi
4817 chmod 755 cppstdin
4818 wrapper=`pwd`/cppstdin
4819 ok='false'
4820 cd UU
4821
4822 if $test "X$cppstdin" != "X" && \
4823         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4824         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4825 then
4826         echo "You used to use $cppstdin $cppminus so we'll use that again."
4827         case "$cpprun" in
4828         '') echo "But let's see if we can live without a wrapper..." ;;
4829         *)
4830                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4831                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4832                 then
4833                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4834                         ok='true'
4835                 else
4836                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4837                 fi
4838                 ;;
4839         esac
4840 else
4841         case "$cppstdin" in
4842         '') ;;
4843         *)
4844                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4845                 ;;
4846         esac
4847 fi
4848
4849 if $ok; then
4850         : nothing
4851 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4852         $cc -E <testcpp.c >testcpp.out 2>&1; \
4853         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4854         echo "Yup, it does."
4855         x_cpp="$cc $cppflags -E"
4856         x_minus='';
4857 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4858         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4859         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4860         echo "Yup, it does."
4861         x_cpp="$cc $cppflags -E"
4862         x_minus='-';
4863 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4864         $cc -P <testcpp.c >testcpp.out 2>&1; \
4865         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4866         echo "Yipee, that works!"
4867         x_cpp="$cc $cppflags -P"
4868         x_minus='';
4869 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4870         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4871         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4872         echo "At long last!"
4873         x_cpp="$cc $cppflags -P"
4874         x_minus='-';
4875 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4876         $cpp <testcpp.c >testcpp.out 2>&1; \
4877         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4878         echo "It works!"
4879         x_cpp="$cpp $cppflags"
4880         x_minus='';
4881 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4882         $cpp - <testcpp.c >testcpp.out 2>&1; \
4883         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4884         echo "Hooray, it works!  I was beginning to wonder."
4885         x_cpp="$cpp $cppflags"
4886         x_minus='-';
4887 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4888         $wrapper <testcpp.c >testcpp.out 2>&1; \
4889         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4890         x_cpp="$wrapper"
4891         x_minus=''
4892         echo "Eureka!"
4893 else
4894         dflt=''
4895         rp="No dice.  I can't find a C preprocessor.  Name one:"
4896         . ./myread
4897         x_cpp="$ans"
4898         x_minus=''
4899         $x_cpp <testcpp.c >testcpp.out 2>&1
4900         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4901                 echo "OK, that will do." >&4
4902         else
4903 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4904                 exit 1
4905         fi
4906 fi
4907
4908 case "$ok" in
4909 false)
4910         cppstdin="$x_cpp"
4911         cppminus="$x_minus"
4912         cpprun="$x_cpp"
4913         cpplast="$x_minus"
4914         set X $x_cpp
4915         shift
4916         case "$1" in
4917         "$cpp")
4918                 echo "Perhaps can we force $cc -E using a wrapper..."
4919                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4920                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4921                 then
4922                         echo "Yup, we can."
4923                         cppstdin="$wrapper"
4924                         cppminus='';
4925                 else
4926                         echo "Nope, we'll have to live without it..."
4927                 fi
4928                 ;;
4929         esac
4930         case "$cpprun" in
4931         "$wrapper")
4932                 cpprun=''
4933                 cpplast=''
4934                 ;;
4935         esac
4936         ;;
4937 esac
4938
4939 case "$cppstdin" in
4940 "$wrapper"|'cppstdin') ;;
4941 *) $rm -f $wrapper;;
4942 esac
4943 $rm -f testcpp.c testcpp.out
4944
4945 : Adjust cppfilter for path component separator
4946 case "$osname" in
4947 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4948 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4949 *)   cppfilter='' ;;
4950 esac
4951
4952 : Use gcc to determine libpth and incpth
4953 # If using gcc or clang, we can get better values for libpth, incpth
4954 # and usrinc directly from the compiler.
4955 # Note that ccname for clang is also gcc.
4956 case "$ccname" in
4957     gcc)
4958         $echo 'extern int foo;' > try.c
4959         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4960         shift
4961         if $test $# -gt 0; then
4962             incpth="$incpth $*"
4963             incpth="`$echo $incpth|$sed 's/^ //'`"
4964             for i in $*; do
4965                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4966                 if $test -d $j; then
4967                     libpth="$libpth $j"
4968                 fi
4969             done
4970             libpth="`$echo $libpth|$sed 's/^ //'`"
4971             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4972                 if $test -d $xxx; then
4973                     case " $libpth " in
4974                     *" $xxx "*) ;;
4975                     *) libpth="$libpth $xxx";;
4976                     esac
4977                 fi
4978             done
4979         fi
4980         $rm -f try.c
4981         case "$usrinc" in
4982         '') for i in $incpth; do
4983                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4984                     usrinc="$i"
4985                     break
4986                 fi
4987             done
4988             ;;
4989         esac
4990
4991         case "$usecrosscompile" in
4992         $define|true|[yY]*)
4993             case "$incpth" in
4994                 '') echo "Incpth not defined." >&4; croak=y ;;
4995                 *)  echo "Using incpth '$incpth'." >&4 ;;
4996             esac
4997             case "$libpth" in
4998                 '') echo "Libpth not defined." >&4; croak=y ;;
4999                 *)  echo "Using libpth '$libpth'." >&4 ;;
5000             esac
5001             case "$usrinc" in
5002                 '') echo "Usrinc not defined." >&4; croak=y ;;
5003                 *)  echo "Using usrinc $usrinc." >&4 ;;
5004             esac
5005             case "$croak" in
5006                 y)
5007                 if test "X$sysroot" = X; then
5008                     echo "Cannot continue, aborting." >&4; exit 1
5009                 else
5010                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5011                 fi
5012                 ;;
5013             esac
5014             ;;
5015         esac
5016     ;;
5017 esac
5018
5019 : Default value for incpth is just usrinc
5020 case "$incpth" in
5021 '') incpth="$usrinc";;
5022 esac
5023
5024 : Set private lib path
5025 case "$plibpth" in
5026 '') if ./mips; then
5027         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5028     fi;;
5029 esac
5030 case "$libpth" in
5031 ' ') dlist='';;
5032 '') dlist="$loclibpth $plibpth $glibpth";;
5033 *) dlist="$libpth";;
5034 esac
5035
5036 : Now check and see which directories actually exist, avoiding duplicates
5037 for xxx in $dlist
5038 do
5039     if $test -d $xxx; then
5040                 case " $libpth " in
5041                 *" $xxx "*) ;;
5042                 *) libpth="$libpth $xxx";;
5043                 esac
5044     fi
5045 done
5046 $cat <<'EOM'
5047
5048 Some systems have incompatible or broken versions of libraries.  Among
5049 the directories listed in the question below, please remove any you
5050 know not to be holding relevant libraries, and add any that are needed.
5051 Say "none" for none.
5052
5053 EOM
5054
5055 if test "X$sysroot" != X; then
5056     $cat <<EOM
5057 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5058
5059 EOM
5060 fi
5061
5062 case "$libpth" in
5063 '') dflt='none';;
5064 *)
5065         set X $libpth
5066         shift
5067         dflt=${1+"$@"}
5068         ;;
5069 esac
5070 rp="Directories to use for library searches?"
5071 . ./myread
5072 case "$ans" in
5073 none) libpth=' ';;
5074 *) libpth="$ans";;
5075 esac
5076
5077 : compute shared library extension
5078 case "$so" in
5079 '')
5080         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5081                 dflt='sl'
5082         else
5083                 dflt='so'
5084         fi
5085         ;;
5086 *) dflt="$so";;
5087 esac
5088 $cat <<EOM
5089
5090 On some systems, shared libraries may be available.  Answer 'none' if
5091 you want to suppress searching of shared libraries for the remainder
5092 of this configuration.
5093
5094 EOM
5095 rp='What is the file extension used for shared libraries?'
5096 . ./myread
5097 so="$ans"
5098
5099 : Does target system insist that shared library basenames are unique
5100 $cat << EOM
5101
5102 Some dynamic loaders assume that the *basename* of shared library filenames
5103 are globally unique.  We'll default this to undef as we assume your system
5104 is not this weird. Set to defined if you're on one of them.
5105
5106 EOM
5107
5108 dflt='n'
5109 rp='Make shared library basenames unique?'
5110 . ./myread
5111 case "$ans" in
5112 y|Y) val="$define" ;;
5113 *)   val="$undef"  ;;
5114 esac
5115 set d_libname_unique
5116 eval $setvar
5117
5118 : Define several unixisms.
5119 : Hints files or command line option can be used to override them.
5120 : The convoluted testing is in case hints files set either the old
5121 : or the new name.
5122 case "$_exe" in
5123 '')     case "$exe_ext" in
5124         '')     ;;
5125         *)      _exe="$exe_ext" ;;
5126         esac
5127         ;;
5128 esac
5129 case "$_a" in
5130 '')     case "$lib_ext" in
5131     '') _a='.a';;
5132         *)      _a="$lib_ext" ;;
5133         esac
5134         ;;
5135 esac
5136 case "$_o" in
5137 '') case "$obj_ext" in
5138         '')     _o='.o';;
5139         *)      _o="$obj_ext";;
5140         esac
5141         ;;
5142 esac
5143 case "$p_" in
5144 '') case "$path_sep" in
5145         '')     p_=':';;
5146         *)      p_="$path_sep";;
5147         esac
5148         ;;
5149 esac
5150 exe_ext=$_exe
5151 lib_ext=$_a
5152 obj_ext=$_o
5153 path_sep=$p_
5154
5155 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5156
5157 : Which makefile gets called first.  This is used by make depend.
5158 case "$firstmakefile" in
5159 '') firstmakefile='makefile';;
5160 esac
5161
5162 : Check is we will use socks
5163 case "$usesocks" in
5164 $define|true|[yY]*)     dflt='y';;
5165 *) dflt='n';;
5166 esac
5167 cat <<EOM
5168
5169 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5170 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5171 to use the PerlIO abstraction layer, this will be implicitly selected.
5172
5173 If this doesn't make any sense to you, just accept the default '$dflt'.
5174 EOM
5175 rp='Build Perl for SOCKS?'
5176 . ./myread
5177 case "$ans" in
5178 y|Y)    val="$define" ;;
5179 *)      val="$undef" ;;
5180 esac
5181 set usesocks
5182 eval $setvar
5183
5184 : Check for uselongdouble support
5185 case "$ccflags" in
5186 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5187 esac
5188
5189 case "$uselongdouble" in
5190 $define|true|[yY]*)     dflt='y';;
5191 *) dflt='n';;
5192 esac
5193 cat <<EOM
5194
5195 Perl can be built to take advantage of long doubles which
5196 (if available) may give more accuracy and range for floating point numbers.
5197
5198 If this doesn't make any sense to you, just accept the default '$dflt'.
5199 EOM
5200 rp='Try to use long doubles if available?'
5201 . ./myread
5202 case "$ans" in
5203 y|Y)    val="$define"   ;;
5204 *)      val="$undef"    ;;
5205 esac
5206 set uselongdouble
5207 eval $setvar
5208
5209 case "$uselongdouble" in
5210 true|[yY]*) uselongdouble="$define" ;;
5211 esac
5212
5213 : Look for a hint-file generated 'call-back-unit'.  If the
5214 : user has specified that long doubles should be used,
5215 : we may need to set or change some other defaults.
5216 if $test -f uselongdouble.cbu; then
5217     echo "Your platform has some specific hints regarding long doubles, using them..."
5218     . ./uselongdouble.cbu
5219 else
5220     case "$uselongdouble" in
5221         $define)
5222                 $cat <<EOM
5223 (Your platform does not have any specific hints for long doubles.)
5224 EOM
5225         ;;
5226     esac
5227 fi
5228
5229 : Check if quadmath is requested
5230 case "$usequadmath" in
5231 "$define"|true|[yY]*) usequadmath="$define" ;;
5232 *)                    usequadmath="$undef"  ;;
5233 esac
5234
5235 : Fail if both uselongdouble and usequadmath are requested
5236 case "$usequadmath:$uselongdouble" in
5237 define:define)
5238         $cat <<EOM >&4
5239
5240 *** You requested the use of the quadmath library and use
5241 *** of long doubles.
5242 ***
5243 *** Please select one or the other.
5244 EOM
5245         exit 1
5246         ;;
5247 esac
5248
5249 : Looking for optional libraries
5250 echo " "
5251 echo "Checking for optional libraries..." >&4
5252 case "$libs" in
5253 ' '|'') dflt='';;
5254 *) dflt="$libs";;
5255 esac
5256 case "$libswanted" in
5257 '') libswanted='c_s';;
5258 esac
5259 case "$usesocks" in
5260 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5261 esac
5262 case "$usecbacktrace" in
5263 "$define") libswanted="$libswanted bfd" ;;
5264 esac
5265 case "$usequadmath" in
5266 "$define") libswanted="$libswanted quadmath" ;;
5267 esac
5268 libsfound=''
5269 libsfiles=''
5270 libsdirs=''
5271 libspath=''
5272 for thisdir in $libpth $xlibpth; do
5273   test -d $thisdir && libspath="$libspath $thisdir"
5274 done
5275 for thislib in $libswanted; do
5276         for thisdir in $libspath; do
5277             xxx=''
5278             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5279                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5280                 $test -f "$xxx" && eval $libscheck
5281                 $test -f "$xxx" && libstyle=shared
5282                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5283                 $test -f "$xxx" && eval $libscheck
5284                 $test -f "$xxx" && libstyle=shared
5285             fi
5286             if test ! -f "$xxx"; then
5287                 xxx=$thisdir/lib$thislib.$so
5288                 $test -f "$xxx" && eval $libscheck
5289                 $test -f "$xxx" && libstyle=shared
5290             fi
5291             if test ! -f "$xxx"; then
5292                 xxx=$thisdir/lib$thislib$_a
5293                 $test -f "$xxx" && eval $libscheck
5294                 $test -f "$xxx" && libstyle=static
5295             fi
5296             if test ! -f "$xxx"; then
5297                 xxx=$thisdir/$thislib$_a
5298                 $test -f "$xxx" && eval $libscheck
5299                 $test -f "$xxx" && libstyle=static
5300             fi
5301             if test ! -f "$xxx"; then
5302                 xxx=$thisdir/lib${thislib}_s$_a
5303                 $test -f "$xxx" && eval $libscheck
5304                 $test -f "$xxx" && libstyle=static
5305                 $test -f "$xxx" && thislib=${thislib}_s
5306             fi
5307             if test ! -f "$xxx"; then
5308                 xxx=$thisdir/Slib$thislib$_a
5309                 $test -f "$xxx" && eval $libscheck
5310                 $test -f "$xxx" && libstyle=static
5311             fi
5312             if $test -f "$xxx"; then
5313                 case "$libstyle" in
5314                 shared) echo "Found -l$thislib (shared)." ;;
5315                 static) echo "Found -l$thislib." ;;
5316                 *)      echo "Found -l$thislib ($libstyle)." ;;
5317                 esac
5318                 case " $dflt " in
5319                 *"-l$thislib "*);;
5320                 *) dflt="$dflt -l$thislib"
5321                    libsfound="$libsfound $xxx"
5322                    yyy=`basename $xxx`
5323                    libsfiles="$libsfiles $yyy"
5324                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5325                    case " $libsdirs " in
5326                    *" $yyy "*) ;;
5327                    *) libsdirs="$libsdirs $yyy" ;;
5328                    esac
5329                    ;;
5330                 esac
5331                 break
5332             fi
5333         done
5334         if $test ! -f "$xxx"; then
5335             echo "No -l$thislib."
5336         fi
5337 done
5338 set X $dflt
5339 shift
5340 dflt="$*"
5341 case "$libs" in
5342 '') dflt="$dflt";;
5343 *) dflt="$libs";;
5344 esac
5345 case "$dflt" in
5346 ' '|'') dflt='none';;
5347 esac
5348
5349 $cat <<EOM
5350
5351 In order to compile $package on your machine, a number of libraries
5352 are usually needed.  Include any other special libraries here as well.
5353 Say "none" for none.  The default list is almost always right.
5354 EOM
5355
5356 echo " "
5357 rp="What libraries to use?"
5358 . ./myread
5359 case "$ans" in
5360 none) libs=' ';;
5361 *) libs="$ans";;
5362 esac
5363
5364 : determine optimization, if desired, or use for debug flag also
5365 case "$optimize" in
5366 ' '|$undef) dflt='none';;
5367 '') dflt='-O';;
5368 *) dflt="$optimize";;
5369 esac
5370 $cat <<EOH
5371
5372 By default, $package compiles with the -O flag to use the optimizer.
5373 Alternately, you might want to use the symbolic debugger, which uses
5374 the -g flag (on traditional Unix systems).  Either flag can be
5375 specified here.  To use neither flag, specify the word "none".
5376
5377 EOH
5378 rp="What optimizer/debugger flag should be used?"
5379 . ./myread
5380 optimize="$ans"
5381 case "$optimize" in
5382 'none') optimize=" ";;
5383 esac
5384
5385 : Check what DEBUGGING is required from the command line
5386 : -DEBUGGING      or -DDEBUGGING or
5387 : -DEBUGGING=both                       = -g + -DDEBUGGING
5388 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5389 : -DEBUGGING=none or -UDEBUGGING        =
5390 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5391 case "$EBUGGING" in
5392 '')     ;;
5393 *)      DEBUGGING=$EBUGGING ;;
5394 esac
5395
5396 case "$DEBUGGING" in
5397 -g|both|$define)
5398     case "$optimize" in
5399         *-g*) ;;
5400         *)    optimize="$optimize -g" ;;
5401     esac ;;
5402 none|$undef)
5403     case "$optimize" in
5404         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5405                 shift
5406                 optimize="$*"
5407                 ;;
5408     esac ;;
5409 esac
5410
5411 dflt=''
5412 case "$DEBUGGING" in
5413 both|$define) dflt='-DDEBUGGING'
5414 esac
5415
5416 : argument order is deliberate, as the flag will start with - which set could
5417 : think is an option
5418 checkccflag='check=$1; flag=$2; callback=$3;
5419 echo " ";
5420 echo "Checking if your compiler accepts $flag" 2>&1;
5421 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5422 echo "int main(void) { return 0; }" > gcctest.c;
5423 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5424     echo "Yes, it does." 2>&1;
5425     if $test -s gcctest.out ; then
5426         echo "But your platform does not like it:";
5427         cat gcctest.out;
5428     else
5429         case "$ccflags" in
5430         *$check*)
5431             echo "Leaving current flags $ccflags alone." 2>&1
5432             ;;
5433         *) dflt="$dflt $flag";
5434             eval $callback
5435             ;;
5436         esac
5437     fi
5438 else
5439     echo "Nope, it does not, but that is ok." 2>&1;
5440 fi
5441 '
5442
5443 : We will not override a previous value, but we might want to
5444 : augment a hint file
5445 case "$hint" in
5446 default|recommended)
5447         case "$gccversion" in
5448         1*) dflt="$dflt -fpcc-struct-return" ;;
5449         esac
5450         case "$optimize:$DEBUGGING" in
5451         *-g*:old) dflt="$dflt -DDEBUGGING";;
5452         esac
5453         case "$gccversion" in
5454         2*) if $test -d /etc/conf/kconfig.d &&
5455                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5456                 then
5457                         # Interactive Systems (ISC) POSIX mode.
5458                         dflt="$dflt -posix"
5459                 fi
5460                 ;;
5461         esac
5462         case "$gccversion" in
5463         1*) ;;
5464         2.[0-8]*) ;;
5465         ?*)     set strict-aliasing -fno-strict-aliasing
5466                 eval $checkccflag
5467                 ;;
5468         esac
5469         # For gcc, adding -pipe speeds up compilations for some, but apparently
5470         # some assemblers can't read from stdin.  (It also slows down compilations
5471         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5472         case "$gccversion" in
5473         ?*)     set pipe -pipe
5474                 eval $checkccflag
5475                 ;;
5476         esac
5477
5478         # on x86_64 (at least) we require an extra library (libssp) in the
5479         # link command line. This library is not named, so I infer that it is
5480         # an implementation detail that may change. Hence the safest approach
5481         # is to add the flag to the flags passed to the compiler at link time,
5482         # as that way the compiler can do the right implementation dependant
5483         # thing. (NWC)
5484         case "$osname" in
5485         amigaos) ;; # -fstack-protector builds but doesn't work
5486         *)      case "$gccversion" in
5487                 ?*)     set stack-protector-strong -fstack-protector-strong
5488                         eval $checkccflag
5489                         case "$dflt" in
5490                         *-fstack-protector-strong*) ;; # It got added.
5491                         *) # Try the plain/older -fstack-protector.
5492                            set stack-protector -fstack-protector
5493                            eval $checkccflag
5494                            ;;
5495                         esac
5496                         ;;
5497                 esac
5498                 ;;
5499         esac
5500         ;;
5501 esac
5502
5503 case "$mips_type" in
5504 *BSD*|'') inclwanted="$locincpth $usrinc";;
5505 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5506 esac
5507 for thisincl in $inclwanted; do
5508         if $test -d $thisincl; then
5509                 if $test x$thisincl != x$usrinc; then
5510                         case "$dflt" in
5511                         *" -I$thisincl "*);;
5512                         *) dflt="$dflt -I$thisincl ";;
5513                         esac
5514                 fi
5515         fi
5516 done
5517
5518 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5519         xxx=true;
5520 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5521         xxx=true;
5522 else
5523         xxx=false;
5524 fi;
5525 if $xxx; then
5526         case "$dflt" in
5527         *$2*);;
5528         *) dflt="$dflt -D$2";;
5529         esac;
5530 fi'
5531
5532 set signal.h LANGUAGE_C; eval $inctest
5533
5534 case "$usesocks" in
5535 $define)
5536         ccflags="$ccflags -DSOCKS"
5537         ;;
5538 esac
5539
5540 case "$hint" in
5541 default|recommended) dflt="$ccflags $dflt" ;;
5542 *) dflt="$ccflags";;
5543 esac
5544
5545 case "$dflt" in
5546 ''|' ') dflt=none;;
5547 esac
5548
5549 $cat <<EOH
5550
5551 Your C compiler may want other flags.  For this question you should include
5552 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5553 but you should NOT include libraries or ld flags like -lwhatever.  If you
5554 want $package to honor its debug switch, you should include -DDEBUGGING here.
5555 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5556
5557 To use no flags, specify the word "none".
5558
5559 EOH
5560 set X $dflt
5561 shift
5562 dflt=${1+"$@"}
5563 rp="Any additional cc flags?"
5564 . ./myread
5565 case "$ans" in
5566 none) ccflags='';;
5567 *) ccflags="$ans";;
5568 esac
5569
5570 : the following weeds options from ccflags that are of no interest to cpp
5571 case "$cppflags" in
5572 '') cppflags="$ccflags" ;;
5573 *)  set X $ccflags; shift
5574     case " $cppflags " in
5575     *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5576     *) cppflags="$cppflags $ccflags" ;;
5577     esac
5578     ;;
5579 esac
5580 case "$gccversion" in
5581 1*) cppflags="$cppflags -D__GNUC__"
5582 esac
5583 case "$mips_type" in
5584 '');;
5585 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5586 esac
5587 case "$cppflags" in
5588 '');;
5589 *)
5590         echo " "
5591         echo "Let me guess what the preprocessor flags are..." >&4
5592         set X $cppflags
5593         shift
5594         cppflags=''
5595         $cat >cpp.c <<'EOM'
5596 #define BLURFL foo
5597
5598 BLURFL xx LFRULB
5599 EOM
5600         previous=''
5601         for flag in $*
5602         do
5603                 case "$flag" in
5604                 -*) ftry="$flag";;
5605                 *) ftry="$previous $flag";;
5606                 esac
5607                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5608                         >cpp1.out 2>/dev/null && \
5609                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5610                         >cpp2.out 2>/dev/null && \
5611                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5612                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5613                 then
5614                         cppflags="$cppflags $ftry"
5615                         previous=''
5616                 else
5617                         previous="$flag"
5618                 fi
5619         done
5620         set X $cppflags
5621         shift
5622         cppflags=${1+"$@"}
5623         case "$cppflags" in
5624         *-*)  echo "They appear to be: $cppflags";;
5625         esac
5626         $rm -f cpp.c cpp?.out
5627         ;;
5628 esac
5629
5630 : flags used in final linking phase
5631 case "$ldflags" in
5632 '') if ./venix; then
5633                 dflt='-i -z'
5634         else
5635                 dflt=''
5636         fi
5637         case "$ccflags" in
5638         *-posix*) dflt="$dflt -posix" ;;
5639         esac
5640         ;;
5641 *) dflt="$ldflags";;
5642 esac
5643 # See note above about -fstack-protector
5644 case "$ccflags" in
5645 *-fstack-protector-strong*)
5646         case "$dflt" in
5647         *-fstack-protector-strong*) ;; # Don't add it again
5648         *) dflt="$dflt -fstack-protector-strong" ;;
5649         esac
5650         ;;
5651 *-fstack-protector*)
5652         case "$dflt" in
5653         *-fstack-protector*) ;; # Don't add it again
5654         *) dflt="$dflt -fstack-protector" ;;
5655         esac
5656         ;;
5657 esac
5658
5659 : Try to guess additional flags to pick up local libraries.
5660 for thislibdir in $libpth; do
5661         case " $loclibpth " in
5662         *" $thislibdir "*)
5663                 case "$dflt " in
5664                 *"-L$thislibdir "*) ;;
5665                 *)  dflt="$dflt -L$thislibdir" ;;
5666                 esac
5667                 ;;
5668         esac
5669 done
5670
5671 case "$dflt" in
5672 '') dflt='none' ;;
5673 esac
5674
5675 $cat <<EOH
5676
5677 Your C linker may need flags.  For this question you should
5678 include -L/whatever and any other flags used by the C linker, but you
5679 should NOT include libraries like -lwhatever.
5680
5681 Make sure you include the appropriate -L/path flags if your C linker
5682 does not normally search all of the directories you specified above,
5683 namely
5684         $libpth
5685 To use no flags, specify the word "none".
5686
5687 EOH
5688
5689 rp="Any additional ld flags (NOT including libraries)?"
5690 . ./myread
5691 case "$ans" in
5692 none) ldflags='';;
5693 *) ldflags="$ans";;
5694 esac
5695 rmlist="$rmlist pdp11"
5696
5697 : coherency check
5698 echo " "
5699 echo "Checking your choice of C compiler and flags for coherency..." >&4
5700 $cat > try.c <<'EOF'
5701 #include <stdio.h>
5702 int main() { printf("Ok\n"); return(0); }
5703 EOF
5704 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5705 shift
5706 $cat >try.msg <<'EOM'
5707 I've tried to compile and run the following simple program:
5708
5709 EOM
5710 $cat try.c >> try.msg
5711
5712 $cat >> try.msg <<EOM
5713
5714 I used the command:
5715
5716         $*
5717         $run ./try
5718
5719 and I got the following output:
5720
5721 EOM
5722 dflt=y
5723 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5724         if $sh -c "$run ./try " >>try.msg 2>&1; then
5725                 xxx=`$run ./try`
5726                 case "$xxx" in
5727                 "Ok") dflt=n ;;
5728                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5729                 esac
5730         else
5731                 echo "The program compiled OK, but exited with status $?." >>try.msg
5732                 rp="You have a problem.  Shall I abort Configure"
5733                 dflt=y
5734         fi
5735 else
5736         echo "I can't compile the test program." >>try.msg
5737         rp="You have a BIG problem.  Shall I abort Configure"
5738         dflt=y
5739 fi
5740 case "$dflt" in
5741 y)
5742         $cat try.msg >&4
5743         case "$knowitall" in
5744         '')
5745                 echo "(The supplied flags or libraries might be incorrect.)"
5746                 ;;
5747         *) dflt=n;;
5748         esac
5749         echo " "
5750         . ./myread
5751         case "$ans" in
5752         n*|N*) ;;
5753         *)      echo "Ok.  Stopping Configure." >&4
5754                 exit 1
5755                 ;;
5756         esac
5757         ;;
5758 n) echo "OK, that should do.";;
5759 esac
5760 $rm_try gcctest gcctest.out
5761
5762 : define a shorthand compile call
5763 compile='
5764 mc_file=$1;
5765 shift;
5766 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5767 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5768 exit 1;
5769 fi;
5770 esac;
5771 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5772 : define a shorthand compile call for compilations that should be ok.
5773 compile_ok='
5774 mc_file=$1;
5775 shift;
5776 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5777
5778 : stub, used only to satisfy other units
5779 i_stdlib='define'
5780
5781 : check for lengths of integral types
5782 echo " "
5783 case "$intsize" in
5784 '')
5785         echo "Checking to see how big your integers are..." >&4
5786         $cat >try.c <<EOCP
5787 #include <stdio.h>
5788 #$i_stdlib I_STDLIB
5789 #ifdef I_STDLIB
5790 #include <stdlib.h>
5791 #endif
5792 int main()
5793 {
5794         printf("intsize=%d;\n", (int)sizeof(int));
5795         printf("longsize=%d;\n", (int)sizeof(long));
5796         printf("shortsize=%d;\n", (int)sizeof(short));
5797         exit(0);
5798 }
5799 EOCP
5800         set try
5801         if eval $compile_ok && $run ./try > /dev/null; then
5802                 eval `$run ./try`
5803                 echo "Your integers are $intsize bytes long."
5804                 echo "Your long integers are $longsize bytes long."
5805                 echo "Your short integers are $shortsize bytes long."
5806         else
5807                 $cat >&4 <<EOM
5808 !
5809 Help! I can't compile and run the intsize test program: please enlighten me!
5810 (This is probably a misconfiguration in your system or libraries, and
5811 you really ought to fix it.  Still, I'll try anyway.)
5812 !
5813 EOM
5814                 dflt=4
5815                 rp="What is the size of an integer (in bytes)?"
5816                 . ./myread
5817                 intsize="$ans"
5818                 dflt=$intsize
5819                 rp="What is the size of a long integer (in bytes)?"
5820                 . ./myread
5821                 longsize="$ans"
5822                 dflt=2
5823                 rp="What is the size of a short integer (in bytes)?"
5824                 . ./myread
5825                 shortsize="$ans"
5826         fi
5827         ;;
5828 esac
5829 $rm_try
5830
5831 : check for long long
5832 echo " "
5833 echo "Checking to see if you have long long..." >&4
5834 echo 'int main() { long long x = 7; return 0; }' > try.c
5835 set try
5836 if eval $compile; then
5837         val="$define"
5838         echo "You have long long."
5839 else
5840         val="$undef"
5841         echo "You do not have long long."
5842 fi
5843 $rm_try
5844 set d_longlong
5845 eval $setvar
5846
5847 : check for length of long long
5848 case "${d_longlong}${longlongsize}" in
5849 $define)
5850         echo " "
5851         echo "Checking to see how big your long longs are..." >&4
5852         $cat >try.c <<'EOCP'
5853 #include <stdio.h>
5854 int main()
5855 {
5856     printf("%d\n", (int)sizeof(long long));
5857     return(0);
5858 }
5859 EOCP
5860         set try
5861         if eval $compile_ok; then
5862                 longlongsize=`$run ./try`
5863                 echo "Your long longs are $longlongsize bytes long."
5864         else
5865                 dflt='8'
5866                 echo " "
5867                 echo "(I can't seem to compile the test program.  Guessing...)"
5868                 rp="What is the size of a long long (in bytes)?"
5869                 . ./myread
5870                 longlongsize="$ans"
5871         fi
5872         if $test "X$longsize" = "X$longlongsize"; then
5873                 echo "(That isn't any different from an ordinary long.)"
5874         fi
5875         ;;
5876 esac
5877 $rm_try
5878
5879 : determine filename position in cpp output
5880 echo " "
5881 echo "Computing filename position in cpp output for #include directives..." >&4
5882 case "$osname" in
5883 amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5884 esac
5885 case "$fieldn" in
5886 '')
5887 case "$osname" in
5888 vos) testaccess=-e ;;
5889 *)   testaccess=-r ;;
5890 esac
5891 echo '#include <stdio.h>' > foo.c
5892 $cat >fieldn <<EOF
5893 $startsh
5894 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5895 $grep '^[       ]*#.*stdio\.h' | \
5896 while read cline; do
5897         pos=1
5898         set \$cline
5899         while $test \$# -gt 0; do
5900                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5901                         echo "\$pos"
5902                         exit 0
5903                 fi
5904                 shift
5905                 pos=\`expr \$pos + 1\`
5906         done
5907 done
5908 EOF
5909 chmod +x fieldn
5910 fieldn=`./fieldn`
5911 $rm -f foo.c fieldn
5912 ;;
5913 esac
5914 case $fieldn in
5915 '') pos='???';;
5916 1) pos=first;;
5917 2) pos=second;;
5918 3) pos=third;;
5919 *) pos="${fieldn}th";;
5920 esac
5921 echo "Your cpp writes the filename in the $pos field of the line."
5922
5923 : locate header file
5924 $cat >findhdr <<EOF
5925 $startsh
5926 wanted=\$1
5927 name=''
5928 for usrincdir in $incpth
5929 do
5930         if test -f \$usrincdir/\$wanted; then
5931                 echo "\$usrincdir/\$wanted"
5932                 exit 0
5933         fi
5934 done
5935 awkprg='{ print \$$fieldn }'
5936 echo "#include <\$wanted>" > foo\$\$.c
5937 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5938 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5939 while read cline; do
5940         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5941         case "\$name" in
5942         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5943         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5944         *) exit 2;;
5945         esac;
5946 done;
5947 #
5948 # status = 0: grep returned 0 lines, case statement not executed
5949 # status = 1: headerfile found
5950 # status = 2: while loop executed, no headerfile found
5951 #
5952 status=\$?
5953 $rm -f foo\$\$.c;
5954 if test \$status -eq 1; then
5955         exit 0;
5956 fi
5957 exit 1
5958 EOF
5959 chmod +x findhdr
5960
5961 : define an alternate in-header-list? function
5962 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5963 cont=true; xxf="echo \"<\$1> found.\" >&4";
5964 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5965 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5966 esac;
5967 case $# in 4) instead=instead;; *) instead="at last";; esac;
5968 while $test "$cont"; do
5969         xxx=`./findhdr $1`
5970         var=$2; eval "was=\$$2";
5971         if $test "$xxx" && $test -r "$xxx";
5972         then eval $xxf;
5973         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5974                 cont="";
5975         else eval $xxnf;
5976         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5977         set $yyy; shift; shift; yyy=$@;
5978         case $# in 0) cont="";;
5979         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5980                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5981         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5982                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5983         esac;
5984 done;
5985 while $test "$yyy";
5986 do set $yyy; var=$2; eval "was=\$$2";
5987         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5988         set $yyy; shift; shift; yyy=$@;
5989 done'
5990
5991 : see if inttypes.h is available
5992 : we want a real compile instead of Inhdr because some systems
5993 : have an inttypes.h which includes non-existent headers
5994 echo " "
5995 $cat >try.c <<EOCP
5996 #include <inttypes.h>
5997 int main() {
5998         static int32_t foo32 = 0x12345678;
5999 }
6000 EOCP
6001 set try
6002 if eval $compile; then
6003         echo "<inttypes.h> found." >&4
6004         val="$define"
6005 else
6006         echo "<inttypes.h> NOT found." >&4
6007         val="$undef"
6008 fi
6009 $rm_try
6010 set i_inttypes
6011 eval $setvar
6012
6013 : check for int64_t
6014 echo " "
6015 echo "Checking to see if you have int64_t..." >&4
6016 $cat >try.c <<EOCP
6017 #include <sys/types.h>
6018 #$i_inttypes I_INTTYPES
6019 #ifdef I_INTTYPES
6020 #include <inttypes.h>
6021 #endif
6022 int main() { int64_t x = 7; }
6023 EOCP
6024 set try
6025 if eval $compile; then
6026         val="$define"
6027         echo "You have int64_t."
6028 else
6029         val="$undef"
6030         echo "You do not have int64_t."
6031 fi
6032 $rm_try
6033 set d_int64_t
6034 eval $setvar
6035
6036 : Check if 64bit ints have a quad type
6037 echo " "
6038 echo "Checking which 64-bit integer type we could use..." >&4
6039
6040 case "$intsize" in
6041 8) val=int
6042    set quadtype
6043    eval $setvar
6044    val='"unsigned int"'
6045    set uquadtype
6046    eval $setvar
6047    quadkind=1
6048    ;;
6049 *) case "$longsize" in
6050    8) val=long
6051       set quadtype
6052       eval $setvar
6053       val='"unsigned long"'
6054       set uquadtype
6055       eval $setvar
6056       quadkind=2
6057       ;;
6058    *) case "$d_longlong:$longlongsize" in
6059       define:8)
6060         val='"long long"'
6061         set quadtype
6062         eval $setvar
6063         val='"unsigned long long"'
6064         set uquadtype
6065         eval $setvar
6066         quadkind=3
6067         ;;
6068       *) case "$d_int64_t" in
6069          define)
6070            val=int64_t
6071            set quadtype
6072            eval $setvar
6073            val=uint64_t
6074            set uquadtype
6075            eval $setvar
6076            quadkind=4
6077            ;;
6078          esac
6079          ;;
6080       esac
6081       ;;
6082    esac
6083    ;;
6084 esac
6085
6086 case "$quadtype" in
6087 '')     echo "Alas, no 64-bit integer types in sight." >&4
6088         d_quad="$undef"
6089         ;;
6090 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6091         d_quad="$define"
6092         ;;
6093 esac
6094
6095 : Do we want 64bit support
6096 case "$uselonglong" in
6097 "$define"|true|[yY]*)
6098         cat <<EOM >&4
6099
6100 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6101 EOM
6102         use64bitint="$define"
6103         ;;
6104 esac
6105 case "$use64bits" in
6106 "$define"|true|[yY]*)
6107         cat <<EOM >&4
6108
6109 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6110 EOM
6111         use64bitint="$define"
6112         ;;
6113 esac
6114 case "$use64bitints" in
6115 "$define"|true|[yY]*)
6116         cat <<EOM >&4
6117
6118 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6119 EOM
6120         use64bitint="$define"
6121         ;;
6122 esac
6123 case "$use64bitsint" in
6124 "$define"|true|[yY]*)
6125         cat <<EOM >&4
6126
6127 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6128 EOM
6129         use64bitint="$define"
6130         ;;
6131 esac
6132 case "$uselonglongs" in
6133 "$define"|true|[yY]*)
6134         cat <<EOM >&4
6135
6136 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6137 EOM
6138         use64bitint="$define"
6139         ;;
6140 esac
6141 case "$use64bitsall" in
6142 "$define"|true|[yY]*)
6143         cat <<EOM >&4
6144
6145 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6146 EOM
6147         use64bitall="$define"
6148         ;;
6149 esac
6150
6151 case "$ccflags" in
6152 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6153 esac
6154 case "$use64bitall" in
6155 "$define"|true|[yY]*) use64bitint="$define" ;;
6156 esac
6157
6158 case "$longsize" in
6159 8) cat <<EOM
6160
6161 You have natively 64-bit long integers.
6162 EOM
6163    val="$define"
6164    ;;
6165 *) case "$use64bitint" in
6166    "$define"|true|[yY]*) dflt='y';;
6167    *) dflt='n';;
6168    esac
6169    case "$d_quad" in
6170    "$define") ;;
6171    *) dflt='n' ;;
6172    esac
6173    cat <<EOM
6174
6175 Perl can be built to take advantage of 64-bit integer types
6176 on some systems.  To do so, Configure can be run with -Duse64bitint.
6177 Choosing this option will most probably introduce binary incompatibilities.
6178
6179 If this doesn't make any sense to you, just accept the default '$dflt'.
6180 (The default has been chosen based on your configuration.)
6181 EOM
6182    rp='Try to use 64-bit integers, if available?'
6183    . ./myread
6184    case "$ans" in
6185    [yY]*) val="$define" ;;
6186    *)     val="$undef"  ;;
6187    esac
6188    ;;
6189 esac
6190 set use64bitint
6191 eval $setvar
6192
6193 case "$use64bitall" in
6194 "$define"|true|[yY]*) dflt='y' ;;
6195 *) case "$longsize" in
6196    8) dflt='y' ;;
6197    *) dflt='n' ;;
6198    esac
6199    ;;
6200 esac
6201 cat <<EOM
6202
6203 You may also choose to try maximal 64-bitness.  It means using as much
6204 64-bitness as possible on the platform.  This in turn means even more
6205 binary incompatibilities.  On the other hand, your platform may not
6206 have any more 64-bitness available than what you already have chosen.
6207
6208 If this doesn't make any sense to you, just accept the default '$dflt'.
6209 (The default has been chosen based on your configuration.)
6210 EOM
6211 rp='Try to use maximal 64-bit support, if available?'
6212 . ./myread
6213 case "$ans" in
6214 [yY]*) val="$define" ;;
6215 *)     val="$undef"  ;;
6216 esac
6217 set use64bitall
6218 eval $setvar
6219 case "$use64bitall" in
6220 "$define")
6221         case "$use64bitint" in
6222         "$undef")
6223                 cat <<EOM
6224
6225 Since you have chosen a maximally 64-bit build, I'm also turning on
6226 the use of 64-bit integers.
6227 EOM
6228                 use64bitint="$define" ;;
6229         esac
6230         ;;
6231 esac
6232
6233 : Look for a hint-file generated 'call-back-unit'.  If the
6234 : user has specified that a 64-bit perl is to be built,
6235 : we may need to set or change some other defaults.
6236 if $test -f use64bitint.cbu; then
6237         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6238         . ./use64bitint.cbu
6239 fi
6240 case "$use64bitint" in
6241 "$define"|true|[yY]*)
6242         : This test was common to all the OpenBSD forks, and seems harmless for
6243         : other platforms:
6244         echo " "
6245         echo "Checking if your C library has broken 64-bit functions..." >&4
6246         cat >try.c <<EOCP
6247 #include <stdio.h>
6248 typedef $uquadtype myULL;
6249 int main (void)
6250 {
6251     struct {
6252         double d;
6253         myULL  u;
6254     } *p, test[] = {
6255         {4294967303.15, 4294967303ULL},
6256         {4294967294.2,  4294967294ULL},
6257         {4294967295.7,  4294967295ULL},
6258         {0.0, 0ULL}
6259     };
6260     for (p = test; p->u; p++) {
6261         myULL x = (myULL)p->d;
6262         if (x != p->u) {
6263             printf("buggy\n");
6264             return 0;
6265         }
6266     }
6267     printf("ok\n");
6268     return 0;
6269 }
6270 EOCP
6271         set try
6272         if eval $compile_ok; then
6273             libcquad=`$run ./try`
6274             echo "Your C library's 64-bit functions are $libcquad."
6275         else
6276             echo "(I can't seem to compile the test program.)"
6277             echo "Assuming that your C library's 64-bit functions are ok."
6278             libcquad="ok"
6279         fi
6280         $rm_try
6281
6282         case "$libcquad" in
6283             buggy*)
6284                 cat >&4 <<EOM
6285
6286 *** You have a C library with broken 64-bit functions.
6287 *** 64-bit support does not work reliably in this configuration.
6288 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6289 *** Cannot continue, aborting.
6290
6291 EOM
6292                 exit 1
6293                 ;;
6294         esac
6295         case "$longsize" in
6296         4) case "$archname64" in
6297            '') archname64=64int ;;
6298            esac
6299            ;;
6300         esac
6301         ;;
6302 esac
6303
6304 : Look for a hint-file generated 'call-back-unit'.  If the
6305 : user has specified that a maximally 64-bit perl is to be built,
6306 : we may need to set or change some other defaults.
6307 if $test -f use64bitall.cbu; then
6308         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6309         . ./use64bitall.cbu
6310 fi
6311 case "$use64bitall" in
6312 "$define"|true|[yY]*)
6313         case "$longsize" in
6314         4) case "$archname64" in
6315            ''|64int) archname64=64all ;;
6316            esac
6317            ;;
6318         esac
6319         ;;
6320 esac
6321
6322 case "$d_quad:$use64bitint" in
6323 $undef:$define)
6324         cat >&4 <<EOF
6325
6326 *** You have chosen to use 64-bit integers,
6327 *** but none can be found.
6328 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6329 *** Cannot continue, aborting.
6330
6331 EOF
6332         exit 1
6333         ;;
6334 esac
6335
6336 : Check if we are using the GNU C library
6337 echo " "
6338 echo "Checking for GNU C Library..." >&4
6339 cat >try.c <<'EOCP'
6340 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6341    alone are insufficient to distinguish different versions, such as
6342    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6343    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6344 */
6345 #include <stdio.h>
6346 int main(void)
6347 {
6348 #ifdef __GLIBC__
6349 #   ifdef __GLIBC_MINOR__
6350 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6351 #           include <gnu/libc-version.h>
6352             printf("%s\n",  gnu_get_libc_version());
6353 #       else
6354             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6355 #       endif
6356 #   else
6357         printf("%d\n",  __GLIBC__);
6358 #   endif
6359     return 0;
6360 #else
6361     return 1;
6362 #endif
6363 }
6364 EOCP
6365 set try
6366 if eval $compile_ok && $run ./try > glibc.ver; then
6367         val="$define"
6368         gnulibc_version=`$cat glibc.ver`
6369         echo "You are using the GNU C Library version $gnulibc_version"
6370 else
6371         val="$undef"
6372         gnulibc_version=''
6373         echo "You are not using the GNU C Library"
6374 fi
6375 $rm_try glibc.ver
6376 set d_gnulibc
6377 eval $setvar
6378
6379 : see if nm is to be used to determine whether a symbol is defined or not
6380 case "$usenm" in
6381 '')
6382         dflt=''
6383         case "$d_gnulibc" in
6384         "$define")
6385                 echo " "
6386                 echo "nm probably won't work on the GNU C Library." >&4
6387                 dflt=n
6388                 ;;
6389         esac
6390         case "$dflt" in
6391         '')
6392                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6393                         echo " "
6394                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6395                         echo "'nm' won't be sufficient on this system." >&4
6396                         dflt=n
6397                 fi
6398                 ;;
6399         esac
6400         case "$dflt" in
6401         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6402                 if $test $dflt -gt 20; then
6403                         dflt=y
6404                 else
6405                         dflt=n
6406                 fi
6407                 ;;
6408         esac
6409         ;;
6410 *)
6411         case "$usenm" in
6412         true|$define) dflt=y;;
6413         *) dflt=n;;
6414         esac
6415         ;;
6416 esac
6417 $cat <<EOM
6418
6419 I can use $nm to extract the symbols from your C libraries. This
6420 is a time consuming task which may generate huge output on the disk (up
6421 to 3 megabytes) but that should make the symbols extraction faster. The
6422 alternative is to skip the 'nm' extraction part and to compile a small
6423 test program instead to determine whether each symbol is present. If
6424 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6425 this may be the best solution.
6426
6427 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6428
6429 EOM
6430 rp="Shall I use $nm to extract C symbols from the libraries?"
6431 . ./myread
6432 case "$ans" in
6433 [Nn]*) usenm=false;;
6434 *) usenm=true;;
6435 esac
6436
6437 runnm=$usenm
6438 case "$reuseval" in
6439 true) runnm=false;;
6440 esac
6441
6442 : nm options which may be necessary
6443 case "$nm_opt" in
6444 '') if $test -f /mach_boot; then
6445                 nm_opt=''       # Mach
6446         elif $test -d /usr/ccs/lib; then
6447                 nm_opt='-p'     # Solaris (and SunOS?)
6448         elif $test -f /dgux; then
6449                 nm_opt='-p'     # DG-UX
6450         elif $test -f /lib64/rld; then
6451                 nm_opt='-p'     # 64-bit Irix
6452         else
6453                 nm_opt=''
6454         fi;;
6455 esac
6456
6457 : nm options which may be necessary for shared libraries but illegal
6458 : for archive libraries.  Thank you, Linux.
6459 case "$nm_so_opt" in
6460 '')     case "$myuname" in
6461         *linux*|gnu*)
6462                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6463                         nm_so_opt='--dynamic'
6464                 fi
6465                 ;;
6466         esac
6467         ;;
6468 esac
6469
6470 : Figure out where the libc is located
6471 case "$runnm" in
6472 true)
6473 : get list of predefined functions in a handy place
6474 echo " "
6475 case "$libc" in
6476 '') libc=unknown
6477         case "$libs" in
6478         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6479         esac
6480         ;;
6481 esac
6482 case "$libs" in
6483 '') ;;
6484 *)  for thislib in $libs; do
6485         case "$thislib" in
6486         -lc|-lc_s)
6487                 : Handle C library specially below.
6488                 ;;
6489         -l*)
6490                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6491                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6492                         :
6493                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6494                         :
6495                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6496                         :
6497                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6498                         :
6499                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6500                         :
6501                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6502                         :
6503                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6504                         :
6505                 else
6506                         try=''
6507                 fi
6508                 libnames="$libnames $try"
6509                 ;;
6510         *) libnames="$libnames $thislib" ;;
6511         esac
6512         done
6513         ;;
6514 esac
6515 xxx=normal
6516 case "$libc" in
6517 unknown)
6518         set /lib/libc.$so
6519         for xxx in $libpth; do
6520                 $test -r $1 || set $xxx/libc.$so
6521                 : The messy sed command sorts on library version numbers.
6522                 $test -r $1 || \
6523                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6524                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6525                                 h
6526                                 s/[0-9][0-9]*/0000&/g
6527                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6528                                 G
6529                                 s/\n/ /' | \
6530                          $sort | $sed -e 's/^.* //'`
6531                 eval set \$$#
6532         done
6533         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6534         $test -r $1 || set $sysroot/lib/libsys_s$_a
6535         ;;
6536 *)
6537         set blurfl
6538         ;;
6539 esac
6540 if $test -r "$1"; then
6541         echo "Your (shared) C library seems to be in $1."
6542         libc="$1"
6543 elif $test -r /lib/libc && $test -r /lib/clib; then
6544         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6545         xxx=apollo
6546         libc='/lib/clib /lib/libc'
6547         if $test -r /lib/syslib; then
6548                 echo "(Your math library is in /lib/syslib.)"
6549                 libc="$libc /lib/syslib"
6550         fi
6551 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6552         echo "Your C library seems to be in $libc, as you said before."
6553 elif $test -r $incpath/usr/lib/libc$_a; then
6554         libc=$incpath/usr/lib/libc$_a;
6555         echo "Your C library seems to be in $libc.  That's fine."
6556 elif $test -r /lib/libc$_a; then
6557         libc=/lib/libc$_a;
6558         echo "Your C library seems to be in $libc.  You're normal."
6559 else
6560         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6561                 :
6562         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6563                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6564         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6565                 :
6566         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6567                 :
6568         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6569                 :
6570         else
6571                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6572         fi
6573         if $test -r "$tans"; then
6574                 echo "Your C library seems to be in $tans, of all places."
6575                 libc=$tans
6576         else
6577                 libc='blurfl'
6578         fi
6579 fi
6580 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6581         dflt="$libc"
6582         cat <<EOM
6583
6584 If the guess above is wrong (which it might be if you're using a strange
6585 compiler, or your machine supports multiple models), you can override it here.
6586
6587 EOM
6588 else
6589         dflt=''
6590         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6591         cat >&4 <<EOM
6592 I can't seem to find your C library.  I've looked in the following places:
6593
6594 EOM
6595         $sed 's/^/      /' libpath
6596         cat <<EOM
6597
6598 None of these seems to contain your C library. I need to get its name...
6599
6600 EOM
6601 fi
6602 fn=f
6603 rp='Where is your C library?'
6604 . ./getfile
6605 libc="$ans"
6606
6607 echo " "
6608 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6609 set X `cat libnames`
6610 shift
6611 xxx=files
6612 case $# in 1) xxx=file; esac
6613 echo "Extracting names from the following $xxx for later perusal:" >&4
6614 echo " "
6615 $sed 's/^/      /' libnames >&4
6616 echo " "
6617 $echo $n "This may take a while...$c" >&4
6618
6619 for file in $*; do
6620         case $file in
6621         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6622         *) $nm $nm_opt $file 2>/dev/null;;
6623         esac
6624 done >libc.tmp
6625
6626 $echo $n ".$c"
6627 $grep fprintf libc.tmp > libc.ptf
6628 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6629 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6630 xxx='[ADTSIWi]'
6631 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6632         eval $xscan;\
6633         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6634                 eval $xrun
6635 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6636         eval $xscan;\
6637         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6638                 eval $xrun
6639 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6640         eval $xscan;\
6641         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6642                 eval $xrun
6643 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6644         eval $xscan;\
6645         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6646                 eval $xrun
6647 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6648         eval $xscan;\
6649         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6650                 eval $xrun
6651 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6652         eval $xscan;\
6653         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6654                 eval $xrun
6655 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6656                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6657         eval $xscan;\
6658         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6659                 eval $xrun
6660 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6661         eval $xscan;\
6662         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6663                 eval $xrun
6664 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6665         eval $xscan;\
6666         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6667                 eval $xrun
6668 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6669         eval $xscan;\
6670         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6671                 eval $xrun
6672 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6673         eval $xscan;\
6674         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6675                 eval $xrun
6676 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6677         eval $xscan;\
6678         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6679                 eval $xrun
6680 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6681         eval $xscan;\
6682         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6683                 eval $xrun
6684 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6685         eval $xscan;\
6686         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6687                 eval $xrun
6688 else
6689         $nm -p $* 2>/dev/null >libc.tmp
6690         $grep fprintf libc.tmp > libc.ptf
6691         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6692                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6693         then
6694                 nm_opt='-p'
6695                 eval $xrun
6696         else
6697                 echo " "
6698                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6699                 com=''
6700                 if $ar t $libc > libc.tmp && \
6701                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6702                 then
6703                         for thisname in $libnames $libc; do
6704                                 $ar t $thisname >>libc.tmp
6705                         done
6706                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6707                         echo "Ok." >&4
6708                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6709                         for thisname in $libnames $libc; do
6710                                 $ar tv $thisname >>libc.tmp
6711                                 emximp -o tmp.imp $thisname \
6712                                     2>/dev/null && \
6713                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6714                                     < tmp.imp >>libc.tmp
6715                                 $rm -f tmp.imp
6716                         done
6717                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6718                         echo "Ok." >&4
6719                 else
6720                         echo "$ar didn't seem to work right." >&4
6721                         echo "Maybe this is a Cray...trying bld instead..." >&4
6722                         if  bld t $libc | \
6723                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6724                                 $test -s libc.list
6725                         then
6726                                 for thisname in $libnames; do
6727                                         bld t $libnames | \
6728                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6729                                         $ar t $thisname >>libc.tmp
6730                                 done
6731                                 echo "Ok." >&4
6732                         else
6733                                 echo "That didn't work either.  Giving up." >&4
6734                                 exit 1
6735                         fi
6736                 fi
6737         fi
6738 fi
6739 nm_extract="$com"
6740 case "$PASE" in
6741 define)
6742     echo " "
6743     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6744     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6745     ;;
6746 *)  if $test -f /lib/syscalls.exp; then
6747         echo " "
6748         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6749         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6750                 /lib/syscalls.exp >>libc.list
6751     fi
6752     ;;
6753 esac
6754 ;;
6755 esac
6756 $rm -f libnames libpath
6757
6758 : Check if we are using C++
6759 echo " "
6760 echo "Checking for C++..." >&4
6761 $cat >try.c <<'EOCP'
6762 #include <stdio.h>
6763 int main(void)
6764 {
6765 #ifdef __cplusplus
6766     return 0;
6767 #else
6768     return 1;
6769 #endif
6770 }
6771 EOCP
6772 set try
6773 if eval $compile_ok && $run ./try; then
6774         val="$define"
6775         echo "You are using a C++ compiler."
6776 else
6777         val="$undef"
6778         echo "You are not using a C++ compiler."
6779 fi
6780 $rm_try cplusplus$$
6781 set d_cplusplus
6782 eval $setvar
6783
6784 : is a C symbol defined?
6785 csym='tlook=$1;
6786 case "$3" in
6787 -v) tf=libc.tmp; tdc="";;
6788 -a) tf=libc.tmp; tdc="[]";;
6789 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6790 esac;
6791 case "$d_cplusplus" in
6792     $define)    extern_C="extern \"C\"" ;;
6793     *)          extern_C="extern"       ;;
6794 esac;
6795 tx=yes;
6796 case "$reuseval-$4" in
6797 true-) ;;
6798 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6799 esac;
6800 case "$tx" in
6801 yes)
6802         tval=false;
6803         if $test "$runnm" = true; then
6804                 if $contains $tlook $tf >/dev/null 2>&1; then
6805                         tval=true;
6806                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6807                         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;
6808                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6809                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6810                         $rm_try;
6811                 fi;
6812         else
6813                 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;
6814                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6815                 $rm_try;
6816         fi;
6817         ;;
6818 *)
6819         case "$tval" in
6820         $define) tval=true;;
6821         *) tval=false;;
6822         esac;
6823         ;;
6824 esac;
6825 eval "$2=$tval"'
6826
6827 : define an is-in-libc? function
6828 inlibc='echo " "; td=$define; tu=$undef;
6829 sym=$1; var=$2; eval "was=\$$2";
6830 tx=yes;
6831 case "$reuseval$was" in
6832 true) ;;
6833 true*) tx=no;;
6834 esac;
6835 case "$tx" in
6836 yes)
6837         set $sym tres -f;
6838         eval $csym;
6839         case "$tres" in
6840         true)
6841                 echo "$sym() found." >&4;
6842                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6843         *)
6844                 echo "$sym() NOT found." >&4;
6845                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6846         esac;;
6847 *)
6848         case "$was" in
6849         $define) echo "$sym() found." >&4;;
6850         *) echo "$sym() NOT found." >&4;;
6851         esac;;
6852 esac'
6853
6854 : check for length of double
6855 echo " "
6856 case "$doublesize" in
6857 '')
6858         echo "Checking to see how big your double precision numbers are..." >&4
6859         $cat >try.c <<EOCP
6860 #include <stdio.h>
6861 #$i_stdlib I_STDLIB
6862 #ifdef I_STDLIB
6863 #include <stdlib.h>
6864 #endif
6865 int main()
6866 {
6867     printf("%d\n", (int)sizeof(double));
6868     exit(0);
6869 }
6870 EOCP
6871         set try
6872         if eval $compile_ok; then
6873                 doublesize=`$run ./try`
6874                 echo "Your double is $doublesize bytes long."
6875         else
6876                 dflt='8'
6877                 echo "(I can't seem to compile the test program.  Guessing...)"
6878                 rp="What is the size of a double precision number (in bytes)?"
6879                 . ./myread
6880                 doublesize="$ans"
6881         fi
6882         ;;
6883 esac
6884 $rm_try
6885
6886 : check for long doubles
6887 echo " "
6888 echo "Checking to see if you have long double..." >&4
6889 echo 'int main() { long double x = 7.0; }' > try.c
6890 set try
6891 if eval $compile; then
6892         val="$define"
6893         echo "You have long double."
6894 else
6895         val="$undef"
6896         echo "You do not have long double."
6897 fi
6898 $rm_try
6899 set d_longdbl
6900 eval $setvar
6901
6902 : see if ldexpl exists
6903 set ldexpl d_ldexpl
6904 eval $inlibc
6905
6906 : check for length of long double
6907 case "${d_longdbl}${longdblsize}" in
6908 $define)
6909         echo " "
6910         echo "Checking to see how big your long doubles are..." >&4
6911         $cat >try.c <<'EOCP'
6912 #include <stdio.h>
6913 int main()
6914 {
6915         printf("%d\n", sizeof(long double));
6916 }
6917 EOCP
6918         set try
6919         set try
6920         if eval $compile; then
6921                 longdblsize=`$run ./try`
6922                 echo "Your long doubles are $longdblsize bytes long."
6923         else
6924                 dflt='8'
6925                 echo " "
6926                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6927                 rp="What is the size of a long double (in bytes)?"
6928                 . ./myread
6929                 longdblsize="$ans"
6930         fi
6931         if $test "X$doublesize" = "X$longdblsize"; then
6932                 echo "That isn't any different from an ordinary double."
6933                 echo "I'll keep your setting anyway, but you may see some"
6934                 echo "harmless compilation warnings."
6935         fi
6936         ;;
6937 esac
6938 $rm_try
6939
6940 $echo "Checking the kind of long doubles you have..." >&4
6941 case "$d_longdbl" in
6942 define)
6943 $cat <<EOP >try.c
6944 #$i_stdlib I_STDLIB
6945 #define LONGDBLSIZE $longdblsize
6946 #define DOUBLESIZE $doublesize
6947 #include <float.h>
6948 #ifdef I_STDLIB
6949 #include <stdlib.h>
6950 #endif
6951 #include <stdio.h>
6952 static const long double d = -0.1L;
6953 int main() {
6954   unsigned const char* b = (unsigned const char*)(&d);
6955 #if DOUBLESIZE == LONGDBLSIZE
6956   printf("0\n"); /* if it floats like double */
6957   exit(0);
6958 #endif
6959 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6960   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6961     /* IEEE 754 128-bit little-endian */
6962     printf("1\n");
6963     exit(0);
6964   }
6965   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6966     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6967     printf("2\n");
6968     exit(0);
6969   }
6970 #endif
6971 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6972  * while 64-bits platforms have it in 16 bytes.  The trailing bytes
6973  * cannot be trusted. */
6974 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6975   if (b[0] == 0xCD && b[9] == 0xBF) {
6976     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6977      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6978      * Also known as "extended precision". */
6979     printf("3\n");
6980     exit(0);
6981   }
6982   if (b[0] == 0xBF && b[9] == 0xCD) {
6983     /* Is there ever big-endian 80-bit, really?
6984      *
6985      * The Motorola 68881 had another "extended precision" format:
6986      * sign:1 exp:15 zero:16 integer:1 mantissa:63
6987      * for total of 96 bits of bytes.  The zero bits were unused.
6988      * See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL" for more details.
6989      * If it ever becomes relevant, this format should be allocated
6990      * a new doublekind code since it's quite different from the Intel x87.
6991      */
6992     printf("4\n");
6993     exit(0);
6994   }
6995 #endif
6996 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
6997   /* software "double double", the 106 is 53+53.
6998    * but irix thinks it is 107. */
6999   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
7000     /* double double 128-bit fully little-endian,
7001      * little-endian doubles in little-endian order,
7002      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
7003     printf("5\n");
7004     exit(0);
7005   }
7006   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7007     /* double double 128-bit fully big-endian,
7008      * big-endian doubles in big-endian order,
7009      * e.g. PPC/Power and MIPS:
7010      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7011     printf("6\n");
7012     exit(0);
7013   }
7014   if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7015     /* double double 128-bit mixed endian.
7016      * little-endian doubles in big-endian order,
7017      * e.g. ppc64el,
7018      * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7019     printf("7\n");
7020     exit(0);
7021   }
7022   if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7023     /* double double 128-bit mixed endian,
7024      * big-endian doubles in little-endian order,
7025      * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7026     printf("8\n");
7027     exit(0);
7028   }
7029 #endif
7030 /* We are largely making this up because it may well be
7031  * that the VAX format H was never made available to C,
7032  * only to Fortran. */
7033 #if LONGDBLSIZE == 16 && defined(__vax__)
7034   if (b[0] == 0xFD && b[15] == 0x99) {
7035     /* VAX format H, PDP-11 mixed endian. */
7036     printf("9\n");
7037     exit(0);
7038   }
7039 #endif
7040   printf("-1\n"); /* unknown */
7041   exit(0);
7042 }
7043 EOP
7044 set try
7045 if eval $compile; then
7046     longdblkind=`$run ./try`
7047 else
7048     longdblkind=-1
7049 fi
7050 ;;
7051 *) longdblkind=0 ;;
7052 esac
7053 case "$longdblkind" in
7054 0) echo "Your long doubles are doubles." >&4 ;;
7055 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7056 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7057 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
7058 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
7059 5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >& 4 ;;
7060 6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >& 4 ;;
7061 7) echo "You have 128-bit mixed-endian double-double long doubles (64-bit LEs in BE)." >& 4 ;;
7062 8) echo "You have 128-bit mixed-endian double-double long doubles (64-bit BEs in LE)." >& 4 ;;
7063 9) echo "You have 128-bit PDP-style mixed-endian long doubles (VAX format H)." >& 4 ;;
7064 *) echo "Cannot figure out your long double." >&4 ;;
7065 esac
7066 d_long_double_style_ieee=$undef
7067 d_long_double_style_ieee_std=$undef
7068 d_long_double_style_ieee_extended=$undef
7069 d_long_double_style_ieee_doubledouble=$undef
7070 d_long_double_style_vax=$undef
7071 case "$longdblkind" in
7072 1|2|3|4|5|6|7|8) d_long_double_style_ieee=$define ;;
7073 esac
7074 case "$longdblkind" in
7075 1|2) d_long_double_style_ieee_std=$define ;;
7076 esac
7077 case "$longdblkind" in
7078 3|4) d_long_double_style_ieee_extended=$define ;;
7079 esac
7080 case "$longdblkind" in
7081 5|6|7|8) d_long_double_style_ieee_doubledouble=$define ;;
7082 esac
7083 case "$longdblkind" in
7084 9) d_long_double_style_vax=$define ;;
7085 esac
7086 $rm_try
7087
7088 : determine the architecture name
7089 echo " "
7090 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7091         tarch=`arch`"-$osname"
7092 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7093         if uname -m > tmparch 2>&1 ; then
7094                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7095                         -e 's/$/'"-$osname/" tmparch`
7096         else
7097                 tarch="$osname"
7098         fi
7099         $rm -f tmparch
7100 else
7101         tarch="$osname"
7102 fi
7103 case "$myarchname" in
7104 ''|"$tarch") ;;
7105 *)
7106         echo "(Your architecture name used to be $myarchname.)"
7107         archname=''
7108         ;;
7109 esac
7110 case "$targetarch" in
7111 '') ;;
7112 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7113 esac
7114 myarchname="$tarch"
7115 case "$archname" in
7116 '') dflt="$tarch";;
7117 *) dflt="$archname";;
7118 esac
7119 rp='What is your architecture name'
7120 . ./myread
7121 archname="$ans"
7122
7123 : optionally add API version to the architecture for versioned archlibs
7124 case "$useversionedarchname" in
7125 $define|true|[yY]*) dflt='y';;
7126 *)                  dflt='n';;
7127 esac
7128 rp='Add the Perl API version to your archname?'
7129 . ./myread
7130 case "$ans" in
7131 y|Y)    useversionedarchname="$define" ;;
7132 *)      useversionedarchname="$undef" ;;
7133 esac
7134 case "$useversionedarchname" in
7135 $define)
7136         case "$archname" in
7137         *-$api_versionstring)
7138                 echo "...and architecture name already has -$api_versionstring" >&4
7139                 ;;
7140         *)
7141                 archname="$archname-$api_versionstring"
7142                 echo "...setting architecture name to $archname." >&4
7143                 ;;
7144         esac
7145         ;;
7146 esac
7147
7148 case "$usethreads" in
7149 $define)
7150         echo "Threads selected." >&4
7151         case "$archname" in
7152         *-thread*) echo "...and architecture name already has -thread." >&4
7153                 ;;
7154         *)      archname="$archname-thread"
7155                 echo "...setting architecture name to $archname." >&4
7156                 ;;
7157         esac
7158         ;;
7159 esac
7160 case "$usemultiplicity" in
7161 $define)
7162         echo "Multiplicity selected." >&4
7163         case "$archname" in
7164         *-multi*) echo "...and architecture name already has -multi." >&4
7165                 ;;
7166         *)      archname="$archname-multi"
7167                 echo "...setting architecture name to $archname." >&4
7168                 ;;
7169         esac
7170         ;;
7171 esac
7172 case "$use64bitint$use64bitall" in
7173 *"$define"*)
7174         case "$archname64" in
7175         '')
7176                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7177                 ;;
7178         *)
7179                 case "$use64bitint" in
7180                 "$define") echo "64 bit integers selected." >&4 ;;
7181                 esac
7182                 case "$use64bitall" in
7183                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7184                 esac
7185                 case "$archname" in
7186                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7187                         ;;
7188                 *)      archname="$archname-$archname64"
7189                         echo "...setting architecture name to $archname." >&4
7190                         ;;
7191                 esac
7192                 ;;
7193         esac
7194 esac
7195 case "$uselongdouble" in
7196 $define)
7197         echo "Long doubles selected." >&4
7198         case "$longdblsize" in
7199         $doublesize)
7200                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7201                 ;;
7202         *)
7203                 case "$archname" in
7204                 *-ld*) echo "...and architecture name already has -ld." >&4
7205                         ;;
7206                 *)      archname="$archname-ld"
7207                         echo "...setting architecture name to $archname." >&4
7208                         ;;
7209                 esac
7210                 ;;
7211         esac
7212         ;;
7213 esac
7214 case "$usequadmath" in
7215 $define)
7216         echo "quadmath selected." >&4
7217         case "$archname" in
7218         *-quadmath*) echo "...and architecture name already has -quadmath." >&4
7219                 ;;
7220         *)      archname="$archname-quadmath"
7221                 echo "...setting architecture name to $archname." >&4
7222                 ;;
7223         esac
7224         ;;
7225 esac
7226 if $test -f archname.cbu; then
7227         echo "Your platform has some specific hints for architecture name, using them..."
7228         . ./archname.cbu
7229 fi
7230
7231 : set the prefixit variable, to compute a suitable default value
7232 prefixit='case "$3" in
7233 ""|none)
7234         case "$oldprefix" in
7235         "") eval "$1=\"\$$2\"";;
7236         *)
7237                 case "$3" in
7238                 "") eval "$1=";;
7239                 none)
7240                         eval "tp=\"\$$2\"";
7241                         case "$tp" in
7242                         ""|" ") eval "$1=\"\$$2\"";;
7243                         *) eval "$1=";;
7244                         esac;;
7245                 esac;;
7246         esac;;
7247 *)
7248         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7249         case "$tp" in
7250         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7251         /*-$oldprefix/*|\~*-$oldprefix/*)
7252                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7253         *) eval "$1=\"\$$2\"";;
7254         esac;;
7255 esac'
7256
7257 : determine installation style
7258 : For now, try to deduce it from prefix unless it is already set.
7259 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7260 case "$installstyle" in
7261 '')     case "$prefix" in
7262                 *perl*) dflt='lib';;
7263                 *) dflt='lib/perl5' ;;
7264         esac
7265         ;;
7266 *)      dflt="$installstyle" ;;
7267 esac
7268 : Probably not worth prompting for this since we prompt for all
7269 : the directories individually, and the prompt would be too long and
7270 : confusing anyway.
7271 installstyle=$dflt
7272
7273 : determine where public executables go
7274 echo " "
7275 set dflt bin bin
7276 eval $prefixit
7277 fn=d~
7278 rp='Pathname where the public executables will reside?'
7279 . ./getfile
7280 if $test "X$ansexp" != "X$binexp"; then
7281         installbin=''
7282 fi
7283 prefixvar=bin
7284 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7285 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7286 :     this via initialinstalllocation
7287 . ./setprefixvar
7288
7289 case "$userelocatableinc" in
7290 $define|true|[yY]*)     dflt='y' ;;
7291 *)                      dflt='n' ;;
7292 esac
7293 cat <<EOM
7294
7295 Would you like to build Perl so that the installation is relocatable, so that
7296 library paths in @INC are determined relative to the path of the perl binary?
7297 This is not advised for system Perl installs, or if you need to run setid
7298 scripts or scripts under taint mode.
7299
7300 If this doesn't make any sense to you, just accept the default '$dflt'.
7301 EOM
7302 rp='Use relocatable @INC?'
7303 . ./myread
7304 case "$ans" in
7305 y|Y)    val="$define" ;;
7306 *)      val="$undef"  ;;
7307 esac
7308 set userelocatableinc
7309 eval $setvar
7310
7311 initialinstalllocation="$binexp"
7312 : Default prefix is now "up one level from where the binaries are"
7313 case "$userelocatableinc" in
7314 $define|true|[yY]*)
7315     bin=".../"
7316     binexp=".../"
7317     prefix=".../.."
7318     prefixexp=".../.."
7319     installprefixexp=".../.."
7320     ;;
7321 esac
7322
7323 : determine where private library files go
7324 : Usual default is /usr/local/lib/perl5/$version.
7325 : Also allow things like /opt/perl/lib/$version, since
7326 : /opt/perl/lib/perl5... would be redundant.
7327 : The default "style" setting is made in installstyle.U
7328 case "$installstyle" in
7329 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7330 *)       set dflt privlib lib/$version ;;
7331 esac
7332 eval $prefixit
7333 $cat <<EOM
7334
7335 There are some auxiliary files for $package that need to be put into a
7336 private library directory that is accessible by everyone.
7337
7338 EOM
7339 fn=$binexp
7340 fn=d~+
7341 rp='Pathname where the private library files will reside?'
7342 . ./getfile
7343 prefixvar=privlib
7344 . ./setprefixvar
7345
7346 : set the prefixup variable, to restore leading tilda escape
7347 prefixup='case "$prefixexp" in
7348 "$prefix") ;;
7349 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7350 esac'
7351
7352 : determine where public architecture dependent libraries go
7353 set archlib archlib
7354 eval $prefixit
7355 : privlib default is /usr/local/lib/$package/$version
7356 : archlib default is /usr/local/lib/$package/$version/$archname
7357 : privlib may have an optional trailing /share.
7358 tdflt=`echo $privlib | $sed 's,/share$,,'`
7359 tdflt=$tdflt/$archname
7360 case "$archlib" in
7361 '')     dflt=$tdflt
7362         ;;
7363 *)      dflt="$archlib"
7364     ;;
7365 esac
7366 $cat <<EOM
7367
7368 $spackage contains architecture-dependent library files.  If you are
7369 sharing libraries in a heterogeneous environment, you might store
7370 these files in a separate location.  Otherwise, you can just include
7371 them with the rest of the public library files.
7372
7373 EOM
7374 fn=$binexp
7375 fn=d+~
7376 rp='Where do you want to put the public architecture-dependent libraries?'
7377 . ./getfile
7378 prefixvar=archlib
7379 . ./setprefixvar
7380 if $test X"$archlib" = X"$privlib"; then
7381         d_archlib="$undef"
7382 else
7383         d_archlib="$define"
7384 fi
7385
7386 : see if setuid scripts can be secure
7387 $cat <<EOM
7388
7389 Some kernels have a bug that prevents setuid #! scripts from being
7390 secure.  Some sites have disabled setuid #! scripts because of this.
7391
7392 First let's decide if your kernel supports secure setuid #! scripts.
7393 (If setuid #! scripts would be secure but have been disabled anyway,
7394 don't say that they are secure if asked.)
7395
7396 EOM
7397
7398 val="$undef"
7399 if $test -d /dev/fd; then
7400         echo "#!$ls" >reflect
7401         chmod +x,u+s reflect
7402         ./reflect >flect 2>&1
7403         if $contains "/dev/fd" flect >/dev/null; then
7404                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7405                 val="$define"
7406         else
7407                 $cat <<EOM
7408 If you are not sure if they are secure, I can check but I'll need a
7409 username and password different from the one you are using right now.
7410 If you don't have such a username or don't want me to test, simply
7411 enter 'none'.
7412
7413 EOM
7414                 rp='Other username to test security of setuid scripts with?'
7415                 dflt='none'
7416                 . ./myread
7417                 case "$ans" in
7418                 n|none)
7419                         case "$d_suidsafe" in
7420                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7421                                 dflt=n;;
7422                         "$undef")
7423                                 echo "Well, the $hint value is *not* secure." >&4
7424                                 dflt=n;;
7425                         *)      echo "Well, the $hint value *is* secure." >&4
7426                                 dflt=y;;
7427                         esac
7428                         ;;
7429                 *)
7430                         $rm -f reflect flect
7431                         echo "#!$ls" >reflect
7432                         chmod +x,u+s reflect
7433                         echo >flect
7434                         chmod a+w flect
7435                         echo '"su" will (probably) prompt you for '"$ans's password."
7436                         su $ans -c './reflect >flect'
7437                         if $contains "/dev/fd" flect >/dev/null; then
7438                                 echo "Okay, it looks like setuid scripts are secure." >&4
7439                                 dflt=y
7440                         else
7441                                 echo "I don't think setuid scripts are secure." >&4
7442                                 dflt=n
7443                         fi
7444                         ;;
7445                 esac
7446                 rp='Does your kernel have *secure* setuid scripts?'
7447                 . ./myread
7448                 case "$ans" in
7449                 [yY]*)  val="$define";;
7450                 *)      val="$undef";;
7451                 esac
7452         fi
7453 else
7454         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7455         echo "(That's for file descriptors, not floppy disks.)"
7456         val="$undef"
7457 fi
7458 set d_suidsafe
7459 eval $setvar
7460
7461 $rm -f reflect flect
7462
7463 : now see if they want to do setuid emulation
7464 if $test $patchlevel -lt 11; then
7465 echo " "
7466 val="$undef"
7467 case "$d_suidsafe" in
7468 "$define")
7469         val="$undef"
7470         echo "No need to emulate SUID scripts since they are secure here." >&4
7471         ;;
7472 *)
7473         $cat <<EOM
7474 Some systems have disabled setuid scripts, especially systems where
7475 setuid scripts cannot be secure.  On systems where setuid scripts have
7476 been disabled, the setuid/setgid bits on scripts are currently
7477 useless.  It is possible for $package to detect those bits and emulate
7478 setuid/setgid in a secure fashion.  This emulation will only work if
7479 setuid scripts have been disabled in your kernel.
7480
7481 EOM
7482         case "$d_dosuid" in
7483         "$define") dflt=y ;;
7484         *) dflt=n ;;
7485         esac
7486         rp="Do you want to do setuid/setgid emulation?"
7487         . ./myread
7488         case "$ans" in
7489         [yY]*)  val="$define";;
7490         *)      val="$undef";;
7491         esac
7492         ;;
7493 esac
7494 set d_dosuid
7495 eval $setvar
7496 else
7497     case "$d_dosuid" in
7498         "$define")
7499         cat >&4 <<EOH
7500
7501 SUID emulation has been removed for 5.12
7502 Please re-run Configure without -Dd_dosuid
7503
7504 EOH
7505         exit 1;
7506         ;;
7507     esac
7508     d_dosuid=undef
7509 fi
7510
7511 : Find perl5.005 or later.
7512 echo "Looking for a previously installed perl5.005 or later... "
7513 case "$perl5" in
7514 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7515                 : Check if this perl is recent and can load a simple module
7516                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7517                         perl5=$tdir/perl
7518                         break;
7519                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7520                         perl5=$tdir/perl5
7521                         break;
7522                 fi
7523         done
7524         ;;
7525 *)      perl5="$perl5"
7526         ;;
7527 esac
7528 case "$perl5" in
7529 '')     echo "None found.  That's ok.";;
7530 *)      echo "Using $perl5." ;;
7531 esac
7532
7533 : Set the siteprefix variables
7534 $cat <<EOM
7535
7536 After $package is installed, you may wish to install various
7537 add-on modules and utilities.  Typically, these add-ons will
7538 be installed under $prefix with the rest
7539 of this package.  However, you may wish to install such add-ons
7540 elsewhere under a different prefix.
7541
7542 If you do not wish to put everything under a single prefix, that's
7543 ok.  You will be prompted for the individual locations; this siteprefix
7544 is only used to suggest the defaults.
7545
7546 The default should be fine for most people.
7547
7548 EOM
7549 fn=d~+
7550 rp='Installation prefix to use for add-on modules and utilities?'
7551 : XXX Here might be another good place for an installstyle setting.
7552 case "$siteprefix" in
7553 '') dflt=$prefix ;;
7554 *)  dflt=$siteprefix ;;
7555 esac
7556 . ./getfile
7557 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7558 oldsiteprefix=''
7559 case "$siteprefix" in
7560 '') ;;
7561 *)      case "$ans" in
7562         "$prefix") ;;
7563         *) oldsiteprefix="$prefix";;
7564         esac
7565         ;;
7566 esac
7567 siteprefix="$ans"
7568 siteprefixexp="$ansexp"
7569
7570 : determine where site specific libraries go.
7571 : Usual default is /usr/local/lib/perl5/site_perl/$version
7572 : The default "style" setting is made in installstyle.U
7573 : XXX No longer works with Prefixit stuff.
7574 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7575 case "$sitelib" in
7576 '') case "$installstyle" in
7577         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7578         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7579         esac
7580         ;;
7581 *)      dflt="$sitelib"
7582         ;;
7583 esac
7584 $cat <<EOM
7585
7586 The installation process will create a directory for
7587 site-specific extensions and modules.  Most users find it convenient
7588 to place all site-specific files in this directory rather than in the
7589 main distribution directory.
7590
7591 EOM
7592 fn=d~+
7593 rp='Pathname for the site-specific library files?'
7594 . ./getfile
7595 prefixvar=sitelib
7596 . ./setprefixvar
7597 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7598
7599 : Determine list of previous versions to include in @INC
7600 $cat > getverlist <<EOPL
7601 #!$perl5 -w
7602 use File::Basename;
7603 \$api_versionstring = "$api_versionstring";
7604 \$version = "$version";
7605 \$stem = "$sitelib_stem";
7606 \$archname = "$archname";
7607 EOPL
7608         $cat >> getverlist <<'EOPL'
7609 # The list found is store twice for each entry: the original name, and
7610 # the binary broken down version as pack "sss", so sorting is easy and
7611 # unambiguous. This will work for all versions that have a maximum of
7612 # three digit groups, separate by '.'s or '_'s. Names are extended with
7613 # ".0.0" to ensure at least three elements for the pack.
7614 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7615
7616 # Can't have leading @ because metaconfig interprets it as a command!
7617 ;@inc_version_list=();
7618 # XXX Redo to do opendir/readdir?
7619 if (-d $stem) {
7620     chdir($stem);
7621     ;@candidates = map {
7622         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7623     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7624 }
7625 else {
7626     ;@candidates = ();
7627 }
7628
7629 ($pversion, $aversion, $vsn5005) = map {
7630     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7631 foreach $d (@candidates) {
7632     if ($d->[1] lt $pversion) {
7633         if ($d->[1] ge $aversion) {
7634             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7635         }
7636         elsif ($d->[1] ge $vsn5005) {
7637             unshift(@inc_version_list, grep { -d } $d->[0]);
7638         }
7639     }
7640     else {
7641         # Skip newer version.  I.e. don't look in
7642         # 5.7.0 if we're installing 5.6.1.
7643     }
7644 }
7645
7646 if (@inc_version_list) {
7647     print join(' ', @inc_version_list);
7648 }
7649 else {
7650     # Blank space to preserve value for next Configure run.
7651     print " ";
7652 }
7653 EOPL
7654 chmod +x getverlist
7655 case "$inc_version_list" in
7656 '')     if test -x "$perl5$exe_ext"; then
7657                 dflt=`$perl5 getverlist`
7658         else
7659                 dflt='none'
7660         fi
7661         ;;
7662 $undef) dflt='none' ;;
7663 *)  eval dflt=\"$inc_version_list\" ;;
7664 esac
7665 case "$dflt" in
7666 ''|' ') dflt=none ;;
7667 esac
7668 case "$dflt" in
7669 5.005) dflt=none ;;
7670 esac
7671 $cat <<EOM
7672
7673 In order to ease the process of upgrading, this version of perl
7674 can be configured to use modules built and installed with earlier
7675 versions of perl that were installed under $prefix.  Specify here
7676 the list of earlier versions that this version of perl should check.
7677 If Configure detected no earlier versions of perl installed under
7678 $prefix, then the list will be empty.  Answer 'none' to tell perl
7679 to not search earlier versions.
7680
7681 The default should almost always be sensible, so if you're not sure,
7682 just accept the default.
7683 EOM
7684
7685 rp='List of earlier versions to include in @INC?'
7686 . ./myread
7687 case "$ans" in
7688 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7689 *) inc_version_list="$ans" ;;
7690 esac
7691 case "$inc_version_list" in
7692 ''|' ')
7693         inc_version_list_init='0'
7694         d_inc_version_list="$undef"
7695         ;;
7696 *)      inc_version_list_init=`echo $inc_version_list |
7697                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7698         d_inc_version_list="$define"
7699         ;;
7700 esac
7701 $rm -f getverlist
7702
7703 : see if malloc/malloc.h has to be included
7704 set malloc/malloc.h i_mallocmalloc
7705 eval $inhdr
7706
7707 : see if this is a malloc.h system
7708 : we want a real compile instead of Inhdr because some systems have a
7709 : malloc.h that just gives a compile error saying to use stdlib.h instead
7710 echo " "
7711 $cat >try.c <<EOCP
7712 #include <stdlib.h>
7713 #include <malloc.h>
7714 #$i_mallocmalloc I_MALLOCMALLOC
7715 #ifdef I_MALLOCMALLOC
7716 # include <malloc/malloc.h>
7717 #endif
7718
7719 int main () { return 0; }
7720 EOCP
7721 set try
7722 if eval $compile; then
7723     echo "<malloc.h> found." >&4
7724     val="$define"
7725 else
7726     echo "<malloc.h> NOT found." >&4
7727     val="$undef"
7728 fi
7729 $rm_try
7730 set i_malloc
7731 eval $setvar
7732
7733 : check for length of pointer
7734 echo " "
7735 case "$ptrsize" in
7736 '')
7737         echo "Checking to see how big your pointers are..." >&4
7738         $cat >try.c <<EOCP
7739 #include <stdio.h>
7740 #$i_stdlib I_STDLIB
7741 #ifdef I_STDLIB
7742 #include <stdlib.h>
7743 #endif
7744 int main()
7745 {
7746     printf("%d\n", (int)sizeof(void *));
7747     exit(0);
7748 }
7749 EOCP
7750         set try
7751         if eval $compile_ok; then
7752                 ptrsize=`$run ./try`
7753                 echo "Your pointers are $ptrsize bytes long."
7754         else
7755                 dflt='4'
7756                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7757                 rp="What is the size of a pointer (in bytes)?"
7758                 . ./myread
7759                 ptrsize="$ans"
7760         fi
7761         ;;
7762 esac
7763 $rm_try
7764 case "$use64bitall" in
7765 "$define"|true|[yY]*)
7766         case "$ptrsize" in
7767         4)      cat <<EOM >&4
7768
7769 *** You have chosen a maximally 64-bit build,
7770 *** but your pointers are only 4 bytes wide.
7771 *** Please rerun Configure without -Duse64bitall.
7772 EOM
7773                 case "$d_quad" in
7774                 define)
7775                         cat <<EOM >&4
7776 *** Since you have quads, you could possibly try with -Duse64bitint.
7777 EOM
7778                         ;;
7779                 esac
7780                 cat <<EOM >&4
7781 *** Cannot continue, aborting.
7782
7783 EOM
7784
7785                 exit 1
7786                 ;;
7787         esac
7788         ;;
7789 esac
7790
7791
7792 : determine whether to use malloc wrapping
7793 echo " "
7794 case "$usemallocwrap" in
7795 [yY]*|true|$define)     dflt='y' ;;
7796 [nN]*|false|$undef)     dflt='n' ;;
7797 *)      case "$usedevel" in
7798         [yY]*|true|$define)     dflt='y' ;;
7799         *) dflt='n' ;;
7800         esac
7801         ;;
7802 esac
7803 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7804 . ./myread
7805 usemallocwrap="$ans"
7806 case "$ans" in
7807 y*|true)
7808         usemallocwrap="$define" ;;
7809 *)
7810         usemallocwrap="$undef" ;;
7811 esac
7812
7813 : determine which malloc to compile in
7814 echo " "
7815 case "$usemymalloc" in
7816 [yY]*|true|$define)     dflt='y' ;;
7817 [nN]*|false|$undef)     dflt='n' ;;
7818 *)      case "$ptrsize" in
7819         4) dflt='y' ;;
7820         *) dflt='n' ;;
7821         esac
7822         if test "$useithreads" = "$define"; then dflt='n'; fi
7823         ;;
7824 esac
7825 rp="Do you wish to attempt to use the malloc that comes with $package?"
7826 . ./myread
7827 usemymalloc="$ans"
7828 case "$ans" in
7829 y*|true)
7830         usemymalloc='y'
7831         mallocsrc='malloc.c'
7832         mallocobj="malloc$_o"
7833         d_mymalloc="$define"
7834         case "$libs" in
7835         *-lmalloc*)
7836                 : Remove malloc from list of libraries to use
7837                 echo "Removing unneeded -lmalloc from library list" >&4
7838                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7839                 shift
7840                 libs="$*"
7841                 echo "libs = $libs" >&4
7842                 ;;
7843         esac
7844         ;;
7845 *)
7846         usemymalloc='n'
7847         mallocsrc=''
7848         mallocobj=''
7849         d_mymalloc="$undef"
7850         ;;
7851 esac
7852
7853 : compute the return types of malloc and free
7854 echo " "
7855 $cat >malloc.c <<END
7856 #$i_malloc I_MALLOC
7857 #$i_stdlib I_STDLIB
7858 #include <stdio.h>
7859 #include <sys/types.h>
7860 #ifdef I_MALLOC
7861 #include <malloc.h>
7862 #endif
7863 #ifdef I_STDLIB
7864 #include <stdlib.h>
7865 #endif
7866 #ifdef TRY_MALLOC
7867 void *malloc();
7868 #endif
7869 #ifdef TRY_FREE
7870 void free();
7871 #endif
7872 END
7873 case "$malloctype" in
7874 '')
7875         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7876                 malloctype='void *'
7877         else
7878                 malloctype='char *'
7879         fi
7880         ;;
7881 esac
7882 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7883
7884 case "$freetype" in
7885 '')
7886         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7887                 freetype='void'
7888         else
7889                 freetype='int'
7890         fi
7891         ;;
7892 esac
7893 echo "Your system uses $freetype free(), it would seem." >&4
7894 $rm -f malloc.[co]
7895 : determine where site specific architecture-dependent libraries go.
7896 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7897 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7898 : sitelib may have an optional trailing /share.
7899 case "$sitearch" in
7900 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7901         dflt="$dflt/$archname"
7902         ;;
7903 *)      dflt="$sitearch"
7904         ;;
7905 esac
7906 set sitearch sitearch none
7907 eval $prefixit
7908 $cat <<EOM
7909
7910 The installation process will also create a directory for
7911 architecture-dependent site-specific extensions and modules.
7912
7913 EOM
7914 fn=d~+
7915 rp='Pathname for the site-specific architecture-dependent library files?'
7916 . ./getfile
7917 prefixvar=sitearch
7918 . ./setprefixvar
7919 if $test X"$sitearch" = X"$sitelib"; then
7920         d_sitearch="$undef"
7921 else
7922         d_sitearch="$define"
7923 fi
7924
7925 : Set the vendorprefix variables
7926 $cat <<EOM
7927
7928 The installation process will also create a directory for
7929 vendor-supplied add-ons.  Vendors who supply perl with their system
7930 may find it convenient to place all vendor-supplied files in this
7931 directory rather than in the main distribution directory.  This will
7932 ease upgrades between binary-compatible maintenance versions of perl.
7933
7934 Of course you may also use these directories in whatever way you see
7935 fit.  For example, you might use them to access modules shared over a
7936 company-wide network.
7937
7938 The default answer should be fine for most people.
7939 This causes further questions about vendor add-ons to be skipped
7940 and no vendor-specific directories will be configured for perl.
7941
7942 EOM
7943 rp='Do you want to configure vendor-specific add-on directories?'
7944 case "$usevendorprefix" in
7945 define|true|[yY]*) dflt=y ;;
7946 *)      : User may have set vendorprefix directly on Configure command line.
7947         case "$vendorprefix" in
7948         ''|' ') dflt=n ;;
7949         *)      dflt=y ;;
7950         esac
7951         ;;
7952 esac
7953 . ./myread
7954 case "$ans" in
7955 [yY]*)  fn=d~+
7956         rp='Installation prefix to use for vendor-supplied add-ons?'
7957         case "$vendorprefix" in
7958         '') dflt="$prefix" ;;
7959         *)  dflt=$vendorprefix ;;
7960         esac
7961         . ./getfile
7962         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7963         oldvendorprefix=''
7964         case "$vendorprefix" in
7965         '') ;;
7966         *)      case "$ans" in
7967                 "$prefix") ;;
7968                 *) oldvendorprefix="$prefix";;
7969                 esac
7970                 ;;
7971         esac
7972         usevendorprefix="$define"
7973         vendorprefix="$ans"
7974         vendorprefixexp="$ansexp"
7975         ;;
7976 *)      usevendorprefix="$undef"
7977         vendorprefix=''
7978         vendorprefixexp=''
7979         ;;
7980 esac
7981
7982 : Set the vendorlib variables
7983 case "$vendorprefix" in
7984 '')     d_vendorlib="$undef"
7985         vendorlib=''
7986         vendorlibexp=''
7987         ;;
7988 *)      d_vendorlib="$define"
7989         : determine where vendor-supplied modules go.
7990         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7991         case "$vendorlib" in
7992         '')
7993                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7994                 case "$installstyle" in
7995                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7996                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7997                 esac
7998                 ;;
7999         *)      dflt="$vendorlib"
8000                 ;;
8001         esac
8002         fn=d~+
8003         rp='Pathname for the vendor-supplied library files?'
8004         . ./getfile
8005         vendorlib="$ans"
8006         vendorlibexp="$ansexp"
8007         ;;
8008 esac
8009 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
8010 prefixvar=vendorlib
8011 . ./installprefix
8012
8013 : Set the vendorarch variables
8014 case "$vendorprefix" in
8015 '')     d_vendorarch="$undef"
8016         vendorarch=''
8017         vendorarchexp=''
8018         ;;
8019 *)      d_vendorarch="$define"
8020         : determine where vendor-supplied architecture-dependent libraries go.
8021         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
8022         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
8023         : vendorlib may have an optional trailing /share.
8024         case "$vendorarch" in
8025         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
8026                 dflt="$dflt/$archname"
8027                 ;;
8028         *)      dflt="$vendorarch" ;;
8029         esac
8030         fn=d~+
8031         rp='Pathname for vendor-supplied architecture-dependent files?'
8032         . ./getfile
8033         vendorarch="$ans"
8034         vendorarchexp="$ansexp"
8035         ;;
8036 esac
8037 prefixvar=vendorarch
8038 . ./installprefix
8039 if $test X"$vendorarch" = X"$vendorlib"; then
8040         d_vendorarch="$undef"
8041 else
8042         d_vendorarch="$define"
8043 fi
8044
8045 : Final catch-all directories to search
8046 $cat <<EOM
8047
8048 Lastly, you can have perl look in other directories for extensions and
8049 modules in addition to those already specified.
8050 These directories will be searched after
8051         $sitearch
8052         $sitelib
8053 EOM
8054 test X"$vendorlib" != "X" && echo '     ' $vendorlib
8055 test X"$vendorarch" != "X" && echo '    ' $vendorarch
8056 echo ' '
8057 case "$otherlibdirs" in
8058 ''|' ') dflt='none' ;;
8059 *)      dflt="$otherlibdirs" ;;
8060 esac
8061 $cat <<EOM
8062 Enter a colon-separated set of extra paths to include in perl's @INC
8063 search path, or enter 'none' for no extra paths.
8064
8065 EOM
8066
8067 rp='Colon-separated list of additional directories for perl to search?'
8068 . ./myread
8069 case "$ans" in
8070 ' '|''|none)    otherlibdirs=' ' ;;
8071 *)      otherlibdirs="$ans" ;;
8072 esac
8073 case "$otherlibdirs" in
8074 ' ') val=$undef ;;
8075 *)      val=$define ;;
8076 esac
8077 set d_perl_otherlibdirs
8078 eval $setvar
8079
8080 : DTrace support
8081 dflt_dtrace='/usr/sbin/dtrace'
8082 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8083
8084 cat <<EOM
8085
8086 Perl can be built to support DTrace on platforms that support it.
8087 DTrace is a diagnosis and performance analysis tool from Sun.
8088
8089 If this doesn't make any sense to you, just accept the default.
8090 EOM
8091
8092 while $test 1 ; do
8093         case "$usedtrace" in
8094         $define|true|[yY]*)
8095                 dflt='y'
8096                 ;;
8097         ?*)
8098                 dflt='y'
8099                 dflt_dtrace=$usedtrace
8100                 ;;
8101         *)
8102                 dflt='n'
8103                 ;;
8104         esac
8105
8106         rp='Support DTrace if available?'
8107         . ./myread
8108         case "$ans" in
8109         y|Y)    val="$define" ;;
8110         *)      val="$undef" ;;
8111         esac
8112         set usedtrace
8113         eval $setvar
8114
8115         test "X$usedtrace" != "X$define" && break
8116
8117         echo " "
8118         rp='Where is the dtrace executable?'
8119         dflt=$dflt_dtrace
8120         . ./getfile
8121         val="$ans"
8122         set dtrace
8123         eval $setvar
8124
8125         if $test -f $dtrace
8126         then
8127                 if $dtrace -h -s ../perldtrace.d \
8128                         -o perldtrace.tmp >/dev/null 2>&1 \
8129                         && rm -f perldtrace.tmp
8130                 then
8131                         echo " "
8132                         echo "Good: your $dtrace knows about the -h flag."
8133                 else
8134                         cat >&2 <<EOM
8135
8136 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8137 ***
8138 *** Your installed dtrace doesn't support the -h switch to compile a D
8139 *** program into a C header. Can't continue.
8140
8141 EOM
8142                         exit 1
8143                 fi
8144                 break;
8145         fi
8146
8147         case "$fastread" in
8148         yes)
8149                 cat >&2 <<EOM
8150
8151 *** $me:  Fatal Error:  $dtrace not found.
8152 *** Can't continue.
8153
8154 EOM
8155                 exit 1
8156                 ;;
8157         *)
8158                 echo "*** $dtrace was not found."
8159                 echo " "
8160                 ;;
8161         esac
8162 done
8163
8164 : See if we want extra modules installed
8165 echo " "
8166 case "$extras" in
8167 '') dflt='n';;
8168 *) dflt='y';;
8169 esac
8170 cat <<EOM
8171 Perl can be built with extra modules or bundles of modules which
8172 will be fetched from the CPAN and installed alongside Perl.
8173
8174 Notice that you will need access to the CPAN; either via the Internet,
8175 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8176 be asked later to configure the CPAN.pm module which will in turn do
8177 the installation of the rest of the extra modules or bundles.)
8178
8179 Notice also that if the modules require any external software such as
8180 libraries and headers (the libz library and the zlib.h header for the
8181 Compress::Zlib module, for example) you MUST have any such software
8182 already installed, this configuration process will NOT install such
8183 things for you.
8184
8185 If this doesn't make any sense to you, just accept the default '$dflt'.
8186 EOM
8187 rp='Install any extra modules (y or n)?'
8188 . ./myread
8189 case "$ans" in
8190 y|Y)
8191         cat <<EOM
8192
8193 Please list any extra modules or bundles to be installed from CPAN,
8194 with spaces between the names.  The names can be in any format the
8195 'install' command of CPAN.pm will understand.  (Answer 'none',
8196 without the quotes, to install no extra modules or bundles.)
8197 EOM
8198         rp='Extras?'
8199         dflt="$extras"
8200         . ./myread
8201         extras="$ans"
8202 esac
8203 case "$extras" in
8204 ''|'none')
8205         val=''
8206         $rm -f ../extras.lst
8207         ;;
8208 *)      echo "(Saving the list of extras for later...)"
8209         echo "$extras" > ../extras.lst
8210         val="'$extras'"
8211         ;;
8212 esac
8213 set extras
8214 eval $setvar
8215 echo " "
8216
8217 : determine where html pages for programs go
8218 set html1dir html1dir none
8219 eval $prefixit
8220 $cat <<EOM
8221
8222 If you wish to install html files for programs in $spackage, indicate
8223 the appropriate directory here.  To skip installing html files,
8224 answer "none".
8225 EOM
8226 case "$html1dir" in
8227 ''|none|$undef|' ') dflt=none ;;
8228 *) dflt=$html1dir ;;
8229 esac
8230 fn=dn+~
8231 rp="Directory for the main $spackage html pages?"
8232 . ./getfile
8233 prefixvar=html1dir
8234 . ./setprefixvar
8235 : Use ' ' for none so value is preserved next time through Configure
8236 $test X"$html1dir" = "X" && html1dir=' '
8237
8238 : determine where html pages for libraries and modules go
8239 set html3dir html3dir none
8240 eval $prefixit
8241 $cat <<EOM
8242
8243 If you wish to install html files for modules associated with $spackage,
8244 indicate the appropriate directory here.  To skip installing html files,
8245 answer "none".
8246 EOM
8247 : There is no obvious default.  If they have specified html1dir, then
8248 : try to key off that, possibly changing .../html1 into .../html3.
8249 case "$html3dir" in
8250 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8251 *) dflt=$html3dir ;;
8252 esac
8253 fn=dn+~
8254 rp="Directory for the $spackage module html pages?"
8255 . ./getfile
8256 prefixvar=html3dir
8257 . ./setprefixvar
8258 : Use ' ' for none so value is preserved next time through Configure
8259 $test X"$html3dir" = "X" && html3dir=' '
8260
8261 : determine whether to install perl also as /usr/bin/perl
8262
8263 echo " "
8264 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8265         $cat <<EOM
8266 Many scripts expect perl to be installed as /usr/bin/perl.
8267
8268 If you want to, I can install the perl you are about to compile
8269 as /usr/bin/perl (in addition to $bin/perl).
8270 EOM
8271         if test -f /usr/bin/perl; then
8272             $cat <<EOM
8273
8274 However, please note that because you already have a /usr/bin/perl,
8275 overwriting that with a new Perl would very probably cause problems.
8276 Therefore I'm assuming you don't want to do that (unless you insist).
8277
8278 EOM
8279             case "$installusrbinperl" in
8280             "$define"|[yY]*)    dflt='y';;
8281             *)                  dflt='n';;
8282             esac
8283         else
8284             $cat <<EOM
8285
8286 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8287
8288 EOM
8289             case "$installusrbinperl" in
8290             "$undef"|[nN]*)     dflt='n';;
8291             *)                  dflt='y';;
8292             esac
8293         fi
8294         rp="Do you want to install perl as /usr/bin/perl?"
8295         . ./myread
8296         case "$ans" in
8297         [yY]*)  val="$define";;
8298         *)      val="$undef" ;;
8299         esac
8300 else
8301         val="$undef"
8302 fi
8303 set installusrbinperl
8304 eval $setvar
8305
8306 : see if dlopen exists
8307 xxx_runnm="$runnm"
8308 xxx_ccflags="$ccflags"
8309 runnm=false
8310 : with g++ one needs -shared to get is-in-libc to work for dlopen
8311 case "$gccversion" in
8312 '')     ;;
8313 *Clang*)        ;;
8314 *)      case "$d_cplusplus" in
8315         "$define") ccflags="$ccflags -shared" ;;
8316         esac
8317         ;;
8318 esac
8319 set dlopen d_dlopen
8320 eval $inlibc
8321 runnm="$xxx_runnm"
8322 ccflags="$xxx_ccflags"
8323
8324 : see if this is a unistd.h system
8325 set unistd.h i_unistd
8326 eval $inhdr
8327
8328 : determine which dynamic loading, if any, to compile in
8329 echo " "
8330 dldir="ext/DynaLoader"
8331 case "$usedl" in
8332     $define|y|true)
8333         dflt='y'
8334         usedl="$define"
8335         ;;
8336     $undef|n|false)
8337         dflt='n'
8338         usedl="$undef"
8339         ;;
8340     *)
8341         dflt='n'
8342         case "$d_dlopen" in
8343             $define) dflt='y' ;;
8344         esac
8345         : Does a dl_xxx.xs file exist for this operating system
8346         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8347         ;;
8348 esac
8349 rp="Do you wish to use dynamic loading?"
8350 . ./myread
8351 usedl="$ans"
8352 bin_ELF="$undef"
8353 case "$ans" in
8354     y*) usedl="$define"
8355         case "$dlsrc" in
8356             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8357                     dflt="$dldir/dl_${osname}.xs"
8358                 elif $test "$d_dlopen" = "$define" ; then
8359                     dflt="$dldir/dl_dlopen.xs"
8360                 else
8361                     dflt=''
8362                 fi
8363                 ;;
8364             *)  dflt="$dldir/$dlsrc"
8365                 ;;
8366         esac
8367         echo "The following dynamic loading files are available:"
8368         : Can not go over to $dldir because getfile has path hard-coded in.
8369         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8370         rp="Source file to use for dynamic loading"
8371         fn="fne"
8372         gfpth="$src"
8373         . ./getfile
8374         usedl="$define"
8375         : emulate basename
8376         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8377
8378         $cat << EOM
8379
8380 Some systems may require passing special flags to $cc -c to
8381 compile modules that will be used to create a shared library.
8382 To use no flags, say "none".
8383
8384 EOM
8385         case "$cccdlflags" in
8386             '') case "$gccversion" in
8387                 '') case "$osname" in
8388                         hpux)   dflt='+z' ;;
8389                         irix*)  dflt='-KPIC' ;;
8390                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8391                         sunos)  dflt='-pic' ;;
8392                         *)      dflt='none' ;;
8393                     esac
8394                     ;;
8395                 *)  case "$osname" in
8396                         darwin) dflt='none' ;;
8397                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8398                         *)      dflt='-fpic' ;;
8399                     esac ;;
8400                 esac ;;
8401             ' ') dflt='none' ;;
8402             *)   dflt="$cccdlflags" ;;
8403         esac
8404
8405         case "$dflt" in
8406             none) dflt='' ;;
8407         esac
8408
8409         # If -Dsysroot was specified, now's the time to add it
8410         # to cccdlflags
8411         if test "X$sysroot" != X; then
8412             case "$gccversion" in
8413                 '') ;;
8414                 *)  case "$dflt" in
8415                         *sysroot*) ;;
8416                         'undef'|*)
8417                             dflt="$dflt --sysroot=$sysroot" ;;
8418                     esac
8419                     ;;
8420             esac
8421         fi
8422
8423         case "$dflt" in
8424             '') dflt='none';;
8425         esac
8426
8427         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8428         . ./myread
8429         case "$ans" in
8430             none) cccdlflags=' ' ;;
8431             *)    cccdlflags="$ans" ;;
8432         esac
8433
8434         cat << EOM
8435
8436 Some systems use ld to create libraries that can be dynamically loaded,
8437 while other systems (such as those using ELF) use $cc.
8438
8439 EOM
8440
8441 : Determine if this is ELF
8442         $cat >try.c <<EOM
8443 /* Test for whether ELF binaries are produced */
8444 #include <fcntl.h>
8445 #$i_stdlib I_STDLIB
8446 #ifdef I_STDLIB
8447 #include <stdlib.h>
8448 #endif
8449 #$i_unistd I_UNISTD
8450 #ifdef I_UNISTD
8451 #include <unistd.h>
8452 #endif
8453 int main() {
8454     char b[4];
8455     int i = open("a.out",O_RDONLY);
8456     if(i == -1)
8457         exit(1); /* fail */
8458     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8459         exit(0); /* succeed (yes, it is ELF) */
8460     exit(1); /* fail */
8461 }
8462 EOM
8463         if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8464             bin_ELF="$define"
8465         fi
8466         $rm_try
8467
8468         case "$ld" in
8469             '') if $test $bin_ELF = "$define"; then
8470                     cat <<EOM
8471 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8472 EOM
8473                     dflt="$cc"
8474                 else
8475                     echo "I'll use ld to build dynamic libraries."
8476                     dflt='ld'
8477                 fi
8478                 ;;
8479             *)  dflt="$ld"
8480                 ;;
8481         esac
8482
8483         rp="What command should be used to create dynamic libraries?"
8484         . ./myread
8485         ld="$ans"
8486
8487         cat << EOM
8488
8489 Some systems may require passing special flags to $ld to create a
8490 library that can be dynamically loaded.  If your ld flags include
8491 -L/other/path options to locate libraries outside your loader's normal
8492 search path, you may need to specify those -L options here as well.  To
8493 use no flags, say "none".
8494
8495 EOM
8496         case "$lddlflags" in
8497             '') case "$osname" in
8498                     haiku) dflt='-shared' ;;
8499                     hpux) dflt='-b';
8500                           case "$gccversion" in
8501                               '') dflt="$dflt +vnocompatwarnings" ;;
8502                           esac
8503                           ;;
8504                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8505                     solaris) # See [perl #66604].
8506                             # On Solaris 11, gcc -m64 on amd64
8507                             # appears not to understand -G.  gcc versions at
8508                             # least as old as 3.4.3 support -shared, so just
8509                             # use that with Solaris 11 and later, but keep
8510                             # the old behavior for older Solaris versions.
8511                             case "$gccversion" in
8512                                 '') dflt='-G' ;;
8513                                 *)  case "$osvers" in
8514                                         2.?|2.10) dflt='-G' ;;
8515                                         *) dflt='-shared' ;;
8516                                     esac
8517                                     ;;
8518                             esac
8519                             ;;
8520                     sunos) dflt='-assert nodefinitions' ;;
8521                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8522                     *)     dflt='none' ;;
8523                 esac
8524                 ;;
8525             *) dflt="$lddlflags" ;;
8526         esac
8527
8528         : Only do this for gcc, since, for example, qcc has no concept
8529         : of --sysroot.
8530         if $test "X$sysroot" != X; then
8531             case "$gccversion" in
8532                 '') ;;
8533                 *)  dflt="$dflt --sysroot $sysroot" ;;
8534             esac
8535         fi
8536
8537         : Try to guess additional flags to pick up local libraries.
8538         : Be careful not to append to a plain 'none'
8539         case "$dflt" in
8540             none) dflt='' ;;
8541         esac
8542         for thisflag in $ldflags; do
8543             case "$thisflag" in
8544                 -L*|-R*|-Wl,-R*)
8545                     case " $dflt " in
8546                         *" $thisflag "*) ;;
8547                         *) dflt="$dflt $thisflag" ;;
8548                     esac
8549                     ;;
8550             esac
8551         done
8552
8553         case "$dflt" in
8554             ''|' ') dflt='none' ;;
8555         esac
8556
8557         case "$ldflags" in
8558             *-fstack-protector-strong*)
8559                 case "$dflt" in
8560                     *-fstack-protector-strong*) ;; # Don't add it again
8561                     *) dflt="$dflt -fstack-protector-strong" ;;
8562                 esac
8563                 ;;
8564             *-fstack-protector*)
8565                 case "$dflt" in
8566                     *-fstack-protector*) ;; # Don't add it again
8567                     *) dflt="$dflt -fstack-protector" ;;
8568                 esac
8569                 ;;
8570         esac
8571
8572         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8573         . ./myread
8574         case "$ans" in
8575             none) lddlflags=' ' ;;
8576             *) lddlflags="$ans" ;;
8577         esac
8578
8579         cat <<EOM
8580
8581 Some systems may require passing special flags to $cc to indicate that
8582 the resulting executable will use dynamic linking.  To use no flags,
8583 say "none".
8584
8585 EOM
8586         case "$ccdlflags" in
8587             '') case "$osname" in
8588                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8589                     sunos)             dflt='none'   ;;
8590                     *)                 dflt='none'   ;;
8591                 esac ;;
8592             ' ') dflt='none' ;;
8593             *)   dflt="$ccdlflags" ;;
8594         esac
8595         rp="Any special flags to pass to $cc to use dynamic linking?"
8596         . ./myread
8597         case "$ans" in
8598             none) ccdlflags=' ' ;;
8599             *)    ccdlflags="$ans" ;;
8600         esac
8601         ;;
8602
8603     *)  usedl="$undef"
8604         ld='ld'
8605         dlsrc='dl_none.xs'
8606         lddlflags=''
8607         ccdlflags=''
8608         ;;
8609 esac
8610
8611 ld_can_script="$undef"
8612 case "$bin_ELF$usedl" in
8613     $define$define)
8614         # Abuse try.h and a.out names for neat cleanup
8615         $cat >try.c <<EOM
8616 void foo() {}
8617 void bar() {}
8618 EOM
8619         $cat >try.h <<EOM
8620 LIBTEST_42 {
8621  global:
8622   foo;
8623  local: *;
8624  };
8625 EOM
8626         if $cc $cccdlflags $ccdlflags $ccflags \
8627                $ldflags $lddlflags -o a.out try.c \
8628                -Wl,--version-script=try.h >/dev/null 2>&1 \
8629            &&  $test -s a.out ; then
8630             echo "ld supports scripting" >&4
8631             ld_can_script="$define"
8632         else
8633             echo "ld does not support scripting" >&4
8634         fi
8635         $rm_try
8636         ;;
8637 esac
8638
8639 : Do we want a shared libperl?
8640 also=''
8641 case "$usedl" in
8642 $undef)
8643         # No dynamic loading being used, so don't bother even to prompt.
8644         useshrplib='false'
8645         ;;
8646 *)      case "$useshrplib" in
8647         '')     case "$osname" in
8648                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8649                         dflt=y
8650                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8651                         ;;
8652                 *)      dflt=n
8653                         ;;
8654                 esac
8655                 ;;
8656         $define|true|[Yy]*)
8657                 dflt=y
8658                 ;;
8659         *)      dflt=n
8660                 ;;
8661         esac
8662         $cat << EOM
8663
8664 The perl executable is normally obtained by linking perlmain.c with
8665 libperl${_a}, any static extensions (usually just DynaLoader), and
8666 any other libraries needed on this system (such as -lm, etc.).  Since
8667 your system supports dynamic loading, it is probably possible to build
8668 a shared libperl.$so.  If you will have more than one executable linked
8669 to libperl.$so, this will significantly reduce the size of each
8670 executable, but it may have a noticeable effect on performance.  The
8671 default is probably sensible for your system.
8672 $also
8673
8674 EOM
8675         rp="Build a shared libperl.$so (y/n)"
8676         . ./myread
8677         case "$ans" in
8678         true|$define|[Yy]*)
8679                 useshrplib='true'  ;;
8680         *)      useshrplib='false' ;;
8681         esac
8682         ;;
8683 esac
8684
8685 case "$useshrplib" in
8686 true)
8687         case "$userelocatableinc" in
8688         true|define)
8689                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8690                 echo "See INSTALL for an explanation why that won't work." >&4
8691                 exit 4
8692                 ;;
8693         esac
8694         case "$libperl" in
8695         '')
8696                 # Figure out a good name for libperl.so.  Since it gets stored in
8697                 # a version-specific architecture-dependent library, the version
8698                 # number isn't really that important, except for making cc/ld happy.
8699                 #
8700                 # A name such as libperl.so.10.1
8701                 majmin="libperl.$so.$patchlevel.$subversion"
8702                 # A name such as libperl.so.100
8703                 majonly=`echo $patchlevel $subversion |
8704                         $awk '{printf "%d%02d", $1, $2}'`
8705                 majonly=libperl.$so.$majonly
8706                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8707                 # rely on figuring it out from the naming of libc.
8708                 case "${osname}${osvers}" in
8709                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8710                         dflt=libperl.$so
8711                         ;;
8712                 cygwin*) # ld links now against the dll directly
8713                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8714                         majonly=`echo $patchlevel $subversion |
8715                                 $awk '{printf "%03d%03d", $1, $2}'`
8716                         majonly=cygperl5.$majonly.$so
8717                         dflt=$majmin
8718                         ;;
8719                 *)      # Try to guess based on whether libc has major.minor.
8720                         case "$libc" in
8721                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8722                         *libc.$so.[0-9]*) dflt=$majonly ;;
8723                         *)      dflt=libperl.$so ;;
8724                         esac
8725                         ;;
8726                 esac
8727                 ;;
8728         *)      dflt=$libperl
8729                 ;;
8730         esac
8731         cat << EOM
8732
8733 I need to select a good name for the shared libperl.  If your system uses
8734 library names with major and minor numbers, then you might want something
8735 like $majmin.  Alternatively, if your system uses a single version
8736 number for shared libraries, then you might want to use $majonly.
8737 Or, your system might be quite happy with a simple libperl.$so.
8738
8739 Since the shared libperl will get installed into a version-specific
8740 architecture-dependent directory, the version number of the shared perl
8741 library probably isn't important, so the default should be o.k.
8742
8743 EOM
8744         rp='What name do you want to give to the shared libperl?'
8745         . ./myread
8746         libperl=$ans
8747         echo "Ok, I'll use $libperl"
8748         ;;
8749 *)
8750         libperl="libperl${_a}"
8751         ;;
8752 esac
8753
8754 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8755 case "$shrpdir" in
8756 '') ;;
8757 *)      $cat >&4 <<EOM
8758 WARNING:  Use of the shrpdir variable for the installation location of
8759 the shared $libperl is not supported.  It was never documented and
8760 will not work in this version.  Let me (perlbug@perl.org)
8761 know of any problems this may cause.
8762
8763 EOM
8764         case "$shrpdir" in
8765         "$archlibexp/CORE")
8766                 $cat >&4 <<EOM
8767 But your current setting of $shrpdir is
8768 the default anyway, so it's harmless.
8769 EOM
8770                 ;;
8771         *)
8772                 $cat >&4 <<EOM
8773 Further, your current attempted setting of $shrpdir
8774 conflicts with the value of $archlibexp/CORE
8775 that installperl will use.
8776 EOM
8777                 ;;
8778         esac
8779         ;;
8780 esac
8781
8782 # How will the perl executable find the installed shared $libperl?
8783 # Add $xxx to ccdlflags.
8784 # If we can't figure out a command-line option, use $shrpenv to
8785 # set env LD_RUN_PATH.  The main perl makefile uses this.
8786 shrpdir=$archlibexp/CORE
8787 xxx=''
8788 tmp_shrpenv=''
8789 if "$useshrplib"; then
8790     case "$osname" in
8791         aix)
8792                 # We'll set it in Makefile.SH...
8793                 ;;
8794         solaris)
8795                 xxx="-R $shrpdir"
8796                 ;;
8797         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8798                 xxx="-Wl,-R$shrpdir"
8799                 ;;
8800         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8801                 xxx="-Wl,-rpath,$shrpdir"
8802                 ;;
8803         hpux*)
8804                 # hpux doesn't like the default, either.
8805                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8806                 ;;
8807         cygwin)
8808                 # cygwin needs only ldlibpth
8809                 ;;
8810         *)
8811                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8812                 ;;
8813         esac
8814         case "$xxx" in
8815         '') ;;
8816         *)
8817                 # Only add $xxx if it isn't already in ccdlflags.
8818                 case " $ccdlflags " in
8819                 *" $xxx "*)     ;;
8820                 *)      ccdlflags="$ccdlflags $xxx"
8821                         cat <<EOM >&4
8822
8823 Adding $xxx to the flags
8824 passed to $ld so that the perl executable will find the
8825 installed shared $libperl.
8826
8827 EOM
8828                         ;;
8829                 esac
8830                 ;;
8831         esac
8832 fi
8833 # Fix ccdlflags in AIX for building external extensions.
8834 # (For building Perl itself bare -bE:perl.exp is needed,
8835 #  Makefile.SH takes care of this.)
8836 case "$osname" in
8837 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8838 esac
8839 # Respect a hint or command-line value.
8840 case "$shrpenv" in
8841 '') shrpenv="$tmp_shrpenv" ;;
8842 esac
8843 case "$ldlibpthname" in
8844 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8845 none)   ldlibpthname='' ;;
8846 esac
8847
8848 : determine where manual pages are on this system
8849 echo " "
8850 case "$sysman" in
8851 '')
8852         syspath='/usr/share/man/man1 /usr/man/man1'
8853         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8854         syspath="$syspath /usr/man/u_man/man1"
8855         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8856         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8857         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8858         sysman=`./loc . /usr/man/man1 $syspath`
8859         ;;
8860 esac
8861 if $test -d "$sysman"; then
8862         echo "System manual is in $sysman." >&4
8863 else
8864         echo "Could not find manual pages in source form." >&4
8865 fi
8866
8867 : determine where manual pages go
8868 set man1dir man1dir none
8869 eval $prefixit
8870 $cat <<EOM
8871
8872 $spackage has manual pages available in source form.
8873 EOM
8874 case "$nroff" in
8875 nroff)
8876         echo "However, you don't have nroff, so they're probably useless to you."
8877         case "$man1dir" in
8878         '') man1dir="none";;
8879         esac;;
8880 esac
8881 echo "If you don't want the manual sources installed, answer 'none'."
8882 case "$man1dir" in
8883 ' ') dflt=none
8884         ;;
8885 '')
8886         lookpath="$prefixexp/share/man/man1"
8887         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8888         lookpath="$lookpath $prefixexp/man/p_man/man1"
8889         lookpath="$lookpath $prefixexp/man/u_man/man1"
8890         lookpath="$lookpath $prefixexp/man/man.1"
8891         case "$sysman" in
8892         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8893         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8894         esac
8895         set dflt
8896         eval $prefixup
8897         ;;
8898 *)  dflt="$man1dir"
8899         ;;
8900 esac
8901 echo " "
8902 fn=dn+~
8903 rp="Where do the main $spackage manual pages (source) go?"
8904 . ./getfile
8905 if $test "X$man1direxp" != "X$ansexp"; then
8906         installman1dir=''
8907 fi
8908 prefixvar=man1dir
8909 . ./setprefixvar
8910
8911 case "$man1dir" in
8912 '')     man1dir=' '
8913         installman1dir='';;
8914 esac
8915
8916 : What suffix to use on installed man pages
8917
8918 case "$man1dir" in
8919 ' ')
8920         man1ext='0'
8921         ;;
8922 *)
8923         rp="What suffix should be used for the main $spackage man pages?"
8924         case "$man1ext" in
8925         '')     case "$man1dir" in
8926                 *1)  dflt=1 ;;
8927                 *1p) dflt=1p ;;
8928                 *1pm) dflt=1pm ;;
8929                 *l) dflt=l;;
8930                 *n) dflt=n;;
8931                 *o) dflt=o;;
8932                 *p) dflt=p;;
8933                 *C) dflt=C;;
8934                 *L) dflt=L;;
8935                 *L1) dflt=L1;;
8936                 *) dflt=1;;
8937                 esac
8938                 ;;
8939         *)      dflt="$man1ext";;
8940         esac
8941         . ./myread
8942         man1ext="$ans"
8943         ;;
8944 esac
8945
8946 : see if we can have long filenames
8947 echo " "
8948 first=123456789abcdef
8949 $rm -f $first
8950 if (echo hi >$first) 2>/dev/null; then
8951         if $test -f 123456789abcde; then
8952                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8953                 val="$undef"
8954         else
8955                 echo 'You can have filenames longer than 14 characters.'>&4
8956                 val="$define"
8957         fi
8958 else
8959         $cat <<'EOM'
8960 You can't have filenames longer than 14 chars.
8961 You can't even think about them!
8962 EOM
8963         val="$undef"
8964 fi
8965 set d_flexfnam
8966 eval $setvar
8967 $rm -rf 123456789abcde*
8968
8969 : determine where library module manual pages go
8970 set man3dir man3dir none
8971 eval $prefixit
8972 $cat <<EOM
8973
8974 $spackage has manual pages for many of the library modules.
8975 EOM
8976
8977 case "$nroff" in
8978 nroff)
8979         $cat <<'EOM'
8980 However, you don't have nroff, so they're probably useless to you.
8981 EOM
8982         case "$man3dir" in
8983         '') man3dir="none";;
8984         esac;;
8985 esac
8986
8987 case "$d_flexfnam" in
8988 undef)
8989         $cat <<'EOM'
8990 However, your system can't handle the long file names like File::Basename.3.
8991 EOM
8992         case "$man3dir" in
8993         '') man3dir="none";;
8994         esac;;
8995 esac
8996
8997 echo "If you don't want the manual sources installed, answer 'none'."
8998 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8999 case "$man3dir" in
9000 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9001         if $test -d "$privlib/man/man3"; then
9002                 cat <<EOM >&4
9003
9004 WARNING:  Previous versions of perl installed man3 pages into
9005 $privlib/man/man3.  This version will suggest a
9006 new default of $dflt.
9007 EOM
9008                 tdflt=$dflt
9009                 dflt='n'
9010                 rp='Do you wish to preserve the old behavior?(y/n)'
9011                 . ./myread
9012                 case "$ans" in
9013                 y*) dflt="$privlib/man/man3" ;;
9014                 *)  dflt=$tdflt ;;
9015                 esac
9016     fi
9017         ;;
9018 *)      dflt="$man3dir" ;;
9019 esac
9020 case "$dflt" in
9021 ' ') dflt=none ;;
9022 esac
9023 echo " "
9024 fn=dn+~
9025 rp="Where do the $package library man pages (source) go?"
9026 . ./getfile
9027 prefixvar=man3dir
9028 . ./setprefixvar
9029
9030 case "$man3dir" in
9031 '')     man3dir=' '
9032         installman3dir='';;
9033 esac
9034
9035 : What suffix to use on installed man pages
9036 case "$man3dir" in
9037 ' ')
9038         man3ext='0'
9039         ;;
9040 *)
9041         rp="What suffix should be used for the $package library man pages?"
9042         case "$man3ext" in
9043         '')     case "$man3dir" in
9044                 *3)  dflt=3 ;;
9045                 *3p) dflt=3p ;;
9046                 *3pm) dflt=3pm ;;
9047                 *l) dflt=l;;
9048                 *n) dflt=n;;
9049                 *o) dflt=o;;
9050                 *p) dflt=p;;
9051                 *C) dflt=C;;
9052                 *L) dflt=L;;
9053                 *L3) dflt=L3;;
9054                 *) dflt=3;;
9055                 esac
9056                 ;;
9057         *)      dflt="$man3ext";;
9058         esac
9059         . ./myread
9060         man3ext="$ans"
9061         ;;
9062 esac
9063
9064 : see if we have to deal with yellow pages, now NIS.
9065 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9066         case "$hostcat" in
9067         nidump*) ;;
9068         *)
9069                 case "$hostcat" in
9070                 *ypcat*) dflt=y;;
9071                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9072                                 dflt=y
9073                         else
9074                                 dflt=n
9075                         fi;;
9076                 *) dflt=n;;
9077                 esac
9078                 echo " "
9079                 rp='Are you getting the hosts file via yellow pages?'
9080                 . ./myread
9081                 case "$ans" in
9082                 y*) hostcat='ypcat hosts';;
9083                 *) hostcat='cat /etc/hosts';;
9084                 esac
9085                 ;;
9086         esac
9087 fi
9088 case "$hostcat" in
9089 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9090 esac
9091 case "$groupcat" in
9092 '') test -f /etc/group && groupcat='cat /etc/group';;
9093 esac
9094 case "$passcat" in
9095 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9096 esac
9097
9098 : now get the host name
9099 echo " "
9100 echo "Figuring out host name..." >&4
9101 case "$myhostname" in
9102 '') cont=true
9103         echo 'Maybe "hostname" will work...'
9104         if tans=`sh -c hostname 2>&1` ; then
9105                 myhostname=$tans
9106                 phostname=hostname
9107                 cont=''
9108         fi
9109         ;;
9110 *) cont='';;
9111 esac
9112 if $test "$cont"; then
9113         if ./xenix; then
9114                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9115                 if tans=`cat /etc/systemid 2>&1` ; then
9116                         myhostname=$tans
9117                         phostname='cat /etc/systemid'
9118                         echo "Whadyaknow.  Xenix always was a bit strange..."
9119                         cont=''
9120                 fi
9121         elif $test -r /etc/systemid; then
9122                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9123         fi
9124 fi
9125 if $test "$cont"; then
9126         echo 'No, maybe "uuname -l" will work...'
9127         if tans=`sh -c 'uuname -l' 2>&1` ; then
9128                 myhostname=$tans
9129                 phostname='uuname -l'
9130         else
9131                 echo 'Strange.  Maybe "uname -n" will work...'
9132                 if tans=`sh -c 'uname -n' 2>&1` ; then
9133                         myhostname=$tans
9134                         phostname='uname -n'
9135                 else
9136                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9137                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9138                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9139                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9140                         else
9141                                 case "$myhostname" in
9142                                 '') echo "Does this machine have an identity crisis or something?"
9143                                         phostname='';;
9144                                 *)
9145                                         echo "Well, you said $myhostname before..."
9146                                         phostname='echo $myhostname';;
9147                                 esac
9148                         fi
9149                 fi
9150         fi
9151 fi
9152 case "$myhostname" in
9153 '') myhostname=noname ;;
9154 esac
9155 : you do not want to know about this
9156 set $myhostname
9157 myhostname=$1
9158
9159 : verify guess
9160 if $test "$myhostname" ; then
9161         dflt=y
9162         rp='Your host name appears to be "'$myhostname'".'" Right?"
9163         . ./myread
9164         case "$ans" in
9165         y*) ;;
9166         *) myhostname='';;
9167         esac
9168 fi
9169
9170 : bad guess or no guess
9171 while $test "X$myhostname" = X ; do
9172         dflt=''
9173         rp="Please type the (one word) name of your host:"
9174         . ./myread
9175         myhostname="$ans"
9176 done
9177
9178 : translate upper to lower if necessary
9179 case "$myhostname" in
9180 *[A-Z]*)
9181         echo "(Normalizing case in your host name)"
9182         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9183         ;;
9184 esac
9185
9186 case "$myhostname" in
9187 *.*)
9188         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9189         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9190         echo "(Trimming domain name from host name--host name is now $myhostname)"
9191         ;;
9192 *) case "$mydomain" in
9193         '')
9194                 {
9195                         test "X$hostcat" = "Xypcat hosts" &&
9196                         ypmatch "$myhostname" hosts 2>/dev/null |\
9197                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9198                         $test -s hosts
9199                 } || {
9200                         test "X$hostcat" != "X" &&
9201                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9202                                         /[       ]$myhostname[  . ]/p" > hosts
9203                 }
9204                 tmp_re="[       . ]"
9205                 if $test -f hosts; then
9206                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9207                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9208                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9209                                 hosts | $sort | $uniq | \
9210                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9211                         case `$echo X$dflt` in
9212                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9213                                 dflt=.
9214                                 ;;
9215                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9216                                 ;;
9217                         esac
9218                 else
9219                         echo "(I cannot locate a hosts database anywhere)"
9220                         dflt=.
9221                 fi
9222                 case "$dflt" in
9223                 .)
9224                         tans=`./loc resolv.conf X /etc /usr/etc`
9225                         if $test -f "$tans"; then
9226                                 echo "(Attempting domain name extraction from $tans)"
9227                                 dflt=.`$sed -n -e 's/   / /g' \
9228                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9229                                   -e 1q 2>/dev/null`
9230                                 case "$dflt" in
9231                                 .) dflt=.`$sed -n -e 's/        / /g' \
9232                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9233                                      -e 1q 2>/dev/null`
9234                                         ;;
9235                                 esac
9236                         fi
9237                         ;;
9238                 esac
9239                 case "$dflt" in
9240                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9241                         dflt=.`sh -c domainname 2>/dev/null`
9242                         case "$dflt" in
9243                         '') dflt='.';;
9244                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9245                         esac
9246                         ;;
9247                 esac
9248                 case "$dflt$osname" in
9249                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9250                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9251                         ;;
9252                 esac
9253                 case "$dflt" in
9254                 .) echo "(Lost all hope -- silly guess then)"
9255                         dflt='.nonet'
9256                         ;;
9257                 esac
9258                 $rm -f hosts
9259                 ;;
9260         *) dflt="$mydomain";;
9261         esac;;
9262 esac
9263 echo " "
9264 rp="What is your domain name?"
9265 . ./myread
9266 tans="$ans"
9267 case "$ans" in
9268 '') ;;
9269 .*) ;;
9270 *) tans=".$tans";;
9271 esac
9272 mydomain="$tans"
9273
9274 : translate upper to lower if necessary
9275 case "$mydomain" in
9276 *[A-Z]*)
9277         echo "(Normalizing case in your domain name)"
9278         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9279         ;;
9280 esac
9281
9282 : a little sanity check here
9283 case "$phostname" in
9284 '') ;;
9285 *)
9286         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9287         $myhostname$mydomain|$myhostname) ;;
9288         *)
9289                 case "$phostname" in
9290                 sed*)
9291                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9292                         ;;
9293                 *)
9294                         echo "(That doesn't agree with your $phostname command, by the way.)"
9295                         ;;
9296                 esac
9297         ;;
9298         esac
9299         ;;
9300 esac
9301
9302 : determine the e-mail address of the user who is running us
9303 $cat <<EOM
9304
9305 I need to get your e-mail address in Internet format if possible, i.e.
9306 something like user@host.domain. Please answer accurately since I have
9307 no easy means to double check it. The default value provided below
9308 is most probably close to reality but may not be valid from outside
9309 your organization...
9310
9311 EOM
9312 cont=x
9313 while test "$cont"; do
9314         case "$MAILDOMAIN" in
9315         '')
9316                 if $test -s /etc/mailname; then
9317                         maildomain=`$cat /etc/mailname`
9318                 else
9319                         maildomain="$myhostname$mydomain"
9320                 fi
9321                 ;;
9322         *)  maildomain="$MAILDOMAIN";;
9323         esac
9324         case "$cf_email" in
9325         '') dflt="$cf_by@$maildomain";;
9326         *)  dflt="$cf_email";;
9327         esac
9328         rp='What is your e-mail address?'
9329         . ./myread
9330         cf_email="$ans"
9331         case "$cf_email" in
9332         *@*.*) cont='' ;;
9333         *)
9334                 rp='Address does not look like an Internet one.  Use it anyway?'
9335                 case "$fastread" in
9336                 yes) dflt=y ;;
9337                 *) dflt=n ;;
9338                 esac
9339                 . ./myread
9340                 case "$ans" in
9341                 y*) cont='' ;;
9342                 *) echo " " ;;
9343                 esac
9344                 ;;
9345         esac
9346 done
9347
9348 : Ask e-mail of administrator
9349 $cat <<EOM
9350
9351 If you or somebody else will be maintaining perl at your site, please
9352 fill in the correct e-mail address here so that they may be contacted
9353 if necessary. Currently, the "perlbug" program included with perl
9354 will send mail to this address in addition to perlbug@perl.org. You may
9355 enter "none" for no administrator.
9356
9357 EOM
9358 case "$perladmin" in
9359 '') dflt="$cf_email";;
9360 *) dflt="$perladmin";;
9361 esac
9362 rp='Perl administrator e-mail address'
9363 . ./myread
9364 perladmin="$ans"
9365
9366 : determine whether to use a version number suffix for installed binaries
9367 echo " "
9368 $cat <<EOM
9369 Do you want to use a version number suffix for installed binaries? This
9370 will install 'perl$version' instead of 'perl', and likewise for other
9371 binaries like 'perldoc' and 'cpan'. This allows many versions of perl
9372 to be installed side-by-side. Unless you are a developer, you probably
9373 do *not* want to do this.
9374 EOM
9375 case "$versiononly" in
9376 "$define"|[Yy]*|true) dflt='y' ;;
9377 *) dflt='n';
9378 esac
9379 rp="Do you want to use a version number suffix for installed binaries?"
9380 . ./myread
9381 case "$ans" in
9382 [yY]*)  val="$define";;
9383 *)      val="$undef" ;;
9384 esac
9385 set versiononly
9386 eval $setvar
9387
9388 case "$versiononly" in
9389 "$define") inc_version_list=''
9390            inc_version_list_init=0
9391            ;;
9392 esac
9393
9394 : figure out how to guarantee perl startup
9395 : XXX Note that this currently takes advantage of the bug that binexp ignores
9396 :     the Configure -Dinstallprefix setting, which in turn means that under
9397 :     relocatable @INC, initialinstalllocation is what binexp started as.
9398 case "$startperl" in
9399 '')
9400         case "$sharpbang" in
9401         *!)
9402                 $cat <<EOH
9403
9404 I can use the #! construct to start perl on your system. This will
9405 make startup of perl scripts faster, but may cause problems if you
9406 want to share those scripts and perl is not in a standard place
9407 ($initialinstalllocation/perl) on all your platforms. The alternative
9408 is to force a shell by starting the script with a single ':' character.
9409
9410 EOH
9411                 case "$versiononly" in
9412                 "$define")      dflt="$initialinstalllocation/perl$version";;
9413                 *)              dflt="$initialinstalllocation/perl";;
9414                 esac
9415                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9416                 . ./myread
9417                 case "$ans" in
9418                 none)   startperl=": # use perl";;
9419                 *)      startperl="#!$ans"
9420                         if $test 30 -lt `echo "$ans" | wc -c`; then
9421                                 $cat >&4 <<EOM
9422
9423 WARNING:  Some systems limit the #! command to 32 characters.
9424 If you experience difficulty running Perl scripts with #!, try
9425 installing Perl in a directory with a shorter pathname.
9426
9427 EOM
9428                         fi ;;
9429                 esac
9430                 ;;
9431         *) startperl=": # use perl"
9432                 ;;
9433         esac
9434         ;;
9435 esac
9436 echo "I'll use $startperl to start perl scripts."
9437
9438 : figure best path for perl in scripts
9439 case "$perlpath" in
9440 '')
9441         case "$versiononly" in
9442         "$define")      perlpath="$initialinstalllocation/perl$version";;
9443         *)              perlpath="$initialinstalllocation/perl";;
9444         esac
9445         case "$startperl" in
9446         *!*) ;;
9447         *)
9448                 $cat <<EOH
9449
9450 I will use the "eval 'exec'" idiom to start Perl on your system.
9451 I can use the full path of your Perl binary for this purpose, but
9452 doing so may cause problems if you want to share those scripts and
9453 Perl is not always in a standard place ($initialinstalllocation/perl).
9454
9455 EOH
9456                 dflt="$initialinstalllocation/perl"
9457                 rp="What path shall I use in \"eval 'exec'\"?"
9458                 . ./myread
9459                 perlpath="$ans"
9460                 ;;
9461         esac
9462         ;;
9463 esac
9464 case "$startperl" in
9465 *!*)    ;;
9466 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9467 esac
9468
9469 : determine where public executable scripts go
9470 set scriptdir scriptdir
9471 eval $prefixit
9472 case "$scriptdir" in
9473 '')
9474         dflt="$bin"
9475         : guess some guesses
9476         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9477         $test -d /usr/share/bin     && dflt=/usr/share/bin
9478         $test -d /usr/local/script  && dflt=/usr/local/script
9479         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9480         $test -d $prefixexp/script  && dflt=$prefixexp/script
9481         set dflt
9482         eval $prefixup
9483         ;;
9484 *)  dflt="$scriptdir"
9485         ;;
9486 esac
9487 $cat <<EOM
9488
9489 Some installations have a separate directory just for executable scripts so
9490 that they can mount it across multiple architectures but keep the scripts in
9491 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9492 Or you might just lump your scripts in with all your other executables.
9493
9494 EOM
9495 fn=d~
9496 rp='Where do you keep publicly executable scripts?'
9497 . ./getfile
9498 if $test "X$ansexp" != "X$scriptdirexp"; then
9499         installscript=''
9500 fi
9501 installscriptdir=''
9502 prefixvar=scriptdir
9503 . ./setprefixvar
9504 : A little fix up for an irregularly named variable.
9505 installscript="$installscriptdir"
9506
9507 : determine where add-on public executables go
9508 case "$sitebin" in
9509 '')     dflt=$siteprefix/bin ;;
9510 *)      dflt=$sitebin ;;
9511 esac
9512 fn=d~
9513 rp='Pathname where the add-on public executables should be installed?'
9514 . ./getfile
9515 prefixvar=sitebin
9516 . ./setprefixvar
9517
9518 : determine where add-on html pages go
9519 : There is no standard location, so try to copy the previously-selected
9520 : directory structure for the core html pages.
9521 case "$sitehtml1dir" in
9522 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9523 *)     dflt=$sitehtml1dir ;;
9524 esac
9525 case "$dflt" in
9526 ''|' ') dflt=none ;;
9527 esac
9528 fn=dn+~
9529 rp='Pathname where the site-specific html pages should be installed?'
9530 . ./getfile
9531 prefixvar=sitehtml1dir
9532 . ./setprefixvar
9533
9534 : determine where add-on library html pages go
9535 : There is no standard location, so try to copy the previously-selected
9536 : directory structure for the core html pages.
9537 case "$sitehtml3dir" in
9538 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9539 *)     dflt=$sitehtml3dir ;;
9540 esac
9541 case "$dflt" in
9542 ''|' ') dflt=none ;;
9543 esac
9544 fn=dn+~
9545 rp='Pathname where the site-specific library html pages should be installed?'
9546 . ./getfile
9547 prefixvar=sitehtml3dir
9548 . ./setprefixvar
9549
9550 : determine where add-on manual pages go
9551 case "$siteman1dir" in
9552 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9553 *)      dflt=$siteman1dir ;;
9554 esac
9555 case "$dflt" in
9556 ''|' ') dflt=none ;;
9557 esac
9558 fn=dn+~
9559 rp='Pathname where the site-specific manual pages should be installed?'
9560 . ./getfile
9561 prefixvar=siteman1dir
9562 . ./setprefixvar
9563
9564 : determine where add-on library man pages go
9565 case "$siteman3dir" in
9566 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9567 *)      dflt=$siteman3dir ;;
9568 esac
9569 case "$dflt" in
9570 ''|' ') dflt=none ;;
9571 esac
9572 fn=dn+~
9573 rp='Pathname where the site-specific library manual pages should be installed?'
9574 . ./getfile
9575 prefixvar=siteman3dir
9576 . ./setprefixvar
9577
9578 : determine where add-on public executable scripts go
9579 case "$sitescript" in
9580 '')     dflt=$siteprefix/script
9581         $test -d $dflt || dflt=$sitebin ;;
9582 *)  dflt="$sitescript" ;;
9583 esac
9584 fn=d~+
9585 rp='Pathname where add-on public executable scripts should be installed?'
9586 . ./getfile
9587 prefixvar=sitescript
9588 . ./setprefixvar
9589
9590 : see if backtrace exists
9591 set backtrace d_backtrace
9592 eval $inlibc
9593
9594 : add flags if using c backtrace
9595 case "$usecbacktrace" in
9596   "") usecbacktrace=$undef ;;
9597   [yY]*|true|$define)
9598     case "$d_backtrace" in
9599       [yY]*|true|$define)
9600         case " $ccflags " in
9601           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9602           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9603           esac
9604         ;;
9605       *)
9606         echo "This system does not support backtrace" >&4
9607         usecbacktrace=$undef
9608         ;;
9609       esac
9610     ;;
9611   esac
9612
9613 : Check if faststdio is requested and available
9614 case "$usefaststdio" in
9615 $define|true|[yY]*|'')
9616         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9617         case "$xversion" in
9618         [68])   dflt='y' ;;
9619         *)      dflt='n' ;;
9620         esac
9621         ;;
9622 *) dflt='n';;
9623 esac
9624 cat <<EOM
9625
9626 Perl can be built to use 'fast stdio', which means using the stdio
9627 library but also directly manipulating the stdio buffers to enable
9628 faster I/O.  Using stdio is better for backward compatibility (especially
9629 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9630 interface has been preferred instead of stdio.
9631
9632 If this doesn't make any sense to you, just accept the default '$dflt'.
9633 EOM
9634 rp='Use the "fast stdio" if available?'
9635 . ./myread
9636 case "$ans" in
9637 y|Y)    val="$define" ;;
9638 *)      val="$undef" ;;
9639 esac
9640 set usefaststdio
9641 eval $setvar
9642
9643
9644 : define an is-a-typedef? function
9645 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9646 case "$inclist" in
9647 "") inclist="sys/types.h";;
9648 esac;
9649 eval "varval=\$$var";
9650 case "$varval" in
9651 "")
9652         $rm -f temp.c;
9653         for inc in $inclist; do
9654                 echo "#include <$inc>" >>temp.c;
9655         done;
9656         echo "#ifdef $type" >> temp.c;
9657         echo "printf(\"We have $type\");" >> temp.c;
9658         echo "#endif" >> temp.c;
9659         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9660         if $contains $type temp.E >/dev/null 2>&1; then
9661                 eval "$var=\$type";
9662         else
9663                 eval "$var=\$def";
9664         fi;
9665         $rm -f temp.?;;
9666 *) eval "$var=\$varval";;
9667 esac'
9668
9669 : define an is-a-typedef? function that prompts if the type is not available.
9670 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9671 case "$inclist" in
9672 "") inclist="sys/types.h";;
9673 esac;
9674 eval "varval=\$$var";
9675 case "$varval" in
9676 "")
9677         $rm -f temp.c;
9678         for inc in $inclist; do
9679                 echo "#include <$inc>" >>temp.c;
9680         done;
9681         echo "#ifdef $type" >> temp.c;
9682         echo "printf(\"We have $type\");" >> temp.c;
9683         echo "#endif" >> temp.c;
9684         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9685         echo " " ;
9686         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9687         if $contains $type temp.E >/dev/null 2>&1; then
9688                 echo "$type found." >&4;
9689                 eval "$var=\$type";
9690         else
9691                 echo "$type NOT found." >&4;
9692                 dflt="$def";
9693                 . ./myread ;
9694                 eval "$var=\$ans";
9695         fi;
9696         $rm -f temp.?;;
9697 *) eval "$var=\$varval";;
9698 esac'
9699
9700 : see what type lseek is declared as in the kernel
9701 rp="What is the type used for lseek's offset on this system?"
9702 set off_t lseektype long stdio.h sys/types.h
9703 eval $typedef_ask
9704
9705 echo " "
9706 echo "Checking to see how big your file offsets are..." >&4
9707 $cat >try.c <<EOCP
9708 #include <sys/types.h>
9709 #include <stdio.h>
9710 int main()
9711 {
9712     printf("%d\n", (int)sizeof($lseektype));
9713     return(0);
9714 }
9715 EOCP
9716 set try
9717 if eval $compile_ok; then
9718         lseeksize=`$run ./try`
9719         echo "Your file offsets are $lseeksize bytes long."
9720 else
9721         dflt=$longsize
9722         echo " "
9723         echo "(I can't seem to compile the test program.  Guessing...)"
9724         rp="What is the size of your file offsets (in bytes)?"
9725         . ./myread
9726         lseeksize="$ans"
9727 fi
9728 $rm_try
9729
9730 : see what type file positions are declared as in the library
9731 rp="What is the type for file position used by fsetpos()?"
9732 set fpos_t fpostype long stdio.h sys/types.h
9733 eval $typedef_ask
9734
9735 : Check size for Fpos_t
9736 echo " "
9737 case "$fpostype" in
9738 *_t) zzz="$fpostype"    ;;
9739 *)   zzz="fpos_t"       ;;
9740 esac
9741 echo "Checking the size of $zzz..." >&4
9742 cat > try.c <<EOCP
9743 #include <sys/types.h>
9744 #include <stdio.h>
9745 #$i_stdlib I_STDLIB
9746 #ifdef I_STDLIB
9747 #include <stdlib.h>
9748 #endif
9749 int main() {
9750     printf("%d\n", (int)sizeof($fpostype));
9751     exit(0);
9752 }
9753 EOCP
9754 set try
9755 if eval $compile_ok; then
9756         yyy=`$run ./try`
9757         case "$yyy" in
9758         '')     fpossize=4
9759                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9760                 ;;
9761         *)      fpossize=$yyy
9762                 echo "Your $zzz is $fpossize bytes long."
9763                 ;;
9764         esac
9765 else
9766         dflt="$longsize"
9767         echo " " >&4
9768         echo "(I can't compile the test program.  Guessing...)" >&4
9769         rp="What is the size of your file positions (in bytes)?"
9770         . ./myread
9771         fpossize="$ans"
9772 fi
9773
9774 : Check for large file support
9775 # Backward compatibility (uselfs is deprecated).
9776 case "$uselfs" in
9777 "$define"|true|[yY]*)
9778         cat <<EOM >&4
9779
9780 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9781 EOM
9782         uselargefiles="$define"
9783         ;;
9784 esac
9785
9786 case "$lseeksize:$fpossize" in
9787 8:8) cat <<EOM
9788
9789 You can have files larger than 2 gigabytes.
9790 EOM
9791    val="$define" ;;
9792 *)    case "$uselargefiles" in
9793    "$undef"|false|[nN]*) dflt='n' ;;
9794    *)   dflt='y' ;;
9795    esac
9796    cat <<EOM
9797
9798 Perl can be built to understand large files (files larger than 2 gigabytes)
9799 on some systems.  To do so, Configure can be run with -Duselargefiles.
9800
9801 If this doesn't make any sense to you, just accept the default '$dflt'.
9802 EOM
9803    rp='Try to understand large files, if available?'
9804    . ./myread
9805    case "$ans" in
9806    y|Y)         val="$define" ;;
9807    *)           val="$undef"  ;;
9808    esac
9809    ;;
9810 esac
9811 set uselargefiles
9812 eval $setvar
9813 : Look for a hint-file generated 'call-back-unit'.  If the
9814 : user has specified that a large files perl is to be built,
9815 : we may need to set or change some other defaults.
9816 if $test -f uselargefiles.cbu; then
9817         echo "Your platform has some specific hints regarding large file builds, using them..."
9818         . ./uselargefiles.cbu
9819 fi
9820 case "$uselargefiles" in
9821 "$define")
9822         if $test -f uselargefiles.cbu; then
9823                 echo " "
9824                 echo "Rechecking to see how big your file offsets are..." >&4
9825                 $cat >try.c <<EOCP
9826 #include <sys/types.h>
9827 #include <stdio.h>
9828 int main()
9829 {
9830     printf("%d\n", (int)sizeof($lseektype));
9831     return(0);
9832 }
9833 EOCP
9834                 set try
9835                 if eval $compile_ok; then
9836                         lseeksize=`$run ./try`
9837                         $echo "Your file offsets are now $lseeksize bytes long."
9838                 else
9839                         dflt="$lseeksize"
9840                         echo " "
9841                         echo "(I can't seem to compile the test program.  Guessing...)"
9842                         rp="What is the size of your file offsets (in bytes)?"
9843                         . ./myread
9844                         lseeksize="$ans"
9845                 fi
9846                 case "$fpostype" in
9847                 *_t) zzz="$fpostype"    ;;
9848                 *)   zzz="fpos_t"       ;;
9849                 esac
9850                 $echo $n "Rechecking the size of $zzz...$c" >&4
9851                 $cat > try.c <<EOCP
9852 #include <sys/types.h>
9853 #include <stdio.h>
9854 #$i_stdlib I_STDLIB
9855 #ifdef I_STDLIB
9856 #include <stdlib.h>
9857 #endif
9858 int main() {
9859     printf("%d\n", (int)sizeof($fpostype));
9860     return(0);
9861 }
9862 EOCP
9863                 set try
9864                 if eval $compile_ok; then
9865                         yyy=`$run ./try`
9866                         dflt="$lseeksize"
9867                         case "$yyy" in
9868                         '')     echo " "
9869                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9870                                 ;;
9871                         *)      fpossize=$yyy
9872                                 echo " $fpossize bytes." >&4
9873                                 ;;
9874                         esac
9875                 else
9876                         dflt="$fpossize"
9877                         echo " "
9878                         echo "(I can't compile the test program.  Guessing...)" >&4
9879                         rp="What is the size of your file positions (in bytes)?"
9880                         . ./myread
9881                         fpossize="$ans"
9882                 fi
9883                 $rm_try
9884         fi
9885         ;;
9886 esac
9887
9888 : Check if we want perlio
9889 useperlio="$define"
9890
9891 : Set the vendorbin variables
9892 case "$vendorprefix" in
9893 '')     d_vendorbin="$undef"
9894         vendorbin=''
9895         vendorbinexp=''
9896         ;;
9897 *)      d_vendorbin="$define"
9898         : determine where vendor-supplied executables go.
9899         case "$vendorbin" in
9900         '') dflt=$vendorprefix/bin ;;
9901         *)      dflt="$vendorbin" ;;
9902         esac
9903         fn=d~+
9904         rp='Pathname for the vendor-supplied executables directory?'
9905         . ./getfile
9906         vendorbin="$ans"
9907         vendorbinexp="$ansexp"
9908         ;;
9909 esac
9910 prefixvar=vendorbin
9911 . ./installprefix
9912
9913 : Set the vendorhtml1dir variables
9914 case "$vendorprefix" in
9915 '')     vendorhtml1dir=''
9916         vendorhtml1direxp=''
9917         ;;
9918 *)      : determine where vendor-supplied html pages go.
9919         : There is no standard location, so try to copy the previously-selected
9920         : directory structure for the core html pages.
9921         : XXX Better default suggestions would be welcome.
9922         case "$vendorhtml1dir" in
9923         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9924         *)      dflt=$vendorhtml1dir ;;
9925         esac
9926         case "$dflt" in
9927         ''|' ') dflt=none ;;
9928         esac
9929         fn=dn+~
9930         rp='Pathname for the vendor-supplied html pages?'
9931         . ./getfile
9932         vendorhtml1dir="$ans"
9933         vendorhtml1direxp="$ansexp"
9934         ;;
9935 esac
9936 : Use ' ' for none so value is preserved next time through Configure
9937 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9938 prefixvar=vendorhtml1dir
9939 . ./installprefix
9940
9941 : Set the vendorhtml3dir variables
9942 case "$vendorprefix" in
9943 '')     vendorhtml3dir=''
9944         vendorhtml3direxp=''
9945         ;;
9946 *)      : determine where vendor-supplied module html pages go.
9947         : There is no standard location, so try to copy the previously-selected
9948         : directory structure for the core html pages.
9949         : XXX Better default suggestions would be welcome.
9950         case "$vendorhtml3dir" in
9951         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9952         *)      dflt=$vendorhtml3dir ;;
9953         esac
9954         case "$dflt" in
9955         ''|' ') dflt=none ;;
9956         esac
9957         fn=dn+~
9958         rp='Pathname for the vendor-supplied html pages?'
9959         . ./getfile
9960         vendorhtml3dir="$ans"
9961         vendorhtml3direxp="$ansexp"
9962         ;;
9963 esac
9964 : Use ' ' for none so value is preserved next time through Configure
9965 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9966 prefixvar=vendorhtml3dir
9967 . ./installprefix
9968
9969 : Set the vendorman1dir variables
9970 case "$vendorprefix" in
9971 '')     vendorman1dir=''
9972         vendorman1direxp=''
9973         ;;
9974 *)      : determine where vendor-supplied manual pages go.
9975         case "$vendorman1dir" in
9976         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9977         *)      dflt=$vendorman1dir ;;
9978         esac
9979         case "$dflt" in
9980         ''|' ') dflt=none ;;
9981         esac
9982         fn=nd~+
9983         rp='Pathname for the vendor-supplied manual section 1 pages?'
9984         . ./getfile
9985         vendorman1dir="$ans"
9986         vendorman1direxp="$ansexp"
9987         ;;
9988 esac
9989 : Use ' ' for none so value is preserved next time through Configure
9990 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9991 prefixvar=vendorman1dir
9992 . ./installprefix
9993
9994 : Set the vendorman3dir variables
9995 case "$vendorprefix" in
9996 '')     vendorman3dir=''
9997         vendorman3direxp=''
9998         ;;
9999 *)      : determine where vendor-supplied module manual pages go.
10000         case "$vendorman3dir" in
10001         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10002         *)      dflt=$vendorman3dir ;;
10003         esac
10004         case "$dflt" in
10005         ''|' ') dflt=none ;;
10006         esac
10007         fn=nd~+
10008         rp='Pathname for the vendor-supplied manual section 3 pages?'
10009         . ./getfile
10010         vendorman3dir="$ans"
10011         vendorman3direxp="$ansexp"
10012         ;;
10013 esac
10014 : Use ' ' for none so value is preserved next time through Configure
10015 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
10016 prefixvar=vendorman3dir
10017 . ./installprefix
10018
10019 : Set the vendorscript variables
10020 case "$vendorprefix" in
10021 '')     d_vendorscript="$undef"
10022         vendorscript=''
10023         vendorscriptexp=''
10024         ;;
10025 *)      d_vendorscript="$define"
10026         : determine where vendor-supplied scripts go.
10027         case "$vendorscript" in
10028         '')     dflt=$vendorprefix/script
10029                 $test -d $dflt || dflt=$vendorbin ;;
10030         *)  dflt="$vendorscript" ;;
10031         esac
10032         $cat <<EOM
10033
10034 The installation process will create a directory for
10035 vendor-supplied scripts.
10036
10037 EOM
10038         fn=d~+
10039         rp='Pathname for the vendor-supplied scripts directory?'
10040         . ./getfile
10041         vendorscript="$ans"
10042         vendorscriptexp="$ansexp"
10043         ;;
10044 esac
10045 prefixvar=vendorscript
10046 . ./installprefix
10047
10048 : see if qgcvt exists
10049 set qgcvt d_qgcvt
10050 eval $inlibc
10051
10052 : Check what kind of doubles your system has
10053 $echo "Checking the kind of doubles you have..." >&4
10054 $cat >try.c <<EOP
10055 #$i_stdlib I_STDLIB
10056 #define DOUBLESIZE $doublesize
10057 #ifdef I_STDLIB
10058 #include <stdlib.h>
10059 #endif
10060 #include <stdio.h>
10061 static const double d = -0.1;
10062 int main() {
10063   unsigned const char* b = (unsigned const char*)(&d);
10064 #if DOUBLESIZE == 4
10065   if (b[0] == 0xCD && b[3] == 0xBD) {
10066     /* IEEE 754 32-bit little-endian */
10067     printf("1\n");
10068     exit(0);
10069   }
10070   if (b[0] == 0xBD && b[3] == 0xCD) {
10071     /* IEEE 754 32-bit big-endian */
10072     printf("2\n");
10073     exit(0);
10074   }
10075   if (b[0] == 0xCC && b[3] == 0xCC) {
10076     /* VAX format F, 32-bit PDP-style mixed endian. */
10077     printf("9\n");
10078     exit(0);
10079   }
10080   if (b[0] == 0xC0 && b[3] == 0x9A) {
10081     /* IBM single 32-bit */
10082     printf("12\n");
10083     exit(0);
10084   }
10085 #endif
10086 #if DOUBLESIZE == 8
10087   if (b[0] == 0x9A && b[7] == 0xBF) {
10088     /* IEEE 754 64-bit little-endian */
10089     printf("3\n");
10090     exit(0);
10091   }
10092   if (b[0] == 0xBF && b[7] == 0x9A) {
10093     /* IEEE 754 64-bit big-endian */
10094     printf("4\n");
10095     exit(0);
10096   }
10097   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10098    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10099     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10100     * 99 99 b9 bf 9a 99 99 99 */
10101     printf("7\n");
10102     exit(0);
10103   }
10104   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10105    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10106     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10107     * 99 99 99 9a bf b9 99 99 */
10108     printf("8\n");
10109     exit(0);
10110   }
10111   if (b[0] == 0xCC && b[7] == 0xCC) {
10112    /* VAX format D, 64-bit PDP-style mixed endian. */
10113     printf("10\n");
10114     exit(0);
10115   }
10116   if (b[0] == 0xD9 && b[7] == 0x99) {
10117    /* VAX format G, 64-bit PDP-style mixed endian. */
10118     printf("11\n");
10119     exit(0);
10120   }
10121   if (b[0] == 0xC0 && b[7] == 0x9A) {
10122     /* IBM double 64-bit */
10123     printf("13\n");
10124     exit(0);
10125   }
10126   if (b[0] == 0xBF && b[7] == 0xCD) {
10127     /* CRAY single 64-bit */
10128     printf("14\n");
10129     exit(0);
10130   }
10131 #endif
10132 #if DOUBLESIZE == 16
10133   if (b[0] == 0x9A && b[15] == 0xBF) {
10134     /* IEEE 754 128-bit little-endian */
10135     printf("5\n");
10136     exit(0);
10137   }
10138   if (b[0] == 0xBF && b[15] == 0x9A) {
10139     /* IEEE 754 128-bit big-endian */
10140     printf("6\n");
10141     exit(0);
10142   }
10143 #endif
10144   /* Then there are old mainframe/miniframe formats like IBM and CRAY.
10145    * Whether those environments can still build Perl is debatable. */
10146   printf("-1\n"); /* unknown */
10147   exit(0);
10148 }
10149 EOP
10150 set try
10151 if eval $compile; then
10152     doublekind=`$run ./try`
10153 else
10154     doublekind=-1
10155 fi
10156 case "$doublekind" in
10157 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10158 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10159 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10160 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10161 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10162 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10163 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10164 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10165 9) echo "You have VAX format F 32-bit PDP-style mixed endian doubles." >&4 ;;
10166 10) echo "You have VAX format D 64-bit PDP-style mixed endian doubles." >&4 ;;
10167 11) echo "You have VAX format G 64-bit PDP-style mixed endian doubles." >&4 ;;
10168 12) echo "You have IBM short 32-bit doubles." >&4 ;;
10169 13) echo "You have IBM long 64-bit doubles." >&4 ;;
10170 14) echo "You have Cray single 64-bit doubles." >&4 ;;
10171 *) echo "Cannot figure out your double.  You Cyber, or something?" >&4 ;;
10172 esac
10173 d_double_style_ieee=$undef
10174 d_double_style_vax=$undef
10175 d_double_style_ibm=$undef
10176 d_double_style_cray=$undef
10177 case "$doublekind" in
10178 1|2|3|4|5|6|7|8) d_double_style_ieee=$define ;;
10179 9|10|11) d_double_style_vax=$define ;;
10180 12|13) d_double_style_ibm=$define ;;
10181 14) d_double_style_cray=$define ;;
10182 esac
10183 case "$d_double_style_ieee" in
10184 $define)
10185     d_double_has_inf=$define
10186     d_double_has_nan=$define
10187     d_double_has_negative_zero=$define
10188     d_double_has_subnormals=$define
10189     ;;
10190 *)
10191     d_double_has_inf=$undef
10192     d_double_has_nan=$undef
10193     d_double_has_negative_zero=$undef
10194     d_double_has_subnormals=$undef
10195     ;;
10196 esac
10197 $rm_try
10198
10199 : Check print/scan long double stuff
10200 echo " "
10201
10202 if $test X"$d_longdbl" = X"$define"; then
10203
10204 echo "Checking how to print long doubles..." >&4
10205
10206 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10207         $cat >try.c <<'EOCP'
10208 #include <sys/types.h>
10209 #include <stdio.h>
10210 int main() {
10211   double d = 123.456;
10212   printf("%.3f\n", d);
10213 }
10214 EOCP
10215         set try
10216         if eval $compile; then
10217                 yyy=`$run ./try`
10218                 case "$yyy" in
10219                 123.456)
10220                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10221                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10222                         echo "We will use %f."
10223                         ;;
10224                 esac
10225         fi
10226 fi
10227
10228 if $test X"$sPRIfldbl" = X; then
10229         $cat >try.c <<'EOCP'
10230 #include <sys/types.h>
10231 #include <stdio.h>
10232 int main() {
10233   long double d = 123.456;
10234   printf("%.3Lf\n", d);
10235 }
10236 EOCP
10237         set try
10238         if eval $compile; then
10239                 yyy=`$run ./try`
10240                 case "$yyy" in
10241                 123.456)
10242                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10243                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10244                         echo "We will use %Lf."
10245                         ;;
10246                 esac
10247         fi
10248 fi
10249
10250 if $test X"$sPRIfldbl" = X; then
10251         $cat >try.c <<'EOCP'
10252 #include <sys/types.h>
10253 #include <stdio.h>
10254 int main() {
10255   long double d = 123.456;
10256   printf("%.3llf\n", d);
10257 }
10258 EOCP
10259         set try
10260         if eval $compile; then
10261                 yyy=`$run ./try`
10262                 case "$yyy" in
10263                 123.456)
10264                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10265                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10266                         echo "We will use %llf."
10267                         ;;
10268                 esac
10269         fi
10270 fi
10271
10272 if $test X"$sPRIfldbl" = X; then
10273         $cat >try.c <<'EOCP'
10274 #include <sys/types.h>
10275 #include <stdio.h>
10276 int main() {
10277   long double d = 123.456;
10278   printf("%.3lf\n", d);
10279 }
10280 EOCP
10281         set try
10282         if eval $compile; then
10283                 yyy=`$run ./try`
10284                 case "$yyy" in
10285                 123.456)
10286                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10287                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10288                         echo "We will use %lf."
10289                         ;;
10290                 esac
10291         fi
10292 fi
10293
10294 if $test X"$sPRIfldbl" = X; then
10295         echo "Cannot figure out how to print long doubles." >&4
10296 else
10297         sSCNfldbl=$sPRIfldbl    # expect consistency
10298 fi
10299
10300 $rm_try
10301
10302 fi # d_longdbl
10303
10304 case "$sPRIfldbl" in
10305 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10306         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10307         d_SCNfldbl="$undef";
10308         ;;
10309 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10310         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10311         d_SCNfldbl="$define";
10312         ;;
10313 esac
10314
10315 : Before committing on uselongdouble, see whether that looks sane.
10316 if $test "$uselongdouble" = "$define"; then
10317     message=""
10318     echo " "
10319     echo "Checking if your long double math functions work right..." >&4
10320     $cat > try.c <<EOF
10321 #include <math.h>
10322 #include <stdio.h>
10323 int main() {
10324   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10325 }
10326 EOF
10327     case "$osname:$gccversion" in
10328     aix:)       saveccflags="$ccflags"
10329                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10330     esac
10331     set try
10332     if eval $compile_ok; then
10333       yyy=`$run ./try`
10334     fi
10335     case "$yyy" in
10336     3) echo "Your long double math functions are working correctly." >&4 ;;
10337     *) echo "Your long double math functions are broken, not using long doubles." >&4
10338        uselongdouble=$undef
10339        ;;
10340     esac
10341     $rm_try
10342     case "$osname:$gccversion" in
10343     aix:)       ccflags="$saveccflags" ;; # restore
10344     esac
10345 fi
10346
10347 : Check how to convert floats to strings.
10348
10349 if test "X$d_Gconvert" = X; then
10350
10351 echo " "
10352 echo "Checking for an efficient way to convert floats to strings."
10353 echo " " > try.c
10354 case "$uselongdouble" in
10355 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10356 esac
10357 case "$d_longdbl" in
10358 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10359 esac
10360 case "$d_PRIgldbl" in
10361 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10362 esac
10363 $cat >>try.c <<EOP
10364 #ifdef TRY_gconvert
10365 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10366 char *myname = "gconvert";
10367 #endif
10368 #ifdef TRY_gcvt
10369 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10370 char *myname = "gcvt";
10371 #endif
10372 #ifdef TRY_qgcvt
10373 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10374 char *myname = "qgcvt";
10375 #define DOUBLETYPE long double
10376 #endif
10377 #ifdef TRY_sprintf
10378 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10379 #ifdef HAS_PRIgldbl
10380 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10381 #else
10382 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10383 #endif
10384 #else
10385 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10386 #endif
10387 char *myname = "sprintf";
10388 #endif
10389
10390 #ifndef DOUBLETYPE
10391 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10392 #define DOUBLETYPE long double
10393 #else
10394 #define DOUBLETYPE double
10395 #endif
10396 #endif
10397
10398 #include <stdio.h>
10399
10400 #$i_stdlib I_STDLIB
10401 #ifdef I_STDLIB
10402 #include <stdlib.h>
10403 #endif
10404 #include <string.h>
10405
10406 int checkit(char *expect, char *got)
10407 {
10408     if (strcmp(expect, got)) {
10409                 printf("%s oddity:  Expected %s, got %s\n",
10410                         myname, expect, got);
10411                 exit(1);
10412         }
10413 }
10414
10415 int main()
10416 {
10417         char buf[64];
10418         buf[63] = '\0';
10419
10420         /* This must be 1st test on (which?) platform */
10421         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10422         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10423         checkit("0.1", buf);
10424
10425         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10426         checkit("0.01", buf);
10427
10428         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10429         checkit("0.001", buf);
10430
10431         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10432         checkit("0.0001", buf);
10433
10434         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10435         if (strlen(buf) > 5)
10436             checkit("9e-005", buf); /* for Microsoft ?? */
10437         else
10438             checkit("9e-05", buf);
10439
10440         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10441         checkit("1", buf);
10442
10443         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10444         checkit("1.1", buf);
10445
10446         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10447         checkit("1.01", buf);
10448
10449         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10450         checkit("1.001", buf);
10451
10452         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10453         checkit("1.0001", buf);
10454
10455         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10456         checkit("1.00001", buf);
10457
10458         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10459         checkit("1.000001", buf);
10460
10461         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10462         checkit("0", buf);
10463
10464         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10465         checkit("-1", buf);
10466
10467         /* Some Linux gcvt's give 1.e+5 here. */
10468         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10469         checkit("100000", buf);
10470
10471         /* Some Linux gcvt's give -1.e+5 here. */
10472         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10473         checkit("-100000", buf);
10474
10475         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10476         checkit("123.456", buf);
10477
10478         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10479         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10480         /* 34 should be enough to scare even long double
10481          * places into using the e notation. */
10482         if (strlen(buf) > 5)
10483             checkit("1e+034", buf); /* for Microsoft */
10484         else
10485             checkit("1e+34", buf);
10486
10487         /* For Perl, if you add additional tests here, also add them to
10488          * t/base/num.t for benefit of platforms not using Configure or
10489          * overriding d_Gconvert */
10490
10491         exit(0);
10492 }
10493 EOP
10494 : first add preferred functions to our list
10495 xxx_list=""
10496 for xxx_convert in $gconvert_preference; do
10497     case $xxx_convert in
10498     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10499     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10500     esac
10501 done
10502 : then add any others
10503 for xxx_convert in gconvert gcvt sprintf; do
10504     case "$xxx_list" in
10505     *$xxx_convert*) ;;
10506     *) xxx_list="$xxx_list $xxx_convert" ;;
10507     esac
10508 done
10509
10510 case "$d_longdbl$uselongdouble" in
10511 "$define$define")
10512     : again, add preferred functions to our list first
10513     xxx_ld_list=""
10514     for xxx_convert in $gconvert_ld_preference; do
10515         case $xxx_convert in
10516         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10517         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10518         esac
10519     done
10520     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10521     for xxx_convert in qgcvt sprintf $xxx_list; do
10522         case "$xxx_ld_list" in
10523         $xxx_convert*|*" $xxx_convert"*) ;;
10524         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10525         esac
10526     done
10527     : if sprintf cannot do long doubles, move it to the end
10528     if test "$d_PRIgldbl" != "$define"; then
10529         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10530     fi
10531     : if no qgcvt, remove it
10532     if test "$d_qgcvt" != "$define"; then
10533         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10534     fi
10535     : use the ld_list
10536     xxx_list="$xxx_ld_list"
10537     ;;
10538 esac
10539
10540 for xxx_convert in $xxx_list; do
10541         echo "Trying $xxx_convert..."
10542         $rm -f try try$_o core
10543         set try -DTRY_$xxx_convert
10544         if eval $compile; then
10545                 echo "$xxx_convert() found." >&4
10546                 if $run ./try; then
10547                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10548                         break;
10549                 else
10550                         echo "...But $xxx_convert didn't work as I expected."
10551                         xxx_convert=''
10552                 fi
10553         else
10554                 echo "$xxx_convert NOT found." >&4
10555         fi
10556 done
10557
10558 if test X$xxx_convert = X; then
10559     echo "*** WHOA THERE!!! ***" >&4
10560     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10561     xxx_convert=sprintf
10562 fi
10563
10564 case "$xxx_convert" in
10565 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10566 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10567 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10568 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10569    "$define$define$define")
10570       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10571    "$define$define$undef")
10572       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10573    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10574    esac
10575    ;;
10576 esac
10577
10578 fi
10579 $rm_try
10580
10581 : see if _fwalk exists
10582 set fwalk d__fwalk
10583 eval $inlibc
10584
10585 : Initialize h_fcntl
10586 h_fcntl=false
10587
10588 : Initialize h_sysfile
10589 h_sysfile=false
10590
10591 : access call always available on UNIX
10592 set access d_access
10593 eval $inlibc
10594
10595 : locate the flags for 'access()'
10596 case "$d_access" in
10597 "$define")
10598         echo " "
10599         $cat >access.c <<EOCP
10600 #include <sys/types.h>
10601 #ifdef I_FCNTL
10602 #include <fcntl.h>
10603 #endif
10604 #ifdef I_SYS_FILE
10605 #include <sys/file.h>
10606 #endif
10607 #ifdef I_UNISTD
10608 #include <unistd.h>
10609 #endif
10610 #$i_stdlib I_STDLIB
10611 #ifdef I_STDLIB
10612 #include <stdlib.h>
10613 #endif
10614 int main() {
10615         exit(R_OK);
10616 }
10617 EOCP
10618         : check sys/file.h first, no particular reason here
10619         if $test `./findhdr sys/file.h` && \
10620                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10621                 h_sysfile=true;
10622                 echo "<sys/file.h> defines the *_OK access constants." >&4
10623         elif $test `./findhdr fcntl.h` && \
10624                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10625                 h_fcntl=true;
10626                 echo "<fcntl.h> defines the *_OK access constants." >&4
10627         elif $test `./findhdr unistd.h` && \
10628                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10629                 echo "<unistd.h> defines the *_OK access constants." >&4
10630         else
10631                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10632         fi
10633         ;;
10634 esac
10635 $rm -f access*
10636
10637 : see if accessx exists
10638 set accessx d_accessx
10639 eval $inlibc
10640
10641 : see if acosh exists
10642 set acosh d_acosh
10643 eval $inlibc
10644
10645 : see if aintl exists
10646 set aintl d_aintl
10647 eval $inlibc
10648
10649 : see if alarm exists
10650 set alarm d_alarm
10651 eval $inlibc
10652
10653 : see if 64bit time functions exists
10654
10655 set ctime64 d_ctime64
10656 eval $inlibc
10657
10658 set localtime64 d_localtime64
10659 eval $inlibc
10660
10661 set gmtime64 d_gmtime64
10662 eval $inlibc
10663
10664 set mktime64 d_mktime64
10665 eval $inlibc
10666
10667 set difftime64 d_difftime64
10668 eval $inlibc
10669
10670 set asctime64 d_asctime64
10671 eval $inlibc
10672
10673 : see if POSIX threads are available
10674 set pthread.h i_pthread
10675 eval $inhdr
10676
10677 : define a function to check prototypes
10678 $cat > protochk <<EOSH
10679 $startsh
10680 cc="$cc"
10681 optimize="$optimize"
10682 ccflags="$ccflags"
10683 define="$define"
10684 rm_try="$rm_try"
10685 usethreads=$usethreads
10686 i_pthread=$i_pthread
10687 pthread_h_first=$pthread_h_first
10688 EOSH
10689
10690 $cat >> protochk <<'EOSH'
10691
10692 $rm_try
10693 foo="$1"
10694 shift
10695 while test $# -ge 2; do
10696         case "$1" in
10697                 $define) echo "#include <$2>" >> try.c ;;
10698                 literal) echo "$2" >> try.c ;;
10699         esac
10700     # Extra magic for the benefit of systems that need pthread.h
10701     # to be included early to correctly detect threadsafe functions.
10702     # Such functions must guarantee themselves, though, that the usethreads
10703     # and i_pthread have been defined, before calling protochk.
10704     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10705         echo "#include <pthread.h>" >> try.c
10706         pthread_h_done=yes
10707     fi
10708     shift 2
10709 done
10710 cat >> try.c <<'EOCP'
10711 #define _(args) args
10712 EOCP
10713 echo "$foo" >> try.c
10714 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10715 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10716 status=$?
10717 $rm_try
10718 exit $status
10719 EOSH
10720 chmod +x protochk
10721 $eunicefix protochk
10722
10723 : Define hasproto macro for Configure internal use
10724 hasproto='varname=$1; func=$2; shift; shift;
10725 while $test $# -ge 2; do
10726         case "$1" in
10727         $define) echo "#include <$2>";;
10728         esac ;
10729     shift 2;
10730 done > try.c;
10731 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10732 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10733         echo "$func() prototype found.";
10734         val="$define";
10735 else
10736         echo "$func() prototype NOT found.";
10737         val="$undef";
10738 fi;
10739 set $varname;
10740 eval $setvar;
10741 $rm_try tryout.c'
10742
10743 : see if sys/types.h has to be included
10744 set sys/types.h i_systypes
10745 eval $inhdr
10746
10747 : see if sys/select.h has to be included
10748 set sys/select.h i_sysselct
10749 eval $inhdr
10750
10751 : Define hasfield macro for Configure internal use
10752 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10753 while $test $# -ge 2; do
10754         case "$1" in
10755         $define) echo "#include <$2>";;
10756         esac ;
10757     shift 2;
10758 done > try.c;
10759 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10760 set try;
10761 if eval $compile; then
10762         val="$define";
10763 else
10764         val="$undef";
10765 fi;
10766 set $varname;
10767 eval $setvar;
10768 $rm_try'
10769
10770 : see if we should include sys/time.h
10771 echo " "
10772 i_time='define'
10773 if test "X$timeincl" = X; then
10774         echo "Testing to see if we should include <sys/time.h>." >&4
10775         $echo $n "I'm now running the test program...$c"
10776         $cat >try.c <<EOCP
10777 #include <sys/types.h>
10778 #include <time.h>
10779 #ifdef I_SYSTIME
10780 #ifdef SYSTIMEKERNEL
10781 #define KERNEL
10782 #endif
10783 #include <sys/time.h>
10784 #endif
10785 #ifdef I_SYSSELECT
10786 #include <sys/select.h>
10787 #endif
10788 #$i_stdlib I_STDLIB
10789 #ifdef I_STDLIB
10790 #include <stdlib.h>
10791 #endif
10792 int main()
10793 {
10794         struct tm foo;
10795 #ifdef S_TIMEVAL
10796         struct timeval bar;
10797 #endif
10798 #ifdef S_TIMEZONE
10799         struct timezone tzp;
10800 #endif
10801         if (foo.tm_sec == foo.tm_sec)
10802                 exit(0);
10803 #ifdef S_TIMEVAL
10804         if (bar.tv_sec == bar.tv_sec)
10805                 exit(0);
10806 #endif
10807         exit(1);
10808 }
10809 EOCP
10810         flags=''
10811         for s_timezone in '-DS_TIMEZONE' ''; do
10812         sysselect=''
10813         for s_timeval in '-DS_TIMEVAL' ''; do
10814         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10815         for i_systime in '-DI_SYSTIME' ''; do
10816                 case "$flags" in
10817                 '') $echo $n ".$c"
10818                         set try $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10819                         if eval $compile; then
10820                                 set X $i_systime $i_systimek $sysselect $s_timeval
10821                                 shift
10822                                 flags="$*"
10823                                 echo " "
10824                                 $echo $n "Succeeded with $flags$c"
10825                         fi
10826                         ;;
10827                 esac
10828         done
10829         done
10830         done
10831         done
10832         timeincl=''
10833         echo " "
10834         case "$flags" in
10835         *SYSTIMEKERNEL*) i_systimek="$define"
10836                 timeincl=`./findhdr sys/time.h`
10837                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10838         *) i_systimek="$undef";;
10839         esac
10840         case "$flags" in
10841         *I_SYSTIME*) i_systime="$define"
10842                 timeincl=`./findhdr sys/time.h`" $timeincl"
10843                 echo "We'll include <sys/time.h>." >&4;;
10844         *) i_systime="$undef";;
10845         esac
10846         $rm_try
10847 fi
10848 : see if struct tm knows about tm_zone
10849 case "$i_systime$i_time" in
10850 *$define*)
10851         echo " "
10852         echo "Checking to see if your struct tm has tm_zone field..." >&4
10853         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10854         eval $hasfield
10855         ;;
10856 *)      val="$undef"
10857         set d_tm_tm_zone
10858         eval $setvar
10859         ;;
10860 esac
10861 case "$d_tm_tm_zone" in
10862 "$define")      echo "Yes, it does."   ;;
10863 *)              echo "No, it doesn't." ;;
10864 esac
10865 : see if struct tm knows about tm_gmtoff
10866 case "$i_systime$i_time" in
10867 *$define*)
10868         echo " "
10869         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10870         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10871         eval $hasfield
10872         ;;
10873 *)      val="$undef"
10874         set d_tm_tm_gmtoff
10875         eval $setvar
10876         ;;
10877 esac
10878 case "$d_tm_tm_gmtoff" in
10879 "$define")      echo "Yes, it does."   ;;
10880 *)              echo "No, it doesn't." ;;
10881 esac
10882
10883 : see if asctime_r exists
10884 set asctime_r d_asctime_r
10885 eval $inlibc
10886 case "$d_asctime_r" in
10887 "$define")
10888         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10889         case "$d_asctime_r_proto:$usethreads" in
10890         ":define")      d_asctime_r_proto=define
10891                 set d_asctime_r_proto asctime_r $hdrs
10892                 eval $hasproto ;;
10893         *)      ;;
10894         esac
10895         case "$d_asctime_r_proto" in
10896         define)
10897         case "$asctime_r_proto" in
10898         ''|0) try='char* asctime_r(const struct tm*, char*);'
10899         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10900         esac
10901         case "$asctime_r_proto" in
10902         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10903         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10904         esac
10905         case "$asctime_r_proto" in
10906         ''|0) try='int asctime_r(const struct tm*, char*);'
10907         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10908         esac
10909         case "$asctime_r_proto" in
10910         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10911         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10912         esac
10913         case "$asctime_r_proto" in
10914         ''|0)   d_asctime_r=undef
10915                 asctime_r_proto=0
10916                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10917         * )     case "$asctime_r_proto" in
10918                 REENTRANT_PROTO*) ;;
10919                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10920                 esac
10921                 echo "Prototype: $try" ;;
10922         esac
10923         ;;
10924         *)      case "$usethreads" in
10925                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10926                 esac
10927                 d_asctime_r=undef
10928                 asctime_r_proto=0
10929                 ;;
10930         esac
10931         ;;
10932 *)      asctime_r_proto=0
10933         ;;
10934 esac
10935
10936 : see if asinh exists
10937 set asinh d_asinh
10938 eval $inlibc
10939
10940 : see if atanh exists
10941 set atanh d_atanh
10942 eval $inlibc
10943
10944 : see if atolf exists
10945 set atolf d_atolf
10946 eval $inlibc
10947
10948 : see if atoll exists
10949 set atoll d_atoll
10950 eval $inlibc
10951
10952 : Look for GCC-style attribute format
10953 case "$d_attribute_format" in
10954 '')
10955 echo " "
10956 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10957 $cat >attrib.c <<'EOCP'
10958 #include <stdio.h>
10959 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10960 EOCP
10961 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10962         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10963                 echo "Your C compiler doesn't support __attribute__((format))."
10964                 val="$undef"
10965         else
10966                 echo "Your C compiler supports __attribute__((format))."
10967                 val="$define"
10968         fi
10969 else
10970         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10971         val="$undef"
10972 fi
10973 ;;
10974 *) val="$d_attribute_format" ;;
10975 esac
10976 set d_attribute_format
10977 eval $setvar
10978 $rm -f attrib*
10979
10980 : Look for GCC-style attribute format with null format allowed
10981 case "$d_printf_format_null" in
10982 '') case "$d_attribute_format" in
10983     $define)
10984         echo " "
10985         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10986 $cat >attrib.c <<EOCP
10987 #include <stdio.h>
10988 #$i_stdlib I_STDLIB
10989 #ifdef I_STDLIB
10990 #include <stdlib.h>
10991 #endif
10992 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10993 int null_printf (char* pat,...) { return (int)pat; }
10994 int main () { exit(null_printf(NULL)); }
10995 EOCP
10996         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10997             : run the executable in case it produces a run-time warning
10998             if $run ./attrib >>attrib.out 2>&1; then
10999                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11000                     echo "Your C compiler doesn't allow __printf__ format to be null."
11001                     val="$undef"
11002                 else
11003                     echo "Your C compiler allows __printf__ format to be null."
11004                     val="$define"
11005                 fi
11006             else
11007             echo "Your C compiler executable failed with __printf__ format null."
11008             val="$undef"
11009         fi
11010     else
11011         echo "Your C compiler fails with __printf__ format null."
11012         val="$undef"
11013     fi
11014     ;;
11015     *)  val="$undef" ;;
11016     esac
11017 ;;
11018 *)  val="$d_printf_format_null" ;;
11019 esac
11020 set d_printf_format_null
11021 eval $setvar
11022 $rm -f attrib*
11023
11024 : Look for GCC-style attribute malloc
11025 case "$d_attribute_malloc" in
11026 '')
11027 echo " "
11028 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11029 $cat >attrib.c <<'EOCP'
11030 #include <stdio.h>
11031 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11032 EOCP
11033 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11034         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11035                 echo "Your C compiler doesn't support __attribute__((malloc))."
11036                 val="$undef"
11037         else
11038                 echo "Your C compiler supports __attribute__((malloc))."
11039                 val="$define"
11040         fi
11041 else
11042         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11043         val="$undef"
11044 fi
11045 ;;
11046 *) val="$d_attribute_malloc" ;;
11047 esac
11048 set d_attribute_malloc
11049 eval $setvar
11050 $rm -f attrib*
11051
11052 : Look for GCC-style attribute nonnull
11053 case "$d_attribute_nonnull" in
11054 '')
11055 echo " "
11056 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11057 $cat >attrib.c <<'EOCP'
11058 #include <stdio.h>
11059 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11060 EOCP
11061 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11062         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11063                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11064                 val="$undef"
11065         else
11066                 echo "Your C compiler supports __attribute__((nonnull))."
11067                 val="$define"
11068         fi
11069 else
11070         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11071         val="$undef"
11072 fi
11073 ;;
11074 *) val="$d_attribute_nonnull" ;;
11075 esac
11076 set d_attribute_nonnull
11077 eval $setvar
11078 $rm -f attrib*
11079
11080 : Look for GCC-style attribute noreturn
11081 case "$d_attribute_noreturn" in
11082 '')
11083 echo " "
11084 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11085 $cat >attrib.c <<'EOCP'
11086 #include <stdio.h>
11087 void fall_over_dead( void ) __attribute__((noreturn));
11088 EOCP
11089 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11090         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11091                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11092                 val="$undef"
11093         else
11094                 echo "Your C compiler supports __attribute__((noreturn))."
11095                 val="$define"
11096         fi
11097 else
11098         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11099         val="$undef"
11100 fi
11101 ;;
11102 *) val="$d_attribute_noreturn" ;;
11103 esac
11104 set d_attribute_noreturn
11105 eval $setvar
11106 $rm -f attrib*
11107
11108 : Look for GCC-style attribute pure
11109 case "$d_attribute_pure" in
11110 '')
11111 echo " "
11112 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11113 $cat >attrib.c <<'EOCP'
11114 #include <stdio.h>
11115 int square( int n ) __attribute__((pure));
11116 EOCP
11117 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11118         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11119                 echo "Your C compiler doesn't support __attribute__((pure))."
11120                 val="$undef"
11121         else
11122                 echo "Your C compiler supports __attribute__((pure))."
11123                 val="$define"
11124         fi
11125 else
11126         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11127         val="$undef"
11128 fi
11129 ;;
11130 *) val="$d_attribute_pure" ;;
11131 esac
11132 set d_attribute_pure
11133 eval $setvar
11134 $rm -f attrib*
11135
11136 : Look for GCC-style attribute unused
11137 case "$d_attribute_unused" in
11138 '')
11139 echo " "
11140 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11141 $cat >attrib.c <<'EOCP'
11142 #include <stdio.h>
11143 int do_something( int dummy __attribute__((unused)), int n );
11144 EOCP
11145 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11146         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11147                 echo "Your C compiler doesn't support __attribute__((unused))."
11148                 val="$undef"
11149         else
11150                 echo "Your C compiler supports __attribute__((unused))."
11151                 val="$define"
11152         fi
11153 else
11154         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11155         val="$undef"
11156 fi
11157 ;;
11158 *) val="$d_attribute_unused" ;;
11159 esac
11160 set d_attribute_unused
11161 eval $setvar
11162 $rm -f attrib*
11163
11164 : Look for GCC-style attribute deprecated
11165 case "$d_attribute_deprecated" in
11166 '')
11167 echo " "
11168 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11169 $cat >attrib.c <<'EOCP'
11170 #include <stdio.h>
11171 int I_am_deprecated(void) __attribute__((deprecated));
11172 EOCP
11173 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11174         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11175                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11176                 val="$undef"
11177         else
11178                 echo "Your C compiler supports __attribute__((deprecated))."
11179                 val="$define"
11180         fi
11181 else
11182         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11183         val="$undef"
11184 fi
11185 ;;
11186 *) val="$d_attribute_deprecated" ;;
11187 esac
11188 set d_attribute_deprecated
11189 eval $setvar
11190 $rm -f attrib*
11191
11192 : Look for GCC-style attribute warn_unused_result
11193 case "$d_attribute_warn_unused_result" in
11194 '')
11195 echo " "
11196 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11197 $cat >attrib.c <<'EOCP'
11198 #include <stdio.h>
11199 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11200 EOCP
11201 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11202         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11203                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11204                 val="$undef"
11205         else
11206                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11207                 val="$define"
11208         fi
11209 else
11210         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11211         val="$undef"
11212 fi
11213 ;;
11214 *) val="$d_attribute_warn_unused_result" ;;
11215 esac
11216 set d_attribute_warn_unused_result
11217 eval $setvar
11218 $rm -f attrib*
11219
11220 : see if getpgrp exists
11221 set getpgrp d_getpgrp
11222 eval $inlibc
11223
11224 case "$d_getpgrp" in
11225 "$define")
11226         echo " "
11227         echo "Checking to see which flavor of getpgrp is in use..."
11228         $cat >try.c <<EOP
11229 #$i_unistd I_UNISTD
11230 #include <sys/types.h>
11231 #ifdef I_UNISTD
11232 #  include <unistd.h>
11233 #endif
11234 #$i_stdlib I_STDLIB
11235 #ifdef I_STDLIB
11236 #include <stdlib.h>
11237 #endif
11238 int main()
11239 {
11240         if (getuid() == 0) {
11241                 printf("(I see you are running Configure as super-user...)\n");
11242                 setuid(1);
11243         }
11244 #ifdef TRY_BSD_PGRP
11245         if (getpgrp(1) == 0)
11246                 exit(0);
11247 #else
11248         if (getpgrp() > 0)
11249                 exit(0);
11250 #endif
11251         exit(1);
11252 }
11253 EOP
11254         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11255                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11256                 val="$define"
11257         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11258                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11259                 val="$undef"
11260         else
11261                 echo "I can't seem to compile and run the test program."
11262                 if ./usg; then
11263                         xxx="a USG one, i.e. you use getpgrp()."
11264                 else
11265                         # SVR4 systems can appear rather BSD-ish.
11266                         case "$i_unistd" in
11267                         $undef)
11268                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11269                                 val="$define"
11270                                 ;;
11271                         $define)
11272                                 xxx="probably a USG one, i.e. you use getpgrp()."
11273                                 val="$undef"
11274                                 ;;
11275                         esac
11276                 fi
11277                 echo "Assuming your getpgrp is $xxx" >&4
11278         fi
11279         ;;
11280 *) val="$undef";;
11281 esac
11282 set d_bsdgetpgrp
11283 eval $setvar
11284 $rm_try
11285
11286 : see if setpgrp exists
11287 set setpgrp d_setpgrp
11288 eval $inlibc
11289
11290 case "$d_setpgrp" in
11291 "$define")
11292         echo " "
11293         echo "Checking to see which flavor of setpgrp is in use..."
11294         $cat >try.c <<EOP
11295 #$i_unistd I_UNISTD
11296 #include <sys/types.h>
11297 #ifdef I_UNISTD
11298 #  include <unistd.h>
11299 #endif
11300 #$i_stdlib I_STDLIB
11301 #ifdef I_STDLIB
11302 #include <stdlib.h>
11303 #endif
11304 int main()
11305 {
11306         if (getuid() == 0) {
11307                 printf("(I see you are running Configure as super-user...)\n");
11308                 setuid(1);
11309         }
11310 #ifdef TRY_BSD_PGRP
11311         if (-1 == setpgrp(1, 1))
11312                 exit(0);
11313 #else
11314         if (setpgrp() != -1)
11315                 exit(0);
11316 #endif
11317         exit(1);
11318 }
11319 EOP
11320         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11321                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11322                 val="$define"
11323         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11324                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11325                 val="$undef"
11326         else
11327                 echo "(I can't seem to compile and run the test program.)"
11328                 if ./usg; then
11329                         xxx="a USG one, i.e. you use setpgrp()."
11330                 else
11331                         # SVR4 systems can appear rather BSD-ish.
11332                         case "$i_unistd" in
11333                         $undef)
11334                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11335                                 val="$define"
11336                                 ;;
11337                         $define)
11338                                 xxx="probably a USG one, i.e. you use setpgrp()."
11339                                 val="$undef"
11340                                 ;;
11341                         esac
11342                 fi
11343                 echo "Assuming your setpgrp is $xxx" >&4
11344         fi
11345         ;;
11346 *) val="$undef";;
11347 esac
11348 set d_bsdsetpgrp
11349 eval $setvar
11350 $rm_try
11351
11352 : Look for GCC-style __builtin_add_overflow
11353 case "$d_builtin_add_overflow" in
11354 '')
11355     echo " "
11356     echo "Checking whether your compiler can handle __builtin_add_overflow ..." >&4
11357     $cat >try.c <<'EOCP'
11358 int main(void) {
11359     const unsigned int uint_max = ~0u;
11360     int target_int = 0;
11361     if (__builtin_add_overflow(1, 2, &target_int) || target_int != 3) {
11362         return 1;
11363     }
11364     if (!__builtin_add_overflow((int)(uint_max >> 1), 1, &target_int)) {
11365         return 1;
11366     }
11367     if (!__builtin_add_overflow(uint_max, -1, &target_int)) {
11368         return 1;
11369     }
11370     return 0;
11371 }
11372 EOCP
11373     set try
11374     if eval $compile && $run ./try; then
11375         echo "Your C compiler supports __builtin_add_overflow."
11376         val="$define"
11377     else
11378         echo "Your C compiler doesn't seem to understand __builtin_add_overflow."
11379         val="$undef"
11380     fi
11381     ;;
11382 *) val="$d_builtin_add_overflow" ;;
11383 esac
11384
11385 set d_builtin_add_overflow
11386 eval $setvar
11387 $rm_try
11388
11389 : Look for GCC-style __builtin_sub_overflow
11390 case "$d_builtin_sub_overflow" in
11391 '')
11392     echo " "
11393     echo "Checking whether your compiler can handle __builtin_sub_overflow ..." >&4
11394     $cat >try.c <<'EOCP'
11395 int main(void) {
11396     const unsigned int uint_max = ~0u;
11397     int target_int = 0;
11398     if (__builtin_sub_overflow(1, -2, &target_int) || target_int != 3) {
11399         return 1;
11400     }
11401     if (!__builtin_sub_overflow(-(int)(uint_max >> 1), 2, &target_int)) {
11402         return 1;
11403     }
11404     if (!__builtin_sub_overflow(uint_max, 1, &target_int)) {
11405         return 1;
11406     }
11407     return 0;
11408 }
11409 EOCP
11410     set try
11411     if eval $compile && $run ./try; then
11412         echo "Your C compiler supports __builtin_sub_overflow."
11413         val="$define"
11414     else
11415         echo "Your C compiler doesn't seem to understand __builtin_sub_overflow."
11416         val="$undef"
11417     fi
11418     ;;
11419 *) val="$d_builtin_sub_overflow" ;;
11420 esac
11421
11422 set d_builtin_sub_overflow
11423 eval $setvar
11424 $rm_try
11425
11426 : Look for GCC-style __builtin_mul_overflow
11427 case "$d_builtin_mul_overflow" in
11428 '')
11429     echo " "
11430     echo "Checking whether your compiler can handle __builtin_mul_overflow ..." >&4
11431     $cat >try.c <<'EOCP'
11432 int main(void) {
11433     const unsigned int uint_max = ~0u;
11434     int target_int = 0;
11435     if (__builtin_mul_overflow(2, 3, &target_int) || target_int != 6) {
11436         return 1;
11437     }
11438     if (!__builtin_mul_overflow((int)(uint_max >> 1), 2, &target_int)) {
11439         return 1;
11440     }
11441     if (!__builtin_mul_overflow(uint_max, 1, &target_int)) {
11442         return 1;
11443     }
11444     return 0;
11445 }
11446 EOCP
11447     set try
11448     if eval $compile && $run ./try; then
11449         echo "Your C compiler supports __builtin_mul_overflow."
11450         val="$define"
11451     else
11452         echo "Your C compiler doesn't seem to understand __builtin_mul_overflow."
11453         val="$undef"
11454     fi
11455     ;;
11456 *) val="$d_builtin_mul_overflow" ;;
11457 esac
11458
11459 set d_builtin_mul_overflow
11460 eval $setvar
11461 $rm_try
11462
11463 : Look for GCC-style __builtin_choose_expr
11464 case "$d_builtin_choose_expr" in
11465 '')
11466     echo " "
11467     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11468     $cat >try.c <<'EOCP'
11469 #include <assert.h>
11470 #include <stdlib.h>
11471 #include <stdio.h>
11472
11473 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11474
11475 int main(void) {
11476     assert( SYRINX(1) == 2112 );
11477     assert( SYRINX(1) != 5150 );
11478     assert( SYRINX(0) == 5150 );
11479     assert( SYRINX(0) != 2112 );
11480     puts( "All good!" );
11481     exit(0);
11482 }
11483
11484 EOCP
11485     set try
11486     if eval $compile && $run ./try; then
11487         echo "Your C compiler supports __builtin_choose_expr."
11488         val="$define"
11489     else
11490         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11491         val="$undef"
11492     fi
11493 ;;
11494 *) val="$d_builtin_choose_expr" ;;
11495 esac
11496
11497 set d_builtin_choose_expr
11498 eval $setvar
11499 $rm_try
11500
11501 : Look for GCC-style __builtin_expect
11502 case "$d_builtin_expect" in
11503 '')
11504     echo " "
11505     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11506     $cat >try.c <<'EOCP'
11507 int main(void) {
11508     int n = 50;
11509     if ( __builtin_expect(n, 0) ) n = 1;
11510     /* Remember shell exit code truth is 0, C truth is non-zero */
11511     return !(n == 1);
11512 }
11513 EOCP
11514     set try
11515     if eval $compile && $run ./try; then
11516         echo "Your C compiler supports __builtin_expect."
11517         val="$define"
11518     else
11519         echo "Your C compiler doesn't seem to understand __builtin_expect."
11520         val="$undef"
11521     fi
11522     ;;
11523 *) val="$d_builtin_expect" ;;
11524 esac
11525
11526 set d_builtin_expect
11527 eval $setvar
11528 $rm_try
11529
11530 : see if the Compiler supports C99 variadic macros
11531 echo "Checking for C99 variadic macros." >&4
11532 $cat >try.c <<EOCP
11533 #include <stdio.h>
11534 #include <stdarg.h>
11535
11536 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11537
11538 int main() {
11539   char buf[20];
11540   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11541   puts(buf);
11542   return 0;
11543 }
11544 EOCP
11545 set try
11546 if eval $compile && $run ./try 2>&1 >/dev/null; then
11547     case "`$run ./try`" in
11548         "123 456 789")
11549         echo "You have C99 variadic macros." >&4
11550         d_c99_variadic_macros="$define"
11551         ;;
11552         *)
11553         echo "You don't have functional C99 variadic macros." >&4
11554         d_c99_variadic_macros="$undef"
11555         ;;
11556     esac
11557 else
11558     echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11559     d_c99_variadic_macros="$undef"
11560 fi
11561 $rm_try
11562
11563 : see if signal is declared as pointer to function returning int or void
11564 echo " "
11565 xxx=`./findhdr signal.h`
11566 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11567 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11568         echo "You have int (*signal())() instead of void." >&4
11569         val="$undef"
11570 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11571         echo "You have void (*signal())()." >&4
11572         val="$define"
11573 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11574         echo "You have int (*signal())() instead of void." >&4
11575         val="$undef"
11576 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11577         echo "You have void (*signal())()." >&4
11578         val="$define"
11579 else
11580         case "$d_voidsig" in
11581         '')
11582         echo "I can't determine whether signal handler returns void or int..." >&4
11583                 dflt=void
11584                 rp="What type does your signal handler return?"
11585                 . ./myread
11586                 case "$ans" in
11587                 v*) val="$define";;
11588                 *) val="$undef";;
11589                 esac;;
11590         "$define")
11591                 echo "As you already told me, signal handler returns void." >&4
11592                 val="$define"
11593                 ;;
11594         *)      echo "As you already told me, signal handler returns int." >&4
11595                 val="$undef"
11596                 ;;
11597         esac
11598 fi
11599 set d_voidsig
11600 eval $setvar
11601 case "$d_voidsig" in
11602 "$define") signal_t="void";;
11603 *) signal_t="int";;
11604 esac
11605 $rm -f $$.tmp
11606
11607 : check for ability to cast large floats to 32-bit ints.
11608 echo " "
11609 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11610 if $test "$intsize" -ge 4; then
11611         xxx=int
11612 else
11613         xxx=long
11614 fi
11615 $cat >try.c <<EOCP
11616 #include <stdio.h>
11617 #$i_stdlib I_STDLIB
11618 #ifdef I_STDLIB
11619 #include <stdlib.h>
11620 #endif
11621 #include <sys/types.h>
11622 #include <signal.h>
11623 $signal_t blech(int s) { exit(3); }
11624 int main()
11625 {
11626         $xxx i32;
11627         double f, g;
11628         int result = 0;
11629         char str[16];
11630         signal(SIGFPE, blech);
11631
11632         /* Don't let compiler optimize the test away.  Store the number
11633            in a writable string for gcc to pass to sscanf under HP-UX.
11634         */
11635         sprintf(str, "2147483647");
11636         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11637         g = 10 * f;
11638         i32  = ($xxx) g;
11639
11640         /* x86 processors will probably give 0x8000 0000, which is a
11641            sign change.  We don't want that.  We want to mimic SPARC
11642            behavior here, which is to preserve the sign and give
11643            back 0x7fff ffff.
11644         */
11645         if (i32 != ($xxx) f)
11646                 result |= 1;
11647         exit(result);
11648 }
11649 EOCP
11650 set try
11651 if eval $compile_ok; then
11652         $run ./try 2>/dev/null
11653         yyy=$?
11654 else
11655         echo "(I can't seem to compile the test program--assuming it can't)"
11656         yyy=1
11657 fi
11658 case "$yyy" in
11659 0)      val="$define"
11660         echo "Yup, it can."
11661         ;;
11662 *)      val="$undef"
11663         echo "Nope, it can't."
11664         ;;
11665 esac
11666 set d_casti32
11667 eval $setvar
11668 $rm_try
11669
11670 : check for ability to cast negative floats to unsigned
11671 echo " "
11672 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11673 $cat >try.c <<EOCP
11674 #include <stdio.h>
11675 #$i_stdlib I_STDLIB
11676 #ifdef I_STDLIB
11677 #include <stdlib.h>
11678 #endif
11679 #include <sys/types.h>
11680 #include <signal.h>
11681 $signal_t blech(int s) { exit(7); }
11682 $signal_t blech_in_list(int s) { exit(4); }
11683 unsigned long dummy_long(unsigned long p) { return p; }
11684 unsigned int dummy_int(unsigned int p) { return p; }
11685 unsigned short dummy_short(unsigned short p) { return p; }
11686 int main()
11687 {
11688         double f;
11689         unsigned long along;
11690         unsigned int aint;
11691         unsigned short ashort;
11692         int result = 0;
11693         char str[16];
11694
11695         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11696            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11697            optimized the whole file away
11698         */
11699         /* Store the number in a writable string for gcc to pass to
11700            sscanf under HP-UX.
11701         */
11702         sprintf(str, "-123");
11703         sscanf(str, "%lf", &f);  /* f = -123.; */
11704
11705         signal(SIGFPE, blech);
11706         along = (unsigned long)f;
11707         aint = (unsigned int)f;
11708         ashort = (unsigned short)f;
11709         if (along != (unsigned long)-123)
11710                 result |= 1;
11711         if (aint != (unsigned int)-123)
11712                 result |= 1;
11713         if (ashort != (unsigned short)-123)
11714                 result |= 1;
11715         sprintf(str, "1073741824.");
11716         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11717         f = f + f;
11718         along = 0;
11719         along = (unsigned long)f;
11720         if (along != 0x80000000)
11721                 result |= 2;
11722         f -= 1.;
11723         along = 0;
11724         along = (unsigned long)f;
11725         if (along != 0x7fffffff)
11726                 result |= 1;
11727         f += 2.;
11728         along = 0;
11729         along = (unsigned long)f;
11730         if (along != 0x80000001)
11731                 result |= 2;
11732         if (result)
11733                 exit(result);
11734         signal(SIGFPE, blech_in_list);
11735         sprintf(str, "123.");
11736         sscanf(str, "%lf", &f);  /* f = 123.; */
11737         along = dummy_long((unsigned long)f);
11738         aint = dummy_int((unsigned int)f);
11739         ashort = dummy_short((unsigned short)f);
11740         if (along != (unsigned long)123)
11741                 result |= 4;
11742         if (aint != (unsigned int)123)
11743                 result |= 4;
11744         if (ashort != (unsigned short)123)
11745                 result |= 4;
11746         exit(result);
11747
11748 }
11749 EOCP
11750 set try
11751 if eval $compile_ok; then
11752         $run ./try 2>/dev/null
11753         castflags=$?
11754 else
11755         echo "(I can't seem to compile the test program--assuming it can't)"
11756         castflags=7
11757 fi
11758 case "$castflags" in
11759 0)      val="$define"
11760         echo "Yup, it can."
11761         ;;
11762 *)      val="$undef"
11763         echo "Nope, it can't."
11764         ;;
11765 esac
11766 set d_castneg
11767 eval $setvar
11768 $rm_try
11769
11770 : see if cbrt exists
11771 set cbrt d_cbrt
11772 eval $inlibc
11773
11774 : see if chown exists
11775 set chown d_chown
11776 eval $inlibc
11777
11778 : see if chroot exists
11779 set chroot d_chroot
11780 eval $inlibc
11781
11782 : see if chsize exists
11783 set chsize d_chsize
11784 eval $inlibc
11785
11786 : see if class exists
11787 set class d_class
11788 eval $inlibc
11789
11790 : see if clearenv exists
11791 set clearenv d_clearenv
11792 eval $inlibc
11793
11794 : Define hasstruct macro for Configure internal use
11795 hasstruct='varname=$1; struct=$2; shift; shift;
11796 while $test $# -ge 2; do
11797         case "$1" in
11798         $define) echo "#include <$2>";;
11799         esac ;
11800     shift 2;
11801 done > try.c;
11802 echo "int main () { struct $struct foo; }" >> try.c;
11803 set try;
11804 if eval $compile; then
11805         val="$define";
11806 else
11807         val="$undef";
11808 fi;
11809 set $varname;
11810 eval $setvar;
11811 $rm_try'
11812
11813 : see whether socket exists
11814 socketlib=''
11815 sockethdr=''
11816 echo " "
11817 $echo $n "Hmm... $c" >&4
11818 if set socket val -f d_socket; eval $csym; $val; then
11819     echo "Looks like you have Berkeley networking support." >&4
11820     d_socket="$define"
11821     if set setsockopt val -f; eval $csym; $val; then
11822         d_oldsock="$undef"
11823     else
11824         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11825         d_oldsock="$define"
11826     fi
11827 else
11828     if $contains socklib libc.list >/dev/null 2>&1; then
11829         echo "Looks like you have Berkeley networking support." >&4
11830         d_socket="$define"
11831         : we will have to assume that it supports the 4.2 BSD interface
11832         d_oldsock="$undef"
11833     else
11834         echo "You don't have Berkeley networking in libc$_a..." >&4
11835         if test "X$d_socket" = "X$define"; then
11836             echo "...but you seem to believe that you have sockets." >&4
11837         else
11838             for net in net socket
11839             do
11840                 if test -f $sysroot/usr/lib/lib$net$_a; then
11841                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11842                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11843                     if $contains socket libc.list >/dev/null 2>&1; then
11844                         d_socket="$define"
11845                         socketlib="-l$net"
11846                         case "$net" in
11847                         net)
11848                             echo "...but the Wollongong group seems to have hacked it in." >&4
11849                             sockethdr="-I$sysroot/usr/netinclude"
11850                             ;;
11851                         esac
11852                         echo "Found Berkeley sockets interface in lib$net." >&4
11853                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11854                             d_oldsock="$undef"
11855                         else
11856                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11857                             d_oldsock="$define"
11858                         fi
11859                         break
11860                     fi
11861                 fi
11862             done
11863             if test "X$d_socket" != "X$define"; then
11864                echo "or anywhere else I see." >&4
11865                d_socket="$undef"
11866                d_oldsock="$undef"
11867             fi
11868         fi
11869     fi
11870 fi
11871
11872 : see if socketpair exists
11873 set socketpair d_sockpair
11874 eval $inlibc
11875
11876
11877 echo " "
11878 echo "Checking the availability sa_len in the sock struct ..." >&4
11879 $cat >try.c <<EOF
11880 #include <sys/types.h>
11881 #include <sys/socket.h>
11882 int main() {
11883 struct sockaddr sa;
11884 return (sa.sa_len);
11885 }
11886 EOF
11887 val="$undef"
11888 set try; if eval $compile; then
11889     val="$define"
11890 fi
11891 set d_sockaddr_sa_len; eval $setvar
11892 $rm_try
11893
11894 echo " "
11895 echo "Checking the availability struct sockaddr_in6 ..." >&4
11896 $cat >try.c <<EOF
11897 #include <sys/types.h>
11898 #include <sys/socket.h>
11899 #include <netinet/in.h>
11900 int main() {
11901 struct sockaddr_in6 sin6;
11902 return (sin6.sin6_family);
11903 }
11904 EOF
11905 val="$undef"
11906 set try; if eval $compile; then
11907     val="$define"
11908 fi
11909 set d_sockaddr_in6; eval $setvar
11910 $rm_try
11911
11912 echo " "
11913 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11914 $cat >try.c <<EOF
11915 #include <sys/types.h>
11916 #include <sys/socket.h>
11917 #include <netinet/in.h>
11918 int main() {
11919 struct sockaddr_in6 sin6;
11920 return (sin6.sin6_scope_id);
11921 }
11922 EOF
11923 val="$undef"
11924 set try; if eval $compile; then
11925     val="$define"
11926 fi
11927 set d_sin6_scope_id; eval $setvar
11928 $rm_try
11929
11930 echo " "
11931 echo "Checking the availability struct ip_mreq ..." >&4
11932 $cat >try.c <<EOF
11933 #include <sys/types.h>
11934 #include <sys/socket.h>
11935 #include <netinet/in.h>
11936 int main() {
11937 struct ip_mreq mreq;
11938 return (mreq.imr_multiaddr.s_addr);
11939 }
11940 EOF
11941 val="$undef"
11942 set try; if eval $compile; then
11943        val="$define"
11944 fi
11945 set d_ip_mreq; eval $setvar
11946 $rm_try
11947
11948 echo " "
11949 echo "Checking the availability struct ip_mreq_source ..." >&4
11950 $cat >try.c <<EOF
11951 #include <sys/types.h>
11952 #include <sys/socket.h>
11953 #include <netinet/in.h>
11954 int main() {
11955 struct ip_mreq_source mreq;
11956 return (mreq.imr_multiaddr.s_addr);
11957 }
11958 EOF
11959 val="$undef"
11960 set try; if eval $compile; then
11961        val="$define"
11962 fi
11963 set d_ip_mreq_source; eval $setvar
11964 $rm_try
11965
11966 echo " "
11967 echo "Checking the availability struct ipv6_mreq ..." >&4
11968 $cat >try.c <<EOF
11969 #include <sys/types.h>
11970 #include <sys/socket.h>
11971 #include <netinet/in.h>
11972 int main() {
11973 struct ipv6_mreq mreq;
11974 return (mreq.ipv6mr_interface);
11975 }
11976 EOF
11977 val="$undef"
11978 set try; if eval $compile; then
11979     val="$define"
11980 fi
11981 set d_ipv6_mreq; eval $setvar
11982 $rm_try
11983
11984 echo " "
11985 echo "Checking the availability struct ipv6_mreq_source ..." >&4
11986 $cat >try.c <<EOF
11987 #include <sys/types.h>
11988 #include <sys/socket.h>
11989 #include <netinet/in.h>
11990 int main() {
11991 struct ipv6_mreq_source mreq;
11992 return (mreq.imr_multiaddr.s_addr);
11993 }
11994 EOF
11995 val="$undef"
11996 set try; if eval $compile; then
11997        val="$define"
11998 fi
11999 set d_ipv6_mreq_source; eval $setvar
12000 $rm_try
12001
12002 echo " "
12003 echo "Checking the availability of certain socket constants..." >&4
12004 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12005     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12006     $cat >try.c <<EOF
12007 #include <sys/types.h>
12008 #include <sys/socket.h>
12009 int main() {
12010     int i = $ENUM;
12011 }
12012 EOF
12013     val="$undef"
12014     set try; if eval $compile; then
12015         val="$define"
12016     fi
12017     set d_${enum}; eval $setvar
12018     $rm_try
12019 done
12020
12021 : see if this is a sys/uio.h system
12022 set sys/uio.h i_sysuio
12023 eval $inhdr
12024
12025 : Check for cmsghdr support
12026 echo " "
12027 echo "Checking to see if your system supports struct cmsghdr..." >&4
12028 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12029 eval $hasstruct
12030 case "$d_cmsghdr_s" in
12031 "$define")      echo "Yes, it does."   ;;
12032 *)              echo "No, it doesn't." ;;
12033 esac
12034
12035
12036 : check for const keyword
12037 echo " "
12038 echo 'Checking to see if your C compiler knows about "const"...' >&4
12039 $cat >const.c <<'EOCP'
12040 typedef struct spug { int drokk; } spug;
12041 int main()
12042 {
12043         const char *foo;
12044         const spug y = { 0 };
12045 }
12046 EOCP
12047 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
12048         val="$define"
12049         echo "Yup, it does."
12050 else
12051         val="$undef"
12052         echo "Nope, it doesn't."
12053 fi
12054 set d_const
12055 eval $setvar
12056
12057 : see if copysign exists
12058 set copysign d_copysign
12059 eval $inlibc
12060
12061 : see if copysignl exists
12062 set copysignl d_copysignl
12063 eval $inlibc
12064
12065 : see if crypt exists
12066 echo " "
12067 set crypt d_crypt
12068 eval $inlibc
12069 case "$d_crypt" in
12070 $define) cryptlib='' ;;
12071 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12072                 echo 'crypt() found.' >&4
12073                 val="$define"
12074                 cryptlib=''
12075         else
12076                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12077                 if $test -z "$cryptlib"; then
12078                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12079                 else
12080                         cryptlib=-lcrypt
12081                 fi
12082                 if $test -z "$cryptlib"; then
12083                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12084                 else
12085                         cryptlib=-lcrypt
12086                 fi
12087                 if $test -z "$cryptlib"; then
12088                         cryptlib=`./loc libcrypt$_a "" $libpth`
12089                 else
12090                         cryptlib=-lcrypt
12091                 fi
12092                 if $test -z "$cryptlib"; then
12093                         echo 'crypt() NOT found.' >&4
12094                         val="$undef"
12095                 else
12096                         val="$define"
12097                 fi
12098         fi
12099         set d_crypt
12100         eval $setvar
12101         ;;
12102 esac
12103
12104 : see if this is a crypt.h system
12105 set crypt.h i_crypt
12106 eval $inhdr
12107
12108 : see if crypt_r exists
12109 set crypt_r d_crypt_r
12110 eval $inlibc
12111 case "$d_crypt_r" in
12112 "$define")
12113         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12114         case "$d_crypt_r_proto:$usethreads" in
12115         ":define")      d_crypt_r_proto=define
12116                 set d_crypt_r_proto crypt_r $hdrs
12117                 eval $hasproto ;;
12118         *)      ;;
12119         esac
12120         case "$d_crypt_r_proto" in
12121         define)
12122         case "$crypt_r_proto" in
12123         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12124         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12125         esac
12126         case "$crypt_r_proto" in
12127         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12128         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12129         esac
12130         case "$crypt_r_proto" in
12131         ''|0)   d_crypt_r=undef
12132                 crypt_r_proto=0
12133                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12134         * )     case "$crypt_r_proto" in
12135                 REENTRANT_PROTO*) ;;
12136                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12137                 esac
12138                 echo "Prototype: $try" ;;
12139         esac
12140         ;;
12141         *)      case "$usethreads" in
12142                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12143                 esac
12144                 d_crypt_r=undef
12145                 crypt_r_proto=0
12146                 ;;
12147         esac
12148         ;;
12149 *)      crypt_r_proto=0
12150         ;;
12151 esac
12152
12153 : get csh whereabouts
12154 case "$csh" in
12155 'csh') val="$undef" ;;
12156 *) val="$define" ;;
12157 esac
12158 set d_csh
12159 eval $setvar
12160 : Respect a hint or command line value for full_csh.
12161 case "$full_csh" in
12162 '') full_csh=$csh ;;
12163 esac
12164
12165 : see if ctermid exists
12166 set ctermid d_ctermid
12167 eval $inlibc
12168
12169 : see if ctermid_r exists
12170 set ctermid_r d_ctermid_r
12171 eval $inlibc
12172 case "$d_ctermid_r" in
12173 "$define")
12174         hdrs="$i_systypes sys/types.h define stdio.h "
12175         case "$d_ctermid_r_proto:$usethreads" in
12176         ":define")      d_ctermid_r_proto=define
12177                 set d_ctermid_r_proto ctermid_r $hdrs
12178                 eval $hasproto ;;
12179         *)      ;;
12180         esac
12181         case "$d_ctermid_r_proto" in
12182         define)
12183         case "$ctermid_r_proto" in
12184         ''|0) try='char* ctermid_r(char*);'
12185         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12186         esac
12187         case "$ctermid_r_proto" in
12188         ''|0)   d_ctermid_r=undef
12189                 ctermid_r_proto=0
12190                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12191         * )     case "$ctermid_r_proto" in
12192                 REENTRANT_PROTO*) ;;
12193                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12194                 esac
12195                 echo "Prototype: $try" ;;
12196         esac
12197         ;;
12198         *)      case "$usethreads" in
12199                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12200                 esac
12201                 d_ctermid_r=undef
12202                 ctermid_r_proto=0
12203                 ;;
12204         esac
12205         ;;
12206 *)      ctermid_r_proto=0
12207         ;;
12208 esac
12209
12210 : see if ctime_r exists
12211 set ctime_r d_ctime_r
12212 eval $inlibc
12213 case "$d_ctime_r" in
12214 "$define")
12215         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12216         case "$d_ctime_r_proto:$usethreads" in
12217         ":define")      d_ctime_r_proto=define
12218                 set d_ctime_r_proto ctime_r $hdrs
12219                 eval $hasproto ;;
12220         *)      ;;
12221         esac
12222         case "$d_ctime_r_proto" in
12223         define)
12224         case "$ctime_r_proto" in
12225         ''|0) try='char* ctime_r(const time_t*, char*);'
12226         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12227         esac
12228         case "$ctime_r_proto" in
12229         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12230         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12231         esac
12232         case "$ctime_r_proto" in
12233         ''|0) try='int ctime_r(const time_t*, char*);'
12234         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12235         esac
12236         case "$ctime_r_proto" in
12237         ''|0) try='int ctime_r(const time_t*, char*, int);'
12238         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12239         esac
12240         case "$ctime_r_proto" in
12241         ''|0)   d_ctime_r=undef
12242                 ctime_r_proto=0
12243                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12244         * )     case "$ctime_r_proto" in
12245                 REENTRANT_PROTO*) ;;
12246                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12247                 esac
12248                 echo "Prototype: $try" ;;
12249         esac
12250         ;;
12251         *)      case "$usethreads" in
12252                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12253                 esac
12254                 d_ctime_r=undef
12255                 ctime_r_proto=0
12256                 ;;
12257         esac
12258         ;;
12259 *)      ctime_r_proto=0
12260         ;;
12261 esac
12262
12263 : see if cuserid exists
12264 set cuserid d_cuserid
12265 eval $inlibc
12266
12267 : see if dbm.h is available
12268 : see if dbmclose exists
12269 set dbmclose d_dbmclose
12270 eval $inlibc
12271
12272 case "$d_dbmclose" in
12273 $define)
12274         set dbm.h i_dbm
12275         eval $inhdr
12276         case "$i_dbm" in
12277         $define)
12278                 val="$undef"
12279                 set i_rpcsvcdbm
12280                 eval $setvar
12281                 ;;
12282         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12283                 eval $inhdr
12284                 ;;
12285         esac
12286         ;;
12287 *)      echo "We won't be including <dbm.h>"
12288         val="$undef"
12289         set i_dbm
12290         eval $setvar
12291         val="$undef"
12292         set i_rpcsvcdbm
12293         eval $setvar
12294         ;;
12295 esac
12296
12297 : see if prototype for dbminit is available
12298 echo " "
12299 set d_dbminitproto dbminit $i_dbm dbm.h
12300 eval $hasproto
12301
12302 : see if difftime exists
12303 set difftime d_difftime
12304 eval $inlibc
12305
12306 : see if this is a dirent system
12307 echo " "
12308 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12309         val="$define"
12310         echo "<dirent.h> found." >&4
12311 else
12312         val="$undef"
12313         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12314                 echo "<sys/dir.h> found." >&4
12315                 echo " "
12316         else
12317                 xinc=`./findhdr sys/ndir.h`
12318         fi
12319         echo "<dirent.h> NOT found." >&4
12320 fi
12321 set i_dirent
12322 eval $setvar
12323
12324 : Look for type of directory structure.
12325 echo " "
12326 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12327
12328 case "$direntrytype" in
12329 ''|' ')
12330         case "$i_dirent" in
12331         $define) guess1='struct dirent' ;;
12332         *) guess1='struct direct'  ;;
12333         esac
12334         ;;
12335 *)      guess1="$direntrytype"
12336         ;;
12337 esac
12338
12339 case "$guess1" in
12340 'struct dirent') guess2='struct direct' ;;
12341 *) guess2='struct dirent' ;;
12342 esac
12343
12344 if $contains "$guess1" try.c >/dev/null 2>&1; then
12345         direntrytype="$guess1"
12346         echo "Your directory entries are $direntrytype." >&4
12347 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12348         direntrytype="$guess2"
12349         echo "Your directory entries seem to be $direntrytype." >&4
12350 else
12351         echo "I don't recognize your system's directory entries." >&4
12352         rp="What type is used for directory entries on this system?"
12353         dflt="$guess1"
12354         . ./myread
12355         direntrytype="$ans"
12356 fi
12357 $rm_try
12358
12359 : see if the directory entry stores field length
12360 echo " "
12361 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12362 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12363         echo "Good, your directory entry keeps length information in d_namlen." >&4
12364         val="$define"
12365 else
12366         echo "Your directory entry does not know about the d_namlen field." >&4
12367         val="$undef"
12368 fi
12369 set d_dirnamlen
12370 eval $setvar
12371 $rm_try
12372
12373 : Look for DIR.dd_fd
12374 case "$i_dirent" in
12375 "$define")
12376     echo "Checking to see if DIR has a dd_fd member variable" >&4
12377     $cat >try.c <<EOCP
12378 #$i_stdlib I_STDLIB
12379 #ifdef I_STDLIB
12380 #include <stdlib.h>
12381 #endif
12382 #include <dirent.h>
12383
12384 int main() {
12385     DIR dir;
12386     dir.dd_fd = 1;
12387     return 0;
12388 }
12389 EOCP
12390     val=$undef
12391     set try
12392     if eval $compile; then
12393         echo "Yes, it does."
12394         val="$define"
12395     else
12396         echo "No, it does not."
12397         val="$undef"
12398     fi
12399     ;;
12400 *)
12401     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12402     val="$undef"
12403     ;;
12404 esac
12405 set d_dir_dd_fd
12406 eval $setvar
12407 $rm_try
12408
12409 : see if this is an sysdir system
12410 set sys/dir.h i_sysdir
12411 eval $inhdr
12412
12413 : see if this is an sysndir system
12414 set sys/ndir.h i_sysndir
12415 eval $inhdr
12416
12417 : Look for dirfd
12418 echo " "
12419 $cat >dirfd.c <<EOM
12420 #include <stdio.h>
12421 #$i_stdlib I_STDLIB
12422 #ifdef I_STDLIB
12423 #include <stdlib.h>
12424 #endif
12425 #$i_dirent I_DIRENT             /**/
12426 #$i_sysdir I_SYS_DIR            /**/
12427 #$i_sysndir I_SYS_NDIR          /**/
12428 #$i_systypes I_SYS_TYPES        /**/
12429 #if defined(I_SYS_TYPES)
12430 #include <sys/types.h>
12431 #endif
12432 #if defined(I_DIRENT)
12433 #include <dirent.h>
12434 #else
12435 #ifdef I_SYS_NDIR
12436 #include <sys/ndir.h>
12437 #else
12438 #ifdef I_SYS_DIR
12439 #include <sys/dir.h>
12440 #endif
12441 #endif
12442 #endif
12443 int main() {
12444         DIR *dirp = opendir(".");
12445         if (dirfd(dirp) >= 0)
12446                 exit(0);
12447         else
12448                 exit(1);
12449 }
12450 EOM
12451 val=$undef
12452 set dirfd
12453 if eval $compile; then
12454         val="$define"
12455 fi
12456 case "$val" in
12457 $define)        echo "dirfd() found." >&4       ;;
12458 *)              echo "dirfd() NOT found." >&4   ;;
12459 esac
12460 set d_dirfd
12461 eval $setvar
12462 $rm -f dirfd*
12463
12464 : see if dladdr exists
12465 set dladdr d_dladdr
12466 eval $inlibc
12467
12468 : see if dlerror exists
12469 xxx_runnm="$runnm"
12470 runnm=false
12471 set dlerror d_dlerror
12472 eval $inlibc
12473 runnm="$xxx_runnm"
12474
12475 : see if dlfcn is available
12476 set dlfcn.h i_dlfcn
12477 eval $inhdr
12478
12479 : Check what extension to use for shared libs
12480 case "$usedl" in
12481 $define|y|true)
12482         $cat << EOM
12483
12484 On a few systems, the dynamically loaded modules that perl generates and uses
12485 will need a different extension than shared libs. The default will probably
12486 be appropriate.
12487
12488 EOM
12489         case "$dlext" in
12490         '')     dflt="$so" ;;
12491         *)      dflt="$dlext" ;;
12492         esac
12493         rp='What is the extension of dynamically loaded modules'
12494         . ./myread
12495         dlext="$ans"
12496         ;;
12497 *)
12498         dlext="none"
12499         ;;
12500 esac
12501
12502 : Check if dlsym need a leading underscore
12503 echo " "
12504 val="$undef"
12505
12506 case "$dlsrc" in
12507 dl_dlopen.xs)
12508         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12509         $cat >dyna.c <<'EOM'
12510 fred () { }
12511 EOM
12512
12513 $cat >fred.c<<EOM
12514
12515 #include <stdio.h>
12516 #$i_stdlib I_STDLIB
12517 #ifdef I_STDLIB
12518 #include <stdlib.h>
12519 #endif
12520 #$i_dlfcn I_DLFCN
12521 #ifdef I_DLFCN
12522 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12523 #else
12524 #include <sys/types.h>
12525 #include <nlist.h>
12526 #include <link.h>
12527 #endif
12528
12529 extern int fred() ;
12530
12531 int main()
12532 {
12533     void * handle ;
12534     void * symbol ;
12535 #ifndef RTLD_LAZY
12536     int mode = 1 ;
12537 #else
12538     int mode = RTLD_LAZY ;
12539 #endif
12540     handle = dlopen("./dyna.$dlext", mode) ;
12541     if (handle == NULL) {
12542         printf ("1\n") ;
12543         fflush (stdout) ;
12544         exit(0);
12545     }
12546     symbol = dlsym(handle, "fred") ;
12547     if (symbol == NULL) {
12548         /* try putting a leading underscore */
12549         symbol = dlsym(handle, "_fred") ;
12550         if (symbol == NULL) {
12551             printf ("2\n") ;
12552             fflush (stdout) ;
12553             exit(0);
12554         }
12555         printf ("3\n") ;
12556     }
12557     else
12558         printf ("4\n") ;
12559     fflush (stdout) ;
12560     exit(0);
12561 }
12562 EOM
12563         : Call the object file tmp-dyna.o in case dlext=o.
12564         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12565                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12566                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12567                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12568                 xxx=`$run ./fred`
12569                 case $xxx in
12570                 1)      echo "Test program failed using dlopen." >&4
12571                         echo "Perhaps you should not use dynamic loading." >&4;;
12572                 2)      echo "Test program failed using dlsym." >&4
12573                         echo "Perhaps you should not use dynamic loading." >&4;;
12574                 3)      echo "dlsym needs a leading underscore" >&4
12575                         val="$define" ;;
12576                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12577                 esac
12578         else
12579                 echo "I can't compile and run the test program." >&4
12580                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12581         fi
12582         ;;
12583 esac
12584
12585 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12586
12587 set d_dlsymun
12588 eval $setvar
12589
12590 : see if drand48_r exists
12591 set drand48_r d_drand48_r
12592 eval $inlibc
12593 case "$d_drand48_r" in
12594 "$define")
12595         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12596         case "$d_drand48_r_proto:$usethreads" in
12597         ":define")      d_drand48_r_proto=define
12598                 set d_drand48_r_proto drand48_r $hdrs
12599                 eval $hasproto ;;
12600         *)      ;;
12601         esac
12602         case "$d_drand48_r_proto" in
12603         define)
12604         case "$drand48_r_proto" in
12605         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12606         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12607         esac
12608         case "$drand48_r_proto" in
12609         ''|0)   d_drand48_r=undef
12610                 drand48_r_proto=0
12611                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12612         * )     case "$drand48_r_proto" in
12613                 REENTRANT_PROTO*) ;;
12614                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12615                 esac
12616                 echo "Prototype: $try" ;;
12617         esac
12618         ;;
12619         *)      case "$usethreads" in
12620                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12621                 esac
12622                 d_drand48_r=undef
12623                 drand48_r_proto=0
12624                 ;;
12625         esac
12626         ;;
12627 *)      drand48_r_proto=0
12628         ;;
12629 esac
12630
12631 : see if prototype for drand48 is available
12632 echo " "
12633 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12634 eval $hasproto
12635
12636 : see if dup2 exists
12637 set dup2 d_dup2
12638 eval $inlibc
12639
12640 : see if eaccess exists
12641 set eaccess d_eaccess
12642 eval $inlibc
12643
12644 : see if endgrent exists
12645 set endgrent d_endgrent
12646 eval $inlibc
12647
12648 : see if this is an grp system
12649 set grp.h i_grp
12650 eval $inhdr
12651
12652 case "$i_grp" in
12653 $define)
12654         xxx=`./findhdr grp.h`
12655         $cppstdin $cppflags $cppminus < $xxx >$$.h
12656
12657         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12658                 val="$define"
12659         else
12660                 val="$undef"
12661         fi
12662         set d_grpasswd
12663         eval $setvar
12664
12665         $rm -f $$.h
12666         ;;
12667 *)
12668         val="$undef";
12669         set d_grpasswd; eval $setvar
12670         ;;
12671 esac
12672
12673 : see if endgrent_r exists
12674 set endgrent_r d_endgrent_r
12675 eval $inlibc
12676 case "$d_endgrent_r" in
12677 "$define")
12678         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12679         case "$d_endgrent_r_proto:$usethreads" in
12680         ":define")      d_endgrent_r_proto=define
12681                 set d_endgrent_r_proto endgrent_r $hdrs
12682                 eval $hasproto ;;
12683         *)      ;;
12684         esac
12685         case "$d_endgrent_r_proto" in
12686         define)
12687         case "$endgrent_r_proto" in
12688         ''|0) try='int endgrent_r(FILE**);'
12689         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12690         esac
12691         case "$endgrent_r_proto" in
12692         ''|0) try='void endgrent_r(FILE**);'
12693         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12694         esac
12695         case "$endgrent_r_proto" in
12696         ''|0)   d_endgrent_r=undef
12697                 endgrent_r_proto=0
12698                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12699         * )     case "$endgrent_r_proto" in
12700                 REENTRANT_PROTO*) ;;
12701                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12702                 esac
12703                 echo "Prototype: $try" ;;
12704         esac
12705         ;;
12706         *)      case "$usethreads" in
12707                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12708                 esac
12709                 d_endgrent_r=undef
12710                 endgrent_r_proto=0
12711                 ;;
12712         esac
12713         ;;
12714 *)      endgrent_r_proto=0
12715         ;;
12716 esac
12717
12718 : see if endhostent exists
12719 set endhostent d_endhent
12720 eval $inlibc
12721
12722 : see if this is a netdb.h system
12723 set netdb.h i_netdb
12724 eval $inhdr
12725
12726 : see if endhostent_r exists
12727 set endhostent_r d_endhostent_r
12728 eval $inlibc
12729 case "$d_endhostent_r" in
12730 "$define")
12731         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12732         case "$d_endhostent_r_proto:$usethreads" in
12733         ":define")      d_endhostent_r_proto=define
12734                 set d_endhostent_r_proto endhostent_r $hdrs
12735                 eval $hasproto ;;
12736         *)      ;;
12737         esac
12738         case "$d_endhostent_r_proto" in
12739         define)
12740         case "$endhostent_r_proto" in
12741         ''|0) try='int endhostent_r(struct hostent_data*);'
12742         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12743         esac
12744         case "$endhostent_r_proto" in
12745         ''|0) try='void endhostent_r(struct hostent_data*);'
12746         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12747         esac
12748         case "$endhostent_r_proto" in
12749         ''|0)   d_endhostent_r=undef
12750                 endhostent_r_proto=0
12751                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12752         * )     case "$endhostent_r_proto" in
12753                 REENTRANT_PROTO*) ;;
12754                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12755                 esac
12756                 echo "Prototype: $try" ;;
12757         esac
12758         ;;
12759         *)      case "$usethreads" in
12760                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12761                 esac
12762                 d_endhostent_r=undef
12763                 endhostent_r_proto=0
12764                 ;;
12765         esac
12766         ;;
12767 *)      endhostent_r_proto=0
12768         ;;
12769 esac
12770
12771 : see if endnetent exists
12772 set endnetent d_endnent
12773 eval $inlibc
12774
12775 : see if endnetent_r exists
12776 set endnetent_r d_endnetent_r
12777 eval $inlibc
12778 case "$d_endnetent_r" in
12779 "$define")
12780         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12781         case "$d_endnetent_r_proto:$usethreads" in
12782         ":define")      d_endnetent_r_proto=define
12783                 set d_endnetent_r_proto endnetent_r $hdrs
12784                 eval $hasproto ;;
12785         *)      ;;
12786         esac
12787         case "$d_endnetent_r_proto" in
12788         define)
12789         case "$endnetent_r_proto" in
12790         ''|0) try='int endnetent_r(struct netent_data*);'
12791         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12792         esac
12793         case "$endnetent_r_proto" in
12794         ''|0) try='void endnetent_r(struct netent_data*);'
12795         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12796         esac
12797         case "$endnetent_r_proto" in
12798         ''|0)   d_endnetent_r=undef
12799                 endnetent_r_proto=0
12800                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12801         * )     case "$endnetent_r_proto" in
12802                 REENTRANT_PROTO*) ;;
12803                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12804                 esac
12805                 echo "Prototype: $try" ;;
12806         esac
12807         ;;
12808         *)      case "$usethreads" in
12809                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12810                 esac
12811                 d_endnetent_r=undef
12812                 endnetent_r_proto=0
12813                 ;;
12814         esac
12815         ;;
12816 *)      endnetent_r_proto=0
12817         ;;
12818 esac
12819
12820 : see if endprotoent exists
12821 set endprotoent d_endpent
12822 eval $inlibc
12823
12824 : see if endprotoent_r exists
12825 set endprotoent_r d_endprotoent_r
12826 eval $inlibc
12827 case "$d_endprotoent_r" in
12828 "$define")
12829         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12830         case "$d_endprotoent_r_proto:$usethreads" in
12831         ":define")      d_endprotoent_r_proto=define
12832                 set d_endprotoent_r_proto endprotoent_r $hdrs
12833                 eval $hasproto ;;
12834         *)      ;;
12835         esac
12836         case "$d_endprotoent_r_proto" in
12837         define)
12838         case "$endprotoent_r_proto" in
12839         ''|0) try='int endprotoent_r(struct protoent_data*);'
12840         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12841         esac
12842         case "$endprotoent_r_proto" in
12843         ''|0) try='void endprotoent_r(struct protoent_data*);'
12844         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12845         esac
12846         case "$endprotoent_r_proto" in
12847         ''|0)   d_endprotoent_r=undef
12848                 endprotoent_r_proto=0
12849                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12850         * )     case "$endprotoent_r_proto" in
12851                 REENTRANT_PROTO*) ;;
12852                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12853                 esac
12854                 echo "Prototype: $try" ;;
12855         esac
12856         ;;
12857         *)      case "$usethreads" in
12858                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12859                 esac
12860                 d_endprotoent_r=undef
12861                 endprotoent_r_proto=0
12862                 ;;
12863         esac
12864         ;;
12865 *)      endprotoent_r_proto=0
12866         ;;
12867 esac
12868
12869 : see if endpwent exists
12870 set endpwent d_endpwent
12871 eval $inlibc
12872
12873 : see if this is a pwd.h system
12874 set pwd.h i_pwd
12875 eval $inhdr
12876
12877 case "$i_pwd" in
12878 $define)
12879         xxx=`./findhdr pwd.h`
12880         $cppstdin $cppflags $cppminus < $xxx >$$.h
12881
12882         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12883                 val="$define"
12884         else
12885                 val="$undef"
12886         fi
12887         set d_pwquota
12888         eval $setvar
12889
12890         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12891                 val="$define"
12892         else
12893                 val="$undef"
12894         fi
12895         set d_pwage
12896         eval $setvar
12897
12898         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12899                 val="$define"
12900         else
12901                 val="$undef"
12902         fi
12903         set d_pwchange
12904         eval $setvar
12905
12906         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12907                 val="$define"
12908         else
12909                 val="$undef"
12910         fi
12911         set d_pwclass
12912         eval $setvar
12913
12914         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12915                 val="$define"
12916         else
12917                 val="$undef"
12918         fi
12919         set d_pwexpire
12920         eval $setvar
12921
12922         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12923                 val="$define"
12924         else
12925                 val="$undef"
12926         fi
12927         set d_pwcomment
12928         eval $setvar
12929
12930         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12931                 val="$define"
12932         else
12933                 val="$undef"
12934         fi
12935         set d_pwgecos
12936         eval $setvar
12937
12938         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12939                 val="$define"
12940         else
12941                 val="$undef"
12942         fi
12943         set d_pwpasswd
12944         eval $setvar
12945
12946         $rm -f $$.h
12947         ;;
12948 *)
12949         val="$undef";
12950         set d_pwquota; eval $setvar
12951         set d_pwage; eval $setvar
12952         set d_pwchange; eval $setvar
12953         set d_pwclass; eval $setvar
12954         set d_pwexpire; eval $setvar
12955         set d_pwcomment; eval $setvar
12956         set d_pwgecos; eval $setvar
12957         set d_pwpasswd; eval $setvar
12958         ;;
12959 esac
12960
12961 : see if endpwent_r exists
12962 set endpwent_r d_endpwent_r
12963 eval $inlibc
12964 case "$d_endpwent_r" in
12965 "$define")
12966         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12967         case "$d_endpwent_r_proto:$usethreads" in
12968         ":define")      d_endpwent_r_proto=define
12969                 set d_endpwent_r_proto endpwent_r $hdrs
12970                 eval $hasproto ;;
12971         *)      ;;
12972         esac
12973         case "$d_endpwent_r_proto" in
12974         define)
12975         case "$endpwent_r_proto" in
12976         ''|0) try='int endpwent_r(FILE**);'
12977         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12978         esac
12979         case "$endpwent_r_proto" in
12980         ''|0) try='void endpwent_r(FILE**);'
12981         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12982         esac
12983         case "$endpwent_r_proto" in
12984         ''|0)   d_endpwent_r=undef
12985                 endpwent_r_proto=0
12986                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12987         * )     case "$endpwent_r_proto" in
12988                 REENTRANT_PROTO*) ;;
12989                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12990                 esac
12991                 echo "Prototype: $try" ;;
12992         esac
12993         ;;
12994         *)      case "$usethreads" in
12995                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12996                 esac
12997                 d_endpwent_r=undef
12998                 endpwent_r_proto=0
12999                 ;;
13000         esac
13001         ;;
13002 *)      endpwent_r_proto=0
13003         ;;
13004 esac
13005
13006 : see if endservent exists
13007 set endservent d_endsent
13008 eval $inlibc
13009
13010 : see if endservent_r exists
13011 set endservent_r d_endservent_r
13012 eval $inlibc
13013 case "$d_endservent_r" in
13014 "$define")
13015         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13016         case "$d_endservent_r_proto:$usethreads" in
13017         ":define")      d_endservent_r_proto=define
13018                 set d_endservent_r_proto endservent_r $hdrs
13019                 eval $hasproto ;;
13020         *)      ;;
13021         esac
13022         case "$d_endservent_r_proto" in
13023         define)
13024         case "$endservent_r_proto" in
13025         ''|0) try='int endservent_r(struct servent_data*);'
13026         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13027         esac
13028         case "$endservent_r_proto" in
13029         ''|0) try='void endservent_r(struct servent_data*);'
13030         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13031         esac
13032         case "$endservent_r_proto" in
13033         ''|0)   d_endservent_r=undef
13034                 endservent_r_proto=0
13035                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13036         * )     case "$endservent_r_proto" in
13037                 REENTRANT_PROTO*) ;;
13038                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13039                 esac
13040                 echo "Prototype: $try" ;;
13041         esac
13042         ;;
13043         *)      case "$usethreads" in
13044                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13045                 esac
13046                 d_endservent_r=undef
13047                 endservent_r_proto=0
13048                 ;;
13049         esac
13050         ;;
13051 *)      endservent_r_proto=0
13052         ;;
13053 esac
13054
13055 : Locate the flags for 'open()'
13056 echo " "
13057 $cat >try.c <<EOCP
13058 #include <sys/types.h>
13059 #ifdef I_FCNTL
13060 #include <fcntl.h>
13061 #endif
13062 #ifdef I_SYS_FILE
13063 #include <sys/file.h>
13064 #endif
13065 #$i_stdlib I_STDLIB
13066 #ifdef I_STDLIB
13067 #include <stdlib.h>
13068 #endif
13069 int main() {
13070         if(O_RDONLY);
13071 #ifdef O_TRUNC
13072         exit(0);
13073 #else
13074         exit(1);
13075 #endif
13076 }
13077 EOCP
13078 : check sys/file.h first to get FREAD on Sun
13079 if $test `./findhdr sys/file.h` && \
13080                 set try -DI_SYS_FILE && eval $compile; then
13081         h_sysfile=true;
13082         echo "<sys/file.h> defines the O_* constants..." >&4
13083         if $run ./try; then
13084                 echo "and you have the 3 argument form of open()." >&4
13085                 val="$define"
13086         else
13087                 echo "but not the 3 argument form of open().  Oh, well." >&4
13088                 val="$undef"
13089         fi
13090 elif $test `./findhdr fcntl.h` && \
13091                 set try -DI_FCNTL && eval $compile; then
13092         h_fcntl=true;
13093         echo "<fcntl.h> defines the O_* constants..." >&4
13094         if $run ./try; then
13095                 echo "and you have the 3 argument form of open()." >&4
13096                 val="$define"
13097         else
13098                 echo "but not the 3 argument form of open().  Oh, well." >&4
13099                 val="$undef"
13100         fi
13101 else
13102         val="$undef"
13103         echo "I can't find the O_* constant definitions!  You got problems." >&4
13104 fi
13105 set d_open3
13106 eval $setvar
13107 $rm_try
13108
13109 : see if this is a sys/file.h system
13110 val=''
13111 set sys/file.h val
13112 eval $inhdr
13113
13114 : do we need to include sys/file.h ?
13115 case "$val" in
13116 "$define")
13117         echo " "
13118         if $h_sysfile; then
13119                 val="$define"
13120                 echo "We'll be including <sys/file.h>." >&4
13121         else
13122                 val="$undef"
13123                 echo "We won't be including <sys/file.h>." >&4
13124         fi
13125         ;;
13126 *)
13127         h_sysfile=false
13128         ;;
13129 esac
13130 set i_sysfile
13131 eval $setvar
13132
13133 : see if fcntl.h is there
13134 val=''
13135 set fcntl.h val
13136 eval $inhdr
13137
13138 : see if we can include fcntl.h
13139 case "$val" in
13140 "$define")
13141         echo " "
13142         if $h_fcntl; then
13143                 val="$define"
13144                 echo "We'll be including <fcntl.h>." >&4
13145         else
13146                 val="$undef"
13147                 if $h_sysfile; then
13148         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13149                 else
13150                         echo "We won't be including <fcntl.h>." >&4
13151                 fi
13152         fi
13153         ;;
13154 *)
13155         h_fcntl=false
13156         val="$undef"
13157         ;;
13158 esac
13159 set i_fcntl
13160 eval $setvar
13161
13162 : see if fork exists
13163 set fork d_fork
13164 eval $inlibc
13165
13166 : see if pipe exists
13167 set pipe d_pipe
13168 eval $inlibc
13169
13170 : check for non-blocking I/O stuff
13171 case "$h_sysfile" in
13172 true) echo "#include <sys/file.h>" > head.c;;
13173 *)
13174        case "$h_fcntl" in
13175        true) echo "#include <fcntl.h>" > head.c;;
13176        *) echo "#include <sys/fcntl.h>" > head.c;;
13177        esac
13178        ;;
13179 esac
13180 echo " "
13181 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13182 case "$o_nonblock" in
13183 '')
13184         $cat head.c > try.c
13185         $cat >>try.c <<EOCP
13186 #include <stdio.h>
13187 #$i_stdlib I_STDLIB
13188 #ifdef I_STDLIB
13189 #include <stdlib.h>
13190 #endif
13191 #$i_fcntl I_FCNTL
13192 #ifdef I_FCNTL
13193 #include <fcntl.h>
13194 #endif
13195 int main() {
13196 #ifdef O_NONBLOCK
13197         printf("O_NONBLOCK\n");
13198         exit(0);
13199 #endif
13200 #ifdef O_NDELAY
13201         printf("O_NDELAY\n");
13202         exit(0);
13203 #endif
13204 #ifdef FNDELAY
13205         printf("FNDELAY\n");
13206         exit(0);
13207 #endif
13208         exit(0);
13209 }
13210 EOCP
13211         set try
13212         if eval $compile_ok; then
13213                 o_nonblock=`$run ./try`
13214                 case "$o_nonblock" in
13215                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13216                 *) echo "Seems like we can use $o_nonblock.";;
13217                 esac
13218         else
13219                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13220         fi
13221         ;;
13222 *) echo "Using $hint value $o_nonblock.";;
13223 esac
13224 $rm_try
13225
13226 echo " "
13227 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13228 case "$eagain" in
13229 '')
13230         case "$d_fork:$d_pipe:$d_alarm" in
13231         define:define:define)
13232         $cat head.c > try.c
13233         $cat >>try.c <<EOCP
13234 #include <errno.h>
13235 #include <sys/types.h>
13236 #include <signal.h>
13237 #include <stdio.h>
13238 #$i_stdlib I_STDLIB
13239 #ifdef I_STDLIB
13240 #include <stdlib.h>
13241 #endif
13242 #$i_fcntl I_FCNTL
13243 #ifdef I_FCNTL
13244 #include <fcntl.h>
13245 #endif
13246 #define MY_O_NONBLOCK $o_nonblock
13247 #ifndef errno  /* XXX need better Configure test */
13248 extern int errno;
13249 #endif
13250 #$i_unistd I_UNISTD
13251 #ifdef I_UNISTD
13252 #include <unistd.h>
13253 #endif
13254 #include <string.h>
13255 $signal_t blech(int x) { exit(3); }
13256 EOCP
13257         $cat >> try.c <<'EOCP'
13258 int main()
13259 {
13260         int pd[2];
13261         int pu[2];
13262         char buf[1];
13263         char string[100];
13264         int ret;
13265
13266         ret = pipe(pd); /* Down: child -> parent */
13267         if (ret != 0)
13268                 exit(3);
13269         ret = pipe(pu); /* Up: parent -> child */
13270         if (ret != 0)
13271                 exit(3);
13272         if (0 != fork()) {
13273                 close(pd[1]);   /* Parent reads from pd[0] */
13274                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13275 #ifdef F_SETFL
13276                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13277                         exit(1);
13278 #else
13279                 exit(4);
13280 #endif
13281                 signal(SIGALRM, blech);
13282                 alarm(5);
13283                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13284                         exit(2);
13285                 sprintf(string, "%d\n", ret);
13286                 ret = write(2, string, strlen(string));
13287                 if (ret != strlen(string))
13288                         exit(3);
13289                 alarm(0);
13290 #ifdef EAGAIN
13291                 if (errno == EAGAIN) {
13292                         printf("EAGAIN\n");
13293                         goto ok;
13294                 }
13295 #endif
13296 #ifdef EWOULDBLOCK
13297                 if (errno == EWOULDBLOCK)
13298                         printf("EWOULDBLOCK\n");
13299 #endif
13300         ok:
13301                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13302                 if (ret != 1)
13303                         exit(3);
13304                 sleep(2);                               /* Give it time to close our pipe */
13305                 alarm(5);
13306                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13307                 alarm(0);
13308                 sprintf(string, "%d\n", ret);
13309                 ret = write(4, string, strlen(string));
13310                 if (ret != strlen(string))
13311                         exit(3);
13312                 exit(0);
13313         }
13314
13315         close(pd[0]);                   /* We write to pd[1] */
13316         close(pu[1]);                   /* We read from pu[0] */
13317         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13318         if (ret != 1)
13319                 exit(3);
13320         close(pd[1]);                   /* Pipe pd is now fully closed! */
13321         exit(0);                                /* Bye bye, thank you for playing! */
13322 }
13323 EOCP
13324         set try
13325         if eval $compile_ok; then
13326                 echo "$startsh" >mtry
13327                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13328                 chmod +x mtry
13329                 $run ./mtry >/dev/null 2>&1
13330                 case $? in
13331                 0) eagain=`$cat try.out`;;
13332                 1) echo "Could not perform non-blocking setting!";;
13333                 2) echo "I did a successful read() for something that was not there!";;
13334                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13335                 4) echo "Could not find F_SETFL!";;
13336                 *) echo "Something terribly wrong happened during testing.";;
13337                 esac
13338                 rd_nodata=`$cat try.ret`
13339                 echo "A read() system call with no data present returns $rd_nodata."
13340                 case "$rd_nodata" in
13341                 0|-1) ;;
13342                 *)
13343                         echo "(That's peculiar, fixing that to be -1.)"
13344                         rd_nodata=-1
13345                         ;;
13346                 esac
13347                 case "$eagain" in
13348                 '')
13349                         echo "Forcing errno EAGAIN on read() with no data available."
13350                         eagain=EAGAIN
13351                         ;;
13352                 *)
13353                         echo "Your read() sets errno to $eagain when no data is available."
13354                         ;;
13355                 esac
13356                 status=`$cat try.err`
13357                 case "$status" in
13358                 0) echo "And it correctly returns 0 to signal EOF.";;
13359                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13360                 *) echo "However, your read() returns '$status' on EOF??";;
13361                 esac
13362                 val="$define"
13363                 if test "$status" = "$rd_nodata"; then
13364                         echo "WARNING: you can't distinguish between EOF and no data!"
13365                         val="$undef"
13366                 fi
13367         else
13368                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13369                 eagain=EAGAIN
13370         fi
13371         ;;
13372         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13373                 eagain=EAGAIN
13374                 val="$define"
13375                 ;;
13376         esac
13377         set d_eofnblk
13378         eval $setvar
13379         ;;
13380 *)
13381         echo "Using $hint value $eagain."
13382         echo "Your read() returns $rd_nodata when no data is present."
13383         case "$d_eofnblk" in
13384         "$define") echo "And you can see EOF because read() returns 0.";;
13385         "$undef") echo "But you can't see EOF status from read() returned value.";;
13386         *)
13387                 echo "(Assuming you can't see EOF status from read anyway.)"
13388                 d_eofnblk=$undef
13389                 ;;
13390         esac
13391         ;;
13392 esac
13393 $rm_try head.c mtry
13394
13395 : see if erf exists
13396 set erf d_erf
13397 eval $inlibc
13398
13399 : see if erfc exists
13400 set erfc d_erfc
13401 eval $inlibc
13402
13403 : see if exp2 exists
13404 set exp2 d_exp2
13405 eval $inlibc
13406
13407 : see if expm1 exists
13408 set expm1 d_expm1
13409 eval $inlibc
13410
13411 : see if _ptr and _cnt from stdio act std
13412 echo " "
13413
13414 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13415         echo "(Looks like you have stdio.h from BSD.)"
13416         case "$stdio_ptr" in
13417         '') stdio_ptr='((fp)->_p)'
13418                 ptr_lval=$define
13419                 ;;
13420         *)      ptr_lval=$d_stdio_ptr_lval;;
13421         esac
13422         case "$stdio_cnt" in
13423         '') stdio_cnt='((fp)->_r)'
13424                 cnt_lval=$define
13425                 ;;
13426         *)      cnt_lval=$d_stdio_cnt_lval;;
13427         esac
13428         case "$stdio_base" in
13429         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13430         esac
13431         case "$stdio_bufsiz" in
13432         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13433         esac
13434 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13435         echo "(Looks like you have stdio.h from Linux.)"
13436         case "$stdio_ptr" in
13437         '') stdio_ptr='((fp)->_IO_read_ptr)'
13438                 ptr_lval=$define
13439                 ;;
13440         *)      ptr_lval=$d_stdio_ptr_lval;;
13441         esac
13442         case "$stdio_cnt" in
13443         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13444                 cnt_lval=$undef
13445                 ;;
13446         *)      cnt_lval=$d_stdio_cnt_lval;;
13447         esac
13448         case "$stdio_base" in
13449         '') stdio_base='((fp)->_IO_read_base)';;
13450         esac
13451         case "$stdio_bufsiz" in
13452         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13453         esac
13454 else
13455         case "$stdio_ptr" in
13456         '') stdio_ptr='((fp)->_ptr)'
13457                 ptr_lval=$define
13458                 ;;
13459         *)      ptr_lval=$d_stdio_ptr_lval;;
13460         esac
13461         case "$stdio_cnt" in
13462         '') stdio_cnt='((fp)->_cnt)'
13463                 cnt_lval=$define
13464                 ;;
13465         *)      cnt_lval=$d_stdio_cnt_lval;;
13466         esac
13467         case "$stdio_base" in
13468         '') stdio_base='((fp)->_base)';;
13469         esac
13470         case "$stdio_bufsiz" in
13471         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13472         esac
13473 fi
13474
13475 : test whether _ptr and _cnt really work
13476 echo "Checking how std your stdio is..." >&4
13477 $cat >try.c <<EOP
13478 #include <stdio.h>
13479 #$i_stdlib I_STDLIB
13480 #ifdef I_STDLIB
13481 #include <stdlib.h>
13482 #endif
13483 #define FILE_ptr(fp)    $stdio_ptr
13484 #define FILE_cnt(fp)    $stdio_cnt
13485 int main() {
13486         FILE *fp = fopen("try.c", "r");
13487         char c = getc(fp);
13488         if (
13489                 18 <= FILE_cnt(fp) &&
13490                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13491         )
13492                 exit(0);
13493         exit(1);
13494 }
13495 EOP
13496 val="$undef"
13497 set try
13498 if eval $compile && $to try.c; then
13499         if $run ./try; then
13500                 echo "Your stdio acts pretty std."
13501                 val="$define"
13502         else
13503                 echo "Your stdio isn't very std."
13504         fi
13505 else
13506         echo "Your stdio doesn't appear very std."
13507 fi
13508 $rm_try
13509
13510 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13511 # direct buffer manipulation no longer works.  The Configure tests
13512 # should be changed to correctly detect this, but until then,
13513 # the following check should at least let perl compile and run.
13514 # (This quick fix should be updated before 5.8.1.)
13515 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13516 # A. Dougherty, June 3, 2002.
13517 case "$d_gnulibc" in
13518 $define)
13519         case "$gnulibc_version" in
13520         2.[01]*)  ;;
13521         2.2) ;;
13522         2.2.[0-9]) ;;
13523         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13524                 val="$undef"
13525                 ;;
13526         esac
13527         ;;
13528 esac
13529 set d_stdstdio
13530 eval $setvar
13531
13532 : Can _ptr be used as an lvalue?
13533 case "$d_stdstdio$ptr_lval" in
13534 $define$define) val=$define ;;
13535 *) val=$undef ;;
13536 esac
13537 set d_stdio_ptr_lval
13538 eval $setvar
13539
13540 : Can _cnt be used as an lvalue?
13541 case "$d_stdstdio$cnt_lval" in
13542 $define$define) val=$define ;;
13543 *) val=$undef ;;
13544 esac
13545 set d_stdio_cnt_lval
13546 eval $setvar
13547
13548
13549 : test whether setting _ptr sets _cnt as a side effect
13550 d_stdio_ptr_lval_sets_cnt="$undef"
13551 d_stdio_ptr_lval_nochange_cnt="$undef"
13552 case "$d_stdio_ptr_lval$d_stdstdio" in
13553 $define$define)
13554         echo "Checking to see what happens if we set the stdio ptr..." >&4
13555 $cat >try.c <<EOP
13556 #include <stdio.h>
13557 /* Can we scream? */
13558 /* Eat dust sed :-) */
13559 /* In the buffer space, no one can hear you scream. */
13560 #$i_stdlib I_STDLIB
13561 #ifdef I_STDLIB
13562 #include <stdlib.h>
13563 #endif
13564 #define FILE_ptr(fp)    $stdio_ptr
13565 #define FILE_cnt(fp)    $stdio_cnt
13566 #include <sys/types.h>
13567 int main() {
13568         FILE *fp = fopen("try.c", "r");
13569         int c;
13570         char *ptr;
13571         size_t cnt;
13572         if (!fp) {
13573             puts("Fail even to read");
13574             exit(1);
13575         }
13576         c = getc(fp); /* Read away the first # */
13577         if (c == EOF) {
13578             puts("Fail even to read");
13579             exit(1);
13580         }
13581         if (!(
13582                 18 <= FILE_cnt(fp) &&
13583                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13584         )) {
13585                 puts("Fail even to read");
13586                 exit (1);
13587         }
13588         ptr = (char*) FILE_ptr(fp);
13589         cnt = (size_t)FILE_cnt(fp);
13590
13591         FILE_ptr(fp) += 42;
13592
13593         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13594                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13595                 exit (1);
13596         }
13597         if (FILE_cnt(fp) <= 20) {
13598                 printf ("Fail (<20 chars to test)");
13599                 exit (1);
13600         }
13601         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13602                 puts("Fail compare");
13603                 exit (1);
13604         }
13605         if (cnt == FILE_cnt(fp)) {
13606                 puts("Pass_unchanged");
13607                 exit (0);
13608         }
13609         if (FILE_cnt(fp) == (cnt - 42)) {
13610                 puts("Pass_changed");
13611                 exit (0);
13612         }
13613         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13614         return 1;
13615
13616 }
13617 EOP
13618         set try
13619         if eval $compile && $to try.c; then
13620                 case `$run ./try` in
13621                 Pass_changed)
13622                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13623                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13624                 Pass_unchanged)
13625                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13626                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13627                 Fail*)
13628                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13629                 *)
13630                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13631         esac
13632         else
13633                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13634         fi
13635         $rm_try
13636         ;;
13637 esac
13638
13639 : see if _base is also standard
13640 val="$undef"
13641 case "$d_stdstdio" in
13642 $define)
13643         $cat >try.c <<EOP
13644 #include <stdio.h>
13645 #$i_stdlib I_STDLIB
13646 #ifdef I_STDLIB
13647 #include <stdlib.h>
13648 #endif
13649 #define FILE_base(fp)   $stdio_base
13650 #define FILE_bufsiz(fp) $stdio_bufsiz
13651 int main() {
13652         FILE *fp = fopen("try.c", "r");
13653         char c = getc(fp);
13654         if (
13655                 19 <= FILE_bufsiz(fp) &&
13656                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13657         )
13658                 exit(0);
13659         exit(1);
13660 }
13661 EOP
13662         set try
13663         if eval $compile && $to try.c; then
13664                 if $run ./try; then
13665                         echo "And its _base field acts std."
13666                         val="$define"
13667                 else
13668                         echo "But its _base field isn't std."
13669                 fi
13670         else
13671                 echo "However, it seems to be lacking the _base field."
13672         fi
13673         $rm_try
13674         ;;
13675 esac
13676 set d_stdiobase
13677 eval $setvar
13678
13679 : see if fast_stdio exists
13680 val="$undef"
13681 case "$d_stdstdio:$d_stdio_ptr_lval" in
13682 "$define:$define")
13683         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13684         *$define*)
13685                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13686                 val="$define"
13687                 ;;
13688         esac
13689         ;;
13690 esac
13691 set d_faststdio
13692 eval $setvar
13693
13694
13695
13696 : see if fchdir exists
13697 set fchdir d_fchdir
13698 eval $inlibc
13699
13700 : see if fchmod exists
13701 set fchmod d_fchmod
13702 eval $inlibc
13703
13704 : check for openat, unlinkat, renameat, linkat, fchmodat
13705 set openat d_openat
13706 eval $inlibc
13707
13708 set unlinkat d_unlinkat
13709 eval $inlibc
13710
13711 set renameat d_renameat
13712 eval $inlibc
13713
13714 set linkat d_linkat
13715 eval $inlibc
13716
13717 set fchmodat d_fchmodat
13718 eval $inlibc
13719
13720 : see if fchown exists
13721 set fchown d_fchown
13722 eval $inlibc
13723
13724 : see if this is an fcntl system
13725 set fcntl d_fcntl
13726 eval $inlibc
13727
13728 : See if fcntl-based locking works.
13729 echo " "
13730 $cat >try.c <<EOCP
13731 #$i_stdlib I_STDLIB
13732 #ifdef I_STDLIB
13733 #include <stdlib.h>
13734 #endif
13735 #include <unistd.h>
13736 #include <fcntl.h>
13737 #include <signal.h>
13738 $signal_t blech(int x) { exit(3); }
13739 int main() {
13740 #if defined(F_SETLK) && defined(F_SETLKW)
13741      struct flock flock;
13742      int retval, fd;
13743      fd = open("try.c", O_RDONLY);
13744      flock.l_type = F_RDLCK;
13745      flock.l_whence = SEEK_SET;
13746      flock.l_start = flock.l_len = 0;
13747      signal(SIGALRM, blech);
13748      alarm(10);
13749      retval = fcntl(fd, F_SETLK, &flock);
13750      close(fd);
13751      (retval < 0 ? exit(2) : exit(0));
13752 #else
13753      exit(2);
13754 #endif
13755 }
13756 EOCP
13757 echo "Checking if fcntl-based file locking works... "
13758 case "$d_fcntl" in
13759 "$define")
13760         set try
13761         if eval $compile_ok; then
13762                 if $run ./try; then
13763                         echo "Yes, it seems to work."
13764                         val="$define"
13765                 else
13766                         echo "Nope, it didn't work."
13767                         val="$undef"
13768                         case "$?" in
13769                         3) $cat >&4 <<EOM
13770 ***
13771 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13772 *** This is (almost) impossible.
13773 *** If your NFS lock daemons are not feeling well, something like
13774 *** this may happen, please investigate.  Cannot continue, aborting.
13775 ***
13776 EOM
13777                                 exit 1
13778                                 ;;
13779                         esac
13780                 fi
13781         else
13782                 echo "I'm unable to compile the test program, so I'll assume not."
13783                 val="$undef"
13784         fi
13785         ;;
13786 *) val="$undef";
13787         echo "Nope, since you don't even have fcntl()."
13788         ;;
13789 esac
13790 set d_fcntl_can_lock
13791 eval $setvar
13792 $rm_try
13793
13794 : check for fd_set items
13795 $cat <<EOM
13796
13797 Checking to see how well your C compiler handles fd_set and friends ...
13798 EOM
13799 $cat >try.c <<EOCP
13800 #$i_stdlib I_STDLIB
13801 #ifdef I_STDLIB
13802 #include <stdlib.h>
13803 #endif
13804 #$i_systime I_SYS_TIME
13805 #$i_sysselct I_SYS_SELECT
13806 #$d_socket HAS_SOCKET
13807 #include <sys/types.h>
13808 #ifdef HAS_SOCKET
13809 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13810 #endif
13811 #ifdef I_SYS_TIME
13812 #include <sys/time.h>
13813 #endif
13814 #ifdef I_SYS_SELECT
13815 #include <sys/select.h>
13816 #endif
13817 int main() {
13818         fd_set fds;
13819
13820 #ifdef TRYBITS
13821         if(fds.fds_bits);
13822 #endif
13823
13824 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13825         exit(0);
13826 #else
13827         exit(1);
13828 #endif
13829 }
13830 EOCP
13831 set try -DTRYBITS
13832 if eval $compile; then
13833         d_fds_bits="$define"
13834         d_fd_set="$define"
13835         echo "Well, your system knows about the normal fd_set typedef..." >&4
13836         if $run ./try; then
13837                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13838                 d_fd_macros="$define"
13839         else
13840                 $cat >&4 <<'EOM'
13841 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13842 EOM
13843                 d_fd_macros="$undef"
13844         fi
13845 else
13846         $cat <<'EOM'
13847 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13848 EOM
13849         set try
13850         if eval $compile; then
13851                 d_fds_bits="$undef"
13852                 d_fd_set="$define"
13853                 echo "Well, your system has some sort of fd_set available..." >&4
13854                 if $run ./try; then
13855                         echo "and you have the normal fd_set macros." >&4
13856                         d_fd_macros="$define"
13857                 else
13858                         $cat <<'EOM'
13859 but not the normal fd_set macros!  Gross!  More work for me...
13860 EOM
13861                         d_fd_macros="$undef"
13862                 fi
13863         else
13864         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13865                 d_fd_set="$undef"
13866                 d_fds_bits="$undef"
13867                 d_fd_macros="$undef"
13868         fi
13869 fi
13870 $rm_try
13871
13872 : see if fdclose exists
13873 set fdclose d_fdclose
13874 eval $inlibc
13875
13876 : see if fdim exists
13877 set fdim d_fdim
13878 eval $inlibc
13879
13880 : see if fegetround exists
13881 set fegetround d_fegetround
13882 eval $inlibc
13883
13884 : see if fgetpos exists
13885 set fgetpos d_fgetpos
13886 eval $inlibc
13887
13888 : see if finite exists
13889 set finite d_finite
13890 eval $inlibc
13891
13892 : see if finitel exists
13893 set finitel d_finitel
13894 eval $inlibc
13895
13896 : see if flock exists
13897 set flock d_flock
13898 eval $inlibc
13899
13900 : see if prototype for flock is available
13901 echo " "
13902 set d_flockproto flock $i_sysfile sys/file.h
13903 eval $hasproto
13904
13905 : see if fma exists
13906 set fma d_fma
13907 eval $inlibc
13908
13909 : see if fmax exists
13910 set fmax d_fmax
13911 eval $inlibc
13912
13913 : see if fmin exists
13914 set fmin d_fmin
13915 eval $inlibc
13916
13917 : see if fp_class exists
13918 set fp_class d_fp_class
13919 eval $inlibc
13920
13921 : check for fpclassify
13922 echo "Checking to see if you have fpclassify..." >&4
13923 $cat >try.c <<EOCP
13924 #include <math.h>
13925 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
13926 EOCP
13927 set try
13928 if eval $compile; then
13929         val="$define"
13930         echo "You have fpclassify."
13931 else
13932         val="$undef"
13933         echo "You do not have fpclassify."
13934 fi
13935 $rm_try
13936 set d_fpclassify
13937 eval $setvar
13938
13939 : see if fp_classify exists
13940 set fp_classify d_fp_classify
13941 eval $inlibc
13942
13943 : see if fp_classl exists
13944 set fp_classl d_fp_classl
13945 eval $inlibc
13946
13947 : see if pathconf exists
13948 set pathconf d_pathconf
13949 eval $inlibc
13950
13951 : see if fpathconf exists
13952 set fpathconf d_fpathconf
13953 eval $inlibc
13954
13955 : see if fpclass exists
13956 set fpclass d_fpclass
13957 eval $inlibc
13958
13959 : see if fpclassl exists
13960 set fpclassl d_fpclassl
13961 eval $inlibc
13962
13963 : see if fpgetround exists
13964 set fpgetround d_fpgetround
13965 eval $inlibc
13966
13967 : check for fpos64_t
13968 echo " "
13969 echo "Checking to see if you have fpos64_t..." >&4
13970 $cat >try.c <<EOCP
13971 #include <stdio.h>
13972 int main() { fpos64_t x = 7; }
13973 EOCP
13974 set try
13975 if eval $compile; then
13976         val="$define"
13977         echo "You have fpos64_t."
13978 else
13979         val="$undef"
13980         echo "You do not have fpos64_t."
13981         case "$fpossize" in
13982         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13983         esac
13984 fi
13985 $rm_try
13986 set d_fpos64_t
13987 eval $setvar
13988
13989 : see if this is an xlocale.h system
13990 set xlocale.h i_xlocale
13991 eval $inhdr
13992
13993 : see if newlocale exists
13994 set newlocale d_newlocale
13995 eval $inlibc
13996
13997 : see if freelocale exists
13998 set freelocale d_freelocale
13999 eval $inlibc
14000
14001 : see if uselocale exists
14002 set uselocale d_uselocale
14003 eval $inlibc
14004
14005 : see if duplocale exists
14006 set duplocale d_duplocale
14007 eval $inlibc
14008
14009 : see if querylocale exists
14010 set querylocale d_querylocale
14011 eval $inlibc
14012
14013 : see if frexpl exists
14014 set frexpl d_frexpl
14015 eval $inlibc
14016
14017 : see if this is a sys/param system
14018 set sys/param.h i_sysparam
14019 eval $inhdr
14020
14021 : see if this is a sys/mount.h system
14022 set sys/mount.h i_sysmount
14023 eval $inhdr
14024
14025 : Check for fs_data_s
14026 echo " "
14027 echo "Checking to see if your system supports struct fs_data..." >&4
14028 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14029 eval $hasstruct
14030 case "$d_fs_data_s" in
14031 "$define")      echo "Yes, it does."   ;;
14032 *)              echo "No, it doesn't." ;;
14033 esac
14034
14035 : see if fseeko exists
14036 set fseeko d_fseeko
14037 eval $inlibc
14038 case "$longsize" in
14039 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14040 esac
14041
14042 : see if fsetpos exists
14043 set fsetpos d_fsetpos
14044 eval $inlibc
14045
14046 : see if fstatfs exists
14047 set fstatfs d_fstatfs
14048 eval $inlibc
14049
14050 : see if statvfs exists
14051 set statvfs d_statvfs
14052 eval $inlibc
14053
14054 : see if fstatvfs exists
14055 set fstatvfs d_fstatvfs
14056 eval $inlibc
14057
14058
14059 : see if fsync exists
14060 set fsync d_fsync
14061 eval $inlibc
14062
14063 : see if ftello exists
14064 set ftello d_ftello
14065 eval $inlibc
14066 case "$longsize" in
14067 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14068 esac
14069
14070 : check for a working futimes
14071 d_futimes="$undef"
14072 echo " "
14073 echo "Checking if you have a working futimes()" >&4
14074 $cat >try.c <<EOCP
14075 #include <stdio.h>
14076 #include <sys/time.h>
14077 #include <errno.h>
14078 #include <fcntl.h>
14079
14080 int main ()
14081 {
14082     int fd, rv;
14083     fd = open ("try.c", O_RDWR);
14084     if (-1 == fd) exit (1);
14085     rv = futimes (fd, NULL);
14086     exit (rv == -1 ? errno : 0);
14087 }
14088 EOCP
14089 set try
14090 if eval $compile; then
14091     `$run ./try`
14092     rc=$?
14093     case "$rc" in
14094         0)  echo "Yes, you have" >&4
14095             d_futimes="$define"
14096             ;;
14097         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14098             ;;
14099     esac
14100 else
14101     echo "No, it does not (probably harmless)" >&4
14102 fi
14103 $rm_try
14104
14105 : look for gai_strerror
14106 echo " "
14107 $cat >try.c <<'EOCP'
14108 #include <sys/types.h>
14109 #include <sys/socket.h>
14110 #include <netdb.h>
14111 int main ()
14112 {
14113     return (gai_strerror (0) ? 0 : 1);
14114     }
14115 EOCP
14116 set try
14117 val="$undef"
14118 if eval $compile; then
14119     `$run ./try`
14120     case "$?" in
14121         0)  echo "A working gai_strerror() found." >&4
14122             val="$define" ;;
14123         *)  echo "gai_strerror() found, but it doesn't work" >&4
14124             ;;
14125         esac
14126 else
14127     echo "gai_strerror() NOT found." >&4
14128     fi
14129 set d_gai_strerror
14130 eval $setvar
14131 $rm_try
14132
14133 : see if ndbm.h is available
14134 set ndbm.h i_ndbm
14135 eval $inhdr
14136 : Compatibility location for RedHat 7.1
14137 set gdbm/ndbm.h i_gdbmndbm
14138 eval $inhdr
14139 : Compatibility location for Debian 4.0
14140 set gdbm-ndbm.h i_gdbm_ndbm
14141 eval $inhdr
14142
14143 val="$undef"
14144 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14145         : see if dbm_open exists
14146         set dbm_open d_dbm_open
14147         eval $inlibc
14148         case "$d_dbm_open" in
14149         $undef)
14150                 i_ndbm="$undef"
14151                 i_gdbmndbm="$undef"
14152                 i_gdbm_ndbm="$undef"
14153                 echo "We won't be including <ndbm.h>"
14154                 val="$undef"
14155                 ;;
14156         *) val="$define"
14157            ;;
14158         esac
14159 fi
14160 set d_ndbm
14161 eval $setvar
14162
14163 ndbm_hdr_protochk='name=$1; hdr=$2;
14164 eval "ihdr=\$""i_$name";
14165 val="$undef";
14166 if $test "$ihdr" = "$define"; then
14167         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14168         case "$d_cplusplus" in
14169         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14170         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14171         esac;
14172         case "$val" in
14173         $define) $echo "Your <$hdr> seems to have prototypes";;
14174         *) $echo "Your <$hdr> does not seem to have prototypes";;
14175         esac;
14176 fi;
14177 set "d_${name}_h_uses_prototypes";
14178 eval $setvar'
14179
14180 set ndbm ndbm.h
14181 eval $ndbm_hdr_protochk
14182 set gdbmndbm gdbm/ndbm.h
14183 eval $ndbm_hdr_protochk
14184 set gdbm_ndbm gdbm-ndbm.h
14185 eval $ndbm_hdr_protochk
14186
14187 : see if getaddrinfo exists
14188 set getaddrinfo d_getaddrinfo
14189 eval $inlibc
14190
14191 : see if getcwd exists
14192 set getcwd d_getcwd
14193 eval $inlibc
14194
14195 : see if getespwnam exists
14196 set getespwnam d_getespwnam
14197 eval $inlibc
14198
14199 : see if getfsstat exists
14200 set getfsstat d_getfsstat
14201 eval $inlibc
14202
14203 : see if getgrent exists
14204 set getgrent d_getgrent
14205 eval $inlibc
14206
14207 : see if getgrent_r exists
14208 set getgrent_r d_getgrent_r
14209 eval $inlibc
14210 case "$d_getgrent_r" in
14211 "$define")
14212         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14213         case "$d_getgrent_r_proto:$usethreads" in
14214         ":define")      d_getgrent_r_proto=define
14215                 set d_getgrent_r_proto getgrent_r $hdrs
14216                 eval $hasproto ;;
14217         *)      ;;
14218         esac
14219         case "$d_getgrent_r_proto" in
14220         define)
14221         case "$getgrent_r_proto" in
14222         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14223         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14224         esac
14225         case "$getgrent_r_proto" in
14226         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14227         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14228         esac
14229         case "$getgrent_r_proto" in
14230         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14231         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14232         esac
14233         case "$getgrent_r_proto" in
14234         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14235         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14236         esac
14237         case "$getgrent_r_proto" in
14238         ''|0) try='int getgrent_r(struct group*, char*, int);'
14239         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14240         esac
14241         case "$getgrent_r_proto" in
14242         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14243         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14244         esac
14245         case "$getgrent_r_proto" in
14246         ''|0)   d_getgrent_r=undef
14247                 getgrent_r_proto=0
14248                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14249         * )     case "$getgrent_r_proto" in
14250                 REENTRANT_PROTO*) ;;
14251                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14252                 esac
14253                 echo "Prototype: $try" ;;
14254         esac
14255         ;;
14256         *)      case "$usethreads" in
14257                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14258                 esac
14259                 d_getgrent_r=undef
14260                 getgrent_r_proto=0
14261                 ;;
14262         esac
14263         ;;
14264 *)      getgrent_r_proto=0
14265         ;;
14266 esac
14267
14268 : see if getgrgid_r exists
14269 set getgrgid_r d_getgrgid_r
14270 eval $inlibc
14271 case "$d_getgrgid_r" in
14272 "$define")
14273         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14274         case "$d_getgrgid_r_proto:$usethreads" in
14275         ":define")      d_getgrgid_r_proto=define
14276                 set d_getgrgid_r_proto getgrgid_r $hdrs
14277                 eval $hasproto ;;
14278         *)      ;;
14279         esac
14280         case "$d_getgrgid_r_proto" in
14281         define)
14282         case "$getgrgid_r_proto" in
14283         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14284         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14285         esac
14286         case "$getgrgid_r_proto" in
14287         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14288         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14289         esac
14290         case "$getgrgid_r_proto" in
14291         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14292         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14293         esac
14294         case "$getgrgid_r_proto" in
14295         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14296         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14297         esac
14298         case "$getgrgid_r_proto" in
14299         ''|0)   d_getgrgid_r=undef
14300                 getgrgid_r_proto=0
14301                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14302         * )     case "$getgrgid_r_proto" in
14303                 REENTRANT_PROTO*) ;;
14304                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14305                 esac
14306                 echo "Prototype: $try" ;;
14307         esac
14308         ;;
14309         *)      case "$usethreads" in
14310                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14311                 esac
14312                 d_getgrgid_r=undef
14313                 getgrgid_r_proto=0
14314                 ;;
14315         esac
14316         ;;
14317 *)      getgrgid_r_proto=0
14318         ;;
14319 esac
14320
14321 : see if getgrnam_r exists
14322 set getgrnam_r d_getgrnam_r
14323 eval $inlibc
14324 case "$d_getgrnam_r" in
14325 "$define")
14326         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14327         case "$d_getgrnam_r_proto:$usethreads" in
14328         ":define")      d_getgrnam_r_proto=define
14329                 set d_getgrnam_r_proto getgrnam_r $hdrs
14330                 eval $hasproto ;;
14331         *)      ;;
14332         esac
14333         case "$d_getgrnam_r_proto" in
14334         define)
14335         case "$getgrnam_r_proto" in
14336         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14337         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14338         esac
14339         case "$getgrnam_r_proto" in
14340         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14341         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14342         esac
14343         case "$getgrnam_r_proto" in
14344         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14345         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14346         esac
14347         case "$getgrnam_r_proto" in
14348         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14349         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14350         esac
14351         case "$getgrnam_r_proto" in
14352         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14353         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14354         esac
14355         case "$getgrnam_r_proto" in
14356         ''|0)   d_getgrnam_r=undef
14357                 getgrnam_r_proto=0
14358                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14359         * )     case "$getgrnam_r_proto" in
14360                 REENTRANT_PROTO*) ;;
14361                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14362                 esac
14363                 echo "Prototype: $try" ;;
14364         esac
14365         ;;
14366         *)      case "$usethreads" in
14367                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14368                 esac
14369                 d_getgrnam_r=undef
14370                 getgrnam_r_proto=0
14371                 ;;
14372         esac
14373         ;;
14374 *)      getgrnam_r_proto=0
14375         ;;
14376 esac
14377
14378 : see if gethostbyaddr exists
14379 set gethostbyaddr d_gethbyaddr
14380 eval $inlibc
14381
14382 : see if gethostbyname exists
14383 set gethostbyname d_gethbyname
14384 eval $inlibc
14385
14386 : see if gethostent exists
14387 set gethostent d_gethent
14388 eval $inlibc
14389
14390 : see how we will look up host name
14391 echo " "
14392 call=''
14393 if set gethostname val -f d_gethname; eval $csym; $val; then
14394         echo 'gethostname() found.' >&4
14395         d_gethname="$define"
14396         call=gethostname
14397 fi
14398 if set uname val -f d_uname; eval $csym; $val; then
14399         if ./xenix; then
14400                 $cat <<'EOM'
14401 uname() was found, but you're running xenix, and older versions of xenix
14402 have a broken uname(). If you don't really know whether your xenix is old
14403 enough to have a broken system call, use the default answer.
14404
14405 EOM
14406                 dflt=y
14407                 case "$d_uname" in
14408                 "$define") dflt=n;;
14409                 esac
14410                 rp='Is your uname() broken?'
14411                 . ./myread
14412                 case "$ans" in
14413                 n*) d_uname="$define"; call=uname;;
14414                 esac
14415         else
14416                 echo 'uname() found.' >&4
14417                 d_uname="$define"
14418                 case "$call" in
14419                 '') call=uname ;;
14420                 esac
14421         fi
14422 fi
14423 case "$d_gethname" in
14424 '') d_gethname="$undef";;
14425 esac
14426 case "$d_uname" in
14427 '') d_uname="$undef";;
14428 esac
14429 case "$d_uname$d_gethname" in
14430 *define*)
14431         dflt=n
14432         cat <<EOM
14433
14434 Every now and then someone has a $call() that lies about the hostname
14435 but can't be fixed for political or economic reasons.  If you wish, I can
14436 pretend $call() isn't there and maybe compute hostname at run-time
14437 thanks to the '$phostname' command.
14438
14439 EOM
14440         rp="Shall I ignore $call() from now on?"
14441         . ./myread
14442         case "$ans" in
14443         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14444         esac;;
14445 esac
14446 case "$phostname" in
14447 '') aphostname='';;
14448 *) case "$aphostname" in
14449         /*) ;;
14450         *) set X $phostname
14451                 shift
14452                 file=$1
14453                 shift
14454                 file=`./loc $file $file $pth`
14455                 aphostname=`echo $file $*`
14456                 ;;
14457         esac
14458         ;;
14459 esac
14460 case "$d_uname$d_gethname" in
14461 *define*) ;;
14462 *)
14463         case "$phostname" in
14464         '')
14465                 echo "There will be no way for $package to get your hostname." >&4;;
14466         *)
14467         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14468                 ;;
14469         esac;;
14470 esac
14471 case "$d_phostname" in
14472 '') d_phostname="$undef";;
14473 esac
14474
14475 : see if gethostbyaddr_r exists
14476 set gethostbyaddr_r d_gethostbyaddr_r
14477 eval $inlibc
14478 case "$d_gethostbyaddr_r" in
14479 "$define")
14480         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14481         case "$d_gethostbyaddr_r_proto:$usethreads" in
14482         ":define")      d_gethostbyaddr_r_proto=define
14483                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14484                 eval $hasproto ;;
14485         *)      ;;
14486         esac
14487         case "$d_gethostbyaddr_r_proto" in
14488         define)
14489         case "$gethostbyaddr_r_proto" in
14490         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14491         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14492         esac
14493         case "$gethostbyaddr_r_proto" in
14494         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14495         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14496         esac
14497         case "$gethostbyaddr_r_proto" in
14498         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14499         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14500         esac
14501         case "$gethostbyaddr_r_proto" in
14502         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14503         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14504         esac
14505         case "$gethostbyaddr_r_proto" in
14506         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14507         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14508         esac
14509         case "$gethostbyaddr_r_proto" in
14510         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14511         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14512         esac
14513         case "$gethostbyaddr_r_proto" in
14514         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14515         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14516         esac
14517         case "$gethostbyaddr_r_proto" in
14518         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14519         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14520         esac
14521         case "$gethostbyaddr_r_proto" in
14522         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14523         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14524         esac
14525         case "$gethostbyaddr_r_proto" in
14526         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14527         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14528         esac
14529         case "$gethostbyaddr_r_proto" in
14530         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14531         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14532         esac
14533         case "$gethostbyaddr_r_proto" in
14534         ''|0)   d_gethostbyaddr_r=undef
14535                 gethostbyaddr_r_proto=0
14536                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14537         * )     case "$gethostbyaddr_r_proto" in
14538                 REENTRANT_PROTO*) ;;
14539                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14540                 esac
14541                 echo "Prototype: $try" ;;
14542         esac
14543         ;;
14544         *)      case "$usethreads" in
14545                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14546                 esac
14547                 d_gethostbyaddr_r=undef
14548                 gethostbyaddr_r_proto=0
14549                 ;;
14550         esac
14551         ;;
14552 *)      gethostbyaddr_r_proto=0
14553         ;;
14554 esac
14555
14556 : see if gethostbyname_r exists
14557 set gethostbyname_r d_gethostbyname_r
14558 eval $inlibc
14559 case "$d_gethostbyname_r" in
14560 "$define")
14561         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14562         case "$d_gethostbyname_r_proto:$usethreads" in
14563         ":define")      d_gethostbyname_r_proto=define
14564                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14565                 eval $hasproto ;;
14566         *)      ;;
14567         esac
14568         case "$d_gethostbyname_r_proto" in
14569         define)
14570         case "$gethostbyname_r_proto" in
14571         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14572         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14573         esac
14574         case "$gethostbyname_r_proto" in
14575         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14576         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14577         esac
14578         case "$gethostbyname_r_proto" in
14579         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14580         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14581         esac
14582         case "$gethostbyname_r_proto" in
14583         ''|0)   d_gethostbyname_r=undef
14584                 gethostbyname_r_proto=0
14585                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14586         * )     case "$gethostbyname_r_proto" in
14587                 REENTRANT_PROTO*) ;;
14588                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14589                 esac
14590                 echo "Prototype: $try" ;;
14591         esac
14592         ;;
14593         *)      case "$usethreads" in
14594                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14595                 esac
14596                 d_gethostbyname_r=undef
14597                 gethostbyname_r_proto=0
14598                 ;;
14599         esac
14600         ;;
14601 *)      gethostbyname_r_proto=0
14602         ;;
14603 esac
14604
14605 : see if gethostent_r exists
14606 set gethostent_r d_gethostent_r
14607 eval $inlibc
14608 case "$d_gethostent_r" in
14609 "$define")
14610         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14611         case "$d_gethostent_r_proto:$usethreads" in
14612         ":define")      d_gethostent_r_proto=define
14613                 set d_gethostent_r_proto gethostent_r $hdrs
14614                 eval $hasproto ;;
14615         *)      ;;
14616         esac
14617         case "$d_gethostent_r_proto" in
14618         define)
14619         case "$gethostent_r_proto" in
14620         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14621         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14622         esac
14623         case "$gethostent_r_proto" in
14624         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14625         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14626         esac
14627         case "$gethostent_r_proto" in
14628         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14629         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14630         esac
14631         case "$gethostent_r_proto" in
14632         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14633         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14634         esac
14635         case "$gethostent_r_proto" in
14636         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14637         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14638         esac
14639         case "$gethostent_r_proto" in
14640         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14641         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14642         esac
14643         case "$gethostent_r_proto" in
14644         ''|0)   d_gethostent_r=undef
14645                 gethostent_r_proto=0
14646                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14647         * )     case "$gethostent_r_proto" in
14648                 REENTRANT_PROTO*) ;;
14649                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14650                 esac
14651                 echo "Prototype: $try" ;;
14652         esac
14653         ;;
14654         *)      case "$usethreads" in
14655                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14656                 esac
14657                 d_gethostent_r=undef
14658                 gethostent_r_proto=0
14659                 ;;
14660         esac
14661         ;;
14662 *)      gethostent_r_proto=0
14663         ;;
14664 esac
14665
14666 : see if prototypes for various gethostxxx netdb.h functions are available
14667 echo " "
14668 set d_gethostprotos gethostent $i_netdb netdb.h
14669 eval $hasproto
14670
14671 : see if getitimer exists
14672 set getitimer d_getitimer
14673 eval $inlibc
14674
14675 : see if getlogin exists
14676 set getlogin d_getlogin
14677 eval $inlibc
14678
14679 : see if getlogin_r exists
14680 set getlogin_r d_getlogin_r
14681 eval $inlibc
14682 case "$d_getlogin_r" in
14683 "$define")
14684         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14685         case "$d_getlogin_r_proto:$usethreads" in
14686         ":define")      d_getlogin_r_proto=define
14687                 set d_getlogin_r_proto getlogin_r $hdrs
14688                 eval $hasproto ;;
14689         *)      ;;
14690         esac
14691         case "$d_getlogin_r_proto" in
14692         define)
14693         case "$getlogin_r_proto" in
14694         ''|0) try='int getlogin_r(char*, size_t);'
14695         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14696         esac
14697         case "$getlogin_r_proto" in
14698         ''|0) try='int getlogin_r(char*, int);'
14699         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14700         esac
14701         case "$getlogin_r_proto" in
14702         ''|0) try='char* getlogin_r(char*, size_t);'
14703         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14704         esac
14705         case "$getlogin_r_proto" in
14706         ''|0) try='char* getlogin_r(char*, int);'
14707         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14708         esac
14709         case "$getlogin_r_proto" in
14710         ''|0)   d_getlogin_r=undef
14711                 getlogin_r_proto=0
14712                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14713         * )     case "$getlogin_r_proto" in
14714                 REENTRANT_PROTO*) ;;
14715                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14716                 esac
14717                 echo "Prototype: $try" ;;
14718         esac
14719         ;;
14720         *)      case "$usethreads" in
14721                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14722                 esac
14723                 d_getlogin_r=undef
14724                 getlogin_r_proto=0
14725                 ;;
14726         esac
14727         ;;
14728 *)      getlogin_r_proto=0
14729         ;;
14730 esac
14731
14732 : see if getmnt exists
14733 set getmnt d_getmnt
14734 eval $inlibc
14735
14736 : see if getmntent exists
14737 set getmntent d_getmntent
14738 eval $inlibc
14739
14740 : see if getnameinfo exists
14741 set getnameinfo d_getnameinfo
14742 eval $inlibc
14743
14744 : see if getnetbyaddr exists
14745 set getnetbyaddr d_getnbyaddr
14746 eval $inlibc
14747
14748 : see if getnetbyname exists
14749 set getnetbyname d_getnbyname
14750 eval $inlibc
14751
14752 : see if getnetent exists
14753 set getnetent d_getnent
14754 eval $inlibc
14755
14756 : see if getnetbyaddr_r exists
14757 set getnetbyaddr_r d_getnetbyaddr_r
14758 eval $inlibc
14759 case "$d_getnetbyaddr_r" in
14760 "$define")
14761         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14762         case "$d_getnetbyaddr_r_proto:$usethreads" in
14763         ":define")      d_getnetbyaddr_r_proto=define
14764                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14765                 eval $hasproto ;;
14766         *)      ;;
14767         esac
14768         case "$d_getnetbyaddr_r_proto" in
14769         define)
14770         case "$getnetbyaddr_r_proto" in
14771         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14772         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14773         esac
14774         case "$getnetbyaddr_r_proto" in
14775         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14776         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14777         esac
14778         case "$getnetbyaddr_r_proto" in
14779         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14780         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14781         esac
14782         case "$getnetbyaddr_r_proto" in
14783         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14784         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14785         esac
14786         case "$getnetbyaddr_r_proto" in
14787         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14788         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14789         esac
14790         case "$getnetbyaddr_r_proto" in
14791         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14792         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14793         esac
14794         case "$getnetbyaddr_r_proto" in
14795         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14796         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14797         esac
14798         case "$getnetbyaddr_r_proto" in
14799         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14800         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14801         esac
14802         case "$getnetbyaddr_r_proto" in
14803         ''|0)   d_getnetbyaddr_r=undef
14804                 getnetbyaddr_r_proto=0
14805                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14806         * )     case "$getnetbyaddr_r_proto" in
14807                 REENTRANT_PROTO*) ;;
14808                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14809                 esac
14810                 echo "Prototype: $try" ;;
14811         esac
14812         ;;
14813         *)      case "$usethreads" in
14814                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14815                 esac
14816                 d_getnetbyaddr_r=undef
14817                 getnetbyaddr_r_proto=0
14818                 ;;
14819         esac
14820         ;;
14821 *)      getnetbyaddr_r_proto=0
14822         ;;
14823 esac
14824
14825 : see if getnetbyname_r exists
14826 set getnetbyname_r d_getnetbyname_r
14827 eval $inlibc
14828 case "$d_getnetbyname_r" in
14829 "$define")
14830         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14831         case "$d_getnetbyname_r_proto:$usethreads" in
14832         ":define")      d_getnetbyname_r_proto=define
14833                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14834                 eval $hasproto ;;
14835         *)      ;;
14836         esac
14837         case "$d_getnetbyname_r_proto" in
14838         define)
14839         case "$getnetbyname_r_proto" in
14840         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14841         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14842         esac
14843         case "$getnetbyname_r_proto" in
14844         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14845         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14846         esac
14847         case "$getnetbyname_r_proto" in
14848         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14849         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14850         esac
14851         case "$getnetbyname_r_proto" in
14852         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14853         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14854         esac
14855         case "$getnetbyname_r_proto" in
14856         ''|0)   d_getnetbyname_r=undef
14857                 getnetbyname_r_proto=0
14858                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14859         * )     case "$getnetbyname_r_proto" in
14860                 REENTRANT_PROTO*) ;;
14861                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14862                 esac
14863                 echo "Prototype: $try" ;;
14864         esac
14865         ;;
14866         *)      case "$usethreads" in
14867                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14868                 esac
14869                 d_getnetbyname_r=undef
14870                 getnetbyname_r_proto=0
14871                 ;;
14872         esac
14873         ;;
14874 *)      getnetbyname_r_proto=0
14875         ;;
14876 esac
14877
14878 : see if getnetent_r exists
14879 set getnetent_r d_getnetent_r
14880 eval $inlibc
14881 case "$d_getnetent_r" in
14882 "$define")
14883         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14884         case "$d_getnetent_r_proto:$usethreads" in
14885         ":define")      d_getnetent_r_proto=define
14886                 set d_getnetent_r_proto getnetent_r $hdrs
14887                 eval $hasproto ;;
14888         *)      ;;
14889         esac
14890         case "$d_getnetent_r_proto" in
14891         define)
14892         case "$getnetent_r_proto" in
14893         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14894         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14895         esac
14896         case "$getnetent_r_proto" in
14897         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14898         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14899         esac
14900         case "$getnetent_r_proto" in
14901         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14902         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14903         esac
14904         case "$getnetent_r_proto" in
14905         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14906         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14907         esac
14908         case "$getnetent_r_proto" in
14909         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14910         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14911         esac
14912         case "$getnetent_r_proto" in
14913         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14914         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14915         esac
14916         case "$getnetent_r_proto" in
14917         ''|0)   d_getnetent_r=undef
14918                 getnetent_r_proto=0
14919                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14920         * )     case "$getnetent_r_proto" in
14921                 REENTRANT_PROTO*) ;;
14922                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14923                 esac
14924                 echo "Prototype: $try" ;;
14925         esac
14926         ;;
14927         *)      case "$usethreads" in
14928                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14929                 esac
14930                 d_getnetent_r=undef
14931                 getnetent_r_proto=0
14932                 ;;
14933         esac
14934         ;;
14935 *)      getnetent_r_proto=0
14936         ;;
14937 esac
14938
14939 : see if prototypes for various getnetxxx netdb.h functions are available
14940 echo " "
14941 set d_getnetprotos getnetent $i_netdb netdb.h
14942 eval $hasproto
14943
14944 : see if getpagesize exists
14945 set getpagesize d_getpagsz
14946 eval $inlibc
14947
14948 : Optional checks for getprotobyname and getprotobynumber
14949
14950 : see if getprotobyname exists
14951 set getprotobyname d_getpbyname
14952 eval $inlibc
14953
14954 : see if getprotobynumber exists
14955 set getprotobynumber d_getpbynumber
14956 eval $inlibc
14957
14958 : see if getprotoent exists
14959 set getprotoent d_getpent
14960 eval $inlibc
14961
14962 : see if getpgid exists
14963 set getpgid d_getpgid
14964 eval $inlibc
14965
14966 : see if getpgrp2 exists
14967 set getpgrp2 d_getpgrp2
14968 eval $inlibc
14969
14970 : see if getppid exists
14971 set getppid d_getppid
14972 eval $inlibc
14973
14974 : see if getpriority exists
14975 set getpriority d_getprior
14976 eval $inlibc
14977
14978 : see if getprotobyname_r exists
14979 set getprotobyname_r d_getprotobyname_r
14980 eval $inlibc
14981 case "$d_getprotobyname_r" in
14982 "$define")
14983         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14984         case "$d_getprotobyname_r_proto:$usethreads" in
14985         ":define")      d_getprotobyname_r_proto=define
14986                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14987                 eval $hasproto ;;
14988         *)      ;;
14989         esac
14990         case "$d_getprotobyname_r_proto" in
14991         define)
14992         case "$getprotobyname_r_proto" in
14993         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14994         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14995         esac
14996         case "$getprotobyname_r_proto" in
14997         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14998         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14999         esac
15000         case "$getprotobyname_r_proto" in
15001         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15002         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15003         esac
15004         case "$getprotobyname_r_proto" in
15005         ''|0)   d_getprotobyname_r=undef
15006                 getprotobyname_r_proto=0
15007                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15008         * )     case "$getprotobyname_r_proto" in
15009                 REENTRANT_PROTO*) ;;
15010                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15011                 esac
15012                 echo "Prototype: $try" ;;
15013         esac
15014         ;;
15015         *)      case "$usethreads" in
15016                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15017                 esac
15018                 d_getprotobyname_r=undef
15019                 getprotobyname_r_proto=0
15020                 ;;
15021         esac
15022         ;;
15023 *)      getprotobyname_r_proto=0
15024         ;;
15025 esac
15026
15027 : see if getprotobynumber_r exists
15028 set getprotobynumber_r d_getprotobynumber_r
15029 eval $inlibc
15030 case "$d_getprotobynumber_r" in
15031 "$define")
15032         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15033         case "$d_getprotobynumber_r_proto:$usethreads" in
15034         ":define")      d_getprotobynumber_r_proto=define
15035                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15036                 eval $hasproto ;;
15037         *)      ;;
15038         esac
15039         case "$d_getprotobynumber_r_proto" in
15040         define)
15041         case "$getprotobynumber_r_proto" in
15042         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15043         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15044         esac
15045         case "$getprotobynumber_r_proto" in
15046         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15047         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15048         esac
15049         case "$getprotobynumber_r_proto" in
15050         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15051         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15052         esac
15053         case "$getprotobynumber_r_proto" in
15054         ''|0)   d_getprotobynumber_r=undef
15055                 getprotobynumber_r_proto=0
15056                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15057         * )     case "$getprotobynumber_r_proto" in
15058                 REENTRANT_PROTO*) ;;
15059                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15060                 esac
15061                 echo "Prototype: $try" ;;
15062         esac
15063         ;;
15064         *)      case "$usethreads" in
15065                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15066                 esac
15067                 d_getprotobynumber_r=undef
15068                 getprotobynumber_r_proto=0
15069                 ;;
15070         esac
15071         ;;
15072 *)      getprotobynumber_r_proto=0
15073         ;;
15074 esac
15075
15076 : see if getprotoent_r exists
15077 set getprotoent_r d_getprotoent_r
15078 eval $inlibc
15079 case "$d_getprotoent_r" in
15080 "$define")
15081         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15082         case "$d_getprotoent_r_proto:$usethreads" in
15083         ":define")      d_getprotoent_r_proto=define
15084                 set d_getprotoent_r_proto getprotoent_r $hdrs
15085                 eval $hasproto ;;
15086         *)      ;;
15087         esac
15088         case "$d_getprotoent_r_proto" in
15089         define)
15090         case "$getprotoent_r_proto" in
15091         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15092         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15093         esac
15094         case "$getprotoent_r_proto" in
15095         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15096         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15097         esac
15098         case "$getprotoent_r_proto" in
15099         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15100         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15101         esac
15102         case "$getprotoent_r_proto" in
15103         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15104         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15105         esac
15106         case "$getprotoent_r_proto" in
15107         ''|0)   d_getprotoent_r=undef
15108                 getprotoent_r_proto=0
15109                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15110         * )     case "$getprotoent_r_proto" in
15111                 REENTRANT_PROTO*) ;;
15112                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15113                 esac
15114                 echo "Prototype: $try" ;;
15115         esac
15116         ;;
15117         *)      case "$usethreads" in
15118                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15119                 esac
15120                 d_getprotoent_r=undef
15121                 getprotoent_r_proto=0
15122                 ;;
15123         esac
15124         ;;
15125 *)      getprotoent_r_proto=0
15126         ;;
15127 esac
15128
15129 : see if prototypes for various getprotoxxx netdb.h functions are available
15130 echo " "
15131 set d_getprotoprotos getprotoent $i_netdb netdb.h
15132 eval $hasproto
15133
15134 : see if getprpwnam exists
15135 set getprpwnam d_getprpwnam
15136 eval $inlibc
15137
15138 : see if getpwent exists
15139 set getpwent d_getpwent
15140 eval $inlibc
15141
15142 : see if getpwent_r exists
15143 set getpwent_r d_getpwent_r
15144 eval $inlibc
15145 case "$d_getpwent_r" in
15146 "$define")
15147         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15148         case "$d_getpwent_r_proto:$usethreads" in
15149         ":define")      d_getpwent_r_proto=define
15150                 set d_getpwent_r_proto getpwent_r $hdrs
15151                 eval $hasproto ;;
15152         *)      ;;
15153         esac
15154         case "$d_getpwent_r_proto" in
15155         define)
15156         case "$getpwent_r_proto" in
15157         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15158         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15159         esac
15160         case "$getpwent_r_proto" in
15161         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15162         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15163         esac
15164         case "$getpwent_r_proto" in
15165         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15166         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15167         esac
15168         case "$getpwent_r_proto" in
15169         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15170         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15171         esac
15172         case "$getpwent_r_proto" in
15173         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15174         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15175         esac
15176         case "$getpwent_r_proto" in
15177         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15178         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15179         esac
15180         case "$getpwent_r_proto" in
15181         ''|0)   d_getpwent_r=undef
15182                 getpwent_r_proto=0
15183                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15184         * )     case "$getpwent_r_proto" in
15185                 REENTRANT_PROTO*) ;;
15186                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15187                 esac
15188                 echo "Prototype: $try" ;;
15189         esac
15190         ;;
15191         *)      case "$usethreads" in
15192                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15193                 esac
15194                 d_getpwent_r=undef
15195                 getpwent_r_proto=0
15196                 ;;
15197         esac
15198         ;;
15199 *)      getpwent_r_proto=0
15200         ;;
15201 esac
15202
15203 : see if getpwnam_r exists
15204 set getpwnam_r d_getpwnam_r
15205 eval $inlibc
15206 case "$d_getpwnam_r" in
15207 "$define")
15208         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15209         case "$d_getpwnam_r_proto:$usethreads" in
15210         ":define")      d_getpwnam_r_proto=define
15211                 set d_getpwnam_r_proto getpwnam_r $hdrs
15212                 eval $hasproto ;;
15213         *)      ;;
15214         esac
15215         case "$d_getpwnam_r_proto" in
15216         define)
15217         case "$getpwnam_r_proto" in
15218         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15219         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15220         esac
15221         case "$getpwnam_r_proto" in
15222         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15223         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15224         esac
15225         case "$getpwnam_r_proto" in
15226         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15227         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15228         esac
15229         case "$getpwnam_r_proto" in
15230         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15231         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15232         esac
15233         case "$getpwnam_r_proto" in
15234         ''|0)   d_getpwnam_r=undef
15235                 getpwnam_r_proto=0
15236                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15237         * )     case "$getpwnam_r_proto" in
15238                 REENTRANT_PROTO*) ;;
15239                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15240                 esac
15241                 echo "Prototype: $try" ;;
15242         esac
15243         ;;
15244         *)      case "$usethreads" in
15245                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15246                 esac
15247                 d_getpwnam_r=undef
15248                 getpwnam_r_proto=0
15249                 ;;
15250         esac
15251         ;;
15252 *)      getpwnam_r_proto=0
15253         ;;
15254 esac
15255
15256 : see if getpwuid_r exists
15257 set getpwuid_r d_getpwuid_r
15258 eval $inlibc
15259 case "$d_getpwuid_r" in
15260 "$define")
15261         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15262         case "$d_getpwuid_r_proto:$usethreads" in
15263         ":define")      d_getpwuid_r_proto=define
15264                 set d_getpwuid_r_proto getpwuid_r $hdrs
15265                 eval $hasproto ;;
15266         *)      ;;
15267         esac
15268         case "$d_getpwuid_r_proto" in
15269         define)
15270         case "$getpwuid_r_proto" in
15271         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15272         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15273         esac
15274         case "$getpwuid_r_proto" in
15275         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15276         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15277         esac
15278         case "$getpwuid_r_proto" in
15279         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15280         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15281         esac
15282         case "$getpwuid_r_proto" in
15283         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15284         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15285         esac
15286         case "$getpwuid_r_proto" in
15287         ''|0)   d_getpwuid_r=undef
15288                 getpwuid_r_proto=0
15289                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15290         * )     case "$getpwuid_r_proto" in
15291                 REENTRANT_PROTO*) ;;
15292                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15293                 esac
15294                 echo "Prototype: $try" ;;
15295         esac
15296         ;;
15297         *)      case "$usethreads" in
15298                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15299                 esac
15300                 d_getpwuid_r=undef
15301                 getpwuid_r_proto=0
15302                 ;;
15303         esac
15304         ;;
15305 *)      getpwuid_r_proto=0
15306         ;;
15307 esac
15308
15309 : Optional checks for getsbyname and getsbyport
15310
15311 : see if getservbyname exists
15312 set getservbyname d_getsbyname
15313 eval $inlibc
15314
15315 : see if getservbyport exists
15316 set getservbyport d_getsbyport
15317 eval $inlibc
15318
15319 : see if getservent exists
15320 set getservent d_getsent
15321 eval $inlibc
15322
15323 : see if getservbyname_r exists
15324 set getservbyname_r d_getservbyname_r
15325 eval $inlibc
15326 case "$d_getservbyname_r" in
15327 "$define")
15328         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15329         case "$d_getservbyname_r_proto:$usethreads" in
15330         ":define")      d_getservbyname_r_proto=define
15331                 set d_getservbyname_r_proto getservbyname_r $hdrs
15332                 eval $hasproto ;;
15333         *)      ;;
15334         esac
15335         case "$d_getservbyname_r_proto" in
15336         define)
15337         case "$getservbyname_r_proto" in
15338         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15339         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15340         esac
15341         case "$getservbyname_r_proto" in
15342         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15343         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15344         esac
15345         case "$getservbyname_r_proto" in
15346         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15347         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15348         esac
15349         case "$getservbyname_r_proto" in
15350         ''|0)   d_getservbyname_r=undef
15351                 getservbyname_r_proto=0
15352                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15353         * )     case "$getservbyname_r_proto" in
15354                 REENTRANT_PROTO*) ;;
15355                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15356                 esac
15357                 echo "Prototype: $try" ;;
15358         esac
15359         ;;
15360         *)      case "$usethreads" in
15361                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15362                 esac
15363                 d_getservbyname_r=undef
15364                 getservbyname_r_proto=0
15365                 ;;
15366         esac
15367         ;;
15368 *)      getservbyname_r_proto=0
15369         ;;
15370 esac
15371
15372 : see if getservbyport_r exists
15373 set getservbyport_r d_getservbyport_r
15374 eval $inlibc
15375 case "$d_getservbyport_r" in
15376 "$define")
15377         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15378         case "$d_getservbyport_r_proto:$usethreads" in
15379         ":define")      d_getservbyport_r_proto=define
15380                 set d_getservbyport_r_proto getservbyport_r $hdrs
15381                 eval $hasproto ;;
15382         *)      ;;
15383         esac
15384         case "$d_getservbyport_r_proto" in
15385         define)
15386         case "$getservbyport_r_proto" in
15387         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15388         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15389         esac
15390         case "$getservbyport_r_proto" in
15391         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15392         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15393         esac
15394         case "$getservbyport_r_proto" in
15395         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15396         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15397         esac
15398         case "$getservbyport_r_proto" in
15399         ''|0)   d_getservbyport_r=undef
15400                 getservbyport_r_proto=0
15401                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15402         * )     case "$getservbyport_r_proto" in
15403                 REENTRANT_PROTO*) ;;
15404                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15405                 esac
15406                 echo "Prototype: $try" ;;
15407         esac
15408         ;;
15409         *)      case "$usethreads" in
15410                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15411                 esac
15412                 d_getservbyport_r=undef
15413                 getservbyport_r_proto=0
15414                 ;;
15415         esac
15416         ;;
15417 *)      getservbyport_r_proto=0
15418         ;;
15419 esac
15420
15421 : see if getservent_r exists
15422 set getservent_r d_getservent_r
15423 eval $inlibc
15424 case "$d_getservent_r" in
15425 "$define")
15426         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15427         case "$d_getservent_r_proto:$usethreads" in
15428         ":define")      d_getservent_r_proto=define
15429                 set d_getservent_r_proto getservent_r $hdrs
15430                 eval $hasproto ;;
15431         *)      ;;
15432         esac
15433         case "$d_getservent_r_proto" in
15434         define)
15435         case "$getservent_r_proto" in
15436         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15437         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15438         esac
15439         case "$getservent_r_proto" in
15440         ''|0) try='int getservent_r(struct servent*, char*, int);'
15441         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15442         esac
15443         case "$getservent_r_proto" in
15444         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15445         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15446         esac
15447         case "$getservent_r_proto" in
15448         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15449         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15450         esac
15451         case "$getservent_r_proto" in
15452         ''|0)   d_getservent_r=undef
15453                 getservent_r_proto=0
15454                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15455         * )     case "$getservent_r_proto" in
15456                 REENTRANT_PROTO*) ;;
15457                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15458                 esac
15459                 echo "Prototype: $try" ;;
15460         esac
15461         ;;
15462         *)      case "$usethreads" in
15463                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15464                 esac
15465                 d_getservent_r=undef
15466                 getservent_r_proto=0
15467                 ;;
15468         esac
15469         ;;
15470 *)      getservent_r_proto=0
15471         ;;
15472 esac
15473
15474 : see if prototypes for various getservxxx netdb.h functions are available
15475 echo " "
15476 set d_getservprotos getservent $i_netdb netdb.h
15477 eval $hasproto
15478
15479 : see if getspnam exists
15480 set getspnam d_getspnam
15481 eval $inlibc
15482
15483 : see if this is a shadow.h system
15484 set shadow.h i_shadow
15485 eval $inhdr
15486
15487 : see if getspnam_r exists
15488 set getspnam_r d_getspnam_r
15489 eval $inlibc
15490 case "$d_getspnam_r" in
15491 "$define")
15492         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15493         case "$d_getspnam_r_proto:$usethreads" in
15494         ":define")      d_getspnam_r_proto=define
15495                 set d_getspnam_r_proto getspnam_r $hdrs
15496                 eval $hasproto ;;
15497         *)      ;;
15498         esac
15499         case "$d_getspnam_r_proto" in
15500         define)
15501         case "$getspnam_r_proto" in
15502         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15503         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15504         esac
15505         case "$getspnam_r_proto" in
15506         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15507         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15508         esac
15509         case "$getspnam_r_proto" in
15510         ''|0)   d_getspnam_r=undef
15511                 getspnam_r_proto=0
15512                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15513         * )     case "$getspnam_r_proto" in
15514                 REENTRANT_PROTO*) ;;
15515                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15516                 esac
15517                 echo "Prototype: $try" ;;
15518         esac
15519         ;;
15520         *)      case "$usethreads" in
15521                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15522                 esac
15523                 d_getspnam_r=undef
15524                 getspnam_r_proto=0
15525                 ;;
15526         esac
15527         ;;
15528 *)      getspnam_r_proto=0
15529         ;;
15530 esac
15531
15532 : see if gettimeofday or ftime exists
15533 set gettimeofday d_gettimeod
15534 eval $inlibc
15535 case "$d_gettimeod" in
15536 "$undef")
15537         set ftime d_ftime 
15538         eval $inlibc
15539         ;;
15540 *)
15541         val="$undef"; set d_ftime; eval $setvar
15542         ;;
15543 esac
15544 case "$d_gettimeod$d_ftime" in
15545 "$undef$undef")
15546         echo " "
15547         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15548         ;;
15549 esac
15550
15551 : see if gmtime_r exists
15552 set gmtime_r d_gmtime_r
15553 eval $inlibc
15554 case "$d_gmtime_r" in
15555 "$define")
15556         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15557         case "$d_gmtime_r_proto:$usethreads" in
15558         ":define")      d_gmtime_r_proto=define
15559                 set d_gmtime_r_proto gmtime_r $hdrs
15560                 eval $hasproto ;;
15561         *)      ;;
15562         esac
15563         case "$d_gmtime_r_proto" in
15564         define)
15565         case "$gmtime_r_proto" in
15566         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15567         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15568         esac
15569         case "$gmtime_r_proto" in
15570         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15571         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15572         esac
15573         case "$gmtime_r_proto" in
15574         ''|0)   d_gmtime_r=undef
15575                 gmtime_r_proto=0
15576                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15577         * )     case "$gmtime_r_proto" in
15578                 REENTRANT_PROTO*) ;;
15579                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15580                 esac
15581                 echo "Prototype: $try" ;;
15582         esac
15583         ;;
15584         *)      case "$usethreads" in
15585                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15586                 esac
15587                 d_gmtime_r=undef
15588                 gmtime_r_proto=0
15589                 ;;
15590         esac
15591         ;;
15592 *)      gmtime_r_proto=0
15593         ;;
15594 esac
15595
15596 : see if hasmntopt exists
15597 set hasmntopt d_hasmntopt
15598 eval $inlibc
15599
15600 : see if this is a netinet/in.h or sys/in.h system
15601 set netinet/in.h i_niin sys/in.h i_sysin
15602 eval $inhdr
15603
15604 : see if arpa/inet.h has to be included
15605 set arpa/inet.h i_arpainet
15606 eval $inhdr
15607
15608 : see if htonl --and friends-- exists
15609 val=''
15610 set htonl val
15611 eval $inlibc
15612
15613 : Maybe they are macros.
15614 case "$val" in
15615 $undef)
15616         $cat >htonl.c <<EOM
15617 #include <stdio.h>
15618 #include <sys/types.h>
15619 #$i_niin I_NETINET_IN
15620 #$i_sysin I_SYS_IN
15621 #$i_arpainet I_ARPA_INET
15622 #ifdef I_NETINET_IN
15623 #include <netinet/in.h>
15624 #endif
15625 #ifdef I_SYS_IN
15626 #include <sys/in.h>
15627 #endif
15628 #ifdef I_ARPA_INET
15629 #include <arpa/inet.h>
15630 #endif
15631 #ifdef htonl
15632 printf("Defined as a macro.");
15633 #endif
15634 EOM
15635         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15636         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15637                 val="$define"
15638                 echo "But it seems to be defined as a macro." >&4
15639         fi
15640         $rm -f htonl.?
15641         ;;
15642 esac
15643 set d_htonl
15644 eval $setvar
15645
15646 : see if hypot exists
15647 set hypot d_hypot
15648 eval $inlibc
15649
15650 : see if ilogb exists
15651 set ilogb d_ilogb
15652 eval $inlibc
15653
15654 : see if ilogbl exists
15655 set ilogbl d_ilogbl
15656 eval $inlibc
15657
15658 : check whether inet_aton exists
15659 set inet_aton d_inetaton
15660 eval $inlibc
15661
15662 : see if inet_ntop exists
15663 set inet_ntop d_inetntop
15664 eval $inlibc
15665
15666 : see if inet_pton exists
15667 set inet_pton d_inetpton
15668 eval $inlibc
15669
15670 : Look for isascii
15671 echo " "
15672 $cat >isascii.c <<EOCP
15673 #include <stdio.h>
15674 #include <ctype.h>
15675 #$i_stdlib I_STDLIB
15676 #ifdef I_STDLIB
15677 #include <stdlib.h>
15678 #endif
15679 int main() {
15680         int c = 'A';
15681         if (isascii(c))
15682                 exit(0);
15683         else
15684                 exit(1);
15685 }
15686 EOCP
15687 set isascii
15688 if eval $compile; then
15689         echo "isascii() found." >&4
15690         val="$define"
15691 else
15692         echo "isascii() NOT found." >&4
15693         val="$undef"
15694 fi
15695 set d_isascii
15696 eval $setvar
15697 $rm -f isascii*
15698
15699 : Look for isblank
15700 echo " "
15701 $cat >isblank.c <<'EOCP'
15702 #include <stdio.h>
15703 #include <ctype.h>
15704 int main() {
15705         int c = ' ';
15706         if (isblank(c))
15707                 return 0 ;
15708         else
15709                 return 1 ;
15710 }
15711 EOCP
15712 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15713         echo "isblank() found." >&4
15714         val="$define"
15715 else
15716         echo "isblank() NOT found." >&4
15717         val="$undef"
15718 fi
15719 set d_isblank
15720 eval $setvar
15721 $rm -f isblank*
15722
15723 : check for isfinite
15724 echo "Checking to see if you have isfinite..." >&4
15725 $cat >try.c <<EOCP
15726 #include <math.h>
15727 int main() { return isfinite(0.0); }
15728 EOCP
15729 set try
15730 if eval $compile; then
15731         val="$define"
15732         echo "You have isfinite."
15733 else
15734         val="$undef"
15735         echo "You do not have isfinite."
15736 fi
15737 $rm_try
15738 set d_isfinite
15739 eval $setvar
15740
15741 : see if isfinitel exists
15742 set isfinitel d_isfinitel
15743 eval $inlibc
15744
15745 : check for isinf
15746 echo "Checking to see if you have isinf..." >&4
15747 $cat >try.c <<EOCP
15748 #include <math.h>
15749 int main() { return isinf(0.0); }
15750 EOCP
15751 set try
15752 if eval $compile; then
15753         val="$define"
15754         echo "You have isinf."
15755 else
15756         val="$undef"
15757         echo "You do not have isinf."
15758 fi
15759 $rm_try
15760 set d_isinf
15761 eval $setvar
15762
15763 : see if isinfl exists
15764 set isinfl d_isinfl
15765 eval $inlibc
15766
15767 : check for isless
15768 echo "Checking to see if you have isless..." >&4
15769 $cat >try.c <<EOCP
15770 #include <math.h>
15771 int main() { return isless(0.0); }
15772 EOCP
15773 set try
15774 if eval $compile; then
15775         val="$define"
15776         echo "You have isless."
15777 else
15778         val="$undef"
15779         echo "You do not have isless."
15780 fi
15781 $rm_try
15782 set d_isless
15783 eval $setvar
15784
15785 : check for isnan
15786 echo "Checking to see if you have isnan..." >&4
15787 $cat >try.c <<EOCP
15788 #include <math.h>
15789 int main() { return isnan(0.0); }
15790 EOCP
15791 set try
15792 if eval $compile; then
15793         val="$define"
15794         echo "You have isnan."
15795 else
15796         val="$undef"
15797         echo "You do not have isnan."
15798 fi
15799 $rm_try
15800 set d_isnan
15801 eval $setvar
15802
15803 : see if isnanl exists
15804 set isnanl d_isnanl
15805 eval $inlibc
15806
15807 : check for isnormal
15808 echo "Checking to see if you have isnormal..." >&4
15809 $cat >try.c <<EOCP
15810 #include <math.h>
15811 int main() { return isnormal(0.0); }
15812 EOCP
15813 set try
15814 if eval $compile; then
15815         val="$define"
15816         echo "You have isnormal."
15817 else
15818         val="$undef"
15819         echo "You do not have isnormal."
15820 fi
15821 $rm_try
15822 set d_isnormal
15823 eval $setvar
15824
15825 : see if j0 exists
15826 set j0 d_j0
15827 eval $inlibc
15828
15829 : see if j0l exists
15830 set j0l d_j0l
15831 eval $inlibc
15832
15833 : see if killpg exists
15834 set killpg d_killpg
15835 eval $inlibc
15836
15837 : see if localeconv exists
15838 set localeconv d_locconv
15839 eval $inlibc
15840
15841 : see if libc has the POSIX.1-2008 currency locale rules
15842 case "$d_locconv:$d_lc_monetary_2008" in
15843 $define:)
15844         $cat >try.c <<EOCP
15845 #include <locale.h>
15846 int main() {
15847         struct lconv *lc = localeconv();
15848         char int_p_cs_precedes = lc->int_p_cs_precedes;
15849         return 0;
15850 }
15851 EOCP
15852         set try
15853         if eval $compile; then
15854                 d_lc_monetary_2008="$define"
15855         else
15856                 d_lc_monetary_2008="$undef"
15857         fi;
15858         $rm_try
15859         ;;
15860 esac
15861
15862 : see if lchown exists
15863 echo " "
15864 $cat > try.c <<'EOCP'
15865 /* System header to define __stub macros and hopefully few prototypes,
15866     which can conflict with char lchown(); below.  */
15867 #include <assert.h>
15868 /* Override any gcc2 internal prototype to avoid an error.  */
15869 /* We use char because int might match the return type of a gcc2
15870    builtin and then its argument prototype would still apply.  */
15871 char lchown();
15872 int main() {
15873     /*  The GNU C library defines this for functions which it implements
15874         to always fail with ENOSYS.  Some functions are actually named
15875         something starting with __ and the normal name is an alias.  */
15876 #if defined (__stub_lchown) || defined (__stub___lchown)
15877 choke me
15878 #else
15879 lchown();
15880 #endif
15881 ; return 0; }
15882 EOCP
15883 set try
15884 if eval $compile; then
15885     $echo "lchown() found." >&4
15886     val="$define"
15887 else
15888     $echo "lchown() NOT found." >&4
15889     val="$undef"
15890 fi
15891 set d_lchown
15892 eval $setvar
15893
15894 : See if number of significant digits in a double precision number is known
15895 echo " "
15896 $cat >ldbl_dig.c <<EOM
15897 #include <limits.h>
15898 #include <float.h>
15899 #ifdef LDBL_DIG
15900 printf("Contains LDBL_DIG");
15901 #endif
15902 EOM
15903 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15904 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15905         echo "LDBL_DIG found." >&4
15906         val="$define"
15907 else
15908         echo "LDBL_DIG NOT found." >&4
15909         val="$undef"
15910 fi
15911 $rm -f ldbl_dig.?
15912 set d_ldbl_dig
15913 eval $setvar
15914
15915 : see if lgamma exists
15916 set lgamma d_lgamma
15917 eval $inlibc
15918
15919 : see if lgamma_r exists
15920 set lgamma_r d_lgamma_r
15921 eval $inlibc
15922
15923 : check to see if math.h defines _LIB_VERSION
15924 d_libm_lib_version="$undef"
15925 echo " "
15926 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15927 $cat >try.c <<EOCP
15928 #include <unistd.h>
15929 #include <math.h>
15930 int main (int argc, char *argv[])
15931 {
15932     printf ("%d\n", _LIB_VERSION);
15933     return (0);
15934     } /* main */
15935 EOCP
15936 set try
15937 if eval $compile; then
15938     foo=`$run ./try`
15939     echo "Yes, it does ($foo)" >&4
15940     d_libm_lib_version="$define"
15941 else
15942     echo "No, it does not (probably harmless)" >&4
15943     fi
15944 $rm_try
15945
15946 : see if link exists
15947 set link d_link
15948 eval $inlibc
15949
15950 : see if llrint exists
15951 set llrint d_llrint
15952 eval $inlibc
15953
15954 : see if llrintl exists
15955 set llrintl d_llrintl
15956 eval $inlibc
15957
15958 : see if llround exists
15959 set llround d_llround
15960 eval $inlibc
15961
15962 : see if llroundl exists
15963 set llroundl d_llroundl
15964 eval $inlibc
15965
15966 : see if localeconv_l exists
15967 set localeconv_l d_localeconv_l
15968 eval $inlibc
15969
15970 : see if localtime_r exists
15971 set localtime_r d_localtime_r
15972 eval $inlibc
15973 case "$d_localtime_r" in
15974 "$define")
15975         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15976         case "$d_localtime_r_proto:$usethreads" in
15977         ":define")      d_localtime_r_proto=define
15978                 set d_localtime_r_proto localtime_r $hdrs
15979                 eval $hasproto ;;
15980         *)      ;;
15981         esac
15982         case "$d_localtime_r_proto" in
15983         define)
15984         case "$localtime_r_proto" in
15985         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15986         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15987         esac
15988         case "$localtime_r_proto" in
15989         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15990         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15991         esac
15992         case "$localtime_r_proto" in
15993         ''|0)   d_localtime_r=undef
15994                 localtime_r_proto=0
15995                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15996         * )     case "$localtime_r_proto" in
15997                 REENTRANT_PROTO*) ;;
15998                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15999                 esac
16000                 echo "Prototype: $try" ;;
16001         esac
16002         ;;
16003         *)      case "$usethreads" in
16004                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16005                 esac
16006                 d_localtime_r=undef
16007                 localtime_r_proto=0
16008                 ;;
16009         esac
16010         ;;
16011 *)      localtime_r_proto=0
16012         ;;
16013 esac
16014
16015 : see if localtime_r calls tzset
16016 case "$localtime_r_proto" in
16017 REENTRANT_PROTO*)
16018         $cat >try.c <<EOCP
16019 /*  Does our libc's localtime_r call tzset ?
16020  *  return 0 if so, 1 otherwise.
16021  */
16022 #$i_systypes    I_SYS_TYPES
16023 #$i_unistd      I_UNISTD
16024 #$i_time        I_TIME
16025 #$i_stdlib      I_STDLIB
16026 #$i_malloc      I_MALLOC
16027 #ifdef I_SYS_TYPES
16028 #  include <sys/types.h>
16029 #endif
16030 #ifdef I_UNISTD
16031 #  include <unistd.h>
16032 #endif
16033 #ifdef I_TIME
16034 #  include <time.h>
16035 #endif
16036 #ifdef I_STDLIB
16037 #include <stdlib.h>
16038 #endif
16039 #include <string.h>
16040 #ifdef I_MALLOC
16041 #  include <malloc.h>
16042 #endif
16043 int main()
16044 {
16045     time_t t = time(0L);
16046     char w_tz[]="TZ" "=GMT+5",
16047          e_tz[]="TZ" "=GMT-5",
16048         *tz_e = (char*)malloc(16),
16049         *tz_w = (char*)malloc(16);
16050     struct tm tm_e, tm_w;
16051     memset(&tm_e,'\0',sizeof(struct tm));
16052     memset(&tm_w,'\0',sizeof(struct tm));
16053     strcpy(tz_e,e_tz);
16054     strcpy(tz_w,w_tz);
16055
16056     putenv(tz_e);
16057     localtime_r(&t, &tm_e);
16058
16059     putenv(tz_w);
16060     localtime_r(&t, &tm_w);
16061
16062     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16063         return 1;
16064     return 0;
16065 }
16066 EOCP
16067         set try
16068         if eval $compile; then
16069             if $run ./try; then
16070                 d_localtime_r_needs_tzset=undef;
16071             else
16072                 d_localtime_r_needs_tzset=define;
16073             fi;
16074         else
16075             d_localtime_r_needs_tzset=undef;
16076         fi;
16077      ;;
16078   *)
16079      d_localtime_r_needs_tzset=undef;
16080      ;;
16081 esac
16082 $rm_try
16083
16084 : see if lockf exists
16085 set lockf d_lockf
16086 eval $inlibc
16087
16088 : see if log1p exists
16089 set log1p d_log1p
16090 eval $inlibc
16091
16092 : see if log2 exists
16093 set log2 d_log2
16094 eval $inlibc
16095
16096 : see if logb exists
16097 set logb d_logb
16098 eval $inlibc
16099
16100 : see if lrint exists
16101 set lrint d_lrint
16102 eval $inlibc
16103
16104 : see if lrintl exists
16105 set lrintl d_lrintl
16106 eval $inlibc
16107
16108 : see if lround exists
16109 set lround d_lround
16110 eval $inlibc
16111
16112 : see if lroundl exists
16113 set lroundl d_lroundl
16114 eval $inlibc
16115
16116 : see if prototype for lseek is available
16117 echo " "
16118 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16119 eval $hasproto
16120
16121 : see if lstat exists
16122 set lstat d_lstat
16123 eval $inlibc
16124
16125 : see if madvise exists
16126 set madvise d_madvise
16127 eval $inlibc
16128
16129 : see if malloc_size exists
16130 set malloc_size d_malloc_size
16131 eval $inlibc
16132
16133 : see if malloc_size_good exists
16134 set malloc_good_size d_malloc_good_size
16135 eval $inlibc
16136
16137 : see if mblen exists
16138 set mblen d_mblen
16139 eval $inlibc
16140
16141 : see if mbrlen exists
16142 set mbrlen d_mbrlen
16143 eval $inlibc
16144
16145 : see if mbrtowc exists
16146 set mbrtowc d_mbrtowc
16147 eval $inlibc
16148
16149 : see if mbstowcs exists
16150 set mbstowcs d_mbstowcs
16151 eval $inlibc
16152
16153 : see if mbtowc exists
16154 set mbtowc d_mbtowc
16155 eval $inlibc
16156
16157 : see if memmem exists
16158 set memmem d_memmem
16159 eval $inlibc
16160
16161 : see if memrchr exists
16162 set memrchr d_memrchr
16163 eval $inlibc
16164
16165 : see if mkdir exists
16166 set mkdir d_mkdir
16167 eval $inlibc
16168
16169 : see if mkdtemp exists
16170 set mkdtemp d_mkdtemp
16171 eval $inlibc
16172
16173 : see if mkfifo exists
16174 set mkfifo d_mkfifo
16175 eval $inlibc
16176
16177 : see if mkstemp exists
16178 set mkstemp d_mkstemp
16179 eval $inlibc
16180
16181 : see if mkstemps exists
16182 set mkstemps d_mkstemps
16183 eval $inlibc
16184
16185 : see if mktime exists
16186 set mktime d_mktime
16187 eval $inlibc
16188
16189 : see if this is a sys/mman.h system
16190 set sys/mman.h i_sysmman
16191 eval $inhdr
16192
16193 : see if mmap exists
16194 set mmap d_mmap
16195 eval $inlibc
16196 : see what shmat returns
16197 : default to something harmless
16198 mmaptype='void *'
16199 case "$i_sysmman$d_mmap" in
16200 "$define$define")
16201         $cat >mmap.c <<'END'
16202 #include <sys/mman.h>
16203 void *mmap();
16204 END
16205         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16206                 mmaptype='void *'
16207         else
16208                 mmaptype='caddr_t'
16209         fi
16210         echo "and it returns ($mmaptype)." >&4
16211         ;;
16212 esac
16213
16214
16215
16216 : see if sqrtl exists
16217 set sqrtl d_sqrtl
16218 eval $inlibc
16219
16220 : see if scalbnl exists
16221 set scalbnl d_scalbnl
16222 eval $inlibc
16223
16224 : see if truncl exists
16225 set truncl d_truncl
16226 eval $inlibc
16227
16228 : see if modfl exists
16229 set modfl d_modfl
16230 eval $inlibc
16231
16232 : see if prototype for modfl is available
16233 echo " "
16234 set d_modflproto modfl define math.h
16235 eval $hasproto
16236
16237 if $test "$uselongdouble" = "$define"; then
16238     message=""
16239     if $test "$d_sqrtl" != "$define"; then
16240         message="$message sqrtl"
16241     fi
16242     if $test "$d_modfl" != "$define"; then
16243         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16244             echo "You have both truncl and copysignl, so I can emulate modfl."
16245         else
16246             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16247                 echo "You have both aintl and copysignl, so I can emulate modfl."
16248             else
16249                 message="$message modfl"
16250             fi
16251         fi
16252     fi
16253     if $test "$d_frexpl" != "$define"; then
16254         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16255             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16256         else
16257             message="$message frexpl"
16258         fi
16259     fi
16260     if $test "$d_ldexpl" != "$define"; then
16261         message="$message ldexpl"
16262     fi
16263
16264     if $test "$message" != ""; then
16265         $cat <<EOM >&4
16266
16267 *** You requested the use of long doubles but you do not seem to have
16268 *** the following mathematical functions needed for long double support:
16269 ***    $message
16270 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16271 *** Cannot continue, aborting.
16272
16273 EOM
16274
16275         exit 1
16276     fi
16277 fi
16278
16279 : see if mprotect exists
16280 set mprotect d_mprotect
16281 eval $inlibc
16282
16283 : see if msgctl exists
16284 set msgctl d_msgctl
16285 eval $inlibc
16286
16287 : see if msgget exists
16288 set msgget d_msgget
16289 eval $inlibc
16290
16291 : see if msgsnd exists
16292 set msgsnd d_msgsnd
16293 eval $inlibc
16294
16295 : see if msgrcv exists
16296 set msgrcv d_msgrcv
16297 eval $inlibc
16298
16299 : see how much of the 'msg*(2)' library is present.
16300 h_msg=true
16301 echo " "
16302 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16303 *"$undef"*) h_msg=false;;
16304 esac
16305 case "$osname" in
16306 freebsd)
16307     case "`ipcs 2>&1`" in
16308     "SVID messages"*"not configured"*)
16309         echo "Your $osname does not have the msg*(2) configured." >&4
16310         h_msg=false
16311         val="$undef"
16312         set msgctl d_msgctl
16313         eval $setvar
16314         set msgget d_msgget
16315         eval $setvar
16316         set msgsnd d_msgsnd
16317         eval $setvar
16318         set msgrcv d_msgrcv
16319         eval $setvar
16320         ;;
16321     esac
16322     ;;
16323 esac
16324 : we could also check for sys/ipc.h ...
16325 if $h_msg && $test `./findhdr sys/msg.h`; then
16326         echo "You have the full msg*(2) library." >&4
16327         val="$define"
16328 else
16329         echo "You don't have the full msg*(2) library." >&4
16330         val="$undef"
16331 fi
16332 set d_msg
16333 eval $setvar
16334
16335 : Check for msghdr_s
16336 echo " "
16337 echo "Checking to see if your system supports struct msghdr..." >&4
16338 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16339 eval $hasstruct
16340 case "$d_msghdr_s" in
16341 "$define")      echo "Yes, it does."   ;;
16342 *)              echo "No, it doesn't." ;;
16343 esac
16344
16345
16346 : see if msync exists
16347 set msync d_msync
16348 eval $inlibc
16349
16350 : see if munmap exists
16351 set munmap d_munmap
16352 eval $inlibc
16353
16354 : see if nan exists
16355 set nan d_nan
16356 eval $inlibc
16357
16358 : see if nanosleep exists
16359 set nanosleep d_nanosleep
16360 eval $inlibc
16361
16362 : see if nearbyint exists
16363 set nearbyint d_nearbyint
16364 eval $inlibc
16365
16366 : see if nextafter exists
16367 set nextafter d_nextafter
16368 eval $inlibc
16369
16370 : see if nexttoward exists
16371 set nexttoward d_nexttoward
16372 eval $inlibc
16373
16374 : see if nice exists
16375 set nice d_nice
16376 eval $inlibc
16377
16378 : see if this is a langinfo.h system
16379 set langinfo.h i_langinfo
16380 eval $inhdr
16381
16382 : see if nl_langinfo exists
16383 set nl_langinfo d_nl_langinfo
16384 eval $inlibc
16385
16386 : see if this is a quadmath.h system
16387 set quadmath.h i_quadmath
16388 eval $inhdr
16389
16390 : Check basic sizes
16391 echo " "
16392 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16393
16394 case "$use64bitint:$d_quad:$quadtype" in
16395 define:define:?*)
16396         ivtype="$quadtype"
16397         uvtype="$uquadtype"
16398         ivsize=8
16399         uvsize=8
16400         ;;
16401 *)      ivtype="long"
16402         uvtype="unsigned long"
16403         ivsize=$longsize
16404         uvsize=$longsize
16405         ;;
16406 esac
16407
16408 case "$uselongdouble:$d_longdbl" in
16409 define:define)
16410         nvtype="long double"
16411         nvsize=$longdblsize
16412         ;;
16413 *)      nvtype=double
16414         nvsize=$doublesize
16415         ;;
16416 esac
16417
16418 case "$usequadmath:$i_quadmath" in
16419 define:define)
16420   nvtype="__float128"
16421   nvsize=16
16422   case "$libs" in
16423   *quadmath*) ;;
16424   *) $cat <<EOM >&4
16425
16426 *** You requested the use of the quadmath library, but you
16427 *** do not seem to have the quadmath library installed.
16428 *** Cannot continue, aborting.
16429 EOM
16430     exit 1
16431     ;;
16432   esac
16433   ;;
16434 define:*) $cat <<EOM >&4
16435
16436 *** You requested the use of the quadmath library, but you
16437 *** do not seem to have the required header, <quadmath.h>.
16438 EOM
16439   case "$gccversion" in
16440   [23].*|4.[0-5]*)
16441    $cat <<EOM >&4
16442 *** Your gcc looks a bit old:
16443 *** $gccversion
16444 EOM
16445     ;;
16446   '')
16447    $cat <<EOM >&4
16448 *** You are not running a gcc.
16449 EOM
16450     ;;
16451   esac
16452   $cat <<EOM >&4
16453 *** For the quadmath library you need at least gcc 4.6.
16454 *** Cannot continue, aborting.
16455 EOM
16456   exit 1
16457   ;;
16458 esac
16459
16460 $echo "(IV will be "$ivtype", $ivsize bytes)"
16461 $echo "(UV will be "$uvtype", $uvsize bytes)"
16462 $echo "(NV will be "$nvtype", $nvsize bytes)"
16463
16464 $cat >try.c <<EOCP
16465 #$i_inttypes I_INTTYPES
16466 #ifdef I_INTTYPES
16467 #include <inttypes.h>
16468 #endif
16469 #include <stdio.h>
16470 int main() {
16471 #ifdef INT8
16472    int8_t i =  INT8_MAX;
16473   uint8_t u = UINT8_MAX;
16474   printf("int8_t\n");
16475 #endif
16476 #ifdef INT16
16477    int16_t i =  INT16_MAX;
16478   uint16_t u = UINT16_MAX;
16479   printf("int16_t\n");
16480 #endif
16481 #ifdef INT32
16482    int32_t i =  INT32_MAX;
16483   uint32_t u = UINT32_MAX;
16484   printf("int32_t\n");
16485 #endif
16486 }
16487 EOCP
16488
16489 i8type="signed char"
16490 u8type="unsigned char"
16491 i8size=1
16492 u8size=1
16493
16494 case "$i16type" in
16495 '')     case "$shortsize" in
16496         2)      i16type=short
16497                 u16type="unsigned short"
16498                 i16size=$shortsize
16499                 u16size=$shortsize
16500                 ;;
16501         esac
16502         ;;
16503 esac
16504 case "$i16type" in
16505 '')     set try -DINT16
16506         if eval $compile; then
16507                 case "`$run ./try`" in
16508                 int16_t)
16509                         i16type=int16_t
16510                         u16type=uint16_t
16511                         i16size=2
16512                         u16size=2
16513                         ;;
16514                 esac
16515         fi
16516         ;;
16517 esac
16518 case "$i16type" in
16519 '')     if $test $shortsize -ge 2; then
16520                 i16type=short
16521                 u16type="unsigned short"
16522                 i16size=$shortsize
16523                 u16size=$shortsize
16524         fi
16525         ;;
16526 esac
16527
16528 case "$i32type" in
16529 '')     case "$longsize" in
16530         4)      i32type=long
16531                 u32type="unsigned long"
16532                 i32size=$longsize
16533                 u32size=$longsize
16534                 ;;
16535         *)      case "$intsize" in
16536                 4)      i32type=int
16537                         u32type="unsigned int"
16538                         i32size=$intsize
16539                         u32size=$intsize
16540                         ;;
16541                 esac
16542                 ;;
16543         esac
16544         ;;
16545 esac
16546 case "$i32type" in
16547 '')     set try -DINT32
16548         if eval $compile; then
16549                 case "`$run ./try`" in
16550                 int32_t)
16551                         i32type=int32_t
16552                         u32type=uint32_t
16553                         i32size=4
16554                         u32size=4
16555                         ;;
16556                 esac
16557         fi
16558         ;;
16559 esac
16560 case "$i32type" in
16561 '')     if $test $intsize -ge 4; then
16562                 i32type=int
16563                 u32type="unsigned int"
16564                 i32size=$intsize
16565                 u32size=$intsize
16566         fi
16567         ;;
16568 esac
16569
16570 case "$i64type" in
16571 '')     case "$d_quad:$quadtype" in
16572         define:?*)
16573                 i64type="$quadtype"
16574                 u64type="$uquadtype"
16575                 i64size=8
16576                 u64size=8
16577                 ;;
16578         esac
16579         ;;
16580 esac
16581
16582 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16583 $cat <<EOP >try.c
16584 #include <stdio.h>
16585 #$i_stdlib I_STDLIB
16586 #ifdef I_STDLIB
16587 #include <stdlib.h>
16588 #endif
16589 #include <sys/types.h>
16590 #include <signal.h>
16591 #ifdef SIGFPE
16592 /* volatile so that the compiler has to store it out to memory */
16593 volatile int bletched = 0;
16594 $signal_t blech(int s) { bletched = 1; }
16595 #endif
16596 int main() {
16597     $uvtype u = 0;
16598     $nvtype d;
16599     int     n = 8 * $uvsize;
16600     int     i;
16601 #ifdef SIGFPE
16602     signal(SIGFPE, blech);
16603 #endif
16604
16605     for (i = 0; i < n; i++) {
16606       u = u << 1 | ($uvtype)1;
16607       d = ($nvtype)u;
16608       if (($uvtype)d != u)
16609         break;
16610       if (d <= 0)
16611         break;
16612       d = ($nvtype)(u - 1);
16613       if (($uvtype)d != (u - 1))
16614         break;
16615 #ifdef SIGFPE
16616       if (bletched)
16617         break;
16618 #endif
16619     }
16620     printf("%d\n", ((i == n) ? -n : i));
16621     exit(0);
16622 }
16623 EOP
16624 set try
16625
16626 d_nv_preserves_uv="$undef"
16627 if eval $compile; then
16628         nv_preserves_uv_bits="`$run ./try`"
16629 fi
16630 case "$nv_preserves_uv_bits" in
16631 \-[1-9]*)
16632         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16633         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16634         d_nv_preserves_uv="$define"
16635         ;;
16636 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16637         d_nv_preserves_uv="$undef" ;;
16638 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16639         nv_preserves_uv_bits="0" ;;
16640 esac
16641 $rm_try
16642
16643 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16644 $cat <<EOP >try.c
16645 #include <stdio.h>
16646
16647 typedef $nvtype NV;
16648
16649 int
16650 main() {
16651   NV value = 2;
16652   int count = 1;
16653
16654   while(count < 256) {
16655     /* volatile so that the compiler has to store it out to memory */
16656     volatile NV up = value + 1.0;
16657     volatile NV negated = -value;
16658     volatile NV down = negated - 1.0;
16659     volatile NV got_up = up - value;
16660     int up_good = got_up == 1.0;
16661     int got_down = down - negated;
16662     int down_good = got_down == -1.0;
16663
16664     if (down_good != up_good) {
16665       fprintf(stderr,
16666               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16667               up_good, (double) got_up, down_good, (double) got_down,
16668               count, (double) value);
16669       return 1;
16670     }
16671     if (!up_good) {
16672       while (1) {
16673         if (count > 8) {
16674           count -= 8;
16675           fputs("256.0", stdout);
16676         } else {
16677           count--;
16678           fputs("2.0", stdout);
16679         }
16680         if (!count) {
16681           puts("");
16682           return 0;
16683         }
16684         fputs("*", stdout);
16685       }
16686     }
16687     value *= 2;
16688     ++count;
16689   }
16690   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16691           count, (double) value);
16692   return 1;
16693 }
16694 EOP
16695 set try
16696
16697 nv_overflows_integers_at='0'
16698 if eval $compile; then
16699     xxx="`$run ./try`"
16700     case "$?" in
16701         0)
16702             case "$xxx" in
16703                 2*)  cat >&4 <<EOM
16704 The largest integer your NVs can preserve is equal to $xxx
16705 EOM
16706                     nv_overflows_integers_at="$xxx"
16707                     ;;
16708                 *)  cat >&4 <<EOM
16709 Cannot determine the largest integer value your NVs can hold, unexpected output
16710 '$xxx'
16711 EOM
16712                     ;;
16713             esac
16714             ;;
16715         *)  cat >&4 <<EOM
16716 Cannot determine the largest integer value your NVs can hold
16717 EOM
16718             ;;
16719     esac
16720 fi
16721 $rm_try
16722
16723 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16724 $cat <<EOP >try.c
16725 #include <stdio.h>
16726 #$i_stdlib I_STDLIB
16727 #ifdef I_STDLIB
16728 #include <stdlib.h>
16729 #endif
16730 #include <string.h>
16731 #include <sys/types.h>
16732 #include <signal.h>
16733 #ifdef SIGFPE
16734 /* volatile so that the compiler has to store it out to memory */
16735 volatile int bletched = 0;
16736 $signal_t blech(int s) { bletched = 1; }
16737 #endif
16738
16739 int checkit($nvtype d, const char *where) {
16740     void *v = &d;
16741     unsigned char *p = (unsigned char *)v;
16742     unsigned char *end = p + sizeof(d);
16743     int fail = 0;
16744
16745     while (p < end)
16746         fail += *p++;
16747
16748     if (!fail)
16749         return 0;
16750
16751     p = (unsigned char *)v;
16752     printf("No - %s: 0x", where);
16753     while (p < end)
16754         printf ("%02X", *p++);
16755     printf("\n");
16756     return 1;
16757 }
16758
16759 int main(int argc, char **argv) {
16760     $nvtype d = 0.0;
16761     int fail = 0;
16762     fail += checkit(d, "0.0");
16763
16764     /* The compiler shouldn't be assuming that bletched is 0  */
16765     d = bletched;
16766
16767     fail += checkit(d, "bleched");
16768
16769 #ifdef SIGFPE
16770     signal(SIGFPE, blech);
16771 #endif
16772
16773     /* Paranoia - the compiler should have no way of knowing that ANSI says
16774        that argv[argc] will always be NULL.  Actually, if it did assume this it
16775        would be buggy, as this is C and main() can be called from elsewhere in
16776        the program.  */
16777     d = argv[argc] ? 1 : 0;
16778
16779     if (d) {
16780         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16781     }
16782
16783     fail += checkit(d, "ternary");
16784
16785     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16786
16787     if (d != 0.0) {
16788         printf("No - memset doesn't give 0.0\n");
16789         /* This might just blow up:  */
16790         printf("(gives %g)\n", d);
16791         return 1;
16792     }
16793
16794 #ifdef SIGFPE
16795     if (bletched) {
16796         printf("No - something bleched\n");
16797         return 1;
16798     }
16799 #endif
16800     if (fail) {
16801       printf("No - %d fail(s)\n", fail);
16802       return 1;
16803     }
16804     printf("Yes\n");
16805     return 0;
16806 }
16807 EOP
16808 set try
16809
16810 d_nv_zero_is_allbits_zero="$undef"
16811 if eval $compile; then
16812     xxx="`$run ./try`"
16813     case "$?" in
16814         0)
16815             case "$xxx" in
16816                 Yes)  cat >&4 <<EOM
16817 0.0 is represented as all bits zero in memory
16818 EOM
16819                     d_nv_zero_is_allbits_zero="$define"
16820                     ;;
16821                 *)  cat >&4 <<EOM
16822 0.0 is not represented as all bits zero in memory
16823 EOM
16824                     d_nv_zero_is_allbits_zero="$undef"
16825                     ;;
16826             esac
16827             ;;
16828         *)  cat >&4 <<EOM
16829 0.0 is not represented as all bits zero in memory
16830 EOM
16831             d_nv_zero_is_allbits_zero="$undef"
16832             ;;
16833     esac
16834 fi
16835 $rm_try
16836
16837 : check for off64_t
16838 echo " "
16839 echo "Checking to see if you have off64_t..." >&4
16840 $cat >try.c <<EOCP
16841 #include <sys/types.h>
16842 #include <unistd.h>
16843 int main() { off64_t x = 7; }
16844 EOCP
16845 set try
16846 if eval $compile; then
16847         val="$define"
16848         echo "You have off64_t."
16849 else
16850         val="$undef"
16851         echo "You do not have off64_t."
16852         case "$lseeksize" in
16853         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16854         esac
16855 fi
16856 $rm_try
16857 set d_off64_t
16858 eval $setvar
16859
16860 : how to create joinable pthreads
16861 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16862         echo " "
16863         echo "Checking what constant to use for creating joinable pthreads..." >&4
16864         $cat >try.c <<'EOCP'
16865 #include <pthread.h>
16866 int main() {
16867     int detachstate = JOINABLE;
16868 }
16869 EOCP
16870         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16871         if eval $compile; then
16872                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16873                 val="$undef" # Yes, undef.
16874                 set d_old_pthread_create_joinable
16875                 eval $setvar
16876                 val=""
16877                 set old_pthread_create_joinable
16878                 eval $setvar
16879         else
16880                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16881                 if eval $compile; then
16882                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16883                         val="$define"
16884                         set d_old_pthread_create_joinable
16885                         eval $setvar
16886                         val=PTHREAD_CREATE_UNDETACHED
16887                         set old_pthread_create_joinable
16888                         eval $setvar
16889                 else
16890                         set try -DJOINABLE=__UNDETACHED
16891                         if eval $compile; then
16892                                 echo "You seem to use __UNDETACHED." >&4
16893                                 val="$define"
16894                                 set d_old_pthread_create_joinable
16895                                 eval $setvar
16896                                 val=__UNDETACHED
16897                                 set old_pthread_create_joinable
16898                                 eval $setvar
16899                         else
16900                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16901                                 val="$define"
16902                                 set d_old_pthread_create_joinable
16903                                 eval $setvar
16904                                 val=0
16905                                 set old_pthread_create_joinable
16906                                 eval $setvar
16907                         fi
16908                 fi
16909         fi
16910         $rm_try
16911 else
16912     d_old_pthread_create_joinable="$undef"
16913     old_pthread_create_joinable=""
16914 fi
16915
16916 : see if pause exists
16917 set pause d_pause
16918 eval $inlibc
16919
16920 : see if poll exists
16921 set poll d_poll
16922 eval $inlibc
16923
16924 : see if prctl exists
16925 set prctl d_prctl
16926 eval $inlibc
16927
16928 : see if prctl supports PR_SET_NAME
16929 d_prctl_set_name=$undef
16930 case $d_prctl in
16931     $define)
16932         $cat >try.c <<EOM
16933 #ifdef __ANDROID__
16934 #include <unistd.h>
16935 #endif
16936 #include <sys/prctl.h>
16937
16938 int main (int argc, char *argv[])
16939 {
16940     return (prctl (PR_SET_NAME, "Test"));
16941     } /* main */
16942 EOM
16943         set try
16944         if eval $compile_ok && $run ./try; then
16945             echo "Your prctl (PR_SET_NAME, ...) works"
16946             d_prctl_set_name=$define
16947             fi
16948         $rm_try
16949         ;;
16950     esac
16951
16952 : see if readlink exists
16953 set readlink d_readlink
16954 eval $inlibc
16955
16956 : Check if there is a /proc symlink to the abs path of
16957 : the executing program.  We will honor hints of d_procselfexe=$undef
16958 : or procselfexe being non-empty, otherwise will try to determine both
16959 : if we have readlink.
16960 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
16961 : referenced, and AmigaOS does not have a proc filesystem anyway.
16962 echo " "
16963 val="$undef"
16964 if $test "X$d_procselfexe" = Xundef; then
16965         procselfexe=''
16966 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
16967         val="$define"
16968 elif $test "X$d_readlink" = Xdefine; then
16969         : NetBSD first as /proc/self is a symlink to /proc/curproc,
16970         : and it feels more tidy to avoid an extra level of symlink
16971         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16972         while test $# -gt 0; do
16973             type=$1; try=$2
16974             shift; shift
16975             if $issymlink $try; then
16976                 $ls -l $try > reflect
16977                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16978                     echo "You have $type-like $try."
16979                     procselfexe='"'$try'"'
16980                     val="$define"
16981                     : This will break out of the loop
16982                     set X; shift
16983                 fi
16984             fi
16985         done
16986 fi
16987 $rm -f reflect
16988 set d_procselfexe
16989 eval $setvar
16990
16991 : backward compatibility for d_hvfork
16992 if test X$d_hvfork != X; then
16993         d_vfork="$d_hvfork"
16994         d_hvfork=''
16995 fi
16996 : see if there is a vfork
16997 val=''
16998 set vfork val
16999 eval $inlibc
17000
17001 d_pseudofork=$undef
17002
17003 : Ok, but do we want to use it. vfork is reportedly unreliable in
17004 : perl on Solaris 2.x, and probably elsewhere.
17005 case "$val" in
17006 $define)
17007         echo " "
17008         case "$usevfork" in
17009         false) dflt='n';;
17010         *) dflt='y';;
17011         esac
17012         cat <<'EOM'
17013
17014 Perl can only use a vfork() that doesn't suffer from strict
17015 restrictions on calling functions or modifying global data in
17016 the child.  For example, glibc-2.1 contains such a vfork()
17017 that is unsuitable.  If your system provides a proper fork()
17018 call, chances are that you do NOT want perl to use vfork().
17019
17020 EOM
17021         rp="Do you still want to use vfork()?"
17022         . ./myread
17023         case "$ans" in
17024         y|Y) ;;
17025         *)
17026                 echo "Ok, we won't use vfork()."
17027                 val="$undef"
17028                 ;;
17029         esac
17030         ;;
17031 esac
17032 set d_vfork
17033 eval $setvar
17034 case "$d_vfork" in
17035 $define) usevfork='true';;
17036 *) usevfork='false';;
17037 esac
17038
17039 : see whether the pthread_atfork exists
17040 $cat >try.c <<EOP
17041 #include <pthread.h>
17042 #include <stdio.h>
17043 int main() {
17044 #ifdef  PTHREAD_ATFORK
17045         pthread_atfork(NULL,NULL,NULL);
17046 #endif
17047 }
17048 EOP
17049
17050 : see if pthread_atfork exists
17051 set try -DPTHREAD_ATFORK
17052 if eval $compile; then
17053     val="$define"
17054 else
17055     val="$undef"
17056 fi
17057 case "$usethreads" in
17058 $define)
17059         case "$val" in
17060         $define) echo 'pthread_atfork found.' >&4        ;;
17061         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17062         esac
17063 esac
17064 set d_pthread_atfork
17065 eval $setvar
17066
17067 : see if pthread_attr_setscope exists
17068 set pthread_attr_setscope d_pthread_attr_setscope
17069 eval $inlibc
17070
17071 : see whether the various POSIXish _yields exist
17072 $cat >try.c <<EOP
17073 #include <pthread.h>
17074 #include <stdio.h>
17075 int main() {
17076 #ifdef SCHED_YIELD
17077         sched_yield();
17078 #else
17079 #ifdef PTHREAD_YIELD
17080         pthread_yield();
17081 #else
17082 #ifdef PTHREAD_YIELD_NULL
17083         pthread_yield(NULL);
17084 #endif
17085 #endif
17086 #endif
17087 }
17088 EOP
17089 : see if sched_yield exists
17090 set try -DSCHED_YIELD
17091 if eval $compile; then
17092     val="$define"
17093     sched_yield='sched_yield()'
17094 else
17095     val="$undef"
17096 fi
17097 case "$usethreads" in
17098 $define)
17099         case "$val" in
17100         $define) echo 'sched_yield() found.' >&4        ;;
17101         *)       echo 'sched_yield() NOT found.' >&4    ;;
17102         esac
17103 esac
17104 set d_sched_yield
17105 eval $setvar
17106
17107 : see if pthread_yield exists
17108 set try -DPTHREAD_YIELD
17109 if eval $compile; then
17110     val="$define"
17111     case "$sched_yield" in
17112     '') sched_yield='pthread_yield()' ;;
17113     esac
17114 else
17115     set try -DPTHREAD_YIELD_NULL
17116     if eval $compile; then
17117         val="$define"
17118         case "$sched_yield" in
17119         '') sched_yield='pthread_yield(NULL)' ;;
17120         esac
17121     else
17122         val="$undef"
17123     fi
17124 fi
17125 case "$usethreads" in
17126 $define)
17127         case "$val" in
17128         $define) echo 'pthread_yield() found.' >&4      ;;
17129         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17130         esac
17131         ;;
17132 esac
17133 set d_pthread_yield
17134 eval $setvar
17135 case "$sched_yield" in
17136 '') sched_yield=undef ;;
17137 esac
17138 $rm_try
17139
17140 : check for ptrdiff_t
17141 echo " "
17142 echo "Checking to see if you have ptrdiff_t..." >&4
17143 $cat >try.c <<EOCP
17144 #include <stddef.h>
17145 int main() { ptrdiff_t x = 7; }
17146 EOCP
17147 set try
17148 if eval $compile; then
17149         val="$define"
17150         echo "You have ptrdiff_t."
17151 else
17152         val="$undef"
17153         echo "You do not have ptrdiff_t."
17154 fi
17155 $rm_try
17156 set d_ptrdiff_t
17157 eval $setvar
17158
17159 : see if random_r exists
17160 set random_r d_random_r
17161 eval $inlibc
17162 case "$d_random_r" in
17163 "$define")
17164         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17165         case "$d_random_r_proto:$usethreads" in
17166         ":define")      d_random_r_proto=define
17167                 set d_random_r_proto random_r $hdrs
17168                 eval $hasproto ;;
17169         *)      ;;
17170         esac
17171         case "$d_random_r_proto" in
17172         define)
17173         case "$random_r_proto" in
17174         ''|0) try='int random_r(int*, struct random_data*);'
17175         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17176         esac
17177         case "$random_r_proto" in
17178         ''|0) try='int random_r(long*, struct random_data*);'
17179         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17180         esac
17181         case "$random_r_proto" in
17182         ''|0) try='int random_r(struct random_data*, int32_t*);'
17183         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17184         esac
17185         case "$random_r_proto" in
17186         ''|0)   d_random_r=undef
17187                 random_r_proto=0
17188                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17189         * )     case "$random_r_proto" in
17190                 REENTRANT_PROTO*) ;;
17191                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17192                 esac
17193                 echo "Prototype: $try" ;;
17194         esac
17195         ;;
17196         *)      case "$usethreads" in
17197                 define) echo "random_r has no prototype, not using it." >&4 ;;
17198                 esac
17199                 d_random_r=undef
17200                 random_r_proto=0
17201                 ;;
17202         esac
17203         ;;
17204 *)      random_r_proto=0
17205         ;;
17206 esac
17207
17208 : see if readdir and friends exist
17209 set readdir d_readdir
17210 eval $inlibc
17211 set seekdir d_seekdir
17212 eval $inlibc
17213 set telldir d_telldir
17214 eval $inlibc
17215 set rewinddir d_rewinddir
17216 eval $inlibc
17217
17218 : see if readdir64_r exists
17219 set readdir64_r d_readdir64_r
17220 eval $inlibc
17221 case "$d_readdir64_r" in
17222 "$define")
17223         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17224         case "$d_readdir64_r_proto:$usethreads" in
17225         ":define")      d_readdir64_r_proto=define
17226                 set d_readdir64_r_proto readdir64_r $hdrs
17227                 eval $hasproto ;;
17228         *)      ;;
17229         esac
17230         case "$d_readdir64_r_proto" in
17231         define)
17232         case "$readdir64_r_proto" in
17233         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17234         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17235         esac
17236         case "$readdir64_r_proto" in
17237         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17238         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17239         esac
17240         case "$readdir64_r_proto" in
17241         ''|0)   d_readdir64_r=undef
17242                 readdir64_r_proto=0
17243                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17244         * )     case "$readdir64_r_proto" in
17245                 REENTRANT_PROTO*) ;;
17246                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17247                 esac
17248                 echo "Prototype: $try" ;;
17249         esac
17250         ;;
17251         *)      case "$usethreads" in
17252                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17253                 esac
17254                 d_readdir64_r=undef
17255                 readdir64_r_proto=0
17256                 ;;
17257         esac
17258         ;;
17259 *)      readdir64_r_proto=0
17260         ;;
17261 esac
17262
17263 : see if readdir_r exists
17264 set readdir_r d_readdir_r
17265 eval $inlibc
17266 case "$d_readdir_r" in
17267 "$define")
17268         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17269         case "$d_readdir_r_proto:$usethreads" in
17270         ":define")      d_readdir_r_proto=define
17271                 set d_readdir_r_proto readdir_r $hdrs
17272                 eval $hasproto ;;
17273         *)      ;;
17274         esac
17275         case "$d_readdir_r_proto" in
17276         define)
17277         case "$readdir_r_proto" in
17278         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17279         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17280         esac
17281         case "$readdir_r_proto" in
17282         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17283         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17284         esac
17285         case "$readdir_r_proto" in
17286         ''|0)   d_readdir_r=undef
17287                 readdir_r_proto=0
17288                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17289         * )     case "$readdir_r_proto" in
17290                 REENTRANT_PROTO*) ;;
17291                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17292                 esac
17293                 echo "Prototype: $try" ;;
17294         esac
17295         ;;
17296         *)      case "$usethreads" in
17297                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17298                 esac
17299                 d_readdir_r=undef
17300                 readdir_r_proto=0
17301                 ;;
17302         esac
17303         ;;
17304 *)      readdir_r_proto=0
17305         ;;
17306 esac
17307
17308 : see if readv exists
17309 set readv d_readv
17310 eval $inlibc
17311
17312 : see if recvmsg exists
17313 set recvmsg d_recvmsg
17314 eval $inlibc
17315
17316 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17317 echo " "
17318 if set regcomp val -f d_regcomp; eval $csym; $val; then
17319         echo 'regcomp() found.' >&4
17320         d_regcomp="$define"
17321         d_regcmp="$undef"
17322         d_re_comp="$undef"
17323 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17324         echo 'regcmp() found.' >&4
17325         d_regcmp="$define"
17326         d_regcomp="$undef"
17327         d_re_comp="$undef"
17328 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17329         echo 're_comp() found, assuming re_exec() also exists.' >&4
17330         d_re_comp="$define"
17331         d_regcomp="$undef"
17332         d_regcmp="$undef"
17333 else
17334         $cat >&4 <<EOM
17335 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17336 EOM
17337         d_regcmp="$undef"
17338         d_re_comp="$undef"
17339         d_regcomp="$undef"
17340 fi
17341
17342 : see if remainder exists
17343 set remainder d_remainder
17344 eval $inlibc
17345
17346 : see if remquo exists
17347 set remquo d_remquo
17348 eval $inlibc
17349
17350 : see if rename exists
17351 set rename d_rename
17352 eval $inlibc
17353
17354 : see if rint exists
17355 set rint d_rint
17356 eval $inlibc
17357
17358 : see if rmdir exists
17359 set rmdir d_rmdir
17360 eval $inlibc
17361
17362 : see if round exists
17363 set round d_round
17364 eval $inlibc
17365
17366 : see if prototype for sbrk is available
17367 echo " "
17368 set d_sbrkproto sbrk $i_unistd unistd.h
17369 eval $hasproto
17370
17371 : see if scalbn exists
17372 set scalbn d_scalbn
17373 eval $inlibc
17374
17375 : see if select exists
17376 set select d_select
17377 eval $inlibc
17378
17379 : see if semctl exists
17380 set semctl d_semctl
17381 eval $inlibc
17382
17383 : see if semget exists
17384 set semget d_semget
17385 eval $inlibc
17386
17387 : see if semop exists
17388 set semop d_semop
17389 eval $inlibc
17390
17391 : see how much of the 'sem*(2)' library is present.
17392 h_sem=true
17393 echo " "
17394 case "$d_semctl$d_semget$d_semop" in
17395 *"$undef"*) h_sem=false;;
17396 esac
17397 case "$osname" in
17398 freebsd)
17399     case "`ipcs 2>&1`" in
17400     "SVID messages"*"not configured"*)
17401         echo "Your $osname does not have the sem*(2) configured." >&4
17402         h_sem=false
17403         val="$undef"
17404         set semctl d_semctl
17405         eval $setvar
17406         set semget d_semget
17407         eval $setvar
17408         set semop d_semop
17409         eval $setvar
17410         ;;
17411     esac
17412     ;;
17413 esac
17414 : we could also check for sys/ipc.h ...
17415 if $h_sem && $test `./findhdr sys/sem.h`; then
17416         echo "You have the full sem*(2) library." >&4
17417         val="$define"
17418 else
17419         echo "You don't have the full sem*(2) library." >&4
17420         val="$undef"
17421 fi
17422 set d_sem
17423 eval $setvar
17424
17425 : see whether sys/sem.h defines union semun
17426 echo " "
17427 $cat > try.c <<'END'
17428 #include <sys/types.h>
17429 #include <sys/ipc.h>
17430 #include <sys/sem.h>
17431 int main () { union semun semun; semun.buf = 0; }
17432 END
17433 set try
17434 if eval $compile; then
17435     echo "You have union semun in <sys/sem.h>." >&4
17436     val="$define"
17437 else
17438     echo "You do not have union semun in <sys/sem.h>." >&4
17439     val="$undef"
17440 fi
17441 $rm_try
17442 set d_union_semun
17443 eval $setvar
17444
17445 : see how to do semctl IPC_STAT
17446 case "$d_sem" in
17447 $define)
17448     echo " "
17449     $cat > tryh.h <<END
17450 #ifndef S_IRUSR
17451 #   ifdef S_IREAD
17452 #       define S_IRUSR S_IREAD
17453 #       define S_IWUSR S_IWRITE
17454 #       define S_IXUSR S_IEXEC
17455 #   else
17456 #       define S_IRUSR 0400
17457 #       define S_IWUSR 0200
17458 #       define S_IXUSR 0100
17459 #   endif
17460 #   define S_IRGRP (S_IRUSR>>3)
17461 #   define S_IWGRP (S_IWUSR>>3)
17462 #   define S_IXGRP (S_IXUSR>>3)
17463 #   define S_IROTH (S_IRUSR>>6)
17464 #   define S_IWOTH (S_IWUSR>>6)
17465 #   define S_IXOTH (S_IXUSR>>6)
17466 #endif
17467 #ifndef S_IRWXU
17468 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17469 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17470 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17471 #endif
17472 END
17473     : see whether semctl IPC_STAT can use union semun
17474     case "$d_semctl_semun" in
17475     '')
17476       val="$undef"
17477       $cat > try.c <<END
17478 #include <sys/types.h>
17479 #include <sys/ipc.h>
17480 #include <sys/sem.h>
17481 #include <sys/stat.h>
17482 #include <stdio.h>
17483 #include <errno.h>
17484 #include "tryh.h"
17485 #ifndef errno
17486 extern int errno;
17487 #endif
17488 #$d_union_semun HAS_UNION_SEMUN
17489 int main() {
17490     union semun
17491 #ifndef HAS_UNION_SEMUN
17492     {
17493         int val;
17494         struct semid_ds *buf;
17495         unsigned short *array;
17496     }
17497 #endif
17498     arg;
17499     int sem, st;
17500
17501 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17502     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17503     if (sem > -1) {
17504         struct semid_ds argbuf;
17505         arg.buf = &argbuf;
17506 #       ifdef IPC_STAT
17507         st = semctl(sem, 0, IPC_STAT, arg);
17508         if (st == 0)
17509             printf("semun\n");
17510         else
17511 #       endif /* IPC_STAT */
17512             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17513 #       ifdef IPC_RMID
17514         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17515 #       endif /* IPC_RMID */
17516             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17517     } else
17518 #endif /* IPC_PRIVATE && ... */
17519         printf("semget failed: errno = %d\n", errno);
17520   return 0;
17521 }
17522 END
17523       set try
17524       if eval $compile; then
17525           xxx=`$run ./try`
17526           case "$xxx" in
17527           semun) val="$define" ;;
17528           esac
17529       fi
17530       $rm_try
17531       set d_semctl_semun
17532       eval $setvar
17533       ;;
17534     esac
17535     case "$d_semctl_semun" in
17536     $define)
17537         echo "You can use union semun for semctl IPC_STAT." >&4
17538         also='also'
17539         ;;
17540     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17541         also=''
17542         ;;
17543     esac
17544
17545     : see whether semctl IPC_STAT can use struct semid_ds pointer
17546     case "$d_semctl_semid_ds" in
17547     '')
17548       val="$undef"
17549       $cat > try.c <<'END'
17550 #include <sys/types.h>
17551 #include <sys/ipc.h>
17552 #include <sys/sem.h>
17553 #include <sys/stat.h>
17554 #include "tryh.h"
17555 #include <stdio.h>
17556 #include <errno.h>
17557 #ifndef errno
17558 extern int errno;
17559 #endif
17560 int main() {
17561     struct semid_ds arg;
17562     int sem, st;
17563
17564 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17565     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17566     if (sem > -1) {
17567 #       ifdef IPC_STAT
17568         st = semctl(sem, 0, IPC_STAT, &arg);
17569         if (st == 0)
17570             printf("semid_ds\n");
17571         else
17572 #       endif /* IPC_STAT */
17573             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17574 #       ifdef IPC_RMID
17575         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
17576 #       endif /* IPC_RMID */
17577             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17578     } else
17579 #endif /* IPC_PRIVATE && ... */
17580         printf("semget failed: errno = %d\n", errno);
17581
17582     return 0;
17583 }
17584 END
17585       set try
17586       if eval $compile; then
17587           xxx=`$run ./try`
17588           case "$xxx" in
17589           semid_ds) val="$define" ;;
17590           esac
17591       fi
17592       $rm_try
17593       set d_semctl_semid_ds
17594       eval $setvar
17595       ;;
17596     esac
17597     case "$d_semctl_semid_ds" in
17598     $define)
17599         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17600         ;;
17601     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17602         ;;
17603     esac
17604     ;;
17605 *)  val="$undef"
17606
17607     # We do not have the full sem*(2) library, so assume we can not
17608     # use either.
17609
17610     set d_semctl_semun
17611     eval $setvar
17612
17613     set d_semctl_semid_ds
17614     eval $setvar
17615     ;;
17616 esac
17617 $rm_try tryh.h
17618
17619 : see if sendmsg exists
17620 set sendmsg d_sendmsg
17621 eval $inlibc
17622
17623 : see if setegid exists
17624 set setegid d_setegid
17625 eval $inlibc
17626
17627 : see if seteuid exists
17628 set seteuid d_seteuid
17629 eval $inlibc
17630
17631 : see if setgrent exists
17632 set setgrent d_setgrent
17633 eval $inlibc
17634
17635 : see if setgrent_r exists
17636 set setgrent_r d_setgrent_r
17637 eval $inlibc
17638 case "$d_setgrent_r" in
17639 "$define")
17640         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17641         case "$d_setgrent_r_proto:$usethreads" in
17642         ":define")      d_setgrent_r_proto=define
17643                 set d_setgrent_r_proto setgrent_r $hdrs
17644                 eval $hasproto ;;
17645         *)      ;;
17646         esac
17647         case "$d_setgrent_r_proto" in
17648         define)
17649         case "$setgrent_r_proto" in
17650         ''|0) try='int setgrent_r(FILE**);'
17651         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17652         esac
17653         case "$setgrent_r_proto" in
17654         ''|0) try='void setgrent_r(FILE**);'
17655         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17656         esac
17657         case "$setgrent_r_proto" in
17658         ''|0)   d_setgrent_r=undef
17659                 setgrent_r_proto=0
17660                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17661         * )     case "$setgrent_r_proto" in
17662                 REENTRANT_PROTO*) ;;
17663                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17664                 esac
17665                 echo "Prototype: $try" ;;
17666         esac
17667         ;;
17668         *)      case "$usethreads" in
17669                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17670                 esac
17671                 d_setgrent_r=undef
17672                 setgrent_r_proto=0
17673                 ;;
17674         esac
17675         ;;
17676 *)      setgrent_r_proto=0
17677         ;;
17678 esac
17679
17680 : see if sethostent exists
17681 set sethostent d_sethent
17682 eval $inlibc
17683
17684 : see if sethostent_r exists
17685 set sethostent_r d_sethostent_r
17686 eval $inlibc
17687 case "$d_sethostent_r" in
17688 "$define")
17689         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17690         case "$d_sethostent_r_proto:$usethreads" in
17691         ":define")      d_sethostent_r_proto=define
17692                 set d_sethostent_r_proto sethostent_r $hdrs
17693                 eval $hasproto ;;
17694         *)      ;;
17695         esac
17696         case "$d_sethostent_r_proto" in
17697         define)
17698         case "$sethostent_r_proto" in
17699         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17700         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17701         esac
17702         case "$sethostent_r_proto" in
17703         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17704         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17705         esac
17706         case "$sethostent_r_proto" in
17707         ''|0)   d_sethostent_r=undef
17708                 sethostent_r_proto=0
17709                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17710         * )     case "$sethostent_r_proto" in
17711                 REENTRANT_PROTO*) ;;
17712                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17713                 esac
17714                 echo "Prototype: $try" ;;
17715         esac
17716         ;;
17717         *)      case "$usethreads" in
17718                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17719                 esac
17720                 d_sethostent_r=undef
17721                 sethostent_r_proto=0
17722                 ;;
17723         esac
17724         ;;
17725 *)      sethostent_r_proto=0
17726         ;;
17727 esac
17728
17729 : see if setitimer exists
17730 set setitimer d_setitimer
17731 eval $inlibc
17732
17733 : see if setlinebuf exists
17734 set setlinebuf d_setlinebuf
17735 eval $inlibc
17736
17737 : see if setlocale exists
17738 set setlocale d_setlocale
17739 eval $inlibc
17740
17741 : see if locale.h is available
17742 set locale.h i_locale
17743 eval $inhdr
17744
17745 : see if setlocale_r exists
17746 set setlocale_r d_setlocale_r
17747 eval $inlibc
17748 case "$d_setlocale_r" in
17749 "$define")
17750         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17751         case "$d_setlocale_r_proto:$usethreads" in
17752         ":define")      d_setlocale_r_proto=define
17753                 set d_setlocale_r_proto setlocale_r $hdrs
17754                 eval $hasproto ;;
17755         *)      ;;
17756         esac
17757         case "$d_setlocale_r_proto" in
17758         define)
17759         case "$setlocale_r_proto" in
17760         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17761         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17762         esac
17763         case "$setlocale_r_proto" in
17764         ''|0)   d_setlocale_r=undef
17765                 setlocale_r_proto=0
17766                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17767         * )     case "$setlocale_r_proto" in
17768                 REENTRANT_PROTO*) ;;
17769                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17770                 esac
17771                 echo "Prototype: $try" ;;
17772         esac
17773         ;;
17774         *)      case "$usethreads" in
17775                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17776                 esac
17777                 d_setlocale_r=undef
17778                 setlocale_r_proto=0
17779                 ;;
17780         esac
17781         ;;
17782 *)      setlocale_r_proto=0
17783         ;;
17784 esac
17785
17786 : see if setnetent exists
17787 set setnetent d_setnent
17788 eval $inlibc
17789
17790 : see if setnetent_r exists
17791 set setnetent_r d_setnetent_r
17792 eval $inlibc
17793 case "$d_setnetent_r" in
17794 "$define")
17795         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17796         case "$d_setnetent_r_proto:$usethreads" in
17797         ":define")      d_setnetent_r_proto=define
17798                 set d_setnetent_r_proto setnetent_r $hdrs
17799                 eval $hasproto ;;
17800         *)      ;;
17801         esac
17802         case "$d_setnetent_r_proto" in
17803         define)
17804         case "$setnetent_r_proto" in
17805         ''|0) try='int setnetent_r(int, struct netent_data*);'
17806         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17807         esac
17808         case "$setnetent_r_proto" in
17809         ''|0) try='void setnetent_r(int, struct netent_data*);'
17810         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17811         esac
17812         case "$setnetent_r_proto" in
17813         ''|0)   d_setnetent_r=undef
17814                 setnetent_r_proto=0
17815                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17816         * )     case "$setnetent_r_proto" in
17817                 REENTRANT_PROTO*) ;;
17818                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17819                 esac
17820                 echo "Prototype: $try" ;;
17821         esac
17822         ;;
17823         *)      case "$usethreads" in
17824                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17825                 esac
17826                 d_setnetent_r=undef
17827                 setnetent_r_proto=0
17828                 ;;
17829         esac
17830         ;;
17831 *)      setnetent_r_proto=0
17832         ;;
17833 esac
17834
17835 : see if setprotoent exists
17836 set setprotoent d_setpent
17837 eval $inlibc
17838
17839 : see if setpgid exists
17840 set setpgid d_setpgid
17841 eval $inlibc
17842
17843 : see if setpgrp2 exists
17844 set setpgrp2 d_setpgrp2
17845 eval $inlibc
17846
17847 : see if setpriority exists
17848 set setpriority d_setprior
17849 eval $inlibc
17850
17851 : see if setproctitle exists
17852 set setproctitle d_setproctitle
17853 eval $inlibc
17854
17855 : see if setprotoent_r exists
17856 set setprotoent_r d_setprotoent_r
17857 eval $inlibc
17858 case "$d_setprotoent_r" in
17859 "$define")
17860         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17861         case "$d_setprotoent_r_proto:$usethreads" in
17862         ":define")      d_setprotoent_r_proto=define
17863                 set d_setprotoent_r_proto setprotoent_r $hdrs
17864                 eval $hasproto ;;
17865         *)      ;;
17866         esac
17867         case "$d_setprotoent_r_proto" in
17868         define)
17869         case "$setprotoent_r_proto" in
17870         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17871         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17872         esac
17873         case "$setprotoent_r_proto" in
17874         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17875         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17876         esac
17877         case "$setprotoent_r_proto" in
17878         ''|0)   d_setprotoent_r=undef
17879                 setprotoent_r_proto=0
17880                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17881         * )     case "$setprotoent_r_proto" in
17882                 REENTRANT_PROTO*) ;;
17883                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17884                 esac
17885                 echo "Prototype: $try" ;;
17886         esac
17887         ;;
17888         *)      case "$usethreads" in
17889                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17890                 esac
17891                 d_setprotoent_r=undef
17892                 setprotoent_r_proto=0
17893                 ;;
17894         esac
17895         ;;
17896 *)      setprotoent_r_proto=0
17897         ;;
17898 esac
17899
17900 : see if setpwent exists
17901 set setpwent d_setpwent
17902 eval $inlibc
17903
17904 : see if setpwent_r exists
17905 set setpwent_r d_setpwent_r
17906 eval $inlibc
17907 case "$d_setpwent_r" in
17908 "$define")
17909         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17910         case "$d_setpwent_r_proto:$usethreads" in
17911         ":define")      d_setpwent_r_proto=define
17912                 set d_setpwent_r_proto setpwent_r $hdrs
17913                 eval $hasproto ;;
17914         *)      ;;
17915         esac
17916         case "$d_setpwent_r_proto" in
17917         define)
17918         case "$setpwent_r_proto" in
17919         ''|0) try='int setpwent_r(FILE**);'
17920         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17921         esac
17922         case "$setpwent_r_proto" in
17923         ''|0) try='void setpwent_r(FILE**);'
17924         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17925         esac
17926         case "$setpwent_r_proto" in
17927         ''|0)   d_setpwent_r=undef
17928                 setpwent_r_proto=0
17929                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17930         * )     case "$setpwent_r_proto" in
17931                 REENTRANT_PROTO*) ;;
17932                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17933                 esac
17934                 echo "Prototype: $try" ;;
17935         esac
17936         ;;
17937         *)      case "$usethreads" in
17938                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17939                 esac
17940                 d_setpwent_r=undef
17941                 setpwent_r_proto=0
17942                 ;;
17943         esac
17944         ;;
17945 *)      setpwent_r_proto=0
17946         ;;
17947 esac
17948
17949 : see if setregid exists
17950 set setregid d_setregid
17951 eval $inlibc
17952 set setresgid d_setresgid
17953 eval $inlibc
17954
17955 : see if setreuid exists
17956 set setreuid d_setreuid
17957 eval $inlibc
17958 set setresuid d_setresuid
17959 eval $inlibc
17960
17961 : see if setrgid exists
17962 set setrgid d_setrgid
17963 eval $inlibc
17964
17965 : see if setruid exists
17966 set setruid d_setruid
17967 eval $inlibc
17968
17969 : see if setservent exists
17970 set setservent d_setsent
17971 eval $inlibc
17972
17973 : see if setservent_r exists
17974 set setservent_r d_setservent_r
17975 eval $inlibc
17976 case "$d_setservent_r" in
17977 "$define")
17978         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17979         case "$d_setservent_r_proto:$usethreads" in
17980         ":define")      d_setservent_r_proto=define
17981                 set d_setservent_r_proto setservent_r $hdrs
17982                 eval $hasproto ;;
17983         *)      ;;
17984         esac
17985         case "$d_setservent_r_proto" in
17986         define)
17987         case "$setservent_r_proto" in
17988         ''|0) try='int setservent_r(int, struct servent_data*);'
17989         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17990         esac
17991         case "$setservent_r_proto" in
17992         ''|0) try='void setservent_r(int, struct servent_data*);'
17993         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17994         esac
17995         case "$setservent_r_proto" in
17996         ''|0)   d_setservent_r=undef
17997                 setservent_r_proto=0
17998                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17999         * )     case "$setservent_r_proto" in
18000                 REENTRANT_PROTO*) ;;
18001                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18002                 esac
18003                 echo "Prototype: $try" ;;
18004         esac
18005         ;;
18006         *)      case "$usethreads" in
18007                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18008                 esac
18009                 d_setservent_r=undef
18010                 setservent_r_proto=0
18011                 ;;
18012         esac
18013         ;;
18014 *)      setservent_r_proto=0
18015         ;;
18016 esac
18017
18018 : see if setsid exists
18019 set setsid d_setsid
18020 eval $inlibc
18021
18022 : see if setvbuf exists
18023 set setvbuf d_setvbuf
18024 eval $inlibc
18025
18026 : see if shmctl exists
18027 set shmctl d_shmctl
18028 eval $inlibc
18029
18030 : see if shmget exists
18031 set shmget d_shmget
18032 eval $inlibc
18033
18034 : see if shmat exists
18035 set shmat d_shmat
18036 eval $inlibc
18037 : see what shmat returns
18038 case "$d_shmat" in
18039 "$define")
18040         $cat >shmat.c <<'END'
18041 #include <sys/shm.h>
18042 void *shmat();
18043 END
18044         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18045                 shmattype='void *'
18046         else
18047                 shmattype='char *'
18048         fi
18049         echo "and it returns ($shmattype)." >&4
18050         : see if a prototype for shmat is available
18051         xxx=`./findhdr sys/shm.h`
18052         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18053         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18054                 val="$define"
18055         else
18056                 val="$undef"
18057         fi
18058         $rm -f shmat.[co]
18059         ;;
18060 *)
18061         val="$undef"
18062         ;;
18063 esac
18064 set d_shmatprototype
18065 eval $setvar
18066
18067 : see if shmdt exists
18068 set shmdt d_shmdt
18069 eval $inlibc
18070
18071 : see how much of the 'shm*(2)' library is present.
18072 h_shm=true
18073 echo " "
18074 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18075 *"$undef"*) h_shm=false;;
18076 esac
18077 case "$osname" in
18078 freebsd)
18079     case "`ipcs 2>&1`" in
18080     "SVID shared memory"*"not configured"*)
18081         echo "Your $osname does not have the shm*(2) configured." >&4
18082         h_shm=false
18083         val="$undef"
18084         set shmctl d_shmctl
18085         eval $setvar
18086         set shmget d_shmget
18087         eval $setvar
18088         set shmat d_shmat
18089         eval $setvar
18090         set shmdt d_shmdt
18091         eval $setvar
18092         ;;
18093     esac
18094     ;;
18095 esac
18096 : we could also check for sys/ipc.h ...
18097 if $h_shm && $test `./findhdr sys/shm.h`; then
18098         echo "You have the full shm*(2) library." >&4
18099         val="$define"
18100 else
18101         echo "You don't have the full shm*(2) library." >&4
18102         val="$undef"
18103 fi
18104 set d_shm
18105 eval $setvar
18106
18107 : see if we have sigaction
18108 echo " "
18109 if set sigaction val -f d_sigaction; eval $csym; $val; then
18110         echo 'sigaction() found.' >&4
18111         $cat > try.c <<EOP
18112 #include <stdio.h>
18113 #include <sys/types.h>
18114 #include <signal.h>
18115 #$i_stdlib I_STDLIB
18116 #ifdef I_STDLIB
18117 #include <stdlib.h>
18118 #endif
18119 int main()
18120 {
18121     struct sigaction act, oact;
18122     act.sa_flags = 0;
18123     oact.sa_handler = 0;
18124     /* so that act and oact are used */
18125     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18126 }
18127 EOP
18128         set try
18129         if eval $compile_ok; then
18130                 val="$define"
18131         else
18132                 echo "But you don't seem to have a usable struct sigaction." >&4
18133                 val="$undef"
18134         fi
18135 else
18136         echo 'sigaction NOT found.' >&4
18137         val="$undef"
18138 fi
18139 set d_sigaction; eval $setvar
18140 $rm_try
18141
18142 : see what type pids are declared as in the kernel
18143 rp="What is the type of process ids on this system?"
18144 set pid_t pidtype int stdio.h sys/types.h
18145 eval $typedef_ask
18146
18147 : see what type uids are declared as in the kernel
18148 echo " "
18149 echo "Looking for the type for user ids returned by getuid()."
18150 set uid_t uidtype xxx stdio.h sys/types.h
18151 eval $typedef
18152 case "$uidtype" in
18153 xxx)
18154         xxx=`./findhdr sys/user.h`
18155         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18156         case $1 in
18157         unsigned) dflt="$1 $2" ;;
18158         *) dflt="$1" ;;
18159         esac
18160         ;;
18161 *) dflt="$uidtype";;
18162 esac
18163 case "$uidtype" in
18164 uid_t)  echo "uid_t found." ;;
18165 *)      rp="What is the type for user ids returned by getuid()?"
18166         . ./myread
18167         uidtype="$ans"
18168         ;;
18169 esac
18170
18171 : Define hasfield_t macro for Configure internal use
18172 hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
18173 while $test $# -ge 2; do
18174     case "$1" in
18175         $define) echo "#include <$2>";;
18176     esac ;
18177     shift 2;
18178 done > try.c;
18179 echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
18180 set try;
18181 if eval $compile; then
18182         val="$define";
18183 else
18184         val="$undef";
18185 fi;
18186 set $varname;
18187 eval $setvar;
18188 $rm_try'
18189
18190 : see what siginfo fields we have
18191 case "$d_sigaction" in
18192 "$define")
18193         echo "Checking if your siginfo_t has si_errno field...">&4
18194         set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
18195         eval $hasfield_t;
18196
18197         echo "Checking if your siginfo_t has si_pid field...">&4
18198         set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
18199         eval $hasfield_t;
18200
18201         echo "Checking if your siginfo_t has si_uid field...">&4
18202         set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
18203         eval $hasfield_t;
18204
18205         echo "Checking if your siginfo_t has si_addr field...">&4
18206         set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
18207         eval $hasfield_t;
18208
18209         echo "Checking if your siginfo_t has si_status field...">&4
18210         set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
18211         eval $hasfield_t;
18212
18213         echo "Checking if your siginfo_t has si_band field...">&4
18214         set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
18215         eval $hasfield_t;
18216
18217         echo "Checking if your siginfo_t has si_value field...">&4
18218         set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
18219         eval $hasfield_t;
18220
18221         echo "Checking if your siginfo_t has si_fd field...">&4
18222         set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
18223         eval $hasfield_t;
18224
18225         ;;
18226 *)
18227         d_siginfo_si_errno="$undef"
18228         d_siginfo_si_pid="$undef"
18229         d_siginfo_si_uid="$undef"
18230         d_siginfo_si_addr="$undef"
18231         d_siginfo_si_status="$undef"
18232         d_siginfo_si_band="$undef"
18233         d_siginfo_si_value="$undef"
18234         d_siginfo_si_fd="$undef"
18235         ;;
18236 esac
18237
18238 : see if this is a sunmath.h system
18239 set sunmath.h i_sunmath
18240 eval $inhdr
18241
18242 : see if signbit exists
18243 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18244 $cat >try.c <<EOCP
18245 #$i_sunmath I_SUNMATH
18246 #include <math.h>
18247 #ifdef I_SUNMATH  /* Solaris special math library */
18248 #  include <sunmath.h>
18249 #endif
18250 #define NV $nvtype
18251 int main(int argc, char **argv)
18252 {
18253     NV x = 0.0;
18254     NV y = -1.0;
18255     if ((signbit(x) == 0) && (signbit(y) != 0))
18256         return 0;
18257     else
18258         return 1;
18259 }
18260 EOCP
18261 val="$undef"
18262 set try
18263 if eval $compile; then
18264     if $run ./try; then
18265         $echo "Yes." >&4
18266         val="$define"
18267     else
18268         $echo "Signbit seems to be available, but doesn't work as I expected."
18269         $echo "I won't use it." >&4
18270         val="$undef"
18271     fi
18272 else
18273     $echo "Nope." >&4
18274     dflt="$undef"
18275 fi
18276 set d_signbit
18277 eval $setvar
18278 $rm_try
18279
18280 : see if sigprocmask exists
18281 set sigprocmask d_sigprocmask
18282 eval $inlibc
18283
18284 : see if sigsetjmp exists
18285 echo " "
18286 case "$d_sigsetjmp" in
18287 '')
18288         $cat >try.c <<EOP
18289 #include <setjmp.h>
18290 #$i_stdlib I_STDLIB
18291 #ifdef I_STDLIB
18292 #include <stdlib.h>
18293 #endif
18294 sigjmp_buf env;
18295 int set = 1;
18296 int main()
18297 {
18298         if (sigsetjmp(env,1))
18299                 exit(set);
18300         set = 0;
18301         siglongjmp(env, 1);
18302         exit(1);
18303 }
18304 EOP
18305         set try
18306         if eval $compile; then
18307                 if $run ./try >/dev/null 2>&1; then
18308                         echo "POSIX sigsetjmp found." >&4
18309                         val="$define"
18310                 else
18311                         $cat >&4 <<EOM
18312 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18313 I'll ignore them.
18314 EOM
18315                         val="$undef"
18316                 fi
18317         else
18318                 echo "sigsetjmp not found." >&4
18319                 val="$undef"
18320         fi
18321         ;;
18322 *) val="$d_sigsetjmp"
18323         case "$d_sigsetjmp" in
18324         $define) echo "POSIX sigsetjmp found." >&4;;
18325         $undef) echo "sigsetjmp not found." >&4;;
18326         esac
18327         ;;
18328 esac
18329 set d_sigsetjmp
18330 eval $setvar
18331 $rm_try
18332
18333 : see if sockatmark exists
18334 set sockatmark d_sockatmark
18335 eval $inlibc
18336
18337 : see if prototype for sockatmark is available
18338 echo " "
18339 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18340 eval $hasproto
18341
18342 : see if socks5_init exists
18343 set socks5_init d_socks5_init
18344 eval $inlibc
18345
18346 : see if srand48_r exists
18347 set srand48_r d_srand48_r
18348 eval $inlibc
18349 case "$d_srand48_r" in
18350 "$define")
18351         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18352         case "$d_srand48_r_proto:$usethreads" in
18353         ":define")      d_srand48_r_proto=define
18354                 set d_srand48_r_proto srand48_r $hdrs
18355                 eval $hasproto ;;
18356         *)      ;;
18357         esac
18358         case "$d_srand48_r_proto" in
18359         define)
18360         case "$srand48_r_proto" in
18361         ''|0) try='int srand48_r(long, struct drand48_data*);'
18362         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18363         esac
18364         case "$srand48_r_proto" in
18365         ''|0)   d_srand48_r=undef
18366                 srand48_r_proto=0
18367                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18368         * )     case "$srand48_r_proto" in
18369                 REENTRANT_PROTO*) ;;
18370                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18371                 esac
18372                 echo "Prototype: $try" ;;
18373         esac
18374         ;;
18375         *)      case "$usethreads" in
18376                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18377                 esac
18378                 d_srand48_r=undef
18379                 srand48_r_proto=0
18380                 ;;
18381         esac
18382         ;;
18383 *)      srand48_r_proto=0
18384         ;;
18385 esac
18386
18387 : see if srandom_r exists
18388 set srandom_r d_srandom_r
18389 eval $inlibc
18390 case "$d_srandom_r" in
18391 "$define")
18392         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18393         case "$d_srandom_r_proto:$usethreads" in
18394         ":define")      d_srandom_r_proto=define
18395                 set d_srandom_r_proto srandom_r $hdrs
18396                 eval $hasproto ;;
18397         *)      ;;
18398         esac
18399         case "$d_srandom_r_proto" in
18400         define)
18401         case "$srandom_r_proto" in
18402         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18403         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18404         esac
18405         case "$srandom_r_proto" in
18406         ''|0)   d_srandom_r=undef
18407                 srandom_r_proto=0
18408                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18409         * )     case "$srandom_r_proto" in
18410                 REENTRANT_PROTO*) ;;
18411                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18412                 esac
18413                 echo "Prototype: $try" ;;
18414         esac
18415         ;;
18416         *)      case "$usethreads" in
18417                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18418                 esac
18419                 d_srandom_r=undef
18420                 srandom_r_proto=0
18421                 ;;
18422         esac
18423         ;;
18424 *)      srandom_r_proto=0
18425         ;;
18426 esac
18427
18428 : see if prototype for setresgid is available
18429 echo " "
18430 set d_sresgproto setresgid $i_unistd unistd.h
18431 eval $hasproto
18432
18433 : see if prototype for setresuid is available
18434 echo " "
18435 set d_sresuproto setresuid $i_unistd unistd.h
18436 eval $hasproto
18437
18438 : see if stat exists
18439 set stat d_stat
18440 eval $inlibc
18441
18442 : see if sys/stat.h is available
18443 set sys/stat.h i_sysstat
18444 eval $inhdr
18445
18446 : see if stat knows about block sizes
18447 echo " "
18448 echo "Checking to see if your struct stat has st_blocks field..." >&4
18449 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18450 eval $hasfield
18451
18452 : see if this is a sys/vfs.h system
18453 set sys/vfs.h i_sysvfs
18454 eval $inhdr
18455
18456 : see if this is a sys/statfs.h system
18457 set sys/statfs.h i_sysstatfs
18458 eval $inhdr
18459
18460 : Check for statfs_s
18461 echo " "
18462 echo "Checking to see if your system supports struct statfs..." >&4
18463 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
18464 eval $hasstruct
18465 case "$d_statfs_s" in
18466 "$define")      echo "Yes, it does."   ;;
18467 *)              echo "No, it doesn't." ;;
18468 esac
18469
18470
18471 : see if struct statfs knows about f_flags
18472 case "$d_statfs_s" in
18473 define)
18474         echo " "
18475         echo "Checking to see if your struct statfs has f_flags field..." >&4
18476         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
18477         eval $hasfield
18478         ;;
18479 *)      val="$undef"
18480         set d_statfs_f_flags
18481         eval $setvar
18482         ;;
18483 esac
18484 case "$d_statfs_f_flags" in
18485 "$define")      echo "Yes, it does."   ;;
18486 *)              echo "No, it doesn't." ;;
18487 esac
18488
18489 : see what flavor, if any, of static inline is supported
18490 echo " "
18491 echo "Checking to see if your system supports static inline..."
18492 $cat > try.c <<'EOCP'
18493 #include <stdlib.h>
18494 extern int f_via_a(int x);
18495 extern int f_via_b(int x);
18496 int main(int argc, char **argv)
18497 {
18498     int y;
18499
18500     y = f_via_a(0);
18501 #ifdef USE_B
18502     y = f_via_b(0);
18503 #endif
18504     if (y == 42) {
18505         return EXIT_SUCCESS;
18506     }
18507     else {
18508         return EXIT_FAILURE;
18509     }
18510 }
18511 EOCP
18512 $cat > a.c <<'EOCP'
18513 static INLINE int f(int x) {
18514     int y;
18515     y = x + 42;
18516     return y;
18517 }
18518
18519 int f_via_a(int x)
18520 {
18521     return f(x);
18522 }
18523 EOCP
18524 $cat > b.c <<'EOCP'
18525 extern int f(int x);
18526
18527 int f_via_b(int x)
18528 {
18529     return f(x);
18530 }
18531 EOCP
18532
18533 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18534 case "$perl_static_inline" in
18535 '')     # Check the various possibilities, and break out on success.
18536         # For gcc, prefer __inline__, which will still permit
18537         # cflags.SH to add in -ansi.
18538         case "$gccversion" in
18539                 '') xxx="inline __inline__ __inline _inline";;
18540                 *)  xxx="__inline__ inline __inline _inline";;
18541         esac
18542         for inline in $xxx; do
18543                 set try -DINLINE=$inline a.c
18544                 if eval $compile && $run ./try; then
18545                         # Now make sure there is no external linkage of static
18546                         # functions
18547                         set try -DINLINE=$inline -DUSE_B a.c b.c
18548                         if eval $compile && $run ./try; then
18549                                 $echo "Your compiler supports static $inline, " >&4
18550                                 $echo "but it also creates an external definition," >&4
18551                                 $echo "so I won't use it." >&4
18552                                 val=$undef
18553                         else
18554                                 $echo "Your compiler supports static $inline." >&4
18555                                 val=$define
18556                                 perl_static_inline="static $inline";
18557                                 break;
18558                         fi
18559                 else
18560                         $echo "Your compiler does NOT support static $inline." >&4
18561                         val="$undef"
18562                 fi
18563         done
18564         ;;
18565 *inline*) # Some variant of inline exists.
18566         echo "Keeping your $hint value of $perl_static_inline."
18567         val=$define
18568         ;;
18569 static)  # No inline capabilities
18570         echo "Keeping your $hint value of $perl_static_inline."
18571         val=$undef
18572         ;;
18573 *)  # Unrecognized previous value -- blindly trust the supplied
18574         # value and hope it makes sense.  Use old value for
18575         # d_static_inline, if there is one.
18576         echo "Keeping your $hint value of $perl_static_inline."
18577         case "$d_static_inline" in
18578                 '') val=$define ;;
18579                 *)  val=$d_static_inline ;;
18580         esac
18581         ;;
18582 esac
18583 # Fallback to plain 'static' if nothing worked.
18584 case "$perl_static_inline" in
18585 '')
18586         perl_static_inline="static"
18587         val=$undef
18588         ;;
18589 esac
18590 set d_static_inline
18591 eval $setvar
18592 $rm -f a.[co] b.[co]
18593 $rm_try
18594
18595 : Check stream access
18596 $cat >&4 <<EOM
18597 Checking how to access stdio streams by file descriptor number...
18598 EOM
18599 case "$stdio_stream_array" in
18600 '')     $cat >try.c <<EOCP
18601 #include <stdio.h>
18602 int main() {
18603   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18604     printf("yes\n");
18605 }
18606 EOCP
18607         for s in _iob __iob __sF
18608         do
18609                 set try -DSTDIO_STREAM_ARRAY=$s
18610                 if eval $compile; then
18611                         case "`$run ./try`" in
18612                         yes)    stdio_stream_array=$s; break ;;
18613                         esac
18614                 fi
18615         done
18616         $rm_try
18617 esac
18618 case "$stdio_stream_array" in
18619 '')     $cat >&4 <<EOM
18620 I can't figure out how to access stdio streams by file descriptor number.
18621 EOM
18622         d_stdio_stream_array="$undef"
18623         ;;
18624 *)      $cat >&4 <<EOM
18625 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18626 EOM
18627         d_stdio_stream_array="$define"
18628         ;;
18629 esac
18630
18631 : see if strcoll exists
18632 set strcoll d_strcoll
18633 eval $inlibc
18634
18635 : see if strerror_l exists
18636 set strerror_l d_strerror_l
18637 eval $inlibc
18638
18639 : see if strerror_r exists
18640 set strerror_r d_strerror_r
18641 eval $inlibc
18642 case "$d_strerror_r" in
18643 "$define")
18644         hdrs="$i_systypes sys/types.h define stdio.h define string.h"
18645         case "$d_strerror_r_proto:$usethreads" in
18646         ":define")      d_strerror_r_proto=define
18647                 set d_strerror_r_proto strerror_r $hdrs
18648                 eval $hasproto ;;
18649         *)      ;;
18650         esac
18651         case "$d_strerror_r_proto" in
18652         define)
18653         case "$strerror_r_proto" in
18654         ''|0) try='int strerror_r(int, char*, size_t);'
18655         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18656         esac
18657         case "$strerror_r_proto" in
18658         ''|0) try='int strerror_r(int, char*, int);'
18659         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18660         esac
18661         case "$strerror_r_proto" in
18662         ''|0) try='char* strerror_r(int, char*, size_t);'
18663         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18664         esac
18665         case "$strerror_r_proto" in
18666         ''|0)   d_strerror_r=undef
18667                 strerror_r_proto=0
18668                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18669         * )     case "$strerror_r_proto" in
18670                 REENTRANT_PROTO*) ;;
18671                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18672                 esac
18673                 echo "Prototype: $try" ;;
18674         esac
18675         ;;
18676         *)      case "$usethreads" in
18677                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18678                 esac
18679                 d_strerror_r=undef
18680                 strerror_r_proto=0
18681                 ;;
18682         esac
18683         ;;
18684 *)      strerror_r_proto=0
18685         ;;
18686 esac
18687
18688 : see if strftime exists
18689 set strftime d_strftime
18690 eval $inlibc
18691
18692 : see if strlcat exists
18693 set strlcat d_strlcat
18694 eval $inlibc
18695
18696 : see if strlcpy exists
18697 set strlcpy d_strlcpy
18698 eval $inlibc
18699
18700 : see if strnlen exists
18701 set strnlen d_strnlen
18702 eval $inlibc
18703
18704 : see if strtod exists
18705 set strtod d_strtod
18706 eval $inlibc
18707
18708 : see if strtol exists
18709 set strtol d_strtol
18710 eval $inlibc
18711
18712 : see if strtold exists
18713 set strtold d_strtold
18714 eval $inlibc
18715
18716 : see if strtold_l exists
18717 set strtold_l d_strtold_l
18718 eval $inlibc
18719
18720 : see if strtoll exists
18721 set strtoll d_strtoll
18722 eval $inlibc
18723
18724 case "$d_longlong-$d_strtoll" in
18725 "$define-$define")
18726         $cat <<EOM
18727 Checking whether your strtoll() works okay...
18728 EOM
18729         $cat >try.c <<'EOCP'
18730 #include <errno.h>
18731 #ifdef __hpux
18732 #define strtoll __strtoll
18733 #endif
18734 #ifdef __EMX__
18735 #define strtoll _strtoll
18736 #endif
18737 #include <stdio.h>
18738 extern long long int strtoll(char *s, char **, int);
18739 static int bad = 0;
18740 int check(char *s, long long ell, int een) {
18741         long long gll;
18742         errno = 0;
18743         gll = strtoll(s, 0, 10);
18744         if (!((gll == ell) && (errno == een)))
18745                 bad++;
18746 }
18747 int main() {
18748         check(" 1",                                      1LL, 0);
18749         check(" 0",                                      0LL, 0);
18750         check("-1",                                     -1LL, 0);
18751         check("-9223372036854775808", -9223372036854775808LL, 0);
18752         check("-9223372036854775808", -9223372036854775808LL, 0);
18753         check(" 9223372036854775807",  9223372036854775807LL, 0);
18754         check("-9223372036854775808", -9223372036854775808LL, 0);
18755         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18756         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18757         if (!bad)
18758                 printf("ok\n");
18759 }
18760 EOCP
18761         set try
18762         if eval $compile; then
18763                 yyy=`$run ./try`
18764                 case "$yyy" in
18765                 ok) echo "Your strtoll() seems to be working okay." ;;
18766                 *) cat <<EOM >&4
18767 Your strtoll() doesn't seem to be working okay.
18768 EOM
18769                    d_strtoll="$undef"
18770                    ;;
18771                 esac
18772         else
18773                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18774                 d_strtoll="$undef"
18775         fi
18776         ;;
18777 esac
18778
18779 : see if strtoq exists
18780 set strtoq d_strtoq
18781 eval $inlibc
18782
18783 : see if strtoul exists
18784 set strtoul d_strtoul
18785 eval $inlibc
18786
18787 case "$d_strtoul" in
18788 "$define")
18789         $cat <<EOM
18790 Checking whether your strtoul() works okay...
18791 EOM
18792         $cat >try.c <<'EOCP'
18793 #include <errno.h>
18794 #include <stdio.h>
18795 extern unsigned long int strtoul(char *s, char **, int);
18796 static int bad = 0;
18797 void check(char *s, unsigned long eul, int een) {
18798         unsigned long gul;
18799         errno = 0;
18800         gul = strtoul(s, 0, 10);
18801         if (!((gul == eul) && (errno == een)))
18802                 bad++;
18803 }
18804 int main() {
18805         check(" 1", 1L, 0);
18806         check(" 0", 0L, 0);
18807 EOCP
18808         case "$longsize" in
18809         8)
18810             $cat >>try.c <<'EOCP'
18811         check("18446744073709551615", 18446744073709551615UL, 0);
18812         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18813 #if 0 /* strtoul() for /^-/ strings is undefined. */
18814         check("-1", 18446744073709551615UL, 0);
18815         check("-18446744073709551614", 2, 0);
18816         check("-18446744073709551615", 1, 0);
18817         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18818         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18819 #endif
18820 EOCP
18821                 ;;
18822         4)
18823                     $cat >>try.c <<'EOCP'
18824         check("4294967295", 4294967295UL, 0);
18825         check("4294967296", 4294967295UL, ERANGE);
18826 #if 0 /* strtoul() for /^-/ strings is undefined. */
18827         check("-1", 4294967295UL, 0);
18828         check("-4294967294", 2, 0);
18829         check("-4294967295", 1, 0);
18830         check("-4294967296", 4294967295UL, ERANGE);
18831         check("-4294967297", 4294967295UL, ERANGE);
18832 #endif
18833 EOCP
18834                 ;;
18835         *)
18836 : Should we write these tests to be more portable by sprintf-ing
18837 : ~0 and then manipulating that char string as input for strtol?
18838                 ;;
18839         esac
18840         $cat >>try.c <<'EOCP'
18841         if (!bad)
18842                 printf("ok\n");
18843         return 0;
18844 }
18845 EOCP
18846         set try
18847         if eval $compile; then
18848                 case "`$run ./try`" in
18849                 ok) echo "Your strtoul() seems to be working okay." ;;
18850                 *) cat <<EOM >&4
18851 Your strtoul() doesn't seem to be working okay.
18852 EOM
18853                    d_strtoul="$undef"
18854                    ;;
18855                 esac
18856         else
18857                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18858                 d_strtoul="$undef"
18859         fi
18860         ;;
18861 esac
18862
18863 : see if strtoull exists
18864 set strtoull d_strtoull
18865 eval $inlibc
18866
18867 case "$d_longlong-$d_strtoull" in
18868 "$define-$define")
18869         $cat <<EOM
18870 Checking whether your strtoull() works okay...
18871 EOM
18872         $cat >try.c <<'EOCP'
18873 #include <errno.h>
18874 #ifdef __hpux
18875 #define strtoull __strtoull
18876 #endif
18877 #include <stdio.h>
18878 extern unsigned long long int strtoull(char *s, char **, int);
18879 static int bad = 0;
18880 int check(char *s, long long eull, int een) {
18881         long long gull;
18882         errno = 0;
18883         gull = strtoull(s, 0, 10);
18884         if (!((gull == eull) && (errno == een)))
18885                 bad++;
18886 }
18887 int main() {
18888         check(" 1",                                        1LL, 0);
18889         check(" 0",                                        0LL, 0);
18890         check("18446744073709551615",  18446744073709551615ULL, 0);
18891         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18892 #if 0 /* strtoull() for /^-/ strings is undefined. */
18893         check("-1",                    18446744073709551615ULL, 0);
18894         check("-18446744073709551614",                     2LL, 0);
18895         check("-18446744073709551615",                     1LL, 0);
18896         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18897         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18898 #endif
18899         if (!bad)
18900                 printf("ok\n");
18901 }
18902 EOCP
18903         set try
18904         if eval $compile; then
18905                 case "`$run ./try`" in
18906                 ok) echo "Your strtoull() seems to be working okay." ;;
18907                 *) cat <<EOM >&4
18908 Your strtoull() doesn't seem to be working okay.
18909 EOM
18910                    d_strtoull="$undef"
18911                    ;;
18912                 esac
18913         else
18914                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18915                 d_strtoull="$undef"
18916         fi
18917         ;;
18918 esac
18919
18920 : see if strtouq exists
18921 set strtouq d_strtouq
18922 eval $inlibc
18923
18924 case "$d_strtouq" in
18925 "$define")
18926         $cat <<EOM
18927 Checking whether your strtouq() works okay...
18928 EOM
18929         $cat >try.c <<'EOCP'
18930 #include <errno.h>
18931 #include <stdio.h>
18932 extern unsigned long long int strtouq(char *s, char **, int);
18933 static int bad = 0;
18934 void check(char *s, unsigned long long eull, int een) {
18935         unsigned long long gull;
18936         errno = 0;
18937         gull = strtouq(s, 0, 10);
18938         if (!((gull == eull) && (errno == een)))
18939                 bad++;
18940 }
18941 int main() {
18942         check(" 1",                                        1LL, 0);
18943         check(" 0",                                        0LL, 0);
18944         check("18446744073709551615",  18446744073709551615ULL, 0);
18945         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18946 #if 0 /* strtouq() for /^-/ strings is undefined. */
18947         check("-1",                    18446744073709551615ULL, 0);
18948         check("-18446744073709551614",                     2LL, 0);
18949         check("-18446744073709551615",                     1LL, 0);
18950         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18951         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18952 #endif
18953         if (!bad)
18954                 printf("ok\n");
18955         return 0;
18956 }
18957 EOCP
18958         set try
18959         if eval $compile; then
18960                 case "`$run ./try`" in
18961                 ok) echo "Your strtouq() seems to be working okay." ;;
18962                 *) cat <<EOM >&4
18963 Your strtouq() doesn't seem to be working okay.
18964 EOM
18965                    d_strtouq="$undef"
18966                    ;;
18967                 esac
18968         else
18969                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18970                 d_strtouq="$undef"
18971         fi
18972         ;;
18973 esac
18974
18975 : see if strxfrm exists
18976 set strxfrm d_strxfrm
18977 eval $inlibc
18978
18979 : see if symlink exists
18980 set symlink d_symlink
18981 eval $inlibc
18982
18983 : see if syscall exists
18984 set syscall d_syscall
18985 eval $inlibc
18986
18987 : see if prototype for syscall is available
18988 echo " "
18989 set d_syscallproto syscall $i_unistd unistd.h
18990 eval $hasproto
18991
18992 : see if sysconf exists
18993 set sysconf d_sysconf
18994 eval $inlibc
18995
18996 : see if sys_errlist[] exists
18997 echo " "
18998 if test "X$d_syserrlst" = X; then
18999         if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19000                 echo "You have sys_errlist[], so we could roll our own strerror."
19001                 d_syserrlst="$define"
19002         else
19003                 echo "You don't have sys_errlist[], so strerror() is welcome."
19004                 d_syserrlst="$undef"
19005         fi
19006 fi
19007
19008 : see if system exists
19009 set system d_system
19010 eval $inlibc
19011
19012 : see if tcgetpgrp exists
19013 set tcgetpgrp d_tcgetpgrp
19014 eval $inlibc
19015
19016 : see if tcsetpgrp exists
19017 set tcsetpgrp d_tcsetpgrp
19018 eval $inlibc
19019
19020 : see if prototype for telldir is available
19021 echo " "
19022 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19023 eval $hasproto
19024
19025 : see if tgamma exists
19026 set tgamma d_tgamma
19027 eval $inlibc
19028
19029 : check for thread_safe_nl_langinfo_l item
19030 $cat <<EOM
19031
19032 Checking to see if you have nl_langinfo_l() and that it is thread-safe
19033 EOM
19034 $cat >try.c <<EOCP
19035 #$i_stdlib I_STDLIB
19036 #ifdef I_STDLIB
19037 #  include <stdlib.h>
19038 #endif
19039 #include <string.h>
19040 #$i_langinfo I_LANGINFO
19041 #ifdef I_LANGINFO
19042 #  include <langinfo.h>
19043 #endif
19044 #$i_pthread I_PTHREAD
19045 #ifdef I_PTHREAD
19046 #  include <pthread.h>
19047 #endif
19048 #$i_locale I_LOCALE
19049 #ifdef I_LOCALE
19050 #  include <locale.h>
19051 #endif
19052
19053 void *
19054 thread_start(void * arg)
19055 {
19056     nl_langinfo(RADIXCHAR);
19057 }
19058
19059 int main() {
19060     char * main_buffer;
19061     char save_main_buffer[1000];
19062     pthread_t subthread;
19063     pthread_attr_t attr;
19064
19065     main_buffer = nl_langinfo_l(CODESET, newlocale(LC_ALL_MASK, "C", 0));
19066
19067     /* If too large for our generous allowance, just assume we don't have
19068      * it. */
19069     if (strlen(main_buffer) >= sizeof(save_main_buffer)) {
19070         exit(1);
19071     }
19072
19073     strcpy(save_main_buffer, main_buffer);
19074
19075     if (pthread_attr_init(&attr) != 0) {
19076         exit(1);
19077     }
19078
19079     if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) {
19080         exit(1);
19081     }
19082
19083     if (pthread_join(subthread, NULL) != 0) {
19084         exit(1);
19085     }
19086
19087     exit(! (strcmp(main_buffer, save_main_buffer) == 0));
19088 }
19089 EOCP
19090 case "$usethreads" in
19091     define)
19092         set try
19093         if eval $compile; then
19094             echo "Your system has nl_langinfo_l()..." >&4
19095             if $run ./try; then
19096                 echo "and it is thread-safe (just as I'd hoped)." >&4
19097                 d_thread_safe_nl_langinfo_l="$define"
19098                 echo "$d_thread_safe_nl_langinfo_l" >&4
19099             else
19100                 echo "but it isn't thread-safe, so we won't use it." >&4
19101             fi
19102         else
19103             echo "your system does not have nl_langinfo_l()" >&4
19104         fi
19105         ;;
19106     *) echo "Since threads aren't selected, we won't bother looking for nl_langinfo_l()" >&4
19107 esac
19108 if test X"$d_thread_safe_nl_langinfo_l" = X; then
19109         d_thread_safe_nl_langinfo_l="$undef"
19110 fi
19111 $rm_try
19112
19113 : see if time exists
19114 echo " "
19115 if test "X$d_time" = X -o X"$timetype" = X; then
19116     if set time val -f d_time; eval $csym; $val; then
19117                 echo 'time() found.' >&4
19118                 val="$define"
19119                 rp="What is the type returned by time() on this system?"
19120                 set time_t timetype long stdio.h sys/types.h
19121                 eval $typedef_ask
19122     else
19123                 echo 'time() not found, hope that will do.' >&4
19124                 val="$undef"
19125                 timetype='int';
19126     fi
19127     set d_time
19128     eval $setvar
19129 fi
19130
19131 : see if timegm exists
19132 set timegm d_timegm
19133 eval $inlibc
19134
19135 : see if this is a sys/times.h system
19136 set sys/times.h i_systimes
19137 eval $inhdr
19138
19139 : see if times exists
19140 echo " "
19141 if set times val -f d_times; eval $csym; $val; then
19142         echo 'times() found.' >&4
19143         d_times="$define"
19144         inc=''
19145         case "$i_systimes" in
19146         "$define") inc='sys/times.h';;
19147         esac
19148         rp="What is the type returned by times() on this system?"
19149         set clock_t clocktype long stdio.h sys/types.h $inc
19150         eval $typedef_ask
19151 else
19152         echo 'times() NOT found, hope that will do.' >&4
19153         d_times="$undef"
19154         clocktype='int'
19155 fi
19156
19157 : see if tmpnam_r exists
19158 set tmpnam_r d_tmpnam_r
19159 eval $inlibc
19160 case "$d_tmpnam_r" in
19161 "$define")
19162         hdrs="$i_systypes sys/types.h define stdio.h "
19163         case "$d_tmpnam_r_proto:$usethreads" in
19164         ":define")      d_tmpnam_r_proto=define
19165                 set d_tmpnam_r_proto tmpnam_r $hdrs
19166                 eval $hasproto ;;
19167         *)      ;;
19168         esac
19169         case "$d_tmpnam_r_proto" in
19170         define)
19171         case "$tmpnam_r_proto" in
19172         ''|0) try='char* tmpnam_r(char*);'
19173         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19174         esac
19175         case "$tmpnam_r_proto" in
19176         ''|0)   d_tmpnam_r=undef
19177                 tmpnam_r_proto=0
19178                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19179         * )     case "$tmpnam_r_proto" in
19180                 REENTRANT_PROTO*) ;;
19181                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19182                 esac
19183                 echo "Prototype: $try" ;;
19184         esac
19185         ;;
19186         *)      case "$usethreads" in
19187                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19188                 esac
19189                 d_tmpnam_r=undef
19190                 tmpnam_r_proto=0
19191                 ;;
19192         esac
19193         ;;
19194 *)      tmpnam_r_proto=0
19195         ;;
19196 esac
19197
19198 : see if trunc exists
19199 set trunc d_trunc
19200 eval $inlibc
19201
19202 : see if truncate exists
19203 set truncate d_truncate
19204 eval $inlibc
19205
19206 : see if ttyname_r exists
19207 set ttyname_r d_ttyname_r
19208 eval $inlibc
19209 case "$d_ttyname_r" in
19210 "$define")
19211         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19212         case "$d_ttyname_r_proto:$usethreads" in
19213         ":define")      d_ttyname_r_proto=define
19214                 set d_ttyname_r_proto ttyname_r $hdrs
19215                 eval $hasproto ;;
19216         *)      ;;
19217         esac
19218         case "$d_ttyname_r_proto" in
19219         define)
19220         case "$ttyname_r_proto" in
19221         ''|0) try='int ttyname_r(int, char*, size_t);'
19222         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19223         esac
19224         case "$ttyname_r_proto" in
19225         ''|0) try='int ttyname_r(int, char*, int);'
19226         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19227         esac
19228         case "$ttyname_r_proto" in
19229         ''|0) try='char* ttyname_r(int, char*, int);'
19230         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19231         esac
19232         case "$ttyname_r_proto" in
19233         ''|0)   d_ttyname_r=undef
19234                 ttyname_r_proto=0
19235                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19236         * )     case "$ttyname_r_proto" in
19237                 REENTRANT_PROTO*) ;;
19238                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19239                 esac
19240                 echo "Prototype: $try" ;;
19241         esac
19242         ;;
19243         *)      case "$usethreads" in
19244                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19245                 esac
19246                 d_ttyname_r=undef
19247                 ttyname_r_proto=0
19248                 ;;
19249         esac
19250         ;;
19251 *)      ttyname_r_proto=0
19252         ;;
19253 esac
19254
19255 : see if tzname[] exists
19256 echo " "
19257 if set tzname val -a d_tzname; eval $csym; $val; then
19258         val="$define"
19259         echo 'tzname[] found.' >&4
19260 else
19261         val="$undef"
19262         echo 'tzname[] NOT found.' >&4
19263 fi
19264 set d_tzname
19265 eval $setvar
19266
19267 : Check if is a multiplatform env
19268 case "$osname" in
19269 darwin) multiarch="$define" ;;
19270 esac
19271 case "$multiarch" in
19272 ''|[nN]*) multiarch="$undef" ;;
19273 esac
19274
19275 : check for ordering of bytes in a UV
19276 echo " "
19277 case "$multiarch" in
19278 *$define*)
19279         $cat <<EOM
19280 You seem to be doing a multiarchitecture build,
19281 skipping the byteorder check.
19282
19283 EOM
19284         byteorder='ffff'
19285         ;;
19286 *)
19287         case "$byteorder" in
19288         '')
19289                 $cat <<'EOM'
19290 In the following, larger digits indicate more significance.  A big-endian
19291 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19292 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19293 machines may have weird orders like 3412.  A Cray will report 87654321,
19294 an Alpha will report 12345678. If the test program works the default is
19295 probably right.
19296 I'm now running the test program...
19297 EOM
19298                 $cat >try.c <<EOCP
19299 #include <stdio.h>
19300 #$i_stdlib I_STDLIB
19301 #ifdef I_STDLIB
19302 #include <stdlib.h>
19303 #endif
19304 #include <sys/types.h>
19305 typedef $uvtype UV;
19306 int main()
19307 {
19308         int i;
19309         union {
19310                 UV l;
19311                 char c[$uvsize];
19312         } u;
19313
19314         if ($uvsize > 4)
19315                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19316         else
19317                 u.l = (UV)0x04030201;
19318         for (i = 0; i < $uvsize; i++)
19319                 printf("%c", u.c[i]+'0');
19320         printf("\n");
19321         exit(0);
19322 }
19323 EOCP
19324                 xxx_prompt=y
19325                 set try
19326                 if eval $compile && $run ./try > /dev/null; then
19327                         dflt=`$run ./try`
19328                         case "$dflt" in
19329                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19330                                 echo "(The test program ran ok.)"
19331                                 echo "byteorder=$dflt"
19332                                 xxx_prompt=n
19333                         ;;
19334                         ????|????????) echo "(The test program ran ok.)" ;;
19335                         *) echo "(The test program didn't run right for some reason.)" ;;
19336                         esac
19337                 else
19338                         dflt='4321'
19339                         cat <<'EOM'
19340 (I can't seem to compile the test program.  Guessing big-endian...)
19341 EOM
19342                 fi
19343                 case "$xxx_prompt" in
19344                 y)
19345                         rp="What is the order of bytes in $uvtype?"
19346                         . ./myread
19347                         byteorder="$ans"
19348                         ;;
19349                 *)      byteorder=$dflt
19350                         ;;
19351                 esac
19352                 ;;
19353         esac
19354         $rm_try
19355         ;;
19356 esac
19357
19358 : Checking 32bit alignedness
19359 $cat <<EOM
19360
19361 Checking to see whether you can access character data unalignedly...
19362 EOM
19363 case "$d_u32align" in
19364 '')   $cat >try.c <<EOCP
19365 #include <stdio.h>
19366 #$i_stdlib I_STDLIB
19367 #ifdef I_STDLIB
19368 #include <stdlib.h>
19369 #endif
19370 #define U32 $u32type
19371 #define BYTEORDER 0x$byteorder
19372 #define U8 $u8type
19373 #include <signal.h>
19374 #ifdef SIGBUS
19375 $signal_t bletch(int s) { exit(4); }
19376 #endif
19377 int main() {
19378 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19379     volatile U8 buf[8];
19380     volatile U32 *up;
19381     int i;
19382
19383     if (sizeof(U32) != 4) {
19384         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19385         exit(1);
19386     }
19387
19388     fflush(stdout);
19389
19390 #ifdef SIGBUS
19391     signal(SIGBUS, bletch);
19392 #endif
19393
19394     buf[0] = 0;
19395     buf[1] = 0;
19396     buf[2] = 0;
19397     buf[3] = 1;
19398     buf[4] = 0;
19399     buf[5] = 0;
19400     buf[6] = 0;
19401     buf[7] = 1;
19402
19403     for (i = 0; i < 4; i++) {
19404         up = (U32*)(buf + i);
19405         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19406                (*up == 1 << (8*(3-i)))  /* little-endian */
19407               )
19408            )
19409         {
19410             printf("read failed (%x)\n", *up);
19411             exit(2);
19412         }
19413     }
19414
19415     /* write test */
19416     for (i = 0; i < 4; i++) {
19417         up = (U32*)(buf + i);
19418         *up = 0xBeef;
19419         if (*up != 0xBeef) {
19420             printf("write failed (%x)\n", *up);
19421             exit(3);
19422         }
19423     }
19424
19425     exit(0);
19426 #else
19427     printf("1\n");
19428     exit(1);
19429 #endif
19430     return 0;
19431 }
19432 EOCP
19433 set try
19434 if eval $compile_ok; then
19435         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19436         $run ./try 2>&1 >/dev/null
19437         case "$?" in
19438         0)      cat >&4 <<EOM
19439 You can access character data pretty unalignedly.
19440 EOM
19441                 d_u32align="$undef"
19442                 ;;
19443         *)      cat >&4 <<EOM
19444 It seems that you must access character data in an aligned manner.
19445 EOM
19446                 d_u32align="$define"
19447                 ;;
19448         esac
19449 else
19450         rp='Can you access character data at unaligned addresses?'
19451         dflt='n'
19452         . ./myread
19453         case "$ans" in
19454         [yY]*)  d_u32align="$undef"  ;;
19455         *)      d_u32align="$define" ;;
19456         esac
19457 fi
19458 $rm_try
19459 ;;
19460 esac
19461
19462 : see if ualarm exists
19463 set ualarm d_ualarm
19464 eval $inlibc
19465
19466 : see if umask exists
19467 set umask d_umask
19468 eval $inlibc
19469
19470 : see if unordered exists
19471 set unordered d_unordered
19472 eval $inlibc
19473
19474 : see if unsetenv exists
19475 set unsetenv d_unsetenv
19476 eval $inlibc
19477
19478 : see if usleep exists
19479 set usleep d_usleep
19480 eval $inlibc
19481
19482 : see if prototype for usleep is available
19483 echo " "
19484 set d_usleepproto usleep $i_unistd unistd.h
19485 eval $hasproto
19486
19487 : see if ustat exists
19488 set ustat d_ustat
19489 eval $inlibc
19490
19491 : see if closedir exists
19492 set closedir d_closedir
19493 eval $inlibc
19494
19495 case "$d_closedir" in
19496 "$define")
19497         echo " "
19498         echo "Checking whether closedir() returns a status..." >&4
19499         cat > try.c <<EOM
19500 #$i_dirent I_DIRENT             /**/
19501 #$i_sysdir I_SYS_DIR            /**/
19502 #$i_sysndir I_SYS_NDIR          /**/
19503 #$i_systypes I_SYS_TYPES        /**/
19504
19505 #if defined(I_SYS_TYPES)
19506 #include <sys/types.h>
19507 #endif
19508 #if defined(I_DIRENT)
19509 #include <dirent.h>
19510 #else
19511 #ifdef I_SYS_NDIR
19512 #include <sys/ndir.h>
19513 #else
19514 #ifdef I_SYS_DIR
19515 #include <sys/dir.h>
19516 #endif
19517 #endif
19518 #endif
19519 int main() { return closedir(opendir(".")); }
19520 EOM
19521         set try
19522         if eval $compile_ok; then
19523                 if $run ./try > /dev/null 2>&1 ; then
19524                         echo "Yes, it does."
19525                         val="$undef"
19526                 else
19527                         echo "No, it doesn't."
19528                         val="$define"
19529                 fi
19530         else
19531                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19532                 val="$define"
19533         fi
19534         ;;
19535 *)
19536         val="$undef";
19537         ;;
19538 esac
19539 set d_void_closedir
19540 eval $setvar
19541 $rm_try
19542
19543 : see if there is a wait4
19544 set wait4 d_wait4
19545 eval $inlibc
19546
19547 : see if waitpid exists
19548 set waitpid d_waitpid
19549 eval $inlibc
19550
19551 : look for wcscmp
19552 echo " "
19553 $cat >try.c <<'EOCP'
19554 #include <stdio.h>
19555 #include <wchar.h>
19556 int main ()
19557 {
19558     wchar_t *s = L" ";
19559     return (wcscmp (s, s) ? 1 : 0);
19560     }
19561 EOCP
19562 set try
19563 val="$undef"
19564 if eval $compile; then
19565     `$run ./try`
19566     case "$?" in
19567         0)  echo "A working wcscmp() found." >&4
19568             val="$define" ;;
19569         *)  echo "wcscmp() found, but it doesn't work" >&4
19570             ;;
19571         esac
19572 else
19573     echo "wcscmp() NOT found." >&4
19574     fi
19575 set d_wcscmp
19576 eval $setvar
19577 $rm_try
19578
19579 : see if wcstombs exists
19580 set wcstombs d_wcstombs
19581 eval $inlibc
19582
19583 : look for wcsxfrm
19584 echo " "
19585 $cat >try.c <<'EOCP'
19586 #include <errno.h>
19587 #include <wchar.h>
19588 int main ()
19589 {
19590     wchar_t dst[4], *src = L" ";
19591     errno = 0;
19592     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
19593     }
19594 EOCP
19595 set try
19596 val="$undef"
19597 if eval $compile; then
19598     `$run ./try`
19599     case "$?" in
19600         0)  echo "A working wcsxfrm() found." >&4
19601             val="$define" ;;
19602         *)  echo "wcsxfrm() found, but it doesn't work" >&4
19603             ;;
19604         esac
19605 else
19606     echo "wcsxfrm() NOT found." >&4
19607     fi
19608 set d_wcsxfrm
19609 eval $setvar
19610 $rm_try
19611
19612 : see if wctomb exists
19613 set wctomb d_wctomb
19614 eval $inlibc
19615
19616 : see if writev exists
19617 set writev d_writev
19618 eval $inlibc
19619
19620 : check for alignment requirements
19621 echo " "
19622 case "$alignbytes" in
19623     '') echo "Checking alignment constraints..." >&4
19624         $cat >try.c <<EOCP
19625 #include <stdio.h>
19626 struct foobar {
19627     char foo;
19628     $nvtype bar;
19629 } try_algn;
19630 int main()
19631 {
19632     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19633     return(0);
19634 }
19635 EOCP
19636         set try
19637         if eval $compile_ok; then
19638             dflt=`$run ./try`
19639         else
19640             dflt='8'
19641             echo "(I can't seem to compile the test program...)"
19642         fi
19643         case "$multiarch" in
19644             *$define*)
19645                 : The usual safe value is 8, but Darwin with -Duselongdouble
19646                 : needs 16.  Hence, we will take 8 as a minimum, but allow
19647                 : Configure to pick a larger value if needed.
19648                 if $test "$dflt" -lt 8; then
19649                     dflt='8'
19650                     echo "Setting alignment to 8 for multiarch support.">&4
19651                 fi
19652                 ;;
19653         esac
19654         ;;
19655     *) dflt="$alignbytes"
19656         ;;
19657 esac
19658 rp="Doubles must be aligned on a how-many-byte boundary?"
19659 . ./myread
19660 alignbytes="$ans"
19661 $rm_try
19662
19663 : set the base revision
19664 baserev=5.0
19665
19666 : length of character in bytes. Is always 1, otherwise it is not C
19667 : This used to be a test using sizeof
19668 charsize=1
19669
19670 : Check for the number of bits in a character
19671 case "$charbits" in
19672 '')     echo "Checking how long a character is (in bits)..." >&4
19673         $cat >try.c <<EOCP
19674 #include <stdio.h>
19675 int main ()
19676 {
19677     int n;
19678     unsigned char c;
19679     for (c = 1, n = 0; c; c <<= 1, n++) ;
19680     printf ("%d\n", n);
19681     return (0);
19682     }
19683 EOCP
19684         set try
19685         if eval $compile_ok; then
19686                 dflt=`$run ./try`
19687         else
19688                 dflt='8'
19689                 echo "(I can't seem to compile the test program.  Guessing...)"
19690         fi
19691         ;;
19692 *)
19693         dflt="$charbits"
19694         ;;
19695 esac
19696 rp="What is the length of a character (in bits)?"
19697 . ./myread
19698 charbits="$ans"
19699 $rm_try
19700 case "$charbits" in
19701 8)      ;;
19702 *)      cat >&4 << EOM
19703 Your system has an unsigned character size of $charbits bits, which
19704 is rather unusual (normally it is 8 bits).  Perl likely will not work
19705 correctly on your system, with subtle bugs in various places.
19706 EOM
19707         rp='Do you really want to continue?'
19708         dflt='n'
19709         . ./myread
19710         case "$ans" in
19711                 [yY])   echo >&4 "Okay, continuing."    ;;
19712                 *)      exit 1                          ;;
19713         esac
19714 esac
19715
19716 : how do we concatenate cpp tokens here?
19717 echo " "
19718 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19719 $cat >cpp_stuff.c <<'EOCP'
19720 #define RCAT(a,b)a/**/b
19721 #define ACAT(a,b)a ## b
19722 RCAT(Rei,ser)
19723 ACAT(Cir,cus)
19724 EOCP
19725 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19726 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19727         echo "Oh!  Smells like ANSI's been here." >&4
19728         echo "We can catify or stringify, separately or together!"
19729         cpp_stuff=42
19730 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19731         echo "Ah, yes!  The good old days!" >&4
19732         echo "However, in the good old days we don't know how to stringify and"
19733         echo "catify at the same time."
19734         cpp_stuff=1
19735 else
19736         $cat >&4 <<EOM
19737 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19738 You're going to have to edit the values of CAT[2-5] in config.h...
19739 EOM
19740         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19741 fi
19742 $rm -f cpp_stuff.*
19743
19744 : see if this is a db.h system
19745 set db.h i_db
19746 eval $inhdr
19747
19748 case "$i_db" in
19749 $define)
19750         : Check db version.
19751         echo " "
19752         echo "Checking Berkeley DB version ..." >&4
19753         $cat >try.c <<EOCP
19754 #$d_const HASCONST
19755 #ifndef HASCONST
19756 #define const
19757 #endif
19758 #include <sys/types.h>
19759 #include <stdio.h>
19760 #$i_stdlib I_STDLIB
19761 #ifdef I_STDLIB
19762 #include <stdlib.h>
19763 #endif
19764 #include <db.h>
19765 int main(int argc, char *argv[])
19766 {
19767 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19768     int Major, Minor, Patch ;
19769     unsigned long Version ;
19770     (void)db_version(&Major, &Minor, &Patch) ;
19771     if (argc == 2) {
19772         printf("%d %d %d %d %d %d\n",
19773                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19774                Major, Minor, Patch);
19775         exit(0);
19776     }
19777     printf("You have Berkeley DB Version 2 or greater.\n");
19778
19779     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19780                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19781     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19782                 Major, Minor, Patch) ;
19783
19784     /* check that db.h & libdb are compatible */
19785     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19786         printf("db.h and libdb are incompatible.\n") ;
19787         exit(3);
19788     }
19789
19790     printf("db.h and libdb are compatible.\n") ;
19791
19792     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19793                 + DB_VERSION_PATCH ;
19794
19795     /* needs to be >= 2.3.4 */
19796     if (Version < 2003004) {
19797     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19798         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19799         exit(2);
19800     }
19801
19802     exit(0);
19803 #else
19804 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19805     if (argc == 2) {
19806         printf("1 0 0\n");
19807         exit(0);
19808     }
19809     printf("You have Berkeley DB Version 1.\n");
19810     exit(0);    /* DB version < 2: the coast is clear. */
19811 #else
19812     exit(1);    /* <db.h> not Berkeley DB? */
19813 #endif
19814 #endif
19815 }
19816 EOCP
19817         set try
19818         if eval $compile_ok && $run ./try; then
19819                 echo 'Looks OK.' >&4
19820                 set `$run ./try 1`
19821                 db_version_major=$1
19822                 db_version_minor=$2
19823                 db_version_patch=$3
19824         else
19825                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19826                 i_db=$undef
19827                 case " $libs " in
19828                 *"-ldb "*)
19829                         : Remove db from list of libraries to use
19830                         echo "Removing unusable -ldb from library list" >&4
19831                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19832                         shift
19833                         libs="$*"
19834                         echo "libs = $libs" >&4
19835                         ;;
19836                 esac
19837         fi
19838         $rm_try
19839         ;;
19840 esac
19841
19842 case "$i_db" in
19843 define)
19844         : Check the return type needed for hash
19845         echo " "
19846         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19847         $cat >try.c <<EOCP
19848 #$d_const HASCONST
19849 #ifndef HASCONST
19850 #define const
19851 #endif
19852 #include <sys/types.h>
19853 #include <db.h>
19854
19855 #ifndef DB_VERSION_MAJOR
19856 u_int32_t hash_cb (const void* ptr, size_t size)
19857 {
19858 }
19859 HASHINFO info;
19860 int main()
19861 {
19862         info.hash = hash_cb;
19863 }
19864 #endif
19865 EOCP
19866         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19867                 if $contains warning try.out >>/dev/null 2>&1 ; then
19868                         db_hashtype='int'
19869                 else
19870                         db_hashtype='u_int32_t'
19871                 fi
19872         else
19873                 : XXX Maybe we should just give up here.
19874                 db_hashtype=u_int32_t
19875                 $cat try.out >&4
19876                 echo "Help:  I can't seem to compile the db test program." >&4
19877                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19878         fi
19879         $rm_try
19880         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19881         ;;
19882 *)      db_hashtype=u_int32_t
19883         ;;
19884 esac
19885 case "$i_db" in
19886 define)
19887         : Check the return type needed for prefix
19888         echo " "
19889         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19890         cat >try.c <<EOCP
19891 #$d_const HASCONST
19892 #ifndef HASCONST
19893 #define const
19894 #endif
19895 #include <sys/types.h>
19896 #include <db.h>
19897
19898 #ifndef DB_VERSION_MAJOR
19899 size_t prefix_cb (const DBT *key1, const DBT *key2)
19900 {
19901 }
19902 BTREEINFO info;
19903 int main()
19904 {
19905         info.prefix = prefix_cb;
19906 }
19907 #endif
19908 EOCP
19909         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19910                 if $contains warning try.out >>/dev/null 2>&1 ; then
19911                         db_prefixtype='int'
19912                 else
19913                         db_prefixtype='size_t'
19914                 fi
19915         else
19916                 db_prefixtype='size_t'
19917                 : XXX Maybe we should just give up here.
19918                 $cat try.out >&4
19919                 echo "Help:  I can't seem to compile the db test program." >&4
19920                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19921         fi
19922         $rm_try
19923         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19924         ;;
19925 *)      db_prefixtype='size_t'
19926         ;;
19927 esac
19928
19929 : Include . in @INC
19930 $cat <<EOM
19931
19932 Historically Perl has provided a final fallback of the current working
19933 directory '.' when searching for a library. This, however, can lead to
19934 problems when a Perl program which loads optional modules is called from
19935 a shared directory. This can lead to executing unexpected code.
19936
19937 EOM
19938
19939 # When changing to exclude by default:
19940 case "$default_inc_excludes_dot" in
19941     $undef|false|[nN]*) dflt="n" ;;
19942     *)                  dflt="y" ;;
19943 esac
19944 # To turn exclude off by default:
19945 #case "$default_inc_excludes_dot" in
19946 #    $define|true|[yY]*) dflt="y" ;;
19947 #    *)                  dflt="n" ;;
19948 #esac
19949
19950 rp='Exclude '.' from @INC by default? '
19951 . ./myread
19952 case "$ans" in
19953     [nN]|undef) default_inc_excludes_dot="$undef"  ;;
19954     *)          default_inc_excludes_dot="$define" ;;
19955 esac
19956
19957 : Check what kind of inf/nan your system has
19958 $echo "Checking the kind of infinities and nans you have..." >&4
19959 $echo "(The following tests may crash.  That's okay.)" >&4
19960 $cat >try.c <<EOP
19961 #define DOUBLESIZE $doublesize
19962 #$d_longdbl HAS_LONG_DOUBLE
19963 #ifdef HAS_LONG_DOUBLE
19964 #define LONG_DOUBLESIZE $longdblsize
19965 #define LONG_DOUBLEKIND $longdblkind
19966 #endif
19967 #include <math.h>
19968 #include <string.h>
19969 #include <stdio.h>
19970 /* Note that whether the sign bit is on or off
19971  * for NaN depends on the CPU/FPU, and possibly
19972  * can be affected by the build toolchain.
19973  *
19974  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
19975  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
19976  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
19977  * (respectively) as opposed to the more usual
19978  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
19979  *
19980  * Pre-IEEE-754 floating point format do not even have inf/nan support
19981  * at all.  They might have a "max" value (DBL_MAX), which may be deadly
19982  * to even mention, causing immediate SIGFPE or equivalent: this is
19983  * the case with VAX floating point, for example.
19984  */
19985 static void bytes(void *v, unsigned int n) {
19986   unsigned char *p = (unsigned char *)v;
19987   int i;
19988   for (i = 0; i < n; i++) {
19989     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
19990   }
19991 }
19992 int main(int argc, char *argv[]) {
19993    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
19994     * because some compilers are 'smart' and not only warn but refuse to
19995     * compile such 'illegal' values. */
19996    double dinf = exp(1e9);
19997    double dnan = sqrt(-1.0);
19998 #ifdef HAS_LONG_DOUBLE
19999    long double ldinf = (long double)exp(1e9);
20000    long double ldnan = (long double)sqrt(-1.0);
20001 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20002 /* the 80-bit long doubles might have garbage in their excess bytes */
20003     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20004     memset((char *)&ldnan + 10, '\0', LONG_DOUBLESIZE - 10);
20005 # endif
20006   if (argc == 2) {
20007     switch (argv[1][0]) {
20008     case '1': bytes(&dinf, sizeof(dinf)); break;
20009     case '2': bytes(&dnan, sizeof(dnan)); break;
20010     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20011     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20012 #endif
20013     }
20014   }
20015   return 0;
20016 }
20017 EOP
20018 set try
20019 if eval $compile; then
20020     doubleinfbytes=`$run ./try 1`
20021     doublenanbytes=`$run ./try 2`
20022     case "$d_longdbl" in
20023     $define)
20024       longdblinfbytes=`$run ./try 3`
20025       longdblnanbytes=`$run ./try 4`
20026       ;;
20027     esac
20028 else
20029     # Defaults in case the above test program failed.
20030     case "$doublekind" in
20031     1) # IEEE 754 32-bit LE
20032        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20033        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20034        ;;
20035     2) # IEEE 754 32-bit BE
20036        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20037        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20038        ;;
20039     3) # IEEE 754 64-bit LE
20040        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20041        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20042        ;;
20043     4) # IEEE 754 64-bit BE
20044        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20045        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20046        ;;
20047     5) # IEEE 754 128-bit LE
20048        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20049        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20050        ;;
20051     6) # IEEE 754 128-bit BE
20052        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20053        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20054        ;;
20055     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20056        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20057        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20058        ;;
20059     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20060        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20061        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20062        ;;
20063     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20064        doubleinfbytes=$undef
20065        doublenanbytes=$undef
20066        ;;
20067     *) # No idea.
20068        doubleinfbytes=$undef
20069        doublenanbytes=$undef
20070        ;;
20071     esac
20072     case "$longdblkind" in
20073     1) # IEEE 754 128-bit LE
20074        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20075        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20076        ;;
20077     2) # IEEE 754 128-bit BE
20078        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20079        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20080        ;;
20081     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20082        case "$longdblsize" in
20083        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20084            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20085            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20086            ;;
20087        16) # x86_64
20088            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20089            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20090            ;;
20091        *)  # No idea.
20092            longdblinfbytes=$undef
20093            longdblnanbytes=$undef
20094        ;;
20095        esac
20096        ;;
20097     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20098        case "$longdblsize" in
20099        12) # 32-bit system
20100            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20101            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20102            ;;
20103        16) # 64-bit system
20104            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20105            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20106            ;;
20107        *)  # No idea.
20108            longdblinfbytes=$undef
20109            longdblnanbytes=$undef
20110        ;;
20111        esac
20112        ;;
20113     5) # 128-bit LE-LE "double double"
20114        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20115        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20116        ;;
20117     6) # 128-bit BE-BE "double double"
20118        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20119        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20120        ;;
20121     7) # 128-bit LE-BE "double double"
20122        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20123        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20124        ;;
20125     8) # 128-bit BE-LE "double double"
20126        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20127        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20128        ;;
20129     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20130        longdblinfbytes=$undef
20131        longdblnanbytes=$undef
20132        ;;
20133     *) # No idea.
20134        longdblinfbytes=$undef
20135        longdblnanbytes=$undef
20136        ;;
20137     esac
20138 fi
20139 # In case the program crashed the values are empty, turn them undef.
20140 case "$doubleinfbytes" in
20141 '') doubleinfbytes=$undef ;;
20142 esac
20143 case "$doublenanbytes" in
20144 '') doublenanbytes=$undef ;;
20145 esac
20146 case "$longdblinfbytes" in
20147 '') longdblinfbytes=$undef ;;
20148 esac
20149 case "$longdblnanbytes" in
20150 '') longdblnanbytes=$undef ;;
20151 esac
20152 $rm_try
20153
20154 : Check the length of the double mantissa
20155 $echo "Checking how many mantissa bits your doubles have..." >&4
20156 $cat >try.c <<EOP
20157 #$i_sunmath I_SUNMATH
20158 #include <float.h>
20159 #ifdef I_SUNMATH
20160 # include <sunmath.h>
20161 #endif
20162 #ifdef DBL_MANT_DIG
20163 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20164 #endif
20165 #include <stdio.h>
20166 int main(int argc, char *argv[]) {
20167 #ifdef BITS
20168   printf("%d\n", BITS);
20169 #endif
20170   return 0;
20171 }
20172 EOP
20173 set try
20174 if eval $compile; then
20175     doublemantbits=`$run ./try`
20176 else
20177     doublemantbits="$undef"
20178 fi
20179 $rm_try
20180
20181 : Check the length of the longdouble mantissa
20182 $echo "Checking how many mantissa bits your long doubles have..." >&4
20183 $cat >try.c <<EOP
20184 #$i_sunmath I_SUNMATH
20185 #include <float.h>
20186 #ifdef I_SUNMATH
20187 # include <sunmath.h>
20188 #endif
20189 #$d_longdbl HAS_LONG_DOUBLE
20190 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20191 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20192 /* This format has no implicit bit.  Beware, however, that for
20193  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20194  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20195  * and the top bit must have been one since 387, zero is plain invalid.
20196  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20197 #  define BITS LDBL_MANT_DIG
20198 # elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
20199 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20200  * reason e.g. Irix thinks 107.  But in any case, we want only
20201  * the number of real bits, the implicit bits are of no interest.  */
20202 #  define BITS 2 * (DBL_MANT_DIG - 1)
20203 # else
20204 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20205 # endif
20206 #endif
20207 #include <stdio.h>
20208 int main(int argc, char *argv[]) {
20209 #ifdef BITS
20210   printf("%d\n", BITS);
20211 #endif
20212   return 0;
20213 }
20214 EOP
20215 set try
20216 if eval $compile; then
20217     longdblmantbits=`$run ./try`
20218 else
20219     longdblmantbits="$undef"
20220 fi
20221 $rm_try
20222
20223 : Check the length of the NV mantissa
20224 $echo "Checking how many mantissa bits your NVs have..." >&4
20225 if test "X$usequadmath" = "X$define"; then
20226   nvmantbits=112 # 128-1-15
20227 else
20228   if test "X$nvsize" = "X$doublesize"; then
20229     nvmantbits="$doublemantbits"
20230   else
20231      if test "X$nvsize" = "X$longdblsize"; then
20232        nvmantbits="$longdblmantbits"
20233      else
20234        nvmantbits="$undef"
20235      fi
20236   fi
20237 fi
20238
20239 : How can we generate normalized random numbers ?
20240 echo " "
20241 echo "Using our internal random number implementation..." >&4
20242
20243 case "$ccflags" in
20244 *-Dmy_rand=*|*-Dmy_srand=*)
20245         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20246         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20247         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20248         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20249         ;;
20250 esac
20251
20252 randfunc=Perl_drand48
20253 drand01="Perl_drand48()"
20254 seedfunc="Perl_drand48_init"
20255 randbits=48
20256 randseedtype=U32
20257
20258 : Probe whether dtrace builds an object, as newer Illumos requires an input
20259 : object file that uses at least one of the probes defined in the .d file
20260 case "$usedtrace" in
20261 $define)
20262     case "$dtracexnolibs" in
20263     $define|true|[yY]*)
20264         dtracexnolibs=$define
20265         $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h
20266         ;;
20267     ' '|'')
20268         if $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20269              dtracexnolibs=$define
20270              echo "Your dtrace accepts -xnolibs"
20271         elif $dtrace -h -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20272              dtracexnolibs=$undef
20273              echo "Your dtrace doesn't accept -xnolibs"
20274         else
20275              echo "Your dtrace doesn't work at all, try building without dtrace support" >&4
20276              exit 1
20277         fi
20278         ;;
20279     *)
20280         dtracexnolibs=$undef
20281         $dtrace -h -s ../perldtrace.d -o perldtrace.h
20282         ;;
20283     esac
20284     case $dtracexnolibs in
20285     $define) xnolibs=-xnolibs ;;
20286     *) xnolibs= ;;
20287     esac
20288
20289     case "$dtraceobject" in
20290     $define|true|[yY]*)
20291         dtraceobject=$define
20292         ;;
20293     ' '|'')
20294         $cat >try.c <<EOM
20295 #include "perldtrace.h"
20296 int main(void) {
20297     PERL_LOADED_FILE("dummy");
20298     return 0;
20299 }
20300 EOM
20301         dtraceobject=$undef
20302         if $cc -c -o try.o $optimize $ccflags try.c \
20303                     && $dtrace -G $xnolibs -s ../perldtrace.d try.o >/dev/null 2>&1; then
20304                 dtraceobject=$define
20305             echo "Your dtrace builds an object file"
20306         fi
20307         ;;
20308     *) dtraceobject=$undef ;;
20309     esac
20310     $rm_try perldtrace.o perldtrace.h
20311 esac
20312
20313 : Determine if this is an EBCDIC system
20314 echo " "
20315 echo "Determining whether or not we are on an EBCDIC system..." >&4
20316 $cat >try.c <<'EOM'
20317 int main()
20318 {
20319   if ('M'==0xd4) return 0;
20320   return 1;
20321 }
20322 EOM
20323
20324 val=$undef
20325 set try
20326 if eval $compile_ok; then
20327         if $run ./try; then
20328                 echo "You seem to speak EBCDIC." >&4
20329                 val="$define"
20330         else
20331                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20332         fi
20333 else
20334         echo "I'm unable to compile the test program." >&4
20335         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20336 fi
20337 $rm_try
20338 set ebcdic
20339 eval $setvar
20340
20341 : Check how to flush
20342 echo " "
20343 $cat >&4 <<EOM
20344 Checking how to flush all pending stdio output...
20345 EOM
20346 # I only know how to find the first 32 possibly open files on SunOS.
20347 # See also hints/sunos_4_1.sh and util.c  --AD
20348 case "$osname" in
20349 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20350 esac
20351 $cat >>try.c <<EOCP
20352 #include <stdio.h>
20353 #$i_stdlib I_STDLIB
20354 #ifdef I_STDLIB
20355 #include <stdlib.h>
20356 #endif
20357 #$i_unistd I_UNISTD
20358 #ifdef I_UNISTD
20359 # include <unistd.h>
20360 #endif
20361 #$d_sysconf HAS_SYSCONF
20362 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20363 #ifdef HAS_STDIO_STREAM_ARRAY
20364 # define STDIO_STREAM_ARRAY $stdio_stream_array
20365 #endif
20366 int main() {
20367   FILE* p;
20368   unlink("try.out");
20369   p = fopen("try.out", "w");
20370 #ifdef TRY_FPUTC
20371   fputc('x', p);
20372 #else
20373 # ifdef TRY_FPRINTF
20374   fprintf(p, "x");
20375 # endif
20376 #endif
20377 #ifdef TRY_FFLUSH_NULL
20378   fflush(NULL);
20379 #endif
20380 #ifdef TRY_FFLUSH_ALL
20381   {
20382     long open_max = -1;
20383 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20384     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20385 # else
20386 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20387     open_max = sysconf(_SC_OPEN_MAX);
20388 #  else
20389 #   ifdef FOPEN_MAX
20390     open_max = FOPEN_MAX;
20391 #   else
20392 #    ifdef OPEN_MAX
20393     open_max = OPEN_MAX;
20394 #    else
20395 #     ifdef _NFILE
20396     open_max = _NFILE;
20397 #     endif
20398 #    endif
20399 #   endif
20400 #  endif
20401 # endif
20402 # ifdef HAS_STDIO_STREAM_ARRAY
20403     if (open_max > 0) {
20404       long i;
20405       for (i = 0; i < open_max; i++)
20406             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20407                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20408                 STDIO_STREAM_ARRAY[i]._flag)
20409                 fflush(&STDIO_STREAM_ARRAY[i]);
20410     }
20411   }
20412 # endif
20413 #endif
20414   _exit(42);
20415 }
20416 EOCP
20417 : first we have to find out how _not_ to flush
20418 $to try.c
20419 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20420     output=''
20421     set try -DTRY_FPUTC
20422     if eval $compile; then
20423             $run ./try 2>/dev/null
20424             code="$?"
20425             $from try.out
20426             if $test ! -s try.out -a "X$code" = X42; then
20427                 output=-DTRY_FPUTC
20428             fi
20429     fi
20430     case "$output" in
20431     '')
20432             set try -DTRY_FPRINTF
20433             if eval $compile; then
20434                     $run ./try 2>/dev/null
20435                     code="$?"
20436                     $from try.out
20437                     if $test ! -s try.out -a "X$code" = X42; then
20438                         output=-DTRY_FPRINTF
20439                     fi
20440             fi
20441         ;;
20442     esac
20443 fi
20444 : check for fflush NULL behavior
20445 case "$fflushNULL" in
20446 '')     set try -DTRY_FFLUSH_NULL $output
20447         if eval $compile; then
20448                 $run ./try 2>/dev/null
20449                 code="$?"
20450                 $from try.out
20451                 if $test -s try.out -a "X$code" = X42; then
20452                         fflushNULL="`$cat try.out`"
20453                 else
20454                         if $test "X$code" != X42; then
20455                                 $cat >&4 <<EOM
20456 (If this test failed, don't worry, we'll try another method shortly.)
20457 EOM
20458                         fi
20459                 fi
20460         fi
20461         $rm -f core try.core core.try.*
20462         case "$fflushNULL" in
20463         x)      $cat >&4 <<EOM
20464 Your fflush(NULL) works okay for output streams.
20465 Let's see if it clobbers input pipes...
20466 EOM
20467 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20468 # bug that improperly flushes the input end of pipes.  So we avoid the
20469 # autoflush on fork/system/exec support for now. :-(
20470 $cat >tryp.c <<EOCP
20471 #include <stdio.h>
20472 int
20473 main(int argc, char **argv)
20474 {
20475     char buf[1024];
20476     int i;
20477     char *bp = buf;
20478     while (1) {
20479         while ((i = getc(stdin)) != -1
20480                && (*bp++ = i) != '\n'
20481                && bp < &buf[1024])
20482         /* DO NOTHING */ ;
20483         *bp = '\0';
20484         fprintf(stdout, "%s", buf);
20485         fflush(NULL);
20486         if (i == -1)
20487             return 0;
20488         bp = buf;
20489     }
20490 }
20491 EOCP
20492                 fflushNULL="$define"
20493                 set tryp
20494                 if eval $compile; then
20495                     $rm -f tryp.out
20496                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20497                     if $test "X$targethost" != X; then
20498                         $to tryp.c
20499                         $to tryp
20500                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20501                     else
20502                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20503                     fi
20504                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20505                        $cat >&4 <<EOM
20506 fflush(NULL) seems to behave okay with input streams.
20507 EOM
20508                         fflushNULL="$define"
20509                     else
20510                         $cat >&4 <<EOM
20511 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20512 EOM
20513                         fflushNULL="$undef"
20514                     fi
20515                 fi
20516                 $rm -f core tryp.c tryp.core core.tryp.*
20517                 ;;
20518         '')     $cat >&4 <<EOM
20519 Your fflush(NULL) isn't working (contrary to ANSI C).
20520 EOM
20521                 fflushNULL="$undef"
20522                 ;;
20523         *)      $cat >&4 <<EOM
20524 Cannot figure out whether your fflush(NULL) works or not.
20525 I'm assuming it doesn't (contrary to ANSI C).
20526 EOM
20527                 fflushNULL="$undef"
20528                 ;;
20529         esac
20530         ;;
20531 $define|true|[yY]*)
20532         fflushNULL="$define"
20533         ;;
20534 *)
20535         fflushNULL="$undef"
20536         ;;
20537 esac
20538 : check explicit looping only if NULL did not work, and if the pipe
20539 : bug does not show up on an explicit flush too
20540 case "$fflushNULL" in
20541 "$undef")
20542         $cat >tryp.c <<EOCP
20543 #include <stdio.h>
20544 int
20545 main(int argc, char **argv)
20546 {
20547     char buf[1024];
20548     int i;
20549     char *bp = buf;
20550     while (1) {
20551         while ((i = getc(stdin)) != -1
20552                && (*bp++ = i) != '\n'
20553                && bp < &buf[1024])
20554         /* DO NOTHING */ ;
20555         *bp = '\0';
20556         fprintf(stdout, "%s", buf);
20557         fflush(stdin);
20558         if (i == -1)
20559             return 0;
20560         bp = buf;
20561     }
20562 }
20563 EOCP
20564         set tryp
20565         if eval $compile; then
20566             $rm -f tryp.out
20567             if $test "X$targethost" != X; then
20568                 $to tryp.c
20569                 $to tryp
20570                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20571             else
20572                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20573             fi
20574             if cmp tryp.c tryp.out >/dev/null 2>&1; then
20575                $cat >&4 <<EOM
20576 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20577 EOM
20578                 : now check for fflushall behaviour
20579                 case "$fflushall" in
20580                 '')     set try -DTRY_FFLUSH_ALL $output
20581                         if eval $compile; then
20582                                 $cat >&4 <<EOM
20583 (Now testing the other method--but note that this also may fail.)
20584 EOM
20585                                 $run ./try 2>/dev/null
20586                                 code=$?
20587                                 $from try.out
20588                                 if $test -s try.out -a "X$code" = X42; then
20589                                         fflushall="`$cat try.out`"
20590                                 fi
20591                         fi
20592                         $rm_try
20593                         case "$fflushall" in
20594                         x)      $cat >&4 <<EOM
20595 Whew. Flushing explicitly all the stdio streams works.
20596 EOM
20597                                 fflushall="$define"
20598                                 ;;
20599                         '')     $cat >&4 <<EOM
20600 Sigh. Flushing explicitly all the stdio streams doesn't work.
20601 EOM
20602                                 fflushall="$undef"
20603                                 ;;
20604                         *)      $cat >&4 <<EOM
20605 Cannot figure out whether flushing stdio streams explicitly works or not.
20606 I'm assuming it doesn't.
20607 EOM
20608                                 fflushall="$undef"
20609                                 ;;
20610                         esac
20611                         ;;
20612                 "$define"|true|[yY]*)
20613                         fflushall="$define"
20614                         ;;
20615                 *)
20616                         fflushall="$undef"
20617                         ;;
20618                 esac
20619             else
20620                 $cat >&4 <<EOM
20621 All is futile.  Even fflush(stdin) clobbers input pipes!
20622 EOM
20623                 fflushall="$undef"
20624             fi
20625         else
20626             fflushall="$undef"
20627         fi
20628         $rm -f core tryp.c tryp.core core.tryp.*
20629         ;;
20630 *)      fflushall="$undef"
20631         ;;
20632 esac
20633
20634 case "$fflushNULL$fflushall" in
20635 undefundef)
20636         $cat <<EOM
20637 OK, I give up.  I cannot figure out how to flush pending stdio output.
20638 We won't be flushing handles at all before fork/exec/popen.
20639 EOM
20640         ;;
20641 esac
20642 $rm_try tryp
20643
20644 : Store the full pathname to the ar program for use in the C program
20645 : Respect a hint or command line value for full_ar.
20646 case "$full_ar" in
20647 '') full_ar=$ar ;;
20648 esac
20649
20650 : Store the full pathname to the sed program for use in the C program
20651 full_sed=$sed
20652
20653 : see what type gids are declared as in the kernel
20654 echo " "
20655 echo "Looking for the type for group ids returned by getgid()."
20656 set gid_t gidtype xxx stdio.h sys/types.h
20657 eval $typedef
20658 case "$gidtype" in
20659 xxx)
20660         xxx=`./findhdr sys/user.h`
20661         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
20662         case $1 in
20663         unsigned) dflt="$1 $2" ;;
20664         *) dflt="$1" ;;
20665         esac
20666         ;;
20667 *) dflt="$gidtype";;
20668 esac
20669 case "$gidtype" in
20670 gid_t) echo "gid_t found." ;;
20671 *)      rp="What is the type for group ids returned by getgid()?"
20672         . ./myread
20673         gidtype="$ans"
20674         ;;
20675 esac
20676
20677 : Check the size of GID
20678 echo " "
20679 case "$gidtype" in
20680 *_t) zzz="$gidtype"     ;;
20681 *)   zzz="gid"          ;;
20682 esac
20683 echo "Checking the size of $zzz..." >&4
20684 cat > try.c <<EOCP
20685 #include <sys/types.h>
20686 #include <stdio.h>
20687 #$i_stdlib I_STDLIB
20688 #ifdef I_STDLIB
20689 #include <stdlib.h>
20690 #endif
20691 int main() {
20692     printf("%d\n", (int)sizeof($gidtype));
20693     exit(0);
20694 }
20695 EOCP
20696 set try
20697 if eval $compile_ok; then
20698         yyy=`$run ./try`
20699         case "$yyy" in
20700         '')     gidsize=4
20701                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
20702                 ;;
20703         *)      gidsize=$yyy
20704                 echo "Your $zzz is $gidsize bytes long."
20705                 ;;
20706         esac
20707 else
20708         gidsize=4
20709         echo "(I can't compile the test program--guessing $gidsize.)" >&4
20710 fi
20711
20712
20713 : Check if GID is signed
20714 echo " "
20715 case "$gidtype" in
20716 *_t) zzz="$gidtype"     ;;
20717 *)   zzz="gid"          ;;
20718 esac
20719 echo "Checking the sign of $zzz..." >&4
20720 cat > try.c <<EOCP
20721 #include <sys/types.h>
20722 #include <stdio.h>
20723 int main() {
20724         $gidtype foo = -1;
20725         if (foo < 0)
20726                 printf("-1\n");
20727         else
20728                 printf("1\n");
20729 }
20730 EOCP
20731 set try
20732 if eval $compile; then
20733         yyy=`$run ./try`
20734         case "$yyy" in
20735         '')     gidsign=1
20736                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20737                 ;;
20738         *)      gidsign=$yyy
20739                 case "$gidsign" in
20740                  1) echo "Your $zzz is unsigned." ;;
20741                 -1) echo "Your $zzz is signed."   ;;
20742                 esac
20743                 ;;
20744         esac
20745 else
20746         gidsign=1
20747         echo "(I can't compile the test program--guessing unsigned.)" >&4
20748 fi
20749
20750
20751 : Check 64bit sizes
20752 echo " "
20753
20754 if $test X"$quadtype" != X; then
20755
20756 echo "Checking how to print 64-bit integers..." >&4
20757
20758 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
20759         $cat >try.c <<'EOCP'
20760 #include <sys/types.h>
20761 #include <stdio.h>
20762 int main() {
20763   int q = 12345678901;
20764   printf("%ld\n", q);
20765 }
20766 EOCP
20767         set try
20768         if eval $compile; then
20769                 yyy=`$run ./try`
20770                 case "$yyy" in
20771                 12345678901)
20772                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
20773                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
20774                         echo "We will use %d."
20775                         ;;
20776                 esac
20777         fi
20778 fi
20779
20780 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
20781         $cat >try.c <<'EOCP'
20782 #include <sys/types.h>
20783 #include <stdio.h>
20784 int main() {
20785   long q = 12345678901;
20786   printf("%ld\n", q);
20787 }
20788 EOCP
20789         set try
20790         if eval $compile; then
20791                 yyy=`$run ./try`
20792                 case "$yyy" in
20793                 12345678901)
20794                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
20795                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
20796                         echo "We will use %ld."
20797                         ;;
20798                 esac
20799         fi
20800 fi
20801
20802 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
20803         $cat >try.c <<'EOCP'
20804 #include <sys/types.h>
20805 #include <inttypes.h>
20806 #include <stdio.h>
20807 int main() {
20808   int64_t q = 12345678901;
20809   printf("%" PRId64 "\n", q);
20810 }
20811 EOCP
20812         set try
20813         if eval $compile; then
20814                 yyy=`$run ./try`
20815                 case "$yyy" in
20816                 12345678901)
20817                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
20818                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
20819                         echo "We will use the C9X style."
20820                         ;;
20821                 esac
20822         fi
20823 fi
20824
20825 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20826         $cat >try.c <<EOCP
20827 #include <sys/types.h>
20828 #include <stdio.h>
20829 int main() {
20830   $quadtype 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='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
20840                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20841                         echo "We will use %Ld."
20842                         ;;
20843                 esac
20844         fi
20845 fi
20846
20847 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20848         $cat >try.c <<'EOCP'
20849 #include <sys/types.h>
20850 #include <stdio.h>
20851 int main() {
20852   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20853   printf("%lld\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='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20862                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20863                         echo "We will use the %lld style."
20864                         ;;
20865                 esac
20866         fi
20867 fi
20868
20869 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20870         $cat >try.c <<EOCP
20871 #include <sys/types.h>
20872 #include <stdio.h>
20873 int main() {
20874   $quadtype q = 12345678901;
20875   printf("%qd\n", q);
20876 }
20877 EOCP
20878         set try
20879         if eval $compile; then
20880                 yyy=`$run ./try`
20881                 case "$yyy" in
20882                 12345678901)
20883                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20884                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20885                         echo "We will use %qd."
20886                         ;;
20887                 esac
20888         fi
20889 fi
20890
20891 if $test X"$sPRId64" = X; then
20892         echo "Cannot figure out how to print 64-bit integers." >&4
20893 fi
20894 $rm_try
20895
20896 fi
20897
20898 case "$sPRId64" in
20899 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20900         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20901         ;;
20902 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20903         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20904         ;;
20905 esac
20906
20907 : Check format strings for internal types
20908 echo " "
20909 $echo "Checking the format strings to be used for Perl's internal types..." >&4
20910
20911 if $test X"$ivsize" = X8; then
20912         ivdformat="$sPRId64"
20913         uvuformat="$sPRIu64"
20914         uvoformat="$sPRIo64"
20915         uvxformat="$sPRIx64"
20916         uvXUformat="$sPRIXU64"
20917 else
20918         if $test X"$ivsize" = X"$longsize"; then
20919                 ivdformat='"ld"'
20920                 uvuformat='"lu"'
20921                 uvoformat='"lo"'
20922                 uvxformat='"lx"'
20923                 uvXUformat='"lX"'
20924         else
20925                 if $test X"$ivsize" = X"$intsize"; then
20926                         ivdformat='"d"'
20927                         uvuformat='"u"'
20928                         uvoformat='"o"'
20929                         uvxformat='"x"'
20930                         uvXUformat='"X"'
20931                 else
20932                         : far out
20933                         if $test X"$ivsize" = X"$shortsize"; then
20934                                 ivdformat='"hd"'
20935                                 uvuformat='"hu"'
20936                                 uvoformat='"ho"'
20937                                 uvxformat='"hx"'
20938                                 uvXUformat='"hX"'
20939                         fi
20940                 fi
20941         fi
20942 fi
20943
20944 if $test X"$usequadmath" = X"$define"; then
20945     nveformat='"Qe"'
20946     nvfformat='"Qf"'
20947     nvgformat='"Qg"'
20948     nvEUformat='"QE"'
20949     nvFUformat='"QF"'
20950     nvGUformat='"QG"'
20951 else
20952     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20953         nveformat="$sPRIeldbl"
20954         nvfformat="$sPRIfldbl"
20955         nvgformat="$sPRIgldbl"
20956         nvEUformat="$sPRIEUldbl"
20957         nvFUformat="$sPRIFUldbl"
20958         nvGUformat="$sPRIGUldbl"
20959     else
20960         nveformat='"e"'
20961         nvfformat='"f"'
20962         nvgformat='"g"'
20963         nvEUformat='"E"'
20964         nvFUformat='"F"'
20965         nvGUformat='"G"'
20966     fi
20967 fi
20968
20969 case "$ivdformat" in
20970 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20971     exit 1
20972     ;;
20973 esac
20974
20975 : Check format string for GID
20976
20977 echo " "
20978 $echo "Checking the format string to be used for gids..." >&4
20979
20980 case "$gidsign" in
20981 -1)     if $test X"$gidsize" = X"$ivsize"; then
20982                 gidformat="$ivdformat"
20983         else
20984                 if $test X"$gidsize" = X"$longsize"; then
20985                         gidformat='"ld"'
20986                 else
20987                         if $test X"$gidsize" = X"$intsize"; then
20988                                 gidformat='"d"'
20989                         else
20990                                 if $test X"$gidsize" = X"$shortsize"; then
20991                                         gidformat='"hd"'
20992                                 fi
20993                         fi
20994                 fi
20995         fi
20996         ;;
20997 *)      if $test X"$gidsize" = X"$uvsize"; then
20998                 gidformat="$uvuformat"
20999         else
21000                 if $test X"$gidsize" = X"$longsize"; then
21001                         gidformat='"lu"'
21002                 else
21003                         if $test X"$gidsize" = X"$intsize"; then
21004                                 gidformat='"u"'
21005                         else
21006                                 if $test X"$gidsize" = X"$shortsize"; then
21007                                         gidformat='"hu"'
21008                                 fi
21009                         fi
21010                 fi
21011         fi
21012         ;;
21013 esac
21014
21015 : see if getgroups exists
21016 set getgroups d_getgrps
21017 eval $inlibc
21018
21019 : see if setgroups exists
21020 set setgroups d_setgrps
21021 eval $inlibc
21022
21023 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21024 echo " "
21025 case "$d_getgrps$d_setgrps" in
21026 *define*)
21027         case "$groupstype" in
21028         '') dflt="$gidtype" ;;
21029         *)  dflt="$groupstype" ;;
21030         esac
21031         $cat <<EOM
21032 What type of pointer is the second argument to getgroups() and setgroups()?
21033 Usually this is the same as group ids, $gidtype, but not always.
21034
21035 EOM
21036         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21037         . ./myread
21038         groupstype="$ans"
21039         ;;
21040 *)  groupstype="$gidtype";;
21041 esac
21042
21043 : check whether make sets MAKE
21044 echo " "
21045 echo "Checking if your $make program sets \$(MAKE)..." >&4
21046 case "$make_set_make" in
21047 '')
21048         $sed 's/^X //' > testmake.mak << 'EOF'
21049 Xall:
21050 X       @echo 'maketemp="$(MAKE)"'
21051 EOF
21052         case "`$make -f testmake.mak 2>/dev/null`" in
21053         *maketemp=*) make_set_make='#' ;;
21054         *)      make_set_make="MAKE=$make" ;;
21055         esac
21056         $rm -f testmake.mak
21057         ;;
21058 esac
21059 case "$make_set_make" in
21060 '#') echo "Yup, it does.";;
21061 *) echo "Nope, it doesn't.";;
21062 esac
21063
21064 : see what type is used for mode_t
21065 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21066 set mode_t modetype int stdio.h sys/types.h
21067 eval $typedef_ask
21068
21069 : see if we need va_copy
21070 echo " "
21071 $cat >try.c <<EOCP
21072 #include <stdarg.h>
21073 #include <stdio.h>
21074 #include <stdlib.h>
21075 #include <signal.h>
21076
21077 int
21078 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21079 {
21080   return vfprintf(f, fmt, *valp);
21081 }
21082
21083 int
21084 myvfprintf(FILE *f, const  char *fmt, va_list val)
21085 {
21086   return ivfprintf(f, fmt, &val);
21087 }
21088
21089 int
21090 myprintf(char *fmt, ...)
21091 {
21092   va_list val;
21093   va_start(val, fmt);
21094   return myvfprintf(stdout, fmt, val);
21095 }
21096
21097 int
21098 main(int ac, char **av)
21099 {
21100   signal(SIGSEGV, exit);
21101
21102   myprintf("%s%cs all right, then\n", "that", '\'');
21103   exit(0);
21104 }
21105 EOCP
21106 set try
21107 if eval $compile && $run ./try 2>&1 >/dev/null; then
21108         case "`$run ./try`" in
21109         "that's all right, then")
21110                 okay=yes
21111                 ;;
21112         esac
21113 fi
21114 case "$okay" in
21115 yes)    echo "It seems that you don't need va_copy()." >&4
21116         need_va_copy="$undef"
21117         ;;
21118 *)      echo "It seems that va_copy() or similar will be needed." >&4
21119         need_va_copy="$define"
21120         ;;
21121 esac
21122 $rm_try
21123
21124 : see what type is used for size_t
21125 rp="What is the type used for the length parameter for string functions?"
21126 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21127 eval $typedef_ask
21128
21129 : check for type of arguments to gethostbyaddr.
21130 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21131         case "$d_gethbyaddr" in
21132         $define)
21133                 $cat <<EOM
21134
21135 Checking to see what type of arguments are accepted by gethostbyaddr().
21136 EOM
21137                 hdrs="$define sys/types.h
21138                         $d_socket sys/socket.h
21139                         $i_niin netinet/in.h
21140                         $i_netdb netdb.h
21141                         $i_unistd unistd.h"
21142                 : The first arg can 'char *' or 'void *'
21143                 : The second arg is some of integral type
21144                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21145                         for yyy in size_t long int; do
21146                                 case "$netdb_host_type" in
21147                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21148                                         if ./protochk "$try" $hdrs; then
21149                                                 echo "Your system accepts $xxx for the first arg."
21150                                                 echo "...and $yyy for the second arg."
21151                                                 netdb_host_type="$xxx"
21152                                                 netdb_hlen_type="$yyy"
21153                                         fi
21154                                         ;;
21155                                 esac
21156                         done
21157                 done
21158                 : In case none of those worked, prompt the user.
21159                 case "$netdb_host_type" in
21160                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21161                         dflt='char *'
21162                         . ./myread
21163                         netdb_host_type=$ans
21164                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21165                         dflt="$sizetype"
21166                         . ./myread
21167                         netdb_hlen_type=$ans
21168                         ;;
21169                 esac
21170                 ;;
21171         *)      : no gethostbyaddr, so pick harmless defaults
21172                 netdb_host_type='char *'
21173                 netdb_hlen_type="$sizetype"
21174                 ;;
21175         esac
21176         # Remove the "const" if needed. -- but then we'll have a
21177         # prototype clash!
21178         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21179 fi
21180
21181 : check for type of argument to gethostbyname.
21182 if test "X$netdb_name_type" = X ; then
21183         case "$d_gethbyname" in
21184         $define)
21185                 $cat <<EOM
21186
21187 Checking to see what type of argument is accepted by gethostbyname().
21188 EOM
21189                 hdrs="$define sys/types.h
21190                         $d_socket sys/socket.h
21191                         $i_niin netinet/in.h
21192                         $i_netdb netdb.h
21193                         $i_unistd unistd.h"
21194                 for xxx in "const char *" "char *"; do
21195                         case "$netdb_name_type" in
21196                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21197                                 if ./protochk "$try" $hdrs; then
21198                                         echo "Your system accepts $xxx."
21199                                         netdb_name_type="$xxx"
21200                                 fi
21201                                 ;;
21202                         esac
21203                 done
21204                 : In case none of those worked, prompt the user.
21205                 case "$netdb_name_type" in
21206                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21207                         dflt='char *'
21208                         . ./myread
21209                         netdb_name_type=$ans
21210                         ;;
21211                 esac
21212                 ;;
21213         *)      : no gethostbyname, so pick harmless default
21214                 netdb_name_type='char *'
21215                 ;;
21216         esac
21217 fi
21218
21219 : check for type of 1st argument to getnetbyaddr.
21220 if test "X$netdb_net_type" = X ; then
21221         case "$d_getnbyaddr" in
21222         $define)
21223                 $cat <<EOM
21224
21225 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21226 EOM
21227                 hdrs="$define sys/types.h
21228                         $d_socket sys/socket.h
21229                         $i_niin netinet/in.h
21230                         $i_netdb netdb.h
21231                         $i_unistd unistd.h"
21232                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21233                         case "$netdb_net_type" in
21234                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21235                                 if ./protochk "$try" $hdrs; then
21236                                         echo "Your system accepts $xxx."
21237                                         netdb_net_type="$xxx"
21238                                 fi
21239                                 ;;
21240                         esac
21241                 done
21242                 : In case none of those worked, prompt the user.
21243                 case "$netdb_net_type" in
21244                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21245                         dflt='long'
21246                         . ./myread
21247                         netdb_net_type=$ans
21248                         ;;
21249                 esac
21250                 ;;
21251         *)      : no getnetbyaddr, so pick harmless default
21252                 netdb_net_type='long'
21253                 ;;
21254         esac
21255 fi
21256 : locate the preferred pager for this system
21257 fn=f/
21258 case "$pager" in
21259 '')
21260         dflt=''
21261         case "$pg" in
21262         /*) dflt=$pg;;
21263         [a-zA-Z]:/*) dflt=$pg;;
21264         esac
21265         case "$more" in
21266         /*) dflt=$more;;
21267         [a-zA-Z]:/*) dflt=$more;;
21268         esac
21269         case "$less" in
21270         /*) dflt=$less;;
21271         [a-zA-Z]:/*) dflt=$less;;
21272         esac
21273         case "$dflt" in
21274         '') dflt=/usr/ucb/more;;
21275         esac
21276         ;;
21277 *)      dflt="$pager"
21278         ;;
21279 esac
21280 fn="f/($dflt)"
21281 echo " "
21282 rp='What pager is used on your system?'
21283 . ./getfile
21284 pager="$ans"
21285
21286 : see if ar generates random libraries by itself
21287 echo " "
21288 echo "Checking how to generate random libraries on your machine..." >&4
21289 echo 'int bar1() { return bar2(); }' > bar1.c
21290 echo 'int bar2() { return 2; }' > bar2.c
21291 $cat > foo.c <<EOP
21292 #$i_stdlib I_STDLIB
21293 #ifdef I_STDLIB
21294 #include <stdlib.h>
21295 #endif
21296 int main() { printf("%d\n", bar1()); exit(0); }
21297 EOP
21298 $cc $ccflags -c bar1.c >/dev/null 2>&1
21299 $cc $ccflags -c bar2.c >/dev/null 2>&1
21300 $cc $ccflags -c foo.c >/dev/null 2>&1
21301 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21302 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21303         $run ./foobar >/dev/null 2>&1; then
21304         echo "$ar appears to generate random libraries itself."
21305         orderlib=false
21306         if [ "X$ranlib" = "X" ]; then
21307             ranlib=":"
21308         fi
21309 elif $ar s bar$_a >/dev/null 2>&1 &&
21310         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21311         $run ./foobar >/dev/null 2>&1; then
21312                 echo "a table of contents needs to be added with '$ar s'."
21313                 orderlib=false
21314                 ranlib="$ar s"
21315 elif $ar ts bar$_a >/dev/null 2>&1 &&
21316         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21317         $run ./foobar >/dev/null 2>&1; then
21318                 echo "a table of contents needs to be added with '$ar ts'."
21319                 orderlib=false
21320                 ranlib="$ar ts"
21321 else
21322         case "$ranlib" in
21323         :) ranlib='';;
21324         '')
21325                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21326                 $test -f $ranlib || ranlib=''
21327                 ;;
21328         esac
21329         if $test -n "$ranlib"; then
21330                 echo "your system has '$ranlib'; we'll use that."
21331                 orderlib=false
21332         else
21333                 echo "your system doesn't seem to support random libraries"
21334                 echo "so we'll use lorder and tsort to order the libraries."
21335                 orderlib=true
21336                 ranlib=":"
21337         fi
21338 fi
21339 $rm -f foo* bar*
21340
21341 : Check the max offset that gmtime and localtime accept
21342 echo "Checking max offsets that gmtime () accepts"
21343
21344 case "$sGMTIME_min/$sGMTIME_max" in
21345     0/0|/)
21346         $cat >try.c <<EOCP
21347 #include <sys/types.h>
21348 #include <stdio.h>
21349 #include <time.h>
21350
21351 int i;
21352 struct tm *tmp;
21353 time_t pt;
21354
21355 void gm_check (time_t t, int min_year, int max_year)
21356 {
21357     tmp = gmtime (&t);
21358     if ( tmp == NULL ||
21359         /* Check tm_year overflow */
21360          tmp->tm_year < min_year || tmp->tm_year > max_year)
21361         tmp = NULL;
21362     else
21363         pt = t;
21364     } /* gm_check */
21365
21366 int check_max ()
21367 {
21368     tmp = NULL;
21369     pt  = 0;
21370 #ifdef MAXLONG
21371     gm_check (MAXLONG, 69, 0x7fffffff);
21372 #endif
21373     if (tmp == NULL || tmp->tm_year < 0) {
21374         for (i = 63; i >= 0; i--) {
21375             time_t x = pt | ((time_t)1 << i);
21376             if (x < 0 || x < pt) continue;
21377             gm_check (x, 69, 0x7fffffff);
21378             }
21379         }
21380     printf ("sGMTIME_max=%ld\n", pt);
21381     return (0);
21382     } /* check_max */
21383
21384 int check_min ()
21385 {
21386     tmp = NULL;
21387     pt  = 0;
21388 #ifdef MINLONG
21389     gm_check (MINLONG, -1900, 70);
21390 #endif
21391     if (tmp == NULL) {
21392         for (i = 36; i >= 0; i--) {
21393             time_t x = pt - ((time_t)1 << i);
21394             if (x > 0) continue;
21395             gm_check (x, -1900, 70);
21396             }
21397         }
21398     printf ("sGMTIME_min=%ld\n", pt);
21399     return (0);
21400     } /* check_min */
21401
21402 int main (int argc, char *argv[])
21403 {
21404     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21405     check_max ();
21406     check_min ();
21407     return (0);
21408     } /* main */
21409 EOCP
21410         set try
21411         if eval $compile; then
21412             eval `$run ./try 2>/dev/null`
21413         else
21414             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21415             fi
21416         $rm_try
21417         ;;
21418     esac
21419
21420 echo "Checking max offsets that localtime () accepts"
21421
21422 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21423     0/0|/)
21424         $cat >try.c <<EOCP
21425 #include <sys/types.h>
21426 #include <stdio.h>
21427 #include <time.h>
21428
21429 int i;
21430 struct tm *tmp;
21431 time_t pt;
21432
21433 void local_check (time_t t, int min_year, int max_year)
21434 {
21435     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21436         tmp = NULL;
21437     else
21438         tmp = localtime (&t);
21439     if ( tmp == NULL ||
21440         /* Check tm_year overflow */
21441          tmp->tm_year < min_year || tmp->tm_year > max_year)
21442         tmp = NULL;
21443     else
21444         pt = t;
21445     } /* local_check */
21446
21447 int check_max ()
21448 {
21449     tmp = NULL;
21450     pt  = 0;
21451 #ifdef MAXLONG
21452     local_check (MAXLONG, 69, 0x7fffffff);
21453 #endif
21454     if (tmp == NULL || tmp->tm_year < 0) {
21455         for (i = 63; i >= 0; i--) {
21456             time_t x = pt | ((time_t)1 << i);
21457             if (x < 0 || x < pt) continue;
21458             local_check (x, 69, 0x7fffffff);
21459             }
21460         }
21461     printf ("sLOCALTIME_max=%ld\n", pt);
21462     return (0);
21463    } /* check_max */
21464
21465 int check_min ()
21466 {
21467     tmp = NULL;
21468     pt  = 0;
21469 #ifdef MINLONG
21470     local_check (MINLONG, -1900, 70);
21471 #endif
21472     if (tmp == NULL) {
21473         for (i = 36; i >= 0; i--) {
21474             time_t x = pt - ((time_t)1 << i);
21475             if (x > 0) continue;
21476             local_check (x, -1900, 70);
21477             }
21478         }
21479     printf ("sLOCALTIME_min=%ld\n", pt);
21480     return (0);
21481     } /* check_min */
21482
21483 int main (int argc, char *argv[])
21484 {
21485     check_max ();
21486     check_min ();
21487     return (0);
21488     } /* main */
21489 EOCP
21490         set try
21491         if eval $compile; then
21492             eval `$run ./try 2>/dev/null`
21493         else
21494             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21495             fi
21496         $rm_try
21497         ;;
21498     esac
21499
21500 : check for type of arguments to select.
21501 case "$selecttype" in
21502 '') case "$d_select" in
21503         $define)
21504                 echo " "
21505                 $cat <<EOM
21506 Checking to see what type of arguments are accepted by select().
21507 EOM
21508                 hdrs="$define sys/types.h
21509                         $i_systime sys/time.h
21510                         $i_sysselct sys/select.h
21511                         $d_socket sys/socket.h"
21512                 : The first arg can be int, unsigned, or size_t
21513                 : The last arg may or may not be 'const'
21514                 val=''
21515                 : void pointer has been seen but using that
21516                 : breaks the selectminbits test
21517                 for xxx in 'fd_set *' 'int *'; do
21518                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21519                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
21520                                         case "$val" in
21521                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21522                                                 if ./protochk "$try" $hdrs; then
21523                                                         echo "Your system accepts $xxx."
21524                                                         val="$xxx"
21525                                                 fi
21526                                                 ;;
21527                                         esac
21528                                 done
21529                         done
21530                 done
21531                 case "$val" in
21532                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21533                         case "$d_fd_set" in
21534                                 $define) dflt="fd_set *" ;;
21535                                 *)              dflt="int *" ;;
21536                         esac
21537                         . ./myread
21538                         val=$ans
21539                         ;;
21540                 esac
21541                 selecttype="$val"
21542                 ;;
21543         *)      : no select, so pick a harmless default
21544                 selecttype='int *'
21545                 ;;
21546         esac
21547         ;;
21548 esac
21549
21550 : check for the select 'width'
21551 case "$selectminbits" in
21552 '') safebits=`expr $ptrsize \* 8`
21553     case "$d_select" in
21554         $define)
21555                 $cat <<EOM
21556
21557 Checking to see on how many bits at a time your select() operates...
21558 EOM
21559                 $cat >try.c <<EOCP
21560 #include <sys/types.h>
21561 #$i_time I_TIME
21562 #$i_systime I_SYS_TIME
21563 #$i_systimek I_SYS_TIME_KERNEL
21564 #ifdef I_TIME
21565 #   include <time.h>
21566 #endif
21567 #ifdef I_SYS_TIME
21568 #   ifdef I_SYS_TIME_KERNEL
21569 #       define KERNEL
21570 #   endif
21571 #   include <sys/time.h>
21572 #   ifdef I_SYS_TIME_KERNEL
21573 #       undef KERNEL
21574 #   endif
21575 #endif
21576 #$i_sysselct I_SYS_SELECT
21577 #ifdef I_SYS_SELECT
21578 #include <sys/select.h>
21579 #endif
21580 #$d_socket HAS_SOCKET
21581 #ifdef HAS_SOCKET
21582 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21583 #endif
21584 #include <stdio.h>
21585 #$i_stdlib I_STDLIB
21586 #ifdef I_STDLIB
21587 #include <stdlib.h>
21588 #endif
21589 $selecttype b;
21590 #define S sizeof(*(b))
21591 #define MINBITS 64
21592 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21593 #define NBITS  (NBYTES * 8)
21594 int main() {
21595     char *s = (char *)malloc(NBYTES);
21596     struct timeval t;
21597     int i;
21598     FILE* fp;
21599     int fd;
21600
21601     if (!s)
21602         exit(1);
21603     fclose(stdin);
21604     fp = fopen("try.c", "r");
21605     if (fp == 0)
21606       exit(2);
21607     fd = fileno(fp);
21608     if (fd < 0)
21609       exit(3);
21610     b = ($selecttype)s;
21611     for (i = 0; i < NBITS; i++)
21612         FD_SET(i, b);
21613     t.tv_sec  = 0;
21614     t.tv_usec = 0;
21615     select(fd + 1, b, 0, 0, &t);
21616     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
21617     free(s);
21618     printf("%d\n", i + 1);
21619     return 0;
21620 }
21621 EOCP
21622                 set try
21623                 if eval $compile_ok; then
21624                         selectminbits=`$run ./try 2>/dev/null`
21625                         case "$selectminbits" in
21626                         '')     cat >&4 <<EOM
21627 Cannot figure out on how many bits at a time your select() operates.
21628 I'll play safe and guess it is $safebits bits.
21629 EOM
21630                                 selectminbits=$safebits
21631                                 bits="$safebits bits"
21632                                 ;;
21633                         1)      bits="1 bit" ;;
21634                         *)      bits="$selectminbits bits" ;;
21635                         esac
21636                         echo "Your select() operates on $bits at a time." >&4
21637                 else
21638                         rp='What is the minimum number of bits your select() operates on?'
21639                         case "$byteorder" in
21640                         12345678)       dflt=64 ;;
21641                         1234)           dflt=32 ;;
21642                         *)              dflt=1  ;;
21643                         esac
21644                         . ./myread
21645                         val=$ans
21646                         selectminbits="$val"
21647                 fi
21648                 $rm_try
21649                 ;;
21650         *)      : no select, so pick a harmless default
21651                 selectminbits=$safebits
21652                 ;;
21653         esac
21654         ;;
21655 esac
21656
21657 : Trace out the files included by signal.h, then look for SIGxxx names.
21658 case "$sig_num_init" in
21659 '')
21660 if [ "X$fieldn" = X ]; then
21661         : Just make some guesses.  We check them later.
21662         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
21663 else
21664         xxx=`echo '#include <signal.h>' |
21665         $cppstdin $cppminus $cppflags 2>/dev/null |
21666         $grep '^[       ]*#.*include' |
21667         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
21668                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
21669 fi
21670 xxxfiles=''
21671 for xx in $xxx /dev/null ; do
21672         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
21673 done
21674 case "$xxxfiles" in
21675 '')     xxxfiles=`./findhdr signal.h` ;;
21676 esac
21677 xxx=`awk '
21678 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
21679         print substr($2, 4, 20)
21680 }
21681 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
21682         print substr($3, 4, 20)
21683 }' $xxxfiles`
21684 : Append some common names just in case the awk scan failed.
21685 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
21686 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
21687 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
21688 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
21689 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
21690
21691 : generate a few handy files for later
21692 $cat > signal.c <<EOCP
21693 #include <sys/types.h>
21694 #include <signal.h>
21695 #$i_stdlib I_STDLIB
21696 #ifdef I_STDLIB
21697 #include <stdlib.h>
21698 #endif
21699 #include <stdio.h>
21700 int main() {
21701
21702 /* Strange style to avoid deeply-nested #if/#else/#endif */
21703 #ifndef NSIG
21704 #  ifdef _NSIG
21705 #    define NSIG (_NSIG)
21706 #  endif
21707 #endif
21708
21709 #ifndef NSIG
21710 #  ifdef SIGMAX
21711 #    define NSIG (SIGMAX+1)
21712 #  endif
21713 #endif
21714
21715 #ifndef NSIG
21716 #  ifdef SIG_MAX
21717 #    define NSIG (SIG_MAX+1)
21718 #  endif
21719 #endif
21720
21721 #ifndef NSIG
21722 #  ifdef _SIG_MAX
21723 #    define NSIG (_SIG_MAX+1)
21724 #  endif
21725 #endif
21726
21727 #ifndef NSIG
21728 #  ifdef MAXSIG
21729 #    define NSIG (MAXSIG+1)
21730 #  endif
21731 #endif
21732
21733 #ifndef NSIG
21734 #  ifdef MAX_SIG
21735 #    define NSIG (MAX_SIG+1)
21736 #  endif
21737 #endif
21738
21739 #ifndef NSIG
21740 #  ifdef SIGARRAYSIZE
21741 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
21742 #  endif
21743 #endif
21744
21745 #ifndef NSIG
21746 #  ifdef _sys_nsig
21747 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
21748 #  endif
21749 #endif
21750
21751 /* Default to some arbitrary number that's big enough to get most
21752    of the common signals.
21753 */
21754 #ifndef NSIG
21755 #    define NSIG 50
21756 #endif
21757
21758 printf("NSIG %d\n", NSIG);
21759
21760 #ifndef JUST_NSIG
21761
21762 EOCP
21763
21764 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
21765 {
21766         printf "#ifdef SIG"; printf $1; printf "\n"
21767         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
21768         printf $1; printf ");\n"
21769         printf "#endif\n"
21770 }
21771 END {
21772         printf "#endif /* JUST_NSIG */\n";
21773         printf "exit(0);\n}\n";
21774 }
21775 ' >>signal.c
21776 $cat >signal.awk <<'EOP'
21777 BEGIN { ndups = 0 }
21778 $1 ~ /^NSIG$/ { nsig = $2 }
21779 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
21780     if ($2 > maxsig) { maxsig = $2 }
21781     if (sig_name[$2]) {
21782         dup_name[ndups] = $1
21783         dup_num[ndups] = $2
21784         ndups++
21785     }
21786     else {
21787         sig_name[$2] = $1
21788         sig_num[$2] = $2
21789     }
21790 }
21791 END {
21792     if (nsig == 0) {
21793         nsig = maxsig + 1
21794     }
21795     printf("NSIG %d\n", nsig);
21796     for (n = 1; n < nsig; n++) {
21797         if (sig_name[n]) {
21798             printf("%s %d\n", sig_name[n], sig_num[n])
21799         }
21800         else {
21801             printf("NUM%d %d\n", n, n)
21802         }
21803     }
21804     for (n = 0; n < ndups; n++) {
21805         printf("%s %d\n", dup_name[n], dup_num[n])
21806     }
21807 }
21808 EOP
21809 $cat >signal_cmd <<EOS
21810 $startsh
21811 if $test -s signal.lst; then
21812     echo "Using your existing signal.lst file"
21813         exit 0
21814 fi
21815 xxx="$xxx"
21816 EOS
21817 $cat >>signal_cmd <<'EOS'
21818
21819 set signal
21820 if eval $compile_ok; then
21821         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21822                 $uniq | $awk -f signal.awk >signal.lst
21823 else
21824         echo "(I can't seem be able to compile the whole test program)" >&4
21825         echo "(I'll try it in little pieces.)" >&4
21826         set signal -DJUST_NSIG
21827         if eval $compile_ok; then
21828                 $run ./signal$_exe > signal.nsg
21829                 $cat signal.nsg
21830         else
21831                 echo "I can't seem to figure out how many signals you have." >&4
21832                 echo "Guessing 50." >&4
21833                 echo 'NSIG 50' > signal.nsg
21834         fi
21835         : Now look at all the signal names, one at a time.
21836         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21837                 $cat > signal.c <<EOCP
21838 #include <sys/types.h>
21839 #include <signal.h>
21840 #include <stdio.h>
21841 int main() {
21842 printf("$xx %d\n", SIG${xx});
21843 return 0;
21844 }
21845 EOCP
21846                 set signal
21847                 if eval $compile; then
21848                         echo "SIG${xx} found."
21849                         $run ./signal$_exe  >> signal.ls1
21850                 else
21851                         echo "SIG${xx} NOT found."
21852                 fi
21853         done
21854         if $test -s signal.ls1; then
21855                 $cat signal.nsg signal.ls1 |
21856                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
21857         fi
21858
21859 fi
21860 if $test -s signal.lst; then
21861         :
21862 else
21863         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21864         echo 'kill -l' >signal
21865         set X `csh -f <signal`
21866         $rm -f signal
21867         shift
21868         case $# in
21869         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21870         esac
21871         echo $@ | $tr ' ' $trnl | \
21872             $awk '{ printf "%s %d\n", $1, ++s; }
21873                   END { printf "NSIG %d\n", ++s }' >signal.lst
21874 fi
21875 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21876 EOS
21877 chmod a+x signal_cmd
21878 $eunicefix signal_cmd
21879 ;;
21880 esac
21881
21882 : generate list of signal names
21883 case "$sig_num_init" in
21884 '')
21885 echo " "
21886 case "$sig_name_init" in
21887 '') doinit=yes ;;
21888 *)  case "$sig_num_init" in
21889     ''|*,*) doinit=yes ;;
21890     esac ;;
21891 esac
21892 case "$doinit" in
21893 yes)
21894         echo "Generating a list of signal names and numbers..." >&4
21895         . ./signal_cmd
21896         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21897         sig_name=`$awk 'BEGIN { printf "ZERO " }
21898                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21899         sig_num=`$awk  'BEGIN { printf "0 " }
21900                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21901         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
21902                              !/^NSIG/   { printf "\"%s\", ", $1 }
21903                              END        { printf "0\n" }' signal.lst`
21904         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21905                              !/^NSIG/   { printf "%d, ", $2}
21906                              END        { printf "0\n"}' signal.lst`
21907         ;;
21908 esac
21909 echo "The following $sig_count signals are available:"
21910 echo " "
21911 echo $sig_name | $awk \
21912 'BEGIN { linelen = 0 }
21913 {
21914         for (i = 1; i <= NF; i++) {
21915                 name = "SIG" $i " "
21916                 linelen = linelen + length(name)
21917                 if (linelen > 70) {
21918                         printf "\n"
21919                         linelen = length(name)
21920                 }
21921                 printf "%s", name
21922         }
21923         printf "\n"
21924 }'
21925 sig_size=`echo $sig_name | awk '{print NF}'`
21926 $rm -f signal signal.c signal.awk signal.lst signal_cmd
21927 ;;
21928 esac
21929
21930 : Check size of size
21931 echo " "
21932 case "$sizetype" in
21933 *_t) zzz="$sizetype"    ;;
21934 *)   zzz="filesize"     ;;
21935 esac
21936 echo "Checking the size of $zzz..." >&4
21937 cat > try.c <<EOCP
21938 #include <sys/types.h>
21939 #include <stdio.h>
21940 #$i_stdlib I_STDLIB
21941 #ifdef I_STDLIB
21942 #include <stdlib.h>
21943 #endif
21944 int main() {
21945     printf("%d\n", (int)sizeof($sizetype));
21946     exit(0);
21947 }
21948 EOCP
21949 set try
21950 if eval $compile_ok; then
21951         yyy=`$run ./try`
21952         case "$yyy" in
21953         '')     sizesize=4
21954                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21955                 ;;
21956         *)      sizesize=$yyy
21957                 echo "Your $zzz size is $sizesize bytes."
21958                 ;;
21959         esac
21960 else
21961         sizesize=4
21962         echo "(I can't compile the test program--guessing $sizesize.)" >&4
21963 fi
21964
21965
21966 : check for socklen_t
21967 echo " "
21968 echo "Checking to see if you have socklen_t..." >&4
21969 $cat >try.c <<EOCP
21970 #include <sys/types.h>
21971 #$d_socket HAS_SOCKET
21972 #ifdef HAS_SOCKET
21973 #include <sys/socket.h>
21974 #endif
21975 int main() { socklen_t x = 16; }
21976 EOCP
21977 set try
21978 if eval $compile; then
21979         val="$define"
21980         echo "You have socklen_t."
21981 else
21982         val="$undef"
21983         echo "You do not have socklen_t."
21984         case "$sizetype" in
21985         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21986         esac
21987 fi
21988 $rm_try
21989 set d_socklen_t
21990 eval $setvar
21991
21992 : see if this is a socks.h system
21993 set socks.h i_socks
21994 eval $inhdr
21995
21996 : check for type of the size argument to socket calls
21997 case "$d_socket" in
21998 "$define")
21999         $cat <<EOM
22000
22001 Checking to see what type is the last argument of accept().
22002 EOM
22003         yyy=''
22004         case "$d_socklen_t" in
22005         "$define") yyy="$yyy socklen_t"
22006         esac
22007         yyy="$yyy $sizetype int long unsigned"
22008         for xxx in $yyy; do
22009                 case "$socksizetype" in
22010                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22011                         case "$usesocks" in
22012                         "$define")
22013                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22014                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22015                                         socksizetype="$xxx"
22016                                 fi
22017                                 ;;
22018                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22019                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22020                                         socksizetype="$xxx"
22021                                 fi
22022                                 ;;
22023                         esac
22024                         ;;
22025                 esac
22026         done
22027 : In case none of those worked, prompt the user.
22028         case "$socksizetype" in
22029         '')     rp='What is the type for socket address structure sizes?'
22030                 dflt='int'
22031                 . ./myread
22032                 socksizetype=$ans
22033                 ;;
22034         esac
22035         ;;
22036 *)      : no sockets, so pick relatively harmless default
22037         socksizetype='int'
22038         ;;
22039 esac
22040
22041 : see what type is used for signed size_t
22042 set ssize_t ssizetype int stdio.h sys/types.h
22043 eval $typedef
22044 dflt="$ssizetype"
22045 $cat > try.c <<EOM
22046 #include <stdio.h>
22047 #$i_stdlib I_STDLIB
22048 #ifdef I_STDLIB
22049 #include <stdlib.h>
22050 #endif
22051 #include <sys/types.h>
22052 #define Size_t $sizetype
22053 #define SSize_t $dflt
22054 int main()
22055 {
22056         if (sizeof(Size_t) == sizeof(SSize_t))
22057                 printf("$dflt\n");
22058         else if (sizeof(Size_t) == sizeof(int))
22059                 printf("int\n");
22060         else
22061                 printf("long\n");
22062         exit(0);
22063 }
22064 EOM
22065 echo " "
22066 set try
22067 if eval $compile_ok && $run ./try > /dev/null; then
22068         ssizetype=`$run ./try`
22069         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22070 else
22071         $cat >&4 <<EOM
22072 Help! I can't compile and run the ssize_t test program: please enlighten me!
22073 (This is probably a misconfiguration in your system or libraries, and
22074 you really ought to fix it.  Still, I'll try anyway.)
22075
22076 I need a type that is the same size as $sizetype, but is guaranteed to
22077 be signed.  Common values are ssize_t, int and long.
22078
22079 EOM
22080         rp="What signed type is the same size as $sizetype?"
22081         . ./myread
22082         ssizetype="$ans"
22083 fi
22084 $rm_try
22085
22086 : Check the size of st_ino
22087 $echo " "
22088 $echo "Checking the size of st_ino..." >&4
22089 $cat > try.c <<EOCP
22090 #include <sys/stat.h>
22091 #include <stdio.h>
22092 #$i_stdlib I_STDLIB
22093 #ifdef I_STDLIB
22094 #include <stdlib.h>
22095 #endif
22096 int main() {
22097     struct stat st;
22098     printf("%d\n", (int)sizeof(st.st_ino));
22099     exit(0);
22100 }
22101 EOCP
22102 set try
22103 if eval $compile_ok; then
22104         val=`$run ./try`
22105         case "$val" in
22106         '')     st_ino_size=4
22107                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22108                 ;;
22109         *)      st_ino_size=$val
22110                 $echo "Your st_ino is $st_ino_size bytes long."
22111                 ;;
22112         esac
22113 else
22114         st_ino_size=4
22115         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22116 fi
22117 $rm_try
22118
22119 : Check if st_ino is signed
22120 $echo " "
22121 $echo "Checking the sign of st_ino..." >&4
22122 $cat > try.c <<EOCP
22123 #include <sys/stat.h>
22124 #include <stdio.h>
22125 int main() {
22126         struct stat foo;
22127         foo.st_ino = -1;
22128         if (foo.st_ino < 0)
22129                 printf("-1\n");
22130         else
22131                 printf("1\n");
22132 }
22133 EOCP
22134 set try
22135 if eval $compile; then
22136         val=`$run ./try`
22137         case "$val" in
22138         '')     st_ino_sign=1
22139                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22140                 ;;
22141         *)      st_ino_sign=$val
22142                 case "$st_ino_sign" in
22143                  1) $echo "Your st_ino is unsigned." ;;
22144                 -1) $echo "Your st_ino is signed."   ;;
22145                 esac
22146                 ;;
22147         esac
22148 else
22149         st_ino_sign=1
22150         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22151 fi
22152 $rm_try
22153
22154 : see what type of char stdio uses.
22155 echo " "
22156 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22157 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22158         echo "Your stdio uses unsigned chars." >&4
22159         stdchar="unsigned char"
22160 else
22161         echo "Your stdio uses signed chars." >&4
22162         stdchar="char"
22163 fi
22164 $rm -f stdioh
22165
22166 : Check size of UID
22167 echo " "
22168 case "$uidtype" in
22169 *_t) zzz="$uidtype"     ;;
22170 *)   zzz="uid"          ;;
22171 esac
22172 echo "Checking the size of $zzz..." >&4
22173 cat > try.c <<EOCP
22174 #include <sys/types.h>
22175 #include <stdio.h>
22176 #$i_stdlib I_STDLIB
22177 #ifdef I_STDLIB
22178 #include <stdlib.h>
22179 #endif
22180 int main() {
22181     printf("%d\n", (int)sizeof($uidtype));
22182     exit(0);
22183 }
22184 EOCP
22185 set try
22186 if eval $compile_ok; then
22187         yyy=`$run ./try`
22188         case "$yyy" in
22189         '')     uidsize=4
22190                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22191                 ;;
22192         *)      uidsize=$yyy
22193                 echo "Your $zzz is $uidsize bytes long."
22194                 ;;
22195         esac
22196 else
22197         uidsize=4
22198         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22199 fi
22200
22201 : Check if UID is signed
22202 echo " "
22203 case "$uidtype" in
22204 *_t) zzz="$uidtype"     ;;
22205 *)   zzz="uid"          ;;
22206 esac
22207 echo "Checking the sign of $zzz..." >&4
22208 cat > try.c <<EOCP
22209 #include <sys/types.h>
22210 #include <stdio.h>
22211 int main() {
22212         $uidtype foo = -1;
22213         if (foo < 0)
22214                 printf("-1\n");
22215         else
22216                 printf("1\n");
22217 }
22218 EOCP
22219 set try
22220 if eval $compile; then
22221         yyy=`$run ./try`
22222         case "$yyy" in
22223         '')     uidsign=1
22224                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22225                 ;;
22226         *)      uidsign=$yyy
22227                 case "$uidsign" in
22228                  1) echo "Your $zzz is unsigned." ;;
22229                 -1) echo "Your $zzz is signed."   ;;
22230                 esac
22231                 ;;
22232         esac
22233 else
22234         uidsign=1
22235         echo "(I can't compile the test program--guessing unsigned.)" >&4
22236 fi
22237
22238
22239 : Check format string for UID
22240 echo " "
22241 $echo "Checking the format string to be used for uids..." >&4
22242
22243 case "$uidsign" in
22244 -1)     if $test X"$uidsize" = X"$ivsize"; then
22245                 uidformat="$ivdformat"
22246         else
22247                 if $test X"$uidsize" = X"$longsize"; then
22248                         uidformat='"ld"'
22249                 else
22250                         if $test X"$uidsize" = X"$intsize"; then
22251                                 uidformat='"d"'
22252                         else
22253                                 if $test X"$uidsize" = X"$shortsize"; then
22254                                         uidformat='"hd"'
22255                                 fi
22256                         fi
22257                 fi
22258         fi
22259         ;;
22260 *)      if $test X"$uidsize" = X"$uvsize"; then
22261                 uidformat="$uvuformat"
22262         else
22263                 if $test X"$uidsize" = X"$longsize"; then
22264                         uidformat='"lu"'
22265                 else
22266                         if $test X"$uidsize" = X"$intsize"; then
22267                                 uidformat='"u"'
22268                         else
22269                                 if $test X"$uidsize" = X"$shortsize"; then
22270                                         uidformat='"hu"'
22271                                 fi
22272                         fi
22273                 fi
22274         fi
22275         ;;
22276 esac
22277
22278 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22279 echo " "
22280 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22281 $cat >try.c <<'EOM'
22282 /* Intentionally a long probe as I'd like to sanity check that the exact
22283    approach is going to work, as thinking it will work, but only having it
22284    part working at runtime is worse than not having it.  */
22285
22286 #include <sys/types.h>
22287 #include <sys/sysctl.h>
22288 #include <sys/param.h>
22289 #include <stdio.h>
22290 #include <string.h>
22291 #include <stdlib.h>
22292 #include <unistd.h>
22293
22294 int
22295 main(int argc, char **argv) {
22296     char *buffer;
22297     char *argv_leaf = strrchr(argv[0], '/');
22298     char *buffer_leaf;
22299     size_t size = 0;
22300     int mib[4];
22301
22302     mib[0] = CTL_KERN;
22303     mib[1] = KERN_PROC;
22304     mib[2] = KERN_PROC_PATHNAME;
22305     mib[3] = -1;
22306
22307     if (!argv_leaf) {
22308         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22309         return 1;
22310     }
22311
22312     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22313         perror("sysctl");
22314         return 2;
22315     }
22316
22317     if (size < strlen(argv_leaf) + 1) {
22318         fprintf(stderr, "size %lu is too short for a path\n",
22319                 (unsigned long) size);
22320         return 3;
22321     }
22322
22323     if (size > MAXPATHLEN * MAXPATHLEN) {
22324         fprintf(stderr, "size %lu is too long for a path\n",
22325                 (unsigned long) size);
22326         return 4;
22327     }
22328
22329     buffer = (char *)malloc(size);
22330     if (!buffer) {
22331         perror("malloc");
22332         return 5;
22333     }
22334
22335     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22336         perror("sysctl");
22337         return 6;
22338     }
22339
22340     if (strlen(buffer) + 1 != size) {
22341         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22342                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22343         return 7;
22344     }
22345
22346
22347     if (*buffer != '/') {
22348         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22349         return 8;
22350     }
22351
22352     if (strstr(buffer, "/./")) {
22353         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22354         return 9;
22355     }
22356
22357     if (strstr(buffer, "/../")) {
22358         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22359         return 10;
22360     }
22361
22362     buffer_leaf = strrchr(buffer, '/');
22363     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22364         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22365         return 11;
22366     }
22367
22368     free(buffer);
22369
22370     return 0;
22371 }
22372 EOM
22373
22374 val=$undef
22375 set try
22376 if eval $compile; then
22377         if $run ./try; then
22378                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22379                 val="$define"
22380         else
22381                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22382                 val="$undef"
22383         fi
22384 else
22385         echo "I'm unable to compile the test program." >&4
22386         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22387         val="$undef"
22388 fi
22389 $rm_try
22390 set usekernprocpathname
22391 eval $setvar
22392
22393 : Determine if we can use _NSGetExecutablePath to find executing program
22394 echo " "
22395 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22396 $cat >try.c <<'EOM'
22397 /* Intentionally a long probe as I'd like to sanity check that the exact
22398    approach is going to work, as thinking it will work, but only having it
22399    part working at runtime is worse than not having it.  */
22400 #include <mach-o/dyld.h>
22401 #include <stdio.h>
22402 #include <stdlib.h>
22403 #include <sys/param.h>
22404 #include <string.h>
22405
22406 int
22407 main(int argc, char **argv) {
22408     char buf[1];
22409     uint32_t size = sizeof(buf);
22410     int result;
22411     char *buffer;
22412     char *tidied;
22413     char *argv_leaf = strrchr(argv[0], '/');
22414     char *tidied_leaf;
22415
22416     if (!argv_leaf) {
22417         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22418         return 1;
22419     }
22420
22421     _NSGetExecutablePath(buf, &size);
22422     if (size > MAXPATHLEN * MAXPATHLEN) {
22423         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22424                 (unsigned int) size);
22425         return 2;
22426     }
22427
22428     buffer = (char *)malloc(size);
22429     if (!buffer) {
22430         perror("malloc");
22431         return 3;
22432     }
22433
22434     result = _NSGetExecutablePath(buffer, &size);
22435     if (result != 0) {
22436         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22437                 result, (unsigned int) size);
22438         return 4;
22439     }
22440
22441     tidied = realpath(buffer, NULL);
22442     if (!tidied) {
22443         perror("realpath");
22444         return 5;
22445     }
22446
22447     free(buffer);
22448
22449     if (*tidied != '/') {
22450         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22451         return 6;
22452     }
22453
22454     if (strstr(tidied, "/./")) {
22455         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22456         return 7;
22457     }
22458
22459     if (strstr(tidied, "/../")) {
22460         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22461         return 8;
22462     }
22463
22464     tidied_leaf = strrchr(tidied, '/');
22465     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22466         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22467         return 9;
22468     }
22469
22470     free(tidied);
22471
22472     return 0;
22473 }
22474 EOM
22475
22476 val=$undef
22477 set try
22478 if eval $compile; then
22479         if $run ./try; then
22480                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22481                 val="$define"
22482         else
22483                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22484         fi
22485 else
22486         echo "I'm unable to compile the test program." >&4
22487         echo "I'll assume no _NSGetExecutablePath here." >&4
22488 fi
22489 $rm_try
22490 set usensgetexecutablepath
22491 eval $setvar
22492
22493 : Check if site customization support was requested
22494 case "$usesitecustomize" in
22495     $define|true|[Yy]*)
22496         usesitecustomize="$define"
22497         ;;
22498     *)
22499         usesitecustomize="$undef"
22500         ;;
22501     esac
22502
22503 : determine compiler compiler
22504 case "$yacc" in
22505 '')
22506         dflt=yacc;;
22507 *)
22508         dflt="$yacc";;
22509 esac
22510 echo " "
22511 comp='yacc'
22512 if $test -f "$byacc$_exe"; then
22513         dflt="$byacc"
22514         comp="byacc or $comp"
22515 fi
22516 if $test -f "$bison$_exe"; then
22517         comp="$comp or bison -y"
22518 fi
22519 rp="Which compiler compiler ($comp) shall I use?"
22520 . ./myread
22521 yacc="$ans"
22522 case "$yacc" in
22523 *bis*)
22524         case "$yacc" in
22525         *-y*) ;;
22526         *)
22527                 yacc="$yacc -y"
22528                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22529                 ;;
22530         esac
22531         ;;
22532 esac
22533
22534 : see if this is a bfd.h system
22535 set bfd.h i_bfd
22536 eval $inhdr
22537
22538 : see if this is an execinfo.h system
22539 set execinfo.h i_execinfo
22540 eval $inhdr
22541
22542 : see if this is a fenv.h system
22543 set fenv.h i_fenv
22544 eval $inhdr
22545
22546 : see if this is a fp.h system
22547 set fp.h i_fp
22548 eval $inhdr
22549
22550 : see if this is a fp_class.h system
22551 set fp_class.h i_fp_class
22552 eval $inhdr
22553
22554 : see if gdbm.h is available
22555 set gdbm.h t_gdbm
22556 eval $inhdr
22557 case "$t_gdbm" in
22558 $define)
22559         : see if gdbm_open exists
22560         set gdbm_open d_gdbm_open
22561         eval $inlibc
22562         case "$d_gdbm_open" in
22563         $undef)
22564                 t_gdbm="$undef"
22565                 echo "We won't be including <gdbm.h>"
22566                 ;;
22567         esac
22568         ;;
22569 esac
22570 val="$t_gdbm"
22571 set i_gdbm
22572 eval $setvar
22573
22574 : see if this is a ieeefp.h system
22575 case "$i_ieeefp" in
22576 '' ) set ieeefp.h i_ieeefp
22577      eval $inhdr
22578      ;;
22579 esac
22580
22581 : see if this is a libutil.h system
22582 set libutil.h i_libutil
22583 eval $inhdr
22584
22585 : see if mach cthreads are available
22586 if test "X$usethreads" = "X$define"; then
22587         set mach/cthreads.h i_machcthr
22588         eval $inhdr
22589 else
22590         i_machcthr="$undef"
22591 fi
22592
22593 : see if this is a mntent.h system
22594 set mntent.h i_mntent
22595 eval $inhdr
22596
22597 : see if net/errno.h is available
22598 val=''
22599 set net/errno.h val
22600 eval $inhdr
22601
22602 : Unfortunately, it causes problems on some systems.  Arrgh.
22603 case "$val" in
22604 $define)
22605         cat > try.c <<'EOM'
22606 #include <stdio.h>
22607 #include <errno.h>
22608 #include <net/errno.h>
22609 int func()
22610 {
22611         return ENOTSOCK;
22612 }
22613 EOM
22614         if $cc $ccflags -c try.c >/dev/null 2>&1; then
22615                 echo "We'll be including <net/errno.h>." >&4
22616         else
22617                 echo "We won't be including <net/errno.h>." >&4
22618                 val="$undef"
22619         fi
22620         $rm_try
22621         ;;
22622 esac
22623 set i_neterrno
22624 eval $setvar
22625
22626 : see if netinet/tcp.h is available
22627 set netinet/tcp.h i_netinettcp
22628 eval $inhdr
22629
22630 : see if this is a poll.h system
22631 set poll.h i_poll
22632 eval $inhdr
22633
22634 : see if this is a prot.h system
22635 set prot.h i_prot
22636 eval $inhdr
22637
22638 : Preprocessor symbols
22639 echo " "
22640 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
22641 $cat <<'EOSH' > Cppsym.know
22642 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
22643 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
22644 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
22645 arch_pwr ardent ARM ARM32 atarist att386 att3b
22646 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
22647 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
22648 byteorder byte_order
22649 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
22650 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
22651 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
22652 ELF encore EPI EXTENSIONS
22653 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
22654 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
22655 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
22656 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
22657 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400
22658 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
22659 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
22660 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
22661 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
22662 ksr1
22663 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
22664 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
22665 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
22666 luna88k Lynx
22667 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
22668 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
22669 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
22670 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
22671 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
22672 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
22673 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
22674 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
22675 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
22676 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
22677 ns32000 ns32016 ns32332 ns32k nsc32000
22678 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
22679 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
22680 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
22681 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
22682 QK_USER QNX
22683 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
22684 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
22685 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
22686 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
22687 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
22688 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
22689 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
22690 SYSV4 SYSV5 sysV68 sysV88
22691 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
22692 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
22693 tower32_800 tower32_850 tss
22694 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
22695 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
22696 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
22697 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
22698 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
22699 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
22700 uxpm uxps
22701 vax venix VMESA vms
22702 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
22703 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
22704 z8000 zarch
22705 EOSH
22706 # Maybe put other stuff here too.
22707 ./tr '-' '_' <<EOSH >>Cppsym.know
22708 $osname
22709 EOSH
22710 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
22711 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
22712 $cat Cppsym.know > Cppsym.c
22713 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
22714 $rm -f Cppsym.a Cppsym.b Cppsym.c
22715 cat <<EOSH > Cppsym
22716 $startsh
22717 if $test \$# -gt 0; then
22718     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
22719     if $test -s Cppsym.got; then
22720         $rm -f Cppsym.got
22721         exit 0
22722     fi
22723     $rm -f Cppsym.got
22724     exit 1
22725 else
22726     $tr " " "$trnl" | ./Cppsym.try
22727     exit 0
22728 fi
22729 EOSH
22730 chmod +x Cppsym
22731 $eunicefix Cppsym
22732 cat <<EOSH > Cppsym.try
22733 $startsh
22734 cat <<'EOCP' > try.c
22735 #include <stdio.h>
22736 #if cpp_stuff == 1
22737 #define STRINGIFY(a)    "a"
22738 #endif
22739 #if cpp_stuff == 42
22740 #define StGiFy(a)  #a
22741 #define STRINGIFY(a)    StGiFy(a)
22742 #endif
22743 #if $cpp_stuff != 1 && $cpp_stuff != 42
22744 #   include "Bletch: How does this C preprocessor stringify macros?"
22745 #endif
22746 int main() {
22747 EOCP
22748 $awk \\
22749 EOSH
22750 cat <<'EOSH' >> Cppsym.try
22751 'length($1) > 0 {
22752     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
22753     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
22754     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
22755     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
22756 }'       >> try.c
22757 echo 'return 0;}' >> try.c
22758 EOSH
22759 cat <<EOSH >> Cppsym.try
22760 ccflags="$ccflags"
22761 case "$osname-$gccversion" in
22762 irix-) ccflags="\$ccflags -woff 1178" ;;
22763 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
22764 esac
22765 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
22766 EOSH
22767 chmod +x Cppsym.try
22768 $eunicefix Cppsym.try
22769 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
22770 : Add in any Linux cpp "predefined macros":
22771 case "$osname::$gccversion" in
22772   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
22773     tHdrH=_tmpHdr
22774     rm -f $tHdrH'.h' $tHdrH
22775     touch $tHdrH'.h'
22776     # Filter out macro arguments, such as Linux's __INT8_C(c)
22777     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
22778        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
22779        if [ -s $tHdrH'_cppsym.real' ]; then
22780           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22781        fi
22782     fi
22783     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22784   ;;
22785 esac
22786 : now check the C compiler for additional symbols
22787 postprocess_cc_v=''
22788 case "$osname" in
22789 aix) postprocess_cc_v="|$tr , ' '" ;;
22790 esac
22791 $cat >ccsym <<EOS
22792 $startsh
22793 $cat >tmp.c <<EOF
22794 extern int foo;
22795 EOF
22796 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22797 do
22798         case "\$i" in
22799         -D*) echo "\$i" | $sed 's/^-D//';;
22800         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22801         esac
22802 done
22803 $rm_try
22804 EOS
22805 postprocess_cc_v=''
22806 chmod +x ccsym
22807 $eunicefix ccsym
22808 ./ccsym > ccsym1.raw
22809 if $test -s ccsym1.raw; then
22810     $sort ccsym1.raw | $uniq >ccsym.raw
22811 else
22812     mv ccsym1.raw ccsym.raw
22813 fi
22814
22815 $awk '/\=/ { print $0; next }
22816         { print $0"=1" }' ccsym.raw >ccsym.list
22817 $comm -13 Cppsym.true ccsym.list >ccsym.own
22818 $comm -12 Cppsym.true ccsym.list >ccsym.com
22819 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
22820 also=''
22821 if $test -z ccsym.raw; then
22822         echo "Your C compiler doesn't seem to define any symbols!" >&4
22823         echo " "
22824         echo "However, your C preprocessor defines the following symbols:"
22825         $cat Cppsym.true
22826         ccsymbols=''
22827         cppsymbols=`$cat Cppsym.true`
22828         cppsymbols=`echo $cppsymbols`
22829         cppccsymbols="$cppsymbols"
22830 else
22831         if $test -s ccsym.com; then
22832                 echo "Your C compiler and pre-processor define these symbols:"
22833                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22834                 also='also '
22835                 symbols='ones'
22836                 cppccsymbols=`$cat ccsym.com`
22837                 cppccsymbols=`echo $cppccsymbols`
22838                 $test "$silent" || sleep 1
22839         fi
22840         if $test -s ccsym.cpp; then
22841                 $test "$also" && echo " "
22842                 echo "Your C pre-processor ${also}defines the following symbols:"
22843                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22844                 also='further '
22845                 cppsymbols=`$cat ccsym.cpp`
22846                 cppsymbols=`echo $cppsymbols`
22847                 $test "$silent" || sleep 1
22848         fi
22849         if $test -s ccsym.own; then
22850                 $test "$also" && echo " "
22851                 echo "Your C compiler ${also}defines the following cpp symbols:"
22852                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22853                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22854                 ccsymbols=`$cat ccsym.own`
22855                 ccsymbols=`echo $ccsymbols`
22856                 $test "$silent" || sleep 1
22857         fi
22858 fi
22859
22860 : add -D_FORTIFY_SOURCE if feasible and not already there
22861 case "$gccversion" in
22862 [4567].*)       case "$optimize$ccflags" in
22863         *-O*)   case "$ccflags$cppsymbols" in
22864                 *_FORTIFY_SOURCE=*) # Don't add it again.
22865                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
22866                         ;;
22867                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
22868                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
22869                         ;;
22870                 esac
22871                 ;;
22872         *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
22873                 ;;
22874         esac
22875         ;;
22876 *)      echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
22877         ;;
22878 esac
22879
22880 : script used to emit important warnings
22881 cat >warn <<EOS
22882 $startsh
22883 if test \$# -gt 0; then
22884         echo "\$@" >msg
22885 else
22886         cat >msg
22887 fi
22888 echo "*** WARNING:" >&4
22889 sed -e 's/^/*** /' <msg >&4
22890 echo "*** " >&4
22891 cat msg >>config.msg
22892 echo " " >>config.msg
22893 rm -f msg
22894 EOS
22895 chmod +x warn
22896 $eunicefix warn
22897
22898 : see if this is a termio system
22899 val="$undef"
22900 val2="$undef"
22901 val3="$undef"
22902 if $test `./findhdr termios.h`; then
22903     set tcsetattr i_termios
22904     eval $inlibc
22905     val3="$i_termios"
22906 fi
22907 echo " "
22908 case "$val3" in
22909     "$define") echo "You have POSIX termios.h... good!" >&4;;
22910     *)  if ./Cppsym pyr; then
22911             case "`$run /bin/universe`" in
22912                 ucb) if $test `./findhdr sgtty.h`; then
22913                         val2="$define"
22914                         echo "<sgtty.h> found." >&4
22915                     else
22916                         echo "System is pyramid with BSD universe."
22917                         ./warn "<sgtty.h> not found--you could have problems."
22918                     fi;;
22919                 *)  if $test `./findhdr termio.h`; then
22920                         val="$define"
22921                         echo "<termio.h> found." >&4
22922                     else
22923                         echo "System is pyramid with USG universe."
22924                         ./warn "<termio.h> not found--you could have problems."
22925                     fi;;
22926             esac
22927         elif ./usg; then
22928             if $test `./findhdr termio.h`; then
22929                 echo "<termio.h> found." >&4
22930                 val="$define"
22931             elif $test `./findhdr sgtty.h`; then
22932                 echo "<sgtty.h> found." >&4
22933                 val2="$define"
22934             else
22935                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
22936             fi
22937         else
22938             if $test `./findhdr sgtty.h`; then
22939                 echo "<sgtty.h> found." >&4
22940                 val2="$define"
22941             elif $test `./findhdr termio.h`; then
22942                 echo "<termio.h> found." >&4
22943                 val="$define"
22944             else
22945                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
22946             fi
22947         fi;;
22948 esac
22949 set i_termio; eval $setvar
22950 val=$val2; set i_sgtty; eval $setvar
22951 val=$val3; set i_termios; eval $setvar
22952
22953 : see if stdbool is available
22954 : we want a real compile instead of Inhdr because some Solaris systems
22955 : have stdbool.h, but it can only be used if the compiler indicates it
22956 : is sufficiently c99-compliant.
22957 echo " "
22958 $cat >try.c <<EOCP
22959 #include <stdio.h>
22960 #include <stdbool.h>
22961 int func(bool x)
22962 {
22963     return x ? 1 : 0;
22964 }
22965 int main(int argc, char **argv)
22966 {
22967     return func(0);
22968 }
22969 EOCP
22970 set try
22971 if eval $compile; then
22972         echo "<stdbool.h> found." >&4
22973         val="$define"
22974 else
22975         echo "<stdbool.h> NOT found." >&4
22976         val="$undef"
22977 fi
22978 $rm_try
22979 set i_stdbool
22980 eval $setvar
22981
22982 : see if stdint is available
22983 set stdint.h i_stdint
22984 eval $inhdr
22985
22986 : see if sys/access.h is available
22987 set sys/access.h i_sysaccess
22988 eval $inhdr
22989
22990 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22991 set sys/filio.h i_sysfilio
22992 eval $inhdr
22993 echo " "
22994 if $test `./findhdr sys/ioctl.h`; then
22995         val="$define"
22996         echo '<sys/ioctl.h> found.' >&4
22997 else
22998         val="$undef"
22999         if $test $i_sysfilio = "$define"; then
23000             echo '<sys/ioctl.h> NOT found.' >&4
23001         else
23002                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23003                 $test $i_termio = "$define" && xxx="termio.h"
23004                 $test $i_termios = "$define" && xxx="termios.h"
23005 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23006         fi
23007 fi
23008 set i_sysioctl
23009 eval $setvar
23010
23011 : see if socket ioctl defs are in sys/sockio.h
23012 echo " "
23013 xxx=`./findhdr sys/sockio.h`
23014 if $test "$xxx"; then
23015         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23016                 val="$define"
23017                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23018         else
23019                 val="$undef"
23020                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23021         fi
23022 else
23023         val="$undef"
23024         $cat <<EOM
23025 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23026 EOM
23027 fi
23028 set i_syssockio
23029 eval $setvar
23030
23031 : see if this is a syslog.h system
23032 set syslog.h i_syslog
23033 eval $inhdr
23034
23035 : see if this is a sys/mode.h system
23036 set sys/mode.h i_sysmode
23037 eval $inhdr
23038
23039 : see if there is a sys/poll.h file
23040 set sys/poll.h i_syspoll
23041 eval $inhdr
23042
23043 : see if sys/resource.h has to be included
23044 set sys/resource.h i_sysresrc
23045 eval $inhdr
23046
23047 : see if sys/security.h is available
23048 set sys/security.h i_syssecrt
23049 eval $inhdr
23050
23051 : see if this is a sys/statvfs.h system
23052 set sys/statvfs.h i_sysstatvfs
23053 eval $inhdr
23054
23055 : see if this is a sys/un.h system
23056 set sys/un.h i_sysun
23057 eval $inhdr
23058
23059 : see if this is a sys/utsname.h system
23060 set sys/utsname.h i_sysutsname
23061 eval $inhdr
23062
23063 : see if this is a syswait system
23064 set sys/wait.h i_syswait
23065 eval $inhdr
23066
23067 : see if this is a ustat.h system
23068 set ustat.h i_ustat
23069 eval $inhdr
23070
23071 : see if this is an utime system
23072 set utime.h i_utime
23073 eval $inhdr
23074
23075 : see if this is a vfork system
23076 case "$d_vfork" in
23077 "$define")
23078         set vfork.h i_vfork
23079         eval $inhdr
23080         ;;
23081 *)
23082         i_vfork="$undef"
23083         ;;
23084 esac
23085
23086 : see if wchar.h is present
23087 set wchar.h i_wchar
23088 eval $inhdr
23089
23090 : Check extensions
23091 echo " "
23092 echo "Looking for extensions..." >&4
23093 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23094 : contain old or inaccurate or duplicate values.
23095 nonxs_extensions=''
23096 xs_extensions=''
23097 : We do not use find because it might not be available.
23098 : We do not just use MANIFEST because the user may have dropped
23099 : some additional extensions into the source tree and expect them
23100 : to be built.
23101
23102 : Function to recursively find available extensions, ignoring DynaLoader
23103 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23104 : In 5.10.1 and later, extensions are stored in directories
23105 : like File-Glob instead of the older File/Glob/.
23106 find_extensions='
23107     for xxx in *; do
23108         case "$xxx" in
23109             DynaLoader|dynaload) ;;
23110             *)
23111             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23112             case "$this_ext" in
23113                 Scalar/List/Utils) this_ext="List/Util" ;;
23114                 PathTools)         this_ext="Cwd"       ;;
23115             esac;
23116             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23117             if $contains " $this_ext " "$tdir/$$.tmp"; then
23118                 echo >&4;
23119                 echo "Duplicate directories detected for extension $xxx" >&4;
23120                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23121                 case "$knowitall" in
23122                 "") dflt=y;;
23123                 *) dflt=n;;
23124                 esac;
23125                 . ../UU/myread;
23126                 case "$ans" in
23127                 n*|N*) ;;
23128                 *) echo >&4;
23129                     echo "Ok.  Stopping Configure." >&4;
23130                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23131                     exit 1;;
23132                 esac;
23133                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23134             fi;
23135             $ls -1 "$xxx" > "$tdir/$$.tmp";
23136             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23137                 xs_extensions="$xs_extensions $this_ext";
23138             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
23139                 xs_extensions="$xs_extensions $this_ext";
23140             elif $test -d "$xxx"; then
23141                 nonxs_extensions="$nonxs_extensions $this_ext";
23142             fi;
23143             $rm -f "$tdir/$$.tmp";
23144             ;;
23145         esac;
23146     done'
23147 tdir=`pwd`
23148 cd "$rsrc/cpan"
23149 set X
23150 shift
23151 eval $find_extensions
23152 cd "$rsrc/dist"
23153 set X
23154 shift
23155 eval $find_extensions
23156 cd "$rsrc/ext"
23157 set X
23158 shift
23159 eval $find_extensions
23160 set X $xs_extensions
23161 shift
23162 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23163 set X $nonxs_extensions
23164 shift
23165 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23166 cd "$tdir"
23167 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23168
23169 : Now see which are supported on this system.
23170 avail_ext=''
23171 for xxx in $xs_extensions ; do
23172         case "$xxx" in
23173         Amiga*)
23174                 case "$osname" in
23175                 amigaos) avail_ext="$avail_ext $xxx" ;;
23176                 esac
23177                 ;;
23178         DB_File|db_file)
23179                 case "$i_db" in
23180                 $define) avail_ext="$avail_ext $xxx" ;;
23181                 esac
23182                 ;;
23183         GDBM_File|gdbm_fil)
23184                 case "$i_gdbm" in
23185                 $define) avail_ext="$avail_ext $xxx" ;;
23186                 esac
23187                 ;;
23188         I18N/Langinfo|i18n_lan)
23189                 case "$i_langinfo$d_nl_langinfo" in
23190                 $define$define) avail_ext="$avail_ext $xxx" ;;
23191                 esac
23192                 ;;
23193         IPC/SysV|ipc/sysv)
23194                 : XXX Do we need a useipcsysv variable here
23195                 case "${d_msg}${d_sem}${d_shm}" in
23196                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23197                 esac
23198                 ;;
23199         NDBM_File|ndbm_fil)
23200                 case "$d_ndbm" in
23201                 $define)
23202                     case "$osname-$use64bitint" in
23203                     hpux-define)
23204                         case "$libs" in
23205                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23206                         esac
23207                         ;;
23208                     *) avail_ext="$avail_ext $xxx" ;;
23209                     esac
23210                     ;;
23211                 esac
23212                 ;;
23213         ODBM_File|odbm_fil)
23214                 case "${i_dbm}${i_rpcsvcdbm}" in
23215                 *"${define}"*)
23216                     case "$d_cplusplus" in
23217                     define) ;; # delete as a function name will not work
23218                     *)  case "$osname-$use64bitint" in
23219                         hpux-define)
23220                             case "$libs" in
23221                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23222                             esac
23223                             ;;
23224                         *) avail_ext="$avail_ext $xxx" ;;
23225                         esac
23226                         ;;
23227                     esac
23228                     ;;
23229                 esac
23230                 ;;
23231         Opcode|opcode)
23232                 case "$useopcode" in
23233                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23234                 esac
23235                 ;;
23236         POSIX|posix)
23237                 case "$useposix" in
23238                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23239                 esac
23240                 ;;
23241         Socket|socket)
23242                 case "$d_socket" in
23243                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23244                 esac
23245                 ;;
23246         Sys/Syslog|sys/syslog)
23247                 case $osname in
23248                         amigaos) ;; # not really very useful on AmigaOS
23249                         *)
23250                         : XXX syslog requires socket
23251                         case "$d_socket" in
23252                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
23253                         esac
23254                         ;;
23255                 esac
23256                 ;;
23257         Thread|thread)
23258                 case "$usethreads" in
23259                 true|$define|y)
23260                         case "$use5005threads" in
23261                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23262                         esac
23263                 esac
23264                 ;;
23265         threads|threads/shared)
23266                 # threads and threads::shared are special cases.
23267                 # To stop people from asking "Perl 5.8.0 was supposed
23268                 # to have this new fancy threads implementation but my
23269                 # perl doesn't have it" and from people trying to
23270                 # (re)install the threads module using CPAN.pm and
23271                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23272                 # the threads.pm and threads/shared.pm will always be
23273                 # there, croaking informatively ("you need to rebuild
23274                 # all of Perl with threads, sorry") when threads haven't
23275                 # been compiled in.
23276                 # --jhi
23277                 avail_ext="$avail_ext $xxx"
23278                 ;;
23279         VMS*)
23280                 ;;
23281         Win32*)
23282                 case "$osname" in
23283                 cygwin) avail_ext="$avail_ext $xxx" ;;
23284                 esac
23285                 ;;
23286         XS/APItest|xs/apitest)
23287                 # This is just for testing.  Skip it unless we have dynamic loading.
23288
23289                 case "$usedl" in
23290                 $define) avail_ext="$avail_ext $xxx" ;;
23291                 esac
23292                 ;;
23293         XS/Typemap|xs/typemap)
23294                 # This is just for testing.  Skip it unless we have dynamic loading.
23295                 case "$usedl" in
23296                 $define) avail_ext="$avail_ext $xxx" ;;
23297                 esac
23298                 ;;
23299         *)      avail_ext="$avail_ext $xxx"
23300                 ;;
23301         esac
23302 done
23303
23304 set X $avail_ext
23305 shift
23306 avail_ext="$*"
23307
23308 case "$onlyextensions" in
23309 '') ;;
23310 *)  keepextensions=''
23311     echo "You have requested that only certain extensions be included..." >&4
23312     for i in $onlyextensions; do
23313         case " $avail_ext " in
23314         *" $i "*)
23315             echo "Keeping extension $i."
23316             keepextensions="$keepextensions $i"
23317             ;;
23318         *) echo "Ignoring extension $i." ;;
23319         esac
23320     done
23321     avail_ext="$keepextensions"
23322     ;;
23323 esac
23324
23325 case "$noextensions" in
23326 '') ;;
23327 *)  keepextensions=''
23328     echo "You have requested that certain extensions be ignored..." >&4
23329     for i in $avail_ext; do
23330         case " $noextensions " in
23331         *" $i "*) echo "Ignoring extension $i." ;;
23332         *) echo "Keeping extension $i.";
23333            keepextensions="$keepextensions $i"
23334            ;;
23335         esac
23336     done
23337     avail_ext="$keepextensions"
23338     ;;
23339 esac
23340
23341 : Now see which nonxs extensions are supported on this system.
23342 : For now assume all are.
23343 nonxs_ext=''
23344 for xxx in $nonxs_extensions ; do
23345         case "$xxx" in
23346         VMS*)
23347                 ;;
23348         *)      nonxs_ext="$nonxs_ext $xxx"
23349                 ;;
23350         esac
23351 done
23352
23353 set X $nonxs_ext
23354 shift
23355 nonxs_ext="$*"
23356
23357 case $usedl in
23358 $define)
23359         $cat <<EOM
23360 A number of extensions are supplied with $package.  You may choose to
23361 compile these extensions for dynamic loading (the default), compile
23362 them into the $package executable (static loading), or not include
23363 them at all.  Answer "none" to include no extensions.
23364 Note that DynaLoader is always built and need not be mentioned here.
23365
23366 EOM
23367         case "$dynamic_ext" in
23368         '')
23369                 : Exclude those listed in static_ext
23370                 dflt=''
23371                 for xxx in $avail_ext; do
23372                         case " $static_ext " in
23373                         *" $xxx "*) ;;
23374                         *) dflt="$dflt $xxx" ;;
23375                         esac
23376                 done
23377                 set X $dflt
23378                 shift
23379                 dflt="$*"
23380                 ;;
23381         *)      dflt="$dynamic_ext"
23382                 # Perhaps we are reusing an old out-of-date config.sh.
23383                 case "$hint" in
23384                 previous)
23385                         if test X"$dynamic_ext" != X"$avail_ext"; then
23386                                 $cat <<EOM
23387 NOTICE:  Your previous config.sh list may be incorrect.
23388 The extensions now available to you are
23389         ${avail_ext}
23390 but the default list from your previous config.sh is
23391         ${dynamic_ext}
23392
23393 EOM
23394                         fi
23395                         ;;
23396                 esac
23397                 ;;
23398         esac
23399         case "$dflt" in
23400         '')     dflt=none;;
23401         esac
23402         rp="What extensions do you wish to load dynamically?"
23403         . ./myread
23404         case "$ans" in
23405         none) dynamic_ext=' ' ;;
23406         *) dynamic_ext="$ans" ;;
23407         esac
23408
23409         case "$static_ext" in
23410         '')
23411                 : Exclude those already listed in dynamic linking
23412                 dflt=''
23413                 for xxx in $avail_ext; do
23414                         case " $dynamic_ext " in
23415                         *" $xxx "*) ;;
23416                         *) dflt="$dflt $xxx" ;;
23417                         esac
23418                 done
23419                 set X $dflt
23420                 shift
23421                 dflt="$*"
23422                 ;;
23423         *)  dflt="$static_ext"
23424                 ;;
23425         esac
23426
23427         case "$dflt" in
23428         '')     dflt=none;;
23429         esac
23430         rp="What extensions do you wish to load statically?"
23431         . ./myread
23432         case "$ans" in
23433         none) static_ext=' ' ;;
23434         *) static_ext="$ans" ;;
23435         esac
23436         ;;
23437 *)
23438         $cat <<EOM
23439 A number of extensions are supplied with $package.  Answer "none"
23440 to include no extensions.
23441 Note that DynaLoader is always built and need not be mentioned here.
23442
23443 EOM
23444         case "$static_ext" in
23445         '') dflt="$avail_ext" ;;
23446         *)      dflt="$static_ext"
23447                 # Perhaps we are reusing an old out-of-date config.sh.
23448                 case "$hint" in
23449                 previous)
23450                         if test X"$static_ext" != X"$avail_ext"; then
23451                                 $cat <<EOM
23452 NOTICE:  Your previous config.sh list may be incorrect.
23453 The extensions now available to you are
23454         ${avail_ext}
23455 but the default list from your previous config.sh is
23456         ${static_ext}
23457
23458 EOM
23459                         fi
23460                         ;;
23461                 esac
23462                 ;;
23463         esac
23464         : Exclude those that are not xs extensions
23465         case "$dflt" in
23466         '')     dflt=none;;
23467         esac
23468         rp="What extensions do you wish to include?"
23469         . ./myread
23470         case "$ans" in
23471         none) static_ext=' ' ;;
23472         *) static_ext="$ans" ;;
23473         esac
23474         ;;
23475 esac
23476 #
23477 # Encode is a special case.  If we are building Encode as a static
23478 # extension, we need to explicitly list its subextensions as well.
23479 # For other nested extensions, this is handled automatically by
23480 # the appropriate Makefile.PL.
23481 case " $static_ext " in
23482         *" Encode "*) # Add the subextensions of Encode
23483         cd "$rsrc/cpan"
23484         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23485                 static_ext="$static_ext Encode/$xxx"
23486                 known_extensions="$known_extensions Encode/$xxx"
23487         done
23488         cd "$tdir"
23489         ;;
23490 esac
23491
23492 set X $dynamic_ext $static_ext $nonxs_ext
23493 shift
23494 extensions="$*"
23495
23496 # Sanity check:  We require an extension suitable for use with
23497 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23498 # should show up as failures in the test suite, but it's helpful to
23499 # catch them now.) The 'extensions' list is normally sorted
23500 # alphabetically, so we need to accept either
23501 #    DB_File ... Fcntl ... IO  ....
23502 # or something like
23503 #    Fcntl ... NDBM_File ... IO  ....
23504 case " $extensions"  in
23505 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
23506 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23507 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23508 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23509    echo "WARNING: The Perl you are building will be quite crippled." >& 4
23510    ;;
23511 esac
23512
23513 : Remove libraries needed only for extensions
23514 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23515 : The exception is SunOS 4.x, which needs them.
23516 case "${osname}X${osvers}" in
23517 sunos*X4*)
23518     perllibs="$libs"
23519     ;;
23520 *) case "$usedl" in
23521     $define|true|[yY]*)
23522             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23523             shift
23524             perllibs="$*"
23525             ;;
23526     *)  perllibs="$libs"
23527             ;;
23528     esac
23529     ;;
23530 esac
23531
23532 : Remove build directory name from cppstdin so it can be used from
23533 : either the present location or the final installed location.
23534 echo " "
23535 : Get out of the UU directory to get correct path name.
23536 cd ..
23537 case "$cppstdin" in
23538 `pwd`/cppstdin)
23539         echo "Stripping down cppstdin path name"
23540         cppstdin=cppstdin
23541         ;;
23542 esac
23543 cd UU
23544
23545 : end of configuration questions
23546 echo " "
23547 echo "End of configuration questions."
23548 echo " "
23549
23550 : back to where it started
23551 if test -d ../UU; then
23552         cd ..
23553 fi
23554
23555 : configuration may be unconditionally patched via a 'config.arch' file
23556 if $test -f config.arch; then
23557         echo "I see a config.arch file, loading it." >&4
23558         . ./config.arch
23559 fi
23560
23561 : configuration may be patched via a 'config.over' file
23562 if $test -f config.over; then
23563         echo " "
23564         dflt=y
23565         rp='I see a config.over file.  Do you wish to load it?'
23566         . UU/myread
23567         case "$ans" in
23568         n*) echo "OK, I'll ignore it.";;
23569         *)      . ./config.over
23570                 echo "Configuration override changes have been loaded."
23571                 ;;
23572         esac
23573 fi
23574
23575 : in case they want portability, strip down executable paths
23576 case "$d_portable" in
23577 "$define")
23578         echo " "
23579         echo "Stripping down executable paths..." >&4
23580         for file in $loclist $trylist; do
23581                 eval temp=\$$file
23582                 eval $file=`basename $temp`
23583         done
23584         ;;
23585 esac
23586
23587 : create config.sh file
23588 echo " "
23589 echo "Creating config.sh..." >&4
23590 $spitshell <<EOT >config.sh
23591 $startsh
23592 #
23593 # This file was produced by running the Configure script. It holds all the
23594 # definitions figured out by Configure. Should you modify one of these values,
23595 # do not forget to propagate your changes by running "Configure -der". You may
23596 # instead choose to run each of the .SH files by yourself, or "Configure -S".
23597 #
23598
23599 # Package name      : $package
23600 # Source directory  : $src
23601 # Configuration time: $cf_time
23602 # Configured by     : $cf_by
23603 # Target system     : $myuname
23604
23605 EOT
23606 : Add in command line options if available
23607 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23608
23609 $spitshell <<EOT >>config.sh
23610
23611 Author='$Author'
23612 Date='$Date'
23613 Header='$Header'
23614 Id='$Id'
23615 Locker='$Locker'
23616 Log='$Log'
23617 RCSfile='$RCSfile'
23618 Revision='$Revision'
23619 Source='$Source'
23620 State='$State'
23621 _a='$_a'
23622 _exe='$_exe'
23623 _o='$_o'
23624 afs='$afs'
23625 afsroot='$afsroot'
23626 alignbytes='$alignbytes'
23627 aphostname='$aphostname'
23628 api_revision='$api_revision'
23629 api_subversion='$api_subversion'
23630 api_version='$api_version'
23631 api_versionstring='$api_versionstring'
23632 ar='$ar'
23633 archlib='$archlib'
23634 archlibexp='$archlibexp'
23635 archname64='$archname64'
23636 archname='$archname'
23637 archobjs='$archobjs'
23638 asctime_r_proto='$asctime_r_proto'
23639 awk='$awk'
23640 baserev='$baserev'
23641 bash='$bash'
23642 bin='$bin'
23643 bin_ELF='$bin_ELF'
23644 binexp='$binexp'
23645 bison='$bison'
23646 byacc='$byacc'
23647 byteorder='$byteorder'
23648 c='$c'
23649 castflags='$castflags'
23650 cat='$cat'
23651 cc='$cc'
23652 cccdlflags='$cccdlflags'
23653 ccdlflags='$ccdlflags'
23654 ccflags='$ccflags'
23655 ccflags_uselargefiles='$ccflags_uselargefiles'
23656 ccname='$ccname'
23657 ccsymbols='$ccsymbols'
23658 ccversion='$ccversion'
23659 cf_by='$cf_by'
23660 cf_email='$cf_email'
23661 cf_time='$cf_time'
23662 charbits='$charbits'
23663 charsize='$charsize'
23664 chgrp='$chgrp'
23665 chmod='$chmod'
23666 chown='$chown'
23667 clocktype='$clocktype'
23668 comm='$comm'
23669 compress='$compress'
23670 contains='$contains'
23671 cp='$cp'
23672 cpio='$cpio'
23673 cpp='$cpp'
23674 cpp_stuff='$cpp_stuff'
23675 cppccsymbols='$cppccsymbols'
23676 cppflags='$cppflags'
23677 cpplast='$cpplast'
23678 cppminus='$cppminus'
23679 cpprun='$cpprun'
23680 cppstdin='$cppstdin'
23681 cppsymbols='$cppsymbols'
23682 crypt_r_proto='$crypt_r_proto'
23683 cryptlib='$cryptlib'
23684 csh='$csh'
23685 ctermid_r_proto='$ctermid_r_proto'
23686 ctime_r_proto='$ctime_r_proto'
23687 d_Gconvert='$d_Gconvert'
23688 d_PRIEUldbl='$d_PRIEUldbl'
23689 d_PRIFUldbl='$d_PRIFUldbl'
23690 d_PRIGUldbl='$d_PRIGUldbl'
23691 d_PRIXU64='$d_PRIXU64'
23692 d_PRId64='$d_PRId64'
23693 d_PRIeldbl='$d_PRIeldbl'
23694 d_PRIfldbl='$d_PRIfldbl'
23695 d_PRIgldbl='$d_PRIgldbl'
23696 d_PRIi64='$d_PRIi64'
23697 d_PRIo64='$d_PRIo64'
23698 d_PRIu64='$d_PRIu64'
23699 d_PRIx64='$d_PRIx64'
23700 d_SCNfldbl='$d_SCNfldbl'
23701 d__fwalk='$d__fwalk'
23702 d_access='$d_access'
23703 d_accessx='$d_accessx'
23704 d_acosh='$d_acosh'
23705 d_aintl='$d_aintl'
23706 d_alarm='$d_alarm'
23707 d_archlib='$d_archlib'
23708 d_asctime64='$d_asctime64'
23709 d_asctime_r='$d_asctime_r'
23710 d_asinh='$d_asinh'
23711 d_atanh='$d_atanh'
23712 d_atolf='$d_atolf'
23713 d_atoll='$d_atoll'
23714 d_attribute_deprecated='$d_attribute_deprecated'
23715 d_attribute_format='$d_attribute_format'
23716 d_attribute_malloc='$d_attribute_malloc'
23717 d_attribute_nonnull='$d_attribute_nonnull'
23718 d_attribute_noreturn='$d_attribute_noreturn'
23719 d_attribute_pure='$d_attribute_pure'
23720 d_attribute_unused='$d_attribute_unused'
23721 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
23722 d_backtrace='$d_backtrace'
23723 d_bsd='$d_bsd'
23724 d_bsdgetpgrp='$d_bsdgetpgrp'
23725 d_bsdsetpgrp='$d_bsdsetpgrp'
23726 d_builtin_add_overflow='$d_builtin_add_overflow'
23727 d_builtin_choose_expr='$d_builtin_choose_expr'
23728 d_builtin_expect='$d_builtin_expect'
23729 d_builtin_mul_overflow='$d_builtin_mul_overflow'
23730 d_builtin_sub_overflow='$d_builtin_sub_overflow'
23731 d_c99_variadic_macros='$d_c99_variadic_macros'
23732 d_casti32='$d_casti32'
23733 d_castneg='$d_castneg'
23734 d_cbrt='$d_cbrt'
23735 d_chown='$d_chown'
23736 d_chroot='$d_chroot'
23737 d_chsize='$d_chsize'
23738 d_class='$d_class'
23739 d_clearenv='$d_clearenv'
23740 d_closedir='$d_closedir'
23741 d_cmsghdr_s='$d_cmsghdr_s'
23742 d_const='$d_const'
23743 d_copysign='$d_copysign'
23744 d_copysignl='$d_copysignl'
23745 d_cplusplus='$d_cplusplus'
23746 d_crypt='$d_crypt'
23747 d_crypt_r='$d_crypt_r'
23748 d_csh='$d_csh'
23749 d_ctermid='$d_ctermid'
23750 d_ctermid_r='$d_ctermid_r'
23751 d_ctime64='$d_ctime64'
23752 d_ctime_r='$d_ctime_r'
23753 d_cuserid='$d_cuserid'
23754 d_dbminitproto='$d_dbminitproto'
23755 d_difftime64='$d_difftime64'
23756 d_difftime='$d_difftime'
23757 d_dir_dd_fd='$d_dir_dd_fd'
23758 d_dirfd='$d_dirfd'
23759 d_dirnamlen='$d_dirnamlen'
23760 d_dladdr='$d_dladdr'
23761 d_dlerror='$d_dlerror'
23762 d_dlopen='$d_dlopen'
23763 d_dlsymun='$d_dlsymun'
23764 d_dosuid='$d_dosuid'
23765 d_double_has_inf='$d_double_has_inf'
23766 d_double_has_nan='$d_double_has_nan'
23767 d_double_has_negative_zero='$d_double_has_negative_zero'
23768 d_double_has_subnormals='$d_double_has_subnormals'
23769 d_double_style_cray='$d_double_style_cray'
23770 d_double_style_ibm='$d_double_style_ibm'
23771 d_double_style_ieee='$d_double_style_ieee'
23772 d_double_style_vax='$d_double_style_vax'
23773 d_drand48_r='$d_drand48_r'
23774 d_drand48proto='$d_drand48proto'
23775 d_dup2='$d_dup2'
23776 d_duplocale='$d_duplocale'
23777 d_eaccess='$d_eaccess'
23778 d_endgrent='$d_endgrent'
23779 d_endgrent_r='$d_endgrent_r'
23780 d_endhent='$d_endhent'
23781 d_endhostent_r='$d_endhostent_r'
23782 d_endnent='$d_endnent'
23783 d_endnetent_r='$d_endnetent_r'
23784 d_endpent='$d_endpent'
23785 d_endprotoent_r='$d_endprotoent_r'
23786 d_endpwent='$d_endpwent'
23787 d_endpwent_r='$d_endpwent_r'
23788 d_endsent='$d_endsent'
23789 d_endservent_r='$d_endservent_r'
23790 d_eofnblk='$d_eofnblk'
23791 d_erf='$d_erf'
23792 d_erfc='$d_erfc'
23793 d_eunice='$d_eunice'
23794 d_exp2='$d_exp2'
23795 d_expm1='$d_expm1'
23796 d_faststdio='$d_faststdio'
23797 d_fchdir='$d_fchdir'
23798 d_fchmod='$d_fchmod'
23799 d_fchmodat='$d_fchmodat'
23800 d_fchown='$d_fchown'
23801 d_fcntl='$d_fcntl'
23802 d_fcntl_can_lock='$d_fcntl_can_lock'
23803 d_fd_macros='$d_fd_macros'
23804 d_fd_set='$d_fd_set'
23805 d_fdclose='$d_fdclose'
23806 d_fdim='$d_fdim'
23807 d_fds_bits='$d_fds_bits'
23808 d_fegetround='$d_fegetround'
23809 d_fgetpos='$d_fgetpos'
23810 d_finite='$d_finite'
23811 d_finitel='$d_finitel'
23812 d_flexfnam='$d_flexfnam'
23813 d_flock='$d_flock'
23814 d_flockproto='$d_flockproto'
23815 d_fma='$d_fma'
23816 d_fmax='$d_fmax'
23817 d_fmin='$d_fmin'
23818 d_fork='$d_fork'
23819 d_fp_class='$d_fp_class'
23820 d_fp_classify='$d_fp_classify'
23821 d_fp_classl='$d_fp_classl'
23822 d_fpathconf='$d_fpathconf'
23823 d_fpclass='$d_fpclass'
23824 d_fpclassify='$d_fpclassify'
23825 d_fpclassl='$d_fpclassl'
23826 d_fpgetround='$d_fpgetround'
23827 d_fpos64_t='$d_fpos64_t'
23828 d_freelocale='$d_freelocale'
23829 d_frexpl='$d_frexpl'
23830 d_fs_data_s='$d_fs_data_s'
23831 d_fseeko='$d_fseeko'
23832 d_fsetpos='$d_fsetpos'
23833 d_fstatfs='$d_fstatfs'
23834 d_fstatvfs='$d_fstatvfs'
23835 d_fsync='$d_fsync'
23836 d_ftello='$d_ftello'
23837 d_ftime='$d_ftime'
23838 d_futimes='$d_futimes'
23839 d_gai_strerror='$d_gai_strerror'
23840 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23841 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
23842 d_getaddrinfo='$d_getaddrinfo'
23843 d_getcwd='$d_getcwd'
23844 d_getespwnam='$d_getespwnam'
23845 d_getfsstat='$d_getfsstat'
23846 d_getgrent='$d_getgrent'
23847 d_getgrent_r='$d_getgrent_r'
23848 d_getgrgid_r='$d_getgrgid_r'
23849 d_getgrnam_r='$d_getgrnam_r'
23850 d_getgrps='$d_getgrps'
23851 d_gethbyaddr='$d_gethbyaddr'
23852 d_gethbyname='$d_gethbyname'
23853 d_gethent='$d_gethent'
23854 d_gethname='$d_gethname'
23855 d_gethostbyaddr_r='$d_gethostbyaddr_r'
23856 d_gethostbyname_r='$d_gethostbyname_r'
23857 d_gethostent_r='$d_gethostent_r'
23858 d_gethostprotos='$d_gethostprotos'
23859 d_getitimer='$d_getitimer'
23860 d_getlogin='$d_getlogin'
23861 d_getlogin_r='$d_getlogin_r'
23862 d_getmnt='$d_getmnt'
23863 d_getmntent='$d_getmntent'
23864 d_getnameinfo='$d_getnameinfo'
23865 d_getnbyaddr='$d_getnbyaddr'
23866 d_getnbyname='$d_getnbyname'
23867 d_getnent='$d_getnent'
23868 d_getnetbyaddr_r='$d_getnetbyaddr_r'
23869 d_getnetbyname_r='$d_getnetbyname_r'
23870 d_getnetent_r='$d_getnetent_r'
23871 d_getnetprotos='$d_getnetprotos'
23872 d_getpagsz='$d_getpagsz'
23873 d_getpbyname='$d_getpbyname'
23874 d_getpbynumber='$d_getpbynumber'
23875 d_getpent='$d_getpent'
23876 d_getpgid='$d_getpgid'
23877 d_getpgrp2='$d_getpgrp2'
23878 d_getpgrp='$d_getpgrp'
23879 d_getppid='$d_getppid'
23880 d_getprior='$d_getprior'
23881 d_getprotobyname_r='$d_getprotobyname_r'
23882 d_getprotobynumber_r='$d_getprotobynumber_r'
23883 d_getprotoent_r='$d_getprotoent_r'
23884 d_getprotoprotos='$d_getprotoprotos'
23885 d_getprpwnam='$d_getprpwnam'
23886 d_getpwent='$d_getpwent'
23887 d_getpwent_r='$d_getpwent_r'
23888 d_getpwnam_r='$d_getpwnam_r'
23889 d_getpwuid_r='$d_getpwuid_r'
23890 d_getsbyname='$d_getsbyname'
23891 d_getsbyport='$d_getsbyport'
23892 d_getsent='$d_getsent'
23893 d_getservbyname_r='$d_getservbyname_r'
23894 d_getservbyport_r='$d_getservbyport_r'
23895 d_getservent_r='$d_getservent_r'
23896 d_getservprotos='$d_getservprotos'
23897 d_getspnam='$d_getspnam'
23898 d_getspnam_r='$d_getspnam_r'
23899 d_gettimeod='$d_gettimeod'
23900 d_gmtime64='$d_gmtime64'
23901 d_gmtime_r='$d_gmtime_r'
23902 d_gnulibc='$d_gnulibc'
23903 d_grpasswd='$d_grpasswd'
23904 d_hasmntopt='$d_hasmntopt'
23905 d_htonl='$d_htonl'
23906 d_hypot='$d_hypot'
23907 d_ilogb='$d_ilogb'
23908 d_ilogbl='$d_ilogbl'
23909 d_inc_version_list='$d_inc_version_list'
23910 d_inetaton='$d_inetaton'
23911 d_inetntop='$d_inetntop'
23912 d_inetpton='$d_inetpton'
23913 d_int64_t='$d_int64_t'
23914 d_ip_mreq='$d_ip_mreq'
23915 d_ip_mreq_source='$d_ip_mreq_source'
23916 d_ipv6_mreq='$d_ipv6_mreq'
23917 d_ipv6_mreq_source='$d_ipv6_mreq_source'
23918 d_isascii='$d_isascii'
23919 d_isblank='$d_isblank'
23920 d_isfinite='$d_isfinite'
23921 d_isfinitel='$d_isfinitel'
23922 d_isinf='$d_isinf'
23923 d_isinfl='$d_isinfl'
23924 d_isless='$d_isless'
23925 d_isnan='$d_isnan'
23926 d_isnanl='$d_isnanl'
23927 d_isnormal='$d_isnormal'
23928 d_j0='$d_j0'
23929 d_j0l='$d_j0l'
23930 d_killpg='$d_killpg'
23931 d_lc_monetary_2008='$d_lc_monetary_2008'
23932 d_lchown='$d_lchown'
23933 d_ldbl_dig='$d_ldbl_dig'
23934 d_ldexpl='$d_ldexpl'
23935 d_lgamma='$d_lgamma'
23936 d_lgamma_r='$d_lgamma_r'
23937 d_libm_lib_version='$d_libm_lib_version'
23938 d_libname_unique='$d_libname_unique'
23939 d_link='$d_link'
23940 d_linkat='$d_linkat'
23941 d_llrint='$d_llrint'
23942 d_llrintl='$d_llrintl'
23943 d_llround='$d_llround'
23944 d_llroundl='$d_llroundl'
23945 d_localeconv_l='$d_localeconv_l'
23946 d_localtime64='$d_localtime64'
23947 d_localtime_r='$d_localtime_r'
23948 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
23949 d_locconv='$d_locconv'
23950 d_lockf='$d_lockf'
23951 d_log1p='$d_log1p'
23952 d_log2='$d_log2'
23953 d_logb='$d_logb'
23954 d_long_double_style_ieee='$d_long_double_style_ieee'
23955 d_long_double_style_ieee_doubledouble='$d_long_double_style_ieee_doubledouble'
23956 d_long_double_style_ieee_extended='$d_long_double_style_ieee_extended'
23957 d_long_double_style_ieee_std='$d_long_double_style_ieee_std'
23958 d_long_double_style_vax='$d_long_double_style_vax'
23959 d_longdbl='$d_longdbl'
23960 d_longlong='$d_longlong'
23961 d_lrint='$d_lrint'
23962 d_lrintl='$d_lrintl'
23963 d_lround='$d_lround'
23964 d_lroundl='$d_lroundl'
23965 d_lseekproto='$d_lseekproto'
23966 d_lstat='$d_lstat'
23967 d_madvise='$d_madvise'
23968 d_malloc_good_size='$d_malloc_good_size'
23969 d_malloc_size='$d_malloc_size'
23970 d_mblen='$d_mblen'
23971 d_mbrlen='$d_mbrlen'
23972 d_mbrtowc='$d_mbrtowc'
23973 d_mbstowcs='$d_mbstowcs'
23974 d_mbtowc='$d_mbtowc'
23975 d_memmem='$d_memmem'
23976 d_memrchr='$d_memrchr'
23977 d_mkdir='$d_mkdir'
23978 d_mkdtemp='$d_mkdtemp'
23979 d_mkfifo='$d_mkfifo'
23980 d_mkstemp='$d_mkstemp'
23981 d_mkstemps='$d_mkstemps'
23982 d_mktime64='$d_mktime64'
23983 d_mktime='$d_mktime'
23984 d_mmap='$d_mmap'
23985 d_modfl='$d_modfl'
23986 d_modflproto='$d_modflproto'
23987 d_mprotect='$d_mprotect'
23988 d_msg='$d_msg'
23989 d_msg_ctrunc='$d_msg_ctrunc'
23990 d_msg_dontroute='$d_msg_dontroute'
23991 d_msg_oob='$d_msg_oob'
23992 d_msg_peek='$d_msg_peek'
23993 d_msg_proxy='$d_msg_proxy'
23994 d_msgctl='$d_msgctl'
23995 d_msgget='$d_msgget'
23996 d_msghdr_s='$d_msghdr_s'
23997 d_msgrcv='$d_msgrcv'
23998 d_msgsnd='$d_msgsnd'
23999 d_msync='$d_msync'
24000 d_munmap='$d_munmap'
24001 d_mymalloc='$d_mymalloc'
24002 d_nan='$d_nan'
24003 d_nanosleep='$d_nanosleep'
24004 d_ndbm='$d_ndbm'
24005 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24006 d_nearbyint='$d_nearbyint'
24007 d_newlocale='$d_newlocale'
24008 d_nextafter='$d_nextafter'
24009 d_nexttoward='$d_nexttoward'
24010 d_nice='$d_nice'
24011 d_nl_langinfo='$d_nl_langinfo'
24012 d_nv_preserves_uv='$d_nv_preserves_uv'
24013 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24014 d_off64_t='$d_off64_t'
24015 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24016 d_oldpthreads='$d_oldpthreads'
24017 d_oldsock='$d_oldsock'
24018 d_open3='$d_open3'
24019 d_openat='$d_openat'
24020 d_pathconf='$d_pathconf'
24021 d_pause='$d_pause'
24022 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24023 d_phostname='$d_phostname'
24024 d_pipe='$d_pipe'
24025 d_poll='$d_poll'
24026 d_portable='$d_portable'
24027 d_prctl='$d_prctl'
24028 d_prctl_set_name='$d_prctl_set_name'
24029 d_printf_format_null='$d_printf_format_null'
24030 d_procselfexe='$d_procselfexe'
24031 d_pseudofork='$d_pseudofork'
24032 d_pthread_atfork='$d_pthread_atfork'
24033 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24034 d_pthread_yield='$d_pthread_yield'
24035 d_ptrdiff_t='$d_ptrdiff_t'
24036 d_pwage='$d_pwage'
24037 d_pwchange='$d_pwchange'
24038 d_pwclass='$d_pwclass'
24039 d_pwcomment='$d_pwcomment'
24040 d_pwexpire='$d_pwexpire'
24041 d_pwgecos='$d_pwgecos'
24042 d_pwpasswd='$d_pwpasswd'
24043 d_pwquota='$d_pwquota'
24044 d_qgcvt='$d_qgcvt'
24045 d_quad='$d_quad'
24046 d_querylocale='$d_querylocale'
24047 d_random_r='$d_random_r'
24048 d_re_comp='$d_re_comp'
24049 d_readdir64_r='$d_readdir64_r'
24050 d_readdir='$d_readdir'
24051 d_readdir_r='$d_readdir_r'
24052 d_readlink='$d_readlink'
24053 d_readv='$d_readv'
24054 d_recvmsg='$d_recvmsg'
24055 d_regcmp='$d_regcmp'
24056 d_regcomp='$d_regcomp'
24057 d_remainder='$d_remainder'
24058 d_remquo='$d_remquo'
24059 d_rename='$d_rename'
24060 d_renameat='$d_renameat'
24061 d_rewinddir='$d_rewinddir'
24062 d_rint='$d_rint'
24063 d_rmdir='$d_rmdir'
24064 d_round='$d_round'
24065 d_sbrkproto='$d_sbrkproto'
24066 d_scalbn='$d_scalbn'
24067 d_scalbnl='$d_scalbnl'
24068 d_sched_yield='$d_sched_yield'
24069 d_scm_rights='$d_scm_rights'
24070 d_seekdir='$d_seekdir'
24071 d_select='$d_select'
24072 d_sem='$d_sem'
24073 d_semctl='$d_semctl'
24074 d_semctl_semid_ds='$d_semctl_semid_ds'
24075 d_semctl_semun='$d_semctl_semun'
24076 d_semget='$d_semget'
24077 d_semop='$d_semop'
24078 d_sendmsg='$d_sendmsg'
24079 d_setegid='$d_setegid'
24080 d_seteuid='$d_seteuid'
24081 d_setgrent='$d_setgrent'
24082 d_setgrent_r='$d_setgrent_r'
24083 d_setgrps='$d_setgrps'
24084 d_sethent='$d_sethent'
24085 d_sethostent_r='$d_sethostent_r'
24086 d_setitimer='$d_setitimer'
24087 d_setlinebuf='$d_setlinebuf'
24088 d_setlocale='$d_setlocale'
24089 d_setlocale_r='$d_setlocale_r'
24090 d_setnent='$d_setnent'
24091 d_setnetent_r='$d_setnetent_r'
24092 d_setpent='$d_setpent'
24093 d_setpgid='$d_setpgid'
24094 d_setpgrp2='$d_setpgrp2'
24095 d_setpgrp='$d_setpgrp'
24096 d_setprior='$d_setprior'
24097 d_setproctitle='$d_setproctitle'
24098 d_setprotoent_r='$d_setprotoent_r'
24099 d_setpwent='$d_setpwent'
24100 d_setpwent_r='$d_setpwent_r'
24101 d_setregid='$d_setregid'
24102 d_setresgid='$d_setresgid'
24103 d_setresuid='$d_setresuid'
24104 d_setreuid='$d_setreuid'
24105 d_setrgid='$d_setrgid'
24106 d_setruid='$d_setruid'
24107 d_setsent='$d_setsent'
24108 d_setservent_r='$d_setservent_r'
24109 d_setsid='$d_setsid'
24110 d_setvbuf='$d_setvbuf'
24111 d_shm='$d_shm'
24112 d_shmat='$d_shmat'
24113 d_shmatprototype='$d_shmatprototype'
24114 d_shmctl='$d_shmctl'
24115 d_shmdt='$d_shmdt'
24116 d_shmget='$d_shmget'
24117 d_sigaction='$d_sigaction'
24118 d_siginfo_si_addr='$d_siginfo_si_addr'
24119 d_siginfo_si_band='$d_siginfo_si_band'
24120 d_siginfo_si_errno='$d_siginfo_si_errno'
24121 d_siginfo_si_fd='$d_siginfo_si_fd'
24122 d_siginfo_si_pid='$d_siginfo_si_pid'
24123 d_siginfo_si_status='$d_siginfo_si_status'
24124 d_siginfo_si_uid='$d_siginfo_si_uid'
24125 d_siginfo_si_value='$d_siginfo_si_value'
24126 d_signbit='$d_signbit'
24127 d_sigprocmask='$d_sigprocmask'
24128 d_sigsetjmp='$d_sigsetjmp'
24129 d_sin6_scope_id='$d_sin6_scope_id'
24130 d_sitearch='$d_sitearch'
24131 d_sockaddr_in6='$d_sockaddr_in6'
24132 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24133 d_sockatmark='$d_sockatmark'
24134 d_sockatmarkproto='$d_sockatmarkproto'
24135 d_socket='$d_socket'
24136 d_socklen_t='$d_socklen_t'
24137 d_sockpair='$d_sockpair'
24138 d_socks5_init='$d_socks5_init'
24139 d_sqrtl='$d_sqrtl'
24140 d_srand48_r='$d_srand48_r'
24141 d_srandom_r='$d_srandom_r'
24142 d_sresgproto='$d_sresgproto'
24143 d_sresuproto='$d_sresuproto'
24144 d_stat='$d_stat'
24145 d_statblks='$d_statblks'
24146 d_statfs_f_flags='$d_statfs_f_flags'
24147 d_statfs_s='$d_statfs_s'
24148 d_static_inline='$d_static_inline'
24149 d_statvfs='$d_statvfs'
24150 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24151 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24152 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24153 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24154 d_stdio_stream_array='$d_stdio_stream_array'
24155 d_stdiobase='$d_stdiobase'
24156 d_stdstdio='$d_stdstdio'
24157 d_strcoll='$d_strcoll'
24158 d_strerror_l='$d_strerror_l'
24159 d_strerror_r='$d_strerror_r'
24160 d_strftime='$d_strftime'
24161 d_strlcat='$d_strlcat'
24162 d_strlcpy='$d_strlcpy'
24163 d_strnlen='$d_strnlen'
24164 d_strtod='$d_strtod'
24165 d_strtol='$d_strtol'
24166 d_strtold='$d_strtold'
24167 d_strtold_l='$d_strtold_l'
24168 d_strtoll='$d_strtoll'
24169 d_strtoq='$d_strtoq'
24170 d_strtoul='$d_strtoul'
24171 d_strtoull='$d_strtoull'
24172 d_strtouq='$d_strtouq'
24173 d_strxfrm='$d_strxfrm'
24174 d_suidsafe='$d_suidsafe'
24175 d_symlink='$d_symlink'
24176 d_syscall='$d_syscall'
24177 d_syscallproto='$d_syscallproto'
24178 d_sysconf='$d_sysconf'
24179 d_sysernlst='$d_sysernlst'
24180 d_syserrlst='$d_syserrlst'
24181 d_system='$d_system'
24182 d_tcgetpgrp='$d_tcgetpgrp'
24183 d_tcsetpgrp='$d_tcsetpgrp'
24184 d_telldir='$d_telldir'
24185 d_telldirproto='$d_telldirproto'
24186 d_tgamma='$d_tgamma'
24187 d_thread_safe_nl_langinfo_l='$d_thread_safe_nl_langinfo_l'
24188 d_time='$d_time'
24189 d_timegm='$d_timegm'
24190 d_times='$d_times'
24191 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24192 d_tm_tm_zone='$d_tm_tm_zone'
24193 d_tmpnam_r='$d_tmpnam_r'
24194 d_trunc='$d_trunc'
24195 d_truncate='$d_truncate'
24196 d_truncl='$d_truncl'
24197 d_ttyname_r='$d_ttyname_r'
24198 d_tzname='$d_tzname'
24199 d_u32align='$d_u32align'
24200 d_ualarm='$d_ualarm'
24201 d_umask='$d_umask'
24202 d_uname='$d_uname'
24203 d_union_semun='$d_union_semun'
24204 d_unlinkat='$d_unlinkat'
24205 d_unordered='$d_unordered'
24206 d_unsetenv='$d_unsetenv'
24207 d_uselocale='$d_uselocale'
24208 d_usleep='$d_usleep'
24209 d_usleepproto='$d_usleepproto'
24210 d_ustat='$d_ustat'
24211 d_vendorarch='$d_vendorarch'
24212 d_vendorbin='$d_vendorbin'
24213 d_vendorlib='$d_vendorlib'
24214 d_vendorscript='$d_vendorscript'
24215 d_vfork='$d_vfork'
24216 d_void_closedir='$d_void_closedir'
24217 d_voidsig='$d_voidsig'
24218 d_voidtty='$d_voidtty'
24219 d_wait4='$d_wait4'
24220 d_waitpid='$d_waitpid'
24221 d_wcscmp='$d_wcscmp'
24222 d_wcstombs='$d_wcstombs'
24223 d_wcsxfrm='$d_wcsxfrm'
24224 d_wctomb='$d_wctomb'
24225 d_writev='$d_writev'
24226 d_xenix='$d_xenix'
24227 date='$date'
24228 db_hashtype='$db_hashtype'
24229 db_prefixtype='$db_prefixtype'
24230 db_version_major='$db_version_major'
24231 db_version_minor='$db_version_minor'
24232 db_version_patch='$db_version_patch'
24233 default_inc_excludes_dot='$default_inc_excludes_dot'
24234 direntrytype='$direntrytype'
24235 dlext='$dlext'
24236 dlsrc='$dlsrc'
24237 doubleinfbytes='$doubleinfbytes'
24238 doublekind='$doublekind'
24239 doublemantbits='$doublemantbits'
24240 doublenanbytes='$doublenanbytes'
24241 doublesize='$doublesize'
24242 drand01='$drand01'
24243 drand48_r_proto='$drand48_r_proto'
24244 dtrace='$dtrace'
24245 dtraceobject='$dtraceobject'
24246 dtracexnolibs='$dtracexnolibs'
24247 dynamic_ext='$dynamic_ext'
24248 eagain='$eagain'
24249 ebcdic='$ebcdic'
24250 echo='$echo'
24251 egrep='$egrep'
24252 emacs='$emacs'
24253 endgrent_r_proto='$endgrent_r_proto'
24254 endhostent_r_proto='$endhostent_r_proto'
24255 endnetent_r_proto='$endnetent_r_proto'
24256 endprotoent_r_proto='$endprotoent_r_proto'
24257 endpwent_r_proto='$endpwent_r_proto'
24258 endservent_r_proto='$endservent_r_proto'
24259 eunicefix='$eunicefix'
24260 exe_ext='$exe_ext'
24261 expr='$expr'
24262 extensions='$extensions'
24263 extern_C='$extern_C'
24264 extras='$extras'
24265 fflushNULL='$fflushNULL'
24266 fflushall='$fflushall'
24267 find='$find'
24268 firstmakefile='$firstmakefile'
24269 flex='$flex'
24270 fpossize='$fpossize'
24271 fpostype='$fpostype'
24272 freetype='$freetype'
24273 from='$from'
24274 full_ar='$full_ar'
24275 full_csh='$full_csh'
24276 full_sed='$full_sed'
24277 gccansipedantic='$gccansipedantic'
24278 gccosandvers='$gccosandvers'
24279 gccversion='$gccversion'
24280 getgrent_r_proto='$getgrent_r_proto'
24281 getgrgid_r_proto='$getgrgid_r_proto'
24282 getgrnam_r_proto='$getgrnam_r_proto'
24283 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24284 gethostbyname_r_proto='$gethostbyname_r_proto'
24285 gethostent_r_proto='$gethostent_r_proto'
24286 getlogin_r_proto='$getlogin_r_proto'
24287 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24288 getnetbyname_r_proto='$getnetbyname_r_proto'
24289 getnetent_r_proto='$getnetent_r_proto'
24290 getprotobyname_r_proto='$getprotobyname_r_proto'
24291 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24292 getprotoent_r_proto='$getprotoent_r_proto'
24293 getpwent_r_proto='$getpwent_r_proto'
24294 getpwnam_r_proto='$getpwnam_r_proto'
24295 getpwuid_r_proto='$getpwuid_r_proto'
24296 getservbyname_r_proto='$getservbyname_r_proto'
24297 getservbyport_r_proto='$getservbyport_r_proto'
24298 getservent_r_proto='$getservent_r_proto'
24299 getspnam_r_proto='$getspnam_r_proto'
24300 gidformat='$gidformat'
24301 gidsign='$gidsign'
24302 gidsize='$gidsize'
24303 gidtype='$gidtype'
24304 glibpth='$glibpth'
24305 gmake='$gmake'
24306 gmtime_r_proto='$gmtime_r_proto'
24307 gnulibc_version='$gnulibc_version'
24308 grep='$grep'
24309 groupcat='$groupcat'
24310 groupstype='$groupstype'
24311 gzip='$gzip'
24312 h_fcntl='$h_fcntl'
24313 h_sysfile='$h_sysfile'
24314 hint='$hint'
24315 hostcat='$hostcat'
24316 hostgenerate='$hostgenerate'
24317 hostosname='$hostosname'
24318 hostperl='$hostperl'
24319 html1dir='$html1dir'
24320 html1direxp='$html1direxp'
24321 html3dir='$html3dir'
24322 html3direxp='$html3direxp'
24323 i16size='$i16size'
24324 i16type='$i16type'
24325 i32size='$i32size'
24326 i32type='$i32type'
24327 i64size='$i64size'
24328 i64type='$i64type'
24329 i8size='$i8size'
24330 i8type='$i8type'
24331 i_arpainet='$i_arpainet'
24332 i_bfd='$i_bfd'
24333 i_bsdioctl='$i_bsdioctl'
24334 i_crypt='$i_crypt'
24335 i_db='$i_db'
24336 i_dbm='$i_dbm'
24337 i_dirent='$i_dirent'
24338 i_dlfcn='$i_dlfcn'
24339 i_execinfo='$i_execinfo'
24340 i_fcntl='$i_fcntl'
24341 i_fenv='$i_fenv'
24342 i_fp='$i_fp'
24343 i_fp_class='$i_fp_class'
24344 i_gdbm='$i_gdbm'
24345 i_gdbm_ndbm='$i_gdbm_ndbm'
24346 i_gdbmndbm='$i_gdbmndbm'
24347 i_grp='$i_grp'
24348 i_ieeefp='$i_ieeefp'
24349 i_inttypes='$i_inttypes'
24350 i_langinfo='$i_langinfo'
24351 i_libutil='$i_libutil'
24352 i_locale='$i_locale'
24353 i_machcthr='$i_machcthr'
24354 i_malloc='$i_malloc'
24355 i_mallocmalloc='$i_mallocmalloc'
24356 i_mntent='$i_mntent'
24357 i_ndbm='$i_ndbm'
24358 i_netdb='$i_netdb'
24359 i_neterrno='$i_neterrno'
24360 i_netinettcp='$i_netinettcp'
24361 i_niin='$i_niin'
24362 i_poll='$i_poll'
24363 i_prot='$i_prot'
24364 i_pthread='$i_pthread'
24365 i_pwd='$i_pwd'
24366 i_quadmath='$i_quadmath'
24367 i_rpcsvcdbm='$i_rpcsvcdbm'
24368 i_sgtty='$i_sgtty'
24369 i_shadow='$i_shadow'
24370 i_socks='$i_socks'
24371 i_stdbool='$i_stdbool'
24372 i_stdint='$i_stdint'
24373 i_stdlib='$i_stdlib'
24374 i_sunmath='$i_sunmath'
24375 i_sysaccess='$i_sysaccess'
24376 i_sysdir='$i_sysdir'
24377 i_sysfile='$i_sysfile'
24378 i_sysfilio='$i_sysfilio'
24379 i_sysin='$i_sysin'
24380 i_sysioctl='$i_sysioctl'
24381 i_syslog='$i_syslog'
24382 i_sysmman='$i_sysmman'
24383 i_sysmode='$i_sysmode'
24384 i_sysmount='$i_sysmount'
24385 i_sysndir='$i_sysndir'
24386 i_sysparam='$i_sysparam'
24387 i_syspoll='$i_syspoll'
24388 i_sysresrc='$i_sysresrc'
24389 i_syssecrt='$i_syssecrt'
24390 i_sysselct='$i_sysselct'
24391 i_syssockio='$i_syssockio'
24392 i_sysstat='$i_sysstat'
24393 i_sysstatfs='$i_sysstatfs'
24394 i_sysstatvfs='$i_sysstatvfs'
24395 i_systime='$i_systime'
24396 i_systimek='$i_systimek'
24397 i_systimes='$i_systimes'
24398 i_systypes='$i_systypes'
24399 i_sysuio='$i_sysuio'
24400 i_sysun='$i_sysun'
24401 i_sysutsname='$i_sysutsname'
24402 i_sysvfs='$i_sysvfs'
24403 i_syswait='$i_syswait'
24404 i_termio='$i_termio'
24405 i_termios='$i_termios'
24406 i_time='$i_time'
24407 i_unistd='$i_unistd'
24408 i_ustat='$i_ustat'
24409 i_utime='$i_utime'
24410 i_vfork='$i_vfork'
24411 i_wchar='$i_wchar'
24412 i_xlocale='$i_xlocale'
24413 ignore_versioned_solibs='$ignore_versioned_solibs'
24414 inc_version_list='$inc_version_list'
24415 inc_version_list_init='$inc_version_list_init'
24416 incpath='$incpath'
24417 incpth='$incpth'
24418 inews='$inews'
24419 initialinstalllocation='$initialinstalllocation'
24420 installarchlib='$installarchlib'
24421 installbin='$installbin'
24422 installhtml1dir='$installhtml1dir'
24423 installhtml3dir='$installhtml3dir'
24424 installman1dir='$installman1dir'
24425 installman3dir='$installman3dir'
24426 installprefix='$installprefix'
24427 installprefixexp='$installprefixexp'
24428 installprivlib='$installprivlib'
24429 installscript='$installscript'
24430 installsitearch='$installsitearch'
24431 installsitebin='$installsitebin'
24432 installsitehtml1dir='$installsitehtml1dir'
24433 installsitehtml3dir='$installsitehtml3dir'
24434 installsitelib='$installsitelib'
24435 installsiteman1dir='$installsiteman1dir'
24436 installsiteman3dir='$installsiteman3dir'
24437 installsitescript='$installsitescript'
24438 installstyle='$installstyle'
24439 installusrbinperl='$installusrbinperl'
24440 installvendorarch='$installvendorarch'
24441 installvendorbin='$installvendorbin'
24442 installvendorhtml1dir='$installvendorhtml1dir'
24443 installvendorhtml3dir='$installvendorhtml3dir'
24444 installvendorlib='$installvendorlib'
24445 installvendorman1dir='$installvendorman1dir'
24446 installvendorman3dir='$installvendorman3dir'
24447 installvendorscript='$installvendorscript'
24448 intsize='$intsize'
24449 issymlink='$issymlink'
24450 ivdformat='$ivdformat'
24451 ivsize='$ivsize'
24452 ivtype='$ivtype'
24453 known_extensions='$known_extensions'
24454 ksh='$ksh'
24455 ld='$ld'
24456 ld_can_script='$ld_can_script'
24457 lddlflags='$lddlflags'
24458 ldflags='$ldflags'
24459 ldflags_uselargefiles='$ldflags_uselargefiles'
24460 ldlibpthname='$ldlibpthname'
24461 less='$less'
24462 lib_ext='$lib_ext'
24463 libc='$libc'
24464 libperl='$libperl'
24465 libpth='$libpth'
24466 libs='$libs'
24467 libsdirs='$libsdirs'
24468 libsfiles='$libsfiles'
24469 libsfound='$libsfound'
24470 libspath='$libspath'
24471 libswanted='$libswanted'
24472 libswanted_uselargefiles='$libswanted_uselargefiles'
24473 line='$line'
24474 lint='$lint'
24475 lkflags='$lkflags'
24476 ln='$ln'
24477 lns='$lns'
24478 localtime_r_proto='$localtime_r_proto'
24479 locincpth='$locincpth'
24480 loclibpth='$loclibpth'
24481 longdblinfbytes='$longdblinfbytes'
24482 longdblkind='$longdblkind'
24483 longdblmantbits='$longdblmantbits'
24484 longdblnanbytes='$longdblnanbytes'
24485 longdblsize='$longdblsize'
24486 longlongsize='$longlongsize'
24487 longsize='$longsize'
24488 lp='$lp'
24489 lpr='$lpr'
24490 ls='$ls'
24491 lseeksize='$lseeksize'
24492 lseektype='$lseektype'
24493 mail='$mail'
24494 mailx='$mailx'
24495 make='$make'
24496 make_set_make='$make_set_make'
24497 mallocobj='$mallocobj'
24498 mallocsrc='$mallocsrc'
24499 malloctype='$malloctype'
24500 man1dir='$man1dir'
24501 man1direxp='$man1direxp'
24502 man1ext='$man1ext'
24503 man3dir='$man3dir'
24504 man3direxp='$man3direxp'
24505 man3ext='$man3ext'
24506 mips_type='$mips_type'
24507 mistrustnm='$mistrustnm'
24508 mkdir='$mkdir'
24509 mmaptype='$mmaptype'
24510 modetype='$modetype'
24511 more='$more'
24512 multiarch='$multiarch'
24513 mv='$mv'
24514 myarchname='$myarchname'
24515 mydomain='$mydomain'
24516 myhostname='$myhostname'
24517 myuname='$myuname'
24518 n='$n'
24519 need_va_copy='$need_va_copy'
24520 netdb_hlen_type='$netdb_hlen_type'
24521 netdb_host_type='$netdb_host_type'
24522 netdb_name_type='$netdb_name_type'
24523 netdb_net_type='$netdb_net_type'
24524 nm='$nm'
24525 nm_opt='$nm_opt'
24526 nm_so_opt='$nm_so_opt'
24527 nonxs_ext='$nonxs_ext'
24528 nroff='$nroff'
24529 nvEUformat='$nvEUformat'
24530 nvFUformat='$nvFUformat'
24531 nvGUformat='$nvGUformat'
24532 nv_overflows_integers_at='$nv_overflows_integers_at'
24533 nv_preserves_uv_bits='$nv_preserves_uv_bits'
24534 nveformat='$nveformat'
24535 nvfformat='$nvfformat'
24536 nvgformat='$nvgformat'
24537 nvmantbits='$nvmantbits'
24538 nvsize='$nvsize'
24539 nvtype='$nvtype'
24540 o_nonblock='$o_nonblock'
24541 obj_ext='$obj_ext'
24542 old_pthread_create_joinable='$old_pthread_create_joinable'
24543 optimize='$optimize'
24544 orderlib='$orderlib'
24545 osname='$osname'
24546 osvers='$osvers'
24547 otherlibdirs='$otherlibdirs'
24548 package='$package'
24549 pager='$pager'
24550 passcat='$passcat'
24551 patchlevel='$patchlevel'
24552 path_sep='$path_sep'
24553 perl5='$perl5'
24554 perl='$perl'
24555 perl_patchlevel='$perl_patchlevel'
24556 perl_static_inline='$perl_static_inline'
24557 perladmin='$perladmin'
24558 perllibs='$perllibs'
24559 perlpath='$perlpath'
24560 pg='$pg'
24561 phostname='$phostname'
24562 pidtype='$pidtype'
24563 plibpth='$plibpth'
24564 pmake='$pmake'
24565 pr='$pr'
24566 prefix='$prefix'
24567 prefixexp='$prefixexp'
24568 privlib='$privlib'
24569 privlibexp='$privlibexp'
24570 procselfexe='$procselfexe'
24571 ptrsize='$ptrsize'
24572 quadkind='$quadkind'
24573 quadtype='$quadtype'
24574 randbits='$randbits'
24575 randfunc='$randfunc'
24576 random_r_proto='$random_r_proto'
24577 randseedtype='$randseedtype'
24578 ranlib='$ranlib'
24579 rd_nodata='$rd_nodata'
24580 readdir64_r_proto='$readdir64_r_proto'
24581 readdir_r_proto='$readdir_r_proto'
24582 revision='$revision'
24583 rm='$rm'
24584 rm_try='$rm_try'
24585 rmail='$rmail'
24586 run='$run'
24587 runnm='$runnm'
24588 sGMTIME_max='$sGMTIME_max'
24589 sGMTIME_min='$sGMTIME_min'
24590 sLOCALTIME_max='$sLOCALTIME_max'
24591 sLOCALTIME_min='$sLOCALTIME_min'
24592 sPRIEUldbl='$sPRIEUldbl'
24593 sPRIFUldbl='$sPRIFUldbl'
24594 sPRIGUldbl='$sPRIGUldbl'
24595 sPRIXU64='$sPRIXU64'
24596 sPRId64='$sPRId64'
24597 sPRIeldbl='$sPRIeldbl'
24598 sPRIfldbl='$sPRIfldbl'
24599 sPRIgldbl='$sPRIgldbl'
24600 sPRIi64='$sPRIi64'
24601 sPRIo64='$sPRIo64'
24602 sPRIu64='$sPRIu64'
24603 sPRIx64='$sPRIx64'
24604 sSCNfldbl='$sSCNfldbl'
24605 sched_yield='$sched_yield'
24606 scriptdir='$scriptdir'
24607 scriptdirexp='$scriptdirexp'
24608 sed='$sed'
24609 seedfunc='$seedfunc'
24610 selectminbits='$selectminbits'
24611 selecttype='$selecttype'
24612 sendmail='$sendmail'
24613 setgrent_r_proto='$setgrent_r_proto'
24614 sethostent_r_proto='$sethostent_r_proto'
24615 setlocale_r_proto='$setlocale_r_proto'
24616 setnetent_r_proto='$setnetent_r_proto'
24617 setprotoent_r_proto='$setprotoent_r_proto'
24618 setpwent_r_proto='$setpwent_r_proto'
24619 setservent_r_proto='$setservent_r_proto'
24620 sh='$sh'
24621 shar='$shar'
24622 sharpbang='$sharpbang'
24623 shmattype='$shmattype'
24624 shortsize='$shortsize'
24625 shrpenv='$shrpenv'
24626 shsharp='$shsharp'
24627 sig_count='$sig_count'
24628 sig_name='$sig_name'
24629 sig_name_init='$sig_name_init'
24630 sig_num='$sig_num'
24631 sig_num_init='$sig_num_init'
24632 sig_size='$sig_size'
24633 signal_t='$signal_t'
24634 sitearch='$sitearch'
24635 sitearchexp='$sitearchexp'
24636 sitebin='$sitebin'
24637 sitebinexp='$sitebinexp'
24638 sitehtml1dir='$sitehtml1dir'
24639 sitehtml1direxp='$sitehtml1direxp'
24640 sitehtml3dir='$sitehtml3dir'
24641 sitehtml3direxp='$sitehtml3direxp'
24642 sitelib='$sitelib'
24643 sitelib_stem='$sitelib_stem'
24644 sitelibexp='$sitelibexp'
24645 siteman1dir='$siteman1dir'
24646 siteman1direxp='$siteman1direxp'
24647 siteman3dir='$siteman3dir'
24648 siteman3direxp='$siteman3direxp'
24649 siteprefix='$siteprefix'
24650 siteprefixexp='$siteprefixexp'
24651 sitescript='$sitescript'
24652 sitescriptexp='$sitescriptexp'
24653 sizesize='$sizesize'
24654 sizetype='$sizetype'
24655 sleep='$sleep'
24656 smail='$smail'
24657 so='$so'
24658 sockethdr='$sockethdr'
24659 socketlib='$socketlib'
24660 socksizetype='$socksizetype'
24661 sort='$sort'
24662 spackage='$spackage'
24663 spitshell='$spitshell'
24664 srand48_r_proto='$srand48_r_proto'
24665 srandom_r_proto='$srandom_r_proto'
24666 src='$src'
24667 ssizetype='$ssizetype'
24668 st_ino_sign='$st_ino_sign'
24669 st_ino_size='$st_ino_size'
24670 startperl='$startperl'
24671 startsh='$startsh'
24672 static_ext='$static_ext'
24673 stdchar='$stdchar'
24674 stdio_base='$stdio_base'
24675 stdio_bufsiz='$stdio_bufsiz'
24676 stdio_cnt='$stdio_cnt'
24677 stdio_filbuf='$stdio_filbuf'
24678 stdio_ptr='$stdio_ptr'
24679 stdio_stream_array='$stdio_stream_array'
24680 strerror_r_proto='$strerror_r_proto'
24681 submit='$submit'
24682 subversion='$subversion'
24683 sysman='$sysman'
24684 sysroot='$sysroot'
24685 tail='$tail'
24686 tar='$tar'
24687 targetarch='$targetarch'
24688 targetdir='$targetdir'
24689 targetenv='$targetenv'
24690 targethost='$targethost'
24691 targetmkdir='$targetmkdir'
24692 targetport='$targetport'
24693 targetsh='$targetsh'
24694 tbl='$tbl'
24695 tee='$tee'
24696 test='$test'
24697 timeincl='$timeincl'
24698 timetype='$timetype'
24699 tmpnam_r_proto='$tmpnam_r_proto'
24700 to='$to'
24701 touch='$touch'
24702 tr='$tr'
24703 trnl='$trnl'
24704 troff='$troff'
24705 ttyname_r_proto='$ttyname_r_proto'
24706 u16size='$u16size'
24707 u16type='$u16type'
24708 u32size='$u32size'
24709 u32type='$u32type'
24710 u64size='$u64size'
24711 u64type='$u64type'
24712 u8size='$u8size'
24713 u8type='$u8type'
24714 uidformat='$uidformat'
24715 uidsign='$uidsign'
24716 uidsize='$uidsize'
24717 uidtype='$uidtype'
24718 uname='$uname'
24719 uniq='$uniq'
24720 uquadtype='$uquadtype'
24721 use5005threads='$use5005threads'
24722 use64bitall='$use64bitall'
24723 use64bitint='$use64bitint'
24724 usecbacktrace='$usecbacktrace'
24725 usecrosscompile='$usecrosscompile'
24726 usedevel='$usedevel'
24727 usedl='$usedl'
24728 usedtrace='$usedtrace'
24729 usefaststdio='$usefaststdio'
24730 useithreads='$useithreads'
24731 usekernprocpathname='$usekernprocpathname'
24732 uselargefiles='$uselargefiles'
24733 uselongdouble='$uselongdouble'
24734 usemallocwrap='$usemallocwrap'
24735 usemorebits='$usemorebits'
24736 usemultiplicity='$usemultiplicity'
24737 usemymalloc='$usemymalloc'
24738 usenm='$usenm'
24739 usensgetexecutablepath='$usensgetexecutablepath'
24740 useopcode='$useopcode'
24741 useperlio='$useperlio'
24742 useposix='$useposix'
24743 usequadmath='$usequadmath'
24744 usereentrant='$usereentrant'
24745 userelocatableinc='$userelocatableinc'
24746 useshrplib='$useshrplib'
24747 usesitecustomize='$usesitecustomize'
24748 usesocks='$usesocks'
24749 usethreads='$usethreads'
24750 usevendorprefix='$usevendorprefix'
24751 useversionedarchname='$useversionedarchname'
24752 usevfork='$usevfork'
24753 usrinc='$usrinc'
24754 uuname='$uuname'
24755 uvXUformat='$uvXUformat'
24756 uvoformat='$uvoformat'
24757 uvsize='$uvsize'
24758 uvtype='$uvtype'
24759 uvuformat='$uvuformat'
24760 uvxformat='$uvxformat'
24761 vendorarch='$vendorarch'
24762 vendorarchexp='$vendorarchexp'
24763 vendorbin='$vendorbin'
24764 vendorbinexp='$vendorbinexp'
24765 vendorhtml1dir='$vendorhtml1dir'
24766 vendorhtml1direxp='$vendorhtml1direxp'
24767 vendorhtml3dir='$vendorhtml3dir'
24768 vendorhtml3direxp='$vendorhtml3direxp'
24769 vendorlib='$vendorlib'
24770 vendorlib_stem='$vendorlib_stem'
24771 vendorlibexp='$vendorlibexp'
24772 vendorman1dir='$vendorman1dir'
24773 vendorman1direxp='$vendorman1direxp'
24774 vendorman3dir='$vendorman3dir'
24775 vendorman3direxp='$vendorman3direxp'
24776 vendorprefix='$vendorprefix'
24777 vendorprefixexp='$vendorprefixexp'
24778 vendorscript='$vendorscript'
24779 vendorscriptexp='$vendorscriptexp'
24780 version='$version'
24781 version_patchlevel_string='$version_patchlevel_string'
24782 versiononly='$versiononly'
24783 vi='$vi'
24784 xlibpth='$xlibpth'
24785 yacc='$yacc'
24786 yaccflags='$yaccflags'
24787 zcat='$zcat'
24788 zip='$zip'
24789 EOT
24790
24791 : add special variables
24792 $test -f $src/patchlevel.h && \
24793 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
24794 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
24795 echo "PERL_CONFIG_SH=true" >>config.sh
24796
24797 : propagate old symbols
24798 if $test -f UU/config.sh; then
24799         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
24800         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
24801                 config.sh config.sh UU/oldconfig.sh |\
24802                 $sort | $uniq -u >UU/oldsyms
24803         set X `$cat UU/oldsyms`
24804         shift
24805         case $# in
24806         0) ;;
24807         *)
24808                 $cat <<EOM
24809 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
24810 EOM
24811                 echo ": Variables propagated from previous config.sh file." >>config.sh
24812                 for sym in `$cat UU/oldsyms`; do
24813                         echo "    Propagating $hint variable "'$'"$sym..."
24814                         eval 'tmp="$'"${sym}"'"'
24815                         echo "$tmp" | \
24816                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
24817                 done
24818                 ;;
24819         esac
24820 fi
24821
24822 : preserve RCS keywords in files with variable substitution, grrr
24823 Id='$Id'
24824
24825 : Finish up by extracting the .SH files
24826 case "$alldone" in
24827 exit)
24828         echo "Stopping at your request, leaving temporary files around."
24829         exit 0
24830         ;;
24831 cont)
24832         ;;
24833 '')
24834         dflt=''
24835         nostick=true
24836         $cat <<EOM
24837
24838 If you'd like to make any changes to the config.sh file before I begin
24839 to configure things, do it as a shell escape now (e.g. !vi config.sh).
24840
24841 EOM
24842         rp="Press return or use a shell escape to edit config.sh:"
24843         . UU/myread
24844         nostick=''
24845         case "$ans" in
24846         '') ;;
24847         *) : in case they cannot read
24848                 sh 1>&4 -c "$ans";;
24849         esac
24850         ;;
24851 esac
24852
24853 : if this fails, just run all the .SH files by hand
24854 . ./config.sh
24855
24856 echo " "
24857 exec 1>&4
24858 pwd=`pwd`
24859 . ./UU/extract
24860 cd "$pwd"
24861
24862 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
24863         dflt=y
24864         case "$silent" in
24865         true) ;;
24866         *)
24867                 $cat <<EOM
24868
24869 Now you need to generate make dependencies by running "$make depend".
24870 You might prefer to run it in background: "$make depend > makedepend.out &"
24871 It can take a while, so you might not want to run it right now.
24872
24873 EOM
24874                 ;;
24875         esac
24876         rp="Run $make depend now?"
24877         . UU/myread
24878         case "$ans" in
24879         y*)
24880                 $make depend && echo "Now you must run '$make'."
24881                 ;;
24882         *)
24883                 echo "You must run '$make depend' then '$make'."
24884                 ;;
24885         esac
24886 elif test -f [Mm]akefile; then
24887         echo " "
24888         echo "Now you must run a $make."
24889 else
24890         echo "Configure done."
24891 fi
24892
24893 if $test -f Policy.sh; then
24894     $cat <<EOM
24895
24896 If you compile $package on a different machine or from a different object
24897 directory, copy the Policy.sh file from this object directory to the
24898 new one before you run Configure -- this will help you with most of
24899 the policy defaults.
24900
24901 EOM
24902 fi
24903 if $test -f UU/config.msg; then
24904     echo "Hmm.  I also noted the following information while running:"
24905     echo " "
24906     $cat UU/config.msg >&4
24907 fi
24908 $rm -f kit*isdone ark*isdone
24909 $rm -rf UU
24910
24911 : End of Configure
24912