This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
customise Pod::Perldoc to fix output misbehaviour
[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 ansi2knr=''
340 archlib=''
341 archlibexp=''
342 d_archlib=''
343 installarchlib=''
344 archname=''
345 myarchname=''
346 useversionedarchname=''
347 d_atolf=''
348 d_atoll=''
349 baserev=''
350 bin=''
351 binexp=''
352 initialinstalllocation=''
353 installbin=''
354 userelocatableinc=''
355 byteorder=''
356 cc=''
357 ccflags=''
358 cppflags=''
359 ldflags=''
360 lkflags=''
361 locincpth=''
362 optimize=''
363 cf_email=''
364 cf_by=''
365 cf_time=''
366 charbits=''
367 charsize=''
368 contains=''
369 cpp_stuff=''
370 cpplast=''
371 cppminus=''
372 cpprun=''
373 cppstdin=''
374 d__fwalk=''
375 d_access=''
376 d_accessx=''
377 d_acosh=''
378 d_aintl=''
379 d_alarm=''
380 asctime_r_proto=''
381 d_asctime_r=''
382 d_asinh=''
383 d_atanh=''
384 d_attribute_deprecated=''
385 d_attribute_format=''
386 d_attribute_malloc=''
387 d_attribute_nonnull=''
388 d_attribute_noreturn=''
389 d_attribute_pure=''
390 d_attribute_unused=''
391 d_attribute_warn_unused_result=''
392 d_printf_format_null=''
393 d_backtrace=''
394 d_bcmp=''
395 d_bcopy=''
396 d_builtin_choose_expr=''
397 d_builtin_expect=''
398 d_bzero=''
399 d_c99_variadic_macros=''
400 d_casti32=''
401 castflags=''
402 d_castneg=''
403 d_cbrt=''
404 d_chown=''
405 d_chroot=''
406 d_chsize=''
407 d_class=''
408 d_clearenv=''
409 d_closedir=''
410 d_void_closedir=''
411 d_cmsghdr_s=''
412 d_const=''
413 d_copysign=''
414 d_copysignl=''
415 d_cplusplus=''
416 cryptlib=''
417 d_crypt=''
418 crypt_r_proto=''
419 d_crypt_r=''
420 d_csh=''
421 full_csh=''
422 d_ctermid=''
423 ctermid_r_proto=''
424 d_ctermid_r=''
425 ctime_r_proto=''
426 d_ctime_r=''
427 d_cuserid=''
428 d_dbl_dig=''
429 d_dbminitproto=''
430 d_difftime=''
431 d_dir_dd_fd=''
432 d_dirfd=''
433 d_dladdr=''
434 d_dlerror=''
435 d_dlopen=''
436 d_dlsymun=''
437 d_dosuid=''
438 d_suidsafe=''
439 d_drand48_r=''
440 drand48_r_proto=''
441 d_drand48proto=''
442 d_dup2=''
443 d_eaccess=''
444 d_endgrent=''
445 d_endgrent_r=''
446 endgrent_r_proto=''
447 d_endhent=''
448 d_endhostent_r=''
449 endhostent_r_proto=''
450 d_endnent=''
451 d_endnetent_r=''
452 endnetent_r_proto=''
453 d_endpent=''
454 d_endprotoent_r=''
455 endprotoent_r_proto=''
456 d_endpwent=''
457 d_endpwent_r=''
458 endpwent_r_proto=''
459 d_endsent=''
460 d_endservent_r=''
461 endservent_r_proto=''
462 d_erf=''
463 d_erfc=''
464 d_exp2=''
465 d_expm1=''
466 d_faststdio=''
467 d_fchdir=''
468 d_fchmod=''
469 d_fchown=''
470 d_fcntl=''
471 d_fcntl_can_lock=''
472 d_fd_macros=''
473 d_fd_set=''
474 d_fds_bits=''
475 d_fdclose=''
476 d_fdim=''
477 d_fegetround=''
478 d_fgetpos=''
479 d_finite=''
480 d_finitel=''
481 d_flexfnam=''
482 d_flock=''
483 d_flockproto=''
484 d_fma=''
485 d_fmax=''
486 d_fmin=''
487 d_fork=''
488 d_fp_class=''
489 d_fp_classl=''
490 d_fpclass=''
491 d_fp_classify=''
492 d_fpclassify=''
493 d_fpclassl=''
494 d_fpgetround=''
495 d_fpos64_t=''
496 d_frexpl=''
497 d_fs_data_s=''
498 d_fchmodat=''
499 d_linkat=''
500 d_openat=''
501 d_renameat=''
502 d_unlinkat=''
503 d_fseeko=''
504 d_fsetpos=''
505 d_fstatfs=''
506 d_fsync=''
507 d_ftello=''
508 d_ftime=''
509 d_gettimeod=''
510 d_futimes=''
511 d_gai_strerror=''
512 d_Gconvert=''
513 d_getaddrinfo=''
514 d_getcwd=''
515 d_getespwnam=''
516 d_getfsstat=''
517 d_getgrent=''
518 d_getgrent_r=''
519 getgrent_r_proto=''
520 d_getgrgid_r=''
521 getgrgid_r_proto=''
522 d_getgrnam_r=''
523 getgrnam_r_proto=''
524 d_getgrps=''
525 d_gethbyaddr=''
526 d_gethbyname=''
527 d_gethent=''
528 aphostname=''
529 d_gethname=''
530 d_phostname=''
531 d_uname=''
532 d_gethostbyaddr_r=''
533 gethostbyaddr_r_proto=''
534 d_gethostbyname_r=''
535 gethostbyname_r_proto=''
536 d_gethostent_r=''
537 gethostent_r_proto=''
538 d_gethostprotos=''
539 d_getitimer=''
540 d_getlogin=''
541 d_getlogin_r=''
542 getlogin_r_proto=''
543 d_getmnt=''
544 d_getmntent=''
545 d_getnameinfo=''
546 d_getnbyaddr=''
547 d_getnbyname=''
548 d_getnent=''
549 d_getnetbyaddr_r=''
550 getnetbyaddr_r_proto=''
551 d_getnetbyname_r=''
552 getnetbyname_r_proto=''
553 d_getnetent_r=''
554 getnetent_r_proto=''
555 d_getnetprotos=''
556 d_getpagsz=''
557 d_getpent=''
558 d_getpgid=''
559 d_getpgrp2=''
560 d_bsdgetpgrp=''
561 d_getpgrp=''
562 d_getppid=''
563 d_getprior=''
564 d_getpbyname=''
565 d_getpbynumber=''
566 d_getprotobyname_r=''
567 getprotobyname_r_proto=''
568 d_getprotobynumber_r=''
569 getprotobynumber_r_proto=''
570 d_getprotoent_r=''
571 getprotoent_r_proto=''
572 d_getprotoprotos=''
573 d_getprpwnam=''
574 d_getpwent=''
575 d_getpwent_r=''
576 getpwent_r_proto=''
577 d_getpwnam_r=''
578 getpwnam_r_proto=''
579 d_getpwuid_r=''
580 getpwuid_r_proto=''
581 d_getsent=''
582 d_getservbyname_r=''
583 getservbyname_r_proto=''
584 d_getservbyport_r=''
585 getservbyport_r_proto=''
586 d_getservent_r=''
587 getservent_r_proto=''
588 d_getservprotos=''
589 d_getspnam=''
590 d_getspnam_r=''
591 getspnam_r_proto=''
592 d_getsbyname=''
593 d_getsbyport=''
594 d_gmtime_r=''
595 gmtime_r_proto=''
596 d_gnulibc=''
597 gnulibc_version=''
598 d_hasmntopt=''
599 d_htonl=''
600 d_hypot=''
601 d_ilogb=''
602 d_ilogbl=''
603 d_inetaton=''
604 d_inetntop=''
605 d_inetpton=''
606 d_int64_t=''
607 d_isascii=''
608 d_isblank=''
609 d_isfinite=''
610 d_isfinitel=''
611 d_isinf=''
612 d_isinfl=''
613 d_isless=''
614 d_isnan=''
615 d_isnanl=''
616 d_isnormal=''
617 d_j0=''
618 d_j0l=''
619 d_killpg=''
620 d_lc_monetary_2008=''
621 d_lchown=''
622 d_ldbl_dig=''
623 d_lgamma=''
624 d_lgamma_r=''
625 d_libm_lib_version=''
626 d_link=''
627 d_llrint=''
628 d_llrintl=''
629 d_llround=''
630 d_llroundl=''
631 d_localtime_r=''
632 d_localtime_r_needs_tzset=''
633 localtime_r_proto=''
634 d_locconv=''
635 d_lockf=''
636 d_log1p=''
637 d_log2=''
638 d_logb=''
639 d_ldexpl=''
640 d_long_double_style_ieee=''
641 d_long_double_style_ieee_doubledouble=''
642 d_long_double_style_ieee_extended=''
643 d_long_double_style_ieee_std=''
644 d_long_double_style_vax=''
645 d_longdbl=''
646 longdblkind=''
647 longdblsize=''
648 d_longlong=''
649 longlongsize=''
650 d_lrint=''
651 d_lrintl=''
652 d_lround=''
653 d_lroundl=''
654 d_lseekproto=''
655 d_lstat=''
656 d_madvise=''
657 d_malloc_good_size=''
658 d_malloc_size=''
659 d_mblen=''
660 d_mbstowcs=''
661 d_mbtowc=''
662 d_memchr=''
663 d_memcmp=''
664 d_memcpy=''
665 d_memmem=''
666 d_memmove=''
667 d_memrchr=''
668 d_memset=''
669 d_mkdir=''
670 d_mkdtemp=''
671 d_mkfifo=''
672 d_mkstemp=''
673 d_mkstemps=''
674 d_mktime=''
675 d_mmap=''
676 mmaptype=''
677 d_modfl=''
678 d_modflproto=''
679 d_mprotect=''
680 d_msg=''
681 d_msgctl=''
682 d_msgget=''
683 d_msghdr_s=''
684 d_msgrcv=''
685 d_msgsnd=''
686 d_msync=''
687 d_munmap=''
688 d_nan=''
689 d_nearbyint=''
690 d_duplocale=''
691 d_freelocale=''
692 d_newlocale=''
693 d_querylocale=''
694 d_uselocale=''
695 i_xlocale=''
696 d_nextafter=''
697 d_nexttoward=''
698 d_nice=''
699 d_nl_langinfo=''
700 d_off64_t=''
701 d_open3=''
702 d_fpathconf=''
703 d_pathconf=''
704 d_pause=''
705 d_pipe=''
706 d_poll=''
707 d_portable=''
708 d_prctl=''
709 d_prctl_set_name=''
710 d_procselfexe=''
711 procselfexe=''
712 d_old_pthread_create_joinable=''
713 old_pthread_create_joinable=''
714 d_pthread_atfork=''
715 d_pthread_attr_setscope=''
716 d_pthread_yield=''
717 d_sched_yield=''
718 sched_yield=''
719 d_ptrdiff_t=''
720 d_qgcvt=''
721 d_random_r=''
722 random_r_proto=''
723 d_readdir64_r=''
724 readdir64_r_proto=''
725 d_readdir=''
726 d_rewinddir=''
727 d_seekdir=''
728 d_telldir=''
729 d_readdir_r=''
730 readdir_r_proto=''
731 d_readlink=''
732 d_readv=''
733 d_recvmsg=''
734 d_re_comp=''
735 d_regcmp=''
736 d_regcomp=''
737 d_remainder=''
738 d_remquo=''
739 d_rename=''
740 d_rint=''
741 d_rmdir=''
742 d_round=''
743 d_safebcpy=''
744 d_safemcpy=''
745 d_sanemcmp=''
746 d_sbrkproto=''
747 d_scalbn=''
748 d_scalbnl=''
749 d_select=''
750 d_sem=''
751 d_semctl=''
752 d_semget=''
753 d_semop=''
754 d_sendmsg=''
755 d_setegid=''
756 d_seteuid=''
757 d_setgrent=''
758 d_setgrent_r=''
759 setgrent_r_proto=''
760 d_setgrps=''
761 d_sethent=''
762 d_sethostent_r=''
763 sethostent_r_proto=''
764 d_setitimer=''
765 d_setlinebuf=''
766 d_setlocale=''
767 d_setlocale_r=''
768 setlocale_r_proto=''
769 d_setnent=''
770 d_setnetent_r=''
771 setnetent_r_proto=''
772 d_setpent=''
773 d_setpgid=''
774 d_setpgrp2=''
775 d_bsdsetpgrp=''
776 d_setpgrp=''
777 d_setprior=''
778 d_setproctitle=''
779 d_setprotoent_r=''
780 setprotoent_r_proto=''
781 d_setpwent=''
782 d_setpwent_r=''
783 setpwent_r_proto=''
784 d_setregid=''
785 d_setresgid=''
786 d_setresuid=''
787 d_setreuid=''
788 d_setrgid=''
789 d_setruid=''
790 d_setsent=''
791 d_setservent_r=''
792 setservent_r_proto=''
793 d_setsid=''
794 d_setvbuf=''
795 d_shm=''
796 d_shmat=''
797 d_shmatprototype=''
798 shmattype=''
799 d_shmctl=''
800 d_shmdt=''
801 d_shmget=''
802 d_sigaction=''
803 d_siginfo_si_addr=''
804 d_siginfo_si_band=''
805 d_siginfo_si_errno=''
806 d_siginfo_si_fd=''
807 d_siginfo_si_pid=''
808 d_siginfo_si_status=''
809 d_siginfo_si_uid=''
810 d_siginfo_si_value=''
811 d_signbit=''
812 d_sigprocmask=''
813 d_sigsetjmp=''
814 usesitecustomize=''
815 d_snprintf=''
816 d_vsnprintf=''
817 d_sockatmark=''
818 d_sockatmarkproto=''
819 d_ip_mreq=''
820 d_ip_mreq_source=''
821 d_ipv6_mreq=''
822 d_ipv6_mreq_source=''
823 d_msg_ctrunc=''
824 d_msg_dontroute=''
825 d_msg_oob=''
826 d_msg_peek=''
827 d_msg_proxy=''
828 d_oldsock=''
829 d_scm_rights=''
830 d_sin6_scope_id=''
831 d_sockaddr_in6=''
832 d_sockaddr_sa_len=''
833 d_socket=''
834 d_sockpair=''
835 sockethdr=''
836 socketlib=''
837 d_socklen_t=''
838 d_socks5_init=''
839 d_sprintf_returns_strlen=''
840 d_sqrtl=''
841 d_srand48_r=''
842 srand48_r_proto=''
843 d_srandom_r=''
844 srandom_r_proto=''
845 d_sresgproto=''
846 d_sresuproto=''
847 d_stat=''
848 d_statblks=''
849 d_statfs_f_flags=''
850 d_statfs_s=''
851 d_static_inline=''
852 perl_static_inline=''
853 d_fstatvfs=''
854 d_statvfs=''
855 d_stdio_cnt_lval=''
856 d_stdio_ptr_lval=''
857 d_stdio_ptr_lval_nochange_cnt=''
858 d_stdio_ptr_lval_sets_cnt=''
859 d_stdiobase=''
860 d_stdstdio=''
861 stdio_base=''
862 stdio_bufsiz=''
863 stdio_cnt=''
864 stdio_filbuf=''
865 stdio_ptr=''
866 d_index=''
867 d_strchr=''
868 d_strcoll=''
869 d_strctcpy=''
870 d_strerrm=''
871 d_strerror=''
872 d_sysernlst=''
873 d_syserrlst=''
874 d_strerror_l=''
875 d_strerror_r=''
876 strerror_r_proto=''
877 d_strftime=''
878 d_strlcat=''
879 d_strlcpy=''
880 d_strtod=''
881 d_strtol=''
882 d_strtold=''
883 d_strtoll=''
884 d_strtoq=''
885 d_strtoul=''
886 d_strtoull=''
887 d_strtouq=''
888 d_strxfrm=''
889 d_symlink=''
890 d_syscall=''
891 d_syscallproto=''
892 d_sysconf=''
893 d_system=''
894 d_tcgetpgrp=''
895 d_tcsetpgrp=''
896 d_telldirproto=''
897 d_tgamma=''
898 d_time=''
899 timetype=''
900 d_asctime64=''
901 d_ctime64=''
902 d_difftime64=''
903 d_gmtime64=''
904 d_localtime64=''
905 d_mktime64=''
906 d_timegm=''
907 clocktype=''
908 d_times=''
909 d_tmpnam_r=''
910 tmpnam_r_proto=''
911 d_trunc=''
912 d_truncate=''
913 d_truncl=''
914 d_ttyname_r=''
915 ttyname_r_proto=''
916 d_tzname=''
917 d_u32align=''
918 d_ualarm=''
919 d_umask=''
920 d_semctl_semid_ds=''
921 d_semctl_semun=''
922 d_union_semun=''
923 d_unordered=''
924 d_unsetenv=''
925 d_usleep=''
926 d_usleepproto=''
927 d_ustat=''
928 d_pseudofork=''
929 d_vfork=''
930 usevfork=''
931 d_voidsig=''
932 signal_t=''
933 d_volatile=''
934 d_charvspr=''
935 d_vprintf=''
936 d_wait4=''
937 d_waitpid=''
938 d_wcscmp=''
939 d_wcstombs=''
940 d_wcsxfrm=''
941 d_wctomb=''
942 d_writev=''
943 default_inc_excludes_dot=''
944 dlext=''
945 bin_ELF=''
946 cccdlflags=''
947 ccdlflags=''
948 dlsrc=''
949 ld=''
950 ld_can_script=''
951 lddlflags=''
952 usedl=''
953 doublesize=''
954 dtraceobject=''
955 dtracexnolibs=''
956 ebcdic=''
957 fflushNULL=''
958 fflushall=''
959 fpossize=''
960 fpostype=''
961 gccansipedantic=''
962 gccosandvers=''
963 gccversion=''
964 gidformat=''
965 gidsign=''
966 gidsize=''
967 gidtype=''
968 groupstype=''
969 h_fcntl=''
970 h_sysfile=''
971 html1dir=''
972 html1direxp=''
973 installhtml1dir=''
974 html3dir=''
975 html3direxp=''
976 installhtml3dir=''
977 i_arpainet=''
978 i_assert=''
979 i_bfd=''
980 i_crypt=''
981 db_hashtype=''
982 db_prefixtype=''
983 db_version_major=''
984 db_version_minor=''
985 db_version_patch=''
986 i_db=''
987 i_dbm=''
988 i_rpcsvcdbm=''
989 d_dirnamlen=''
990 direntrytype=''
991 i_dirent=''
992 i_dlfcn=''
993 i_execinfo=''
994 i_fcntl=''
995 i_fenv=''
996 i_float=''
997 i_fp=''
998 i_fp_class=''
999 i_gdbm=''
1000 d_grpasswd=''
1001 i_grp=''
1002 i_ieeefp=''
1003 i_inttypes=''
1004 i_langinfo=''
1005 i_libutil=''
1006 i_limits=''
1007 i_locale=''
1008 i_machcthr=''
1009 i_malloc=''
1010 i_mallocmalloc=''
1011 i_math=''
1012 i_memory=''
1013 i_mntent=''
1014 d_gdbm_ndbm_h_uses_prototypes=''
1015 d_gdbmndbm_h_uses_prototypes=''
1016 d_ndbm=''
1017 d_ndbm_h_uses_prototypes=''
1018 i_gdbm_ndbm=''
1019 i_gdbmndbm=''
1020 i_ndbm=''
1021 i_netdb=''
1022 i_neterrno=''
1023 i_netinettcp=''
1024 i_niin=''
1025 i_sysin=''
1026 i_poll=''
1027 i_prot=''
1028 i_pthread=''
1029 d_pwage=''
1030 d_pwchange=''
1031 d_pwclass=''
1032 d_pwcomment=''
1033 d_pwexpire=''
1034 d_pwgecos=''
1035 d_pwpasswd=''
1036 d_pwquota=''
1037 i_pwd=''
1038 i_quadmath=''
1039 i_shadow=''
1040 i_socks=''
1041 i_stdbool=''
1042 i_stddef=''
1043 i_stdint=''
1044 i_stdlib=''
1045 i_string=''
1046 strings=''
1047 i_sunmath=''
1048 i_sysaccess=''
1049 i_sysdir=''
1050 i_sysfile=''
1051 d_voidtty=''
1052 i_bsdioctl=''
1053 i_sysfilio=''
1054 i_sysioctl=''
1055 i_syssockio=''
1056 i_syslog=''
1057 i_sysmman=''
1058 i_sysmode=''
1059 i_sysmount=''
1060 i_sysndir=''
1061 i_sysparam=''
1062 i_syspoll=''
1063 i_sysresrc=''
1064 i_syssecrt=''
1065 i_sysselct=''
1066 i_sysstat=''
1067 i_sysstatfs=''
1068 i_sysstatvfs=''
1069 i_systimes=''
1070 i_systypes=''
1071 i_sysuio=''
1072 i_sysun=''
1073 i_sysutsname=''
1074 i_sysvfs=''
1075 i_syswait=''
1076 i_sgtty=''
1077 i_termio=''
1078 i_termios=''
1079 d_tm_tm_gmtoff=''
1080 d_tm_tm_zone=''
1081 i_systime=''
1082 i_systimek=''
1083 i_time=''
1084 timeincl=''
1085 i_unistd=''
1086 i_ustat=''
1087 i_utime=''
1088 i_values=''
1089 i_stdarg=''
1090 i_varargs=''
1091 i_varhdr=''
1092 i_vfork=''
1093 d_inc_version_list=''
1094 inc_version_list=''
1095 inc_version_list_init=''
1096 doubleinfbytes=''
1097 doublenanbytes=''
1098 longdblinfbytes=''
1099 longdblnanbytes=''
1100 installprefix=''
1101 installprefixexp=''
1102 installstyle=''
1103 installusrbinperl=''
1104 intsize=''
1105 longsize=''
1106 shortsize=''
1107 issymlink=''
1108 libc=''
1109 ldlibpthname=''
1110 libperl=''
1111 shrpenv=''
1112 useshrplib=''
1113 glibpth=''
1114 incpth=''
1115 libpth=''
1116 loclibpth=''
1117 plibpth=''
1118 xlibpth=''
1119 ignore_versioned_solibs=''
1120 libs=''
1121 libsdirs=''
1122 libsfiles=''
1123 libsfound=''
1124 libspath=''
1125 lns=''
1126 d_PRIEUldbl=''
1127 d_PRIFUldbl=''
1128 d_PRIGUldbl=''
1129 d_PRIeldbl=''
1130 d_PRIfldbl=''
1131 d_PRIgldbl=''
1132 d_SCNfldbl=''
1133 d_double_has_inf=''
1134 d_double_has_nan=''
1135 d_double_has_negative_zero=''
1136 d_double_has_subnormals=''
1137 d_double_style_cray=''
1138 d_double_style_ibm=''
1139 d_double_style_ieee=''
1140 d_double_style_vax=''
1141 doublekind=''
1142 sPRIEUldbl=''
1143 sPRIFUldbl=''
1144 sPRIGUldbl=''
1145 sPRIeldbl=''
1146 sPRIfldbl=''
1147 sPRIgldbl=''
1148 sSCNfldbl=''
1149 lseeksize=''
1150 lseektype=''
1151 make_set_make=''
1152 d_mymalloc=''
1153 freetype=''
1154 mallocobj=''
1155 mallocsrc=''
1156 malloctype=''
1157 usemallocwrap=''
1158 usemymalloc=''
1159 installman1dir=''
1160 man1dir=''
1161 man1direxp=''
1162 man1ext=''
1163 installman3dir=''
1164 man3dir=''
1165 man3direxp=''
1166 man3ext=''
1167 doublemantbits=''
1168 longdblmantbits=''
1169 nvmantbits=''
1170 modetype=''
1171 multiarch=''
1172 mydomain=''
1173 myhostname=''
1174 phostname=''
1175 c=''
1176 n=''
1177 d_eofnblk=''
1178 eagain=''
1179 o_nonblock=''
1180 rd_nodata=''
1181 need_va_copy=''
1182 netdb_hlen_type=''
1183 netdb_host_type=''
1184 netdb_name_type=''
1185 netdb_net_type=''
1186 groupcat=''
1187 hostcat=''
1188 passcat=''
1189 orderlib=''
1190 ranlib=''
1191 d_perl_otherlibdirs=''
1192 otherlibdirs=''
1193 package=''
1194 spackage=''
1195 pager=''
1196 api_revision=''
1197 api_subversion=''
1198 api_version=''
1199 api_versionstring=''
1200 patchlevel=''
1201 perl_patchlevel=''
1202 revision=''
1203 subversion=''
1204 version=''
1205 version_patchlevel_string=''
1206 perl5=''
1207 perladmin=''
1208 perlpath=''
1209 d_nv_preserves_uv=''
1210 d_nv_zero_is_allbits_zero=''
1211 i16size=''
1212 i16type=''
1213 i32size=''
1214 i32type=''
1215 i64size=''
1216 i64type=''
1217 i8size=''
1218 i8type=''
1219 ivsize=''
1220 ivtype=''
1221 nv_overflows_integers_at=''
1222 nv_preserves_uv_bits=''
1223 nvsize=''
1224 nvtype=''
1225 u16size=''
1226 u16type=''
1227 u32size=''
1228 u32type=''
1229 u64size=''
1230 u64type=''
1231 u8size=''
1232 u8type=''
1233 uvsize=''
1234 uvtype=''
1235 ivdformat=''
1236 nvEUformat=''
1237 nvFUformat=''
1238 nvGUformat=''
1239 nveformat=''
1240 nvfformat=''
1241 nvgformat=''
1242 uvXUformat=''
1243 uvoformat=''
1244 uvuformat=''
1245 uvxformat=''
1246 pidtype=''
1247 prefix=''
1248 prefixexp=''
1249 installprivlib=''
1250 privlib=''
1251 privlibexp=''
1252 prototype=''
1253 ptrsize=''
1254 d_PRIXU64=''
1255 d_PRId64=''
1256 d_PRIi64=''
1257 d_PRIo64=''
1258 d_PRIu64=''
1259 d_PRIx64=''
1260 sPRIXU64=''
1261 sPRId64=''
1262 sPRIi64=''
1263 sPRIo64=''
1264 sPRIu64=''
1265 sPRIx64=''
1266 d_quad=''
1267 quadkind=''
1268 quadtype=''
1269 uquadtype=''
1270 drand01=''
1271 randbits=''
1272 randfunc=''
1273 randseedtype=''
1274 seedfunc=''
1275 installscript=''
1276 scriptdir=''
1277 scriptdirexp=''
1278 selectminbits=''
1279 selecttype=''
1280 sh=''
1281 targetsh=''
1282 sig_count=''
1283 sig_name=''
1284 sig_name_init=''
1285 sig_num=''
1286 sig_num_init=''
1287 sig_size=''
1288 d_sitearch=''
1289 installsitearch=''
1290 sitearch=''
1291 sitearchexp=''
1292 installsitebin=''
1293 sitebin=''
1294 sitebinexp=''
1295 installsitehtml1dir=''
1296 sitehtml1dir=''
1297 sitehtml1direxp=''
1298 installsitehtml3dir=''
1299 sitehtml3dir=''
1300 sitehtml3direxp=''
1301 installsitelib=''
1302 sitelib=''
1303 sitelib_stem=''
1304 sitelibexp=''
1305 installsiteman1dir=''
1306 siteman1dir=''
1307 siteman1direxp=''
1308 installsiteman3dir=''
1309 siteman3dir=''
1310 siteman3direxp=''
1311 siteprefix=''
1312 siteprefixexp=''
1313 installsitescript=''
1314 sitescript=''
1315 sitescriptexp=''
1316 sizesize=''
1317 sizetype=''
1318 d_libname_unique=''
1319 so=''
1320 socksizetype=''
1321 sharpbang=''
1322 shsharp=''
1323 spitshell=''
1324 src=''
1325 ssizetype=''
1326 st_ino_sign=''
1327 st_ino_size=''
1328 startperl=''
1329 startsh=''
1330 stdchar=''
1331 d_stdio_stream_array=''
1332 stdio_stream_array=''
1333 sysman=''
1334 sGMTIME_max=''
1335 sGMTIME_min=''
1336 sLOCALTIME_max=''
1337 sLOCALTIME_min=''
1338 trnl=''
1339 uidformat=''
1340 uidsign=''
1341 uidsize=''
1342 uidtype=''
1343 archname64=''
1344 use64bitall=''
1345 use64bitint=''
1346 usecbacktrace=''
1347 dtrace=''
1348 usedtrace=''
1349 usefaststdio=''
1350 usekernprocpathname=''
1351 ccflags_uselargefiles=''
1352 ldflags_uselargefiles=''
1353 libswanted_uselargefiles=''
1354 uselargefiles=''
1355 uselongdouble=''
1356 usemorebits=''
1357 usemultiplicity=''
1358 nm_opt=''
1359 nm_so_opt=''
1360 runnm=''
1361 usenm=''
1362 usensgetexecutablepath=''
1363 useperlio=''
1364 usequadmath=''
1365 usesocks=''
1366 d_oldpthreads=''
1367 use5005threads=''
1368 useithreads=''
1369 usereentrant=''
1370 usethreads=''
1371 incpath=''
1372 mips_type=''
1373 usrinc=''
1374 vaproto=''
1375 d_vendorarch=''
1376 installvendorarch=''
1377 vendorarch=''
1378 vendorarchexp=''
1379 d_vendorbin=''
1380 installvendorbin=''
1381 vendorbin=''
1382 vendorbinexp=''
1383 installvendorhtml1dir=''
1384 vendorhtml1dir=''
1385 vendorhtml1direxp=''
1386 installvendorhtml3dir=''
1387 vendorhtml3dir=''
1388 vendorhtml3direxp=''
1389 d_vendorlib=''
1390 installvendorlib=''
1391 vendorlib=''
1392 vendorlib_stem=''
1393 vendorlibexp=''
1394 installvendorman1dir=''
1395 vendorman1dir=''
1396 vendorman1direxp=''
1397 installvendorman3dir=''
1398 vendorman3dir=''
1399 vendorman3direxp=''
1400 usevendorprefix=''
1401 vendorprefix=''
1402 vendorprefixexp=''
1403 d_vendorscript=''
1404 installvendorscript=''
1405 vendorscript=''
1406 vendorscriptexp=''
1407 versiononly=''
1408 yacc=''
1409 yaccflags=''
1410 CONFIG=''
1411
1412 : Detect odd OSs
1413 define='define'
1414 undef='undef'
1415 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1416 rmlist=''
1417
1418 : We must find out about Eunice early
1419 eunicefix=':'
1420 if test -f /etc/unixtovms; then
1421         eunicefix=/etc/unixtovms
1422 fi
1423 if test -f /etc/unixtovms.exe; then
1424         eunicefix=/etc/unixtovms.exe
1425 fi
1426
1427 : Set executable suffix now -- needed before hints available
1428 if test -f "/libs/version.library"; then
1429 : Amiga OS
1430     _exe=""
1431 elif test -f "/system/gnu_library/bin/ar.pm"; then
1432 : Stratus VOS
1433     _exe=".pm"
1434 elif test -n "$DJGPP"; then
1435 : DOS DJGPP
1436     _exe=".exe"
1437 elif test -f /kern/cookiejar; then
1438 : MiNT
1439     _exe=""
1440 elif test -d c:/. -o -n "$is_os2" ; then
1441 : OS/2 or cygwin
1442     _exe=".exe"
1443 fi
1444
1445 groupstype=''
1446 i_whoami=''
1447 : Possible local include directories to search.
1448 : Set locincpth to "" in a hint file to defeat local include searches.
1449 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1450 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1451 :
1452 : no include file wanted by default
1453 inclwanted=''
1454
1455 : Enable -DEBUGGING and -DDEBUGGING from the command line
1456 EBUGGING=''
1457 DEBUGGING=''
1458
1459 : Trailing extension.  Override this in a hint file, if needed.
1460 : Extra object files, if any, needed on this platform.
1461 archobjs=''
1462 libnames=''
1463 : change the next line if compiling for Xenix/286 on Xenix/386
1464 xlibpth='/usr/lib/386 /lib/386'
1465 : Possible local library directories to search.
1466 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1467 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1468
1469 : general looking path for locating libraries
1470 glibpth="/lib /usr/lib $xlibpth"
1471 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1472 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1473 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1474 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1475
1476 : Private path used by Configure to find libraries.  Its value
1477 : is prepended to libpth. This variable takes care of special
1478 : machines, like the mips.  Usually, it should be empty.
1479 plibpth=''
1480
1481 : default library list
1482 libswanted=''
1483 : some systems want to use only the non-versioned libso:s
1484 ignore_versioned_solibs=''
1485 ccname=''
1486 ccversion=''
1487 perllibs=''
1488 : set useposix=false in your hint file to disable the POSIX extension.
1489 useposix=true
1490 : set useopcode=false in your hint file to disable the Opcode extension.
1491 useopcode=true
1492 archname64=''
1493 ccflags_uselargefiles=''
1494 ldflags_uselargefiles=''
1495 libswanted_uselargefiles=''
1496 : set usemultiplicity on the Configure command line to enable multiplicity.
1497 : set usesocks on the Configure command line to enable socks.
1498 archname=''
1499 : set usethreads on the Configure command line to enable threads.
1500 usereentrant='undef'
1501 : List of libraries we want.
1502 : If anyone needs extra -lxxx, put those in a hint file.
1503 libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
1504 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1505 : We probably want to search /usr/shlib before most other libraries.
1506 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1507 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1508 glibpth="/usr/shlib $glibpth"
1509 : Do not use vfork unless overridden by a hint file.
1510 usevfork=false
1511
1512 : Find the basic shell for Bourne shell scripts
1513 case "$sh" in
1514 '')
1515         case "$SYSTYPE" in
1516         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1517         *) xxx='/bin/sh';;
1518         esac
1519         if test -f "$xxx"; then
1520                 sh="$xxx"
1521         else
1522                 : Build up a list and do a single loop so we can 'break' out.
1523                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1524                 for xxx in sh bash ksh pdksh ash; do
1525                         for p in $pth; do
1526                                 try="$try ${p}/${xxx}"
1527                         done
1528                 done
1529                 for xxx in $try; do
1530                         if test -f "$xxx"; then
1531                                 sh="$xxx";
1532                                 break
1533                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1534                                 sh="$xxx";
1535                                 break
1536                         elif test -f "$xxx.exe"; then
1537                                 sh="$xxx";
1538                                 break
1539                         fi
1540                 done
1541         fi
1542         ;;
1543 esac
1544
1545 case "$sh" in
1546 '')     cat >&2 <<EOM
1547 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1548
1549 Usually it's in /bin/sh.  How did you even get this far?
1550 Please contact me (Perl Maintainers) at perlbug@perl.org and
1551 we'll try to straighten this all out.
1552 EOM
1553         exit 1
1554         ;;
1555 esac
1556
1557 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1558 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1559 targetsh=$sh
1560
1561 : see if sh knows # comments
1562 if `$sh -c '#' >/dev/null 2>&1`; then
1563         shsharp=true
1564         spitshell=cat
1565         xcat=/bin/cat
1566         test -f $xcat$_exe || xcat=/usr/bin/cat
1567         if test ! -f $xcat$_exe; then
1568                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1569                         if test -f $p/cat$_exe; then
1570                                 xcat=$p/cat
1571                                 break
1572                         fi
1573                 done
1574                 if test ! -f $xcat$_exe; then
1575                         echo "Can't find cat anywhere!"
1576                         exit 1
1577                 fi
1578         fi
1579         echo "#!$xcat" >sharp
1580         $eunicefix sharp
1581         chmod +x sharp
1582         ./sharp > today 2>/dev/null
1583         if test -s today; then
1584                 sharpbang='#!'
1585         else
1586                 echo "#! $xcat" > sharp
1587                 $eunicefix sharp
1588                 chmod +x sharp
1589                 ./sharp > today 2>/dev/null
1590                 if test -s today; then
1591                         sharpbang='#! '
1592                 else
1593                         sharpbang=': use '
1594                 fi
1595         fi
1596 else
1597         echo " "
1598         echo "Your $sh doesn't grok # comments--I will strip them later on."
1599         shsharp=false
1600         cd ..
1601         echo "exec grep -v '^[  ]*#'" >spitshell
1602         chmod +x spitshell
1603         $eunicefix spitshell
1604         spitshell=`pwd`/spitshell
1605         cd UU
1606         echo "I presume that if # doesn't work, #! won't work either!"
1607         sharpbang=': use '
1608 fi
1609 rm -f sharp today
1610
1611 : figure out how to guarantee sh startup
1612 case "$startsh" in
1613 '') startsh=${sharpbang}${sh} ;;
1614 *)
1615 esac
1616 cat >sharp <<EOSS
1617 $startsh
1618 set abc
1619 test "$?abc" != 1
1620 EOSS
1621
1622 chmod +x sharp
1623 $eunicefix sharp
1624 if ./sharp; then
1625         : echo "Yup, it does."
1626 else
1627         echo "Hmm... '$startsh' does not guarantee sh startup..."
1628         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1629 fi
1630 rm -f sharp
1631
1632 : Save command line options in file UU/cmdline.opt for later use in
1633 : generating config.sh.
1634 cat > cmdline.opt <<EOSH
1635 : Configure command line arguments.
1636 config_arg0='$0'
1637 config_args='$*'
1638 config_argc=$#
1639 EOSH
1640 argn=1
1641 args_exp=''
1642 args_sep=''
1643 for arg in "$@"; do
1644         cat >>cmdline.opt <<EOSH
1645 config_arg$argn='$arg'
1646 EOSH
1647         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1648 $arg
1649 EOC
1650         arg_exp=`cat cmdl.opt`
1651         args_exp="$args_exp$args_sep'$arg_exp'"
1652         argn=`expr $argn + 1`
1653         args_sep=' '
1654 done
1655 rm -f cmdl.opt
1656
1657 : produce awk script to parse command line options
1658 cat >options.awk <<'EOF'
1659 BEGIN {
1660         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1661
1662         len = length(optstr);
1663         for (i = 1; i <= len; i++) {
1664                 c = substr(optstr, i, 1);
1665                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1666                 if (a == ":") {
1667                         arg[c] = 1;
1668                         i++;
1669                 }
1670                 opt[c] = 1;
1671         }
1672 }
1673 {
1674         expect = 0;
1675         str = $0;
1676         if (substr(str, 1, 1) != "-") {
1677                 printf("'%s'\n", str);
1678                 next;
1679         }
1680         len = length($0);
1681         for (i = 2; i <= len; i++) {
1682                 c = substr(str, i, 1);
1683                 if (!opt[c]) {
1684                         printf("-%s\n", substr(str, i));
1685                         next;
1686                 }
1687                 printf("-%s\n", c);
1688                 if (arg[c]) {
1689                         if (i < len)
1690                                 printf("'%s'\n", substr(str, i + 1));
1691                         else
1692                                 expect = 1;
1693                         next;
1694                 }
1695         }
1696 }
1697 END {
1698         if (expect)
1699                 print "?";
1700 }
1701 EOF
1702
1703 : process the command line options
1704 set X `for arg in "$@"; do echo "X$arg"; done |
1705         sed -e s/X// | awk -f options.awk`
1706 eval "set $*"
1707 shift
1708 rm -f options.awk
1709
1710 : set up default values
1711 fastread=''
1712 reuseval=false
1713 config_sh=''
1714 alldone=''
1715 error=''
1716 silent=''
1717 extractsh=''
1718 knowitall=''
1719 rm -f optdef.sh posthint.sh
1720 cat >optdef.sh <<EOS
1721 $startsh
1722 EOS
1723
1724
1725 : option parsing
1726 while test $# -gt 0; do
1727         case "$1" in
1728         -d) shift; fastread=yes;;
1729         -e) shift; alldone=cont;;
1730         -f)
1731                 shift
1732                 cd ..
1733                 if test -r "$1"; then
1734                         config_sh="$1"
1735                 else
1736                         echo "$me: cannot read config file $1." >&2
1737                         error=true
1738                 fi
1739                 cd UU
1740                 shift;;
1741         --help|\
1742         -h) shift; error=true;;
1743         -r) shift; reuseval=true;;
1744         -s) shift; silent=true; realsilent=true;;
1745         -E) shift; alldone=exit;;
1746         -K) shift; knowitall=true;;
1747         -O) shift;;
1748         -S) shift; silent=true; extractsh=true;;
1749         -D)
1750                 shift
1751                 case "$1" in
1752                 *=)
1753                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1754                         echo "$me: ignoring -D $1" >&2
1755                         ;;
1756                 *=*) echo "$1" | \
1757                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1758                 *) echo "$1='define'" >> optdef.sh;;
1759                 esac
1760                 shift
1761                 ;;
1762         -U)
1763                 shift
1764                 case "$1" in
1765                 *=) echo "$1" >> optdef.sh;;
1766                 *=*)
1767                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1768                         echo "$me: ignoring -U $1" >&2
1769                         ;;
1770                 *) echo "$1='undef'" >> optdef.sh;;
1771                 esac
1772                 shift
1773                 ;;
1774         -A)
1775             shift
1776             xxx=''
1777             yyy="$1"
1778             zzz=''
1779             uuu=undef
1780             case "$yyy" in
1781             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1782                  case "$zzz" in
1783                  *:*) zzz='' ;;
1784                  *)   xxx=append
1785                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1786                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1787                  esac
1788                  ;;
1789             esac
1790             case "$xxx" in
1791             '')  case "$yyy" in
1792                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1793                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1794                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1795                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1796                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1797                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1798                  esac
1799                  ;;
1800             esac
1801             case "$xxx" in
1802             append)
1803                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1804             clear)
1805                 echo "$yyy=''"                  >> posthint.sh ;;
1806             define)
1807                 case "$zzz" in
1808                 '') zzz=define ;;
1809                 esac
1810                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1811             eval)
1812                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1813             prepend)
1814                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1815             undef)
1816                 case "$zzz" in
1817                 '') zzz="$uuu" ;;
1818                 esac
1819                 echo "$yyy=$zzz"                >> posthint.sh ;;
1820             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1821             esac
1822             shift
1823             ;;
1824         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1825             exit 0;;
1826         --) break;;
1827         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1828         *) break;;
1829         esac
1830 done
1831
1832 case "$error" in
1833 true)
1834         cat >&2 <<EOM
1835 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1836                  [-U symbol] [-U symbol=] [-A command:symbol...]
1837   -d : use defaults for all answers.
1838   -e : go on without questioning past the production of config.sh.
1839   -f : specify an alternate default configuration file.
1840   -h : print this help message and exit (with an error status).
1841   -r : reuse C symbols value if possible (skips costly nm extraction).
1842   -s : silent mode, only echoes questions and essential information.
1843   -D : define symbol to have some value:
1844          -D symbol         symbol gets the value 'define'
1845          -D symbol=value   symbol gets the value 'value'
1846        common used examples (see INSTALL for more info):
1847          -Duse64bitint            use 64bit integers
1848          -Duse64bitall            use 64bit integers and pointers
1849          -Dusethreads             use thread support
1850          -Dinc_version_list=none  do not include older perl trees in @INC
1851          -DEBUGGING=none          DEBUGGING options
1852          -Dcc=gcc                 choose your compiler
1853          -Dprefix=/opt/perl5      choose your destination
1854   -E : stop at the end of questions, after having produced config.sh.
1855   -K : do not use unless you know what you are doing.
1856   -O : ignored for backward compatibility
1857   -S : perform variable substitutions on all .SH files (can mix with -f)
1858   -U : undefine symbol:
1859          -U symbol    symbol gets the value 'undef'
1860          -U symbol=   symbol gets completely empty
1861        e.g.:  -Uversiononly
1862   -A : manipulate symbol after the platform specific hints have been applied:
1863          -A append:symbol=value   append value to symbol
1864          -A symbol=value          like append:, but with a separating space
1865          -A define:symbol=value   define symbol to have value
1866          -A clear:symbol          define symbol to be ''
1867          -A define:symbol         define symbol to be 'define'
1868          -A eval:symbol=value     define symbol to be eval of value
1869          -A prepend:symbol=value  prepend value to symbol
1870          -A undef:symbol          define symbol to be 'undef'
1871          -A undef:symbol=         define symbol to be ''
1872        e.g.:  -A prepend:libswanted='cl pthread '
1873               -A ccflags=-DSOME_MACRO
1874   -V : print version number and exit (with a zero status).
1875 EOM
1876         exit 1
1877         ;;
1878 esac
1879
1880 : Sanity checks
1881 case "$fastread$alldone" in
1882 yescont|yesexit) ;;
1883 *)
1884         case "$extractsh" in
1885         true) ;;
1886         *)
1887                 if test ! -t 0; then
1888                         echo "Say 'sh Configure', not 'sh <Configure'"
1889                         exit 1
1890                 fi
1891                 ;;
1892         esac
1893         ;;
1894 esac
1895
1896 exec 4>&1
1897 case "$silent" in
1898 true) exec 1>/dev/null;;
1899 esac
1900
1901 : run the defines and the undefines, if any, but leave the file out there...
1902 touch optdef.sh
1903 grep '\\' optdef.sh >/dev/null 2>&1
1904 if test $? = 0; then
1905     echo "Configure does not support \\ in -D arguments"
1906     exit 1
1907 fi
1908 . ./optdef.sh
1909 : create the posthint manipulation script and leave the file out there...
1910 touch posthint.sh
1911
1912 : set package name
1913 package='perl5'
1914 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1915 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1916 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1917 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1918 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1919 esac
1920
1921 : Some greps do not return status, grrr.
1922 echo "grimblepritz" >grimble
1923 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1924         contains=contains
1925 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1926         contains=grep
1927 else
1928         contains=contains
1929 fi
1930 rm -f grimble
1931 : the following should work in any shell
1932 case "$contains" in
1933 contains*)
1934         echo " "
1935         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1936         cat >contains <<'EOSS'
1937 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1938 EOSS
1939 chmod +x contains
1940 esac
1941
1942 : Find the path to the source tree
1943 case "$src" in
1944 '') case "$0" in
1945     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1946          case "$src" in
1947          /*)    ;;
1948          .)     ;;
1949          *)     src=`cd ../$src && pwd` ;;
1950          esac
1951          ;;
1952     *)   src='.';;
1953     esac;;
1954 esac
1955 case "$src" in
1956 '')     src=/
1957         rsrc=/
1958         ;;
1959 /*)     rsrc="$src";;
1960 *)      rsrc="../$src";;
1961 esac
1962 if test -f $rsrc/Configure && \
1963         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1964 then
1965    : found it, so we are ok.
1966 else
1967         rsrc=''
1968         for src in . .. ../.. ../../.. ../../../..; do
1969                 if test -f ../$src/Configure && \
1970                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1971                 then
1972                         rsrc=../$src
1973                         break
1974                 fi
1975         done
1976 fi
1977 case "$rsrc" in
1978 '')
1979         cat <<EOM >&4
1980
1981 Sorry, I can't seem to locate the source dir for $package.  Please start
1982 Configure with an explicit path -- i.e. /some/path/Configure.
1983
1984 EOM
1985         exit 1
1986         ;;
1987 ../.)   rsrc='..';;
1988 *)
1989         echo " "
1990         echo "Sources for $package found in \"$src\"." >&4
1991         ;;
1992 esac
1993
1994 : script used to extract .SH files with variable substitutions
1995 cat >extract <<'EOS'
1996 PERL_CONFIG_SH=true
1997 echo "Doing variable substitutions on .SH files..."
1998 if test -f MANIFEST; then
1999         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
2000 else
2001         echo "(Looking for .SH files under the source directory.)"
2002         set x `(cd "$src"; find . -name "*.SH" -print)`
2003 fi
2004 shift
2005 case $# in
2006 0) set x `(cd "$src"; echo *.SH)`; shift;;
2007 esac
2008 if test ! -f "$src/$1"; then
2009         shift
2010 fi
2011 mkdir_p='
2012 name=$1;
2013 create="";
2014 while test $name; do
2015         if test ! -d "$name"; then
2016                 create="$name $create";
2017                 name=`echo $name | sed -e "s|^[^/]*$||"`;
2018                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
2019         else
2020                 name="";
2021         fi;
2022 done;
2023 for file in $create; do
2024         mkdir $file;
2025 done
2026 '
2027 for file in $*; do
2028         case "$src" in
2029         ".")
2030                 case "$file" in
2031                 */*)
2032                         dir=`expr X$file : 'X\(.*\)/'`
2033                         file=`expr X$file : 'X.*/\(.*\)'`
2034                         (cd "$dir" && . ./$file)
2035                         ;;
2036                 *)
2037                         . ./$file
2038                         ;;
2039                 esac
2040                 ;;
2041         *)
2042                 case "$file" in
2043                 */*)
2044                         dir=`expr X$file : 'X\(.*\)/'`
2045                         file=`expr X$file : 'X.*/\(.*\)'`
2046                         (set x $dir; shift; eval $mkdir_p)
2047                         sh <"$src/$dir/$file"
2048                         ;;
2049                 *)
2050                         sh <"$src/$file"
2051                         ;;
2052                 esac
2053                 ;;
2054         esac
2055 done
2056 if test -f "$src/config_h.SH"; then
2057         if test ! -f config.h; then
2058         : oops, they left it out of MANIFEST, probably, so do it anyway.
2059         . "$src/config_h.SH"
2060         fi
2061 fi
2062 EOS
2063
2064 : extract files and exit if asked to do so
2065 case "$extractsh" in
2066 true)
2067         case "$realsilent" in
2068         true) ;;
2069         *) exec 1>&4;;
2070         esac
2071         case "$config_sh" in
2072         '') config_sh='config.sh';;
2073         esac
2074         echo " "
2075         echo "Fetching answers from $config_sh..."
2076         cd ..
2077         . $config_sh
2078         . UU/optdef.sh
2079         echo " "
2080         . UU/extract
2081         rm -rf UU
2082         echo "Extraction done."
2083         exit 0
2084         ;;
2085 esac
2086
2087 : Eunice requires " " instead of "", can you believe it
2088 echo " "
2089 : Here we go...
2090 echo "Beginning of configuration questions for $package."
2091
2092 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2093
2094 : first determine how to suppress newline on echo command
2095 echo " "
2096 echo "Checking echo to see how to suppress newlines..."
2097 (echo "hi there\c" ; echo " ") >.echotmp
2098 if $contains c .echotmp >/dev/null 2>&1 ; then
2099         echo "...using -n."
2100         n='-n'
2101         c=''
2102 else
2103         cat <<'EOM'
2104 ...using \c
2105 EOM
2106         n=''
2107         c='\c'
2108 fi
2109 echo $n "The star should be here-->$c"
2110 echo '*'
2111 rm -f .echotmp
2112
2113 : Now test for existence of everything in MANIFEST
2114 echo " "
2115 if test -f "$rsrc/MANIFEST"; then
2116         echo "First let's make sure your kit is complete.  Checking..." >&4
2117         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2118                 (split -l 50 2>/dev/null || split -50)
2119         rm -f missing
2120         tmppwd=`pwd`
2121         for filelist in x??; do
2122                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2123                         >/dev/null 2>>"$tmppwd/missing")
2124         done
2125         if test -s missing; then
2126                 cat missing >&4
2127                 cat >&4 <<'EOM'
2128
2129 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2130
2131 You have the option of continuing the configuration process, despite the
2132 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2133 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2134 and contact the author (perlbug@perl.org).
2135
2136 EOM
2137                 echo $n "Continue? [n] $c" >&4
2138                 read ans
2139                 case "$ans" in
2140                 y*)
2141                         echo "Continuing..." >&4
2142                         rm -f missing
2143                         ;;
2144                 *)
2145                         echo "ABORTING..." >&4
2146                         kill $$
2147                         ;;
2148                 esac
2149         else
2150                 echo "Looks good..."
2151         fi
2152 else
2153         echo "There is no MANIFEST file.  I hope your kit is complete !"
2154 fi
2155 rm -f missing x??
2156
2157 : Find the appropriate value for a newline for tr
2158 if test -n "$DJGPP"; then
2159        trnl='\012'
2160 fi
2161 if test X"$trnl" = X; then
2162         case "`echo foo | tr '\n' x 2>/dev/null`" in
2163         foox) trnl='\n' ;;
2164         esac
2165 fi
2166 if test X"$trnl" = X; then
2167         case "`echo foo | tr '\012' x 2>/dev/null`" in
2168         foox) trnl='\012' ;;
2169         esac
2170 fi
2171 if test X"$trnl" = X; then
2172        case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
2173        fooxy) trnl='\n\r' ;;
2174        esac
2175 fi
2176 if test X"$trnl" = X; then
2177         cat <<EOM >&2
2178
2179 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2180
2181 EOM
2182         exit 1
2183 fi
2184
2185 : compute the number of columns on the terminal for proper question formatting
2186 case "$COLUMNS" in
2187 '') COLUMNS='80';;
2188 esac
2189
2190 : set up the echo used in my read
2191 myecho="case \"\$xxxm\" in
2192 '') echo $n \"\$rp $c\" >&4;;
2193 *) case \"\$rp\" in
2194         '') echo $n \"[\$xxxm] $c\";;
2195         *)
2196                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2197                         echo \"\$rp\" >&4
2198                         echo $n \"[\$xxxm] $c\" >&4
2199                 else
2200                         echo $n \"\$rp [\$xxxm] $c\" >&4
2201                 fi
2202                 ;;
2203         esac;;
2204 esac"
2205
2206 : now set up to do reads with possible shell escape and default assignment
2207 cat <<EOSC >myread
2208 $startsh
2209 xxxm=\$dflt
2210 $myecho
2211 ans='!'
2212 case "\$fastread" in
2213 yes) case "\$dflt" in
2214         '') ;;
2215         *) ans='';
2216                 case "\$silent-\$rp" in
2217                 true-) ;;
2218                 *) echo " " >&4;;
2219                 esac;;
2220         esac;;
2221 *) case "\$silent" in
2222         true) case "\$rp" in
2223                 '') ans='';;
2224                 esac;;
2225         esac;;
2226 esac
2227 while expr "X\$ans" : "X!" >/dev/null; do
2228         read answ
2229         set x \$xxxm
2230         shift
2231         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2232         case  "\$answ" in
2233         "!")
2234                 sh 1>&4
2235                 echo " "
2236                 $myecho
2237                 ;;
2238         !*)
2239                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2240                 shift
2241                 sh 1>&4 -c "\$*"
2242                 echo " "
2243                 $myecho
2244                 ;;
2245         "\$ans")
2246                 case "\$ans" in
2247                 \\&*)
2248                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2249                         shift
2250                         case "\$1" in
2251                         -d)
2252                                 fastread=yes
2253                                 echo "(OK, I'll run with -d after this question.)" >&4
2254                                 ;;
2255                         -*)
2256                                 echo "*** Sorry, \$1 not supported yet." >&4
2257                                 ;;
2258                         esac
2259                         $myecho
2260                         ans=!
2261                         ;;
2262                 esac;;
2263         *)
2264                 case "\$aok" in
2265                 y)
2266                         echo "*** Substitution done -- please confirm."
2267                         xxxm="\$ans"
2268                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2269                         xxxm="\$ans"
2270                         ans=!
2271                         ;;
2272                 *)
2273                         echo "*** Error -- try again."
2274                         ans=!
2275                         ;;
2276                 esac
2277                 $myecho
2278                 ;;
2279         esac
2280         case "\$ans\$xxxm\$nostick" in
2281         '')
2282                 ans=!
2283                 $myecho
2284                 ;;
2285         esac
2286 done
2287 case "\$ans" in
2288 '') ans="\$xxxm";;
2289 esac
2290 EOSC
2291
2292 : create .config dir to save info across Configure sessions
2293 test -d ../.config || mkdir ../.config
2294 cat >../.config/README <<EOF
2295 This directory created by Configure to save information that should
2296 persist across sessions for $package.
2297
2298 You may safely delete it if you wish.
2299 EOF
2300
2301 : See if we are using a devel version and want that
2302 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2303 case "$usedevel" in
2304 $define|true|[yY]*)
2305     usedevel="$define" ;;
2306 *) case "$xversion" in
2307    *[13579])
2308         cat >&4 <<EOH
2309 *** WHOA THERE!!! ***
2310
2311     This is an UNSTABLE DEVELOPMENT release.
2312     The version of this $package distribution is $xversion, that is, odd,
2313     (as opposed to even) and that signifies a development release.
2314     If you want a maintenance release, you want an even-numbered version.
2315
2316     Do ***NOT*** install this into production use.
2317     Data corruption and crashes are possible.
2318
2319     It is most seriously suggested that you do not continue any further
2320     unless you want to help in developing and debugging Perl.
2321
2322     If you *still* want to build perl, you can answer 'y' now,
2323     or pass -Dusedevel to Configure.
2324
2325 EOH
2326         rp='Do you really want to continue?'
2327         dflt='n'
2328         . ./myread
2329         case "$ans" in
2330         [yY]) echo >&4 "Okay, continuing."
2331               usedevel="$define" ;;
2332         *) echo >&4 "Okay, bye."
2333            exit 1
2334            ;;
2335         esac
2336         ;;
2337     esac
2338     usedevel="$undef"
2339     ;;
2340 esac
2341 case "$usedevel" in
2342 $define|true|[yY]*)
2343         case "$versiononly" in
2344         '') versiononly="$define" ;;
2345         esac
2346         case "$installusrbinperl" in
2347         '') installusrbinperl="$undef" ;;
2348         esac
2349         ;;
2350 esac
2351
2352 : general instructions
2353 needman=true
2354 firsttime=true
2355 user=`(logname) 2>/dev/null`
2356 case "$user" in
2357 '') user=`whoami 2>&1`;;
2358 esac
2359 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2360         firsttime=false
2361         echo " "
2362         rp='Would you like to see the instructions?'
2363         dflt=n
2364         . ./myread
2365         case "$ans" in
2366         [yY]*) ;;
2367         *) needman=false;;
2368         esac
2369 fi
2370 if $needman; then
2371         cat <<EOH
2372
2373 This installation shell script will examine your system and ask you questions
2374 to determine how the perl5 package should be installed. If you get
2375 stuck on a question, you may use a ! shell escape to start a subshell or
2376 execute a command.  Many of the questions will have default answers in square
2377 brackets; typing carriage return will give you the default.
2378
2379 On some of the questions which ask for file or directory names you are allowed
2380 to use the ~name construct to specify the login directory belonging to "name",
2381 even if you don't have a shell which knows about that.  Questions where this is
2382 allowed will be marked "(~name ok)".
2383
2384 EOH
2385         rp=''
2386         dflt='Type carriage return to continue'
2387         . ./myread
2388         cat <<'EOH'
2389
2390 The prompter used in this script allows you to use shell variables and
2391 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2392 in the default answer, as if the default line was a set of arguments given to a
2393 script shell.  This means you may also use $* to repeat the whole default line,
2394 so you do not have to re-type everything to add something to the default.
2395
2396 Every time there is a substitution, you will have to confirm.  If there is an
2397 error (e.g. an unmatched backtick), the default answer will remain unchanged
2398 and you will be prompted again.
2399
2400 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2401 the questions and use the computed defaults (or the previous answers if there
2402 was already a config.sh file). Type 'Configure -h' for a list of options.
2403 You may also start interactively and then answer '& -d' at any prompt to turn
2404 on the non-interactive behaviour for the remainder of the execution.
2405
2406 EOH
2407         . ./myread
2408         cat <<EOH
2409
2410 Much effort has been expended to ensure that this shell script will run on any
2411 Unix system.  If despite that it blows up on yours, your best bet is to edit
2412 Configure and run it again.  If you can't run Configure for some reason,
2413 you'll have to generate a config.sh file by hand.  Whatever problems you
2414 have, let me (perlbug@perl.org) know how I blew it.
2415
2416 This installation script affects things in two ways:
2417
2418 1) it may do direct variable substitutions on some of the files included
2419    in this kit.
2420 2) it builds a config.h file for inclusion in C programs.  You may edit
2421    any of these files as the need arises after running this script.
2422
2423 If you make a mistake on a question, there is no easy way to back up to it
2424 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2425 files.  Configure will offer to let you do this before it runs the SH files.
2426
2427 EOH
2428         dflt='Type carriage return to continue'
2429         . ./myread
2430         case "$firsttime" in
2431         true) echo $user >>../.config/instruct;;
2432         esac
2433 fi
2434
2435 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2436 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2437 if test "X$sysroot" = X; then
2438     sysroot=""
2439 else
2440     case "$cc" in
2441         *gcc*|*g++*)
2442             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2443             # _sysroot is used in places where we need --sysroot=foo
2444             # but using the rest of the flags could cause issues.
2445             _sysroot="--sysroot=$sysroot";
2446             case "$ccflags" in
2447                 *sysroot*) ;;
2448                 'undef'|*)
2449                 ccflags="$ccflags $_sysroot"
2450             esac
2451             case "$ldflags" in
2452                 *sysroot*) ;;
2453                 'undef'|*)
2454                 ldflags="$ldflags $_sysroot"
2455             esac
2456             case "$cppflags" in
2457                 *sysroot*) ;;
2458                 'undef'|*)
2459                 cppflags="$cppflags $_sysroot"
2460             esac
2461             # lddlflags updated below in lddlflags section;
2462             # same with cccdlflags
2463             ;;
2464     esac
2465
2466     # Adjust some defaults to also use $sysroot
2467     for var in xlibpth loclibpth locincpth glibpth; do
2468         eval xxx=\$$var
2469         eval $var=''
2470         for path in $xxx; do
2471             eval $var=\"\$$var $sysroot$path\"
2472         done
2473     done
2474
2475 fi
2476
2477 : find out where common programs are
2478 echo " "
2479 echo "Locating common programs..." >&4
2480 cat <<EOSC >loc
2481 $startsh
2482 case \$# in
2483 0) exit 1;;
2484 esac
2485 thing=\$1
2486 shift
2487 dflt=\$1
2488 shift
2489 for dir in \$*; do
2490         case "\$thing" in
2491         .)
2492         if test -d \$dir/\$thing; then
2493                 echo \$dir
2494                 exit 0
2495         fi
2496         ;;
2497         *)
2498         for thisthing in \$dir/\$thing; do
2499                 : just loop through to pick last item
2500         done
2501         if test -f \$thisthing; then
2502                 echo \$thisthing
2503                 exit 0
2504         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2505                 echo \$thisthing
2506                 exit 0
2507         elif test -f \$dir/\$thing.exe; then
2508                 if test -n "$DJGPP"; then
2509                         echo \$dir/\$thing.exe
2510                 elif test "$eunicefix" != ":"; then
2511                         : on Eunice apparently
2512                         echo \$dir/\$thing
2513                 fi
2514                 exit 0
2515         fi
2516         ;;
2517         esac
2518 done
2519 echo \$dflt
2520 exit 1
2521 EOSC
2522 chmod +x loc
2523 $eunicefix loc
2524 loclist="
2525 awk
2526 cat
2527 chmod
2528 comm
2529 cp
2530 echo
2531 expr
2532 grep
2533 ls
2534 mkdir
2535 rm
2536 sed
2537 sort
2538 touch
2539 tr
2540 uniq
2541 "
2542 trylist="
2543 ar
2544 bison
2545 byacc
2546 cpp
2547 csh
2548 date
2549 egrep
2550 gmake
2551 gzip
2552 less
2553 ln
2554 make
2555 more
2556 nm
2557 nroff
2558 perl
2559 pg
2560 test
2561 uname
2562 zip
2563 "
2564 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2565 pth="$pth $sysroot/lib $sysroot/usr/lib"
2566 for file in $loclist; do
2567         eval xxx=\$$file
2568         case "$xxx" in
2569         /*|?:[\\/]*)
2570                 if test -f "$xxx"; then
2571                         : ok
2572                 else
2573                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2574                         xxx=`./loc $file $file $pth`
2575                 fi
2576                 ;;
2577         '') xxx=`./loc $file $file $pth`;;
2578         *) xxx=`./loc $xxx $xxx $pth`;;
2579         esac
2580         eval $file=$xxx$_exe
2581         eval _$file=$xxx
2582         case "$xxx" in
2583         /*)
2584                 echo $file is in $xxx.
2585                 ;;
2586         ?:[\\/]*)
2587                 echo $file is in $xxx.
2588                 ;;
2589         *)
2590                 echo "I don't know where '$file' is, and my life depends on it." >&4
2591                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2592                 exit 1
2593                 ;;
2594         esac
2595 done
2596 echo " "
2597 echo "Don't worry if any of the following aren't found..."
2598 say=offhand
2599 for file in $trylist; do
2600         eval xxx=\$$file
2601         case "$xxx" in
2602         /*|?:[\\/]*)
2603                 if test -f "$xxx"; then
2604                         : ok
2605                 else
2606                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2607                         xxx=`./loc $file $file $pth`
2608                 fi
2609                 ;;
2610         '') xxx=`./loc $file $file $pth`;;
2611         *) xxx=`./loc $xxx $xxx $pth`;;
2612         esac
2613         eval $file=$xxx$_exe
2614         eval _$file=$xxx
2615         case "$xxx" in
2616         /*)
2617                 echo $file is in $xxx.
2618                 ;;
2619         ?:[\\/]*)
2620                 echo $file is in $xxx.
2621                 ;;
2622         *)
2623                 echo "I don't see $file out there, $say."
2624                 say=either
2625                 ;;
2626         esac
2627 done
2628 case "$egrep" in
2629 egrep)
2630         echo "Substituting grep for egrep."
2631         egrep=$grep
2632         _egrep=$grep
2633         ;;
2634 esac
2635 case "$less" in
2636 '')     ;;
2637 *)      if $less -R </dev/null >/dev/null 2>&1; then
2638                echo "Substituting less -R for less."
2639                less="$less -R"
2640                _less=$less
2641         fi
2642         ;;
2643 esac
2644 case "$ln" in
2645 ln)
2646         echo "Substituting cp for ln."
2647         ln=$cp
2648         _ln=$cp
2649         ;;
2650 esac
2651 case "$make" in
2652 make)
2653         case "$gmake" in
2654         gmake)
2655         echo "I can't find make or gmake, and my life depends on it." >&4
2656         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2657         exit 1
2658         ;;
2659         esac
2660         ;;
2661 esac
2662 case "$gmake" in
2663 gmake)  ;;
2664 *)      # We can't have osname yet.
2665         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2666                 # Assume that gmake, if found, is definitely GNU make
2667                 # and prefer it over the system make.
2668                 echo "Substituting gmake for make."
2669                 make=$gmake
2670                 _make=$gmake
2671         fi
2672         ;;
2673 esac
2674 case "$test" in
2675 test)
2676         echo "Hopefully test is built into your sh."
2677         ;;
2678 *)
2679         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2680                 echo "Using the test built into your sh."
2681                 test=test
2682                 _test=test
2683         fi
2684         ;;
2685 esac
2686 case "$echo" in
2687 echo)
2688         echo "Hopefully echo is built into your sh."
2689         ;;
2690 '') ;;
2691 *)
2692         echo " "
2693 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2694         $echo $n "hi there$c" >foo1
2695         echo $n "hi there$c" >foo2
2696         if cmp foo1 foo2 >/dev/null 2>&1; then
2697                 echo "They are compatible.  In fact, they may be identical."
2698         else
2699                 case "$n" in
2700                 '-n') n='' c='\c';;
2701                 *) n='-n' c='';;
2702                 esac
2703                 cat <<FOO
2704 They are not compatible!  You are probably running ksh on a non-USG system.
2705 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2706 have echo built in and we may have to run some Bourne shell scripts.  That
2707 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2708
2709 FOO
2710                 $echo $n "The star should be here-->$c"
2711                 $echo "*"
2712         fi
2713         $rm -f foo1 foo2
2714         ;;
2715 esac
2716
2717 # This question was auctioned at YAPC::Europe-2007 in Vienna
2718 # I never promised you could answer it. I only auctioned the question.
2719 cat <<FOO
2720 The following message is sponsored by
2721
2722   Dresden.pm<--The stars should be here.
2723
2724 Dear Perl user, system administrator or package
2725 maintainer, the Perl community sends greetings to
2726 you. Do you (emblematical) greet back [Y/n]? n
2727
2728 FOO
2729
2730 : Check what type of C compiler we use
2731 cat <<EOS >trygcc
2732 $startsh
2733 EOS
2734 cat <<'EOSC' >>trygcc
2735 case "$cc" in
2736 '') ;;
2737 *)  $rm -f try try.*
2738     $cat >try.c <<EOM
2739 int main(int argc, char *argv[]) {
2740   return 0;
2741 }
2742 EOM
2743     if $cc -o try $ccflags $ldflags try.c; then
2744        :
2745     else
2746         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2747         despair=yes
2748         trygcc=yes
2749         case "$cc" in
2750         *gcc*) trygcc=no ;;
2751         esac
2752         # Skip this test because it gives a false match on output like:
2753         #    ./trygcc: line 23: cc: command not found
2754         # case "`$cc -v -c try.c 2>&1`" in
2755         # *gcc*) trygcc=no ;;
2756         # esac
2757         if $test X"$trygcc" = Xyes; then
2758             if gcc -o try -c try.c; then
2759                 echo " "
2760                 echo "You seem to have a working gcc, though." >&4
2761                 # Switching compilers may undo the work of hints files.
2762                 # The most common problem is -D_REENTRANT for threads.
2763                 # This heuristic catches that case, but gets false positives
2764                 # if -Dusethreads was not actually specified.  Better to
2765                 # bail out here with a useful message than fail
2766                 # mysteriously later. Should we perhaps just try to
2767                 # re-invoke Configure -Dcc=gcc config_args ?
2768                 if $test -f usethreads.cbu; then
2769                         $cat >&4 <<EOM
2770
2771 *** However, any setting of the C compiler flags (e.g. for thread support)
2772 *** will be lost.  It may be necessary for you to restart Configure and
2773 *** add -Dcc=gcc to your Configure command line.
2774
2775 EOM
2776                         rp="Would you like to go ahead and try gcc anyway?"
2777                         dflt=n
2778                 else
2779                         rp="Would you like to use it?"
2780                         dflt=y
2781                 fi
2782                 if $test -f myread; then
2783                     . ./myread
2784                 else
2785                     if $test -f UU/myread; then
2786                         . ./UU/myread
2787                     else
2788                         echo "Cannot find myread, sorry.  Aborting." >&2
2789                         exit 1
2790                     fi
2791                 fi
2792                 case "$ans" in
2793                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2794                 esac
2795             fi
2796         fi
2797     fi
2798     $rm -f try try.*
2799     ;;
2800 esac
2801 EOSC
2802
2803 cat <<EOS >checkcc
2804 $startsh
2805 EOS
2806 cat <<'EOSC' >>checkcc
2807 case "$cc" in
2808 '') ;;
2809 *)  $rm -f try try.*
2810     $cat >try.c <<EOM
2811 int main(int argc, char *argv[]) {
2812   return 0;
2813 }
2814 EOM
2815     if $cc -o try $ccflags $ldflags try.c; then
2816        :
2817     else
2818         if $test X"$despair" = Xyes; then
2819            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2820         fi
2821         $cat >&4 <<EOM
2822 You need to find a working C compiler.
2823 Either (purchase and) install the C compiler supplied by your OS vendor,
2824 or for a free C compiler try http://gcc.gnu.org/
2825 I cannot continue any further, aborting.
2826 EOM
2827         exit 1
2828     fi
2829     $rm -f try try.*
2830     ;;
2831 esac
2832 EOSC
2833
2834 : determine whether symbolic links are supported
2835 echo " "
2836 $touch blurfl
2837 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2838         echo "Symbolic links are supported." >&4
2839         lns="$ln -s"
2840 else
2841         echo "Symbolic links are NOT supported." >&4
2842         lns="$ln"
2843 fi
2844 $rm -f blurfl sym
2845
2846 : determine whether symbolic links are supported
2847 echo " "
2848 case "$lns" in
2849 *"ln"*" -s")
2850         echo "Checking how to test for symbolic links..." >&4
2851         $lns blurfl sym
2852         if $test "X$issymlink" = X; then
2853                 case "$newsh" in
2854                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2855                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2856                 esac
2857                 if test $? = 0; then
2858                         issymlink="test -h"
2859                 else
2860                         echo "Your builtin 'test -h' may be broken." >&4
2861                         case "$test" in
2862                         /*)     ;;
2863                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2864                                 for p in $pth
2865                                 do
2866                                         if test -f "$p/$test"; then
2867                                                 test="$p/$test"
2868                                                 break
2869                                         fi
2870                                 done
2871                                 ;;
2872                         esac
2873                         case "$test" in
2874                         /*)
2875                                 echo "Trying external '$test -h'." >&4
2876                                 issymlink="$test -h"
2877                                 if $test ! -h sym >/dev/null 2>&1; then
2878                                         echo "External '$test -h' is broken, too." >&4
2879                                         issymlink=''
2880                                 fi
2881                                 ;;
2882                         *)      issymlink='' ;;
2883                         esac
2884                 fi
2885         fi
2886         if $test "X$issymlink" = X; then
2887                 if $test -L sym 2>/dev/null; then
2888                         issymlink="$test -L"
2889                         echo "The builtin '$test -L' worked." >&4
2890                 fi
2891         fi
2892         if $test "X$issymlink" != X; then
2893                 echo "You can test for symbolic links with '$issymlink'." >&4
2894         else
2895                 echo "I do not know how you can test for symbolic links." >&4
2896         fi
2897         $rm -f blurfl sym
2898         ;;
2899 *)      echo "No symbolic links, so not testing for their testing..." >&4
2900         ;;
2901 esac
2902
2903 : Make symlinks util
2904 case "$mksymlinks" in
2905 $define|true|[yY]*)
2906         case "$src" in
2907         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2908                 exit 1
2909                 ;;
2910         *)      case "$lns:$issymlink" in
2911                 *"ln"*" -s:"*"test -"?)
2912                         echo "Creating the symbolic links..." >&4
2913                         cd ..
2914                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2915                         awk 'NF == 1 {
2916                                 dir=".";
2917                                 file=$1 "";
2918                              }
2919                              NF == 2 {
2920                                 dir=$1 "";
2921                                 file=$2 "";
2922                              }
2923                              {
2924                                  print "# dir = ", dir, "file = ", file
2925                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2926                              } END {
2927                                  for (d in mf) {
2928                                      if (d != ".") { print("mkdir -p "d) }
2929                                      print("ln -sf "mf[d]" "d);
2930                                  }
2931                              }' source="$src" > UU/mksymlinks.$$
2932                         sh UU/mksymlinks.$$
2933                         rm UU/mksymlinks.$$
2934                         # Sanity check 1.
2935                         if test ! -d t/base; then
2936                                 echo "Failed to create the subdirectories.  Aborting." >&4
2937                                 exit 1
2938                         fi
2939                         # Sanity check 2.
2940                         if test ! -f t/base/lex.t; then
2941                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2942                                 exit 1
2943                         fi
2944                         if test ! -f win32/win32.c; then
2945                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2946                                 exit 1
2947                         fi
2948                         cd UU
2949                         ;;
2950                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2951                         ;;
2952                 esac
2953                 ;;
2954         esac
2955         ;;
2956 esac
2957
2958 : Check for Cross-Compilation
2959 if $test "X$targethost" = "X"; then
2960     targethost=""
2961 fi
2962 if $test "X$targetenv" = "X"; then
2963     targetenv=""
2964 fi
2965 case "$usecrosscompile" in
2966 $define|true|[yY]*)
2967         $echo "Cross-compiling..."
2968         croak=''
2969         case "$cc" in
2970         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2971             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2972             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2973             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2974             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2975             # leave out ld, choosing it is more complex
2976             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2977             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2978             # We are in a weird spot. Just before us, some values
2979             # were 'saved', to be restored after the hints are
2980             # run.  This means that the changes we made to ar,
2981             # nm and ranlib will get reverted.
2982             # To avoid that, we hijack the saving mechanism and
2983             # have it save our new values.
2984             for file in ar nm ranlib; do
2985                 eval xxx=\$$file
2986                 eval $file=$xxx$_exe
2987                 eval _$file=$xxx
2988             done
2989         ;;
2990         esac
2991         case "$targetarch" in
2992         '') echo "Targetarch not defined." >&4; croak=y ;;
2993         *)  echo "Using targetarch $targetarch." >&4 ;;
2994         esac
2995         case "$targethost" in
2996         '') echo "Targethost not defined." >&4; croak=n ;;
2997         *)  echo "Using targethost $targethost." >&4
2998         esac
2999         locincpth=' '
3000         loclibpth=' '
3001         case "$croak" in
3002         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
3003         esac
3004     : compile a host miniperl and generate_uudmap, unless we got passed them
3005     if $test "X$hostperl" = X; then
3006       echo "Building host miniperl and generate_uudmap binaries" >&4
3007       before_host=`pwd`
3008       cd ..
3009       cd $src
3010       src=`pwd`
3011       rm -rf $src/host
3012       mkdir $src/host
3013       cd $src/host
3014       $src/Configure -des -Dusedevel -Dmksymlinks
3015       $make miniperl
3016       case "$hostgenerate" in
3017       '') $make generate_uudmap
3018           hostgenerate=$src/host/generate_uudmap
3019           ;;
3020        "$undef") hostgenerate=''
3021           ;;
3022       esac
3023       hostperl=$src/host/miniperl
3024       cd $before_host
3025     fi
3026     hostosname=`$hostperl -le 'print $^O'`
3027     ;;
3028 *)
3029     usecrosscompile="$undef"
3030     ;;
3031 esac
3032
3033 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3034 case "$targethost" in
3035     '') echo "Checking for cross-compile" >&4
3036     case "$usecrosscompile$multiarch" in
3037        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3038          if [ -f Makefile ]; then
3039            echo " "
3040            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3041          else
3042            echo "Configure done."
3043          fi
3044        exit 0
3045        ;;
3046      *) echo "No targethost for running compiler tests against defined, running locally" >&4
3047         run=''
3048         to=:
3049         from=:
3050         ;;
3051     esac
3052     ;;
3053     *) echo "Using targethost $targethost." >&4
3054         case "$src" in
3055         /*) run=$src/Cross/run
3056             targetmkdir=$src/Cross/mkdir
3057             to=$src/Cross/to
3058             from=$src/Cross/from
3059             ;;
3060         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3061             run=$pwd/Cross/run
3062             targetmkdir=$pwd/Cross/mkdir
3063             to=$pwd/Cross/to
3064             from=$pwd/Cross/from
3065             ;;
3066         esac
3067         case "$targetrun" in
3068         '') targetrun=ssh ;;
3069         esac
3070         case "$targetto" in
3071         '') targetto=scp ;;
3072         esac
3073         case "$targetfrom" in
3074         '') targetfrom=scp ;;
3075         esac
3076         run=$run-$targetrun
3077         to=$to-$targetto
3078         from=$from-$targetfrom
3079         case "$targetdir" in
3080         '')  targetdir=/tmp
3081              echo "Guessing targetdir $targetdir." >&4
3082              ;;
3083         esac
3084         case "$targetuser" in
3085         '')  targetuser=root
3086              echo "Guessing targetuser $targetuser." >&4
3087              ;;
3088         esac
3089         case "$targetport" in
3090         '')  targetport=22
3091              echo "Guessing targetport $targetport." >&4
3092              ;;
3093         esac
3094         case "$targetfrom" in
3095         scp)    q=-q ;;
3096         *)      q='' ;;
3097         esac
3098         case "$targetrun" in
3099         ssh|rsh)
3100             cat >$run <<EOF
3101 #!/bin/sh
3102 env=''
3103 case "\$1" in
3104 -cwd)
3105   shift
3106   cwd=\$1
3107   shift
3108   ;;
3109 esac
3110 case "\$1" in
3111 -env)
3112   shift
3113   env=\$1
3114   shift
3115   ;;
3116 esac
3117 case "\$cwd" in
3118 '') cwd=$targetdir ;;
3119 esac
3120 exe=\$1
3121 shift
3122 $to \$exe
3123 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3124 EOF
3125             ;;
3126         adb)
3127             $touch $run
3128             ;;
3129         *)  echo "Unknown targetrun '$targetrun'" >&4
3130             exit 1
3131             ;;
3132         esac
3133         case "$targetmkdir" in
3134         */Cross/mkdir)
3135             cat >$targetmkdir <<EOF
3136 #!/bin/sh
3137 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3138 EOF
3139             $chmod a+rx $targetmkdir
3140             ;;
3141         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3142             exit 1
3143             ;;
3144         esac
3145         case "$targetto" in
3146         scp|rcp)
3147             cat >$to <<EOF
3148 #!/bin/sh
3149 for f in \$@
3150 do
3151   case "\$f" in
3152   /*)
3153     $targetmkdir \`dirname \$f\`
3154     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3155     ;;
3156   *)
3157     $targetmkdir $targetdir/\`dirname \$f\`
3158     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3159     ;;
3160   esac
3161 done
3162 exit 0
3163 EOF
3164             ;;
3165         cp) cat >$to <<EOF
3166 #!/bin/sh
3167 for f in \$@
3168 do
3169   case "\$f" in
3170   /*)
3171     $mkdir -p $targetdir/\`dirname \$f\`
3172     $cp \$f $targetdir/\$f || exit 1
3173     ;;
3174   *)
3175     $targetmkdir $targetdir/\`dirname \$f\`
3176     $cp \$f $targetdir/\$f || exit 1
3177     ;;
3178   esac
3179 done
3180 exit 0
3181 EOF
3182             ;;
3183         *)  echo "Unknown targetto '$targetto'" >&4
3184             exit 1
3185             ;;
3186         esac
3187         case "$targetfrom" in
3188         scp|rcp)
3189           cat >$from <<EOF
3190 #!/bin/sh
3191 for f in \$@
3192 do
3193   $rm -f \$f
3194   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3195 done
3196 exit 0
3197 EOF
3198             ;;
3199         cp) cat >$from <<EOF
3200 #!/bin/sh
3201 for f in \$@
3202 do
3203   $rm -f \$f
3204   cp $targetdir/\$f . || exit 1
3205 done
3206 exit 0
3207 EOF
3208             ;;
3209         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3210             exit 1
3211             ;;
3212         esac
3213         if $test ! -f $run; then
3214             echo "Target 'run' script '$run' not found." >&4
3215         else
3216             $chmod a+rx $run
3217         fi
3218         if $test ! -f $to; then
3219             echo "Target 'to' script '$to' not found." >&4
3220         else
3221             $chmod a+rx $to
3222         fi
3223         if $test ! -f $from; then
3224             echo "Target 'from' script '$from' not found." >&4
3225         else
3226             $chmod a+rx $from
3227         fi
3228         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3229             exit 1
3230         fi
3231         cat >&4 <<EOF
3232 Using '$run' for remote execution,
3233 and '$from' and '$to'
3234 for remote file transfer.
3235 EOF
3236         ;;
3237 *)      run=''
3238         to=:
3239         from=:
3240         usecrosscompile="$undef"
3241         targetarch=''
3242         ;;
3243 esac
3244
3245 : see whether [:lower:] and [:upper:] are supported character classes
3246 echo " "
3247 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3248 ABYZ-abyz)
3249         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3250         up='[:upper:]'
3251         low='[:lower:]'
3252         ;;
3253 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3254         # (0xd9 and 0xe2), therefore that is a nice testing point.
3255         if test "X$up" = X -o "X$low" = X; then
3256             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3257             rs) up='[A-Z]'
3258                 low='[a-z]'
3259                 ;;
3260             esac
3261         fi
3262         if test "X$up" = X -o "X$low" = X; then
3263             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3264             rs) up='A-Z'
3265                 low='a-z'
3266                 ;;
3267             esac
3268         fi
3269         if test "X$up" = X -o "X$low" = X; then
3270             case "`echo RS | od -x 2>/dev/null`" in
3271             *D9E2*|*d9e2*)
3272                 echo "Hey, this might be EBCDIC." >&4
3273                 if test "X$up" = X -o "X$low" = X; then
3274                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3275                     rs) up='[A-IJ-RS-Z]'
3276                         low='[a-ij-rs-z]'
3277                         ;;
3278                     esac
3279                 fi
3280                 if test "X$up" = X -o "X$low" = X; then
3281                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3282                     rs) up='A-IJ-RS-Z'
3283                         low='a-ij-rs-z'
3284                         ;;
3285                     esac
3286                 fi
3287                 ;;
3288             esac
3289         fi
3290 esac
3291 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3292 rs)
3293     echo "Using $up and $low to convert case." >&4
3294     ;;
3295 *)
3296     echo "I don't know how to translate letters from upper to lower case." >&4
3297     echo "Your tr is not acting any way I know of." >&4
3298     exit 1
3299     ;;
3300 esac
3301 : set up the translation script tr, must be called with ./tr of course
3302 cat >tr <<EOSC
3303 $startsh
3304 case "\$1\$2" in
3305 '[A-Z][a-z]') exec $tr '$up' '$low';;
3306 '[a-z][A-Z]') exec $tr '$low' '$up';;
3307 esac
3308 exec $tr "\$@"
3309 EOSC
3310 chmod +x tr
3311 $eunicefix tr
3312
3313 : Try to determine whether config.sh was made on this system
3314 case "$config_sh" in
3315 '')
3316 myuname=`$uname -a 2>/dev/null`
3317 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3318 # Downcase everything to avoid ambiguity.
3319 # Remove slashes and single quotes so we can use parts of this in
3320 # directory and file names.
3321 # Remove newlines so myuname is sane to use elsewhere.
3322 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3323 # because the A-Z/a-z are not consecutive.
3324 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3325         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3326 newmyuname="$myuname"
3327 dflt=n
3328 case "$knowitall" in
3329 '')
3330         if test -f ../config.sh; then
3331                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3332                         eval "`grep myuname= ../config.sh`"
3333                 fi
3334                 if test "X$myuname" = "X$newmyuname"; then
3335                         dflt=y
3336                 fi
3337         fi
3338         ;;
3339 *) dflt=y;;
3340 esac
3341
3342 : Get old answers from old config file if Configure was run on the
3343 : same system, otherwise use the hints.
3344 hint=default
3345 cd ..
3346 if test -f config.sh; then
3347         echo " "
3348         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3349         . UU/myread
3350         case "$ans" in
3351         n*|N*) echo "OK, I'll ignore it."
3352                 mv config.sh config.sh.old
3353                 myuname="$newmyuname"
3354                 ;;
3355         *)  echo "Fetching default answers from your old config.sh file..." >&4
3356                 tmp_n="$n"
3357                 tmp_c="$c"
3358                 tmp_sh="$sh"
3359                 . ./config.sh
3360                 cp config.sh UU
3361                 n="$tmp_n"
3362                 c="$tmp_c"
3363                 : Older versions did not always set $sh.  Catch re-use of such
3364                 : an old config.sh.
3365                 case "$sh" in
3366                 '') sh="$tmp_sh" ;;
3367                 esac
3368                 hint=previous
3369                 ;;
3370         esac
3371 fi
3372 . ./UU/checkcc
3373 if test ! -f config.sh; then
3374         $cat <<EOM
3375
3376 First time through, eh?  I have some defaults handy for some systems
3377 that need some extra help getting the Configure answers right:
3378
3379 EOM
3380         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3381         dflt=''
3382         : Half the following guesses are probably wrong... If you have better
3383         : tests or hints, please send them to perlbug@perl.org
3384         : The metaconfig authors would also appreciate a copy...
3385         $test -f /irix && osname=irix
3386         $test -f /xenix && osname=sco_xenix
3387         $test -f /dynix && osname=dynix
3388         $test -f /dnix && osname=dnix
3389         $test -f /lynx.os && osname=lynxos
3390         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3391         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3392         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3393         $test -f /bin/mips && /bin/mips && osname=mips
3394         $test -d /usr/apollo/bin && osname=apollo
3395         $test -f /etc/saf/_sactab && osname=svr4
3396         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3397         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3398         $test -f /sys/utilities/MultiView && osname=amigaos
3399         if $test -d /MachTen -o -d /MachTen_Folder; then
3400                 osname=machten
3401                 if $test -x /sbin/version; then
3402                         osvers=`/sbin/version | $awk '{print $2}' |
3403                         $sed -e 's/[A-Za-z]$//'`
3404                 elif $test -x /usr/etc/version; then
3405                         osvers=`/usr/etc/version | $awk '{print $2}' |
3406                         $sed -e 's/[A-Za-z]$//'`
3407                 else
3408                         osvers="$2.$3"
3409                 fi
3410         fi
3411
3412         $test -f /sys/posix.dll &&
3413                 $test -f /usr/bin/what &&
3414                 set X `/usr/bin/what /sys/posix.dll` &&
3415                 $test "$3" = UWIN &&
3416                 osname=uwin &&
3417                 osvers="$5"
3418
3419         if $test -f $uname; then
3420                 set X $myuname
3421                 shift
3422
3423                 case "$5" in
3424                 fps*) osname=fps ;;
3425                 mips*)
3426                         case "$4" in
3427                         umips) osname=umips ;;
3428                         *) osname=mips ;;
3429                         esac;;
3430                 [23]100) osname=mips ;;
3431                 i386*)
3432                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3433                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3434                                 osname='sco'
3435                                 osvers=$tmp
3436                         elif $test -f /etc/kconfig; then
3437                                 osname=isc
3438                                 if test "$lns" = "$ln -s"; then
3439                                         osvers=4
3440                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3441                                         osvers=3
3442                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3443                                         osvers=2
3444                                 fi
3445                         fi
3446                         tmp=''
3447                         ;;
3448                 pc*)
3449                         if test -n "$DJGPP"; then
3450                                 osname=dos
3451                                 osvers=djgpp
3452                         fi
3453                         ;;
3454                 esac
3455
3456                 case "$1" in
3457                 aix) osname=aix
3458                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3459                         case "$tmp" in
3460                         # oslevel can fail with:
3461                         # oslevel: Unable to acquire lock.
3462                         *not\ found) osvers="$4"."$3" ;;
3463                         '<3240'|'<>3240') osvers=3.2.0 ;;
3464                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3465                         '=3250'|'>3250') osvers=3.2.5 ;;
3466                         *) osvers=$tmp;;
3467                         esac
3468                         ;;
3469                 bitrig) osname=bitrig
3470                         osvers="$3"
3471                         ;;
3472                 bsd386) osname=bsd386
3473                         osvers=`$uname -r`
3474                         ;;
3475                 cygwin*) osname=cygwin
3476                         osvers="$3"
3477                         ;;
3478                 *dc.osx) osname=dcosx
3479                         osvers="$3"
3480                         ;;
3481                 dnix) osname=dnix
3482                         osvers="$3"
3483                         ;;
3484                 domainos) osname=apollo
3485                         osvers="$3"
3486                         ;;
3487                 dgux)   osname=dgux
3488                         osvers="$3"
3489                         ;;
3490                 dragonfly) osname=dragonfly
3491                         osvers="$3"
3492                         ;;
3493                 dynixptx*) osname=dynixptx
3494                         osvers=`echo "$4"|sed 's/^v//'`
3495                         ;;
3496                 freebsd) osname=freebsd
3497                         osvers="$3" ;;
3498                 genix)  osname=genix ;;
3499                 gnu)    osname=gnu
3500                         osvers="$3" ;;
3501                 hp*)    osname=hpux
3502                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3503                         ;;
3504                 irix*)  osname=irix
3505                         case "$3" in
3506                         4*) osvers=4 ;;
3507                         5*) osvers=5 ;;
3508                         *)      osvers="$3" ;;
3509                         esac
3510                         ;;
3511                 linux)  osname=linux
3512                         case "$3" in
3513                         *)      osvers="$3" ;;
3514                         esac
3515                         $test -f /system/lib/libandroid.so && osname=linux-android
3516                         ;;
3517                 MiNT)   osname=mint
3518                         ;;
3519                 netbsd*) osname=netbsd
3520                         osvers="$3"
3521                         ;;
3522                 news-os) osvers="$3"
3523                         case "$3" in
3524                         4*) osname=newsos4 ;;
3525                         *) osname=newsos ;;
3526                         esac
3527                         ;;
3528                 nonstop-ux) osname=nonstopux ;;
3529                 openbsd) osname=openbsd
3530                         osvers="$3"
3531                         ;;
3532                 os2)    osname=os2
3533                         osvers="$4"
3534                         ;;
3535                 POSIX-BC | posix-bc ) osname=posix-bc
3536                         osvers="$3"
3537                         ;;
3538                 powerux | power_ux | powermax_os | powermaxos | \
3539                 powerunix | power_unix) osname=powerux
3540                         osvers="$3"
3541                         ;;
3542                 qnx) osname=qnx
3543                         osvers="$4"
3544                         ;;
3545                 solaris) osname=solaris
3546                         case "$3" in
3547                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3548                         *)      osvers="$3" ;;
3549                         esac
3550                         ;;
3551                 sunos) osname=sunos
3552                         case "$3" in
3553                         5*) osname=solaris
3554                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3555                         *)      osvers="$3" ;;
3556                         esac
3557                         ;;
3558                 titanos) osname=titanos
3559                         case "$3" in
3560                         1*) osvers=1 ;;
3561                         2*) osvers=2 ;;
3562                         3*) osvers=3 ;;
3563                         4*) osvers=4 ;;
3564                         *)      osvers="$3" ;;
3565                         esac
3566                         ;;
3567                 ultrix) osname=ultrix
3568                         osvers="$3"
3569                         ;;
3570                 osf1|mls+)      case "$5" in
3571                                 alpha)
3572                                         osname=dec_osf
3573                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3574                                         case "$osvers" in
3575                                         [1-9].[0-9]*) ;;
3576                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3577                                         esac
3578                                         ;;
3579                         hp*)    osname=hp_osf1  ;;
3580                         mips)   osname=mips_osf1 ;;
3581                         esac
3582                         ;;
3583                 # UnixWare 7.1.2 is known as Open UNIX 8
3584                 openunix|unixware) osname=svr5
3585                         osvers="$4"
3586                         ;;
3587                 uts)    osname=uts
3588                         osvers="$3"
3589                         ;;
3590                 vos) osvers="$3"
3591                         ;;
3592                 $2) case "$osname" in
3593                         *isc*) ;;
3594                         *freebsd*) ;;
3595                         svr*)
3596                                 : svr4.x or possibly later
3597                                 case "svr$3" in
3598                                 ${osname}*)
3599                                         osname=svr$3
3600                                         osvers=$4
3601                                         ;;
3602                                 esac
3603                                 case "$osname" in
3604                                 svr4.0)
3605                                         : Check for ESIX
3606                                         if test -f /stand/boot ; then
3607                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3608                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3609                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3610                                                         if test -n "$isesix"; then
3611                                                                 osname=esix4
3612                                                         fi
3613                                                 fi
3614                                         fi
3615                                         ;;
3616                                 esac
3617                                 ;;
3618                         *)      if test -f /etc/systemid; then
3619                                         osname=sco
3620                                         set `echo $3 | $sed 's/\./ /g'` $4
3621                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3622                                                 osvers=$1.$2.$3
3623                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3624                                                 osvers=$1.$2
3625                                         elif $test -f $src/hints/sco_$1.sh; then
3626                                                 osvers=$1
3627                                         fi
3628                                 else
3629                                         case "$osname" in
3630                                         '') : Still unknown.  Probably a generic Sys V.
3631                                                 osname="sysv"
3632                                                 osvers="$3"
3633                                                 ;;
3634                                         esac
3635                                 fi
3636                                 ;;
3637                         esac
3638                         ;;
3639                 *)      case "$osname" in
3640                         '') : Still unknown.  Probably a generic BSD.
3641                                 osname="$1"
3642                                 osvers="$3"
3643                                 ;;
3644                         esac
3645                         ;;
3646                 esac
3647         else
3648                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3649                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3650                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3651                                 osname=news_os
3652                         fi
3653                         $rm -f UU/kernel.what
3654                 elif test -d c:/. -o -n "$is_os2" ; then
3655                         set X $myuname
3656                         osname=os2
3657                         osvers="$5"
3658                 fi
3659         fi
3660
3661         case "$targetarch" in
3662         '') ;;
3663         *)  hostarch=$osname
3664             case "$targetarch" in
3665                 nto*|*-nto-*)
3666                     # Will load qnx.sh, which should change osname to nto
3667                     osname=qnx
3668                     osvers=''
3669                     ;;
3670                 *linux-android*)
3671                     # Catch arm-linux-androideabi, mipsel-linux-android,
3672                     # and i686-linux-android
3673                     osname=linux-android
3674                     osvers=''
3675                     ;;
3676                 *linux*)
3677                     # Something like arm-linux-gnueabihf is really just
3678                     # plain linux.
3679                     osname=linux
3680                     osvers=''
3681                     ;;
3682                 *solaris*|*sunos*)
3683                     osname=solaris
3684                     # XXX perhaps we should just assume
3685                     # osvers to be 2, or maybe take the value
3686                     # from targetarch. Using $run before the
3687                     # hints are run is somewhat icky.
3688                     set X `$run $uname -a 2>/dev/null`
3689                     shift
3690                     case "$3" in
3691                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3692                         *)  osvers="$3" ;;
3693                     esac
3694                     ;;
3695                 *)
3696                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3697                     osvers=''
3698                 ;;
3699             esac
3700             ;;
3701         esac
3702
3703         : Now look for a hint file osname_osvers, unless one has been
3704         : specified already.
3705         case "$hintfile" in
3706         ''|' ')
3707                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3708                 : Also try without trailing minor version numbers.
3709                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3710                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3711                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3712                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3713                 case "$file" in
3714                 '') dflt=none ;;
3715                 *)  case "$osvers" in
3716                         '') dflt=$file
3717                                 ;;
3718                         *)  if $test -f $src/hints/$file.sh ; then
3719                                         dflt=$file
3720                                 elif $test -f $src/hints/$xfile.sh ; then
3721                                         dflt=$xfile
3722                                 elif $test -f $src/hints/$xxfile.sh ; then
3723                                         dflt=$xxfile
3724                                 elif $test -f $src/hints/$xxxfile.sh ; then
3725                                         dflt=$xxxfile
3726                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3727                                         dflt=$xxxxfile
3728                                 elif $test -f "$src/hints/${osname}.sh" ; then
3729                                         dflt="${osname}"
3730                                 else
3731                                         dflt=none
3732                                 fi
3733                                 ;;
3734                         esac
3735                         ;;
3736                 esac
3737                 if $test -f Policy.sh ; then
3738                         case "$dflt" in
3739                         *Policy*) ;;
3740                         none) dflt="Policy" ;;
3741                         *) dflt="Policy $dflt" ;;
3742                         esac
3743                 fi
3744                 ;;
3745         *)
3746                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3747                 ;;
3748         esac
3749
3750         if $test -f Policy.sh ; then
3751                 $cat <<EOM
3752
3753 There's also a Policy hint file available, which should make the
3754 site-specific (policy) questions easier to answer.
3755 EOM
3756
3757         fi
3758
3759         $cat <<EOM
3760
3761 You may give one or more space-separated answers, or "none" if appropriate.
3762 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3763 previous run of Configure, you may specify it as well as or instead of
3764 OS-specific hints.  If hints are provided for your OS, you should use them:
3765 although Perl can probably be built without hints on many platforms, using
3766 hints often improve performance and may enable features that Configure can't
3767 set up on its own. If there are no hints that match your OS, specify "none";
3768 DO NOT give a wrong version or a wrong OS.
3769
3770 EOM
3771
3772         rp="Which of these apply, if any?"
3773         . UU/myread
3774         tans=$ans
3775         for file in $tans; do
3776                 if $test X$file = XPolicy -a -f Policy.sh; then
3777                         . Policy.sh
3778                         $cat Policy.sh >> UU/config.sh
3779                 elif $test -f $src/hints/$file.sh; then
3780                         . $src/hints/$file.sh
3781                         $cat $src/hints/$file.sh >> UU/config.sh
3782                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3783                         : nothing
3784                 else
3785                         : Give one chance to correct a possible typo.
3786                         echo "$file.sh does not exist"
3787                         dflt=$file
3788                         rp="hint to use instead?"
3789                         . UU/myread
3790                         for file in $ans; do
3791                                 if $test -f "$src/hints/$file.sh"; then
3792                                         . $src/hints/$file.sh
3793                                         $cat $src/hints/$file.sh >> UU/config.sh
3794                                 elif $test X$ans = X -o X$ans = Xnone ; then
3795                                         : nothing
3796                                 else
3797                                         echo "$file.sh does not exist -- ignored."
3798                                 fi
3799                         done
3800                 fi
3801         done
3802
3803         hint=recommended
3804         : Remember our hint file for later.
3805         if $test -f "$src/hints/$file.sh" ; then
3806                 hintfile="$file"
3807         else
3808                 hintfile=''
3809         fi
3810 fi
3811 cd UU
3812 ;;
3813 *)
3814         echo " "
3815         echo "Fetching default answers from $config_sh..." >&4
3816         tmp_n="$n"
3817         tmp_c="$c"
3818         cd ..
3819         cp $config_sh config.sh 2>/dev/null
3820         chmod +w config.sh
3821         . ./config.sh
3822         cd UU
3823         cp ../config.sh .
3824         n="$tmp_n"
3825         c="$tmp_c"
3826         hint=previous
3827         ;;
3828 esac
3829 . ./optdef.sh
3830
3831 : Restore computed paths
3832 for file in $loclist $trylist; do
3833         eval $file="\$_$file"
3834 done
3835
3836 cat << EOM
3837
3838 Configure uses the operating system name and version to set some defaults.
3839 The default value is probably right if the name rings a bell. Otherwise,
3840 since spelling matters for me, either accept the default or answer "none"
3841 to leave it blank.
3842
3843 EOM
3844 case "$osname" in
3845         ''|' ')
3846                 case "$hintfile" in
3847                 ''|' '|none) dflt=none ;;
3848                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3849                 esac
3850                 ;;
3851         *) dflt="$osname" ;;
3852 esac
3853 rp="Operating system name?"
3854 . ./myread
3855 case "$ans" in
3856 none)  osname='' ;;
3857 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3858 esac
3859 echo " "
3860 case "$osvers" in
3861         ''|' ')
3862                 case "$hintfile" in
3863                 ''|' '|none) dflt=none ;;
3864                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3865                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3866                         case "$dflt" in
3867                         ''|' ') dflt=none ;;
3868                         esac
3869                         ;;
3870                 esac
3871                 ;;
3872         *) dflt="$osvers" ;;
3873 esac
3874 rp="Operating system version?"
3875 . ./myread
3876 case "$ans" in
3877 none)  osvers='' ;;
3878 *) osvers="$ans" ;;
3879 esac
3880
3881
3882 . ./posthint.sh
3883
3884 : who configured the system
3885 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3886 case "$cf_by" in
3887 "")
3888         cf_by=`(logname) 2>/dev/null`
3889         case "$cf_by" in
3890         "")
3891                 cf_by=`(whoami) 2>/dev/null`
3892                 case "$cf_by" in
3893                 "") cf_by=unknown ;;
3894                 esac ;;
3895         esac ;;
3896 esac
3897
3898 : decide how portable to be.  Allow command line overrides.
3899 case "$d_portable" in
3900 "$undef") ;;
3901 *)      d_portable="$define" ;;
3902 esac
3903
3904 : set up shell script to do ~ expansion
3905 cat >filexp <<EOSS
3906 $startsh
3907 : expand filename
3908 case "\$1" in
3909  \~/*|\~)
3910         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3911         ;;
3912  \~*)
3913         if $test -f /bin/csh; then
3914                 /bin/csh -f -c "glob \$1"
3915                 failed=\$?
3916                 echo ""
3917                 exit \$failed
3918         else
3919                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3920                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3921                 if $test ! -d "\$dir"; then
3922                         me=\`basename \$0\`
3923                         echo "\$me: can't locate home directory for: \$name" >&2
3924                         exit 1
3925                 fi
3926                 case "\$1" in
3927                 */*)
3928                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3929                         ;;
3930                 *)
3931                         echo \$dir
3932                         ;;
3933                 esac
3934         fi
3935         ;;
3936 *)
3937         echo \$1
3938         ;;
3939 esac
3940 EOSS
3941 chmod +x filexp
3942 $eunicefix filexp
3943
3944 : now set up to get a file name
3945 cat <<EOS >getfile
3946 $startsh
3947 EOS
3948 cat <<'EOSC' >>getfile
3949 tilde=''
3950 fullpath=''
3951 already=''
3952 skip=''
3953 none_ok=''
3954 exp_file=''
3955 nopath_ok=''
3956 orig_rp="$rp"
3957 orig_dflt="$dflt"
3958 case "$gfpth" in
3959 '') gfpth='.' ;;
3960 esac
3961
3962 case "$fn" in
3963 *\(*)
3964         : getfile will accept an answer from the comma-separated list
3965         : enclosed in parentheses even if it does not meet other criteria.
3966         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3967         fn=`echo $fn | sed 's/(.*)//'`
3968         ;;
3969 esac
3970
3971 case "$fn" in
3972 *:*)
3973         loc_file=`expr $fn : '.*:\(.*\)'`
3974         fn=`expr $fn : '\(.*\):.*'`
3975         ;;
3976 esac
3977
3978 case "$fn" in
3979 *~*) tilde=true;;
3980 esac
3981 case "$fn" in
3982 */*) fullpath=true;;
3983 esac
3984 case "$fn" in
3985 *+*) skip=true;;
3986 esac
3987 case "$fn" in
3988 *n*) none_ok=true;;
3989 esac
3990 case "$fn" in
3991 *e*) exp_file=true;;
3992 esac
3993 case "$fn" in
3994 *p*) nopath_ok=true;;
3995 esac
3996
3997 case "$fn" in
3998 *f*) type='File';;
3999 *d*) type='Directory';;
4000 *l*) type='Locate';;
4001 esac
4002
4003 what="$type"
4004 case "$what" in
4005 Locate) what='File';;
4006 esac
4007
4008 case "$exp_file" in
4009 '')
4010         case "$d_portable" in
4011         "$define") ;;
4012         *) exp_file=true;;
4013         esac
4014         ;;
4015 esac
4016
4017 cd ..
4018 while test "$type"; do
4019         redo=''
4020         rp="$orig_rp"
4021         dflt="$orig_dflt"
4022         case "$tilde" in
4023         true) rp="$rp (~name ok)";;
4024         esac
4025         . UU/myread
4026         if test -f UU/getfile.ok && \
4027                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4028         then
4029                 value="$ans"
4030                 ansexp="$ans"
4031                 break
4032         fi
4033         case "$ans" in
4034         none)
4035                 value=''
4036                 ansexp=''
4037                 case "$none_ok" in
4038                 true) type='';;
4039                 esac
4040                 ;;
4041         *)
4042                 case "$tilde" in
4043                 '') value="$ans"
4044                         ansexp="$ans";;
4045                 *)
4046                         value=`UU/filexp $ans`
4047                         case $? in
4048                         0)
4049                                 if test "$ans" != "$value"; then
4050                                         echo "(That expands to $value on this system.)"
4051                                 fi
4052                                 ;;
4053                         *) value="$ans";;
4054                         esac
4055                         ansexp="$value"
4056                         case "$exp_file" in
4057                         '') value="$ans";;
4058                         esac
4059                         ;;
4060                 esac
4061                 case "$fullpath" in
4062                 true)
4063                         case "$ansexp" in
4064                         /*) value="$ansexp" ;;
4065                         [a-zA-Z]:/*) value="$ansexp" ;;
4066                         *)
4067                                 redo=true
4068                                 case "$already" in
4069                                 true)
4070                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4071                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4072                                         ;;
4073                                 *)
4074                                 echo "Please give a full path name, starting with slash." >&4
4075                                         case "$tilde" in
4076                                         true)
4077                                 echo "Note that using ~name is ok provided it expands well." >&4
4078                                                 already=true
4079                                                 ;;
4080                                         esac
4081                                 esac
4082                                 ;;
4083                         esac
4084                         ;;
4085                 esac
4086                 case "$redo" in
4087                 '')
4088                         case "$type" in
4089                         File)
4090                                 for fp in $gfpth; do
4091                                         if test "X$fp" = X.; then
4092                                             pf="$ansexp"
4093                                         else    
4094                                             pf="$fp/$ansexp"
4095                                         fi
4096                                         if test -f "$pf"; then
4097                                                 type=''
4098                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4099                                         then
4100                                                 echo "($value is not a plain file, but that's ok.)"
4101                                                 type=''
4102                                         fi
4103                                         if test X"$type" = X; then
4104                                             value="$pf"
4105                                             break
4106                                         fi
4107                                 done
4108                                 ;;
4109                         Directory)
4110                                 for fp in $gfpth; do
4111                                         if test "X$fp" = X.; then
4112                                             dir="$ans"
4113                                             direxp="$ansexp"
4114                                         else    
4115                                             dir="$fp/$ansexp"
4116                                             direxp="$fp/$ansexp"
4117                                         fi
4118                                         if test -d "$direxp"; then
4119                                                 type=''
4120                                                 value="$dir"
4121                                                 break
4122                                         fi
4123                                 done
4124                                 ;;
4125                         Locate)
4126                                 if test -d "$ansexp"; then
4127                                         echo "(Looking for $loc_file in directory $value.)"
4128                                         value="$value/$loc_file"
4129                                         ansexp="$ansexp/$loc_file"
4130                                 fi
4131                                 if test -f "$ansexp"; then
4132                                         type=''
4133                                 fi
4134                                 case "$nopath_ok" in
4135                                 true)   case "$value" in
4136                                         */*) ;;
4137                                         *)      echo "Assuming $value will be in people's path."
4138                                                 type=''
4139                                                 ;;
4140                                         esac
4141                                         ;;
4142                                 esac
4143                                 ;;
4144                         esac
4145
4146                         case "$skip" in
4147                         true) type='';
4148                         esac
4149
4150                         case "$type" in
4151                         '') ;;
4152                         *)
4153                                 if test "$fastread" = yes; then
4154                                         dflt=y
4155                                 else
4156                                         dflt=n
4157                                 fi
4158                                 rp="$what $value doesn't exist.  Use that name anyway?"
4159                                 . UU/myread
4160                                 dflt=''
4161                                 case "$ans" in
4162                                 y*) type='';;
4163                                 *) echo " ";;
4164                                 esac
4165                                 ;;
4166                         esac
4167                         ;;
4168                 esac
4169                 ;;
4170         esac
4171 done
4172 cd UU
4173 ans="$value"
4174 rp="$orig_rp"
4175 dflt="$orig_dflt"
4176 rm -f getfile.ok
4177 test "X$gfpthkeep" != Xy && gfpth=""
4178 EOSC
4179
4180 : determine root of directory hierarchy where package will be installed.
4181 case "$prefix" in
4182 '')
4183         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4184         ;;
4185 *?/)
4186         dflt=`echo "$prefix" | sed 's/.$//'`
4187         ;;
4188 *)
4189         dflt="$prefix"
4190         ;;
4191 esac
4192 $cat <<EOM
4193
4194 By default, $package will be installed in $dflt/bin, manual pages
4195 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4196 installation directories. Typically this is something like /usr/local.
4197 If you wish to have binaries under /usr/bin but other parts of the
4198 installation under /usr/local, that's ok: you will be prompted
4199 separately for each of the installation directories, the prefix being
4200 only used to set the defaults.
4201
4202 EOM
4203 fn=d~
4204 rp='Installation prefix to use?'
4205 . ./getfile
4206 oldprefix=''
4207 case "$prefix" in
4208 '') ;;
4209 *)
4210         case "$ans" in
4211         "$prefix") ;;
4212         *) oldprefix="$prefix";;
4213         esac
4214         ;;
4215 esac
4216 prefix="$ans"
4217 prefixexp="$ansexp"
4218
4219 : allow them to override the AFS root
4220 case "$afsroot" in
4221 '')     afsroot=/afs ;;
4222 *)      afsroot=$afsroot ;;
4223 esac
4224
4225 : is AFS running?
4226 echo " "
4227 case "$afs" in
4228 $define|true)   afs=true ;;
4229 $undef|false)   afs=false ;;
4230 *)      if $test -d $afsroot; then
4231                 afs=true
4232         else
4233                 afs=false
4234         fi
4235         ;;
4236 esac
4237 if $afs; then
4238         echo "AFS may be running... I'll be extra cautious then..." >&4
4239 else
4240         echo "AFS does not seem to be running..." >&4
4241 fi
4242
4243 : determine installation prefix for where package is to be installed.
4244 if $afs; then
4245 $cat <<EOM
4246
4247 Since you are running AFS, I need to distinguish the directory in which
4248 files will reside from the directory in which they are installed (and from
4249 which they are presumably copied to the former directory by occult means).
4250
4251 EOM
4252         case "$installprefix" in
4253         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4254         *) dflt="$installprefix";;
4255         esac
4256 else
4257 $cat <<EOM
4258
4259 In some special cases, particularly when building $package for distribution,
4260 it is convenient to distinguish the directory in which files should be
4261 installed from the directory ($prefix) in which they will
4262 eventually reside.  For most users, these two directories are the same.
4263
4264 EOM
4265         case "$installprefix" in
4266         '') dflt=$prefix ;;
4267         *) dflt=$installprefix;;
4268         esac
4269 fi
4270 fn=d~
4271 rp='What installation prefix should I use for installing files?'
4272 . ./getfile
4273 installprefix="$ans"
4274 installprefixexp="$ansexp"
4275
4276 : Perform the prefixexp/installprefixexp correction if necessary
4277 cat <<EOS >installprefix
4278 $startsh
4279 EOS
4280 cat <<'EOSC' >>installprefix
4281 : Change installation prefix, if necessary.
4282 if $test X"$prefix" != X"$installprefix"; then
4283     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4284 else
4285     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4286 fi
4287 EOSC
4288 chmod +x installprefix
4289 $eunicefix installprefix
4290
4291 : Set variables such as privlib and privlibexp from the output of ./getfile
4292 : performing the prefixexp/installprefixexp correction if necessary.
4293 cat <<EOS >setprefixvar
4294 $startsh
4295 EOS
4296 cat <<'EOSC' >>setprefixvar
4297 eval "${prefixvar}=\"\$ans\""
4298 eval "${prefixvar}exp=\"\$ansexp\""
4299 . ./installprefix
4300 EOSC
4301 chmod +x setprefixvar
4302 $eunicefix setprefixvar
4303
4304 : set up the script used to warn in case of inconsistency
4305 cat <<EOS >whoa
4306 $startsh
4307 EOS
4308 cat <<'EOSC' >>whoa
4309 dflt=y
4310 case "$hint" in
4311     recommended)
4312         case "$hintfile" in
4313         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4314                 ;;
4315         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4316                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4317                 ;;
4318         esac
4319         ;;
4320     *)  echo " "
4321         echo "*** WHOA THERE!!! ***" >&4
4322         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4323         ;;
4324 esac
4325 rp="    Keep the $hint value?"
4326 . ./myread
4327 case "$ans" in
4328 y) td=$was; tu=$was;;
4329 esac
4330 EOSC
4331
4332 : function used to set '$1' to '$val'
4333 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4334 case "$val$was" in
4335 $define$undef) . ./whoa; eval "$var=\$td";;
4336 $undef$define) . ./whoa; eval "$var=\$tu";;
4337 *) eval "$var=$val";;
4338 esac'
4339
4340 : get the patchlevel
4341 echo " "
4342 echo "Getting the current patchlevel..." >&4
4343 if $test -r $rsrc/patchlevel.h;then
4344         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4345         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4346         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4347         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4348         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4349         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4350         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4351 else
4352         revision=0
4353         patchlevel=0
4354         subversion=0
4355         api_revision=0
4356         api_version=0
4357         api_subversion=0
4358         perl_patchlevel=0
4359         $echo "(You do not have patchlevel.h.  Eek.)"
4360 fi
4361 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4362 version_patchlevel_string="version $patchlevel subversion $subversion"
4363 case "$perl_patchlevel" in
4364 0|'') ;;
4365 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4366     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4367     ;;
4368 esac
4369
4370 $echo "(You have $package $version_patchlevel_string.)"
4371
4372 case "$osname" in
4373 dos|vms)
4374         : XXX Should be a Configure test for double-dots in filenames.
4375         version=`echo $revision $patchlevel $subversion | \
4376                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4377         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4378                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4379         ;;
4380 *)
4381         version=`echo $revision $patchlevel $subversion | \
4382                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4383         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4384                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4385         ;;
4386 esac
4387 : Special case the 5.005_xx maintenance series, which used 5.005
4388 : without any subversion label as a subdirectory in $sitelib
4389 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4390         api_versionstring='5.005'
4391 fi
4392
4393 : Do we want threads support and if so, what type
4394 case "$usethreads" in
4395 $define|true|[yY]*)     dflt='y';;
4396 *)     # Catch case where user specified ithreads or 5005threads but
4397        # forgot -Dusethreads (A.D. 4/2002)
4398        case "$useithreads$use5005threads" in
4399        *$define*)       dflt='y';;
4400        *)               dflt='n';;
4401        esac
4402        ;;
4403 esac
4404 cat <<EOM
4405
4406 Perl can be built to offer a form of threading support on some systems
4407 To do so, Configure can be run with -Dusethreads.
4408
4409 Note that Perl built with threading support runs slightly slower
4410 and uses slightly more memory than plain Perl.
4411
4412 If this doesn't make any sense to you, just accept the default '$dflt'.
4413 EOM
4414 rp='Build a threading Perl?'
4415 . ./myread
4416 case "$ans" in
4417 y|Y)    val="$define" ;;
4418 *)      val="$undef" ;;
4419 esac
4420 set usethreads
4421 eval $setvar
4422
4423 if $test $patchlevel -lt 9; then
4424     case "$usethreads" in
4425     $define)
4426         : Default to ithreads unless overridden on command line or with
4427         : old config.sh
4428         dflt='y'
4429         case "$use5005threads" in
4430                 $define|true|[yY]*)
4431                         echo "5.005 threads are no longer supported"
4432                         exit 1
4433                 ;;
4434         esac
4435         case "$useithreads" in
4436                 $undef|false|[nN]*) dflt='n';;
4437         esac
4438         rp='Use the newer interpreter-based ithreads?'
4439         . ./myread
4440         case "$ans" in
4441         y|Y)    val="$define" ;;
4442         *)      val="$undef" ;;
4443         esac
4444         set useithreads
4445         eval $setvar
4446         : Now set use5005threads to the opposite value.
4447         case "$useithreads" in
4448         $define) val="$undef" ;;
4449         *) val="$define" ;;
4450         esac
4451         set use5005threads
4452         eval $setvar
4453         ;;
4454     *)
4455         useithreads="$undef"
4456         use5005threads="$undef"
4457         ;;
4458     esac
4459
4460     case "$useithreads$use5005threads" in
4461     "$define$define")
4462         $cat >&4 <<EOM
4463
4464 You cannot have both the ithreads and the 5.005 threads enabled
4465 at the same time.  Disabling the 5.005 threads since they are
4466 much less stable than the ithreads.
4467
4468 EOM
4469         use5005threads="$undef"
4470         ;;
4471     esac
4472
4473 else
4474 : perl-5.9.x and later
4475
4476     if test X"$usethreads" = "X$define"; then
4477         case "$use5005threads" in
4478             $define|true|[yY]*)
4479                 $cat >&4 <<EOM
4480
4481 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4482
4483 EOM
4484             ;;
4485         esac
4486     fi
4487
4488     use5005threads="$undef"
4489     useithreads="$usethreads"
4490 fi
4491
4492 case "$d_oldpthreads" in
4493 '')     : Configure tests would be welcome here.  For now, assume undef.
4494         val="$undef" ;;
4495 *)      val="$d_oldpthreads" ;;
4496 esac
4497 set d_oldpthreads
4498 eval $setvar
4499
4500
4501 : Look for a hint-file generated 'call-back-unit'.  If the
4502 : user has specified that a threading perl is to be built,
4503 : we may need to set or change some other defaults.
4504 if $test -f usethreads.cbu; then
4505     echo "Your platform has some specific hints regarding threaded builds, using them..."
4506     . ./usethreads.cbu
4507 else
4508     case "$usethreads" in
4509         "$define"|true|[yY]*)
4510                 $cat <<EOM
4511 (Your platform does not have any specific hints for threaded builds.
4512  Assuming POSIX threads, then.)
4513 EOM
4514         ;;
4515     esac
4516 fi
4517
4518 : Check if multiplicity is required
4519 cat <<EOM
4520
4521 Perl can be built so that multiple Perl interpreters can coexist
4522 within the same Perl executable.
4523 EOM
4524
4525 case "$useithreads" in
4526 $define)
4527         cat <<EOM
4528 This multiple interpreter support is required for interpreter-based threads.
4529 EOM
4530         val="$define"
4531         ;;
4532 *)      case "$usemultiplicity" in
4533         $define|true|[yY]*)     dflt='y';;
4534         *) dflt='n';;
4535         esac
4536         echo " "
4537         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4538         rp='Build Perl for multiplicity?'
4539         . ./myread
4540         case "$ans" in
4541         y|Y)    val="$define" ;;
4542         *)      val="$undef" ;;
4543         esac
4544         ;;
4545 esac
4546 set usemultiplicity
4547 eval $setvar
4548
4549 : Check if morebits is requested
4550 case "$usemorebits" in
4551 "$define"|true|[yY]*)
4552         use64bitint="$define"
4553         uselongdouble="$define"
4554         usemorebits="$define"
4555         ;;
4556 *)      usemorebits="$undef"
4557         ;;
4558 esac
4559
4560 : Determine the C compiler to be used
4561 echo " "
4562 case "$cc" in
4563 '') dflt=cc;;
4564 *) dflt="$cc";;
4565 esac
4566 rp="Use which C compiler?"
4567 . ./myread
4568 cc="$ans"
4569
4570 : See whether they have no cc but they do have gcc
4571 . ./trygcc
4572 if $test -f cc.cbu; then
4573     . ./cc.cbu
4574 fi
4575 . ./checkcc
4576
4577 : make some quick guesses about what we are up against
4578 echo " "
4579 $echo $n "Hmm...  $c"
4580 echo exit 1 >bsd
4581 echo exit 1 >usg
4582 echo exit 1 >v7
4583 echo exit 1 >osf1
4584 echo exit 1 >eunice
4585 echo exit 1 >xenix
4586 echo exit 1 >venix
4587 echo exit 1 >os2
4588 d_bsd="$undef"
4589 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4590 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4591 then
4592         echo "Looks kind of like an OSF/1 system, but we'll see..."
4593         echo exit 0 >osf1
4594 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4595         xxx=`./loc addbib blurfl $pth`
4596         if $test -f $xxx; then
4597         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4598                 echo exit 0 >bsd
4599                 echo exit 0 >usg
4600         else
4601                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4602                         echo "Looks kind of like an extended USG system, but we'll see..."
4603                 else
4604                         echo "Looks kind of like a USG system, but we'll see..."
4605                 fi
4606                 echo exit 0 >usg
4607         fi
4608 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4609         echo "Looks kind of like a BSD system, but we'll see..."
4610         d_bsd="$define"
4611         echo exit 0 >bsd
4612 else
4613         echo "Looks kind of like a Version 7 system, but we'll see..."
4614         echo exit 0 >v7
4615 fi
4616 case "$eunicefix" in
4617 *unixtovms*)
4618         $cat <<'EOI'
4619 There is, however, a strange, musty smell in the air that reminds me of
4620 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4621 EOI
4622         echo exit 0 >eunice
4623         d_eunice="$define"
4624 : it so happens the Eunice I know will not run shell scripts in Unix format
4625         ;;
4626 *)
4627         echo " "
4628         echo "Congratulations.  You aren't running Eunice."
4629         d_eunice="$undef"
4630         ;;
4631 esac
4632 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4633 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4634 : semicolon as a patch separator
4635 case "$p_" in
4636 :) ;;
4637 *)
4638         $cat <<'EOI'
4639 I have the feeling something is not exactly right, however...don't tell me...
4640 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4641 (Or you may be running DOS with DJGPP.)
4642 EOI
4643         echo exit 0 >os2
4644         ;;
4645 esac
4646 if test -f /xenix; then
4647         echo "Actually, this looks more like a XENIX system..."
4648         echo exit 0 >xenix
4649         d_xenix="$define"
4650 else
4651         echo " "
4652         echo "It's not Xenix..."
4653         d_xenix="$undef"
4654 fi
4655 chmod +x xenix
4656 $eunicefix xenix
4657 if test -f /venix; then
4658         echo "Actually, this looks more like a VENIX system..."
4659         echo exit 0 >venix
4660 else
4661         echo " "
4662         if ./xenix; then
4663                 : null
4664         else
4665                 echo "Nor is it Venix..."
4666         fi
4667 fi
4668 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4669 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4670 $rm -f foo
4671
4672 : Check if we are using GNU gcc and what its version is
4673 echo " "
4674 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4675 $cat >try.c <<EOM
4676 #include <stdio.h>
4677 int main() {
4678 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4679 #ifdef __VERSION__
4680         printf("%s\n", __VERSION__);
4681 #else
4682         printf("%s\n", "1");
4683 #endif
4684 #endif
4685         return(0);
4686 }
4687 EOM
4688 if $cc -o try $ccflags $ldflags try.c; then
4689         gccversion=`$run ./try`
4690         case "$gccversion" in
4691         '') echo "You are not using GNU cc." ;;
4692         *)  echo "You are using GNU cc $gccversion."
4693             ccname=gcc
4694             ;;
4695         esac
4696 else
4697         echo " "
4698         echo "*** WHOA THERE!!! ***" >&4
4699         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4700         case "$knowitall" in
4701         '')
4702         echo "    You'd better start hunting for one and let me know about it." >&4
4703                 exit 1
4704                 ;;
4705         esac
4706 fi
4707 $rm -f try try.*
4708 case "$gccversion" in
4709 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4710 esac
4711 case "$gccversion" in
4712 '') gccosandvers='' ;;
4713 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4714    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4715    gccshortvers=''
4716    case "$gccosandvers" in
4717    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4718    $osname$osvers) ;; # looking good
4719    $osname*) cat <<EOM >&4
4720
4721 *** WHOA THERE!!! ***
4722
4723     Your gcc has not been compiled for the exact release of
4724     your operating system ($gccosandvers versus $osname$osvers).
4725
4726     In general it is a good idea to keep gcc synchronized with
4727     the operating system because otherwise serious problems
4728     may ensue when trying to compile software, like Perl.
4729
4730     I'm trying to be optimistic here, though, and will continue.
4731     If later during the configuration and build icky compilation
4732     problems appear (headerfile conflicts being the most common
4733     manifestation), I suggest reinstalling the gcc to match
4734     your operating system release.
4735
4736 EOM
4737       ;;
4738    *) gccosandvers='' ;; # failed to parse, better be silent
4739    esac
4740    ;;
4741 esac
4742 case "$ccname" in
4743 '') ccname="$cc" ;;
4744 esac
4745
4746 # gcc 3.* complain about adding -Idirectories that they already know about,
4747 # so we will take those off from locincpth.
4748 case "$gccversion" in
4749 3*)
4750     echo "main(){}">try.c
4751     for incdir in $locincpth; do
4752        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4753              grep '^c[cp]p*[01]: warning: changing search order '`
4754        if test "X$warn" != X; then
4755            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4756        fi
4757     done
4758     $rm -f try try.*
4759 esac
4760
4761 # gcc 4.9 by default does some optimizations that break perl.
4762 # see ticket 121505.
4763 #
4764 # The -fwrapv disables those optimizations (and probably others,) so
4765 # for gcc 4.9 (and later, since the optimizations probably won't go
4766 # away), add -fwrapv unless the user requests -fno-wrapv, which
4767 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4768 # which turns the overflows -fwrapv ignores into runtime errors.
4769 case "$gccversion" in
4770 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4771     case "$ccflags" in
4772     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4773     *) ccflags="$ccflags -fwrapv" ;;
4774     esac
4775 esac
4776
4777 : What should the include directory be ?
4778 : Use sysroot if set, so findhdr looks in the right place.
4779 echo " "
4780 $echo $n "Hmm...  $c"
4781 dflt="$sysroot/usr/include"
4782 incpath=''
4783 mips_type=''
4784 if $test -f /bin/mips && /bin/mips; then
4785         echo "Looks like a MIPS system..."
4786         $cat >usr.c <<'EOCP'
4787 #ifdef SYSTYPE_BSD43
4788 /bsd43
4789 #endif
4790 EOCP
4791         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4792                 dflt='/bsd43/usr/include'
4793                 incpath='/bsd43'
4794                 mips_type='BSD 4.3'
4795         else
4796                 mips_type='System V'
4797         fi
4798         $rm -f usr.c usr.out
4799         echo "and you're compiling with the $mips_type compiler and libraries."
4800         xxx_prompt=y
4801         echo "exit 0" >mips
4802 else
4803         echo "Doesn't look like a MIPS system."
4804         xxx_prompt=n
4805         echo "exit 1" >mips
4806 fi
4807 chmod +x mips
4808 $eunicefix mips
4809 case "$usrinc" in
4810 '') ;;
4811 *) dflt="$usrinc";;
4812 esac
4813 case "$xxx_prompt" in
4814 y)      fn=d/
4815         echo " "
4816         rp='Where are the include files you want to use?'
4817         . ./getfile
4818         usrinc="$ans"
4819         ;;
4820 *)      usrinc="$dflt"
4821         ;;
4822 esac
4823
4824 : see how we invoke the C preprocessor
4825 echo " "
4826 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4827 cat <<'EOT' >testcpp.c
4828 #define ABC abc
4829 #define XYZ xyz
4830 ABC.XYZ
4831 EOT
4832 cd ..
4833 if test ! -f cppstdin; then
4834         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4835                 # AIX cc -E doesn't show the absolute headerfile
4836                 # locations but we'll cheat by using the -M flag.
4837                 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
4838         else
4839                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4840         fi
4841 else
4842         echo "Keeping your $hint cppstdin wrapper."
4843 fi
4844 chmod 755 cppstdin
4845 wrapper=`pwd`/cppstdin
4846 ok='false'
4847 cd UU
4848
4849 if $test "X$cppstdin" != "X" && \
4850         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4851         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4852 then
4853         echo "You used to use $cppstdin $cppminus so we'll use that again."
4854         case "$cpprun" in
4855         '') echo "But let's see if we can live without a wrapper..." ;;
4856         *)
4857                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4858                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4859                 then
4860                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4861                         ok='true'
4862                 else
4863                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4864                 fi
4865                 ;;
4866         esac
4867 else
4868         case "$cppstdin" in
4869         '') ;;
4870         *)
4871                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4872                 ;;
4873         esac
4874 fi
4875
4876 if $ok; then
4877         : nothing
4878 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4879         $cc -E <testcpp.c >testcpp.out 2>&1; \
4880         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4881         echo "Yup, it does."
4882         x_cpp="$cc $cppflags -E"
4883         x_minus='';
4884 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4885         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4886         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4887         echo "Yup, it does."
4888         x_cpp="$cc $cppflags -E"
4889         x_minus='-';
4890 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4891         $cc -P <testcpp.c >testcpp.out 2>&1; \
4892         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4893         echo "Yipee, that works!"
4894         x_cpp="$cc $cppflags -P"
4895         x_minus='';
4896 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4897         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4898         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4899         echo "At long last!"
4900         x_cpp="$cc $cppflags -P"
4901         x_minus='-';
4902 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4903         $cpp <testcpp.c >testcpp.out 2>&1; \
4904         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4905         echo "It works!"
4906         x_cpp="$cpp $cppflags"
4907         x_minus='';
4908 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4909         $cpp - <testcpp.c >testcpp.out 2>&1; \
4910         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4911         echo "Hooray, it works!  I was beginning to wonder."
4912         x_cpp="$cpp $cppflags"
4913         x_minus='-';
4914 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4915         $wrapper <testcpp.c >testcpp.out 2>&1; \
4916         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4917         x_cpp="$wrapper"
4918         x_minus=''
4919         echo "Eureka!"
4920 else
4921         dflt=''
4922         rp="No dice.  I can't find a C preprocessor.  Name one:"
4923         . ./myread
4924         x_cpp="$ans"
4925         x_minus=''
4926         $x_cpp <testcpp.c >testcpp.out 2>&1
4927         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4928                 echo "OK, that will do." >&4
4929         else
4930 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4931                 exit 1
4932         fi
4933 fi
4934
4935 case "$ok" in
4936 false)
4937         cppstdin="$x_cpp"
4938         cppminus="$x_minus"
4939         cpprun="$x_cpp"
4940         cpplast="$x_minus"
4941         set X $x_cpp
4942         shift
4943         case "$1" in
4944         "$cpp")
4945                 echo "Perhaps can we force $cc -E using a wrapper..."
4946                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4947                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4948                 then
4949                         echo "Yup, we can."
4950                         cppstdin="$wrapper"
4951                         cppminus='';
4952                 else
4953                         echo "Nope, we'll have to live without it..."
4954                 fi
4955                 ;;
4956         esac
4957         case "$cpprun" in
4958         "$wrapper")
4959                 cpprun=''
4960                 cpplast=''
4961                 ;;
4962         esac
4963         ;;
4964 esac
4965
4966 case "$cppstdin" in
4967 "$wrapper"|'cppstdin') ;;
4968 *) $rm -f $wrapper;;
4969 esac
4970 $rm -f testcpp.c testcpp.out
4971
4972 : Adjust cppfilter for path component separator
4973 case "$osname" in
4974 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4975 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4976 *)   cppfilter='' ;;
4977 esac
4978
4979 : Use gcc to determine libpth and incpth
4980 # If using gcc or clang, we can get better values for libpth, incpth
4981 # and usrinc directly from the compiler.
4982 # Note that ccname for clang is also gcc.
4983 case "$ccname" in
4984     gcc)
4985         $echo 'extern int foo;' > try.c
4986         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4987         shift
4988         if $test $# -gt 0; then
4989             incpth="$incpth $*"
4990             incpth="`$echo $incpth|$sed 's/^ //'`"
4991             for i in $*; do
4992                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4993                 if $test -d $j; then
4994                     libpth="$libpth $j"
4995                 fi
4996             done
4997             libpth="`$echo $libpth|$sed 's/^ //'`"
4998             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4999                 if $test -d $xxx; then
5000                     case " $libpth " in
5001                     *" $xxx "*) ;;
5002                     *) libpth="$libpth $xxx";;
5003                     esac
5004                 fi
5005             done
5006         fi
5007         $rm -f try.c
5008         case "$usrinc" in
5009         '') for i in $incpth; do
5010                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
5011                     usrinc="$i"
5012                     break
5013                 fi
5014             done
5015             ;;
5016         esac
5017
5018         case "$usecrosscompile" in
5019         $define|true|[yY]*)
5020             case "$incpth" in
5021                 '') echo "Incpth not defined." >&4; croak=y ;;
5022                 *)  echo "Using incpth '$incpth'." >&4 ;;
5023             esac
5024             case "$libpth" in
5025                 '') echo "Libpth not defined." >&4; croak=y ;;
5026                 *)  echo "Using libpth '$libpth'." >&4 ;;
5027             esac
5028             case "$usrinc" in
5029                 '') echo "Usrinc not defined." >&4; croak=y ;;
5030                 *)  echo "Using usrinc $usrinc." >&4 ;;
5031             esac
5032             case "$croak" in
5033                 y)
5034                 if test "X$sysroot" = X; then
5035                     echo "Cannot continue, aborting." >&4; exit 1
5036                 else
5037                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5038                 fi
5039                 ;;
5040             esac
5041             ;;
5042         esac
5043     ;;
5044 esac
5045
5046 : Default value for incpth is just usrinc
5047 case "$incpth" in
5048 '') incpth="$usrinc";;
5049 esac
5050
5051 : Set private lib path
5052 case "$plibpth" in
5053 '') if ./mips; then
5054         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5055     fi;;
5056 esac
5057 case "$libpth" in
5058 ' ') dlist='';;
5059 '') dlist="$loclibpth $plibpth $glibpth";;
5060 *) dlist="$libpth";;
5061 esac
5062
5063 : Now check and see which directories actually exist, avoiding duplicates
5064 for xxx in $dlist
5065 do
5066     if $test -d $xxx; then
5067                 case " $libpth " in
5068                 *" $xxx "*) ;;
5069                 *) libpth="$libpth $xxx";;
5070                 esac
5071     fi
5072 done
5073 $cat <<'EOM'
5074
5075 Some systems have incompatible or broken versions of libraries.  Among
5076 the directories listed in the question below, please remove any you
5077 know not to be holding relevant libraries, and add any that are needed.
5078 Say "none" for none.
5079
5080 EOM
5081
5082 if test "X$sysroot" != X; then
5083     $cat <<EOM
5084 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5085
5086 EOM
5087 fi
5088
5089 case "$libpth" in
5090 '') dflt='none';;
5091 *)
5092         set X $libpth
5093         shift
5094         dflt=${1+"$@"}
5095         ;;
5096 esac
5097 rp="Directories to use for library searches?"
5098 . ./myread
5099 case "$ans" in
5100 none) libpth=' ';;
5101 *) libpth="$ans";;
5102 esac
5103
5104 : compute shared library extension
5105 case "$so" in
5106 '')
5107         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5108                 dflt='sl'
5109         else
5110                 dflt='so'
5111         fi
5112         ;;
5113 *) dflt="$so";;
5114 esac
5115 $cat <<EOM
5116
5117 On some systems, shared libraries may be available.  Answer 'none' if
5118 you want to suppress searching of shared libraries for the remainder
5119 of this configuration.
5120
5121 EOM
5122 rp='What is the file extension used for shared libraries?'
5123 . ./myread
5124 so="$ans"
5125
5126 : Does target system insist that shared library basenames are unique
5127 $cat << EOM
5128
5129 Some dynamic loaders assume that the *basename* of shared library filenames
5130 are globally unique.  We'll default this to undef as we assume your system
5131 is not this weird. Set to defined if you're on one of them.
5132
5133 EOM
5134
5135 dflt='n'
5136 rp='Make shared library basenames unique?'
5137 . ./myread
5138 case "$ans" in
5139 y|Y) val="$define" ;;
5140 *)   val="$undef"  ;;
5141 esac
5142 set d_libname_unique
5143 eval $setvar
5144
5145 : Define several unixisms.
5146 : Hints files or command line option can be used to override them.
5147 : The convoluted testing is in case hints files set either the old
5148 : or the new name.
5149 case "$_exe" in
5150 '')     case "$exe_ext" in
5151         '')     ;;
5152         *)      _exe="$exe_ext" ;;
5153         esac
5154         ;;
5155 esac
5156 case "$_a" in
5157 '')     case "$lib_ext" in
5158     '') _a='.a';;
5159         *)      _a="$lib_ext" ;;
5160         esac
5161         ;;
5162 esac
5163 case "$_o" in
5164 '') case "$obj_ext" in
5165         '')     _o='.o';;
5166         *)      _o="$obj_ext";;
5167         esac
5168         ;;
5169 esac
5170 case "$p_" in
5171 '') case "$path_sep" in
5172         '')     p_=':';;
5173         *)      p_="$path_sep";;
5174         esac
5175         ;;
5176 esac
5177 exe_ext=$_exe
5178 lib_ext=$_a
5179 obj_ext=$_o
5180 path_sep=$p_
5181
5182 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5183
5184 : Which makefile gets called first.  This is used by make depend.
5185 case "$firstmakefile" in
5186 '') firstmakefile='makefile';;
5187 esac
5188
5189 : Check is we will use socks
5190 case "$usesocks" in
5191 $define|true|[yY]*)     dflt='y';;
5192 *) dflt='n';;
5193 esac
5194 cat <<EOM
5195
5196 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5197 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5198 to use the PerlIO abstraction layer, this will be implicitly selected.
5199
5200 If this doesn't make any sense to you, just accept the default '$dflt'.
5201 EOM
5202 rp='Build Perl for SOCKS?'
5203 . ./myread
5204 case "$ans" in
5205 y|Y)    val="$define" ;;
5206 *)      val="$undef" ;;
5207 esac
5208 set usesocks
5209 eval $setvar
5210
5211 : Check for uselongdouble support
5212 case "$ccflags" in
5213 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5214 esac
5215
5216 case "$uselongdouble" in
5217 $define|true|[yY]*)     dflt='y';;
5218 *) dflt='n';;
5219 esac
5220 cat <<EOM
5221
5222 Perl can be built to take advantage of long doubles which
5223 (if available) may give more accuracy and range for floating point numbers.
5224
5225 If this doesn't make any sense to you, just accept the default '$dflt'.
5226 EOM
5227 rp='Try to use long doubles if available?'
5228 . ./myread
5229 case "$ans" in
5230 y|Y)    val="$define"   ;;
5231 *)      val="$undef"    ;;
5232 esac
5233 set uselongdouble
5234 eval $setvar
5235
5236 case "$uselongdouble" in
5237 true|[yY]*) uselongdouble="$define" ;;
5238 esac
5239
5240 : Look for a hint-file generated 'call-back-unit'.  If the
5241 : user has specified that long doubles should be used,
5242 : we may need to set or change some other defaults.
5243 if $test -f uselongdouble.cbu; then
5244     echo "Your platform has some specific hints regarding long doubles, using them..."
5245     . ./uselongdouble.cbu
5246 else
5247     case "$uselongdouble" in
5248         $define)
5249                 $cat <<EOM
5250 (Your platform does not have any specific hints for long doubles.)
5251 EOM
5252         ;;
5253     esac
5254 fi
5255
5256 : Check if quadmath is requested
5257 case "$usequadmath" in
5258 "$define"|true|[yY]*) usequadmath="$define" ;;
5259 *)                    usequadmath="$undef"  ;;
5260 esac
5261
5262 : Fail if both uselongdouble and usequadmath are requested
5263 case "$usequadmath:$uselongdouble" in
5264 define:define)
5265         $cat <<EOM >&4
5266
5267 *** You requested the use of the quadmath library and use
5268 *** of long doubles.
5269 ***
5270 *** Please select one or the other.
5271 EOM
5272         exit 1
5273         ;;
5274 esac
5275
5276 : Looking for optional libraries
5277 echo " "
5278 echo "Checking for optional libraries..." >&4
5279 case "$libs" in
5280 ' '|'') dflt='';;
5281 *) dflt="$libs";;
5282 esac
5283 case "$libswanted" in
5284 '') libswanted='c_s';;
5285 esac
5286 case "$usesocks" in
5287 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5288 esac
5289 case "$usecbacktrace" in
5290 "$define") libswanted="$libswanted bfd" ;;
5291 esac
5292 case "$usequadmath" in
5293 "$define") libswanted="$libswanted quadmath" ;;
5294 esac
5295 libsfound=''
5296 libsfiles=''
5297 libsdirs=''
5298 libspath=''
5299 for thisdir in $libpth $xlibpth; do
5300   test -d $thisdir && libspath="$libspath $thisdir"
5301 done
5302 for thislib in $libswanted; do
5303         for thisdir in $libspath; do
5304             xxx=''
5305             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5306                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5307                 $test -f "$xxx" && eval $libscheck
5308                 $test -f "$xxx" && libstyle=shared
5309                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5310                 $test -f "$xxx" && eval $libscheck
5311                 $test -f "$xxx" && libstyle=shared
5312             fi
5313             if test ! -f "$xxx"; then
5314                 xxx=$thisdir/lib$thislib.$so
5315                 $test -f "$xxx" && eval $libscheck
5316                 $test -f "$xxx" && libstyle=shared
5317             fi
5318             if test ! -f "$xxx"; then
5319                 xxx=$thisdir/lib$thislib$_a
5320                 $test -f "$xxx" && eval $libscheck
5321                 $test -f "$xxx" && libstyle=static
5322             fi
5323             if test ! -f "$xxx"; then
5324                 xxx=$thisdir/$thislib$_a
5325                 $test -f "$xxx" && eval $libscheck
5326                 $test -f "$xxx" && libstyle=static
5327             fi
5328             if test ! -f "$xxx"; then
5329                 xxx=$thisdir/lib${thislib}_s$_a
5330                 $test -f "$xxx" && eval $libscheck
5331                 $test -f "$xxx" && libstyle=static
5332                 $test -f "$xxx" && thislib=${thislib}_s
5333             fi
5334             if test ! -f "$xxx"; then
5335                 xxx=$thisdir/Slib$thislib$_a
5336                 $test -f "$xxx" && eval $libscheck
5337                 $test -f "$xxx" && libstyle=static
5338             fi
5339             if $test -f "$xxx"; then
5340                 case "$libstyle" in
5341                 shared) echo "Found -l$thislib (shared)." ;;
5342                 static) echo "Found -l$thislib." ;;
5343                 *)      echo "Found -l$thislib ($libstyle)." ;;
5344                 esac
5345                 case " $dflt " in
5346                 *"-l$thislib "*);;
5347                 *) dflt="$dflt -l$thislib"
5348                    libsfound="$libsfound $xxx"
5349                    yyy=`basename $xxx`
5350                    libsfiles="$libsfiles $yyy"
5351                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5352                    case " $libsdirs " in
5353                    *" $yyy "*) ;;
5354                    *) libsdirs="$libsdirs $yyy" ;;
5355                    esac
5356                    ;;
5357                 esac
5358                 break
5359             fi
5360         done
5361         if $test ! -f "$xxx"; then
5362             echo "No -l$thislib."
5363         fi
5364 done
5365 set X $dflt
5366 shift
5367 dflt="$*"
5368 case "$libs" in
5369 '') dflt="$dflt";;
5370 *) dflt="$libs";;
5371 esac
5372 case "$dflt" in
5373 ' '|'') dflt='none';;
5374 esac
5375
5376 $cat <<EOM
5377
5378 In order to compile $package on your machine, a number of libraries
5379 are usually needed.  Include any other special libraries here as well.
5380 Say "none" for none.  The default list is almost always right.
5381 EOM
5382
5383 echo " "
5384 rp="What libraries to use?"
5385 . ./myread
5386 case "$ans" in
5387 none) libs=' ';;
5388 *) libs="$ans";;
5389 esac
5390
5391 : determine optimization, if desired, or use for debug flag also
5392 case "$optimize" in
5393 ' '|$undef) dflt='none';;
5394 '') dflt='-O';;
5395 *) dflt="$optimize";;
5396 esac
5397 $cat <<EOH
5398
5399 By default, $package compiles with the -O flag to use the optimizer.
5400 Alternately, you might want to use the symbolic debugger, which uses
5401 the -g flag (on traditional Unix systems).  Either flag can be
5402 specified here.  To use neither flag, specify the word "none".
5403
5404 EOH
5405 rp="What optimizer/debugger flag should be used?"
5406 . ./myread
5407 optimize="$ans"
5408 case "$optimize" in
5409 'none') optimize=" ";;
5410 esac
5411
5412 : Check what DEBUGGING is required from the command line
5413 : -DEBUGGING      or -DDEBUGGING or
5414 : -DEBUGGING=both                       = -g + -DDEBUGGING
5415 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5416 : -DEBUGGING=none or -UDEBUGGING        =
5417 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5418 case "$EBUGGING" in
5419 '')     ;;
5420 *)      DEBUGGING=$EBUGGING ;;
5421 esac
5422
5423 case "$DEBUGGING" in
5424 -g|both|$define)
5425     case "$optimize" in
5426         *-g*) ;;
5427         *)    optimize="$optimize -g" ;;
5428     esac ;;
5429 none|$undef)
5430     case "$optimize" in
5431         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5432                 shift
5433                 optimize="$*"
5434                 ;;
5435     esac ;;
5436 esac
5437
5438 dflt=''
5439 case "$DEBUGGING" in
5440 both|$define) dflt='-DDEBUGGING'
5441 esac
5442
5443 : argument order is deliberate, as the flag will start with - which set could
5444 : think is an option
5445 checkccflag='check=$1; flag=$2; callback=$3;
5446 echo " ";
5447 echo "Checking if your compiler accepts $flag" 2>&1;
5448 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5449 echo "int main(void) { return 0; }" > gcctest.c;
5450 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5451     echo "Yes, it does." 2>&1;
5452     if $test -s gcctest.out ; then
5453         echo "But your platform does not like it:";
5454         cat gcctest.out;
5455     else
5456         case "$ccflags" in
5457         *$check*)
5458             echo "Leaving current flags $ccflags alone." 2>&1
5459             ;;
5460         *) dflt="$dflt $flag";
5461             eval $callback
5462             ;;
5463         esac
5464     fi
5465 else
5466     echo "Nope, it does not, but that is ok." 2>&1;
5467 fi
5468 '
5469
5470 : We will not override a previous value, but we might want to
5471 : augment a hint file
5472 case "$hint" in
5473 default|recommended)
5474         case "$gccversion" in
5475         1*) dflt="$dflt -fpcc-struct-return" ;;
5476         esac
5477         case "$optimize:$DEBUGGING" in
5478         *-g*:old) dflt="$dflt -DDEBUGGING";;
5479         esac
5480         case "$gccversion" in
5481         2*) if $test -d /etc/conf/kconfig.d &&
5482                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5483                 then
5484                         # Interactive Systems (ISC) POSIX mode.
5485                         dflt="$dflt -posix"
5486                 fi
5487                 ;;
5488         esac
5489         case "$gccversion" in
5490         1*) ;;
5491         2.[0-8]*) ;;
5492         ?*)     set strict-aliasing -fno-strict-aliasing
5493                 eval $checkccflag
5494                 ;;
5495         esac
5496         # For gcc, adding -pipe speeds up compilations for some, but apparently
5497         # some assemblers can't read from stdin.  (It also slows down compilations
5498         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5499         case "$gccversion" in
5500         ?*)     set pipe -pipe
5501                 eval $checkccflag
5502                 ;;
5503         esac
5504
5505         # on x86_64 (at least) we require an extra library (libssp) in the
5506         # link command line. This library is not named, so I infer that it is
5507         # an implementation detail that may change. Hence the safest approach
5508         # is to add the flag to the flags passed to the compiler at link time,
5509         # as that way the compiler can do the right implementation dependant
5510         # thing. (NWC)
5511         case "$osname" in
5512         amigaos) ;; # -fstack-protector builds but doesn't work
5513         *)      case "$gccversion" in
5514                 ?*)     set stack-protector-strong -fstack-protector-strong
5515                         eval $checkccflag
5516                         case "$dflt" in
5517                         *-fstack-protector-strong*) ;; # It got added.
5518                         *) # Try the plain/older -fstack-protector.
5519                            set stack-protector -fstack-protector
5520                            eval $checkccflag
5521                            ;;
5522                         esac
5523                         ;;
5524                 esac
5525                 ;;
5526         esac
5527         ;;
5528 esac
5529
5530 case "$mips_type" in
5531 *BSD*|'') inclwanted="$locincpth $usrinc";;
5532 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5533 esac
5534 for thisincl in $inclwanted; do
5535         if $test -d $thisincl; then
5536                 if $test x$thisincl != x$usrinc; then
5537                         case "$dflt" in
5538                         *" -I$thisincl "*);;
5539                         *) dflt="$dflt -I$thisincl ";;
5540                         esac
5541                 fi
5542         fi
5543 done
5544
5545 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5546         xxx=true;
5547 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5548         xxx=true;
5549 else
5550         xxx=false;
5551 fi;
5552 if $xxx; then
5553         case "$dflt" in
5554         *$2*);;
5555         *) dflt="$dflt -D$2";;
5556         esac;
5557 fi'
5558
5559 set signal.h LANGUAGE_C; eval $inctest
5560
5561 case "$usesocks" in
5562 $define)
5563         ccflags="$ccflags -DSOCKS"
5564         ;;
5565 esac
5566
5567 case "$hint" in
5568 default|recommended) dflt="$ccflags $dflt" ;;
5569 *) dflt="$ccflags";;
5570 esac
5571
5572 case "$dflt" in
5573 ''|' ') dflt=none;;
5574 esac
5575
5576 $cat <<EOH
5577
5578 Your C compiler may want other flags.  For this question you should include
5579 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5580 but you should NOT include libraries or ld flags like -lwhatever.  If you
5581 want $package to honor its debug switch, you should include -DDEBUGGING here.
5582 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5583
5584 To use no flags, specify the word "none".
5585
5586 EOH
5587 set X $dflt
5588 shift
5589 dflt=${1+"$@"}
5590 rp="Any additional cc flags?"
5591 . ./myread
5592 case "$ans" in
5593 none) ccflags='';;
5594 *) ccflags="$ans";;
5595 esac
5596
5597 : the following weeds options from ccflags that are of no interest to cpp
5598 case "$cppflags" in
5599 '') cppflags="$ccflags" ;;
5600 *)  set X $ccflags; shift
5601     case " $cppflags " in
5602     *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5603     *) cppflags="$cppflags $ccflags" ;;
5604     esac
5605     ;;
5606 esac
5607 case "$gccversion" in
5608 1*) cppflags="$cppflags -D__GNUC__"
5609 esac
5610 case "$mips_type" in
5611 '');;
5612 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5613 esac
5614 case "$cppflags" in
5615 '');;
5616 *)
5617         echo " "
5618         echo "Let me guess what the preprocessor flags are..." >&4
5619         set X $cppflags
5620         shift
5621         cppflags=''
5622         $cat >cpp.c <<'EOM'
5623 #define BLURFL foo
5624
5625 BLURFL xx LFRULB
5626 EOM
5627         previous=''
5628         for flag in $*
5629         do
5630                 case "$flag" in
5631                 -*) ftry="$flag";;
5632                 *) ftry="$previous $flag";;
5633                 esac
5634                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5635                         >cpp1.out 2>/dev/null && \
5636                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5637                         >cpp2.out 2>/dev/null && \
5638                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5639                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5640                 then
5641                         cppflags="$cppflags $ftry"
5642                         previous=''
5643                 else
5644                         previous="$flag"
5645                 fi
5646         done
5647         set X $cppflags
5648         shift
5649         cppflags=${1+"$@"}
5650         case "$cppflags" in
5651         *-*)  echo "They appear to be: $cppflags";;
5652         esac
5653         $rm -f cpp.c cpp?.out
5654         ;;
5655 esac
5656
5657 : flags used in final linking phase
5658 case "$ldflags" in
5659 '') if ./venix; then
5660                 dflt='-i -z'
5661         else
5662                 dflt=''
5663         fi
5664         case "$ccflags" in
5665         *-posix*) dflt="$dflt -posix" ;;
5666         esac
5667         ;;
5668 *) dflt="$ldflags";;
5669 esac
5670 # See note above about -fstack-protector
5671 case "$ccflags" in
5672 *-fstack-protector-strong*)
5673         case "$dflt" in
5674         *-fstack-protector-strong*) ;; # Don't add it again
5675         *) dflt="$dflt -fstack-protector-strong" ;;
5676         esac
5677         ;;
5678 *-fstack-protector*)
5679         case "$dflt" in
5680         *-fstack-protector*) ;; # Don't add it again
5681         *) dflt="$dflt -fstack-protector" ;;
5682         esac
5683         ;;
5684 esac
5685
5686 : Try to guess additional flags to pick up local libraries.
5687 for thislibdir in $libpth; do
5688         case " $loclibpth " in
5689         *" $thislibdir "*)
5690                 case "$dflt " in
5691                 *"-L$thislibdir "*) ;;
5692                 *)  dflt="$dflt -L$thislibdir" ;;
5693                 esac
5694                 ;;
5695         esac
5696 done
5697
5698 case "$dflt" in
5699 '') dflt='none' ;;
5700 esac
5701
5702 $cat <<EOH
5703
5704 Your C linker may need flags.  For this question you should
5705 include -L/whatever and any other flags used by the C linker, but you
5706 should NOT include libraries like -lwhatever.
5707
5708 Make sure you include the appropriate -L/path flags if your C linker
5709 does not normally search all of the directories you specified above,
5710 namely
5711         $libpth
5712 To use no flags, specify the word "none".
5713
5714 EOH
5715
5716 rp="Any additional ld flags (NOT including libraries)?"
5717 . ./myread
5718 case "$ans" in
5719 none) ldflags='';;
5720 *) ldflags="$ans";;
5721 esac
5722 rmlist="$rmlist pdp11"
5723
5724 : coherency check
5725 echo " "
5726 echo "Checking your choice of C compiler and flags for coherency..." >&4
5727 $cat > try.c <<'EOF'
5728 #include <stdio.h>
5729 int main() { printf("Ok\n"); return(0); }
5730 EOF
5731 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5732 shift
5733 $cat >try.msg <<'EOM'
5734 I've tried to compile and run the following simple program:
5735
5736 EOM
5737 $cat try.c >> try.msg
5738
5739 $cat >> try.msg <<EOM
5740
5741 I used the command:
5742
5743         $*
5744         $run ./try
5745
5746 and I got the following output:
5747
5748 EOM
5749 dflt=y
5750 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5751         if $sh -c "$run ./try " >>try.msg 2>&1; then
5752                 xxx=`$run ./try`
5753                 case "$xxx" in
5754                 "Ok") dflt=n ;;
5755                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5756                 esac
5757         else
5758                 echo "The program compiled OK, but exited with status $?." >>try.msg
5759                 rp="You have a problem.  Shall I abort Configure"
5760                 dflt=y
5761         fi
5762 else
5763         echo "I can't compile the test program." >>try.msg
5764         rp="You have a BIG problem.  Shall I abort Configure"
5765         dflt=y
5766 fi
5767 case "$dflt" in
5768 y)
5769         $cat try.msg >&4
5770         case "$knowitall" in
5771         '')
5772                 echo "(The supplied flags or libraries might be incorrect.)"
5773                 ;;
5774         *) dflt=n;;
5775         esac
5776         echo " "
5777         . ./myread
5778         case "$ans" in
5779         n*|N*) ;;
5780         *)      echo "Ok.  Stopping Configure." >&4
5781                 exit 1
5782                 ;;
5783         esac
5784         ;;
5785 n) echo "OK, that should do.";;
5786 esac
5787 $rm_try gcctest gcctest.out
5788
5789 : define a shorthand compile call
5790 compile='
5791 mc_file=$1;
5792 shift;
5793 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5794 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5795 exit 1;
5796 fi;
5797 esac;
5798 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5799 : define a shorthand compile call for compilations that should be ok.
5800 compile_ok='
5801 mc_file=$1;
5802 shift;
5803 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5804
5805 : determine filename position in cpp output
5806 echo " "
5807 echo "Computing filename position in cpp output for #include directives..." >&4
5808 case "$osname" in
5809 amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5810 esac
5811 case "$fieldn" in
5812 '')
5813 case "$osname" in
5814 vos) testaccess=-e ;;
5815 *)   testaccess=-r ;;
5816 esac
5817 echo '#include <stdio.h>' > foo.c
5818 $cat >fieldn <<EOF
5819 $startsh
5820 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5821 $grep '^[       ]*#.*stdio\.h' | \
5822 while read cline; do
5823         pos=1
5824         set \$cline
5825         while $test \$# -gt 0; do
5826                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5827                         echo "\$pos"
5828                         exit 0
5829                 fi
5830                 shift
5831                 pos=\`expr \$pos + 1\`
5832         done
5833 done
5834 EOF
5835 chmod +x fieldn
5836 fieldn=`./fieldn`
5837 $rm -f foo.c fieldn
5838 ;;
5839 esac
5840 case $fieldn in
5841 '') pos='???';;
5842 1) pos=first;;
5843 2) pos=second;;
5844 3) pos=third;;
5845 *) pos="${fieldn}th";;
5846 esac
5847 echo "Your cpp writes the filename in the $pos field of the line."
5848
5849 : locate header file
5850 $cat >findhdr <<EOF
5851 $startsh
5852 wanted=\$1
5853 name=''
5854 for usrincdir in $incpth
5855 do
5856         if test -f \$usrincdir/\$wanted; then
5857                 echo "\$usrincdir/\$wanted"
5858                 exit 0
5859         fi
5860 done
5861 awkprg='{ print \$$fieldn }'
5862 echo "#include <\$wanted>" > foo\$\$.c
5863 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5864 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5865 while read cline; do
5866         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5867         case "\$name" in
5868         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5869         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5870         *) exit 2;;
5871         esac;
5872 done;
5873 #
5874 # status = 0: grep returned 0 lines, case statement not executed
5875 # status = 1: headerfile found
5876 # status = 2: while loop executed, no headerfile found
5877 #
5878 status=\$?
5879 $rm -f foo\$\$.c;
5880 if test \$status -eq 1; then
5881         exit 0;
5882 fi
5883 exit 1
5884 EOF
5885 chmod +x findhdr
5886
5887 : define an alternate in-header-list? function
5888 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5889 cont=true; xxf="echo \"<\$1> found.\" >&4";
5890 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5891 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5892 esac;
5893 case $# in 4) instead=instead;; *) instead="at last";; esac;
5894 while $test "$cont"; do
5895         xxx=`./findhdr $1`
5896         var=$2; eval "was=\$$2";
5897         if $test "$xxx" && $test -r "$xxx";
5898         then eval $xxf;
5899         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5900                 cont="";
5901         else eval $xxnf;
5902         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5903         set $yyy; shift; shift; yyy=$@;
5904         case $# in 0) cont="";;
5905         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5906                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5907         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5908                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5909         esac;
5910 done;
5911 while $test "$yyy";
5912 do set $yyy; var=$2; eval "was=\$$2";
5913         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5914         set $yyy; shift; shift; yyy=$@;
5915 done'
5916
5917 : see if stdlib is available
5918 set stdlib.h i_stdlib
5919 eval $inhdr
5920
5921 : check for lengths of integral types
5922 echo " "
5923 case "$intsize" in
5924 '')
5925         echo "Checking to see how big your integers are..." >&4
5926         $cat >try.c <<EOCP
5927 #include <stdio.h>
5928 #$i_stdlib I_STDLIB
5929 #ifdef I_STDLIB
5930 #include <stdlib.h>
5931 #endif
5932 int main()
5933 {
5934         printf("intsize=%d;\n", (int)sizeof(int));
5935         printf("longsize=%d;\n", (int)sizeof(long));
5936         printf("shortsize=%d;\n", (int)sizeof(short));
5937         exit(0);
5938 }
5939 EOCP
5940         set try
5941         if eval $compile_ok && $run ./try > /dev/null; then
5942                 eval `$run ./try`
5943                 echo "Your integers are $intsize bytes long."
5944                 echo "Your long integers are $longsize bytes long."
5945                 echo "Your short integers are $shortsize bytes long."
5946         else
5947                 $cat >&4 <<EOM
5948 !
5949 Help! I can't compile and run the intsize test program: please enlighten me!
5950 (This is probably a misconfiguration in your system or libraries, and
5951 you really ought to fix it.  Still, I'll try anyway.)
5952 !
5953 EOM
5954                 dflt=4
5955                 rp="What is the size of an integer (in bytes)?"
5956                 . ./myread
5957                 intsize="$ans"
5958                 dflt=$intsize
5959                 rp="What is the size of a long integer (in bytes)?"
5960                 . ./myread
5961                 longsize="$ans"
5962                 dflt=2
5963                 rp="What is the size of a short integer (in bytes)?"
5964                 . ./myread
5965                 shortsize="$ans"
5966         fi
5967         ;;
5968 esac
5969 $rm_try
5970
5971 : check for long long
5972 echo " "
5973 echo "Checking to see if you have long long..." >&4
5974 echo 'int main() { long long x = 7; return 0; }' > try.c
5975 set try
5976 if eval $compile; then
5977         val="$define"
5978         echo "You have long long."
5979 else
5980         val="$undef"
5981         echo "You do not have long long."
5982 fi
5983 $rm_try
5984 set d_longlong
5985 eval $setvar
5986
5987 : check for length of long long
5988 case "${d_longlong}${longlongsize}" in
5989 $define)
5990         echo " "
5991         echo "Checking to see how big your long longs are..." >&4
5992         $cat >try.c <<'EOCP'
5993 #include <stdio.h>
5994 int main()
5995 {
5996     printf("%d\n", (int)sizeof(long long));
5997     return(0);
5998 }
5999 EOCP
6000         set try
6001         if eval $compile_ok; then
6002                 longlongsize=`$run ./try`
6003                 echo "Your long longs are $longlongsize bytes long."
6004         else
6005                 dflt='8'
6006                 echo " "
6007                 echo "(I can't seem to compile the test program.  Guessing...)"
6008                 rp="What is the size of a long long (in bytes)?"
6009                 . ./myread
6010                 longlongsize="$ans"
6011         fi
6012         if $test "X$longsize" = "X$longlongsize"; then
6013                 echo "(That isn't any different from an ordinary long.)"
6014         fi
6015         ;;
6016 esac
6017 $rm_try
6018
6019 : see if inttypes.h is available
6020 : we want a real compile instead of Inhdr because some systems
6021 : have an inttypes.h which includes non-existent headers
6022 echo " "
6023 $cat >try.c <<EOCP
6024 #include <inttypes.h>
6025 int main() {
6026         static int32_t foo32 = 0x12345678;
6027 }
6028 EOCP
6029 set try
6030 if eval $compile; then
6031         echo "<inttypes.h> found." >&4
6032         val="$define"
6033 else
6034         echo "<inttypes.h> NOT found." >&4
6035         val="$undef"
6036 fi
6037 $rm_try
6038 set i_inttypes
6039 eval $setvar
6040
6041 : check for int64_t
6042 echo " "
6043 echo "Checking to see if you have int64_t..." >&4
6044 $cat >try.c <<EOCP
6045 #include <sys/types.h>
6046 #$i_inttypes I_INTTYPES
6047 #ifdef I_INTTYPES
6048 #include <inttypes.h>
6049 #endif
6050 int main() { int64_t x = 7; }
6051 EOCP
6052 set try
6053 if eval $compile; then
6054         val="$define"
6055         echo "You have int64_t."
6056 else
6057         val="$undef"
6058         echo "You do not have int64_t."
6059 fi
6060 $rm_try
6061 set d_int64_t
6062 eval $setvar
6063
6064 : Check if 64bit ints have a quad type
6065 echo " "
6066 echo "Checking which 64-bit integer type we could use..." >&4
6067
6068 case "$intsize" in
6069 8) val=int
6070    set quadtype
6071    eval $setvar
6072    val='"unsigned int"'
6073    set uquadtype
6074    eval $setvar
6075    quadkind=1
6076    ;;
6077 *) case "$longsize" in
6078    8) val=long
6079       set quadtype
6080       eval $setvar
6081       val='"unsigned long"'
6082       set uquadtype
6083       eval $setvar
6084       quadkind=2
6085       ;;
6086    *) case "$d_longlong:$longlongsize" in
6087       define:8)
6088         val='"long long"'
6089         set quadtype
6090         eval $setvar
6091         val='"unsigned long long"'
6092         set uquadtype
6093         eval $setvar
6094         quadkind=3
6095         ;;
6096       *) case "$d_int64_t" in
6097          define)
6098            val=int64_t
6099            set quadtype
6100            eval $setvar
6101            val=uint64_t
6102            set uquadtype
6103            eval $setvar
6104            quadkind=4
6105            ;;
6106          esac
6107          ;;
6108       esac
6109       ;;
6110    esac
6111    ;;
6112 esac
6113
6114 case "$quadtype" in
6115 '')     echo "Alas, no 64-bit integer types in sight." >&4
6116         d_quad="$undef"
6117         ;;
6118 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6119         d_quad="$define"
6120         ;;
6121 esac
6122
6123 : Do we want 64bit support
6124 case "$uselonglong" in
6125 "$define"|true|[yY]*)
6126         cat <<EOM >&4
6127
6128 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6129 EOM
6130         use64bitint="$define"
6131         ;;
6132 esac
6133 case "$use64bits" in
6134 "$define"|true|[yY]*)
6135         cat <<EOM >&4
6136
6137 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6138 EOM
6139         use64bitint="$define"
6140         ;;
6141 esac
6142 case "$use64bitints" in
6143 "$define"|true|[yY]*)
6144         cat <<EOM >&4
6145
6146 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6147 EOM
6148         use64bitint="$define"
6149         ;;
6150 esac
6151 case "$use64bitsint" in
6152 "$define"|true|[yY]*)
6153         cat <<EOM >&4
6154
6155 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6156 EOM
6157         use64bitint="$define"
6158         ;;
6159 esac
6160 case "$uselonglongs" in
6161 "$define"|true|[yY]*)
6162         cat <<EOM >&4
6163
6164 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6165 EOM
6166         use64bitint="$define"
6167         ;;
6168 esac
6169 case "$use64bitsall" in
6170 "$define"|true|[yY]*)
6171         cat <<EOM >&4
6172
6173 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6174 EOM
6175         use64bitall="$define"
6176         ;;
6177 esac
6178
6179 case "$ccflags" in
6180 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6181 esac
6182 case "$use64bitall" in
6183 "$define"|true|[yY]*) use64bitint="$define" ;;
6184 esac
6185
6186 case "$longsize" in
6187 8) cat <<EOM
6188
6189 You have natively 64-bit long integers.
6190 EOM
6191    val="$define"
6192    ;;
6193 *) case "$use64bitint" in
6194    "$define"|true|[yY]*) dflt='y';;
6195    *) dflt='n';;
6196    esac
6197    case "$d_quad" in
6198    "$define") ;;
6199    *) dflt='n' ;;
6200    esac
6201    cat <<EOM
6202
6203 Perl can be built to take advantage of 64-bit integer types
6204 on some systems.  To do so, Configure can be run with -Duse64bitint.
6205 Choosing this option will most probably introduce binary incompatibilities.
6206
6207 If this doesn't make any sense to you, just accept the default '$dflt'.
6208 (The default has been chosen based on your configuration.)
6209 EOM
6210    rp='Try to use 64-bit integers, if available?'
6211    . ./myread
6212    case "$ans" in
6213    [yY]*) val="$define" ;;
6214    *)     val="$undef"  ;;
6215    esac
6216    ;;
6217 esac
6218 set use64bitint
6219 eval $setvar
6220
6221 case "$use64bitall" in
6222 "$define"|true|[yY]*) dflt='y' ;;
6223 *) case "$longsize" in
6224    8) dflt='y' ;;
6225    *) dflt='n' ;;
6226    esac
6227    ;;
6228 esac
6229 cat <<EOM
6230
6231 You may also choose to try maximal 64-bitness.  It means using as much
6232 64-bitness as possible on the platform.  This in turn means even more
6233 binary incompatibilities.  On the other hand, your platform may not
6234 have any more 64-bitness available than what you already have chosen.
6235
6236 If this doesn't make any sense to you, just accept the default '$dflt'.
6237 (The default has been chosen based on your configuration.)
6238 EOM
6239 rp='Try to use maximal 64-bit support, if available?'
6240 . ./myread
6241 case "$ans" in
6242 [yY]*) val="$define" ;;
6243 *)     val="$undef"  ;;
6244 esac
6245 set use64bitall
6246 eval $setvar
6247 case "$use64bitall" in
6248 "$define")
6249         case "$use64bitint" in
6250         "$undef")
6251                 cat <<EOM
6252
6253 Since you have chosen a maximally 64-bit build, I'm also turning on
6254 the use of 64-bit integers.
6255 EOM
6256                 use64bitint="$define" ;;
6257         esac
6258         ;;
6259 esac
6260
6261 : Look for a hint-file generated 'call-back-unit'.  If the
6262 : user has specified that a 64-bit perl is to be built,
6263 : we may need to set or change some other defaults.
6264 if $test -f use64bitint.cbu; then
6265         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6266         . ./use64bitint.cbu
6267 fi
6268 case "$use64bitint" in
6269 "$define"|true|[yY]*)
6270         : This test was common to all the OpenBSD forks, and seems harmless for
6271         : other platforms:
6272         echo " "
6273         echo "Checking if your C library has broken 64-bit functions..." >&4
6274         cat >try.c <<EOCP
6275 #include <stdio.h>
6276 typedef $uquadtype myULL;
6277 int main (void)
6278 {
6279     struct {
6280         double d;
6281         myULL  u;
6282     } *p, test[] = {
6283         {4294967303.15, 4294967303ULL},
6284         {4294967294.2,  4294967294ULL},
6285         {4294967295.7,  4294967295ULL},
6286         {0.0, 0ULL}
6287     };
6288     for (p = test; p->u; p++) {
6289         myULL x = (myULL)p->d;
6290         if (x != p->u) {
6291             printf("buggy\n");
6292             return 0;
6293         }
6294     }
6295     printf("ok\n");
6296     return 0;
6297 }
6298 EOCP
6299         set try
6300         if eval $compile_ok; then
6301             libcquad=`$run ./try`
6302             echo "Your C library's 64-bit functions are $libcquad."
6303         else
6304             echo "(I can't seem to compile the test program.)"
6305             echo "Assuming that your C library's 64-bit functions are ok."
6306             libcquad="ok"
6307         fi
6308         $rm_try
6309
6310         case "$libcquad" in
6311             buggy*)
6312                 cat >&4 <<EOM
6313
6314 *** You have a C library with broken 64-bit functions.
6315 *** 64-bit support does not work reliably in this configuration.
6316 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6317 *** Cannot continue, aborting.
6318
6319 EOM
6320                 exit 1
6321                 ;;
6322         esac
6323         case "$longsize" in
6324         4) case "$archname64" in
6325            '') archname64=64int ;;
6326            esac
6327            ;;
6328         esac
6329         ;;
6330 esac
6331
6332 : Look for a hint-file generated 'call-back-unit'.  If the
6333 : user has specified that a maximally 64-bit perl is to be built,
6334 : we may need to set or change some other defaults.
6335 if $test -f use64bitall.cbu; then
6336         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6337         . ./use64bitall.cbu
6338 fi
6339 case "$use64bitall" in
6340 "$define"|true|[yY]*)
6341         case "$longsize" in
6342         4) case "$archname64" in
6343            ''|64int) archname64=64all ;;
6344            esac
6345            ;;
6346         esac
6347         ;;
6348 esac
6349
6350 case "$d_quad:$use64bitint" in
6351 $undef:$define)
6352         cat >&4 <<EOF
6353
6354 *** You have chosen to use 64-bit integers,
6355 *** but none can be found.
6356 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6357 *** Cannot continue, aborting.
6358
6359 EOF
6360         exit 1
6361         ;;
6362 esac
6363
6364 : Check if we are using the GNU C library
6365 echo " "
6366 echo "Checking for GNU C Library..." >&4
6367 cat >try.c <<'EOCP'
6368 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6369    alone are insufficient to distinguish different versions, such as
6370    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6371    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6372 */
6373 #include <stdio.h>
6374 int main(void)
6375 {
6376 #ifdef __GLIBC__
6377 #   ifdef __GLIBC_MINOR__
6378 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6379 #           include <gnu/libc-version.h>
6380             printf("%s\n",  gnu_get_libc_version());
6381 #       else
6382             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6383 #       endif
6384 #   else
6385         printf("%d\n",  __GLIBC__);
6386 #   endif
6387     return 0;
6388 #else
6389     return 1;
6390 #endif
6391 }
6392 EOCP
6393 set try
6394 if eval $compile_ok && $run ./try > glibc.ver; then
6395         val="$define"
6396         gnulibc_version=`$cat glibc.ver`
6397         echo "You are using the GNU C Library version $gnulibc_version"
6398 else
6399         val="$undef"
6400         gnulibc_version=''
6401         echo "You are not using the GNU C Library"
6402 fi
6403 $rm_try glibc.ver
6404 set d_gnulibc
6405 eval $setvar
6406
6407 : see if nm is to be used to determine whether a symbol is defined or not
6408 case "$usenm" in
6409 '')
6410         dflt=''
6411         case "$d_gnulibc" in
6412         "$define")
6413                 echo " "
6414                 echo "nm probably won't work on the GNU C Library." >&4
6415                 dflt=n
6416                 ;;
6417         esac
6418         case "$dflt" in
6419         '')
6420                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6421                         echo " "
6422                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6423                         echo "'nm' won't be sufficient on this system." >&4
6424                         dflt=n
6425                 fi
6426                 ;;
6427         esac
6428         case "$dflt" in
6429         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6430                 if $test $dflt -gt 20; then
6431                         dflt=y
6432                 else
6433                         dflt=n
6434                 fi
6435                 ;;
6436         esac
6437         ;;
6438 *)
6439         case "$usenm" in
6440         true|$define) dflt=y;;
6441         *) dflt=n;;
6442         esac
6443         ;;
6444 esac
6445 $cat <<EOM
6446
6447 I can use $nm to extract the symbols from your C libraries. This
6448 is a time consuming task which may generate huge output on the disk (up
6449 to 3 megabytes) but that should make the symbols extraction faster. The
6450 alternative is to skip the 'nm' extraction part and to compile a small
6451 test program instead to determine whether each symbol is present. If
6452 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6453 this may be the best solution.
6454
6455 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6456
6457 EOM
6458 rp="Shall I use $nm to extract C symbols from the libraries?"
6459 . ./myread
6460 case "$ans" in
6461 [Nn]*) usenm=false;;
6462 *) usenm=true;;
6463 esac
6464
6465 runnm=$usenm
6466 case "$reuseval" in
6467 true) runnm=false;;
6468 esac
6469
6470 : nm options which may be necessary
6471 case "$nm_opt" in
6472 '') if $test -f /mach_boot; then
6473                 nm_opt=''       # Mach
6474         elif $test -d /usr/ccs/lib; then
6475                 nm_opt='-p'     # Solaris (and SunOS?)
6476         elif $test -f /dgux; then
6477                 nm_opt='-p'     # DG-UX
6478         elif $test -f /lib64/rld; then
6479                 nm_opt='-p'     # 64-bit Irix
6480         else
6481                 nm_opt=''
6482         fi;;
6483 esac
6484
6485 : nm options which may be necessary for shared libraries but illegal
6486 : for archive libraries.  Thank you, Linux.
6487 case "$nm_so_opt" in
6488 '')     case "$myuname" in
6489         *linux*|gnu*)
6490                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6491                         nm_so_opt='--dynamic'
6492                 fi
6493                 ;;
6494         esac
6495         ;;
6496 esac
6497
6498 : Figure out where the libc is located
6499 case "$runnm" in
6500 true)
6501 : get list of predefined functions in a handy place
6502 echo " "
6503 case "$libc" in
6504 '') libc=unknown
6505         case "$libs" in
6506         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6507         esac
6508         ;;
6509 esac
6510 case "$libs" in
6511 '') ;;
6512 *)  for thislib in $libs; do
6513         case "$thislib" in
6514         -lc|-lc_s)
6515                 : Handle C library specially below.
6516                 ;;
6517         -l*)
6518                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6519                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6520                         :
6521                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6522                         :
6523                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6524                         :
6525                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6526                         :
6527                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6528                         :
6529                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6530                         :
6531                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6532                         :
6533                 else
6534                         try=''
6535                 fi
6536                 libnames="$libnames $try"
6537                 ;;
6538         *) libnames="$libnames $thislib" ;;
6539         esac
6540         done
6541         ;;
6542 esac
6543 xxx=normal
6544 case "$libc" in
6545 unknown)
6546         set /lib/libc.$so
6547         for xxx in $libpth; do
6548                 $test -r $1 || set $xxx/libc.$so
6549                 : The messy sed command sorts on library version numbers.
6550                 $test -r $1 || \
6551                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6552                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6553                                 h
6554                                 s/[0-9][0-9]*/0000&/g
6555                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6556                                 G
6557                                 s/\n/ /' | \
6558                          $sort | $sed -e 's/^.* //'`
6559                 eval set \$$#
6560         done
6561         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6562         $test -r $1 || set $sysroot/lib/libsys_s$_a
6563         ;;
6564 *)
6565         set blurfl
6566         ;;
6567 esac
6568 if $test -r "$1"; then
6569         echo "Your (shared) C library seems to be in $1."
6570         libc="$1"
6571 elif $test -r /lib/libc && $test -r /lib/clib; then
6572         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6573         xxx=apollo
6574         libc='/lib/clib /lib/libc'
6575         if $test -r /lib/syslib; then
6576                 echo "(Your math library is in /lib/syslib.)"
6577                 libc="$libc /lib/syslib"
6578         fi
6579 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6580         echo "Your C library seems to be in $libc, as you said before."
6581 elif $test -r $incpath/usr/lib/libc$_a; then
6582         libc=$incpath/usr/lib/libc$_a;
6583         echo "Your C library seems to be in $libc.  That's fine."
6584 elif $test -r /lib/libc$_a; then
6585         libc=/lib/libc$_a;
6586         echo "Your C library seems to be in $libc.  You're normal."
6587 else
6588         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6589                 :
6590         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6591                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6592         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6593                 :
6594         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6595                 :
6596         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6597                 :
6598         else
6599                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6600         fi
6601         if $test -r "$tans"; then
6602                 echo "Your C library seems to be in $tans, of all places."
6603                 libc=$tans
6604         else
6605                 libc='blurfl'
6606         fi
6607 fi
6608 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6609         dflt="$libc"
6610         cat <<EOM
6611
6612 If the guess above is wrong (which it might be if you're using a strange
6613 compiler, or your machine supports multiple models), you can override it here.
6614
6615 EOM
6616 else
6617         dflt=''
6618         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6619         cat >&4 <<EOM
6620 I can't seem to find your C library.  I've looked in the following places:
6621
6622 EOM
6623         $sed 's/^/      /' libpath
6624         cat <<EOM
6625
6626 None of these seems to contain your C library. I need to get its name...
6627
6628 EOM
6629 fi
6630 fn=f
6631 rp='Where is your C library?'
6632 . ./getfile
6633 libc="$ans"
6634
6635 echo " "
6636 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6637 set X `cat libnames`
6638 shift
6639 xxx=files
6640 case $# in 1) xxx=file; esac
6641 echo "Extracting names from the following $xxx for later perusal:" >&4
6642 echo " "
6643 $sed 's/^/      /' libnames >&4
6644 echo " "
6645 $echo $n "This may take a while...$c" >&4
6646
6647 for file in $*; do
6648         case $file in
6649         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6650         *) $nm $nm_opt $file 2>/dev/null;;
6651         esac
6652 done >libc.tmp
6653
6654 $echo $n ".$c"
6655 $grep fprintf libc.tmp > libc.ptf
6656 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6657 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6658 xxx='[ADTSIWi]'
6659 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6660         eval $xscan;\
6661         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6662                 eval $xrun
6663 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6664         eval $xscan;\
6665         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6666                 eval $xrun
6667 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6668         eval $xscan;\
6669         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6670                 eval $xrun
6671 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6672         eval $xscan;\
6673         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6674                 eval $xrun
6675 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6676         eval $xscan;\
6677         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6678                 eval $xrun
6679 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6680         eval $xscan;\
6681         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6682                 eval $xrun
6683 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6684                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6685         eval $xscan;\
6686         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6687                 eval $xrun
6688 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6689         eval $xscan;\
6690         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6691                 eval $xrun
6692 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6693         eval $xscan;\
6694         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6695                 eval $xrun
6696 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6697         eval $xscan;\
6698         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6699                 eval $xrun
6700 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6701         eval $xscan;\
6702         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6703                 eval $xrun
6704 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6705         eval $xscan;\
6706         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6707                 eval $xrun
6708 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6709         eval $xscan;\
6710         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6711                 eval $xrun
6712 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6713         eval $xscan;\
6714         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6715                 eval $xrun
6716 else
6717         $nm -p $* 2>/dev/null >libc.tmp
6718         $grep fprintf libc.tmp > libc.ptf
6719         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6720                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6721         then
6722                 nm_opt='-p'
6723                 eval $xrun
6724         else
6725                 echo " "
6726                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6727                 com=''
6728                 if $ar t $libc > libc.tmp && \
6729                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6730                 then
6731                         for thisname in $libnames $libc; do
6732                                 $ar t $thisname >>libc.tmp
6733                         done
6734                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6735                         echo "Ok." >&4
6736                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6737                         for thisname in $libnames $libc; do
6738                                 $ar tv $thisname >>libc.tmp
6739                                 emximp -o tmp.imp $thisname \
6740                                     2>/dev/null && \
6741                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6742                                     < tmp.imp >>libc.tmp
6743                                 $rm -f tmp.imp
6744                         done
6745                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6746                         echo "Ok." >&4
6747                 else
6748                         echo "$ar didn't seem to work right." >&4
6749                         echo "Maybe this is a Cray...trying bld instead..." >&4
6750                         if  bld t $libc | \
6751                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6752                                 $test -s libc.list
6753                         then
6754                                 for thisname in $libnames; do
6755                                         bld t $libnames | \
6756                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6757                                         $ar t $thisname >>libc.tmp
6758                                 done
6759                                 echo "Ok." >&4
6760                         else
6761                                 echo "That didn't work either.  Giving up." >&4
6762                                 exit 1
6763                         fi
6764                 fi
6765         fi
6766 fi
6767 nm_extract="$com"
6768 case "$PASE" in
6769 define)
6770     echo " "
6771     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6772     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6773     ;;
6774 *)  if $test -f /lib/syscalls.exp; then
6775         echo " "
6776         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6777         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6778                 /lib/syscalls.exp >>libc.list
6779     fi
6780     ;;
6781 esac
6782 ;;
6783 esac
6784 $rm -f libnames libpath
6785
6786 : Check if we are using C++
6787 echo " "
6788 echo "Checking for C++..." >&4
6789 $cat >try.c <<'EOCP'
6790 #include <stdio.h>
6791 int main(void)
6792 {
6793 #ifdef __cplusplus
6794     return 0;
6795 #else
6796     return 1;
6797 #endif
6798 }
6799 EOCP
6800 set try
6801 if eval $compile_ok && $run ./try; then
6802         val="$define"
6803         echo "You are using a C++ compiler."
6804 else
6805         val="$undef"
6806         echo "You are not using a C++ compiler."
6807 fi
6808 $rm_try cplusplus$$
6809 set d_cplusplus
6810 eval $setvar
6811
6812 : is a C symbol defined?
6813 csym='tlook=$1;
6814 case "$3" in
6815 -v) tf=libc.tmp; tdc="";;
6816 -a) tf=libc.tmp; tdc="[]";;
6817 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6818 esac;
6819 case "$d_cplusplus" in
6820     $define)    extern_C="extern \"C\"" ;;
6821     *)          extern_C="extern"       ;;
6822 esac;
6823 tx=yes;
6824 case "$reuseval-$4" in
6825 true-) ;;
6826 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6827 esac;
6828 case "$tx" in
6829 yes)
6830         tval=false;
6831         if $test "$runnm" = true; then
6832                 if $contains $tlook $tf >/dev/null 2>&1; then
6833                         tval=true;
6834                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6835                         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;
6836                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6837                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6838                         $rm_try;
6839                 fi;
6840         else
6841                 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;
6842                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6843                 $rm_try;
6844         fi;
6845         ;;
6846 *)
6847         case "$tval" in
6848         $define) tval=true;;
6849         *) tval=false;;
6850         esac;
6851         ;;
6852 esac;
6853 eval "$2=$tval"'
6854
6855 : define an is-in-libc? function
6856 inlibc='echo " "; td=$define; tu=$undef;
6857 sym=$1; var=$2; eval "was=\$$2";
6858 tx=yes;
6859 case "$reuseval$was" in
6860 true) ;;
6861 true*) tx=no;;
6862 esac;
6863 case "$tx" in
6864 yes)
6865         set $sym tres -f;
6866         eval $csym;
6867         case "$tres" in
6868         true)
6869                 echo "$sym() found." >&4;
6870                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6871         *)
6872                 echo "$sym() NOT found." >&4;
6873                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6874         esac;;
6875 *)
6876         case "$was" in
6877         $define) echo "$sym() found." >&4;;
6878         *) echo "$sym() NOT found." >&4;;
6879         esac;;
6880 esac'
6881
6882 : check for length of double
6883 echo " "
6884 case "$doublesize" in
6885 '')
6886         echo "Checking to see how big your double precision numbers are..." >&4
6887         $cat >try.c <<EOCP
6888 #include <stdio.h>
6889 #$i_stdlib I_STDLIB
6890 #ifdef I_STDLIB
6891 #include <stdlib.h>
6892 #endif
6893 int main()
6894 {
6895     printf("%d\n", (int)sizeof(double));
6896     exit(0);
6897 }
6898 EOCP
6899         set try
6900         if eval $compile_ok; then
6901                 doublesize=`$run ./try`
6902                 echo "Your double is $doublesize bytes long."
6903         else
6904                 dflt='8'
6905                 echo "(I can't seem to compile the test program.  Guessing...)"
6906                 rp="What is the size of a double precision number (in bytes)?"
6907                 . ./myread
6908                 doublesize="$ans"
6909         fi
6910         ;;
6911 esac
6912 $rm_try
6913
6914 : see if this is a float.h system
6915 set float.h i_float
6916 eval $inhdr
6917
6918 : check for long doubles
6919 echo " "
6920 echo "Checking to see if you have long double..." >&4
6921 echo 'int main() { long double x = 7.0; }' > try.c
6922 set try
6923 if eval $compile; then
6924         val="$define"
6925         echo "You have long double."
6926 else
6927         val="$undef"
6928         echo "You do not have long double."
6929 fi
6930 $rm_try
6931 set d_longdbl
6932 eval $setvar
6933
6934 : see if ldexpl exists
6935 set ldexpl d_ldexpl
6936 eval $inlibc
6937
6938 : check for length of long double
6939 case "${d_longdbl}${longdblsize}" in
6940 $define)
6941         echo " "
6942         echo "Checking to see how big your long doubles are..." >&4
6943         $cat >try.c <<'EOCP'
6944 #include <stdio.h>
6945 int main()
6946 {
6947         printf("%d\n", sizeof(long double));
6948 }
6949 EOCP
6950         set try
6951         set try
6952         if eval $compile; then
6953                 longdblsize=`$run ./try`
6954                 echo "Your long doubles are $longdblsize bytes long."
6955         else
6956                 dflt='8'
6957                 echo " "
6958                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6959                 rp="What is the size of a long double (in bytes)?"
6960                 . ./myread
6961                 longdblsize="$ans"
6962         fi
6963         if $test "X$doublesize" = "X$longdblsize"; then
6964                 echo "That isn't any different from an ordinary double."
6965                 echo "I'll keep your setting anyway, but you may see some"
6966                 echo "harmless compilation warnings."
6967         fi
6968         ;;
6969 esac
6970 $rm_try
6971
6972 $echo "Checking the kind of long doubles you have..." >&4
6973 case "$d_longdbl" in
6974 define)
6975 $cat <<EOP >try.c
6976 #$i_float I_FLOAT
6977 #$i_stdlib I_STDLIB
6978 #define LONGDBLSIZE $longdblsize
6979 #define DOUBLESIZE $doublesize
6980 #ifdef I_FLOAT
6981 #include <float.h>
6982 #endif
6983 #ifdef I_STDLIB
6984 #include <stdlib.h>
6985 #endif
6986 #include <stdio.h>
6987 static const long double d = -0.1L;
6988 int main() {
6989   unsigned const char* b = (unsigned const char*)(&d);
6990 #if DOUBLESIZE == LONGDBLSIZE
6991   printf("0\n"); /* if it floats like double */
6992   exit(0);
6993 #endif
6994 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6995   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6996     /* IEEE 754 128-bit little-endian */
6997     printf("1\n");
6998     exit(0);
6999   }
7000   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
7001     /* IEEE 128-bit big-endian, e.g. solaris sparc */
7002     printf("2\n");
7003     exit(0);
7004   }
7005 #endif
7006 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
7007  * while 64-bits platforms have it in 16 bytes.  The trailing bytes
7008  * cannot be trusted. */
7009 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
7010   if (b[0] == 0xCD && b[9] == 0xBF) {
7011     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
7012      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
7013      * Also known as "extended precision". */
7014     printf("3\n");
7015     exit(0);
7016   }
7017   if (b[0] == 0xBF && b[9] == 0xCD) {
7018     /* Is there ever big-endian 80-bit, really?
7019      *
7020      * The Motorola 68881 had another "extended precision" format:
7021      * sign:1 exp:15 zero:16 integer:1 mantissa:63
7022      * for total of 96 bits of bytes.  The zero bits were unused.
7023      * See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL" for more details.
7024      * If it ever becomes relevant, this format should be allocated
7025      * a new doublekind code since it's quite different from the Intel x87.
7026      */
7027     printf("4\n");
7028     exit(0);
7029   }
7030 #endif
7031 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
7032   /* software "double double", the 106 is 53+53.
7033    * but irix thinks it is 107. */
7034   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
7035     /* double double 128-bit fully little-endian,
7036      * little-endian doubles in little-endian order,
7037      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
7038     printf("5\n");
7039     exit(0);
7040   }
7041   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7042     /* double double 128-bit fully big-endian,
7043      * big-endian doubles in big-endian order,
7044      * e.g. PPC/Power and MIPS:
7045      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7046     printf("6\n");
7047     exit(0);
7048   }
7049   if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7050     /* double double 128-bit mixed endian.
7051      * little-endian doubles in big-endian order,
7052      * e.g. ppc64el,
7053      * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7054     printf("7\n");
7055     exit(0);
7056   }
7057   if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7058     /* double double 128-bit mixed endian,
7059      * big-endian doubles in little-endian order,
7060      * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7061     printf("8\n");
7062     exit(0);
7063   }
7064 #endif
7065 /* We are largely making this up because it may well be
7066  * that the VAX format H was never made available to C,
7067  * only to Fortran. */
7068 #if LONGDBLSIZE == 16 && defined(__vax__)
7069   if (b[0] == 0xFD && b[15] == 0x99) {
7070     /* VAX format H, PDP-11 mixed endian. */
7071     printf("9\n");
7072     exit(0);
7073   }
7074 #endif
7075   printf("-1\n"); /* unknown */
7076   exit(0);
7077 }
7078 EOP
7079 set try
7080 if eval $compile; then
7081     longdblkind=`$run ./try`
7082 else
7083     longdblkind=-1
7084 fi
7085 ;;
7086 *) longdblkind=0 ;;
7087 esac
7088 case "$longdblkind" in
7089 0) echo "Your long doubles are doubles." >&4 ;;
7090 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7091 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7092 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
7093 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
7094 5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >& 4 ;;
7095 6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >& 4 ;;
7096 7) echo "You have 128-bit mixed-endian double-double long doubles (64-bit LEs in BE)." >& 4 ;;
7097 8) echo "You have 128-bit mixed-endian double-double long doubles (64-bit BEs in LE)." >& 4 ;;
7098 9) echo "You have 128-bit PDP-style mixed-endian long doubles (VAX format H)." >& 4 ;;
7099 *) echo "Cannot figure out your long double." >&4 ;;
7100 esac
7101 d_long_double_style_ieee=$undef
7102 d_long_double_style_ieee_std=$undef
7103 d_long_double_style_ieee_extended=$undef
7104 d_long_double_style_ieee_doubledouble=$undef
7105 d_long_double_style_vax=$undef
7106 case "$longdblkind" in
7107 1|2|3|4|5|6|7|8) d_long_double_style_ieee=$define ;;
7108 esac
7109 case "$longdblkind" in
7110 1|2) d_long_double_style_ieee_std=$define ;;
7111 esac
7112 case "$longdblkind" in
7113 3|4) d_long_double_style_ieee_extended=$define ;;
7114 esac
7115 case "$longdblkind" in
7116 5|6|7|8) d_long_double_style_ieee_doubledouble=$define ;;
7117 esac
7118 case "$longdblkind" in
7119 9) d_long_double_style_vax=$define ;;
7120 esac
7121 $rm_try
7122
7123 : determine the architecture name
7124 echo " "
7125 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7126         tarch=`arch`"-$osname"
7127 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7128         if uname -m > tmparch 2>&1 ; then
7129                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7130                         -e 's/$/'"-$osname/" tmparch`
7131         else
7132                 tarch="$osname"
7133         fi
7134         $rm -f tmparch
7135 else
7136         tarch="$osname"
7137 fi
7138 case "$myarchname" in
7139 ''|"$tarch") ;;
7140 *)
7141         echo "(Your architecture name used to be $myarchname.)"
7142         archname=''
7143         ;;
7144 esac
7145 case "$targetarch" in
7146 '') ;;
7147 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7148 esac
7149 myarchname="$tarch"
7150 case "$archname" in
7151 '') dflt="$tarch";;
7152 *) dflt="$archname";;
7153 esac
7154 rp='What is your architecture name'
7155 . ./myread
7156 archname="$ans"
7157
7158 : optionally add API version to the architecture for versioned archlibs
7159 case "$useversionedarchname" in
7160 $define|true|[yY]*) dflt='y';;
7161 *)                  dflt='n';;
7162 esac
7163 rp='Add the Perl API version to your archname?'
7164 . ./myread
7165 case "$ans" in
7166 y|Y)    useversionedarchname="$define" ;;
7167 *)      useversionedarchname="$undef" ;;
7168 esac
7169 case "$useversionedarchname" in
7170 $define)
7171         case "$archname" in
7172         *-$api_versionstring)
7173                 echo "...and architecture name already has -$api_versionstring" >&4
7174                 ;;
7175         *)
7176                 archname="$archname-$api_versionstring"
7177                 echo "...setting architecture name to $archname." >&4
7178                 ;;
7179         esac
7180         ;;
7181 esac
7182
7183 case "$usethreads" in
7184 $define)
7185         echo "Threads selected." >&4
7186         case "$archname" in
7187         *-thread*) echo "...and architecture name already has -thread." >&4
7188                 ;;
7189         *)      archname="$archname-thread"
7190                 echo "...setting architecture name to $archname." >&4
7191                 ;;
7192         esac
7193         ;;
7194 esac
7195 case "$usemultiplicity" in
7196 $define)
7197         echo "Multiplicity selected." >&4
7198         case "$archname" in
7199         *-multi*) echo "...and architecture name already has -multi." >&4
7200                 ;;
7201         *)      archname="$archname-multi"
7202                 echo "...setting architecture name to $archname." >&4
7203                 ;;
7204         esac
7205         ;;
7206 esac
7207 case "$use64bitint$use64bitall" in
7208 *"$define"*)
7209         case "$archname64" in
7210         '')
7211                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7212                 ;;
7213         *)
7214                 case "$use64bitint" in
7215                 "$define") echo "64 bit integers selected." >&4 ;;
7216                 esac
7217                 case "$use64bitall" in
7218                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7219                 esac
7220                 case "$archname" in
7221                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7222                         ;;
7223                 *)      archname="$archname-$archname64"
7224                         echo "...setting architecture name to $archname." >&4
7225                         ;;
7226                 esac
7227                 ;;
7228         esac
7229 esac
7230 case "$uselongdouble" in
7231 $define)
7232         echo "Long doubles selected." >&4
7233         case "$longdblsize" in
7234         $doublesize)
7235                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7236                 ;;
7237         *)
7238                 case "$archname" in
7239                 *-ld*) echo "...and architecture name already has -ld." >&4
7240                         ;;
7241                 *)      archname="$archname-ld"
7242                         echo "...setting architecture name to $archname." >&4
7243                         ;;
7244                 esac
7245                 ;;
7246         esac
7247         ;;
7248 esac
7249 case "$usequadmath" in
7250 $define)
7251         echo "quadmath selected." >&4
7252         case "$archname" in
7253         *-quadmath*) echo "...and architecture name already has -quadmath." >&4
7254                 ;;
7255         *)      archname="$archname-quadmath"
7256                 echo "...setting architecture name to $archname." >&4
7257                 ;;
7258         esac
7259         ;;
7260 esac
7261 if $test -f archname.cbu; then
7262         echo "Your platform has some specific hints for architecture name, using them..."
7263         . ./archname.cbu
7264 fi
7265
7266 : set the prefixit variable, to compute a suitable default value
7267 prefixit='case "$3" in
7268 ""|none)
7269         case "$oldprefix" in
7270         "") eval "$1=\"\$$2\"";;
7271         *)
7272                 case "$3" in
7273                 "") eval "$1=";;
7274                 none)
7275                         eval "tp=\"\$$2\"";
7276                         case "$tp" in
7277                         ""|" ") eval "$1=\"\$$2\"";;
7278                         *) eval "$1=";;
7279                         esac;;
7280                 esac;;
7281         esac;;
7282 *)
7283         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7284         case "$tp" in
7285         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7286         /*-$oldprefix/*|\~*-$oldprefix/*)
7287                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7288         *) eval "$1=\"\$$2\"";;
7289         esac;;
7290 esac'
7291
7292 : determine installation style
7293 : For now, try to deduce it from prefix unless it is already set.
7294 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7295 case "$installstyle" in
7296 '')     case "$prefix" in
7297                 *perl*) dflt='lib';;
7298                 *) dflt='lib/perl5' ;;
7299         esac
7300         ;;
7301 *)      dflt="$installstyle" ;;
7302 esac
7303 : Probably not worth prompting for this since we prompt for all
7304 : the directories individually, and the prompt would be too long and
7305 : confusing anyway.
7306 installstyle=$dflt
7307
7308 : determine where public executables go
7309 echo " "
7310 set dflt bin bin
7311 eval $prefixit
7312 fn=d~
7313 rp='Pathname where the public executables will reside?'
7314 . ./getfile
7315 if $test "X$ansexp" != "X$binexp"; then
7316         installbin=''
7317 fi
7318 prefixvar=bin
7319 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7320 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7321 :     this via initialinstalllocation
7322 . ./setprefixvar
7323
7324 case "$userelocatableinc" in
7325 $define|true|[yY]*)     dflt='y' ;;
7326 *)                      dflt='n' ;;
7327 esac
7328 cat <<EOM
7329
7330 Would you like to build Perl so that the installation is relocatable, so that
7331 library paths in @INC are determined relative to the path of the perl binary?
7332 This is not advised for system Perl installs, or if you need to run setid
7333 scripts or scripts under taint mode.
7334
7335 If this doesn't make any sense to you, just accept the default '$dflt'.
7336 EOM
7337 rp='Use relocatable @INC?'
7338 . ./myread
7339 case "$ans" in
7340 y|Y)    val="$define" ;;
7341 *)      val="$undef"  ;;
7342 esac
7343 set userelocatableinc
7344 eval $setvar
7345
7346 initialinstalllocation="$binexp"
7347 : Default prefix is now "up one level from where the binaries are"
7348 case "$userelocatableinc" in
7349 $define|true|[yY]*)
7350     bin=".../"
7351     binexp=".../"
7352     prefix=".../.."
7353     prefixexp=".../.."
7354     installprefixexp=".../.."
7355     ;;
7356 esac
7357
7358 : determine where private library files go
7359 : Usual default is /usr/local/lib/perl5/$version.
7360 : Also allow things like /opt/perl/lib/$version, since
7361 : /opt/perl/lib/perl5... would be redundant.
7362 : The default "style" setting is made in installstyle.U
7363 case "$installstyle" in
7364 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7365 *)       set dflt privlib lib/$version ;;
7366 esac
7367 eval $prefixit
7368 $cat <<EOM
7369
7370 There are some auxiliary files for $package that need to be put into a
7371 private library directory that is accessible by everyone.
7372
7373 EOM
7374 fn=$binexp
7375 fn=d~+
7376 rp='Pathname where the private library files will reside?'
7377 . ./getfile
7378 prefixvar=privlib
7379 . ./setprefixvar
7380
7381 : set the prefixup variable, to restore leading tilda escape
7382 prefixup='case "$prefixexp" in
7383 "$prefix") ;;
7384 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7385 esac'
7386
7387 : determine where public architecture dependent libraries go
7388 set archlib archlib
7389 eval $prefixit
7390 : privlib default is /usr/local/lib/$package/$version
7391 : archlib default is /usr/local/lib/$package/$version/$archname
7392 : privlib may have an optional trailing /share.
7393 tdflt=`echo $privlib | $sed 's,/share$,,'`
7394 tdflt=$tdflt/$archname
7395 case "$archlib" in
7396 '')     dflt=$tdflt
7397         ;;
7398 *)      dflt="$archlib"
7399     ;;
7400 esac
7401 $cat <<EOM
7402
7403 $spackage contains architecture-dependent library files.  If you are
7404 sharing libraries in a heterogeneous environment, you might store
7405 these files in a separate location.  Otherwise, you can just include
7406 them with the rest of the public library files.
7407
7408 EOM
7409 fn=$binexp
7410 fn=d+~
7411 rp='Where do you want to put the public architecture-dependent libraries?'
7412 . ./getfile
7413 prefixvar=archlib
7414 . ./setprefixvar
7415 if $test X"$archlib" = X"$privlib"; then
7416         d_archlib="$undef"
7417 else
7418         d_archlib="$define"
7419 fi
7420
7421 : see if setuid scripts can be secure
7422 $cat <<EOM
7423
7424 Some kernels have a bug that prevents setuid #! scripts from being
7425 secure.  Some sites have disabled setuid #! scripts because of this.
7426
7427 First let's decide if your kernel supports secure setuid #! scripts.
7428 (If setuid #! scripts would be secure but have been disabled anyway,
7429 don't say that they are secure if asked.)
7430
7431 EOM
7432
7433 val="$undef"
7434 if $test -d /dev/fd; then
7435         echo "#!$ls" >reflect
7436         chmod +x,u+s reflect
7437         ./reflect >flect 2>&1
7438         if $contains "/dev/fd" flect >/dev/null; then
7439                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7440                 val="$define"
7441         else
7442                 $cat <<EOM
7443 If you are not sure if they are secure, I can check but I'll need a
7444 username and password different from the one you are using right now.
7445 If you don't have such a username or don't want me to test, simply
7446 enter 'none'.
7447
7448 EOM
7449                 rp='Other username to test security of setuid scripts with?'
7450                 dflt='none'
7451                 . ./myread
7452                 case "$ans" in
7453                 n|none)
7454                         case "$d_suidsafe" in
7455                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7456                                 dflt=n;;
7457                         "$undef")
7458                                 echo "Well, the $hint value is *not* secure." >&4
7459                                 dflt=n;;
7460                         *)      echo "Well, the $hint value *is* secure." >&4
7461                                 dflt=y;;
7462                         esac
7463                         ;;
7464                 *)
7465                         $rm -f reflect flect
7466                         echo "#!$ls" >reflect
7467                         chmod +x,u+s reflect
7468                         echo >flect
7469                         chmod a+w flect
7470                         echo '"su" will (probably) prompt you for '"$ans's password."
7471                         su $ans -c './reflect >flect'
7472                         if $contains "/dev/fd" flect >/dev/null; then
7473                                 echo "Okay, it looks like setuid scripts are secure." >&4
7474                                 dflt=y
7475                         else
7476                                 echo "I don't think setuid scripts are secure." >&4
7477                                 dflt=n
7478                         fi
7479                         ;;
7480                 esac
7481                 rp='Does your kernel have *secure* setuid scripts?'
7482                 . ./myread
7483                 case "$ans" in
7484                 [yY]*)  val="$define";;
7485                 *)      val="$undef";;
7486                 esac
7487         fi
7488 else
7489         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7490         echo "(That's for file descriptors, not floppy disks.)"
7491         val="$undef"
7492 fi
7493 set d_suidsafe
7494 eval $setvar
7495
7496 $rm -f reflect flect
7497
7498 : now see if they want to do setuid emulation
7499 if $test $patchlevel -lt 11; then
7500 echo " "
7501 val="$undef"
7502 case "$d_suidsafe" in
7503 "$define")
7504         val="$undef"
7505         echo "No need to emulate SUID scripts since they are secure here." >&4
7506         ;;
7507 *)
7508         $cat <<EOM
7509 Some systems have disabled setuid scripts, especially systems where
7510 setuid scripts cannot be secure.  On systems where setuid scripts have
7511 been disabled, the setuid/setgid bits on scripts are currently
7512 useless.  It is possible for $package to detect those bits and emulate
7513 setuid/setgid in a secure fashion.  This emulation will only work if
7514 setuid scripts have been disabled in your kernel.
7515
7516 EOM
7517         case "$d_dosuid" in
7518         "$define") dflt=y ;;
7519         *) dflt=n ;;
7520         esac
7521         rp="Do you want to do setuid/setgid emulation?"
7522         . ./myread
7523         case "$ans" in
7524         [yY]*)  val="$define";;
7525         *)      val="$undef";;
7526         esac
7527         ;;
7528 esac
7529 set d_dosuid
7530 eval $setvar
7531 else
7532     case "$d_dosuid" in
7533         "$define")
7534         cat >&4 <<EOH
7535
7536 SUID emulation has been removed for 5.12
7537 Please re-run Configure without -Dd_dosuid
7538
7539 EOH
7540         exit 1;
7541         ;;
7542     esac
7543     d_dosuid=undef
7544 fi
7545
7546 : Find perl5.005 or later.
7547 echo "Looking for a previously installed perl5.005 or later... "
7548 case "$perl5" in
7549 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7550                 : Check if this perl is recent and can load a simple module
7551                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7552                         perl5=$tdir/perl
7553                         break;
7554                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7555                         perl5=$tdir/perl5
7556                         break;
7557                 fi
7558         done
7559         ;;
7560 *)      perl5="$perl5"
7561         ;;
7562 esac
7563 case "$perl5" in
7564 '')     echo "None found.  That's ok.";;
7565 *)      echo "Using $perl5." ;;
7566 esac
7567
7568 : Set the siteprefix variables
7569 $cat <<EOM
7570
7571 After $package is installed, you may wish to install various
7572 add-on modules and utilities.  Typically, these add-ons will
7573 be installed under $prefix with the rest
7574 of this package.  However, you may wish to install such add-ons
7575 elsewhere under a different prefix.
7576
7577 If you do not wish to put everything under a single prefix, that's
7578 ok.  You will be prompted for the individual locations; this siteprefix
7579 is only used to suggest the defaults.
7580
7581 The default should be fine for most people.
7582
7583 EOM
7584 fn=d~+
7585 rp='Installation prefix to use for add-on modules and utilities?'
7586 : XXX Here might be another good place for an installstyle setting.
7587 case "$siteprefix" in
7588 '') dflt=$prefix ;;
7589 *)  dflt=$siteprefix ;;
7590 esac
7591 . ./getfile
7592 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7593 oldsiteprefix=''
7594 case "$siteprefix" in
7595 '') ;;
7596 *)      case "$ans" in
7597         "$prefix") ;;
7598         *) oldsiteprefix="$prefix";;
7599         esac
7600         ;;
7601 esac
7602 siteprefix="$ans"
7603 siteprefixexp="$ansexp"
7604
7605 : determine where site specific libraries go.
7606 : Usual default is /usr/local/lib/perl5/site_perl/$version
7607 : The default "style" setting is made in installstyle.U
7608 : XXX No longer works with Prefixit stuff.
7609 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7610 case "$sitelib" in
7611 '') case "$installstyle" in
7612         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7613         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7614         esac
7615         ;;
7616 *)      dflt="$sitelib"
7617         ;;
7618 esac
7619 $cat <<EOM
7620
7621 The installation process will create a directory for
7622 site-specific extensions and modules.  Most users find it convenient
7623 to place all site-specific files in this directory rather than in the
7624 main distribution directory.
7625
7626 EOM
7627 fn=d~+
7628 rp='Pathname for the site-specific library files?'
7629 . ./getfile
7630 prefixvar=sitelib
7631 . ./setprefixvar
7632 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7633
7634 : Determine list of previous versions to include in @INC
7635 $cat > getverlist <<EOPL
7636 #!$perl5 -w
7637 use File::Basename;
7638 \$api_versionstring = "$api_versionstring";
7639 \$version = "$version";
7640 \$stem = "$sitelib_stem";
7641 \$archname = "$archname";
7642 EOPL
7643         $cat >> getverlist <<'EOPL'
7644 # The list found is store twice for each entry: the original name, and
7645 # the binary broken down version as pack "sss", so sorting is easy and
7646 # unambiguous. This will work for all versions that have a maximum of
7647 # three digit groups, separate by '.'s or '_'s. Names are extended with
7648 # ".0.0" to ensure at least three elements for the pack.
7649 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7650
7651 # Can't have leading @ because metaconfig interprets it as a command!
7652 ;@inc_version_list=();
7653 # XXX Redo to do opendir/readdir?
7654 if (-d $stem) {
7655     chdir($stem);
7656     ;@candidates = map {
7657         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7658     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7659 }
7660 else {
7661     ;@candidates = ();
7662 }
7663
7664 ($pversion, $aversion, $vsn5005) = map {
7665     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7666 foreach $d (@candidates) {
7667     if ($d->[1] lt $pversion) {
7668         if ($d->[1] ge $aversion) {
7669             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7670         }
7671         elsif ($d->[1] ge $vsn5005) {
7672             unshift(@inc_version_list, grep { -d } $d->[0]);
7673         }
7674     }
7675     else {
7676         # Skip newer version.  I.e. don't look in
7677         # 5.7.0 if we're installing 5.6.1.
7678     }
7679 }
7680
7681 if (@inc_version_list) {
7682     print join(' ', @inc_version_list);
7683 }
7684 else {
7685     # Blank space to preserve value for next Configure run.
7686     print " ";
7687 }
7688 EOPL
7689 chmod +x getverlist
7690 case "$inc_version_list" in
7691 '')     if test -x "$perl5$exe_ext"; then
7692                 dflt=`$perl5 getverlist`
7693         else
7694                 dflt='none'
7695         fi
7696         ;;
7697 $undef) dflt='none' ;;
7698 *)  eval dflt=\"$inc_version_list\" ;;
7699 esac
7700 case "$dflt" in
7701 ''|' ') dflt=none ;;
7702 esac
7703 case "$dflt" in
7704 5.005) dflt=none ;;
7705 esac
7706 $cat <<EOM
7707
7708 In order to ease the process of upgrading, this version of perl
7709 can be configured to use modules built and installed with earlier
7710 versions of perl that were installed under $prefix.  Specify here
7711 the list of earlier versions that this version of perl should check.
7712 If Configure detected no earlier versions of perl installed under
7713 $prefix, then the list will be empty.  Answer 'none' to tell perl
7714 to not search earlier versions.
7715
7716 The default should almost always be sensible, so if you're not sure,
7717 just accept the default.
7718 EOM
7719
7720 rp='List of earlier versions to include in @INC?'
7721 . ./myread
7722 case "$ans" in
7723 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7724 *) inc_version_list="$ans" ;;
7725 esac
7726 case "$inc_version_list" in
7727 ''|' ')
7728         inc_version_list_init='0'
7729         d_inc_version_list="$undef"
7730         ;;
7731 *)      inc_version_list_init=`echo $inc_version_list |
7732                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7733         d_inc_version_list="$define"
7734         ;;
7735 esac
7736 $rm -f getverlist
7737
7738 : see if malloc/malloc.h has to be included
7739 set malloc/malloc.h i_mallocmalloc
7740 eval $inhdr
7741
7742 : see if this is a malloc.h system
7743 : we want a real compile instead of Inhdr because some systems have a
7744 : malloc.h that just gives a compile error saying to use stdlib.h instead
7745 echo " "
7746 $cat >try.c <<EOCP
7747 #include <stdlib.h>
7748 #include <malloc.h>
7749 #$i_mallocmalloc I_MALLOCMALLOC
7750 #ifdef I_MALLOCMALLOC
7751 # include <malloc/malloc.h>
7752 #endif
7753
7754 int main () { return 0; }
7755 EOCP
7756 set try
7757 if eval $compile; then
7758     echo "<malloc.h> found." >&4
7759     val="$define"
7760 else
7761     echo "<malloc.h> NOT found." >&4
7762     val="$undef"
7763 fi
7764 $rm_try
7765 set i_malloc
7766 eval $setvar
7767
7768 : check for length of pointer
7769 echo " "
7770 case "$ptrsize" in
7771 '')
7772         echo "Checking to see how big your pointers are..." >&4
7773         $cat >try.c <<EOCP
7774 #include <stdio.h>
7775 #$i_stdlib I_STDLIB
7776 #ifdef I_STDLIB
7777 #include <stdlib.h>
7778 #endif
7779 int main()
7780 {
7781     printf("%d\n", (int)sizeof(void *));
7782     exit(0);
7783 }
7784 EOCP
7785         set try
7786         if eval $compile_ok; then
7787                 ptrsize=`$run ./try`
7788                 echo "Your pointers are $ptrsize bytes long."
7789         else
7790                 dflt='4'
7791                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7792                 rp="What is the size of a pointer (in bytes)?"
7793                 . ./myread
7794                 ptrsize="$ans"
7795         fi
7796         ;;
7797 esac
7798 $rm_try
7799 case "$use64bitall" in
7800 "$define"|true|[yY]*)
7801         case "$ptrsize" in
7802         4)      cat <<EOM >&4
7803
7804 *** You have chosen a maximally 64-bit build,
7805 *** but your pointers are only 4 bytes wide.
7806 *** Please rerun Configure without -Duse64bitall.
7807 EOM
7808                 case "$d_quad" in
7809                 define)
7810                         cat <<EOM >&4
7811 *** Since you have quads, you could possibly try with -Duse64bitint.
7812 EOM
7813                         ;;
7814                 esac
7815                 cat <<EOM >&4
7816 *** Cannot continue, aborting.
7817
7818 EOM
7819
7820                 exit 1
7821                 ;;
7822         esac
7823         ;;
7824 esac
7825
7826
7827 : determine whether to use malloc wrapping
7828 echo " "
7829 case "$usemallocwrap" in
7830 [yY]*|true|$define)     dflt='y' ;;
7831 [nN]*|false|$undef)     dflt='n' ;;
7832 *)      case "$usedevel" in
7833         [yY]*|true|$define)     dflt='y' ;;
7834         *) dflt='n' ;;
7835         esac
7836         ;;
7837 esac
7838 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7839 . ./myread
7840 usemallocwrap="$ans"
7841 case "$ans" in
7842 y*|true)
7843         usemallocwrap="$define" ;;
7844 *)
7845         usemallocwrap="$undef" ;;
7846 esac
7847
7848 : determine which malloc to compile in
7849 echo " "
7850 case "$usemymalloc" in
7851 [yY]*|true|$define)     dflt='y' ;;
7852 [nN]*|false|$undef)     dflt='n' ;;
7853 *)      case "$ptrsize" in
7854         4) dflt='y' ;;
7855         *) dflt='n' ;;
7856         esac
7857         if test "$useithreads" = "$define"; then dflt='n'; fi
7858         ;;
7859 esac
7860 rp="Do you wish to attempt to use the malloc that comes with $package?"
7861 . ./myread
7862 usemymalloc="$ans"
7863 case "$ans" in
7864 y*|true)
7865         usemymalloc='y'
7866         mallocsrc='malloc.c'
7867         mallocobj="malloc$_o"
7868         d_mymalloc="$define"
7869         case "$libs" in
7870         *-lmalloc*)
7871                 : Remove malloc from list of libraries to use
7872                 echo "Removing unneeded -lmalloc from library list" >&4
7873                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7874                 shift
7875                 libs="$*"
7876                 echo "libs = $libs" >&4
7877                 ;;
7878         esac
7879         ;;
7880 *)
7881         usemymalloc='n'
7882         mallocsrc=''
7883         mallocobj=''
7884         d_mymalloc="$undef"
7885         ;;
7886 esac
7887
7888 : compute the return types of malloc and free
7889 echo " "
7890 $cat >malloc.c <<END
7891 #$i_malloc I_MALLOC
7892 #$i_stdlib I_STDLIB
7893 #include <stdio.h>
7894 #include <sys/types.h>
7895 #ifdef I_MALLOC
7896 #include <malloc.h>
7897 #endif
7898 #ifdef I_STDLIB
7899 #include <stdlib.h>
7900 #endif
7901 #ifdef TRY_MALLOC
7902 void *malloc();
7903 #endif
7904 #ifdef TRY_FREE
7905 void free();
7906 #endif
7907 END
7908 case "$malloctype" in
7909 '')
7910         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7911                 malloctype='void *'
7912         else
7913                 malloctype='char *'
7914         fi
7915         ;;
7916 esac
7917 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7918
7919 case "$freetype" in
7920 '')
7921         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7922                 freetype='void'
7923         else
7924                 freetype='int'
7925         fi
7926         ;;
7927 esac
7928 echo "Your system uses $freetype free(), it would seem." >&4
7929 $rm -f malloc.[co]
7930 : determine where site specific architecture-dependent libraries go.
7931 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7932 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7933 : sitelib may have an optional trailing /share.
7934 case "$sitearch" in
7935 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7936         dflt="$dflt/$archname"
7937         ;;
7938 *)      dflt="$sitearch"
7939         ;;
7940 esac
7941 set sitearch sitearch none
7942 eval $prefixit
7943 $cat <<EOM
7944
7945 The installation process will also create a directory for
7946 architecture-dependent site-specific extensions and modules.
7947
7948 EOM
7949 fn=d~+
7950 rp='Pathname for the site-specific architecture-dependent library files?'
7951 . ./getfile
7952 prefixvar=sitearch
7953 . ./setprefixvar
7954 if $test X"$sitearch" = X"$sitelib"; then
7955         d_sitearch="$undef"
7956 else
7957         d_sitearch="$define"
7958 fi
7959
7960 : Set the vendorprefix variables
7961 $cat <<EOM
7962
7963 The installation process will also create a directory for
7964 vendor-supplied add-ons.  Vendors who supply perl with their system
7965 may find it convenient to place all vendor-supplied files in this
7966 directory rather than in the main distribution directory.  This will
7967 ease upgrades between binary-compatible maintenance versions of perl.
7968
7969 Of course you may also use these directories in whatever way you see
7970 fit.  For example, you might use them to access modules shared over a
7971 company-wide network.
7972
7973 The default answer should be fine for most people.
7974 This causes further questions about vendor add-ons to be skipped
7975 and no vendor-specific directories will be configured for perl.
7976
7977 EOM
7978 rp='Do you want to configure vendor-specific add-on directories?'
7979 case "$usevendorprefix" in
7980 define|true|[yY]*) dflt=y ;;
7981 *)      : User may have set vendorprefix directly on Configure command line.
7982         case "$vendorprefix" in
7983         ''|' ') dflt=n ;;
7984         *)      dflt=y ;;
7985         esac
7986         ;;
7987 esac
7988 . ./myread
7989 case "$ans" in
7990 [yY]*)  fn=d~+
7991         rp='Installation prefix to use for vendor-supplied add-ons?'
7992         case "$vendorprefix" in
7993         '') dflt="$prefix" ;;
7994         *)  dflt=$vendorprefix ;;
7995         esac
7996         . ./getfile
7997         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7998         oldvendorprefix=''
7999         case "$vendorprefix" in
8000         '') ;;
8001         *)      case "$ans" in
8002                 "$prefix") ;;
8003                 *) oldvendorprefix="$prefix";;
8004                 esac
8005                 ;;
8006         esac
8007         usevendorprefix="$define"
8008         vendorprefix="$ans"
8009         vendorprefixexp="$ansexp"
8010         ;;
8011 *)      usevendorprefix="$undef"
8012         vendorprefix=''
8013         vendorprefixexp=''
8014         ;;
8015 esac
8016
8017 : Set the vendorlib variables
8018 case "$vendorprefix" in
8019 '')     d_vendorlib="$undef"
8020         vendorlib=''
8021         vendorlibexp=''
8022         ;;
8023 *)      d_vendorlib="$define"
8024         : determine where vendor-supplied modules go.
8025         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
8026         case "$vendorlib" in
8027         '')
8028                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8029                 case "$installstyle" in
8030                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
8031                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
8032                 esac
8033                 ;;
8034         *)      dflt="$vendorlib"
8035                 ;;
8036         esac
8037         fn=d~+
8038         rp='Pathname for the vendor-supplied library files?'
8039         . ./getfile
8040         vendorlib="$ans"
8041         vendorlibexp="$ansexp"
8042         ;;
8043 esac
8044 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
8045 prefixvar=vendorlib
8046 . ./installprefix
8047
8048 : Set the vendorarch variables
8049 case "$vendorprefix" in
8050 '')     d_vendorarch="$undef"
8051         vendorarch=''
8052         vendorarchexp=''
8053         ;;
8054 *)      d_vendorarch="$define"
8055         : determine where vendor-supplied architecture-dependent libraries go.
8056         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
8057         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
8058         : vendorlib may have an optional trailing /share.
8059         case "$vendorarch" in
8060         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
8061                 dflt="$dflt/$archname"
8062                 ;;
8063         *)      dflt="$vendorarch" ;;
8064         esac
8065         fn=d~+
8066         rp='Pathname for vendor-supplied architecture-dependent files?'
8067         . ./getfile
8068         vendorarch="$ans"
8069         vendorarchexp="$ansexp"
8070         ;;
8071 esac
8072 prefixvar=vendorarch
8073 . ./installprefix
8074 if $test X"$vendorarch" = X"$vendorlib"; then
8075         d_vendorarch="$undef"
8076 else
8077         d_vendorarch="$define"
8078 fi
8079
8080 : Final catch-all directories to search
8081 $cat <<EOM
8082
8083 Lastly, you can have perl look in other directories for extensions and
8084 modules in addition to those already specified.
8085 These directories will be searched after
8086         $sitearch
8087         $sitelib
8088 EOM
8089 test X"$vendorlib" != "X" && echo '     ' $vendorlib
8090 test X"$vendorarch" != "X" && echo '    ' $vendorarch
8091 echo ' '
8092 case "$otherlibdirs" in
8093 ''|' ') dflt='none' ;;
8094 *)      dflt="$otherlibdirs" ;;
8095 esac
8096 $cat <<EOM
8097 Enter a colon-separated set of extra paths to include in perl's @INC
8098 search path, or enter 'none' for no extra paths.
8099
8100 EOM
8101
8102 rp='Colon-separated list of additional directories for perl to search?'
8103 . ./myread
8104 case "$ans" in
8105 ' '|''|none)    otherlibdirs=' ' ;;
8106 *)      otherlibdirs="$ans" ;;
8107 esac
8108 case "$otherlibdirs" in
8109 ' ') val=$undef ;;
8110 *)      val=$define ;;
8111 esac
8112 set d_perl_otherlibdirs
8113 eval $setvar
8114
8115 : Cruising for prototypes
8116 echo " "
8117 echo "Checking out function prototypes..." >&4
8118 $cat >prototype.c <<EOCP
8119 #$i_stdlib I_STDLIB
8120 #ifdef I_STDLIB
8121 #include <stdlib.h>
8122 #endif
8123 int main(int argc, char *argv[]) {
8124         exit(0);}
8125 EOCP
8126 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
8127         echo "Your C compiler appears to support function prototypes."
8128         val="$define"
8129 else
8130         echo "Your C compiler doesn't seem to understand function prototypes."
8131         val="$undef"
8132 fi
8133 set prototype
8134 eval $setvar
8135 $rm -f prototype*
8136
8137 : Check if ansi2knr is required
8138 case "$prototype" in
8139 "$define") ;;
8140 *)      ansi2knr='ansi2knr'
8141         echo " "
8142         cat <<EOM >&4
8143
8144 $me:  FATAL ERROR:
8145 This version of $package can only be compiled by a compiler that
8146 understands function prototypes.  Unfortunately, your C compiler
8147         $cc $ccflags
8148 doesn't seem to understand them.  Sorry about that.
8149
8150 If GNU cc is available for your system, perhaps you could try that instead.
8151
8152 Eventually, we hope to support building Perl with pre-ANSI compilers.
8153 If you would like to help in that effort, please contact <perlbug@perl.org>.
8154
8155 Aborting Configure now.
8156 EOM
8157         exit 2
8158         ;;
8159 esac
8160
8161 : DTrace support
8162 dflt_dtrace='/usr/sbin/dtrace'
8163 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8164
8165 cat <<EOM
8166
8167 Perl can be built to support DTrace on platforms that support it.
8168 DTrace is a diagnosis and performance analysis tool from Sun.
8169
8170 If this doesn't make any sense to you, just accept the default.
8171 EOM
8172
8173 while $test 1 ; do
8174         case "$usedtrace" in
8175         $define|true|[yY]*)
8176                 dflt='y'
8177                 ;;
8178         ?*)
8179                 dflt='y'
8180                 dflt_dtrace=$usedtrace
8181                 ;;
8182         *)
8183                 dflt='n'
8184                 ;;
8185         esac
8186
8187         rp='Support DTrace if available?'
8188         . ./myread
8189         case "$ans" in
8190         y|Y)    val="$define" ;;
8191         *)      val="$undef" ;;
8192         esac
8193         set usedtrace
8194         eval $setvar
8195
8196         test "X$usedtrace" != "X$define" && break
8197
8198         echo " "
8199         rp='Where is the dtrace executable?'
8200         dflt=$dflt_dtrace
8201         . ./getfile
8202         val="$ans"
8203         set dtrace
8204         eval $setvar
8205
8206         if $test -f $dtrace
8207         then
8208                 if $dtrace -h -s ../perldtrace.d \
8209                         -o perldtrace.tmp >/dev/null 2>&1 \
8210                         && rm -f perldtrace.tmp
8211                 then
8212                         echo " "
8213                         echo "Good: your $dtrace knows about the -h flag."
8214                 else
8215                         cat >&2 <<EOM
8216
8217 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8218 ***
8219 *** Your installed dtrace doesn't support the -h switch to compile a D
8220 *** program into a C header. Can't continue.
8221
8222 EOM
8223                         exit 1
8224                 fi
8225                 break;
8226         fi
8227
8228         case "$fastread" in
8229         yes)
8230                 cat >&2 <<EOM
8231
8232 *** $me:  Fatal Error:  $dtrace not found.
8233 *** Can't continue.
8234
8235 EOM
8236                 exit 1
8237                 ;;
8238         *)
8239                 echo "*** $dtrace was not found."
8240                 echo " "
8241                 ;;
8242         esac
8243 done
8244
8245 : See if we want extra modules installed
8246 echo " "
8247 case "$extras" in
8248 '') dflt='n';;
8249 *) dflt='y';;
8250 esac
8251 cat <<EOM
8252 Perl can be built with extra modules or bundles of modules which
8253 will be fetched from the CPAN and installed alongside Perl.
8254
8255 Notice that you will need access to the CPAN; either via the Internet,
8256 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8257 be asked later to configure the CPAN.pm module which will in turn do
8258 the installation of the rest of the extra modules or bundles.)
8259
8260 Notice also that if the modules require any external software such as
8261 libraries and headers (the libz library and the zlib.h header for the
8262 Compress::Zlib module, for example) you MUST have any such software
8263 already installed, this configuration process will NOT install such
8264 things for you.
8265
8266 If this doesn't make any sense to you, just accept the default '$dflt'.
8267 EOM
8268 rp='Install any extra modules (y or n)?'
8269 . ./myread
8270 case "$ans" in
8271 y|Y)
8272         cat <<EOM
8273
8274 Please list any extra modules or bundles to be installed from CPAN,
8275 with spaces between the names.  The names can be in any format the
8276 'install' command of CPAN.pm will understand.  (Answer 'none',
8277 without the quotes, to install no extra modules or bundles.)
8278 EOM
8279         rp='Extras?'
8280         dflt="$extras"
8281         . ./myread
8282         extras="$ans"
8283 esac
8284 case "$extras" in
8285 ''|'none')
8286         val=''
8287         $rm -f ../extras.lst
8288         ;;
8289 *)      echo "(Saving the list of extras for later...)"
8290         echo "$extras" > ../extras.lst
8291         val="'$extras'"
8292         ;;
8293 esac
8294 set extras
8295 eval $setvar
8296 echo " "
8297
8298 : determine where html pages for programs go
8299 set html1dir html1dir none
8300 eval $prefixit
8301 $cat <<EOM
8302
8303 If you wish to install html files for programs in $spackage, indicate
8304 the appropriate directory here.  To skip installing html files,
8305 answer "none".
8306 EOM
8307 case "$html1dir" in
8308 ''|none|$undef|' ') dflt=none ;;
8309 *) dflt=$html1dir ;;
8310 esac
8311 fn=dn+~
8312 rp="Directory for the main $spackage html pages?"
8313 . ./getfile
8314 prefixvar=html1dir
8315 . ./setprefixvar
8316 : Use ' ' for none so value is preserved next time through Configure
8317 $test X"$html1dir" = "X" && html1dir=' '
8318
8319 : determine where html pages for libraries and modules go
8320 set html3dir html3dir none
8321 eval $prefixit
8322 $cat <<EOM
8323
8324 If you wish to install html files for modules associated with $spackage,
8325 indicate the appropriate directory here.  To skip installing html files,
8326 answer "none".
8327 EOM
8328 : There is no obvious default.  If they have specified html1dir, then
8329 : try to key off that, possibly changing .../html1 into .../html3.
8330 case "$html3dir" in
8331 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8332 *) dflt=$html3dir ;;
8333 esac
8334 fn=dn+~
8335 rp="Directory for the $spackage module html pages?"
8336 . ./getfile
8337 prefixvar=html3dir
8338 . ./setprefixvar
8339 : Use ' ' for none so value is preserved next time through Configure
8340 $test X"$html3dir" = "X" && html3dir=' '
8341
8342 : determine whether to install perl also as /usr/bin/perl
8343
8344 echo " "
8345 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8346         $cat <<EOM
8347 Many scripts expect perl to be installed as /usr/bin/perl.
8348
8349 If you want to, I can install the perl you are about to compile
8350 as /usr/bin/perl (in addition to $bin/perl).
8351 EOM
8352         if test -f /usr/bin/perl; then
8353             $cat <<EOM
8354
8355 However, please note that because you already have a /usr/bin/perl,
8356 overwriting that with a new Perl would very probably cause problems.
8357 Therefore I'm assuming you don't want to do that (unless you insist).
8358
8359 EOM
8360             case "$installusrbinperl" in
8361             "$define"|[yY]*)    dflt='y';;
8362             *)                  dflt='n';;
8363             esac
8364         else
8365             $cat <<EOM
8366
8367 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8368
8369 EOM
8370             case "$installusrbinperl" in
8371             "$undef"|[nN]*)     dflt='n';;
8372             *)                  dflt='y';;
8373             esac
8374         fi
8375         rp="Do you want to install perl as /usr/bin/perl?"
8376         . ./myread
8377         case "$ans" in
8378         [yY]*)  val="$define";;
8379         *)      val="$undef" ;;
8380         esac
8381 else
8382         val="$undef"
8383 fi
8384 set installusrbinperl
8385 eval $setvar
8386
8387 : see if dlopen exists
8388 xxx_runnm="$runnm"
8389 xxx_ccflags="$ccflags"
8390 runnm=false
8391 : with g++ one needs -shared to get is-in-libc to work for dlopen
8392 case "$gccversion" in
8393 '')     ;;
8394 *Clang*)        ;;
8395 *)      case "$d_cplusplus" in
8396         "$define") ccflags="$ccflags -shared" ;;
8397         esac
8398         ;;
8399 esac
8400 set dlopen d_dlopen
8401 eval $inlibc
8402 runnm="$xxx_runnm"
8403 ccflags="$xxx_ccflags"
8404
8405 : see if this is a unistd.h system
8406 set unistd.h i_unistd
8407 eval $inhdr
8408
8409 : determine which dynamic loading, if any, to compile in
8410 echo " "
8411 dldir="ext/DynaLoader"
8412 case "$usedl" in
8413     $define|y|true)
8414         dflt='y'
8415         usedl="$define"
8416         ;;
8417     $undef|n|false)
8418         dflt='n'
8419         usedl="$undef"
8420         ;;
8421     *)
8422         dflt='n'
8423         case "$d_dlopen" in
8424             $define) dflt='y' ;;
8425         esac
8426         : Does a dl_xxx.xs file exist for this operating system
8427         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8428         ;;
8429 esac
8430 rp="Do you wish to use dynamic loading?"
8431 . ./myread
8432 usedl="$ans"
8433 bin_ELF="$undef"
8434 case "$ans" in
8435     y*) usedl="$define"
8436         case "$dlsrc" in
8437             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8438                     dflt="$dldir/dl_${osname}.xs"
8439                 elif $test "$d_dlopen" = "$define" ; then
8440                     dflt="$dldir/dl_dlopen.xs"
8441                 else
8442                     dflt=''
8443                 fi
8444                 ;;
8445             *)  dflt="$dldir/$dlsrc"
8446                 ;;
8447         esac
8448         echo "The following dynamic loading files are available:"
8449         : Can not go over to $dldir because getfile has path hard-coded in.
8450         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8451         rp="Source file to use for dynamic loading"
8452         fn="fne"
8453         gfpth="$src"
8454         . ./getfile
8455         usedl="$define"
8456         : emulate basename
8457         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8458
8459         $cat << EOM
8460
8461 Some systems may require passing special flags to $cc -c to
8462 compile modules that will be used to create a shared library.
8463 To use no flags, say "none".
8464
8465 EOM
8466         case "$cccdlflags" in
8467             '') case "$gccversion" in
8468                 '') case "$osname" in
8469                         hpux)   dflt='+z' ;;
8470                         irix*)  dflt='-KPIC' ;;
8471                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8472                         sunos)  dflt='-pic' ;;
8473                         *)      dflt='none' ;;
8474                     esac
8475                     ;;
8476                 *)  case "$osname" in
8477                         darwin) dflt='none' ;;
8478                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8479                         *)      dflt='-fpic' ;;
8480                     esac ;;
8481                 esac ;;
8482             ' ') dflt='none' ;;
8483             *)   dflt="$cccdlflags" ;;
8484         esac
8485
8486         case "$dflt" in
8487             none) dflt='' ;;
8488         esac
8489
8490         # If -Dsysroot was specified, now's the time to add it
8491         # to cccdlflags
8492         if test "X$sysroot" != X; then
8493             case "$gccversion" in
8494                 '') ;;
8495                 *)  case "$dflt" in
8496                         *sysroot*) ;;
8497                         'undef'|*)
8498                             dflt="$dflt --sysroot=$sysroot" ;;
8499                     esac
8500                     ;;
8501             esac
8502         fi
8503
8504         case "$dflt" in
8505             '') dflt='none';;
8506         esac
8507
8508         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8509         . ./myread
8510         case "$ans" in
8511             none) cccdlflags=' ' ;;
8512             *)    cccdlflags="$ans" ;;
8513         esac
8514
8515         cat << EOM
8516
8517 Some systems use ld to create libraries that can be dynamically loaded,
8518 while other systems (such as those using ELF) use $cc.
8519
8520 EOM
8521
8522 : Determine if this is ELF
8523         $cat >try.c <<EOM
8524 /* Test for whether ELF binaries are produced */
8525 #include <fcntl.h>
8526 #$i_stdlib I_STDLIB
8527 #ifdef I_STDLIB
8528 #include <stdlib.h>
8529 #endif
8530 #$i_unistd I_UNISTD
8531 #ifdef I_UNISTD
8532 #include <unistd.h>
8533 #endif
8534 int main() {
8535     char b[4];
8536     int i = open("a.out",O_RDONLY);
8537     if(i == -1)
8538         exit(1); /* fail */
8539     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8540         exit(0); /* succeed (yes, it is ELF) */
8541     exit(1); /* fail */
8542 }
8543 EOM
8544         if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8545             bin_ELF="$define"
8546         fi
8547         $rm_try
8548
8549         case "$ld" in
8550             '') if $test $bin_ELF = "$define"; then
8551                     cat <<EOM
8552 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8553 EOM
8554                     dflt="$cc"
8555                 else
8556                     echo "I'll use ld to build dynamic libraries."
8557                     dflt='ld'
8558                 fi
8559                 ;;
8560             *)  dflt="$ld"
8561                 ;;
8562         esac
8563
8564         rp="What command should be used to create dynamic libraries?"
8565         . ./myread
8566         ld="$ans"
8567
8568         cat << EOM
8569
8570 Some systems may require passing special flags to $ld to create a
8571 library that can be dynamically loaded.  If your ld flags include
8572 -L/other/path options to locate libraries outside your loader's normal
8573 search path, you may need to specify those -L options here as well.  To
8574 use no flags, say "none".
8575
8576 EOM
8577         case "$lddlflags" in
8578             '') case "$osname" in
8579                     haiku) dflt='-shared' ;;
8580                     hpux) dflt='-b';
8581                           case "$gccversion" in
8582                               '') dflt="$dflt +vnocompatwarnings" ;;
8583                           esac
8584                           ;;
8585                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8586                     solaris) # See [perl #66604].
8587                             # On Solaris 11, gcc -m64 on amd64
8588                             # appears not to understand -G.  gcc versions at
8589                             # least as old as 3.4.3 support -shared, so just
8590                             # use that with Solaris 11 and later, but keep
8591                             # the old behavior for older Solaris versions.
8592                             case "$gccversion" in
8593                                 '') dflt='-G' ;;
8594                                 *)  case "$osvers" in
8595                                         2.?|2.10) dflt='-G' ;;
8596                                         *) dflt='-shared' ;;
8597                                     esac
8598                                     ;;
8599                             esac
8600                             ;;
8601                     sunos) dflt='-assert nodefinitions' ;;
8602                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8603                     *)     dflt='none' ;;
8604                 esac
8605                 ;;
8606             *) dflt="$lddlflags" ;;
8607         esac
8608
8609         : Only do this for gcc, since, for example, qcc has no concept
8610         : of --sysroot.
8611         if $test "X$sysroot" != X; then
8612             case "$gccversion" in
8613                 '') ;;
8614                 *)  dflt="$dflt --sysroot $sysroot" ;;
8615             esac
8616         fi
8617
8618         : Try to guess additional flags to pick up local libraries.
8619         : Be careful not to append to a plain 'none'
8620         case "$dflt" in
8621             none) dflt='' ;;
8622         esac
8623         for thisflag in $ldflags; do
8624             case "$thisflag" in
8625                 -L*|-R*|-Wl,-R*)
8626                     case " $dflt " in
8627                         *" $thisflag "*) ;;
8628                         *) dflt="$dflt $thisflag" ;;
8629                     esac
8630                     ;;
8631             esac
8632         done
8633
8634         case "$dflt" in
8635             ''|' ') dflt='none' ;;
8636         esac
8637
8638         case "$ldflags" in
8639             *-fstack-protector-strong*)
8640                 case "$dflt" in
8641                     *-fstack-protector-strong*) ;; # Don't add it again
8642                     *) dflt="$dflt -fstack-protector-strong" ;;
8643                 esac
8644                 ;;
8645             *-fstack-protector*)
8646                 case "$dflt" in
8647                     *-fstack-protector*) ;; # Don't add it again
8648                     *) dflt="$dflt -fstack-protector" ;;
8649                 esac
8650                 ;;
8651         esac
8652
8653         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8654         . ./myread
8655         case "$ans" in
8656             none) lddlflags=' ' ;;
8657             *) lddlflags="$ans" ;;
8658         esac
8659
8660         cat <<EOM
8661
8662 Some systems may require passing special flags to $cc to indicate that
8663 the resulting executable will use dynamic linking.  To use no flags,
8664 say "none".
8665
8666 EOM
8667         case "$ccdlflags" in
8668             '') case "$osname" in
8669                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8670                     sunos)             dflt='none'   ;;
8671                     *)                 dflt='none'   ;;
8672                 esac ;;
8673             ' ') dflt='none' ;;
8674             *)   dflt="$ccdlflags" ;;
8675         esac
8676         rp="Any special flags to pass to $cc to use dynamic linking?"
8677         . ./myread
8678         case "$ans" in
8679             none) ccdlflags=' ' ;;
8680             *)    ccdlflags="$ans" ;;
8681         esac
8682         ;;
8683
8684     *)  usedl="$undef"
8685         ld='ld'
8686         dlsrc='dl_none.xs'
8687         lddlflags=''
8688         ccdlflags=''
8689         ;;
8690 esac
8691
8692 ld_can_script="$undef"
8693 case "$bin_ELF$usedl" in
8694     $define$define)
8695         # Abuse try.h and a.out names for neat cleanup
8696         $cat >try.c <<EOM
8697 void foo() {}
8698 void bar() {}
8699 EOM
8700         $cat >try.h <<EOM
8701 LIBTEST_42 {
8702  global:
8703   foo;
8704  local: *;
8705  };
8706 EOM
8707         if $cc $cccdlflags $ccdlflags $ccflags \
8708                $ldflags $lddlflags -o a.out try.c \
8709                -Wl,--version-script=try.h >/dev/null 2>&1 \
8710            &&  $test -s a.out ; then
8711             echo "ld supports scripting" >&4
8712             ld_can_script="$define"
8713         else
8714             echo "ld does not support scripting" >&4
8715         fi
8716         $rm_try
8717         ;;
8718 esac
8719
8720 : Do we want a shared libperl?
8721 also=''
8722 case "$usedl" in
8723 $undef)
8724         # No dynamic loading being used, so don't bother even to prompt.
8725         useshrplib='false'
8726         ;;
8727 *)      case "$useshrplib" in
8728         '')     case "$osname" in
8729                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8730                         dflt=y
8731                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8732                         ;;
8733                 *)      dflt=n
8734                         ;;
8735                 esac
8736                 ;;
8737         $define|true|[Yy]*)
8738                 dflt=y
8739                 ;;
8740         *)      dflt=n
8741                 ;;
8742         esac
8743         $cat << EOM
8744
8745 The perl executable is normally obtained by linking perlmain.c with
8746 libperl${_a}, any static extensions (usually just DynaLoader), and
8747 any other libraries needed on this system (such as -lm, etc.).  Since
8748 your system supports dynamic loading, it is probably possible to build
8749 a shared libperl.$so.  If you will have more than one executable linked
8750 to libperl.$so, this will significantly reduce the size of each
8751 executable, but it may have a noticeable effect on performance.  The
8752 default is probably sensible for your system.
8753 $also
8754
8755 EOM
8756         rp="Build a shared libperl.$so (y/n)"
8757         . ./myread
8758         case "$ans" in
8759         true|$define|[Yy]*)
8760                 useshrplib='true'  ;;
8761         *)      useshrplib='false' ;;
8762         esac
8763         ;;
8764 esac
8765
8766 case "$useshrplib" in
8767 true)
8768         case "$userelocatableinc" in
8769         true|define)
8770                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8771                 echo "See INSTALL for an explanation why that won't work." >&4
8772                 exit 4
8773                 ;;
8774         esac
8775         case "$libperl" in
8776         '')
8777                 # Figure out a good name for libperl.so.  Since it gets stored in
8778                 # a version-specific architecture-dependent library, the version
8779                 # number isn't really that important, except for making cc/ld happy.
8780                 #
8781                 # A name such as libperl.so.10.1
8782                 majmin="libperl.$so.$patchlevel.$subversion"
8783                 # A name such as libperl.so.100
8784                 majonly=`echo $patchlevel $subversion |
8785                         $awk '{printf "%d%02d", $1, $2}'`
8786                 majonly=libperl.$so.$majonly
8787                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8788                 # rely on figuring it out from the naming of libc.
8789                 case "${osname}${osvers}" in
8790                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8791                         dflt=libperl.$so
8792                         ;;
8793                 cygwin*) # ld links now against the dll directly
8794                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8795                         majonly=`echo $patchlevel $subversion |
8796                                 $awk '{printf "%03d%03d", $1, $2}'`
8797                         majonly=cygperl5.$majonly.$so
8798                         dflt=$majmin
8799                         ;;
8800                 *)      # Try to guess based on whether libc has major.minor.
8801                         case "$libc" in
8802                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8803                         *libc.$so.[0-9]*) dflt=$majonly ;;
8804                         *)      dflt=libperl.$so ;;
8805                         esac
8806                         ;;
8807                 esac
8808                 ;;
8809         *)      dflt=$libperl
8810                 ;;
8811         esac
8812         cat << EOM
8813
8814 I need to select a good name for the shared libperl.  If your system uses
8815 library names with major and minor numbers, then you might want something
8816 like $majmin.  Alternatively, if your system uses a single version
8817 number for shared libraries, then you might want to use $majonly.
8818 Or, your system might be quite happy with a simple libperl.$so.
8819
8820 Since the shared libperl will get installed into a version-specific
8821 architecture-dependent directory, the version number of the shared perl
8822 library probably isn't important, so the default should be o.k.
8823
8824 EOM
8825         rp='What name do you want to give to the shared libperl?'
8826         . ./myread
8827         libperl=$ans
8828         echo "Ok, I'll use $libperl"
8829         ;;
8830 *)
8831         libperl="libperl${_a}"
8832         ;;
8833 esac
8834
8835 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8836 case "$shrpdir" in
8837 '') ;;
8838 *)      $cat >&4 <<EOM
8839 WARNING:  Use of the shrpdir variable for the installation location of
8840 the shared $libperl is not supported.  It was never documented and
8841 will not work in this version.  Let me (perlbug@perl.org)
8842 know of any problems this may cause.
8843
8844 EOM
8845         case "$shrpdir" in
8846         "$archlibexp/CORE")
8847                 $cat >&4 <<EOM
8848 But your current setting of $shrpdir is
8849 the default anyway, so it's harmless.
8850 EOM
8851                 ;;
8852         *)
8853                 $cat >&4 <<EOM
8854 Further, your current attempted setting of $shrpdir
8855 conflicts with the value of $archlibexp/CORE
8856 that installperl will use.
8857 EOM
8858                 ;;
8859         esac
8860         ;;
8861 esac
8862
8863 # How will the perl executable find the installed shared $libperl?
8864 # Add $xxx to ccdlflags.
8865 # If we can't figure out a command-line option, use $shrpenv to
8866 # set env LD_RUN_PATH.  The main perl makefile uses this.
8867 shrpdir=$archlibexp/CORE
8868 xxx=''
8869 tmp_shrpenv=''
8870 if "$useshrplib"; then
8871     case "$osname" in
8872         aix)
8873                 # We'll set it in Makefile.SH...
8874                 ;;
8875         solaris)
8876                 xxx="-R $shrpdir"
8877                 ;;
8878         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8879                 xxx="-Wl,-R$shrpdir"
8880                 ;;
8881         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8882                 xxx="-Wl,-rpath,$shrpdir"
8883                 ;;
8884         hpux*)
8885                 # hpux doesn't like the default, either.
8886                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8887                 ;;
8888         cygwin)
8889                 # cygwin needs only ldlibpth
8890                 ;;
8891         *)
8892                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8893                 ;;
8894         esac
8895         case "$xxx" in
8896         '') ;;
8897         *)
8898                 # Only add $xxx if it isn't already in ccdlflags.
8899                 case " $ccdlflags " in
8900                 *" $xxx "*)     ;;
8901                 *)      ccdlflags="$ccdlflags $xxx"
8902                         cat <<EOM >&4
8903
8904 Adding $xxx to the flags
8905 passed to $ld so that the perl executable will find the
8906 installed shared $libperl.
8907
8908 EOM
8909                         ;;
8910                 esac
8911                 ;;
8912         esac
8913 fi
8914 # Fix ccdlflags in AIX for building external extensions.
8915 # (For building Perl itself bare -bE:perl.exp is needed,
8916 #  Makefile.SH takes care of this.)
8917 case "$osname" in
8918 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8919 esac
8920 # Respect a hint or command-line value.
8921 case "$shrpenv" in
8922 '') shrpenv="$tmp_shrpenv" ;;
8923 esac
8924 case "$ldlibpthname" in
8925 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8926 none)   ldlibpthname='' ;;
8927 esac
8928
8929 : determine where manual pages are on this system
8930 echo " "
8931 case "$sysman" in
8932 '')
8933         syspath='/usr/share/man/man1 /usr/man/man1'
8934         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8935         syspath="$syspath /usr/man/u_man/man1"
8936         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8937         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8938         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8939         sysman=`./loc . /usr/man/man1 $syspath`
8940         ;;
8941 esac
8942 if $test -d "$sysman"; then
8943         echo "System manual is in $sysman." >&4
8944 else
8945         echo "Could not find manual pages in source form." >&4
8946 fi
8947
8948 : determine where manual pages go
8949 set man1dir man1dir none
8950 eval $prefixit
8951 $cat <<EOM
8952
8953 $spackage has manual pages available in source form.
8954 EOM
8955 case "$nroff" in
8956 nroff)
8957         echo "However, you don't have nroff, so they're probably useless to you."
8958         case "$man1dir" in
8959         '') man1dir="none";;
8960         esac;;
8961 esac
8962 echo "If you don't want the manual sources installed, answer 'none'."
8963 case "$man1dir" in
8964 ' ') dflt=none
8965         ;;
8966 '')
8967         lookpath="$prefixexp/share/man/man1"
8968         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8969         lookpath="$lookpath $prefixexp/man/p_man/man1"
8970         lookpath="$lookpath $prefixexp/man/u_man/man1"
8971         lookpath="$lookpath $prefixexp/man/man.1"
8972         case "$sysman" in
8973         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8974         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8975         esac
8976         set dflt
8977         eval $prefixup
8978         ;;
8979 *)  dflt="$man1dir"
8980         ;;
8981 esac
8982 echo " "
8983 fn=dn+~
8984 rp="Where do the main $spackage manual pages (source) go?"
8985 . ./getfile
8986 if $test "X$man1direxp" != "X$ansexp"; then
8987         installman1dir=''
8988 fi
8989 prefixvar=man1dir
8990 . ./setprefixvar
8991
8992 case "$man1dir" in
8993 '')     man1dir=' '
8994         installman1dir='';;
8995 esac
8996
8997 : What suffix to use on installed man pages
8998
8999 case "$man1dir" in
9000 ' ')
9001         man1ext='0'
9002         ;;
9003 *)
9004         rp="What suffix should be used for the main $spackage man pages?"
9005         case "$man1ext" in
9006         '')     case "$man1dir" in
9007                 *1)  dflt=1 ;;
9008                 *1p) dflt=1p ;;
9009                 *1pm) dflt=1pm ;;
9010                 *l) dflt=l;;
9011                 *n) dflt=n;;
9012                 *o) dflt=o;;
9013                 *p) dflt=p;;
9014                 *C) dflt=C;;
9015                 *L) dflt=L;;
9016                 *L1) dflt=L1;;
9017                 *) dflt=1;;
9018                 esac
9019                 ;;
9020         *)      dflt="$man1ext";;
9021         esac
9022         . ./myread
9023         man1ext="$ans"
9024         ;;
9025 esac
9026
9027 : see if we can have long filenames
9028 echo " "
9029 first=123456789abcdef
9030 $rm -f $first
9031 if (echo hi >$first) 2>/dev/null; then
9032         if $test -f 123456789abcde; then
9033                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
9034                 val="$undef"
9035         else
9036                 echo 'You can have filenames longer than 14 characters.'>&4
9037                 val="$define"
9038         fi
9039 else
9040         $cat <<'EOM'
9041 You can't have filenames longer than 14 chars.
9042 You can't even think about them!
9043 EOM
9044         val="$undef"
9045 fi
9046 set d_flexfnam
9047 eval $setvar
9048 $rm -rf 123456789abcde*
9049
9050 : determine where library module manual pages go
9051 set man3dir man3dir none
9052 eval $prefixit
9053 $cat <<EOM
9054
9055 $spackage has manual pages for many of the library modules.
9056 EOM
9057
9058 case "$nroff" in
9059 nroff)
9060         $cat <<'EOM'
9061 However, you don't have nroff, so they're probably useless to you.
9062 EOM
9063         case "$man3dir" in
9064         '') man3dir="none";;
9065         esac;;
9066 esac
9067
9068 case "$d_flexfnam" in
9069 undef)
9070         $cat <<'EOM'
9071 However, your system can't handle the long file names like File::Basename.3.
9072 EOM
9073         case "$man3dir" in
9074         '') man3dir="none";;
9075         esac;;
9076 esac
9077
9078 echo "If you don't want the manual sources installed, answer 'none'."
9079 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9080 case "$man3dir" in
9081 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9082         if $test -d "$privlib/man/man3"; then
9083                 cat <<EOM >&4
9084
9085 WARNING:  Previous versions of perl installed man3 pages into
9086 $privlib/man/man3.  This version will suggest a
9087 new default of $dflt.
9088 EOM
9089                 tdflt=$dflt
9090                 dflt='n'
9091                 rp='Do you wish to preserve the old behavior?(y/n)'
9092                 . ./myread
9093                 case "$ans" in
9094                 y*) dflt="$privlib/man/man3" ;;
9095                 *)  dflt=$tdflt ;;
9096                 esac
9097     fi
9098         ;;
9099 *)      dflt="$man3dir" ;;
9100 esac
9101 case "$dflt" in
9102 ' ') dflt=none ;;
9103 esac
9104 echo " "
9105 fn=dn+~
9106 rp="Where do the $package library man pages (source) go?"
9107 . ./getfile
9108 prefixvar=man3dir
9109 . ./setprefixvar
9110
9111 case "$man3dir" in
9112 '')     man3dir=' '
9113         installman3dir='';;
9114 esac
9115
9116 : What suffix to use on installed man pages
9117 case "$man3dir" in
9118 ' ')
9119         man3ext='0'
9120         ;;
9121 *)
9122         rp="What suffix should be used for the $package library man pages?"
9123         case "$man3ext" in
9124         '')     case "$man3dir" in
9125                 *3)  dflt=3 ;;
9126                 *3p) dflt=3p ;;
9127                 *3pm) dflt=3pm ;;
9128                 *l) dflt=l;;
9129                 *n) dflt=n;;
9130                 *o) dflt=o;;
9131                 *p) dflt=p;;
9132                 *C) dflt=C;;
9133                 *L) dflt=L;;
9134                 *L3) dflt=L3;;
9135                 *) dflt=3;;
9136                 esac
9137                 ;;
9138         *)      dflt="$man3ext";;
9139         esac
9140         . ./myread
9141         man3ext="$ans"
9142         ;;
9143 esac
9144
9145 : see if we have to deal with yellow pages, now NIS.
9146 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9147         case "$hostcat" in
9148         nidump*) ;;
9149         *)
9150                 case "$hostcat" in
9151                 *ypcat*) dflt=y;;
9152                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9153                                 dflt=y
9154                         else
9155                                 dflt=n
9156                         fi;;
9157                 *) dflt=n;;
9158                 esac
9159                 echo " "
9160                 rp='Are you getting the hosts file via yellow pages?'
9161                 . ./myread
9162                 case "$ans" in
9163                 y*) hostcat='ypcat hosts';;
9164                 *) hostcat='cat /etc/hosts';;
9165                 esac
9166                 ;;
9167         esac
9168 fi
9169 case "$hostcat" in
9170 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9171 esac
9172 case "$groupcat" in
9173 '') test -f /etc/group && groupcat='cat /etc/group';;
9174 esac
9175 case "$passcat" in
9176 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9177 esac
9178
9179 : now get the host name
9180 echo " "
9181 echo "Figuring out host name..." >&4
9182 case "$myhostname" in
9183 '') cont=true
9184         echo 'Maybe "hostname" will work...'
9185         if tans=`sh -c hostname 2>&1` ; then
9186                 myhostname=$tans
9187                 phostname=hostname
9188                 cont=''
9189         fi
9190         ;;
9191 *) cont='';;
9192 esac
9193 if $test "$cont"; then
9194         if ./xenix; then
9195                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9196                 if tans=`cat /etc/systemid 2>&1` ; then
9197                         myhostname=$tans
9198                         phostname='cat /etc/systemid'
9199                         echo "Whadyaknow.  Xenix always was a bit strange..."
9200                         cont=''
9201                 fi
9202         elif $test -r /etc/systemid; then
9203                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9204         fi
9205 fi
9206 if $test "$cont"; then
9207         echo 'No, maybe "uuname -l" will work...'
9208         if tans=`sh -c 'uuname -l' 2>&1` ; then
9209                 myhostname=$tans
9210                 phostname='uuname -l'
9211         else
9212                 echo 'Strange.  Maybe "uname -n" will work...'
9213                 if tans=`sh -c 'uname -n' 2>&1` ; then
9214                         myhostname=$tans
9215                         phostname='uname -n'
9216                 else
9217                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9218                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9219                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9220                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9221                         else
9222                                 case "$myhostname" in
9223                                 '') echo "Does this machine have an identity crisis or something?"
9224                                         phostname='';;
9225                                 *)
9226                                         echo "Well, you said $myhostname before..."
9227                                         phostname='echo $myhostname';;
9228                                 esac
9229                         fi
9230                 fi
9231         fi
9232 fi
9233 case "$myhostname" in
9234 '') myhostname=noname ;;
9235 esac
9236 : you do not want to know about this
9237 set $myhostname
9238 myhostname=$1
9239
9240 : verify guess
9241 if $test "$myhostname" ; then
9242         dflt=y
9243         rp='Your host name appears to be "'$myhostname'".'" Right?"
9244         . ./myread
9245         case "$ans" in
9246         y*) ;;
9247         *) myhostname='';;
9248         esac
9249 fi
9250
9251 : bad guess or no guess
9252 while $test "X$myhostname" = X ; do
9253         dflt=''
9254         rp="Please type the (one word) name of your host:"
9255         . ./myread
9256         myhostname="$ans"
9257 done
9258
9259 : translate upper to lower if necessary
9260 case "$myhostname" in
9261 *[A-Z]*)
9262         echo "(Normalizing case in your host name)"
9263         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9264         ;;
9265 esac
9266
9267 case "$myhostname" in
9268 *.*)
9269         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9270         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9271         echo "(Trimming domain name from host name--host name is now $myhostname)"
9272         ;;
9273 *) case "$mydomain" in
9274         '')
9275                 {
9276                         test "X$hostcat" = "Xypcat hosts" &&
9277                         ypmatch "$myhostname" hosts 2>/dev/null |\
9278                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9279                         $test -s hosts
9280                 } || {
9281                         test "X$hostcat" != "X" &&
9282                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9283                                         /[       ]$myhostname[  . ]/p" > hosts
9284                 }
9285                 tmp_re="[       . ]"
9286                 if $test -f hosts; then
9287                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9288                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9289                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9290                                 hosts | $sort | $uniq | \
9291                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9292                         case `$echo X$dflt` in
9293                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9294                                 dflt=.
9295                                 ;;
9296                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9297                                 ;;
9298                         esac
9299                 else
9300                         echo "(I cannot locate a hosts database anywhere)"
9301                         dflt=.
9302                 fi
9303                 case "$dflt" in
9304                 .)
9305                         tans=`./loc resolv.conf X /etc /usr/etc`
9306                         if $test -f "$tans"; then
9307                                 echo "(Attempting domain name extraction from $tans)"
9308                                 dflt=.`$sed -n -e 's/   / /g' \
9309                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9310                                   -e 1q 2>/dev/null`
9311                                 case "$dflt" in
9312                                 .) dflt=.`$sed -n -e 's/        / /g' \
9313                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9314                                      -e 1q 2>/dev/null`
9315                                         ;;
9316                                 esac
9317                         fi
9318                         ;;
9319                 esac
9320                 case "$dflt" in
9321                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9322                         dflt=.`sh -c domainname 2>/dev/null`
9323                         case "$dflt" in
9324                         '') dflt='.';;
9325                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9326                         esac
9327                         ;;
9328                 esac
9329                 case "$dflt$osname" in
9330                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9331                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9332                         ;;
9333                 esac
9334                 case "$dflt" in
9335                 .) echo "(Lost all hope -- silly guess then)"
9336                         dflt='.nonet'
9337                         ;;
9338                 esac
9339                 $rm -f hosts
9340                 ;;
9341         *) dflt="$mydomain";;
9342         esac;;
9343 esac
9344 echo " "
9345 rp="What is your domain name?"
9346 . ./myread
9347 tans="$ans"
9348 case "$ans" in
9349 '') ;;
9350 .*) ;;
9351 *) tans=".$tans";;
9352 esac
9353 mydomain="$tans"
9354
9355 : translate upper to lower if necessary
9356 case "$mydomain" in
9357 *[A-Z]*)
9358         echo "(Normalizing case in your domain name)"
9359         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9360         ;;
9361 esac
9362
9363 : a little sanity check here
9364 case "$phostname" in
9365 '') ;;
9366 *)
9367         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9368         $myhostname$mydomain|$myhostname) ;;
9369         *)
9370                 case "$phostname" in
9371                 sed*)
9372                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9373                         ;;
9374                 *)
9375                         echo "(That doesn't agree with your $phostname command, by the way.)"
9376                         ;;
9377                 esac
9378         ;;
9379         esac
9380         ;;
9381 esac
9382
9383 : determine the e-mail address of the user who is running us
9384 $cat <<EOM
9385
9386 I need to get your e-mail address in Internet format if possible, i.e.
9387 something like user@host.domain. Please answer accurately since I have
9388 no easy means to double check it. The default value provided below
9389 is most probably close to reality but may not be valid from outside
9390 your organization...
9391
9392 EOM
9393 cont=x
9394 while test "$cont"; do
9395         case "$MAILDOMAIN" in
9396         '')
9397                 if $test -s /etc/mailname; then
9398                         maildomain=`$cat /etc/mailname`
9399                 else
9400                         maildomain="$myhostname$mydomain"
9401                 fi
9402                 ;;
9403         *)  maildomain="$MAILDOMAIN";;
9404         esac
9405         case "$cf_email" in
9406         '') dflt="$cf_by@$maildomain";;
9407         *)  dflt="$cf_email";;
9408         esac
9409         rp='What is your e-mail address?'
9410         . ./myread
9411         cf_email="$ans"
9412         case "$cf_email" in
9413         *@*.*) cont='' ;;
9414         *)
9415                 rp='Address does not look like an Internet one.  Use it anyway?'
9416                 case "$fastread" in
9417                 yes) dflt=y ;;
9418                 *) dflt=n ;;
9419                 esac
9420                 . ./myread
9421                 case "$ans" in
9422                 y*) cont='' ;;
9423                 *) echo " " ;;
9424                 esac
9425                 ;;
9426         esac
9427 done
9428
9429 : Ask e-mail of administrator
9430 $cat <<EOM
9431
9432 If you or somebody else will be maintaining perl at your site, please
9433 fill in the correct e-mail address here so that they may be contacted
9434 if necessary. Currently, the "perlbug" program included with perl
9435 will send mail to this address in addition to perlbug@perl.org. You may
9436 enter "none" for no administrator.
9437
9438 EOM
9439 case "$perladmin" in
9440 '') dflt="$cf_email";;
9441 *) dflt="$perladmin";;
9442 esac
9443 rp='Perl administrator e-mail address'
9444 . ./myread
9445 perladmin="$ans"
9446
9447 : determine whether to use a version number suffix for installed binaries
9448 echo " "
9449 $cat <<EOM
9450 Do you want to use a version number suffix for installed binaries? This
9451 will install 'perl$version' instead of 'perl', and likewise for other
9452 binaries like 'perldoc' and 'cpan'. This allows many versions of perl
9453 to be installed side-by-side. Unless you are a developer, you probably
9454 do *not* want to do this.
9455 EOM
9456 case "$versiononly" in
9457 "$define"|[Yy]*|true) dflt='y' ;;
9458 *) dflt='n';
9459 esac
9460 rp="Do you want to use a version number suffix for installed binaries?"
9461 . ./myread
9462 case "$ans" in
9463 [yY]*)  val="$define";;
9464 *)      val="$undef" ;;
9465 esac
9466 set versiononly
9467 eval $setvar
9468
9469 case "$versiononly" in
9470 "$define") inc_version_list=''
9471            inc_version_list_init=0
9472            ;;
9473 esac
9474
9475 : figure out how to guarantee perl startup
9476 : XXX Note that this currently takes advantage of the bug that binexp ignores
9477 :     the Configure -Dinstallprefix setting, which in turn means that under
9478 :     relocatable @INC, initialinstalllocation is what binexp started as.
9479 case "$startperl" in
9480 '')
9481         case "$sharpbang" in
9482         *!)
9483                 $cat <<EOH
9484
9485 I can use the #! construct to start perl on your system. This will
9486 make startup of perl scripts faster, but may cause problems if you
9487 want to share those scripts and perl is not in a standard place
9488 ($initialinstalllocation/perl) on all your platforms. The alternative
9489 is to force a shell by starting the script with a single ':' character.
9490
9491 EOH
9492                 case "$versiononly" in
9493                 "$define")      dflt="$initialinstalllocation/perl$version";;
9494                 *)              dflt="$initialinstalllocation/perl";;
9495                 esac
9496                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9497                 . ./myread
9498                 case "$ans" in
9499                 none)   startperl=": # use perl";;
9500                 *)      startperl="#!$ans"
9501                         if $test 30 -lt `echo "$ans" | wc -c`; then
9502                                 $cat >&4 <<EOM
9503
9504 WARNING:  Some systems limit the #! command to 32 characters.
9505 If you experience difficulty running Perl scripts with #!, try
9506 installing Perl in a directory with a shorter pathname.
9507
9508 EOM
9509                         fi ;;
9510                 esac
9511                 ;;
9512         *) startperl=": # use perl"
9513                 ;;
9514         esac
9515         ;;
9516 esac
9517 echo "I'll use $startperl to start perl scripts."
9518
9519 : figure best path for perl in scripts
9520 case "$perlpath" in
9521 '')
9522         case "$versiononly" in
9523         "$define")      perlpath="$initialinstalllocation/perl$version";;
9524         *)              perlpath="$initialinstalllocation/perl";;
9525         esac
9526         case "$startperl" in
9527         *!*) ;;
9528         *)
9529                 $cat <<EOH
9530
9531 I will use the "eval 'exec'" idiom to start Perl on your system.
9532 I can use the full path of your Perl binary for this purpose, but
9533 doing so may cause problems if you want to share those scripts and
9534 Perl is not always in a standard place ($initialinstalllocation/perl).
9535
9536 EOH
9537                 dflt="$initialinstalllocation/perl"
9538                 rp="What path shall I use in \"eval 'exec'\"?"
9539                 . ./myread
9540                 perlpath="$ans"
9541                 ;;
9542         esac
9543         ;;
9544 esac
9545 case "$startperl" in
9546 *!*)    ;;
9547 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9548 esac
9549
9550 : determine where public executable scripts go
9551 set scriptdir scriptdir
9552 eval $prefixit
9553 case "$scriptdir" in
9554 '')
9555         dflt="$bin"
9556         : guess some guesses
9557         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9558         $test -d /usr/share/bin     && dflt=/usr/share/bin
9559         $test -d /usr/local/script  && dflt=/usr/local/script
9560         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9561         $test -d $prefixexp/script  && dflt=$prefixexp/script
9562         set dflt
9563         eval $prefixup
9564         ;;
9565 *)  dflt="$scriptdir"
9566         ;;
9567 esac
9568 $cat <<EOM
9569
9570 Some installations have a separate directory just for executable scripts so
9571 that they can mount it across multiple architectures but keep the scripts in
9572 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9573 Or you might just lump your scripts in with all your other executables.
9574
9575 EOM
9576 fn=d~
9577 rp='Where do you keep publicly executable scripts?'
9578 . ./getfile
9579 if $test "X$ansexp" != "X$scriptdirexp"; then
9580         installscript=''
9581 fi
9582 installscriptdir=''
9583 prefixvar=scriptdir
9584 . ./setprefixvar
9585 : A little fix up for an irregularly named variable.
9586 installscript="$installscriptdir"
9587
9588 : determine where add-on public executables go
9589 case "$sitebin" in
9590 '')     dflt=$siteprefix/bin ;;
9591 *)      dflt=$sitebin ;;
9592 esac
9593 fn=d~
9594 rp='Pathname where the add-on public executables should be installed?'
9595 . ./getfile
9596 prefixvar=sitebin
9597 . ./setprefixvar
9598
9599 : determine where add-on html pages go
9600 : There is no standard location, so try to copy the previously-selected
9601 : directory structure for the core html pages.
9602 case "$sitehtml1dir" in
9603 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9604 *)     dflt=$sitehtml1dir ;;
9605 esac
9606 case "$dflt" in
9607 ''|' ') dflt=none ;;
9608 esac
9609 fn=dn+~
9610 rp='Pathname where the site-specific html pages should be installed?'
9611 . ./getfile
9612 prefixvar=sitehtml1dir
9613 . ./setprefixvar
9614
9615 : determine where add-on library html pages go
9616 : There is no standard location, so try to copy the previously-selected
9617 : directory structure for the core html pages.
9618 case "$sitehtml3dir" in
9619 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9620 *)     dflt=$sitehtml3dir ;;
9621 esac
9622 case "$dflt" in
9623 ''|' ') dflt=none ;;
9624 esac
9625 fn=dn+~
9626 rp='Pathname where the site-specific library html pages should be installed?'
9627 . ./getfile
9628 prefixvar=sitehtml3dir
9629 . ./setprefixvar
9630
9631 : determine where add-on manual pages go
9632 case "$siteman1dir" in
9633 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9634 *)      dflt=$siteman1dir ;;
9635 esac
9636 case "$dflt" in
9637 ''|' ') dflt=none ;;
9638 esac
9639 fn=dn+~
9640 rp='Pathname where the site-specific manual pages should be installed?'
9641 . ./getfile
9642 prefixvar=siteman1dir
9643 . ./setprefixvar
9644
9645 : determine where add-on library man pages go
9646 case "$siteman3dir" in
9647 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9648 *)      dflt=$siteman3dir ;;
9649 esac
9650 case "$dflt" in
9651 ''|' ') dflt=none ;;
9652 esac
9653 fn=dn+~
9654 rp='Pathname where the site-specific library manual pages should be installed?'
9655 . ./getfile
9656 prefixvar=siteman3dir
9657 . ./setprefixvar
9658
9659 : determine where add-on public executable scripts go
9660 case "$sitescript" in
9661 '')     dflt=$siteprefix/script
9662         $test -d $dflt || dflt=$sitebin ;;
9663 *)  dflt="$sitescript" ;;
9664 esac
9665 fn=d~+
9666 rp='Pathname where add-on public executable scripts should be installed?'
9667 . ./getfile
9668 prefixvar=sitescript
9669 . ./setprefixvar
9670
9671 : see if backtrace exists
9672 set backtrace d_backtrace
9673 eval $inlibc
9674
9675 : add flags if using c backtrace
9676 case "$usecbacktrace" in
9677   "") usecbacktrace=$undef ;;
9678   [yY]*|true|$define)
9679     case "$d_backtrace" in
9680       [yY]*|true|$define)
9681         case " $ccflags " in
9682           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9683           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9684           esac
9685         ;;
9686       *)
9687         echo "This system does not support backtrace" >&4
9688         usecbacktrace=$undef
9689         ;;
9690       esac
9691     ;;
9692   esac
9693
9694 : Check if faststdio is requested and available
9695 case "$usefaststdio" in
9696 $define|true|[yY]*|'')
9697         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9698         case "$xversion" in
9699         [68])   dflt='y' ;;
9700         *)      dflt='n' ;;
9701         esac
9702         ;;
9703 *) dflt='n';;
9704 esac
9705 cat <<EOM
9706
9707 Perl can be built to use 'fast stdio', which means using the stdio
9708 library but also directly manipulating the stdio buffers to enable
9709 faster I/O.  Using stdio is better for backward compatibility (especially
9710 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9711 interface has been preferred instead of stdio.
9712
9713 If this doesn't make any sense to you, just accept the default '$dflt'.
9714 EOM
9715 rp='Use the "fast stdio" if available?'
9716 . ./myread
9717 case "$ans" in
9718 y|Y)    val="$define" ;;
9719 *)      val="$undef" ;;
9720 esac
9721 set usefaststdio
9722 eval $setvar
9723
9724
9725 : define an is-a-typedef? function
9726 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9727 case "$inclist" in
9728 "") inclist="sys/types.h";;
9729 esac;
9730 eval "varval=\$$var";
9731 case "$varval" in
9732 "")
9733         $rm -f temp.c;
9734         for inc in $inclist; do
9735                 echo "#include <$inc>" >>temp.c;
9736         done;
9737         echo "#ifdef $type" >> temp.c;
9738         echo "printf(\"We have $type\");" >> temp.c;
9739         echo "#endif" >> temp.c;
9740         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9741         if $contains $type temp.E >/dev/null 2>&1; then
9742                 eval "$var=\$type";
9743         else
9744                 eval "$var=\$def";
9745         fi;
9746         $rm -f temp.?;;
9747 *) eval "$var=\$varval";;
9748 esac'
9749
9750 : define an is-a-typedef? function that prompts if the type is not available.
9751 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9752 case "$inclist" in
9753 "") inclist="sys/types.h";;
9754 esac;
9755 eval "varval=\$$var";
9756 case "$varval" in
9757 "")
9758         $rm -f temp.c;
9759         for inc in $inclist; do
9760                 echo "#include <$inc>" >>temp.c;
9761         done;
9762         echo "#ifdef $type" >> temp.c;
9763         echo "printf(\"We have $type\");" >> temp.c;
9764         echo "#endif" >> temp.c;
9765         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9766         echo " " ;
9767         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9768         if $contains $type temp.E >/dev/null 2>&1; then
9769                 echo "$type found." >&4;
9770                 eval "$var=\$type";
9771         else
9772                 echo "$type NOT found." >&4;
9773                 dflt="$def";
9774                 . ./myread ;
9775                 eval "$var=\$ans";
9776         fi;
9777         $rm -f temp.?;;
9778 *) eval "$var=\$varval";;
9779 esac'
9780
9781 : see what type lseek is declared as in the kernel
9782 rp="What is the type used for lseek's offset on this system?"
9783 set off_t lseektype long stdio.h sys/types.h
9784 eval $typedef_ask
9785
9786 echo " "
9787 echo "Checking to see how big your file offsets are..." >&4
9788 $cat >try.c <<EOCP
9789 #include <sys/types.h>
9790 #include <stdio.h>
9791 int main()
9792 {
9793     printf("%d\n", (int)sizeof($lseektype));
9794     return(0);
9795 }
9796 EOCP
9797 set try
9798 if eval $compile_ok; then
9799         lseeksize=`$run ./try`
9800         echo "Your file offsets are $lseeksize bytes long."
9801 else
9802         dflt=$longsize
9803         echo " "
9804         echo "(I can't seem to compile the test program.  Guessing...)"
9805         rp="What is the size of your file offsets (in bytes)?"
9806         . ./myread
9807         lseeksize="$ans"
9808 fi
9809 $rm_try
9810
9811 : see what type file positions are declared as in the library
9812 rp="What is the type for file position used by fsetpos()?"
9813 set fpos_t fpostype long stdio.h sys/types.h
9814 eval $typedef_ask
9815
9816 : Check size for Fpos_t
9817 echo " "
9818 case "$fpostype" in
9819 *_t) zzz="$fpostype"    ;;
9820 *)   zzz="fpos_t"       ;;
9821 esac
9822 echo "Checking the size of $zzz..." >&4
9823 cat > try.c <<EOCP
9824 #include <sys/types.h>
9825 #include <stdio.h>
9826 #$i_stdlib I_STDLIB
9827 #ifdef I_STDLIB
9828 #include <stdlib.h>
9829 #endif
9830 int main() {
9831     printf("%d\n", (int)sizeof($fpostype));
9832     exit(0);
9833 }
9834 EOCP
9835 set try
9836 if eval $compile_ok; then
9837         yyy=`$run ./try`
9838         case "$yyy" in
9839         '')     fpossize=4
9840                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9841                 ;;
9842         *)      fpossize=$yyy
9843                 echo "Your $zzz is $fpossize bytes long."
9844                 ;;
9845         esac
9846 else
9847         dflt="$longsize"
9848         echo " " >&4
9849         echo "(I can't compile the test program.  Guessing...)" >&4
9850         rp="What is the size of your file positions (in bytes)?"
9851         . ./myread
9852         fpossize="$ans"
9853 fi
9854
9855 : Check for large file support
9856 # Backward compatibility (uselfs is deprecated).
9857 case "$uselfs" in
9858 "$define"|true|[yY]*)
9859         cat <<EOM >&4
9860
9861 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9862 EOM
9863         uselargefiles="$define"
9864         ;;
9865 esac
9866
9867 case "$lseeksize:$fpossize" in
9868 8:8) cat <<EOM
9869
9870 You can have files larger than 2 gigabytes.
9871 EOM
9872    val="$define" ;;
9873 *)    case "$uselargefiles" in
9874    "$undef"|false|[nN]*) dflt='n' ;;
9875    *)   dflt='y' ;;
9876    esac
9877    cat <<EOM
9878
9879 Perl can be built to understand large files (files larger than 2 gigabytes)
9880 on some systems.  To do so, Configure can be run with -Duselargefiles.
9881
9882 If this doesn't make any sense to you, just accept the default '$dflt'.
9883 EOM
9884    rp='Try to understand large files, if available?'
9885    . ./myread
9886    case "$ans" in
9887    y|Y)         val="$define" ;;
9888    *)           val="$undef"  ;;
9889    esac
9890    ;;
9891 esac
9892 set uselargefiles
9893 eval $setvar
9894 : Look for a hint-file generated 'call-back-unit'.  If the
9895 : user has specified that a large files perl is to be built,
9896 : we may need to set or change some other defaults.
9897 if $test -f uselargefiles.cbu; then
9898         echo "Your platform has some specific hints regarding large file builds, using them..."
9899         . ./uselargefiles.cbu
9900 fi
9901 case "$uselargefiles" in
9902 "$define")
9903         if $test -f uselargefiles.cbu; then
9904                 echo " "
9905                 echo "Rechecking to see how big your file offsets are..." >&4
9906                 $cat >try.c <<EOCP
9907 #include <sys/types.h>
9908 #include <stdio.h>
9909 int main()
9910 {
9911     printf("%d\n", (int)sizeof($lseektype));
9912     return(0);
9913 }
9914 EOCP
9915                 set try
9916                 if eval $compile_ok; then
9917                         lseeksize=`$run ./try`
9918                         $echo "Your file offsets are now $lseeksize bytes long."
9919                 else
9920                         dflt="$lseeksize"
9921                         echo " "
9922                         echo "(I can't seem to compile the test program.  Guessing...)"
9923                         rp="What is the size of your file offsets (in bytes)?"
9924                         . ./myread
9925                         lseeksize="$ans"
9926                 fi
9927                 case "$fpostype" in
9928                 *_t) zzz="$fpostype"    ;;
9929                 *)   zzz="fpos_t"       ;;
9930                 esac
9931                 $echo $n "Rechecking the size of $zzz...$c" >&4
9932                 $cat > try.c <<EOCP
9933 #include <sys/types.h>
9934 #include <stdio.h>
9935 #$i_stdlib I_STDLIB
9936 #ifdef I_STDLIB
9937 #include <stdlib.h>
9938 #endif
9939 int main() {
9940     printf("%d\n", (int)sizeof($fpostype));
9941     return(0);
9942 }
9943 EOCP
9944                 set try
9945                 if eval $compile_ok; then
9946                         yyy=`$run ./try`
9947                         dflt="$lseeksize"
9948                         case "$yyy" in
9949                         '')     echo " "
9950                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9951                                 ;;
9952                         *)      fpossize=$yyy
9953                                 echo " $fpossize bytes." >&4
9954                                 ;;
9955                         esac
9956                 else
9957                         dflt="$fpossize"
9958                         echo " "
9959                         echo "(I can't compile the test program.  Guessing...)" >&4
9960                         rp="What is the size of your file positions (in bytes)?"
9961                         . ./myread
9962                         fpossize="$ans"
9963                 fi
9964                 $rm_try
9965         fi
9966         ;;
9967 esac
9968
9969 : Check if we want perlio
9970 useperlio="$define"
9971
9972 : Set the vendorbin variables
9973 case "$vendorprefix" in
9974 '')     d_vendorbin="$undef"
9975         vendorbin=''
9976         vendorbinexp=''
9977         ;;
9978 *)      d_vendorbin="$define"
9979         : determine where vendor-supplied executables go.
9980         case "$vendorbin" in
9981         '') dflt=$vendorprefix/bin ;;
9982         *)      dflt="$vendorbin" ;;
9983         esac
9984         fn=d~+
9985         rp='Pathname for the vendor-supplied executables directory?'
9986         . ./getfile
9987         vendorbin="$ans"
9988         vendorbinexp="$ansexp"
9989         ;;
9990 esac
9991 prefixvar=vendorbin
9992 . ./installprefix
9993
9994 : Set the vendorhtml1dir variables
9995 case "$vendorprefix" in
9996 '')     vendorhtml1dir=''
9997         vendorhtml1direxp=''
9998         ;;
9999 *)      : determine where vendor-supplied html pages go.
10000         : There is no standard location, so try to copy the previously-selected
10001         : directory structure for the core html pages.
10002         : XXX Better default suggestions would be welcome.
10003         case "$vendorhtml1dir" in
10004         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10005         *)      dflt=$vendorhtml1dir ;;
10006         esac
10007         case "$dflt" in
10008         ''|' ') dflt=none ;;
10009         esac
10010         fn=dn+~
10011         rp='Pathname for the vendor-supplied html pages?'
10012         . ./getfile
10013         vendorhtml1dir="$ans"
10014         vendorhtml1direxp="$ansexp"
10015         ;;
10016 esac
10017 : Use ' ' for none so value is preserved next time through Configure
10018 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
10019 prefixvar=vendorhtml1dir
10020 . ./installprefix
10021
10022 : Set the vendorhtml3dir variables
10023 case "$vendorprefix" in
10024 '')     vendorhtml3dir=''
10025         vendorhtml3direxp=''
10026         ;;
10027 *)      : determine where vendor-supplied module html pages go.
10028         : There is no standard location, so try to copy the previously-selected
10029         : directory structure for the core html pages.
10030         : XXX Better default suggestions would be welcome.
10031         case "$vendorhtml3dir" in
10032         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10033         *)      dflt=$vendorhtml3dir ;;
10034         esac
10035         case "$dflt" in
10036         ''|' ') dflt=none ;;
10037         esac
10038         fn=dn+~
10039         rp='Pathname for the vendor-supplied html pages?'
10040         . ./getfile
10041         vendorhtml3dir="$ans"
10042         vendorhtml3direxp="$ansexp"
10043         ;;
10044 esac
10045 : Use ' ' for none so value is preserved next time through Configure
10046 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
10047 prefixvar=vendorhtml3dir
10048 . ./installprefix
10049
10050 : Set the vendorman1dir variables
10051 case "$vendorprefix" in
10052 '')     vendorman1dir=''
10053         vendorman1direxp=''
10054         ;;
10055 *)      : determine where vendor-supplied manual pages go.
10056         case "$vendorman1dir" in
10057         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10058         *)      dflt=$vendorman1dir ;;
10059         esac
10060         case "$dflt" in
10061         ''|' ') dflt=none ;;
10062         esac
10063         fn=nd~+
10064         rp='Pathname for the vendor-supplied manual section 1 pages?'
10065         . ./getfile
10066         vendorman1dir="$ans"
10067         vendorman1direxp="$ansexp"
10068         ;;
10069 esac
10070 : Use ' ' for none so value is preserved next time through Configure
10071 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
10072 prefixvar=vendorman1dir
10073 . ./installprefix
10074
10075 : Set the vendorman3dir variables
10076 case "$vendorprefix" in
10077 '')     vendorman3dir=''
10078         vendorman3direxp=''
10079         ;;
10080 *)      : determine where vendor-supplied module manual pages go.
10081         case "$vendorman3dir" in
10082         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10083         *)      dflt=$vendorman3dir ;;
10084         esac
10085         case "$dflt" in
10086         ''|' ') dflt=none ;;
10087         esac
10088         fn=nd~+
10089         rp='Pathname for the vendor-supplied manual section 3 pages?'
10090         . ./getfile
10091         vendorman3dir="$ans"
10092         vendorman3direxp="$ansexp"
10093         ;;
10094 esac
10095 : Use ' ' for none so value is preserved next time through Configure
10096 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
10097 prefixvar=vendorman3dir
10098 . ./installprefix
10099
10100 : Set the vendorscript variables
10101 case "$vendorprefix" in
10102 '')     d_vendorscript="$undef"
10103         vendorscript=''
10104         vendorscriptexp=''
10105         ;;
10106 *)      d_vendorscript="$define"
10107         : determine where vendor-supplied scripts go.
10108         case "$vendorscript" in
10109         '')     dflt=$vendorprefix/script
10110                 $test -d $dflt || dflt=$vendorbin ;;
10111         *)  dflt="$vendorscript" ;;
10112         esac
10113         $cat <<EOM
10114
10115 The installation process will create a directory for
10116 vendor-supplied scripts.
10117
10118 EOM
10119         fn=d~+
10120         rp='Pathname for the vendor-supplied scripts directory?'
10121         . ./getfile
10122         vendorscript="$ans"
10123         vendorscriptexp="$ansexp"
10124         ;;
10125 esac
10126 prefixvar=vendorscript
10127 . ./installprefix
10128
10129 : script used to emit important warnings
10130 cat >warn <<EOS
10131 $startsh
10132 if test \$# -gt 0; then
10133         echo "\$@" >msg
10134 else
10135         cat >msg
10136 fi
10137 echo "*** WARNING:" >&4
10138 sed -e 's/^/*** /' <msg >&4
10139 echo "*** " >&4
10140 cat msg >>config.msg
10141 echo " " >>config.msg
10142 rm -f msg
10143 EOS
10144 chmod +x warn
10145 $eunicefix warn
10146
10147 : see which of string.h or strings.h is needed
10148 echo " "
10149 strings=`./findhdr string.h`
10150 if $test "$strings" && $test -r "$strings"; then
10151         echo "Using <string.h> instead of <strings.h>." >&4
10152         val="$define"
10153 else
10154         val="$undef"
10155         strings=`./findhdr strings.h`
10156         if $test "$strings" && $test -r "$strings"; then
10157                 echo "Using <strings.h> instead of <string.h>." >&4
10158         else
10159                 ./warn "No string header found -- You'll surely have problems."
10160         fi
10161 fi
10162 set i_string
10163 eval $setvar
10164 case "$i_string" in
10165 "$undef") strings=`./findhdr strings.h`;;
10166 *)        strings=`./findhdr string.h`;;
10167 esac
10168
10169 : see if qgcvt exists
10170 set qgcvt d_qgcvt
10171 eval $inlibc
10172
10173 : Check what kind of doubles your system has
10174 $echo "Checking the kind of doubles you have..." >&4
10175 $cat >try.c <<EOP
10176 #$i_stdlib I_STDLIB
10177 #define DOUBLESIZE $doublesize
10178 #ifdef I_STDLIB
10179 #include <stdlib.h>
10180 #endif
10181 #include <stdio.h>
10182 static const double d = -0.1;
10183 int main() {
10184   unsigned const char* b = (unsigned const char*)(&d);
10185 #if DOUBLESIZE == 4
10186   if (b[0] == 0xCD && b[3] == 0xBD) {
10187     /* IEEE 754 32-bit little-endian */
10188     printf("1\n");
10189     exit(0);
10190   }
10191   if (b[0] == 0xBD && b[3] == 0xCD) {
10192     /* IEEE 754 32-bit big-endian */
10193     printf("2\n");
10194     exit(0);
10195   }
10196   if (b[0] == 0xCC && b[3] == 0xCC) {
10197     /* VAX format F, 32-bit PDP-style mixed endian. */
10198     printf("9\n");
10199     exit(0);
10200   }
10201   if (b[0] == 0xC0 && b[3] == 0x9A) {
10202     /* IBM single 32-bit */
10203     printf("12\n");
10204     exit(0);
10205   }
10206 #endif
10207 #if DOUBLESIZE == 8
10208   if (b[0] == 0x9A && b[7] == 0xBF) {
10209     /* IEEE 754 64-bit little-endian */
10210     printf("3\n");
10211     exit(0);
10212   }
10213   if (b[0] == 0xBF && b[7] == 0x9A) {
10214     /* IEEE 754 64-bit big-endian */
10215     printf("4\n");
10216     exit(0);
10217   }
10218   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10219    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10220     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10221     * 99 99 b9 bf 9a 99 99 99 */
10222     printf("7\n");
10223     exit(0);
10224   }
10225   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10226    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10227     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10228     * 99 99 99 9a bf b9 99 99 */
10229     printf("8\n");
10230     exit(0);
10231   }
10232   if (b[0] == 0xCC && b[7] == 0xCC) {
10233    /* VAX format D, 64-bit PDP-style mixed endian. */
10234     printf("10\n");
10235     exit(0);
10236   }
10237   if (b[0] == 0xD9 && b[7] == 0x99) {
10238    /* VAX format G, 64-bit PDP-style mixed endian. */
10239     printf("11\n");
10240     exit(0);
10241   }
10242   if (b[0] == 0xC0 && b[7] == 0x9A) {
10243     /* IBM double 64-bit */
10244     printf("13\n");
10245     exit(0);
10246   }
10247   if (b[0] == 0xBF && b[7] == 0xCD) {
10248     /* CRAY single 64-bit */
10249     printf("14\n");
10250     exit(0);
10251   }
10252 #endif
10253 #if DOUBLESIZE == 16
10254   if (b[0] == 0x9A && b[15] == 0xBF) {
10255     /* IEEE 754 128-bit little-endian */
10256     printf("5\n");
10257     exit(0);
10258   }
10259   if (b[0] == 0xBF && b[15] == 0x9A) {
10260     /* IEEE 754 128-bit big-endian */
10261     printf("6\n");
10262     exit(0);
10263   }
10264 #endif
10265   /* Then there are old mainframe/miniframe formats like IBM and CRAY.
10266    * Whether those environments can still build Perl is debatable. */
10267   printf("-1\n"); /* unknown */
10268   exit(0);
10269 }
10270 EOP
10271 set try
10272 if eval $compile; then
10273     doublekind=`$run ./try`
10274 else
10275     doublekind=-1
10276 fi
10277 case "$doublekind" in
10278 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10279 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10280 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10281 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10282 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10283 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10284 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10285 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10286 9) echo "You have VAX format F 32-bit PDP-style mixed endian doubles." >&4 ;;
10287 10) echo "You have VAX format D 64-bit PDP-style mixed endian doubles." >&4 ;;
10288 11) echo "You have VAX format G 64-bit PDP-style mixed endian doubles." >&4 ;;
10289 12) echo "You have IBM short 32-bit doubles." >&4 ;;
10290 13) echo "You have IBM long 64-bit doubles." >&4 ;;
10291 14) echo "You have Cray single 64-bit doubles." >&4 ;;
10292 *) echo "Cannot figure out your double.  You Cyber, or something?" >&4 ;;
10293 esac
10294 d_double_style_ieee=$undef
10295 d_double_style_vax=$undef
10296 d_double_style_ibm=$undef
10297 d_double_style_cray=$undef
10298 case "$doublekind" in
10299 1|2|3|4|5|6|7|8) d_double_style_ieee=$define ;;
10300 9|10|11) d_double_style_vax=$define ;;
10301 12|13) d_double_style_ibm=$define ;;
10302 14) d_double_style_cray=$define ;;
10303 esac
10304 case "$d_double_style_ieee" in
10305 $define)
10306     d_double_has_inf=$define
10307     d_double_has_nan=$define
10308     d_double_has_negative_zero=$define
10309     d_double_has_subnormals=$define
10310     ;;
10311 *)
10312     d_double_has_inf=$undef
10313     d_double_has_nan=$undef
10314     d_double_has_negative_zero=$undef
10315     d_double_has_subnormals=$undef
10316     ;;
10317 esac
10318 $rm_try
10319
10320 : Check print/scan long double stuff
10321 echo " "
10322
10323 if $test X"$d_longdbl" = X"$define"; then
10324
10325 echo "Checking how to print long doubles..." >&4
10326
10327 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10328         $cat >try.c <<'EOCP'
10329 #include <sys/types.h>
10330 #include <stdio.h>
10331 int main() {
10332   double d = 123.456;
10333   printf("%.3f\n", d);
10334 }
10335 EOCP
10336         set try
10337         if eval $compile; then
10338                 yyy=`$run ./try`
10339                 case "$yyy" in
10340                 123.456)
10341                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10342                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10343                         echo "We will use %f."
10344                         ;;
10345                 esac
10346         fi
10347 fi
10348
10349 if $test X"$sPRIfldbl" = X; then
10350         $cat >try.c <<'EOCP'
10351 #include <sys/types.h>
10352 #include <stdio.h>
10353 int main() {
10354   long double d = 123.456;
10355   printf("%.3Lf\n", d);
10356 }
10357 EOCP
10358         set try
10359         if eval $compile; then
10360                 yyy=`$run ./try`
10361                 case "$yyy" in
10362                 123.456)
10363                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10364                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10365                         echo "We will use %Lf."
10366                         ;;
10367                 esac
10368         fi
10369 fi
10370
10371 if $test X"$sPRIfldbl" = X; then
10372         $cat >try.c <<'EOCP'
10373 #include <sys/types.h>
10374 #include <stdio.h>
10375 int main() {
10376   long double d = 123.456;
10377   printf("%.3llf\n", d);
10378 }
10379 EOCP
10380         set try
10381         if eval $compile; then
10382                 yyy=`$run ./try`
10383                 case "$yyy" in
10384                 123.456)
10385                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10386                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10387                         echo "We will use %llf."
10388                         ;;
10389                 esac
10390         fi
10391 fi
10392
10393 if $test X"$sPRIfldbl" = X; then
10394         $cat >try.c <<'EOCP'
10395 #include <sys/types.h>
10396 #include <stdio.h>
10397 int main() {
10398   long double d = 123.456;
10399   printf("%.3lf\n", d);
10400 }
10401 EOCP
10402         set try
10403         if eval $compile; then
10404                 yyy=`$run ./try`
10405                 case "$yyy" in
10406                 123.456)
10407                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10408                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10409                         echo "We will use %lf."
10410                         ;;
10411                 esac
10412         fi
10413 fi
10414
10415 if $test X"$sPRIfldbl" = X; then
10416         echo "Cannot figure out how to print long doubles." >&4
10417 else
10418         sSCNfldbl=$sPRIfldbl    # expect consistency
10419 fi
10420
10421 $rm_try
10422
10423 fi # d_longdbl
10424
10425 case "$sPRIfldbl" in
10426 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10427         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10428         d_SCNfldbl="$undef";
10429         ;;
10430 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10431         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10432         d_SCNfldbl="$define";
10433         ;;
10434 esac
10435
10436 : Before committing on uselongdouble, see whether that looks sane.
10437 if $test "$uselongdouble" = "$define"; then
10438     message=""
10439     echo " "
10440     echo "Checking if your long double math functions work right..." >&4
10441     $cat > try.c <<EOF
10442 #include <math.h>
10443 #include <stdio.h>
10444 int main() {
10445   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10446 }
10447 EOF
10448     case "$osname:$gccversion" in
10449     aix:)       saveccflags="$ccflags"
10450                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10451     esac
10452     set try
10453     if eval $compile_ok; then
10454       yyy=`$run ./try`
10455     fi
10456     case "$yyy" in
10457     3) echo "Your long double math functions are working correctly." >&4 ;;
10458     *) echo "Your long double math functions are broken, not using long doubles." >&4
10459        uselongdouble=$undef
10460        ;;
10461     esac
10462     $rm_try
10463     case "$osname:$gccversion" in
10464     aix:)       ccflags="$saveccflags" ;; # restore
10465     esac
10466 fi
10467
10468 : Check how to convert floats to strings.
10469
10470 if test "X$d_Gconvert" = X; then
10471
10472 echo " "
10473 echo "Checking for an efficient way to convert floats to strings."
10474 echo " " > try.c
10475 case "$uselongdouble" in
10476 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10477 esac
10478 case "$d_longdbl" in
10479 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10480 esac
10481 case "$d_PRIgldbl" in
10482 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10483 esac
10484 $cat >>try.c <<EOP
10485 #ifdef TRY_gconvert
10486 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10487 char *myname = "gconvert";
10488 #endif
10489 #ifdef TRY_gcvt
10490 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10491 char *myname = "gcvt";
10492 #endif
10493 #ifdef TRY_qgcvt
10494 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10495 char *myname = "qgcvt";
10496 #define DOUBLETYPE long double
10497 #endif
10498 #ifdef TRY_sprintf
10499 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10500 #ifdef HAS_PRIgldbl
10501 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10502 #else
10503 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10504 #endif
10505 #else
10506 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10507 #endif
10508 char *myname = "sprintf";
10509 #endif
10510
10511 #ifndef DOUBLETYPE
10512 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10513 #define DOUBLETYPE long double
10514 #else
10515 #define DOUBLETYPE double
10516 #endif
10517 #endif
10518
10519 #include <stdio.h>
10520
10521 #$i_stdlib I_STDLIB
10522 #ifdef I_STDLIB
10523 #include <stdlib.h>
10524 #endif
10525 #$i_string I_STRING
10526 #ifdef I_STRING
10527 #  include <string.h>
10528 #else
10529 #  include <strings.h>
10530 #endif
10531
10532 int checkit(char *expect, char *got)
10533 {
10534     if (strcmp(expect, got)) {
10535                 printf("%s oddity:  Expected %s, got %s\n",
10536                         myname, expect, got);
10537                 exit(1);
10538         }
10539 }
10540
10541 int main()
10542 {
10543         char buf[64];
10544         buf[63] = '\0';
10545
10546         /* This must be 1st test on (which?) platform */
10547         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10548         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10549         checkit("0.1", buf);
10550
10551         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10552         checkit("0.01", buf);
10553
10554         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10555         checkit("0.001", buf);
10556
10557         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10558         checkit("0.0001", buf);
10559
10560         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10561         if (strlen(buf) > 5)
10562             checkit("9e-005", buf); /* for Microsoft ?? */
10563         else
10564             checkit("9e-05", buf);
10565
10566         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10567         checkit("1", buf);
10568
10569         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10570         checkit("1.1", buf);
10571
10572         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10573         checkit("1.01", buf);
10574
10575         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10576         checkit("1.001", buf);
10577
10578         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10579         checkit("1.0001", buf);
10580
10581         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10582         checkit("1.00001", buf);
10583
10584         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10585         checkit("1.000001", buf);
10586
10587         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10588         checkit("0", buf);
10589
10590         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10591         checkit("-1", buf);
10592
10593         /* Some Linux gcvt's give 1.e+5 here. */
10594         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10595         checkit("100000", buf);
10596
10597         /* Some Linux gcvt's give -1.e+5 here. */
10598         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10599         checkit("-100000", buf);
10600
10601         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10602         checkit("123.456", buf);
10603
10604         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10605         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10606         /* 34 should be enough to scare even long double
10607          * places into using the e notation. */
10608         if (strlen(buf) > 5)
10609             checkit("1e+034", buf); /* for Microsoft */
10610         else
10611             checkit("1e+34", buf);
10612
10613         /* For Perl, if you add additional tests here, also add them to
10614          * t/base/num.t for benefit of platforms not using Configure or
10615          * overriding d_Gconvert */
10616
10617         exit(0);
10618 }
10619 EOP
10620 : first add preferred functions to our list
10621 xxx_list=""
10622 for xxx_convert in $gconvert_preference; do
10623     case $xxx_convert in
10624     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10625     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10626     esac
10627 done
10628 : then add any others
10629 for xxx_convert in gconvert gcvt sprintf; do
10630     case "$xxx_list" in
10631     *$xxx_convert*) ;;
10632     *) xxx_list="$xxx_list $xxx_convert" ;;
10633     esac
10634 done
10635
10636 case "$d_longdbl$uselongdouble" in
10637 "$define$define")
10638     : again, add preferred functions to our list first
10639     xxx_ld_list=""
10640     for xxx_convert in $gconvert_ld_preference; do
10641         case $xxx_convert in
10642         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10643         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10644         esac
10645     done
10646     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10647     for xxx_convert in qgcvt sprintf $xxx_list; do
10648         case "$xxx_ld_list" in
10649         $xxx_convert*|*" $xxx_convert"*) ;;
10650         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10651         esac
10652     done
10653     : if sprintf cannot do long doubles, move it to the end
10654     if test "$d_PRIgldbl" != "$define"; then
10655         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10656     fi
10657     : if no qgcvt, remove it
10658     if test "$d_qgcvt" != "$define"; then
10659         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10660     fi
10661     : use the ld_list
10662     xxx_list="$xxx_ld_list"
10663     ;;
10664 esac
10665
10666 for xxx_convert in $xxx_list; do
10667         echo "Trying $xxx_convert..."
10668         $rm -f try try$_o core
10669         set try -DTRY_$xxx_convert
10670         if eval $compile; then
10671                 echo "$xxx_convert() found." >&4
10672                 if $run ./try; then
10673                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10674                         break;
10675                 else
10676                         echo "...But $xxx_convert didn't work as I expected."
10677                         xxx_convert=''
10678                 fi
10679         else
10680                 echo "$xxx_convert NOT found." >&4
10681         fi
10682 done
10683
10684 if test X$xxx_convert = X; then
10685     echo "*** WHOA THERE!!! ***" >&4
10686     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10687     xxx_convert=sprintf
10688 fi
10689
10690 case "$xxx_convert" in
10691 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10692 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10693 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10694 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10695    "$define$define$define")
10696       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10697    "$define$define$undef")
10698       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10699    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10700    esac
10701    ;;
10702 esac
10703
10704 fi
10705 $rm_try
10706
10707 : see if _fwalk exists
10708 set fwalk d__fwalk
10709 eval $inlibc
10710
10711 : Initialize h_fcntl
10712 h_fcntl=false
10713
10714 : Initialize h_sysfile
10715 h_sysfile=false
10716
10717 : access call always available on UNIX
10718 set access d_access
10719 eval $inlibc
10720
10721 : locate the flags for 'access()'
10722 case "$d_access" in
10723 "$define")
10724         echo " "
10725         $cat >access.c <<EOCP
10726 #include <sys/types.h>
10727 #ifdef I_FCNTL
10728 #include <fcntl.h>
10729 #endif
10730 #ifdef I_SYS_FILE
10731 #include <sys/file.h>
10732 #endif
10733 #ifdef I_UNISTD
10734 #include <unistd.h>
10735 #endif
10736 #$i_stdlib I_STDLIB
10737 #ifdef I_STDLIB
10738 #include <stdlib.h>
10739 #endif
10740 int main() {
10741         exit(R_OK);
10742 }
10743 EOCP
10744         : check sys/file.h first, no particular reason here
10745         if $test `./findhdr sys/file.h` && \
10746                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10747                 h_sysfile=true;
10748                 echo "<sys/file.h> defines the *_OK access constants." >&4
10749         elif $test `./findhdr fcntl.h` && \
10750                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10751                 h_fcntl=true;
10752                 echo "<fcntl.h> defines the *_OK access constants." >&4
10753         elif $test `./findhdr unistd.h` && \
10754                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10755                 echo "<unistd.h> defines the *_OK access constants." >&4
10756         else
10757                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10758         fi
10759         ;;
10760 esac
10761 $rm -f access*
10762
10763 : see if accessx exists
10764 set accessx d_accessx
10765 eval $inlibc
10766
10767 : see if acosh exists
10768 set acosh d_acosh
10769 eval $inlibc
10770
10771 : see if aintl exists
10772 set aintl d_aintl
10773 eval $inlibc
10774
10775 : see if alarm exists
10776 set alarm d_alarm
10777 eval $inlibc
10778
10779 : see if 64bit time functions exists
10780
10781 set ctime64 d_ctime64
10782 eval $inlibc
10783
10784 set localtime64 d_localtime64
10785 eval $inlibc
10786
10787 set gmtime64 d_gmtime64
10788 eval $inlibc
10789
10790 set mktime64 d_mktime64
10791 eval $inlibc
10792
10793 set difftime64 d_difftime64
10794 eval $inlibc
10795
10796 set asctime64 d_asctime64
10797 eval $inlibc
10798
10799 : see if POSIX threads are available
10800 set pthread.h i_pthread
10801 eval $inhdr
10802
10803 : define a function to check prototypes
10804 $cat > protochk <<EOSH
10805 $startsh
10806 cc="$cc"
10807 optimize="$optimize"
10808 ccflags="$ccflags"
10809 prototype="$prototype"
10810 define="$define"
10811 rm_try="$rm_try"
10812 usethreads=$usethreads
10813 i_pthread=$i_pthread
10814 pthread_h_first=$pthread_h_first
10815 EOSH
10816
10817 $cat >> protochk <<'EOSH'
10818
10819 $rm_try
10820 foo="$1"
10821 shift
10822 while test $# -ge 2; do
10823         case "$1" in
10824                 $define) echo "#include <$2>" >> try.c ;;
10825                 literal) echo "$2" >> try.c ;;
10826         esac
10827     # Extra magic for the benefit of systems that need pthread.h
10828     # to be included early to correctly detect threadsafe functions.
10829     # Such functions must guarantee themselves, though, that the usethreads
10830     # and i_pthread have been defined, before calling protochk.
10831     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10832         echo "#include <pthread.h>" >> try.c
10833         pthread_h_done=yes
10834     fi
10835     shift 2
10836 done
10837 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10838 cat >> try.c <<'EOCP'
10839 #ifdef CAN_PROTOTYPE
10840 #define _(args) args
10841 #else
10842 #define _(args) ()
10843 #endif
10844 EOCP
10845 echo "$foo" >> try.c
10846 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10847 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10848 status=$?
10849 $rm_try
10850 exit $status
10851 EOSH
10852 chmod +x protochk
10853 $eunicefix protochk
10854
10855 : Define hasproto macro for Configure internal use
10856 hasproto='varname=$1; func=$2; shift; shift;
10857 while $test $# -ge 2; do
10858         case "$1" in
10859         $define) echo "#include <$2>";;
10860         esac ;
10861     shift 2;
10862 done > try.c;
10863 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10864 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10865         echo "$func() prototype found.";
10866         val="$define";
10867 else
10868         echo "$func() prototype NOT found.";
10869         val="$undef";
10870 fi;
10871 set $varname;
10872 eval $setvar;
10873 $rm_try tryout.c'
10874
10875 : see if sys/types.h has to be included
10876 set sys/types.h i_systypes
10877 eval $inhdr
10878
10879 : see if sys/select.h has to be included
10880 set sys/select.h i_sysselct
10881 eval $inhdr
10882
10883 : Define hasfield macro for Configure internal use
10884 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10885 while $test $# -ge 2; do
10886         case "$1" in
10887         $define) echo "#include <$2>";;
10888         esac ;
10889     shift 2;
10890 done > try.c;
10891 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10892 set try;
10893 if eval $compile; then
10894         val="$define";
10895 else
10896         val="$undef";
10897 fi;
10898 set $varname;
10899 eval $setvar;
10900 $rm_try'
10901
10902 : see if we should include time.h, sys/time.h, or both
10903 echo " "
10904 if test "X$timeincl" = X; then
10905         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10906         $echo $n "I'm now running the test program...$c"
10907         $cat >try.c <<EOCP
10908 #include <sys/types.h>
10909 #ifdef I_TIME
10910 #include <time.h>
10911 #endif
10912 #ifdef I_SYSTIME
10913 #ifdef SYSTIMEKERNEL
10914 #define KERNEL
10915 #endif
10916 #include <sys/time.h>
10917 #endif
10918 #ifdef I_SYSSELECT
10919 #include <sys/select.h>
10920 #endif
10921 #$i_stdlib I_STDLIB
10922 #ifdef I_STDLIB
10923 #include <stdlib.h>
10924 #endif
10925 int main()
10926 {
10927         struct tm foo;
10928 #ifdef S_TIMEVAL
10929         struct timeval bar;
10930 #endif
10931 #ifdef S_TIMEZONE
10932         struct timezone tzp;
10933 #endif
10934         if (foo.tm_sec == foo.tm_sec)
10935                 exit(0);
10936 #ifdef S_TIMEVAL
10937         if (bar.tv_sec == bar.tv_sec)
10938                 exit(0);
10939 #endif
10940         exit(1);
10941 }
10942 EOCP
10943         flags=''
10944         for s_timezone in '-DS_TIMEZONE' ''; do
10945         sysselect=''
10946         for s_timeval in '-DS_TIMEVAL' ''; do
10947         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10948         for i_time in '' '-DI_TIME'; do
10949         for i_systime in '-DI_SYSTIME' ''; do
10950                 case "$flags" in
10951                 '') $echo $n ".$c"
10952                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10953                         if eval $compile; then
10954                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10955                                 shift
10956                                 flags="$*"
10957                                 echo " "
10958                                 $echo $n "Succeeded with $flags$c"
10959                         fi
10960                         ;;
10961                 esac
10962         done
10963         done
10964         done
10965         done
10966         done
10967         timeincl=''
10968         echo " "
10969         case "$flags" in
10970         *SYSTIMEKERNEL*) i_systimek="$define"
10971                 timeincl=`./findhdr sys/time.h`
10972                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10973         *) i_systimek="$undef";;
10974         esac
10975         case "$flags" in
10976         *I_TIME*) i_time="$define"
10977                 timeincl=`./findhdr time.h`" $timeincl"
10978                 echo "We'll include <time.h>." >&4;;
10979         *) i_time="$undef";;
10980         esac
10981         case "$flags" in
10982         *I_SYSTIME*) i_systime="$define"
10983                 timeincl=`./findhdr sys/time.h`" $timeincl"
10984                 echo "We'll include <sys/time.h>." >&4;;
10985         *) i_systime="$undef";;
10986         esac
10987         $rm_try
10988 fi
10989 : see if struct tm knows about tm_zone
10990 case "$i_systime$i_time" in
10991 *$define*)
10992         echo " "
10993         echo "Checking to see if your struct tm has tm_zone field..." >&4
10994         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10995         eval $hasfield
10996         ;;
10997 *)      val="$undef"
10998         set d_tm_tm_zone
10999         eval $setvar
11000         ;;
11001 esac
11002 case "$d_tm_tm_zone" in
11003 "$define")      echo "Yes, it does."   ;;
11004 *)              echo "No, it doesn't." ;;
11005 esac
11006 : see if struct tm knows about tm_gmtoff
11007 case "$i_systime$i_time" in
11008 *$define*)
11009         echo " "
11010         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
11011         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
11012         eval $hasfield
11013         ;;
11014 *)      val="$undef"
11015         set d_tm_tm_gmtoff
11016         eval $setvar
11017         ;;
11018 esac
11019 case "$d_tm_tm_gmtoff" in
11020 "$define")      echo "Yes, it does."   ;;
11021 *)              echo "No, it doesn't." ;;
11022 esac
11023
11024 : see if asctime_r exists
11025 set asctime_r d_asctime_r
11026 eval $inlibc
11027 case "$d_asctime_r" in
11028 "$define")
11029         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11030         case "$d_asctime_r_proto:$usethreads" in
11031         ":define")      d_asctime_r_proto=define
11032                 set d_asctime_r_proto asctime_r $hdrs
11033                 eval $hasproto ;;
11034         *)      ;;
11035         esac
11036         case "$d_asctime_r_proto" in
11037         define)
11038         case "$asctime_r_proto" in
11039         ''|0) try='char* asctime_r(const struct tm*, char*);'
11040         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
11041         esac
11042         case "$asctime_r_proto" in
11043         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
11044         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
11045         esac
11046         case "$asctime_r_proto" in
11047         ''|0) try='int asctime_r(const struct tm*, char*);'
11048         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
11049         esac
11050         case "$asctime_r_proto" in
11051         ''|0) try='int asctime_r(const struct tm*, char*, int);'
11052         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
11053         esac
11054         case "$asctime_r_proto" in
11055         ''|0)   d_asctime_r=undef
11056                 asctime_r_proto=0
11057                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
11058         * )     case "$asctime_r_proto" in
11059                 REENTRANT_PROTO*) ;;
11060                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
11061                 esac
11062                 echo "Prototype: $try" ;;
11063         esac
11064         ;;
11065         *)      case "$usethreads" in
11066                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
11067                 esac
11068                 d_asctime_r=undef
11069                 asctime_r_proto=0
11070                 ;;
11071         esac
11072         ;;
11073 *)      asctime_r_proto=0
11074         ;;
11075 esac
11076
11077 : see if asinh exists
11078 set asinh d_asinh
11079 eval $inlibc
11080
11081 : see if atanh exists
11082 set atanh d_atanh
11083 eval $inlibc
11084
11085 : see if atolf exists
11086 set atolf d_atolf
11087 eval $inlibc
11088
11089 : see if atoll exists
11090 set atoll d_atoll
11091 eval $inlibc
11092
11093 : Look for GCC-style attribute format
11094 case "$d_attribute_format" in
11095 '')
11096 echo " "
11097 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
11098 $cat >attrib.c <<'EOCP'
11099 #include <stdio.h>
11100 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
11101 EOCP
11102 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11103         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11104                 echo "Your C compiler doesn't support __attribute__((format))."
11105                 val="$undef"
11106         else
11107                 echo "Your C compiler supports __attribute__((format))."
11108                 val="$define"
11109         fi
11110 else
11111         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11112         val="$undef"
11113 fi
11114 ;;
11115 *) val="$d_attribute_format" ;;
11116 esac
11117 set d_attribute_format
11118 eval $setvar
11119 $rm -f attrib*
11120
11121 : Look for GCC-style attribute format with null format allowed
11122 case "$d_printf_format_null" in
11123 '') case "$d_attribute_format" in
11124     $define)
11125         echo " "
11126         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
11127 $cat >attrib.c <<EOCP
11128 #include <stdio.h>
11129 #$i_stdlib I_STDLIB
11130 #ifdef I_STDLIB
11131 #include <stdlib.h>
11132 #endif
11133 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
11134 int null_printf (char* pat,...) { return (int)pat; }
11135 int main () { exit(null_printf(NULL)); }
11136 EOCP
11137         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
11138             : run the executable in case it produces a run-time warning
11139             if $run ./attrib >>attrib.out 2>&1; then
11140                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11141                     echo "Your C compiler doesn't allow __printf__ format to be null."
11142                     val="$undef"
11143                 else
11144                     echo "Your C compiler allows __printf__ format to be null."
11145                     val="$define"
11146                 fi
11147             else
11148             echo "Your C compiler executable failed with __printf__ format null."
11149             val="$undef"
11150         fi
11151     else
11152         echo "Your C compiler fails with __printf__ format null."
11153         val="$undef"
11154     fi
11155     ;;
11156     *)  val="$undef" ;;
11157     esac
11158 ;;
11159 *)  val="$d_printf_format_null" ;;
11160 esac
11161 set d_printf_format_null
11162 eval $setvar
11163 $rm -f attrib*
11164
11165 : Look for GCC-style attribute malloc
11166 case "$d_attribute_malloc" in
11167 '')
11168 echo " "
11169 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11170 $cat >attrib.c <<'EOCP'
11171 #include <stdio.h>
11172 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11173 EOCP
11174 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11175         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11176                 echo "Your C compiler doesn't support __attribute__((malloc))."
11177                 val="$undef"
11178         else
11179                 echo "Your C compiler supports __attribute__((malloc))."
11180                 val="$define"
11181         fi
11182 else
11183         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11184         val="$undef"
11185 fi
11186 ;;
11187 *) val="$d_attribute_malloc" ;;
11188 esac
11189 set d_attribute_malloc
11190 eval $setvar
11191 $rm -f attrib*
11192
11193 : Look for GCC-style attribute nonnull
11194 case "$d_attribute_nonnull" in
11195 '')
11196 echo " "
11197 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11198 $cat >attrib.c <<'EOCP'
11199 #include <stdio.h>
11200 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11201 EOCP
11202 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11203         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11204                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11205                 val="$undef"
11206         else
11207                 echo "Your C compiler supports __attribute__((nonnull))."
11208                 val="$define"
11209         fi
11210 else
11211         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11212         val="$undef"
11213 fi
11214 ;;
11215 *) val="$d_attribute_nonnull" ;;
11216 esac
11217 set d_attribute_nonnull
11218 eval $setvar
11219 $rm -f attrib*
11220
11221 : Look for GCC-style attribute noreturn
11222 case "$d_attribute_noreturn" in
11223 '')
11224 echo " "
11225 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11226 $cat >attrib.c <<'EOCP'
11227 #include <stdio.h>
11228 void fall_over_dead( void ) __attribute__((noreturn));
11229 EOCP
11230 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11231         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11232                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11233                 val="$undef"
11234         else
11235                 echo "Your C compiler supports __attribute__((noreturn))."
11236                 val="$define"
11237         fi
11238 else
11239         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11240         val="$undef"
11241 fi
11242 ;;
11243 *) val="$d_attribute_noreturn" ;;
11244 esac
11245 set d_attribute_noreturn
11246 eval $setvar
11247 $rm -f attrib*
11248
11249 : Look for GCC-style attribute pure
11250 case "$d_attribute_pure" in
11251 '')
11252 echo " "
11253 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11254 $cat >attrib.c <<'EOCP'
11255 #include <stdio.h>
11256 int square( int n ) __attribute__((pure));
11257 EOCP
11258 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11259         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11260                 echo "Your C compiler doesn't support __attribute__((pure))."
11261                 val="$undef"
11262         else
11263                 echo "Your C compiler supports __attribute__((pure))."
11264                 val="$define"
11265         fi
11266 else
11267         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11268         val="$undef"
11269 fi
11270 ;;
11271 *) val="$d_attribute_pure" ;;
11272 esac
11273 set d_attribute_pure
11274 eval $setvar
11275 $rm -f attrib*
11276
11277 : Look for GCC-style attribute unused
11278 case "$d_attribute_unused" in
11279 '')
11280 echo " "
11281 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11282 $cat >attrib.c <<'EOCP'
11283 #include <stdio.h>
11284 int do_something( int dummy __attribute__((unused)), int n );
11285 EOCP
11286 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11287         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11288                 echo "Your C compiler doesn't support __attribute__((unused))."
11289                 val="$undef"
11290         else
11291                 echo "Your C compiler supports __attribute__((unused))."
11292                 val="$define"
11293         fi
11294 else
11295         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11296         val="$undef"
11297 fi
11298 ;;
11299 *) val="$d_attribute_unused" ;;
11300 esac
11301 set d_attribute_unused
11302 eval $setvar
11303 $rm -f attrib*
11304
11305 : Look for GCC-style attribute deprecated
11306 case "$d_attribute_deprecated" in
11307 '')
11308 echo " "
11309 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11310 $cat >attrib.c <<'EOCP'
11311 #include <stdio.h>
11312 int I_am_deprecated(void) __attribute__((deprecated));
11313 EOCP
11314 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11315         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11316                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11317                 val="$undef"
11318         else
11319                 echo "Your C compiler supports __attribute__((deprecated))."
11320                 val="$define"
11321         fi
11322 else
11323         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11324         val="$undef"
11325 fi
11326 ;;
11327 *) val="$d_attribute_deprecated" ;;
11328 esac
11329 set d_attribute_deprecated
11330 eval $setvar
11331 $rm -f attrib*
11332
11333 : Look for GCC-style attribute warn_unused_result
11334 case "$d_attribute_warn_unused_result" in
11335 '')
11336 echo " "
11337 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11338 $cat >attrib.c <<'EOCP'
11339 #include <stdio.h>
11340 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11341 EOCP
11342 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11343         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11344                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11345                 val="$undef"
11346         else
11347                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11348                 val="$define"
11349         fi
11350 else
11351         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11352         val="$undef"
11353 fi
11354 ;;
11355 *) val="$d_attribute_warn_unused_result" ;;
11356 esac
11357 set d_attribute_warn_unused_result
11358 eval $setvar
11359 $rm -f attrib*
11360
11361 : see if bcmp exists
11362 set bcmp d_bcmp
11363 eval $inlibc
11364
11365 : see if bcopy exists
11366 set bcopy d_bcopy
11367 eval $inlibc
11368
11369 : see if getpgrp exists
11370 set getpgrp d_getpgrp
11371 eval $inlibc
11372
11373 case "$d_getpgrp" in
11374 "$define")
11375         echo " "
11376         echo "Checking to see which flavor of getpgrp is in use..."
11377         $cat >try.c <<EOP
11378 #$i_unistd I_UNISTD
11379 #include <sys/types.h>
11380 #ifdef I_UNISTD
11381 #  include <unistd.h>
11382 #endif
11383 #$i_stdlib I_STDLIB
11384 #ifdef I_STDLIB
11385 #include <stdlib.h>
11386 #endif
11387 int main()
11388 {
11389         if (getuid() == 0) {
11390                 printf("(I see you are running Configure as super-user...)\n");
11391                 setuid(1);
11392         }
11393 #ifdef TRY_BSD_PGRP
11394         if (getpgrp(1) == 0)
11395                 exit(0);
11396 #else
11397         if (getpgrp() > 0)
11398                 exit(0);
11399 #endif
11400         exit(1);
11401 }
11402 EOP
11403         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11404                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11405                 val="$define"
11406         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11407                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11408                 val="$undef"
11409         else
11410                 echo "I can't seem to compile and run the test program."
11411                 if ./usg; then
11412                         xxx="a USG one, i.e. you use getpgrp()."
11413                 else
11414                         # SVR4 systems can appear rather BSD-ish.
11415                         case "$i_unistd" in
11416                         $undef)
11417                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11418                                 val="$define"
11419                                 ;;
11420                         $define)
11421                                 xxx="probably a USG one, i.e. you use getpgrp()."
11422                                 val="$undef"
11423                                 ;;
11424                         esac
11425                 fi
11426                 echo "Assuming your getpgrp is $xxx" >&4
11427         fi
11428         ;;
11429 *) val="$undef";;
11430 esac
11431 set d_bsdgetpgrp
11432 eval $setvar
11433 $rm_try
11434
11435 : see if setpgrp exists
11436 set setpgrp d_setpgrp
11437 eval $inlibc
11438
11439 case "$d_setpgrp" in
11440 "$define")
11441         echo " "
11442         echo "Checking to see which flavor of setpgrp is in use..."
11443         $cat >try.c <<EOP
11444 #$i_unistd I_UNISTD
11445 #include <sys/types.h>
11446 #ifdef I_UNISTD
11447 #  include <unistd.h>
11448 #endif
11449 #$i_stdlib I_STDLIB
11450 #ifdef I_STDLIB
11451 #include <stdlib.h>
11452 #endif
11453 int main()
11454 {
11455         if (getuid() == 0) {
11456                 printf("(I see you are running Configure as super-user...)\n");
11457                 setuid(1);
11458         }
11459 #ifdef TRY_BSD_PGRP
11460         if (-1 == setpgrp(1, 1))
11461                 exit(0);
11462 #else
11463         if (setpgrp() != -1)
11464                 exit(0);
11465 #endif
11466         exit(1);
11467 }
11468 EOP
11469         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11470                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11471                 val="$define"
11472         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11473                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11474                 val="$undef"
11475         else
11476                 echo "(I can't seem to compile and run the test program.)"
11477                 if ./usg; then
11478                         xxx="a USG one, i.e. you use setpgrp()."
11479                 else
11480                         # SVR4 systems can appear rather BSD-ish.
11481                         case "$i_unistd" in
11482                         $undef)
11483                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11484                                 val="$define"
11485                                 ;;
11486                         $define)
11487                                 xxx="probably a USG one, i.e. you use setpgrp()."
11488                                 val="$undef"
11489                                 ;;
11490                         esac
11491                 fi
11492                 echo "Assuming your setpgrp is $xxx" >&4
11493         fi
11494         ;;
11495 *) val="$undef";;
11496 esac
11497 set d_bsdsetpgrp
11498 eval $setvar
11499 $rm_try
11500
11501 : Look for GCC-style __builtin_choose_expr
11502 case "$d_builtin_choose_expr" in
11503 '')
11504     echo " "
11505     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11506     $cat >try.c <<'EOCP'
11507 #include <assert.h>
11508 #include <stdlib.h>
11509 #include <stdio.h>
11510
11511 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11512
11513 int main(void) {
11514     assert( SYRINX(1) == 2112 );
11515     assert( SYRINX(1) != 5150 );
11516     assert( SYRINX(0) == 5150 );
11517     assert( SYRINX(0) != 2112 );
11518     puts( "All good!" );
11519     exit(0);
11520 }
11521
11522 EOCP
11523     set try
11524     if eval $compile && $run ./try; then
11525         echo "Your C compiler supports __builtin_choose_expr."
11526         val="$define"
11527     else
11528         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11529         val="$undef"
11530     fi
11531 ;;
11532 *) val="$d_builtin_choose_expr" ;;
11533 esac
11534
11535 set d_builtin_choose_expr
11536 eval $setvar
11537 $rm_try
11538
11539 : Look for GCC-style __builtin_expect
11540 case "$d_builtin_expect" in
11541 '')
11542     echo " "
11543     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11544     $cat >try.c <<'EOCP'
11545 int main(void) {
11546     int n = 50;
11547     if ( __builtin_expect(n, 0) ) n = 1;
11548     /* Remember shell exit code truth is 0, C truth is non-zero */
11549     return !(n == 1);
11550 }
11551 EOCP
11552     set try
11553     if eval $compile && $run ./try; then
11554         echo "Your C compiler supports __builtin_expect."
11555         val="$define"
11556     else
11557         echo "Your C compiler doesn't seem to understand __builtin_expect."
11558         val="$undef"
11559     fi
11560     ;;
11561 *) val="$d_builtin_expect" ;;
11562 esac
11563
11564 set d_builtin_expect
11565 eval $setvar
11566 $rm_try
11567
11568 : see if bzero exists
11569 set bzero d_bzero
11570 eval $inlibc
11571
11572 : see if stdarg is available
11573 echo " "
11574 if $test `./findhdr stdarg.h`; then
11575         echo "<stdarg.h> found." >&4
11576         valstd="$define"
11577 else
11578         echo "<stdarg.h> NOT found." >&4
11579         valstd="$undef"
11580 fi
11581
11582 : see if varargs is available
11583 echo " "
11584 if $test `./findhdr varargs.h`; then
11585         echo "<varargs.h> found." >&4
11586 else
11587         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11588 fi
11589
11590 : set up the varargs testing programs
11591 $cat > varargs.c <<EOP
11592 #ifdef I_STDARG
11593 #include <stdarg.h>
11594 #endif
11595 #ifdef I_VARARGS
11596 #include <varargs.h>
11597 #endif
11598
11599 #ifdef I_STDARG
11600 int f(char *p, ...)
11601 #else
11602 int f(va_alist)
11603 va_dcl
11604 #endif
11605 {
11606         va_list ap;
11607 #ifndef I_STDARG
11608         char *p;
11609 #endif
11610 #ifdef I_STDARG
11611         va_start(ap,p);
11612 #else
11613         va_start(ap);
11614         p = va_arg(ap, char *);
11615 #endif
11616         va_end(ap);
11617         return 0;
11618 }
11619 EOP
11620 $cat > varargs <<EOP
11621 $startsh
11622 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11623         echo "true"
11624 else
11625         echo "false"
11626 fi
11627 $rm -f varargs$_o
11628 EOP
11629 chmod +x varargs
11630
11631 : now check which varargs header should be included
11632 echo " "
11633 i_varhdr=''
11634 val=''
11635 case "$valstd" in
11636 "$define")
11637         if `./varargs I_STDARG`; then
11638                 val='stdarg.h'
11639         elif `./varargs I_VARARGS`; then
11640                 val='varargs.h'
11641         fi
11642         ;;
11643 *)
11644         if `./varargs I_VARARGS`; then
11645                 val='varargs.h'
11646         fi
11647         ;;
11648 esac
11649 case "$val" in
11650 '')
11651         echo " "
11652         echo "*** WHOA THERE!!! ***" >&4
11653         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
11654         case "$knowitall" in
11655         '')
11656         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
11657                 exit 1
11658                 ;;
11659         esac
11660 echo "I could not find the definition for va_dcl... You have problems..." >&4
11661         val="$undef"; set i_stdarg; eval $setvar
11662         val="$undef"; set i_varargs; eval $setvar
11663         ;;
11664 *)
11665         set i_varhdr
11666         eval $setvar
11667         case "$i_varhdr" in
11668         stdarg.h)
11669                 val="$define"; set i_stdarg; eval $setvar
11670                 val="$undef"; set i_varargs; eval $setvar
11671                 ;;
11672         varargs.h)
11673                 val="$undef"; set i_stdarg; eval $setvar
11674                 val="$define"; set i_varargs; eval $setvar
11675                 ;;
11676         esac
11677         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11678 esac
11679 $rm -f varargs*
11680
11681 : see if the Compiler supports C99 variadic macros
11682 case "$i_stdarg$i_stdlib" in
11683     "$define$define")
11684     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11685     $cat >try.c <<EOCP
11686 #include <stdio.h>
11687 #include <stdarg.h>
11688
11689 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11690
11691 int main() {
11692   char buf[20];
11693   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11694   puts(buf);
11695   return 0;
11696 }
11697 EOCP
11698     set try
11699     if eval $compile && $run ./try 2>&1 >/dev/null; then
11700         case "`$run ./try`" in
11701             "123 456 789")
11702             echo "You have C99 variadic macros." >&4
11703             d_c99_variadic_macros="$define"
11704             ;;
11705             *)
11706             echo "You don't have functional C99 variadic macros." >&4
11707             d_c99_variadic_macros="$undef"
11708             ;;
11709         esac
11710     else
11711         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11712         d_c99_variadic_macros="$undef"
11713     fi
11714     $rm_try
11715     ;;
11716     *)
11717     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11718     d_c99_variadic_macros="$undef"
11719     ;;
11720 esac
11721
11722 : see if signal is declared as pointer to function returning int or void
11723 echo " "
11724 xxx=`./findhdr signal.h`
11725 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11726 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11727         echo "You have int (*signal())() instead of void." >&4
11728         val="$undef"
11729 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11730         echo "You have void (*signal())()." >&4
11731         val="$define"
11732 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11733         echo "You have int (*signal())() instead of void." >&4
11734         val="$undef"
11735 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11736         echo "You have void (*signal())()." >&4
11737         val="$define"
11738 else
11739         case "$d_voidsig" in
11740         '')
11741         echo "I can't determine whether signal handler returns void or int..." >&4
11742                 dflt=void
11743                 rp="What type does your signal handler return?"
11744                 . ./myread
11745                 case "$ans" in
11746                 v*) val="$define";;
11747                 *) val="$undef";;
11748                 esac;;
11749         "$define")
11750                 echo "As you already told me, signal handler returns void." >&4
11751                 val="$define"
11752                 ;;
11753         *)      echo "As you already told me, signal handler returns int." >&4
11754                 val="$undef"
11755                 ;;
11756         esac
11757 fi
11758 set d_voidsig
11759 eval $setvar
11760 case "$d_voidsig" in
11761 "$define") signal_t="void";;
11762 *) signal_t="int";;
11763 esac
11764 $rm -f $$.tmp
11765
11766 : check for ability to cast large floats to 32-bit ints.
11767 echo " "
11768 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11769 if $test "$intsize" -ge 4; then
11770         xxx=int
11771 else
11772         xxx=long
11773 fi
11774 $cat >try.c <<EOCP
11775 #include <stdio.h>
11776 #$i_stdlib I_STDLIB
11777 #ifdef I_STDLIB
11778 #include <stdlib.h>
11779 #endif
11780 #include <sys/types.h>
11781 #include <signal.h>
11782 $signal_t blech(int s) { exit(3); }
11783 int main()
11784 {
11785         $xxx i32;
11786         double f, g;
11787         int result = 0;
11788         char str[16];
11789         signal(SIGFPE, blech);
11790
11791         /* Don't let compiler optimize the test away.  Store the number
11792            in a writable string for gcc to pass to sscanf under HP-UX.
11793         */
11794         sprintf(str, "2147483647");
11795         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11796         g = 10 * f;
11797         i32  = ($xxx) g;
11798
11799         /* x86 processors will probably give 0x8000 0000, which is a
11800            sign change.  We don't want that.  We want to mimic SPARC
11801            behavior here, which is to preserve the sign and give
11802            back 0x7fff ffff.
11803         */
11804         if (i32 != ($xxx) f)
11805                 result |= 1;
11806         exit(result);
11807 }
11808 EOCP
11809 set try
11810 if eval $compile_ok; then
11811         $run ./try 2>/dev/null
11812         yyy=$?
11813 else
11814         echo "(I can't seem to compile the test program--assuming it can't)"
11815         yyy=1
11816 fi
11817 case "$yyy" in
11818 0)      val="$define"
11819         echo "Yup, it can."
11820         ;;
11821 *)      val="$undef"
11822         echo "Nope, it can't."
11823         ;;
11824 esac
11825 set d_casti32
11826 eval $setvar
11827 $rm_try
11828
11829 : check for ability to cast negative floats to unsigned
11830 echo " "
11831 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11832 $cat >try.c <<EOCP
11833 #include <stdio.h>
11834 #$i_stdlib I_STDLIB
11835 #ifdef I_STDLIB
11836 #include <stdlib.h>
11837 #endif
11838 #include <sys/types.h>
11839 #include <signal.h>
11840 $signal_t blech(int s) { exit(7); }
11841 $signal_t blech_in_list(int s) { exit(4); }
11842 unsigned long dummy_long(unsigned long p) { return p; }
11843 unsigned int dummy_int(unsigned int p) { return p; }
11844 unsigned short dummy_short(unsigned short p) { return p; }
11845 int main()
11846 {
11847         double f;
11848         unsigned long along;
11849         unsigned int aint;
11850         unsigned short ashort;
11851         int result = 0;
11852         char str[16];
11853
11854         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11855            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11856            optimized the whole file away
11857         */
11858         /* Store the number in a writable string for gcc to pass to
11859            sscanf under HP-UX.
11860         */
11861         sprintf(str, "-123");
11862         sscanf(str, "%lf", &f);  /* f = -123.; */
11863
11864         signal(SIGFPE, blech);
11865         along = (unsigned long)f;
11866         aint = (unsigned int)f;
11867         ashort = (unsigned short)f;
11868         if (along != (unsigned long)-123)
11869                 result |= 1;
11870         if (aint != (unsigned int)-123)
11871                 result |= 1;
11872         if (ashort != (unsigned short)-123)
11873                 result |= 1;
11874         sprintf(str, "1073741824.");
11875         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11876         f = f + f;
11877         along = 0;
11878         along = (unsigned long)f;
11879         if (along != 0x80000000)
11880                 result |= 2;
11881         f -= 1.;
11882         along = 0;
11883         along = (unsigned long)f;
11884         if (along != 0x7fffffff)
11885                 result |= 1;
11886         f += 2.;
11887         along = 0;
11888         along = (unsigned long)f;
11889         if (along != 0x80000001)
11890                 result |= 2;
11891         if (result)
11892                 exit(result);
11893         signal(SIGFPE, blech_in_list);
11894         sprintf(str, "123.");
11895         sscanf(str, "%lf", &f);  /* f = 123.; */
11896         along = dummy_long((unsigned long)f);
11897         aint = dummy_int((unsigned int)f);
11898         ashort = dummy_short((unsigned short)f);
11899         if (along != (unsigned long)123)
11900                 result |= 4;
11901         if (aint != (unsigned int)123)
11902                 result |= 4;
11903         if (ashort != (unsigned short)123)
11904                 result |= 4;
11905         exit(result);
11906
11907 }
11908 EOCP
11909 set try
11910 if eval $compile_ok; then
11911         $run ./try 2>/dev/null
11912         castflags=$?
11913 else
11914         echo "(I can't seem to compile the test program--assuming it can't)"
11915         castflags=7
11916 fi
11917 case "$castflags" in
11918 0)      val="$define"
11919         echo "Yup, it can."
11920         ;;
11921 *)      val="$undef"
11922         echo "Nope, it can't."
11923         ;;
11924 esac
11925 set d_castneg
11926 eval $setvar
11927 $rm_try
11928
11929 : see if cbrt exists
11930 set cbrt d_cbrt
11931 eval $inlibc
11932
11933 : see if vprintf exists
11934 echo " "
11935 if set vprintf val -f d_vprintf; eval $csym; $val; then
11936         echo 'vprintf() found.' >&4
11937         val="$define"
11938         $cat >try.c <<EOF
11939 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11940 #$i_varargs I_VARARGS
11941
11942 #$i_stdlib I_STDLIB
11943 #$i_unistd I_UNISTD
11944
11945 #ifdef I_STDARG
11946 #  include <stdarg.h>
11947 #else /* I_VARARGS */
11948 #  include <varargs.h>
11949 #endif
11950
11951 #ifdef I_UNISTD
11952 #  include <unistd.h>
11953 #endif
11954
11955 #ifdef I_STDLIB
11956 #  include <stdlib.h>
11957 #endif
11958
11959 #include <stdio.h> /* vsprintf prototype */
11960
11961 #ifdef I_STDARG
11962 void xxx(int n, ...)
11963 {
11964     va_list args;
11965     char buf[10];
11966     va_start(args, n);
11967     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11968 }
11969 int main() { xxx(1, "foo"); }
11970
11971 #else /* I_VARARGS */
11972
11973 xxx(va_alist)
11974 va_dcl
11975 {
11976     va_list args;
11977     char buf[10];
11978     va_start(args);
11979     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11980 }
11981 int main() { xxx("foo"); }
11982
11983 #endif
11984
11985 EOF
11986         set try
11987         if eval $compile_ok; then
11988                 if $run ./try; then
11989                         echo "Your vsprintf() returns (int)." >&4
11990                         val2="$undef"
11991                 else
11992                         echo "Your vsprintf() returns (char*)." >&4
11993                         val2="$define"
11994                 fi
11995         else
11996                 echo 'I am unable to compile the vsprintf() test program.' >&4
11997                 # We shouldn't get here.  If we do, assume the standard signature,
11998                 # not the old BSD one.
11999                 echo 'Guessing that vsprintf() returns (int).' >&4
12000                 val2="$undef"
12001         fi
12002 else
12003         echo 'vprintf() NOT found.' >&4
12004         val="$undef"
12005         val2="$undef"
12006 fi
12007 $rm_try
12008 set d_vprintf
12009 eval $setvar
12010 val=$val2
12011 set d_charvspr
12012 eval $setvar
12013
12014 : see if chown exists
12015 set chown d_chown
12016 eval $inlibc
12017
12018 : see if chroot exists
12019 set chroot d_chroot
12020 eval $inlibc
12021
12022 : see if chsize exists
12023 set chsize d_chsize
12024 eval $inlibc
12025
12026 : see if class exists
12027 set class d_class
12028 eval $inlibc
12029
12030 : see if clearenv exists
12031 set clearenv d_clearenv
12032 eval $inlibc
12033
12034 : Define hasstruct macro for Configure internal use
12035 hasstruct='varname=$1; struct=$2; shift; shift;
12036 while $test $# -ge 2; do
12037         case "$1" in
12038         $define) echo "#include <$2>";;
12039         esac ;
12040     shift 2;
12041 done > try.c;
12042 echo "int main () { struct $struct foo; }" >> try.c;
12043 set try;
12044 if eval $compile; then
12045         val="$define";
12046 else
12047         val="$undef";
12048 fi;
12049 set $varname;
12050 eval $setvar;
12051 $rm_try'
12052
12053 : see whether socket exists
12054 socketlib=''
12055 sockethdr=''
12056 echo " "
12057 $echo $n "Hmm... $c" >&4
12058 if set socket val -f d_socket; eval $csym; $val; then
12059     echo "Looks like you have Berkeley networking support." >&4
12060     d_socket="$define"
12061     if set setsockopt val -f; eval $csym; $val; then
12062         d_oldsock="$undef"
12063     else
12064         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
12065         d_oldsock="$define"
12066     fi
12067 else
12068     if $contains socklib libc.list >/dev/null 2>&1; then
12069         echo "Looks like you have Berkeley networking support." >&4
12070         d_socket="$define"
12071         : we will have to assume that it supports the 4.2 BSD interface
12072         d_oldsock="$undef"
12073     else
12074         echo "You don't have Berkeley networking in libc$_a..." >&4
12075         if test "X$d_socket" = "X$define"; then
12076             echo "...but you seem to believe that you have sockets." >&4
12077         else
12078             for net in net socket
12079             do
12080                 if test -f $sysroot/usr/lib/lib$net$_a; then
12081                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
12082                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
12083                     if $contains socket libc.list >/dev/null 2>&1; then
12084                         d_socket="$define"
12085                         socketlib="-l$net"
12086                         case "$net" in
12087                         net)
12088                             echo "...but the Wollongong group seems to have hacked it in." >&4
12089                             sockethdr="-I$sysroot/usr/netinclude"
12090                             ;;
12091                         esac
12092                         echo "Found Berkeley sockets interface in lib$net." >&4
12093                         if $contains setsockopt libc.list >/dev/null 2>&1; then
12094                             d_oldsock="$undef"
12095                         else
12096                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
12097                             d_oldsock="$define"
12098                         fi
12099                         break
12100                     fi
12101                 fi
12102             done
12103             if test "X$d_socket" != "X$define"; then
12104                echo "or anywhere else I see." >&4
12105                d_socket="$undef"
12106                d_oldsock="$undef"
12107             fi
12108         fi
12109     fi
12110 fi
12111
12112 : see if socketpair exists
12113 set socketpair d_sockpair
12114 eval $inlibc
12115
12116
12117 echo " "
12118 echo "Checking the availability sa_len in the sock struct ..." >&4
12119 $cat >try.c <<EOF
12120 #include <sys/types.h>
12121 #include <sys/socket.h>
12122 int main() {
12123 struct sockaddr sa;
12124 return (sa.sa_len);
12125 }
12126 EOF
12127 val="$undef"
12128 set try; if eval $compile; then
12129     val="$define"
12130 fi
12131 set d_sockaddr_sa_len; eval $setvar
12132 $rm_try
12133
12134 echo " "
12135 echo "Checking the availability struct sockaddr_in6 ..." >&4
12136 $cat >try.c <<EOF
12137 #include <sys/types.h>
12138 #include <sys/socket.h>
12139 #include <netinet/in.h>
12140 int main() {
12141 struct sockaddr_in6 sin6;
12142 return (sin6.sin6_family);
12143 }
12144 EOF
12145 val="$undef"
12146 set try; if eval $compile; then
12147     val="$define"
12148 fi
12149 set d_sockaddr_in6; eval $setvar
12150 $rm_try
12151
12152 echo " "
12153 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
12154 $cat >try.c <<EOF
12155 #include <sys/types.h>
12156 #include <sys/socket.h>
12157 #include <netinet/in.h>
12158 int main() {
12159 struct sockaddr_in6 sin6;
12160 return (sin6.sin6_scope_id);
12161 }
12162 EOF
12163 val="$undef"
12164 set try; if eval $compile; then
12165     val="$define"
12166 fi
12167 set d_sin6_scope_id; eval $setvar
12168 $rm_try
12169
12170 echo " "
12171 echo "Checking the availability struct ip_mreq ..." >&4
12172 $cat >try.c <<EOF
12173 #include <sys/types.h>
12174 #include <sys/socket.h>
12175 #include <netinet/in.h>
12176 int main() {
12177 struct ip_mreq mreq;
12178 return (mreq.imr_multiaddr.s_addr);
12179 }
12180 EOF
12181 val="$undef"
12182 set try; if eval $compile; then
12183        val="$define"
12184 fi
12185 set d_ip_mreq; eval $setvar
12186 $rm_try
12187
12188 echo " "
12189 echo "Checking the availability struct ip_mreq_source ..." >&4
12190 $cat >try.c <<EOF
12191 #include <sys/types.h>
12192 #include <sys/socket.h>
12193 #include <netinet/in.h>
12194 int main() {
12195 struct ip_mreq_source mreq;
12196 return (mreq.imr_multiaddr.s_addr);
12197 }
12198 EOF
12199 val="$undef"
12200 set try; if eval $compile; then
12201        val="$define"
12202 fi
12203 set d_ip_mreq_source; eval $setvar
12204 $rm_try
12205
12206 echo " "
12207 echo "Checking the availability struct ipv6_mreq ..." >&4
12208 $cat >try.c <<EOF
12209 #include <sys/types.h>
12210 #include <sys/socket.h>
12211 #include <netinet/in.h>
12212 int main() {
12213 struct ipv6_mreq mreq;
12214 return (mreq.ipv6mr_interface);
12215 }
12216 EOF
12217 val="$undef"
12218 set try; if eval $compile; then
12219     val="$define"
12220 fi
12221 set d_ipv6_mreq; eval $setvar
12222 $rm_try
12223
12224 echo " "
12225 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12226 $cat >try.c <<EOF
12227 #include <sys/types.h>
12228 #include <sys/socket.h>
12229 #include <netinet/in.h>
12230 int main() {
12231 struct ipv6_mreq_source mreq;
12232 return (mreq.imr_multiaddr.s_addr);
12233 }
12234 EOF
12235 val="$undef"
12236 set try; if eval $compile; then
12237        val="$define"
12238 fi
12239 set d_ipv6_mreq_source; eval $setvar
12240 $rm_try
12241
12242 echo " "
12243 echo "Checking the availability of certain socket constants..." >&4
12244 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12245     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12246     $cat >try.c <<EOF
12247 #include <sys/types.h>
12248 #include <sys/socket.h>
12249 int main() {
12250     int i = $ENUM;
12251 }
12252 EOF
12253     val="$undef"
12254     set try; if eval $compile; then
12255         val="$define"
12256     fi
12257     set d_${enum}; eval $setvar
12258     $rm_try
12259 done
12260
12261 : see if this is a sys/uio.h system
12262 set sys/uio.h i_sysuio
12263 eval $inhdr
12264
12265 : Check for cmsghdr support
12266 echo " "
12267 echo "Checking to see if your system supports struct cmsghdr..." >&4
12268 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12269 eval $hasstruct
12270 case "$d_cmsghdr_s" in
12271 "$define")      echo "Yes, it does."   ;;
12272 *)              echo "No, it doesn't." ;;
12273 esac
12274
12275
12276 : check for const keyword
12277 echo " "
12278 echo 'Checking to see if your C compiler knows about "const"...' >&4
12279 $cat >const.c <<'EOCP'
12280 typedef struct spug { int drokk; } spug;
12281 int main()
12282 {
12283         const char *foo;
12284         const spug y = { 0 };
12285 }
12286 EOCP
12287 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
12288         val="$define"
12289         echo "Yup, it does."
12290 else
12291         val="$undef"
12292         echo "Nope, it doesn't."
12293 fi
12294 set d_const
12295 eval $setvar
12296
12297 : see if copysign exists
12298 set copysign d_copysign
12299 eval $inlibc
12300
12301 : see if copysignl exists
12302 set copysignl d_copysignl
12303 eval $inlibc
12304
12305 : see if crypt exists
12306 echo " "
12307 set crypt d_crypt
12308 eval $inlibc
12309 case "$d_crypt" in
12310 $define) cryptlib='' ;;
12311 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12312                 echo 'crypt() found.' >&4
12313                 val="$define"
12314                 cryptlib=''
12315         else
12316                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12317                 if $test -z "$cryptlib"; then
12318                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12319                 else
12320                         cryptlib=-lcrypt
12321                 fi
12322                 if $test -z "$cryptlib"; then
12323                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12324                 else
12325                         cryptlib=-lcrypt
12326                 fi
12327                 if $test -z "$cryptlib"; then
12328                         cryptlib=`./loc libcrypt$_a "" $libpth`
12329                 else
12330                         cryptlib=-lcrypt
12331                 fi
12332                 if $test -z "$cryptlib"; then
12333                         echo 'crypt() NOT found.' >&4
12334                         val="$undef"
12335                 else
12336                         val="$define"
12337                 fi
12338         fi
12339         set d_crypt
12340         eval $setvar
12341         ;;
12342 esac
12343
12344 : see if this is a crypt.h system
12345 set crypt.h i_crypt
12346 eval $inhdr
12347
12348 : see if crypt_r exists
12349 set crypt_r d_crypt_r
12350 eval $inlibc
12351 case "$d_crypt_r" in
12352 "$define")
12353         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12354         case "$d_crypt_r_proto:$usethreads" in
12355         ":define")      d_crypt_r_proto=define
12356                 set d_crypt_r_proto crypt_r $hdrs
12357                 eval $hasproto ;;
12358         *)      ;;
12359         esac
12360         case "$d_crypt_r_proto" in
12361         define)
12362         case "$crypt_r_proto" in
12363         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12364         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12365         esac
12366         case "$crypt_r_proto" in
12367         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12368         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12369         esac
12370         case "$crypt_r_proto" in
12371         ''|0)   d_crypt_r=undef
12372                 crypt_r_proto=0
12373                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12374         * )     case "$crypt_r_proto" in
12375                 REENTRANT_PROTO*) ;;
12376                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12377                 esac
12378                 echo "Prototype: $try" ;;
12379         esac
12380         ;;
12381         *)      case "$usethreads" in
12382                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12383                 esac
12384                 d_crypt_r=undef
12385                 crypt_r_proto=0
12386                 ;;
12387         esac
12388         ;;
12389 *)      crypt_r_proto=0
12390         ;;
12391 esac
12392
12393 : get csh whereabouts
12394 case "$csh" in
12395 'csh') val="$undef" ;;
12396 *) val="$define" ;;
12397 esac
12398 set d_csh
12399 eval $setvar
12400 : Respect a hint or command line value for full_csh.
12401 case "$full_csh" in
12402 '') full_csh=$csh ;;
12403 esac
12404
12405 : see if ctermid exists
12406 set ctermid d_ctermid
12407 eval $inlibc
12408
12409 : see if ctermid_r exists
12410 set ctermid_r d_ctermid_r
12411 eval $inlibc
12412 case "$d_ctermid_r" in
12413 "$define")
12414         hdrs="$i_systypes sys/types.h define stdio.h "
12415         case "$d_ctermid_r_proto:$usethreads" in
12416         ":define")      d_ctermid_r_proto=define
12417                 set d_ctermid_r_proto ctermid_r $hdrs
12418                 eval $hasproto ;;
12419         *)      ;;
12420         esac
12421         case "$d_ctermid_r_proto" in
12422         define)
12423         case "$ctermid_r_proto" in
12424         ''|0) try='char* ctermid_r(char*);'
12425         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12426         esac
12427         case "$ctermid_r_proto" in
12428         ''|0)   d_ctermid_r=undef
12429                 ctermid_r_proto=0
12430                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12431         * )     case "$ctermid_r_proto" in
12432                 REENTRANT_PROTO*) ;;
12433                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12434                 esac
12435                 echo "Prototype: $try" ;;
12436         esac
12437         ;;
12438         *)      case "$usethreads" in
12439                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12440                 esac
12441                 d_ctermid_r=undef
12442                 ctermid_r_proto=0
12443                 ;;
12444         esac
12445         ;;
12446 *)      ctermid_r_proto=0
12447         ;;
12448 esac
12449
12450 : see if ctime_r exists
12451 set ctime_r d_ctime_r
12452 eval $inlibc
12453 case "$d_ctime_r" in
12454 "$define")
12455         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12456         case "$d_ctime_r_proto:$usethreads" in
12457         ":define")      d_ctime_r_proto=define
12458                 set d_ctime_r_proto ctime_r $hdrs
12459                 eval $hasproto ;;
12460         *)      ;;
12461         esac
12462         case "$d_ctime_r_proto" in
12463         define)
12464         case "$ctime_r_proto" in
12465         ''|0) try='char* ctime_r(const time_t*, char*);'
12466         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12467         esac
12468         case "$ctime_r_proto" in
12469         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12470         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12471         esac
12472         case "$ctime_r_proto" in
12473         ''|0) try='int ctime_r(const time_t*, char*);'
12474         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12475         esac
12476         case "$ctime_r_proto" in
12477         ''|0) try='int ctime_r(const time_t*, char*, int);'
12478         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12479         esac
12480         case "$ctime_r_proto" in
12481         ''|0)   d_ctime_r=undef
12482                 ctime_r_proto=0
12483                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12484         * )     case "$ctime_r_proto" in
12485                 REENTRANT_PROTO*) ;;
12486                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12487                 esac
12488                 echo "Prototype: $try" ;;
12489         esac
12490         ;;
12491         *)      case "$usethreads" in
12492                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12493                 esac
12494                 d_ctime_r=undef
12495                 ctime_r_proto=0
12496                 ;;
12497         esac
12498         ;;
12499 *)      ctime_r_proto=0
12500         ;;
12501 esac
12502
12503 : see if cuserid exists
12504 set cuserid d_cuserid
12505 eval $inlibc
12506
12507 : see if this is a limits.h system
12508 set limits.h i_limits
12509 eval $inhdr
12510
12511 : See if number of significant digits in a double precision number is known
12512 echo " "
12513 $cat >dbl_dig.c <<EOM
12514 #$i_limits I_LIMITS
12515 #$i_float I_FLOAT
12516 #ifdef I_LIMITS
12517 #include <limits.h>
12518 #endif
12519 #ifdef I_FLOAT
12520 #include <float.h>
12521 #endif
12522 #ifdef DBL_DIG
12523 printf("Contains DBL_DIG");
12524 #endif
12525 EOM
12526 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
12527 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
12528         echo "DBL_DIG found." >&4
12529         val="$define"
12530 else
12531         echo "DBL_DIG NOT found." >&4
12532         val="$undef"
12533 fi
12534 $rm -f dbl_dig.?
12535 set d_dbl_dig
12536 eval $setvar
12537
12538 : see if dbm.h is available
12539 : see if dbmclose exists
12540 set dbmclose d_dbmclose
12541 eval $inlibc
12542
12543 case "$d_dbmclose" in
12544 $define)
12545         set dbm.h i_dbm
12546         eval $inhdr
12547         case "$i_dbm" in
12548         $define)
12549                 val="$undef"
12550                 set i_rpcsvcdbm
12551                 eval $setvar
12552                 ;;
12553         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12554                 eval $inhdr
12555                 ;;
12556         esac
12557         ;;
12558 *)      echo "We won't be including <dbm.h>"
12559         val="$undef"
12560         set i_dbm
12561         eval $setvar
12562         val="$undef"
12563         set i_rpcsvcdbm
12564         eval $setvar
12565         ;;
12566 esac
12567
12568 : see if prototype for dbminit is available
12569 echo " "
12570 set d_dbminitproto dbminit $i_dbm dbm.h
12571 eval $hasproto
12572
12573 : see if difftime exists
12574 set difftime d_difftime
12575 eval $inlibc
12576
12577 : see if this is a dirent system
12578 echo " "
12579 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12580         val="$define"
12581         echo "<dirent.h> found." >&4
12582 else
12583         val="$undef"
12584         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12585                 echo "<sys/dir.h> found." >&4
12586                 echo " "
12587         else
12588                 xinc=`./findhdr sys/ndir.h`
12589         fi
12590         echo "<dirent.h> NOT found." >&4
12591 fi
12592 set i_dirent
12593 eval $setvar
12594
12595 : Look for type of directory structure.
12596 echo " "
12597 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12598
12599 case "$direntrytype" in
12600 ''|' ')
12601         case "$i_dirent" in
12602         $define) guess1='struct dirent' ;;
12603         *) guess1='struct direct'  ;;
12604         esac
12605         ;;
12606 *)      guess1="$direntrytype"
12607         ;;
12608 esac
12609
12610 case "$guess1" in
12611 'struct dirent') guess2='struct direct' ;;
12612 *) guess2='struct dirent' ;;
12613 esac
12614
12615 if $contains "$guess1" try.c >/dev/null 2>&1; then
12616         direntrytype="$guess1"
12617         echo "Your directory entries are $direntrytype." >&4
12618 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12619         direntrytype="$guess2"
12620         echo "Your directory entries seem to be $direntrytype." >&4
12621 else
12622         echo "I don't recognize your system's directory entries." >&4
12623         rp="What type is used for directory entries on this system?"
12624         dflt="$guess1"
12625         . ./myread
12626         direntrytype="$ans"
12627 fi
12628 $rm_try
12629
12630 : see if the directory entry stores field length
12631 echo " "
12632 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12633 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12634         echo "Good, your directory entry keeps length information in d_namlen." >&4
12635         val="$define"
12636 else
12637         echo "Your directory entry does not know about the d_namlen field." >&4
12638         val="$undef"
12639 fi
12640 set d_dirnamlen
12641 eval $setvar
12642 $rm_try
12643
12644 : Look for DIR.dd_fd
12645 case "$i_dirent" in
12646 "$define")
12647     echo "Checking to see if DIR has a dd_fd member variable" >&4
12648     $cat >try.c <<EOCP
12649 #$i_stdlib I_STDLIB
12650 #ifdef I_STDLIB
12651 #include <stdlib.h>
12652 #endif
12653 #include <dirent.h>
12654
12655 int main() {
12656     DIR dir;
12657     dir.dd_fd = 1;
12658     return 0;
12659 }
12660 EOCP
12661     val=$undef
12662     set try
12663     if eval $compile; then
12664         echo "Yes, it does."
12665         val="$define"
12666     else
12667         echo "No, it does not."
12668         val="$undef"
12669     fi
12670     ;;
12671 *)
12672     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12673     val="$undef"
12674     ;;
12675 esac
12676 set d_dir_dd_fd
12677 eval $setvar
12678 $rm_try
12679
12680 : see if this is an sysdir system
12681 set sys/dir.h i_sysdir
12682 eval $inhdr
12683
12684 : see if this is an sysndir system
12685 set sys/ndir.h i_sysndir
12686 eval $inhdr
12687
12688 : Look for dirfd
12689 echo " "
12690 $cat >dirfd.c <<EOM
12691 #include <stdio.h>
12692 #$i_stdlib I_STDLIB
12693 #ifdef I_STDLIB
12694 #include <stdlib.h>
12695 #endif
12696 #$i_dirent I_DIRENT             /**/
12697 #$i_sysdir I_SYS_DIR            /**/
12698 #$i_sysndir I_SYS_NDIR          /**/
12699 #$i_systypes I_SYS_TYPES        /**/
12700 #if defined(I_SYS_TYPES)
12701 #include <sys/types.h>
12702 #endif
12703 #if defined(I_DIRENT)
12704 #include <dirent.h>
12705 #else
12706 #ifdef I_SYS_NDIR
12707 #include <sys/ndir.h>
12708 #else
12709 #ifdef I_SYS_DIR
12710 #ifdef hp9000s500
12711 #include <ndir.h>       /* may be wrong in the future */
12712 #else
12713 #include <sys/dir.h>
12714 #endif
12715 #endif
12716 #endif
12717 #endif
12718 int main() {
12719         DIR *dirp = opendir(".");
12720         if (dirfd(dirp) >= 0)
12721                 exit(0);
12722         else
12723                 exit(1);
12724 }
12725 EOM
12726 val=$undef
12727 set dirfd
12728 if eval $compile; then
12729         val="$define"
12730 fi
12731 case "$val" in
12732 $define)        echo "dirfd() found." >&4       ;;
12733 *)              echo "dirfd() NOT found." >&4   ;;
12734 esac
12735 set d_dirfd
12736 eval $setvar
12737 $rm -f dirfd*
12738
12739 : see if dladdr exists
12740 set dladdr d_dladdr
12741 eval $inlibc
12742
12743 : see if dlerror exists
12744 xxx_runnm="$runnm"
12745 runnm=false
12746 set dlerror d_dlerror
12747 eval $inlibc
12748 runnm="$xxx_runnm"
12749
12750 : see if dlfcn is available
12751 set dlfcn.h i_dlfcn
12752 eval $inhdr
12753
12754 : Check what extension to use for shared libs
12755 case "$usedl" in
12756 $define|y|true)
12757         $cat << EOM
12758
12759 On a few systems, the dynamically loaded modules that perl generates and uses
12760 will need a different extension than shared libs. The default will probably
12761 be appropriate.
12762
12763 EOM
12764         case "$dlext" in
12765         '')     dflt="$so" ;;
12766         *)      dflt="$dlext" ;;
12767         esac
12768         rp='What is the extension of dynamically loaded modules'
12769         . ./myread
12770         dlext="$ans"
12771         ;;
12772 *)
12773         dlext="none"
12774         ;;
12775 esac
12776
12777 : Check if dlsym need a leading underscore
12778 echo " "
12779 val="$undef"
12780
12781 case "$dlsrc" in
12782 dl_dlopen.xs)
12783         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12784         $cat >dyna.c <<'EOM'
12785 fred () { }
12786 EOM
12787
12788 $cat >fred.c<<EOM
12789
12790 #include <stdio.h>
12791 #$i_stdlib I_STDLIB
12792 #ifdef I_STDLIB
12793 #include <stdlib.h>
12794 #endif
12795 #$i_dlfcn I_DLFCN
12796 #ifdef I_DLFCN
12797 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12798 #else
12799 #include <sys/types.h>
12800 #include <nlist.h>
12801 #include <link.h>
12802 #endif
12803
12804 extern int fred() ;
12805
12806 int main()
12807 {
12808     void * handle ;
12809     void * symbol ;
12810 #ifndef RTLD_LAZY
12811     int mode = 1 ;
12812 #else
12813     int mode = RTLD_LAZY ;
12814 #endif
12815     handle = dlopen("./dyna.$dlext", mode) ;
12816     if (handle == NULL) {
12817         printf ("1\n") ;
12818         fflush (stdout) ;
12819         exit(0);
12820     }
12821     symbol = dlsym(handle, "fred") ;
12822     if (symbol == NULL) {
12823         /* try putting a leading underscore */
12824         symbol = dlsym(handle, "_fred") ;
12825         if (symbol == NULL) {
12826             printf ("2\n") ;
12827             fflush (stdout) ;
12828             exit(0);
12829         }
12830         printf ("3\n") ;
12831     }
12832     else
12833         printf ("4\n") ;
12834     fflush (stdout) ;
12835     exit(0);
12836 }
12837 EOM
12838         : Call the object file tmp-dyna.o in case dlext=o.
12839         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12840                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12841                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12842                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12843                 xxx=`$run ./fred`
12844                 case $xxx in
12845                 1)      echo "Test program failed using dlopen." >&4
12846                         echo "Perhaps you should not use dynamic loading." >&4;;
12847                 2)      echo "Test program failed using dlsym." >&4
12848                         echo "Perhaps you should not use dynamic loading." >&4;;
12849                 3)      echo "dlsym needs a leading underscore" >&4
12850                         val="$define" ;;
12851                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12852                 esac
12853         else
12854                 echo "I can't compile and run the test program." >&4
12855                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12856         fi
12857         ;;
12858 esac
12859
12860 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12861
12862 set d_dlsymun
12863 eval $setvar
12864
12865 : see if drand48_r exists
12866 set drand48_r d_drand48_r
12867 eval $inlibc
12868 case "$d_drand48_r" in
12869 "$define")
12870         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12871         case "$d_drand48_r_proto:$usethreads" in
12872         ":define")      d_drand48_r_proto=define
12873                 set d_drand48_r_proto drand48_r $hdrs
12874                 eval $hasproto ;;
12875         *)      ;;
12876         esac
12877         case "$d_drand48_r_proto" in
12878         define)
12879         case "$drand48_r_proto" in
12880         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12881         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12882         esac
12883         case "$drand48_r_proto" in
12884         ''|0)   d_drand48_r=undef
12885                 drand48_r_proto=0
12886                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12887         * )     case "$drand48_r_proto" in
12888                 REENTRANT_PROTO*) ;;
12889                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12890                 esac
12891                 echo "Prototype: $try" ;;
12892         esac
12893         ;;
12894         *)      case "$usethreads" in
12895                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12896                 esac
12897                 d_drand48_r=undef
12898                 drand48_r_proto=0
12899                 ;;
12900         esac
12901         ;;
12902 *)      drand48_r_proto=0
12903         ;;
12904 esac
12905
12906 : see if prototype for drand48 is available
12907 echo " "
12908 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12909 eval $hasproto
12910
12911 : see if dup2 exists
12912 set dup2 d_dup2
12913 eval $inlibc
12914
12915 : see if eaccess exists
12916 set eaccess d_eaccess
12917 eval $inlibc
12918
12919 : see if endgrent exists
12920 set endgrent d_endgrent
12921 eval $inlibc
12922
12923 : see if this is an grp system
12924 set grp.h i_grp
12925 eval $inhdr
12926
12927 case "$i_grp" in
12928 $define)
12929         xxx=`./findhdr grp.h`
12930         $cppstdin $cppflags $cppminus < $xxx >$$.h
12931
12932         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12933                 val="$define"
12934         else
12935                 val="$undef"
12936         fi
12937         set d_grpasswd
12938         eval $setvar
12939
12940         $rm -f $$.h
12941         ;;
12942 *)
12943         val="$undef";
12944         set d_grpasswd; eval $setvar
12945         ;;
12946 esac
12947
12948 : see if endgrent_r exists
12949 set endgrent_r d_endgrent_r
12950 eval $inlibc
12951 case "$d_endgrent_r" in
12952 "$define")
12953         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12954         case "$d_endgrent_r_proto:$usethreads" in
12955         ":define")      d_endgrent_r_proto=define
12956                 set d_endgrent_r_proto endgrent_r $hdrs
12957                 eval $hasproto ;;
12958         *)      ;;
12959         esac
12960         case "$d_endgrent_r_proto" in
12961         define)
12962         case "$endgrent_r_proto" in
12963         ''|0) try='int endgrent_r(FILE**);'
12964         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12965         esac
12966         case "$endgrent_r_proto" in
12967         ''|0) try='void endgrent_r(FILE**);'
12968         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12969         esac
12970         case "$endgrent_r_proto" in
12971         ''|0)   d_endgrent_r=undef
12972                 endgrent_r_proto=0
12973                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12974         * )     case "$endgrent_r_proto" in
12975                 REENTRANT_PROTO*) ;;
12976                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12977                 esac
12978                 echo "Prototype: $try" ;;
12979         esac
12980         ;;
12981         *)      case "$usethreads" in
12982                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12983                 esac
12984                 d_endgrent_r=undef
12985                 endgrent_r_proto=0
12986                 ;;
12987         esac
12988         ;;
12989 *)      endgrent_r_proto=0
12990         ;;
12991 esac
12992
12993 : see if endhostent exists
12994 set endhostent d_endhent
12995 eval $inlibc
12996
12997 : see if this is a netdb.h system
12998 set netdb.h i_netdb
12999 eval $inhdr
13000
13001 : see if endhostent_r exists
13002 set endhostent_r d_endhostent_r
13003 eval $inlibc
13004 case "$d_endhostent_r" in
13005 "$define")
13006         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13007         case "$d_endhostent_r_proto:$usethreads" in
13008         ":define")      d_endhostent_r_proto=define
13009                 set d_endhostent_r_proto endhostent_r $hdrs
13010                 eval $hasproto ;;
13011         *)      ;;
13012         esac
13013         case "$d_endhostent_r_proto" in
13014         define)
13015         case "$endhostent_r_proto" in
13016         ''|0) try='int endhostent_r(struct hostent_data*);'
13017         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
13018         esac
13019         case "$endhostent_r_proto" in
13020         ''|0) try='void endhostent_r(struct hostent_data*);'
13021         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
13022         esac
13023         case "$endhostent_r_proto" in
13024         ''|0)   d_endhostent_r=undef
13025                 endhostent_r_proto=0
13026                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
13027         * )     case "$endhostent_r_proto" in
13028                 REENTRANT_PROTO*) ;;
13029                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
13030                 esac
13031                 echo "Prototype: $try" ;;
13032         esac
13033         ;;
13034         *)      case "$usethreads" in
13035                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
13036                 esac
13037                 d_endhostent_r=undef
13038                 endhostent_r_proto=0
13039                 ;;
13040         esac
13041         ;;
13042 *)      endhostent_r_proto=0
13043         ;;
13044 esac
13045
13046 : see if endnetent exists
13047 set endnetent d_endnent
13048 eval $inlibc
13049
13050 : see if endnetent_r exists
13051 set endnetent_r d_endnetent_r
13052 eval $inlibc
13053 case "$d_endnetent_r" in
13054 "$define")
13055         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13056         case "$d_endnetent_r_proto:$usethreads" in
13057         ":define")      d_endnetent_r_proto=define
13058                 set d_endnetent_r_proto endnetent_r $hdrs
13059                 eval $hasproto ;;
13060         *)      ;;
13061         esac
13062         case "$d_endnetent_r_proto" in
13063         define)
13064         case "$endnetent_r_proto" in
13065         ''|0) try='int endnetent_r(struct netent_data*);'
13066         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
13067         esac
13068         case "$endnetent_r_proto" in
13069         ''|0) try='void endnetent_r(struct netent_data*);'
13070         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
13071         esac
13072         case "$endnetent_r_proto" in
13073         ''|0)   d_endnetent_r=undef
13074                 endnetent_r_proto=0
13075                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
13076         * )     case "$endnetent_r_proto" in
13077                 REENTRANT_PROTO*) ;;
13078                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
13079                 esac
13080                 echo "Prototype: $try" ;;
13081         esac
13082         ;;
13083         *)      case "$usethreads" in
13084                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
13085                 esac
13086                 d_endnetent_r=undef
13087                 endnetent_r_proto=0
13088                 ;;
13089         esac
13090         ;;
13091 *)      endnetent_r_proto=0
13092         ;;
13093 esac
13094
13095 : see if endprotoent exists
13096 set endprotoent d_endpent
13097 eval $inlibc
13098
13099 : see if endprotoent_r exists
13100 set endprotoent_r d_endprotoent_r
13101 eval $inlibc
13102 case "$d_endprotoent_r" in
13103 "$define")
13104         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13105         case "$d_endprotoent_r_proto:$usethreads" in
13106         ":define")      d_endprotoent_r_proto=define
13107                 set d_endprotoent_r_proto endprotoent_r $hdrs
13108                 eval $hasproto ;;
13109         *)      ;;
13110         esac
13111         case "$d_endprotoent_r_proto" in
13112         define)
13113         case "$endprotoent_r_proto" in
13114         ''|0) try='int endprotoent_r(struct protoent_data*);'
13115         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
13116         esac
13117         case "$endprotoent_r_proto" in
13118         ''|0) try='void endprotoent_r(struct protoent_data*);'
13119         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
13120         esac
13121         case "$endprotoent_r_proto" in
13122         ''|0)   d_endprotoent_r=undef
13123                 endprotoent_r_proto=0
13124                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
13125         * )     case "$endprotoent_r_proto" in
13126                 REENTRANT_PROTO*) ;;
13127                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
13128                 esac
13129                 echo "Prototype: $try" ;;
13130         esac
13131         ;;
13132         *)      case "$usethreads" in
13133                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
13134                 esac
13135                 d_endprotoent_r=undef
13136                 endprotoent_r_proto=0
13137                 ;;
13138         esac
13139         ;;
13140 *)      endprotoent_r_proto=0
13141         ;;
13142 esac
13143
13144 : see if endpwent exists
13145 set endpwent d_endpwent
13146 eval $inlibc
13147
13148 : see if this is a pwd.h system
13149 set pwd.h i_pwd
13150 eval $inhdr
13151
13152 case "$i_pwd" in
13153 $define)
13154         xxx=`./findhdr pwd.h`
13155         $cppstdin $cppflags $cppminus < $xxx >$$.h
13156
13157         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
13158                 val="$define"
13159         else
13160                 val="$undef"
13161         fi
13162         set d_pwquota
13163         eval $setvar
13164
13165         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
13166                 val="$define"
13167         else
13168                 val="$undef"
13169         fi
13170         set d_pwage
13171         eval $setvar
13172
13173         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
13174                 val="$define"
13175         else
13176                 val="$undef"
13177         fi
13178         set d_pwchange
13179         eval $setvar
13180
13181         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
13182                 val="$define"
13183         else
13184                 val="$undef"
13185         fi
13186         set d_pwclass
13187         eval $setvar
13188
13189         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
13190                 val="$define"
13191         else
13192                 val="$undef"
13193         fi
13194         set d_pwexpire
13195         eval $setvar
13196
13197         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
13198                 val="$define"
13199         else
13200                 val="$undef"
13201         fi
13202         set d_pwcomment
13203         eval $setvar
13204
13205         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
13206                 val="$define"
13207         else
13208                 val="$undef"
13209         fi
13210         set d_pwgecos
13211         eval $setvar
13212
13213         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
13214                 val="$define"
13215         else
13216                 val="$undef"
13217         fi
13218         set d_pwpasswd
13219         eval $setvar
13220
13221         $rm -f $$.h
13222         ;;
13223 *)
13224         val="$undef";
13225         set d_pwquota; eval $setvar
13226         set d_pwage; eval $setvar
13227         set d_pwchange; eval $setvar
13228         set d_pwclass; eval $setvar
13229         set d_pwexpire; eval $setvar
13230         set d_pwcomment; eval $setvar
13231         set d_pwgecos; eval $setvar
13232         set d_pwpasswd; eval $setvar
13233         ;;
13234 esac
13235
13236 : see if endpwent_r exists
13237 set endpwent_r d_endpwent_r
13238 eval $inlibc
13239 case "$d_endpwent_r" in
13240 "$define")
13241         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13242         case "$d_endpwent_r_proto:$usethreads" in
13243         ":define")      d_endpwent_r_proto=define
13244                 set d_endpwent_r_proto endpwent_r $hdrs
13245                 eval $hasproto ;;
13246         *)      ;;
13247         esac
13248         case "$d_endpwent_r_proto" in
13249         define)
13250         case "$endpwent_r_proto" in
13251         ''|0) try='int endpwent_r(FILE**);'
13252         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13253         esac
13254         case "$endpwent_r_proto" in
13255         ''|0) try='void endpwent_r(FILE**);'
13256         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13257         esac
13258         case "$endpwent_r_proto" in
13259         ''|0)   d_endpwent_r=undef
13260                 endpwent_r_proto=0
13261                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13262         * )     case "$endpwent_r_proto" in
13263                 REENTRANT_PROTO*) ;;
13264                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13265                 esac
13266                 echo "Prototype: $try" ;;
13267         esac
13268         ;;
13269         *)      case "$usethreads" in
13270                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13271                 esac
13272                 d_endpwent_r=undef
13273                 endpwent_r_proto=0
13274                 ;;
13275         esac
13276         ;;
13277 *)      endpwent_r_proto=0
13278         ;;
13279 esac
13280
13281 : see if endservent exists
13282 set endservent d_endsent
13283 eval $inlibc
13284
13285 : see if endservent_r exists
13286 set endservent_r d_endservent_r
13287 eval $inlibc
13288 case "$d_endservent_r" in
13289 "$define")
13290         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13291         case "$d_endservent_r_proto:$usethreads" in
13292         ":define")      d_endservent_r_proto=define
13293                 set d_endservent_r_proto endservent_r $hdrs
13294                 eval $hasproto ;;
13295         *)      ;;
13296         esac
13297         case "$d_endservent_r_proto" in
13298         define)
13299         case "$endservent_r_proto" in
13300         ''|0) try='int endservent_r(struct servent_data*);'
13301         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13302         esac
13303         case "$endservent_r_proto" in
13304         ''|0) try='void endservent_r(struct servent_data*);'
13305         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13306         esac
13307         case "$endservent_r_proto" in
13308         ''|0)   d_endservent_r=undef
13309                 endservent_r_proto=0
13310                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13311         * )     case "$endservent_r_proto" in
13312                 REENTRANT_PROTO*) ;;
13313                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13314                 esac
13315                 echo "Prototype: $try" ;;
13316         esac
13317         ;;
13318         *)      case "$usethreads" in
13319                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13320                 esac
13321                 d_endservent_r=undef
13322                 endservent_r_proto=0
13323                 ;;
13324         esac
13325         ;;
13326 *)      endservent_r_proto=0
13327         ;;
13328 esac
13329
13330 : Locate the flags for 'open()'
13331 echo " "
13332 $cat >try.c <<EOCP
13333 #include <sys/types.h>
13334 #ifdef I_FCNTL
13335 #include <fcntl.h>
13336 #endif
13337 #ifdef I_SYS_FILE
13338 #include <sys/file.h>
13339 #endif
13340 #$i_stdlib I_STDLIB
13341 #ifdef I_STDLIB
13342 #include <stdlib.h>
13343 #endif
13344 int main() {
13345         if(O_RDONLY);
13346 #ifdef O_TRUNC
13347         exit(0);
13348 #else
13349         exit(1);
13350 #endif
13351 }
13352 EOCP
13353 : check sys/file.h first to get FREAD on Sun
13354 if $test `./findhdr sys/file.h` && \
13355                 set try -DI_SYS_FILE && eval $compile; then
13356         h_sysfile=true;
13357         echo "<sys/file.h> defines the O_* constants..." >&4
13358         if $run ./try; then
13359                 echo "and you have the 3 argument form of open()." >&4
13360                 val="$define"
13361         else
13362                 echo "but not the 3 argument form of open().  Oh, well." >&4
13363                 val="$undef"
13364         fi
13365 elif $test `./findhdr fcntl.h` && \
13366                 set try -DI_FCNTL && eval $compile; then
13367         h_fcntl=true;
13368         echo "<fcntl.h> defines the O_* constants..." >&4
13369         if $run ./try; then
13370                 echo "and you have the 3 argument form of open()." >&4
13371                 val="$define"
13372         else
13373                 echo "but not the 3 argument form of open().  Oh, well." >&4
13374                 val="$undef"
13375         fi
13376 else
13377         val="$undef"
13378         echo "I can't find the O_* constant definitions!  You got problems." >&4
13379 fi
13380 set d_open3
13381 eval $setvar
13382 $rm_try
13383
13384 : see if this is a sys/file.h system
13385 val=''
13386 set sys/file.h val
13387 eval $inhdr
13388
13389 : do we need to include sys/file.h ?
13390 case "$val" in
13391 "$define")
13392         echo " "
13393         if $h_sysfile; then
13394                 val="$define"
13395                 echo "We'll be including <sys/file.h>." >&4
13396         else
13397                 val="$undef"
13398                 echo "We won't be including <sys/file.h>." >&4
13399         fi
13400         ;;
13401 *)
13402         h_sysfile=false
13403         ;;
13404 esac
13405 set i_sysfile
13406 eval $setvar
13407
13408 : see if fcntl.h is there
13409 val=''
13410 set fcntl.h val
13411 eval $inhdr
13412
13413 : see if we can include fcntl.h
13414 case "$val" in
13415 "$define")
13416         echo " "
13417         if $h_fcntl; then
13418                 val="$define"
13419                 echo "We'll be including <fcntl.h>." >&4
13420         else
13421                 val="$undef"
13422                 if $h_sysfile; then
13423         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13424                 else
13425                         echo "We won't be including <fcntl.h>." >&4
13426                 fi
13427         fi
13428         ;;
13429 *)
13430         h_fcntl=false
13431         val="$undef"
13432         ;;
13433 esac
13434 set i_fcntl
13435 eval $setvar
13436
13437 : see if fork exists
13438 set fork d_fork
13439 eval $inlibc
13440
13441 : see if pipe exists
13442 set pipe d_pipe
13443 eval $inlibc
13444
13445 : check for non-blocking I/O stuff
13446 case "$h_sysfile" in
13447 true) echo "#include <sys/file.h>" > head.c;;
13448 *)
13449        case "$h_fcntl" in
13450        true) echo "#include <fcntl.h>" > head.c;;
13451        *) echo "#include <sys/fcntl.h>" > head.c;;
13452        esac
13453        ;;
13454 esac
13455 echo " "
13456 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13457 case "$o_nonblock" in
13458 '')
13459         $cat head.c > try.c
13460         $cat >>try.c <<EOCP
13461 #include <stdio.h>
13462 #$i_stdlib I_STDLIB
13463 #ifdef I_STDLIB
13464 #include <stdlib.h>
13465 #endif
13466 #$i_fcntl I_FCNTL
13467 #ifdef I_FCNTL
13468 #include <fcntl.h>
13469 #endif
13470 int main() {
13471 #ifdef O_NONBLOCK
13472         printf("O_NONBLOCK\n");
13473         exit(0);
13474 #endif
13475 #ifdef O_NDELAY
13476         printf("O_NDELAY\n");
13477         exit(0);
13478 #endif
13479 #ifdef FNDELAY
13480         printf("FNDELAY\n");
13481         exit(0);
13482 #endif
13483         exit(0);
13484 }
13485 EOCP
13486         set try
13487         if eval $compile_ok; then
13488                 o_nonblock=`$run ./try`
13489                 case "$o_nonblock" in
13490                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13491                 *) echo "Seems like we can use $o_nonblock.";;
13492                 esac
13493         else
13494                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13495         fi
13496         ;;
13497 *) echo "Using $hint value $o_nonblock.";;
13498 esac
13499 $rm_try
13500
13501 echo " "
13502 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13503 case "$eagain" in
13504 '')
13505         case "$d_fork:$d_pipe:$d_alarm" in
13506         define:define:define)
13507         $cat head.c > try.c
13508         $cat >>try.c <<EOCP
13509 #include <errno.h>
13510 #include <sys/types.h>
13511 #include <signal.h>
13512 #include <stdio.h>
13513 #$i_stdlib I_STDLIB
13514 #ifdef I_STDLIB
13515 #include <stdlib.h>
13516 #endif
13517 #$i_fcntl I_FCNTL
13518 #ifdef I_FCNTL
13519 #include <fcntl.h>
13520 #endif
13521 #define MY_O_NONBLOCK $o_nonblock
13522 #ifndef errno  /* XXX need better Configure test */
13523 extern int errno;
13524 #endif
13525 #$i_unistd I_UNISTD
13526 #ifdef I_UNISTD
13527 #include <unistd.h>
13528 #endif
13529 #$i_string I_STRING
13530 #ifdef I_STRING
13531 #include <string.h>
13532 #else
13533 #include <strings.h>
13534 #endif
13535 $signal_t blech(int x) { exit(3); }
13536 EOCP
13537         $cat >> try.c <<'EOCP'
13538 int main()
13539 {
13540         int pd[2];
13541         int pu[2];
13542         char buf[1];
13543         char string[100];
13544         int ret;
13545
13546         ret = pipe(pd); /* Down: child -> parent */
13547         if (ret != 0)
13548                 exit(3);
13549         ret = pipe(pu); /* Up: parent -> child */
13550         if (ret != 0)
13551                 exit(3);
13552         if (0 != fork()) {
13553                 close(pd[1]);   /* Parent reads from pd[0] */
13554                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13555 #ifdef F_SETFL
13556                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13557                         exit(1);
13558 #else
13559                 exit(4);
13560 #endif
13561                 signal(SIGALRM, blech);
13562                 alarm(5);
13563                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13564                         exit(2);
13565                 sprintf(string, "%d\n", ret);
13566                 ret = write(2, string, strlen(string));
13567                 if (ret != strlen(string))
13568                         exit(3);
13569                 alarm(0);
13570 #ifdef EAGAIN
13571                 if (errno == EAGAIN) {
13572                         printf("EAGAIN\n");
13573                         goto ok;
13574                 }
13575 #endif
13576 #ifdef EWOULDBLOCK
13577                 if (errno == EWOULDBLOCK)
13578                         printf("EWOULDBLOCK\n");
13579 #endif
13580         ok:
13581                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13582                 if (ret != 1)
13583                         exit(3);
13584                 sleep(2);                               /* Give it time to close our pipe */
13585                 alarm(5);
13586                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13587                 alarm(0);
13588                 sprintf(string, "%d\n", ret);
13589                 ret = write(4, string, strlen(string));
13590                 if (ret != strlen(string))
13591                         exit(3);
13592                 exit(0);
13593         }
13594
13595         close(pd[0]);                   /* We write to pd[1] */
13596         close(pu[1]);                   /* We read from pu[0] */
13597         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13598         if (ret != 1)
13599                 exit(3);
13600         close(pd[1]);                   /* Pipe pd is now fully closed! */
13601         exit(0);                                /* Bye bye, thank you for playing! */
13602 }
13603 EOCP
13604         set try
13605         if eval $compile_ok; then
13606                 echo "$startsh" >mtry
13607                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13608                 chmod +x mtry
13609                 $run ./mtry >/dev/null 2>&1
13610                 case $? in
13611                 0) eagain=`$cat try.out`;;
13612                 1) echo "Could not perform non-blocking setting!";;
13613                 2) echo "I did a successful read() for something that was not there!";;
13614                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13615                 4) echo "Could not find F_SETFL!";;
13616                 *) echo "Something terribly wrong happened during testing.";;
13617                 esac
13618                 rd_nodata=`$cat try.ret`
13619                 echo "A read() system call with no data present returns $rd_nodata."
13620                 case "$rd_nodata" in
13621                 0|-1) ;;
13622                 *)
13623                         echo "(That's peculiar, fixing that to be -1.)"
13624                         rd_nodata=-1
13625                         ;;
13626                 esac
13627                 case "$eagain" in
13628                 '')
13629                         echo "Forcing errno EAGAIN on read() with no data available."
13630                         eagain=EAGAIN
13631                         ;;
13632                 *)
13633                         echo "Your read() sets errno to $eagain when no data is available."
13634                         ;;
13635                 esac
13636                 status=`$cat try.err`
13637                 case "$status" in
13638                 0) echo "And it correctly returns 0 to signal EOF.";;
13639                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13640                 *) echo "However, your read() returns '$status' on EOF??";;
13641                 esac
13642                 val="$define"
13643                 if test "$status" = "$rd_nodata"; then
13644                         echo "WARNING: you can't distinguish between EOF and no data!"
13645                         val="$undef"
13646                 fi
13647         else
13648                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13649                 eagain=EAGAIN
13650         fi
13651         ;;
13652         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13653                 eagain=EAGAIN
13654                 val="$define"
13655                 ;;
13656         esac
13657         set d_eofnblk
13658         eval $setvar
13659         ;;
13660 *)
13661         echo "Using $hint value $eagain."
13662         echo "Your read() returns $rd_nodata when no data is present."
13663         case "$d_eofnblk" in
13664         "$define") echo "And you can see EOF because read() returns 0.";;
13665         "$undef") echo "But you can't see EOF status from read() returned value.";;
13666         *)
13667                 echo "(Assuming you can't see EOF status from read anyway.)"
13668                 d_eofnblk=$undef
13669                 ;;
13670         esac
13671         ;;
13672 esac
13673 $rm_try head.c mtry
13674
13675 : see if erf exists
13676 set erf d_erf
13677 eval $inlibc
13678
13679 : see if erfc exists
13680 set erfc d_erfc
13681 eval $inlibc
13682
13683 : see if exp2 exists
13684 set exp2 d_exp2
13685 eval $inlibc
13686
13687 : see if expm1 exists
13688 set expm1 d_expm1
13689 eval $inlibc
13690
13691 : see if _ptr and _cnt from stdio act std
13692 echo " "
13693
13694 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13695         echo "(Looks like you have stdio.h from BSD.)"
13696         case "$stdio_ptr" in
13697         '') stdio_ptr='((fp)->_p)'
13698                 ptr_lval=$define
13699                 ;;
13700         *)      ptr_lval=$d_stdio_ptr_lval;;
13701         esac
13702         case "$stdio_cnt" in
13703         '') stdio_cnt='((fp)->_r)'
13704                 cnt_lval=$define
13705                 ;;
13706         *)      cnt_lval=$d_stdio_cnt_lval;;
13707         esac
13708         case "$stdio_base" in
13709         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13710         esac
13711         case "$stdio_bufsiz" in
13712         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13713         esac
13714 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13715         echo "(Looks like you have stdio.h from Linux.)"
13716         case "$stdio_ptr" in
13717         '') stdio_ptr='((fp)->_IO_read_ptr)'
13718                 ptr_lval=$define
13719                 ;;
13720         *)      ptr_lval=$d_stdio_ptr_lval;;
13721         esac
13722         case "$stdio_cnt" in
13723         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13724                 cnt_lval=$undef
13725                 ;;
13726         *)      cnt_lval=$d_stdio_cnt_lval;;
13727         esac
13728         case "$stdio_base" in
13729         '') stdio_base='((fp)->_IO_read_base)';;
13730         esac
13731         case "$stdio_bufsiz" in
13732         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13733         esac
13734 else
13735         case "$stdio_ptr" in
13736         '') stdio_ptr='((fp)->_ptr)'
13737                 ptr_lval=$define
13738                 ;;
13739         *)      ptr_lval=$d_stdio_ptr_lval;;
13740         esac
13741         case "$stdio_cnt" in
13742         '') stdio_cnt='((fp)->_cnt)'
13743                 cnt_lval=$define
13744                 ;;
13745         *)      cnt_lval=$d_stdio_cnt_lval;;
13746         esac
13747         case "$stdio_base" in
13748         '') stdio_base='((fp)->_base)';;
13749         esac
13750         case "$stdio_bufsiz" in
13751         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13752         esac
13753 fi
13754
13755 : test whether _ptr and _cnt really work
13756 echo "Checking how std your stdio is..." >&4
13757 $cat >try.c <<EOP
13758 #include <stdio.h>
13759 #$i_stdlib I_STDLIB
13760 #ifdef I_STDLIB
13761 #include <stdlib.h>
13762 #endif
13763 #define FILE_ptr(fp)    $stdio_ptr
13764 #define FILE_cnt(fp)    $stdio_cnt
13765 int main() {
13766         FILE *fp = fopen("try.c", "r");
13767         char c = getc(fp);
13768         if (
13769                 18 <= FILE_cnt(fp) &&
13770                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13771         )
13772                 exit(0);
13773         exit(1);
13774 }
13775 EOP
13776 val="$undef"
13777 set try
13778 if eval $compile && $to try.c; then
13779         if $run ./try; then
13780                 echo "Your stdio acts pretty std."
13781                 val="$define"
13782         else
13783                 echo "Your stdio isn't very std."
13784         fi
13785 else
13786         echo "Your stdio doesn't appear very std."
13787 fi
13788 $rm_try
13789
13790 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13791 # direct buffer manipulation no longer works.  The Configure tests
13792 # should be changed to correctly detect this, but until then,
13793 # the following check should at least let perl compile and run.
13794 # (This quick fix should be updated before 5.8.1.)
13795 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13796 # A. Dougherty, June 3, 2002.
13797 case "$d_gnulibc" in
13798 $define)
13799         case "$gnulibc_version" in
13800         2.[01]*)  ;;
13801         2.2) ;;
13802         2.2.[0-9]) ;;
13803         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13804                 val="$undef"
13805                 ;;
13806         esac
13807         ;;
13808 esac
13809 set d_stdstdio
13810 eval $setvar
13811
13812 : Can _ptr be used as an lvalue?
13813 case "$d_stdstdio$ptr_lval" in
13814 $define$define) val=$define ;;
13815 *) val=$undef ;;
13816 esac
13817 set d_stdio_ptr_lval
13818 eval $setvar
13819
13820 : Can _cnt be used as an lvalue?
13821 case "$d_stdstdio$cnt_lval" in
13822 $define$define) val=$define ;;
13823 *) val=$undef ;;
13824 esac
13825 set d_stdio_cnt_lval
13826 eval $setvar
13827
13828
13829 : test whether setting _ptr sets _cnt as a side effect
13830 d_stdio_ptr_lval_sets_cnt="$undef"
13831 d_stdio_ptr_lval_nochange_cnt="$undef"
13832 case "$d_stdio_ptr_lval$d_stdstdio" in
13833 $define$define)
13834         echo "Checking to see what happens if we set the stdio ptr..." >&4
13835 $cat >try.c <<EOP
13836 #include <stdio.h>
13837 /* Can we scream? */
13838 /* Eat dust sed :-) */
13839 /* In the buffer space, no one can hear you scream. */
13840 #$i_stdlib I_STDLIB
13841 #ifdef I_STDLIB
13842 #include <stdlib.h>
13843 #endif
13844 #define FILE_ptr(fp)    $stdio_ptr
13845 #define FILE_cnt(fp)    $stdio_cnt
13846 #include <sys/types.h>
13847 int main() {
13848         FILE *fp = fopen("try.c", "r");
13849         int c;
13850         char *ptr;
13851         size_t cnt;
13852         if (!fp) {
13853             puts("Fail even to read");
13854             exit(1);
13855         }
13856         c = getc(fp); /* Read away the first # */
13857         if (c == EOF) {
13858             puts("Fail even to read");
13859             exit(1);
13860         }
13861         if (!(
13862                 18 <= FILE_cnt(fp) &&
13863                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13864         )) {
13865                 puts("Fail even to read");
13866                 exit (1);
13867         }
13868         ptr = (char*) FILE_ptr(fp);
13869         cnt = (size_t)FILE_cnt(fp);
13870
13871         FILE_ptr(fp) += 42;
13872
13873         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13874                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13875                 exit (1);
13876         }
13877         if (FILE_cnt(fp) <= 20) {
13878                 printf ("Fail (<20 chars to test)");
13879                 exit (1);
13880         }
13881         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13882                 puts("Fail compare");
13883                 exit (1);
13884         }
13885         if (cnt == FILE_cnt(fp)) {
13886                 puts("Pass_unchanged");
13887                 exit (0);
13888         }
13889         if (FILE_cnt(fp) == (cnt - 42)) {
13890                 puts("Pass_changed");
13891                 exit (0);
13892         }
13893         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13894         return 1;
13895
13896 }
13897 EOP
13898         set try
13899         if eval $compile && $to try.c; then
13900                 case `$run ./try` in
13901                 Pass_changed)
13902                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13903                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13904                 Pass_unchanged)
13905                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13906                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13907                 Fail*)
13908                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13909                 *)
13910                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13911         esac
13912         else
13913                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13914         fi
13915         $rm_try
13916         ;;
13917 esac
13918
13919 : see if _base is also standard
13920 val="$undef"
13921 case "$d_stdstdio" in
13922 $define)
13923         $cat >try.c <<EOP
13924 #include <stdio.h>
13925 #$i_stdlib I_STDLIB
13926 #ifdef I_STDLIB
13927 #include <stdlib.h>
13928 #endif
13929 #define FILE_base(fp)   $stdio_base
13930 #define FILE_bufsiz(fp) $stdio_bufsiz
13931 int main() {
13932         FILE *fp = fopen("try.c", "r");
13933         char c = getc(fp);
13934         if (
13935                 19 <= FILE_bufsiz(fp) &&
13936                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13937         )
13938                 exit(0);
13939         exit(1);
13940 }
13941 EOP
13942         set try
13943         if eval $compile && $to try.c; then
13944                 if $run ./try; then
13945                         echo "And its _base field acts std."
13946                         val="$define"
13947                 else
13948                         echo "But its _base field isn't std."
13949                 fi
13950         else
13951                 echo "However, it seems to be lacking the _base field."
13952         fi
13953         $rm_try
13954         ;;
13955 esac
13956 set d_stdiobase
13957 eval $setvar
13958
13959 : see if fast_stdio exists
13960 val="$undef"
13961 case "$d_stdstdio:$d_stdio_ptr_lval" in
13962 "$define:$define")
13963         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13964         *$define*)
13965                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13966                 val="$define"
13967                 ;;
13968         esac
13969         ;;
13970 esac
13971 set d_faststdio
13972 eval $setvar
13973
13974
13975
13976 : see if fchdir exists
13977 set fchdir d_fchdir
13978 eval $inlibc
13979
13980 : see if fchmod exists
13981 set fchmod d_fchmod
13982 eval $inlibc
13983
13984 : check for openat, unlinkat, renameat, linkat, fchmodat
13985 set openat d_openat
13986 eval $inlibc
13987
13988 set unlinkat d_unlinkat
13989 eval $inlibc
13990
13991 set renameat d_renameat
13992 eval $inlibc
13993
13994 set linkat d_linkat
13995 eval $inlibc
13996
13997 set fchmodat d_fchmodat
13998 eval $inlibc
13999
14000 : see if fchown exists
14001 set fchown d_fchown
14002 eval $inlibc
14003
14004 : see if this is an fcntl system
14005 set fcntl d_fcntl
14006 eval $inlibc
14007
14008 : See if fcntl-based locking works.
14009 echo " "
14010 $cat >try.c <<EOCP
14011 #$i_stdlib I_STDLIB
14012 #ifdef I_STDLIB
14013 #include <stdlib.h>
14014 #endif
14015 #include <unistd.h>
14016 #include <fcntl.h>
14017 #include <signal.h>
14018 $signal_t blech(int x) { exit(3); }
14019 int main() {
14020 #if defined(F_SETLK) && defined(F_SETLKW)
14021      struct flock flock;
14022      int retval, fd;
14023      fd = open("try.c", O_RDONLY);
14024      flock.l_type = F_RDLCK;
14025      flock.l_whence = SEEK_SET;
14026      flock.l_start = flock.l_len = 0;
14027      signal(SIGALRM, blech);
14028      alarm(10);
14029      retval = fcntl(fd, F_SETLK, &flock);
14030      close(fd);
14031      (retval < 0 ? exit(2) : exit(0));
14032 #else
14033      exit(2);
14034 #endif
14035 }
14036 EOCP
14037 echo "Checking if fcntl-based file locking works... "
14038 case "$d_fcntl" in
14039 "$define")
14040         set try
14041         if eval $compile_ok; then
14042                 if $run ./try; then
14043                         echo "Yes, it seems to work."
14044                         val="$define"
14045                 else
14046                         echo "Nope, it didn't work."
14047                         val="$undef"
14048                         case "$?" in
14049                         3) $cat >&4 <<EOM
14050 ***
14051 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
14052 *** This is (almost) impossible.
14053 *** If your NFS lock daemons are not feeling well, something like
14054 *** this may happen, please investigate.  Cannot continue, aborting.
14055 ***
14056 EOM
14057                                 exit 1
14058                                 ;;
14059                         esac
14060                 fi
14061         else
14062                 echo "I'm unable to compile the test program, so I'll assume not."
14063                 val="$undef"
14064         fi
14065         ;;
14066 *) val="$undef";
14067         echo "Nope, since you don't even have fcntl()."
14068         ;;
14069 esac
14070 set d_fcntl_can_lock
14071 eval $setvar
14072 $rm_try
14073
14074 : check for fd_set items
14075 $cat <<EOM
14076
14077 Checking to see how well your C compiler handles fd_set and friends ...
14078 EOM
14079 $cat >try.c <<EOCP
14080 #$i_stdlib I_STDLIB
14081 #ifdef I_STDLIB
14082 #include <stdlib.h>
14083 #endif
14084 #$i_systime I_SYS_TIME
14085 #$i_sysselct I_SYS_SELECT
14086 #$d_socket HAS_SOCKET
14087 #include <sys/types.h>
14088 #ifdef HAS_SOCKET
14089 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14090 #endif
14091 #ifdef I_SYS_TIME
14092 #include <sys/time.h>
14093 #endif
14094 #ifdef I_SYS_SELECT
14095 #include <sys/select.h>
14096 #endif
14097 int main() {
14098         fd_set fds;
14099
14100 #ifdef TRYBITS
14101         if(fds.fds_bits);
14102 #endif
14103
14104 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
14105         exit(0);
14106 #else
14107         exit(1);
14108 #endif
14109 }
14110 EOCP
14111 set try -DTRYBITS
14112 if eval $compile; then
14113         d_fds_bits="$define"
14114         d_fd_set="$define"
14115         echo "Well, your system knows about the normal fd_set typedef..." >&4
14116         if $run ./try; then
14117                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
14118                 d_fd_macros="$define"
14119         else
14120                 $cat >&4 <<'EOM'
14121 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
14122 EOM
14123                 d_fd_macros="$undef"
14124         fi
14125 else
14126         $cat <<'EOM'
14127 Hmm, your compiler has some difficulty with fd_set.  Checking further...
14128 EOM
14129         set try
14130         if eval $compile; then
14131                 d_fds_bits="$undef"
14132                 d_fd_set="$define"
14133                 echo "Well, your system has some sort of fd_set available..." >&4
14134                 if $run ./try; then
14135                         echo "and you have the normal fd_set macros." >&4
14136                         d_fd_macros="$define"
14137                 else
14138                         $cat <<'EOM'
14139 but not the normal fd_set macros!  Gross!  More work for me...
14140 EOM
14141                         d_fd_macros="$undef"
14142                 fi
14143         else
14144         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
14145                 d_fd_set="$undef"
14146                 d_fds_bits="$undef"
14147                 d_fd_macros="$undef"
14148         fi
14149 fi
14150 $rm_try
14151
14152 : see if fdclose exists
14153 set fdclose d_fdclose
14154 eval $inlibc
14155
14156 : see if fdim exists
14157 set fdim d_fdim
14158 eval $inlibc
14159
14160 : see if fegetround exists
14161 set fegetround d_fegetround
14162 eval $inlibc
14163
14164 : see if fgetpos exists
14165 set fgetpos d_fgetpos
14166 eval $inlibc
14167
14168 : see if finite exists
14169 set finite d_finite
14170 eval $inlibc
14171
14172 : see if finitel exists
14173 set finitel d_finitel
14174 eval $inlibc
14175
14176 : see if flock exists
14177 set flock d_flock
14178 eval $inlibc
14179
14180 : see if prototype for flock is available
14181 echo " "
14182 set d_flockproto flock $i_sysfile sys/file.h
14183 eval $hasproto
14184
14185 : see if fma exists
14186 set fma d_fma
14187 eval $inlibc
14188
14189 : see if fmax exists
14190 set fmax d_fmax
14191 eval $inlibc
14192
14193 : see if fmin exists
14194 set fmin d_fmin
14195 eval $inlibc
14196
14197 : see if fp_class exists
14198 set fp_class d_fp_class
14199 eval $inlibc
14200
14201 : see if this is a math.h system
14202 set math.h i_math
14203 eval $inhdr
14204
14205 : check for fpclassify
14206 echo "Checking to see if you have fpclassify..." >&4
14207 $cat >try.c <<EOCP
14208 #$i_math I_MATH
14209 #ifdef I_MATH
14210 #include <math.h>
14211 #endif
14212 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
14213 EOCP
14214 set try
14215 if eval $compile; then
14216         val="$define"
14217         echo "You have fpclassify."
14218 else
14219         val="$undef"
14220         echo "You do not have fpclassify."
14221 fi
14222 $rm_try
14223 set d_fpclassify
14224 eval $setvar
14225
14226 : see if fp_classify exists
14227 set fp_classify d_fp_classify
14228 eval $inlibc
14229
14230 : see if fp_classl exists
14231 set fp_classl d_fp_classl
14232 eval $inlibc
14233
14234 : see if pathconf exists
14235 set pathconf d_pathconf
14236 eval $inlibc
14237
14238 : see if fpathconf exists
14239 set fpathconf d_fpathconf
14240 eval $inlibc
14241
14242 : see if fpclass exists
14243 set fpclass d_fpclass
14244 eval $inlibc
14245
14246 : see if fpclassl exists
14247 set fpclassl d_fpclassl
14248 eval $inlibc
14249
14250 : see if fpgetround exists
14251 set fpgetround d_fpgetround
14252 eval $inlibc
14253
14254 : check for fpos64_t
14255 echo " "
14256 echo "Checking to see if you have fpos64_t..." >&4
14257 $cat >try.c <<EOCP
14258 #include <stdio.h>
14259 int main() { fpos64_t x = 7; }
14260 EOCP
14261 set try
14262 if eval $compile; then
14263         val="$define"
14264         echo "You have fpos64_t."
14265 else
14266         val="$undef"
14267         echo "You do not have fpos64_t."
14268         case "$fpossize" in
14269         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14270         esac
14271 fi
14272 $rm_try
14273 set d_fpos64_t
14274 eval $setvar
14275
14276 : see if this is an xlocale.h system
14277 set xlocale.h i_xlocale
14278 eval $inhdr
14279
14280 : see if newlocale exists
14281 set newlocale d_newlocale
14282 eval $inlibc
14283
14284 : see if freelocale exists
14285 set freelocale d_freelocale
14286 eval $inlibc
14287
14288 : see if uselocale exists
14289 set uselocale d_uselocale
14290 eval $inlibc
14291
14292 : see if duplocale exists
14293 set duplocale d_duplocale
14294 eval $inlibc
14295
14296 : see if querylocale exists
14297 set querylocale d_querylocale
14298 eval $inlibc
14299
14300 : see if frexpl exists
14301 set frexpl d_frexpl
14302 eval $inlibc
14303
14304 : see if this is a sys/param system
14305 set sys/param.h i_sysparam
14306 eval $inhdr
14307
14308 : see if this is a sys/mount.h system
14309 set sys/mount.h i_sysmount
14310 eval $inhdr
14311
14312 : Check for fs_data_s
14313 echo " "
14314 echo "Checking to see if your system supports struct fs_data..." >&4
14315 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14316 eval $hasstruct
14317 case "$d_fs_data_s" in
14318 "$define")      echo "Yes, it does."   ;;
14319 *)              echo "No, it doesn't." ;;
14320 esac
14321
14322 : see if fseeko exists
14323 set fseeko d_fseeko
14324 eval $inlibc
14325 case "$longsize" in
14326 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14327 esac
14328
14329 : see if fsetpos exists
14330 set fsetpos d_fsetpos
14331 eval $inlibc
14332
14333 : see if fstatfs exists
14334 set fstatfs d_fstatfs
14335 eval $inlibc
14336
14337 : see if statvfs exists
14338 set statvfs d_statvfs
14339 eval $inlibc
14340
14341 : see if fstatvfs exists
14342 set fstatvfs d_fstatvfs
14343 eval $inlibc
14344
14345
14346 : see if fsync exists
14347 set fsync d_fsync
14348 eval $inlibc
14349
14350 : see if ftello exists
14351 set ftello d_ftello
14352 eval $inlibc
14353 case "$longsize" in
14354 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14355 esac
14356
14357 : check for a working futimes
14358 d_futimes="$undef"
14359 echo " "
14360 echo "Checking if you have a working futimes()" >&4
14361 $cat >try.c <<EOCP
14362 #include <stdio.h>
14363 #include <sys/time.h>
14364 #include <errno.h>
14365 #include <fcntl.h>
14366
14367 int main ()
14368 {
14369     int fd, rv;
14370     fd = open ("try.c", O_RDWR);
14371     if (-1 == fd) exit (1);
14372     rv = futimes (fd, NULL);
14373     exit (rv == -1 ? errno : 0);
14374 }
14375 EOCP
14376 set try
14377 if eval $compile; then
14378     `$run ./try`
14379     rc=$?
14380     case "$rc" in
14381         0)  echo "Yes, you have" >&4
14382             d_futimes="$define"
14383             ;;
14384         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14385             ;;
14386     esac
14387 else
14388     echo "No, it does not (probably harmless)" >&4
14389 fi
14390 $rm_try
14391
14392 : look for gai_strerror
14393 echo " "
14394 $cat >try.c <<'EOCP'
14395 #include <sys/types.h>
14396 #include <sys/socket.h>
14397 #include <netdb.h>
14398 int main ()
14399 {
14400     return (gai_strerror (0) ? 0 : 1);
14401     }
14402 EOCP
14403 set try
14404 val="$undef"
14405 if eval $compile; then
14406     `$run ./try`
14407     case "$?" in
14408         0)  echo "A working gai_strerror() found." >&4
14409             val="$define" ;;
14410         *)  echo "gai_strerror() found, but it doesn't work" >&4
14411             ;;
14412         esac
14413 else
14414     echo "gai_strerror() NOT found." >&4
14415     fi
14416 set d_gai_strerror
14417 eval $setvar
14418 $rm_try
14419
14420 : see if ndbm.h is available
14421 set ndbm.h i_ndbm
14422 eval $inhdr
14423 : Compatibility location for RedHat 7.1
14424 set gdbm/ndbm.h i_gdbmndbm
14425 eval $inhdr
14426 : Compatibility location for Debian 4.0
14427 set gdbm-ndbm.h i_gdbm_ndbm
14428 eval $inhdr
14429
14430 val="$undef"
14431 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14432         : see if dbm_open exists
14433         set dbm_open d_dbm_open
14434         eval $inlibc
14435         case "$d_dbm_open" in
14436         $undef)
14437                 i_ndbm="$undef"
14438                 i_gdbmndbm="$undef"
14439                 i_gdbm_ndbm="$undef"
14440                 echo "We won't be including <ndbm.h>"
14441                 val="$undef"
14442                 ;;
14443         *) val="$define"
14444            ;;
14445         esac
14446 fi
14447 set d_ndbm
14448 eval $setvar
14449
14450 ndbm_hdr_protochk='name=$1; hdr=$2;
14451 eval "ihdr=\$""i_$name";
14452 val="$undef";
14453 if $test "$ihdr" = "$define"; then
14454         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14455         case "$d_cplusplus" in
14456         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14457         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14458         esac;
14459         case "$val" in
14460         $define) $echo "Your <$hdr> seems to have prototypes";;
14461         *) $echo "Your <$hdr> does not seem to have prototypes";;
14462         esac;
14463 fi;
14464 set "d_${name}_h_uses_prototypes";
14465 eval $setvar'
14466
14467 set ndbm ndbm.h
14468 eval $ndbm_hdr_protochk
14469 set gdbmndbm gdbm/ndbm.h
14470 eval $ndbm_hdr_protochk
14471 set gdbm_ndbm gdbm-ndbm.h
14472 eval $ndbm_hdr_protochk
14473
14474 : see if getaddrinfo exists
14475 set getaddrinfo d_getaddrinfo
14476 eval $inlibc
14477
14478 : see if getcwd exists
14479 set getcwd d_getcwd
14480 eval $inlibc
14481
14482 : see if getespwnam exists
14483 set getespwnam d_getespwnam
14484 eval $inlibc
14485
14486 : see if getfsstat exists
14487 set getfsstat d_getfsstat
14488 eval $inlibc
14489
14490 : see if getgrent exists
14491 set getgrent d_getgrent
14492 eval $inlibc
14493
14494 : see if getgrent_r exists
14495 set getgrent_r d_getgrent_r
14496 eval $inlibc
14497 case "$d_getgrent_r" in
14498 "$define")
14499         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14500         case "$d_getgrent_r_proto:$usethreads" in
14501         ":define")      d_getgrent_r_proto=define
14502                 set d_getgrent_r_proto getgrent_r $hdrs
14503                 eval $hasproto ;;
14504         *)      ;;
14505         esac
14506         case "$d_getgrent_r_proto" in
14507         define)
14508         case "$getgrent_r_proto" in
14509         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14510         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14511         esac
14512         case "$getgrent_r_proto" in
14513         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14514         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14515         esac
14516         case "$getgrent_r_proto" in
14517         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14518         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14519         esac
14520         case "$getgrent_r_proto" in
14521         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14522         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14523         esac
14524         case "$getgrent_r_proto" in
14525         ''|0) try='int getgrent_r(struct group*, char*, int);'
14526         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14527         esac
14528         case "$getgrent_r_proto" in
14529         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14530         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14531         esac
14532         case "$getgrent_r_proto" in
14533         ''|0)   d_getgrent_r=undef
14534                 getgrent_r_proto=0
14535                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14536         * )     case "$getgrent_r_proto" in
14537                 REENTRANT_PROTO*) ;;
14538                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14539                 esac
14540                 echo "Prototype: $try" ;;
14541         esac
14542         ;;
14543         *)      case "$usethreads" in
14544                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14545                 esac
14546                 d_getgrent_r=undef
14547                 getgrent_r_proto=0
14548                 ;;
14549         esac
14550         ;;
14551 *)      getgrent_r_proto=0
14552         ;;
14553 esac
14554
14555 : see if getgrgid_r exists
14556 set getgrgid_r d_getgrgid_r
14557 eval $inlibc
14558 case "$d_getgrgid_r" in
14559 "$define")
14560         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14561         case "$d_getgrgid_r_proto:$usethreads" in
14562         ":define")      d_getgrgid_r_proto=define
14563                 set d_getgrgid_r_proto getgrgid_r $hdrs
14564                 eval $hasproto ;;
14565         *)      ;;
14566         esac
14567         case "$d_getgrgid_r_proto" in
14568         define)
14569         case "$getgrgid_r_proto" in
14570         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14571         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14572         esac
14573         case "$getgrgid_r_proto" in
14574         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14575         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14576         esac
14577         case "$getgrgid_r_proto" in
14578         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14579         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14580         esac
14581         case "$getgrgid_r_proto" in
14582         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14583         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14584         esac
14585         case "$getgrgid_r_proto" in
14586         ''|0)   d_getgrgid_r=undef
14587                 getgrgid_r_proto=0
14588                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14589         * )     case "$getgrgid_r_proto" in
14590                 REENTRANT_PROTO*) ;;
14591                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14592                 esac
14593                 echo "Prototype: $try" ;;
14594         esac
14595         ;;
14596         *)      case "$usethreads" in
14597                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14598                 esac
14599                 d_getgrgid_r=undef
14600                 getgrgid_r_proto=0
14601                 ;;
14602         esac
14603         ;;
14604 *)      getgrgid_r_proto=0
14605         ;;
14606 esac
14607
14608 : see if getgrnam_r exists
14609 set getgrnam_r d_getgrnam_r
14610 eval $inlibc
14611 case "$d_getgrnam_r" in
14612 "$define")
14613         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14614         case "$d_getgrnam_r_proto:$usethreads" in
14615         ":define")      d_getgrnam_r_proto=define
14616                 set d_getgrnam_r_proto getgrnam_r $hdrs
14617                 eval $hasproto ;;
14618         *)      ;;
14619         esac
14620         case "$d_getgrnam_r_proto" in
14621         define)
14622         case "$getgrnam_r_proto" in
14623         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14624         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14625         esac
14626         case "$getgrnam_r_proto" in
14627         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14628         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14629         esac
14630         case "$getgrnam_r_proto" in
14631         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14632         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14633         esac
14634         case "$getgrnam_r_proto" in
14635         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14636         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14637         esac
14638         case "$getgrnam_r_proto" in
14639         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14640         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14641         esac
14642         case "$getgrnam_r_proto" in
14643         ''|0)   d_getgrnam_r=undef
14644                 getgrnam_r_proto=0
14645                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14646         * )     case "$getgrnam_r_proto" in
14647                 REENTRANT_PROTO*) ;;
14648                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14649                 esac
14650                 echo "Prototype: $try" ;;
14651         esac
14652         ;;
14653         *)      case "$usethreads" in
14654                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14655                 esac
14656                 d_getgrnam_r=undef
14657                 getgrnam_r_proto=0
14658                 ;;
14659         esac
14660         ;;
14661 *)      getgrnam_r_proto=0
14662         ;;
14663 esac
14664
14665 : see if gethostbyaddr exists
14666 set gethostbyaddr d_gethbyaddr
14667 eval $inlibc
14668
14669 : see if gethostbyname exists
14670 set gethostbyname d_gethbyname
14671 eval $inlibc
14672
14673 : see if gethostent exists
14674 set gethostent d_gethent
14675 eval $inlibc
14676
14677 : see how we will look up host name
14678 echo " "
14679 call=''
14680 if set gethostname val -f d_gethname; eval $csym; $val; then
14681         echo 'gethostname() found.' >&4
14682         d_gethname="$define"
14683         call=gethostname
14684 fi
14685 if set uname val -f d_uname; eval $csym; $val; then
14686         if ./xenix; then
14687                 $cat <<'EOM'
14688 uname() was found, but you're running xenix, and older versions of xenix
14689 have a broken uname(). If you don't really know whether your xenix is old
14690 enough to have a broken system call, use the default answer.
14691
14692 EOM
14693                 dflt=y
14694                 case "$d_uname" in
14695                 "$define") dflt=n;;
14696                 esac
14697                 rp='Is your uname() broken?'
14698                 . ./myread
14699                 case "$ans" in
14700                 n*) d_uname="$define"; call=uname;;
14701                 esac
14702         else
14703                 echo 'uname() found.' >&4
14704                 d_uname="$define"
14705                 case "$call" in
14706                 '') call=uname ;;
14707                 esac
14708         fi
14709 fi
14710 case "$d_gethname" in
14711 '') d_gethname="$undef";;
14712 esac
14713 case "$d_uname" in
14714 '') d_uname="$undef";;
14715 esac
14716 case "$d_uname$d_gethname" in
14717 *define*)
14718         dflt=n
14719         cat <<EOM
14720
14721 Every now and then someone has a $call() that lies about the hostname
14722 but can't be fixed for political or economic reasons.  If you wish, I can
14723 pretend $call() isn't there and maybe compute hostname at run-time
14724 thanks to the '$phostname' command.
14725
14726 EOM
14727         rp="Shall I ignore $call() from now on?"
14728         . ./myread
14729         case "$ans" in
14730         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14731         esac;;
14732 esac
14733 case "$phostname" in
14734 '') aphostname='';;
14735 *) case "$aphostname" in
14736         /*) ;;
14737         *) set X $phostname
14738                 shift
14739                 file=$1
14740                 shift
14741                 file=`./loc $file $file $pth`
14742                 aphostname=`echo $file $*`
14743                 ;;
14744         esac
14745         ;;
14746 esac
14747 case "$d_uname$d_gethname" in
14748 *define*) ;;
14749 *)
14750         case "$phostname" in
14751         '')
14752                 echo "There will be no way for $package to get your hostname." >&4;;
14753         *)
14754         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14755                 ;;
14756         esac;;
14757 esac
14758 case "$d_phostname" in
14759 '') d_phostname="$undef";;
14760 esac
14761
14762 : see if gethostbyaddr_r exists
14763 set gethostbyaddr_r d_gethostbyaddr_r
14764 eval $inlibc
14765 case "$d_gethostbyaddr_r" in
14766 "$define")
14767         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14768         case "$d_gethostbyaddr_r_proto:$usethreads" in
14769         ":define")      d_gethostbyaddr_r_proto=define
14770                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14771                 eval $hasproto ;;
14772         *)      ;;
14773         esac
14774         case "$d_gethostbyaddr_r_proto" in
14775         define)
14776         case "$gethostbyaddr_r_proto" in
14777         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14778         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14779         esac
14780         case "$gethostbyaddr_r_proto" in
14781         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14782         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14783         esac
14784         case "$gethostbyaddr_r_proto" in
14785         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14786         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14787         esac
14788         case "$gethostbyaddr_r_proto" in
14789         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14790         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14791         esac
14792         case "$gethostbyaddr_r_proto" in
14793         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14794         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14795         esac
14796         case "$gethostbyaddr_r_proto" in
14797         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14798         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14799         esac
14800         case "$gethostbyaddr_r_proto" in
14801         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14802         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14803         esac
14804         case "$gethostbyaddr_r_proto" in
14805         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14806         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14807         esac
14808         case "$gethostbyaddr_r_proto" in
14809         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14810         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14811         esac
14812         case "$gethostbyaddr_r_proto" in
14813         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14814         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14815         esac
14816         case "$gethostbyaddr_r_proto" in
14817         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14818         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14819         esac
14820         case "$gethostbyaddr_r_proto" in
14821         ''|0)   d_gethostbyaddr_r=undef
14822                 gethostbyaddr_r_proto=0
14823                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14824         * )     case "$gethostbyaddr_r_proto" in
14825                 REENTRANT_PROTO*) ;;
14826                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14827                 esac
14828                 echo "Prototype: $try" ;;
14829         esac
14830         ;;
14831         *)      case "$usethreads" in
14832                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14833                 esac
14834                 d_gethostbyaddr_r=undef
14835                 gethostbyaddr_r_proto=0
14836                 ;;
14837         esac
14838         ;;
14839 *)      gethostbyaddr_r_proto=0
14840         ;;
14841 esac
14842
14843 : see if gethostbyname_r exists
14844 set gethostbyname_r d_gethostbyname_r
14845 eval $inlibc
14846 case "$d_gethostbyname_r" in
14847 "$define")
14848         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14849         case "$d_gethostbyname_r_proto:$usethreads" in
14850         ":define")      d_gethostbyname_r_proto=define
14851                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14852                 eval $hasproto ;;
14853         *)      ;;
14854         esac
14855         case "$d_gethostbyname_r_proto" in
14856         define)
14857         case "$gethostbyname_r_proto" in
14858         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14859         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14860         esac
14861         case "$gethostbyname_r_proto" in
14862         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14863         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14864         esac
14865         case "$gethostbyname_r_proto" in
14866         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14867         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14868         esac
14869         case "$gethostbyname_r_proto" in
14870         ''|0)   d_gethostbyname_r=undef
14871                 gethostbyname_r_proto=0
14872                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14873         * )     case "$gethostbyname_r_proto" in
14874                 REENTRANT_PROTO*) ;;
14875                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14876                 esac
14877                 echo "Prototype: $try" ;;
14878         esac
14879         ;;
14880         *)      case "$usethreads" in
14881                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14882                 esac
14883                 d_gethostbyname_r=undef
14884                 gethostbyname_r_proto=0
14885                 ;;
14886         esac
14887         ;;
14888 *)      gethostbyname_r_proto=0
14889         ;;
14890 esac
14891
14892 : see if gethostent_r exists
14893 set gethostent_r d_gethostent_r
14894 eval $inlibc
14895 case "$d_gethostent_r" in
14896 "$define")
14897         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14898         case "$d_gethostent_r_proto:$usethreads" in
14899         ":define")      d_gethostent_r_proto=define
14900                 set d_gethostent_r_proto gethostent_r $hdrs
14901                 eval $hasproto ;;
14902         *)      ;;
14903         esac
14904         case "$d_gethostent_r_proto" in
14905         define)
14906         case "$gethostent_r_proto" in
14907         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14908         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14909         esac
14910         case "$gethostent_r_proto" in
14911         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14912         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14913         esac
14914         case "$gethostent_r_proto" in
14915         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14916         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14917         esac
14918         case "$gethostent_r_proto" in
14919         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14920         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14921         esac
14922         case "$gethostent_r_proto" in
14923         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14924         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14925         esac
14926         case "$gethostent_r_proto" in
14927         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14928         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14929         esac
14930         case "$gethostent_r_proto" in
14931         ''|0)   d_gethostent_r=undef
14932                 gethostent_r_proto=0
14933                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14934         * )     case "$gethostent_r_proto" in
14935                 REENTRANT_PROTO*) ;;
14936                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14937                 esac
14938                 echo "Prototype: $try" ;;
14939         esac
14940         ;;
14941         *)      case "$usethreads" in
14942                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14943                 esac
14944                 d_gethostent_r=undef
14945                 gethostent_r_proto=0
14946                 ;;
14947         esac
14948         ;;
14949 *)      gethostent_r_proto=0
14950         ;;
14951 esac
14952
14953 : see if prototypes for various gethostxxx netdb.h functions are available
14954 echo " "
14955 set d_gethostprotos gethostent $i_netdb netdb.h
14956 eval $hasproto
14957
14958 : see if getitimer exists
14959 set getitimer d_getitimer
14960 eval $inlibc
14961
14962 : see if getlogin exists
14963 set getlogin d_getlogin
14964 eval $inlibc
14965
14966 : see if getlogin_r exists
14967 set getlogin_r d_getlogin_r
14968 eval $inlibc
14969 case "$d_getlogin_r" in
14970 "$define")
14971         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14972         case "$d_getlogin_r_proto:$usethreads" in
14973         ":define")      d_getlogin_r_proto=define
14974                 set d_getlogin_r_proto getlogin_r $hdrs
14975                 eval $hasproto ;;
14976         *)      ;;
14977         esac
14978         case "$d_getlogin_r_proto" in
14979         define)
14980         case "$getlogin_r_proto" in
14981         ''|0) try='int getlogin_r(char*, size_t);'
14982         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14983         esac
14984         case "$getlogin_r_proto" in
14985         ''|0) try='int getlogin_r(char*, int);'
14986         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14987         esac
14988         case "$getlogin_r_proto" in
14989         ''|0) try='char* getlogin_r(char*, size_t);'
14990         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14991         esac
14992         case "$getlogin_r_proto" in
14993         ''|0) try='char* getlogin_r(char*, int);'
14994         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14995         esac
14996         case "$getlogin_r_proto" in
14997         ''|0)   d_getlogin_r=undef
14998                 getlogin_r_proto=0
14999                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
15000         * )     case "$getlogin_r_proto" in
15001                 REENTRANT_PROTO*) ;;
15002                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
15003                 esac
15004                 echo "Prototype: $try" ;;
15005         esac
15006         ;;
15007         *)      case "$usethreads" in
15008                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
15009                 esac
15010                 d_getlogin_r=undef
15011                 getlogin_r_proto=0
15012                 ;;
15013         esac
15014         ;;
15015 *)      getlogin_r_proto=0
15016         ;;
15017 esac
15018
15019 : see if getmnt exists
15020 set getmnt d_getmnt
15021 eval $inlibc
15022
15023 : see if getmntent exists
15024 set getmntent d_getmntent
15025 eval $inlibc
15026
15027 : see if getnameinfo exists
15028 set getnameinfo d_getnameinfo
15029 eval $inlibc
15030
15031 : see if getnetbyaddr exists
15032 set getnetbyaddr d_getnbyaddr
15033 eval $inlibc
15034
15035 : see if getnetbyname exists
15036 set getnetbyname d_getnbyname
15037 eval $inlibc
15038
15039 : see if getnetent exists
15040 set getnetent d_getnent
15041 eval $inlibc
15042
15043 : see if getnetbyaddr_r exists
15044 set getnetbyaddr_r d_getnetbyaddr_r
15045 eval $inlibc
15046 case "$d_getnetbyaddr_r" in
15047 "$define")
15048         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15049         case "$d_getnetbyaddr_r_proto:$usethreads" in
15050         ":define")      d_getnetbyaddr_r_proto=define
15051                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
15052                 eval $hasproto ;;
15053         *)      ;;
15054         esac
15055         case "$d_getnetbyaddr_r_proto" in
15056         define)
15057         case "$getnetbyaddr_r_proto" in
15058         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
15059         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
15060         esac
15061         case "$getnetbyaddr_r_proto" in
15062         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
15063         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
15064         esac
15065         case "$getnetbyaddr_r_proto" in
15066         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
15067         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
15068         esac
15069         case "$getnetbyaddr_r_proto" in
15070         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
15071         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
15072         esac
15073         case "$getnetbyaddr_r_proto" in
15074         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
15075         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
15076         esac
15077         case "$getnetbyaddr_r_proto" in
15078         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
15079         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
15080         esac
15081         case "$getnetbyaddr_r_proto" in
15082         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
15083         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
15084         esac
15085         case "$getnetbyaddr_r_proto" in
15086         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
15087         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
15088         esac
15089         case "$getnetbyaddr_r_proto" in
15090         ''|0)   d_getnetbyaddr_r=undef
15091                 getnetbyaddr_r_proto=0
15092                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
15093         * )     case "$getnetbyaddr_r_proto" in
15094                 REENTRANT_PROTO*) ;;
15095                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
15096                 esac
15097                 echo "Prototype: $try" ;;
15098         esac
15099         ;;
15100         *)      case "$usethreads" in
15101                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
15102                 esac
15103                 d_getnetbyaddr_r=undef
15104                 getnetbyaddr_r_proto=0
15105                 ;;
15106         esac
15107         ;;
15108 *)      getnetbyaddr_r_proto=0
15109         ;;
15110 esac
15111
15112 : see if getnetbyname_r exists
15113 set getnetbyname_r d_getnetbyname_r
15114 eval $inlibc
15115 case "$d_getnetbyname_r" in
15116 "$define")
15117         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15118         case "$d_getnetbyname_r_proto:$usethreads" in
15119         ":define")      d_getnetbyname_r_proto=define
15120                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
15121                 eval $hasproto ;;
15122         *)      ;;
15123         esac
15124         case "$d_getnetbyname_r_proto" in
15125         define)
15126         case "$getnetbyname_r_proto" in
15127         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
15128         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
15129         esac
15130         case "$getnetbyname_r_proto" in
15131         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
15132         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
15133         esac
15134         case "$getnetbyname_r_proto" in
15135         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
15136         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
15137         esac
15138         case "$getnetbyname_r_proto" in
15139         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
15140         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
15141         esac
15142         case "$getnetbyname_r_proto" in
15143         ''|0)   d_getnetbyname_r=undef
15144                 getnetbyname_r_proto=0
15145                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
15146         * )     case "$getnetbyname_r_proto" in
15147                 REENTRANT_PROTO*) ;;
15148                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
15149                 esac
15150                 echo "Prototype: $try" ;;
15151         esac
15152         ;;
15153         *)      case "$usethreads" in
15154                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
15155                 esac
15156                 d_getnetbyname_r=undef
15157                 getnetbyname_r_proto=0
15158                 ;;
15159         esac
15160         ;;
15161 *)      getnetbyname_r_proto=0
15162         ;;
15163 esac
15164
15165 : see if getnetent_r exists
15166 set getnetent_r d_getnetent_r
15167 eval $inlibc
15168 case "$d_getnetent_r" in
15169 "$define")
15170         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15171         case "$d_getnetent_r_proto:$usethreads" in
15172         ":define")      d_getnetent_r_proto=define
15173                 set d_getnetent_r_proto getnetent_r $hdrs
15174                 eval $hasproto ;;
15175         *)      ;;
15176         esac
15177         case "$d_getnetent_r_proto" in
15178         define)
15179         case "$getnetent_r_proto" in
15180         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
15181         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
15182         esac
15183         case "$getnetent_r_proto" in
15184         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
15185         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
15186         esac
15187         case "$getnetent_r_proto" in
15188         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
15189         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
15190         esac
15191         case "$getnetent_r_proto" in
15192         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
15193         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
15194         esac
15195         case "$getnetent_r_proto" in
15196         ''|0) try='int getnetent_r(struct netent*, char*, int);'
15197         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
15198         esac
15199         case "$getnetent_r_proto" in
15200         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
15201         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
15202         esac
15203         case "$getnetent_r_proto" in
15204         ''|0)   d_getnetent_r=undef
15205                 getnetent_r_proto=0
15206                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
15207         * )     case "$getnetent_r_proto" in
15208                 REENTRANT_PROTO*) ;;
15209                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
15210                 esac
15211                 echo "Prototype: $try" ;;
15212         esac
15213         ;;
15214         *)      case "$usethreads" in
15215                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
15216                 esac
15217                 d_getnetent_r=undef
15218                 getnetent_r_proto=0
15219                 ;;
15220         esac
15221         ;;
15222 *)      getnetent_r_proto=0
15223         ;;
15224 esac
15225
15226 : see if prototypes for various getnetxxx netdb.h functions are available
15227 echo " "
15228 set d_getnetprotos getnetent $i_netdb netdb.h
15229 eval $hasproto
15230
15231 : see if getpagesize exists
15232 set getpagesize d_getpagsz
15233 eval $inlibc
15234
15235 : Optional checks for getprotobyname and getprotobynumber
15236
15237 : see if getprotobyname exists
15238 set getprotobyname d_getpbyname
15239 eval $inlibc
15240
15241 : see if getprotobynumber exists
15242 set getprotobynumber d_getpbynumber
15243 eval $inlibc
15244
15245 : see if getprotoent exists
15246 set getprotoent d_getpent
15247 eval $inlibc
15248
15249 : see if getpgid exists
15250 set getpgid d_getpgid
15251 eval $inlibc
15252
15253 : see if getpgrp2 exists
15254 set getpgrp2 d_getpgrp2
15255 eval $inlibc
15256
15257 : see if getppid exists
15258 set getppid d_getppid
15259 eval $inlibc
15260
15261 : see if getpriority exists
15262 set getpriority d_getprior
15263 eval $inlibc
15264
15265 : see if getprotobyname_r exists
15266 set getprotobyname_r d_getprotobyname_r
15267 eval $inlibc
15268 case "$d_getprotobyname_r" in
15269 "$define")
15270         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15271         case "$d_getprotobyname_r_proto:$usethreads" in
15272         ":define")      d_getprotobyname_r_proto=define
15273                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
15274                 eval $hasproto ;;
15275         *)      ;;
15276         esac
15277         case "$d_getprotobyname_r_proto" in
15278         define)
15279         case "$getprotobyname_r_proto" in
15280         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15281         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15282         esac
15283         case "$getprotobyname_r_proto" in
15284         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15285         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15286         esac
15287         case "$getprotobyname_r_proto" in
15288         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15289         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15290         esac
15291         case "$getprotobyname_r_proto" in
15292         ''|0)   d_getprotobyname_r=undef
15293                 getprotobyname_r_proto=0
15294                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15295         * )     case "$getprotobyname_r_proto" in
15296                 REENTRANT_PROTO*) ;;
15297                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15298                 esac
15299                 echo "Prototype: $try" ;;
15300         esac
15301         ;;
15302         *)      case "$usethreads" in
15303                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15304                 esac
15305                 d_getprotobyname_r=undef
15306                 getprotobyname_r_proto=0
15307                 ;;
15308         esac
15309         ;;
15310 *)      getprotobyname_r_proto=0
15311         ;;
15312 esac
15313
15314 : see if getprotobynumber_r exists
15315 set getprotobynumber_r d_getprotobynumber_r
15316 eval $inlibc
15317 case "$d_getprotobynumber_r" in
15318 "$define")
15319         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15320         case "$d_getprotobynumber_r_proto:$usethreads" in
15321         ":define")      d_getprotobynumber_r_proto=define
15322                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15323                 eval $hasproto ;;
15324         *)      ;;
15325         esac
15326         case "$d_getprotobynumber_r_proto" in
15327         define)
15328         case "$getprotobynumber_r_proto" in
15329         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15330         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15331         esac
15332         case "$getprotobynumber_r_proto" in
15333         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15334         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15335         esac
15336         case "$getprotobynumber_r_proto" in
15337         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15338         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15339         esac
15340         case "$getprotobynumber_r_proto" in
15341         ''|0)   d_getprotobynumber_r=undef
15342                 getprotobynumber_r_proto=0
15343                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15344         * )     case "$getprotobynumber_r_proto" in
15345                 REENTRANT_PROTO*) ;;
15346                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15347                 esac
15348                 echo "Prototype: $try" ;;
15349         esac
15350         ;;
15351         *)      case "$usethreads" in
15352                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15353                 esac
15354                 d_getprotobynumber_r=undef
15355                 getprotobynumber_r_proto=0
15356                 ;;
15357         esac
15358         ;;
15359 *)      getprotobynumber_r_proto=0
15360         ;;
15361 esac
15362
15363 : see if getprotoent_r exists
15364 set getprotoent_r d_getprotoent_r
15365 eval $inlibc
15366 case "$d_getprotoent_r" in
15367 "$define")
15368         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15369         case "$d_getprotoent_r_proto:$usethreads" in
15370         ":define")      d_getprotoent_r_proto=define
15371                 set d_getprotoent_r_proto getprotoent_r $hdrs
15372                 eval $hasproto ;;
15373         *)      ;;
15374         esac
15375         case "$d_getprotoent_r_proto" in
15376         define)
15377         case "$getprotoent_r_proto" in
15378         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15379         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15380         esac
15381         case "$getprotoent_r_proto" in
15382         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15383         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15384         esac
15385         case "$getprotoent_r_proto" in
15386         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15387         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15388         esac
15389         case "$getprotoent_r_proto" in
15390         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15391         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15392         esac
15393         case "$getprotoent_r_proto" in
15394         ''|0)   d_getprotoent_r=undef
15395                 getprotoent_r_proto=0
15396                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15397         * )     case "$getprotoent_r_proto" in
15398                 REENTRANT_PROTO*) ;;
15399                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15400                 esac
15401                 echo "Prototype: $try" ;;
15402         esac
15403         ;;
15404         *)      case "$usethreads" in
15405                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15406                 esac
15407                 d_getprotoent_r=undef
15408                 getprotoent_r_proto=0
15409                 ;;
15410         esac
15411         ;;
15412 *)      getprotoent_r_proto=0
15413         ;;
15414 esac
15415
15416 : see if prototypes for various getprotoxxx netdb.h functions are available
15417 echo " "
15418 set d_getprotoprotos getprotoent $i_netdb netdb.h
15419 eval $hasproto
15420
15421 : see if getprpwnam exists
15422 set getprpwnam d_getprpwnam
15423 eval $inlibc
15424
15425 : see if getpwent exists
15426 set getpwent d_getpwent
15427 eval $inlibc
15428
15429 : see if getpwent_r exists
15430 set getpwent_r d_getpwent_r
15431 eval $inlibc
15432 case "$d_getpwent_r" in
15433 "$define")
15434         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15435         case "$d_getpwent_r_proto:$usethreads" in
15436         ":define")      d_getpwent_r_proto=define
15437                 set d_getpwent_r_proto getpwent_r $hdrs
15438                 eval $hasproto ;;
15439         *)      ;;
15440         esac
15441         case "$d_getpwent_r_proto" in
15442         define)
15443         case "$getpwent_r_proto" in
15444         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15445         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15446         esac
15447         case "$getpwent_r_proto" in
15448         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15449         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15450         esac
15451         case "$getpwent_r_proto" in
15452         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15453         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15454         esac
15455         case "$getpwent_r_proto" in
15456         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15457         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15458         esac
15459         case "$getpwent_r_proto" in
15460         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15461         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15462         esac
15463         case "$getpwent_r_proto" in
15464         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15465         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15466         esac
15467         case "$getpwent_r_proto" in
15468         ''|0)   d_getpwent_r=undef
15469                 getpwent_r_proto=0
15470                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15471         * )     case "$getpwent_r_proto" in
15472                 REENTRANT_PROTO*) ;;
15473                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15474                 esac
15475                 echo "Prototype: $try" ;;
15476         esac
15477         ;;
15478         *)      case "$usethreads" in
15479                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15480                 esac
15481                 d_getpwent_r=undef
15482                 getpwent_r_proto=0
15483                 ;;
15484         esac
15485         ;;
15486 *)      getpwent_r_proto=0
15487         ;;
15488 esac
15489
15490 : see if getpwnam_r exists
15491 set getpwnam_r d_getpwnam_r
15492 eval $inlibc
15493 case "$d_getpwnam_r" in
15494 "$define")
15495         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15496         case "$d_getpwnam_r_proto:$usethreads" in
15497         ":define")      d_getpwnam_r_proto=define
15498                 set d_getpwnam_r_proto getpwnam_r $hdrs
15499                 eval $hasproto ;;
15500         *)      ;;
15501         esac
15502         case "$d_getpwnam_r_proto" in
15503         define)
15504         case "$getpwnam_r_proto" in
15505         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15506         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15507         esac
15508         case "$getpwnam_r_proto" in
15509         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15510         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15511         esac
15512         case "$getpwnam_r_proto" in
15513         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15514         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15515         esac
15516         case "$getpwnam_r_proto" in
15517         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15518         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15519         esac
15520         case "$getpwnam_r_proto" in
15521         ''|0)   d_getpwnam_r=undef
15522                 getpwnam_r_proto=0
15523                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15524         * )     case "$getpwnam_r_proto" in
15525                 REENTRANT_PROTO*) ;;
15526                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15527                 esac
15528                 echo "Prototype: $try" ;;
15529         esac
15530         ;;
15531         *)      case "$usethreads" in
15532                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15533                 esac
15534                 d_getpwnam_r=undef
15535                 getpwnam_r_proto=0
15536                 ;;
15537         esac
15538         ;;
15539 *)      getpwnam_r_proto=0
15540         ;;
15541 esac
15542
15543 : see if getpwuid_r exists
15544 set getpwuid_r d_getpwuid_r
15545 eval $inlibc
15546 case "$d_getpwuid_r" in
15547 "$define")
15548         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15549         case "$d_getpwuid_r_proto:$usethreads" in
15550         ":define")      d_getpwuid_r_proto=define
15551                 set d_getpwuid_r_proto getpwuid_r $hdrs
15552                 eval $hasproto ;;
15553         *)      ;;
15554         esac
15555         case "$d_getpwuid_r_proto" in
15556         define)
15557         case "$getpwuid_r_proto" in
15558         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15559         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15560         esac
15561         case "$getpwuid_r_proto" in
15562         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15563         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15564         esac
15565         case "$getpwuid_r_proto" in
15566         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15567         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15568         esac
15569         case "$getpwuid_r_proto" in
15570         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15571         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15572         esac
15573         case "$getpwuid_r_proto" in
15574         ''|0)   d_getpwuid_r=undef
15575                 getpwuid_r_proto=0
15576                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15577         * )     case "$getpwuid_r_proto" in
15578                 REENTRANT_PROTO*) ;;
15579                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15580                 esac
15581                 echo "Prototype: $try" ;;
15582         esac
15583         ;;
15584         *)      case "$usethreads" in
15585                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15586                 esac
15587                 d_getpwuid_r=undef
15588                 getpwuid_r_proto=0
15589                 ;;
15590         esac
15591         ;;
15592 *)      getpwuid_r_proto=0
15593         ;;
15594 esac
15595
15596 : Optional checks for getsbyname and getsbyport
15597
15598 : see if getservbyname exists
15599 set getservbyname d_getsbyname
15600 eval $inlibc
15601
15602 : see if getservbyport exists
15603 set getservbyport d_getsbyport
15604 eval $inlibc
15605
15606 : see if getservent exists
15607 set getservent d_getsent
15608 eval $inlibc
15609
15610 : see if getservbyname_r exists
15611 set getservbyname_r d_getservbyname_r
15612 eval $inlibc
15613 case "$d_getservbyname_r" in
15614 "$define")
15615         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15616         case "$d_getservbyname_r_proto:$usethreads" in
15617         ":define")      d_getservbyname_r_proto=define
15618                 set d_getservbyname_r_proto getservbyname_r $hdrs
15619                 eval $hasproto ;;
15620         *)      ;;
15621         esac
15622         case "$d_getservbyname_r_proto" in
15623         define)
15624         case "$getservbyname_r_proto" in
15625         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15626         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15627         esac
15628         case "$getservbyname_r_proto" in
15629         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15630         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15631         esac
15632         case "$getservbyname_r_proto" in
15633         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15634         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15635         esac
15636         case "$getservbyname_r_proto" in
15637         ''|0)   d_getservbyname_r=undef
15638                 getservbyname_r_proto=0
15639                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15640         * )     case "$getservbyname_r_proto" in
15641                 REENTRANT_PROTO*) ;;
15642                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15643                 esac
15644                 echo "Prototype: $try" ;;
15645         esac
15646         ;;
15647         *)      case "$usethreads" in
15648                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15649                 esac
15650                 d_getservbyname_r=undef
15651                 getservbyname_r_proto=0
15652                 ;;
15653         esac
15654         ;;
15655 *)      getservbyname_r_proto=0
15656         ;;
15657 esac
15658
15659 : see if getservbyport_r exists
15660 set getservbyport_r d_getservbyport_r
15661 eval $inlibc
15662 case "$d_getservbyport_r" in
15663 "$define")
15664         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15665         case "$d_getservbyport_r_proto:$usethreads" in
15666         ":define")      d_getservbyport_r_proto=define
15667                 set d_getservbyport_r_proto getservbyport_r $hdrs
15668                 eval $hasproto ;;
15669         *)      ;;
15670         esac
15671         case "$d_getservbyport_r_proto" in
15672         define)
15673         case "$getservbyport_r_proto" in
15674         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15675         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15676         esac
15677         case "$getservbyport_r_proto" in
15678         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15679         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15680         esac
15681         case "$getservbyport_r_proto" in
15682         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15683         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15684         esac
15685         case "$getservbyport_r_proto" in
15686         ''|0)   d_getservbyport_r=undef
15687                 getservbyport_r_proto=0
15688                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15689         * )     case "$getservbyport_r_proto" in
15690                 REENTRANT_PROTO*) ;;
15691                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15692                 esac
15693                 echo "Prototype: $try" ;;
15694         esac
15695         ;;
15696         *)      case "$usethreads" in
15697                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15698                 esac
15699                 d_getservbyport_r=undef
15700                 getservbyport_r_proto=0
15701                 ;;
15702         esac
15703         ;;
15704 *)      getservbyport_r_proto=0
15705         ;;
15706 esac
15707
15708 : see if getservent_r exists
15709 set getservent_r d_getservent_r
15710 eval $inlibc
15711 case "$d_getservent_r" in
15712 "$define")
15713         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15714         case "$d_getservent_r_proto:$usethreads" in
15715         ":define")      d_getservent_r_proto=define
15716                 set d_getservent_r_proto getservent_r $hdrs
15717                 eval $hasproto ;;
15718         *)      ;;
15719         esac
15720         case "$d_getservent_r_proto" in
15721         define)
15722         case "$getservent_r_proto" in
15723         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15724         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15725         esac
15726         case "$getservent_r_proto" in
15727         ''|0) try='int getservent_r(struct servent*, char*, int);'
15728         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15729         esac
15730         case "$getservent_r_proto" in
15731         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15732         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15733         esac
15734         case "$getservent_r_proto" in
15735         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15736         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15737         esac
15738         case "$getservent_r_proto" in
15739         ''|0)   d_getservent_r=undef
15740                 getservent_r_proto=0
15741                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15742         * )     case "$getservent_r_proto" in
15743                 REENTRANT_PROTO*) ;;
15744                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15745                 esac
15746                 echo "Prototype: $try" ;;
15747         esac
15748         ;;
15749         *)      case "$usethreads" in
15750                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15751                 esac
15752                 d_getservent_r=undef
15753                 getservent_r_proto=0
15754                 ;;
15755         esac
15756         ;;
15757 *)      getservent_r_proto=0
15758         ;;
15759 esac
15760
15761 : see if prototypes for various getservxxx netdb.h functions are available
15762 echo " "
15763 set d_getservprotos getservent $i_netdb netdb.h
15764 eval $hasproto
15765
15766 : see if getspnam exists
15767 set getspnam d_getspnam
15768 eval $inlibc
15769
15770 : see if this is a shadow.h system
15771 set shadow.h i_shadow
15772 eval $inhdr
15773
15774 : see if getspnam_r exists
15775 set getspnam_r d_getspnam_r
15776 eval $inlibc
15777 case "$d_getspnam_r" in
15778 "$define")
15779         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15780         case "$d_getspnam_r_proto:$usethreads" in
15781         ":define")      d_getspnam_r_proto=define
15782                 set d_getspnam_r_proto getspnam_r $hdrs
15783                 eval $hasproto ;;
15784         *)      ;;
15785         esac
15786         case "$d_getspnam_r_proto" in
15787         define)
15788         case "$getspnam_r_proto" in
15789         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15790         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15791         esac
15792         case "$getspnam_r_proto" in
15793         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15794         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15795         esac
15796         case "$getspnam_r_proto" in
15797         ''|0)   d_getspnam_r=undef
15798                 getspnam_r_proto=0
15799                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15800         * )     case "$getspnam_r_proto" in
15801                 REENTRANT_PROTO*) ;;
15802                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15803                 esac
15804                 echo "Prototype: $try" ;;
15805         esac
15806         ;;
15807         *)      case "$usethreads" in
15808                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15809                 esac
15810                 d_getspnam_r=undef
15811                 getspnam_r_proto=0
15812                 ;;
15813         esac
15814         ;;
15815 *)      getspnam_r_proto=0
15816         ;;
15817 esac
15818
15819 : see if gettimeofday or ftime exists
15820 set gettimeofday d_gettimeod
15821 eval $inlibc
15822 case "$d_gettimeod" in
15823 "$undef")
15824         set ftime d_ftime 
15825         eval $inlibc
15826         ;;
15827 *)
15828         val="$undef"; set d_ftime; eval $setvar
15829         ;;
15830 esac
15831 case "$d_gettimeod$d_ftime" in
15832 "$undef$undef")
15833         echo " "
15834         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15835         ;;
15836 esac
15837
15838 : see if gmtime_r exists
15839 set gmtime_r d_gmtime_r
15840 eval $inlibc
15841 case "$d_gmtime_r" in
15842 "$define")
15843         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15844         case "$d_gmtime_r_proto:$usethreads" in
15845         ":define")      d_gmtime_r_proto=define
15846                 set d_gmtime_r_proto gmtime_r $hdrs
15847                 eval $hasproto ;;
15848         *)      ;;
15849         esac
15850         case "$d_gmtime_r_proto" in
15851         define)
15852         case "$gmtime_r_proto" in
15853         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15854         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15855         esac
15856         case "$gmtime_r_proto" in
15857         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15858         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15859         esac
15860         case "$gmtime_r_proto" in
15861         ''|0)   d_gmtime_r=undef
15862                 gmtime_r_proto=0
15863                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15864         * )     case "$gmtime_r_proto" in
15865                 REENTRANT_PROTO*) ;;
15866                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15867                 esac
15868                 echo "Prototype: $try" ;;
15869         esac
15870         ;;
15871         *)      case "$usethreads" in
15872                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15873                 esac
15874                 d_gmtime_r=undef
15875                 gmtime_r_proto=0
15876                 ;;
15877         esac
15878         ;;
15879 *)      gmtime_r_proto=0
15880         ;;
15881 esac
15882
15883 : see if hasmntopt exists
15884 set hasmntopt d_hasmntopt
15885 eval $inlibc
15886
15887 : see if this is a netinet/in.h or sys/in.h system
15888 set netinet/in.h i_niin sys/in.h i_sysin
15889 eval $inhdr
15890
15891 : see if arpa/inet.h has to be included
15892 set arpa/inet.h i_arpainet
15893 eval $inhdr
15894
15895 : see if htonl --and friends-- exists
15896 val=''
15897 set htonl val
15898 eval $inlibc
15899
15900 : Maybe they are macros.
15901 case "$val" in
15902 $undef)
15903         $cat >htonl.c <<EOM
15904 #include <stdio.h>
15905 #include <sys/types.h>
15906 #$i_niin I_NETINET_IN
15907 #$i_sysin I_SYS_IN
15908 #$i_arpainet I_ARPA_INET
15909 #ifdef I_NETINET_IN
15910 #include <netinet/in.h>
15911 #endif
15912 #ifdef I_SYS_IN
15913 #include <sys/in.h>
15914 #endif
15915 #ifdef I_ARPA_INET
15916 #include <arpa/inet.h>
15917 #endif
15918 #ifdef htonl
15919 printf("Defined as a macro.");
15920 #endif
15921 EOM
15922         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15923         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15924                 val="$define"
15925                 echo "But it seems to be defined as a macro." >&4
15926         fi
15927         $rm -f htonl.?
15928         ;;
15929 esac
15930 set d_htonl
15931 eval $setvar
15932
15933 : see if hypot exists
15934 set hypot d_hypot
15935 eval $inlibc
15936
15937 : see if ilogb exists
15938 set ilogb d_ilogb
15939 eval $inlibc
15940
15941 : see if ilogbl exists
15942 set ilogbl d_ilogbl
15943 eval $inlibc
15944
15945 : index or strchr
15946 echo " "
15947 if set index val -f; eval $csym; $val; then
15948         if set strchr val -f d_strchr; eval $csym; $val; then
15949                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15950                         val="$define"
15951                         vali="$undef"
15952                         echo "strchr() found." >&4
15953                 else
15954                         val="$undef"
15955                         vali="$define"
15956                         echo "index() found." >&4
15957                 fi
15958         else
15959                 val="$undef"
15960                 vali="$define"
15961                 echo "index() found." >&4
15962         fi
15963 else
15964         if set strchr val -f d_strchr; eval $csym; $val; then
15965                 val="$define"
15966                 vali="$undef"
15967                 echo "strchr() found." >&4
15968         else
15969                 echo "No index() or strchr() found!" >&4
15970                 val="$undef"
15971                 vali="$undef"
15972         fi
15973 fi
15974 set d_strchr; eval $setvar
15975 val="$vali"
15976 set d_index; eval $setvar
15977
15978 : check whether inet_aton exists
15979 set inet_aton d_inetaton
15980 eval $inlibc
15981
15982 : see if inet_ntop exists
15983 set inet_ntop d_inetntop
15984 eval $inlibc
15985
15986 : see if inet_pton exists
15987 set inet_pton d_inetpton
15988 eval $inlibc
15989
15990 : Look for isascii
15991 echo " "
15992 $cat >isascii.c <<EOCP
15993 #include <stdio.h>
15994 #include <ctype.h>
15995 #$i_stdlib I_STDLIB
15996 #ifdef I_STDLIB
15997 #include <stdlib.h>
15998 #endif
15999 int main() {
16000         int c = 'A';
16001         if (isascii(c))
16002                 exit(0);
16003         else
16004                 exit(1);
16005 }
16006 EOCP
16007 set isascii
16008 if eval $compile; then
16009         echo "isascii() found." >&4
16010         val="$define"
16011 else
16012         echo "isascii() NOT found." >&4
16013         val="$undef"
16014 fi
16015 set d_isascii
16016 eval $setvar
16017 $rm -f isascii*
16018
16019 : Look for isblank
16020 echo " "
16021 $cat >isblank.c <<'EOCP'
16022 #include <stdio.h>
16023 #include <ctype.h>
16024 int main() {
16025         int c = ' ';
16026         if (isblank(c))
16027                 return 0 ;
16028         else
16029                 return 1 ;
16030 }
16031 EOCP
16032 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
16033         echo "isblank() found." >&4
16034         val="$define"
16035 else
16036         echo "isblank() NOT found." >&4
16037         val="$undef"
16038 fi
16039 set d_isblank
16040 eval $setvar
16041 $rm -f isblank*
16042
16043 : check for isfinite
16044 echo "Checking to see if you have isfinite..." >&4
16045 $cat >try.c <<EOCP
16046 #$i_math I_MATH
16047 #ifdef I_MATH
16048 #include <math.h>
16049 #endif
16050 int main() { return isfinite(0.0); }
16051 EOCP
16052 set try
16053 if eval $compile; then
16054         val="$define"
16055         echo "You have isfinite."
16056 else
16057         val="$undef"
16058         echo "You do not have isfinite."
16059 fi
16060 $rm_try
16061 set d_isfinite
16062 eval $setvar
16063
16064 : see if isfinitel exists
16065 set isfinitel d_isfinitel
16066 eval $inlibc
16067
16068 : check for isinf
16069 echo "Checking to see if you have isinf..." >&4
16070 $cat >try.c <<EOCP
16071 #$i_math I_MATH
16072 #ifdef I_MATH
16073 #include <math.h>
16074 #endif
16075 int main() { return isinf(0.0); }
16076 EOCP
16077 set try
16078 if eval $compile; then
16079         val="$define"
16080         echo "You have isinf."
16081 else
16082         val="$undef"
16083         echo "You do not have isinf."
16084 fi
16085 $rm_try
16086 set d_isinf
16087 eval $setvar
16088
16089 : see if isinfl exists
16090 set isinfl d_isinfl
16091 eval $inlibc
16092
16093 : check for isless
16094 echo "Checking to see if you have isless..." >&4
16095 $cat >try.c <<EOCP
16096 #$i_math I_MATH
16097 #ifdef I_MATH
16098 #include <math.h>
16099 #endif
16100 int main() { return isless(0.0); }
16101 EOCP
16102 set try
16103 if eval $compile; then
16104         val="$define"
16105         echo "You have isless."
16106 else
16107         val="$undef"
16108         echo "You do not have isless."
16109 fi
16110 $rm_try
16111 set d_isless
16112 eval $setvar
16113
16114 : check for isnan
16115 echo "Checking to see if you have isnan..." >&4
16116 $cat >try.c <<EOCP
16117 #$i_math I_MATH
16118 #ifdef I_MATH
16119 #include <math.h>
16120 #endif
16121 int main() { return isnan(0.0); }
16122 EOCP
16123 set try
16124 if eval $compile; then
16125         val="$define"
16126         echo "You have isnan."
16127 else
16128         val="$undef"
16129         echo "You do not have isnan."
16130 fi
16131 $rm_try
16132 set d_isnan
16133 eval $setvar
16134
16135 : see if isnanl exists
16136 set isnanl d_isnanl
16137 eval $inlibc
16138
16139 : check for isnormal
16140 echo "Checking to see if you have isnormal..." >&4
16141 $cat >try.c <<EOCP
16142 #$i_math I_MATH
16143 #ifdef I_MATH
16144 #include <math.h>
16145 #endif
16146 int main() { return isnormal(0.0); }
16147 EOCP
16148 set try
16149 if eval $compile; then
16150         val="$define"
16151         echo "You have isnormal."
16152 else
16153         val="$undef"
16154         echo "You do not have isnormal."
16155 fi
16156 $rm_try
16157 set d_isnormal
16158 eval $setvar
16159
16160 : see if j0 exists
16161 set j0 d_j0
16162 eval $inlibc
16163
16164 : see if j0l exists
16165 set j0l d_j0l
16166 eval $inlibc
16167
16168 : see if killpg exists
16169 set killpg d_killpg
16170 eval $inlibc
16171
16172 : see if localeconv exists
16173 set localeconv d_locconv
16174 eval $inlibc
16175
16176 : see if libc has the POSIX.1-2008 currency locale rules
16177 case "$d_locconv:$d_lc_monetary_2008" in
16178 $define:)
16179         $cat >try.c <<EOCP
16180 #include <locale.h>
16181 int main() {
16182         struct lconv *lc = localeconv();
16183         char int_p_cs_precedes = lc->int_p_cs_precedes;
16184         return 0;
16185 }
16186 EOCP
16187         set try
16188         if eval $compile; then
16189                 d_lc_monetary_2008="$define"
16190         else
16191                 d_lc_monetary_2008="$undef"
16192         fi;
16193         $rm_try
16194         ;;
16195 esac
16196
16197 : see if lchown exists
16198 echo " "
16199 $cat > try.c <<'EOCP'
16200 /* System header to define __stub macros and hopefully few prototypes,
16201     which can conflict with char lchown(); below.  */
16202 #include <assert.h>
16203 /* Override any gcc2 internal prototype to avoid an error.  */
16204 /* We use char because int might match the return type of a gcc2
16205    builtin and then its argument prototype would still apply.  */
16206 char lchown();
16207 int main() {
16208     /*  The GNU C library defines this for functions which it implements
16209         to always fail with ENOSYS.  Some functions are actually named
16210         something starting with __ and the normal name is an alias.  */
16211 #if defined (__stub_lchown) || defined (__stub___lchown)
16212 choke me
16213 #else
16214 lchown();
16215 #endif
16216 ; return 0; }
16217 EOCP
16218 set try
16219 if eval $compile; then
16220     $echo "lchown() found." >&4
16221     val="$define"
16222 else
16223     $echo "lchown() NOT found." >&4
16224     val="$undef"
16225 fi
16226 set d_lchown
16227 eval $setvar
16228
16229 : See if number of significant digits in a double precision number is known
16230 echo " "
16231 $cat >ldbl_dig.c <<EOM
16232 #$i_limits I_LIMITS
16233 #$i_float I_FLOAT
16234 #ifdef I_LIMITS
16235 #include <limits.h>
16236 #endif
16237 #ifdef I_FLOAT
16238 #include <float.h>
16239 #endif
16240 #ifdef LDBL_DIG
16241 printf("Contains LDBL_DIG");
16242 #endif
16243 EOM
16244 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
16245 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
16246         echo "LDBL_DIG found." >&4
16247         val="$define"
16248 else
16249         echo "LDBL_DIG NOT found." >&4
16250         val="$undef"
16251 fi
16252 $rm -f ldbl_dig.?
16253 set d_ldbl_dig
16254 eval $setvar
16255
16256 : see if lgamma exists
16257 set lgamma d_lgamma
16258 eval $inlibc
16259
16260 : see if lgamma_r exists
16261 set lgamma_r d_lgamma_r
16262 eval $inlibc
16263
16264 : check to see if math.h defines _LIB_VERSION
16265 d_libm_lib_version="$undef"
16266 case $i_math in
16267     $define)
16268         echo " "
16269         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
16270         $cat >try.c <<EOCP
16271 #include <unistd.h>
16272 #include <math.h>
16273 int main (int argc, char *argv[])
16274 {
16275     printf ("%d\n", _LIB_VERSION);
16276     return (0);
16277     } /* main */
16278 EOCP
16279         set try
16280         if eval $compile; then
16281             foo=`$run ./try`
16282             echo "Yes, it does ($foo)" >&4
16283             d_libm_lib_version="$define"
16284         else
16285             echo "No, it does not (probably harmless)" >&4
16286             fi
16287         $rm_try
16288         ;;
16289
16290     esac
16291
16292 : see if link exists
16293 set link d_link
16294 eval $inlibc
16295
16296 : see if llrint exists
16297 set llrint d_llrint
16298 eval $inlibc
16299
16300 : see if llrintl exists
16301 set llrintl d_llrintl
16302 eval $inlibc
16303
16304 : see if llround exists
16305 set llround d_llround
16306 eval $inlibc
16307
16308 : see if llroundl exists
16309 set llroundl d_llroundl
16310 eval $inlibc
16311
16312 : see if localtime_r exists
16313 set localtime_r d_localtime_r
16314 eval $inlibc
16315 case "$d_localtime_r" in
16316 "$define")
16317         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16318         case "$d_localtime_r_proto:$usethreads" in
16319         ":define")      d_localtime_r_proto=define
16320                 set d_localtime_r_proto localtime_r $hdrs
16321                 eval $hasproto ;;
16322         *)      ;;
16323         esac
16324         case "$d_localtime_r_proto" in
16325         define)
16326         case "$localtime_r_proto" in
16327         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16328         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16329         esac
16330         case "$localtime_r_proto" in
16331         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16332         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16333         esac
16334         case "$localtime_r_proto" in
16335         ''|0)   d_localtime_r=undef
16336                 localtime_r_proto=0
16337                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16338         * )     case "$localtime_r_proto" in
16339                 REENTRANT_PROTO*) ;;
16340                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16341                 esac
16342                 echo "Prototype: $try" ;;
16343         esac
16344         ;;
16345         *)      case "$usethreads" in
16346                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16347                 esac
16348                 d_localtime_r=undef
16349                 localtime_r_proto=0
16350                 ;;
16351         esac
16352         ;;
16353 *)      localtime_r_proto=0
16354         ;;
16355 esac
16356
16357 : see if localtime_r calls tzset
16358 case "$localtime_r_proto" in
16359 REENTRANT_PROTO*)
16360         $cat >try.c <<EOCP
16361 /*  Does our libc's localtime_r call tzset ?
16362  *  return 0 if so, 1 otherwise.
16363  */
16364 #$i_systypes    I_SYS_TYPES
16365 #$i_unistd      I_UNISTD
16366 #$i_time        I_TIME
16367 #$i_stdlib      I_STDLIB
16368 #$i_string      I_STRING
16369 #$i_malloc      I_MALLOC
16370 #ifdef I_SYS_TYPES
16371 #  include <sys/types.h>
16372 #endif
16373 #ifdef I_UNISTD
16374 #  include <unistd.h>
16375 #endif
16376 #ifdef I_TIME
16377 #  include <time.h>
16378 #endif
16379 #ifdef I_STDLIB
16380 #include <stdlib.h>
16381 #endif
16382 #ifdef I_STRING
16383 #  include <string.h>
16384 #else
16385 #  include <strings.h>
16386 #endif
16387 #ifdef I_MALLOC
16388 #  include <malloc.h>
16389 #endif
16390 int main()
16391 {
16392     time_t t = time(0L);
16393     char w_tz[]="TZ" "=GMT+5",
16394          e_tz[]="TZ" "=GMT-5",
16395         *tz_e = (char*)malloc(16),
16396         *tz_w = (char*)malloc(16);
16397     struct tm tm_e, tm_w;
16398     memset(&tm_e,'\0',sizeof(struct tm));
16399     memset(&tm_w,'\0',sizeof(struct tm));
16400     strcpy(tz_e,e_tz);
16401     strcpy(tz_w,w_tz);
16402
16403     putenv(tz_e);
16404     localtime_r(&t, &tm_e);
16405
16406     putenv(tz_w);
16407     localtime_r(&t, &tm_w);
16408
16409     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16410         return 1;
16411     return 0;
16412 }
16413 EOCP
16414         set try
16415         if eval $compile; then
16416             if $run ./try; then
16417                 d_localtime_r_needs_tzset=undef;
16418             else
16419                 d_localtime_r_needs_tzset=define;
16420             fi;
16421         else
16422             d_localtime_r_needs_tzset=undef;
16423         fi;
16424      ;;
16425   *)
16426      d_localtime_r_needs_tzset=undef;
16427      ;;
16428 esac
16429 $rm_try
16430
16431 : see if lockf exists
16432 set lockf d_lockf
16433 eval $inlibc
16434
16435 : see if log1p exists
16436 set log1p d_log1p
16437 eval $inlibc
16438
16439 : see if log2 exists
16440 set log2 d_log2
16441 eval $inlibc
16442
16443 : see if logb exists
16444 set logb d_logb
16445 eval $inlibc
16446
16447 : see if lrint exists
16448 set lrint d_lrint
16449 eval $inlibc
16450
16451 : see if lrintl exists
16452 set lrintl d_lrintl
16453 eval $inlibc
16454
16455 : see if lround exists
16456 set lround d_lround
16457 eval $inlibc
16458
16459 : see if lroundl exists
16460 set lroundl d_lroundl
16461 eval $inlibc
16462
16463 : see if prototype for lseek is available
16464 echo " "
16465 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16466 eval $hasproto
16467
16468 : see if lstat exists
16469 set lstat d_lstat
16470 eval $inlibc
16471
16472 : see if madvise exists
16473 set madvise d_madvise
16474 eval $inlibc
16475
16476 : see if malloc_size exists
16477 set malloc_size d_malloc_size
16478 eval $inlibc
16479
16480 : see if malloc_size_good exists
16481 set malloc_good_size d_malloc_good_size
16482 eval $inlibc
16483
16484 : see if mblen exists
16485 set mblen d_mblen
16486 eval $inlibc
16487
16488 : see if mbstowcs exists
16489 set mbstowcs d_mbstowcs
16490 eval $inlibc
16491
16492 : see if mbtowc exists
16493 set mbtowc d_mbtowc
16494 eval $inlibc
16495
16496 : see if memchr exists
16497 set memchr d_memchr
16498 eval $inlibc
16499
16500 : see if memcmp exists
16501 set memcmp d_memcmp
16502 eval $inlibc
16503
16504 : see if memcpy exists
16505 set memcpy d_memcpy
16506 eval $inlibc
16507
16508 : see if memmem exists
16509 set memmem d_memmem
16510 eval $inlibc
16511
16512 : see if memmove exists
16513 set memmove d_memmove
16514 eval $inlibc
16515
16516 : see if memrchr exists
16517 set memrchr d_memrchr
16518 eval $inlibc
16519
16520 : see if memset exists
16521 set memset d_memset
16522 eval $inlibc
16523
16524 : see if mkdir exists
16525 set mkdir d_mkdir
16526 eval $inlibc
16527
16528 : see if mkdtemp exists
16529 set mkdtemp d_mkdtemp
16530 eval $inlibc
16531
16532 : see if mkfifo exists
16533 set mkfifo d_mkfifo
16534 eval $inlibc
16535
16536 : see if mkstemp exists
16537 set mkstemp d_mkstemp
16538 eval $inlibc
16539
16540 : see if mkstemps exists
16541 set mkstemps d_mkstemps
16542 eval $inlibc
16543
16544 : see if mktime exists
16545 set mktime d_mktime
16546 eval $inlibc
16547
16548 : see if this is a sys/mman.h system
16549 set sys/mman.h i_sysmman
16550 eval $inhdr
16551
16552 : see if mmap exists
16553 set mmap d_mmap
16554 eval $inlibc
16555 : see what shmat returns
16556 : default to something harmless
16557 mmaptype='void *'
16558 case "$i_sysmman$d_mmap" in
16559 "$define$define")
16560         $cat >mmap.c <<'END'
16561 #include <sys/mman.h>
16562 void *mmap();
16563 END
16564         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16565                 mmaptype='void *'
16566         else
16567                 mmaptype='caddr_t'
16568         fi
16569         echo "and it returns ($mmaptype)." >&4
16570         ;;
16571 esac
16572
16573
16574
16575 : see if sqrtl exists
16576 set sqrtl d_sqrtl
16577 eval $inlibc
16578
16579 : see if scalbnl exists
16580 set scalbnl d_scalbnl
16581 eval $inlibc
16582
16583 : see if truncl exists
16584 set truncl d_truncl
16585 eval $inlibc
16586
16587 : see if modfl exists
16588 set modfl d_modfl
16589 eval $inlibc
16590
16591 : see if prototype for modfl is available
16592 echo " "
16593 set d_modflproto modfl $i_math math.h
16594 eval $hasproto
16595
16596 if $test "$uselongdouble" = "$define"; then
16597     message=""
16598     if $test "$d_sqrtl" != "$define"; then
16599         message="$message sqrtl"
16600     fi
16601     if $test "$d_modfl" != "$define"; then
16602         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16603             echo "You have both truncl and copysignl, so I can emulate modfl."
16604         else
16605             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16606                 echo "You have both aintl and copysignl, so I can emulate modfl."
16607             else
16608                 message="$message modfl"
16609             fi
16610         fi
16611     fi
16612     if $test "$d_frexpl" != "$define"; then
16613         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16614             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16615         else
16616             message="$message frexpl"
16617         fi
16618     fi
16619     if $test "$d_ldexpl" != "$define"; then
16620         message="$message ldexpl"
16621     fi
16622
16623     if $test "$message" != ""; then
16624         $cat <<EOM >&4
16625
16626 *** You requested the use of long doubles but you do not seem to have
16627 *** the following mathematical functions needed for long double support:
16628 ***    $message
16629 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16630 *** Cannot continue, aborting.
16631
16632 EOM
16633
16634         exit 1
16635     fi
16636 fi
16637
16638 : see if mprotect exists
16639 set mprotect d_mprotect
16640 eval $inlibc
16641
16642 : see if msgctl exists
16643 set msgctl d_msgctl
16644 eval $inlibc
16645
16646 : see if msgget exists
16647 set msgget d_msgget
16648 eval $inlibc
16649
16650 : see if msgsnd exists
16651 set msgsnd d_msgsnd
16652 eval $inlibc
16653
16654 : see if msgrcv exists
16655 set msgrcv d_msgrcv
16656 eval $inlibc
16657
16658 : see how much of the 'msg*(2)' library is present.
16659 h_msg=true
16660 echo " "
16661 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16662 *"$undef"*) h_msg=false;;
16663 esac
16664 case "$osname" in
16665 freebsd)
16666     case "`ipcs 2>&1`" in
16667     "SVID messages"*"not configured"*)
16668         echo "Your $osname does not have the msg*(2) configured." >&4
16669         h_msg=false
16670         val="$undef"
16671         set msgctl d_msgctl
16672         eval $setvar
16673         set msgget d_msgget
16674         eval $setvar
16675         set msgsnd d_msgsnd
16676         eval $setvar
16677         set msgrcv d_msgrcv
16678         eval $setvar
16679         ;;
16680     esac
16681     ;;
16682 esac
16683 : we could also check for sys/ipc.h ...
16684 if $h_msg && $test `./findhdr sys/msg.h`; then
16685         echo "You have the full msg*(2) library." >&4
16686         val="$define"
16687 else
16688         echo "You don't have the full msg*(2) library." >&4
16689         val="$undef"
16690 fi
16691 set d_msg
16692 eval $setvar
16693
16694 : Check for msghdr_s
16695 echo " "
16696 echo "Checking to see if your system supports struct msghdr..." >&4
16697 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16698 eval $hasstruct
16699 case "$d_msghdr_s" in
16700 "$define")      echo "Yes, it does."   ;;
16701 *)              echo "No, it doesn't." ;;
16702 esac
16703
16704
16705 : see if msync exists
16706 set msync d_msync
16707 eval $inlibc
16708
16709 : see if munmap exists
16710 set munmap d_munmap
16711 eval $inlibc
16712
16713 : see if nan exists
16714 set nan d_nan
16715 eval $inlibc
16716
16717 : see if nearbyint exists
16718 set nearbyint d_nearbyint
16719 eval $inlibc
16720
16721 : see if nextafter exists
16722 set nextafter d_nextafter
16723 eval $inlibc
16724
16725 : see if nexttoward exists
16726 set nexttoward d_nexttoward
16727 eval $inlibc
16728
16729 : see if nice exists
16730 set nice d_nice
16731 eval $inlibc
16732
16733 : see if this is a langinfo.h system
16734 set langinfo.h i_langinfo
16735 eval $inhdr
16736
16737 : see if nl_langinfo exists
16738 set nl_langinfo d_nl_langinfo
16739 eval $inlibc
16740
16741 : see if this is a quadmath.h system
16742 set quadmath.h i_quadmath
16743 eval $inhdr
16744
16745 : check for volatile keyword
16746 echo " "
16747 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
16748 $cat >try.c <<'EOCP'
16749 int main()
16750 {
16751         typedef struct _goo_struct goo_struct;
16752         goo_struct * volatile goo = ((goo_struct *)0);
16753         struct _goo_struct {
16754                 long long_int;
16755                 int reg_int;
16756                 char char_var;
16757         };
16758         typedef unsigned short foo_t;
16759         char *volatile foo;
16760         volatile int bar;
16761         volatile foo_t blech;
16762         foo = foo;
16763 }
16764 EOCP
16765 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
16766         val="$define"
16767         echo "Yup, it does."
16768 else
16769         val="$undef"
16770         echo "Nope, it doesn't."
16771 fi
16772 set d_volatile
16773 eval $setvar
16774 $rm_try
16775
16776 : Check basic sizes
16777 echo " "
16778 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16779
16780 case "$use64bitint:$d_quad:$quadtype" in
16781 define:define:?*)
16782         ivtype="$quadtype"
16783         uvtype="$uquadtype"
16784         ivsize=8
16785         uvsize=8
16786         ;;
16787 *)      ivtype="long"
16788         uvtype="unsigned long"
16789         ivsize=$longsize
16790         uvsize=$longsize
16791         ;;
16792 esac
16793
16794 case "$uselongdouble:$d_longdbl" in
16795 define:define)
16796         nvtype="long double"
16797         nvsize=$longdblsize
16798         ;;
16799 *)      nvtype=double
16800         nvsize=$doublesize
16801         ;;
16802 esac
16803
16804 case "$usequadmath:$i_quadmath" in
16805 define:define)
16806   nvtype="__float128"
16807   nvsize=16
16808   case "$libs" in
16809   *quadmath*) ;;
16810   *) $cat <<EOM >&4
16811
16812 *** You requested the use of the quadmath library, but you
16813 *** do not seem to have the quadmath library installed.
16814 *** Cannot continue, aborting.
16815 EOM
16816     exit 1
16817     ;;
16818   esac
16819   ;;
16820 define:*) $cat <<EOM >&4
16821
16822 *** You requested the use of the quadmath library, but you
16823 *** do not seem to have the required header, <quadmath.h>.
16824 EOM
16825   case "$gccversion" in
16826   [23].*|4.[0-5]*)
16827    $cat <<EOM >&4
16828 *** Your gcc looks a bit old:
16829 *** $gccversion
16830 EOM
16831     ;;
16832   '')
16833    $cat <<EOM >&4
16834 *** You are not running a gcc.
16835 EOM
16836     ;;
16837   esac
16838   $cat <<EOM >&4
16839 *** For the quadmath library you need at least gcc 4.6.
16840 *** Cannot continue, aborting.
16841 EOM
16842   exit 1
16843   ;;
16844 esac
16845
16846 $echo "(IV will be "$ivtype", $ivsize bytes)"
16847 $echo "(UV will be "$uvtype", $uvsize bytes)"
16848 $echo "(NV will be "$nvtype", $nvsize bytes)"
16849
16850 $cat >try.c <<EOCP
16851 #$i_inttypes I_INTTYPES
16852 #ifdef I_INTTYPES
16853 #include <inttypes.h>
16854 #endif
16855 #include <stdio.h>
16856 int main() {
16857 #ifdef INT8
16858    int8_t i =  INT8_MAX;
16859   uint8_t u = UINT8_MAX;
16860   printf("int8_t\n");
16861 #endif
16862 #ifdef INT16
16863    int16_t i =  INT16_MAX;
16864   uint16_t u = UINT16_MAX;
16865   printf("int16_t\n");
16866 #endif
16867 #ifdef INT32
16868    int32_t i =  INT32_MAX;
16869   uint32_t u = UINT32_MAX;
16870   printf("int32_t\n");
16871 #endif
16872 }
16873 EOCP
16874
16875 i8type="signed char"
16876 u8type="unsigned char"
16877 i8size=1
16878 u8size=1
16879
16880 case "$i16type" in
16881 '')     case "$shortsize" in
16882         2)      i16type=short
16883                 u16type="unsigned short"
16884                 i16size=$shortsize
16885                 u16size=$shortsize
16886                 ;;
16887         esac
16888         ;;
16889 esac
16890 case "$i16type" in
16891 '')     set try -DINT16
16892         if eval $compile; then
16893                 case "`$run ./try`" in
16894                 int16_t)
16895                         i16type=int16_t
16896                         u16type=uint16_t
16897                         i16size=2
16898                         u16size=2
16899                         ;;
16900                 esac
16901         fi
16902         ;;
16903 esac
16904 case "$i16type" in
16905 '')     if $test $shortsize -ge 2; then
16906                 i16type=short
16907                 u16type="unsigned short"
16908                 i16size=$shortsize
16909                 u16size=$shortsize
16910         fi
16911         ;;
16912 esac
16913
16914 case "$i32type" in
16915 '')     case "$longsize" in
16916         4)      i32type=long
16917                 u32type="unsigned long"
16918                 i32size=$longsize
16919                 u32size=$longsize
16920                 ;;
16921         *)      case "$intsize" in
16922                 4)      i32type=int
16923                         u32type="unsigned int"
16924                         i32size=$intsize
16925                         u32size=$intsize
16926                         ;;
16927                 esac
16928                 ;;
16929         esac
16930         ;;
16931 esac
16932 case "$i32type" in
16933 '')     set try -DINT32
16934         if eval $compile; then
16935                 case "`$run ./try`" in
16936                 int32_t)
16937                         i32type=int32_t
16938                         u32type=uint32_t
16939                         i32size=4
16940                         u32size=4
16941                         ;;
16942                 esac
16943         fi
16944         ;;
16945 esac
16946 case "$i32type" in
16947 '')     if $test $intsize -ge 4; then
16948                 i32type=int
16949                 u32type="unsigned int"
16950                 i32size=$intsize
16951                 u32size=$intsize
16952         fi
16953         ;;
16954 esac
16955
16956 case "$i64type" in
16957 '')     case "$d_quad:$quadtype" in
16958         define:?*)
16959                 i64type="$quadtype"
16960                 u64type="$uquadtype"
16961                 i64size=8
16962                 u64size=8
16963                 ;;
16964         esac
16965         ;;
16966 esac
16967
16968 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16969 : volatile so that the compiler has to store it out to memory.
16970 if test X"$d_volatile" = X"$define"; then
16971         volatile=volatile
16972 fi
16973 $cat <<EOP >try.c
16974 #include <stdio.h>
16975 #$i_stdlib I_STDLIB
16976 #ifdef I_STDLIB
16977 #include <stdlib.h>
16978 #endif
16979 #include <sys/types.h>
16980 #include <signal.h>
16981 #ifdef SIGFPE
16982 $volatile int bletched = 0;
16983 $signal_t blech(int s) { bletched = 1; }
16984 #endif
16985 int main() {
16986     $uvtype u = 0;
16987     $nvtype d;
16988     int     n = 8 * $uvsize;
16989     int     i;
16990 #ifdef SIGFPE
16991     signal(SIGFPE, blech);
16992 #endif
16993
16994     for (i = 0; i < n; i++) {
16995       u = u << 1 | ($uvtype)1;
16996       d = ($nvtype)u;
16997       if (($uvtype)d != u)
16998         break;
16999       if (d <= 0)
17000         break;
17001       d = ($nvtype)(u - 1);
17002       if (($uvtype)d != (u - 1))
17003         break;
17004 #ifdef SIGFPE
17005       if (bletched)
17006         break;
17007 #endif
17008     }
17009     printf("%d\n", ((i == n) ? -n : i));
17010     exit(0);
17011 }
17012 EOP
17013 set try
17014
17015 d_nv_preserves_uv="$undef"
17016 if eval $compile; then
17017         nv_preserves_uv_bits="`$run ./try`"
17018 fi
17019 case "$nv_preserves_uv_bits" in
17020 \-[1-9]*)
17021         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
17022         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
17023         d_nv_preserves_uv="$define"
17024         ;;
17025 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
17026         d_nv_preserves_uv="$undef" ;;
17027 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
17028         nv_preserves_uv_bits="0" ;;
17029 esac
17030 $rm_try
17031
17032 $echo "Checking to find the largest integer value your NVs can hold..." >&4
17033 : volatile so that the compiler has to store it out to memory.
17034 if test X"$d_volatile" = X"$define"; then
17035         volatile=volatile
17036 fi
17037 $cat <<EOP >try.c
17038 #include <stdio.h>
17039
17040 typedef $nvtype NV;
17041
17042 int
17043 main() {
17044   NV value = 2;
17045   int count = 1;
17046
17047   while(count < 256) {
17048     $volatile NV up = value + 1.0;
17049     $volatile NV negated = -value;
17050     $volatile NV down = negated - 1.0;
17051     $volatile NV got_up = up - value;
17052     int up_good = got_up == 1.0;
17053     int got_down = down - negated;
17054     int down_good = got_down == -1.0;
17055
17056     if (down_good != up_good) {
17057       fprintf(stderr,
17058               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
17059               up_good, (double) got_up, down_good, (double) got_down,
17060               count, (double) value);
17061       return 1;
17062     }
17063     if (!up_good) {
17064       while (1) {
17065         if (count > 8) {
17066           count -= 8;
17067           fputs("256.0", stdout);
17068         } else {
17069           count--;
17070           fputs("2.0", stdout);
17071         }
17072         if (!count) {
17073           puts("");
17074           return 0;
17075         }
17076         fputs("*", stdout);
17077       }
17078     }
17079     value *= 2;
17080     ++count;
17081   }
17082   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
17083           count, (double) value);
17084   return 1;
17085 }
17086 EOP
17087 set try
17088
17089 nv_overflows_integers_at='0'
17090 if eval $compile; then
17091     xxx="`$run ./try`"
17092     case "$?" in
17093         0)
17094             case "$xxx" in
17095                 2*)  cat >&4 <<EOM
17096 The largest integer your NVs can preserve is equal to $xxx
17097 EOM
17098                     nv_overflows_integers_at="$xxx"
17099                     ;;
17100                 *)  cat >&4 <<EOM
17101 Cannot determine the largest integer value your NVs can hold, unexpected output
17102 '$xxx'
17103 EOM
17104                     ;;
17105             esac
17106             ;;
17107         *)  cat >&4 <<EOM
17108 Cannot determine the largest integer value your NVs can hold
17109 EOM
17110             ;;
17111     esac
17112 fi
17113 $rm_try
17114
17115 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
17116 : volatile so that the compiler has to store it out to memory.
17117 if test X"$d_volatile" = X"$define"; then
17118         volatile=volatile
17119 fi
17120 $cat <<EOP >try.c
17121 #include <stdio.h>
17122 #$i_stdlib I_STDLIB
17123 #ifdef I_STDLIB
17124 #include <stdlib.h>
17125 #endif
17126 #$i_string I_STRING
17127 #ifdef I_STRING
17128 #  include <string.h>
17129 #else
17130 #  include <strings.h>
17131 #endif
17132 #include <sys/types.h>
17133 #include <signal.h>
17134 #ifdef SIGFPE
17135 $volatile int bletched = 0;
17136 $signal_t blech(int s) { bletched = 1; }
17137 #endif
17138
17139 int checkit($nvtype d, const char *where) {
17140     void *v = &d;
17141     unsigned char *p = (unsigned char *)v;
17142     unsigned char *end = p + sizeof(d);
17143     int fail = 0;
17144
17145     while (p < end)
17146         fail += *p++;
17147
17148     if (!fail)
17149         return 0;
17150
17151     p = (unsigned char *)v;
17152     printf("No - %s: 0x", where);
17153     while (p < end)
17154         printf ("%02X", *p++);
17155     printf("\n");
17156     return 1;
17157 }
17158
17159 int main(int argc, char **argv) {
17160     $nvtype d = 0.0;
17161     int fail = 0;
17162     fail += checkit(d, "0.0");
17163
17164     /* The compiler shouldn't be assuming that bletched is 0  */
17165     d = bletched;
17166
17167     fail += checkit(d, "bleched");
17168
17169 #ifdef SIGFPE
17170     signal(SIGFPE, blech);
17171 #endif
17172
17173     /* Paranoia - the compiler should have no way of knowing that ANSI says
17174        that argv[argc] will always be NULL.  Actually, if it did assume this it
17175        would be buggy, as this is C and main() can be called from elsewhere in
17176        the program.  */
17177     d = argv[argc] ? 1 : 0;
17178
17179     if (d) {
17180         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
17181     }
17182
17183     fail += checkit(d, "ternary");
17184
17185     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
17186
17187     if (d != 0.0) {
17188         printf("No - memset doesn't give 0.0\n");
17189         /* This might just blow up:  */
17190         printf("(gives %g)\n", d);
17191         return 1;
17192     }
17193
17194 #ifdef SIGFPE
17195     if (bletched) {
17196         printf("No - something bleched\n");
17197         return 1;
17198     }
17199 #endif
17200     if (fail) {
17201       printf("No - %d fail(s)\n", fail);
17202       return 1;
17203     }
17204     printf("Yes\n");
17205     return 0;
17206 }
17207 EOP
17208 set try
17209
17210 d_nv_zero_is_allbits_zero="$undef"
17211 if eval $compile; then
17212     xxx="`$run ./try`"
17213     case "$?" in
17214         0)
17215             case "$xxx" in
17216                 Yes)  cat >&4 <<EOM
17217 0.0 is represented as all bits zero in memory
17218 EOM
17219                     d_nv_zero_is_allbits_zero="$define"
17220                     ;;
17221                 *)  cat >&4 <<EOM
17222 0.0 is not represented as all bits zero in memory
17223 EOM
17224                     d_nv_zero_is_allbits_zero="$undef"
17225                     ;;
17226             esac
17227             ;;
17228         *)  cat >&4 <<EOM
17229 0.0 is not represented as all bits zero in memory
17230 EOM
17231             d_nv_zero_is_allbits_zero="$undef"
17232             ;;
17233     esac
17234 fi
17235 $rm_try
17236
17237 : check for off64_t
17238 echo " "
17239 echo "Checking to see if you have off64_t..." >&4
17240 $cat >try.c <<EOCP
17241 #include <sys/types.h>
17242 #include <unistd.h>
17243 int main() { off64_t x = 7; }
17244 EOCP
17245 set try
17246 if eval $compile; then
17247         val="$define"
17248         echo "You have off64_t."
17249 else
17250         val="$undef"
17251         echo "You do not have off64_t."
17252         case "$lseeksize" in
17253         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
17254         esac
17255 fi
17256 $rm_try
17257 set d_off64_t
17258 eval $setvar
17259
17260 : how to create joinable pthreads
17261 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
17262         echo " "
17263         echo "Checking what constant to use for creating joinable pthreads..." >&4
17264         $cat >try.c <<'EOCP'
17265 #include <pthread.h>
17266 int main() {
17267     int detachstate = JOINABLE;
17268 }
17269 EOCP
17270         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
17271         if eval $compile; then
17272                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
17273                 val="$undef" # Yes, undef.
17274                 set d_old_pthread_create_joinable
17275                 eval $setvar
17276                 val=""
17277                 set old_pthread_create_joinable
17278                 eval $setvar
17279         else
17280                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
17281                 if eval $compile; then
17282                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
17283                         val="$define"
17284                         set d_old_pthread_create_joinable
17285                         eval $setvar
17286                         val=PTHREAD_CREATE_UNDETACHED
17287                         set old_pthread_create_joinable
17288                         eval $setvar
17289                 else
17290                         set try -DJOINABLE=__UNDETACHED
17291                         if eval $compile; then
17292                                 echo "You seem to use __UNDETACHED." >&4
17293                                 val="$define"
17294                                 set d_old_pthread_create_joinable
17295                                 eval $setvar
17296                                 val=__UNDETACHED
17297                                 set old_pthread_create_joinable
17298                                 eval $setvar
17299                         else
17300                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
17301                                 val="$define"
17302                                 set d_old_pthread_create_joinable
17303                                 eval $setvar
17304                                 val=0
17305                                 set old_pthread_create_joinable
17306                                 eval $setvar
17307                         fi
17308                 fi
17309         fi
17310         $rm_try
17311 else
17312     d_old_pthread_create_joinable="$undef"
17313     old_pthread_create_joinable=""
17314 fi
17315
17316 : see if pause exists
17317 set pause d_pause
17318 eval $inlibc
17319
17320 : see if poll exists
17321 set poll d_poll
17322 eval $inlibc
17323
17324 : see if prctl exists
17325 set prctl d_prctl
17326 eval $inlibc
17327
17328 : see if prctl supports PR_SET_NAME
17329 d_prctl_set_name=$undef
17330 case $d_prctl in
17331     $define)
17332         $cat >try.c <<EOM
17333 #ifdef __ANDROID__
17334 #include <unistd.h>
17335 #endif
17336 #include <sys/prctl.h>
17337
17338 int main (int argc, char *argv[])
17339 {
17340     return (prctl (PR_SET_NAME, "Test"));
17341     } /* main */
17342 EOM
17343         set try
17344         if eval $compile_ok && $run ./try; then
17345             echo "Your prctl (PR_SET_NAME, ...) works"
17346             d_prctl_set_name=$define
17347             fi
17348         $rm_try
17349         ;;
17350     esac
17351
17352 : see if readlink exists
17353 set readlink d_readlink
17354 eval $inlibc
17355
17356 : Check if there is a /proc symlink to the abs path of
17357 : the executing program.  We will honor hints of d_procselfexe=$undef
17358 : or procselfexe being non-empty, otherwise will try to determine both
17359 : if we have readlink.
17360 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
17361 : referenced, and AmigaOS does not have a proc filesystem anyway.
17362 echo " "
17363 val="$undef"
17364 if $test "X$d_procselfexe" = Xundef; then
17365         procselfexe=''
17366 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
17367         val="$define"
17368 elif $test "X$d_readlink" = Xdefine; then
17369         : NetBSD first as /proc/self is a symlink to /proc/curproc,
17370         : and it feels more tidy to avoid an extra level of symlink
17371         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17372         while test $# -gt 0; do
17373             type=$1; try=$2
17374             shift; shift
17375             if $issymlink $try; then
17376                 $ls -l $try > reflect
17377                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17378                     echo "You have $type-like $try."
17379                     procselfexe='"'$try'"'
17380                     val="$define"
17381                     : This will break out of the loop
17382                     set X; shift
17383                 fi
17384             fi
17385         done
17386 fi
17387 $rm -f reflect
17388 set d_procselfexe
17389 eval $setvar
17390
17391 : backward compatibility for d_hvfork
17392 if test X$d_hvfork != X; then
17393         d_vfork="$d_hvfork"
17394         d_hvfork=''
17395 fi
17396 : see if there is a vfork
17397 val=''
17398 set vfork val
17399 eval $inlibc
17400
17401 d_pseudofork=$undef
17402
17403 : Ok, but do we want to use it. vfork is reportedly unreliable in
17404 : perl on Solaris 2.x, and probably elsewhere.
17405 case "$val" in
17406 $define)
17407         echo " "
17408         case "$usevfork" in
17409         false) dflt='n';;
17410         *) dflt='y';;
17411         esac
17412         cat <<'EOM'
17413
17414 Perl can only use a vfork() that doesn't suffer from strict
17415 restrictions on calling functions or modifying global data in
17416 the child.  For example, glibc-2.1 contains such a vfork()
17417 that is unsuitable.  If your system provides a proper fork()
17418 call, chances are that you do NOT want perl to use vfork().
17419
17420 EOM
17421         rp="Do you still want to use vfork()?"
17422         . ./myread
17423         case "$ans" in
17424         y|Y) ;;
17425         *)
17426                 echo "Ok, we won't use vfork()."
17427                 val="$undef"
17428                 ;;
17429         esac
17430         ;;
17431 esac
17432 set d_vfork
17433 eval $setvar
17434 case "$d_vfork" in
17435 $define) usevfork='true';;
17436 *) usevfork='false';;
17437 esac
17438
17439 : see whether the pthread_atfork exists
17440 $cat >try.c <<EOP
17441 #include <pthread.h>
17442 #include <stdio.h>
17443 int main() {
17444 #ifdef  PTHREAD_ATFORK
17445         pthread_atfork(NULL,NULL,NULL);
17446 #endif
17447 }
17448 EOP
17449
17450 : see if pthread_atfork exists
17451 set try -DPTHREAD_ATFORK
17452 if eval $compile; then
17453     val="$define"
17454 else
17455     val="$undef"
17456 fi
17457 case "$usethreads" in
17458 $define)
17459         case "$val" in
17460         $define) echo 'pthread_atfork found.' >&4        ;;
17461         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17462         esac
17463 esac
17464 set d_pthread_atfork
17465 eval $setvar
17466
17467 : see if pthread_attr_setscope exists
17468 set pthread_attr_setscope d_pthread_attr_setscope
17469 eval $inlibc
17470
17471 : see whether the various POSIXish _yields exist
17472 $cat >try.c <<EOP
17473 #include <pthread.h>
17474 #include <stdio.h>
17475 int main() {
17476 #ifdef SCHED_YIELD
17477         sched_yield();
17478 #else
17479 #ifdef PTHREAD_YIELD
17480         pthread_yield();
17481 #else
17482 #ifdef PTHREAD_YIELD_NULL
17483         pthread_yield(NULL);
17484 #endif
17485 #endif
17486 #endif
17487 }
17488 EOP
17489 : see if sched_yield exists
17490 set try -DSCHED_YIELD
17491 if eval $compile; then
17492     val="$define"
17493     sched_yield='sched_yield()'
17494 else
17495     val="$undef"
17496 fi
17497 case "$usethreads" in
17498 $define)
17499         case "$val" in
17500         $define) echo 'sched_yield() found.' >&4        ;;
17501         *)       echo 'sched_yield() NOT found.' >&4    ;;
17502         esac
17503 esac
17504 set d_sched_yield
17505 eval $setvar
17506
17507 : see if pthread_yield exists
17508 set try -DPTHREAD_YIELD
17509 if eval $compile; then
17510     val="$define"
17511     case "$sched_yield" in
17512     '') sched_yield='pthread_yield()' ;;
17513     esac
17514 else
17515     set try -DPTHREAD_YIELD_NULL
17516     if eval $compile; then
17517         val="$define"
17518         case "$sched_yield" in
17519         '') sched_yield='pthread_yield(NULL)' ;;
17520         esac
17521     else
17522         val="$undef"
17523     fi
17524 fi
17525 case "$usethreads" in
17526 $define)
17527         case "$val" in
17528         $define) echo 'pthread_yield() found.' >&4      ;;
17529         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17530         esac
17531         ;;
17532 esac
17533 set d_pthread_yield
17534 eval $setvar
17535 case "$sched_yield" in
17536 '') sched_yield=undef ;;
17537 esac
17538 $rm_try
17539
17540 : check for ptrdiff_t
17541 echo " "
17542 echo "Checking to see if you have ptrdiff_t..." >&4
17543 $cat >try.c <<EOCP
17544 #include <stddef.h>
17545 int main() { ptrdiff_t x = 7; }
17546 EOCP
17547 set try
17548 if eval $compile; then
17549         val="$define"
17550         echo "You have ptrdiff_t."
17551 else
17552         val="$undef"
17553         echo "You do not have ptrdiff_t."
17554 fi
17555 $rm_try
17556 set d_ptrdiff_t
17557 eval $setvar
17558
17559 : see if random_r exists
17560 set random_r d_random_r
17561 eval $inlibc
17562 case "$d_random_r" in
17563 "$define")
17564         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17565         case "$d_random_r_proto:$usethreads" in
17566         ":define")      d_random_r_proto=define
17567                 set d_random_r_proto random_r $hdrs
17568                 eval $hasproto ;;
17569         *)      ;;
17570         esac
17571         case "$d_random_r_proto" in
17572         define)
17573         case "$random_r_proto" in
17574         ''|0) try='int random_r(int*, struct random_data*);'
17575         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17576         esac
17577         case "$random_r_proto" in
17578         ''|0) try='int random_r(long*, struct random_data*);'
17579         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17580         esac
17581         case "$random_r_proto" in
17582         ''|0) try='int random_r(struct random_data*, int32_t*);'
17583         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17584         esac
17585         case "$random_r_proto" in
17586         ''|0)   d_random_r=undef
17587                 random_r_proto=0
17588                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17589         * )     case "$random_r_proto" in
17590                 REENTRANT_PROTO*) ;;
17591                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17592                 esac
17593                 echo "Prototype: $try" ;;
17594         esac
17595         ;;
17596         *)      case "$usethreads" in
17597                 define) echo "random_r has no prototype, not using it." >&4 ;;
17598                 esac
17599                 d_random_r=undef
17600                 random_r_proto=0
17601                 ;;
17602         esac
17603         ;;
17604 *)      random_r_proto=0
17605         ;;
17606 esac
17607
17608 : see if readdir and friends exist
17609 set readdir d_readdir
17610 eval $inlibc
17611 set seekdir d_seekdir
17612 eval $inlibc
17613 set telldir d_telldir
17614 eval $inlibc
17615 set rewinddir d_rewinddir
17616 eval $inlibc
17617
17618 : see if readdir64_r exists
17619 set readdir64_r d_readdir64_r
17620 eval $inlibc
17621 case "$d_readdir64_r" in
17622 "$define")
17623         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17624         case "$d_readdir64_r_proto:$usethreads" in
17625         ":define")      d_readdir64_r_proto=define
17626                 set d_readdir64_r_proto readdir64_r $hdrs
17627                 eval $hasproto ;;
17628         *)      ;;
17629         esac
17630         case "$d_readdir64_r_proto" in
17631         define)
17632         case "$readdir64_r_proto" in
17633         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17634         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17635         esac
17636         case "$readdir64_r_proto" in
17637         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17638         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17639         esac
17640         case "$readdir64_r_proto" in
17641         ''|0)   d_readdir64_r=undef
17642                 readdir64_r_proto=0
17643                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17644         * )     case "$readdir64_r_proto" in
17645                 REENTRANT_PROTO*) ;;
17646                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17647                 esac
17648                 echo "Prototype: $try" ;;
17649         esac
17650         ;;
17651         *)      case "$usethreads" in
17652                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17653                 esac
17654                 d_readdir64_r=undef
17655                 readdir64_r_proto=0
17656                 ;;
17657         esac
17658         ;;
17659 *)      readdir64_r_proto=0
17660         ;;
17661 esac
17662
17663 : see if readdir_r exists
17664 set readdir_r d_readdir_r
17665 eval $inlibc
17666 case "$d_readdir_r" in
17667 "$define")
17668         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17669         case "$d_readdir_r_proto:$usethreads" in
17670         ":define")      d_readdir_r_proto=define
17671                 set d_readdir_r_proto readdir_r $hdrs
17672                 eval $hasproto ;;
17673         *)      ;;
17674         esac
17675         case "$d_readdir_r_proto" in
17676         define)
17677         case "$readdir_r_proto" in
17678         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17679         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17680         esac
17681         case "$readdir_r_proto" in
17682         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17683         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17684         esac
17685         case "$readdir_r_proto" in
17686         ''|0)   d_readdir_r=undef
17687                 readdir_r_proto=0
17688                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17689         * )     case "$readdir_r_proto" in
17690                 REENTRANT_PROTO*) ;;
17691                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17692                 esac
17693                 echo "Prototype: $try" ;;
17694         esac
17695         ;;
17696         *)      case "$usethreads" in
17697                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17698                 esac
17699                 d_readdir_r=undef
17700                 readdir_r_proto=0
17701                 ;;
17702         esac
17703         ;;
17704 *)      readdir_r_proto=0
17705         ;;
17706 esac
17707
17708 : see if readv exists
17709 set readv d_readv
17710 eval $inlibc
17711
17712 : see if recvmsg exists
17713 set recvmsg d_recvmsg
17714 eval $inlibc
17715
17716 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17717 echo " "
17718 if set regcomp val -f d_regcomp; eval $csym; $val; then
17719         echo 'regcomp() found.' >&4
17720         d_regcomp="$define"
17721         d_regcmp="$undef"
17722         d_re_comp="$undef"
17723 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17724         echo 'regcmp() found.' >&4
17725         d_regcmp="$define"
17726         d_regcomp="$undef"
17727         d_re_comp="$undef"
17728 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17729         echo 're_comp() found, assuming re_exec() also exists.' >&4
17730         d_re_comp="$define"
17731         d_regcomp="$undef"
17732         d_regcmp="$undef"
17733 else
17734         $cat >&4 <<EOM
17735 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17736 EOM
17737         d_regcmp="$undef"
17738         d_re_comp="$undef"
17739         d_regcomp="$undef"
17740 fi
17741
17742 : see if remainder exists
17743 set remainder d_remainder
17744 eval $inlibc
17745
17746 : see if remquo exists
17747 set remquo d_remquo
17748 eval $inlibc
17749
17750 : see if rename exists
17751 set rename d_rename
17752 eval $inlibc
17753
17754 : see if rint exists
17755 set rint d_rint
17756 eval $inlibc
17757
17758 : see if rmdir exists
17759 set rmdir d_rmdir
17760 eval $inlibc
17761
17762 : see if round exists
17763 set round d_round
17764 eval $inlibc
17765
17766 : see if memory.h is available.
17767 val=''
17768 set memory.h val
17769 eval $inhdr
17770
17771 : See if it conflicts with string.h
17772 case "$val" in
17773 $define)
17774         case "$strings" in
17775         '') ;;
17776         *)
17777                 $cppstdin $cppflags $cppminus < $strings > mem.h
17778                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
17779                         echo " "
17780                         echo "We won't be including <memory.h>."
17781                         val="$undef"
17782                 fi
17783                 $rm -f mem.h
17784                 ;;
17785         esac
17786 esac
17787 set i_memory
17788 eval $setvar
17789
17790 : can bcopy handle overlapping blocks?
17791 echo " "
17792 val="$undef"
17793 case "$d_memmove" in
17794 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
17795 *)      case "$d_bcopy" in
17796         "$define")
17797                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
17798                 $cat >try.c <<EOCP
17799 #$i_memory I_MEMORY
17800 #$i_stdlib I_STDLIB
17801 #$i_string I_STRING
17802 #$i_unistd I_UNISTD
17803 EOCP
17804         $cat >>try.c <<'EOCP'
17805 #include <stdio.h>
17806 #ifdef I_MEMORY
17807 #  include <memory.h>
17808 #endif
17809 #ifdef I_STDLIB
17810 #  include <stdlib.h>
17811 #endif
17812 #ifdef I_STRING
17813 #  include <string.h>
17814 #else
17815 #  include <strings.h>
17816 #endif
17817 #ifdef I_UNISTD
17818 #  include <unistd.h>  /* Needed for NetBSD */
17819 #endif
17820 int main()
17821 {
17822 char buf[128], abc[128];
17823 char *b;
17824 int len;
17825 int off;
17826 int align;
17827
17828 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17829    try to store the string in read-only memory. */
17830 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
17831
17832 for (align = 7; align >= 0; align--) {
17833         for (len = 36; len; len--) {
17834                 b = buf+align;
17835                 bcopy(abc, b, len);
17836                 for (off = 1; off <= len; off++) {
17837                         bcopy(b, b+off, len);
17838                         bcopy(b+off, b, len);
17839                         if (bcmp(b, abc, len))
17840                                 exit(1);
17841                 }
17842         }
17843 }
17844 exit(0);
17845 }
17846 EOCP
17847                 set try
17848                 if eval $compile_ok; then
17849                         if $run ./try 2>/dev/null; then
17850                                 echo "Yes, it can."
17851                                 val="$define"
17852                         else
17853                                 echo "It can't, sorry."
17854                         fi
17855                 else
17856                         echo "(I can't compile the test program, so we'll assume not...)"
17857                 fi
17858                 ;;
17859         esac
17860         $rm_try
17861         ;;
17862 esac
17863 set d_safebcpy
17864 eval $setvar
17865
17866 : can memcpy handle overlapping blocks?
17867 echo " "
17868 val="$undef"
17869 case "$d_memmove" in
17870 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
17871 *)      case "$d_memcpy" in
17872         "$define")
17873                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
17874                 $cat >try.c <<EOCP
17875 #$i_memory I_MEMORY
17876 #$i_stdlib I_STDLIB
17877 #$i_string I_STRING
17878 #$i_unistd I_UNISTD
17879 EOCP
17880         $cat >>try.c <<'EOCP'
17881 #include <stdio.h>
17882 #ifdef I_MEMORY
17883 #  include <memory.h>
17884 #endif
17885 #ifdef I_STDLIB
17886 #  include <stdlib.h>
17887 #endif
17888 #ifdef I_STRING
17889 #  include <string.h>
17890 #else
17891 #  include <strings.h>
17892 #endif
17893 #ifdef I_UNISTD
17894 #  include <unistd.h>  /* Needed for NetBSD */
17895 #endif
17896 int main()
17897 {
17898 char buf[128], abc[128];
17899 char *b;
17900 int len;
17901 int off;
17902 int align;
17903
17904 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17905    try to store the string in read-only memory. */
17906 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
17907
17908 for (align = 7; align >= 0; align--) {
17909         for (len = 36; len; len--) {
17910                 b = buf+align;
17911                 memcpy(b, abc, len);
17912                 for (off = 1; off <= len; off++) {
17913                         memcpy(b+off, b, len);
17914                         memcpy(b, b+off, len);
17915                         if (memcmp(b, abc, len))
17916                                 exit(1);
17917                 }
17918         }
17919 }
17920 exit(0);
17921 }
17922 EOCP
17923                 set try
17924                 if eval $compile_ok; then
17925                         if $run ./try 2>/dev/null; then
17926                                 echo "Yes, it can."
17927                                 val="$define"
17928                         else
17929                                 echo "It can't, sorry."
17930                         fi
17931                 else
17932                         echo "(I can't compile the test program, so we'll assume not...)"
17933                 fi
17934                 ;;
17935         esac
17936         $rm_try
17937         ;;
17938 esac
17939 set d_safemcpy
17940 eval $setvar
17941
17942 : can memcmp be trusted to compare relative magnitude?
17943 val="$undef"
17944 case "$d_memcmp" in
17945 "$define")
17946         echo " "
17947         echo "Checking if your memcmp() can compare relative magnitude..." >&4
17948         $cat >try.c <<EOCP
17949 #$i_memory I_MEMORY
17950 #$i_stdlib I_STDLIB
17951 #$i_string I_STRING
17952 #$i_unistd I_UNISTD
17953 EOCP
17954         $cat >>try.c <<'EOCP'
17955 #include <stdio.h>
17956 #ifdef I_MEMORY
17957 #  include <memory.h>
17958 #endif
17959 #ifdef I_STDLIB
17960 #  include <stdlib.h>
17961 #endif
17962 #ifdef I_STRING
17963 #  include <string.h>
17964 #else
17965 #  include <strings.h>
17966 #endif
17967 #ifdef I_UNISTD
17968 #  include <unistd.h>  /* Needed for NetBSD */
17969 #endif
17970 int main()
17971 {
17972 char a = -1;
17973 char b = 0;
17974 if ((a < b) && memcmp(&a, &b, 1) < 0)
17975         exit(1);
17976 exit(0);
17977 }
17978 EOCP
17979         set try
17980         if eval $compile_ok; then
17981                 if $run ./try 2>/dev/null; then
17982                         echo "Yes, it can."
17983                         val="$define"
17984                 else
17985                         echo "No, it can't (it uses signed chars)."
17986                 fi
17987         else
17988                 echo "(I can't compile the test program, so we'll assume not...)"
17989         fi
17990         ;;
17991 esac
17992 $rm_try
17993 set d_sanemcmp
17994 eval $setvar
17995
17996 : see if prototype for sbrk is available
17997 echo " "
17998 set d_sbrkproto sbrk $i_unistd unistd.h
17999 eval $hasproto
18000
18001 : see if scalbn exists
18002 set scalbn d_scalbn
18003 eval $inlibc
18004
18005 : see if select exists
18006 set select d_select
18007 eval $inlibc
18008
18009 : see if semctl exists
18010 set semctl d_semctl
18011 eval $inlibc
18012
18013 : see if semget exists
18014 set semget d_semget
18015 eval $inlibc
18016
18017 : see if semop exists
18018 set semop d_semop
18019 eval $inlibc
18020
18021 : see how much of the 'sem*(2)' library is present.
18022 h_sem=true
18023 echo " "
18024 case "$d_semctl$d_semget$d_semop" in
18025 *"$undef"*) h_sem=false;;
18026 esac
18027 case "$osname" in
18028 freebsd)
18029     case "`ipcs 2>&1`" in
18030     "SVID messages"*"not configured"*)
18031         echo "Your $osname does not have the sem*(2) configured." >&4
18032         h_sem=false
18033         val="$undef"
18034         set semctl d_semctl
18035         eval $setvar
18036         set semget d_semget
18037         eval $setvar
18038         set semop d_semop
18039         eval $setvar
18040         ;;
18041     esac
18042     ;;
18043 esac
18044 : we could also check for sys/ipc.h ...
18045 if $h_sem && $test `./findhdr sys/sem.h`; then
18046         echo "You have the full sem*(2) library." >&4
18047         val="$define"
18048 else
18049         echo "You don't have the full sem*(2) library." >&4
18050         val="$undef"
18051 fi
18052 set d_sem
18053 eval $setvar
18054
18055 : see whether sys/sem.h defines union semun
18056 echo " "
18057 $cat > try.c <<'END'
18058 #include <sys/types.h>
18059 #include <sys/ipc.h>
18060 #include <sys/sem.h>
18061 int main () { union semun semun; semun.buf = 0; }
18062 END
18063 set try
18064 if eval $compile; then
18065     echo "You have union semun in <sys/sem.h>." >&4
18066     val="$define"
18067 else
18068     echo "You do not have union semun in <sys/sem.h>." >&4
18069     val="$undef"
18070 fi
18071 $rm_try
18072 set d_union_semun
18073 eval $setvar
18074
18075 : see how to do semctl IPC_STAT
18076 case "$d_sem" in
18077 $define)
18078     echo " "
18079     $cat > tryh.h <<END
18080 #ifndef S_IRUSR
18081 #   ifdef S_IREAD
18082 #       define S_IRUSR S_IREAD
18083 #       define S_IWUSR S_IWRITE
18084 #       define S_IXUSR S_IEXEC
18085 #   else
18086 #       define S_IRUSR 0400
18087 #       define S_IWUSR 0200
18088 #       define S_IXUSR 0100
18089 #   endif
18090 #   define S_IRGRP (S_IRUSR>>3)
18091 #   define S_IWGRP (S_IWUSR>>3)
18092 #   define S_IXGRP (S_IXUSR>>3)
18093 #   define S_IROTH (S_IRUSR>>6)
18094 #   define S_IWOTH (S_IWUSR>>6)
18095 #   define S_IXOTH (S_IXUSR>>6)
18096 #endif
18097 #ifndef S_IRWXU
18098 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
18099 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
18100 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
18101 #endif
18102 END
18103     : see whether semctl IPC_STAT can use union semun
18104     case "$d_semctl_semun" in
18105     '')
18106       val="$undef"
18107       $cat > try.c <<END
18108 #include <sys/types.h>
18109 #include <sys/ipc.h>
18110 #include <sys/sem.h>
18111 #include <sys/stat.h>
18112 #include <stdio.h>
18113 #include <errno.h>
18114 #include "tryh.h"
18115 #ifndef errno
18116 extern int errno;
18117 #endif
18118 #$d_union_semun HAS_UNION_SEMUN
18119 int main() {
18120     union semun
18121 #ifndef HAS_UNION_SEMUN
18122     {
18123         int val;
18124         struct semid_ds *buf;
18125         unsigned short *array;
18126     }
18127 #endif
18128     arg;
18129     int sem, st;
18130
18131 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
18132     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18133     if (sem > -1) {
18134         struct semid_ds argbuf;
18135         arg.buf = &argbuf;
18136 #       ifdef IPC_STAT
18137         st = semctl(sem, 0, IPC_STAT, arg);
18138         if (st == 0)
18139             printf("semun\n");
18140         else
18141 #       endif /* IPC_STAT */
18142             printf("semctl IPC_STAT failed: errno = %d\n", errno);
18143 #       ifdef IPC_RMID
18144         if (semctl(sem, 0, IPC_RMID, arg) != 0)
18145 #       endif /* IPC_RMID */
18146             printf("semctl IPC_RMID failed: errno = %d\n", errno);
18147     } else
18148 #endif /* IPC_PRIVATE && ... */
18149         printf("semget failed: errno = %d\n", errno);
18150   return 0;
18151 }
18152 END
18153       set try
18154       if eval $compile; then
18155           xxx=`$run ./try`
18156           case "$xxx" in
18157           semun) val="$define" ;;
18158           esac
18159       fi
18160       $rm_try
18161       set d_semctl_semun
18162       eval $setvar
18163       ;;
18164     esac
18165     case "$d_semctl_semun" in
18166     $define)
18167         echo "You can use union semun for semctl IPC_STAT." >&4
18168         also='also'
18169         ;;
18170     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
18171         also=''
18172         ;;
18173     esac
18174
18175     : see whether semctl IPC_STAT can use struct semid_ds pointer
18176     case "$d_semctl_semid_ds" in
18177     '')
18178       val="$undef"
18179       $cat > try.c <<'END'
18180 #include <sys/types.h>
18181 #include <sys/ipc.h>
18182 #include <sys/sem.h>
18183 #include <sys/stat.h>
18184 #include "tryh.h"
18185 #include <stdio.h>
18186 #include <errno.h>
18187 #ifndef errno
18188 extern int errno;
18189 #endif
18190 int main() {
18191     struct semid_ds arg;
18192     int sem, st;
18193
18194 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
18195     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18196     if (sem > -1) {
18197 #       ifdef IPC_STAT
18198         st = semctl(sem, 0, IPC_STAT, &arg);
18199         if (st == 0)
18200             printf("semid_ds\n");
18201         else
18202 #       endif /* IPC_STAT */
18203             printf("semctl IPC_STAT failed: errno = %d\n", errno);
18204 #       ifdef IPC_RMID
18205         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
18206 #       endif /* IPC_RMID */
18207             printf("semctl IPC_RMID failed: errno = %d\n", errno);
18208     } else
18209 #endif /* IPC_PRIVATE && ... */
18210         printf("semget failed: errno = %d\n", errno);
18211
18212     return 0;
18213 }
18214 END
18215       set try
18216       if eval $compile; then
18217           xxx=`$run ./try`
18218           case "$xxx" in
18219           semid_ds) val="$define" ;;
18220           esac
18221       fi
18222       $rm_try
18223       set d_semctl_semid_ds
18224       eval $setvar
18225       ;;
18226     esac
18227     case "$d_semctl_semid_ds" in
18228     $define)
18229         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
18230         ;;
18231     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
18232         ;;
18233     esac
18234     ;;
18235 *)  val="$undef"
18236
18237     # We do not have the full sem*(2) library, so assume we can not
18238     # use either.
18239
18240     set d_semctl_semun
18241     eval $setvar
18242
18243     set d_semctl_semid_ds
18244     eval $setvar
18245     ;;
18246 esac
18247 $rm_try tryh.h
18248
18249 : see if sendmsg exists
18250 set sendmsg d_sendmsg
18251 eval $inlibc
18252
18253 : see if setegid exists
18254 set setegid d_setegid
18255 eval $inlibc
18256
18257 : see if seteuid exists
18258 set seteuid d_seteuid
18259 eval $inlibc
18260
18261 : see if setgrent exists
18262 set setgrent d_setgrent
18263 eval $inlibc
18264
18265 : see if setgrent_r exists
18266 set setgrent_r d_setgrent_r
18267 eval $inlibc
18268 case "$d_setgrent_r" in
18269 "$define")
18270         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
18271         case "$d_setgrent_r_proto:$usethreads" in
18272         ":define")      d_setgrent_r_proto=define
18273                 set d_setgrent_r_proto setgrent_r $hdrs
18274                 eval $hasproto ;;
18275         *)      ;;
18276         esac
18277         case "$d_setgrent_r_proto" in
18278         define)
18279         case "$setgrent_r_proto" in
18280         ''|0) try='int setgrent_r(FILE**);'
18281         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
18282         esac
18283         case "$setgrent_r_proto" in
18284         ''|0) try='void setgrent_r(FILE**);'
18285         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
18286         esac
18287         case "$setgrent_r_proto" in
18288         ''|0)   d_setgrent_r=undef
18289                 setgrent_r_proto=0
18290                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
18291         * )     case "$setgrent_r_proto" in
18292                 REENTRANT_PROTO*) ;;
18293                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
18294                 esac
18295                 echo "Prototype: $try" ;;
18296         esac
18297         ;;
18298         *)      case "$usethreads" in
18299                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
18300                 esac
18301                 d_setgrent_r=undef
18302                 setgrent_r_proto=0
18303                 ;;
18304         esac
18305         ;;
18306 *)      setgrent_r_proto=0
18307         ;;
18308 esac
18309
18310 : see if sethostent exists
18311 set sethostent d_sethent
18312 eval $inlibc
18313
18314 : see if sethostent_r exists
18315 set sethostent_r d_sethostent_r
18316 eval $inlibc
18317 case "$d_sethostent_r" in
18318 "$define")
18319         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18320         case "$d_sethostent_r_proto:$usethreads" in
18321         ":define")      d_sethostent_r_proto=define
18322                 set d_sethostent_r_proto sethostent_r $hdrs
18323                 eval $hasproto ;;
18324         *)      ;;
18325         esac
18326         case "$d_sethostent_r_proto" in
18327         define)
18328         case "$sethostent_r_proto" in
18329         ''|0) try='int sethostent_r(int, struct hostent_data*);'
18330         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
18331         esac
18332         case "$sethostent_r_proto" in
18333         ''|0) try='void sethostent_r(int, struct hostent_data*);'
18334         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
18335         esac
18336         case "$sethostent_r_proto" in
18337         ''|0)   d_sethostent_r=undef
18338                 sethostent_r_proto=0
18339                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
18340         * )     case "$sethostent_r_proto" in
18341                 REENTRANT_PROTO*) ;;
18342                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
18343                 esac
18344                 echo "Prototype: $try" ;;
18345         esac
18346         ;;
18347         *)      case "$usethreads" in
18348                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
18349                 esac
18350                 d_sethostent_r=undef
18351                 sethostent_r_proto=0
18352                 ;;
18353         esac
18354         ;;
18355 *)      sethostent_r_proto=0
18356         ;;
18357 esac
18358
18359 : see if setitimer exists
18360 set setitimer d_setitimer
18361 eval $inlibc
18362
18363 : see if setlinebuf exists
18364 set setlinebuf d_setlinebuf
18365 eval $inlibc
18366
18367 : see if setlocale exists
18368 set setlocale d_setlocale
18369 eval $inlibc
18370
18371 : see if locale.h is available
18372 set locale.h i_locale
18373 eval $inhdr
18374
18375 : see if setlocale_r exists
18376 set setlocale_r d_setlocale_r
18377 eval $inlibc
18378 case "$d_setlocale_r" in
18379 "$define")
18380         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18381         case "$d_setlocale_r_proto:$usethreads" in
18382         ":define")      d_setlocale_r_proto=define
18383                 set d_setlocale_r_proto setlocale_r $hdrs
18384                 eval $hasproto ;;
18385         *)      ;;
18386         esac
18387         case "$d_setlocale_r_proto" in
18388         define)
18389         case "$setlocale_r_proto" in
18390         ''|0) try='int setlocale_r(int, const char*, char*, int);'
18391         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18392         esac
18393         case "$setlocale_r_proto" in
18394         ''|0)   d_setlocale_r=undef
18395                 setlocale_r_proto=0
18396                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18397         * )     case "$setlocale_r_proto" in
18398                 REENTRANT_PROTO*) ;;
18399                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18400                 esac
18401                 echo "Prototype: $try" ;;
18402         esac
18403         ;;
18404         *)      case "$usethreads" in
18405                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18406                 esac
18407                 d_setlocale_r=undef
18408                 setlocale_r_proto=0
18409                 ;;
18410         esac
18411         ;;
18412 *)      setlocale_r_proto=0
18413         ;;
18414 esac
18415
18416 : see if setnetent exists
18417 set setnetent d_setnent
18418 eval $inlibc
18419
18420 : see if setnetent_r exists
18421 set setnetent_r d_setnetent_r
18422 eval $inlibc
18423 case "$d_setnetent_r" in
18424 "$define")
18425         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18426         case "$d_setnetent_r_proto:$usethreads" in
18427         ":define")      d_setnetent_r_proto=define
18428                 set d_setnetent_r_proto setnetent_r $hdrs
18429                 eval $hasproto ;;
18430         *)      ;;
18431         esac
18432         case "$d_setnetent_r_proto" in
18433         define)
18434         case "$setnetent_r_proto" in
18435         ''|0) try='int setnetent_r(int, struct netent_data*);'
18436         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18437         esac
18438         case "$setnetent_r_proto" in
18439         ''|0) try='void setnetent_r(int, struct netent_data*);'
18440         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18441         esac
18442         case "$setnetent_r_proto" in
18443         ''|0)   d_setnetent_r=undef
18444                 setnetent_r_proto=0
18445                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18446         * )     case "$setnetent_r_proto" in
18447                 REENTRANT_PROTO*) ;;
18448                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18449                 esac
18450                 echo "Prototype: $try" ;;
18451         esac
18452         ;;
18453         *)      case "$usethreads" in
18454                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18455                 esac
18456                 d_setnetent_r=undef
18457                 setnetent_r_proto=0
18458                 ;;
18459         esac
18460         ;;
18461 *)      setnetent_r_proto=0
18462         ;;
18463 esac
18464
18465 : see if setprotoent exists
18466 set setprotoent d_setpent
18467 eval $inlibc
18468
18469 : see if setpgid exists
18470 set setpgid d_setpgid
18471 eval $inlibc
18472
18473 : see if setpgrp2 exists
18474 set setpgrp2 d_setpgrp2
18475 eval $inlibc
18476
18477 : see if setpriority exists
18478 set setpriority d_setprior
18479 eval $inlibc
18480
18481 : see if setproctitle exists
18482 set setproctitle d_setproctitle
18483 eval $inlibc
18484
18485 : see if setprotoent_r exists
18486 set setprotoent_r d_setprotoent_r
18487 eval $inlibc
18488 case "$d_setprotoent_r" in
18489 "$define")
18490         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18491         case "$d_setprotoent_r_proto:$usethreads" in
18492         ":define")      d_setprotoent_r_proto=define
18493                 set d_setprotoent_r_proto setprotoent_r $hdrs
18494                 eval $hasproto ;;
18495         *)      ;;
18496         esac
18497         case "$d_setprotoent_r_proto" in
18498         define)
18499         case "$setprotoent_r_proto" in
18500         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18501         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18502         esac
18503         case "$setprotoent_r_proto" in
18504         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18505         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18506         esac
18507         case "$setprotoent_r_proto" in
18508         ''|0)   d_setprotoent_r=undef
18509                 setprotoent_r_proto=0
18510                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18511         * )     case "$setprotoent_r_proto" in
18512                 REENTRANT_PROTO*) ;;
18513                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18514                 esac
18515                 echo "Prototype: $try" ;;
18516         esac
18517         ;;
18518         *)      case "$usethreads" in
18519                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18520                 esac
18521                 d_setprotoent_r=undef
18522                 setprotoent_r_proto=0
18523                 ;;
18524         esac
18525         ;;
18526 *)      setprotoent_r_proto=0
18527         ;;
18528 esac
18529
18530 : see if setpwent exists
18531 set setpwent d_setpwent
18532 eval $inlibc
18533
18534 : see if setpwent_r exists
18535 set setpwent_r d_setpwent_r
18536 eval $inlibc
18537 case "$d_setpwent_r" in
18538 "$define")
18539         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18540         case "$d_setpwent_r_proto:$usethreads" in
18541         ":define")      d_setpwent_r_proto=define
18542                 set d_setpwent_r_proto setpwent_r $hdrs
18543                 eval $hasproto ;;
18544         *)      ;;
18545         esac
18546         case "$d_setpwent_r_proto" in
18547         define)
18548         case "$setpwent_r_proto" in
18549         ''|0) try='int setpwent_r(FILE**);'
18550         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18551         esac
18552         case "$setpwent_r_proto" in
18553         ''|0) try='void setpwent_r(FILE**);'
18554         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18555         esac
18556         case "$setpwent_r_proto" in
18557         ''|0)   d_setpwent_r=undef
18558                 setpwent_r_proto=0
18559                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18560         * )     case "$setpwent_r_proto" in
18561                 REENTRANT_PROTO*) ;;
18562                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18563                 esac
18564                 echo "Prototype: $try" ;;
18565         esac
18566         ;;
18567         *)      case "$usethreads" in
18568                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18569                 esac
18570                 d_setpwent_r=undef
18571                 setpwent_r_proto=0
18572                 ;;
18573         esac
18574         ;;
18575 *)      setpwent_r_proto=0
18576         ;;
18577 esac
18578
18579 : see if setregid exists
18580 set setregid d_setregid
18581 eval $inlibc
18582 set setresgid d_setresgid
18583 eval $inlibc
18584
18585 : see if setreuid exists
18586 set setreuid d_setreuid
18587 eval $inlibc
18588 set setresuid d_setresuid
18589 eval $inlibc
18590
18591 : see if setrgid exists
18592 set setrgid d_setrgid
18593 eval $inlibc
18594
18595 : see if setruid exists
18596 set setruid d_setruid
18597 eval $inlibc
18598
18599 : see if setservent exists
18600 set setservent d_setsent
18601 eval $inlibc
18602
18603 : see if setservent_r exists
18604 set setservent_r d_setservent_r
18605 eval $inlibc
18606 case "$d_setservent_r" in
18607 "$define")
18608         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18609         case "$d_setservent_r_proto:$usethreads" in
18610         ":define")      d_setservent_r_proto=define
18611                 set d_setservent_r_proto setservent_r $hdrs
18612                 eval $hasproto ;;
18613         *)      ;;
18614         esac
18615         case "$d_setservent_r_proto" in
18616         define)
18617         case "$setservent_r_proto" in
18618         ''|0) try='int setservent_r(int, struct servent_data*);'
18619         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18620         esac
18621         case "$setservent_r_proto" in
18622         ''|0) try='void setservent_r(int, struct servent_data*);'
18623         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18624         esac
18625         case "$setservent_r_proto" in
18626         ''|0)   d_setservent_r=undef
18627                 setservent_r_proto=0
18628                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18629         * )     case "$setservent_r_proto" in
18630                 REENTRANT_PROTO*) ;;
18631                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18632                 esac
18633                 echo "Prototype: $try" ;;
18634         esac
18635         ;;
18636         *)      case "$usethreads" in
18637                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18638                 esac
18639                 d_setservent_r=undef
18640                 setservent_r_proto=0
18641                 ;;
18642         esac
18643         ;;
18644 *)      setservent_r_proto=0
18645         ;;
18646 esac
18647
18648 : see if setsid exists
18649 set setsid d_setsid
18650 eval $inlibc
18651
18652 : see if setvbuf exists
18653 set setvbuf d_setvbuf
18654 eval $inlibc
18655
18656 : see if shmctl exists
18657 set shmctl d_shmctl
18658 eval $inlibc
18659
18660 : see if shmget exists
18661 set shmget d_shmget
18662 eval $inlibc
18663
18664 : see if shmat exists
18665 set shmat d_shmat
18666 eval $inlibc
18667 : see what shmat returns
18668 case "$d_shmat" in
18669 "$define")
18670         $cat >shmat.c <<'END'
18671 #include <sys/shm.h>
18672 void *shmat();
18673 END
18674         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18675                 shmattype='void *'
18676         else
18677                 shmattype='char *'
18678         fi
18679         echo "and it returns ($shmattype)." >&4
18680         : see if a prototype for shmat is available
18681         xxx=`./findhdr sys/shm.h`
18682         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18683         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18684                 val="$define"
18685         else
18686                 val="$undef"
18687         fi
18688         $rm -f shmat.[co]
18689         ;;
18690 *)
18691         val="$undef"
18692         ;;
18693 esac
18694 set d_shmatprototype
18695 eval $setvar
18696
18697 : see if shmdt exists
18698 set shmdt d_shmdt
18699 eval $inlibc
18700
18701 : see how much of the 'shm*(2)' library is present.
18702 h_shm=true
18703 echo " "
18704 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18705 *"$undef"*) h_shm=false;;
18706 esac
18707 case "$osname" in
18708 freebsd)
18709     case "`ipcs 2>&1`" in
18710     "SVID shared memory"*"not configured"*)
18711         echo "Your $osname does not have the shm*(2) configured." >&4
18712         h_shm=false
18713         val="$undef"
18714         set shmctl d_shmctl
18715         eval $setvar
18716         set shmget d_shmget
18717         eval $setvar
18718         set shmat d_shmat
18719         eval $setvar
18720         set shmdt d_shmdt
18721         eval $setvar
18722         ;;
18723     esac
18724     ;;
18725 esac
18726 : we could also check for sys/ipc.h ...
18727 if $h_shm && $test `./findhdr sys/shm.h`; then
18728         echo "You have the full shm*(2) library." >&4
18729         val="$define"
18730 else
18731         echo "You don't have the full shm*(2) library." >&4
18732         val="$undef"
18733 fi
18734 set d_shm
18735 eval $setvar
18736
18737 : see if we have sigaction
18738 echo " "
18739 if set sigaction val -f d_sigaction; eval $csym; $val; then
18740         echo 'sigaction() found.' >&4
18741         $cat > try.c <<EOP
18742 #include <stdio.h>
18743 #include <sys/types.h>
18744 #include <signal.h>
18745 #$i_stdlib I_STDLIB
18746 #ifdef I_STDLIB
18747 #include <stdlib.h>
18748 #endif
18749 int main()
18750 {
18751     struct sigaction act, oact;
18752     act.sa_flags = 0;
18753     oact.sa_handler = 0;
18754     /* so that act and oact are used */
18755     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18756 }
18757 EOP
18758         set try
18759         if eval $compile_ok; then
18760                 val="$define"
18761         else
18762                 echo "But you don't seem to have a usable struct sigaction." >&4
18763                 val="$undef"
18764         fi
18765 else
18766         echo 'sigaction NOT found.' >&4
18767         val="$undef"
18768 fi
18769 set d_sigaction; eval $setvar
18770 $rm_try
18771
18772 : see what type pids are declared as in the kernel
18773 rp="What is the type of process ids on this system?"
18774 set pid_t pidtype int stdio.h sys/types.h
18775 eval $typedef_ask
18776
18777 : see what type uids are declared as in the kernel
18778 echo " "
18779 echo "Looking for the type for user ids returned by getuid()."
18780 set uid_t uidtype xxx stdio.h sys/types.h
18781 eval $typedef
18782 case "$uidtype" in
18783 xxx)
18784         xxx=`./findhdr sys/user.h`
18785         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18786         case $1 in
18787         unsigned) dflt="$1 $2" ;;
18788         *) dflt="$1" ;;
18789         esac
18790         ;;
18791 *) dflt="$uidtype";;
18792 esac
18793 case "$uidtype" in
18794 uid_t)  echo "uid_t found." ;;
18795 *)      rp="What is the type for user ids returned by getuid()?"
18796         . ./myread
18797         uidtype="$ans"
18798         ;;
18799 esac
18800
18801 : Define hasfield_t macro for Configure internal use
18802 hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
18803 while $test $# -ge 2; do
18804     case "$1" in
18805         $define) echo "#include <$2>";;
18806     esac ;
18807     shift 2;
18808 done > try.c;
18809 echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
18810 set try;
18811 if eval $compile; then
18812         val="$define";
18813 else
18814         val="$undef";
18815 fi;
18816 set $varname;
18817 eval $setvar;
18818 $rm_try'
18819
18820 : see what siginfo fields we have
18821 case "$d_sigaction" in
18822 "$define")
18823         echo "Checking if your siginfo_t has si_errno field...">&4
18824         set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
18825         eval $hasfield_t;
18826
18827         echo "Checking if your siginfo_t has si_pid field...">&4
18828         set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
18829         eval $hasfield_t;
18830
18831         echo "Checking if your siginfo_t has si_uid field...">&4
18832         set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
18833         eval $hasfield_t;
18834
18835         echo "Checking if your siginfo_t has si_addr field...">&4
18836         set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
18837         eval $hasfield_t;
18838
18839         echo "Checking if your siginfo_t has si_status field...">&4
18840         set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
18841         eval $hasfield_t;
18842
18843         echo "Checking if your siginfo_t has si_band field...">&4
18844         set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
18845         eval $hasfield_t;
18846
18847         echo "Checking if your siginfo_t has si_value field...">&4
18848         set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
18849         eval $hasfield_t;
18850
18851         echo "Checking if your siginfo_t has si_fd field...">&4
18852         set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
18853         eval $hasfield_t;
18854
18855         ;;
18856 *)
18857         d_siginfo_si_errno="$undef"
18858         d_siginfo_si_pid="$undef"
18859         d_siginfo_si_uid="$undef"
18860         d_siginfo_si_addr="$undef"
18861         d_siginfo_si_status="$undef"
18862         d_siginfo_si_band="$undef"
18863         d_siginfo_si_value="$undef"
18864         d_siginfo_si_fd="$undef"
18865         ;;
18866 esac
18867
18868 : see if this is a sunmath.h system
18869 set sunmath.h i_sunmath
18870 eval $inhdr
18871
18872 : see if signbit exists
18873 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18874 $cat >try.c <<EOCP
18875 #$i_math I_MATH
18876 #$i_sunmath I_SUNMATH
18877 #ifdef I_MATH
18878 #  include <math.h>
18879 #endif
18880 #ifdef I_SUNMATH  /* Solaris special math library */
18881 #  include <sunmath.h>
18882 #endif
18883 #define NV $nvtype
18884 int main(int argc, char **argv)
18885 {
18886     NV x = 0.0;
18887     NV y = -1.0;
18888     if ((signbit(x) == 0) && (signbit(y) != 0))
18889         return 0;
18890     else
18891         return 1;
18892 }
18893 EOCP
18894 val="$undef"
18895 set try
18896 if eval $compile; then
18897     if $run ./try; then
18898         $echo "Yes." >&4
18899         val="$define"
18900     else
18901         $echo "Signbit seems to be available, but doesn't work as I expected."
18902         $echo "I won't use it." >&4
18903         val="$undef"
18904     fi
18905 else
18906     $echo "Nope." >&4
18907     dflt="$undef"
18908 fi
18909 set d_signbit
18910 eval $setvar
18911 $rm_try
18912
18913 : see if sigprocmask exists
18914 set sigprocmask d_sigprocmask
18915 eval $inlibc
18916
18917 : see if sigsetjmp exists
18918 echo " "
18919 case "$d_sigsetjmp" in
18920 '')
18921         $cat >try.c <<EOP
18922 #include <setjmp.h>
18923 #$i_stdlib I_STDLIB
18924 #ifdef I_STDLIB
18925 #include <stdlib.h>
18926 #endif
18927 sigjmp_buf env;
18928 int set = 1;
18929 int main()
18930 {
18931         if (sigsetjmp(env,1))
18932                 exit(set);
18933         set = 0;
18934         siglongjmp(env, 1);
18935         exit(1);
18936 }
18937 EOP
18938         set try
18939         if eval $compile; then
18940                 if $run ./try >/dev/null 2>&1; then
18941                         echo "POSIX sigsetjmp found." >&4
18942                         val="$define"
18943                 else
18944                         $cat >&4 <<EOM
18945 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18946 I'll ignore them.
18947 EOM
18948                         val="$undef"
18949                 fi
18950         else
18951                 echo "sigsetjmp not found." >&4
18952                 val="$undef"
18953         fi
18954         ;;
18955 *) val="$d_sigsetjmp"
18956         case "$d_sigsetjmp" in
18957         $define) echo "POSIX sigsetjmp found." >&4;;
18958         $undef) echo "sigsetjmp not found." >&4;;
18959         esac
18960         ;;
18961 esac
18962 set d_sigsetjmp
18963 eval $setvar
18964 $rm_try
18965
18966 : see if snprintf exists
18967 set snprintf d_snprintf
18968 eval $inlibc
18969
18970 : see if vsnprintf exists
18971 set vsnprintf d_vsnprintf
18972 eval $inlibc
18973
18974 case "$d_snprintf-$d_vsnprintf" in
18975 "$define-$define")
18976     $cat <<EOM
18977 Checking whether your snprintf() and vsnprintf() work okay...
18978 EOM
18979     $cat >try.c <<'EOCP'
18980 /* v?snprintf testing logic courtesy of Russ Allbery.
18981  * According to C99:
18982  * - if the buffer is too short it still must be \0-terminated
18983  * - if the buffer is too short the potentially required length
18984  *   must be returned and not -1
18985  * - if the buffer is NULL the potentially required length
18986  *   must be returned and not -1 or core dump
18987  */
18988 #include <stdio.h>
18989 #include <stdarg.h>
18990
18991 char buf[2];
18992
18993 int test (char *format, ...)
18994 {
18995     va_list args;
18996     int count;
18997
18998     va_start (args, format);
18999     count = vsnprintf (buf, sizeof buf, format, args);
19000     va_end (args);
19001     return count;
19002 }
19003
19004 int main ()
19005 {
19006     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
19007              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
19008 }
19009 EOCP
19010     set try
19011     if eval $compile; then
19012         `$run ./try`
19013         case "$?" in
19014         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
19015         *) cat <<EOM >&4
19016 Your snprintf() and snprintf() don't seem to be working okay.
19017 EOM
19018            d_snprintf="$undef"
19019            d_vsnprintf="$undef"
19020            ;;
19021         esac
19022     else
19023         echo "(I can't seem to compile the test program--assuming they don't)"
19024         d_snprintf="$undef"
19025         d_vsnprintf="$undef"
19026     fi
19027     $rm_try
19028     ;;
19029 esac
19030
19031 : see if sockatmark exists
19032 set sockatmark d_sockatmark
19033 eval $inlibc
19034
19035 : see if prototype for sockatmark is available
19036 echo " "
19037 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
19038 eval $hasproto
19039
19040 : see if socks5_init exists
19041 set socks5_init d_socks5_init
19042 eval $inlibc
19043
19044 : see if sprintf returns the length of the string in the buffer as per ANSI
19045 $echo "Checking whether sprintf returns the length of the string..." >&4
19046 $cat <<EOP >try.c
19047 #include <stdio.h>
19048 #$i_stdlib I_STDLIB
19049 #ifdef I_STDLIB
19050 #include <stdlib.h>
19051 #endif
19052 #$i_string I_STRING
19053 #ifdef I_STRING
19054 #  include <string.h>
19055 #else
19056 #  include <strings.h>
19057 #endif
19058 #$i_math I_MATH
19059 #ifdef I_MATH
19060 #include <math.h>
19061 #endif
19062
19063 char buffer[256];
19064
19065 int check (size_t expect, int test) {
19066   size_t got = strlen(buffer);
19067   if (expect == got)
19068     return 0;
19069
19070   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
19071        test, buffer);
19072   exit (test);
19073 }
19074
19075 int main(int argc, char **argv) {
19076   int test = 0;
19077
19078   check(sprintf(buffer, ""), ++test);
19079   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
19080   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
19081
19082   return 0;
19083 }
19084 EOP
19085 set try
19086
19087 if eval $compile; then
19088     xxx="`$run ./try`"
19089     case "$?" in
19090         0) cat >&4 <<EOM
19091 sprintf returns the length of the string (as ANSI says it should)
19092 EOM
19093         d_sprintf_returns_strlen="$define"
19094         ;;
19095         *) cat >&4 <<EOM
19096 sprintf does not return the length of the string (how old is this system?)
19097 EOM
19098         d_sprintf_returns_strlen="$undef"
19099         ;;
19100     esac
19101 else
19102     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
19103     d_sprintf_returns_strlen="$undef"
19104 fi
19105 $rm_try
19106
19107 : see if srand48_r exists
19108 set srand48_r d_srand48_r
19109 eval $inlibc
19110 case "$d_srand48_r" in
19111 "$define")
19112         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
19113         case "$d_srand48_r_proto:$usethreads" in
19114         ":define")      d_srand48_r_proto=define
19115                 set d_srand48_r_proto srand48_r $hdrs
19116                 eval $hasproto ;;
19117         *)      ;;
19118         esac
19119         case "$d_srand48_r_proto" in
19120         define)
19121         case "$srand48_r_proto" in
19122         ''|0) try='int srand48_r(long, struct drand48_data*);'
19123         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
19124         esac
19125         case "$srand48_r_proto" in
19126         ''|0)   d_srand48_r=undef
19127                 srand48_r_proto=0
19128                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
19129         * )     case "$srand48_r_proto" in
19130                 REENTRANT_PROTO*) ;;
19131                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
19132                 esac
19133                 echo "Prototype: $try" ;;
19134         esac
19135         ;;
19136         *)      case "$usethreads" in
19137                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
19138                 esac
19139                 d_srand48_r=undef
19140                 srand48_r_proto=0
19141                 ;;
19142         esac
19143         ;;
19144 *)      srand48_r_proto=0
19145         ;;
19146 esac
19147
19148 : see if srandom_r exists
19149 set srandom_r d_srandom_r
19150 eval $inlibc
19151 case "$d_srandom_r" in
19152 "$define")
19153         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
19154         case "$d_srandom_r_proto:$usethreads" in
19155         ":define")      d_srandom_r_proto=define
19156                 set d_srandom_r_proto srandom_r $hdrs
19157                 eval $hasproto ;;
19158         *)      ;;
19159         esac
19160         case "$d_srandom_r_proto" in
19161         define)
19162         case "$srandom_r_proto" in
19163         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
19164         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
19165         esac
19166         case "$srandom_r_proto" in
19167         ''|0)   d_srandom_r=undef
19168                 srandom_r_proto=0
19169                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
19170         * )     case "$srandom_r_proto" in
19171                 REENTRANT_PROTO*) ;;
19172                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
19173                 esac
19174                 echo "Prototype: $try" ;;
19175         esac
19176         ;;
19177         *)      case "$usethreads" in
19178                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
19179                 esac
19180                 d_srandom_r=undef
19181                 srandom_r_proto=0
19182                 ;;
19183         esac
19184         ;;
19185 *)      srandom_r_proto=0
19186         ;;
19187 esac
19188
19189 : see if prototype for setresgid is available
19190 echo " "
19191 set d_sresgproto setresgid $i_unistd unistd.h
19192 eval $hasproto
19193
19194 : see if prototype for setresuid is available
19195 echo " "
19196 set d_sresuproto setresuid $i_unistd unistd.h
19197 eval $hasproto
19198
19199 : see if stat exists
19200 set stat d_stat
19201 eval $inlibc
19202
19203 : see if sys/stat.h is available
19204 set sys/stat.h i_sysstat
19205 eval $inhdr
19206
19207 : see if stat knows about block sizes
19208 echo " "
19209 echo "Checking to see if your struct stat has st_blocks field..." >&4
19210 set d_statblks stat st_blocks $i_sysstat sys/stat.h
19211 eval $hasfield
19212
19213 : see if this is a sys/vfs.h system
19214 set sys/vfs.h i_sysvfs
19215 eval $inhdr
19216
19217 : see if this is a sys/statfs.h system
19218 set sys/statfs.h i_sysstatfs
19219 eval $inhdr
19220
19221 : Check for statfs_s
19222 echo " "
19223 echo "Checking to see if your system supports struct statfs..." >&4
19224 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
19225 eval $hasstruct
19226 case "$d_statfs_s" in
19227 "$define")      echo "Yes, it does."   ;;
19228 *)              echo "No, it doesn't." ;;
19229 esac
19230
19231
19232 : see if struct statfs knows about f_flags
19233 case "$d_statfs_s" in
19234 define)
19235         echo " "
19236         echo "Checking to see if your struct statfs has f_flags field..." >&4
19237         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
19238         eval $hasfield
19239         ;;
19240 *)      val="$undef"
19241         set d_statfs_f_flags
19242         eval $setvar
19243         ;;
19244 esac
19245 case "$d_statfs_f_flags" in
19246 "$define")      echo "Yes, it does."   ;;
19247 *)              echo "No, it doesn't." ;;
19248 esac
19249
19250 : see what flavor, if any, of static inline is supported
19251 echo " "
19252 echo "Checking to see if your system supports static inline..."
19253 $cat > try.c <<'EOCP'
19254 #include <stdlib.h>
19255 extern int f_via_a(int x);
19256 extern int f_via_b(int x);
19257 int main(int argc, char **argv)
19258 {
19259     int y;
19260
19261     y = f_via_a(0);
19262 #ifdef USE_B
19263     y = f_via_b(0);
19264 #endif
19265     if (y == 42) {
19266         return EXIT_SUCCESS;
19267     }
19268     else {
19269         return EXIT_FAILURE;
19270     }
19271 }
19272 EOCP
19273 $cat > a.c <<'EOCP'
19274 static INLINE int f(int x) {
19275     int y;
19276     y = x + 42;
19277     return y;
19278 }
19279
19280 int f_via_a(int x)
19281 {
19282     return f(x);
19283 }
19284 EOCP
19285 $cat > b.c <<'EOCP'
19286 extern int f(int x);
19287
19288 int f_via_b(int x)
19289 {
19290     return f(x);
19291 }
19292 EOCP
19293
19294 # Respect a hint (or previous) value for perl_static_inline, if there is one.
19295 case "$perl_static_inline" in
19296 '')     # Check the various possibilities, and break out on success.
19297         # For gcc, prefer __inline__, which will still permit
19298         # cflags.SH to add in -ansi.
19299         case "$gccversion" in
19300                 '') xxx="inline __inline__ __inline _inline";;
19301                 *)  xxx="__inline__ inline __inline _inline";;
19302         esac
19303         for inline in $xxx; do
19304                 set try -DINLINE=$inline a.c
19305                 if eval $compile && $run ./try; then
19306                         # Now make sure there is no external linkage of static
19307                         # functions
19308                         set try -DINLINE=$inline -DUSE_B a.c b.c
19309                         if eval $compile && $run ./try; then
19310                                 $echo "Your compiler supports static $inline, " >&4
19311                                 $echo "but it also creates an external definition," >&4
19312                                 $echo "so I won't use it." >&4
19313                                 val=$undef
19314                         else
19315                                 $echo "Your compiler supports static $inline." >&4
19316                                 val=$define
19317                                 perl_static_inline="static $inline";
19318                                 break;
19319                         fi
19320                 else
19321                         $echo "Your compiler does NOT support static $inline." >&4
19322                         val="$undef"
19323                 fi
19324         done
19325         ;;
19326 *inline*) # Some variant of inline exists.
19327         echo "Keeping your $hint value of $perl_static_inline."
19328         val=$define
19329         ;;
19330 static)  # No inline capabilities
19331         echo "Keeping your $hint value of $perl_static_inline."
19332         val=$undef
19333         ;;
19334 *)  # Unrecognized previous value -- blindly trust the supplied
19335         # value and hope it makes sense.  Use old value for
19336         # d_static_inline, if there is one.
19337         echo "Keeping your $hint value of $perl_static_inline."
19338         case "$d_static_inline" in
19339                 '') val=$define ;;
19340                 *)  val=$d_static_inline ;;
19341         esac
19342         ;;
19343 esac
19344 # Fallback to plain 'static' if nothing worked.
19345 case "$perl_static_inline" in
19346 '')
19347         perl_static_inline="static"
19348         val=$undef
19349         ;;
19350 esac
19351 set d_static_inline
19352 eval $setvar
19353 $rm -f a.[co] b.[co]
19354 $rm_try
19355
19356 : Check stream access
19357 $cat >&4 <<EOM
19358 Checking how to access stdio streams by file descriptor number...
19359 EOM
19360 case "$stdio_stream_array" in
19361 '')     $cat >try.c <<EOCP
19362 #include <stdio.h>
19363 int main() {
19364   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
19365     printf("yes\n");
19366 }
19367 EOCP
19368         for s in _iob __iob __sF
19369         do
19370                 set try -DSTDIO_STREAM_ARRAY=$s
19371                 if eval $compile; then
19372                         case "`$run ./try`" in
19373                         yes)    stdio_stream_array=$s; break ;;
19374                         esac
19375                 fi
19376         done
19377         $rm_try
19378 esac
19379 case "$stdio_stream_array" in
19380 '')     $cat >&4 <<EOM
19381 I can't figure out how to access stdio streams by file descriptor number.
19382 EOM
19383         d_stdio_stream_array="$undef"
19384         ;;
19385 *)      $cat >&4 <<EOM
19386 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
19387 EOM
19388         d_stdio_stream_array="$define"
19389         ;;
19390 esac
19391
19392 : see if strcoll exists
19393 set strcoll d_strcoll
19394 eval $inlibc
19395
19396 : check for structure copying
19397 echo " "
19398 echo "Checking to see if your C compiler can copy structs..." >&4
19399 $cat >try.c <<'EOCP'
19400 int main()
19401 {
19402         struct blurfl {
19403                 int dyick;
19404         } foo, bar;
19405
19406         foo = bar;
19407 }
19408 EOCP
19409 if $cc -c try.c >/dev/null 2>&1 ; then
19410         val="$define"
19411         echo "Yup, it can."
19412 else
19413         val="$undef"
19414         echo "Nope, it can't."
19415 fi
19416 set d_strctcpy
19417 eval $setvar
19418 $rm_try
19419
19420 : see if strerror and/or sys_errlist[] exist
19421 echo " "
19422 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
19423     if set strerror val -f d_strerror; eval $csym; $val; then
19424                 echo 'strerror() found.' >&4
19425                 d_strerror="$define"
19426                 d_strerrm='strerror(e)'
19427                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19428                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
19429                         d_syserrlst="$define"
19430                 else
19431                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
19432                         d_syserrlst="$undef"
19433                 fi
19434     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
19435                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
19436                 echo 'strerror() found in string header.' >&4
19437                 d_strerror="$define"
19438                 d_strerrm='strerror(e)'
19439                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19440                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
19441                                 d_syserrlst="$define"
19442                 else
19443                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
19444                         d_syserrlst="$undef"
19445                 fi
19446     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19447                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
19448                 d_strerror="$undef"
19449                 d_syserrlst="$define"
19450                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
19451     else
19452                 echo 'strerror() and sys_errlist[] NOT found.' >&4
19453                 d_strerror="$undef"
19454                 d_syserrlst="$undef"
19455                 d_strerrm='"unknown"'
19456     fi
19457 fi
19458
19459 : see if strerror_l exists
19460 set strerror_l d_strerror_l
19461 eval $inlibc
19462
19463 : see if strerror_r exists
19464 set strerror_r d_strerror_r
19465 eval $inlibc
19466 case "$d_strerror_r" in
19467 "$define")
19468         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
19469         case "$d_strerror_r_proto:$usethreads" in
19470         ":define")      d_strerror_r_proto=define
19471                 set d_strerror_r_proto strerror_r $hdrs
19472                 eval $hasproto ;;
19473         *)      ;;
19474         esac
19475         case "$d_strerror_r_proto" in
19476         define)
19477         case "$strerror_r_proto" in
19478         ''|0) try='int strerror_r(int, char*, size_t);'
19479         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
19480         esac
19481         case "$strerror_r_proto" in
19482         ''|0) try='int strerror_r(int, char*, int);'
19483         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
19484         esac
19485         case "$strerror_r_proto" in
19486         ''|0) try='char* strerror_r(int, char*, size_t);'
19487         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
19488         esac
19489         case "$strerror_r_proto" in
19490         ''|0)   d_strerror_r=undef
19491                 strerror_r_proto=0
19492                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19493         * )     case "$strerror_r_proto" in
19494                 REENTRANT_PROTO*) ;;
19495                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19496                 esac
19497                 echo "Prototype: $try" ;;
19498         esac
19499         ;;
19500         *)      case "$usethreads" in
19501                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
19502                 esac
19503                 d_strerror_r=undef
19504                 strerror_r_proto=0
19505                 ;;
19506         esac
19507         ;;
19508 *)      strerror_r_proto=0
19509         ;;
19510 esac
19511
19512 : see if strftime exists
19513 set strftime d_strftime
19514 eval $inlibc
19515
19516 : see if strlcat exists
19517 set strlcat d_strlcat
19518 eval $inlibc
19519
19520 : see if strlcpy exists
19521 set strlcpy d_strlcpy
19522 eval $inlibc
19523
19524 : see if strtod exists
19525 set strtod d_strtod
19526 eval $inlibc
19527
19528 : see if strtol exists
19529 set strtol d_strtol
19530 eval $inlibc
19531
19532 : see if strtold exists
19533 set strtold d_strtold
19534 eval $inlibc
19535
19536 : see if strtoll exists
19537 set strtoll d_strtoll
19538 eval $inlibc
19539
19540 case "$d_longlong-$d_strtoll" in
19541 "$define-$define")
19542         $cat <<EOM
19543 Checking whether your strtoll() works okay...
19544 EOM
19545         $cat >try.c <<'EOCP'
19546 #include <errno.h>
19547 #ifdef __hpux
19548 #define strtoll __strtoll
19549 #endif
19550 #ifdef __EMX__
19551 #define strtoll _strtoll
19552 #endif
19553 #include <stdio.h>
19554 extern long long int strtoll(char *s, char **, int);
19555 static int bad = 0;
19556 int check(char *s, long long ell, int een) {
19557         long long gll;
19558         errno = 0;
19559         gll = strtoll(s, 0, 10);
19560         if (!((gll == ell) && (errno == een)))
19561                 bad++;
19562 }
19563 int main() {
19564         check(" 1",                                      1LL, 0);
19565         check(" 0",                                      0LL, 0);
19566         check("-1",                                     -1LL, 0);
19567         check("-9223372036854775808", -9223372036854775808LL, 0);
19568         check("-9223372036854775808", -9223372036854775808LL, 0);
19569         check(" 9223372036854775807",  9223372036854775807LL, 0);
19570         check("-9223372036854775808", -9223372036854775808LL, 0);
19571         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19572         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19573         if (!bad)
19574                 printf("ok\n");
19575 }
19576 EOCP
19577         set try
19578         if eval $compile; then
19579                 yyy=`$run ./try`
19580                 case "$yyy" in
19581                 ok) echo "Your strtoll() seems to be working okay." ;;
19582                 *) cat <<EOM >&4
19583 Your strtoll() doesn't seem to be working okay.
19584 EOM
19585                    d_strtoll="$undef"
19586                    ;;
19587                 esac
19588         else
19589                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19590                 d_strtoll="$undef"
19591         fi
19592         ;;
19593 esac
19594
19595 : see if strtoq exists
19596 set strtoq d_strtoq
19597 eval $inlibc
19598
19599 : see if strtoul exists
19600 set strtoul d_strtoul
19601 eval $inlibc
19602
19603 case "$d_strtoul" in
19604 "$define")
19605         $cat <<EOM
19606 Checking whether your strtoul() works okay...
19607 EOM
19608         $cat >try.c <<'EOCP'
19609 #include <errno.h>
19610 #include <stdio.h>
19611 extern unsigned long int strtoul(char *s, char **, int);
19612 static int bad = 0;
19613 void check(char *s, unsigned long eul, int een) {
19614         unsigned long gul;
19615         errno = 0;
19616         gul = strtoul(s, 0, 10);
19617         if (!((gul == eul) && (errno == een)))
19618                 bad++;
19619 }
19620 int main() {
19621         check(" 1", 1L, 0);
19622         check(" 0", 0L, 0);
19623 EOCP
19624         case "$longsize" in
19625         8)
19626             $cat >>try.c <<'EOCP'
19627         check("18446744073709551615", 18446744073709551615UL, 0);
19628         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19629 #if 0 /* strtoul() for /^-/ strings is undefined. */
19630         check("-1", 18446744073709551615UL, 0);
19631         check("-18446744073709551614", 2, 0);
19632         check("-18446744073709551615", 1, 0);
19633         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19634         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19635 #endif
19636 EOCP
19637                 ;;
19638         4)
19639                     $cat >>try.c <<'EOCP'
19640         check("4294967295", 4294967295UL, 0);
19641         check("4294967296", 4294967295UL, ERANGE);
19642 #if 0 /* strtoul() for /^-/ strings is undefined. */
19643         check("-1", 4294967295UL, 0);
19644         check("-4294967294", 2, 0);
19645         check("-4294967295", 1, 0);
19646         check("-4294967296", 4294967295UL, ERANGE);
19647         check("-4294967297", 4294967295UL, ERANGE);
19648 #endif
19649 EOCP
19650                 ;;
19651         *)
19652 : Should we write these tests to be more portable by sprintf-ing
19653 : ~0 and then manipulating that char string as input for strtol?
19654                 ;;
19655         esac
19656         $cat >>try.c <<'EOCP'
19657         if (!bad)
19658                 printf("ok\n");
19659         return 0;
19660 }
19661 EOCP
19662         set try
19663         if eval $compile; then
19664                 case "`$run ./try`" in
19665                 ok) echo "Your strtoul() seems to be working okay." ;;
19666                 *) cat <<EOM >&4
19667 Your strtoul() doesn't seem to be working okay.
19668 EOM
19669                    d_strtoul="$undef"
19670                    ;;
19671                 esac
19672         else
19673                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19674                 d_strtoul="$undef"
19675         fi
19676         ;;
19677 esac
19678
19679 : see if strtoull exists
19680 set strtoull d_strtoull
19681 eval $inlibc
19682
19683 case "$d_longlong-$d_strtoull" in
19684 "$define-$define")
19685         $cat <<EOM
19686 Checking whether your strtoull() works okay...
19687 EOM
19688         $cat >try.c <<'EOCP'
19689 #include <errno.h>
19690 #ifdef __hpux
19691 #define strtoull __strtoull
19692 #endif
19693 #include <stdio.h>
19694 extern unsigned long long int strtoull(char *s, char **, int);
19695 static int bad = 0;
19696 int check(char *s, long long eull, int een) {
19697         long long gull;
19698         errno = 0;
19699         gull = strtoull(s, 0, 10);
19700         if (!((gull == eull) && (errno == een)))
19701                 bad++;
19702 }
19703 int main() {
19704         check(" 1",                                        1LL, 0);
19705         check(" 0",                                        0LL, 0);
19706         check("18446744073709551615",  18446744073709551615ULL, 0);
19707         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19708 #if 0 /* strtoull() for /^-/ strings is undefined. */
19709         check("-1",                    18446744073709551615ULL, 0);
19710         check("-18446744073709551614",                     2LL, 0);
19711         check("-18446744073709551615",                     1LL, 0);
19712         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19713         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19714 #endif
19715         if (!bad)
19716                 printf("ok\n");
19717 }
19718 EOCP
19719         set try
19720         if eval $compile; then
19721                 case "`$run ./try`" in
19722                 ok) echo "Your strtoull() seems to be working okay." ;;
19723                 *) cat <<EOM >&4
19724 Your strtoull() doesn't seem to be working okay.
19725 EOM
19726                    d_strtoull="$undef"
19727                    ;;
19728                 esac
19729         else
19730                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19731                 d_strtoull="$undef"
19732         fi
19733         ;;
19734 esac
19735
19736 : see if strtouq exists
19737 set strtouq d_strtouq
19738 eval $inlibc
19739
19740 case "$d_strtouq" in
19741 "$define")
19742         $cat <<EOM
19743 Checking whether your strtouq() works okay...
19744 EOM
19745         $cat >try.c <<'EOCP'
19746 #include <errno.h>
19747 #include <stdio.h>
19748 extern unsigned long long int strtouq(char *s, char **, int);
19749 static int bad = 0;
19750 void check(char *s, unsigned long long eull, int een) {
19751         unsigned long long gull;
19752         errno = 0;
19753         gull = strtouq(s, 0, 10);
19754         if (!((gull == eull) && (errno == een)))
19755                 bad++;
19756 }
19757 int main() {
19758         check(" 1",                                        1LL, 0);
19759         check(" 0",                                        0LL, 0);
19760         check("18446744073709551615",  18446744073709551615ULL, 0);
19761         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19762 #if 0 /* strtouq() for /^-/ strings is undefined. */
19763         check("-1",                    18446744073709551615ULL, 0);
19764         check("-18446744073709551614",                     2LL, 0);
19765         check("-18446744073709551615",                     1LL, 0);
19766         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19767         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19768 #endif
19769         if (!bad)
19770                 printf("ok\n");
19771         return 0;
19772 }
19773 EOCP
19774         set try
19775         if eval $compile; then
19776                 case "`$run ./try`" in
19777                 ok) echo "Your strtouq() seems to be working okay." ;;
19778                 *) cat <<EOM >&4
19779 Your strtouq() doesn't seem to be working okay.
19780 EOM
19781                    d_strtouq="$undef"
19782                    ;;
19783                 esac
19784         else
19785                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19786                 d_strtouq="$undef"
19787         fi
19788         ;;
19789 esac
19790
19791 : see if strxfrm exists
19792 set strxfrm d_strxfrm
19793 eval $inlibc
19794
19795 : see if symlink exists
19796 set symlink d_symlink
19797 eval $inlibc
19798
19799 : see if syscall exists
19800 set syscall d_syscall
19801 eval $inlibc
19802
19803 : see if prototype for syscall is available
19804 echo " "
19805 set d_syscallproto syscall $i_unistd unistd.h
19806 eval $hasproto
19807
19808 : see if sysconf exists
19809 set sysconf d_sysconf
19810 eval $inlibc
19811
19812 : see if system exists
19813 set system d_system
19814 eval $inlibc
19815
19816 : see if tcgetpgrp exists
19817 set tcgetpgrp d_tcgetpgrp
19818 eval $inlibc
19819
19820 : see if tcsetpgrp exists
19821 set tcsetpgrp d_tcsetpgrp
19822 eval $inlibc
19823
19824 : see if prototype for telldir is available
19825 echo " "
19826 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19827 eval $hasproto
19828
19829 : see if tgamma exists
19830 set tgamma d_tgamma
19831 eval $inlibc
19832
19833 : see if time exists
19834 echo " "
19835 if test "X$d_time" = X -o X"$timetype" = X; then
19836     if set time val -f d_time; eval $csym; $val; then
19837                 echo 'time() found.' >&4
19838                 val="$define"
19839                 rp="What is the type returned by time() on this system?"
19840                 set time_t timetype long stdio.h sys/types.h
19841                 eval $typedef_ask
19842     else
19843                 echo 'time() not found, hope that will do.' >&4
19844                 val="$undef"
19845                 timetype='int';
19846     fi
19847     set d_time
19848     eval $setvar
19849 fi
19850
19851 : see if timegm exists
19852 set timegm d_timegm
19853 eval $inlibc
19854
19855 : see if this is a sys/times.h system
19856 set sys/times.h i_systimes
19857 eval $inhdr
19858
19859 : see if times exists
19860 echo " "
19861 if set times val -f d_times; eval $csym; $val; then
19862         echo 'times() found.' >&4
19863         d_times="$define"
19864         inc=''
19865         case "$i_systimes" in
19866         "$define") inc='sys/times.h';;
19867         esac
19868         rp="What is the type returned by times() on this system?"
19869         set clock_t clocktype long stdio.h sys/types.h $inc
19870         eval $typedef_ask
19871 else
19872         echo 'times() NOT found, hope that will do.' >&4
19873         d_times="$undef"
19874         clocktype='int'
19875 fi
19876
19877 : see if tmpnam_r exists
19878 set tmpnam_r d_tmpnam_r
19879 eval $inlibc
19880 case "$d_tmpnam_r" in
19881 "$define")
19882         hdrs="$i_systypes sys/types.h define stdio.h "
19883         case "$d_tmpnam_r_proto:$usethreads" in
19884         ":define")      d_tmpnam_r_proto=define
19885                 set d_tmpnam_r_proto tmpnam_r $hdrs
19886                 eval $hasproto ;;
19887         *)      ;;
19888         esac
19889         case "$d_tmpnam_r_proto" in
19890         define)
19891         case "$tmpnam_r_proto" in
19892         ''|0) try='char* tmpnam_r(char*);'
19893         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19894         esac
19895         case "$tmpnam_r_proto" in
19896         ''|0)   d_tmpnam_r=undef
19897                 tmpnam_r_proto=0
19898                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19899         * )     case "$tmpnam_r_proto" in
19900                 REENTRANT_PROTO*) ;;
19901                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19902                 esac
19903                 echo "Prototype: $try" ;;
19904         esac
19905         ;;
19906         *)      case "$usethreads" in
19907                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19908                 esac
19909                 d_tmpnam_r=undef
19910                 tmpnam_r_proto=0
19911                 ;;
19912         esac
19913         ;;
19914 *)      tmpnam_r_proto=0
19915         ;;
19916 esac
19917
19918 : see if trunc exists
19919 set trunc d_trunc
19920 eval $inlibc
19921
19922 : see if truncate exists
19923 set truncate d_truncate
19924 eval $inlibc
19925
19926 : see if ttyname_r exists
19927 set ttyname_r d_ttyname_r
19928 eval $inlibc
19929 case "$d_ttyname_r" in
19930 "$define")
19931         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19932         case "$d_ttyname_r_proto:$usethreads" in
19933         ":define")      d_ttyname_r_proto=define
19934                 set d_ttyname_r_proto ttyname_r $hdrs
19935                 eval $hasproto ;;
19936         *)      ;;
19937         esac
19938         case "$d_ttyname_r_proto" in
19939         define)
19940         case "$ttyname_r_proto" in
19941         ''|0) try='int ttyname_r(int, char*, size_t);'
19942         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19943         esac
19944         case "$ttyname_r_proto" in
19945         ''|0) try='int ttyname_r(int, char*, int);'
19946         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19947         esac
19948         case "$ttyname_r_proto" in
19949         ''|0) try='char* ttyname_r(int, char*, int);'
19950         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19951         esac
19952         case "$ttyname_r_proto" in
19953         ''|0)   d_ttyname_r=undef
19954                 ttyname_r_proto=0
19955                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19956         * )     case "$ttyname_r_proto" in
19957                 REENTRANT_PROTO*) ;;
19958                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19959                 esac
19960                 echo "Prototype: $try" ;;
19961         esac
19962         ;;
19963         *)      case "$usethreads" in
19964                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19965                 esac
19966                 d_ttyname_r=undef
19967                 ttyname_r_proto=0
19968                 ;;
19969         esac
19970         ;;
19971 *)      ttyname_r_proto=0
19972         ;;
19973 esac
19974
19975 : see if tzname[] exists
19976 echo " "
19977 if set tzname val -a d_tzname; eval $csym; $val; then
19978         val="$define"
19979         echo 'tzname[] found.' >&4
19980 else
19981         val="$undef"
19982         echo 'tzname[] NOT found.' >&4
19983 fi
19984 set d_tzname
19985 eval $setvar
19986
19987 : Check if is a multiplatform env
19988 case "$osname" in
19989 darwin) multiarch="$define" ;;
19990 esac
19991 case "$multiarch" in
19992 ''|[nN]*) multiarch="$undef" ;;
19993 esac
19994
19995 : check for ordering of bytes in a UV
19996 echo " "
19997 case "$multiarch" in
19998 *$define*)
19999         $cat <<EOM
20000 You seem to be doing a multiarchitecture build,
20001 skipping the byteorder check.
20002
20003 EOM
20004         byteorder='ffff'
20005         ;;
20006 *)
20007         case "$byteorder" in
20008         '')
20009                 $cat <<'EOM'
20010 In the following, larger digits indicate more significance.  A big-endian
20011 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
20012 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
20013 machines may have weird orders like 3412.  A Cray will report 87654321,
20014 an Alpha will report 12345678. If the test program works the default is
20015 probably right.
20016 I'm now running the test program...
20017 EOM
20018                 $cat >try.c <<EOCP
20019 #include <stdio.h>
20020 #$i_stdlib I_STDLIB
20021 #ifdef I_STDLIB
20022 #include <stdlib.h>
20023 #endif
20024 #include <sys/types.h>
20025 typedef $uvtype UV;
20026 int main()
20027 {
20028         int i;
20029         union {
20030                 UV l;
20031                 char c[$uvsize];
20032         } u;
20033
20034         if ($uvsize > 4)
20035                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
20036         else
20037                 u.l = (UV)0x04030201;
20038         for (i = 0; i < $uvsize; i++)
20039                 printf("%c", u.c[i]+'0');
20040         printf("\n");
20041         exit(0);
20042 }
20043 EOCP
20044                 xxx_prompt=y
20045                 set try
20046                 if eval $compile && $run ./try > /dev/null; then
20047                         dflt=`$run ./try`
20048                         case "$dflt" in
20049                         [1-4][1-4][1-4][1-4]|12345678|87654321)
20050                                 echo "(The test program ran ok.)"
20051                                 echo "byteorder=$dflt"
20052                                 xxx_prompt=n
20053                         ;;
20054                         ????|????????) echo "(The test program ran ok.)" ;;
20055                         *) echo "(The test program didn't run right for some reason.)" ;;
20056                         esac
20057                 else
20058                         dflt='4321'
20059                         cat <<'EOM'
20060 (I can't seem to compile the test program.  Guessing big-endian...)
20061 EOM
20062                 fi
20063                 case "$xxx_prompt" in
20064                 y)
20065                         rp="What is the order of bytes in $uvtype?"
20066                         . ./myread
20067                         byteorder="$ans"
20068                         ;;
20069                 *)      byteorder=$dflt
20070                         ;;
20071                 esac
20072                 ;;
20073         esac
20074         $rm_try
20075         ;;
20076 esac
20077
20078 : Checking 32bit alignedness
20079 $cat <<EOM
20080
20081 Checking to see whether you can access character data unalignedly...
20082 EOM
20083 case "$d_u32align" in
20084 '')   $cat >try.c <<EOCP
20085 #include <stdio.h>
20086 #$i_stdlib I_STDLIB
20087 #ifdef I_STDLIB
20088 #include <stdlib.h>
20089 #endif
20090 #define U32 $u32type
20091 #define BYTEORDER 0x$byteorder
20092 #define U8 $u8type
20093 #include <signal.h>
20094 #ifdef SIGBUS
20095 $signal_t bletch(int s) { exit(4); }
20096 #endif
20097 int main() {
20098 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
20099     volatile U8 buf[8];
20100     volatile U32 *up;
20101     int i;
20102
20103     if (sizeof(U32) != 4) {
20104         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
20105         exit(1);
20106     }
20107
20108     fflush(stdout);
20109
20110 #ifdef SIGBUS
20111     signal(SIGBUS, bletch);
20112 #endif
20113
20114     buf[0] = 0;
20115     buf[1] = 0;
20116     buf[2] = 0;
20117     buf[3] = 1;
20118     buf[4] = 0;
20119     buf[5] = 0;
20120     buf[6] = 0;
20121     buf[7] = 1;
20122
20123     for (i = 0; i < 4; i++) {
20124         up = (U32*)(buf + i);
20125         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
20126                (*up == 1 << (8*(3-i)))  /* little-endian */
20127               )
20128            )
20129         {
20130             printf("read failed (%x)\n", *up);
20131             exit(2);
20132         }
20133     }
20134
20135     /* write test */
20136     for (i = 0; i < 4; i++) {
20137         up = (U32*)(buf + i);
20138         *up = 0xBeef;
20139         if (*up != 0xBeef) {
20140             printf("write failed (%x)\n", *up);
20141             exit(3);
20142         }
20143     }
20144
20145     exit(0);
20146 #else
20147     printf("1\n");
20148     exit(1);
20149 #endif
20150     return 0;
20151 }
20152 EOCP
20153 set try
20154 if eval $compile_ok; then
20155         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
20156         $run ./try 2>&1 >/dev/null
20157         case "$?" in
20158         0)      cat >&4 <<EOM
20159 You can access character data pretty unalignedly.
20160 EOM
20161                 d_u32align="$undef"
20162                 ;;
20163         *)      cat >&4 <<EOM
20164 It seems that you must access character data in an aligned manner.
20165 EOM
20166                 d_u32align="$define"
20167                 ;;
20168         esac
20169 else
20170         rp='Can you access character data at unaligned addresses?'
20171         dflt='n'
20172         . ./myread
20173         case "$ans" in
20174         [yY]*)  d_u32align="$undef"  ;;
20175         *)      d_u32align="$define" ;;
20176         esac
20177 fi
20178 $rm_try
20179 ;;
20180 esac
20181
20182 : see if ualarm exists
20183 set ualarm d_ualarm
20184 eval $inlibc
20185
20186 : see if umask exists
20187 set umask d_umask
20188 eval $inlibc
20189
20190 : see if unordered exists
20191 set unordered d_unordered
20192 eval $inlibc
20193
20194 : see if unsetenv exists
20195 set unsetenv d_unsetenv
20196 eval $inlibc
20197
20198 : see if usleep exists
20199 set usleep d_usleep
20200 eval $inlibc
20201
20202 : see if prototype for usleep is available
20203 echo " "
20204 set d_usleepproto usleep $i_unistd unistd.h
20205 eval $hasproto
20206
20207 : see if ustat exists
20208 set ustat d_ustat
20209 eval $inlibc
20210
20211 : see if closedir exists
20212 set closedir d_closedir
20213 eval $inlibc
20214
20215 case "$d_closedir" in
20216 "$define")
20217         echo " "
20218         echo "Checking whether closedir() returns a status..." >&4
20219         cat > try.c <<EOM
20220 #$i_dirent I_DIRENT             /**/
20221 #$i_sysdir I_SYS_DIR            /**/
20222 #$i_sysndir I_SYS_NDIR          /**/
20223 #$i_systypes I_SYS_TYPES        /**/
20224
20225 #if defined(I_SYS_TYPES)
20226 #include <sys/types.h>
20227 #endif
20228 #if defined(I_DIRENT)
20229 #include <dirent.h>
20230 #else
20231 #ifdef I_SYS_NDIR
20232 #include <sys/ndir.h>
20233 #else
20234 #ifdef I_SYS_DIR
20235 #ifdef hp9000s500
20236 #include <ndir.h>       /* may be wrong in the future */
20237 #else
20238 #include <sys/dir.h>
20239 #endif
20240 #endif
20241 #endif
20242 #endif
20243 int main() { return closedir(opendir(".")); }
20244 EOM
20245         set try
20246         if eval $compile_ok; then
20247                 if $run ./try > /dev/null 2>&1 ; then
20248                         echo "Yes, it does."
20249                         val="$undef"
20250                 else
20251                         echo "No, it doesn't."
20252                         val="$define"
20253                 fi
20254         else
20255                 echo "(I can't seem to compile the test program--assuming it doesn't)"
20256                 val="$define"
20257         fi
20258         ;;
20259 *)
20260         val="$undef";
20261         ;;
20262 esac
20263 set d_void_closedir
20264 eval $setvar
20265 $rm_try
20266
20267 : see if there is a wait4
20268 set wait4 d_wait4
20269 eval $inlibc
20270
20271 : see if waitpid exists
20272 set waitpid d_waitpid
20273 eval $inlibc
20274
20275 : look for wcscmp
20276 echo " "
20277 $cat >try.c <<'EOCP'
20278 #include <stdio.h>
20279 #include <wchar.h>
20280 int main ()
20281 {
20282     wchar_t *s = L" ";
20283     return (wcscmp (s, s) ? 1 : 0);
20284     }
20285 EOCP
20286 set try
20287 val="$undef"
20288 if eval $compile; then
20289     `$run ./try`
20290     case "$?" in
20291         0)  echo "A working wcscmp() found." >&4
20292             val="$define" ;;
20293         *)  echo "wcscmp() found, but it doesn't work" >&4
20294             ;;
20295         esac
20296 else
20297     echo "wcscmp() NOT found." >&4
20298     fi
20299 set d_wcscmp
20300 eval $setvar
20301 $rm_try
20302
20303 : see if wcstombs exists
20304 set wcstombs d_wcstombs
20305 eval $inlibc
20306
20307 : look for wcsxfrm
20308 echo " "
20309 $cat >try.c <<'EOCP'
20310 #include <errno.h>
20311 #include <wchar.h>
20312 int main ()
20313 {
20314     wchar_t dst[4], *src = L" ";
20315     errno = 0;
20316     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
20317     }
20318 EOCP
20319 set try
20320 val="$undef"
20321 if eval $compile; then
20322     `$run ./try`
20323     case "$?" in
20324         0)  echo "A working wcsxfrm() found." >&4
20325             val="$define" ;;
20326         *)  echo "wcsxfrm() found, but it doesn't work" >&4
20327             ;;
20328         esac
20329 else
20330     echo "wcsxfrm() NOT found." >&4
20331     fi
20332 set d_wcsxfrm
20333 eval $setvar
20334 $rm_try
20335
20336 : see if wctomb exists
20337 set wctomb d_wctomb
20338 eval $inlibc
20339
20340 : see if writev exists
20341 set writev d_writev
20342 eval $inlibc
20343
20344 : check for alignment requirements
20345 echo " "
20346 case "$alignbytes" in
20347     '') echo "Checking alignment constraints..." >&4
20348         $cat >try.c <<EOCP
20349 #include <stdio.h>
20350 struct foobar {
20351     char foo;
20352     $nvtype bar;
20353 } try_algn;
20354 int main()
20355 {
20356     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20357     return(0);
20358 }
20359 EOCP
20360         set try
20361         if eval $compile_ok; then
20362             dflt=`$run ./try`
20363         else
20364             dflt='8'
20365             echo "(I can't seem to compile the test program...)"
20366         fi
20367         case "$multiarch" in
20368             *$define*)
20369                 : The usual safe value is 8, but Darwin with -Duselongdouble
20370                 : needs 16.  Hence, we will take 8 as a minimum, but allow
20371                 : Configure to pick a larger value if needed.
20372                 if $test "$dflt" -lt 8; then
20373                     dflt='8'
20374                     echo "Setting alignment to 8 for multiarch support.">&4
20375                 fi
20376                 ;;
20377         esac
20378         ;;
20379     *) dflt="$alignbytes"
20380         ;;
20381 esac
20382 rp="Doubles must be aligned on a how-many-byte boundary?"
20383 . ./myread
20384 alignbytes="$ans"
20385 $rm_try
20386
20387 : set the base revision
20388 baserev=5.0
20389
20390 : length of character in bytes. Is always 1, otherwise it is not C
20391 : This used to be a test using sizeof
20392 charsize=1
20393
20394 : Check for the number of bits in a character
20395 case "$charbits" in
20396 '')     echo "Checking how long a character is (in bits)..." >&4
20397         $cat >try.c <<EOCP
20398 #include <stdio.h>
20399 int main ()
20400 {
20401     int n;
20402     unsigned char c;
20403     for (c = 1, n = 0; c; c <<= 1, n++) ;
20404     printf ("%d\n", n);
20405     return (0);
20406     }
20407 EOCP
20408         set try
20409         if eval $compile_ok; then
20410                 dflt=`$run ./try`
20411         else
20412                 dflt='8'
20413                 echo "(I can't seem to compile the test program.  Guessing...)"
20414         fi
20415         ;;
20416 *)
20417         dflt="$charbits"
20418         ;;
20419 esac
20420 rp="What is the length of a character (in bits)?"
20421 . ./myread
20422 charbits="$ans"
20423 $rm_try
20424 case "$charbits" in
20425 8)      ;;
20426 *)      cat >&4 << EOM
20427 Your system has an unsigned character size of $charbits bits, which
20428 is rather unusual (normally it is 8 bits).  Perl likely will not work
20429 correctly on your system, with subtle bugs in various places.
20430 EOM
20431         rp='Do you really want to continue?'
20432         dflt='n'
20433         . ./myread
20434         case "$ans" in
20435                 [yY])   echo >&4 "Okay, continuing."    ;;
20436                 *)      exit 1                          ;;
20437         esac
20438 esac
20439
20440 : how do we concatenate cpp tokens here?
20441 echo " "
20442 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20443 $cat >cpp_stuff.c <<'EOCP'
20444 #define RCAT(a,b)a/**/b
20445 #define ACAT(a,b)a ## b
20446 RCAT(Rei,ser)
20447 ACAT(Cir,cus)
20448 EOCP
20449 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20450 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20451         echo "Oh!  Smells like ANSI's been here." >&4
20452         echo "We can catify or stringify, separately or together!"
20453         cpp_stuff=42
20454 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20455         echo "Ah, yes!  The good old days!" >&4
20456         echo "However, in the good old days we don't know how to stringify and"
20457         echo "catify at the same time."
20458         cpp_stuff=1
20459 else
20460         $cat >&4 <<EOM
20461 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20462 You're going to have to edit the values of CAT[2-5] in config.h...
20463 EOM
20464         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20465 fi
20466 $rm -f cpp_stuff.*
20467
20468 : see if this is a db.h system
20469 set db.h i_db
20470 eval $inhdr
20471
20472 case "$i_db" in
20473 $define)
20474         : Check db version.
20475         echo " "
20476         echo "Checking Berkeley DB version ..." >&4
20477         $cat >try.c <<EOCP
20478 #$d_const HASCONST
20479 #ifndef HASCONST
20480 #define const
20481 #endif
20482 #include <sys/types.h>
20483 #include <stdio.h>
20484 #$i_stdlib I_STDLIB
20485 #ifdef I_STDLIB
20486 #include <stdlib.h>
20487 #endif
20488 #include <db.h>
20489 int main(int argc, char *argv[])
20490 {
20491 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20492     int Major, Minor, Patch ;
20493     unsigned long Version ;
20494     (void)db_version(&Major, &Minor, &Patch) ;
20495     if (argc == 2) {
20496         printf("%d %d %d %d %d %d\n",
20497                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20498                Major, Minor, Patch);
20499         exit(0);
20500     }
20501     printf("You have Berkeley DB Version 2 or greater.\n");
20502
20503     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20504                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20505     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20506                 Major, Minor, Patch) ;
20507
20508     /* check that db.h & libdb are compatible */
20509     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20510         printf("db.h and libdb are incompatible.\n") ;
20511         exit(3);
20512     }
20513
20514     printf("db.h and libdb are compatible.\n") ;
20515
20516     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20517                 + DB_VERSION_PATCH ;
20518
20519     /* needs to be >= 2.3.4 */
20520     if (Version < 2003004) {
20521     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20522         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20523         exit(2);
20524     }
20525
20526     exit(0);
20527 #else
20528 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20529     if (argc == 2) {
20530         printf("1 0 0\n");
20531         exit(0);
20532     }
20533     printf("You have Berkeley DB Version 1.\n");
20534     exit(0);    /* DB version < 2: the coast is clear. */
20535 #else
20536     exit(1);    /* <db.h> not Berkeley DB? */
20537 #endif
20538 #endif
20539 }
20540 EOCP
20541         set try
20542         if eval $compile_ok && $run ./try; then
20543                 echo 'Looks OK.' >&4
20544                 set `$run ./try 1`
20545                 db_version_major=$1
20546                 db_version_minor=$2
20547                 db_version_patch=$3
20548         else
20549                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20550                 i_db=$undef
20551                 case " $libs " in
20552                 *"-ldb "*)
20553                         : Remove db from list of libraries to use
20554                         echo "Removing unusable -ldb from library list" >&4
20555                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20556                         shift
20557                         libs="$*"
20558                         echo "libs = $libs" >&4
20559                         ;;
20560                 esac
20561         fi
20562         $rm_try
20563         ;;
20564 esac
20565
20566 case "$i_db" in
20567 define)
20568         : Check the return type needed for hash
20569         echo " "
20570         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20571         $cat >try.c <<EOCP
20572 #$d_const HASCONST
20573 #ifndef HASCONST
20574 #define const
20575 #endif
20576 #include <sys/types.h>
20577 #include <db.h>
20578
20579 #ifndef DB_VERSION_MAJOR
20580 u_int32_t hash_cb (const void* ptr, size_t size)
20581 {
20582 }
20583 HASHINFO info;
20584 int main()
20585 {
20586         info.hash = hash_cb;
20587 }
20588 #endif
20589 EOCP
20590         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20591                 if $contains warning try.out >>/dev/null 2>&1 ; then
20592                         db_hashtype='int'
20593                 else
20594                         db_hashtype='u_int32_t'
20595                 fi
20596         else
20597                 : XXX Maybe we should just give up here.
20598                 db_hashtype=u_int32_t
20599                 $cat try.out >&4
20600                 echo "Help:  I can't seem to compile the db test program." >&4
20601                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20602         fi
20603         $rm_try
20604         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20605         ;;
20606 *)      db_hashtype=u_int32_t
20607         ;;
20608 esac
20609 case "$i_db" in
20610 define)
20611         : Check the return type needed for prefix
20612         echo " "
20613         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20614         cat >try.c <<EOCP
20615 #$d_const HASCONST
20616 #ifndef HASCONST
20617 #define const
20618 #endif
20619 #include <sys/types.h>
20620 #include <db.h>
20621
20622 #ifndef DB_VERSION_MAJOR
20623 size_t prefix_cb (const DBT *key1, const DBT *key2)
20624 {
20625 }
20626 BTREEINFO info;
20627 int main()
20628 {
20629         info.prefix = prefix_cb;
20630 }
20631 #endif
20632 EOCP
20633         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20634                 if $contains warning try.out >>/dev/null 2>&1 ; then
20635                         db_prefixtype='int'
20636                 else
20637                         db_prefixtype='size_t'
20638                 fi
20639         else
20640                 db_prefixtype='size_t'
20641                 : XXX Maybe we should just give up here.
20642                 $cat try.out >&4
20643                 echo "Help:  I can't seem to compile the db test program." >&4
20644                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20645         fi
20646         $rm_try
20647         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20648         ;;
20649 *)      db_prefixtype='size_t'
20650         ;;
20651 esac
20652
20653 : Include . in @INC
20654 $cat <<EOM
20655
20656 Historically Perl has provided a final fallback of the current working
20657 directory '.' when searching for a library. This, however, can lead to
20658 problems when a Perl program which loads optional modules is called from
20659 a shared directory. This can lead to executing unexpected code.
20660
20661 EOM
20662
20663 # When changing to exclude by default:
20664 case "$default_inc_excludes_dot" in
20665     $undef|false|[nN]*) dflt="n" ;;
20666     *)                  dflt="y" ;;
20667 esac
20668 # To turn exclude off by default:
20669 #case "$default_inc_excludes_dot" in
20670 #    $define|true|[yY]*) dflt="y" ;;
20671 #    *)                  dflt="n" ;;
20672 #esac
20673
20674 rp='Exclude '.' from @INC by default? '
20675 . ./myread
20676 case "$ans" in
20677     [nN]|undef) default_inc_excludes_dot="$undef"  ;;
20678     *)          default_inc_excludes_dot="$define" ;;
20679 esac
20680
20681 : Check what kind of inf/nan your system has
20682 $echo "Checking the kind of infinities and nans you have..." >&4
20683 $echo "(The following tests may crash.  That's okay.)" >&4
20684 $cat >try.c <<EOP
20685 #define DOUBLESIZE $doublesize
20686 #$d_longdbl HAS_LONG_DOUBLE
20687 #ifdef HAS_LONG_DOUBLE
20688 #define LONG_DOUBLESIZE $longdblsize
20689 #define LONG_DOUBLEKIND $longdblkind
20690 #endif
20691 #$i_math I_MATH
20692 #$i_string I_STRING
20693 #ifdef I_MATH
20694 #include <math.h>
20695 #endif
20696 #ifdef I_STRING
20697 #  include <string.h>
20698 #endif
20699 #include <stdio.h>
20700 /* Note that whether the sign bit is on or off
20701  * for NaN depends on the CPU/FPU, and possibly
20702  * can be affected by the build toolchain.
20703  *
20704  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20705  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20706  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20707  * (respectively) as opposed to the more usual
20708  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20709  *
20710  * Pre-IEEE-754 floating point format do not even have inf/nan support
20711  * at all.  They might have a "max" value (DBL_MAX), which may be deadly
20712  * to even mention, causing immediate SIGFPE or equivalent: this is
20713  * the case with VAX floating point, for example.
20714  */
20715 static void bytes(void *v, unsigned int n) {
20716   unsigned char *p = (unsigned char *)v;
20717   int i;
20718   for (i = 0; i < n; i++) {
20719     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20720   }
20721 }
20722 int main(int argc, char *argv[]) {
20723    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20724     * because some compilers are 'smart' and not only warn but refuse to
20725     * compile such 'illegal' values. */
20726    double dinf = exp(1e9);
20727    double dnan = sqrt(-1.0);
20728 #ifdef HAS_LONG_DOUBLE
20729    long double ldinf = (long double)exp(1e9);
20730    long double ldnan = (long double)sqrt(-1.0);
20731 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20732 /* the 80-bit long doubles might have garbage in their excess bytes */
20733     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20734     memset((char *)&ldnan + 10, '\0', LONG_DOUBLESIZE - 10);
20735 # endif
20736   if (argc == 2) {
20737     switch (argv[1][0]) {
20738     case '1': bytes(&dinf, sizeof(dinf)); break;
20739     case '2': bytes(&dnan, sizeof(dnan)); break;
20740     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20741     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20742 #endif
20743     }
20744   }
20745   return 0;
20746 }
20747 EOP
20748 set try
20749 if eval $compile; then
20750     doubleinfbytes=`$run ./try 1`
20751     doublenanbytes=`$run ./try 2`
20752     case "$d_longdbl" in
20753     $define)
20754       longdblinfbytes=`$run ./try 3`
20755       longdblnanbytes=`$run ./try 4`
20756       ;;
20757     esac
20758 else
20759     # Defaults in case the above test program failed.
20760     case "$doublekind" in
20761     1) # IEEE 754 32-bit LE
20762        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20763        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20764        ;;
20765     2) # IEEE 754 32-bit BE
20766        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20767        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20768        ;;
20769     3) # IEEE 754 64-bit LE
20770        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20771        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20772        ;;
20773     4) # IEEE 754 64-bit BE
20774        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20775        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20776        ;;
20777     5) # IEEE 754 128-bit LE
20778        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20779        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20780        ;;
20781     6) # IEEE 754 128-bit BE
20782        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20783        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20784        ;;
20785     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20786        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20787        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20788        ;;
20789     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20790        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20791        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20792        ;;
20793     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20794        doubleinfbytes=$undef
20795        doublenanbytes=$undef
20796        ;;
20797     *) # No idea.
20798        doubleinfbytes=$undef
20799        doublenanbytes=$undef
20800        ;;
20801     esac
20802     case "$longdblkind" in
20803     1) # IEEE 754 128-bit LE
20804        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20805        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20806        ;;
20807     2) # IEEE 754 128-bit BE
20808        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20809        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20810        ;;
20811     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20812        case "$longdblsize" in
20813        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20814            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20815            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20816            ;;
20817        16) # x86_64
20818            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20819            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20820            ;;
20821        *)  # No idea.
20822            longdblinfbytes=$undef
20823            longdblnanbytes=$undef
20824        ;;
20825        esac
20826        ;;
20827     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20828        case "$longdblsize" in
20829        12) # 32-bit system
20830            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20831            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20832            ;;
20833        16) # 64-bit system
20834            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20835            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20836            ;;
20837        *)  # No idea.
20838            longdblinfbytes=$undef
20839            longdblnanbytes=$undef
20840        ;;
20841        esac
20842        ;;
20843     5) # 128-bit LE-LE "double double"
20844        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20845        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20846        ;;
20847     6) # 128-bit BE-BE "double double"
20848        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20849        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20850        ;;
20851     7) # 128-bit LE-BE "double double"
20852        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20853        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20854        ;;
20855     8) # 128-bit BE-LE "double double"
20856        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20857        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20858        ;;
20859     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20860        longdblinfbytes=$undef
20861        longdblnanbytes=$undef
20862        ;;
20863     *) # No idea.
20864        longdblinfbytes=$undef
20865        longdblnanbytes=$undef
20866        ;;
20867     esac
20868 fi
20869 # In case the program crashed the values are empty, turn them undef.
20870 case "$doubleinfbytes" in
20871 '') doubleinfbytes=$undef ;;
20872 esac
20873 case "$doublenanbytes" in
20874 '') doublenanbytes=$undef ;;
20875 esac
20876 case "$longdblinfbytes" in
20877 '') longdblinfbytes=$undef ;;
20878 esac
20879 case "$longdblnanbytes" in
20880 '') longdblnanbytes=$undef ;;
20881 esac
20882 $rm_try
20883
20884 : Check the length of the double mantissa
20885 $echo "Checking how many mantissa bits your doubles have..." >&4
20886 $cat >try.c <<EOP
20887 #$i_float I_FLOAT
20888 #$i_sunmath I_SUNMATH
20889 #ifdef I_FLOAT
20890 # include <float.h>
20891 #endif
20892 #ifdef I_SUNMATH
20893 # include <sunmath.h>
20894 #endif
20895 #ifdef DBL_MANT_DIG
20896 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20897 #endif
20898 #include <stdio.h>
20899 int main(int argc, char *argv[]) {
20900 #ifdef BITS
20901   printf("%d\n", BITS);
20902 #endif
20903   return 0;
20904 }
20905 EOP
20906 set try
20907 if eval $compile; then
20908     doublemantbits=`$run ./try`
20909 else
20910     doublemantbits="$undef"
20911 fi
20912 $rm_try
20913
20914 : Check the length of the longdouble mantissa
20915 $echo "Checking how many mantissa bits your long doubles have..." >&4
20916 $cat >try.c <<EOP
20917 #$i_float I_FLOAT
20918 #$i_sunmath I_SUNMATH
20919 #ifdef I_FLOAT
20920 # include <float.h>
20921 #endif
20922 #ifdef I_SUNMATH
20923 # include <sunmath.h>
20924 #endif
20925 #$d_longdbl HAS_LONG_DOUBLE
20926 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20927 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20928 /* This format has no implicit bit.  Beware, however, that for
20929  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20930  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20931  * and the top bit must have been one since 387, zero is plain invalid.
20932  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20933 #  define BITS LDBL_MANT_DIG
20934 # elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
20935 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20936  * reason e.g. Irix thinks 107.  But in any case, we want only
20937  * the number of real bits, the implicit bits are of no interest.  */
20938 #  define BITS 2 * (DBL_MANT_DIG - 1)
20939 # else
20940 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20941 # endif
20942 #endif
20943 #include <stdio.h>
20944 int main(int argc, char *argv[]) {
20945 #ifdef BITS
20946   printf("%d\n", BITS);
20947 #endif
20948   return 0;
20949 }
20950 EOP
20951 set try
20952 if eval $compile; then
20953     longdblmantbits=`$run ./try`
20954 else
20955     longdblmantbits="$undef"
20956 fi
20957 $rm_try
20958
20959 : Check the length of the NV mantissa
20960 $echo "Checking how many mantissa bits your NVs have..." >&4
20961 if test "X$usequadmath" = "X$define"; then
20962   nvmantbits=112 # 128-1-15
20963 else
20964   if test "X$nvsize" = "X$doublesize"; then
20965     nvmantbits="$doublemantbits"
20966   else
20967      if test "X$nvsize" = "X$longdblsize"; then
20968        nvmantbits="$longdblmantbits"
20969      else
20970        nvmantbits="$undef"
20971      fi
20972   fi
20973 fi
20974
20975 : How can we generate normalized random numbers ?
20976 echo " "
20977 echo "Using our internal random number implementation..." >&4
20978
20979 case "$ccflags" in
20980 *-Dmy_rand=*|*-Dmy_srand=*)
20981         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20982         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20983         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20984         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20985         ;;
20986 esac
20987
20988 randfunc=Perl_drand48
20989 drand01="Perl_drand48()"
20990 seedfunc="Perl_drand48_init"
20991 randbits=48
20992 randseedtype=U32
20993
20994 : Probe whether dtrace builds an object, as newer Illumos requires an input
20995 : object file that uses at least one of the probes defined in the .d file
20996 case "$usedtrace" in
20997 $define)
20998     case "$dtracexnolibs" in
20999     $define|true|[yY]*)
21000         dtracexnolibs=$define
21001         $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h
21002         ;;
21003     ' '|'')
21004         if $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
21005              dtracexnolibs=$define
21006              echo "Your dtrace accepts -xnolibs"
21007         elif $dtrace -h -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
21008              dtracexnolibs=$undef
21009              echo "Your dtrace doesn't accept -xnolibs"
21010         else
21011              echo "Your dtrace doesn't work at all, try building without dtrace support" >&4
21012              exit 1
21013         fi
21014         ;;
21015     *)
21016         dtracexnolibs=$undef
21017         $dtrace -h -s ../perldtrace.d -o perldtrace.h
21018         ;;
21019     esac
21020     case $dtracexnolibs in
21021     $define) xnolibs=-xnolibs ;;
21022     *) xnolibs= ;;
21023     esac
21024
21025     case "$dtraceobject" in
21026     $define|true|[yY]*)
21027         dtraceobject=$define
21028         ;;
21029     ' '|'')
21030         $cat >try.c <<EOM
21031 #include "perldtrace.h"
21032 int main(void) {
21033     PERL_LOADED_FILE("dummy");
21034     return 0;
21035 }
21036 EOM
21037         dtraceobject=$undef
21038         if $cc -c -o try.o $optimize $ccflags try.c \
21039                     && $dtrace -G $xnolibs -s ../perldtrace.d try.o >/dev/null 2>&1; then
21040                 dtraceobject=$define
21041             echo "Your dtrace builds an object file"
21042         fi
21043         ;;
21044     *) dtraceobject=$undef ;;
21045     esac
21046     $rm_try perldtrace.o perldtrace.h
21047 esac
21048
21049 : Determine if this is an EBCDIC system
21050 echo " "
21051 echo "Determining whether or not we are on an EBCDIC system..." >&4
21052 $cat >try.c <<'EOM'
21053 int main()
21054 {
21055   if ('M'==0xd4) return 0;
21056   return 1;
21057 }
21058 EOM
21059
21060 val=$undef
21061 set try
21062 if eval $compile_ok; then
21063         if $run ./try; then
21064                 echo "You seem to speak EBCDIC." >&4
21065                 val="$define"
21066         else
21067                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
21068         fi
21069 else
21070         echo "I'm unable to compile the test program." >&4
21071         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
21072 fi
21073 $rm_try
21074 set ebcdic
21075 eval $setvar
21076
21077 : Check how to flush
21078 echo " "
21079 $cat >&4 <<EOM
21080 Checking how to flush all pending stdio output...
21081 EOM
21082 # I only know how to find the first 32 possibly open files on SunOS.
21083 # See also hints/sunos_4_1.sh and util.c  --AD
21084 case "$osname" in
21085 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
21086 esac
21087 $cat >>try.c <<EOCP
21088 #include <stdio.h>
21089 #$i_stdlib I_STDLIB
21090 #ifdef I_STDLIB
21091 #include <stdlib.h>
21092 #endif
21093 #$i_unistd I_UNISTD
21094 #ifdef I_UNISTD
21095 # include <unistd.h>
21096 #endif
21097 #$d_sysconf HAS_SYSCONF
21098 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
21099 #ifdef HAS_STDIO_STREAM_ARRAY
21100 # define STDIO_STREAM_ARRAY $stdio_stream_array
21101 #endif
21102 int main() {
21103   FILE* p;
21104   unlink("try.out");
21105   p = fopen("try.out", "w");
21106 #ifdef TRY_FPUTC
21107   fputc('x', p);
21108 #else
21109 # ifdef TRY_FPRINTF
21110   fprintf(p, "x");
21111 # endif
21112 #endif
21113 #ifdef TRY_FFLUSH_NULL
21114   fflush(NULL);
21115 #endif
21116 #ifdef TRY_FFLUSH_ALL
21117   {
21118     long open_max = -1;
21119 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
21120     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
21121 # else
21122 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
21123     open_max = sysconf(_SC_OPEN_MAX);
21124 #  else
21125 #   ifdef FOPEN_MAX
21126     open_max = FOPEN_MAX;
21127 #   else
21128 #    ifdef OPEN_MAX
21129     open_max = OPEN_MAX;
21130 #    else
21131 #     ifdef _NFILE
21132     open_max = _NFILE;
21133 #     endif
21134 #    endif
21135 #   endif
21136 #  endif
21137 # endif
21138 # ifdef HAS_STDIO_STREAM_ARRAY
21139     if (open_max > 0) {
21140       long i;
21141       for (i = 0; i < open_max; i++)
21142             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
21143                 STDIO_STREAM_ARRAY[i]._file < open_max &&
21144                 STDIO_STREAM_ARRAY[i]._flag)
21145                 fflush(&STDIO_STREAM_ARRAY[i]);
21146     }
21147   }
21148 # endif
21149 #endif
21150   _exit(42);
21151 }
21152 EOCP
21153 : first we have to find out how _not_ to flush
21154 $to try.c
21155 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
21156     output=''
21157     set try -DTRY_FPUTC
21158     if eval $compile; then
21159             $run ./try 2>/dev/null
21160             code="$?"
21161             $from try.out
21162             if $test ! -s try.out -a "X$code" = X42; then
21163                 output=-DTRY_FPUTC
21164             fi
21165     fi
21166     case "$output" in
21167     '')
21168             set try -DTRY_FPRINTF
21169             if eval $compile; then
21170                     $run ./try 2>/dev/null
21171                     code="$?"
21172                     $from try.out
21173                     if $test ! -s try.out -a "X$code" = X42; then
21174                         output=-DTRY_FPRINTF
21175                     fi
21176             fi
21177         ;;
21178     esac
21179 fi
21180 : check for fflush NULL behavior
21181 case "$fflushNULL" in
21182 '')     set try -DTRY_FFLUSH_NULL $output
21183         if eval $compile; then
21184                 $run ./try 2>/dev/null
21185                 code="$?"
21186                 $from try.out
21187                 if $test -s try.out -a "X$code" = X42; then
21188                         fflushNULL="`$cat try.out`"
21189                 else
21190                         if $test "X$code" != X42; then
21191                                 $cat >&4 <<EOM
21192 (If this test failed, don't worry, we'll try another method shortly.)
21193 EOM
21194                         fi
21195                 fi
21196         fi
21197         $rm -f core try.core core.try.*
21198         case "$fflushNULL" in
21199         x)      $cat >&4 <<EOM
21200 Your fflush(NULL) works okay for output streams.
21201 Let's see if it clobbers input pipes...
21202 EOM
21203 # As of mid-March 2000 all versions of Solaris appear to have a stdio
21204 # bug that improperly flushes the input end of pipes.  So we avoid the
21205 # autoflush on fork/system/exec support for now. :-(
21206 $cat >tryp.c <<EOCP
21207 #include <stdio.h>
21208 int
21209 main(int argc, char **argv)
21210 {
21211     char buf[1024];
21212     int i;
21213     char *bp = buf;
21214     while (1) {
21215         while ((i = getc(stdin)) != -1
21216                && (*bp++ = i) != '\n'
21217                && bp < &buf[1024])
21218         /* DO NOTHING */ ;
21219         *bp = '\0';
21220         fprintf(stdout, "%s", buf);
21221         fflush(NULL);
21222         if (i == -1)
21223             return 0;
21224         bp = buf;
21225     }
21226 }
21227 EOCP
21228                 fflushNULL="$define"
21229                 set tryp
21230                 if eval $compile; then
21231                     $rm -f tryp.out
21232                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
21233                     if $test "X$targethost" != X; then
21234                         $to tryp.c
21235                         $to tryp
21236                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
21237                     else
21238                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
21239                     fi
21240                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
21241                        $cat >&4 <<EOM
21242 fflush(NULL) seems to behave okay with input streams.
21243 EOM
21244                         fflushNULL="$define"
21245                     else
21246                         $cat >&4 <<EOM
21247 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
21248 EOM
21249                         fflushNULL="$undef"
21250                     fi
21251                 fi
21252                 $rm -f core tryp.c tryp.core core.tryp.*
21253                 ;;
21254         '')     $cat >&4 <<EOM
21255 Your fflush(NULL) isn't working (contrary to ANSI C).
21256 EOM
21257                 fflushNULL="$undef"
21258                 ;;
21259         *)      $cat >&4 <<EOM
21260 Cannot figure out whether your fflush(NULL) works or not.
21261 I'm assuming it doesn't (contrary to ANSI C).
21262 EOM
21263                 fflushNULL="$undef"
21264                 ;;
21265         esac
21266         ;;
21267 $define|true|[yY]*)
21268         fflushNULL="$define"
21269         ;;
21270 *)
21271         fflushNULL="$undef"
21272         ;;
21273 esac
21274 : check explicit looping only if NULL did not work, and if the pipe
21275 : bug does not show up on an explicit flush too
21276 case "$fflushNULL" in
21277 "$undef")
21278         $cat >tryp.c <<EOCP
21279 #include <stdio.h>
21280 int
21281 main(int argc, char **argv)
21282 {
21283     char buf[1024];
21284     int i;
21285     char *bp = buf;
21286     while (1) {
21287         while ((i = getc(stdin)) != -1
21288                && (*bp++ = i) != '\n'
21289                && bp < &buf[1024])
21290         /* DO NOTHING */ ;
21291         *bp = '\0';
21292         fprintf(stdout, "%s", buf);
21293         fflush(stdin);
21294         if (i == -1)
21295             return 0;
21296         bp = buf;
21297     }
21298 }
21299 EOCP
21300         set tryp
21301         if eval $compile; then
21302             $rm -f tryp.out
21303             if $test "X$targethost" != X; then
21304                 $to tryp.c
21305                 $to tryp
21306                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
21307             else
21308                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
21309             fi
21310             if cmp tryp.c tryp.out >/dev/null 2>&1; then
21311                $cat >&4 <<EOM
21312 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
21313 EOM
21314                 : now check for fflushall behaviour
21315                 case "$fflushall" in
21316                 '')     set try -DTRY_FFLUSH_ALL $output
21317                         if eval $compile; then
21318                                 $cat >&4 <<EOM
21319 (Now testing the other method--but note that this also may fail.)
21320 EOM
21321                                 $run ./try 2>/dev/null
21322                                 code=$?
21323                                 $from try.out
21324                                 if $test -s try.out -a "X$code" = X42; then
21325                                         fflushall="`$cat try.out`"
21326                                 fi
21327                         fi
21328                         $rm_try
21329                         case "$fflushall" in
21330                         x)      $cat >&4 <<EOM
21331 Whew. Flushing explicitly all the stdio streams works.
21332 EOM
21333                                 fflushall="$define"
21334                                 ;;
21335                         '')     $cat >&4 <<EOM
21336 Sigh. Flushing explicitly all the stdio streams doesn't work.
21337 EOM
21338                                 fflushall="$undef"
21339                                 ;;
21340                         *)      $cat >&4 <<EOM
21341 Cannot figure out whether flushing stdio streams explicitly works or not.
21342 I'm assuming it doesn't.
21343 EOM
21344                                 fflushall="$undef"
21345                                 ;;
21346                         esac
21347                         ;;
21348                 "$define"|true|[yY]*)
21349                         fflushall="$define"
21350                         ;;
21351                 *)
21352                         fflushall="$undef"
21353                         ;;
21354                 esac
21355             else
21356                 $cat >&4 <<EOM
21357 All is futile.  Even fflush(stdin) clobbers input pipes!
21358 EOM
21359                 fflushall="$undef"
21360             fi
21361         else
21362             fflushall="$undef"
21363         fi
21364         $rm -f core tryp.c tryp.core core.tryp.*
21365         ;;
21366 *)      fflushall="$undef"
21367         ;;
21368 esac
21369
21370 case "$fflushNULL$fflushall" in
21371 undefundef)
21372         $cat <<EOM
21373 OK, I give up.  I cannot figure out how to flush pending stdio output.
21374 We won't be flushing handles at all before fork/exec/popen.
21375 EOM
21376         ;;
21377 esac
21378 $rm_try tryp
21379
21380 : Store the full pathname to the ar program for use in the C program
21381 : Respect a hint or command line value for full_ar.
21382 case "$full_ar" in
21383 '') full_ar=$ar ;;
21384 esac
21385
21386 : Store the full pathname to the sed program for use in the C program
21387 full_sed=$sed
21388
21389 : see what type gids are declared as in the kernel
21390 echo " "
21391 echo "Looking for the type for group ids returned by getgid()."
21392 set gid_t gidtype xxx stdio.h sys/types.h
21393 eval $typedef
21394 case "$gidtype" in
21395 xxx)
21396         xxx=`./findhdr sys/user.h`
21397         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
21398         case $1 in
21399         unsigned) dflt="$1 $2" ;;
21400         *) dflt="$1" ;;
21401         esac
21402         ;;
21403 *) dflt="$gidtype";;
21404 esac
21405 case "$gidtype" in
21406 gid_t) echo "gid_t found." ;;
21407 *)      rp="What is the type for group ids returned by getgid()?"
21408         . ./myread
21409         gidtype="$ans"
21410         ;;
21411 esac
21412
21413 : Check the size of GID
21414 echo " "
21415 case "$gidtype" in
21416 *_t) zzz="$gidtype"     ;;
21417 *)   zzz="gid"          ;;
21418 esac
21419 echo "Checking the size of $zzz..." >&4
21420 cat > try.c <<EOCP
21421 #include <sys/types.h>
21422 #include <stdio.h>
21423 #$i_stdlib I_STDLIB
21424 #ifdef I_STDLIB
21425 #include <stdlib.h>
21426 #endif
21427 int main() {
21428     printf("%d\n", (int)sizeof($gidtype));
21429     exit(0);
21430 }
21431 EOCP
21432 set try
21433 if eval $compile_ok; then
21434         yyy=`$run ./try`
21435         case "$yyy" in
21436         '')     gidsize=4
21437                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
21438                 ;;
21439         *)      gidsize=$yyy
21440                 echo "Your $zzz is $gidsize bytes long."
21441                 ;;
21442         esac
21443 else
21444         gidsize=4
21445         echo "(I can't compile the test program--guessing $gidsize.)" >&4
21446 fi
21447
21448
21449 : Check if GID is signed
21450 echo " "
21451 case "$gidtype" in
21452 *_t) zzz="$gidtype"     ;;
21453 *)   zzz="gid"          ;;
21454 esac
21455 echo "Checking the sign of $zzz..." >&4
21456 cat > try.c <<EOCP
21457 #include <sys/types.h>
21458 #include <stdio.h>
21459 int main() {
21460         $gidtype foo = -1;
21461         if (foo < 0)
21462                 printf("-1\n");
21463         else
21464                 printf("1\n");
21465 }
21466 EOCP
21467 set try
21468 if eval $compile; then
21469         yyy=`$run ./try`
21470         case "$yyy" in
21471         '')     gidsign=1
21472                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21473                 ;;
21474         *)      gidsign=$yyy
21475                 case "$gidsign" in
21476                  1) echo "Your $zzz is unsigned." ;;
21477                 -1) echo "Your $zzz is signed."   ;;
21478                 esac
21479                 ;;
21480         esac
21481 else
21482         gidsign=1
21483         echo "(I can't compile the test program--guessing unsigned.)" >&4
21484 fi
21485
21486
21487 : Check 64bit sizes
21488 echo " "
21489
21490 if $test X"$quadtype" != X; then
21491
21492 echo "Checking how to print 64-bit integers..." >&4
21493
21494 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21495         $cat >try.c <<'EOCP'
21496 #include <sys/types.h>
21497 #include <stdio.h>
21498 int main() {
21499   int q = 12345678901;
21500   printf("%ld\n", q);
21501 }
21502 EOCP
21503         set try
21504         if eval $compile; then
21505                 yyy=`$run ./try`
21506                 case "$yyy" in
21507                 12345678901)
21508                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21509                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21510                         echo "We will use %d."
21511                         ;;
21512                 esac
21513         fi
21514 fi
21515
21516 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21517         $cat >try.c <<'EOCP'
21518 #include <sys/types.h>
21519 #include <stdio.h>
21520 int main() {
21521   long q = 12345678901;
21522   printf("%ld\n", q);
21523 }
21524 EOCP
21525         set try
21526         if eval $compile; then
21527                 yyy=`$run ./try`
21528                 case "$yyy" in
21529                 12345678901)
21530                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21531                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21532                         echo "We will use %ld."
21533                         ;;
21534                 esac
21535         fi
21536 fi
21537
21538 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21539         $cat >try.c <<'EOCP'
21540 #include <sys/types.h>
21541 #include <inttypes.h>
21542 #include <stdio.h>
21543 int main() {
21544   int64_t q = 12345678901;
21545   printf("%" PRId64 "\n", q);
21546 }
21547 EOCP
21548         set try
21549         if eval $compile; then
21550                 yyy=`$run ./try`
21551                 case "$yyy" in
21552                 12345678901)
21553                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21554                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
21555                         echo "We will use the C9X style."
21556                         ;;
21557                 esac
21558         fi
21559 fi
21560
21561 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21562         $cat >try.c <<EOCP
21563 #include <sys/types.h>
21564 #include <stdio.h>
21565 int main() {
21566   $quadtype q = 12345678901;
21567   printf("%Ld\n", q);
21568 }
21569 EOCP
21570         set try
21571         if eval $compile; then
21572                 yyy=`$run ./try`
21573                 case "$yyy" in
21574                 12345678901)
21575                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21576                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21577                         echo "We will use %Ld."
21578                         ;;
21579                 esac
21580         fi
21581 fi
21582
21583 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21584         $cat >try.c <<'EOCP'
21585 #include <sys/types.h>
21586 #include <stdio.h>
21587 int main() {
21588   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21589   printf("%lld\n", q);
21590 }
21591 EOCP
21592         set try
21593         if eval $compile; then
21594                 yyy=`$run ./try`
21595                 case "$yyy" in
21596                 12345678901)
21597                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21598                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21599                         echo "We will use the %lld style."
21600                         ;;
21601                 esac
21602         fi
21603 fi
21604
21605 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21606         $cat >try.c <<EOCP
21607 #include <sys/types.h>
21608 #include <stdio.h>
21609 int main() {
21610   $quadtype q = 12345678901;
21611   printf("%qd\n", q);
21612 }
21613 EOCP
21614         set try
21615         if eval $compile; then
21616                 yyy=`$run ./try`
21617                 case "$yyy" in
21618                 12345678901)
21619                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21620                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21621                         echo "We will use %qd."
21622                         ;;
21623                 esac
21624         fi
21625 fi
21626
21627 if $test X"$sPRId64" = X; then
21628         echo "Cannot figure out how to print 64-bit integers." >&4
21629 fi
21630 $rm_try
21631
21632 fi
21633
21634 case "$sPRId64" in
21635 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21636         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21637         ;;
21638 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21639         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21640         ;;
21641 esac
21642
21643 : Check format strings for internal types
21644 echo " "
21645 $echo "Checking the format strings to be used for Perl's internal types..." >&4
21646
21647 if $test X"$ivsize" = X8; then
21648         ivdformat="$sPRId64"
21649         uvuformat="$sPRIu64"
21650         uvoformat="$sPRIo64"
21651         uvxformat="$sPRIx64"
21652         uvXUformat="$sPRIXU64"
21653 else
21654         if $test X"$ivsize" = X"$longsize"; then
21655                 ivdformat='"ld"'
21656                 uvuformat='"lu"'
21657                 uvoformat='"lo"'
21658                 uvxformat='"lx"'
21659                 uvXUformat='"lX"'
21660         else
21661                 if $test X"$ivsize" = X"$intsize"; then
21662                         ivdformat='"d"'
21663                         uvuformat='"u"'
21664                         uvoformat='"o"'
21665                         uvxformat='"x"'
21666                         uvXUformat='"X"'
21667                 else
21668                         : far out
21669                         if $test X"$ivsize" = X"$shortsize"; then
21670                                 ivdformat='"hd"'
21671                                 uvuformat='"hu"'
21672                                 uvoformat='"ho"'
21673                                 uvxformat='"hx"'
21674                                 uvXUformat='"hX"'
21675                         fi
21676                 fi
21677         fi
21678 fi
21679
21680 if $test X"$usequadmath" = X"$define"; then
21681     nveformat='"Qe"'
21682     nvfformat='"Qf"'
21683     nvgformat='"Qg"'
21684     nvEUformat='"QE"'
21685     nvFUformat='"QF"'
21686     nvGUformat='"QG"'
21687 else
21688     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21689         nveformat="$sPRIeldbl"
21690         nvfformat="$sPRIfldbl"
21691         nvgformat="$sPRIgldbl"
21692         nvEUformat="$sPRIEUldbl"
21693         nvFUformat="$sPRIFUldbl"
21694         nvGUformat="$sPRIGUldbl"
21695     else
21696         nveformat='"e"'
21697         nvfformat='"f"'
21698         nvgformat='"g"'
21699         nvEUformat='"E"'
21700         nvFUformat='"F"'
21701         nvGUformat='"G"'
21702     fi
21703 fi
21704
21705 case "$ivdformat" in
21706 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21707     exit 1
21708     ;;
21709 esac
21710
21711 : Check format string for GID
21712
21713 echo " "
21714 $echo "Checking the format string to be used for gids..." >&4
21715
21716 case "$gidsign" in
21717 -1)     if $test X"$gidsize" = X"$ivsize"; then
21718                 gidformat="$ivdformat"
21719         else
21720                 if $test X"$gidsize" = X"$longsize"; then
21721                         gidformat='"ld"'
21722                 else
21723                         if $test X"$gidsize" = X"$intsize"; then
21724                                 gidformat='"d"'
21725                         else
21726                                 if $test X"$gidsize" = X"$shortsize"; then
21727                                         gidformat='"hd"'
21728                                 fi
21729                         fi
21730                 fi
21731         fi
21732         ;;
21733 *)      if $test X"$gidsize" = X"$uvsize"; then
21734                 gidformat="$uvuformat"
21735         else
21736                 if $test X"$gidsize" = X"$longsize"; then
21737                         gidformat='"lu"'
21738                 else
21739                         if $test X"$gidsize" = X"$intsize"; then
21740                                 gidformat='"u"'
21741                         else
21742                                 if $test X"$gidsize" = X"$shortsize"; then
21743                                         gidformat='"hu"'
21744                                 fi
21745                         fi
21746                 fi
21747         fi
21748         ;;
21749 esac
21750
21751 : see if getgroups exists
21752 set getgroups d_getgrps
21753 eval $inlibc
21754
21755 : see if setgroups exists
21756 set setgroups d_setgrps
21757 eval $inlibc
21758
21759 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21760 echo " "
21761 case "$d_getgrps$d_setgrps" in
21762 *define*)
21763         case "$groupstype" in
21764         '') dflt="$gidtype" ;;
21765         *)  dflt="$groupstype" ;;
21766         esac
21767         $cat <<EOM
21768 What type of pointer is the second argument to getgroups() and setgroups()?
21769 Usually this is the same as group ids, $gidtype, but not always.
21770
21771 EOM
21772         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21773         . ./myread
21774         groupstype="$ans"
21775         ;;
21776 *)  groupstype="$gidtype";;
21777 esac
21778
21779 : check whether make sets MAKE
21780 echo " "
21781 echo "Checking if your $make program sets \$(MAKE)..." >&4
21782 case "$make_set_make" in
21783 '')
21784         $sed 's/^X //' > testmake.mak << 'EOF'
21785 Xall:
21786 X       @echo 'maketemp="$(MAKE)"'
21787 EOF
21788         case "`$make -f testmake.mak 2>/dev/null`" in
21789         *maketemp=*) make_set_make='#' ;;
21790         *)      make_set_make="MAKE=$make" ;;
21791         esac
21792         $rm -f testmake.mak
21793         ;;
21794 esac
21795 case "$make_set_make" in
21796 '#') echo "Yup, it does.";;
21797 *) echo "Nope, it doesn't.";;
21798 esac
21799
21800 : see what type is used for mode_t
21801 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21802 set mode_t modetype int stdio.h sys/types.h
21803 eval $typedef_ask
21804
21805 : see if we need va_copy
21806 echo " "
21807 case "$i_stdarg" in
21808 "$define")
21809         $cat >try.c <<EOCP
21810 #include <stdarg.h>
21811 #include <stdio.h>
21812 #$i_stdlib I_STDLIB
21813 #ifdef I_STDLIB
21814 #include <stdlib.h>
21815 #endif
21816 #include <signal.h>
21817
21818 int
21819 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21820 {
21821   return vfprintf(f, fmt, *valp);
21822 }
21823
21824 int
21825 myvfprintf(FILE *f, const  char *fmt, va_list val)
21826 {
21827   return ivfprintf(f, fmt, &val);
21828 }
21829
21830 int
21831 myprintf(char *fmt, ...)
21832 {
21833   va_list val;
21834   va_start(val, fmt);
21835   return myvfprintf(stdout, fmt, val);
21836 }
21837
21838 int
21839 main(int ac, char **av)
21840 {
21841   signal(SIGSEGV, exit);
21842
21843   myprintf("%s%cs all right, then\n", "that", '\'');
21844   exit(0);
21845 }
21846 EOCP
21847         set try
21848         if eval $compile && $run ./try 2>&1 >/dev/null; then
21849                 case "`$run ./try`" in
21850                 "that's all right, then")
21851                         okay=yes
21852                         ;;
21853                 esac
21854         fi
21855         case "$okay" in
21856         yes)    echo "It seems that you don't need va_copy()." >&4
21857                 need_va_copy="$undef"
21858                 ;;
21859         *)      echo "It seems that va_copy() or similar will be needed." >&4
21860                 need_va_copy="$define"
21861                 ;;
21862         esac
21863         $rm_try
21864         ;;
21865 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
21866         need_va_copy="$undef"
21867         ;;
21868 esac
21869
21870 : see what type is used for size_t
21871 rp="What is the type used for the length parameter for string functions?"
21872 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21873 eval $typedef_ask
21874
21875 : check for type of arguments to gethostbyaddr.
21876 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21877         case "$d_gethbyaddr" in
21878         $define)
21879                 $cat <<EOM
21880
21881 Checking to see what type of arguments are accepted by gethostbyaddr().
21882 EOM
21883                 hdrs="$define sys/types.h
21884                         $d_socket sys/socket.h
21885                         $i_niin netinet/in.h
21886                         $i_netdb netdb.h
21887                         $i_unistd unistd.h"
21888                 : The first arg can 'char *' or 'void *'
21889                 : The second arg is some of integral type
21890                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21891                         for yyy in size_t long int; do
21892                                 case "$netdb_host_type" in
21893                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21894                                         if ./protochk "$try" $hdrs; then
21895                                                 echo "Your system accepts $xxx for the first arg."
21896                                                 echo "...and $yyy for the second arg."
21897                                                 netdb_host_type="$xxx"
21898                                                 netdb_hlen_type="$yyy"
21899                                         fi
21900                                         ;;
21901                                 esac
21902                         done
21903                 done
21904                 : In case none of those worked, prompt the user.
21905                 case "$netdb_host_type" in
21906                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21907                         dflt='char *'
21908                         . ./myread
21909                         netdb_host_type=$ans
21910                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21911                         dflt="$sizetype"
21912                         . ./myread
21913                         netdb_hlen_type=$ans
21914                         ;;
21915                 esac
21916                 ;;
21917         *)      : no gethostbyaddr, so pick harmless defaults
21918                 netdb_host_type='char *'
21919                 netdb_hlen_type="$sizetype"
21920                 ;;
21921         esac
21922         # Remove the "const" if needed. -- but then we'll have a
21923         # prototype clash!
21924         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21925 fi
21926
21927 : check for type of argument to gethostbyname.
21928 if test "X$netdb_name_type" = X ; then
21929         case "$d_gethbyname" in
21930         $define)
21931                 $cat <<EOM
21932
21933 Checking to see what type of argument is accepted by gethostbyname().
21934 EOM
21935                 hdrs="$define sys/types.h
21936                         $d_socket sys/socket.h
21937                         $i_niin netinet/in.h
21938                         $i_netdb netdb.h
21939                         $i_unistd unistd.h"
21940                 for xxx in "const char *" "char *"; do
21941                         case "$netdb_name_type" in
21942                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21943                                 if ./protochk "$try" $hdrs; then
21944                                         echo "Your system accepts $xxx."
21945                                         netdb_name_type="$xxx"
21946                                 fi
21947                                 ;;
21948                         esac
21949                 done
21950                 : In case none of those worked, prompt the user.
21951                 case "$netdb_name_type" in
21952                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21953                         dflt='char *'
21954                         . ./myread
21955                         netdb_name_type=$ans
21956                         ;;
21957                 esac
21958                 ;;
21959         *)      : no gethostbyname, so pick harmless default
21960                 netdb_name_type='char *'
21961                 ;;
21962         esac
21963 fi
21964
21965 : check for type of 1st argument to getnetbyaddr.
21966 if test "X$netdb_net_type" = X ; then
21967         case "$d_getnbyaddr" in
21968         $define)
21969                 $cat <<EOM
21970
21971 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21972 EOM
21973                 hdrs="$define sys/types.h
21974                         $d_socket sys/socket.h
21975                         $i_niin netinet/in.h
21976                         $i_netdb netdb.h
21977                         $i_unistd unistd.h"
21978                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21979                         case "$netdb_net_type" in
21980                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21981                                 if ./protochk "$try" $hdrs; then
21982                                         echo "Your system accepts $xxx."
21983                                         netdb_net_type="$xxx"
21984                                 fi
21985                                 ;;
21986                         esac
21987                 done
21988                 : In case none of those worked, prompt the user.
21989                 case "$netdb_net_type" in
21990                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21991                         dflt='long'
21992                         . ./myread
21993                         netdb_net_type=$ans
21994                         ;;
21995                 esac
21996                 ;;
21997         *)      : no getnetbyaddr, so pick harmless default
21998                 netdb_net_type='long'
21999                 ;;
22000         esac
22001 fi
22002 : locate the preferred pager for this system
22003 fn=f/
22004 case "$pager" in
22005 '')
22006         dflt=''
22007         case "$pg" in
22008         /*) dflt=$pg;;
22009         [a-zA-Z]:/*) dflt=$pg;;
22010         esac
22011         case "$more" in
22012         /*) dflt=$more;;
22013         [a-zA-Z]:/*) dflt=$more;;
22014         esac
22015         case "$less" in
22016         /*) dflt=$less;;
22017         [a-zA-Z]:/*) dflt=$less;;
22018         esac
22019         case "$dflt" in
22020         '') dflt=/usr/ucb/more;;
22021         esac
22022         ;;
22023 *)      dflt="$pager"
22024         ;;
22025 esac
22026 fn="f/($dflt)"
22027 echo " "
22028 rp='What pager is used on your system?'
22029 . ./getfile
22030 pager="$ans"
22031
22032 : see if ar generates random libraries by itself
22033 echo " "
22034 echo "Checking how to generate random libraries on your machine..." >&4
22035 echo 'int bar1() { return bar2(); }' > bar1.c
22036 echo 'int bar2() { return 2; }' > bar2.c
22037 $cat > foo.c <<EOP
22038 #$i_stdlib I_STDLIB
22039 #ifdef I_STDLIB
22040 #include <stdlib.h>
22041 #endif
22042 int main() { printf("%d\n", bar1()); exit(0); }
22043 EOP
22044 $cc $ccflags -c bar1.c >/dev/null 2>&1
22045 $cc $ccflags -c bar2.c >/dev/null 2>&1
22046 $cc $ccflags -c foo.c >/dev/null 2>&1
22047 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
22048 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
22049         $run ./foobar >/dev/null 2>&1; then
22050         echo "$ar appears to generate random libraries itself."
22051         orderlib=false
22052         if [ "X$ranlib" = "X" ]; then
22053             ranlib=":"
22054         fi
22055 elif $ar s bar$_a >/dev/null 2>&1 &&
22056         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
22057         $run ./foobar >/dev/null 2>&1; then
22058                 echo "a table of contents needs to be added with '$ar s'."
22059                 orderlib=false
22060                 ranlib="$ar s"
22061 elif $ar ts bar$_a >/dev/null 2>&1 &&
22062         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
22063         $run ./foobar >/dev/null 2>&1; then
22064                 echo "a table of contents needs to be added with '$ar ts'."
22065                 orderlib=false
22066                 ranlib="$ar ts"
22067 else
22068         case "$ranlib" in
22069         :) ranlib='';;
22070         '')
22071                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
22072                 $test -f $ranlib || ranlib=''
22073                 ;;
22074         esac
22075         if $test -n "$ranlib"; then
22076                 echo "your system has '$ranlib'; we'll use that."
22077                 orderlib=false
22078         else
22079                 echo "your system doesn't seem to support random libraries"
22080                 echo "so we'll use lorder and tsort to order the libraries."
22081                 orderlib=true
22082                 ranlib=":"
22083         fi
22084 fi
22085 $rm -f foo* bar*
22086
22087 : see if this is a values.h system
22088 set values.h i_values
22089 eval $inhdr
22090
22091 : Check the max offset that gmtime and localtime accept
22092 echo "Checking max offsets that gmtime () accepts"
22093
22094 case $i_values in
22095     define) yyy="#include <values.h>" ;;
22096     *)      yyy="" ;;
22097     esac
22098
22099 case "$sGMTIME_min/$sGMTIME_max" in
22100     0/0|/)
22101         $cat >try.c <<EOCP
22102 #include <sys/types.h>
22103 #include <stdio.h>
22104 #include <time.h>
22105 $yyy
22106
22107 int i;
22108 struct tm *tmp;
22109 time_t pt;
22110
22111 void gm_check (time_t t, int min_year, int max_year)
22112 {
22113     tmp = gmtime (&t);
22114     if ( tmp == NULL ||
22115         /* Check tm_year overflow */
22116          tmp->tm_year < min_year || tmp->tm_year > max_year)
22117         tmp = NULL;
22118     else
22119         pt = t;
22120     } /* gm_check */
22121
22122 int check_max ()
22123 {
22124     tmp = NULL;
22125     pt  = 0;
22126 #ifdef MAXLONG
22127     gm_check (MAXLONG, 69, 0x7fffffff);
22128 #endif
22129     if (tmp == NULL || tmp->tm_year < 0) {
22130         for (i = 63; i >= 0; i--) {
22131             time_t x = pt | ((time_t)1 << i);
22132             if (x < 0 || x < pt) continue;
22133             gm_check (x, 69, 0x7fffffff);
22134             }
22135         }
22136     printf ("sGMTIME_max=%ld\n", pt);
22137     return (0);
22138     } /* check_max */
22139
22140 int check_min ()
22141 {
22142     tmp = NULL;
22143     pt  = 0;
22144 #ifdef MINLONG
22145     gm_check (MINLONG, -1900, 70);
22146 #endif
22147     if (tmp == NULL) {
22148         for (i = 36; i >= 0; i--) {
22149             time_t x = pt - ((time_t)1 << i);
22150             if (x > 0) continue;
22151             gm_check (x, -1900, 70);
22152             }
22153         }
22154     printf ("sGMTIME_min=%ld\n", pt);
22155     return (0);
22156     } /* check_min */
22157
22158 int main (int argc, char *argv[])
22159 {
22160     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
22161     check_max ();
22162     check_min ();
22163     return (0);
22164     } /* main */
22165 EOCP
22166         set try
22167         if eval $compile; then
22168             eval `$run ./try 2>/dev/null`
22169         else
22170             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
22171             fi
22172         $rm_try
22173         ;;
22174     esac
22175
22176 echo "Checking max offsets that localtime () accepts"
22177
22178 case "$sLOCALTIME_min/$sLOCALTIME_max" in
22179     0/0|/)
22180         $cat >try.c <<EOCP
22181 #include <sys/types.h>
22182 #include <stdio.h>
22183 #include <time.h>
22184 $yyy
22185
22186 int i;
22187 struct tm *tmp;
22188 time_t pt;
22189
22190 void local_check (time_t t, int min_year, int max_year)
22191 {
22192     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
22193         tmp = NULL;
22194     else
22195         tmp = localtime (&t);
22196     if ( tmp == NULL ||
22197         /* Check tm_year overflow */
22198          tmp->tm_year < min_year || tmp->tm_year > max_year)
22199         tmp = NULL;
22200     else
22201         pt = t;
22202     } /* local_check */
22203
22204 int check_max ()
22205 {
22206     tmp = NULL;
22207     pt  = 0;
22208 #ifdef MAXLONG
22209     local_check (MAXLONG, 69, 0x7fffffff);
22210 #endif
22211     if (tmp == NULL || tmp->tm_year < 0) {
22212         for (i = 63; i >= 0; i--) {
22213             time_t x = pt | ((time_t)1 << i);
22214             if (x < 0 || x < pt) continue;
22215             local_check (x, 69, 0x7fffffff);
22216             }
22217         }
22218     printf ("sLOCALTIME_max=%ld\n", pt);
22219     return (0);
22220    } /* check_max */
22221
22222 int check_min ()
22223 {
22224     tmp = NULL;
22225     pt  = 0;
22226 #ifdef MINLONG
22227     local_check (MINLONG, -1900, 70);
22228 #endif
22229     if (tmp == NULL) {
22230         for (i = 36; i >= 0; i--) {
22231             time_t x = pt - ((time_t)1 << i);
22232             if (x > 0) continue;
22233             local_check (x, -1900, 70);
22234             }
22235         }
22236     printf ("sLOCALTIME_min=%ld\n", pt);
22237     return (0);
22238     } /* check_min */
22239
22240 int main (int argc, char *argv[])
22241 {
22242     check_max ();
22243     check_min ();
22244     return (0);
22245     } /* main */
22246 EOCP
22247         set try
22248         if eval $compile; then
22249             eval `$run ./try 2>/dev/null`
22250         else
22251             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
22252             fi
22253         $rm_try
22254         ;;
22255     esac
22256
22257 : check for type of arguments to select.
22258 case "$selecttype" in
22259 '') case "$d_select" in
22260         $define)
22261                 echo " "
22262                 $cat <<EOM
22263 Checking to see what type of arguments are accepted by select().
22264 EOM
22265                 hdrs="$define sys/types.h
22266                         $i_systime sys/time.h
22267                         $i_sysselct sys/select.h
22268                         $d_socket sys/socket.h"
22269                 : The first arg can be int, unsigned, or size_t
22270                 : The last arg may or may not be 'const'
22271                 val=''
22272                 : void pointer has been seen but using that
22273                 : breaks the selectminbits test
22274                 for xxx in 'fd_set *' 'int *'; do
22275                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
22276                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
22277                                         case "$val" in
22278                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
22279                                                 if ./protochk "$try" $hdrs; then
22280                                                         echo "Your system accepts $xxx."
22281                                                         val="$xxx"
22282                                                 fi
22283                                                 ;;
22284                                         esac
22285                                 done
22286                         done
22287                 done
22288                 case "$val" in
22289                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
22290                         case "$d_fd_set" in
22291                                 $define) dflt="fd_set *" ;;
22292                                 *)              dflt="int *" ;;
22293                         esac
22294                         . ./myread
22295                         val=$ans
22296                         ;;
22297                 esac
22298                 selecttype="$val"
22299                 ;;
22300         *)      : no select, so pick a harmless default
22301                 selecttype='int *'
22302                 ;;
22303         esac
22304         ;;
22305 esac
22306
22307 : check for the select 'width'
22308 case "$selectminbits" in
22309 '') safebits=`expr $ptrsize \* 8`
22310     case "$d_select" in
22311         $define)
22312                 $cat <<EOM
22313
22314 Checking to see on how many bits at a time your select() operates...
22315 EOM
22316                 $cat >try.c <<EOCP
22317 #include <sys/types.h>
22318 #$i_time I_TIME
22319 #$i_systime I_SYS_TIME
22320 #$i_systimek I_SYS_TIME_KERNEL
22321 #ifdef I_TIME
22322 #   include <time.h>
22323 #endif
22324 #ifdef I_SYS_TIME
22325 #   ifdef I_SYS_TIME_KERNEL
22326 #       define KERNEL
22327 #   endif
22328 #   include <sys/time.h>
22329 #   ifdef I_SYS_TIME_KERNEL
22330 #       undef KERNEL
22331 #   endif
22332 #endif
22333 #$i_sysselct I_SYS_SELECT
22334 #ifdef I_SYS_SELECT
22335 #include <sys/select.h>
22336 #endif
22337 #$d_socket HAS_SOCKET
22338 #ifdef HAS_SOCKET
22339 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
22340 #endif
22341 #include <stdio.h>
22342 #$i_stdlib I_STDLIB
22343 #ifdef I_STDLIB
22344 #include <stdlib.h>
22345 #endif
22346 $selecttype b;
22347 #define S sizeof(*(b))
22348 #define MINBITS 64
22349 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
22350 #define NBITS  (NBYTES * 8)
22351 int main() {
22352     char *s = (char *)malloc(NBYTES);
22353     struct timeval t;
22354     int i;
22355     FILE* fp;
22356     int fd;
22357
22358     if (!s)
22359         exit(1);
22360     fclose(stdin);
22361     fp = fopen("try.c", "r");
22362     if (fp == 0)
22363       exit(2);
22364     fd = fileno(fp);
22365     if (fd < 0)
22366       exit(3);
22367     b = ($selecttype)s;
22368     for (i = 0; i < NBITS; i++)
22369         FD_SET(i, b);
22370     t.tv_sec  = 0;
22371     t.tv_usec = 0;
22372     select(fd + 1, b, 0, 0, &t);
22373     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
22374     free(s);
22375     printf("%d\n", i + 1);
22376     return 0;
22377 }
22378 EOCP
22379                 set try
22380                 if eval $compile_ok; then
22381                         selectminbits=`$run ./try 2>/dev/null`
22382                         case "$selectminbits" in
22383                         '')     cat >&4 <<EOM
22384 Cannot figure out on how many bits at a time your select() operates.
22385 I'll play safe and guess it is $safebits bits.
22386 EOM
22387                                 selectminbits=$safebits
22388                                 bits="$safebits bits"
22389                                 ;;
22390                         1)      bits="1 bit" ;;
22391                         *)      bits="$selectminbits bits" ;;
22392                         esac
22393                         echo "Your select() operates on $bits at a time." >&4
22394                 else
22395                         rp='What is the minimum number of bits your select() operates on?'
22396                         case "$byteorder" in
22397                         12345678)       dflt=64 ;;
22398                         1234)           dflt=32 ;;
22399                         *)              dflt=1  ;;
22400                         esac
22401                         . ./myread
22402                         val=$ans
22403                         selectminbits="$val"
22404                 fi
22405                 $rm_try
22406                 ;;
22407         *)      : no select, so pick a harmless default
22408                 selectminbits=$safebits
22409                 ;;
22410         esac
22411         ;;
22412 esac
22413
22414 : Trace out the files included by signal.h, then look for SIGxxx names.
22415 case "$sig_num_init" in
22416 '')
22417 if [ "X$fieldn" = X ]; then
22418         : Just make some guesses.  We check them later.
22419         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
22420 else
22421         xxx=`echo '#include <signal.h>' |
22422         $cppstdin $cppminus $cppflags 2>/dev/null |
22423         $grep '^[       ]*#.*include' |
22424         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
22425                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
22426 fi
22427 xxxfiles=''
22428 for xx in $xxx /dev/null ; do
22429         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
22430 done
22431 case "$xxxfiles" in
22432 '')     xxxfiles=`./findhdr signal.h` ;;
22433 esac
22434 xxx=`awk '
22435 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
22436         print substr($2, 4, 20)
22437 }
22438 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
22439         print substr($3, 4, 20)
22440 }' $xxxfiles`
22441 : Append some common names just in case the awk scan failed.
22442 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22443 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22444 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22445 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22446 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22447
22448 : generate a few handy files for later
22449 $cat > signal.c <<EOCP
22450 #include <sys/types.h>
22451 #include <signal.h>
22452 #$i_stdlib I_STDLIB
22453 #ifdef I_STDLIB
22454 #include <stdlib.h>
22455 #endif
22456 #include <stdio.h>
22457 int main() {
22458
22459 /* Strange style to avoid deeply-nested #if/#else/#endif */
22460 #ifndef NSIG
22461 #  ifdef _NSIG
22462 #    define NSIG (_NSIG)
22463 #  endif
22464 #endif
22465
22466 #ifndef NSIG
22467 #  ifdef SIGMAX
22468 #    define NSIG (SIGMAX+1)
22469 #  endif
22470 #endif
22471
22472 #ifndef NSIG
22473 #  ifdef SIG_MAX
22474 #    define NSIG (SIG_MAX+1)
22475 #  endif
22476 #endif
22477
22478 #ifndef NSIG
22479 #  ifdef _SIG_MAX
22480 #    define NSIG (_SIG_MAX+1)
22481 #  endif
22482 #endif
22483
22484 #ifndef NSIG
22485 #  ifdef MAXSIG
22486 #    define NSIG (MAXSIG+1)
22487 #  endif
22488 #endif
22489
22490 #ifndef NSIG
22491 #  ifdef MAX_SIG
22492 #    define NSIG (MAX_SIG+1)
22493 #  endif
22494 #endif
22495
22496 #ifndef NSIG
22497 #  ifdef SIGARRAYSIZE
22498 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22499 #  endif
22500 #endif
22501
22502 #ifndef NSIG
22503 #  ifdef _sys_nsig
22504 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
22505 #  endif
22506 #endif
22507
22508 /* Default to some arbitrary number that's big enough to get most
22509    of the common signals.
22510 */
22511 #ifndef NSIG
22512 #    define NSIG 50
22513 #endif
22514
22515 printf("NSIG %d\n", NSIG);
22516
22517 #ifndef JUST_NSIG
22518
22519 EOCP
22520
22521 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22522 {
22523         printf "#ifdef SIG"; printf $1; printf "\n"
22524         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22525         printf $1; printf ");\n"
22526         printf "#endif\n"
22527 }
22528 END {
22529         printf "#endif /* JUST_NSIG */\n";
22530         printf "exit(0);\n}\n";
22531 }
22532 ' >>signal.c
22533 $cat >signal.awk <<'EOP'
22534 BEGIN { ndups = 0 }
22535 $1 ~ /^NSIG$/ { nsig = $2 }
22536 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22537     if ($2 > maxsig) { maxsig = $2 }
22538     if (sig_name[$2]) {
22539         dup_name[ndups] = $1
22540         dup_num[ndups] = $2
22541         ndups++
22542     }
22543     else {
22544         sig_name[$2] = $1
22545         sig_num[$2] = $2
22546     }
22547 }
22548 END {
22549     if (nsig == 0) {
22550         nsig = maxsig + 1
22551     }
22552     printf("NSIG %d\n", nsig);
22553     for (n = 1; n < nsig; n++) {
22554         if (sig_name[n]) {
22555             printf("%s %d\n", sig_name[n], sig_num[n])
22556         }
22557         else {
22558             printf("NUM%d %d\n", n, n)
22559         }
22560     }
22561     for (n = 0; n < ndups; n++) {
22562         printf("%s %d\n", dup_name[n], dup_num[n])
22563     }
22564 }
22565 EOP
22566 $cat >signal_cmd <<EOS
22567 $startsh
22568 if $test -s signal.lst; then
22569     echo "Using your existing signal.lst file"
22570         exit 0
22571 fi
22572 xxx="$xxx"
22573 EOS
22574 $cat >>signal_cmd <<'EOS'
22575
22576 set signal
22577 if eval $compile_ok; then
22578         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22579                 $uniq | $awk -f signal.awk >signal.lst
22580 else
22581         echo "(I can't seem be able to compile the whole test program)" >&4
22582         echo "(I'll try it in little pieces.)" >&4
22583         set signal -DJUST_NSIG
22584         if eval $compile_ok; then
22585                 $run ./signal$_exe > signal.nsg
22586                 $cat signal.nsg
22587         else
22588                 echo "I can't seem to figure out how many signals you have." >&4
22589                 echo "Guessing 50." >&4
22590                 echo 'NSIG 50' > signal.nsg
22591         fi
22592         : Now look at all the signal names, one at a time.
22593         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22594                 $cat > signal.c <<EOCP
22595 #include <sys/types.h>
22596 #include <signal.h>
22597 #include <stdio.h>
22598 int main() {
22599 printf("$xx %d\n", SIG${xx});
22600 return 0;
22601 }
22602 EOCP
22603                 set signal
22604                 if eval $compile; then
22605                         echo "SIG${xx} found."
22606                         $run ./signal$_exe  >> signal.ls1
22607                 else
22608                         echo "SIG${xx} NOT found."
22609                 fi
22610         done
22611         if $test -s signal.ls1; then
22612                 $cat signal.nsg signal.ls1 |
22613                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
22614         fi
22615
22616 fi
22617 if $test -s signal.lst; then
22618         :
22619 else
22620         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
22621         echo 'kill -l' >signal
22622         set X `csh -f <signal`
22623         $rm -f signal
22624         shift
22625         case $# in
22626         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
22627         esac
22628         echo $@ | $tr ' ' $trnl | \
22629             $awk '{ printf "%s %d\n", $1, ++s; }
22630                   END { printf "NSIG %d\n", ++s }' >signal.lst
22631 fi
22632 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
22633 EOS
22634 chmod a+x signal_cmd
22635 $eunicefix signal_cmd
22636 ;;
22637 esac
22638
22639 : generate list of signal names
22640 case "$sig_num_init" in
22641 '')
22642 echo " "
22643 case "$sig_name_init" in
22644 '') doinit=yes ;;
22645 *)  case "$sig_num_init" in
22646     ''|*,*) doinit=yes ;;
22647     esac ;;
22648 esac
22649 case "$doinit" in
22650 yes)
22651         echo "Generating a list of signal names and numbers..." >&4
22652         . ./signal_cmd
22653         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22654         sig_name=`$awk 'BEGIN { printf "ZERO " }
22655                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
22656         sig_num=`$awk  'BEGIN { printf "0 " }
22657                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
22658         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
22659                              !/^NSIG/   { printf "\"%s\", ", $1 }
22660                              END        { printf "0\n" }' signal.lst`
22661         sig_num_init=`$awk  'BEGIN      { printf "0, " }
22662                              !/^NSIG/   { printf "%d, ", $2}
22663                              END        { printf "0\n"}' signal.lst`
22664         ;;
22665 esac
22666 echo "The following $sig_count signals are available:"
22667 echo " "
22668 echo $sig_name | $awk \
22669 'BEGIN { linelen = 0 }
22670 {
22671         for (i = 1; i <= NF; i++) {
22672                 name = "SIG" $i " "
22673                 linelen = linelen + length(name)
22674                 if (linelen > 70) {
22675                         printf "\n"
22676                         linelen = length(name)
22677                 }
22678                 printf "%s", name
22679         }
22680         printf "\n"
22681 }'
22682 sig_size=`echo $sig_name | awk '{print NF}'`
22683 $rm -f signal signal.c signal.awk signal.lst signal_cmd
22684 ;;
22685 esac
22686
22687 : Check size of size
22688 echo " "
22689 case "$sizetype" in
22690 *_t) zzz="$sizetype"    ;;
22691 *)   zzz="filesize"     ;;
22692 esac
22693 echo "Checking the size of $zzz..." >&4
22694 cat > try.c <<EOCP
22695 #include <sys/types.h>
22696 #include <stdio.h>
22697 #$i_stdlib I_STDLIB
22698 #ifdef I_STDLIB
22699 #include <stdlib.h>
22700 #endif
22701 int main() {
22702     printf("%d\n", (int)sizeof($sizetype));
22703     exit(0);
22704 }
22705 EOCP
22706 set try
22707 if eval $compile_ok; then
22708         yyy=`$run ./try`
22709         case "$yyy" in
22710         '')     sizesize=4
22711                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22712                 ;;
22713         *)      sizesize=$yyy
22714                 echo "Your $zzz size is $sizesize bytes."
22715                 ;;
22716         esac
22717 else
22718         sizesize=4
22719         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22720 fi
22721
22722
22723 : check for socklen_t
22724 echo " "
22725 echo "Checking to see if you have socklen_t..." >&4
22726 $cat >try.c <<EOCP
22727 #include <sys/types.h>
22728 #$d_socket HAS_SOCKET
22729 #ifdef HAS_SOCKET
22730 #include <sys/socket.h>
22731 #endif
22732 int main() { socklen_t x = 16; }
22733 EOCP
22734 set try
22735 if eval $compile; then
22736         val="$define"
22737         echo "You have socklen_t."
22738 else
22739         val="$undef"
22740         echo "You do not have socklen_t."
22741         case "$sizetype" in
22742         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22743         esac
22744 fi
22745 $rm_try
22746 set d_socklen_t
22747 eval $setvar
22748
22749 : see if this is a socks.h system
22750 set socks.h i_socks
22751 eval $inhdr
22752
22753 : check for type of the size argument to socket calls
22754 case "$d_socket" in
22755 "$define")
22756         $cat <<EOM
22757
22758 Checking to see what type is the last argument of accept().
22759 EOM
22760         yyy=''
22761         case "$d_socklen_t" in
22762         "$define") yyy="$yyy socklen_t"
22763         esac
22764         yyy="$yyy $sizetype int long unsigned"
22765         for xxx in $yyy; do
22766                 case "$socksizetype" in
22767                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22768                         case "$usesocks" in
22769                         "$define")
22770                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22771                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22772                                         socksizetype="$xxx"
22773                                 fi
22774                                 ;;
22775                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22776                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22777                                         socksizetype="$xxx"
22778                                 fi
22779                                 ;;
22780                         esac
22781                         ;;
22782                 esac
22783         done
22784 : In case none of those worked, prompt the user.
22785         case "$socksizetype" in
22786         '')     rp='What is the type for socket address structure sizes?'
22787                 dflt='int'
22788                 . ./myread
22789                 socksizetype=$ans
22790                 ;;
22791         esac
22792         ;;
22793 *)      : no sockets, so pick relatively harmless default
22794         socksizetype='int'
22795         ;;
22796 esac
22797
22798 : see what type is used for signed size_t
22799 set ssize_t ssizetype int stdio.h sys/types.h
22800 eval $typedef
22801 dflt="$ssizetype"
22802 $cat > try.c <<EOM
22803 #include <stdio.h>
22804 #$i_stdlib I_STDLIB
22805 #ifdef I_STDLIB
22806 #include <stdlib.h>
22807 #endif
22808 #include <sys/types.h>
22809 #define Size_t $sizetype
22810 #define SSize_t $dflt
22811 int main()
22812 {
22813         if (sizeof(Size_t) == sizeof(SSize_t))
22814                 printf("$dflt\n");
22815         else if (sizeof(Size_t) == sizeof(int))
22816                 printf("int\n");
22817         else
22818                 printf("long\n");
22819         exit(0);
22820 }
22821 EOM
22822 echo " "
22823 set try
22824 if eval $compile_ok && $run ./try > /dev/null; then
22825         ssizetype=`$run ./try`
22826         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22827 else
22828         $cat >&4 <<EOM
22829 Help! I can't compile and run the ssize_t test program: please enlighten me!
22830 (This is probably a misconfiguration in your system or libraries, and
22831 you really ought to fix it.  Still, I'll try anyway.)
22832
22833 I need a type that is the same size as $sizetype, but is guaranteed to
22834 be signed.  Common values are ssize_t, int and long.
22835
22836 EOM
22837         rp="What signed type is the same size as $sizetype?"
22838         . ./myread
22839         ssizetype="$ans"
22840 fi
22841 $rm_try
22842
22843 : Check the size of st_ino
22844 $echo " "
22845 $echo "Checking the size of st_ino..." >&4
22846 $cat > try.c <<EOCP
22847 #include <sys/stat.h>
22848 #include <stdio.h>
22849 #$i_stdlib I_STDLIB
22850 #ifdef I_STDLIB
22851 #include <stdlib.h>
22852 #endif
22853 int main() {
22854     struct stat st;
22855     printf("%d\n", (int)sizeof(st.st_ino));
22856     exit(0);
22857 }
22858 EOCP
22859 set try
22860 if eval $compile_ok; then
22861         val=`$run ./try`
22862         case "$val" in
22863         '')     st_ino_size=4
22864                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22865                 ;;
22866         *)      st_ino_size=$val
22867                 $echo "Your st_ino is $st_ino_size bytes long."
22868                 ;;
22869         esac
22870 else
22871         st_ino_size=4
22872         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22873 fi
22874 $rm_try
22875
22876 : Check if st_ino is signed
22877 $echo " "
22878 $echo "Checking the sign of st_ino..." >&4
22879 $cat > try.c <<EOCP
22880 #include <sys/stat.h>
22881 #include <stdio.h>
22882 int main() {
22883         struct stat foo;
22884         foo.st_ino = -1;
22885         if (foo.st_ino < 0)
22886                 printf("-1\n");
22887         else
22888                 printf("1\n");
22889 }
22890 EOCP
22891 set try
22892 if eval $compile; then
22893         val=`$run ./try`
22894         case "$val" in
22895         '')     st_ino_sign=1
22896                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22897                 ;;
22898         *)      st_ino_sign=$val
22899                 case "$st_ino_sign" in
22900                  1) $echo "Your st_ino is unsigned." ;;
22901                 -1) $echo "Your st_ino is signed."   ;;
22902                 esac
22903                 ;;
22904         esac
22905 else
22906         st_ino_sign=1
22907         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22908 fi
22909 $rm_try
22910
22911 : see what type of char stdio uses.
22912 echo " "
22913 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22914 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22915         echo "Your stdio uses unsigned chars." >&4
22916         stdchar="unsigned char"
22917 else
22918         echo "Your stdio uses signed chars." >&4
22919         stdchar="char"
22920 fi
22921 $rm -f stdioh
22922
22923 : Check size of UID
22924 echo " "
22925 case "$uidtype" in
22926 *_t) zzz="$uidtype"     ;;
22927 *)   zzz="uid"          ;;
22928 esac
22929 echo "Checking the size of $zzz..." >&4
22930 cat > try.c <<EOCP
22931 #include <sys/types.h>
22932 #include <stdio.h>
22933 #$i_stdlib I_STDLIB
22934 #ifdef I_STDLIB
22935 #include <stdlib.h>
22936 #endif
22937 int main() {
22938     printf("%d\n", (int)sizeof($uidtype));
22939     exit(0);
22940 }
22941 EOCP
22942 set try
22943 if eval $compile_ok; then
22944         yyy=`$run ./try`
22945         case "$yyy" in
22946         '')     uidsize=4
22947                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22948                 ;;
22949         *)      uidsize=$yyy
22950                 echo "Your $zzz is $uidsize bytes long."
22951                 ;;
22952         esac
22953 else
22954         uidsize=4
22955         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22956 fi
22957
22958 : Check if UID is signed
22959 echo " "
22960 case "$uidtype" in
22961 *_t) zzz="$uidtype"     ;;
22962 *)   zzz="uid"          ;;
22963 esac
22964 echo "Checking the sign of $zzz..." >&4
22965 cat > try.c <<EOCP
22966 #include <sys/types.h>
22967 #include <stdio.h>
22968 int main() {
22969         $uidtype foo = -1;
22970         if (foo < 0)
22971                 printf("-1\n");
22972         else
22973                 printf("1\n");
22974 }
22975 EOCP
22976 set try
22977 if eval $compile; then
22978         yyy=`$run ./try`
22979         case "$yyy" in
22980         '')     uidsign=1
22981                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22982                 ;;
22983         *)      uidsign=$yyy
22984                 case "$uidsign" in
22985                  1) echo "Your $zzz is unsigned." ;;
22986                 -1) echo "Your $zzz is signed."   ;;
22987                 esac
22988                 ;;
22989         esac
22990 else
22991         uidsign=1
22992         echo "(I can't compile the test program--guessing unsigned.)" >&4
22993 fi
22994
22995
22996 : Check format string for UID
22997 echo " "
22998 $echo "Checking the format string to be used for uids..." >&4
22999
23000 case "$uidsign" in
23001 -1)     if $test X"$uidsize" = X"$ivsize"; then
23002                 uidformat="$ivdformat"
23003         else
23004                 if $test X"$uidsize" = X"$longsize"; then
23005                         uidformat='"ld"'
23006                 else
23007                         if $test X"$uidsize" = X"$intsize"; then
23008                                 uidformat='"d"'
23009                         else
23010                                 if $test X"$uidsize" = X"$shortsize"; then
23011                                         uidformat='"hd"'
23012                                 fi
23013                         fi
23014                 fi
23015         fi
23016         ;;
23017 *)      if $test X"$uidsize" = X"$uvsize"; then
23018                 uidformat="$uvuformat"
23019         else
23020                 if $test X"$uidsize" = X"$longsize"; then
23021                         uidformat='"lu"'
23022                 else
23023                         if $test X"$uidsize" = X"$intsize"; then
23024                                 uidformat='"u"'
23025                         else
23026                                 if $test X"$uidsize" = X"$shortsize"; then
23027                                         uidformat='"hu"'
23028                                 fi
23029                         fi
23030                 fi
23031         fi
23032         ;;
23033 esac
23034
23035 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
23036 echo " "
23037 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
23038 $cat >try.c <<'EOM'
23039 /* Intentionally a long probe as I'd like to sanity check that the exact
23040    approach is going to work, as thinking it will work, but only having it
23041    part working at runtime is worse than not having it.  */
23042
23043 #include <sys/types.h>
23044 #include <sys/sysctl.h>
23045 #include <sys/param.h>
23046 #include <stdio.h>
23047 #include <string.h>
23048 #include <stdlib.h>
23049 #include <unistd.h>
23050
23051 int
23052 main(int argc, char **argv) {
23053     char *buffer;
23054     char *argv_leaf = strrchr(argv[0], '/');
23055     char *buffer_leaf;
23056     size_t size = 0;
23057     int mib[4];
23058
23059     mib[0] = CTL_KERN;
23060     mib[1] = KERN_PROC;
23061     mib[2] = KERN_PROC_PATHNAME;
23062     mib[3] = -1;
23063
23064     if (!argv_leaf) {
23065         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
23066         return 1;
23067     }
23068
23069     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
23070         perror("sysctl");
23071         return 2;
23072     }
23073
23074     if (size < strlen(argv_leaf) + 1) {
23075         fprintf(stderr, "size %lu is too short for a path\n",
23076                 (unsigned long) size);
23077         return 3;
23078     }
23079
23080     if (size > MAXPATHLEN * MAXPATHLEN) {
23081         fprintf(stderr, "size %lu is too long for a path\n",
23082                 (unsigned long) size);
23083         return 4;
23084     }
23085
23086     buffer = (char *)malloc(size);
23087     if (!buffer) {
23088         perror("malloc");
23089         return 5;
23090     }
23091
23092     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
23093         perror("sysctl");
23094         return 6;
23095     }
23096
23097     if (strlen(buffer) + 1 != size) {
23098         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
23099                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
23100         return 7;
23101     }
23102
23103
23104     if (*buffer != '/') {
23105         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
23106         return 8;
23107     }
23108
23109     if (strstr(buffer, "/./")) {
23110         fprintf(stderr, "Contains /./: '%s'\n", buffer);
23111         return 9;
23112     }
23113
23114     if (strstr(buffer, "/../")) {
23115         fprintf(stderr, "Contains /../: '%s'\n", buffer);
23116         return 10;
23117     }
23118
23119     buffer_leaf = strrchr(buffer, '/');
23120     if (strcmp(buffer_leaf, argv_leaf) != 0) {
23121         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
23122         return 11;
23123     }
23124
23125     free(buffer);
23126
23127     return 0;
23128 }
23129 EOM
23130
23131 val=$undef
23132 set try
23133 if eval $compile; then
23134         if $run ./try; then
23135                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
23136                 val="$define"
23137         else
23138                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
23139                 val="$undef"
23140         fi
23141 else
23142         echo "I'm unable to compile the test program." >&4
23143         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
23144         val="$undef"
23145 fi
23146 $rm_try
23147 set usekernprocpathname
23148 eval $setvar
23149
23150 : Determine if we can use _NSGetExecutablePath to find executing program
23151 echo " "
23152 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
23153 $cat >try.c <<'EOM'
23154 /* Intentionally a long probe as I'd like to sanity check that the exact
23155    approach is going to work, as thinking it will work, but only having it
23156    part working at runtime is worse than not having it.  */
23157 #include <mach-o/dyld.h>
23158 #include <stdio.h>
23159 #include <stdlib.h>
23160 #include <sys/param.h>
23161 #include <string.h>
23162
23163 int
23164 main(int argc, char **argv) {
23165     char buf[1];
23166     uint32_t size = sizeof(buf);
23167     int result;
23168     char *buffer;
23169     char *tidied;
23170     char *argv_leaf = strrchr(argv[0], '/');
23171     char *tidied_leaf;
23172
23173     if (!argv_leaf) {
23174         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
23175         return 1;
23176     }
23177
23178     _NSGetExecutablePath(buf, &size);
23179     if (size > MAXPATHLEN * MAXPATHLEN) {
23180         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
23181                 (unsigned int) size);
23182         return 2;
23183     }
23184
23185     buffer = (char *)malloc(size);
23186     if (!buffer) {
23187         perror("malloc");
23188         return 3;
23189     }
23190
23191     result = _NSGetExecutablePath(buffer, &size);
23192     if (result != 0) {
23193         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
23194                 result, (unsigned int) size);
23195         return 4;
23196     }
23197
23198     tidied = realpath(buffer, NULL);
23199     if (!tidied) {
23200         perror("realpath");
23201         return 5;
23202     }
23203
23204     free(buffer);
23205
23206     if (*tidied != '/') {
23207         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
23208         return 6;
23209     }
23210
23211     if (strstr(tidied, "/./")) {
23212         fprintf(stderr, "Contains /./: '%s'\n", tidied);
23213         return 7;
23214     }
23215
23216     if (strstr(tidied, "/../")) {
23217         fprintf(stderr, "Contains /../: '%s'\n", tidied);
23218         return 8;
23219     }
23220
23221     tidied_leaf = strrchr(tidied, '/');
23222     if (strcmp(tidied_leaf, argv_leaf) != 0) {
23223         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
23224         return 9;
23225     }
23226
23227     free(tidied);
23228
23229     return 0;
23230 }
23231 EOM
23232
23233 val=$undef
23234 set try
23235 if eval $compile; then
23236         if $run ./try; then
23237                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
23238                 val="$define"
23239         else
23240                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
23241         fi
23242 else
23243         echo "I'm unable to compile the test program." >&4
23244         echo "I'll assume no _NSGetExecutablePath here." >&4
23245 fi
23246 $rm_try
23247 set usensgetexecutablepath
23248 eval $setvar
23249
23250 : Check if site customization support was requested
23251 case "$usesitecustomize" in
23252     $define|true|[Yy]*)
23253         usesitecustomize="$define"
23254         ;;
23255     *)
23256         usesitecustomize="$undef"
23257         ;;
23258     esac
23259
23260 : see if prototypes support variable argument declarations
23261 echo " "
23262 case "$prototype$i_stdarg" in
23263 $define$define)
23264         echo "It appears we'll be able to prototype varargs functions." >&4
23265         val="$define"
23266         ;;
23267 *)
23268         echo "Too bad... We won't be using prototyped varargs functions..." >&4
23269         val="$undef"
23270         ;;
23271 esac
23272 set vaproto
23273 eval $setvar
23274
23275 : determine compiler compiler
23276 case "$yacc" in
23277 '')
23278         dflt=yacc;;
23279 *)
23280         dflt="$yacc";;
23281 esac
23282 echo " "
23283 comp='yacc'
23284 if $test -f "$byacc$_exe"; then
23285         dflt="$byacc"
23286         comp="byacc or $comp"
23287 fi
23288 if $test -f "$bison$_exe"; then
23289         comp="$comp or bison -y"
23290 fi
23291 rp="Which compiler compiler ($comp) shall I use?"
23292 . ./myread
23293 yacc="$ans"
23294 case "$yacc" in
23295 *bis*)
23296         case "$yacc" in
23297         *-y*) ;;
23298         *)
23299                 yacc="$yacc -y"
23300                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
23301                 ;;
23302         esac
23303         ;;
23304 esac
23305
23306 : see if this is a assert.h system
23307 set assert.h i_assert
23308 eval $inhdr
23309
23310 : see if this is a bfd.h system
23311 set bfd.h i_bfd
23312 eval $inhdr
23313
23314 : see if this is an execinfo.h system
23315 set execinfo.h i_execinfo
23316 eval $inhdr
23317
23318 : see if this is a fenv.h system
23319 set fenv.h i_fenv
23320 eval $inhdr
23321
23322 : see if this is a fp.h system
23323 set fp.h i_fp
23324 eval $inhdr
23325
23326 : see if this is a fp_class.h system
23327 set fp_class.h i_fp_class
23328 eval $inhdr
23329
23330 : see if gdbm.h is available
23331 set gdbm.h t_gdbm
23332 eval $inhdr
23333 case "$t_gdbm" in
23334 $define)
23335         : see if gdbm_open exists
23336         set gdbm_open d_gdbm_open
23337         eval $inlibc
23338         case "$d_gdbm_open" in
23339         $undef)
23340                 t_gdbm="$undef"
23341                 echo "We won't be including <gdbm.h>"
23342                 ;;
23343         esac
23344         ;;
23345 esac
23346 val="$t_gdbm"
23347 set i_gdbm
23348 eval $setvar
23349
23350 : see if this is a ieeefp.h system
23351 case "$i_ieeefp" in
23352 '' ) set ieeefp.h i_ieeefp
23353      eval $inhdr
23354      ;;
23355 esac
23356
23357 : see if this is a libutil.h system
23358 set libutil.h i_libutil
23359 eval $inhdr
23360
23361 : see if mach cthreads are available
23362 if test "X$usethreads" = "X$define"; then
23363         set mach/cthreads.h i_machcthr
23364         eval $inhdr
23365 else
23366         i_machcthr="$undef"
23367 fi
23368
23369 : see if this is a mntent.h system
23370 set mntent.h i_mntent
23371 eval $inhdr
23372
23373 : see if net/errno.h is available
23374 val=''
23375 set net/errno.h val
23376 eval $inhdr
23377
23378 : Unfortunately, it causes problems on some systems.  Arrgh.
23379 case "$val" in
23380 $define)
23381         cat > try.c <<'EOM'
23382 #include <stdio.h>
23383 #include <errno.h>
23384 #include <net/errno.h>
23385 int func()
23386 {
23387         return ENOTSOCK;
23388 }
23389 EOM
23390         if $cc $ccflags -c try.c >/dev/null 2>&1; then
23391                 echo "We'll be including <net/errno.h>." >&4
23392         else
23393                 echo "We won't be including <net/errno.h>." >&4
23394                 val="$undef"
23395         fi
23396         $rm_try
23397         ;;
23398 esac
23399 set i_neterrno
23400 eval $setvar
23401
23402 : see if netinet/tcp.h is available
23403 set netinet/tcp.h i_netinettcp
23404 eval $inhdr
23405
23406 : see if this is a poll.h system
23407 set poll.h i_poll
23408 eval $inhdr
23409
23410 : see if this is a prot.h system
23411 set prot.h i_prot
23412 eval $inhdr
23413
23414 : Preprocessor symbols
23415 echo " "
23416 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
23417 $cat <<'EOSH' > Cppsym.know
23418 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
23419 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
23420 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
23421 arch_pwr ardent ARM ARM32 atarist att386 att3b
23422 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
23423 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
23424 byteorder byte_order
23425 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
23426 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
23427 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
23428 ELF encore EPI EXTENSIONS
23429 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
23430 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
23431 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
23432 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
23433 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400 hp9000s500
23434 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
23435 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
23436 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
23437 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
23438 ksr1
23439 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
23440 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
23441 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
23442 luna88k Lynx
23443 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
23444 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
23445 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
23446 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
23447 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
23448 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
23449 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
23450 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
23451 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
23452 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
23453 ns32000 ns32016 ns32332 ns32k nsc32000
23454 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23455 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23456 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23457 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23458 QK_USER QNX
23459 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23460 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23461 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23462 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23463 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23464 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23465 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23466 SYSV4 SYSV5 sysV68 sysV88
23467 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23468 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23469 tower32_800 tower32_850 tss
23470 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23471 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23472 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23473 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23474 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23475 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23476 uxpm uxps
23477 vax venix VMESA vms
23478 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23479 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23480 z8000 zarch
23481 EOSH
23482 # Maybe put other stuff here too.
23483 ./tr '-' '_' <<EOSH >>Cppsym.know
23484 $osname
23485 EOSH
23486 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23487 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23488 $cat Cppsym.know > Cppsym.c
23489 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23490 $rm -f Cppsym.a Cppsym.b Cppsym.c
23491 cat <<EOSH > Cppsym
23492 $startsh
23493 if $test \$# -gt 0; then
23494     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23495     if $test -s Cppsym.got; then
23496         $rm -f Cppsym.got
23497         exit 0
23498     fi
23499     $rm -f Cppsym.got
23500     exit 1
23501 else
23502     $tr " " "$trnl" | ./Cppsym.try
23503     exit 0
23504 fi
23505 EOSH
23506 chmod +x Cppsym
23507 $eunicefix Cppsym
23508 cat <<EOSH > Cppsym.try
23509 $startsh
23510 cat <<'EOCP' > try.c
23511 #include <stdio.h>
23512 #if cpp_stuff == 1
23513 #define STRINGIFY(a)    "a"
23514 #endif
23515 #if cpp_stuff == 42
23516 #define StGiFy(a)  #a
23517 #define STRINGIFY(a)    StGiFy(a)
23518 #endif
23519 #if $cpp_stuff != 1 && $cpp_stuff != 42
23520 #   include "Bletch: How does this C preprocessor stringify macros?"
23521 #endif
23522 int main() {
23523 EOCP
23524 $awk \\
23525 EOSH
23526 cat <<'EOSH' >> Cppsym.try
23527 'length($1) > 0 {
23528     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23529     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23530     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23531     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23532 }'       >> try.c
23533 echo 'return 0;}' >> try.c
23534 EOSH
23535 cat <<EOSH >> Cppsym.try
23536 ccflags="$ccflags"
23537 case "$osname-$gccversion" in
23538 irix-) ccflags="\$ccflags -woff 1178" ;;
23539 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
23540 esac
23541 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
23542 EOSH
23543 chmod +x Cppsym.try
23544 $eunicefix Cppsym.try
23545 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
23546 : Add in any Linux cpp "predefined macros":
23547 case "$osname::$gccversion" in
23548   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
23549     tHdrH=_tmpHdr
23550     rm -f $tHdrH'.h' $tHdrH
23551     touch $tHdrH'.h'
23552     # Filter out macro arguments, such as Linux's __INT8_C(c)
23553     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
23554        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
23555        if [ -s $tHdrH'_cppsym.real' ]; then
23556           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
23557        fi
23558     fi
23559     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
23560   ;;
23561 esac
23562 : now check the C compiler for additional symbols
23563 postprocess_cc_v=''
23564 case "$osname" in
23565 aix) postprocess_cc_v="|$tr , ' '" ;;
23566 esac
23567 $cat >ccsym <<EOS
23568 $startsh
23569 $cat >tmp.c <<EOF
23570 extern int foo;
23571 EOF
23572 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
23573 do
23574         case "\$i" in
23575         -D*) echo "\$i" | $sed 's/^-D//';;
23576         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
23577         esac
23578 done
23579 $rm_try
23580 EOS
23581 postprocess_cc_v=''
23582 chmod +x ccsym
23583 $eunicefix ccsym
23584 ./ccsym > ccsym1.raw
23585 if $test -s ccsym1.raw; then
23586     $sort ccsym1.raw | $uniq >ccsym.raw
23587 else
23588     mv ccsym1.raw ccsym.raw
23589 fi
23590
23591 $awk '/\=/ { print $0; next }
23592         { print $0"=1" }' ccsym.raw >ccsym.list
23593 $comm -13 Cppsym.true ccsym.list >ccsym.own
23594 $comm -12 Cppsym.true ccsym.list >ccsym.com
23595 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
23596 also=''
23597 if $test -z ccsym.raw; then
23598         echo "Your C compiler doesn't seem to define any symbols!" >&4
23599         echo " "
23600         echo "However, your C preprocessor defines the following symbols:"
23601         $cat Cppsym.true
23602         ccsymbols=''
23603         cppsymbols=`$cat Cppsym.true`
23604         cppsymbols=`echo $cppsymbols`
23605         cppccsymbols="$cppsymbols"
23606 else
23607         if $test -s ccsym.com; then
23608                 echo "Your C compiler and pre-processor define these symbols:"
23609                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
23610                 also='also '
23611                 symbols='ones'
23612                 cppccsymbols=`$cat ccsym.com`
23613                 cppccsymbols=`echo $cppccsymbols`
23614                 $test "$silent" || sleep 1
23615         fi
23616         if $test -s ccsym.cpp; then
23617                 $test "$also" && echo " "
23618                 echo "Your C pre-processor ${also}defines the following symbols:"
23619                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
23620                 also='further '
23621                 cppsymbols=`$cat ccsym.cpp`
23622                 cppsymbols=`echo $cppsymbols`
23623                 $test "$silent" || sleep 1
23624         fi
23625         if $test -s ccsym.own; then
23626                 $test "$also" && echo " "
23627                 echo "Your C compiler ${also}defines the following cpp symbols:"
23628                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
23629                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
23630                 ccsymbols=`$cat ccsym.own`
23631                 ccsymbols=`echo $ccsymbols`
23632                 $test "$silent" || sleep 1
23633         fi
23634 fi
23635
23636 : add -D_FORTIFY_SOURCE if feasible and not already there
23637 case "$gccversion" in
23638 [4567].*)       case "$optimize$ccflags" in
23639         *-O*)   case "$ccflags$cppsymbols" in
23640                 *_FORTIFY_SOURCE=*) # Don't add it again.
23641                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
23642                         ;;
23643                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
23644                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
23645                         ;;
23646                 esac
23647                 ;;
23648         *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
23649                 ;;
23650         esac
23651         ;;
23652 *)      echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
23653         ;;
23654 esac
23655
23656 : see if this is a termio system
23657 val="$undef"
23658 val2="$undef"
23659 val3="$undef"
23660 if $test `./findhdr termios.h`; then
23661     set tcsetattr i_termios
23662     eval $inlibc
23663     val3="$i_termios"
23664 fi
23665 echo " "
23666 case "$val3" in
23667     "$define") echo "You have POSIX termios.h... good!" >&4;;
23668     *)  if ./Cppsym pyr; then
23669             case "`$run /bin/universe`" in
23670                 ucb) if $test `./findhdr sgtty.h`; then
23671                         val2="$define"
23672                         echo "<sgtty.h> found." >&4
23673                     else
23674                         echo "System is pyramid with BSD universe."
23675                         ./warn "<sgtty.h> not found--you could have problems."
23676                     fi;;
23677                 *)  if $test `./findhdr termio.h`; then
23678                         val="$define"
23679                         echo "<termio.h> found." >&4
23680                     else
23681                         echo "System is pyramid with USG universe."
23682                         ./warn "<termio.h> not found--you could have problems."
23683                     fi;;
23684             esac
23685         elif ./usg; then
23686             if $test `./findhdr termio.h`; then
23687                 echo "<termio.h> found." >&4
23688                 val="$define"
23689             elif $test `./findhdr sgtty.h`; then
23690                 echo "<sgtty.h> found." >&4
23691                 val2="$define"
23692             else
23693                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23694             fi
23695         else
23696             if $test `./findhdr sgtty.h`; then
23697                 echo "<sgtty.h> found." >&4
23698                 val2="$define"
23699             elif $test `./findhdr termio.h`; then
23700                 echo "<termio.h> found." >&4
23701                 val="$define"
23702             else
23703                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23704             fi
23705         fi;;
23706 esac
23707 set i_termio; eval $setvar
23708 val=$val2; set i_sgtty; eval $setvar
23709 val=$val3; set i_termios; eval $setvar
23710
23711 : see if stdbool is available
23712 : we want a real compile instead of Inhdr because some Solaris systems
23713 : have stdbool.h, but it can only be used if the compiler indicates it
23714 : is sufficiently c99-compliant.
23715 echo " "
23716 $cat >try.c <<EOCP
23717 #include <stdio.h>
23718 #include <stdbool.h>
23719 int func(bool x)
23720 {
23721     return x ? 1 : 0;
23722 }
23723 int main(int argc, char **argv)
23724 {
23725     return func(0);
23726 }
23727 EOCP
23728 set try
23729 if eval $compile; then
23730         echo "<stdbool.h> found." >&4
23731         val="$define"
23732 else
23733         echo "<stdbool.h> NOT found." >&4
23734         val="$undef"
23735 fi
23736 $rm_try
23737 set i_stdbool
23738 eval $setvar
23739
23740 : see if stddef is available
23741 set stddef.h i_stddef
23742 eval $inhdr
23743
23744 : see if stdint is available
23745 set stdint.h i_stdint
23746 eval $inhdr
23747
23748 : see if sys/access.h is available
23749 set sys/access.h i_sysaccess
23750 eval $inhdr
23751
23752 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23753 set sys/filio.h i_sysfilio
23754 eval $inhdr
23755 echo " "
23756 if $test `./findhdr sys/ioctl.h`; then
23757         val="$define"
23758         echo '<sys/ioctl.h> found.' >&4
23759 else
23760         val="$undef"
23761         if $test $i_sysfilio = "$define"; then
23762             echo '<sys/ioctl.h> NOT found.' >&4
23763         else
23764                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23765                 $test $i_termio = "$define" && xxx="termio.h"
23766                 $test $i_termios = "$define" && xxx="termios.h"
23767 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23768         fi
23769 fi
23770 set i_sysioctl
23771 eval $setvar
23772
23773 : see if socket ioctl defs are in sys/sockio.h
23774 echo " "
23775 xxx=`./findhdr sys/sockio.h`
23776 if $test "$xxx"; then
23777         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23778                 val="$define"
23779                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23780         else
23781                 val="$undef"
23782                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23783         fi
23784 else
23785         val="$undef"
23786         $cat <<EOM
23787 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23788 EOM
23789 fi
23790 set i_syssockio
23791 eval $setvar
23792
23793 : see if this is a syslog.h system
23794 set syslog.h i_syslog
23795 eval $inhdr
23796
23797 : see if this is a sys/mode.h system
23798 set sys/mode.h i_sysmode
23799 eval $inhdr
23800
23801 : see if there is a sys/poll.h file
23802 set sys/poll.h i_syspoll
23803 eval $inhdr
23804
23805 : see if sys/resource.h has to be included
23806 set sys/resource.h i_sysresrc
23807 eval $inhdr
23808
23809 : see if sys/security.h is available
23810 set sys/security.h i_syssecrt
23811 eval $inhdr
23812
23813 : see if this is a sys/statvfs.h system
23814 set sys/statvfs.h i_sysstatvfs
23815 eval $inhdr
23816
23817 : see if this is a sys/un.h system
23818 set sys/un.h i_sysun
23819 eval $inhdr
23820
23821 : see if this is a sys/utsname.h system
23822 set sys/utsname.h i_sysutsname
23823 eval $inhdr
23824
23825 : see if this is a syswait system
23826 set sys/wait.h i_syswait
23827 eval $inhdr
23828
23829 : see if this is a ustat.h system
23830 set ustat.h i_ustat
23831 eval $inhdr
23832
23833 : see if this is an utime system
23834 set utime.h i_utime
23835 eval $inhdr
23836
23837 : see if this is a vfork system
23838 case "$d_vfork" in
23839 "$define")
23840         set vfork.h i_vfork
23841         eval $inhdr
23842         ;;
23843 *)
23844         i_vfork="$undef"
23845         ;;
23846 esac
23847
23848 : Check extensions
23849 echo " "
23850 echo "Looking for extensions..." >&4
23851 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23852 : contain old or inaccurate or duplicate values.
23853 nonxs_extensions=''
23854 xs_extensions=''
23855 : We do not use find because it might not be available.
23856 : We do not just use MANIFEST because the user may have dropped
23857 : some additional extensions into the source tree and expect them
23858 : to be built.
23859
23860 : Function to recursively find available extensions, ignoring DynaLoader
23861 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23862 : In 5.10.1 and later, extensions are stored in directories
23863 : like File-Glob instead of the older File/Glob/.
23864 find_extensions='
23865     for xxx in *; do
23866         case "$xxx" in
23867             DynaLoader|dynaload) ;;
23868             *)
23869             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23870             case "$this_ext" in
23871                 Scalar/List/Utils) this_ext="List/Util" ;;
23872                 PathTools)         this_ext="Cwd"       ;;
23873             esac;
23874             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23875             if $contains " $this_ext " "$tdir/$$.tmp"; then
23876                 echo >&4;
23877                 echo "Duplicate directories detected for extension $xxx" >&4;
23878                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23879                 case "$knowitall" in
23880                 "") dflt=y;;
23881                 *) dflt=n;;
23882                 esac;
23883                 . ../UU/myread;
23884                 case "$ans" in
23885                 n*|N*) ;;
23886                 *) echo >&4;
23887                     echo "Ok.  Stopping Configure." >&4;
23888                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23889                     exit 1;;
23890                 esac;
23891                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23892             fi;
23893             $ls -1 "$xxx" > "$tdir/$$.tmp";
23894             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23895                 xs_extensions="$xs_extensions $this_ext";
23896             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
23897                 xs_extensions="$xs_extensions $this_ext";
23898             elif $test -d "$xxx"; then
23899                 nonxs_extensions="$nonxs_extensions $this_ext";
23900             fi;
23901             $rm -f "$tdir/$$.tmp";
23902             ;;
23903         esac;
23904     done'
23905 tdir=`pwd`
23906 cd "$rsrc/cpan"
23907 set X
23908 shift
23909 eval $find_extensions
23910 cd "$rsrc/dist"
23911 set X
23912 shift
23913 eval $find_extensions
23914 cd "$rsrc/ext"
23915 set X
23916 shift
23917 eval $find_extensions
23918 set X $xs_extensions
23919 shift
23920 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23921 set X $nonxs_extensions
23922 shift
23923 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23924 cd "$tdir"
23925 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23926
23927 : Now see which are supported on this system.
23928 avail_ext=''
23929 for xxx in $xs_extensions ; do
23930         case "$xxx" in
23931         Amiga*)
23932                 case "$osname" in
23933                 amigaos) avail_ext="$avail_ext $xxx" ;;
23934                 esac
23935                 ;;
23936         DB_File|db_file)
23937                 case "$i_db" in
23938                 $define) avail_ext="$avail_ext $xxx" ;;
23939                 esac
23940                 ;;
23941         GDBM_File|gdbm_fil)
23942                 case "$i_gdbm" in
23943                 $define) avail_ext="$avail_ext $xxx" ;;
23944                 esac
23945                 ;;
23946         I18N/Langinfo|i18n_lan)
23947                 case "$i_langinfo$d_nl_langinfo" in
23948                 $define$define) avail_ext="$avail_ext $xxx" ;;
23949                 esac
23950                 ;;
23951         IPC/SysV|ipc/sysv)
23952                 : XXX Do we need a useipcsysv variable here
23953                 case "${d_msg}${d_sem}${d_shm}" in
23954                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23955                 esac
23956                 ;;
23957         NDBM_File|ndbm_fil)
23958                 case "$d_ndbm" in
23959                 $define)
23960                     case "$osname-$use64bitint" in
23961                     hpux-define)
23962                         case "$libs" in
23963                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23964                         esac
23965                         ;;
23966                     *) avail_ext="$avail_ext $xxx" ;;
23967                     esac
23968                     ;;
23969                 esac
23970                 ;;
23971         ODBM_File|odbm_fil)
23972                 case "${i_dbm}${i_rpcsvcdbm}" in
23973                 *"${define}"*)
23974                     case "$d_cplusplus" in
23975                     define) ;; # delete as a function name will not work
23976                     *)  case "$osname-$use64bitint" in
23977                         hpux-define)
23978                             case "$libs" in
23979                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23980                             esac
23981                             ;;
23982                         *) avail_ext="$avail_ext $xxx" ;;
23983                         esac
23984                         ;;
23985                     esac
23986                     ;;
23987                 esac
23988                 ;;
23989         Opcode|opcode)
23990                 case "$useopcode" in
23991                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23992                 esac
23993                 ;;
23994         POSIX|posix)
23995                 case "$useposix" in
23996                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23997                 esac
23998                 ;;
23999         Socket|socket)
24000                 case "$d_socket" in
24001                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
24002                 esac
24003                 ;;
24004         Sys/Syslog|sys/syslog)
24005                 case $osname in
24006                         amigaos) ;; # not really very useful on AmigaOS
24007                         *)
24008                         : XXX syslog requires socket
24009                         case "$d_socket" in
24010                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
24011                         esac
24012                         ;;
24013                 esac
24014                 ;;
24015         Thread|thread)
24016                 case "$usethreads" in
24017                 true|$define|y)
24018                         case "$use5005threads" in
24019                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
24020                         esac
24021                 esac
24022                 ;;
24023         threads|threads/shared)
24024                 # threads and threads::shared are special cases.
24025                 # To stop people from asking "Perl 5.8.0 was supposed
24026                 # to have this new fancy threads implementation but my
24027                 # perl doesn't have it" and from people trying to
24028                 # (re)install the threads module using CPAN.pm and
24029                 # CPAN.pm then offering to reinstall Perl 5.8.0,
24030                 # the threads.pm and threads/shared.pm will always be
24031                 # there, croaking informatively ("you need to rebuild
24032                 # all of Perl with threads, sorry") when threads haven't
24033                 # been compiled in.
24034                 # --jhi
24035                 avail_ext="$avail_ext $xxx"
24036                 ;;
24037         VMS*)
24038                 ;;
24039         Win32*)
24040                 case "$osname" in
24041                 cygwin) avail_ext="$avail_ext $xxx" ;;
24042                 esac
24043                 ;;
24044         XS/APItest|xs/apitest)
24045                 # This is just for testing.  Skip it unless we have dynamic loading.
24046
24047                 case "$usedl" in
24048                 $define) avail_ext="$avail_ext $xxx" ;;
24049                 esac
24050                 ;;
24051         XS/Typemap|xs/typemap)
24052                 # This is just for testing.  Skip it unless we have dynamic loading.
24053                 case "$usedl" in
24054                 $define) avail_ext="$avail_ext $xxx" ;;
24055                 esac
24056                 ;;
24057         *)      avail_ext="$avail_ext $xxx"
24058                 ;;
24059         esac
24060 done
24061
24062 set X $avail_ext
24063 shift
24064 avail_ext="$*"
24065
24066 case "$onlyextensions" in
24067 '') ;;
24068 *)  keepextensions=''
24069     echo "You have requested that only certain extensions be included..." >&4
24070     for i in $onlyextensions; do
24071         case " $avail_ext " in
24072         *" $i "*)
24073             echo "Keeping extension $i."
24074             keepextensions="$keepextensions $i"
24075             ;;
24076         *) echo "Ignoring extension $i." ;;
24077         esac
24078     done
24079     avail_ext="$keepextensions"
24080     ;;
24081 esac
24082
24083 case "$noextensions" in
24084 '') ;;
24085 *)  keepextensions=''
24086     echo "You have requested that certain extensions be ignored..." >&4
24087     for i in $avail_ext; do
24088         case " $noextensions " in
24089         *" $i "*) echo "Ignoring extension $i." ;;
24090         *) echo "Keeping extension $i.";
24091            keepextensions="$keepextensions $i"
24092            ;;
24093         esac
24094     done
24095     avail_ext="$keepextensions"
24096     ;;
24097 esac
24098
24099 : Now see which nonxs extensions are supported on this system.
24100 : For now assume all are.
24101 nonxs_ext=''
24102 for xxx in $nonxs_extensions ; do
24103         case "$xxx" in
24104         VMS*)
24105                 ;;
24106         *)      nonxs_ext="$nonxs_ext $xxx"
24107                 ;;
24108         esac
24109 done
24110
24111 set X $nonxs_ext
24112 shift
24113 nonxs_ext="$*"
24114
24115 case $usedl in
24116 $define)
24117         $cat <<EOM
24118 A number of extensions are supplied with $package.  You may choose to
24119 compile these extensions for dynamic loading (the default), compile
24120 them into the $package executable (static loading), or not include
24121 them at all.  Answer "none" to include no extensions.
24122 Note that DynaLoader is always built and need not be mentioned here.
24123
24124 EOM
24125         case "$dynamic_ext" in
24126         '')
24127                 : Exclude those listed in static_ext
24128                 dflt=''
24129                 for xxx in $avail_ext; do
24130                         case " $static_ext " in
24131                         *" $xxx "*) ;;
24132                         *) dflt="$dflt $xxx" ;;
24133                         esac
24134                 done
24135                 set X $dflt
24136                 shift
24137                 dflt="$*"
24138                 ;;
24139         *)      dflt="$dynamic_ext"
24140                 # Perhaps we are reusing an old out-of-date config.sh.
24141                 case "$hint" in
24142                 previous)
24143                         if test X"$dynamic_ext" != X"$avail_ext"; then
24144                                 $cat <<EOM
24145 NOTICE:  Your previous config.sh list may be incorrect.
24146 The extensions now available to you are
24147         ${avail_ext}
24148 but the default list from your previous config.sh is
24149         ${dynamic_ext}
24150
24151 EOM
24152                         fi
24153                         ;;
24154                 esac
24155                 ;;
24156         esac
24157         case "$dflt" in
24158         '')     dflt=none;;
24159         esac
24160         rp="What extensions do you wish to load dynamically?"
24161         . ./myread
24162         case "$ans" in
24163         none) dynamic_ext=' ' ;;
24164         *) dynamic_ext="$ans" ;;
24165         esac
24166
24167         case "$static_ext" in
24168         '')
24169                 : Exclude those already listed in dynamic linking
24170                 dflt=''
24171                 for xxx in $avail_ext; do
24172                         case " $dynamic_ext " in
24173                         *" $xxx "*) ;;
24174                         *) dflt="$dflt $xxx" ;;
24175                         esac
24176                 done
24177                 set X $dflt
24178                 shift
24179                 dflt="$*"
24180                 ;;
24181         *)  dflt="$static_ext"
24182                 ;;
24183         esac
24184
24185         case "$dflt" in
24186         '')     dflt=none;;
24187         esac
24188         rp="What extensions do you wish to load statically?"
24189         . ./myread
24190         case "$ans" in
24191         none) static_ext=' ' ;;
24192         *) static_ext="$ans" ;;
24193         esac
24194         ;;
24195 *)
24196         $cat <<EOM
24197 A number of extensions are supplied with $package.  Answer "none"
24198 to include no extensions.
24199 Note that DynaLoader is always built and need not be mentioned here.
24200
24201 EOM
24202         case "$static_ext" in
24203         '') dflt="$avail_ext" ;;
24204         *)      dflt="$static_ext"
24205                 # Perhaps we are reusing an old out-of-date config.sh.
24206                 case "$hint" in
24207                 previous)
24208                         if test X"$static_ext" != X"$avail_ext"; then
24209                                 $cat <<EOM
24210 NOTICE:  Your previous config.sh list may be incorrect.
24211 The extensions now available to you are
24212         ${avail_ext}
24213 but the default list from your previous config.sh is
24214         ${static_ext}
24215
24216 EOM
24217                         fi
24218                         ;;
24219                 esac
24220                 ;;
24221         esac
24222         : Exclude those that are not xs extensions
24223         case "$dflt" in
24224         '')     dflt=none;;
24225         esac
24226         rp="What extensions do you wish to include?"
24227         . ./myread
24228         case "$ans" in
24229         none) static_ext=' ' ;;
24230         *) static_ext="$ans" ;;
24231         esac
24232         ;;
24233 esac
24234 #
24235 # Encode is a special case.  If we are building Encode as a static
24236 # extension, we need to explicitly list its subextensions as well.
24237 # For other nested extensions, this is handled automatically by
24238 # the appropriate Makefile.PL.
24239 case " $static_ext " in
24240         *" Encode "*) # Add the subextensions of Encode
24241         cd "$rsrc/cpan"
24242         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
24243                 static_ext="$static_ext Encode/$xxx"
24244                 known_extensions="$known_extensions Encode/$xxx"
24245         done
24246         cd "$tdir"
24247         ;;
24248 esac
24249
24250 set X $dynamic_ext $static_ext $nonxs_ext
24251 shift
24252 extensions="$*"
24253
24254 # Sanity check:  We require an extension suitable for use with
24255 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
24256 # should show up as failures in the test suite, but it's helpful to
24257 # catch them now.) The 'extensions' list is normally sorted
24258 # alphabetically, so we need to accept either
24259 #    DB_File ... Fcntl ... IO  ....
24260 # or something like
24261 #    Fcntl ... NDBM_File ... IO  ....
24262 case " $extensions"  in
24263 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
24264 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
24265 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
24266 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
24267    echo "WARNING: The Perl you are building will be quite crippled." >& 4
24268    ;;
24269 esac
24270
24271 : Remove libraries needed only for extensions
24272 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
24273 : The exception is SunOS 4.x, which needs them.
24274 case "${osname}X${osvers}" in
24275 sunos*X4*)
24276     perllibs="$libs"
24277     ;;
24278 *) case "$usedl" in
24279     $define|true|[yY]*)
24280             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
24281             shift
24282             perllibs="$*"
24283             ;;
24284     *)  perllibs="$libs"
24285             ;;
24286     esac
24287     ;;
24288 esac
24289
24290 : Remove build directory name from cppstdin so it can be used from
24291 : either the present location or the final installed location.
24292 echo " "
24293 : Get out of the UU directory to get correct path name.
24294 cd ..
24295 case "$cppstdin" in
24296 `pwd`/cppstdin)
24297         echo "Stripping down cppstdin path name"
24298         cppstdin=cppstdin
24299         ;;
24300 esac
24301 cd UU
24302
24303 : end of configuration questions
24304 echo " "
24305 echo "End of configuration questions."
24306 echo " "
24307
24308 : back to where it started
24309 if test -d ../UU; then
24310         cd ..
24311 fi
24312
24313 : configuration may be unconditionally patched via a 'config.arch' file
24314 if $test -f config.arch; then
24315         echo "I see a config.arch file, loading it." >&4
24316         . ./config.arch
24317 fi
24318
24319 : configuration may be patched via a 'config.over' file
24320 if $test -f config.over; then
24321         echo " "
24322         dflt=y
24323         rp='I see a config.over file.  Do you wish to load it?'
24324         . UU/myread
24325         case "$ans" in
24326         n*) echo "OK, I'll ignore it.";;
24327         *)      . ./config.over
24328                 echo "Configuration override changes have been loaded."
24329                 ;;
24330         esac
24331 fi
24332
24333 : in case they want portability, strip down executable paths
24334 case "$d_portable" in
24335 "$define")
24336         echo " "
24337         echo "Stripping down executable paths..." >&4
24338         for file in $loclist $trylist; do
24339                 eval temp=\$$file
24340                 eval $file=`basename $temp`
24341         done
24342         ;;
24343 esac
24344
24345 : create config.sh file
24346 echo " "
24347 echo "Creating config.sh..." >&4
24348 $spitshell <<EOT >config.sh
24349 $startsh
24350 #
24351 # This file was produced by running the Configure script. It holds all the
24352 # definitions figured out by Configure. Should you modify one of these values,
24353 # do not forget to propagate your changes by running "Configure -der". You may
24354 # instead choose to run each of the .SH files by yourself, or "Configure -S".
24355 #
24356
24357 # Package name      : $package
24358 # Source directory  : $src
24359 # Configuration time: $cf_time
24360 # Configured by     : $cf_by
24361 # Target system     : $myuname
24362
24363 EOT
24364 : Add in command line options if available
24365 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
24366
24367 $spitshell <<EOT >>config.sh
24368
24369 Author='$Author'
24370 Date='$Date'
24371 Header='$Header'
24372 Id='$Id'
24373 Locker='$Locker'
24374 Log='$Log'
24375 RCSfile='$RCSfile'
24376 Revision='$Revision'
24377 Source='$Source'
24378 State='$State'
24379 _a='$_a'
24380 _exe='$_exe'
24381 _o='$_o'
24382 afs='$afs'
24383 afsroot='$afsroot'
24384 alignbytes='$alignbytes'
24385 ansi2knr='$ansi2knr'
24386 aphostname='$aphostname'
24387 api_revision='$api_revision'
24388 api_subversion='$api_subversion'
24389 api_version='$api_version'
24390 api_versionstring='$api_versionstring'
24391 ar='$ar'
24392 archlib='$archlib'
24393 archlibexp='$archlibexp'
24394 archname64='$archname64'
24395 archname='$archname'
24396 archobjs='$archobjs'
24397 asctime_r_proto='$asctime_r_proto'
24398 awk='$awk'
24399 baserev='$baserev'
24400 bash='$bash'
24401 bin='$bin'
24402 bin_ELF='$bin_ELF'
24403 binexp='$binexp'
24404 bison='$bison'
24405 byacc='$byacc'
24406 byteorder='$byteorder'
24407 c='$c'
24408 castflags='$castflags'
24409 cat='$cat'
24410 cc='$cc'
24411 cccdlflags='$cccdlflags'
24412 ccdlflags='$ccdlflags'
24413 ccflags='$ccflags'
24414 ccflags_uselargefiles='$ccflags_uselargefiles'
24415 ccname='$ccname'
24416 ccsymbols='$ccsymbols'
24417 ccversion='$ccversion'
24418 cf_by='$cf_by'
24419 cf_email='$cf_email'
24420 cf_time='$cf_time'
24421 charbits='$charbits'
24422 charsize='$charsize'
24423 chgrp='$chgrp'
24424 chmod='$chmod'
24425 chown='$chown'
24426 clocktype='$clocktype'
24427 comm='$comm'
24428 compress='$compress'
24429 contains='$contains'
24430 cp='$cp'
24431 cpio='$cpio'
24432 cpp='$cpp'
24433 cpp_stuff='$cpp_stuff'
24434 cppccsymbols='$cppccsymbols'
24435 cppflags='$cppflags'
24436 cpplast='$cpplast'
24437 cppminus='$cppminus'
24438 cpprun='$cpprun'
24439 cppstdin='$cppstdin'
24440 cppsymbols='$cppsymbols'
24441 crypt_r_proto='$crypt_r_proto'
24442 cryptlib='$cryptlib'
24443 csh='$csh'
24444 ctermid_r_proto='$ctermid_r_proto'
24445 ctime_r_proto='$ctime_r_proto'
24446 d_Gconvert='$d_Gconvert'
24447 d_PRIEUldbl='$d_PRIEUldbl'
24448 d_PRIFUldbl='$d_PRIFUldbl'
24449 d_PRIGUldbl='$d_PRIGUldbl'
24450 d_PRIXU64='$d_PRIXU64'
24451 d_PRId64='$d_PRId64'
24452 d_PRIeldbl='$d_PRIeldbl'
24453 d_PRIfldbl='$d_PRIfldbl'
24454 d_PRIgldbl='$d_PRIgldbl'
24455 d_PRIi64='$d_PRIi64'
24456 d_PRIo64='$d_PRIo64'
24457 d_PRIu64='$d_PRIu64'
24458 d_PRIx64='$d_PRIx64'
24459 d_SCNfldbl='$d_SCNfldbl'
24460 d__fwalk='$d__fwalk'
24461 d_access='$d_access'
24462 d_accessx='$d_accessx'
24463 d_acosh='$d_acosh'
24464 d_aintl='$d_aintl'
24465 d_alarm='$d_alarm'
24466 d_archlib='$d_archlib'
24467 d_asctime64='$d_asctime64'
24468 d_asctime_r='$d_asctime_r'
24469 d_asinh='$d_asinh'
24470 d_atanh='$d_atanh'
24471 d_atolf='$d_atolf'
24472 d_atoll='$d_atoll'
24473 d_attribute_deprecated='$d_attribute_deprecated'
24474 d_attribute_format='$d_attribute_format'
24475 d_attribute_malloc='$d_attribute_malloc'
24476 d_attribute_nonnull='$d_attribute_nonnull'
24477 d_attribute_noreturn='$d_attribute_noreturn'
24478 d_attribute_pure='$d_attribute_pure'
24479 d_attribute_unused='$d_attribute_unused'
24480 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24481 d_backtrace='$d_backtrace'
24482 d_bcmp='$d_bcmp'
24483 d_bcopy='$d_bcopy'
24484 d_bsd='$d_bsd'
24485 d_bsdgetpgrp='$d_bsdgetpgrp'
24486 d_bsdsetpgrp='$d_bsdsetpgrp'
24487 d_builtin_choose_expr='$d_builtin_choose_expr'
24488 d_builtin_expect='$d_builtin_expect'
24489 d_bzero='$d_bzero'
24490 d_c99_variadic_macros='$d_c99_variadic_macros'
24491 d_casti32='$d_casti32'
24492 d_castneg='$d_castneg'
24493 d_cbrt='$d_cbrt'
24494 d_charvspr='$d_charvspr'
24495 d_chown='$d_chown'
24496 d_chroot='$d_chroot'
24497 d_chsize='$d_chsize'
24498 d_class='$d_class'
24499 d_clearenv='$d_clearenv'
24500 d_closedir='$d_closedir'
24501 d_cmsghdr_s='$d_cmsghdr_s'
24502 d_const='$d_const'
24503 d_copysign='$d_copysign'
24504 d_copysignl='$d_copysignl'
24505 d_cplusplus='$d_cplusplus'
24506 d_crypt='$d_crypt'
24507 d_crypt_r='$d_crypt_r'
24508 d_csh='$d_csh'
24509 d_ctermid='$d_ctermid'
24510 d_ctermid_r='$d_ctermid_r'
24511 d_ctime64='$d_ctime64'
24512 d_ctime_r='$d_ctime_r'
24513 d_cuserid='$d_cuserid'
24514 d_dbl_dig='$d_dbl_dig'
24515 d_dbminitproto='$d_dbminitproto'
24516 d_difftime64='$d_difftime64'
24517 d_difftime='$d_difftime'
24518 d_dir_dd_fd='$d_dir_dd_fd'
24519 d_dirfd='$d_dirfd'
24520 d_dirnamlen='$d_dirnamlen'
24521 d_dladdr='$d_dladdr'
24522 d_dlerror='$d_dlerror'
24523 d_dlopen='$d_dlopen'
24524 d_dlsymun='$d_dlsymun'
24525 d_dosuid='$d_dosuid'
24526 d_double_has_inf='$d_double_has_inf'
24527 d_double_has_nan='$d_double_has_nan'
24528 d_double_has_negative_zero='$d_double_has_negative_zero'
24529 d_double_has_subnormals='$d_double_has_subnormals'
24530 d_double_style_cray='$d_double_style_cray'
24531 d_double_style_ibm='$d_double_style_ibm'
24532 d_double_style_ieee='$d_double_style_ieee'
24533 d_double_style_vax='$d_double_style_vax'
24534 d_drand48_r='$d_drand48_r'
24535 d_drand48proto='$d_drand48proto'
24536 d_dup2='$d_dup2'
24537 d_duplocale='$d_duplocale'
24538 d_eaccess='$d_eaccess'
24539 d_endgrent='$d_endgrent'
24540 d_endgrent_r='$d_endgrent_r'
24541 d_endhent='$d_endhent'
24542 d_endhostent_r='$d_endhostent_r'
24543 d_endnent='$d_endnent'
24544 d_endnetent_r='$d_endnetent_r'
24545 d_endpent='$d_endpent'
24546 d_endprotoent_r='$d_endprotoent_r'
24547 d_endpwent='$d_endpwent'
24548 d_endpwent_r='$d_endpwent_r'
24549 d_endsent='$d_endsent'
24550 d_endservent_r='$d_endservent_r'
24551 d_eofnblk='$d_eofnblk'
24552 d_erf='$d_erf'
24553 d_erfc='$d_erfc'
24554 d_eunice='$d_eunice'
24555 d_exp2='$d_exp2'
24556 d_expm1='$d_expm1'
24557 d_faststdio='$d_faststdio'
24558 d_fchdir='$d_fchdir'
24559 d_fchmod='$d_fchmod'
24560 d_fchmodat='$d_fchmodat'
24561 d_fchown='$d_fchown'
24562 d_fcntl='$d_fcntl'
24563 d_fcntl_can_lock='$d_fcntl_can_lock'
24564 d_fd_macros='$d_fd_macros'
24565 d_fd_set='$d_fd_set'
24566 d_fdclose='$d_fdclose'
24567 d_fdim='$d_fdim'
24568 d_fds_bits='$d_fds_bits'
24569 d_fegetround='$d_fegetround'
24570 d_fgetpos='$d_fgetpos'
24571 d_finite='$d_finite'
24572 d_finitel='$d_finitel'
24573 d_flexfnam='$d_flexfnam'
24574 d_flock='$d_flock'
24575 d_flockproto='$d_flockproto'
24576 d_fma='$d_fma'
24577 d_fmax='$d_fmax'
24578 d_fmin='$d_fmin'
24579 d_fork='$d_fork'
24580 d_fp_class='$d_fp_class'
24581 d_fp_classify='$d_fp_classify'
24582 d_fp_classl='$d_fp_classl'
24583 d_fpathconf='$d_fpathconf'
24584 d_fpclass='$d_fpclass'
24585 d_fpclassify='$d_fpclassify'
24586 d_fpclassl='$d_fpclassl'
24587 d_fpgetround='$d_fpgetround'
24588 d_fpos64_t='$d_fpos64_t'
24589 d_freelocale='$d_freelocale'
24590 d_frexpl='$d_frexpl'
24591 d_fs_data_s='$d_fs_data_s'
24592 d_fseeko='$d_fseeko'
24593 d_fsetpos='$d_fsetpos'
24594 d_fstatfs='$d_fstatfs'
24595 d_fstatvfs='$d_fstatvfs'
24596 d_fsync='$d_fsync'
24597 d_ftello='$d_ftello'
24598 d_ftime='$d_ftime'
24599 d_futimes='$d_futimes'
24600 d_gai_strerror='$d_gai_strerror'
24601 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
24602 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
24603 d_getaddrinfo='$d_getaddrinfo'
24604 d_getcwd='$d_getcwd'
24605 d_getespwnam='$d_getespwnam'
24606 d_getfsstat='$d_getfsstat'
24607 d_getgrent='$d_getgrent'
24608 d_getgrent_r='$d_getgrent_r'
24609 d_getgrgid_r='$d_getgrgid_r'
24610 d_getgrnam_r='$d_getgrnam_r'
24611 d_getgrps='$d_getgrps'
24612 d_gethbyaddr='$d_gethbyaddr'
24613 d_gethbyname='$d_gethbyname'
24614 d_gethent='$d_gethent'
24615 d_gethname='$d_gethname'
24616 d_gethostbyaddr_r='$d_gethostbyaddr_r'
24617 d_gethostbyname_r='$d_gethostbyname_r'
24618 d_gethostent_r='$d_gethostent_r'
24619 d_gethostprotos='$d_gethostprotos'
24620 d_getitimer='$d_getitimer'
24621 d_getlogin='$d_getlogin'
24622 d_getlogin_r='$d_getlogin_r'
24623 d_getmnt='$d_getmnt'
24624 d_getmntent='$d_getmntent'
24625 d_getnameinfo='$d_getnameinfo'
24626 d_getnbyaddr='$d_getnbyaddr'
24627 d_getnbyname='$d_getnbyname'
24628 d_getnent='$d_getnent'
24629 d_getnetbyaddr_r='$d_getnetbyaddr_r'
24630 d_getnetbyname_r='$d_getnetbyname_r'
24631 d_getnetent_r='$d_getnetent_r'
24632 d_getnetprotos='$d_getnetprotos'
24633 d_getpagsz='$d_getpagsz'
24634 d_getpbyname='$d_getpbyname'
24635 d_getpbynumber='$d_getpbynumber'
24636 d_getpent='$d_getpent'
24637 d_getpgid='$d_getpgid'
24638 d_getpgrp2='$d_getpgrp2'
24639 d_getpgrp='$d_getpgrp'
24640 d_getppid='$d_getppid'
24641 d_getprior='$d_getprior'
24642 d_getprotobyname_r='$d_getprotobyname_r'
24643 d_getprotobynumber_r='$d_getprotobynumber_r'
24644 d_getprotoent_r='$d_getprotoent_r'
24645 d_getprotoprotos='$d_getprotoprotos'
24646 d_getprpwnam='$d_getprpwnam'
24647 d_getpwent='$d_getpwent'
24648 d_getpwent_r='$d_getpwent_r'
24649 d_getpwnam_r='$d_getpwnam_r'
24650 d_getpwuid_r='$d_getpwuid_r'
24651 d_getsbyname='$d_getsbyname'
24652 d_getsbyport='$d_getsbyport'
24653 d_getsent='$d_getsent'
24654 d_getservbyname_r='$d_getservbyname_r'
24655 d_getservbyport_r='$d_getservbyport_r'
24656 d_getservent_r='$d_getservent_r'
24657 d_getservprotos='$d_getservprotos'
24658 d_getspnam='$d_getspnam'
24659 d_getspnam_r='$d_getspnam_r'
24660 d_gettimeod='$d_gettimeod'
24661 d_gmtime64='$d_gmtime64'
24662 d_gmtime_r='$d_gmtime_r'
24663 d_gnulibc='$d_gnulibc'
24664 d_grpasswd='$d_grpasswd'
24665 d_hasmntopt='$d_hasmntopt'
24666 d_htonl='$d_htonl'
24667 d_hypot='$d_hypot'
24668 d_ilogb='$d_ilogb'
24669 d_ilogbl='$d_ilogbl'
24670 d_inc_version_list='$d_inc_version_list'
24671 d_index='$d_index'
24672 d_inetaton='$d_inetaton'
24673 d_inetntop='$d_inetntop'
24674 d_inetpton='$d_inetpton'
24675 d_int64_t='$d_int64_t'
24676 d_ip_mreq='$d_ip_mreq'
24677 d_ip_mreq_source='$d_ip_mreq_source'
24678 d_ipv6_mreq='$d_ipv6_mreq'
24679 d_ipv6_mreq_source='$d_ipv6_mreq_source'
24680 d_isascii='$d_isascii'
24681 d_isblank='$d_isblank'
24682 d_isfinite='$d_isfinite'
24683 d_isfinitel='$d_isfinitel'
24684 d_isinf='$d_isinf'
24685 d_isinfl='$d_isinfl'
24686 d_isless='$d_isless'
24687 d_isnan='$d_isnan'
24688 d_isnanl='$d_isnanl'
24689 d_isnormal='$d_isnormal'
24690 d_j0='$d_j0'
24691 d_j0l='$d_j0l'
24692 d_killpg='$d_killpg'
24693 d_lc_monetary_2008='$d_lc_monetary_2008'
24694 d_lchown='$d_lchown'
24695 d_ldbl_dig='$d_ldbl_dig'
24696 d_ldexpl='$d_ldexpl'
24697 d_lgamma='$d_lgamma'
24698 d_lgamma_r='$d_lgamma_r'
24699 d_libm_lib_version='$d_libm_lib_version'
24700 d_libname_unique='$d_libname_unique'
24701 d_link='$d_link'
24702 d_linkat='$d_linkat'
24703 d_llrint='$d_llrint'
24704 d_llrintl='$d_llrintl'
24705 d_llround='$d_llround'
24706 d_llroundl='$d_llroundl'
24707 d_localtime64='$d_localtime64'
24708 d_localtime_r='$d_localtime_r'
24709 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24710 d_locconv='$d_locconv'
24711 d_lockf='$d_lockf'
24712 d_log1p='$d_log1p'
24713 d_log2='$d_log2'
24714 d_logb='$d_logb'
24715 d_long_double_style_ieee='$d_long_double_style_ieee'
24716 d_long_double_style_ieee_doubledouble='$d_long_double_style_ieee_doubledouble'
24717 d_long_double_style_ieee_extended='$d_long_double_style_ieee_extended'
24718 d_long_double_style_ieee_std='$d_long_double_style_ieee_std'
24719 d_long_double_style_vax='$d_long_double_style_vax'
24720 d_longdbl='$d_longdbl'
24721 d_longlong='$d_longlong'
24722 d_lrint='$d_lrint'
24723 d_lrintl='$d_lrintl'
24724 d_lround='$d_lround'
24725 d_lroundl='$d_lroundl'
24726 d_lseekproto='$d_lseekproto'
24727 d_lstat='$d_lstat'
24728 d_madvise='$d_madvise'
24729 d_malloc_good_size='$d_malloc_good_size'
24730 d_malloc_size='$d_malloc_size'
24731 d_mblen='$d_mblen'
24732 d_mbstowcs='$d_mbstowcs'
24733 d_mbtowc='$d_mbtowc'
24734 d_memchr='$d_memchr'
24735 d_memcmp='$d_memcmp'
24736 d_memcpy='$d_memcpy'
24737 d_memmem='$d_memmem'
24738 d_memmove='$d_memmove'
24739 d_memrchr='$d_memrchr'
24740 d_memset='$d_memset'
24741 d_mkdir='$d_mkdir'
24742 d_mkdtemp='$d_mkdtemp'
24743 d_mkfifo='$d_mkfifo'
24744 d_mkstemp='$d_mkstemp'
24745 d_mkstemps='$d_mkstemps'
24746 d_mktime64='$d_mktime64'
24747 d_mktime='$d_mktime'
24748 d_mmap='$d_mmap'
24749 d_modfl='$d_modfl'
24750 d_modflproto='$d_modflproto'
24751 d_mprotect='$d_mprotect'
24752 d_msg='$d_msg'
24753 d_msg_ctrunc='$d_msg_ctrunc'
24754 d_msg_dontroute='$d_msg_dontroute'
24755 d_msg_oob='$d_msg_oob'
24756 d_msg_peek='$d_msg_peek'
24757 d_msg_proxy='$d_msg_proxy'
24758 d_msgctl='$d_msgctl'
24759 d_msgget='$d_msgget'
24760 d_msghdr_s='$d_msghdr_s'
24761 d_msgrcv='$d_msgrcv'
24762 d_msgsnd='$d_msgsnd'
24763 d_msync='$d_msync'
24764 d_munmap='$d_munmap'
24765 d_mymalloc='$d_mymalloc'
24766 d_nan='$d_nan'
24767 d_ndbm='$d_ndbm'
24768 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24769 d_nearbyint='$d_nearbyint'
24770 d_newlocale='$d_newlocale'
24771 d_nextafter='$d_nextafter'
24772 d_nexttoward='$d_nexttoward'
24773 d_nice='$d_nice'
24774 d_nl_langinfo='$d_nl_langinfo'
24775 d_nv_preserves_uv='$d_nv_preserves_uv'
24776 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24777 d_off64_t='$d_off64_t'
24778 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24779 d_oldpthreads='$d_oldpthreads'
24780 d_oldsock='$d_oldsock'
24781 d_open3='$d_open3'
24782 d_openat='$d_openat'
24783 d_pathconf='$d_pathconf'
24784 d_pause='$d_pause'
24785 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24786 d_phostname='$d_phostname'
24787 d_pipe='$d_pipe'
24788 d_poll='$d_poll'
24789 d_portable='$d_portable'
24790 d_prctl='$d_prctl'
24791 d_prctl_set_name='$d_prctl_set_name'
24792 d_printf_format_null='$d_printf_format_null'
24793 d_procselfexe='$d_procselfexe'
24794 d_pseudofork='$d_pseudofork'
24795 d_pthread_atfork='$d_pthread_atfork'
24796 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24797 d_pthread_yield='$d_pthread_yield'
24798 d_ptrdiff_t='$d_ptrdiff_t'
24799 d_pwage='$d_pwage'
24800 d_pwchange='$d_pwchange'
24801 d_pwclass='$d_pwclass'
24802 d_pwcomment='$d_pwcomment'
24803 d_pwexpire='$d_pwexpire'
24804 d_pwgecos='$d_pwgecos'
24805 d_pwpasswd='$d_pwpasswd'
24806 d_pwquota='$d_pwquota'
24807 d_qgcvt='$d_qgcvt'
24808 d_quad='$d_quad'
24809 d_querylocale='$d_querylocale'
24810 d_random_r='$d_random_r'
24811 d_re_comp='$d_re_comp'
24812 d_readdir64_r='$d_readdir64_r'
24813 d_readdir='$d_readdir'
24814 d_readdir_r='$d_readdir_r'
24815 d_readlink='$d_readlink'
24816 d_readv='$d_readv'
24817 d_recvmsg='$d_recvmsg'
24818 d_regcmp='$d_regcmp'
24819 d_regcomp='$d_regcomp'
24820 d_remainder='$d_remainder'
24821 d_remquo='$d_remquo'
24822 d_rename='$d_rename'
24823 d_renameat='$d_renameat'
24824 d_rewinddir='$d_rewinddir'
24825 d_rint='$d_rint'
24826 d_rmdir='$d_rmdir'
24827 d_round='$d_round'
24828 d_safebcpy='$d_safebcpy'
24829 d_safemcpy='$d_safemcpy'
24830 d_sanemcmp='$d_sanemcmp'
24831 d_sbrkproto='$d_sbrkproto'
24832 d_scalbn='$d_scalbn'
24833 d_scalbnl='$d_scalbnl'
24834 d_sched_yield='$d_sched_yield'
24835 d_scm_rights='$d_scm_rights'
24836 d_seekdir='$d_seekdir'
24837 d_select='$d_select'
24838 d_sem='$d_sem'
24839 d_semctl='$d_semctl'
24840 d_semctl_semid_ds='$d_semctl_semid_ds'
24841 d_semctl_semun='$d_semctl_semun'
24842 d_semget='$d_semget'
24843 d_semop='$d_semop'
24844 d_sendmsg='$d_sendmsg'
24845 d_setegid='$d_setegid'
24846 d_seteuid='$d_seteuid'
24847 d_setgrent='$d_setgrent'
24848 d_setgrent_r='$d_setgrent_r'
24849 d_setgrps='$d_setgrps'
24850 d_sethent='$d_sethent'
24851 d_sethostent_r='$d_sethostent_r'
24852 d_setitimer='$d_setitimer'
24853 d_setlinebuf='$d_setlinebuf'
24854 d_setlocale='$d_setlocale'
24855 d_setlocale_r='$d_setlocale_r'
24856 d_setnent='$d_setnent'
24857 d_setnetent_r='$d_setnetent_r'
24858 d_setpent='$d_setpent'
24859 d_setpgid='$d_setpgid'
24860 d_setpgrp2='$d_setpgrp2'
24861 d_setpgrp='$d_setpgrp'
24862 d_setprior='$d_setprior'
24863 d_setproctitle='$d_setproctitle'
24864 d_setprotoent_r='$d_setprotoent_r'
24865 d_setpwent='$d_setpwent'
24866 d_setpwent_r='$d_setpwent_r'
24867 d_setregid='$d_setregid'
24868 d_setresgid='$d_setresgid'
24869 d_setresuid='$d_setresuid'
24870 d_setreuid='$d_setreuid'
24871 d_setrgid='$d_setrgid'
24872 d_setruid='$d_setruid'
24873 d_setsent='$d_setsent'
24874 d_setservent_r='$d_setservent_r'
24875 d_setsid='$d_setsid'
24876 d_setvbuf='$d_setvbuf'
24877 d_shm='$d_shm'
24878 d_shmat='$d_shmat'
24879 d_shmatprototype='$d_shmatprototype'
24880 d_shmctl='$d_shmctl'
24881 d_shmdt='$d_shmdt'
24882 d_shmget='$d_shmget'
24883 d_sigaction='$d_sigaction'
24884 d_siginfo_si_addr='$d_siginfo_si_addr'
24885 d_siginfo_si_band='$d_siginfo_si_band'
24886 d_siginfo_si_errno='$d_siginfo_si_errno'
24887 d_siginfo_si_fd='$d_siginfo_si_fd'
24888 d_siginfo_si_pid='$d_siginfo_si_pid'
24889 d_siginfo_si_status='$d_siginfo_si_status'
24890 d_siginfo_si_uid='$d_siginfo_si_uid'
24891 d_siginfo_si_value='$d_siginfo_si_value'
24892 d_signbit='$d_signbit'
24893 d_sigprocmask='$d_sigprocmask'
24894 d_sigsetjmp='$d_sigsetjmp'
24895 d_sin6_scope_id='$d_sin6_scope_id'
24896 d_sitearch='$d_sitearch'
24897 d_snprintf='$d_snprintf'
24898 d_sockaddr_in6='$d_sockaddr_in6'
24899 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24900 d_sockatmark='$d_sockatmark'
24901 d_sockatmarkproto='$d_sockatmarkproto'
24902 d_socket='$d_socket'
24903 d_socklen_t='$d_socklen_t'
24904 d_sockpair='$d_sockpair'
24905 d_socks5_init='$d_socks5_init'
24906 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
24907 d_sqrtl='$d_sqrtl'
24908 d_srand48_r='$d_srand48_r'
24909 d_srandom_r='$d_srandom_r'
24910 d_sresgproto='$d_sresgproto'
24911 d_sresuproto='$d_sresuproto'
24912 d_stat='$d_stat'
24913 d_statblks='$d_statblks'
24914 d_statfs_f_flags='$d_statfs_f_flags'
24915 d_statfs_s='$d_statfs_s'
24916 d_static_inline='$d_static_inline'
24917 d_statvfs='$d_statvfs'
24918 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24919 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24920 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24921 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24922 d_stdio_stream_array='$d_stdio_stream_array'
24923 d_stdiobase='$d_stdiobase'
24924 d_stdstdio='$d_stdstdio'
24925 d_strchr='$d_strchr'
24926 d_strcoll='$d_strcoll'
24927 d_strctcpy='$d_strctcpy'
24928 d_strerrm='$d_strerrm'
24929 d_strerror='$d_strerror'
24930 d_strerror_l='$d_strerror_l'
24931 d_strerror_r='$d_strerror_r'
24932 d_strftime='$d_strftime'
24933 d_strlcat='$d_strlcat'
24934 d_strlcpy='$d_strlcpy'
24935 d_strtod='$d_strtod'
24936 d_strtol='$d_strtol'
24937 d_strtold='$d_strtold'
24938 d_strtoll='$d_strtoll'
24939 d_strtoq='$d_strtoq'
24940 d_strtoul='$d_strtoul'
24941 d_strtoull='$d_strtoull'
24942 d_strtouq='$d_strtouq'
24943 d_strxfrm='$d_strxfrm'
24944 d_suidsafe='$d_suidsafe'
24945 d_symlink='$d_symlink'
24946 d_syscall='$d_syscall'
24947 d_syscallproto='$d_syscallproto'
24948 d_sysconf='$d_sysconf'
24949 d_sysernlst='$d_sysernlst'
24950 d_syserrlst='$d_syserrlst'
24951 d_system='$d_system'
24952 d_tcgetpgrp='$d_tcgetpgrp'
24953 d_tcsetpgrp='$d_tcsetpgrp'
24954 d_telldir='$d_telldir'
24955 d_telldirproto='$d_telldirproto'
24956 d_tgamma='$d_tgamma'
24957 d_time='$d_time'
24958 d_timegm='$d_timegm'
24959 d_times='$d_times'
24960 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24961 d_tm_tm_zone='$d_tm_tm_zone'
24962 d_tmpnam_r='$d_tmpnam_r'
24963 d_trunc='$d_trunc'
24964 d_truncate='$d_truncate'
24965 d_truncl='$d_truncl'
24966 d_ttyname_r='$d_ttyname_r'
24967 d_tzname='$d_tzname'
24968 d_u32align='$d_u32align'
24969 d_ualarm='$d_ualarm'
24970 d_umask='$d_umask'
24971 d_uname='$d_uname'
24972 d_union_semun='$d_union_semun'
24973 d_unlinkat='$d_unlinkat'
24974 d_unordered='$d_unordered'
24975 d_unsetenv='$d_unsetenv'
24976 d_uselocale='$d_uselocale'
24977 d_usleep='$d_usleep'
24978 d_usleepproto='$d_usleepproto'
24979 d_ustat='$d_ustat'
24980 d_vendorarch='$d_vendorarch'
24981 d_vendorbin='$d_vendorbin'
24982 d_vendorlib='$d_vendorlib'
24983 d_vendorscript='$d_vendorscript'
24984 d_vfork='$d_vfork'
24985 d_void_closedir='$d_void_closedir'
24986 d_voidsig='$d_voidsig'
24987 d_voidtty='$d_voidtty'
24988 d_volatile='$d_volatile'
24989 d_vprintf='$d_vprintf'
24990 d_vsnprintf='$d_vsnprintf'
24991 d_wait4='$d_wait4'
24992 d_waitpid='$d_waitpid'
24993 d_wcscmp='$d_wcscmp'
24994 d_wcstombs='$d_wcstombs'
24995 d_wcsxfrm='$d_wcsxfrm'
24996 d_wctomb='$d_wctomb'
24997 d_writev='$d_writev'
24998 d_xenix='$d_xenix'
24999 date='$date'
25000 db_hashtype='$db_hashtype'
25001 db_prefixtype='$db_prefixtype'
25002 db_version_major='$db_version_major'
25003 db_version_minor='$db_version_minor'
25004 db_version_patch='$db_version_patch'
25005 default_inc_excludes_dot='$default_inc_excludes_dot'
25006 direntrytype='$direntrytype'
25007 dlext='$dlext'
25008 dlsrc='$dlsrc'
25009 doubleinfbytes='$doubleinfbytes'
25010 doublekind='$doublekind'
25011 doublemantbits='$doublemantbits'
25012 doublenanbytes='$doublenanbytes'
25013 doublesize='$doublesize'
25014 drand01='$drand01'
25015 drand48_r_proto='$drand48_r_proto'
25016 dtrace='$dtrace'
25017 dtraceobject='$dtraceobject'
25018 dtracexnolibs='$dtracexnolibs'
25019 dynamic_ext='$dynamic_ext'
25020 eagain='$eagain'
25021 ebcdic='$ebcdic'
25022 echo='$echo'
25023 egrep='$egrep'
25024 emacs='$emacs'
25025 endgrent_r_proto='$endgrent_r_proto'
25026 endhostent_r_proto='$endhostent_r_proto'
25027 endnetent_r_proto='$endnetent_r_proto'
25028 endprotoent_r_proto='$endprotoent_r_proto'
25029 endpwent_r_proto='$endpwent_r_proto'
25030 endservent_r_proto='$endservent_r_proto'
25031 eunicefix='$eunicefix'
25032 exe_ext='$exe_ext'
25033 expr='$expr'
25034 extensions='$extensions'
25035 extern_C='$extern_C'
25036 extras='$extras'
25037 fflushNULL='$fflushNULL'
25038 fflushall='$fflushall'
25039 find='$find'
25040 firstmakefile='$firstmakefile'
25041 flex='$flex'
25042 fpossize='$fpossize'
25043 fpostype='$fpostype'
25044 freetype='$freetype'
25045 from='$from'
25046 full_ar='$full_ar'
25047 full_csh='$full_csh'
25048 full_sed='$full_sed'
25049 gccansipedantic='$gccansipedantic'
25050 gccosandvers='$gccosandvers'
25051 gccversion='$gccversion'
25052 getgrent_r_proto='$getgrent_r_proto'
25053 getgrgid_r_proto='$getgrgid_r_proto'
25054 getgrnam_r_proto='$getgrnam_r_proto'
25055 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
25056 gethostbyname_r_proto='$gethostbyname_r_proto'
25057 gethostent_r_proto='$gethostent_r_proto'
25058 getlogin_r_proto='$getlogin_r_proto'
25059 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
25060 getnetbyname_r_proto='$getnetbyname_r_proto'
25061 getnetent_r_proto='$getnetent_r_proto'
25062 getprotobyname_r_proto='$getprotobyname_r_proto'
25063 getprotobynumber_r_proto='$getprotobynumber_r_proto'
25064 getprotoent_r_proto='$getprotoent_r_proto'
25065 getpwent_r_proto='$getpwent_r_proto'
25066 getpwnam_r_proto='$getpwnam_r_proto'
25067 getpwuid_r_proto='$getpwuid_r_proto'
25068 getservbyname_r_proto='$getservbyname_r_proto'
25069 getservbyport_r_proto='$getservbyport_r_proto'
25070 getservent_r_proto='$getservent_r_proto'
25071 getspnam_r_proto='$getspnam_r_proto'
25072 gidformat='$gidformat'
25073 gidsign='$gidsign'
25074 gidsize='$gidsize'
25075 gidtype='$gidtype'
25076 glibpth='$glibpth'
25077 gmake='$gmake'
25078 gmtime_r_proto='$gmtime_r_proto'
25079 gnulibc_version='$gnulibc_version'
25080 grep='$grep'
25081 groupcat='$groupcat'
25082 groupstype='$groupstype'
25083 gzip='$gzip'
25084 h_fcntl='$h_fcntl'
25085 h_sysfile='$h_sysfile'
25086 hint='$hint'
25087 hostcat='$hostcat'
25088 hostgenerate='$hostgenerate'
25089 hostosname='$hostosname'
25090 hostperl='$hostperl'
25091 html1dir='$html1dir'
25092 html1direxp='$html1direxp'
25093 html3dir='$html3dir'
25094 html3direxp='$html3direxp'
25095 i16size='$i16size'
25096 i16type='$i16type'
25097 i32size='$i32size'
25098 i32type='$i32type'
25099 i64size='$i64size'
25100 i64type='$i64type'
25101 i8size='$i8size'
25102 i8type='$i8type'
25103 i_arpainet='$i_arpainet'
25104 i_assert='$i_assert'
25105 i_bfd='$i_bfd'
25106 i_bsdioctl='$i_bsdioctl'
25107 i_crypt='$i_crypt'
25108 i_db='$i_db'
25109 i_dbm='$i_dbm'
25110 i_dirent='$i_dirent'
25111 i_dlfcn='$i_dlfcn'
25112 i_execinfo='$i_execinfo'
25113 i_fcntl='$i_fcntl'
25114 i_fenv='$i_fenv'
25115 i_float='$i_float'
25116 i_fp='$i_fp'
25117 i_fp_class='$i_fp_class'
25118 i_gdbm='$i_gdbm'
25119 i_gdbm_ndbm='$i_gdbm_ndbm'
25120 i_gdbmndbm='$i_gdbmndbm'
25121 i_grp='$i_grp'
25122 i_ieeefp='$i_ieeefp'
25123 i_inttypes='$i_inttypes'
25124 i_langinfo='$i_langinfo'
25125 i_libutil='$i_libutil'
25126 i_limits='$i_limits'
25127 i_locale='$i_locale'
25128 i_machcthr='$i_machcthr'
25129 i_malloc='$i_malloc'
25130 i_mallocmalloc='$i_mallocmalloc'
25131 i_math='$i_math'
25132 i_memory='$i_memory'
25133 i_mntent='$i_mntent'
25134 i_ndbm='$i_ndbm'
25135 i_netdb='$i_netdb'
25136 i_neterrno='$i_neterrno'
25137 i_netinettcp='$i_netinettcp'
25138 i_niin='$i_niin'
25139 i_poll='$i_poll'
25140 i_prot='$i_prot'
25141 i_pthread='$i_pthread'
25142 i_pwd='$i_pwd'
25143 i_quadmath='$i_quadmath'
25144 i_rpcsvcdbm='$i_rpcsvcdbm'
25145 i_sgtty='$i_sgtty'
25146 i_shadow='$i_shadow'
25147 i_socks='$i_socks'
25148 i_stdarg='$i_stdarg'
25149 i_stdbool='$i_stdbool'
25150 i_stddef='$i_stddef'
25151 i_stdint='$i_stdint'
25152 i_stdlib='$i_stdlib'
25153 i_string='$i_string'
25154 i_sunmath='$i_sunmath'
25155 i_sysaccess='$i_sysaccess'
25156 i_sysdir='$i_sysdir'
25157 i_sysfile='$i_sysfile'
25158 i_sysfilio='$i_sysfilio'
25159 i_sysin='$i_sysin'
25160 i_sysioctl='$i_sysioctl'
25161 i_syslog='$i_syslog'
25162 i_sysmman='$i_sysmman'
25163 i_sysmode='$i_sysmode'
25164 i_sysmount='$i_sysmount'
25165 i_sysndir='$i_sysndir'
25166 i_sysparam='$i_sysparam'
25167 i_syspoll='$i_syspoll'
25168 i_sysresrc='$i_sysresrc'
25169 i_syssecrt='$i_syssecrt'
25170 i_sysselct='$i_sysselct'
25171 i_syssockio='$i_syssockio'
25172 i_sysstat='$i_sysstat'
25173 i_sysstatfs='$i_sysstatfs'
25174 i_sysstatvfs='$i_sysstatvfs'
25175 i_systime='$i_systime'
25176 i_systimek='$i_systimek'
25177 i_systimes='$i_systimes'
25178 i_systypes='$i_systypes'
25179 i_sysuio='$i_sysuio'
25180 i_sysun='$i_sysun'
25181 i_sysutsname='$i_sysutsname'
25182 i_sysvfs='$i_sysvfs'
25183 i_syswait='$i_syswait'
25184 i_termio='$i_termio'
25185 i_termios='$i_termios'
25186 i_time='$i_time'
25187 i_unistd='$i_unistd'
25188 i_ustat='$i_ustat'
25189 i_utime='$i_utime'
25190 i_values='$i_values'
25191 i_varargs='$i_varargs'
25192 i_varhdr='$i_varhdr'
25193 i_vfork='$i_vfork'
25194 i_xlocale='$i_xlocale'
25195 ignore_versioned_solibs='$ignore_versioned_solibs'
25196 inc_version_list='$inc_version_list'
25197 inc_version_list_init='$inc_version_list_init'
25198 incpath='$incpath'
25199 incpth='$incpth'
25200 inews='$inews'
25201 initialinstalllocation='$initialinstalllocation'
25202 installarchlib='$installarchlib'
25203 installbin='$installbin'
25204 installhtml1dir='$installhtml1dir'
25205 installhtml3dir='$installhtml3dir'
25206 installman1dir='$installman1dir'
25207 installman3dir='$installman3dir'
25208 installprefix='$installprefix'
25209 installprefixexp='$installprefixexp'
25210 installprivlib='$installprivlib'
25211 installscript='$installscript'
25212 installsitearch='$installsitearch'
25213 installsitebin='$installsitebin'
25214 installsitehtml1dir='$installsitehtml1dir'
25215 installsitehtml3dir='$installsitehtml3dir'
25216 installsitelib='$installsitelib'
25217 installsiteman1dir='$installsiteman1dir'
25218 installsiteman3dir='$installsiteman3dir'
25219 installsitescript='$installsitescript'
25220 installstyle='$installstyle'
25221 installusrbinperl='$installusrbinperl'
25222 installvendorarch='$installvendorarch'
25223 installvendorbin='$installvendorbin'
25224 installvendorhtml1dir='$installvendorhtml1dir'
25225 installvendorhtml3dir='$installvendorhtml3dir'
25226 installvendorlib='$installvendorlib'
25227 installvendorman1dir='$installvendorman1dir'
25228 installvendorman3dir='$installvendorman3dir'
25229 installvendorscript='$installvendorscript'
25230 intsize='$intsize'
25231 issymlink='$issymlink'
25232 ivdformat='$ivdformat'
25233 ivsize='$ivsize'
25234 ivtype='$ivtype'
25235 known_extensions='$known_extensions'
25236 ksh='$ksh'
25237 ld='$ld'
25238 ld_can_script='$ld_can_script'
25239 lddlflags='$lddlflags'
25240 ldflags='$ldflags'
25241 ldflags_uselargefiles='$ldflags_uselargefiles'
25242 ldlibpthname='$ldlibpthname'
25243 less='$less'
25244 lib_ext='$lib_ext'
25245 libc='$libc'
25246 libperl='$libperl'
25247 libpth='$libpth'
25248 libs='$libs'
25249 libsdirs='$libsdirs'
25250 libsfiles='$libsfiles'
25251 libsfound='$libsfound'
25252 libspath='$libspath'
25253 libswanted='$libswanted'
25254 libswanted_uselargefiles='$libswanted_uselargefiles'
25255 line='$line'
25256 lint='$lint'
25257 lkflags='$lkflags'
25258 ln='$ln'
25259 lns='$lns'
25260 localtime_r_proto='$localtime_r_proto'
25261 locincpth='$locincpth'
25262 loclibpth='$loclibpth'
25263 longdblinfbytes='$longdblinfbytes'
25264 longdblkind='$longdblkind'
25265 longdblmantbits='$longdblmantbits'
25266 longdblnanbytes='$longdblnanbytes'
25267 longdblsize='$longdblsize'
25268 longlongsize='$longlongsize'
25269 longsize='$longsize'
25270 lp='$lp'
25271 lpr='$lpr'
25272 ls='$ls'
25273 lseeksize='$lseeksize'
25274 lseektype='$lseektype'
25275 mail='$mail'
25276 mailx='$mailx'
25277 make='$make'
25278 make_set_make='$make_set_make'
25279 mallocobj='$mallocobj'
25280 mallocsrc='$mallocsrc'
25281 malloctype='$malloctype'
25282 man1dir='$man1dir'
25283 man1direxp='$man1direxp'
25284 man1ext='$man1ext'
25285 man3dir='$man3dir'
25286 man3direxp='$man3direxp'
25287 man3ext='$man3ext'
25288 mips_type='$mips_type'
25289 mistrustnm='$mistrustnm'
25290 mkdir='$mkdir'
25291 mmaptype='$mmaptype'
25292 modetype='$modetype'
25293 more='$more'
25294 multiarch='$multiarch'
25295 mv='$mv'
25296 myarchname='$myarchname'
25297 mydomain='$mydomain'
25298 myhostname='$myhostname'
25299 myuname='$myuname'
25300 n='$n'
25301 need_va_copy='$need_va_copy'
25302 netdb_hlen_type='$netdb_hlen_type'
25303 netdb_host_type='$netdb_host_type'
25304 netdb_name_type='$netdb_name_type'
25305 netdb_net_type='$netdb_net_type'
25306 nm='$nm'
25307 nm_opt='$nm_opt'
25308 nm_so_opt='$nm_so_opt'
25309 nonxs_ext='$nonxs_ext'
25310 nroff='$nroff'
25311 nvEUformat='$nvEUformat'
25312 nvFUformat='$nvFUformat'
25313 nvGUformat='$nvGUformat'
25314 nv_overflows_integers_at='$nv_overflows_integers_at'
25315 nv_preserves_uv_bits='$nv_preserves_uv_bits'
25316 nveformat='$nveformat'
25317 nvfformat='$nvfformat'
25318 nvgformat='$nvgformat'
25319 nvmantbits='$nvmantbits'
25320 nvsize='$nvsize'
25321 nvtype='$nvtype'
25322 o_nonblock='$o_nonblock'
25323 obj_ext='$obj_ext'
25324 old_pthread_create_joinable='$old_pthread_create_joinable'
25325 optimize='$optimize'
25326 orderlib='$orderlib'
25327 osname='$osname'
25328 osvers='$osvers'
25329 otherlibdirs='$otherlibdirs'
25330 package='$package'
25331 pager='$pager'
25332 passcat='$passcat'
25333 patchlevel='$patchlevel'
25334 path_sep='$path_sep'
25335 perl5='$perl5'
25336 perl='$perl'
25337 perl_patchlevel='$perl_patchlevel'
25338 perl_static_inline='$perl_static_inline'
25339 perladmin='$perladmin'
25340 perllibs='$perllibs'
25341 perlpath='$perlpath'
25342 pg='$pg'
25343 phostname='$phostname'
25344 pidtype='$pidtype'
25345 plibpth='$plibpth'
25346 pmake='$pmake'
25347 pr='$pr'
25348 prefix='$prefix'
25349 prefixexp='$prefixexp'
25350 privlib='$privlib'
25351 privlibexp='$privlibexp'
25352 procselfexe='$procselfexe'
25353 prototype='$prototype'
25354 ptrsize='$ptrsize'
25355 quadkind='$quadkind'
25356 quadtype='$quadtype'
25357 randbits='$randbits'
25358 randfunc='$randfunc'
25359 random_r_proto='$random_r_proto'
25360 randseedtype='$randseedtype'
25361 ranlib='$ranlib'
25362 rd_nodata='$rd_nodata'
25363 readdir64_r_proto='$readdir64_r_proto'
25364 readdir_r_proto='$readdir_r_proto'
25365 revision='$revision'
25366 rm='$rm'
25367 rm_try='$rm_try'
25368 rmail='$rmail'
25369 run='$run'
25370 runnm='$runnm'
25371 sGMTIME_max='$sGMTIME_max'
25372 sGMTIME_min='$sGMTIME_min'
25373 sLOCALTIME_max='$sLOCALTIME_max'
25374 sLOCALTIME_min='$sLOCALTIME_min'
25375 sPRIEUldbl='$sPRIEUldbl'
25376 sPRIFUldbl='$sPRIFUldbl'
25377 sPRIGUldbl='$sPRIGUldbl'
25378 sPRIXU64='$sPRIXU64'
25379 sPRId64='$sPRId64'
25380 sPRIeldbl='$sPRIeldbl'
25381 sPRIfldbl='$sPRIfldbl'
25382 sPRIgldbl='$sPRIgldbl'
25383 sPRIi64='$sPRIi64'
25384 sPRIo64='$sPRIo64'
25385 sPRIu64='$sPRIu64'
25386 sPRIx64='$sPRIx64'
25387 sSCNfldbl='$sSCNfldbl'
25388 sched_yield='$sched_yield'
25389 scriptdir='$scriptdir'
25390 scriptdirexp='$scriptdirexp'
25391 sed='$sed'
25392 seedfunc='$seedfunc'
25393 selectminbits='$selectminbits'
25394 selecttype='$selecttype'
25395 sendmail='$sendmail'
25396 setgrent_r_proto='$setgrent_r_proto'
25397 sethostent_r_proto='$sethostent_r_proto'
25398 setlocale_r_proto='$setlocale_r_proto'
25399 setnetent_r_proto='$setnetent_r_proto'
25400 setprotoent_r_proto='$setprotoent_r_proto'
25401 setpwent_r_proto='$setpwent_r_proto'
25402 setservent_r_proto='$setservent_r_proto'
25403 sh='$sh'
25404 shar='$shar'
25405 sharpbang='$sharpbang'
25406 shmattype='$shmattype'
25407 shortsize='$shortsize'
25408 shrpenv='$shrpenv'
25409 shsharp='$shsharp'
25410 sig_count='$sig_count'
25411 sig_name='$sig_name'
25412 sig_name_init='$sig_name_init'
25413 sig_num='$sig_num'
25414 sig_num_init='$sig_num_init'
25415 sig_size='$sig_size'
25416 signal_t='$signal_t'
25417 sitearch='$sitearch'
25418 sitearchexp='$sitearchexp'
25419 sitebin='$sitebin'
25420 sitebinexp='$sitebinexp'
25421 sitehtml1dir='$sitehtml1dir'
25422 sitehtml1direxp='$sitehtml1direxp'
25423 sitehtml3dir='$sitehtml3dir'
25424 sitehtml3direxp='$sitehtml3direxp'
25425 sitelib='$sitelib'
25426 sitelib_stem='$sitelib_stem'
25427 sitelibexp='$sitelibexp'
25428 siteman1dir='$siteman1dir'
25429 siteman1direxp='$siteman1direxp'
25430 siteman3dir='$siteman3dir'
25431 siteman3direxp='$siteman3direxp'
25432 siteprefix='$siteprefix'
25433 siteprefixexp='$siteprefixexp'
25434 sitescript='$sitescript'
25435 sitescriptexp='$sitescriptexp'
25436 sizesize='$sizesize'
25437 sizetype='$sizetype'
25438 sleep='$sleep'
25439 smail='$smail'
25440 so='$so'
25441 sockethdr='$sockethdr'
25442 socketlib='$socketlib'
25443 socksizetype='$socksizetype'
25444 sort='$sort'
25445 spackage='$spackage'
25446 spitshell='$spitshell'
25447 srand48_r_proto='$srand48_r_proto'
25448 srandom_r_proto='$srandom_r_proto'
25449 src='$src'
25450 ssizetype='$ssizetype'
25451 st_ino_sign='$st_ino_sign'
25452 st_ino_size='$st_ino_size'
25453 startperl='$startperl'
25454 startsh='$startsh'
25455 static_ext='$static_ext'
25456 stdchar='$stdchar'
25457 stdio_base='$stdio_base'
25458 stdio_bufsiz='$stdio_bufsiz'
25459 stdio_cnt='$stdio_cnt'
25460 stdio_filbuf='$stdio_filbuf'
25461 stdio_ptr='$stdio_ptr'
25462 stdio_stream_array='$stdio_stream_array'
25463 strerror_r_proto='$strerror_r_proto'
25464 strings='$strings'
25465 submit='$submit'
25466 subversion='$subversion'
25467 sysman='$sysman'
25468 sysroot='$sysroot'
25469 tail='$tail'
25470 tar='$tar'
25471 targetarch='$targetarch'
25472 targetdir='$targetdir'
25473 targetenv='$targetenv'
25474 targethost='$targethost'
25475 targetmkdir='$targetmkdir'
25476 targetport='$targetport'
25477 targetsh='$targetsh'
25478 tbl='$tbl'
25479 tee='$tee'
25480 test='$test'
25481 timeincl='$timeincl'
25482 timetype='$timetype'
25483 tmpnam_r_proto='$tmpnam_r_proto'
25484 to='$to'
25485 touch='$touch'
25486 tr='$tr'
25487 trnl='$trnl'
25488 troff='$troff'
25489 ttyname_r_proto='$ttyname_r_proto'
25490 u16size='$u16size'
25491 u16type='$u16type'
25492 u32size='$u32size'
25493 u32type='$u32type'
25494 u64size='$u64size'
25495 u64type='$u64type'
25496 u8size='$u8size'
25497 u8type='$u8type'
25498 uidformat='$uidformat'
25499 uidsign='$uidsign'
25500 uidsize='$uidsize'
25501 uidtype='$uidtype'
25502 uname='$uname'
25503 uniq='$uniq'
25504 uquadtype='$uquadtype'
25505 use5005threads='$use5005threads'
25506 use64bitall='$use64bitall'
25507 use64bitint='$use64bitint'
25508 usecbacktrace='$usecbacktrace'
25509 usecrosscompile='$usecrosscompile'
25510 usedevel='$usedevel'
25511 usedl='$usedl'
25512 usedtrace='$usedtrace'
25513 usefaststdio='$usefaststdio'
25514 useithreads='$useithreads'
25515 usekernprocpathname='$usekernprocpathname'
25516 uselargefiles='$uselargefiles'
25517 uselongdouble='$uselongdouble'
25518 usemallocwrap='$usemallocwrap'
25519 usemorebits='$usemorebits'
25520 usemultiplicity='$usemultiplicity'
25521 usemymalloc='$usemymalloc'
25522 usenm='$usenm'
25523 usensgetexecutablepath='$usensgetexecutablepath'
25524 useopcode='$useopcode'
25525 useperlio='$useperlio'
25526 useposix='$useposix'
25527 usequadmath='$usequadmath'
25528 usereentrant='$usereentrant'
25529 userelocatableinc='$userelocatableinc'
25530 useshrplib='$useshrplib'
25531 usesitecustomize='$usesitecustomize'
25532 usesocks='$usesocks'
25533 usethreads='$usethreads'
25534 usevendorprefix='$usevendorprefix'
25535 useversionedarchname='$useversionedarchname'
25536 usevfork='$usevfork'
25537 usrinc='$usrinc'
25538 uuname='$uuname'
25539 uvXUformat='$uvXUformat'
25540 uvoformat='$uvoformat'
25541 uvsize='$uvsize'
25542 uvtype='$uvtype'
25543 uvuformat='$uvuformat'
25544 uvxformat='$uvxformat'
25545 vaproto='$vaproto'
25546 vendorarch='$vendorarch'
25547 vendorarchexp='$vendorarchexp'
25548 vendorbin='$vendorbin'
25549 vendorbinexp='$vendorbinexp'
25550 vendorhtml1dir='$vendorhtml1dir'
25551 vendorhtml1direxp='$vendorhtml1direxp'
25552 vendorhtml3dir='$vendorhtml3dir'
25553 vendorhtml3direxp='$vendorhtml3direxp'
25554 vendorlib='$vendorlib'
25555 vendorlib_stem='$vendorlib_stem'
25556 vendorlibexp='$vendorlibexp'
25557 vendorman1dir='$vendorman1dir'
25558 vendorman1direxp='$vendorman1direxp'
25559 vendorman3dir='$vendorman3dir'
25560 vendorman3direxp='$vendorman3direxp'
25561 vendorprefix='$vendorprefix'
25562 vendorprefixexp='$vendorprefixexp'
25563 vendorscript='$vendorscript'
25564 vendorscriptexp='$vendorscriptexp'
25565 version='$version'
25566 version_patchlevel_string='$version_patchlevel_string'
25567 versiononly='$versiononly'
25568 vi='$vi'
25569 xlibpth='$xlibpth'
25570 yacc='$yacc'
25571 yaccflags='$yaccflags'
25572 zcat='$zcat'
25573 zip='$zip'
25574 EOT
25575
25576 : add special variables
25577 $test -f $src/patchlevel.h && \
25578 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
25579 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
25580 echo "PERL_CONFIG_SH=true" >>config.sh
25581
25582 : propagate old symbols
25583 if $test -f UU/config.sh; then
25584         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
25585         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
25586                 config.sh config.sh UU/oldconfig.sh |\
25587                 $sort | $uniq -u >UU/oldsyms
25588         set X `$cat UU/oldsyms`
25589         shift
25590         case $# in
25591         0) ;;
25592         *)
25593                 $cat <<EOM
25594 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
25595 EOM
25596                 echo ": Variables propagated from previous config.sh file." >>config.sh
25597                 for sym in `$cat UU/oldsyms`; do
25598                         echo "    Propagating $hint variable "'$'"$sym..."
25599                         eval 'tmp="$'"${sym}"'"'
25600                         echo "$tmp" | \
25601                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
25602                 done
25603                 ;;
25604         esac
25605 fi
25606
25607 : preserve RCS keywords in files with variable substitution, grrr
25608 Id='$Id'
25609
25610 : Finish up by extracting the .SH files
25611 case "$alldone" in
25612 exit)
25613         echo "Stopping at your request, leaving temporary files around."
25614         exit 0
25615         ;;
25616 cont)
25617         ;;
25618 '')
25619         dflt=''
25620         nostick=true
25621         $cat <<EOM
25622
25623 If you'd like to make any changes to the config.sh file before I begin
25624 to configure things, do it as a shell escape now (e.g. !vi config.sh).
25625
25626 EOM
25627         rp="Press return or use a shell escape to edit config.sh:"
25628         . UU/myread
25629         nostick=''
25630         case "$ans" in
25631         '') ;;
25632         *) : in case they cannot read
25633                 sh 1>&4 -c "$ans";;
25634         esac
25635         ;;
25636 esac
25637
25638 : if this fails, just run all the .SH files by hand
25639 . ./config.sh
25640
25641 echo " "
25642 exec 1>&4
25643 pwd=`pwd`
25644 . ./UU/extract
25645 cd "$pwd"
25646
25647 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
25648         dflt=y
25649         case "$silent" in
25650         true) ;;
25651         *)
25652                 $cat <<EOM
25653
25654 Now you need to generate make dependencies by running "$make depend".
25655 You might prefer to run it in background: "$make depend > makedepend.out &"
25656 It can take a while, so you might not want to run it right now.
25657
25658 EOM
25659                 ;;
25660         esac
25661         rp="Run $make depend now?"
25662         . UU/myread
25663         case "$ans" in
25664         y*)
25665                 $make depend && echo "Now you must run '$make'."
25666                 ;;
25667         *)
25668                 echo "You must run '$make depend' then '$make'."
25669                 ;;
25670         esac
25671 elif test -f [Mm]akefile; then
25672         echo " "
25673         echo "Now you must run a $make."
25674 else
25675         echo "Configure done."
25676 fi
25677
25678 if $test -f Policy.sh; then
25679     $cat <<EOM
25680
25681 If you compile $package on a different machine or from a different object
25682 directory, copy the Policy.sh file from this object directory to the
25683 new one before you run Configure -- this will help you with most of
25684 the policy defaults.
25685
25686 EOM
25687 fi
25688 if $test -f UU/config.msg; then
25689     echo "Hmm.  I also noted the following information while running:"
25690     echo " "
25691     $cat UU/config.msg >&4
25692 fi
25693 $rm -f kit*isdone ark*isdone
25694 $rm -rf UU
25695
25696 : End of Configure
25697