This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
APItest/t/utf8.t: Fix test name
[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_long_double_style_ieee=''
639 d_long_double_style_ieee_doubledouble=''
640 d_long_double_style_ieee_extended=''
641 d_long_double_style_ieee_std=''
642 d_long_double_style_vax=''
643 d_longdbl=''
644 longdblkind=''
645 longdblsize=''
646 d_longlong=''
647 longlongsize=''
648 d_lrint=''
649 d_lrintl=''
650 d_lround=''
651 d_lroundl=''
652 d_lseekproto=''
653 d_lstat=''
654 d_madvise=''
655 d_malloc_good_size=''
656 d_malloc_size=''
657 d_mblen=''
658 d_mbstowcs=''
659 d_mbtowc=''
660 d_memchr=''
661 d_memcmp=''
662 d_memcpy=''
663 d_memmem=''
664 d_memmove=''
665 d_memset=''
666 d_mkdir=''
667 d_mkdtemp=''
668 d_mkfifo=''
669 d_mkstemp=''
670 d_mkstemps=''
671 d_mktime=''
672 d_mmap=''
673 mmaptype=''
674 d_modfl=''
675 d_modflproto=''
676 d_mprotect=''
677 d_msg=''
678 d_msgctl=''
679 d_msgget=''
680 d_msghdr_s=''
681 d_msgrcv=''
682 d_msgsnd=''
683 d_msync=''
684 d_munmap=''
685 d_nan=''
686 d_nearbyint=''
687 d_duplocale=''
688 d_freelocale=''
689 d_newlocale=''
690 d_querylocale=''
691 d_uselocale=''
692 i_xlocale=''
693 d_nextafter=''
694 d_nexttoward=''
695 d_nice=''
696 d_nl_langinfo=''
697 d_off64_t=''
698 d_open3=''
699 d_fpathconf=''
700 d_pathconf=''
701 d_pause=''
702 d_pipe=''
703 d_poll=''
704 d_portable=''
705 d_prctl=''
706 d_prctl_set_name=''
707 d_procselfexe=''
708 procselfexe=''
709 d_old_pthread_create_joinable=''
710 old_pthread_create_joinable=''
711 d_pthread_atfork=''
712 d_pthread_attr_setscope=''
713 d_pthread_yield=''
714 d_sched_yield=''
715 sched_yield=''
716 d_ptrdiff_t=''
717 d_qgcvt=''
718 d_random_r=''
719 random_r_proto=''
720 d_readdir64_r=''
721 readdir64_r_proto=''
722 d_readdir=''
723 d_rewinddir=''
724 d_seekdir=''
725 d_telldir=''
726 d_readdir_r=''
727 readdir_r_proto=''
728 d_readlink=''
729 d_readv=''
730 d_recvmsg=''
731 d_re_comp=''
732 d_regcmp=''
733 d_regcomp=''
734 d_remainder=''
735 d_remquo=''
736 d_rename=''
737 d_rint=''
738 d_rmdir=''
739 d_round=''
740 d_safebcpy=''
741 d_safemcpy=''
742 d_sanemcmp=''
743 d_sbrkproto=''
744 d_scalbn=''
745 d_scalbnl=''
746 d_select=''
747 d_sem=''
748 d_semctl=''
749 d_semget=''
750 d_semop=''
751 d_sendmsg=''
752 d_setegid=''
753 d_seteuid=''
754 d_setgrent=''
755 d_setgrent_r=''
756 setgrent_r_proto=''
757 d_setgrps=''
758 d_sethent=''
759 d_sethostent_r=''
760 sethostent_r_proto=''
761 d_setitimer=''
762 d_setlinebuf=''
763 d_setlocale=''
764 d_setlocale_r=''
765 setlocale_r_proto=''
766 d_setnent=''
767 d_setnetent_r=''
768 setnetent_r_proto=''
769 d_setpent=''
770 d_setpgid=''
771 d_setpgrp2=''
772 d_bsdsetpgrp=''
773 d_setpgrp=''
774 d_setprior=''
775 d_setproctitle=''
776 d_setprotoent_r=''
777 setprotoent_r_proto=''
778 d_setpwent=''
779 d_setpwent_r=''
780 setpwent_r_proto=''
781 d_setregid=''
782 d_setresgid=''
783 d_setresuid=''
784 d_setreuid=''
785 d_setrgid=''
786 d_setruid=''
787 d_setsent=''
788 d_setservent_r=''
789 setservent_r_proto=''
790 d_setsid=''
791 d_setvbuf=''
792 d_shm=''
793 d_shmat=''
794 d_shmatprototype=''
795 shmattype=''
796 d_shmctl=''
797 d_shmdt=''
798 d_shmget=''
799 d_sigaction=''
800 d_siginfo_si_addr=''
801 d_siginfo_si_band=''
802 d_siginfo_si_errno=''
803 d_siginfo_si_fd=''
804 d_siginfo_si_pid=''
805 d_siginfo_si_status=''
806 d_siginfo_si_uid=''
807 d_siginfo_si_value=''
808 d_signbit=''
809 d_sigprocmask=''
810 d_sigsetjmp=''
811 usesitecustomize=''
812 d_snprintf=''
813 d_vsnprintf=''
814 d_sockatmark=''
815 d_sockatmarkproto=''
816 d_ip_mreq=''
817 d_ip_mreq_source=''
818 d_ipv6_mreq=''
819 d_ipv6_mreq_source=''
820 d_msg_ctrunc=''
821 d_msg_dontroute=''
822 d_msg_oob=''
823 d_msg_peek=''
824 d_msg_proxy=''
825 d_oldsock=''
826 d_scm_rights=''
827 d_sin6_scope_id=''
828 d_sockaddr_in6=''
829 d_sockaddr_sa_len=''
830 d_socket=''
831 d_sockpair=''
832 sockethdr=''
833 socketlib=''
834 d_socklen_t=''
835 d_socks5_init=''
836 d_sprintf_returns_strlen=''
837 d_sqrtl=''
838 d_srand48_r=''
839 srand48_r_proto=''
840 d_srandom_r=''
841 srandom_r_proto=''
842 d_sresgproto=''
843 d_sresuproto=''
844 d_stat=''
845 d_statblks=''
846 d_statfs_f_flags=''
847 d_statfs_s=''
848 d_static_inline=''
849 perl_static_inline=''
850 d_fstatvfs=''
851 d_statvfs=''
852 d_stdio_cnt_lval=''
853 d_stdio_ptr_lval=''
854 d_stdio_ptr_lval_nochange_cnt=''
855 d_stdio_ptr_lval_sets_cnt=''
856 d_stdiobase=''
857 d_stdstdio=''
858 stdio_base=''
859 stdio_bufsiz=''
860 stdio_cnt=''
861 stdio_filbuf=''
862 stdio_ptr=''
863 d_index=''
864 d_strchr=''
865 d_strcoll=''
866 d_strctcpy=''
867 d_strerrm=''
868 d_strerror=''
869 d_sysernlst=''
870 d_syserrlst=''
871 d_strerror_l=''
872 d_strerror_r=''
873 strerror_r_proto=''
874 d_strftime=''
875 d_strlcat=''
876 d_strlcpy=''
877 d_strtod=''
878 d_strtol=''
879 d_strtold=''
880 d_strtoll=''
881 d_strtoq=''
882 d_strtoul=''
883 d_strtoull=''
884 d_strtouq=''
885 d_strxfrm=''
886 d_symlink=''
887 d_syscall=''
888 d_syscallproto=''
889 d_sysconf=''
890 d_system=''
891 d_tcgetpgrp=''
892 d_tcsetpgrp=''
893 d_telldirproto=''
894 d_tgamma=''
895 d_time=''
896 timetype=''
897 d_asctime64=''
898 d_ctime64=''
899 d_difftime64=''
900 d_gmtime64=''
901 d_localtime64=''
902 d_mktime64=''
903 d_timegm=''
904 clocktype=''
905 d_times=''
906 d_tmpnam_r=''
907 tmpnam_r_proto=''
908 d_trunc=''
909 d_truncate=''
910 d_truncl=''
911 d_ttyname_r=''
912 ttyname_r_proto=''
913 d_tzname=''
914 d_u32align=''
915 d_ualarm=''
916 d_umask=''
917 d_semctl_semid_ds=''
918 d_semctl_semun=''
919 d_union_semun=''
920 d_unordered=''
921 d_unsetenv=''
922 d_usleep=''
923 d_usleepproto=''
924 d_ustat=''
925 d_pseudofork=''
926 d_vfork=''
927 usevfork=''
928 d_voidsig=''
929 signal_t=''
930 d_volatile=''
931 d_charvspr=''
932 d_vprintf=''
933 d_wait4=''
934 d_waitpid=''
935 d_wcscmp=''
936 d_wcstombs=''
937 d_wcsxfrm=''
938 d_wctomb=''
939 d_writev=''
940 default_inc_excludes_dot='undef'
941 dlext=''
942 bin_ELF=''
943 cccdlflags=''
944 ccdlflags=''
945 dlsrc=''
946 ld=''
947 ld_can_script=''
948 lddlflags=''
949 usedl=''
950 doublesize=''
951 dtraceobject=''
952 ebcdic=''
953 fflushNULL=''
954 fflushall=''
955 fpossize=''
956 fpostype=''
957 gccansipedantic=''
958 gccosandvers=''
959 gccversion=''
960 gidformat=''
961 gidsign=''
962 gidsize=''
963 gidtype=''
964 groupstype=''
965 h_fcntl=''
966 h_sysfile=''
967 html1dir=''
968 html1direxp=''
969 installhtml1dir=''
970 html3dir=''
971 html3direxp=''
972 installhtml3dir=''
973 i_arpainet=''
974 i_assert=''
975 i_bfd=''
976 i_crypt=''
977 db_hashtype=''
978 db_prefixtype=''
979 db_version_major=''
980 db_version_minor=''
981 db_version_patch=''
982 i_db=''
983 i_dbm=''
984 i_rpcsvcdbm=''
985 d_dirnamlen=''
986 direntrytype=''
987 i_dirent=''
988 i_dlfcn=''
989 i_execinfo=''
990 i_fcntl=''
991 i_fenv=''
992 i_float=''
993 i_fp=''
994 i_fp_class=''
995 i_gdbm=''
996 d_grpasswd=''
997 i_grp=''
998 i_ieeefp=''
999 i_inttypes=''
1000 i_langinfo=''
1001 i_libutil=''
1002 i_limits=''
1003 i_locale=''
1004 i_machcthr=''
1005 i_malloc=''
1006 i_mallocmalloc=''
1007 i_math=''
1008 i_memory=''
1009 i_mntent=''
1010 d_gdbm_ndbm_h_uses_prototypes=''
1011 d_gdbmndbm_h_uses_prototypes=''
1012 d_ndbm=''
1013 d_ndbm_h_uses_prototypes=''
1014 i_gdbm_ndbm=''
1015 i_gdbmndbm=''
1016 i_ndbm=''
1017 i_netdb=''
1018 i_neterrno=''
1019 i_netinettcp=''
1020 i_niin=''
1021 i_sysin=''
1022 i_poll=''
1023 i_prot=''
1024 i_pthread=''
1025 d_pwage=''
1026 d_pwchange=''
1027 d_pwclass=''
1028 d_pwcomment=''
1029 d_pwexpire=''
1030 d_pwgecos=''
1031 d_pwpasswd=''
1032 d_pwquota=''
1033 i_pwd=''
1034 i_quadmath=''
1035 i_shadow=''
1036 i_socks=''
1037 i_stdbool=''
1038 i_stddef=''
1039 i_stdint=''
1040 i_stdlib=''
1041 i_string=''
1042 strings=''
1043 i_sunmath=''
1044 i_sysaccess=''
1045 i_sysdir=''
1046 i_sysfile=''
1047 d_voidtty=''
1048 i_bsdioctl=''
1049 i_sysfilio=''
1050 i_sysioctl=''
1051 i_syssockio=''
1052 i_syslog=''
1053 i_sysmman=''
1054 i_sysmode=''
1055 i_sysmount=''
1056 i_sysndir=''
1057 i_sysparam=''
1058 i_syspoll=''
1059 i_sysresrc=''
1060 i_syssecrt=''
1061 i_sysselct=''
1062 i_sysstat=''
1063 i_sysstatfs=''
1064 i_sysstatvfs=''
1065 i_systimes=''
1066 i_systypes=''
1067 i_sysuio=''
1068 i_sysun=''
1069 i_sysutsname=''
1070 i_sysvfs=''
1071 i_syswait=''
1072 i_sgtty=''
1073 i_termio=''
1074 i_termios=''
1075 d_tm_tm_gmtoff=''
1076 d_tm_tm_zone=''
1077 i_systime=''
1078 i_systimek=''
1079 i_time=''
1080 timeincl=''
1081 i_unistd=''
1082 i_ustat=''
1083 i_utime=''
1084 i_values=''
1085 i_stdarg=''
1086 i_varargs=''
1087 i_varhdr=''
1088 i_vfork=''
1089 d_inc_version_list=''
1090 inc_version_list=''
1091 inc_version_list_init=''
1092 doubleinfbytes=''
1093 doublenanbytes=''
1094 longdblinfbytes=''
1095 longdblnanbytes=''
1096 installprefix=''
1097 installprefixexp=''
1098 installstyle=''
1099 installusrbinperl=''
1100 intsize=''
1101 longsize=''
1102 shortsize=''
1103 issymlink=''
1104 libc=''
1105 ldlibpthname=''
1106 libperl=''
1107 shrpenv=''
1108 useshrplib=''
1109 glibpth=''
1110 incpth=''
1111 libpth=''
1112 loclibpth=''
1113 plibpth=''
1114 xlibpth=''
1115 ignore_versioned_solibs=''
1116 libs=''
1117 libsdirs=''
1118 libsfiles=''
1119 libsfound=''
1120 libspath=''
1121 lns=''
1122 d_PRIEUldbl=''
1123 d_PRIFUldbl=''
1124 d_PRIGUldbl=''
1125 d_PRIeldbl=''
1126 d_PRIfldbl=''
1127 d_PRIgldbl=''
1128 d_SCNfldbl=''
1129 d_double_has_inf=''
1130 d_double_has_nan=''
1131 d_double_has_negative_zero=''
1132 d_double_has_subnormals=''
1133 d_double_style_cray=''
1134 d_double_style_ibm=''
1135 d_double_style_ieee=''
1136 d_double_style_vax=''
1137 doublekind=''
1138 sPRIEUldbl=''
1139 sPRIFUldbl=''
1140 sPRIGUldbl=''
1141 sPRIeldbl=''
1142 sPRIfldbl=''
1143 sPRIgldbl=''
1144 sSCNfldbl=''
1145 lseeksize=''
1146 lseektype=''
1147 make_set_make=''
1148 d_mymalloc=''
1149 freetype=''
1150 mallocobj=''
1151 mallocsrc=''
1152 malloctype=''
1153 usemallocwrap=''
1154 usemymalloc=''
1155 installman1dir=''
1156 man1dir=''
1157 man1direxp=''
1158 man1ext=''
1159 installman3dir=''
1160 man3dir=''
1161 man3direxp=''
1162 man3ext=''
1163 doublemantbits=''
1164 longdblmantbits=''
1165 nvmantbits=''
1166 modetype=''
1167 multiarch=''
1168 mydomain=''
1169 myhostname=''
1170 phostname=''
1171 c=''
1172 n=''
1173 d_eofnblk=''
1174 eagain=''
1175 o_nonblock=''
1176 rd_nodata=''
1177 need_va_copy=''
1178 netdb_hlen_type=''
1179 netdb_host_type=''
1180 netdb_name_type=''
1181 netdb_net_type=''
1182 groupcat=''
1183 hostcat=''
1184 passcat=''
1185 orderlib=''
1186 ranlib=''
1187 d_perl_otherlibdirs=''
1188 otherlibdirs=''
1189 package=''
1190 spackage=''
1191 pager=''
1192 api_revision=''
1193 api_subversion=''
1194 api_version=''
1195 api_versionstring=''
1196 patchlevel=''
1197 perl_patchlevel=''
1198 revision=''
1199 subversion=''
1200 version=''
1201 version_patchlevel_string=''
1202 perl5=''
1203 perladmin=''
1204 perlpath=''
1205 d_nv_preserves_uv=''
1206 d_nv_zero_is_allbits_zero=''
1207 i16size=''
1208 i16type=''
1209 i32size=''
1210 i32type=''
1211 i64size=''
1212 i64type=''
1213 i8size=''
1214 i8type=''
1215 ivsize=''
1216 ivtype=''
1217 nv_overflows_integers_at=''
1218 nv_preserves_uv_bits=''
1219 nvsize=''
1220 nvtype=''
1221 u16size=''
1222 u16type=''
1223 u32size=''
1224 u32type=''
1225 u64size=''
1226 u64type=''
1227 u8size=''
1228 u8type=''
1229 uvsize=''
1230 uvtype=''
1231 ivdformat=''
1232 nvEUformat=''
1233 nvFUformat=''
1234 nvGUformat=''
1235 nveformat=''
1236 nvfformat=''
1237 nvgformat=''
1238 uvXUformat=''
1239 uvoformat=''
1240 uvuformat=''
1241 uvxformat=''
1242 pidtype=''
1243 prefix=''
1244 prefixexp=''
1245 installprivlib=''
1246 privlib=''
1247 privlibexp=''
1248 prototype=''
1249 ptrsize=''
1250 d_PRIXU64=''
1251 d_PRId64=''
1252 d_PRIi64=''
1253 d_PRIo64=''
1254 d_PRIu64=''
1255 d_PRIx64=''
1256 sPRIXU64=''
1257 sPRId64=''
1258 sPRIi64=''
1259 sPRIo64=''
1260 sPRIu64=''
1261 sPRIx64=''
1262 d_quad=''
1263 quadkind=''
1264 quadtype=''
1265 uquadtype=''
1266 drand01=''
1267 randbits=''
1268 randfunc=''
1269 randseedtype=''
1270 seedfunc=''
1271 installscript=''
1272 scriptdir=''
1273 scriptdirexp=''
1274 selectminbits=''
1275 selecttype=''
1276 sh=''
1277 targetsh=''
1278 sig_count=''
1279 sig_name=''
1280 sig_name_init=''
1281 sig_num=''
1282 sig_num_init=''
1283 sig_size=''
1284 d_sitearch=''
1285 installsitearch=''
1286 sitearch=''
1287 sitearchexp=''
1288 installsitebin=''
1289 sitebin=''
1290 sitebinexp=''
1291 installsitehtml1dir=''
1292 sitehtml1dir=''
1293 sitehtml1direxp=''
1294 installsitehtml3dir=''
1295 sitehtml3dir=''
1296 sitehtml3direxp=''
1297 installsitelib=''
1298 sitelib=''
1299 sitelib_stem=''
1300 sitelibexp=''
1301 installsiteman1dir=''
1302 siteman1dir=''
1303 siteman1direxp=''
1304 installsiteman3dir=''
1305 siteman3dir=''
1306 siteman3direxp=''
1307 siteprefix=''
1308 siteprefixexp=''
1309 installsitescript=''
1310 sitescript=''
1311 sitescriptexp=''
1312 sizesize=''
1313 sizetype=''
1314 d_libname_unique=''
1315 so=''
1316 socksizetype=''
1317 sharpbang=''
1318 shsharp=''
1319 spitshell=''
1320 src=''
1321 ssizetype=''
1322 st_ino_sign=''
1323 st_ino_size=''
1324 startperl=''
1325 startsh=''
1326 stdchar=''
1327 d_stdio_stream_array=''
1328 stdio_stream_array=''
1329 sysman=''
1330 sGMTIME_max=''
1331 sGMTIME_min=''
1332 sLOCALTIME_max=''
1333 sLOCALTIME_min=''
1334 trnl=''
1335 uidformat=''
1336 uidsign=''
1337 uidsize=''
1338 uidtype=''
1339 archname64=''
1340 use64bitall=''
1341 use64bitint=''
1342 usecbacktrace=''
1343 dtrace=''
1344 usedtrace=''
1345 usefaststdio=''
1346 usekernprocpathname=''
1347 ccflags_uselargefiles=''
1348 ldflags_uselargefiles=''
1349 libswanted_uselargefiles=''
1350 uselargefiles=''
1351 uselongdouble=''
1352 usemorebits=''
1353 usemultiplicity=''
1354 nm_opt=''
1355 nm_so_opt=''
1356 runnm=''
1357 usenm=''
1358 usensgetexecutablepath=''
1359 useperlio=''
1360 usequadmath=''
1361 usesocks=''
1362 d_oldpthreads=''
1363 use5005threads=''
1364 useithreads=''
1365 usereentrant=''
1366 usethreads=''
1367 incpath=''
1368 mips_type=''
1369 usrinc=''
1370 vaproto=''
1371 d_vendorarch=''
1372 installvendorarch=''
1373 vendorarch=''
1374 vendorarchexp=''
1375 d_vendorbin=''
1376 installvendorbin=''
1377 vendorbin=''
1378 vendorbinexp=''
1379 installvendorhtml1dir=''
1380 vendorhtml1dir=''
1381 vendorhtml1direxp=''
1382 installvendorhtml3dir=''
1383 vendorhtml3dir=''
1384 vendorhtml3direxp=''
1385 d_vendorlib=''
1386 installvendorlib=''
1387 vendorlib=''
1388 vendorlib_stem=''
1389 vendorlibexp=''
1390 installvendorman1dir=''
1391 vendorman1dir=''
1392 vendorman1direxp=''
1393 installvendorman3dir=''
1394 vendorman3dir=''
1395 vendorman3direxp=''
1396 usevendorprefix=''
1397 vendorprefix=''
1398 vendorprefixexp=''
1399 d_vendorscript=''
1400 installvendorscript=''
1401 vendorscript=''
1402 vendorscriptexp=''
1403 versiononly=''
1404 yacc=''
1405 yaccflags=''
1406 CONFIG=''
1407
1408 : Detect odd OSs
1409 define='define'
1410 undef='undef'
1411 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1412 rmlist=''
1413
1414 : We must find out about Eunice early
1415 eunicefix=':'
1416 if test -f /etc/unixtovms; then
1417         eunicefix=/etc/unixtovms
1418 fi
1419 if test -f /etc/unixtovms.exe; then
1420         eunicefix=/etc/unixtovms.exe
1421 fi
1422
1423 : Set executable suffix now -- needed before hints available
1424 if test -f "/libs/version.library"; then
1425 : Amiga OS
1426     _exe=""
1427 elif test -f "/system/gnu_library/bin/ar.pm"; then
1428 : Stratus VOS
1429     _exe=".pm"
1430 elif test -n "$DJGPP"; then
1431 : DOS DJGPP
1432     _exe=".exe"
1433 elif test -f /kern/cookiejar; then
1434 : MiNT
1435     _exe=""
1436 elif test -d c:/. -o -n "$is_os2" ; then
1437 : OS/2 or cygwin
1438     _exe=".exe"
1439 fi
1440
1441 groupstype=''
1442 i_whoami=''
1443 : Possible local include directories to search.
1444 : Set locincpth to "" in a hint file to defeat local include searches.
1445 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1446 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1447 :
1448 : no include file wanted by default
1449 inclwanted=''
1450
1451 : Enable -DEBUGGING and -DDEBUGGING from the command line
1452 EBUGGING=''
1453 DEBUGGING=''
1454
1455 : Trailing extension.  Override this in a hint file, if needed.
1456 : Extra object files, if any, needed on this platform.
1457 archobjs=''
1458 libnames=''
1459 : change the next line if compiling for Xenix/286 on Xenix/386
1460 xlibpth='/usr/lib/386 /lib/386'
1461 : Possible local library directories to search.
1462 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1463 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1464
1465 : general looking path for locating libraries
1466 glibpth="/lib /usr/lib $xlibpth"
1467 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1468 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1469 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1470 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1471
1472 : Private path used by Configure to find libraries.  Its value
1473 : is prepended to libpth. This variable takes care of special
1474 : machines, like the mips.  Usually, it should be empty.
1475 plibpth=''
1476
1477 : default library list
1478 libswanted=''
1479 : some systems want to use only the non-versioned libso:s
1480 ignore_versioned_solibs=''
1481 ccname=''
1482 ccversion=''
1483 perllibs=''
1484 : set useposix=false in your hint file to disable the POSIX extension.
1485 useposix=true
1486 : set useopcode=false in your hint file to disable the Opcode extension.
1487 useopcode=true
1488 archname64=''
1489 ccflags_uselargefiles=''
1490 ldflags_uselargefiles=''
1491 libswanted_uselargefiles=''
1492 : set usemultiplicity on the Configure command line to enable multiplicity.
1493 : set usesocks on the Configure command line to enable socks.
1494 archname=''
1495 : set usethreads on the Configure command line to enable threads.
1496 usereentrant='undef'
1497 : List of libraries we want.
1498 : If anyone needs extra -lxxx, put those in a hint file.
1499 libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
1500 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1501 : We probably want to search /usr/shlib before most other libraries.
1502 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1503 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1504 glibpth="/usr/shlib $glibpth"
1505 : Do not use vfork unless overridden by a hint file.
1506 usevfork=false
1507
1508 : Find the basic shell for Bourne shell scripts
1509 case "$sh" in
1510 '')
1511         case "$SYSTYPE" in
1512         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1513         *) xxx='/bin/sh';;
1514         esac
1515         if test -f "$xxx"; then
1516                 sh="$xxx"
1517         else
1518                 : Build up a list and do a single loop so we can 'break' out.
1519                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1520                 for xxx in sh bash ksh pdksh ash; do
1521                         for p in $pth; do
1522                                 try="$try ${p}/${xxx}"
1523                         done
1524                 done
1525                 for xxx in $try; do
1526                         if test -f "$xxx"; then
1527                                 sh="$xxx";
1528                                 break
1529                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1530                                 sh="$xxx";
1531                                 break
1532                         elif test -f "$xxx.exe"; then
1533                                 sh="$xxx";
1534                                 break
1535                         fi
1536                 done
1537         fi
1538         ;;
1539 esac
1540
1541 case "$sh" in
1542 '')     cat >&2 <<EOM
1543 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1544
1545 Usually it's in /bin/sh.  How did you even get this far?
1546 Please contact me (Perl Maintainers) at perlbug@perl.org and
1547 we'll try to straighten this all out.
1548 EOM
1549         exit 1
1550         ;;
1551 esac
1552
1553 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1554 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1555 targetsh=$sh
1556
1557 : see if sh knows # comments
1558 if `$sh -c '#' >/dev/null 2>&1`; then
1559         shsharp=true
1560         spitshell=cat
1561         xcat=/bin/cat
1562         test -f $xcat$_exe || xcat=/usr/bin/cat
1563         if test ! -f $xcat$_exe; then
1564                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1565                         if test -f $p/cat$_exe; then
1566                                 xcat=$p/cat
1567                                 break
1568                         fi
1569                 done
1570                 if test ! -f $xcat$_exe; then
1571                         echo "Can't find cat anywhere!"
1572                         exit 1
1573                 fi
1574         fi
1575         echo "#!$xcat" >sharp
1576         $eunicefix sharp
1577         chmod +x sharp
1578         ./sharp > today 2>/dev/null
1579         if test -s today; then
1580                 sharpbang='#!'
1581         else
1582                 echo "#! $xcat" > sharp
1583                 $eunicefix sharp
1584                 chmod +x sharp
1585                 ./sharp > today 2>/dev/null
1586                 if test -s today; then
1587                         sharpbang='#! '
1588                 else
1589                         sharpbang=': use '
1590                 fi
1591         fi
1592 else
1593         echo " "
1594         echo "Your $sh doesn't grok # comments--I will strip them later on."
1595         shsharp=false
1596         cd ..
1597         echo "exec grep -v '^[  ]*#'" >spitshell
1598         chmod +x spitshell
1599         $eunicefix spitshell
1600         spitshell=`pwd`/spitshell
1601         cd UU
1602         echo "I presume that if # doesn't work, #! won't work either!"
1603         sharpbang=': use '
1604 fi
1605 rm -f sharp today
1606
1607 : figure out how to guarantee sh startup
1608 case "$startsh" in
1609 '') startsh=${sharpbang}${sh} ;;
1610 *)
1611 esac
1612 cat >sharp <<EOSS
1613 $startsh
1614 set abc
1615 test "$?abc" != 1
1616 EOSS
1617
1618 chmod +x sharp
1619 $eunicefix sharp
1620 if ./sharp; then
1621         : echo "Yup, it does."
1622 else
1623         echo "Hmm... '$startsh' does not guarantee sh startup..."
1624         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1625 fi
1626 rm -f sharp
1627
1628 : Save command line options in file UU/cmdline.opt for later use in
1629 : generating config.sh.
1630 cat > cmdline.opt <<EOSH
1631 : Configure command line arguments.
1632 config_arg0='$0'
1633 config_args='$*'
1634 config_argc=$#
1635 EOSH
1636 argn=1
1637 args_exp=''
1638 args_sep=''
1639 for arg in "$@"; do
1640         cat >>cmdline.opt <<EOSH
1641 config_arg$argn='$arg'
1642 EOSH
1643         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1644 $arg
1645 EOC
1646         arg_exp=`cat cmdl.opt`
1647         args_exp="$args_exp$args_sep'$arg_exp'"
1648         argn=`expr $argn + 1`
1649         args_sep=' '
1650 done
1651 rm -f cmdl.opt
1652
1653 : produce awk script to parse command line options
1654 cat >options.awk <<'EOF'
1655 BEGIN {
1656         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1657
1658         len = length(optstr);
1659         for (i = 1; i <= len; i++) {
1660                 c = substr(optstr, i, 1);
1661                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1662                 if (a == ":") {
1663                         arg[c] = 1;
1664                         i++;
1665                 }
1666                 opt[c] = 1;
1667         }
1668 }
1669 {
1670         expect = 0;
1671         str = $0;
1672         if (substr(str, 1, 1) != "-") {
1673                 printf("'%s'\n", str);
1674                 next;
1675         }
1676         len = length($0);
1677         for (i = 2; i <= len; i++) {
1678                 c = substr(str, i, 1);
1679                 if (!opt[c]) {
1680                         printf("-%s\n", substr(str, i));
1681                         next;
1682                 }
1683                 printf("-%s\n", c);
1684                 if (arg[c]) {
1685                         if (i < len)
1686                                 printf("'%s'\n", substr(str, i + 1));
1687                         else
1688                                 expect = 1;
1689                         next;
1690                 }
1691         }
1692 }
1693 END {
1694         if (expect)
1695                 print "?";
1696 }
1697 EOF
1698
1699 : process the command line options
1700 set X `for arg in "$@"; do echo "X$arg"; done |
1701         sed -e s/X// | awk -f options.awk`
1702 eval "set $*"
1703 shift
1704 rm -f options.awk
1705
1706 : set up default values
1707 fastread=''
1708 reuseval=false
1709 config_sh=''
1710 alldone=''
1711 error=''
1712 silent=''
1713 extractsh=''
1714 knowitall=''
1715 rm -f optdef.sh posthint.sh
1716 cat >optdef.sh <<EOS
1717 $startsh
1718 EOS
1719
1720
1721 : option parsing
1722 while test $# -gt 0; do
1723         case "$1" in
1724         -d) shift; fastread=yes;;
1725         -e) shift; alldone=cont;;
1726         -f)
1727                 shift
1728                 cd ..
1729                 if test -r "$1"; then
1730                         config_sh="$1"
1731                 else
1732                         echo "$me: cannot read config file $1." >&2
1733                         error=true
1734                 fi
1735                 cd UU
1736                 shift;;
1737         --help|\
1738         -h) shift; error=true;;
1739         -r) shift; reuseval=true;;
1740         -s) shift; silent=true; realsilent=true;;
1741         -E) shift; alldone=exit;;
1742         -K) shift; knowitall=true;;
1743         -O) shift;;
1744         -S) shift; silent=true; extractsh=true;;
1745         -D)
1746                 shift
1747                 case "$1" in
1748                 *=)
1749                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1750                         echo "$me: ignoring -D $1" >&2
1751                         ;;
1752                 *=*) echo "$1" | \
1753                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1754                 *) echo "$1='define'" >> optdef.sh;;
1755                 esac
1756                 shift
1757                 ;;
1758         -U)
1759                 shift
1760                 case "$1" in
1761                 *=) echo "$1" >> optdef.sh;;
1762                 *=*)
1763                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1764                         echo "$me: ignoring -U $1" >&2
1765                         ;;
1766                 *) echo "$1='undef'" >> optdef.sh;;
1767                 esac
1768                 shift
1769                 ;;
1770         -A)
1771             shift
1772             xxx=''
1773             yyy="$1"
1774             zzz=''
1775             uuu=undef
1776             case "$yyy" in
1777             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1778                  case "$zzz" in
1779                  *:*) zzz='' ;;
1780                  *)   xxx=append
1781                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1782                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1783                  esac
1784                  ;;
1785             esac
1786             case "$xxx" in
1787             '')  case "$yyy" in
1788                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1789                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1790                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1791                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1792                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1793                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1794                  esac
1795                  ;;
1796             esac
1797             case "$xxx" in
1798             append)
1799                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1800             clear)
1801                 echo "$yyy=''"                  >> posthint.sh ;;
1802             define)
1803                 case "$zzz" in
1804                 '') zzz=define ;;
1805                 esac
1806                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1807             eval)
1808                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1809             prepend)
1810                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1811             undef)
1812                 case "$zzz" in
1813                 '') zzz="$uuu" ;;
1814                 esac
1815                 echo "$yyy=$zzz"                >> posthint.sh ;;
1816             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1817             esac
1818             shift
1819             ;;
1820         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1821             exit 0;;
1822         --) break;;
1823         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1824         *) break;;
1825         esac
1826 done
1827
1828 case "$error" in
1829 true)
1830         cat >&2 <<EOM
1831 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1832                  [-U symbol] [-U symbol=] [-A command:symbol...]
1833   -d : use defaults for all answers.
1834   -e : go on without questioning past the production of config.sh.
1835   -f : specify an alternate default configuration file.
1836   -h : print this help message and exit (with an error status).
1837   -r : reuse C symbols value if possible (skips costly nm extraction).
1838   -s : silent mode, only echoes questions and essential information.
1839   -D : define symbol to have some value:
1840          -D symbol         symbol gets the value 'define'
1841          -D symbol=value   symbol gets the value 'value'
1842        common used examples (see INSTALL for more info):
1843          -Duse64bitint            use 64bit integers
1844          -Duse64bitall            use 64bit integers and pointers
1845          -Dusethreads             use thread support
1846          -Dinc_version_list=none  do not include older perl trees in @INC
1847          -DEBUGGING=none          DEBUGGING options
1848          -Dcc=gcc                 choose your compiler
1849          -Dprefix=/opt/perl5      choose your destination
1850   -E : stop at the end of questions, after having produced config.sh.
1851   -K : do not use unless you know what you are doing.
1852   -O : ignored for backward compatibility
1853   -S : perform variable substitutions on all .SH files (can mix with -f)
1854   -U : undefine symbol:
1855          -U symbol    symbol gets the value 'undef'
1856          -U symbol=   symbol gets completely empty
1857        e.g.:  -Uversiononly
1858   -A : manipulate symbol after the platform specific hints have been applied:
1859          -A append:symbol=value   append value to symbol
1860          -A symbol=value          like append:, but with a separating space
1861          -A define:symbol=value   define symbol to have value
1862          -A clear:symbol          define symbol to be ''
1863          -A define:symbol         define symbol to be 'define'
1864          -A eval:symbol=value     define symbol to be eval of value
1865          -A prepend:symbol=value  prepend value to symbol
1866          -A undef:symbol          define symbol to be 'undef'
1867          -A undef:symbol=         define symbol to be ''
1868        e.g.:  -A prepend:libswanted='cl pthread '
1869               -A ccflags=-DSOME_MACRO
1870   -V : print version number and exit (with a zero status).
1871 EOM
1872         exit 1
1873         ;;
1874 esac
1875
1876 : Sanity checks
1877 case "$fastread$alldone" in
1878 yescont|yesexit) ;;
1879 *)
1880         case "$extractsh" in
1881         true) ;;
1882         *)
1883                 if test ! -t 0; then
1884                         echo "Say 'sh Configure', not 'sh <Configure'"
1885                         exit 1
1886                 fi
1887                 ;;
1888         esac
1889         ;;
1890 esac
1891
1892 exec 4>&1
1893 case "$silent" in
1894 true) exec 1>/dev/null;;
1895 esac
1896
1897 : run the defines and the undefines, if any, but leave the file out there...
1898 touch optdef.sh
1899 grep '\\' optdef.sh >/dev/null 2>&1
1900 if test $? = 0; then
1901     echo "Configure does not support \\ in -D arguments"
1902     exit 1
1903 fi
1904 . ./optdef.sh
1905 : create the posthint manipulation script and leave the file out there...
1906 touch posthint.sh
1907
1908 : set package name
1909 package='perl5'
1910 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1911 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1912 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1913 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1914 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1915 esac
1916
1917 : Some greps do not return status, grrr.
1918 echo "grimblepritz" >grimble
1919 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1920         contains=contains
1921 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1922         contains=grep
1923 else
1924         contains=contains
1925 fi
1926 rm -f grimble
1927 : the following should work in any shell
1928 case "$contains" in
1929 contains*)
1930         echo " "
1931         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1932         cat >contains <<'EOSS'
1933 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1934 EOSS
1935 chmod +x contains
1936 esac
1937
1938 : Find the path to the source tree
1939 case "$src" in
1940 '') case "$0" in
1941     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1942          case "$src" in
1943          /*)    ;;
1944          .)     ;;
1945          *)     src=`cd ../$src && pwd` ;;
1946          esac
1947          ;;
1948     *)   src='.';;
1949     esac;;
1950 esac
1951 case "$src" in
1952 '')     src=/
1953         rsrc=/
1954         ;;
1955 /*)     rsrc="$src";;
1956 *)      rsrc="../$src";;
1957 esac
1958 if test -f $rsrc/Configure && \
1959         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1960 then
1961    : found it, so we are ok.
1962 else
1963         rsrc=''
1964         for src in . .. ../.. ../../.. ../../../..; do
1965                 if test -f ../$src/Configure && \
1966                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1967                 then
1968                         rsrc=../$src
1969                         break
1970                 fi
1971         done
1972 fi
1973 case "$rsrc" in
1974 '')
1975         cat <<EOM >&4
1976
1977 Sorry, I can't seem to locate the source dir for $package.  Please start
1978 Configure with an explicit path -- i.e. /some/path/Configure.
1979
1980 EOM
1981         exit 1
1982         ;;
1983 ../.)   rsrc='..';;
1984 *)
1985         echo " "
1986         echo "Sources for $package found in \"$src\"." >&4
1987         ;;
1988 esac
1989
1990 : script used to extract .SH files with variable substitutions
1991 cat >extract <<'EOS'
1992 PERL_CONFIG_SH=true
1993 echo "Doing variable substitutions on .SH files..."
1994 if test -f MANIFEST; then
1995         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1996 else
1997         echo "(Looking for .SH files under the source directory.)"
1998         set x `(cd "$src"; find . -name "*.SH" -print)`
1999 fi
2000 shift
2001 case $# in
2002 0) set x `(cd "$src"; echo *.SH)`; shift;;
2003 esac
2004 if test ! -f "$src/$1"; then
2005         shift
2006 fi
2007 mkdir_p='
2008 name=$1;
2009 create="";
2010 while test $name; do
2011         if test ! -d "$name"; then
2012                 create="$name $create";
2013                 name=`echo $name | sed -e "s|^[^/]*$||"`;
2014                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
2015         else
2016                 name="";
2017         fi;
2018 done;
2019 for file in $create; do
2020         mkdir $file;
2021 done
2022 '
2023 for file in $*; do
2024         case "$src" in
2025         ".")
2026                 case "$file" in
2027                 */*)
2028                         dir=`expr X$file : 'X\(.*\)/'`
2029                         file=`expr X$file : 'X.*/\(.*\)'`
2030                         (cd "$dir" && . ./$file)
2031                         ;;
2032                 *)
2033                         . ./$file
2034                         ;;
2035                 esac
2036                 ;;
2037         *)
2038                 case "$file" in
2039                 */*)
2040                         dir=`expr X$file : 'X\(.*\)/'`
2041                         file=`expr X$file : 'X.*/\(.*\)'`
2042                         (set x $dir; shift; eval $mkdir_p)
2043                         sh <"$src/$dir/$file"
2044                         ;;
2045                 *)
2046                         sh <"$src/$file"
2047                         ;;
2048                 esac
2049                 ;;
2050         esac
2051 done
2052 if test -f "$src/config_h.SH"; then
2053         if test ! -f config.h; then
2054         : oops, they left it out of MANIFEST, probably, so do it anyway.
2055         . "$src/config_h.SH"
2056         fi
2057 fi
2058 EOS
2059
2060 : extract files and exit if asked to do so
2061 case "$extractsh" in
2062 true)
2063         case "$realsilent" in
2064         true) ;;
2065         *) exec 1>&4;;
2066         esac
2067         case "$config_sh" in
2068         '') config_sh='config.sh';;
2069         esac
2070         echo " "
2071         echo "Fetching answers from $config_sh..."
2072         cd ..
2073         . $config_sh
2074         . UU/optdef.sh
2075         echo " "
2076         . UU/extract
2077         rm -rf UU
2078         echo "Extraction done."
2079         exit 0
2080         ;;
2081 esac
2082
2083 : Eunice requires " " instead of "", can you believe it
2084 echo " "
2085 : Here we go...
2086 echo "Beginning of configuration questions for $package."
2087
2088 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2089
2090 : first determine how to suppress newline on echo command
2091 echo " "
2092 echo "Checking echo to see how to suppress newlines..."
2093 (echo "hi there\c" ; echo " ") >.echotmp
2094 if $contains c .echotmp >/dev/null 2>&1 ; then
2095         echo "...using -n."
2096         n='-n'
2097         c=''
2098 else
2099         cat <<'EOM'
2100 ...using \c
2101 EOM
2102         n=''
2103         c='\c'
2104 fi
2105 echo $n "The star should be here-->$c"
2106 echo '*'
2107 rm -f .echotmp
2108
2109 : Now test for existence of everything in MANIFEST
2110 echo " "
2111 if test -f "$rsrc/MANIFEST"; then
2112         echo "First let's make sure your kit is complete.  Checking..." >&4
2113         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2114                 (split -l 50 2>/dev/null || split -50)
2115         rm -f missing
2116         tmppwd=`pwd`
2117         for filelist in x??; do
2118                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2119                         >/dev/null 2>>"$tmppwd/missing")
2120         done
2121         if test -s missing; then
2122                 cat missing >&4
2123                 cat >&4 <<'EOM'
2124
2125 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2126
2127 You have the option of continuing the configuration process, despite the
2128 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2129 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2130 and contact the author (perlbug@perl.org).
2131
2132 EOM
2133                 echo $n "Continue? [n] $c" >&4
2134                 read ans
2135                 case "$ans" in
2136                 y*)
2137                         echo "Continuing..." >&4
2138                         rm -f missing
2139                         ;;
2140                 *)
2141                         echo "ABORTING..." >&4
2142                         kill $$
2143                         ;;
2144                 esac
2145         else
2146                 echo "Looks good..."
2147         fi
2148 else
2149         echo "There is no MANIFEST file.  I hope your kit is complete !"
2150 fi
2151 rm -f missing x??
2152
2153 : Find the appropriate value for a newline for tr
2154 if test -n "$DJGPP"; then
2155        trnl='\012'
2156 fi
2157 if test X"$trnl" = X; then
2158         case "`echo foo | tr '\n' x 2>/dev/null`" in
2159         foox) trnl='\n' ;;
2160         esac
2161 fi
2162 if test X"$trnl" = X; then
2163         case "`echo foo | tr '\012' x 2>/dev/null`" in
2164         foox) trnl='\012' ;;
2165         esac
2166 fi
2167 if test X"$trnl" = X; then
2168        case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
2169        fooxy) trnl='\n\r' ;;
2170        esac
2171 fi
2172 if test X"$trnl" = X; then
2173         cat <<EOM >&2
2174
2175 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2176
2177 EOM
2178         exit 1
2179 fi
2180
2181 : compute the number of columns on the terminal for proper question formatting
2182 case "$COLUMNS" in
2183 '') COLUMNS='80';;
2184 esac
2185
2186 : set up the echo used in my read
2187 myecho="case \"\$xxxm\" in
2188 '') echo $n \"\$rp $c\" >&4;;
2189 *) case \"\$rp\" in
2190         '') echo $n \"[\$xxxm] $c\";;
2191         *)
2192                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2193                         echo \"\$rp\" >&4
2194                         echo $n \"[\$xxxm] $c\" >&4
2195                 else
2196                         echo $n \"\$rp [\$xxxm] $c\" >&4
2197                 fi
2198                 ;;
2199         esac;;
2200 esac"
2201
2202 : now set up to do reads with possible shell escape and default assignment
2203 cat <<EOSC >myread
2204 $startsh
2205 xxxm=\$dflt
2206 $myecho
2207 ans='!'
2208 case "\$fastread" in
2209 yes) case "\$dflt" in
2210         '') ;;
2211         *) ans='';
2212                 case "\$silent-\$rp" in
2213                 true-) ;;
2214                 *) echo " " >&4;;
2215                 esac;;
2216         esac;;
2217 *) case "\$silent" in
2218         true) case "\$rp" in
2219                 '') ans='';;
2220                 esac;;
2221         esac;;
2222 esac
2223 while expr "X\$ans" : "X!" >/dev/null; do
2224         read answ
2225         set x \$xxxm
2226         shift
2227         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2228         case  "\$answ" in
2229         "!")
2230                 sh 1>&4
2231                 echo " "
2232                 $myecho
2233                 ;;
2234         !*)
2235                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2236                 shift
2237                 sh 1>&4 -c "\$*"
2238                 echo " "
2239                 $myecho
2240                 ;;
2241         "\$ans")
2242                 case "\$ans" in
2243                 \\&*)
2244                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2245                         shift
2246                         case "\$1" in
2247                         -d)
2248                                 fastread=yes
2249                                 echo "(OK, I'll run with -d after this question.)" >&4
2250                                 ;;
2251                         -*)
2252                                 echo "*** Sorry, \$1 not supported yet." >&4
2253                                 ;;
2254                         esac
2255                         $myecho
2256                         ans=!
2257                         ;;
2258                 esac;;
2259         *)
2260                 case "\$aok" in
2261                 y)
2262                         echo "*** Substitution done -- please confirm."
2263                         xxxm="\$ans"
2264                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2265                         xxxm="\$ans"
2266                         ans=!
2267                         ;;
2268                 *)
2269                         echo "*** Error -- try again."
2270                         ans=!
2271                         ;;
2272                 esac
2273                 $myecho
2274                 ;;
2275         esac
2276         case "\$ans\$xxxm\$nostick" in
2277         '')
2278                 ans=!
2279                 $myecho
2280                 ;;
2281         esac
2282 done
2283 case "\$ans" in
2284 '') ans="\$xxxm";;
2285 esac
2286 EOSC
2287
2288 : create .config dir to save info across Configure sessions
2289 test -d ../.config || mkdir ../.config
2290 cat >../.config/README <<EOF
2291 This directory created by Configure to save information that should
2292 persist across sessions for $package.
2293
2294 You may safely delete it if you wish.
2295 EOF
2296
2297 : See if we are using a devel version and want that
2298 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2299 case "$usedevel" in
2300 $define|true|[yY]*)
2301     usedevel="$define" ;;
2302 *) case "$xversion" in
2303    *[13579])
2304         cat >&4 <<EOH
2305 *** WHOA THERE!!! ***
2306
2307     This is an UNSTABLE DEVELOPMENT release.
2308     The version of this $package distribution is $xversion, that is, odd,
2309     (as opposed to even) and that signifies a development release.
2310     If you want a maintenance release, you want an even-numbered version.
2311
2312     Do ***NOT*** install this into production use.
2313     Data corruption and crashes are possible.
2314
2315     It is most seriously suggested that you do not continue any further
2316     unless you want to help in developing and debugging Perl.
2317
2318     If you *still* want to build perl, you can answer 'y' now,
2319     or pass -Dusedevel to Configure.
2320
2321 EOH
2322         rp='Do you really want to continue?'
2323         dflt='n'
2324         . ./myread
2325         case "$ans" in
2326         [yY]) echo >&4 "Okay, continuing."
2327               usedevel="$define" ;;
2328         *) echo >&4 "Okay, bye."
2329            exit 1
2330            ;;
2331         esac
2332         ;;
2333     esac
2334     usedevel="$undef"
2335     ;;
2336 esac
2337 case "$usedevel" in
2338 $define|true|[yY]*)
2339         case "$versiononly" in
2340         '') versiononly="$define" ;;
2341         esac
2342         case "$installusrbinperl" in
2343         '') installusrbinperl="$undef" ;;
2344         esac
2345         ;;
2346 esac
2347
2348 : general instructions
2349 needman=true
2350 firsttime=true
2351 user=`(logname) 2>/dev/null`
2352 case "$user" in
2353 '') user=`whoami 2>&1`;;
2354 esac
2355 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2356         firsttime=false
2357         echo " "
2358         rp='Would you like to see the instructions?'
2359         dflt=n
2360         . ./myread
2361         case "$ans" in
2362         [yY]*) ;;
2363         *) needman=false;;
2364         esac
2365 fi
2366 if $needman; then
2367         cat <<EOH
2368
2369 This installation shell script will examine your system and ask you questions
2370 to determine how the perl5 package should be installed. If you get
2371 stuck on a question, you may use a ! shell escape to start a subshell or
2372 execute a command.  Many of the questions will have default answers in square
2373 brackets; typing carriage return will give you the default.
2374
2375 On some of the questions which ask for file or directory names you are allowed
2376 to use the ~name construct to specify the login directory belonging to "name",
2377 even if you don't have a shell which knows about that.  Questions where this is
2378 allowed will be marked "(~name ok)".
2379
2380 EOH
2381         rp=''
2382         dflt='Type carriage return to continue'
2383         . ./myread
2384         cat <<'EOH'
2385
2386 The prompter used in this script allows you to use shell variables and
2387 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2388 in the default answer, as if the default line was a set of arguments given to a
2389 script shell.  This means you may also use $* to repeat the whole default line,
2390 so you do not have to re-type everything to add something to the default.
2391
2392 Every time there is a substitution, you will have to confirm.  If there is an
2393 error (e.g. an unmatched backtick), the default answer will remain unchanged
2394 and you will be prompted again.
2395
2396 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2397 the questions and use the computed defaults (or the previous answers if there
2398 was already a config.sh file). Type 'Configure -h' for a list of options.
2399 You may also start interactively and then answer '& -d' at any prompt to turn
2400 on the non-interactive behaviour for the remainder of the execution.
2401
2402 EOH
2403         . ./myread
2404         cat <<EOH
2405
2406 Much effort has been expended to ensure that this shell script will run on any
2407 Unix system.  If despite that it blows up on yours, your best bet is to edit
2408 Configure and run it again.  If you can't run Configure for some reason,
2409 you'll have to generate a config.sh file by hand.  Whatever problems you
2410 have, let me (perlbug@perl.org) know how I blew it.
2411
2412 This installation script affects things in two ways:
2413
2414 1) it may do direct variable substitutions on some of the files included
2415    in this kit.
2416 2) it builds a config.h file for inclusion in C programs.  You may edit
2417    any of these files as the need arises after running this script.
2418
2419 If you make a mistake on a question, there is no easy way to back up to it
2420 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2421 files.  Configure will offer to let you do this before it runs the SH files.
2422
2423 EOH
2424         dflt='Type carriage return to continue'
2425         . ./myread
2426         case "$firsttime" in
2427         true) echo $user >>../.config/instruct;;
2428         esac
2429 fi
2430
2431 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2432 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2433 if test "X$sysroot" = X; then
2434     sysroot=""
2435 else
2436     case "$cc" in
2437         *gcc*|*g++*)
2438             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2439             # _sysroot is used in places where we need --sysroot=foo
2440             # but using the rest of the flags could cause issues.
2441             _sysroot="--sysroot=$sysroot";
2442             case "$ccflags" in
2443                 *sysroot*) ;;
2444                 'undef'|*)
2445                 ccflags="$ccflags $_sysroot"
2446             esac
2447             case "$ldflags" in
2448                 *sysroot*) ;;
2449                 'undef'|*)
2450                 ldflags="$ldflags $_sysroot"
2451             esac
2452             case "$cppflags" in
2453                 *sysroot*) ;;
2454                 'undef'|*)
2455                 cppflags="$cppflags $_sysroot"
2456             esac
2457             # lddlflags updated below in lddlflags section;
2458             # same with cccdlflags
2459             ;;
2460     esac
2461
2462     # Adjust some defaults to also use $sysroot
2463     for var in xlibpth loclibpth locincpth glibpth; do
2464         eval xxx=\$$var
2465         eval $var=''
2466         for path in $xxx; do
2467             eval $var=\"\$$var $sysroot$path\"
2468         done
2469     done
2470
2471 fi
2472
2473 : find out where common programs are
2474 echo " "
2475 echo "Locating common programs..." >&4
2476 cat <<EOSC >loc
2477 $startsh
2478 case \$# in
2479 0) exit 1;;
2480 esac
2481 thing=\$1
2482 shift
2483 dflt=\$1
2484 shift
2485 for dir in \$*; do
2486         case "\$thing" in
2487         .)
2488         if test -d \$dir/\$thing; then
2489                 echo \$dir
2490                 exit 0
2491         fi
2492         ;;
2493         *)
2494         for thisthing in \$dir/\$thing; do
2495                 : just loop through to pick last item
2496         done
2497         if test -f \$thisthing; then
2498                 echo \$thisthing
2499                 exit 0
2500         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2501                 echo \$thisthing
2502                 exit 0
2503         elif test -f \$dir/\$thing.exe; then
2504                 if test -n "$DJGPP"; then
2505                         echo \$dir/\$thing.exe
2506                 elif test "$eunicefix" != ":"; then
2507                         : on Eunice apparently
2508                         echo \$dir/\$thing
2509                 fi
2510                 exit 0
2511         fi
2512         ;;
2513         esac
2514 done
2515 echo \$dflt
2516 exit 1
2517 EOSC
2518 chmod +x loc
2519 $eunicefix loc
2520 loclist="
2521 awk
2522 cat
2523 chmod
2524 comm
2525 cp
2526 echo
2527 expr
2528 grep
2529 ls
2530 mkdir
2531 rm
2532 sed
2533 sort
2534 touch
2535 tr
2536 uniq
2537 "
2538 trylist="
2539 ar
2540 bison
2541 byacc
2542 cpp
2543 csh
2544 date
2545 egrep
2546 gmake
2547 gzip
2548 less
2549 ln
2550 make
2551 more
2552 nm
2553 nroff
2554 perl
2555 pg
2556 test
2557 uname
2558 zip
2559 "
2560 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2561 pth="$pth $sysroot/lib $sysroot/usr/lib"
2562 for file in $loclist; do
2563         eval xxx=\$$file
2564         case "$xxx" in
2565         /*|?:[\\/]*)
2566                 if test -f "$xxx"; then
2567                         : ok
2568                 else
2569                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2570                         xxx=`./loc $file $file $pth`
2571                 fi
2572                 ;;
2573         '') xxx=`./loc $file $file $pth`;;
2574         *) xxx=`./loc $xxx $xxx $pth`;;
2575         esac
2576         eval $file=$xxx$_exe
2577         eval _$file=$xxx
2578         case "$xxx" in
2579         /*)
2580                 echo $file is in $xxx.
2581                 ;;
2582         ?:[\\/]*)
2583                 echo $file is in $xxx.
2584                 ;;
2585         *)
2586                 echo "I don't know where '$file' is, and my life depends on it." >&4
2587                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2588                 exit 1
2589                 ;;
2590         esac
2591 done
2592 echo " "
2593 echo "Don't worry if any of the following aren't found..."
2594 say=offhand
2595 for file in $trylist; do
2596         eval xxx=\$$file
2597         case "$xxx" in
2598         /*|?:[\\/]*)
2599                 if test -f "$xxx"; then
2600                         : ok
2601                 else
2602                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2603                         xxx=`./loc $file $file $pth`
2604                 fi
2605                 ;;
2606         '') xxx=`./loc $file $file $pth`;;
2607         *) xxx=`./loc $xxx $xxx $pth`;;
2608         esac
2609         eval $file=$xxx$_exe
2610         eval _$file=$xxx
2611         case "$xxx" in
2612         /*)
2613                 echo $file is in $xxx.
2614                 ;;
2615         ?:[\\/]*)
2616                 echo $file is in $xxx.
2617                 ;;
2618         *)
2619                 echo "I don't see $file out there, $say."
2620                 say=either
2621                 ;;
2622         esac
2623 done
2624 case "$egrep" in
2625 egrep)
2626         echo "Substituting grep for egrep."
2627         egrep=$grep
2628         _egrep=$grep
2629         ;;
2630 esac
2631 case "$less" in
2632 '')     ;;
2633 *)      if $less -R </dev/null >/dev/null 2>&1; then
2634                echo "Substituting less -R for less."
2635                less="$less -R"
2636                _less=$less
2637         fi
2638         ;;
2639 esac
2640 case "$ln" in
2641 ln)
2642         echo "Substituting cp for ln."
2643         ln=$cp
2644         _ln=$cp
2645         ;;
2646 esac
2647 case "$make" in
2648 make)
2649         case "$gmake" in
2650         gmake)
2651         echo "I can't find make or gmake, and my life depends on it." >&4
2652         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2653         exit 1
2654         ;;
2655         esac
2656         ;;
2657 esac
2658 case "$gmake" in
2659 gmake)  ;;
2660 *)      # We can't have osname yet.
2661         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2662                 # Assume that gmake, if found, is definitely GNU make
2663                 # and prefer it over the system make.
2664                 echo "Substituting gmake for make."
2665                 make=$gmake
2666                 _make=$gmake
2667         fi
2668         ;;
2669 esac
2670 case "$test" in
2671 test)
2672         echo "Hopefully test is built into your sh."
2673         ;;
2674 *)
2675         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2676                 echo "Using the test built into your sh."
2677                 test=test
2678                 _test=test
2679         fi
2680         ;;
2681 esac
2682 case "$echo" in
2683 echo)
2684         echo "Hopefully echo is built into your sh."
2685         ;;
2686 '') ;;
2687 *)
2688         echo " "
2689 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2690         $echo $n "hi there$c" >foo1
2691         echo $n "hi there$c" >foo2
2692         if cmp foo1 foo2 >/dev/null 2>&1; then
2693                 echo "They are compatible.  In fact, they may be identical."
2694         else
2695                 case "$n" in
2696                 '-n') n='' c='\c';;
2697                 *) n='-n' c='';;
2698                 esac
2699                 cat <<FOO
2700 They are not compatible!  You are probably running ksh on a non-USG system.
2701 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2702 have echo built in and we may have to run some Bourne shell scripts.  That
2703 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2704
2705 FOO
2706                 $echo $n "The star should be here-->$c"
2707                 $echo "*"
2708         fi
2709         $rm -f foo1 foo2
2710         ;;
2711 esac
2712
2713 # This question was auctioned at YAPC::Europe-2007 in Vienna
2714 # I never promised you could answer it. I only auctioned the question.
2715 cat <<FOO
2716 The following message is sponsored by
2717
2718   Dresden.pm<--The stars should be here.
2719
2720 Dear Perl user, system administrator or package
2721 maintainer, the Perl community sends greetings to
2722 you. Do you (emblematical) greet back [Y/n]? n
2723
2724 FOO
2725
2726 : Check what type of C compiler we use
2727 cat <<EOS >trygcc
2728 $startsh
2729 EOS
2730 cat <<'EOSC' >>trygcc
2731 case "$cc" in
2732 '') ;;
2733 *)  $rm -f try try.*
2734     $cat >try.c <<EOM
2735 int main(int argc, char *argv[]) {
2736   return 0;
2737 }
2738 EOM
2739     if $cc -o try $ccflags $ldflags try.c; then
2740        :
2741     else
2742         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2743         despair=yes
2744         trygcc=yes
2745         case "$cc" in
2746         *gcc*) trygcc=no ;;
2747         esac
2748         # Skip this test because it gives a false match on output like:
2749         #    ./trygcc: line 23: cc: command not found
2750         # case "`$cc -v -c try.c 2>&1`" in
2751         # *gcc*) trygcc=no ;;
2752         # esac
2753         if $test X"$trygcc" = Xyes; then
2754             if gcc -o try -c try.c; then
2755                 echo " "
2756                 echo "You seem to have a working gcc, though." >&4
2757                 # Switching compilers may undo the work of hints files.
2758                 # The most common problem is -D_REENTRANT for threads.
2759                 # This heuristic catches that case, but gets false positives
2760                 # if -Dusethreads was not actually specified.  Better to
2761                 # bail out here with a useful message than fail
2762                 # mysteriously later. Should we perhaps just try to
2763                 # re-invoke Configure -Dcc=gcc config_args ?
2764                 if $test -f usethreads.cbu; then
2765                         $cat >&4 <<EOM
2766
2767 *** However, any setting of the C compiler flags (e.g. for thread support)
2768 *** will be lost.  It may be necessary for you to restart Configure and
2769 *** add -Dcc=gcc to your Configure command line.
2770
2771 EOM
2772                         rp="Would you like to go ahead and try gcc anyway?"
2773                         dflt=n
2774                 else
2775                         rp="Would you like to use it?"
2776                         dflt=y
2777                 fi
2778                 if $test -f myread; then
2779                     . ./myread
2780                 else
2781                     if $test -f UU/myread; then
2782                         . ./UU/myread
2783                     else
2784                         echo "Cannot find myread, sorry.  Aborting." >&2
2785                         exit 1
2786                     fi
2787                 fi
2788                 case "$ans" in
2789                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2790                 esac
2791             fi
2792         fi
2793     fi
2794     $rm -f try try.*
2795     ;;
2796 esac
2797 EOSC
2798
2799 cat <<EOS >checkcc
2800 $startsh
2801 EOS
2802 cat <<'EOSC' >>checkcc
2803 case "$cc" in
2804 '') ;;
2805 *)  $rm -f try try.*
2806     $cat >try.c <<EOM
2807 int main(int argc, char *argv[]) {
2808   return 0;
2809 }
2810 EOM
2811     if $cc -o try $ccflags $ldflags try.c; then
2812        :
2813     else
2814         if $test X"$despair" = Xyes; then
2815            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2816         fi
2817         $cat >&4 <<EOM
2818 You need to find a working C compiler.
2819 Either (purchase and) install the C compiler supplied by your OS vendor,
2820 or for a free C compiler try http://gcc.gnu.org/
2821 I cannot continue any further, aborting.
2822 EOM
2823         exit 1
2824     fi
2825     $rm -f try try.*
2826     ;;
2827 esac
2828 EOSC
2829
2830 : determine whether symbolic links are supported
2831 echo " "
2832 $touch blurfl
2833 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2834         echo "Symbolic links are supported." >&4
2835         lns="$ln -s"
2836 else
2837         echo "Symbolic links are NOT supported." >&4
2838         lns="$ln"
2839 fi
2840 $rm -f blurfl sym
2841
2842 : determine whether symbolic links are supported
2843 echo " "
2844 case "$lns" in
2845 *"ln"*" -s")
2846         echo "Checking how to test for symbolic links..." >&4
2847         $lns blurfl sym
2848         if $test "X$issymlink" = X; then
2849                 case "$newsh" in
2850                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2851                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2852                 esac
2853                 if test $? = 0; then
2854                         issymlink="test -h"
2855                 else
2856                         echo "Your builtin 'test -h' may be broken." >&4
2857                         case "$test" in
2858                         /*)     ;;
2859                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2860                                 for p in $pth
2861                                 do
2862                                         if test -f "$p/$test"; then
2863                                                 test="$p/$test"
2864                                                 break
2865                                         fi
2866                                 done
2867                                 ;;
2868                         esac
2869                         case "$test" in
2870                         /*)
2871                                 echo "Trying external '$test -h'." >&4
2872                                 issymlink="$test -h"
2873                                 if $test ! -h sym >/dev/null 2>&1; then
2874                                         echo "External '$test -h' is broken, too." >&4
2875                                         issymlink=''
2876                                 fi
2877                                 ;;
2878                         *)      issymlink='' ;;
2879                         esac
2880                 fi
2881         fi
2882         if $test "X$issymlink" = X; then
2883                 if $test -L sym 2>/dev/null; then
2884                         issymlink="$test -L"
2885                         echo "The builtin '$test -L' worked." >&4
2886                 fi
2887         fi
2888         if $test "X$issymlink" != X; then
2889                 echo "You can test for symbolic links with '$issymlink'." >&4
2890         else
2891                 echo "I do not know how you can test for symbolic links." >&4
2892         fi
2893         $rm -f blurfl sym
2894         ;;
2895 *)      echo "No symbolic links, so not testing for their testing..." >&4
2896         ;;
2897 esac
2898 echo " "
2899
2900 : Make symlinks util
2901 case "$mksymlinks" in
2902 $define|true|[yY]*)
2903         case "$src" in
2904         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2905                 exit 1
2906                 ;;
2907         *)      case "$lns:$issymlink" in
2908                 *"ln"*" -s:"*"test -"?)
2909                         echo "Creating the symbolic links..." >&4
2910                         cd ..
2911                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2912                         awk 'NF == 1 {
2913                                 dir=".";
2914                                 file=$1 "";
2915                              }
2916                              NF == 2 {
2917                                 dir=$1 "";
2918                                 file=$2 "";
2919                              }
2920                              {
2921                                  print "# dir = ", dir, "file = ", file
2922                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2923                              } END {
2924                                  for (d in mf) {
2925                                      if (d != ".") { print("mkdir -p "d) }
2926                                      print("ln -sf "mf[d]" "d);
2927                                  }
2928                              }' source="$src" > UU/mksymlinks.$$
2929                         sh UU/mksymlinks.$$
2930                         rm UU/mksymlinks.$$
2931                         # Sanity check 1.
2932                         if test ! -d t/base; then
2933                                 echo "Failed to create the subdirectories.  Aborting." >&4
2934                                 exit 1
2935                         fi
2936                         # Sanity check 2.
2937                         if test ! -f t/base/lex.t; then
2938                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2939                                 exit 1
2940                         fi
2941                         if test ! -f win32/win32.c; then
2942                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2943                                 exit 1
2944                         fi
2945                         cd UU
2946                         ;;
2947                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2948                         ;;
2949                 esac
2950                 ;;
2951         esac
2952         ;;
2953 esac
2954
2955 : Check for Cross-Compilation
2956 if $test "X$targethost" = "X"; then
2957     targethost=""
2958 fi
2959 if $test "X$targetenv" = "X"; then
2960     targetenv=""
2961 fi
2962 case "$usecrosscompile" in
2963 $define|true|[yY]*)
2964         $echo "Cross-compiling..."
2965         croak=''
2966         case "$cc" in
2967         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2968             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2969             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2970             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2971             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2972             # leave out ld, choosing it is more complex
2973             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2974             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2975             # We are in a weird spot. Just before us, some values
2976             # were 'saved', to be restored after the hints are
2977             # run.  This means that the changes we made to ar,
2978             # nm and ranlib will get reverted.
2979             # To avoid that, we hijack the saving mechanism and
2980             # have it save our new values.
2981             for file in ar nm ranlib; do
2982                 eval xxx=\$$file
2983                 eval $file=$xxx$_exe
2984                 eval _$file=$xxx
2985             done
2986         ;;
2987         esac
2988         case "$targetarch" in
2989         '') echo "Targetarch not defined." >&4; croak=y ;;
2990         *)  echo "Using targetarch $targetarch." >&4 ;;
2991         esac
2992         case "$targethost" in
2993         '') echo "Targethost not defined." >&4; croak=n ;;
2994         *)  echo "Using targethost $targethost." >&4
2995         esac
2996         locincpth=' '
2997         loclibpth=' '
2998         case "$croak" in
2999         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
3000         esac
3001     : compile a host miniperl and generate_uudmap, unless we got passed them
3002     if $test "X$hostperl" = X; then
3003       echo "Building host miniperl and generate_uudmap binaries" >&4
3004       before_host=`pwd`
3005       cd ..
3006       cd $src
3007       src=`pwd`
3008       rm -rf $src/host
3009       mkdir $src/host
3010       cd $src/host
3011       $src/Configure -des -Dusedevel -Dmksymlinks
3012       $make miniperl
3013       case "$hostgenerate" in
3014       '') $make generate_uudmap
3015           hostgenerate=$src/host/generate_uudmap
3016           ;;
3017        "$undef") hostgenerate=''
3018           ;;
3019       esac
3020       hostperl=$src/host/miniperl
3021       cd $before_host
3022     fi
3023     hostosname=`$hostperl -le 'print $^O'`
3024     ;;
3025 *)
3026     usecrosscompile="$undef"
3027     ;;
3028 esac
3029
3030 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3031 case "$targethost" in
3032     '') echo "Checking for cross-compile" >&4
3033     case "$usecrosscompile$multiarch" in
3034        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3035          if [ -f Makefile ]; then
3036            echo " "
3037            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3038          else
3039            echo "Configure done."
3040          fi
3041        exit 0
3042        ;;
3043      *) echo "No targethost for running compiler tests against defined, running locally" >&4
3044         run=''
3045         to=:
3046         from=:
3047         ;;
3048     esac
3049     ;;
3050     *) echo "Using targethost $targethost." >&4
3051         case "$src" in
3052         /*) run=$src/Cross/run
3053             targetmkdir=$src/Cross/mkdir
3054             to=$src/Cross/to
3055             from=$src/Cross/from
3056             ;;
3057         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3058             run=$pwd/Cross/run
3059             targetmkdir=$pwd/Cross/mkdir
3060             to=$pwd/Cross/to
3061             from=$pwd/Cross/from
3062             ;;
3063         esac
3064         case "$targetrun" in
3065         '') targetrun=ssh ;;
3066         esac
3067         case "$targetto" in
3068         '') targetto=scp ;;
3069         esac
3070         case "$targetfrom" in
3071         '') targetfrom=scp ;;
3072         esac
3073         run=$run-$targetrun
3074         to=$to-$targetto
3075         from=$from-$targetfrom
3076         case "$targetdir" in
3077         '')  targetdir=/tmp
3078              echo "Guessing targetdir $targetdir." >&4
3079              ;;
3080         esac
3081         case "$targetuser" in
3082         '')  targetuser=root
3083              echo "Guessing targetuser $targetuser." >&4
3084              ;;
3085         esac
3086         case "$targetport" in
3087         '')  targetport=22
3088              echo "Guessing targetport $targetport." >&4
3089              ;;
3090         esac
3091         case "$targetfrom" in
3092         scp)    q=-q ;;
3093         *)      q='' ;;
3094         esac
3095         case "$targetrun" in
3096         ssh|rsh)
3097             cat >$run <<EOF
3098 #!/bin/sh
3099 env=''
3100 case "\$1" in
3101 -cwd)
3102   shift
3103   cwd=\$1
3104   shift
3105   ;;
3106 esac
3107 case "\$1" in
3108 -env)
3109   shift
3110   env=\$1
3111   shift
3112   ;;
3113 esac
3114 case "\$cwd" in
3115 '') cwd=$targetdir ;;
3116 esac
3117 exe=\$1
3118 shift
3119 $to \$exe
3120 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3121 EOF
3122             ;;
3123         adb)
3124             $touch $run
3125             ;;
3126         *)  echo "Unknown targetrun '$targetrun'" >&4
3127             exit 1
3128             ;;
3129         esac
3130         case "$targetmkdir" in
3131         */Cross/mkdir)
3132             cat >$targetmkdir <<EOF
3133 #!/bin/sh
3134 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3135 EOF
3136             $chmod a+rx $targetmkdir
3137             ;;
3138         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3139             exit 1
3140             ;;
3141         esac
3142         case "$targetto" in
3143         scp|rcp)
3144             cat >$to <<EOF
3145 #!/bin/sh
3146 for f in \$@
3147 do
3148   case "\$f" in
3149   /*)
3150     $targetmkdir \`dirname \$f\`
3151     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3152     ;;
3153   *)
3154     $targetmkdir $targetdir/\`dirname \$f\`
3155     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3156     ;;
3157   esac
3158 done
3159 exit 0
3160 EOF
3161             ;;
3162         cp) cat >$to <<EOF
3163 #!/bin/sh
3164 for f in \$@
3165 do
3166   case "\$f" in
3167   /*)
3168     $mkdir -p $targetdir/\`dirname \$f\`
3169     $cp \$f $targetdir/\$f || exit 1
3170     ;;
3171   *)
3172     $targetmkdir $targetdir/\`dirname \$f\`
3173     $cp \$f $targetdir/\$f || exit 1
3174     ;;
3175   esac
3176 done
3177 exit 0
3178 EOF
3179             ;;
3180         *)  echo "Unknown targetto '$targetto'" >&4
3181             exit 1
3182             ;;
3183         esac
3184         case "$targetfrom" in
3185         scp|rcp)
3186           cat >$from <<EOF
3187 #!/bin/sh
3188 for f in \$@
3189 do
3190   $rm -f \$f
3191   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3192 done
3193 exit 0
3194 EOF
3195             ;;
3196         cp) cat >$from <<EOF
3197 #!/bin/sh
3198 for f in \$@
3199 do
3200   $rm -f \$f
3201   cp $targetdir/\$f . || exit 1
3202 done
3203 exit 0
3204 EOF
3205             ;;
3206         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3207             exit 1
3208             ;;
3209         esac
3210         if $test ! -f $run; then
3211             echo "Target 'run' script '$run' not found." >&4
3212         else
3213             $chmod a+rx $run
3214         fi
3215         if $test ! -f $to; then
3216             echo "Target 'to' script '$to' not found." >&4
3217         else
3218             $chmod a+rx $to
3219         fi
3220         if $test ! -f $from; then
3221             echo "Target 'from' script '$from' not found." >&4
3222         else
3223             $chmod a+rx $from
3224         fi
3225         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3226             exit 1
3227         fi
3228         cat >&4 <<EOF
3229 Using '$run' for remote execution,
3230 and '$from' and '$to'
3231 for remote file transfer.
3232 EOF
3233         ;;
3234 *)      run=''
3235         to=:
3236         from=:
3237         usecrosscompile="$undef"
3238         targetarch=''
3239         ;;
3240 esac
3241
3242 : see whether [:lower:] and [:upper:] are supported character classes
3243 echo " "
3244 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3245 ABYZ-abyz)
3246         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3247         up='[:upper:]'
3248         low='[:lower:]'
3249         ;;
3250 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3251         # (0xd9 and 0xe2), therefore that is a nice testing point.
3252         if test "X$up" = X -o "X$low" = X; then
3253             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3254             rs) up='[A-Z]'
3255                 low='[a-z]'
3256                 ;;
3257             esac
3258         fi
3259         if test "X$up" = X -o "X$low" = X; then
3260             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3261             rs) up='A-Z'
3262                 low='a-z'
3263                 ;;
3264             esac
3265         fi
3266         if test "X$up" = X -o "X$low" = X; then
3267             case "`echo RS | od -x 2>/dev/null`" in
3268             *D9E2*|*d9e2*)
3269                 echo "Hey, this might be EBCDIC." >&4
3270                 if test "X$up" = X -o "X$low" = X; then
3271                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3272                     rs) up='[A-IJ-RS-Z]'
3273                         low='[a-ij-rs-z]'
3274                         ;;
3275                     esac
3276                 fi
3277                 if test "X$up" = X -o "X$low" = X; then
3278                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3279                     rs) up='A-IJ-RS-Z'
3280                         low='a-ij-rs-z'
3281                         ;;
3282                     esac
3283                 fi
3284                 ;;
3285             esac
3286         fi
3287 esac
3288 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3289 rs)
3290     echo "Using $up and $low to convert case." >&4
3291     ;;
3292 *)
3293     echo "I don't know how to translate letters from upper to lower case." >&4
3294     echo "Your tr is not acting any way I know of." >&4
3295     exit 1
3296     ;;
3297 esac
3298 : set up the translation script tr, must be called with ./tr of course
3299 cat >tr <<EOSC
3300 $startsh
3301 case "\$1\$2" in
3302 '[A-Z][a-z]') exec $tr '$up' '$low';;
3303 '[a-z][A-Z]') exec $tr '$low' '$up';;
3304 esac
3305 exec $tr "\$@"
3306 EOSC
3307 chmod +x tr
3308 $eunicefix tr
3309
3310 : Try to determine whether config.sh was made on this system
3311 case "$config_sh" in
3312 '')
3313 myuname=`$uname -a 2>/dev/null`
3314 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3315 # Downcase everything to avoid ambiguity.
3316 # Remove slashes and single quotes so we can use parts of this in
3317 # directory and file names.
3318 # Remove newlines so myuname is sane to use elsewhere.
3319 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3320 # because the A-Z/a-z are not consecutive.
3321 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3322         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3323 newmyuname="$myuname"
3324 dflt=n
3325 case "$knowitall" in
3326 '')
3327         if test -f ../config.sh; then
3328                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3329                         eval "`grep myuname= ../config.sh`"
3330                 fi
3331                 if test "X$myuname" = "X$newmyuname"; then
3332                         dflt=y
3333                 fi
3334         fi
3335         ;;
3336 *) dflt=y;;
3337 esac
3338
3339 : Get old answers from old config file if Configure was run on the
3340 : same system, otherwise use the hints.
3341 hint=default
3342 cd ..
3343 if test -f config.sh; then
3344         echo " "
3345         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3346         . UU/myread
3347         case "$ans" in
3348         n*|N*) echo "OK, I'll ignore it."
3349                 mv config.sh config.sh.old
3350                 myuname="$newmyuname"
3351                 ;;
3352         *)  echo "Fetching default answers from your old config.sh file..." >&4
3353                 tmp_n="$n"
3354                 tmp_c="$c"
3355                 tmp_sh="$sh"
3356                 . ./config.sh
3357                 cp config.sh UU
3358                 n="$tmp_n"
3359                 c="$tmp_c"
3360                 : Older versions did not always set $sh.  Catch re-use of such
3361                 : an old config.sh.
3362                 case "$sh" in
3363                 '') sh="$tmp_sh" ;;
3364                 esac
3365                 hint=previous
3366                 ;;
3367         esac
3368 fi
3369 . ./UU/checkcc
3370 if test ! -f config.sh; then
3371         $cat <<EOM
3372
3373 First time through, eh?  I have some defaults handy for some systems
3374 that need some extra help getting the Configure answers right:
3375
3376 EOM
3377         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3378         dflt=''
3379         : Half the following guesses are probably wrong... If you have better
3380         : tests or hints, please send them to perlbug@perl.org
3381         : The metaconfig authors would also appreciate a copy...
3382         $test -f /irix && osname=irix
3383         $test -f /xenix && osname=sco_xenix
3384         $test -f /dynix && osname=dynix
3385         $test -f /dnix && osname=dnix
3386         $test -f /lynx.os && osname=lynxos
3387         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3388         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3389         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3390         $test -f /bin/mips && /bin/mips && osname=mips
3391         $test -d /usr/apollo/bin && osname=apollo
3392         $test -f /etc/saf/_sactab && osname=svr4
3393         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3394         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3395         $test -f /sys/utilities/MultiView && osname=amigaos
3396         if $test -d /MachTen -o -d /MachTen_Folder; then
3397                 osname=machten
3398                 if $test -x /sbin/version; then
3399                         osvers=`/sbin/version | $awk '{print $2}' |
3400                         $sed -e 's/[A-Za-z]$//'`
3401                 elif $test -x /usr/etc/version; then
3402                         osvers=`/usr/etc/version | $awk '{print $2}' |
3403                         $sed -e 's/[A-Za-z]$//'`
3404                 else
3405                         osvers="$2.$3"
3406                 fi
3407         fi
3408
3409         $test -f /sys/posix.dll &&
3410                 $test -f /usr/bin/what &&
3411                 set X `/usr/bin/what /sys/posix.dll` &&
3412                 $test "$3" = UWIN &&
3413                 osname=uwin &&
3414                 osvers="$5"
3415
3416         if $test -f $uname; then
3417                 set X $myuname
3418                 shift
3419
3420                 case "$5" in
3421                 fps*) osname=fps ;;
3422                 mips*)
3423                         case "$4" in
3424                         umips) osname=umips ;;
3425                         *) osname=mips ;;
3426                         esac;;
3427                 [23]100) osname=mips ;;
3428                 i386*)
3429                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3430                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3431                                 osname='sco'
3432                                 osvers=$tmp
3433                         elif $test -f /etc/kconfig; then
3434                                 osname=isc
3435                                 if test "$lns" = "$ln -s"; then
3436                                         osvers=4
3437                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3438                                         osvers=3
3439                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3440                                         osvers=2
3441                                 fi
3442                         fi
3443                         tmp=''
3444                         ;;
3445                 pc*)
3446                         if test -n "$DJGPP"; then
3447                                 osname=dos
3448                                 osvers=djgpp
3449                         fi
3450                         ;;
3451                 esac
3452
3453                 case "$1" in
3454                 aix) osname=aix
3455                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3456                         case "$tmp" in
3457                         # oslevel can fail with:
3458                         # oslevel: Unable to acquire lock.
3459                         *not\ found) osvers="$4"."$3" ;;
3460                         '<3240'|'<>3240') osvers=3.2.0 ;;
3461                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3462                         '=3250'|'>3250') osvers=3.2.5 ;;
3463                         *) osvers=$tmp;;
3464                         esac
3465                         ;;
3466                 bitrig) osname=bitrig
3467                         osvers="$3"
3468                         ;;
3469                 bsd386) osname=bsd386
3470                         osvers=`$uname -r`
3471                         ;;
3472                 cygwin*) osname=cygwin
3473                         osvers="$3"
3474                         ;;
3475                 *dc.osx) osname=dcosx
3476                         osvers="$3"
3477                         ;;
3478                 dnix) osname=dnix
3479                         osvers="$3"
3480                         ;;
3481                 domainos) osname=apollo
3482                         osvers="$3"
3483                         ;;
3484                 dgux)   osname=dgux
3485                         osvers="$3"
3486                         ;;
3487                 dragonfly) osname=dragonfly
3488                         osvers="$3"
3489                         ;;
3490                 dynixptx*) osname=dynixptx
3491                         osvers=`echo "$4"|sed 's/^v//'`
3492                         ;;
3493                 freebsd) osname=freebsd
3494                         osvers="$3" ;;
3495                 genix)  osname=genix ;;
3496                 gnu)    osname=gnu
3497                         osvers="$3" ;;
3498                 hp*)    osname=hpux
3499                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3500                         ;;
3501                 irix*)  osname=irix
3502                         case "$3" in
3503                         4*) osvers=4 ;;
3504                         5*) osvers=5 ;;
3505                         *)      osvers="$3" ;;
3506                         esac
3507                         ;;
3508                 linux)  osname=linux
3509                         case "$3" in
3510                         *)      osvers="$3" ;;
3511                         esac
3512                         $test -f /system/lib/libandroid.so && osname=linux-android
3513                         ;;
3514                 MiNT)   osname=mint
3515                         ;;
3516                 netbsd*) osname=netbsd
3517                         osvers="$3"
3518                         ;;
3519                 news-os) osvers="$3"
3520                         case "$3" in
3521                         4*) osname=newsos4 ;;
3522                         *) osname=newsos ;;
3523                         esac
3524                         ;;
3525                 nonstop-ux) osname=nonstopux ;;
3526                 openbsd) osname=openbsd
3527                         osvers="$3"
3528                         ;;
3529                 os2)    osname=os2
3530                         osvers="$4"
3531                         ;;
3532                 POSIX-BC | posix-bc ) osname=posix-bc
3533                         osvers="$3"
3534                         ;;
3535                 powerux | power_ux | powermax_os | powermaxos | \
3536                 powerunix | power_unix) osname=powerux
3537                         osvers="$3"
3538                         ;;
3539                 qnx) osname=qnx
3540                         osvers="$4"
3541                         ;;
3542                 solaris) osname=solaris
3543                         case "$3" in
3544                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3545                         *)      osvers="$3" ;;
3546                         esac
3547                         ;;
3548                 sunos) osname=sunos
3549                         case "$3" in
3550                         5*) osname=solaris
3551                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3552                         *)      osvers="$3" ;;
3553                         esac
3554                         ;;
3555                 titanos) osname=titanos
3556                         case "$3" in
3557                         1*) osvers=1 ;;
3558                         2*) osvers=2 ;;
3559                         3*) osvers=3 ;;
3560                         4*) osvers=4 ;;
3561                         *)      osvers="$3" ;;
3562                         esac
3563                         ;;
3564                 ultrix) osname=ultrix
3565                         osvers="$3"
3566                         ;;
3567                 osf1|mls+)      case "$5" in
3568                                 alpha)
3569                                         osname=dec_osf
3570                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3571                                         case "$osvers" in
3572                                         [1-9].[0-9]*) ;;
3573                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3574                                         esac
3575                                         ;;
3576                         hp*)    osname=hp_osf1  ;;
3577                         mips)   osname=mips_osf1 ;;
3578                         esac
3579                         ;;
3580                 # UnixWare 7.1.2 is known as Open UNIX 8
3581                 openunix|unixware) osname=svr5
3582                         osvers="$4"
3583                         ;;
3584                 uts)    osname=uts
3585                         osvers="$3"
3586                         ;;
3587                 vos) osvers="$3"
3588                         ;;
3589                 $2) case "$osname" in
3590                         *isc*) ;;
3591                         *freebsd*) ;;
3592                         svr*)
3593                                 : svr4.x or possibly later
3594                                 case "svr$3" in
3595                                 ${osname}*)
3596                                         osname=svr$3
3597                                         osvers=$4
3598                                         ;;
3599                                 esac
3600                                 case "$osname" in
3601                                 svr4.0)
3602                                         : Check for ESIX
3603                                         if test -f /stand/boot ; then
3604                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3605                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3606                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3607                                                         if test -n "$isesix"; then
3608                                                                 osname=esix4
3609                                                         fi
3610                                                 fi
3611                                         fi
3612                                         ;;
3613                                 esac
3614                                 ;;
3615                         *)      if test -f /etc/systemid; then
3616                                         osname=sco
3617                                         set `echo $3 | $sed 's/\./ /g'` $4
3618                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3619                                                 osvers=$1.$2.$3
3620                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3621                                                 osvers=$1.$2
3622                                         elif $test -f $src/hints/sco_$1.sh; then
3623                                                 osvers=$1
3624                                         fi
3625                                 else
3626                                         case "$osname" in
3627                                         '') : Still unknown.  Probably a generic Sys V.
3628                                                 osname="sysv"
3629                                                 osvers="$3"
3630                                                 ;;
3631                                         esac
3632                                 fi
3633                                 ;;
3634                         esac
3635                         ;;
3636                 *)      case "$osname" in
3637                         '') : Still unknown.  Probably a generic BSD.
3638                                 osname="$1"
3639                                 osvers="$3"
3640                                 ;;
3641                         esac
3642                         ;;
3643                 esac
3644         else
3645                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3646                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3647                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3648                                 osname=news_os
3649                         fi
3650                         $rm -f UU/kernel.what
3651                 elif test -d c:/. -o -n "$is_os2" ; then
3652                         set X $myuname
3653                         osname=os2
3654                         osvers="$5"
3655                 fi
3656         fi
3657
3658         case "$targetarch" in
3659         '') ;;
3660         *)  hostarch=$osname
3661             case "$targetarch" in
3662                 nto*|*-nto-*)
3663                     # Will load qnx.sh, which should change osname to nto
3664                     osname=qnx
3665                     osvers=''
3666                     ;;
3667                 *linux-android*)
3668                     # Catch arm-linux-androideabi, mipsel-linux-android,
3669                     # and i686-linux-android
3670                     osname=linux-android
3671                     osvers=''
3672                     ;;
3673                 *linux*)
3674                     # Something like arm-linux-gnueabihf is really just
3675                     # plain linux.
3676                     osname=linux
3677                     osvers=''
3678                     ;;
3679                 *solaris*|*sunos*)
3680                     osname=solaris
3681                     # XXX perhaps we should just assume
3682                     # osvers to be 2, or maybe take the value
3683                     # from targetarch. Using $run before the
3684                     # hints are run is somewhat icky.
3685                     set X `$run $uname -a 2>/dev/null`
3686                     shift
3687                     case "$3" in
3688                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3689                         *)  osvers="$3" ;;
3690                     esac
3691                     ;;
3692                 *)
3693                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3694                     osvers=''
3695                 ;;
3696             esac
3697             ;;
3698         esac
3699
3700         : Now look for a hint file osname_osvers, unless one has been
3701         : specified already.
3702         case "$hintfile" in
3703         ''|' ')
3704                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3705                 : Also try without trailing minor version numbers.
3706                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3707                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3708                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3709                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3710                 case "$file" in
3711                 '') dflt=none ;;
3712                 *)  case "$osvers" in
3713                         '') dflt=$file
3714                                 ;;
3715                         *)  if $test -f $src/hints/$file.sh ; then
3716                                         dflt=$file
3717                                 elif $test -f $src/hints/$xfile.sh ; then
3718                                         dflt=$xfile
3719                                 elif $test -f $src/hints/$xxfile.sh ; then
3720                                         dflt=$xxfile
3721                                 elif $test -f $src/hints/$xxxfile.sh ; then
3722                                         dflt=$xxxfile
3723                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3724                                         dflt=$xxxxfile
3725                                 elif $test -f "$src/hints/${osname}.sh" ; then
3726                                         dflt="${osname}"
3727                                 else
3728                                         dflt=none
3729                                 fi
3730                                 ;;
3731                         esac
3732                         ;;
3733                 esac
3734                 if $test -f Policy.sh ; then
3735                         case "$dflt" in
3736                         *Policy*) ;;
3737                         none) dflt="Policy" ;;
3738                         *) dflt="Policy $dflt" ;;
3739                         esac
3740                 fi
3741                 ;;
3742         *)
3743                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3744                 ;;
3745         esac
3746
3747         if $test -f Policy.sh ; then
3748                 $cat <<EOM
3749
3750 There's also a Policy hint file available, which should make the
3751 site-specific (policy) questions easier to answer.
3752 EOM
3753
3754         fi
3755
3756         $cat <<EOM
3757
3758 You may give one or more space-separated answers, or "none" if appropriate.
3759 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3760 previous run of Configure, you may specify it as well as or instead of
3761 OS-specific hints.  If hints are provided for your OS, you should use them:
3762 although Perl can probably be built without hints on many platforms, using
3763 hints often improve performance and may enable features that Configure can't
3764 set up on its own. If there are no hints that match your OS, specify "none";
3765 DO NOT give a wrong version or a wrong OS.
3766
3767 EOM
3768
3769         rp="Which of these apply, if any?"
3770         . UU/myread
3771         tans=$ans
3772         for file in $tans; do
3773                 if $test X$file = XPolicy -a -f Policy.sh; then
3774                         . Policy.sh
3775                         $cat Policy.sh >> UU/config.sh
3776                 elif $test -f $src/hints/$file.sh; then
3777                         . $src/hints/$file.sh
3778                         $cat $src/hints/$file.sh >> UU/config.sh
3779                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3780                         : nothing
3781                 else
3782                         : Give one chance to correct a possible typo.
3783                         echo "$file.sh does not exist"
3784                         dflt=$file
3785                         rp="hint to use instead?"
3786                         . UU/myread
3787                         for file in $ans; do
3788                                 if $test -f "$src/hints/$file.sh"; then
3789                                         . $src/hints/$file.sh
3790                                         $cat $src/hints/$file.sh >> UU/config.sh
3791                                 elif $test X$ans = X -o X$ans = Xnone ; then
3792                                         : nothing
3793                                 else
3794                                         echo "$file.sh does not exist -- ignored."
3795                                 fi
3796                         done
3797                 fi
3798         done
3799
3800         hint=recommended
3801         : Remember our hint file for later.
3802         if $test -f "$src/hints/$file.sh" ; then
3803                 hintfile="$file"
3804         else
3805                 hintfile=''
3806         fi
3807 fi
3808 cd UU
3809 ;;
3810 *)
3811         echo " "
3812         echo "Fetching default answers from $config_sh..." >&4
3813         tmp_n="$n"
3814         tmp_c="$c"
3815         cd ..
3816         cp $config_sh config.sh 2>/dev/null
3817         chmod +w config.sh
3818         . ./config.sh
3819         cd UU
3820         cp ../config.sh .
3821         n="$tmp_n"
3822         c="$tmp_c"
3823         hint=previous
3824         ;;
3825 esac
3826 . ./optdef.sh
3827
3828 : Restore computed paths
3829 for file in $loclist $trylist; do
3830         eval $file="\$_$file"
3831 done
3832
3833 cat << EOM
3834
3835 Configure uses the operating system name and version to set some defaults.
3836 The default value is probably right if the name rings a bell. Otherwise,
3837 since spelling matters for me, either accept the default or answer "none"
3838 to leave it blank.
3839
3840 EOM
3841 case "$osname" in
3842         ''|' ')
3843                 case "$hintfile" in
3844                 ''|' '|none) dflt=none ;;
3845                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3846                 esac
3847                 ;;
3848         *) dflt="$osname" ;;
3849 esac
3850 rp="Operating system name?"
3851 . ./myread
3852 case "$ans" in
3853 none)  osname='' ;;
3854 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3855 esac
3856 echo " "
3857 case "$osvers" in
3858         ''|' ')
3859                 case "$hintfile" in
3860                 ''|' '|none) dflt=none ;;
3861                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3862                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3863                         case "$dflt" in
3864                         ''|' ') dflt=none ;;
3865                         esac
3866                         ;;
3867                 esac
3868                 ;;
3869         *) dflt="$osvers" ;;
3870 esac
3871 rp="Operating system version?"
3872 . ./myread
3873 case "$ans" in
3874 none)  osvers='' ;;
3875 *) osvers="$ans" ;;
3876 esac
3877
3878
3879 . ./posthint.sh
3880
3881 : who configured the system
3882 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3883 case "$cf_by" in
3884 "")
3885         cf_by=`(logname) 2>/dev/null`
3886         case "$cf_by" in
3887         "")
3888                 cf_by=`(whoami) 2>/dev/null`
3889                 case "$cf_by" in
3890                 "") cf_by=unknown ;;
3891                 esac ;;
3892         esac ;;
3893 esac
3894
3895 : decide how portable to be.  Allow command line overrides.
3896 case "$d_portable" in
3897 "$undef") ;;
3898 *)      d_portable="$define" ;;
3899 esac
3900
3901 : set up shell script to do ~ expansion
3902 cat >filexp <<EOSS
3903 $startsh
3904 : expand filename
3905 case "\$1" in
3906  \~/*|\~)
3907         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3908         ;;
3909  \~*)
3910         if $test -f /bin/csh; then
3911                 /bin/csh -f -c "glob \$1"
3912                 failed=\$?
3913                 echo ""
3914                 exit \$failed
3915         else
3916                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3917                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3918                 if $test ! -d "\$dir"; then
3919                         me=\`basename \$0\`
3920                         echo "\$me: can't locate home directory for: \$name" >&2
3921                         exit 1
3922                 fi
3923                 case "\$1" in
3924                 */*)
3925                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3926                         ;;
3927                 *)
3928                         echo \$dir
3929                         ;;
3930                 esac
3931         fi
3932         ;;
3933 *)
3934         echo \$1
3935         ;;
3936 esac
3937 EOSS
3938 chmod +x filexp
3939 $eunicefix filexp
3940
3941 : now set up to get a file name
3942 cat <<EOS >getfile
3943 $startsh
3944 EOS
3945 cat <<'EOSC' >>getfile
3946 tilde=''
3947 fullpath=''
3948 already=''
3949 skip=''
3950 none_ok=''
3951 exp_file=''
3952 nopath_ok=''
3953 orig_rp="$rp"
3954 orig_dflt="$dflt"
3955 case "$gfpth" in
3956 '') gfpth='.' ;;
3957 esac
3958
3959 case "$fn" in
3960 *\(*)
3961         : getfile will accept an answer from the comma-separated list
3962         : enclosed in parentheses even if it does not meet other criteria.
3963         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3964         fn=`echo $fn | sed 's/(.*)//'`
3965         ;;
3966 esac
3967
3968 case "$fn" in
3969 *:*)
3970         loc_file=`expr $fn : '.*:\(.*\)'`
3971         fn=`expr $fn : '\(.*\):.*'`
3972         ;;
3973 esac
3974
3975 case "$fn" in
3976 *~*) tilde=true;;
3977 esac
3978 case "$fn" in
3979 */*) fullpath=true;;
3980 esac
3981 case "$fn" in
3982 *+*) skip=true;;
3983 esac
3984 case "$fn" in
3985 *n*) none_ok=true;;
3986 esac
3987 case "$fn" in
3988 *e*) exp_file=true;;
3989 esac
3990 case "$fn" in
3991 *p*) nopath_ok=true;;
3992 esac
3993
3994 case "$fn" in
3995 *f*) type='File';;
3996 *d*) type='Directory';;
3997 *l*) type='Locate';;
3998 esac
3999
4000 what="$type"
4001 case "$what" in
4002 Locate) what='File';;
4003 esac
4004
4005 case "$exp_file" in
4006 '')
4007         case "$d_portable" in
4008         "$define") ;;
4009         *) exp_file=true;;
4010         esac
4011         ;;
4012 esac
4013
4014 cd ..
4015 while test "$type"; do
4016         redo=''
4017         rp="$orig_rp"
4018         dflt="$orig_dflt"
4019         case "$tilde" in
4020         true) rp="$rp (~name ok)";;
4021         esac
4022         . UU/myread
4023         if test -f UU/getfile.ok && \
4024                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4025         then
4026                 value="$ans"
4027                 ansexp="$ans"
4028                 break
4029         fi
4030         case "$ans" in
4031         none)
4032                 value=''
4033                 ansexp=''
4034                 case "$none_ok" in
4035                 true) type='';;
4036                 esac
4037                 ;;
4038         *)
4039                 case "$tilde" in
4040                 '') value="$ans"
4041                         ansexp="$ans";;
4042                 *)
4043                         value=`UU/filexp $ans`
4044                         case $? in
4045                         0)
4046                                 if test "$ans" != "$value"; then
4047                                         echo "(That expands to $value on this system.)"
4048                                 fi
4049                                 ;;
4050                         *) value="$ans";;
4051                         esac
4052                         ansexp="$value"
4053                         case "$exp_file" in
4054                         '') value="$ans";;
4055                         esac
4056                         ;;
4057                 esac
4058                 case "$fullpath" in
4059                 true)
4060                         case "$ansexp" in
4061                         /*) value="$ansexp" ;;
4062                         [a-zA-Z]:/*) value="$ansexp" ;;
4063                         *)
4064                                 redo=true
4065                                 case "$already" in
4066                                 true)
4067                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4068                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4069                                         ;;
4070                                 *)
4071                                 echo "Please give a full path name, starting with slash." >&4
4072                                         case "$tilde" in
4073                                         true)
4074                                 echo "Note that using ~name is ok provided it expands well." >&4
4075                                                 already=true
4076                                                 ;;
4077                                         esac
4078                                 esac
4079                                 ;;
4080                         esac
4081                         ;;
4082                 esac
4083                 case "$redo" in
4084                 '')
4085                         case "$type" in
4086                         File)
4087                                 for fp in $gfpth; do
4088                                         if test "X$fp" = X.; then
4089                                             pf="$ansexp"
4090                                         else    
4091                                             pf="$fp/$ansexp"
4092                                         fi
4093                                         if test -f "$pf"; then
4094                                                 type=''
4095                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4096                                         then
4097                                                 echo "($value is not a plain file, but that's ok.)"
4098                                                 type=''
4099                                         fi
4100                                         if test X"$type" = X; then
4101                                             value="$pf"
4102                                             break
4103                                         fi
4104                                 done
4105                                 ;;
4106                         Directory)
4107                                 for fp in $gfpth; do
4108                                         if test "X$fp" = X.; then
4109                                             dir="$ans"
4110                                             direxp="$ansexp"
4111                                         else    
4112                                             dir="$fp/$ansexp"
4113                                             direxp="$fp/$ansexp"
4114                                         fi
4115                                         if test -d "$direxp"; then
4116                                                 type=''
4117                                                 value="$dir"
4118                                                 break
4119                                         fi
4120                                 done
4121                                 ;;
4122                         Locate)
4123                                 if test -d "$ansexp"; then
4124                                         echo "(Looking for $loc_file in directory $value.)"
4125                                         value="$value/$loc_file"
4126                                         ansexp="$ansexp/$loc_file"
4127                                 fi
4128                                 if test -f "$ansexp"; then
4129                                         type=''
4130                                 fi
4131                                 case "$nopath_ok" in
4132                                 true)   case "$value" in
4133                                         */*) ;;
4134                                         *)      echo "Assuming $value will be in people's path."
4135                                                 type=''
4136                                                 ;;
4137                                         esac
4138                                         ;;
4139                                 esac
4140                                 ;;
4141                         esac
4142
4143                         case "$skip" in
4144                         true) type='';
4145                         esac
4146
4147                         case "$type" in
4148                         '') ;;
4149                         *)
4150                                 if test "$fastread" = yes; then
4151                                         dflt=y
4152                                 else
4153                                         dflt=n
4154                                 fi
4155                                 rp="$what $value doesn't exist.  Use that name anyway?"
4156                                 . UU/myread
4157                                 dflt=''
4158                                 case "$ans" in
4159                                 y*) type='';;
4160                                 *) echo " ";;
4161                                 esac
4162                                 ;;
4163                         esac
4164                         ;;
4165                 esac
4166                 ;;
4167         esac
4168 done
4169 cd UU
4170 ans="$value"
4171 rp="$orig_rp"
4172 dflt="$orig_dflt"
4173 rm -f getfile.ok
4174 test "X$gfpthkeep" != Xy && gfpth=""
4175 EOSC
4176
4177 : determine root of directory hierarchy where package will be installed.
4178 case "$prefix" in
4179 '')
4180         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4181         ;;
4182 *?/)
4183         dflt=`echo "$prefix" | sed 's/.$//'`
4184         ;;
4185 *)
4186         dflt="$prefix"
4187         ;;
4188 esac
4189 $cat <<EOM
4190
4191 By default, $package will be installed in $dflt/bin, manual pages
4192 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4193 installation directories. Typically this is something like /usr/local.
4194 If you wish to have binaries under /usr/bin but other parts of the
4195 installation under /usr/local, that's ok: you will be prompted
4196 separately for each of the installation directories, the prefix being
4197 only used to set the defaults.
4198
4199 EOM
4200 fn=d~
4201 rp='Installation prefix to use?'
4202 . ./getfile
4203 oldprefix=''
4204 case "$prefix" in
4205 '') ;;
4206 *)
4207         case "$ans" in
4208         "$prefix") ;;
4209         *) oldprefix="$prefix";;
4210         esac
4211         ;;
4212 esac
4213 prefix="$ans"
4214 prefixexp="$ansexp"
4215
4216 : allow them to override the AFS root
4217 case "$afsroot" in
4218 '')     afsroot=/afs ;;
4219 *)      afsroot=$afsroot ;;
4220 esac
4221
4222 : is AFS running?
4223 echo " "
4224 case "$afs" in
4225 $define|true)   afs=true ;;
4226 $undef|false)   afs=false ;;
4227 *)      if $test -d $afsroot; then
4228                 afs=true
4229         else
4230                 afs=false
4231         fi
4232         ;;
4233 esac
4234 if $afs; then
4235         echo "AFS may be running... I'll be extra cautious then..." >&4
4236 else
4237         echo "AFS does not seem to be running..." >&4
4238 fi
4239
4240 : determine installation prefix for where package is to be installed.
4241 if $afs; then
4242 $cat <<EOM
4243
4244 Since you are running AFS, I need to distinguish the directory in which
4245 files will reside from the directory in which they are installed (and from
4246 which they are presumably copied to the former directory by occult means).
4247
4248 EOM
4249         case "$installprefix" in
4250         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4251         *) dflt="$installprefix";;
4252         esac
4253 else
4254 $cat <<EOM
4255
4256 In some special cases, particularly when building $package for distribution,
4257 it is convenient to distinguish the directory in which files should be
4258 installed from the directory ($prefix) in which they will
4259 eventually reside.  For most users, these two directories are the same.
4260
4261 EOM
4262         case "$installprefix" in
4263         '') dflt=$prefix ;;
4264         *) dflt=$installprefix;;
4265         esac
4266 fi
4267 fn=d~
4268 rp='What installation prefix should I use for installing files?'
4269 . ./getfile
4270 installprefix="$ans"
4271 installprefixexp="$ansexp"
4272
4273 : Perform the prefixexp/installprefixexp correction if necessary
4274 cat <<EOS >installprefix
4275 $startsh
4276 EOS
4277 cat <<'EOSC' >>installprefix
4278 : Change installation prefix, if necessary.
4279 if $test X"$prefix" != X"$installprefix"; then
4280     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4281 else
4282     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4283 fi
4284 EOSC
4285 chmod +x installprefix
4286 $eunicefix installprefix
4287
4288 : Set variables such as privlib and privlibexp from the output of ./getfile
4289 : performing the prefixexp/installprefixexp correction if necessary.
4290 cat <<EOS >setprefixvar
4291 $startsh
4292 EOS
4293 cat <<'EOSC' >>setprefixvar
4294 eval "${prefixvar}=\"\$ans\""
4295 eval "${prefixvar}exp=\"\$ansexp\""
4296 . ./installprefix
4297 EOSC
4298 chmod +x setprefixvar
4299 $eunicefix setprefixvar
4300
4301 : set up the script used to warn in case of inconsistency
4302 cat <<EOS >whoa
4303 $startsh
4304 EOS
4305 cat <<'EOSC' >>whoa
4306 dflt=y
4307 case "$hint" in
4308     recommended)
4309         case "$hintfile" in
4310         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4311                 ;;
4312         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4313                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4314                 ;;
4315         esac
4316         ;;
4317     *)  echo " "
4318         echo "*** WHOA THERE!!! ***" >&4
4319         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4320         ;;
4321 esac
4322 rp="    Keep the $hint value?"
4323 . ./myread
4324 case "$ans" in
4325 y) td=$was; tu=$was;;
4326 esac
4327 EOSC
4328
4329 : function used to set '$1' to '$val'
4330 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4331 case "$val$was" in
4332 $define$undef) . ./whoa; eval "$var=\$td";;
4333 $undef$define) . ./whoa; eval "$var=\$tu";;
4334 *) eval "$var=$val";;
4335 esac'
4336
4337 : get the patchlevel
4338 echo " "
4339 echo "Getting the current patchlevel..." >&4
4340 if $test -r $rsrc/patchlevel.h;then
4341         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4342         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4343         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4344         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4345         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4346         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4347         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4348 else
4349         revision=0
4350         patchlevel=0
4351         subversion=0
4352         api_revision=0
4353         api_version=0
4354         api_subversion=0
4355         perl_patchlevel=0
4356         $echo "(You do not have patchlevel.h.  Eek.)"
4357 fi
4358 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4359 version_patchlevel_string="version $patchlevel subversion $subversion"
4360 case "$perl_patchlevel" in
4361 0|'') ;;
4362 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4363     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4364     ;;
4365 esac
4366
4367 $echo "(You have $package $version_patchlevel_string.)"
4368
4369 case "$osname" in
4370 dos|vms)
4371         : XXX Should be a Configure test for double-dots in filenames.
4372         version=`echo $revision $patchlevel $subversion | \
4373                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4374         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4375                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4376         ;;
4377 *)
4378         version=`echo $revision $patchlevel $subversion | \
4379                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4380         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4381                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4382         ;;
4383 esac
4384 : Special case the 5.005_xx maintenance series, which used 5.005
4385 : without any subversion label as a subdirectory in $sitelib
4386 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4387         api_versionstring='5.005'
4388 fi
4389
4390 : Do we want threads support and if so, what type
4391 case "$usethreads" in
4392 $define|true|[yY]*)     dflt='y';;
4393 *)     # Catch case where user specified ithreads or 5005threads but
4394        # forgot -Dusethreads (A.D. 4/2002)
4395        case "$useithreads$use5005threads" in
4396        *$define*)       dflt='y';;
4397        *)               dflt='n';;
4398        esac
4399        ;;
4400 esac
4401 cat <<EOM
4402
4403 Perl can be built to offer a form of threading support on some systems
4404 To do so, Configure can be run with -Dusethreads.
4405
4406 Note that Perl built with threading support runs slightly slower
4407 and uses slightly more memory than plain Perl.
4408
4409 If this doesn't make any sense to you, just accept the default '$dflt'.
4410 EOM
4411 rp='Build a threading Perl?'
4412 . ./myread
4413 case "$ans" in
4414 y|Y)    val="$define" ;;
4415 *)      val="$undef" ;;
4416 esac
4417 set usethreads
4418 eval $setvar
4419
4420 if $test $patchlevel -lt 9; then
4421     case "$usethreads" in
4422     $define)
4423         : Default to ithreads unless overridden on command line or with
4424         : old config.sh
4425         dflt='y'
4426         case "$use5005threads" in
4427                 $define|true|[yY]*)
4428                         echo "5.005 threads are no longer supported"
4429                         exit 1
4430                 ;;
4431         esac
4432         case "$useithreads" in
4433                 $undef|false|[nN]*) dflt='n';;
4434         esac
4435         rp='Use the newer interpreter-based ithreads?'
4436         . ./myread
4437         case "$ans" in
4438         y|Y)    val="$define" ;;
4439         *)      val="$undef" ;;
4440         esac
4441         set useithreads
4442         eval $setvar
4443         : Now set use5005threads to the opposite value.
4444         case "$useithreads" in
4445         $define) val="$undef" ;;
4446         *) val="$define" ;;
4447         esac
4448         set use5005threads
4449         eval $setvar
4450         ;;
4451     *)
4452         useithreads="$undef"
4453         use5005threads="$undef"
4454         ;;
4455     esac
4456
4457     case "$useithreads$use5005threads" in
4458     "$define$define")
4459         $cat >&4 <<EOM
4460
4461 You cannot have both the ithreads and the 5.005 threads enabled
4462 at the same time.  Disabling the 5.005 threads since they are
4463 much less stable than the ithreads.
4464
4465 EOM
4466         use5005threads="$undef"
4467         ;;
4468     esac
4469
4470 else
4471 : perl-5.9.x and later
4472
4473     if test X"$usethreads" = "X$define"; then
4474         case "$use5005threads" in
4475             $define|true|[yY]*)
4476                 $cat >&4 <<EOM
4477
4478 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4479
4480 EOM
4481             ;;
4482         esac
4483     fi
4484
4485     use5005threads="$undef"
4486     useithreads="$usethreads"
4487 fi
4488
4489 case "$d_oldpthreads" in
4490 '')     : Configure tests would be welcome here.  For now, assume undef.
4491         val="$undef" ;;
4492 *)      val="$d_oldpthreads" ;;
4493 esac
4494 set d_oldpthreads
4495 eval $setvar
4496
4497
4498 : Look for a hint-file generated 'call-back-unit'.  If the
4499 : user has specified that a threading perl is to be built,
4500 : we may need to set or change some other defaults.
4501 if $test -f usethreads.cbu; then
4502     echo "Your platform has some specific hints regarding threaded builds, using them..."
4503     . ./usethreads.cbu
4504 else
4505     case "$usethreads" in
4506         "$define"|true|[yY]*)
4507                 $cat <<EOM
4508 (Your platform does not have any specific hints for threaded builds.
4509  Assuming POSIX threads, then.)
4510 EOM
4511         ;;
4512     esac
4513 fi
4514
4515 : Check if multiplicity is required
4516 cat <<EOM
4517
4518 Perl can be built so that multiple Perl interpreters can coexist
4519 within the same Perl executable.
4520 EOM
4521
4522 case "$useithreads" in
4523 $define)
4524         cat <<EOM
4525 This multiple interpreter support is required for interpreter-based threads.
4526 EOM
4527         val="$define"
4528         ;;
4529 *)      case "$usemultiplicity" in
4530         $define|true|[yY]*)     dflt='y';;
4531         *) dflt='n';;
4532         esac
4533         echo " "
4534         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4535         rp='Build Perl for multiplicity?'
4536         . ./myread
4537         case "$ans" in
4538         y|Y)    val="$define" ;;
4539         *)      val="$undef" ;;
4540         esac
4541         ;;
4542 esac
4543 set usemultiplicity
4544 eval $setvar
4545
4546 : Check if morebits is requested
4547 case "$usemorebits" in
4548 "$define"|true|[yY]*)
4549         use64bitint="$define"
4550         uselongdouble="$define"
4551         usemorebits="$define"
4552         ;;
4553 *)      usemorebits="$undef"
4554         ;;
4555 esac
4556
4557 : Determine the C compiler to be used
4558 echo " "
4559 case "$cc" in
4560 '') dflt=cc;;
4561 *) dflt="$cc";;
4562 esac
4563 rp="Use which C compiler?"
4564 . ./myread
4565 cc="$ans"
4566
4567 : See whether they have no cc but they do have gcc
4568 . ./trygcc
4569 if $test -f cc.cbu; then
4570     . ./cc.cbu
4571 fi
4572 . ./checkcc
4573
4574 : make some quick guesses about what we are up against
4575 echo " "
4576 $echo $n "Hmm...  $c"
4577 echo exit 1 >bsd
4578 echo exit 1 >usg
4579 echo exit 1 >v7
4580 echo exit 1 >osf1
4581 echo exit 1 >eunice
4582 echo exit 1 >xenix
4583 echo exit 1 >venix
4584 echo exit 1 >os2
4585 d_bsd="$undef"
4586 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4587 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4588 then
4589         echo "Looks kind of like an OSF/1 system, but we'll see..."
4590         echo exit 0 >osf1
4591 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4592         xxx=`./loc addbib blurfl $pth`
4593         if $test -f $xxx; then
4594         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4595                 echo exit 0 >bsd
4596                 echo exit 0 >usg
4597         else
4598                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4599                         echo "Looks kind of like an extended USG system, but we'll see..."
4600                 else
4601                         echo "Looks kind of like a USG system, but we'll see..."
4602                 fi
4603                 echo exit 0 >usg
4604         fi
4605 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4606         echo "Looks kind of like a BSD system, but we'll see..."
4607         d_bsd="$define"
4608         echo exit 0 >bsd
4609 else
4610         echo "Looks kind of like a Version 7 system, but we'll see..."
4611         echo exit 0 >v7
4612 fi
4613 case "$eunicefix" in
4614 *unixtovms*)
4615         $cat <<'EOI'
4616 There is, however, a strange, musty smell in the air that reminds me of
4617 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4618 EOI
4619         echo exit 0 >eunice
4620         d_eunice="$define"
4621 : it so happens the Eunice I know will not run shell scripts in Unix format
4622         ;;
4623 *)
4624         echo " "
4625         echo "Congratulations.  You aren't running Eunice."
4626         d_eunice="$undef"
4627         ;;
4628 esac
4629 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4630 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4631 : semicolon as a patch separator
4632 case "$p_" in
4633 :) ;;
4634 *)
4635         $cat <<'EOI'
4636 I have the feeling something is not exactly right, however...don't tell me...
4637 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4638 (Or you may be running DOS with DJGPP.)
4639 EOI
4640         echo exit 0 >os2
4641         ;;
4642 esac
4643 if test -f /xenix; then
4644         echo "Actually, this looks more like a XENIX system..."
4645         echo exit 0 >xenix
4646         d_xenix="$define"
4647 else
4648         echo " "
4649         echo "It's not Xenix..."
4650         d_xenix="$undef"
4651 fi
4652 chmod +x xenix
4653 $eunicefix xenix
4654 if test -f /venix; then
4655         echo "Actually, this looks more like a VENIX system..."
4656         echo exit 0 >venix
4657 else
4658         echo " "
4659         if ./xenix; then
4660                 : null
4661         else
4662                 echo "Nor is it Venix..."
4663         fi
4664 fi
4665 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4666 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4667 $rm -f foo
4668
4669 : Check if we are using GNU gcc and what its version is
4670 echo " "
4671 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4672 $cat >try.c <<EOM
4673 #include <stdio.h>
4674 int main() {
4675 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4676 #ifdef __VERSION__
4677         printf("%s\n", __VERSION__);
4678 #else
4679         printf("%s\n", "1");
4680 #endif
4681 #endif
4682         return(0);
4683 }
4684 EOM
4685 if $cc -o try $ccflags $ldflags try.c; then
4686         gccversion=`$run ./try`
4687         case "$gccversion" in
4688         '') echo "You are not using GNU cc." ;;
4689         *)  echo "You are using GNU cc $gccversion."
4690             ccname=gcc
4691             ;;
4692         esac
4693 else
4694         echo " "
4695         echo "*** WHOA THERE!!! ***" >&4
4696         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4697         case "$knowitall" in
4698         '')
4699         echo "    You'd better start hunting for one and let me know about it." >&4
4700                 exit 1
4701                 ;;
4702         esac
4703 fi
4704 $rm -f try try.*
4705 case "$gccversion" in
4706 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4707 esac
4708 case "$gccversion" in
4709 '') gccosandvers='' ;;
4710 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4711    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4712    gccshortvers=''
4713    case "$gccosandvers" in
4714    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4715    $osname$osvers) ;; # looking good
4716    $osname*) cat <<EOM >&4
4717
4718 *** WHOA THERE!!! ***
4719
4720     Your gcc has not been compiled for the exact release of
4721     your operating system ($gccosandvers versus $osname$osvers).
4722
4723     In general it is a good idea to keep gcc synchronized with
4724     the operating system because otherwise serious problems
4725     may ensue when trying to compile software, like Perl.
4726
4727     I'm trying to be optimistic here, though, and will continue.
4728     If later during the configuration and build icky compilation
4729     problems appear (headerfile conflicts being the most common
4730     manifestation), I suggest reinstalling the gcc to match
4731     your operating system release.
4732
4733 EOM
4734       ;;
4735    *) gccosandvers='' ;; # failed to parse, better be silent
4736    esac
4737    ;;
4738 esac
4739 case "$ccname" in
4740 '') ccname="$cc" ;;
4741 esac
4742
4743 # gcc 3.* complain about adding -Idirectories that they already know about,
4744 # so we will take those off from locincpth.
4745 case "$gccversion" in
4746 3*)
4747     echo "main(){}">try.c
4748     for incdir in $locincpth; do
4749        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4750              grep '^c[cp]p*[01]: warning: changing search order '`
4751        if test "X$warn" != X; then
4752            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4753        fi
4754     done
4755     $rm -f try try.*
4756 esac
4757
4758 # gcc 4.9 by default does some optimizations that break perl.
4759 # see ticket 121505.
4760 #
4761 # The -fwrapv disables those optimizations (and probably others,) so
4762 # for gcc 4.9 (and later, since the optimizations probably won't go
4763 # away), add -fwrapv unless the user requests -fno-wrapv, which
4764 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4765 # which turns the overflows -fwrapv ignores into runtime errors.
4766 case "$gccversion" in
4767 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4768     case "$ccflags" in
4769     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4770     *) ccflags="$ccflags -fwrapv" ;;
4771     esac
4772 esac
4773
4774 : What should the include directory be ?
4775 : Use sysroot if set, so findhdr looks in the right place.
4776 echo " "
4777 $echo $n "Hmm...  $c"
4778 dflt="$sysroot/usr/include"
4779 incpath=''
4780 mips_type=''
4781 if $test -f /bin/mips && /bin/mips; then
4782         echo "Looks like a MIPS system..."
4783         $cat >usr.c <<'EOCP'
4784 #ifdef SYSTYPE_BSD43
4785 /bsd43
4786 #endif
4787 EOCP
4788         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4789                 dflt='/bsd43/usr/include'
4790                 incpath='/bsd43'
4791                 mips_type='BSD 4.3'
4792         else
4793                 mips_type='System V'
4794         fi
4795         $rm -f usr.c usr.out
4796         echo "and you're compiling with the $mips_type compiler and libraries."
4797         xxx_prompt=y
4798         echo "exit 0" >mips
4799 else
4800         echo "Doesn't look like a MIPS system."
4801         xxx_prompt=n
4802         echo "exit 1" >mips
4803 fi
4804 chmod +x mips
4805 $eunicefix mips
4806 case "$usrinc" in
4807 '') ;;
4808 *) dflt="$usrinc";;
4809 esac
4810 case "$xxx_prompt" in
4811 y)      fn=d/
4812         echo " "
4813         rp='Where are the include files you want to use?'
4814         . ./getfile
4815         usrinc="$ans"
4816         ;;
4817 *)      usrinc="$dflt"
4818         ;;
4819 esac
4820
4821 : see how we invoke the C preprocessor
4822 echo " "
4823 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4824 cat <<'EOT' >testcpp.c
4825 #define ABC abc
4826 #define XYZ xyz
4827 ABC.XYZ
4828 EOT
4829 cd ..
4830 if test ! -f cppstdin; then
4831         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4832                 # AIX cc -E doesn't show the absolute headerfile
4833                 # locations but we'll cheat by using the -M flag.
4834                 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
4835         else
4836                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4837         fi
4838 else
4839         echo "Keeping your $hint cppstdin wrapper."
4840 fi
4841 chmod 755 cppstdin
4842 wrapper=`pwd`/cppstdin
4843 ok='false'
4844 cd UU
4845
4846 if $test "X$cppstdin" != "X" && \
4847         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4848         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4849 then
4850         echo "You used to use $cppstdin $cppminus so we'll use that again."
4851         case "$cpprun" in
4852         '') echo "But let's see if we can live without a wrapper..." ;;
4853         *)
4854                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4855                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4856                 then
4857                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4858                         ok='true'
4859                 else
4860                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4861                 fi
4862                 ;;
4863         esac
4864 else
4865         case "$cppstdin" in
4866         '') ;;
4867         *)
4868                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4869                 ;;
4870         esac
4871 fi
4872
4873 if $ok; then
4874         : nothing
4875 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4876         $cc -E <testcpp.c >testcpp.out 2>&1; \
4877         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4878         echo "Yup, it does."
4879         x_cpp="$cc $cppflags -E"
4880         x_minus='';
4881 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4882         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4883         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4884         echo "Yup, it does."
4885         x_cpp="$cc $cppflags -E"
4886         x_minus='-';
4887 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4888         $cc -P <testcpp.c >testcpp.out 2>&1; \
4889         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4890         echo "Yipee, that works!"
4891         x_cpp="$cc $cppflags -P"
4892         x_minus='';
4893 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4894         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4895         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4896         echo "At long last!"
4897         x_cpp="$cc $cppflags -P"
4898         x_minus='-';
4899 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4900         $cpp <testcpp.c >testcpp.out 2>&1; \
4901         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4902         echo "It works!"
4903         x_cpp="$cpp $cppflags"
4904         x_minus='';
4905 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4906         $cpp - <testcpp.c >testcpp.out 2>&1; \
4907         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4908         echo "Hooray, it works!  I was beginning to wonder."
4909         x_cpp="$cpp $cppflags"
4910         x_minus='-';
4911 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4912         $wrapper <testcpp.c >testcpp.out 2>&1; \
4913         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4914         x_cpp="$wrapper"
4915         x_minus=''
4916         echo "Eureka!"
4917 else
4918         dflt=''
4919         rp="No dice.  I can't find a C preprocessor.  Name one:"
4920         . ./myread
4921         x_cpp="$ans"
4922         x_minus=''
4923         $x_cpp <testcpp.c >testcpp.out 2>&1
4924         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4925                 echo "OK, that will do." >&4
4926         else
4927 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4928                 exit 1
4929         fi
4930 fi
4931
4932 case "$ok" in
4933 false)
4934         cppstdin="$x_cpp"
4935         cppminus="$x_minus"
4936         cpprun="$x_cpp"
4937         cpplast="$x_minus"
4938         set X $x_cpp
4939         shift
4940         case "$1" in
4941         "$cpp")
4942                 echo "Perhaps can we force $cc -E using a wrapper..."
4943                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4944                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4945                 then
4946                         echo "Yup, we can."
4947                         cppstdin="$wrapper"
4948                         cppminus='';
4949                 else
4950                         echo "Nope, we'll have to live without it..."
4951                 fi
4952                 ;;
4953         esac
4954         case "$cpprun" in
4955         "$wrapper")
4956                 cpprun=''
4957                 cpplast=''
4958                 ;;
4959         esac
4960         ;;
4961 esac
4962
4963 case "$cppstdin" in
4964 "$wrapper"|'cppstdin') ;;
4965 *) $rm -f $wrapper;;
4966 esac
4967 $rm -f testcpp.c testcpp.out
4968
4969 : Adjust cppfilter for path component separator
4970 case "$osname" in
4971 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4972 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4973 *)   cppfilter='' ;;
4974 esac
4975
4976 : Use gcc to determine libpth and incpth
4977 # If using gcc or clang, we can get better values for libpth, incpth
4978 # and usrinc directly from the compiler.
4979 # Note that ccname for clang is also gcc.
4980 case "$ccname" in
4981     gcc)
4982         $echo 'extern int foo;' > try.c
4983         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4984         shift
4985         if $test $# -gt 0; then
4986             incpth="$incpth $*"
4987             incpth="`$echo $incpth|$sed 's/^ //'`"
4988             for i in $*; do
4989                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4990                 if $test -d $j; then
4991                     libpth="$libpth $j"
4992                 fi
4993             done
4994             libpth="`$echo $libpth|$sed 's/^ //'`"
4995             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4996                 if $test -d $xxx; then
4997                     case " $libpth " in
4998                     *" $xxx "*) ;;
4999                     *) libpth="$libpth $xxx";;
5000                     esac
5001                 fi
5002             done
5003         fi
5004         $rm -f try.c
5005         case "$usrinc" in
5006         '') for i in $incpth; do
5007                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
5008                     usrinc="$i"
5009                     break
5010                 fi
5011             done
5012             ;;
5013         esac
5014
5015         case "$usecrosscompile" in
5016         $define|true|[yY]*)
5017             case "$incpth" in
5018                 '') echo "Incpth not defined." >&4; croak=y ;;
5019                 *)  echo "Using incpth '$incpth'." >&4 ;;
5020             esac
5021             case "$libpth" in
5022                 '') echo "Libpth not defined." >&4; croak=y ;;
5023                 *)  echo "Using libpth '$libpth'." >&4 ;;
5024             esac
5025             case "$usrinc" in
5026                 '') echo "Usrinc not defined." >&4; croak=y ;;
5027                 *)  echo "Using usrinc $usrinc." >&4 ;;
5028             esac
5029             case "$croak" in
5030                 y)
5031                 if test "X$sysroot" = X; then
5032                     echo "Cannot continue, aborting." >&4; exit 1
5033                 else
5034                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5035                 fi
5036                 ;;
5037             esac
5038             ;;
5039         esac
5040     ;;
5041 esac
5042
5043 : Default value for incpth is just usrinc
5044 case "$incpth" in
5045 '') incpth="$usrinc";;
5046 esac
5047
5048 : Set private lib path
5049 case "$plibpth" in
5050 '') if ./mips; then
5051         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5052     fi;;
5053 esac
5054 case "$libpth" in
5055 ' ') dlist='';;
5056 '') dlist="$loclibpth $plibpth $glibpth";;
5057 *) dlist="$libpth";;
5058 esac
5059
5060 : Now check and see which directories actually exist, avoiding duplicates
5061 for xxx in $dlist
5062 do
5063     if $test -d $xxx; then
5064                 case " $libpth " in
5065                 *" $xxx "*) ;;
5066                 *) libpth="$libpth $xxx";;
5067                 esac
5068     fi
5069 done
5070 $cat <<'EOM'
5071
5072 Some systems have incompatible or broken versions of libraries.  Among
5073 the directories listed in the question below, please remove any you
5074 know not to be holding relevant libraries, and add any that are needed.
5075 Say "none" for none.
5076
5077 EOM
5078
5079 if test "X$sysroot" != X; then
5080     $cat <<EOM
5081 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5082
5083 EOM
5084 fi
5085
5086 case "$libpth" in
5087 '') dflt='none';;
5088 *)
5089         set X $libpth
5090         shift
5091         dflt=${1+"$@"}
5092         ;;
5093 esac
5094 rp="Directories to use for library searches?"
5095 . ./myread
5096 case "$ans" in
5097 none) libpth=' ';;
5098 *) libpth="$ans";;
5099 esac
5100
5101 : compute shared library extension
5102 case "$so" in
5103 '')
5104         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5105                 dflt='sl'
5106         else
5107                 dflt='so'
5108         fi
5109         ;;
5110 *) dflt="$so";;
5111 esac
5112 $cat <<EOM
5113
5114 On some systems, shared libraries may be available.  Answer 'none' if
5115 you want to suppress searching of shared libraries for the remainder
5116 of this configuration.
5117
5118 EOM
5119 rp='What is the file extension used for shared libraries?'
5120 . ./myread
5121 so="$ans"
5122
5123 : Does target system insist that shared library basenames are unique
5124 $cat << EOM
5125
5126 Some dynamic loaders assume that the *basename* of shared library filenames
5127 are globally unique.  We'll default this to undef as we assume your system
5128 is not this weird. Set to defined if you're on one of them.
5129
5130 EOM
5131
5132 dflt='n'
5133 rp='Make shared library basenames unique?'
5134 . ./myread
5135 case "$ans" in
5136 y|Y) val="$define" ;;
5137 *)   val="$undef"  ;;
5138 esac
5139 set d_libname_unique
5140 eval $setvar
5141
5142 : Define several unixisms.
5143 : Hints files or command line option can be used to override them.
5144 : The convoluted testing is in case hints files set either the old
5145 : or the new name.
5146 case "$_exe" in
5147 '')     case "$exe_ext" in
5148         '')     ;;
5149         *)      _exe="$exe_ext" ;;
5150         esac
5151         ;;
5152 esac
5153 case "$_a" in
5154 '')     case "$lib_ext" in
5155     '') _a='.a';;
5156         *)      _a="$lib_ext" ;;
5157         esac
5158         ;;
5159 esac
5160 case "$_o" in
5161 '') case "$obj_ext" in
5162         '')     _o='.o';;
5163         *)      _o="$obj_ext";;
5164         esac
5165         ;;
5166 esac
5167 case "$p_" in
5168 '') case "$path_sep" in
5169         '')     p_=':';;
5170         *)      p_="$path_sep";;
5171         esac
5172         ;;
5173 esac
5174 exe_ext=$_exe
5175 lib_ext=$_a
5176 obj_ext=$_o
5177 path_sep=$p_
5178
5179 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5180
5181 : Which makefile gets called first.  This is used by make depend.
5182 case "$firstmakefile" in
5183 '') firstmakefile='makefile';;
5184 esac
5185
5186 : Check is we will use socks
5187 case "$usesocks" in
5188 $define|true|[yY]*)     dflt='y';;
5189 *) dflt='n';;
5190 esac
5191 cat <<EOM
5192
5193 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5194 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5195 to use the PerlIO abstraction layer, this will be implicitly selected.
5196
5197 If this doesn't make any sense to you, just accept the default '$dflt'.
5198 EOM
5199 rp='Build Perl for SOCKS?'
5200 . ./myread
5201 case "$ans" in
5202 y|Y)    val="$define" ;;
5203 *)      val="$undef" ;;
5204 esac
5205 set usesocks
5206 eval $setvar
5207
5208 : Check for uselongdouble support
5209 case "$ccflags" in
5210 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5211 esac
5212
5213 case "$uselongdouble" in
5214 $define|true|[yY]*)     dflt='y';;
5215 *) dflt='n';;
5216 esac
5217 cat <<EOM
5218
5219 Perl can be built to take advantage of long doubles which
5220 (if available) may give more accuracy and range for floating point numbers.
5221
5222 If this doesn't make any sense to you, just accept the default '$dflt'.
5223 EOM
5224 rp='Try to use long doubles if available?'
5225 . ./myread
5226 case "$ans" in
5227 y|Y)    val="$define"   ;;
5228 *)      val="$undef"    ;;
5229 esac
5230 set uselongdouble
5231 eval $setvar
5232
5233 case "$uselongdouble" in
5234 true|[yY]*) uselongdouble="$define" ;;
5235 esac
5236
5237 : Look for a hint-file generated 'call-back-unit'.  If the
5238 : user has specified that long doubles should be used,
5239 : we may need to set or change some other defaults.
5240 if $test -f uselongdouble.cbu; then
5241     echo "Your platform has some specific hints regarding long doubles, using them..."
5242     . ./uselongdouble.cbu
5243 else
5244     case "$uselongdouble" in
5245         $define)
5246                 $cat <<EOM
5247 (Your platform does not have any specific hints for long doubles.)
5248 EOM
5249         ;;
5250     esac
5251 fi
5252
5253 : Check if quadmath is requested
5254 case "$usequadmath" in
5255 "$define"|true|[yY]*) usequadmath="$define" ;;
5256 *)                    usequadmath="$undef"  ;;
5257 esac
5258
5259 : Fail if both uselongdouble and usequadmath are requested
5260 case "$usequadmath:$uselongdouble" in
5261 define:define)
5262         $cat <<EOM >&4
5263
5264 *** You requested the use of the quadmath library and use
5265 *** of long doubles.
5266 ***
5267 *** Please select one or the other.
5268 EOM
5269         exit 1
5270         ;;
5271 esac
5272
5273 : Looking for optional libraries
5274 echo " "
5275 echo "Checking for optional libraries..." >&4
5276 case "$libs" in
5277 ' '|'') dflt='';;
5278 *) dflt="$libs";;
5279 esac
5280 case "$libswanted" in
5281 '') libswanted='c_s';;
5282 esac
5283 case "$usesocks" in
5284 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5285 esac
5286 case "$usecbacktrace" in
5287 "$define") libswanted="$libswanted bfd" ;;
5288 esac
5289 case "$usequadmath" in
5290 "$define") libswanted="$libswanted quadmath" ;;
5291 esac
5292 libsfound=''
5293 libsfiles=''
5294 libsdirs=''
5295 libspath=''
5296 for thisdir in $libpth $xlibpth; do
5297   test -d $thisdir && libspath="$libspath $thisdir"
5298 done
5299 for thislib in $libswanted; do
5300         for thisdir in $libspath; do
5301             xxx=''
5302             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5303                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5304                 $test -f "$xxx" && eval $libscheck
5305                 $test -f "$xxx" && libstyle=shared
5306                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5307                 $test -f "$xxx" && eval $libscheck
5308                 $test -f "$xxx" && libstyle=shared
5309             fi
5310             if test ! -f "$xxx"; then
5311                 xxx=$thisdir/lib$thislib.$so
5312                 $test -f "$xxx" && eval $libscheck
5313                 $test -f "$xxx" && libstyle=shared
5314             fi
5315             if test ! -f "$xxx"; then
5316                 xxx=$thisdir/lib$thislib$_a
5317                 $test -f "$xxx" && eval $libscheck
5318                 $test -f "$xxx" && libstyle=static
5319             fi
5320             if test ! -f "$xxx"; then
5321                 xxx=$thisdir/$thislib$_a
5322                 $test -f "$xxx" && eval $libscheck
5323                 $test -f "$xxx" && libstyle=static
5324             fi
5325             if test ! -f "$xxx"; then
5326                 xxx=$thisdir/lib${thislib}_s$_a
5327                 $test -f "$xxx" && eval $libscheck
5328                 $test -f "$xxx" && libstyle=static
5329                 $test -f "$xxx" && thislib=${thislib}_s
5330             fi
5331             if test ! -f "$xxx"; then
5332                 xxx=$thisdir/Slib$thislib$_a
5333                 $test -f "$xxx" && eval $libscheck
5334                 $test -f "$xxx" && libstyle=static
5335             fi
5336             if $test -f "$xxx"; then
5337                 case "$libstyle" in
5338                 shared) echo "Found -l$thislib (shared)." ;;
5339                 static) echo "Found -l$thislib." ;;
5340                 *)      echo "Found -l$thislib ($libstyle)." ;;
5341                 esac
5342                 case " $dflt " in
5343                 *"-l$thislib "*);;
5344                 *) dflt="$dflt -l$thislib"
5345                    libsfound="$libsfound $xxx"
5346                    yyy=`basename $xxx`
5347                    libsfiles="$libsfiles $yyy"
5348                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5349                    case " $libsdirs " in
5350                    *" $yyy "*) ;;
5351                    *) libsdirs="$libsdirs $yyy" ;;
5352                    esac
5353                    ;;
5354                 esac
5355                 break
5356             fi
5357         done
5358         if $test ! -f "$xxx"; then
5359             echo "No -l$thislib."
5360         fi
5361 done
5362 set X $dflt
5363 shift
5364 dflt="$*"
5365 case "$libs" in
5366 '') dflt="$dflt";;
5367 *) dflt="$libs";;
5368 esac
5369 case "$dflt" in
5370 ' '|'') dflt='none';;
5371 esac
5372
5373 $cat <<EOM
5374
5375 In order to compile $package on your machine, a number of libraries
5376 are usually needed.  Include any other special libraries here as well.
5377 Say "none" for none.  The default list is almost always right.
5378 EOM
5379
5380 echo " "
5381 rp="What libraries to use?"
5382 . ./myread
5383 case "$ans" in
5384 none) libs=' ';;
5385 *) libs="$ans";;
5386 esac
5387
5388 : determine optimization, if desired, or use for debug flag also
5389 case "$optimize" in
5390 ' '|$undef) dflt='none';;
5391 '') dflt='-O';;
5392 *) dflt="$optimize";;
5393 esac
5394 $cat <<EOH
5395
5396 By default, $package compiles with the -O flag to use the optimizer.
5397 Alternately, you might want to use the symbolic debugger, which uses
5398 the -g flag (on traditional Unix systems).  Either flag can be
5399 specified here.  To use neither flag, specify the word "none".
5400
5401 EOH
5402 rp="What optimizer/debugger flag should be used?"
5403 . ./myread
5404 optimize="$ans"
5405 case "$optimize" in
5406 'none') optimize=" ";;
5407 esac
5408
5409 : Check what DEBUGGING is required from the command line
5410 : -DEBUGGING      or -DDEBUGGING or
5411 : -DEBUGGING=both                       = -g + -DDEBUGGING
5412 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5413 : -DEBUGGING=none or -UDEBUGGING        =
5414 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5415 case "$EBUGGING" in
5416 '')     ;;
5417 *)      DEBUGGING=$EBUGGING ;;
5418 esac
5419
5420 case "$DEBUGGING" in
5421 -g|both|$define)
5422     case "$optimize" in
5423         *-g*) ;;
5424         *)    optimize="$optimize -g" ;;
5425     esac ;;
5426 none|$undef)
5427     case "$optimize" in
5428         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5429                 shift
5430                 optimize="$*"
5431                 ;;
5432     esac ;;
5433 esac
5434
5435 dflt=''
5436 case "$DEBUGGING" in
5437 both|$define) dflt='-DDEBUGGING'
5438 esac
5439
5440 : argument order is deliberate, as the flag will start with - which set could
5441 : think is an option
5442 checkccflag='check=$1; flag=$2; callback=$3;
5443 echo " ";
5444 echo "Checking if your compiler accepts $flag" 2>&1;
5445 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5446 echo "int main(void) { return 0; }" > gcctest.c;
5447 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5448     echo "Yes, it does." 2>&1;
5449     if $test -s gcctest.out ; then
5450         echo "But your platform does not like it:";
5451         cat gcctest.out;
5452     else
5453         case "$ccflags" in
5454         *$check*)
5455             echo "Leaving current flags $ccflags alone." 2>&1
5456             ;;
5457         *) dflt="$dflt $flag";
5458             eval $callback
5459             ;;
5460         esac
5461     fi
5462 else
5463     echo "Nope, it does not, but that is ok." 2>&1;
5464 fi
5465 '
5466
5467 : We will not override a previous value, but we might want to
5468 : augment a hint file
5469 case "$hint" in
5470 default|recommended)
5471         case "$gccversion" in
5472         1*) dflt="$dflt -fpcc-struct-return" ;;
5473         esac
5474         case "$optimize:$DEBUGGING" in
5475         *-g*:old) dflt="$dflt -DDEBUGGING";;
5476         esac
5477         case "$gccversion" in
5478         2*) if $test -d /etc/conf/kconfig.d &&
5479                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5480                 then
5481                         # Interactive Systems (ISC) POSIX mode.
5482                         dflt="$dflt -posix"
5483                 fi
5484                 ;;
5485         esac
5486         case "$gccversion" in
5487         1*) ;;
5488         2.[0-8]*) ;;
5489         ?*)     set strict-aliasing -fno-strict-aliasing
5490                 eval $checkccflag
5491                 ;;
5492         esac
5493         # For gcc, adding -pipe speeds up compilations for some, but apparently
5494         # some assemblers can't read from stdin.  (It also slows down compilations
5495         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5496         case "$gccversion" in
5497         ?*)     set pipe -pipe
5498                 eval $checkccflag
5499                 ;;
5500         esac
5501
5502         # on x86_64 (at least) we require an extra library (libssp) in the
5503         # link command line. This library is not named, so I infer that it is
5504         # an implementation detail that may change. Hence the safest approach
5505         # is to add the flag to the flags passed to the compiler at link time,
5506         # as that way the compiler can do the right implementation dependant
5507         # thing. (NWC)
5508         case "$osname" in
5509         amigaos) ;; # -fstack-protector builds but doesn't work
5510         *)      case "$gccversion" in
5511                 ?*)     set stack-protector-strong -fstack-protector-strong
5512                         eval $checkccflag
5513                         case "$dflt" in
5514                         *-fstack-protector-strong*) ;; # It got added.
5515                         *) # Try the plain/older -fstack-protector.
5516                            set stack-protector -fstack-protector
5517                            eval $checkccflag
5518                            ;;
5519                         esac
5520                         ;;
5521                 esac
5522                 ;;
5523         esac
5524         ;;
5525 esac
5526
5527 case "$mips_type" in
5528 *BSD*|'') inclwanted="$locincpth $usrinc";;
5529 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5530 esac
5531 for thisincl in $inclwanted; do
5532         if $test -d $thisincl; then
5533                 if $test x$thisincl != x$usrinc; then
5534                         case "$dflt" in
5535                         *" -I$thisincl "*);;
5536                         *) dflt="$dflt -I$thisincl ";;
5537                         esac
5538                 fi
5539         fi
5540 done
5541
5542 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5543         xxx=true;
5544 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5545         xxx=true;
5546 else
5547         xxx=false;
5548 fi;
5549 if $xxx; then
5550         case "$dflt" in
5551         *$2*);;
5552         *) dflt="$dflt -D$2";;
5553         esac;
5554 fi'
5555
5556 set signal.h LANGUAGE_C; eval $inctest
5557
5558 case "$usesocks" in
5559 $define)
5560         ccflags="$ccflags -DSOCKS"
5561         ;;
5562 esac
5563
5564 case "$hint" in
5565 default|recommended) dflt="$ccflags $dflt" ;;
5566 *) dflt="$ccflags";;
5567 esac
5568
5569 case "$dflt" in
5570 ''|' ') dflt=none;;
5571 esac
5572
5573 $cat <<EOH
5574
5575 Your C compiler may want other flags.  For this question you should include
5576 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5577 but you should NOT include libraries or ld flags like -lwhatever.  If you
5578 want $package to honor its debug switch, you should include -DDEBUGGING here.
5579 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5580
5581 To use no flags, specify the word "none".
5582
5583 EOH
5584 set X $dflt
5585 shift
5586 dflt=${1+"$@"}
5587 rp="Any additional cc flags?"
5588 . ./myread
5589 case "$ans" in
5590 none) ccflags='';;
5591 *) ccflags="$ans";;
5592 esac
5593
5594 : the following weeds options from ccflags that are of no interest to cpp
5595 case "$cppflags" in
5596 '') cppflags="$ccflags" ;;
5597 *)  set X $ccflags; shift
5598     case " $cppflags " in
5599     *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5600     *) cppflags="$cppflags $ccflags" ;;
5601     esac
5602     ;;
5603 esac
5604 case "$gccversion" in
5605 1*) cppflags="$cppflags -D__GNUC__"
5606 esac
5607 case "$mips_type" in
5608 '');;
5609 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5610 esac
5611 case "$cppflags" in
5612 '');;
5613 *)
5614         echo " "
5615         echo "Let me guess what the preprocessor flags are..." >&4
5616         set X $cppflags
5617         shift
5618         cppflags=''
5619         $cat >cpp.c <<'EOM'
5620 #define BLURFL foo
5621
5622 BLURFL xx LFRULB
5623 EOM
5624         previous=''
5625         for flag in $*
5626         do
5627                 case "$flag" in
5628                 -*) ftry="$flag";;
5629                 *) ftry="$previous $flag";;
5630                 esac
5631                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5632                         >cpp1.out 2>/dev/null && \
5633                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5634                         >cpp2.out 2>/dev/null && \
5635                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5636                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5637                 then
5638                         cppflags="$cppflags $ftry"
5639                         previous=''
5640                 else
5641                         previous="$flag"
5642                 fi
5643         done
5644         set X $cppflags
5645         shift
5646         cppflags=${1+"$@"}
5647         case "$cppflags" in
5648         *-*)  echo "They appear to be: $cppflags";;
5649         esac
5650         $rm -f cpp.c cpp?.out
5651         ;;
5652 esac
5653
5654 : flags used in final linking phase
5655 case "$ldflags" in
5656 '') if ./venix; then
5657                 dflt='-i -z'
5658         else
5659                 dflt=''
5660         fi
5661         case "$ccflags" in
5662         *-posix*) dflt="$dflt -posix" ;;
5663         esac
5664         ;;
5665 *) dflt="$ldflags";;
5666 esac
5667 # See note above about -fstack-protector
5668 case "$ccflags" in
5669 *-fstack-protector-strong*)
5670         case "$dflt" in
5671         *-fstack-protector-strong*) ;; # Don't add it again
5672         *) dflt="$dflt -fstack-protector-strong" ;;
5673         esac
5674         ;;
5675 *-fstack-protector*)
5676         case "$dflt" in
5677         *-fstack-protector*) ;; # Don't add it again
5678         *) dflt="$dflt -fstack-protector" ;;
5679         esac
5680         ;;
5681 esac
5682
5683 : Try to guess additional flags to pick up local libraries.
5684 for thislibdir in $libpth; do
5685         case " $loclibpth " in
5686         *" $thislibdir "*)
5687                 case "$dflt " in
5688                 *"-L$thislibdir "*) ;;
5689                 *)  dflt="$dflt -L$thislibdir" ;;
5690                 esac
5691                 ;;
5692         esac
5693 done
5694
5695 case "$dflt" in
5696 '') dflt='none' ;;
5697 esac
5698
5699 $cat <<EOH
5700
5701 Your C linker may need flags.  For this question you should
5702 include -L/whatever and any other flags used by the C linker, but you
5703 should NOT include libraries like -lwhatever.
5704
5705 Make sure you include the appropriate -L/path flags if your C linker
5706 does not normally search all of the directories you specified above,
5707 namely
5708         $libpth
5709 To use no flags, specify the word "none".
5710
5711 EOH
5712
5713 rp="Any additional ld flags (NOT including libraries)?"
5714 . ./myread
5715 case "$ans" in
5716 none) ldflags='';;
5717 *) ldflags="$ans";;
5718 esac
5719 rmlist="$rmlist pdp11"
5720
5721 : coherency check
5722 echo " "
5723 echo "Checking your choice of C compiler and flags for coherency..." >&4
5724 $cat > try.c <<'EOF'
5725 #include <stdio.h>
5726 int main() { printf("Ok\n"); return(0); }
5727 EOF
5728 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5729 shift
5730 $cat >try.msg <<'EOM'
5731 I've tried to compile and run the following simple program:
5732
5733 EOM
5734 $cat try.c >> try.msg
5735
5736 $cat >> try.msg <<EOM
5737
5738 I used the command:
5739
5740         $*
5741         $run ./try
5742
5743 and I got the following output:
5744
5745 EOM
5746 dflt=y
5747 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5748         if $sh -c "$run ./try " >>try.msg 2>&1; then
5749                 xxx=`$run ./try`
5750                 case "$xxx" in
5751                 "Ok") dflt=n ;;
5752                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5753                 esac
5754         else
5755                 echo "The program compiled OK, but exited with status $?." >>try.msg
5756                 rp="You have a problem.  Shall I abort Configure"
5757                 dflt=y
5758         fi
5759 else
5760         echo "I can't compile the test program." >>try.msg
5761         rp="You have a BIG problem.  Shall I abort Configure"
5762         dflt=y
5763 fi
5764 case "$dflt" in
5765 y)
5766         $cat try.msg >&4
5767         case "$knowitall" in
5768         '')
5769                 echo "(The supplied flags or libraries might be incorrect.)"
5770                 ;;
5771         *) dflt=n;;
5772         esac
5773         echo " "
5774         . ./myread
5775         case "$ans" in
5776         n*|N*) ;;
5777         *)      echo "Ok.  Stopping Configure." >&4
5778                 exit 1
5779                 ;;
5780         esac
5781         ;;
5782 n) echo "OK, that should do.";;
5783 esac
5784 $rm_try gcctest gcctest.out
5785
5786 : define a shorthand compile call
5787 compile='
5788 mc_file=$1;
5789 shift;
5790 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5791 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5792 exit 1;
5793 fi;
5794 esac;
5795 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5796 : define a shorthand compile call for compilations that should be ok.
5797 compile_ok='
5798 mc_file=$1;
5799 shift;
5800 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5801
5802 : determine filename position in cpp output
5803 echo " "
5804 echo "Computing filename position in cpp output for #include directives..." >&4
5805 case "$osname" in
5806 amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5807 esac
5808 case "$fieldn" in
5809 '')
5810 case "$osname" in
5811 vos) testaccess=-e ;;
5812 *)   testaccess=-r ;;
5813 esac
5814 echo '#include <stdio.h>' > foo.c
5815 $cat >fieldn <<EOF
5816 $startsh
5817 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5818 $grep '^[       ]*#.*stdio\.h' | \
5819 while read cline; do
5820         pos=1
5821         set \$cline
5822         while $test \$# -gt 0; do
5823                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5824                         echo "\$pos"
5825                         exit 0
5826                 fi
5827                 shift
5828                 pos=\`expr \$pos + 1\`
5829         done
5830 done
5831 EOF
5832 chmod +x fieldn
5833 fieldn=`./fieldn`
5834 $rm -f foo.c fieldn
5835 ;;
5836 esac
5837 case $fieldn in
5838 '') pos='???';;
5839 1) pos=first;;
5840 2) pos=second;;
5841 3) pos=third;;
5842 *) pos="${fieldn}th";;
5843 esac
5844 echo "Your cpp writes the filename in the $pos field of the line."
5845
5846 : locate header file
5847 $cat >findhdr <<EOF
5848 $startsh
5849 wanted=\$1
5850 name=''
5851 for usrincdir in $incpth
5852 do
5853         if test -f \$usrincdir/\$wanted; then
5854                 echo "\$usrincdir/\$wanted"
5855                 exit 0
5856         fi
5857 done
5858 awkprg='{ print \$$fieldn }'
5859 echo "#include <\$wanted>" > foo\$\$.c
5860 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5861 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5862 while read cline; do
5863         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5864         case "\$name" in
5865         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5866         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5867         *) exit 2;;
5868         esac;
5869 done;
5870 #
5871 # status = 0: grep returned 0 lines, case statement not executed
5872 # status = 1: headerfile found
5873 # status = 2: while loop executed, no headerfile found
5874 #
5875 status=\$?
5876 $rm -f foo\$\$.c;
5877 if test \$status -eq 1; then
5878         exit 0;
5879 fi
5880 exit 1
5881 EOF
5882 chmod +x findhdr
5883
5884 : define an alternate in-header-list? function
5885 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5886 cont=true; xxf="echo \"<\$1> found.\" >&4";
5887 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5888 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5889 esac;
5890 case $# in 4) instead=instead;; *) instead="at last";; esac;
5891 while $test "$cont"; do
5892         xxx=`./findhdr $1`
5893         var=$2; eval "was=\$$2";
5894         if $test "$xxx" && $test -r "$xxx";
5895         then eval $xxf;
5896         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5897                 cont="";
5898         else eval $xxnf;
5899         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5900         set $yyy; shift; shift; yyy=$@;
5901         case $# in 0) cont="";;
5902         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5903                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5904         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5905                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5906         esac;
5907 done;
5908 while $test "$yyy";
5909 do set $yyy; var=$2; eval "was=\$$2";
5910         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5911         set $yyy; shift; shift; yyy=$@;
5912 done'
5913
5914 : see if stdlib is available
5915 set stdlib.h i_stdlib
5916 eval $inhdr
5917
5918 : check for lengths of integral types
5919 echo " "
5920 case "$intsize" in
5921 '')
5922         echo "Checking to see how big your integers are..." >&4
5923         $cat >try.c <<EOCP
5924 #include <stdio.h>
5925 #$i_stdlib I_STDLIB
5926 #ifdef I_STDLIB
5927 #include <stdlib.h>
5928 #endif
5929 int main()
5930 {
5931         printf("intsize=%d;\n", (int)sizeof(int));
5932         printf("longsize=%d;\n", (int)sizeof(long));
5933         printf("shortsize=%d;\n", (int)sizeof(short));
5934         exit(0);
5935 }
5936 EOCP
5937         set try
5938         if eval $compile_ok && $run ./try > /dev/null; then
5939                 eval `$run ./try`
5940                 echo "Your integers are $intsize bytes long."
5941                 echo "Your long integers are $longsize bytes long."
5942                 echo "Your short integers are $shortsize bytes long."
5943         else
5944                 $cat >&4 <<EOM
5945 !
5946 Help! I can't compile and run the intsize test program: please enlighten me!
5947 (This is probably a misconfiguration in your system or libraries, and
5948 you really ought to fix it.  Still, I'll try anyway.)
5949 !
5950 EOM
5951                 dflt=4
5952                 rp="What is the size of an integer (in bytes)?"
5953                 . ./myread
5954                 intsize="$ans"
5955                 dflt=$intsize
5956                 rp="What is the size of a long integer (in bytes)?"
5957                 . ./myread
5958                 longsize="$ans"
5959                 dflt=2
5960                 rp="What is the size of a short integer (in bytes)?"
5961                 . ./myread
5962                 shortsize="$ans"
5963         fi
5964         ;;
5965 esac
5966 $rm_try
5967
5968 : check for long long
5969 echo " "
5970 echo "Checking to see if you have long long..." >&4
5971 echo 'int main() { long long x = 7; return 0; }' > try.c
5972 set try
5973 if eval $compile; then
5974         val="$define"
5975         echo "You have long long."
5976 else
5977         val="$undef"
5978         echo "You do not have long long."
5979 fi
5980 $rm_try
5981 set d_longlong
5982 eval $setvar
5983
5984 : check for length of long long
5985 case "${d_longlong}${longlongsize}" in
5986 $define)
5987         echo " "
5988         echo "Checking to see how big your long longs are..." >&4
5989         $cat >try.c <<'EOCP'
5990 #include <stdio.h>
5991 int main()
5992 {
5993     printf("%d\n", (int)sizeof(long long));
5994     return(0);
5995 }
5996 EOCP
5997         set try
5998         if eval $compile_ok; then
5999                 longlongsize=`$run ./try`
6000                 echo "Your long longs are $longlongsize bytes long."
6001         else
6002                 dflt='8'
6003                 echo " "
6004                 echo "(I can't seem to compile the test program.  Guessing...)"
6005                 rp="What is the size of a long long (in bytes)?"
6006                 . ./myread
6007                 longlongsize="$ans"
6008         fi
6009         if $test "X$longsize" = "X$longlongsize"; then
6010                 echo "(That isn't any different from an ordinary long.)"
6011         fi
6012         ;;
6013 esac
6014 $rm_try
6015
6016 : see if inttypes.h is available
6017 : we want a real compile instead of Inhdr because some systems
6018 : have an inttypes.h which includes non-existent headers
6019 echo " "
6020 $cat >try.c <<EOCP
6021 #include <inttypes.h>
6022 int main() {
6023         static int32_t foo32 = 0x12345678;
6024 }
6025 EOCP
6026 set try
6027 if eval $compile; then
6028         echo "<inttypes.h> found." >&4
6029         val="$define"
6030 else
6031         echo "<inttypes.h> NOT found." >&4
6032         val="$undef"
6033 fi
6034 $rm_try
6035 set i_inttypes
6036 eval $setvar
6037
6038 : check for int64_t
6039 echo " "
6040 echo "Checking to see if you have int64_t..." >&4
6041 $cat >try.c <<EOCP
6042 #include <sys/types.h>
6043 #$i_inttypes I_INTTYPES
6044 #ifdef I_INTTYPES
6045 #include <inttypes.h>
6046 #endif
6047 int main() { int64_t x = 7; }
6048 EOCP
6049 set try
6050 if eval $compile; then
6051         val="$define"
6052         echo "You have int64_t."
6053 else
6054         val="$undef"
6055         echo "You do not have int64_t."
6056 fi
6057 $rm_try
6058 set d_int64_t
6059 eval $setvar
6060
6061 : Check if 64bit ints have a quad type
6062 echo " "
6063 echo "Checking which 64-bit integer type we could use..." >&4
6064
6065 case "$intsize" in
6066 8) val=int
6067    set quadtype
6068    eval $setvar
6069    val='"unsigned int"'
6070    set uquadtype
6071    eval $setvar
6072    quadkind=1
6073    ;;
6074 *) case "$longsize" in
6075    8) val=long
6076       set quadtype
6077       eval $setvar
6078       val='"unsigned long"'
6079       set uquadtype
6080       eval $setvar
6081       quadkind=2
6082       ;;
6083    *) case "$d_longlong:$longlongsize" in
6084       define:8)
6085         val='"long long"'
6086         set quadtype
6087         eval $setvar
6088         val='"unsigned long long"'
6089         set uquadtype
6090         eval $setvar
6091         quadkind=3
6092         ;;
6093       *) case "$d_int64_t" in
6094          define)
6095            val=int64_t
6096            set quadtype
6097            eval $setvar
6098            val=uint64_t
6099            set uquadtype
6100            eval $setvar
6101            quadkind=4
6102            ;;
6103          esac
6104          ;;
6105       esac
6106       ;;
6107    esac
6108    ;;
6109 esac
6110
6111 case "$quadtype" in
6112 '')     echo "Alas, no 64-bit integer types in sight." >&4
6113         d_quad="$undef"
6114         ;;
6115 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6116         d_quad="$define"
6117         ;;
6118 esac
6119
6120 : Do we want 64bit support
6121 case "$uselonglong" in
6122 "$define"|true|[yY]*)
6123         cat <<EOM >&4
6124
6125 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6126 EOM
6127         use64bitint="$define"
6128         ;;
6129 esac
6130 case "$use64bits" in
6131 "$define"|true|[yY]*)
6132         cat <<EOM >&4
6133
6134 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6135 EOM
6136         use64bitint="$define"
6137         ;;
6138 esac
6139 case "$use64bitints" in
6140 "$define"|true|[yY]*)
6141         cat <<EOM >&4
6142
6143 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6144 EOM
6145         use64bitint="$define"
6146         ;;
6147 esac
6148 case "$use64bitsint" in
6149 "$define"|true|[yY]*)
6150         cat <<EOM >&4
6151
6152 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6153 EOM
6154         use64bitint="$define"
6155         ;;
6156 esac
6157 case "$uselonglongs" in
6158 "$define"|true|[yY]*)
6159         cat <<EOM >&4
6160
6161 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6162 EOM
6163         use64bitint="$define"
6164         ;;
6165 esac
6166 case "$use64bitsall" in
6167 "$define"|true|[yY]*)
6168         cat <<EOM >&4
6169
6170 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6171 EOM
6172         use64bitall="$define"
6173         ;;
6174 esac
6175
6176 case "$ccflags" in
6177 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6178 esac
6179 case "$use64bitall" in
6180 "$define"|true|[yY]*) use64bitint="$define" ;;
6181 esac
6182
6183 case "$longsize" in
6184 8) cat <<EOM
6185
6186 You have natively 64-bit long integers.
6187 EOM
6188    val="$define"
6189    ;;
6190 *) case "$use64bitint" in
6191    "$define"|true|[yY]*) dflt='y';;
6192    *) dflt='n';;
6193    esac
6194    case "$d_quad" in
6195    "$define") ;;
6196    *) dflt='n' ;;
6197    esac
6198    cat <<EOM
6199
6200 Perl can be built to take advantage of 64-bit integer types
6201 on some systems.  To do so, Configure can be run with -Duse64bitint.
6202 Choosing this option will most probably introduce binary incompatibilities.
6203
6204 If this doesn't make any sense to you, just accept the default '$dflt'.
6205 (The default has been chosen based on your configuration.)
6206 EOM
6207    rp='Try to use 64-bit integers, if available?'
6208    . ./myread
6209    case "$ans" in
6210    [yY]*) val="$define" ;;
6211    *)     val="$undef"  ;;
6212    esac
6213    ;;
6214 esac
6215 set use64bitint
6216 eval $setvar
6217
6218 case "$use64bitall" in
6219 "$define"|true|[yY]*) dflt='y' ;;
6220 *) case "$longsize" in
6221    8) dflt='y' ;;
6222    *) dflt='n' ;;
6223    esac
6224    ;;
6225 esac
6226 cat <<EOM
6227
6228 You may also choose to try maximal 64-bitness.  It means using as much
6229 64-bitness as possible on the platform.  This in turn means even more
6230 binary incompatibilities.  On the other hand, your platform may not
6231 have any more 64-bitness available than what you already have chosen.
6232
6233 If this doesn't make any sense to you, just accept the default '$dflt'.
6234 (The default has been chosen based on your configuration.)
6235 EOM
6236 rp='Try to use maximal 64-bit support, if available?'
6237 . ./myread
6238 case "$ans" in
6239 [yY]*) val="$define" ;;
6240 *)     val="$undef"  ;;
6241 esac
6242 set use64bitall
6243 eval $setvar
6244 case "$use64bitall" in
6245 "$define")
6246         case "$use64bitint" in
6247         "$undef")
6248                 cat <<EOM
6249
6250 Since you have chosen a maximally 64-bit build, I'm also turning on
6251 the use of 64-bit integers.
6252 EOM
6253                 use64bitint="$define" ;;
6254         esac
6255         ;;
6256 esac
6257
6258 : Look for a hint-file generated 'call-back-unit'.  If the
6259 : user has specified that a 64-bit perl is to be built,
6260 : we may need to set or change some other defaults.
6261 if $test -f use64bitint.cbu; then
6262         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6263         . ./use64bitint.cbu
6264 fi
6265 case "$use64bitint" in
6266 "$define"|true|[yY]*)
6267         : This test was common to all the OpenBSD forks, and seems harmless for
6268         : other platforms:
6269         echo " "
6270         echo "Checking if your C library has broken 64-bit functions..." >&4
6271         cat >try.c <<EOCP
6272 #include <stdio.h>
6273 typedef $uquadtype myULL;
6274 int main (void)
6275 {
6276     struct {
6277         double d;
6278         myULL  u;
6279     } *p, test[] = {
6280         {4294967303.15, 4294967303ULL},
6281         {4294967294.2,  4294967294ULL},
6282         {4294967295.7,  4294967295ULL},
6283         {0.0, 0ULL}
6284     };
6285     for (p = test; p->u; p++) {
6286         myULL x = (myULL)p->d;
6287         if (x != p->u) {
6288             printf("buggy\n");
6289             return 0;
6290         }
6291     }
6292     printf("ok\n");
6293     return 0;
6294 }
6295 EOCP
6296         set try
6297         if eval $compile_ok; then
6298             libcquad=`$run ./try`
6299             echo "Your C library's 64-bit functions are $libcquad."
6300         else
6301             echo "(I can't seem to compile the test program.)"
6302             echo "Assuming that your C library's 64-bit functions are ok."
6303             libcquad="ok"
6304         fi
6305         $rm_try
6306
6307         case "$libcquad" in
6308             buggy*)
6309                 cat >&4 <<EOM
6310
6311 *** You have a C library with broken 64-bit functions.
6312 *** 64-bit support does not work reliably in this configuration.
6313 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6314 *** Cannot continue, aborting.
6315
6316 EOM
6317                 exit 1
6318                 ;;
6319         esac
6320         case "$longsize" in
6321         4) case "$archname64" in
6322            '') archname64=64int ;;
6323            esac
6324            ;;
6325         esac
6326         ;;
6327 esac
6328
6329 : Look for a hint-file generated 'call-back-unit'.  If the
6330 : user has specified that a maximally 64-bit perl is to be built,
6331 : we may need to set or change some other defaults.
6332 if $test -f use64bitall.cbu; then
6333         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6334         . ./use64bitall.cbu
6335 fi
6336 case "$use64bitall" in
6337 "$define"|true|[yY]*)
6338         case "$longsize" in
6339         4) case "$archname64" in
6340            ''|64int) archname64=64all ;;
6341            esac
6342            ;;
6343         esac
6344         ;;
6345 esac
6346
6347 case "$d_quad:$use64bitint" in
6348 $undef:$define)
6349         cat >&4 <<EOF
6350
6351 *** You have chosen to use 64-bit integers,
6352 *** but none can be found.
6353 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6354 *** Cannot continue, aborting.
6355
6356 EOF
6357         exit 1
6358         ;;
6359 esac
6360
6361 : Check if we are using the GNU C library
6362 echo " "
6363 echo "Checking for GNU C Library..." >&4
6364 cat >try.c <<'EOCP'
6365 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6366    alone are insufficient to distinguish different versions, such as
6367    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6368    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6369 */
6370 #include <stdio.h>
6371 int main(void)
6372 {
6373 #ifdef __GLIBC__
6374 #   ifdef __GLIBC_MINOR__
6375 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6376 #           include <gnu/libc-version.h>
6377             printf("%s\n",  gnu_get_libc_version());
6378 #       else
6379             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6380 #       endif
6381 #   else
6382         printf("%d\n",  __GLIBC__);
6383 #   endif
6384     return 0;
6385 #else
6386     return 1;
6387 #endif
6388 }
6389 EOCP
6390 set try
6391 if eval $compile_ok && $run ./try > glibc.ver; then
6392         val="$define"
6393         gnulibc_version=`$cat glibc.ver`
6394         echo "You are using the GNU C Library version $gnulibc_version"
6395 else
6396         val="$undef"
6397         gnulibc_version=''
6398         echo "You are not using the GNU C Library"
6399 fi
6400 $rm_try glibc.ver
6401 set d_gnulibc
6402 eval $setvar
6403
6404 : see if nm is to be used to determine whether a symbol is defined or not
6405 case "$usenm" in
6406 '')
6407         dflt=''
6408         case "$d_gnulibc" in
6409         "$define")
6410                 echo " "
6411                 echo "nm probably won't work on the GNU C Library." >&4
6412                 dflt=n
6413                 ;;
6414         esac
6415         case "$dflt" in
6416         '')
6417                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6418                         echo " "
6419                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6420                         echo "'nm' won't be sufficient on this system." >&4
6421                         dflt=n
6422                 fi
6423                 ;;
6424         esac
6425         case "$dflt" in
6426         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6427                 if $test $dflt -gt 20; then
6428                         dflt=y
6429                 else
6430                         dflt=n
6431                 fi
6432                 ;;
6433         esac
6434         ;;
6435 *)
6436         case "$usenm" in
6437         true|$define) dflt=y;;
6438         *) dflt=n;;
6439         esac
6440         ;;
6441 esac
6442 $cat <<EOM
6443
6444 I can use $nm to extract the symbols from your C libraries. This
6445 is a time consuming task which may generate huge output on the disk (up
6446 to 3 megabytes) but that should make the symbols extraction faster. The
6447 alternative is to skip the 'nm' extraction part and to compile a small
6448 test program instead to determine whether each symbol is present. If
6449 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6450 this may be the best solution.
6451
6452 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6453
6454 EOM
6455 rp="Shall I use $nm to extract C symbols from the libraries?"
6456 . ./myread
6457 case "$ans" in
6458 [Nn]*) usenm=false;;
6459 *) usenm=true;;
6460 esac
6461
6462 runnm=$usenm
6463 case "$reuseval" in
6464 true) runnm=false;;
6465 esac
6466
6467 : nm options which may be necessary
6468 case "$nm_opt" in
6469 '') if $test -f /mach_boot; then
6470                 nm_opt=''       # Mach
6471         elif $test -d /usr/ccs/lib; then
6472                 nm_opt='-p'     # Solaris (and SunOS?)
6473         elif $test -f /dgux; then
6474                 nm_opt='-p'     # DG-UX
6475         elif $test -f /lib64/rld; then
6476                 nm_opt='-p'     # 64-bit Irix
6477         else
6478                 nm_opt=''
6479         fi;;
6480 esac
6481
6482 : nm options which may be necessary for shared libraries but illegal
6483 : for archive libraries.  Thank you, Linux.
6484 case "$nm_so_opt" in
6485 '')     case "$myuname" in
6486         *linux*|gnu*)
6487                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6488                         nm_so_opt='--dynamic'
6489                 fi
6490                 ;;
6491         esac
6492         ;;
6493 esac
6494
6495 : Figure out where the libc is located
6496 case "$runnm" in
6497 true)
6498 : get list of predefined functions in a handy place
6499 echo " "
6500 case "$libc" in
6501 '') libc=unknown
6502         case "$libs" in
6503         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6504         esac
6505         ;;
6506 esac
6507 case "$libs" in
6508 '') ;;
6509 *)  for thislib in $libs; do
6510         case "$thislib" in
6511         -lc|-lc_s)
6512                 : Handle C library specially below.
6513                 ;;
6514         -l*)
6515                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6516                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6517                         :
6518                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6519                         :
6520                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6521                         :
6522                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6523                         :
6524                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6525                         :
6526                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6527                         :
6528                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6529                         :
6530                 else
6531                         try=''
6532                 fi
6533                 libnames="$libnames $try"
6534                 ;;
6535         *) libnames="$libnames $thislib" ;;
6536         esac
6537         done
6538         ;;
6539 esac
6540 xxx=normal
6541 case "$libc" in
6542 unknown)
6543         set /lib/libc.$so
6544         for xxx in $libpth; do
6545                 $test -r $1 || set $xxx/libc.$so
6546                 : The messy sed command sorts on library version numbers.
6547                 $test -r $1 || \
6548                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6549                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6550                                 h
6551                                 s/[0-9][0-9]*/0000&/g
6552                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6553                                 G
6554                                 s/\n/ /' | \
6555                          $sort | $sed -e 's/^.* //'`
6556                 eval set \$$#
6557         done
6558         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6559         $test -r $1 || set $sysroot/lib/libsys_s$_a
6560         ;;
6561 *)
6562         set blurfl
6563         ;;
6564 esac
6565 if $test -r "$1"; then
6566         echo "Your (shared) C library seems to be in $1."
6567         libc="$1"
6568 elif $test -r /lib/libc && $test -r /lib/clib; then
6569         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6570         xxx=apollo
6571         libc='/lib/clib /lib/libc'
6572         if $test -r /lib/syslib; then
6573                 echo "(Your math library is in /lib/syslib.)"
6574                 libc="$libc /lib/syslib"
6575         fi
6576 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6577         echo "Your C library seems to be in $libc, as you said before."
6578 elif $test -r $incpath/usr/lib/libc$_a; then
6579         libc=$incpath/usr/lib/libc$_a;
6580         echo "Your C library seems to be in $libc.  That's fine."
6581 elif $test -r /lib/libc$_a; then
6582         libc=/lib/libc$_a;
6583         echo "Your C library seems to be in $libc.  You're normal."
6584 else
6585         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6586                 :
6587         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6588                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6589         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6590                 :
6591         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6592                 :
6593         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6594                 :
6595         else
6596                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6597         fi
6598         if $test -r "$tans"; then
6599                 echo "Your C library seems to be in $tans, of all places."
6600                 libc=$tans
6601         else
6602                 libc='blurfl'
6603         fi
6604 fi
6605 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6606         dflt="$libc"
6607         cat <<EOM
6608
6609 If the guess above is wrong (which it might be if you're using a strange
6610 compiler, or your machine supports multiple models), you can override it here.
6611
6612 EOM
6613 else
6614         dflt=''
6615         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6616         cat >&4 <<EOM
6617 I can't seem to find your C library.  I've looked in the following places:
6618
6619 EOM
6620         $sed 's/^/      /' libpath
6621         cat <<EOM
6622
6623 None of these seems to contain your C library. I need to get its name...
6624
6625 EOM
6626 fi
6627 fn=f
6628 rp='Where is your C library?'
6629 . ./getfile
6630 libc="$ans"
6631
6632 echo " "
6633 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6634 set X `cat libnames`
6635 shift
6636 xxx=files
6637 case $# in 1) xxx=file; esac
6638 echo "Extracting names from the following $xxx for later perusal:" >&4
6639 echo " "
6640 $sed 's/^/      /' libnames >&4
6641 echo " "
6642 $echo $n "This may take a while...$c" >&4
6643
6644 for file in $*; do
6645         case $file in
6646         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6647         *) $nm $nm_opt $file 2>/dev/null;;
6648         esac
6649 done >libc.tmp
6650
6651 $echo $n ".$c"
6652 $grep fprintf libc.tmp > libc.ptf
6653 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6654 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6655 xxx='[ADTSIWi]'
6656 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6657         eval $xscan;\
6658         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6659                 eval $xrun
6660 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6661         eval $xscan;\
6662         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6663                 eval $xrun
6664 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6665         eval $xscan;\
6666         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6667                 eval $xrun
6668 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6669         eval $xscan;\
6670         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6671                 eval $xrun
6672 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6673         eval $xscan;\
6674         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6675                 eval $xrun
6676 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6677         eval $xscan;\
6678         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6679                 eval $xrun
6680 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6681                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6682         eval $xscan;\
6683         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6684                 eval $xrun
6685 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6686         eval $xscan;\
6687         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6688                 eval $xrun
6689 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6690         eval $xscan;\
6691         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6692                 eval $xrun
6693 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6694         eval $xscan;\
6695         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6696                 eval $xrun
6697 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6698         eval $xscan;\
6699         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6700                 eval $xrun
6701 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6702         eval $xscan;\
6703         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6704                 eval $xrun
6705 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6706         eval $xscan;\
6707         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6708                 eval $xrun
6709 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6710         eval $xscan;\
6711         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6712                 eval $xrun
6713 else
6714         $nm -p $* 2>/dev/null >libc.tmp
6715         $grep fprintf libc.tmp > libc.ptf
6716         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6717                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6718         then
6719                 nm_opt='-p'
6720                 eval $xrun
6721         else
6722                 echo " "
6723                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6724                 com=''
6725                 if $ar t $libc > libc.tmp && \
6726                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6727                 then
6728                         for thisname in $libnames $libc; do
6729                                 $ar t $thisname >>libc.tmp
6730                         done
6731                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6732                         echo "Ok." >&4
6733                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6734                         for thisname in $libnames $libc; do
6735                                 $ar tv $thisname >>libc.tmp
6736                                 emximp -o tmp.imp $thisname \
6737                                     2>/dev/null && \
6738                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6739                                     < tmp.imp >>libc.tmp
6740                                 $rm -f tmp.imp
6741                         done
6742                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6743                         echo "Ok." >&4
6744                 else
6745                         echo "$ar didn't seem to work right." >&4
6746                         echo "Maybe this is a Cray...trying bld instead..." >&4
6747                         if  bld t $libc | \
6748                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6749                                 $test -s libc.list
6750                         then
6751                                 for thisname in $libnames; do
6752                                         bld t $libnames | \
6753                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6754                                         $ar t $thisname >>libc.tmp
6755                                 done
6756                                 echo "Ok." >&4
6757                         else
6758                                 echo "That didn't work either.  Giving up." >&4
6759                                 exit 1
6760                         fi
6761                 fi
6762         fi
6763 fi
6764 nm_extract="$com"
6765 case "$PASE" in
6766 define)
6767     echo " "
6768     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6769     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6770     ;;
6771 *)  if $test -f /lib/syscalls.exp; then
6772         echo " "
6773         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6774         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6775                 /lib/syscalls.exp >>libc.list
6776     fi
6777     ;;
6778 esac
6779 ;;
6780 esac
6781 $rm -f libnames libpath
6782
6783 : Check if we are using C++
6784 echo " "
6785 echo "Checking for C++..." >&4
6786 $cat >try.c <<'EOCP'
6787 #include <stdio.h>
6788 int main(void)
6789 {
6790 #ifdef __cplusplus
6791     return 0;
6792 #else
6793     return 1;
6794 #endif
6795 }
6796 EOCP
6797 set try
6798 if eval $compile_ok && $run ./try; then
6799         val="$define"
6800         echo "You are using a C++ compiler."
6801 else
6802         val="$undef"
6803         echo "You are not using a C++ compiler."
6804 fi
6805 $rm_try cplusplus$$
6806 set d_cplusplus
6807 eval $setvar
6808
6809 : is a C symbol defined?
6810 csym='tlook=$1;
6811 case "$3" in
6812 -v) tf=libc.tmp; tdc="";;
6813 -a) tf=libc.tmp; tdc="[]";;
6814 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6815 esac;
6816 case "$d_cplusplus" in
6817     $define)    extern_C="extern \"C\"" ;;
6818     *)          extern_C="extern"       ;;
6819 esac;
6820 tx=yes;
6821 case "$reuseval-$4" in
6822 true-) ;;
6823 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6824 esac;
6825 case "$tx" in
6826 yes)
6827         tval=false;
6828         if $test "$runnm" = true; then
6829                 if $contains $tlook $tf >/dev/null 2>&1; then
6830                         tval=true;
6831                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6832                         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;
6833                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6834                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6835                         $rm_try;
6836                 fi;
6837         else
6838                 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;
6839                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6840                 $rm_try;
6841         fi;
6842         ;;
6843 *)
6844         case "$tval" in
6845         $define) tval=true;;
6846         *) tval=false;;
6847         esac;
6848         ;;
6849 esac;
6850 eval "$2=$tval"'
6851
6852 : define an is-in-libc? function
6853 inlibc='echo " "; td=$define; tu=$undef;
6854 sym=$1; var=$2; eval "was=\$$2";
6855 tx=yes;
6856 case "$reuseval$was" in
6857 true) ;;
6858 true*) tx=no;;
6859 esac;
6860 case "$tx" in
6861 yes)
6862         set $sym tres -f;
6863         eval $csym;
6864         case "$tres" in
6865         true)
6866                 echo "$sym() found." >&4;
6867                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6868         *)
6869                 echo "$sym() NOT found." >&4;
6870                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6871         esac;;
6872 *)
6873         case "$was" in
6874         $define) echo "$sym() found." >&4;;
6875         *) echo "$sym() NOT found." >&4;;
6876         esac;;
6877 esac'
6878
6879 : check for length of double
6880 echo " "
6881 case "$doublesize" in
6882 '')
6883         echo "Checking to see how big your double precision numbers are..." >&4
6884         $cat >try.c <<EOCP
6885 #include <stdio.h>
6886 #$i_stdlib I_STDLIB
6887 #ifdef I_STDLIB
6888 #include <stdlib.h>
6889 #endif
6890 int main()
6891 {
6892     printf("%d\n", (int)sizeof(double));
6893     exit(0);
6894 }
6895 EOCP
6896         set try
6897         if eval $compile_ok; then
6898                 doublesize=`$run ./try`
6899                 echo "Your double is $doublesize bytes long."
6900         else
6901                 dflt='8'
6902                 echo "(I can't seem to compile the test program.  Guessing...)"
6903                 rp="What is the size of a double precision number (in bytes)?"
6904                 . ./myread
6905                 doublesize="$ans"
6906         fi
6907         ;;
6908 esac
6909 $rm_try
6910
6911 : see if this is a float.h system
6912 set float.h i_float
6913 eval $inhdr
6914
6915 : check for long doubles
6916 echo " "
6917 echo "Checking to see if you have long double..." >&4
6918 echo 'int main() { long double x = 7.0; }' > try.c
6919 set try
6920 if eval $compile; then
6921         val="$define"
6922         echo "You have long double."
6923 else
6924         val="$undef"
6925         echo "You do not have long double."
6926 fi
6927 $rm_try
6928 set d_longdbl
6929 eval $setvar
6930
6931 : see if ldexpl exists
6932 set ldexpl d_ldexpl
6933 eval $inlibc
6934
6935 : check for length of long double
6936 case "${d_longdbl}${longdblsize}" in
6937 $define)
6938         echo " "
6939         echo "Checking to see how big your long doubles are..." >&4
6940         $cat >try.c <<'EOCP'
6941 #include <stdio.h>
6942 int main()
6943 {
6944         printf("%d\n", sizeof(long double));
6945 }
6946 EOCP
6947         set try
6948         set try
6949         if eval $compile; then
6950                 longdblsize=`$run ./try`
6951                 echo "Your long doubles are $longdblsize bytes long."
6952         else
6953                 dflt='8'
6954                 echo " "
6955                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6956                 rp="What is the size of a long double (in bytes)?"
6957                 . ./myread
6958                 longdblsize="$ans"
6959         fi
6960         if $test "X$doublesize" = "X$longdblsize"; then
6961                 echo "That isn't any different from an ordinary double."
6962                 echo "I'll keep your setting anyway, but you may see some"
6963                 echo "harmless compilation warnings."
6964         fi
6965         ;;
6966 esac
6967 $rm_try
6968
6969 $echo "Checking the kind of long doubles you have..." >&4
6970 case "$d_longdbl" in
6971 define)
6972 $cat <<EOP >try.c
6973 #$i_float I_FLOAT
6974 #$i_stdlib I_STDLIB
6975 #define LONGDBLSIZE $longdblsize
6976 #define DOUBLESIZE $doublesize
6977 #ifdef I_FLOAT
6978 #include <float.h>
6979 #endif
6980 #ifdef I_STDLIB
6981 #include <stdlib.h>
6982 #endif
6983 #include <stdio.h>
6984 static const long double d = -0.1L;
6985 int main() {
6986   unsigned const char* b = (unsigned const char*)(&d);
6987 #if DOUBLESIZE == LONGDBLSIZE
6988   printf("0\n"); /* if it floats like double */
6989   exit(0);
6990 #endif
6991 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6992   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6993     /* IEEE 754 128-bit little-endian */
6994     printf("1\n");
6995     exit(0);
6996   }
6997   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6998     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6999     printf("2\n");
7000     exit(0);
7001   }
7002 #endif
7003 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
7004  * while 64-bits platforms have it in 16 bytes.  The trailing bytes
7005  * cannot be trusted. */
7006 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
7007   if (b[0] == 0xCD && b[9] == 0xBF) {
7008     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
7009      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
7010      * Also known as "extended precision". */
7011     printf("3\n");
7012     exit(0);
7013   }
7014   if (b[0] == 0xBF && b[9] == 0xCD) {
7015     /* Is there ever big-endian 80-bit, really?
7016      *
7017      * The Motorola 68881 had another "extended precision" format:
7018      * sign:1 exp:15 zero:16 integer:1 mantissa:63
7019      * for total of 96 bits of bytes.  The zero bits were unused.
7020      * See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL" for more details.
7021      * If it ever becomes relevant, this format should be allocated
7022      * a new doublekind code since it's quite different from the Intel x87.
7023      */
7024     printf("4\n");
7025     exit(0);
7026   }
7027 #endif
7028 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
7029   /* software "double double", the 106 is 53+53.
7030    * but irix thinks it is 107. */
7031   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
7032     /* double double 128-bit fully little-endian,
7033      * little-endian doubles in little-endian order,
7034      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
7035     printf("5\n");
7036     exit(0);
7037   }
7038   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7039     /* double double 128-bit fully big-endian,
7040      * big-endian doubles in big-endian order,
7041      * e.g. PPC/Power and MIPS:
7042      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7043     printf("6\n");
7044     exit(0);
7045   }
7046   if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7047     /* double double 128-bit mixed endian.
7048      * little-endian doubles in big-endian order,
7049      * e.g. ppc64el,
7050      * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7051     printf("7\n");
7052     exit(0);
7053   }
7054   if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7055     /* double double 128-bit mixed endian,
7056      * big-endian doubles in little-endian order,
7057      * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7058     printf("8\n");
7059     exit(0);
7060   }
7061 #endif
7062 /* We are largely making this up because it may well be
7063  * that the VAX format H was never made available to C,
7064  * only to Fortran. */
7065 #if LONGDBLSIZE == 16 && defined(__vax__)
7066   if (b[0] == 0xFD && b[15] == 0x99) {
7067     /* VAX format H, PDP-11 mixed endian. */
7068     printf("9\n");
7069     exit(0);
7070   }
7071 #endif
7072   printf("-1\n"); /* unknown */
7073   exit(0);
7074 }
7075 EOP
7076 set try
7077 if eval $compile; then
7078     longdblkind=`$run ./try`
7079 else
7080     longdblkind=-1
7081 fi
7082 ;;
7083 *) longdblkind=0 ;;
7084 esac
7085 case "$longdblkind" in
7086 0) echo "Your long doubles are doubles." >&4 ;;
7087 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7088 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7089 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
7090 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
7091 5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >& 4 ;;
7092 6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >& 4 ;;
7093 7) echo "You have 128-bit mixed-endian double-double long doubles (64-bit LEs in BE)." >& 4 ;;
7094 8) echo "You have 128-bit mixed-endian double-double long doubles (64-bit BEs in LE)." >& 4 ;;
7095 9) echo "You have 128-bit PDP-style mixed-endian long doubles (VAX format H)." >& 4 ;;
7096 *) echo "Cannot figure out your long double." >&4 ;;
7097 esac
7098 d_long_double_style_ieee=$undef
7099 d_long_double_style_ieee_std=$undef
7100 d_long_double_style_ieee_extended=$undef
7101 d_long_double_style_ieee_doubledouble=$undef
7102 d_long_double_style_vax=$undef
7103 case "$longdblkind" in
7104 1|2|3|4|5|6|7|8) d_long_double_style_ieee=$define ;;
7105 esac
7106 case "$longdblkind" in
7107 1|2) d_long_double_style_ieee_std=$define ;;
7108 esac
7109 case "$longdblkind" in
7110 3|4) d_long_double_style_ieee_extended=$define ;;
7111 esac
7112 case "$longdblkind" in
7113 5|6|7|8) d_long_double_style_ieee_doubledouble=$define ;;
7114 esac
7115 case "$longdblkind" in
7116 9) d_long_double_style_vax=$define ;;
7117 esac
7118 $rm_try
7119
7120 : determine the architecture name
7121 echo " "
7122 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7123         tarch=`arch`"-$osname"
7124 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7125         if uname -m > tmparch 2>&1 ; then
7126                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7127                         -e 's/$/'"-$osname/" tmparch`
7128         else
7129                 tarch="$osname"
7130         fi
7131         $rm -f tmparch
7132 else
7133         tarch="$osname"
7134 fi
7135 case "$myarchname" in
7136 ''|"$tarch") ;;
7137 *)
7138         echo "(Your architecture name used to be $myarchname.)"
7139         archname=''
7140         ;;
7141 esac
7142 case "$targetarch" in
7143 '') ;;
7144 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7145 esac
7146 myarchname="$tarch"
7147 case "$archname" in
7148 '') dflt="$tarch";;
7149 *) dflt="$archname";;
7150 esac
7151 rp='What is your architecture name'
7152 . ./myread
7153 archname="$ans"
7154
7155 : optionally add API version to the architecture for versioned archlibs
7156 case "$useversionedarchname" in
7157 $define|true|[yY]*) dflt='y';;
7158 *)                  dflt='n';;
7159 esac
7160 rp='Add the Perl API version to your archname?'
7161 . ./myread
7162 case "$ans" in
7163 y|Y)    useversionedarchname="$define" ;;
7164 *)      useversionedarchname="$undef" ;;
7165 esac
7166 case "$useversionedarchname" in
7167 $define)
7168         case "$archname" in
7169         *-$api_versionstring)
7170                 echo "...and architecture name already has -$api_versionstring" >&4
7171                 ;;
7172         *)
7173                 archname="$archname-$api_versionstring"
7174                 echo "...setting architecture name to $archname." >&4
7175                 ;;
7176         esac
7177         ;;
7178 esac
7179
7180 case "$usethreads" in
7181 $define)
7182         echo "Threads selected." >&4
7183         case "$archname" in
7184         *-thread*) echo "...and architecture name already has -thread." >&4
7185                 ;;
7186         *)      archname="$archname-thread"
7187                 echo "...setting architecture name to $archname." >&4
7188                 ;;
7189         esac
7190         ;;
7191 esac
7192 case "$usemultiplicity" in
7193 $define)
7194         echo "Multiplicity selected." >&4
7195         case "$archname" in
7196         *-multi*) echo "...and architecture name already has -multi." >&4
7197                 ;;
7198         *)      archname="$archname-multi"
7199                 echo "...setting architecture name to $archname." >&4
7200                 ;;
7201         esac
7202         ;;
7203 esac
7204 case "$use64bitint$use64bitall" in
7205 *"$define"*)
7206         case "$archname64" in
7207         '')
7208                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7209                 ;;
7210         *)
7211                 case "$use64bitint" in
7212                 "$define") echo "64 bit integers selected." >&4 ;;
7213                 esac
7214                 case "$use64bitall" in
7215                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7216                 esac
7217                 case "$archname" in
7218                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7219                         ;;
7220                 *)      archname="$archname-$archname64"
7221                         echo "...setting architecture name to $archname." >&4
7222                         ;;
7223                 esac
7224                 ;;
7225         esac
7226 esac
7227 case "$uselongdouble" in
7228 $define)
7229         echo "Long doubles selected." >&4
7230         case "$longdblsize" in
7231         $doublesize)
7232                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7233                 ;;
7234         *)
7235                 case "$archname" in
7236                 *-ld*) echo "...and architecture name already has -ld." >&4
7237                         ;;
7238                 *)      archname="$archname-ld"
7239                         echo "...setting architecture name to $archname." >&4
7240                         ;;
7241                 esac
7242                 ;;
7243         esac
7244         ;;
7245 esac
7246 case "$usequadmath" in
7247 $define)
7248         echo "quadmath selected." >&4
7249         case "$archname" in
7250         *-quadmath*) echo "...and architecture name already has -quadmath." >&4
7251                 ;;
7252         *)      archname="$archname-quadmath"
7253                 echo "...setting architecture name to $archname." >&4
7254                 ;;
7255         esac
7256         ;;
7257 esac
7258 if $test -f archname.cbu; then
7259         echo "Your platform has some specific hints for architecture name, using them..."
7260         . ./archname.cbu
7261 fi
7262
7263 : set the prefixit variable, to compute a suitable default value
7264 prefixit='case "$3" in
7265 ""|none)
7266         case "$oldprefix" in
7267         "") eval "$1=\"\$$2\"";;
7268         *)
7269                 case "$3" in
7270                 "") eval "$1=";;
7271                 none)
7272                         eval "tp=\"\$$2\"";
7273                         case "$tp" in
7274                         ""|" ") eval "$1=\"\$$2\"";;
7275                         *) eval "$1=";;
7276                         esac;;
7277                 esac;;
7278         esac;;
7279 *)
7280         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7281         case "$tp" in
7282         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7283         /*-$oldprefix/*|\~*-$oldprefix/*)
7284                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7285         *) eval "$1=\"\$$2\"";;
7286         esac;;
7287 esac'
7288
7289 : determine installation style
7290 : For now, try to deduce it from prefix unless it is already set.
7291 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7292 case "$installstyle" in
7293 '')     case "$prefix" in
7294                 *perl*) dflt='lib';;
7295                 *) dflt='lib/perl5' ;;
7296         esac
7297         ;;
7298 *)      dflt="$installstyle" ;;
7299 esac
7300 : Probably not worth prompting for this since we prompt for all
7301 : the directories individually, and the prompt would be too long and
7302 : confusing anyway.
7303 installstyle=$dflt
7304
7305 : determine where public executables go
7306 echo " "
7307 set dflt bin bin
7308 eval $prefixit
7309 fn=d~
7310 rp='Pathname where the public executables will reside?'
7311 . ./getfile
7312 if $test "X$ansexp" != "X$binexp"; then
7313         installbin=''
7314 fi
7315 prefixvar=bin
7316 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7317 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7318 :     this via initialinstalllocation
7319 . ./setprefixvar
7320
7321 case "$userelocatableinc" in
7322 $define|true|[yY]*)     dflt='y' ;;
7323 *)                      dflt='n' ;;
7324 esac
7325 cat <<EOM
7326
7327 Would you like to build Perl so that the installation is relocatable, so that
7328 library paths in @INC are determined relative to the path of the perl binary?
7329 This is not advised for system Perl installs, or if you need to run setid
7330 scripts or scripts under taint mode.
7331
7332 If this doesn't make any sense to you, just accept the default '$dflt'.
7333 EOM
7334 rp='Use relocatable @INC?'
7335 . ./myread
7336 case "$ans" in
7337 y|Y)    val="$define" ;;
7338 *)      val="$undef"  ;;
7339 esac
7340 set userelocatableinc
7341 eval $setvar
7342
7343 initialinstalllocation="$binexp"
7344 : Default prefix is now "up one level from where the binaries are"
7345 case "$userelocatableinc" in
7346 $define|true|[yY]*)
7347     bin=".../"
7348     binexp=".../"
7349     prefix=".../.."
7350     prefixexp=".../.."
7351     installprefixexp=".../.."
7352     ;;
7353 esac
7354
7355 : determine where private library files go
7356 : Usual default is /usr/local/lib/perl5/$version.
7357 : Also allow things like /opt/perl/lib/$version, since
7358 : /opt/perl/lib/perl5... would be redundant.
7359 : The default "style" setting is made in installstyle.U
7360 case "$installstyle" in
7361 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7362 *)       set dflt privlib lib/$version ;;
7363 esac
7364 eval $prefixit
7365 $cat <<EOM
7366
7367 There are some auxiliary files for $package that need to be put into a
7368 private library directory that is accessible by everyone.
7369
7370 EOM
7371 fn=$binexp
7372 fn=d~+
7373 rp='Pathname where the private library files will reside?'
7374 . ./getfile
7375 prefixvar=privlib
7376 . ./setprefixvar
7377
7378 : set the prefixup variable, to restore leading tilda escape
7379 prefixup='case "$prefixexp" in
7380 "$prefix") ;;
7381 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7382 esac'
7383
7384 : determine where public architecture dependent libraries go
7385 set archlib archlib
7386 eval $prefixit
7387 : privlib default is /usr/local/lib/$package/$version
7388 : archlib default is /usr/local/lib/$package/$version/$archname
7389 : privlib may have an optional trailing /share.
7390 tdflt=`echo $privlib | $sed 's,/share$,,'`
7391 tdflt=$tdflt/$archname
7392 case "$archlib" in
7393 '')     dflt=$tdflt
7394         ;;
7395 *)      dflt="$archlib"
7396     ;;
7397 esac
7398 $cat <<EOM
7399
7400 $spackage contains architecture-dependent library files.  If you are
7401 sharing libraries in a heterogeneous environment, you might store
7402 these files in a separate location.  Otherwise, you can just include
7403 them with the rest of the public library files.
7404
7405 EOM
7406 fn=$binexp
7407 fn=d+~
7408 rp='Where do you want to put the public architecture-dependent libraries?'
7409 . ./getfile
7410 prefixvar=archlib
7411 . ./setprefixvar
7412 if $test X"$archlib" = X"$privlib"; then
7413         d_archlib="$undef"
7414 else
7415         d_archlib="$define"
7416 fi
7417
7418 : see if setuid scripts can be secure
7419 $cat <<EOM
7420
7421 Some kernels have a bug that prevents setuid #! scripts from being
7422 secure.  Some sites have disabled setuid #! scripts because of this.
7423
7424 First let's decide if your kernel supports secure setuid #! scripts.
7425 (If setuid #! scripts would be secure but have been disabled anyway,
7426 don't say that they are secure if asked.)
7427
7428 EOM
7429
7430 val="$undef"
7431 if $test -d /dev/fd; then
7432         echo "#!$ls" >reflect
7433         chmod +x,u+s reflect
7434         ./reflect >flect 2>&1
7435         if $contains "/dev/fd" flect >/dev/null; then
7436                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7437                 val="$define"
7438         else
7439                 $cat <<EOM
7440 If you are not sure if they are secure, I can check but I'll need a
7441 username and password different from the one you are using right now.
7442 If you don't have such a username or don't want me to test, simply
7443 enter 'none'.
7444
7445 EOM
7446                 rp='Other username to test security of setuid scripts with?'
7447                 dflt='none'
7448                 . ./myread
7449                 case "$ans" in
7450                 n|none)
7451                         case "$d_suidsafe" in
7452                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7453                                 dflt=n;;
7454                         "$undef")
7455                                 echo "Well, the $hint value is *not* secure." >&4
7456                                 dflt=n;;
7457                         *)      echo "Well, the $hint value *is* secure." >&4
7458                                 dflt=y;;
7459                         esac
7460                         ;;
7461                 *)
7462                         $rm -f reflect flect
7463                         echo "#!$ls" >reflect
7464                         chmod +x,u+s reflect
7465                         echo >flect
7466                         chmod a+w flect
7467                         echo '"su" will (probably) prompt you for '"$ans's password."
7468                         su $ans -c './reflect >flect'
7469                         if $contains "/dev/fd" flect >/dev/null; then
7470                                 echo "Okay, it looks like setuid scripts are secure." >&4
7471                                 dflt=y
7472                         else
7473                                 echo "I don't think setuid scripts are secure." >&4
7474                                 dflt=n
7475                         fi
7476                         ;;
7477                 esac
7478                 rp='Does your kernel have *secure* setuid scripts?'
7479                 . ./myread
7480                 case "$ans" in
7481                 [yY]*)  val="$define";;
7482                 *)      val="$undef";;
7483                 esac
7484         fi
7485 else
7486         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7487         echo "(That's for file descriptors, not floppy disks.)"
7488         val="$undef"
7489 fi
7490 set d_suidsafe
7491 eval $setvar
7492
7493 $rm -f reflect flect
7494
7495 : now see if they want to do setuid emulation
7496 if $test $patchlevel -lt 11; then
7497 echo " "
7498 val="$undef"
7499 case "$d_suidsafe" in
7500 "$define")
7501         val="$undef"
7502         echo "No need to emulate SUID scripts since they are secure here." >&4
7503         ;;
7504 *)
7505         $cat <<EOM
7506 Some systems have disabled setuid scripts, especially systems where
7507 setuid scripts cannot be secure.  On systems where setuid scripts have
7508 been disabled, the setuid/setgid bits on scripts are currently
7509 useless.  It is possible for $package to detect those bits and emulate
7510 setuid/setgid in a secure fashion.  This emulation will only work if
7511 setuid scripts have been disabled in your kernel.
7512
7513 EOM
7514         case "$d_dosuid" in
7515         "$define") dflt=y ;;
7516         *) dflt=n ;;
7517         esac
7518         rp="Do you want to do setuid/setgid emulation?"
7519         . ./myread
7520         case "$ans" in
7521         [yY]*)  val="$define";;
7522         *)      val="$undef";;
7523         esac
7524         ;;
7525 esac
7526 set d_dosuid
7527 eval $setvar
7528 else
7529     case "$d_dosuid" in
7530         "$define")
7531         cat >&4 <<EOH
7532
7533 SUID emulation has been removed for 5.12
7534 Please re-run Configure without -Dd_dosuid
7535
7536 EOH
7537         exit 1;
7538         ;;
7539     esac
7540     d_dosuid=undef
7541 fi
7542
7543 : Find perl5.005 or later.
7544 echo "Looking for a previously installed perl5.005 or later... "
7545 case "$perl5" in
7546 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7547                 : Check if this perl is recent and can load a simple module
7548                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7549                         perl5=$tdir/perl
7550                         break;
7551                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7552                         perl5=$tdir/perl5
7553                         break;
7554                 fi
7555         done
7556         ;;
7557 *)      perl5="$perl5"
7558         ;;
7559 esac
7560 case "$perl5" in
7561 '')     echo "None found.  That's ok.";;
7562 *)      echo "Using $perl5." ;;
7563 esac
7564
7565 : Set the siteprefix variables
7566 $cat <<EOM
7567
7568 After $package is installed, you may wish to install various
7569 add-on modules and utilities.  Typically, these add-ons will
7570 be installed under $prefix with the rest
7571 of this package.  However, you may wish to install such add-ons
7572 elsewhere under a different prefix.
7573
7574 If you do not wish to put everything under a single prefix, that's
7575 ok.  You will be prompted for the individual locations; this siteprefix
7576 is only used to suggest the defaults.
7577
7578 The default should be fine for most people.
7579
7580 EOM
7581 fn=d~+
7582 rp='Installation prefix to use for add-on modules and utilities?'
7583 : XXX Here might be another good place for an installstyle setting.
7584 case "$siteprefix" in
7585 '') dflt=$prefix ;;
7586 *)  dflt=$siteprefix ;;
7587 esac
7588 . ./getfile
7589 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7590 oldsiteprefix=''
7591 case "$siteprefix" in
7592 '') ;;
7593 *)      case "$ans" in
7594         "$prefix") ;;
7595         *) oldsiteprefix="$prefix";;
7596         esac
7597         ;;
7598 esac
7599 siteprefix="$ans"
7600 siteprefixexp="$ansexp"
7601
7602 : determine where site specific libraries go.
7603 : Usual default is /usr/local/lib/perl5/site_perl/$version
7604 : The default "style" setting is made in installstyle.U
7605 : XXX No longer works with Prefixit stuff.
7606 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7607 case "$sitelib" in
7608 '') case "$installstyle" in
7609         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7610         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7611         esac
7612         ;;
7613 *)      dflt="$sitelib"
7614         ;;
7615 esac
7616 $cat <<EOM
7617
7618 The installation process will create a directory for
7619 site-specific extensions and modules.  Most users find it convenient
7620 to place all site-specific files in this directory rather than in the
7621 main distribution directory.
7622
7623 EOM
7624 fn=d~+
7625 rp='Pathname for the site-specific library files?'
7626 . ./getfile
7627 prefixvar=sitelib
7628 . ./setprefixvar
7629 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7630
7631 : Determine list of previous versions to include in @INC
7632 $cat > getverlist <<EOPL
7633 #!$perl5 -w
7634 use File::Basename;
7635 \$api_versionstring = "$api_versionstring";
7636 \$version = "$version";
7637 \$stem = "$sitelib_stem";
7638 \$archname = "$archname";
7639 EOPL
7640         $cat >> getverlist <<'EOPL'
7641 # The list found is store twice for each entry: the original name, and
7642 # the binary broken down version as pack "sss", so sorting is easy and
7643 # unambiguous. This will work for all versions that have a maximum of
7644 # three digit groups, separate by '.'s or '_'s. Names are extended with
7645 # ".0.0" to ensure at least three elements for the pack.
7646 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7647
7648 # Can't have leading @ because metaconfig interprets it as a command!
7649 ;@inc_version_list=();
7650 # XXX Redo to do opendir/readdir?
7651 if (-d $stem) {
7652     chdir($stem);
7653     ;@candidates = map {
7654         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7655     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7656 }
7657 else {
7658     ;@candidates = ();
7659 }
7660
7661 ($pversion, $aversion, $vsn5005) = map {
7662     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7663 foreach $d (@candidates) {
7664     if ($d->[1] lt $pversion) {
7665         if ($d->[1] ge $aversion) {
7666             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7667         }
7668         elsif ($d->[1] ge $vsn5005) {
7669             unshift(@inc_version_list, grep { -d } $d->[0]);
7670         }
7671     }
7672     else {
7673         # Skip newer version.  I.e. don't look in
7674         # 5.7.0 if we're installing 5.6.1.
7675     }
7676 }
7677
7678 if (@inc_version_list) {
7679     print join(' ', @inc_version_list);
7680 }
7681 else {
7682     # Blank space to preserve value for next Configure run.
7683     print " ";
7684 }
7685 EOPL
7686 chmod +x getverlist
7687 case "$inc_version_list" in
7688 '')     if test -x "$perl5$exe_ext"; then
7689                 dflt=`$perl5 getverlist`
7690         else
7691                 dflt='none'
7692         fi
7693         ;;
7694 $undef) dflt='none' ;;
7695 *)  eval dflt=\"$inc_version_list\" ;;
7696 esac
7697 case "$dflt" in
7698 ''|' ') dflt=none ;;
7699 esac
7700 case "$dflt" in
7701 5.005) dflt=none ;;
7702 esac
7703 $cat <<EOM
7704
7705 In order to ease the process of upgrading, this version of perl
7706 can be configured to use modules built and installed with earlier
7707 versions of perl that were installed under $prefix.  Specify here
7708 the list of earlier versions that this version of perl should check.
7709 If Configure detected no earlier versions of perl installed under
7710 $prefix, then the list will be empty.  Answer 'none' to tell perl
7711 to not search earlier versions.
7712
7713 The default should almost always be sensible, so if you're not sure,
7714 just accept the default.
7715 EOM
7716
7717 rp='List of earlier versions to include in @INC?'
7718 . ./myread
7719 case "$ans" in
7720 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7721 *) inc_version_list="$ans" ;;
7722 esac
7723 case "$inc_version_list" in
7724 ''|' ')
7725         inc_version_list_init='0'
7726         d_inc_version_list="$undef"
7727         ;;
7728 *)      inc_version_list_init=`echo $inc_version_list |
7729                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7730         d_inc_version_list="$define"
7731         ;;
7732 esac
7733 $rm -f getverlist
7734
7735 : see if malloc/malloc.h has to be included
7736 set malloc/malloc.h i_mallocmalloc
7737 eval $inhdr
7738
7739 : see if this is a malloc.h system
7740 : we want a real compile instead of Inhdr because some systems have a
7741 : malloc.h that just gives a compile error saying to use stdlib.h instead
7742 echo " "
7743 $cat >try.c <<EOCP
7744 #include <stdlib.h>
7745 #include <malloc.h>
7746 #$i_mallocmalloc I_MALLOCMALLOC
7747 #ifdef I_MALLOCMALLOC
7748 # include <malloc/malloc.h>
7749 #endif
7750
7751 int main () { return 0; }
7752 EOCP
7753 set try
7754 if eval $compile; then
7755     echo "<malloc.h> found." >&4
7756     val="$define"
7757 else
7758     echo "<malloc.h> NOT found." >&4
7759     val="$undef"
7760 fi
7761 $rm_try
7762 set i_malloc
7763 eval $setvar
7764
7765 : check for length of pointer
7766 echo " "
7767 case "$ptrsize" in
7768 '')
7769         echo "Checking to see how big your pointers are..." >&4
7770         $cat >try.c <<EOCP
7771 #include <stdio.h>
7772 #$i_stdlib I_STDLIB
7773 #ifdef I_STDLIB
7774 #include <stdlib.h>
7775 #endif
7776 int main()
7777 {
7778     printf("%d\n", (int)sizeof(void *));
7779     exit(0);
7780 }
7781 EOCP
7782         set try
7783         if eval $compile_ok; then
7784                 ptrsize=`$run ./try`
7785                 echo "Your pointers are $ptrsize bytes long."
7786         else
7787                 dflt='4'
7788                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7789                 rp="What is the size of a pointer (in bytes)?"
7790                 . ./myread
7791                 ptrsize="$ans"
7792         fi
7793         ;;
7794 esac
7795 $rm_try
7796 case "$use64bitall" in
7797 "$define"|true|[yY]*)
7798         case "$ptrsize" in
7799         4)      cat <<EOM >&4
7800
7801 *** You have chosen a maximally 64-bit build,
7802 *** but your pointers are only 4 bytes wide.
7803 *** Please rerun Configure without -Duse64bitall.
7804 EOM
7805                 case "$d_quad" in
7806                 define)
7807                         cat <<EOM >&4
7808 *** Since you have quads, you could possibly try with -Duse64bitint.
7809 EOM
7810                         ;;
7811                 esac
7812                 cat <<EOM >&4
7813 *** Cannot continue, aborting.
7814
7815 EOM
7816
7817                 exit 1
7818                 ;;
7819         esac
7820         ;;
7821 esac
7822
7823
7824 : determine whether to use malloc wrapping
7825 echo " "
7826 case "$usemallocwrap" in
7827 [yY]*|true|$define)     dflt='y' ;;
7828 [nN]*|false|$undef)     dflt='n' ;;
7829 *)      case "$usedevel" in
7830         [yY]*|true|$define)     dflt='y' ;;
7831         *) dflt='n' ;;
7832         esac
7833         ;;
7834 esac
7835 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7836 . ./myread
7837 usemallocwrap="$ans"
7838 case "$ans" in
7839 y*|true)
7840         usemallocwrap="$define" ;;
7841 *)
7842         usemallocwrap="$undef" ;;
7843 esac
7844
7845 : determine which malloc to compile in
7846 echo " "
7847 case "$usemymalloc" in
7848 [yY]*|true|$define)     dflt='y' ;;
7849 [nN]*|false|$undef)     dflt='n' ;;
7850 *)      case "$ptrsize" in
7851         4) dflt='y' ;;
7852         *) dflt='n' ;;
7853         esac
7854         if test "$useithreads" = "$define"; then dflt='n'; fi
7855         ;;
7856 esac
7857 rp="Do you wish to attempt to use the malloc that comes with $package?"
7858 . ./myread
7859 usemymalloc="$ans"
7860 case "$ans" in
7861 y*|true)
7862         usemymalloc='y'
7863         mallocsrc='malloc.c'
7864         mallocobj="malloc$_o"
7865         d_mymalloc="$define"
7866         case "$libs" in
7867         *-lmalloc*)
7868                 : Remove malloc from list of libraries to use
7869                 echo "Removing unneeded -lmalloc from library list" >&4
7870                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7871                 shift
7872                 libs="$*"
7873                 echo "libs = $libs" >&4
7874                 ;;
7875         esac
7876         ;;
7877 *)
7878         usemymalloc='n'
7879         mallocsrc=''
7880         mallocobj=''
7881         d_mymalloc="$undef"
7882         ;;
7883 esac
7884
7885 : compute the return types of malloc and free
7886 echo " "
7887 $cat >malloc.c <<END
7888 #$i_malloc I_MALLOC
7889 #$i_stdlib I_STDLIB
7890 #include <stdio.h>
7891 #include <sys/types.h>
7892 #ifdef I_MALLOC
7893 #include <malloc.h>
7894 #endif
7895 #ifdef I_STDLIB
7896 #include <stdlib.h>
7897 #endif
7898 #ifdef TRY_MALLOC
7899 void *malloc();
7900 #endif
7901 #ifdef TRY_FREE
7902 void free();
7903 #endif
7904 END
7905 case "$malloctype" in
7906 '')
7907         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7908                 malloctype='void *'
7909         else
7910                 malloctype='char *'
7911         fi
7912         ;;
7913 esac
7914 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7915
7916 case "$freetype" in
7917 '')
7918         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7919                 freetype='void'
7920         else
7921                 freetype='int'
7922         fi
7923         ;;
7924 esac
7925 echo "Your system uses $freetype free(), it would seem." >&4
7926 $rm -f malloc.[co]
7927 : determine where site specific architecture-dependent libraries go.
7928 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7929 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7930 : sitelib may have an optional trailing /share.
7931 case "$sitearch" in
7932 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7933         dflt="$dflt/$archname"
7934         ;;
7935 *)      dflt="$sitearch"
7936         ;;
7937 esac
7938 set sitearch sitearch none
7939 eval $prefixit
7940 $cat <<EOM
7941
7942 The installation process will also create a directory for
7943 architecture-dependent site-specific extensions and modules.
7944
7945 EOM
7946 fn=d~+
7947 rp='Pathname for the site-specific architecture-dependent library files?'
7948 . ./getfile
7949 prefixvar=sitearch
7950 . ./setprefixvar
7951 if $test X"$sitearch" = X"$sitelib"; then
7952         d_sitearch="$undef"
7953 else
7954         d_sitearch="$define"
7955 fi
7956
7957 : Set the vendorprefix variables
7958 $cat <<EOM
7959
7960 The installation process will also create a directory for
7961 vendor-supplied add-ons.  Vendors who supply perl with their system
7962 may find it convenient to place all vendor-supplied files in this
7963 directory rather than in the main distribution directory.  This will
7964 ease upgrades between binary-compatible maintenance versions of perl.
7965
7966 Of course you may also use these directories in whatever way you see
7967 fit.  For example, you might use them to access modules shared over a
7968 company-wide network.
7969
7970 The default answer should be fine for most people.
7971 This causes further questions about vendor add-ons to be skipped
7972 and no vendor-specific directories will be configured for perl.
7973
7974 EOM
7975 rp='Do you want to configure vendor-specific add-on directories?'
7976 case "$usevendorprefix" in
7977 define|true|[yY]*) dflt=y ;;
7978 *)      : User may have set vendorprefix directly on Configure command line.
7979         case "$vendorprefix" in
7980         ''|' ') dflt=n ;;
7981         *)      dflt=y ;;
7982         esac
7983         ;;
7984 esac
7985 . ./myread
7986 case "$ans" in
7987 [yY]*)  fn=d~+
7988         rp='Installation prefix to use for vendor-supplied add-ons?'
7989         case "$vendorprefix" in
7990         '') dflt="$prefix" ;;
7991         *)  dflt=$vendorprefix ;;
7992         esac
7993         . ./getfile
7994         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7995         oldvendorprefix=''
7996         case "$vendorprefix" in
7997         '') ;;
7998         *)      case "$ans" in
7999                 "$prefix") ;;
8000                 *) oldvendorprefix="$prefix";;
8001                 esac
8002                 ;;
8003         esac
8004         usevendorprefix="$define"
8005         vendorprefix="$ans"
8006         vendorprefixexp="$ansexp"
8007         ;;
8008 *)      usevendorprefix="$undef"
8009         vendorprefix=''
8010         vendorprefixexp=''
8011         ;;
8012 esac
8013
8014 : Set the vendorlib variables
8015 case "$vendorprefix" in
8016 '')     d_vendorlib="$undef"
8017         vendorlib=''
8018         vendorlibexp=''
8019         ;;
8020 *)      d_vendorlib="$define"
8021         : determine where vendor-supplied modules go.
8022         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
8023         case "$vendorlib" in
8024         '')
8025                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8026                 case "$installstyle" in
8027                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
8028                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
8029                 esac
8030                 ;;
8031         *)      dflt="$vendorlib"
8032                 ;;
8033         esac
8034         fn=d~+
8035         rp='Pathname for the vendor-supplied library files?'
8036         . ./getfile
8037         vendorlib="$ans"
8038         vendorlibexp="$ansexp"
8039         ;;
8040 esac
8041 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
8042 prefixvar=vendorlib
8043 . ./installprefix
8044
8045 : Set the vendorarch variables
8046 case "$vendorprefix" in
8047 '')     d_vendorarch="$undef"
8048         vendorarch=''
8049         vendorarchexp=''
8050         ;;
8051 *)      d_vendorarch="$define"
8052         : determine where vendor-supplied architecture-dependent libraries go.
8053         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
8054         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
8055         : vendorlib may have an optional trailing /share.
8056         case "$vendorarch" in
8057         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
8058                 dflt="$dflt/$archname"
8059                 ;;
8060         *)      dflt="$vendorarch" ;;
8061         esac
8062         fn=d~+
8063         rp='Pathname for vendor-supplied architecture-dependent files?'
8064         . ./getfile
8065         vendorarch="$ans"
8066         vendorarchexp="$ansexp"
8067         ;;
8068 esac
8069 prefixvar=vendorarch
8070 . ./installprefix
8071 if $test X"$vendorarch" = X"$vendorlib"; then
8072         d_vendorarch="$undef"
8073 else
8074         d_vendorarch="$define"
8075 fi
8076
8077 : Final catch-all directories to search
8078 $cat <<EOM
8079
8080 Lastly, you can have perl look in other directories for extensions and
8081 modules in addition to those already specified.
8082 These directories will be searched after
8083         $sitearch
8084         $sitelib
8085 EOM
8086 test X"$vendorlib" != "X" && echo '     ' $vendorlib
8087 test X"$vendorarch" != "X" && echo '    ' $vendorarch
8088 echo ' '
8089 case "$otherlibdirs" in
8090 ''|' ') dflt='none' ;;
8091 *)      dflt="$otherlibdirs" ;;
8092 esac
8093 $cat <<EOM
8094 Enter a colon-separated set of extra paths to include in perl's @INC
8095 search path, or enter 'none' for no extra paths.
8096
8097 EOM
8098
8099 rp='Colon-separated list of additional directories for perl to search?'
8100 . ./myread
8101 case "$ans" in
8102 ' '|''|none)    otherlibdirs=' ' ;;
8103 *)      otherlibdirs="$ans" ;;
8104 esac
8105 case "$otherlibdirs" in
8106 ' ') val=$undef ;;
8107 *)      val=$define ;;
8108 esac
8109 set d_perl_otherlibdirs
8110 eval $setvar
8111
8112 : Cruising for prototypes
8113 echo " "
8114 echo "Checking out function prototypes..." >&4
8115 $cat >prototype.c <<EOCP
8116 #$i_stdlib I_STDLIB
8117 #ifdef I_STDLIB
8118 #include <stdlib.h>
8119 #endif
8120 int main(int argc, char *argv[]) {
8121         exit(0);}
8122 EOCP
8123 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
8124         echo "Your C compiler appears to support function prototypes."
8125         val="$define"
8126 else
8127         echo "Your C compiler doesn't seem to understand function prototypes."
8128         val="$undef"
8129 fi
8130 set prototype
8131 eval $setvar
8132 $rm -f prototype*
8133
8134 : Check if ansi2knr is required
8135 case "$prototype" in
8136 "$define") ;;
8137 *)      ansi2knr='ansi2knr'
8138         echo " "
8139         cat <<EOM >&4
8140
8141 $me:  FATAL ERROR:
8142 This version of $package can only be compiled by a compiler that
8143 understands function prototypes.  Unfortunately, your C compiler
8144         $cc $ccflags
8145 doesn't seem to understand them.  Sorry about that.
8146
8147 If GNU cc is available for your system, perhaps you could try that instead.
8148
8149 Eventually, we hope to support building Perl with pre-ANSI compilers.
8150 If you would like to help in that effort, please contact <perlbug@perl.org>.
8151
8152 Aborting Configure now.
8153 EOM
8154         exit 2
8155         ;;
8156 esac
8157
8158 : DTrace support
8159 dflt_dtrace='/usr/sbin/dtrace'
8160 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8161
8162 cat <<EOM
8163
8164 Perl can be built to support DTrace on platforms that support it.
8165 DTrace is a diagnosis and performance analysis tool from Sun.
8166
8167 If this doesn't make any sense to you, just accept the default.
8168 EOM
8169
8170 while $test 1 ; do
8171         case "$usedtrace" in
8172         $define|true|[yY]*)
8173                 dflt='y'
8174                 ;;
8175         ?*)
8176                 dflt='y'
8177                 dflt_dtrace=$usedtrace
8178                 ;;
8179         *)
8180                 dflt='n'
8181                 ;;
8182         esac
8183
8184         rp='Support DTrace if available?'
8185         . ./myread
8186         case "$ans" in
8187         y|Y)    val="$define" ;;
8188         *)      val="$undef" ;;
8189         esac
8190         set usedtrace
8191         eval $setvar
8192
8193         test "X$usedtrace" != "X$define" && break
8194
8195         echo " "
8196         rp='Where is the dtrace executable?'
8197         dflt=$dflt_dtrace
8198         . ./getfile
8199         val="$ans"
8200         set dtrace
8201         eval $setvar
8202
8203         if $test -f $dtrace
8204         then
8205                 if $dtrace -h -s ../perldtrace.d \
8206                         -o perldtrace.tmp >/dev/null 2>&1 \
8207                         && rm -f perldtrace.tmp
8208                 then
8209                         echo " "
8210                         echo "Good: your $dtrace knows about the -h flag."
8211                 else
8212                         cat >&2 <<EOM
8213
8214 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8215 ***
8216 *** Your installed dtrace doesn't support the -h switch to compile a D
8217 *** program into a C header. Can't continue.
8218
8219 EOM
8220                         exit 1
8221                 fi
8222                 break;
8223         fi
8224
8225         case "$fastread" in
8226         yes)
8227                 cat >&2 <<EOM
8228
8229 *** $me:  Fatal Error:  $dtrace not found.
8230 *** Can't continue.
8231
8232 EOM
8233                 exit 1
8234                 ;;
8235         *)
8236                 echo "*** $dtrace was not found."
8237                 echo " "
8238                 ;;
8239         esac
8240 done
8241
8242 : See if we want extra modules installed
8243 echo " "
8244 case "$extras" in
8245 '') dflt='n';;
8246 *) dflt='y';;
8247 esac
8248 cat <<EOM
8249 Perl can be built with extra modules or bundles of modules which
8250 will be fetched from the CPAN and installed alongside Perl.
8251
8252 Notice that you will need access to the CPAN; either via the Internet,
8253 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8254 be asked later to configure the CPAN.pm module which will in turn do
8255 the installation of the rest of the extra modules or bundles.)
8256
8257 Notice also that if the modules require any external software such as
8258 libraries and headers (the libz library and the zlib.h header for the
8259 Compress::Zlib module, for example) you MUST have any such software
8260 already installed, this configuration process will NOT install such
8261 things for you.
8262
8263 If this doesn't make any sense to you, just accept the default '$dflt'.
8264 EOM
8265 rp='Install any extra modules (y or n)?'
8266 . ./myread
8267 case "$ans" in
8268 y|Y)
8269         cat <<EOM
8270
8271 Please list any extra modules or bundles to be installed from CPAN,
8272 with spaces between the names.  The names can be in any format the
8273 'install' command of CPAN.pm will understand.  (Answer 'none',
8274 without the quotes, to install no extra modules or bundles.)
8275 EOM
8276         rp='Extras?'
8277         dflt="$extras"
8278         . ./myread
8279         extras="$ans"
8280 esac
8281 case "$extras" in
8282 ''|'none')
8283         val=''
8284         $rm -f ../extras.lst
8285         ;;
8286 *)      echo "(Saving the list of extras for later...)"
8287         echo "$extras" > ../extras.lst
8288         val="'$extras'"
8289         ;;
8290 esac
8291 set extras
8292 eval $setvar
8293 echo " "
8294
8295 : determine where html pages for programs go
8296 set html1dir html1dir none
8297 eval $prefixit
8298 $cat <<EOM
8299
8300 If you wish to install html files for programs in $spackage, indicate
8301 the appropriate directory here.  To skip installing html files,
8302 answer "none".
8303 EOM
8304 case "$html1dir" in
8305 ''|none|$undef|' ') dflt=none ;;
8306 *) dflt=$html1dir ;;
8307 esac
8308 fn=dn+~
8309 rp="Directory for the main $spackage html pages?"
8310 . ./getfile
8311 prefixvar=html1dir
8312 . ./setprefixvar
8313 : Use ' ' for none so value is preserved next time through Configure
8314 $test X"$html1dir" = "X" && html1dir=' '
8315
8316 : determine where html pages for libraries and modules go
8317 set html3dir html3dir none
8318 eval $prefixit
8319 $cat <<EOM
8320
8321 If you wish to install html files for modules associated with $spackage,
8322 indicate the appropriate directory here.  To skip installing html files,
8323 answer "none".
8324 EOM
8325 : There is no obvious default.  If they have specified html1dir, then
8326 : try to key off that, possibly changing .../html1 into .../html3.
8327 case "$html3dir" in
8328 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8329 *) dflt=$html3dir ;;
8330 esac
8331 fn=dn+~
8332 rp="Directory for the $spackage module html pages?"
8333 . ./getfile
8334 prefixvar=html3dir
8335 . ./setprefixvar
8336 : Use ' ' for none so value is preserved next time through Configure
8337 $test X"$html3dir" = "X" && html3dir=' '
8338
8339 : determine whether to install perl also as /usr/bin/perl
8340
8341 echo " "
8342 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8343         $cat <<EOM
8344 Many scripts expect perl to be installed as /usr/bin/perl.
8345
8346 If you want to, I can install the perl you are about to compile
8347 as /usr/bin/perl (in addition to $bin/perl).
8348 EOM
8349         if test -f /usr/bin/perl; then
8350             $cat <<EOM
8351
8352 However, please note that because you already have a /usr/bin/perl,
8353 overwriting that with a new Perl would very probably cause problems.
8354 Therefore I'm assuming you don't want to do that (unless you insist).
8355
8356 EOM
8357             case "$installusrbinperl" in
8358             "$define"|[yY]*)    dflt='y';;
8359             *)                  dflt='n';;
8360             esac
8361         else
8362             $cat <<EOM
8363
8364 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8365
8366 EOM
8367             case "$installusrbinperl" in
8368             "$undef"|[nN]*)     dflt='n';;
8369             *)                  dflt='y';;
8370             esac
8371         fi
8372         rp="Do you want to install perl as /usr/bin/perl?"
8373         . ./myread
8374         case "$ans" in
8375         [yY]*)  val="$define";;
8376         *)      val="$undef" ;;
8377         esac
8378 else
8379         val="$undef"
8380 fi
8381 set installusrbinperl
8382 eval $setvar
8383
8384 : see if dlopen exists
8385 xxx_runnm="$runnm"
8386 xxx_ccflags="$ccflags"
8387 runnm=false
8388 : with g++ one needs -shared to get is-in-libc to work for dlopen
8389 case "$gccversion" in
8390 '')     ;;
8391 *Clang*)        ;;
8392 *)      case "$d_cplusplus" in
8393         "$define") ccflags="$ccflags -shared" ;;
8394         esac
8395         ;;
8396 esac
8397 set dlopen d_dlopen
8398 eval $inlibc
8399 runnm="$xxx_runnm"
8400 ccflags="$xxx_ccflags"
8401
8402 : see if this is a unistd.h system
8403 set unistd.h i_unistd
8404 eval $inhdr
8405
8406 : determine which dynamic loading, if any, to compile in
8407 echo " "
8408 dldir="ext/DynaLoader"
8409 case "$usedl" in
8410     $define|y|true)
8411         dflt='y'
8412         usedl="$define"
8413         ;;
8414     $undef|n|false)
8415         dflt='n'
8416         usedl="$undef"
8417         ;;
8418     *)
8419         dflt='n'
8420         case "$d_dlopen" in
8421             $define) dflt='y' ;;
8422         esac
8423         : Does a dl_xxx.xs file exist for this operating system
8424         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8425         ;;
8426 esac
8427 rp="Do you wish to use dynamic loading?"
8428 . ./myread
8429 usedl="$ans"
8430 bin_ELF="$undef"
8431 case "$ans" in
8432     y*) usedl="$define"
8433         case "$dlsrc" in
8434             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8435                     dflt="$dldir/dl_${osname}.xs"
8436                 elif $test "$d_dlopen" = "$define" ; then
8437                     dflt="$dldir/dl_dlopen.xs"
8438                 else
8439                     dflt=''
8440                 fi
8441                 ;;
8442             *)  dflt="$dldir/$dlsrc"
8443                 ;;
8444         esac
8445         echo "The following dynamic loading files are available:"
8446         : Can not go over to $dldir because getfile has path hard-coded in.
8447         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8448         rp="Source file to use for dynamic loading"
8449         fn="fne"
8450         gfpth="$src"
8451         . ./getfile
8452         usedl="$define"
8453         : emulate basename
8454         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8455
8456         $cat << EOM
8457
8458 Some systems may require passing special flags to $cc -c to
8459 compile modules that will be used to create a shared library.
8460 To use no flags, say "none".
8461
8462 EOM
8463         case "$cccdlflags" in
8464             '') case "$gccversion" in
8465                 '') case "$osname" in
8466                         hpux)   dflt='+z' ;;
8467                         irix*)  dflt='-KPIC' ;;
8468                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8469                         sunos)  dflt='-pic' ;;
8470                         *)      dflt='none' ;;
8471                     esac
8472                     ;;
8473                 *)  case "$osname" in
8474                         darwin) dflt='none' ;;
8475                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8476                         *)      dflt='-fpic' ;;
8477                     esac ;;
8478                 esac ;;
8479             ' ') dflt='none' ;;
8480             *)   dflt="$cccdlflags" ;;
8481         esac
8482
8483         case "$dflt" in
8484             none) dflt='' ;;
8485         esac
8486
8487         # If -Dsysroot was specified, now's the time to add it
8488         # to cccdlflags
8489         if test "X$sysroot" != X; then
8490             case "$gccversion" in
8491                 '') ;;
8492                 *)  case "$dflt" in
8493                         *sysroot*) ;;
8494                         'undef'|*)
8495                             dflt="$dflt --sysroot=$sysroot" ;;
8496                     esac
8497                     ;;
8498             esac
8499         fi
8500
8501         case "$dflt" in
8502             '') dflt='none';;
8503         esac
8504
8505         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8506         . ./myread
8507         case "$ans" in
8508             none) cccdlflags=' ' ;;
8509             *)    cccdlflags="$ans" ;;
8510         esac
8511
8512         cat << EOM
8513
8514 Some systems use ld to create libraries that can be dynamically loaded,
8515 while other systems (such as those using ELF) use $cc.
8516
8517 EOM
8518
8519 : Determine if this is ELF
8520         $cat >try.c <<EOM
8521 /* Test for whether ELF binaries are produced */
8522 #include <fcntl.h>
8523 #$i_stdlib I_STDLIB
8524 #ifdef I_STDLIB
8525 #include <stdlib.h>
8526 #endif
8527 #$i_unistd I_UNISTD
8528 #ifdef I_UNISTD
8529 #include <unistd.h>
8530 #endif
8531 int main() {
8532     char b[4];
8533     int i = open("a.out",O_RDONLY);
8534     if(i == -1)
8535         exit(1); /* fail */
8536     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8537         exit(0); /* succeed (yes, it is ELF) */
8538     exit(1); /* fail */
8539 }
8540 EOM
8541         if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8542             bin_ELF="$define"
8543         fi
8544         $rm_try
8545
8546         case "$ld" in
8547             '') if $test $bin_ELF = "$define"; then
8548                     cat <<EOM
8549 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8550 EOM
8551                     dflt="$cc"
8552                 else
8553                     echo "I'll use ld to build dynamic libraries."
8554                     dflt='ld'
8555                 fi
8556                 ;;
8557             *)  dflt="$ld"
8558                 ;;
8559         esac
8560
8561         rp="What command should be used to create dynamic libraries?"
8562         . ./myread
8563         ld="$ans"
8564
8565         cat << EOM
8566
8567 Some systems may require passing special flags to $ld to create a
8568 library that can be dynamically loaded.  If your ld flags include
8569 -L/other/path options to locate libraries outside your loader's normal
8570 search path, you may need to specify those -L options here as well.  To
8571 use no flags, say "none".
8572
8573 EOM
8574         case "$lddlflags" in
8575             '') case "$osname" in
8576                     haiku) dflt='-shared' ;;
8577                     hpux) dflt='-b';
8578                           case "$gccversion" in
8579                               '') dflt="$dflt +vnocompatwarnings" ;;
8580                           esac
8581                           ;;
8582                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8583                     solaris) # See [perl #66604].
8584                             # On Solaris 11, gcc -m64 on amd64
8585                             # appears not to understand -G.  gcc versions at
8586                             # least as old as 3.4.3 support -shared, so just
8587                             # use that with Solaris 11 and later, but keep
8588                             # the old behavior for older Solaris versions.
8589                             case "$gccversion" in
8590                                 '') dflt='-G' ;;
8591                                 *)  case "$osvers" in
8592                                         2.?|2.10) dflt='-G' ;;
8593                                         *) dflt='-shared' ;;
8594                                     esac
8595                                     ;;
8596                             esac
8597                             ;;
8598                     sunos) dflt='-assert nodefinitions' ;;
8599                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8600                     *)     dflt='none' ;;
8601                 esac
8602                 ;;
8603             *) dflt="$lddlflags" ;;
8604         esac
8605
8606         : Only do this for gcc, since, for example, qcc has no concept
8607         : of --sysroot.
8608         if $test "X$sysroot" != X; then
8609             case "$gccversion" in
8610                 '') ;;
8611                 *)  dflt="$dflt --sysroot $sysroot" ;;
8612             esac
8613         fi
8614
8615         : Try to guess additional flags to pick up local libraries.
8616         : Be careful not to append to a plain 'none'
8617         case "$dflt" in
8618             none) dflt='' ;;
8619         esac
8620         for thisflag in $ldflags; do
8621             case "$thisflag" in
8622                 -L*|-R*|-Wl,-R*)
8623                     case " $dflt " in
8624                         *" $thisflag "*) ;;
8625                         *) dflt="$dflt $thisflag" ;;
8626                     esac
8627                     ;;
8628             esac
8629         done
8630
8631         case "$dflt" in
8632             ''|' ') dflt='none' ;;
8633         esac
8634
8635         case "$ldflags" in
8636             *-fstack-protector-strong*)
8637                 case "$dflt" in
8638                     *-fstack-protector-strong*) ;; # Don't add it again
8639                     *) dflt="$dflt -fstack-protector-strong" ;;
8640                 esac
8641                 ;;
8642             *-fstack-protector*)
8643                 case "$dflt" in
8644                     *-fstack-protector*) ;; # Don't add it again
8645                     *) dflt="$dflt -fstack-protector" ;;
8646                 esac
8647                 ;;
8648         esac
8649
8650         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8651         . ./myread
8652         case "$ans" in
8653             none) lddlflags=' ' ;;
8654             *) lddlflags="$ans" ;;
8655         esac
8656
8657         cat <<EOM
8658
8659 Some systems may require passing special flags to $cc to indicate that
8660 the resulting executable will use dynamic linking.  To use no flags,
8661 say "none".
8662
8663 EOM
8664         case "$ccdlflags" in
8665             '') case "$osname" in
8666                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8667                     sunos)             dflt='none'   ;;
8668                     *)                 dflt='none'   ;;
8669                 esac ;;
8670             ' ') dflt='none' ;;
8671             *)   dflt="$ccdlflags" ;;
8672         esac
8673         rp="Any special flags to pass to $cc to use dynamic linking?"
8674         . ./myread
8675         case "$ans" in
8676             none) ccdlflags=' ' ;;
8677             *)    ccdlflags="$ans" ;;
8678         esac
8679         ;;
8680
8681     *)  usedl="$undef"
8682         ld='ld'
8683         dlsrc='dl_none.xs'
8684         lddlflags=''
8685         ccdlflags=''
8686         ;;
8687 esac
8688
8689 ld_can_script="$undef"
8690 case "$bin_ELF$usedl" in
8691     $define$define)
8692         # Abuse try.h and a.out names for neat cleanup
8693         $cat >try.c <<EOM
8694 void foo() {}
8695 void bar() {}
8696 EOM
8697         $cat >try.h <<EOM
8698 LIBTEST_42 {
8699  global:
8700   foo;
8701  local: *;
8702  };
8703 EOM
8704         if $cc $cccdlflags $ccdlflags $ccflags \
8705                $ldflags $lddlflags -o a.out try.c \
8706                -Wl,--version-script=try.h >/dev/null 2>&1 \
8707            &&  $test -s a.out ; then
8708             echo "ld supports scripting" >&4
8709             ld_can_script="$define"
8710         else
8711             echo "ld does not support scripting" >&4
8712         fi
8713         $rm_try
8714         ;;
8715 esac
8716
8717 : Do we want a shared libperl?
8718 also=''
8719 case "$usedl" in
8720 $undef)
8721         # No dynamic loading being used, so don't bother even to prompt.
8722         useshrplib='false'
8723         ;;
8724 *)      case "$useshrplib" in
8725         '')     case "$osname" in
8726                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8727                         dflt=y
8728                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8729                         ;;
8730                 *)      dflt=n
8731                         ;;
8732                 esac
8733                 ;;
8734         $define|true|[Yy]*)
8735                 dflt=y
8736                 ;;
8737         *)      dflt=n
8738                 ;;
8739         esac
8740         $cat << EOM
8741
8742 The perl executable is normally obtained by linking perlmain.c with
8743 libperl${_a}, any static extensions (usually just DynaLoader), and
8744 any other libraries needed on this system (such as -lm, etc.).  Since
8745 your system supports dynamic loading, it is probably possible to build
8746 a shared libperl.$so.  If you will have more than one executable linked
8747 to libperl.$so, this will significantly reduce the size of each
8748 executable, but it may have a noticeable effect on performance.  The
8749 default is probably sensible for your system.
8750 $also
8751
8752 EOM
8753         rp="Build a shared libperl.$so (y/n)"
8754         . ./myread
8755         case "$ans" in
8756         true|$define|[Yy]*)
8757                 useshrplib='true'  ;;
8758         *)      useshrplib='false' ;;
8759         esac
8760         ;;
8761 esac
8762
8763 case "$useshrplib" in
8764 true)
8765         case "$userelocatableinc" in
8766         true|define)
8767                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8768                 echo "See INSTALL for an explanation why that won't work." >&4
8769                 exit 4
8770                 ;;
8771         esac
8772         case "$libperl" in
8773         '')
8774                 # Figure out a good name for libperl.so.  Since it gets stored in
8775                 # a version-specific architecture-dependent library, the version
8776                 # number isn't really that important, except for making cc/ld happy.
8777                 #
8778                 # A name such as libperl.so.10.1
8779                 majmin="libperl.$so.$patchlevel.$subversion"
8780                 # A name such as libperl.so.100
8781                 majonly=`echo $patchlevel $subversion |
8782                         $awk '{printf "%d%02d", $1, $2}'`
8783                 majonly=libperl.$so.$majonly
8784                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8785                 # rely on figuring it out from the naming of libc.
8786                 case "${osname}${osvers}" in
8787                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8788                         dflt=libperl.$so
8789                         ;;
8790                 cygwin*) # ld links now against the dll directly
8791                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8792                         majonly=`echo $patchlevel $subversion |
8793                                 $awk '{printf "%03d%03d", $1, $2}'`
8794                         majonly=cygperl5.$majonly.$so
8795                         dflt=$majmin
8796                         ;;
8797                 *)      # Try to guess based on whether libc has major.minor.
8798                         case "$libc" in
8799                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8800                         *libc.$so.[0-9]*) dflt=$majonly ;;
8801                         *)      dflt=libperl.$so ;;
8802                         esac
8803                         ;;
8804                 esac
8805                 ;;
8806         *)      dflt=$libperl
8807                 ;;
8808         esac
8809         cat << EOM
8810
8811 I need to select a good name for the shared libperl.  If your system uses
8812 library names with major and minor numbers, then you might want something
8813 like $majmin.  Alternatively, if your system uses a single version
8814 number for shared libraries, then you might want to use $majonly.
8815 Or, your system might be quite happy with a simple libperl.$so.
8816
8817 Since the shared libperl will get installed into a version-specific
8818 architecture-dependent directory, the version number of the shared perl
8819 library probably isn't important, so the default should be o.k.
8820
8821 EOM
8822         rp='What name do you want to give to the shared libperl?'
8823         . ./myread
8824         libperl=$ans
8825         echo "Ok, I'll use $libperl"
8826         ;;
8827 *)
8828         libperl="libperl${_a}"
8829         ;;
8830 esac
8831
8832 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8833 case "$shrpdir" in
8834 '') ;;
8835 *)      $cat >&4 <<EOM
8836 WARNING:  Use of the shrpdir variable for the installation location of
8837 the shared $libperl is not supported.  It was never documented and
8838 will not work in this version.  Let me (perlbug@perl.org)
8839 know of any problems this may cause.
8840
8841 EOM
8842         case "$shrpdir" in
8843         "$archlibexp/CORE")
8844                 $cat >&4 <<EOM
8845 But your current setting of $shrpdir is
8846 the default anyway, so it's harmless.
8847 EOM
8848                 ;;
8849         *)
8850                 $cat >&4 <<EOM
8851 Further, your current attempted setting of $shrpdir
8852 conflicts with the value of $archlibexp/CORE
8853 that installperl will use.
8854 EOM
8855                 ;;
8856         esac
8857         ;;
8858 esac
8859
8860 # How will the perl executable find the installed shared $libperl?
8861 # Add $xxx to ccdlflags.
8862 # If we can't figure out a command-line option, use $shrpenv to
8863 # set env LD_RUN_PATH.  The main perl makefile uses this.
8864 shrpdir=$archlibexp/CORE
8865 xxx=''
8866 tmp_shrpenv=''
8867 if "$useshrplib"; then
8868     case "$osname" in
8869         aix)
8870                 # We'll set it in Makefile.SH...
8871                 ;;
8872         solaris)
8873                 xxx="-R $shrpdir"
8874                 ;;
8875         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8876                 xxx="-Wl,-R$shrpdir"
8877                 ;;
8878         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8879                 xxx="-Wl,-rpath,$shrpdir"
8880                 ;;
8881         hpux*)
8882                 # hpux doesn't like the default, either.
8883                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8884                 ;;
8885         cygwin)
8886                 # cygwin needs only ldlibpth
8887                 ;;
8888         *)
8889                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8890                 ;;
8891         esac
8892         case "$xxx" in
8893         '') ;;
8894         *)
8895                 # Only add $xxx if it isn't already in ccdlflags.
8896                 case " $ccdlflags " in
8897                 *" $xxx "*)     ;;
8898                 *)      ccdlflags="$ccdlflags $xxx"
8899                         cat <<EOM >&4
8900
8901 Adding $xxx to the flags
8902 passed to $ld so that the perl executable will find the
8903 installed shared $libperl.
8904
8905 EOM
8906                         ;;
8907                 esac
8908                 ;;
8909         esac
8910 fi
8911 # Fix ccdlflags in AIX for building external extensions.
8912 # (For building Perl itself bare -bE:perl.exp is needed,
8913 #  Makefile.SH takes care of this.)
8914 case "$osname" in
8915 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8916 esac
8917 # Respect a hint or command-line value.
8918 case "$shrpenv" in
8919 '') shrpenv="$tmp_shrpenv" ;;
8920 esac
8921 case "$ldlibpthname" in
8922 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8923 none)   ldlibpthname='' ;;
8924 esac
8925
8926 : determine where manual pages are on this system
8927 echo " "
8928 case "$sysman" in
8929 '')
8930         syspath='/usr/share/man/man1 /usr/man/man1'
8931         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8932         syspath="$syspath /usr/man/u_man/man1"
8933         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8934         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8935         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8936         sysman=`./loc . /usr/man/man1 $syspath`
8937         ;;
8938 esac
8939 if $test -d "$sysman"; then
8940         echo "System manual is in $sysman." >&4
8941 else
8942         echo "Could not find manual pages in source form." >&4
8943 fi
8944
8945 : determine where manual pages go
8946 set man1dir man1dir none
8947 eval $prefixit
8948 $cat <<EOM
8949
8950 $spackage has manual pages available in source form.
8951 EOM
8952 case "$nroff" in
8953 nroff)
8954         echo "However, you don't have nroff, so they're probably useless to you."
8955         case "$man1dir" in
8956         '') man1dir="none";;
8957         esac;;
8958 esac
8959 echo "If you don't want the manual sources installed, answer 'none'."
8960 case "$man1dir" in
8961 ' ') dflt=none
8962         ;;
8963 '')
8964         lookpath="$prefixexp/share/man/man1"
8965         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8966         lookpath="$lookpath $prefixexp/man/p_man/man1"
8967         lookpath="$lookpath $prefixexp/man/u_man/man1"
8968         lookpath="$lookpath $prefixexp/man/man.1"
8969         case "$sysman" in
8970         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8971         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8972         esac
8973         set dflt
8974         eval $prefixup
8975         ;;
8976 *)  dflt="$man1dir"
8977         ;;
8978 esac
8979 echo " "
8980 fn=dn+~
8981 rp="Where do the main $spackage manual pages (source) go?"
8982 . ./getfile
8983 if $test "X$man1direxp" != "X$ansexp"; then
8984         installman1dir=''
8985 fi
8986 prefixvar=man1dir
8987 . ./setprefixvar
8988
8989 case "$man1dir" in
8990 '')     man1dir=' '
8991         installman1dir='';;
8992 esac
8993
8994 : What suffix to use on installed man pages
8995
8996 case "$man1dir" in
8997 ' ')
8998         man1ext='0'
8999         ;;
9000 *)
9001         rp="What suffix should be used for the main $spackage man pages?"
9002         case "$man1ext" in
9003         '')     case "$man1dir" in
9004                 *1)  dflt=1 ;;
9005                 *1p) dflt=1p ;;
9006                 *1pm) dflt=1pm ;;
9007                 *l) dflt=l;;
9008                 *n) dflt=n;;
9009                 *o) dflt=o;;
9010                 *p) dflt=p;;
9011                 *C) dflt=C;;
9012                 *L) dflt=L;;
9013                 *L1) dflt=L1;;
9014                 *) dflt=1;;
9015                 esac
9016                 ;;
9017         *)      dflt="$man1ext";;
9018         esac
9019         . ./myread
9020         man1ext="$ans"
9021         ;;
9022 esac
9023
9024 : see if we can have long filenames
9025 echo " "
9026 first=123456789abcdef
9027 $rm -f $first
9028 if (echo hi >$first) 2>/dev/null; then
9029         if $test -f 123456789abcde; then
9030                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
9031                 val="$undef"
9032         else
9033                 echo 'You can have filenames longer than 14 characters.'>&4
9034                 val="$define"
9035         fi
9036 else
9037         $cat <<'EOM'
9038 You can't have filenames longer than 14 chars.
9039 You can't even think about them!
9040 EOM
9041         val="$undef"
9042 fi
9043 set d_flexfnam
9044 eval $setvar
9045 $rm -rf 123456789abcde*
9046
9047 : determine where library module manual pages go
9048 set man3dir man3dir none
9049 eval $prefixit
9050 $cat <<EOM
9051
9052 $spackage has manual pages for many of the library modules.
9053 EOM
9054
9055 case "$nroff" in
9056 nroff)
9057         $cat <<'EOM'
9058 However, you don't have nroff, so they're probably useless to you.
9059 EOM
9060         case "$man3dir" in
9061         '') man3dir="none";;
9062         esac;;
9063 esac
9064
9065 case "$d_flexfnam" in
9066 undef)
9067         $cat <<'EOM'
9068 However, your system can't handle the long file names like File::Basename.3.
9069 EOM
9070         case "$man3dir" in
9071         '') man3dir="none";;
9072         esac;;
9073 esac
9074
9075 echo "If you don't want the manual sources installed, answer 'none'."
9076 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9077 case "$man3dir" in
9078 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9079         if $test -d "$privlib/man/man3"; then
9080                 cat <<EOM >&4
9081
9082 WARNING:  Previous versions of perl installed man3 pages into
9083 $privlib/man/man3.  This version will suggest a
9084 new default of $dflt.
9085 EOM
9086                 tdflt=$dflt
9087                 dflt='n'
9088                 rp='Do you wish to preserve the old behavior?(y/n)'
9089                 . ./myread
9090                 case "$ans" in
9091                 y*) dflt="$privlib/man/man3" ;;
9092                 *)  dflt=$tdflt ;;
9093                 esac
9094     fi
9095         ;;
9096 *)      dflt="$man3dir" ;;
9097 esac
9098 case "$dflt" in
9099 ' ') dflt=none ;;
9100 esac
9101 echo " "
9102 fn=dn+~
9103 rp="Where do the $package library man pages (source) go?"
9104 . ./getfile
9105 prefixvar=man3dir
9106 . ./setprefixvar
9107
9108 case "$man3dir" in
9109 '')     man3dir=' '
9110         installman3dir='';;
9111 esac
9112
9113 : What suffix to use on installed man pages
9114 case "$man3dir" in
9115 ' ')
9116         man3ext='0'
9117         ;;
9118 *)
9119         rp="What suffix should be used for the $package library man pages?"
9120         case "$man3ext" in
9121         '')     case "$man3dir" in
9122                 *3)  dflt=3 ;;
9123                 *3p) dflt=3p ;;
9124                 *3pm) dflt=3pm ;;
9125                 *l) dflt=l;;
9126                 *n) dflt=n;;
9127                 *o) dflt=o;;
9128                 *p) dflt=p;;
9129                 *C) dflt=C;;
9130                 *L) dflt=L;;
9131                 *L3) dflt=L3;;
9132                 *) dflt=3;;
9133                 esac
9134                 ;;
9135         *)      dflt="$man3ext";;
9136         esac
9137         . ./myread
9138         man3ext="$ans"
9139         ;;
9140 esac
9141
9142 : see if we have to deal with yellow pages, now NIS.
9143 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9144         case "$hostcat" in
9145         nidump*) ;;
9146         *)
9147                 case "$hostcat" in
9148                 *ypcat*) dflt=y;;
9149                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9150                                 dflt=y
9151                         else
9152                                 dflt=n
9153                         fi;;
9154                 *) dflt=n;;
9155                 esac
9156                 echo " "
9157                 rp='Are you getting the hosts file via yellow pages?'
9158                 . ./myread
9159                 case "$ans" in
9160                 y*) hostcat='ypcat hosts';;
9161                 *) hostcat='cat /etc/hosts';;
9162                 esac
9163                 ;;
9164         esac
9165 fi
9166 case "$hostcat" in
9167 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9168 esac
9169 case "$groupcat" in
9170 '') test -f /etc/group && groupcat='cat /etc/group';;
9171 esac
9172 case "$passcat" in
9173 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9174 esac
9175
9176 : now get the host name
9177 echo " "
9178 echo "Figuring out host name..." >&4
9179 case "$myhostname" in
9180 '') cont=true
9181         echo 'Maybe "hostname" will work...'
9182         if tans=`sh -c hostname 2>&1` ; then
9183                 myhostname=$tans
9184                 phostname=hostname
9185                 cont=''
9186         fi
9187         ;;
9188 *) cont='';;
9189 esac
9190 if $test "$cont"; then
9191         if ./xenix; then
9192                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9193                 if tans=`cat /etc/systemid 2>&1` ; then
9194                         myhostname=$tans
9195                         phostname='cat /etc/systemid'
9196                         echo "Whadyaknow.  Xenix always was a bit strange..."
9197                         cont=''
9198                 fi
9199         elif $test -r /etc/systemid; then
9200                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9201         fi
9202 fi
9203 if $test "$cont"; then
9204         echo 'No, maybe "uuname -l" will work...'
9205         if tans=`sh -c 'uuname -l' 2>&1` ; then
9206                 myhostname=$tans
9207                 phostname='uuname -l'
9208         else
9209                 echo 'Strange.  Maybe "uname -n" will work...'
9210                 if tans=`sh -c 'uname -n' 2>&1` ; then
9211                         myhostname=$tans
9212                         phostname='uname -n'
9213                 else
9214                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9215                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9216                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9217                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9218                         else
9219                                 case "$myhostname" in
9220                                 '') echo "Does this machine have an identity crisis or something?"
9221                                         phostname='';;
9222                                 *)
9223                                         echo "Well, you said $myhostname before..."
9224                                         phostname='echo $myhostname';;
9225                                 esac
9226                         fi
9227                 fi
9228         fi
9229 fi
9230 case "$myhostname" in
9231 '') myhostname=noname ;;
9232 esac
9233 : you do not want to know about this
9234 set $myhostname
9235 myhostname=$1
9236
9237 : verify guess
9238 if $test "$myhostname" ; then
9239         dflt=y
9240         rp='Your host name appears to be "'$myhostname'".'" Right?"
9241         . ./myread
9242         case "$ans" in
9243         y*) ;;
9244         *) myhostname='';;
9245         esac
9246 fi
9247
9248 : bad guess or no guess
9249 while $test "X$myhostname" = X ; do
9250         dflt=''
9251         rp="Please type the (one word) name of your host:"
9252         . ./myread
9253         myhostname="$ans"
9254 done
9255
9256 : translate upper to lower if necessary
9257 case "$myhostname" in
9258 *[A-Z]*)
9259         echo "(Normalizing case in your host name)"
9260         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9261         ;;
9262 esac
9263
9264 case "$myhostname" in
9265 *.*)
9266         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9267         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9268         echo "(Trimming domain name from host name--host name is now $myhostname)"
9269         ;;
9270 *) case "$mydomain" in
9271         '')
9272                 {
9273                         test "X$hostcat" = "Xypcat hosts" &&
9274                         ypmatch "$myhostname" hosts 2>/dev/null |\
9275                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9276                         $test -s hosts
9277                 } || {
9278                         test "X$hostcat" != "X" &&
9279                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9280                                         /[       ]$myhostname[  . ]/p" > hosts
9281                 }
9282                 tmp_re="[       . ]"
9283                 if $test -f hosts; then
9284                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9285                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9286                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9287                                 hosts | $sort | $uniq | \
9288                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9289                         case `$echo X$dflt` in
9290                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9291                                 dflt=.
9292                                 ;;
9293                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9294                                 ;;
9295                         esac
9296                 else
9297                         echo "(I cannot locate a hosts database anywhere)"
9298                         dflt=.
9299                 fi
9300                 case "$dflt" in
9301                 .)
9302                         tans=`./loc resolv.conf X /etc /usr/etc`
9303                         if $test -f "$tans"; then
9304                                 echo "(Attempting domain name extraction from $tans)"
9305                                 dflt=.`$sed -n -e 's/   / /g' \
9306                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9307                                   -e 1q 2>/dev/null`
9308                                 case "$dflt" in
9309                                 .) dflt=.`$sed -n -e 's/        / /g' \
9310                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9311                                      -e 1q 2>/dev/null`
9312                                         ;;
9313                                 esac
9314                         fi
9315                         ;;
9316                 esac
9317                 case "$dflt" in
9318                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9319                         dflt=.`sh -c domainname 2>/dev/null`
9320                         case "$dflt" in
9321                         '') dflt='.';;
9322                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9323                         esac
9324                         ;;
9325                 esac
9326                 case "$dflt$osname" in
9327                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9328                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9329                         ;;
9330                 esac
9331                 case "$dflt" in
9332                 .) echo "(Lost all hope -- silly guess then)"
9333                         dflt='.nonet'
9334                         ;;
9335                 esac
9336                 $rm -f hosts
9337                 ;;
9338         *) dflt="$mydomain";;
9339         esac;;
9340 esac
9341 echo " "
9342 rp="What is your domain name?"
9343 . ./myread
9344 tans="$ans"
9345 case "$ans" in
9346 '') ;;
9347 .*) ;;
9348 *) tans=".$tans";;
9349 esac
9350 mydomain="$tans"
9351
9352 : translate upper to lower if necessary
9353 case "$mydomain" in
9354 *[A-Z]*)
9355         echo "(Normalizing case in your domain name)"
9356         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9357         ;;
9358 esac
9359
9360 : a little sanity check here
9361 case "$phostname" in
9362 '') ;;
9363 *)
9364         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9365         $myhostname$mydomain|$myhostname) ;;
9366         *)
9367                 case "$phostname" in
9368                 sed*)
9369                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9370                         ;;
9371                 *)
9372                         echo "(That doesn't agree with your $phostname command, by the way.)"
9373                         ;;
9374                 esac
9375         ;;
9376         esac
9377         ;;
9378 esac
9379
9380 : determine the e-mail address of the user who is running us
9381 $cat <<EOM
9382
9383 I need to get your e-mail address in Internet format if possible, i.e.
9384 something like user@host.domain. Please answer accurately since I have
9385 no easy means to double check it. The default value provided below
9386 is most probably close to reality but may not be valid from outside
9387 your organization...
9388
9389 EOM
9390 cont=x
9391 while test "$cont"; do
9392         case "$MAILDOMAIN" in
9393         '')
9394                 if $test -s /etc/mailname; then
9395                         maildomain=`$cat /etc/mailname`
9396                 else
9397                         maildomain="$myhostname$mydomain"
9398                 fi
9399                 ;;
9400         *)  maildomain="$MAILDOMAIN";;
9401         esac
9402         case "$cf_email" in
9403         '') dflt="$cf_by@$maildomain";;
9404         *)  dflt="$cf_email";;
9405         esac
9406         rp='What is your e-mail address?'
9407         . ./myread
9408         cf_email="$ans"
9409         case "$cf_email" in
9410         *@*.*) cont='' ;;
9411         *)
9412                 rp='Address does not look like an Internet one.  Use it anyway?'
9413                 case "$fastread" in
9414                 yes) dflt=y ;;
9415                 *) dflt=n ;;
9416                 esac
9417                 . ./myread
9418                 case "$ans" in
9419                 y*) cont='' ;;
9420                 *) echo " " ;;
9421                 esac
9422                 ;;
9423         esac
9424 done
9425
9426 : Ask e-mail of administrator
9427 $cat <<EOM
9428
9429 If you or somebody else will be maintaining perl at your site, please
9430 fill in the correct e-mail address here so that they may be contacted
9431 if necessary. Currently, the "perlbug" program included with perl
9432 will send mail to this address in addition to perlbug@perl.org. You may
9433 enter "none" for no administrator.
9434
9435 EOM
9436 case "$perladmin" in
9437 '') dflt="$cf_email";;
9438 *) dflt="$perladmin";;
9439 esac
9440 rp='Perl administrator e-mail address'
9441 . ./myread
9442 perladmin="$ans"
9443
9444 : determine whether to use a version number suffix for installed binaries
9445 echo " "
9446 $cat <<EOM
9447 Do you want to use a version number suffix for installed binaries? This
9448 will install 'perl$version' instead of 'perl', and likewise for other
9449 binaries like 'perldoc' and 'cpan'. This allows many versions of perl
9450 to be installed side-by-side. Unless you are a developer, you probably
9451 do *not* want to do this.
9452 EOM
9453 case "$versiononly" in
9454 "$define"|[Yy]*|true) dflt='y' ;;
9455 *) dflt='n';
9456 esac
9457 rp="Do you want to use a version number suffix for installed binaries?"
9458 . ./myread
9459 case "$ans" in
9460 [yY]*)  val="$define";;
9461 *)      val="$undef" ;;
9462 esac
9463 set versiononly
9464 eval $setvar
9465
9466 case "$versiononly" in
9467 "$define") inc_version_list=''
9468            inc_version_list_init=0
9469            ;;
9470 esac
9471
9472 : figure out how to guarantee perl startup
9473 : XXX Note that this currently takes advantage of the bug that binexp ignores
9474 :     the Configure -Dinstallprefix setting, which in turn means that under
9475 :     relocatable @INC, initialinstalllocation is what binexp started as.
9476 case "$startperl" in
9477 '')
9478         case "$sharpbang" in
9479         *!)
9480                 $cat <<EOH
9481
9482 I can use the #! construct to start perl on your system. This will
9483 make startup of perl scripts faster, but may cause problems if you
9484 want to share those scripts and perl is not in a standard place
9485 ($initialinstalllocation/perl) on all your platforms. The alternative
9486 is to force a shell by starting the script with a single ':' character.
9487
9488 EOH
9489                 case "$versiononly" in
9490                 "$define")      dflt="$initialinstalllocation/perl$version";;
9491                 *)              dflt="$initialinstalllocation/perl";;
9492                 esac
9493                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9494                 . ./myread
9495                 case "$ans" in
9496                 none)   startperl=": # use perl";;
9497                 *)      startperl="#!$ans"
9498                         if $test 30 -lt `echo "$ans" | wc -c`; then
9499                                 $cat >&4 <<EOM
9500
9501 WARNING:  Some systems limit the #! command to 32 characters.
9502 If you experience difficulty running Perl scripts with #!, try
9503 installing Perl in a directory with a shorter pathname.
9504
9505 EOM
9506                         fi ;;
9507                 esac
9508                 ;;
9509         *) startperl=": # use perl"
9510                 ;;
9511         esac
9512         ;;
9513 esac
9514 echo "I'll use $startperl to start perl scripts."
9515
9516 : figure best path for perl in scripts
9517 case "$perlpath" in
9518 '')
9519         case "$versiononly" in
9520         "$define")      perlpath="$initialinstalllocation/perl$version";;
9521         *)              perlpath="$initialinstalllocation/perl";;
9522         esac
9523         case "$startperl" in
9524         *!*) ;;
9525         *)
9526                 $cat <<EOH
9527
9528 I will use the "eval 'exec'" idiom to start Perl on your system.
9529 I can use the full path of your Perl binary for this purpose, but
9530 doing so may cause problems if you want to share those scripts and
9531 Perl is not always in a standard place ($initialinstalllocation/perl).
9532
9533 EOH
9534                 dflt="$initialinstalllocation/perl"
9535                 rp="What path shall I use in \"eval 'exec'\"?"
9536                 . ./myread
9537                 perlpath="$ans"
9538                 ;;
9539         esac
9540         ;;
9541 esac
9542 case "$startperl" in
9543 *!*)    ;;
9544 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9545 esac
9546
9547 : determine where public executable scripts go
9548 set scriptdir scriptdir
9549 eval $prefixit
9550 case "$scriptdir" in
9551 '')
9552         dflt="$bin"
9553         : guess some guesses
9554         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9555         $test -d /usr/share/bin     && dflt=/usr/share/bin
9556         $test -d /usr/local/script  && dflt=/usr/local/script
9557         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9558         $test -d $prefixexp/script  && dflt=$prefixexp/script
9559         set dflt
9560         eval $prefixup
9561         ;;
9562 *)  dflt="$scriptdir"
9563         ;;
9564 esac
9565 $cat <<EOM
9566
9567 Some installations have a separate directory just for executable scripts so
9568 that they can mount it across multiple architectures but keep the scripts in
9569 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9570 Or you might just lump your scripts in with all your other executables.
9571
9572 EOM
9573 fn=d~
9574 rp='Where do you keep publicly executable scripts?'
9575 . ./getfile
9576 if $test "X$ansexp" != "X$scriptdirexp"; then
9577         installscript=''
9578 fi
9579 installscriptdir=''
9580 prefixvar=scriptdir
9581 . ./setprefixvar
9582 : A little fix up for an irregularly named variable.
9583 installscript="$installscriptdir"
9584
9585 : determine where add-on public executables go
9586 case "$sitebin" in
9587 '')     dflt=$siteprefix/bin ;;
9588 *)      dflt=$sitebin ;;
9589 esac
9590 fn=d~
9591 rp='Pathname where the add-on public executables should be installed?'
9592 . ./getfile
9593 prefixvar=sitebin
9594 . ./setprefixvar
9595
9596 : determine where add-on html pages go
9597 : There is no standard location, so try to copy the previously-selected
9598 : directory structure for the core html pages.
9599 case "$sitehtml1dir" in
9600 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9601 *)     dflt=$sitehtml1dir ;;
9602 esac
9603 case "$dflt" in
9604 ''|' ') dflt=none ;;
9605 esac
9606 fn=dn+~
9607 rp='Pathname where the site-specific html pages should be installed?'
9608 . ./getfile
9609 prefixvar=sitehtml1dir
9610 . ./setprefixvar
9611
9612 : determine where add-on library html pages go
9613 : There is no standard location, so try to copy the previously-selected
9614 : directory structure for the core html pages.
9615 case "$sitehtml3dir" in
9616 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9617 *)     dflt=$sitehtml3dir ;;
9618 esac
9619 case "$dflt" in
9620 ''|' ') dflt=none ;;
9621 esac
9622 fn=dn+~
9623 rp='Pathname where the site-specific library html pages should be installed?'
9624 . ./getfile
9625 prefixvar=sitehtml3dir
9626 . ./setprefixvar
9627
9628 : determine where add-on manual pages go
9629 case "$siteman1dir" in
9630 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9631 *)      dflt=$siteman1dir ;;
9632 esac
9633 case "$dflt" in
9634 ''|' ') dflt=none ;;
9635 esac
9636 fn=dn+~
9637 rp='Pathname where the site-specific manual pages should be installed?'
9638 . ./getfile
9639 prefixvar=siteman1dir
9640 . ./setprefixvar
9641
9642 : determine where add-on library man pages go
9643 case "$siteman3dir" in
9644 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9645 *)      dflt=$siteman3dir ;;
9646 esac
9647 case "$dflt" in
9648 ''|' ') dflt=none ;;
9649 esac
9650 fn=dn+~
9651 rp='Pathname where the site-specific library manual pages should be installed?'
9652 . ./getfile
9653 prefixvar=siteman3dir
9654 . ./setprefixvar
9655
9656 : determine where add-on public executable scripts go
9657 case "$sitescript" in
9658 '')     dflt=$siteprefix/script
9659         $test -d $dflt || dflt=$sitebin ;;
9660 *)  dflt="$sitescript" ;;
9661 esac
9662 fn=d~+
9663 rp='Pathname where add-on public executable scripts should be installed?'
9664 . ./getfile
9665 prefixvar=sitescript
9666 . ./setprefixvar
9667
9668 : see if backtrace exists
9669 set backtrace d_backtrace
9670 eval $inlibc
9671
9672 : add flags if using c backtrace
9673 case "$usecbacktrace" in
9674   "") usecbacktrace=$undef ;;
9675   [yY]*|true|$define)
9676     case "$d_backtrace" in
9677       [yY]*|true|$define)
9678         case " $ccflags " in
9679           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9680           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9681           esac
9682         ;;
9683       *)
9684         echo "This system does not support backtrace" >&4
9685         usecbacktrace=$undef
9686         ;;
9687       esac
9688     ;;
9689   esac
9690
9691 : Check if faststdio is requested and available
9692 case "$usefaststdio" in
9693 $define|true|[yY]*|'')
9694         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9695         case "$xversion" in
9696         [68])   dflt='y' ;;
9697         *)      dflt='n' ;;
9698         esac
9699         ;;
9700 *) dflt='n';;
9701 esac
9702 cat <<EOM
9703
9704 Perl can be built to use 'fast stdio', which means using the stdio
9705 library but also directly manipulating the stdio buffers to enable
9706 faster I/O.  Using stdio is better for backward compatibility (especially
9707 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9708 interface has been preferred instead of stdio.
9709
9710 If this doesn't make any sense to you, just accept the default '$dflt'.
9711 EOM
9712 rp='Use the "fast stdio" if available?'
9713 . ./myread
9714 case "$ans" in
9715 y|Y)    val="$define" ;;
9716 *)      val="$undef" ;;
9717 esac
9718 set usefaststdio
9719 eval $setvar
9720
9721
9722 : define an is-a-typedef? function
9723 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9724 case "$inclist" in
9725 "") inclist="sys/types.h";;
9726 esac;
9727 eval "varval=\$$var";
9728 case "$varval" in
9729 "")
9730         $rm -f temp.c;
9731         for inc in $inclist; do
9732                 echo "#include <$inc>" >>temp.c;
9733         done;
9734         echo "#ifdef $type" >> temp.c;
9735         echo "printf(\"We have $type\");" >> temp.c;
9736         echo "#endif" >> temp.c;
9737         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9738         if $contains $type temp.E >/dev/null 2>&1; then
9739                 eval "$var=\$type";
9740         else
9741                 eval "$var=\$def";
9742         fi;
9743         $rm -f temp.?;;
9744 *) eval "$var=\$varval";;
9745 esac'
9746
9747 : define an is-a-typedef? function that prompts if the type is not available.
9748 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9749 case "$inclist" in
9750 "") inclist="sys/types.h";;
9751 esac;
9752 eval "varval=\$$var";
9753 case "$varval" in
9754 "")
9755         $rm -f temp.c;
9756         for inc in $inclist; do
9757                 echo "#include <$inc>" >>temp.c;
9758         done;
9759         echo "#ifdef $type" >> temp.c;
9760         echo "printf(\"We have $type\");" >> temp.c;
9761         echo "#endif" >> temp.c;
9762         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9763         echo " " ;
9764         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9765         if $contains $type temp.E >/dev/null 2>&1; then
9766                 echo "$type found." >&4;
9767                 eval "$var=\$type";
9768         else
9769                 echo "$type NOT found." >&4;
9770                 dflt="$def";
9771                 . ./myread ;
9772                 eval "$var=\$ans";
9773         fi;
9774         $rm -f temp.?;;
9775 *) eval "$var=\$varval";;
9776 esac'
9777
9778 : see what type lseek is declared as in the kernel
9779 rp="What is the type used for lseek's offset on this system?"
9780 set off_t lseektype long stdio.h sys/types.h
9781 eval $typedef_ask
9782
9783 echo " "
9784 echo "Checking to see how big your file offsets are..." >&4
9785 $cat >try.c <<EOCP
9786 #include <sys/types.h>
9787 #include <stdio.h>
9788 int main()
9789 {
9790     printf("%d\n", (int)sizeof($lseektype));
9791     return(0);
9792 }
9793 EOCP
9794 set try
9795 if eval $compile_ok; then
9796         lseeksize=`$run ./try`
9797         echo "Your file offsets are $lseeksize bytes long."
9798 else
9799         dflt=$longsize
9800         echo " "
9801         echo "(I can't seem to compile the test program.  Guessing...)"
9802         rp="What is the size of your file offsets (in bytes)?"
9803         . ./myread
9804         lseeksize="$ans"
9805 fi
9806 $rm_try
9807
9808 : see what type file positions are declared as in the library
9809 rp="What is the type for file position used by fsetpos()?"
9810 set fpos_t fpostype long stdio.h sys/types.h
9811 eval $typedef_ask
9812
9813 : Check size for Fpos_t
9814 echo " "
9815 case "$fpostype" in
9816 *_t) zzz="$fpostype"    ;;
9817 *)   zzz="fpos_t"       ;;
9818 esac
9819 echo "Checking the size of $zzz..." >&4
9820 cat > try.c <<EOCP
9821 #include <sys/types.h>
9822 #include <stdio.h>
9823 #$i_stdlib I_STDLIB
9824 #ifdef I_STDLIB
9825 #include <stdlib.h>
9826 #endif
9827 int main() {
9828     printf("%d\n", (int)sizeof($fpostype));
9829     exit(0);
9830 }
9831 EOCP
9832 set try
9833 if eval $compile_ok; then
9834         yyy=`$run ./try`
9835         case "$yyy" in
9836         '')     fpossize=4
9837                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9838                 ;;
9839         *)      fpossize=$yyy
9840                 echo "Your $zzz is $fpossize bytes long."
9841                 ;;
9842         esac
9843 else
9844         dflt="$longsize"
9845         echo " " >&4
9846         echo "(I can't compile the test program.  Guessing...)" >&4
9847         rp="What is the size of your file positions (in bytes)?"
9848         . ./myread
9849         fpossize="$ans"
9850 fi
9851
9852 : Check for large file support
9853 # Backward compatibility (uselfs is deprecated).
9854 case "$uselfs" in
9855 "$define"|true|[yY]*)
9856         cat <<EOM >&4
9857
9858 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9859 EOM
9860         uselargefiles="$define"
9861         ;;
9862 esac
9863
9864 case "$lseeksize:$fpossize" in
9865 8:8) cat <<EOM
9866
9867 You can have files larger than 2 gigabytes.
9868 EOM
9869    val="$define" ;;
9870 *)    case "$uselargefiles" in
9871    "$undef"|false|[nN]*) dflt='n' ;;
9872    *)   dflt='y' ;;
9873    esac
9874    cat <<EOM
9875
9876 Perl can be built to understand large files (files larger than 2 gigabytes)
9877 on some systems.  To do so, Configure can be run with -Duselargefiles.
9878
9879 If this doesn't make any sense to you, just accept the default '$dflt'.
9880 EOM
9881    rp='Try to understand large files, if available?'
9882    . ./myread
9883    case "$ans" in
9884    y|Y)         val="$define" ;;
9885    *)           val="$undef"  ;;
9886    esac
9887    ;;
9888 esac
9889 set uselargefiles
9890 eval $setvar
9891 : Look for a hint-file generated 'call-back-unit'.  If the
9892 : user has specified that a large files perl is to be built,
9893 : we may need to set or change some other defaults.
9894 if $test -f uselargefiles.cbu; then
9895         echo "Your platform has some specific hints regarding large file builds, using them..."
9896         . ./uselargefiles.cbu
9897 fi
9898 case "$uselargefiles" in
9899 "$define")
9900         if $test -f uselargefiles.cbu; then
9901                 echo " "
9902                 echo "Rechecking to see how big your file offsets are..." >&4
9903                 $cat >try.c <<EOCP
9904 #include <sys/types.h>
9905 #include <stdio.h>
9906 int main()
9907 {
9908     printf("%d\n", (int)sizeof($lseektype));
9909     return(0);
9910 }
9911 EOCP
9912                 set try
9913                 if eval $compile_ok; then
9914                         lseeksize=`$run ./try`
9915                         $echo "Your file offsets are now $lseeksize bytes long."
9916                 else
9917                         dflt="$lseeksize"
9918                         echo " "
9919                         echo "(I can't seem to compile the test program.  Guessing...)"
9920                         rp="What is the size of your file offsets (in bytes)?"
9921                         . ./myread
9922                         lseeksize="$ans"
9923                 fi
9924                 case "$fpostype" in
9925                 *_t) zzz="$fpostype"    ;;
9926                 *)   zzz="fpos_t"       ;;
9927                 esac
9928                 $echo $n "Rechecking the size of $zzz...$c" >&4
9929                 $cat > try.c <<EOCP
9930 #include <sys/types.h>
9931 #include <stdio.h>
9932 #$i_stdlib I_STDLIB
9933 #ifdef I_STDLIB
9934 #include <stdlib.h>
9935 #endif
9936 int main() {
9937     printf("%d\n", (int)sizeof($fpostype));
9938     return(0);
9939 }
9940 EOCP
9941                 set try
9942                 if eval $compile_ok; then
9943                         yyy=`$run ./try`
9944                         dflt="$lseeksize"
9945                         case "$yyy" in
9946                         '')     echo " "
9947                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9948                                 ;;
9949                         *)      fpossize=$yyy
9950                                 echo " $fpossize bytes." >&4
9951                                 ;;
9952                         esac
9953                 else
9954                         dflt="$fpossize"
9955                         echo " "
9956                         echo "(I can't compile the test program.  Guessing...)" >&4
9957                         rp="What is the size of your file positions (in bytes)?"
9958                         . ./myread
9959                         fpossize="$ans"
9960                 fi
9961                 $rm_try
9962         fi
9963         ;;
9964 esac
9965
9966 : Check if we want perlio
9967 useperlio="$define"
9968
9969 : Set the vendorbin variables
9970 case "$vendorprefix" in
9971 '')     d_vendorbin="$undef"
9972         vendorbin=''
9973         vendorbinexp=''
9974         ;;
9975 *)      d_vendorbin="$define"
9976         : determine where vendor-supplied executables go.
9977         case "$vendorbin" in
9978         '') dflt=$vendorprefix/bin ;;
9979         *)      dflt="$vendorbin" ;;
9980         esac
9981         fn=d~+
9982         rp='Pathname for the vendor-supplied executables directory?'
9983         . ./getfile
9984         vendorbin="$ans"
9985         vendorbinexp="$ansexp"
9986         ;;
9987 esac
9988 prefixvar=vendorbin
9989 . ./installprefix
9990
9991 : Set the vendorhtml1dir variables
9992 case "$vendorprefix" in
9993 '')     vendorhtml1dir=''
9994         vendorhtml1direxp=''
9995         ;;
9996 *)      : determine where vendor-supplied html pages go.
9997         : There is no standard location, so try to copy the previously-selected
9998         : directory structure for the core html pages.
9999         : XXX Better default suggestions would be welcome.
10000         case "$vendorhtml1dir" in
10001         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10002         *)      dflt=$vendorhtml1dir ;;
10003         esac
10004         case "$dflt" in
10005         ''|' ') dflt=none ;;
10006         esac
10007         fn=dn+~
10008         rp='Pathname for the vendor-supplied html pages?'
10009         . ./getfile
10010         vendorhtml1dir="$ans"
10011         vendorhtml1direxp="$ansexp"
10012         ;;
10013 esac
10014 : Use ' ' for none so value is preserved next time through Configure
10015 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
10016 prefixvar=vendorhtml1dir
10017 . ./installprefix
10018
10019 : Set the vendorhtml3dir variables
10020 case "$vendorprefix" in
10021 '')     vendorhtml3dir=''
10022         vendorhtml3direxp=''
10023         ;;
10024 *)      : determine where vendor-supplied module html pages go.
10025         : There is no standard location, so try to copy the previously-selected
10026         : directory structure for the core html pages.
10027         : XXX Better default suggestions would be welcome.
10028         case "$vendorhtml3dir" in
10029         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10030         *)      dflt=$vendorhtml3dir ;;
10031         esac
10032         case "$dflt" in
10033         ''|' ') dflt=none ;;
10034         esac
10035         fn=dn+~
10036         rp='Pathname for the vendor-supplied html pages?'
10037         . ./getfile
10038         vendorhtml3dir="$ans"
10039         vendorhtml3direxp="$ansexp"
10040         ;;
10041 esac
10042 : Use ' ' for none so value is preserved next time through Configure
10043 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
10044 prefixvar=vendorhtml3dir
10045 . ./installprefix
10046
10047 : Set the vendorman1dir variables
10048 case "$vendorprefix" in
10049 '')     vendorman1dir=''
10050         vendorman1direxp=''
10051         ;;
10052 *)      : determine where vendor-supplied manual pages go.
10053         case "$vendorman1dir" in
10054         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10055         *)      dflt=$vendorman1dir ;;
10056         esac
10057         case "$dflt" in
10058         ''|' ') dflt=none ;;
10059         esac
10060         fn=nd~+
10061         rp='Pathname for the vendor-supplied manual section 1 pages?'
10062         . ./getfile
10063         vendorman1dir="$ans"
10064         vendorman1direxp="$ansexp"
10065         ;;
10066 esac
10067 : Use ' ' for none so value is preserved next time through Configure
10068 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
10069 prefixvar=vendorman1dir
10070 . ./installprefix
10071
10072 : Set the vendorman3dir variables
10073 case "$vendorprefix" in
10074 '')     vendorman3dir=''
10075         vendorman3direxp=''
10076         ;;
10077 *)      : determine where vendor-supplied module manual pages go.
10078         case "$vendorman3dir" in
10079         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10080         *)      dflt=$vendorman3dir ;;
10081         esac
10082         case "$dflt" in
10083         ''|' ') dflt=none ;;
10084         esac
10085         fn=nd~+
10086         rp='Pathname for the vendor-supplied manual section 3 pages?'
10087         . ./getfile
10088         vendorman3dir="$ans"
10089         vendorman3direxp="$ansexp"
10090         ;;
10091 esac
10092 : Use ' ' for none so value is preserved next time through Configure
10093 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
10094 prefixvar=vendorman3dir
10095 . ./installprefix
10096
10097 : Set the vendorscript variables
10098 case "$vendorprefix" in
10099 '')     d_vendorscript="$undef"
10100         vendorscript=''
10101         vendorscriptexp=''
10102         ;;
10103 *)      d_vendorscript="$define"
10104         : determine where vendor-supplied scripts go.
10105         case "$vendorscript" in
10106         '')     dflt=$vendorprefix/script
10107                 $test -d $dflt || dflt=$vendorbin ;;
10108         *)  dflt="$vendorscript" ;;
10109         esac
10110         $cat <<EOM
10111
10112 The installation process will create a directory for
10113 vendor-supplied scripts.
10114
10115 EOM
10116         fn=d~+
10117         rp='Pathname for the vendor-supplied scripts directory?'
10118         . ./getfile
10119         vendorscript="$ans"
10120         vendorscriptexp="$ansexp"
10121         ;;
10122 esac
10123 prefixvar=vendorscript
10124 . ./installprefix
10125
10126 : script used to emit important warnings
10127 cat >warn <<EOS
10128 $startsh
10129 if test \$# -gt 0; then
10130         echo "\$@" >msg
10131 else
10132         cat >msg
10133 fi
10134 echo "*** WARNING:" >&4
10135 sed -e 's/^/*** /' <msg >&4
10136 echo "*** " >&4
10137 cat msg >>config.msg
10138 echo " " >>config.msg
10139 rm -f msg
10140 EOS
10141 chmod +x warn
10142 $eunicefix warn
10143
10144 : see which of string.h or strings.h is needed
10145 echo " "
10146 strings=`./findhdr string.h`
10147 if $test "$strings" && $test -r "$strings"; then
10148         echo "Using <string.h> instead of <strings.h>." >&4
10149         val="$define"
10150 else
10151         val="$undef"
10152         strings=`./findhdr strings.h`
10153         if $test "$strings" && $test -r "$strings"; then
10154                 echo "Using <strings.h> instead of <string.h>." >&4
10155         else
10156                 ./warn "No string header found -- You'll surely have problems."
10157         fi
10158 fi
10159 set i_string
10160 eval $setvar
10161 case "$i_string" in
10162 "$undef") strings=`./findhdr strings.h`;;
10163 *)        strings=`./findhdr string.h`;;
10164 esac
10165
10166 : see if qgcvt exists
10167 set qgcvt d_qgcvt
10168 eval $inlibc
10169
10170 : Check what kind of doubles your system has
10171 $echo "Checking the kind of doubles you have..." >&4
10172 $cat >try.c <<EOP
10173 #$i_stdlib I_STDLIB
10174 #define DOUBLESIZE $doublesize
10175 #ifdef I_STDLIB
10176 #include <stdlib.h>
10177 #endif
10178 #include <stdio.h>
10179 static const double d = -0.1;
10180 int main() {
10181   unsigned const char* b = (unsigned const char*)(&d);
10182 #if DOUBLESIZE == 4
10183   if (b[0] == 0xCD && b[3] == 0xBD) {
10184     /* IEEE 754 32-bit little-endian */
10185     printf("1\n");
10186     exit(0);
10187   }
10188   if (b[0] == 0xBD && b[3] == 0xCD) {
10189     /* IEEE 754 32-bit big-endian */
10190     printf("2\n");
10191     exit(0);
10192   }
10193   if (b[0] == 0xCC && b[3] == 0xCC) {
10194     /* VAX format F, 32-bit PDP-style mixed endian. */
10195     printf("9\n");
10196     exit(0);
10197   }
10198   if (b[0] == 0xC0 && b[3] == 0x9A) {
10199     /* IBM single 32-bit */
10200     printf("12\n");
10201     exit(0);
10202   }
10203 #endif
10204 #if DOUBLESIZE == 8
10205   if (b[0] == 0x9A && b[7] == 0xBF) {
10206     /* IEEE 754 64-bit little-endian */
10207     printf("3\n");
10208     exit(0);
10209   }
10210   if (b[0] == 0xBF && b[7] == 0x9A) {
10211     /* IEEE 754 64-bit big-endian */
10212     printf("4\n");
10213     exit(0);
10214   }
10215   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10216    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10217     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10218     * 99 99 b9 bf 9a 99 99 99 */
10219     printf("7\n");
10220     exit(0);
10221   }
10222   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10223    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10224     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10225     * 99 99 99 9a bf b9 99 99 */
10226     printf("8\n");
10227     exit(0);
10228   }
10229   if (b[0] == 0xCC && b[7] == 0xCC) {
10230    /* VAX format D, 64-bit PDP-style mixed endian. */
10231     printf("10\n");
10232     exit(0);
10233   }
10234   if (b[0] == 0xD9 && b[7] == 0x99) {
10235    /* VAX format G, 64-bit PDP-style mixed endian. */
10236     printf("11\n");
10237     exit(0);
10238   }
10239   if (b[0] == 0xC0 && b[7] == 0x9A) {
10240     /* IBM double 64-bit */
10241     printf("13\n");
10242     exit(0);
10243   }
10244   if (b[0] == 0xBF && b[7] == 0xCD) {
10245     /* CRAY single 64-bit */
10246     printf("14\n");
10247     exit(0);
10248   }
10249 #endif
10250 #if DOUBLESIZE == 16
10251   if (b[0] == 0x9A && b[15] == 0xBF) {
10252     /* IEEE 754 128-bit little-endian */
10253     printf("5\n");
10254     exit(0);
10255   }
10256   if (b[0] == 0xBF && b[15] == 0x9A) {
10257     /* IEEE 754 128-bit big-endian */
10258     printf("6\n");
10259     exit(0);
10260   }
10261 #endif
10262   /* Then there are old mainframe/miniframe formats like IBM and CRAY.
10263    * Whether those environments can still build Perl is debatable. */
10264   printf("-1\n"); /* unknown */
10265   exit(0);
10266 }
10267 EOP
10268 set try
10269 if eval $compile; then
10270     doublekind=`$run ./try`
10271 else
10272     doublekind=-1
10273 fi
10274 case "$doublekind" in
10275 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10276 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10277 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10278 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10279 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10280 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10281 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10282 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10283 9) echo "You have VAX format F 32-bit PDP-style mixed endian doubles." >&4 ;;
10284 10) echo "You have VAX format D 64-bit PDP-style mixed endian doubles." >&4 ;;
10285 11) echo "You have VAX format G 64-bit PDP-style mixed endian doubles." >&4 ;;
10286 12) echo "You have IBM short 32-bit doubles." >&4 ;;
10287 13) echo "You have IBM long 64-bit doubles." >&4 ;;
10288 14) echo "You have Cray single 64-bit doubles." >&4 ;;
10289 *) echo "Cannot figure out your double.  You Cyber, or something?" >&4 ;;
10290 esac
10291 d_double_style_ieee=$undef
10292 d_double_style_vax=$undef
10293 d_double_style_ibm=$undef
10294 d_double_style_cray=$undef
10295 case "$doublekind" in
10296 1|2|3|4|5|6|7|8) d_double_style_ieee=$define ;;
10297 9|10|11) d_double_style_vax=$define ;;
10298 12|13) d_double_style_ibm=$define ;;
10299 14) d_double_style_cray=$define ;;
10300 esac
10301 case "$d_double_style_ieee" in
10302 $define)
10303     d_double_has_inf=$define
10304     d_double_has_nan=$define
10305     d_double_has_negative_zero=$define
10306     d_double_has_subnormals=$define
10307     ;;
10308 *)
10309     d_double_has_inf=$undef
10310     d_double_has_nan=$undef
10311     d_double_has_negative_zero=$undef
10312     d_double_has_subnormals=$undef
10313     ;;
10314 esac
10315 $rm_try
10316
10317 : Check print/scan long double stuff
10318 echo " "
10319
10320 if $test X"$d_longdbl" = X"$define"; then
10321
10322 echo "Checking how to print long doubles..." >&4
10323
10324 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10325         $cat >try.c <<'EOCP'
10326 #include <sys/types.h>
10327 #include <stdio.h>
10328 int main() {
10329   double d = 123.456;
10330   printf("%.3f\n", d);
10331 }
10332 EOCP
10333         set try
10334         if eval $compile; then
10335                 yyy=`$run ./try`
10336                 case "$yyy" in
10337                 123.456)
10338                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10339                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10340                         echo "We will use %f."
10341                         ;;
10342                 esac
10343         fi
10344 fi
10345
10346 if $test X"$sPRIfldbl" = X; then
10347         $cat >try.c <<'EOCP'
10348 #include <sys/types.h>
10349 #include <stdio.h>
10350 int main() {
10351   long double d = 123.456;
10352   printf("%.3Lf\n", d);
10353 }
10354 EOCP
10355         set try
10356         if eval $compile; then
10357                 yyy=`$run ./try`
10358                 case "$yyy" in
10359                 123.456)
10360                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10361                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10362                         echo "We will use %Lf."
10363                         ;;
10364                 esac
10365         fi
10366 fi
10367
10368 if $test X"$sPRIfldbl" = X; then
10369         $cat >try.c <<'EOCP'
10370 #include <sys/types.h>
10371 #include <stdio.h>
10372 int main() {
10373   long double d = 123.456;
10374   printf("%.3llf\n", d);
10375 }
10376 EOCP
10377         set try
10378         if eval $compile; then
10379                 yyy=`$run ./try`
10380                 case "$yyy" in
10381                 123.456)
10382                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10383                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10384                         echo "We will use %llf."
10385                         ;;
10386                 esac
10387         fi
10388 fi
10389
10390 if $test X"$sPRIfldbl" = X; then
10391         $cat >try.c <<'EOCP'
10392 #include <sys/types.h>
10393 #include <stdio.h>
10394 int main() {
10395   long double d = 123.456;
10396   printf("%.3lf\n", d);
10397 }
10398 EOCP
10399         set try
10400         if eval $compile; then
10401                 yyy=`$run ./try`
10402                 case "$yyy" in
10403                 123.456)
10404                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10405                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10406                         echo "We will use %lf."
10407                         ;;
10408                 esac
10409         fi
10410 fi
10411
10412 if $test X"$sPRIfldbl" = X; then
10413         echo "Cannot figure out how to print long doubles." >&4
10414 else
10415         sSCNfldbl=$sPRIfldbl    # expect consistency
10416 fi
10417
10418 $rm_try
10419
10420 fi # d_longdbl
10421
10422 case "$sPRIfldbl" in
10423 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10424         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10425         d_SCNfldbl="$undef";
10426         ;;
10427 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10428         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10429         d_SCNfldbl="$define";
10430         ;;
10431 esac
10432
10433 : Before committing on uselongdouble, see whether that looks sane.
10434 if $test "$uselongdouble" = "$define"; then
10435     message=""
10436     echo " "
10437     echo "Checking if your long double math functions work right..." >&4
10438     $cat > try.c <<EOF
10439 #include <math.h>
10440 #include <stdio.h>
10441 int main() {
10442   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10443 }
10444 EOF
10445     case "$osname:$gccversion" in
10446     aix:)       saveccflags="$ccflags"
10447                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10448     esac
10449     set try
10450     if eval $compile_ok; then
10451       yyy=`$run ./try`
10452     fi
10453     case "$yyy" in
10454     3) echo "Your long double math functions are working correctly." >&4 ;;
10455     *) echo "Your long double math functions are broken, not using long doubles." >&4
10456        uselongdouble=$undef
10457        ;;
10458     esac
10459     $rm_try
10460     case "$osname:$gccversion" in
10461     aix:)       ccflags="$saveccflags" ;; # restore
10462     esac
10463 fi
10464
10465 : Check how to convert floats to strings.
10466
10467 if test "X$d_Gconvert" = X; then
10468
10469 echo " "
10470 echo "Checking for an efficient way to convert floats to strings."
10471 echo " " > try.c
10472 case "$uselongdouble" in
10473 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10474 esac
10475 case "$d_longdbl" in
10476 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10477 esac
10478 case "$d_PRIgldbl" in
10479 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10480 esac
10481 $cat >>try.c <<EOP
10482 #ifdef TRY_gconvert
10483 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10484 char *myname = "gconvert";
10485 #endif
10486 #ifdef TRY_gcvt
10487 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10488 char *myname = "gcvt";
10489 #endif
10490 #ifdef TRY_qgcvt
10491 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10492 char *myname = "qgcvt";
10493 #define DOUBLETYPE long double
10494 #endif
10495 #ifdef TRY_sprintf
10496 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10497 #ifdef HAS_PRIgldbl
10498 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10499 #else
10500 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10501 #endif
10502 #else
10503 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10504 #endif
10505 char *myname = "sprintf";
10506 #endif
10507
10508 #ifndef DOUBLETYPE
10509 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10510 #define DOUBLETYPE long double
10511 #else
10512 #define DOUBLETYPE double
10513 #endif
10514 #endif
10515
10516 #include <stdio.h>
10517
10518 #$i_stdlib I_STDLIB
10519 #ifdef I_STDLIB
10520 #include <stdlib.h>
10521 #endif
10522 #$i_string I_STRING
10523 #ifdef I_STRING
10524 #  include <string.h>
10525 #else
10526 #  include <strings.h>
10527 #endif
10528
10529 int checkit(char *expect, char *got)
10530 {
10531     if (strcmp(expect, got)) {
10532                 printf("%s oddity:  Expected %s, got %s\n",
10533                         myname, expect, got);
10534                 exit(1);
10535         }
10536 }
10537
10538 int main()
10539 {
10540         char buf[64];
10541         buf[63] = '\0';
10542
10543         /* This must be 1st test on (which?) platform */
10544         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10545         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10546         checkit("0.1", buf);
10547
10548         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10549         checkit("0.01", buf);
10550
10551         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10552         checkit("0.001", buf);
10553
10554         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10555         checkit("0.0001", buf);
10556
10557         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10558         if (strlen(buf) > 5)
10559             checkit("9e-005", buf); /* for Microsoft ?? */
10560         else
10561             checkit("9e-05", buf);
10562
10563         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10564         checkit("1", buf);
10565
10566         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10567         checkit("1.1", buf);
10568
10569         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10570         checkit("1.01", buf);
10571
10572         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10573         checkit("1.001", buf);
10574
10575         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10576         checkit("1.0001", buf);
10577
10578         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10579         checkit("1.00001", buf);
10580
10581         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10582         checkit("1.000001", buf);
10583
10584         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10585         checkit("0", buf);
10586
10587         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10588         checkit("-1", buf);
10589
10590         /* Some Linux gcvt's give 1.e+5 here. */
10591         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10592         checkit("100000", buf);
10593
10594         /* Some Linux gcvt's give -1.e+5 here. */
10595         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10596         checkit("-100000", buf);
10597
10598         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10599         checkit("123.456", buf);
10600
10601         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10602         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10603         /* 34 should be enough to scare even long double
10604          * places into using the e notation. */
10605         if (strlen(buf) > 5)
10606             checkit("1e+034", buf); /* for Microsoft */
10607         else
10608             checkit("1e+34", buf);
10609
10610         /* For Perl, if you add additional tests here, also add them to
10611          * t/base/num.t for benefit of platforms not using Configure or
10612          * overriding d_Gconvert */
10613
10614         exit(0);
10615 }
10616 EOP
10617 : first add preferred functions to our list
10618 xxx_list=""
10619 for xxx_convert in $gconvert_preference; do
10620     case $xxx_convert in
10621     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10622     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10623     esac
10624 done
10625 : then add any others
10626 for xxx_convert in gconvert gcvt sprintf; do
10627     case "$xxx_list" in
10628     *$xxx_convert*) ;;
10629     *) xxx_list="$xxx_list $xxx_convert" ;;
10630     esac
10631 done
10632
10633 case "$d_longdbl$uselongdouble" in
10634 "$define$define")
10635     : again, add preferred functions to our list first
10636     xxx_ld_list=""
10637     for xxx_convert in $gconvert_ld_preference; do
10638         case $xxx_convert in
10639         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10640         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10641         esac
10642     done
10643     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10644     for xxx_convert in qgcvt sprintf $xxx_list; do
10645         case "$xxx_ld_list" in
10646         $xxx_convert*|*" $xxx_convert"*) ;;
10647         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10648         esac
10649     done
10650     : if sprintf cannot do long doubles, move it to the end
10651     if test "$d_PRIgldbl" != "$define"; then
10652         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10653     fi
10654     : if no qgcvt, remove it
10655     if test "$d_qgcvt" != "$define"; then
10656         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10657     fi
10658     : use the ld_list
10659     xxx_list="$xxx_ld_list"
10660     ;;
10661 esac
10662
10663 for xxx_convert in $xxx_list; do
10664         echo "Trying $xxx_convert..."
10665         $rm -f try try$_o core
10666         set try -DTRY_$xxx_convert
10667         if eval $compile; then
10668                 echo "$xxx_convert() found." >&4
10669                 if $run ./try; then
10670                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10671                         break;
10672                 else
10673                         echo "...But $xxx_convert didn't work as I expected."
10674                         xxx_convert=''
10675                 fi
10676         else
10677                 echo "$xxx_convert NOT found." >&4
10678         fi
10679 done
10680
10681 if test X$xxx_convert = X; then
10682     echo "*** WHOA THERE!!! ***" >&4
10683     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10684     xxx_convert=sprintf
10685 fi
10686
10687 case "$xxx_convert" in
10688 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10689 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10690 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10691 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10692    "$define$define$define")
10693       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10694    "$define$define$undef")
10695       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10696    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10697    esac
10698    ;;
10699 esac
10700
10701 fi
10702 $rm_try
10703
10704 : see if _fwalk exists
10705 set fwalk d__fwalk
10706 eval $inlibc
10707
10708 : Initialize h_fcntl
10709 h_fcntl=false
10710
10711 : Initialize h_sysfile
10712 h_sysfile=false
10713
10714 : access call always available on UNIX
10715 set access d_access
10716 eval $inlibc
10717
10718 : locate the flags for 'access()'
10719 case "$d_access" in
10720 "$define")
10721         echo " "
10722         $cat >access.c <<EOCP
10723 #include <sys/types.h>
10724 #ifdef I_FCNTL
10725 #include <fcntl.h>
10726 #endif
10727 #ifdef I_SYS_FILE
10728 #include <sys/file.h>
10729 #endif
10730 #ifdef I_UNISTD
10731 #include <unistd.h>
10732 #endif
10733 #$i_stdlib I_STDLIB
10734 #ifdef I_STDLIB
10735 #include <stdlib.h>
10736 #endif
10737 int main() {
10738         exit(R_OK);
10739 }
10740 EOCP
10741         : check sys/file.h first, no particular reason here
10742         if $test `./findhdr sys/file.h` && \
10743                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10744                 h_sysfile=true;
10745                 echo "<sys/file.h> defines the *_OK access constants." >&4
10746         elif $test `./findhdr fcntl.h` && \
10747                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10748                 h_fcntl=true;
10749                 echo "<fcntl.h> defines the *_OK access constants." >&4
10750         elif $test `./findhdr unistd.h` && \
10751                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10752                 echo "<unistd.h> defines the *_OK access constants." >&4
10753         else
10754                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10755         fi
10756         ;;
10757 esac
10758 $rm -f access*
10759
10760 : see if accessx exists
10761 set accessx d_accessx
10762 eval $inlibc
10763
10764 : see if acosh exists
10765 set acosh d_acosh
10766 eval $inlibc
10767
10768 : see if aintl exists
10769 set aintl d_aintl
10770 eval $inlibc
10771
10772 : see if alarm exists
10773 set alarm d_alarm
10774 eval $inlibc
10775
10776 : see if 64bit time functions exists
10777
10778 set ctime64 d_ctime64
10779 eval $inlibc
10780
10781 set localtime64 d_localtime64
10782 eval $inlibc
10783
10784 set gmtime64 d_gmtime64
10785 eval $inlibc
10786
10787 set mktime64 d_mktime64
10788 eval $inlibc
10789
10790 set difftime64 d_difftime64
10791 eval $inlibc
10792
10793 set asctime64 d_asctime64
10794 eval $inlibc
10795
10796 : see if POSIX threads are available
10797 set pthread.h i_pthread
10798 eval $inhdr
10799
10800 : define a function to check prototypes
10801 $cat > protochk <<EOSH
10802 $startsh
10803 cc="$cc"
10804 optimize="$optimize"
10805 ccflags="$ccflags"
10806 prototype="$prototype"
10807 define="$define"
10808 rm_try="$rm_try"
10809 usethreads=$usethreads
10810 i_pthread=$i_pthread
10811 pthread_h_first=$pthread_h_first
10812 EOSH
10813
10814 $cat >> protochk <<'EOSH'
10815
10816 $rm_try
10817 foo="$1"
10818 shift
10819 while test $# -ge 2; do
10820         case "$1" in
10821                 $define) echo "#include <$2>" >> try.c ;;
10822                 literal) echo "$2" >> try.c ;;
10823         esac
10824     # Extra magic for the benefit of systems that need pthread.h
10825     # to be included early to correctly detect threadsafe functions.
10826     # Such functions must guarantee themselves, though, that the usethreads
10827     # and i_pthread have been defined, before calling protochk.
10828     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10829         echo "#include <pthread.h>" >> try.c
10830         pthread_h_done=yes
10831     fi
10832     shift 2
10833 done
10834 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10835 cat >> try.c <<'EOCP'
10836 #ifdef CAN_PROTOTYPE
10837 #define _(args) args
10838 #else
10839 #define _(args) ()
10840 #endif
10841 EOCP
10842 echo "$foo" >> try.c
10843 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10844 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10845 status=$?
10846 $rm_try
10847 exit $status
10848 EOSH
10849 chmod +x protochk
10850 $eunicefix protochk
10851
10852 : Define hasproto macro for Configure internal use
10853 hasproto='varname=$1; func=$2; shift; shift;
10854 while $test $# -ge 2; do
10855         case "$1" in
10856         $define) echo "#include <$2>";;
10857         esac ;
10858     shift 2;
10859 done > try.c;
10860 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10861 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10862         echo "$func() prototype found.";
10863         val="$define";
10864 else
10865         echo "$func() prototype NOT found.";
10866         val="$undef";
10867 fi;
10868 set $varname;
10869 eval $setvar;
10870 $rm_try tryout.c'
10871
10872 : see if sys/types.h has to be included
10873 set sys/types.h i_systypes
10874 eval $inhdr
10875
10876 : see if sys/select.h has to be included
10877 set sys/select.h i_sysselct
10878 eval $inhdr
10879
10880 : Define hasfield macro for Configure internal use
10881 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10882 while $test $# -ge 2; do
10883         case "$1" in
10884         $define) echo "#include <$2>";;
10885         esac ;
10886     shift 2;
10887 done > try.c;
10888 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10889 set try;
10890 if eval $compile; then
10891         val="$define";
10892 else
10893         val="$undef";
10894 fi;
10895 set $varname;
10896 eval $setvar;
10897 $rm_try'
10898
10899 : see if we should include time.h, sys/time.h, or both
10900 echo " "
10901 if test "X$timeincl" = X; then
10902         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10903         $echo $n "I'm now running the test program...$c"
10904         $cat >try.c <<EOCP
10905 #include <sys/types.h>
10906 #ifdef I_TIME
10907 #include <time.h>
10908 #endif
10909 #ifdef I_SYSTIME
10910 #ifdef SYSTIMEKERNEL
10911 #define KERNEL
10912 #endif
10913 #include <sys/time.h>
10914 #endif
10915 #ifdef I_SYSSELECT
10916 #include <sys/select.h>
10917 #endif
10918 #$i_stdlib I_STDLIB
10919 #ifdef I_STDLIB
10920 #include <stdlib.h>
10921 #endif
10922 int main()
10923 {
10924         struct tm foo;
10925 #ifdef S_TIMEVAL
10926         struct timeval bar;
10927 #endif
10928 #ifdef S_TIMEZONE
10929         struct timezone tzp;
10930 #endif
10931         if (foo.tm_sec == foo.tm_sec)
10932                 exit(0);
10933 #ifdef S_TIMEVAL
10934         if (bar.tv_sec == bar.tv_sec)
10935                 exit(0);
10936 #endif
10937         exit(1);
10938 }
10939 EOCP
10940         flags=''
10941         for s_timezone in '-DS_TIMEZONE' ''; do
10942         sysselect=''
10943         for s_timeval in '-DS_TIMEVAL' ''; do
10944         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10945         for i_time in '' '-DI_TIME'; do
10946         for i_systime in '-DI_SYSTIME' ''; do
10947                 case "$flags" in
10948                 '') $echo $n ".$c"
10949                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10950                         if eval $compile; then
10951                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10952                                 shift
10953                                 flags="$*"
10954                                 echo " "
10955                                 $echo $n "Succeeded with $flags$c"
10956                         fi
10957                         ;;
10958                 esac
10959         done
10960         done
10961         done
10962         done
10963         done
10964         timeincl=''
10965         echo " "
10966         case "$flags" in
10967         *SYSTIMEKERNEL*) i_systimek="$define"
10968                 timeincl=`./findhdr sys/time.h`
10969                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10970         *) i_systimek="$undef";;
10971         esac
10972         case "$flags" in
10973         *I_TIME*) i_time="$define"
10974                 timeincl=`./findhdr time.h`" $timeincl"
10975                 echo "We'll include <time.h>." >&4;;
10976         *) i_time="$undef";;
10977         esac
10978         case "$flags" in
10979         *I_SYSTIME*) i_systime="$define"
10980                 timeincl=`./findhdr sys/time.h`" $timeincl"
10981                 echo "We'll include <sys/time.h>." >&4;;
10982         *) i_systime="$undef";;
10983         esac
10984         $rm_try
10985 fi
10986 : see if struct tm knows about tm_zone
10987 case "$i_systime$i_time" in
10988 *$define*)
10989         echo " "
10990         echo "Checking to see if your struct tm has tm_zone field..." >&4
10991         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10992         eval $hasfield
10993         ;;
10994 *)      val="$undef"
10995         set d_tm_tm_zone
10996         eval $setvar
10997         ;;
10998 esac
10999 case "$d_tm_tm_zone" in
11000 "$define")      echo "Yes, it does."   ;;
11001 *)              echo "No, it doesn't." ;;
11002 esac
11003 : see if struct tm knows about tm_gmtoff
11004 case "$i_systime$i_time" in
11005 *$define*)
11006         echo " "
11007         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
11008         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
11009         eval $hasfield
11010         ;;
11011 *)      val="$undef"
11012         set d_tm_tm_gmtoff
11013         eval $setvar
11014         ;;
11015 esac
11016 case "$d_tm_tm_gmtoff" in
11017 "$define")      echo "Yes, it does."   ;;
11018 *)              echo "No, it doesn't." ;;
11019 esac
11020
11021 : see if asctime_r exists
11022 set asctime_r d_asctime_r
11023 eval $inlibc
11024 case "$d_asctime_r" in
11025 "$define")
11026         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11027         case "$d_asctime_r_proto:$usethreads" in
11028         ":define")      d_asctime_r_proto=define
11029                 set d_asctime_r_proto asctime_r $hdrs
11030                 eval $hasproto ;;
11031         *)      ;;
11032         esac
11033         case "$d_asctime_r_proto" in
11034         define)
11035         case "$asctime_r_proto" in
11036         ''|0) try='char* asctime_r(const struct tm*, char*);'
11037         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
11038         esac
11039         case "$asctime_r_proto" in
11040         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
11041         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
11042         esac
11043         case "$asctime_r_proto" in
11044         ''|0) try='int asctime_r(const struct tm*, char*);'
11045         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
11046         esac
11047         case "$asctime_r_proto" in
11048         ''|0) try='int asctime_r(const struct tm*, char*, int);'
11049         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
11050         esac
11051         case "$asctime_r_proto" in
11052         ''|0)   d_asctime_r=undef
11053                 asctime_r_proto=0
11054                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
11055         * )     case "$asctime_r_proto" in
11056                 REENTRANT_PROTO*) ;;
11057                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
11058                 esac
11059                 echo "Prototype: $try" ;;
11060         esac
11061         ;;
11062         *)      case "$usethreads" in
11063                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
11064                 esac
11065                 d_asctime_r=undef
11066                 asctime_r_proto=0
11067                 ;;
11068         esac
11069         ;;
11070 *)      asctime_r_proto=0
11071         ;;
11072 esac
11073
11074 : see if asinh exists
11075 set asinh d_asinh
11076 eval $inlibc
11077
11078 : see if atanh exists
11079 set atanh d_atanh
11080 eval $inlibc
11081
11082 : see if atolf exists
11083 set atolf d_atolf
11084 eval $inlibc
11085
11086 : see if atoll exists
11087 set atoll d_atoll
11088 eval $inlibc
11089
11090 : Look for GCC-style attribute format
11091 case "$d_attribute_format" in
11092 '')
11093 echo " "
11094 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
11095 $cat >attrib.c <<'EOCP'
11096 #include <stdio.h>
11097 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
11098 EOCP
11099 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11100         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11101                 echo "Your C compiler doesn't support __attribute__((format))."
11102                 val="$undef"
11103         else
11104                 echo "Your C compiler supports __attribute__((format))."
11105                 val="$define"
11106         fi
11107 else
11108         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11109         val="$undef"
11110 fi
11111 ;;
11112 *) val="$d_attribute_format" ;;
11113 esac
11114 set d_attribute_format
11115 eval $setvar
11116 $rm -f attrib*
11117
11118 : Look for GCC-style attribute format with null format allowed
11119 case "$d_printf_format_null" in
11120 '') case "$d_attribute_format" in
11121     $define)
11122         echo " "
11123         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
11124 $cat >attrib.c <<EOCP
11125 #include <stdio.h>
11126 #$i_stdlib I_STDLIB
11127 #ifdef I_STDLIB
11128 #include <stdlib.h>
11129 #endif
11130 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
11131 int null_printf (char* pat,...) { return (int)pat; }
11132 int main () { exit(null_printf(NULL)); }
11133 EOCP
11134         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
11135             : run the executable in case it produces a run-time warning
11136             if $run ./attrib >>attrib.out 2>&1; then
11137                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11138                     echo "Your C compiler doesn't allow __printf__ format to be null."
11139                     val="$undef"
11140                 else
11141                     echo "Your C compiler allows __printf__ format to be null."
11142                     val="$define"
11143                 fi
11144             else
11145             echo "Your C compiler executable failed with __printf__ format null."
11146             val="$undef"
11147         fi
11148     else
11149         echo "Your C compiler fails with __printf__ format null."
11150         val="$undef"
11151     fi
11152     ;;
11153     *)  val="$undef" ;;
11154     esac
11155 ;;
11156 *)  val="$d_printf_format_null" ;;
11157 esac
11158 set d_printf_format_null
11159 eval $setvar
11160 $rm -f attrib*
11161
11162 : Look for GCC-style attribute malloc
11163 case "$d_attribute_malloc" in
11164 '')
11165 echo " "
11166 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11167 $cat >attrib.c <<'EOCP'
11168 #include <stdio.h>
11169 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11170 EOCP
11171 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11172         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11173                 echo "Your C compiler doesn't support __attribute__((malloc))."
11174                 val="$undef"
11175         else
11176                 echo "Your C compiler supports __attribute__((malloc))."
11177                 val="$define"
11178         fi
11179 else
11180         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11181         val="$undef"
11182 fi
11183 ;;
11184 *) val="$d_attribute_malloc" ;;
11185 esac
11186 set d_attribute_malloc
11187 eval $setvar
11188 $rm -f attrib*
11189
11190 : Look for GCC-style attribute nonnull
11191 case "$d_attribute_nonnull" in
11192 '')
11193 echo " "
11194 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11195 $cat >attrib.c <<'EOCP'
11196 #include <stdio.h>
11197 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11198 EOCP
11199 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11200         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11201                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11202                 val="$undef"
11203         else
11204                 echo "Your C compiler supports __attribute__((nonnull))."
11205                 val="$define"
11206         fi
11207 else
11208         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11209         val="$undef"
11210 fi
11211 ;;
11212 *) val="$d_attribute_nonnull" ;;
11213 esac
11214 set d_attribute_nonnull
11215 eval $setvar
11216 $rm -f attrib*
11217
11218 : Look for GCC-style attribute noreturn
11219 case "$d_attribute_noreturn" in
11220 '')
11221 echo " "
11222 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11223 $cat >attrib.c <<'EOCP'
11224 #include <stdio.h>
11225 void fall_over_dead( void ) __attribute__((noreturn));
11226 EOCP
11227 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11228         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11229                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11230                 val="$undef"
11231         else
11232                 echo "Your C compiler supports __attribute__((noreturn))."
11233                 val="$define"
11234         fi
11235 else
11236         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11237         val="$undef"
11238 fi
11239 ;;
11240 *) val="$d_attribute_noreturn" ;;
11241 esac
11242 set d_attribute_noreturn
11243 eval $setvar
11244 $rm -f attrib*
11245
11246 : Look for GCC-style attribute pure
11247 case "$d_attribute_pure" in
11248 '')
11249 echo " "
11250 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11251 $cat >attrib.c <<'EOCP'
11252 #include <stdio.h>
11253 int square( int n ) __attribute__((pure));
11254 EOCP
11255 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11256         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11257                 echo "Your C compiler doesn't support __attribute__((pure))."
11258                 val="$undef"
11259         else
11260                 echo "Your C compiler supports __attribute__((pure))."
11261                 val="$define"
11262         fi
11263 else
11264         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11265         val="$undef"
11266 fi
11267 ;;
11268 *) val="$d_attribute_pure" ;;
11269 esac
11270 set d_attribute_pure
11271 eval $setvar
11272 $rm -f attrib*
11273
11274 : Look for GCC-style attribute unused
11275 case "$d_attribute_unused" in
11276 '')
11277 echo " "
11278 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11279 $cat >attrib.c <<'EOCP'
11280 #include <stdio.h>
11281 int do_something( int dummy __attribute__((unused)), int n );
11282 EOCP
11283 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11284         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11285                 echo "Your C compiler doesn't support __attribute__((unused))."
11286                 val="$undef"
11287         else
11288                 echo "Your C compiler supports __attribute__((unused))."
11289                 val="$define"
11290         fi
11291 else
11292         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11293         val="$undef"
11294 fi
11295 ;;
11296 *) val="$d_attribute_unused" ;;
11297 esac
11298 set d_attribute_unused
11299 eval $setvar
11300 $rm -f attrib*
11301
11302 : Look for GCC-style attribute deprecated
11303 case "$d_attribute_deprecated" in
11304 '')
11305 echo " "
11306 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11307 $cat >attrib.c <<'EOCP'
11308 #include <stdio.h>
11309 int I_am_deprecated(void) __attribute__((deprecated));
11310 EOCP
11311 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11312         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11313                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11314                 val="$undef"
11315         else
11316                 echo "Your C compiler supports __attribute__((deprecated))."
11317                 val="$define"
11318         fi
11319 else
11320         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11321         val="$undef"
11322 fi
11323 ;;
11324 *) val="$d_attribute_deprecated" ;;
11325 esac
11326 set d_attribute_deprecated
11327 eval $setvar
11328 $rm -f attrib*
11329
11330 : Look for GCC-style attribute warn_unused_result
11331 case "$d_attribute_warn_unused_result" in
11332 '')
11333 echo " "
11334 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11335 $cat >attrib.c <<'EOCP'
11336 #include <stdio.h>
11337 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11338 EOCP
11339 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11340         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11341                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11342                 val="$undef"
11343         else
11344                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11345                 val="$define"
11346         fi
11347 else
11348         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11349         val="$undef"
11350 fi
11351 ;;
11352 *) val="$d_attribute_warn_unused_result" ;;
11353 esac
11354 set d_attribute_warn_unused_result
11355 eval $setvar
11356 $rm -f attrib*
11357
11358 : see if bcmp exists
11359 set bcmp d_bcmp
11360 eval $inlibc
11361
11362 : see if bcopy exists
11363 set bcopy d_bcopy
11364 eval $inlibc
11365
11366 : see if getpgrp exists
11367 set getpgrp d_getpgrp
11368 eval $inlibc
11369
11370 case "$d_getpgrp" in
11371 "$define")
11372         echo " "
11373         echo "Checking to see which flavor of getpgrp is in use..."
11374         $cat >try.c <<EOP
11375 #$i_unistd I_UNISTD
11376 #include <sys/types.h>
11377 #ifdef I_UNISTD
11378 #  include <unistd.h>
11379 #endif
11380 #$i_stdlib I_STDLIB
11381 #ifdef I_STDLIB
11382 #include <stdlib.h>
11383 #endif
11384 int main()
11385 {
11386         if (getuid() == 0) {
11387                 printf("(I see you are running Configure as super-user...)\n");
11388                 setuid(1);
11389         }
11390 #ifdef TRY_BSD_PGRP
11391         if (getpgrp(1) == 0)
11392                 exit(0);
11393 #else
11394         if (getpgrp() > 0)
11395                 exit(0);
11396 #endif
11397         exit(1);
11398 }
11399 EOP
11400         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11401                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11402                 val="$define"
11403         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11404                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11405                 val="$undef"
11406         else
11407                 echo "I can't seem to compile and run the test program."
11408                 if ./usg; then
11409                         xxx="a USG one, i.e. you use getpgrp()."
11410                 else
11411                         # SVR4 systems can appear rather BSD-ish.
11412                         case "$i_unistd" in
11413                         $undef)
11414                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11415                                 val="$define"
11416                                 ;;
11417                         $define)
11418                                 xxx="probably a USG one, i.e. you use getpgrp()."
11419                                 val="$undef"
11420                                 ;;
11421                         esac
11422                 fi
11423                 echo "Assuming your getpgrp is $xxx" >&4
11424         fi
11425         ;;
11426 *) val="$undef";;
11427 esac
11428 set d_bsdgetpgrp
11429 eval $setvar
11430 $rm_try
11431
11432 : see if setpgrp exists
11433 set setpgrp d_setpgrp
11434 eval $inlibc
11435
11436 case "$d_setpgrp" in
11437 "$define")
11438         echo " "
11439         echo "Checking to see which flavor of setpgrp is in use..."
11440         $cat >try.c <<EOP
11441 #$i_unistd I_UNISTD
11442 #include <sys/types.h>
11443 #ifdef I_UNISTD
11444 #  include <unistd.h>
11445 #endif
11446 #$i_stdlib I_STDLIB
11447 #ifdef I_STDLIB
11448 #include <stdlib.h>
11449 #endif
11450 int main()
11451 {
11452         if (getuid() == 0) {
11453                 printf("(I see you are running Configure as super-user...)\n");
11454                 setuid(1);
11455         }
11456 #ifdef TRY_BSD_PGRP
11457         if (-1 == setpgrp(1, 1))
11458                 exit(0);
11459 #else
11460         if (setpgrp() != -1)
11461                 exit(0);
11462 #endif
11463         exit(1);
11464 }
11465 EOP
11466         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11467                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11468                 val="$define"
11469         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11470                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11471                 val="$undef"
11472         else
11473                 echo "(I can't seem to compile and run the test program.)"
11474                 if ./usg; then
11475                         xxx="a USG one, i.e. you use setpgrp()."
11476                 else
11477                         # SVR4 systems can appear rather BSD-ish.
11478                         case "$i_unistd" in
11479                         $undef)
11480                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11481                                 val="$define"
11482                                 ;;
11483                         $define)
11484                                 xxx="probably a USG one, i.e. you use setpgrp()."
11485                                 val="$undef"
11486                                 ;;
11487                         esac
11488                 fi
11489                 echo "Assuming your setpgrp is $xxx" >&4
11490         fi
11491         ;;
11492 *) val="$undef";;
11493 esac
11494 set d_bsdsetpgrp
11495 eval $setvar
11496 $rm_try
11497
11498 : Look for GCC-style __builtin_choose_expr
11499 case "$d_builtin_choose_expr" in
11500 '')
11501     echo " "
11502     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11503     $cat >try.c <<'EOCP'
11504 #include <assert.h>
11505 #include <stdlib.h>
11506 #include <stdio.h>
11507
11508 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11509
11510 int main(void) {
11511     assert( SYRINX(1) == 2112 );
11512     assert( SYRINX(1) != 5150 );
11513     assert( SYRINX(0) == 5150 );
11514     assert( SYRINX(0) != 2112 );
11515     puts( "All good!" );
11516     exit(0);
11517 }
11518
11519 EOCP
11520     set try
11521     if eval $compile && $run ./try; then
11522         echo "Your C compiler supports __builtin_choose_expr."
11523         val="$define"
11524     else
11525         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11526         val="$undef"
11527     fi
11528 ;;
11529 *) val="$d_builtin_choose_expr" ;;
11530 esac
11531
11532 set d_builtin_choose_expr
11533 eval $setvar
11534 $rm_try
11535
11536 : Look for GCC-style __builtin_expect
11537 case "$d_builtin_expect" in
11538 '')
11539     echo " "
11540     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11541     $cat >try.c <<'EOCP'
11542 int main(void) {
11543     int n = 50;
11544     if ( __builtin_expect(n, 0) ) n = 1;
11545     /* Remember shell exit code truth is 0, C truth is non-zero */
11546     return !(n == 1);
11547 }
11548 EOCP
11549     set try
11550     if eval $compile && $run ./try; then
11551         echo "Your C compiler supports __builtin_expect."
11552         val="$define"
11553     else
11554         echo "Your C compiler doesn't seem to understand __builtin_expect."
11555         val="$undef"
11556     fi
11557     ;;
11558 *) val="$d_builtin_expect" ;;
11559 esac
11560
11561 set d_builtin_expect
11562 eval $setvar
11563 $rm_try
11564
11565 : see if bzero exists
11566 set bzero d_bzero
11567 eval $inlibc
11568
11569 : see if stdarg is available
11570 echo " "
11571 if $test `./findhdr stdarg.h`; then
11572         echo "<stdarg.h> found." >&4
11573         valstd="$define"
11574 else
11575         echo "<stdarg.h> NOT found." >&4
11576         valstd="$undef"
11577 fi
11578
11579 : see if varargs is available
11580 echo " "
11581 if $test `./findhdr varargs.h`; then
11582         echo "<varargs.h> found." >&4
11583 else
11584         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11585 fi
11586
11587 : set up the varargs testing programs
11588 $cat > varargs.c <<EOP
11589 #ifdef I_STDARG
11590 #include <stdarg.h>
11591 #endif
11592 #ifdef I_VARARGS
11593 #include <varargs.h>
11594 #endif
11595
11596 #ifdef I_STDARG
11597 int f(char *p, ...)
11598 #else
11599 int f(va_alist)
11600 va_dcl
11601 #endif
11602 {
11603         va_list ap;
11604 #ifndef I_STDARG
11605         char *p;
11606 #endif
11607 #ifdef I_STDARG
11608         va_start(ap,p);
11609 #else
11610         va_start(ap);
11611         p = va_arg(ap, char *);
11612 #endif
11613         va_end(ap);
11614         return 0;
11615 }
11616 EOP
11617 $cat > varargs <<EOP
11618 $startsh
11619 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11620         echo "true"
11621 else
11622         echo "false"
11623 fi
11624 $rm -f varargs$_o
11625 EOP
11626 chmod +x varargs
11627
11628 : now check which varargs header should be included
11629 echo " "
11630 i_varhdr=''
11631 val=''
11632 case "$valstd" in
11633 "$define")
11634         if `./varargs I_STDARG`; then
11635                 val='stdarg.h'
11636         elif `./varargs I_VARARGS`; then
11637                 val='varargs.h'
11638         fi
11639         ;;
11640 *)
11641         if `./varargs I_VARARGS`; then
11642                 val='varargs.h'
11643         fi
11644         ;;
11645 esac
11646 case "$val" in
11647 '')
11648         echo " "
11649         echo "*** WHOA THERE!!! ***" >&4
11650         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
11651         case "$knowitall" in
11652         '')
11653         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
11654                 exit 1
11655                 ;;
11656         esac
11657 echo "I could not find the definition for va_dcl... You have problems..." >&4
11658         val="$undef"; set i_stdarg; eval $setvar
11659         val="$undef"; set i_varargs; eval $setvar
11660         ;;
11661 *)
11662         set i_varhdr
11663         eval $setvar
11664         case "$i_varhdr" in
11665         stdarg.h)
11666                 val="$define"; set i_stdarg; eval $setvar
11667                 val="$undef"; set i_varargs; eval $setvar
11668                 ;;
11669         varargs.h)
11670                 val="$undef"; set i_stdarg; eval $setvar
11671                 val="$define"; set i_varargs; eval $setvar
11672                 ;;
11673         esac
11674         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11675 esac
11676 $rm -f varargs*
11677
11678 : see if the Compiler supports C99 variadic macros
11679 case "$i_stdarg$i_stdlib" in
11680     "$define$define")
11681     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11682     $cat >try.c <<EOCP
11683 #include <stdio.h>
11684 #include <stdarg.h>
11685
11686 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11687
11688 int main() {
11689   char buf[20];
11690   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11691   puts(buf);
11692   return 0;
11693 }
11694 EOCP
11695     set try
11696     if eval $compile && $run ./try 2>&1 >/dev/null; then
11697         case "`$run ./try`" in
11698             "123 456 789")
11699             echo "You have C99 variadic macros." >&4
11700             d_c99_variadic_macros="$define"
11701             ;;
11702             *)
11703             echo "You don't have functional C99 variadic macros." >&4
11704             d_c99_variadic_macros="$undef"
11705             ;;
11706         esac
11707     else
11708         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11709         d_c99_variadic_macros="$undef"
11710     fi
11711     $rm_try
11712     ;;
11713     *)
11714     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11715     d_c99_variadic_macros="$undef"
11716     ;;
11717 esac
11718
11719 : see if signal is declared as pointer to function returning int or void
11720 echo " "
11721 xxx=`./findhdr signal.h`
11722 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11723 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11724         echo "You have int (*signal())() instead of void." >&4
11725         val="$undef"
11726 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11727         echo "You have void (*signal())()." >&4
11728         val="$define"
11729 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11730         echo "You have int (*signal())() instead of void." >&4
11731         val="$undef"
11732 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11733         echo "You have void (*signal())()." >&4
11734         val="$define"
11735 else
11736         case "$d_voidsig" in
11737         '')
11738         echo "I can't determine whether signal handler returns void or int..." >&4
11739                 dflt=void
11740                 rp="What type does your signal handler return?"
11741                 . ./myread
11742                 case "$ans" in
11743                 v*) val="$define";;
11744                 *) val="$undef";;
11745                 esac;;
11746         "$define")
11747                 echo "As you already told me, signal handler returns void." >&4
11748                 val="$define"
11749                 ;;
11750         *)      echo "As you already told me, signal handler returns int." >&4
11751                 val="$undef"
11752                 ;;
11753         esac
11754 fi
11755 set d_voidsig
11756 eval $setvar
11757 case "$d_voidsig" in
11758 "$define") signal_t="void";;
11759 *) signal_t="int";;
11760 esac
11761 $rm -f $$.tmp
11762
11763 : check for ability to cast large floats to 32-bit ints.
11764 echo " "
11765 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11766 if $test "$intsize" -ge 4; then
11767         xxx=int
11768 else
11769         xxx=long
11770 fi
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(3); }
11780 int main()
11781 {
11782         $xxx i32;
11783         double f, g;
11784         int result = 0;
11785         char str[16];
11786         signal(SIGFPE, blech);
11787
11788         /* Don't let compiler optimize the test away.  Store the number
11789            in a writable string for gcc to pass to sscanf under HP-UX.
11790         */
11791         sprintf(str, "2147483647");
11792         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11793         g = 10 * f;
11794         i32  = ($xxx) g;
11795
11796         /* x86 processors will probably give 0x8000 0000, which is a
11797            sign change.  We don't want that.  We want to mimic SPARC
11798            behavior here, which is to preserve the sign and give
11799            back 0x7fff ffff.
11800         */
11801         if (i32 != ($xxx) f)
11802                 result |= 1;
11803         exit(result);
11804 }
11805 EOCP
11806 set try
11807 if eval $compile_ok; then
11808         $run ./try 2>/dev/null
11809         yyy=$?
11810 else
11811         echo "(I can't seem to compile the test program--assuming it can't)"
11812         yyy=1
11813 fi
11814 case "$yyy" in
11815 0)      val="$define"
11816         echo "Yup, it can."
11817         ;;
11818 *)      val="$undef"
11819         echo "Nope, it can't."
11820         ;;
11821 esac
11822 set d_casti32
11823 eval $setvar
11824 $rm_try
11825
11826 : check for ability to cast negative floats to unsigned
11827 echo " "
11828 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11829 $cat >try.c <<EOCP
11830 #include <stdio.h>
11831 #$i_stdlib I_STDLIB
11832 #ifdef I_STDLIB
11833 #include <stdlib.h>
11834 #endif
11835 #include <sys/types.h>
11836 #include <signal.h>
11837 $signal_t blech(int s) { exit(7); }
11838 $signal_t blech_in_list(int s) { exit(4); }
11839 unsigned long dummy_long(unsigned long p) { return p; }
11840 unsigned int dummy_int(unsigned int p) { return p; }
11841 unsigned short dummy_short(unsigned short p) { return p; }
11842 int main()
11843 {
11844         double f;
11845         unsigned long along;
11846         unsigned int aint;
11847         unsigned short ashort;
11848         int result = 0;
11849         char str[16];
11850
11851         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11852            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11853            optimized the whole file away
11854         */
11855         /* Store the number in a writable string for gcc to pass to
11856            sscanf under HP-UX.
11857         */
11858         sprintf(str, "-123");
11859         sscanf(str, "%lf", &f);  /* f = -123.; */
11860
11861         signal(SIGFPE, blech);
11862         along = (unsigned long)f;
11863         aint = (unsigned int)f;
11864         ashort = (unsigned short)f;
11865         if (along != (unsigned long)-123)
11866                 result |= 1;
11867         if (aint != (unsigned int)-123)
11868                 result |= 1;
11869         if (ashort != (unsigned short)-123)
11870                 result |= 1;
11871         sprintf(str, "1073741824.");
11872         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11873         f = f + f;
11874         along = 0;
11875         along = (unsigned long)f;
11876         if (along != 0x80000000)
11877                 result |= 2;
11878         f -= 1.;
11879         along = 0;
11880         along = (unsigned long)f;
11881         if (along != 0x7fffffff)
11882                 result |= 1;
11883         f += 2.;
11884         along = 0;
11885         along = (unsigned long)f;
11886         if (along != 0x80000001)
11887                 result |= 2;
11888         if (result)
11889                 exit(result);
11890         signal(SIGFPE, blech_in_list);
11891         sprintf(str, "123.");
11892         sscanf(str, "%lf", &f);  /* f = 123.; */
11893         along = dummy_long((unsigned long)f);
11894         aint = dummy_int((unsigned int)f);
11895         ashort = dummy_short((unsigned short)f);
11896         if (along != (unsigned long)123)
11897                 result |= 4;
11898         if (aint != (unsigned int)123)
11899                 result |= 4;
11900         if (ashort != (unsigned short)123)
11901                 result |= 4;
11902         exit(result);
11903
11904 }
11905 EOCP
11906 set try
11907 if eval $compile_ok; then
11908         $run ./try 2>/dev/null
11909         castflags=$?
11910 else
11911         echo "(I can't seem to compile the test program--assuming it can't)"
11912         castflags=7
11913 fi
11914 case "$castflags" in
11915 0)      val="$define"
11916         echo "Yup, it can."
11917         ;;
11918 *)      val="$undef"
11919         echo "Nope, it can't."
11920         ;;
11921 esac
11922 set d_castneg
11923 eval $setvar
11924 $rm_try
11925
11926 : see if cbrt exists
11927 set cbrt d_cbrt
11928 eval $inlibc
11929
11930 : see if vprintf exists
11931 echo " "
11932 if set vprintf val -f d_vprintf; eval $csym; $val; then
11933         echo 'vprintf() found.' >&4
11934         val="$define"
11935         $cat >try.c <<EOF
11936 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11937 #$i_varargs I_VARARGS
11938
11939 #$i_stdlib I_STDLIB
11940 #$i_unistd I_UNISTD
11941
11942 #ifdef I_STDARG
11943 #  include <stdarg.h>
11944 #else /* I_VARARGS */
11945 #  include <varargs.h>
11946 #endif
11947
11948 #ifdef I_UNISTD
11949 #  include <unistd.h>
11950 #endif
11951
11952 #ifdef I_STDLIB
11953 #  include <stdlib.h>
11954 #endif
11955
11956 #include <stdio.h> /* vsprintf prototype */
11957
11958 #ifdef I_STDARG
11959 void xxx(int n, ...)
11960 {
11961     va_list args;
11962     char buf[10];
11963     va_start(args, n);
11964     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11965 }
11966 int main() { xxx(1, "foo"); }
11967
11968 #else /* I_VARARGS */
11969
11970 xxx(va_alist)
11971 va_dcl
11972 {
11973     va_list args;
11974     char buf[10];
11975     va_start(args);
11976     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11977 }
11978 int main() { xxx("foo"); }
11979
11980 #endif
11981
11982 EOF
11983         set try
11984         if eval $compile_ok; then
11985                 if $run ./try; then
11986                         echo "Your vsprintf() returns (int)." >&4
11987                         val2="$undef"
11988                 else
11989                         echo "Your vsprintf() returns (char*)." >&4
11990                         val2="$define"
11991                 fi
11992         else
11993                 echo 'I am unable to compile the vsprintf() test program.' >&4
11994                 # We shouldn't get here.  If we do, assume the standard signature,
11995                 # not the old BSD one.
11996                 echo 'Guessing that vsprintf() returns (int).' >&4
11997                 val2="$undef"
11998         fi
11999 else
12000         echo 'vprintf() NOT found.' >&4
12001         val="$undef"
12002         val2="$undef"
12003 fi
12004 $rm_try
12005 set d_vprintf
12006 eval $setvar
12007 val=$val2
12008 set d_charvspr
12009 eval $setvar
12010
12011 : see if chown exists
12012 set chown d_chown
12013 eval $inlibc
12014
12015 : see if chroot exists
12016 set chroot d_chroot
12017 eval $inlibc
12018
12019 : see if chsize exists
12020 set chsize d_chsize
12021 eval $inlibc
12022
12023 : see if class exists
12024 set class d_class
12025 eval $inlibc
12026
12027 : see if clearenv exists
12028 set clearenv d_clearenv
12029 eval $inlibc
12030
12031 : Define hasstruct macro for Configure internal use
12032 hasstruct='varname=$1; struct=$2; shift; shift;
12033 while $test $# -ge 2; do
12034         case "$1" in
12035         $define) echo "#include <$2>";;
12036         esac ;
12037     shift 2;
12038 done > try.c;
12039 echo "int main () { struct $struct foo; }" >> try.c;
12040 set try;
12041 if eval $compile; then
12042         val="$define";
12043 else
12044         val="$undef";
12045 fi;
12046 set $varname;
12047 eval $setvar;
12048 $rm_try'
12049
12050 : see whether socket exists
12051 socketlib=''
12052 sockethdr=''
12053 echo " "
12054 $echo $n "Hmm... $c" >&4
12055 if set socket val -f d_socket; eval $csym; $val; then
12056     echo "Looks like you have Berkeley networking support." >&4
12057     d_socket="$define"
12058     if set setsockopt val -f; eval $csym; $val; then
12059         d_oldsock="$undef"
12060     else
12061         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
12062         d_oldsock="$define"
12063     fi
12064 else
12065     if $contains socklib libc.list >/dev/null 2>&1; then
12066         echo "Looks like you have Berkeley networking support." >&4
12067         d_socket="$define"
12068         : we will have to assume that it supports the 4.2 BSD interface
12069         d_oldsock="$undef"
12070     else
12071         echo "You don't have Berkeley networking in libc$_a..." >&4
12072         if test "X$d_socket" = "X$define"; then
12073             echo "...but you seem to believe that you have sockets." >&4
12074         else
12075             for net in net socket
12076             do
12077                 if test -f $sysroot/usr/lib/lib$net$_a; then
12078                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
12079                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
12080                     if $contains socket libc.list >/dev/null 2>&1; then
12081                         d_socket="$define"
12082                         socketlib="-l$net"
12083                         case "$net" in
12084                         net)
12085                             echo "...but the Wollongong group seems to have hacked it in." >&4
12086                             sockethdr="-I$sysroot/usr/netinclude"
12087                             ;;
12088                         esac
12089                         echo "Found Berkeley sockets interface in lib$net." >&4
12090                         if $contains setsockopt libc.list >/dev/null 2>&1; then
12091                             d_oldsock="$undef"
12092                         else
12093                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
12094                             d_oldsock="$define"
12095                         fi
12096                         break
12097                     fi
12098                 fi
12099             done
12100             if test "X$d_socket" != "X$define"; then
12101                echo "or anywhere else I see." >&4
12102                d_socket="$undef"
12103                d_oldsock="$undef"
12104             fi
12105         fi
12106     fi
12107 fi
12108
12109 : see if socketpair exists
12110 set socketpair d_sockpair
12111 eval $inlibc
12112
12113
12114 echo " "
12115 echo "Checking the availability sa_len in the sock struct ..." >&4
12116 $cat >try.c <<EOF
12117 #include <sys/types.h>
12118 #include <sys/socket.h>
12119 int main() {
12120 struct sockaddr sa;
12121 return (sa.sa_len);
12122 }
12123 EOF
12124 val="$undef"
12125 set try; if eval $compile; then
12126     val="$define"
12127 fi
12128 set d_sockaddr_sa_len; eval $setvar
12129 $rm_try
12130
12131 echo " "
12132 echo "Checking the availability struct sockaddr_in6 ..." >&4
12133 $cat >try.c <<EOF
12134 #include <sys/types.h>
12135 #include <sys/socket.h>
12136 #include <netinet/in.h>
12137 int main() {
12138 struct sockaddr_in6 sin6;
12139 return (sin6.sin6_family);
12140 }
12141 EOF
12142 val="$undef"
12143 set try; if eval $compile; then
12144     val="$define"
12145 fi
12146 set d_sockaddr_in6; eval $setvar
12147 $rm_try
12148
12149 echo " "
12150 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
12151 $cat >try.c <<EOF
12152 #include <sys/types.h>
12153 #include <sys/socket.h>
12154 #include <netinet/in.h>
12155 int main() {
12156 struct sockaddr_in6 sin6;
12157 return (sin6.sin6_scope_id);
12158 }
12159 EOF
12160 val="$undef"
12161 set try; if eval $compile; then
12162     val="$define"
12163 fi
12164 set d_sin6_scope_id; eval $setvar
12165 $rm_try
12166
12167 echo " "
12168 echo "Checking the availability struct ip_mreq ..." >&4
12169 $cat >try.c <<EOF
12170 #include <sys/types.h>
12171 #include <sys/socket.h>
12172 #include <netinet/in.h>
12173 int main() {
12174 struct ip_mreq mreq;
12175 return (mreq.imr_multiaddr.s_addr);
12176 }
12177 EOF
12178 val="$undef"
12179 set try; if eval $compile; then
12180        val="$define"
12181 fi
12182 set d_ip_mreq; eval $setvar
12183 $rm_try
12184
12185 echo " "
12186 echo "Checking the availability struct ip_mreq_source ..." >&4
12187 $cat >try.c <<EOF
12188 #include <sys/types.h>
12189 #include <sys/socket.h>
12190 #include <netinet/in.h>
12191 int main() {
12192 struct ip_mreq_source mreq;
12193 return (mreq.imr_multiaddr.s_addr);
12194 }
12195 EOF
12196 val="$undef"
12197 set try; if eval $compile; then
12198        val="$define"
12199 fi
12200 set d_ip_mreq_source; eval $setvar
12201 $rm_try
12202
12203 echo " "
12204 echo "Checking the availability struct ipv6_mreq ..." >&4
12205 $cat >try.c <<EOF
12206 #include <sys/types.h>
12207 #include <sys/socket.h>
12208 #include <netinet/in.h>
12209 int main() {
12210 struct ipv6_mreq mreq;
12211 return (mreq.ipv6mr_interface);
12212 }
12213 EOF
12214 val="$undef"
12215 set try; if eval $compile; then
12216     val="$define"
12217 fi
12218 set d_ipv6_mreq; eval $setvar
12219 $rm_try
12220
12221 echo " "
12222 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12223 $cat >try.c <<EOF
12224 #include <sys/types.h>
12225 #include <sys/socket.h>
12226 #include <netinet/in.h>
12227 int main() {
12228 struct ipv6_mreq_source mreq;
12229 return (mreq.imr_multiaddr.s_addr);
12230 }
12231 EOF
12232 val="$undef"
12233 set try; if eval $compile; then
12234        val="$define"
12235 fi
12236 set d_ipv6_mreq_source; eval $setvar
12237 $rm_try
12238
12239 echo " "
12240 echo "Checking the availability of certain socket constants..." >&4
12241 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12242     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12243     $cat >try.c <<EOF
12244 #include <sys/types.h>
12245 #include <sys/socket.h>
12246 int main() {
12247     int i = $ENUM;
12248 }
12249 EOF
12250     val="$undef"
12251     set try; if eval $compile; then
12252         val="$define"
12253     fi
12254     set d_${enum}; eval $setvar
12255     $rm_try
12256 done
12257
12258 : see if this is a sys/uio.h system
12259 set sys/uio.h i_sysuio
12260 eval $inhdr
12261
12262 : Check for cmsghdr support
12263 echo " "
12264 echo "Checking to see if your system supports struct cmsghdr..." >&4
12265 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12266 eval $hasstruct
12267 case "$d_cmsghdr_s" in
12268 "$define")      echo "Yes, it does."   ;;
12269 *)              echo "No, it doesn't." ;;
12270 esac
12271
12272
12273 : check for const keyword
12274 echo " "
12275 echo 'Checking to see if your C compiler knows about "const"...' >&4
12276 $cat >const.c <<'EOCP'
12277 typedef struct spug { int drokk; } spug;
12278 int main()
12279 {
12280         const char *foo;
12281         const spug y = { 0 };
12282 }
12283 EOCP
12284 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
12285         val="$define"
12286         echo "Yup, it does."
12287 else
12288         val="$undef"
12289         echo "Nope, it doesn't."
12290 fi
12291 set d_const
12292 eval $setvar
12293
12294 : see if copysign exists
12295 set copysign d_copysign
12296 eval $inlibc
12297
12298 : see if copysignl exists
12299 set copysignl d_copysignl
12300 eval $inlibc
12301
12302 : see if crypt exists
12303 echo " "
12304 set crypt d_crypt
12305 eval $inlibc
12306 case "$d_crypt" in
12307 $define) cryptlib='' ;;
12308 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12309                 echo 'crypt() found.' >&4
12310                 val="$define"
12311                 cryptlib=''
12312         else
12313                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12314                 if $test -z "$cryptlib"; then
12315                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12316                 else
12317                         cryptlib=-lcrypt
12318                 fi
12319                 if $test -z "$cryptlib"; then
12320                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12321                 else
12322                         cryptlib=-lcrypt
12323                 fi
12324                 if $test -z "$cryptlib"; then
12325                         cryptlib=`./loc libcrypt$_a "" $libpth`
12326                 else
12327                         cryptlib=-lcrypt
12328                 fi
12329                 if $test -z "$cryptlib"; then
12330                         echo 'crypt() NOT found.' >&4
12331                         val="$undef"
12332                 else
12333                         val="$define"
12334                 fi
12335         fi
12336         set d_crypt
12337         eval $setvar
12338         ;;
12339 esac
12340
12341 : see if this is a crypt.h system
12342 set crypt.h i_crypt
12343 eval $inhdr
12344
12345 : see if crypt_r exists
12346 set crypt_r d_crypt_r
12347 eval $inlibc
12348 case "$d_crypt_r" in
12349 "$define")
12350         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12351         case "$d_crypt_r_proto:$usethreads" in
12352         ":define")      d_crypt_r_proto=define
12353                 set d_crypt_r_proto crypt_r $hdrs
12354                 eval $hasproto ;;
12355         *)      ;;
12356         esac
12357         case "$d_crypt_r_proto" in
12358         define)
12359         case "$crypt_r_proto" in
12360         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12361         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12362         esac
12363         case "$crypt_r_proto" in
12364         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12365         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12366         esac
12367         case "$crypt_r_proto" in
12368         ''|0)   d_crypt_r=undef
12369                 crypt_r_proto=0
12370                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12371         * )     case "$crypt_r_proto" in
12372                 REENTRANT_PROTO*) ;;
12373                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12374                 esac
12375                 echo "Prototype: $try" ;;
12376         esac
12377         ;;
12378         *)      case "$usethreads" in
12379                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12380                 esac
12381                 d_crypt_r=undef
12382                 crypt_r_proto=0
12383                 ;;
12384         esac
12385         ;;
12386 *)      crypt_r_proto=0
12387         ;;
12388 esac
12389
12390 : get csh whereabouts
12391 case "$csh" in
12392 'csh') val="$undef" ;;
12393 *) val="$define" ;;
12394 esac
12395 set d_csh
12396 eval $setvar
12397 : Respect a hint or command line value for full_csh.
12398 case "$full_csh" in
12399 '') full_csh=$csh ;;
12400 esac
12401
12402 : see if ctermid exists
12403 set ctermid d_ctermid
12404 eval $inlibc
12405
12406 : see if ctermid_r exists
12407 set ctermid_r d_ctermid_r
12408 eval $inlibc
12409 case "$d_ctermid_r" in
12410 "$define")
12411         hdrs="$i_systypes sys/types.h define stdio.h "
12412         case "$d_ctermid_r_proto:$usethreads" in
12413         ":define")      d_ctermid_r_proto=define
12414                 set d_ctermid_r_proto ctermid_r $hdrs
12415                 eval $hasproto ;;
12416         *)      ;;
12417         esac
12418         case "$d_ctermid_r_proto" in
12419         define)
12420         case "$ctermid_r_proto" in
12421         ''|0) try='char* ctermid_r(char*);'
12422         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12423         esac
12424         case "$ctermid_r_proto" in
12425         ''|0)   d_ctermid_r=undef
12426                 ctermid_r_proto=0
12427                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12428         * )     case "$ctermid_r_proto" in
12429                 REENTRANT_PROTO*) ;;
12430                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12431                 esac
12432                 echo "Prototype: $try" ;;
12433         esac
12434         ;;
12435         *)      case "$usethreads" in
12436                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12437                 esac
12438                 d_ctermid_r=undef
12439                 ctermid_r_proto=0
12440                 ;;
12441         esac
12442         ;;
12443 *)      ctermid_r_proto=0
12444         ;;
12445 esac
12446
12447 : see if ctime_r exists
12448 set ctime_r d_ctime_r
12449 eval $inlibc
12450 case "$d_ctime_r" in
12451 "$define")
12452         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12453         case "$d_ctime_r_proto:$usethreads" in
12454         ":define")      d_ctime_r_proto=define
12455                 set d_ctime_r_proto ctime_r $hdrs
12456                 eval $hasproto ;;
12457         *)      ;;
12458         esac
12459         case "$d_ctime_r_proto" in
12460         define)
12461         case "$ctime_r_proto" in
12462         ''|0) try='char* ctime_r(const time_t*, char*);'
12463         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12464         esac
12465         case "$ctime_r_proto" in
12466         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12467         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12468         esac
12469         case "$ctime_r_proto" in
12470         ''|0) try='int ctime_r(const time_t*, char*);'
12471         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12472         esac
12473         case "$ctime_r_proto" in
12474         ''|0) try='int ctime_r(const time_t*, char*, int);'
12475         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12476         esac
12477         case "$ctime_r_proto" in
12478         ''|0)   d_ctime_r=undef
12479                 ctime_r_proto=0
12480                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12481         * )     case "$ctime_r_proto" in
12482                 REENTRANT_PROTO*) ;;
12483                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12484                 esac
12485                 echo "Prototype: $try" ;;
12486         esac
12487         ;;
12488         *)      case "$usethreads" in
12489                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12490                 esac
12491                 d_ctime_r=undef
12492                 ctime_r_proto=0
12493                 ;;
12494         esac
12495         ;;
12496 *)      ctime_r_proto=0
12497         ;;
12498 esac
12499
12500 : see if cuserid exists
12501 set cuserid d_cuserid
12502 eval $inlibc
12503
12504 : see if this is a limits.h system
12505 set limits.h i_limits
12506 eval $inhdr
12507
12508 : See if number of significant digits in a double precision number is known
12509 echo " "
12510 $cat >dbl_dig.c <<EOM
12511 #$i_limits I_LIMITS
12512 #$i_float I_FLOAT
12513 #ifdef I_LIMITS
12514 #include <limits.h>
12515 #endif
12516 #ifdef I_FLOAT
12517 #include <float.h>
12518 #endif
12519 #ifdef DBL_DIG
12520 printf("Contains DBL_DIG");
12521 #endif
12522 EOM
12523 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
12524 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
12525         echo "DBL_DIG found." >&4
12526         val="$define"
12527 else
12528         echo "DBL_DIG NOT found." >&4
12529         val="$undef"
12530 fi
12531 $rm -f dbl_dig.?
12532 set d_dbl_dig
12533 eval $setvar
12534
12535 : see if dbm.h is available
12536 : see if dbmclose exists
12537 set dbmclose d_dbmclose
12538 eval $inlibc
12539
12540 case "$d_dbmclose" in
12541 $define)
12542         set dbm.h i_dbm
12543         eval $inhdr
12544         case "$i_dbm" in
12545         $define)
12546                 val="$undef"
12547                 set i_rpcsvcdbm
12548                 eval $setvar
12549                 ;;
12550         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12551                 eval $inhdr
12552                 ;;
12553         esac
12554         ;;
12555 *)      echo "We won't be including <dbm.h>"
12556         val="$undef"
12557         set i_dbm
12558         eval $setvar
12559         val="$undef"
12560         set i_rpcsvcdbm
12561         eval $setvar
12562         ;;
12563 esac
12564
12565 : see if prototype for dbminit is available
12566 echo " "
12567 set d_dbminitproto dbminit $i_dbm dbm.h
12568 eval $hasproto
12569
12570 : see if difftime exists
12571 set difftime d_difftime
12572 eval $inlibc
12573
12574 : see if this is a dirent system
12575 echo " "
12576 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12577         val="$define"
12578         echo "<dirent.h> found." >&4
12579 else
12580         val="$undef"
12581         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12582                 echo "<sys/dir.h> found." >&4
12583                 echo " "
12584         else
12585                 xinc=`./findhdr sys/ndir.h`
12586         fi
12587         echo "<dirent.h> NOT found." >&4
12588 fi
12589 set i_dirent
12590 eval $setvar
12591
12592 : Look for type of directory structure.
12593 echo " "
12594 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12595
12596 case "$direntrytype" in
12597 ''|' ')
12598         case "$i_dirent" in
12599         $define) guess1='struct dirent' ;;
12600         *) guess1='struct direct'  ;;
12601         esac
12602         ;;
12603 *)      guess1="$direntrytype"
12604         ;;
12605 esac
12606
12607 case "$guess1" in
12608 'struct dirent') guess2='struct direct' ;;
12609 *) guess2='struct dirent' ;;
12610 esac
12611
12612 if $contains "$guess1" try.c >/dev/null 2>&1; then
12613         direntrytype="$guess1"
12614         echo "Your directory entries are $direntrytype." >&4
12615 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12616         direntrytype="$guess2"
12617         echo "Your directory entries seem to be $direntrytype." >&4
12618 else
12619         echo "I don't recognize your system's directory entries." >&4
12620         rp="What type is used for directory entries on this system?"
12621         dflt="$guess1"
12622         . ./myread
12623         direntrytype="$ans"
12624 fi
12625 $rm_try
12626
12627 : see if the directory entry stores field length
12628 echo " "
12629 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12630 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12631         echo "Good, your directory entry keeps length information in d_namlen." >&4
12632         val="$define"
12633 else
12634         echo "Your directory entry does not know about the d_namlen field." >&4
12635         val="$undef"
12636 fi
12637 set d_dirnamlen
12638 eval $setvar
12639 $rm_try
12640
12641 : Look for DIR.dd_fd
12642 case "$i_dirent" in
12643 "$define")
12644     echo "Checking to see if DIR has a dd_fd member variable" >&4
12645     $cat >try.c <<EOCP
12646 #$i_stdlib I_STDLIB
12647 #ifdef I_STDLIB
12648 #include <stdlib.h>
12649 #endif
12650 #include <dirent.h>
12651
12652 int main() {
12653     DIR dir;
12654     dir.dd_fd = 1;
12655     return 0;
12656 }
12657 EOCP
12658     val=$undef
12659     set try
12660     if eval $compile; then
12661         echo "Yes, it does."
12662         val="$define"
12663     else
12664         echo "No, it does not."
12665         val="$undef"
12666     fi
12667     ;;
12668 *)
12669     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12670     val="$undef"
12671     ;;
12672 esac
12673 set d_dir_dd_fd
12674 eval $setvar
12675 $rm_try
12676
12677 : see if this is an sysdir system
12678 set sys/dir.h i_sysdir
12679 eval $inhdr
12680
12681 : see if this is an sysndir system
12682 set sys/ndir.h i_sysndir
12683 eval $inhdr
12684
12685 : Look for dirfd
12686 echo " "
12687 $cat >dirfd.c <<EOM
12688 #include <stdio.h>
12689 #$i_stdlib I_STDLIB
12690 #ifdef I_STDLIB
12691 #include <stdlib.h>
12692 #endif
12693 #$i_dirent I_DIRENT             /**/
12694 #$i_sysdir I_SYS_DIR            /**/
12695 #$i_sysndir I_SYS_NDIR          /**/
12696 #$i_systypes I_SYS_TYPES        /**/
12697 #if defined(I_SYS_TYPES)
12698 #include <sys/types.h>
12699 #endif
12700 #if defined(I_DIRENT)
12701 #include <dirent.h>
12702 #else
12703 #ifdef I_SYS_NDIR
12704 #include <sys/ndir.h>
12705 #else
12706 #ifdef I_SYS_DIR
12707 #ifdef hp9000s500
12708 #include <ndir.h>       /* may be wrong in the future */
12709 #else
12710 #include <sys/dir.h>
12711 #endif
12712 #endif
12713 #endif
12714 #endif
12715 int main() {
12716         DIR *dirp = opendir(".");
12717         if (dirfd(dirp) >= 0)
12718                 exit(0);
12719         else
12720                 exit(1);
12721 }
12722 EOM
12723 val=$undef
12724 set dirfd
12725 if eval $compile; then
12726         val="$define"
12727 fi
12728 case "$val" in
12729 $define)        echo "dirfd() found." >&4       ;;
12730 *)              echo "dirfd() NOT found." >&4   ;;
12731 esac
12732 set d_dirfd
12733 eval $setvar
12734 $rm -f dirfd*
12735
12736 : see if dladdr exists
12737 set dladdr d_dladdr
12738 eval $inlibc
12739
12740 : see if dlerror exists
12741 xxx_runnm="$runnm"
12742 runnm=false
12743 set dlerror d_dlerror
12744 eval $inlibc
12745 runnm="$xxx_runnm"
12746
12747 : see if dlfcn is available
12748 set dlfcn.h i_dlfcn
12749 eval $inhdr
12750
12751 : Check what extension to use for shared libs
12752 case "$usedl" in
12753 $define|y|true)
12754         $cat << EOM
12755
12756 On a few systems, the dynamically loaded modules that perl generates and uses
12757 will need a different extension than shared libs. The default will probably
12758 be appropriate.
12759
12760 EOM
12761         case "$dlext" in
12762         '')     dflt="$so" ;;
12763         *)      dflt="$dlext" ;;
12764         esac
12765         rp='What is the extension of dynamically loaded modules'
12766         . ./myread
12767         dlext="$ans"
12768         ;;
12769 *)
12770         dlext="none"
12771         ;;
12772 esac
12773
12774 : Check if dlsym need a leading underscore
12775 echo " "
12776 val="$undef"
12777
12778 case "$dlsrc" in
12779 dl_dlopen.xs)
12780         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12781         $cat >dyna.c <<'EOM'
12782 fred () { }
12783 EOM
12784
12785 $cat >fred.c<<EOM
12786
12787 #include <stdio.h>
12788 #$i_stdlib I_STDLIB
12789 #ifdef I_STDLIB
12790 #include <stdlib.h>
12791 #endif
12792 #$i_dlfcn I_DLFCN
12793 #ifdef I_DLFCN
12794 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12795 #else
12796 #include <sys/types.h>
12797 #include <nlist.h>
12798 #include <link.h>
12799 #endif
12800
12801 extern int fred() ;
12802
12803 int main()
12804 {
12805     void * handle ;
12806     void * symbol ;
12807 #ifndef RTLD_LAZY
12808     int mode = 1 ;
12809 #else
12810     int mode = RTLD_LAZY ;
12811 #endif
12812     handle = dlopen("./dyna.$dlext", mode) ;
12813     if (handle == NULL) {
12814         printf ("1\n") ;
12815         fflush (stdout) ;
12816         exit(0);
12817     }
12818     symbol = dlsym(handle, "fred") ;
12819     if (symbol == NULL) {
12820         /* try putting a leading underscore */
12821         symbol = dlsym(handle, "_fred") ;
12822         if (symbol == NULL) {
12823             printf ("2\n") ;
12824             fflush (stdout) ;
12825             exit(0);
12826         }
12827         printf ("3\n") ;
12828     }
12829     else
12830         printf ("4\n") ;
12831     fflush (stdout) ;
12832     exit(0);
12833 }
12834 EOM
12835         : Call the object file tmp-dyna.o in case dlext=o.
12836         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12837                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12838                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12839                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12840                 xxx=`$run ./fred`
12841                 case $xxx in
12842                 1)      echo "Test program failed using dlopen." >&4
12843                         echo "Perhaps you should not use dynamic loading." >&4;;
12844                 2)      echo "Test program failed using dlsym." >&4
12845                         echo "Perhaps you should not use dynamic loading." >&4;;
12846                 3)      echo "dlsym needs a leading underscore" >&4
12847                         val="$define" ;;
12848                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12849                 esac
12850         else
12851                 echo "I can't compile and run the test program." >&4
12852                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12853         fi
12854         ;;
12855 esac
12856
12857 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12858
12859 set d_dlsymun
12860 eval $setvar
12861
12862 : see if drand48_r exists
12863 set drand48_r d_drand48_r
12864 eval $inlibc
12865 case "$d_drand48_r" in
12866 "$define")
12867         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12868         case "$d_drand48_r_proto:$usethreads" in
12869         ":define")      d_drand48_r_proto=define
12870                 set d_drand48_r_proto drand48_r $hdrs
12871                 eval $hasproto ;;
12872         *)      ;;
12873         esac
12874         case "$d_drand48_r_proto" in
12875         define)
12876         case "$drand48_r_proto" in
12877         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12878         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12879         esac
12880         case "$drand48_r_proto" in
12881         ''|0)   d_drand48_r=undef
12882                 drand48_r_proto=0
12883                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12884         * )     case "$drand48_r_proto" in
12885                 REENTRANT_PROTO*) ;;
12886                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12887                 esac
12888                 echo "Prototype: $try" ;;
12889         esac
12890         ;;
12891         *)      case "$usethreads" in
12892                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12893                 esac
12894                 d_drand48_r=undef
12895                 drand48_r_proto=0
12896                 ;;
12897         esac
12898         ;;
12899 *)      drand48_r_proto=0
12900         ;;
12901 esac
12902
12903 : see if prototype for drand48 is available
12904 echo " "
12905 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12906 eval $hasproto
12907
12908 : see if dup2 exists
12909 set dup2 d_dup2
12910 eval $inlibc
12911
12912 : see if eaccess exists
12913 set eaccess d_eaccess
12914 eval $inlibc
12915
12916 : see if endgrent exists
12917 set endgrent d_endgrent
12918 eval $inlibc
12919
12920 : see if this is an grp system
12921 set grp.h i_grp
12922 eval $inhdr
12923
12924 case "$i_grp" in
12925 $define)
12926         xxx=`./findhdr grp.h`
12927         $cppstdin $cppflags $cppminus < $xxx >$$.h
12928
12929         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12930                 val="$define"
12931         else
12932                 val="$undef"
12933         fi
12934         set d_grpasswd
12935         eval $setvar
12936
12937         $rm -f $$.h
12938         ;;
12939 *)
12940         val="$undef";
12941         set d_grpasswd; eval $setvar
12942         ;;
12943 esac
12944
12945 : see if endgrent_r exists
12946 set endgrent_r d_endgrent_r
12947 eval $inlibc
12948 case "$d_endgrent_r" in
12949 "$define")
12950         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12951         case "$d_endgrent_r_proto:$usethreads" in
12952         ":define")      d_endgrent_r_proto=define
12953                 set d_endgrent_r_proto endgrent_r $hdrs
12954                 eval $hasproto ;;
12955         *)      ;;
12956         esac
12957         case "$d_endgrent_r_proto" in
12958         define)
12959         case "$endgrent_r_proto" in
12960         ''|0) try='int endgrent_r(FILE**);'
12961         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12962         esac
12963         case "$endgrent_r_proto" in
12964         ''|0) try='void endgrent_r(FILE**);'
12965         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12966         esac
12967         case "$endgrent_r_proto" in
12968         ''|0)   d_endgrent_r=undef
12969                 endgrent_r_proto=0
12970                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12971         * )     case "$endgrent_r_proto" in
12972                 REENTRANT_PROTO*) ;;
12973                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12974                 esac
12975                 echo "Prototype: $try" ;;
12976         esac
12977         ;;
12978         *)      case "$usethreads" in
12979                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12980                 esac
12981                 d_endgrent_r=undef
12982                 endgrent_r_proto=0
12983                 ;;
12984         esac
12985         ;;
12986 *)      endgrent_r_proto=0
12987         ;;
12988 esac
12989
12990 : see if endhostent exists
12991 set endhostent d_endhent
12992 eval $inlibc
12993
12994 : see if this is a netdb.h system
12995 set netdb.h i_netdb
12996 eval $inhdr
12997
12998 : see if endhostent_r exists
12999 set endhostent_r d_endhostent_r
13000 eval $inlibc
13001 case "$d_endhostent_r" in
13002 "$define")
13003         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13004         case "$d_endhostent_r_proto:$usethreads" in
13005         ":define")      d_endhostent_r_proto=define
13006                 set d_endhostent_r_proto endhostent_r $hdrs
13007                 eval $hasproto ;;
13008         *)      ;;
13009         esac
13010         case "$d_endhostent_r_proto" in
13011         define)
13012         case "$endhostent_r_proto" in
13013         ''|0) try='int endhostent_r(struct hostent_data*);'
13014         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
13015         esac
13016         case "$endhostent_r_proto" in
13017         ''|0) try='void endhostent_r(struct hostent_data*);'
13018         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
13019         esac
13020         case "$endhostent_r_proto" in
13021         ''|0)   d_endhostent_r=undef
13022                 endhostent_r_proto=0
13023                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
13024         * )     case "$endhostent_r_proto" in
13025                 REENTRANT_PROTO*) ;;
13026                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
13027                 esac
13028                 echo "Prototype: $try" ;;
13029         esac
13030         ;;
13031         *)      case "$usethreads" in
13032                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
13033                 esac
13034                 d_endhostent_r=undef
13035                 endhostent_r_proto=0
13036                 ;;
13037         esac
13038         ;;
13039 *)      endhostent_r_proto=0
13040         ;;
13041 esac
13042
13043 : see if endnetent exists
13044 set endnetent d_endnent
13045 eval $inlibc
13046
13047 : see if endnetent_r exists
13048 set endnetent_r d_endnetent_r
13049 eval $inlibc
13050 case "$d_endnetent_r" in
13051 "$define")
13052         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13053         case "$d_endnetent_r_proto:$usethreads" in
13054         ":define")      d_endnetent_r_proto=define
13055                 set d_endnetent_r_proto endnetent_r $hdrs
13056                 eval $hasproto ;;
13057         *)      ;;
13058         esac
13059         case "$d_endnetent_r_proto" in
13060         define)
13061         case "$endnetent_r_proto" in
13062         ''|0) try='int endnetent_r(struct netent_data*);'
13063         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
13064         esac
13065         case "$endnetent_r_proto" in
13066         ''|0) try='void endnetent_r(struct netent_data*);'
13067         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
13068         esac
13069         case "$endnetent_r_proto" in
13070         ''|0)   d_endnetent_r=undef
13071                 endnetent_r_proto=0
13072                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
13073         * )     case "$endnetent_r_proto" in
13074                 REENTRANT_PROTO*) ;;
13075                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
13076                 esac
13077                 echo "Prototype: $try" ;;
13078         esac
13079         ;;
13080         *)      case "$usethreads" in
13081                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
13082                 esac
13083                 d_endnetent_r=undef
13084                 endnetent_r_proto=0
13085                 ;;
13086         esac
13087         ;;
13088 *)      endnetent_r_proto=0
13089         ;;
13090 esac
13091
13092 : see if endprotoent exists
13093 set endprotoent d_endpent
13094 eval $inlibc
13095
13096 : see if endprotoent_r exists
13097 set endprotoent_r d_endprotoent_r
13098 eval $inlibc
13099 case "$d_endprotoent_r" in
13100 "$define")
13101         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13102         case "$d_endprotoent_r_proto:$usethreads" in
13103         ":define")      d_endprotoent_r_proto=define
13104                 set d_endprotoent_r_proto endprotoent_r $hdrs
13105                 eval $hasproto ;;
13106         *)      ;;
13107         esac
13108         case "$d_endprotoent_r_proto" in
13109         define)
13110         case "$endprotoent_r_proto" in
13111         ''|0) try='int endprotoent_r(struct protoent_data*);'
13112         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
13113         esac
13114         case "$endprotoent_r_proto" in
13115         ''|0) try='void endprotoent_r(struct protoent_data*);'
13116         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
13117         esac
13118         case "$endprotoent_r_proto" in
13119         ''|0)   d_endprotoent_r=undef
13120                 endprotoent_r_proto=0
13121                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
13122         * )     case "$endprotoent_r_proto" in
13123                 REENTRANT_PROTO*) ;;
13124                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
13125                 esac
13126                 echo "Prototype: $try" ;;
13127         esac
13128         ;;
13129         *)      case "$usethreads" in
13130                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
13131                 esac
13132                 d_endprotoent_r=undef
13133                 endprotoent_r_proto=0
13134                 ;;
13135         esac
13136         ;;
13137 *)      endprotoent_r_proto=0
13138         ;;
13139 esac
13140
13141 : see if endpwent exists
13142 set endpwent d_endpwent
13143 eval $inlibc
13144
13145 : see if this is a pwd.h system
13146 set pwd.h i_pwd
13147 eval $inhdr
13148
13149 case "$i_pwd" in
13150 $define)
13151         xxx=`./findhdr pwd.h`
13152         $cppstdin $cppflags $cppminus < $xxx >$$.h
13153
13154         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
13155                 val="$define"
13156         else
13157                 val="$undef"
13158         fi
13159         set d_pwquota
13160         eval $setvar
13161
13162         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
13163                 val="$define"
13164         else
13165                 val="$undef"
13166         fi
13167         set d_pwage
13168         eval $setvar
13169
13170         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
13171                 val="$define"
13172         else
13173                 val="$undef"
13174         fi
13175         set d_pwchange
13176         eval $setvar
13177
13178         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
13179                 val="$define"
13180         else
13181                 val="$undef"
13182         fi
13183         set d_pwclass
13184         eval $setvar
13185
13186         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
13187                 val="$define"
13188         else
13189                 val="$undef"
13190         fi
13191         set d_pwexpire
13192         eval $setvar
13193
13194         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
13195                 val="$define"
13196         else
13197                 val="$undef"
13198         fi
13199         set d_pwcomment
13200         eval $setvar
13201
13202         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
13203                 val="$define"
13204         else
13205                 val="$undef"
13206         fi
13207         set d_pwgecos
13208         eval $setvar
13209
13210         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
13211                 val="$define"
13212         else
13213                 val="$undef"
13214         fi
13215         set d_pwpasswd
13216         eval $setvar
13217
13218         $rm -f $$.h
13219         ;;
13220 *)
13221         val="$undef";
13222         set d_pwquota; eval $setvar
13223         set d_pwage; eval $setvar
13224         set d_pwchange; eval $setvar
13225         set d_pwclass; eval $setvar
13226         set d_pwexpire; eval $setvar
13227         set d_pwcomment; eval $setvar
13228         set d_pwgecos; eval $setvar
13229         set d_pwpasswd; eval $setvar
13230         ;;
13231 esac
13232
13233 : see if endpwent_r exists
13234 set endpwent_r d_endpwent_r
13235 eval $inlibc
13236 case "$d_endpwent_r" in
13237 "$define")
13238         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13239         case "$d_endpwent_r_proto:$usethreads" in
13240         ":define")      d_endpwent_r_proto=define
13241                 set d_endpwent_r_proto endpwent_r $hdrs
13242                 eval $hasproto ;;
13243         *)      ;;
13244         esac
13245         case "$d_endpwent_r_proto" in
13246         define)
13247         case "$endpwent_r_proto" in
13248         ''|0) try='int endpwent_r(FILE**);'
13249         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13250         esac
13251         case "$endpwent_r_proto" in
13252         ''|0) try='void endpwent_r(FILE**);'
13253         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13254         esac
13255         case "$endpwent_r_proto" in
13256         ''|0)   d_endpwent_r=undef
13257                 endpwent_r_proto=0
13258                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13259         * )     case "$endpwent_r_proto" in
13260                 REENTRANT_PROTO*) ;;
13261                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13262                 esac
13263                 echo "Prototype: $try" ;;
13264         esac
13265         ;;
13266         *)      case "$usethreads" in
13267                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13268                 esac
13269                 d_endpwent_r=undef
13270                 endpwent_r_proto=0
13271                 ;;
13272         esac
13273         ;;
13274 *)      endpwent_r_proto=0
13275         ;;
13276 esac
13277
13278 : see if endservent exists
13279 set endservent d_endsent
13280 eval $inlibc
13281
13282 : see if endservent_r exists
13283 set endservent_r d_endservent_r
13284 eval $inlibc
13285 case "$d_endservent_r" in
13286 "$define")
13287         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13288         case "$d_endservent_r_proto:$usethreads" in
13289         ":define")      d_endservent_r_proto=define
13290                 set d_endservent_r_proto endservent_r $hdrs
13291                 eval $hasproto ;;
13292         *)      ;;
13293         esac
13294         case "$d_endservent_r_proto" in
13295         define)
13296         case "$endservent_r_proto" in
13297         ''|0) try='int endservent_r(struct servent_data*);'
13298         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13299         esac
13300         case "$endservent_r_proto" in
13301         ''|0) try='void endservent_r(struct servent_data*);'
13302         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13303         esac
13304         case "$endservent_r_proto" in
13305         ''|0)   d_endservent_r=undef
13306                 endservent_r_proto=0
13307                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13308         * )     case "$endservent_r_proto" in
13309                 REENTRANT_PROTO*) ;;
13310                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13311                 esac
13312                 echo "Prototype: $try" ;;
13313         esac
13314         ;;
13315         *)      case "$usethreads" in
13316                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13317                 esac
13318                 d_endservent_r=undef
13319                 endservent_r_proto=0
13320                 ;;
13321         esac
13322         ;;
13323 *)      endservent_r_proto=0
13324         ;;
13325 esac
13326
13327 : Locate the flags for 'open()'
13328 echo " "
13329 $cat >try.c <<EOCP
13330 #include <sys/types.h>
13331 #ifdef I_FCNTL
13332 #include <fcntl.h>
13333 #endif
13334 #ifdef I_SYS_FILE
13335 #include <sys/file.h>
13336 #endif
13337 #$i_stdlib I_STDLIB
13338 #ifdef I_STDLIB
13339 #include <stdlib.h>
13340 #endif
13341 int main() {
13342         if(O_RDONLY);
13343 #ifdef O_TRUNC
13344         exit(0);
13345 #else
13346         exit(1);
13347 #endif
13348 }
13349 EOCP
13350 : check sys/file.h first to get FREAD on Sun
13351 if $test `./findhdr sys/file.h` && \
13352                 set try -DI_SYS_FILE && eval $compile; then
13353         h_sysfile=true;
13354         echo "<sys/file.h> defines the O_* constants..." >&4
13355         if $run ./try; then
13356                 echo "and you have the 3 argument form of open()." >&4
13357                 val="$define"
13358         else
13359                 echo "but not the 3 argument form of open().  Oh, well." >&4
13360                 val="$undef"
13361         fi
13362 elif $test `./findhdr fcntl.h` && \
13363                 set try -DI_FCNTL && eval $compile; then
13364         h_fcntl=true;
13365         echo "<fcntl.h> defines the O_* constants..." >&4
13366         if $run ./try; then
13367                 echo "and you have the 3 argument form of open()." >&4
13368                 val="$define"
13369         else
13370                 echo "but not the 3 argument form of open().  Oh, well." >&4
13371                 val="$undef"
13372         fi
13373 else
13374         val="$undef"
13375         echo "I can't find the O_* constant definitions!  You got problems." >&4
13376 fi
13377 set d_open3
13378 eval $setvar
13379 $rm_try
13380
13381 : see if this is a sys/file.h system
13382 val=''
13383 set sys/file.h val
13384 eval $inhdr
13385
13386 : do we need to include sys/file.h ?
13387 case "$val" in
13388 "$define")
13389         echo " "
13390         if $h_sysfile; then
13391                 val="$define"
13392                 echo "We'll be including <sys/file.h>." >&4
13393         else
13394                 val="$undef"
13395                 echo "We won't be including <sys/file.h>." >&4
13396         fi
13397         ;;
13398 *)
13399         h_sysfile=false
13400         ;;
13401 esac
13402 set i_sysfile
13403 eval $setvar
13404
13405 : see if fcntl.h is there
13406 val=''
13407 set fcntl.h val
13408 eval $inhdr
13409
13410 : see if we can include fcntl.h
13411 case "$val" in
13412 "$define")
13413         echo " "
13414         if $h_fcntl; then
13415                 val="$define"
13416                 echo "We'll be including <fcntl.h>." >&4
13417         else
13418                 val="$undef"
13419                 if $h_sysfile; then
13420         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13421                 else
13422                         echo "We won't be including <fcntl.h>." >&4
13423                 fi
13424         fi
13425         ;;
13426 *)
13427         h_fcntl=false
13428         val="$undef"
13429         ;;
13430 esac
13431 set i_fcntl
13432 eval $setvar
13433
13434 : see if fork exists
13435 set fork d_fork
13436 eval $inlibc
13437
13438 : see if pipe exists
13439 set pipe d_pipe
13440 eval $inlibc
13441
13442 : check for non-blocking I/O stuff
13443 case "$h_sysfile" in
13444 true) echo "#include <sys/file.h>" > head.c;;
13445 *)
13446        case "$h_fcntl" in
13447        true) echo "#include <fcntl.h>" > head.c;;
13448        *) echo "#include <sys/fcntl.h>" > head.c;;
13449        esac
13450        ;;
13451 esac
13452 echo " "
13453 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13454 case "$o_nonblock" in
13455 '')
13456         $cat head.c > try.c
13457         $cat >>try.c <<EOCP
13458 #include <stdio.h>
13459 #$i_stdlib I_STDLIB
13460 #ifdef I_STDLIB
13461 #include <stdlib.h>
13462 #endif
13463 #$i_fcntl I_FCNTL
13464 #ifdef I_FCNTL
13465 #include <fcntl.h>
13466 #endif
13467 int main() {
13468 #ifdef O_NONBLOCK
13469         printf("O_NONBLOCK\n");
13470         exit(0);
13471 #endif
13472 #ifdef O_NDELAY
13473         printf("O_NDELAY\n");
13474         exit(0);
13475 #endif
13476 #ifdef FNDELAY
13477         printf("FNDELAY\n");
13478         exit(0);
13479 #endif
13480         exit(0);
13481 }
13482 EOCP
13483         set try
13484         if eval $compile_ok; then
13485                 o_nonblock=`$run ./try`
13486                 case "$o_nonblock" in
13487                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13488                 *) echo "Seems like we can use $o_nonblock.";;
13489                 esac
13490         else
13491                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13492         fi
13493         ;;
13494 *) echo "Using $hint value $o_nonblock.";;
13495 esac
13496 $rm_try
13497
13498 echo " "
13499 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13500 case "$eagain" in
13501 '')
13502         case "$d_fork:$d_pipe:$d_alarm" in
13503         define:define:define)
13504         $cat head.c > try.c
13505         $cat >>try.c <<EOCP
13506 #include <errno.h>
13507 #include <sys/types.h>
13508 #include <signal.h>
13509 #include <stdio.h>
13510 #$i_stdlib I_STDLIB
13511 #ifdef I_STDLIB
13512 #include <stdlib.h>
13513 #endif
13514 #$i_fcntl I_FCNTL
13515 #ifdef I_FCNTL
13516 #include <fcntl.h>
13517 #endif
13518 #define MY_O_NONBLOCK $o_nonblock
13519 #ifndef errno  /* XXX need better Configure test */
13520 extern int errno;
13521 #endif
13522 #$i_unistd I_UNISTD
13523 #ifdef I_UNISTD
13524 #include <unistd.h>
13525 #endif
13526 #$i_string I_STRING
13527 #ifdef I_STRING
13528 #include <string.h>
13529 #else
13530 #include <strings.h>
13531 #endif
13532 $signal_t blech(int x) { exit(3); }
13533 EOCP
13534         $cat >> try.c <<'EOCP'
13535 int main()
13536 {
13537         int pd[2];
13538         int pu[2];
13539         char buf[1];
13540         char string[100];
13541         int ret;
13542
13543         ret = pipe(pd); /* Down: child -> parent */
13544         if (ret != 0)
13545                 exit(3);
13546         ret = pipe(pu); /* Up: parent -> child */
13547         if (ret != 0)
13548                 exit(3);
13549         if (0 != fork()) {
13550                 close(pd[1]);   /* Parent reads from pd[0] */
13551                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13552 #ifdef F_SETFL
13553                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13554                         exit(1);
13555 #else
13556                 exit(4);
13557 #endif
13558                 signal(SIGALRM, blech);
13559                 alarm(5);
13560                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13561                         exit(2);
13562                 sprintf(string, "%d\n", ret);
13563                 ret = write(2, string, strlen(string));
13564                 if (ret != strlen(string))
13565                         exit(3);
13566                 alarm(0);
13567 #ifdef EAGAIN
13568                 if (errno == EAGAIN) {
13569                         printf("EAGAIN\n");
13570                         goto ok;
13571                 }
13572 #endif
13573 #ifdef EWOULDBLOCK
13574                 if (errno == EWOULDBLOCK)
13575                         printf("EWOULDBLOCK\n");
13576 #endif
13577         ok:
13578                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13579                 if (ret != 1)
13580                         exit(3);
13581                 sleep(2);                               /* Give it time to close our pipe */
13582                 alarm(5);
13583                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13584                 alarm(0);
13585                 sprintf(string, "%d\n", ret);
13586                 ret = write(4, string, strlen(string));
13587                 if (ret != strlen(string))
13588                         exit(3);
13589                 exit(0);
13590         }
13591
13592         close(pd[0]);                   /* We write to pd[1] */
13593         close(pu[1]);                   /* We read from pu[0] */
13594         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13595         if (ret != 1)
13596                 exit(3);
13597         close(pd[1]);                   /* Pipe pd is now fully closed! */
13598         exit(0);                                /* Bye bye, thank you for playing! */
13599 }
13600 EOCP
13601         set try
13602         if eval $compile_ok; then
13603                 echo "$startsh" >mtry
13604                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13605                 chmod +x mtry
13606                 $run ./mtry >/dev/null 2>&1
13607                 case $? in
13608                 0) eagain=`$cat try.out`;;
13609                 1) echo "Could not perform non-blocking setting!";;
13610                 2) echo "I did a successful read() for something that was not there!";;
13611                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13612                 4) echo "Could not find F_SETFL!";;
13613                 *) echo "Something terribly wrong happened during testing.";;
13614                 esac
13615                 rd_nodata=`$cat try.ret`
13616                 echo "A read() system call with no data present returns $rd_nodata."
13617                 case "$rd_nodata" in
13618                 0|-1) ;;
13619                 *)
13620                         echo "(That's peculiar, fixing that to be -1.)"
13621                         rd_nodata=-1
13622                         ;;
13623                 esac
13624                 case "$eagain" in
13625                 '')
13626                         echo "Forcing errno EAGAIN on read() with no data available."
13627                         eagain=EAGAIN
13628                         ;;
13629                 *)
13630                         echo "Your read() sets errno to $eagain when no data is available."
13631                         ;;
13632                 esac
13633                 status=`$cat try.err`
13634                 case "$status" in
13635                 0) echo "And it correctly returns 0 to signal EOF.";;
13636                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13637                 *) echo "However, your read() returns '$status' on EOF??";;
13638                 esac
13639                 val="$define"
13640                 if test "$status" = "$rd_nodata"; then
13641                         echo "WARNING: you can't distinguish between EOF and no data!"
13642                         val="$undef"
13643                 fi
13644         else
13645                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13646                 eagain=EAGAIN
13647         fi
13648         ;;
13649         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13650                 eagain=EAGAIN
13651                 val="$define"
13652                 ;;
13653         esac
13654         set d_eofnblk
13655         eval $setvar
13656         ;;
13657 *)
13658         echo "Using $hint value $eagain."
13659         echo "Your read() returns $rd_nodata when no data is present."
13660         case "$d_eofnblk" in
13661         "$define") echo "And you can see EOF because read() returns 0.";;
13662         "$undef") echo "But you can't see EOF status from read() returned value.";;
13663         *)
13664                 echo "(Assuming you can't see EOF status from read anyway.)"
13665                 d_eofnblk=$undef
13666                 ;;
13667         esac
13668         ;;
13669 esac
13670 $rm_try head.c mtry
13671
13672 : see if erf exists
13673 set erf d_erf
13674 eval $inlibc
13675
13676 : see if erfc exists
13677 set erfc d_erfc
13678 eval $inlibc
13679
13680 : see if exp2 exists
13681 set exp2 d_exp2
13682 eval $inlibc
13683
13684 : see if expm1 exists
13685 set expm1 d_expm1
13686 eval $inlibc
13687
13688 : see if _ptr and _cnt from stdio act std
13689 echo " "
13690
13691 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13692         echo "(Looks like you have stdio.h from BSD.)"
13693         case "$stdio_ptr" in
13694         '') stdio_ptr='((fp)->_p)'
13695                 ptr_lval=$define
13696                 ;;
13697         *)      ptr_lval=$d_stdio_ptr_lval;;
13698         esac
13699         case "$stdio_cnt" in
13700         '') stdio_cnt='((fp)->_r)'
13701                 cnt_lval=$define
13702                 ;;
13703         *)      cnt_lval=$d_stdio_cnt_lval;;
13704         esac
13705         case "$stdio_base" in
13706         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13707         esac
13708         case "$stdio_bufsiz" in
13709         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13710         esac
13711 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13712         echo "(Looks like you have stdio.h from Linux.)"
13713         case "$stdio_ptr" in
13714         '') stdio_ptr='((fp)->_IO_read_ptr)'
13715                 ptr_lval=$define
13716                 ;;
13717         *)      ptr_lval=$d_stdio_ptr_lval;;
13718         esac
13719         case "$stdio_cnt" in
13720         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13721                 cnt_lval=$undef
13722                 ;;
13723         *)      cnt_lval=$d_stdio_cnt_lval;;
13724         esac
13725         case "$stdio_base" in
13726         '') stdio_base='((fp)->_IO_read_base)';;
13727         esac
13728         case "$stdio_bufsiz" in
13729         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13730         esac
13731 else
13732         case "$stdio_ptr" in
13733         '') stdio_ptr='((fp)->_ptr)'
13734                 ptr_lval=$define
13735                 ;;
13736         *)      ptr_lval=$d_stdio_ptr_lval;;
13737         esac
13738         case "$stdio_cnt" in
13739         '') stdio_cnt='((fp)->_cnt)'
13740                 cnt_lval=$define
13741                 ;;
13742         *)      cnt_lval=$d_stdio_cnt_lval;;
13743         esac
13744         case "$stdio_base" in
13745         '') stdio_base='((fp)->_base)';;
13746         esac
13747         case "$stdio_bufsiz" in
13748         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13749         esac
13750 fi
13751
13752 : test whether _ptr and _cnt really work
13753 echo "Checking how std your stdio is..." >&4
13754 $cat >try.c <<EOP
13755 #include <stdio.h>
13756 #$i_stdlib I_STDLIB
13757 #ifdef I_STDLIB
13758 #include <stdlib.h>
13759 #endif
13760 #define FILE_ptr(fp)    $stdio_ptr
13761 #define FILE_cnt(fp)    $stdio_cnt
13762 int main() {
13763         FILE *fp = fopen("try.c", "r");
13764         char c = getc(fp);
13765         if (
13766                 18 <= FILE_cnt(fp) &&
13767                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13768         )
13769                 exit(0);
13770         exit(1);
13771 }
13772 EOP
13773 val="$undef"
13774 set try
13775 if eval $compile && $to try.c; then
13776         if $run ./try; then
13777                 echo "Your stdio acts pretty std."
13778                 val="$define"
13779         else
13780                 echo "Your stdio isn't very std."
13781         fi
13782 else
13783         echo "Your stdio doesn't appear very std."
13784 fi
13785 $rm_try
13786
13787 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13788 # direct buffer manipulation no longer works.  The Configure tests
13789 # should be changed to correctly detect this, but until then,
13790 # the following check should at least let perl compile and run.
13791 # (This quick fix should be updated before 5.8.1.)
13792 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13793 # A. Dougherty, June 3, 2002.
13794 case "$d_gnulibc" in
13795 $define)
13796         case "$gnulibc_version" in
13797         2.[01]*)  ;;
13798         2.2) ;;
13799         2.2.[0-9]) ;;
13800         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13801                 val="$undef"
13802                 ;;
13803         esac
13804         ;;
13805 esac
13806 set d_stdstdio
13807 eval $setvar
13808
13809 : Can _ptr be used as an lvalue?
13810 case "$d_stdstdio$ptr_lval" in
13811 $define$define) val=$define ;;
13812 *) val=$undef ;;
13813 esac
13814 set d_stdio_ptr_lval
13815 eval $setvar
13816
13817 : Can _cnt be used as an lvalue?
13818 case "$d_stdstdio$cnt_lval" in
13819 $define$define) val=$define ;;
13820 *) val=$undef ;;
13821 esac
13822 set d_stdio_cnt_lval
13823 eval $setvar
13824
13825
13826 : test whether setting _ptr sets _cnt as a side effect
13827 d_stdio_ptr_lval_sets_cnt="$undef"
13828 d_stdio_ptr_lval_nochange_cnt="$undef"
13829 case "$d_stdio_ptr_lval$d_stdstdio" in
13830 $define$define)
13831         echo "Checking to see what happens if we set the stdio ptr..." >&4
13832 $cat >try.c <<EOP
13833 #include <stdio.h>
13834 /* Can we scream? */
13835 /* Eat dust sed :-) */
13836 /* In the buffer space, no one can hear you scream. */
13837 #$i_stdlib I_STDLIB
13838 #ifdef I_STDLIB
13839 #include <stdlib.h>
13840 #endif
13841 #define FILE_ptr(fp)    $stdio_ptr
13842 #define FILE_cnt(fp)    $stdio_cnt
13843 #include <sys/types.h>
13844 int main() {
13845         FILE *fp = fopen("try.c", "r");
13846         int c;
13847         char *ptr;
13848         size_t cnt;
13849         if (!fp) {
13850             puts("Fail even to read");
13851             exit(1);
13852         }
13853         c = getc(fp); /* Read away the first # */
13854         if (c == EOF) {
13855             puts("Fail even to read");
13856             exit(1);
13857         }
13858         if (!(
13859                 18 <= FILE_cnt(fp) &&
13860                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13861         )) {
13862                 puts("Fail even to read");
13863                 exit (1);
13864         }
13865         ptr = (char*) FILE_ptr(fp);
13866         cnt = (size_t)FILE_cnt(fp);
13867
13868         FILE_ptr(fp) += 42;
13869
13870         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13871                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13872                 exit (1);
13873         }
13874         if (FILE_cnt(fp) <= 20) {
13875                 printf ("Fail (<20 chars to test)");
13876                 exit (1);
13877         }
13878         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13879                 puts("Fail compare");
13880                 exit (1);
13881         }
13882         if (cnt == FILE_cnt(fp)) {
13883                 puts("Pass_unchanged");
13884                 exit (0);
13885         }
13886         if (FILE_cnt(fp) == (cnt - 42)) {
13887                 puts("Pass_changed");
13888                 exit (0);
13889         }
13890         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13891         return 1;
13892
13893 }
13894 EOP
13895         set try
13896         if eval $compile && $to try.c; then
13897                 case `$run ./try` in
13898                 Pass_changed)
13899                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13900                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13901                 Pass_unchanged)
13902                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13903                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13904                 Fail*)
13905                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13906                 *)
13907                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13908         esac
13909         else
13910                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13911         fi
13912         $rm_try
13913         ;;
13914 esac
13915
13916 : see if _base is also standard
13917 val="$undef"
13918 case "$d_stdstdio" in
13919 $define)
13920         $cat >try.c <<EOP
13921 #include <stdio.h>
13922 #$i_stdlib I_STDLIB
13923 #ifdef I_STDLIB
13924 #include <stdlib.h>
13925 #endif
13926 #define FILE_base(fp)   $stdio_base
13927 #define FILE_bufsiz(fp) $stdio_bufsiz
13928 int main() {
13929         FILE *fp = fopen("try.c", "r");
13930         char c = getc(fp);
13931         if (
13932                 19 <= FILE_bufsiz(fp) &&
13933                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13934         )
13935                 exit(0);
13936         exit(1);
13937 }
13938 EOP
13939         set try
13940         if eval $compile && $to try.c; then
13941                 if $run ./try; then
13942                         echo "And its _base field acts std."
13943                         val="$define"
13944                 else
13945                         echo "But its _base field isn't std."
13946                 fi
13947         else
13948                 echo "However, it seems to be lacking the _base field."
13949         fi
13950         $rm_try
13951         ;;
13952 esac
13953 set d_stdiobase
13954 eval $setvar
13955
13956 : see if fast_stdio exists
13957 val="$undef"
13958 case "$d_stdstdio:$d_stdio_ptr_lval" in
13959 "$define:$define")
13960         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13961         *$define*)
13962                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13963                 val="$define"
13964                 ;;
13965         esac
13966         ;;
13967 esac
13968 set d_faststdio
13969 eval $setvar
13970
13971
13972
13973 : see if fchdir exists
13974 set fchdir d_fchdir
13975 eval $inlibc
13976
13977 : see if fchmod exists
13978 set fchmod d_fchmod
13979 eval $inlibc
13980
13981 : see if fchown exists
13982 set fchown d_fchown
13983 eval $inlibc
13984
13985 : see if this is an fcntl system
13986 set fcntl d_fcntl
13987 eval $inlibc
13988
13989 : See if fcntl-based locking works.
13990 echo " "
13991 $cat >try.c <<EOCP
13992 #$i_stdlib I_STDLIB
13993 #ifdef I_STDLIB
13994 #include <stdlib.h>
13995 #endif
13996 #include <unistd.h>
13997 #include <fcntl.h>
13998 #include <signal.h>
13999 $signal_t blech(int x) { exit(3); }
14000 int main() {
14001 #if defined(F_SETLK) && defined(F_SETLKW)
14002      struct flock flock;
14003      int retval, fd;
14004      fd = open("try.c", O_RDONLY);
14005      flock.l_type = F_RDLCK;
14006      flock.l_whence = SEEK_SET;
14007      flock.l_start = flock.l_len = 0;
14008      signal(SIGALRM, blech);
14009      alarm(10);
14010      retval = fcntl(fd, F_SETLK, &flock);
14011      close(fd);
14012      (retval < 0 ? exit(2) : exit(0));
14013 #else
14014      exit(2);
14015 #endif
14016 }
14017 EOCP
14018 echo "Checking if fcntl-based file locking works... "
14019 case "$d_fcntl" in
14020 "$define")
14021         set try
14022         if eval $compile_ok; then
14023                 if $run ./try; then
14024                         echo "Yes, it seems to work."
14025                         val="$define"
14026                 else
14027                         echo "Nope, it didn't work."
14028                         val="$undef"
14029                         case "$?" in
14030                         3) $cat >&4 <<EOM
14031 ***
14032 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
14033 *** This is (almost) impossible.
14034 *** If your NFS lock daemons are not feeling well, something like
14035 *** this may happen, please investigate.  Cannot continue, aborting.
14036 ***
14037 EOM
14038                                 exit 1
14039                                 ;;
14040                         esac
14041                 fi
14042         else
14043                 echo "I'm unable to compile the test program, so I'll assume not."
14044                 val="$undef"
14045         fi
14046         ;;
14047 *) val="$undef";
14048         echo "Nope, since you don't even have fcntl()."
14049         ;;
14050 esac
14051 set d_fcntl_can_lock
14052 eval $setvar
14053 $rm_try
14054
14055 : check for fd_set items
14056 $cat <<EOM
14057
14058 Checking to see how well your C compiler handles fd_set and friends ...
14059 EOM
14060 $cat >try.c <<EOCP
14061 #$i_stdlib I_STDLIB
14062 #ifdef I_STDLIB
14063 #include <stdlib.h>
14064 #endif
14065 #$i_systime I_SYS_TIME
14066 #$i_sysselct I_SYS_SELECT
14067 #$d_socket HAS_SOCKET
14068 #include <sys/types.h>
14069 #ifdef HAS_SOCKET
14070 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14071 #endif
14072 #ifdef I_SYS_TIME
14073 #include <sys/time.h>
14074 #endif
14075 #ifdef I_SYS_SELECT
14076 #include <sys/select.h>
14077 #endif
14078 int main() {
14079         fd_set fds;
14080
14081 #ifdef TRYBITS
14082         if(fds.fds_bits);
14083 #endif
14084
14085 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
14086         exit(0);
14087 #else
14088         exit(1);
14089 #endif
14090 }
14091 EOCP
14092 set try -DTRYBITS
14093 if eval $compile; then
14094         d_fds_bits="$define"
14095         d_fd_set="$define"
14096         echo "Well, your system knows about the normal fd_set typedef..." >&4
14097         if $run ./try; then
14098                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
14099                 d_fd_macros="$define"
14100         else
14101                 $cat >&4 <<'EOM'
14102 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
14103 EOM
14104                 d_fd_macros="$undef"
14105         fi
14106 else
14107         $cat <<'EOM'
14108 Hmm, your compiler has some difficulty with fd_set.  Checking further...
14109 EOM
14110         set try
14111         if eval $compile; then
14112                 d_fds_bits="$undef"
14113                 d_fd_set="$define"
14114                 echo "Well, your system has some sort of fd_set available..." >&4
14115                 if $run ./try; then
14116                         echo "and you have the normal fd_set macros." >&4
14117                         d_fd_macros="$define"
14118                 else
14119                         $cat <<'EOM'
14120 but not the normal fd_set macros!  Gross!  More work for me...
14121 EOM
14122                         d_fd_macros="$undef"
14123                 fi
14124         else
14125         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
14126                 d_fd_set="$undef"
14127                 d_fds_bits="$undef"
14128                 d_fd_macros="$undef"
14129         fi
14130 fi
14131 $rm_try
14132
14133 : see if fdclose exists
14134 set fdclose d_fdclose
14135 eval $inlibc
14136
14137 : see if fdim exists
14138 set fdim d_fdim
14139 eval $inlibc
14140
14141 : see if fegetround exists
14142 set fegetround d_fegetround
14143 eval $inlibc
14144
14145 : see if fgetpos exists
14146 set fgetpos d_fgetpos
14147 eval $inlibc
14148
14149 : see if finite exists
14150 set finite d_finite
14151 eval $inlibc
14152
14153 : see if finitel exists
14154 set finitel d_finitel
14155 eval $inlibc
14156
14157 : see if flock exists
14158 set flock d_flock
14159 eval $inlibc
14160
14161 : see if prototype for flock is available
14162 echo " "
14163 set d_flockproto flock $i_sysfile sys/file.h
14164 eval $hasproto
14165
14166 : see if fma exists
14167 set fma d_fma
14168 eval $inlibc
14169
14170 : see if fmax exists
14171 set fmax d_fmax
14172 eval $inlibc
14173
14174 : see if fmin exists
14175 set fmin d_fmin
14176 eval $inlibc
14177
14178 : see if fp_class exists
14179 set fp_class d_fp_class
14180 eval $inlibc
14181
14182 : see if this is a math.h system
14183 set math.h i_math
14184 eval $inhdr
14185
14186 : check for fpclassify
14187 echo "Checking to see if you have fpclassify..." >&4
14188 $cat >try.c <<EOCP
14189 #$i_math I_MATH
14190 #ifdef I_MATH
14191 #include <math.h>
14192 #endif
14193 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
14194 EOCP
14195 set try
14196 if eval $compile; then
14197         val="$define"
14198         echo "You have fpclassify."
14199 else
14200         val="$undef"
14201         echo "You do not have fpclassify."
14202 fi
14203 $rm_try
14204 set d_fpclassify
14205 eval $setvar
14206
14207 : see if fp_classify exists
14208 set fp_classify d_fp_classify
14209 eval $inlibc
14210
14211 : see if fp_classl exists
14212 set fp_classl d_fp_classl
14213 eval $inlibc
14214
14215 : see if pathconf exists
14216 set pathconf d_pathconf
14217 eval $inlibc
14218
14219 : see if fpathconf exists
14220 set fpathconf d_fpathconf
14221 eval $inlibc
14222
14223 : see if fpclass exists
14224 set fpclass d_fpclass
14225 eval $inlibc
14226
14227 : see if fpclassl exists
14228 set fpclassl d_fpclassl
14229 eval $inlibc
14230
14231 : see if fpgetround exists
14232 set fpgetround d_fpgetround
14233 eval $inlibc
14234
14235 : check for fpos64_t
14236 echo " "
14237 echo "Checking to see if you have fpos64_t..." >&4
14238 $cat >try.c <<EOCP
14239 #include <stdio.h>
14240 int main() { fpos64_t x = 7; }
14241 EOCP
14242 set try
14243 if eval $compile; then
14244         val="$define"
14245         echo "You have fpos64_t."
14246 else
14247         val="$undef"
14248         echo "You do not have fpos64_t."
14249         case "$fpossize" in
14250         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14251         esac
14252 fi
14253 $rm_try
14254 set d_fpos64_t
14255 eval $setvar
14256
14257 : see if this is an xlocale.h system
14258 set xlocale.h i_xlocale
14259 eval $inhdr
14260
14261 : see if newlocale exists
14262 set newlocale d_newlocale
14263 eval $inlibc
14264
14265 : see if freelocale exists
14266 set freelocale d_freelocale
14267 eval $inlibc
14268
14269 : see if uselocale exists
14270 set uselocale d_uselocale
14271 eval $inlibc
14272
14273 : see if duplocale exists
14274 set duplocale d_duplocale
14275 eval $inlibc
14276
14277 : see if querylocale exists
14278 set querylocale d_querylocale
14279 eval $inlibc
14280
14281 : see if frexpl exists
14282 set frexpl d_frexpl
14283 eval $inlibc
14284
14285 : see if this is a sys/param system
14286 set sys/param.h i_sysparam
14287 eval $inhdr
14288
14289 : see if this is a sys/mount.h system
14290 set sys/mount.h i_sysmount
14291 eval $inhdr
14292
14293 : Check for fs_data_s
14294 echo " "
14295 echo "Checking to see if your system supports struct fs_data..." >&4
14296 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14297 eval $hasstruct
14298 case "$d_fs_data_s" in
14299 "$define")      echo "Yes, it does."   ;;
14300 *)              echo "No, it doesn't." ;;
14301 esac
14302
14303 : see if fseeko exists
14304 set fseeko d_fseeko
14305 eval $inlibc
14306 case "$longsize" in
14307 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14308 esac
14309
14310 : see if fsetpos exists
14311 set fsetpos d_fsetpos
14312 eval $inlibc
14313
14314 : see if fstatfs exists
14315 set fstatfs d_fstatfs
14316 eval $inlibc
14317
14318 : see if statvfs exists
14319 set statvfs d_statvfs
14320 eval $inlibc
14321
14322 : see if fstatvfs exists
14323 set fstatvfs d_fstatvfs
14324 eval $inlibc
14325
14326
14327 : see if fsync exists
14328 set fsync d_fsync
14329 eval $inlibc
14330
14331 : see if ftello exists
14332 set ftello d_ftello
14333 eval $inlibc
14334 case "$longsize" in
14335 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14336 esac
14337
14338 : check for a working futimes
14339 d_futimes="$undef"
14340 echo " "
14341 echo "Checking if you have a working futimes()" >&4
14342 $cat >try.c <<EOCP
14343 #include <stdio.h>
14344 #include <sys/time.h>
14345 #include <errno.h>
14346 #include <fcntl.h>
14347
14348 int main ()
14349 {
14350     int fd, rv;
14351     fd = open ("try.c", O_RDWR);
14352     if (-1 == fd) exit (1);
14353     rv = futimes (fd, NULL);
14354     exit (rv == -1 ? errno : 0);
14355 }
14356 EOCP
14357 set try
14358 if eval $compile; then
14359     `$run ./try`
14360     rc=$?
14361     case "$rc" in
14362         0)  echo "Yes, you have" >&4
14363             d_futimes="$define"
14364             ;;
14365         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14366             ;;
14367     esac
14368 else
14369     echo "No, it does not (probably harmless)" >&4
14370 fi
14371 $rm_try
14372
14373 : look for gai_strerror
14374 echo " "
14375 $cat >try.c <<'EOCP'
14376 #include <sys/types.h>
14377 #include <sys/socket.h>
14378 #include <netdb.h>
14379 int main ()
14380 {
14381     return (gai_strerror (0) ? 0 : 1);
14382     }
14383 EOCP
14384 set try
14385 val="$undef"
14386 if eval $compile; then
14387     `$run ./try`
14388     case "$?" in
14389         0)  echo "A working gai_strerror() found." >&4
14390             val="$define" ;;
14391         *)  echo "gai_strerror() found, but it doesn't work" >&4
14392             ;;
14393         esac
14394 else
14395     echo "gai_strerror() NOT found." >&4
14396     fi
14397 set d_gai_strerror
14398 eval $setvar
14399 $rm_try
14400
14401 : see if ndbm.h is available
14402 set ndbm.h i_ndbm
14403 eval $inhdr
14404 : Compatibility location for RedHat 7.1
14405 set gdbm/ndbm.h i_gdbmndbm
14406 eval $inhdr
14407 : Compatibility location for Debian 4.0
14408 set gdbm-ndbm.h i_gdbm_ndbm
14409 eval $inhdr
14410
14411 val="$undef"
14412 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14413         : see if dbm_open exists
14414         set dbm_open d_dbm_open
14415         eval $inlibc
14416         case "$d_dbm_open" in
14417         $undef)
14418                 i_ndbm="$undef"
14419                 i_gdbmndbm="$undef"
14420                 i_gdbm_ndbm="$undef"
14421                 echo "We won't be including <ndbm.h>"
14422                 val="$undef"
14423                 ;;
14424         *) val="$define"
14425            ;;
14426         esac
14427 fi
14428 set d_ndbm
14429 eval $setvar
14430
14431 ndbm_hdr_protochk='name=$1; hdr=$2;
14432 eval "ihdr=\$""i_$name";
14433 val="$undef";
14434 if $test "$ihdr" = "$define"; then
14435         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14436         case "$d_cplusplus" in
14437         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14438         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14439         esac;
14440         case "$val" in
14441         $define) $echo "Your <$hdr> seems to have prototypes";;
14442         *) $echo "Your <$hdr> does not seem to have prototypes";;
14443         esac;
14444 fi;
14445 set "d_${name}_h_uses_prototypes";
14446 eval $setvar'
14447
14448 set ndbm ndbm.h
14449 eval $ndbm_hdr_protochk
14450 set gdbmndbm gdbm/ndbm.h
14451 eval $ndbm_hdr_protochk
14452 set gdbm_ndbm gdbm-ndbm.h
14453 eval $ndbm_hdr_protochk
14454
14455 : see if getaddrinfo exists
14456 set getaddrinfo d_getaddrinfo
14457 eval $inlibc
14458
14459 : see if getcwd exists
14460 set getcwd d_getcwd
14461 eval $inlibc
14462
14463 : see if getespwnam exists
14464 set getespwnam d_getespwnam
14465 eval $inlibc
14466
14467 : see if getfsstat exists
14468 set getfsstat d_getfsstat
14469 eval $inlibc
14470
14471 : see if getgrent exists
14472 set getgrent d_getgrent
14473 eval $inlibc
14474
14475 : see if getgrent_r exists
14476 set getgrent_r d_getgrent_r
14477 eval $inlibc
14478 case "$d_getgrent_r" in
14479 "$define")
14480         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14481         case "$d_getgrent_r_proto:$usethreads" in
14482         ":define")      d_getgrent_r_proto=define
14483                 set d_getgrent_r_proto getgrent_r $hdrs
14484                 eval $hasproto ;;
14485         *)      ;;
14486         esac
14487         case "$d_getgrent_r_proto" in
14488         define)
14489         case "$getgrent_r_proto" in
14490         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14491         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14492         esac
14493         case "$getgrent_r_proto" in
14494         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14495         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14496         esac
14497         case "$getgrent_r_proto" in
14498         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14499         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14500         esac
14501         case "$getgrent_r_proto" in
14502         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14503         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14504         esac
14505         case "$getgrent_r_proto" in
14506         ''|0) try='int getgrent_r(struct group*, char*, int);'
14507         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14508         esac
14509         case "$getgrent_r_proto" in
14510         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14511         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14512         esac
14513         case "$getgrent_r_proto" in
14514         ''|0)   d_getgrent_r=undef
14515                 getgrent_r_proto=0
14516                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14517         * )     case "$getgrent_r_proto" in
14518                 REENTRANT_PROTO*) ;;
14519                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14520                 esac
14521                 echo "Prototype: $try" ;;
14522         esac
14523         ;;
14524         *)      case "$usethreads" in
14525                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14526                 esac
14527                 d_getgrent_r=undef
14528                 getgrent_r_proto=0
14529                 ;;
14530         esac
14531         ;;
14532 *)      getgrent_r_proto=0
14533         ;;
14534 esac
14535
14536 : see if getgrgid_r exists
14537 set getgrgid_r d_getgrgid_r
14538 eval $inlibc
14539 case "$d_getgrgid_r" in
14540 "$define")
14541         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14542         case "$d_getgrgid_r_proto:$usethreads" in
14543         ":define")      d_getgrgid_r_proto=define
14544                 set d_getgrgid_r_proto getgrgid_r $hdrs
14545                 eval $hasproto ;;
14546         *)      ;;
14547         esac
14548         case "$d_getgrgid_r_proto" in
14549         define)
14550         case "$getgrgid_r_proto" in
14551         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14552         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14553         esac
14554         case "$getgrgid_r_proto" in
14555         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14556         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14557         esac
14558         case "$getgrgid_r_proto" in
14559         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14560         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14561         esac
14562         case "$getgrgid_r_proto" in
14563         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14564         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14565         esac
14566         case "$getgrgid_r_proto" in
14567         ''|0)   d_getgrgid_r=undef
14568                 getgrgid_r_proto=0
14569                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14570         * )     case "$getgrgid_r_proto" in
14571                 REENTRANT_PROTO*) ;;
14572                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14573                 esac
14574                 echo "Prototype: $try" ;;
14575         esac
14576         ;;
14577         *)      case "$usethreads" in
14578                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14579                 esac
14580                 d_getgrgid_r=undef
14581                 getgrgid_r_proto=0
14582                 ;;
14583         esac
14584         ;;
14585 *)      getgrgid_r_proto=0
14586         ;;
14587 esac
14588
14589 : see if getgrnam_r exists
14590 set getgrnam_r d_getgrnam_r
14591 eval $inlibc
14592 case "$d_getgrnam_r" in
14593 "$define")
14594         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14595         case "$d_getgrnam_r_proto:$usethreads" in
14596         ":define")      d_getgrnam_r_proto=define
14597                 set d_getgrnam_r_proto getgrnam_r $hdrs
14598                 eval $hasproto ;;
14599         *)      ;;
14600         esac
14601         case "$d_getgrnam_r_proto" in
14602         define)
14603         case "$getgrnam_r_proto" in
14604         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14605         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14606         esac
14607         case "$getgrnam_r_proto" in
14608         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14609         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14610         esac
14611         case "$getgrnam_r_proto" in
14612         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14613         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14614         esac
14615         case "$getgrnam_r_proto" in
14616         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14617         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14618         esac
14619         case "$getgrnam_r_proto" in
14620         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14621         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14622         esac
14623         case "$getgrnam_r_proto" in
14624         ''|0)   d_getgrnam_r=undef
14625                 getgrnam_r_proto=0
14626                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14627         * )     case "$getgrnam_r_proto" in
14628                 REENTRANT_PROTO*) ;;
14629                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14630                 esac
14631                 echo "Prototype: $try" ;;
14632         esac
14633         ;;
14634         *)      case "$usethreads" in
14635                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14636                 esac
14637                 d_getgrnam_r=undef
14638                 getgrnam_r_proto=0
14639                 ;;
14640         esac
14641         ;;
14642 *)      getgrnam_r_proto=0
14643         ;;
14644 esac
14645
14646 : see if gethostbyaddr exists
14647 set gethostbyaddr d_gethbyaddr
14648 eval $inlibc
14649
14650 : see if gethostbyname exists
14651 set gethostbyname d_gethbyname
14652 eval $inlibc
14653
14654 : see if gethostent exists
14655 set gethostent d_gethent
14656 eval $inlibc
14657
14658 : see how we will look up host name
14659 echo " "
14660 call=''
14661 if set gethostname val -f d_gethname; eval $csym; $val; then
14662         echo 'gethostname() found.' >&4
14663         d_gethname="$define"
14664         call=gethostname
14665 fi
14666 if set uname val -f d_uname; eval $csym; $val; then
14667         if ./xenix; then
14668                 $cat <<'EOM'
14669 uname() was found, but you're running xenix, and older versions of xenix
14670 have a broken uname(). If you don't really know whether your xenix is old
14671 enough to have a broken system call, use the default answer.
14672
14673 EOM
14674                 dflt=y
14675                 case "$d_uname" in
14676                 "$define") dflt=n;;
14677                 esac
14678                 rp='Is your uname() broken?'
14679                 . ./myread
14680                 case "$ans" in
14681                 n*) d_uname="$define"; call=uname;;
14682                 esac
14683         else
14684                 echo 'uname() found.' >&4
14685                 d_uname="$define"
14686                 case "$call" in
14687                 '') call=uname ;;
14688                 esac
14689         fi
14690 fi
14691 case "$d_gethname" in
14692 '') d_gethname="$undef";;
14693 esac
14694 case "$d_uname" in
14695 '') d_uname="$undef";;
14696 esac
14697 case "$d_uname$d_gethname" in
14698 *define*)
14699         dflt=n
14700         cat <<EOM
14701
14702 Every now and then someone has a $call() that lies about the hostname
14703 but can't be fixed for political or economic reasons.  If you wish, I can
14704 pretend $call() isn't there and maybe compute hostname at run-time
14705 thanks to the '$phostname' command.
14706
14707 EOM
14708         rp="Shall I ignore $call() from now on?"
14709         . ./myread
14710         case "$ans" in
14711         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14712         esac;;
14713 esac
14714 case "$phostname" in
14715 '') aphostname='';;
14716 *) case "$aphostname" in
14717         /*) ;;
14718         *) set X $phostname
14719                 shift
14720                 file=$1
14721                 shift
14722                 file=`./loc $file $file $pth`
14723                 aphostname=`echo $file $*`
14724                 ;;
14725         esac
14726         ;;
14727 esac
14728 case "$d_uname$d_gethname" in
14729 *define*) ;;
14730 *)
14731         case "$phostname" in
14732         '')
14733                 echo "There will be no way for $package to get your hostname." >&4;;
14734         *)
14735         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14736                 ;;
14737         esac;;
14738 esac
14739 case "$d_phostname" in
14740 '') d_phostname="$undef";;
14741 esac
14742
14743 : see if gethostbyaddr_r exists
14744 set gethostbyaddr_r d_gethostbyaddr_r
14745 eval $inlibc
14746 case "$d_gethostbyaddr_r" in
14747 "$define")
14748         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14749         case "$d_gethostbyaddr_r_proto:$usethreads" in
14750         ":define")      d_gethostbyaddr_r_proto=define
14751                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14752                 eval $hasproto ;;
14753         *)      ;;
14754         esac
14755         case "$d_gethostbyaddr_r_proto" in
14756         define)
14757         case "$gethostbyaddr_r_proto" in
14758         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14759         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14760         esac
14761         case "$gethostbyaddr_r_proto" in
14762         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14763         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14764         esac
14765         case "$gethostbyaddr_r_proto" in
14766         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14767         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14768         esac
14769         case "$gethostbyaddr_r_proto" in
14770         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14771         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14772         esac
14773         case "$gethostbyaddr_r_proto" in
14774         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14775         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14776         esac
14777         case "$gethostbyaddr_r_proto" in
14778         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14779         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14780         esac
14781         case "$gethostbyaddr_r_proto" in
14782         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14783         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14784         esac
14785         case "$gethostbyaddr_r_proto" in
14786         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14787         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14788         esac
14789         case "$gethostbyaddr_r_proto" in
14790         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14791         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14792         esac
14793         case "$gethostbyaddr_r_proto" in
14794         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14795         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14796         esac
14797         case "$gethostbyaddr_r_proto" in
14798         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14799         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14800         esac
14801         case "$gethostbyaddr_r_proto" in
14802         ''|0)   d_gethostbyaddr_r=undef
14803                 gethostbyaddr_r_proto=0
14804                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14805         * )     case "$gethostbyaddr_r_proto" in
14806                 REENTRANT_PROTO*) ;;
14807                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14808                 esac
14809                 echo "Prototype: $try" ;;
14810         esac
14811         ;;
14812         *)      case "$usethreads" in
14813                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14814                 esac
14815                 d_gethostbyaddr_r=undef
14816                 gethostbyaddr_r_proto=0
14817                 ;;
14818         esac
14819         ;;
14820 *)      gethostbyaddr_r_proto=0
14821         ;;
14822 esac
14823
14824 : see if gethostbyname_r exists
14825 set gethostbyname_r d_gethostbyname_r
14826 eval $inlibc
14827 case "$d_gethostbyname_r" in
14828 "$define")
14829         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14830         case "$d_gethostbyname_r_proto:$usethreads" in
14831         ":define")      d_gethostbyname_r_proto=define
14832                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14833                 eval $hasproto ;;
14834         *)      ;;
14835         esac
14836         case "$d_gethostbyname_r_proto" in
14837         define)
14838         case "$gethostbyname_r_proto" in
14839         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14840         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14841         esac
14842         case "$gethostbyname_r_proto" in
14843         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14844         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14845         esac
14846         case "$gethostbyname_r_proto" in
14847         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14848         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14849         esac
14850         case "$gethostbyname_r_proto" in
14851         ''|0)   d_gethostbyname_r=undef
14852                 gethostbyname_r_proto=0
14853                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14854         * )     case "$gethostbyname_r_proto" in
14855                 REENTRANT_PROTO*) ;;
14856                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14857                 esac
14858                 echo "Prototype: $try" ;;
14859         esac
14860         ;;
14861         *)      case "$usethreads" in
14862                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14863                 esac
14864                 d_gethostbyname_r=undef
14865                 gethostbyname_r_proto=0
14866                 ;;
14867         esac
14868         ;;
14869 *)      gethostbyname_r_proto=0
14870         ;;
14871 esac
14872
14873 : see if gethostent_r exists
14874 set gethostent_r d_gethostent_r
14875 eval $inlibc
14876 case "$d_gethostent_r" in
14877 "$define")
14878         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14879         case "$d_gethostent_r_proto:$usethreads" in
14880         ":define")      d_gethostent_r_proto=define
14881                 set d_gethostent_r_proto gethostent_r $hdrs
14882                 eval $hasproto ;;
14883         *)      ;;
14884         esac
14885         case "$d_gethostent_r_proto" in
14886         define)
14887         case "$gethostent_r_proto" in
14888         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14889         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14890         esac
14891         case "$gethostent_r_proto" in
14892         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14893         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14894         esac
14895         case "$gethostent_r_proto" in
14896         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14897         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14898         esac
14899         case "$gethostent_r_proto" in
14900         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14901         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14902         esac
14903         case "$gethostent_r_proto" in
14904         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14905         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14906         esac
14907         case "$gethostent_r_proto" in
14908         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14909         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14910         esac
14911         case "$gethostent_r_proto" in
14912         ''|0)   d_gethostent_r=undef
14913                 gethostent_r_proto=0
14914                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14915         * )     case "$gethostent_r_proto" in
14916                 REENTRANT_PROTO*) ;;
14917                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14918                 esac
14919                 echo "Prototype: $try" ;;
14920         esac
14921         ;;
14922         *)      case "$usethreads" in
14923                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14924                 esac
14925                 d_gethostent_r=undef
14926                 gethostent_r_proto=0
14927                 ;;
14928         esac
14929         ;;
14930 *)      gethostent_r_proto=0
14931         ;;
14932 esac
14933
14934 : see if prototypes for various gethostxxx netdb.h functions are available
14935 echo " "
14936 set d_gethostprotos gethostent $i_netdb netdb.h
14937 eval $hasproto
14938
14939 : see if getitimer exists
14940 set getitimer d_getitimer
14941 eval $inlibc
14942
14943 : see if getlogin exists
14944 set getlogin d_getlogin
14945 eval $inlibc
14946
14947 : see if getlogin_r exists
14948 set getlogin_r d_getlogin_r
14949 eval $inlibc
14950 case "$d_getlogin_r" in
14951 "$define")
14952         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14953         case "$d_getlogin_r_proto:$usethreads" in
14954         ":define")      d_getlogin_r_proto=define
14955                 set d_getlogin_r_proto getlogin_r $hdrs
14956                 eval $hasproto ;;
14957         *)      ;;
14958         esac
14959         case "$d_getlogin_r_proto" in
14960         define)
14961         case "$getlogin_r_proto" in
14962         ''|0) try='int getlogin_r(char*, size_t);'
14963         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14964         esac
14965         case "$getlogin_r_proto" in
14966         ''|0) try='int getlogin_r(char*, int);'
14967         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14968         esac
14969         case "$getlogin_r_proto" in
14970         ''|0) try='char* getlogin_r(char*, size_t);'
14971         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14972         esac
14973         case "$getlogin_r_proto" in
14974         ''|0) try='char* getlogin_r(char*, int);'
14975         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14976         esac
14977         case "$getlogin_r_proto" in
14978         ''|0)   d_getlogin_r=undef
14979                 getlogin_r_proto=0
14980                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14981         * )     case "$getlogin_r_proto" in
14982                 REENTRANT_PROTO*) ;;
14983                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14984                 esac
14985                 echo "Prototype: $try" ;;
14986         esac
14987         ;;
14988         *)      case "$usethreads" in
14989                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14990                 esac
14991                 d_getlogin_r=undef
14992                 getlogin_r_proto=0
14993                 ;;
14994         esac
14995         ;;
14996 *)      getlogin_r_proto=0
14997         ;;
14998 esac
14999
15000 : see if getmnt exists
15001 set getmnt d_getmnt
15002 eval $inlibc
15003
15004 : see if getmntent exists
15005 set getmntent d_getmntent
15006 eval $inlibc
15007
15008 : see if getnameinfo exists
15009 set getnameinfo d_getnameinfo
15010 eval $inlibc
15011
15012 : see if getnetbyaddr exists
15013 set getnetbyaddr d_getnbyaddr
15014 eval $inlibc
15015
15016 : see if getnetbyname exists
15017 set getnetbyname d_getnbyname
15018 eval $inlibc
15019
15020 : see if getnetent exists
15021 set getnetent d_getnent
15022 eval $inlibc
15023
15024 : see if getnetbyaddr_r exists
15025 set getnetbyaddr_r d_getnetbyaddr_r
15026 eval $inlibc
15027 case "$d_getnetbyaddr_r" in
15028 "$define")
15029         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15030         case "$d_getnetbyaddr_r_proto:$usethreads" in
15031         ":define")      d_getnetbyaddr_r_proto=define
15032                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
15033                 eval $hasproto ;;
15034         *)      ;;
15035         esac
15036         case "$d_getnetbyaddr_r_proto" in
15037         define)
15038         case "$getnetbyaddr_r_proto" in
15039         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
15040         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
15041         esac
15042         case "$getnetbyaddr_r_proto" in
15043         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
15044         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
15045         esac
15046         case "$getnetbyaddr_r_proto" in
15047         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
15048         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
15049         esac
15050         case "$getnetbyaddr_r_proto" in
15051         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
15052         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
15053         esac
15054         case "$getnetbyaddr_r_proto" in
15055         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
15056         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
15057         esac
15058         case "$getnetbyaddr_r_proto" in
15059         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
15060         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
15061         esac
15062         case "$getnetbyaddr_r_proto" in
15063         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
15064         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
15065         esac
15066         case "$getnetbyaddr_r_proto" in
15067         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
15068         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
15069         esac
15070         case "$getnetbyaddr_r_proto" in
15071         ''|0)   d_getnetbyaddr_r=undef
15072                 getnetbyaddr_r_proto=0
15073                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
15074         * )     case "$getnetbyaddr_r_proto" in
15075                 REENTRANT_PROTO*) ;;
15076                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
15077                 esac
15078                 echo "Prototype: $try" ;;
15079         esac
15080         ;;
15081         *)      case "$usethreads" in
15082                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
15083                 esac
15084                 d_getnetbyaddr_r=undef
15085                 getnetbyaddr_r_proto=0
15086                 ;;
15087         esac
15088         ;;
15089 *)      getnetbyaddr_r_proto=0
15090         ;;
15091 esac
15092
15093 : see if getnetbyname_r exists
15094 set getnetbyname_r d_getnetbyname_r
15095 eval $inlibc
15096 case "$d_getnetbyname_r" in
15097 "$define")
15098         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15099         case "$d_getnetbyname_r_proto:$usethreads" in
15100         ":define")      d_getnetbyname_r_proto=define
15101                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
15102                 eval $hasproto ;;
15103         *)      ;;
15104         esac
15105         case "$d_getnetbyname_r_proto" in
15106         define)
15107         case "$getnetbyname_r_proto" in
15108         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
15109         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
15110         esac
15111         case "$getnetbyname_r_proto" in
15112         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
15113         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
15114         esac
15115         case "$getnetbyname_r_proto" in
15116         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
15117         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
15118         esac
15119         case "$getnetbyname_r_proto" in
15120         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
15121         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
15122         esac
15123         case "$getnetbyname_r_proto" in
15124         ''|0)   d_getnetbyname_r=undef
15125                 getnetbyname_r_proto=0
15126                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
15127         * )     case "$getnetbyname_r_proto" in
15128                 REENTRANT_PROTO*) ;;
15129                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
15130                 esac
15131                 echo "Prototype: $try" ;;
15132         esac
15133         ;;
15134         *)      case "$usethreads" in
15135                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
15136                 esac
15137                 d_getnetbyname_r=undef
15138                 getnetbyname_r_proto=0
15139                 ;;
15140         esac
15141         ;;
15142 *)      getnetbyname_r_proto=0
15143         ;;
15144 esac
15145
15146 : see if getnetent_r exists
15147 set getnetent_r d_getnetent_r
15148 eval $inlibc
15149 case "$d_getnetent_r" in
15150 "$define")
15151         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15152         case "$d_getnetent_r_proto:$usethreads" in
15153         ":define")      d_getnetent_r_proto=define
15154                 set d_getnetent_r_proto getnetent_r $hdrs
15155                 eval $hasproto ;;
15156         *)      ;;
15157         esac
15158         case "$d_getnetent_r_proto" in
15159         define)
15160         case "$getnetent_r_proto" in
15161         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
15162         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
15163         esac
15164         case "$getnetent_r_proto" in
15165         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
15166         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
15167         esac
15168         case "$getnetent_r_proto" in
15169         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
15170         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
15171         esac
15172         case "$getnetent_r_proto" in
15173         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
15174         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
15175         esac
15176         case "$getnetent_r_proto" in
15177         ''|0) try='int getnetent_r(struct netent*, char*, int);'
15178         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
15179         esac
15180         case "$getnetent_r_proto" in
15181         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
15182         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
15183         esac
15184         case "$getnetent_r_proto" in
15185         ''|0)   d_getnetent_r=undef
15186                 getnetent_r_proto=0
15187                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
15188         * )     case "$getnetent_r_proto" in
15189                 REENTRANT_PROTO*) ;;
15190                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
15191                 esac
15192                 echo "Prototype: $try" ;;
15193         esac
15194         ;;
15195         *)      case "$usethreads" in
15196                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
15197                 esac
15198                 d_getnetent_r=undef
15199                 getnetent_r_proto=0
15200                 ;;
15201         esac
15202         ;;
15203 *)      getnetent_r_proto=0
15204         ;;
15205 esac
15206
15207 : see if prototypes for various getnetxxx netdb.h functions are available
15208 echo " "
15209 set d_getnetprotos getnetent $i_netdb netdb.h
15210 eval $hasproto
15211
15212 : see if getpagesize exists
15213 set getpagesize d_getpagsz
15214 eval $inlibc
15215
15216 : Optional checks for getprotobyname and getprotobynumber
15217
15218 : see if getprotobyname exists
15219 set getprotobyname d_getpbyname
15220 eval $inlibc
15221
15222 : see if getprotobynumber exists
15223 set getprotobynumber d_getpbynumber
15224 eval $inlibc
15225
15226 : see if getprotoent exists
15227 set getprotoent d_getpent
15228 eval $inlibc
15229
15230 : see if getpgid exists
15231 set getpgid d_getpgid
15232 eval $inlibc
15233
15234 : see if getpgrp2 exists
15235 set getpgrp2 d_getpgrp2
15236 eval $inlibc
15237
15238 : see if getppid exists
15239 set getppid d_getppid
15240 eval $inlibc
15241
15242 : see if getpriority exists
15243 set getpriority d_getprior
15244 eval $inlibc
15245
15246 : see if getprotobyname_r exists
15247 set getprotobyname_r d_getprotobyname_r
15248 eval $inlibc
15249 case "$d_getprotobyname_r" in
15250 "$define")
15251         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15252         case "$d_getprotobyname_r_proto:$usethreads" in
15253         ":define")      d_getprotobyname_r_proto=define
15254                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
15255                 eval $hasproto ;;
15256         *)      ;;
15257         esac
15258         case "$d_getprotobyname_r_proto" in
15259         define)
15260         case "$getprotobyname_r_proto" in
15261         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15262         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15263         esac
15264         case "$getprotobyname_r_proto" in
15265         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15266         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15267         esac
15268         case "$getprotobyname_r_proto" in
15269         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15270         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15271         esac
15272         case "$getprotobyname_r_proto" in
15273         ''|0)   d_getprotobyname_r=undef
15274                 getprotobyname_r_proto=0
15275                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15276         * )     case "$getprotobyname_r_proto" in
15277                 REENTRANT_PROTO*) ;;
15278                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15279                 esac
15280                 echo "Prototype: $try" ;;
15281         esac
15282         ;;
15283         *)      case "$usethreads" in
15284                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15285                 esac
15286                 d_getprotobyname_r=undef
15287                 getprotobyname_r_proto=0
15288                 ;;
15289         esac
15290         ;;
15291 *)      getprotobyname_r_proto=0
15292         ;;
15293 esac
15294
15295 : see if getprotobynumber_r exists
15296 set getprotobynumber_r d_getprotobynumber_r
15297 eval $inlibc
15298 case "$d_getprotobynumber_r" in
15299 "$define")
15300         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15301         case "$d_getprotobynumber_r_proto:$usethreads" in
15302         ":define")      d_getprotobynumber_r_proto=define
15303                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15304                 eval $hasproto ;;
15305         *)      ;;
15306         esac
15307         case "$d_getprotobynumber_r_proto" in
15308         define)
15309         case "$getprotobynumber_r_proto" in
15310         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15311         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15312         esac
15313         case "$getprotobynumber_r_proto" in
15314         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15315         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15316         esac
15317         case "$getprotobynumber_r_proto" in
15318         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15319         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15320         esac
15321         case "$getprotobynumber_r_proto" in
15322         ''|0)   d_getprotobynumber_r=undef
15323                 getprotobynumber_r_proto=0
15324                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15325         * )     case "$getprotobynumber_r_proto" in
15326                 REENTRANT_PROTO*) ;;
15327                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15328                 esac
15329                 echo "Prototype: $try" ;;
15330         esac
15331         ;;
15332         *)      case "$usethreads" in
15333                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15334                 esac
15335                 d_getprotobynumber_r=undef
15336                 getprotobynumber_r_proto=0
15337                 ;;
15338         esac
15339         ;;
15340 *)      getprotobynumber_r_proto=0
15341         ;;
15342 esac
15343
15344 : see if getprotoent_r exists
15345 set getprotoent_r d_getprotoent_r
15346 eval $inlibc
15347 case "$d_getprotoent_r" in
15348 "$define")
15349         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15350         case "$d_getprotoent_r_proto:$usethreads" in
15351         ":define")      d_getprotoent_r_proto=define
15352                 set d_getprotoent_r_proto getprotoent_r $hdrs
15353                 eval $hasproto ;;
15354         *)      ;;
15355         esac
15356         case "$d_getprotoent_r_proto" in
15357         define)
15358         case "$getprotoent_r_proto" in
15359         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15360         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15361         esac
15362         case "$getprotoent_r_proto" in
15363         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15364         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15365         esac
15366         case "$getprotoent_r_proto" in
15367         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15368         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15369         esac
15370         case "$getprotoent_r_proto" in
15371         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15372         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15373         esac
15374         case "$getprotoent_r_proto" in
15375         ''|0)   d_getprotoent_r=undef
15376                 getprotoent_r_proto=0
15377                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15378         * )     case "$getprotoent_r_proto" in
15379                 REENTRANT_PROTO*) ;;
15380                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15381                 esac
15382                 echo "Prototype: $try" ;;
15383         esac
15384         ;;
15385         *)      case "$usethreads" in
15386                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15387                 esac
15388                 d_getprotoent_r=undef
15389                 getprotoent_r_proto=0
15390                 ;;
15391         esac
15392         ;;
15393 *)      getprotoent_r_proto=0
15394         ;;
15395 esac
15396
15397 : see if prototypes for various getprotoxxx netdb.h functions are available
15398 echo " "
15399 set d_getprotoprotos getprotoent $i_netdb netdb.h
15400 eval $hasproto
15401
15402 : see if getprpwnam exists
15403 set getprpwnam d_getprpwnam
15404 eval $inlibc
15405
15406 : see if getpwent exists
15407 set getpwent d_getpwent
15408 eval $inlibc
15409
15410 : see if getpwent_r exists
15411 set getpwent_r d_getpwent_r
15412 eval $inlibc
15413 case "$d_getpwent_r" in
15414 "$define")
15415         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15416         case "$d_getpwent_r_proto:$usethreads" in
15417         ":define")      d_getpwent_r_proto=define
15418                 set d_getpwent_r_proto getpwent_r $hdrs
15419                 eval $hasproto ;;
15420         *)      ;;
15421         esac
15422         case "$d_getpwent_r_proto" in
15423         define)
15424         case "$getpwent_r_proto" in
15425         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15426         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15427         esac
15428         case "$getpwent_r_proto" in
15429         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15430         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15431         esac
15432         case "$getpwent_r_proto" in
15433         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15434         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15435         esac
15436         case "$getpwent_r_proto" in
15437         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15438         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15439         esac
15440         case "$getpwent_r_proto" in
15441         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15442         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15443         esac
15444         case "$getpwent_r_proto" in
15445         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15446         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15447         esac
15448         case "$getpwent_r_proto" in
15449         ''|0)   d_getpwent_r=undef
15450                 getpwent_r_proto=0
15451                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15452         * )     case "$getpwent_r_proto" in
15453                 REENTRANT_PROTO*) ;;
15454                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15455                 esac
15456                 echo "Prototype: $try" ;;
15457         esac
15458         ;;
15459         *)      case "$usethreads" in
15460                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15461                 esac
15462                 d_getpwent_r=undef
15463                 getpwent_r_proto=0
15464                 ;;
15465         esac
15466         ;;
15467 *)      getpwent_r_proto=0
15468         ;;
15469 esac
15470
15471 : see if getpwnam_r exists
15472 set getpwnam_r d_getpwnam_r
15473 eval $inlibc
15474 case "$d_getpwnam_r" in
15475 "$define")
15476         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15477         case "$d_getpwnam_r_proto:$usethreads" in
15478         ":define")      d_getpwnam_r_proto=define
15479                 set d_getpwnam_r_proto getpwnam_r $hdrs
15480                 eval $hasproto ;;
15481         *)      ;;
15482         esac
15483         case "$d_getpwnam_r_proto" in
15484         define)
15485         case "$getpwnam_r_proto" in
15486         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15487         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15488         esac
15489         case "$getpwnam_r_proto" in
15490         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15491         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15492         esac
15493         case "$getpwnam_r_proto" in
15494         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15495         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15496         esac
15497         case "$getpwnam_r_proto" in
15498         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15499         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15500         esac
15501         case "$getpwnam_r_proto" in
15502         ''|0)   d_getpwnam_r=undef
15503                 getpwnam_r_proto=0
15504                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15505         * )     case "$getpwnam_r_proto" in
15506                 REENTRANT_PROTO*) ;;
15507                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15508                 esac
15509                 echo "Prototype: $try" ;;
15510         esac
15511         ;;
15512         *)      case "$usethreads" in
15513                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15514                 esac
15515                 d_getpwnam_r=undef
15516                 getpwnam_r_proto=0
15517                 ;;
15518         esac
15519         ;;
15520 *)      getpwnam_r_proto=0
15521         ;;
15522 esac
15523
15524 : see if getpwuid_r exists
15525 set getpwuid_r d_getpwuid_r
15526 eval $inlibc
15527 case "$d_getpwuid_r" in
15528 "$define")
15529         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15530         case "$d_getpwuid_r_proto:$usethreads" in
15531         ":define")      d_getpwuid_r_proto=define
15532                 set d_getpwuid_r_proto getpwuid_r $hdrs
15533                 eval $hasproto ;;
15534         *)      ;;
15535         esac
15536         case "$d_getpwuid_r_proto" in
15537         define)
15538         case "$getpwuid_r_proto" in
15539         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15540         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15541         esac
15542         case "$getpwuid_r_proto" in
15543         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15544         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15545         esac
15546         case "$getpwuid_r_proto" in
15547         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15548         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15549         esac
15550         case "$getpwuid_r_proto" in
15551         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15552         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15553         esac
15554         case "$getpwuid_r_proto" in
15555         ''|0)   d_getpwuid_r=undef
15556                 getpwuid_r_proto=0
15557                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15558         * )     case "$getpwuid_r_proto" in
15559                 REENTRANT_PROTO*) ;;
15560                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15561                 esac
15562                 echo "Prototype: $try" ;;
15563         esac
15564         ;;
15565         *)      case "$usethreads" in
15566                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15567                 esac
15568                 d_getpwuid_r=undef
15569                 getpwuid_r_proto=0
15570                 ;;
15571         esac
15572         ;;
15573 *)      getpwuid_r_proto=0
15574         ;;
15575 esac
15576
15577 : Optional checks for getsbyname and getsbyport
15578
15579 : see if getservbyname exists
15580 set getservbyname d_getsbyname
15581 eval $inlibc
15582
15583 : see if getservbyport exists
15584 set getservbyport d_getsbyport
15585 eval $inlibc
15586
15587 : see if getservent exists
15588 set getservent d_getsent
15589 eval $inlibc
15590
15591 : see if getservbyname_r exists
15592 set getservbyname_r d_getservbyname_r
15593 eval $inlibc
15594 case "$d_getservbyname_r" in
15595 "$define")
15596         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15597         case "$d_getservbyname_r_proto:$usethreads" in
15598         ":define")      d_getservbyname_r_proto=define
15599                 set d_getservbyname_r_proto getservbyname_r $hdrs
15600                 eval $hasproto ;;
15601         *)      ;;
15602         esac
15603         case "$d_getservbyname_r_proto" in
15604         define)
15605         case "$getservbyname_r_proto" in
15606         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15607         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15608         esac
15609         case "$getservbyname_r_proto" in
15610         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15611         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15612         esac
15613         case "$getservbyname_r_proto" in
15614         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15615         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15616         esac
15617         case "$getservbyname_r_proto" in
15618         ''|0)   d_getservbyname_r=undef
15619                 getservbyname_r_proto=0
15620                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15621         * )     case "$getservbyname_r_proto" in
15622                 REENTRANT_PROTO*) ;;
15623                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15624                 esac
15625                 echo "Prototype: $try" ;;
15626         esac
15627         ;;
15628         *)      case "$usethreads" in
15629                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15630                 esac
15631                 d_getservbyname_r=undef
15632                 getservbyname_r_proto=0
15633                 ;;
15634         esac
15635         ;;
15636 *)      getservbyname_r_proto=0
15637         ;;
15638 esac
15639
15640 : see if getservbyport_r exists
15641 set getservbyport_r d_getservbyport_r
15642 eval $inlibc
15643 case "$d_getservbyport_r" in
15644 "$define")
15645         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15646         case "$d_getservbyport_r_proto:$usethreads" in
15647         ":define")      d_getservbyport_r_proto=define
15648                 set d_getservbyport_r_proto getservbyport_r $hdrs
15649                 eval $hasproto ;;
15650         *)      ;;
15651         esac
15652         case "$d_getservbyport_r_proto" in
15653         define)
15654         case "$getservbyport_r_proto" in
15655         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15656         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15657         esac
15658         case "$getservbyport_r_proto" in
15659         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15660         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15661         esac
15662         case "$getservbyport_r_proto" in
15663         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15664         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15665         esac
15666         case "$getservbyport_r_proto" in
15667         ''|0)   d_getservbyport_r=undef
15668                 getservbyport_r_proto=0
15669                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15670         * )     case "$getservbyport_r_proto" in
15671                 REENTRANT_PROTO*) ;;
15672                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15673                 esac
15674                 echo "Prototype: $try" ;;
15675         esac
15676         ;;
15677         *)      case "$usethreads" in
15678                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15679                 esac
15680                 d_getservbyport_r=undef
15681                 getservbyport_r_proto=0
15682                 ;;
15683         esac
15684         ;;
15685 *)      getservbyport_r_proto=0
15686         ;;
15687 esac
15688
15689 : see if getservent_r exists
15690 set getservent_r d_getservent_r
15691 eval $inlibc
15692 case "$d_getservent_r" in
15693 "$define")
15694         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15695         case "$d_getservent_r_proto:$usethreads" in
15696         ":define")      d_getservent_r_proto=define
15697                 set d_getservent_r_proto getservent_r $hdrs
15698                 eval $hasproto ;;
15699         *)      ;;
15700         esac
15701         case "$d_getservent_r_proto" in
15702         define)
15703         case "$getservent_r_proto" in
15704         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15705         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15706         esac
15707         case "$getservent_r_proto" in
15708         ''|0) try='int getservent_r(struct servent*, char*, int);'
15709         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15710         esac
15711         case "$getservent_r_proto" in
15712         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15713         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15714         esac
15715         case "$getservent_r_proto" in
15716         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15717         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15718         esac
15719         case "$getservent_r_proto" in
15720         ''|0)   d_getservent_r=undef
15721                 getservent_r_proto=0
15722                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15723         * )     case "$getservent_r_proto" in
15724                 REENTRANT_PROTO*) ;;
15725                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15726                 esac
15727                 echo "Prototype: $try" ;;
15728         esac
15729         ;;
15730         *)      case "$usethreads" in
15731                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15732                 esac
15733                 d_getservent_r=undef
15734                 getservent_r_proto=0
15735                 ;;
15736         esac
15737         ;;
15738 *)      getservent_r_proto=0
15739         ;;
15740 esac
15741
15742 : see if prototypes for various getservxxx netdb.h functions are available
15743 echo " "
15744 set d_getservprotos getservent $i_netdb netdb.h
15745 eval $hasproto
15746
15747 : see if getspnam exists
15748 set getspnam d_getspnam
15749 eval $inlibc
15750
15751 : see if this is a shadow.h system
15752 set shadow.h i_shadow
15753 eval $inhdr
15754
15755 : see if getspnam_r exists
15756 set getspnam_r d_getspnam_r
15757 eval $inlibc
15758 case "$d_getspnam_r" in
15759 "$define")
15760         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15761         case "$d_getspnam_r_proto:$usethreads" in
15762         ":define")      d_getspnam_r_proto=define
15763                 set d_getspnam_r_proto getspnam_r $hdrs
15764                 eval $hasproto ;;
15765         *)      ;;
15766         esac
15767         case "$d_getspnam_r_proto" in
15768         define)
15769         case "$getspnam_r_proto" in
15770         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15771         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15772         esac
15773         case "$getspnam_r_proto" in
15774         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15775         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15776         esac
15777         case "$getspnam_r_proto" in
15778         ''|0)   d_getspnam_r=undef
15779                 getspnam_r_proto=0
15780                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15781         * )     case "$getspnam_r_proto" in
15782                 REENTRANT_PROTO*) ;;
15783                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15784                 esac
15785                 echo "Prototype: $try" ;;
15786         esac
15787         ;;
15788         *)      case "$usethreads" in
15789                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15790                 esac
15791                 d_getspnam_r=undef
15792                 getspnam_r_proto=0
15793                 ;;
15794         esac
15795         ;;
15796 *)      getspnam_r_proto=0
15797         ;;
15798 esac
15799
15800 : see if gettimeofday or ftime exists
15801 set gettimeofday d_gettimeod
15802 eval $inlibc
15803 case "$d_gettimeod" in
15804 "$undef")
15805         set ftime d_ftime 
15806         eval $inlibc
15807         ;;
15808 *)
15809         val="$undef"; set d_ftime; eval $setvar
15810         ;;
15811 esac
15812 case "$d_gettimeod$d_ftime" in
15813 "$undef$undef")
15814         echo " "
15815         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15816         ;;
15817 esac
15818
15819 : see if gmtime_r exists
15820 set gmtime_r d_gmtime_r
15821 eval $inlibc
15822 case "$d_gmtime_r" in
15823 "$define")
15824         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15825         case "$d_gmtime_r_proto:$usethreads" in
15826         ":define")      d_gmtime_r_proto=define
15827                 set d_gmtime_r_proto gmtime_r $hdrs
15828                 eval $hasproto ;;
15829         *)      ;;
15830         esac
15831         case "$d_gmtime_r_proto" in
15832         define)
15833         case "$gmtime_r_proto" in
15834         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15835         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15836         esac
15837         case "$gmtime_r_proto" in
15838         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15839         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15840         esac
15841         case "$gmtime_r_proto" in
15842         ''|0)   d_gmtime_r=undef
15843                 gmtime_r_proto=0
15844                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15845         * )     case "$gmtime_r_proto" in
15846                 REENTRANT_PROTO*) ;;
15847                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15848                 esac
15849                 echo "Prototype: $try" ;;
15850         esac
15851         ;;
15852         *)      case "$usethreads" in
15853                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15854                 esac
15855                 d_gmtime_r=undef
15856                 gmtime_r_proto=0
15857                 ;;
15858         esac
15859         ;;
15860 *)      gmtime_r_proto=0
15861         ;;
15862 esac
15863
15864 : see if hasmntopt exists
15865 set hasmntopt d_hasmntopt
15866 eval $inlibc
15867
15868 : see if this is a netinet/in.h or sys/in.h system
15869 set netinet/in.h i_niin sys/in.h i_sysin
15870 eval $inhdr
15871
15872 : see if arpa/inet.h has to be included
15873 set arpa/inet.h i_arpainet
15874 eval $inhdr
15875
15876 : see if htonl --and friends-- exists
15877 val=''
15878 set htonl val
15879 eval $inlibc
15880
15881 : Maybe they are macros.
15882 case "$val" in
15883 $undef)
15884         $cat >htonl.c <<EOM
15885 #include <stdio.h>
15886 #include <sys/types.h>
15887 #$i_niin I_NETINET_IN
15888 #$i_sysin I_SYS_IN
15889 #$i_arpainet I_ARPA_INET
15890 #ifdef I_NETINET_IN
15891 #include <netinet/in.h>
15892 #endif
15893 #ifdef I_SYS_IN
15894 #include <sys/in.h>
15895 #endif
15896 #ifdef I_ARPA_INET
15897 #include <arpa/inet.h>
15898 #endif
15899 #ifdef htonl
15900 printf("Defined as a macro.");
15901 #endif
15902 EOM
15903         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15904         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15905                 val="$define"
15906                 echo "But it seems to be defined as a macro." >&4
15907         fi
15908         $rm -f htonl.?
15909         ;;
15910 esac
15911 set d_htonl
15912 eval $setvar
15913
15914 : see if hypot exists
15915 set hypot d_hypot
15916 eval $inlibc
15917
15918 : see if ilogb exists
15919 set ilogb d_ilogb
15920 eval $inlibc
15921
15922 : see if ilogbl exists
15923 set ilogbl d_ilogbl
15924 eval $inlibc
15925
15926 : index or strchr
15927 echo " "
15928 if set index val -f; eval $csym; $val; then
15929         if set strchr val -f d_strchr; eval $csym; $val; then
15930                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15931                         val="$define"
15932                         vali="$undef"
15933                         echo "strchr() found." >&4
15934                 else
15935                         val="$undef"
15936                         vali="$define"
15937                         echo "index() found." >&4
15938                 fi
15939         else
15940                 val="$undef"
15941                 vali="$define"
15942                 echo "index() found." >&4
15943         fi
15944 else
15945         if set strchr val -f d_strchr; eval $csym; $val; then
15946                 val="$define"
15947                 vali="$undef"
15948                 echo "strchr() found." >&4
15949         else
15950                 echo "No index() or strchr() found!" >&4
15951                 val="$undef"
15952                 vali="$undef"
15953         fi
15954 fi
15955 set d_strchr; eval $setvar
15956 val="$vali"
15957 set d_index; eval $setvar
15958
15959 : check whether inet_aton exists
15960 set inet_aton d_inetaton
15961 eval $inlibc
15962
15963 : see if inet_ntop exists
15964 set inet_ntop d_inetntop
15965 eval $inlibc
15966
15967 : see if inet_pton exists
15968 set inet_pton d_inetpton
15969 eval $inlibc
15970
15971 : Look for isascii
15972 echo " "
15973 $cat >isascii.c <<EOCP
15974 #include <stdio.h>
15975 #include <ctype.h>
15976 #$i_stdlib I_STDLIB
15977 #ifdef I_STDLIB
15978 #include <stdlib.h>
15979 #endif
15980 int main() {
15981         int c = 'A';
15982         if (isascii(c))
15983                 exit(0);
15984         else
15985                 exit(1);
15986 }
15987 EOCP
15988 set isascii
15989 if eval $compile; then
15990         echo "isascii() found." >&4
15991         val="$define"
15992 else
15993         echo "isascii() NOT found." >&4
15994         val="$undef"
15995 fi
15996 set d_isascii
15997 eval $setvar
15998 $rm -f isascii*
15999
16000 : Look for isblank
16001 echo " "
16002 $cat >isblank.c <<'EOCP'
16003 #include <stdio.h>
16004 #include <ctype.h>
16005 int main() {
16006         int c = ' ';
16007         if (isblank(c))
16008                 return 0 ;
16009         else
16010                 return 1 ;
16011 }
16012 EOCP
16013 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
16014         echo "isblank() found." >&4
16015         val="$define"
16016 else
16017         echo "isblank() NOT found." >&4
16018         val="$undef"
16019 fi
16020 set d_isblank
16021 eval $setvar
16022 $rm -f isblank*
16023
16024 : check for isfinite
16025 echo "Checking to see if you have isfinite..." >&4
16026 $cat >try.c <<EOCP
16027 #$i_math I_MATH
16028 #ifdef I_MATH
16029 #include <math.h>
16030 #endif
16031 int main() { return isfinite(0.0); }
16032 EOCP
16033 set try
16034 if eval $compile; then
16035         val="$define"
16036         echo "You have isfinite."
16037 else
16038         val="$undef"
16039         echo "You do not have isfinite."
16040 fi
16041 $rm_try
16042 set d_isfinite
16043 eval $setvar
16044
16045 : see if isfinitel exists
16046 set isfinitel d_isfinitel
16047 eval $inlibc
16048
16049 : check for isinf
16050 echo "Checking to see if you have isinf..." >&4
16051 $cat >try.c <<EOCP
16052 #$i_math I_MATH
16053 #ifdef I_MATH
16054 #include <math.h>
16055 #endif
16056 int main() { return isinf(0.0); }
16057 EOCP
16058 set try
16059 if eval $compile; then
16060         val="$define"
16061         echo "You have isinf."
16062 else
16063         val="$undef"
16064         echo "You do not have isinf."
16065 fi
16066 $rm_try
16067 set d_isinf
16068 eval $setvar
16069
16070 : see if isinfl exists
16071 set isinfl d_isinfl
16072 eval $inlibc
16073
16074 : check for isless
16075 echo "Checking to see if you have isless..." >&4
16076 $cat >try.c <<EOCP
16077 #$i_math I_MATH
16078 #ifdef I_MATH
16079 #include <math.h>
16080 #endif
16081 int main() { return isless(0.0); }
16082 EOCP
16083 set try
16084 if eval $compile; then
16085         val="$define"
16086         echo "You have isless."
16087 else
16088         val="$undef"
16089         echo "You do not have isless."
16090 fi
16091 $rm_try
16092 set d_isless
16093 eval $setvar
16094
16095 : check for isnan
16096 echo "Checking to see if you have isnan..." >&4
16097 $cat >try.c <<EOCP
16098 #$i_math I_MATH
16099 #ifdef I_MATH
16100 #include <math.h>
16101 #endif
16102 int main() { return isnan(0.0); }
16103 EOCP
16104 set try
16105 if eval $compile; then
16106         val="$define"
16107         echo "You have isnan."
16108 else
16109         val="$undef"
16110         echo "You do not have isnan."
16111 fi
16112 $rm_try
16113 set d_isnan
16114 eval $setvar
16115
16116 : see if isnanl exists
16117 set isnanl d_isnanl
16118 eval $inlibc
16119
16120 : check for isnormal
16121 echo "Checking to see if you have isnormal..." >&4
16122 $cat >try.c <<EOCP
16123 #$i_math I_MATH
16124 #ifdef I_MATH
16125 #include <math.h>
16126 #endif
16127 int main() { return isnormal(0.0); }
16128 EOCP
16129 set try
16130 if eval $compile; then
16131         val="$define"
16132         echo "You have isnormal."
16133 else
16134         val="$undef"
16135         echo "You do not have isnormal."
16136 fi
16137 $rm_try
16138 set d_isnormal
16139 eval $setvar
16140
16141 : see if j0 exists
16142 set j0 d_j0
16143 eval $inlibc
16144
16145 : see if j0l exists
16146 set j0l d_j0l
16147 eval $inlibc
16148
16149 : see if killpg exists
16150 set killpg d_killpg
16151 eval $inlibc
16152
16153 : see if localeconv exists
16154 set localeconv d_locconv
16155 eval $inlibc
16156
16157 : see if libc has the POSIX.1-2008 currency locale rules
16158 case "$d_locconv:$d_lc_monetary_2008" in
16159 $define:)
16160         $cat >try.c <<EOCP
16161 #include <locale.h>
16162 int main() {
16163         struct lconv *lc = localeconv();
16164         char int_p_cs_precedes = lc->int_p_cs_precedes;
16165         return 0;
16166 }
16167 EOCP
16168         set try
16169         if eval $compile; then
16170                 d_lc_monetary_2008="$define"
16171         else
16172                 d_lc_monetary_2008="$undef"
16173         fi;
16174         $rm_try
16175         ;;
16176 esac
16177
16178 : see if lchown exists
16179 echo " "
16180 $cat > try.c <<'EOCP'
16181 /* System header to define __stub macros and hopefully few prototypes,
16182     which can conflict with char lchown(); below.  */
16183 #include <assert.h>
16184 /* Override any gcc2 internal prototype to avoid an error.  */
16185 /* We use char because int might match the return type of a gcc2
16186    builtin and then its argument prototype would still apply.  */
16187 char lchown();
16188 int main() {
16189     /*  The GNU C library defines this for functions which it implements
16190         to always fail with ENOSYS.  Some functions are actually named
16191         something starting with __ and the normal name is an alias.  */
16192 #if defined (__stub_lchown) || defined (__stub___lchown)
16193 choke me
16194 #else
16195 lchown();
16196 #endif
16197 ; return 0; }
16198 EOCP
16199 set try
16200 if eval $compile; then
16201     $echo "lchown() found." >&4
16202     val="$define"
16203 else
16204     $echo "lchown() NOT found." >&4
16205     val="$undef"
16206 fi
16207 set d_lchown
16208 eval $setvar
16209
16210 : See if number of significant digits in a double precision number is known
16211 echo " "
16212 $cat >ldbl_dig.c <<EOM
16213 #$i_limits I_LIMITS
16214 #$i_float I_FLOAT
16215 #ifdef I_LIMITS
16216 #include <limits.h>
16217 #endif
16218 #ifdef I_FLOAT
16219 #include <float.h>
16220 #endif
16221 #ifdef LDBL_DIG
16222 printf("Contains LDBL_DIG");
16223 #endif
16224 EOM
16225 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
16226 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
16227         echo "LDBL_DIG found." >&4
16228         val="$define"
16229 else
16230         echo "LDBL_DIG NOT found." >&4
16231         val="$undef"
16232 fi
16233 $rm -f ldbl_dig.?
16234 set d_ldbl_dig
16235 eval $setvar
16236
16237 : see if lgamma exists
16238 set lgamma d_lgamma
16239 eval $inlibc
16240
16241 : see if lgamma_r exists
16242 set lgamma_r d_lgamma_r
16243 eval $inlibc
16244
16245 : check to see if math.h defines _LIB_VERSION
16246 d_libm_lib_version="$undef"
16247 case $i_math in
16248     $define)
16249         echo " "
16250         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
16251         $cat >try.c <<EOCP
16252 #include <unistd.h>
16253 #include <math.h>
16254 int main (int argc, char *argv[])
16255 {
16256     printf ("%d\n", _LIB_VERSION);
16257     return (0);
16258     } /* main */
16259 EOCP
16260         set try
16261         if eval $compile; then
16262             foo=`$run ./try`
16263             echo "Yes, it does ($foo)" >&4
16264             d_libm_lib_version="$define"
16265         else
16266             echo "No, it does not (probably harmless)" >&4
16267             fi
16268         $rm_try
16269         ;;
16270
16271     esac
16272
16273 : see if link exists
16274 set link d_link
16275 eval $inlibc
16276
16277 : see if llrint exists
16278 set llrint d_llrint
16279 eval $inlibc
16280
16281 : see if llrintl exists
16282 set llrintl d_llrintl
16283 eval $inlibc
16284
16285 : see if llround exists
16286 set llround d_llround
16287 eval $inlibc
16288
16289 : see if llroundl exists
16290 set llroundl d_llroundl
16291 eval $inlibc
16292
16293 : see if localtime_r exists
16294 set localtime_r d_localtime_r
16295 eval $inlibc
16296 case "$d_localtime_r" in
16297 "$define")
16298         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16299         case "$d_localtime_r_proto:$usethreads" in
16300         ":define")      d_localtime_r_proto=define
16301                 set d_localtime_r_proto localtime_r $hdrs
16302                 eval $hasproto ;;
16303         *)      ;;
16304         esac
16305         case "$d_localtime_r_proto" in
16306         define)
16307         case "$localtime_r_proto" in
16308         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16309         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16310         esac
16311         case "$localtime_r_proto" in
16312         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16313         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16314         esac
16315         case "$localtime_r_proto" in
16316         ''|0)   d_localtime_r=undef
16317                 localtime_r_proto=0
16318                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16319         * )     case "$localtime_r_proto" in
16320                 REENTRANT_PROTO*) ;;
16321                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16322                 esac
16323                 echo "Prototype: $try" ;;
16324         esac
16325         ;;
16326         *)      case "$usethreads" in
16327                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16328                 esac
16329                 d_localtime_r=undef
16330                 localtime_r_proto=0
16331                 ;;
16332         esac
16333         ;;
16334 *)      localtime_r_proto=0
16335         ;;
16336 esac
16337
16338 : see if localtime_r calls tzset
16339 case "$localtime_r_proto" in
16340 REENTRANT_PROTO*)
16341         $cat >try.c <<EOCP
16342 /*  Does our libc's localtime_r call tzset ?
16343  *  return 0 if so, 1 otherwise.
16344  */
16345 #$i_systypes    I_SYS_TYPES
16346 #$i_unistd      I_UNISTD
16347 #$i_time        I_TIME
16348 #$i_stdlib      I_STDLIB
16349 #$i_string      I_STRING
16350 #$i_malloc      I_MALLOC
16351 #ifdef I_SYS_TYPES
16352 #  include <sys/types.h>
16353 #endif
16354 #ifdef I_UNISTD
16355 #  include <unistd.h>
16356 #endif
16357 #ifdef I_TIME
16358 #  include <time.h>
16359 #endif
16360 #ifdef I_STDLIB
16361 #include <stdlib.h>
16362 #endif
16363 #ifdef I_STRING
16364 #  include <string.h>
16365 #else
16366 #  include <strings.h>
16367 #endif
16368 #ifdef I_MALLOC
16369 #  include <malloc.h>
16370 #endif
16371 int main()
16372 {
16373     time_t t = time(0L);
16374     char w_tz[]="TZ" "=GMT+5",
16375          e_tz[]="TZ" "=GMT-5",
16376         *tz_e = (char*)malloc(16),
16377         *tz_w = (char*)malloc(16);
16378     struct tm tm_e, tm_w;
16379     memset(&tm_e,'\0',sizeof(struct tm));
16380     memset(&tm_w,'\0',sizeof(struct tm));
16381     strcpy(tz_e,e_tz);
16382     strcpy(tz_w,w_tz);
16383
16384     putenv(tz_e);
16385     localtime_r(&t, &tm_e);
16386
16387     putenv(tz_w);
16388     localtime_r(&t, &tm_w);
16389
16390     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16391         return 1;
16392     return 0;
16393 }
16394 EOCP
16395         set try
16396         if eval $compile; then
16397             if $run ./try; then
16398                 d_localtime_r_needs_tzset=undef;
16399             else
16400                 d_localtime_r_needs_tzset=define;
16401             fi;
16402         else
16403             d_localtime_r_needs_tzset=undef;
16404         fi;
16405      ;;
16406   *)
16407      d_localtime_r_needs_tzset=undef;
16408      ;;
16409 esac
16410 $rm_try
16411
16412 : see if lockf exists
16413 set lockf d_lockf
16414 eval $inlibc
16415
16416 : see if log1p exists
16417 set log1p d_log1p
16418 eval $inlibc
16419
16420 : see if log2 exists
16421 set log2 d_log2
16422 eval $inlibc
16423
16424 : see if logb exists
16425 set logb d_logb
16426 eval $inlibc
16427
16428 : see if lrint exists
16429 set lrint d_lrint
16430 eval $inlibc
16431
16432 : see if lrintl exists
16433 set lrintl d_lrintl
16434 eval $inlibc
16435
16436 : see if lround exists
16437 set lround d_lround
16438 eval $inlibc
16439
16440 : see if lroundl exists
16441 set lroundl d_lroundl
16442 eval $inlibc
16443
16444 : see if prototype for lseek is available
16445 echo " "
16446 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16447 eval $hasproto
16448
16449 : see if lstat exists
16450 set lstat d_lstat
16451 eval $inlibc
16452
16453 : see if madvise exists
16454 set madvise d_madvise
16455 eval $inlibc
16456
16457 : see if malloc_size exists
16458 set malloc_size d_malloc_size
16459 eval $inlibc
16460
16461 : see if malloc_size_good exists
16462 set malloc_good_size d_malloc_good_size
16463 eval $inlibc
16464
16465 : see if mblen exists
16466 set mblen d_mblen
16467 eval $inlibc
16468
16469 : see if mbstowcs exists
16470 set mbstowcs d_mbstowcs
16471 eval $inlibc
16472
16473 : see if mbtowc exists
16474 set mbtowc d_mbtowc
16475 eval $inlibc
16476
16477 : see if memchr exists
16478 set memchr d_memchr
16479 eval $inlibc
16480
16481 : see if memcmp exists
16482 set memcmp d_memcmp
16483 eval $inlibc
16484
16485 : see if memcpy exists
16486 set memcpy d_memcpy
16487 eval $inlibc
16488
16489 : see if memmem exists
16490 set memmem d_memmem
16491 eval $inlibc
16492
16493 : see if memmove exists
16494 set memmove d_memmove
16495 eval $inlibc
16496
16497 : see if memset exists
16498 set memset d_memset
16499 eval $inlibc
16500
16501 : see if mkdir exists
16502 set mkdir d_mkdir
16503 eval $inlibc
16504
16505 : see if mkdtemp exists
16506 set mkdtemp d_mkdtemp
16507 eval $inlibc
16508
16509 : see if mkfifo exists
16510 set mkfifo d_mkfifo
16511 eval $inlibc
16512
16513 : see if mkstemp exists
16514 set mkstemp d_mkstemp
16515 eval $inlibc
16516
16517 : see if mkstemps exists
16518 set mkstemps d_mkstemps
16519 eval $inlibc
16520
16521 : see if mktime exists
16522 set mktime d_mktime
16523 eval $inlibc
16524
16525 : see if this is a sys/mman.h system
16526 set sys/mman.h i_sysmman
16527 eval $inhdr
16528
16529 : see if mmap exists
16530 set mmap d_mmap
16531 eval $inlibc
16532 : see what shmat returns
16533 : default to something harmless
16534 mmaptype='void *'
16535 case "$i_sysmman$d_mmap" in
16536 "$define$define")
16537         $cat >mmap.c <<'END'
16538 #include <sys/mman.h>
16539 void *mmap();
16540 END
16541         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16542                 mmaptype='void *'
16543         else
16544                 mmaptype='caddr_t'
16545         fi
16546         echo "and it returns ($mmaptype)." >&4
16547         ;;
16548 esac
16549
16550
16551
16552 : see if sqrtl exists
16553 set sqrtl d_sqrtl
16554 eval $inlibc
16555
16556 : see if scalbnl exists
16557 set scalbnl d_scalbnl
16558 eval $inlibc
16559
16560 : see if truncl exists
16561 set truncl d_truncl
16562 eval $inlibc
16563
16564 : see if modfl exists
16565 set modfl d_modfl
16566 eval $inlibc
16567
16568 : see if prototype for modfl is available
16569 echo " "
16570 set d_modflproto modfl $i_math math.h
16571 eval $hasproto
16572
16573 if $test "$uselongdouble" = "$define"; then
16574     message=""
16575     if $test "$d_sqrtl" != "$define"; then
16576         message="$message sqrtl"
16577     fi
16578     if $test "$d_modfl" != "$define"; then
16579         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16580             echo "You have both truncl and copysignl, so I can emulate modfl."
16581         else
16582             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16583                 echo "You have both aintl and copysignl, so I can emulate modfl."
16584             else
16585                 message="$message modfl"
16586             fi
16587         fi
16588     fi
16589     if $test "$d_frexpl" != "$define"; then
16590         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16591             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16592         else
16593             message="$message frexpl"
16594         fi
16595     fi
16596     if $test "$d_ldexpl" != "$define"; then
16597         message="$message ldexpl"
16598     fi
16599
16600     if $test "$message" != ""; then
16601         $cat <<EOM >&4
16602
16603 *** You requested the use of long doubles but you do not seem to have
16604 *** the following mathematical functions needed for long double support:
16605 ***    $message
16606 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16607 *** Cannot continue, aborting.
16608
16609 EOM
16610
16611         exit 1
16612     fi
16613 fi
16614
16615 : see if mprotect exists
16616 set mprotect d_mprotect
16617 eval $inlibc
16618
16619 : see if msgctl exists
16620 set msgctl d_msgctl
16621 eval $inlibc
16622
16623 : see if msgget exists
16624 set msgget d_msgget
16625 eval $inlibc
16626
16627 : see if msgsnd exists
16628 set msgsnd d_msgsnd
16629 eval $inlibc
16630
16631 : see if msgrcv exists
16632 set msgrcv d_msgrcv
16633 eval $inlibc
16634
16635 : see how much of the 'msg*(2)' library is present.
16636 h_msg=true
16637 echo " "
16638 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16639 *"$undef"*) h_msg=false;;
16640 esac
16641 case "$osname" in
16642 freebsd)
16643     case "`ipcs 2>&1`" in
16644     "SVID messages"*"not configured"*)
16645         echo "Your $osname does not have the msg*(2) configured." >&4
16646         h_msg=false
16647         val="$undef"
16648         set msgctl d_msgctl
16649         eval $setvar
16650         set msgget d_msgget
16651         eval $setvar
16652         set msgsnd d_msgsnd
16653         eval $setvar
16654         set msgrcv d_msgrcv
16655         eval $setvar
16656         ;;
16657     esac
16658     ;;
16659 esac
16660 : we could also check for sys/ipc.h ...
16661 if $h_msg && $test `./findhdr sys/msg.h`; then
16662         echo "You have the full msg*(2) library." >&4
16663         val="$define"
16664 else
16665         echo "You don't have the full msg*(2) library." >&4
16666         val="$undef"
16667 fi
16668 set d_msg
16669 eval $setvar
16670
16671 : Check for msghdr_s
16672 echo " "
16673 echo "Checking to see if your system supports struct msghdr..." >&4
16674 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16675 eval $hasstruct
16676 case "$d_msghdr_s" in
16677 "$define")      echo "Yes, it does."   ;;
16678 *)              echo "No, it doesn't." ;;
16679 esac
16680
16681
16682 : see if msync exists
16683 set msync d_msync
16684 eval $inlibc
16685
16686 : see if munmap exists
16687 set munmap d_munmap
16688 eval $inlibc
16689
16690 : see if nan exists
16691 set nan d_nan
16692 eval $inlibc
16693
16694 : see if nearbyint exists
16695 set nearbyint d_nearbyint
16696 eval $inlibc
16697
16698 : see if nextafter exists
16699 set nextafter d_nextafter
16700 eval $inlibc
16701
16702 : see if nexttoward exists
16703 set nexttoward d_nexttoward
16704 eval $inlibc
16705
16706 : see if nice exists
16707 set nice d_nice
16708 eval $inlibc
16709
16710 : see if this is a langinfo.h system
16711 set langinfo.h i_langinfo
16712 eval $inhdr
16713
16714 : see if nl_langinfo exists
16715 set nl_langinfo d_nl_langinfo
16716 eval $inlibc
16717
16718 : see if this is a quadmath.h system
16719 set quadmath.h i_quadmath
16720 eval $inhdr
16721
16722 : check for volatile keyword
16723 echo " "
16724 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
16725 $cat >try.c <<'EOCP'
16726 int main()
16727 {
16728         typedef struct _goo_struct goo_struct;
16729         goo_struct * volatile goo = ((goo_struct *)0);
16730         struct _goo_struct {
16731                 long long_int;
16732                 int reg_int;
16733                 char char_var;
16734         };
16735         typedef unsigned short foo_t;
16736         char *volatile foo;
16737         volatile int bar;
16738         volatile foo_t blech;
16739         foo = foo;
16740 }
16741 EOCP
16742 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
16743         val="$define"
16744         echo "Yup, it does."
16745 else
16746         val="$undef"
16747         echo "Nope, it doesn't."
16748 fi
16749 set d_volatile
16750 eval $setvar
16751 $rm_try
16752
16753 : Check basic sizes
16754 echo " "
16755 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16756
16757 case "$use64bitint:$d_quad:$quadtype" in
16758 define:define:?*)
16759         ivtype="$quadtype"
16760         uvtype="$uquadtype"
16761         ivsize=8
16762         uvsize=8
16763         ;;
16764 *)      ivtype="long"
16765         uvtype="unsigned long"
16766         ivsize=$longsize
16767         uvsize=$longsize
16768         ;;
16769 esac
16770
16771 case "$uselongdouble:$d_longdbl" in
16772 define:define)
16773         nvtype="long double"
16774         nvsize=$longdblsize
16775         ;;
16776 *)      nvtype=double
16777         nvsize=$doublesize
16778         ;;
16779 esac
16780
16781 case "$usequadmath:$i_quadmath" in
16782 define:define)
16783   nvtype="__float128"
16784   nvsize=16
16785   case "$libs" in
16786   *quadmath*) ;;
16787   *) $cat <<EOM >&4
16788
16789 *** You requested the use of the quadmath library, but you
16790 *** do not seem to have the quadmath library installed.
16791 *** Cannot continue, aborting.
16792 EOM
16793     exit 1
16794     ;;
16795   esac
16796   ;;
16797 define:*) $cat <<EOM >&4
16798
16799 *** You requested the use of the quadmath library, but you
16800 *** do not seem to have the required header, <quadmath.h>.
16801 EOM
16802   case "$gccversion" in
16803   [23].*|4.[0-5]*)
16804    $cat <<EOM >&4
16805 *** Your gcc looks a bit old:
16806 *** $gccversion
16807 EOM
16808     ;;
16809   '')
16810    $cat <<EOM >&4
16811 *** You are not running a gcc.
16812 EOM
16813     ;;
16814   esac
16815   $cat <<EOM >&4
16816 *** For the quadmath library you need at least gcc 4.6.
16817 *** Cannot continue, aborting.
16818 EOM
16819   exit 1
16820   ;;
16821 esac
16822
16823 $echo "(IV will be "$ivtype", $ivsize bytes)"
16824 $echo "(UV will be "$uvtype", $uvsize bytes)"
16825 $echo "(NV will be "$nvtype", $nvsize bytes)"
16826
16827 $cat >try.c <<EOCP
16828 #$i_inttypes I_INTTYPES
16829 #ifdef I_INTTYPES
16830 #include <inttypes.h>
16831 #endif
16832 #include <stdio.h>
16833 int main() {
16834 #ifdef INT8
16835    int8_t i =  INT8_MAX;
16836   uint8_t u = UINT8_MAX;
16837   printf("int8_t\n");
16838 #endif
16839 #ifdef INT16
16840    int16_t i =  INT16_MAX;
16841   uint16_t u = UINT16_MAX;
16842   printf("int16_t\n");
16843 #endif
16844 #ifdef INT32
16845    int32_t i =  INT32_MAX;
16846   uint32_t u = UINT32_MAX;
16847   printf("int32_t\n");
16848 #endif
16849 }
16850 EOCP
16851
16852 i8type="signed char"
16853 u8type="unsigned char"
16854 i8size=1
16855 u8size=1
16856
16857 case "$i16type" in
16858 '')     case "$shortsize" in
16859         2)      i16type=short
16860                 u16type="unsigned short"
16861                 i16size=$shortsize
16862                 u16size=$shortsize
16863                 ;;
16864         esac
16865         ;;
16866 esac
16867 case "$i16type" in
16868 '')     set try -DINT16
16869         if eval $compile; then
16870                 case "`$run ./try`" in
16871                 int16_t)
16872                         i16type=int16_t
16873                         u16type=uint16_t
16874                         i16size=2
16875                         u16size=2
16876                         ;;
16877                 esac
16878         fi
16879         ;;
16880 esac
16881 case "$i16type" in
16882 '')     if $test $shortsize -ge 2; then
16883                 i16type=short
16884                 u16type="unsigned short"
16885                 i16size=$shortsize
16886                 u16size=$shortsize
16887         fi
16888         ;;
16889 esac
16890
16891 case "$i32type" in
16892 '')     case "$longsize" in
16893         4)      i32type=long
16894                 u32type="unsigned long"
16895                 i32size=$longsize
16896                 u32size=$longsize
16897                 ;;
16898         *)      case "$intsize" in
16899                 4)      i32type=int
16900                         u32type="unsigned int"
16901                         i32size=$intsize
16902                         u32size=$intsize
16903                         ;;
16904                 esac
16905                 ;;
16906         esac
16907         ;;
16908 esac
16909 case "$i32type" in
16910 '')     set try -DINT32
16911         if eval $compile; then
16912                 case "`$run ./try`" in
16913                 int32_t)
16914                         i32type=int32_t
16915                         u32type=uint32_t
16916                         i32size=4
16917                         u32size=4
16918                         ;;
16919                 esac
16920         fi
16921         ;;
16922 esac
16923 case "$i32type" in
16924 '')     if $test $intsize -ge 4; then
16925                 i32type=int
16926                 u32type="unsigned int"
16927                 i32size=$intsize
16928                 u32size=$intsize
16929         fi
16930         ;;
16931 esac
16932
16933 case "$i64type" in
16934 '')     case "$d_quad:$quadtype" in
16935         define:?*)
16936                 i64type="$quadtype"
16937                 u64type="$uquadtype"
16938                 i64size=8
16939                 u64size=8
16940                 ;;
16941         esac
16942         ;;
16943 esac
16944
16945 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16946 : volatile so that the compiler has to store it out to memory.
16947 if test X"$d_volatile" = X"$define"; then
16948         volatile=volatile
16949 fi
16950 $cat <<EOP >try.c
16951 #include <stdio.h>
16952 #$i_stdlib I_STDLIB
16953 #ifdef I_STDLIB
16954 #include <stdlib.h>
16955 #endif
16956 #include <sys/types.h>
16957 #include <signal.h>
16958 #ifdef SIGFPE
16959 $volatile int bletched = 0;
16960 $signal_t blech(int s) { bletched = 1; }
16961 #endif
16962 int main() {
16963     $uvtype u = 0;
16964     $nvtype d;
16965     int     n = 8 * $uvsize;
16966     int     i;
16967 #ifdef SIGFPE
16968     signal(SIGFPE, blech);
16969 #endif
16970
16971     for (i = 0; i < n; i++) {
16972       u = u << 1 | ($uvtype)1;
16973       d = ($nvtype)u;
16974       if (($uvtype)d != u)
16975         break;
16976       if (d <= 0)
16977         break;
16978       d = ($nvtype)(u - 1);
16979       if (($uvtype)d != (u - 1))
16980         break;
16981 #ifdef SIGFPE
16982       if (bletched)
16983         break;
16984 #endif
16985     }
16986     printf("%d\n", ((i == n) ? -n : i));
16987     exit(0);
16988 }
16989 EOP
16990 set try
16991
16992 d_nv_preserves_uv="$undef"
16993 if eval $compile; then
16994         nv_preserves_uv_bits="`$run ./try`"
16995 fi
16996 case "$nv_preserves_uv_bits" in
16997 \-[1-9]*)
16998         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16999         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
17000         d_nv_preserves_uv="$define"
17001         ;;
17002 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
17003         d_nv_preserves_uv="$undef" ;;
17004 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
17005         nv_preserves_uv_bits="0" ;;
17006 esac
17007 $rm_try
17008
17009 $echo "Checking to find the largest integer value your NVs can hold..." >&4
17010 : volatile so that the compiler has to store it out to memory.
17011 if test X"$d_volatile" = X"$define"; then
17012         volatile=volatile
17013 fi
17014 $cat <<EOP >try.c
17015 #include <stdio.h>
17016
17017 typedef $nvtype NV;
17018
17019 int
17020 main() {
17021   NV value = 2;
17022   int count = 1;
17023
17024   while(count < 256) {
17025     $volatile NV up = value + 1.0;
17026     $volatile NV negated = -value;
17027     $volatile NV down = negated - 1.0;
17028     $volatile NV got_up = up - value;
17029     int up_good = got_up == 1.0;
17030     int got_down = down - negated;
17031     int down_good = got_down == -1.0;
17032
17033     if (down_good != up_good) {
17034       fprintf(stderr,
17035               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
17036               up_good, (double) got_up, down_good, (double) got_down,
17037               count, (double) value);
17038       return 1;
17039     }
17040     if (!up_good) {
17041       while (1) {
17042         if (count > 8) {
17043           count -= 8;
17044           fputs("256.0", stdout);
17045         } else {
17046           count--;
17047           fputs("2.0", stdout);
17048         }
17049         if (!count) {
17050           puts("");
17051           return 0;
17052         }
17053         fputs("*", stdout);
17054       }
17055     }
17056     value *= 2;
17057     ++count;
17058   }
17059   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
17060           count, (double) value);
17061   return 1;
17062 }
17063 EOP
17064 set try
17065
17066 nv_overflows_integers_at='0'
17067 if eval $compile; then
17068     xxx="`$run ./try`"
17069     case "$?" in
17070         0)
17071             case "$xxx" in
17072                 2*)  cat >&4 <<EOM
17073 The largest integer your NVs can preserve is equal to $xxx
17074 EOM
17075                     nv_overflows_integers_at="$xxx"
17076                     ;;
17077                 *)  cat >&4 <<EOM
17078 Cannot determine the largest integer value your NVs can hold, unexpected output
17079 '$xxx'
17080 EOM
17081                     ;;
17082             esac
17083             ;;
17084         *)  cat >&4 <<EOM
17085 Cannot determine the largest integer value your NVs can hold
17086 EOM
17087             ;;
17088     esac
17089 fi
17090 $rm_try
17091
17092 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
17093 : volatile so that the compiler has to store it out to memory.
17094 if test X"$d_volatile" = X"$define"; then
17095         volatile=volatile
17096 fi
17097 $cat <<EOP >try.c
17098 #include <stdio.h>
17099 #$i_stdlib I_STDLIB
17100 #ifdef I_STDLIB
17101 #include <stdlib.h>
17102 #endif
17103 #$i_string I_STRING
17104 #ifdef I_STRING
17105 #  include <string.h>
17106 #else
17107 #  include <strings.h>
17108 #endif
17109 #include <sys/types.h>
17110 #include <signal.h>
17111 #ifdef SIGFPE
17112 $volatile int bletched = 0;
17113 $signal_t blech(int s) { bletched = 1; }
17114 #endif
17115
17116 int checkit($nvtype d, char *where) {
17117     unsigned char *p = (char *)&d;
17118     unsigned char *end = p + sizeof(d);
17119     int fail = 0;
17120
17121     while (p < end)
17122         fail += *p++;
17123
17124     if (!fail)
17125         return 0;
17126
17127     p = (char *)&d;
17128     printf("No - %s: 0x", where);
17129     while (p < end)
17130         printf ("%02X", *p++);
17131     printf("\n");
17132     return 1;
17133 }
17134
17135 int main(int argc, char **argv) {
17136     $nvtype d = 0.0;
17137     int fail = 0;
17138     fail += checkit(d, "0.0");
17139
17140     /* The compiler shouldn't be assuming that bletched is 0  */
17141     d = bletched;
17142
17143     fail += checkit(d, "bleched");
17144
17145 #ifdef SIGFPE
17146     signal(SIGFPE, blech);
17147 #endif
17148
17149     /* Paranoia - the compiler should have no way of knowing that ANSI says
17150        that argv[argc] will always be NULL.  Actually, if it did assume this it
17151        would be buggy, as this is C and main() can be called from elsewhere in
17152        the program.  */
17153     d = argv[argc] ? 1 : 0;
17154
17155     if (d) {
17156         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
17157     }
17158
17159     fail += checkit(d, "ternary");
17160
17161     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
17162
17163     if (d != 0.0) {
17164         printf("No - memset doesn't give 0.0\n");
17165         /* This might just blow up:  */
17166         printf("(gives %g)\n", d);
17167         return 1;
17168     }
17169
17170 #ifdef SIGFPE
17171     if (bletched) {
17172         printf("No - something bleched\n");
17173         return 1;
17174     }
17175 #endif
17176     if (fail) {
17177       printf("No - %d fail(s)\n", fail);
17178       return 1;
17179     }
17180     printf("Yes\n");
17181     return 0;
17182 }
17183 EOP
17184 set try
17185
17186 d_nv_zero_is_allbits_zero="$undef"
17187 if eval $compile; then
17188     xxx="`$run ./try`"
17189     case "$?" in
17190         0)
17191             case "$xxx" in
17192                 Yes)  cat >&4 <<EOM
17193 0.0 is represented as all bits zero in memory
17194 EOM
17195                     d_nv_zero_is_allbits_zero="$define"
17196                     ;;
17197                 *)  cat >&4 <<EOM
17198 0.0 is not represented as all bits zero in memory
17199 EOM
17200                     d_nv_zero_is_allbits_zero="$undef"
17201                     ;;
17202             esac
17203             ;;
17204         *)  cat >&4 <<EOM
17205 0.0 is not represented as all bits zero in memory
17206 EOM
17207             d_nv_zero_is_allbits_zero="$undef"
17208             ;;
17209     esac
17210 fi
17211 $rm_try
17212
17213 : check for off64_t
17214 echo " "
17215 echo "Checking to see if you have off64_t..." >&4
17216 $cat >try.c <<EOCP
17217 #include <sys/types.h>
17218 #include <unistd.h>
17219 int main() { off64_t x = 7; }
17220 EOCP
17221 set try
17222 if eval $compile; then
17223         val="$define"
17224         echo "You have off64_t."
17225 else
17226         val="$undef"
17227         echo "You do not have off64_t."
17228         case "$lseeksize" in
17229         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
17230         esac
17231 fi
17232 $rm_try
17233 set d_off64_t
17234 eval $setvar
17235
17236 : how to create joinable pthreads
17237 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
17238         echo " "
17239         echo "Checking what constant to use for creating joinable pthreads..." >&4
17240         $cat >try.c <<'EOCP'
17241 #include <pthread.h>
17242 int main() {
17243     int detachstate = JOINABLE;
17244 }
17245 EOCP
17246         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
17247         if eval $compile; then
17248                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
17249                 val="$undef" # Yes, undef.
17250                 set d_old_pthread_create_joinable
17251                 eval $setvar
17252                 val=""
17253                 set old_pthread_create_joinable
17254                 eval $setvar
17255         else
17256                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
17257                 if eval $compile; then
17258                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
17259                         val="$define"
17260                         set d_old_pthread_create_joinable
17261                         eval $setvar
17262                         val=PTHREAD_CREATE_UNDETACHED
17263                         set old_pthread_create_joinable
17264                         eval $setvar
17265                 else
17266                         set try -DJOINABLE=__UNDETACHED
17267                         if eval $compile; then
17268                                 echo "You seem to use __UNDETACHED." >&4
17269                                 val="$define"
17270                                 set d_old_pthread_create_joinable
17271                                 eval $setvar
17272                                 val=__UNDETACHED
17273                                 set old_pthread_create_joinable
17274                                 eval $setvar
17275                         else
17276                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
17277                                 val="$define"
17278                                 set d_old_pthread_create_joinable
17279                                 eval $setvar
17280                                 val=0
17281                                 set old_pthread_create_joinable
17282                                 eval $setvar
17283                         fi
17284                 fi
17285         fi
17286         $rm_try
17287 else
17288     d_old_pthread_create_joinable="$undef"
17289     old_pthread_create_joinable=""
17290 fi
17291
17292 : see if pause exists
17293 set pause d_pause
17294 eval $inlibc
17295
17296 : see if poll exists
17297 set poll d_poll
17298 eval $inlibc
17299
17300 : see if prctl exists
17301 set prctl d_prctl
17302 eval $inlibc
17303
17304 : see if prctl supports PR_SET_NAME
17305 d_prctl_set_name=$undef
17306 case $d_prctl in
17307     $define)
17308         $cat >try.c <<EOM
17309 #ifdef __ANDROID__
17310 #include <unistd.h>
17311 #endif
17312 #include <sys/prctl.h>
17313
17314 int main (int argc, char *argv[])
17315 {
17316     return (prctl (PR_SET_NAME, "Test"));
17317     } /* main */
17318 EOM
17319         set try
17320         if eval $compile_ok && $run ./try; then
17321             echo "Your prctl (PR_SET_NAME, ...) works"
17322             d_prctl_set_name=$define
17323             fi
17324         $rm_try
17325         ;;
17326     esac
17327
17328 : see if readlink exists
17329 set readlink d_readlink
17330 eval $inlibc
17331
17332 : Check if there is a /proc symlink to the abs path of
17333 : the executing program.  We will honor hints of d_procselfexe=$undef
17334 : or procselfexe being non-empty, otherwise will try to determine both
17335 : if we have readlink.
17336 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
17337 : referenced, and AmigaOS does not have a proc filesystem anyway.
17338 echo " "
17339 val="$undef"
17340 if $test "X$d_procselfexe" = Xundef; then
17341         procselfexe=''
17342 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
17343         val="$define"
17344 elif $test "X$d_readlink" = Xdefine; then
17345         : NetBSD first as /proc/self is a symlink to /proc/curproc,
17346         : and it feels more tidy to avoid an extra level of symlink
17347         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17348         while test $# -gt 0; do
17349             type=$1; try=$2
17350             shift; shift
17351             if $issymlink $try; then
17352                 $ls -l $try > reflect
17353                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17354                     echo "You have $type-like $try."
17355                     procselfexe='"'$try'"'
17356                     val="$define"
17357                     : This will break out of the loop
17358                     set X; shift
17359                 fi
17360             fi
17361         done
17362 fi
17363 $rm -f reflect
17364 set d_procselfexe
17365 eval $setvar
17366
17367 : backward compatibility for d_hvfork
17368 if test X$d_hvfork != X; then
17369         d_vfork="$d_hvfork"
17370         d_hvfork=''
17371 fi
17372 : see if there is a vfork
17373 val=''
17374 set vfork val
17375 eval $inlibc
17376
17377 d_pseudofork=$undef
17378
17379 : Ok, but do we want to use it. vfork is reportedly unreliable in
17380 : perl on Solaris 2.x, and probably elsewhere.
17381 case "$val" in
17382 $define)
17383         echo " "
17384         case "$usevfork" in
17385         false) dflt='n';;
17386         *) dflt='y';;
17387         esac
17388         cat <<'EOM'
17389
17390 Perl can only use a vfork() that doesn't suffer from strict
17391 restrictions on calling functions or modifying global data in
17392 the child.  For example, glibc-2.1 contains such a vfork()
17393 that is unsuitable.  If your system provides a proper fork()
17394 call, chances are that you do NOT want perl to use vfork().
17395
17396 EOM
17397         rp="Do you still want to use vfork()?"
17398         . ./myread
17399         case "$ans" in
17400         y|Y) ;;
17401         *)
17402                 echo "Ok, we won't use vfork()."
17403                 val="$undef"
17404                 ;;
17405         esac
17406         ;;
17407 esac
17408 set d_vfork
17409 eval $setvar
17410 case "$d_vfork" in
17411 $define) usevfork='true';;
17412 *) usevfork='false';;
17413 esac
17414
17415 : see whether the pthread_atfork exists
17416 $cat >try.c <<EOP
17417 #include <pthread.h>
17418 #include <stdio.h>
17419 int main() {
17420 #ifdef  PTHREAD_ATFORK
17421         pthread_atfork(NULL,NULL,NULL);
17422 #endif
17423 }
17424 EOP
17425
17426 : see if pthread_atfork exists
17427 set try -DPTHREAD_ATFORK
17428 if eval $compile; then
17429     val="$define"
17430 else
17431     val="$undef"
17432 fi
17433 case "$usethreads" in
17434 $define)
17435         case "$val" in
17436         $define) echo 'pthread_atfork found.' >&4        ;;
17437         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17438         esac
17439 esac
17440 set d_pthread_atfork
17441 eval $setvar
17442
17443 : see if pthread_attr_setscope exists
17444 set pthread_attr_setscope d_pthread_attr_setscope
17445 eval $inlibc
17446
17447 : see whether the various POSIXish _yields exist
17448 $cat >try.c <<EOP
17449 #include <pthread.h>
17450 #include <stdio.h>
17451 int main() {
17452 #ifdef SCHED_YIELD
17453         sched_yield();
17454 #else
17455 #ifdef PTHREAD_YIELD
17456         pthread_yield();
17457 #else
17458 #ifdef PTHREAD_YIELD_NULL
17459         pthread_yield(NULL);
17460 #endif
17461 #endif
17462 #endif
17463 }
17464 EOP
17465 : see if sched_yield exists
17466 set try -DSCHED_YIELD
17467 if eval $compile; then
17468     val="$define"
17469     sched_yield='sched_yield()'
17470 else
17471     val="$undef"
17472 fi
17473 case "$usethreads" in
17474 $define)
17475         case "$val" in
17476         $define) echo 'sched_yield() found.' >&4        ;;
17477         *)       echo 'sched_yield() NOT found.' >&4    ;;
17478         esac
17479 esac
17480 set d_sched_yield
17481 eval $setvar
17482
17483 : see if pthread_yield exists
17484 set try -DPTHREAD_YIELD
17485 if eval $compile; then
17486     val="$define"
17487     case "$sched_yield" in
17488     '') sched_yield='pthread_yield()' ;;
17489     esac
17490 else
17491     set try -DPTHREAD_YIELD_NULL
17492     if eval $compile; then
17493         val="$define"
17494         case "$sched_yield" in
17495         '') sched_yield='pthread_yield(NULL)' ;;
17496         esac
17497     else
17498         val="$undef"
17499     fi
17500 fi
17501 case "$usethreads" in
17502 $define)
17503         case "$val" in
17504         $define) echo 'pthread_yield() found.' >&4      ;;
17505         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17506         esac
17507         ;;
17508 esac
17509 set d_pthread_yield
17510 eval $setvar
17511 case "$sched_yield" in
17512 '') sched_yield=undef ;;
17513 esac
17514 $rm_try
17515
17516 : check for ptrdiff_t
17517 echo " "
17518 echo "Checking to see if you have ptrdiff_t..." >&4
17519 $cat >try.c <<EOCP
17520 #include <stddef.h>
17521 int main() { ptrdiff_t x = 7; }
17522 EOCP
17523 set try
17524 if eval $compile; then
17525         val="$define"
17526         echo "You have ptrdiff_t."
17527 else
17528         val="$undef"
17529         echo "You do not have ptrdiff_t."
17530 fi
17531 $rm_try
17532 set d_ptrdiff_t
17533 eval $setvar
17534
17535 : see if random_r exists
17536 set random_r d_random_r
17537 eval $inlibc
17538 case "$d_random_r" in
17539 "$define")
17540         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17541         case "$d_random_r_proto:$usethreads" in
17542         ":define")      d_random_r_proto=define
17543                 set d_random_r_proto random_r $hdrs
17544                 eval $hasproto ;;
17545         *)      ;;
17546         esac
17547         case "$d_random_r_proto" in
17548         define)
17549         case "$random_r_proto" in
17550         ''|0) try='int random_r(int*, struct random_data*);'
17551         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17552         esac
17553         case "$random_r_proto" in
17554         ''|0) try='int random_r(long*, struct random_data*);'
17555         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17556         esac
17557         case "$random_r_proto" in
17558         ''|0) try='int random_r(struct random_data*, int32_t*);'
17559         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17560         esac
17561         case "$random_r_proto" in
17562         ''|0)   d_random_r=undef
17563                 random_r_proto=0
17564                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17565         * )     case "$random_r_proto" in
17566                 REENTRANT_PROTO*) ;;
17567                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17568                 esac
17569                 echo "Prototype: $try" ;;
17570         esac
17571         ;;
17572         *)      case "$usethreads" in
17573                 define) echo "random_r has no prototype, not using it." >&4 ;;
17574                 esac
17575                 d_random_r=undef
17576                 random_r_proto=0
17577                 ;;
17578         esac
17579         ;;
17580 *)      random_r_proto=0
17581         ;;
17582 esac
17583
17584 : see if readdir and friends exist
17585 set readdir d_readdir
17586 eval $inlibc
17587 set seekdir d_seekdir
17588 eval $inlibc
17589 set telldir d_telldir
17590 eval $inlibc
17591 set rewinddir d_rewinddir
17592 eval $inlibc
17593
17594 : see if readdir64_r exists
17595 set readdir64_r d_readdir64_r
17596 eval $inlibc
17597 case "$d_readdir64_r" in
17598 "$define")
17599         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17600         case "$d_readdir64_r_proto:$usethreads" in
17601         ":define")      d_readdir64_r_proto=define
17602                 set d_readdir64_r_proto readdir64_r $hdrs
17603                 eval $hasproto ;;
17604         *)      ;;
17605         esac
17606         case "$d_readdir64_r_proto" in
17607         define)
17608         case "$readdir64_r_proto" in
17609         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17610         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17611         esac
17612         case "$readdir64_r_proto" in
17613         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17614         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17615         esac
17616         case "$readdir64_r_proto" in
17617         ''|0)   d_readdir64_r=undef
17618                 readdir64_r_proto=0
17619                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17620         * )     case "$readdir64_r_proto" in
17621                 REENTRANT_PROTO*) ;;
17622                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17623                 esac
17624                 echo "Prototype: $try" ;;
17625         esac
17626         ;;
17627         *)      case "$usethreads" in
17628                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17629                 esac
17630                 d_readdir64_r=undef
17631                 readdir64_r_proto=0
17632                 ;;
17633         esac
17634         ;;
17635 *)      readdir64_r_proto=0
17636         ;;
17637 esac
17638
17639 : see if readdir_r exists
17640 set readdir_r d_readdir_r
17641 eval $inlibc
17642 case "$d_readdir_r" in
17643 "$define")
17644         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17645         case "$d_readdir_r_proto:$usethreads" in
17646         ":define")      d_readdir_r_proto=define
17647                 set d_readdir_r_proto readdir_r $hdrs
17648                 eval $hasproto ;;
17649         *)      ;;
17650         esac
17651         case "$d_readdir_r_proto" in
17652         define)
17653         case "$readdir_r_proto" in
17654         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17655         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17656         esac
17657         case "$readdir_r_proto" in
17658         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17659         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17660         esac
17661         case "$readdir_r_proto" in
17662         ''|0)   d_readdir_r=undef
17663                 readdir_r_proto=0
17664                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17665         * )     case "$readdir_r_proto" in
17666                 REENTRANT_PROTO*) ;;
17667                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17668                 esac
17669                 echo "Prototype: $try" ;;
17670         esac
17671         ;;
17672         *)      case "$usethreads" in
17673                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17674                 esac
17675                 d_readdir_r=undef
17676                 readdir_r_proto=0
17677                 ;;
17678         esac
17679         ;;
17680 *)      readdir_r_proto=0
17681         ;;
17682 esac
17683
17684 : see if readv exists
17685 set readv d_readv
17686 eval $inlibc
17687
17688 : see if recvmsg exists
17689 set recvmsg d_recvmsg
17690 eval $inlibc
17691
17692 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17693 echo " "
17694 if set regcomp val -f d_regcomp; eval $csym; $val; then
17695         echo 'regcomp() found.' >&4
17696         d_regcomp="$define"
17697         d_regcmp="$undef"
17698         d_re_comp="$undef"
17699 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17700         echo 'regcmp() found.' >&4
17701         d_regcmp="$define"
17702         d_regcomp="$undef"
17703         d_re_comp="$undef"
17704 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17705         echo 're_comp() found, assuming re_exec() also exists.' >&4
17706         d_re_comp="$define"
17707         d_regcomp="$undef"
17708         d_regcmp="$undef"
17709 else
17710         $cat >&4 <<EOM
17711 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17712 EOM
17713         d_regcmp="$undef"
17714         d_re_comp="$undef"
17715         d_regcomp="$undef"
17716 fi
17717
17718 : see if remainder exists
17719 set remainder d_remainder
17720 eval $inlibc
17721
17722 : see if remquo exists
17723 set remquo d_remquo
17724 eval $inlibc
17725
17726 : see if rename exists
17727 set rename d_rename
17728 eval $inlibc
17729
17730 : see if rint exists
17731 set rint d_rint
17732 eval $inlibc
17733
17734 : see if rmdir exists
17735 set rmdir d_rmdir
17736 eval $inlibc
17737
17738 : see if round exists
17739 set round d_round
17740 eval $inlibc
17741
17742 : see if memory.h is available.
17743 val=''
17744 set memory.h val
17745 eval $inhdr
17746
17747 : See if it conflicts with string.h
17748 case "$val" in
17749 $define)
17750         case "$strings" in
17751         '') ;;
17752         *)
17753                 $cppstdin $cppflags $cppminus < $strings > mem.h
17754                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
17755                         echo " "
17756                         echo "We won't be including <memory.h>."
17757                         val="$undef"
17758                 fi
17759                 $rm -f mem.h
17760                 ;;
17761         esac
17762 esac
17763 set i_memory
17764 eval $setvar
17765
17766 : can bcopy handle overlapping blocks?
17767 echo " "
17768 val="$undef"
17769 case "$d_memmove" in
17770 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
17771 *)      case "$d_bcopy" in
17772         "$define")
17773                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
17774                 $cat >try.c <<EOCP
17775 #$i_memory I_MEMORY
17776 #$i_stdlib I_STDLIB
17777 #$i_string I_STRING
17778 #$i_unistd I_UNISTD
17779 EOCP
17780         $cat >>try.c <<'EOCP'
17781 #include <stdio.h>
17782 #ifdef I_MEMORY
17783 #  include <memory.h>
17784 #endif
17785 #ifdef I_STDLIB
17786 #  include <stdlib.h>
17787 #endif
17788 #ifdef I_STRING
17789 #  include <string.h>
17790 #else
17791 #  include <strings.h>
17792 #endif
17793 #ifdef I_UNISTD
17794 #  include <unistd.h>  /* Needed for NetBSD */
17795 #endif
17796 int main()
17797 {
17798 char buf[128], abc[128];
17799 char *b;
17800 int len;
17801 int off;
17802 int align;
17803
17804 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17805    try to store the string in read-only memory. */
17806 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
17807
17808 for (align = 7; align >= 0; align--) {
17809         for (len = 36; len; len--) {
17810                 b = buf+align;
17811                 bcopy(abc, b, len);
17812                 for (off = 1; off <= len; off++) {
17813                         bcopy(b, b+off, len);
17814                         bcopy(b+off, b, len);
17815                         if (bcmp(b, abc, len))
17816                                 exit(1);
17817                 }
17818         }
17819 }
17820 exit(0);
17821 }
17822 EOCP
17823                 set try
17824                 if eval $compile_ok; then
17825                         if $run ./try 2>/dev/null; then
17826                                 echo "Yes, it can."
17827                                 val="$define"
17828                         else
17829                                 echo "It can't, sorry."
17830                         fi
17831                 else
17832                         echo "(I can't compile the test program, so we'll assume not...)"
17833                 fi
17834                 ;;
17835         esac
17836         $rm_try
17837         ;;
17838 esac
17839 set d_safebcpy
17840 eval $setvar
17841
17842 : can memcpy handle overlapping blocks?
17843 echo " "
17844 val="$undef"
17845 case "$d_memmove" in
17846 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
17847 *)      case "$d_memcpy" in
17848         "$define")
17849                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
17850                 $cat >try.c <<EOCP
17851 #$i_memory I_MEMORY
17852 #$i_stdlib I_STDLIB
17853 #$i_string I_STRING
17854 #$i_unistd I_UNISTD
17855 EOCP
17856         $cat >>try.c <<'EOCP'
17857 #include <stdio.h>
17858 #ifdef I_MEMORY
17859 #  include <memory.h>
17860 #endif
17861 #ifdef I_STDLIB
17862 #  include <stdlib.h>
17863 #endif
17864 #ifdef I_STRING
17865 #  include <string.h>
17866 #else
17867 #  include <strings.h>
17868 #endif
17869 #ifdef I_UNISTD
17870 #  include <unistd.h>  /* Needed for NetBSD */
17871 #endif
17872 int main()
17873 {
17874 char buf[128], abc[128];
17875 char *b;
17876 int len;
17877 int off;
17878 int align;
17879
17880 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17881    try to store the string in read-only memory. */
17882 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
17883
17884 for (align = 7; align >= 0; align--) {
17885         for (len = 36; len; len--) {
17886                 b = buf+align;
17887                 memcpy(b, abc, len);
17888                 for (off = 1; off <= len; off++) {
17889                         memcpy(b+off, b, len);
17890                         memcpy(b, b+off, len);
17891                         if (memcmp(b, abc, len))
17892                                 exit(1);
17893                 }
17894         }
17895 }
17896 exit(0);
17897 }
17898 EOCP
17899                 set try
17900                 if eval $compile_ok; then
17901                         if $run ./try 2>/dev/null; then
17902                                 echo "Yes, it can."
17903                                 val="$define"
17904                         else
17905                                 echo "It can't, sorry."
17906                         fi
17907                 else
17908                         echo "(I can't compile the test program, so we'll assume not...)"
17909                 fi
17910                 ;;
17911         esac
17912         $rm_try
17913         ;;
17914 esac
17915 set d_safemcpy
17916 eval $setvar
17917
17918 : can memcmp be trusted to compare relative magnitude?
17919 val="$undef"
17920 case "$d_memcmp" in
17921 "$define")
17922         echo " "
17923         echo "Checking if your memcmp() can compare relative magnitude..." >&4
17924         $cat >try.c <<EOCP
17925 #$i_memory I_MEMORY
17926 #$i_stdlib I_STDLIB
17927 #$i_string I_STRING
17928 #$i_unistd I_UNISTD
17929 EOCP
17930         $cat >>try.c <<'EOCP'
17931 #include <stdio.h>
17932 #ifdef I_MEMORY
17933 #  include <memory.h>
17934 #endif
17935 #ifdef I_STDLIB
17936 #  include <stdlib.h>
17937 #endif
17938 #ifdef I_STRING
17939 #  include <string.h>
17940 #else
17941 #  include <strings.h>
17942 #endif
17943 #ifdef I_UNISTD
17944 #  include <unistd.h>  /* Needed for NetBSD */
17945 #endif
17946 int main()
17947 {
17948 char a = -1;
17949 char b = 0;
17950 if ((a < b) && memcmp(&a, &b, 1) < 0)
17951         exit(1);
17952 exit(0);
17953 }
17954 EOCP
17955         set try
17956         if eval $compile_ok; then
17957                 if $run ./try 2>/dev/null; then
17958                         echo "Yes, it can."
17959                         val="$define"
17960                 else
17961                         echo "No, it can't (it uses signed chars)."
17962                 fi
17963         else
17964                 echo "(I can't compile the test program, so we'll assume not...)"
17965         fi
17966         ;;
17967 esac
17968 $rm_try
17969 set d_sanemcmp
17970 eval $setvar
17971
17972 : see if prototype for sbrk is available
17973 echo " "
17974 set d_sbrkproto sbrk $i_unistd unistd.h
17975 eval $hasproto
17976
17977 : see if scalbn exists
17978 set scalbn d_scalbn
17979 eval $inlibc
17980
17981 : see if select exists
17982 set select d_select
17983 eval $inlibc
17984
17985 : see if semctl exists
17986 set semctl d_semctl
17987 eval $inlibc
17988
17989 : see if semget exists
17990 set semget d_semget
17991 eval $inlibc
17992
17993 : see if semop exists
17994 set semop d_semop
17995 eval $inlibc
17996
17997 : see how much of the 'sem*(2)' library is present.
17998 h_sem=true
17999 echo " "
18000 case "$d_semctl$d_semget$d_semop" in
18001 *"$undef"*) h_sem=false;;
18002 esac
18003 case "$osname" in
18004 freebsd)
18005     case "`ipcs 2>&1`" in
18006     "SVID messages"*"not configured"*)
18007         echo "Your $osname does not have the sem*(2) configured." >&4
18008         h_sem=false
18009         val="$undef"
18010         set semctl d_semctl
18011         eval $setvar
18012         set semget d_semget
18013         eval $setvar
18014         set semop d_semop
18015         eval $setvar
18016         ;;
18017     esac
18018     ;;
18019 esac
18020 : we could also check for sys/ipc.h ...
18021 if $h_sem && $test `./findhdr sys/sem.h`; then
18022         echo "You have the full sem*(2) library." >&4
18023         val="$define"
18024 else
18025         echo "You don't have the full sem*(2) library." >&4
18026         val="$undef"
18027 fi
18028 set d_sem
18029 eval $setvar
18030
18031 : see whether sys/sem.h defines union semun
18032 echo " "
18033 $cat > try.c <<'END'
18034 #include <sys/types.h>
18035 #include <sys/ipc.h>
18036 #include <sys/sem.h>
18037 int main () { union semun semun; semun.buf = 0; }
18038 END
18039 set try
18040 if eval $compile; then
18041     echo "You have union semun in <sys/sem.h>." >&4
18042     val="$define"
18043 else
18044     echo "You do not have union semun in <sys/sem.h>." >&4
18045     val="$undef"
18046 fi
18047 $rm_try
18048 set d_union_semun
18049 eval $setvar
18050
18051 : see how to do semctl IPC_STAT
18052 case "$d_sem" in
18053 $define)
18054     echo " "
18055     $cat > tryh.h <<END
18056 #ifndef S_IRUSR
18057 #   ifdef S_IREAD
18058 #       define S_IRUSR S_IREAD
18059 #       define S_IWUSR S_IWRITE
18060 #       define S_IXUSR S_IEXEC
18061 #   else
18062 #       define S_IRUSR 0400
18063 #       define S_IWUSR 0200
18064 #       define S_IXUSR 0100
18065 #   endif
18066 #   define S_IRGRP (S_IRUSR>>3)
18067 #   define S_IWGRP (S_IWUSR>>3)
18068 #   define S_IXGRP (S_IXUSR>>3)
18069 #   define S_IROTH (S_IRUSR>>6)
18070 #   define S_IWOTH (S_IWUSR>>6)
18071 #   define S_IXOTH (S_IXUSR>>6)
18072 #endif
18073 #ifndef S_IRWXU
18074 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
18075 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
18076 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
18077 #endif
18078 END
18079     : see whether semctl IPC_STAT can use union semun
18080     case "$d_semctl_semun" in
18081     '')
18082       val="$undef"
18083       $cat > try.c <<END
18084 #include <sys/types.h>
18085 #include <sys/ipc.h>
18086 #include <sys/sem.h>
18087 #include <sys/stat.h>
18088 #include <stdio.h>
18089 #include <errno.h>
18090 #include "tryh.h"
18091 #ifndef errno
18092 extern int errno;
18093 #endif
18094 #$d_union_semun HAS_UNION_SEMUN
18095 int main() {
18096     union semun
18097 #ifndef HAS_UNION_SEMUN
18098     {
18099         int val;
18100         struct semid_ds *buf;
18101         unsigned short *array;
18102     }
18103 #endif
18104     arg;
18105     int sem, st;
18106
18107 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
18108     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18109     if (sem > -1) {
18110         struct semid_ds argbuf;
18111         arg.buf = &argbuf;
18112 #       ifdef IPC_STAT
18113         st = semctl(sem, 0, IPC_STAT, arg);
18114         if (st == 0)
18115             printf("semun\n");
18116         else
18117 #       endif /* IPC_STAT */
18118             printf("semctl IPC_STAT failed: errno = %d\n", errno);
18119 #       ifdef IPC_RMID
18120         if (semctl(sem, 0, IPC_RMID, arg) != 0)
18121 #       endif /* IPC_RMID */
18122             printf("semctl IPC_RMID failed: errno = %d\n", errno);
18123     } else
18124 #endif /* IPC_PRIVATE && ... */
18125         printf("semget failed: errno = %d\n", errno);
18126   return 0;
18127 }
18128 END
18129       set try
18130       if eval $compile; then
18131           xxx=`$run ./try`
18132           case "$xxx" in
18133           semun) val="$define" ;;
18134           esac
18135       fi
18136       $rm_try
18137       set d_semctl_semun
18138       eval $setvar
18139       ;;
18140     esac
18141     case "$d_semctl_semun" in
18142     $define)
18143         echo "You can use union semun for semctl IPC_STAT." >&4
18144         also='also'
18145         ;;
18146     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
18147         also=''
18148         ;;
18149     esac
18150
18151     : see whether semctl IPC_STAT can use struct semid_ds pointer
18152     case "$d_semctl_semid_ds" in
18153     '')
18154       val="$undef"
18155       $cat > try.c <<'END'
18156 #include <sys/types.h>
18157 #include <sys/ipc.h>
18158 #include <sys/sem.h>
18159 #include <sys/stat.h>
18160 #include "tryh.h"
18161 #include <stdio.h>
18162 #include <errno.h>
18163 #ifndef errno
18164 extern int errno;
18165 #endif
18166 int main() {
18167     struct semid_ds arg;
18168     int sem, st;
18169
18170 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
18171     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18172     if (sem > -1) {
18173 #       ifdef IPC_STAT
18174         st = semctl(sem, 0, IPC_STAT, &arg);
18175         if (st == 0)
18176             printf("semid_ds\n");
18177         else
18178 #       endif /* IPC_STAT */
18179             printf("semctl IPC_STAT failed: errno = %d\n", errno);
18180 #       ifdef IPC_RMID
18181         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
18182 #       endif /* IPC_RMID */
18183             printf("semctl IPC_RMID failed: errno = %d\n", errno);
18184     } else
18185 #endif /* IPC_PRIVATE && ... */
18186         printf("semget failed: errno = %d\n", errno);
18187
18188     return 0;
18189 }
18190 END
18191       set try
18192       if eval $compile; then
18193           xxx=`$run ./try`
18194           case "$xxx" in
18195           semid_ds) val="$define" ;;
18196           esac
18197       fi
18198       $rm_try
18199       set d_semctl_semid_ds
18200       eval $setvar
18201       ;;
18202     esac
18203     case "$d_semctl_semid_ds" in
18204     $define)
18205         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
18206         ;;
18207     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
18208         ;;
18209     esac
18210     ;;
18211 *)  val="$undef"
18212
18213     # We do not have the full sem*(2) library, so assume we can not
18214     # use either.
18215
18216     set d_semctl_semun
18217     eval $setvar
18218
18219     set d_semctl_semid_ds
18220     eval $setvar
18221     ;;
18222 esac
18223 $rm_try tryh.h
18224
18225 : see if sendmsg exists
18226 set sendmsg d_sendmsg
18227 eval $inlibc
18228
18229 : see if setegid exists
18230 set setegid d_setegid
18231 eval $inlibc
18232
18233 : see if seteuid exists
18234 set seteuid d_seteuid
18235 eval $inlibc
18236
18237 : see if setgrent exists
18238 set setgrent d_setgrent
18239 eval $inlibc
18240
18241 : see if setgrent_r exists
18242 set setgrent_r d_setgrent_r
18243 eval $inlibc
18244 case "$d_setgrent_r" in
18245 "$define")
18246         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
18247         case "$d_setgrent_r_proto:$usethreads" in
18248         ":define")      d_setgrent_r_proto=define
18249                 set d_setgrent_r_proto setgrent_r $hdrs
18250                 eval $hasproto ;;
18251         *)      ;;
18252         esac
18253         case "$d_setgrent_r_proto" in
18254         define)
18255         case "$setgrent_r_proto" in
18256         ''|0) try='int setgrent_r(FILE**);'
18257         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
18258         esac
18259         case "$setgrent_r_proto" in
18260         ''|0) try='void setgrent_r(FILE**);'
18261         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
18262         esac
18263         case "$setgrent_r_proto" in
18264         ''|0)   d_setgrent_r=undef
18265                 setgrent_r_proto=0
18266                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
18267         * )     case "$setgrent_r_proto" in
18268                 REENTRANT_PROTO*) ;;
18269                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
18270                 esac
18271                 echo "Prototype: $try" ;;
18272         esac
18273         ;;
18274         *)      case "$usethreads" in
18275                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
18276                 esac
18277                 d_setgrent_r=undef
18278                 setgrent_r_proto=0
18279                 ;;
18280         esac
18281         ;;
18282 *)      setgrent_r_proto=0
18283         ;;
18284 esac
18285
18286 : see if sethostent exists
18287 set sethostent d_sethent
18288 eval $inlibc
18289
18290 : see if sethostent_r exists
18291 set sethostent_r d_sethostent_r
18292 eval $inlibc
18293 case "$d_sethostent_r" in
18294 "$define")
18295         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18296         case "$d_sethostent_r_proto:$usethreads" in
18297         ":define")      d_sethostent_r_proto=define
18298                 set d_sethostent_r_proto sethostent_r $hdrs
18299                 eval $hasproto ;;
18300         *)      ;;
18301         esac
18302         case "$d_sethostent_r_proto" in
18303         define)
18304         case "$sethostent_r_proto" in
18305         ''|0) try='int sethostent_r(int, struct hostent_data*);'
18306         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
18307         esac
18308         case "$sethostent_r_proto" in
18309         ''|0) try='void sethostent_r(int, struct hostent_data*);'
18310         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
18311         esac
18312         case "$sethostent_r_proto" in
18313         ''|0)   d_sethostent_r=undef
18314                 sethostent_r_proto=0
18315                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
18316         * )     case "$sethostent_r_proto" in
18317                 REENTRANT_PROTO*) ;;
18318                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
18319                 esac
18320                 echo "Prototype: $try" ;;
18321         esac
18322         ;;
18323         *)      case "$usethreads" in
18324                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
18325                 esac
18326                 d_sethostent_r=undef
18327                 sethostent_r_proto=0
18328                 ;;
18329         esac
18330         ;;
18331 *)      sethostent_r_proto=0
18332         ;;
18333 esac
18334
18335 : see if setitimer exists
18336 set setitimer d_setitimer
18337 eval $inlibc
18338
18339 : see if setlinebuf exists
18340 set setlinebuf d_setlinebuf
18341 eval $inlibc
18342
18343 : see if setlocale exists
18344 set setlocale d_setlocale
18345 eval $inlibc
18346
18347 : see if locale.h is available
18348 set locale.h i_locale
18349 eval $inhdr
18350
18351 : see if setlocale_r exists
18352 set setlocale_r d_setlocale_r
18353 eval $inlibc
18354 case "$d_setlocale_r" in
18355 "$define")
18356         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18357         case "$d_setlocale_r_proto:$usethreads" in
18358         ":define")      d_setlocale_r_proto=define
18359                 set d_setlocale_r_proto setlocale_r $hdrs
18360                 eval $hasproto ;;
18361         *)      ;;
18362         esac
18363         case "$d_setlocale_r_proto" in
18364         define)
18365         case "$setlocale_r_proto" in
18366         ''|0) try='int setlocale_r(int, const char*, char*, int);'
18367         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18368         esac
18369         case "$setlocale_r_proto" in
18370         ''|0)   d_setlocale_r=undef
18371                 setlocale_r_proto=0
18372                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18373         * )     case "$setlocale_r_proto" in
18374                 REENTRANT_PROTO*) ;;
18375                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18376                 esac
18377                 echo "Prototype: $try" ;;
18378         esac
18379         ;;
18380         *)      case "$usethreads" in
18381                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18382                 esac
18383                 d_setlocale_r=undef
18384                 setlocale_r_proto=0
18385                 ;;
18386         esac
18387         ;;
18388 *)      setlocale_r_proto=0
18389         ;;
18390 esac
18391
18392 : see if setnetent exists
18393 set setnetent d_setnent
18394 eval $inlibc
18395
18396 : see if setnetent_r exists
18397 set setnetent_r d_setnetent_r
18398 eval $inlibc
18399 case "$d_setnetent_r" in
18400 "$define")
18401         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18402         case "$d_setnetent_r_proto:$usethreads" in
18403         ":define")      d_setnetent_r_proto=define
18404                 set d_setnetent_r_proto setnetent_r $hdrs
18405                 eval $hasproto ;;
18406         *)      ;;
18407         esac
18408         case "$d_setnetent_r_proto" in
18409         define)
18410         case "$setnetent_r_proto" in
18411         ''|0) try='int setnetent_r(int, struct netent_data*);'
18412         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18413         esac
18414         case "$setnetent_r_proto" in
18415         ''|0) try='void setnetent_r(int, struct netent_data*);'
18416         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18417         esac
18418         case "$setnetent_r_proto" in
18419         ''|0)   d_setnetent_r=undef
18420                 setnetent_r_proto=0
18421                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18422         * )     case "$setnetent_r_proto" in
18423                 REENTRANT_PROTO*) ;;
18424                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18425                 esac
18426                 echo "Prototype: $try" ;;
18427         esac
18428         ;;
18429         *)      case "$usethreads" in
18430                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18431                 esac
18432                 d_setnetent_r=undef
18433                 setnetent_r_proto=0
18434                 ;;
18435         esac
18436         ;;
18437 *)      setnetent_r_proto=0
18438         ;;
18439 esac
18440
18441 : see if setprotoent exists
18442 set setprotoent d_setpent
18443 eval $inlibc
18444
18445 : see if setpgid exists
18446 set setpgid d_setpgid
18447 eval $inlibc
18448
18449 : see if setpgrp2 exists
18450 set setpgrp2 d_setpgrp2
18451 eval $inlibc
18452
18453 : see if setpriority exists
18454 set setpriority d_setprior
18455 eval $inlibc
18456
18457 : see if setproctitle exists
18458 set setproctitle d_setproctitle
18459 eval $inlibc
18460
18461 : see if setprotoent_r exists
18462 set setprotoent_r d_setprotoent_r
18463 eval $inlibc
18464 case "$d_setprotoent_r" in
18465 "$define")
18466         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18467         case "$d_setprotoent_r_proto:$usethreads" in
18468         ":define")      d_setprotoent_r_proto=define
18469                 set d_setprotoent_r_proto setprotoent_r $hdrs
18470                 eval $hasproto ;;
18471         *)      ;;
18472         esac
18473         case "$d_setprotoent_r_proto" in
18474         define)
18475         case "$setprotoent_r_proto" in
18476         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18477         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18478         esac
18479         case "$setprotoent_r_proto" in
18480         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18481         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18482         esac
18483         case "$setprotoent_r_proto" in
18484         ''|0)   d_setprotoent_r=undef
18485                 setprotoent_r_proto=0
18486                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18487         * )     case "$setprotoent_r_proto" in
18488                 REENTRANT_PROTO*) ;;
18489                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18490                 esac
18491                 echo "Prototype: $try" ;;
18492         esac
18493         ;;
18494         *)      case "$usethreads" in
18495                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18496                 esac
18497                 d_setprotoent_r=undef
18498                 setprotoent_r_proto=0
18499                 ;;
18500         esac
18501         ;;
18502 *)      setprotoent_r_proto=0
18503         ;;
18504 esac
18505
18506 : see if setpwent exists
18507 set setpwent d_setpwent
18508 eval $inlibc
18509
18510 : see if setpwent_r exists
18511 set setpwent_r d_setpwent_r
18512 eval $inlibc
18513 case "$d_setpwent_r" in
18514 "$define")
18515         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18516         case "$d_setpwent_r_proto:$usethreads" in
18517         ":define")      d_setpwent_r_proto=define
18518                 set d_setpwent_r_proto setpwent_r $hdrs
18519                 eval $hasproto ;;
18520         *)      ;;
18521         esac
18522         case "$d_setpwent_r_proto" in
18523         define)
18524         case "$setpwent_r_proto" in
18525         ''|0) try='int setpwent_r(FILE**);'
18526         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18527         esac
18528         case "$setpwent_r_proto" in
18529         ''|0) try='void setpwent_r(FILE**);'
18530         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18531         esac
18532         case "$setpwent_r_proto" in
18533         ''|0)   d_setpwent_r=undef
18534                 setpwent_r_proto=0
18535                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18536         * )     case "$setpwent_r_proto" in
18537                 REENTRANT_PROTO*) ;;
18538                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18539                 esac
18540                 echo "Prototype: $try" ;;
18541         esac
18542         ;;
18543         *)      case "$usethreads" in
18544                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18545                 esac
18546                 d_setpwent_r=undef
18547                 setpwent_r_proto=0
18548                 ;;
18549         esac
18550         ;;
18551 *)      setpwent_r_proto=0
18552         ;;
18553 esac
18554
18555 : see if setregid exists
18556 set setregid d_setregid
18557 eval $inlibc
18558 set setresgid d_setresgid
18559 eval $inlibc
18560
18561 : see if setreuid exists
18562 set setreuid d_setreuid
18563 eval $inlibc
18564 set setresuid d_setresuid
18565 eval $inlibc
18566
18567 : see if setrgid exists
18568 set setrgid d_setrgid
18569 eval $inlibc
18570
18571 : see if setruid exists
18572 set setruid d_setruid
18573 eval $inlibc
18574
18575 : see if setservent exists
18576 set setservent d_setsent
18577 eval $inlibc
18578
18579 : see if setservent_r exists
18580 set setservent_r d_setservent_r
18581 eval $inlibc
18582 case "$d_setservent_r" in
18583 "$define")
18584         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18585         case "$d_setservent_r_proto:$usethreads" in
18586         ":define")      d_setservent_r_proto=define
18587                 set d_setservent_r_proto setservent_r $hdrs
18588                 eval $hasproto ;;
18589         *)      ;;
18590         esac
18591         case "$d_setservent_r_proto" in
18592         define)
18593         case "$setservent_r_proto" in
18594         ''|0) try='int setservent_r(int, struct servent_data*);'
18595         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18596         esac
18597         case "$setservent_r_proto" in
18598         ''|0) try='void setservent_r(int, struct servent_data*);'
18599         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18600         esac
18601         case "$setservent_r_proto" in
18602         ''|0)   d_setservent_r=undef
18603                 setservent_r_proto=0
18604                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18605         * )     case "$setservent_r_proto" in
18606                 REENTRANT_PROTO*) ;;
18607                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18608                 esac
18609                 echo "Prototype: $try" ;;
18610         esac
18611         ;;
18612         *)      case "$usethreads" in
18613                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18614                 esac
18615                 d_setservent_r=undef
18616                 setservent_r_proto=0
18617                 ;;
18618         esac
18619         ;;
18620 *)      setservent_r_proto=0
18621         ;;
18622 esac
18623
18624 : see if setsid exists
18625 set setsid d_setsid
18626 eval $inlibc
18627
18628 : see if setvbuf exists
18629 set setvbuf d_setvbuf
18630 eval $inlibc
18631
18632 : see if shmctl exists
18633 set shmctl d_shmctl
18634 eval $inlibc
18635
18636 : see if shmget exists
18637 set shmget d_shmget
18638 eval $inlibc
18639
18640 : see if shmat exists
18641 set shmat d_shmat
18642 eval $inlibc
18643 : see what shmat returns
18644 case "$d_shmat" in
18645 "$define")
18646         $cat >shmat.c <<'END'
18647 #include <sys/shm.h>
18648 void *shmat();
18649 END
18650         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18651                 shmattype='void *'
18652         else
18653                 shmattype='char *'
18654         fi
18655         echo "and it returns ($shmattype)." >&4
18656         : see if a prototype for shmat is available
18657         xxx=`./findhdr sys/shm.h`
18658         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18659         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18660                 val="$define"
18661         else
18662                 val="$undef"
18663         fi
18664         $rm -f shmat.[co]
18665         ;;
18666 *)
18667         val="$undef"
18668         ;;
18669 esac
18670 set d_shmatprototype
18671 eval $setvar
18672
18673 : see if shmdt exists
18674 set shmdt d_shmdt
18675 eval $inlibc
18676
18677 : see how much of the 'shm*(2)' library is present.
18678 h_shm=true
18679 echo " "
18680 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18681 *"$undef"*) h_shm=false;;
18682 esac
18683 case "$osname" in
18684 freebsd)
18685     case "`ipcs 2>&1`" in
18686     "SVID shared memory"*"not configured"*)
18687         echo "Your $osname does not have the shm*(2) configured." >&4
18688         h_shm=false
18689         val="$undef"
18690         set shmctl d_shmctl
18691         eval $setvar
18692         set shmget d_shmget
18693         eval $setvar
18694         set shmat d_shmat
18695         eval $setvar
18696         set shmdt d_shmdt
18697         eval $setvar
18698         ;;
18699     esac
18700     ;;
18701 esac
18702 : we could also check for sys/ipc.h ...
18703 if $h_shm && $test `./findhdr sys/shm.h`; then
18704         echo "You have the full shm*(2) library." >&4
18705         val="$define"
18706 else
18707         echo "You don't have the full shm*(2) library." >&4
18708         val="$undef"
18709 fi
18710 set d_shm
18711 eval $setvar
18712
18713 : see if we have sigaction
18714 echo " "
18715 if set sigaction val -f d_sigaction; eval $csym; $val; then
18716         echo 'sigaction() found.' >&4
18717         $cat > try.c <<EOP
18718 #include <stdio.h>
18719 #include <sys/types.h>
18720 #include <signal.h>
18721 #$i_stdlib I_STDLIB
18722 #ifdef I_STDLIB
18723 #include <stdlib.h>
18724 #endif
18725 int main()
18726 {
18727     struct sigaction act, oact;
18728     act.sa_flags = 0;
18729     oact.sa_handler = 0;
18730     /* so that act and oact are used */
18731     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18732 }
18733 EOP
18734         set try
18735         if eval $compile_ok; then
18736                 val="$define"
18737         else
18738                 echo "But you don't seem to have a usable struct sigaction." >&4
18739                 val="$undef"
18740         fi
18741 else
18742         echo 'sigaction NOT found.' >&4
18743         val="$undef"
18744 fi
18745 set d_sigaction; eval $setvar
18746 $rm_try
18747
18748 : see what type pids are declared as in the kernel
18749 rp="What is the type of process ids on this system?"
18750 set pid_t pidtype int stdio.h sys/types.h
18751 eval $typedef_ask
18752
18753 : see what type uids are declared as in the kernel
18754 echo " "
18755 echo "Looking for the type for user ids returned by getuid()."
18756 set uid_t uidtype xxx stdio.h sys/types.h
18757 eval $typedef
18758 case "$uidtype" in
18759 xxx)
18760         xxx=`./findhdr sys/user.h`
18761         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18762         case $1 in
18763         unsigned) dflt="$1 $2" ;;
18764         *) dflt="$1" ;;
18765         esac
18766         ;;
18767 *) dflt="$uidtype";;
18768 esac
18769 case "$uidtype" in
18770 uid_t)  echo "uid_t found." ;;
18771 *)      rp="What is the type for user ids returned by getuid()?"
18772         . ./myread
18773         uidtype="$ans"
18774         ;;
18775 esac
18776
18777 : Define hasfield_t macro for Configure internal use
18778 hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
18779 while $test $# -ge 2; do
18780     case "$1" in
18781         $define) echo "#include <$2>";;
18782     esac ;
18783     shift 2;
18784 done > try.c;
18785 echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
18786 set try;
18787 if eval $compile; then
18788         val="$define";
18789 else
18790         val="$undef";
18791 fi;
18792 set $varname;
18793 eval $setvar;
18794 $rm_try'
18795
18796 : see what siginfo fields we have
18797 case "$d_sigaction" in
18798 "$define")
18799         echo "Checking if your siginfo_t has si_errno field...">&4
18800         set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
18801         eval $hasfield_t;
18802
18803         echo "Checking if your siginfo_t has si_pid field...">&4
18804         set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
18805         eval $hasfield_t;
18806
18807         echo "Checking if your siginfo_t has si_uid field...">&4
18808         set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
18809         eval $hasfield_t;
18810
18811         echo "Checking if your siginfo_t has si_addr field...">&4
18812         set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
18813         eval $hasfield_t;
18814
18815         echo "Checking if your siginfo_t has si_status field...">&4
18816         set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
18817         eval $hasfield_t;
18818
18819         echo "Checking if your siginfo_t has si_band field...">&4
18820         set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
18821         eval $hasfield_t;
18822
18823         echo "Checking if your siginfo_t has si_value field...">&4
18824         set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
18825         eval $hasfield_t;
18826
18827         echo "Checking if your siginfo_t has si_fd field...">&4
18828         set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
18829         eval $hasfield_t;
18830
18831         ;;
18832 *)
18833         d_siginfo_si_errno="$undef"
18834         d_siginfo_si_pid="$undef"
18835         d_siginfo_si_uid="$undef"
18836         d_siginfo_si_addr="$undef"
18837         d_siginfo_si_status="$undef"
18838         d_siginfo_si_band="$undef"
18839         d_siginfo_si_value="$undef"
18840         d_siginfo_si_fd="$undef"
18841         ;;
18842 esac
18843
18844 : see if this is a sunmath.h system
18845 set sunmath.h i_sunmath
18846 eval $inhdr
18847
18848 : see if signbit exists
18849 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18850 $cat >try.c <<EOCP
18851 #$i_math I_MATH
18852 #$i_sunmath I_SUNMATH
18853 #ifdef I_MATH
18854 #  include <math.h>
18855 #endif
18856 #ifdef I_SUNMATH  /* Solaris special math library */
18857 #  include <sunmath.h>
18858 #endif
18859 #define NV $nvtype
18860 int main(int argc, char **argv)
18861 {
18862     NV x = 0.0;
18863     NV y = -1.0;
18864     if ((signbit(x) == 0) && (signbit(y) != 0))
18865         return 0;
18866     else
18867         return 1;
18868 }
18869 EOCP
18870 val="$undef"
18871 set try
18872 if eval $compile; then
18873     if $run ./try; then
18874         $echo "Yes." >&4
18875         val="$define"
18876     else
18877         $echo "Signbit seems to be available, but doesn't work as I expected."
18878         $echo "I won't use it." >&4
18879         val="$undef"
18880     fi
18881 else
18882     $echo "Nope." >&4
18883     dflt="$undef"
18884 fi
18885 set d_signbit
18886 eval $setvar
18887 $rm_try
18888
18889 : see if sigprocmask exists
18890 set sigprocmask d_sigprocmask
18891 eval $inlibc
18892
18893 : see if sigsetjmp exists
18894 echo " "
18895 case "$d_sigsetjmp" in
18896 '')
18897         $cat >try.c <<EOP
18898 #include <setjmp.h>
18899 #$i_stdlib I_STDLIB
18900 #ifdef I_STDLIB
18901 #include <stdlib.h>
18902 #endif
18903 sigjmp_buf env;
18904 int set = 1;
18905 int main()
18906 {
18907         if (sigsetjmp(env,1))
18908                 exit(set);
18909         set = 0;
18910         siglongjmp(env, 1);
18911         exit(1);
18912 }
18913 EOP
18914         set try
18915         if eval $compile; then
18916                 if $run ./try >/dev/null 2>&1; then
18917                         echo "POSIX sigsetjmp found." >&4
18918                         val="$define"
18919                 else
18920                         $cat >&4 <<EOM
18921 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18922 I'll ignore them.
18923 EOM
18924                         val="$undef"
18925                 fi
18926         else
18927                 echo "sigsetjmp not found." >&4
18928                 val="$undef"
18929         fi
18930         ;;
18931 *) val="$d_sigsetjmp"
18932         case "$d_sigsetjmp" in
18933         $define) echo "POSIX sigsetjmp found." >&4;;
18934         $undef) echo "sigsetjmp not found." >&4;;
18935         esac
18936         ;;
18937 esac
18938 set d_sigsetjmp
18939 eval $setvar
18940 $rm_try
18941
18942 : see if snprintf exists
18943 set snprintf d_snprintf
18944 eval $inlibc
18945
18946 : see if vsnprintf exists
18947 set vsnprintf d_vsnprintf
18948 eval $inlibc
18949
18950 case "$d_snprintf-$d_vsnprintf" in
18951 "$define-$define")
18952     $cat <<EOM
18953 Checking whether your snprintf() and vsnprintf() work okay...
18954 EOM
18955     $cat >try.c <<'EOCP'
18956 /* v?snprintf testing logic courtesy of Russ Allbery.
18957  * According to C99:
18958  * - if the buffer is too short it still must be \0-terminated
18959  * - if the buffer is too short the potentially required length
18960  *   must be returned and not -1
18961  * - if the buffer is NULL the potentially required length
18962  *   must be returned and not -1 or core dump
18963  */
18964 #include <stdio.h>
18965 #include <stdarg.h>
18966
18967 char buf[2];
18968
18969 int test (char *format, ...)
18970 {
18971     va_list args;
18972     int count;
18973
18974     va_start (args, format);
18975     count = vsnprintf (buf, sizeof buf, format, args);
18976     va_end (args);
18977     return count;
18978 }
18979
18980 int main ()
18981 {
18982     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18983              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18984 }
18985 EOCP
18986     set try
18987     if eval $compile; then
18988         `$run ./try`
18989         case "$?" in
18990         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18991         *) cat <<EOM >&4
18992 Your snprintf() and snprintf() don't seem to be working okay.
18993 EOM
18994            d_snprintf="$undef"
18995            d_vsnprintf="$undef"
18996            ;;
18997         esac
18998     else
18999         echo "(I can't seem to compile the test program--assuming they don't)"
19000         d_snprintf="$undef"
19001         d_vsnprintf="$undef"
19002     fi
19003     $rm_try
19004     ;;
19005 esac
19006
19007 : see if sockatmark exists
19008 set sockatmark d_sockatmark
19009 eval $inlibc
19010
19011 : see if prototype for sockatmark is available
19012 echo " "
19013 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
19014 eval $hasproto
19015
19016 : see if socks5_init exists
19017 set socks5_init d_socks5_init
19018 eval $inlibc
19019
19020 : see if sprintf returns the length of the string in the buffer as per ANSI
19021 $echo "Checking whether sprintf returns the length of the string..." >&4
19022 $cat <<EOP >try.c
19023 #include <stdio.h>
19024 #$i_stdlib I_STDLIB
19025 #ifdef I_STDLIB
19026 #include <stdlib.h>
19027 #endif
19028 #$i_string I_STRING
19029 #ifdef I_STRING
19030 #  include <string.h>
19031 #else
19032 #  include <strings.h>
19033 #endif
19034 #$i_math I_MATH
19035 #ifdef I_MATH
19036 #include <math.h>
19037 #endif
19038
19039 char buffer[256];
19040
19041 int check (size_t expect, int test) {
19042   size_t got = strlen(buffer);
19043   if (expect == got)
19044     return 0;
19045
19046   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
19047        test, buffer);
19048   exit (test);
19049 }
19050
19051 int main(int argc, char **argv) {
19052   int test = 0;
19053
19054   check(sprintf(buffer, ""), ++test);
19055   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
19056   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
19057
19058   return 0;
19059 }
19060 EOP
19061 set try
19062
19063 if eval $compile; then
19064     xxx="`$run ./try`"
19065     case "$?" in
19066         0) cat >&4 <<EOM
19067 sprintf returns the length of the string (as ANSI says it should)
19068 EOM
19069         d_sprintf_returns_strlen="$define"
19070         ;;
19071         *) cat >&4 <<EOM
19072 sprintf does not return the length of the string (how old is this system?)
19073 EOM
19074         d_sprintf_returns_strlen="$undef"
19075         ;;
19076     esac
19077 else
19078     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
19079     d_sprintf_returns_strlen="$undef"
19080 fi
19081 $rm_try
19082
19083 : see if srand48_r exists
19084 set srand48_r d_srand48_r
19085 eval $inlibc
19086 case "$d_srand48_r" in
19087 "$define")
19088         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
19089         case "$d_srand48_r_proto:$usethreads" in
19090         ":define")      d_srand48_r_proto=define
19091                 set d_srand48_r_proto srand48_r $hdrs
19092                 eval $hasproto ;;
19093         *)      ;;
19094         esac
19095         case "$d_srand48_r_proto" in
19096         define)
19097         case "$srand48_r_proto" in
19098         ''|0) try='int srand48_r(long, struct drand48_data*);'
19099         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
19100         esac
19101         case "$srand48_r_proto" in
19102         ''|0)   d_srand48_r=undef
19103                 srand48_r_proto=0
19104                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
19105         * )     case "$srand48_r_proto" in
19106                 REENTRANT_PROTO*) ;;
19107                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
19108                 esac
19109                 echo "Prototype: $try" ;;
19110         esac
19111         ;;
19112         *)      case "$usethreads" in
19113                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
19114                 esac
19115                 d_srand48_r=undef
19116                 srand48_r_proto=0
19117                 ;;
19118         esac
19119         ;;
19120 *)      srand48_r_proto=0
19121         ;;
19122 esac
19123
19124 : see if srandom_r exists
19125 set srandom_r d_srandom_r
19126 eval $inlibc
19127 case "$d_srandom_r" in
19128 "$define")
19129         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
19130         case "$d_srandom_r_proto:$usethreads" in
19131         ":define")      d_srandom_r_proto=define
19132                 set d_srandom_r_proto srandom_r $hdrs
19133                 eval $hasproto ;;
19134         *)      ;;
19135         esac
19136         case "$d_srandom_r_proto" in
19137         define)
19138         case "$srandom_r_proto" in
19139         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
19140         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
19141         esac
19142         case "$srandom_r_proto" in
19143         ''|0)   d_srandom_r=undef
19144                 srandom_r_proto=0
19145                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
19146         * )     case "$srandom_r_proto" in
19147                 REENTRANT_PROTO*) ;;
19148                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
19149                 esac
19150                 echo "Prototype: $try" ;;
19151         esac
19152         ;;
19153         *)      case "$usethreads" in
19154                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
19155                 esac
19156                 d_srandom_r=undef
19157                 srandom_r_proto=0
19158                 ;;
19159         esac
19160         ;;
19161 *)      srandom_r_proto=0
19162         ;;
19163 esac
19164
19165 : see if prototype for setresgid is available
19166 echo " "
19167 set d_sresgproto setresgid $i_unistd unistd.h
19168 eval $hasproto
19169
19170 : see if prototype for setresuid is available
19171 echo " "
19172 set d_sresuproto setresuid $i_unistd unistd.h
19173 eval $hasproto
19174
19175 : see if stat exists
19176 set stat d_stat
19177 eval $inlibc
19178
19179 : see if sys/stat.h is available
19180 set sys/stat.h i_sysstat
19181 eval $inhdr
19182
19183 : see if stat knows about block sizes
19184 echo " "
19185 echo "Checking to see if your struct stat has st_blocks field..." >&4
19186 set d_statblks stat st_blocks $i_sysstat sys/stat.h
19187 eval $hasfield
19188
19189 : see if this is a sys/vfs.h system
19190 set sys/vfs.h i_sysvfs
19191 eval $inhdr
19192
19193 : see if this is a sys/statfs.h system
19194 set sys/statfs.h i_sysstatfs
19195 eval $inhdr
19196
19197 : Check for statfs_s
19198 echo " "
19199 echo "Checking to see if your system supports struct statfs..." >&4
19200 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
19201 eval $hasstruct
19202 case "$d_statfs_s" in
19203 "$define")      echo "Yes, it does."   ;;
19204 *)              echo "No, it doesn't." ;;
19205 esac
19206
19207
19208 : see if struct statfs knows about f_flags
19209 case "$d_statfs_s" in
19210 define)
19211         echo " "
19212         echo "Checking to see if your struct statfs has f_flags field..." >&4
19213         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
19214         eval $hasfield
19215         ;;
19216 *)      val="$undef"
19217         set d_statfs_f_flags
19218         eval $setvar
19219         ;;
19220 esac
19221 case "$d_statfs_f_flags" in
19222 "$define")      echo "Yes, it does."   ;;
19223 *)              echo "No, it doesn't." ;;
19224 esac
19225
19226 : see what flavor, if any, of static inline is supported
19227 echo " "
19228 echo "Checking to see if your system supports static inline..."
19229 $cat > try.c <<'EOCP'
19230 #include <stdlib.h>
19231 extern int f_via_a(int x);
19232 extern int f_via_b(int x);
19233 int main(int argc, char **argv)
19234 {
19235     int y;
19236
19237     y = f_via_a(0);
19238 #ifdef USE_B
19239     y = f_via_b(0);
19240 #endif
19241     if (y == 42) {
19242         return EXIT_SUCCESS;
19243     }
19244     else {
19245         return EXIT_FAILURE;
19246     }
19247 }
19248 EOCP
19249 $cat > a.c <<'EOCP'
19250 static INLINE int f(int x) {
19251     int y;
19252     y = x + 42;
19253     return y;
19254 }
19255
19256 int f_via_a(int x)
19257 {
19258     return f(x);
19259 }
19260 EOCP
19261 $cat > b.c <<'EOCP'
19262 extern int f(int x);
19263
19264 int f_via_b(int x)
19265 {
19266     return f(x);
19267 }
19268 EOCP
19269
19270 # Respect a hint (or previous) value for perl_static_inline, if there is one.
19271 case "$perl_static_inline" in
19272 '')     # Check the various possibilities, and break out on success.
19273         # For gcc, prefer __inline__, which will still permit
19274         # cflags.SH to add in -ansi.
19275         case "$gccversion" in
19276                 '') xxx="inline __inline__ __inline _inline";;
19277                 *)  xxx="__inline__ inline __inline _inline";;
19278         esac
19279         for inline in $xxx; do
19280                 set try -DINLINE=$inline a.c
19281                 if eval $compile && $run ./try; then
19282                         # Now make sure there is no external linkage of static
19283                         # functions
19284                         set try -DINLINE=$inline -DUSE_B a.c b.c
19285                         if eval $compile && $run ./try; then
19286                                 $echo "Your compiler supports static $inline, " >&4
19287                                 $echo "but it also creates an external definition," >&4
19288                                 $echo "so I won't use it." >&4
19289                                 val=$undef
19290                         else
19291                                 $echo "Your compiler supports static $inline." >&4
19292                                 val=$define
19293                                 perl_static_inline="static $inline";
19294                                 break;
19295                         fi
19296                 else
19297                         $echo "Your compiler does NOT support static $inline." >&4
19298                         val="$undef"
19299                 fi
19300         done
19301         ;;
19302 *inline*) # Some variant of inline exists.
19303         echo "Keeping your $hint value of $perl_static_inline."
19304         val=$define
19305         ;;
19306 static)  # No inline capabilities
19307         echo "Keeping your $hint value of $perl_static_inline."
19308         val=$undef
19309         ;;
19310 *)  # Unrecognized previous value -- blindly trust the supplied
19311         # value and hope it makes sense.  Use old value for
19312         # d_static_inline, if there is one.
19313         echo "Keeping your $hint value of $perl_static_inline."
19314         case "$d_static_inline" in
19315                 '') val=$define ;;
19316                 *)  val=$d_static_inline ;;
19317         esac
19318         ;;
19319 esac
19320 # Fallback to plain 'static' if nothing worked.
19321 case "$perl_static_inline" in
19322 '')
19323         perl_static_inline="static"
19324         val=$undef
19325         ;;
19326 esac
19327 set d_static_inline
19328 eval $setvar
19329 $rm -f a.[co] b.[co]
19330 $rm_try
19331
19332 : Check stream access
19333 $cat >&4 <<EOM
19334 Checking how to access stdio streams by file descriptor number...
19335 EOM
19336 case "$stdio_stream_array" in
19337 '')     $cat >try.c <<EOCP
19338 #include <stdio.h>
19339 int main() {
19340   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
19341     printf("yes\n");
19342 }
19343 EOCP
19344         for s in _iob __iob __sF
19345         do
19346                 set try -DSTDIO_STREAM_ARRAY=$s
19347                 if eval $compile; then
19348                         case "`$run ./try`" in
19349                         yes)    stdio_stream_array=$s; break ;;
19350                         esac
19351                 fi
19352         done
19353         $rm_try
19354 esac
19355 case "$stdio_stream_array" in
19356 '')     $cat >&4 <<EOM
19357 I can't figure out how to access stdio streams by file descriptor number.
19358 EOM
19359         d_stdio_stream_array="$undef"
19360         ;;
19361 *)      $cat >&4 <<EOM
19362 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
19363 EOM
19364         d_stdio_stream_array="$define"
19365         ;;
19366 esac
19367
19368 : see if strcoll exists
19369 set strcoll d_strcoll
19370 eval $inlibc
19371
19372 : check for structure copying
19373 echo " "
19374 echo "Checking to see if your C compiler can copy structs..." >&4
19375 $cat >try.c <<'EOCP'
19376 int main()
19377 {
19378         struct blurfl {
19379                 int dyick;
19380         } foo, bar;
19381
19382         foo = bar;
19383 }
19384 EOCP
19385 if $cc -c try.c >/dev/null 2>&1 ; then
19386         val="$define"
19387         echo "Yup, it can."
19388 else
19389         val="$undef"
19390         echo "Nope, it can't."
19391 fi
19392 set d_strctcpy
19393 eval $setvar
19394 $rm_try
19395
19396 : see if strerror and/or sys_errlist[] exist
19397 echo " "
19398 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
19399     if set strerror val -f d_strerror; eval $csym; $val; then
19400                 echo 'strerror() found.' >&4
19401                 d_strerror="$define"
19402                 d_strerrm='strerror(e)'
19403                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19404                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
19405                         d_syserrlst="$define"
19406                 else
19407                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
19408                         d_syserrlst="$undef"
19409                 fi
19410     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
19411                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
19412                 echo 'strerror() found in string header.' >&4
19413                 d_strerror="$define"
19414                 d_strerrm='strerror(e)'
19415                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19416                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
19417                                 d_syserrlst="$define"
19418                 else
19419                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
19420                         d_syserrlst="$undef"
19421                 fi
19422     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19423                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
19424                 d_strerror="$undef"
19425                 d_syserrlst="$define"
19426                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
19427     else
19428                 echo 'strerror() and sys_errlist[] NOT found.' >&4
19429                 d_strerror="$undef"
19430                 d_syserrlst="$undef"
19431                 d_strerrm='"unknown"'
19432     fi
19433 fi
19434
19435 : see if strerror_l exists
19436 set strerror_l d_strerror_l
19437 eval $inlibc
19438
19439 : see if strerror_r exists
19440 set strerror_r d_strerror_r
19441 eval $inlibc
19442 case "$d_strerror_r" in
19443 "$define")
19444         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
19445         case "$d_strerror_r_proto:$usethreads" in
19446         ":define")      d_strerror_r_proto=define
19447                 set d_strerror_r_proto strerror_r $hdrs
19448                 eval $hasproto ;;
19449         *)      ;;
19450         esac
19451         case "$d_strerror_r_proto" in
19452         define)
19453         case "$strerror_r_proto" in
19454         ''|0) try='int strerror_r(int, char*, size_t);'
19455         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
19456         esac
19457         case "$strerror_r_proto" in
19458         ''|0) try='int strerror_r(int, char*, int);'
19459         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
19460         esac
19461         case "$strerror_r_proto" in
19462         ''|0) try='char* strerror_r(int, char*, size_t);'
19463         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
19464         esac
19465         case "$strerror_r_proto" in
19466         ''|0)   d_strerror_r=undef
19467                 strerror_r_proto=0
19468                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19469         * )     case "$strerror_r_proto" in
19470                 REENTRANT_PROTO*) ;;
19471                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19472                 esac
19473                 echo "Prototype: $try" ;;
19474         esac
19475         ;;
19476         *)      case "$usethreads" in
19477                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
19478                 esac
19479                 d_strerror_r=undef
19480                 strerror_r_proto=0
19481                 ;;
19482         esac
19483         ;;
19484 *)      strerror_r_proto=0
19485         ;;
19486 esac
19487
19488 : see if strftime exists
19489 set strftime d_strftime
19490 eval $inlibc
19491
19492 : see if strlcat exists
19493 set strlcat d_strlcat
19494 eval $inlibc
19495
19496 : see if strlcpy exists
19497 set strlcpy d_strlcpy
19498 eval $inlibc
19499
19500 : see if strtod exists
19501 set strtod d_strtod
19502 eval $inlibc
19503
19504 : see if strtol exists
19505 set strtol d_strtol
19506 eval $inlibc
19507
19508 : see if strtold exists
19509 set strtold d_strtold
19510 eval $inlibc
19511
19512 : see if strtoll exists
19513 set strtoll d_strtoll
19514 eval $inlibc
19515
19516 case "$d_longlong-$d_strtoll" in
19517 "$define-$define")
19518         $cat <<EOM
19519 Checking whether your strtoll() works okay...
19520 EOM
19521         $cat >try.c <<'EOCP'
19522 #include <errno.h>
19523 #ifdef __hpux
19524 #define strtoll __strtoll
19525 #endif
19526 #ifdef __EMX__
19527 #define strtoll _strtoll
19528 #endif
19529 #include <stdio.h>
19530 extern long long int strtoll(char *s, char **, int);
19531 static int bad = 0;
19532 int check(char *s, long long ell, int een) {
19533         long long gll;
19534         errno = 0;
19535         gll = strtoll(s, 0, 10);
19536         if (!((gll == ell) && (errno == een)))
19537                 bad++;
19538 }
19539 int main() {
19540         check(" 1",                                      1LL, 0);
19541         check(" 0",                                      0LL, 0);
19542         check("-1",                                     -1LL, 0);
19543         check("-9223372036854775808", -9223372036854775808LL, 0);
19544         check("-9223372036854775808", -9223372036854775808LL, 0);
19545         check(" 9223372036854775807",  9223372036854775807LL, 0);
19546         check("-9223372036854775808", -9223372036854775808LL, 0);
19547         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19548         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19549         if (!bad)
19550                 printf("ok\n");
19551 }
19552 EOCP
19553         set try
19554         if eval $compile; then
19555                 yyy=`$run ./try`
19556                 case "$yyy" in
19557                 ok) echo "Your strtoll() seems to be working okay." ;;
19558                 *) cat <<EOM >&4
19559 Your strtoll() doesn't seem to be working okay.
19560 EOM
19561                    d_strtoll="$undef"
19562                    ;;
19563                 esac
19564         else
19565                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19566                 d_strtoll="$undef"
19567         fi
19568         ;;
19569 esac
19570
19571 : see if strtoq exists
19572 set strtoq d_strtoq
19573 eval $inlibc
19574
19575 : see if strtoul exists
19576 set strtoul d_strtoul
19577 eval $inlibc
19578
19579 case "$d_strtoul" in
19580 "$define")
19581         $cat <<EOM
19582 Checking whether your strtoul() works okay...
19583 EOM
19584         $cat >try.c <<'EOCP'
19585 #include <errno.h>
19586 #include <stdio.h>
19587 extern unsigned long int strtoul(char *s, char **, int);
19588 static int bad = 0;
19589 void check(char *s, unsigned long eul, int een) {
19590         unsigned long gul;
19591         errno = 0;
19592         gul = strtoul(s, 0, 10);
19593         if (!((gul == eul) && (errno == een)))
19594                 bad++;
19595 }
19596 int main() {
19597         check(" 1", 1L, 0);
19598         check(" 0", 0L, 0);
19599 EOCP
19600         case "$longsize" in
19601         8)
19602             $cat >>try.c <<'EOCP'
19603         check("18446744073709551615", 18446744073709551615UL, 0);
19604         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19605 #if 0 /* strtoul() for /^-/ strings is undefined. */
19606         check("-1", 18446744073709551615UL, 0);
19607         check("-18446744073709551614", 2, 0);
19608         check("-18446744073709551615", 1, 0);
19609         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19610         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19611 #endif
19612 EOCP
19613                 ;;
19614         4)
19615                     $cat >>try.c <<'EOCP'
19616         check("4294967295", 4294967295UL, 0);
19617         check("4294967296", 4294967295UL, ERANGE);
19618 #if 0 /* strtoul() for /^-/ strings is undefined. */
19619         check("-1", 4294967295UL, 0);
19620         check("-4294967294", 2, 0);
19621         check("-4294967295", 1, 0);
19622         check("-4294967296", 4294967295UL, ERANGE);
19623         check("-4294967297", 4294967295UL, ERANGE);
19624 #endif
19625 EOCP
19626                 ;;
19627         *)
19628 : Should we write these tests to be more portable by sprintf-ing
19629 : ~0 and then manipulating that char string as input for strtol?
19630                 ;;
19631         esac
19632         $cat >>try.c <<'EOCP'
19633         if (!bad)
19634                 printf("ok\n");
19635         return 0;
19636 }
19637 EOCP
19638         set try
19639         if eval $compile; then
19640                 case "`$run ./try`" in
19641                 ok) echo "Your strtoul() seems to be working okay." ;;
19642                 *) cat <<EOM >&4
19643 Your strtoul() doesn't seem to be working okay.
19644 EOM
19645                    d_strtoul="$undef"
19646                    ;;
19647                 esac
19648         else
19649                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19650                 d_strtoul="$undef"
19651         fi
19652         ;;
19653 esac
19654
19655 : see if strtoull exists
19656 set strtoull d_strtoull
19657 eval $inlibc
19658
19659 case "$d_longlong-$d_strtoull" in
19660 "$define-$define")
19661         $cat <<EOM
19662 Checking whether your strtoull() works okay...
19663 EOM
19664         $cat >try.c <<'EOCP'
19665 #include <errno.h>
19666 #ifdef __hpux
19667 #define strtoull __strtoull
19668 #endif
19669 #include <stdio.h>
19670 extern unsigned long long int strtoull(char *s, char **, int);
19671 static int bad = 0;
19672 int check(char *s, long long eull, int een) {
19673         long long gull;
19674         errno = 0;
19675         gull = strtoull(s, 0, 10);
19676         if (!((gull == eull) && (errno == een)))
19677                 bad++;
19678 }
19679 int main() {
19680         check(" 1",                                        1LL, 0);
19681         check(" 0",                                        0LL, 0);
19682         check("18446744073709551615",  18446744073709551615ULL, 0);
19683         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19684 #if 0 /* strtoull() for /^-/ strings is undefined. */
19685         check("-1",                    18446744073709551615ULL, 0);
19686         check("-18446744073709551614",                     2LL, 0);
19687         check("-18446744073709551615",                     1LL, 0);
19688         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19689         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19690 #endif
19691         if (!bad)
19692                 printf("ok\n");
19693 }
19694 EOCP
19695         set try
19696         if eval $compile; then
19697                 case "`$run ./try`" in
19698                 ok) echo "Your strtoull() seems to be working okay." ;;
19699                 *) cat <<EOM >&4
19700 Your strtoull() doesn't seem to be working okay.
19701 EOM
19702                    d_strtoull="$undef"
19703                    ;;
19704                 esac
19705         else
19706                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19707                 d_strtoull="$undef"
19708         fi
19709         ;;
19710 esac
19711
19712 : see if strtouq exists
19713 set strtouq d_strtouq
19714 eval $inlibc
19715
19716 case "$d_strtouq" in
19717 "$define")
19718         $cat <<EOM
19719 Checking whether your strtouq() works okay...
19720 EOM
19721         $cat >try.c <<'EOCP'
19722 #include <errno.h>
19723 #include <stdio.h>
19724 extern unsigned long long int strtouq(char *s, char **, int);
19725 static int bad = 0;
19726 void check(char *s, unsigned long long eull, int een) {
19727         unsigned long long gull;
19728         errno = 0;
19729         gull = strtouq(s, 0, 10);
19730         if (!((gull == eull) && (errno == een)))
19731                 bad++;
19732 }
19733 int main() {
19734         check(" 1",                                        1LL, 0);
19735         check(" 0",                                        0LL, 0);
19736         check("18446744073709551615",  18446744073709551615ULL, 0);
19737         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19738 #if 0 /* strtouq() for /^-/ strings is undefined. */
19739         check("-1",                    18446744073709551615ULL, 0);
19740         check("-18446744073709551614",                     2LL, 0);
19741         check("-18446744073709551615",                     1LL, 0);
19742         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19743         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19744 #endif
19745         if (!bad)
19746                 printf("ok\n");
19747         return 0;
19748 }
19749 EOCP
19750         set try
19751         if eval $compile; then
19752                 case "`$run ./try`" in
19753                 ok) echo "Your strtouq() seems to be working okay." ;;
19754                 *) cat <<EOM >&4
19755 Your strtouq() doesn't seem to be working okay.
19756 EOM
19757                    d_strtouq="$undef"
19758                    ;;
19759                 esac
19760         else
19761                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19762                 d_strtouq="$undef"
19763         fi
19764         ;;
19765 esac
19766
19767 : see if strxfrm exists
19768 set strxfrm d_strxfrm
19769 eval $inlibc
19770
19771 : see if symlink exists
19772 set symlink d_symlink
19773 eval $inlibc
19774
19775 : see if syscall exists
19776 set syscall d_syscall
19777 eval $inlibc
19778
19779 : see if prototype for syscall is available
19780 echo " "
19781 set d_syscallproto syscall $i_unistd unistd.h
19782 eval $hasproto
19783
19784 : see if sysconf exists
19785 set sysconf d_sysconf
19786 eval $inlibc
19787
19788 : see if system exists
19789 set system d_system
19790 eval $inlibc
19791
19792 : see if tcgetpgrp exists
19793 set tcgetpgrp d_tcgetpgrp
19794 eval $inlibc
19795
19796 : see if tcsetpgrp exists
19797 set tcsetpgrp d_tcsetpgrp
19798 eval $inlibc
19799
19800 : see if prototype for telldir is available
19801 echo " "
19802 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19803 eval $hasproto
19804
19805 : see if tgamma exists
19806 set tgamma d_tgamma
19807 eval $inlibc
19808
19809 : see if time exists
19810 echo " "
19811 if test "X$d_time" = X -o X"$timetype" = X; then
19812     if set time val -f d_time; eval $csym; $val; then
19813                 echo 'time() found.' >&4
19814                 val="$define"
19815                 rp="What is the type returned by time() on this system?"
19816                 set time_t timetype long stdio.h sys/types.h
19817                 eval $typedef_ask
19818     else
19819                 echo 'time() not found, hope that will do.' >&4
19820                 val="$undef"
19821                 timetype='int';
19822     fi
19823     set d_time
19824     eval $setvar
19825 fi
19826
19827 : see if timegm exists
19828 set timegm d_timegm
19829 eval $inlibc
19830
19831 : see if this is a sys/times.h system
19832 set sys/times.h i_systimes
19833 eval $inhdr
19834
19835 : see if times exists
19836 echo " "
19837 if set times val -f d_times; eval $csym; $val; then
19838         echo 'times() found.' >&4
19839         d_times="$define"
19840         inc=''
19841         case "$i_systimes" in
19842         "$define") inc='sys/times.h';;
19843         esac
19844         rp="What is the type returned by times() on this system?"
19845         set clock_t clocktype long stdio.h sys/types.h $inc
19846         eval $typedef_ask
19847 else
19848         echo 'times() NOT found, hope that will do.' >&4
19849         d_times="$undef"
19850         clocktype='int'
19851 fi
19852
19853 : see if tmpnam_r exists
19854 set tmpnam_r d_tmpnam_r
19855 eval $inlibc
19856 case "$d_tmpnam_r" in
19857 "$define")
19858         hdrs="$i_systypes sys/types.h define stdio.h "
19859         case "$d_tmpnam_r_proto:$usethreads" in
19860         ":define")      d_tmpnam_r_proto=define
19861                 set d_tmpnam_r_proto tmpnam_r $hdrs
19862                 eval $hasproto ;;
19863         *)      ;;
19864         esac
19865         case "$d_tmpnam_r_proto" in
19866         define)
19867         case "$tmpnam_r_proto" in
19868         ''|0) try='char* tmpnam_r(char*);'
19869         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19870         esac
19871         case "$tmpnam_r_proto" in
19872         ''|0)   d_tmpnam_r=undef
19873                 tmpnam_r_proto=0
19874                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19875         * )     case "$tmpnam_r_proto" in
19876                 REENTRANT_PROTO*) ;;
19877                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19878                 esac
19879                 echo "Prototype: $try" ;;
19880         esac
19881         ;;
19882         *)      case "$usethreads" in
19883                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19884                 esac
19885                 d_tmpnam_r=undef
19886                 tmpnam_r_proto=0
19887                 ;;
19888         esac
19889         ;;
19890 *)      tmpnam_r_proto=0
19891         ;;
19892 esac
19893
19894 : see if trunc exists
19895 set trunc d_trunc
19896 eval $inlibc
19897
19898 : see if truncate exists
19899 set truncate d_truncate
19900 eval $inlibc
19901
19902 : see if ttyname_r exists
19903 set ttyname_r d_ttyname_r
19904 eval $inlibc
19905 case "$d_ttyname_r" in
19906 "$define")
19907         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19908         case "$d_ttyname_r_proto:$usethreads" in
19909         ":define")      d_ttyname_r_proto=define
19910                 set d_ttyname_r_proto ttyname_r $hdrs
19911                 eval $hasproto ;;
19912         *)      ;;
19913         esac
19914         case "$d_ttyname_r_proto" in
19915         define)
19916         case "$ttyname_r_proto" in
19917         ''|0) try='int ttyname_r(int, char*, size_t);'
19918         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19919         esac
19920         case "$ttyname_r_proto" in
19921         ''|0) try='int ttyname_r(int, char*, int);'
19922         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19923         esac
19924         case "$ttyname_r_proto" in
19925         ''|0) try='char* ttyname_r(int, char*, int);'
19926         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19927         esac
19928         case "$ttyname_r_proto" in
19929         ''|0)   d_ttyname_r=undef
19930                 ttyname_r_proto=0
19931                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19932         * )     case "$ttyname_r_proto" in
19933                 REENTRANT_PROTO*) ;;
19934                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19935                 esac
19936                 echo "Prototype: $try" ;;
19937         esac
19938         ;;
19939         *)      case "$usethreads" in
19940                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19941                 esac
19942                 d_ttyname_r=undef
19943                 ttyname_r_proto=0
19944                 ;;
19945         esac
19946         ;;
19947 *)      ttyname_r_proto=0
19948         ;;
19949 esac
19950
19951 : see if tzname[] exists
19952 echo " "
19953 if set tzname val -a d_tzname; eval $csym; $val; then
19954         val="$define"
19955         echo 'tzname[] found.' >&4
19956 else
19957         val="$undef"
19958         echo 'tzname[] NOT found.' >&4
19959 fi
19960 set d_tzname
19961 eval $setvar
19962
19963 : Check if is a multiplatform env
19964 case "$osname" in
19965 darwin) multiarch="$define" ;;
19966 esac
19967 case "$multiarch" in
19968 ''|[nN]*) multiarch="$undef" ;;
19969 esac
19970
19971 : check for ordering of bytes in a UV
19972 echo " "
19973 case "$multiarch" in
19974 *$define*)
19975         $cat <<EOM
19976 You seem to be doing a multiarchitecture build,
19977 skipping the byteorder check.
19978
19979 EOM
19980         byteorder='ffff'
19981         ;;
19982 *)
19983         case "$byteorder" in
19984         '')
19985                 $cat <<'EOM'
19986 In the following, larger digits indicate more significance.  A big-endian
19987 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19988 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19989 machines may have weird orders like 3412.  A Cray will report 87654321,
19990 an Alpha will report 12345678. If the test program works the default is
19991 probably right.
19992 I'm now running the test program...
19993 EOM
19994                 $cat >try.c <<EOCP
19995 #include <stdio.h>
19996 #$i_stdlib I_STDLIB
19997 #ifdef I_STDLIB
19998 #include <stdlib.h>
19999 #endif
20000 #include <sys/types.h>
20001 typedef $uvtype UV;
20002 int main()
20003 {
20004         int i;
20005         union {
20006                 UV l;
20007                 char c[$uvsize];
20008         } u;
20009
20010         if ($uvsize > 4)
20011                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
20012         else
20013                 u.l = (UV)0x04030201;
20014         for (i = 0; i < $uvsize; i++)
20015                 printf("%c", u.c[i]+'0');
20016         printf("\n");
20017         exit(0);
20018 }
20019 EOCP
20020                 xxx_prompt=y
20021                 set try
20022                 if eval $compile && $run ./try > /dev/null; then
20023                         dflt=`$run ./try`
20024                         case "$dflt" in
20025                         [1-4][1-4][1-4][1-4]|12345678|87654321)
20026                                 echo "(The test program ran ok.)"
20027                                 echo "byteorder=$dflt"
20028                                 xxx_prompt=n
20029                         ;;
20030                         ????|????????) echo "(The test program ran ok.)" ;;
20031                         *) echo "(The test program didn't run right for some reason.)" ;;
20032                         esac
20033                 else
20034                         dflt='4321'
20035                         cat <<'EOM'
20036 (I can't seem to compile the test program.  Guessing big-endian...)
20037 EOM
20038                 fi
20039                 case "$xxx_prompt" in
20040                 y)
20041                         rp="What is the order of bytes in $uvtype?"
20042                         . ./myread
20043                         byteorder="$ans"
20044                         ;;
20045                 *)      byteorder=$dflt
20046                         ;;
20047                 esac
20048                 ;;
20049         esac
20050         $rm_try
20051         ;;
20052 esac
20053
20054 : Checking 32bit alignedness
20055 $cat <<EOM
20056
20057 Checking to see whether you can access character data unalignedly...
20058 EOM
20059 case "$d_u32align" in
20060 '')   $cat >try.c <<EOCP
20061 #include <stdio.h>
20062 #$i_stdlib I_STDLIB
20063 #ifdef I_STDLIB
20064 #include <stdlib.h>
20065 #endif
20066 #define U32 $u32type
20067 #define BYTEORDER 0x$byteorder
20068 #define U8 $u8type
20069 #include <signal.h>
20070 #ifdef SIGBUS
20071 $signal_t bletch(int s) { exit(4); }
20072 #endif
20073 int main() {
20074 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
20075     volatile U8 buf[8];
20076     volatile U32 *up;
20077     int i;
20078
20079     if (sizeof(U32) != 4) {
20080         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
20081         exit(1);
20082     }
20083
20084     fflush(stdout);
20085
20086 #ifdef SIGBUS
20087     signal(SIGBUS, bletch);
20088 #endif
20089
20090     buf[0] = 0;
20091     buf[1] = 0;
20092     buf[2] = 0;
20093     buf[3] = 1;
20094     buf[4] = 0;
20095     buf[5] = 0;
20096     buf[6] = 0;
20097     buf[7] = 1;
20098
20099     for (i = 0; i < 4; i++) {
20100         up = (U32*)(buf + i);
20101         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
20102                (*up == 1 << (8*(3-i)))  /* little-endian */
20103               )
20104            )
20105         {
20106             printf("read failed (%x)\n", *up);
20107             exit(2);
20108         }
20109     }
20110
20111     /* write test */
20112     for (i = 0; i < 4; i++) {
20113         up = (U32*)(buf + i);
20114         *up = 0xBeef;
20115         if (*up != 0xBeef) {
20116             printf("write failed (%x)\n", *up);
20117             exit(3);
20118         }
20119     }
20120
20121     exit(0);
20122 #else
20123     printf("1\n");
20124     exit(1);
20125 #endif
20126     return 0;
20127 }
20128 EOCP
20129 set try
20130 if eval $compile_ok; then
20131         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
20132         $run ./try 2>&1 >/dev/null
20133         case "$?" in
20134         0)      cat >&4 <<EOM
20135 You can access character data pretty unalignedly.
20136 EOM
20137                 d_u32align="$undef"
20138                 ;;
20139         *)      cat >&4 <<EOM
20140 It seems that you must access character data in an aligned manner.
20141 EOM
20142                 d_u32align="$define"
20143                 ;;
20144         esac
20145 else
20146         rp='Can you access character data at unaligned addresses?'
20147         dflt='n'
20148         . ./myread
20149         case "$ans" in
20150         [yY]*)  d_u32align="$undef"  ;;
20151         *)      d_u32align="$define" ;;
20152         esac
20153 fi
20154 $rm_try
20155 ;;
20156 esac
20157
20158 : see if ualarm exists
20159 set ualarm d_ualarm
20160 eval $inlibc
20161
20162 : see if umask exists
20163 set umask d_umask
20164 eval $inlibc
20165
20166 : see if unordered exists
20167 set unordered d_unordered
20168 eval $inlibc
20169
20170 : see if unsetenv exists
20171 set unsetenv d_unsetenv
20172 eval $inlibc
20173
20174 : see if usleep exists
20175 set usleep d_usleep
20176 eval $inlibc
20177
20178 : see if prototype for usleep is available
20179 echo " "
20180 set d_usleepproto usleep $i_unistd unistd.h
20181 eval $hasproto
20182
20183 : see if ustat exists
20184 set ustat d_ustat
20185 eval $inlibc
20186
20187 : see if closedir exists
20188 set closedir d_closedir
20189 eval $inlibc
20190
20191 case "$d_closedir" in
20192 "$define")
20193         echo " "
20194         echo "Checking whether closedir() returns a status..." >&4
20195         cat > try.c <<EOM
20196 #$i_dirent I_DIRENT             /**/
20197 #$i_sysdir I_SYS_DIR            /**/
20198 #$i_sysndir I_SYS_NDIR          /**/
20199 #$i_systypes I_SYS_TYPES        /**/
20200
20201 #if defined(I_SYS_TYPES)
20202 #include <sys/types.h>
20203 #endif
20204 #if defined(I_DIRENT)
20205 #include <dirent.h>
20206 #else
20207 #ifdef I_SYS_NDIR
20208 #include <sys/ndir.h>
20209 #else
20210 #ifdef I_SYS_DIR
20211 #ifdef hp9000s500
20212 #include <ndir.h>       /* may be wrong in the future */
20213 #else
20214 #include <sys/dir.h>
20215 #endif
20216 #endif
20217 #endif
20218 #endif
20219 int main() { return closedir(opendir(".")); }
20220 EOM
20221         set try
20222         if eval $compile_ok; then
20223                 if $run ./try > /dev/null 2>&1 ; then
20224                         echo "Yes, it does."
20225                         val="$undef"
20226                 else
20227                         echo "No, it doesn't."
20228                         val="$define"
20229                 fi
20230         else
20231                 echo "(I can't seem to compile the test program--assuming it doesn't)"
20232                 val="$define"
20233         fi
20234         ;;
20235 *)
20236         val="$undef";
20237         ;;
20238 esac
20239 set d_void_closedir
20240 eval $setvar
20241 $rm_try
20242
20243 : see if there is a wait4
20244 set wait4 d_wait4
20245 eval $inlibc
20246
20247 : see if waitpid exists
20248 set waitpid d_waitpid
20249 eval $inlibc
20250
20251 : look for wcscmp
20252 echo " "
20253 $cat >try.c <<'EOCP'
20254 #include <stdio.h>
20255 #include <wchar.h>
20256 int main ()
20257 {
20258     wchar_t *s = L" ";
20259     return (wcscmp (s, s) ? 1 : 0);
20260     }
20261 EOCP
20262 set try
20263 val="$undef"
20264 if eval $compile; then
20265     `$run ./try`
20266     case "$?" in
20267         0)  echo "A working wcscmp() found." >&4
20268             val="$define" ;;
20269         *)  echo "wcscmp() found, but it doesn't work" >&4
20270             ;;
20271         esac
20272 else
20273     echo "wcscmp() NOT found." >&4
20274     fi
20275 set d_wcscmp
20276 eval $setvar
20277 $rm_try
20278
20279 : see if wcstombs exists
20280 set wcstombs d_wcstombs
20281 eval $inlibc
20282
20283 : look for wcsxfrm
20284 echo " "
20285 $cat >try.c <<'EOCP'
20286 #include <errno.h>
20287 #include <wchar.h>
20288 int main ()
20289 {
20290     wchar_t dst[4], *src = L" ";
20291     errno = 0;
20292     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
20293     }
20294 EOCP
20295 set try
20296 val="$undef"
20297 if eval $compile; then
20298     `$run ./try`
20299     case "$?" in
20300         0)  echo "A working wcsxfrm() found." >&4
20301             val="$define" ;;
20302         *)  echo "wcsxfrm() found, but it doesn't work" >&4
20303             ;;
20304         esac
20305 else
20306     echo "wcsxfrm() NOT found." >&4
20307     fi
20308 set d_wcsxfrm
20309 eval $setvar
20310 $rm_try
20311
20312 : see if wctomb exists
20313 set wctomb d_wctomb
20314 eval $inlibc
20315
20316 : see if writev exists
20317 set writev d_writev
20318 eval $inlibc
20319
20320 : check for alignment requirements
20321 echo " "
20322 case "$alignbytes" in
20323     '') echo "Checking alignment constraints..." >&4
20324         $cat >try.c <<EOCP
20325 #include <stdio.h>
20326 struct foobar {
20327     char foo;
20328     $nvtype bar;
20329 } try_algn;
20330 int main()
20331 {
20332     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20333     return(0);
20334 }
20335 EOCP
20336         set try
20337         if eval $compile_ok; then
20338             dflt=`$run ./try`
20339         else
20340             dflt='8'
20341             echo "(I can't seem to compile the test program...)"
20342         fi
20343         case "$multiarch" in
20344             *$define*)
20345                 : The usual safe value is 8, but Darwin with -Duselongdouble
20346                 : needs 16.  Hence, we will take 8 as a minimum, but allow
20347                 : Configure to pick a larger value if needed.
20348                 if $test "$dflt" -lt 8; then
20349                     dflt='8'
20350                     echo "Setting alignment to 8 for multiarch support.">&4
20351                 fi
20352                 ;;
20353         esac
20354         ;;
20355     *) dflt="$alignbytes"
20356         ;;
20357 esac
20358 rp="Doubles must be aligned on a how-many-byte boundary?"
20359 . ./myread
20360 alignbytes="$ans"
20361 $rm_try
20362
20363 : set the base revision
20364 baserev=5.0
20365
20366 : length of character in bytes. Is always 1, otherwise it is not C
20367 : This used to be a test using sizeof
20368 charsize=1
20369
20370 : Check for the number of bits in a character
20371 case "$charbits" in
20372 '')     echo "Checking how long a character is (in bits)..." >&4
20373         $cat >try.c <<EOCP
20374 #include <stdio.h>
20375 int main ()
20376 {
20377     int n;
20378     unsigned char c;
20379     for (c = 1, n = 0; c; c <<= 1, n++) ;
20380     printf ("%d\n", n);
20381     return (0);
20382     }
20383 EOCP
20384         set try
20385         if eval $compile_ok; then
20386                 dflt=`$run ./try`
20387         else
20388                 dflt='8'
20389                 echo "(I can't seem to compile the test program.  Guessing...)"
20390         fi
20391         ;;
20392 *)
20393         dflt="$charbits"
20394         ;;
20395 esac
20396 rp="What is the length of a character (in bits)?"
20397 . ./myread
20398 charbits="$ans"
20399 $rm_try
20400 case "$charbits" in
20401 8)      ;;
20402 *)      cat >&4 << EOM
20403 Your system has an unsigned character size of $charbits bits, which
20404 is rather unusual (normally it is 8 bits).  Perl likely will not work
20405 correctly on your system, with subtle bugs in various places.
20406 EOM
20407         rp='Do you really want to continue?'
20408         dflt='n'
20409         . ./myread
20410         case "$ans" in
20411                 [yY])   echo >&4 "Okay, continuing."    ;;
20412                 *)      exit 1                          ;;
20413         esac
20414 esac
20415
20416 : how do we concatenate cpp tokens here?
20417 echo " "
20418 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20419 $cat >cpp_stuff.c <<'EOCP'
20420 #define RCAT(a,b)a/**/b
20421 #define ACAT(a,b)a ## b
20422 RCAT(Rei,ser)
20423 ACAT(Cir,cus)
20424 EOCP
20425 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20426 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20427         echo "Oh!  Smells like ANSI's been here." >&4
20428         echo "We can catify or stringify, separately or together!"
20429         cpp_stuff=42
20430 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20431         echo "Ah, yes!  The good old days!" >&4
20432         echo "However, in the good old days we don't know how to stringify and"
20433         echo "catify at the same time."
20434         cpp_stuff=1
20435 else
20436         $cat >&4 <<EOM
20437 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20438 You're going to have to edit the values of CAT[2-5] in config.h...
20439 EOM
20440         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20441 fi
20442 $rm -f cpp_stuff.*
20443
20444 : see if this is a db.h system
20445 set db.h i_db
20446 eval $inhdr
20447
20448 case "$i_db" in
20449 $define)
20450         : Check db version.
20451         echo " "
20452         echo "Checking Berkeley DB version ..." >&4
20453         $cat >try.c <<EOCP
20454 #$d_const HASCONST
20455 #ifndef HASCONST
20456 #define const
20457 #endif
20458 #include <sys/types.h>
20459 #include <stdio.h>
20460 #$i_stdlib I_STDLIB
20461 #ifdef I_STDLIB
20462 #include <stdlib.h>
20463 #endif
20464 #include <db.h>
20465 int main(int argc, char *argv[])
20466 {
20467 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20468     int Major, Minor, Patch ;
20469     unsigned long Version ;
20470     (void)db_version(&Major, &Minor, &Patch) ;
20471     if (argc == 2) {
20472         printf("%d %d %d %d %d %d\n",
20473                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20474                Major, Minor, Patch);
20475         exit(0);
20476     }
20477     printf("You have Berkeley DB Version 2 or greater.\n");
20478
20479     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20480                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20481     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20482                 Major, Minor, Patch) ;
20483
20484     /* check that db.h & libdb are compatible */
20485     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20486         printf("db.h and libdb are incompatible.\n") ;
20487         exit(3);
20488     }
20489
20490     printf("db.h and libdb are compatible.\n") ;
20491
20492     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20493                 + DB_VERSION_PATCH ;
20494
20495     /* needs to be >= 2.3.4 */
20496     if (Version < 2003004) {
20497     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20498         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20499         exit(2);
20500     }
20501
20502     exit(0);
20503 #else
20504 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20505     if (argc == 2) {
20506         printf("1 0 0\n");
20507         exit(0);
20508     }
20509     printf("You have Berkeley DB Version 1.\n");
20510     exit(0);    /* DB version < 2: the coast is clear. */
20511 #else
20512     exit(1);    /* <db.h> not Berkeley DB? */
20513 #endif
20514 #endif
20515 }
20516 EOCP
20517         set try
20518         if eval $compile_ok && $run ./try; then
20519                 echo 'Looks OK.' >&4
20520                 set `$run ./try 1`
20521                 db_version_major=$1
20522                 db_version_minor=$2
20523                 db_version_patch=$3
20524         else
20525                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20526                 i_db=$undef
20527                 case " $libs " in
20528                 *"-ldb "*)
20529                         : Remove db from list of libraries to use
20530                         echo "Removing unusable -ldb from library list" >&4
20531                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20532                         shift
20533                         libs="$*"
20534                         echo "libs = $libs" >&4
20535                         ;;
20536                 esac
20537         fi
20538         $rm_try
20539         ;;
20540 esac
20541
20542 case "$i_db" in
20543 define)
20544         : Check the return type needed for hash
20545         echo " "
20546         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20547         $cat >try.c <<EOCP
20548 #$d_const HASCONST
20549 #ifndef HASCONST
20550 #define const
20551 #endif
20552 #include <sys/types.h>
20553 #include <db.h>
20554
20555 #ifndef DB_VERSION_MAJOR
20556 u_int32_t hash_cb (const void* ptr, size_t size)
20557 {
20558 }
20559 HASHINFO info;
20560 int main()
20561 {
20562         info.hash = hash_cb;
20563 }
20564 #endif
20565 EOCP
20566         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20567                 if $contains warning try.out >>/dev/null 2>&1 ; then
20568                         db_hashtype='int'
20569                 else
20570                         db_hashtype='u_int32_t'
20571                 fi
20572         else
20573                 : XXX Maybe we should just give up here.
20574                 db_hashtype=u_int32_t
20575                 $cat try.out >&4
20576                 echo "Help:  I can't seem to compile the db test program." >&4
20577                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20578         fi
20579         $rm_try
20580         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20581         ;;
20582 *)      db_hashtype=u_int32_t
20583         ;;
20584 esac
20585 case "$i_db" in
20586 define)
20587         : Check the return type needed for prefix
20588         echo " "
20589         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20590         cat >try.c <<EOCP
20591 #$d_const HASCONST
20592 #ifndef HASCONST
20593 #define const
20594 #endif
20595 #include <sys/types.h>
20596 #include <db.h>
20597
20598 #ifndef DB_VERSION_MAJOR
20599 size_t prefix_cb (const DBT *key1, const DBT *key2)
20600 {
20601 }
20602 BTREEINFO info;
20603 int main()
20604 {
20605         info.prefix = prefix_cb;
20606 }
20607 #endif
20608 EOCP
20609         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20610                 if $contains warning try.out >>/dev/null 2>&1 ; then
20611                         db_prefixtype='int'
20612                 else
20613                         db_prefixtype='size_t'
20614                 fi
20615         else
20616                 db_prefixtype='size_t'
20617                 : XXX Maybe we should just give up here.
20618                 $cat try.out >&4
20619                 echo "Help:  I can't seem to compile the db test program." >&4
20620                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20621         fi
20622         $rm_try
20623         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20624         ;;
20625 *)      db_prefixtype='size_t'
20626         ;;
20627 esac
20628
20629 : Include . in @INC
20630 $cat <<EOM
20631
20632 Historically Perl has provided a final fallback of the current working
20633 directory '.' when searching for a library. This, however, can lead to
20634 problems when a Perl program which loads optional modules is called from
20635 a shared directory. This can lead to executing unexpected code.
20636
20637 EOM
20638
20639 # When changing to exclude by default:
20640 #case "$default_inc_excludes_dot" in
20641 #    $undef|false|[nN]*) dflt="n" ;;
20642 #    *)                  dflt="y" ;;
20643 #esac
20644 # For now:
20645 case "$default_inc_excludes_dot" in
20646     $define|true|[yY]*) dflt="y" ;;
20647     *)                  dflt="n" ;;
20648 esac
20649
20650 rp='Exclude '.' from @INC by default? '
20651 . ./myread
20652 case "$ans" in
20653     [nN]|undef) default_inc_excludes_dot="$undef"  ;;
20654     *)          default_inc_excludes_dot="$define" ;;
20655 esac
20656
20657 : Check what kind of inf/nan your system has
20658 $echo "Checking the kind of infinities and nans you have..." >&4
20659 $echo "(The following tests may crash.  That's okay.)" >&4
20660 $cat >try.c <<EOP
20661 #define DOUBLESIZE $doublesize
20662 #$d_longdbl HAS_LONG_DOUBLE
20663 #ifdef HAS_LONG_DOUBLE
20664 #define LONG_DOUBLESIZE $longdblsize
20665 #define LONG_DOUBLEKIND $longdblkind
20666 #endif
20667 #$i_math I_MATH
20668 #ifdef I_MATH
20669 #include <math.h>
20670 #endif
20671 #include <stdio.h>
20672 /* Note that whether the sign bit is on or off
20673  * for NaN depends on the CPU/FPU, and possibly
20674  * can be affected by the build toolchain.
20675  *
20676  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20677  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20678  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20679  * (respectively) as opposed to the more usual
20680  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20681  *
20682  * Pre-IEEE-754 floating point format do not even have inf/nan support
20683  * at all.  They might have a "max" value (DBL_MAX), which may be deadly
20684  * to even mention, causing immediate SIGFPE or equivalent: this is
20685  * the case with VAX floating point, for example.
20686  */
20687 static void bytes(unsigned char *p, unsigned int n) {
20688   int i;
20689   for (i = 0; i < n; i++) {
20690     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20691   }
20692 }
20693 int main(int argc, char *argv[]) {
20694    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20695     * because some compilers are 'smart' and not only warn but refuse to
20696     * compile such 'illegal' values. */
20697    double dinf = exp(1e9);
20698    double dnan = sqrt(-1.0);
20699 #ifdef HAS_LONG_DOUBLE
20700    long double ldinf = (long double)exp(1e9);
20701    long double ldnan = (long double)sqrt(-1.0);
20702 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20703 /* the 80-bit long doubles might have garbage in their excess bytes */
20704     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20705     memset((char *)&ldnan + 10, '\0', LONG_DOUBLESIZE - 10);
20706 # endif
20707   if (argc == 2) {
20708     switch (argv[1][0]) {
20709     case '1': bytes(&dinf, sizeof(dinf)); break;
20710     case '2': bytes(&dnan, sizeof(dnan)); break;
20711     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20712     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20713 #endif
20714     }
20715   }
20716   return 0;
20717 }
20718 EOP
20719 set try
20720 if eval $compile; then
20721     doubleinfbytes=`$run ./try 1`
20722     doublenanbytes=`$run ./try 2`
20723     case "$d_longdbl" in
20724     $define)
20725       longdblinfbytes=`$run ./try 3`
20726       longdblnanbytes=`$run ./try 4`
20727       ;;
20728     esac
20729 else
20730     # Defaults in case the above test program failed.
20731     case "$doublekind" in
20732     1) # IEEE 754 32-bit LE
20733        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20734        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20735        ;;
20736     2) # IEEE 754 32-bit BE
20737        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20738        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20739        ;;
20740     3) # IEEE 754 64-bit LE
20741        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20742        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20743        ;;
20744     4) # IEEE 754 64-bit BE
20745        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20746        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20747        ;;
20748     5) # IEEE 754 128-bit LE
20749        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20750        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20751        ;;
20752     6) # IEEE 754 128-bit BE
20753        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20754        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20755        ;;
20756     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20757        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20758        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20759        ;;
20760     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20761        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20762        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20763        ;;
20764     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20765        doubleinfbytes=$undef
20766        doublenanbytes=$undef
20767        ;;
20768     *) # No idea.
20769        doubleinfbytes=$undef
20770        doublenanbytes=$undef
20771        ;;
20772     esac
20773     case "$longdblkind" in
20774     1) # IEEE 754 128-bit LE
20775        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20776        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20777        ;;
20778     2) # IEEE 754 128-bit BE
20779        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20780        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20781        ;;
20782     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20783        case "$longdblsize" in
20784        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20785            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20786            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20787            ;;
20788        16) # x86_64
20789            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20790            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20791            ;;
20792        *)  # No idea.
20793            longdblinfbytes=$undef
20794            longdblnanbytes=$undef
20795        ;;
20796        esac
20797        ;;
20798     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20799        case "$longdblsize" in
20800        12) # 32-bit system
20801            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20802            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20803            ;;
20804        16) # 64-bit system
20805            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20806            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20807            ;;
20808        *)  # No idea.
20809            longdblinfbytes=$undef
20810            longdblnanbytes=$undef
20811        ;;
20812        esac
20813        ;;
20814     5) # 128-bit LE-LE "double double"
20815        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20816        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20817        ;;
20818     6) # 128-bit BE-BE "double double"
20819        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20820        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20821        ;;
20822     7) # 128-bit LE-BE "double double"
20823        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20824        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20825        ;;
20826     8) # 128-bit BE-LE "double double"
20827        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20828        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20829        ;;
20830     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20831        longdblinfbytes=$undef
20832        longdblnanbytes=$undef
20833        ;;
20834     *) # No idea.
20835        longdblinfbytes=$undef
20836        longdblnanbytes=$undef
20837        ;;
20838     esac
20839 fi
20840 # In case the program crashed the values are empty, turn them undef.
20841 case "$doubleinfbytes" in
20842 '') doubleinfbytes=$undef ;;
20843 esac
20844 case "$doublenanbytes" in
20845 '') doublenanbytes=$undef ;;
20846 esac
20847 case "$longdblinfbytes" in
20848 '') longdblinfbytes=$undef ;;
20849 esac
20850 case "$longdblnanbytes" in
20851 '') longdblnanbytes=$undef ;;
20852 esac
20853 $rm_try
20854
20855 : Check the length of the double mantissa
20856 $echo "Checking how many mantissa bits your doubles have..." >&4
20857 $cat >try.c <<EOP
20858 #$i_float I_FLOAT
20859 #$i_sunmath I_SUNMATH
20860 #ifdef I_FLOAT
20861 # include <float.h>
20862 #endif
20863 #ifdef I_SUNMATH
20864 # include <sunmath.h>
20865 #endif
20866 #ifdef DBL_MANT_DIG
20867 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20868 #endif
20869 #include <stdio.h>
20870 int main(int argc, char *argv[]) {
20871 #ifdef BITS
20872   printf("%d\n", BITS);
20873 #endif
20874   return 0;
20875 }
20876 EOP
20877 set try
20878 if eval $compile; then
20879     doublemantbits=`$run ./try`
20880 else
20881     doublemantbits="$undef"
20882 fi
20883 $rm_try
20884
20885 : Check the length of the longdouble mantissa
20886 $echo "Checking how many mantissa bits your long doubles have..." >&4
20887 $cat >try.c <<EOP
20888 #$i_float I_FLOAT
20889 #$i_sunmath I_SUNMATH
20890 #ifdef I_FLOAT
20891 # include <float.h>
20892 #endif
20893 #ifdef I_SUNMATH
20894 # include <sunmath.h>
20895 #endif
20896 #$d_longdbl HAS_LONG_DOUBLE
20897 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20898 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20899 /* This format has no implicit bit.  Beware, however, that for
20900  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20901  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20902  * and the top bit must have been one since 387, zero is plain invalid.
20903  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20904 #  define BITS LDBL_MANT_DIG
20905 # elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
20906 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20907  * reason e.g. Irix thinks 107.  But in any case, we want only
20908  * the number of real bits, the implicit bits are of no interest.  */
20909 #  define BITS 2 * (DBL_MANT_DIG - 1)
20910 # else
20911 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20912 # endif
20913 #endif
20914 #include <stdio.h>
20915 int main(int argc, char *argv[]) {
20916 #ifdef BITS
20917   printf("%d\n", BITS);
20918 #endif
20919   return 0;
20920 }
20921 EOP
20922 set try
20923 if eval $compile; then
20924     longdblmantbits=`$run ./try`
20925 else
20926     longdblmantbits="$undef"
20927 fi
20928 $rm_try
20929
20930 : Check the length of the NV mantissa
20931 $echo "Checking how many mantissa bits your NVs have..." >&4
20932 if test "X$usequadmath" = "X$define"; then
20933   nvmantbits=112 # 128-1-15
20934 else
20935   if test "X$nvsize" = "X$doublesize"; then
20936     nvmantbits="$doublemantbits"
20937   else
20938      if test "X$nvsize" = "X$longdblsize"; then
20939        nvmantbits="$longdblmantbits"
20940      else
20941        nvmantbits="$undef"
20942      fi
20943   fi
20944 fi
20945
20946 : How can we generate normalized random numbers ?
20947 echo " "
20948 echo "Using our internal random number implementation..." >&4
20949
20950 case "$ccflags" in
20951 *-Dmy_rand=*|*-Dmy_srand=*)
20952         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20953         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20954         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20955         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20956         ;;
20957 esac
20958
20959 randfunc=Perl_drand48
20960 drand01="Perl_drand48()"
20961 seedfunc="Perl_drand48_init"
20962 randbits=48
20963 randseedtype=U32
20964
20965 : Probe whether dtrace builds an object, as newer Illumos requires an input
20966 : object file that uses at least one of the probes defined in the .d file
20967 case "$usedtrace" in
20968 $define)
20969     case "$dtraceobject" in
20970     $define|true|[yY]*)
20971         dtraceobject=$define
20972         ;;
20973     ' '|'')
20974         $dtrace -h -s ../perldtrace.d -o perldtrace.h
20975         $cat >try.c <<EOM
20976 #include "perldtrace.h"
20977 int main(void) {
20978     PERL_LOADED_FILE("dummy");
20979     return 0;
20980 }
20981 EOM
20982         dtraceobject=$undef
20983         if $cc -c -o try.o $optimize $ccflags try.c \
20984                     && $dtrace -G -s ../perldtrace.d try.o >/dev/null 2>&1; then
20985                 dtraceobject=$define
20986             echo "Your dtrace builds an object file"
20987         fi
20988         $rm -f try.c try.o perldtrace.o
20989         ;;
20990     *) dtraceobject=$undef ;;
20991     esac
20992 esac
20993
20994 : Determine if this is an EBCDIC system
20995 echo " "
20996 echo "Determining whether or not we are on an EBCDIC system..." >&4
20997 $cat >try.c <<'EOM'
20998 int main()
20999 {
21000   if ('M'==0xd4) return 0;
21001   return 1;
21002 }
21003 EOM
21004
21005 val=$undef
21006 set try
21007 if eval $compile_ok; then
21008         if $run ./try; then
21009                 echo "You seem to speak EBCDIC." >&4
21010                 val="$define"
21011         else
21012                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
21013         fi
21014 else
21015         echo "I'm unable to compile the test program." >&4
21016         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
21017 fi
21018 $rm_try
21019 set ebcdic
21020 eval $setvar
21021
21022 : Check how to flush
21023 echo " "
21024 $cat >&4 <<EOM
21025 Checking how to flush all pending stdio output...
21026 EOM
21027 # I only know how to find the first 32 possibly open files on SunOS.
21028 # See also hints/sunos_4_1.sh and util.c  --AD
21029 case "$osname" in
21030 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
21031 esac
21032 $cat >>try.c <<EOCP
21033 #include <stdio.h>
21034 #$i_stdlib I_STDLIB
21035 #ifdef I_STDLIB
21036 #include <stdlib.h>
21037 #endif
21038 #$i_unistd I_UNISTD
21039 #ifdef I_UNISTD
21040 # include <unistd.h>
21041 #endif
21042 #$d_sysconf HAS_SYSCONF
21043 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
21044 #ifdef HAS_STDIO_STREAM_ARRAY
21045 # define STDIO_STREAM_ARRAY $stdio_stream_array
21046 #endif
21047 int main() {
21048   FILE* p;
21049   unlink("try.out");
21050   p = fopen("try.out", "w");
21051 #ifdef TRY_FPUTC
21052   fputc('x', p);
21053 #else
21054 # ifdef TRY_FPRINTF
21055   fprintf(p, "x");
21056 # endif
21057 #endif
21058 #ifdef TRY_FFLUSH_NULL
21059   fflush(NULL);
21060 #endif
21061 #ifdef TRY_FFLUSH_ALL
21062   {
21063     long open_max = -1;
21064 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
21065     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
21066 # else
21067 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
21068     open_max = sysconf(_SC_OPEN_MAX);
21069 #  else
21070 #   ifdef FOPEN_MAX
21071     open_max = FOPEN_MAX;
21072 #   else
21073 #    ifdef OPEN_MAX
21074     open_max = OPEN_MAX;
21075 #    else
21076 #     ifdef _NFILE
21077     open_max = _NFILE;
21078 #     endif
21079 #    endif
21080 #   endif
21081 #  endif
21082 # endif
21083 # ifdef HAS_STDIO_STREAM_ARRAY
21084     if (open_max > 0) {
21085       long i;
21086       for (i = 0; i < open_max; i++)
21087             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
21088                 STDIO_STREAM_ARRAY[i]._file < open_max &&
21089                 STDIO_STREAM_ARRAY[i]._flag)
21090                 fflush(&STDIO_STREAM_ARRAY[i]);
21091     }
21092   }
21093 # endif
21094 #endif
21095   _exit(42);
21096 }
21097 EOCP
21098 : first we have to find out how _not_ to flush
21099 $to try.c
21100 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
21101     output=''
21102     set try -DTRY_FPUTC
21103     if eval $compile; then
21104             $run ./try 2>/dev/null
21105             code="$?"
21106             $from try.out
21107             if $test ! -s try.out -a "X$code" = X42; then
21108                 output=-DTRY_FPUTC
21109             fi
21110     fi
21111     case "$output" in
21112     '')
21113             set try -DTRY_FPRINTF
21114             if eval $compile; then
21115                     $run ./try 2>/dev/null
21116                     code="$?"
21117                     $from try.out
21118                     if $test ! -s try.out -a "X$code" = X42; then
21119                         output=-DTRY_FPRINTF
21120                     fi
21121             fi
21122         ;;
21123     esac
21124 fi
21125 : check for fflush NULL behavior
21126 case "$fflushNULL" in
21127 '')     set try -DTRY_FFLUSH_NULL $output
21128         if eval $compile; then
21129                 $run ./try 2>/dev/null
21130                 code="$?"
21131                 $from try.out
21132                 if $test -s try.out -a "X$code" = X42; then
21133                         fflushNULL="`$cat try.out`"
21134                 else
21135                         if $test "X$code" != X42; then
21136                                 $cat >&4 <<EOM
21137 (If this test failed, don't worry, we'll try another method shortly.)
21138 EOM
21139                         fi
21140                 fi
21141         fi
21142         $rm -f core try.core core.try.*
21143         case "$fflushNULL" in
21144         x)      $cat >&4 <<EOM
21145 Your fflush(NULL) works okay for output streams.
21146 Let's see if it clobbers input pipes...
21147 EOM
21148 # As of mid-March 2000 all versions of Solaris appear to have a stdio
21149 # bug that improperly flushes the input end of pipes.  So we avoid the
21150 # autoflush on fork/system/exec support for now. :-(
21151 $cat >tryp.c <<EOCP
21152 #include <stdio.h>
21153 int
21154 main(int argc, char **argv)
21155 {
21156     char buf[1024];
21157     int i;
21158     char *bp = buf;
21159     while (1) {
21160         while ((i = getc(stdin)) != -1
21161                && (*bp++ = i) != '\n'
21162                && bp < &buf[1024])
21163         /* DO NOTHING */ ;
21164         *bp = '\0';
21165         fprintf(stdout, "%s", buf);
21166         fflush(NULL);
21167         if (i == -1)
21168             return 0;
21169         bp = buf;
21170     }
21171 }
21172 EOCP
21173                 fflushNULL="$define"
21174                 set tryp
21175                 if eval $compile; then
21176                     $rm -f tryp.out
21177                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
21178                     if $test "X$targethost" != X; then
21179                         $to tryp.c
21180                         $to tryp
21181                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
21182                     else
21183                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
21184                     fi
21185                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
21186                        $cat >&4 <<EOM
21187 fflush(NULL) seems to behave okay with input streams.
21188 EOM
21189                         fflushNULL="$define"
21190                     else
21191                         $cat >&4 <<EOM
21192 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
21193 EOM
21194                         fflushNULL="$undef"
21195                     fi
21196                 fi
21197                 $rm -f core tryp.c tryp.core core.tryp.*
21198                 ;;
21199         '')     $cat >&4 <<EOM
21200 Your fflush(NULL) isn't working (contrary to ANSI C).
21201 EOM
21202                 fflushNULL="$undef"
21203                 ;;
21204         *)      $cat >&4 <<EOM
21205 Cannot figure out whether your fflush(NULL) works or not.
21206 I'm assuming it doesn't (contrary to ANSI C).
21207 EOM
21208                 fflushNULL="$undef"
21209                 ;;
21210         esac
21211         ;;
21212 $define|true|[yY]*)
21213         fflushNULL="$define"
21214         ;;
21215 *)
21216         fflushNULL="$undef"
21217         ;;
21218 esac
21219 : check explicit looping only if NULL did not work, and if the pipe
21220 : bug does not show up on an explicit flush too
21221 case "$fflushNULL" in
21222 "$undef")
21223         $cat >tryp.c <<EOCP
21224 #include <stdio.h>
21225 int
21226 main(int argc, char **argv)
21227 {
21228     char buf[1024];
21229     int i;
21230     char *bp = buf;
21231     while (1) {
21232         while ((i = getc(stdin)) != -1
21233                && (*bp++ = i) != '\n'
21234                && bp < &buf[1024])
21235         /* DO NOTHING */ ;
21236         *bp = '\0';
21237         fprintf(stdout, "%s", buf);
21238         fflush(stdin);
21239         if (i == -1)
21240             return 0;
21241         bp = buf;
21242     }
21243 }
21244 EOCP
21245         set tryp
21246         if eval $compile; then
21247             $rm -f tryp.out
21248             if $test "X$targethost" != X; then
21249                 $to tryp.c
21250                 $to tryp
21251                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
21252             else
21253                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
21254             fi
21255             if cmp tryp.c tryp.out >/dev/null 2>&1; then
21256                $cat >&4 <<EOM
21257 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
21258 EOM
21259                 : now check for fflushall behaviour
21260                 case "$fflushall" in
21261                 '')     set try -DTRY_FFLUSH_ALL $output
21262                         if eval $compile; then
21263                                 $cat >&4 <<EOM
21264 (Now testing the other method--but note that this also may fail.)
21265 EOM
21266                                 $run ./try 2>/dev/null
21267                                 code=$?
21268                                 $from try.out
21269                                 if $test -s try.out -a "X$code" = X42; then
21270                                         fflushall="`$cat try.out`"
21271                                 fi
21272                         fi
21273                         $rm_try
21274                         case "$fflushall" in
21275                         x)      $cat >&4 <<EOM
21276 Whew. Flushing explicitly all the stdio streams works.
21277 EOM
21278                                 fflushall="$define"
21279                                 ;;
21280                         '')     $cat >&4 <<EOM
21281 Sigh. Flushing explicitly all the stdio streams doesn't work.
21282 EOM
21283                                 fflushall="$undef"
21284                                 ;;
21285                         *)      $cat >&4 <<EOM
21286 Cannot figure out whether flushing stdio streams explicitly works or not.
21287 I'm assuming it doesn't.
21288 EOM
21289                                 fflushall="$undef"
21290                                 ;;
21291                         esac
21292                         ;;
21293                 "$define"|true|[yY]*)
21294                         fflushall="$define"
21295                         ;;
21296                 *)
21297                         fflushall="$undef"
21298                         ;;
21299                 esac
21300             else
21301                 $cat >&4 <<EOM
21302 All is futile.  Even fflush(stdin) clobbers input pipes!
21303 EOM
21304                 fflushall="$undef"
21305             fi
21306         else
21307             fflushall="$undef"
21308         fi
21309         $rm -f core tryp.c tryp.core core.tryp.*
21310         ;;
21311 *)      fflushall="$undef"
21312         ;;
21313 esac
21314
21315 case "$fflushNULL$fflushall" in
21316 undefundef)
21317         $cat <<EOM
21318 OK, I give up.  I cannot figure out how to flush pending stdio output.
21319 We won't be flushing handles at all before fork/exec/popen.
21320 EOM
21321         ;;
21322 esac
21323 $rm_try tryp
21324
21325 : Store the full pathname to the ar program for use in the C program
21326 : Respect a hint or command line value for full_ar.
21327 case "$full_ar" in
21328 '') full_ar=$ar ;;
21329 esac
21330
21331 : Store the full pathname to the sed program for use in the C program
21332 full_sed=$sed
21333
21334 : see what type gids are declared as in the kernel
21335 echo " "
21336 echo "Looking for the type for group ids returned by getgid()."
21337 set gid_t gidtype xxx stdio.h sys/types.h
21338 eval $typedef
21339 case "$gidtype" in
21340 xxx)
21341         xxx=`./findhdr sys/user.h`
21342         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
21343         case $1 in
21344         unsigned) dflt="$1 $2" ;;
21345         *) dflt="$1" ;;
21346         esac
21347         ;;
21348 *) dflt="$gidtype";;
21349 esac
21350 case "$gidtype" in
21351 gid_t) echo "gid_t found." ;;
21352 *)      rp="What is the type for group ids returned by getgid()?"
21353         . ./myread
21354         gidtype="$ans"
21355         ;;
21356 esac
21357
21358 : Check the size of GID
21359 echo " "
21360 case "$gidtype" in
21361 *_t) zzz="$gidtype"     ;;
21362 *)   zzz="gid"          ;;
21363 esac
21364 echo "Checking the size of $zzz..." >&4
21365 cat > try.c <<EOCP
21366 #include <sys/types.h>
21367 #include <stdio.h>
21368 #$i_stdlib I_STDLIB
21369 #ifdef I_STDLIB
21370 #include <stdlib.h>
21371 #endif
21372 int main() {
21373     printf("%d\n", (int)sizeof($gidtype));
21374     exit(0);
21375 }
21376 EOCP
21377 set try
21378 if eval $compile_ok; then
21379         yyy=`$run ./try`
21380         case "$yyy" in
21381         '')     gidsize=4
21382                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
21383                 ;;
21384         *)      gidsize=$yyy
21385                 echo "Your $zzz is $gidsize bytes long."
21386                 ;;
21387         esac
21388 else
21389         gidsize=4
21390         echo "(I can't compile the test program--guessing $gidsize.)" >&4
21391 fi
21392
21393
21394 : Check if GID is signed
21395 echo " "
21396 case "$gidtype" in
21397 *_t) zzz="$gidtype"     ;;
21398 *)   zzz="gid"          ;;
21399 esac
21400 echo "Checking the sign of $zzz..." >&4
21401 cat > try.c <<EOCP
21402 #include <sys/types.h>
21403 #include <stdio.h>
21404 int main() {
21405         $gidtype foo = -1;
21406         if (foo < 0)
21407                 printf("-1\n");
21408         else
21409                 printf("1\n");
21410 }
21411 EOCP
21412 set try
21413 if eval $compile; then
21414         yyy=`$run ./try`
21415         case "$yyy" in
21416         '')     gidsign=1
21417                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21418                 ;;
21419         *)      gidsign=$yyy
21420                 case "$gidsign" in
21421                  1) echo "Your $zzz is unsigned." ;;
21422                 -1) echo "Your $zzz is signed."   ;;
21423                 esac
21424                 ;;
21425         esac
21426 else
21427         gidsign=1
21428         echo "(I can't compile the test program--guessing unsigned.)" >&4
21429 fi
21430
21431
21432 : Check 64bit sizes
21433 echo " "
21434
21435 if $test X"$quadtype" != X; then
21436
21437 echo "Checking how to print 64-bit integers..." >&4
21438
21439 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21440         $cat >try.c <<'EOCP'
21441 #include <sys/types.h>
21442 #include <stdio.h>
21443 int main() {
21444   int q = 12345678901;
21445   printf("%ld\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='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21454                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21455                         echo "We will use %d."
21456                         ;;
21457                 esac
21458         fi
21459 fi
21460
21461 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21462         $cat >try.c <<'EOCP'
21463 #include <sys/types.h>
21464 #include <stdio.h>
21465 int main() {
21466   long q = 12345678901;
21467   printf("%ld\n", q);
21468 }
21469 EOCP
21470         set try
21471         if eval $compile; then
21472                 yyy=`$run ./try`
21473                 case "$yyy" in
21474                 12345678901)
21475                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21476                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21477                         echo "We will use %ld."
21478                         ;;
21479                 esac
21480         fi
21481 fi
21482
21483 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21484         $cat >try.c <<'EOCP'
21485 #include <sys/types.h>
21486 #include <inttypes.h>
21487 #include <stdio.h>
21488 int main() {
21489   int64_t q = 12345678901;
21490   printf("%" PRId64 "\n", q);
21491 }
21492 EOCP
21493         set try
21494         if eval $compile; then
21495                 yyy=`$run ./try`
21496                 case "$yyy" in
21497                 12345678901)
21498                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21499                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
21500                         echo "We will use the C9X style."
21501                         ;;
21502                 esac
21503         fi
21504 fi
21505
21506 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21507         $cat >try.c <<EOCP
21508 #include <sys/types.h>
21509 #include <stdio.h>
21510 int main() {
21511   $quadtype q = 12345678901;
21512   printf("%Ld\n", q);
21513 }
21514 EOCP
21515         set try
21516         if eval $compile; then
21517                 yyy=`$run ./try`
21518                 case "$yyy" in
21519                 12345678901)
21520                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21521                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21522                         echo "We will use %Ld."
21523                         ;;
21524                 esac
21525         fi
21526 fi
21527
21528 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21529         $cat >try.c <<'EOCP'
21530 #include <sys/types.h>
21531 #include <stdio.h>
21532 int main() {
21533   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21534   printf("%lld\n", q);
21535 }
21536 EOCP
21537         set try
21538         if eval $compile; then
21539                 yyy=`$run ./try`
21540                 case "$yyy" in
21541                 12345678901)
21542                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21543                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21544                         echo "We will use the %lld style."
21545                         ;;
21546                 esac
21547         fi
21548 fi
21549
21550 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21551         $cat >try.c <<EOCP
21552 #include <sys/types.h>
21553 #include <stdio.h>
21554 int main() {
21555   $quadtype q = 12345678901;
21556   printf("%qd\n", q);
21557 }
21558 EOCP
21559         set try
21560         if eval $compile; then
21561                 yyy=`$run ./try`
21562                 case "$yyy" in
21563                 12345678901)
21564                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21565                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21566                         echo "We will use %qd."
21567                         ;;
21568                 esac
21569         fi
21570 fi
21571
21572 if $test X"$sPRId64" = X; then
21573         echo "Cannot figure out how to print 64-bit integers." >&4
21574 fi
21575 $rm_try
21576
21577 fi
21578
21579 case "$sPRId64" in
21580 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21581         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21582         ;;
21583 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21584         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21585         ;;
21586 esac
21587
21588 : Check format strings for internal types
21589 echo " "
21590 $echo "Checking the format strings to be used for Perl's internal types..." >&4
21591
21592 if $test X"$ivsize" = X8; then
21593         ivdformat="$sPRId64"
21594         uvuformat="$sPRIu64"
21595         uvoformat="$sPRIo64"
21596         uvxformat="$sPRIx64"
21597         uvXUformat="$sPRIXU64"
21598 else
21599         if $test X"$ivsize" = X"$longsize"; then
21600                 ivdformat='"ld"'
21601                 uvuformat='"lu"'
21602                 uvoformat='"lo"'
21603                 uvxformat='"lx"'
21604                 uvXUformat='"lX"'
21605         else
21606                 if $test X"$ivsize" = X"$intsize"; then
21607                         ivdformat='"d"'
21608                         uvuformat='"u"'
21609                         uvoformat='"o"'
21610                         uvxformat='"x"'
21611                         uvXUformat='"X"'
21612                 else
21613                         : far out
21614                         if $test X"$ivsize" = X"$shortsize"; then
21615                                 ivdformat='"hd"'
21616                                 uvuformat='"hu"'
21617                                 uvoformat='"ho"'
21618                                 uvxformat='"hx"'
21619                                 uvXUformat='"hX"'
21620                         fi
21621                 fi
21622         fi
21623 fi
21624
21625 if $test X"$usequadmath" = X"$define"; then
21626     nveformat='"Qe"'
21627     nvfformat='"Qf"'
21628     nvgformat='"Qg"'
21629     nvEUformat='"QE"'
21630     nvFUformat='"QF"'
21631     nvGUformat='"QG"'
21632 else
21633     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21634         nveformat="$sPRIeldbl"
21635         nvfformat="$sPRIfldbl"
21636         nvgformat="$sPRIgldbl"
21637         nvEUformat="$sPRIEUldbl"
21638         nvFUformat="$sPRIFUldbl"
21639         nvGUformat="$sPRIGUldbl"
21640     else
21641         nveformat='"e"'
21642         nvfformat='"f"'
21643         nvgformat='"g"'
21644         nvEUformat='"E"'
21645         nvFUformat='"F"'
21646         nvGUformat='"G"'
21647     fi
21648 fi
21649
21650 case "$ivdformat" in
21651 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21652     exit 1
21653     ;;
21654 esac
21655
21656 : Check format string for GID
21657
21658 echo " "
21659 $echo "Checking the format string to be used for gids..." >&4
21660
21661 case "$gidsign" in
21662 -1)     if $test X"$gidsize" = X"$ivsize"; then
21663                 gidformat="$ivdformat"
21664         else
21665                 if $test X"$gidsize" = X"$longsize"; then
21666                         gidformat='"ld"'
21667                 else
21668                         if $test X"$gidsize" = X"$intsize"; then
21669                                 gidformat='"d"'
21670                         else
21671                                 if $test X"$gidsize" = X"$shortsize"; then
21672                                         gidformat='"hd"'
21673                                 fi
21674                         fi
21675                 fi
21676         fi
21677         ;;
21678 *)      if $test X"$gidsize" = X"$uvsize"; then
21679                 gidformat="$uvuformat"
21680         else
21681                 if $test X"$gidsize" = X"$longsize"; then
21682                         gidformat='"lu"'
21683                 else
21684                         if $test X"$gidsize" = X"$intsize"; then
21685                                 gidformat='"u"'
21686                         else
21687                                 if $test X"$gidsize" = X"$shortsize"; then
21688                                         gidformat='"hu"'
21689                                 fi
21690                         fi
21691                 fi
21692         fi
21693         ;;
21694 esac
21695
21696 : see if getgroups exists
21697 set getgroups d_getgrps
21698 eval $inlibc
21699
21700 : see if setgroups exists
21701 set setgroups d_setgrps
21702 eval $inlibc
21703
21704 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21705 echo " "
21706 case "$d_getgrps$d_setgrps" in
21707 *define*)
21708         case "$groupstype" in
21709         '') dflt="$gidtype" ;;
21710         *)  dflt="$groupstype" ;;
21711         esac
21712         $cat <<EOM
21713 What type of pointer is the second argument to getgroups() and setgroups()?
21714 Usually this is the same as group ids, $gidtype, but not always.
21715
21716 EOM
21717         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21718         . ./myread
21719         groupstype="$ans"
21720         ;;
21721 *)  groupstype="$gidtype";;
21722 esac
21723
21724 : check whether make sets MAKE
21725 echo " "
21726 echo "Checking if your $make program sets \$(MAKE)..." >&4
21727 case "$make_set_make" in
21728 '')
21729         $sed 's/^X //' > testmake.mak << 'EOF'
21730 Xall:
21731 X       @echo 'maketemp="$(MAKE)"'
21732 EOF
21733         case "`$make -f testmake.mak 2>/dev/null`" in
21734         *maketemp=*) make_set_make='#' ;;
21735         *)      make_set_make="MAKE=$make" ;;
21736         esac
21737         $rm -f testmake.mak
21738         ;;
21739 esac
21740 case "$make_set_make" in
21741 '#') echo "Yup, it does.";;
21742 *) echo "Nope, it doesn't.";;
21743 esac
21744
21745 : see what type is used for mode_t
21746 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21747 set mode_t modetype int stdio.h sys/types.h
21748 eval $typedef_ask
21749
21750 : see if we need va_copy
21751 echo " "
21752 case "$i_stdarg" in
21753 "$define")
21754         $cat >try.c <<EOCP
21755 #include <stdarg.h>
21756 #include <stdio.h>
21757 #$i_stdlib I_STDLIB
21758 #ifdef I_STDLIB
21759 #include <stdlib.h>
21760 #endif
21761 #include <signal.h>
21762
21763 int
21764 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21765 {
21766   return vfprintf(f, fmt, *valp);
21767 }
21768
21769 int
21770 myvfprintf(FILE *f, const  char *fmt, va_list val)
21771 {
21772   return ivfprintf(f, fmt, &val);
21773 }
21774
21775 int
21776 myprintf(char *fmt, ...)
21777 {
21778   va_list val;
21779   va_start(val, fmt);
21780   return myvfprintf(stdout, fmt, val);
21781 }
21782
21783 int
21784 main(int ac, char **av)
21785 {
21786   signal(SIGSEGV, exit);
21787
21788   myprintf("%s%cs all right, then\n", "that", '\'');
21789   exit(0);
21790 }
21791 EOCP
21792         set try
21793         if eval $compile && $run ./try 2>&1 >/dev/null; then
21794                 case "`$run ./try`" in
21795                 "that's all right, then")
21796                         okay=yes
21797                         ;;
21798                 esac
21799         fi
21800         case "$okay" in
21801         yes)    echo "It seems that you don't need va_copy()." >&4
21802                 need_va_copy="$undef"
21803                 ;;
21804         *)      echo "It seems that va_copy() or similar will be needed." >&4
21805                 need_va_copy="$define"
21806                 ;;
21807         esac
21808         $rm_try
21809         ;;
21810 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
21811         need_va_copy="$undef"
21812         ;;
21813 esac
21814
21815 : see what type is used for size_t
21816 rp="What is the type used for the length parameter for string functions?"
21817 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21818 eval $typedef_ask
21819
21820 : check for type of arguments to gethostbyaddr.
21821 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21822         case "$d_gethbyaddr" in
21823         $define)
21824                 $cat <<EOM
21825
21826 Checking to see what type of arguments are accepted by gethostbyaddr().
21827 EOM
21828                 hdrs="$define sys/types.h
21829                         $d_socket sys/socket.h
21830                         $i_niin netinet/in.h
21831                         $i_netdb netdb.h
21832                         $i_unistd unistd.h"
21833                 : The first arg can 'char *' or 'void *'
21834                 : The second arg is some of integral type
21835                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21836                         for yyy in size_t long int; do
21837                                 case "$netdb_host_type" in
21838                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21839                                         if ./protochk "$try" $hdrs; then
21840                                                 echo "Your system accepts $xxx for the first arg."
21841                                                 echo "...and $yyy for the second arg."
21842                                                 netdb_host_type="$xxx"
21843                                                 netdb_hlen_type="$yyy"
21844                                         fi
21845                                         ;;
21846                                 esac
21847                         done
21848                 done
21849                 : In case none of those worked, prompt the user.
21850                 case "$netdb_host_type" in
21851                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21852                         dflt='char *'
21853                         . ./myread
21854                         netdb_host_type=$ans
21855                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21856                         dflt="$sizetype"
21857                         . ./myread
21858                         netdb_hlen_type=$ans
21859                         ;;
21860                 esac
21861                 ;;
21862         *)      : no gethostbyaddr, so pick harmless defaults
21863                 netdb_host_type='char *'
21864                 netdb_hlen_type="$sizetype"
21865                 ;;
21866         esac
21867         # Remove the "const" if needed. -- but then we'll have a
21868         # prototype clash!
21869         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21870 fi
21871
21872 : check for type of argument to gethostbyname.
21873 if test "X$netdb_name_type" = X ; then
21874         case "$d_gethbyname" in
21875         $define)
21876                 $cat <<EOM
21877
21878 Checking to see what type of argument is accepted by gethostbyname().
21879 EOM
21880                 hdrs="$define sys/types.h
21881                         $d_socket sys/socket.h
21882                         $i_niin netinet/in.h
21883                         $i_netdb netdb.h
21884                         $i_unistd unistd.h"
21885                 for xxx in "const char *" "char *"; do
21886                         case "$netdb_name_type" in
21887                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21888                                 if ./protochk "$try" $hdrs; then
21889                                         echo "Your system accepts $xxx."
21890                                         netdb_name_type="$xxx"
21891                                 fi
21892                                 ;;
21893                         esac
21894                 done
21895                 : In case none of those worked, prompt the user.
21896                 case "$netdb_name_type" in
21897                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21898                         dflt='char *'
21899                         . ./myread
21900                         netdb_name_type=$ans
21901                         ;;
21902                 esac
21903                 ;;
21904         *)      : no gethostbyname, so pick harmless default
21905                 netdb_name_type='char *'
21906                 ;;
21907         esac
21908 fi
21909
21910 : check for type of 1st argument to getnetbyaddr.
21911 if test "X$netdb_net_type" = X ; then
21912         case "$d_getnbyaddr" in
21913         $define)
21914                 $cat <<EOM
21915
21916 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21917 EOM
21918                 hdrs="$define sys/types.h
21919                         $d_socket sys/socket.h
21920                         $i_niin netinet/in.h
21921                         $i_netdb netdb.h
21922                         $i_unistd unistd.h"
21923                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21924                         case "$netdb_net_type" in
21925                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21926                                 if ./protochk "$try" $hdrs; then
21927                                         echo "Your system accepts $xxx."
21928                                         netdb_net_type="$xxx"
21929                                 fi
21930                                 ;;
21931                         esac
21932                 done
21933                 : In case none of those worked, prompt the user.
21934                 case "$netdb_net_type" in
21935                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21936                         dflt='long'
21937                         . ./myread
21938                         netdb_net_type=$ans
21939                         ;;
21940                 esac
21941                 ;;
21942         *)      : no getnetbyaddr, so pick harmless default
21943                 netdb_net_type='long'
21944                 ;;
21945         esac
21946 fi
21947 : locate the preferred pager for this system
21948 fn=f/
21949 case "$pager" in
21950 '')
21951         dflt=''
21952         case "$pg" in
21953         /*) dflt=$pg;;
21954         [a-zA-Z]:/*) dflt=$pg;;
21955         esac
21956         case "$more" in
21957         /*) dflt=$more;;
21958         [a-zA-Z]:/*) dflt=$more;;
21959         esac
21960         case "$less" in
21961         /*) dflt=$less;;
21962         [a-zA-Z]:/*) dflt=$less;;
21963         esac
21964         case "$dflt" in
21965         '') dflt=/usr/ucb/more;;
21966         esac
21967         ;;
21968 *)      dflt="$pager"
21969         ;;
21970 esac
21971 fn="f/($dflt)"
21972 echo " "
21973 rp='What pager is used on your system?'
21974 . ./getfile
21975 pager="$ans"
21976
21977 : see if ar generates random libraries by itself
21978 echo " "
21979 echo "Checking how to generate random libraries on your machine..." >&4
21980 echo 'int bar1() { return bar2(); }' > bar1.c
21981 echo 'int bar2() { return 2; }' > bar2.c
21982 $cat > foo.c <<EOP
21983 #$i_stdlib I_STDLIB
21984 #ifdef I_STDLIB
21985 #include <stdlib.h>
21986 #endif
21987 int main() { printf("%d\n", bar1()); exit(0); }
21988 EOP
21989 $cc $ccflags -c bar1.c >/dev/null 2>&1
21990 $cc $ccflags -c bar2.c >/dev/null 2>&1
21991 $cc $ccflags -c foo.c >/dev/null 2>&1
21992 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21993 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21994         $run ./foobar >/dev/null 2>&1; then
21995         echo "$ar appears to generate random libraries itself."
21996         orderlib=false
21997         if [ "X$ranlib" = "X" ]; then
21998             ranlib=":"
21999         fi
22000 elif $ar s bar$_a >/dev/null 2>&1 &&
22001         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
22002         $run ./foobar >/dev/null 2>&1; then
22003                 echo "a table of contents needs to be added with '$ar s'."
22004                 orderlib=false
22005                 ranlib="$ar s"
22006 elif $ar ts bar$_a >/dev/null 2>&1 &&
22007         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
22008         $run ./foobar >/dev/null 2>&1; then
22009                 echo "a table of contents needs to be added with '$ar ts'."
22010                 orderlib=false
22011                 ranlib="$ar ts"
22012 else
22013         case "$ranlib" in
22014         :) ranlib='';;
22015         '')
22016                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
22017                 $test -f $ranlib || ranlib=''
22018                 ;;
22019         esac
22020         if $test -n "$ranlib"; then
22021                 echo "your system has '$ranlib'; we'll use that."
22022                 orderlib=false
22023         else
22024                 echo "your system doesn't seem to support random libraries"
22025                 echo "so we'll use lorder and tsort to order the libraries."
22026                 orderlib=true
22027                 ranlib=":"
22028         fi
22029 fi
22030 $rm -f foo* bar*
22031
22032 : see if this is a values.h system
22033 set values.h i_values
22034 eval $inhdr
22035
22036 : Check the max offset that gmtime and localtime accept
22037 echo "Checking max offsets that gmtime () accepts"
22038
22039 case $i_values in
22040     define) yyy="#include <values.h>" ;;
22041     *)      yyy="" ;;
22042     esac
22043
22044 case "$sGMTIME_min/$sGMTIME_max" in
22045     0/0|/)
22046         $cat >try.c <<EOCP
22047 #include <sys/types.h>
22048 #include <stdio.h>
22049 #include <time.h>
22050 $yyy
22051
22052 int i;
22053 struct tm *tmp;
22054 time_t pt;
22055
22056 void gm_check (time_t t, int min_year, int max_year)
22057 {
22058     tmp = gmtime (&t);
22059     if ( tmp == NULL ||
22060         /* Check tm_year overflow */
22061          tmp->tm_year < min_year || tmp->tm_year > max_year)
22062         tmp = NULL;
22063     else
22064         pt = t;
22065     } /* gm_check */
22066
22067 int check_max ()
22068 {
22069     tmp = NULL;
22070     pt  = 0;
22071 #ifdef MAXLONG
22072     gm_check (MAXLONG, 69, 0x7fffffff);
22073 #endif
22074     if (tmp == NULL || tmp->tm_year < 0) {
22075         for (i = 63; i >= 0; i--) {
22076             time_t x = pt | ((time_t)1 << i);
22077             if (x < 0 || x < pt) continue;
22078             gm_check (x, 69, 0x7fffffff);
22079             }
22080         }
22081     printf ("sGMTIME_max=%ld\n", pt);
22082     return (0);
22083     } /* check_max */
22084
22085 int check_min ()
22086 {
22087     tmp = NULL;
22088     pt  = 0;
22089 #ifdef MINLONG
22090     gm_check (MINLONG, -1900, 70);
22091 #endif
22092     if (tmp == NULL) {
22093         for (i = 36; i >= 0; i--) {
22094             time_t x = pt - ((time_t)1 << i);
22095             if (x > 0) continue;
22096             gm_check (x, -1900, 70);
22097             }
22098         }
22099     printf ("sGMTIME_min=%ld\n", pt);
22100     return (0);
22101     } /* check_min */
22102
22103 int main (int argc, char *argv[])
22104 {
22105     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
22106     check_max ();
22107     check_min ();
22108     return (0);
22109     } /* main */
22110 EOCP
22111         set try
22112         if eval $compile; then
22113             eval `$run ./try 2>/dev/null`
22114         else
22115             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
22116             fi
22117         $rm_try
22118         ;;
22119     esac
22120
22121 echo "Checking max offsets that localtime () accepts"
22122
22123 case "$sLOCALTIME_min/$sLOCALTIME_max" in
22124     0/0|/)
22125         $cat >try.c <<EOCP
22126 #include <sys/types.h>
22127 #include <stdio.h>
22128 #include <time.h>
22129 $yyy
22130
22131 int i;
22132 struct tm *tmp;
22133 time_t pt;
22134
22135 void local_check (time_t t, int min_year, int max_year)
22136 {
22137     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
22138         tmp = NULL;
22139     else
22140         tmp = localtime (&t);
22141     if ( tmp == NULL ||
22142         /* Check tm_year overflow */
22143          tmp->tm_year < min_year || tmp->tm_year > max_year)
22144         tmp = NULL;
22145     else
22146         pt = t;
22147     } /* local_check */
22148
22149 int check_max ()
22150 {
22151     tmp = NULL;
22152     pt  = 0;
22153 #ifdef MAXLONG
22154     local_check (MAXLONG, 69, 0x7fffffff);
22155 #endif
22156     if (tmp == NULL || tmp->tm_year < 0) {
22157         for (i = 63; i >= 0; i--) {
22158             time_t x = pt | ((time_t)1 << i);
22159             if (x < 0 || x < pt) continue;
22160             local_check (x, 69, 0x7fffffff);
22161             }
22162         }
22163     printf ("sLOCALTIME_max=%ld\n", pt);
22164     return (0);
22165    } /* check_max */
22166
22167 int check_min ()
22168 {
22169     tmp = NULL;
22170     pt  = 0;
22171 #ifdef MINLONG
22172     local_check (MINLONG, -1900, 70);
22173 #endif
22174     if (tmp == NULL) {
22175         for (i = 36; i >= 0; i--) {
22176             time_t x = pt - ((time_t)1 << i);
22177             if (x > 0) continue;
22178             local_check (x, -1900, 70);
22179             }
22180         }
22181     printf ("sLOCALTIME_min=%ld\n", pt);
22182     return (0);
22183     } /* check_min */
22184
22185 int main (int argc, char *argv[])
22186 {
22187     check_max ();
22188     check_min ();
22189     return (0);
22190     } /* main */
22191 EOCP
22192         set try
22193         if eval $compile; then
22194             eval `$run ./try 2>/dev/null`
22195         else
22196             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
22197             fi
22198         $rm_try
22199         ;;
22200     esac
22201
22202 : check for type of arguments to select.
22203 case "$selecttype" in
22204 '') case "$d_select" in
22205         $define)
22206                 echo " "
22207                 $cat <<EOM
22208 Checking to see what type of arguments are accepted by select().
22209 EOM
22210                 hdrs="$define sys/types.h
22211                         $i_systime sys/time.h
22212                         $i_sysselct sys/select.h
22213                         $d_socket sys/socket.h"
22214                 : The first arg can be int, unsigned, or size_t
22215                 : The last arg may or may not be 'const'
22216                 val=''
22217                 : void pointer has been seen but using that
22218                 : breaks the selectminbits test
22219                 for xxx in 'fd_set *' 'int *'; do
22220                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
22221                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
22222                                         case "$val" in
22223                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
22224                                                 if ./protochk "$try" $hdrs; then
22225                                                         echo "Your system accepts $xxx."
22226                                                         val="$xxx"
22227                                                 fi
22228                                                 ;;
22229                                         esac
22230                                 done
22231                         done
22232                 done
22233                 case "$val" in
22234                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
22235                         case "$d_fd_set" in
22236                                 $define) dflt="fd_set *" ;;
22237                                 *)              dflt="int *" ;;
22238                         esac
22239                         . ./myread
22240                         val=$ans
22241                         ;;
22242                 esac
22243                 selecttype="$val"
22244                 ;;
22245         *)      : no select, so pick a harmless default
22246                 selecttype='int *'
22247                 ;;
22248         esac
22249         ;;
22250 esac
22251
22252 : check for the select 'width'
22253 case "$selectminbits" in
22254 '') safebits=`expr $ptrsize \* 8`
22255     case "$d_select" in
22256         $define)
22257                 $cat <<EOM
22258
22259 Checking to see on how many bits at a time your select() operates...
22260 EOM
22261                 $cat >try.c <<EOCP
22262 #include <sys/types.h>
22263 #$i_time I_TIME
22264 #$i_systime I_SYS_TIME
22265 #$i_systimek I_SYS_TIME_KERNEL
22266 #ifdef I_TIME
22267 #   include <time.h>
22268 #endif
22269 #ifdef I_SYS_TIME
22270 #   ifdef I_SYS_TIME_KERNEL
22271 #       define KERNEL
22272 #   endif
22273 #   include <sys/time.h>
22274 #   ifdef I_SYS_TIME_KERNEL
22275 #       undef KERNEL
22276 #   endif
22277 #endif
22278 #$i_sysselct I_SYS_SELECT
22279 #ifdef I_SYS_SELECT
22280 #include <sys/select.h>
22281 #endif
22282 #$d_socket HAS_SOCKET
22283 #ifdef HAS_SOCKET
22284 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
22285 #endif
22286 #include <stdio.h>
22287 #$i_stdlib I_STDLIB
22288 #ifdef I_STDLIB
22289 #include <stdlib.h>
22290 #endif
22291 $selecttype b;
22292 #define S sizeof(*(b))
22293 #define MINBITS 64
22294 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
22295 #define NBITS  (NBYTES * 8)
22296 int main() {
22297     char *s = (char *)malloc(NBYTES);
22298     struct timeval t;
22299     int i;
22300     FILE* fp;
22301     int fd;
22302
22303     if (!s)
22304         exit(1);
22305     fclose(stdin);
22306     fp = fopen("try.c", "r");
22307     if (fp == 0)
22308       exit(2);
22309     fd = fileno(fp);
22310     if (fd < 0)
22311       exit(3);
22312     b = ($selecttype)s;
22313     for (i = 0; i < NBITS; i++)
22314         FD_SET(i, b);
22315     t.tv_sec  = 0;
22316     t.tv_usec = 0;
22317     select(fd + 1, b, 0, 0, &t);
22318     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
22319     free(s);
22320     printf("%d\n", i + 1);
22321     return 0;
22322 }
22323 EOCP
22324                 set try
22325                 if eval $compile_ok; then
22326                         selectminbits=`$run ./try 2>/dev/null`
22327                         case "$selectminbits" in
22328                         '')     cat >&4 <<EOM
22329 Cannot figure out on how many bits at a time your select() operates.
22330 I'll play safe and guess it is $safebits bits.
22331 EOM
22332                                 selectminbits=$safebits
22333                                 bits="$safebits bits"
22334                                 ;;
22335                         1)      bits="1 bit" ;;
22336                         *)      bits="$selectminbits bits" ;;
22337                         esac
22338                         echo "Your select() operates on $bits at a time." >&4
22339                 else
22340                         rp='What is the minimum number of bits your select() operates on?'
22341                         case "$byteorder" in
22342                         12345678)       dflt=64 ;;
22343                         1234)           dflt=32 ;;
22344                         *)              dflt=1  ;;
22345                         esac
22346                         . ./myread
22347                         val=$ans
22348                         selectminbits="$val"
22349                 fi
22350                 $rm_try
22351                 ;;
22352         *)      : no select, so pick a harmless default
22353                 selectminbits=$safebits
22354                 ;;
22355         esac
22356         ;;
22357 esac
22358
22359 : Trace out the files included by signal.h, then look for SIGxxx names.
22360 case "$sig_num_init" in
22361 '')
22362 if [ "X$fieldn" = X ]; then
22363         : Just make some guesses.  We check them later.
22364         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
22365 else
22366         xxx=`echo '#include <signal.h>' |
22367         $cppstdin $cppminus $cppflags 2>/dev/null |
22368         $grep '^[       ]*#.*include' |
22369         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
22370                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
22371 fi
22372 xxxfiles=''
22373 for xx in $xxx /dev/null ; do
22374         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
22375 done
22376 case "$xxxfiles" in
22377 '')     xxxfiles=`./findhdr signal.h` ;;
22378 esac
22379 xxx=`awk '
22380 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
22381         print substr($2, 4, 20)
22382 }
22383 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
22384         print substr($3, 4, 20)
22385 }' $xxxfiles`
22386 : Append some common names just in case the awk scan failed.
22387 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22388 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22389 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22390 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22391 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22392
22393 : generate a few handy files for later
22394 $cat > signal.c <<EOCP
22395 #include <sys/types.h>
22396 #include <signal.h>
22397 #$i_stdlib I_STDLIB
22398 #ifdef I_STDLIB
22399 #include <stdlib.h>
22400 #endif
22401 #include <stdio.h>
22402 int main() {
22403
22404 /* Strange style to avoid deeply-nested #if/#else/#endif */
22405 #ifndef NSIG
22406 #  ifdef _NSIG
22407 #    define NSIG (_NSIG)
22408 #  endif
22409 #endif
22410
22411 #ifndef NSIG
22412 #  ifdef SIGMAX
22413 #    define NSIG (SIGMAX+1)
22414 #  endif
22415 #endif
22416
22417 #ifndef NSIG
22418 #  ifdef SIG_MAX
22419 #    define NSIG (SIG_MAX+1)
22420 #  endif
22421 #endif
22422
22423 #ifndef NSIG
22424 #  ifdef _SIG_MAX
22425 #    define NSIG (_SIG_MAX+1)
22426 #  endif
22427 #endif
22428
22429 #ifndef NSIG
22430 #  ifdef MAXSIG
22431 #    define NSIG (MAXSIG+1)
22432 #  endif
22433 #endif
22434
22435 #ifndef NSIG
22436 #  ifdef MAX_SIG
22437 #    define NSIG (MAX_SIG+1)
22438 #  endif
22439 #endif
22440
22441 #ifndef NSIG
22442 #  ifdef SIGARRAYSIZE
22443 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22444 #  endif
22445 #endif
22446
22447 #ifndef NSIG
22448 #  ifdef _sys_nsig
22449 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
22450 #  endif
22451 #endif
22452
22453 /* Default to some arbitrary number that's big enough to get most
22454    of the common signals.
22455 */
22456 #ifndef NSIG
22457 #    define NSIG 50
22458 #endif
22459
22460 printf("NSIG %d\n", NSIG);
22461
22462 #ifndef JUST_NSIG
22463
22464 EOCP
22465
22466 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22467 {
22468         printf "#ifdef SIG"; printf $1; printf "\n"
22469         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22470         printf $1; printf ");\n"
22471         printf "#endif\n"
22472 }
22473 END {
22474         printf "#endif /* JUST_NSIG */\n";
22475         printf "exit(0);\n}\n";
22476 }
22477 ' >>signal.c
22478 $cat >signal.awk <<'EOP'
22479 BEGIN { ndups = 0 }
22480 $1 ~ /^NSIG$/ { nsig = $2 }
22481 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22482     if ($2 > maxsig) { maxsig = $2 }
22483     if (sig_name[$2]) {
22484         dup_name[ndups] = $1
22485         dup_num[ndups] = $2
22486         ndups++
22487     }
22488     else {
22489         sig_name[$2] = $1
22490         sig_num[$2] = $2
22491     }
22492 }
22493 END {
22494     if (nsig == 0) {
22495         nsig = maxsig + 1
22496     }
22497     printf("NSIG %d\n", nsig);
22498     for (n = 1; n < nsig; n++) {
22499         if (sig_name[n]) {
22500             printf("%s %d\n", sig_name[n], sig_num[n])
22501         }
22502         else {
22503             printf("NUM%d %d\n", n, n)
22504         }
22505     }
22506     for (n = 0; n < ndups; n++) {
22507         printf("%s %d\n", dup_name[n], dup_num[n])
22508     }
22509 }
22510 EOP
22511 $cat >signal_cmd <<EOS
22512 $startsh
22513 if $test -s signal.lst; then
22514     echo "Using your existing signal.lst file"
22515         exit 0
22516 fi
22517 xxx="$xxx"
22518 EOS
22519 $cat >>signal_cmd <<'EOS'
22520
22521 set signal
22522 if eval $compile_ok; then
22523         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22524                 $uniq | $awk -f signal.awk >signal.lst
22525 else
22526         echo "(I can't seem be able to compile the whole test program)" >&4
22527         echo "(I'll try it in little pieces.)" >&4
22528         set signal -DJUST_NSIG
22529         if eval $compile_ok; then
22530                 $run ./signal$_exe > signal.nsg
22531                 $cat signal.nsg
22532         else
22533                 echo "I can't seem to figure out how many signals you have." >&4
22534                 echo "Guessing 50." >&4
22535                 echo 'NSIG 50' > signal.nsg
22536         fi
22537         : Now look at all the signal names, one at a time.
22538         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22539                 $cat > signal.c <<EOCP
22540 #include <sys/types.h>
22541 #include <signal.h>
22542 #include <stdio.h>
22543 int main() {
22544 printf("$xx %d\n", SIG${xx});
22545 return 0;
22546 }
22547 EOCP
22548                 set signal
22549                 if eval $compile; then
22550                         echo "SIG${xx} found."
22551                         $run ./signal$_exe  >> signal.ls1
22552                 else
22553                         echo "SIG${xx} NOT found."
22554                 fi
22555         done
22556         if $test -s signal.ls1; then
22557                 $cat signal.nsg signal.ls1 |
22558                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
22559         fi
22560
22561 fi
22562 if $test -s signal.lst; then
22563         :
22564 else
22565         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
22566         echo 'kill -l' >signal
22567         set X `csh -f <signal`
22568         $rm -f signal
22569         shift
22570         case $# in
22571         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
22572         esac
22573         echo $@ | $tr ' ' $trnl | \
22574             $awk '{ printf "%s %d\n", $1, ++s; }
22575                   END { printf "NSIG %d\n", ++s }' >signal.lst
22576 fi
22577 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
22578 EOS
22579 chmod a+x signal_cmd
22580 $eunicefix signal_cmd
22581 ;;
22582 esac
22583
22584 : generate list of signal names
22585 case "$sig_num_init" in
22586 '')
22587 echo " "
22588 case "$sig_name_init" in
22589 '') doinit=yes ;;
22590 *)  case "$sig_num_init" in
22591     ''|*,*) doinit=yes ;;
22592     esac ;;
22593 esac
22594 case "$doinit" in
22595 yes)
22596         echo "Generating a list of signal names and numbers..." >&4
22597         . ./signal_cmd
22598         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22599         sig_name=`$awk 'BEGIN { printf "ZERO " }
22600                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
22601         sig_num=`$awk  'BEGIN { printf "0 " }
22602                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
22603         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
22604                              !/^NSIG/   { printf "\"%s\", ", $1 }
22605                              END        { printf "0\n" }' signal.lst`
22606         sig_num_init=`$awk  'BEGIN      { printf "0, " }
22607                              !/^NSIG/   { printf "%d, ", $2}
22608                              END        { printf "0\n"}' signal.lst`
22609         ;;
22610 esac
22611 echo "The following $sig_count signals are available:"
22612 echo " "
22613 echo $sig_name | $awk \
22614 'BEGIN { linelen = 0 }
22615 {
22616         for (i = 1; i <= NF; i++) {
22617                 name = "SIG" $i " "
22618                 linelen = linelen + length(name)
22619                 if (linelen > 70) {
22620                         printf "\n"
22621                         linelen = length(name)
22622                 }
22623                 printf "%s", name
22624         }
22625         printf "\n"
22626 }'
22627 sig_size=`echo $sig_name | awk '{print NF}'`
22628 $rm -f signal signal.c signal.awk signal.lst signal_cmd
22629 ;;
22630 esac
22631
22632 : Check size of size
22633 echo " "
22634 case "$sizetype" in
22635 *_t) zzz="$sizetype"    ;;
22636 *)   zzz="filesize"     ;;
22637 esac
22638 echo "Checking the size of $zzz..." >&4
22639 cat > try.c <<EOCP
22640 #include <sys/types.h>
22641 #include <stdio.h>
22642 #$i_stdlib I_STDLIB
22643 #ifdef I_STDLIB
22644 #include <stdlib.h>
22645 #endif
22646 int main() {
22647     printf("%d\n", (int)sizeof($sizetype));
22648     exit(0);
22649 }
22650 EOCP
22651 set try
22652 if eval $compile_ok; then
22653         yyy=`$run ./try`
22654         case "$yyy" in
22655         '')     sizesize=4
22656                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22657                 ;;
22658         *)      sizesize=$yyy
22659                 echo "Your $zzz size is $sizesize bytes."
22660                 ;;
22661         esac
22662 else
22663         sizesize=4
22664         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22665 fi
22666
22667
22668 : check for socklen_t
22669 echo " "
22670 echo "Checking to see if you have socklen_t..." >&4
22671 $cat >try.c <<EOCP
22672 #include <sys/types.h>
22673 #$d_socket HAS_SOCKET
22674 #ifdef HAS_SOCKET
22675 #include <sys/socket.h>
22676 #endif
22677 int main() { socklen_t x = 16; }
22678 EOCP
22679 set try
22680 if eval $compile; then
22681         val="$define"
22682         echo "You have socklen_t."
22683 else
22684         val="$undef"
22685         echo "You do not have socklen_t."
22686         case "$sizetype" in
22687         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22688         esac
22689 fi
22690 $rm_try
22691 set d_socklen_t
22692 eval $setvar
22693
22694 : see if this is a socks.h system
22695 set socks.h i_socks
22696 eval $inhdr
22697
22698 : check for type of the size argument to socket calls
22699 case "$d_socket" in
22700 "$define")
22701         $cat <<EOM
22702
22703 Checking to see what type is the last argument of accept().
22704 EOM
22705         yyy=''
22706         case "$d_socklen_t" in
22707         "$define") yyy="$yyy socklen_t"
22708         esac
22709         yyy="$yyy $sizetype int long unsigned"
22710         for xxx in $yyy; do
22711                 case "$socksizetype" in
22712                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22713                         case "$usesocks" in
22714                         "$define")
22715                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22716                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22717                                         socksizetype="$xxx"
22718                                 fi
22719                                 ;;
22720                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22721                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22722                                         socksizetype="$xxx"
22723                                 fi
22724                                 ;;
22725                         esac
22726                         ;;
22727                 esac
22728         done
22729 : In case none of those worked, prompt the user.
22730         case "$socksizetype" in
22731         '')     rp='What is the type for socket address structure sizes?'
22732                 dflt='int'
22733                 . ./myread
22734                 socksizetype=$ans
22735                 ;;
22736         esac
22737         ;;
22738 *)      : no sockets, so pick relatively harmless default
22739         socksizetype='int'
22740         ;;
22741 esac
22742
22743 : see what type is used for signed size_t
22744 set ssize_t ssizetype int stdio.h sys/types.h
22745 eval $typedef
22746 dflt="$ssizetype"
22747 $cat > try.c <<EOM
22748 #include <stdio.h>
22749 #$i_stdlib I_STDLIB
22750 #ifdef I_STDLIB
22751 #include <stdlib.h>
22752 #endif
22753 #include <sys/types.h>
22754 #define Size_t $sizetype
22755 #define SSize_t $dflt
22756 int main()
22757 {
22758         if (sizeof(Size_t) == sizeof(SSize_t))
22759                 printf("$dflt\n");
22760         else if (sizeof(Size_t) == sizeof(int))
22761                 printf("int\n");
22762         else
22763                 printf("long\n");
22764         exit(0);
22765 }
22766 EOM
22767 echo " "
22768 set try
22769 if eval $compile_ok && $run ./try > /dev/null; then
22770         ssizetype=`$run ./try`
22771         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22772 else
22773         $cat >&4 <<EOM
22774 Help! I can't compile and run the ssize_t test program: please enlighten me!
22775 (This is probably a misconfiguration in your system or libraries, and
22776 you really ought to fix it.  Still, I'll try anyway.)
22777
22778 I need a type that is the same size as $sizetype, but is guaranteed to
22779 be signed.  Common values are ssize_t, int and long.
22780
22781 EOM
22782         rp="What signed type is the same size as $sizetype?"
22783         . ./myread
22784         ssizetype="$ans"
22785 fi
22786 $rm_try
22787
22788 : Check the size of st_ino
22789 $echo " "
22790 $echo "Checking the size of st_ino..." >&4
22791 $cat > try.c <<EOCP
22792 #include <sys/stat.h>
22793 #include <stdio.h>
22794 #$i_stdlib I_STDLIB
22795 #ifdef I_STDLIB
22796 #include <stdlib.h>
22797 #endif
22798 int main() {
22799     struct stat st;
22800     printf("%d\n", (int)sizeof(st.st_ino));
22801     exit(0);
22802 }
22803 EOCP
22804 set try
22805 if eval $compile_ok; then
22806         val=`$run ./try`
22807         case "$val" in
22808         '')     st_ino_size=4
22809                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22810                 ;;
22811         *)      st_ino_size=$val
22812                 $echo "Your st_ino is $st_ino_size bytes long."
22813                 ;;
22814         esac
22815 else
22816         st_ino_size=4
22817         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22818 fi
22819 $rm_try
22820
22821 : Check if st_ino is signed
22822 $echo " "
22823 $echo "Checking the sign of st_ino..." >&4
22824 $cat > try.c <<EOCP
22825 #include <sys/stat.h>
22826 #include <stdio.h>
22827 int main() {
22828         struct stat foo;
22829         foo.st_ino = -1;
22830         if (foo.st_ino < 0)
22831                 printf("-1\n");
22832         else
22833                 printf("1\n");
22834 }
22835 EOCP
22836 set try
22837 if eval $compile; then
22838         val=`$run ./try`
22839         case "$val" in
22840         '')     st_ino_sign=1
22841                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22842                 ;;
22843         *)      st_ino_sign=$val
22844                 case "$st_ino_sign" in
22845                  1) $echo "Your st_ino is unsigned." ;;
22846                 -1) $echo "Your st_ino is signed."   ;;
22847                 esac
22848                 ;;
22849         esac
22850 else
22851         st_ino_sign=1
22852         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22853 fi
22854 $rm_try
22855
22856 : see what type of char stdio uses.
22857 echo " "
22858 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22859 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22860         echo "Your stdio uses unsigned chars." >&4
22861         stdchar="unsigned char"
22862 else
22863         echo "Your stdio uses signed chars." >&4
22864         stdchar="char"
22865 fi
22866 $rm -f stdioh
22867
22868 : Check size of UID
22869 echo " "
22870 case "$uidtype" in
22871 *_t) zzz="$uidtype"     ;;
22872 *)   zzz="uid"          ;;
22873 esac
22874 echo "Checking the size of $zzz..." >&4
22875 cat > try.c <<EOCP
22876 #include <sys/types.h>
22877 #include <stdio.h>
22878 #$i_stdlib I_STDLIB
22879 #ifdef I_STDLIB
22880 #include <stdlib.h>
22881 #endif
22882 int main() {
22883     printf("%d\n", (int)sizeof($uidtype));
22884     exit(0);
22885 }
22886 EOCP
22887 set try
22888 if eval $compile_ok; then
22889         yyy=`$run ./try`
22890         case "$yyy" in
22891         '')     uidsize=4
22892                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22893                 ;;
22894         *)      uidsize=$yyy
22895                 echo "Your $zzz is $uidsize bytes long."
22896                 ;;
22897         esac
22898 else
22899         uidsize=4
22900         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22901 fi
22902
22903 : Check if UID is signed
22904 echo " "
22905 case "$uidtype" in
22906 *_t) zzz="$uidtype"     ;;
22907 *)   zzz="uid"          ;;
22908 esac
22909 echo "Checking the sign of $zzz..." >&4
22910 cat > try.c <<EOCP
22911 #include <sys/types.h>
22912 #include <stdio.h>
22913 int main() {
22914         $uidtype foo = -1;
22915         if (foo < 0)
22916                 printf("-1\n");
22917         else
22918                 printf("1\n");
22919 }
22920 EOCP
22921 set try
22922 if eval $compile; then
22923         yyy=`$run ./try`
22924         case "$yyy" in
22925         '')     uidsign=1
22926                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22927                 ;;
22928         *)      uidsign=$yyy
22929                 case "$uidsign" in
22930                  1) echo "Your $zzz is unsigned." ;;
22931                 -1) echo "Your $zzz is signed."   ;;
22932                 esac
22933                 ;;
22934         esac
22935 else
22936         uidsign=1
22937         echo "(I can't compile the test program--guessing unsigned.)" >&4
22938 fi
22939
22940
22941 : Check format string for UID
22942 echo " "
22943 $echo "Checking the format string to be used for uids..." >&4
22944
22945 case "$uidsign" in
22946 -1)     if $test X"$uidsize" = X"$ivsize"; then
22947                 uidformat="$ivdformat"
22948         else
22949                 if $test X"$uidsize" = X"$longsize"; then
22950                         uidformat='"ld"'
22951                 else
22952                         if $test X"$uidsize" = X"$intsize"; then
22953                                 uidformat='"d"'
22954                         else
22955                                 if $test X"$uidsize" = X"$shortsize"; then
22956                                         uidformat='"hd"'
22957                                 fi
22958                         fi
22959                 fi
22960         fi
22961         ;;
22962 *)      if $test X"$uidsize" = X"$uvsize"; then
22963                 uidformat="$uvuformat"
22964         else
22965                 if $test X"$uidsize" = X"$longsize"; then
22966                         uidformat='"lu"'
22967                 else
22968                         if $test X"$uidsize" = X"$intsize"; then
22969                                 uidformat='"u"'
22970                         else
22971                                 if $test X"$uidsize" = X"$shortsize"; then
22972                                         uidformat='"hu"'
22973                                 fi
22974                         fi
22975                 fi
22976         fi
22977         ;;
22978 esac
22979
22980 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22981 echo " "
22982 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22983 $cat >try.c <<'EOM'
22984 /* Intentionally a long probe as I'd like to sanity check that the exact
22985    approach is going to work, as thinking it will work, but only having it
22986    part working at runtime is worse than not having it.  */
22987
22988 #include <sys/types.h>
22989 #include <sys/sysctl.h>
22990 #include <sys/param.h>
22991 #include <stdio.h>
22992 #include <string.h>
22993 #include <stdlib.h>
22994 #include <unistd.h>
22995
22996 int
22997 main(int argc, char **argv) {
22998     char *buffer;
22999     char *argv_leaf = strrchr(argv[0], '/');
23000     char *buffer_leaf;
23001     size_t size = 0;
23002     int mib[4];
23003
23004     mib[0] = CTL_KERN;
23005     mib[1] = KERN_PROC;
23006     mib[2] = KERN_PROC_PATHNAME;
23007     mib[3] = -1;
23008
23009     if (!argv_leaf) {
23010         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
23011         return 1;
23012     }
23013
23014     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
23015         perror("sysctl");
23016         return 2;
23017     }
23018
23019     if (size < strlen(argv_leaf) + 1) {
23020         fprintf(stderr, "size %lu is too short for a path\n",
23021                 (unsigned long) size);
23022         return 3;
23023     }
23024
23025     if (size > MAXPATHLEN * MAXPATHLEN) {
23026         fprintf(stderr, "size %lu is too long for a path\n",
23027                 (unsigned long) size);
23028         return 4;
23029     }
23030
23031     buffer = malloc(size);
23032     if (!buffer) {
23033         perror("malloc");
23034         return 5;
23035     }
23036
23037     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
23038         perror("sysctl");
23039         return 6;
23040     }
23041
23042     if (strlen(buffer) + 1 != size) {
23043         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
23044                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
23045         return 7;
23046     }
23047
23048
23049     if (*buffer != '/') {
23050         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
23051         return 8;
23052     }
23053
23054     if (strstr(buffer, "/./")) {
23055         fprintf(stderr, "Contains /./: '%s'\n", buffer);
23056         return 9;
23057     }
23058
23059     if (strstr(buffer, "/../")) {
23060         fprintf(stderr, "Contains /../: '%s'\n", buffer);
23061         return 10;
23062     }
23063
23064     buffer_leaf = strrchr(buffer, '/');
23065     if (strcmp(buffer_leaf, argv_leaf) != 0) {
23066         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
23067         return 11;
23068     }
23069
23070     free(buffer);
23071
23072     return 0;
23073 }
23074 EOM
23075
23076 val=$undef
23077 set try
23078 if eval $compile; then
23079         if $run ./try; then
23080                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
23081                 val="$define"
23082         else
23083                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
23084                 val="$undef"
23085         fi
23086 else
23087         echo "I'm unable to compile the test program." >&4
23088         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
23089         val="$undef"
23090 fi
23091 $rm_try
23092 set usekernprocpathname
23093 eval $setvar
23094
23095 : Determine if we can use _NSGetExecutablePath to find executing program
23096 echo " "
23097 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
23098 $cat >try.c <<'EOM'
23099 /* Intentionally a long probe as I'd like to sanity check that the exact
23100    approach is going to work, as thinking it will work, but only having it
23101    part working at runtime is worse than not having it.  */
23102 #include <mach-o/dyld.h>
23103 #include <stdio.h>
23104 #include <stdlib.h>
23105 #include <sys/param.h>
23106 #include <string.h>
23107
23108 int
23109 main(int argc, char **argv) {
23110     char buf[1];
23111     uint32_t size = sizeof(buf);
23112     int result;
23113     char *buffer;
23114     char *tidied;
23115     char *argv_leaf = strrchr(argv[0], '/');
23116     char *tidied_leaf;
23117
23118     if (!argv_leaf) {
23119         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
23120         return 1;
23121     }
23122
23123     _NSGetExecutablePath(buf, &size);
23124     if (size > MAXPATHLEN * MAXPATHLEN) {
23125         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
23126                 (unsigned int) size);
23127         return 2;
23128     }
23129
23130     buffer = malloc(size);
23131     if (!buffer) {
23132         perror("malloc");
23133         return 3;
23134     }
23135
23136     result = _NSGetExecutablePath(buffer, &size);
23137     if (result != 0) {
23138         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
23139                 result, (unsigned int) size);
23140         return 4;
23141     }
23142
23143     tidied = realpath(buffer, NULL);
23144     if (!tidied) {
23145         perror("realpath");
23146         return 5;
23147     }
23148
23149     free(buffer);
23150
23151     if (*tidied != '/') {
23152         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
23153         return 6;
23154     }
23155
23156     if (strstr(tidied, "/./")) {
23157         fprintf(stderr, "Contains /./: '%s'\n", tidied);
23158         return 7;
23159     }
23160
23161     if (strstr(tidied, "/../")) {
23162         fprintf(stderr, "Contains /../: '%s'\n", tidied);
23163         return 8;
23164     }
23165
23166     tidied_leaf = strrchr(tidied, '/');
23167     if (strcmp(tidied_leaf, argv_leaf) != 0) {
23168         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
23169         return 9;
23170     }
23171
23172     free(tidied);
23173
23174     return 0;
23175 }
23176 EOM
23177
23178 val=$undef
23179 set try
23180 if eval $compile; then
23181         if $run ./try; then
23182                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
23183                 val="$define"
23184         else
23185                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
23186         fi
23187 else
23188         echo "I'm unable to compile the test program." >&4
23189         echo "I'll assume no _NSGetExecutablePath here." >&4
23190 fi
23191 $rm_try
23192 set usensgetexecutablepath
23193 eval $setvar
23194
23195 : Check if site customization support was requested
23196 case "$usesitecustomize" in
23197     $define|true|[Yy]*)
23198         usesitecustomize="$define"
23199         ;;
23200     *)
23201         usesitecustomize="$undef"
23202         ;;
23203     esac
23204
23205 : see if prototypes support variable argument declarations
23206 echo " "
23207 case "$prototype$i_stdarg" in
23208 $define$define)
23209         echo "It appears we'll be able to prototype varargs functions." >&4
23210         val="$define"
23211         ;;
23212 *)
23213         echo "Too bad... We won't be using prototyped varargs functions..." >&4
23214         val="$undef"
23215         ;;
23216 esac
23217 set vaproto
23218 eval $setvar
23219
23220 : determine compiler compiler
23221 case "$yacc" in
23222 '')
23223         dflt=yacc;;
23224 *)
23225         dflt="$yacc";;
23226 esac
23227 echo " "
23228 comp='yacc'
23229 if $test -f "$byacc$_exe"; then
23230         dflt="$byacc"
23231         comp="byacc or $comp"
23232 fi
23233 if $test -f "$bison$_exe"; then
23234         comp="$comp or bison -y"
23235 fi
23236 rp="Which compiler compiler ($comp) shall I use?"
23237 . ./myread
23238 yacc="$ans"
23239 case "$yacc" in
23240 *bis*)
23241         case "$yacc" in
23242         *-y*) ;;
23243         *)
23244                 yacc="$yacc -y"
23245                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
23246                 ;;
23247         esac
23248         ;;
23249 esac
23250
23251 : see if this is a assert.h system
23252 set assert.h i_assert
23253 eval $inhdr
23254
23255 : see if this is a bfd.h system
23256 set bfd.h i_bfd
23257 eval $inhdr
23258
23259 : see if this is an execinfo.h system
23260 set execinfo.h i_execinfo
23261 eval $inhdr
23262
23263 : see if this is a fenv.h system
23264 set fenv.h i_fenv
23265 eval $inhdr
23266
23267 : see if this is a fp.h system
23268 set fp.h i_fp
23269 eval $inhdr
23270
23271 : see if this is a fp_class.h system
23272 set fp_class.h i_fp_class
23273 eval $inhdr
23274
23275 : see if gdbm.h is available
23276 set gdbm.h t_gdbm
23277 eval $inhdr
23278 case "$t_gdbm" in
23279 $define)
23280         : see if gdbm_open exists
23281         set gdbm_open d_gdbm_open
23282         eval $inlibc
23283         case "$d_gdbm_open" in
23284         $undef)
23285                 t_gdbm="$undef"
23286                 echo "We won't be including <gdbm.h>"
23287                 ;;
23288         esac
23289         ;;
23290 esac
23291 val="$t_gdbm"
23292 set i_gdbm
23293 eval $setvar
23294
23295 : see if this is a ieeefp.h system
23296 case "$i_ieeefp" in
23297 '' ) set ieeefp.h i_ieeefp
23298      eval $inhdr
23299      ;;
23300 esac
23301
23302 : see if this is a libutil.h system
23303 set libutil.h i_libutil
23304 eval $inhdr
23305
23306 : see if mach cthreads are available
23307 if test "X$usethreads" = "X$define"; then
23308         set mach/cthreads.h i_machcthr
23309         eval $inhdr
23310 else
23311         i_machcthr="$undef"
23312 fi
23313
23314 : see if this is a mntent.h system
23315 set mntent.h i_mntent
23316 eval $inhdr
23317
23318 : see if net/errno.h is available
23319 val=''
23320 set net/errno.h val
23321 eval $inhdr
23322
23323 : Unfortunately, it causes problems on some systems.  Arrgh.
23324 case "$val" in
23325 $define)
23326         cat > try.c <<'EOM'
23327 #include <stdio.h>
23328 #include <errno.h>
23329 #include <net/errno.h>
23330 int func()
23331 {
23332         return ENOTSOCK;
23333 }
23334 EOM
23335         if $cc $ccflags -c try.c >/dev/null 2>&1; then
23336                 echo "We'll be including <net/errno.h>." >&4
23337         else
23338                 echo "We won't be including <net/errno.h>." >&4
23339                 val="$undef"
23340         fi
23341         $rm_try
23342         ;;
23343 esac
23344 set i_neterrno
23345 eval $setvar
23346
23347 : see if netinet/tcp.h is available
23348 set netinet/tcp.h i_netinettcp
23349 eval $inhdr
23350
23351 : see if this is a poll.h system
23352 set poll.h i_poll
23353 eval $inhdr
23354
23355 : see if this is a prot.h system
23356 set prot.h i_prot
23357 eval $inhdr
23358
23359 : Preprocessor symbols
23360 echo " "
23361 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
23362 $cat <<'EOSH' > Cppsym.know
23363 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
23364 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
23365 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
23366 arch_pwr ardent ARM ARM32 atarist att386 att3b
23367 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
23368 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
23369 byteorder byte_order
23370 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
23371 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
23372 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
23373 ELF encore EPI EXTENSIONS
23374 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
23375 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
23376 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
23377 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
23378 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400 hp9000s500
23379 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
23380 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
23381 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
23382 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
23383 ksr1
23384 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
23385 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
23386 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
23387 luna88k Lynx
23388 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
23389 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
23390 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
23391 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
23392 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
23393 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
23394 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
23395 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
23396 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
23397 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
23398 ns32000 ns32016 ns32332 ns32k nsc32000
23399 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23400 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23401 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23402 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23403 QK_USER QNX
23404 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23405 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23406 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23407 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23408 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23409 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23410 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23411 SYSV4 SYSV5 sysV68 sysV88
23412 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23413 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23414 tower32_800 tower32_850 tss
23415 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23416 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23417 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23418 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23419 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23420 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23421 uxpm uxps
23422 vax venix VMESA vms
23423 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23424 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23425 z8000 zarch
23426 EOSH
23427 # Maybe put other stuff here too.
23428 ./tr '-' '_' <<EOSH >>Cppsym.know
23429 $osname
23430 EOSH
23431 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23432 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23433 $cat Cppsym.know > Cppsym.c
23434 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23435 $rm -f Cppsym.a Cppsym.b Cppsym.c
23436 cat <<EOSH > Cppsym
23437 $startsh
23438 if $test \$# -gt 0; then
23439     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23440     if $test -s Cppsym.got; then
23441         $rm -f Cppsym.got
23442         exit 0
23443     fi
23444     $rm -f Cppsym.got
23445     exit 1
23446 else
23447     $tr " " "$trnl" | ./Cppsym.try
23448     exit 0
23449 fi
23450 EOSH
23451 chmod +x Cppsym
23452 $eunicefix Cppsym
23453 cat <<EOSH > Cppsym.try
23454 $startsh
23455 cat <<'EOCP' > try.c
23456 #include <stdio.h>
23457 #if cpp_stuff == 1
23458 #define STRINGIFY(a)    "a"
23459 #endif
23460 #if cpp_stuff == 42
23461 #define StGiFy(a)  #a
23462 #define STRINGIFY(a)    StGiFy(a)
23463 #endif
23464 #if $cpp_stuff != 1 && $cpp_stuff != 42
23465 #   include "Bletch: How does this C preprocessor stringify macros?"
23466 #endif
23467 int main() {
23468 EOCP
23469 $awk \\
23470 EOSH
23471 cat <<'EOSH' >> Cppsym.try
23472 'length($1) > 0 {
23473     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23474     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23475     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23476     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23477 }'       >> try.c
23478 echo 'return 0;}' >> try.c
23479 EOSH
23480 cat <<EOSH >> Cppsym.try
23481 ccflags="$ccflags"
23482 case "$osname-$gccversion" in
23483 irix-) ccflags="\$ccflags -woff 1178" ;;
23484 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
23485 esac
23486 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
23487 EOSH
23488 chmod +x Cppsym.try
23489 $eunicefix Cppsym.try
23490 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
23491 : Add in any Linux cpp "predefined macros":
23492 case "$osname::$gccversion" in
23493   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
23494     tHdrH=_tmpHdr
23495     rm -f $tHdrH'.h' $tHdrH
23496     touch $tHdrH'.h'
23497     # Filter out macro arguments, such as Linux's __INT8_C(c)
23498     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
23499        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
23500        if [ -s $tHdrH'_cppsym.real' ]; then
23501           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
23502        fi
23503     fi
23504     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
23505   ;;
23506 esac
23507 : now check the C compiler for additional symbols
23508 postprocess_cc_v=''
23509 case "$osname" in
23510 aix) postprocess_cc_v="|$tr , ' '" ;;
23511 esac
23512 $cat >ccsym <<EOS
23513 $startsh
23514 $cat >tmp.c <<EOF
23515 extern int foo;
23516 EOF
23517 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
23518 do
23519         case "\$i" in
23520         -D*) echo "\$i" | $sed 's/^-D//';;
23521         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
23522         esac
23523 done
23524 $rm_try
23525 EOS
23526 postprocess_cc_v=''
23527 chmod +x ccsym
23528 $eunicefix ccsym
23529 ./ccsym > ccsym1.raw
23530 if $test -s ccsym1.raw; then
23531     $sort ccsym1.raw | $uniq >ccsym.raw
23532 else
23533     mv ccsym1.raw ccsym.raw
23534 fi
23535
23536 $awk '/\=/ { print $0; next }
23537         { print $0"=1" }' ccsym.raw >ccsym.list
23538 $comm -13 Cppsym.true ccsym.list >ccsym.own
23539 $comm -12 Cppsym.true ccsym.list >ccsym.com
23540 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
23541 also=''
23542 if $test -z ccsym.raw; then
23543         echo "Your C compiler doesn't seem to define any symbols!" >&4
23544         echo " "
23545         echo "However, your C preprocessor defines the following symbols:"
23546         $cat Cppsym.true
23547         ccsymbols=''
23548         cppsymbols=`$cat Cppsym.true`
23549         cppsymbols=`echo $cppsymbols`
23550         cppccsymbols="$cppsymbols"
23551 else
23552         if $test -s ccsym.com; then
23553                 echo "Your C compiler and pre-processor define these symbols:"
23554                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
23555                 also='also '
23556                 symbols='ones'
23557                 cppccsymbols=`$cat ccsym.com`
23558                 cppccsymbols=`echo $cppccsymbols`
23559                 $test "$silent" || sleep 1
23560         fi
23561         if $test -s ccsym.cpp; then
23562                 $test "$also" && echo " "
23563                 echo "Your C pre-processor ${also}defines the following symbols:"
23564                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
23565                 also='further '
23566                 cppsymbols=`$cat ccsym.cpp`
23567                 cppsymbols=`echo $cppsymbols`
23568                 $test "$silent" || sleep 1
23569         fi
23570         if $test -s ccsym.own; then
23571                 $test "$also" && echo " "
23572                 echo "Your C compiler ${also}defines the following cpp symbols:"
23573                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
23574                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
23575                 ccsymbols=`$cat ccsym.own`
23576                 ccsymbols=`echo $ccsymbols`
23577                 $test "$silent" || sleep 1
23578         fi
23579 fi
23580
23581 : add -D_FORTIFY_SOURCE if feasible and not already there
23582 case "$gccversion" in
23583 [45].*) case "$optimize$ccflags" in
23584         *-O*)   case "$ccflags$cppsymbols" in
23585                 *_FORTIFY_SOURCE=*) # Don't add it again.
23586                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
23587                         ;;
23588                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
23589                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
23590                         ;;
23591                 esac
23592                 ;;
23593         *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
23594                 ;;
23595         esac
23596         ;;
23597 *)      echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
23598         ;;
23599 esac
23600
23601 : see if this is a termio system
23602 val="$undef"
23603 val2="$undef"
23604 val3="$undef"
23605 if $test `./findhdr termios.h`; then
23606     set tcsetattr i_termios
23607     eval $inlibc
23608     val3="$i_termios"
23609 fi
23610 echo " "
23611 case "$val3" in
23612     "$define") echo "You have POSIX termios.h... good!" >&4;;
23613     *)  if ./Cppsym pyr; then
23614             case "`$run /bin/universe`" in
23615                 ucb) if $test `./findhdr sgtty.h`; then
23616                         val2="$define"
23617                         echo "<sgtty.h> found." >&4
23618                     else
23619                         echo "System is pyramid with BSD universe."
23620                         ./warn "<sgtty.h> not found--you could have problems."
23621                     fi;;
23622                 *)  if $test `./findhdr termio.h`; then
23623                         val="$define"
23624                         echo "<termio.h> found." >&4
23625                     else
23626                         echo "System is pyramid with USG universe."
23627                         ./warn "<termio.h> not found--you could have problems."
23628                     fi;;
23629             esac
23630         elif ./usg; then
23631             if $test `./findhdr termio.h`; then
23632                 echo "<termio.h> found." >&4
23633                 val="$define"
23634             elif $test `./findhdr sgtty.h`; then
23635                 echo "<sgtty.h> found." >&4
23636                 val2="$define"
23637             else
23638                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23639             fi
23640         else
23641             if $test `./findhdr sgtty.h`; then
23642                 echo "<sgtty.h> found." >&4
23643                 val2="$define"
23644             elif $test `./findhdr termio.h`; then
23645                 echo "<termio.h> found." >&4
23646                 val="$define"
23647             else
23648                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23649             fi
23650         fi;;
23651 esac
23652 set i_termio; eval $setvar
23653 val=$val2; set i_sgtty; eval $setvar
23654 val=$val3; set i_termios; eval $setvar
23655
23656 : see if stdbool is available
23657 : we want a real compile instead of Inhdr because some Solaris systems
23658 : have stdbool.h, but it can only be used if the compiler indicates it
23659 : is sufficiently c99-compliant.
23660 echo " "
23661 $cat >try.c <<EOCP
23662 #include <stdio.h>
23663 #include <stdbool.h>
23664 int func(bool x)
23665 {
23666     return x ? 1 : 0;
23667 }
23668 int main(int argc, char **argv)
23669 {
23670     return func(0);
23671 }
23672 EOCP
23673 set try
23674 if eval $compile; then
23675         echo "<stdbool.h> found." >&4
23676         val="$define"
23677 else
23678         echo "<stdbool.h> NOT found." >&4
23679         val="$undef"
23680 fi
23681 $rm_try
23682 set i_stdbool
23683 eval $setvar
23684
23685 : see if stddef is available
23686 set stddef.h i_stddef
23687 eval $inhdr
23688
23689 : see if stdint is available
23690 set stdint.h i_stdint
23691 eval $inhdr
23692
23693 : see if sys/access.h is available
23694 set sys/access.h i_sysaccess
23695 eval $inhdr
23696
23697 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23698 set sys/filio.h i_sysfilio
23699 eval $inhdr
23700 echo " "
23701 if $test `./findhdr sys/ioctl.h`; then
23702         val="$define"
23703         echo '<sys/ioctl.h> found.' >&4
23704 else
23705         val="$undef"
23706         if $test $i_sysfilio = "$define"; then
23707             echo '<sys/ioctl.h> NOT found.' >&4
23708         else
23709                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23710                 $test $i_termio = "$define" && xxx="termio.h"
23711                 $test $i_termios = "$define" && xxx="termios.h"
23712 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23713         fi
23714 fi
23715 set i_sysioctl
23716 eval $setvar
23717
23718 : see if socket ioctl defs are in sys/sockio.h
23719 echo " "
23720 xxx=`./findhdr sys/sockio.h`
23721 if $test "$xxx"; then
23722         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23723                 val="$define"
23724                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23725         else
23726                 val="$undef"
23727                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23728         fi
23729 else
23730         val="$undef"
23731         $cat <<EOM
23732 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23733 EOM
23734 fi
23735 set i_syssockio
23736 eval $setvar
23737
23738 : see if this is a syslog.h system
23739 set syslog.h i_syslog
23740 eval $inhdr
23741
23742 : see if this is a sys/mode.h system
23743 set sys/mode.h i_sysmode
23744 eval $inhdr
23745
23746 : see if there is a sys/poll.h file
23747 set sys/poll.h i_syspoll
23748 eval $inhdr
23749
23750 : see if sys/resource.h has to be included
23751 set sys/resource.h i_sysresrc
23752 eval $inhdr
23753
23754 : see if sys/security.h is available
23755 set sys/security.h i_syssecrt
23756 eval $inhdr
23757
23758 : see if this is a sys/statvfs.h system
23759 set sys/statvfs.h i_sysstatvfs
23760 eval $inhdr
23761
23762 : see if this is a sys/un.h system
23763 set sys/un.h i_sysun
23764 eval $inhdr
23765
23766 : see if this is a sys/utsname.h system
23767 set sys/utsname.h i_sysutsname
23768 eval $inhdr
23769
23770 : see if this is a syswait system
23771 set sys/wait.h i_syswait
23772 eval $inhdr
23773
23774 : see if this is a ustat.h system
23775 set ustat.h i_ustat
23776 eval $inhdr
23777
23778 : see if this is an utime system
23779 set utime.h i_utime
23780 eval $inhdr
23781
23782 : see if this is a vfork system
23783 case "$d_vfork" in
23784 "$define")
23785         set vfork.h i_vfork
23786         eval $inhdr
23787         ;;
23788 *)
23789         i_vfork="$undef"
23790         ;;
23791 esac
23792
23793 : Check extensions
23794 echo " "
23795 echo "Looking for extensions..." >&4
23796 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23797 : contain old or inaccurate or duplicate values.
23798 nonxs_extensions=''
23799 xs_extensions=''
23800 : We do not use find because it might not be available.
23801 : We do not just use MANIFEST because the user may have dropped
23802 : some additional extensions into the source tree and expect them
23803 : to be built.
23804
23805 : Function to recursively find available extensions, ignoring DynaLoader
23806 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23807 : In 5.10.1 and later, extensions are stored in directories
23808 : like File-Glob instead of the older File/Glob/.
23809 find_extensions='
23810     for xxx in *; do
23811         case "$xxx" in
23812             DynaLoader|dynaload) ;;
23813             *)
23814             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23815             case "$this_ext" in
23816                 Scalar/List/Utils) this_ext="List/Util" ;;
23817                 PathTools)         this_ext="Cwd"       ;;
23818             esac;
23819             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23820             if $contains " $this_ext " "$tdir/$$.tmp"; then
23821                 echo >&4;
23822                 echo "Duplicate directories detected for extension $xxx" >&4;
23823                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23824                 case "$knowitall" in
23825                 "") dflt=y;;
23826                 *) dflt=n;;
23827                 esac;
23828                 . ../UU/myread;
23829                 case "$ans" in
23830                 n*|N*) ;;
23831                 *) echo >&4;
23832                     echo "Ok.  Stopping Configure." >&4;
23833                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23834                     exit 1;;
23835                 esac;
23836                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23837             fi;
23838             $ls -1 "$xxx" > "$tdir/$$.tmp";
23839             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23840                 xs_extensions="$xs_extensions $this_ext";
23841             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
23842                 xs_extensions="$xs_extensions $this_ext";
23843             elif $test -d "$xxx"; then
23844                 nonxs_extensions="$nonxs_extensions $this_ext";
23845             fi;
23846             $rm -f "$tdir/$$.tmp";
23847             ;;
23848         esac;
23849     done'
23850 tdir=`pwd`
23851 cd "$rsrc/cpan"
23852 set X
23853 shift
23854 eval $find_extensions
23855 cd "$rsrc/dist"
23856 set X
23857 shift
23858 eval $find_extensions
23859 cd "$rsrc/ext"
23860 set X
23861 shift
23862 eval $find_extensions
23863 set X $xs_extensions
23864 shift
23865 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23866 set X $nonxs_extensions
23867 shift
23868 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23869 cd "$tdir"
23870 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23871
23872 : Now see which are supported on this system.
23873 avail_ext=''
23874 for xxx in $xs_extensions ; do
23875         case "$xxx" in
23876         Amiga*)
23877                 case "$osname" in
23878                 amigaos) avail_ext="$avail_ext $xxx" ;;
23879                 esac
23880                 ;;
23881         DB_File|db_file)
23882                 case "$i_db" in
23883                 $define) avail_ext="$avail_ext $xxx" ;;
23884                 esac
23885                 ;;
23886         GDBM_File|gdbm_fil)
23887                 case "$i_gdbm" in
23888                 $define) avail_ext="$avail_ext $xxx" ;;
23889                 esac
23890                 ;;
23891         I18N/Langinfo|i18n_lan)
23892                 case "$i_langinfo$d_nl_langinfo" in
23893                 $define$define) avail_ext="$avail_ext $xxx" ;;
23894                 esac
23895                 ;;
23896         IPC/SysV|ipc/sysv)
23897                 : XXX Do we need a useipcsysv variable here
23898                 case "${d_msg}${d_sem}${d_shm}" in
23899                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23900                 esac
23901                 ;;
23902         NDBM_File|ndbm_fil)
23903                 case "$d_ndbm" in
23904                 $define)
23905                     case "$osname-$use64bitint" in
23906                     hpux-define)
23907                         case "$libs" in
23908                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23909                         esac
23910                         ;;
23911                     *) avail_ext="$avail_ext $xxx" ;;
23912                     esac
23913                     ;;
23914                 esac
23915                 ;;
23916         ODBM_File|odbm_fil)
23917                 case "${i_dbm}${i_rpcsvcdbm}" in
23918                 *"${define}"*)
23919                     case "$d_cplusplus" in
23920                     define) ;; # delete as a function name will not work
23921                     *)  case "$osname-$use64bitint" in
23922                         hpux-define)
23923                             case "$libs" in
23924                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23925                             esac
23926                             ;;
23927                         *) avail_ext="$avail_ext $xxx" ;;
23928                         esac
23929                         ;;
23930                     esac
23931                     ;;
23932                 esac
23933                 ;;
23934         Opcode|opcode)
23935                 case "$useopcode" in
23936                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23937                 esac
23938                 ;;
23939         POSIX|posix)
23940                 case "$useposix" in
23941                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23942                 esac
23943                 ;;
23944         Socket|socket)
23945                 case "$d_socket" in
23946                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23947                 esac
23948                 ;;
23949         Sys/Syslog|sys/syslog)
23950                 case $osname in
23951                         amigaos) ;; # not really very useful on AmigaOS
23952                         *)
23953                         : XXX syslog requires socket
23954                         case "$d_socket" in
23955                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
23956                         esac
23957                         ;;
23958                 esac
23959                 ;;
23960         Thread|thread)
23961                 case "$usethreads" in
23962                 true|$define|y)
23963                         case "$use5005threads" in
23964                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23965                         esac
23966                 esac
23967                 ;;
23968         threads|threads/shared)
23969                 # threads and threads::shared are special cases.
23970                 # To stop people from asking "Perl 5.8.0 was supposed
23971                 # to have this new fancy threads implementation but my
23972                 # perl doesn't have it" and from people trying to
23973                 # (re)install the threads module using CPAN.pm and
23974                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23975                 # the threads.pm and threads/shared.pm will always be
23976                 # there, croaking informatively ("you need to rebuild
23977                 # all of Perl with threads, sorry") when threads haven't
23978                 # been compiled in.
23979                 # --jhi
23980                 avail_ext="$avail_ext $xxx"
23981                 ;;
23982         VMS*)
23983                 ;;
23984         Win32*)
23985                 case "$osname" in
23986                 cygwin) avail_ext="$avail_ext $xxx" ;;
23987                 esac
23988                 ;;
23989         XS/APItest|xs/apitest)
23990                 # This is just for testing.  Skip it unless we have dynamic loading.
23991
23992                 case "$usedl" in
23993                 $define) avail_ext="$avail_ext $xxx" ;;
23994                 esac
23995                 ;;
23996         XS/Typemap|xs/typemap)
23997                 # This is just for testing.  Skip it unless we have dynamic loading.
23998                 case "$usedl" in
23999                 $define) avail_ext="$avail_ext $xxx" ;;
24000                 esac
24001                 ;;
24002         *)      avail_ext="$avail_ext $xxx"
24003                 ;;
24004         esac
24005 done
24006
24007 set X $avail_ext
24008 shift
24009 avail_ext="$*"
24010
24011 case "$onlyextensions" in
24012 '') ;;
24013 *)  keepextensions=''
24014     echo "You have requested that only certain extensions be included..." >&4
24015     for i in $onlyextensions; do
24016         case " $avail_ext " in
24017         *" $i "*)
24018             echo "Keeping extension $i."
24019             keepextensions="$keepextensions $i"
24020             ;;
24021         *) echo "Ignoring extension $i." ;;
24022         esac
24023     done
24024     avail_ext="$keepextensions"
24025     ;;
24026 esac
24027
24028 case "$noextensions" in
24029 '') ;;
24030 *)  keepextensions=''
24031     echo "You have requested that certain extensions be ignored..." >&4
24032     for i in $avail_ext; do
24033         case " $noextensions " in
24034         *" $i "*) echo "Ignoring extension $i." ;;
24035         *) echo "Keeping extension $i.";
24036            keepextensions="$keepextensions $i"
24037            ;;
24038         esac
24039     done
24040     avail_ext="$keepextensions"
24041     ;;
24042 esac
24043
24044 : Now see which nonxs extensions are supported on this system.
24045 : For now assume all are.
24046 nonxs_ext=''
24047 for xxx in $nonxs_extensions ; do
24048         case "$xxx" in
24049         VMS*)
24050                 ;;
24051         *)      nonxs_ext="$nonxs_ext $xxx"
24052                 ;;
24053         esac
24054 done
24055
24056 set X $nonxs_ext
24057 shift
24058 nonxs_ext="$*"
24059
24060 case $usedl in
24061 $define)
24062         $cat <<EOM
24063 A number of extensions are supplied with $package.  You may choose to
24064 compile these extensions for dynamic loading (the default), compile
24065 them into the $package executable (static loading), or not include
24066 them at all.  Answer "none" to include no extensions.
24067 Note that DynaLoader is always built and need not be mentioned here.
24068
24069 EOM
24070         case "$dynamic_ext" in
24071         '')
24072                 : Exclude those listed in static_ext
24073                 dflt=''
24074                 for xxx in $avail_ext; do
24075                         case " $static_ext " in
24076                         *" $xxx "*) ;;
24077                         *) dflt="$dflt $xxx" ;;
24078                         esac
24079                 done
24080                 set X $dflt
24081                 shift
24082                 dflt="$*"
24083                 ;;
24084         *)      dflt="$dynamic_ext"
24085                 # Perhaps we are reusing an old out-of-date config.sh.
24086                 case "$hint" in
24087                 previous)
24088                         if test X"$dynamic_ext" != X"$avail_ext"; then
24089                                 $cat <<EOM
24090 NOTICE:  Your previous config.sh list may be incorrect.
24091 The extensions now available to you are
24092         ${avail_ext}
24093 but the default list from your previous config.sh is
24094         ${dynamic_ext}
24095
24096 EOM
24097                         fi
24098                         ;;
24099                 esac
24100                 ;;
24101         esac
24102         case "$dflt" in
24103         '')     dflt=none;;
24104         esac
24105         rp="What extensions do you wish to load dynamically?"
24106         . ./myread
24107         case "$ans" in
24108         none) dynamic_ext=' ' ;;
24109         *) dynamic_ext="$ans" ;;
24110         esac
24111
24112         case "$static_ext" in
24113         '')
24114                 : Exclude those already listed in dynamic linking
24115                 dflt=''
24116                 for xxx in $avail_ext; do
24117                         case " $dynamic_ext " in
24118                         *" $xxx "*) ;;
24119                         *) dflt="$dflt $xxx" ;;
24120                         esac
24121                 done
24122                 set X $dflt
24123                 shift
24124                 dflt="$*"
24125                 ;;
24126         *)  dflt="$static_ext"
24127                 ;;
24128         esac
24129
24130         case "$dflt" in
24131         '')     dflt=none;;
24132         esac
24133         rp="What extensions do you wish to load statically?"
24134         . ./myread
24135         case "$ans" in
24136         none) static_ext=' ' ;;
24137         *) static_ext="$ans" ;;
24138         esac
24139         ;;
24140 *)
24141         $cat <<EOM
24142 A number of extensions are supplied with $package.  Answer "none"
24143 to include no extensions.
24144 Note that DynaLoader is always built and need not be mentioned here.
24145
24146 EOM
24147         case "$static_ext" in
24148         '') dflt="$avail_ext" ;;
24149         *)      dflt="$static_ext"
24150                 # Perhaps we are reusing an old out-of-date config.sh.
24151                 case "$hint" in
24152                 previous)
24153                         if test X"$static_ext" != X"$avail_ext"; then
24154                                 $cat <<EOM
24155 NOTICE:  Your previous config.sh list may be incorrect.
24156 The extensions now available to you are
24157         ${avail_ext}
24158 but the default list from your previous config.sh is
24159         ${static_ext}
24160
24161 EOM
24162                         fi
24163                         ;;
24164                 esac
24165                 ;;
24166         esac
24167         : Exclude those that are not xs extensions
24168         case "$dflt" in
24169         '')     dflt=none;;
24170         esac
24171         rp="What extensions do you wish to include?"
24172         . ./myread
24173         case "$ans" in
24174         none) static_ext=' ' ;;
24175         *) static_ext="$ans" ;;
24176         esac
24177         ;;
24178 esac
24179 #
24180 # Encode is a special case.  If we are building Encode as a static
24181 # extension, we need to explicitly list its subextensions as well.
24182 # For other nested extensions, this is handled automatically by
24183 # the appropriate Makefile.PL.
24184 case " $static_ext " in
24185         *" Encode "*) # Add the subextensions of Encode
24186         cd "$rsrc/cpan"
24187         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
24188                 static_ext="$static_ext Encode/$xxx"
24189                 known_extensions="$known_extensions Encode/$xxx"
24190         done
24191         cd "$tdir"
24192         ;;
24193 esac
24194
24195 set X $dynamic_ext $static_ext $nonxs_ext
24196 shift
24197 extensions="$*"
24198
24199 # Sanity check:  We require an extension suitable for use with
24200 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
24201 # should show up as failures in the test suite, but it's helpful to
24202 # catch them now.) The 'extensions' list is normally sorted
24203 # alphabetically, so we need to accept either
24204 #    DB_File ... Fcntl ... IO  ....
24205 # or something like
24206 #    Fcntl ... NDBM_File ... IO  ....
24207 case " $extensions"  in
24208 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
24209 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
24210 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
24211 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
24212    echo "WARNING: The Perl you are building will be quite crippled." >& 4
24213    ;;
24214 esac
24215
24216 : Remove libraries needed only for extensions
24217 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
24218 : The exception is SunOS 4.x, which needs them.
24219 case "${osname}X${osvers}" in
24220 sunos*X4*)
24221     perllibs="$libs"
24222     ;;
24223 *) case "$usedl" in
24224     $define|true|[yY]*)
24225             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
24226             shift
24227             perllibs="$*"
24228             ;;
24229     *)  perllibs="$libs"
24230             ;;
24231     esac
24232     ;;
24233 esac
24234
24235 : Remove build directory name from cppstdin so it can be used from
24236 : either the present location or the final installed location.
24237 echo " "
24238 : Get out of the UU directory to get correct path name.
24239 cd ..
24240 case "$cppstdin" in
24241 `pwd`/cppstdin)
24242         echo "Stripping down cppstdin path name"
24243         cppstdin=cppstdin
24244         ;;
24245 esac
24246 cd UU
24247
24248 : end of configuration questions
24249 echo " "
24250 echo "End of configuration questions."
24251 echo " "
24252
24253 : back to where it started
24254 if test -d ../UU; then
24255         cd ..
24256 fi
24257
24258 : configuration may be unconditionally patched via a 'config.arch' file
24259 if $test -f config.arch; then
24260         echo "I see a config.arch file, loading it." >&4
24261         . ./config.arch
24262 fi
24263
24264 : configuration may be patched via a 'config.over' file
24265 if $test -f config.over; then
24266         echo " "
24267         dflt=y
24268         rp='I see a config.over file.  Do you wish to load it?'
24269         . UU/myread
24270         case "$ans" in
24271         n*) echo "OK, I'll ignore it.";;
24272         *)      . ./config.over
24273                 echo "Configuration override changes have been loaded."
24274                 ;;
24275         esac
24276 fi
24277
24278 : in case they want portability, strip down executable paths
24279 case "$d_portable" in
24280 "$define")
24281         echo " "
24282         echo "Stripping down executable paths..." >&4
24283         for file in $loclist $trylist; do
24284                 eval temp=\$$file
24285                 eval $file=`basename $temp`
24286         done
24287         ;;
24288 esac
24289
24290 : create config.sh file
24291 echo " "
24292 echo "Creating config.sh..." >&4
24293 $spitshell <<EOT >config.sh
24294 $startsh
24295 #
24296 # This file was produced by running the Configure script. It holds all the
24297 # definitions figured out by Configure. Should you modify one of these values,
24298 # do not forget to propagate your changes by running "Configure -der". You may
24299 # instead choose to run each of the .SH files by yourself, or "Configure -S".
24300 #
24301
24302 # Package name      : $package
24303 # Source directory  : $src
24304 # Configuration time: $cf_time
24305 # Configured by     : $cf_by
24306 # Target system     : $myuname
24307
24308 EOT
24309 : Add in command line options if available
24310 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
24311
24312 $spitshell <<EOT >>config.sh
24313
24314 Author='$Author'
24315 Date='$Date'
24316 Header='$Header'
24317 Id='$Id'
24318 Locker='$Locker'
24319 Log='$Log'
24320 RCSfile='$RCSfile'
24321 Revision='$Revision'
24322 Source='$Source'
24323 State='$State'
24324 _a='$_a'
24325 _exe='$_exe'
24326 _o='$_o'
24327 afs='$afs'
24328 afsroot='$afsroot'
24329 alignbytes='$alignbytes'
24330 ansi2knr='$ansi2knr'
24331 aphostname='$aphostname'
24332 api_revision='$api_revision'
24333 api_subversion='$api_subversion'
24334 api_version='$api_version'
24335 api_versionstring='$api_versionstring'
24336 ar='$ar'
24337 archlib='$archlib'
24338 archlibexp='$archlibexp'
24339 archname64='$archname64'
24340 archname='$archname'
24341 archobjs='$archobjs'
24342 asctime_r_proto='$asctime_r_proto'
24343 awk='$awk'
24344 baserev='$baserev'
24345 bash='$bash'
24346 bin='$bin'
24347 bin_ELF='$bin_ELF'
24348 binexp='$binexp'
24349 bison='$bison'
24350 byacc='$byacc'
24351 byteorder='$byteorder'
24352 c='$c'
24353 castflags='$castflags'
24354 cat='$cat'
24355 cc='$cc'
24356 cccdlflags='$cccdlflags'
24357 ccdlflags='$ccdlflags'
24358 ccflags='$ccflags'
24359 ccflags_uselargefiles='$ccflags_uselargefiles'
24360 ccname='$ccname'
24361 ccsymbols='$ccsymbols'
24362 ccversion='$ccversion'
24363 cf_by='$cf_by'
24364 cf_email='$cf_email'
24365 cf_time='$cf_time'
24366 charbits='$charbits'
24367 charsize='$charsize'
24368 chgrp='$chgrp'
24369 chmod='$chmod'
24370 chown='$chown'
24371 clocktype='$clocktype'
24372 comm='$comm'
24373 compress='$compress'
24374 contains='$contains'
24375 cp='$cp'
24376 cpio='$cpio'
24377 cpp='$cpp'
24378 cpp_stuff='$cpp_stuff'
24379 cppccsymbols='$cppccsymbols'
24380 cppflags='$cppflags'
24381 cpplast='$cpplast'
24382 cppminus='$cppminus'
24383 cpprun='$cpprun'
24384 cppstdin='$cppstdin'
24385 cppsymbols='$cppsymbols'
24386 crypt_r_proto='$crypt_r_proto'
24387 cryptlib='$cryptlib'
24388 csh='$csh'
24389 ctermid_r_proto='$ctermid_r_proto'
24390 ctime_r_proto='$ctime_r_proto'
24391 d_Gconvert='$d_Gconvert'
24392 d_PRIEUldbl='$d_PRIEUldbl'
24393 d_PRIFUldbl='$d_PRIFUldbl'
24394 d_PRIGUldbl='$d_PRIGUldbl'
24395 d_PRIXU64='$d_PRIXU64'
24396 d_PRId64='$d_PRId64'
24397 d_PRIeldbl='$d_PRIeldbl'
24398 d_PRIfldbl='$d_PRIfldbl'
24399 d_PRIgldbl='$d_PRIgldbl'
24400 d_PRIi64='$d_PRIi64'
24401 d_PRIo64='$d_PRIo64'
24402 d_PRIu64='$d_PRIu64'
24403 d_PRIx64='$d_PRIx64'
24404 d_SCNfldbl='$d_SCNfldbl'
24405 d__fwalk='$d__fwalk'
24406 d_access='$d_access'
24407 d_accessx='$d_accessx'
24408 d_acosh='$d_acosh'
24409 d_aintl='$d_aintl'
24410 d_alarm='$d_alarm'
24411 d_archlib='$d_archlib'
24412 d_asctime64='$d_asctime64'
24413 d_asctime_r='$d_asctime_r'
24414 d_asinh='$d_asinh'
24415 d_atanh='$d_atanh'
24416 d_atolf='$d_atolf'
24417 d_atoll='$d_atoll'
24418 d_attribute_deprecated='$d_attribute_deprecated'
24419 d_attribute_format='$d_attribute_format'
24420 d_attribute_malloc='$d_attribute_malloc'
24421 d_attribute_nonnull='$d_attribute_nonnull'
24422 d_attribute_noreturn='$d_attribute_noreturn'
24423 d_attribute_pure='$d_attribute_pure'
24424 d_attribute_unused='$d_attribute_unused'
24425 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24426 d_backtrace='$d_backtrace'
24427 d_bcmp='$d_bcmp'
24428 d_bcopy='$d_bcopy'
24429 d_bsd='$d_bsd'
24430 d_bsdgetpgrp='$d_bsdgetpgrp'
24431 d_bsdsetpgrp='$d_bsdsetpgrp'
24432 d_builtin_choose_expr='$d_builtin_choose_expr'
24433 d_builtin_expect='$d_builtin_expect'
24434 d_bzero='$d_bzero'
24435 d_c99_variadic_macros='$d_c99_variadic_macros'
24436 d_casti32='$d_casti32'
24437 d_castneg='$d_castneg'
24438 d_cbrt='$d_cbrt'
24439 d_charvspr='$d_charvspr'
24440 d_chown='$d_chown'
24441 d_chroot='$d_chroot'
24442 d_chsize='$d_chsize'
24443 d_class='$d_class'
24444 d_clearenv='$d_clearenv'
24445 d_closedir='$d_closedir'
24446 d_cmsghdr_s='$d_cmsghdr_s'
24447 d_const='$d_const'
24448 d_copysign='$d_copysign'
24449 d_copysignl='$d_copysignl'
24450 d_cplusplus='$d_cplusplus'
24451 d_crypt='$d_crypt'
24452 d_crypt_r='$d_crypt_r'
24453 d_csh='$d_csh'
24454 d_ctermid='$d_ctermid'
24455 d_ctermid_r='$d_ctermid_r'
24456 d_ctime64='$d_ctime64'
24457 d_ctime_r='$d_ctime_r'
24458 d_cuserid='$d_cuserid'
24459 d_dbl_dig='$d_dbl_dig'
24460 d_dbminitproto='$d_dbminitproto'
24461 d_difftime64='$d_difftime64'
24462 d_difftime='$d_difftime'
24463 d_dir_dd_fd='$d_dir_dd_fd'
24464 d_dirfd='$d_dirfd'
24465 d_dirnamlen='$d_dirnamlen'
24466 d_dladdr='$d_dladdr'
24467 d_dlerror='$d_dlerror'
24468 d_dlopen='$d_dlopen'
24469 d_dlsymun='$d_dlsymun'
24470 d_dosuid='$d_dosuid'
24471 d_double_has_inf='$d_double_has_inf'
24472 d_double_has_nan='$d_double_has_nan'
24473 d_double_has_negative_zero='$d_double_has_negative_zero'
24474 d_double_has_subnormals='$d_double_has_subnormals'
24475 d_double_style_cray='$d_double_style_cray'
24476 d_double_style_ibm='$d_double_style_ibm'
24477 d_double_style_ieee='$d_double_style_ieee'
24478 d_double_style_vax='$d_double_style_vax'
24479 d_drand48_r='$d_drand48_r'
24480 d_drand48proto='$d_drand48proto'
24481 d_dup2='$d_dup2'
24482 d_duplocale='$d_duplocale'
24483 d_eaccess='$d_eaccess'
24484 d_endgrent='$d_endgrent'
24485 d_endgrent_r='$d_endgrent_r'
24486 d_endhent='$d_endhent'
24487 d_endhostent_r='$d_endhostent_r'
24488 d_endnent='$d_endnent'
24489 d_endnetent_r='$d_endnetent_r'
24490 d_endpent='$d_endpent'
24491 d_endprotoent_r='$d_endprotoent_r'
24492 d_endpwent='$d_endpwent'
24493 d_endpwent_r='$d_endpwent_r'
24494 d_endsent='$d_endsent'
24495 d_endservent_r='$d_endservent_r'
24496 d_eofnblk='$d_eofnblk'
24497 d_erf='$d_erf'
24498 d_erfc='$d_erfc'
24499 d_eunice='$d_eunice'
24500 d_exp2='$d_exp2'
24501 d_expm1='$d_expm1'
24502 d_faststdio='$d_faststdio'
24503 d_fchdir='$d_fchdir'
24504 d_fchmod='$d_fchmod'
24505 d_fchown='$d_fchown'
24506 d_fcntl='$d_fcntl'
24507 d_fcntl_can_lock='$d_fcntl_can_lock'
24508 d_fd_macros='$d_fd_macros'
24509 d_fd_set='$d_fd_set'
24510 d_fdclose='$d_fdclose'
24511 d_fdim='$d_fdim'
24512 d_fds_bits='$d_fds_bits'
24513 d_fegetround='$d_fegetround'
24514 d_fgetpos='$d_fgetpos'
24515 d_finite='$d_finite'
24516 d_finitel='$d_finitel'
24517 d_flexfnam='$d_flexfnam'
24518 d_flock='$d_flock'
24519 d_flockproto='$d_flockproto'
24520 d_fma='$d_fma'
24521 d_fmax='$d_fmax'
24522 d_fmin='$d_fmin'
24523 d_fork='$d_fork'
24524 d_fp_class='$d_fp_class'
24525 d_fp_classify='$d_fp_classify'
24526 d_fp_classl='$d_fp_classl'
24527 d_fpathconf='$d_fpathconf'
24528 d_fpclass='$d_fpclass'
24529 d_fpclassify='$d_fpclassify'
24530 d_fpclassl='$d_fpclassl'
24531 d_fpgetround='$d_fpgetround'
24532 d_fpos64_t='$d_fpos64_t'
24533 d_freelocale='$d_freelocale'
24534 d_frexpl='$d_frexpl'
24535 d_fs_data_s='$d_fs_data_s'
24536 d_fseeko='$d_fseeko'
24537 d_fsetpos='$d_fsetpos'
24538 d_fstatfs='$d_fstatfs'
24539 d_fstatvfs='$d_fstatvfs'
24540 d_fsync='$d_fsync'
24541 d_ftello='$d_ftello'
24542 d_ftime='$d_ftime'
24543 d_futimes='$d_futimes'
24544 d_gai_strerror='$d_gai_strerror'
24545 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
24546 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
24547 d_getaddrinfo='$d_getaddrinfo'
24548 d_getcwd='$d_getcwd'
24549 d_getespwnam='$d_getespwnam'
24550 d_getfsstat='$d_getfsstat'
24551 d_getgrent='$d_getgrent'
24552 d_getgrent_r='$d_getgrent_r'
24553 d_getgrgid_r='$d_getgrgid_r'
24554 d_getgrnam_r='$d_getgrnam_r'
24555 d_getgrps='$d_getgrps'
24556 d_gethbyaddr='$d_gethbyaddr'
24557 d_gethbyname='$d_gethbyname'
24558 d_gethent='$d_gethent'
24559 d_gethname='$d_gethname'
24560 d_gethostbyaddr_r='$d_gethostbyaddr_r'
24561 d_gethostbyname_r='$d_gethostbyname_r'
24562 d_gethostent_r='$d_gethostent_r'
24563 d_gethostprotos='$d_gethostprotos'
24564 d_getitimer='$d_getitimer'
24565 d_getlogin='$d_getlogin'
24566 d_getlogin_r='$d_getlogin_r'
24567 d_getmnt='$d_getmnt'
24568 d_getmntent='$d_getmntent'
24569 d_getnameinfo='$d_getnameinfo'
24570 d_getnbyaddr='$d_getnbyaddr'
24571 d_getnbyname='$d_getnbyname'
24572 d_getnent='$d_getnent'
24573 d_getnetbyaddr_r='$d_getnetbyaddr_r'
24574 d_getnetbyname_r='$d_getnetbyname_r'
24575 d_getnetent_r='$d_getnetent_r'
24576 d_getnetprotos='$d_getnetprotos'
24577 d_getpagsz='$d_getpagsz'
24578 d_getpbyname='$d_getpbyname'
24579 d_getpbynumber='$d_getpbynumber'
24580 d_getpent='$d_getpent'
24581 d_getpgid='$d_getpgid'
24582 d_getpgrp2='$d_getpgrp2'
24583 d_getpgrp='$d_getpgrp'
24584 d_getppid='$d_getppid'
24585 d_getprior='$d_getprior'
24586 d_getprotobyname_r='$d_getprotobyname_r'
24587 d_getprotobynumber_r='$d_getprotobynumber_r'
24588 d_getprotoent_r='$d_getprotoent_r'
24589 d_getprotoprotos='$d_getprotoprotos'
24590 d_getprpwnam='$d_getprpwnam'
24591 d_getpwent='$d_getpwent'
24592 d_getpwent_r='$d_getpwent_r'
24593 d_getpwnam_r='$d_getpwnam_r'
24594 d_getpwuid_r='$d_getpwuid_r'
24595 d_getsbyname='$d_getsbyname'
24596 d_getsbyport='$d_getsbyport'
24597 d_getsent='$d_getsent'
24598 d_getservbyname_r='$d_getservbyname_r'
24599 d_getservbyport_r='$d_getservbyport_r'
24600 d_getservent_r='$d_getservent_r'
24601 d_getservprotos='$d_getservprotos'
24602 d_getspnam='$d_getspnam'
24603 d_getspnam_r='$d_getspnam_r'
24604 d_gettimeod='$d_gettimeod'
24605 d_gmtime64='$d_gmtime64'
24606 d_gmtime_r='$d_gmtime_r'
24607 d_gnulibc='$d_gnulibc'
24608 d_grpasswd='$d_grpasswd'
24609 d_hasmntopt='$d_hasmntopt'
24610 d_htonl='$d_htonl'
24611 d_hypot='$d_hypot'
24612 d_ilogb='$d_ilogb'
24613 d_ilogbl='$d_ilogbl'
24614 d_inc_version_list='$d_inc_version_list'
24615 d_index='$d_index'
24616 d_inetaton='$d_inetaton'
24617 d_inetntop='$d_inetntop'
24618 d_inetpton='$d_inetpton'
24619 d_int64_t='$d_int64_t'
24620 d_ip_mreq='$d_ip_mreq'
24621 d_ip_mreq_source='$d_ip_mreq_source'
24622 d_ipv6_mreq='$d_ipv6_mreq'
24623 d_ipv6_mreq_source='$d_ipv6_mreq_source'
24624 d_isascii='$d_isascii'
24625 d_isblank='$d_isblank'
24626 d_isfinite='$d_isfinite'
24627 d_isfinitel='$d_isfinitel'
24628 d_isinf='$d_isinf'
24629 d_isinfl='$d_isinfl'
24630 d_isless='$d_isless'
24631 d_isnan='$d_isnan'
24632 d_isnanl='$d_isnanl'
24633 d_isnormal='$d_isnormal'
24634 d_j0='$d_j0'
24635 d_j0l='$d_j0l'
24636 d_killpg='$d_killpg'
24637 d_lc_monetary_2008='$d_lc_monetary_2008'
24638 d_lchown='$d_lchown'
24639 d_ldbl_dig='$d_ldbl_dig'
24640 d_ldexpl='$d_ldexpl'
24641 d_lgamma='$d_lgamma'
24642 d_lgamma_r='$d_lgamma_r'
24643 d_libm_lib_version='$d_libm_lib_version'
24644 d_libname_unique='$d_libname_unique'
24645 d_link='$d_link'
24646 d_llrint='$d_llrint'
24647 d_llrintl='$d_llrintl'
24648 d_llround='$d_llround'
24649 d_llroundl='$d_llroundl'
24650 d_localtime64='$d_localtime64'
24651 d_localtime_r='$d_localtime_r'
24652 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24653 d_locconv='$d_locconv'
24654 d_lockf='$d_lockf'
24655 d_log1p='$d_log1p'
24656 d_log2='$d_log2'
24657 d_logb='$d_logb'
24658 d_long_double_style_ieee='$d_long_double_style_ieee'
24659 d_long_double_style_ieee_doubledouble='$d_long_double_style_ieee_doubledouble'
24660 d_long_double_style_ieee_extended='$d_long_double_style_ieee_extended'
24661 d_long_double_style_ieee_std='$d_long_double_style_ieee_std'
24662 d_long_double_style_vax='$d_long_double_style_vax'
24663 d_longdbl='$d_longdbl'
24664 d_longlong='$d_longlong'
24665 d_lrint='$d_lrint'
24666 d_lrintl='$d_lrintl'
24667 d_lround='$d_lround'
24668 d_lroundl='$d_lroundl'
24669 d_lseekproto='$d_lseekproto'
24670 d_lstat='$d_lstat'
24671 d_madvise='$d_madvise'
24672 d_malloc_good_size='$d_malloc_good_size'
24673 d_malloc_size='$d_malloc_size'
24674 d_mblen='$d_mblen'
24675 d_mbstowcs='$d_mbstowcs'
24676 d_mbtowc='$d_mbtowc'
24677 d_memchr='$d_memchr'
24678 d_memcmp='$d_memcmp'
24679 d_memcpy='$d_memcpy'
24680 d_memmem='$d_memmem'
24681 d_memmove='$d_memmove'
24682 d_memset='$d_memset'
24683 d_mkdir='$d_mkdir'
24684 d_mkdtemp='$d_mkdtemp'
24685 d_mkfifo='$d_mkfifo'
24686 d_mkstemp='$d_mkstemp'
24687 d_mkstemps='$d_mkstemps'
24688 d_mktime64='$d_mktime64'
24689 d_mktime='$d_mktime'
24690 d_mmap='$d_mmap'
24691 d_modfl='$d_modfl'
24692 d_modflproto='$d_modflproto'
24693 d_mprotect='$d_mprotect'
24694 d_msg='$d_msg'
24695 d_msg_ctrunc='$d_msg_ctrunc'
24696 d_msg_dontroute='$d_msg_dontroute'
24697 d_msg_oob='$d_msg_oob'
24698 d_msg_peek='$d_msg_peek'
24699 d_msg_proxy='$d_msg_proxy'
24700 d_msgctl='$d_msgctl'
24701 d_msgget='$d_msgget'
24702 d_msghdr_s='$d_msghdr_s'
24703 d_msgrcv='$d_msgrcv'
24704 d_msgsnd='$d_msgsnd'
24705 d_msync='$d_msync'
24706 d_munmap='$d_munmap'
24707 d_mymalloc='$d_mymalloc'
24708 d_nan='$d_nan'
24709 d_ndbm='$d_ndbm'
24710 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24711 d_nearbyint='$d_nearbyint'
24712 d_newlocale='$d_newlocale'
24713 d_nextafter='$d_nextafter'
24714 d_nexttoward='$d_nexttoward'
24715 d_nice='$d_nice'
24716 d_nl_langinfo='$d_nl_langinfo'
24717 d_nv_preserves_uv='$d_nv_preserves_uv'
24718 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24719 d_off64_t='$d_off64_t'
24720 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24721 d_oldpthreads='$d_oldpthreads'
24722 d_oldsock='$d_oldsock'
24723 d_open3='$d_open3'
24724 d_pathconf='$d_pathconf'
24725 d_pause='$d_pause'
24726 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24727 d_phostname='$d_phostname'
24728 d_pipe='$d_pipe'
24729 d_poll='$d_poll'
24730 d_portable='$d_portable'
24731 d_prctl='$d_prctl'
24732 d_prctl_set_name='$d_prctl_set_name'
24733 d_printf_format_null='$d_printf_format_null'
24734 d_procselfexe='$d_procselfexe'
24735 d_pseudofork='$d_pseudofork'
24736 d_pthread_atfork='$d_pthread_atfork'
24737 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24738 d_pthread_yield='$d_pthread_yield'
24739 d_ptrdiff_t='$d_ptrdiff_t'
24740 d_pwage='$d_pwage'
24741 d_pwchange='$d_pwchange'
24742 d_pwclass='$d_pwclass'
24743 d_pwcomment='$d_pwcomment'
24744 d_pwexpire='$d_pwexpire'
24745 d_pwgecos='$d_pwgecos'
24746 d_pwpasswd='$d_pwpasswd'
24747 d_pwquota='$d_pwquota'
24748 d_qgcvt='$d_qgcvt'
24749 d_quad='$d_quad'
24750 d_querylocale='$d_querylocale'
24751 d_random_r='$d_random_r'
24752 d_re_comp='$d_re_comp'
24753 d_readdir64_r='$d_readdir64_r'
24754 d_readdir='$d_readdir'
24755 d_readdir_r='$d_readdir_r'
24756 d_readlink='$d_readlink'
24757 d_readv='$d_readv'
24758 d_recvmsg='$d_recvmsg'
24759 d_regcmp='$d_regcmp'
24760 d_regcomp='$d_regcomp'
24761 d_remainder='$d_remainder'
24762 d_remquo='$d_remquo'
24763 d_rename='$d_rename'
24764 d_rewinddir='$d_rewinddir'
24765 d_rint='$d_rint'
24766 d_rmdir='$d_rmdir'
24767 d_round='$d_round'
24768 d_safebcpy='$d_safebcpy'
24769 d_safemcpy='$d_safemcpy'
24770 d_sanemcmp='$d_sanemcmp'
24771 d_sbrkproto='$d_sbrkproto'
24772 d_scalbn='$d_scalbn'
24773 d_scalbnl='$d_scalbnl'
24774 d_sched_yield='$d_sched_yield'
24775 d_scm_rights='$d_scm_rights'
24776 d_seekdir='$d_seekdir'
24777 d_select='$d_select'
24778 d_sem='$d_sem'
24779 d_semctl='$d_semctl'
24780 d_semctl_semid_ds='$d_semctl_semid_ds'
24781 d_semctl_semun='$d_semctl_semun'
24782 d_semget='$d_semget'
24783 d_semop='$d_semop'
24784 d_sendmsg='$d_sendmsg'
24785 d_setegid='$d_setegid'
24786 d_seteuid='$d_seteuid'
24787 d_setgrent='$d_setgrent'
24788 d_setgrent_r='$d_setgrent_r'
24789 d_setgrps='$d_setgrps'
24790 d_sethent='$d_sethent'
24791 d_sethostent_r='$d_sethostent_r'
24792 d_setitimer='$d_setitimer'
24793 d_setlinebuf='$d_setlinebuf'
24794 d_setlocale='$d_setlocale'
24795 d_setlocale_r='$d_setlocale_r'
24796 d_setnent='$d_setnent'
24797 d_setnetent_r='$d_setnetent_r'
24798 d_setpent='$d_setpent'
24799 d_setpgid='$d_setpgid'
24800 d_setpgrp2='$d_setpgrp2'
24801 d_setpgrp='$d_setpgrp'
24802 d_setprior='$d_setprior'
24803 d_setproctitle='$d_setproctitle'
24804 d_setprotoent_r='$d_setprotoent_r'
24805 d_setpwent='$d_setpwent'
24806 d_setpwent_r='$d_setpwent_r'
24807 d_setregid='$d_setregid'
24808 d_setresgid='$d_setresgid'
24809 d_setresuid='$d_setresuid'
24810 d_setreuid='$d_setreuid'
24811 d_setrgid='$d_setrgid'
24812 d_setruid='$d_setruid'
24813 d_setsent='$d_setsent'
24814 d_setservent_r='$d_setservent_r'
24815 d_setsid='$d_setsid'
24816 d_setvbuf='$d_setvbuf'
24817 d_shm='$d_shm'
24818 d_shmat='$d_shmat'
24819 d_shmatprototype='$d_shmatprototype'
24820 d_shmctl='$d_shmctl'
24821 d_shmdt='$d_shmdt'
24822 d_shmget='$d_shmget'
24823 d_sigaction='$d_sigaction'
24824 d_siginfo_si_addr='$d_siginfo_si_addr'
24825 d_siginfo_si_band='$d_siginfo_si_band'
24826 d_siginfo_si_errno='$d_siginfo_si_errno'
24827 d_siginfo_si_fd='$d_siginfo_si_fd'
24828 d_siginfo_si_pid='$d_siginfo_si_pid'
24829 d_siginfo_si_status='$d_siginfo_si_status'
24830 d_siginfo_si_uid='$d_siginfo_si_uid'
24831 d_siginfo_si_value='$d_siginfo_si_value'
24832 d_signbit='$d_signbit'
24833 d_sigprocmask='$d_sigprocmask'
24834 d_sigsetjmp='$d_sigsetjmp'
24835 d_sin6_scope_id='$d_sin6_scope_id'
24836 d_sitearch='$d_sitearch'
24837 d_snprintf='$d_snprintf'
24838 d_sockaddr_in6='$d_sockaddr_in6'
24839 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24840 d_sockatmark='$d_sockatmark'
24841 d_sockatmarkproto='$d_sockatmarkproto'
24842 d_socket='$d_socket'
24843 d_socklen_t='$d_socklen_t'
24844 d_sockpair='$d_sockpair'
24845 d_socks5_init='$d_socks5_init'
24846 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
24847 d_sqrtl='$d_sqrtl'
24848 d_srand48_r='$d_srand48_r'
24849 d_srandom_r='$d_srandom_r'
24850 d_sresgproto='$d_sresgproto'
24851 d_sresuproto='$d_sresuproto'
24852 d_stat='$d_stat'
24853 d_statblks='$d_statblks'
24854 d_statfs_f_flags='$d_statfs_f_flags'
24855 d_statfs_s='$d_statfs_s'
24856 d_static_inline='$d_static_inline'
24857 d_statvfs='$d_statvfs'
24858 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24859 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24860 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24861 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24862 d_stdio_stream_array='$d_stdio_stream_array'
24863 d_stdiobase='$d_stdiobase'
24864 d_stdstdio='$d_stdstdio'
24865 d_strchr='$d_strchr'
24866 d_strcoll='$d_strcoll'
24867 d_strctcpy='$d_strctcpy'
24868 d_strerrm='$d_strerrm'
24869 d_strerror='$d_strerror'
24870 d_strerror_l='$d_strerror_l'
24871 d_strerror_r='$d_strerror_r'
24872 d_strftime='$d_strftime'
24873 d_strlcat='$d_strlcat'
24874 d_strlcpy='$d_strlcpy'
24875 d_strtod='$d_strtod'
24876 d_strtol='$d_strtol'
24877 d_strtold='$d_strtold'
24878 d_strtoll='$d_strtoll'
24879 d_strtoq='$d_strtoq'
24880 d_strtoul='$d_strtoul'
24881 d_strtoull='$d_strtoull'
24882 d_strtouq='$d_strtouq'
24883 d_strxfrm='$d_strxfrm'
24884 d_suidsafe='$d_suidsafe'
24885 d_symlink='$d_symlink'
24886 d_syscall='$d_syscall'
24887 d_syscallproto='$d_syscallproto'
24888 d_sysconf='$d_sysconf'
24889 d_sysernlst='$d_sysernlst'
24890 d_syserrlst='$d_syserrlst'
24891 d_system='$d_system'
24892 d_tcgetpgrp='$d_tcgetpgrp'
24893 d_tcsetpgrp='$d_tcsetpgrp'
24894 d_telldir='$d_telldir'
24895 d_telldirproto='$d_telldirproto'
24896 d_tgamma='$d_tgamma'
24897 d_time='$d_time'
24898 d_timegm='$d_timegm'
24899 d_times='$d_times'
24900 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24901 d_tm_tm_zone='$d_tm_tm_zone'
24902 d_tmpnam_r='$d_tmpnam_r'
24903 d_trunc='$d_trunc'
24904 d_truncate='$d_truncate'
24905 d_truncl='$d_truncl'
24906 d_ttyname_r='$d_ttyname_r'
24907 d_tzname='$d_tzname'
24908 d_u32align='$d_u32align'
24909 d_ualarm='$d_ualarm'
24910 d_umask='$d_umask'
24911 d_uname='$d_uname'
24912 d_union_semun='$d_union_semun'
24913 d_unordered='$d_unordered'
24914 d_unsetenv='$d_unsetenv'
24915 d_uselocale='$d_uselocale'
24916 d_usleep='$d_usleep'
24917 d_usleepproto='$d_usleepproto'
24918 d_ustat='$d_ustat'
24919 d_vendorarch='$d_vendorarch'
24920 d_vendorbin='$d_vendorbin'
24921 d_vendorlib='$d_vendorlib'
24922 d_vendorscript='$d_vendorscript'
24923 d_vfork='$d_vfork'
24924 d_void_closedir='$d_void_closedir'
24925 d_voidsig='$d_voidsig'
24926 d_voidtty='$d_voidtty'
24927 d_volatile='$d_volatile'
24928 d_vprintf='$d_vprintf'
24929 d_vsnprintf='$d_vsnprintf'
24930 d_wait4='$d_wait4'
24931 d_waitpid='$d_waitpid'
24932 d_wcscmp='$d_wcscmp'
24933 d_wcstombs='$d_wcstombs'
24934 d_wcsxfrm='$d_wcsxfrm'
24935 d_wctomb='$d_wctomb'
24936 d_writev='$d_writev'
24937 d_xenix='$d_xenix'
24938 date='$date'
24939 db_hashtype='$db_hashtype'
24940 db_prefixtype='$db_prefixtype'
24941 db_version_major='$db_version_major'
24942 db_version_minor='$db_version_minor'
24943 db_version_patch='$db_version_patch'
24944 default_inc_excludes_dot='$default_inc_excludes_dot'
24945 direntrytype='$direntrytype'
24946 dlext='$dlext'
24947 dlsrc='$dlsrc'
24948 doubleinfbytes='$doubleinfbytes'
24949 doublekind='$doublekind'
24950 doublemantbits='$doublemantbits'
24951 doublenanbytes='$doublenanbytes'
24952 doublesize='$doublesize'
24953 drand01='$drand01'
24954 drand48_r_proto='$drand48_r_proto'
24955 dtrace='$dtrace'
24956 dtraceobject='$dtraceobject'
24957 dynamic_ext='$dynamic_ext'
24958 eagain='$eagain'
24959 ebcdic='$ebcdic'
24960 echo='$echo'
24961 egrep='$egrep'
24962 emacs='$emacs'
24963 endgrent_r_proto='$endgrent_r_proto'
24964 endhostent_r_proto='$endhostent_r_proto'
24965 endnetent_r_proto='$endnetent_r_proto'
24966 endprotoent_r_proto='$endprotoent_r_proto'
24967 endpwent_r_proto='$endpwent_r_proto'
24968 endservent_r_proto='$endservent_r_proto'
24969 eunicefix='$eunicefix'
24970 exe_ext='$exe_ext'
24971 expr='$expr'
24972 extensions='$extensions'
24973 extern_C='$extern_C'
24974 extras='$extras'
24975 fflushNULL='$fflushNULL'
24976 fflushall='$fflushall'
24977 find='$find'
24978 firstmakefile='$firstmakefile'
24979 flex='$flex'
24980 fpossize='$fpossize'
24981 fpostype='$fpostype'
24982 freetype='$freetype'
24983 from='$from'
24984 full_ar='$full_ar'
24985 full_csh='$full_csh'
24986 full_sed='$full_sed'
24987 gccansipedantic='$gccansipedantic'
24988 gccosandvers='$gccosandvers'
24989 gccversion='$gccversion'
24990 getgrent_r_proto='$getgrent_r_proto'
24991 getgrgid_r_proto='$getgrgid_r_proto'
24992 getgrnam_r_proto='$getgrnam_r_proto'
24993 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24994 gethostbyname_r_proto='$gethostbyname_r_proto'
24995 gethostent_r_proto='$gethostent_r_proto'
24996 getlogin_r_proto='$getlogin_r_proto'
24997 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24998 getnetbyname_r_proto='$getnetbyname_r_proto'
24999 getnetent_r_proto='$getnetent_r_proto'
25000 getprotobyname_r_proto='$getprotobyname_r_proto'
25001 getprotobynumber_r_proto='$getprotobynumber_r_proto'
25002 getprotoent_r_proto='$getprotoent_r_proto'
25003 getpwent_r_proto='$getpwent_r_proto'
25004 getpwnam_r_proto='$getpwnam_r_proto'
25005 getpwuid_r_proto='$getpwuid_r_proto'
25006 getservbyname_r_proto='$getservbyname_r_proto'
25007 getservbyport_r_proto='$getservbyport_r_proto'
25008 getservent_r_proto='$getservent_r_proto'
25009 getspnam_r_proto='$getspnam_r_proto'
25010 gidformat='$gidformat'
25011 gidsign='$gidsign'
25012 gidsize='$gidsize'
25013 gidtype='$gidtype'
25014 glibpth='$glibpth'
25015 gmake='$gmake'
25016 gmtime_r_proto='$gmtime_r_proto'
25017 gnulibc_version='$gnulibc_version'
25018 grep='$grep'
25019 groupcat='$groupcat'
25020 groupstype='$groupstype'
25021 gzip='$gzip'
25022 h_fcntl='$h_fcntl'
25023 h_sysfile='$h_sysfile'
25024 hint='$hint'
25025 hostcat='$hostcat'
25026 hostgenerate='$hostgenerate'
25027 hostosname='$hostosname'
25028 hostperl='$hostperl'
25029 html1dir='$html1dir'
25030 html1direxp='$html1direxp'
25031 html3dir='$html3dir'
25032 html3direxp='$html3direxp'
25033 i16size='$i16size'
25034 i16type='$i16type'
25035 i32size='$i32size'
25036 i32type='$i32type'
25037 i64size='$i64size'
25038 i64type='$i64type'
25039 i8size='$i8size'
25040 i8type='$i8type'
25041 i_arpainet='$i_arpainet'
25042 i_assert='$i_assert'
25043 i_bfd='$i_bfd'
25044 i_bsdioctl='$i_bsdioctl'
25045 i_crypt='$i_crypt'
25046 i_db='$i_db'
25047 i_dbm='$i_dbm'
25048 i_dirent='$i_dirent'
25049 i_dlfcn='$i_dlfcn'
25050 i_execinfo='$i_execinfo'
25051 i_fcntl='$i_fcntl'
25052 i_fenv='$i_fenv'
25053 i_float='$i_float'
25054 i_fp='$i_fp'
25055 i_fp_class='$i_fp_class'
25056 i_gdbm='$i_gdbm'
25057 i_gdbm_ndbm='$i_gdbm_ndbm'
25058 i_gdbmndbm='$i_gdbmndbm'
25059 i_grp='$i_grp'
25060 i_ieeefp='$i_ieeefp'
25061 i_inttypes='$i_inttypes'
25062 i_langinfo='$i_langinfo'
25063 i_libutil='$i_libutil'
25064 i_limits='$i_limits'
25065 i_locale='$i_locale'
25066 i_machcthr='$i_machcthr'
25067 i_malloc='$i_malloc'
25068 i_mallocmalloc='$i_mallocmalloc'
25069 i_math='$i_math'
25070 i_memory='$i_memory'
25071 i_mntent='$i_mntent'
25072 i_ndbm='$i_ndbm'
25073 i_netdb='$i_netdb'
25074 i_neterrno='$i_neterrno'
25075 i_netinettcp='$i_netinettcp'
25076 i_niin='$i_niin'
25077 i_poll='$i_poll'
25078 i_prot='$i_prot'
25079 i_pthread='$i_pthread'
25080 i_pwd='$i_pwd'
25081 i_quadmath='$i_quadmath'
25082 i_rpcsvcdbm='$i_rpcsvcdbm'
25083 i_sgtty='$i_sgtty'
25084 i_shadow='$i_shadow'
25085 i_socks='$i_socks'
25086 i_stdarg='$i_stdarg'
25087 i_stdbool='$i_stdbool'
25088 i_stddef='$i_stddef'
25089 i_stdint='$i_stdint'
25090 i_stdlib='$i_stdlib'
25091 i_string='$i_string'
25092 i_sunmath='$i_sunmath'
25093 i_sysaccess='$i_sysaccess'
25094 i_sysdir='$i_sysdir'
25095 i_sysfile='$i_sysfile'
25096 i_sysfilio='$i_sysfilio'
25097 i_sysin='$i_sysin'
25098 i_sysioctl='$i_sysioctl'
25099 i_syslog='$i_syslog'
25100 i_sysmman='$i_sysmman'
25101 i_sysmode='$i_sysmode'
25102 i_sysmount='$i_sysmount'
25103 i_sysndir='$i_sysndir'
25104 i_sysparam='$i_sysparam'
25105 i_syspoll='$i_syspoll'
25106 i_sysresrc='$i_sysresrc'
25107 i_syssecrt='$i_syssecrt'
25108 i_sysselct='$i_sysselct'
25109 i_syssockio='$i_syssockio'
25110 i_sysstat='$i_sysstat'
25111 i_sysstatfs='$i_sysstatfs'
25112 i_sysstatvfs='$i_sysstatvfs'
25113 i_systime='$i_systime'
25114 i_systimek='$i_systimek'
25115 i_systimes='$i_systimes'
25116 i_systypes='$i_systypes'
25117 i_sysuio='$i_sysuio'
25118 i_sysun='$i_sysun'
25119 i_sysutsname='$i_sysutsname'
25120 i_sysvfs='$i_sysvfs'
25121 i_syswait='$i_syswait'
25122 i_termio='$i_termio'
25123 i_termios='$i_termios'
25124 i_time='$i_time'
25125 i_unistd='$i_unistd'
25126 i_ustat='$i_ustat'
25127 i_utime='$i_utime'
25128 i_values='$i_values'
25129 i_varargs='$i_varargs'
25130 i_varhdr='$i_varhdr'
25131 i_vfork='$i_vfork'
25132 i_xlocale='$i_xlocale'
25133 ignore_versioned_solibs='$ignore_versioned_solibs'
25134 inc_version_list='$inc_version_list'
25135 inc_version_list_init='$inc_version_list_init'
25136 incpath='$incpath'
25137 incpth='$incpth'
25138 inews='$inews'
25139 initialinstalllocation='$initialinstalllocation'
25140 installarchlib='$installarchlib'
25141 installbin='$installbin'
25142 installhtml1dir='$installhtml1dir'
25143 installhtml3dir='$installhtml3dir'
25144 installman1dir='$installman1dir'
25145 installman3dir='$installman3dir'
25146 installprefix='$installprefix'
25147 installprefixexp='$installprefixexp'
25148 installprivlib='$installprivlib'
25149 installscript='$installscript'
25150 installsitearch='$installsitearch'
25151 installsitebin='$installsitebin'
25152 installsitehtml1dir='$installsitehtml1dir'
25153 installsitehtml3dir='$installsitehtml3dir'
25154 installsitelib='$installsitelib'
25155 installsiteman1dir='$installsiteman1dir'
25156 installsiteman3dir='$installsiteman3dir'
25157 installsitescript='$installsitescript'
25158 installstyle='$installstyle'
25159 installusrbinperl='$installusrbinperl'
25160 installvendorarch='$installvendorarch'
25161 installvendorbin='$installvendorbin'
25162 installvendorhtml1dir='$installvendorhtml1dir'
25163 installvendorhtml3dir='$installvendorhtml3dir'
25164 installvendorlib='$installvendorlib'
25165 installvendorman1dir='$installvendorman1dir'
25166 installvendorman3dir='$installvendorman3dir'
25167 installvendorscript='$installvendorscript'
25168 intsize='$intsize'
25169 issymlink='$issymlink'
25170 ivdformat='$ivdformat'
25171 ivsize='$ivsize'
25172 ivtype='$ivtype'
25173 known_extensions='$known_extensions'
25174 ksh='$ksh'
25175 ld='$ld'
25176 ld_can_script='$ld_can_script'
25177 lddlflags='$lddlflags'
25178 ldflags='$ldflags'
25179 ldflags_uselargefiles='$ldflags_uselargefiles'
25180 ldlibpthname='$ldlibpthname'
25181 less='$less'
25182 lib_ext='$lib_ext'
25183 libc='$libc'
25184 libperl='$libperl'
25185 libpth='$libpth'
25186 libs='$libs'
25187 libsdirs='$libsdirs'
25188 libsfiles='$libsfiles'
25189 libsfound='$libsfound'
25190 libspath='$libspath'
25191 libswanted='$libswanted'
25192 libswanted_uselargefiles='$libswanted_uselargefiles'
25193 line='$line'
25194 lint='$lint'
25195 lkflags='$lkflags'
25196 ln='$ln'
25197 lns='$lns'
25198 localtime_r_proto='$localtime_r_proto'
25199 locincpth='$locincpth'
25200 loclibpth='$loclibpth'
25201 longdblinfbytes='$longdblinfbytes'
25202 longdblkind='$longdblkind'
25203 longdblmantbits='$longdblmantbits'
25204 longdblnanbytes='$longdblnanbytes'
25205 longdblsize='$longdblsize'
25206 longlongsize='$longlongsize'
25207 longsize='$longsize'
25208 lp='$lp'
25209 lpr='$lpr'
25210 ls='$ls'
25211 lseeksize='$lseeksize'
25212 lseektype='$lseektype'
25213 mail='$mail'
25214 mailx='$mailx'
25215 make='$make'
25216 make_set_make='$make_set_make'
25217 mallocobj='$mallocobj'
25218 mallocsrc='$mallocsrc'
25219 malloctype='$malloctype'
25220 man1dir='$man1dir'
25221 man1direxp='$man1direxp'
25222 man1ext='$man1ext'
25223 man3dir='$man3dir'
25224 man3direxp='$man3direxp'
25225 man3ext='$man3ext'
25226 mips_type='$mips_type'
25227 mistrustnm='$mistrustnm'
25228 mkdir='$mkdir'
25229 mmaptype='$mmaptype'
25230 modetype='$modetype'
25231 more='$more'
25232 multiarch='$multiarch'
25233 mv='$mv'
25234 myarchname='$myarchname'
25235 mydomain='$mydomain'
25236 myhostname='$myhostname'
25237 myuname='$myuname'
25238 n='$n'
25239 need_va_copy='$need_va_copy'
25240 netdb_hlen_type='$netdb_hlen_type'
25241 netdb_host_type='$netdb_host_type'
25242 netdb_name_type='$netdb_name_type'
25243 netdb_net_type='$netdb_net_type'
25244 nm='$nm'
25245 nm_opt='$nm_opt'
25246 nm_so_opt='$nm_so_opt'
25247 nonxs_ext='$nonxs_ext'
25248 nroff='$nroff'
25249 nvEUformat='$nvEUformat'
25250 nvFUformat='$nvFUformat'
25251 nvGUformat='$nvGUformat'
25252 nv_overflows_integers_at='$nv_overflows_integers_at'
25253 nv_preserves_uv_bits='$nv_preserves_uv_bits'
25254 nveformat='$nveformat'
25255 nvfformat='$nvfformat'
25256 nvgformat='$nvgformat'
25257 nvmantbits='$nvmantbits'
25258 nvsize='$nvsize'
25259 nvtype='$nvtype'
25260 o_nonblock='$o_nonblock'
25261 obj_ext='$obj_ext'
25262 old_pthread_create_joinable='$old_pthread_create_joinable'
25263 optimize='$optimize'
25264 orderlib='$orderlib'
25265 osname='$osname'
25266 osvers='$osvers'
25267 otherlibdirs='$otherlibdirs'
25268 package='$package'
25269 pager='$pager'
25270 passcat='$passcat'
25271 patchlevel='$patchlevel'
25272 path_sep='$path_sep'
25273 perl5='$perl5'
25274 perl='$perl'
25275 perl_patchlevel='$perl_patchlevel'
25276 perl_static_inline='$perl_static_inline'
25277 perladmin='$perladmin'
25278 perllibs='$perllibs'
25279 perlpath='$perlpath'
25280 pg='$pg'
25281 phostname='$phostname'
25282 pidtype='$pidtype'
25283 plibpth='$plibpth'
25284 pmake='$pmake'
25285 pr='$pr'
25286 prefix='$prefix'
25287 prefixexp='$prefixexp'
25288 privlib='$privlib'
25289 privlibexp='$privlibexp'
25290 procselfexe='$procselfexe'
25291 prototype='$prototype'
25292 ptrsize='$ptrsize'
25293 quadkind='$quadkind'
25294 quadtype='$quadtype'
25295 randbits='$randbits'
25296 randfunc='$randfunc'
25297 random_r_proto='$random_r_proto'
25298 randseedtype='$randseedtype'
25299 ranlib='$ranlib'
25300 rd_nodata='$rd_nodata'
25301 readdir64_r_proto='$readdir64_r_proto'
25302 readdir_r_proto='$readdir_r_proto'
25303 revision='$revision'
25304 rm='$rm'
25305 rm_try='$rm_try'
25306 rmail='$rmail'
25307 run='$run'
25308 runnm='$runnm'
25309 sGMTIME_max='$sGMTIME_max'
25310 sGMTIME_min='$sGMTIME_min'
25311 sLOCALTIME_max='$sLOCALTIME_max'
25312 sLOCALTIME_min='$sLOCALTIME_min'
25313 sPRIEUldbl='$sPRIEUldbl'
25314 sPRIFUldbl='$sPRIFUldbl'
25315 sPRIGUldbl='$sPRIGUldbl'
25316 sPRIXU64='$sPRIXU64'
25317 sPRId64='$sPRId64'
25318 sPRIeldbl='$sPRIeldbl'
25319 sPRIfldbl='$sPRIfldbl'
25320 sPRIgldbl='$sPRIgldbl'
25321 sPRIi64='$sPRIi64'
25322 sPRIo64='$sPRIo64'
25323 sPRIu64='$sPRIu64'
25324 sPRIx64='$sPRIx64'
25325 sSCNfldbl='$sSCNfldbl'
25326 sched_yield='$sched_yield'
25327 scriptdir='$scriptdir'
25328 scriptdirexp='$scriptdirexp'
25329 sed='$sed'
25330 seedfunc='$seedfunc'
25331 selectminbits='$selectminbits'
25332 selecttype='$selecttype'
25333 sendmail='$sendmail'
25334 setgrent_r_proto='$setgrent_r_proto'
25335 sethostent_r_proto='$sethostent_r_proto'
25336 setlocale_r_proto='$setlocale_r_proto'
25337 setnetent_r_proto='$setnetent_r_proto'
25338 setprotoent_r_proto='$setprotoent_r_proto'
25339 setpwent_r_proto='$setpwent_r_proto'
25340 setservent_r_proto='$setservent_r_proto'
25341 sh='$sh'
25342 shar='$shar'
25343 sharpbang='$sharpbang'
25344 shmattype='$shmattype'
25345 shortsize='$shortsize'
25346 shrpenv='$shrpenv'
25347 shsharp='$shsharp'
25348 sig_count='$sig_count'
25349 sig_name='$sig_name'
25350 sig_name_init='$sig_name_init'
25351 sig_num='$sig_num'
25352 sig_num_init='$sig_num_init'
25353 sig_size='$sig_size'
25354 signal_t='$signal_t'
25355 sitearch='$sitearch'
25356 sitearchexp='$sitearchexp'
25357 sitebin='$sitebin'
25358 sitebinexp='$sitebinexp'
25359 sitehtml1dir='$sitehtml1dir'
25360 sitehtml1direxp='$sitehtml1direxp'
25361 sitehtml3dir='$sitehtml3dir'
25362 sitehtml3direxp='$sitehtml3direxp'
25363 sitelib='$sitelib'
25364 sitelib_stem='$sitelib_stem'
25365 sitelibexp='$sitelibexp'
25366 siteman1dir='$siteman1dir'
25367 siteman1direxp='$siteman1direxp'
25368 siteman3dir='$siteman3dir'
25369 siteman3direxp='$siteman3direxp'
25370 siteprefix='$siteprefix'
25371 siteprefixexp='$siteprefixexp'
25372 sitescript='$sitescript'
25373 sitescriptexp='$sitescriptexp'
25374 sizesize='$sizesize'
25375 sizetype='$sizetype'
25376 sleep='$sleep'
25377 smail='$smail'
25378 so='$so'
25379 sockethdr='$sockethdr'
25380 socketlib='$socketlib'
25381 socksizetype='$socksizetype'
25382 sort='$sort'
25383 spackage='$spackage'
25384 spitshell='$spitshell'
25385 srand48_r_proto='$srand48_r_proto'
25386 srandom_r_proto='$srandom_r_proto'
25387 src='$src'
25388 ssizetype='$ssizetype'
25389 st_ino_sign='$st_ino_sign'
25390 st_ino_size='$st_ino_size'
25391 startperl='$startperl'
25392 startsh='$startsh'
25393 static_ext='$static_ext'
25394 stdchar='$stdchar'
25395 stdio_base='$stdio_base'
25396 stdio_bufsiz='$stdio_bufsiz'
25397 stdio_cnt='$stdio_cnt'
25398 stdio_filbuf='$stdio_filbuf'
25399 stdio_ptr='$stdio_ptr'
25400 stdio_stream_array='$stdio_stream_array'
25401 strerror_r_proto='$strerror_r_proto'
25402 strings='$strings'
25403 submit='$submit'
25404 subversion='$subversion'
25405 sysman='$sysman'
25406 sysroot='$sysroot'
25407 tail='$tail'
25408 tar='$tar'
25409 targetarch='$targetarch'
25410 targetdir='$targetdir'
25411 targetenv='$targetenv'
25412 targethost='$targethost'
25413 targetmkdir='$targetmkdir'
25414 targetport='$targetport'
25415 targetsh='$targetsh'
25416 tbl='$tbl'
25417 tee='$tee'
25418 test='$test'
25419 timeincl='$timeincl'
25420 timetype='$timetype'
25421 tmpnam_r_proto='$tmpnam_r_proto'
25422 to='$to'
25423 touch='$touch'
25424 tr='$tr'
25425 trnl='$trnl'
25426 troff='$troff'
25427 ttyname_r_proto='$ttyname_r_proto'
25428 u16size='$u16size'
25429 u16type='$u16type'
25430 u32size='$u32size'
25431 u32type='$u32type'
25432 u64size='$u64size'
25433 u64type='$u64type'
25434 u8size='$u8size'
25435 u8type='$u8type'
25436 uidformat='$uidformat'
25437 uidsign='$uidsign'
25438 uidsize='$uidsize'
25439 uidtype='$uidtype'
25440 uname='$uname'
25441 uniq='$uniq'
25442 uquadtype='$uquadtype'
25443 use5005threads='$use5005threads'
25444 use64bitall='$use64bitall'
25445 use64bitint='$use64bitint'
25446 usecbacktrace='$usecbacktrace'
25447 usecrosscompile='$usecrosscompile'
25448 usedevel='$usedevel'
25449 usedl='$usedl'
25450 usedtrace='$usedtrace'
25451 usefaststdio='$usefaststdio'
25452 useithreads='$useithreads'
25453 usekernprocpathname='$usekernprocpathname'
25454 uselargefiles='$uselargefiles'
25455 uselongdouble='$uselongdouble'
25456 usemallocwrap='$usemallocwrap'
25457 usemorebits='$usemorebits'
25458 usemultiplicity='$usemultiplicity'
25459 usemymalloc='$usemymalloc'
25460 usenm='$usenm'
25461 usensgetexecutablepath='$usensgetexecutablepath'
25462 useopcode='$useopcode'
25463 useperlio='$useperlio'
25464 useposix='$useposix'
25465 usequadmath='$usequadmath'
25466 usereentrant='$usereentrant'
25467 userelocatableinc='$userelocatableinc'
25468 useshrplib='$useshrplib'
25469 usesitecustomize='$usesitecustomize'
25470 usesocks='$usesocks'
25471 usethreads='$usethreads'
25472 usevendorprefix='$usevendorprefix'
25473 useversionedarchname='$useversionedarchname'
25474 usevfork='$usevfork'
25475 usrinc='$usrinc'
25476 uuname='$uuname'
25477 uvXUformat='$uvXUformat'
25478 uvoformat='$uvoformat'
25479 uvsize='$uvsize'
25480 uvtype='$uvtype'
25481 uvuformat='$uvuformat'
25482 uvxformat='$uvxformat'
25483 vaproto='$vaproto'
25484 vendorarch='$vendorarch'
25485 vendorarchexp='$vendorarchexp'
25486 vendorbin='$vendorbin'
25487 vendorbinexp='$vendorbinexp'
25488 vendorhtml1dir='$vendorhtml1dir'
25489 vendorhtml1direxp='$vendorhtml1direxp'
25490 vendorhtml3dir='$vendorhtml3dir'
25491 vendorhtml3direxp='$vendorhtml3direxp'
25492 vendorlib='$vendorlib'
25493 vendorlib_stem='$vendorlib_stem'
25494 vendorlibexp='$vendorlibexp'
25495 vendorman1dir='$vendorman1dir'
25496 vendorman1direxp='$vendorman1direxp'
25497 vendorman3dir='$vendorman3dir'
25498 vendorman3direxp='$vendorman3direxp'
25499 vendorprefix='$vendorprefix'
25500 vendorprefixexp='$vendorprefixexp'
25501 vendorscript='$vendorscript'
25502 vendorscriptexp='$vendorscriptexp'
25503 version='$version'
25504 version_patchlevel_string='$version_patchlevel_string'
25505 versiononly='$versiononly'
25506 vi='$vi'
25507 xlibpth='$xlibpth'
25508 yacc='$yacc'
25509 yaccflags='$yaccflags'
25510 zcat='$zcat'
25511 zip='$zip'
25512 EOT
25513
25514 : add special variables
25515 $test -f $src/patchlevel.h && \
25516 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
25517 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
25518 echo "PERL_CONFIG_SH=true" >>config.sh
25519
25520 : propagate old symbols
25521 if $test -f UU/config.sh; then
25522         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
25523         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
25524                 config.sh config.sh UU/oldconfig.sh |\
25525                 $sort | $uniq -u >UU/oldsyms
25526         set X `$cat UU/oldsyms`
25527         shift
25528         case $# in
25529         0) ;;
25530         *)
25531                 $cat <<EOM
25532 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
25533 EOM
25534                 echo ": Variables propagated from previous config.sh file." >>config.sh
25535                 for sym in `$cat UU/oldsyms`; do
25536                         echo "    Propagating $hint variable "'$'"$sym..."
25537                         eval 'tmp="$'"${sym}"'"'
25538                         echo "$tmp" | \
25539                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
25540                 done
25541                 ;;
25542         esac
25543 fi
25544
25545 : preserve RCS keywords in files with variable substitution, grrr
25546 Id='$Id'
25547
25548 : Finish up by extracting the .SH files
25549 case "$alldone" in
25550 exit)
25551         echo "Stopping at your request, leaving temporary files around."
25552         exit 0
25553         ;;
25554 cont)
25555         ;;
25556 '')
25557         dflt=''
25558         nostick=true
25559         $cat <<EOM
25560
25561 If you'd like to make any changes to the config.sh file before I begin
25562 to configure things, do it as a shell escape now (e.g. !vi config.sh).
25563
25564 EOM
25565         rp="Press return or use a shell escape to edit config.sh:"
25566         . UU/myread
25567         nostick=''
25568         case "$ans" in
25569         '') ;;
25570         *) : in case they cannot read
25571                 sh 1>&4 -c "$ans";;
25572         esac
25573         ;;
25574 esac
25575
25576 : if this fails, just run all the .SH files by hand
25577 . ./config.sh
25578
25579 echo " "
25580 exec 1>&4
25581 pwd=`pwd`
25582 . ./UU/extract
25583 cd "$pwd"
25584
25585 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
25586         dflt=y
25587         case "$silent" in
25588         true) ;;
25589         *)
25590                 $cat <<EOM
25591
25592 Now you need to generate make dependencies by running "$make depend".
25593 You might prefer to run it in background: "$make depend > makedepend.out &"
25594 It can take a while, so you might not want to run it right now.
25595
25596 EOM
25597                 ;;
25598         esac
25599         rp="Run $make depend now?"
25600         . UU/myread
25601         case "$ans" in
25602         y*)
25603                 $make depend && echo "Now you must run '$make'."
25604                 ;;
25605         *)
25606                 echo "You must run '$make depend' then '$make'."
25607                 ;;
25608         esac
25609 elif test -f [Mm]akefile; then
25610         echo " "
25611         echo "Now you must run a $make."
25612 else
25613         echo "Configure done."
25614 fi
25615
25616 if $test -f Policy.sh; then
25617     $cat <<EOM
25618
25619 If you compile $package on a different machine or from a different object
25620 directory, copy the Policy.sh file from this object directory to the
25621 new one before you run Configure -- this will help you with most of
25622 the policy defaults.
25623
25624 EOM
25625 fi
25626 if $test -f UU/config.msg; then
25627     echo "Hmm.  I also noted the following information while running:"
25628     echo " "
25629     $cat UU/config.msg >&4
25630 fi
25631 $rm -f kit*isdone ark*isdone
25632 $rm -rf UU
25633
25634 : End of Configure
25635