This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
utf8.c: use new SvPVCLEAR and constant string friendly macros
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # Note: this Configure script was generated automatically by the tool
15 # called "metaconfig". Rather than working with this copy of Configure,
16 # you may wish to get metaconfig. Perl uses a modified version of this
17 # tool, available in the "dist" folder in the checkout of the git repo
18 #    $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
19 # The original dist package (including metaconfig) is available via SVN:
20 #    $ svn co https://svn.code.sf.net/p/dist/code/trunk/dist
21 #
22 # Though this script was generated by metaconfig from metaunits, it is
23 # OK to send patches against Configure itself. It's up to the Configure
24 # pumpkin to backport the patch to the metaunits if it is accepted.
25 # For more information on patching Configure, see pod/perlhack.pod
26 #
27 # The metaunits are also available from the public git repository:
28 #     http://perl5.git.perl.org/metaconfig.git/ or
29 #     $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
30 #
31 # See Porting/pumpkin.pod for more information on metaconfig.
32
33 # Generated using [metaconfig 3.5 PL0]
34 # (with additional metaconfig patches by perlbug@perl.org)
35
36 cat >c1$$ <<EOF
37 ARGGGHHHH!!!!!
38
39 SCO csh still thinks true is false.  Write to SCO today and tell them that next
40 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
41
42 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
43 we'd have to do is go in and swap the && and || tokens, wherever they are.)
44
45 [End of diatribe. We now return you to your regularly scheduled programming...]
46 EOF
47 cat >c2$$ <<EOF
48
49 OOPS!  You naughty creature!  You didn't run Configure with sh!
50 I will attempt to remedy the situation by running sh for you...
51 EOF
52
53 true || cat c1$$ c2$$
54 true || exec sh $0 $argv:q
55
56 (exit $?0) || cat c2$$
57 (exit $?0) || exec sh $0 $argv:q
58 rm -f c1$$ c2$$
59
60 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
61         cat <<EOF
62 ***
63 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
64 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
65 *** Please read the README.plan9 for further instructions.
66 *** Cannot continue, aborting.
67 ***
68 EOF
69         exit 1
70 fi
71
72 if test -f /sys/utilities/MultiView ; then
73         # AmigaOS, test -c for /dev/null is not useful
74         :
75 elif test ! -c /dev/null ; then
76         cat <<EOF
77 ***
78 *** I'm sorry, but /dev/null appears to be a file rather than a device.
79 *** Please consult your operating sytem's notes for making a device
80 *** in /dev.
81 *** Cannot continue, aborting.
82 ***
83 EOF
84         exit 1
85 fi
86
87 : compute my invocation name
88 me=$0
89 case "$0" in
90 */*)
91         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
92         test "$me" || me=$0
93         ;;
94 esac
95
96 : Proper separator for the PATH environment variable
97 p_=:
98 : On OS/2 this directory should exist if this is not floppy only system ":-]"
99 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' 2>&1 ) 2>&1 >/dev/null ; then
100         if test -n "$OS2_SHELL"; then
101                 p_=\;
102                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
103                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
104                 is_os2=yes
105         elif test -n "$DJGPP"; then
106                 case "X${MACHTYPE:-nonesuchmach}" in
107                 *cygwin|*msys) ;;
108                 *) p_=\; ;;
109                 esac
110         fi
111 fi
112
113 : Proper PATH setting
114 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
115 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
116 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
117 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
118 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
119 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
120 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
121 paths="$paths /sbin /usr/sbin /usr/libexec"
122 paths="$paths /system/gnu_library/bin"
123
124 for p in $paths
125 do
126         case "$p_$PATH$p_" in
127         *$p_$p$p_*) ;;
128         *) test -d $p && PATH=$PATH$p_$p ;;
129         esac
130 done
131
132 PATH=.$p_$PATH
133 export PATH
134
135 : shall we be using ksh?
136 inksh=''
137 needksh=''
138 avoidksh=''
139 newsh=/bin/ksh
140 changesh=''
141 if (PATH=.; alias -x) >/dev/null 2>&1; then
142                 inksh=true
143 fi
144 if test -f /hp-ux -a -f /bin/ksh; then
145         needksh='to avoid sh bug in "here document" expansion'
146 fi
147 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
148         if test X`/usr/bin/uname -v` = X4; then
149                 avoidksh="to avoid AIX 4's /bin/sh"
150                 newsh=/usr/bin/bsh
151         fi
152 fi
153 if test -f /osf_boot -a -f /usr/sbin/setld; then
154         if test X`/usr/bin/uname -s` = XOSF1; then
155                 avoidksh="to avoid Digital UNIX' ksh"
156                 newsh=/bin/sh
157                 unset BIN_SH
158         fi
159 fi
160 case "$inksh/$needksh" in
161 /[a-z]*)
162                 ENV=''
163                 changesh=true
164                 reason="$needksh"
165         ;;
166 esac
167 case "$inksh/$avoidksh" in
168 true/[a-z]*)
169         changesh=true
170         reason="$avoidksh"
171         ;;
172 esac
173 case "$inksh/$needksh-$avoidksh-" in
174 true/--)
175                 cat <<EOM
176 (I see you are using the Korn shell.  Some ksh's blow up on $me,
177 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
178 EOM
179         ;;
180 esac
181 case "$changesh" in
182 true)
183         export newsh
184         echo "(Feeding myself to $newsh $reason.)"
185         case "$0" in
186         Configure|*/Configure) exec $newsh $0 "$@";;
187         *) exec $newsh Configure "$@";;
188         esac
189         ;;
190 esac
191 test -x "${newsh}" || unset newsh
192
193 : if needed, set CDPATH to a harmless value that is not chatty
194 : avoid bash 2.02 problems with empty CDPATH.
195 case "$CDPATH" in
196 '')     ;;
197 *)      case "$SHELL" in
198         *bash*) CDPATH='.' ;;
199         *) CDPATH='' ;;
200         esac
201         ;;
202 esac
203
204 : Configure runs within the UU subdirectory
205 test -d UU || mkdir UU
206 cd UU && rm -f ./*
207
208 ccname=''
209 ccversion=''
210 ccsymbols=''
211 cppccsymbols=''
212 cppsymbols=''
213 from=''
214 hostgenerate=''
215 hostosname=''
216 hostperl=''
217 run=''
218 targetarch=''
219 targetdir=''
220 targetenv=''
221 targethost=''
222 targetmkdir=''
223 targetport=''
224 to=''
225 usecrosscompile=''
226 extern_C=''
227 mistrustnm=''
228 usedevel=''
229 perllibs=''
230 dynamic_ext=''
231 extensions=''
232 known_extensions=''
233 nonxs_ext=''
234 static_ext=''
235 useopcode=''
236 useposix=''
237 extras=''
238 d_bsd=''
239 d_eunice=''
240 d_xenix=''
241 eunicefix=''
242 ar=''
243 awk=''
244 bash=''
245 bison=''
246 byacc=''
247 cat=''
248 chgrp=''
249 chmod=''
250 chown=''
251 comm=''
252 compress=''
253 cp=''
254 cpio=''
255 cpp=''
256 csh=''
257 date=''
258 echo=''
259 egrep=''
260 emacs=''
261 expr=''
262 find=''
263 flex=''
264 gmake=''
265 grep=''
266 gzip=''
267 inews=''
268 ksh=''
269 less=''
270 line=''
271 lint=''
272 ln=''
273 lp=''
274 lpr=''
275 ls=''
276 mail=''
277 mailx=''
278 make=''
279 mkdir=''
280 more=''
281 mv=''
282 nm=''
283 nroff=''
284 perl=''
285 pg=''
286 pmake=''
287 pr=''
288 rm=''
289 rmail=''
290 sed=''
291 sendmail=''
292 shar=''
293 sleep=''
294 smail=''
295 sort=''
296 submit=''
297 tail=''
298 tar=''
299 tbl=''
300 tee=''
301 test=''
302 touch=''
303 tr=''
304 troff=''
305 uname=''
306 uniq=''
307 uuname=''
308 vi=''
309 zcat=''
310 zip=''
311 full_ar=''
312 full_sed=''
313 libswanted=''
314 hint=''
315 myuname=''
316 osname=''
317 osvers=''
318 Author=''
319 Date=''
320 Header=''
321 Id=''
322 Locker=''
323 Log=''
324 RCSfile=''
325 Revision=''
326 Source=''
327 State=''
328 sysroot=''
329 _a=''
330 _exe=''
331 _o=''
332 archobjs=''
333 exe_ext=''
334 firstmakefile=''
335 lib_ext=''
336 obj_ext=''
337 path_sep=''
338 rm_try=''
339 afs=''
340 afsroot=''
341 alignbytes=''
342 ansi2knr=''
343 archlib=''
344 archlibexp=''
345 d_archlib=''
346 installarchlib=''
347 archname=''
348 myarchname=''
349 useversionedarchname=''
350 d_atolf=''
351 d_atoll=''
352 baserev=''
353 bin=''
354 binexp=''
355 initialinstalllocation=''
356 installbin=''
357 userelocatableinc=''
358 byteorder=''
359 cc=''
360 ccflags=''
361 cppflags=''
362 ldflags=''
363 lkflags=''
364 locincpth=''
365 optimize=''
366 cf_email=''
367 cf_by=''
368 cf_time=''
369 charbits=''
370 charsize=''
371 contains=''
372 cpp_stuff=''
373 cpplast=''
374 cppminus=''
375 cpprun=''
376 cppstdin=''
377 d__fwalk=''
378 d_access=''
379 d_accessx=''
380 d_acosh=''
381 d_aintl=''
382 d_alarm=''
383 asctime_r_proto=''
384 d_asctime_r=''
385 d_asinh=''
386 d_atanh=''
387 d_attribute_deprecated=''
388 d_attribute_format=''
389 d_attribute_malloc=''
390 d_attribute_nonnull=''
391 d_attribute_noreturn=''
392 d_attribute_pure=''
393 d_attribute_unused=''
394 d_attribute_warn_unused_result=''
395 d_printf_format_null=''
396 d_backtrace=''
397 d_bcmp=''
398 d_bcopy=''
399 d_builtin_choose_expr=''
400 d_builtin_expect=''
401 d_bzero=''
402 d_c99_variadic_macros=''
403 d_casti32=''
404 castflags=''
405 d_castneg=''
406 d_cbrt=''
407 d_chown=''
408 d_chroot=''
409 d_chsize=''
410 d_class=''
411 d_clearenv=''
412 d_closedir=''
413 d_void_closedir=''
414 d_cmsghdr_s=''
415 d_const=''
416 d_copysign=''
417 d_copysignl=''
418 d_cplusplus=''
419 cryptlib=''
420 d_crypt=''
421 crypt_r_proto=''
422 d_crypt_r=''
423 d_csh=''
424 full_csh=''
425 d_ctermid=''
426 ctermid_r_proto=''
427 d_ctermid_r=''
428 ctime_r_proto=''
429 d_ctime_r=''
430 d_cuserid=''
431 d_dbl_dig=''
432 d_dbminitproto=''
433 d_difftime=''
434 d_dir_dd_fd=''
435 d_dirfd=''
436 d_dladdr=''
437 d_dlerror=''
438 d_dlopen=''
439 d_dlsymun=''
440 d_dosuid=''
441 d_suidsafe=''
442 d_drand48_r=''
443 drand48_r_proto=''
444 d_drand48proto=''
445 d_dup2=''
446 d_eaccess=''
447 d_endgrent=''
448 d_endgrent_r=''
449 endgrent_r_proto=''
450 d_endhent=''
451 d_endhostent_r=''
452 endhostent_r_proto=''
453 d_endnent=''
454 d_endnetent_r=''
455 endnetent_r_proto=''
456 d_endpent=''
457 d_endprotoent_r=''
458 endprotoent_r_proto=''
459 d_endpwent=''
460 d_endpwent_r=''
461 endpwent_r_proto=''
462 d_endsent=''
463 d_endservent_r=''
464 endservent_r_proto=''
465 d_erf=''
466 d_erfc=''
467 d_exp2=''
468 d_expm1=''
469 d_faststdio=''
470 d_fchdir=''
471 d_fchmod=''
472 d_fchown=''
473 d_fcntl=''
474 d_fcntl_can_lock=''
475 d_fd_macros=''
476 d_fd_set=''
477 d_fds_bits=''
478 d_fdclose=''
479 d_fdim=''
480 d_fegetround=''
481 d_fgetpos=''
482 d_finite=''
483 d_finitel=''
484 d_flexfnam=''
485 d_flock=''
486 d_flockproto=''
487 d_fma=''
488 d_fmax=''
489 d_fmin=''
490 d_fork=''
491 d_fp_class=''
492 d_fp_classl=''
493 d_fpclass=''
494 d_fp_classify=''
495 d_fpclassify=''
496 d_fpclassl=''
497 d_fpgetround=''
498 d_fpos64_t=''
499 d_frexpl=''
500 d_fs_data_s=''
501 d_fseeko=''
502 d_fsetpos=''
503 d_fstatfs=''
504 d_fsync=''
505 d_ftello=''
506 d_ftime=''
507 d_gettimeod=''
508 d_futimes=''
509 d_gai_strerror=''
510 d_Gconvert=''
511 d_getaddrinfo=''
512 d_getcwd=''
513 d_getespwnam=''
514 d_getfsstat=''
515 d_getgrent=''
516 d_getgrent_r=''
517 getgrent_r_proto=''
518 d_getgrgid_r=''
519 getgrgid_r_proto=''
520 d_getgrnam_r=''
521 getgrnam_r_proto=''
522 d_getgrps=''
523 d_gethbyaddr=''
524 d_gethbyname=''
525 d_gethent=''
526 aphostname=''
527 d_gethname=''
528 d_phostname=''
529 d_uname=''
530 d_gethostbyaddr_r=''
531 gethostbyaddr_r_proto=''
532 d_gethostbyname_r=''
533 gethostbyname_r_proto=''
534 d_gethostent_r=''
535 gethostent_r_proto=''
536 d_gethostprotos=''
537 d_getitimer=''
538 d_getlogin=''
539 d_getlogin_r=''
540 getlogin_r_proto=''
541 d_getmnt=''
542 d_getmntent=''
543 d_getnameinfo=''
544 d_getnbyaddr=''
545 d_getnbyname=''
546 d_getnent=''
547 d_getnetbyaddr_r=''
548 getnetbyaddr_r_proto=''
549 d_getnetbyname_r=''
550 getnetbyname_r_proto=''
551 d_getnetent_r=''
552 getnetent_r_proto=''
553 d_getnetprotos=''
554 d_getpagsz=''
555 d_getpent=''
556 d_getpgid=''
557 d_getpgrp2=''
558 d_bsdgetpgrp=''
559 d_getpgrp=''
560 d_getppid=''
561 d_getprior=''
562 d_getpbyname=''
563 d_getpbynumber=''
564 d_getprotobyname_r=''
565 getprotobyname_r_proto=''
566 d_getprotobynumber_r=''
567 getprotobynumber_r_proto=''
568 d_getprotoent_r=''
569 getprotoent_r_proto=''
570 d_getprotoprotos=''
571 d_getprpwnam=''
572 d_getpwent=''
573 d_getpwent_r=''
574 getpwent_r_proto=''
575 d_getpwnam_r=''
576 getpwnam_r_proto=''
577 d_getpwuid_r=''
578 getpwuid_r_proto=''
579 d_getsent=''
580 d_getservbyname_r=''
581 getservbyname_r_proto=''
582 d_getservbyport_r=''
583 getservbyport_r_proto=''
584 d_getservent_r=''
585 getservent_r_proto=''
586 d_getservprotos=''
587 d_getspnam=''
588 d_getspnam_r=''
589 getspnam_r_proto=''
590 d_getsbyname=''
591 d_getsbyport=''
592 d_gmtime_r=''
593 gmtime_r_proto=''
594 d_gnulibc=''
595 gnulibc_version=''
596 d_hasmntopt=''
597 d_htonl=''
598 d_hypot=''
599 d_ilogb=''
600 d_ilogbl=''
601 d_inetaton=''
602 d_inetntop=''
603 d_inetpton=''
604 d_int64_t=''
605 d_isascii=''
606 d_isblank=''
607 d_isfinite=''
608 d_isfinitel=''
609 d_isinf=''
610 d_isinfl=''
611 d_isless=''
612 d_isnan=''
613 d_isnanl=''
614 d_isnormal=''
615 d_j0=''
616 d_j0l=''
617 d_killpg=''
618 d_lc_monetary_2008=''
619 d_lchown=''
620 d_ldbl_dig=''
621 d_lgamma=''
622 d_lgamma_r=''
623 d_libm_lib_version=''
624 d_link=''
625 d_llrint=''
626 d_llrintl=''
627 d_llround=''
628 d_llroundl=''
629 d_localtime_r=''
630 d_localtime_r_needs_tzset=''
631 localtime_r_proto=''
632 d_locconv=''
633 d_lockf=''
634 d_log1p=''
635 d_log2=''
636 d_logb=''
637 d_ldexpl=''
638 d_longdbl=''
639 longdblkind=''
640 longdblsize=''
641 d_longlong=''
642 longlongsize=''
643 d_lrint=''
644 d_lrintl=''
645 d_lround=''
646 d_lroundl=''
647 d_lseekproto=''
648 d_lstat=''
649 d_madvise=''
650 d_malloc_good_size=''
651 d_malloc_size=''
652 d_mblen=''
653 d_mbstowcs=''
654 d_mbtowc=''
655 d_memchr=''
656 d_memcmp=''
657 d_memcpy=''
658 d_memmem=''
659 d_memmove=''
660 d_memset=''
661 d_mkdir=''
662 d_mkdtemp=''
663 d_mkfifo=''
664 d_mkstemp=''
665 d_mkstemps=''
666 d_mktime=''
667 d_mmap=''
668 mmaptype=''
669 d_modfl=''
670 d_modflproto=''
671 d_mprotect=''
672 d_msg=''
673 d_msgctl=''
674 d_msgget=''
675 d_msghdr_s=''
676 d_msgrcv=''
677 d_msgsnd=''
678 d_msync=''
679 d_munmap=''
680 d_nan=''
681 d_nearbyint=''
682 d_duplocale=''
683 d_freelocale=''
684 d_newlocale=''
685 d_querylocale=''
686 d_uselocale=''
687 i_xlocale=''
688 d_nextafter=''
689 d_nexttoward=''
690 d_nice=''
691 d_nl_langinfo=''
692 d_off64_t=''
693 d_open3=''
694 d_fpathconf=''
695 d_pathconf=''
696 d_pause=''
697 d_pipe=''
698 d_poll=''
699 d_portable=''
700 d_prctl=''
701 d_prctl_set_name=''
702 d_procselfexe=''
703 procselfexe=''
704 d_old_pthread_create_joinable=''
705 old_pthread_create_joinable=''
706 d_pthread_atfork=''
707 d_pthread_attr_setscope=''
708 d_pthread_yield=''
709 d_sched_yield=''
710 sched_yield=''
711 d_ptrdiff_t=''
712 d_qgcvt=''
713 d_random_r=''
714 random_r_proto=''
715 d_readdir64_r=''
716 readdir64_r_proto=''
717 d_readdir=''
718 d_rewinddir=''
719 d_seekdir=''
720 d_telldir=''
721 d_readdir_r=''
722 readdir_r_proto=''
723 d_readlink=''
724 d_readv=''
725 d_recvmsg=''
726 d_re_comp=''
727 d_regcmp=''
728 d_regcomp=''
729 d_remainder=''
730 d_remquo=''
731 d_rename=''
732 d_rint=''
733 d_rmdir=''
734 d_round=''
735 d_safebcpy=''
736 d_safemcpy=''
737 d_sanemcmp=''
738 d_sbrkproto=''
739 d_scalbn=''
740 d_scalbnl=''
741 d_select=''
742 d_sem=''
743 d_semctl=''
744 d_semget=''
745 d_semop=''
746 d_sendmsg=''
747 d_setegid=''
748 d_seteuid=''
749 d_setgrent=''
750 d_setgrent_r=''
751 setgrent_r_proto=''
752 d_setgrps=''
753 d_sethent=''
754 d_sethostent_r=''
755 sethostent_r_proto=''
756 d_setitimer=''
757 d_setlinebuf=''
758 d_setlocale=''
759 d_setlocale_r=''
760 setlocale_r_proto=''
761 d_setnent=''
762 d_setnetent_r=''
763 setnetent_r_proto=''
764 d_setpent=''
765 d_setpgid=''
766 d_setpgrp2=''
767 d_bsdsetpgrp=''
768 d_setpgrp=''
769 d_setprior=''
770 d_setproctitle=''
771 d_setprotoent_r=''
772 setprotoent_r_proto=''
773 d_setpwent=''
774 d_setpwent_r=''
775 setpwent_r_proto=''
776 d_setregid=''
777 d_setresgid=''
778 d_setresuid=''
779 d_setreuid=''
780 d_setrgid=''
781 d_setruid=''
782 d_setsent=''
783 d_setservent_r=''
784 setservent_r_proto=''
785 d_setsid=''
786 d_setvbuf=''
787 d_shm=''
788 d_shmat=''
789 d_shmatprototype=''
790 shmattype=''
791 d_shmctl=''
792 d_shmdt=''
793 d_shmget=''
794 d_sigaction=''
795 d_siginfo_si_addr=''
796 d_siginfo_si_band=''
797 d_siginfo_si_errno=''
798 d_siginfo_si_fd=''
799 d_siginfo_si_pid=''
800 d_siginfo_si_status=''
801 d_siginfo_si_uid=''
802 d_siginfo_si_value=''
803 d_signbit=''
804 d_sigprocmask=''
805 d_sigsetjmp=''
806 usesitecustomize=''
807 d_snprintf=''
808 d_vsnprintf=''
809 d_sockatmark=''
810 d_sockatmarkproto=''
811 d_ip_mreq=''
812 d_ip_mreq_source=''
813 d_ipv6_mreq=''
814 d_ipv6_mreq_source=''
815 d_msg_ctrunc=''
816 d_msg_dontroute=''
817 d_msg_oob=''
818 d_msg_peek=''
819 d_msg_proxy=''
820 d_oldsock=''
821 d_scm_rights=''
822 d_sin6_scope_id=''
823 d_sockaddr_in6=''
824 d_sockaddr_sa_len=''
825 d_socket=''
826 d_sockpair=''
827 sockethdr=''
828 socketlib=''
829 d_socklen_t=''
830 d_socks5_init=''
831 d_sprintf_returns_strlen=''
832 d_sqrtl=''
833 d_srand48_r=''
834 srand48_r_proto=''
835 d_srandom_r=''
836 srandom_r_proto=''
837 d_sresgproto=''
838 d_sresuproto=''
839 d_stat=''
840 d_statblks=''
841 d_statfs_f_flags=''
842 d_statfs_s=''
843 d_static_inline=''
844 perl_static_inline=''
845 d_fstatvfs=''
846 d_statvfs=''
847 d_stdio_cnt_lval=''
848 d_stdio_ptr_lval=''
849 d_stdio_ptr_lval_nochange_cnt=''
850 d_stdio_ptr_lval_sets_cnt=''
851 d_stdiobase=''
852 d_stdstdio=''
853 stdio_base=''
854 stdio_bufsiz=''
855 stdio_cnt=''
856 stdio_filbuf=''
857 stdio_ptr=''
858 d_index=''
859 d_strchr=''
860 d_strcoll=''
861 d_strctcpy=''
862 d_strerrm=''
863 d_strerror=''
864 d_sysernlst=''
865 d_syserrlst=''
866 d_strerror_l=''
867 d_strerror_r=''
868 strerror_r_proto=''
869 d_strftime=''
870 d_strlcat=''
871 d_strlcpy=''
872 d_strtod=''
873 d_strtol=''
874 d_strtold=''
875 d_strtoll=''
876 d_strtoq=''
877 d_strtoul=''
878 d_strtoull=''
879 d_strtouq=''
880 d_strxfrm=''
881 d_symlink=''
882 d_syscall=''
883 d_syscallproto=''
884 d_sysconf=''
885 d_system=''
886 d_tcgetpgrp=''
887 d_tcsetpgrp=''
888 d_telldirproto=''
889 d_tgamma=''
890 d_time=''
891 timetype=''
892 d_asctime64=''
893 d_ctime64=''
894 d_difftime64=''
895 d_gmtime64=''
896 d_localtime64=''
897 d_mktime64=''
898 d_timegm=''
899 clocktype=''
900 d_times=''
901 d_tmpnam_r=''
902 tmpnam_r_proto=''
903 d_trunc=''
904 d_truncate=''
905 d_truncl=''
906 d_ttyname_r=''
907 ttyname_r_proto=''
908 d_tzname=''
909 d_u32align=''
910 d_ualarm=''
911 d_umask=''
912 d_semctl_semid_ds=''
913 d_semctl_semun=''
914 d_union_semun=''
915 d_unordered=''
916 d_unsetenv=''
917 d_usleep=''
918 d_usleepproto=''
919 d_ustat=''
920 d_pseudofork=''
921 d_vfork=''
922 usevfork=''
923 d_voidsig=''
924 signal_t=''
925 d_volatile=''
926 d_charvspr=''
927 d_vprintf=''
928 d_wait4=''
929 d_waitpid=''
930 d_wcscmp=''
931 d_wcstombs=''
932 d_wcsxfrm=''
933 d_wctomb=''
934 d_writev=''
935 dlext=''
936 bin_ELF=''
937 cccdlflags=''
938 ccdlflags=''
939 dlsrc=''
940 ld=''
941 ld_can_script=''
942 lddlflags=''
943 usedl=''
944 doublesize=''
945 dtraceobject=''
946 ebcdic=''
947 fflushNULL=''
948 fflushall=''
949 fpossize=''
950 fpostype=''
951 gccansipedantic=''
952 gccosandvers=''
953 gccversion=''
954 gidformat=''
955 gidsign=''
956 gidsize=''
957 gidtype=''
958 groupstype=''
959 h_fcntl=''
960 h_sysfile=''
961 html1dir=''
962 html1direxp=''
963 installhtml1dir=''
964 html3dir=''
965 html3direxp=''
966 installhtml3dir=''
967 i_arpainet=''
968 i_assert=''
969 i_bfd=''
970 i_crypt=''
971 db_hashtype=''
972 db_prefixtype=''
973 db_version_major=''
974 db_version_minor=''
975 db_version_patch=''
976 i_db=''
977 i_dbm=''
978 i_rpcsvcdbm=''
979 d_dirnamlen=''
980 direntrytype=''
981 i_dirent=''
982 i_dlfcn=''
983 i_execinfo=''
984 i_fcntl=''
985 i_fenv=''
986 i_float=''
987 i_fp=''
988 i_fp_class=''
989 i_gdbm=''
990 d_grpasswd=''
991 i_grp=''
992 i_ieeefp=''
993 i_inttypes=''
994 i_langinfo=''
995 i_libutil=''
996 i_limits=''
997 i_locale=''
998 i_machcthr=''
999 i_malloc=''
1000 i_mallocmalloc=''
1001 i_math=''
1002 i_memory=''
1003 i_mntent=''
1004 d_gdbm_ndbm_h_uses_prototypes=''
1005 d_gdbmndbm_h_uses_prototypes=''
1006 d_ndbm=''
1007 d_ndbm_h_uses_prototypes=''
1008 i_gdbm_ndbm=''
1009 i_gdbmndbm=''
1010 i_ndbm=''
1011 i_netdb=''
1012 i_neterrno=''
1013 i_netinettcp=''
1014 i_niin=''
1015 i_sysin=''
1016 i_poll=''
1017 i_prot=''
1018 i_pthread=''
1019 d_pwage=''
1020 d_pwchange=''
1021 d_pwclass=''
1022 d_pwcomment=''
1023 d_pwexpire=''
1024 d_pwgecos=''
1025 d_pwpasswd=''
1026 d_pwquota=''
1027 i_pwd=''
1028 i_quadmath=''
1029 i_shadow=''
1030 i_socks=''
1031 i_stdbool=''
1032 i_stddef=''
1033 i_stdint=''
1034 i_stdlib=''
1035 i_string=''
1036 strings=''
1037 i_sunmath=''
1038 i_sysaccess=''
1039 i_sysdir=''
1040 i_sysfile=''
1041 d_voidtty=''
1042 i_bsdioctl=''
1043 i_sysfilio=''
1044 i_sysioctl=''
1045 i_syssockio=''
1046 i_syslog=''
1047 i_sysmman=''
1048 i_sysmode=''
1049 i_sysmount=''
1050 i_sysndir=''
1051 i_sysparam=''
1052 i_syspoll=''
1053 i_sysresrc=''
1054 i_syssecrt=''
1055 i_sysselct=''
1056 i_sysstat=''
1057 i_sysstatfs=''
1058 i_sysstatvfs=''
1059 i_systimes=''
1060 i_systypes=''
1061 i_sysuio=''
1062 i_sysun=''
1063 i_sysutsname=''
1064 i_sysvfs=''
1065 i_syswait=''
1066 i_sgtty=''
1067 i_termio=''
1068 i_termios=''
1069 d_tm_tm_gmtoff=''
1070 d_tm_tm_zone=''
1071 i_systime=''
1072 i_systimek=''
1073 i_time=''
1074 timeincl=''
1075 i_unistd=''
1076 i_ustat=''
1077 i_utime=''
1078 i_values=''
1079 i_stdarg=''
1080 i_varargs=''
1081 i_varhdr=''
1082 i_vfork=''
1083 d_inc_version_list=''
1084 inc_version_list=''
1085 inc_version_list_init=''
1086 doubleinfbytes=''
1087 doublenanbytes=''
1088 longdblinfbytes=''
1089 longdblnanbytes=''
1090 installprefix=''
1091 installprefixexp=''
1092 installstyle=''
1093 installusrbinperl=''
1094 intsize=''
1095 longsize=''
1096 shortsize=''
1097 issymlink=''
1098 libc=''
1099 ldlibpthname=''
1100 libperl=''
1101 shrpenv=''
1102 useshrplib=''
1103 glibpth=''
1104 incpth=''
1105 libpth=''
1106 loclibpth=''
1107 plibpth=''
1108 xlibpth=''
1109 ignore_versioned_solibs=''
1110 libs=''
1111 libsdirs=''
1112 libsfiles=''
1113 libsfound=''
1114 libspath=''
1115 lns=''
1116 d_PRIEUldbl=''
1117 d_PRIFUldbl=''
1118 d_PRIGUldbl=''
1119 d_PRIeldbl=''
1120 d_PRIfldbl=''
1121 d_PRIgldbl=''
1122 d_SCNfldbl=''
1123 doublekind=''
1124 sPRIEUldbl=''
1125 sPRIFUldbl=''
1126 sPRIGUldbl=''
1127 sPRIeldbl=''
1128 sPRIfldbl=''
1129 sPRIgldbl=''
1130 sSCNfldbl=''
1131 lseeksize=''
1132 lseektype=''
1133 make_set_make=''
1134 d_mymalloc=''
1135 freetype=''
1136 mallocobj=''
1137 mallocsrc=''
1138 malloctype=''
1139 usemallocwrap=''
1140 usemymalloc=''
1141 installman1dir=''
1142 man1dir=''
1143 man1direxp=''
1144 man1ext=''
1145 installman3dir=''
1146 man3dir=''
1147 man3direxp=''
1148 man3ext=''
1149 doublemantbits=''
1150 longdblmantbits=''
1151 nvmantbits=''
1152 modetype=''
1153 multiarch=''
1154 mydomain=''
1155 myhostname=''
1156 phostname=''
1157 c=''
1158 n=''
1159 d_eofnblk=''
1160 eagain=''
1161 o_nonblock=''
1162 rd_nodata=''
1163 need_va_copy=''
1164 netdb_hlen_type=''
1165 netdb_host_type=''
1166 netdb_name_type=''
1167 netdb_net_type=''
1168 groupcat=''
1169 hostcat=''
1170 passcat=''
1171 orderlib=''
1172 ranlib=''
1173 d_perl_otherlibdirs=''
1174 otherlibdirs=''
1175 package=''
1176 spackage=''
1177 pager=''
1178 api_revision=''
1179 api_subversion=''
1180 api_version=''
1181 api_versionstring=''
1182 patchlevel=''
1183 perl_patchlevel=''
1184 revision=''
1185 subversion=''
1186 version=''
1187 version_patchlevel_string=''
1188 perl5=''
1189 perladmin=''
1190 perlpath=''
1191 d_nv_preserves_uv=''
1192 d_nv_zero_is_allbits_zero=''
1193 i16size=''
1194 i16type=''
1195 i32size=''
1196 i32type=''
1197 i64size=''
1198 i64type=''
1199 i8size=''
1200 i8type=''
1201 ivsize=''
1202 ivtype=''
1203 nv_overflows_integers_at=''
1204 nv_preserves_uv_bits=''
1205 nvsize=''
1206 nvtype=''
1207 u16size=''
1208 u16type=''
1209 u32size=''
1210 u32type=''
1211 u64size=''
1212 u64type=''
1213 u8size=''
1214 u8type=''
1215 uvsize=''
1216 uvtype=''
1217 ivdformat=''
1218 nvEUformat=''
1219 nvFUformat=''
1220 nvGUformat=''
1221 nveformat=''
1222 nvfformat=''
1223 nvgformat=''
1224 uvXUformat=''
1225 uvoformat=''
1226 uvuformat=''
1227 uvxformat=''
1228 pidtype=''
1229 prefix=''
1230 prefixexp=''
1231 installprivlib=''
1232 privlib=''
1233 privlibexp=''
1234 prototype=''
1235 ptrsize=''
1236 d_PRIXU64=''
1237 d_PRId64=''
1238 d_PRIi64=''
1239 d_PRIo64=''
1240 d_PRIu64=''
1241 d_PRIx64=''
1242 sPRIXU64=''
1243 sPRId64=''
1244 sPRIi64=''
1245 sPRIo64=''
1246 sPRIu64=''
1247 sPRIx64=''
1248 d_quad=''
1249 quadkind=''
1250 quadtype=''
1251 uquadtype=''
1252 drand01=''
1253 randbits=''
1254 randfunc=''
1255 randseedtype=''
1256 seedfunc=''
1257 installscript=''
1258 scriptdir=''
1259 scriptdirexp=''
1260 selectminbits=''
1261 selecttype=''
1262 sh=''
1263 targetsh=''
1264 sig_count=''
1265 sig_name=''
1266 sig_name_init=''
1267 sig_num=''
1268 sig_num_init=''
1269 sig_size=''
1270 d_sitearch=''
1271 installsitearch=''
1272 sitearch=''
1273 sitearchexp=''
1274 installsitebin=''
1275 sitebin=''
1276 sitebinexp=''
1277 installsitehtml1dir=''
1278 sitehtml1dir=''
1279 sitehtml1direxp=''
1280 installsitehtml3dir=''
1281 sitehtml3dir=''
1282 sitehtml3direxp=''
1283 installsitelib=''
1284 sitelib=''
1285 sitelib_stem=''
1286 sitelibexp=''
1287 installsiteman1dir=''
1288 siteman1dir=''
1289 siteman1direxp=''
1290 installsiteman3dir=''
1291 siteman3dir=''
1292 siteman3direxp=''
1293 siteprefix=''
1294 siteprefixexp=''
1295 installsitescript=''
1296 sitescript=''
1297 sitescriptexp=''
1298 sizesize=''
1299 sizetype=''
1300 d_libname_unique=''
1301 so=''
1302 socksizetype=''
1303 sharpbang=''
1304 shsharp=''
1305 spitshell=''
1306 src=''
1307 ssizetype=''
1308 st_ino_sign=''
1309 st_ino_size=''
1310 startperl=''
1311 startsh=''
1312 stdchar=''
1313 d_stdio_stream_array=''
1314 stdio_stream_array=''
1315 sysman=''
1316 sGMTIME_max=''
1317 sGMTIME_min=''
1318 sLOCALTIME_max=''
1319 sLOCALTIME_min=''
1320 trnl=''
1321 uidformat=''
1322 uidsign=''
1323 uidsize=''
1324 uidtype=''
1325 archname64=''
1326 use64bitall=''
1327 use64bitint=''
1328 usecbacktrace=''
1329 dtrace=''
1330 usedtrace=''
1331 usefaststdio=''
1332 usekernprocpathname=''
1333 ccflags_uselargefiles=''
1334 ldflags_uselargefiles=''
1335 libswanted_uselargefiles=''
1336 uselargefiles=''
1337 uselongdouble=''
1338 usemorebits=''
1339 usemultiplicity=''
1340 nm_opt=''
1341 nm_so_opt=''
1342 runnm=''
1343 usenm=''
1344 usensgetexecutablepath=''
1345 useperlio=''
1346 usequadmath=''
1347 usesocks=''
1348 d_oldpthreads=''
1349 use5005threads=''
1350 useithreads=''
1351 usereentrant=''
1352 usethreads=''
1353 incpath=''
1354 mips_type=''
1355 usrinc=''
1356 vaproto=''
1357 d_vendorarch=''
1358 installvendorarch=''
1359 vendorarch=''
1360 vendorarchexp=''
1361 d_vendorbin=''
1362 installvendorbin=''
1363 vendorbin=''
1364 vendorbinexp=''
1365 installvendorhtml1dir=''
1366 vendorhtml1dir=''
1367 vendorhtml1direxp=''
1368 installvendorhtml3dir=''
1369 vendorhtml3dir=''
1370 vendorhtml3direxp=''
1371 d_vendorlib=''
1372 installvendorlib=''
1373 vendorlib=''
1374 vendorlib_stem=''
1375 vendorlibexp=''
1376 installvendorman1dir=''
1377 vendorman1dir=''
1378 vendorman1direxp=''
1379 installvendorman3dir=''
1380 vendorman3dir=''
1381 vendorman3direxp=''
1382 usevendorprefix=''
1383 vendorprefix=''
1384 vendorprefixexp=''
1385 d_vendorscript=''
1386 installvendorscript=''
1387 vendorscript=''
1388 vendorscriptexp=''
1389 versiononly=''
1390 yacc=''
1391 yaccflags=''
1392 CONFIG=''
1393
1394 : Detect odd OSs
1395 define='define'
1396 undef='undef'
1397 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1398 rmlist=''
1399
1400 : We must find out about Eunice early
1401 eunicefix=':'
1402 if test -f /etc/unixtovms; then
1403         eunicefix=/etc/unixtovms
1404 fi
1405 if test -f /etc/unixtovms.exe; then
1406         eunicefix=/etc/unixtovms.exe
1407 fi
1408
1409 : Set executable suffix now -- needed before hints available
1410 if test -f "/libs/version.library"; then
1411 : Amiga OS
1412     _exe=""
1413 elif test -f "/system/gnu_library/bin/ar.pm"; then
1414 : Stratus VOS
1415     _exe=".pm"
1416 elif test -n "$DJGPP"; then
1417 : DOS DJGPP
1418     _exe=".exe"
1419 elif test -f /kern/cookiejar; then
1420 : MiNT
1421     _exe=""
1422 elif test -d c:/. -o -n "$is_os2" ; then
1423 : OS/2 or cygwin
1424     _exe=".exe"
1425 fi
1426
1427 groupstype=''
1428 i_whoami=''
1429 : Possible local include directories to search.
1430 : Set locincpth to "" in a hint file to defeat local include searches.
1431 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1432 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1433 :
1434 : no include file wanted by default
1435 inclwanted=''
1436
1437 : Enable -DEBUGGING and -DDEBUGGING from the command line
1438 EBUGGING=''
1439 DEBUGGING=''
1440
1441 : Trailing extension.  Override this in a hint file, if needed.
1442 : Extra object files, if any, needed on this platform.
1443 archobjs=''
1444 libnames=''
1445 : change the next line if compiling for Xenix/286 on Xenix/386
1446 xlibpth='/usr/lib/386 /lib/386'
1447 : Possible local library directories to search.
1448 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1449 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1450
1451 : general looking path for locating libraries
1452 glibpth="/lib /usr/lib $xlibpth"
1453 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1454 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1455 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1456 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1457
1458 : Private path used by Configure to find libraries.  Its value
1459 : is prepended to libpth. This variable takes care of special
1460 : machines, like the mips.  Usually, it should be empty.
1461 plibpth=''
1462
1463 : default library list
1464 libswanted=''
1465 : some systems want to use only the non-versioned libso:s
1466 ignore_versioned_solibs=''
1467 ccname=''
1468 ccversion=''
1469 perllibs=''
1470 : set useposix=false in your hint file to disable the POSIX extension.
1471 useposix=true
1472 : set useopcode=false in your hint file to disable the Opcode extension.
1473 useopcode=true
1474 archname64=''
1475 ccflags_uselargefiles=''
1476 ldflags_uselargefiles=''
1477 libswanted_uselargefiles=''
1478 : set usemultiplicity on the Configure command line to enable multiplicity.
1479 : set usesocks on the Configure command line to enable socks.
1480 archname=''
1481 : set usethreads on the Configure command line to enable threads.
1482 usereentrant='undef'
1483 : List of libraries we want.
1484 : If anyone needs extra -lxxx, put those in a hint file.
1485 libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
1486 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1487 : We probably want to search /usr/shlib before most other libraries.
1488 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1489 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1490 glibpth="/usr/shlib $glibpth"
1491 : Do not use vfork unless overridden by a hint file.
1492 usevfork=false
1493
1494 : Find the basic shell for Bourne shell scripts
1495 case "$sh" in
1496 '')
1497         case "$SYSTYPE" in
1498         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1499         *) xxx='/bin/sh';;
1500         esac
1501         if test -f "$xxx"; then
1502                 sh="$xxx"
1503         else
1504                 : Build up a list and do a single loop so we can 'break' out.
1505                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1506                 for xxx in sh bash ksh pdksh ash; do
1507                         for p in $pth; do
1508                                 try="$try ${p}/${xxx}"
1509                         done
1510                 done
1511                 for xxx in $try; do
1512                         if test -f "$xxx"; then
1513                                 sh="$xxx";
1514                                 break
1515                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1516                                 sh="$xxx";
1517                                 break
1518                         elif test -f "$xxx.exe"; then
1519                                 sh="$xxx";
1520                                 break
1521                         fi
1522                 done
1523         fi
1524         ;;
1525 esac
1526
1527 case "$sh" in
1528 '')     cat >&2 <<EOM
1529 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1530
1531 Usually it's in /bin/sh.  How did you even get this far?
1532 Please contact me (Perl Maintainers) at perlbug@perl.org and
1533 we'll try to straighten this all out.
1534 EOM
1535         exit 1
1536         ;;
1537 esac
1538
1539 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1540 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1541 targetsh=$sh
1542
1543 : see if sh knows # comments
1544 if `$sh -c '#' >/dev/null 2>&1`; then
1545         shsharp=true
1546         spitshell=cat
1547         xcat=/bin/cat
1548         test -f $xcat$_exe || xcat=/usr/bin/cat
1549         if test ! -f $xcat$_exe; then
1550                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1551                         if test -f $p/cat$_exe; then
1552                                 xcat=$p/cat
1553                                 break
1554                         fi
1555                 done
1556                 if test ! -f $xcat$_exe; then
1557                         echo "Can't find cat anywhere!"
1558                         exit 1
1559                 fi
1560         fi
1561         echo "#!$xcat" >sharp
1562         $eunicefix sharp
1563         chmod +x sharp
1564         ./sharp > today 2>/dev/null
1565         if test -s today; then
1566                 sharpbang='#!'
1567         else
1568                 echo "#! $xcat" > sharp
1569                 $eunicefix sharp
1570                 chmod +x sharp
1571                 ./sharp > today 2>/dev/null
1572                 if test -s today; then
1573                         sharpbang='#! '
1574                 else
1575                         sharpbang=': use '
1576                 fi
1577         fi
1578 else
1579         echo " "
1580         echo "Your $sh doesn't grok # comments--I will strip them later on."
1581         shsharp=false
1582         cd ..
1583         echo "exec grep -v '^[  ]*#'" >spitshell
1584         chmod +x spitshell
1585         $eunicefix spitshell
1586         spitshell=`pwd`/spitshell
1587         cd UU
1588         echo "I presume that if # doesn't work, #! won't work either!"
1589         sharpbang=': use '
1590 fi
1591 rm -f sharp today
1592
1593 : figure out how to guarantee sh startup
1594 case "$startsh" in
1595 '') startsh=${sharpbang}${sh} ;;
1596 *)
1597 esac
1598 cat >sharp <<EOSS
1599 $startsh
1600 set abc
1601 test "$?abc" != 1
1602 EOSS
1603
1604 chmod +x sharp
1605 $eunicefix sharp
1606 if ./sharp; then
1607         : echo "Yup, it does."
1608 else
1609         echo "Hmm... '$startsh' does not guarantee sh startup..."
1610         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1611 fi
1612 rm -f sharp
1613
1614 : Save command line options in file UU/cmdline.opt for later use in
1615 : generating config.sh.
1616 cat > cmdline.opt <<EOSH
1617 : Configure command line arguments.
1618 config_arg0='$0'
1619 config_args='$*'
1620 config_argc=$#
1621 EOSH
1622 argn=1
1623 args_exp=''
1624 args_sep=''
1625 for arg in "$@"; do
1626         cat >>cmdline.opt <<EOSH
1627 config_arg$argn='$arg'
1628 EOSH
1629         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1630 $arg
1631 EOC
1632         arg_exp=`cat cmdl.opt`
1633         args_exp="$args_exp$args_sep'$arg_exp'"
1634         argn=`expr $argn + 1`
1635         args_sep=' '
1636 done
1637 rm -f cmdl.opt
1638
1639 : produce awk script to parse command line options
1640 cat >options.awk <<'EOF'
1641 BEGIN {
1642         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1643
1644         len = length(optstr);
1645         for (i = 1; i <= len; i++) {
1646                 c = substr(optstr, i, 1);
1647                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1648                 if (a == ":") {
1649                         arg[c] = 1;
1650                         i++;
1651                 }
1652                 opt[c] = 1;
1653         }
1654 }
1655 {
1656         expect = 0;
1657         str = $0;
1658         if (substr(str, 1, 1) != "-") {
1659                 printf("'%s'\n", str);
1660                 next;
1661         }
1662         len = length($0);
1663         for (i = 2; i <= len; i++) {
1664                 c = substr(str, i, 1);
1665                 if (!opt[c]) {
1666                         printf("-%s\n", substr(str, i));
1667                         next;
1668                 }
1669                 printf("-%s\n", c);
1670                 if (arg[c]) {
1671                         if (i < len)
1672                                 printf("'%s'\n", substr(str, i + 1));
1673                         else
1674                                 expect = 1;
1675                         next;
1676                 }
1677         }
1678 }
1679 END {
1680         if (expect)
1681                 print "?";
1682 }
1683 EOF
1684
1685 : process the command line options
1686 set X `for arg in "$@"; do echo "X$arg"; done |
1687         sed -e s/X// | awk -f options.awk`
1688 eval "set $*"
1689 shift
1690 rm -f options.awk
1691
1692 : set up default values
1693 fastread=''
1694 reuseval=false
1695 config_sh=''
1696 alldone=''
1697 error=''
1698 silent=''
1699 extractsh=''
1700 knowitall=''
1701 rm -f optdef.sh posthint.sh
1702 cat >optdef.sh <<EOS
1703 $startsh
1704 EOS
1705
1706
1707 : option parsing
1708 while test $# -gt 0; do
1709         case "$1" in
1710         -d) shift; fastread=yes;;
1711         -e) shift; alldone=cont;;
1712         -f)
1713                 shift
1714                 cd ..
1715                 if test -r "$1"; then
1716                         config_sh="$1"
1717                 else
1718                         echo "$me: cannot read config file $1." >&2
1719                         error=true
1720                 fi
1721                 cd UU
1722                 shift;;
1723         --help|\
1724         -h) shift; error=true;;
1725         -r) shift; reuseval=true;;
1726         -s) shift; silent=true; realsilent=true;;
1727         -E) shift; alldone=exit;;
1728         -K) shift; knowitall=true;;
1729         -O) shift;;
1730         -S) shift; silent=true; extractsh=true;;
1731         -D)
1732                 shift
1733                 case "$1" in
1734                 *=)
1735                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1736                         echo "$me: ignoring -D $1" >&2
1737                         ;;
1738                 *=*) echo "$1" | \
1739                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1740                 *) echo "$1='define'" >> optdef.sh;;
1741                 esac
1742                 shift
1743                 ;;
1744         -U)
1745                 shift
1746                 case "$1" in
1747                 *=) echo "$1" >> optdef.sh;;
1748                 *=*)
1749                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1750                         echo "$me: ignoring -U $1" >&2
1751                         ;;
1752                 *) echo "$1='undef'" >> optdef.sh;;
1753                 esac
1754                 shift
1755                 ;;
1756         -A)
1757             shift
1758             xxx=''
1759             yyy="$1"
1760             zzz=''
1761             uuu=undef
1762             case "$yyy" in
1763             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1764                  case "$zzz" in
1765                  *:*) zzz='' ;;
1766                  *)   xxx=append
1767                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1768                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1769                  esac
1770                  ;;
1771             esac
1772             case "$xxx" in
1773             '')  case "$yyy" in
1774                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1775                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1776                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1777                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1778                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1779                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1780                  esac
1781                  ;;
1782             esac
1783             case "$xxx" in
1784             append)
1785                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1786             clear)
1787                 echo "$yyy=''"                  >> posthint.sh ;;
1788             define)
1789                 case "$zzz" in
1790                 '') zzz=define ;;
1791                 esac
1792                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1793             eval)
1794                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1795             prepend)
1796                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1797             undef)
1798                 case "$zzz" in
1799                 '') zzz="$uuu" ;;
1800                 esac
1801                 echo "$yyy=$zzz"                >> posthint.sh ;;
1802             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1803             esac
1804             shift
1805             ;;
1806         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1807             exit 0;;
1808         --) break;;
1809         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1810         *) break;;
1811         esac
1812 done
1813
1814 case "$error" in
1815 true)
1816         cat >&2 <<EOM
1817 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1818                  [-U symbol] [-U symbol=] [-A command:symbol...]
1819   -d : use defaults for all answers.
1820   -e : go on without questioning past the production of config.sh.
1821   -f : specify an alternate default configuration file.
1822   -h : print this help message and exit (with an error status).
1823   -r : reuse C symbols value if possible (skips costly nm extraction).
1824   -s : silent mode, only echoes questions and essential information.
1825   -D : define symbol to have some value:
1826          -D symbol         symbol gets the value 'define'
1827          -D symbol=value   symbol gets the value 'value'
1828        common used examples (see INSTALL for more info):
1829          -Duse64bitint            use 64bit integers
1830          -Duse64bitall            use 64bit integers and pointers
1831          -Dusethreads             use thread support
1832          -Dinc_version_list=none  do not include older perl trees in @INC
1833          -DEBUGGING=none          DEBUGGING options
1834          -Dcc=gcc                 choose your compiler
1835          -Dprefix=/opt/perl5      choose your destination
1836   -E : stop at the end of questions, after having produced config.sh.
1837   -K : do not use unless you know what you are doing.
1838   -O : ignored for backward compatibility
1839   -S : perform variable substitutions on all .SH files (can mix with -f)
1840   -U : undefine symbol:
1841          -U symbol    symbol gets the value 'undef'
1842          -U symbol=   symbol gets completely empty
1843        e.g.:  -Uversiononly
1844   -A : manipulate symbol after the platform specific hints have been applied:
1845          -A append:symbol=value   append value to symbol
1846          -A symbol=value          like append:, but with a separating space
1847          -A define:symbol=value   define symbol to have value
1848          -A clear:symbol          define symbol to be ''
1849          -A define:symbol         define symbol to be 'define'
1850          -A eval:symbol=value     define symbol to be eval of value
1851          -A prepend:symbol=value  prepend value to symbol
1852          -A undef:symbol          define symbol to be 'undef'
1853          -A undef:symbol=         define symbol to be ''
1854        e.g.:  -A prepend:libswanted='cl pthread '
1855               -A ccflags=-DSOME_MACRO
1856   -V : print version number and exit (with a zero status).
1857 EOM
1858         exit 1
1859         ;;
1860 esac
1861
1862 : Sanity checks
1863 case "$fastread$alldone" in
1864 yescont|yesexit) ;;
1865 *)
1866         case "$extractsh" in
1867         true) ;;
1868         *)
1869                 if test ! -t 0; then
1870                         echo "Say 'sh Configure', not 'sh <Configure'"
1871                         exit 1
1872                 fi
1873                 ;;
1874         esac
1875         ;;
1876 esac
1877
1878 exec 4>&1
1879 case "$silent" in
1880 true) exec 1>/dev/null;;
1881 esac
1882
1883 : run the defines and the undefines, if any, but leave the file out there...
1884 touch optdef.sh
1885 grep '\\' optdef.sh >/dev/null 2>&1
1886 if test $? = 0; then
1887     echo "Configure does not support \\ in -D arguments"
1888     exit 1
1889 fi
1890 . ./optdef.sh
1891 : create the posthint manipulation script and leave the file out there...
1892 touch posthint.sh
1893
1894 : set package name
1895 package='perl5'
1896 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1897 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1898 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1899 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1900 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1901 esac
1902
1903 : Some greps do not return status, grrr.
1904 echo "grimblepritz" >grimble
1905 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1906         contains=contains
1907 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1908         contains=grep
1909 else
1910         contains=contains
1911 fi
1912 rm -f grimble
1913 : the following should work in any shell
1914 case "$contains" in
1915 contains*)
1916         echo " "
1917         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1918         cat >contains <<'EOSS'
1919 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1920 EOSS
1921 chmod +x contains
1922 esac
1923
1924 : Find the path to the source tree
1925 case "$src" in
1926 '') case "$0" in
1927     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1928          case "$src" in
1929          /*)    ;;
1930          .)     ;;
1931          *)     src=`cd ../$src && pwd` ;;
1932          esac
1933          ;;
1934     *)   src='.';;
1935     esac;;
1936 esac
1937 case "$src" in
1938 '')     src=/
1939         rsrc=/
1940         ;;
1941 /*)     rsrc="$src";;
1942 *)      rsrc="../$src";;
1943 esac
1944 if test -f $rsrc/Configure && \
1945         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1946 then
1947    : found it, so we are ok.
1948 else
1949         rsrc=''
1950         for src in . .. ../.. ../../.. ../../../..; do
1951                 if test -f ../$src/Configure && \
1952                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1953                 then
1954                         rsrc=../$src
1955                         break
1956                 fi
1957         done
1958 fi
1959 case "$rsrc" in
1960 '')
1961         cat <<EOM >&4
1962
1963 Sorry, I can't seem to locate the source dir for $package.  Please start
1964 Configure with an explicit path -- i.e. /some/path/Configure.
1965
1966 EOM
1967         exit 1
1968         ;;
1969 ../.)   rsrc='..';;
1970 *)
1971         echo " "
1972         echo "Sources for $package found in \"$src\"." >&4
1973         ;;
1974 esac
1975
1976 : script used to extract .SH files with variable substitutions
1977 cat >extract <<'EOS'
1978 PERL_CONFIG_SH=true
1979 echo "Doing variable substitutions on .SH files..."
1980 if test -f MANIFEST; then
1981         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1982 else
1983         echo "(Looking for .SH files under the source directory.)"
1984         set x `(cd "$src"; find . -name "*.SH" -print)`
1985 fi
1986 shift
1987 case $# in
1988 0) set x `(cd "$src"; echo *.SH)`; shift;;
1989 esac
1990 if test ! -f "$src/$1"; then
1991         shift
1992 fi
1993 mkdir_p='
1994 name=$1;
1995 create="";
1996 while test $name; do
1997         if test ! -d "$name"; then
1998                 create="$name $create";
1999                 name=`echo $name | sed -e "s|^[^/]*$||"`;
2000                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
2001         else
2002                 name="";
2003         fi;
2004 done;
2005 for file in $create; do
2006         mkdir $file;
2007 done
2008 '
2009 for file in $*; do
2010         case "$src" in
2011         ".")
2012                 case "$file" in
2013                 */*)
2014                         dir=`expr X$file : 'X\(.*\)/'`
2015                         file=`expr X$file : 'X.*/\(.*\)'`
2016                         (cd "$dir" && . ./$file)
2017                         ;;
2018                 *)
2019                         . ./$file
2020                         ;;
2021                 esac
2022                 ;;
2023         *)
2024                 case "$file" in
2025                 */*)
2026                         dir=`expr X$file : 'X\(.*\)/'`
2027                         file=`expr X$file : 'X.*/\(.*\)'`
2028                         (set x $dir; shift; eval $mkdir_p)
2029                         sh <"$src/$dir/$file"
2030                         ;;
2031                 *)
2032                         sh <"$src/$file"
2033                         ;;
2034                 esac
2035                 ;;
2036         esac
2037 done
2038 if test -f "$src/config_h.SH"; then
2039         if test ! -f config.h; then
2040         : oops, they left it out of MANIFEST, probably, so do it anyway.
2041         . "$src/config_h.SH"
2042         fi
2043 fi
2044 EOS
2045
2046 : extract files and exit if asked to do so
2047 case "$extractsh" in
2048 true)
2049         case "$realsilent" in
2050         true) ;;
2051         *) exec 1>&4;;
2052         esac
2053         case "$config_sh" in
2054         '') config_sh='config.sh';;
2055         esac
2056         echo " "
2057         echo "Fetching answers from $config_sh..."
2058         cd ..
2059         . $config_sh
2060         . UU/optdef.sh
2061         echo " "
2062         . UU/extract
2063         rm -rf UU
2064         echo "Extraction done."
2065         exit 0
2066         ;;
2067 esac
2068
2069 : Eunice requires " " instead of "", can you believe it
2070 echo " "
2071 : Here we go...
2072 echo "Beginning of configuration questions for $package."
2073
2074 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2075
2076 : first determine how to suppress newline on echo command
2077 echo " "
2078 echo "Checking echo to see how to suppress newlines..."
2079 (echo "hi there\c" ; echo " ") >.echotmp
2080 if $contains c .echotmp >/dev/null 2>&1 ; then
2081         echo "...using -n."
2082         n='-n'
2083         c=''
2084 else
2085         cat <<'EOM'
2086 ...using \c
2087 EOM
2088         n=''
2089         c='\c'
2090 fi
2091 echo $n "The star should be here-->$c"
2092 echo '*'
2093 rm -f .echotmp
2094
2095 : Now test for existence of everything in MANIFEST
2096 echo " "
2097 if test -f "$rsrc/MANIFEST"; then
2098         echo "First let's make sure your kit is complete.  Checking..." >&4
2099         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2100                 (split -l 50 2>/dev/null || split -50)
2101         rm -f missing
2102         tmppwd=`pwd`
2103         for filelist in x??; do
2104                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2105                         >/dev/null 2>>"$tmppwd/missing")
2106         done
2107         if test -s missing; then
2108                 cat missing >&4
2109                 cat >&4 <<'EOM'
2110
2111 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2112
2113 You have the option of continuing the configuration process, despite the
2114 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2115 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2116 and contact the author (perlbug@perl.org).
2117
2118 EOM
2119                 echo $n "Continue? [n] $c" >&4
2120                 read ans
2121                 case "$ans" in
2122                 y*)
2123                         echo "Continuing..." >&4
2124                         rm -f missing
2125                         ;;
2126                 *)
2127                         echo "ABORTING..." >&4
2128                         kill $$
2129                         ;;
2130                 esac
2131         else
2132                 echo "Looks good..."
2133         fi
2134 else
2135         echo "There is no MANIFEST file.  I hope your kit is complete !"
2136 fi
2137 rm -f missing x??
2138
2139 : Find the appropriate value for a newline for tr
2140 if test -n "$DJGPP"; then
2141        trnl='\012'
2142 fi
2143 if test X"$trnl" = X; then
2144         case "`echo foo | tr '\n' x 2>/dev/null`" in
2145         foox) trnl='\n' ;;
2146         esac
2147 fi
2148 if test X"$trnl" = X; then
2149         case "`echo foo | tr '\012' x 2>/dev/null`" in
2150         foox) trnl='\012' ;;
2151         esac
2152 fi
2153 if test X"$trnl" = X; then
2154        case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
2155        fooxy) trnl='\n\r' ;;
2156        esac
2157 fi
2158 if test X"$trnl" = X; then
2159         cat <<EOM >&2
2160
2161 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2162
2163 EOM
2164         exit 1
2165 fi
2166
2167 : compute the number of columns on the terminal for proper question formatting
2168 case "$COLUMNS" in
2169 '') COLUMNS='80';;
2170 esac
2171
2172 : set up the echo used in my read
2173 myecho="case \"\$xxxm\" in
2174 '') echo $n \"\$rp $c\" >&4;;
2175 *) case \"\$rp\" in
2176         '') echo $n \"[\$xxxm] $c\";;
2177         *)
2178                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2179                         echo \"\$rp\" >&4
2180                         echo $n \"[\$xxxm] $c\" >&4
2181                 else
2182                         echo $n \"\$rp [\$xxxm] $c\" >&4
2183                 fi
2184                 ;;
2185         esac;;
2186 esac"
2187
2188 : now set up to do reads with possible shell escape and default assignment
2189 cat <<EOSC >myread
2190 $startsh
2191 xxxm=\$dflt
2192 $myecho
2193 ans='!'
2194 case "\$fastread" in
2195 yes) case "\$dflt" in
2196         '') ;;
2197         *) ans='';
2198                 case "\$silent-\$rp" in
2199                 true-) ;;
2200                 *) echo " " >&4;;
2201                 esac;;
2202         esac;;
2203 *) case "\$silent" in
2204         true) case "\$rp" in
2205                 '') ans='';;
2206                 esac;;
2207         esac;;
2208 esac
2209 while expr "X\$ans" : "X!" >/dev/null; do
2210         read answ
2211         set x \$xxxm
2212         shift
2213         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2214         case  "\$answ" in
2215         "!")
2216                 sh 1>&4
2217                 echo " "
2218                 $myecho
2219                 ;;
2220         !*)
2221                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2222                 shift
2223                 sh 1>&4 -c "\$*"
2224                 echo " "
2225                 $myecho
2226                 ;;
2227         "\$ans")
2228                 case "\$ans" in
2229                 \\&*)
2230                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2231                         shift
2232                         case "\$1" in
2233                         -d)
2234                                 fastread=yes
2235                                 echo "(OK, I'll run with -d after this question.)" >&4
2236                                 ;;
2237                         -*)
2238                                 echo "*** Sorry, \$1 not supported yet." >&4
2239                                 ;;
2240                         esac
2241                         $myecho
2242                         ans=!
2243                         ;;
2244                 esac;;
2245         *)
2246                 case "\$aok" in
2247                 y)
2248                         echo "*** Substitution done -- please confirm."
2249                         xxxm="\$ans"
2250                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2251                         xxxm="\$ans"
2252                         ans=!
2253                         ;;
2254                 *)
2255                         echo "*** Error -- try again."
2256                         ans=!
2257                         ;;
2258                 esac
2259                 $myecho
2260                 ;;
2261         esac
2262         case "\$ans\$xxxm\$nostick" in
2263         '')
2264                 ans=!
2265                 $myecho
2266                 ;;
2267         esac
2268 done
2269 case "\$ans" in
2270 '') ans="\$xxxm";;
2271 esac
2272 EOSC
2273
2274 : create .config dir to save info across Configure sessions
2275 test -d ../.config || mkdir ../.config
2276 cat >../.config/README <<EOF
2277 This directory created by Configure to save information that should
2278 persist across sessions for $package.
2279
2280 You may safely delete it if you wish.
2281 EOF
2282
2283 : See if we are using a devel version and want that
2284 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2285 case "$usedevel" in
2286 $define|true|[yY]*)
2287     usedevel="$define" ;;
2288 *) case "$xversion" in
2289    *[13579])
2290         cat >&4 <<EOH
2291 *** WHOA THERE!!! ***
2292
2293     This is an UNSTABLE DEVELOPMENT release.
2294     The version of this $package distribution is $xversion, that is, odd,
2295     (as opposed to even) and that signifies a development release.
2296     If you want a maintenance release, you want an even-numbered version.
2297
2298     Do ***NOT*** install this into production use.
2299     Data corruption and crashes are possible.
2300
2301     It is most seriously suggested that you do not continue any further
2302     unless you want to help in developing and debugging Perl.
2303
2304     If you *still* want to build perl, you can answer 'y' now,
2305     or pass -Dusedevel to Configure.
2306
2307 EOH
2308         rp='Do you really want to continue?'
2309         dflt='n'
2310         . ./myread
2311         case "$ans" in
2312         [yY]) echo >&4 "Okay, continuing."
2313               usedevel="$define" ;;
2314         *) echo >&4 "Okay, bye."
2315            exit 1
2316            ;;
2317         esac
2318         ;;
2319     esac
2320     usedevel="$undef"
2321     ;;
2322 esac
2323 case "$usedevel" in
2324 $define|true|[yY]*)
2325         case "$versiononly" in
2326         '') versiononly="$define" ;;
2327         esac
2328         case "$installusrbinperl" in
2329         '') installusrbinperl="$undef" ;;
2330         esac
2331         ;;
2332 esac
2333
2334 : general instructions
2335 needman=true
2336 firsttime=true
2337 user=`(logname) 2>/dev/null`
2338 case "$user" in
2339 '') user=`whoami 2>&1`;;
2340 esac
2341 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2342         firsttime=false
2343         echo " "
2344         rp='Would you like to see the instructions?'
2345         dflt=n
2346         . ./myread
2347         case "$ans" in
2348         [yY]*) ;;
2349         *) needman=false;;
2350         esac
2351 fi
2352 if $needman; then
2353         cat <<EOH
2354
2355 This installation shell script will examine your system and ask you questions
2356 to determine how the perl5 package should be installed. If you get
2357 stuck on a question, you may use a ! shell escape to start a subshell or
2358 execute a command.  Many of the questions will have default answers in square
2359 brackets; typing carriage return will give you the default.
2360
2361 On some of the questions which ask for file or directory names you are allowed
2362 to use the ~name construct to specify the login directory belonging to "name",
2363 even if you don't have a shell which knows about that.  Questions where this is
2364 allowed will be marked "(~name ok)".
2365
2366 EOH
2367         rp=''
2368         dflt='Type carriage return to continue'
2369         . ./myread
2370         cat <<'EOH'
2371
2372 The prompter used in this script allows you to use shell variables and
2373 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2374 in the default answer, as if the default line was a set of arguments given to a
2375 script shell.  This means you may also use $* to repeat the whole default line,
2376 so you do not have to re-type everything to add something to the default.
2377
2378 Every time there is a substitution, you will have to confirm.  If there is an
2379 error (e.g. an unmatched backtick), the default answer will remain unchanged
2380 and you will be prompted again.
2381
2382 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2383 the questions and use the computed defaults (or the previous answers if there
2384 was already a config.sh file). Type 'Configure -h' for a list of options.
2385 You may also start interactively and then answer '& -d' at any prompt to turn
2386 on the non-interactive behaviour for the remainder of the execution.
2387
2388 EOH
2389         . ./myread
2390         cat <<EOH
2391
2392 Much effort has been expended to ensure that this shell script will run on any
2393 Unix system.  If despite that it blows up on yours, your best bet is to edit
2394 Configure and run it again.  If you can't run Configure for some reason,
2395 you'll have to generate a config.sh file by hand.  Whatever problems you
2396 have, let me (perlbug@perl.org) know how I blew it.
2397
2398 This installation script affects things in two ways:
2399
2400 1) it may do direct variable substitutions on some of the files included
2401    in this kit.
2402 2) it builds a config.h file for inclusion in C programs.  You may edit
2403    any of these files as the need arises after running this script.
2404
2405 If you make a mistake on a question, there is no easy way to back up to it
2406 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2407 files.  Configure will offer to let you do this before it runs the SH files.
2408
2409 EOH
2410         dflt='Type carriage return to continue'
2411         . ./myread
2412         case "$firsttime" in
2413         true) echo $user >>../.config/instruct;;
2414         esac
2415 fi
2416
2417 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2418 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2419 if test "X$sysroot" = X; then
2420     sysroot=""
2421 else
2422     case "$cc" in
2423         *gcc*|*g++*)
2424             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2425             # _sysroot is used in places where we need --sysroot=foo
2426             # but using the rest of the flags could cause issues.
2427             _sysroot="--sysroot=$sysroot";
2428             case "$ccflags" in
2429                 *sysroot*) ;;
2430                 'undef'|*)
2431                 ccflags="$ccflags $_sysroot"
2432             esac
2433             case "$ldflags" in
2434                 *sysroot*) ;;
2435                 'undef'|*)
2436                 ldflags="$ldflags $_sysroot"
2437             esac
2438             case "$cppflags" in
2439                 *sysroot*) ;;
2440                 'undef'|*)
2441                 cppflags="$cppflags $_sysroot"
2442             esac
2443             # lddlflags updated below in lddlflags section;
2444             # same with cccdlflags
2445             ;;
2446     esac
2447
2448     # Adjust some defaults to also use $sysroot
2449     for var in xlibpth loclibpth locincpth glibpth; do
2450         eval xxx=\$$var
2451         eval $var=''
2452         for path in $xxx; do
2453             eval $var=\"\$$var $sysroot$path\"
2454         done
2455     done
2456
2457 fi
2458
2459 : find out where common programs are
2460 echo " "
2461 echo "Locating common programs..." >&4
2462 cat <<EOSC >loc
2463 $startsh
2464 case \$# in
2465 0) exit 1;;
2466 esac
2467 thing=\$1
2468 shift
2469 dflt=\$1
2470 shift
2471 for dir in \$*; do
2472         case "\$thing" in
2473         .)
2474         if test -d \$dir/\$thing; then
2475                 echo \$dir
2476                 exit 0
2477         fi
2478         ;;
2479         *)
2480         for thisthing in \$dir/\$thing; do
2481                 : just loop through to pick last item
2482         done
2483         if test -f \$thisthing; then
2484                 echo \$thisthing
2485                 exit 0
2486         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2487                 echo \$thisthing
2488                 exit 0
2489         elif test -f \$dir/\$thing.exe; then
2490                 if test -n "$DJGPP"; then
2491                         echo \$dir/\$thing.exe
2492                 elif test "$eunicefix" != ":"; then
2493                         : on Eunice apparently
2494                         echo \$dir/\$thing
2495                 fi
2496                 exit 0
2497         fi
2498         ;;
2499         esac
2500 done
2501 echo \$dflt
2502 exit 1
2503 EOSC
2504 chmod +x loc
2505 $eunicefix loc
2506 loclist="
2507 awk
2508 cat
2509 chmod
2510 comm
2511 cp
2512 echo
2513 expr
2514 grep
2515 ls
2516 mkdir
2517 rm
2518 sed
2519 sort
2520 touch
2521 tr
2522 uniq
2523 "
2524 trylist="
2525 ar
2526 bison
2527 byacc
2528 cpp
2529 csh
2530 date
2531 egrep
2532 gmake
2533 gzip
2534 less
2535 ln
2536 make
2537 more
2538 nm
2539 nroff
2540 perl
2541 pg
2542 test
2543 uname
2544 zip
2545 "
2546 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2547 pth="$pth $sysroot/lib $sysroot/usr/lib"
2548 for file in $loclist; do
2549         eval xxx=\$$file
2550         case "$xxx" in
2551         /*|?:[\\/]*)
2552                 if test -f "$xxx"; then
2553                         : ok
2554                 else
2555                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2556                         xxx=`./loc $file $file $pth`
2557                 fi
2558                 ;;
2559         '') xxx=`./loc $file $file $pth`;;
2560         *) xxx=`./loc $xxx $xxx $pth`;;
2561         esac
2562         eval $file=$xxx$_exe
2563         eval _$file=$xxx
2564         case "$xxx" in
2565         /*)
2566                 echo $file is in $xxx.
2567                 ;;
2568         ?:[\\/]*)
2569                 echo $file is in $xxx.
2570                 ;;
2571         *)
2572                 echo "I don't know where '$file' is, and my life depends on it." >&4
2573                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2574                 exit 1
2575                 ;;
2576         esac
2577 done
2578 echo " "
2579 echo "Don't worry if any of the following aren't found..."
2580 say=offhand
2581 for file in $trylist; do
2582         eval xxx=\$$file
2583         case "$xxx" in
2584         /*|?:[\\/]*)
2585                 if test -f "$xxx"; then
2586                         : ok
2587                 else
2588                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2589                         xxx=`./loc $file $file $pth`
2590                 fi
2591                 ;;
2592         '') xxx=`./loc $file $file $pth`;;
2593         *) xxx=`./loc $xxx $xxx $pth`;;
2594         esac
2595         eval $file=$xxx$_exe
2596         eval _$file=$xxx
2597         case "$xxx" in
2598         /*)
2599                 echo $file is in $xxx.
2600                 ;;
2601         ?:[\\/]*)
2602                 echo $file is in $xxx.
2603                 ;;
2604         *)
2605                 echo "I don't see $file out there, $say."
2606                 say=either
2607                 ;;
2608         esac
2609 done
2610 case "$egrep" in
2611 egrep)
2612         echo "Substituting grep for egrep."
2613         egrep=$grep
2614         _egrep=$grep
2615         ;;
2616 esac
2617 case "$less" in
2618 '')     ;;
2619 *)      if $less -R </dev/null >/dev/null 2>&1; then
2620                echo "Substituting less -R for less."
2621                less="$less -R"
2622                _less=$less
2623         fi
2624         ;;
2625 esac
2626 case "$ln" in
2627 ln)
2628         echo "Substituting cp for ln."
2629         ln=$cp
2630         _ln=$cp
2631         ;;
2632 esac
2633 case "$make" in
2634 make)
2635         case "$gmake" in
2636         gmake)
2637         echo "I can't find make or gmake, and my life depends on it." >&4
2638         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2639         exit 1
2640         ;;
2641         esac
2642         ;;
2643 esac
2644 case "$gmake" in
2645 gmake)  ;;
2646 *)      # We can't have osname yet.
2647         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2648                 # Assume that gmake, if found, is definitely GNU make
2649                 # and prefer it over the system make.
2650                 echo "Substituting gmake for make."
2651                 make=$gmake
2652                 _make=$gmake
2653         fi
2654         ;;
2655 esac
2656 case "$test" in
2657 test)
2658         echo "Hopefully test is built into your sh."
2659         ;;
2660 *)
2661         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2662                 echo "Using the test built into your sh."
2663                 test=test
2664                 _test=test
2665         fi
2666         ;;
2667 esac
2668 case "$echo" in
2669 echo)
2670         echo "Hopefully echo is built into your sh."
2671         ;;
2672 '') ;;
2673 *)
2674         echo " "
2675 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2676         $echo $n "hi there$c" >foo1
2677         echo $n "hi there$c" >foo2
2678         if cmp foo1 foo2 >/dev/null 2>&1; then
2679                 echo "They are compatible.  In fact, they may be identical."
2680         else
2681                 case "$n" in
2682                 '-n') n='' c='\c';;
2683                 *) n='-n' c='';;
2684                 esac
2685                 cat <<FOO
2686 They are not compatible!  You are probably running ksh on a non-USG system.
2687 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2688 have echo built in and we may have to run some Bourne shell scripts.  That
2689 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2690
2691 FOO
2692                 $echo $n "The star should be here-->$c"
2693                 $echo "*"
2694         fi
2695         $rm -f foo1 foo2
2696         ;;
2697 esac
2698
2699 # This question was auctioned at YAPC::Europe-2007 in Vienna
2700 # I never promised you could answer it. I only auctioned the question.
2701 cat <<FOO
2702 The following message is sponsored by
2703
2704   Dresden.pm<--The stars should be here.
2705
2706 Dear Perl user, system administrator or package
2707 maintainer, the Perl community sends greetings to
2708 you. Do you (emblematical) greet back [Y/n]? n
2709
2710 FOO
2711
2712 : Check what type of C compiler we use
2713 cat <<EOS >trygcc
2714 $startsh
2715 EOS
2716 cat <<'EOSC' >>trygcc
2717 case "$cc" in
2718 '') ;;
2719 *)  $rm -f try try.*
2720     $cat >try.c <<EOM
2721 int main(int argc, char *argv[]) {
2722   return 0;
2723 }
2724 EOM
2725     if $cc -o try $ccflags $ldflags try.c; then
2726        :
2727     else
2728         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2729         despair=yes
2730         trygcc=yes
2731         case "$cc" in
2732         *gcc*) trygcc=no ;;
2733         esac
2734         # Skip this test because it gives a false match on output like:
2735         #    ./trygcc: line 23: cc: command not found
2736         # case "`$cc -v -c try.c 2>&1`" in
2737         # *gcc*) trygcc=no ;;
2738         # esac
2739         if $test X"$trygcc" = Xyes; then
2740             if gcc -o try -c try.c; then
2741                 echo " "
2742                 echo "You seem to have a working gcc, though." >&4
2743                 # Switching compilers may undo the work of hints files.
2744                 # The most common problem is -D_REENTRANT for threads.
2745                 # This heuristic catches that case, but gets false positives
2746                 # if -Dusethreads was not actually specified.  Better to
2747                 # bail out here with a useful message than fail
2748                 # mysteriously later. Should we perhaps just try to
2749                 # re-invoke Configure -Dcc=gcc config_args ?
2750                 if $test -f usethreads.cbu; then
2751                         $cat >&4 <<EOM
2752
2753 *** However, any setting of the C compiler flags (e.g. for thread support)
2754 *** will be lost.  It may be necessary for you to restart Configure and
2755 *** add -Dcc=gcc to your Configure command line.
2756
2757 EOM
2758                         rp="Would you like to go ahead and try gcc anyway?"
2759                         dflt=n
2760                 else
2761                         rp="Would you like to use it?"
2762                         dflt=y
2763                 fi
2764                 if $test -f myread; then
2765                     . ./myread
2766                 else
2767                     if $test -f UU/myread; then
2768                         . ./UU/myread
2769                     else
2770                         echo "Cannot find myread, sorry.  Aborting." >&2
2771                         exit 1
2772                     fi
2773                 fi
2774                 case "$ans" in
2775                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2776                 esac
2777             fi
2778         fi
2779     fi
2780     $rm -f try try.*
2781     ;;
2782 esac
2783 EOSC
2784
2785 cat <<EOS >checkcc
2786 $startsh
2787 EOS
2788 cat <<'EOSC' >>checkcc
2789 case "$cc" in
2790 '') ;;
2791 *)  $rm -f try try.*
2792     $cat >try.c <<EOM
2793 int main(int argc, char *argv[]) {
2794   return 0;
2795 }
2796 EOM
2797     if $cc -o try $ccflags $ldflags try.c; then
2798        :
2799     else
2800         if $test X"$despair" = Xyes; then
2801            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2802         fi
2803         $cat >&4 <<EOM
2804 You need to find a working C compiler.
2805 Either (purchase and) install the C compiler supplied by your OS vendor,
2806 or for a free C compiler try http://gcc.gnu.org/
2807 I cannot continue any further, aborting.
2808 EOM
2809         exit 1
2810     fi
2811     $rm -f try try.*
2812     ;;
2813 esac
2814 EOSC
2815
2816 : determine whether symbolic links are supported
2817 echo " "
2818 $touch blurfl
2819 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2820         echo "Symbolic links are supported." >&4
2821         lns="$ln -s"
2822 else
2823         echo "Symbolic links are NOT supported." >&4
2824         lns="$ln"
2825 fi
2826 $rm -f blurfl sym
2827
2828 : determine whether symbolic links are supported
2829 echo " "
2830 case "$lns" in
2831 *"ln"*" -s")
2832         echo "Checking how to test for symbolic links..." >&4
2833         $lns blurfl sym
2834         if $test "X$issymlink" = X; then
2835                 case "$newsh" in
2836                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2837                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2838                 esac
2839                 if test $? = 0; then
2840                         issymlink="test -h"
2841                 else
2842                         echo "Your builtin 'test -h' may be broken." >&4
2843                         case "$test" in
2844                         /*)     ;;
2845                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2846                                 for p in $pth
2847                                 do
2848                                         if test -f "$p/$test"; then
2849                                                 test="$p/$test"
2850                                                 break
2851                                         fi
2852                                 done
2853                                 ;;
2854                         esac
2855                         case "$test" in
2856                         /*)
2857                                 echo "Trying external '$test -h'." >&4
2858                                 issymlink="$test -h"
2859                                 if $test ! -h sym >/dev/null 2>&1; then
2860                                         echo "External '$test -h' is broken, too." >&4
2861                                         issymlink=''
2862                                 fi
2863                                 ;;
2864                         *)      issymlink='' ;;
2865                         esac
2866                 fi
2867         fi
2868         if $test "X$issymlink" = X; then
2869                 if $test -L sym 2>/dev/null; then
2870                         issymlink="$test -L"
2871                         echo "The builtin '$test -L' worked." >&4
2872                 fi
2873         fi
2874         if $test "X$issymlink" != X; then
2875                 echo "You can test for symbolic links with '$issymlink'." >&4
2876         else
2877                 echo "I do not know how you can test for symbolic links." >&4
2878         fi
2879         $rm -f blurfl sym
2880         ;;
2881 *)      echo "No symbolic links, so not testing for their testing..." >&4
2882         ;;
2883 esac
2884 echo " "
2885
2886 : Make symlinks util
2887 case "$mksymlinks" in
2888 $define|true|[yY]*)
2889         case "$src" in
2890         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2891                 exit 1
2892                 ;;
2893         *)      case "$lns:$issymlink" in
2894                 *"ln"*" -s:"*"test -"?)
2895                         echo "Creating the symbolic links..." >&4
2896                         cd ..
2897                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2898                         awk 'NF == 1 {
2899                                 dir=".";
2900                                 file=$1 "";
2901                              }
2902                              NF == 2 {
2903                                 dir=$1 "";
2904                                 file=$2 "";
2905                              }
2906                              {
2907                                  print "# dir = ", dir, "file = ", file
2908                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2909                              } END {
2910                                  for (d in mf) {
2911                                      if (d != ".") { print("mkdir -p "d) }
2912                                      print("ln -sf "mf[d]" "d);
2913                                  }
2914                              }' source="$src" > UU/mksymlinks.$$
2915                         sh UU/mksymlinks.$$
2916                         rm UU/mksymlinks.$$
2917                         # Sanity check 1.
2918                         if test ! -d t/base; then
2919                                 echo "Failed to create the subdirectories.  Aborting." >&4
2920                                 exit 1
2921                         fi
2922                         # Sanity check 2.
2923                         if test ! -f t/base/lex.t; then
2924                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2925                                 exit 1
2926                         fi
2927                         if test ! -f win32/win32.c; then
2928                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2929                                 exit 1
2930                         fi
2931                         cd UU
2932                         ;;
2933                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2934                         ;;
2935                 esac
2936                 ;;
2937         esac
2938         ;;
2939 esac
2940
2941 : Check for Cross-Compilation
2942 if $test "X$targethost" = "X"; then
2943     targethost=""
2944 fi
2945 if $test "X$targetenv" = "X"; then
2946     targetenv=""
2947 fi
2948 case "$usecrosscompile" in
2949 $define|true|[yY]*)
2950         $echo "Cross-compiling..."
2951         croak=''
2952         case "$cc" in
2953         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2954             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2955             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2956             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2957             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2958             # leave out ld, choosing it is more complex
2959             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2960             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2961             # We are in a weird spot. Just before us, some values
2962             # were 'saved', to be restored after the hints are
2963             # run.  This means that the changes we made to ar,
2964             # nm and ranlib will get reverted.
2965             # To avoid that, we hijack the saving mechanism and
2966             # have it save our new values.
2967             for file in ar nm ranlib; do
2968                 eval xxx=\$$file
2969                 eval $file=$xxx$_exe
2970                 eval _$file=$xxx
2971             done
2972         ;;
2973         esac
2974         case "$targetarch" in
2975         '') echo "Targetarch not defined." >&4; croak=y ;;
2976         *)  echo "Using targetarch $targetarch." >&4 ;;
2977         esac
2978         case "$targethost" in
2979         '') echo "Targethost not defined." >&4; croak=n ;;
2980         *)  echo "Using targethost $targethost." >&4
2981         esac
2982         locincpth=' '
2983         loclibpth=' '
2984         case "$croak" in
2985         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2986         esac
2987     : compile a host miniperl and generate_uudmap, unless we got passed them
2988     if $test "X$hostperl" = X; then
2989       echo "Building host miniperl and generate_uudmap binaries" >&4
2990       before_host=`pwd`
2991       cd ..
2992       cd $src
2993       src=`pwd`
2994       rm -rf $src/host
2995       mkdir $src/host
2996       cd $src/host
2997       $src/Configure -des -Dusedevel -Dmksymlinks
2998       $make miniperl
2999       case "$hostgenerate" in
3000       '') $make generate_uudmap
3001           hostgenerate=$src/host/generate_uudmap
3002           ;;
3003        "$undef") hostgenerate=''
3004           ;;
3005       esac
3006       hostperl=$src/host/miniperl
3007       cd $before_host
3008     fi
3009     hostosname=`$hostperl -le 'print $^O'`
3010     ;;
3011 *)
3012     usecrosscompile="$undef"
3013     ;;
3014 esac
3015
3016 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3017 case "$targethost" in
3018     '') echo "Checking for cross-compile" >&4
3019     case "$usecrosscompile$multiarch" in
3020        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3021          if [ -f Makefile ]; then
3022            echo " "
3023            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3024          else
3025            echo "Configure done."
3026          fi
3027        exit 0
3028        ;;
3029      *) echo "No targethost for running compiler tests against defined, running locally" >&4
3030         run=''
3031         to=:
3032         from=:
3033         ;;
3034     esac
3035     ;;
3036     *) echo "Using targethost $targethost." >&4
3037         case "$src" in
3038         /*) run=$src/Cross/run
3039             targetmkdir=$src/Cross/mkdir
3040             to=$src/Cross/to
3041             from=$src/Cross/from
3042             ;;
3043         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3044             run=$pwd/Cross/run
3045             targetmkdir=$pwd/Cross/mkdir
3046             to=$pwd/Cross/to
3047             from=$pwd/Cross/from
3048             ;;
3049         esac
3050         case "$targetrun" in
3051         '') targetrun=ssh ;;
3052         esac
3053         case "$targetto" in
3054         '') targetto=scp ;;
3055         esac
3056         case "$targetfrom" in
3057         '') targetfrom=scp ;;
3058         esac
3059         run=$run-$targetrun
3060         to=$to-$targetto
3061         from=$from-$targetfrom
3062         case "$targetdir" in
3063         '')  targetdir=/tmp
3064              echo "Guessing targetdir $targetdir." >&4
3065              ;;
3066         esac
3067         case "$targetuser" in
3068         '')  targetuser=root
3069              echo "Guessing targetuser $targetuser." >&4
3070              ;;
3071         esac
3072         case "$targetport" in
3073         '')  targetport=22
3074              echo "Guessing targetport $targetport." >&4
3075              ;;
3076         esac
3077         case "$targetfrom" in
3078         scp)    q=-q ;;
3079         *)      q='' ;;
3080         esac
3081         case "$targetrun" in
3082         ssh|rsh)
3083             cat >$run <<EOF
3084 #!/bin/sh
3085 env=''
3086 case "\$1" in
3087 -cwd)
3088   shift
3089   cwd=\$1
3090   shift
3091   ;;
3092 esac
3093 case "\$1" in
3094 -env)
3095   shift
3096   env=\$1
3097   shift
3098   ;;
3099 esac
3100 case "\$cwd" in
3101 '') cwd=$targetdir ;;
3102 esac
3103 exe=\$1
3104 shift
3105 $to \$exe
3106 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3107 EOF
3108             ;;
3109         adb)
3110             $touch $run
3111             ;;
3112         *)  echo "Unknown targetrun '$targetrun'" >&4
3113             exit 1
3114             ;;
3115         esac
3116         case "$targetmkdir" in
3117         */Cross/mkdir)
3118             cat >$targetmkdir <<EOF
3119 #!/bin/sh
3120 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3121 EOF
3122             $chmod a+rx $targetmkdir
3123             ;;
3124         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3125             exit 1
3126             ;;
3127         esac
3128         case "$targetto" in
3129         scp|rcp)
3130             cat >$to <<EOF
3131 #!/bin/sh
3132 for f in \$@
3133 do
3134   case "\$f" in
3135   /*)
3136     $targetmkdir \`dirname \$f\`
3137     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3138     ;;
3139   *)
3140     $targetmkdir $targetdir/\`dirname \$f\`
3141     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3142     ;;
3143   esac
3144 done
3145 exit 0
3146 EOF
3147             ;;
3148         cp) cat >$to <<EOF
3149 #!/bin/sh
3150 for f in \$@
3151 do
3152   case "\$f" in
3153   /*)
3154     $mkdir -p $targetdir/\`dirname \$f\`
3155     $cp \$f $targetdir/\$f || exit 1
3156     ;;
3157   *)
3158     $targetmkdir $targetdir/\`dirname \$f\`
3159     $cp \$f $targetdir/\$f || exit 1
3160     ;;
3161   esac
3162 done
3163 exit 0
3164 EOF
3165             ;;
3166         *)  echo "Unknown targetto '$targetto'" >&4
3167             exit 1
3168             ;;
3169         esac
3170         case "$targetfrom" in
3171         scp|rcp)
3172           cat >$from <<EOF
3173 #!/bin/sh
3174 for f in \$@
3175 do
3176   $rm -f \$f
3177   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3178 done
3179 exit 0
3180 EOF
3181             ;;
3182         cp) cat >$from <<EOF
3183 #!/bin/sh
3184 for f in \$@
3185 do
3186   $rm -f \$f
3187   cp $targetdir/\$f . || exit 1
3188 done
3189 exit 0
3190 EOF
3191             ;;
3192         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3193             exit 1
3194             ;;
3195         esac
3196         if $test ! -f $run; then
3197             echo "Target 'run' script '$run' not found." >&4
3198         else
3199             $chmod a+rx $run
3200         fi
3201         if $test ! -f $to; then
3202             echo "Target 'to' script '$to' not found." >&4
3203         else
3204             $chmod a+rx $to
3205         fi
3206         if $test ! -f $from; then
3207             echo "Target 'from' script '$from' not found." >&4
3208         else
3209             $chmod a+rx $from
3210         fi
3211         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3212             exit 1
3213         fi
3214         cat >&4 <<EOF
3215 Using '$run' for remote execution,
3216 and '$from' and '$to'
3217 for remote file transfer.
3218 EOF
3219         ;;
3220 *)      run=''
3221         to=:
3222         from=:
3223         usecrosscompile="$undef"
3224         targetarch=''
3225         ;;
3226 esac
3227
3228 : see whether [:lower:] and [:upper:] are supported character classes
3229 echo " "
3230 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3231 ABYZ-abyz)
3232         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3233         up='[:upper:]'
3234         low='[:lower:]'
3235         ;;
3236 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3237         # (0xd9 and 0xe2), therefore that is a nice testing point.
3238         if test "X$up" = X -o "X$low" = X; then
3239             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3240             rs) up='[A-Z]'
3241                 low='[a-z]'
3242                 ;;
3243             esac
3244         fi
3245         if test "X$up" = X -o "X$low" = X; then
3246             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3247             rs) up='A-Z'
3248                 low='a-z'
3249                 ;;
3250             esac
3251         fi
3252         if test "X$up" = X -o "X$low" = X; then
3253             case "`echo RS | od -x 2>/dev/null`" in
3254             *D9E2*|*d9e2*)
3255                 echo "Hey, this might be EBCDIC." >&4
3256                 if test "X$up" = X -o "X$low" = X; then
3257                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3258                     rs) up='[A-IJ-RS-Z]'
3259                         low='[a-ij-rs-z]'
3260                         ;;
3261                     esac
3262                 fi
3263                 if test "X$up" = X -o "X$low" = X; then
3264                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3265                     rs) up='A-IJ-RS-Z'
3266                         low='a-ij-rs-z'
3267                         ;;
3268                     esac
3269                 fi
3270                 ;;
3271             esac
3272         fi
3273 esac
3274 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3275 rs)
3276     echo "Using $up and $low to convert case." >&4
3277     ;;
3278 *)
3279     echo "I don't know how to translate letters from upper to lower case." >&4
3280     echo "Your tr is not acting any way I know of." >&4
3281     exit 1
3282     ;;
3283 esac
3284 : set up the translation script tr, must be called with ./tr of course
3285 cat >tr <<EOSC
3286 $startsh
3287 case "\$1\$2" in
3288 '[A-Z][a-z]') exec $tr '$up' '$low';;
3289 '[a-z][A-Z]') exec $tr '$low' '$up';;
3290 esac
3291 exec $tr "\$@"
3292 EOSC
3293 chmod +x tr
3294 $eunicefix tr
3295
3296 : Try to determine whether config.sh was made on this system
3297 case "$config_sh" in
3298 '')
3299 myuname=`$uname -a 2>/dev/null`
3300 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3301 # Downcase everything to avoid ambiguity.
3302 # Remove slashes and single quotes so we can use parts of this in
3303 # directory and file names.
3304 # Remove newlines so myuname is sane to use elsewhere.
3305 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3306 # because the A-Z/a-z are not consecutive.
3307 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3308         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3309 newmyuname="$myuname"
3310 dflt=n
3311 case "$knowitall" in
3312 '')
3313         if test -f ../config.sh; then
3314                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3315                         eval "`grep myuname= ../config.sh`"
3316                 fi
3317                 if test "X$myuname" = "X$newmyuname"; then
3318                         dflt=y
3319                 fi
3320         fi
3321         ;;
3322 *) dflt=y;;
3323 esac
3324
3325 : Get old answers from old config file if Configure was run on the
3326 : same system, otherwise use the hints.
3327 hint=default
3328 cd ..
3329 if test -f config.sh; then
3330         echo " "
3331         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3332         . UU/myread
3333         case "$ans" in
3334         n*|N*) echo "OK, I'll ignore it."
3335                 mv config.sh config.sh.old
3336                 myuname="$newmyuname"
3337                 ;;
3338         *)  echo "Fetching default answers from your old config.sh file..." >&4
3339                 tmp_n="$n"
3340                 tmp_c="$c"
3341                 tmp_sh="$sh"
3342                 . ./config.sh
3343                 cp config.sh UU
3344                 n="$tmp_n"
3345                 c="$tmp_c"
3346                 : Older versions did not always set $sh.  Catch re-use of such
3347                 : an old config.sh.
3348                 case "$sh" in
3349                 '') sh="$tmp_sh" ;;
3350                 esac
3351                 hint=previous
3352                 ;;
3353         esac
3354 fi
3355 . ./UU/checkcc
3356 if test ! -f config.sh; then
3357         $cat <<EOM
3358
3359 First time through, eh?  I have some defaults handy for some systems
3360 that need some extra help getting the Configure answers right:
3361
3362 EOM
3363         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3364         dflt=''
3365         : Half the following guesses are probably wrong... If you have better
3366         : tests or hints, please send them to perlbug@perl.org
3367         : The metaconfig authors would also appreciate a copy...
3368         $test -f /irix && osname=irix
3369         $test -f /xenix && osname=sco_xenix
3370         $test -f /dynix && osname=dynix
3371         $test -f /dnix && osname=dnix
3372         $test -f /lynx.os && osname=lynxos
3373         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3374         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3375         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3376         $test -f /bin/mips && /bin/mips && osname=mips
3377         $test -d /usr/apollo/bin && osname=apollo
3378         $test -f /etc/saf/_sactab && osname=svr4
3379         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3380         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3381         $test -f /sys/utilities/MultiView && osname=amigaos
3382         if $test -d /MachTen -o -d /MachTen_Folder; then
3383                 osname=machten
3384                 if $test -x /sbin/version; then
3385                         osvers=`/sbin/version | $awk '{print $2}' |
3386                         $sed -e 's/[A-Za-z]$//'`
3387                 elif $test -x /usr/etc/version; then
3388                         osvers=`/usr/etc/version | $awk '{print $2}' |
3389                         $sed -e 's/[A-Za-z]$//'`
3390                 else
3391                         osvers="$2.$3"
3392                 fi
3393         fi
3394
3395         $test -f /sys/posix.dll &&
3396                 $test -f /usr/bin/what &&
3397                 set X `/usr/bin/what /sys/posix.dll` &&
3398                 $test "$3" = UWIN &&
3399                 osname=uwin &&
3400                 osvers="$5"
3401
3402         if $test -f $uname; then
3403                 set X $myuname
3404                 shift
3405
3406                 case "$5" in
3407                 fps*) osname=fps ;;
3408                 mips*)
3409                         case "$4" in
3410                         umips) osname=umips ;;
3411                         *) osname=mips ;;
3412                         esac;;
3413                 [23]100) osname=mips ;;
3414                 i386*)
3415                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3416                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3417                                 osname='sco'
3418                                 osvers=$tmp
3419                         elif $test -f /etc/kconfig; then
3420                                 osname=isc
3421                                 if test "$lns" = "$ln -s"; then
3422                                         osvers=4
3423                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3424                                         osvers=3
3425                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3426                                         osvers=2
3427                                 fi
3428                         fi
3429                         tmp=''
3430                         ;;
3431                 pc*)
3432                         if test -n "$DJGPP"; then
3433                                 osname=dos
3434                                 osvers=djgpp
3435                         fi
3436                         ;;
3437                 esac
3438
3439                 case "$1" in
3440                 aix) osname=aix
3441                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3442                         case "$tmp" in
3443                         # oslevel can fail with:
3444                         # oslevel: Unable to acquire lock.
3445                         *not\ found) osvers="$4"."$3" ;;
3446                         '<3240'|'<>3240') osvers=3.2.0 ;;
3447                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3448                         '=3250'|'>3250') osvers=3.2.5 ;;
3449                         *) osvers=$tmp;;
3450                         esac
3451                         ;;
3452                 bitrig) osname=bitrig
3453                         osvers="$3"
3454                         ;;
3455                 bsd386) osname=bsd386
3456                         osvers=`$uname -r`
3457                         ;;
3458                 cygwin*) osname=cygwin
3459                         osvers="$3"
3460                         ;;
3461                 *dc.osx) osname=dcosx
3462                         osvers="$3"
3463                         ;;
3464                 dnix) osname=dnix
3465                         osvers="$3"
3466                         ;;
3467                 domainos) osname=apollo
3468                         osvers="$3"
3469                         ;;
3470                 dgux)   osname=dgux
3471                         osvers="$3"
3472                         ;;
3473                 dragonfly) osname=dragonfly
3474                         osvers="$3"
3475                         ;;
3476                 dynixptx*) osname=dynixptx
3477                         osvers=`echo "$4"|sed 's/^v//'`
3478                         ;;
3479                 freebsd) osname=freebsd
3480                         osvers="$3" ;;
3481                 genix)  osname=genix ;;
3482                 gnu)    osname=gnu
3483                         osvers="$3" ;;
3484                 hp*)    osname=hpux
3485                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3486                         ;;
3487                 irix*)  osname=irix
3488                         case "$3" in
3489                         4*) osvers=4 ;;
3490                         5*) osvers=5 ;;
3491                         *)      osvers="$3" ;;
3492                         esac
3493                         ;;
3494                 linux)  osname=linux
3495                         case "$3" in
3496                         *)      osvers="$3" ;;
3497                         esac
3498                         $test -f /system/lib/libandroid.so && osname=linux-android
3499                         ;;
3500                 MiNT)   osname=mint
3501                         ;;
3502                 netbsd*) osname=netbsd
3503                         osvers="$3"
3504                         ;;
3505                 news-os) osvers="$3"
3506                         case "$3" in
3507                         4*) osname=newsos4 ;;
3508                         *) osname=newsos ;;
3509                         esac
3510                         ;;
3511                 nonstop-ux) osname=nonstopux ;;
3512                 openbsd) osname=openbsd
3513                         osvers="$3"
3514                         ;;
3515                 os2)    osname=os2
3516                         osvers="$4"
3517                         ;;
3518                 POSIX-BC | posix-bc ) osname=posix-bc
3519                         osvers="$3"
3520                         ;;
3521                 powerux | power_ux | powermax_os | powermaxos | \
3522                 powerunix | power_unix) osname=powerux
3523                         osvers="$3"
3524                         ;;
3525                 qnx) osname=qnx
3526                         osvers="$4"
3527                         ;;
3528                 solaris) osname=solaris
3529                         case "$3" in
3530                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3531                         *)      osvers="$3" ;;
3532                         esac
3533                         ;;
3534                 sunos) osname=sunos
3535                         case "$3" in
3536                         5*) osname=solaris
3537                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3538                         *)      osvers="$3" ;;
3539                         esac
3540                         ;;
3541                 titanos) osname=titanos
3542                         case "$3" in
3543                         1*) osvers=1 ;;
3544                         2*) osvers=2 ;;
3545                         3*) osvers=3 ;;
3546                         4*) osvers=4 ;;
3547                         *)      osvers="$3" ;;
3548                         esac
3549                         ;;
3550                 ultrix) osname=ultrix
3551                         osvers="$3"
3552                         ;;
3553                 osf1|mls+)      case "$5" in
3554                                 alpha)
3555                                         osname=dec_osf
3556                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3557                                         case "$osvers" in
3558                                         [1-9].[0-9]*) ;;
3559                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3560                                         esac
3561                                         ;;
3562                         hp*)    osname=hp_osf1  ;;
3563                         mips)   osname=mips_osf1 ;;
3564                         esac
3565                         ;;
3566                 # UnixWare 7.1.2 is known as Open UNIX 8
3567                 openunix|unixware) osname=svr5
3568                         osvers="$4"
3569                         ;;
3570                 uts)    osname=uts
3571                         osvers="$3"
3572                         ;;
3573                 vos) osvers="$3"
3574                         ;;
3575                 $2) case "$osname" in
3576                         *isc*) ;;
3577                         *freebsd*) ;;
3578                         svr*)
3579                                 : svr4.x or possibly later
3580                                 case "svr$3" in
3581                                 ${osname}*)
3582                                         osname=svr$3
3583                                         osvers=$4
3584                                         ;;
3585                                 esac
3586                                 case "$osname" in
3587                                 svr4.0)
3588                                         : Check for ESIX
3589                                         if test -f /stand/boot ; then
3590                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3591                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3592                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3593                                                         if test -n "$isesix"; then
3594                                                                 osname=esix4
3595                                                         fi
3596                                                 fi
3597                                         fi
3598                                         ;;
3599                                 esac
3600                                 ;;
3601                         *)      if test -f /etc/systemid; then
3602                                         osname=sco
3603                                         set `echo $3 | $sed 's/\./ /g'` $4
3604                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3605                                                 osvers=$1.$2.$3
3606                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3607                                                 osvers=$1.$2
3608                                         elif $test -f $src/hints/sco_$1.sh; then
3609                                                 osvers=$1
3610                                         fi
3611                                 else
3612                                         case "$osname" in
3613                                         '') : Still unknown.  Probably a generic Sys V.
3614                                                 osname="sysv"
3615                                                 osvers="$3"
3616                                                 ;;
3617                                         esac
3618                                 fi
3619                                 ;;
3620                         esac
3621                         ;;
3622                 *)      case "$osname" in
3623                         '') : Still unknown.  Probably a generic BSD.
3624                                 osname="$1"
3625                                 osvers="$3"
3626                                 ;;
3627                         esac
3628                         ;;
3629                 esac
3630         else
3631                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3632                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3633                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3634                                 osname=news_os
3635                         fi
3636                         $rm -f UU/kernel.what
3637                 elif test -d c:/. -o -n "$is_os2" ; then
3638                         set X $myuname
3639                         osname=os2
3640                         osvers="$5"
3641                 fi
3642         fi
3643
3644         case "$targetarch" in
3645         '') ;;
3646         *)  hostarch=$osname
3647             case "$targetarch" in
3648                 nto*|*-nto-*)
3649                     # Will load qnx.sh, which should change osname to nto
3650                     osname=qnx
3651                     osvers=''
3652                     ;;
3653                 *linux-android*)
3654                     # Catch arm-linux-androideabi, mipsel-linux-android,
3655                     # and i686-linux-android
3656                     osname=linux-android
3657                     osvers=''
3658                     ;;
3659                 *linux*)
3660                     # Something like arm-linux-gnueabihf is really just
3661                     # plain linux.
3662                     osname=linux
3663                     osvers=''
3664                     ;;
3665                 *solaris*|*sunos*)
3666                     osname=solaris
3667                     # XXX perhaps we should just assume
3668                     # osvers to be 2, or maybe take the value
3669                     # from targetarch. Using $run before the
3670                     # hints are run is somewhat icky.
3671                     set X `$run $uname -a 2>/dev/null`
3672                     shift
3673                     case "$3" in
3674                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3675                         *)  osvers="$3" ;;
3676                     esac
3677                     ;;
3678                 *)
3679                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3680                     osvers=''
3681                 ;;
3682             esac
3683             ;;
3684         esac
3685
3686         : Now look for a hint file osname_osvers, unless one has been
3687         : specified already.
3688         case "$hintfile" in
3689         ''|' ')
3690                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3691                 : Also try without trailing minor version numbers.
3692                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3693                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3694                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3695                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3696                 case "$file" in
3697                 '') dflt=none ;;
3698                 *)  case "$osvers" in
3699                         '') dflt=$file
3700                                 ;;
3701                         *)  if $test -f $src/hints/$file.sh ; then
3702                                         dflt=$file
3703                                 elif $test -f $src/hints/$xfile.sh ; then
3704                                         dflt=$xfile
3705                                 elif $test -f $src/hints/$xxfile.sh ; then
3706                                         dflt=$xxfile
3707                                 elif $test -f $src/hints/$xxxfile.sh ; then
3708                                         dflt=$xxxfile
3709                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3710                                         dflt=$xxxxfile
3711                                 elif $test -f "$src/hints/${osname}.sh" ; then
3712                                         dflt="${osname}"
3713                                 else
3714                                         dflt=none
3715                                 fi
3716                                 ;;
3717                         esac
3718                         ;;
3719                 esac
3720                 if $test -f Policy.sh ; then
3721                         case "$dflt" in
3722                         *Policy*) ;;
3723                         none) dflt="Policy" ;;
3724                         *) dflt="Policy $dflt" ;;
3725                         esac
3726                 fi
3727                 ;;
3728         *)
3729                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3730                 ;;
3731         esac
3732
3733         if $test -f Policy.sh ; then
3734                 $cat <<EOM
3735
3736 There's also a Policy hint file available, which should make the
3737 site-specific (policy) questions easier to answer.
3738 EOM
3739
3740         fi
3741
3742         $cat <<EOM
3743
3744 You may give one or more space-separated answers, or "none" if appropriate.
3745 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3746 previous run of Configure, you may specify it as well as or instead of
3747 OS-specific hints.  If hints are provided for your OS, you should use them:
3748 although Perl can probably be built without hints on many platforms, using
3749 hints often improve performance and may enable features that Configure can't
3750 set up on its own. If there are no hints that match your OS, specify "none";
3751 DO NOT give a wrong version or a wrong OS.
3752
3753 EOM
3754
3755         rp="Which of these apply, if any?"
3756         . UU/myread
3757         tans=$ans
3758         for file in $tans; do
3759                 if $test X$file = XPolicy -a -f Policy.sh; then
3760                         . Policy.sh
3761                         $cat Policy.sh >> UU/config.sh
3762                 elif $test -f $src/hints/$file.sh; then
3763                         . $src/hints/$file.sh
3764                         $cat $src/hints/$file.sh >> UU/config.sh
3765                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3766                         : nothing
3767                 else
3768                         : Give one chance to correct a possible typo.
3769                         echo "$file.sh does not exist"
3770                         dflt=$file
3771                         rp="hint to use instead?"
3772                         . UU/myread
3773                         for file in $ans; do
3774                                 if $test -f "$src/hints/$file.sh"; then
3775                                         . $src/hints/$file.sh
3776                                         $cat $src/hints/$file.sh >> UU/config.sh
3777                                 elif $test X$ans = X -o X$ans = Xnone ; then
3778                                         : nothing
3779                                 else
3780                                         echo "$file.sh does not exist -- ignored."
3781                                 fi
3782                         done
3783                 fi
3784         done
3785
3786         hint=recommended
3787         : Remember our hint file for later.
3788         if $test -f "$src/hints/$file.sh" ; then
3789                 hintfile="$file"
3790         else
3791                 hintfile=''
3792         fi
3793 fi
3794 cd UU
3795 ;;
3796 *)
3797         echo " "
3798         echo "Fetching default answers from $config_sh..." >&4
3799         tmp_n="$n"
3800         tmp_c="$c"
3801         cd ..
3802         cp $config_sh config.sh 2>/dev/null
3803         chmod +w config.sh
3804         . ./config.sh
3805         cd UU
3806         cp ../config.sh .
3807         n="$tmp_n"
3808         c="$tmp_c"
3809         hint=previous
3810         ;;
3811 esac
3812 . ./optdef.sh
3813
3814 : Restore computed paths
3815 for file in $loclist $trylist; do
3816         eval $file="\$_$file"
3817 done
3818
3819 cat << EOM
3820
3821 Configure uses the operating system name and version to set some defaults.
3822 The default value is probably right if the name rings a bell. Otherwise,
3823 since spelling matters for me, either accept the default or answer "none"
3824 to leave it blank.
3825
3826 EOM
3827 case "$osname" in
3828         ''|' ')
3829                 case "$hintfile" in
3830                 ''|' '|none) dflt=none ;;
3831                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3832                 esac
3833                 ;;
3834         *) dflt="$osname" ;;
3835 esac
3836 rp="Operating system name?"
3837 . ./myread
3838 case "$ans" in
3839 none)  osname='' ;;
3840 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3841 esac
3842 echo " "
3843 case "$osvers" in
3844         ''|' ')
3845                 case "$hintfile" in
3846                 ''|' '|none) dflt=none ;;
3847                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3848                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3849                         case "$dflt" in
3850                         ''|' ') dflt=none ;;
3851                         esac
3852                         ;;
3853                 esac
3854                 ;;
3855         *) dflt="$osvers" ;;
3856 esac
3857 rp="Operating system version?"
3858 . ./myread
3859 case "$ans" in
3860 none)  osvers='' ;;
3861 *) osvers="$ans" ;;
3862 esac
3863
3864
3865 . ./posthint.sh
3866
3867 : who configured the system
3868 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3869 case "$cf_by" in
3870 "")
3871         cf_by=`(logname) 2>/dev/null`
3872         case "$cf_by" in
3873         "")
3874                 cf_by=`(whoami) 2>/dev/null`
3875                 case "$cf_by" in
3876                 "") cf_by=unknown ;;
3877                 esac ;;
3878         esac ;;
3879 esac
3880
3881 : decide how portable to be.  Allow command line overrides.
3882 case "$d_portable" in
3883 "$undef") ;;
3884 *)      d_portable="$define" ;;
3885 esac
3886
3887 : set up shell script to do ~ expansion
3888 cat >filexp <<EOSS
3889 $startsh
3890 : expand filename
3891 case "\$1" in
3892  \~/*|\~)
3893         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3894         ;;
3895  \~*)
3896         if $test -f /bin/csh; then
3897                 /bin/csh -f -c "glob \$1"
3898                 failed=\$?
3899                 echo ""
3900                 exit \$failed
3901         else
3902                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3903                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3904                 if $test ! -d "\$dir"; then
3905                         me=\`basename \$0\`
3906                         echo "\$me: can't locate home directory for: \$name" >&2
3907                         exit 1
3908                 fi
3909                 case "\$1" in
3910                 */*)
3911                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3912                         ;;
3913                 *)
3914                         echo \$dir
3915                         ;;
3916                 esac
3917         fi
3918         ;;
3919 *)
3920         echo \$1
3921         ;;
3922 esac
3923 EOSS
3924 chmod +x filexp
3925 $eunicefix filexp
3926
3927 : now set up to get a file name
3928 cat <<EOS >getfile
3929 $startsh
3930 EOS
3931 cat <<'EOSC' >>getfile
3932 tilde=''
3933 fullpath=''
3934 already=''
3935 skip=''
3936 none_ok=''
3937 exp_file=''
3938 nopath_ok=''
3939 orig_rp="$rp"
3940 orig_dflt="$dflt"
3941 case "$gfpth" in
3942 '') gfpth='.' ;;
3943 esac
3944
3945 case "$fn" in
3946 *\(*)
3947         : getfile will accept an answer from the comma-separated list
3948         : enclosed in parentheses even if it does not meet other criteria.
3949         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3950         fn=`echo $fn | sed 's/(.*)//'`
3951         ;;
3952 esac
3953
3954 case "$fn" in
3955 *:*)
3956         loc_file=`expr $fn : '.*:\(.*\)'`
3957         fn=`expr $fn : '\(.*\):.*'`
3958         ;;
3959 esac
3960
3961 case "$fn" in
3962 *~*) tilde=true;;
3963 esac
3964 case "$fn" in
3965 */*) fullpath=true;;
3966 esac
3967 case "$fn" in
3968 *+*) skip=true;;
3969 esac
3970 case "$fn" in
3971 *n*) none_ok=true;;
3972 esac
3973 case "$fn" in
3974 *e*) exp_file=true;;
3975 esac
3976 case "$fn" in
3977 *p*) nopath_ok=true;;
3978 esac
3979
3980 case "$fn" in
3981 *f*) type='File';;
3982 *d*) type='Directory';;
3983 *l*) type='Locate';;
3984 esac
3985
3986 what="$type"
3987 case "$what" in
3988 Locate) what='File';;
3989 esac
3990
3991 case "$exp_file" in
3992 '')
3993         case "$d_portable" in
3994         "$define") ;;
3995         *) exp_file=true;;
3996         esac
3997         ;;
3998 esac
3999
4000 cd ..
4001 while test "$type"; do
4002         redo=''
4003         rp="$orig_rp"
4004         dflt="$orig_dflt"
4005         case "$tilde" in
4006         true) rp="$rp (~name ok)";;
4007         esac
4008         . UU/myread
4009         if test -f UU/getfile.ok && \
4010                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4011         then
4012                 value="$ans"
4013                 ansexp="$ans"
4014                 break
4015         fi
4016         case "$ans" in
4017         none)
4018                 value=''
4019                 ansexp=''
4020                 case "$none_ok" in
4021                 true) type='';;
4022                 esac
4023                 ;;
4024         *)
4025                 case "$tilde" in
4026                 '') value="$ans"
4027                         ansexp="$ans";;
4028                 *)
4029                         value=`UU/filexp $ans`
4030                         case $? in
4031                         0)
4032                                 if test "$ans" != "$value"; then
4033                                         echo "(That expands to $value on this system.)"
4034                                 fi
4035                                 ;;
4036                         *) value="$ans";;
4037                         esac
4038                         ansexp="$value"
4039                         case "$exp_file" in
4040                         '') value="$ans";;
4041                         esac
4042                         ;;
4043                 esac
4044                 case "$fullpath" in
4045                 true)
4046                         case "$ansexp" in
4047                         /*) value="$ansexp" ;;
4048                         [a-zA-Z]:/*) value="$ansexp" ;;
4049                         *)
4050                                 redo=true
4051                                 case "$already" in
4052                                 true)
4053                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4054                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4055                                         ;;
4056                                 *)
4057                                 echo "Please give a full path name, starting with slash." >&4
4058                                         case "$tilde" in
4059                                         true)
4060                                 echo "Note that using ~name is ok provided it expands well." >&4
4061                                                 already=true
4062                                                 ;;
4063                                         esac
4064                                 esac
4065                                 ;;
4066                         esac
4067                         ;;
4068                 esac
4069                 case "$redo" in
4070                 '')
4071                         case "$type" in
4072                         File)
4073                                 for fp in $gfpth; do
4074                                         if test "X$fp" = X.; then
4075                                             pf="$ansexp"
4076                                         else    
4077                                             pf="$fp/$ansexp"
4078                                         fi
4079                                         if test -f "$pf"; then
4080                                                 type=''
4081                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4082                                         then
4083                                                 echo "($value is not a plain file, but that's ok.)"
4084                                                 type=''
4085                                         fi
4086                                         if test X"$type" = X; then
4087                                             value="$pf"
4088                                             break
4089                                         fi
4090                                 done
4091                                 ;;
4092                         Directory)
4093                                 for fp in $gfpth; do
4094                                         if test "X$fp" = X.; then
4095                                             dir="$ans"
4096                                             direxp="$ansexp"
4097                                         else    
4098                                             dir="$fp/$ansexp"
4099                                             direxp="$fp/$ansexp"
4100                                         fi
4101                                         if test -d "$direxp"; then
4102                                                 type=''
4103                                                 value="$dir"
4104                                                 break
4105                                         fi
4106                                 done
4107                                 ;;
4108                         Locate)
4109                                 if test -d "$ansexp"; then
4110                                         echo "(Looking for $loc_file in directory $value.)"
4111                                         value="$value/$loc_file"
4112                                         ansexp="$ansexp/$loc_file"
4113                                 fi
4114                                 if test -f "$ansexp"; then
4115                                         type=''
4116                                 fi
4117                                 case "$nopath_ok" in
4118                                 true)   case "$value" in
4119                                         */*) ;;
4120                                         *)      echo "Assuming $value will be in people's path."
4121                                                 type=''
4122                                                 ;;
4123                                         esac
4124                                         ;;
4125                                 esac
4126                                 ;;
4127                         esac
4128
4129                         case "$skip" in
4130                         true) type='';
4131                         esac
4132
4133                         case "$type" in
4134                         '') ;;
4135                         *)
4136                                 if test "$fastread" = yes; then
4137                                         dflt=y
4138                                 else
4139                                         dflt=n
4140                                 fi
4141                                 rp="$what $value doesn't exist.  Use that name anyway?"
4142                                 . UU/myread
4143                                 dflt=''
4144                                 case "$ans" in
4145                                 y*) type='';;
4146                                 *) echo " ";;
4147                                 esac
4148                                 ;;
4149                         esac
4150                         ;;
4151                 esac
4152                 ;;
4153         esac
4154 done
4155 cd UU
4156 ans="$value"
4157 rp="$orig_rp"
4158 dflt="$orig_dflt"
4159 rm -f getfile.ok
4160 test "X$gfpthkeep" != Xy && gfpth=""
4161 EOSC
4162
4163 : determine root of directory hierarchy where package will be installed.
4164 case "$prefix" in
4165 '')
4166         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4167         ;;
4168 *?/)
4169         dflt=`echo "$prefix" | sed 's/.$//'`
4170         ;;
4171 *)
4172         dflt="$prefix"
4173         ;;
4174 esac
4175 $cat <<EOM
4176
4177 By default, $package will be installed in $dflt/bin, manual pages
4178 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4179 installation directories. Typically this is something like /usr/local.
4180 If you wish to have binaries under /usr/bin but other parts of the
4181 installation under /usr/local, that's ok: you will be prompted
4182 separately for each of the installation directories, the prefix being
4183 only used to set the defaults.
4184
4185 EOM
4186 fn=d~
4187 rp='Installation prefix to use?'
4188 . ./getfile
4189 oldprefix=''
4190 case "$prefix" in
4191 '') ;;
4192 *)
4193         case "$ans" in
4194         "$prefix") ;;
4195         *) oldprefix="$prefix";;
4196         esac
4197         ;;
4198 esac
4199 prefix="$ans"
4200 prefixexp="$ansexp"
4201
4202 : allow them to override the AFS root
4203 case "$afsroot" in
4204 '')     afsroot=/afs ;;
4205 *)      afsroot=$afsroot ;;
4206 esac
4207
4208 : is AFS running?
4209 echo " "
4210 case "$afs" in
4211 $define|true)   afs=true ;;
4212 $undef|false)   afs=false ;;
4213 *)      if $test -d $afsroot; then
4214                 afs=true
4215         else
4216                 afs=false
4217         fi
4218         ;;
4219 esac
4220 if $afs; then
4221         echo "AFS may be running... I'll be extra cautious then..." >&4
4222 else
4223         echo "AFS does not seem to be running..." >&4
4224 fi
4225
4226 : determine installation prefix for where package is to be installed.
4227 if $afs; then
4228 $cat <<EOM
4229
4230 Since you are running AFS, I need to distinguish the directory in which
4231 files will reside from the directory in which they are installed (and from
4232 which they are presumably copied to the former directory by occult means).
4233
4234 EOM
4235         case "$installprefix" in
4236         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4237         *) dflt="$installprefix";;
4238         esac
4239 else
4240 $cat <<EOM
4241
4242 In some special cases, particularly when building $package for distribution,
4243 it is convenient to distinguish the directory in which files should be
4244 installed from the directory ($prefix) in which they will
4245 eventually reside.  For most users, these two directories are the same.
4246
4247 EOM
4248         case "$installprefix" in
4249         '') dflt=$prefix ;;
4250         *) dflt=$installprefix;;
4251         esac
4252 fi
4253 fn=d~
4254 rp='What installation prefix should I use for installing files?'
4255 . ./getfile
4256 installprefix="$ans"
4257 installprefixexp="$ansexp"
4258
4259 : Perform the prefixexp/installprefixexp correction if necessary
4260 cat <<EOS >installprefix
4261 $startsh
4262 EOS
4263 cat <<'EOSC' >>installprefix
4264 : Change installation prefix, if necessary.
4265 if $test X"$prefix" != X"$installprefix"; then
4266     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4267 else
4268     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4269 fi
4270 EOSC
4271 chmod +x installprefix
4272 $eunicefix installprefix
4273
4274 : Set variables such as privlib and privlibexp from the output of ./getfile
4275 : performing the prefixexp/installprefixexp correction if necessary.
4276 cat <<EOS >setprefixvar
4277 $startsh
4278 EOS
4279 cat <<'EOSC' >>setprefixvar
4280 eval "${prefixvar}=\"\$ans\""
4281 eval "${prefixvar}exp=\"\$ansexp\""
4282 . ./installprefix
4283 EOSC
4284 chmod +x setprefixvar
4285 $eunicefix setprefixvar
4286
4287 : set up the script used to warn in case of inconsistency
4288 cat <<EOS >whoa
4289 $startsh
4290 EOS
4291 cat <<'EOSC' >>whoa
4292 dflt=y
4293 case "$hint" in
4294     recommended)
4295         case "$hintfile" in
4296         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4297                 ;;
4298         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4299                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4300                 ;;
4301         esac
4302         ;;
4303     *)  echo " "
4304         echo "*** WHOA THERE!!! ***" >&4
4305         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4306         ;;
4307 esac
4308 rp="    Keep the $hint value?"
4309 . ./myread
4310 case "$ans" in
4311 y) td=$was; tu=$was;;
4312 esac
4313 EOSC
4314
4315 : function used to set '$1' to '$val'
4316 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4317 case "$val$was" in
4318 $define$undef) . ./whoa; eval "$var=\$td";;
4319 $undef$define) . ./whoa; eval "$var=\$tu";;
4320 *) eval "$var=$val";;
4321 esac'
4322
4323 : get the patchlevel
4324 echo " "
4325 echo "Getting the current patchlevel..." >&4
4326 if $test -r $rsrc/patchlevel.h;then
4327         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4328         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4329         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4330         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4331         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4332         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4333         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4334 else
4335         revision=0
4336         patchlevel=0
4337         subversion=0
4338         api_revision=0
4339         api_version=0
4340         api_subversion=0
4341         perl_patchlevel=0
4342         $echo "(You do not have patchlevel.h.  Eek.)"
4343 fi
4344 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4345 version_patchlevel_string="version $patchlevel subversion $subversion"
4346 case "$perl_patchlevel" in
4347 0|'') ;;
4348 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4349     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4350     ;;
4351 esac
4352
4353 $echo "(You have $package $version_patchlevel_string.)"
4354
4355 case "$osname" in
4356 dos|vms)
4357         : XXX Should be a Configure test for double-dots in filenames.
4358         version=`echo $revision $patchlevel $subversion | \
4359                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4360         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4361                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4362         ;;
4363 *)
4364         version=`echo $revision $patchlevel $subversion | \
4365                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4366         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4367                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4368         ;;
4369 esac
4370 : Special case the 5.005_xx maintenance series, which used 5.005
4371 : without any subversion label as a subdirectory in $sitelib
4372 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4373         api_versionstring='5.005'
4374 fi
4375
4376 : Do we want threads support and if so, what type
4377 case "$usethreads" in
4378 $define|true|[yY]*)     dflt='y';;
4379 *)     # Catch case where user specified ithreads or 5005threads but
4380        # forgot -Dusethreads (A.D. 4/2002)
4381        case "$useithreads$use5005threads" in
4382        *$define*)       dflt='y';;
4383        *)               dflt='n';;
4384        esac
4385        ;;
4386 esac
4387 cat <<EOM
4388
4389 Perl can be built to offer a form of threading support on some systems
4390 To do so, Configure can be run with -Dusethreads.
4391
4392 Note that Perl built with threading support runs slightly slower
4393 and uses slightly more memory than plain Perl.
4394
4395 If this doesn't make any sense to you, just accept the default '$dflt'.
4396 EOM
4397 rp='Build a threading Perl?'
4398 . ./myread
4399 case "$ans" in
4400 y|Y)    val="$define" ;;
4401 *)      val="$undef" ;;
4402 esac
4403 set usethreads
4404 eval $setvar
4405
4406 if $test $patchlevel -lt 9; then
4407     case "$usethreads" in
4408     $define)
4409         : Default to ithreads unless overridden on command line or with
4410         : old config.sh
4411         dflt='y'
4412         case "$use5005threads" in
4413                 $define|true|[yY]*)
4414                         echo "5.005 threads are no longer supported"
4415                         exit 1
4416                 ;;
4417         esac
4418         case "$useithreads" in
4419                 $undef|false|[nN]*) dflt='n';;
4420         esac
4421         rp='Use the newer interpreter-based ithreads?'
4422         . ./myread
4423         case "$ans" in
4424         y|Y)    val="$define" ;;
4425         *)      val="$undef" ;;
4426         esac
4427         set useithreads
4428         eval $setvar
4429         : Now set use5005threads to the opposite value.
4430         case "$useithreads" in
4431         $define) val="$undef" ;;
4432         *) val="$define" ;;
4433         esac
4434         set use5005threads
4435         eval $setvar
4436         ;;
4437     *)
4438         useithreads="$undef"
4439         use5005threads="$undef"
4440         ;;
4441     esac
4442
4443     case "$useithreads$use5005threads" in
4444     "$define$define")
4445         $cat >&4 <<EOM
4446
4447 You cannot have both the ithreads and the 5.005 threads enabled
4448 at the same time.  Disabling the 5.005 threads since they are
4449 much less stable than the ithreads.
4450
4451 EOM
4452         use5005threads="$undef"
4453         ;;
4454     esac
4455
4456 else
4457 : perl-5.9.x and later
4458
4459     if test X"$usethreads" = "X$define"; then
4460         case "$use5005threads" in
4461             $define|true|[yY]*)
4462                 $cat >&4 <<EOM
4463
4464 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4465
4466 EOM
4467             ;;
4468         esac
4469     fi
4470
4471     use5005threads="$undef"
4472     useithreads="$usethreads"
4473 fi
4474
4475 case "$d_oldpthreads" in
4476 '')     : Configure tests would be welcome here.  For now, assume undef.
4477         val="$undef" ;;
4478 *)      val="$d_oldpthreads" ;;
4479 esac
4480 set d_oldpthreads
4481 eval $setvar
4482
4483
4484 : Look for a hint-file generated 'call-back-unit'.  If the
4485 : user has specified that a threading perl is to be built,
4486 : we may need to set or change some other defaults.
4487 if $test -f usethreads.cbu; then
4488     echo "Your platform has some specific hints regarding threaded builds, using them..."
4489     . ./usethreads.cbu
4490 else
4491     case "$usethreads" in
4492         "$define"|true|[yY]*)
4493                 $cat <<EOM
4494 (Your platform does not have any specific hints for threaded builds.
4495  Assuming POSIX threads, then.)
4496 EOM
4497         ;;
4498     esac
4499 fi
4500
4501 : Check if multiplicity is required
4502 cat <<EOM
4503
4504 Perl can be built so that multiple Perl interpreters can coexist
4505 within the same Perl executable.
4506 EOM
4507
4508 case "$useithreads" in
4509 $define)
4510         cat <<EOM
4511 This multiple interpreter support is required for interpreter-based threads.
4512 EOM
4513         val="$define"
4514         ;;
4515 *)      case "$usemultiplicity" in
4516         $define|true|[yY]*)     dflt='y';;
4517         *) dflt='n';;
4518         esac
4519         echo " "
4520         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4521         rp='Build Perl for multiplicity?'
4522         . ./myread
4523         case "$ans" in
4524         y|Y)    val="$define" ;;
4525         *)      val="$undef" ;;
4526         esac
4527         ;;
4528 esac
4529 set usemultiplicity
4530 eval $setvar
4531
4532 : Check if morebits is requested
4533 case "$usemorebits" in
4534 "$define"|true|[yY]*)
4535         use64bitint="$define"
4536         uselongdouble="$define"
4537         usemorebits="$define"
4538         ;;
4539 *)      usemorebits="$undef"
4540         ;;
4541 esac
4542
4543 : Determine the C compiler to be used
4544 echo " "
4545 case "$cc" in
4546 '') dflt=cc;;
4547 *) dflt="$cc";;
4548 esac
4549 rp="Use which C compiler?"
4550 . ./myread
4551 cc="$ans"
4552
4553 : See whether they have no cc but they do have gcc
4554 . ./trygcc
4555 if $test -f cc.cbu; then
4556     . ./cc.cbu
4557 fi
4558 . ./checkcc
4559
4560 : make some quick guesses about what we are up against
4561 echo " "
4562 $echo $n "Hmm...  $c"
4563 echo exit 1 >bsd
4564 echo exit 1 >usg
4565 echo exit 1 >v7
4566 echo exit 1 >osf1
4567 echo exit 1 >eunice
4568 echo exit 1 >xenix
4569 echo exit 1 >venix
4570 echo exit 1 >os2
4571 d_bsd="$undef"
4572 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4573 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4574 then
4575         echo "Looks kind of like an OSF/1 system, but we'll see..."
4576         echo exit 0 >osf1
4577 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4578         xxx=`./loc addbib blurfl $pth`
4579         if $test -f $xxx; then
4580         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4581                 echo exit 0 >bsd
4582                 echo exit 0 >usg
4583         else
4584                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4585                         echo "Looks kind of like an extended USG system, but we'll see..."
4586                 else
4587                         echo "Looks kind of like a USG system, but we'll see..."
4588                 fi
4589                 echo exit 0 >usg
4590         fi
4591 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4592         echo "Looks kind of like a BSD system, but we'll see..."
4593         d_bsd="$define"
4594         echo exit 0 >bsd
4595 else
4596         echo "Looks kind of like a Version 7 system, but we'll see..."
4597         echo exit 0 >v7
4598 fi
4599 case "$eunicefix" in
4600 *unixtovms*)
4601         $cat <<'EOI'
4602 There is, however, a strange, musty smell in the air that reminds me of
4603 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4604 EOI
4605         echo exit 0 >eunice
4606         d_eunice="$define"
4607 : it so happens the Eunice I know will not run shell scripts in Unix format
4608         ;;
4609 *)
4610         echo " "
4611         echo "Congratulations.  You aren't running Eunice."
4612         d_eunice="$undef"
4613         ;;
4614 esac
4615 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4616 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4617 : semicolon as a patch separator
4618 case "$p_" in
4619 :) ;;
4620 *)
4621         $cat <<'EOI'
4622 I have the feeling something is not exactly right, however...don't tell me...
4623 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4624 (Or you may be running DOS with DJGPP.)
4625 EOI
4626         echo exit 0 >os2
4627         ;;
4628 esac
4629 if test -f /xenix; then
4630         echo "Actually, this looks more like a XENIX system..."
4631         echo exit 0 >xenix
4632         d_xenix="$define"
4633 else
4634         echo " "
4635         echo "It's not Xenix..."
4636         d_xenix="$undef"
4637 fi
4638 chmod +x xenix
4639 $eunicefix xenix
4640 if test -f /venix; then
4641         echo "Actually, this looks more like a VENIX system..."
4642         echo exit 0 >venix
4643 else
4644         echo " "
4645         if ./xenix; then
4646                 : null
4647         else
4648                 echo "Nor is it Venix..."
4649         fi
4650 fi
4651 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4652 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4653 $rm -f foo
4654
4655 : Check if we are using GNU gcc and what its version is
4656 echo " "
4657 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4658 $cat >try.c <<EOM
4659 #include <stdio.h>
4660 int main() {
4661 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4662 #ifdef __VERSION__
4663         printf("%s\n", __VERSION__);
4664 #else
4665         printf("%s\n", "1");
4666 #endif
4667 #endif
4668         return(0);
4669 }
4670 EOM
4671 if $cc -o try $ccflags $ldflags try.c; then
4672         gccversion=`$run ./try`
4673         case "$gccversion" in
4674         '') echo "You are not using GNU cc." ;;
4675         *)  echo "You are using GNU cc $gccversion."
4676             ccname=gcc
4677             ;;
4678         esac
4679 else
4680         echo " "
4681         echo "*** WHOA THERE!!! ***" >&4
4682         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4683         case "$knowitall" in
4684         '')
4685         echo "    You'd better start hunting for one and let me know about it." >&4
4686                 exit 1
4687                 ;;
4688         esac
4689 fi
4690 $rm -f try try.*
4691 case "$gccversion" in
4692 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4693 esac
4694 case "$gccversion" in
4695 '') gccosandvers='' ;;
4696 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4697    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4698    gccshortvers=''
4699    case "$gccosandvers" in
4700    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4701    $osname$osvers) ;; # looking good
4702    $osname*) cat <<EOM >&4
4703
4704 *** WHOA THERE!!! ***
4705
4706     Your gcc has not been compiled for the exact release of
4707     your operating system ($gccosandvers versus $osname$osvers).
4708
4709     In general it is a good idea to keep gcc synchronized with
4710     the operating system because otherwise serious problems
4711     may ensue when trying to compile software, like Perl.
4712
4713     I'm trying to be optimistic here, though, and will continue.
4714     If later during the configuration and build icky compilation
4715     problems appear (headerfile conflicts being the most common
4716     manifestation), I suggest reinstalling the gcc to match
4717     your operating system release.
4718
4719 EOM
4720       ;;
4721    *) gccosandvers='' ;; # failed to parse, better be silent
4722    esac
4723    ;;
4724 esac
4725 case "$ccname" in
4726 '') ccname="$cc" ;;
4727 esac
4728
4729 # gcc 3.* complain about adding -Idirectories that they already know about,
4730 # so we will take those off from locincpth.
4731 case "$gccversion" in
4732 3*)
4733     echo "main(){}">try.c
4734     for incdir in $locincpth; do
4735        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4736              grep '^c[cp]p*[01]: warning: changing search order '`
4737        if test "X$warn" != X; then
4738            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4739        fi
4740     done
4741     $rm -f try try.*
4742 esac
4743
4744 # gcc 4.9 by default does some optimizations that break perl.
4745 # see ticket 121505.
4746 #
4747 # The -fwrapv disables those optimizations (and probably others,) so
4748 # for gcc 4.9 (and later, since the optimizations probably won't go
4749 # away), add -fwrapv unless the user requests -fno-wrapv, which
4750 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4751 # which turns the overflows -fwrapv ignores into runtime errors.
4752 case "$gccversion" in
4753 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4754     case "$ccflags" in
4755     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4756     *) ccflags="$ccflags -fwrapv" ;;
4757     esac
4758 esac
4759
4760 : What should the include directory be ?
4761 : Use sysroot if set, so findhdr looks in the right place.
4762 echo " "
4763 $echo $n "Hmm...  $c"
4764 dflt="$sysroot/usr/include"
4765 incpath=''
4766 mips_type=''
4767 if $test -f /bin/mips && /bin/mips; then
4768         echo "Looks like a MIPS system..."
4769         $cat >usr.c <<'EOCP'
4770 #ifdef SYSTYPE_BSD43
4771 /bsd43
4772 #endif
4773 EOCP
4774         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4775                 dflt='/bsd43/usr/include'
4776                 incpath='/bsd43'
4777                 mips_type='BSD 4.3'
4778         else
4779                 mips_type='System V'
4780         fi
4781         $rm -f usr.c usr.out
4782         echo "and you're compiling with the $mips_type compiler and libraries."
4783         xxx_prompt=y
4784         echo "exit 0" >mips
4785 else
4786         echo "Doesn't look like a MIPS system."
4787         xxx_prompt=n
4788         echo "exit 1" >mips
4789 fi
4790 chmod +x mips
4791 $eunicefix mips
4792 case "$usrinc" in
4793 '') ;;
4794 *) dflt="$usrinc";;
4795 esac
4796 case "$xxx_prompt" in
4797 y)      fn=d/
4798         echo " "
4799         rp='Where are the include files you want to use?'
4800         . ./getfile
4801         usrinc="$ans"
4802         ;;
4803 *)      usrinc="$dflt"
4804         ;;
4805 esac
4806
4807 : see how we invoke the C preprocessor
4808 echo " "
4809 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4810 cat <<'EOT' >testcpp.c
4811 #define ABC abc
4812 #define XYZ xyz
4813 ABC.XYZ
4814 EOT
4815 cd ..
4816 if test ! -f cppstdin; then
4817         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4818                 # AIX cc -E doesn't show the absolute headerfile
4819                 # locations but we'll cheat by using the -M flag.
4820                 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
4821         else
4822                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4823         fi
4824 else
4825         echo "Keeping your $hint cppstdin wrapper."
4826 fi
4827 chmod 755 cppstdin
4828 wrapper=`pwd`/cppstdin
4829 ok='false'
4830 cd UU
4831
4832 if $test "X$cppstdin" != "X" && \
4833         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4834         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4835 then
4836         echo "You used to use $cppstdin $cppminus so we'll use that again."
4837         case "$cpprun" in
4838         '') echo "But let's see if we can live without a wrapper..." ;;
4839         *)
4840                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4841                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4842                 then
4843                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4844                         ok='true'
4845                 else
4846                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4847                 fi
4848                 ;;
4849         esac
4850 else
4851         case "$cppstdin" in
4852         '') ;;
4853         *)
4854                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4855                 ;;
4856         esac
4857 fi
4858
4859 if $ok; then
4860         : nothing
4861 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4862         $cc -E <testcpp.c >testcpp.out 2>&1; \
4863         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4864         echo "Yup, it does."
4865         x_cpp="$cc $cppflags -E"
4866         x_minus='';
4867 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4868         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4869         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4870         echo "Yup, it does."
4871         x_cpp="$cc $cppflags -E"
4872         x_minus='-';
4873 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4874         $cc -P <testcpp.c >testcpp.out 2>&1; \
4875         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4876         echo "Yipee, that works!"
4877         x_cpp="$cc $cppflags -P"
4878         x_minus='';
4879 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4880         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4881         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4882         echo "At long last!"
4883         x_cpp="$cc $cppflags -P"
4884         x_minus='-';
4885 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4886         $cpp <testcpp.c >testcpp.out 2>&1; \
4887         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4888         echo "It works!"
4889         x_cpp="$cpp $cppflags"
4890         x_minus='';
4891 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4892         $cpp - <testcpp.c >testcpp.out 2>&1; \
4893         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4894         echo "Hooray, it works!  I was beginning to wonder."
4895         x_cpp="$cpp $cppflags"
4896         x_minus='-';
4897 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4898         $wrapper <testcpp.c >testcpp.out 2>&1; \
4899         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4900         x_cpp="$wrapper"
4901         x_minus=''
4902         echo "Eureka!"
4903 else
4904         dflt=''
4905         rp="No dice.  I can't find a C preprocessor.  Name one:"
4906         . ./myread
4907         x_cpp="$ans"
4908         x_minus=''
4909         $x_cpp <testcpp.c >testcpp.out 2>&1
4910         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4911                 echo "OK, that will do." >&4
4912         else
4913 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4914                 exit 1
4915         fi
4916 fi
4917
4918 case "$ok" in
4919 false)
4920         cppstdin="$x_cpp"
4921         cppminus="$x_minus"
4922         cpprun="$x_cpp"
4923         cpplast="$x_minus"
4924         set X $x_cpp
4925         shift
4926         case "$1" in
4927         "$cpp")
4928                 echo "Perhaps can we force $cc -E using a wrapper..."
4929                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4930                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4931                 then
4932                         echo "Yup, we can."
4933                         cppstdin="$wrapper"
4934                         cppminus='';
4935                 else
4936                         echo "Nope, we'll have to live without it..."
4937                 fi
4938                 ;;
4939         esac
4940         case "$cpprun" in
4941         "$wrapper")
4942                 cpprun=''
4943                 cpplast=''
4944                 ;;
4945         esac
4946         ;;
4947 esac
4948
4949 case "$cppstdin" in
4950 "$wrapper"|'cppstdin') ;;
4951 *) $rm -f $wrapper;;
4952 esac
4953 $rm -f testcpp.c testcpp.out
4954
4955 : Adjust cppfilter for path component separator
4956 case "$osname" in
4957 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4958 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4959 *)   cppfilter='' ;;
4960 esac
4961
4962 : Use gcc to determine libpth and incpth
4963 # If using gcc or clang, we can get better values for libpth, incpth
4964 # and usrinc directly from the compiler.
4965 # Note that ccname for clang is also gcc.
4966 case "$ccname" in
4967     gcc)
4968         $echo 'extern int foo;' > try.c
4969         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4970         shift
4971         if $test $# -gt 0; then
4972             incpth="$incpth $*"
4973             incpth="`$echo $incpth|$sed 's/^ //'`"
4974             for i in $*; do
4975                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4976                 if $test -d $j; then
4977                     libpth="$libpth $j"
4978                 fi
4979             done
4980             libpth="`$echo $libpth|$sed 's/^ //'`"
4981             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4982                 if $test -d $xxx; then
4983                     case " $libpth " in
4984                     *" $xxx "*) ;;
4985                     *) libpth="$libpth $xxx";;
4986                     esac
4987                 fi
4988             done
4989         fi
4990         $rm -f try.c
4991         case "$usrinc" in
4992         '') for i in $incpth; do
4993                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4994                     usrinc="$i"
4995                     break
4996                 fi
4997             done
4998             ;;
4999         esac
5000
5001         case "$usecrosscompile" in
5002         $define|true|[yY]*)
5003             case "$incpth" in
5004                 '') echo "Incpth not defined." >&4; croak=y ;;
5005                 *)  echo "Using incpth '$incpth'." >&4 ;;
5006             esac
5007             case "$libpth" in
5008                 '') echo "Libpth not defined." >&4; croak=y ;;
5009                 *)  echo "Using libpth '$libpth'." >&4 ;;
5010             esac
5011             case "$usrinc" in
5012                 '') echo "Usrinc not defined." >&4; croak=y ;;
5013                 *)  echo "Using usrinc $usrinc." >&4 ;;
5014             esac
5015             case "$croak" in
5016                 y)
5017                 if test "X$sysroot" = X; then
5018                     echo "Cannot continue, aborting." >&4; exit 1
5019                 else
5020                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5021                 fi
5022                 ;;
5023             esac
5024             ;;
5025         esac
5026     ;;
5027 esac
5028
5029 : Default value for incpth is just usrinc
5030 case "$incpth" in
5031 '') incpth="$usrinc";;
5032 esac
5033
5034 : Set private lib path
5035 case "$plibpth" in
5036 '') if ./mips; then
5037         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5038     fi;;
5039 esac
5040 case "$libpth" in
5041 ' ') dlist='';;
5042 '') dlist="$loclibpth $plibpth $glibpth";;
5043 *) dlist="$libpth";;
5044 esac
5045
5046 : Now check and see which directories actually exist, avoiding duplicates
5047 for xxx in $dlist
5048 do
5049     if $test -d $xxx; then
5050                 case " $libpth " in
5051                 *" $xxx "*) ;;
5052                 *) libpth="$libpth $xxx";;
5053                 esac
5054     fi
5055 done
5056 $cat <<'EOM'
5057
5058 Some systems have incompatible or broken versions of libraries.  Among
5059 the directories listed in the question below, please remove any you
5060 know not to be holding relevant libraries, and add any that are needed.
5061 Say "none" for none.
5062
5063 EOM
5064
5065 if test "X$sysroot" != X; then
5066     $cat <<EOM
5067 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5068
5069 EOM
5070 fi
5071
5072 case "$libpth" in
5073 '') dflt='none';;
5074 *)
5075         set X $libpth
5076         shift
5077         dflt=${1+"$@"}
5078         ;;
5079 esac
5080 rp="Directories to use for library searches?"
5081 . ./myread
5082 case "$ans" in
5083 none) libpth=' ';;
5084 *) libpth="$ans";;
5085 esac
5086
5087 : compute shared library extension
5088 case "$so" in
5089 '')
5090         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5091                 dflt='sl'
5092         else
5093                 dflt='so'
5094         fi
5095         ;;
5096 *) dflt="$so";;
5097 esac
5098 $cat <<EOM
5099
5100 On some systems, shared libraries may be available.  Answer 'none' if
5101 you want to suppress searching of shared libraries for the remainder
5102 of this configuration.
5103
5104 EOM
5105 rp='What is the file extension used for shared libraries?'
5106 . ./myread
5107 so="$ans"
5108
5109 : Does target system insist that shared library basenames are unique
5110 $cat << EOM
5111
5112 Some dynamic loaders assume that the *basename* of shared library filenames
5113 are globally unique.  We'll default this to undef as we assume your system
5114 is not this weird. Set to defined if you're on one of them.
5115
5116 EOM
5117
5118 dflt='n'
5119 rp='Make shared library basenames unique?'
5120 . ./myread
5121 case "$ans" in
5122 y|Y) val="$define" ;;
5123 *)   val="$undef"  ;;
5124 esac
5125 set d_libname_unique
5126 eval $setvar
5127
5128 : Define several unixisms.
5129 : Hints files or command line option can be used to override them.
5130 : The convoluted testing is in case hints files set either the old
5131 : or the new name.
5132 case "$_exe" in
5133 '')     case "$exe_ext" in
5134         '')     ;;
5135         *)      _exe="$exe_ext" ;;
5136         esac
5137         ;;
5138 esac
5139 case "$_a" in
5140 '')     case "$lib_ext" in
5141     '') _a='.a';;
5142         *)      _a="$lib_ext" ;;
5143         esac
5144         ;;
5145 esac
5146 case "$_o" in
5147 '') case "$obj_ext" in
5148         '')     _o='.o';;
5149         *)      _o="$obj_ext";;
5150         esac
5151         ;;
5152 esac
5153 case "$p_" in
5154 '') case "$path_sep" in
5155         '')     p_=':';;
5156         *)      p_="$path_sep";;
5157         esac
5158         ;;
5159 esac
5160 exe_ext=$_exe
5161 lib_ext=$_a
5162 obj_ext=$_o
5163 path_sep=$p_
5164
5165 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5166
5167 : Which makefile gets called first.  This is used by make depend.
5168 case "$firstmakefile" in
5169 '') firstmakefile='makefile';;
5170 esac
5171
5172 : Check is we will use socks
5173 case "$usesocks" in
5174 $define|true|[yY]*)     dflt='y';;
5175 *) dflt='n';;
5176 esac
5177 cat <<EOM
5178
5179 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5180 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5181 to use the PerlIO abstraction layer, this will be implicitly selected.
5182
5183 If this doesn't make any sense to you, just accept the default '$dflt'.
5184 EOM
5185 rp='Build Perl for SOCKS?'
5186 . ./myread
5187 case "$ans" in
5188 y|Y)    val="$define" ;;
5189 *)      val="$undef" ;;
5190 esac
5191 set usesocks
5192 eval $setvar
5193
5194 : Check for uselongdouble support
5195 case "$ccflags" in
5196 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5197 esac
5198
5199 case "$uselongdouble" in
5200 $define|true|[yY]*)     dflt='y';;
5201 *) dflt='n';;
5202 esac
5203 cat <<EOM
5204
5205 Perl can be built to take advantage of long doubles which
5206 (if available) may give more accuracy and range for floating point numbers.
5207
5208 If this doesn't make any sense to you, just accept the default '$dflt'.
5209 EOM
5210 rp='Try to use long doubles if available?'
5211 . ./myread
5212 case "$ans" in
5213 y|Y)    val="$define"   ;;
5214 *)      val="$undef"    ;;
5215 esac
5216 set uselongdouble
5217 eval $setvar
5218
5219 case "$uselongdouble" in
5220 true|[yY]*) uselongdouble="$define" ;;
5221 esac
5222
5223 : Look for a hint-file generated 'call-back-unit'.  If the
5224 : user has specified that long doubles should be used,
5225 : we may need to set or change some other defaults.
5226 if $test -f uselongdouble.cbu; then
5227     echo "Your platform has some specific hints regarding long doubles, using them..."
5228     . ./uselongdouble.cbu
5229 else
5230     case "$uselongdouble" in
5231         $define)
5232                 $cat <<EOM
5233 (Your platform does not have any specific hints for long doubles.)
5234 EOM
5235         ;;
5236     esac
5237 fi
5238
5239 : Check if quadmath is requested
5240 case "$usequadmath" in
5241 "$define"|true|[yY]*) usequadmath="$define" ;;
5242 *)                    usequadmath="$undef"  ;;
5243 esac
5244
5245 : Fail if both uselongdouble and usequadmath are requested
5246 case "$usequadmath:$uselongdouble" in
5247 define:define)
5248         $cat <<EOM >&4
5249
5250 *** You requested the use of the quadmath library and use
5251 *** of long doubles.
5252 ***
5253 *** Please select one or the other.
5254 EOM
5255         exit 1
5256         ;;
5257 esac
5258
5259 : Looking for optional libraries
5260 echo " "
5261 echo "Checking for optional libraries..." >&4
5262 case "$libs" in
5263 ' '|'') dflt='';;
5264 *) dflt="$libs";;
5265 esac
5266 case "$libswanted" in
5267 '') libswanted='c_s';;
5268 esac
5269 case "$usesocks" in
5270 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5271 esac
5272 case "$usecbacktrace" in
5273 "$define") libswanted="$libswanted bfd" ;;
5274 esac
5275 case "$usequadmath" in
5276 "$define") libswanted="$libswanted quadmath" ;;
5277 esac
5278 libsfound=''
5279 libsfiles=''
5280 libsdirs=''
5281 libspath=''
5282 for thisdir in $libpth $xlibpth; do
5283   test -d $thisdir && libspath="$libspath $thisdir"
5284 done
5285 for thislib in $libswanted; do
5286         for thisdir in $libspath; do
5287             xxx=''
5288             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5289                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5290                 $test -f "$xxx" && eval $libscheck
5291                 $test -f "$xxx" && libstyle=shared
5292                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5293                 $test -f "$xxx" && eval $libscheck
5294                 $test -f "$xxx" && libstyle=shared
5295             fi
5296             if test ! -f "$xxx"; then
5297                 xxx=$thisdir/lib$thislib.$so
5298                 $test -f "$xxx" && eval $libscheck
5299                 $test -f "$xxx" && libstyle=shared
5300             fi
5301             if test ! -f "$xxx"; then
5302                 xxx=$thisdir/lib$thislib$_a
5303                 $test -f "$xxx" && eval $libscheck
5304                 $test -f "$xxx" && libstyle=static
5305             fi
5306             if test ! -f "$xxx"; then
5307                 xxx=$thisdir/$thislib$_a
5308                 $test -f "$xxx" && eval $libscheck
5309                 $test -f "$xxx" && libstyle=static
5310             fi
5311             if test ! -f "$xxx"; then
5312                 xxx=$thisdir/lib${thislib}_s$_a
5313                 $test -f "$xxx" && eval $libscheck
5314                 $test -f "$xxx" && libstyle=static
5315                 $test -f "$xxx" && thislib=${thislib}_s
5316             fi
5317             if test ! -f "$xxx"; then
5318                 xxx=$thisdir/Slib$thislib$_a
5319                 $test -f "$xxx" && eval $libscheck
5320                 $test -f "$xxx" && libstyle=static
5321             fi
5322             if $test -f "$xxx"; then
5323                 case "$libstyle" in
5324                 shared) echo "Found -l$thislib (shared)." ;;
5325                 static) echo "Found -l$thislib." ;;
5326                 *)      echo "Found -l$thislib ($libstyle)." ;;
5327                 esac
5328                 case " $dflt " in
5329                 *"-l$thislib "*);;
5330                 *) dflt="$dflt -l$thislib"
5331                    libsfound="$libsfound $xxx"
5332                    yyy=`basename $xxx`
5333                    libsfiles="$libsfiles $yyy"
5334                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5335                    case " $libsdirs " in
5336                    *" $yyy "*) ;;
5337                    *) libsdirs="$libsdirs $yyy" ;;
5338                    esac
5339                    ;;
5340                 esac
5341                 break
5342             fi
5343         done
5344         if $test ! -f "$xxx"; then
5345             echo "No -l$thislib."
5346         fi
5347 done
5348 set X $dflt
5349 shift
5350 dflt="$*"
5351 case "$libs" in
5352 '') dflt="$dflt";;
5353 *) dflt="$libs";;
5354 esac
5355 case "$dflt" in
5356 ' '|'') dflt='none';;
5357 esac
5358
5359 $cat <<EOM
5360
5361 In order to compile $package on your machine, a number of libraries
5362 are usually needed.  Include any other special libraries here as well.
5363 Say "none" for none.  The default list is almost always right.
5364 EOM
5365
5366 echo " "
5367 rp="What libraries to use?"
5368 . ./myread
5369 case "$ans" in
5370 none) libs=' ';;
5371 *) libs="$ans";;
5372 esac
5373
5374 : determine optimization, if desired, or use for debug flag also
5375 case "$optimize" in
5376 ' '|$undef) dflt='none';;
5377 '') dflt='-O';;
5378 *) dflt="$optimize";;
5379 esac
5380 $cat <<EOH
5381
5382 By default, $package compiles with the -O flag to use the optimizer.
5383 Alternately, you might want to use the symbolic debugger, which uses
5384 the -g flag (on traditional Unix systems).  Either flag can be
5385 specified here.  To use neither flag, specify the word "none".
5386
5387 EOH
5388 rp="What optimizer/debugger flag should be used?"
5389 . ./myread
5390 optimize="$ans"
5391 case "$optimize" in
5392 'none') optimize=" ";;
5393 esac
5394
5395 : Check what DEBUGGING is required from the command line
5396 : -DEBUGGING      or -DDEBUGGING or
5397 : -DEBUGGING=both                       = -g + -DDEBUGGING
5398 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5399 : -DEBUGGING=none or -UDEBUGGING        =
5400 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5401 case "$EBUGGING" in
5402 '')     ;;
5403 *)      DEBUGGING=$EBUGGING ;;
5404 esac
5405
5406 case "$DEBUGGING" in
5407 -g|both|$define)
5408     case "$optimize" in
5409         *-g*) ;;
5410         *)    optimize="$optimize -g" ;;
5411     esac ;;
5412 none|$undef)
5413     case "$optimize" in
5414         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5415                 shift
5416                 optimize="$*"
5417                 ;;
5418     esac ;;
5419 esac
5420
5421 dflt=''
5422 case "$DEBUGGING" in
5423 both|$define) dflt='-DDEBUGGING'
5424 esac
5425
5426 : argument order is deliberate, as the flag will start with - which set could
5427 : think is an option
5428 checkccflag='check=$1; flag=$2; callback=$3;
5429 echo " ";
5430 echo "Checking if your compiler accepts $flag" 2>&1;
5431 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5432 echo "int main(void) { return 0; }" > gcctest.c;
5433 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5434     echo "Yes, it does." 2>&1;
5435     if $test -s gcctest.out ; then
5436         echo "But your platform does not like it:";
5437         cat gcctest.out;
5438     else
5439         case "$ccflags" in
5440         *$check*)
5441             echo "Leaving current flags $ccflags alone." 2>&1
5442             ;;
5443         *) dflt="$dflt $flag";
5444             eval $callback
5445             ;;
5446         esac
5447     fi
5448 else
5449     echo "Nope, it does not, but that is ok." 2>&1;
5450 fi
5451 '
5452
5453 : We will not override a previous value, but we might want to
5454 : augment a hint file
5455 case "$hint" in
5456 default|recommended)
5457         case "$gccversion" in
5458         1*) dflt="$dflt -fpcc-struct-return" ;;
5459         esac
5460         case "$optimize:$DEBUGGING" in
5461         *-g*:old) dflt="$dflt -DDEBUGGING";;
5462         esac
5463         case "$gccversion" in
5464         2*) if $test -d /etc/conf/kconfig.d &&
5465                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5466                 then
5467                         # Interactive Systems (ISC) POSIX mode.
5468                         dflt="$dflt -posix"
5469                 fi
5470                 ;;
5471         esac
5472         case "$gccversion" in
5473         1*) ;;
5474         2.[0-8]*) ;;
5475         ?*)     set strict-aliasing -fno-strict-aliasing
5476                 eval $checkccflag
5477                 ;;
5478         esac
5479         # For gcc, adding -pipe speeds up compilations for some, but apparently
5480         # some assemblers can't read from stdin.  (It also slows down compilations
5481         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5482         case "$gccversion" in
5483         ?*)     set pipe -pipe
5484                 eval $checkccflag
5485                 ;;
5486         esac
5487
5488         # on x86_64 (at least) we require an extra library (libssp) in the
5489         # link command line. This library is not named, so I infer that it is
5490         # an implementation detail that may change. Hence the safest approach
5491         # is to add the flag to the flags passed to the compiler at link time,
5492         # as that way the compiler can do the right implementation dependant
5493         # thing. (NWC)
5494         case "$osname" in
5495         amigaos) ;; # -fstack-protector builds but doesn't work
5496         *)      case "$gccversion" in
5497                 ?*)     set stack-protector-strong -fstack-protector-strong
5498                         eval $checkccflag
5499                         case "$dflt" in
5500                         *-fstack-protector-strong*) ;; # It got added.
5501                         *) # Try the plain/older -fstack-protector.
5502                            set stack-protector -fstack-protector
5503                            eval $checkccflag
5504                            ;;
5505                         esac
5506                         ;;
5507                 esac
5508                 ;;
5509         esac
5510         ;;
5511 esac
5512
5513 case "$mips_type" in
5514 *BSD*|'') inclwanted="$locincpth $usrinc";;
5515 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5516 esac
5517 for thisincl in $inclwanted; do
5518         if $test -d $thisincl; then
5519                 if $test x$thisincl != x$usrinc; then
5520                         case "$dflt" in
5521                         *" -I$thisincl "*);;
5522                         *) dflt="$dflt -I$thisincl ";;
5523                         esac
5524                 fi
5525         fi
5526 done
5527
5528 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5529         xxx=true;
5530 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5531         xxx=true;
5532 else
5533         xxx=false;
5534 fi;
5535 if $xxx; then
5536         case "$dflt" in
5537         *$2*);;
5538         *) dflt="$dflt -D$2";;
5539         esac;
5540 fi'
5541
5542 set signal.h LANGUAGE_C; eval $inctest
5543
5544 case "$usesocks" in
5545 $define)
5546         ccflags="$ccflags -DSOCKS"
5547         ;;
5548 esac
5549
5550 case "$hint" in
5551 default|recommended) dflt="$ccflags $dflt" ;;
5552 *) dflt="$ccflags";;
5553 esac
5554
5555 case "$dflt" in
5556 ''|' ') dflt=none;;
5557 esac
5558
5559 $cat <<EOH
5560
5561 Your C compiler may want other flags.  For this question you should include
5562 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5563 but you should NOT include libraries or ld flags like -lwhatever.  If you
5564 want $package to honor its debug switch, you should include -DDEBUGGING here.
5565 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5566
5567 To use no flags, specify the word "none".
5568
5569 EOH
5570 set X $dflt
5571 shift
5572 dflt=${1+"$@"}
5573 rp="Any additional cc flags?"
5574 . ./myread
5575 case "$ans" in
5576 none) ccflags='';;
5577 *) ccflags="$ans";;
5578 esac
5579
5580 : the following weeds options from ccflags that are of no interest to cpp
5581 case "$cppflags" in
5582 '') cppflags="$ccflags" ;;
5583 *)  set X $ccflags; shift
5584     case " $cppflags " in
5585     *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5586     *) cppflags="$cppflags $ccflags" ;;
5587     esac
5588     ;;
5589 esac
5590 case "$gccversion" in
5591 1*) cppflags="$cppflags -D__GNUC__"
5592 esac
5593 case "$mips_type" in
5594 '');;
5595 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5596 esac
5597 case "$cppflags" in
5598 '');;
5599 *)
5600         echo " "
5601         echo "Let me guess what the preprocessor flags are..." >&4
5602         set X $cppflags
5603         shift
5604         cppflags=''
5605         $cat >cpp.c <<'EOM'
5606 #define BLURFL foo
5607
5608 BLURFL xx LFRULB
5609 EOM
5610         previous=''
5611         for flag in $*
5612         do
5613                 case "$flag" in
5614                 -*) ftry="$flag";;
5615                 *) ftry="$previous $flag";;
5616                 esac
5617                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5618                         >cpp1.out 2>/dev/null && \
5619                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5620                         >cpp2.out 2>/dev/null && \
5621                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5622                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5623                 then
5624                         cppflags="$cppflags $ftry"
5625                         previous=''
5626                 else
5627                         previous="$flag"
5628                 fi
5629         done
5630         set X $cppflags
5631         shift
5632         cppflags=${1+"$@"}
5633         case "$cppflags" in
5634         *-*)  echo "They appear to be: $cppflags";;
5635         esac
5636         $rm -f cpp.c cpp?.out
5637         ;;
5638 esac
5639
5640 : flags used in final linking phase
5641 case "$ldflags" in
5642 '') if ./venix; then
5643                 dflt='-i -z'
5644         else
5645                 dflt=''
5646         fi
5647         case "$ccflags" in
5648         *-posix*) dflt="$dflt -posix" ;;
5649         esac
5650         ;;
5651 *) dflt="$ldflags";;
5652 esac
5653 # See note above about -fstack-protector
5654 case "$ccflags" in
5655 *-fstack-protector-strong*)
5656         case "$dflt" in
5657         *-fstack-protector-strong*) ;; # Don't add it again
5658         *) dflt="$dflt -fstack-protector-strong" ;;
5659         esac
5660         ;;
5661 *-fstack-protector*)
5662         case "$dflt" in
5663         *-fstack-protector*) ;; # Don't add it again
5664         *) dflt="$dflt -fstack-protector" ;;
5665         esac
5666         ;;
5667 esac
5668
5669 : Try to guess additional flags to pick up local libraries.
5670 for thislibdir in $libpth; do
5671         case " $loclibpth " in
5672         *" $thislibdir "*)
5673                 case "$dflt " in
5674                 *"-L$thislibdir "*) ;;
5675                 *)  dflt="$dflt -L$thislibdir" ;;
5676                 esac
5677                 ;;
5678         esac
5679 done
5680
5681 case "$dflt" in
5682 '') dflt='none' ;;
5683 esac
5684
5685 $cat <<EOH
5686
5687 Your C linker may need flags.  For this question you should
5688 include -L/whatever and any other flags used by the C linker, but you
5689 should NOT include libraries like -lwhatever.
5690
5691 Make sure you include the appropriate -L/path flags if your C linker
5692 does not normally search all of the directories you specified above,
5693 namely
5694         $libpth
5695 To use no flags, specify the word "none".
5696
5697 EOH
5698
5699 rp="Any additional ld flags (NOT including libraries)?"
5700 . ./myread
5701 case "$ans" in
5702 none) ldflags='';;
5703 *) ldflags="$ans";;
5704 esac
5705 rmlist="$rmlist pdp11"
5706
5707 : coherency check
5708 echo " "
5709 echo "Checking your choice of C compiler and flags for coherency..." >&4
5710 $cat > try.c <<'EOF'
5711 #include <stdio.h>
5712 int main() { printf("Ok\n"); return(0); }
5713 EOF
5714 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5715 shift
5716 $cat >try.msg <<'EOM'
5717 I've tried to compile and run the following simple program:
5718
5719 EOM
5720 $cat try.c >> try.msg
5721
5722 $cat >> try.msg <<EOM
5723
5724 I used the command:
5725
5726         $*
5727         $run ./try
5728
5729 and I got the following output:
5730
5731 EOM
5732 dflt=y
5733 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5734         if $sh -c "$run ./try " >>try.msg 2>&1; then
5735                 xxx=`$run ./try`
5736                 case "$xxx" in
5737                 "Ok") dflt=n ;;
5738                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5739                 esac
5740         else
5741                 echo "The program compiled OK, but exited with status $?." >>try.msg
5742                 rp="You have a problem.  Shall I abort Configure"
5743                 dflt=y
5744         fi
5745 else
5746         echo "I can't compile the test program." >>try.msg
5747         rp="You have a BIG problem.  Shall I abort Configure"
5748         dflt=y
5749 fi
5750 case "$dflt" in
5751 y)
5752         $cat try.msg >&4
5753         case "$knowitall" in
5754         '')
5755                 echo "(The supplied flags or libraries might be incorrect.)"
5756                 ;;
5757         *) dflt=n;;
5758         esac
5759         echo " "
5760         . ./myread
5761         case "$ans" in
5762         n*|N*) ;;
5763         *)      echo "Ok.  Stopping Configure." >&4
5764                 exit 1
5765                 ;;
5766         esac
5767         ;;
5768 n) echo "OK, that should do.";;
5769 esac
5770 $rm_try gcctest gcctest.out
5771
5772 : define a shorthand compile call
5773 compile='
5774 mc_file=$1;
5775 shift;
5776 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5777 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5778 exit 1;
5779 fi;
5780 esac;
5781 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5782 : define a shorthand compile call for compilations that should be ok.
5783 compile_ok='
5784 mc_file=$1;
5785 shift;
5786 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5787
5788 : determine filename position in cpp output
5789 echo " "
5790 echo "Computing filename position in cpp output for #include directives..." >&4
5791 case "$osname" in
5792 amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5793 esac
5794 case "$fieldn" in
5795 '')
5796 case "$osname" in
5797 vos) testaccess=-e ;;
5798 *)   testaccess=-r ;;
5799 esac
5800 echo '#include <stdio.h>' > foo.c
5801 $cat >fieldn <<EOF
5802 $startsh
5803 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5804 $grep '^[       ]*#.*stdio\.h' | \
5805 while read cline; do
5806         pos=1
5807         set \$cline
5808         while $test \$# -gt 0; do
5809                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5810                         echo "\$pos"
5811                         exit 0
5812                 fi
5813                 shift
5814                 pos=\`expr \$pos + 1\`
5815         done
5816 done
5817 EOF
5818 chmod +x fieldn
5819 fieldn=`./fieldn`
5820 $rm -f foo.c fieldn
5821 ;;
5822 esac
5823 case $fieldn in
5824 '') pos='???';;
5825 1) pos=first;;
5826 2) pos=second;;
5827 3) pos=third;;
5828 *) pos="${fieldn}th";;
5829 esac
5830 echo "Your cpp writes the filename in the $pos field of the line."
5831
5832 : locate header file
5833 $cat >findhdr <<EOF
5834 $startsh
5835 wanted=\$1
5836 name=''
5837 for usrincdir in $incpth
5838 do
5839         if test -f \$usrincdir/\$wanted; then
5840                 echo "\$usrincdir/\$wanted"
5841                 exit 0
5842         fi
5843 done
5844 awkprg='{ print \$$fieldn }'
5845 echo "#include <\$wanted>" > foo\$\$.c
5846 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5847 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5848 while read cline; do
5849         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5850         case "\$name" in
5851         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5852         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5853         *) exit 2;;
5854         esac;
5855 done;
5856 #
5857 # status = 0: grep returned 0 lines, case statement not executed
5858 # status = 1: headerfile found
5859 # status = 2: while loop executed, no headerfile found
5860 #
5861 status=\$?
5862 $rm -f foo\$\$.c;
5863 if test \$status -eq 1; then
5864         exit 0;
5865 fi
5866 exit 1
5867 EOF
5868 chmod +x findhdr
5869
5870 : define an alternate in-header-list? function
5871 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5872 cont=true; xxf="echo \"<\$1> found.\" >&4";
5873 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5874 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5875 esac;
5876 case $# in 4) instead=instead;; *) instead="at last";; esac;
5877 while $test "$cont"; do
5878         xxx=`./findhdr $1`
5879         var=$2; eval "was=\$$2";
5880         if $test "$xxx" && $test -r "$xxx";
5881         then eval $xxf;
5882         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5883                 cont="";
5884         else eval $xxnf;
5885         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5886         set $yyy; shift; shift; yyy=$@;
5887         case $# in 0) cont="";;
5888         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5889                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5890         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5891                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5892         esac;
5893 done;
5894 while $test "$yyy";
5895 do set $yyy; var=$2; eval "was=\$$2";
5896         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5897         set $yyy; shift; shift; yyy=$@;
5898 done'
5899
5900 : see if stdlib is available
5901 set stdlib.h i_stdlib
5902 eval $inhdr
5903
5904 : check for lengths of integral types
5905 echo " "
5906 case "$intsize" in
5907 '')
5908         echo "Checking to see how big your integers are..." >&4
5909         $cat >try.c <<EOCP
5910 #include <stdio.h>
5911 #$i_stdlib I_STDLIB
5912 #ifdef I_STDLIB
5913 #include <stdlib.h>
5914 #endif
5915 int main()
5916 {
5917         printf("intsize=%d;\n", (int)sizeof(int));
5918         printf("longsize=%d;\n", (int)sizeof(long));
5919         printf("shortsize=%d;\n", (int)sizeof(short));
5920         exit(0);
5921 }
5922 EOCP
5923         set try
5924         if eval $compile_ok && $run ./try > /dev/null; then
5925                 eval `$run ./try`
5926                 echo "Your integers are $intsize bytes long."
5927                 echo "Your long integers are $longsize bytes long."
5928                 echo "Your short integers are $shortsize bytes long."
5929         else
5930                 $cat >&4 <<EOM
5931 !
5932 Help! I can't compile and run the intsize test program: please enlighten me!
5933 (This is probably a misconfiguration in your system or libraries, and
5934 you really ought to fix it.  Still, I'll try anyway.)
5935 !
5936 EOM
5937                 dflt=4
5938                 rp="What is the size of an integer (in bytes)?"
5939                 . ./myread
5940                 intsize="$ans"
5941                 dflt=$intsize
5942                 rp="What is the size of a long integer (in bytes)?"
5943                 . ./myread
5944                 longsize="$ans"
5945                 dflt=2
5946                 rp="What is the size of a short integer (in bytes)?"
5947                 . ./myread
5948                 shortsize="$ans"
5949         fi
5950         ;;
5951 esac
5952 $rm_try
5953
5954 : check for long long
5955 echo " "
5956 echo "Checking to see if you have long long..." >&4
5957 echo 'int main() { long long x = 7; return 0; }' > try.c
5958 set try
5959 if eval $compile; then
5960         val="$define"
5961         echo "You have long long."
5962 else
5963         val="$undef"
5964         echo "You do not have long long."
5965 fi
5966 $rm_try
5967 set d_longlong
5968 eval $setvar
5969
5970 : check for length of long long
5971 case "${d_longlong}${longlongsize}" in
5972 $define)
5973         echo " "
5974         echo "Checking to see how big your long longs are..." >&4
5975         $cat >try.c <<'EOCP'
5976 #include <stdio.h>
5977 int main()
5978 {
5979     printf("%d\n", (int)sizeof(long long));
5980     return(0);
5981 }
5982 EOCP
5983         set try
5984         if eval $compile_ok; then
5985                 longlongsize=`$run ./try`
5986                 echo "Your long longs are $longlongsize bytes long."
5987         else
5988                 dflt='8'
5989                 echo " "
5990                 echo "(I can't seem to compile the test program.  Guessing...)"
5991                 rp="What is the size of a long long (in bytes)?"
5992                 . ./myread
5993                 longlongsize="$ans"
5994         fi
5995         if $test "X$longsize" = "X$longlongsize"; then
5996                 echo "(That isn't any different from an ordinary long.)"
5997         fi
5998         ;;
5999 esac
6000 $rm_try
6001
6002 : see if inttypes.h is available
6003 : we want a real compile instead of Inhdr because some systems
6004 : have an inttypes.h which includes non-existent headers
6005 echo " "
6006 $cat >try.c <<EOCP
6007 #include <inttypes.h>
6008 int main() {
6009         static int32_t foo32 = 0x12345678;
6010 }
6011 EOCP
6012 set try
6013 if eval $compile; then
6014         echo "<inttypes.h> found." >&4
6015         val="$define"
6016 else
6017         echo "<inttypes.h> NOT found." >&4
6018         val="$undef"
6019 fi
6020 $rm_try
6021 set i_inttypes
6022 eval $setvar
6023
6024 : check for int64_t
6025 echo " "
6026 echo "Checking to see if you have int64_t..." >&4
6027 $cat >try.c <<EOCP
6028 #include <sys/types.h>
6029 #$i_inttypes I_INTTYPES
6030 #ifdef I_INTTYPES
6031 #include <inttypes.h>
6032 #endif
6033 int main() { int64_t x = 7; }
6034 EOCP
6035 set try
6036 if eval $compile; then
6037         val="$define"
6038         echo "You have int64_t."
6039 else
6040         val="$undef"
6041         echo "You do not have int64_t."
6042 fi
6043 $rm_try
6044 set d_int64_t
6045 eval $setvar
6046
6047 : Check if 64bit ints have a quad type
6048 echo " "
6049 echo "Checking which 64-bit integer type we could use..." >&4
6050
6051 case "$intsize" in
6052 8) val=int
6053    set quadtype
6054    eval $setvar
6055    val='"unsigned int"'
6056    set uquadtype
6057    eval $setvar
6058    quadkind=1
6059    ;;
6060 *) case "$longsize" in
6061    8) val=long
6062       set quadtype
6063       eval $setvar
6064       val='"unsigned long"'
6065       set uquadtype
6066       eval $setvar
6067       quadkind=2
6068       ;;
6069    *) case "$d_longlong:$longlongsize" in
6070       define:8)
6071         val='"long long"'
6072         set quadtype
6073         eval $setvar
6074         val='"unsigned long long"'
6075         set uquadtype
6076         eval $setvar
6077         quadkind=3
6078         ;;
6079       *) case "$d_int64_t" in
6080          define)
6081            val=int64_t
6082            set quadtype
6083            eval $setvar
6084            val=uint64_t
6085            set uquadtype
6086            eval $setvar
6087            quadkind=4
6088            ;;
6089          esac
6090          ;;
6091       esac
6092       ;;
6093    esac
6094    ;;
6095 esac
6096
6097 case "$quadtype" in
6098 '')     echo "Alas, no 64-bit integer types in sight." >&4
6099         d_quad="$undef"
6100         ;;
6101 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6102         d_quad="$define"
6103         ;;
6104 esac
6105
6106 : Do we want 64bit support
6107 case "$uselonglong" in
6108 "$define"|true|[yY]*)
6109         cat <<EOM >&4
6110
6111 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6112 EOM
6113         use64bitint="$define"
6114         ;;
6115 esac
6116 case "$use64bits" in
6117 "$define"|true|[yY]*)
6118         cat <<EOM >&4
6119
6120 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6121 EOM
6122         use64bitint="$define"
6123         ;;
6124 esac
6125 case "$use64bitints" in
6126 "$define"|true|[yY]*)
6127         cat <<EOM >&4
6128
6129 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6130 EOM
6131         use64bitint="$define"
6132         ;;
6133 esac
6134 case "$use64bitsint" in
6135 "$define"|true|[yY]*)
6136         cat <<EOM >&4
6137
6138 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6139 EOM
6140         use64bitint="$define"
6141         ;;
6142 esac
6143 case "$uselonglongs" in
6144 "$define"|true|[yY]*)
6145         cat <<EOM >&4
6146
6147 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6148 EOM
6149         use64bitint="$define"
6150         ;;
6151 esac
6152 case "$use64bitsall" in
6153 "$define"|true|[yY]*)
6154         cat <<EOM >&4
6155
6156 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6157 EOM
6158         use64bitall="$define"
6159         ;;
6160 esac
6161
6162 case "$ccflags" in
6163 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6164 esac
6165 case "$use64bitall" in
6166 "$define"|true|[yY]*) use64bitint="$define" ;;
6167 esac
6168
6169 case "$longsize" in
6170 8) cat <<EOM
6171
6172 You have natively 64-bit long integers.
6173 EOM
6174    val="$define"
6175    ;;
6176 *) case "$use64bitint" in
6177    "$define"|true|[yY]*) dflt='y';;
6178    *) dflt='n';;
6179    esac
6180    case "$d_quad" in
6181    "$define") ;;
6182    *) dflt='n' ;;
6183    esac
6184    cat <<EOM
6185
6186 Perl can be built to take advantage of 64-bit integer types
6187 on some systems.  To do so, Configure can be run with -Duse64bitint.
6188 Choosing this option will most probably introduce binary incompatibilities.
6189
6190 If this doesn't make any sense to you, just accept the default '$dflt'.
6191 (The default has been chosen based on your configuration.)
6192 EOM
6193    rp='Try to use 64-bit integers, if available?'
6194    . ./myread
6195    case "$ans" in
6196    [yY]*) val="$define" ;;
6197    *)     val="$undef"  ;;
6198    esac
6199    ;;
6200 esac
6201 set use64bitint
6202 eval $setvar
6203
6204 case "$use64bitall" in
6205 "$define"|true|[yY]*) dflt='y' ;;
6206 *) case "$longsize" in
6207    8) dflt='y' ;;
6208    *) dflt='n' ;;
6209    esac
6210    ;;
6211 esac
6212 cat <<EOM
6213
6214 You may also choose to try maximal 64-bitness.  It means using as much
6215 64-bitness as possible on the platform.  This in turn means even more
6216 binary incompatibilities.  On the other hand, your platform may not
6217 have any more 64-bitness available than what you already have chosen.
6218
6219 If this doesn't make any sense to you, just accept the default '$dflt'.
6220 (The default has been chosen based on your configuration.)
6221 EOM
6222 rp='Try to use maximal 64-bit support, if available?'
6223 . ./myread
6224 case "$ans" in
6225 [yY]*) val="$define" ;;
6226 *)     val="$undef"  ;;
6227 esac
6228 set use64bitall
6229 eval $setvar
6230 case "$use64bitall" in
6231 "$define")
6232         case "$use64bitint" in
6233         "$undef")
6234                 cat <<EOM
6235
6236 Since you have chosen a maximally 64-bit build, I'm also turning on
6237 the use of 64-bit integers.
6238 EOM
6239                 use64bitint="$define" ;;
6240         esac
6241         ;;
6242 esac
6243
6244 : Look for a hint-file generated 'call-back-unit'.  If the
6245 : user has specified that a 64-bit perl is to be built,
6246 : we may need to set or change some other defaults.
6247 if $test -f use64bitint.cbu; then
6248         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6249         . ./use64bitint.cbu
6250 fi
6251 case "$use64bitint" in
6252 "$define"|true|[yY]*)
6253         : This test was common to all the OpenBSD forks, and seems harmless for
6254         : other platforms:
6255         echo " "
6256         echo "Checking if your C library has broken 64-bit functions..." >&4
6257         cat >try.c <<EOCP
6258 #include <stdio.h>
6259 typedef $uquadtype myULL;
6260 int main (void)
6261 {
6262     struct {
6263         double d;
6264         myULL  u;
6265     } *p, test[] = {
6266         {4294967303.15, 4294967303ULL},
6267         {4294967294.2,  4294967294ULL},
6268         {4294967295.7,  4294967295ULL},
6269         {0.0, 0ULL}
6270     };
6271     for (p = test; p->u; p++) {
6272         myULL x = (myULL)p->d;
6273         if (x != p->u) {
6274             printf("buggy\n");
6275             return 0;
6276         }
6277     }
6278     printf("ok\n");
6279     return 0;
6280 }
6281 EOCP
6282         set try
6283         if eval $compile_ok; then
6284             libcquad=`$run ./try`
6285             echo "Your C library's 64-bit functions are $libcquad."
6286         else
6287             echo "(I can't seem to compile the test program.)"
6288             echo "Assuming that your C library's 64-bit functions are ok."
6289             libcquad="ok"
6290         fi
6291         $rm_try
6292
6293         case "$libcquad" in
6294             buggy*)
6295                 cat >&4 <<EOM
6296
6297 *** You have a C library with broken 64-bit functions.
6298 *** 64-bit support does not work reliably in this configuration.
6299 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6300 *** Cannot continue, aborting.
6301
6302 EOM
6303                 exit 1
6304                 ;;
6305         esac
6306         case "$longsize" in
6307         4) case "$archname64" in
6308            '') archname64=64int ;;
6309            esac
6310            ;;
6311         esac
6312         ;;
6313 esac
6314
6315 : Look for a hint-file generated 'call-back-unit'.  If the
6316 : user has specified that a maximally 64-bit perl is to be built,
6317 : we may need to set or change some other defaults.
6318 if $test -f use64bitall.cbu; then
6319         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6320         . ./use64bitall.cbu
6321 fi
6322 case "$use64bitall" in
6323 "$define"|true|[yY]*)
6324         case "$longsize" in
6325         4) case "$archname64" in
6326            ''|64int) archname64=64all ;;
6327            esac
6328            ;;
6329         esac
6330         ;;
6331 esac
6332
6333 case "$d_quad:$use64bitint" in
6334 $undef:$define)
6335         cat >&4 <<EOF
6336
6337 *** You have chosen to use 64-bit integers,
6338 *** but none can be found.
6339 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6340 *** Cannot continue, aborting.
6341
6342 EOF
6343         exit 1
6344         ;;
6345 esac
6346
6347 : Check if we are using the GNU C library
6348 echo " "
6349 echo "Checking for GNU C Library..." >&4
6350 cat >try.c <<'EOCP'
6351 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6352    alone are insufficient to distinguish different versions, such as
6353    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6354    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6355 */
6356 #include <stdio.h>
6357 int main(void)
6358 {
6359 #ifdef __GLIBC__
6360 #   ifdef __GLIBC_MINOR__
6361 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6362 #           include <gnu/libc-version.h>
6363             printf("%s\n",  gnu_get_libc_version());
6364 #       else
6365             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6366 #       endif
6367 #   else
6368         printf("%d\n",  __GLIBC__);
6369 #   endif
6370     return 0;
6371 #else
6372     return 1;
6373 #endif
6374 }
6375 EOCP
6376 set try
6377 if eval $compile_ok && $run ./try > glibc.ver; then
6378         val="$define"
6379         gnulibc_version=`$cat glibc.ver`
6380         echo "You are using the GNU C Library version $gnulibc_version"
6381 else
6382         val="$undef"
6383         gnulibc_version=''
6384         echo "You are not using the GNU C Library"
6385 fi
6386 $rm_try glibc.ver
6387 set d_gnulibc
6388 eval $setvar
6389
6390 : see if nm is to be used to determine whether a symbol is defined or not
6391 case "$usenm" in
6392 '')
6393         dflt=''
6394         case "$d_gnulibc" in
6395         "$define")
6396                 echo " "
6397                 echo "nm probably won't work on the GNU C Library." >&4
6398                 dflt=n
6399                 ;;
6400         esac
6401         case "$dflt" in
6402         '')
6403                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6404                         echo " "
6405                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6406                         echo "'nm' won't be sufficient on this system." >&4
6407                         dflt=n
6408                 fi
6409                 ;;
6410         esac
6411         case "$dflt" in
6412         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6413                 if $test $dflt -gt 20; then
6414                         dflt=y
6415                 else
6416                         dflt=n
6417                 fi
6418                 ;;
6419         esac
6420         ;;
6421 *)
6422         case "$usenm" in
6423         true|$define) dflt=y;;
6424         *) dflt=n;;
6425         esac
6426         ;;
6427 esac
6428 $cat <<EOM
6429
6430 I can use $nm to extract the symbols from your C libraries. This
6431 is a time consuming task which may generate huge output on the disk (up
6432 to 3 megabytes) but that should make the symbols extraction faster. The
6433 alternative is to skip the 'nm' extraction part and to compile a small
6434 test program instead to determine whether each symbol is present. If
6435 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6436 this may be the best solution.
6437
6438 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6439
6440 EOM
6441 rp="Shall I use $nm to extract C symbols from the libraries?"
6442 . ./myread
6443 case "$ans" in
6444 [Nn]*) usenm=false;;
6445 *) usenm=true;;
6446 esac
6447
6448 runnm=$usenm
6449 case "$reuseval" in
6450 true) runnm=false;;
6451 esac
6452
6453 : nm options which may be necessary
6454 case "$nm_opt" in
6455 '') if $test -f /mach_boot; then
6456                 nm_opt=''       # Mach
6457         elif $test -d /usr/ccs/lib; then
6458                 nm_opt='-p'     # Solaris (and SunOS?)
6459         elif $test -f /dgux; then
6460                 nm_opt='-p'     # DG-UX
6461         elif $test -f /lib64/rld; then
6462                 nm_opt='-p'     # 64-bit Irix
6463         else
6464                 nm_opt=''
6465         fi;;
6466 esac
6467
6468 : nm options which may be necessary for shared libraries but illegal
6469 : for archive libraries.  Thank you, Linux.
6470 case "$nm_so_opt" in
6471 '')     case "$myuname" in
6472         *linux*|gnu*)
6473                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6474                         nm_so_opt='--dynamic'
6475                 fi
6476                 ;;
6477         esac
6478         ;;
6479 esac
6480
6481 : Figure out where the libc is located
6482 case "$runnm" in
6483 true)
6484 : get list of predefined functions in a handy place
6485 echo " "
6486 case "$libc" in
6487 '') libc=unknown
6488         case "$libs" in
6489         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6490         esac
6491         ;;
6492 esac
6493 case "$libs" in
6494 '') ;;
6495 *)  for thislib in $libs; do
6496         case "$thislib" in
6497         -lc|-lc_s)
6498                 : Handle C library specially below.
6499                 ;;
6500         -l*)
6501                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6502                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6503                         :
6504                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6505                         :
6506                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6507                         :
6508                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6509                         :
6510                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6511                         :
6512                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6513                         :
6514                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6515                         :
6516                 else
6517                         try=''
6518                 fi
6519                 libnames="$libnames $try"
6520                 ;;
6521         *) libnames="$libnames $thislib" ;;
6522         esac
6523         done
6524         ;;
6525 esac
6526 xxx=normal
6527 case "$libc" in
6528 unknown)
6529         set /lib/libc.$so
6530         for xxx in $libpth; do
6531                 $test -r $1 || set $xxx/libc.$so
6532                 : The messy sed command sorts on library version numbers.
6533                 $test -r $1 || \
6534                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6535                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6536                                 h
6537                                 s/[0-9][0-9]*/0000&/g
6538                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6539                                 G
6540                                 s/\n/ /' | \
6541                          $sort | $sed -e 's/^.* //'`
6542                 eval set \$$#
6543         done
6544         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6545         $test -r $1 || set $sysroot/lib/libsys_s$_a
6546         ;;
6547 *)
6548         set blurfl
6549         ;;
6550 esac
6551 if $test -r "$1"; then
6552         echo "Your (shared) C library seems to be in $1."
6553         libc="$1"
6554 elif $test -r /lib/libc && $test -r /lib/clib; then
6555         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6556         xxx=apollo
6557         libc='/lib/clib /lib/libc'
6558         if $test -r /lib/syslib; then
6559                 echo "(Your math library is in /lib/syslib.)"
6560                 libc="$libc /lib/syslib"
6561         fi
6562 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6563         echo "Your C library seems to be in $libc, as you said before."
6564 elif $test -r $incpath/usr/lib/libc$_a; then
6565         libc=$incpath/usr/lib/libc$_a;
6566         echo "Your C library seems to be in $libc.  That's fine."
6567 elif $test -r /lib/libc$_a; then
6568         libc=/lib/libc$_a;
6569         echo "Your C library seems to be in $libc.  You're normal."
6570 else
6571         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6572                 :
6573         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6574                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6575         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6576                 :
6577         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6578                 :
6579         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6580                 :
6581         else
6582                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6583         fi
6584         if $test -r "$tans"; then
6585                 echo "Your C library seems to be in $tans, of all places."
6586                 libc=$tans
6587         else
6588                 libc='blurfl'
6589         fi
6590 fi
6591 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6592         dflt="$libc"
6593         cat <<EOM
6594
6595 If the guess above is wrong (which it might be if you're using a strange
6596 compiler, or your machine supports multiple models), you can override it here.
6597
6598 EOM
6599 else
6600         dflt=''
6601         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6602         cat >&4 <<EOM
6603 I can't seem to find your C library.  I've looked in the following places:
6604
6605 EOM
6606         $sed 's/^/      /' libpath
6607         cat <<EOM
6608
6609 None of these seems to contain your C library. I need to get its name...
6610
6611 EOM
6612 fi
6613 fn=f
6614 rp='Where is your C library?'
6615 . ./getfile
6616 libc="$ans"
6617
6618 echo " "
6619 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6620 set X `cat libnames`
6621 shift
6622 xxx=files
6623 case $# in 1) xxx=file; esac
6624 echo "Extracting names from the following $xxx for later perusal:" >&4
6625 echo " "
6626 $sed 's/^/      /' libnames >&4
6627 echo " "
6628 $echo $n "This may take a while...$c" >&4
6629
6630 for file in $*; do
6631         case $file in
6632         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6633         *) $nm $nm_opt $file 2>/dev/null;;
6634         esac
6635 done >libc.tmp
6636
6637 $echo $n ".$c"
6638 $grep fprintf libc.tmp > libc.ptf
6639 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6640 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6641 xxx='[ADTSIWi]'
6642 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6643         eval $xscan;\
6644         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6645                 eval $xrun
6646 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6647         eval $xscan;\
6648         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6649                 eval $xrun
6650 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6651         eval $xscan;\
6652         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6653                 eval $xrun
6654 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6655         eval $xscan;\
6656         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6657                 eval $xrun
6658 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6659         eval $xscan;\
6660         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6661                 eval $xrun
6662 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6663         eval $xscan;\
6664         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6665                 eval $xrun
6666 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6667                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6668         eval $xscan;\
6669         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6670                 eval $xrun
6671 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//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 '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6676         eval $xscan;\
6677         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6678                 eval $xrun
6679 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6680         eval $xscan;\
6681         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6682                 eval $xrun
6683 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6684         eval $xscan;\
6685         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6686                 eval $xrun
6687 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6688         eval $xscan;\
6689         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6690                 eval $xrun
6691 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6692         eval $xscan;\
6693         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6694                 eval $xrun
6695 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6696         eval $xscan;\
6697         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6698                 eval $xrun
6699 else
6700         $nm -p $* 2>/dev/null >libc.tmp
6701         $grep fprintf libc.tmp > libc.ptf
6702         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6703                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6704         then
6705                 nm_opt='-p'
6706                 eval $xrun
6707         else
6708                 echo " "
6709                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6710                 com=''
6711                 if $ar t $libc > libc.tmp && \
6712                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6713                 then
6714                         for thisname in $libnames $libc; do
6715                                 $ar t $thisname >>libc.tmp
6716                         done
6717                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6718                         echo "Ok." >&4
6719                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6720                         for thisname in $libnames $libc; do
6721                                 $ar tv $thisname >>libc.tmp
6722                                 emximp -o tmp.imp $thisname \
6723                                     2>/dev/null && \
6724                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6725                                     < tmp.imp >>libc.tmp
6726                                 $rm -f tmp.imp
6727                         done
6728                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6729                         echo "Ok." >&4
6730                 else
6731                         echo "$ar didn't seem to work right." >&4
6732                         echo "Maybe this is a Cray...trying bld instead..." >&4
6733                         if  bld t $libc | \
6734                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6735                                 $test -s libc.list
6736                         then
6737                                 for thisname in $libnames; do
6738                                         bld t $libnames | \
6739                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6740                                         $ar t $thisname >>libc.tmp
6741                                 done
6742                                 echo "Ok." >&4
6743                         else
6744                                 echo "That didn't work either.  Giving up." >&4
6745                                 exit 1
6746                         fi
6747                 fi
6748         fi
6749 fi
6750 nm_extract="$com"
6751 case "$PASE" in
6752 define)
6753     echo " "
6754     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6755     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6756     ;;
6757 *)  if $test -f /lib/syscalls.exp; then
6758         echo " "
6759         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6760         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6761                 /lib/syscalls.exp >>libc.list
6762     fi
6763     ;;
6764 esac
6765 ;;
6766 esac
6767 $rm -f libnames libpath
6768
6769 : Check if we are using C++
6770 echo " "
6771 echo "Checking for C++..." >&4
6772 $cat >try.c <<'EOCP'
6773 #include <stdio.h>
6774 int main(void)
6775 {
6776 #ifdef __cplusplus
6777     return 0;
6778 #else
6779     return 1;
6780 #endif
6781 }
6782 EOCP
6783 set try
6784 if eval $compile_ok && $run ./try; then
6785         val="$define"
6786         echo "You are using a C++ compiler."
6787 else
6788         val="$undef"
6789         echo "You are not using a C++ compiler."
6790 fi
6791 $rm_try cplusplus$$
6792 set d_cplusplus
6793 eval $setvar
6794
6795 : is a C symbol defined?
6796 csym='tlook=$1;
6797 case "$3" in
6798 -v) tf=libc.tmp; tdc="";;
6799 -a) tf=libc.tmp; tdc="[]";;
6800 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6801 esac;
6802 case "$d_cplusplus" in
6803     $define)    extern_C="extern \"C\"" ;;
6804     *)          extern_C="extern"       ;;
6805 esac;
6806 tx=yes;
6807 case "$reuseval-$4" in
6808 true-) ;;
6809 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6810 esac;
6811 case "$tx" in
6812 yes)
6813         tval=false;
6814         if $test "$runnm" = true; then
6815                 if $contains $tlook $tf >/dev/null 2>&1; then
6816                         tval=true;
6817                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6818                         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;
6819                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6820                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6821                         $rm_try;
6822                 fi;
6823         else
6824                 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;
6825                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6826                 $rm_try;
6827         fi;
6828         ;;
6829 *)
6830         case "$tval" in
6831         $define) tval=true;;
6832         *) tval=false;;
6833         esac;
6834         ;;
6835 esac;
6836 eval "$2=$tval"'
6837
6838 : define an is-in-libc? function
6839 inlibc='echo " "; td=$define; tu=$undef;
6840 sym=$1; var=$2; eval "was=\$$2";
6841 tx=yes;
6842 case "$reuseval$was" in
6843 true) ;;
6844 true*) tx=no;;
6845 esac;
6846 case "$tx" in
6847 yes)
6848         set $sym tres -f;
6849         eval $csym;
6850         case "$tres" in
6851         true)
6852                 echo "$sym() found." >&4;
6853                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6854         *)
6855                 echo "$sym() NOT found." >&4;
6856                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6857         esac;;
6858 *)
6859         case "$was" in
6860         $define) echo "$sym() found." >&4;;
6861         *) echo "$sym() NOT found." >&4;;
6862         esac;;
6863 esac'
6864
6865 : check for length of double
6866 echo " "
6867 case "$doublesize" in
6868 '')
6869         echo "Checking to see how big your double precision numbers are..." >&4
6870         $cat >try.c <<EOCP
6871 #include <stdio.h>
6872 #$i_stdlib I_STDLIB
6873 #ifdef I_STDLIB
6874 #include <stdlib.h>
6875 #endif
6876 int main()
6877 {
6878     printf("%d\n", (int)sizeof(double));
6879     exit(0);
6880 }
6881 EOCP
6882         set try
6883         if eval $compile_ok; then
6884                 doublesize=`$run ./try`
6885                 echo "Your double is $doublesize bytes long."
6886         else
6887                 dflt='8'
6888                 echo "(I can't seem to compile the test program.  Guessing...)"
6889                 rp="What is the size of a double precision number (in bytes)?"
6890                 . ./myread
6891                 doublesize="$ans"
6892         fi
6893         ;;
6894 esac
6895 $rm_try
6896
6897 : see if this is a float.h system
6898 set float.h i_float
6899 eval $inhdr
6900
6901 : check for long doubles
6902 echo " "
6903 echo "Checking to see if you have long double..." >&4
6904 echo 'int main() { long double x = 7.0; }' > try.c
6905 set try
6906 if eval $compile; then
6907         val="$define"
6908         echo "You have long double."
6909 else
6910         val="$undef"
6911         echo "You do not have long double."
6912 fi
6913 $rm_try
6914 set d_longdbl
6915 eval $setvar
6916
6917 : see if ldexpl exists
6918 set ldexpl d_ldexpl
6919 eval $inlibc
6920
6921 : check for length of long double
6922 case "${d_longdbl}${longdblsize}" in
6923 $define)
6924         echo " "
6925         echo "Checking to see how big your long doubles are..." >&4
6926         $cat >try.c <<'EOCP'
6927 #include <stdio.h>
6928 int main()
6929 {
6930         printf("%d\n", sizeof(long double));
6931 }
6932 EOCP
6933         set try
6934         set try
6935         if eval $compile; then
6936                 longdblsize=`$run ./try`
6937                 echo "Your long doubles are $longdblsize bytes long."
6938         else
6939                 dflt='8'
6940                 echo " "
6941                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6942                 rp="What is the size of a long double (in bytes)?"
6943                 . ./myread
6944                 longdblsize="$ans"
6945         fi
6946         if $test "X$doublesize" = "X$longdblsize"; then
6947                 echo "That isn't any different from an ordinary double."
6948                 echo "I'll keep your setting anyway, but you may see some"
6949                 echo "harmless compilation warnings."
6950         fi
6951         ;;
6952 esac
6953 $rm_try
6954
6955 $echo "Checking the kind of long doubles you have..." >&4
6956 case "$d_longdbl" in
6957 define)
6958 $cat <<EOP >try.c
6959 #$i_float I_FLOAT
6960 #$i_stdlib I_STDLIB
6961 #define LONGDBLSIZE $longdblsize
6962 #define DOUBLESIZE $doublesize
6963 #ifdef I_FLOAT
6964 #include <float.h>
6965 #endif
6966 #ifdef I_STDLIB
6967 #include <stdlib.h>
6968 #endif
6969 #include <stdio.h>
6970 static const long double d = -0.1L;
6971 int main() {
6972   unsigned const char* b = (unsigned const char*)(&d);
6973 #if DOUBLESIZE == LONGDBLSIZE
6974   printf("0\n"); /* if it floats like double */
6975   exit(0);
6976 #endif
6977 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6978   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6979     /* IEEE 754 128-bit little-endian */
6980     printf("1\n");
6981     exit(0);
6982   }
6983   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6984     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6985     printf("2\n");
6986     exit(0);
6987   }
6988 #endif
6989 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6990  * while 64-bits platforms have it in 16 bytes.  The trailing bytes
6991  * cannot be trusted. */
6992 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6993   if (b[0] == 0xCD && b[9] == 0xBF) {
6994     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6995      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6996      * Also known as "extended precision". */
6997     printf("3\n");
6998     exit(0);
6999   }
7000   if (b[0] == 0xBF && b[9] == 0xCD) {
7001     /* Is there ever big-endian 80-bit, really?
7002      *
7003      * The Motorola 68881 had another "extended precision" format:
7004      * sign:1 exp:15 zero:16 integer:1 mantissa:63
7005      * for total of 96 bits of bytes.  The zero bits were unused.
7006      * See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL" for more details.
7007      * If it ever becomes relevant, this format should be allocated
7008      * a new doublekind code since it's quite different from the Intel x87.
7009      */
7010     printf("4\n");
7011     exit(0);
7012   }
7013 #endif
7014 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
7015   /* software "double double", the 106 is 53+53.
7016    * but irix thinks it is 107. */
7017   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
7018     /* double double 128-bit fully little-endian,
7019      * little-endian doubles in little-endian order,
7020      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
7021     printf("5\n");
7022     exit(0);
7023   }
7024   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7025     /* double double 128-bit fully big-endian,
7026      * big-endian doubles in big-endian order,
7027      * e.g. PPC/Power and MIPS:
7028      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7029     printf("6\n");
7030     exit(0);
7031   }
7032   if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7033     /* double double 128-bit mixed endian.
7034      * little-endian doubles in big-endian order,
7035      * e.g. ppc64el,
7036      * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7037     printf("7\n");
7038     exit(0);
7039   }
7040   if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7041     /* double double 128-bit mixed endian,
7042      * big-endian doubles in little-endian order,
7043      * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7044     printf("8\n");
7045     exit(0);
7046   }
7047 #endif
7048 /* We are largely making this up because it may well be
7049  * that the VAX format H was never made available to C,
7050  * only to Fortran. */
7051 #if LONGDBLSIZE == 16 && defined(__vax__)
7052   if (b[0] == 0xFD && b[15] == 0x99) {
7053     /* VAX format H, PDP-11 mixed endian. */
7054     printf("9\n");
7055     exit(0);
7056   }
7057 #endif
7058   printf("-1\n"); /* unknown */
7059   exit(0);
7060 }
7061 EOP
7062 set try
7063 if eval $compile; then
7064     longdblkind=`$run ./try`
7065 else
7066     longdblkind=-1
7067 fi
7068 ;;
7069 *) longdblkind=0 ;;
7070 esac
7071 case "$longdblkind" in
7072 0) echo "Your long doubles are doubles." >&4 ;;
7073 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7074 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7075 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
7076 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
7077 5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >& 4 ;;
7078 6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >& 4 ;;
7079 7) echo "You have 128-bit mixed-endian double-double long doubles (64-bit LEs in BE)." >& 4 ;;
7080 8) echo "You have 128-bit mixed-endian double-double long doubles (64-bit BEs in LE)." >& 4 ;;
7081 9) echo "You have 128-bit PDP-style mixed-endian long doubles." >& 4 ;;
7082 *) echo "Cannot figure out your long double." >&4 ;;
7083 esac
7084 $rm_try
7085
7086 : determine the architecture name
7087 echo " "
7088 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7089         tarch=`arch`"-$osname"
7090 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7091         if uname -m > tmparch 2>&1 ; then
7092                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7093                         -e 's/$/'"-$osname/" tmparch`
7094         else
7095                 tarch="$osname"
7096         fi
7097         $rm -f tmparch
7098 else
7099         tarch="$osname"
7100 fi
7101 case "$myarchname" in
7102 ''|"$tarch") ;;
7103 *)
7104         echo "(Your architecture name used to be $myarchname.)"
7105         archname=''
7106         ;;
7107 esac
7108 case "$targetarch" in
7109 '') ;;
7110 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7111 esac
7112 myarchname="$tarch"
7113 case "$archname" in
7114 '') dflt="$tarch";;
7115 *) dflt="$archname";;
7116 esac
7117 rp='What is your architecture name'
7118 . ./myread
7119 archname="$ans"
7120
7121 : optionally add API version to the architecture for versioned archlibs
7122 case "$useversionedarchname" in
7123 $define|true|[yY]*) dflt='y';;
7124 *)                  dflt='n';;
7125 esac
7126 rp='Add the Perl API version to your archname?'
7127 . ./myread
7128 case "$ans" in
7129 y|Y)    useversionedarchname="$define" ;;
7130 *)      useversionedarchname="$undef" ;;
7131 esac
7132 case "$useversionedarchname" in
7133 $define)
7134         case "$archname" in
7135         *-$api_versionstring)
7136                 echo "...and architecture name already has -$api_versionstring" >&4
7137                 ;;
7138         *)
7139                 archname="$archname-$api_versionstring"
7140                 echo "...setting architecture name to $archname." >&4
7141                 ;;
7142         esac
7143         ;;
7144 esac
7145
7146 case "$usethreads" in
7147 $define)
7148         echo "Threads selected." >&4
7149         case "$archname" in
7150         *-thread*) echo "...and architecture name already has -thread." >&4
7151                 ;;
7152         *)      archname="$archname-thread"
7153                 echo "...setting architecture name to $archname." >&4
7154                 ;;
7155         esac
7156         ;;
7157 esac
7158 case "$usemultiplicity" in
7159 $define)
7160         echo "Multiplicity selected." >&4
7161         case "$archname" in
7162         *-multi*) echo "...and architecture name already has -multi." >&4
7163                 ;;
7164         *)      archname="$archname-multi"
7165                 echo "...setting architecture name to $archname." >&4
7166                 ;;
7167         esac
7168         ;;
7169 esac
7170 case "$use64bitint$use64bitall" in
7171 *"$define"*)
7172         case "$archname64" in
7173         '')
7174                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7175                 ;;
7176         *)
7177                 case "$use64bitint" in
7178                 "$define") echo "64 bit integers selected." >&4 ;;
7179                 esac
7180                 case "$use64bitall" in
7181                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7182                 esac
7183                 case "$archname" in
7184                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7185                         ;;
7186                 *)      archname="$archname-$archname64"
7187                         echo "...setting architecture name to $archname." >&4
7188                         ;;
7189                 esac
7190                 ;;
7191         esac
7192 esac
7193 case "$uselongdouble" in
7194 $define)
7195         echo "Long doubles selected." >&4
7196         case "$longdblsize" in
7197         $doublesize)
7198                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7199                 ;;
7200         *)
7201                 case "$archname" in
7202                 *-ld*) echo "...and architecture name already has -ld." >&4
7203                         ;;
7204                 *)      archname="$archname-ld"
7205                         echo "...setting architecture name to $archname." >&4
7206                         ;;
7207                 esac
7208                 ;;
7209         esac
7210         ;;
7211 esac
7212 case "$usequadmath" in
7213 $define)
7214         echo "quadmath selected." >&4
7215         case "$archname" in
7216         *-quadmath*) echo "...and architecture name already has -quadmath." >&4
7217                 ;;
7218         *)      archname="$archname-quadmath"
7219                 echo "...setting architecture name to $archname." >&4
7220                 ;;
7221         esac
7222         ;;
7223 esac
7224 if $test -f archname.cbu; then
7225         echo "Your platform has some specific hints for architecture name, using them..."
7226         . ./archname.cbu
7227 fi
7228
7229 : set the prefixit variable, to compute a suitable default value
7230 prefixit='case "$3" in
7231 ""|none)
7232         case "$oldprefix" in
7233         "") eval "$1=\"\$$2\"";;
7234         *)
7235                 case "$3" in
7236                 "") eval "$1=";;
7237                 none)
7238                         eval "tp=\"\$$2\"";
7239                         case "$tp" in
7240                         ""|" ") eval "$1=\"\$$2\"";;
7241                         *) eval "$1=";;
7242                         esac;;
7243                 esac;;
7244         esac;;
7245 *)
7246         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7247         case "$tp" in
7248         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7249         /*-$oldprefix/*|\~*-$oldprefix/*)
7250                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7251         *) eval "$1=\"\$$2\"";;
7252         esac;;
7253 esac'
7254
7255 : determine installation style
7256 : For now, try to deduce it from prefix unless it is already set.
7257 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7258 case "$installstyle" in
7259 '')     case "$prefix" in
7260                 *perl*) dflt='lib';;
7261                 *) dflt='lib/perl5' ;;
7262         esac
7263         ;;
7264 *)      dflt="$installstyle" ;;
7265 esac
7266 : Probably not worth prompting for this since we prompt for all
7267 : the directories individually, and the prompt would be too long and
7268 : confusing anyway.
7269 installstyle=$dflt
7270
7271 : determine where public executables go
7272 echo " "
7273 set dflt bin bin
7274 eval $prefixit
7275 fn=d~
7276 rp='Pathname where the public executables will reside?'
7277 . ./getfile
7278 if $test "X$ansexp" != "X$binexp"; then
7279         installbin=''
7280 fi
7281 prefixvar=bin
7282 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7283 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7284 :     this via initialinstalllocation
7285 . ./setprefixvar
7286
7287 case "$userelocatableinc" in
7288 $define|true|[yY]*)     dflt='y' ;;
7289 *)                      dflt='n' ;;
7290 esac
7291 cat <<EOM
7292
7293 Would you like to build Perl so that the installation is relocatable, so that
7294 library paths in @INC are determined relative to the path of the perl binary?
7295 This is not advised for system Perl installs, or if you need to run setid
7296 scripts or scripts under taint mode.
7297
7298 If this doesn't make any sense to you, just accept the default '$dflt'.
7299 EOM
7300 rp='Use relocatable @INC?'
7301 . ./myread
7302 case "$ans" in
7303 y|Y)    val="$define" ;;
7304 *)      val="$undef"  ;;
7305 esac
7306 set userelocatableinc
7307 eval $setvar
7308
7309 initialinstalllocation="$binexp"
7310 : Default prefix is now "up one level from where the binaries are"
7311 case "$userelocatableinc" in
7312 $define|true|[yY]*)
7313     bin=".../"
7314     binexp=".../"
7315     prefix=".../.."
7316     prefixexp=".../.."
7317     installprefixexp=".../.."
7318     ;;
7319 esac
7320
7321 : determine where private library files go
7322 : Usual default is /usr/local/lib/perl5/$version.
7323 : Also allow things like /opt/perl/lib/$version, since
7324 : /opt/perl/lib/perl5... would be redundant.
7325 : The default "style" setting is made in installstyle.U
7326 case "$installstyle" in
7327 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7328 *)       set dflt privlib lib/$version ;;
7329 esac
7330 eval $prefixit
7331 $cat <<EOM
7332
7333 There are some auxiliary files for $package that need to be put into a
7334 private library directory that is accessible by everyone.
7335
7336 EOM
7337 fn=$binexp
7338 fn=d~+
7339 rp='Pathname where the private library files will reside?'
7340 . ./getfile
7341 prefixvar=privlib
7342 . ./setprefixvar
7343
7344 : set the prefixup variable, to restore leading tilda escape
7345 prefixup='case "$prefixexp" in
7346 "$prefix") ;;
7347 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7348 esac'
7349
7350 : determine where public architecture dependent libraries go
7351 set archlib archlib
7352 eval $prefixit
7353 : privlib default is /usr/local/lib/$package/$version
7354 : archlib default is /usr/local/lib/$package/$version/$archname
7355 : privlib may have an optional trailing /share.
7356 tdflt=`echo $privlib | $sed 's,/share$,,'`
7357 tdflt=$tdflt/$archname
7358 case "$archlib" in
7359 '')     dflt=$tdflt
7360         ;;
7361 *)      dflt="$archlib"
7362     ;;
7363 esac
7364 $cat <<EOM
7365
7366 $spackage contains architecture-dependent library files.  If you are
7367 sharing libraries in a heterogeneous environment, you might store
7368 these files in a separate location.  Otherwise, you can just include
7369 them with the rest of the public library files.
7370
7371 EOM
7372 fn=$binexp
7373 fn=d+~
7374 rp='Where do you want to put the public architecture-dependent libraries?'
7375 . ./getfile
7376 prefixvar=archlib
7377 . ./setprefixvar
7378 if $test X"$archlib" = X"$privlib"; then
7379         d_archlib="$undef"
7380 else
7381         d_archlib="$define"
7382 fi
7383
7384 : see if setuid scripts can be secure
7385 $cat <<EOM
7386
7387 Some kernels have a bug that prevents setuid #! scripts from being
7388 secure.  Some sites have disabled setuid #! scripts because of this.
7389
7390 First let's decide if your kernel supports secure setuid #! scripts.
7391 (If setuid #! scripts would be secure but have been disabled anyway,
7392 don't say that they are secure if asked.)
7393
7394 EOM
7395
7396 val="$undef"
7397 if $test -d /dev/fd; then
7398         echo "#!$ls" >reflect
7399         chmod +x,u+s reflect
7400         ./reflect >flect 2>&1
7401         if $contains "/dev/fd" flect >/dev/null; then
7402                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7403                 val="$define"
7404         else
7405                 $cat <<EOM
7406 If you are not sure if they are secure, I can check but I'll need a
7407 username and password different from the one you are using right now.
7408 If you don't have such a username or don't want me to test, simply
7409 enter 'none'.
7410
7411 EOM
7412                 rp='Other username to test security of setuid scripts with?'
7413                 dflt='none'
7414                 . ./myread
7415                 case "$ans" in
7416                 n|none)
7417                         case "$d_suidsafe" in
7418                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7419                                 dflt=n;;
7420                         "$undef")
7421                                 echo "Well, the $hint value is *not* secure." >&4
7422                                 dflt=n;;
7423                         *)      echo "Well, the $hint value *is* secure." >&4
7424                                 dflt=y;;
7425                         esac
7426                         ;;
7427                 *)
7428                         $rm -f reflect flect
7429                         echo "#!$ls" >reflect
7430                         chmod +x,u+s reflect
7431                         echo >flect
7432                         chmod a+w flect
7433                         echo '"su" will (probably) prompt you for '"$ans's password."
7434                         su $ans -c './reflect >flect'
7435                         if $contains "/dev/fd" flect >/dev/null; then
7436                                 echo "Okay, it looks like setuid scripts are secure." >&4
7437                                 dflt=y
7438                         else
7439                                 echo "I don't think setuid scripts are secure." >&4
7440                                 dflt=n
7441                         fi
7442                         ;;
7443                 esac
7444                 rp='Does your kernel have *secure* setuid scripts?'
7445                 . ./myread
7446                 case "$ans" in
7447                 [yY]*)  val="$define";;
7448                 *)      val="$undef";;
7449                 esac
7450         fi
7451 else
7452         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7453         echo "(That's for file descriptors, not floppy disks.)"
7454         val="$undef"
7455 fi
7456 set d_suidsafe
7457 eval $setvar
7458
7459 $rm -f reflect flect
7460
7461 : now see if they want to do setuid emulation
7462 if $test $patchlevel -lt 11; then
7463 echo " "
7464 val="$undef"
7465 case "$d_suidsafe" in
7466 "$define")
7467         val="$undef"
7468         echo "No need to emulate SUID scripts since they are secure here." >&4
7469         ;;
7470 *)
7471         $cat <<EOM
7472 Some systems have disabled setuid scripts, especially systems where
7473 setuid scripts cannot be secure.  On systems where setuid scripts have
7474 been disabled, the setuid/setgid bits on scripts are currently
7475 useless.  It is possible for $package to detect those bits and emulate
7476 setuid/setgid in a secure fashion.  This emulation will only work if
7477 setuid scripts have been disabled in your kernel.
7478
7479 EOM
7480         case "$d_dosuid" in
7481         "$define") dflt=y ;;
7482         *) dflt=n ;;
7483         esac
7484         rp="Do you want to do setuid/setgid emulation?"
7485         . ./myread
7486         case "$ans" in
7487         [yY]*)  val="$define";;
7488         *)      val="$undef";;
7489         esac
7490         ;;
7491 esac
7492 set d_dosuid
7493 eval $setvar
7494 else
7495     case "$d_dosuid" in
7496         "$define")
7497         cat >&4 <<EOH
7498
7499 SUID emulation has been removed for 5.12
7500 Please re-run Configure without -Dd_dosuid
7501
7502 EOH
7503         exit 1;
7504         ;;
7505     esac
7506     d_dosuid=undef
7507 fi
7508
7509 : Find perl5.005 or later.
7510 echo "Looking for a previously installed perl5.005 or later... "
7511 case "$perl5" in
7512 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7513                 : Check if this perl is recent and can load a simple module
7514                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7515                         perl5=$tdir/perl
7516                         break;
7517                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7518                         perl5=$tdir/perl5
7519                         break;
7520                 fi
7521         done
7522         ;;
7523 *)      perl5="$perl5"
7524         ;;
7525 esac
7526 case "$perl5" in
7527 '')     echo "None found.  That's ok.";;
7528 *)      echo "Using $perl5." ;;
7529 esac
7530
7531 : Set the siteprefix variables
7532 $cat <<EOM
7533
7534 After $package is installed, you may wish to install various
7535 add-on modules and utilities.  Typically, these add-ons will
7536 be installed under $prefix with the rest
7537 of this package.  However, you may wish to install such add-ons
7538 elsewhere under a different prefix.
7539
7540 If you do not wish to put everything under a single prefix, that's
7541 ok.  You will be prompted for the individual locations; this siteprefix
7542 is only used to suggest the defaults.
7543
7544 The default should be fine for most people.
7545
7546 EOM
7547 fn=d~+
7548 rp='Installation prefix to use for add-on modules and utilities?'
7549 : XXX Here might be another good place for an installstyle setting.
7550 case "$siteprefix" in
7551 '') dflt=$prefix ;;
7552 *)  dflt=$siteprefix ;;
7553 esac
7554 . ./getfile
7555 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7556 oldsiteprefix=''
7557 case "$siteprefix" in
7558 '') ;;
7559 *)      case "$ans" in
7560         "$prefix") ;;
7561         *) oldsiteprefix="$prefix";;
7562         esac
7563         ;;
7564 esac
7565 siteprefix="$ans"
7566 siteprefixexp="$ansexp"
7567
7568 : determine where site specific libraries go.
7569 : Usual default is /usr/local/lib/perl5/site_perl/$version
7570 : The default "style" setting is made in installstyle.U
7571 : XXX No longer works with Prefixit stuff.
7572 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7573 case "$sitelib" in
7574 '') case "$installstyle" in
7575         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7576         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7577         esac
7578         ;;
7579 *)      dflt="$sitelib"
7580         ;;
7581 esac
7582 $cat <<EOM
7583
7584 The installation process will create a directory for
7585 site-specific extensions and modules.  Most users find it convenient
7586 to place all site-specific files in this directory rather than in the
7587 main distribution directory.
7588
7589 EOM
7590 fn=d~+
7591 rp='Pathname for the site-specific library files?'
7592 . ./getfile
7593 prefixvar=sitelib
7594 . ./setprefixvar
7595 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7596
7597 : Determine list of previous versions to include in @INC
7598 $cat > getverlist <<EOPL
7599 #!$perl5 -w
7600 use File::Basename;
7601 \$api_versionstring = "$api_versionstring";
7602 \$version = "$version";
7603 \$stem = "$sitelib_stem";
7604 \$archname = "$archname";
7605 EOPL
7606         $cat >> getverlist <<'EOPL'
7607 # The list found is store twice for each entry: the original name, and
7608 # the binary broken down version as pack "sss", so sorting is easy and
7609 # unambiguous. This will work for all versions that have a maximum of
7610 # three digit groups, separate by '.'s or '_'s. Names are extended with
7611 # ".0.0" to ensure at least three elements for the pack.
7612 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7613
7614 # Can't have leading @ because metaconfig interprets it as a command!
7615 ;@inc_version_list=();
7616 # XXX Redo to do opendir/readdir?
7617 if (-d $stem) {
7618     chdir($stem);
7619     ;@candidates = map {
7620         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7621     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7622 }
7623 else {
7624     ;@candidates = ();
7625 }
7626
7627 ($pversion, $aversion, $vsn5005) = map {
7628     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7629 foreach $d (@candidates) {
7630     if ($d->[1] lt $pversion) {
7631         if ($d->[1] ge $aversion) {
7632             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7633         }
7634         elsif ($d->[1] ge $vsn5005) {
7635             unshift(@inc_version_list, grep { -d } $d->[0]);
7636         }
7637     }
7638     else {
7639         # Skip newer version.  I.e. don't look in
7640         # 5.7.0 if we're installing 5.6.1.
7641     }
7642 }
7643
7644 if (@inc_version_list) {
7645     print join(' ', @inc_version_list);
7646 }
7647 else {
7648     # Blank space to preserve value for next Configure run.
7649     print " ";
7650 }
7651 EOPL
7652 chmod +x getverlist
7653 case "$inc_version_list" in
7654 '')     if test -x "$perl5$exe_ext"; then
7655                 dflt=`$perl5 getverlist`
7656         else
7657                 dflt='none'
7658         fi
7659         ;;
7660 $undef) dflt='none' ;;
7661 *)  eval dflt=\"$inc_version_list\" ;;
7662 esac
7663 case "$dflt" in
7664 ''|' ') dflt=none ;;
7665 esac
7666 case "$dflt" in
7667 5.005) dflt=none ;;
7668 esac
7669 $cat <<EOM
7670
7671 In order to ease the process of upgrading, this version of perl
7672 can be configured to use modules built and installed with earlier
7673 versions of perl that were installed under $prefix.  Specify here
7674 the list of earlier versions that this version of perl should check.
7675 If Configure detected no earlier versions of perl installed under
7676 $prefix, then the list will be empty.  Answer 'none' to tell perl
7677 to not search earlier versions.
7678
7679 The default should almost always be sensible, so if you're not sure,
7680 just accept the default.
7681 EOM
7682
7683 rp='List of earlier versions to include in @INC?'
7684 . ./myread
7685 case "$ans" in
7686 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7687 *) inc_version_list="$ans" ;;
7688 esac
7689 case "$inc_version_list" in
7690 ''|' ')
7691         inc_version_list_init='0'
7692         d_inc_version_list="$undef"
7693         ;;
7694 *)      inc_version_list_init=`echo $inc_version_list |
7695                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7696         d_inc_version_list="$define"
7697         ;;
7698 esac
7699 $rm -f getverlist
7700
7701 : see if malloc/malloc.h has to be included
7702 set malloc/malloc.h i_mallocmalloc
7703 eval $inhdr
7704
7705 : see if this is a malloc.h system
7706 : we want a real compile instead of Inhdr because some systems have a
7707 : malloc.h that just gives a compile error saying to use stdlib.h instead
7708 echo " "
7709 $cat >try.c <<EOCP
7710 #include <stdlib.h>
7711 #include <malloc.h>
7712 #$i_mallocmalloc I_MALLOCMALLOC
7713 #ifdef I_MALLOCMALLOC
7714 # include <malloc/malloc.h>
7715 #endif
7716
7717 int main () { return 0; }
7718 EOCP
7719 set try
7720 if eval $compile; then
7721     echo "<malloc.h> found." >&4
7722     val="$define"
7723 else
7724     echo "<malloc.h> NOT found." >&4
7725     val="$undef"
7726 fi
7727 $rm_try
7728 set i_malloc
7729 eval $setvar
7730
7731 : check for length of pointer
7732 echo " "
7733 case "$ptrsize" in
7734 '')
7735         echo "Checking to see how big your pointers are..." >&4
7736         $cat >try.c <<EOCP
7737 #include <stdio.h>
7738 #$i_stdlib I_STDLIB
7739 #ifdef I_STDLIB
7740 #include <stdlib.h>
7741 #endif
7742 int main()
7743 {
7744     printf("%d\n", (int)sizeof(void *));
7745     exit(0);
7746 }
7747 EOCP
7748         set try
7749         if eval $compile_ok; then
7750                 ptrsize=`$run ./try`
7751                 echo "Your pointers are $ptrsize bytes long."
7752         else
7753                 dflt='4'
7754                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7755                 rp="What is the size of a pointer (in bytes)?"
7756                 . ./myread
7757                 ptrsize="$ans"
7758         fi
7759         ;;
7760 esac
7761 $rm_try
7762 case "$use64bitall" in
7763 "$define"|true|[yY]*)
7764         case "$ptrsize" in
7765         4)      cat <<EOM >&4
7766
7767 *** You have chosen a maximally 64-bit build,
7768 *** but your pointers are only 4 bytes wide.
7769 *** Please rerun Configure without -Duse64bitall.
7770 EOM
7771                 case "$d_quad" in
7772                 define)
7773                         cat <<EOM >&4
7774 *** Since you have quads, you could possibly try with -Duse64bitint.
7775 EOM
7776                         ;;
7777                 esac
7778                 cat <<EOM >&4
7779 *** Cannot continue, aborting.
7780
7781 EOM
7782
7783                 exit 1
7784                 ;;
7785         esac
7786         ;;
7787 esac
7788
7789
7790 : determine whether to use malloc wrapping
7791 echo " "
7792 case "$usemallocwrap" in
7793 [yY]*|true|$define)     dflt='y' ;;
7794 [nN]*|false|$undef)     dflt='n' ;;
7795 *)      case "$usedevel" in
7796         [yY]*|true|$define)     dflt='y' ;;
7797         *) dflt='n' ;;
7798         esac
7799         ;;
7800 esac
7801 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7802 . ./myread
7803 usemallocwrap="$ans"
7804 case "$ans" in
7805 y*|true)
7806         usemallocwrap="$define" ;;
7807 *)
7808         usemallocwrap="$undef" ;;
7809 esac
7810
7811 : determine which malloc to compile in
7812 echo " "
7813 case "$usemymalloc" in
7814 [yY]*|true|$define)     dflt='y' ;;
7815 [nN]*|false|$undef)     dflt='n' ;;
7816 *)      case "$ptrsize" in
7817         4) dflt='y' ;;
7818         *) dflt='n' ;;
7819         esac
7820         if test "$useithreads" = "$define"; then dflt='n'; fi
7821         ;;
7822 esac
7823 rp="Do you wish to attempt to use the malloc that comes with $package?"
7824 . ./myread
7825 usemymalloc="$ans"
7826 case "$ans" in
7827 y*|true)
7828         usemymalloc='y'
7829         mallocsrc='malloc.c'
7830         mallocobj="malloc$_o"
7831         d_mymalloc="$define"
7832         case "$libs" in
7833         *-lmalloc*)
7834                 : Remove malloc from list of libraries to use
7835                 echo "Removing unneeded -lmalloc from library list" >&4
7836                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7837                 shift
7838                 libs="$*"
7839                 echo "libs = $libs" >&4
7840                 ;;
7841         esac
7842         ;;
7843 *)
7844         usemymalloc='n'
7845         mallocsrc=''
7846         mallocobj=''
7847         d_mymalloc="$undef"
7848         ;;
7849 esac
7850
7851 : compute the return types of malloc and free
7852 echo " "
7853 $cat >malloc.c <<END
7854 #$i_malloc I_MALLOC
7855 #$i_stdlib I_STDLIB
7856 #include <stdio.h>
7857 #include <sys/types.h>
7858 #ifdef I_MALLOC
7859 #include <malloc.h>
7860 #endif
7861 #ifdef I_STDLIB
7862 #include <stdlib.h>
7863 #endif
7864 #ifdef TRY_MALLOC
7865 void *malloc();
7866 #endif
7867 #ifdef TRY_FREE
7868 void free();
7869 #endif
7870 END
7871 case "$malloctype" in
7872 '')
7873         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7874                 malloctype='void *'
7875         else
7876                 malloctype='char *'
7877         fi
7878         ;;
7879 esac
7880 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7881
7882 case "$freetype" in
7883 '')
7884         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7885                 freetype='void'
7886         else
7887                 freetype='int'
7888         fi
7889         ;;
7890 esac
7891 echo "Your system uses $freetype free(), it would seem." >&4
7892 $rm -f malloc.[co]
7893 : determine where site specific architecture-dependent libraries go.
7894 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7895 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7896 : sitelib may have an optional trailing /share.
7897 case "$sitearch" in
7898 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7899         dflt="$dflt/$archname"
7900         ;;
7901 *)      dflt="$sitearch"
7902         ;;
7903 esac
7904 set sitearch sitearch none
7905 eval $prefixit
7906 $cat <<EOM
7907
7908 The installation process will also create a directory for
7909 architecture-dependent site-specific extensions and modules.
7910
7911 EOM
7912 fn=d~+
7913 rp='Pathname for the site-specific architecture-dependent library files?'
7914 . ./getfile
7915 prefixvar=sitearch
7916 . ./setprefixvar
7917 if $test X"$sitearch" = X"$sitelib"; then
7918         d_sitearch="$undef"
7919 else
7920         d_sitearch="$define"
7921 fi
7922
7923 : Set the vendorprefix variables
7924 $cat <<EOM
7925
7926 The installation process will also create a directory for
7927 vendor-supplied add-ons.  Vendors who supply perl with their system
7928 may find it convenient to place all vendor-supplied files in this
7929 directory rather than in the main distribution directory.  This will
7930 ease upgrades between binary-compatible maintenance versions of perl.
7931
7932 Of course you may also use these directories in whatever way you see
7933 fit.  For example, you might use them to access modules shared over a
7934 company-wide network.
7935
7936 The default answer should be fine for most people.
7937 This causes further questions about vendor add-ons to be skipped
7938 and no vendor-specific directories will be configured for perl.
7939
7940 EOM
7941 rp='Do you want to configure vendor-specific add-on directories?'
7942 case "$usevendorprefix" in
7943 define|true|[yY]*) dflt=y ;;
7944 *)      : User may have set vendorprefix directly on Configure command line.
7945         case "$vendorprefix" in
7946         ''|' ') dflt=n ;;
7947         *)      dflt=y ;;
7948         esac
7949         ;;
7950 esac
7951 . ./myread
7952 case "$ans" in
7953 [yY]*)  fn=d~+
7954         rp='Installation prefix to use for vendor-supplied add-ons?'
7955         case "$vendorprefix" in
7956         '') dflt="$prefix" ;;
7957         *)  dflt=$vendorprefix ;;
7958         esac
7959         . ./getfile
7960         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7961         oldvendorprefix=''
7962         case "$vendorprefix" in
7963         '') ;;
7964         *)      case "$ans" in
7965                 "$prefix") ;;
7966                 *) oldvendorprefix="$prefix";;
7967                 esac
7968                 ;;
7969         esac
7970         usevendorprefix="$define"
7971         vendorprefix="$ans"
7972         vendorprefixexp="$ansexp"
7973         ;;
7974 *)      usevendorprefix="$undef"
7975         vendorprefix=''
7976         vendorprefixexp=''
7977         ;;
7978 esac
7979
7980 : Set the vendorlib variables
7981 case "$vendorprefix" in
7982 '')     d_vendorlib="$undef"
7983         vendorlib=''
7984         vendorlibexp=''
7985         ;;
7986 *)      d_vendorlib="$define"
7987         : determine where vendor-supplied modules go.
7988         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7989         case "$vendorlib" in
7990         '')
7991                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7992                 case "$installstyle" in
7993                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7994                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7995                 esac
7996                 ;;
7997         *)      dflt="$vendorlib"
7998                 ;;
7999         esac
8000         fn=d~+
8001         rp='Pathname for the vendor-supplied library files?'
8002         . ./getfile
8003         vendorlib="$ans"
8004         vendorlibexp="$ansexp"
8005         ;;
8006 esac
8007 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
8008 prefixvar=vendorlib
8009 . ./installprefix
8010
8011 : Set the vendorarch variables
8012 case "$vendorprefix" in
8013 '')     d_vendorarch="$undef"
8014         vendorarch=''
8015         vendorarchexp=''
8016         ;;
8017 *)      d_vendorarch="$define"
8018         : determine where vendor-supplied architecture-dependent libraries go.
8019         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
8020         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
8021         : vendorlib may have an optional trailing /share.
8022         case "$vendorarch" in
8023         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
8024                 dflt="$dflt/$archname"
8025                 ;;
8026         *)      dflt="$vendorarch" ;;
8027         esac
8028         fn=d~+
8029         rp='Pathname for vendor-supplied architecture-dependent files?'
8030         . ./getfile
8031         vendorarch="$ans"
8032         vendorarchexp="$ansexp"
8033         ;;
8034 esac
8035 prefixvar=vendorarch
8036 . ./installprefix
8037 if $test X"$vendorarch" = X"$vendorlib"; then
8038         d_vendorarch="$undef"
8039 else
8040         d_vendorarch="$define"
8041 fi
8042
8043 : Final catch-all directories to search
8044 $cat <<EOM
8045
8046 Lastly, you can have perl look in other directories for extensions and
8047 modules in addition to those already specified.
8048 These directories will be searched after
8049         $sitearch
8050         $sitelib
8051 EOM
8052 test X"$vendorlib" != "X" && echo '     ' $vendorlib
8053 test X"$vendorarch" != "X" && echo '    ' $vendorarch
8054 echo ' '
8055 case "$otherlibdirs" in
8056 ''|' ') dflt='none' ;;
8057 *)      dflt="$otherlibdirs" ;;
8058 esac
8059 $cat <<EOM
8060 Enter a colon-separated set of extra paths to include in perl's @INC
8061 search path, or enter 'none' for no extra paths.
8062
8063 EOM
8064
8065 rp='Colon-separated list of additional directories for perl to search?'
8066 . ./myread
8067 case "$ans" in
8068 ' '|''|none)    otherlibdirs=' ' ;;
8069 *)      otherlibdirs="$ans" ;;
8070 esac
8071 case "$otherlibdirs" in
8072 ' ') val=$undef ;;
8073 *)      val=$define ;;
8074 esac
8075 set d_perl_otherlibdirs
8076 eval $setvar
8077
8078 : Cruising for prototypes
8079 echo " "
8080 echo "Checking out function prototypes..." >&4
8081 $cat >prototype.c <<EOCP
8082 #$i_stdlib I_STDLIB
8083 #ifdef I_STDLIB
8084 #include <stdlib.h>
8085 #endif
8086 int main(int argc, char *argv[]) {
8087         exit(0);}
8088 EOCP
8089 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
8090         echo "Your C compiler appears to support function prototypes."
8091         val="$define"
8092 else
8093         echo "Your C compiler doesn't seem to understand function prototypes."
8094         val="$undef"
8095 fi
8096 set prototype
8097 eval $setvar
8098 $rm -f prototype*
8099
8100 : Check if ansi2knr is required
8101 case "$prototype" in
8102 "$define") ;;
8103 *)      ansi2knr='ansi2knr'
8104         echo " "
8105         cat <<EOM >&4
8106
8107 $me:  FATAL ERROR:
8108 This version of $package can only be compiled by a compiler that
8109 understands function prototypes.  Unfortunately, your C compiler
8110         $cc $ccflags
8111 doesn't seem to understand them.  Sorry about that.
8112
8113 If GNU cc is available for your system, perhaps you could try that instead.
8114
8115 Eventually, we hope to support building Perl with pre-ANSI compilers.
8116 If you would like to help in that effort, please contact <perlbug@perl.org>.
8117
8118 Aborting Configure now.
8119 EOM
8120         exit 2
8121         ;;
8122 esac
8123
8124 : DTrace support
8125 dflt_dtrace='/usr/sbin/dtrace'
8126 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8127
8128 cat <<EOM
8129
8130 Perl can be built to support DTrace on platforms that support it.
8131 DTrace is a diagnosis and performance analysis tool from Sun.
8132
8133 If this doesn't make any sense to you, just accept the default.
8134 EOM
8135
8136 while $test 1 ; do
8137         case "$usedtrace" in
8138         $define|true|[yY]*)
8139                 dflt='y'
8140                 ;;
8141         ?*)
8142                 dflt='y'
8143                 dflt_dtrace=$usedtrace
8144                 ;;
8145         *)
8146                 dflt='n'
8147                 ;;
8148         esac
8149
8150         rp='Support DTrace if available?'
8151         . ./myread
8152         case "$ans" in
8153         y|Y)    val="$define" ;;
8154         *)      val="$undef" ;;
8155         esac
8156         set usedtrace
8157         eval $setvar
8158
8159         test "X$usedtrace" != "X$define" && break
8160
8161         echo " "
8162         rp='Where is the dtrace executable?'
8163         dflt=$dflt_dtrace
8164         . ./getfile
8165         val="$ans"
8166         set dtrace
8167         eval $setvar
8168
8169         if $test -f $dtrace
8170         then
8171                 if $dtrace -h -s ../perldtrace.d \
8172                         -o perldtrace.tmp >/dev/null 2>&1 \
8173                         && rm -f perldtrace.tmp
8174                 then
8175                         echo " "
8176                         echo "Good: your $dtrace knows about the -h flag."
8177                 else
8178                         cat >&2 <<EOM
8179
8180 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8181 ***
8182 *** Your installed dtrace doesn't support the -h switch to compile a D
8183 *** program into a C header. Can't continue.
8184
8185 EOM
8186                         exit 1
8187                 fi
8188                 break;
8189         fi
8190
8191         case "$fastread" in
8192         yes)
8193                 cat >&2 <<EOM
8194
8195 *** $me:  Fatal Error:  $dtrace not found.
8196 *** Can't continue.
8197
8198 EOM
8199                 exit 1
8200                 ;;
8201         *)
8202                 echo "*** $dtrace was not found."
8203                 echo " "
8204                 ;;
8205         esac
8206 done
8207
8208 : See if we want extra modules installed
8209 echo " "
8210 case "$extras" in
8211 '') dflt='n';;
8212 *) dflt='y';;
8213 esac
8214 cat <<EOM
8215 Perl can be built with extra modules or bundles of modules which
8216 will be fetched from the CPAN and installed alongside Perl.
8217
8218 Notice that you will need access to the CPAN; either via the Internet,
8219 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8220 be asked later to configure the CPAN.pm module which will in turn do
8221 the installation of the rest of the extra modules or bundles.)
8222
8223 Notice also that if the modules require any external software such as
8224 libraries and headers (the libz library and the zlib.h header for the
8225 Compress::Zlib module, for example) you MUST have any such software
8226 already installed, this configuration process will NOT install such
8227 things for you.
8228
8229 If this doesn't make any sense to you, just accept the default '$dflt'.
8230 EOM
8231 rp='Install any extra modules (y or n)?'
8232 . ./myread
8233 case "$ans" in
8234 y|Y)
8235         cat <<EOM
8236
8237 Please list any extra modules or bundles to be installed from CPAN,
8238 with spaces between the names.  The names can be in any format the
8239 'install' command of CPAN.pm will understand.  (Answer 'none',
8240 without the quotes, to install no extra modules or bundles.)
8241 EOM
8242         rp='Extras?'
8243         dflt="$extras"
8244         . ./myread
8245         extras="$ans"
8246 esac
8247 case "$extras" in
8248 ''|'none')
8249         val=''
8250         $rm -f ../extras.lst
8251         ;;
8252 *)      echo "(Saving the list of extras for later...)"
8253         echo "$extras" > ../extras.lst
8254         val="'$extras'"
8255         ;;
8256 esac
8257 set extras
8258 eval $setvar
8259 echo " "
8260
8261 : determine where html pages for programs go
8262 set html1dir html1dir none
8263 eval $prefixit
8264 $cat <<EOM
8265
8266 If you wish to install html files for programs in $spackage, indicate
8267 the appropriate directory here.  To skip installing html files,
8268 answer "none".
8269 EOM
8270 case "$html1dir" in
8271 ''|none|$undef|' ') dflt=none ;;
8272 *) dflt=$html1dir ;;
8273 esac
8274 fn=dn+~
8275 rp="Directory for the main $spackage html pages?"
8276 . ./getfile
8277 prefixvar=html1dir
8278 . ./setprefixvar
8279 : Use ' ' for none so value is preserved next time through Configure
8280 $test X"$html1dir" = "X" && html1dir=' '
8281
8282 : determine where html pages for libraries and modules go
8283 set html3dir html3dir none
8284 eval $prefixit
8285 $cat <<EOM
8286
8287 If you wish to install html files for modules associated with $spackage,
8288 indicate the appropriate directory here.  To skip installing html files,
8289 answer "none".
8290 EOM
8291 : There is no obvious default.  If they have specified html1dir, then
8292 : try to key off that, possibly changing .../html1 into .../html3.
8293 case "$html3dir" in
8294 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8295 *) dflt=$html3dir ;;
8296 esac
8297 fn=dn+~
8298 rp="Directory for the $spackage module html pages?"
8299 . ./getfile
8300 prefixvar=html3dir
8301 . ./setprefixvar
8302 : Use ' ' for none so value is preserved next time through Configure
8303 $test X"$html3dir" = "X" && html3dir=' '
8304
8305 : determine whether to install perl also as /usr/bin/perl
8306
8307 echo " "
8308 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8309         $cat <<EOM
8310 Many scripts expect perl to be installed as /usr/bin/perl.
8311
8312 If you want to, I can install the perl you are about to compile
8313 as /usr/bin/perl (in addition to $bin/perl).
8314 EOM
8315         if test -f /usr/bin/perl; then
8316             $cat <<EOM
8317
8318 However, please note that because you already have a /usr/bin/perl,
8319 overwriting that with a new Perl would very probably cause problems.
8320 Therefore I'm assuming you don't want to do that (unless you insist).
8321
8322 EOM
8323             case "$installusrbinperl" in
8324             "$define"|[yY]*)    dflt='y';;
8325             *)                  dflt='n';;
8326             esac
8327         else
8328             $cat <<EOM
8329
8330 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8331
8332 EOM
8333             case "$installusrbinperl" in
8334             "$undef"|[nN]*)     dflt='n';;
8335             *)                  dflt='y';;
8336             esac
8337         fi
8338         rp="Do you want to install perl as /usr/bin/perl?"
8339         . ./myread
8340         case "$ans" in
8341         [yY]*)  val="$define";;
8342         *)      val="$undef" ;;
8343         esac
8344 else
8345         val="$undef"
8346 fi
8347 set installusrbinperl
8348 eval $setvar
8349
8350 : see if dlopen exists
8351 xxx_runnm="$runnm"
8352 xxx_ccflags="$ccflags"
8353 runnm=false
8354 : with g++ one needs -shared to get is-in-libc to work for dlopen
8355 case "$gccversion" in
8356 '')     ;;
8357 *Clang*)        ;;
8358 *)      case "$d_cplusplus" in
8359         "$define") ccflags="$ccflags -shared" ;;
8360         esac
8361         ;;
8362 esac
8363 set dlopen d_dlopen
8364 eval $inlibc
8365 runnm="$xxx_runnm"
8366 ccflags="$xxx_ccflags"
8367
8368 : see if this is a unistd.h system
8369 set unistd.h i_unistd
8370 eval $inhdr
8371
8372 : determine which dynamic loading, if any, to compile in
8373 echo " "
8374 dldir="ext/DynaLoader"
8375 case "$usedl" in
8376     $define|y|true)
8377         dflt='y'
8378         usedl="$define"
8379         ;;
8380     $undef|n|false)
8381         dflt='n'
8382         usedl="$undef"
8383         ;;
8384     *)
8385         dflt='n'
8386         case "$d_dlopen" in
8387             $define) dflt='y' ;;
8388         esac
8389         : Does a dl_xxx.xs file exist for this operating system
8390         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8391         ;;
8392 esac
8393 rp="Do you wish to use dynamic loading?"
8394 . ./myread
8395 usedl="$ans"
8396 bin_ELF="$undef"
8397 case "$ans" in
8398     y*) usedl="$define"
8399         case "$dlsrc" in
8400             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8401                     dflt="$dldir/dl_${osname}.xs"
8402                 elif $test "$d_dlopen" = "$define" ; then
8403                     dflt="$dldir/dl_dlopen.xs"
8404                 else
8405                     dflt=''
8406                 fi
8407                 ;;
8408             *)  dflt="$dldir/$dlsrc"
8409                 ;;
8410         esac
8411         echo "The following dynamic loading files are available:"
8412         : Can not go over to $dldir because getfile has path hard-coded in.
8413         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8414         rp="Source file to use for dynamic loading"
8415         fn="fne"
8416         gfpth="$src"
8417         . ./getfile
8418         usedl="$define"
8419         : emulate basename
8420         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8421
8422         $cat << EOM
8423
8424 Some systems may require passing special flags to $cc -c to
8425 compile modules that will be used to create a shared library.
8426 To use no flags, say "none".
8427
8428 EOM
8429         case "$cccdlflags" in
8430             '') case "$gccversion" in
8431                 '') case "$osname" in
8432                         hpux)   dflt='+z' ;;
8433                         irix*)  dflt='-KPIC' ;;
8434                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8435                         sunos)  dflt='-pic' ;;
8436                         *)      dflt='none' ;;
8437                     esac
8438                     ;;
8439                 *)  case "$osname" in
8440                         darwin) dflt='none' ;;
8441                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8442                         *)      dflt='-fpic' ;;
8443                     esac ;;
8444                 esac ;;
8445             ' ') dflt='none' ;;
8446             *)   dflt="$cccdlflags" ;;
8447         esac
8448
8449         case "$dflt" in
8450             none) dflt='' ;;
8451         esac
8452
8453         # If -Dsysroot was specified, now's the time to add it
8454         # to cccdlflags
8455         if test "X$sysroot" != X; then
8456             case "$gccversion" in
8457                 '') ;;
8458                 *)  case "$dflt" in
8459                         *sysroot*) ;;
8460                         'undef'|*)
8461                             dflt="$dflt --sysroot=$sysroot" ;;
8462                     esac
8463                     ;;
8464             esac
8465         fi
8466
8467         case "$dflt" in
8468             '') dflt='none';;
8469         esac
8470
8471         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8472         . ./myread
8473         case "$ans" in
8474             none) cccdlflags=' ' ;;
8475             *)    cccdlflags="$ans" ;;
8476         esac
8477
8478         cat << EOM
8479
8480 Some systems use ld to create libraries that can be dynamically loaded,
8481 while other systems (such as those using ELF) use $cc.
8482
8483 EOM
8484
8485 : Determine if this is ELF
8486         $cat >try.c <<EOM
8487 /* Test for whether ELF binaries are produced */
8488 #include <fcntl.h>
8489 #$i_stdlib I_STDLIB
8490 #ifdef I_STDLIB
8491 #include <stdlib.h>
8492 #endif
8493 #$i_unistd I_UNISTD
8494 #ifdef I_UNISTD
8495 #include <unistd.h>
8496 #endif
8497 int main() {
8498     char b[4];
8499     int i = open("a.out",O_RDONLY);
8500     if(i == -1)
8501         exit(1); /* fail */
8502     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8503         exit(0); /* succeed (yes, it is ELF) */
8504     exit(1); /* fail */
8505 }
8506 EOM
8507         if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8508             bin_ELF="$define"
8509         fi
8510         $rm_try
8511
8512         case "$ld" in
8513             '') if $test $bin_ELF = "$define"; then
8514                     cat <<EOM
8515 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8516 EOM
8517                     dflt="$cc"
8518                 else
8519                     echo "I'll use ld to build dynamic libraries."
8520                     dflt='ld'
8521                 fi
8522                 ;;
8523             *)  dflt="$ld"
8524                 ;;
8525         esac
8526
8527         rp="What command should be used to create dynamic libraries?"
8528         . ./myread
8529         ld="$ans"
8530
8531         cat << EOM
8532
8533 Some systems may require passing special flags to $ld to create a
8534 library that can be dynamically loaded.  If your ld flags include
8535 -L/other/path options to locate libraries outside your loader's normal
8536 search path, you may need to specify those -L options here as well.  To
8537 use no flags, say "none".
8538
8539 EOM
8540         case "$lddlflags" in
8541             '') case "$osname" in
8542                     haiku) dflt='-shared' ;;
8543                     hpux) dflt='-b';
8544                           case "$gccversion" in
8545                               '') dflt="$dflt +vnocompatwarnings" ;;
8546                           esac
8547                           ;;
8548                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8549                     solaris) # See [perl #66604].
8550                             # On Solaris 11, gcc -m64 on amd64
8551                             # appears not to understand -G.  gcc versions at
8552                             # least as old as 3.4.3 support -shared, so just
8553                             # use that with Solaris 11 and later, but keep
8554                             # the old behavior for older Solaris versions.
8555                             case "$gccversion" in
8556                                 '') dflt='-G' ;;
8557                                 *)  case "$osvers" in
8558                                         2.?|2.10) dflt='-G' ;;
8559                                         *) dflt='-shared' ;;
8560                                     esac
8561                                     ;;
8562                             esac
8563                             ;;
8564                     sunos) dflt='-assert nodefinitions' ;;
8565                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8566                     *)     dflt='none' ;;
8567                 esac
8568                 ;;
8569             *) dflt="$lddlflags" ;;
8570         esac
8571
8572         : Only do this for gcc, since, for example, qcc has no concept
8573         : of --sysroot.
8574         if $test "X$sysroot" != X; then
8575             case "$gccversion" in
8576                 '') ;;
8577                 *)  dflt="$dflt --sysroot $sysroot" ;;
8578             esac
8579         fi
8580
8581         : Try to guess additional flags to pick up local libraries.
8582         : Be careful not to append to a plain 'none'
8583         case "$dflt" in
8584             none) dflt='' ;;
8585         esac
8586         for thisflag in $ldflags; do
8587             case "$thisflag" in
8588                 -L*|-R*|-Wl,-R*)
8589                     case " $dflt " in
8590                         *" $thisflag "*) ;;
8591                         *) dflt="$dflt $thisflag" ;;
8592                     esac
8593                     ;;
8594             esac
8595         done
8596
8597         case "$dflt" in
8598             ''|' ') dflt='none' ;;
8599         esac
8600
8601         case "$ldflags" in
8602             *-fstack-protector-strong*)
8603                 case "$dflt" in
8604                     *-fstack-protector-strong*) ;; # Don't add it again
8605                     *) dflt="$dflt -fstack-protector-strong" ;;
8606                 esac
8607                 ;;
8608             *-fstack-protector*)
8609                 case "$dflt" in
8610                     *-fstack-protector*) ;; # Don't add it again
8611                     *) dflt="$dflt -fstack-protector" ;;
8612                 esac
8613                 ;;
8614         esac
8615
8616         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8617         . ./myread
8618         case "$ans" in
8619             none) lddlflags=' ' ;;
8620             *) lddlflags="$ans" ;;
8621         esac
8622
8623         cat <<EOM
8624
8625 Some systems may require passing special flags to $cc to indicate that
8626 the resulting executable will use dynamic linking.  To use no flags,
8627 say "none".
8628
8629 EOM
8630         case "$ccdlflags" in
8631             '') case "$osname" in
8632                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8633                     sunos)             dflt='none'   ;;
8634                     *)                 dflt='none'   ;;
8635                 esac ;;
8636             ' ') dflt='none' ;;
8637             *)   dflt="$ccdlflags" ;;
8638         esac
8639         rp="Any special flags to pass to $cc to use dynamic linking?"
8640         . ./myread
8641         case "$ans" in
8642             none) ccdlflags=' ' ;;
8643             *)    ccdlflags="$ans" ;;
8644         esac
8645         ;;
8646
8647     *)  usedl="$undef"
8648         ld='ld'
8649         dlsrc='dl_none.xs'
8650         lddlflags=''
8651         ccdlflags=''
8652         ;;
8653 esac
8654
8655 ld_can_script="$undef"
8656 case "$bin_ELF$usedl" in
8657     $define$define)
8658         # Abuse try.h and a.out names for neat cleanup
8659         $cat >try.c <<EOM
8660 void foo() {}
8661 void bar() {}
8662 EOM
8663         $cat >try.h <<EOM
8664 LIBTEST_42 {
8665  global:
8666   foo;
8667  local: *;
8668  };
8669 EOM
8670         if $cc $cccdlflags $ccdlflags $ccflags \
8671                $ldflags $lddlflags -o a.out try.c \
8672                -Wl,--version-script=try.h >/dev/null 2>&1 \
8673            &&  $test -s a.out ; then
8674             echo "ld supports scripting" >&4
8675             ld_can_script="$define"
8676         else
8677             echo "ld does not support scripting" >&4
8678         fi
8679         $rm_try
8680         ;;
8681 esac
8682
8683 : Do we want a shared libperl?
8684 also=''
8685 case "$usedl" in
8686 $undef)
8687         # No dynamic loading being used, so don't bother even to prompt.
8688         useshrplib='false'
8689         ;;
8690 *)      case "$useshrplib" in
8691         '')     case "$osname" in
8692                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8693                         dflt=y
8694                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8695                         ;;
8696                 *)      dflt=n
8697                         ;;
8698                 esac
8699                 ;;
8700         $define|true|[Yy]*)
8701                 dflt=y
8702                 ;;
8703         *)      dflt=n
8704                 ;;
8705         esac
8706         $cat << EOM
8707
8708 The perl executable is normally obtained by linking perlmain.c with
8709 libperl${_a}, any static extensions (usually just DynaLoader), and
8710 any other libraries needed on this system (such as -lm, etc.).  Since
8711 your system supports dynamic loading, it is probably possible to build
8712 a shared libperl.$so.  If you will have more than one executable linked
8713 to libperl.$so, this will significantly reduce the size of each
8714 executable, but it may have a noticeable effect on performance.  The
8715 default is probably sensible for your system.
8716 $also
8717
8718 EOM
8719         rp="Build a shared libperl.$so (y/n)"
8720         . ./myread
8721         case "$ans" in
8722         true|$define|[Yy]*)
8723                 useshrplib='true'  ;;
8724         *)      useshrplib='false' ;;
8725         esac
8726         ;;
8727 esac
8728
8729 case "$useshrplib" in
8730 true)
8731         case "$userelocatableinc" in
8732         true|define)
8733                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8734                 echo "See INSTALL for an explanation why that won't work." >&4
8735                 exit 4
8736                 ;;
8737         esac
8738         case "$libperl" in
8739         '')
8740                 # Figure out a good name for libperl.so.  Since it gets stored in
8741                 # a version-specific architecture-dependent library, the version
8742                 # number isn't really that important, except for making cc/ld happy.
8743                 #
8744                 # A name such as libperl.so.10.1
8745                 majmin="libperl.$so.$patchlevel.$subversion"
8746                 # A name such as libperl.so.100
8747                 majonly=`echo $patchlevel $subversion |
8748                         $awk '{printf "%d%02d", $1, $2}'`
8749                 majonly=libperl.$so.$majonly
8750                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8751                 # rely on figuring it out from the naming of libc.
8752                 case "${osname}${osvers}" in
8753                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8754                         dflt=libperl.$so
8755                         ;;
8756                 cygwin*) # ld links now against the dll directly
8757                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8758                         majonly=`echo $patchlevel $subversion |
8759                                 $awk '{printf "%03d%03d", $1, $2}'`
8760                         majonly=cygperl5.$majonly.$so
8761                         dflt=$majmin
8762                         ;;
8763                 *)      # Try to guess based on whether libc has major.minor.
8764                         case "$libc" in
8765                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8766                         *libc.$so.[0-9]*) dflt=$majonly ;;
8767                         *)      dflt=libperl.$so ;;
8768                         esac
8769                         ;;
8770                 esac
8771                 ;;
8772         *)      dflt=$libperl
8773                 ;;
8774         esac
8775         cat << EOM
8776
8777 I need to select a good name for the shared libperl.  If your system uses
8778 library names with major and minor numbers, then you might want something
8779 like $majmin.  Alternatively, if your system uses a single version
8780 number for shared libraries, then you might want to use $majonly.
8781 Or, your system might be quite happy with a simple libperl.$so.
8782
8783 Since the shared libperl will get installed into a version-specific
8784 architecture-dependent directory, the version number of the shared perl
8785 library probably isn't important, so the default should be o.k.
8786
8787 EOM
8788         rp='What name do you want to give to the shared libperl?'
8789         . ./myread
8790         libperl=$ans
8791         echo "Ok, I'll use $libperl"
8792         ;;
8793 *)
8794         libperl="libperl${_a}"
8795         ;;
8796 esac
8797
8798 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8799 case "$shrpdir" in
8800 '') ;;
8801 *)      $cat >&4 <<EOM
8802 WARNING:  Use of the shrpdir variable for the installation location of
8803 the shared $libperl is not supported.  It was never documented and
8804 will not work in this version.  Let me (perlbug@perl.org)
8805 know of any problems this may cause.
8806
8807 EOM
8808         case "$shrpdir" in
8809         "$archlibexp/CORE")
8810                 $cat >&4 <<EOM
8811 But your current setting of $shrpdir is
8812 the default anyway, so it's harmless.
8813 EOM
8814                 ;;
8815         *)
8816                 $cat >&4 <<EOM
8817 Further, your current attempted setting of $shrpdir
8818 conflicts with the value of $archlibexp/CORE
8819 that installperl will use.
8820 EOM
8821                 ;;
8822         esac
8823         ;;
8824 esac
8825
8826 # How will the perl executable find the installed shared $libperl?
8827 # Add $xxx to ccdlflags.
8828 # If we can't figure out a command-line option, use $shrpenv to
8829 # set env LD_RUN_PATH.  The main perl makefile uses this.
8830 shrpdir=$archlibexp/CORE
8831 xxx=''
8832 tmp_shrpenv=''
8833 if "$useshrplib"; then
8834     case "$osname" in
8835         aix)
8836                 # We'll set it in Makefile.SH...
8837                 ;;
8838         solaris)
8839                 xxx="-R $shrpdir"
8840                 ;;
8841         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8842                 xxx="-Wl,-R$shrpdir"
8843                 ;;
8844         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8845                 xxx="-Wl,-rpath,$shrpdir"
8846                 ;;
8847         hpux*)
8848                 # hpux doesn't like the default, either.
8849                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8850                 ;;
8851         cygwin)
8852                 # cygwin needs only ldlibpth
8853                 ;;
8854         *)
8855                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8856                 ;;
8857         esac
8858         case "$xxx" in
8859         '') ;;
8860         *)
8861                 # Only add $xxx if it isn't already in ccdlflags.
8862                 case " $ccdlflags " in
8863                 *" $xxx "*)     ;;
8864                 *)      ccdlflags="$ccdlflags $xxx"
8865                         cat <<EOM >&4
8866
8867 Adding $xxx to the flags
8868 passed to $ld so that the perl executable will find the
8869 installed shared $libperl.
8870
8871 EOM
8872                         ;;
8873                 esac
8874                 ;;
8875         esac
8876 fi
8877 # Fix ccdlflags in AIX for building external extensions.
8878 # (For building Perl itself bare -bE:perl.exp is needed,
8879 #  Makefile.SH takes care of this.)
8880 case "$osname" in
8881 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8882 esac
8883 # Respect a hint or command-line value.
8884 case "$shrpenv" in
8885 '') shrpenv="$tmp_shrpenv" ;;
8886 esac
8887 case "$ldlibpthname" in
8888 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8889 none)   ldlibpthname='' ;;
8890 esac
8891
8892 : determine where manual pages are on this system
8893 echo " "
8894 case "$sysman" in
8895 '')
8896         syspath='/usr/share/man/man1 /usr/man/man1'
8897         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8898         syspath="$syspath /usr/man/u_man/man1"
8899         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8900         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8901         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8902         sysman=`./loc . /usr/man/man1 $syspath`
8903         ;;
8904 esac
8905 if $test -d "$sysman"; then
8906         echo "System manual is in $sysman." >&4
8907 else
8908         echo "Could not find manual pages in source form." >&4
8909 fi
8910
8911 : determine where manual pages go
8912 set man1dir man1dir none
8913 eval $prefixit
8914 $cat <<EOM
8915
8916 $spackage has manual pages available in source form.
8917 EOM
8918 case "$nroff" in
8919 nroff)
8920         echo "However, you don't have nroff, so they're probably useless to you."
8921         case "$man1dir" in
8922         '') man1dir="none";;
8923         esac;;
8924 esac
8925 echo "If you don't want the manual sources installed, answer 'none'."
8926 case "$man1dir" in
8927 ' ') dflt=none
8928         ;;
8929 '')
8930         lookpath="$prefixexp/share/man/man1"
8931         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8932         lookpath="$lookpath $prefixexp/man/p_man/man1"
8933         lookpath="$lookpath $prefixexp/man/u_man/man1"
8934         lookpath="$lookpath $prefixexp/man/man.1"
8935         case "$sysman" in
8936         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8937         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8938         esac
8939         set dflt
8940         eval $prefixup
8941         ;;
8942 *)  dflt="$man1dir"
8943         ;;
8944 esac
8945 echo " "
8946 fn=dn+~
8947 rp="Where do the main $spackage manual pages (source) go?"
8948 . ./getfile
8949 if $test "X$man1direxp" != "X$ansexp"; then
8950         installman1dir=''
8951 fi
8952 prefixvar=man1dir
8953 . ./setprefixvar
8954
8955 case "$man1dir" in
8956 '')     man1dir=' '
8957         installman1dir='';;
8958 esac
8959
8960 : What suffix to use on installed man pages
8961
8962 case "$man1dir" in
8963 ' ')
8964         man1ext='0'
8965         ;;
8966 *)
8967         rp="What suffix should be used for the main $spackage man pages?"
8968         case "$man1ext" in
8969         '')     case "$man1dir" in
8970                 *1)  dflt=1 ;;
8971                 *1p) dflt=1p ;;
8972                 *1pm) dflt=1pm ;;
8973                 *l) dflt=l;;
8974                 *n) dflt=n;;
8975                 *o) dflt=o;;
8976                 *p) dflt=p;;
8977                 *C) dflt=C;;
8978                 *L) dflt=L;;
8979                 *L1) dflt=L1;;
8980                 *) dflt=1;;
8981                 esac
8982                 ;;
8983         *)      dflt="$man1ext";;
8984         esac
8985         . ./myread
8986         man1ext="$ans"
8987         ;;
8988 esac
8989
8990 : see if we can have long filenames
8991 echo " "
8992 first=123456789abcdef
8993 $rm -f $first
8994 if (echo hi >$first) 2>/dev/null; then
8995         if $test -f 123456789abcde; then
8996                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8997                 val="$undef"
8998         else
8999                 echo 'You can have filenames longer than 14 characters.'>&4
9000                 val="$define"
9001         fi
9002 else
9003         $cat <<'EOM'
9004 You can't have filenames longer than 14 chars.
9005 You can't even think about them!
9006 EOM
9007         val="$undef"
9008 fi
9009 set d_flexfnam
9010 eval $setvar
9011 $rm -rf 123456789abcde*
9012
9013 : determine where library module manual pages go
9014 set man3dir man3dir none
9015 eval $prefixit
9016 $cat <<EOM
9017
9018 $spackage has manual pages for many of the library modules.
9019 EOM
9020
9021 case "$nroff" in
9022 nroff)
9023         $cat <<'EOM'
9024 However, you don't have nroff, so they're probably useless to you.
9025 EOM
9026         case "$man3dir" in
9027         '') man3dir="none";;
9028         esac;;
9029 esac
9030
9031 case "$d_flexfnam" in
9032 undef)
9033         $cat <<'EOM'
9034 However, your system can't handle the long file names like File::Basename.3.
9035 EOM
9036         case "$man3dir" in
9037         '') man3dir="none";;
9038         esac;;
9039 esac
9040
9041 echo "If you don't want the manual sources installed, answer 'none'."
9042 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9043 case "$man3dir" in
9044 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9045         if $test -d "$privlib/man/man3"; then
9046                 cat <<EOM >&4
9047
9048 WARNING:  Previous versions of perl installed man3 pages into
9049 $privlib/man/man3.  This version will suggest a
9050 new default of $dflt.
9051 EOM
9052                 tdflt=$dflt
9053                 dflt='n'
9054                 rp='Do you wish to preserve the old behavior?(y/n)'
9055                 . ./myread
9056                 case "$ans" in
9057                 y*) dflt="$privlib/man/man3" ;;
9058                 *)  dflt=$tdflt ;;
9059                 esac
9060     fi
9061         ;;
9062 *)      dflt="$man3dir" ;;
9063 esac
9064 case "$dflt" in
9065 ' ') dflt=none ;;
9066 esac
9067 echo " "
9068 fn=dn+~
9069 rp="Where do the $package library man pages (source) go?"
9070 . ./getfile
9071 prefixvar=man3dir
9072 . ./setprefixvar
9073
9074 case "$man3dir" in
9075 '')     man3dir=' '
9076         installman3dir='';;
9077 esac
9078
9079 : What suffix to use on installed man pages
9080 case "$man3dir" in
9081 ' ')
9082         man3ext='0'
9083         ;;
9084 *)
9085         rp="What suffix should be used for the $package library man pages?"
9086         case "$man3ext" in
9087         '')     case "$man3dir" in
9088                 *3)  dflt=3 ;;
9089                 *3p) dflt=3p ;;
9090                 *3pm) dflt=3pm ;;
9091                 *l) dflt=l;;
9092                 *n) dflt=n;;
9093                 *o) dflt=o;;
9094                 *p) dflt=p;;
9095                 *C) dflt=C;;
9096                 *L) dflt=L;;
9097                 *L3) dflt=L3;;
9098                 *) dflt=3;;
9099                 esac
9100                 ;;
9101         *)      dflt="$man3ext";;
9102         esac
9103         . ./myread
9104         man3ext="$ans"
9105         ;;
9106 esac
9107
9108 : see if we have to deal with yellow pages, now NIS.
9109 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9110         case "$hostcat" in
9111         nidump*) ;;
9112         *)
9113                 case "$hostcat" in
9114                 *ypcat*) dflt=y;;
9115                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9116                                 dflt=y
9117                         else
9118                                 dflt=n
9119                         fi;;
9120                 *) dflt=n;;
9121                 esac
9122                 echo " "
9123                 rp='Are you getting the hosts file via yellow pages?'
9124                 . ./myread
9125                 case "$ans" in
9126                 y*) hostcat='ypcat hosts';;
9127                 *) hostcat='cat /etc/hosts';;
9128                 esac
9129                 ;;
9130         esac
9131 fi
9132 case "$hostcat" in
9133 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9134 esac
9135 case "$groupcat" in
9136 '') test -f /etc/group && groupcat='cat /etc/group';;
9137 esac
9138 case "$passcat" in
9139 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9140 esac
9141
9142 : now get the host name
9143 echo " "
9144 echo "Figuring out host name..." >&4
9145 case "$myhostname" in
9146 '') cont=true
9147         echo 'Maybe "hostname" will work...'
9148         if tans=`sh -c hostname 2>&1` ; then
9149                 myhostname=$tans
9150                 phostname=hostname
9151                 cont=''
9152         fi
9153         ;;
9154 *) cont='';;
9155 esac
9156 if $test "$cont"; then
9157         if ./xenix; then
9158                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9159                 if tans=`cat /etc/systemid 2>&1` ; then
9160                         myhostname=$tans
9161                         phostname='cat /etc/systemid'
9162                         echo "Whadyaknow.  Xenix always was a bit strange..."
9163                         cont=''
9164                 fi
9165         elif $test -r /etc/systemid; then
9166                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9167         fi
9168 fi
9169 if $test "$cont"; then
9170         echo 'No, maybe "uuname -l" will work...'
9171         if tans=`sh -c 'uuname -l' 2>&1` ; then
9172                 myhostname=$tans
9173                 phostname='uuname -l'
9174         else
9175                 echo 'Strange.  Maybe "uname -n" will work...'
9176                 if tans=`sh -c 'uname -n' 2>&1` ; then
9177                         myhostname=$tans
9178                         phostname='uname -n'
9179                 else
9180                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9181                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9182                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9183                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9184                         else
9185                                 case "$myhostname" in
9186                                 '') echo "Does this machine have an identity crisis or something?"
9187                                         phostname='';;
9188                                 *)
9189                                         echo "Well, you said $myhostname before..."
9190                                         phostname='echo $myhostname';;
9191                                 esac
9192                         fi
9193                 fi
9194         fi
9195 fi
9196 case "$myhostname" in
9197 '') myhostname=noname ;;
9198 esac
9199 : you do not want to know about this
9200 set $myhostname
9201 myhostname=$1
9202
9203 : verify guess
9204 if $test "$myhostname" ; then
9205         dflt=y
9206         rp='Your host name appears to be "'$myhostname'".'" Right?"
9207         . ./myread
9208         case "$ans" in
9209         y*) ;;
9210         *) myhostname='';;
9211         esac
9212 fi
9213
9214 : bad guess or no guess
9215 while $test "X$myhostname" = X ; do
9216         dflt=''
9217         rp="Please type the (one word) name of your host:"
9218         . ./myread
9219         myhostname="$ans"
9220 done
9221
9222 : translate upper to lower if necessary
9223 case "$myhostname" in
9224 *[A-Z]*)
9225         echo "(Normalizing case in your host name)"
9226         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9227         ;;
9228 esac
9229
9230 case "$myhostname" in
9231 *.*)
9232         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9233         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9234         echo "(Trimming domain name from host name--host name is now $myhostname)"
9235         ;;
9236 *) case "$mydomain" in
9237         '')
9238                 {
9239                         test "X$hostcat" = "Xypcat hosts" &&
9240                         ypmatch "$myhostname" hosts 2>/dev/null |\
9241                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9242                         $test -s hosts
9243                 } || {
9244                         test "X$hostcat" != "X" &&
9245                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9246                                         /[       ]$myhostname[  . ]/p" > hosts
9247                 }
9248                 tmp_re="[       . ]"
9249                 if $test -f hosts; then
9250                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9251                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9252                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9253                                 hosts | $sort | $uniq | \
9254                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9255                         case `$echo X$dflt` in
9256                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9257                                 dflt=.
9258                                 ;;
9259                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9260                                 ;;
9261                         esac
9262                 else
9263                         echo "(I cannot locate a hosts database anywhere)"
9264                         dflt=.
9265                 fi
9266                 case "$dflt" in
9267                 .)
9268                         tans=`./loc resolv.conf X /etc /usr/etc`
9269                         if $test -f "$tans"; then
9270                                 echo "(Attempting domain name extraction from $tans)"
9271                                 dflt=.`$sed -n -e 's/   / /g' \
9272                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9273                                   -e 1q 2>/dev/null`
9274                                 case "$dflt" in
9275                                 .) dflt=.`$sed -n -e 's/        / /g' \
9276                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9277                                      -e 1q 2>/dev/null`
9278                                         ;;
9279                                 esac
9280                         fi
9281                         ;;
9282                 esac
9283                 case "$dflt" in
9284                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9285                         dflt=.`sh -c domainname 2>/dev/null`
9286                         case "$dflt" in
9287                         '') dflt='.';;
9288                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9289                         esac
9290                         ;;
9291                 esac
9292                 case "$dflt$osname" in
9293                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9294                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9295                         ;;
9296                 esac
9297                 case "$dflt" in
9298                 .) echo "(Lost all hope -- silly guess then)"
9299                         dflt='.nonet'
9300                         ;;
9301                 esac
9302                 $rm -f hosts
9303                 ;;
9304         *) dflt="$mydomain";;
9305         esac;;
9306 esac
9307 echo " "
9308 rp="What is your domain name?"
9309 . ./myread
9310 tans="$ans"
9311 case "$ans" in
9312 '') ;;
9313 .*) ;;
9314 *) tans=".$tans";;
9315 esac
9316 mydomain="$tans"
9317
9318 : translate upper to lower if necessary
9319 case "$mydomain" in
9320 *[A-Z]*)
9321         echo "(Normalizing case in your domain name)"
9322         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9323         ;;
9324 esac
9325
9326 : a little sanity check here
9327 case "$phostname" in
9328 '') ;;
9329 *)
9330         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9331         $myhostname$mydomain|$myhostname) ;;
9332         *)
9333                 case "$phostname" in
9334                 sed*)
9335                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9336                         ;;
9337                 *)
9338                         echo "(That doesn't agree with your $phostname command, by the way.)"
9339                         ;;
9340                 esac
9341         ;;
9342         esac
9343         ;;
9344 esac
9345
9346 : determine the e-mail address of the user who is running us
9347 $cat <<EOM
9348
9349 I need to get your e-mail address in Internet format if possible, i.e.
9350 something like user@host.domain. Please answer accurately since I have
9351 no easy means to double check it. The default value provided below
9352 is most probably close to reality but may not be valid from outside
9353 your organization...
9354
9355 EOM
9356 cont=x
9357 while test "$cont"; do
9358         case "$MAILDOMAIN" in
9359         '')
9360                 if $test -s /etc/mailname; then
9361                         maildomain=`$cat /etc/mailname`
9362                 else
9363                         maildomain="$myhostname$mydomain"
9364                 fi
9365                 ;;
9366         *)  maildomain="$MAILDOMAIN";;
9367         esac
9368         case "$cf_email" in
9369         '') dflt="$cf_by@$maildomain";;
9370         *)  dflt="$cf_email";;
9371         esac
9372         rp='What is your e-mail address?'
9373         . ./myread
9374         cf_email="$ans"
9375         case "$cf_email" in
9376         *@*.*) cont='' ;;
9377         *)
9378                 rp='Address does not look like an Internet one.  Use it anyway?'
9379                 case "$fastread" in
9380                 yes) dflt=y ;;
9381                 *) dflt=n ;;
9382                 esac
9383                 . ./myread
9384                 case "$ans" in
9385                 y*) cont='' ;;
9386                 *) echo " " ;;
9387                 esac
9388                 ;;
9389         esac
9390 done
9391
9392 : Ask e-mail of administrator
9393 $cat <<EOM
9394
9395 If you or somebody else will be maintaining perl at your site, please
9396 fill in the correct e-mail address here so that they may be contacted
9397 if necessary. Currently, the "perlbug" program included with perl
9398 will send mail to this address in addition to perlbug@perl.org. You may
9399 enter "none" for no administrator.
9400
9401 EOM
9402 case "$perladmin" in
9403 '') dflt="$cf_email";;
9404 *) dflt="$perladmin";;
9405 esac
9406 rp='Perl administrator e-mail address'
9407 . ./myread
9408 perladmin="$ans"
9409
9410 : determine whether to use a version number suffix for installed binaries
9411 echo " "
9412 $cat <<EOM
9413 Do you want to use a version number suffix for installed binaries? This
9414 will install 'perl$version' instead of 'perl', and likewise for other
9415 binaries like 'perldoc' and 'cpan'. This allows many versions of perl
9416 to be installed side-by-side. Unless you are a developer, you probably
9417 do *not* want to do this.
9418 EOM
9419 case "$versiononly" in
9420 "$define"|[Yy]*|true) dflt='y' ;;
9421 *) dflt='n';
9422 esac
9423 rp="Do you want to use a version number suffix for installed binaries?"
9424 . ./myread
9425 case "$ans" in
9426 [yY]*)  val="$define";;
9427 *)      val="$undef" ;;
9428 esac
9429 set versiononly
9430 eval $setvar
9431
9432 case "$versiononly" in
9433 "$define") inc_version_list=''
9434            inc_version_list_init=0
9435            ;;
9436 esac
9437
9438 : figure out how to guarantee perl startup
9439 : XXX Note that this currently takes advantage of the bug that binexp ignores
9440 :     the Configure -Dinstallprefix setting, which in turn means that under
9441 :     relocatable @INC, initialinstalllocation is what binexp started as.
9442 case "$startperl" in
9443 '')
9444         case "$sharpbang" in
9445         *!)
9446                 $cat <<EOH
9447
9448 I can use the #! construct to start perl on your system. This will
9449 make startup of perl scripts faster, but may cause problems if you
9450 want to share those scripts and perl is not in a standard place
9451 ($initialinstalllocation/perl) on all your platforms. The alternative
9452 is to force a shell by starting the script with a single ':' character.
9453
9454 EOH
9455                 case "$versiononly" in
9456                 "$define")      dflt="$initialinstalllocation/perl$version";;
9457                 *)              dflt="$initialinstalllocation/perl";;
9458                 esac
9459                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9460                 . ./myread
9461                 case "$ans" in
9462                 none)   startperl=": # use perl";;
9463                 *)      startperl="#!$ans"
9464                         if $test 30 -lt `echo "$ans" | wc -c`; then
9465                                 $cat >&4 <<EOM
9466
9467 WARNING:  Some systems limit the #! command to 32 characters.
9468 If you experience difficulty running Perl scripts with #!, try
9469 installing Perl in a directory with a shorter pathname.
9470
9471 EOM
9472                         fi ;;
9473                 esac
9474                 ;;
9475         *) startperl=": # use perl"
9476                 ;;
9477         esac
9478         ;;
9479 esac
9480 echo "I'll use $startperl to start perl scripts."
9481
9482 : figure best path for perl in scripts
9483 case "$perlpath" in
9484 '')
9485         case "$versiononly" in
9486         "$define")      perlpath="$initialinstalllocation/perl$version";;
9487         *)              perlpath="$initialinstalllocation/perl";;
9488         esac
9489         case "$startperl" in
9490         *!*) ;;
9491         *)
9492                 $cat <<EOH
9493
9494 I will use the "eval 'exec'" idiom to start Perl on your system.
9495 I can use the full path of your Perl binary for this purpose, but
9496 doing so may cause problems if you want to share those scripts and
9497 Perl is not always in a standard place ($initialinstalllocation/perl).
9498
9499 EOH
9500                 dflt="$initialinstalllocation/perl"
9501                 rp="What path shall I use in \"eval 'exec'\"?"
9502                 . ./myread
9503                 perlpath="$ans"
9504                 ;;
9505         esac
9506         ;;
9507 esac
9508 case "$startperl" in
9509 *!*)    ;;
9510 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9511 esac
9512
9513 : determine where public executable scripts go
9514 set scriptdir scriptdir
9515 eval $prefixit
9516 case "$scriptdir" in
9517 '')
9518         dflt="$bin"
9519         : guess some guesses
9520         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9521         $test -d /usr/share/bin     && dflt=/usr/share/bin
9522         $test -d /usr/local/script  && dflt=/usr/local/script
9523         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9524         $test -d $prefixexp/script  && dflt=$prefixexp/script
9525         set dflt
9526         eval $prefixup
9527         ;;
9528 *)  dflt="$scriptdir"
9529         ;;
9530 esac
9531 $cat <<EOM
9532
9533 Some installations have a separate directory just for executable scripts so
9534 that they can mount it across multiple architectures but keep the scripts in
9535 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9536 Or you might just lump your scripts in with all your other executables.
9537
9538 EOM
9539 fn=d~
9540 rp='Where do you keep publicly executable scripts?'
9541 . ./getfile
9542 if $test "X$ansexp" != "X$scriptdirexp"; then
9543         installscript=''
9544 fi
9545 installscriptdir=''
9546 prefixvar=scriptdir
9547 . ./setprefixvar
9548 : A little fix up for an irregularly named variable.
9549 installscript="$installscriptdir"
9550
9551 : determine where add-on public executables go
9552 case "$sitebin" in
9553 '')     dflt=$siteprefix/bin ;;
9554 *)      dflt=$sitebin ;;
9555 esac
9556 fn=d~
9557 rp='Pathname where the add-on public executables should be installed?'
9558 . ./getfile
9559 prefixvar=sitebin
9560 . ./setprefixvar
9561
9562 : determine where add-on html pages go
9563 : There is no standard location, so try to copy the previously-selected
9564 : directory structure for the core html pages.
9565 case "$sitehtml1dir" in
9566 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9567 *)     dflt=$sitehtml1dir ;;
9568 esac
9569 case "$dflt" in
9570 ''|' ') dflt=none ;;
9571 esac
9572 fn=dn+~
9573 rp='Pathname where the site-specific html pages should be installed?'
9574 . ./getfile
9575 prefixvar=sitehtml1dir
9576 . ./setprefixvar
9577
9578 : determine where add-on library html pages go
9579 : There is no standard location, so try to copy the previously-selected
9580 : directory structure for the core html pages.
9581 case "$sitehtml3dir" in
9582 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9583 *)     dflt=$sitehtml3dir ;;
9584 esac
9585 case "$dflt" in
9586 ''|' ') dflt=none ;;
9587 esac
9588 fn=dn+~
9589 rp='Pathname where the site-specific library html pages should be installed?'
9590 . ./getfile
9591 prefixvar=sitehtml3dir
9592 . ./setprefixvar
9593
9594 : determine where add-on manual pages go
9595 case "$siteman1dir" in
9596 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9597 *)      dflt=$siteman1dir ;;
9598 esac
9599 case "$dflt" in
9600 ''|' ') dflt=none ;;
9601 esac
9602 fn=dn+~
9603 rp='Pathname where the site-specific manual pages should be installed?'
9604 . ./getfile
9605 prefixvar=siteman1dir
9606 . ./setprefixvar
9607
9608 : determine where add-on library man pages go
9609 case "$siteman3dir" in
9610 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9611 *)      dflt=$siteman3dir ;;
9612 esac
9613 case "$dflt" in
9614 ''|' ') dflt=none ;;
9615 esac
9616 fn=dn+~
9617 rp='Pathname where the site-specific library manual pages should be installed?'
9618 . ./getfile
9619 prefixvar=siteman3dir
9620 . ./setprefixvar
9621
9622 : determine where add-on public executable scripts go
9623 case "$sitescript" in
9624 '')     dflt=$siteprefix/script
9625         $test -d $dflt || dflt=$sitebin ;;
9626 *)  dflt="$sitescript" ;;
9627 esac
9628 fn=d~+
9629 rp='Pathname where add-on public executable scripts should be installed?'
9630 . ./getfile
9631 prefixvar=sitescript
9632 . ./setprefixvar
9633
9634 : see if backtrace exists
9635 set backtrace d_backtrace
9636 eval $inlibc
9637
9638 : add flags if using c backtrace
9639 case "$usecbacktrace" in
9640   "") usecbacktrace=$undef ;;
9641   [yY]*|true|$define)
9642     case "$d_backtrace" in
9643       [yY]*|true|$define)
9644         case " $ccflags " in
9645           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9646           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9647           esac
9648         ;;
9649       *)
9650         echo "This system does not support backtrace" >&4
9651         usecbacktrace=$undef
9652         ;;
9653       esac
9654     ;;
9655   esac
9656
9657 : Check if faststdio is requested and available
9658 case "$usefaststdio" in
9659 $define|true|[yY]*|'')
9660         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9661         case "$xversion" in
9662         [68])   dflt='y' ;;
9663         *)      dflt='n' ;;
9664         esac
9665         ;;
9666 *) dflt='n';;
9667 esac
9668 cat <<EOM
9669
9670 Perl can be built to use 'fast stdio', which means using the stdio
9671 library but also directly manipulating the stdio buffers to enable
9672 faster I/O.  Using stdio is better for backward compatibility (especially
9673 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9674 interface has been preferred instead of stdio.
9675
9676 If this doesn't make any sense to you, just accept the default '$dflt'.
9677 EOM
9678 rp='Use the "fast stdio" if available?'
9679 . ./myread
9680 case "$ans" in
9681 y|Y)    val="$define" ;;
9682 *)      val="$undef" ;;
9683 esac
9684 set usefaststdio
9685 eval $setvar
9686
9687
9688 : define an is-a-typedef? function
9689 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9690 case "$inclist" in
9691 "") inclist="sys/types.h";;
9692 esac;
9693 eval "varval=\$$var";
9694 case "$varval" in
9695 "")
9696         $rm -f temp.c;
9697         for inc in $inclist; do
9698                 echo "#include <$inc>" >>temp.c;
9699         done;
9700         echo "#ifdef $type" >> temp.c;
9701         echo "printf(\"We have $type\");" >> temp.c;
9702         echo "#endif" >> temp.c;
9703         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9704         if $contains $type temp.E >/dev/null 2>&1; then
9705                 eval "$var=\$type";
9706         else
9707                 eval "$var=\$def";
9708         fi;
9709         $rm -f temp.?;;
9710 *) eval "$var=\$varval";;
9711 esac'
9712
9713 : define an is-a-typedef? function that prompts if the type is not available.
9714 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9715 case "$inclist" in
9716 "") inclist="sys/types.h";;
9717 esac;
9718 eval "varval=\$$var";
9719 case "$varval" in
9720 "")
9721         $rm -f temp.c;
9722         for inc in $inclist; do
9723                 echo "#include <$inc>" >>temp.c;
9724         done;
9725         echo "#ifdef $type" >> temp.c;
9726         echo "printf(\"We have $type\");" >> temp.c;
9727         echo "#endif" >> temp.c;
9728         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9729         echo " " ;
9730         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9731         if $contains $type temp.E >/dev/null 2>&1; then
9732                 echo "$type found." >&4;
9733                 eval "$var=\$type";
9734         else
9735                 echo "$type NOT found." >&4;
9736                 dflt="$def";
9737                 . ./myread ;
9738                 eval "$var=\$ans";
9739         fi;
9740         $rm -f temp.?;;
9741 *) eval "$var=\$varval";;
9742 esac'
9743
9744 : see what type lseek is declared as in the kernel
9745 rp="What is the type used for lseek's offset on this system?"
9746 set off_t lseektype long stdio.h sys/types.h
9747 eval $typedef_ask
9748
9749 echo " "
9750 echo "Checking to see how big your file offsets are..." >&4
9751 $cat >try.c <<EOCP
9752 #include <sys/types.h>
9753 #include <stdio.h>
9754 int main()
9755 {
9756     printf("%d\n", (int)sizeof($lseektype));
9757     return(0);
9758 }
9759 EOCP
9760 set try
9761 if eval $compile_ok; then
9762         lseeksize=`$run ./try`
9763         echo "Your file offsets are $lseeksize bytes long."
9764 else
9765         dflt=$longsize
9766         echo " "
9767         echo "(I can't seem to compile the test program.  Guessing...)"
9768         rp="What is the size of your file offsets (in bytes)?"
9769         . ./myread
9770         lseeksize="$ans"
9771 fi
9772 $rm_try
9773
9774 : see what type file positions are declared as in the library
9775 rp="What is the type for file position used by fsetpos()?"
9776 set fpos_t fpostype long stdio.h sys/types.h
9777 eval $typedef_ask
9778
9779 : Check size for Fpos_t
9780 echo " "
9781 case "$fpostype" in
9782 *_t) zzz="$fpostype"    ;;
9783 *)   zzz="fpos_t"       ;;
9784 esac
9785 echo "Checking the size of $zzz..." >&4
9786 cat > try.c <<EOCP
9787 #include <sys/types.h>
9788 #include <stdio.h>
9789 #$i_stdlib I_STDLIB
9790 #ifdef I_STDLIB
9791 #include <stdlib.h>
9792 #endif
9793 int main() {
9794     printf("%d\n", (int)sizeof($fpostype));
9795     exit(0);
9796 }
9797 EOCP
9798 set try
9799 if eval $compile_ok; then
9800         yyy=`$run ./try`
9801         case "$yyy" in
9802         '')     fpossize=4
9803                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9804                 ;;
9805         *)      fpossize=$yyy
9806                 echo "Your $zzz is $fpossize bytes long."
9807                 ;;
9808         esac
9809 else
9810         dflt="$longsize"
9811         echo " " >&4
9812         echo "(I can't compile the test program.  Guessing...)" >&4
9813         rp="What is the size of your file positions (in bytes)?"
9814         . ./myread
9815         fpossize="$ans"
9816 fi
9817
9818 : Check for large file support
9819 # Backward compatibility (uselfs is deprecated).
9820 case "$uselfs" in
9821 "$define"|true|[yY]*)
9822         cat <<EOM >&4
9823
9824 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9825 EOM
9826         uselargefiles="$define"
9827         ;;
9828 esac
9829
9830 case "$lseeksize:$fpossize" in
9831 8:8) cat <<EOM
9832
9833 You can have files larger than 2 gigabytes.
9834 EOM
9835    val="$define" ;;
9836 *)    case "$uselargefiles" in
9837    "$undef"|false|[nN]*) dflt='n' ;;
9838    *)   dflt='y' ;;
9839    esac
9840    cat <<EOM
9841
9842 Perl can be built to understand large files (files larger than 2 gigabytes)
9843 on some systems.  To do so, Configure can be run with -Duselargefiles.
9844
9845 If this doesn't make any sense to you, just accept the default '$dflt'.
9846 EOM
9847    rp='Try to understand large files, if available?'
9848    . ./myread
9849    case "$ans" in
9850    y|Y)         val="$define" ;;
9851    *)           val="$undef"  ;;
9852    esac
9853    ;;
9854 esac
9855 set uselargefiles
9856 eval $setvar
9857 : Look for a hint-file generated 'call-back-unit'.  If the
9858 : user has specified that a large files perl is to be built,
9859 : we may need to set or change some other defaults.
9860 if $test -f uselargefiles.cbu; then
9861         echo "Your platform has some specific hints regarding large file builds, using them..."
9862         . ./uselargefiles.cbu
9863 fi
9864 case "$uselargefiles" in
9865 "$define")
9866         if $test -f uselargefiles.cbu; then
9867                 echo " "
9868                 echo "Rechecking to see how big your file offsets are..." >&4
9869                 $cat >try.c <<EOCP
9870 #include <sys/types.h>
9871 #include <stdio.h>
9872 int main()
9873 {
9874     printf("%d\n", (int)sizeof($lseektype));
9875     return(0);
9876 }
9877 EOCP
9878                 set try
9879                 if eval $compile_ok; then
9880                         lseeksize=`$run ./try`
9881                         $echo "Your file offsets are now $lseeksize bytes long."
9882                 else
9883                         dflt="$lseeksize"
9884                         echo " "
9885                         echo "(I can't seem to compile the test program.  Guessing...)"
9886                         rp="What is the size of your file offsets (in bytes)?"
9887                         . ./myread
9888                         lseeksize="$ans"
9889                 fi
9890                 case "$fpostype" in
9891                 *_t) zzz="$fpostype"    ;;
9892                 *)   zzz="fpos_t"       ;;
9893                 esac
9894                 $echo $n "Rechecking the size of $zzz...$c" >&4
9895                 $cat > try.c <<EOCP
9896 #include <sys/types.h>
9897 #include <stdio.h>
9898 #$i_stdlib I_STDLIB
9899 #ifdef I_STDLIB
9900 #include <stdlib.h>
9901 #endif
9902 int main() {
9903     printf("%d\n", (int)sizeof($fpostype));
9904     return(0);
9905 }
9906 EOCP
9907                 set try
9908                 if eval $compile_ok; then
9909                         yyy=`$run ./try`
9910                         dflt="$lseeksize"
9911                         case "$yyy" in
9912                         '')     echo " "
9913                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9914                                 ;;
9915                         *)      fpossize=$yyy
9916                                 echo " $fpossize bytes." >&4
9917                                 ;;
9918                         esac
9919                 else
9920                         dflt="$fpossize"
9921                         echo " "
9922                         echo "(I can't compile the test program.  Guessing...)" >&4
9923                         rp="What is the size of your file positions (in bytes)?"
9924                         . ./myread
9925                         fpossize="$ans"
9926                 fi
9927                 $rm_try
9928         fi
9929         ;;
9930 esac
9931
9932 : Check if we want perlio
9933 useperlio="$define"
9934
9935 : Set the vendorbin variables
9936 case "$vendorprefix" in
9937 '')     d_vendorbin="$undef"
9938         vendorbin=''
9939         vendorbinexp=''
9940         ;;
9941 *)      d_vendorbin="$define"
9942         : determine where vendor-supplied executables go.
9943         case "$vendorbin" in
9944         '') dflt=$vendorprefix/bin ;;
9945         *)      dflt="$vendorbin" ;;
9946         esac
9947         fn=d~+
9948         rp='Pathname for the vendor-supplied executables directory?'
9949         . ./getfile
9950         vendorbin="$ans"
9951         vendorbinexp="$ansexp"
9952         ;;
9953 esac
9954 prefixvar=vendorbin
9955 . ./installprefix
9956
9957 : Set the vendorhtml1dir variables
9958 case "$vendorprefix" in
9959 '')     vendorhtml1dir=''
9960         vendorhtml1direxp=''
9961         ;;
9962 *)      : determine where vendor-supplied html pages go.
9963         : There is no standard location, so try to copy the previously-selected
9964         : directory structure for the core html pages.
9965         : XXX Better default suggestions would be welcome.
9966         case "$vendorhtml1dir" in
9967         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9968         *)      dflt=$vendorhtml1dir ;;
9969         esac
9970         case "$dflt" in
9971         ''|' ') dflt=none ;;
9972         esac
9973         fn=dn+~
9974         rp='Pathname for the vendor-supplied html pages?'
9975         . ./getfile
9976         vendorhtml1dir="$ans"
9977         vendorhtml1direxp="$ansexp"
9978         ;;
9979 esac
9980 : Use ' ' for none so value is preserved next time through Configure
9981 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9982 prefixvar=vendorhtml1dir
9983 . ./installprefix
9984
9985 : Set the vendorhtml3dir variables
9986 case "$vendorprefix" in
9987 '')     vendorhtml3dir=''
9988         vendorhtml3direxp=''
9989         ;;
9990 *)      : determine where vendor-supplied module html pages go.
9991         : There is no standard location, so try to copy the previously-selected
9992         : directory structure for the core html pages.
9993         : XXX Better default suggestions would be welcome.
9994         case "$vendorhtml3dir" in
9995         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9996         *)      dflt=$vendorhtml3dir ;;
9997         esac
9998         case "$dflt" in
9999         ''|' ') dflt=none ;;
10000         esac
10001         fn=dn+~
10002         rp='Pathname for the vendor-supplied html pages?'
10003         . ./getfile
10004         vendorhtml3dir="$ans"
10005         vendorhtml3direxp="$ansexp"
10006         ;;
10007 esac
10008 : Use ' ' for none so value is preserved next time through Configure
10009 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
10010 prefixvar=vendorhtml3dir
10011 . ./installprefix
10012
10013 : Set the vendorman1dir variables
10014 case "$vendorprefix" in
10015 '')     vendorman1dir=''
10016         vendorman1direxp=''
10017         ;;
10018 *)      : determine where vendor-supplied manual pages go.
10019         case "$vendorman1dir" in
10020         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10021         *)      dflt=$vendorman1dir ;;
10022         esac
10023         case "$dflt" in
10024         ''|' ') dflt=none ;;
10025         esac
10026         fn=nd~+
10027         rp='Pathname for the vendor-supplied manual section 1 pages?'
10028         . ./getfile
10029         vendorman1dir="$ans"
10030         vendorman1direxp="$ansexp"
10031         ;;
10032 esac
10033 : Use ' ' for none so value is preserved next time through Configure
10034 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
10035 prefixvar=vendorman1dir
10036 . ./installprefix
10037
10038 : Set the vendorman3dir variables
10039 case "$vendorprefix" in
10040 '')     vendorman3dir=''
10041         vendorman3direxp=''
10042         ;;
10043 *)      : determine where vendor-supplied module manual pages go.
10044         case "$vendorman3dir" in
10045         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10046         *)      dflt=$vendorman3dir ;;
10047         esac
10048         case "$dflt" in
10049         ''|' ') dflt=none ;;
10050         esac
10051         fn=nd~+
10052         rp='Pathname for the vendor-supplied manual section 3 pages?'
10053         . ./getfile
10054         vendorman3dir="$ans"
10055         vendorman3direxp="$ansexp"
10056         ;;
10057 esac
10058 : Use ' ' for none so value is preserved next time through Configure
10059 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
10060 prefixvar=vendorman3dir
10061 . ./installprefix
10062
10063 : Set the vendorscript variables
10064 case "$vendorprefix" in
10065 '')     d_vendorscript="$undef"
10066         vendorscript=''
10067         vendorscriptexp=''
10068         ;;
10069 *)      d_vendorscript="$define"
10070         : determine where vendor-supplied scripts go.
10071         case "$vendorscript" in
10072         '')     dflt=$vendorprefix/script
10073                 $test -d $dflt || dflt=$vendorbin ;;
10074         *)  dflt="$vendorscript" ;;
10075         esac
10076         $cat <<EOM
10077
10078 The installation process will create a directory for
10079 vendor-supplied scripts.
10080
10081 EOM
10082         fn=d~+
10083         rp='Pathname for the vendor-supplied scripts directory?'
10084         . ./getfile
10085         vendorscript="$ans"
10086         vendorscriptexp="$ansexp"
10087         ;;
10088 esac
10089 prefixvar=vendorscript
10090 . ./installprefix
10091
10092 : script used to emit important warnings
10093 cat >warn <<EOS
10094 $startsh
10095 if test \$# -gt 0; then
10096         echo "\$@" >msg
10097 else
10098         cat >msg
10099 fi
10100 echo "*** WARNING:" >&4
10101 sed -e 's/^/*** /' <msg >&4
10102 echo "*** " >&4
10103 cat msg >>config.msg
10104 echo " " >>config.msg
10105 rm -f msg
10106 EOS
10107 chmod +x warn
10108 $eunicefix warn
10109
10110 : see which of string.h or strings.h is needed
10111 echo " "
10112 strings=`./findhdr string.h`
10113 if $test "$strings" && $test -r "$strings"; then
10114         echo "Using <string.h> instead of <strings.h>." >&4
10115         val="$define"
10116 else
10117         val="$undef"
10118         strings=`./findhdr strings.h`
10119         if $test "$strings" && $test -r "$strings"; then
10120                 echo "Using <strings.h> instead of <string.h>." >&4
10121         else
10122                 ./warn "No string header found -- You'll surely have problems."
10123         fi
10124 fi
10125 set i_string
10126 eval $setvar
10127 case "$i_string" in
10128 "$undef") strings=`./findhdr strings.h`;;
10129 *)        strings=`./findhdr string.h`;;
10130 esac
10131
10132 : see if qgcvt exists
10133 set qgcvt d_qgcvt
10134 eval $inlibc
10135
10136 : Check what kind of doubles your system has
10137 $echo "Checking the kind of doubles you have..." >&4
10138 $cat >try.c <<EOP
10139 #$i_stdlib I_STDLIB
10140 #define DOUBLESIZE $doublesize
10141 #ifdef I_STDLIB
10142 #include <stdlib.h>
10143 #endif
10144 #include <stdio.h>
10145 static const double d = -0.1;
10146 int main() {
10147   unsigned const char* b = (unsigned const char*)(&d);
10148 #if DOUBLESIZE == 4
10149   if (b[0] == 0xCD && b[3] == 0xBD) {
10150     /* IEEE 754 32-bit little-endian */
10151     printf("1\n");
10152     exit(0);
10153   }
10154   if (b[0] == 0xBD && b[3] == 0xCD) {
10155     /* IEEE 754 32-bit big-endian */
10156     printf("2\n");
10157     exit(0);
10158   }
10159   if (b[0] == 0xCC && b[3] == 0xCC) {
10160     /* VAX format F, 32-bit PDP-style mixed endian. */
10161     printf("9\n");
10162     exit(0);
10163   }
10164   if (b[0] == 0xC0 && b[3] == 0x9A) {
10165     /* IBM single 32-bit */
10166     printf("12\n");
10167     exit(0);
10168   }
10169 #endif
10170 #if DOUBLESIZE == 8
10171   if (b[0] == 0x9A && b[7] == 0xBF) {
10172     /* IEEE 754 64-bit little-endian */
10173     printf("3\n");
10174     exit(0);
10175   }
10176   if (b[0] == 0xBF && b[7] == 0x9A) {
10177     /* IEEE 754 64-bit big-endian */
10178     printf("4\n");
10179     exit(0);
10180   }
10181   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10182    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10183     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10184     * 99 99 b9 bf 9a 99 99 99 */
10185     printf("7\n");
10186     exit(0);
10187   }
10188   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10189    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10190     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10191     * 99 99 99 9a bf b9 99 99 */
10192     printf("8\n");
10193     exit(0);
10194   }
10195   if (b[0] == 0xCC && b[7] == 0xCC) {
10196    /* VAX format D, 64-bit PDP-style mixed endian. */
10197     printf("10\n");
10198     exit(0);
10199   }
10200   if (b[0] == 0xD9 && b[7] == 0x99) {
10201    /* VAX format G, 64-bit PDP-style mixed endian. */
10202     printf("11\n");
10203     exit(0);
10204   }
10205   if (b[0] == 0xC0 && b[7] == 0x9A) {
10206     /* IBM double 64-bit */
10207     printf("13\n");
10208     exit(0);
10209   }
10210   if (b[0] == 0xBF && b[7] == 0xCD) {
10211     /* CRAY single 64-bit */
10212     printf("14\n");
10213     exit(0);
10214   }
10215 #endif
10216 #if DOUBLESIZE == 16
10217   if (b[0] == 0x9A && b[15] == 0xBF) {
10218     /* IEEE 754 128-bit little-endian */
10219     printf("5\n");
10220     exit(0);
10221   }
10222   if (b[0] == 0xBF && b[15] == 0x9A) {
10223     /* IEEE 754 128-bit big-endian */
10224     printf("6\n");
10225     exit(0);
10226   }
10227 #endif
10228   /* Then there are old mainframe/miniframe formats like IBM and CRAY.
10229    * Whether those environments can still build Perl is debatable. */
10230   printf("-1\n"); /* unknown */
10231   exit(0);
10232 }
10233 EOP
10234 set try
10235 if eval $compile; then
10236     doublekind=`$run ./try`
10237 else
10238     doublekind=-1
10239 fi
10240 case "$doublekind" in
10241 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10242 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10243 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10244 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10245 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10246 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10247 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10248 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10249 9) echo "You have VAX format F 32-bit PDP-style mixed endian doubles." >&4 ;;
10250 10) echo "You have VAX format D 64-bit PDP-style mixed endian doubles." >&4 ;;
10251 11) echo "You have VAX format G 64-bit PDP-style mixed endian doubles." >&4 ;;
10252 12) echo "You have IBM short 32-bit doubles." >&4 ;;
10253 13) echo "You have IBM long 64-bit doubles." >&4 ;;
10254 14) echo "You have Cray single 64-bit doubles." >&4 ;;
10255 *) echo "Cannot figure out your double.  You Cyber, or something?" >&4 ;;
10256 esac
10257 $rm_try
10258
10259 : Check print/scan long double stuff
10260 echo " "
10261
10262 if $test X"$d_longdbl" = X"$define"; then
10263
10264 echo "Checking how to print long doubles..." >&4
10265
10266 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10267         $cat >try.c <<'EOCP'
10268 #include <sys/types.h>
10269 #include <stdio.h>
10270 int main() {
10271   double d = 123.456;
10272   printf("%.3f\n", d);
10273 }
10274 EOCP
10275         set try
10276         if eval $compile; then
10277                 yyy=`$run ./try`
10278                 case "$yyy" in
10279                 123.456)
10280                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10281                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10282                         echo "We will use %f."
10283                         ;;
10284                 esac
10285         fi
10286 fi
10287
10288 if $test X"$sPRIfldbl" = X; then
10289         $cat >try.c <<'EOCP'
10290 #include <sys/types.h>
10291 #include <stdio.h>
10292 int main() {
10293   long double d = 123.456;
10294   printf("%.3Lf\n", d);
10295 }
10296 EOCP
10297         set try
10298         if eval $compile; then
10299                 yyy=`$run ./try`
10300                 case "$yyy" in
10301                 123.456)
10302                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10303                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10304                         echo "We will use %Lf."
10305                         ;;
10306                 esac
10307         fi
10308 fi
10309
10310 if $test X"$sPRIfldbl" = X; then
10311         $cat >try.c <<'EOCP'
10312 #include <sys/types.h>
10313 #include <stdio.h>
10314 int main() {
10315   long double d = 123.456;
10316   printf("%.3llf\n", d);
10317 }
10318 EOCP
10319         set try
10320         if eval $compile; then
10321                 yyy=`$run ./try`
10322                 case "$yyy" in
10323                 123.456)
10324                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10325                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10326                         echo "We will use %llf."
10327                         ;;
10328                 esac
10329         fi
10330 fi
10331
10332 if $test X"$sPRIfldbl" = X; then
10333         $cat >try.c <<'EOCP'
10334 #include <sys/types.h>
10335 #include <stdio.h>
10336 int main() {
10337   long double d = 123.456;
10338   printf("%.3lf\n", d);
10339 }
10340 EOCP
10341         set try
10342         if eval $compile; then
10343                 yyy=`$run ./try`
10344                 case "$yyy" in
10345                 123.456)
10346                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10347                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10348                         echo "We will use %lf."
10349                         ;;
10350                 esac
10351         fi
10352 fi
10353
10354 if $test X"$sPRIfldbl" = X; then
10355         echo "Cannot figure out how to print long doubles." >&4
10356 else
10357         sSCNfldbl=$sPRIfldbl    # expect consistency
10358 fi
10359
10360 $rm_try
10361
10362 fi # d_longdbl
10363
10364 case "$sPRIfldbl" in
10365 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10366         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10367         d_SCNfldbl="$undef";
10368         ;;
10369 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10370         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10371         d_SCNfldbl="$define";
10372         ;;
10373 esac
10374
10375 : Before committing on uselongdouble, see whether that looks sane.
10376 if $test "$uselongdouble" = "$define"; then
10377     message=""
10378     echo " "
10379     echo "Checking if your long double math functions work right..." >&4
10380     $cat > try.c <<EOF
10381 #include <math.h>
10382 #include <stdio.h>
10383 int main() {
10384   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10385 }
10386 EOF
10387     case "$osname:$gccversion" in
10388     aix:)       saveccflags="$ccflags"
10389                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10390     esac
10391     set try
10392     if eval $compile_ok; then
10393       yyy=`$run ./try`
10394     fi
10395     case "$yyy" in
10396     3) echo "Your long double math functions are working correctly." >&4 ;;
10397     *) echo "Your long double math functions are broken, not using long doubles." >&4
10398        uselongdouble=$undef
10399        ;;
10400     esac
10401     $rm_try
10402     case "$osname:$gccversion" in
10403     aix:)       ccflags="$saveccflags" ;; # restore
10404     esac
10405 fi
10406
10407 : Check how to convert floats to strings.
10408
10409 if test "X$d_Gconvert" = X; then
10410
10411 echo " "
10412 echo "Checking for an efficient way to convert floats to strings."
10413 echo " " > try.c
10414 case "$uselongdouble" in
10415 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10416 esac
10417 case "$d_longdbl" in
10418 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10419 esac
10420 case "$d_PRIgldbl" in
10421 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10422 esac
10423 $cat >>try.c <<EOP
10424 #ifdef TRY_gconvert
10425 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10426 char *myname = "gconvert";
10427 #endif
10428 #ifdef TRY_gcvt
10429 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10430 char *myname = "gcvt";
10431 #endif
10432 #ifdef TRY_qgcvt
10433 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10434 char *myname = "qgcvt";
10435 #define DOUBLETYPE long double
10436 #endif
10437 #ifdef TRY_sprintf
10438 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10439 #ifdef HAS_PRIgldbl
10440 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10441 #else
10442 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10443 #endif
10444 #else
10445 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10446 #endif
10447 char *myname = "sprintf";
10448 #endif
10449
10450 #ifndef DOUBLETYPE
10451 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10452 #define DOUBLETYPE long double
10453 #else
10454 #define DOUBLETYPE double
10455 #endif
10456 #endif
10457
10458 #include <stdio.h>
10459
10460 #$i_stdlib I_STDLIB
10461 #ifdef I_STDLIB
10462 #include <stdlib.h>
10463 #endif
10464 #$i_string I_STRING
10465 #ifdef I_STRING
10466 #  include <string.h>
10467 #else
10468 #  include <strings.h>
10469 #endif
10470
10471 int checkit(char *expect, char *got)
10472 {
10473     if (strcmp(expect, got)) {
10474                 printf("%s oddity:  Expected %s, got %s\n",
10475                         myname, expect, got);
10476                 exit(1);
10477         }
10478 }
10479
10480 int main()
10481 {
10482         char buf[64];
10483         buf[63] = '\0';
10484
10485         /* This must be 1st test on (which?) platform */
10486         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10487         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10488         checkit("0.1", buf);
10489
10490         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10491         checkit("0.01", buf);
10492
10493         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10494         checkit("0.001", buf);
10495
10496         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10497         checkit("0.0001", buf);
10498
10499         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10500         if (strlen(buf) > 5)
10501             checkit("9e-005", buf); /* for Microsoft ?? */
10502         else
10503             checkit("9e-05", buf);
10504
10505         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10506         checkit("1", buf);
10507
10508         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10509         checkit("1.1", buf);
10510
10511         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10512         checkit("1.01", buf);
10513
10514         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10515         checkit("1.001", buf);
10516
10517         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10518         checkit("1.0001", buf);
10519
10520         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10521         checkit("1.00001", buf);
10522
10523         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10524         checkit("1.000001", buf);
10525
10526         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10527         checkit("0", buf);
10528
10529         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10530         checkit("-1", buf);
10531
10532         /* Some Linux gcvt's give 1.e+5 here. */
10533         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10534         checkit("100000", buf);
10535
10536         /* Some Linux gcvt's give -1.e+5 here. */
10537         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10538         checkit("-100000", buf);
10539
10540         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10541         checkit("123.456", buf);
10542
10543         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10544         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10545         /* 34 should be enough to scare even long double
10546          * places into using the e notation. */
10547         if (strlen(buf) > 5)
10548             checkit("1e+034", buf); /* for Microsoft */
10549         else
10550             checkit("1e+34", buf);
10551
10552         /* For Perl, if you add additional tests here, also add them to
10553          * t/base/num.t for benefit of platforms not using Configure or
10554          * overriding d_Gconvert */
10555
10556         exit(0);
10557 }
10558 EOP
10559 : first add preferred functions to our list
10560 xxx_list=""
10561 for xxx_convert in $gconvert_preference; do
10562     case $xxx_convert in
10563     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10564     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10565     esac
10566 done
10567 : then add any others
10568 for xxx_convert in gconvert gcvt sprintf; do
10569     case "$xxx_list" in
10570     *$xxx_convert*) ;;
10571     *) xxx_list="$xxx_list $xxx_convert" ;;
10572     esac
10573 done
10574
10575 case "$d_longdbl$uselongdouble" in
10576 "$define$define")
10577     : again, add preferred functions to our list first
10578     xxx_ld_list=""
10579     for xxx_convert in $gconvert_ld_preference; do
10580         case $xxx_convert in
10581         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10582         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10583         esac
10584     done
10585     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10586     for xxx_convert in qgcvt sprintf $xxx_list; do
10587         case "$xxx_ld_list" in
10588         $xxx_convert*|*" $xxx_convert"*) ;;
10589         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10590         esac
10591     done
10592     : if sprintf cannot do long doubles, move it to the end
10593     if test "$d_PRIgldbl" != "$define"; then
10594         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10595     fi
10596     : if no qgcvt, remove it
10597     if test "$d_qgcvt" != "$define"; then
10598         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10599     fi
10600     : use the ld_list
10601     xxx_list="$xxx_ld_list"
10602     ;;
10603 esac
10604
10605 for xxx_convert in $xxx_list; do
10606         echo "Trying $xxx_convert..."
10607         $rm -f try try$_o core
10608         set try -DTRY_$xxx_convert
10609         if eval $compile; then
10610                 echo "$xxx_convert() found." >&4
10611                 if $run ./try; then
10612                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10613                         break;
10614                 else
10615                         echo "...But $xxx_convert didn't work as I expected."
10616                         xxx_convert=''
10617                 fi
10618         else
10619                 echo "$xxx_convert NOT found." >&4
10620         fi
10621 done
10622
10623 if test X$xxx_convert = X; then
10624     echo "*** WHOA THERE!!! ***" >&4
10625     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10626     xxx_convert=sprintf
10627 fi
10628
10629 case "$xxx_convert" in
10630 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10631 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10632 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10633 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10634    "$define$define$define")
10635       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10636    "$define$define$undef")
10637       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10638    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10639    esac
10640    ;;
10641 esac
10642
10643 fi
10644 $rm_try
10645
10646 : see if _fwalk exists
10647 set fwalk d__fwalk
10648 eval $inlibc
10649
10650 : Initialize h_fcntl
10651 h_fcntl=false
10652
10653 : Initialize h_sysfile
10654 h_sysfile=false
10655
10656 : access call always available on UNIX
10657 set access d_access
10658 eval $inlibc
10659
10660 : locate the flags for 'access()'
10661 case "$d_access" in
10662 "$define")
10663         echo " "
10664         $cat >access.c <<EOCP
10665 #include <sys/types.h>
10666 #ifdef I_FCNTL
10667 #include <fcntl.h>
10668 #endif
10669 #ifdef I_SYS_FILE
10670 #include <sys/file.h>
10671 #endif
10672 #ifdef I_UNISTD
10673 #include <unistd.h>
10674 #endif
10675 #$i_stdlib I_STDLIB
10676 #ifdef I_STDLIB
10677 #include <stdlib.h>
10678 #endif
10679 int main() {
10680         exit(R_OK);
10681 }
10682 EOCP
10683         : check sys/file.h first, no particular reason here
10684         if $test `./findhdr sys/file.h` && \
10685                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10686                 h_sysfile=true;
10687                 echo "<sys/file.h> defines the *_OK access constants." >&4
10688         elif $test `./findhdr fcntl.h` && \
10689                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10690                 h_fcntl=true;
10691                 echo "<fcntl.h> defines the *_OK access constants." >&4
10692         elif $test `./findhdr unistd.h` && \
10693                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10694                 echo "<unistd.h> defines the *_OK access constants." >&4
10695         else
10696                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10697         fi
10698         ;;
10699 esac
10700 $rm -f access*
10701
10702 : see if accessx exists
10703 set accessx d_accessx
10704 eval $inlibc
10705
10706 : see if acosh exists
10707 set acosh d_acosh
10708 eval $inlibc
10709
10710 : see if aintl exists
10711 set aintl d_aintl
10712 eval $inlibc
10713
10714 : see if alarm exists
10715 set alarm d_alarm
10716 eval $inlibc
10717
10718 : see if 64bit time functions exists
10719
10720 set ctime64 d_ctime64
10721 eval $inlibc
10722
10723 set localtime64 d_localtime64
10724 eval $inlibc
10725
10726 set gmtime64 d_gmtime64
10727 eval $inlibc
10728
10729 set mktime64 d_mktime64
10730 eval $inlibc
10731
10732 set difftime64 d_difftime64
10733 eval $inlibc
10734
10735 set asctime64 d_asctime64
10736 eval $inlibc
10737
10738 : see if POSIX threads are available
10739 set pthread.h i_pthread
10740 eval $inhdr
10741
10742 : define a function to check prototypes
10743 $cat > protochk <<EOSH
10744 $startsh
10745 cc="$cc"
10746 optimize="$optimize"
10747 ccflags="$ccflags"
10748 prototype="$prototype"
10749 define="$define"
10750 rm_try="$rm_try"
10751 usethreads=$usethreads
10752 i_pthread=$i_pthread
10753 pthread_h_first=$pthread_h_first
10754 EOSH
10755
10756 $cat >> protochk <<'EOSH'
10757
10758 $rm_try
10759 foo="$1"
10760 shift
10761 while test $# -ge 2; do
10762         case "$1" in
10763                 $define) echo "#include <$2>" >> try.c ;;
10764                 literal) echo "$2" >> try.c ;;
10765         esac
10766     # Extra magic for the benefit of systems that need pthread.h
10767     # to be included early to correctly detect threadsafe functions.
10768     # Such functions must guarantee themselves, though, that the usethreads
10769     # and i_pthread have been defined, before calling protochk.
10770     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10771         echo "#include <pthread.h>" >> try.c
10772         pthread_h_done=yes
10773     fi
10774     shift 2
10775 done
10776 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10777 cat >> try.c <<'EOCP'
10778 #ifdef CAN_PROTOTYPE
10779 #define _(args) args
10780 #else
10781 #define _(args) ()
10782 #endif
10783 EOCP
10784 echo "$foo" >> try.c
10785 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10786 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10787 status=$?
10788 $rm_try
10789 exit $status
10790 EOSH
10791 chmod +x protochk
10792 $eunicefix protochk
10793
10794 : Define hasproto macro for Configure internal use
10795 hasproto='varname=$1; func=$2; shift; shift;
10796 while $test $# -ge 2; do
10797         case "$1" in
10798         $define) echo "#include <$2>";;
10799         esac ;
10800     shift 2;
10801 done > try.c;
10802 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10803 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10804         echo "$func() prototype found.";
10805         val="$define";
10806 else
10807         echo "$func() prototype NOT found.";
10808         val="$undef";
10809 fi;
10810 set $varname;
10811 eval $setvar;
10812 $rm_try tryout.c'
10813
10814 : see if sys/types.h has to be included
10815 set sys/types.h i_systypes
10816 eval $inhdr
10817
10818 : see if sys/select.h has to be included
10819 set sys/select.h i_sysselct
10820 eval $inhdr
10821
10822 : Define hasfield macro for Configure internal use
10823 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10824 while $test $# -ge 2; do
10825         case "$1" in
10826         $define) echo "#include <$2>";;
10827         esac ;
10828     shift 2;
10829 done > try.c;
10830 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10831 set try;
10832 if eval $compile; then
10833         val="$define";
10834 else
10835         val="$undef";
10836 fi;
10837 set $varname;
10838 eval $setvar;
10839 $rm_try'
10840
10841 : see if we should include time.h, sys/time.h, or both
10842 echo " "
10843 if test "X$timeincl" = X; then
10844         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10845         $echo $n "I'm now running the test program...$c"
10846         $cat >try.c <<EOCP
10847 #include <sys/types.h>
10848 #ifdef I_TIME
10849 #include <time.h>
10850 #endif
10851 #ifdef I_SYSTIME
10852 #ifdef SYSTIMEKERNEL
10853 #define KERNEL
10854 #endif
10855 #include <sys/time.h>
10856 #endif
10857 #ifdef I_SYSSELECT
10858 #include <sys/select.h>
10859 #endif
10860 #$i_stdlib I_STDLIB
10861 #ifdef I_STDLIB
10862 #include <stdlib.h>
10863 #endif
10864 int main()
10865 {
10866         struct tm foo;
10867 #ifdef S_TIMEVAL
10868         struct timeval bar;
10869 #endif
10870 #ifdef S_TIMEZONE
10871         struct timezone tzp;
10872 #endif
10873         if (foo.tm_sec == foo.tm_sec)
10874                 exit(0);
10875 #ifdef S_TIMEVAL
10876         if (bar.tv_sec == bar.tv_sec)
10877                 exit(0);
10878 #endif
10879         exit(1);
10880 }
10881 EOCP
10882         flags=''
10883         for s_timezone in '-DS_TIMEZONE' ''; do
10884         sysselect=''
10885         for s_timeval in '-DS_TIMEVAL' ''; do
10886         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10887         for i_time in '' '-DI_TIME'; do
10888         for i_systime in '-DI_SYSTIME' ''; do
10889                 case "$flags" in
10890                 '') $echo $n ".$c"
10891                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10892                         if eval $compile; then
10893                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10894                                 shift
10895                                 flags="$*"
10896                                 echo " "
10897                                 $echo $n "Succeeded with $flags$c"
10898                         fi
10899                         ;;
10900                 esac
10901         done
10902         done
10903         done
10904         done
10905         done
10906         timeincl=''
10907         echo " "
10908         case "$flags" in
10909         *SYSTIMEKERNEL*) i_systimek="$define"
10910                 timeincl=`./findhdr sys/time.h`
10911                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10912         *) i_systimek="$undef";;
10913         esac
10914         case "$flags" in
10915         *I_TIME*) i_time="$define"
10916                 timeincl=`./findhdr time.h`" $timeincl"
10917                 echo "We'll include <time.h>." >&4;;
10918         *) i_time="$undef";;
10919         esac
10920         case "$flags" in
10921         *I_SYSTIME*) i_systime="$define"
10922                 timeincl=`./findhdr sys/time.h`" $timeincl"
10923                 echo "We'll include <sys/time.h>." >&4;;
10924         *) i_systime="$undef";;
10925         esac
10926         $rm_try
10927 fi
10928 : see if struct tm knows about tm_zone
10929 case "$i_systime$i_time" in
10930 *$define*)
10931         echo " "
10932         echo "Checking to see if your struct tm has tm_zone field..." >&4
10933         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10934         eval $hasfield
10935         ;;
10936 *)      val="$undef"
10937         set d_tm_tm_zone
10938         eval $setvar
10939         ;;
10940 esac
10941 case "$d_tm_tm_zone" in
10942 "$define")      echo "Yes, it does."   ;;
10943 *)              echo "No, it doesn't." ;;
10944 esac
10945 : see if struct tm knows about tm_gmtoff
10946 case "$i_systime$i_time" in
10947 *$define*)
10948         echo " "
10949         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10950         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10951         eval $hasfield
10952         ;;
10953 *)      val="$undef"
10954         set d_tm_tm_gmtoff
10955         eval $setvar
10956         ;;
10957 esac
10958 case "$d_tm_tm_gmtoff" in
10959 "$define")      echo "Yes, it does."   ;;
10960 *)              echo "No, it doesn't." ;;
10961 esac
10962
10963 : see if asctime_r exists
10964 set asctime_r d_asctime_r
10965 eval $inlibc
10966 case "$d_asctime_r" in
10967 "$define")
10968         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10969         case "$d_asctime_r_proto:$usethreads" in
10970         ":define")      d_asctime_r_proto=define
10971                 set d_asctime_r_proto asctime_r $hdrs
10972                 eval $hasproto ;;
10973         *)      ;;
10974         esac
10975         case "$d_asctime_r_proto" in
10976         define)
10977         case "$asctime_r_proto" in
10978         ''|0) try='char* asctime_r(const struct tm*, char*);'
10979         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10980         esac
10981         case "$asctime_r_proto" in
10982         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10983         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10984         esac
10985         case "$asctime_r_proto" in
10986         ''|0) try='int asctime_r(const struct tm*, char*);'
10987         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10988         esac
10989         case "$asctime_r_proto" in
10990         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10991         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10992         esac
10993         case "$asctime_r_proto" in
10994         ''|0)   d_asctime_r=undef
10995                 asctime_r_proto=0
10996                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10997         * )     case "$asctime_r_proto" in
10998                 REENTRANT_PROTO*) ;;
10999                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
11000                 esac
11001                 echo "Prototype: $try" ;;
11002         esac
11003         ;;
11004         *)      case "$usethreads" in
11005                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
11006                 esac
11007                 d_asctime_r=undef
11008                 asctime_r_proto=0
11009                 ;;
11010         esac
11011         ;;
11012 *)      asctime_r_proto=0
11013         ;;
11014 esac
11015
11016 : see if asinh exists
11017 set asinh d_asinh
11018 eval $inlibc
11019
11020 : see if atanh exists
11021 set atanh d_atanh
11022 eval $inlibc
11023
11024 : see if atolf exists
11025 set atolf d_atolf
11026 eval $inlibc
11027
11028 : see if atoll exists
11029 set atoll d_atoll
11030 eval $inlibc
11031
11032 : Look for GCC-style attribute format
11033 case "$d_attribute_format" in
11034 '')
11035 echo " "
11036 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
11037 $cat >attrib.c <<'EOCP'
11038 #include <stdio.h>
11039 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
11040 EOCP
11041 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11042         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11043                 echo "Your C compiler doesn't support __attribute__((format))."
11044                 val="$undef"
11045         else
11046                 echo "Your C compiler supports __attribute__((format))."
11047                 val="$define"
11048         fi
11049 else
11050         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11051         val="$undef"
11052 fi
11053 ;;
11054 *) val="$d_attribute_format" ;;
11055 esac
11056 set d_attribute_format
11057 eval $setvar
11058 $rm -f attrib*
11059
11060 : Look for GCC-style attribute format with null format allowed
11061 case "$d_printf_format_null" in
11062 '') case "$d_attribute_format" in
11063     $define)
11064         echo " "
11065         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
11066 $cat >attrib.c <<EOCP
11067 #include <stdio.h>
11068 #$i_stdlib I_STDLIB
11069 #ifdef I_STDLIB
11070 #include <stdlib.h>
11071 #endif
11072 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
11073 int null_printf (char* pat,...) { return (int)pat; }
11074 int main () { exit(null_printf(NULL)); }
11075 EOCP
11076         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
11077             : run the executable in case it produces a run-time warning
11078             if $run ./attrib >>attrib.out 2>&1; then
11079                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11080                     echo "Your C compiler doesn't allow __printf__ format to be null."
11081                     val="$undef"
11082                 else
11083                     echo "Your C compiler allows __printf__ format to be null."
11084                     val="$define"
11085                 fi
11086             else
11087             echo "Your C compiler executable failed with __printf__ format null."
11088             val="$undef"
11089         fi
11090     else
11091         echo "Your C compiler fails with __printf__ format null."
11092         val="$undef"
11093     fi
11094     ;;
11095     *)  val="$undef" ;;
11096     esac
11097 ;;
11098 *)  val="$d_printf_format_null" ;;
11099 esac
11100 set d_printf_format_null
11101 eval $setvar
11102 $rm -f attrib*
11103
11104 : Look for GCC-style attribute malloc
11105 case "$d_attribute_malloc" in
11106 '')
11107 echo " "
11108 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11109 $cat >attrib.c <<'EOCP'
11110 #include <stdio.h>
11111 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11112 EOCP
11113 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11114         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11115                 echo "Your C compiler doesn't support __attribute__((malloc))."
11116                 val="$undef"
11117         else
11118                 echo "Your C compiler supports __attribute__((malloc))."
11119                 val="$define"
11120         fi
11121 else
11122         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11123         val="$undef"
11124 fi
11125 ;;
11126 *) val="$d_attribute_malloc" ;;
11127 esac
11128 set d_attribute_malloc
11129 eval $setvar
11130 $rm -f attrib*
11131
11132 : Look for GCC-style attribute nonnull
11133 case "$d_attribute_nonnull" in
11134 '')
11135 echo " "
11136 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11137 $cat >attrib.c <<'EOCP'
11138 #include <stdio.h>
11139 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11140 EOCP
11141 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11142         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11143                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11144                 val="$undef"
11145         else
11146                 echo "Your C compiler supports __attribute__((nonnull))."
11147                 val="$define"
11148         fi
11149 else
11150         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11151         val="$undef"
11152 fi
11153 ;;
11154 *) val="$d_attribute_nonnull" ;;
11155 esac
11156 set d_attribute_nonnull
11157 eval $setvar
11158 $rm -f attrib*
11159
11160 : Look for GCC-style attribute noreturn
11161 case "$d_attribute_noreturn" in
11162 '')
11163 echo " "
11164 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11165 $cat >attrib.c <<'EOCP'
11166 #include <stdio.h>
11167 void fall_over_dead( void ) __attribute__((noreturn));
11168 EOCP
11169 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11170         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11171                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11172                 val="$undef"
11173         else
11174                 echo "Your C compiler supports __attribute__((noreturn))."
11175                 val="$define"
11176         fi
11177 else
11178         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11179         val="$undef"
11180 fi
11181 ;;
11182 *) val="$d_attribute_noreturn" ;;
11183 esac
11184 set d_attribute_noreturn
11185 eval $setvar
11186 $rm -f attrib*
11187
11188 : Look for GCC-style attribute pure
11189 case "$d_attribute_pure" in
11190 '')
11191 echo " "
11192 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11193 $cat >attrib.c <<'EOCP'
11194 #include <stdio.h>
11195 int square( int n ) __attribute__((pure));
11196 EOCP
11197 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11198         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11199                 echo "Your C compiler doesn't support __attribute__((pure))."
11200                 val="$undef"
11201         else
11202                 echo "Your C compiler supports __attribute__((pure))."
11203                 val="$define"
11204         fi
11205 else
11206         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11207         val="$undef"
11208 fi
11209 ;;
11210 *) val="$d_attribute_pure" ;;
11211 esac
11212 set d_attribute_pure
11213 eval $setvar
11214 $rm -f attrib*
11215
11216 : Look for GCC-style attribute unused
11217 case "$d_attribute_unused" in
11218 '')
11219 echo " "
11220 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11221 $cat >attrib.c <<'EOCP'
11222 #include <stdio.h>
11223 int do_something( int dummy __attribute__((unused)), int n );
11224 EOCP
11225 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11226         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11227                 echo "Your C compiler doesn't support __attribute__((unused))."
11228                 val="$undef"
11229         else
11230                 echo "Your C compiler supports __attribute__((unused))."
11231                 val="$define"
11232         fi
11233 else
11234         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11235         val="$undef"
11236 fi
11237 ;;
11238 *) val="$d_attribute_unused" ;;
11239 esac
11240 set d_attribute_unused
11241 eval $setvar
11242 $rm -f attrib*
11243
11244 : Look for GCC-style attribute deprecated
11245 case "$d_attribute_deprecated" in
11246 '')
11247 echo " "
11248 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11249 $cat >attrib.c <<'EOCP'
11250 #include <stdio.h>
11251 int I_am_deprecated(void) __attribute__((deprecated));
11252 EOCP
11253 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11254         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11255                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11256                 val="$undef"
11257         else
11258                 echo "Your C compiler supports __attribute__((deprecated))."
11259                 val="$define"
11260         fi
11261 else
11262         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11263         val="$undef"
11264 fi
11265 ;;
11266 *) val="$d_attribute_deprecated" ;;
11267 esac
11268 set d_attribute_deprecated
11269 eval $setvar
11270 $rm -f attrib*
11271
11272 : Look for GCC-style attribute warn_unused_result
11273 case "$d_attribute_warn_unused_result" in
11274 '')
11275 echo " "
11276 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11277 $cat >attrib.c <<'EOCP'
11278 #include <stdio.h>
11279 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11280 EOCP
11281 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11282         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11283                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11284                 val="$undef"
11285         else
11286                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11287                 val="$define"
11288         fi
11289 else
11290         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11291         val="$undef"
11292 fi
11293 ;;
11294 *) val="$d_attribute_warn_unused_result" ;;
11295 esac
11296 set d_attribute_warn_unused_result
11297 eval $setvar
11298 $rm -f attrib*
11299
11300 : see if bcmp exists
11301 set bcmp d_bcmp
11302 eval $inlibc
11303
11304 : see if bcopy exists
11305 set bcopy d_bcopy
11306 eval $inlibc
11307
11308 : see if getpgrp exists
11309 set getpgrp d_getpgrp
11310 eval $inlibc
11311
11312 case "$d_getpgrp" in
11313 "$define")
11314         echo " "
11315         echo "Checking to see which flavor of getpgrp is in use..."
11316         $cat >try.c <<EOP
11317 #$i_unistd I_UNISTD
11318 #include <sys/types.h>
11319 #ifdef I_UNISTD
11320 #  include <unistd.h>
11321 #endif
11322 #$i_stdlib I_STDLIB
11323 #ifdef I_STDLIB
11324 #include <stdlib.h>
11325 #endif
11326 int main()
11327 {
11328         if (getuid() == 0) {
11329                 printf("(I see you are running Configure as super-user...)\n");
11330                 setuid(1);
11331         }
11332 #ifdef TRY_BSD_PGRP
11333         if (getpgrp(1) == 0)
11334                 exit(0);
11335 #else
11336         if (getpgrp() > 0)
11337                 exit(0);
11338 #endif
11339         exit(1);
11340 }
11341 EOP
11342         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11343                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11344                 val="$define"
11345         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11346                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11347                 val="$undef"
11348         else
11349                 echo "I can't seem to compile and run the test program."
11350                 if ./usg; then
11351                         xxx="a USG one, i.e. you use getpgrp()."
11352                 else
11353                         # SVR4 systems can appear rather BSD-ish.
11354                         case "$i_unistd" in
11355                         $undef)
11356                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11357                                 val="$define"
11358                                 ;;
11359                         $define)
11360                                 xxx="probably a USG one, i.e. you use getpgrp()."
11361                                 val="$undef"
11362                                 ;;
11363                         esac
11364                 fi
11365                 echo "Assuming your getpgrp is $xxx" >&4
11366         fi
11367         ;;
11368 *) val="$undef";;
11369 esac
11370 set d_bsdgetpgrp
11371 eval $setvar
11372 $rm_try
11373
11374 : see if setpgrp exists
11375 set setpgrp d_setpgrp
11376 eval $inlibc
11377
11378 case "$d_setpgrp" in
11379 "$define")
11380         echo " "
11381         echo "Checking to see which flavor of setpgrp is in use..."
11382         $cat >try.c <<EOP
11383 #$i_unistd I_UNISTD
11384 #include <sys/types.h>
11385 #ifdef I_UNISTD
11386 #  include <unistd.h>
11387 #endif
11388 #$i_stdlib I_STDLIB
11389 #ifdef I_STDLIB
11390 #include <stdlib.h>
11391 #endif
11392 int main()
11393 {
11394         if (getuid() == 0) {
11395                 printf("(I see you are running Configure as super-user...)\n");
11396                 setuid(1);
11397         }
11398 #ifdef TRY_BSD_PGRP
11399         if (-1 == setpgrp(1, 1))
11400                 exit(0);
11401 #else
11402         if (setpgrp() != -1)
11403                 exit(0);
11404 #endif
11405         exit(1);
11406 }
11407 EOP
11408         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11409                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11410                 val="$define"
11411         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11412                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11413                 val="$undef"
11414         else
11415                 echo "(I can't seem to compile and run the test program.)"
11416                 if ./usg; then
11417                         xxx="a USG one, i.e. you use setpgrp()."
11418                 else
11419                         # SVR4 systems can appear rather BSD-ish.
11420                         case "$i_unistd" in
11421                         $undef)
11422                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11423                                 val="$define"
11424                                 ;;
11425                         $define)
11426                                 xxx="probably a USG one, i.e. you use setpgrp()."
11427                                 val="$undef"
11428                                 ;;
11429                         esac
11430                 fi
11431                 echo "Assuming your setpgrp is $xxx" >&4
11432         fi
11433         ;;
11434 *) val="$undef";;
11435 esac
11436 set d_bsdsetpgrp
11437 eval $setvar
11438 $rm_try
11439
11440 : Look for GCC-style __builtin_choose_expr
11441 case "$d_builtin_choose_expr" in
11442 '')
11443     echo " "
11444     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11445     $cat >try.c <<'EOCP'
11446 #include <assert.h>
11447 #include <stdlib.h>
11448 #include <stdio.h>
11449
11450 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11451
11452 int main(void) {
11453     assert( SYRINX(1) == 2112 );
11454     assert( SYRINX(1) != 5150 );
11455     assert( SYRINX(0) == 5150 );
11456     assert( SYRINX(0) != 2112 );
11457     puts( "All good!" );
11458     exit(0);
11459 }
11460
11461 EOCP
11462     set try
11463     if eval $compile && $run ./try; then
11464         echo "Your C compiler supports __builtin_choose_expr."
11465         val="$define"
11466     else
11467         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11468         val="$undef"
11469     fi
11470 ;;
11471 *) val="$d_builtin_choose_expr" ;;
11472 esac
11473
11474 set d_builtin_choose_expr
11475 eval $setvar
11476 $rm_try
11477
11478 : Look for GCC-style __builtin_expect
11479 case "$d_builtin_expect" in
11480 '')
11481     echo " "
11482     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11483     $cat >try.c <<'EOCP'
11484 int main(void) {
11485     int n = 50;
11486     if ( __builtin_expect(n, 0) ) n = 1;
11487     /* Remember shell exit code truth is 0, C truth is non-zero */
11488     return !(n == 1);
11489 }
11490 EOCP
11491     set try
11492     if eval $compile && $run ./try; then
11493         echo "Your C compiler supports __builtin_expect."
11494         val="$define"
11495     else
11496         echo "Your C compiler doesn't seem to understand __builtin_expect."
11497         val="$undef"
11498     fi
11499     ;;
11500 *) val="$d_builtin_expect" ;;
11501 esac
11502
11503 set d_builtin_expect
11504 eval $setvar
11505 $rm_try
11506
11507 : see if bzero exists
11508 set bzero d_bzero
11509 eval $inlibc
11510
11511 : see if stdarg is available
11512 echo " "
11513 if $test `./findhdr stdarg.h`; then
11514         echo "<stdarg.h> found." >&4
11515         valstd="$define"
11516 else
11517         echo "<stdarg.h> NOT found." >&4
11518         valstd="$undef"
11519 fi
11520
11521 : see if varargs is available
11522 echo " "
11523 if $test `./findhdr varargs.h`; then
11524         echo "<varargs.h> found." >&4
11525 else
11526         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11527 fi
11528
11529 : set up the varargs testing programs
11530 $cat > varargs.c <<EOP
11531 #ifdef I_STDARG
11532 #include <stdarg.h>
11533 #endif
11534 #ifdef I_VARARGS
11535 #include <varargs.h>
11536 #endif
11537
11538 #ifdef I_STDARG
11539 int f(char *p, ...)
11540 #else
11541 int f(va_alist)
11542 va_dcl
11543 #endif
11544 {
11545         va_list ap;
11546 #ifndef I_STDARG
11547         char *p;
11548 #endif
11549 #ifdef I_STDARG
11550         va_start(ap,p);
11551 #else
11552         va_start(ap);
11553         p = va_arg(ap, char *);
11554 #endif
11555         va_end(ap);
11556         return 0;
11557 }
11558 EOP
11559 $cat > varargs <<EOP
11560 $startsh
11561 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11562         echo "true"
11563 else
11564         echo "false"
11565 fi
11566 $rm -f varargs$_o
11567 EOP
11568 chmod +x varargs
11569
11570 : now check which varargs header should be included
11571 echo " "
11572 i_varhdr=''
11573 val=''
11574 case "$valstd" in
11575 "$define")
11576         if `./varargs I_STDARG`; then
11577                 val='stdarg.h'
11578         elif `./varargs I_VARARGS`; then
11579                 val='varargs.h'
11580         fi
11581         ;;
11582 *)
11583         if `./varargs I_VARARGS`; then
11584                 val='varargs.h'
11585         fi
11586         ;;
11587 esac
11588 case "$val" in
11589 '')
11590         echo " "
11591         echo "*** WHOA THERE!!! ***" >&4
11592         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
11593         case "$knowitall" in
11594         '')
11595         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
11596                 exit 1
11597                 ;;
11598         esac
11599 echo "I could not find the definition for va_dcl... You have problems..." >&4
11600         val="$undef"; set i_stdarg; eval $setvar
11601         val="$undef"; set i_varargs; eval $setvar
11602         ;;
11603 *)
11604         set i_varhdr
11605         eval $setvar
11606         case "$i_varhdr" in
11607         stdarg.h)
11608                 val="$define"; set i_stdarg; eval $setvar
11609                 val="$undef"; set i_varargs; eval $setvar
11610                 ;;
11611         varargs.h)
11612                 val="$undef"; set i_stdarg; eval $setvar
11613                 val="$define"; set i_varargs; eval $setvar
11614                 ;;
11615         esac
11616         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11617 esac
11618 $rm -f varargs*
11619
11620 : see if the Compiler supports C99 variadic macros
11621 case "$i_stdarg$i_stdlib" in
11622     "$define$define")
11623     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11624     $cat >try.c <<EOCP
11625 #include <stdio.h>
11626 #include <stdarg.h>
11627
11628 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11629
11630 int main() {
11631   char buf[20];
11632   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11633   puts(buf);
11634   return 0;
11635 }
11636 EOCP
11637     set try
11638     if eval $compile && $run ./try 2>&1 >/dev/null; then
11639         case "`$run ./try`" in
11640             "123 456 789")
11641             echo "You have C99 variadic macros." >&4
11642             d_c99_variadic_macros="$define"
11643             ;;
11644             *)
11645             echo "You don't have functional C99 variadic macros." >&4
11646             d_c99_variadic_macros="$undef"
11647             ;;
11648         esac
11649     else
11650         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11651         d_c99_variadic_macros="$undef"
11652     fi
11653     $rm_try
11654     ;;
11655     *)
11656     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11657     d_c99_variadic_macros="$undef"
11658     ;;
11659 esac
11660
11661 : see if signal is declared as pointer to function returning int or void
11662 echo " "
11663 xxx=`./findhdr signal.h`
11664 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11665 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11666         echo "You have int (*signal())() instead of void." >&4
11667         val="$undef"
11668 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11669         echo "You have void (*signal())()." >&4
11670         val="$define"
11671 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11672         echo "You have int (*signal())() instead of void." >&4
11673         val="$undef"
11674 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11675         echo "You have void (*signal())()." >&4
11676         val="$define"
11677 else
11678         case "$d_voidsig" in
11679         '')
11680         echo "I can't determine whether signal handler returns void or int..." >&4
11681                 dflt=void
11682                 rp="What type does your signal handler return?"
11683                 . ./myread
11684                 case "$ans" in
11685                 v*) val="$define";;
11686                 *) val="$undef";;
11687                 esac;;
11688         "$define")
11689                 echo "As you already told me, signal handler returns void." >&4
11690                 val="$define"
11691                 ;;
11692         *)      echo "As you already told me, signal handler returns int." >&4
11693                 val="$undef"
11694                 ;;
11695         esac
11696 fi
11697 set d_voidsig
11698 eval $setvar
11699 case "$d_voidsig" in
11700 "$define") signal_t="void";;
11701 *) signal_t="int";;
11702 esac
11703 $rm -f $$.tmp
11704
11705 : check for ability to cast large floats to 32-bit ints.
11706 echo " "
11707 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11708 if $test "$intsize" -ge 4; then
11709         xxx=int
11710 else
11711         xxx=long
11712 fi
11713 $cat >try.c <<EOCP
11714 #include <stdio.h>
11715 #$i_stdlib I_STDLIB
11716 #ifdef I_STDLIB
11717 #include <stdlib.h>
11718 #endif
11719 #include <sys/types.h>
11720 #include <signal.h>
11721 $signal_t blech(int s) { exit(3); }
11722 int main()
11723 {
11724         $xxx i32;
11725         double f, g;
11726         int result = 0;
11727         char str[16];
11728         signal(SIGFPE, blech);
11729
11730         /* Don't let compiler optimize the test away.  Store the number
11731            in a writable string for gcc to pass to sscanf under HP-UX.
11732         */
11733         sprintf(str, "2147483647");
11734         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11735         g = 10 * f;
11736         i32  = ($xxx) g;
11737
11738         /* x86 processors will probably give 0x8000 0000, which is a
11739            sign change.  We don't want that.  We want to mimic SPARC
11740            behavior here, which is to preserve the sign and give
11741            back 0x7fff ffff.
11742         */
11743         if (i32 != ($xxx) f)
11744                 result |= 1;
11745         exit(result);
11746 }
11747 EOCP
11748 set try
11749 if eval $compile_ok; then
11750         $run ./try 2>/dev/null
11751         yyy=$?
11752 else
11753         echo "(I can't seem to compile the test program--assuming it can't)"
11754         yyy=1
11755 fi
11756 case "$yyy" in
11757 0)      val="$define"
11758         echo "Yup, it can."
11759         ;;
11760 *)      val="$undef"
11761         echo "Nope, it can't."
11762         ;;
11763 esac
11764 set d_casti32
11765 eval $setvar
11766 $rm_try
11767
11768 : check for ability to cast negative floats to unsigned
11769 echo " "
11770 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11771 $cat >try.c <<EOCP
11772 #include <stdio.h>
11773 #$i_stdlib I_STDLIB
11774 #ifdef I_STDLIB
11775 #include <stdlib.h>
11776 #endif
11777 #include <sys/types.h>
11778 #include <signal.h>
11779 $signal_t blech(int s) { exit(7); }
11780 $signal_t blech_in_list(int s) { exit(4); }
11781 unsigned long dummy_long(unsigned long p) { return p; }
11782 unsigned int dummy_int(unsigned int p) { return p; }
11783 unsigned short dummy_short(unsigned short p) { return p; }
11784 int main()
11785 {
11786         double f;
11787         unsigned long along;
11788         unsigned int aint;
11789         unsigned short ashort;
11790         int result = 0;
11791         char str[16];
11792
11793         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11794            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11795            optimized the whole file away
11796         */
11797         /* Store the number in a writable string for gcc to pass to
11798            sscanf under HP-UX.
11799         */
11800         sprintf(str, "-123");
11801         sscanf(str, "%lf", &f);  /* f = -123.; */
11802
11803         signal(SIGFPE, blech);
11804         along = (unsigned long)f;
11805         aint = (unsigned int)f;
11806         ashort = (unsigned short)f;
11807         if (along != (unsigned long)-123)
11808                 result |= 1;
11809         if (aint != (unsigned int)-123)
11810                 result |= 1;
11811         if (ashort != (unsigned short)-123)
11812                 result |= 1;
11813         sprintf(str, "1073741824.");
11814         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11815         f = f + f;
11816         along = 0;
11817         along = (unsigned long)f;
11818         if (along != 0x80000000)
11819                 result |= 2;
11820         f -= 1.;
11821         along = 0;
11822         along = (unsigned long)f;
11823         if (along != 0x7fffffff)
11824                 result |= 1;
11825         f += 2.;
11826         along = 0;
11827         along = (unsigned long)f;
11828         if (along != 0x80000001)
11829                 result |= 2;
11830         if (result)
11831                 exit(result);
11832         signal(SIGFPE, blech_in_list);
11833         sprintf(str, "123.");
11834         sscanf(str, "%lf", &f);  /* f = 123.; */
11835         along = dummy_long((unsigned long)f);
11836         aint = dummy_int((unsigned int)f);
11837         ashort = dummy_short((unsigned short)f);
11838         if (along != (unsigned long)123)
11839                 result |= 4;
11840         if (aint != (unsigned int)123)
11841                 result |= 4;
11842         if (ashort != (unsigned short)123)
11843                 result |= 4;
11844         exit(result);
11845
11846 }
11847 EOCP
11848 set try
11849 if eval $compile_ok; then
11850         $run ./try 2>/dev/null
11851         castflags=$?
11852 else
11853         echo "(I can't seem to compile the test program--assuming it can't)"
11854         castflags=7
11855 fi
11856 case "$castflags" in
11857 0)      val="$define"
11858         echo "Yup, it can."
11859         ;;
11860 *)      val="$undef"
11861         echo "Nope, it can't."
11862         ;;
11863 esac
11864 set d_castneg
11865 eval $setvar
11866 $rm_try
11867
11868 : see if cbrt exists
11869 set cbrt d_cbrt
11870 eval $inlibc
11871
11872 : see if vprintf exists
11873 echo " "
11874 if set vprintf val -f d_vprintf; eval $csym; $val; then
11875         echo 'vprintf() found.' >&4
11876         val="$define"
11877         $cat >try.c <<EOF
11878 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11879 #$i_varargs I_VARARGS
11880
11881 #$i_stdlib I_STDLIB
11882 #$i_unistd I_UNISTD
11883
11884 #ifdef I_STDARG
11885 #  include <stdarg.h>
11886 #else /* I_VARARGS */
11887 #  include <varargs.h>
11888 #endif
11889
11890 #ifdef I_UNISTD
11891 #  include <unistd.h>
11892 #endif
11893
11894 #ifdef I_STDLIB
11895 #  include <stdlib.h>
11896 #endif
11897
11898 #include <stdio.h> /* vsprintf prototype */
11899
11900 #ifdef I_STDARG
11901 void xxx(int n, ...)
11902 {
11903     va_list args;
11904     char buf[10];
11905     va_start(args, n);
11906     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11907 }
11908 int main() { xxx(1, "foo"); }
11909
11910 #else /* I_VARARGS */
11911
11912 xxx(va_alist)
11913 va_dcl
11914 {
11915     va_list args;
11916     char buf[10];
11917     va_start(args);
11918     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11919 }
11920 int main() { xxx("foo"); }
11921
11922 #endif
11923
11924 EOF
11925         set try
11926         if eval $compile_ok; then
11927                 if $run ./try; then
11928                         echo "Your vsprintf() returns (int)." >&4
11929                         val2="$undef"
11930                 else
11931                         echo "Your vsprintf() returns (char*)." >&4
11932                         val2="$define"
11933                 fi
11934         else
11935                 echo 'I am unable to compile the vsprintf() test program.' >&4
11936                 # We shouldn't get here.  If we do, assume the standard signature,
11937                 # not the old BSD one.
11938                 echo 'Guessing that vsprintf() returns (int).' >&4
11939                 val2="$undef"
11940         fi
11941 else
11942         echo 'vprintf() NOT found.' >&4
11943         val="$undef"
11944         val2="$undef"
11945 fi
11946 $rm_try
11947 set d_vprintf
11948 eval $setvar
11949 val=$val2
11950 set d_charvspr
11951 eval $setvar
11952
11953 : see if chown exists
11954 set chown d_chown
11955 eval $inlibc
11956
11957 : see if chroot exists
11958 set chroot d_chroot
11959 eval $inlibc
11960
11961 : see if chsize exists
11962 set chsize d_chsize
11963 eval $inlibc
11964
11965 : see if class exists
11966 set class d_class
11967 eval $inlibc
11968
11969 : see if clearenv exists
11970 set clearenv d_clearenv
11971 eval $inlibc
11972
11973 : Define hasstruct macro for Configure internal use
11974 hasstruct='varname=$1; struct=$2; shift; shift;
11975 while $test $# -ge 2; do
11976         case "$1" in
11977         $define) echo "#include <$2>";;
11978         esac ;
11979     shift 2;
11980 done > try.c;
11981 echo "int main () { struct $struct foo; }" >> try.c;
11982 set try;
11983 if eval $compile; then
11984         val="$define";
11985 else
11986         val="$undef";
11987 fi;
11988 set $varname;
11989 eval $setvar;
11990 $rm_try'
11991
11992 : see whether socket exists
11993 socketlib=''
11994 sockethdr=''
11995 echo " "
11996 $echo $n "Hmm... $c" >&4
11997 if set socket val -f d_socket; eval $csym; $val; then
11998     echo "Looks like you have Berkeley networking support." >&4
11999     d_socket="$define"
12000     if set setsockopt val -f; eval $csym; $val; then
12001         d_oldsock="$undef"
12002     else
12003         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
12004         d_oldsock="$define"
12005     fi
12006 else
12007     if $contains socklib libc.list >/dev/null 2>&1; then
12008         echo "Looks like you have Berkeley networking support." >&4
12009         d_socket="$define"
12010         : we will have to assume that it supports the 4.2 BSD interface
12011         d_oldsock="$undef"
12012     else
12013         echo "You don't have Berkeley networking in libc$_a..." >&4
12014         if test "X$d_socket" = "X$define"; then
12015             echo "...but you seem to believe that you have sockets." >&4
12016         else
12017             for net in net socket
12018             do
12019                 if test -f $sysroot/usr/lib/lib$net$_a; then
12020                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
12021                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
12022                     if $contains socket libc.list >/dev/null 2>&1; then
12023                         d_socket="$define"
12024                         socketlib="-l$net"
12025                         case "$net" in
12026                         net)
12027                             echo "...but the Wollongong group seems to have hacked it in." >&4
12028                             sockethdr="-I$sysroot/usr/netinclude"
12029                             ;;
12030                         esac
12031                         echo "Found Berkeley sockets interface in lib$net." >&4
12032                         if $contains setsockopt libc.list >/dev/null 2>&1; then
12033                             d_oldsock="$undef"
12034                         else
12035                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
12036                             d_oldsock="$define"
12037                         fi
12038                         break
12039                     fi
12040                 fi
12041             done
12042             if test "X$d_socket" != "X$define"; then
12043                echo "or anywhere else I see." >&4
12044                d_socket="$undef"
12045                d_oldsock="$undef"
12046             fi
12047         fi
12048     fi
12049 fi
12050
12051 : see if socketpair exists
12052 set socketpair d_sockpair
12053 eval $inlibc
12054
12055
12056 echo " "
12057 echo "Checking the availability sa_len in the sock struct ..." >&4
12058 $cat >try.c <<EOF
12059 #include <sys/types.h>
12060 #include <sys/socket.h>
12061 int main() {
12062 struct sockaddr sa;
12063 return (sa.sa_len);
12064 }
12065 EOF
12066 val="$undef"
12067 set try; if eval $compile; then
12068     val="$define"
12069 fi
12070 set d_sockaddr_sa_len; eval $setvar
12071 $rm_try
12072
12073 echo " "
12074 echo "Checking the availability struct sockaddr_in6 ..." >&4
12075 $cat >try.c <<EOF
12076 #include <sys/types.h>
12077 #include <sys/socket.h>
12078 #include <netinet/in.h>
12079 int main() {
12080 struct sockaddr_in6 sin6;
12081 return (sin6.sin6_family);
12082 }
12083 EOF
12084 val="$undef"
12085 set try; if eval $compile; then
12086     val="$define"
12087 fi
12088 set d_sockaddr_in6; eval $setvar
12089 $rm_try
12090
12091 echo " "
12092 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
12093 $cat >try.c <<EOF
12094 #include <sys/types.h>
12095 #include <sys/socket.h>
12096 #include <netinet/in.h>
12097 int main() {
12098 struct sockaddr_in6 sin6;
12099 return (sin6.sin6_scope_id);
12100 }
12101 EOF
12102 val="$undef"
12103 set try; if eval $compile; then
12104     val="$define"
12105 fi
12106 set d_sin6_scope_id; eval $setvar
12107 $rm_try
12108
12109 echo " "
12110 echo "Checking the availability struct ip_mreq ..." >&4
12111 $cat >try.c <<EOF
12112 #include <sys/types.h>
12113 #include <sys/socket.h>
12114 #include <netinet/in.h>
12115 int main() {
12116 struct ip_mreq mreq;
12117 return (mreq.imr_multiaddr.s_addr);
12118 }
12119 EOF
12120 val="$undef"
12121 set try; if eval $compile; then
12122        val="$define"
12123 fi
12124 set d_ip_mreq; eval $setvar
12125 $rm_try
12126
12127 echo " "
12128 echo "Checking the availability struct ip_mreq_source ..." >&4
12129 $cat >try.c <<EOF
12130 #include <sys/types.h>
12131 #include <sys/socket.h>
12132 #include <netinet/in.h>
12133 int main() {
12134 struct ip_mreq_source mreq;
12135 return (mreq.imr_multiaddr.s_addr);
12136 }
12137 EOF
12138 val="$undef"
12139 set try; if eval $compile; then
12140        val="$define"
12141 fi
12142 set d_ip_mreq_source; eval $setvar
12143 $rm_try
12144
12145 echo " "
12146 echo "Checking the availability struct ipv6_mreq ..." >&4
12147 $cat >try.c <<EOF
12148 #include <sys/types.h>
12149 #include <sys/socket.h>
12150 #include <netinet/in.h>
12151 int main() {
12152 struct ipv6_mreq mreq;
12153 return (mreq.ipv6mr_interface);
12154 }
12155 EOF
12156 val="$undef"
12157 set try; if eval $compile; then
12158     val="$define"
12159 fi
12160 set d_ipv6_mreq; eval $setvar
12161 $rm_try
12162
12163 echo " "
12164 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12165 $cat >try.c <<EOF
12166 #include <sys/types.h>
12167 #include <sys/socket.h>
12168 #include <netinet/in.h>
12169 int main() {
12170 struct ipv6_mreq_source mreq;
12171 return (mreq.imr_multiaddr.s_addr);
12172 }
12173 EOF
12174 val="$undef"
12175 set try; if eval $compile; then
12176        val="$define"
12177 fi
12178 set d_ipv6_mreq_source; eval $setvar
12179 $rm_try
12180
12181 echo " "
12182 echo "Checking the availability of certain socket constants..." >&4
12183 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12184     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12185     $cat >try.c <<EOF
12186 #include <sys/types.h>
12187 #include <sys/socket.h>
12188 int main() {
12189     int i = $ENUM;
12190 }
12191 EOF
12192     val="$undef"
12193     set try; if eval $compile; then
12194         val="$define"
12195     fi
12196     set d_${enum}; eval $setvar
12197     $rm_try
12198 done
12199
12200 : see if this is a sys/uio.h system
12201 set sys/uio.h i_sysuio
12202 eval $inhdr
12203
12204 : Check for cmsghdr support
12205 echo " "
12206 echo "Checking to see if your system supports struct cmsghdr..." >&4
12207 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12208 eval $hasstruct
12209 case "$d_cmsghdr_s" in
12210 "$define")      echo "Yes, it does."   ;;
12211 *)              echo "No, it doesn't." ;;
12212 esac
12213
12214
12215 : check for const keyword
12216 echo " "
12217 echo 'Checking to see if your C compiler knows about "const"...' >&4
12218 $cat >const.c <<'EOCP'
12219 typedef struct spug { int drokk; } spug;
12220 int main()
12221 {
12222         const char *foo;
12223         const spug y = { 0 };
12224 }
12225 EOCP
12226 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
12227         val="$define"
12228         echo "Yup, it does."
12229 else
12230         val="$undef"
12231         echo "Nope, it doesn't."
12232 fi
12233 set d_const
12234 eval $setvar
12235
12236 : see if copysign exists
12237 set copysign d_copysign
12238 eval $inlibc
12239
12240 : see if copysignl exists
12241 set copysignl d_copysignl
12242 eval $inlibc
12243
12244 : see if crypt exists
12245 echo " "
12246 set crypt d_crypt
12247 eval $inlibc
12248 case "$d_crypt" in
12249 $define) cryptlib='' ;;
12250 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12251                 echo 'crypt() found.' >&4
12252                 val="$define"
12253                 cryptlib=''
12254         else
12255                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12256                 if $test -z "$cryptlib"; then
12257                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12258                 else
12259                         cryptlib=-lcrypt
12260                 fi
12261                 if $test -z "$cryptlib"; then
12262                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12263                 else
12264                         cryptlib=-lcrypt
12265                 fi
12266                 if $test -z "$cryptlib"; then
12267                         cryptlib=`./loc libcrypt$_a "" $libpth`
12268                 else
12269                         cryptlib=-lcrypt
12270                 fi
12271                 if $test -z "$cryptlib"; then
12272                         echo 'crypt() NOT found.' >&4
12273                         val="$undef"
12274                 else
12275                         val="$define"
12276                 fi
12277         fi
12278         set d_crypt
12279         eval $setvar
12280         ;;
12281 esac
12282
12283 : see if this is a crypt.h system
12284 set crypt.h i_crypt
12285 eval $inhdr
12286
12287 : see if crypt_r exists
12288 set crypt_r d_crypt_r
12289 eval $inlibc
12290 case "$d_crypt_r" in
12291 "$define")
12292         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12293         case "$d_crypt_r_proto:$usethreads" in
12294         ":define")      d_crypt_r_proto=define
12295                 set d_crypt_r_proto crypt_r $hdrs
12296                 eval $hasproto ;;
12297         *)      ;;
12298         esac
12299         case "$d_crypt_r_proto" in
12300         define)
12301         case "$crypt_r_proto" in
12302         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12303         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12304         esac
12305         case "$crypt_r_proto" in
12306         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12307         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12308         esac
12309         case "$crypt_r_proto" in
12310         ''|0)   d_crypt_r=undef
12311                 crypt_r_proto=0
12312                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12313         * )     case "$crypt_r_proto" in
12314                 REENTRANT_PROTO*) ;;
12315                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12316                 esac
12317                 echo "Prototype: $try" ;;
12318         esac
12319         ;;
12320         *)      case "$usethreads" in
12321                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12322                 esac
12323                 d_crypt_r=undef
12324                 crypt_r_proto=0
12325                 ;;
12326         esac
12327         ;;
12328 *)      crypt_r_proto=0
12329         ;;
12330 esac
12331
12332 : get csh whereabouts
12333 case "$csh" in
12334 'csh') val="$undef" ;;
12335 *) val="$define" ;;
12336 esac
12337 set d_csh
12338 eval $setvar
12339 : Respect a hint or command line value for full_csh.
12340 case "$full_csh" in
12341 '') full_csh=$csh ;;
12342 esac
12343
12344 : see if ctermid exists
12345 set ctermid d_ctermid
12346 eval $inlibc
12347
12348 : see if ctermid_r exists
12349 set ctermid_r d_ctermid_r
12350 eval $inlibc
12351 case "$d_ctermid_r" in
12352 "$define")
12353         hdrs="$i_systypes sys/types.h define stdio.h "
12354         case "$d_ctermid_r_proto:$usethreads" in
12355         ":define")      d_ctermid_r_proto=define
12356                 set d_ctermid_r_proto ctermid_r $hdrs
12357                 eval $hasproto ;;
12358         *)      ;;
12359         esac
12360         case "$d_ctermid_r_proto" in
12361         define)
12362         case "$ctermid_r_proto" in
12363         ''|0) try='char* ctermid_r(char*);'
12364         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12365         esac
12366         case "$ctermid_r_proto" in
12367         ''|0)   d_ctermid_r=undef
12368                 ctermid_r_proto=0
12369                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12370         * )     case "$ctermid_r_proto" in
12371                 REENTRANT_PROTO*) ;;
12372                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12373                 esac
12374                 echo "Prototype: $try" ;;
12375         esac
12376         ;;
12377         *)      case "$usethreads" in
12378                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12379                 esac
12380                 d_ctermid_r=undef
12381                 ctermid_r_proto=0
12382                 ;;
12383         esac
12384         ;;
12385 *)      ctermid_r_proto=0
12386         ;;
12387 esac
12388
12389 : see if ctime_r exists
12390 set ctime_r d_ctime_r
12391 eval $inlibc
12392 case "$d_ctime_r" in
12393 "$define")
12394         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12395         case "$d_ctime_r_proto:$usethreads" in
12396         ":define")      d_ctime_r_proto=define
12397                 set d_ctime_r_proto ctime_r $hdrs
12398                 eval $hasproto ;;
12399         *)      ;;
12400         esac
12401         case "$d_ctime_r_proto" in
12402         define)
12403         case "$ctime_r_proto" in
12404         ''|0) try='char* ctime_r(const time_t*, char*);'
12405         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12406         esac
12407         case "$ctime_r_proto" in
12408         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12409         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12410         esac
12411         case "$ctime_r_proto" in
12412         ''|0) try='int ctime_r(const time_t*, char*);'
12413         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12414         esac
12415         case "$ctime_r_proto" in
12416         ''|0) try='int ctime_r(const time_t*, char*, int);'
12417         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12418         esac
12419         case "$ctime_r_proto" in
12420         ''|0)   d_ctime_r=undef
12421                 ctime_r_proto=0
12422                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12423         * )     case "$ctime_r_proto" in
12424                 REENTRANT_PROTO*) ;;
12425                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12426                 esac
12427                 echo "Prototype: $try" ;;
12428         esac
12429         ;;
12430         *)      case "$usethreads" in
12431                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12432                 esac
12433                 d_ctime_r=undef
12434                 ctime_r_proto=0
12435                 ;;
12436         esac
12437         ;;
12438 *)      ctime_r_proto=0
12439         ;;
12440 esac
12441
12442 : see if cuserid exists
12443 set cuserid d_cuserid
12444 eval $inlibc
12445
12446 : see if this is a limits.h system
12447 set limits.h i_limits
12448 eval $inhdr
12449
12450 : See if number of significant digits in a double precision number is known
12451 echo " "
12452 $cat >dbl_dig.c <<EOM
12453 #$i_limits I_LIMITS
12454 #$i_float I_FLOAT
12455 #ifdef I_LIMITS
12456 #include <limits.h>
12457 #endif
12458 #ifdef I_FLOAT
12459 #include <float.h>
12460 #endif
12461 #ifdef DBL_DIG
12462 printf("Contains DBL_DIG");
12463 #endif
12464 EOM
12465 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
12466 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
12467         echo "DBL_DIG found." >&4
12468         val="$define"
12469 else
12470         echo "DBL_DIG NOT found." >&4
12471         val="$undef"
12472 fi
12473 $rm -f dbl_dig.?
12474 set d_dbl_dig
12475 eval $setvar
12476
12477 : see if dbm.h is available
12478 : see if dbmclose exists
12479 set dbmclose d_dbmclose
12480 eval $inlibc
12481
12482 case "$d_dbmclose" in
12483 $define)
12484         set dbm.h i_dbm
12485         eval $inhdr
12486         case "$i_dbm" in
12487         $define)
12488                 val="$undef"
12489                 set i_rpcsvcdbm
12490                 eval $setvar
12491                 ;;
12492         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12493                 eval $inhdr
12494                 ;;
12495         esac
12496         ;;
12497 *)      echo "We won't be including <dbm.h>"
12498         val="$undef"
12499         set i_dbm
12500         eval $setvar
12501         val="$undef"
12502         set i_rpcsvcdbm
12503         eval $setvar
12504         ;;
12505 esac
12506
12507 : see if prototype for dbminit is available
12508 echo " "
12509 set d_dbminitproto dbminit $i_dbm dbm.h
12510 eval $hasproto
12511
12512 : see if difftime exists
12513 set difftime d_difftime
12514 eval $inlibc
12515
12516 : see if this is a dirent system
12517 echo " "
12518 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12519         val="$define"
12520         echo "<dirent.h> found." >&4
12521 else
12522         val="$undef"
12523         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12524                 echo "<sys/dir.h> found." >&4
12525                 echo " "
12526         else
12527                 xinc=`./findhdr sys/ndir.h`
12528         fi
12529         echo "<dirent.h> NOT found." >&4
12530 fi
12531 set i_dirent
12532 eval $setvar
12533
12534 : Look for type of directory structure.
12535 echo " "
12536 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12537
12538 case "$direntrytype" in
12539 ''|' ')
12540         case "$i_dirent" in
12541         $define) guess1='struct dirent' ;;
12542         *) guess1='struct direct'  ;;
12543         esac
12544         ;;
12545 *)      guess1="$direntrytype"
12546         ;;
12547 esac
12548
12549 case "$guess1" in
12550 'struct dirent') guess2='struct direct' ;;
12551 *) guess2='struct dirent' ;;
12552 esac
12553
12554 if $contains "$guess1" try.c >/dev/null 2>&1; then
12555         direntrytype="$guess1"
12556         echo "Your directory entries are $direntrytype." >&4
12557 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12558         direntrytype="$guess2"
12559         echo "Your directory entries seem to be $direntrytype." >&4
12560 else
12561         echo "I don't recognize your system's directory entries." >&4
12562         rp="What type is used for directory entries on this system?"
12563         dflt="$guess1"
12564         . ./myread
12565         direntrytype="$ans"
12566 fi
12567 $rm_try
12568
12569 : see if the directory entry stores field length
12570 echo " "
12571 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12572 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12573         echo "Good, your directory entry keeps length information in d_namlen." >&4
12574         val="$define"
12575 else
12576         echo "Your directory entry does not know about the d_namlen field." >&4
12577         val="$undef"
12578 fi
12579 set d_dirnamlen
12580 eval $setvar
12581 $rm_try
12582
12583 : Look for DIR.dd_fd
12584 case "$i_dirent" in
12585 "$define")
12586     echo "Checking to see if DIR has a dd_fd member variable" >&4
12587     $cat >try.c <<EOCP
12588 #$i_stdlib I_STDLIB
12589 #ifdef I_STDLIB
12590 #include <stdlib.h>
12591 #endif
12592 #include <dirent.h>
12593
12594 int main() {
12595     DIR dir;
12596     dir.dd_fd = 1;
12597     return 0;
12598 }
12599 EOCP
12600     val=$undef
12601     set try
12602     if eval $compile; then
12603         echo "Yes, it does."
12604         val="$define"
12605     else
12606         echo "No, it does not."
12607         val="$undef"
12608     fi
12609     ;;
12610 *)
12611     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12612     val="$undef"
12613     ;;
12614 esac
12615 set d_dir_dd_fd
12616 eval $setvar
12617 $rm_try
12618
12619 : see if this is an sysdir system
12620 set sys/dir.h i_sysdir
12621 eval $inhdr
12622
12623 : see if this is an sysndir system
12624 set sys/ndir.h i_sysndir
12625 eval $inhdr
12626
12627 : Look for dirfd
12628 echo " "
12629 $cat >dirfd.c <<EOM
12630 #include <stdio.h>
12631 #$i_stdlib I_STDLIB
12632 #ifdef I_STDLIB
12633 #include <stdlib.h>
12634 #endif
12635 #$i_dirent I_DIRENT             /**/
12636 #$i_sysdir I_SYS_DIR            /**/
12637 #$i_sysndir I_SYS_NDIR          /**/
12638 #$i_systypes I_SYS_TYPES        /**/
12639 #if defined(I_SYS_TYPES)
12640 #include <sys/types.h>
12641 #endif
12642 #if defined(I_DIRENT)
12643 #include <dirent.h>
12644 #else
12645 #ifdef I_SYS_NDIR
12646 #include <sys/ndir.h>
12647 #else
12648 #ifdef I_SYS_DIR
12649 #ifdef hp9000s500
12650 #include <ndir.h>       /* may be wrong in the future */
12651 #else
12652 #include <sys/dir.h>
12653 #endif
12654 #endif
12655 #endif
12656 #endif
12657 int main() {
12658         DIR *dirp = opendir(".");
12659         if (dirfd(dirp) >= 0)
12660                 exit(0);
12661         else
12662                 exit(1);
12663 }
12664 EOM
12665 val=$undef
12666 set dirfd
12667 if eval $compile; then
12668         val="$define"
12669 fi
12670 case "$val" in
12671 $define)        echo "dirfd() found." >&4       ;;
12672 *)              echo "dirfd() NOT found." >&4   ;;
12673 esac
12674 set d_dirfd
12675 eval $setvar
12676 $rm -f dirfd*
12677
12678 : see if dladdr exists
12679 set dladdr d_dladdr
12680 eval $inlibc
12681
12682 : see if dlerror exists
12683 xxx_runnm="$runnm"
12684 runnm=false
12685 set dlerror d_dlerror
12686 eval $inlibc
12687 runnm="$xxx_runnm"
12688
12689 : see if dlfcn is available
12690 set dlfcn.h i_dlfcn
12691 eval $inhdr
12692
12693 : Check what extension to use for shared libs
12694 case "$usedl" in
12695 $define|y|true)
12696         $cat << EOM
12697
12698 On a few systems, the dynamically loaded modules that perl generates and uses
12699 will need a different extension than shared libs. The default will probably
12700 be appropriate.
12701
12702 EOM
12703         case "$dlext" in
12704         '')     dflt="$so" ;;
12705         *)      dflt="$dlext" ;;
12706         esac
12707         rp='What is the extension of dynamically loaded modules'
12708         . ./myread
12709         dlext="$ans"
12710         ;;
12711 *)
12712         dlext="none"
12713         ;;
12714 esac
12715
12716 : Check if dlsym need a leading underscore
12717 echo " "
12718 val="$undef"
12719
12720 case "$dlsrc" in
12721 dl_dlopen.xs)
12722         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12723         $cat >dyna.c <<'EOM'
12724 fred () { }
12725 EOM
12726
12727 $cat >fred.c<<EOM
12728
12729 #include <stdio.h>
12730 #$i_stdlib I_STDLIB
12731 #ifdef I_STDLIB
12732 #include <stdlib.h>
12733 #endif
12734 #$i_dlfcn I_DLFCN
12735 #ifdef I_DLFCN
12736 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12737 #else
12738 #include <sys/types.h>
12739 #include <nlist.h>
12740 #include <link.h>
12741 #endif
12742
12743 extern int fred() ;
12744
12745 int main()
12746 {
12747     void * handle ;
12748     void * symbol ;
12749 #ifndef RTLD_LAZY
12750     int mode = 1 ;
12751 #else
12752     int mode = RTLD_LAZY ;
12753 #endif
12754     handle = dlopen("./dyna.$dlext", mode) ;
12755     if (handle == NULL) {
12756         printf ("1\n") ;
12757         fflush (stdout) ;
12758         exit(0);
12759     }
12760     symbol = dlsym(handle, "fred") ;
12761     if (symbol == NULL) {
12762         /* try putting a leading underscore */
12763         symbol = dlsym(handle, "_fred") ;
12764         if (symbol == NULL) {
12765             printf ("2\n") ;
12766             fflush (stdout) ;
12767             exit(0);
12768         }
12769         printf ("3\n") ;
12770     }
12771     else
12772         printf ("4\n") ;
12773     fflush (stdout) ;
12774     exit(0);
12775 }
12776 EOM
12777         : Call the object file tmp-dyna.o in case dlext=o.
12778         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12779                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12780                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12781                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12782                 xxx=`$run ./fred`
12783                 case $xxx in
12784                 1)      echo "Test program failed using dlopen." >&4
12785                         echo "Perhaps you should not use dynamic loading." >&4;;
12786                 2)      echo "Test program failed using dlsym." >&4
12787                         echo "Perhaps you should not use dynamic loading." >&4;;
12788                 3)      echo "dlsym needs a leading underscore" >&4
12789                         val="$define" ;;
12790                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12791                 esac
12792         else
12793                 echo "I can't compile and run the test program." >&4
12794                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12795         fi
12796         ;;
12797 esac
12798
12799 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12800
12801 set d_dlsymun
12802 eval $setvar
12803
12804 : see if drand48_r exists
12805 set drand48_r d_drand48_r
12806 eval $inlibc
12807 case "$d_drand48_r" in
12808 "$define")
12809         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12810         case "$d_drand48_r_proto:$usethreads" in
12811         ":define")      d_drand48_r_proto=define
12812                 set d_drand48_r_proto drand48_r $hdrs
12813                 eval $hasproto ;;
12814         *)      ;;
12815         esac
12816         case "$d_drand48_r_proto" in
12817         define)
12818         case "$drand48_r_proto" in
12819         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12820         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12821         esac
12822         case "$drand48_r_proto" in
12823         ''|0)   d_drand48_r=undef
12824                 drand48_r_proto=0
12825                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12826         * )     case "$drand48_r_proto" in
12827                 REENTRANT_PROTO*) ;;
12828                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12829                 esac
12830                 echo "Prototype: $try" ;;
12831         esac
12832         ;;
12833         *)      case "$usethreads" in
12834                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12835                 esac
12836                 d_drand48_r=undef
12837                 drand48_r_proto=0
12838                 ;;
12839         esac
12840         ;;
12841 *)      drand48_r_proto=0
12842         ;;
12843 esac
12844
12845 : see if prototype for drand48 is available
12846 echo " "
12847 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12848 eval $hasproto
12849
12850 : see if dup2 exists
12851 set dup2 d_dup2
12852 eval $inlibc
12853
12854 : see if eaccess exists
12855 set eaccess d_eaccess
12856 eval $inlibc
12857
12858 : see if endgrent exists
12859 set endgrent d_endgrent
12860 eval $inlibc
12861
12862 : see if this is an grp system
12863 set grp.h i_grp
12864 eval $inhdr
12865
12866 case "$i_grp" in
12867 $define)
12868         xxx=`./findhdr grp.h`
12869         $cppstdin $cppflags $cppminus < $xxx >$$.h
12870
12871         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12872                 val="$define"
12873         else
12874                 val="$undef"
12875         fi
12876         set d_grpasswd
12877         eval $setvar
12878
12879         $rm -f $$.h
12880         ;;
12881 *)
12882         val="$undef";
12883         set d_grpasswd; eval $setvar
12884         ;;
12885 esac
12886
12887 : see if endgrent_r exists
12888 set endgrent_r d_endgrent_r
12889 eval $inlibc
12890 case "$d_endgrent_r" in
12891 "$define")
12892         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12893         case "$d_endgrent_r_proto:$usethreads" in
12894         ":define")      d_endgrent_r_proto=define
12895                 set d_endgrent_r_proto endgrent_r $hdrs
12896                 eval $hasproto ;;
12897         *)      ;;
12898         esac
12899         case "$d_endgrent_r_proto" in
12900         define)
12901         case "$endgrent_r_proto" in
12902         ''|0) try='int endgrent_r(FILE**);'
12903         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12904         esac
12905         case "$endgrent_r_proto" in
12906         ''|0) try='void endgrent_r(FILE**);'
12907         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12908         esac
12909         case "$endgrent_r_proto" in
12910         ''|0)   d_endgrent_r=undef
12911                 endgrent_r_proto=0
12912                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12913         * )     case "$endgrent_r_proto" in
12914                 REENTRANT_PROTO*) ;;
12915                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12916                 esac
12917                 echo "Prototype: $try" ;;
12918         esac
12919         ;;
12920         *)      case "$usethreads" in
12921                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12922                 esac
12923                 d_endgrent_r=undef
12924                 endgrent_r_proto=0
12925                 ;;
12926         esac
12927         ;;
12928 *)      endgrent_r_proto=0
12929         ;;
12930 esac
12931
12932 : see if endhostent exists
12933 set endhostent d_endhent
12934 eval $inlibc
12935
12936 : see if this is a netdb.h system
12937 set netdb.h i_netdb
12938 eval $inhdr
12939
12940 : see if endhostent_r exists
12941 set endhostent_r d_endhostent_r
12942 eval $inlibc
12943 case "$d_endhostent_r" in
12944 "$define")
12945         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12946         case "$d_endhostent_r_proto:$usethreads" in
12947         ":define")      d_endhostent_r_proto=define
12948                 set d_endhostent_r_proto endhostent_r $hdrs
12949                 eval $hasproto ;;
12950         *)      ;;
12951         esac
12952         case "$d_endhostent_r_proto" in
12953         define)
12954         case "$endhostent_r_proto" in
12955         ''|0) try='int endhostent_r(struct hostent_data*);'
12956         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12957         esac
12958         case "$endhostent_r_proto" in
12959         ''|0) try='void endhostent_r(struct hostent_data*);'
12960         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12961         esac
12962         case "$endhostent_r_proto" in
12963         ''|0)   d_endhostent_r=undef
12964                 endhostent_r_proto=0
12965                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12966         * )     case "$endhostent_r_proto" in
12967                 REENTRANT_PROTO*) ;;
12968                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12969                 esac
12970                 echo "Prototype: $try" ;;
12971         esac
12972         ;;
12973         *)      case "$usethreads" in
12974                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12975                 esac
12976                 d_endhostent_r=undef
12977                 endhostent_r_proto=0
12978                 ;;
12979         esac
12980         ;;
12981 *)      endhostent_r_proto=0
12982         ;;
12983 esac
12984
12985 : see if endnetent exists
12986 set endnetent d_endnent
12987 eval $inlibc
12988
12989 : see if endnetent_r exists
12990 set endnetent_r d_endnetent_r
12991 eval $inlibc
12992 case "$d_endnetent_r" in
12993 "$define")
12994         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12995         case "$d_endnetent_r_proto:$usethreads" in
12996         ":define")      d_endnetent_r_proto=define
12997                 set d_endnetent_r_proto endnetent_r $hdrs
12998                 eval $hasproto ;;
12999         *)      ;;
13000         esac
13001         case "$d_endnetent_r_proto" in
13002         define)
13003         case "$endnetent_r_proto" in
13004         ''|0) try='int endnetent_r(struct netent_data*);'
13005         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
13006         esac
13007         case "$endnetent_r_proto" in
13008         ''|0) try='void endnetent_r(struct netent_data*);'
13009         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
13010         esac
13011         case "$endnetent_r_proto" in
13012         ''|0)   d_endnetent_r=undef
13013                 endnetent_r_proto=0
13014                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
13015         * )     case "$endnetent_r_proto" in
13016                 REENTRANT_PROTO*) ;;
13017                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
13018                 esac
13019                 echo "Prototype: $try" ;;
13020         esac
13021         ;;
13022         *)      case "$usethreads" in
13023                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
13024                 esac
13025                 d_endnetent_r=undef
13026                 endnetent_r_proto=0
13027                 ;;
13028         esac
13029         ;;
13030 *)      endnetent_r_proto=0
13031         ;;
13032 esac
13033
13034 : see if endprotoent exists
13035 set endprotoent d_endpent
13036 eval $inlibc
13037
13038 : see if endprotoent_r exists
13039 set endprotoent_r d_endprotoent_r
13040 eval $inlibc
13041 case "$d_endprotoent_r" in
13042 "$define")
13043         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13044         case "$d_endprotoent_r_proto:$usethreads" in
13045         ":define")      d_endprotoent_r_proto=define
13046                 set d_endprotoent_r_proto endprotoent_r $hdrs
13047                 eval $hasproto ;;
13048         *)      ;;
13049         esac
13050         case "$d_endprotoent_r_proto" in
13051         define)
13052         case "$endprotoent_r_proto" in
13053         ''|0) try='int endprotoent_r(struct protoent_data*);'
13054         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
13055         esac
13056         case "$endprotoent_r_proto" in
13057         ''|0) try='void endprotoent_r(struct protoent_data*);'
13058         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
13059         esac
13060         case "$endprotoent_r_proto" in
13061         ''|0)   d_endprotoent_r=undef
13062                 endprotoent_r_proto=0
13063                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
13064         * )     case "$endprotoent_r_proto" in
13065                 REENTRANT_PROTO*) ;;
13066                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
13067                 esac
13068                 echo "Prototype: $try" ;;
13069         esac
13070         ;;
13071         *)      case "$usethreads" in
13072                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
13073                 esac
13074                 d_endprotoent_r=undef
13075                 endprotoent_r_proto=0
13076                 ;;
13077         esac
13078         ;;
13079 *)      endprotoent_r_proto=0
13080         ;;
13081 esac
13082
13083 : see if endpwent exists
13084 set endpwent d_endpwent
13085 eval $inlibc
13086
13087 : see if this is a pwd.h system
13088 set pwd.h i_pwd
13089 eval $inhdr
13090
13091 case "$i_pwd" in
13092 $define)
13093         xxx=`./findhdr pwd.h`
13094         $cppstdin $cppflags $cppminus < $xxx >$$.h
13095
13096         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
13097                 val="$define"
13098         else
13099                 val="$undef"
13100         fi
13101         set d_pwquota
13102         eval $setvar
13103
13104         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
13105                 val="$define"
13106         else
13107                 val="$undef"
13108         fi
13109         set d_pwage
13110         eval $setvar
13111
13112         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
13113                 val="$define"
13114         else
13115                 val="$undef"
13116         fi
13117         set d_pwchange
13118         eval $setvar
13119
13120         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
13121                 val="$define"
13122         else
13123                 val="$undef"
13124         fi
13125         set d_pwclass
13126         eval $setvar
13127
13128         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
13129                 val="$define"
13130         else
13131                 val="$undef"
13132         fi
13133         set d_pwexpire
13134         eval $setvar
13135
13136         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
13137                 val="$define"
13138         else
13139                 val="$undef"
13140         fi
13141         set d_pwcomment
13142         eval $setvar
13143
13144         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
13145                 val="$define"
13146         else
13147                 val="$undef"
13148         fi
13149         set d_pwgecos
13150         eval $setvar
13151
13152         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
13153                 val="$define"
13154         else
13155                 val="$undef"
13156         fi
13157         set d_pwpasswd
13158         eval $setvar
13159
13160         $rm -f $$.h
13161         ;;
13162 *)
13163         val="$undef";
13164         set d_pwquota; eval $setvar
13165         set d_pwage; eval $setvar
13166         set d_pwchange; eval $setvar
13167         set d_pwclass; eval $setvar
13168         set d_pwexpire; eval $setvar
13169         set d_pwcomment; eval $setvar
13170         set d_pwgecos; eval $setvar
13171         set d_pwpasswd; eval $setvar
13172         ;;
13173 esac
13174
13175 : see if endpwent_r exists
13176 set endpwent_r d_endpwent_r
13177 eval $inlibc
13178 case "$d_endpwent_r" in
13179 "$define")
13180         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13181         case "$d_endpwent_r_proto:$usethreads" in
13182         ":define")      d_endpwent_r_proto=define
13183                 set d_endpwent_r_proto endpwent_r $hdrs
13184                 eval $hasproto ;;
13185         *)      ;;
13186         esac
13187         case "$d_endpwent_r_proto" in
13188         define)
13189         case "$endpwent_r_proto" in
13190         ''|0) try='int endpwent_r(FILE**);'
13191         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13192         esac
13193         case "$endpwent_r_proto" in
13194         ''|0) try='void endpwent_r(FILE**);'
13195         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13196         esac
13197         case "$endpwent_r_proto" in
13198         ''|0)   d_endpwent_r=undef
13199                 endpwent_r_proto=0
13200                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13201         * )     case "$endpwent_r_proto" in
13202                 REENTRANT_PROTO*) ;;
13203                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13204                 esac
13205                 echo "Prototype: $try" ;;
13206         esac
13207         ;;
13208         *)      case "$usethreads" in
13209                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13210                 esac
13211                 d_endpwent_r=undef
13212                 endpwent_r_proto=0
13213                 ;;
13214         esac
13215         ;;
13216 *)      endpwent_r_proto=0
13217         ;;
13218 esac
13219
13220 : see if endservent exists
13221 set endservent d_endsent
13222 eval $inlibc
13223
13224 : see if endservent_r exists
13225 set endservent_r d_endservent_r
13226 eval $inlibc
13227 case "$d_endservent_r" in
13228 "$define")
13229         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13230         case "$d_endservent_r_proto:$usethreads" in
13231         ":define")      d_endservent_r_proto=define
13232                 set d_endservent_r_proto endservent_r $hdrs
13233                 eval $hasproto ;;
13234         *)      ;;
13235         esac
13236         case "$d_endservent_r_proto" in
13237         define)
13238         case "$endservent_r_proto" in
13239         ''|0) try='int endservent_r(struct servent_data*);'
13240         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13241         esac
13242         case "$endservent_r_proto" in
13243         ''|0) try='void endservent_r(struct servent_data*);'
13244         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13245         esac
13246         case "$endservent_r_proto" in
13247         ''|0)   d_endservent_r=undef
13248                 endservent_r_proto=0
13249                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13250         * )     case "$endservent_r_proto" in
13251                 REENTRANT_PROTO*) ;;
13252                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13253                 esac
13254                 echo "Prototype: $try" ;;
13255         esac
13256         ;;
13257         *)      case "$usethreads" in
13258                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13259                 esac
13260                 d_endservent_r=undef
13261                 endservent_r_proto=0
13262                 ;;
13263         esac
13264         ;;
13265 *)      endservent_r_proto=0
13266         ;;
13267 esac
13268
13269 : Locate the flags for 'open()'
13270 echo " "
13271 $cat >try.c <<EOCP
13272 #include <sys/types.h>
13273 #ifdef I_FCNTL
13274 #include <fcntl.h>
13275 #endif
13276 #ifdef I_SYS_FILE
13277 #include <sys/file.h>
13278 #endif
13279 #$i_stdlib I_STDLIB
13280 #ifdef I_STDLIB
13281 #include <stdlib.h>
13282 #endif
13283 int main() {
13284         if(O_RDONLY);
13285 #ifdef O_TRUNC
13286         exit(0);
13287 #else
13288         exit(1);
13289 #endif
13290 }
13291 EOCP
13292 : check sys/file.h first to get FREAD on Sun
13293 if $test `./findhdr sys/file.h` && \
13294                 set try -DI_SYS_FILE && eval $compile; then
13295         h_sysfile=true;
13296         echo "<sys/file.h> defines the O_* constants..." >&4
13297         if $run ./try; then
13298                 echo "and you have the 3 argument form of open()." >&4
13299                 val="$define"
13300         else
13301                 echo "but not the 3 argument form of open().  Oh, well." >&4
13302                 val="$undef"
13303         fi
13304 elif $test `./findhdr fcntl.h` && \
13305                 set try -DI_FCNTL && eval $compile; then
13306         h_fcntl=true;
13307         echo "<fcntl.h> defines the O_* constants..." >&4
13308         if $run ./try; then
13309                 echo "and you have the 3 argument form of open()." >&4
13310                 val="$define"
13311         else
13312                 echo "but not the 3 argument form of open().  Oh, well." >&4
13313                 val="$undef"
13314         fi
13315 else
13316         val="$undef"
13317         echo "I can't find the O_* constant definitions!  You got problems." >&4
13318 fi
13319 set d_open3
13320 eval $setvar
13321 $rm_try
13322
13323 : see if this is a sys/file.h system
13324 val=''
13325 set sys/file.h val
13326 eval $inhdr
13327
13328 : do we need to include sys/file.h ?
13329 case "$val" in
13330 "$define")
13331         echo " "
13332         if $h_sysfile; then
13333                 val="$define"
13334                 echo "We'll be including <sys/file.h>." >&4
13335         else
13336                 val="$undef"
13337                 echo "We won't be including <sys/file.h>." >&4
13338         fi
13339         ;;
13340 *)
13341         h_sysfile=false
13342         ;;
13343 esac
13344 set i_sysfile
13345 eval $setvar
13346
13347 : see if fcntl.h is there
13348 val=''
13349 set fcntl.h val
13350 eval $inhdr
13351
13352 : see if we can include fcntl.h
13353 case "$val" in
13354 "$define")
13355         echo " "
13356         if $h_fcntl; then
13357                 val="$define"
13358                 echo "We'll be including <fcntl.h>." >&4
13359         else
13360                 val="$undef"
13361                 if $h_sysfile; then
13362         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13363                 else
13364                         echo "We won't be including <fcntl.h>." >&4
13365                 fi
13366         fi
13367         ;;
13368 *)
13369         h_fcntl=false
13370         val="$undef"
13371         ;;
13372 esac
13373 set i_fcntl
13374 eval $setvar
13375
13376 : see if fork exists
13377 set fork d_fork
13378 eval $inlibc
13379
13380 : see if pipe exists
13381 set pipe d_pipe
13382 eval $inlibc
13383
13384 : check for non-blocking I/O stuff
13385 case "$h_sysfile" in
13386 true) echo "#include <sys/file.h>" > head.c;;
13387 *)
13388        case "$h_fcntl" in
13389        true) echo "#include <fcntl.h>" > head.c;;
13390        *) echo "#include <sys/fcntl.h>" > head.c;;
13391        esac
13392        ;;
13393 esac
13394 echo " "
13395 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13396 case "$o_nonblock" in
13397 '')
13398         $cat head.c > try.c
13399         $cat >>try.c <<EOCP
13400 #include <stdio.h>
13401 #$i_stdlib I_STDLIB
13402 #ifdef I_STDLIB
13403 #include <stdlib.h>
13404 #endif
13405 #$i_fcntl I_FCNTL
13406 #ifdef I_FCNTL
13407 #include <fcntl.h>
13408 #endif
13409 int main() {
13410 #ifdef O_NONBLOCK
13411         printf("O_NONBLOCK\n");
13412         exit(0);
13413 #endif
13414 #ifdef O_NDELAY
13415         printf("O_NDELAY\n");
13416         exit(0);
13417 #endif
13418 #ifdef FNDELAY
13419         printf("FNDELAY\n");
13420         exit(0);
13421 #endif
13422         exit(0);
13423 }
13424 EOCP
13425         set try
13426         if eval $compile_ok; then
13427                 o_nonblock=`$run ./try`
13428                 case "$o_nonblock" in
13429                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13430                 *) echo "Seems like we can use $o_nonblock.";;
13431                 esac
13432         else
13433                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13434         fi
13435         ;;
13436 *) echo "Using $hint value $o_nonblock.";;
13437 esac
13438 $rm_try
13439
13440 echo " "
13441 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13442 case "$eagain" in
13443 '')
13444         case "$d_fork:$d_pipe:$d_alarm" in
13445         define:define:define)
13446         $cat head.c > try.c
13447         $cat >>try.c <<EOCP
13448 #include <errno.h>
13449 #include <sys/types.h>
13450 #include <signal.h>
13451 #include <stdio.h>
13452 #$i_stdlib I_STDLIB
13453 #ifdef I_STDLIB
13454 #include <stdlib.h>
13455 #endif
13456 #$i_fcntl I_FCNTL
13457 #ifdef I_FCNTL
13458 #include <fcntl.h>
13459 #endif
13460 #define MY_O_NONBLOCK $o_nonblock
13461 #ifndef errno  /* XXX need better Configure test */
13462 extern int errno;
13463 #endif
13464 #$i_unistd I_UNISTD
13465 #ifdef I_UNISTD
13466 #include <unistd.h>
13467 #endif
13468 #$i_string I_STRING
13469 #ifdef I_STRING
13470 #include <string.h>
13471 #else
13472 #include <strings.h>
13473 #endif
13474 $signal_t blech(int x) { exit(3); }
13475 EOCP
13476         $cat >> try.c <<'EOCP'
13477 int main()
13478 {
13479         int pd[2];
13480         int pu[2];
13481         char buf[1];
13482         char string[100];
13483         int ret;
13484
13485         ret = pipe(pd); /* Down: child -> parent */
13486         if (ret != 0)
13487                 exit(3);
13488         ret = pipe(pu); /* Up: parent -> child */
13489         if (ret != 0)
13490                 exit(3);
13491         if (0 != fork()) {
13492                 close(pd[1]);   /* Parent reads from pd[0] */
13493                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13494 #ifdef F_SETFL
13495                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13496                         exit(1);
13497 #else
13498                 exit(4);
13499 #endif
13500                 signal(SIGALRM, blech);
13501                 alarm(5);
13502                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13503                         exit(2);
13504                 sprintf(string, "%d\n", ret);
13505                 ret = write(2, string, strlen(string));
13506                 if (ret != strlen(string))
13507                         exit(3);
13508                 alarm(0);
13509 #ifdef EAGAIN
13510                 if (errno == EAGAIN) {
13511                         printf("EAGAIN\n");
13512                         goto ok;
13513                 }
13514 #endif
13515 #ifdef EWOULDBLOCK
13516                 if (errno == EWOULDBLOCK)
13517                         printf("EWOULDBLOCK\n");
13518 #endif
13519         ok:
13520                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13521                 if (ret != 1)
13522                         exit(3);
13523                 sleep(2);                               /* Give it time to close our pipe */
13524                 alarm(5);
13525                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13526                 alarm(0);
13527                 sprintf(string, "%d\n", ret);
13528                 ret = write(4, string, strlen(string));
13529                 if (ret != strlen(string))
13530                         exit(3);
13531                 exit(0);
13532         }
13533
13534         close(pd[0]);                   /* We write to pd[1] */
13535         close(pu[1]);                   /* We read from pu[0] */
13536         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13537         if (ret != 1)
13538                 exit(3);
13539         close(pd[1]);                   /* Pipe pd is now fully closed! */
13540         exit(0);                                /* Bye bye, thank you for playing! */
13541 }
13542 EOCP
13543         set try
13544         if eval $compile_ok; then
13545                 echo "$startsh" >mtry
13546                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13547                 chmod +x mtry
13548                 $run ./mtry >/dev/null 2>&1
13549                 case $? in
13550                 0) eagain=`$cat try.out`;;
13551                 1) echo "Could not perform non-blocking setting!";;
13552                 2) echo "I did a successful read() for something that was not there!";;
13553                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13554                 4) echo "Could not find F_SETFL!";;
13555                 *) echo "Something terribly wrong happened during testing.";;
13556                 esac
13557                 rd_nodata=`$cat try.ret`
13558                 echo "A read() system call with no data present returns $rd_nodata."
13559                 case "$rd_nodata" in
13560                 0|-1) ;;
13561                 *)
13562                         echo "(That's peculiar, fixing that to be -1.)"
13563                         rd_nodata=-1
13564                         ;;
13565                 esac
13566                 case "$eagain" in
13567                 '')
13568                         echo "Forcing errno EAGAIN on read() with no data available."
13569                         eagain=EAGAIN
13570                         ;;
13571                 *)
13572                         echo "Your read() sets errno to $eagain when no data is available."
13573                         ;;
13574                 esac
13575                 status=`$cat try.err`
13576                 case "$status" in
13577                 0) echo "And it correctly returns 0 to signal EOF.";;
13578                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13579                 *) echo "However, your read() returns '$status' on EOF??";;
13580                 esac
13581                 val="$define"
13582                 if test "$status" = "$rd_nodata"; then
13583                         echo "WARNING: you can't distinguish between EOF and no data!"
13584                         val="$undef"
13585                 fi
13586         else
13587                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13588                 eagain=EAGAIN
13589         fi
13590         ;;
13591         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13592                 eagain=EAGAIN
13593                 val="$define"
13594                 ;;
13595         esac
13596         set d_eofnblk
13597         eval $setvar
13598         ;;
13599 *)
13600         echo "Using $hint value $eagain."
13601         echo "Your read() returns $rd_nodata when no data is present."
13602         case "$d_eofnblk" in
13603         "$define") echo "And you can see EOF because read() returns 0.";;
13604         "$undef") echo "But you can't see EOF status from read() returned value.";;
13605         *)
13606                 echo "(Assuming you can't see EOF status from read anyway.)"
13607                 d_eofnblk=$undef
13608                 ;;
13609         esac
13610         ;;
13611 esac
13612 $rm_try head.c mtry
13613
13614 : see if erf exists
13615 set erf d_erf
13616 eval $inlibc
13617
13618 : see if erfc exists
13619 set erfc d_erfc
13620 eval $inlibc
13621
13622 : see if exp2 exists
13623 set exp2 d_exp2
13624 eval $inlibc
13625
13626 : see if expm1 exists
13627 set expm1 d_expm1
13628 eval $inlibc
13629
13630 : see if _ptr and _cnt from stdio act std
13631 echo " "
13632
13633 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13634         echo "(Looks like you have stdio.h from BSD.)"
13635         case "$stdio_ptr" in
13636         '') stdio_ptr='((fp)->_p)'
13637                 ptr_lval=$define
13638                 ;;
13639         *)      ptr_lval=$d_stdio_ptr_lval;;
13640         esac
13641         case "$stdio_cnt" in
13642         '') stdio_cnt='((fp)->_r)'
13643                 cnt_lval=$define
13644                 ;;
13645         *)      cnt_lval=$d_stdio_cnt_lval;;
13646         esac
13647         case "$stdio_base" in
13648         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13649         esac
13650         case "$stdio_bufsiz" in
13651         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13652         esac
13653 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13654         echo "(Looks like you have stdio.h from Linux.)"
13655         case "$stdio_ptr" in
13656         '') stdio_ptr='((fp)->_IO_read_ptr)'
13657                 ptr_lval=$define
13658                 ;;
13659         *)      ptr_lval=$d_stdio_ptr_lval;;
13660         esac
13661         case "$stdio_cnt" in
13662         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13663                 cnt_lval=$undef
13664                 ;;
13665         *)      cnt_lval=$d_stdio_cnt_lval;;
13666         esac
13667         case "$stdio_base" in
13668         '') stdio_base='((fp)->_IO_read_base)';;
13669         esac
13670         case "$stdio_bufsiz" in
13671         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13672         esac
13673 else
13674         case "$stdio_ptr" in
13675         '') stdio_ptr='((fp)->_ptr)'
13676                 ptr_lval=$define
13677                 ;;
13678         *)      ptr_lval=$d_stdio_ptr_lval;;
13679         esac
13680         case "$stdio_cnt" in
13681         '') stdio_cnt='((fp)->_cnt)'
13682                 cnt_lval=$define
13683                 ;;
13684         *)      cnt_lval=$d_stdio_cnt_lval;;
13685         esac
13686         case "$stdio_base" in
13687         '') stdio_base='((fp)->_base)';;
13688         esac
13689         case "$stdio_bufsiz" in
13690         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13691         esac
13692 fi
13693
13694 : test whether _ptr and _cnt really work
13695 echo "Checking how std your stdio is..." >&4
13696 $cat >try.c <<EOP
13697 #include <stdio.h>
13698 #$i_stdlib I_STDLIB
13699 #ifdef I_STDLIB
13700 #include <stdlib.h>
13701 #endif
13702 #define FILE_ptr(fp)    $stdio_ptr
13703 #define FILE_cnt(fp)    $stdio_cnt
13704 int main() {
13705         FILE *fp = fopen("try.c", "r");
13706         char c = getc(fp);
13707         if (
13708                 18 <= FILE_cnt(fp) &&
13709                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13710         )
13711                 exit(0);
13712         exit(1);
13713 }
13714 EOP
13715 val="$undef"
13716 set try
13717 if eval $compile && $to try.c; then
13718         if $run ./try; then
13719                 echo "Your stdio acts pretty std."
13720                 val="$define"
13721         else
13722                 echo "Your stdio isn't very std."
13723         fi
13724 else
13725         echo "Your stdio doesn't appear very std."
13726 fi
13727 $rm_try
13728
13729 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13730 # direct buffer manipulation no longer works.  The Configure tests
13731 # should be changed to correctly detect this, but until then,
13732 # the following check should at least let perl compile and run.
13733 # (This quick fix should be updated before 5.8.1.)
13734 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13735 # A. Dougherty, June 3, 2002.
13736 case "$d_gnulibc" in
13737 $define)
13738         case "$gnulibc_version" in
13739         2.[01]*)  ;;
13740         2.2) ;;
13741         2.2.[0-9]) ;;
13742         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13743                 val="$undef"
13744                 ;;
13745         esac
13746         ;;
13747 esac
13748 set d_stdstdio
13749 eval $setvar
13750
13751 : Can _ptr be used as an lvalue?
13752 case "$d_stdstdio$ptr_lval" in
13753 $define$define) val=$define ;;
13754 *) val=$undef ;;
13755 esac
13756 set d_stdio_ptr_lval
13757 eval $setvar
13758
13759 : Can _cnt be used as an lvalue?
13760 case "$d_stdstdio$cnt_lval" in
13761 $define$define) val=$define ;;
13762 *) val=$undef ;;
13763 esac
13764 set d_stdio_cnt_lval
13765 eval $setvar
13766
13767
13768 : test whether setting _ptr sets _cnt as a side effect
13769 d_stdio_ptr_lval_sets_cnt="$undef"
13770 d_stdio_ptr_lval_nochange_cnt="$undef"
13771 case "$d_stdio_ptr_lval$d_stdstdio" in
13772 $define$define)
13773         echo "Checking to see what happens if we set the stdio ptr..." >&4
13774 $cat >try.c <<EOP
13775 #include <stdio.h>
13776 /* Can we scream? */
13777 /* Eat dust sed :-) */
13778 /* In the buffer space, no one can hear you scream. */
13779 #$i_stdlib I_STDLIB
13780 #ifdef I_STDLIB
13781 #include <stdlib.h>
13782 #endif
13783 #define FILE_ptr(fp)    $stdio_ptr
13784 #define FILE_cnt(fp)    $stdio_cnt
13785 #include <sys/types.h>
13786 int main() {
13787         FILE *fp = fopen("try.c", "r");
13788         int c;
13789         char *ptr;
13790         size_t cnt;
13791         if (!fp) {
13792             puts("Fail even to read");
13793             exit(1);
13794         }
13795         c = getc(fp); /* Read away the first # */
13796         if (c == EOF) {
13797             puts("Fail even to read");
13798             exit(1);
13799         }
13800         if (!(
13801                 18 <= FILE_cnt(fp) &&
13802                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13803         )) {
13804                 puts("Fail even to read");
13805                 exit (1);
13806         }
13807         ptr = (char*) FILE_ptr(fp);
13808         cnt = (size_t)FILE_cnt(fp);
13809
13810         FILE_ptr(fp) += 42;
13811
13812         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13813                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13814                 exit (1);
13815         }
13816         if (FILE_cnt(fp) <= 20) {
13817                 printf ("Fail (<20 chars to test)");
13818                 exit (1);
13819         }
13820         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13821                 puts("Fail compare");
13822                 exit (1);
13823         }
13824         if (cnt == FILE_cnt(fp)) {
13825                 puts("Pass_unchanged");
13826                 exit (0);
13827         }
13828         if (FILE_cnt(fp) == (cnt - 42)) {
13829                 puts("Pass_changed");
13830                 exit (0);
13831         }
13832         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13833         return 1;
13834
13835 }
13836 EOP
13837         set try
13838         if eval $compile && $to try.c; then
13839                 case `$run ./try` in
13840                 Pass_changed)
13841                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13842                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13843                 Pass_unchanged)
13844                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13845                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13846                 Fail*)
13847                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13848                 *)
13849                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13850         esac
13851         else
13852                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13853         fi
13854         $rm_try
13855         ;;
13856 esac
13857
13858 : see if _base is also standard
13859 val="$undef"
13860 case "$d_stdstdio" in
13861 $define)
13862         $cat >try.c <<EOP
13863 #include <stdio.h>
13864 #$i_stdlib I_STDLIB
13865 #ifdef I_STDLIB
13866 #include <stdlib.h>
13867 #endif
13868 #define FILE_base(fp)   $stdio_base
13869 #define FILE_bufsiz(fp) $stdio_bufsiz
13870 int main() {
13871         FILE *fp = fopen("try.c", "r");
13872         char c = getc(fp);
13873         if (
13874                 19 <= FILE_bufsiz(fp) &&
13875                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13876         )
13877                 exit(0);
13878         exit(1);
13879 }
13880 EOP
13881         set try
13882         if eval $compile && $to try.c; then
13883                 if $run ./try; then
13884                         echo "And its _base field acts std."
13885                         val="$define"
13886                 else
13887                         echo "But its _base field isn't std."
13888                 fi
13889         else
13890                 echo "However, it seems to be lacking the _base field."
13891         fi
13892         $rm_try
13893         ;;
13894 esac
13895 set d_stdiobase
13896 eval $setvar
13897
13898 : see if fast_stdio exists
13899 val="$undef"
13900 case "$d_stdstdio:$d_stdio_ptr_lval" in
13901 "$define:$define")
13902         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13903         *$define*)
13904                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13905                 val="$define"
13906                 ;;
13907         esac
13908         ;;
13909 esac
13910 set d_faststdio
13911 eval $setvar
13912
13913
13914
13915 : see if fchdir exists
13916 set fchdir d_fchdir
13917 eval $inlibc
13918
13919 : see if fchmod exists
13920 set fchmod d_fchmod
13921 eval $inlibc
13922
13923 : see if fchown exists
13924 set fchown d_fchown
13925 eval $inlibc
13926
13927 : see if this is an fcntl system
13928 set fcntl d_fcntl
13929 eval $inlibc
13930
13931 : See if fcntl-based locking works.
13932 echo " "
13933 $cat >try.c <<EOCP
13934 #$i_stdlib I_STDLIB
13935 #ifdef I_STDLIB
13936 #include <stdlib.h>
13937 #endif
13938 #include <unistd.h>
13939 #include <fcntl.h>
13940 #include <signal.h>
13941 $signal_t blech(int x) { exit(3); }
13942 int main() {
13943 #if defined(F_SETLK) && defined(F_SETLKW)
13944      struct flock flock;
13945      int retval, fd;
13946      fd = open("try.c", O_RDONLY);
13947      flock.l_type = F_RDLCK;
13948      flock.l_whence = SEEK_SET;
13949      flock.l_start = flock.l_len = 0;
13950      signal(SIGALRM, blech);
13951      alarm(10);
13952      retval = fcntl(fd, F_SETLK, &flock);
13953      close(fd);
13954      (retval < 0 ? exit(2) : exit(0));
13955 #else
13956      exit(2);
13957 #endif
13958 }
13959 EOCP
13960 echo "Checking if fcntl-based file locking works... "
13961 case "$d_fcntl" in
13962 "$define")
13963         set try
13964         if eval $compile_ok; then
13965                 if $run ./try; then
13966                         echo "Yes, it seems to work."
13967                         val="$define"
13968                 else
13969                         echo "Nope, it didn't work."
13970                         val="$undef"
13971                         case "$?" in
13972                         3) $cat >&4 <<EOM
13973 ***
13974 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13975 *** This is (almost) impossible.
13976 *** If your NFS lock daemons are not feeling well, something like
13977 *** this may happen, please investigate.  Cannot continue, aborting.
13978 ***
13979 EOM
13980                                 exit 1
13981                                 ;;
13982                         esac
13983                 fi
13984         else
13985                 echo "I'm unable to compile the test program, so I'll assume not."
13986                 val="$undef"
13987         fi
13988         ;;
13989 *) val="$undef";
13990         echo "Nope, since you don't even have fcntl()."
13991         ;;
13992 esac
13993 set d_fcntl_can_lock
13994 eval $setvar
13995 $rm_try
13996
13997 : check for fd_set items
13998 $cat <<EOM
13999
14000 Checking to see how well your C compiler handles fd_set and friends ...
14001 EOM
14002 $cat >try.c <<EOCP
14003 #$i_stdlib I_STDLIB
14004 #ifdef I_STDLIB
14005 #include <stdlib.h>
14006 #endif
14007 #$i_systime I_SYS_TIME
14008 #$i_sysselct I_SYS_SELECT
14009 #$d_socket HAS_SOCKET
14010 #include <sys/types.h>
14011 #ifdef HAS_SOCKET
14012 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14013 #endif
14014 #ifdef I_SYS_TIME
14015 #include <sys/time.h>
14016 #endif
14017 #ifdef I_SYS_SELECT
14018 #include <sys/select.h>
14019 #endif
14020 int main() {
14021         fd_set fds;
14022
14023 #ifdef TRYBITS
14024         if(fds.fds_bits);
14025 #endif
14026
14027 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
14028         exit(0);
14029 #else
14030         exit(1);
14031 #endif
14032 }
14033 EOCP
14034 set try -DTRYBITS
14035 if eval $compile; then
14036         d_fds_bits="$define"
14037         d_fd_set="$define"
14038         echo "Well, your system knows about the normal fd_set typedef..." >&4
14039         if $run ./try; then
14040                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
14041                 d_fd_macros="$define"
14042         else
14043                 $cat >&4 <<'EOM'
14044 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
14045 EOM
14046                 d_fd_macros="$undef"
14047         fi
14048 else
14049         $cat <<'EOM'
14050 Hmm, your compiler has some difficulty with fd_set.  Checking further...
14051 EOM
14052         set try
14053         if eval $compile; then
14054                 d_fds_bits="$undef"
14055                 d_fd_set="$define"
14056                 echo "Well, your system has some sort of fd_set available..." >&4
14057                 if $run ./try; then
14058                         echo "and you have the normal fd_set macros." >&4
14059                         d_fd_macros="$define"
14060                 else
14061                         $cat <<'EOM'
14062 but not the normal fd_set macros!  Gross!  More work for me...
14063 EOM
14064                         d_fd_macros="$undef"
14065                 fi
14066         else
14067         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
14068                 d_fd_set="$undef"
14069                 d_fds_bits="$undef"
14070                 d_fd_macros="$undef"
14071         fi
14072 fi
14073 $rm_try
14074
14075 : see if fdclose exists
14076 set fdclose d_fdclose
14077 eval $inlibc
14078
14079 : see if fdim exists
14080 set fdim d_fdim
14081 eval $inlibc
14082
14083 : see if fegetround exists
14084 set fegetround d_fegetround
14085 eval $inlibc
14086
14087 : see if fgetpos exists
14088 set fgetpos d_fgetpos
14089 eval $inlibc
14090
14091 : see if finite exists
14092 set finite d_finite
14093 eval $inlibc
14094
14095 : see if finitel exists
14096 set finitel d_finitel
14097 eval $inlibc
14098
14099 : see if flock exists
14100 set flock d_flock
14101 eval $inlibc
14102
14103 : see if prototype for flock is available
14104 echo " "
14105 set d_flockproto flock $i_sysfile sys/file.h
14106 eval $hasproto
14107
14108 : see if fma exists
14109 set fma d_fma
14110 eval $inlibc
14111
14112 : see if fmax exists
14113 set fmax d_fmax
14114 eval $inlibc
14115
14116 : see if fmin exists
14117 set fmin d_fmin
14118 eval $inlibc
14119
14120 : see if fp_class exists
14121 set fp_class d_fp_class
14122 eval $inlibc
14123
14124 : see if this is a math.h system
14125 set math.h i_math
14126 eval $inhdr
14127
14128 : check for fpclassify
14129 echo "Checking to see if you have fpclassify..." >&4
14130 $cat >try.c <<EOCP
14131 #$i_math I_MATH
14132 #ifdef I_MATH
14133 #include <math.h>
14134 #endif
14135 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
14136 EOCP
14137 set try
14138 if eval $compile; then
14139         val="$define"
14140         echo "You have fpclassify."
14141 else
14142         val="$undef"
14143         echo "You do not have fpclassify."
14144 fi
14145 $rm_try
14146 set d_fpclassify
14147 eval $setvar
14148
14149 : see if fp_classify exists
14150 set fp_classify d_fp_classify
14151 eval $inlibc
14152
14153 : see if fp_classl exists
14154 set fp_classl d_fp_classl
14155 eval $inlibc
14156
14157 : see if pathconf exists
14158 set pathconf d_pathconf
14159 eval $inlibc
14160
14161 : see if fpathconf exists
14162 set fpathconf d_fpathconf
14163 eval $inlibc
14164
14165 : see if fpclass exists
14166 set fpclass d_fpclass
14167 eval $inlibc
14168
14169 : see if fpclassl exists
14170 set fpclassl d_fpclassl
14171 eval $inlibc
14172
14173 : see if fpgetround exists
14174 set fpgetround d_fpgetround
14175 eval $inlibc
14176
14177 : check for fpos64_t
14178 echo " "
14179 echo "Checking to see if you have fpos64_t..." >&4
14180 $cat >try.c <<EOCP
14181 #include <stdio.h>
14182 int main() { fpos64_t x = 7; }
14183 EOCP
14184 set try
14185 if eval $compile; then
14186         val="$define"
14187         echo "You have fpos64_t."
14188 else
14189         val="$undef"
14190         echo "You do not have fpos64_t."
14191         case "$fpossize" in
14192         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14193         esac
14194 fi
14195 $rm_try
14196 set d_fpos64_t
14197 eval $setvar
14198
14199 : see if this is an xlocale.h system
14200 set xlocale.h i_xlocale
14201 eval $inhdr
14202
14203 : see if newlocale exists
14204 set newlocale d_newlocale
14205 eval $inlibc
14206
14207 : see if freelocale exists
14208 set freelocale d_freelocale
14209 eval $inlibc
14210
14211 : see if uselocale exists
14212 set uselocale d_uselocale
14213 eval $inlibc
14214
14215 : see if duplocale exists
14216 set duplocale d_duplocale
14217 eval $inlibc
14218
14219 : see if querylocale exists
14220 set querylocale d_querylocale
14221 eval $inlibc
14222
14223 : see if frexpl exists
14224 set frexpl d_frexpl
14225 eval $inlibc
14226
14227 : see if this is a sys/param system
14228 set sys/param.h i_sysparam
14229 eval $inhdr
14230
14231 : see if this is a sys/mount.h system
14232 set sys/mount.h i_sysmount
14233 eval $inhdr
14234
14235 : Check for fs_data_s
14236 echo " "
14237 echo "Checking to see if your system supports struct fs_data..." >&4
14238 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14239 eval $hasstruct
14240 case "$d_fs_data_s" in
14241 "$define")      echo "Yes, it does."   ;;
14242 *)              echo "No, it doesn't." ;;
14243 esac
14244
14245 : see if fseeko exists
14246 set fseeko d_fseeko
14247 eval $inlibc
14248 case "$longsize" in
14249 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14250 esac
14251
14252 : see if fsetpos exists
14253 set fsetpos d_fsetpos
14254 eval $inlibc
14255
14256 : see if fstatfs exists
14257 set fstatfs d_fstatfs
14258 eval $inlibc
14259
14260 : see if statvfs exists
14261 set statvfs d_statvfs
14262 eval $inlibc
14263
14264 : see if fstatvfs exists
14265 set fstatvfs d_fstatvfs
14266 eval $inlibc
14267
14268
14269 : see if fsync exists
14270 set fsync d_fsync
14271 eval $inlibc
14272
14273 : see if ftello exists
14274 set ftello d_ftello
14275 eval $inlibc
14276 case "$longsize" in
14277 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14278 esac
14279
14280 : check for a working futimes
14281 d_futimes="$undef"
14282 echo " "
14283 echo "Checking if you have a working futimes()" >&4
14284 $cat >try.c <<EOCP
14285 #include <stdio.h>
14286 #include <sys/time.h>
14287 #include <errno.h>
14288 #include <fcntl.h>
14289
14290 int main ()
14291 {
14292     int fd, rv;
14293     fd = open ("try.c", O_RDWR);
14294     if (-1 == fd) exit (1);
14295     rv = futimes (fd, NULL);
14296     exit (rv == -1 ? errno : 0);
14297 }
14298 EOCP
14299 set try
14300 if eval $compile; then
14301     `$run ./try`
14302     rc=$?
14303     case "$rc" in
14304         0)  echo "Yes, you have" >&4
14305             d_futimes="$define"
14306             ;;
14307         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14308             ;;
14309     esac
14310 else
14311     echo "No, it does not (probably harmless)" >&4
14312 fi
14313 $rm_try
14314
14315 : look for gai_strerror
14316 echo " "
14317 $cat >try.c <<'EOCP'
14318 #include <sys/types.h>
14319 #include <sys/socket.h>
14320 #include <netdb.h>
14321 int main ()
14322 {
14323     return (gai_strerror (0) ? 0 : 1);
14324     }
14325 EOCP
14326 set try
14327 val="$undef"
14328 if eval $compile; then
14329     `$run ./try`
14330     case "$?" in
14331         0)  echo "A working gai_strerror() found." >&4
14332             val="$define" ;;
14333         *)  echo "gai_strerror() found, but it doesn't work" >&4
14334             ;;
14335         esac
14336 else
14337     echo "gai_strerror() NOT found." >&4
14338     fi
14339 set d_gai_strerror
14340 eval $setvar
14341 $rm_try
14342
14343 : see if ndbm.h is available
14344 set ndbm.h i_ndbm
14345 eval $inhdr
14346 : Compatibility location for RedHat 7.1
14347 set gdbm/ndbm.h i_gdbmndbm
14348 eval $inhdr
14349 : Compatibility location for Debian 4.0
14350 set gdbm-ndbm.h i_gdbm_ndbm
14351 eval $inhdr
14352
14353 val="$undef"
14354 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14355         : see if dbm_open exists
14356         set dbm_open d_dbm_open
14357         eval $inlibc
14358         case "$d_dbm_open" in
14359         $undef)
14360                 i_ndbm="$undef"
14361                 i_gdbmndbm="$undef"
14362                 i_gdbm_ndbm="$undef"
14363                 echo "We won't be including <ndbm.h>"
14364                 val="$undef"
14365                 ;;
14366         *) val="$define"
14367            ;;
14368         esac
14369 fi
14370 set d_ndbm
14371 eval $setvar
14372
14373 ndbm_hdr_protochk='name=$1; hdr=$2;
14374 eval "ihdr=\$""i_$name";
14375 val="$undef";
14376 if $test "$ihdr" = "$define"; then
14377         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14378         case "$d_cplusplus" in
14379         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14380         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14381         esac;
14382         case "$val" in
14383         $define) $echo "Your <$hdr> seems to have prototypes";;
14384         *) $echo "Your <$hdr> does not seem to have prototypes";;
14385         esac;
14386 fi;
14387 set "d_${name}_h_uses_prototypes";
14388 eval $setvar'
14389
14390 set ndbm ndbm.h
14391 eval $ndbm_hdr_protochk
14392 set gdbmndbm gdbm/ndbm.h
14393 eval $ndbm_hdr_protochk
14394 set gdbm_ndbm gdbm-ndbm.h
14395 eval $ndbm_hdr_protochk
14396
14397 : see if getaddrinfo exists
14398 set getaddrinfo d_getaddrinfo
14399 eval $inlibc
14400
14401 : see if getcwd exists
14402 set getcwd d_getcwd
14403 eval $inlibc
14404
14405 : see if getespwnam exists
14406 set getespwnam d_getespwnam
14407 eval $inlibc
14408
14409 : see if getfsstat exists
14410 set getfsstat d_getfsstat
14411 eval $inlibc
14412
14413 : see if getgrent exists
14414 set getgrent d_getgrent
14415 eval $inlibc
14416
14417 : see if getgrent_r exists
14418 set getgrent_r d_getgrent_r
14419 eval $inlibc
14420 case "$d_getgrent_r" in
14421 "$define")
14422         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14423         case "$d_getgrent_r_proto:$usethreads" in
14424         ":define")      d_getgrent_r_proto=define
14425                 set d_getgrent_r_proto getgrent_r $hdrs
14426                 eval $hasproto ;;
14427         *)      ;;
14428         esac
14429         case "$d_getgrent_r_proto" in
14430         define)
14431         case "$getgrent_r_proto" in
14432         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14433         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14434         esac
14435         case "$getgrent_r_proto" in
14436         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14437         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14438         esac
14439         case "$getgrent_r_proto" in
14440         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14441         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14442         esac
14443         case "$getgrent_r_proto" in
14444         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14445         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14446         esac
14447         case "$getgrent_r_proto" in
14448         ''|0) try='int getgrent_r(struct group*, char*, int);'
14449         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14450         esac
14451         case "$getgrent_r_proto" in
14452         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14453         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14454         esac
14455         case "$getgrent_r_proto" in
14456         ''|0)   d_getgrent_r=undef
14457                 getgrent_r_proto=0
14458                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14459         * )     case "$getgrent_r_proto" in
14460                 REENTRANT_PROTO*) ;;
14461                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14462                 esac
14463                 echo "Prototype: $try" ;;
14464         esac
14465         ;;
14466         *)      case "$usethreads" in
14467                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14468                 esac
14469                 d_getgrent_r=undef
14470                 getgrent_r_proto=0
14471                 ;;
14472         esac
14473         ;;
14474 *)      getgrent_r_proto=0
14475         ;;
14476 esac
14477
14478 : see if getgrgid_r exists
14479 set getgrgid_r d_getgrgid_r
14480 eval $inlibc
14481 case "$d_getgrgid_r" in
14482 "$define")
14483         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14484         case "$d_getgrgid_r_proto:$usethreads" in
14485         ":define")      d_getgrgid_r_proto=define
14486                 set d_getgrgid_r_proto getgrgid_r $hdrs
14487                 eval $hasproto ;;
14488         *)      ;;
14489         esac
14490         case "$d_getgrgid_r_proto" in
14491         define)
14492         case "$getgrgid_r_proto" in
14493         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14494         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14495         esac
14496         case "$getgrgid_r_proto" in
14497         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14498         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14499         esac
14500         case "$getgrgid_r_proto" in
14501         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14502         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14503         esac
14504         case "$getgrgid_r_proto" in
14505         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14506         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14507         esac
14508         case "$getgrgid_r_proto" in
14509         ''|0)   d_getgrgid_r=undef
14510                 getgrgid_r_proto=0
14511                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14512         * )     case "$getgrgid_r_proto" in
14513                 REENTRANT_PROTO*) ;;
14514                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14515                 esac
14516                 echo "Prototype: $try" ;;
14517         esac
14518         ;;
14519         *)      case "$usethreads" in
14520                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14521                 esac
14522                 d_getgrgid_r=undef
14523                 getgrgid_r_proto=0
14524                 ;;
14525         esac
14526         ;;
14527 *)      getgrgid_r_proto=0
14528         ;;
14529 esac
14530
14531 : see if getgrnam_r exists
14532 set getgrnam_r d_getgrnam_r
14533 eval $inlibc
14534 case "$d_getgrnam_r" in
14535 "$define")
14536         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14537         case "$d_getgrnam_r_proto:$usethreads" in
14538         ":define")      d_getgrnam_r_proto=define
14539                 set d_getgrnam_r_proto getgrnam_r $hdrs
14540                 eval $hasproto ;;
14541         *)      ;;
14542         esac
14543         case "$d_getgrnam_r_proto" in
14544         define)
14545         case "$getgrnam_r_proto" in
14546         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14547         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14548         esac
14549         case "$getgrnam_r_proto" in
14550         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14551         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14552         esac
14553         case "$getgrnam_r_proto" in
14554         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14555         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14556         esac
14557         case "$getgrnam_r_proto" in
14558         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14559         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14560         esac
14561         case "$getgrnam_r_proto" in
14562         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14563         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14564         esac
14565         case "$getgrnam_r_proto" in
14566         ''|0)   d_getgrnam_r=undef
14567                 getgrnam_r_proto=0
14568                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14569         * )     case "$getgrnam_r_proto" in
14570                 REENTRANT_PROTO*) ;;
14571                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14572                 esac
14573                 echo "Prototype: $try" ;;
14574         esac
14575         ;;
14576         *)      case "$usethreads" in
14577                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14578                 esac
14579                 d_getgrnam_r=undef
14580                 getgrnam_r_proto=0
14581                 ;;
14582         esac
14583         ;;
14584 *)      getgrnam_r_proto=0
14585         ;;
14586 esac
14587
14588 : see if gethostbyaddr exists
14589 set gethostbyaddr d_gethbyaddr
14590 eval $inlibc
14591
14592 : see if gethostbyname exists
14593 set gethostbyname d_gethbyname
14594 eval $inlibc
14595
14596 : see if gethostent exists
14597 set gethostent d_gethent
14598 eval $inlibc
14599
14600 : see how we will look up host name
14601 echo " "
14602 call=''
14603 if set gethostname val -f d_gethname; eval $csym; $val; then
14604         echo 'gethostname() found.' >&4
14605         d_gethname="$define"
14606         call=gethostname
14607 fi
14608 if set uname val -f d_uname; eval $csym; $val; then
14609         if ./xenix; then
14610                 $cat <<'EOM'
14611 uname() was found, but you're running xenix, and older versions of xenix
14612 have a broken uname(). If you don't really know whether your xenix is old
14613 enough to have a broken system call, use the default answer.
14614
14615 EOM
14616                 dflt=y
14617                 case "$d_uname" in
14618                 "$define") dflt=n;;
14619                 esac
14620                 rp='Is your uname() broken?'
14621                 . ./myread
14622                 case "$ans" in
14623                 n*) d_uname="$define"; call=uname;;
14624                 esac
14625         else
14626                 echo 'uname() found.' >&4
14627                 d_uname="$define"
14628                 case "$call" in
14629                 '') call=uname ;;
14630                 esac
14631         fi
14632 fi
14633 case "$d_gethname" in
14634 '') d_gethname="$undef";;
14635 esac
14636 case "$d_uname" in
14637 '') d_uname="$undef";;
14638 esac
14639 case "$d_uname$d_gethname" in
14640 *define*)
14641         dflt=n
14642         cat <<EOM
14643
14644 Every now and then someone has a $call() that lies about the hostname
14645 but can't be fixed for political or economic reasons.  If you wish, I can
14646 pretend $call() isn't there and maybe compute hostname at run-time
14647 thanks to the '$phostname' command.
14648
14649 EOM
14650         rp="Shall I ignore $call() from now on?"
14651         . ./myread
14652         case "$ans" in
14653         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14654         esac;;
14655 esac
14656 case "$phostname" in
14657 '') aphostname='';;
14658 *) case "$aphostname" in
14659         /*) ;;
14660         *) set X $phostname
14661                 shift
14662                 file=$1
14663                 shift
14664                 file=`./loc $file $file $pth`
14665                 aphostname=`echo $file $*`
14666                 ;;
14667         esac
14668         ;;
14669 esac
14670 case "$d_uname$d_gethname" in
14671 *define*) ;;
14672 *)
14673         case "$phostname" in
14674         '')
14675                 echo "There will be no way for $package to get your hostname." >&4;;
14676         *)
14677         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14678                 ;;
14679         esac;;
14680 esac
14681 case "$d_phostname" in
14682 '') d_phostname="$undef";;
14683 esac
14684
14685 : see if gethostbyaddr_r exists
14686 set gethostbyaddr_r d_gethostbyaddr_r
14687 eval $inlibc
14688 case "$d_gethostbyaddr_r" in
14689 "$define")
14690         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14691         case "$d_gethostbyaddr_r_proto:$usethreads" in
14692         ":define")      d_gethostbyaddr_r_proto=define
14693                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14694                 eval $hasproto ;;
14695         *)      ;;
14696         esac
14697         case "$d_gethostbyaddr_r_proto" in
14698         define)
14699         case "$gethostbyaddr_r_proto" in
14700         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14701         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14702         esac
14703         case "$gethostbyaddr_r_proto" in
14704         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14705         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14706         esac
14707         case "$gethostbyaddr_r_proto" in
14708         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14709         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14710         esac
14711         case "$gethostbyaddr_r_proto" in
14712         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14713         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14714         esac
14715         case "$gethostbyaddr_r_proto" in
14716         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14717         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14718         esac
14719         case "$gethostbyaddr_r_proto" in
14720         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14721         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14722         esac
14723         case "$gethostbyaddr_r_proto" in
14724         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14725         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14726         esac
14727         case "$gethostbyaddr_r_proto" in
14728         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14729         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14730         esac
14731         case "$gethostbyaddr_r_proto" in
14732         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14733         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14734         esac
14735         case "$gethostbyaddr_r_proto" in
14736         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14737         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14738         esac
14739         case "$gethostbyaddr_r_proto" in
14740         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14741         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14742         esac
14743         case "$gethostbyaddr_r_proto" in
14744         ''|0)   d_gethostbyaddr_r=undef
14745                 gethostbyaddr_r_proto=0
14746                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14747         * )     case "$gethostbyaddr_r_proto" in
14748                 REENTRANT_PROTO*) ;;
14749                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14750                 esac
14751                 echo "Prototype: $try" ;;
14752         esac
14753         ;;
14754         *)      case "$usethreads" in
14755                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14756                 esac
14757                 d_gethostbyaddr_r=undef
14758                 gethostbyaddr_r_proto=0
14759                 ;;
14760         esac
14761         ;;
14762 *)      gethostbyaddr_r_proto=0
14763         ;;
14764 esac
14765
14766 : see if gethostbyname_r exists
14767 set gethostbyname_r d_gethostbyname_r
14768 eval $inlibc
14769 case "$d_gethostbyname_r" in
14770 "$define")
14771         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14772         case "$d_gethostbyname_r_proto:$usethreads" in
14773         ":define")      d_gethostbyname_r_proto=define
14774                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14775                 eval $hasproto ;;
14776         *)      ;;
14777         esac
14778         case "$d_gethostbyname_r_proto" in
14779         define)
14780         case "$gethostbyname_r_proto" in
14781         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14782         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14783         esac
14784         case "$gethostbyname_r_proto" in
14785         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14786         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14787         esac
14788         case "$gethostbyname_r_proto" in
14789         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14790         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14791         esac
14792         case "$gethostbyname_r_proto" in
14793         ''|0)   d_gethostbyname_r=undef
14794                 gethostbyname_r_proto=0
14795                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14796         * )     case "$gethostbyname_r_proto" in
14797                 REENTRANT_PROTO*) ;;
14798                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14799                 esac
14800                 echo "Prototype: $try" ;;
14801         esac
14802         ;;
14803         *)      case "$usethreads" in
14804                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14805                 esac
14806                 d_gethostbyname_r=undef
14807                 gethostbyname_r_proto=0
14808                 ;;
14809         esac
14810         ;;
14811 *)      gethostbyname_r_proto=0
14812         ;;
14813 esac
14814
14815 : see if gethostent_r exists
14816 set gethostent_r d_gethostent_r
14817 eval $inlibc
14818 case "$d_gethostent_r" in
14819 "$define")
14820         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14821         case "$d_gethostent_r_proto:$usethreads" in
14822         ":define")      d_gethostent_r_proto=define
14823                 set d_gethostent_r_proto gethostent_r $hdrs
14824                 eval $hasproto ;;
14825         *)      ;;
14826         esac
14827         case "$d_gethostent_r_proto" in
14828         define)
14829         case "$gethostent_r_proto" in
14830         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14831         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14832         esac
14833         case "$gethostent_r_proto" in
14834         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14835         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14836         esac
14837         case "$gethostent_r_proto" in
14838         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14839         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14840         esac
14841         case "$gethostent_r_proto" in
14842         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14843         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14844         esac
14845         case "$gethostent_r_proto" in
14846         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14847         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14848         esac
14849         case "$gethostent_r_proto" in
14850         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14851         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14852         esac
14853         case "$gethostent_r_proto" in
14854         ''|0)   d_gethostent_r=undef
14855                 gethostent_r_proto=0
14856                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14857         * )     case "$gethostent_r_proto" in
14858                 REENTRANT_PROTO*) ;;
14859                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14860                 esac
14861                 echo "Prototype: $try" ;;
14862         esac
14863         ;;
14864         *)      case "$usethreads" in
14865                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14866                 esac
14867                 d_gethostent_r=undef
14868                 gethostent_r_proto=0
14869                 ;;
14870         esac
14871         ;;
14872 *)      gethostent_r_proto=0
14873         ;;
14874 esac
14875
14876 : see if prototypes for various gethostxxx netdb.h functions are available
14877 echo " "
14878 set d_gethostprotos gethostent $i_netdb netdb.h
14879 eval $hasproto
14880
14881 : see if getitimer exists
14882 set getitimer d_getitimer
14883 eval $inlibc
14884
14885 : see if getlogin exists
14886 set getlogin d_getlogin
14887 eval $inlibc
14888
14889 : see if getlogin_r exists
14890 set getlogin_r d_getlogin_r
14891 eval $inlibc
14892 case "$d_getlogin_r" in
14893 "$define")
14894         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14895         case "$d_getlogin_r_proto:$usethreads" in
14896         ":define")      d_getlogin_r_proto=define
14897                 set d_getlogin_r_proto getlogin_r $hdrs
14898                 eval $hasproto ;;
14899         *)      ;;
14900         esac
14901         case "$d_getlogin_r_proto" in
14902         define)
14903         case "$getlogin_r_proto" in
14904         ''|0) try='int getlogin_r(char*, size_t);'
14905         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14906         esac
14907         case "$getlogin_r_proto" in
14908         ''|0) try='int getlogin_r(char*, int);'
14909         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14910         esac
14911         case "$getlogin_r_proto" in
14912         ''|0) try='char* getlogin_r(char*, size_t);'
14913         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14914         esac
14915         case "$getlogin_r_proto" in
14916         ''|0) try='char* getlogin_r(char*, int);'
14917         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14918         esac
14919         case "$getlogin_r_proto" in
14920         ''|0)   d_getlogin_r=undef
14921                 getlogin_r_proto=0
14922                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14923         * )     case "$getlogin_r_proto" in
14924                 REENTRANT_PROTO*) ;;
14925                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14926                 esac
14927                 echo "Prototype: $try" ;;
14928         esac
14929         ;;
14930         *)      case "$usethreads" in
14931                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14932                 esac
14933                 d_getlogin_r=undef
14934                 getlogin_r_proto=0
14935                 ;;
14936         esac
14937         ;;
14938 *)      getlogin_r_proto=0
14939         ;;
14940 esac
14941
14942 : see if getmnt exists
14943 set getmnt d_getmnt
14944 eval $inlibc
14945
14946 : see if getmntent exists
14947 set getmntent d_getmntent
14948 eval $inlibc
14949
14950 : see if getnameinfo exists
14951 set getnameinfo d_getnameinfo
14952 eval $inlibc
14953
14954 : see if getnetbyaddr exists
14955 set getnetbyaddr d_getnbyaddr
14956 eval $inlibc
14957
14958 : see if getnetbyname exists
14959 set getnetbyname d_getnbyname
14960 eval $inlibc
14961
14962 : see if getnetent exists
14963 set getnetent d_getnent
14964 eval $inlibc
14965
14966 : see if getnetbyaddr_r exists
14967 set getnetbyaddr_r d_getnetbyaddr_r
14968 eval $inlibc
14969 case "$d_getnetbyaddr_r" in
14970 "$define")
14971         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14972         case "$d_getnetbyaddr_r_proto:$usethreads" in
14973         ":define")      d_getnetbyaddr_r_proto=define
14974                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14975                 eval $hasproto ;;
14976         *)      ;;
14977         esac
14978         case "$d_getnetbyaddr_r_proto" in
14979         define)
14980         case "$getnetbyaddr_r_proto" in
14981         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14982         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14983         esac
14984         case "$getnetbyaddr_r_proto" in
14985         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14986         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14987         esac
14988         case "$getnetbyaddr_r_proto" in
14989         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14990         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14991         esac
14992         case "$getnetbyaddr_r_proto" in
14993         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14994         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14995         esac
14996         case "$getnetbyaddr_r_proto" in
14997         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14998         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14999         esac
15000         case "$getnetbyaddr_r_proto" in
15001         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
15002         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
15003         esac
15004         case "$getnetbyaddr_r_proto" in
15005         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
15006         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
15007         esac
15008         case "$getnetbyaddr_r_proto" in
15009         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
15010         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
15011         esac
15012         case "$getnetbyaddr_r_proto" in
15013         ''|0)   d_getnetbyaddr_r=undef
15014                 getnetbyaddr_r_proto=0
15015                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
15016         * )     case "$getnetbyaddr_r_proto" in
15017                 REENTRANT_PROTO*) ;;
15018                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
15019                 esac
15020                 echo "Prototype: $try" ;;
15021         esac
15022         ;;
15023         *)      case "$usethreads" in
15024                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
15025                 esac
15026                 d_getnetbyaddr_r=undef
15027                 getnetbyaddr_r_proto=0
15028                 ;;
15029         esac
15030         ;;
15031 *)      getnetbyaddr_r_proto=0
15032         ;;
15033 esac
15034
15035 : see if getnetbyname_r exists
15036 set getnetbyname_r d_getnetbyname_r
15037 eval $inlibc
15038 case "$d_getnetbyname_r" in
15039 "$define")
15040         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15041         case "$d_getnetbyname_r_proto:$usethreads" in
15042         ":define")      d_getnetbyname_r_proto=define
15043                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
15044                 eval $hasproto ;;
15045         *)      ;;
15046         esac
15047         case "$d_getnetbyname_r_proto" in
15048         define)
15049         case "$getnetbyname_r_proto" in
15050         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
15051         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
15052         esac
15053         case "$getnetbyname_r_proto" in
15054         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
15055         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
15056         esac
15057         case "$getnetbyname_r_proto" in
15058         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
15059         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
15060         esac
15061         case "$getnetbyname_r_proto" in
15062         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
15063         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
15064         esac
15065         case "$getnetbyname_r_proto" in
15066         ''|0)   d_getnetbyname_r=undef
15067                 getnetbyname_r_proto=0
15068                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
15069         * )     case "$getnetbyname_r_proto" in
15070                 REENTRANT_PROTO*) ;;
15071                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
15072                 esac
15073                 echo "Prototype: $try" ;;
15074         esac
15075         ;;
15076         *)      case "$usethreads" in
15077                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
15078                 esac
15079                 d_getnetbyname_r=undef
15080                 getnetbyname_r_proto=0
15081                 ;;
15082         esac
15083         ;;
15084 *)      getnetbyname_r_proto=0
15085         ;;
15086 esac
15087
15088 : see if getnetent_r exists
15089 set getnetent_r d_getnetent_r
15090 eval $inlibc
15091 case "$d_getnetent_r" in
15092 "$define")
15093         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15094         case "$d_getnetent_r_proto:$usethreads" in
15095         ":define")      d_getnetent_r_proto=define
15096                 set d_getnetent_r_proto getnetent_r $hdrs
15097                 eval $hasproto ;;
15098         *)      ;;
15099         esac
15100         case "$d_getnetent_r_proto" in
15101         define)
15102         case "$getnetent_r_proto" in
15103         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
15104         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
15105         esac
15106         case "$getnetent_r_proto" in
15107         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
15108         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
15109         esac
15110         case "$getnetent_r_proto" in
15111         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
15112         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
15113         esac
15114         case "$getnetent_r_proto" in
15115         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
15116         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
15117         esac
15118         case "$getnetent_r_proto" in
15119         ''|0) try='int getnetent_r(struct netent*, char*, int);'
15120         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
15121         esac
15122         case "$getnetent_r_proto" in
15123         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
15124         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
15125         esac
15126         case "$getnetent_r_proto" in
15127         ''|0)   d_getnetent_r=undef
15128                 getnetent_r_proto=0
15129                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
15130         * )     case "$getnetent_r_proto" in
15131                 REENTRANT_PROTO*) ;;
15132                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
15133                 esac
15134                 echo "Prototype: $try" ;;
15135         esac
15136         ;;
15137         *)      case "$usethreads" in
15138                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
15139                 esac
15140                 d_getnetent_r=undef
15141                 getnetent_r_proto=0
15142                 ;;
15143         esac
15144         ;;
15145 *)      getnetent_r_proto=0
15146         ;;
15147 esac
15148
15149 : see if prototypes for various getnetxxx netdb.h functions are available
15150 echo " "
15151 set d_getnetprotos getnetent $i_netdb netdb.h
15152 eval $hasproto
15153
15154 : see if getpagesize exists
15155 set getpagesize d_getpagsz
15156 eval $inlibc
15157
15158 : Optional checks for getprotobyname and getprotobynumber
15159
15160 : see if getprotobyname exists
15161 set getprotobyname d_getpbyname
15162 eval $inlibc
15163
15164 : see if getprotobynumber exists
15165 set getprotobynumber d_getpbynumber
15166 eval $inlibc
15167
15168 : see if getprotoent exists
15169 set getprotoent d_getpent
15170 eval $inlibc
15171
15172 : see if getpgid exists
15173 set getpgid d_getpgid
15174 eval $inlibc
15175
15176 : see if getpgrp2 exists
15177 set getpgrp2 d_getpgrp2
15178 eval $inlibc
15179
15180 : see if getppid exists
15181 set getppid d_getppid
15182 eval $inlibc
15183
15184 : see if getpriority exists
15185 set getpriority d_getprior
15186 eval $inlibc
15187
15188 : see if getprotobyname_r exists
15189 set getprotobyname_r d_getprotobyname_r
15190 eval $inlibc
15191 case "$d_getprotobyname_r" in
15192 "$define")
15193         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15194         case "$d_getprotobyname_r_proto:$usethreads" in
15195         ":define")      d_getprotobyname_r_proto=define
15196                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
15197                 eval $hasproto ;;
15198         *)      ;;
15199         esac
15200         case "$d_getprotobyname_r_proto" in
15201         define)
15202         case "$getprotobyname_r_proto" in
15203         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15204         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15205         esac
15206         case "$getprotobyname_r_proto" in
15207         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15208         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15209         esac
15210         case "$getprotobyname_r_proto" in
15211         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15212         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15213         esac
15214         case "$getprotobyname_r_proto" in
15215         ''|0)   d_getprotobyname_r=undef
15216                 getprotobyname_r_proto=0
15217                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15218         * )     case "$getprotobyname_r_proto" in
15219                 REENTRANT_PROTO*) ;;
15220                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15221                 esac
15222                 echo "Prototype: $try" ;;
15223         esac
15224         ;;
15225         *)      case "$usethreads" in
15226                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15227                 esac
15228                 d_getprotobyname_r=undef
15229                 getprotobyname_r_proto=0
15230                 ;;
15231         esac
15232         ;;
15233 *)      getprotobyname_r_proto=0
15234         ;;
15235 esac
15236
15237 : see if getprotobynumber_r exists
15238 set getprotobynumber_r d_getprotobynumber_r
15239 eval $inlibc
15240 case "$d_getprotobynumber_r" in
15241 "$define")
15242         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15243         case "$d_getprotobynumber_r_proto:$usethreads" in
15244         ":define")      d_getprotobynumber_r_proto=define
15245                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15246                 eval $hasproto ;;
15247         *)      ;;
15248         esac
15249         case "$d_getprotobynumber_r_proto" in
15250         define)
15251         case "$getprotobynumber_r_proto" in
15252         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15253         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15254         esac
15255         case "$getprotobynumber_r_proto" in
15256         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15257         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15258         esac
15259         case "$getprotobynumber_r_proto" in
15260         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15261         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15262         esac
15263         case "$getprotobynumber_r_proto" in
15264         ''|0)   d_getprotobynumber_r=undef
15265                 getprotobynumber_r_proto=0
15266                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15267         * )     case "$getprotobynumber_r_proto" in
15268                 REENTRANT_PROTO*) ;;
15269                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15270                 esac
15271                 echo "Prototype: $try" ;;
15272         esac
15273         ;;
15274         *)      case "$usethreads" in
15275                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15276                 esac
15277                 d_getprotobynumber_r=undef
15278                 getprotobynumber_r_proto=0
15279                 ;;
15280         esac
15281         ;;
15282 *)      getprotobynumber_r_proto=0
15283         ;;
15284 esac
15285
15286 : see if getprotoent_r exists
15287 set getprotoent_r d_getprotoent_r
15288 eval $inlibc
15289 case "$d_getprotoent_r" in
15290 "$define")
15291         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15292         case "$d_getprotoent_r_proto:$usethreads" in
15293         ":define")      d_getprotoent_r_proto=define
15294                 set d_getprotoent_r_proto getprotoent_r $hdrs
15295                 eval $hasproto ;;
15296         *)      ;;
15297         esac
15298         case "$d_getprotoent_r_proto" in
15299         define)
15300         case "$getprotoent_r_proto" in
15301         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15302         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15303         esac
15304         case "$getprotoent_r_proto" in
15305         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15306         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15307         esac
15308         case "$getprotoent_r_proto" in
15309         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15310         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15311         esac
15312         case "$getprotoent_r_proto" in
15313         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15314         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15315         esac
15316         case "$getprotoent_r_proto" in
15317         ''|0)   d_getprotoent_r=undef
15318                 getprotoent_r_proto=0
15319                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15320         * )     case "$getprotoent_r_proto" in
15321                 REENTRANT_PROTO*) ;;
15322                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15323                 esac
15324                 echo "Prototype: $try" ;;
15325         esac
15326         ;;
15327         *)      case "$usethreads" in
15328                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15329                 esac
15330                 d_getprotoent_r=undef
15331                 getprotoent_r_proto=0
15332                 ;;
15333         esac
15334         ;;
15335 *)      getprotoent_r_proto=0
15336         ;;
15337 esac
15338
15339 : see if prototypes for various getprotoxxx netdb.h functions are available
15340 echo " "
15341 set d_getprotoprotos getprotoent $i_netdb netdb.h
15342 eval $hasproto
15343
15344 : see if getprpwnam exists
15345 set getprpwnam d_getprpwnam
15346 eval $inlibc
15347
15348 : see if getpwent exists
15349 set getpwent d_getpwent
15350 eval $inlibc
15351
15352 : see if getpwent_r exists
15353 set getpwent_r d_getpwent_r
15354 eval $inlibc
15355 case "$d_getpwent_r" in
15356 "$define")
15357         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15358         case "$d_getpwent_r_proto:$usethreads" in
15359         ":define")      d_getpwent_r_proto=define
15360                 set d_getpwent_r_proto getpwent_r $hdrs
15361                 eval $hasproto ;;
15362         *)      ;;
15363         esac
15364         case "$d_getpwent_r_proto" in
15365         define)
15366         case "$getpwent_r_proto" in
15367         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15368         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15369         esac
15370         case "$getpwent_r_proto" in
15371         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15372         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15373         esac
15374         case "$getpwent_r_proto" in
15375         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15376         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15377         esac
15378         case "$getpwent_r_proto" in
15379         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15380         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15381         esac
15382         case "$getpwent_r_proto" in
15383         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15384         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15385         esac
15386         case "$getpwent_r_proto" in
15387         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15388         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15389         esac
15390         case "$getpwent_r_proto" in
15391         ''|0)   d_getpwent_r=undef
15392                 getpwent_r_proto=0
15393                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15394         * )     case "$getpwent_r_proto" in
15395                 REENTRANT_PROTO*) ;;
15396                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15397                 esac
15398                 echo "Prototype: $try" ;;
15399         esac
15400         ;;
15401         *)      case "$usethreads" in
15402                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15403                 esac
15404                 d_getpwent_r=undef
15405                 getpwent_r_proto=0
15406                 ;;
15407         esac
15408         ;;
15409 *)      getpwent_r_proto=0
15410         ;;
15411 esac
15412
15413 : see if getpwnam_r exists
15414 set getpwnam_r d_getpwnam_r
15415 eval $inlibc
15416 case "$d_getpwnam_r" in
15417 "$define")
15418         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15419         case "$d_getpwnam_r_proto:$usethreads" in
15420         ":define")      d_getpwnam_r_proto=define
15421                 set d_getpwnam_r_proto getpwnam_r $hdrs
15422                 eval $hasproto ;;
15423         *)      ;;
15424         esac
15425         case "$d_getpwnam_r_proto" in
15426         define)
15427         case "$getpwnam_r_proto" in
15428         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15429         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15430         esac
15431         case "$getpwnam_r_proto" in
15432         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15433         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15434         esac
15435         case "$getpwnam_r_proto" in
15436         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15437         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15438         esac
15439         case "$getpwnam_r_proto" in
15440         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15441         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15442         esac
15443         case "$getpwnam_r_proto" in
15444         ''|0)   d_getpwnam_r=undef
15445                 getpwnam_r_proto=0
15446                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15447         * )     case "$getpwnam_r_proto" in
15448                 REENTRANT_PROTO*) ;;
15449                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15450                 esac
15451                 echo "Prototype: $try" ;;
15452         esac
15453         ;;
15454         *)      case "$usethreads" in
15455                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15456                 esac
15457                 d_getpwnam_r=undef
15458                 getpwnam_r_proto=0
15459                 ;;
15460         esac
15461         ;;
15462 *)      getpwnam_r_proto=0
15463         ;;
15464 esac
15465
15466 : see if getpwuid_r exists
15467 set getpwuid_r d_getpwuid_r
15468 eval $inlibc
15469 case "$d_getpwuid_r" in
15470 "$define")
15471         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15472         case "$d_getpwuid_r_proto:$usethreads" in
15473         ":define")      d_getpwuid_r_proto=define
15474                 set d_getpwuid_r_proto getpwuid_r $hdrs
15475                 eval $hasproto ;;
15476         *)      ;;
15477         esac
15478         case "$d_getpwuid_r_proto" in
15479         define)
15480         case "$getpwuid_r_proto" in
15481         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15482         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15483         esac
15484         case "$getpwuid_r_proto" in
15485         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15486         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15487         esac
15488         case "$getpwuid_r_proto" in
15489         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15490         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15491         esac
15492         case "$getpwuid_r_proto" in
15493         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15494         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15495         esac
15496         case "$getpwuid_r_proto" in
15497         ''|0)   d_getpwuid_r=undef
15498                 getpwuid_r_proto=0
15499                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15500         * )     case "$getpwuid_r_proto" in
15501                 REENTRANT_PROTO*) ;;
15502                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15503                 esac
15504                 echo "Prototype: $try" ;;
15505         esac
15506         ;;
15507         *)      case "$usethreads" in
15508                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15509                 esac
15510                 d_getpwuid_r=undef
15511                 getpwuid_r_proto=0
15512                 ;;
15513         esac
15514         ;;
15515 *)      getpwuid_r_proto=0
15516         ;;
15517 esac
15518
15519 : Optional checks for getsbyname and getsbyport
15520
15521 : see if getservbyname exists
15522 set getservbyname d_getsbyname
15523 eval $inlibc
15524
15525 : see if getservbyport exists
15526 set getservbyport d_getsbyport
15527 eval $inlibc
15528
15529 : see if getservent exists
15530 set getservent d_getsent
15531 eval $inlibc
15532
15533 : see if getservbyname_r exists
15534 set getservbyname_r d_getservbyname_r
15535 eval $inlibc
15536 case "$d_getservbyname_r" in
15537 "$define")
15538         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15539         case "$d_getservbyname_r_proto:$usethreads" in
15540         ":define")      d_getservbyname_r_proto=define
15541                 set d_getservbyname_r_proto getservbyname_r $hdrs
15542                 eval $hasproto ;;
15543         *)      ;;
15544         esac
15545         case "$d_getservbyname_r_proto" in
15546         define)
15547         case "$getservbyname_r_proto" in
15548         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15549         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15550         esac
15551         case "$getservbyname_r_proto" in
15552         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15553         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15554         esac
15555         case "$getservbyname_r_proto" in
15556         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15557         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15558         esac
15559         case "$getservbyname_r_proto" in
15560         ''|0)   d_getservbyname_r=undef
15561                 getservbyname_r_proto=0
15562                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15563         * )     case "$getservbyname_r_proto" in
15564                 REENTRANT_PROTO*) ;;
15565                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15566                 esac
15567                 echo "Prototype: $try" ;;
15568         esac
15569         ;;
15570         *)      case "$usethreads" in
15571                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15572                 esac
15573                 d_getservbyname_r=undef
15574                 getservbyname_r_proto=0
15575                 ;;
15576         esac
15577         ;;
15578 *)      getservbyname_r_proto=0
15579         ;;
15580 esac
15581
15582 : see if getservbyport_r exists
15583 set getservbyport_r d_getservbyport_r
15584 eval $inlibc
15585 case "$d_getservbyport_r" in
15586 "$define")
15587         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15588         case "$d_getservbyport_r_proto:$usethreads" in
15589         ":define")      d_getservbyport_r_proto=define
15590                 set d_getservbyport_r_proto getservbyport_r $hdrs
15591                 eval $hasproto ;;
15592         *)      ;;
15593         esac
15594         case "$d_getservbyport_r_proto" in
15595         define)
15596         case "$getservbyport_r_proto" in
15597         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15598         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15599         esac
15600         case "$getservbyport_r_proto" in
15601         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15602         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15603         esac
15604         case "$getservbyport_r_proto" in
15605         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15606         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15607         esac
15608         case "$getservbyport_r_proto" in
15609         ''|0)   d_getservbyport_r=undef
15610                 getservbyport_r_proto=0
15611                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15612         * )     case "$getservbyport_r_proto" in
15613                 REENTRANT_PROTO*) ;;
15614                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15615                 esac
15616                 echo "Prototype: $try" ;;
15617         esac
15618         ;;
15619         *)      case "$usethreads" in
15620                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15621                 esac
15622                 d_getservbyport_r=undef
15623                 getservbyport_r_proto=0
15624                 ;;
15625         esac
15626         ;;
15627 *)      getservbyport_r_proto=0
15628         ;;
15629 esac
15630
15631 : see if getservent_r exists
15632 set getservent_r d_getservent_r
15633 eval $inlibc
15634 case "$d_getservent_r" in
15635 "$define")
15636         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15637         case "$d_getservent_r_proto:$usethreads" in
15638         ":define")      d_getservent_r_proto=define
15639                 set d_getservent_r_proto getservent_r $hdrs
15640                 eval $hasproto ;;
15641         *)      ;;
15642         esac
15643         case "$d_getservent_r_proto" in
15644         define)
15645         case "$getservent_r_proto" in
15646         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15647         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15648         esac
15649         case "$getservent_r_proto" in
15650         ''|0) try='int getservent_r(struct servent*, char*, int);'
15651         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15652         esac
15653         case "$getservent_r_proto" in
15654         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15655         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15656         esac
15657         case "$getservent_r_proto" in
15658         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15659         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15660         esac
15661         case "$getservent_r_proto" in
15662         ''|0)   d_getservent_r=undef
15663                 getservent_r_proto=0
15664                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15665         * )     case "$getservent_r_proto" in
15666                 REENTRANT_PROTO*) ;;
15667                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15668                 esac
15669                 echo "Prototype: $try" ;;
15670         esac
15671         ;;
15672         *)      case "$usethreads" in
15673                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15674                 esac
15675                 d_getservent_r=undef
15676                 getservent_r_proto=0
15677                 ;;
15678         esac
15679         ;;
15680 *)      getservent_r_proto=0
15681         ;;
15682 esac
15683
15684 : see if prototypes for various getservxxx netdb.h functions are available
15685 echo " "
15686 set d_getservprotos getservent $i_netdb netdb.h
15687 eval $hasproto
15688
15689 : see if getspnam exists
15690 set getspnam d_getspnam
15691 eval $inlibc
15692
15693 : see if this is a shadow.h system
15694 set shadow.h i_shadow
15695 eval $inhdr
15696
15697 : see if getspnam_r exists
15698 set getspnam_r d_getspnam_r
15699 eval $inlibc
15700 case "$d_getspnam_r" in
15701 "$define")
15702         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15703         case "$d_getspnam_r_proto:$usethreads" in
15704         ":define")      d_getspnam_r_proto=define
15705                 set d_getspnam_r_proto getspnam_r $hdrs
15706                 eval $hasproto ;;
15707         *)      ;;
15708         esac
15709         case "$d_getspnam_r_proto" in
15710         define)
15711         case "$getspnam_r_proto" in
15712         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15713         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15714         esac
15715         case "$getspnam_r_proto" in
15716         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15717         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15718         esac
15719         case "$getspnam_r_proto" in
15720         ''|0)   d_getspnam_r=undef
15721                 getspnam_r_proto=0
15722                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15723         * )     case "$getspnam_r_proto" in
15724                 REENTRANT_PROTO*) ;;
15725                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15726                 esac
15727                 echo "Prototype: $try" ;;
15728         esac
15729         ;;
15730         *)      case "$usethreads" in
15731                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15732                 esac
15733                 d_getspnam_r=undef
15734                 getspnam_r_proto=0
15735                 ;;
15736         esac
15737         ;;
15738 *)      getspnam_r_proto=0
15739         ;;
15740 esac
15741
15742 : see if gettimeofday or ftime exists
15743 set gettimeofday d_gettimeod
15744 eval $inlibc
15745 case "$d_gettimeod" in
15746 "$undef")
15747         set ftime d_ftime 
15748         eval $inlibc
15749         ;;
15750 *)
15751         val="$undef"; set d_ftime; eval $setvar
15752         ;;
15753 esac
15754 case "$d_gettimeod$d_ftime" in
15755 "$undef$undef")
15756         echo " "
15757         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15758         ;;
15759 esac
15760
15761 : see if gmtime_r exists
15762 set gmtime_r d_gmtime_r
15763 eval $inlibc
15764 case "$d_gmtime_r" in
15765 "$define")
15766         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15767         case "$d_gmtime_r_proto:$usethreads" in
15768         ":define")      d_gmtime_r_proto=define
15769                 set d_gmtime_r_proto gmtime_r $hdrs
15770                 eval $hasproto ;;
15771         *)      ;;
15772         esac
15773         case "$d_gmtime_r_proto" in
15774         define)
15775         case "$gmtime_r_proto" in
15776         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15777         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15778         esac
15779         case "$gmtime_r_proto" in
15780         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15781         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15782         esac
15783         case "$gmtime_r_proto" in
15784         ''|0)   d_gmtime_r=undef
15785                 gmtime_r_proto=0
15786                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15787         * )     case "$gmtime_r_proto" in
15788                 REENTRANT_PROTO*) ;;
15789                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15790                 esac
15791                 echo "Prototype: $try" ;;
15792         esac
15793         ;;
15794         *)      case "$usethreads" in
15795                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15796                 esac
15797                 d_gmtime_r=undef
15798                 gmtime_r_proto=0
15799                 ;;
15800         esac
15801         ;;
15802 *)      gmtime_r_proto=0
15803         ;;
15804 esac
15805
15806 : see if hasmntopt exists
15807 set hasmntopt d_hasmntopt
15808 eval $inlibc
15809
15810 : see if this is a netinet/in.h or sys/in.h system
15811 set netinet/in.h i_niin sys/in.h i_sysin
15812 eval $inhdr
15813
15814 : see if arpa/inet.h has to be included
15815 set arpa/inet.h i_arpainet
15816 eval $inhdr
15817
15818 : see if htonl --and friends-- exists
15819 val=''
15820 set htonl val
15821 eval $inlibc
15822
15823 : Maybe they are macros.
15824 case "$val" in
15825 $undef)
15826         $cat >htonl.c <<EOM
15827 #include <stdio.h>
15828 #include <sys/types.h>
15829 #$i_niin I_NETINET_IN
15830 #$i_sysin I_SYS_IN
15831 #$i_arpainet I_ARPA_INET
15832 #ifdef I_NETINET_IN
15833 #include <netinet/in.h>
15834 #endif
15835 #ifdef I_SYS_IN
15836 #include <sys/in.h>
15837 #endif
15838 #ifdef I_ARPA_INET
15839 #include <arpa/inet.h>
15840 #endif
15841 #ifdef htonl
15842 printf("Defined as a macro.");
15843 #endif
15844 EOM
15845         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15846         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15847                 val="$define"
15848                 echo "But it seems to be defined as a macro." >&4
15849         fi
15850         $rm -f htonl.?
15851         ;;
15852 esac
15853 set d_htonl
15854 eval $setvar
15855
15856 : see if hypot exists
15857 set hypot d_hypot
15858 eval $inlibc
15859
15860 : see if ilogb exists
15861 set ilogb d_ilogb
15862 eval $inlibc
15863
15864 : see if ilogbl exists
15865 set ilogbl d_ilogbl
15866 eval $inlibc
15867
15868 : index or strchr
15869 echo " "
15870 if set index val -f; eval $csym; $val; then
15871         if set strchr val -f d_strchr; eval $csym; $val; then
15872                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15873                         val="$define"
15874                         vali="$undef"
15875                         echo "strchr() found." >&4
15876                 else
15877                         val="$undef"
15878                         vali="$define"
15879                         echo "index() found." >&4
15880                 fi
15881         else
15882                 val="$undef"
15883                 vali="$define"
15884                 echo "index() found." >&4
15885         fi
15886 else
15887         if set strchr val -f d_strchr; eval $csym; $val; then
15888                 val="$define"
15889                 vali="$undef"
15890                 echo "strchr() found." >&4
15891         else
15892                 echo "No index() or strchr() found!" >&4
15893                 val="$undef"
15894                 vali="$undef"
15895         fi
15896 fi
15897 set d_strchr; eval $setvar
15898 val="$vali"
15899 set d_index; eval $setvar
15900
15901 : check whether inet_aton exists
15902 set inet_aton d_inetaton
15903 eval $inlibc
15904
15905 : see if inet_ntop exists
15906 set inet_ntop d_inetntop
15907 eval $inlibc
15908
15909 : see if inet_pton exists
15910 set inet_pton d_inetpton
15911 eval $inlibc
15912
15913 : Look for isascii
15914 echo " "
15915 $cat >isascii.c <<EOCP
15916 #include <stdio.h>
15917 #include <ctype.h>
15918 #$i_stdlib I_STDLIB
15919 #ifdef I_STDLIB
15920 #include <stdlib.h>
15921 #endif
15922 int main() {
15923         int c = 'A';
15924         if (isascii(c))
15925                 exit(0);
15926         else
15927                 exit(1);
15928 }
15929 EOCP
15930 set isascii
15931 if eval $compile; then
15932         echo "isascii() found." >&4
15933         val="$define"
15934 else
15935         echo "isascii() NOT found." >&4
15936         val="$undef"
15937 fi
15938 set d_isascii
15939 eval $setvar
15940 $rm -f isascii*
15941
15942 : Look for isblank
15943 echo " "
15944 $cat >isblank.c <<'EOCP'
15945 #include <stdio.h>
15946 #include <ctype.h>
15947 int main() {
15948         int c = ' ';
15949         if (isblank(c))
15950                 return 0 ;
15951         else
15952                 return 1 ;
15953 }
15954 EOCP
15955 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15956         echo "isblank() found." >&4
15957         val="$define"
15958 else
15959         echo "isblank() NOT found." >&4
15960         val="$undef"
15961 fi
15962 set d_isblank
15963 eval $setvar
15964 $rm -f isblank*
15965
15966 : check for isfinite
15967 echo "Checking to see if you have isfinite..." >&4
15968 $cat >try.c <<EOCP
15969 #$i_math I_MATH
15970 #ifdef I_MATH
15971 #include <math.h>
15972 #endif
15973 int main() { return isfinite(0.0); }
15974 EOCP
15975 set try
15976 if eval $compile; then
15977         val="$define"
15978         echo "You have isfinite."
15979 else
15980         val="$undef"
15981         echo "You do not have isfinite."
15982 fi
15983 $rm_try
15984 set d_isfinite
15985 eval $setvar
15986
15987 : see if isfinitel exists
15988 set isfinitel d_isfinitel
15989 eval $inlibc
15990
15991 : check for isinf
15992 echo "Checking to see if you have isinf..." >&4
15993 $cat >try.c <<EOCP
15994 #$i_math I_MATH
15995 #ifdef I_MATH
15996 #include <math.h>
15997 #endif
15998 int main() { return isinf(0.0); }
15999 EOCP
16000 set try
16001 if eval $compile; then
16002         val="$define"
16003         echo "You have isinf."
16004 else
16005         val="$undef"
16006         echo "You do not have isinf."
16007 fi
16008 $rm_try
16009 set d_isinf
16010 eval $setvar
16011
16012 : see if isinfl exists
16013 set isinfl d_isinfl
16014 eval $inlibc
16015
16016 : check for isless
16017 echo "Checking to see if you have isless..." >&4
16018 $cat >try.c <<EOCP
16019 #$i_math I_MATH
16020 #ifdef I_MATH
16021 #include <math.h>
16022 #endif
16023 int main() { return isless(0.0); }
16024 EOCP
16025 set try
16026 if eval $compile; then
16027         val="$define"
16028         echo "You have isless."
16029 else
16030         val="$undef"
16031         echo "You do not have isless."
16032 fi
16033 $rm_try
16034 set d_isless
16035 eval $setvar
16036
16037 : check for isnan
16038 echo "Checking to see if you have isnan..." >&4
16039 $cat >try.c <<EOCP
16040 #$i_math I_MATH
16041 #ifdef I_MATH
16042 #include <math.h>
16043 #endif
16044 int main() { return isnan(0.0); }
16045 EOCP
16046 set try
16047 if eval $compile; then
16048         val="$define"
16049         echo "You have isnan."
16050 else
16051         val="$undef"
16052         echo "You do not have isnan."
16053 fi
16054 $rm_try
16055 set d_isnan
16056 eval $setvar
16057
16058 : see if isnanl exists
16059 set isnanl d_isnanl
16060 eval $inlibc
16061
16062 : check for isnormal
16063 echo "Checking to see if you have isnormal..." >&4
16064 $cat >try.c <<EOCP
16065 #$i_math I_MATH
16066 #ifdef I_MATH
16067 #include <math.h>
16068 #endif
16069 int main() { return isnormal(0.0); }
16070 EOCP
16071 set try
16072 if eval $compile; then
16073         val="$define"
16074         echo "You have isnormal."
16075 else
16076         val="$undef"
16077         echo "You do not have isnormal."
16078 fi
16079 $rm_try
16080 set d_isnormal
16081 eval $setvar
16082
16083 : see if j0 exists
16084 set j0 d_j0
16085 eval $inlibc
16086
16087 : see if j0l exists
16088 set j0l d_j0l
16089 eval $inlibc
16090
16091 : see if killpg exists
16092 set killpg d_killpg
16093 eval $inlibc
16094
16095 : see if localeconv exists
16096 set localeconv d_locconv
16097 eval $inlibc
16098
16099 : see if libc has the POSIX.1-2008 currency locale rules
16100 case "$d_locconv:$d_lc_monetary_2008" in
16101 $define:)
16102         $cat >try.c <<EOCP
16103 #include <locale.h>
16104 int main() {
16105         struct lconv *lc = localeconv();
16106         char int_p_cs_precedes = lc->int_p_cs_precedes;
16107         return 0;
16108 }
16109 EOCP
16110         set try
16111         if eval $compile; then
16112                 d_lc_monetary_2008="$define"
16113         else
16114                 d_lc_monetary_2008="$undef"
16115         fi;
16116         $rm_try
16117         ;;
16118 esac
16119
16120 : see if lchown exists
16121 echo " "
16122 $cat > try.c <<'EOCP'
16123 /* System header to define __stub macros and hopefully few prototypes,
16124     which can conflict with char lchown(); below.  */
16125 #include <assert.h>
16126 /* Override any gcc2 internal prototype to avoid an error.  */
16127 /* We use char because int might match the return type of a gcc2
16128    builtin and then its argument prototype would still apply.  */
16129 char lchown();
16130 int main() {
16131     /*  The GNU C library defines this for functions which it implements
16132         to always fail with ENOSYS.  Some functions are actually named
16133         something starting with __ and the normal name is an alias.  */
16134 #if defined (__stub_lchown) || defined (__stub___lchown)
16135 choke me
16136 #else
16137 lchown();
16138 #endif
16139 ; return 0; }
16140 EOCP
16141 set try
16142 if eval $compile; then
16143     $echo "lchown() found." >&4
16144     val="$define"
16145 else
16146     $echo "lchown() NOT found." >&4
16147     val="$undef"
16148 fi
16149 set d_lchown
16150 eval $setvar
16151
16152 : See if number of significant digits in a double precision number is known
16153 echo " "
16154 $cat >ldbl_dig.c <<EOM
16155 #$i_limits I_LIMITS
16156 #$i_float I_FLOAT
16157 #ifdef I_LIMITS
16158 #include <limits.h>
16159 #endif
16160 #ifdef I_FLOAT
16161 #include <float.h>
16162 #endif
16163 #ifdef LDBL_DIG
16164 printf("Contains LDBL_DIG");
16165 #endif
16166 EOM
16167 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
16168 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
16169         echo "LDBL_DIG found." >&4
16170         val="$define"
16171 else
16172         echo "LDBL_DIG NOT found." >&4
16173         val="$undef"
16174 fi
16175 $rm -f ldbl_dig.?
16176 set d_ldbl_dig
16177 eval $setvar
16178
16179 : see if lgamma exists
16180 set lgamma d_lgamma
16181 eval $inlibc
16182
16183 : see if lgamma_r exists
16184 set lgamma_r d_lgamma_r
16185 eval $inlibc
16186
16187 : check to see if math.h defines _LIB_VERSION
16188 d_libm_lib_version="$undef"
16189 case $i_math in
16190     $define)
16191         echo " "
16192         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
16193         $cat >try.c <<EOCP
16194 #include <unistd.h>
16195 #include <math.h>
16196 int main (int argc, char *argv[])
16197 {
16198     printf ("%d\n", _LIB_VERSION);
16199     return (0);
16200     } /* main */
16201 EOCP
16202         set try
16203         if eval $compile; then
16204             foo=`$run ./try`
16205             echo "Yes, it does ($foo)" >&4
16206             d_libm_lib_version="$define"
16207         else
16208             echo "No, it does not (probably harmless)" >&4
16209             fi
16210         $rm_try
16211         ;;
16212
16213     esac
16214
16215 : see if link exists
16216 set link d_link
16217 eval $inlibc
16218
16219 : see if llrint exists
16220 set llrint d_llrint
16221 eval $inlibc
16222
16223 : see if llrintl exists
16224 set llrintl d_llrintl
16225 eval $inlibc
16226
16227 : see if llround exists
16228 set llround d_llround
16229 eval $inlibc
16230
16231 : see if llroundl exists
16232 set llroundl d_llroundl
16233 eval $inlibc
16234
16235 : see if localtime_r exists
16236 set localtime_r d_localtime_r
16237 eval $inlibc
16238 case "$d_localtime_r" in
16239 "$define")
16240         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16241         case "$d_localtime_r_proto:$usethreads" in
16242         ":define")      d_localtime_r_proto=define
16243                 set d_localtime_r_proto localtime_r $hdrs
16244                 eval $hasproto ;;
16245         *)      ;;
16246         esac
16247         case "$d_localtime_r_proto" in
16248         define)
16249         case "$localtime_r_proto" in
16250         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16251         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16252         esac
16253         case "$localtime_r_proto" in
16254         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16255         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16256         esac
16257         case "$localtime_r_proto" in
16258         ''|0)   d_localtime_r=undef
16259                 localtime_r_proto=0
16260                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16261         * )     case "$localtime_r_proto" in
16262                 REENTRANT_PROTO*) ;;
16263                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16264                 esac
16265                 echo "Prototype: $try" ;;
16266         esac
16267         ;;
16268         *)      case "$usethreads" in
16269                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16270                 esac
16271                 d_localtime_r=undef
16272                 localtime_r_proto=0
16273                 ;;
16274         esac
16275         ;;
16276 *)      localtime_r_proto=0
16277         ;;
16278 esac
16279
16280 : see if localtime_r calls tzset
16281 case "$localtime_r_proto" in
16282 REENTRANT_PROTO*)
16283         $cat >try.c <<EOCP
16284 /*  Does our libc's localtime_r call tzset ?
16285  *  return 0 if so, 1 otherwise.
16286  */
16287 #$i_systypes    I_SYS_TYPES
16288 #$i_unistd      I_UNISTD
16289 #$i_time        I_TIME
16290 #$i_stdlib      I_STDLIB
16291 #$i_string      I_STRING
16292 #$i_malloc      I_MALLOC
16293 #ifdef I_SYS_TYPES
16294 #  include <sys/types.h>
16295 #endif
16296 #ifdef I_UNISTD
16297 #  include <unistd.h>
16298 #endif
16299 #ifdef I_TIME
16300 #  include <time.h>
16301 #endif
16302 #ifdef I_STDLIB
16303 #include <stdlib.h>
16304 #endif
16305 #ifdef I_STRING
16306 #  include <string.h>
16307 #else
16308 #  include <strings.h>
16309 #endif
16310 #ifdef I_MALLOC
16311 #  include <malloc.h>
16312 #endif
16313 int main()
16314 {
16315     time_t t = time(0L);
16316     char w_tz[]="TZ" "=GMT+5",
16317          e_tz[]="TZ" "=GMT-5",
16318         *tz_e = (char*)malloc(16),
16319         *tz_w = (char*)malloc(16);
16320     struct tm tm_e, tm_w;
16321     memset(&tm_e,'\0',sizeof(struct tm));
16322     memset(&tm_w,'\0',sizeof(struct tm));
16323     strcpy(tz_e,e_tz);
16324     strcpy(tz_w,w_tz);
16325
16326     putenv(tz_e);
16327     localtime_r(&t, &tm_e);
16328
16329     putenv(tz_w);
16330     localtime_r(&t, &tm_w);
16331
16332     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16333         return 1;
16334     return 0;
16335 }
16336 EOCP
16337         set try
16338         if eval $compile; then
16339             if $run ./try; then
16340                 d_localtime_r_needs_tzset=undef;
16341             else
16342                 d_localtime_r_needs_tzset=define;
16343             fi;
16344         else
16345             d_localtime_r_needs_tzset=undef;
16346         fi;
16347      ;;
16348   *)
16349      d_localtime_r_needs_tzset=undef;
16350      ;;
16351 esac
16352 $rm_try
16353
16354 : see if lockf exists
16355 set lockf d_lockf
16356 eval $inlibc
16357
16358 : see if log1p exists
16359 set log1p d_log1p
16360 eval $inlibc
16361
16362 : see if log2 exists
16363 set log2 d_log2
16364 eval $inlibc
16365
16366 : see if logb exists
16367 set logb d_logb
16368 eval $inlibc
16369
16370 : see if lrint exists
16371 set lrint d_lrint
16372 eval $inlibc
16373
16374 : see if lrintl exists
16375 set lrintl d_lrintl
16376 eval $inlibc
16377
16378 : see if lround exists
16379 set lround d_lround
16380 eval $inlibc
16381
16382 : see if lroundl exists
16383 set lroundl d_lroundl
16384 eval $inlibc
16385
16386 : see if prototype for lseek is available
16387 echo " "
16388 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16389 eval $hasproto
16390
16391 : see if lstat exists
16392 set lstat d_lstat
16393 eval $inlibc
16394
16395 : see if madvise exists
16396 set madvise d_madvise
16397 eval $inlibc
16398
16399 : see if malloc_size exists
16400 set malloc_size d_malloc_size
16401 eval $inlibc
16402
16403 : see if malloc_size_good exists
16404 set malloc_good_size d_malloc_good_size
16405 eval $inlibc
16406
16407 : see if mblen exists
16408 set mblen d_mblen
16409 eval $inlibc
16410
16411 : see if mbstowcs exists
16412 set mbstowcs d_mbstowcs
16413 eval $inlibc
16414
16415 : see if mbtowc exists
16416 set mbtowc d_mbtowc
16417 eval $inlibc
16418
16419 : see if memchr exists
16420 set memchr d_memchr
16421 eval $inlibc
16422
16423 : see if memcmp exists
16424 set memcmp d_memcmp
16425 eval $inlibc
16426
16427 : see if memcpy exists
16428 set memcpy d_memcpy
16429 eval $inlibc
16430
16431 : see if memmem exists
16432 set memmem d_memmem
16433 eval $inlibc
16434
16435 : see if memmove exists
16436 set memmove d_memmove
16437 eval $inlibc
16438
16439 : see if memset exists
16440 set memset d_memset
16441 eval $inlibc
16442
16443 : see if mkdir exists
16444 set mkdir d_mkdir
16445 eval $inlibc
16446
16447 : see if mkdtemp exists
16448 set mkdtemp d_mkdtemp
16449 eval $inlibc
16450
16451 : see if mkfifo exists
16452 set mkfifo d_mkfifo
16453 eval $inlibc
16454
16455 : see if mkstemp exists
16456 set mkstemp d_mkstemp
16457 eval $inlibc
16458
16459 : see if mkstemps exists
16460 set mkstemps d_mkstemps
16461 eval $inlibc
16462
16463 : see if mktime exists
16464 set mktime d_mktime
16465 eval $inlibc
16466
16467 : see if this is a sys/mman.h system
16468 set sys/mman.h i_sysmman
16469 eval $inhdr
16470
16471 : see if mmap exists
16472 set mmap d_mmap
16473 eval $inlibc
16474 : see what shmat returns
16475 : default to something harmless
16476 mmaptype='void *'
16477 case "$i_sysmman$d_mmap" in
16478 "$define$define")
16479         $cat >mmap.c <<'END'
16480 #include <sys/mman.h>
16481 void *mmap();
16482 END
16483         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16484                 mmaptype='void *'
16485         else
16486                 mmaptype='caddr_t'
16487         fi
16488         echo "and it returns ($mmaptype)." >&4
16489         ;;
16490 esac
16491
16492
16493
16494 : see if sqrtl exists
16495 set sqrtl d_sqrtl
16496 eval $inlibc
16497
16498 : see if scalbnl exists
16499 set scalbnl d_scalbnl
16500 eval $inlibc
16501
16502 : see if truncl exists
16503 set truncl d_truncl
16504 eval $inlibc
16505
16506 : see if modfl exists
16507 set modfl d_modfl
16508 eval $inlibc
16509
16510 : see if prototype for modfl is available
16511 echo " "
16512 set d_modflproto modfl $i_math math.h
16513 eval $hasproto
16514
16515 if $test "$uselongdouble" = "$define"; then
16516     message=""
16517     if $test "$d_sqrtl" != "$define"; then
16518         message="$message sqrtl"
16519     fi
16520     if $test "$d_modfl" != "$define"; then
16521         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16522             echo "You have both truncl and copysignl, so I can emulate modfl."
16523         else
16524             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16525                 echo "You have both aintl and copysignl, so I can emulate modfl."
16526             else
16527                 message="$message modfl"
16528             fi
16529         fi
16530     fi
16531     if $test "$d_frexpl" != "$define"; then
16532         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16533             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16534         else
16535             message="$message frexpl"
16536         fi
16537     fi
16538     if $test "$d_ldexpl" != "$define"; then
16539         message="$message ldexpl"
16540     fi
16541
16542     if $test "$message" != ""; then
16543         $cat <<EOM >&4
16544
16545 *** You requested the use of long doubles but you do not seem to have
16546 *** the following mathematical functions needed for long double support:
16547 ***    $message
16548 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16549 *** Cannot continue, aborting.
16550
16551 EOM
16552
16553         exit 1
16554     fi
16555 fi
16556
16557 : see if mprotect exists
16558 set mprotect d_mprotect
16559 eval $inlibc
16560
16561 : see if msgctl exists
16562 set msgctl d_msgctl
16563 eval $inlibc
16564
16565 : see if msgget exists
16566 set msgget d_msgget
16567 eval $inlibc
16568
16569 : see if msgsnd exists
16570 set msgsnd d_msgsnd
16571 eval $inlibc
16572
16573 : see if msgrcv exists
16574 set msgrcv d_msgrcv
16575 eval $inlibc
16576
16577 : see how much of the 'msg*(2)' library is present.
16578 h_msg=true
16579 echo " "
16580 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16581 *"$undef"*) h_msg=false;;
16582 esac
16583 case "$osname" in
16584 freebsd)
16585     case "`ipcs 2>&1`" in
16586     "SVID messages"*"not configured"*)
16587         echo "Your $osname does not have the msg*(2) configured." >&4
16588         h_msg=false
16589         val="$undef"
16590         set msgctl d_msgctl
16591         eval $setvar
16592         set msgget d_msgget
16593         eval $setvar
16594         set msgsnd d_msgsnd
16595         eval $setvar
16596         set msgrcv d_msgrcv
16597         eval $setvar
16598         ;;
16599     esac
16600     ;;
16601 esac
16602 : we could also check for sys/ipc.h ...
16603 if $h_msg && $test `./findhdr sys/msg.h`; then
16604         echo "You have the full msg*(2) library." >&4
16605         val="$define"
16606 else
16607         echo "You don't have the full msg*(2) library." >&4
16608         val="$undef"
16609 fi
16610 set d_msg
16611 eval $setvar
16612
16613 : Check for msghdr_s
16614 echo " "
16615 echo "Checking to see if your system supports struct msghdr..." >&4
16616 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16617 eval $hasstruct
16618 case "$d_msghdr_s" in
16619 "$define")      echo "Yes, it does."   ;;
16620 *)              echo "No, it doesn't." ;;
16621 esac
16622
16623
16624 : see if msync exists
16625 set msync d_msync
16626 eval $inlibc
16627
16628 : see if munmap exists
16629 set munmap d_munmap
16630 eval $inlibc
16631
16632 : see if nan exists
16633 set nan d_nan
16634 eval $inlibc
16635
16636 : see if nearbyint exists
16637 set nearbyint d_nearbyint
16638 eval $inlibc
16639
16640 : see if nextafter exists
16641 set nextafter d_nextafter
16642 eval $inlibc
16643
16644 : see if nexttoward exists
16645 set nexttoward d_nexttoward
16646 eval $inlibc
16647
16648 : see if nice exists
16649 set nice d_nice
16650 eval $inlibc
16651
16652 : see if this is a langinfo.h system
16653 set langinfo.h i_langinfo
16654 eval $inhdr
16655
16656 : see if nl_langinfo exists
16657 set nl_langinfo d_nl_langinfo
16658 eval $inlibc
16659
16660 : see if this is a quadmath.h system
16661 set quadmath.h i_quadmath
16662 eval $inhdr
16663
16664 : check for volatile keyword
16665 echo " "
16666 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
16667 $cat >try.c <<'EOCP'
16668 int main()
16669 {
16670         typedef struct _goo_struct goo_struct;
16671         goo_struct * volatile goo = ((goo_struct *)0);
16672         struct _goo_struct {
16673                 long long_int;
16674                 int reg_int;
16675                 char char_var;
16676         };
16677         typedef unsigned short foo_t;
16678         char *volatile foo;
16679         volatile int bar;
16680         volatile foo_t blech;
16681         foo = foo;
16682 }
16683 EOCP
16684 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
16685         val="$define"
16686         echo "Yup, it does."
16687 else
16688         val="$undef"
16689         echo "Nope, it doesn't."
16690 fi
16691 set d_volatile
16692 eval $setvar
16693 $rm_try
16694
16695 : Check basic sizes
16696 echo " "
16697 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16698
16699 case "$use64bitint:$d_quad:$quadtype" in
16700 define:define:?*)
16701         ivtype="$quadtype"
16702         uvtype="$uquadtype"
16703         ivsize=8
16704         uvsize=8
16705         ;;
16706 *)      ivtype="long"
16707         uvtype="unsigned long"
16708         ivsize=$longsize
16709         uvsize=$longsize
16710         ;;
16711 esac
16712
16713 case "$uselongdouble:$d_longdbl" in
16714 define:define)
16715         nvtype="long double"
16716         nvsize=$longdblsize
16717         ;;
16718 *)      nvtype=double
16719         nvsize=$doublesize
16720         ;;
16721 esac
16722
16723 case "$usequadmath:$i_quadmath" in
16724 define:define)
16725   nvtype="__float128"
16726   nvsize=16
16727   case "$libs" in
16728   *quadmath*) ;;
16729   *) $cat <<EOM >&4
16730
16731 *** You requested the use of the quadmath library, but you
16732 *** do not seem to have the quadmath library installed.
16733 *** Cannot continue, aborting.
16734 EOM
16735     exit 1
16736     ;;
16737   esac
16738   ;;
16739 define:*) $cat <<EOM >&4
16740
16741 *** You requested the use of the quadmath library, but you
16742 *** do not seem to have the required header, <quadmath.h>.
16743 EOM
16744   case "$gccversion" in
16745   [23].*|4.[0-5]*)
16746    $cat <<EOM >&4
16747 *** Your gcc looks a bit old:
16748 *** $gccversion
16749 EOM
16750     ;;
16751   '')
16752    $cat <<EOM >&4
16753 *** You are not running a gcc.
16754 EOM
16755     ;;
16756   esac
16757   $cat <<EOM >&4
16758 *** For the quadmath library you need at least gcc 4.6.
16759 *** Cannot continue, aborting.
16760 EOM
16761   exit 1
16762   ;;
16763 esac
16764
16765 $echo "(IV will be "$ivtype", $ivsize bytes)"
16766 $echo "(UV will be "$uvtype", $uvsize bytes)"
16767 $echo "(NV will be "$nvtype", $nvsize bytes)"
16768
16769 $cat >try.c <<EOCP
16770 #$i_inttypes I_INTTYPES
16771 #ifdef I_INTTYPES
16772 #include <inttypes.h>
16773 #endif
16774 #include <stdio.h>
16775 int main() {
16776 #ifdef INT8
16777    int8_t i =  INT8_MAX;
16778   uint8_t u = UINT8_MAX;
16779   printf("int8_t\n");
16780 #endif
16781 #ifdef INT16
16782    int16_t i =  INT16_MAX;
16783   uint16_t u = UINT16_MAX;
16784   printf("int16_t\n");
16785 #endif
16786 #ifdef INT32
16787    int32_t i =  INT32_MAX;
16788   uint32_t u = UINT32_MAX;
16789   printf("int32_t\n");
16790 #endif
16791 }
16792 EOCP
16793
16794 i8type="signed char"
16795 u8type="unsigned char"
16796 i8size=1
16797 u8size=1
16798
16799 case "$i16type" in
16800 '')     case "$shortsize" in
16801         2)      i16type=short
16802                 u16type="unsigned short"
16803                 i16size=$shortsize
16804                 u16size=$shortsize
16805                 ;;
16806         esac
16807         ;;
16808 esac
16809 case "$i16type" in
16810 '')     set try -DINT16
16811         if eval $compile; then
16812                 case "`$run ./try`" in
16813                 int16_t)
16814                         i16type=int16_t
16815                         u16type=uint16_t
16816                         i16size=2
16817                         u16size=2
16818                         ;;
16819                 esac
16820         fi
16821         ;;
16822 esac
16823 case "$i16type" in
16824 '')     if $test $shortsize -ge 2; then
16825                 i16type=short
16826                 u16type="unsigned short"
16827                 i16size=$shortsize
16828                 u16size=$shortsize
16829         fi
16830         ;;
16831 esac
16832
16833 case "$i32type" in
16834 '')     case "$longsize" in
16835         4)      i32type=long
16836                 u32type="unsigned long"
16837                 i32size=$longsize
16838                 u32size=$longsize
16839                 ;;
16840         *)      case "$intsize" in
16841                 4)      i32type=int
16842                         u32type="unsigned int"
16843                         i32size=$intsize
16844                         u32size=$intsize
16845                         ;;
16846                 esac
16847                 ;;
16848         esac
16849         ;;
16850 esac
16851 case "$i32type" in
16852 '')     set try -DINT32
16853         if eval $compile; then
16854                 case "`$run ./try`" in
16855                 int32_t)
16856                         i32type=int32_t
16857                         u32type=uint32_t
16858                         i32size=4
16859                         u32size=4
16860                         ;;
16861                 esac
16862         fi
16863         ;;
16864 esac
16865 case "$i32type" in
16866 '')     if $test $intsize -ge 4; then
16867                 i32type=int
16868                 u32type="unsigned int"
16869                 i32size=$intsize
16870                 u32size=$intsize
16871         fi
16872         ;;
16873 esac
16874
16875 case "$i64type" in
16876 '')     case "$d_quad:$quadtype" in
16877         define:?*)
16878                 i64type="$quadtype"
16879                 u64type="$uquadtype"
16880                 i64size=8
16881                 u64size=8
16882                 ;;
16883         esac
16884         ;;
16885 esac
16886
16887 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16888 : volatile so that the compiler has to store it out to memory.
16889 if test X"$d_volatile" = X"$define"; then
16890         volatile=volatile
16891 fi
16892 $cat <<EOP >try.c
16893 #include <stdio.h>
16894 #$i_stdlib I_STDLIB
16895 #ifdef I_STDLIB
16896 #include <stdlib.h>
16897 #endif
16898 #include <sys/types.h>
16899 #include <signal.h>
16900 #ifdef SIGFPE
16901 $volatile int bletched = 0;
16902 $signal_t blech(int s) { bletched = 1; }
16903 #endif
16904 int main() {
16905     $uvtype u = 0;
16906     $nvtype d;
16907     int     n = 8 * $uvsize;
16908     int     i;
16909 #ifdef SIGFPE
16910     signal(SIGFPE, blech);
16911 #endif
16912
16913     for (i = 0; i < n; i++) {
16914       u = u << 1 | ($uvtype)1;
16915       d = ($nvtype)u;
16916       if (($uvtype)d != u)
16917         break;
16918       if (d <= 0)
16919         break;
16920       d = ($nvtype)(u - 1);
16921       if (($uvtype)d != (u - 1))
16922         break;
16923 #ifdef SIGFPE
16924       if (bletched)
16925         break;
16926 #endif
16927     }
16928     printf("%d\n", ((i == n) ? -n : i));
16929     exit(0);
16930 }
16931 EOP
16932 set try
16933
16934 d_nv_preserves_uv="$undef"
16935 if eval $compile; then
16936         nv_preserves_uv_bits="`$run ./try`"
16937 fi
16938 case "$nv_preserves_uv_bits" in
16939 \-[1-9]*)
16940         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16941         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16942         d_nv_preserves_uv="$define"
16943         ;;
16944 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16945         d_nv_preserves_uv="$undef" ;;
16946 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16947         nv_preserves_uv_bits="0" ;;
16948 esac
16949 $rm_try
16950
16951 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16952 : volatile so that the compiler has to store it out to memory.
16953 if test X"$d_volatile" = X"$define"; then
16954         volatile=volatile
16955 fi
16956 $cat <<EOP >try.c
16957 #include <stdio.h>
16958
16959 typedef $nvtype NV;
16960
16961 int
16962 main() {
16963   NV value = 2;
16964   int count = 1;
16965
16966   while(count < 256) {
16967     $volatile NV up = value + 1.0;
16968     $volatile NV negated = -value;
16969     $volatile NV down = negated - 1.0;
16970     $volatile NV got_up = up - value;
16971     int up_good = got_up == 1.0;
16972     int got_down = down - negated;
16973     int down_good = got_down == -1.0;
16974
16975     if (down_good != up_good) {
16976       fprintf(stderr,
16977               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16978               up_good, (double) got_up, down_good, (double) got_down,
16979               count, (double) value);
16980       return 1;
16981     }
16982     if (!up_good) {
16983       while (1) {
16984         if (count > 8) {
16985           count -= 8;
16986           fputs("256.0", stdout);
16987         } else {
16988           count--;
16989           fputs("2.0", stdout);
16990         }
16991         if (!count) {
16992           puts("");
16993           return 0;
16994         }
16995         fputs("*", stdout);
16996       }
16997     }
16998     value *= 2;
16999     ++count;
17000   }
17001   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
17002           count, (double) value);
17003   return 1;
17004 }
17005 EOP
17006 set try
17007
17008 nv_overflows_integers_at='0'
17009 if eval $compile; then
17010     xxx="`$run ./try`"
17011     case "$?" in
17012         0)
17013             case "$xxx" in
17014                 2*)  cat >&4 <<EOM
17015 The largest integer your NVs can preserve is equal to $xxx
17016 EOM
17017                     nv_overflows_integers_at="$xxx"
17018                     ;;
17019                 *)  cat >&4 <<EOM
17020 Cannot determine the largest integer value your NVs can hold, unexpected output
17021 '$xxx'
17022 EOM
17023                     ;;
17024             esac
17025             ;;
17026         *)  cat >&4 <<EOM
17027 Cannot determine the largest integer value your NVs can hold
17028 EOM
17029             ;;
17030     esac
17031 fi
17032 $rm_try
17033
17034 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
17035 : volatile so that the compiler has to store it out to memory.
17036 if test X"$d_volatile" = X"$define"; then
17037         volatile=volatile
17038 fi
17039 $cat <<EOP >try.c
17040 #include <stdio.h>
17041 #$i_stdlib I_STDLIB
17042 #ifdef I_STDLIB
17043 #include <stdlib.h>
17044 #endif
17045 #$i_string I_STRING
17046 #ifdef I_STRING
17047 #  include <string.h>
17048 #else
17049 #  include <strings.h>
17050 #endif
17051 #include <sys/types.h>
17052 #include <signal.h>
17053 #ifdef SIGFPE
17054 $volatile int bletched = 0;
17055 $signal_t blech(int s) { bletched = 1; }
17056 #endif
17057
17058 int checkit($nvtype d, char *where) {
17059     unsigned char *p = (char *)&d;
17060     unsigned char *end = p + sizeof(d);
17061     int fail = 0;
17062
17063     while (p < end)
17064         fail += *p++;
17065
17066     if (!fail)
17067         return 0;
17068
17069     p = (char *)&d;
17070     printf("No - %s: 0x", where);
17071     while (p < end)
17072         printf ("%02X", *p++);
17073     printf("\n");
17074     return 1;
17075 }
17076
17077 int main(int argc, char **argv) {
17078     $nvtype d = 0.0;
17079     int fail = 0;
17080     fail += checkit(d, "0.0");
17081
17082     /* The compiler shouldn't be assuming that bletched is 0  */
17083     d = bletched;
17084
17085     fail += checkit(d, "bleched");
17086
17087 #ifdef SIGFPE
17088     signal(SIGFPE, blech);
17089 #endif
17090
17091     /* Paranoia - the compiler should have no way of knowing that ANSI says
17092        that argv[argc] will always be NULL.  Actually, if it did assume this it
17093        would be buggy, as this is C and main() can be called from elsewhere in
17094        the program.  */
17095     d = argv[argc] ? 1 : 0;
17096
17097     if (d) {
17098         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
17099     }
17100
17101     fail += checkit(d, "ternary");
17102
17103     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
17104
17105     if (d != 0.0) {
17106         printf("No - memset doesn't give 0.0\n");
17107         /* This might just blow up:  */
17108         printf("(gives %g)\n", d);
17109         return 1;
17110     }
17111
17112 #ifdef SIGFPE
17113     if (bletched) {
17114         printf("No - something bleched\n");
17115         return 1;
17116     }
17117 #endif
17118     if (fail) {
17119       printf("No - %d fail(s)\n", fail);
17120       return 1;
17121     }
17122     printf("Yes\n");
17123     return 0;
17124 }
17125 EOP
17126 set try
17127
17128 d_nv_zero_is_allbits_zero="$undef"
17129 if eval $compile; then
17130     xxx="`$run ./try`"
17131     case "$?" in
17132         0)
17133             case "$xxx" in
17134                 Yes)  cat >&4 <<EOM
17135 0.0 is represented as all bits zero in memory
17136 EOM
17137                     d_nv_zero_is_allbits_zero="$define"
17138                     ;;
17139                 *)  cat >&4 <<EOM
17140 0.0 is not represented as all bits zero in memory
17141 EOM
17142                     d_nv_zero_is_allbits_zero="$undef"
17143                     ;;
17144             esac
17145             ;;
17146         *)  cat >&4 <<EOM
17147 0.0 is not represented as all bits zero in memory
17148 EOM
17149             d_nv_zero_is_allbits_zero="$undef"
17150             ;;
17151     esac
17152 fi
17153 $rm_try
17154
17155 : check for off64_t
17156 echo " "
17157 echo "Checking to see if you have off64_t..." >&4
17158 $cat >try.c <<EOCP
17159 #include <sys/types.h>
17160 #include <unistd.h>
17161 int main() { off64_t x = 7; }
17162 EOCP
17163 set try
17164 if eval $compile; then
17165         val="$define"
17166         echo "You have off64_t."
17167 else
17168         val="$undef"
17169         echo "You do not have off64_t."
17170         case "$lseeksize" in
17171         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
17172         esac
17173 fi
17174 $rm_try
17175 set d_off64_t
17176 eval $setvar
17177
17178 : how to create joinable pthreads
17179 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
17180         echo " "
17181         echo "Checking what constant to use for creating joinable pthreads..." >&4
17182         $cat >try.c <<'EOCP'
17183 #include <pthread.h>
17184 int main() {
17185     int detachstate = JOINABLE;
17186 }
17187 EOCP
17188         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
17189         if eval $compile; then
17190                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
17191                 val="$undef" # Yes, undef.
17192                 set d_old_pthread_create_joinable
17193                 eval $setvar
17194                 val=""
17195                 set old_pthread_create_joinable
17196                 eval $setvar
17197         else
17198                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
17199                 if eval $compile; then
17200                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
17201                         val="$define"
17202                         set d_old_pthread_create_joinable
17203                         eval $setvar
17204                         val=PTHREAD_CREATE_UNDETACHED
17205                         set old_pthread_create_joinable
17206                         eval $setvar
17207                 else
17208                         set try -DJOINABLE=__UNDETACHED
17209                         if eval $compile; then
17210                                 echo "You seem to use __UNDETACHED." >&4
17211                                 val="$define"
17212                                 set d_old_pthread_create_joinable
17213                                 eval $setvar
17214                                 val=__UNDETACHED
17215                                 set old_pthread_create_joinable
17216                                 eval $setvar
17217                         else
17218                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
17219                                 val="$define"
17220                                 set d_old_pthread_create_joinable
17221                                 eval $setvar
17222                                 val=0
17223                                 set old_pthread_create_joinable
17224                                 eval $setvar
17225                         fi
17226                 fi
17227         fi
17228         $rm_try
17229 else
17230     d_old_pthread_create_joinable="$undef"
17231     old_pthread_create_joinable=""
17232 fi
17233
17234 : see if pause exists
17235 set pause d_pause
17236 eval $inlibc
17237
17238 : see if poll exists
17239 set poll d_poll
17240 eval $inlibc
17241
17242 : see if prctl exists
17243 set prctl d_prctl
17244 eval $inlibc
17245
17246 : see if prctl supports PR_SET_NAME
17247 d_prctl_set_name=$undef
17248 case $d_prctl in
17249     $define)
17250         $cat >try.c <<EOM
17251 #ifdef __ANDROID__
17252 #include <unistd.h>
17253 #endif
17254 #include <sys/prctl.h>
17255
17256 int main (int argc, char *argv[])
17257 {
17258     return (prctl (PR_SET_NAME, "Test"));
17259     } /* main */
17260 EOM
17261         set try
17262         if eval $compile_ok && $run ./try; then
17263             echo "Your prctl (PR_SET_NAME, ...) works"
17264             d_prctl_set_name=$define
17265             fi
17266         $rm_try
17267         ;;
17268     esac
17269
17270 : see if readlink exists
17271 set readlink d_readlink
17272 eval $inlibc
17273
17274 : Check if there is a /proc symlink to the abs path of
17275 : the executing program.  We will honor hints of d_procselfexe=$undef
17276 : or procselfexe being non-empty, otherwise will try to determine both
17277 : if we have readlink.
17278 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
17279 : referenced, and AmigaOS does not have a proc filesystem anyway.
17280 echo " "
17281 val="$undef"
17282 if $test "X$d_procselfexe" = Xundef; then
17283         procselfexe=''
17284 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
17285         val="$define"
17286 elif $test "X$d_readlink" = Xdefine; then
17287         : NetBSD first as /proc/self is a symlink to /proc/curproc,
17288         : and it feels more tidy to avoid an extra level of symlink
17289         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17290         while test $# -gt 0; do
17291             type=$1; try=$2
17292             shift; shift
17293             if $issymlink $try; then
17294                 $ls -l $try > reflect
17295                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17296                     echo "You have $type-like $try."
17297                     procselfexe='"'$try'"'
17298                     val="$define"
17299                     : This will break out of the loop
17300                     set X; shift
17301                 fi
17302             fi
17303         done
17304 fi
17305 $rm -f reflect
17306 set d_procselfexe
17307 eval $setvar
17308
17309 : backward compatibility for d_hvfork
17310 if test X$d_hvfork != X; then
17311         d_vfork="$d_hvfork"
17312         d_hvfork=''
17313 fi
17314 : see if there is a vfork
17315 val=''
17316 set vfork val
17317 eval $inlibc
17318
17319 d_pseudofork=$undef
17320
17321 : Ok, but do we want to use it. vfork is reportedly unreliable in
17322 : perl on Solaris 2.x, and probably elsewhere.
17323 case "$val" in
17324 $define)
17325         echo " "
17326         case "$usevfork" in
17327         false) dflt='n';;
17328         *) dflt='y';;
17329         esac
17330         cat <<'EOM'
17331
17332 Perl can only use a vfork() that doesn't suffer from strict
17333 restrictions on calling functions or modifying global data in
17334 the child.  For example, glibc-2.1 contains such a vfork()
17335 that is unsuitable.  If your system provides a proper fork()
17336 call, chances are that you do NOT want perl to use vfork().
17337
17338 EOM
17339         rp="Do you still want to use vfork()?"
17340         . ./myread
17341         case "$ans" in
17342         y|Y) ;;
17343         *)
17344                 echo "Ok, we won't use vfork()."
17345                 val="$undef"
17346                 ;;
17347         esac
17348         ;;
17349 esac
17350 set d_vfork
17351 eval $setvar
17352 case "$d_vfork" in
17353 $define) usevfork='true';;
17354 *) usevfork='false';;
17355 esac
17356
17357 : see whether the pthread_atfork exists
17358 $cat >try.c <<EOP
17359 #include <pthread.h>
17360 #include <stdio.h>
17361 int main() {
17362 #ifdef  PTHREAD_ATFORK
17363         pthread_atfork(NULL,NULL,NULL);
17364 #endif
17365 }
17366 EOP
17367
17368 : see if pthread_atfork exists
17369 set try -DPTHREAD_ATFORK
17370 if eval $compile; then
17371     val="$define"
17372 else
17373     val="$undef"
17374 fi
17375 case "$usethreads" in
17376 $define)
17377         case "$val" in
17378         $define) echo 'pthread_atfork found.' >&4        ;;
17379         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17380         esac
17381 esac
17382 set d_pthread_atfork
17383 eval $setvar
17384
17385 : see if pthread_attr_setscope exists
17386 set pthread_attr_setscope d_pthread_attr_setscope
17387 eval $inlibc
17388
17389 : see whether the various POSIXish _yields exist
17390 $cat >try.c <<EOP
17391 #include <pthread.h>
17392 #include <stdio.h>
17393 int main() {
17394 #ifdef SCHED_YIELD
17395         sched_yield();
17396 #else
17397 #ifdef PTHREAD_YIELD
17398         pthread_yield();
17399 #else
17400 #ifdef PTHREAD_YIELD_NULL
17401         pthread_yield(NULL);
17402 #endif
17403 #endif
17404 #endif
17405 }
17406 EOP
17407 : see if sched_yield exists
17408 set try -DSCHED_YIELD
17409 if eval $compile; then
17410     val="$define"
17411     sched_yield='sched_yield()'
17412 else
17413     val="$undef"
17414 fi
17415 case "$usethreads" in
17416 $define)
17417         case "$val" in
17418         $define) echo 'sched_yield() found.' >&4        ;;
17419         *)       echo 'sched_yield() NOT found.' >&4    ;;
17420         esac
17421 esac
17422 set d_sched_yield
17423 eval $setvar
17424
17425 : see if pthread_yield exists
17426 set try -DPTHREAD_YIELD
17427 if eval $compile; then
17428     val="$define"
17429     case "$sched_yield" in
17430     '') sched_yield='pthread_yield()' ;;
17431     esac
17432 else
17433     set try -DPTHREAD_YIELD_NULL
17434     if eval $compile; then
17435         val="$define"
17436         case "$sched_yield" in
17437         '') sched_yield='pthread_yield(NULL)' ;;
17438         esac
17439     else
17440         val="$undef"
17441     fi
17442 fi
17443 case "$usethreads" in
17444 $define)
17445         case "$val" in
17446         $define) echo 'pthread_yield() found.' >&4      ;;
17447         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17448         esac
17449         ;;
17450 esac
17451 set d_pthread_yield
17452 eval $setvar
17453 case "$sched_yield" in
17454 '') sched_yield=undef ;;
17455 esac
17456 $rm_try
17457
17458 : check for ptrdiff_t
17459 echo " "
17460 echo "Checking to see if you have ptrdiff_t..." >&4
17461 $cat >try.c <<EOCP
17462 #include <stddef.h>
17463 int main() { ptrdiff_t x = 7; }
17464 EOCP
17465 set try
17466 if eval $compile; then
17467         val="$define"
17468         echo "You have ptrdiff_t."
17469 else
17470         val="$undef"
17471         echo "You do not have ptrdiff_t."
17472 fi
17473 $rm_try
17474 set d_ptrdiff_t
17475 eval $setvar
17476
17477 : see if random_r exists
17478 set random_r d_random_r
17479 eval $inlibc
17480 case "$d_random_r" in
17481 "$define")
17482         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17483         case "$d_random_r_proto:$usethreads" in
17484         ":define")      d_random_r_proto=define
17485                 set d_random_r_proto random_r $hdrs
17486                 eval $hasproto ;;
17487         *)      ;;
17488         esac
17489         case "$d_random_r_proto" in
17490         define)
17491         case "$random_r_proto" in
17492         ''|0) try='int random_r(int*, struct random_data*);'
17493         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17494         esac
17495         case "$random_r_proto" in
17496         ''|0) try='int random_r(long*, struct random_data*);'
17497         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17498         esac
17499         case "$random_r_proto" in
17500         ''|0) try='int random_r(struct random_data*, int32_t*);'
17501         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17502         esac
17503         case "$random_r_proto" in
17504         ''|0)   d_random_r=undef
17505                 random_r_proto=0
17506                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17507         * )     case "$random_r_proto" in
17508                 REENTRANT_PROTO*) ;;
17509                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17510                 esac
17511                 echo "Prototype: $try" ;;
17512         esac
17513         ;;
17514         *)      case "$usethreads" in
17515                 define) echo "random_r has no prototype, not using it." >&4 ;;
17516                 esac
17517                 d_random_r=undef
17518                 random_r_proto=0
17519                 ;;
17520         esac
17521         ;;
17522 *)      random_r_proto=0
17523         ;;
17524 esac
17525
17526 : see if readdir and friends exist
17527 set readdir d_readdir
17528 eval $inlibc
17529 set seekdir d_seekdir
17530 eval $inlibc
17531 set telldir d_telldir
17532 eval $inlibc
17533 set rewinddir d_rewinddir
17534 eval $inlibc
17535
17536 : see if readdir64_r exists
17537 set readdir64_r d_readdir64_r
17538 eval $inlibc
17539 case "$d_readdir64_r" in
17540 "$define")
17541         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17542         case "$d_readdir64_r_proto:$usethreads" in
17543         ":define")      d_readdir64_r_proto=define
17544                 set d_readdir64_r_proto readdir64_r $hdrs
17545                 eval $hasproto ;;
17546         *)      ;;
17547         esac
17548         case "$d_readdir64_r_proto" in
17549         define)
17550         case "$readdir64_r_proto" in
17551         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17552         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17553         esac
17554         case "$readdir64_r_proto" in
17555         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17556         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17557         esac
17558         case "$readdir64_r_proto" in
17559         ''|0)   d_readdir64_r=undef
17560                 readdir64_r_proto=0
17561                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17562         * )     case "$readdir64_r_proto" in
17563                 REENTRANT_PROTO*) ;;
17564                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17565                 esac
17566                 echo "Prototype: $try" ;;
17567         esac
17568         ;;
17569         *)      case "$usethreads" in
17570                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17571                 esac
17572                 d_readdir64_r=undef
17573                 readdir64_r_proto=0
17574                 ;;
17575         esac
17576         ;;
17577 *)      readdir64_r_proto=0
17578         ;;
17579 esac
17580
17581 : see if readdir_r exists
17582 set readdir_r d_readdir_r
17583 eval $inlibc
17584 case "$d_readdir_r" in
17585 "$define")
17586         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17587         case "$d_readdir_r_proto:$usethreads" in
17588         ":define")      d_readdir_r_proto=define
17589                 set d_readdir_r_proto readdir_r $hdrs
17590                 eval $hasproto ;;
17591         *)      ;;
17592         esac
17593         case "$d_readdir_r_proto" in
17594         define)
17595         case "$readdir_r_proto" in
17596         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17597         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17598         esac
17599         case "$readdir_r_proto" in
17600         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17601         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17602         esac
17603         case "$readdir_r_proto" in
17604         ''|0)   d_readdir_r=undef
17605                 readdir_r_proto=0
17606                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17607         * )     case "$readdir_r_proto" in
17608                 REENTRANT_PROTO*) ;;
17609                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17610                 esac
17611                 echo "Prototype: $try" ;;
17612         esac
17613         ;;
17614         *)      case "$usethreads" in
17615                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17616                 esac
17617                 d_readdir_r=undef
17618                 readdir_r_proto=0
17619                 ;;
17620         esac
17621         ;;
17622 *)      readdir_r_proto=0
17623         ;;
17624 esac
17625
17626 : see if readv exists
17627 set readv d_readv
17628 eval $inlibc
17629
17630 : see if recvmsg exists
17631 set recvmsg d_recvmsg
17632 eval $inlibc
17633
17634 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17635 echo " "
17636 if set regcomp val -f d_regcomp; eval $csym; $val; then
17637         echo 'regcomp() found.' >&4
17638         d_regcomp="$define"
17639         d_regcmp="$undef"
17640         d_re_comp="$undef"
17641 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17642         echo 'regcmp() found.' >&4
17643         d_regcmp="$define"
17644         d_regcomp="$undef"
17645         d_re_comp="$undef"
17646 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17647         echo 're_comp() found, assuming re_exec() also exists.' >&4
17648         d_re_comp="$define"
17649         d_regcomp="$undef"
17650         d_regcmp="$undef"
17651 else
17652         $cat >&4 <<EOM
17653 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17654 EOM
17655         d_regcmp="$undef"
17656         d_re_comp="$undef"
17657         d_regcomp="$undef"
17658 fi
17659
17660 : see if remainder exists
17661 set remainder d_remainder
17662 eval $inlibc
17663
17664 : see if remquo exists
17665 set remquo d_remquo
17666 eval $inlibc
17667
17668 : see if rename exists
17669 set rename d_rename
17670 eval $inlibc
17671
17672 : see if rint exists
17673 set rint d_rint
17674 eval $inlibc
17675
17676 : see if rmdir exists
17677 set rmdir d_rmdir
17678 eval $inlibc
17679
17680 : see if round exists
17681 set round d_round
17682 eval $inlibc
17683
17684 : see if memory.h is available.
17685 val=''
17686 set memory.h val
17687 eval $inhdr
17688
17689 : See if it conflicts with string.h
17690 case "$val" in
17691 $define)
17692         case "$strings" in
17693         '') ;;
17694         *)
17695                 $cppstdin $cppflags $cppminus < $strings > mem.h
17696                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
17697                         echo " "
17698                         echo "We won't be including <memory.h>."
17699                         val="$undef"
17700                 fi
17701                 $rm -f mem.h
17702                 ;;
17703         esac
17704 esac
17705 set i_memory
17706 eval $setvar
17707
17708 : can bcopy handle overlapping blocks?
17709 echo " "
17710 val="$undef"
17711 case "$d_memmove" in
17712 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
17713 *)      case "$d_bcopy" in
17714         "$define")
17715                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
17716                 $cat >try.c <<EOCP
17717 #$i_memory I_MEMORY
17718 #$i_stdlib I_STDLIB
17719 #$i_string I_STRING
17720 #$i_unistd I_UNISTD
17721 EOCP
17722         $cat >>try.c <<'EOCP'
17723 #include <stdio.h>
17724 #ifdef I_MEMORY
17725 #  include <memory.h>
17726 #endif
17727 #ifdef I_STDLIB
17728 #  include <stdlib.h>
17729 #endif
17730 #ifdef I_STRING
17731 #  include <string.h>
17732 #else
17733 #  include <strings.h>
17734 #endif
17735 #ifdef I_UNISTD
17736 #  include <unistd.h>  /* Needed for NetBSD */
17737 #endif
17738 int main()
17739 {
17740 char buf[128], abc[128];
17741 char *b;
17742 int len;
17743 int off;
17744 int align;
17745
17746 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17747    try to store the string in read-only memory. */
17748 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
17749
17750 for (align = 7; align >= 0; align--) {
17751         for (len = 36; len; len--) {
17752                 b = buf+align;
17753                 bcopy(abc, b, len);
17754                 for (off = 1; off <= len; off++) {
17755                         bcopy(b, b+off, len);
17756                         bcopy(b+off, b, len);
17757                         if (bcmp(b, abc, len))
17758                                 exit(1);
17759                 }
17760         }
17761 }
17762 exit(0);
17763 }
17764 EOCP
17765                 set try
17766                 if eval $compile_ok; then
17767                         if $run ./try 2>/dev/null; then
17768                                 echo "Yes, it can."
17769                                 val="$define"
17770                         else
17771                                 echo "It can't, sorry."
17772                         fi
17773                 else
17774                         echo "(I can't compile the test program, so we'll assume not...)"
17775                 fi
17776                 ;;
17777         esac
17778         $rm_try
17779         ;;
17780 esac
17781 set d_safebcpy
17782 eval $setvar
17783
17784 : can memcpy handle overlapping blocks?
17785 echo " "
17786 val="$undef"
17787 case "$d_memmove" in
17788 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
17789 *)      case "$d_memcpy" in
17790         "$define")
17791                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
17792                 $cat >try.c <<EOCP
17793 #$i_memory I_MEMORY
17794 #$i_stdlib I_STDLIB
17795 #$i_string I_STRING
17796 #$i_unistd I_UNISTD
17797 EOCP
17798         $cat >>try.c <<'EOCP'
17799 #include <stdio.h>
17800 #ifdef I_MEMORY
17801 #  include <memory.h>
17802 #endif
17803 #ifdef I_STDLIB
17804 #  include <stdlib.h>
17805 #endif
17806 #ifdef I_STRING
17807 #  include <string.h>
17808 #else
17809 #  include <strings.h>
17810 #endif
17811 #ifdef I_UNISTD
17812 #  include <unistd.h>  /* Needed for NetBSD */
17813 #endif
17814 int main()
17815 {
17816 char buf[128], abc[128];
17817 char *b;
17818 int len;
17819 int off;
17820 int align;
17821
17822 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17823    try to store the string in read-only memory. */
17824 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
17825
17826 for (align = 7; align >= 0; align--) {
17827         for (len = 36; len; len--) {
17828                 b = buf+align;
17829                 memcpy(b, abc, len);
17830                 for (off = 1; off <= len; off++) {
17831                         memcpy(b+off, b, len);
17832                         memcpy(b, b+off, len);
17833                         if (memcmp(b, abc, len))
17834                                 exit(1);
17835                 }
17836         }
17837 }
17838 exit(0);
17839 }
17840 EOCP
17841                 set try
17842                 if eval $compile_ok; then
17843                         if $run ./try 2>/dev/null; then
17844                                 echo "Yes, it can."
17845                                 val="$define"
17846                         else
17847                                 echo "It can't, sorry."
17848                         fi
17849                 else
17850                         echo "(I can't compile the test program, so we'll assume not...)"
17851                 fi
17852                 ;;
17853         esac
17854         $rm_try
17855         ;;
17856 esac
17857 set d_safemcpy
17858 eval $setvar
17859
17860 : can memcmp be trusted to compare relative magnitude?
17861 val="$undef"
17862 case "$d_memcmp" in
17863 "$define")
17864         echo " "
17865         echo "Checking if your memcmp() can compare relative magnitude..." >&4
17866         $cat >try.c <<EOCP
17867 #$i_memory I_MEMORY
17868 #$i_stdlib I_STDLIB
17869 #$i_string I_STRING
17870 #$i_unistd I_UNISTD
17871 EOCP
17872         $cat >>try.c <<'EOCP'
17873 #include <stdio.h>
17874 #ifdef I_MEMORY
17875 #  include <memory.h>
17876 #endif
17877 #ifdef I_STDLIB
17878 #  include <stdlib.h>
17879 #endif
17880 #ifdef I_STRING
17881 #  include <string.h>
17882 #else
17883 #  include <strings.h>
17884 #endif
17885 #ifdef I_UNISTD
17886 #  include <unistd.h>  /* Needed for NetBSD */
17887 #endif
17888 int main()
17889 {
17890 char a = -1;
17891 char b = 0;
17892 if ((a < b) && memcmp(&a, &b, 1) < 0)
17893         exit(1);
17894 exit(0);
17895 }
17896 EOCP
17897         set try
17898         if eval $compile_ok; then
17899                 if $run ./try 2>/dev/null; then
17900                         echo "Yes, it can."
17901                         val="$define"
17902                 else
17903                         echo "No, it can't (it uses signed chars)."
17904                 fi
17905         else
17906                 echo "(I can't compile the test program, so we'll assume not...)"
17907         fi
17908         ;;
17909 esac
17910 $rm_try
17911 set d_sanemcmp
17912 eval $setvar
17913
17914 : see if prototype for sbrk is available
17915 echo " "
17916 set d_sbrkproto sbrk $i_unistd unistd.h
17917 eval $hasproto
17918
17919 : see if scalbn exists
17920 set scalbn d_scalbn
17921 eval $inlibc
17922
17923 : see if select exists
17924 set select d_select
17925 eval $inlibc
17926
17927 : see if semctl exists
17928 set semctl d_semctl
17929 eval $inlibc
17930
17931 : see if semget exists
17932 set semget d_semget
17933 eval $inlibc
17934
17935 : see if semop exists
17936 set semop d_semop
17937 eval $inlibc
17938
17939 : see how much of the 'sem*(2)' library is present.
17940 h_sem=true
17941 echo " "
17942 case "$d_semctl$d_semget$d_semop" in
17943 *"$undef"*) h_sem=false;;
17944 esac
17945 case "$osname" in
17946 freebsd)
17947     case "`ipcs 2>&1`" in
17948     "SVID messages"*"not configured"*)
17949         echo "Your $osname does not have the sem*(2) configured." >&4
17950         h_sem=false
17951         val="$undef"
17952         set semctl d_semctl
17953         eval $setvar
17954         set semget d_semget
17955         eval $setvar
17956         set semop d_semop
17957         eval $setvar
17958         ;;
17959     esac
17960     ;;
17961 esac
17962 : we could also check for sys/ipc.h ...
17963 if $h_sem && $test `./findhdr sys/sem.h`; then
17964         echo "You have the full sem*(2) library." >&4
17965         val="$define"
17966 else
17967         echo "You don't have the full sem*(2) library." >&4
17968         val="$undef"
17969 fi
17970 set d_sem
17971 eval $setvar
17972
17973 : see whether sys/sem.h defines union semun
17974 echo " "
17975 $cat > try.c <<'END'
17976 #include <sys/types.h>
17977 #include <sys/ipc.h>
17978 #include <sys/sem.h>
17979 int main () { union semun semun; semun.buf = 0; }
17980 END
17981 set try
17982 if eval $compile; then
17983     echo "You have union semun in <sys/sem.h>." >&4
17984     val="$define"
17985 else
17986     echo "You do not have union semun in <sys/sem.h>." >&4
17987     val="$undef"
17988 fi
17989 $rm_try
17990 set d_union_semun
17991 eval $setvar
17992
17993 : see how to do semctl IPC_STAT
17994 case "$d_sem" in
17995 $define)
17996     echo " "
17997     $cat > tryh.h <<END
17998 #ifndef S_IRUSR
17999 #   ifdef S_IREAD
18000 #       define S_IRUSR S_IREAD
18001 #       define S_IWUSR S_IWRITE
18002 #       define S_IXUSR S_IEXEC
18003 #   else
18004 #       define S_IRUSR 0400
18005 #       define S_IWUSR 0200
18006 #       define S_IXUSR 0100
18007 #   endif
18008 #   define S_IRGRP (S_IRUSR>>3)
18009 #   define S_IWGRP (S_IWUSR>>3)
18010 #   define S_IXGRP (S_IXUSR>>3)
18011 #   define S_IROTH (S_IRUSR>>6)
18012 #   define S_IWOTH (S_IWUSR>>6)
18013 #   define S_IXOTH (S_IXUSR>>6)
18014 #endif
18015 #ifndef S_IRWXU
18016 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
18017 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
18018 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
18019 #endif
18020 END
18021     : see whether semctl IPC_STAT can use union semun
18022     case "$d_semctl_semun" in
18023     '')
18024       val="$undef"
18025       $cat > try.c <<END
18026 #include <sys/types.h>
18027 #include <sys/ipc.h>
18028 #include <sys/sem.h>
18029 #include <sys/stat.h>
18030 #include <stdio.h>
18031 #include <errno.h>
18032 #include "tryh.h"
18033 #ifndef errno
18034 extern int errno;
18035 #endif
18036 #$d_union_semun HAS_UNION_SEMUN
18037 int main() {
18038     union semun
18039 #ifndef HAS_UNION_SEMUN
18040     {
18041         int val;
18042         struct semid_ds *buf;
18043         unsigned short *array;
18044     }
18045 #endif
18046     arg;
18047     int sem, st;
18048
18049 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
18050     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18051     if (sem > -1) {
18052         struct semid_ds argbuf;
18053         arg.buf = &argbuf;
18054 #       ifdef IPC_STAT
18055         st = semctl(sem, 0, IPC_STAT, arg);
18056         if (st == 0)
18057             printf("semun\n");
18058         else
18059 #       endif /* IPC_STAT */
18060             printf("semctl IPC_STAT failed: errno = %d\n", errno);
18061 #       ifdef IPC_RMID
18062         if (semctl(sem, 0, IPC_RMID, arg) != 0)
18063 #       endif /* IPC_RMID */
18064             printf("semctl IPC_RMID failed: errno = %d\n", errno);
18065     } else
18066 #endif /* IPC_PRIVATE && ... */
18067         printf("semget failed: errno = %d\n", errno);
18068   return 0;
18069 }
18070 END
18071       set try
18072       if eval $compile; then
18073           xxx=`$run ./try`
18074           case "$xxx" in
18075           semun) val="$define" ;;
18076           esac
18077       fi
18078       $rm_try
18079       set d_semctl_semun
18080       eval $setvar
18081       ;;
18082     esac
18083     case "$d_semctl_semun" in
18084     $define)
18085         echo "You can use union semun for semctl IPC_STAT." >&4
18086         also='also'
18087         ;;
18088     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
18089         also=''
18090         ;;
18091     esac
18092
18093     : see whether semctl IPC_STAT can use struct semid_ds pointer
18094     case "$d_semctl_semid_ds" in
18095     '')
18096       val="$undef"
18097       $cat > try.c <<'END'
18098 #include <sys/types.h>
18099 #include <sys/ipc.h>
18100 #include <sys/sem.h>
18101 #include <sys/stat.h>
18102 #include "tryh.h"
18103 #include <stdio.h>
18104 #include <errno.h>
18105 #ifndef errno
18106 extern int errno;
18107 #endif
18108 int main() {
18109     struct semid_ds arg;
18110     int sem, st;
18111
18112 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
18113     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18114     if (sem > -1) {
18115 #       ifdef IPC_STAT
18116         st = semctl(sem, 0, IPC_STAT, &arg);
18117         if (st == 0)
18118             printf("semid_ds\n");
18119         else
18120 #       endif /* IPC_STAT */
18121             printf("semctl IPC_STAT failed: errno = %d\n", errno);
18122 #       ifdef IPC_RMID
18123         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
18124 #       endif /* IPC_RMID */
18125             printf("semctl IPC_RMID failed: errno = %d\n", errno);
18126     } else
18127 #endif /* IPC_PRIVATE && ... */
18128         printf("semget failed: errno = %d\n", errno);
18129
18130     return 0;
18131 }
18132 END
18133       set try
18134       if eval $compile; then
18135           xxx=`$run ./try`
18136           case "$xxx" in
18137           semid_ds) val="$define" ;;
18138           esac
18139       fi
18140       $rm_try
18141       set d_semctl_semid_ds
18142       eval $setvar
18143       ;;
18144     esac
18145     case "$d_semctl_semid_ds" in
18146     $define)
18147         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
18148         ;;
18149     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
18150         ;;
18151     esac
18152     ;;
18153 *)  val="$undef"
18154
18155     # We do not have the full sem*(2) library, so assume we can not
18156     # use either.
18157
18158     set d_semctl_semun
18159     eval $setvar
18160
18161     set d_semctl_semid_ds
18162     eval $setvar
18163     ;;
18164 esac
18165 $rm_try tryh.h
18166
18167 : see if sendmsg exists
18168 set sendmsg d_sendmsg
18169 eval $inlibc
18170
18171 : see if setegid exists
18172 set setegid d_setegid
18173 eval $inlibc
18174
18175 : see if seteuid exists
18176 set seteuid d_seteuid
18177 eval $inlibc
18178
18179 : see if setgrent exists
18180 set setgrent d_setgrent
18181 eval $inlibc
18182
18183 : see if setgrent_r exists
18184 set setgrent_r d_setgrent_r
18185 eval $inlibc
18186 case "$d_setgrent_r" in
18187 "$define")
18188         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
18189         case "$d_setgrent_r_proto:$usethreads" in
18190         ":define")      d_setgrent_r_proto=define
18191                 set d_setgrent_r_proto setgrent_r $hdrs
18192                 eval $hasproto ;;
18193         *)      ;;
18194         esac
18195         case "$d_setgrent_r_proto" in
18196         define)
18197         case "$setgrent_r_proto" in
18198         ''|0) try='int setgrent_r(FILE**);'
18199         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
18200         esac
18201         case "$setgrent_r_proto" in
18202         ''|0) try='void setgrent_r(FILE**);'
18203         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
18204         esac
18205         case "$setgrent_r_proto" in
18206         ''|0)   d_setgrent_r=undef
18207                 setgrent_r_proto=0
18208                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
18209         * )     case "$setgrent_r_proto" in
18210                 REENTRANT_PROTO*) ;;
18211                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
18212                 esac
18213                 echo "Prototype: $try" ;;
18214         esac
18215         ;;
18216         *)      case "$usethreads" in
18217                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
18218                 esac
18219                 d_setgrent_r=undef
18220                 setgrent_r_proto=0
18221                 ;;
18222         esac
18223         ;;
18224 *)      setgrent_r_proto=0
18225         ;;
18226 esac
18227
18228 : see if sethostent exists
18229 set sethostent d_sethent
18230 eval $inlibc
18231
18232 : see if sethostent_r exists
18233 set sethostent_r d_sethostent_r
18234 eval $inlibc
18235 case "$d_sethostent_r" in
18236 "$define")
18237         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18238         case "$d_sethostent_r_proto:$usethreads" in
18239         ":define")      d_sethostent_r_proto=define
18240                 set d_sethostent_r_proto sethostent_r $hdrs
18241                 eval $hasproto ;;
18242         *)      ;;
18243         esac
18244         case "$d_sethostent_r_proto" in
18245         define)
18246         case "$sethostent_r_proto" in
18247         ''|0) try='int sethostent_r(int, struct hostent_data*);'
18248         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
18249         esac
18250         case "$sethostent_r_proto" in
18251         ''|0) try='void sethostent_r(int, struct hostent_data*);'
18252         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
18253         esac
18254         case "$sethostent_r_proto" in
18255         ''|0)   d_sethostent_r=undef
18256                 sethostent_r_proto=0
18257                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
18258         * )     case "$sethostent_r_proto" in
18259                 REENTRANT_PROTO*) ;;
18260                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
18261                 esac
18262                 echo "Prototype: $try" ;;
18263         esac
18264         ;;
18265         *)      case "$usethreads" in
18266                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
18267                 esac
18268                 d_sethostent_r=undef
18269                 sethostent_r_proto=0
18270                 ;;
18271         esac
18272         ;;
18273 *)      sethostent_r_proto=0
18274         ;;
18275 esac
18276
18277 : see if setitimer exists
18278 set setitimer d_setitimer
18279 eval $inlibc
18280
18281 : see if setlinebuf exists
18282 set setlinebuf d_setlinebuf
18283 eval $inlibc
18284
18285 : see if setlocale exists
18286 set setlocale d_setlocale
18287 eval $inlibc
18288
18289 : see if locale.h is available
18290 set locale.h i_locale
18291 eval $inhdr
18292
18293 : see if setlocale_r exists
18294 set setlocale_r d_setlocale_r
18295 eval $inlibc
18296 case "$d_setlocale_r" in
18297 "$define")
18298         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18299         case "$d_setlocale_r_proto:$usethreads" in
18300         ":define")      d_setlocale_r_proto=define
18301                 set d_setlocale_r_proto setlocale_r $hdrs
18302                 eval $hasproto ;;
18303         *)      ;;
18304         esac
18305         case "$d_setlocale_r_proto" in
18306         define)
18307         case "$setlocale_r_proto" in
18308         ''|0) try='int setlocale_r(int, const char*, char*, int);'
18309         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18310         esac
18311         case "$setlocale_r_proto" in
18312         ''|0)   d_setlocale_r=undef
18313                 setlocale_r_proto=0
18314                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18315         * )     case "$setlocale_r_proto" in
18316                 REENTRANT_PROTO*) ;;
18317                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18318                 esac
18319                 echo "Prototype: $try" ;;
18320         esac
18321         ;;
18322         *)      case "$usethreads" in
18323                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18324                 esac
18325                 d_setlocale_r=undef
18326                 setlocale_r_proto=0
18327                 ;;
18328         esac
18329         ;;
18330 *)      setlocale_r_proto=0
18331         ;;
18332 esac
18333
18334 : see if setnetent exists
18335 set setnetent d_setnent
18336 eval $inlibc
18337
18338 : see if setnetent_r exists
18339 set setnetent_r d_setnetent_r
18340 eval $inlibc
18341 case "$d_setnetent_r" in
18342 "$define")
18343         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18344         case "$d_setnetent_r_proto:$usethreads" in
18345         ":define")      d_setnetent_r_proto=define
18346                 set d_setnetent_r_proto setnetent_r $hdrs
18347                 eval $hasproto ;;
18348         *)      ;;
18349         esac
18350         case "$d_setnetent_r_proto" in
18351         define)
18352         case "$setnetent_r_proto" in
18353         ''|0) try='int setnetent_r(int, struct netent_data*);'
18354         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18355         esac
18356         case "$setnetent_r_proto" in
18357         ''|0) try='void setnetent_r(int, struct netent_data*);'
18358         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18359         esac
18360         case "$setnetent_r_proto" in
18361         ''|0)   d_setnetent_r=undef
18362                 setnetent_r_proto=0
18363                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18364         * )     case "$setnetent_r_proto" in
18365                 REENTRANT_PROTO*) ;;
18366                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18367                 esac
18368                 echo "Prototype: $try" ;;
18369         esac
18370         ;;
18371         *)      case "$usethreads" in
18372                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18373                 esac
18374                 d_setnetent_r=undef
18375                 setnetent_r_proto=0
18376                 ;;
18377         esac
18378         ;;
18379 *)      setnetent_r_proto=0
18380         ;;
18381 esac
18382
18383 : see if setprotoent exists
18384 set setprotoent d_setpent
18385 eval $inlibc
18386
18387 : see if setpgid exists
18388 set setpgid d_setpgid
18389 eval $inlibc
18390
18391 : see if setpgrp2 exists
18392 set setpgrp2 d_setpgrp2
18393 eval $inlibc
18394
18395 : see if setpriority exists
18396 set setpriority d_setprior
18397 eval $inlibc
18398
18399 : see if setproctitle exists
18400 set setproctitle d_setproctitle
18401 eval $inlibc
18402
18403 : see if setprotoent_r exists
18404 set setprotoent_r d_setprotoent_r
18405 eval $inlibc
18406 case "$d_setprotoent_r" in
18407 "$define")
18408         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18409         case "$d_setprotoent_r_proto:$usethreads" in
18410         ":define")      d_setprotoent_r_proto=define
18411                 set d_setprotoent_r_proto setprotoent_r $hdrs
18412                 eval $hasproto ;;
18413         *)      ;;
18414         esac
18415         case "$d_setprotoent_r_proto" in
18416         define)
18417         case "$setprotoent_r_proto" in
18418         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18419         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18420         esac
18421         case "$setprotoent_r_proto" in
18422         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18423         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18424         esac
18425         case "$setprotoent_r_proto" in
18426         ''|0)   d_setprotoent_r=undef
18427                 setprotoent_r_proto=0
18428                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18429         * )     case "$setprotoent_r_proto" in
18430                 REENTRANT_PROTO*) ;;
18431                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18432                 esac
18433                 echo "Prototype: $try" ;;
18434         esac
18435         ;;
18436         *)      case "$usethreads" in
18437                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18438                 esac
18439                 d_setprotoent_r=undef
18440                 setprotoent_r_proto=0
18441                 ;;
18442         esac
18443         ;;
18444 *)      setprotoent_r_proto=0
18445         ;;
18446 esac
18447
18448 : see if setpwent exists
18449 set setpwent d_setpwent
18450 eval $inlibc
18451
18452 : see if setpwent_r exists
18453 set setpwent_r d_setpwent_r
18454 eval $inlibc
18455 case "$d_setpwent_r" in
18456 "$define")
18457         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18458         case "$d_setpwent_r_proto:$usethreads" in
18459         ":define")      d_setpwent_r_proto=define
18460                 set d_setpwent_r_proto setpwent_r $hdrs
18461                 eval $hasproto ;;
18462         *)      ;;
18463         esac
18464         case "$d_setpwent_r_proto" in
18465         define)
18466         case "$setpwent_r_proto" in
18467         ''|0) try='int setpwent_r(FILE**);'
18468         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18469         esac
18470         case "$setpwent_r_proto" in
18471         ''|0) try='void setpwent_r(FILE**);'
18472         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18473         esac
18474         case "$setpwent_r_proto" in
18475         ''|0)   d_setpwent_r=undef
18476                 setpwent_r_proto=0
18477                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18478         * )     case "$setpwent_r_proto" in
18479                 REENTRANT_PROTO*) ;;
18480                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18481                 esac
18482                 echo "Prototype: $try" ;;
18483         esac
18484         ;;
18485         *)      case "$usethreads" in
18486                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18487                 esac
18488                 d_setpwent_r=undef
18489                 setpwent_r_proto=0
18490                 ;;
18491         esac
18492         ;;
18493 *)      setpwent_r_proto=0
18494         ;;
18495 esac
18496
18497 : see if setregid exists
18498 set setregid d_setregid
18499 eval $inlibc
18500 set setresgid d_setresgid
18501 eval $inlibc
18502
18503 : see if setreuid exists
18504 set setreuid d_setreuid
18505 eval $inlibc
18506 set setresuid d_setresuid
18507 eval $inlibc
18508
18509 : see if setrgid exists
18510 set setrgid d_setrgid
18511 eval $inlibc
18512
18513 : see if setruid exists
18514 set setruid d_setruid
18515 eval $inlibc
18516
18517 : see if setservent exists
18518 set setservent d_setsent
18519 eval $inlibc
18520
18521 : see if setservent_r exists
18522 set setservent_r d_setservent_r
18523 eval $inlibc
18524 case "$d_setservent_r" in
18525 "$define")
18526         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18527         case "$d_setservent_r_proto:$usethreads" in
18528         ":define")      d_setservent_r_proto=define
18529                 set d_setservent_r_proto setservent_r $hdrs
18530                 eval $hasproto ;;
18531         *)      ;;
18532         esac
18533         case "$d_setservent_r_proto" in
18534         define)
18535         case "$setservent_r_proto" in
18536         ''|0) try='int setservent_r(int, struct servent_data*);'
18537         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18538         esac
18539         case "$setservent_r_proto" in
18540         ''|0) try='void setservent_r(int, struct servent_data*);'
18541         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18542         esac
18543         case "$setservent_r_proto" in
18544         ''|0)   d_setservent_r=undef
18545                 setservent_r_proto=0
18546                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18547         * )     case "$setservent_r_proto" in
18548                 REENTRANT_PROTO*) ;;
18549                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18550                 esac
18551                 echo "Prototype: $try" ;;
18552         esac
18553         ;;
18554         *)      case "$usethreads" in
18555                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18556                 esac
18557                 d_setservent_r=undef
18558                 setservent_r_proto=0
18559                 ;;
18560         esac
18561         ;;
18562 *)      setservent_r_proto=0
18563         ;;
18564 esac
18565
18566 : see if setsid exists
18567 set setsid d_setsid
18568 eval $inlibc
18569
18570 : see if setvbuf exists
18571 set setvbuf d_setvbuf
18572 eval $inlibc
18573
18574 : see if shmctl exists
18575 set shmctl d_shmctl
18576 eval $inlibc
18577
18578 : see if shmget exists
18579 set shmget d_shmget
18580 eval $inlibc
18581
18582 : see if shmat exists
18583 set shmat d_shmat
18584 eval $inlibc
18585 : see what shmat returns
18586 case "$d_shmat" in
18587 "$define")
18588         $cat >shmat.c <<'END'
18589 #include <sys/shm.h>
18590 void *shmat();
18591 END
18592         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18593                 shmattype='void *'
18594         else
18595                 shmattype='char *'
18596         fi
18597         echo "and it returns ($shmattype)." >&4
18598         : see if a prototype for shmat is available
18599         xxx=`./findhdr sys/shm.h`
18600         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18601         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18602                 val="$define"
18603         else
18604                 val="$undef"
18605         fi
18606         $rm -f shmat.[co]
18607         ;;
18608 *)
18609         val="$undef"
18610         ;;
18611 esac
18612 set d_shmatprototype
18613 eval $setvar
18614
18615 : see if shmdt exists
18616 set shmdt d_shmdt
18617 eval $inlibc
18618
18619 : see how much of the 'shm*(2)' library is present.
18620 h_shm=true
18621 echo " "
18622 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18623 *"$undef"*) h_shm=false;;
18624 esac
18625 case "$osname" in
18626 freebsd)
18627     case "`ipcs 2>&1`" in
18628     "SVID shared memory"*"not configured"*)
18629         echo "Your $osname does not have the shm*(2) configured." >&4
18630         h_shm=false
18631         val="$undef"
18632         set shmctl d_shmctl
18633         eval $setvar
18634         set shmget d_shmget
18635         eval $setvar
18636         set shmat d_shmat
18637         eval $setvar
18638         set shmdt d_shmdt
18639         eval $setvar
18640         ;;
18641     esac
18642     ;;
18643 esac
18644 : we could also check for sys/ipc.h ...
18645 if $h_shm && $test `./findhdr sys/shm.h`; then
18646         echo "You have the full shm*(2) library." >&4
18647         val="$define"
18648 else
18649         echo "You don't have the full shm*(2) library." >&4
18650         val="$undef"
18651 fi
18652 set d_shm
18653 eval $setvar
18654
18655 : see if we have sigaction
18656 echo " "
18657 if set sigaction val -f d_sigaction; eval $csym; $val; then
18658         echo 'sigaction() found.' >&4
18659         $cat > try.c <<EOP
18660 #include <stdio.h>
18661 #include <sys/types.h>
18662 #include <signal.h>
18663 #$i_stdlib I_STDLIB
18664 #ifdef I_STDLIB
18665 #include <stdlib.h>
18666 #endif
18667 int main()
18668 {
18669     struct sigaction act, oact;
18670     act.sa_flags = 0;
18671     oact.sa_handler = 0;
18672     /* so that act and oact are used */
18673     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18674 }
18675 EOP
18676         set try
18677         if eval $compile_ok; then
18678                 val="$define"
18679         else
18680                 echo "But you don't seem to have a usable struct sigaction." >&4
18681                 val="$undef"
18682         fi
18683 else
18684         echo 'sigaction NOT found.' >&4
18685         val="$undef"
18686 fi
18687 set d_sigaction; eval $setvar
18688 $rm_try
18689
18690 : see what type pids are declared as in the kernel
18691 rp="What is the type of process ids on this system?"
18692 set pid_t pidtype int stdio.h sys/types.h
18693 eval $typedef_ask
18694
18695 : see what type uids are declared as in the kernel
18696 echo " "
18697 echo "Looking for the type for user ids returned by getuid()."
18698 set uid_t uidtype xxx stdio.h sys/types.h
18699 eval $typedef
18700 case "$uidtype" in
18701 xxx)
18702         xxx=`./findhdr sys/user.h`
18703         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18704         case $1 in
18705         unsigned) dflt="$1 $2" ;;
18706         *) dflt="$1" ;;
18707         esac
18708         ;;
18709 *) dflt="$uidtype";;
18710 esac
18711 case "$uidtype" in
18712 uid_t)  echo "uid_t found." ;;
18713 *)      rp="What is the type for user ids returned by getuid()?"
18714         . ./myread
18715         uidtype="$ans"
18716         ;;
18717 esac
18718
18719 : Define hasfield_t macro for Configure internal use
18720 hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
18721 while $test $# -ge 2; do
18722     case "$1" in
18723         $define) echo "#include <$2>";;
18724     esac ;
18725     shift 2;
18726 done > try.c;
18727 echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
18728 set try;
18729 if eval $compile; then
18730         val="$define";
18731 else
18732         val="$undef";
18733 fi;
18734 set $varname;
18735 eval $setvar;
18736 $rm_try'
18737
18738 : see what siginfo fields we have
18739 case "$d_sigaction" in
18740 "$define")
18741         echo "Checking if your siginfo_t has si_errno field...">&4
18742         set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
18743         eval $hasfield_t;
18744
18745         echo "Checking if your siginfo_t has si_pid field...">&4
18746         set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
18747         eval $hasfield_t;
18748
18749         echo "Checking if your siginfo_t has si_uid field...">&4
18750         set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
18751         eval $hasfield_t;
18752
18753         echo "Checking if your siginfo_t has si_addr field...">&4
18754         set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
18755         eval $hasfield_t;
18756
18757         echo "Checking if your siginfo_t has si_status field...">&4
18758         set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
18759         eval $hasfield_t;
18760
18761         echo "Checking if your siginfo_t has si_band field...">&4
18762         set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
18763         eval $hasfield_t;
18764
18765         echo "Checking if your siginfo_t has si_value field...">&4
18766         set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
18767         eval $hasfield_t;
18768
18769         echo "Checking if your siginfo_t has si_fd field...">&4
18770         set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
18771         eval $hasfield_t;
18772
18773         ;;
18774 *)
18775         d_siginfo_si_errno="$undef"
18776         d_siginfo_si_pid="$undef"
18777         d_siginfo_si_uid="$undef"
18778         d_siginfo_si_addr="$undef"
18779         d_siginfo_si_status="$undef"
18780         d_siginfo_si_band="$undef"
18781         d_siginfo_si_value="$undef"
18782         d_siginfo_si_fd="$undef"
18783         ;;
18784 esac
18785
18786 : see if this is a sunmath.h system
18787 set sunmath.h i_sunmath
18788 eval $inhdr
18789
18790 : see if signbit exists
18791 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18792 $cat >try.c <<EOCP
18793 #$i_math I_MATH
18794 #$i_sunmath I_SUNMATH
18795 #ifdef I_MATH
18796 #  include <math.h>
18797 #endif
18798 #ifdef I_SUNMATH  /* Solaris special math library */
18799 #  include <sunmath.h>
18800 #endif
18801 #define NV $nvtype
18802 int main(int argc, char **argv)
18803 {
18804     NV x = 0.0;
18805     NV y = -0.0;
18806     if ((signbit(x) == 0) && (signbit(y) != 0))
18807         return 0;
18808     else
18809         return 1;
18810 }
18811 EOCP
18812 val="$undef"
18813 set try
18814 if eval $compile; then
18815     if $run ./try; then
18816         $echo "Yes." >&4
18817         val="$define"
18818     else
18819         $echo "Signbit seems to be available, but doesn't work as I expected."
18820         $echo "I won't use it." >&4
18821         val="$undef"
18822     fi
18823 else
18824     $echo "Nope." >&4
18825     dflt="$undef"
18826 fi
18827 set d_signbit
18828 eval $setvar
18829 $rm_try
18830
18831 : see if sigprocmask exists
18832 set sigprocmask d_sigprocmask
18833 eval $inlibc
18834
18835 : see if sigsetjmp exists
18836 echo " "
18837 case "$d_sigsetjmp" in
18838 '')
18839         $cat >try.c <<EOP
18840 #include <setjmp.h>
18841 #$i_stdlib I_STDLIB
18842 #ifdef I_STDLIB
18843 #include <stdlib.h>
18844 #endif
18845 sigjmp_buf env;
18846 int set = 1;
18847 int main()
18848 {
18849         if (sigsetjmp(env,1))
18850                 exit(set);
18851         set = 0;
18852         siglongjmp(env, 1);
18853         exit(1);
18854 }
18855 EOP
18856         set try
18857         if eval $compile; then
18858                 if $run ./try >/dev/null 2>&1; then
18859                         echo "POSIX sigsetjmp found." >&4
18860                         val="$define"
18861                 else
18862                         $cat >&4 <<EOM
18863 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18864 I'll ignore them.
18865 EOM
18866                         val="$undef"
18867                 fi
18868         else
18869                 echo "sigsetjmp not found." >&4
18870                 val="$undef"
18871         fi
18872         ;;
18873 *) val="$d_sigsetjmp"
18874         case "$d_sigsetjmp" in
18875         $define) echo "POSIX sigsetjmp found." >&4;;
18876         $undef) echo "sigsetjmp not found." >&4;;
18877         esac
18878         ;;
18879 esac
18880 set d_sigsetjmp
18881 eval $setvar
18882 $rm_try
18883
18884 : see if snprintf exists
18885 set snprintf d_snprintf
18886 eval $inlibc
18887
18888 : see if vsnprintf exists
18889 set vsnprintf d_vsnprintf
18890 eval $inlibc
18891
18892 case "$d_snprintf-$d_vsnprintf" in
18893 "$define-$define")
18894     $cat <<EOM
18895 Checking whether your snprintf() and vsnprintf() work okay...
18896 EOM
18897     $cat >try.c <<'EOCP'
18898 /* v?snprintf testing logic courtesy of Russ Allbery.
18899  * According to C99:
18900  * - if the buffer is too short it still must be \0-terminated
18901  * - if the buffer is too short the potentially required length
18902  *   must be returned and not -1
18903  * - if the buffer is NULL the potentially required length
18904  *   must be returned and not -1 or core dump
18905  */
18906 #include <stdio.h>
18907 #include <stdarg.h>
18908
18909 char buf[2];
18910
18911 int test (char *format, ...)
18912 {
18913     va_list args;
18914     int count;
18915
18916     va_start (args, format);
18917     count = vsnprintf (buf, sizeof buf, format, args);
18918     va_end (args);
18919     return count;
18920 }
18921
18922 int main ()
18923 {
18924     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18925              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18926 }
18927 EOCP
18928     set try
18929     if eval $compile; then
18930         `$run ./try`
18931         case "$?" in
18932         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18933         *) cat <<EOM >&4
18934 Your snprintf() and snprintf() don't seem to be working okay.
18935 EOM
18936            d_snprintf="$undef"
18937            d_vsnprintf="$undef"
18938            ;;
18939         esac
18940     else
18941         echo "(I can't seem to compile the test program--assuming they don't)"
18942         d_snprintf="$undef"
18943         d_vsnprintf="$undef"
18944     fi
18945     $rm_try
18946     ;;
18947 esac
18948
18949 : see if sockatmark exists
18950 set sockatmark d_sockatmark
18951 eval $inlibc
18952
18953 : see if prototype for sockatmark is available
18954 echo " "
18955 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18956 eval $hasproto
18957
18958 : see if socks5_init exists
18959 set socks5_init d_socks5_init
18960 eval $inlibc
18961
18962 : see if sprintf returns the length of the string in the buffer as per ANSI
18963 $echo "Checking whether sprintf returns the length of the string..." >&4
18964 $cat <<EOP >try.c
18965 #include <stdio.h>
18966 #$i_stdlib I_STDLIB
18967 #ifdef I_STDLIB
18968 #include <stdlib.h>
18969 #endif
18970 #$i_string I_STRING
18971 #ifdef I_STRING
18972 #  include <string.h>
18973 #else
18974 #  include <strings.h>
18975 #endif
18976 #$i_math I_MATH
18977 #ifdef I_MATH
18978 #include <math.h>
18979 #endif
18980
18981 char buffer[256];
18982
18983 int check (size_t expect, int test) {
18984   size_t got = strlen(buffer);
18985   if (expect == got)
18986     return 0;
18987
18988   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
18989        test, buffer);
18990   exit (test);
18991 }
18992
18993 int main(int argc, char **argv) {
18994   int test = 0;
18995
18996   check(sprintf(buffer, ""), ++test);
18997   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
18998   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
18999
19000   return 0;
19001 }
19002 EOP
19003 set try
19004
19005 if eval $compile; then
19006     xxx="`$run ./try`"
19007     case "$?" in
19008         0) cat >&4 <<EOM
19009 sprintf returns the length of the string (as ANSI says it should)
19010 EOM
19011         d_sprintf_returns_strlen="$define"
19012         ;;
19013         *) cat >&4 <<EOM
19014 sprintf does not return the length of the string (how old is this system?)
19015 EOM
19016         d_sprintf_returns_strlen="$undef"
19017         ;;
19018     esac
19019 else
19020     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
19021     d_sprintf_returns_strlen="$undef"
19022 fi
19023 $rm_try
19024
19025 : see if srand48_r exists
19026 set srand48_r d_srand48_r
19027 eval $inlibc
19028 case "$d_srand48_r" in
19029 "$define")
19030         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
19031         case "$d_srand48_r_proto:$usethreads" in
19032         ":define")      d_srand48_r_proto=define
19033                 set d_srand48_r_proto srand48_r $hdrs
19034                 eval $hasproto ;;
19035         *)      ;;
19036         esac
19037         case "$d_srand48_r_proto" in
19038         define)
19039         case "$srand48_r_proto" in
19040         ''|0) try='int srand48_r(long, struct drand48_data*);'
19041         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
19042         esac
19043         case "$srand48_r_proto" in
19044         ''|0)   d_srand48_r=undef
19045                 srand48_r_proto=0
19046                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
19047         * )     case "$srand48_r_proto" in
19048                 REENTRANT_PROTO*) ;;
19049                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
19050                 esac
19051                 echo "Prototype: $try" ;;
19052         esac
19053         ;;
19054         *)      case "$usethreads" in
19055                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
19056                 esac
19057                 d_srand48_r=undef
19058                 srand48_r_proto=0
19059                 ;;
19060         esac
19061         ;;
19062 *)      srand48_r_proto=0
19063         ;;
19064 esac
19065
19066 : see if srandom_r exists
19067 set srandom_r d_srandom_r
19068 eval $inlibc
19069 case "$d_srandom_r" in
19070 "$define")
19071         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
19072         case "$d_srandom_r_proto:$usethreads" in
19073         ":define")      d_srandom_r_proto=define
19074                 set d_srandom_r_proto srandom_r $hdrs
19075                 eval $hasproto ;;
19076         *)      ;;
19077         esac
19078         case "$d_srandom_r_proto" in
19079         define)
19080         case "$srandom_r_proto" in
19081         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
19082         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
19083         esac
19084         case "$srandom_r_proto" in
19085         ''|0)   d_srandom_r=undef
19086                 srandom_r_proto=0
19087                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
19088         * )     case "$srandom_r_proto" in
19089                 REENTRANT_PROTO*) ;;
19090                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
19091                 esac
19092                 echo "Prototype: $try" ;;
19093         esac
19094         ;;
19095         *)      case "$usethreads" in
19096                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
19097                 esac
19098                 d_srandom_r=undef
19099                 srandom_r_proto=0
19100                 ;;
19101         esac
19102         ;;
19103 *)      srandom_r_proto=0
19104         ;;
19105 esac
19106
19107 : see if prototype for setresgid is available
19108 echo " "
19109 set d_sresgproto setresgid $i_unistd unistd.h
19110 eval $hasproto
19111
19112 : see if prototype for setresuid is available
19113 echo " "
19114 set d_sresuproto setresuid $i_unistd unistd.h
19115 eval $hasproto
19116
19117 : see if stat exists
19118 set stat d_stat
19119 eval $inlibc
19120
19121 : see if sys/stat.h is available
19122 set sys/stat.h i_sysstat
19123 eval $inhdr
19124
19125 : see if stat knows about block sizes
19126 echo " "
19127 echo "Checking to see if your struct stat has st_blocks field..." >&4
19128 set d_statblks stat st_blocks $i_sysstat sys/stat.h
19129 eval $hasfield
19130
19131 : see if this is a sys/vfs.h system
19132 set sys/vfs.h i_sysvfs
19133 eval $inhdr
19134
19135 : see if this is a sys/statfs.h system
19136 set sys/statfs.h i_sysstatfs
19137 eval $inhdr
19138
19139 : Check for statfs_s
19140 echo " "
19141 echo "Checking to see if your system supports struct statfs..." >&4
19142 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
19143 eval $hasstruct
19144 case "$d_statfs_s" in
19145 "$define")      echo "Yes, it does."   ;;
19146 *)              echo "No, it doesn't." ;;
19147 esac
19148
19149
19150 : see if struct statfs knows about f_flags
19151 case "$d_statfs_s" in
19152 define)
19153         echo " "
19154         echo "Checking to see if your struct statfs has f_flags field..." >&4
19155         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
19156         eval $hasfield
19157         ;;
19158 *)      val="$undef"
19159         set d_statfs_f_flags
19160         eval $setvar
19161         ;;
19162 esac
19163 case "$d_statfs_f_flags" in
19164 "$define")      echo "Yes, it does."   ;;
19165 *)              echo "No, it doesn't." ;;
19166 esac
19167
19168 : see what flavor, if any, of static inline is supported
19169 echo " "
19170 echo "Checking to see if your system supports static inline..."
19171 $cat > try.c <<'EOCP'
19172 #include <stdlib.h>
19173 extern int f_via_a(int x);
19174 extern int f_via_b(int x);
19175 int main(int argc, char **argv)
19176 {
19177     int y;
19178
19179     y = f_via_a(0);
19180 #ifdef USE_B
19181     y = f_via_b(0);
19182 #endif
19183     if (y == 42) {
19184         return EXIT_SUCCESS;
19185     }
19186     else {
19187         return EXIT_FAILURE;
19188     }
19189 }
19190 EOCP
19191 $cat > a.c <<'EOCP'
19192 static INLINE int f(int x) {
19193     int y;
19194     y = x + 42;
19195     return y;
19196 }
19197
19198 int f_via_a(int x)
19199 {
19200     return f(x);
19201 }
19202 EOCP
19203 $cat > b.c <<'EOCP'
19204 extern int f(int x);
19205
19206 int f_via_b(int x)
19207 {
19208     return f(x);
19209 }
19210 EOCP
19211
19212 # Respect a hint (or previous) value for perl_static_inline, if there is one.
19213 case "$perl_static_inline" in
19214 '')     # Check the various possibilities, and break out on success.
19215         # For gcc, prefer __inline__, which will still permit
19216         # cflags.SH to add in -ansi.
19217         case "$gccversion" in
19218                 '') xxx="inline __inline__ __inline _inline";;
19219                 *)  xxx="__inline__ inline __inline _inline";;
19220         esac
19221         for inline in $xxx; do
19222                 set try -DINLINE=$inline a.c
19223                 if eval $compile && $run ./try; then
19224                         # Now make sure there is no external linkage of static
19225                         # functions
19226                         set try -DINLINE=$inline -DUSE_B a.c b.c
19227                         if eval $compile && $run ./try; then
19228                                 $echo "Your compiler supports static $inline, " >&4
19229                                 $echo "but it also creates an external definition," >&4
19230                                 $echo "so I won't use it." >&4
19231                                 val=$undef
19232                         else
19233                                 $echo "Your compiler supports static $inline." >&4
19234                                 val=$define
19235                                 perl_static_inline="static $inline";
19236                                 break;
19237                         fi
19238                 else
19239                         $echo "Your compiler does NOT support static $inline." >&4
19240                         val="$undef"
19241                 fi
19242         done
19243         ;;
19244 *inline*) # Some variant of inline exists.
19245         echo "Keeping your $hint value of $perl_static_inline."
19246         val=$define
19247         ;;
19248 static)  # No inline capabilities
19249         echo "Keeping your $hint value of $perl_static_inline."
19250         val=$undef
19251         ;;
19252 *)  # Unrecognized previous value -- blindly trust the supplied
19253         # value and hope it makes sense.  Use old value for
19254         # d_static_inline, if there is one.
19255         echo "Keeping your $hint value of $perl_static_inline."
19256         case "$d_static_inline" in
19257                 '') val=$define ;;
19258                 *)  val=$d_static_inline ;;
19259         esac
19260         ;;
19261 esac
19262 # Fallback to plain 'static' if nothing worked.
19263 case "$perl_static_inline" in
19264 '')
19265         perl_static_inline="static"
19266         val=$undef
19267         ;;
19268 esac
19269 set d_static_inline
19270 eval $setvar
19271 $rm -f a.[co] b.[co]
19272 $rm_try
19273
19274 : Check stream access
19275 $cat >&4 <<EOM
19276 Checking how to access stdio streams by file descriptor number...
19277 EOM
19278 case "$stdio_stream_array" in
19279 '')     $cat >try.c <<EOCP
19280 #include <stdio.h>
19281 int main() {
19282   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
19283     printf("yes\n");
19284 }
19285 EOCP
19286         for s in _iob __iob __sF
19287         do
19288                 set try -DSTDIO_STREAM_ARRAY=$s
19289                 if eval $compile; then
19290                         case "`$run ./try`" in
19291                         yes)    stdio_stream_array=$s; break ;;
19292                         esac
19293                 fi
19294         done
19295         $rm_try
19296 esac
19297 case "$stdio_stream_array" in
19298 '')     $cat >&4 <<EOM
19299 I can't figure out how to access stdio streams by file descriptor number.
19300 EOM
19301         d_stdio_stream_array="$undef"
19302         ;;
19303 *)      $cat >&4 <<EOM
19304 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
19305 EOM
19306         d_stdio_stream_array="$define"
19307         ;;
19308 esac
19309
19310 : see if strcoll exists
19311 set strcoll d_strcoll
19312 eval $inlibc
19313
19314 : check for structure copying
19315 echo " "
19316 echo "Checking to see if your C compiler can copy structs..." >&4
19317 $cat >try.c <<'EOCP'
19318 int main()
19319 {
19320         struct blurfl {
19321                 int dyick;
19322         } foo, bar;
19323
19324         foo = bar;
19325 }
19326 EOCP
19327 if $cc -c try.c >/dev/null 2>&1 ; then
19328         val="$define"
19329         echo "Yup, it can."
19330 else
19331         val="$undef"
19332         echo "Nope, it can't."
19333 fi
19334 set d_strctcpy
19335 eval $setvar
19336 $rm_try
19337
19338 : see if strerror and/or sys_errlist[] exist
19339 echo " "
19340 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
19341     if set strerror val -f d_strerror; eval $csym; $val; then
19342                 echo 'strerror() found.' >&4
19343                 d_strerror="$define"
19344                 d_strerrm='strerror(e)'
19345                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19346                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
19347                         d_syserrlst="$define"
19348                 else
19349                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
19350                         d_syserrlst="$undef"
19351                 fi
19352     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
19353                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
19354                 echo 'strerror() found in string header.' >&4
19355                 d_strerror="$define"
19356                 d_strerrm='strerror(e)'
19357                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19358                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
19359                                 d_syserrlst="$define"
19360                 else
19361                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
19362                         d_syserrlst="$undef"
19363                 fi
19364     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19365                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
19366                 d_strerror="$undef"
19367                 d_syserrlst="$define"
19368                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
19369     else
19370                 echo 'strerror() and sys_errlist[] NOT found.' >&4
19371                 d_strerror="$undef"
19372                 d_syserrlst="$undef"
19373                 d_strerrm='"unknown"'
19374     fi
19375 fi
19376
19377 : see if strerror_l exists
19378 set strerror_l d_strerror_l
19379 eval $inlibc
19380
19381 : see if strerror_r exists
19382 set strerror_r d_strerror_r
19383 eval $inlibc
19384 case "$d_strerror_r" in
19385 "$define")
19386         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
19387         case "$d_strerror_r_proto:$usethreads" in
19388         ":define")      d_strerror_r_proto=define
19389                 set d_strerror_r_proto strerror_r $hdrs
19390                 eval $hasproto ;;
19391         *)      ;;
19392         esac
19393         case "$d_strerror_r_proto" in
19394         define)
19395         case "$strerror_r_proto" in
19396         ''|0) try='int strerror_r(int, char*, size_t);'
19397         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
19398         esac
19399         case "$strerror_r_proto" in
19400         ''|0) try='int strerror_r(int, char*, int);'
19401         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
19402         esac
19403         case "$strerror_r_proto" in
19404         ''|0) try='char* strerror_r(int, char*, size_t);'
19405         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
19406         esac
19407         case "$strerror_r_proto" in
19408         ''|0)   d_strerror_r=undef
19409                 strerror_r_proto=0
19410                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19411         * )     case "$strerror_r_proto" in
19412                 REENTRANT_PROTO*) ;;
19413                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19414                 esac
19415                 echo "Prototype: $try" ;;
19416         esac
19417         ;;
19418         *)      case "$usethreads" in
19419                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
19420                 esac
19421                 d_strerror_r=undef
19422                 strerror_r_proto=0
19423                 ;;
19424         esac
19425         ;;
19426 *)      strerror_r_proto=0
19427         ;;
19428 esac
19429
19430 : see if strftime exists
19431 set strftime d_strftime
19432 eval $inlibc
19433
19434 : see if strlcat exists
19435 set strlcat d_strlcat
19436 eval $inlibc
19437
19438 : see if strlcpy exists
19439 set strlcpy d_strlcpy
19440 eval $inlibc
19441
19442 : see if strtod exists
19443 set strtod d_strtod
19444 eval $inlibc
19445
19446 : see if strtol exists
19447 set strtol d_strtol
19448 eval $inlibc
19449
19450 : see if strtold exists
19451 set strtold d_strtold
19452 eval $inlibc
19453
19454 : see if strtoll exists
19455 set strtoll d_strtoll
19456 eval $inlibc
19457
19458 case "$d_longlong-$d_strtoll" in
19459 "$define-$define")
19460         $cat <<EOM
19461 Checking whether your strtoll() works okay...
19462 EOM
19463         $cat >try.c <<'EOCP'
19464 #include <errno.h>
19465 #ifdef __hpux
19466 #define strtoll __strtoll
19467 #endif
19468 #ifdef __EMX__
19469 #define strtoll _strtoll
19470 #endif
19471 #include <stdio.h>
19472 extern long long int strtoll(char *s, char **, int);
19473 static int bad = 0;
19474 int check(char *s, long long ell, int een) {
19475         long long gll;
19476         errno = 0;
19477         gll = strtoll(s, 0, 10);
19478         if (!((gll == ell) && (errno == een)))
19479                 bad++;
19480 }
19481 int main() {
19482         check(" 1",                                      1LL, 0);
19483         check(" 0",                                      0LL, 0);
19484         check("-1",                                     -1LL, 0);
19485         check("-9223372036854775808", -9223372036854775808LL, 0);
19486         check("-9223372036854775808", -9223372036854775808LL, 0);
19487         check(" 9223372036854775807",  9223372036854775807LL, 0);
19488         check("-9223372036854775808", -9223372036854775808LL, 0);
19489         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19490         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19491         if (!bad)
19492                 printf("ok\n");
19493 }
19494 EOCP
19495         set try
19496         if eval $compile; then
19497                 yyy=`$run ./try`
19498                 case "$yyy" in
19499                 ok) echo "Your strtoll() seems to be working okay." ;;
19500                 *) cat <<EOM >&4
19501 Your strtoll() doesn't seem to be working okay.
19502 EOM
19503                    d_strtoll="$undef"
19504                    ;;
19505                 esac
19506         else
19507                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19508                 d_strtoll="$undef"
19509         fi
19510         ;;
19511 esac
19512
19513 : see if strtoq exists
19514 set strtoq d_strtoq
19515 eval $inlibc
19516
19517 : see if strtoul exists
19518 set strtoul d_strtoul
19519 eval $inlibc
19520
19521 case "$d_strtoul" in
19522 "$define")
19523         $cat <<EOM
19524 Checking whether your strtoul() works okay...
19525 EOM
19526         $cat >try.c <<'EOCP'
19527 #include <errno.h>
19528 #include <stdio.h>
19529 extern unsigned long int strtoul(char *s, char **, int);
19530 static int bad = 0;
19531 void check(char *s, unsigned long eul, int een) {
19532         unsigned long gul;
19533         errno = 0;
19534         gul = strtoul(s, 0, 10);
19535         if (!((gul == eul) && (errno == een)))
19536                 bad++;
19537 }
19538 int main() {
19539         check(" 1", 1L, 0);
19540         check(" 0", 0L, 0);
19541 EOCP
19542         case "$longsize" in
19543         8)
19544             $cat >>try.c <<'EOCP'
19545         check("18446744073709551615", 18446744073709551615UL, 0);
19546         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19547 #if 0 /* strtoul() for /^-/ strings is undefined. */
19548         check("-1", 18446744073709551615UL, 0);
19549         check("-18446744073709551614", 2, 0);
19550         check("-18446744073709551615", 1, 0);
19551         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19552         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19553 #endif
19554 EOCP
19555                 ;;
19556         4)
19557                     $cat >>try.c <<'EOCP'
19558         check("4294967295", 4294967295UL, 0);
19559         check("4294967296", 4294967295UL, ERANGE);
19560 #if 0 /* strtoul() for /^-/ strings is undefined. */
19561         check("-1", 4294967295UL, 0);
19562         check("-4294967294", 2, 0);
19563         check("-4294967295", 1, 0);
19564         check("-4294967296", 4294967295UL, ERANGE);
19565         check("-4294967297", 4294967295UL, ERANGE);
19566 #endif
19567 EOCP
19568                 ;;
19569         *)
19570 : Should we write these tests to be more portable by sprintf-ing
19571 : ~0 and then manipulating that char string as input for strtol?
19572                 ;;
19573         esac
19574         $cat >>try.c <<'EOCP'
19575         if (!bad)
19576                 printf("ok\n");
19577         return 0;
19578 }
19579 EOCP
19580         set try
19581         if eval $compile; then
19582                 case "`$run ./try`" in
19583                 ok) echo "Your strtoul() seems to be working okay." ;;
19584                 *) cat <<EOM >&4
19585 Your strtoul() doesn't seem to be working okay.
19586 EOM
19587                    d_strtoul="$undef"
19588                    ;;
19589                 esac
19590         else
19591                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19592                 d_strtoul="$undef"
19593         fi
19594         ;;
19595 esac
19596
19597 : see if strtoull exists
19598 set strtoull d_strtoull
19599 eval $inlibc
19600
19601 case "$d_longlong-$d_strtoull" in
19602 "$define-$define")
19603         $cat <<EOM
19604 Checking whether your strtoull() works okay...
19605 EOM
19606         $cat >try.c <<'EOCP'
19607 #include <errno.h>
19608 #ifdef __hpux
19609 #define strtoull __strtoull
19610 #endif
19611 #include <stdio.h>
19612 extern unsigned long long int strtoull(char *s, char **, int);
19613 static int bad = 0;
19614 int check(char *s, long long eull, int een) {
19615         long long gull;
19616         errno = 0;
19617         gull = strtoull(s, 0, 10);
19618         if (!((gull == eull) && (errno == een)))
19619                 bad++;
19620 }
19621 int main() {
19622         check(" 1",                                        1LL, 0);
19623         check(" 0",                                        0LL, 0);
19624         check("18446744073709551615",  18446744073709551615ULL, 0);
19625         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19626 #if 0 /* strtoull() for /^-/ strings is undefined. */
19627         check("-1",                    18446744073709551615ULL, 0);
19628         check("-18446744073709551614",                     2LL, 0);
19629         check("-18446744073709551615",                     1LL, 0);
19630         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19631         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19632 #endif
19633         if (!bad)
19634                 printf("ok\n");
19635 }
19636 EOCP
19637         set try
19638         if eval $compile; then
19639                 case "`$run ./try`" in
19640                 ok) echo "Your strtoull() seems to be working okay." ;;
19641                 *) cat <<EOM >&4
19642 Your strtoull() doesn't seem to be working okay.
19643 EOM
19644                    d_strtoull="$undef"
19645                    ;;
19646                 esac
19647         else
19648                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19649                 d_strtoull="$undef"
19650         fi
19651         ;;
19652 esac
19653
19654 : see if strtouq exists
19655 set strtouq d_strtouq
19656 eval $inlibc
19657
19658 case "$d_strtouq" in
19659 "$define")
19660         $cat <<EOM
19661 Checking whether your strtouq() works okay...
19662 EOM
19663         $cat >try.c <<'EOCP'
19664 #include <errno.h>
19665 #include <stdio.h>
19666 extern unsigned long long int strtouq(char *s, char **, int);
19667 static int bad = 0;
19668 void check(char *s, unsigned long long eull, int een) {
19669         unsigned long long gull;
19670         errno = 0;
19671         gull = strtouq(s, 0, 10);
19672         if (!((gull == eull) && (errno == een)))
19673                 bad++;
19674 }
19675 int main() {
19676         check(" 1",                                        1LL, 0);
19677         check(" 0",                                        0LL, 0);
19678         check("18446744073709551615",  18446744073709551615ULL, 0);
19679         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19680 #if 0 /* strtouq() for /^-/ strings is undefined. */
19681         check("-1",                    18446744073709551615ULL, 0);
19682         check("-18446744073709551614",                     2LL, 0);
19683         check("-18446744073709551615",                     1LL, 0);
19684         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19685         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19686 #endif
19687         if (!bad)
19688                 printf("ok\n");
19689         return 0;
19690 }
19691 EOCP
19692         set try
19693         if eval $compile; then
19694                 case "`$run ./try`" in
19695                 ok) echo "Your strtouq() seems to be working okay." ;;
19696                 *) cat <<EOM >&4
19697 Your strtouq() doesn't seem to be working okay.
19698 EOM
19699                    d_strtouq="$undef"
19700                    ;;
19701                 esac
19702         else
19703                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19704                 d_strtouq="$undef"
19705         fi
19706         ;;
19707 esac
19708
19709 : see if strxfrm exists
19710 set strxfrm d_strxfrm
19711 eval $inlibc
19712
19713 : see if symlink exists
19714 set symlink d_symlink
19715 eval $inlibc
19716
19717 : see if syscall exists
19718 set syscall d_syscall
19719 eval $inlibc
19720
19721 : see if prototype for syscall is available
19722 echo " "
19723 set d_syscallproto syscall $i_unistd unistd.h
19724 eval $hasproto
19725
19726 : see if sysconf exists
19727 set sysconf d_sysconf
19728 eval $inlibc
19729
19730 : see if system exists
19731 set system d_system
19732 eval $inlibc
19733
19734 : see if tcgetpgrp exists
19735 set tcgetpgrp d_tcgetpgrp
19736 eval $inlibc
19737
19738 : see if tcsetpgrp exists
19739 set tcsetpgrp d_tcsetpgrp
19740 eval $inlibc
19741
19742 : see if prototype for telldir is available
19743 echo " "
19744 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19745 eval $hasproto
19746
19747 : see if tgamma exists
19748 set tgamma d_tgamma
19749 eval $inlibc
19750
19751 : see if time exists
19752 echo " "
19753 if test "X$d_time" = X -o X"$timetype" = X; then
19754     if set time val -f d_time; eval $csym; $val; then
19755                 echo 'time() found.' >&4
19756                 val="$define"
19757                 rp="What is the type returned by time() on this system?"
19758                 set time_t timetype long stdio.h sys/types.h
19759                 eval $typedef_ask
19760     else
19761                 echo 'time() not found, hope that will do.' >&4
19762                 val="$undef"
19763                 timetype='int';
19764     fi
19765     set d_time
19766     eval $setvar
19767 fi
19768
19769 : see if timegm exists
19770 set timegm d_timegm
19771 eval $inlibc
19772
19773 : see if this is a sys/times.h system
19774 set sys/times.h i_systimes
19775 eval $inhdr
19776
19777 : see if times exists
19778 echo " "
19779 if set times val -f d_times; eval $csym; $val; then
19780         echo 'times() found.' >&4
19781         d_times="$define"
19782         inc=''
19783         case "$i_systimes" in
19784         "$define") inc='sys/times.h';;
19785         esac
19786         rp="What is the type returned by times() on this system?"
19787         set clock_t clocktype long stdio.h sys/types.h $inc
19788         eval $typedef_ask
19789 else
19790         echo 'times() NOT found, hope that will do.' >&4
19791         d_times="$undef"
19792         clocktype='int'
19793 fi
19794
19795 : see if tmpnam_r exists
19796 set tmpnam_r d_tmpnam_r
19797 eval $inlibc
19798 case "$d_tmpnam_r" in
19799 "$define")
19800         hdrs="$i_systypes sys/types.h define stdio.h "
19801         case "$d_tmpnam_r_proto:$usethreads" in
19802         ":define")      d_tmpnam_r_proto=define
19803                 set d_tmpnam_r_proto tmpnam_r $hdrs
19804                 eval $hasproto ;;
19805         *)      ;;
19806         esac
19807         case "$d_tmpnam_r_proto" in
19808         define)
19809         case "$tmpnam_r_proto" in
19810         ''|0) try='char* tmpnam_r(char*);'
19811         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19812         esac
19813         case "$tmpnam_r_proto" in
19814         ''|0)   d_tmpnam_r=undef
19815                 tmpnam_r_proto=0
19816                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19817         * )     case "$tmpnam_r_proto" in
19818                 REENTRANT_PROTO*) ;;
19819                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19820                 esac
19821                 echo "Prototype: $try" ;;
19822         esac
19823         ;;
19824         *)      case "$usethreads" in
19825                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19826                 esac
19827                 d_tmpnam_r=undef
19828                 tmpnam_r_proto=0
19829                 ;;
19830         esac
19831         ;;
19832 *)      tmpnam_r_proto=0
19833         ;;
19834 esac
19835
19836 : see if trunc exists
19837 set trunc d_trunc
19838 eval $inlibc
19839
19840 : see if truncate exists
19841 set truncate d_truncate
19842 eval $inlibc
19843
19844 : see if ttyname_r exists
19845 set ttyname_r d_ttyname_r
19846 eval $inlibc
19847 case "$d_ttyname_r" in
19848 "$define")
19849         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19850         case "$d_ttyname_r_proto:$usethreads" in
19851         ":define")      d_ttyname_r_proto=define
19852                 set d_ttyname_r_proto ttyname_r $hdrs
19853                 eval $hasproto ;;
19854         *)      ;;
19855         esac
19856         case "$d_ttyname_r_proto" in
19857         define)
19858         case "$ttyname_r_proto" in
19859         ''|0) try='int ttyname_r(int, char*, size_t);'
19860         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19861         esac
19862         case "$ttyname_r_proto" in
19863         ''|0) try='int ttyname_r(int, char*, int);'
19864         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19865         esac
19866         case "$ttyname_r_proto" in
19867         ''|0) try='char* ttyname_r(int, char*, int);'
19868         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19869         esac
19870         case "$ttyname_r_proto" in
19871         ''|0)   d_ttyname_r=undef
19872                 ttyname_r_proto=0
19873                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19874         * )     case "$ttyname_r_proto" in
19875                 REENTRANT_PROTO*) ;;
19876                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19877                 esac
19878                 echo "Prototype: $try" ;;
19879         esac
19880         ;;
19881         *)      case "$usethreads" in
19882                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19883                 esac
19884                 d_ttyname_r=undef
19885                 ttyname_r_proto=0
19886                 ;;
19887         esac
19888         ;;
19889 *)      ttyname_r_proto=0
19890         ;;
19891 esac
19892
19893 : see if tzname[] exists
19894 echo " "
19895 if set tzname val -a d_tzname; eval $csym; $val; then
19896         val="$define"
19897         echo 'tzname[] found.' >&4
19898 else
19899         val="$undef"
19900         echo 'tzname[] NOT found.' >&4
19901 fi
19902 set d_tzname
19903 eval $setvar
19904
19905 : Check if is a multiplatform env
19906 case "$osname" in
19907 darwin) multiarch="$define" ;;
19908 esac
19909 case "$multiarch" in
19910 ''|[nN]*) multiarch="$undef" ;;
19911 esac
19912
19913 : check for ordering of bytes in a UV
19914 echo " "
19915 case "$multiarch" in
19916 *$define*)
19917         $cat <<EOM
19918 You seem to be doing a multiarchitecture build,
19919 skipping the byteorder check.
19920
19921 EOM
19922         byteorder='ffff'
19923         ;;
19924 *)
19925         case "$byteorder" in
19926         '')
19927                 $cat <<'EOM'
19928 In the following, larger digits indicate more significance.  A big-endian
19929 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19930 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19931 machines may have weird orders like 3412.  A Cray will report 87654321,
19932 an Alpha will report 12345678. If the test program works the default is
19933 probably right.
19934 I'm now running the test program...
19935 EOM
19936                 $cat >try.c <<EOCP
19937 #include <stdio.h>
19938 #$i_stdlib I_STDLIB
19939 #ifdef I_STDLIB
19940 #include <stdlib.h>
19941 #endif
19942 #include <sys/types.h>
19943 typedef $uvtype UV;
19944 int main()
19945 {
19946         int i;
19947         union {
19948                 UV l;
19949                 char c[$uvsize];
19950         } u;
19951
19952         if ($uvsize > 4)
19953                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19954         else
19955                 u.l = (UV)0x04030201;
19956         for (i = 0; i < $uvsize; i++)
19957                 printf("%c", u.c[i]+'0');
19958         printf("\n");
19959         exit(0);
19960 }
19961 EOCP
19962                 xxx_prompt=y
19963                 set try
19964                 if eval $compile && $run ./try > /dev/null; then
19965                         dflt=`$run ./try`
19966                         case "$dflt" in
19967                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19968                                 echo "(The test program ran ok.)"
19969                                 echo "byteorder=$dflt"
19970                                 xxx_prompt=n
19971                         ;;
19972                         ????|????????) echo "(The test program ran ok.)" ;;
19973                         *) echo "(The test program didn't run right for some reason.)" ;;
19974                         esac
19975                 else
19976                         dflt='4321'
19977                         cat <<'EOM'
19978 (I can't seem to compile the test program.  Guessing big-endian...)
19979 EOM
19980                 fi
19981                 case "$xxx_prompt" in
19982                 y)
19983                         rp="What is the order of bytes in $uvtype?"
19984                         . ./myread
19985                         byteorder="$ans"
19986                         ;;
19987                 *)      byteorder=$dflt
19988                         ;;
19989                 esac
19990                 ;;
19991         esac
19992         $rm_try
19993         ;;
19994 esac
19995
19996 : Checking 32bit alignedness
19997 $cat <<EOM
19998
19999 Checking to see whether you can access character data unalignedly...
20000 EOM
20001 case "$d_u32align" in
20002 '')   $cat >try.c <<EOCP
20003 #include <stdio.h>
20004 #$i_stdlib I_STDLIB
20005 #ifdef I_STDLIB
20006 #include <stdlib.h>
20007 #endif
20008 #define U32 $u32type
20009 #define BYTEORDER 0x$byteorder
20010 #define U8 $u8type
20011 #include <signal.h>
20012 #ifdef SIGBUS
20013 $signal_t bletch(int s) { exit(4); }
20014 #endif
20015 int main() {
20016 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
20017     volatile U8 buf[8];
20018     volatile U32 *up;
20019     int i;
20020
20021     if (sizeof(U32) != 4) {
20022         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
20023         exit(1);
20024     }
20025
20026     fflush(stdout);
20027
20028 #ifdef SIGBUS
20029     signal(SIGBUS, bletch);
20030 #endif
20031
20032     buf[0] = 0;
20033     buf[1] = 0;
20034     buf[2] = 0;
20035     buf[3] = 1;
20036     buf[4] = 0;
20037     buf[5] = 0;
20038     buf[6] = 0;
20039     buf[7] = 1;
20040
20041     for (i = 0; i < 4; i++) {
20042         up = (U32*)(buf + i);
20043         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
20044                (*up == 1 << (8*(3-i)))  /* little-endian */
20045               )
20046            )
20047         {
20048             printf("read failed (%x)\n", *up);
20049             exit(2);
20050         }
20051     }
20052
20053     /* write test */
20054     for (i = 0; i < 4; i++) {
20055         up = (U32*)(buf + i);
20056         *up = 0xBeef;
20057         if (*up != 0xBeef) {
20058             printf("write failed (%x)\n", *up);
20059             exit(3);
20060         }
20061     }
20062
20063     exit(0);
20064 #else
20065     printf("1\n");
20066     exit(1);
20067 #endif
20068     return 0;
20069 }
20070 EOCP
20071 set try
20072 if eval $compile_ok; then
20073         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
20074         $run ./try 2>&1 >/dev/null
20075         case "$?" in
20076         0)      cat >&4 <<EOM
20077 You can access character data pretty unalignedly.
20078 EOM
20079                 d_u32align="$undef"
20080                 ;;
20081         *)      cat >&4 <<EOM
20082 It seems that you must access character data in an aligned manner.
20083 EOM
20084                 d_u32align="$define"
20085                 ;;
20086         esac
20087 else
20088         rp='Can you access character data at unaligned addresses?'
20089         dflt='n'
20090         . ./myread
20091         case "$ans" in
20092         [yY]*)  d_u32align="$undef"  ;;
20093         *)      d_u32align="$define" ;;
20094         esac
20095 fi
20096 $rm_try
20097 ;;
20098 esac
20099
20100 : see if ualarm exists
20101 set ualarm d_ualarm
20102 eval $inlibc
20103
20104 : see if umask exists
20105 set umask d_umask
20106 eval $inlibc
20107
20108 : see if unordered exists
20109 set unordered d_unordered
20110 eval $inlibc
20111
20112 : see if unsetenv exists
20113 set unsetenv d_unsetenv
20114 eval $inlibc
20115
20116 : see if usleep exists
20117 set usleep d_usleep
20118 eval $inlibc
20119
20120 : see if prototype for usleep is available
20121 echo " "
20122 set d_usleepproto usleep $i_unistd unistd.h
20123 eval $hasproto
20124
20125 : see if ustat exists
20126 set ustat d_ustat
20127 eval $inlibc
20128
20129 : see if closedir exists
20130 set closedir d_closedir
20131 eval $inlibc
20132
20133 case "$d_closedir" in
20134 "$define")
20135         echo " "
20136         echo "Checking whether closedir() returns a status..." >&4
20137         cat > try.c <<EOM
20138 #$i_dirent I_DIRENT             /**/
20139 #$i_sysdir I_SYS_DIR            /**/
20140 #$i_sysndir I_SYS_NDIR          /**/
20141 #$i_systypes I_SYS_TYPES        /**/
20142
20143 #if defined(I_SYS_TYPES)
20144 #include <sys/types.h>
20145 #endif
20146 #if defined(I_DIRENT)
20147 #include <dirent.h>
20148 #else
20149 #ifdef I_SYS_NDIR
20150 #include <sys/ndir.h>
20151 #else
20152 #ifdef I_SYS_DIR
20153 #ifdef hp9000s500
20154 #include <ndir.h>       /* may be wrong in the future */
20155 #else
20156 #include <sys/dir.h>
20157 #endif
20158 #endif
20159 #endif
20160 #endif
20161 int main() { return closedir(opendir(".")); }
20162 EOM
20163         set try
20164         if eval $compile_ok; then
20165                 if $run ./try > /dev/null 2>&1 ; then
20166                         echo "Yes, it does."
20167                         val="$undef"
20168                 else
20169                         echo "No, it doesn't."
20170                         val="$define"
20171                 fi
20172         else
20173                 echo "(I can't seem to compile the test program--assuming it doesn't)"
20174                 val="$define"
20175         fi
20176         ;;
20177 *)
20178         val="$undef";
20179         ;;
20180 esac
20181 set d_void_closedir
20182 eval $setvar
20183 $rm_try
20184
20185 : see if there is a wait4
20186 set wait4 d_wait4
20187 eval $inlibc
20188
20189 : see if waitpid exists
20190 set waitpid d_waitpid
20191 eval $inlibc
20192
20193 : look for wcscmp
20194 echo " "
20195 $cat >try.c <<'EOCP'
20196 #include <stdio.h>
20197 #include <wchar.h>
20198 int main ()
20199 {
20200     wchar_t *s = L" ";
20201     return (wcscmp (s, s) ? 1 : 0);
20202     }
20203 EOCP
20204 set try
20205 val="$undef"
20206 if eval $compile; then
20207     `$run ./try`
20208     case "$?" in
20209         0)  echo "A working wcscmp() found." >&4
20210             val="$define" ;;
20211         *)  echo "wcscmp() found, but it doesn't work" >&4
20212             ;;
20213         esac
20214 else
20215     echo "wcscmp() NOT found." >&4
20216     fi
20217 set d_wcscmp
20218 eval $setvar
20219 $rm_try
20220
20221 : see if wcstombs exists
20222 set wcstombs d_wcstombs
20223 eval $inlibc
20224
20225 : look for wcsxfrm
20226 echo " "
20227 $cat >try.c <<'EOCP'
20228 #include <errno.h>
20229 #include <wchar.h>
20230 int main ()
20231 {
20232     wchar_t dst[4], *src = L" ";
20233     errno = 0;
20234     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
20235     }
20236 EOCP
20237 set try
20238 val="$undef"
20239 if eval $compile; then
20240     `$run ./try`
20241     case "$?" in
20242         0)  echo "A working wcsxfrm() found." >&4
20243             val="$define" ;;
20244         *)  echo "wcsxfrm() found, but it doesn't work" >&4
20245             ;;
20246         esac
20247 else
20248     echo "wcsxfrm() NOT found." >&4
20249     fi
20250 set d_wcsxfrm
20251 eval $setvar
20252 $rm_try
20253
20254 : see if wctomb exists
20255 set wctomb d_wctomb
20256 eval $inlibc
20257
20258 : see if writev exists
20259 set writev d_writev
20260 eval $inlibc
20261
20262 : check for alignment requirements
20263 echo " "
20264 case "$alignbytes" in
20265     '') echo "Checking alignment constraints..." >&4
20266         $cat >try.c <<EOCP
20267 #include <stdio.h>
20268 struct foobar {
20269     char foo;
20270     $nvtype bar;
20271 } try_algn;
20272 int main()
20273 {
20274     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20275     return(0);
20276 }
20277 EOCP
20278         set try
20279         if eval $compile_ok; then
20280             dflt=`$run ./try`
20281         else
20282             dflt='8'
20283             echo "(I can't seem to compile the test program...)"
20284         fi
20285         case "$multiarch" in
20286             *$define*)
20287                 : The usual safe value is 8, but Darwin with -Duselongdouble
20288                 : needs 16.  Hence, we will take 8 as a minimum, but allow
20289                 : Configure to pick a larger value if needed.
20290                 if $test "$dflt" -lt 8; then
20291                     dflt='8'
20292                     echo "Setting alignment to 8 for multiarch support.">&4
20293                 fi
20294                 ;;
20295         esac
20296         ;;
20297     *) dflt="$alignbytes"
20298         ;;
20299 esac
20300 rp="Doubles must be aligned on a how-many-byte boundary?"
20301 . ./myread
20302 alignbytes="$ans"
20303 $rm_try
20304
20305 : set the base revision
20306 baserev=5.0
20307
20308 : length of character in bytes. Is always 1, otherwise it is not C
20309 : This used to be a test using sizeof
20310 charsize=1
20311
20312 : Check for the number of bits in a character
20313 case "$charbits" in
20314 '')     echo "Checking how long a character is (in bits)..." >&4
20315         $cat >try.c <<EOCP
20316 #include <stdio.h>
20317 int main ()
20318 {
20319     int n;
20320     unsigned char c;
20321     for (c = 1, n = 0; c; c <<= 1, n++) ;
20322     printf ("%d\n", n);
20323     return (0);
20324     }
20325 EOCP
20326         set try
20327         if eval $compile_ok; then
20328                 dflt=`$run ./try`
20329         else
20330                 dflt='8'
20331                 echo "(I can't seem to compile the test program.  Guessing...)"
20332         fi
20333         ;;
20334 *)
20335         dflt="$charbits"
20336         ;;
20337 esac
20338 rp="What is the length of a character (in bits)?"
20339 . ./myread
20340 charbits="$ans"
20341 $rm_try
20342 case "$charbits" in
20343 8)      ;;
20344 *)      cat >&4 << EOM
20345 Your system has an unsigned character size of $charbits bits, which
20346 is rather unusual (normally it is 8 bits).  Perl likely will not work
20347 correctly on your system, with subtle bugs in various places.
20348 EOM
20349         rp='Do you really want to continue?'
20350         dflt='n'
20351         . ./myread
20352         case "$ans" in
20353                 [yY])   echo >&4 "Okay, continuing."    ;;
20354                 *)      exit 1                          ;;
20355         esac
20356 esac
20357
20358 : how do we concatenate cpp tokens here?
20359 echo " "
20360 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20361 $cat >cpp_stuff.c <<'EOCP'
20362 #define RCAT(a,b)a/**/b
20363 #define ACAT(a,b)a ## b
20364 RCAT(Rei,ser)
20365 ACAT(Cir,cus)
20366 EOCP
20367 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20368 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20369         echo "Oh!  Smells like ANSI's been here." >&4
20370         echo "We can catify or stringify, separately or together!"
20371         cpp_stuff=42
20372 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20373         echo "Ah, yes!  The good old days!" >&4
20374         echo "However, in the good old days we don't know how to stringify and"
20375         echo "catify at the same time."
20376         cpp_stuff=1
20377 else
20378         $cat >&4 <<EOM
20379 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20380 You're going to have to edit the values of CAT[2-5] in config.h...
20381 EOM
20382         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20383 fi
20384 $rm -f cpp_stuff.*
20385
20386 : see if this is a db.h system
20387 set db.h i_db
20388 eval $inhdr
20389
20390 case "$i_db" in
20391 $define)
20392         : Check db version.
20393         echo " "
20394         echo "Checking Berkeley DB version ..." >&4
20395         $cat >try.c <<EOCP
20396 #$d_const HASCONST
20397 #ifndef HASCONST
20398 #define const
20399 #endif
20400 #include <sys/types.h>
20401 #include <stdio.h>
20402 #$i_stdlib I_STDLIB
20403 #ifdef I_STDLIB
20404 #include <stdlib.h>
20405 #endif
20406 #include <db.h>
20407 int main(int argc, char *argv[])
20408 {
20409 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20410     int Major, Minor, Patch ;
20411     unsigned long Version ;
20412     (void)db_version(&Major, &Minor, &Patch) ;
20413     if (argc == 2) {
20414         printf("%d %d %d %d %d %d\n",
20415                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20416                Major, Minor, Patch);
20417         exit(0);
20418     }
20419     printf("You have Berkeley DB Version 2 or greater.\n");
20420
20421     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20422                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20423     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20424                 Major, Minor, Patch) ;
20425
20426     /* check that db.h & libdb are compatible */
20427     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20428         printf("db.h and libdb are incompatible.\n") ;
20429         exit(3);
20430     }
20431
20432     printf("db.h and libdb are compatible.\n") ;
20433
20434     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20435                 + DB_VERSION_PATCH ;
20436
20437     /* needs to be >= 2.3.4 */
20438     if (Version < 2003004) {
20439     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20440         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20441         exit(2);
20442     }
20443
20444     exit(0);
20445 #else
20446 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20447     if (argc == 2) {
20448         printf("1 0 0\n");
20449         exit(0);
20450     }
20451     printf("You have Berkeley DB Version 1.\n");
20452     exit(0);    /* DB version < 2: the coast is clear. */
20453 #else
20454     exit(1);    /* <db.h> not Berkeley DB? */
20455 #endif
20456 #endif
20457 }
20458 EOCP
20459         set try
20460         if eval $compile_ok && $run ./try; then
20461                 echo 'Looks OK.' >&4
20462                 set `$run ./try 1`
20463                 db_version_major=$1
20464                 db_version_minor=$2
20465                 db_version_patch=$3
20466         else
20467                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20468                 i_db=$undef
20469                 case " $libs " in
20470                 *"-ldb "*)
20471                         : Remove db from list of libraries to use
20472                         echo "Removing unusable -ldb from library list" >&4
20473                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20474                         shift
20475                         libs="$*"
20476                         echo "libs = $libs" >&4
20477                         ;;
20478                 esac
20479         fi
20480         $rm_try
20481         ;;
20482 esac
20483
20484 case "$i_db" in
20485 define)
20486         : Check the return type needed for hash
20487         echo " "
20488         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20489         $cat >try.c <<EOCP
20490 #$d_const HASCONST
20491 #ifndef HASCONST
20492 #define const
20493 #endif
20494 #include <sys/types.h>
20495 #include <db.h>
20496
20497 #ifndef DB_VERSION_MAJOR
20498 u_int32_t hash_cb (const void* ptr, size_t size)
20499 {
20500 }
20501 HASHINFO info;
20502 int main()
20503 {
20504         info.hash = hash_cb;
20505 }
20506 #endif
20507 EOCP
20508         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20509                 if $contains warning try.out >>/dev/null 2>&1 ; then
20510                         db_hashtype='int'
20511                 else
20512                         db_hashtype='u_int32_t'
20513                 fi
20514         else
20515                 : XXX Maybe we should just give up here.
20516                 db_hashtype=u_int32_t
20517                 $cat try.out >&4
20518                 echo "Help:  I can't seem to compile the db test program." >&4
20519                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20520         fi
20521         $rm_try
20522         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20523         ;;
20524 *)      db_hashtype=u_int32_t
20525         ;;
20526 esac
20527 case "$i_db" in
20528 define)
20529         : Check the return type needed for prefix
20530         echo " "
20531         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20532         cat >try.c <<EOCP
20533 #$d_const HASCONST
20534 #ifndef HASCONST
20535 #define const
20536 #endif
20537 #include <sys/types.h>
20538 #include <db.h>
20539
20540 #ifndef DB_VERSION_MAJOR
20541 size_t prefix_cb (const DBT *key1, const DBT *key2)
20542 {
20543 }
20544 BTREEINFO info;
20545 int main()
20546 {
20547         info.prefix = prefix_cb;
20548 }
20549 #endif
20550 EOCP
20551         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20552                 if $contains warning try.out >>/dev/null 2>&1 ; then
20553                         db_prefixtype='int'
20554                 else
20555                         db_prefixtype='size_t'
20556                 fi
20557         else
20558                 db_prefixtype='size_t'
20559                 : XXX Maybe we should just give up here.
20560                 $cat try.out >&4
20561                 echo "Help:  I can't seem to compile the db test program." >&4
20562                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20563         fi
20564         $rm_try
20565         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20566         ;;
20567 *)      db_prefixtype='size_t'
20568         ;;
20569 esac
20570
20571 : Check what kind of inf/nan your system has
20572 $echo "Checking the kind of infinities and nans you have..." >&4
20573 $echo "(The following tests may crash.  That's okay.)" >&4
20574 $cat >try.c <<EOP
20575 #define DOUBLESIZE $doublesize
20576 #$d_longdbl HAS_LONG_DOUBLE
20577 #ifdef HAS_LONG_DOUBLE
20578 #define LONGDBLSIZE $longdblsize
20579 #define LONGDBLKIND $longdblkind
20580 #endif
20581 #$i_math I_MATH
20582 #ifdef I_MATH
20583 #include <math.h>
20584 #endif
20585 #include <stdio.h>
20586 /* Note that whether the sign bit is on or off
20587  * for NaN depends on the CPU/FPU, and possibly
20588  * can be affected by the build toolchain.
20589  *
20590  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20591  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20592  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20593  * (respectively) as opposed to the more usual
20594  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20595  */
20596 static void bytes(unsigned char *p, unsigned int n) {
20597   int i;
20598   for (i = 0; i < n; i++) {
20599     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20600   }
20601 }
20602 int main(int argc, char *argv[]) {
20603    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20604     * because some compilers are 'smart' and not only warn but refuse to
20605     * compile such 'illegal' values. */
20606    double dinf = exp(1e9);
20607    double dnan = sqrt(-1.0);
20608 #ifdef HAS_LONG_DOUBLE
20609    long double ldinf = (long double)exp(1e9);
20610    long double ldnan = (long double)sqrt(-1.0);
20611 #endif
20612   if (argc == 2) {
20613     switch (argv[1][0]) {
20614     case '1': bytes(&dinf, sizeof(dinf)); break;
20615     case '2': bytes(&dnan, sizeof(dnan)); break;
20616 #ifdef HAS_LONG_DOUBLE
20617 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20618 /* the 80-bit long doubles might have garbage in their excess bytes */
20619     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20620 # endif
20621     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20622     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20623 #endif
20624     }
20625   }
20626   return 0;
20627 }
20628 EOP
20629 set try
20630 if eval $compile; then
20631     doubleinfbytes=`$run ./try 1`
20632     doublenanbytes=`$run ./try 2`
20633     case "$d_longdbl" in
20634     $define)
20635       longdblinfbytes=`$run ./try 3`
20636       longdblnanbytes=`$run ./try 4`
20637       ;;
20638     esac
20639 else
20640     # Defaults in case the above test program failed.
20641     case "$doublekind" in
20642     1) # IEEE 754 32-bit LE
20643        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20644        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20645        ;;
20646     2) # IEEE 754 32-bit BE
20647        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20648        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20649        ;;
20650     3) # IEEE 754 64-bit LE
20651        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20652        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20653        ;;
20654     4) # IEEE 754 64-bit BE
20655        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20656        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20657        ;;
20658     5) # IEEE 754 128-bit LE
20659        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20660        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20661        ;;
20662     6) # IEEE 754 128-bit BE
20663        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20664        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20665        ;;
20666     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20667        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20668        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20669        ;;
20670     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20671        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20672        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20673        ;;
20674     *) # No idea.
20675        doubleinfbytes=$undef
20676        doublenanbytes=$undef
20677        ;;
20678     esac
20679     case "$longdblkind" in
20680     1) # IEEE 754 128-bit LE
20681        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20682        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20683        ;;
20684     2) # IEEE 754 128-bit BE
20685        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20686        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20687        ;;
20688     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20689        case "$longdblsize" in
20690        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20691            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20692            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20693            ;;
20694        16) # x86_64
20695            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20696            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20697            ;;
20698        *)  # No idea.
20699            longdblinfbytes=$undef
20700            longdblnanbytes=$undef
20701        ;;
20702        esac
20703        ;;
20704     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20705        case "$longdblsize" in
20706        12) # 32-bit system
20707            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20708            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20709            ;;
20710        16) # 64-bit system
20711            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20712            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20713            ;;
20714        *)  # No idea.
20715            longdblinfbytes=$undef
20716            longdblnanbytes=$undef
20717        ;;
20718        esac
20719        ;;
20720     5) # 128-bit LE-LE "double double"
20721        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20722        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20723        ;;
20724     6) # 128-bit BE-BE "double double"
20725        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20726        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20727        ;;
20728     7) # 128-bit LE-BE "double double"
20729        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20730        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20731        ;;
20732     8) # 128-bit BE-LE "double double"
20733        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20734        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20735        ;;
20736     *) # No idea.
20737        longdblinfbytes=$undef
20738        longdblnanbytes=$undef
20739        ;;
20740     esac
20741 fi
20742 $rm_try
20743
20744 : Check the length of the double mantissa
20745 $echo "Checking how many mantissa bits your doubles have..." >&4
20746 $cat >try.c <<EOP
20747 #$i_float I_FLOAT
20748 #$i_sunmath I_SUNMATH
20749 #ifdef I_FLOAT
20750 # include <float.h>
20751 #endif
20752 #ifdef I_SUNMATH
20753 # include <sunmath.h>
20754 #endif
20755 #ifdef DBL_MANT_DIG
20756 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20757 #endif
20758 #include <stdio.h>
20759 int main(int argc, char *argv[]) {
20760 #ifdef BITS
20761   printf("%d\n", BITS);
20762 #endif
20763   return 0;
20764 }
20765 EOP
20766 set try
20767 if eval $compile; then
20768     doublemantbits=`$run ./try`
20769 else
20770     doublemantbits="$undef"
20771 fi
20772 $rm_try
20773
20774 : Check the length of the longdouble mantissa
20775 $echo "Checking how many mantissa bits your long doubles have..." >&4
20776 $cat >try.c <<EOP
20777 #$i_float I_FLOAT
20778 #$i_sunmath I_SUNMATH
20779 #ifdef I_FLOAT
20780 # include <float.h>
20781 #endif
20782 #ifdef I_SUNMATH
20783 # include <sunmath.h>
20784 #endif
20785 #$d_longdbl HAS_LONG_DOUBLE
20786 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20787 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20788 /* This format has no implicit bit.  Beware, however, that for
20789  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20790  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20791  * and the top bit must have been one since 387, zero is plain invalid.
20792  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20793 #  define BITS LDBL_MANT_DIG
20794 # elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
20795 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20796  * reason e.g. Irix thinks 107.  But in any case, we want only
20797  * the number of real bits, the implicit bits are of no interest.  */
20798 #  define BITS 2 * (DBL_MANT_DIG - 1)
20799 # else
20800 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20801 # endif
20802 #endif
20803 #include <stdio.h>
20804 int main(int argc, char *argv[]) {
20805 #ifdef BITS
20806   printf("%d\n", BITS);
20807 #endif
20808   return 0;
20809 }
20810 EOP
20811 set try
20812 if eval $compile; then
20813     longdblmantbits=`$run ./try`
20814 else
20815     longdblmantbits="$undef"
20816 fi
20817 $rm_try
20818
20819 : Check the length of the NV mantissa
20820 $echo "Checking how many mantissa bits your NVs have..." >&4
20821 if test "X$usequadmath" = "X$define"; then
20822   nvmantbits=112 # 128-1-15
20823 else
20824   if test "X$nvsize" = "X$doublesize"; then
20825     nvmantbits="$doublemantbits"
20826   else
20827      if test "X$nvsize" = "X$longdblsize"; then
20828        nvmantbits="$longdblmantbits"
20829      else
20830        nvmantbits="$undef"
20831      fi
20832   fi
20833 fi
20834
20835 : How can we generate normalized random numbers ?
20836 echo " "
20837 echo "Using our internal random number implementation..." >&4
20838
20839 case "$ccflags" in
20840 *-Dmy_rand=*|*-Dmy_srand=*)
20841         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20842         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20843         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20844         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20845         ;;
20846 esac
20847
20848 randfunc=Perl_drand48
20849 drand01="Perl_drand48()"
20850 seedfunc="Perl_drand48_init"
20851 randbits=48
20852 randseedtype=U32
20853
20854 : Probe whether dtrace builds an object, as newer Illumos requires an input
20855 : object file that uses at least one of the probes defined in the .d file
20856 case "$usedtrace" in
20857 $define)
20858     case "$dtraceobject" in
20859     $define|true|[yY]*)
20860         dtraceobject=$define
20861         ;;
20862     ' '|'')
20863         $dtrace -h -s ../perldtrace.d -o perldtrace.h
20864         $cat >try.c <<EOM
20865 #include "perldtrace.h"
20866 int main(void) {
20867     PERL_LOADED_FILE("dummy");
20868     return 0;
20869 }
20870 EOM
20871         dtraceobject=$undef
20872         if $cc -c -o try.o $optimize $ccflags try.c \
20873                     && $dtrace -G -s ../perldtrace.d try.o >/dev/null 2>&1; then
20874                 dtraceobject=$define
20875             echo "Your dtrace builds an object file"
20876         fi
20877         $rm -f try.c try.o perldtrace.o
20878         ;;
20879     *) dtraceobject=$undef ;;
20880     esac
20881 esac
20882
20883 : Determine if this is an EBCDIC system
20884 echo " "
20885 echo "Determining whether or not we are on an EBCDIC system..." >&4
20886 $cat >try.c <<'EOM'
20887 int main()
20888 {
20889   if ('M'==0xd4) return 0;
20890   return 1;
20891 }
20892 EOM
20893
20894 val=$undef
20895 set try
20896 if eval $compile_ok; then
20897         if $run ./try; then
20898                 echo "You seem to speak EBCDIC." >&4
20899                 val="$define"
20900         else
20901                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20902         fi
20903 else
20904         echo "I'm unable to compile the test program." >&4
20905         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20906 fi
20907 $rm_try
20908 set ebcdic
20909 eval $setvar
20910
20911 : Check how to flush
20912 echo " "
20913 $cat >&4 <<EOM
20914 Checking how to flush all pending stdio output...
20915 EOM
20916 # I only know how to find the first 32 possibly open files on SunOS.
20917 # See also hints/sunos_4_1.sh and util.c  --AD
20918 case "$osname" in
20919 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20920 esac
20921 $cat >>try.c <<EOCP
20922 #include <stdio.h>
20923 #$i_stdlib I_STDLIB
20924 #ifdef I_STDLIB
20925 #include <stdlib.h>
20926 #endif
20927 #$i_unistd I_UNISTD
20928 #ifdef I_UNISTD
20929 # include <unistd.h>
20930 #endif
20931 #$d_sysconf HAS_SYSCONF
20932 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20933 #ifdef HAS_STDIO_STREAM_ARRAY
20934 # define STDIO_STREAM_ARRAY $stdio_stream_array
20935 #endif
20936 int main() {
20937   FILE* p;
20938   unlink("try.out");
20939   p = fopen("try.out", "w");
20940 #ifdef TRY_FPUTC
20941   fputc('x', p);
20942 #else
20943 # ifdef TRY_FPRINTF
20944   fprintf(p, "x");
20945 # endif
20946 #endif
20947 #ifdef TRY_FFLUSH_NULL
20948   fflush(NULL);
20949 #endif
20950 #ifdef TRY_FFLUSH_ALL
20951   {
20952     long open_max = -1;
20953 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20954     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20955 # else
20956 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20957     open_max = sysconf(_SC_OPEN_MAX);
20958 #  else
20959 #   ifdef FOPEN_MAX
20960     open_max = FOPEN_MAX;
20961 #   else
20962 #    ifdef OPEN_MAX
20963     open_max = OPEN_MAX;
20964 #    else
20965 #     ifdef _NFILE
20966     open_max = _NFILE;
20967 #     endif
20968 #    endif
20969 #   endif
20970 #  endif
20971 # endif
20972 # ifdef HAS_STDIO_STREAM_ARRAY
20973     if (open_max > 0) {
20974       long i;
20975       for (i = 0; i < open_max; i++)
20976             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20977                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20978                 STDIO_STREAM_ARRAY[i]._flag)
20979                 fflush(&STDIO_STREAM_ARRAY[i]);
20980     }
20981   }
20982 # endif
20983 #endif
20984   _exit(42);
20985 }
20986 EOCP
20987 : first we have to find out how _not_ to flush
20988 $to try.c
20989 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20990     output=''
20991     set try -DTRY_FPUTC
20992     if eval $compile; then
20993             $run ./try 2>/dev/null
20994             code="$?"
20995             $from try.out
20996             if $test ! -s try.out -a "X$code" = X42; then
20997                 output=-DTRY_FPUTC
20998             fi
20999     fi
21000     case "$output" in
21001     '')
21002             set try -DTRY_FPRINTF
21003             if eval $compile; then
21004                     $run ./try 2>/dev/null
21005                     code="$?"
21006                     $from try.out
21007                     if $test ! -s try.out -a "X$code" = X42; then
21008                         output=-DTRY_FPRINTF
21009                     fi
21010             fi
21011         ;;
21012     esac
21013 fi
21014 : check for fflush NULL behavior
21015 case "$fflushNULL" in
21016 '')     set try -DTRY_FFLUSH_NULL $output
21017         if eval $compile; then
21018                 $run ./try 2>/dev/null
21019                 code="$?"
21020                 $from try.out
21021                 if $test -s try.out -a "X$code" = X42; then
21022                         fflushNULL="`$cat try.out`"
21023                 else
21024                         if $test "X$code" != X42; then
21025                                 $cat >&4 <<EOM
21026 (If this test failed, don't worry, we'll try another method shortly.)
21027 EOM
21028                         fi
21029                 fi
21030         fi
21031         $rm -f core try.core core.try.*
21032         case "$fflushNULL" in
21033         x)      $cat >&4 <<EOM
21034 Your fflush(NULL) works okay for output streams.
21035 Let's see if it clobbers input pipes...
21036 EOM
21037 # As of mid-March 2000 all versions of Solaris appear to have a stdio
21038 # bug that improperly flushes the input end of pipes.  So we avoid the
21039 # autoflush on fork/system/exec support for now. :-(
21040 $cat >tryp.c <<EOCP
21041 #include <stdio.h>
21042 int
21043 main(int argc, char **argv)
21044 {
21045     char buf[1024];
21046     int i;
21047     char *bp = buf;
21048     while (1) {
21049         while ((i = getc(stdin)) != -1
21050                && (*bp++ = i) != '\n'
21051                && bp < &buf[1024])
21052         /* DO NOTHING */ ;
21053         *bp = '\0';
21054         fprintf(stdout, "%s", buf);
21055         fflush(NULL);
21056         if (i == -1)
21057             return 0;
21058         bp = buf;
21059     }
21060 }
21061 EOCP
21062                 fflushNULL="$define"
21063                 set tryp
21064                 if eval $compile; then
21065                     $rm -f tryp.out
21066                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
21067                     if $test "X$targethost" != X; then
21068                         $to tryp.c
21069                         $to tryp
21070                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
21071                     else
21072                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
21073                     fi
21074                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
21075                        $cat >&4 <<EOM
21076 fflush(NULL) seems to behave okay with input streams.
21077 EOM
21078                         fflushNULL="$define"
21079                     else
21080                         $cat >&4 <<EOM
21081 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
21082 EOM
21083                         fflushNULL="$undef"
21084                     fi
21085                 fi
21086                 $rm -f core tryp.c tryp.core core.tryp.*
21087                 ;;
21088         '')     $cat >&4 <<EOM
21089 Your fflush(NULL) isn't working (contrary to ANSI C).
21090 EOM
21091                 fflushNULL="$undef"
21092                 ;;
21093         *)      $cat >&4 <<EOM
21094 Cannot figure out whether your fflush(NULL) works or not.
21095 I'm assuming it doesn't (contrary to ANSI C).
21096 EOM
21097                 fflushNULL="$undef"
21098                 ;;
21099         esac
21100         ;;
21101 $define|true|[yY]*)
21102         fflushNULL="$define"
21103         ;;
21104 *)
21105         fflushNULL="$undef"
21106         ;;
21107 esac
21108 : check explicit looping only if NULL did not work, and if the pipe
21109 : bug does not show up on an explicit flush too
21110 case "$fflushNULL" in
21111 "$undef")
21112         $cat >tryp.c <<EOCP
21113 #include <stdio.h>
21114 int
21115 main(int argc, char **argv)
21116 {
21117     char buf[1024];
21118     int i;
21119     char *bp = buf;
21120     while (1) {
21121         while ((i = getc(stdin)) != -1
21122                && (*bp++ = i) != '\n'
21123                && bp < &buf[1024])
21124         /* DO NOTHING */ ;
21125         *bp = '\0';
21126         fprintf(stdout, "%s", buf);
21127         fflush(stdin);
21128         if (i == -1)
21129             return 0;
21130         bp = buf;
21131     }
21132 }
21133 EOCP
21134         set tryp
21135         if eval $compile; then
21136             $rm -f tryp.out
21137             if $test "X$targethost" != X; then
21138                 $to tryp.c
21139                 $to tryp
21140                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
21141             else
21142                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
21143             fi
21144             if cmp tryp.c tryp.out >/dev/null 2>&1; then
21145                $cat >&4 <<EOM
21146 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
21147 EOM
21148                 : now check for fflushall behaviour
21149                 case "$fflushall" in
21150                 '')     set try -DTRY_FFLUSH_ALL $output
21151                         if eval $compile; then
21152                                 $cat >&4 <<EOM
21153 (Now testing the other method--but note that this also may fail.)
21154 EOM
21155                                 $run ./try 2>/dev/null
21156                                 code=$?
21157                                 $from try.out
21158                                 if $test -s try.out -a "X$code" = X42; then
21159                                         fflushall="`$cat try.out`"
21160                                 fi
21161                         fi
21162                         $rm_try
21163                         case "$fflushall" in
21164                         x)      $cat >&4 <<EOM
21165 Whew. Flushing explicitly all the stdio streams works.
21166 EOM
21167                                 fflushall="$define"
21168                                 ;;
21169                         '')     $cat >&4 <<EOM
21170 Sigh. Flushing explicitly all the stdio streams doesn't work.
21171 EOM
21172                                 fflushall="$undef"
21173                                 ;;
21174                         *)      $cat >&4 <<EOM
21175 Cannot figure out whether flushing stdio streams explicitly works or not.
21176 I'm assuming it doesn't.
21177 EOM
21178                                 fflushall="$undef"
21179                                 ;;
21180                         esac
21181                         ;;
21182                 "$define"|true|[yY]*)
21183                         fflushall="$define"
21184                         ;;
21185                 *)
21186                         fflushall="$undef"
21187                         ;;
21188                 esac
21189             else
21190                 $cat >&4 <<EOM
21191 All is futile.  Even fflush(stdin) clobbers input pipes!
21192 EOM
21193                 fflushall="$undef"
21194             fi
21195         else
21196             fflushall="$undef"
21197         fi
21198         $rm -f core tryp.c tryp.core core.tryp.*
21199         ;;
21200 *)      fflushall="$undef"
21201         ;;
21202 esac
21203
21204 case "$fflushNULL$fflushall" in
21205 undefundef)
21206         $cat <<EOM
21207 OK, I give up.  I cannot figure out how to flush pending stdio output.
21208 We won't be flushing handles at all before fork/exec/popen.
21209 EOM
21210         ;;
21211 esac
21212 $rm_try tryp
21213
21214 : Store the full pathname to the ar program for use in the C program
21215 : Respect a hint or command line value for full_ar.
21216 case "$full_ar" in
21217 '') full_ar=$ar ;;
21218 esac
21219
21220 : Store the full pathname to the sed program for use in the C program
21221 full_sed=$sed
21222
21223 : see what type gids are declared as in the kernel
21224 echo " "
21225 echo "Looking for the type for group ids returned by getgid()."
21226 set gid_t gidtype xxx stdio.h sys/types.h
21227 eval $typedef
21228 case "$gidtype" in
21229 xxx)
21230         xxx=`./findhdr sys/user.h`
21231         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
21232         case $1 in
21233         unsigned) dflt="$1 $2" ;;
21234         *) dflt="$1" ;;
21235         esac
21236         ;;
21237 *) dflt="$gidtype";;
21238 esac
21239 case "$gidtype" in
21240 gid_t) echo "gid_t found." ;;
21241 *)      rp="What is the type for group ids returned by getgid()?"
21242         . ./myread
21243         gidtype="$ans"
21244         ;;
21245 esac
21246
21247 : Check the size of GID
21248 echo " "
21249 case "$gidtype" in
21250 *_t) zzz="$gidtype"     ;;
21251 *)   zzz="gid"          ;;
21252 esac
21253 echo "Checking the size of $zzz..." >&4
21254 cat > try.c <<EOCP
21255 #include <sys/types.h>
21256 #include <stdio.h>
21257 #$i_stdlib I_STDLIB
21258 #ifdef I_STDLIB
21259 #include <stdlib.h>
21260 #endif
21261 int main() {
21262     printf("%d\n", (int)sizeof($gidtype));
21263     exit(0);
21264 }
21265 EOCP
21266 set try
21267 if eval $compile_ok; then
21268         yyy=`$run ./try`
21269         case "$yyy" in
21270         '')     gidsize=4
21271                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
21272                 ;;
21273         *)      gidsize=$yyy
21274                 echo "Your $zzz is $gidsize bytes long."
21275                 ;;
21276         esac
21277 else
21278         gidsize=4
21279         echo "(I can't compile the test program--guessing $gidsize.)" >&4
21280 fi
21281
21282
21283 : Check if GID is signed
21284 echo " "
21285 case "$gidtype" in
21286 *_t) zzz="$gidtype"     ;;
21287 *)   zzz="gid"          ;;
21288 esac
21289 echo "Checking the sign of $zzz..." >&4
21290 cat > try.c <<EOCP
21291 #include <sys/types.h>
21292 #include <stdio.h>
21293 int main() {
21294         $gidtype foo = -1;
21295         if (foo < 0)
21296                 printf("-1\n");
21297         else
21298                 printf("1\n");
21299 }
21300 EOCP
21301 set try
21302 if eval $compile; then
21303         yyy=`$run ./try`
21304         case "$yyy" in
21305         '')     gidsign=1
21306                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21307                 ;;
21308         *)      gidsign=$yyy
21309                 case "$gidsign" in
21310                  1) echo "Your $zzz is unsigned." ;;
21311                 -1) echo "Your $zzz is signed."   ;;
21312                 esac
21313                 ;;
21314         esac
21315 else
21316         gidsign=1
21317         echo "(I can't compile the test program--guessing unsigned.)" >&4
21318 fi
21319
21320
21321 : Check 64bit sizes
21322 echo " "
21323
21324 if $test X"$quadtype" != X; then
21325
21326 echo "Checking how to print 64-bit integers..." >&4
21327
21328 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21329         $cat >try.c <<'EOCP'
21330 #include <sys/types.h>
21331 #include <stdio.h>
21332 int main() {
21333   int q = 12345678901;
21334   printf("%ld\n", q);
21335 }
21336 EOCP
21337         set try
21338         if eval $compile; then
21339                 yyy=`$run ./try`
21340                 case "$yyy" in
21341                 12345678901)
21342                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21343                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21344                         echo "We will use %d."
21345                         ;;
21346                 esac
21347         fi
21348 fi
21349
21350 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21351         $cat >try.c <<'EOCP'
21352 #include <sys/types.h>
21353 #include <stdio.h>
21354 int main() {
21355   long q = 12345678901;
21356   printf("%ld\n", q);
21357 }
21358 EOCP
21359         set try
21360         if eval $compile; then
21361                 yyy=`$run ./try`
21362                 case "$yyy" in
21363                 12345678901)
21364                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21365                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21366                         echo "We will use %ld."
21367                         ;;
21368                 esac
21369         fi
21370 fi
21371
21372 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21373         $cat >try.c <<'EOCP'
21374 #include <sys/types.h>
21375 #include <inttypes.h>
21376 #include <stdio.h>
21377 int main() {
21378   int64_t q = 12345678901;
21379   printf("%" PRId64 "\n", q);
21380 }
21381 EOCP
21382         set try
21383         if eval $compile; then
21384                 yyy=`$run ./try`
21385                 case "$yyy" in
21386                 12345678901)
21387                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21388                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
21389                         echo "We will use the C9X style."
21390                         ;;
21391                 esac
21392         fi
21393 fi
21394
21395 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21396         $cat >try.c <<EOCP
21397 #include <sys/types.h>
21398 #include <stdio.h>
21399 int main() {
21400   $quadtype q = 12345678901;
21401   printf("%Ld\n", q);
21402 }
21403 EOCP
21404         set try
21405         if eval $compile; then
21406                 yyy=`$run ./try`
21407                 case "$yyy" in
21408                 12345678901)
21409                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21410                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21411                         echo "We will use %Ld."
21412                         ;;
21413                 esac
21414         fi
21415 fi
21416
21417 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21418         $cat >try.c <<'EOCP'
21419 #include <sys/types.h>
21420 #include <stdio.h>
21421 int main() {
21422   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21423   printf("%lld\n", q);
21424 }
21425 EOCP
21426         set try
21427         if eval $compile; then
21428                 yyy=`$run ./try`
21429                 case "$yyy" in
21430                 12345678901)
21431                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21432                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21433                         echo "We will use the %lld style."
21434                         ;;
21435                 esac
21436         fi
21437 fi
21438
21439 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21440         $cat >try.c <<EOCP
21441 #include <sys/types.h>
21442 #include <stdio.h>
21443 int main() {
21444   $quadtype q = 12345678901;
21445   printf("%qd\n", q);
21446 }
21447 EOCP
21448         set try
21449         if eval $compile; then
21450                 yyy=`$run ./try`
21451                 case "$yyy" in
21452                 12345678901)
21453                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21454                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21455                         echo "We will use %qd."
21456                         ;;
21457                 esac
21458         fi
21459 fi
21460
21461 if $test X"$sPRId64" = X; then
21462         echo "Cannot figure out how to print 64-bit integers." >&4
21463 fi
21464 $rm_try
21465
21466 fi
21467
21468 case "$sPRId64" in
21469 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21470         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21471         ;;
21472 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21473         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21474         ;;
21475 esac
21476
21477 : Check format strings for internal types
21478 echo " "
21479 $echo "Checking the format strings to be used for Perl's internal types..." >&4
21480
21481 if $test X"$ivsize" = X8; then
21482         ivdformat="$sPRId64"
21483         uvuformat="$sPRIu64"
21484         uvoformat="$sPRIo64"
21485         uvxformat="$sPRIx64"
21486         uvXUformat="$sPRIXU64"
21487 else
21488         if $test X"$ivsize" = X"$longsize"; then
21489                 ivdformat='"ld"'
21490                 uvuformat='"lu"'
21491                 uvoformat='"lo"'
21492                 uvxformat='"lx"'
21493                 uvXUformat='"lX"'
21494         else
21495                 if $test X"$ivsize" = X"$intsize"; then
21496                         ivdformat='"d"'
21497                         uvuformat='"u"'
21498                         uvoformat='"o"'
21499                         uvxformat='"x"'
21500                         uvXUformat='"X"'
21501                 else
21502                         : far out
21503                         if $test X"$ivsize" = X"$shortsize"; then
21504                                 ivdformat='"hd"'
21505                                 uvuformat='"hu"'
21506                                 uvoformat='"ho"'
21507                                 uvxformat='"hx"'
21508                                 uvXUformat='"hX"'
21509                         fi
21510                 fi
21511         fi
21512 fi
21513
21514 if $test X"$usequadmath" = X"$define"; then
21515     nveformat='"Qe"'
21516     nvfformat='"Qf"'
21517     nvgformat='"Qg"'
21518     nvEUformat='"QE"'
21519     nvFUformat='"QF"'
21520     nvGUformat='"QG"'
21521 else
21522     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21523         nveformat="$sPRIeldbl"
21524         nvfformat="$sPRIfldbl"
21525         nvgformat="$sPRIgldbl"
21526         nvEUformat="$sPRIEUldbl"
21527         nvFUformat="$sPRIFUldbl"
21528         nvGUformat="$sPRIGUldbl"
21529     else
21530         nveformat='"e"'
21531         nvfformat='"f"'
21532         nvgformat='"g"'
21533         nvEUformat='"E"'
21534         nvFUformat='"F"'
21535         nvGUformat='"G"'
21536     fi
21537 fi
21538
21539 case "$ivdformat" in
21540 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21541     exit 1
21542     ;;
21543 esac
21544
21545 : Check format string for GID
21546
21547 echo " "
21548 $echo "Checking the format string to be used for gids..." >&4
21549
21550 case "$gidsign" in
21551 -1)     if $test X"$gidsize" = X"$ivsize"; then
21552                 gidformat="$ivdformat"
21553         else
21554                 if $test X"$gidsize" = X"$longsize"; then
21555                         gidformat='"ld"'
21556                 else
21557                         if $test X"$gidsize" = X"$intsize"; then
21558                                 gidformat='"d"'
21559                         else
21560                                 if $test X"$gidsize" = X"$shortsize"; then
21561                                         gidformat='"hd"'
21562                                 fi
21563                         fi
21564                 fi
21565         fi
21566         ;;
21567 *)      if $test X"$gidsize" = X"$uvsize"; then
21568                 gidformat="$uvuformat"
21569         else
21570                 if $test X"$gidsize" = X"$longsize"; then
21571                         gidformat='"lu"'
21572                 else
21573                         if $test X"$gidsize" = X"$intsize"; then
21574                                 gidformat='"u"'
21575                         else
21576                                 if $test X"$gidsize" = X"$shortsize"; then
21577                                         gidformat='"hu"'
21578                                 fi
21579                         fi
21580                 fi
21581         fi
21582         ;;
21583 esac
21584
21585 : see if getgroups exists
21586 set getgroups d_getgrps
21587 eval $inlibc
21588
21589 : see if setgroups exists
21590 set setgroups d_setgrps
21591 eval $inlibc
21592
21593 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21594 echo " "
21595 case "$d_getgrps$d_setgrps" in
21596 *define*)
21597         case "$groupstype" in
21598         '') dflt="$gidtype" ;;
21599         *)  dflt="$groupstype" ;;
21600         esac
21601         $cat <<EOM
21602 What type of pointer is the second argument to getgroups() and setgroups()?
21603 Usually this is the same as group ids, $gidtype, but not always.
21604
21605 EOM
21606         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21607         . ./myread
21608         groupstype="$ans"
21609         ;;
21610 *)  groupstype="$gidtype";;
21611 esac
21612
21613 : check whether make sets MAKE
21614 echo " "
21615 echo "Checking if your $make program sets \$(MAKE)..." >&4
21616 case "$make_set_make" in
21617 '')
21618         $sed 's/^X //' > testmake.mak << 'EOF'
21619 Xall:
21620 X       @echo 'maketemp="$(MAKE)"'
21621 EOF
21622         case "`$make -f testmake.mak 2>/dev/null`" in
21623         *maketemp=*) make_set_make='#' ;;
21624         *)      make_set_make="MAKE=$make" ;;
21625         esac
21626         $rm -f testmake.mak
21627         ;;
21628 esac
21629 case "$make_set_make" in
21630 '#') echo "Yup, it does.";;
21631 *) echo "Nope, it doesn't.";;
21632 esac
21633
21634 : see what type is used for mode_t
21635 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21636 set mode_t modetype int stdio.h sys/types.h
21637 eval $typedef_ask
21638
21639 : see if we need va_copy
21640 echo " "
21641 case "$i_stdarg" in
21642 "$define")
21643         $cat >try.c <<EOCP
21644 #include <stdarg.h>
21645 #include <stdio.h>
21646 #$i_stdlib I_STDLIB
21647 #ifdef I_STDLIB
21648 #include <stdlib.h>
21649 #endif
21650 #include <signal.h>
21651
21652 int
21653 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21654 {
21655   return vfprintf(f, fmt, *valp);
21656 }
21657
21658 int
21659 myvfprintf(FILE *f, const  char *fmt, va_list val)
21660 {
21661   return ivfprintf(f, fmt, &val);
21662 }
21663
21664 int
21665 myprintf(char *fmt, ...)
21666 {
21667   va_list val;
21668   va_start(val, fmt);
21669   return myvfprintf(stdout, fmt, val);
21670 }
21671
21672 int
21673 main(int ac, char **av)
21674 {
21675   signal(SIGSEGV, exit);
21676
21677   myprintf("%s%cs all right, then\n", "that", '\'');
21678   exit(0);
21679 }
21680 EOCP
21681         set try
21682         if eval $compile && $run ./try 2>&1 >/dev/null; then
21683                 case "`$run ./try`" in
21684                 "that's all right, then")
21685                         okay=yes
21686                         ;;
21687                 esac
21688         fi
21689         case "$okay" in
21690         yes)    echo "It seems that you don't need va_copy()." >&4
21691                 need_va_copy="$undef"
21692                 ;;
21693         *)      echo "It seems that va_copy() or similar will be needed." >&4
21694                 need_va_copy="$define"
21695                 ;;
21696         esac
21697         $rm_try
21698         ;;
21699 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
21700         need_va_copy="$undef"
21701         ;;
21702 esac
21703
21704 : see what type is used for size_t
21705 rp="What is the type used for the length parameter for string functions?"
21706 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21707 eval $typedef_ask
21708
21709 : check for type of arguments to gethostbyaddr.
21710 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21711         case "$d_gethbyaddr" in
21712         $define)
21713                 $cat <<EOM
21714
21715 Checking to see what type of arguments are accepted by gethostbyaddr().
21716 EOM
21717                 hdrs="$define sys/types.h
21718                         $d_socket sys/socket.h
21719                         $i_niin netinet/in.h
21720                         $i_netdb netdb.h
21721                         $i_unistd unistd.h"
21722                 : The first arg can 'char *' or 'void *'
21723                 : The second arg is some of integral type
21724                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21725                         for yyy in size_t long int; do
21726                                 case "$netdb_host_type" in
21727                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21728                                         if ./protochk "$try" $hdrs; then
21729                                                 echo "Your system accepts $xxx for the first arg."
21730                                                 echo "...and $yyy for the second arg."
21731                                                 netdb_host_type="$xxx"
21732                                                 netdb_hlen_type="$yyy"
21733                                         fi
21734                                         ;;
21735                                 esac
21736                         done
21737                 done
21738                 : In case none of those worked, prompt the user.
21739                 case "$netdb_host_type" in
21740                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21741                         dflt='char *'
21742                         . ./myread
21743                         netdb_host_type=$ans
21744                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21745                         dflt="$sizetype"
21746                         . ./myread
21747                         netdb_hlen_type=$ans
21748                         ;;
21749                 esac
21750                 ;;
21751         *)      : no gethostbyaddr, so pick harmless defaults
21752                 netdb_host_type='char *'
21753                 netdb_hlen_type="$sizetype"
21754                 ;;
21755         esac
21756         # Remove the "const" if needed. -- but then we'll have a
21757         # prototype clash!
21758         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21759 fi
21760
21761 : check for type of argument to gethostbyname.
21762 if test "X$netdb_name_type" = X ; then
21763         case "$d_gethbyname" in
21764         $define)
21765                 $cat <<EOM
21766
21767 Checking to see what type of argument is accepted by gethostbyname().
21768 EOM
21769                 hdrs="$define sys/types.h
21770                         $d_socket sys/socket.h
21771                         $i_niin netinet/in.h
21772                         $i_netdb netdb.h
21773                         $i_unistd unistd.h"
21774                 for xxx in "const char *" "char *"; do
21775                         case "$netdb_name_type" in
21776                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21777                                 if ./protochk "$try" $hdrs; then
21778                                         echo "Your system accepts $xxx."
21779                                         netdb_name_type="$xxx"
21780                                 fi
21781                                 ;;
21782                         esac
21783                 done
21784                 : In case none of those worked, prompt the user.
21785                 case "$netdb_name_type" in
21786                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21787                         dflt='char *'
21788                         . ./myread
21789                         netdb_name_type=$ans
21790                         ;;
21791                 esac
21792                 ;;
21793         *)      : no gethostbyname, so pick harmless default
21794                 netdb_name_type='char *'
21795                 ;;
21796         esac
21797 fi
21798
21799 : check for type of 1st argument to getnetbyaddr.
21800 if test "X$netdb_net_type" = X ; then
21801         case "$d_getnbyaddr" in
21802         $define)
21803                 $cat <<EOM
21804
21805 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21806 EOM
21807                 hdrs="$define sys/types.h
21808                         $d_socket sys/socket.h
21809                         $i_niin netinet/in.h
21810                         $i_netdb netdb.h
21811                         $i_unistd unistd.h"
21812                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21813                         case "$netdb_net_type" in
21814                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21815                                 if ./protochk "$try" $hdrs; then
21816                                         echo "Your system accepts $xxx."
21817                                         netdb_net_type="$xxx"
21818                                 fi
21819                                 ;;
21820                         esac
21821                 done
21822                 : In case none of those worked, prompt the user.
21823                 case "$netdb_net_type" in
21824                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21825                         dflt='long'
21826                         . ./myread
21827                         netdb_net_type=$ans
21828                         ;;
21829                 esac
21830                 ;;
21831         *)      : no getnetbyaddr, so pick harmless default
21832                 netdb_net_type='long'
21833                 ;;
21834         esac
21835 fi
21836 : locate the preferred pager for this system
21837 fn=f/
21838 case "$pager" in
21839 '')
21840         dflt=''
21841         case "$pg" in
21842         /*) dflt=$pg;;
21843         [a-zA-Z]:/*) dflt=$pg;;
21844         esac
21845         case "$more" in
21846         /*) dflt=$more;;
21847         [a-zA-Z]:/*) dflt=$more;;
21848         esac
21849         case "$less" in
21850         /*) dflt=$less;;
21851         [a-zA-Z]:/*) dflt=$less;;
21852         esac
21853         case "$dflt" in
21854         '') dflt=/usr/ucb/more;;
21855         esac
21856         ;;
21857 *)      dflt="$pager"
21858         ;;
21859 esac
21860 fn="f/($dflt)"
21861 echo " "
21862 rp='What pager is used on your system?'
21863 . ./getfile
21864 pager="$ans"
21865
21866 : see if ar generates random libraries by itself
21867 echo " "
21868 echo "Checking how to generate random libraries on your machine..." >&4
21869 echo 'int bar1() { return bar2(); }' > bar1.c
21870 echo 'int bar2() { return 2; }' > bar2.c
21871 $cat > foo.c <<EOP
21872 #$i_stdlib I_STDLIB
21873 #ifdef I_STDLIB
21874 #include <stdlib.h>
21875 #endif
21876 int main() { printf("%d\n", bar1()); exit(0); }
21877 EOP
21878 $cc $ccflags -c bar1.c >/dev/null 2>&1
21879 $cc $ccflags -c bar2.c >/dev/null 2>&1
21880 $cc $ccflags -c foo.c >/dev/null 2>&1
21881 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21882 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21883         $run ./foobar >/dev/null 2>&1; then
21884         echo "$ar appears to generate random libraries itself."
21885         orderlib=false
21886         if [ "X$ranlib" = "X" ]; then
21887             ranlib=":"
21888         fi
21889 elif $ar s bar$_a >/dev/null 2>&1 &&
21890         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21891         $run ./foobar >/dev/null 2>&1; then
21892                 echo "a table of contents needs to be added with '$ar s'."
21893                 orderlib=false
21894                 ranlib="$ar s"
21895 elif $ar ts bar$_a >/dev/null 2>&1 &&
21896         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21897         $run ./foobar >/dev/null 2>&1; then
21898                 echo "a table of contents needs to be added with '$ar ts'."
21899                 orderlib=false
21900                 ranlib="$ar ts"
21901 else
21902         case "$ranlib" in
21903         :) ranlib='';;
21904         '')
21905                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21906                 $test -f $ranlib || ranlib=''
21907                 ;;
21908         esac
21909         if $test -n "$ranlib"; then
21910                 echo "your system has '$ranlib'; we'll use that."
21911                 orderlib=false
21912         else
21913                 echo "your system doesn't seem to support random libraries"
21914                 echo "so we'll use lorder and tsort to order the libraries."
21915                 orderlib=true
21916                 ranlib=":"
21917         fi
21918 fi
21919 $rm -f foo* bar*
21920
21921 : see if this is a values.h system
21922 set values.h i_values
21923 eval $inhdr
21924
21925 : Check the max offset that gmtime and localtime accept
21926 echo "Checking max offsets that gmtime () accepts"
21927
21928 case $i_values in
21929     define) yyy="#include <values.h>" ;;
21930     *)      yyy="" ;;
21931     esac
21932
21933 case "$sGMTIME_min/$sGMTIME_max" in
21934     0/0|/)
21935         $cat >try.c <<EOCP
21936 #include <sys/types.h>
21937 #include <stdio.h>
21938 #include <time.h>
21939 $yyy
21940
21941 int i;
21942 struct tm *tmp;
21943 time_t pt;
21944
21945 void gm_check (time_t t, int min_year, int max_year)
21946 {
21947     tmp = gmtime (&t);
21948     if ( tmp == NULL ||
21949         /* Check tm_year overflow */
21950          tmp->tm_year < min_year || tmp->tm_year > max_year)
21951         tmp = NULL;
21952     else
21953         pt = t;
21954     } /* gm_check */
21955
21956 int check_max ()
21957 {
21958     tmp = NULL;
21959     pt  = 0;
21960 #ifdef MAXLONG
21961     gm_check (MAXLONG, 69, 0x7fffffff);
21962 #endif
21963     if (tmp == NULL || tmp->tm_year < 0) {
21964         for (i = 63; i >= 0; i--) {
21965             time_t x = pt | ((time_t)1 << i);
21966             if (x < 0 || x < pt) continue;
21967             gm_check (x, 69, 0x7fffffff);
21968             }
21969         }
21970     printf ("sGMTIME_max=%ld\n", pt);
21971     return (0);
21972     } /* check_max */
21973
21974 int check_min ()
21975 {
21976     tmp = NULL;
21977     pt  = 0;
21978 #ifdef MINLONG
21979     gm_check (MINLONG, -1900, 70);
21980 #endif
21981     if (tmp == NULL) {
21982         for (i = 36; i >= 0; i--) {
21983             time_t x = pt - ((time_t)1 << i);
21984             if (x > 0) continue;
21985             gm_check (x, -1900, 70);
21986             }
21987         }
21988     printf ("sGMTIME_min=%ld\n", pt);
21989     return (0);
21990     } /* check_min */
21991
21992 int main (int argc, char *argv[])
21993 {
21994     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21995     check_max ();
21996     check_min ();
21997     return (0);
21998     } /* main */
21999 EOCP
22000         set try
22001         if eval $compile; then
22002             eval `$run ./try 2>/dev/null`
22003         else
22004             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
22005             fi
22006         $rm_try
22007         ;;
22008     esac
22009
22010 echo "Checking max offsets that localtime () accepts"
22011
22012 case "$sLOCALTIME_min/$sLOCALTIME_max" in
22013     0/0|/)
22014         $cat >try.c <<EOCP
22015 #include <sys/types.h>
22016 #include <stdio.h>
22017 #include <time.h>
22018 $yyy
22019
22020 int i;
22021 struct tm *tmp;
22022 time_t pt;
22023
22024 void local_check (time_t t, int min_year, int max_year)
22025 {
22026     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
22027         tmp = NULL;
22028     else
22029         tmp = localtime (&t);
22030     if ( tmp == NULL ||
22031         /* Check tm_year overflow */
22032          tmp->tm_year < min_year || tmp->tm_year > max_year)
22033         tmp = NULL;
22034     else
22035         pt = t;
22036     } /* local_check */
22037
22038 int check_max ()
22039 {
22040     tmp = NULL;
22041     pt  = 0;
22042 #ifdef MAXLONG
22043     local_check (MAXLONG, 69, 0x7fffffff);
22044 #endif
22045     if (tmp == NULL || tmp->tm_year < 0) {
22046         for (i = 63; i >= 0; i--) {
22047             time_t x = pt | ((time_t)1 << i);
22048             if (x < 0 || x < pt) continue;
22049             local_check (x, 69, 0x7fffffff);
22050             }
22051         }
22052     printf ("sLOCALTIME_max=%ld\n", pt);
22053     return (0);
22054    } /* check_max */
22055
22056 int check_min ()
22057 {
22058     tmp = NULL;
22059     pt  = 0;
22060 #ifdef MINLONG
22061     local_check (MINLONG, -1900, 70);
22062 #endif
22063     if (tmp == NULL) {
22064         for (i = 36; i >= 0; i--) {
22065             time_t x = pt - ((time_t)1 << i);
22066             if (x > 0) continue;
22067             local_check (x, -1900, 70);
22068             }
22069         }
22070     printf ("sLOCALTIME_min=%ld\n", pt);
22071     return (0);
22072     } /* check_min */
22073
22074 int main (int argc, char *argv[])
22075 {
22076     check_max ();
22077     check_min ();
22078     return (0);
22079     } /* main */
22080 EOCP
22081         set try
22082         if eval $compile; then
22083             eval `$run ./try 2>/dev/null`
22084         else
22085             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
22086             fi
22087         $rm_try
22088         ;;
22089     esac
22090
22091 : check for type of arguments to select.
22092 case "$selecttype" in
22093 '') case "$d_select" in
22094         $define)
22095                 echo " "
22096                 $cat <<EOM
22097 Checking to see what type of arguments are accepted by select().
22098 EOM
22099                 hdrs="$define sys/types.h
22100                         $i_systime sys/time.h
22101                         $i_sysselct sys/select.h
22102                         $d_socket sys/socket.h"
22103                 : The first arg can be int, unsigned, or size_t
22104                 : The last arg may or may not be 'const'
22105                 val=''
22106                 : void pointer has been seen but using that
22107                 : breaks the selectminbits test
22108                 for xxx in 'fd_set *' 'int *'; do
22109                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
22110                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
22111                                         case "$val" in
22112                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
22113                                                 if ./protochk "$try" $hdrs; then
22114                                                         echo "Your system accepts $xxx."
22115                                                         val="$xxx"
22116                                                 fi
22117                                                 ;;
22118                                         esac
22119                                 done
22120                         done
22121                 done
22122                 case "$val" in
22123                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
22124                         case "$d_fd_set" in
22125                                 $define) dflt="fd_set *" ;;
22126                                 *)              dflt="int *" ;;
22127                         esac
22128                         . ./myread
22129                         val=$ans
22130                         ;;
22131                 esac
22132                 selecttype="$val"
22133                 ;;
22134         *)      : no select, so pick a harmless default
22135                 selecttype='int *'
22136                 ;;
22137         esac
22138         ;;
22139 esac
22140
22141 : check for the select 'width'
22142 case "$selectminbits" in
22143 '') safebits=`expr $ptrsize \* 8`
22144     case "$d_select" in
22145         $define)
22146                 $cat <<EOM
22147
22148 Checking to see on how many bits at a time your select() operates...
22149 EOM
22150                 $cat >try.c <<EOCP
22151 #include <sys/types.h>
22152 #$i_time I_TIME
22153 #$i_systime I_SYS_TIME
22154 #$i_systimek I_SYS_TIME_KERNEL
22155 #ifdef I_TIME
22156 #   include <time.h>
22157 #endif
22158 #ifdef I_SYS_TIME
22159 #   ifdef I_SYS_TIME_KERNEL
22160 #       define KERNEL
22161 #   endif
22162 #   include <sys/time.h>
22163 #   ifdef I_SYS_TIME_KERNEL
22164 #       undef KERNEL
22165 #   endif
22166 #endif
22167 #$i_sysselct I_SYS_SELECT
22168 #ifdef I_SYS_SELECT
22169 #include <sys/select.h>
22170 #endif
22171 #$d_socket HAS_SOCKET
22172 #ifdef HAS_SOCKET
22173 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
22174 #endif
22175 #include <stdio.h>
22176 #$i_stdlib I_STDLIB
22177 #ifdef I_STDLIB
22178 #include <stdlib.h>
22179 #endif
22180 $selecttype b;
22181 #define S sizeof(*(b))
22182 #define MINBITS 64
22183 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
22184 #define NBITS  (NBYTES * 8)
22185 int main() {
22186     char *s = (char *)malloc(NBYTES);
22187     struct timeval t;
22188     int i;
22189     FILE* fp;
22190     int fd;
22191
22192     if (!s)
22193         exit(1);
22194     fclose(stdin);
22195     fp = fopen("try.c", "r");
22196     if (fp == 0)
22197       exit(2);
22198     fd = fileno(fp);
22199     if (fd < 0)
22200       exit(3);
22201     b = ($selecttype)s;
22202     for (i = 0; i < NBITS; i++)
22203         FD_SET(i, b);
22204     t.tv_sec  = 0;
22205     t.tv_usec = 0;
22206     select(fd + 1, b, 0, 0, &t);
22207     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
22208     free(s);
22209     printf("%d\n", i + 1);
22210     return 0;
22211 }
22212 EOCP
22213                 set try
22214                 if eval $compile_ok; then
22215                         selectminbits=`$run ./try 2>/dev/null`
22216                         case "$selectminbits" in
22217                         '')     cat >&4 <<EOM
22218 Cannot figure out on how many bits at a time your select() operates.
22219 I'll play safe and guess it is $safebits bits.
22220 EOM
22221                                 selectminbits=$safebits
22222                                 bits="$safebits bits"
22223                                 ;;
22224                         1)      bits="1 bit" ;;
22225                         *)      bits="$selectminbits bits" ;;
22226                         esac
22227                         echo "Your select() operates on $bits at a time." >&4
22228                 else
22229                         rp='What is the minimum number of bits your select() operates on?'
22230                         case "$byteorder" in
22231                         12345678)       dflt=64 ;;
22232                         1234)           dflt=32 ;;
22233                         *)              dflt=1  ;;
22234                         esac
22235                         . ./myread
22236                         val=$ans
22237                         selectminbits="$val"
22238                 fi
22239                 $rm_try
22240                 ;;
22241         *)      : no select, so pick a harmless default
22242                 selectminbits=$safebits
22243                 ;;
22244         esac
22245         ;;
22246 esac
22247
22248 : Trace out the files included by signal.h, then look for SIGxxx names.
22249 case "$sig_num_init" in
22250 '')
22251 if [ "X$fieldn" = X ]; then
22252         : Just make some guesses.  We check them later.
22253         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
22254 else
22255         xxx=`echo '#include <signal.h>' |
22256         $cppstdin $cppminus $cppflags 2>/dev/null |
22257         $grep '^[       ]*#.*include' |
22258         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
22259                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
22260 fi
22261 xxxfiles=''
22262 for xx in $xxx /dev/null ; do
22263         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
22264 done
22265 case "$xxxfiles" in
22266 '')     xxxfiles=`./findhdr signal.h` ;;
22267 esac
22268 xxx=`awk '
22269 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
22270         print substr($2, 4, 20)
22271 }
22272 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
22273         print substr($3, 4, 20)
22274 }' $xxxfiles`
22275 : Append some common names just in case the awk scan failed.
22276 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22277 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22278 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22279 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22280 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22281
22282 : generate a few handy files for later
22283 $cat > signal.c <<EOCP
22284 #include <sys/types.h>
22285 #include <signal.h>
22286 #$i_stdlib I_STDLIB
22287 #ifdef I_STDLIB
22288 #include <stdlib.h>
22289 #endif
22290 #include <stdio.h>
22291 int main() {
22292
22293 /* Strange style to avoid deeply-nested #if/#else/#endif */
22294 #ifndef NSIG
22295 #  ifdef _NSIG
22296 #    define NSIG (_NSIG)
22297 #  endif
22298 #endif
22299
22300 #ifndef NSIG
22301 #  ifdef SIGMAX
22302 #    define NSIG (SIGMAX+1)
22303 #  endif
22304 #endif
22305
22306 #ifndef NSIG
22307 #  ifdef SIG_MAX
22308 #    define NSIG (SIG_MAX+1)
22309 #  endif
22310 #endif
22311
22312 #ifndef NSIG
22313 #  ifdef _SIG_MAX
22314 #    define NSIG (_SIG_MAX+1)
22315 #  endif
22316 #endif
22317
22318 #ifndef NSIG
22319 #  ifdef MAXSIG
22320 #    define NSIG (MAXSIG+1)
22321 #  endif
22322 #endif
22323
22324 #ifndef NSIG
22325 #  ifdef MAX_SIG
22326 #    define NSIG (MAX_SIG+1)
22327 #  endif
22328 #endif
22329
22330 #ifndef NSIG
22331 #  ifdef SIGARRAYSIZE
22332 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22333 #  endif
22334 #endif
22335
22336 #ifndef NSIG
22337 #  ifdef _sys_nsig
22338 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
22339 #  endif
22340 #endif
22341
22342 /* Default to some arbitrary number that's big enough to get most
22343    of the common signals.
22344 */
22345 #ifndef NSIG
22346 #    define NSIG 50
22347 #endif
22348
22349 printf("NSIG %d\n", NSIG);
22350
22351 #ifndef JUST_NSIG
22352
22353 EOCP
22354
22355 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22356 {
22357         printf "#ifdef SIG"; printf $1; printf "\n"
22358         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22359         printf $1; printf ");\n"
22360         printf "#endif\n"
22361 }
22362 END {
22363         printf "#endif /* JUST_NSIG */\n";
22364         printf "exit(0);\n}\n";
22365 }
22366 ' >>signal.c
22367 $cat >signal.awk <<'EOP'
22368 BEGIN { ndups = 0 }
22369 $1 ~ /^NSIG$/ { nsig = $2 }
22370 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22371     if ($2 > maxsig) { maxsig = $2 }
22372     if (sig_name[$2]) {
22373         dup_name[ndups] = $1
22374         dup_num[ndups] = $2
22375         ndups++
22376     }
22377     else {
22378         sig_name[$2] = $1
22379         sig_num[$2] = $2
22380     }
22381 }
22382 END {
22383     if (nsig == 0) {
22384         nsig = maxsig + 1
22385     }
22386     printf("NSIG %d\n", nsig);
22387     for (n = 1; n < nsig; n++) {
22388         if (sig_name[n]) {
22389             printf("%s %d\n", sig_name[n], sig_num[n])
22390         }
22391         else {
22392             printf("NUM%d %d\n", n, n)
22393         }
22394     }
22395     for (n = 0; n < ndups; n++) {
22396         printf("%s %d\n", dup_name[n], dup_num[n])
22397     }
22398 }
22399 EOP
22400 $cat >signal_cmd <<EOS
22401 $startsh
22402 if $test -s signal.lst; then
22403     echo "Using your existing signal.lst file"
22404         exit 0
22405 fi
22406 xxx="$xxx"
22407 EOS
22408 $cat >>signal_cmd <<'EOS'
22409
22410 set signal
22411 if eval $compile_ok; then
22412         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22413                 $uniq | $awk -f signal.awk >signal.lst
22414 else
22415         echo "(I can't seem be able to compile the whole test program)" >&4
22416         echo "(I'll try it in little pieces.)" >&4
22417         set signal -DJUST_NSIG
22418         if eval $compile_ok; then
22419                 $run ./signal$_exe > signal.nsg
22420                 $cat signal.nsg
22421         else
22422                 echo "I can't seem to figure out how many signals you have." >&4
22423                 echo "Guessing 50." >&4
22424                 echo 'NSIG 50' > signal.nsg
22425         fi
22426         : Now look at all the signal names, one at a time.
22427         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22428                 $cat > signal.c <<EOCP
22429 #include <sys/types.h>
22430 #include <signal.h>
22431 #include <stdio.h>
22432 int main() {
22433 printf("$xx %d\n", SIG${xx});
22434 return 0;
22435 }
22436 EOCP
22437                 set signal
22438                 if eval $compile; then
22439                         echo "SIG${xx} found."
22440                         $run ./signal$_exe  >> signal.ls1
22441                 else
22442                         echo "SIG${xx} NOT found."
22443                 fi
22444         done
22445         if $test -s signal.ls1; then
22446                 $cat signal.nsg signal.ls1 |
22447                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
22448         fi
22449
22450 fi
22451 if $test -s signal.lst; then
22452         :
22453 else
22454         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
22455         echo 'kill -l' >signal
22456         set X `csh -f <signal`
22457         $rm -f signal
22458         shift
22459         case $# in
22460         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
22461         esac
22462         echo $@ | $tr ' ' $trnl | \
22463             $awk '{ printf "%s %d\n", $1, ++s; }
22464                   END { printf "NSIG %d\n", ++s }' >signal.lst
22465 fi
22466 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
22467 EOS
22468 chmod a+x signal_cmd
22469 $eunicefix signal_cmd
22470 ;;
22471 esac
22472
22473 : generate list of signal names
22474 case "$sig_num_init" in
22475 '')
22476 echo " "
22477 case "$sig_name_init" in
22478 '') doinit=yes ;;
22479 *)  case "$sig_num_init" in
22480     ''|*,*) doinit=yes ;;
22481     esac ;;
22482 esac
22483 case "$doinit" in
22484 yes)
22485         echo "Generating a list of signal names and numbers..." >&4
22486         . ./signal_cmd
22487         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22488         sig_name=`$awk 'BEGIN { printf "ZERO " }
22489                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
22490         sig_num=`$awk  'BEGIN { printf "0 " }
22491                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
22492         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
22493                              !/^NSIG/   { printf "\"%s\", ", $1 }
22494                              END        { printf "0\n" }' signal.lst`
22495         sig_num_init=`$awk  'BEGIN      { printf "0, " }
22496                              !/^NSIG/   { printf "%d, ", $2}
22497                              END        { printf "0\n"}' signal.lst`
22498         ;;
22499 esac
22500 echo "The following $sig_count signals are available:"
22501 echo " "
22502 echo $sig_name | $awk \
22503 'BEGIN { linelen = 0 }
22504 {
22505         for (i = 1; i <= NF; i++) {
22506                 name = "SIG" $i " "
22507                 linelen = linelen + length(name)
22508                 if (linelen > 70) {
22509                         printf "\n"
22510                         linelen = length(name)
22511                 }
22512                 printf "%s", name
22513         }
22514         printf "\n"
22515 }'
22516 sig_size=`echo $sig_name | awk '{print NF}'`
22517 $rm -f signal signal.c signal.awk signal.lst signal_cmd
22518 ;;
22519 esac
22520
22521 : Check size of size
22522 echo " "
22523 case "$sizetype" in
22524 *_t) zzz="$sizetype"    ;;
22525 *)   zzz="filesize"     ;;
22526 esac
22527 echo "Checking the size of $zzz..." >&4
22528 cat > try.c <<EOCP
22529 #include <sys/types.h>
22530 #include <stdio.h>
22531 #$i_stdlib I_STDLIB
22532 #ifdef I_STDLIB
22533 #include <stdlib.h>
22534 #endif
22535 int main() {
22536     printf("%d\n", (int)sizeof($sizetype));
22537     exit(0);
22538 }
22539 EOCP
22540 set try
22541 if eval $compile_ok; then
22542         yyy=`$run ./try`
22543         case "$yyy" in
22544         '')     sizesize=4
22545                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22546                 ;;
22547         *)      sizesize=$yyy
22548                 echo "Your $zzz size is $sizesize bytes."
22549                 ;;
22550         esac
22551 else
22552         sizesize=4
22553         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22554 fi
22555
22556
22557 : check for socklen_t
22558 echo " "
22559 echo "Checking to see if you have socklen_t..." >&4
22560 $cat >try.c <<EOCP
22561 #include <sys/types.h>
22562 #$d_socket HAS_SOCKET
22563 #ifdef HAS_SOCKET
22564 #include <sys/socket.h>
22565 #endif
22566 int main() { socklen_t x = 16; }
22567 EOCP
22568 set try
22569 if eval $compile; then
22570         val="$define"
22571         echo "You have socklen_t."
22572 else
22573         val="$undef"
22574         echo "You do not have socklen_t."
22575         case "$sizetype" in
22576         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22577         esac
22578 fi
22579 $rm_try
22580 set d_socklen_t
22581 eval $setvar
22582
22583 : see if this is a socks.h system
22584 set socks.h i_socks
22585 eval $inhdr
22586
22587 : check for type of the size argument to socket calls
22588 case "$d_socket" in
22589 "$define")
22590         $cat <<EOM
22591
22592 Checking to see what type is the last argument of accept().
22593 EOM
22594         yyy=''
22595         case "$d_socklen_t" in
22596         "$define") yyy="$yyy socklen_t"
22597         esac
22598         yyy="$yyy $sizetype int long unsigned"
22599         for xxx in $yyy; do
22600                 case "$socksizetype" in
22601                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22602                         case "$usesocks" in
22603                         "$define")
22604                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22605                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22606                                         socksizetype="$xxx"
22607                                 fi
22608                                 ;;
22609                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22610                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22611                                         socksizetype="$xxx"
22612                                 fi
22613                                 ;;
22614                         esac
22615                         ;;
22616                 esac
22617         done
22618 : In case none of those worked, prompt the user.
22619         case "$socksizetype" in
22620         '')     rp='What is the type for socket address structure sizes?'
22621                 dflt='int'
22622                 . ./myread
22623                 socksizetype=$ans
22624                 ;;
22625         esac
22626         ;;
22627 *)      : no sockets, so pick relatively harmless default
22628         socksizetype='int'
22629         ;;
22630 esac
22631
22632 : see what type is used for signed size_t
22633 set ssize_t ssizetype int stdio.h sys/types.h
22634 eval $typedef
22635 dflt="$ssizetype"
22636 $cat > try.c <<EOM
22637 #include <stdio.h>
22638 #$i_stdlib I_STDLIB
22639 #ifdef I_STDLIB
22640 #include <stdlib.h>
22641 #endif
22642 #include <sys/types.h>
22643 #define Size_t $sizetype
22644 #define SSize_t $dflt
22645 int main()
22646 {
22647         if (sizeof(Size_t) == sizeof(SSize_t))
22648                 printf("$dflt\n");
22649         else if (sizeof(Size_t) == sizeof(int))
22650                 printf("int\n");
22651         else
22652                 printf("long\n");
22653         exit(0);
22654 }
22655 EOM
22656 echo " "
22657 set try
22658 if eval $compile_ok && $run ./try > /dev/null; then
22659         ssizetype=`$run ./try`
22660         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22661 else
22662         $cat >&4 <<EOM
22663 Help! I can't compile and run the ssize_t test program: please enlighten me!
22664 (This is probably a misconfiguration in your system or libraries, and
22665 you really ought to fix it.  Still, I'll try anyway.)
22666
22667 I need a type that is the same size as $sizetype, but is guaranteed to
22668 be signed.  Common values are ssize_t, int and long.
22669
22670 EOM
22671         rp="What signed type is the same size as $sizetype?"
22672         . ./myread
22673         ssizetype="$ans"
22674 fi
22675 $rm_try
22676
22677 : Check the size of st_ino
22678 $echo " "
22679 $echo "Checking the size of st_ino..." >&4
22680 $cat > try.c <<EOCP
22681 #include <sys/stat.h>
22682 #include <stdio.h>
22683 #$i_stdlib I_STDLIB
22684 #ifdef I_STDLIB
22685 #include <stdlib.h>
22686 #endif
22687 int main() {
22688     struct stat st;
22689     printf("%d\n", (int)sizeof(st.st_ino));
22690     exit(0);
22691 }
22692 EOCP
22693 set try
22694 if eval $compile_ok; then
22695         val=`$run ./try`
22696         case "$val" in
22697         '')     st_ino_size=4
22698                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22699                 ;;
22700         *)      st_ino_size=$val
22701                 $echo "Your st_ino is $st_ino_size bytes long."
22702                 ;;
22703         esac
22704 else
22705         st_ino_size=4
22706         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22707 fi
22708 $rm_try
22709
22710 : Check if st_ino is signed
22711 $echo " "
22712 $echo "Checking the sign of st_ino..." >&4
22713 $cat > try.c <<EOCP
22714 #include <sys/stat.h>
22715 #include <stdio.h>
22716 int main() {
22717         struct stat foo;
22718         foo.st_ino = -1;
22719         if (foo.st_ino < 0)
22720                 printf("-1\n");
22721         else
22722                 printf("1\n");
22723 }
22724 EOCP
22725 set try
22726 if eval $compile; then
22727         val=`$run ./try`
22728         case "$val" in
22729         '')     st_ino_sign=1
22730                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22731                 ;;
22732         *)      st_ino_sign=$val
22733                 case "$st_ino_sign" in
22734                  1) $echo "Your st_ino is unsigned." ;;
22735                 -1) $echo "Your st_ino is signed."   ;;
22736                 esac
22737                 ;;
22738         esac
22739 else
22740         st_ino_sign=1
22741         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22742 fi
22743 $rm_try
22744
22745 : see what type of char stdio uses.
22746 echo " "
22747 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22748 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22749         echo "Your stdio uses unsigned chars." >&4
22750         stdchar="unsigned char"
22751 else
22752         echo "Your stdio uses signed chars." >&4
22753         stdchar="char"
22754 fi
22755 $rm -f stdioh
22756
22757 : Check size of UID
22758 echo " "
22759 case "$uidtype" in
22760 *_t) zzz="$uidtype"     ;;
22761 *)   zzz="uid"          ;;
22762 esac
22763 echo "Checking the size of $zzz..." >&4
22764 cat > try.c <<EOCP
22765 #include <sys/types.h>
22766 #include <stdio.h>
22767 #$i_stdlib I_STDLIB
22768 #ifdef I_STDLIB
22769 #include <stdlib.h>
22770 #endif
22771 int main() {
22772     printf("%d\n", (int)sizeof($uidtype));
22773     exit(0);
22774 }
22775 EOCP
22776 set try
22777 if eval $compile_ok; then
22778         yyy=`$run ./try`
22779         case "$yyy" in
22780         '')     uidsize=4
22781                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22782                 ;;
22783         *)      uidsize=$yyy
22784                 echo "Your $zzz is $uidsize bytes long."
22785                 ;;
22786         esac
22787 else
22788         uidsize=4
22789         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22790 fi
22791
22792 : Check if UID is signed
22793 echo " "
22794 case "$uidtype" in
22795 *_t) zzz="$uidtype"     ;;
22796 *)   zzz="uid"          ;;
22797 esac
22798 echo "Checking the sign of $zzz..." >&4
22799 cat > try.c <<EOCP
22800 #include <sys/types.h>
22801 #include <stdio.h>
22802 int main() {
22803         $uidtype foo = -1;
22804         if (foo < 0)
22805                 printf("-1\n");
22806         else
22807                 printf("1\n");
22808 }
22809 EOCP
22810 set try
22811 if eval $compile; then
22812         yyy=`$run ./try`
22813         case "$yyy" in
22814         '')     uidsign=1
22815                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22816                 ;;
22817         *)      uidsign=$yyy
22818                 case "$uidsign" in
22819                  1) echo "Your $zzz is unsigned." ;;
22820                 -1) echo "Your $zzz is signed."   ;;
22821                 esac
22822                 ;;
22823         esac
22824 else
22825         uidsign=1
22826         echo "(I can't compile the test program--guessing unsigned.)" >&4
22827 fi
22828
22829
22830 : Check format string for UID
22831 echo " "
22832 $echo "Checking the format string to be used for uids..." >&4
22833
22834 case "$uidsign" in
22835 -1)     if $test X"$uidsize" = X"$ivsize"; then
22836                 uidformat="$ivdformat"
22837         else
22838                 if $test X"$uidsize" = X"$longsize"; then
22839                         uidformat='"ld"'
22840                 else
22841                         if $test X"$uidsize" = X"$intsize"; then
22842                                 uidformat='"d"'
22843                         else
22844                                 if $test X"$uidsize" = X"$shortsize"; then
22845                                         uidformat='"hd"'
22846                                 fi
22847                         fi
22848                 fi
22849         fi
22850         ;;
22851 *)      if $test X"$uidsize" = X"$uvsize"; then
22852                 uidformat="$uvuformat"
22853         else
22854                 if $test X"$uidsize" = X"$longsize"; then
22855                         uidformat='"lu"'
22856                 else
22857                         if $test X"$uidsize" = X"$intsize"; then
22858                                 uidformat='"u"'
22859                         else
22860                                 if $test X"$uidsize" = X"$shortsize"; then
22861                                         uidformat='"hu"'
22862                                 fi
22863                         fi
22864                 fi
22865         fi
22866         ;;
22867 esac
22868
22869 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22870 echo " "
22871 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22872 $cat >try.c <<'EOM'
22873 /* Intentionally a long probe as I'd like to sanity check that the exact
22874    approach is going to work, as thinking it will work, but only having it
22875    part working at runtime is worse than not having it.  */
22876
22877 #include <sys/types.h>
22878 #include <sys/sysctl.h>
22879 #include <sys/param.h>
22880 #include <stdio.h>
22881 #include <string.h>
22882 #include <stdlib.h>
22883 #include <unistd.h>
22884
22885 int
22886 main(int argc, char **argv) {
22887     char *buffer;
22888     char *argv_leaf = strrchr(argv[0], '/');
22889     char *buffer_leaf;
22890     size_t size = 0;
22891     int mib[4];
22892
22893     mib[0] = CTL_KERN;
22894     mib[1] = KERN_PROC;
22895     mib[2] = KERN_PROC_PATHNAME;
22896     mib[3] = -1;
22897
22898     if (!argv_leaf) {
22899         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22900         return 1;
22901     }
22902
22903     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22904         perror("sysctl");
22905         return 2;
22906     }
22907
22908     if (size < strlen(argv_leaf) + 1) {
22909         fprintf(stderr, "size %lu is too short for a path\n",
22910                 (unsigned long) size);
22911         return 3;
22912     }
22913
22914     if (size > MAXPATHLEN * MAXPATHLEN) {
22915         fprintf(stderr, "size %lu is too long for a path\n",
22916                 (unsigned long) size);
22917         return 4;
22918     }
22919
22920     buffer = malloc(size);
22921     if (!buffer) {
22922         perror("malloc");
22923         return 5;
22924     }
22925
22926     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22927         perror("sysctl");
22928         return 6;
22929     }
22930
22931     if (strlen(buffer) + 1 != size) {
22932         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22933                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22934         return 7;
22935     }
22936
22937
22938     if (*buffer != '/') {
22939         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22940         return 8;
22941     }
22942
22943     if (strstr(buffer, "/./")) {
22944         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22945         return 9;
22946     }
22947
22948     if (strstr(buffer, "/../")) {
22949         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22950         return 10;
22951     }
22952
22953     buffer_leaf = strrchr(buffer, '/');
22954     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22955         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22956         return 11;
22957     }
22958
22959     free(buffer);
22960
22961     return 0;
22962 }
22963 EOM
22964
22965 val=$undef
22966 set try
22967 if eval $compile; then
22968         if $run ./try; then
22969                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22970                 val="$define"
22971         else
22972                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22973                 val="$undef"
22974         fi
22975 else
22976         echo "I'm unable to compile the test program." >&4
22977         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22978         val="$undef"
22979 fi
22980 $rm_try
22981 set usekernprocpathname
22982 eval $setvar
22983
22984 : Determine if we can use _NSGetExecutablePath to find executing program
22985 echo " "
22986 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22987 $cat >try.c <<'EOM'
22988 /* Intentionally a long probe as I'd like to sanity check that the exact
22989    approach is going to work, as thinking it will work, but only having it
22990    part working at runtime is worse than not having it.  */
22991 #include <mach-o/dyld.h>
22992 #include <stdio.h>
22993 #include <stdlib.h>
22994 #include <sys/param.h>
22995 #include <string.h>
22996
22997 int
22998 main(int argc, char **argv) {
22999     char buf[1];
23000     uint32_t size = sizeof(buf);
23001     int result;
23002     char *buffer;
23003     char *tidied;
23004     char *argv_leaf = strrchr(argv[0], '/');
23005     char *tidied_leaf;
23006
23007     if (!argv_leaf) {
23008         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
23009         return 1;
23010     }
23011
23012     _NSGetExecutablePath(buf, &size);
23013     if (size > MAXPATHLEN * MAXPATHLEN) {
23014         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
23015                 (unsigned int) size);
23016         return 2;
23017     }
23018
23019     buffer = malloc(size);
23020     if (!buffer) {
23021         perror("malloc");
23022         return 3;
23023     }
23024
23025     result = _NSGetExecutablePath(buffer, &size);
23026     if (result != 0) {
23027         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
23028                 result, (unsigned int) size);
23029         return 4;
23030     }
23031
23032     tidied = realpath(buffer, NULL);
23033     if (!tidied) {
23034         perror("realpath");
23035         return 5;
23036     }
23037
23038     free(buffer);
23039
23040     if (*tidied != '/') {
23041         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
23042         return 6;
23043     }
23044
23045     if (strstr(tidied, "/./")) {
23046         fprintf(stderr, "Contains /./: '%s'\n", tidied);
23047         return 7;
23048     }
23049
23050     if (strstr(tidied, "/../")) {
23051         fprintf(stderr, "Contains /../: '%s'\n", tidied);
23052         return 8;
23053     }
23054
23055     tidied_leaf = strrchr(tidied, '/');
23056     if (strcmp(tidied_leaf, argv_leaf) != 0) {
23057         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
23058         return 9;
23059     }
23060
23061     free(tidied);
23062
23063     return 0;
23064 }
23065 EOM
23066
23067 val=$undef
23068 set try
23069 if eval $compile; then
23070         if $run ./try; then
23071                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
23072                 val="$define"
23073         else
23074                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
23075         fi
23076 else
23077         echo "I'm unable to compile the test program." >&4
23078         echo "I'll assume no _NSGetExecutablePath here." >&4
23079 fi
23080 $rm_try
23081 set usensgetexecutablepath
23082 eval $setvar
23083
23084 : Check if site customization support was requested
23085 case "$usesitecustomize" in
23086     $define|true|[Yy]*)
23087         usesitecustomize="$define"
23088         ;;
23089     *)
23090         usesitecustomize="$undef"
23091         ;;
23092     esac
23093
23094 : see if prototypes support variable argument declarations
23095 echo " "
23096 case "$prototype$i_stdarg" in
23097 $define$define)
23098         echo "It appears we'll be able to prototype varargs functions." >&4
23099         val="$define"
23100         ;;
23101 *)
23102         echo "Too bad... We won't be using prototyped varargs functions..." >&4
23103         val="$undef"
23104         ;;
23105 esac
23106 set vaproto
23107 eval $setvar
23108
23109 : determine compiler compiler
23110 case "$yacc" in
23111 '')
23112         dflt=yacc;;
23113 *)
23114         dflt="$yacc";;
23115 esac
23116 echo " "
23117 comp='yacc'
23118 if $test -f "$byacc$_exe"; then
23119         dflt="$byacc"
23120         comp="byacc or $comp"
23121 fi
23122 if $test -f "$bison$_exe"; then
23123         comp="$comp or bison -y"
23124 fi
23125 rp="Which compiler compiler ($comp) shall I use?"
23126 . ./myread
23127 yacc="$ans"
23128 case "$yacc" in
23129 *bis*)
23130         case "$yacc" in
23131         *-y*) ;;
23132         *)
23133                 yacc="$yacc -y"
23134                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
23135                 ;;
23136         esac
23137         ;;
23138 esac
23139
23140 : see if this is a assert.h system
23141 set assert.h i_assert
23142 eval $inhdr
23143
23144 : see if this is a bfd.h system
23145 set bfd.h i_bfd
23146 eval $inhdr
23147
23148 : see if this is an execinfo.h system
23149 set execinfo.h i_execinfo
23150 eval $inhdr
23151
23152 : see if this is a fenv.h system
23153 set fenv.h i_fenv
23154 eval $inhdr
23155
23156 : see if this is a fp.h system
23157 set fp.h i_fp
23158 eval $inhdr
23159
23160 : see if this is a fp_class.h system
23161 set fp_class.h i_fp_class
23162 eval $inhdr
23163
23164 : see if gdbm.h is available
23165 set gdbm.h t_gdbm
23166 eval $inhdr
23167 case "$t_gdbm" in
23168 $define)
23169         : see if gdbm_open exists
23170         set gdbm_open d_gdbm_open
23171         eval $inlibc
23172         case "$d_gdbm_open" in
23173         $undef)
23174                 t_gdbm="$undef"
23175                 echo "We won't be including <gdbm.h>"
23176                 ;;
23177         esac
23178         ;;
23179 esac
23180 val="$t_gdbm"
23181 set i_gdbm
23182 eval $setvar
23183
23184 : see if this is a ieeefp.h system
23185 case "$i_ieeefp" in
23186 '' ) set ieeefp.h i_ieeefp
23187      eval $inhdr
23188      ;;
23189 esac
23190
23191 : see if this is a libutil.h system
23192 set libutil.h i_libutil
23193 eval $inhdr
23194
23195 : see if mach cthreads are available
23196 if test "X$usethreads" = "X$define"; then
23197         set mach/cthreads.h i_machcthr
23198         eval $inhdr
23199 else
23200         i_machcthr="$undef"
23201 fi
23202
23203 : see if this is a mntent.h system
23204 set mntent.h i_mntent
23205 eval $inhdr
23206
23207 : see if net/errno.h is available
23208 val=''
23209 set net/errno.h val
23210 eval $inhdr
23211
23212 : Unfortunately, it causes problems on some systems.  Arrgh.
23213 case "$val" in
23214 $define)
23215         cat > try.c <<'EOM'
23216 #include <stdio.h>
23217 #include <errno.h>
23218 #include <net/errno.h>
23219 int func()
23220 {
23221         return ENOTSOCK;
23222 }
23223 EOM
23224         if $cc $ccflags -c try.c >/dev/null 2>&1; then
23225                 echo "We'll be including <net/errno.h>." >&4
23226         else
23227                 echo "We won't be including <net/errno.h>." >&4
23228                 val="$undef"
23229         fi
23230         $rm_try
23231         ;;
23232 esac
23233 set i_neterrno
23234 eval $setvar
23235
23236 : see if netinet/tcp.h is available
23237 set netinet/tcp.h i_netinettcp
23238 eval $inhdr
23239
23240 : see if this is a poll.h system
23241 set poll.h i_poll
23242 eval $inhdr
23243
23244 : see if this is a prot.h system
23245 set prot.h i_prot
23246 eval $inhdr
23247
23248 : Preprocessor symbols
23249 echo " "
23250 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
23251 $cat <<'EOSH' > Cppsym.know
23252 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
23253 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
23254 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
23255 arch_pwr ardent ARM ARM32 atarist att386 att3b
23256 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
23257 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
23258 byteorder byte_order
23259 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
23260 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
23261 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
23262 ELF encore EPI EXTENSIONS
23263 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
23264 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
23265 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
23266 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
23267 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400 hp9000s500
23268 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
23269 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
23270 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
23271 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
23272 ksr1
23273 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
23274 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
23275 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
23276 luna88k Lynx
23277 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
23278 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
23279 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
23280 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
23281 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
23282 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
23283 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
23284 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
23285 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
23286 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
23287 ns32000 ns32016 ns32332 ns32k nsc32000
23288 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23289 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23290 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23291 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23292 QK_USER QNX
23293 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23294 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23295 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23296 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23297 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23298 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23299 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23300 SYSV4 SYSV5 sysV68 sysV88
23301 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23302 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23303 tower32_800 tower32_850 tss
23304 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23305 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23306 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23307 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23308 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23309 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23310 uxpm uxps
23311 vax venix VMESA vms
23312 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23313 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23314 z8000 zarch
23315 EOSH
23316 # Maybe put other stuff here too.
23317 ./tr '-' '_' <<EOSH >>Cppsym.know
23318 $osname
23319 EOSH
23320 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23321 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23322 $cat Cppsym.know > Cppsym.c
23323 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23324 $rm -f Cppsym.a Cppsym.b Cppsym.c
23325 cat <<EOSH > Cppsym
23326 $startsh
23327 if $test \$# -gt 0; then
23328     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23329     if $test -s Cppsym.got; then
23330         $rm -f Cppsym.got
23331         exit 0
23332     fi
23333     $rm -f Cppsym.got
23334     exit 1
23335 else
23336     $tr " " "$trnl" | ./Cppsym.try
23337     exit 0
23338 fi
23339 EOSH
23340 chmod +x Cppsym
23341 $eunicefix Cppsym
23342 cat <<EOSH > Cppsym.try
23343 $startsh
23344 cat <<'EOCP' > try.c
23345 #include <stdio.h>
23346 #if cpp_stuff == 1
23347 #define STRINGIFY(a)    "a"
23348 #endif
23349 #if cpp_stuff == 42
23350 #define StGiFy(a)  #a
23351 #define STRINGIFY(a)    StGiFy(a)
23352 #endif
23353 #if $cpp_stuff != 1 && $cpp_stuff != 42
23354 #   include "Bletch: How does this C preprocessor stringify macros?"
23355 #endif
23356 int main() {
23357 EOCP
23358 $awk \\
23359 EOSH
23360 cat <<'EOSH' >> Cppsym.try
23361 'length($1) > 0 {
23362     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23363     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23364     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23365     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23366 }'       >> try.c
23367 echo 'return 0;}' >> try.c
23368 EOSH
23369 cat <<EOSH >> Cppsym.try
23370 ccflags="$ccflags"
23371 case "$osname-$gccversion" in
23372 irix-) ccflags="\$ccflags -woff 1178" ;;
23373 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
23374 esac
23375 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
23376 EOSH
23377 chmod +x Cppsym.try
23378 $eunicefix Cppsym.try
23379 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
23380 : Add in any Linux cpp "predefined macros":
23381 case "$osname::$gccversion" in
23382   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
23383     tHdrH=_tmpHdr
23384     rm -f $tHdrH'.h' $tHdrH
23385     touch $tHdrH'.h'
23386     # Filter out macro arguments, such as Linux's __INT8_C(c)
23387     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
23388        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
23389        if [ -s $tHdrH'_cppsym.real' ]; then
23390           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
23391        fi
23392     fi
23393     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
23394   ;;
23395 esac
23396 : now check the C compiler for additional symbols
23397 postprocess_cc_v=''
23398 case "$osname" in
23399 aix) postprocess_cc_v="|$tr , ' '" ;;
23400 esac
23401 $cat >ccsym <<EOS
23402 $startsh
23403 $cat >tmp.c <<EOF
23404 extern int foo;
23405 EOF
23406 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
23407 do
23408         case "\$i" in
23409         -D*) echo "\$i" | $sed 's/^-D//';;
23410         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
23411         esac
23412 done
23413 $rm_try
23414 EOS
23415 postprocess_cc_v=''
23416 chmod +x ccsym
23417 $eunicefix ccsym
23418 ./ccsym > ccsym1.raw
23419 if $test -s ccsym1.raw; then
23420     $sort ccsym1.raw | $uniq >ccsym.raw
23421 else
23422     mv ccsym1.raw ccsym.raw
23423 fi
23424
23425 $awk '/\=/ { print $0; next }
23426         { print $0"=1" }' ccsym.raw >ccsym.list
23427 $comm -13 Cppsym.true ccsym.list >ccsym.own
23428 $comm -12 Cppsym.true ccsym.list >ccsym.com
23429 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
23430 also=''
23431 if $test -z ccsym.raw; then
23432         echo "Your C compiler doesn't seem to define any symbols!" >&4
23433         echo " "
23434         echo "However, your C preprocessor defines the following symbols:"
23435         $cat Cppsym.true
23436         ccsymbols=''
23437         cppsymbols=`$cat Cppsym.true`
23438         cppsymbols=`echo $cppsymbols`
23439         cppccsymbols="$cppsymbols"
23440 else
23441         if $test -s ccsym.com; then
23442                 echo "Your C compiler and pre-processor define these symbols:"
23443                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
23444                 also='also '
23445                 symbols='ones'
23446                 cppccsymbols=`$cat ccsym.com`
23447                 cppccsymbols=`echo $cppccsymbols`
23448                 $test "$silent" || sleep 1
23449         fi
23450         if $test -s ccsym.cpp; then
23451                 $test "$also" && echo " "
23452                 echo "Your C pre-processor ${also}defines the following symbols:"
23453                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
23454                 also='further '
23455                 cppsymbols=`$cat ccsym.cpp`
23456                 cppsymbols=`echo $cppsymbols`
23457                 $test "$silent" || sleep 1
23458         fi
23459         if $test -s ccsym.own; then
23460                 $test "$also" && echo " "
23461                 echo "Your C compiler ${also}defines the following cpp symbols:"
23462                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
23463                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
23464                 ccsymbols=`$cat ccsym.own`
23465                 ccsymbols=`echo $ccsymbols`
23466                 $test "$silent" || sleep 1
23467         fi
23468 fi
23469
23470 : add -D_FORTIFY_SOURCE if feasible and not already there
23471 case "$gccversion" in
23472 [45].*) case "$optimize$ccflags" in
23473         *-O*)   case "$ccflags$cppsymbols" in
23474                 *_FORTIFY_SOURCE=*) # Don't add it again.
23475                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
23476                         ;;
23477                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
23478                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
23479                         ;;
23480                 esac
23481                 ;;
23482         *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
23483                 ;;
23484         esac
23485         ;;
23486 *)      echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
23487         ;;
23488 esac
23489
23490 : see if this is a termio system
23491 val="$undef"
23492 val2="$undef"
23493 val3="$undef"
23494 if $test `./findhdr termios.h`; then
23495     set tcsetattr i_termios
23496     eval $inlibc
23497     val3="$i_termios"
23498 fi
23499 echo " "
23500 case "$val3" in
23501     "$define") echo "You have POSIX termios.h... good!" >&4;;
23502     *)  if ./Cppsym pyr; then
23503             case "`$run /bin/universe`" in
23504                 ucb) if $test `./findhdr sgtty.h`; then
23505                         val2="$define"
23506                         echo "<sgtty.h> found." >&4
23507                     else
23508                         echo "System is pyramid with BSD universe."
23509                         ./warn "<sgtty.h> not found--you could have problems."
23510                     fi;;
23511                 *)  if $test `./findhdr termio.h`; then
23512                         val="$define"
23513                         echo "<termio.h> found." >&4
23514                     else
23515                         echo "System is pyramid with USG universe."
23516                         ./warn "<termio.h> not found--you could have problems."
23517                     fi;;
23518             esac
23519         elif ./usg; then
23520             if $test `./findhdr termio.h`; then
23521                 echo "<termio.h> found." >&4
23522                 val="$define"
23523             elif $test `./findhdr sgtty.h`; then
23524                 echo "<sgtty.h> found." >&4
23525                 val2="$define"
23526             else
23527                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23528             fi
23529         else
23530             if $test `./findhdr sgtty.h`; then
23531                 echo "<sgtty.h> found." >&4
23532                 val2="$define"
23533             elif $test `./findhdr termio.h`; then
23534                 echo "<termio.h> found." >&4
23535                 val="$define"
23536             else
23537                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23538             fi
23539         fi;;
23540 esac
23541 set i_termio; eval $setvar
23542 val=$val2; set i_sgtty; eval $setvar
23543 val=$val3; set i_termios; eval $setvar
23544
23545 : see if stdbool is available
23546 : we want a real compile instead of Inhdr because some Solaris systems
23547 : have stdbool.h, but it can only be used if the compiler indicates it
23548 : is sufficiently c99-compliant.
23549 echo " "
23550 $cat >try.c <<EOCP
23551 #include <stdio.h>
23552 #include <stdbool.h>
23553 int func(bool x)
23554 {
23555     return x ? 1 : 0;
23556 }
23557 int main(int argc, char **argv)
23558 {
23559     return func(0);
23560 }
23561 EOCP
23562 set try
23563 if eval $compile; then
23564         echo "<stdbool.h> found." >&4
23565         val="$define"
23566 else
23567         echo "<stdbool.h> NOT found." >&4
23568         val="$undef"
23569 fi
23570 $rm_try
23571 set i_stdbool
23572 eval $setvar
23573
23574 : see if stddef is available
23575 set stddef.h i_stddef
23576 eval $inhdr
23577
23578 : see if stdint is available
23579 set stdint.h i_stdint
23580 eval $inhdr
23581
23582 : see if sys/access.h is available
23583 set sys/access.h i_sysaccess
23584 eval $inhdr
23585
23586 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23587 set sys/filio.h i_sysfilio
23588 eval $inhdr
23589 echo " "
23590 if $test `./findhdr sys/ioctl.h`; then
23591         val="$define"
23592         echo '<sys/ioctl.h> found.' >&4
23593 else
23594         val="$undef"
23595         if $test $i_sysfilio = "$define"; then
23596             echo '<sys/ioctl.h> NOT found.' >&4
23597         else
23598                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23599                 $test $i_termio = "$define" && xxx="termio.h"
23600                 $test $i_termios = "$define" && xxx="termios.h"
23601 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23602         fi
23603 fi
23604 set i_sysioctl
23605 eval $setvar
23606
23607 : see if socket ioctl defs are in sys/sockio.h
23608 echo " "
23609 xxx=`./findhdr sys/sockio.h`
23610 if $test "$xxx"; then
23611         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23612                 val="$define"
23613                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23614         else
23615                 val="$undef"
23616                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23617         fi
23618 else
23619         val="$undef"
23620         $cat <<EOM
23621 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23622 EOM
23623 fi
23624 set i_syssockio
23625 eval $setvar
23626
23627 : see if this is a syslog.h system
23628 set syslog.h i_syslog
23629 eval $inhdr
23630
23631 : see if this is a sys/mode.h system
23632 set sys/mode.h i_sysmode
23633 eval $inhdr
23634
23635 : see if there is a sys/poll.h file
23636 set sys/poll.h i_syspoll
23637 eval $inhdr
23638
23639 : see if sys/resource.h has to be included
23640 set sys/resource.h i_sysresrc
23641 eval $inhdr
23642
23643 : see if sys/security.h is available
23644 set sys/security.h i_syssecrt
23645 eval $inhdr
23646
23647 : see if this is a sys/statvfs.h system
23648 set sys/statvfs.h i_sysstatvfs
23649 eval $inhdr
23650
23651 : see if this is a sys/un.h system
23652 set sys/un.h i_sysun
23653 eval $inhdr
23654
23655 : see if this is a sys/utsname.h system
23656 set sys/utsname.h i_sysutsname
23657 eval $inhdr
23658
23659 : see if this is a syswait system
23660 set sys/wait.h i_syswait
23661 eval $inhdr
23662
23663 : see if this is a ustat.h system
23664 set ustat.h i_ustat
23665 eval $inhdr
23666
23667 : see if this is an utime system
23668 set utime.h i_utime
23669 eval $inhdr
23670
23671 : see if this is a vfork system
23672 case "$d_vfork" in
23673 "$define")
23674         set vfork.h i_vfork
23675         eval $inhdr
23676         ;;
23677 *)
23678         i_vfork="$undef"
23679         ;;
23680 esac
23681
23682 : Check extensions
23683 echo " "
23684 echo "Looking for extensions..." >&4
23685 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23686 : contain old or inaccurate or duplicate values.
23687 nonxs_extensions=''
23688 xs_extensions=''
23689 : We do not use find because it might not be available.
23690 : We do not just use MANIFEST because the user may have dropped
23691 : some additional extensions into the source tree and expect them
23692 : to be built.
23693
23694 : Function to recursively find available extensions, ignoring DynaLoader
23695 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23696 : In 5.10.1 and later, extensions are stored in directories
23697 : like File-Glob instead of the older File/Glob/.
23698 find_extensions='
23699     for xxx in *; do
23700         case "$xxx" in
23701             DynaLoader|dynaload) ;;
23702             *)
23703             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23704             case "$this_ext" in
23705                 Scalar/List/Utils) this_ext="List/Util" ;;
23706                 PathTools)         this_ext="Cwd"       ;;
23707             esac;
23708             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23709             if $contains " $this_ext " "$tdir/$$.tmp"; then
23710                 echo >&4;
23711                 echo "Duplicate directories detected for extension $xxx" >&4;
23712                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23713                 case "$knowitall" in
23714                 "") dflt=y;;
23715                 *) dflt=n;;
23716                 esac;
23717                 . ../UU/myread;
23718                 case "$ans" in
23719                 n*|N*) ;;
23720                 *) echo >&4;
23721                     echo "Ok.  Stopping Configure." >&4;
23722                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23723                     exit 1;;
23724                 esac;
23725                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23726             fi;
23727             $ls -1 "$xxx" > "$tdir/$$.tmp";
23728             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23729                 xs_extensions="$xs_extensions $this_ext";
23730             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
23731                 xs_extensions="$xs_extensions $this_ext";
23732             elif $test -d "$xxx"; then
23733                 nonxs_extensions="$nonxs_extensions $this_ext";
23734             fi;
23735             $rm -f "$tdir/$$.tmp";
23736             ;;
23737         esac;
23738     done'
23739 tdir=`pwd`
23740 cd "$rsrc/cpan"
23741 set X
23742 shift
23743 eval $find_extensions
23744 cd "$rsrc/dist"
23745 set X
23746 shift
23747 eval $find_extensions
23748 cd "$rsrc/ext"
23749 set X
23750 shift
23751 eval $find_extensions
23752 set X $xs_extensions
23753 shift
23754 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23755 set X $nonxs_extensions
23756 shift
23757 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23758 cd "$tdir"
23759 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23760
23761 : Now see which are supported on this system.
23762 avail_ext=''
23763 for xxx in $xs_extensions ; do
23764         case "$xxx" in
23765         Amiga*)
23766                 case "$osname" in
23767                 amigaos) avail_ext="$avail_ext $xxx" ;;
23768                 esac
23769                 ;;
23770         DB_File|db_file)
23771                 case "$i_db" in
23772                 $define) avail_ext="$avail_ext $xxx" ;;
23773                 esac
23774                 ;;
23775         GDBM_File|gdbm_fil)
23776                 case "$i_gdbm" in
23777                 $define) avail_ext="$avail_ext $xxx" ;;
23778                 esac
23779                 ;;
23780         I18N/Langinfo|i18n_lan)
23781                 case "$i_langinfo$d_nl_langinfo" in
23782                 $define$define) avail_ext="$avail_ext $xxx" ;;
23783                 esac
23784                 ;;
23785         IPC/SysV|ipc/sysv)
23786                 : XXX Do we need a useipcsysv variable here
23787                 case "${d_msg}${d_sem}${d_shm}" in
23788                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23789                 esac
23790                 ;;
23791         NDBM_File|ndbm_fil)
23792                 case "$d_ndbm" in
23793                 $define)
23794                     case "$osname-$use64bitint" in
23795                     hpux-define)
23796                         case "$libs" in
23797                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23798                         esac
23799                         ;;
23800                     *) avail_ext="$avail_ext $xxx" ;;
23801                     esac
23802                     ;;
23803                 esac
23804                 ;;
23805         ODBM_File|odbm_fil)
23806                 case "${i_dbm}${i_rpcsvcdbm}" in
23807                 *"${define}"*)
23808                     case "$d_cplusplus" in
23809                     define) ;; # delete as a function name will not work
23810                     *)  case "$osname-$use64bitint" in
23811                         hpux-define)
23812                             case "$libs" in
23813                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23814                             esac
23815                             ;;
23816                         *) avail_ext="$avail_ext $xxx" ;;
23817                         esac
23818                         ;;
23819                     esac
23820                     ;;
23821                 esac
23822                 ;;
23823         Opcode|opcode)
23824                 case "$useopcode" in
23825                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23826                 esac
23827                 ;;
23828         POSIX|posix)
23829                 case "$useposix" in
23830                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23831                 esac
23832                 ;;
23833         Socket|socket)
23834                 case "$d_socket" in
23835                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23836                 esac
23837                 ;;
23838         Sys/Syslog|sys/syslog)
23839                 case $osname in
23840                         amigaos) ;; # not really very useful on AmigaOS
23841                         *)
23842                         : XXX syslog requires socket
23843                         case "$d_socket" in
23844                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
23845                         esac
23846                         ;;
23847                 esac
23848                 ;;
23849         Thread|thread)
23850                 case "$usethreads" in
23851                 true|$define|y)
23852                         case "$use5005threads" in
23853                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23854                         esac
23855                 esac
23856                 ;;
23857         threads|threads/shared)
23858                 # threads and threads::shared are special cases.
23859                 # To stop people from asking "Perl 5.8.0 was supposed
23860                 # to have this new fancy threads implementation but my
23861                 # perl doesn't have it" and from people trying to
23862                 # (re)install the threads module using CPAN.pm and
23863                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23864                 # the threads.pm and threads/shared.pm will always be
23865                 # there, croaking informatively ("you need to rebuild
23866                 # all of Perl with threads, sorry") when threads haven't
23867                 # been compiled in.
23868                 # --jhi
23869                 avail_ext="$avail_ext $xxx"
23870                 ;;
23871         VMS*)
23872                 ;;
23873         Win32*)
23874                 case "$osname" in
23875                 cygwin) avail_ext="$avail_ext $xxx" ;;
23876                 esac
23877                 ;;
23878         XS/APItest|xs/apitest)
23879                 # This is just for testing.  Skip it unless we have dynamic loading.
23880
23881                 case "$usedl" in
23882                 $define) avail_ext="$avail_ext $xxx" ;;
23883                 esac
23884                 ;;
23885         XS/Typemap|xs/typemap)
23886                 # This is just for testing.  Skip it unless we have dynamic loading.
23887                 case "$usedl" in
23888                 $define) avail_ext="$avail_ext $xxx" ;;
23889                 esac
23890                 ;;
23891         *)      avail_ext="$avail_ext $xxx"
23892                 ;;
23893         esac
23894 done
23895
23896 set X $avail_ext
23897 shift
23898 avail_ext="$*"
23899
23900 case "$onlyextensions" in
23901 '') ;;
23902 *)  keepextensions=''
23903     echo "You have requested that only certain extensions be included..." >&4
23904     for i in $onlyextensions; do
23905         case " $avail_ext " in
23906         *" $i "*)
23907             echo "Keeping extension $i."
23908             keepextensions="$keepextensions $i"
23909             ;;
23910         *) echo "Ignoring extension $i." ;;
23911         esac
23912     done
23913     avail_ext="$keepextensions"
23914     ;;
23915 esac
23916
23917 case "$noextensions" in
23918 '') ;;
23919 *)  keepextensions=''
23920     echo "You have requested that certain extensions be ignored..." >&4
23921     for i in $avail_ext; do
23922         case " $noextensions " in
23923         *" $i "*) echo "Ignoring extension $i." ;;
23924         *) echo "Keeping extension $i.";
23925            keepextensions="$keepextensions $i"
23926            ;;
23927         esac
23928     done
23929     avail_ext="$keepextensions"
23930     ;;
23931 esac
23932
23933 : Now see which nonxs extensions are supported on this system.
23934 : For now assume all are.
23935 nonxs_ext=''
23936 for xxx in $nonxs_extensions ; do
23937         case "$xxx" in
23938         VMS*)
23939                 ;;
23940         *)      nonxs_ext="$nonxs_ext $xxx"
23941                 ;;
23942         esac
23943 done
23944
23945 set X $nonxs_ext
23946 shift
23947 nonxs_ext="$*"
23948
23949 case $usedl in
23950 $define)
23951         $cat <<EOM
23952 A number of extensions are supplied with $package.  You may choose to
23953 compile these extensions for dynamic loading (the default), compile
23954 them into the $package executable (static loading), or not include
23955 them at all.  Answer "none" to include no extensions.
23956 Note that DynaLoader is always built and need not be mentioned here.
23957
23958 EOM
23959         case "$dynamic_ext" in
23960         '')
23961                 : Exclude those listed in static_ext
23962                 dflt=''
23963                 for xxx in $avail_ext; do
23964                         case " $static_ext " in
23965                         *" $xxx "*) ;;
23966                         *) dflt="$dflt $xxx" ;;
23967                         esac
23968                 done
23969                 set X $dflt
23970                 shift
23971                 dflt="$*"
23972                 ;;
23973         *)      dflt="$dynamic_ext"
23974                 # Perhaps we are reusing an old out-of-date config.sh.
23975                 case "$hint" in
23976                 previous)
23977                         if test X"$dynamic_ext" != X"$avail_ext"; then
23978                                 $cat <<EOM
23979 NOTICE:  Your previous config.sh list may be incorrect.
23980 The extensions now available to you are
23981         ${avail_ext}
23982 but the default list from your previous config.sh is
23983         ${dynamic_ext}
23984
23985 EOM
23986                         fi
23987                         ;;
23988                 esac
23989                 ;;
23990         esac
23991         case "$dflt" in
23992         '')     dflt=none;;
23993         esac
23994         rp="What extensions do you wish to load dynamically?"
23995         . ./myread
23996         case "$ans" in
23997         none) dynamic_ext=' ' ;;
23998         *) dynamic_ext="$ans" ;;
23999         esac
24000
24001         case "$static_ext" in
24002         '')
24003                 : Exclude those already listed in dynamic linking
24004                 dflt=''
24005                 for xxx in $avail_ext; do
24006                         case " $dynamic_ext " in
24007                         *" $xxx "*) ;;
24008                         *) dflt="$dflt $xxx" ;;
24009                         esac
24010                 done
24011                 set X $dflt
24012                 shift
24013                 dflt="$*"
24014                 ;;
24015         *)  dflt="$static_ext"
24016                 ;;
24017         esac
24018
24019         case "$dflt" in
24020         '')     dflt=none;;
24021         esac
24022         rp="What extensions do you wish to load statically?"
24023         . ./myread
24024         case "$ans" in
24025         none) static_ext=' ' ;;
24026         *) static_ext="$ans" ;;
24027         esac
24028         ;;
24029 *)
24030         $cat <<EOM
24031 A number of extensions are supplied with $package.  Answer "none"
24032 to include no extensions.
24033 Note that DynaLoader is always built and need not be mentioned here.
24034
24035 EOM
24036         case "$static_ext" in
24037         '') dflt="$avail_ext" ;;
24038         *)      dflt="$static_ext"
24039                 # Perhaps we are reusing an old out-of-date config.sh.
24040                 case "$hint" in
24041                 previous)
24042                         if test X"$static_ext" != X"$avail_ext"; then
24043                                 $cat <<EOM
24044 NOTICE:  Your previous config.sh list may be incorrect.
24045 The extensions now available to you are
24046         ${avail_ext}
24047 but the default list from your previous config.sh is
24048         ${static_ext}
24049
24050 EOM
24051                         fi
24052                         ;;
24053                 esac
24054                 ;;
24055         esac
24056         : Exclude those that are not xs extensions
24057         case "$dflt" in
24058         '')     dflt=none;;
24059         esac
24060         rp="What extensions do you wish to include?"
24061         . ./myread
24062         case "$ans" in
24063         none) static_ext=' ' ;;
24064         *) static_ext="$ans" ;;
24065         esac
24066         ;;
24067 esac
24068 #
24069 # Encode is a special case.  If we are building Encode as a static
24070 # extension, we need to explicitly list its subextensions as well.
24071 # For other nested extensions, this is handled automatically by
24072 # the appropriate Makefile.PL.
24073 case " $static_ext " in
24074         *" Encode "*) # Add the subextensions of Encode
24075         cd "$rsrc/cpan"
24076         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
24077                 static_ext="$static_ext Encode/$xxx"
24078                 known_extensions="$known_extensions Encode/$xxx"
24079         done
24080         cd "$tdir"
24081         ;;
24082 esac
24083
24084 set X $dynamic_ext $static_ext $nonxs_ext
24085 shift
24086 extensions="$*"
24087
24088 # Sanity check:  We require an extension suitable for use with
24089 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
24090 # should show up as failures in the test suite, but it's helpful to
24091 # catch them now.) The 'extensions' list is normally sorted
24092 # alphabetically, so we need to accept either
24093 #    DB_File ... Fcntl ... IO  ....
24094 # or something like
24095 #    Fcntl ... NDBM_File ... IO  ....
24096 case " $extensions"  in
24097 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
24098 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
24099 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
24100 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
24101    echo "WARNING: The Perl you are building will be quite crippled." >& 4
24102    ;;
24103 esac
24104
24105 : Remove libraries needed only for extensions
24106 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
24107 : The exception is SunOS 4.x, which needs them.
24108 case "${osname}X${osvers}" in
24109 sunos*X4*)
24110     perllibs="$libs"
24111     ;;
24112 *) case "$usedl" in
24113     $define|true|[yY]*)
24114             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
24115             shift
24116             perllibs="$*"
24117             ;;
24118     *)  perllibs="$libs"
24119             ;;
24120     esac
24121     ;;
24122 esac
24123
24124 : Remove build directory name from cppstdin so it can be used from
24125 : either the present location or the final installed location.
24126 echo " "
24127 : Get out of the UU directory to get correct path name.
24128 cd ..
24129 case "$cppstdin" in
24130 `pwd`/cppstdin)
24131         echo "Stripping down cppstdin path name"
24132         cppstdin=cppstdin
24133         ;;
24134 esac
24135 cd UU
24136
24137 : end of configuration questions
24138 echo " "
24139 echo "End of configuration questions."
24140 echo " "
24141
24142 : back to where it started
24143 if test -d ../UU; then
24144         cd ..
24145 fi
24146
24147 : configuration may be unconditionally patched via a 'config.arch' file
24148 if $test -f config.arch; then
24149         echo "I see a config.arch file, loading it." >&4
24150         . ./config.arch
24151 fi
24152
24153 : configuration may be patched via a 'config.over' file
24154 if $test -f config.over; then
24155         echo " "
24156         dflt=y
24157         rp='I see a config.over file.  Do you wish to load it?'
24158         . UU/myread
24159         case "$ans" in
24160         n*) echo "OK, I'll ignore it.";;
24161         *)      . ./config.over
24162                 echo "Configuration override changes have been loaded."
24163                 ;;
24164         esac
24165 fi
24166
24167 : in case they want portability, strip down executable paths
24168 case "$d_portable" in
24169 "$define")
24170         echo " "
24171         echo "Stripping down executable paths..." >&4
24172         for file in $loclist $trylist; do
24173                 eval temp=\$$file
24174                 eval $file=`basename $temp`
24175         done
24176         ;;
24177 esac
24178
24179 : create config.sh file
24180 echo " "
24181 echo "Creating config.sh..." >&4
24182 $spitshell <<EOT >config.sh
24183 $startsh
24184 #
24185 # This file was produced by running the Configure script. It holds all the
24186 # definitions figured out by Configure. Should you modify one of these values,
24187 # do not forget to propagate your changes by running "Configure -der". You may
24188 # instead choose to run each of the .SH files by yourself, or "Configure -S".
24189 #
24190
24191 # Package name      : $package
24192 # Source directory  : $src
24193 # Configuration time: $cf_time
24194 # Configured by     : $cf_by
24195 # Target system     : $myuname
24196
24197 EOT
24198 : Add in command line options if available
24199 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
24200
24201 $spitshell <<EOT >>config.sh
24202
24203 Author='$Author'
24204 Date='$Date'
24205 Header='$Header'
24206 Id='$Id'
24207 Locker='$Locker'
24208 Log='$Log'
24209 RCSfile='$RCSfile'
24210 Revision='$Revision'
24211 Source='$Source'
24212 State='$State'
24213 _a='$_a'
24214 _exe='$_exe'
24215 _o='$_o'
24216 afs='$afs'
24217 afsroot='$afsroot'
24218 alignbytes='$alignbytes'
24219 ansi2knr='$ansi2knr'
24220 aphostname='$aphostname'
24221 api_revision='$api_revision'
24222 api_subversion='$api_subversion'
24223 api_version='$api_version'
24224 api_versionstring='$api_versionstring'
24225 ar='$ar'
24226 archlib='$archlib'
24227 archlibexp='$archlibexp'
24228 archname64='$archname64'
24229 archname='$archname'
24230 archobjs='$archobjs'
24231 asctime_r_proto='$asctime_r_proto'
24232 awk='$awk'
24233 baserev='$baserev'
24234 bash='$bash'
24235 bin='$bin'
24236 bin_ELF='$bin_ELF'
24237 binexp='$binexp'
24238 bison='$bison'
24239 byacc='$byacc'
24240 byteorder='$byteorder'
24241 c='$c'
24242 castflags='$castflags'
24243 cat='$cat'
24244 cc='$cc'
24245 cccdlflags='$cccdlflags'
24246 ccdlflags='$ccdlflags'
24247 ccflags='$ccflags'
24248 ccflags_uselargefiles='$ccflags_uselargefiles'
24249 ccname='$ccname'
24250 ccsymbols='$ccsymbols'
24251 ccversion='$ccversion'
24252 cf_by='$cf_by'
24253 cf_email='$cf_email'
24254 cf_time='$cf_time'
24255 charbits='$charbits'
24256 charsize='$charsize'
24257 chgrp='$chgrp'
24258 chmod='$chmod'
24259 chown='$chown'
24260 clocktype='$clocktype'
24261 comm='$comm'
24262 compress='$compress'
24263 contains='$contains'
24264 cp='$cp'
24265 cpio='$cpio'
24266 cpp='$cpp'
24267 cpp_stuff='$cpp_stuff'
24268 cppccsymbols='$cppccsymbols'
24269 cppflags='$cppflags'
24270 cpplast='$cpplast'
24271 cppminus='$cppminus'
24272 cpprun='$cpprun'
24273 cppstdin='$cppstdin'
24274 cppsymbols='$cppsymbols'
24275 crypt_r_proto='$crypt_r_proto'
24276 cryptlib='$cryptlib'
24277 csh='$csh'
24278 ctermid_r_proto='$ctermid_r_proto'
24279 ctime_r_proto='$ctime_r_proto'
24280 d_Gconvert='$d_Gconvert'
24281 d_PRIEUldbl='$d_PRIEUldbl'
24282 d_PRIFUldbl='$d_PRIFUldbl'
24283 d_PRIGUldbl='$d_PRIGUldbl'
24284 d_PRIXU64='$d_PRIXU64'
24285 d_PRId64='$d_PRId64'
24286 d_PRIeldbl='$d_PRIeldbl'
24287 d_PRIfldbl='$d_PRIfldbl'
24288 d_PRIgldbl='$d_PRIgldbl'
24289 d_PRIi64='$d_PRIi64'
24290 d_PRIo64='$d_PRIo64'
24291 d_PRIu64='$d_PRIu64'
24292 d_PRIx64='$d_PRIx64'
24293 d_SCNfldbl='$d_SCNfldbl'
24294 d__fwalk='$d__fwalk'
24295 d_access='$d_access'
24296 d_accessx='$d_accessx'
24297 d_acosh='$d_acosh'
24298 d_aintl='$d_aintl'
24299 d_alarm='$d_alarm'
24300 d_archlib='$d_archlib'
24301 d_asctime64='$d_asctime64'
24302 d_asctime_r='$d_asctime_r'
24303 d_asinh='$d_asinh'
24304 d_atanh='$d_atanh'
24305 d_atolf='$d_atolf'
24306 d_atoll='$d_atoll'
24307 d_attribute_deprecated='$d_attribute_deprecated'
24308 d_attribute_format='$d_attribute_format'
24309 d_attribute_malloc='$d_attribute_malloc'
24310 d_attribute_nonnull='$d_attribute_nonnull'
24311 d_attribute_noreturn='$d_attribute_noreturn'
24312 d_attribute_pure='$d_attribute_pure'
24313 d_attribute_unused='$d_attribute_unused'
24314 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24315 d_backtrace='$d_backtrace'
24316 d_bcmp='$d_bcmp'
24317 d_bcopy='$d_bcopy'
24318 d_bsd='$d_bsd'
24319 d_bsdgetpgrp='$d_bsdgetpgrp'
24320 d_bsdsetpgrp='$d_bsdsetpgrp'
24321 d_builtin_choose_expr='$d_builtin_choose_expr'
24322 d_builtin_expect='$d_builtin_expect'
24323 d_bzero='$d_bzero'
24324 d_c99_variadic_macros='$d_c99_variadic_macros'
24325 d_casti32='$d_casti32'
24326 d_castneg='$d_castneg'
24327 d_cbrt='$d_cbrt'
24328 d_charvspr='$d_charvspr'
24329 d_chown='$d_chown'
24330 d_chroot='$d_chroot'
24331 d_chsize='$d_chsize'
24332 d_class='$d_class'
24333 d_clearenv='$d_clearenv'
24334 d_closedir='$d_closedir'
24335 d_cmsghdr_s='$d_cmsghdr_s'
24336 d_const='$d_const'
24337 d_copysign='$d_copysign'
24338 d_copysignl='$d_copysignl'
24339 d_cplusplus='$d_cplusplus'
24340 d_crypt='$d_crypt'
24341 d_crypt_r='$d_crypt_r'
24342 d_csh='$d_csh'
24343 d_ctermid='$d_ctermid'
24344 d_ctermid_r='$d_ctermid_r'
24345 d_ctime64='$d_ctime64'
24346 d_ctime_r='$d_ctime_r'
24347 d_cuserid='$d_cuserid'
24348 d_dbl_dig='$d_dbl_dig'
24349 d_dbminitproto='$d_dbminitproto'
24350 d_difftime64='$d_difftime64'
24351 d_difftime='$d_difftime'
24352 d_dir_dd_fd='$d_dir_dd_fd'
24353 d_dirfd='$d_dirfd'
24354 d_dirnamlen='$d_dirnamlen'
24355 d_dladdr='$d_dladdr'
24356 d_dlerror='$d_dlerror'
24357 d_dlopen='$d_dlopen'
24358 d_dlsymun='$d_dlsymun'
24359 d_dosuid='$d_dosuid'
24360 d_drand48_r='$d_drand48_r'
24361 d_drand48proto='$d_drand48proto'
24362 d_dup2='$d_dup2'
24363 d_duplocale='$d_duplocale'
24364 d_eaccess='$d_eaccess'
24365 d_endgrent='$d_endgrent'
24366 d_endgrent_r='$d_endgrent_r'
24367 d_endhent='$d_endhent'
24368 d_endhostent_r='$d_endhostent_r'
24369 d_endnent='$d_endnent'
24370 d_endnetent_r='$d_endnetent_r'
24371 d_endpent='$d_endpent'
24372 d_endprotoent_r='$d_endprotoent_r'
24373 d_endpwent='$d_endpwent'
24374 d_endpwent_r='$d_endpwent_r'
24375 d_endsent='$d_endsent'
24376 d_endservent_r='$d_endservent_r'
24377 d_eofnblk='$d_eofnblk'
24378 d_erf='$d_erf'
24379 d_erfc='$d_erfc'
24380 d_eunice='$d_eunice'
24381 d_exp2='$d_exp2'
24382 d_expm1='$d_expm1'
24383 d_faststdio='$d_faststdio'
24384 d_fchdir='$d_fchdir'
24385 d_fchmod='$d_fchmod'
24386 d_fchown='$d_fchown'
24387 d_fcntl='$d_fcntl'
24388 d_fcntl_can_lock='$d_fcntl_can_lock'
24389 d_fd_macros='$d_fd_macros'
24390 d_fd_set='$d_fd_set'
24391 d_fdclose='$d_fdclose'
24392 d_fdim='$d_fdim'
24393 d_fds_bits='$d_fds_bits'
24394 d_fegetround='$d_fegetround'
24395 d_fgetpos='$d_fgetpos'
24396 d_finite='$d_finite'
24397 d_finitel='$d_finitel'
24398 d_flexfnam='$d_flexfnam'
24399 d_flock='$d_flock'
24400 d_flockproto='$d_flockproto'
24401 d_fma='$d_fma'
24402 d_fmax='$d_fmax'
24403 d_fmin='$d_fmin'
24404 d_fork='$d_fork'
24405 d_fp_class='$d_fp_class'
24406 d_fp_classify='$d_fp_classify'
24407 d_fp_classl='$d_fp_classl'
24408 d_fpathconf='$d_fpathconf'
24409 d_fpclass='$d_fpclass'
24410 d_fpclassify='$d_fpclassify'
24411 d_fpclassl='$d_fpclassl'
24412 d_fpgetround='$d_fpgetround'
24413 d_fpos64_t='$d_fpos64_t'
24414 d_freelocale='$d_freelocale'
24415 d_frexpl='$d_frexpl'
24416 d_fs_data_s='$d_fs_data_s'
24417 d_fseeko='$d_fseeko'
24418 d_fsetpos='$d_fsetpos'
24419 d_fstatfs='$d_fstatfs'
24420 d_fstatvfs='$d_fstatvfs'
24421 d_fsync='$d_fsync'
24422 d_ftello='$d_ftello'
24423 d_ftime='$d_ftime'
24424 d_futimes='$d_futimes'
24425 d_gai_strerror='$d_gai_strerror'
24426 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
24427 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
24428 d_getaddrinfo='$d_getaddrinfo'
24429 d_getcwd='$d_getcwd'
24430 d_getespwnam='$d_getespwnam'
24431 d_getfsstat='$d_getfsstat'
24432 d_getgrent='$d_getgrent'
24433 d_getgrent_r='$d_getgrent_r'
24434 d_getgrgid_r='$d_getgrgid_r'
24435 d_getgrnam_r='$d_getgrnam_r'
24436 d_getgrps='$d_getgrps'
24437 d_gethbyaddr='$d_gethbyaddr'
24438 d_gethbyname='$d_gethbyname'
24439 d_gethent='$d_gethent'
24440 d_gethname='$d_gethname'
24441 d_gethostbyaddr_r='$d_gethostbyaddr_r'
24442 d_gethostbyname_r='$d_gethostbyname_r'
24443 d_gethostent_r='$d_gethostent_r'
24444 d_gethostprotos='$d_gethostprotos'
24445 d_getitimer='$d_getitimer'
24446 d_getlogin='$d_getlogin'
24447 d_getlogin_r='$d_getlogin_r'
24448 d_getmnt='$d_getmnt'
24449 d_getmntent='$d_getmntent'
24450 d_getnameinfo='$d_getnameinfo'
24451 d_getnbyaddr='$d_getnbyaddr'
24452 d_getnbyname='$d_getnbyname'
24453 d_getnent='$d_getnent'
24454 d_getnetbyaddr_r='$d_getnetbyaddr_r'
24455 d_getnetbyname_r='$d_getnetbyname_r'
24456 d_getnetent_r='$d_getnetent_r'
24457 d_getnetprotos='$d_getnetprotos'
24458 d_getpagsz='$d_getpagsz'
24459 d_getpbyname='$d_getpbyname'
24460 d_getpbynumber='$d_getpbynumber'
24461 d_getpent='$d_getpent'
24462 d_getpgid='$d_getpgid'
24463 d_getpgrp2='$d_getpgrp2'
24464 d_getpgrp='$d_getpgrp'
24465 d_getppid='$d_getppid'
24466 d_getprior='$d_getprior'
24467 d_getprotobyname_r='$d_getprotobyname_r'
24468 d_getprotobynumber_r='$d_getprotobynumber_r'
24469 d_getprotoent_r='$d_getprotoent_r'
24470 d_getprotoprotos='$d_getprotoprotos'
24471 d_getprpwnam='$d_getprpwnam'
24472 d_getpwent='$d_getpwent'
24473 d_getpwent_r='$d_getpwent_r'
24474 d_getpwnam_r='$d_getpwnam_r'
24475 d_getpwuid_r='$d_getpwuid_r'
24476 d_getsbyname='$d_getsbyname'
24477 d_getsbyport='$d_getsbyport'
24478 d_getsent='$d_getsent'
24479 d_getservbyname_r='$d_getservbyname_r'
24480 d_getservbyport_r='$d_getservbyport_r'
24481 d_getservent_r='$d_getservent_r'
24482 d_getservprotos='$d_getservprotos'
24483 d_getspnam='$d_getspnam'
24484 d_getspnam_r='$d_getspnam_r'
24485 d_gettimeod='$d_gettimeod'
24486 d_gmtime64='$d_gmtime64'
24487 d_gmtime_r='$d_gmtime_r'
24488 d_gnulibc='$d_gnulibc'
24489 d_grpasswd='$d_grpasswd'
24490 d_hasmntopt='$d_hasmntopt'
24491 d_htonl='$d_htonl'
24492 d_hypot='$d_hypot'
24493 d_ilogb='$d_ilogb'
24494 d_ilogbl='$d_ilogbl'
24495 d_inc_version_list='$d_inc_version_list'
24496 d_index='$d_index'
24497 d_inetaton='$d_inetaton'
24498 d_inetntop='$d_inetntop'
24499 d_inetpton='$d_inetpton'
24500 d_int64_t='$d_int64_t'
24501 d_ip_mreq='$d_ip_mreq'
24502 d_ip_mreq_source='$d_ip_mreq_source'
24503 d_ipv6_mreq='$d_ipv6_mreq'
24504 d_ipv6_mreq_source='$d_ipv6_mreq_source'
24505 d_isascii='$d_isascii'
24506 d_isblank='$d_isblank'
24507 d_isfinite='$d_isfinite'
24508 d_isfinitel='$d_isfinitel'
24509 d_isinf='$d_isinf'
24510 d_isinfl='$d_isinfl'
24511 d_isless='$d_isless'
24512 d_isnan='$d_isnan'
24513 d_isnanl='$d_isnanl'
24514 d_isnormal='$d_isnormal'
24515 d_j0='$d_j0'
24516 d_j0l='$d_j0l'
24517 d_killpg='$d_killpg'
24518 d_lc_monetary_2008='$d_lc_monetary_2008'
24519 d_lchown='$d_lchown'
24520 d_ldbl_dig='$d_ldbl_dig'
24521 d_ldexpl='$d_ldexpl'
24522 d_lgamma='$d_lgamma'
24523 d_lgamma_r='$d_lgamma_r'
24524 d_libm_lib_version='$d_libm_lib_version'
24525 d_libname_unique='$d_libname_unique'
24526 d_link='$d_link'
24527 d_llrint='$d_llrint'
24528 d_llrintl='$d_llrintl'
24529 d_llround='$d_llround'
24530 d_llroundl='$d_llroundl'
24531 d_localtime64='$d_localtime64'
24532 d_localtime_r='$d_localtime_r'
24533 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24534 d_locconv='$d_locconv'
24535 d_lockf='$d_lockf'
24536 d_log1p='$d_log1p'
24537 d_log2='$d_log2'
24538 d_logb='$d_logb'
24539 d_longdbl='$d_longdbl'
24540 d_longlong='$d_longlong'
24541 d_lrint='$d_lrint'
24542 d_lrintl='$d_lrintl'
24543 d_lround='$d_lround'
24544 d_lroundl='$d_lroundl'
24545 d_lseekproto='$d_lseekproto'
24546 d_lstat='$d_lstat'
24547 d_madvise='$d_madvise'
24548 d_malloc_good_size='$d_malloc_good_size'
24549 d_malloc_size='$d_malloc_size'
24550 d_mblen='$d_mblen'
24551 d_mbstowcs='$d_mbstowcs'
24552 d_mbtowc='$d_mbtowc'
24553 d_memchr='$d_memchr'
24554 d_memcmp='$d_memcmp'
24555 d_memcpy='$d_memcpy'
24556 d_memmem='$d_memmem'
24557 d_memmove='$d_memmove'
24558 d_memset='$d_memset'
24559 d_mkdir='$d_mkdir'
24560 d_mkdtemp='$d_mkdtemp'
24561 d_mkfifo='$d_mkfifo'
24562 d_mkstemp='$d_mkstemp'
24563 d_mkstemps='$d_mkstemps'
24564 d_mktime64='$d_mktime64'
24565 d_mktime='$d_mktime'
24566 d_mmap='$d_mmap'
24567 d_modfl='$d_modfl'
24568 d_modflproto='$d_modflproto'
24569 d_mprotect='$d_mprotect'
24570 d_msg='$d_msg'
24571 d_msg_ctrunc='$d_msg_ctrunc'
24572 d_msg_dontroute='$d_msg_dontroute'
24573 d_msg_oob='$d_msg_oob'
24574 d_msg_peek='$d_msg_peek'
24575 d_msg_proxy='$d_msg_proxy'
24576 d_msgctl='$d_msgctl'
24577 d_msgget='$d_msgget'
24578 d_msghdr_s='$d_msghdr_s'
24579 d_msgrcv='$d_msgrcv'
24580 d_msgsnd='$d_msgsnd'
24581 d_msync='$d_msync'
24582 d_munmap='$d_munmap'
24583 d_mymalloc='$d_mymalloc'
24584 d_nan='$d_nan'
24585 d_ndbm='$d_ndbm'
24586 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24587 d_nearbyint='$d_nearbyint'
24588 d_newlocale='$d_newlocale'
24589 d_nextafter='$d_nextafter'
24590 d_nexttoward='$d_nexttoward'
24591 d_nice='$d_nice'
24592 d_nl_langinfo='$d_nl_langinfo'
24593 d_nv_preserves_uv='$d_nv_preserves_uv'
24594 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24595 d_off64_t='$d_off64_t'
24596 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24597 d_oldpthreads='$d_oldpthreads'
24598 d_oldsock='$d_oldsock'
24599 d_open3='$d_open3'
24600 d_pathconf='$d_pathconf'
24601 d_pause='$d_pause'
24602 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24603 d_phostname='$d_phostname'
24604 d_pipe='$d_pipe'
24605 d_poll='$d_poll'
24606 d_portable='$d_portable'
24607 d_prctl='$d_prctl'
24608 d_prctl_set_name='$d_prctl_set_name'
24609 d_printf_format_null='$d_printf_format_null'
24610 d_procselfexe='$d_procselfexe'
24611 d_pseudofork='$d_pseudofork'
24612 d_pthread_atfork='$d_pthread_atfork'
24613 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24614 d_pthread_yield='$d_pthread_yield'
24615 d_ptrdiff_t='$d_ptrdiff_t'
24616 d_pwage='$d_pwage'
24617 d_pwchange='$d_pwchange'
24618 d_pwclass='$d_pwclass'
24619 d_pwcomment='$d_pwcomment'
24620 d_pwexpire='$d_pwexpire'
24621 d_pwgecos='$d_pwgecos'
24622 d_pwpasswd='$d_pwpasswd'
24623 d_pwquota='$d_pwquota'
24624 d_qgcvt='$d_qgcvt'
24625 d_quad='$d_quad'
24626 d_querylocale='$d_querylocale'
24627 d_random_r='$d_random_r'
24628 d_re_comp='$d_re_comp'
24629 d_readdir64_r='$d_readdir64_r'
24630 d_readdir='$d_readdir'
24631 d_readdir_r='$d_readdir_r'
24632 d_readlink='$d_readlink'
24633 d_readv='$d_readv'
24634 d_recvmsg='$d_recvmsg'
24635 d_regcmp='$d_regcmp'
24636 d_regcomp='$d_regcomp'
24637 d_remainder='$d_remainder'
24638 d_remquo='$d_remquo'
24639 d_rename='$d_rename'
24640 d_rewinddir='$d_rewinddir'
24641 d_rint='$d_rint'
24642 d_rmdir='$d_rmdir'
24643 d_round='$d_round'
24644 d_safebcpy='$d_safebcpy'
24645 d_safemcpy='$d_safemcpy'
24646 d_sanemcmp='$d_sanemcmp'
24647 d_sbrkproto='$d_sbrkproto'
24648 d_scalbn='$d_scalbn'
24649 d_scalbnl='$d_scalbnl'
24650 d_sched_yield='$d_sched_yield'
24651 d_scm_rights='$d_scm_rights'
24652 d_seekdir='$d_seekdir'
24653 d_select='$d_select'
24654 d_sem='$d_sem'
24655 d_semctl='$d_semctl'
24656 d_semctl_semid_ds='$d_semctl_semid_ds'
24657 d_semctl_semun='$d_semctl_semun'
24658 d_semget='$d_semget'
24659 d_semop='$d_semop'
24660 d_sendmsg='$d_sendmsg'
24661 d_setegid='$d_setegid'
24662 d_seteuid='$d_seteuid'
24663 d_setgrent='$d_setgrent'
24664 d_setgrent_r='$d_setgrent_r'
24665 d_setgrps='$d_setgrps'
24666 d_sethent='$d_sethent'
24667 d_sethostent_r='$d_sethostent_r'
24668 d_setitimer='$d_setitimer'
24669 d_setlinebuf='$d_setlinebuf'
24670 d_setlocale='$d_setlocale'
24671 d_setlocale_r='$d_setlocale_r'
24672 d_setnent='$d_setnent'
24673 d_setnetent_r='$d_setnetent_r'
24674 d_setpent='$d_setpent'
24675 d_setpgid='$d_setpgid'
24676 d_setpgrp2='$d_setpgrp2'
24677 d_setpgrp='$d_setpgrp'
24678 d_setprior='$d_setprior'
24679 d_setproctitle='$d_setproctitle'
24680 d_setprotoent_r='$d_setprotoent_r'
24681 d_setpwent='$d_setpwent'
24682 d_setpwent_r='$d_setpwent_r'
24683 d_setregid='$d_setregid'
24684 d_setresgid='$d_setresgid'
24685 d_setresuid='$d_setresuid'
24686 d_setreuid='$d_setreuid'
24687 d_setrgid='$d_setrgid'
24688 d_setruid='$d_setruid'
24689 d_setsent='$d_setsent'
24690 d_setservent_r='$d_setservent_r'
24691 d_setsid='$d_setsid'
24692 d_setvbuf='$d_setvbuf'
24693 d_shm='$d_shm'
24694 d_shmat='$d_shmat'
24695 d_shmatprototype='$d_shmatprototype'
24696 d_shmctl='$d_shmctl'
24697 d_shmdt='$d_shmdt'
24698 d_shmget='$d_shmget'
24699 d_sigaction='$d_sigaction'
24700 d_siginfo_si_addr='$d_siginfo_si_addr'
24701 d_siginfo_si_band='$d_siginfo_si_band'
24702 d_siginfo_si_errno='$d_siginfo_si_errno'
24703 d_siginfo_si_fd='$d_siginfo_si_fd'
24704 d_siginfo_si_pid='$d_siginfo_si_pid'
24705 d_siginfo_si_status='$d_siginfo_si_status'
24706 d_siginfo_si_uid='$d_siginfo_si_uid'
24707 d_siginfo_si_value='$d_siginfo_si_value'
24708 d_signbit='$d_signbit'
24709 d_sigprocmask='$d_sigprocmask'
24710 d_sigsetjmp='$d_sigsetjmp'
24711 d_sin6_scope_id='$d_sin6_scope_id'
24712 d_sitearch='$d_sitearch'
24713 d_snprintf='$d_snprintf'
24714 d_sockaddr_in6='$d_sockaddr_in6'
24715 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24716 d_sockatmark='$d_sockatmark'
24717 d_sockatmarkproto='$d_sockatmarkproto'
24718 d_socket='$d_socket'
24719 d_socklen_t='$d_socklen_t'
24720 d_sockpair='$d_sockpair'
24721 d_socks5_init='$d_socks5_init'
24722 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
24723 d_sqrtl='$d_sqrtl'
24724 d_srand48_r='$d_srand48_r'
24725 d_srandom_r='$d_srandom_r'
24726 d_sresgproto='$d_sresgproto'
24727 d_sresuproto='$d_sresuproto'
24728 d_stat='$d_stat'
24729 d_statblks='$d_statblks'
24730 d_statfs_f_flags='$d_statfs_f_flags'
24731 d_statfs_s='$d_statfs_s'
24732 d_static_inline='$d_static_inline'
24733 d_statvfs='$d_statvfs'
24734 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24735 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24736 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24737 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24738 d_stdio_stream_array='$d_stdio_stream_array'
24739 d_stdiobase='$d_stdiobase'
24740 d_stdstdio='$d_stdstdio'
24741 d_strchr='$d_strchr'
24742 d_strcoll='$d_strcoll'
24743 d_strctcpy='$d_strctcpy'
24744 d_strerrm='$d_strerrm'
24745 d_strerror='$d_strerror'
24746 d_strerror_l='$d_strerror_l'
24747 d_strerror_r='$d_strerror_r'
24748 d_strftime='$d_strftime'
24749 d_strlcat='$d_strlcat'
24750 d_strlcpy='$d_strlcpy'
24751 d_strtod='$d_strtod'
24752 d_strtol='$d_strtol'
24753 d_strtold='$d_strtold'
24754 d_strtoll='$d_strtoll'
24755 d_strtoq='$d_strtoq'
24756 d_strtoul='$d_strtoul'
24757 d_strtoull='$d_strtoull'
24758 d_strtouq='$d_strtouq'
24759 d_strxfrm='$d_strxfrm'
24760 d_suidsafe='$d_suidsafe'
24761 d_symlink='$d_symlink'
24762 d_syscall='$d_syscall'
24763 d_syscallproto='$d_syscallproto'
24764 d_sysconf='$d_sysconf'
24765 d_sysernlst='$d_sysernlst'
24766 d_syserrlst='$d_syserrlst'
24767 d_system='$d_system'
24768 d_tcgetpgrp='$d_tcgetpgrp'
24769 d_tcsetpgrp='$d_tcsetpgrp'
24770 d_telldir='$d_telldir'
24771 d_telldirproto='$d_telldirproto'
24772 d_tgamma='$d_tgamma'
24773 d_time='$d_time'
24774 d_timegm='$d_timegm'
24775 d_times='$d_times'
24776 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24777 d_tm_tm_zone='$d_tm_tm_zone'
24778 d_tmpnam_r='$d_tmpnam_r'
24779 d_trunc='$d_trunc'
24780 d_truncate='$d_truncate'
24781 d_truncl='$d_truncl'
24782 d_ttyname_r='$d_ttyname_r'
24783 d_tzname='$d_tzname'
24784 d_u32align='$d_u32align'
24785 d_ualarm='$d_ualarm'
24786 d_umask='$d_umask'
24787 d_uname='$d_uname'
24788 d_union_semun='$d_union_semun'
24789 d_unordered='$d_unordered'
24790 d_unsetenv='$d_unsetenv'
24791 d_uselocale='$d_uselocale'
24792 d_usleep='$d_usleep'
24793 d_usleepproto='$d_usleepproto'
24794 d_ustat='$d_ustat'
24795 d_vendorarch='$d_vendorarch'
24796 d_vendorbin='$d_vendorbin'
24797 d_vendorlib='$d_vendorlib'
24798 d_vendorscript='$d_vendorscript'
24799 d_vfork='$d_vfork'
24800 d_void_closedir='$d_void_closedir'
24801 d_voidsig='$d_voidsig'
24802 d_voidtty='$d_voidtty'
24803 d_volatile='$d_volatile'
24804 d_vprintf='$d_vprintf'
24805 d_vsnprintf='$d_vsnprintf'
24806 d_wait4='$d_wait4'
24807 d_waitpid='$d_waitpid'
24808 d_wcscmp='$d_wcscmp'
24809 d_wcstombs='$d_wcstombs'
24810 d_wcsxfrm='$d_wcsxfrm'
24811 d_wctomb='$d_wctomb'
24812 d_writev='$d_writev'
24813 d_xenix='$d_xenix'
24814 date='$date'
24815 db_hashtype='$db_hashtype'
24816 db_prefixtype='$db_prefixtype'
24817 db_version_major='$db_version_major'
24818 db_version_minor='$db_version_minor'
24819 db_version_patch='$db_version_patch'
24820 direntrytype='$direntrytype'
24821 dlext='$dlext'
24822 dlsrc='$dlsrc'
24823 doubleinfbytes='$doubleinfbytes'
24824 doublekind='$doublekind'
24825 doublemantbits='$doublemantbits'
24826 doublenanbytes='$doublenanbytes'
24827 doublesize='$doublesize'
24828 drand01='$drand01'
24829 drand48_r_proto='$drand48_r_proto'
24830 dtrace='$dtrace'
24831 dtraceobject='$dtraceobject'
24832 dynamic_ext='$dynamic_ext'
24833 eagain='$eagain'
24834 ebcdic='$ebcdic'
24835 echo='$echo'
24836 egrep='$egrep'
24837 emacs='$emacs'
24838 endgrent_r_proto='$endgrent_r_proto'
24839 endhostent_r_proto='$endhostent_r_proto'
24840 endnetent_r_proto='$endnetent_r_proto'
24841 endprotoent_r_proto='$endprotoent_r_proto'
24842 endpwent_r_proto='$endpwent_r_proto'
24843 endservent_r_proto='$endservent_r_proto'
24844 eunicefix='$eunicefix'
24845 exe_ext='$exe_ext'
24846 expr='$expr'
24847 extensions='$extensions'
24848 extern_C='$extern_C'
24849 extras='$extras'
24850 fflushNULL='$fflushNULL'
24851 fflushall='$fflushall'
24852 find='$find'
24853 firstmakefile='$firstmakefile'
24854 flex='$flex'
24855 fpossize='$fpossize'
24856 fpostype='$fpostype'
24857 freetype='$freetype'
24858 from='$from'
24859 full_ar='$full_ar'
24860 full_csh='$full_csh'
24861 full_sed='$full_sed'
24862 gccansipedantic='$gccansipedantic'
24863 gccosandvers='$gccosandvers'
24864 gccversion='$gccversion'
24865 getgrent_r_proto='$getgrent_r_proto'
24866 getgrgid_r_proto='$getgrgid_r_proto'
24867 getgrnam_r_proto='$getgrnam_r_proto'
24868 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24869 gethostbyname_r_proto='$gethostbyname_r_proto'
24870 gethostent_r_proto='$gethostent_r_proto'
24871 getlogin_r_proto='$getlogin_r_proto'
24872 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24873 getnetbyname_r_proto='$getnetbyname_r_proto'
24874 getnetent_r_proto='$getnetent_r_proto'
24875 getprotobyname_r_proto='$getprotobyname_r_proto'
24876 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24877 getprotoent_r_proto='$getprotoent_r_proto'
24878 getpwent_r_proto='$getpwent_r_proto'
24879 getpwnam_r_proto='$getpwnam_r_proto'
24880 getpwuid_r_proto='$getpwuid_r_proto'
24881 getservbyname_r_proto='$getservbyname_r_proto'
24882 getservbyport_r_proto='$getservbyport_r_proto'
24883 getservent_r_proto='$getservent_r_proto'
24884 getspnam_r_proto='$getspnam_r_proto'
24885 gidformat='$gidformat'
24886 gidsign='$gidsign'
24887 gidsize='$gidsize'
24888 gidtype='$gidtype'
24889 glibpth='$glibpth'
24890 gmake='$gmake'
24891 gmtime_r_proto='$gmtime_r_proto'
24892 gnulibc_version='$gnulibc_version'
24893 grep='$grep'
24894 groupcat='$groupcat'
24895 groupstype='$groupstype'
24896 gzip='$gzip'
24897 h_fcntl='$h_fcntl'
24898 h_sysfile='$h_sysfile'
24899 hint='$hint'
24900 hostcat='$hostcat'
24901 hostgenerate='$hostgenerate'
24902 hostosname='$hostosname'
24903 hostperl='$hostperl'
24904 html1dir='$html1dir'
24905 html1direxp='$html1direxp'
24906 html3dir='$html3dir'
24907 html3direxp='$html3direxp'
24908 i16size='$i16size'
24909 i16type='$i16type'
24910 i32size='$i32size'
24911 i32type='$i32type'
24912 i64size='$i64size'
24913 i64type='$i64type'
24914 i8size='$i8size'
24915 i8type='$i8type'
24916 i_arpainet='$i_arpainet'
24917 i_assert='$i_assert'
24918 i_bfd='$i_bfd'
24919 i_bsdioctl='$i_bsdioctl'
24920 i_crypt='$i_crypt'
24921 i_db='$i_db'
24922 i_dbm='$i_dbm'
24923 i_dirent='$i_dirent'
24924 i_dlfcn='$i_dlfcn'
24925 i_execinfo='$i_execinfo'
24926 i_fcntl='$i_fcntl'
24927 i_fenv='$i_fenv'
24928 i_float='$i_float'
24929 i_fp='$i_fp'
24930 i_fp_class='$i_fp_class'
24931 i_gdbm='$i_gdbm'
24932 i_gdbm_ndbm='$i_gdbm_ndbm'
24933 i_gdbmndbm='$i_gdbmndbm'
24934 i_grp='$i_grp'
24935 i_ieeefp='$i_ieeefp'
24936 i_inttypes='$i_inttypes'
24937 i_langinfo='$i_langinfo'
24938 i_libutil='$i_libutil'
24939 i_limits='$i_limits'
24940 i_locale='$i_locale'
24941 i_machcthr='$i_machcthr'
24942 i_malloc='$i_malloc'
24943 i_mallocmalloc='$i_mallocmalloc'
24944 i_math='$i_math'
24945 i_memory='$i_memory'
24946 i_mntent='$i_mntent'
24947 i_ndbm='$i_ndbm'
24948 i_netdb='$i_netdb'
24949 i_neterrno='$i_neterrno'
24950 i_netinettcp='$i_netinettcp'
24951 i_niin='$i_niin'
24952 i_poll='$i_poll'
24953 i_prot='$i_prot'
24954 i_pthread='$i_pthread'
24955 i_pwd='$i_pwd'
24956 i_quadmath='$i_quadmath'
24957 i_rpcsvcdbm='$i_rpcsvcdbm'
24958 i_sgtty='$i_sgtty'
24959 i_shadow='$i_shadow'
24960 i_socks='$i_socks'
24961 i_stdarg='$i_stdarg'
24962 i_stdbool='$i_stdbool'
24963 i_stddef='$i_stddef'
24964 i_stdint='$i_stdint'
24965 i_stdlib='$i_stdlib'
24966 i_string='$i_string'
24967 i_sunmath='$i_sunmath'
24968 i_sysaccess='$i_sysaccess'
24969 i_sysdir='$i_sysdir'
24970 i_sysfile='$i_sysfile'
24971 i_sysfilio='$i_sysfilio'
24972 i_sysin='$i_sysin'
24973 i_sysioctl='$i_sysioctl'
24974 i_syslog='$i_syslog'
24975 i_sysmman='$i_sysmman'
24976 i_sysmode='$i_sysmode'
24977 i_sysmount='$i_sysmount'
24978 i_sysndir='$i_sysndir'
24979 i_sysparam='$i_sysparam'
24980 i_syspoll='$i_syspoll'
24981 i_sysresrc='$i_sysresrc'
24982 i_syssecrt='$i_syssecrt'
24983 i_sysselct='$i_sysselct'
24984 i_syssockio='$i_syssockio'
24985 i_sysstat='$i_sysstat'
24986 i_sysstatfs='$i_sysstatfs'
24987 i_sysstatvfs='$i_sysstatvfs'
24988 i_systime='$i_systime'
24989 i_systimek='$i_systimek'
24990 i_systimes='$i_systimes'
24991 i_systypes='$i_systypes'
24992 i_sysuio='$i_sysuio'
24993 i_sysun='$i_sysun'
24994 i_sysutsname='$i_sysutsname'
24995 i_sysvfs='$i_sysvfs'
24996 i_syswait='$i_syswait'
24997 i_termio='$i_termio'
24998 i_termios='$i_termios'
24999 i_time='$i_time'
25000 i_unistd='$i_unistd'
25001 i_ustat='$i_ustat'
25002 i_utime='$i_utime'
25003 i_values='$i_values'
25004 i_varargs='$i_varargs'
25005 i_varhdr='$i_varhdr'
25006 i_vfork='$i_vfork'
25007 i_xlocale='$i_xlocale'
25008 ignore_versioned_solibs='$ignore_versioned_solibs'
25009 inc_version_list='$inc_version_list'
25010 inc_version_list_init='$inc_version_list_init'
25011 incpath='$incpath'
25012 incpth='$incpth'
25013 inews='$inews'
25014 initialinstalllocation='$initialinstalllocation'
25015 installarchlib='$installarchlib'
25016 installbin='$installbin'
25017 installhtml1dir='$installhtml1dir'
25018 installhtml3dir='$installhtml3dir'
25019 installman1dir='$installman1dir'
25020 installman3dir='$installman3dir'
25021 installprefix='$installprefix'
25022 installprefixexp='$installprefixexp'
25023 installprivlib='$installprivlib'
25024 installscript='$installscript'
25025 installsitearch='$installsitearch'
25026 installsitebin='$installsitebin'
25027 installsitehtml1dir='$installsitehtml1dir'
25028 installsitehtml3dir='$installsitehtml3dir'
25029 installsitelib='$installsitelib'
25030 installsiteman1dir='$installsiteman1dir'
25031 installsiteman3dir='$installsiteman3dir'
25032 installsitescript='$installsitescript'
25033 installstyle='$installstyle'
25034 installusrbinperl='$installusrbinperl'
25035 installvendorarch='$installvendorarch'
25036 installvendorbin='$installvendorbin'
25037 installvendorhtml1dir='$installvendorhtml1dir'
25038 installvendorhtml3dir='$installvendorhtml3dir'
25039 installvendorlib='$installvendorlib'
25040 installvendorman1dir='$installvendorman1dir'
25041 installvendorman3dir='$installvendorman3dir'
25042 installvendorscript='$installvendorscript'
25043 intsize='$intsize'
25044 issymlink='$issymlink'
25045 ivdformat='$ivdformat'
25046 ivsize='$ivsize'
25047 ivtype='$ivtype'
25048 known_extensions='$known_extensions'
25049 ksh='$ksh'
25050 ld='$ld'
25051 ld_can_script='$ld_can_script'
25052 lddlflags='$lddlflags'
25053 ldflags='$ldflags'
25054 ldflags_uselargefiles='$ldflags_uselargefiles'
25055 ldlibpthname='$ldlibpthname'
25056 less='$less'
25057 lib_ext='$lib_ext'
25058 libc='$libc'
25059 libperl='$libperl'
25060 libpth='$libpth'
25061 libs='$libs'
25062 libsdirs='$libsdirs'
25063 libsfiles='$libsfiles'
25064 libsfound='$libsfound'
25065 libspath='$libspath'
25066 libswanted='$libswanted'
25067 libswanted_uselargefiles='$libswanted_uselargefiles'
25068 line='$line'
25069 lint='$lint'
25070 lkflags='$lkflags'
25071 ln='$ln'
25072 lns='$lns'
25073 localtime_r_proto='$localtime_r_proto'
25074 locincpth='$locincpth'
25075 loclibpth='$loclibpth'
25076 longdblinfbytes='$longdblinfbytes'
25077 longdblkind='$longdblkind'
25078 longdblmantbits='$longdblmantbits'
25079 longdblnanbytes='$longdblnanbytes'
25080 longdblsize='$longdblsize'
25081 longlongsize='$longlongsize'
25082 longsize='$longsize'
25083 lp='$lp'
25084 lpr='$lpr'
25085 ls='$ls'
25086 lseeksize='$lseeksize'
25087 lseektype='$lseektype'
25088 mail='$mail'
25089 mailx='$mailx'
25090 make='$make'
25091 make_set_make='$make_set_make'
25092 mallocobj='$mallocobj'
25093 mallocsrc='$mallocsrc'
25094 malloctype='$malloctype'
25095 man1dir='$man1dir'
25096 man1direxp='$man1direxp'
25097 man1ext='$man1ext'
25098 man3dir='$man3dir'
25099 man3direxp='$man3direxp'
25100 man3ext='$man3ext'
25101 mips_type='$mips_type'
25102 mistrustnm='$mistrustnm'
25103 mkdir='$mkdir'
25104 mmaptype='$mmaptype'
25105 modetype='$modetype'
25106 more='$more'
25107 multiarch='$multiarch'
25108 mv='$mv'
25109 myarchname='$myarchname'
25110 mydomain='$mydomain'
25111 myhostname='$myhostname'
25112 myuname='$myuname'
25113 n='$n'
25114 need_va_copy='$need_va_copy'
25115 netdb_hlen_type='$netdb_hlen_type'
25116 netdb_host_type='$netdb_host_type'
25117 netdb_name_type='$netdb_name_type'
25118 netdb_net_type='$netdb_net_type'
25119 nm='$nm'
25120 nm_opt='$nm_opt'
25121 nm_so_opt='$nm_so_opt'
25122 nonxs_ext='$nonxs_ext'
25123 nroff='$nroff'
25124 nvEUformat='$nvEUformat'
25125 nvFUformat='$nvFUformat'
25126 nvGUformat='$nvGUformat'
25127 nv_overflows_integers_at='$nv_overflows_integers_at'
25128 nv_preserves_uv_bits='$nv_preserves_uv_bits'
25129 nveformat='$nveformat'
25130 nvfformat='$nvfformat'
25131 nvgformat='$nvgformat'
25132 nvmantbits='$nvmantbits'
25133 nvsize='$nvsize'
25134 nvtype='$nvtype'
25135 o_nonblock='$o_nonblock'
25136 obj_ext='$obj_ext'
25137 old_pthread_create_joinable='$old_pthread_create_joinable'
25138 optimize='$optimize'
25139 orderlib='$orderlib'
25140 osname='$osname'
25141 osvers='$osvers'
25142 otherlibdirs='$otherlibdirs'
25143 package='$package'
25144 pager='$pager'
25145 passcat='$passcat'
25146 patchlevel='$patchlevel'
25147 path_sep='$path_sep'
25148 perl5='$perl5'
25149 perl='$perl'
25150 perl_patchlevel='$perl_patchlevel'
25151 perl_static_inline='$perl_static_inline'
25152 perladmin='$perladmin'
25153 perllibs='$perllibs'
25154 perlpath='$perlpath'
25155 pg='$pg'
25156 phostname='$phostname'
25157 pidtype='$pidtype'
25158 plibpth='$plibpth'
25159 pmake='$pmake'
25160 pr='$pr'
25161 prefix='$prefix'
25162 prefixexp='$prefixexp'
25163 privlib='$privlib'
25164 privlibexp='$privlibexp'
25165 procselfexe='$procselfexe'
25166 prototype='$prototype'
25167 ptrsize='$ptrsize'
25168 quadkind='$quadkind'
25169 quadtype='$quadtype'
25170 randbits='$randbits'
25171 randfunc='$randfunc'
25172 random_r_proto='$random_r_proto'
25173 randseedtype='$randseedtype'
25174 ranlib='$ranlib'
25175 rd_nodata='$rd_nodata'
25176 readdir64_r_proto='$readdir64_r_proto'
25177 readdir_r_proto='$readdir_r_proto'
25178 revision='$revision'
25179 rm='$rm'
25180 rm_try='$rm_try'
25181 rmail='$rmail'
25182 run='$run'
25183 runnm='$runnm'
25184 sGMTIME_max='$sGMTIME_max'
25185 sGMTIME_min='$sGMTIME_min'
25186 sLOCALTIME_max='$sLOCALTIME_max'
25187 sLOCALTIME_min='$sLOCALTIME_min'
25188 sPRIEUldbl='$sPRIEUldbl'
25189 sPRIFUldbl='$sPRIFUldbl'
25190 sPRIGUldbl='$sPRIGUldbl'
25191 sPRIXU64='$sPRIXU64'
25192 sPRId64='$sPRId64'
25193 sPRIeldbl='$sPRIeldbl'
25194 sPRIfldbl='$sPRIfldbl'
25195 sPRIgldbl='$sPRIgldbl'
25196 sPRIi64='$sPRIi64'
25197 sPRIo64='$sPRIo64'
25198 sPRIu64='$sPRIu64'
25199 sPRIx64='$sPRIx64'
25200 sSCNfldbl='$sSCNfldbl'
25201 sched_yield='$sched_yield'
25202 scriptdir='$scriptdir'
25203 scriptdirexp='$scriptdirexp'
25204 sed='$sed'
25205 seedfunc='$seedfunc'
25206 selectminbits='$selectminbits'
25207 selecttype='$selecttype'
25208 sendmail='$sendmail'
25209 setgrent_r_proto='$setgrent_r_proto'
25210 sethostent_r_proto='$sethostent_r_proto'
25211 setlocale_r_proto='$setlocale_r_proto'
25212 setnetent_r_proto='$setnetent_r_proto'
25213 setprotoent_r_proto='$setprotoent_r_proto'
25214 setpwent_r_proto='$setpwent_r_proto'
25215 setservent_r_proto='$setservent_r_proto'
25216 sh='$sh'
25217 shar='$shar'
25218 sharpbang='$sharpbang'
25219 shmattype='$shmattype'
25220 shortsize='$shortsize'
25221 shrpenv='$shrpenv'
25222 shsharp='$shsharp'
25223 sig_count='$sig_count'
25224 sig_name='$sig_name'
25225 sig_name_init='$sig_name_init'
25226 sig_num='$sig_num'
25227 sig_num_init='$sig_num_init'
25228 sig_size='$sig_size'
25229 signal_t='$signal_t'
25230 sitearch='$sitearch'
25231 sitearchexp='$sitearchexp'
25232 sitebin='$sitebin'
25233 sitebinexp='$sitebinexp'
25234 sitehtml1dir='$sitehtml1dir'
25235 sitehtml1direxp='$sitehtml1direxp'
25236 sitehtml3dir='$sitehtml3dir'
25237 sitehtml3direxp='$sitehtml3direxp'
25238 sitelib='$sitelib'
25239 sitelib_stem='$sitelib_stem'
25240 sitelibexp='$sitelibexp'
25241 siteman1dir='$siteman1dir'
25242 siteman1direxp='$siteman1direxp'
25243 siteman3dir='$siteman3dir'
25244 siteman3direxp='$siteman3direxp'
25245 siteprefix='$siteprefix'
25246 siteprefixexp='$siteprefixexp'
25247 sitescript='$sitescript'
25248 sitescriptexp='$sitescriptexp'
25249 sizesize='$sizesize'
25250 sizetype='$sizetype'
25251 sleep='$sleep'
25252 smail='$smail'
25253 so='$so'
25254 sockethdr='$sockethdr'
25255 socketlib='$socketlib'
25256 socksizetype='$socksizetype'
25257 sort='$sort'
25258 spackage='$spackage'
25259 spitshell='$spitshell'
25260 srand48_r_proto='$srand48_r_proto'
25261 srandom_r_proto='$srandom_r_proto'
25262 src='$src'
25263 ssizetype='$ssizetype'
25264 st_ino_sign='$st_ino_sign'
25265 st_ino_size='$st_ino_size'
25266 startperl='$startperl'
25267 startsh='$startsh'
25268 static_ext='$static_ext'
25269 stdchar='$stdchar'
25270 stdio_base='$stdio_base'
25271 stdio_bufsiz='$stdio_bufsiz'
25272 stdio_cnt='$stdio_cnt'
25273 stdio_filbuf='$stdio_filbuf'
25274 stdio_ptr='$stdio_ptr'
25275 stdio_stream_array='$stdio_stream_array'
25276 strerror_r_proto='$strerror_r_proto'
25277 strings='$strings'
25278 submit='$submit'
25279 subversion='$subversion'
25280 sysman='$sysman'
25281 sysroot='$sysroot'
25282 tail='$tail'
25283 tar='$tar'
25284 targetarch='$targetarch'
25285 targetdir='$targetdir'
25286 targetenv='$targetenv'
25287 targethost='$targethost'
25288 targetmkdir='$targetmkdir'
25289 targetport='$targetport'
25290 targetsh='$targetsh'
25291 tbl='$tbl'
25292 tee='$tee'
25293 test='$test'
25294 timeincl='$timeincl'
25295 timetype='$timetype'
25296 tmpnam_r_proto='$tmpnam_r_proto'
25297 to='$to'
25298 touch='$touch'
25299 tr='$tr'
25300 trnl='$trnl'
25301 troff='$troff'
25302 ttyname_r_proto='$ttyname_r_proto'
25303 u16size='$u16size'
25304 u16type='$u16type'
25305 u32size='$u32size'
25306 u32type='$u32type'
25307 u64size='$u64size'
25308 u64type='$u64type'
25309 u8size='$u8size'
25310 u8type='$u8type'
25311 uidformat='$uidformat'
25312 uidsign='$uidsign'
25313 uidsize='$uidsize'
25314 uidtype='$uidtype'
25315 uname='$uname'
25316 uniq='$uniq'
25317 uquadtype='$uquadtype'
25318 use5005threads='$use5005threads'
25319 use64bitall='$use64bitall'
25320 use64bitint='$use64bitint'
25321 usecbacktrace='$usecbacktrace'
25322 usecrosscompile='$usecrosscompile'
25323 usedevel='$usedevel'
25324 usedl='$usedl'
25325 usedtrace='$usedtrace'
25326 usefaststdio='$usefaststdio'
25327 useithreads='$useithreads'
25328 usekernprocpathname='$usekernprocpathname'
25329 uselargefiles='$uselargefiles'
25330 uselongdouble='$uselongdouble'
25331 usemallocwrap='$usemallocwrap'
25332 usemorebits='$usemorebits'
25333 usemultiplicity='$usemultiplicity'
25334 usemymalloc='$usemymalloc'
25335 usenm='$usenm'
25336 usensgetexecutablepath='$usensgetexecutablepath'
25337 useopcode='$useopcode'
25338 useperlio='$useperlio'
25339 useposix='$useposix'
25340 usequadmath='$usequadmath'
25341 usereentrant='$usereentrant'
25342 userelocatableinc='$userelocatableinc'
25343 useshrplib='$useshrplib'
25344 usesitecustomize='$usesitecustomize'
25345 usesocks='$usesocks'
25346 usethreads='$usethreads'
25347 usevendorprefix='$usevendorprefix'
25348 useversionedarchname='$useversionedarchname'
25349 usevfork='$usevfork'
25350 usrinc='$usrinc'
25351 uuname='$uuname'
25352 uvXUformat='$uvXUformat'
25353 uvoformat='$uvoformat'
25354 uvsize='$uvsize'
25355 uvtype='$uvtype'
25356 uvuformat='$uvuformat'
25357 uvxformat='$uvxformat'
25358 vaproto='$vaproto'
25359 vendorarch='$vendorarch'
25360 vendorarchexp='$vendorarchexp'
25361 vendorbin='$vendorbin'
25362 vendorbinexp='$vendorbinexp'
25363 vendorhtml1dir='$vendorhtml1dir'
25364 vendorhtml1direxp='$vendorhtml1direxp'
25365 vendorhtml3dir='$vendorhtml3dir'
25366 vendorhtml3direxp='$vendorhtml3direxp'
25367 vendorlib='$vendorlib'
25368 vendorlib_stem='$vendorlib_stem'
25369 vendorlibexp='$vendorlibexp'
25370 vendorman1dir='$vendorman1dir'
25371 vendorman1direxp='$vendorman1direxp'
25372 vendorman3dir='$vendorman3dir'
25373 vendorman3direxp='$vendorman3direxp'
25374 vendorprefix='$vendorprefix'
25375 vendorprefixexp='$vendorprefixexp'
25376 vendorscript='$vendorscript'
25377 vendorscriptexp='$vendorscriptexp'
25378 version='$version'
25379 version_patchlevel_string='$version_patchlevel_string'
25380 versiononly='$versiononly'
25381 vi='$vi'
25382 xlibpth='$xlibpth'
25383 yacc='$yacc'
25384 yaccflags='$yaccflags'
25385 zcat='$zcat'
25386 zip='$zip'
25387 EOT
25388
25389 : add special variables
25390 $test -f $src/patchlevel.h && \
25391 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
25392 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
25393 echo "PERL_CONFIG_SH=true" >>config.sh
25394
25395 : propagate old symbols
25396 if $test -f UU/config.sh; then
25397         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
25398         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
25399                 config.sh config.sh UU/oldconfig.sh |\
25400                 $sort | $uniq -u >UU/oldsyms
25401         set X `$cat UU/oldsyms`
25402         shift
25403         case $# in
25404         0) ;;
25405         *)
25406                 $cat <<EOM
25407 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
25408 EOM
25409                 echo ": Variables propagated from previous config.sh file." >>config.sh
25410                 for sym in `$cat UU/oldsyms`; do
25411                         echo "    Propagating $hint variable "'$'"$sym..."
25412                         eval 'tmp="$'"${sym}"'"'
25413                         echo "$tmp" | \
25414                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
25415                 done
25416                 ;;
25417         esac
25418 fi
25419
25420 : preserve RCS keywords in files with variable substitution, grrr
25421 Id='$Id'
25422
25423 : Finish up by extracting the .SH files
25424 case "$alldone" in
25425 exit)
25426         echo "Stopping at your request, leaving temporary files around."
25427         exit 0
25428         ;;
25429 cont)
25430         ;;
25431 '')
25432         dflt=''
25433         nostick=true
25434         $cat <<EOM
25435
25436 If you'd like to make any changes to the config.sh file before I begin
25437 to configure things, do it as a shell escape now (e.g. !vi config.sh).
25438
25439 EOM
25440         rp="Press return or use a shell escape to edit config.sh:"
25441         . UU/myread
25442         nostick=''
25443         case "$ans" in
25444         '') ;;
25445         *) : in case they cannot read
25446                 sh 1>&4 -c "$ans";;
25447         esac
25448         ;;
25449 esac
25450
25451 : if this fails, just run all the .SH files by hand
25452 . ./config.sh
25453
25454 echo " "
25455 exec 1>&4
25456 pwd=`pwd`
25457 . ./UU/extract
25458 cd "$pwd"
25459
25460 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
25461         dflt=y
25462         case "$silent" in
25463         true) ;;
25464         *)
25465                 $cat <<EOM
25466
25467 Now you need to generate make dependencies by running "$make depend".
25468 You might prefer to run it in background: "$make depend > makedepend.out &"
25469 It can take a while, so you might not want to run it right now.
25470
25471 EOM
25472                 ;;
25473         esac
25474         rp="Run $make depend now?"
25475         . UU/myread
25476         case "$ans" in
25477         y*)
25478                 $make depend && echo "Now you must run '$make'."
25479                 ;;
25480         *)
25481                 echo "You must run '$make depend' then '$make'."
25482                 ;;
25483         esac
25484 elif test -f [Mm]akefile; then
25485         echo " "
25486         echo "Now you must run a $make."
25487 else
25488         echo "Configure done."
25489 fi
25490
25491 if $test -f Policy.sh; then
25492     $cat <<EOM
25493
25494 If you compile $package on a different machine or from a different object
25495 directory, copy the Policy.sh file from this object directory to the
25496 new one before you run Configure -- this will help you with most of
25497 the policy defaults.
25498
25499 EOM
25500 fi
25501 if $test -f UU/config.msg; then
25502     echo "Hmm.  I also noted the following information while running:"
25503     echo " "
25504     $cat UU/config.msg >&4
25505 fi
25506 $rm -f kit*isdone ark*isdone
25507 $rm -rf UU
25508
25509 : End of Configure
25510