This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
utf8.c: Fix bugs with overlongs combined with other malformations.
[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=''
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 dtracexnolibs=''
953 ebcdic=''
954 fflushNULL=''
955 fflushall=''
956 fpossize=''
957 fpostype=''
958 gccansipedantic=''
959 gccosandvers=''
960 gccversion=''
961 gidformat=''
962 gidsign=''
963 gidsize=''
964 gidtype=''
965 groupstype=''
966 h_fcntl=''
967 h_sysfile=''
968 html1dir=''
969 html1direxp=''
970 installhtml1dir=''
971 html3dir=''
972 html3direxp=''
973 installhtml3dir=''
974 i_arpainet=''
975 i_assert=''
976 i_bfd=''
977 i_crypt=''
978 db_hashtype=''
979 db_prefixtype=''
980 db_version_major=''
981 db_version_minor=''
982 db_version_patch=''
983 i_db=''
984 i_dbm=''
985 i_rpcsvcdbm=''
986 d_dirnamlen=''
987 direntrytype=''
988 i_dirent=''
989 i_dlfcn=''
990 i_execinfo=''
991 i_fcntl=''
992 i_fenv=''
993 i_float=''
994 i_fp=''
995 i_fp_class=''
996 i_gdbm=''
997 d_grpasswd=''
998 i_grp=''
999 i_ieeefp=''
1000 i_inttypes=''
1001 i_langinfo=''
1002 i_libutil=''
1003 i_limits=''
1004 i_locale=''
1005 i_machcthr=''
1006 i_malloc=''
1007 i_mallocmalloc=''
1008 i_math=''
1009 i_memory=''
1010 i_mntent=''
1011 d_gdbm_ndbm_h_uses_prototypes=''
1012 d_gdbmndbm_h_uses_prototypes=''
1013 d_ndbm=''
1014 d_ndbm_h_uses_prototypes=''
1015 i_gdbm_ndbm=''
1016 i_gdbmndbm=''
1017 i_ndbm=''
1018 i_netdb=''
1019 i_neterrno=''
1020 i_netinettcp=''
1021 i_niin=''
1022 i_sysin=''
1023 i_poll=''
1024 i_prot=''
1025 i_pthread=''
1026 d_pwage=''
1027 d_pwchange=''
1028 d_pwclass=''
1029 d_pwcomment=''
1030 d_pwexpire=''
1031 d_pwgecos=''
1032 d_pwpasswd=''
1033 d_pwquota=''
1034 i_pwd=''
1035 i_quadmath=''
1036 i_shadow=''
1037 i_socks=''
1038 i_stdbool=''
1039 i_stddef=''
1040 i_stdint=''
1041 i_stdlib=''
1042 i_string=''
1043 strings=''
1044 i_sunmath=''
1045 i_sysaccess=''
1046 i_sysdir=''
1047 i_sysfile=''
1048 d_voidtty=''
1049 i_bsdioctl=''
1050 i_sysfilio=''
1051 i_sysioctl=''
1052 i_syssockio=''
1053 i_syslog=''
1054 i_sysmman=''
1055 i_sysmode=''
1056 i_sysmount=''
1057 i_sysndir=''
1058 i_sysparam=''
1059 i_syspoll=''
1060 i_sysresrc=''
1061 i_syssecrt=''
1062 i_sysselct=''
1063 i_sysstat=''
1064 i_sysstatfs=''
1065 i_sysstatvfs=''
1066 i_systimes=''
1067 i_systypes=''
1068 i_sysuio=''
1069 i_sysun=''
1070 i_sysutsname=''
1071 i_sysvfs=''
1072 i_syswait=''
1073 i_sgtty=''
1074 i_termio=''
1075 i_termios=''
1076 d_tm_tm_gmtoff=''
1077 d_tm_tm_zone=''
1078 i_systime=''
1079 i_systimek=''
1080 i_time=''
1081 timeincl=''
1082 i_unistd=''
1083 i_ustat=''
1084 i_utime=''
1085 i_values=''
1086 i_stdarg=''
1087 i_varargs=''
1088 i_varhdr=''
1089 i_vfork=''
1090 d_inc_version_list=''
1091 inc_version_list=''
1092 inc_version_list_init=''
1093 doubleinfbytes=''
1094 doublenanbytes=''
1095 longdblinfbytes=''
1096 longdblnanbytes=''
1097 installprefix=''
1098 installprefixexp=''
1099 installstyle=''
1100 installusrbinperl=''
1101 intsize=''
1102 longsize=''
1103 shortsize=''
1104 issymlink=''
1105 libc=''
1106 ldlibpthname=''
1107 libperl=''
1108 shrpenv=''
1109 useshrplib=''
1110 glibpth=''
1111 incpth=''
1112 libpth=''
1113 loclibpth=''
1114 plibpth=''
1115 xlibpth=''
1116 ignore_versioned_solibs=''
1117 libs=''
1118 libsdirs=''
1119 libsfiles=''
1120 libsfound=''
1121 libspath=''
1122 lns=''
1123 d_PRIEUldbl=''
1124 d_PRIFUldbl=''
1125 d_PRIGUldbl=''
1126 d_PRIeldbl=''
1127 d_PRIfldbl=''
1128 d_PRIgldbl=''
1129 d_SCNfldbl=''
1130 d_double_has_inf=''
1131 d_double_has_nan=''
1132 d_double_has_negative_zero=''
1133 d_double_has_subnormals=''
1134 d_double_style_cray=''
1135 d_double_style_ibm=''
1136 d_double_style_ieee=''
1137 d_double_style_vax=''
1138 doublekind=''
1139 sPRIEUldbl=''
1140 sPRIFUldbl=''
1141 sPRIGUldbl=''
1142 sPRIeldbl=''
1143 sPRIfldbl=''
1144 sPRIgldbl=''
1145 sSCNfldbl=''
1146 lseeksize=''
1147 lseektype=''
1148 make_set_make=''
1149 d_mymalloc=''
1150 freetype=''
1151 mallocobj=''
1152 mallocsrc=''
1153 malloctype=''
1154 usemallocwrap=''
1155 usemymalloc=''
1156 installman1dir=''
1157 man1dir=''
1158 man1direxp=''
1159 man1ext=''
1160 installman3dir=''
1161 man3dir=''
1162 man3direxp=''
1163 man3ext=''
1164 doublemantbits=''
1165 longdblmantbits=''
1166 nvmantbits=''
1167 modetype=''
1168 multiarch=''
1169 mydomain=''
1170 myhostname=''
1171 phostname=''
1172 c=''
1173 n=''
1174 d_eofnblk=''
1175 eagain=''
1176 o_nonblock=''
1177 rd_nodata=''
1178 need_va_copy=''
1179 netdb_hlen_type=''
1180 netdb_host_type=''
1181 netdb_name_type=''
1182 netdb_net_type=''
1183 groupcat=''
1184 hostcat=''
1185 passcat=''
1186 orderlib=''
1187 ranlib=''
1188 d_perl_otherlibdirs=''
1189 otherlibdirs=''
1190 package=''
1191 spackage=''
1192 pager=''
1193 api_revision=''
1194 api_subversion=''
1195 api_version=''
1196 api_versionstring=''
1197 patchlevel=''
1198 perl_patchlevel=''
1199 revision=''
1200 subversion=''
1201 version=''
1202 version_patchlevel_string=''
1203 perl5=''
1204 perladmin=''
1205 perlpath=''
1206 d_nv_preserves_uv=''
1207 d_nv_zero_is_allbits_zero=''
1208 i16size=''
1209 i16type=''
1210 i32size=''
1211 i32type=''
1212 i64size=''
1213 i64type=''
1214 i8size=''
1215 i8type=''
1216 ivsize=''
1217 ivtype=''
1218 nv_overflows_integers_at=''
1219 nv_preserves_uv_bits=''
1220 nvsize=''
1221 nvtype=''
1222 u16size=''
1223 u16type=''
1224 u32size=''
1225 u32type=''
1226 u64size=''
1227 u64type=''
1228 u8size=''
1229 u8type=''
1230 uvsize=''
1231 uvtype=''
1232 ivdformat=''
1233 nvEUformat=''
1234 nvFUformat=''
1235 nvGUformat=''
1236 nveformat=''
1237 nvfformat=''
1238 nvgformat=''
1239 uvXUformat=''
1240 uvoformat=''
1241 uvuformat=''
1242 uvxformat=''
1243 pidtype=''
1244 prefix=''
1245 prefixexp=''
1246 installprivlib=''
1247 privlib=''
1248 privlibexp=''
1249 prototype=''
1250 ptrsize=''
1251 d_PRIXU64=''
1252 d_PRId64=''
1253 d_PRIi64=''
1254 d_PRIo64=''
1255 d_PRIu64=''
1256 d_PRIx64=''
1257 sPRIXU64=''
1258 sPRId64=''
1259 sPRIi64=''
1260 sPRIo64=''
1261 sPRIu64=''
1262 sPRIx64=''
1263 d_quad=''
1264 quadkind=''
1265 quadtype=''
1266 uquadtype=''
1267 drand01=''
1268 randbits=''
1269 randfunc=''
1270 randseedtype=''
1271 seedfunc=''
1272 installscript=''
1273 scriptdir=''
1274 scriptdirexp=''
1275 selectminbits=''
1276 selecttype=''
1277 sh=''
1278 targetsh=''
1279 sig_count=''
1280 sig_name=''
1281 sig_name_init=''
1282 sig_num=''
1283 sig_num_init=''
1284 sig_size=''
1285 d_sitearch=''
1286 installsitearch=''
1287 sitearch=''
1288 sitearchexp=''
1289 installsitebin=''
1290 sitebin=''
1291 sitebinexp=''
1292 installsitehtml1dir=''
1293 sitehtml1dir=''
1294 sitehtml1direxp=''
1295 installsitehtml3dir=''
1296 sitehtml3dir=''
1297 sitehtml3direxp=''
1298 installsitelib=''
1299 sitelib=''
1300 sitelib_stem=''
1301 sitelibexp=''
1302 installsiteman1dir=''
1303 siteman1dir=''
1304 siteman1direxp=''
1305 installsiteman3dir=''
1306 siteman3dir=''
1307 siteman3direxp=''
1308 siteprefix=''
1309 siteprefixexp=''
1310 installsitescript=''
1311 sitescript=''
1312 sitescriptexp=''
1313 sizesize=''
1314 sizetype=''
1315 d_libname_unique=''
1316 so=''
1317 socksizetype=''
1318 sharpbang=''
1319 shsharp=''
1320 spitshell=''
1321 src=''
1322 ssizetype=''
1323 st_ino_sign=''
1324 st_ino_size=''
1325 startperl=''
1326 startsh=''
1327 stdchar=''
1328 d_stdio_stream_array=''
1329 stdio_stream_array=''
1330 sysman=''
1331 sGMTIME_max=''
1332 sGMTIME_min=''
1333 sLOCALTIME_max=''
1334 sLOCALTIME_min=''
1335 trnl=''
1336 uidformat=''
1337 uidsign=''
1338 uidsize=''
1339 uidtype=''
1340 archname64=''
1341 use64bitall=''
1342 use64bitint=''
1343 usecbacktrace=''
1344 dtrace=''
1345 usedtrace=''
1346 usefaststdio=''
1347 usekernprocpathname=''
1348 ccflags_uselargefiles=''
1349 ldflags_uselargefiles=''
1350 libswanted_uselargefiles=''
1351 uselargefiles=''
1352 uselongdouble=''
1353 usemorebits=''
1354 usemultiplicity=''
1355 nm_opt=''
1356 nm_so_opt=''
1357 runnm=''
1358 usenm=''
1359 usensgetexecutablepath=''
1360 useperlio=''
1361 usequadmath=''
1362 usesocks=''
1363 d_oldpthreads=''
1364 use5005threads=''
1365 useithreads=''
1366 usereentrant=''
1367 usethreads=''
1368 incpath=''
1369 mips_type=''
1370 usrinc=''
1371 vaproto=''
1372 d_vendorarch=''
1373 installvendorarch=''
1374 vendorarch=''
1375 vendorarchexp=''
1376 d_vendorbin=''
1377 installvendorbin=''
1378 vendorbin=''
1379 vendorbinexp=''
1380 installvendorhtml1dir=''
1381 vendorhtml1dir=''
1382 vendorhtml1direxp=''
1383 installvendorhtml3dir=''
1384 vendorhtml3dir=''
1385 vendorhtml3direxp=''
1386 d_vendorlib=''
1387 installvendorlib=''
1388 vendorlib=''
1389 vendorlib_stem=''
1390 vendorlibexp=''
1391 installvendorman1dir=''
1392 vendorman1dir=''
1393 vendorman1direxp=''
1394 installvendorman3dir=''
1395 vendorman3dir=''
1396 vendorman3direxp=''
1397 usevendorprefix=''
1398 vendorprefix=''
1399 vendorprefixexp=''
1400 d_vendorscript=''
1401 installvendorscript=''
1402 vendorscript=''
1403 vendorscriptexp=''
1404 versiononly=''
1405 yacc=''
1406 yaccflags=''
1407 CONFIG=''
1408
1409 : Detect odd OSs
1410 define='define'
1411 undef='undef'
1412 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1413 rmlist=''
1414
1415 : We must find out about Eunice early
1416 eunicefix=':'
1417 if test -f /etc/unixtovms; then
1418         eunicefix=/etc/unixtovms
1419 fi
1420 if test -f /etc/unixtovms.exe; then
1421         eunicefix=/etc/unixtovms.exe
1422 fi
1423
1424 : Set executable suffix now -- needed before hints available
1425 if test -f "/libs/version.library"; then
1426 : Amiga OS
1427     _exe=""
1428 elif test -f "/system/gnu_library/bin/ar.pm"; then
1429 : Stratus VOS
1430     _exe=".pm"
1431 elif test -n "$DJGPP"; then
1432 : DOS DJGPP
1433     _exe=".exe"
1434 elif test -f /kern/cookiejar; then
1435 : MiNT
1436     _exe=""
1437 elif test -d c:/. -o -n "$is_os2" ; then
1438 : OS/2 or cygwin
1439     _exe=".exe"
1440 fi
1441
1442 groupstype=''
1443 i_whoami=''
1444 : Possible local include directories to search.
1445 : Set locincpth to "" in a hint file to defeat local include searches.
1446 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1447 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1448 :
1449 : no include file wanted by default
1450 inclwanted=''
1451
1452 : Enable -DEBUGGING and -DDEBUGGING from the command line
1453 EBUGGING=''
1454 DEBUGGING=''
1455
1456 : Trailing extension.  Override this in a hint file, if needed.
1457 : Extra object files, if any, needed on this platform.
1458 archobjs=''
1459 libnames=''
1460 : change the next line if compiling for Xenix/286 on Xenix/386
1461 xlibpth='/usr/lib/386 /lib/386'
1462 : Possible local library directories to search.
1463 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1464 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1465
1466 : general looking path for locating libraries
1467 glibpth="/lib /usr/lib $xlibpth"
1468 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1469 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1470 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1471 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1472
1473 : Private path used by Configure to find libraries.  Its value
1474 : is prepended to libpth. This variable takes care of special
1475 : machines, like the mips.  Usually, it should be empty.
1476 plibpth=''
1477
1478 : default library list
1479 libswanted=''
1480 : some systems want to use only the non-versioned libso:s
1481 ignore_versioned_solibs=''
1482 ccname=''
1483 ccversion=''
1484 perllibs=''
1485 : set useposix=false in your hint file to disable the POSIX extension.
1486 useposix=true
1487 : set useopcode=false in your hint file to disable the Opcode extension.
1488 useopcode=true
1489 archname64=''
1490 ccflags_uselargefiles=''
1491 ldflags_uselargefiles=''
1492 libswanted_uselargefiles=''
1493 : set usemultiplicity on the Configure command line to enable multiplicity.
1494 : set usesocks on the Configure command line to enable socks.
1495 archname=''
1496 : set usethreads on the Configure command line to enable threads.
1497 usereentrant='undef'
1498 : List of libraries we want.
1499 : If anyone needs extra -lxxx, put those in a hint file.
1500 libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
1501 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1502 : We probably want to search /usr/shlib before most other libraries.
1503 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1504 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1505 glibpth="/usr/shlib $glibpth"
1506 : Do not use vfork unless overridden by a hint file.
1507 usevfork=false
1508
1509 : Find the basic shell for Bourne shell scripts
1510 case "$sh" in
1511 '')
1512         case "$SYSTYPE" in
1513         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1514         *) xxx='/bin/sh';;
1515         esac
1516         if test -f "$xxx"; then
1517                 sh="$xxx"
1518         else
1519                 : Build up a list and do a single loop so we can 'break' out.
1520                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1521                 for xxx in sh bash ksh pdksh ash; do
1522                         for p in $pth; do
1523                                 try="$try ${p}/${xxx}"
1524                         done
1525                 done
1526                 for xxx in $try; do
1527                         if test -f "$xxx"; then
1528                                 sh="$xxx";
1529                                 break
1530                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1531                                 sh="$xxx";
1532                                 break
1533                         elif test -f "$xxx.exe"; then
1534                                 sh="$xxx";
1535                                 break
1536                         fi
1537                 done
1538         fi
1539         ;;
1540 esac
1541
1542 case "$sh" in
1543 '')     cat >&2 <<EOM
1544 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1545
1546 Usually it's in /bin/sh.  How did you even get this far?
1547 Please contact me (Perl Maintainers) at perlbug@perl.org and
1548 we'll try to straighten this all out.
1549 EOM
1550         exit 1
1551         ;;
1552 esac
1553
1554 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1555 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1556 targetsh=$sh
1557
1558 : see if sh knows # comments
1559 if `$sh -c '#' >/dev/null 2>&1`; then
1560         shsharp=true
1561         spitshell=cat
1562         xcat=/bin/cat
1563         test -f $xcat$_exe || xcat=/usr/bin/cat
1564         if test ! -f $xcat$_exe; then
1565                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1566                         if test -f $p/cat$_exe; then
1567                                 xcat=$p/cat
1568                                 break
1569                         fi
1570                 done
1571                 if test ! -f $xcat$_exe; then
1572                         echo "Can't find cat anywhere!"
1573                         exit 1
1574                 fi
1575         fi
1576         echo "#!$xcat" >sharp
1577         $eunicefix sharp
1578         chmod +x sharp
1579         ./sharp > today 2>/dev/null
1580         if test -s today; then
1581                 sharpbang='#!'
1582         else
1583                 echo "#! $xcat" > sharp
1584                 $eunicefix sharp
1585                 chmod +x sharp
1586                 ./sharp > today 2>/dev/null
1587                 if test -s today; then
1588                         sharpbang='#! '
1589                 else
1590                         sharpbang=': use '
1591                 fi
1592         fi
1593 else
1594         echo " "
1595         echo "Your $sh doesn't grok # comments--I will strip them later on."
1596         shsharp=false
1597         cd ..
1598         echo "exec grep -v '^[  ]*#'" >spitshell
1599         chmod +x spitshell
1600         $eunicefix spitshell
1601         spitshell=`pwd`/spitshell
1602         cd UU
1603         echo "I presume that if # doesn't work, #! won't work either!"
1604         sharpbang=': use '
1605 fi
1606 rm -f sharp today
1607
1608 : figure out how to guarantee sh startup
1609 case "$startsh" in
1610 '') startsh=${sharpbang}${sh} ;;
1611 *)
1612 esac
1613 cat >sharp <<EOSS
1614 $startsh
1615 set abc
1616 test "$?abc" != 1
1617 EOSS
1618
1619 chmod +x sharp
1620 $eunicefix sharp
1621 if ./sharp; then
1622         : echo "Yup, it does."
1623 else
1624         echo "Hmm... '$startsh' does not guarantee sh startup..."
1625         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1626 fi
1627 rm -f sharp
1628
1629 : Save command line options in file UU/cmdline.opt for later use in
1630 : generating config.sh.
1631 cat > cmdline.opt <<EOSH
1632 : Configure command line arguments.
1633 config_arg0='$0'
1634 config_args='$*'
1635 config_argc=$#
1636 EOSH
1637 argn=1
1638 args_exp=''
1639 args_sep=''
1640 for arg in "$@"; do
1641         cat >>cmdline.opt <<EOSH
1642 config_arg$argn='$arg'
1643 EOSH
1644         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1645 $arg
1646 EOC
1647         arg_exp=`cat cmdl.opt`
1648         args_exp="$args_exp$args_sep'$arg_exp'"
1649         argn=`expr $argn + 1`
1650         args_sep=' '
1651 done
1652 rm -f cmdl.opt
1653
1654 : produce awk script to parse command line options
1655 cat >options.awk <<'EOF'
1656 BEGIN {
1657         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1658
1659         len = length(optstr);
1660         for (i = 1; i <= len; i++) {
1661                 c = substr(optstr, i, 1);
1662                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1663                 if (a == ":") {
1664                         arg[c] = 1;
1665                         i++;
1666                 }
1667                 opt[c] = 1;
1668         }
1669 }
1670 {
1671         expect = 0;
1672         str = $0;
1673         if (substr(str, 1, 1) != "-") {
1674                 printf("'%s'\n", str);
1675                 next;
1676         }
1677         len = length($0);
1678         for (i = 2; i <= len; i++) {
1679                 c = substr(str, i, 1);
1680                 if (!opt[c]) {
1681                         printf("-%s\n", substr(str, i));
1682                         next;
1683                 }
1684                 printf("-%s\n", c);
1685                 if (arg[c]) {
1686                         if (i < len)
1687                                 printf("'%s'\n", substr(str, i + 1));
1688                         else
1689                                 expect = 1;
1690                         next;
1691                 }
1692         }
1693 }
1694 END {
1695         if (expect)
1696                 print "?";
1697 }
1698 EOF
1699
1700 : process the command line options
1701 set X `for arg in "$@"; do echo "X$arg"; done |
1702         sed -e s/X// | awk -f options.awk`
1703 eval "set $*"
1704 shift
1705 rm -f options.awk
1706
1707 : set up default values
1708 fastread=''
1709 reuseval=false
1710 config_sh=''
1711 alldone=''
1712 error=''
1713 silent=''
1714 extractsh=''
1715 knowitall=''
1716 rm -f optdef.sh posthint.sh
1717 cat >optdef.sh <<EOS
1718 $startsh
1719 EOS
1720
1721
1722 : option parsing
1723 while test $# -gt 0; do
1724         case "$1" in
1725         -d) shift; fastread=yes;;
1726         -e) shift; alldone=cont;;
1727         -f)
1728                 shift
1729                 cd ..
1730                 if test -r "$1"; then
1731                         config_sh="$1"
1732                 else
1733                         echo "$me: cannot read config file $1." >&2
1734                         error=true
1735                 fi
1736                 cd UU
1737                 shift;;
1738         --help|\
1739         -h) shift; error=true;;
1740         -r) shift; reuseval=true;;
1741         -s) shift; silent=true; realsilent=true;;
1742         -E) shift; alldone=exit;;
1743         -K) shift; knowitall=true;;
1744         -O) shift;;
1745         -S) shift; silent=true; extractsh=true;;
1746         -D)
1747                 shift
1748                 case "$1" in
1749                 *=)
1750                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1751                         echo "$me: ignoring -D $1" >&2
1752                         ;;
1753                 *=*) echo "$1" | \
1754                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1755                 *) echo "$1='define'" >> optdef.sh;;
1756                 esac
1757                 shift
1758                 ;;
1759         -U)
1760                 shift
1761                 case "$1" in
1762                 *=) echo "$1" >> optdef.sh;;
1763                 *=*)
1764                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1765                         echo "$me: ignoring -U $1" >&2
1766                         ;;
1767                 *) echo "$1='undef'" >> optdef.sh;;
1768                 esac
1769                 shift
1770                 ;;
1771         -A)
1772             shift
1773             xxx=''
1774             yyy="$1"
1775             zzz=''
1776             uuu=undef
1777             case "$yyy" in
1778             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1779                  case "$zzz" in
1780                  *:*) zzz='' ;;
1781                  *)   xxx=append
1782                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1783                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1784                  esac
1785                  ;;
1786             esac
1787             case "$xxx" in
1788             '')  case "$yyy" in
1789                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1790                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1791                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1792                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1793                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1794                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1795                  esac
1796                  ;;
1797             esac
1798             case "$xxx" in
1799             append)
1800                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1801             clear)
1802                 echo "$yyy=''"                  >> posthint.sh ;;
1803             define)
1804                 case "$zzz" in
1805                 '') zzz=define ;;
1806                 esac
1807                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1808             eval)
1809                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1810             prepend)
1811                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1812             undef)
1813                 case "$zzz" in
1814                 '') zzz="$uuu" ;;
1815                 esac
1816                 echo "$yyy=$zzz"                >> posthint.sh ;;
1817             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1818             esac
1819             shift
1820             ;;
1821         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1822             exit 0;;
1823         --) break;;
1824         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1825         *) break;;
1826         esac
1827 done
1828
1829 case "$error" in
1830 true)
1831         cat >&2 <<EOM
1832 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1833                  [-U symbol] [-U symbol=] [-A command:symbol...]
1834   -d : use defaults for all answers.
1835   -e : go on without questioning past the production of config.sh.
1836   -f : specify an alternate default configuration file.
1837   -h : print this help message and exit (with an error status).
1838   -r : reuse C symbols value if possible (skips costly nm extraction).
1839   -s : silent mode, only echoes questions and essential information.
1840   -D : define symbol to have some value:
1841          -D symbol         symbol gets the value 'define'
1842          -D symbol=value   symbol gets the value 'value'
1843        common used examples (see INSTALL for more info):
1844          -Duse64bitint            use 64bit integers
1845          -Duse64bitall            use 64bit integers and pointers
1846          -Dusethreads             use thread support
1847          -Dinc_version_list=none  do not include older perl trees in @INC
1848          -DEBUGGING=none          DEBUGGING options
1849          -Dcc=gcc                 choose your compiler
1850          -Dprefix=/opt/perl5      choose your destination
1851   -E : stop at the end of questions, after having produced config.sh.
1852   -K : do not use unless you know what you are doing.
1853   -O : ignored for backward compatibility
1854   -S : perform variable substitutions on all .SH files (can mix with -f)
1855   -U : undefine symbol:
1856          -U symbol    symbol gets the value 'undef'
1857          -U symbol=   symbol gets completely empty
1858        e.g.:  -Uversiononly
1859   -A : manipulate symbol after the platform specific hints have been applied:
1860          -A append:symbol=value   append value to symbol
1861          -A symbol=value          like append:, but with a separating space
1862          -A define:symbol=value   define symbol to have value
1863          -A clear:symbol          define symbol to be ''
1864          -A define:symbol         define symbol to be 'define'
1865          -A eval:symbol=value     define symbol to be eval of value
1866          -A prepend:symbol=value  prepend value to symbol
1867          -A undef:symbol          define symbol to be 'undef'
1868          -A undef:symbol=         define symbol to be ''
1869        e.g.:  -A prepend:libswanted='cl pthread '
1870               -A ccflags=-DSOME_MACRO
1871   -V : print version number and exit (with a zero status).
1872 EOM
1873         exit 1
1874         ;;
1875 esac
1876
1877 : Sanity checks
1878 case "$fastread$alldone" in
1879 yescont|yesexit) ;;
1880 *)
1881         case "$extractsh" in
1882         true) ;;
1883         *)
1884                 if test ! -t 0; then
1885                         echo "Say 'sh Configure', not 'sh <Configure'"
1886                         exit 1
1887                 fi
1888                 ;;
1889         esac
1890         ;;
1891 esac
1892
1893 exec 4>&1
1894 case "$silent" in
1895 true) exec 1>/dev/null;;
1896 esac
1897
1898 : run the defines and the undefines, if any, but leave the file out there...
1899 touch optdef.sh
1900 grep '\\' optdef.sh >/dev/null 2>&1
1901 if test $? = 0; then
1902     echo "Configure does not support \\ in -D arguments"
1903     exit 1
1904 fi
1905 . ./optdef.sh
1906 : create the posthint manipulation script and leave the file out there...
1907 touch posthint.sh
1908
1909 : set package name
1910 package='perl5'
1911 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1912 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1913 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1914 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1915 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1916 esac
1917
1918 : Some greps do not return status, grrr.
1919 echo "grimblepritz" >grimble
1920 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1921         contains=contains
1922 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1923         contains=grep
1924 else
1925         contains=contains
1926 fi
1927 rm -f grimble
1928 : the following should work in any shell
1929 case "$contains" in
1930 contains*)
1931         echo " "
1932         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1933         cat >contains <<'EOSS'
1934 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1935 EOSS
1936 chmod +x contains
1937 esac
1938
1939 : Find the path to the source tree
1940 case "$src" in
1941 '') case "$0" in
1942     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1943          case "$src" in
1944          /*)    ;;
1945          .)     ;;
1946          *)     src=`cd ../$src && pwd` ;;
1947          esac
1948          ;;
1949     *)   src='.';;
1950     esac;;
1951 esac
1952 case "$src" in
1953 '')     src=/
1954         rsrc=/
1955         ;;
1956 /*)     rsrc="$src";;
1957 *)      rsrc="../$src";;
1958 esac
1959 if test -f $rsrc/Configure && \
1960         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1961 then
1962    : found it, so we are ok.
1963 else
1964         rsrc=''
1965         for src in . .. ../.. ../../.. ../../../..; do
1966                 if test -f ../$src/Configure && \
1967                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1968                 then
1969                         rsrc=../$src
1970                         break
1971                 fi
1972         done
1973 fi
1974 case "$rsrc" in
1975 '')
1976         cat <<EOM >&4
1977
1978 Sorry, I can't seem to locate the source dir for $package.  Please start
1979 Configure with an explicit path -- i.e. /some/path/Configure.
1980
1981 EOM
1982         exit 1
1983         ;;
1984 ../.)   rsrc='..';;
1985 *)
1986         echo " "
1987         echo "Sources for $package found in \"$src\"." >&4
1988         ;;
1989 esac
1990
1991 : script used to extract .SH files with variable substitutions
1992 cat >extract <<'EOS'
1993 PERL_CONFIG_SH=true
1994 echo "Doing variable substitutions on .SH files..."
1995 if test -f MANIFEST; then
1996         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1997 else
1998         echo "(Looking for .SH files under the source directory.)"
1999         set x `(cd "$src"; find . -name "*.SH" -print)`
2000 fi
2001 shift
2002 case $# in
2003 0) set x `(cd "$src"; echo *.SH)`; shift;;
2004 esac
2005 if test ! -f "$src/$1"; then
2006         shift
2007 fi
2008 mkdir_p='
2009 name=$1;
2010 create="";
2011 while test $name; do
2012         if test ! -d "$name"; then
2013                 create="$name $create";
2014                 name=`echo $name | sed -e "s|^[^/]*$||"`;
2015                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
2016         else
2017                 name="";
2018         fi;
2019 done;
2020 for file in $create; do
2021         mkdir $file;
2022 done
2023 '
2024 for file in $*; do
2025         case "$src" in
2026         ".")
2027                 case "$file" in
2028                 */*)
2029                         dir=`expr X$file : 'X\(.*\)/'`
2030                         file=`expr X$file : 'X.*/\(.*\)'`
2031                         (cd "$dir" && . ./$file)
2032                         ;;
2033                 *)
2034                         . ./$file
2035                         ;;
2036                 esac
2037                 ;;
2038         *)
2039                 case "$file" in
2040                 */*)
2041                         dir=`expr X$file : 'X\(.*\)/'`
2042                         file=`expr X$file : 'X.*/\(.*\)'`
2043                         (set x $dir; shift; eval $mkdir_p)
2044                         sh <"$src/$dir/$file"
2045                         ;;
2046                 *)
2047                         sh <"$src/$file"
2048                         ;;
2049                 esac
2050                 ;;
2051         esac
2052 done
2053 if test -f "$src/config_h.SH"; then
2054         if test ! -f config.h; then
2055         : oops, they left it out of MANIFEST, probably, so do it anyway.
2056         . "$src/config_h.SH"
2057         fi
2058 fi
2059 EOS
2060
2061 : extract files and exit if asked to do so
2062 case "$extractsh" in
2063 true)
2064         case "$realsilent" in
2065         true) ;;
2066         *) exec 1>&4;;
2067         esac
2068         case "$config_sh" in
2069         '') config_sh='config.sh';;
2070         esac
2071         echo " "
2072         echo "Fetching answers from $config_sh..."
2073         cd ..
2074         . $config_sh
2075         . UU/optdef.sh
2076         echo " "
2077         . UU/extract
2078         rm -rf UU
2079         echo "Extraction done."
2080         exit 0
2081         ;;
2082 esac
2083
2084 : Eunice requires " " instead of "", can you believe it
2085 echo " "
2086 : Here we go...
2087 echo "Beginning of configuration questions for $package."
2088
2089 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2090
2091 : first determine how to suppress newline on echo command
2092 echo " "
2093 echo "Checking echo to see how to suppress newlines..."
2094 (echo "hi there\c" ; echo " ") >.echotmp
2095 if $contains c .echotmp >/dev/null 2>&1 ; then
2096         echo "...using -n."
2097         n='-n'
2098         c=''
2099 else
2100         cat <<'EOM'
2101 ...using \c
2102 EOM
2103         n=''
2104         c='\c'
2105 fi
2106 echo $n "The star should be here-->$c"
2107 echo '*'
2108 rm -f .echotmp
2109
2110 : Now test for existence of everything in MANIFEST
2111 echo " "
2112 if test -f "$rsrc/MANIFEST"; then
2113         echo "First let's make sure your kit is complete.  Checking..." >&4
2114         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2115                 (split -l 50 2>/dev/null || split -50)
2116         rm -f missing
2117         tmppwd=`pwd`
2118         for filelist in x??; do
2119                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2120                         >/dev/null 2>>"$tmppwd/missing")
2121         done
2122         if test -s missing; then
2123                 cat missing >&4
2124                 cat >&4 <<'EOM'
2125
2126 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2127
2128 You have the option of continuing the configuration process, despite the
2129 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2130 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2131 and contact the author (perlbug@perl.org).
2132
2133 EOM
2134                 echo $n "Continue? [n] $c" >&4
2135                 read ans
2136                 case "$ans" in
2137                 y*)
2138                         echo "Continuing..." >&4
2139                         rm -f missing
2140                         ;;
2141                 *)
2142                         echo "ABORTING..." >&4
2143                         kill $$
2144                         ;;
2145                 esac
2146         else
2147                 echo "Looks good..."
2148         fi
2149 else
2150         echo "There is no MANIFEST file.  I hope your kit is complete !"
2151 fi
2152 rm -f missing x??
2153
2154 : Find the appropriate value for a newline for tr
2155 if test -n "$DJGPP"; then
2156        trnl='\012'
2157 fi
2158 if test X"$trnl" = X; then
2159         case "`echo foo | tr '\n' x 2>/dev/null`" in
2160         foox) trnl='\n' ;;
2161         esac
2162 fi
2163 if test X"$trnl" = X; then
2164         case "`echo foo | tr '\012' x 2>/dev/null`" in
2165         foox) trnl='\012' ;;
2166         esac
2167 fi
2168 if test X"$trnl" = X; then
2169        case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
2170        fooxy) trnl='\n\r' ;;
2171        esac
2172 fi
2173 if test X"$trnl" = X; then
2174         cat <<EOM >&2
2175
2176 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2177
2178 EOM
2179         exit 1
2180 fi
2181
2182 : compute the number of columns on the terminal for proper question formatting
2183 case "$COLUMNS" in
2184 '') COLUMNS='80';;
2185 esac
2186
2187 : set up the echo used in my read
2188 myecho="case \"\$xxxm\" in
2189 '') echo $n \"\$rp $c\" >&4;;
2190 *) case \"\$rp\" in
2191         '') echo $n \"[\$xxxm] $c\";;
2192         *)
2193                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2194                         echo \"\$rp\" >&4
2195                         echo $n \"[\$xxxm] $c\" >&4
2196                 else
2197                         echo $n \"\$rp [\$xxxm] $c\" >&4
2198                 fi
2199                 ;;
2200         esac;;
2201 esac"
2202
2203 : now set up to do reads with possible shell escape and default assignment
2204 cat <<EOSC >myread
2205 $startsh
2206 xxxm=\$dflt
2207 $myecho
2208 ans='!'
2209 case "\$fastread" in
2210 yes) case "\$dflt" in
2211         '') ;;
2212         *) ans='';
2213                 case "\$silent-\$rp" in
2214                 true-) ;;
2215                 *) echo " " >&4;;
2216                 esac;;
2217         esac;;
2218 *) case "\$silent" in
2219         true) case "\$rp" in
2220                 '') ans='';;
2221                 esac;;
2222         esac;;
2223 esac
2224 while expr "X\$ans" : "X!" >/dev/null; do
2225         read answ
2226         set x \$xxxm
2227         shift
2228         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2229         case  "\$answ" in
2230         "!")
2231                 sh 1>&4
2232                 echo " "
2233                 $myecho
2234                 ;;
2235         !*)
2236                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2237                 shift
2238                 sh 1>&4 -c "\$*"
2239                 echo " "
2240                 $myecho
2241                 ;;
2242         "\$ans")
2243                 case "\$ans" in
2244                 \\&*)
2245                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2246                         shift
2247                         case "\$1" in
2248                         -d)
2249                                 fastread=yes
2250                                 echo "(OK, I'll run with -d after this question.)" >&4
2251                                 ;;
2252                         -*)
2253                                 echo "*** Sorry, \$1 not supported yet." >&4
2254                                 ;;
2255                         esac
2256                         $myecho
2257                         ans=!
2258                         ;;
2259                 esac;;
2260         *)
2261                 case "\$aok" in
2262                 y)
2263                         echo "*** Substitution done -- please confirm."
2264                         xxxm="\$ans"
2265                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2266                         xxxm="\$ans"
2267                         ans=!
2268                         ;;
2269                 *)
2270                         echo "*** Error -- try again."
2271                         ans=!
2272                         ;;
2273                 esac
2274                 $myecho
2275                 ;;
2276         esac
2277         case "\$ans\$xxxm\$nostick" in
2278         '')
2279                 ans=!
2280                 $myecho
2281                 ;;
2282         esac
2283 done
2284 case "\$ans" in
2285 '') ans="\$xxxm";;
2286 esac
2287 EOSC
2288
2289 : create .config dir to save info across Configure sessions
2290 test -d ../.config || mkdir ../.config
2291 cat >../.config/README <<EOF
2292 This directory created by Configure to save information that should
2293 persist across sessions for $package.
2294
2295 You may safely delete it if you wish.
2296 EOF
2297
2298 : See if we are using a devel version and want that
2299 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2300 case "$usedevel" in
2301 $define|true|[yY]*)
2302     usedevel="$define" ;;
2303 *) case "$xversion" in
2304    *[13579])
2305         cat >&4 <<EOH
2306 *** WHOA THERE!!! ***
2307
2308     This is an UNSTABLE DEVELOPMENT release.
2309     The version of this $package distribution is $xversion, that is, odd,
2310     (as opposed to even) and that signifies a development release.
2311     If you want a maintenance release, you want an even-numbered version.
2312
2313     Do ***NOT*** install this into production use.
2314     Data corruption and crashes are possible.
2315
2316     It is most seriously suggested that you do not continue any further
2317     unless you want to help in developing and debugging Perl.
2318
2319     If you *still* want to build perl, you can answer 'y' now,
2320     or pass -Dusedevel to Configure.
2321
2322 EOH
2323         rp='Do you really want to continue?'
2324         dflt='n'
2325         . ./myread
2326         case "$ans" in
2327         [yY]) echo >&4 "Okay, continuing."
2328               usedevel="$define" ;;
2329         *) echo >&4 "Okay, bye."
2330            exit 1
2331            ;;
2332         esac
2333         ;;
2334     esac
2335     usedevel="$undef"
2336     ;;
2337 esac
2338 case "$usedevel" in
2339 $define|true|[yY]*)
2340         case "$versiononly" in
2341         '') versiononly="$define" ;;
2342         esac
2343         case "$installusrbinperl" in
2344         '') installusrbinperl="$undef" ;;
2345         esac
2346         ;;
2347 esac
2348
2349 : general instructions
2350 needman=true
2351 firsttime=true
2352 user=`(logname) 2>/dev/null`
2353 case "$user" in
2354 '') user=`whoami 2>&1`;;
2355 esac
2356 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2357         firsttime=false
2358         echo " "
2359         rp='Would you like to see the instructions?'
2360         dflt=n
2361         . ./myread
2362         case "$ans" in
2363         [yY]*) ;;
2364         *) needman=false;;
2365         esac
2366 fi
2367 if $needman; then
2368         cat <<EOH
2369
2370 This installation shell script will examine your system and ask you questions
2371 to determine how the perl5 package should be installed. If you get
2372 stuck on a question, you may use a ! shell escape to start a subshell or
2373 execute a command.  Many of the questions will have default answers in square
2374 brackets; typing carriage return will give you the default.
2375
2376 On some of the questions which ask for file or directory names you are allowed
2377 to use the ~name construct to specify the login directory belonging to "name",
2378 even if you don't have a shell which knows about that.  Questions where this is
2379 allowed will be marked "(~name ok)".
2380
2381 EOH
2382         rp=''
2383         dflt='Type carriage return to continue'
2384         . ./myread
2385         cat <<'EOH'
2386
2387 The prompter used in this script allows you to use shell variables and
2388 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2389 in the default answer, as if the default line was a set of arguments given to a
2390 script shell.  This means you may also use $* to repeat the whole default line,
2391 so you do not have to re-type everything to add something to the default.
2392
2393 Every time there is a substitution, you will have to confirm.  If there is an
2394 error (e.g. an unmatched backtick), the default answer will remain unchanged
2395 and you will be prompted again.
2396
2397 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2398 the questions and use the computed defaults (or the previous answers if there
2399 was already a config.sh file). Type 'Configure -h' for a list of options.
2400 You may also start interactively and then answer '& -d' at any prompt to turn
2401 on the non-interactive behaviour for the remainder of the execution.
2402
2403 EOH
2404         . ./myread
2405         cat <<EOH
2406
2407 Much effort has been expended to ensure that this shell script will run on any
2408 Unix system.  If despite that it blows up on yours, your best bet is to edit
2409 Configure and run it again.  If you can't run Configure for some reason,
2410 you'll have to generate a config.sh file by hand.  Whatever problems you
2411 have, let me (perlbug@perl.org) know how I blew it.
2412
2413 This installation script affects things in two ways:
2414
2415 1) it may do direct variable substitutions on some of the files included
2416    in this kit.
2417 2) it builds a config.h file for inclusion in C programs.  You may edit
2418    any of these files as the need arises after running this script.
2419
2420 If you make a mistake on a question, there is no easy way to back up to it
2421 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2422 files.  Configure will offer to let you do this before it runs the SH files.
2423
2424 EOH
2425         dflt='Type carriage return to continue'
2426         . ./myread
2427         case "$firsttime" in
2428         true) echo $user >>../.config/instruct;;
2429         esac
2430 fi
2431
2432 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2433 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2434 if test "X$sysroot" = X; then
2435     sysroot=""
2436 else
2437     case "$cc" in
2438         *gcc*|*g++*)
2439             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2440             # _sysroot is used in places where we need --sysroot=foo
2441             # but using the rest of the flags could cause issues.
2442             _sysroot="--sysroot=$sysroot";
2443             case "$ccflags" in
2444                 *sysroot*) ;;
2445                 'undef'|*)
2446                 ccflags="$ccflags $_sysroot"
2447             esac
2448             case "$ldflags" in
2449                 *sysroot*) ;;
2450                 'undef'|*)
2451                 ldflags="$ldflags $_sysroot"
2452             esac
2453             case "$cppflags" in
2454                 *sysroot*) ;;
2455                 'undef'|*)
2456                 cppflags="$cppflags $_sysroot"
2457             esac
2458             # lddlflags updated below in lddlflags section;
2459             # same with cccdlflags
2460             ;;
2461     esac
2462
2463     # Adjust some defaults to also use $sysroot
2464     for var in xlibpth loclibpth locincpth glibpth; do
2465         eval xxx=\$$var
2466         eval $var=''
2467         for path in $xxx; do
2468             eval $var=\"\$$var $sysroot$path\"
2469         done
2470     done
2471
2472 fi
2473
2474 : find out where common programs are
2475 echo " "
2476 echo "Locating common programs..." >&4
2477 cat <<EOSC >loc
2478 $startsh
2479 case \$# in
2480 0) exit 1;;
2481 esac
2482 thing=\$1
2483 shift
2484 dflt=\$1
2485 shift
2486 for dir in \$*; do
2487         case "\$thing" in
2488         .)
2489         if test -d \$dir/\$thing; then
2490                 echo \$dir
2491                 exit 0
2492         fi
2493         ;;
2494         *)
2495         for thisthing in \$dir/\$thing; do
2496                 : just loop through to pick last item
2497         done
2498         if test -f \$thisthing; then
2499                 echo \$thisthing
2500                 exit 0
2501         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2502                 echo \$thisthing
2503                 exit 0
2504         elif test -f \$dir/\$thing.exe; then
2505                 if test -n "$DJGPP"; then
2506                         echo \$dir/\$thing.exe
2507                 elif test "$eunicefix" != ":"; then
2508                         : on Eunice apparently
2509                         echo \$dir/\$thing
2510                 fi
2511                 exit 0
2512         fi
2513         ;;
2514         esac
2515 done
2516 echo \$dflt
2517 exit 1
2518 EOSC
2519 chmod +x loc
2520 $eunicefix loc
2521 loclist="
2522 awk
2523 cat
2524 chmod
2525 comm
2526 cp
2527 echo
2528 expr
2529 grep
2530 ls
2531 mkdir
2532 rm
2533 sed
2534 sort
2535 touch
2536 tr
2537 uniq
2538 "
2539 trylist="
2540 ar
2541 bison
2542 byacc
2543 cpp
2544 csh
2545 date
2546 egrep
2547 gmake
2548 gzip
2549 less
2550 ln
2551 make
2552 more
2553 nm
2554 nroff
2555 perl
2556 pg
2557 test
2558 uname
2559 zip
2560 "
2561 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2562 pth="$pth $sysroot/lib $sysroot/usr/lib"
2563 for file in $loclist; do
2564         eval xxx=\$$file
2565         case "$xxx" in
2566         /*|?:[\\/]*)
2567                 if test -f "$xxx"; then
2568                         : ok
2569                 else
2570                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2571                         xxx=`./loc $file $file $pth`
2572                 fi
2573                 ;;
2574         '') xxx=`./loc $file $file $pth`;;
2575         *) xxx=`./loc $xxx $xxx $pth`;;
2576         esac
2577         eval $file=$xxx$_exe
2578         eval _$file=$xxx
2579         case "$xxx" in
2580         /*)
2581                 echo $file is in $xxx.
2582                 ;;
2583         ?:[\\/]*)
2584                 echo $file is in $xxx.
2585                 ;;
2586         *)
2587                 echo "I don't know where '$file' is, and my life depends on it." >&4
2588                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2589                 exit 1
2590                 ;;
2591         esac
2592 done
2593 echo " "
2594 echo "Don't worry if any of the following aren't found..."
2595 say=offhand
2596 for file in $trylist; do
2597         eval xxx=\$$file
2598         case "$xxx" in
2599         /*|?:[\\/]*)
2600                 if test -f "$xxx"; then
2601                         : ok
2602                 else
2603                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2604                         xxx=`./loc $file $file $pth`
2605                 fi
2606                 ;;
2607         '') xxx=`./loc $file $file $pth`;;
2608         *) xxx=`./loc $xxx $xxx $pth`;;
2609         esac
2610         eval $file=$xxx$_exe
2611         eval _$file=$xxx
2612         case "$xxx" in
2613         /*)
2614                 echo $file is in $xxx.
2615                 ;;
2616         ?:[\\/]*)
2617                 echo $file is in $xxx.
2618                 ;;
2619         *)
2620                 echo "I don't see $file out there, $say."
2621                 say=either
2622                 ;;
2623         esac
2624 done
2625 case "$egrep" in
2626 egrep)
2627         echo "Substituting grep for egrep."
2628         egrep=$grep
2629         _egrep=$grep
2630         ;;
2631 esac
2632 case "$less" in
2633 '')     ;;
2634 *)      if $less -R </dev/null >/dev/null 2>&1; then
2635                echo "Substituting less -R for less."
2636                less="$less -R"
2637                _less=$less
2638         fi
2639         ;;
2640 esac
2641 case "$ln" in
2642 ln)
2643         echo "Substituting cp for ln."
2644         ln=$cp
2645         _ln=$cp
2646         ;;
2647 esac
2648 case "$make" in
2649 make)
2650         case "$gmake" in
2651         gmake)
2652         echo "I can't find make or gmake, and my life depends on it." >&4
2653         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2654         exit 1
2655         ;;
2656         esac
2657         ;;
2658 esac
2659 case "$gmake" in
2660 gmake)  ;;
2661 *)      # We can't have osname yet.
2662         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2663                 # Assume that gmake, if found, is definitely GNU make
2664                 # and prefer it over the system make.
2665                 echo "Substituting gmake for make."
2666                 make=$gmake
2667                 _make=$gmake
2668         fi
2669         ;;
2670 esac
2671 case "$test" in
2672 test)
2673         echo "Hopefully test is built into your sh."
2674         ;;
2675 *)
2676         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2677                 echo "Using the test built into your sh."
2678                 test=test
2679                 _test=test
2680         fi
2681         ;;
2682 esac
2683 case "$echo" in
2684 echo)
2685         echo "Hopefully echo is built into your sh."
2686         ;;
2687 '') ;;
2688 *)
2689         echo " "
2690 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2691         $echo $n "hi there$c" >foo1
2692         echo $n "hi there$c" >foo2
2693         if cmp foo1 foo2 >/dev/null 2>&1; then
2694                 echo "They are compatible.  In fact, they may be identical."
2695         else
2696                 case "$n" in
2697                 '-n') n='' c='\c';;
2698                 *) n='-n' c='';;
2699                 esac
2700                 cat <<FOO
2701 They are not compatible!  You are probably running ksh on a non-USG system.
2702 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2703 have echo built in and we may have to run some Bourne shell scripts.  That
2704 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2705
2706 FOO
2707                 $echo $n "The star should be here-->$c"
2708                 $echo "*"
2709         fi
2710         $rm -f foo1 foo2
2711         ;;
2712 esac
2713
2714 # This question was auctioned at YAPC::Europe-2007 in Vienna
2715 # I never promised you could answer it. I only auctioned the question.
2716 cat <<FOO
2717 The following message is sponsored by
2718
2719   Dresden.pm<--The stars should be here.
2720
2721 Dear Perl user, system administrator or package
2722 maintainer, the Perl community sends greetings to
2723 you. Do you (emblematical) greet back [Y/n]? n
2724
2725 FOO
2726
2727 : Check what type of C compiler we use
2728 cat <<EOS >trygcc
2729 $startsh
2730 EOS
2731 cat <<'EOSC' >>trygcc
2732 case "$cc" in
2733 '') ;;
2734 *)  $rm -f try try.*
2735     $cat >try.c <<EOM
2736 int main(int argc, char *argv[]) {
2737   return 0;
2738 }
2739 EOM
2740     if $cc -o try $ccflags $ldflags try.c; then
2741        :
2742     else
2743         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2744         despair=yes
2745         trygcc=yes
2746         case "$cc" in
2747         *gcc*) trygcc=no ;;
2748         esac
2749         # Skip this test because it gives a false match on output like:
2750         #    ./trygcc: line 23: cc: command not found
2751         # case "`$cc -v -c try.c 2>&1`" in
2752         # *gcc*) trygcc=no ;;
2753         # esac
2754         if $test X"$trygcc" = Xyes; then
2755             if gcc -o try -c try.c; then
2756                 echo " "
2757                 echo "You seem to have a working gcc, though." >&4
2758                 # Switching compilers may undo the work of hints files.
2759                 # The most common problem is -D_REENTRANT for threads.
2760                 # This heuristic catches that case, but gets false positives
2761                 # if -Dusethreads was not actually specified.  Better to
2762                 # bail out here with a useful message than fail
2763                 # mysteriously later. Should we perhaps just try to
2764                 # re-invoke Configure -Dcc=gcc config_args ?
2765                 if $test -f usethreads.cbu; then
2766                         $cat >&4 <<EOM
2767
2768 *** However, any setting of the C compiler flags (e.g. for thread support)
2769 *** will be lost.  It may be necessary for you to restart Configure and
2770 *** add -Dcc=gcc to your Configure command line.
2771
2772 EOM
2773                         rp="Would you like to go ahead and try gcc anyway?"
2774                         dflt=n
2775                 else
2776                         rp="Would you like to use it?"
2777                         dflt=y
2778                 fi
2779                 if $test -f myread; then
2780                     . ./myread
2781                 else
2782                     if $test -f UU/myread; then
2783                         . ./UU/myread
2784                     else
2785                         echo "Cannot find myread, sorry.  Aborting." >&2
2786                         exit 1
2787                     fi
2788                 fi
2789                 case "$ans" in
2790                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2791                 esac
2792             fi
2793         fi
2794     fi
2795     $rm -f try try.*
2796     ;;
2797 esac
2798 EOSC
2799
2800 cat <<EOS >checkcc
2801 $startsh
2802 EOS
2803 cat <<'EOSC' >>checkcc
2804 case "$cc" in
2805 '') ;;
2806 *)  $rm -f try try.*
2807     $cat >try.c <<EOM
2808 int main(int argc, char *argv[]) {
2809   return 0;
2810 }
2811 EOM
2812     if $cc -o try $ccflags $ldflags try.c; then
2813        :
2814     else
2815         if $test X"$despair" = Xyes; then
2816            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2817         fi
2818         $cat >&4 <<EOM
2819 You need to find a working C compiler.
2820 Either (purchase and) install the C compiler supplied by your OS vendor,
2821 or for a free C compiler try http://gcc.gnu.org/
2822 I cannot continue any further, aborting.
2823 EOM
2824         exit 1
2825     fi
2826     $rm -f try try.*
2827     ;;
2828 esac
2829 EOSC
2830
2831 : determine whether symbolic links are supported
2832 echo " "
2833 $touch blurfl
2834 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2835         echo "Symbolic links are supported." >&4
2836         lns="$ln -s"
2837 else
2838         echo "Symbolic links are NOT supported." >&4
2839         lns="$ln"
2840 fi
2841 $rm -f blurfl sym
2842
2843 : determine whether symbolic links are supported
2844 echo " "
2845 case "$lns" in
2846 *"ln"*" -s")
2847         echo "Checking how to test for symbolic links..." >&4
2848         $lns blurfl sym
2849         if $test "X$issymlink" = X; then
2850                 case "$newsh" in
2851                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2852                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2853                 esac
2854                 if test $? = 0; then
2855                         issymlink="test -h"
2856                 else
2857                         echo "Your builtin 'test -h' may be broken." >&4
2858                         case "$test" in
2859                         /*)     ;;
2860                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2861                                 for p in $pth
2862                                 do
2863                                         if test -f "$p/$test"; then
2864                                                 test="$p/$test"
2865                                                 break
2866                                         fi
2867                                 done
2868                                 ;;
2869                         esac
2870                         case "$test" in
2871                         /*)
2872                                 echo "Trying external '$test -h'." >&4
2873                                 issymlink="$test -h"
2874                                 if $test ! -h sym >/dev/null 2>&1; then
2875                                         echo "External '$test -h' is broken, too." >&4
2876                                         issymlink=''
2877                                 fi
2878                                 ;;
2879                         *)      issymlink='' ;;
2880                         esac
2881                 fi
2882         fi
2883         if $test "X$issymlink" = X; then
2884                 if $test -L sym 2>/dev/null; then
2885                         issymlink="$test -L"
2886                         echo "The builtin '$test -L' worked." >&4
2887                 fi
2888         fi
2889         if $test "X$issymlink" != X; then
2890                 echo "You can test for symbolic links with '$issymlink'." >&4
2891         else
2892                 echo "I do not know how you can test for symbolic links." >&4
2893         fi
2894         $rm -f blurfl sym
2895         ;;
2896 *)      echo "No symbolic links, so not testing for their testing..." >&4
2897         ;;
2898 esac
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, const char *where) {
17117     void *v = &d;
17118     unsigned char *p = (unsigned char *)v;
17119     unsigned char *end = p + sizeof(d);
17120     int fail = 0;
17121
17122     while (p < end)
17123         fail += *p++;
17124
17125     if (!fail)
17126         return 0;
17127
17128     p = (unsigned char *)v;
17129     printf("No - %s: 0x", where);
17130     while (p < end)
17131         printf ("%02X", *p++);
17132     printf("\n");
17133     return 1;
17134 }
17135
17136 int main(int argc, char **argv) {
17137     $nvtype d = 0.0;
17138     int fail = 0;
17139     fail += checkit(d, "0.0");
17140
17141     /* The compiler shouldn't be assuming that bletched is 0  */
17142     d = bletched;
17143
17144     fail += checkit(d, "bleched");
17145
17146 #ifdef SIGFPE
17147     signal(SIGFPE, blech);
17148 #endif
17149
17150     /* Paranoia - the compiler should have no way of knowing that ANSI says
17151        that argv[argc] will always be NULL.  Actually, if it did assume this it
17152        would be buggy, as this is C and main() can be called from elsewhere in
17153        the program.  */
17154     d = argv[argc] ? 1 : 0;
17155
17156     if (d) {
17157         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
17158     }
17159
17160     fail += checkit(d, "ternary");
17161
17162     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
17163
17164     if (d != 0.0) {
17165         printf("No - memset doesn't give 0.0\n");
17166         /* This might just blow up:  */
17167         printf("(gives %g)\n", d);
17168         return 1;
17169     }
17170
17171 #ifdef SIGFPE
17172     if (bletched) {
17173         printf("No - something bleched\n");
17174         return 1;
17175     }
17176 #endif
17177     if (fail) {
17178       printf("No - %d fail(s)\n", fail);
17179       return 1;
17180     }
17181     printf("Yes\n");
17182     return 0;
17183 }
17184 EOP
17185 set try
17186
17187 d_nv_zero_is_allbits_zero="$undef"
17188 if eval $compile; then
17189     xxx="`$run ./try`"
17190     case "$?" in
17191         0)
17192             case "$xxx" in
17193                 Yes)  cat >&4 <<EOM
17194 0.0 is represented as all bits zero in memory
17195 EOM
17196                     d_nv_zero_is_allbits_zero="$define"
17197                     ;;
17198                 *)  cat >&4 <<EOM
17199 0.0 is not represented as all bits zero in memory
17200 EOM
17201                     d_nv_zero_is_allbits_zero="$undef"
17202                     ;;
17203             esac
17204             ;;
17205         *)  cat >&4 <<EOM
17206 0.0 is not represented as all bits zero in memory
17207 EOM
17208             d_nv_zero_is_allbits_zero="$undef"
17209             ;;
17210     esac
17211 fi
17212 $rm_try
17213
17214 : check for off64_t
17215 echo " "
17216 echo "Checking to see if you have off64_t..." >&4
17217 $cat >try.c <<EOCP
17218 #include <sys/types.h>
17219 #include <unistd.h>
17220 int main() { off64_t x = 7; }
17221 EOCP
17222 set try
17223 if eval $compile; then
17224         val="$define"
17225         echo "You have off64_t."
17226 else
17227         val="$undef"
17228         echo "You do not have off64_t."
17229         case "$lseeksize" in
17230         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
17231         esac
17232 fi
17233 $rm_try
17234 set d_off64_t
17235 eval $setvar
17236
17237 : how to create joinable pthreads
17238 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
17239         echo " "
17240         echo "Checking what constant to use for creating joinable pthreads..." >&4
17241         $cat >try.c <<'EOCP'
17242 #include <pthread.h>
17243 int main() {
17244     int detachstate = JOINABLE;
17245 }
17246 EOCP
17247         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
17248         if eval $compile; then
17249                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
17250                 val="$undef" # Yes, undef.
17251                 set d_old_pthread_create_joinable
17252                 eval $setvar
17253                 val=""
17254                 set old_pthread_create_joinable
17255                 eval $setvar
17256         else
17257                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
17258                 if eval $compile; then
17259                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
17260                         val="$define"
17261                         set d_old_pthread_create_joinable
17262                         eval $setvar
17263                         val=PTHREAD_CREATE_UNDETACHED
17264                         set old_pthread_create_joinable
17265                         eval $setvar
17266                 else
17267                         set try -DJOINABLE=__UNDETACHED
17268                         if eval $compile; then
17269                                 echo "You seem to use __UNDETACHED." >&4
17270                                 val="$define"
17271                                 set d_old_pthread_create_joinable
17272                                 eval $setvar
17273                                 val=__UNDETACHED
17274                                 set old_pthread_create_joinable
17275                                 eval $setvar
17276                         else
17277                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
17278                                 val="$define"
17279                                 set d_old_pthread_create_joinable
17280                                 eval $setvar
17281                                 val=0
17282                                 set old_pthread_create_joinable
17283                                 eval $setvar
17284                         fi
17285                 fi
17286         fi
17287         $rm_try
17288 else
17289     d_old_pthread_create_joinable="$undef"
17290     old_pthread_create_joinable=""
17291 fi
17292
17293 : see if pause exists
17294 set pause d_pause
17295 eval $inlibc
17296
17297 : see if poll exists
17298 set poll d_poll
17299 eval $inlibc
17300
17301 : see if prctl exists
17302 set prctl d_prctl
17303 eval $inlibc
17304
17305 : see if prctl supports PR_SET_NAME
17306 d_prctl_set_name=$undef
17307 case $d_prctl in
17308     $define)
17309         $cat >try.c <<EOM
17310 #ifdef __ANDROID__
17311 #include <unistd.h>
17312 #endif
17313 #include <sys/prctl.h>
17314
17315 int main (int argc, char *argv[])
17316 {
17317     return (prctl (PR_SET_NAME, "Test"));
17318     } /* main */
17319 EOM
17320         set try
17321         if eval $compile_ok && $run ./try; then
17322             echo "Your prctl (PR_SET_NAME, ...) works"
17323             d_prctl_set_name=$define
17324             fi
17325         $rm_try
17326         ;;
17327     esac
17328
17329 : see if readlink exists
17330 set readlink d_readlink
17331 eval $inlibc
17332
17333 : Check if there is a /proc symlink to the abs path of
17334 : the executing program.  We will honor hints of d_procselfexe=$undef
17335 : or procselfexe being non-empty, otherwise will try to determine both
17336 : if we have readlink.
17337 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
17338 : referenced, and AmigaOS does not have a proc filesystem anyway.
17339 echo " "
17340 val="$undef"
17341 if $test "X$d_procselfexe" = Xundef; then
17342         procselfexe=''
17343 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
17344         val="$define"
17345 elif $test "X$d_readlink" = Xdefine; then
17346         : NetBSD first as /proc/self is a symlink to /proc/curproc,
17347         : and it feels more tidy to avoid an extra level of symlink
17348         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17349         while test $# -gt 0; do
17350             type=$1; try=$2
17351             shift; shift
17352             if $issymlink $try; then
17353                 $ls -l $try > reflect
17354                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17355                     echo "You have $type-like $try."
17356                     procselfexe='"'$try'"'
17357                     val="$define"
17358                     : This will break out of the loop
17359                     set X; shift
17360                 fi
17361             fi
17362         done
17363 fi
17364 $rm -f reflect
17365 set d_procselfexe
17366 eval $setvar
17367
17368 : backward compatibility for d_hvfork
17369 if test X$d_hvfork != X; then
17370         d_vfork="$d_hvfork"
17371         d_hvfork=''
17372 fi
17373 : see if there is a vfork
17374 val=''
17375 set vfork val
17376 eval $inlibc
17377
17378 d_pseudofork=$undef
17379
17380 : Ok, but do we want to use it. vfork is reportedly unreliable in
17381 : perl on Solaris 2.x, and probably elsewhere.
17382 case "$val" in
17383 $define)
17384         echo " "
17385         case "$usevfork" in
17386         false) dflt='n';;
17387         *) dflt='y';;
17388         esac
17389         cat <<'EOM'
17390
17391 Perl can only use a vfork() that doesn't suffer from strict
17392 restrictions on calling functions or modifying global data in
17393 the child.  For example, glibc-2.1 contains such a vfork()
17394 that is unsuitable.  If your system provides a proper fork()
17395 call, chances are that you do NOT want perl to use vfork().
17396
17397 EOM
17398         rp="Do you still want to use vfork()?"
17399         . ./myread
17400         case "$ans" in
17401         y|Y) ;;
17402         *)
17403                 echo "Ok, we won't use vfork()."
17404                 val="$undef"
17405                 ;;
17406         esac
17407         ;;
17408 esac
17409 set d_vfork
17410 eval $setvar
17411 case "$d_vfork" in
17412 $define) usevfork='true';;
17413 *) usevfork='false';;
17414 esac
17415
17416 : see whether the pthread_atfork exists
17417 $cat >try.c <<EOP
17418 #include <pthread.h>
17419 #include <stdio.h>
17420 int main() {
17421 #ifdef  PTHREAD_ATFORK
17422         pthread_atfork(NULL,NULL,NULL);
17423 #endif
17424 }
17425 EOP
17426
17427 : see if pthread_atfork exists
17428 set try -DPTHREAD_ATFORK
17429 if eval $compile; then
17430     val="$define"
17431 else
17432     val="$undef"
17433 fi
17434 case "$usethreads" in
17435 $define)
17436         case "$val" in
17437         $define) echo 'pthread_atfork found.' >&4        ;;
17438         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17439         esac
17440 esac
17441 set d_pthread_atfork
17442 eval $setvar
17443
17444 : see if pthread_attr_setscope exists
17445 set pthread_attr_setscope d_pthread_attr_setscope
17446 eval $inlibc
17447
17448 : see whether the various POSIXish _yields exist
17449 $cat >try.c <<EOP
17450 #include <pthread.h>
17451 #include <stdio.h>
17452 int main() {
17453 #ifdef SCHED_YIELD
17454         sched_yield();
17455 #else
17456 #ifdef PTHREAD_YIELD
17457         pthread_yield();
17458 #else
17459 #ifdef PTHREAD_YIELD_NULL
17460         pthread_yield(NULL);
17461 #endif
17462 #endif
17463 #endif
17464 }
17465 EOP
17466 : see if sched_yield exists
17467 set try -DSCHED_YIELD
17468 if eval $compile; then
17469     val="$define"
17470     sched_yield='sched_yield()'
17471 else
17472     val="$undef"
17473 fi
17474 case "$usethreads" in
17475 $define)
17476         case "$val" in
17477         $define) echo 'sched_yield() found.' >&4        ;;
17478         *)       echo 'sched_yield() NOT found.' >&4    ;;
17479         esac
17480 esac
17481 set d_sched_yield
17482 eval $setvar
17483
17484 : see if pthread_yield exists
17485 set try -DPTHREAD_YIELD
17486 if eval $compile; then
17487     val="$define"
17488     case "$sched_yield" in
17489     '') sched_yield='pthread_yield()' ;;
17490     esac
17491 else
17492     set try -DPTHREAD_YIELD_NULL
17493     if eval $compile; then
17494         val="$define"
17495         case "$sched_yield" in
17496         '') sched_yield='pthread_yield(NULL)' ;;
17497         esac
17498     else
17499         val="$undef"
17500     fi
17501 fi
17502 case "$usethreads" in
17503 $define)
17504         case "$val" in
17505         $define) echo 'pthread_yield() found.' >&4      ;;
17506         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17507         esac
17508         ;;
17509 esac
17510 set d_pthread_yield
17511 eval $setvar
17512 case "$sched_yield" in
17513 '') sched_yield=undef ;;
17514 esac
17515 $rm_try
17516
17517 : check for ptrdiff_t
17518 echo " "
17519 echo "Checking to see if you have ptrdiff_t..." >&4
17520 $cat >try.c <<EOCP
17521 #include <stddef.h>
17522 int main() { ptrdiff_t x = 7; }
17523 EOCP
17524 set try
17525 if eval $compile; then
17526         val="$define"
17527         echo "You have ptrdiff_t."
17528 else
17529         val="$undef"
17530         echo "You do not have ptrdiff_t."
17531 fi
17532 $rm_try
17533 set d_ptrdiff_t
17534 eval $setvar
17535
17536 : see if random_r exists
17537 set random_r d_random_r
17538 eval $inlibc
17539 case "$d_random_r" in
17540 "$define")
17541         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17542         case "$d_random_r_proto:$usethreads" in
17543         ":define")      d_random_r_proto=define
17544                 set d_random_r_proto random_r $hdrs
17545                 eval $hasproto ;;
17546         *)      ;;
17547         esac
17548         case "$d_random_r_proto" in
17549         define)
17550         case "$random_r_proto" in
17551         ''|0) try='int random_r(int*, struct random_data*);'
17552         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17553         esac
17554         case "$random_r_proto" in
17555         ''|0) try='int random_r(long*, struct random_data*);'
17556         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17557         esac
17558         case "$random_r_proto" in
17559         ''|0) try='int random_r(struct random_data*, int32_t*);'
17560         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17561         esac
17562         case "$random_r_proto" in
17563         ''|0)   d_random_r=undef
17564                 random_r_proto=0
17565                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17566         * )     case "$random_r_proto" in
17567                 REENTRANT_PROTO*) ;;
17568                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17569                 esac
17570                 echo "Prototype: $try" ;;
17571         esac
17572         ;;
17573         *)      case "$usethreads" in
17574                 define) echo "random_r has no prototype, not using it." >&4 ;;
17575                 esac
17576                 d_random_r=undef
17577                 random_r_proto=0
17578                 ;;
17579         esac
17580         ;;
17581 *)      random_r_proto=0
17582         ;;
17583 esac
17584
17585 : see if readdir and friends exist
17586 set readdir d_readdir
17587 eval $inlibc
17588 set seekdir d_seekdir
17589 eval $inlibc
17590 set telldir d_telldir
17591 eval $inlibc
17592 set rewinddir d_rewinddir
17593 eval $inlibc
17594
17595 : see if readdir64_r exists
17596 set readdir64_r d_readdir64_r
17597 eval $inlibc
17598 case "$d_readdir64_r" in
17599 "$define")
17600         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17601         case "$d_readdir64_r_proto:$usethreads" in
17602         ":define")      d_readdir64_r_proto=define
17603                 set d_readdir64_r_proto readdir64_r $hdrs
17604                 eval $hasproto ;;
17605         *)      ;;
17606         esac
17607         case "$d_readdir64_r_proto" in
17608         define)
17609         case "$readdir64_r_proto" in
17610         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17611         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17612         esac
17613         case "$readdir64_r_proto" in
17614         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17615         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17616         esac
17617         case "$readdir64_r_proto" in
17618         ''|0)   d_readdir64_r=undef
17619                 readdir64_r_proto=0
17620                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17621         * )     case "$readdir64_r_proto" in
17622                 REENTRANT_PROTO*) ;;
17623                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17624                 esac
17625                 echo "Prototype: $try" ;;
17626         esac
17627         ;;
17628         *)      case "$usethreads" in
17629                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17630                 esac
17631                 d_readdir64_r=undef
17632                 readdir64_r_proto=0
17633                 ;;
17634         esac
17635         ;;
17636 *)      readdir64_r_proto=0
17637         ;;
17638 esac
17639
17640 : see if readdir_r exists
17641 set readdir_r d_readdir_r
17642 eval $inlibc
17643 case "$d_readdir_r" in
17644 "$define")
17645         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17646         case "$d_readdir_r_proto:$usethreads" in
17647         ":define")      d_readdir_r_proto=define
17648                 set d_readdir_r_proto readdir_r $hdrs
17649                 eval $hasproto ;;
17650         *)      ;;
17651         esac
17652         case "$d_readdir_r_proto" in
17653         define)
17654         case "$readdir_r_proto" in
17655         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17656         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17657         esac
17658         case "$readdir_r_proto" in
17659         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17660         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17661         esac
17662         case "$readdir_r_proto" in
17663         ''|0)   d_readdir_r=undef
17664                 readdir_r_proto=0
17665                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17666         * )     case "$readdir_r_proto" in
17667                 REENTRANT_PROTO*) ;;
17668                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17669                 esac
17670                 echo "Prototype: $try" ;;
17671         esac
17672         ;;
17673         *)      case "$usethreads" in
17674                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17675                 esac
17676                 d_readdir_r=undef
17677                 readdir_r_proto=0
17678                 ;;
17679         esac
17680         ;;
17681 *)      readdir_r_proto=0
17682         ;;
17683 esac
17684
17685 : see if readv exists
17686 set readv d_readv
17687 eval $inlibc
17688
17689 : see if recvmsg exists
17690 set recvmsg d_recvmsg
17691 eval $inlibc
17692
17693 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17694 echo " "
17695 if set regcomp val -f d_regcomp; eval $csym; $val; then
17696         echo 'regcomp() found.' >&4
17697         d_regcomp="$define"
17698         d_regcmp="$undef"
17699         d_re_comp="$undef"
17700 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17701         echo 'regcmp() found.' >&4
17702         d_regcmp="$define"
17703         d_regcomp="$undef"
17704         d_re_comp="$undef"
17705 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17706         echo 're_comp() found, assuming re_exec() also exists.' >&4
17707         d_re_comp="$define"
17708         d_regcomp="$undef"
17709         d_regcmp="$undef"
17710 else
17711         $cat >&4 <<EOM
17712 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17713 EOM
17714         d_regcmp="$undef"
17715         d_re_comp="$undef"
17716         d_regcomp="$undef"
17717 fi
17718
17719 : see if remainder exists
17720 set remainder d_remainder
17721 eval $inlibc
17722
17723 : see if remquo exists
17724 set remquo d_remquo
17725 eval $inlibc
17726
17727 : see if rename exists
17728 set rename d_rename
17729 eval $inlibc
17730
17731 : see if rint exists
17732 set rint d_rint
17733 eval $inlibc
17734
17735 : see if rmdir exists
17736 set rmdir d_rmdir
17737 eval $inlibc
17738
17739 : see if round exists
17740 set round d_round
17741 eval $inlibc
17742
17743 : see if memory.h is available.
17744 val=''
17745 set memory.h val
17746 eval $inhdr
17747
17748 : See if it conflicts with string.h
17749 case "$val" in
17750 $define)
17751         case "$strings" in
17752         '') ;;
17753         *)
17754                 $cppstdin $cppflags $cppminus < $strings > mem.h
17755                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
17756                         echo " "
17757                         echo "We won't be including <memory.h>."
17758                         val="$undef"
17759                 fi
17760                 $rm -f mem.h
17761                 ;;
17762         esac
17763 esac
17764 set i_memory
17765 eval $setvar
17766
17767 : can bcopy handle overlapping blocks?
17768 echo " "
17769 val="$undef"
17770 case "$d_memmove" in
17771 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
17772 *)      case "$d_bcopy" in
17773         "$define")
17774                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
17775                 $cat >try.c <<EOCP
17776 #$i_memory I_MEMORY
17777 #$i_stdlib I_STDLIB
17778 #$i_string I_STRING
17779 #$i_unistd I_UNISTD
17780 EOCP
17781         $cat >>try.c <<'EOCP'
17782 #include <stdio.h>
17783 #ifdef I_MEMORY
17784 #  include <memory.h>
17785 #endif
17786 #ifdef I_STDLIB
17787 #  include <stdlib.h>
17788 #endif
17789 #ifdef I_STRING
17790 #  include <string.h>
17791 #else
17792 #  include <strings.h>
17793 #endif
17794 #ifdef I_UNISTD
17795 #  include <unistd.h>  /* Needed for NetBSD */
17796 #endif
17797 int main()
17798 {
17799 char buf[128], abc[128];
17800 char *b;
17801 int len;
17802 int off;
17803 int align;
17804
17805 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17806    try to store the string in read-only memory. */
17807 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
17808
17809 for (align = 7; align >= 0; align--) {
17810         for (len = 36; len; len--) {
17811                 b = buf+align;
17812                 bcopy(abc, b, len);
17813                 for (off = 1; off <= len; off++) {
17814                         bcopy(b, b+off, len);
17815                         bcopy(b+off, b, len);
17816                         if (bcmp(b, abc, len))
17817                                 exit(1);
17818                 }
17819         }
17820 }
17821 exit(0);
17822 }
17823 EOCP
17824                 set try
17825                 if eval $compile_ok; then
17826                         if $run ./try 2>/dev/null; then
17827                                 echo "Yes, it can."
17828                                 val="$define"
17829                         else
17830                                 echo "It can't, sorry."
17831                         fi
17832                 else
17833                         echo "(I can't compile the test program, so we'll assume not...)"
17834                 fi
17835                 ;;
17836         esac
17837         $rm_try
17838         ;;
17839 esac
17840 set d_safebcpy
17841 eval $setvar
17842
17843 : can memcpy handle overlapping blocks?
17844 echo " "
17845 val="$undef"
17846 case "$d_memmove" in
17847 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
17848 *)      case "$d_memcpy" in
17849         "$define")
17850                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
17851                 $cat >try.c <<EOCP
17852 #$i_memory I_MEMORY
17853 #$i_stdlib I_STDLIB
17854 #$i_string I_STRING
17855 #$i_unistd I_UNISTD
17856 EOCP
17857         $cat >>try.c <<'EOCP'
17858 #include <stdio.h>
17859 #ifdef I_MEMORY
17860 #  include <memory.h>
17861 #endif
17862 #ifdef I_STDLIB
17863 #  include <stdlib.h>
17864 #endif
17865 #ifdef I_STRING
17866 #  include <string.h>
17867 #else
17868 #  include <strings.h>
17869 #endif
17870 #ifdef I_UNISTD
17871 #  include <unistd.h>  /* Needed for NetBSD */
17872 #endif
17873 int main()
17874 {
17875 char buf[128], abc[128];
17876 char *b;
17877 int len;
17878 int off;
17879 int align;
17880
17881 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17882    try to store the string in read-only memory. */
17883 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
17884
17885 for (align = 7; align >= 0; align--) {
17886         for (len = 36; len; len--) {
17887                 b = buf+align;
17888                 memcpy(b, abc, len);
17889                 for (off = 1; off <= len; off++) {
17890                         memcpy(b+off, b, len);
17891                         memcpy(b, b+off, len);
17892                         if (memcmp(b, abc, len))
17893                                 exit(1);
17894                 }
17895         }
17896 }
17897 exit(0);
17898 }
17899 EOCP
17900                 set try
17901                 if eval $compile_ok; then
17902                         if $run ./try 2>/dev/null; then
17903                                 echo "Yes, it can."
17904                                 val="$define"
17905                         else
17906                                 echo "It can't, sorry."
17907                         fi
17908                 else
17909                         echo "(I can't compile the test program, so we'll assume not...)"
17910                 fi
17911                 ;;
17912         esac
17913         $rm_try
17914         ;;
17915 esac
17916 set d_safemcpy
17917 eval $setvar
17918
17919 : can memcmp be trusted to compare relative magnitude?
17920 val="$undef"
17921 case "$d_memcmp" in
17922 "$define")
17923         echo " "
17924         echo "Checking if your memcmp() can compare relative magnitude..." >&4
17925         $cat >try.c <<EOCP
17926 #$i_memory I_MEMORY
17927 #$i_stdlib I_STDLIB
17928 #$i_string I_STRING
17929 #$i_unistd I_UNISTD
17930 EOCP
17931         $cat >>try.c <<'EOCP'
17932 #include <stdio.h>
17933 #ifdef I_MEMORY
17934 #  include <memory.h>
17935 #endif
17936 #ifdef I_STDLIB
17937 #  include <stdlib.h>
17938 #endif
17939 #ifdef I_STRING
17940 #  include <string.h>
17941 #else
17942 #  include <strings.h>
17943 #endif
17944 #ifdef I_UNISTD
17945 #  include <unistd.h>  /* Needed for NetBSD */
17946 #endif
17947 int main()
17948 {
17949 char a = -1;
17950 char b = 0;
17951 if ((a < b) && memcmp(&a, &b, 1) < 0)
17952         exit(1);
17953 exit(0);
17954 }
17955 EOCP
17956         set try
17957         if eval $compile_ok; then
17958                 if $run ./try 2>/dev/null; then
17959                         echo "Yes, it can."
17960                         val="$define"
17961                 else
17962                         echo "No, it can't (it uses signed chars)."
17963                 fi
17964         else
17965                 echo "(I can't compile the test program, so we'll assume not...)"
17966         fi
17967         ;;
17968 esac
17969 $rm_try
17970 set d_sanemcmp
17971 eval $setvar
17972
17973 : see if prototype for sbrk is available
17974 echo " "
17975 set d_sbrkproto sbrk $i_unistd unistd.h
17976 eval $hasproto
17977
17978 : see if scalbn exists
17979 set scalbn d_scalbn
17980 eval $inlibc
17981
17982 : see if select exists
17983 set select d_select
17984 eval $inlibc
17985
17986 : see if semctl exists
17987 set semctl d_semctl
17988 eval $inlibc
17989
17990 : see if semget exists
17991 set semget d_semget
17992 eval $inlibc
17993
17994 : see if semop exists
17995 set semop d_semop
17996 eval $inlibc
17997
17998 : see how much of the 'sem*(2)' library is present.
17999 h_sem=true
18000 echo " "
18001 case "$d_semctl$d_semget$d_semop" in
18002 *"$undef"*) h_sem=false;;
18003 esac
18004 case "$osname" in
18005 freebsd)
18006     case "`ipcs 2>&1`" in
18007     "SVID messages"*"not configured"*)
18008         echo "Your $osname does not have the sem*(2) configured." >&4
18009         h_sem=false
18010         val="$undef"
18011         set semctl d_semctl
18012         eval $setvar
18013         set semget d_semget
18014         eval $setvar
18015         set semop d_semop
18016         eval $setvar
18017         ;;
18018     esac
18019     ;;
18020 esac
18021 : we could also check for sys/ipc.h ...
18022 if $h_sem && $test `./findhdr sys/sem.h`; then
18023         echo "You have the full sem*(2) library." >&4
18024         val="$define"
18025 else
18026         echo "You don't have the full sem*(2) library." >&4
18027         val="$undef"
18028 fi
18029 set d_sem
18030 eval $setvar
18031
18032 : see whether sys/sem.h defines union semun
18033 echo " "
18034 $cat > try.c <<'END'
18035 #include <sys/types.h>
18036 #include <sys/ipc.h>
18037 #include <sys/sem.h>
18038 int main () { union semun semun; semun.buf = 0; }
18039 END
18040 set try
18041 if eval $compile; then
18042     echo "You have union semun in <sys/sem.h>." >&4
18043     val="$define"
18044 else
18045     echo "You do not have union semun in <sys/sem.h>." >&4
18046     val="$undef"
18047 fi
18048 $rm_try
18049 set d_union_semun
18050 eval $setvar
18051
18052 : see how to do semctl IPC_STAT
18053 case "$d_sem" in
18054 $define)
18055     echo " "
18056     $cat > tryh.h <<END
18057 #ifndef S_IRUSR
18058 #   ifdef S_IREAD
18059 #       define S_IRUSR S_IREAD
18060 #       define S_IWUSR S_IWRITE
18061 #       define S_IXUSR S_IEXEC
18062 #   else
18063 #       define S_IRUSR 0400
18064 #       define S_IWUSR 0200
18065 #       define S_IXUSR 0100
18066 #   endif
18067 #   define S_IRGRP (S_IRUSR>>3)
18068 #   define S_IWGRP (S_IWUSR>>3)
18069 #   define S_IXGRP (S_IXUSR>>3)
18070 #   define S_IROTH (S_IRUSR>>6)
18071 #   define S_IWOTH (S_IWUSR>>6)
18072 #   define S_IXOTH (S_IXUSR>>6)
18073 #endif
18074 #ifndef S_IRWXU
18075 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
18076 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
18077 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
18078 #endif
18079 END
18080     : see whether semctl IPC_STAT can use union semun
18081     case "$d_semctl_semun" in
18082     '')
18083       val="$undef"
18084       $cat > try.c <<END
18085 #include <sys/types.h>
18086 #include <sys/ipc.h>
18087 #include <sys/sem.h>
18088 #include <sys/stat.h>
18089 #include <stdio.h>
18090 #include <errno.h>
18091 #include "tryh.h"
18092 #ifndef errno
18093 extern int errno;
18094 #endif
18095 #$d_union_semun HAS_UNION_SEMUN
18096 int main() {
18097     union semun
18098 #ifndef HAS_UNION_SEMUN
18099     {
18100         int val;
18101         struct semid_ds *buf;
18102         unsigned short *array;
18103     }
18104 #endif
18105     arg;
18106     int sem, st;
18107
18108 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
18109     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18110     if (sem > -1) {
18111         struct semid_ds argbuf;
18112         arg.buf = &argbuf;
18113 #       ifdef IPC_STAT
18114         st = semctl(sem, 0, IPC_STAT, arg);
18115         if (st == 0)
18116             printf("semun\n");
18117         else
18118 #       endif /* IPC_STAT */
18119             printf("semctl IPC_STAT failed: errno = %d\n", errno);
18120 #       ifdef IPC_RMID
18121         if (semctl(sem, 0, IPC_RMID, arg) != 0)
18122 #       endif /* IPC_RMID */
18123             printf("semctl IPC_RMID failed: errno = %d\n", errno);
18124     } else
18125 #endif /* IPC_PRIVATE && ... */
18126         printf("semget failed: errno = %d\n", errno);
18127   return 0;
18128 }
18129 END
18130       set try
18131       if eval $compile; then
18132           xxx=`$run ./try`
18133           case "$xxx" in
18134           semun) val="$define" ;;
18135           esac
18136       fi
18137       $rm_try
18138       set d_semctl_semun
18139       eval $setvar
18140       ;;
18141     esac
18142     case "$d_semctl_semun" in
18143     $define)
18144         echo "You can use union semun for semctl IPC_STAT." >&4
18145         also='also'
18146         ;;
18147     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
18148         also=''
18149         ;;
18150     esac
18151
18152     : see whether semctl IPC_STAT can use struct semid_ds pointer
18153     case "$d_semctl_semid_ds" in
18154     '')
18155       val="$undef"
18156       $cat > try.c <<'END'
18157 #include <sys/types.h>
18158 #include <sys/ipc.h>
18159 #include <sys/sem.h>
18160 #include <sys/stat.h>
18161 #include "tryh.h"
18162 #include <stdio.h>
18163 #include <errno.h>
18164 #ifndef errno
18165 extern int errno;
18166 #endif
18167 int main() {
18168     struct semid_ds arg;
18169     int sem, st;
18170
18171 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
18172     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18173     if (sem > -1) {
18174 #       ifdef IPC_STAT
18175         st = semctl(sem, 0, IPC_STAT, &arg);
18176         if (st == 0)
18177             printf("semid_ds\n");
18178         else
18179 #       endif /* IPC_STAT */
18180             printf("semctl IPC_STAT failed: errno = %d\n", errno);
18181 #       ifdef IPC_RMID
18182         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
18183 #       endif /* IPC_RMID */
18184             printf("semctl IPC_RMID failed: errno = %d\n", errno);
18185     } else
18186 #endif /* IPC_PRIVATE && ... */
18187         printf("semget failed: errno = %d\n", errno);
18188
18189     return 0;
18190 }
18191 END
18192       set try
18193       if eval $compile; then
18194           xxx=`$run ./try`
18195           case "$xxx" in
18196           semid_ds) val="$define" ;;
18197           esac
18198       fi
18199       $rm_try
18200       set d_semctl_semid_ds
18201       eval $setvar
18202       ;;
18203     esac
18204     case "$d_semctl_semid_ds" in
18205     $define)
18206         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
18207         ;;
18208     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
18209         ;;
18210     esac
18211     ;;
18212 *)  val="$undef"
18213
18214     # We do not have the full sem*(2) library, so assume we can not
18215     # use either.
18216
18217     set d_semctl_semun
18218     eval $setvar
18219
18220     set d_semctl_semid_ds
18221     eval $setvar
18222     ;;
18223 esac
18224 $rm_try tryh.h
18225
18226 : see if sendmsg exists
18227 set sendmsg d_sendmsg
18228 eval $inlibc
18229
18230 : see if setegid exists
18231 set setegid d_setegid
18232 eval $inlibc
18233
18234 : see if seteuid exists
18235 set seteuid d_seteuid
18236 eval $inlibc
18237
18238 : see if setgrent exists
18239 set setgrent d_setgrent
18240 eval $inlibc
18241
18242 : see if setgrent_r exists
18243 set setgrent_r d_setgrent_r
18244 eval $inlibc
18245 case "$d_setgrent_r" in
18246 "$define")
18247         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
18248         case "$d_setgrent_r_proto:$usethreads" in
18249         ":define")      d_setgrent_r_proto=define
18250                 set d_setgrent_r_proto setgrent_r $hdrs
18251                 eval $hasproto ;;
18252         *)      ;;
18253         esac
18254         case "$d_setgrent_r_proto" in
18255         define)
18256         case "$setgrent_r_proto" in
18257         ''|0) try='int setgrent_r(FILE**);'
18258         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
18259         esac
18260         case "$setgrent_r_proto" in
18261         ''|0) try='void setgrent_r(FILE**);'
18262         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
18263         esac
18264         case "$setgrent_r_proto" in
18265         ''|0)   d_setgrent_r=undef
18266                 setgrent_r_proto=0
18267                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
18268         * )     case "$setgrent_r_proto" in
18269                 REENTRANT_PROTO*) ;;
18270                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
18271                 esac
18272                 echo "Prototype: $try" ;;
18273         esac
18274         ;;
18275         *)      case "$usethreads" in
18276                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
18277                 esac
18278                 d_setgrent_r=undef
18279                 setgrent_r_proto=0
18280                 ;;
18281         esac
18282         ;;
18283 *)      setgrent_r_proto=0
18284         ;;
18285 esac
18286
18287 : see if sethostent exists
18288 set sethostent d_sethent
18289 eval $inlibc
18290
18291 : see if sethostent_r exists
18292 set sethostent_r d_sethostent_r
18293 eval $inlibc
18294 case "$d_sethostent_r" in
18295 "$define")
18296         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18297         case "$d_sethostent_r_proto:$usethreads" in
18298         ":define")      d_sethostent_r_proto=define
18299                 set d_sethostent_r_proto sethostent_r $hdrs
18300                 eval $hasproto ;;
18301         *)      ;;
18302         esac
18303         case "$d_sethostent_r_proto" in
18304         define)
18305         case "$sethostent_r_proto" in
18306         ''|0) try='int sethostent_r(int, struct hostent_data*);'
18307         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
18308         esac
18309         case "$sethostent_r_proto" in
18310         ''|0) try='void sethostent_r(int, struct hostent_data*);'
18311         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
18312         esac
18313         case "$sethostent_r_proto" in
18314         ''|0)   d_sethostent_r=undef
18315                 sethostent_r_proto=0
18316                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
18317         * )     case "$sethostent_r_proto" in
18318                 REENTRANT_PROTO*) ;;
18319                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
18320                 esac
18321                 echo "Prototype: $try" ;;
18322         esac
18323         ;;
18324         *)      case "$usethreads" in
18325                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
18326                 esac
18327                 d_sethostent_r=undef
18328                 sethostent_r_proto=0
18329                 ;;
18330         esac
18331         ;;
18332 *)      sethostent_r_proto=0
18333         ;;
18334 esac
18335
18336 : see if setitimer exists
18337 set setitimer d_setitimer
18338 eval $inlibc
18339
18340 : see if setlinebuf exists
18341 set setlinebuf d_setlinebuf
18342 eval $inlibc
18343
18344 : see if setlocale exists
18345 set setlocale d_setlocale
18346 eval $inlibc
18347
18348 : see if locale.h is available
18349 set locale.h i_locale
18350 eval $inhdr
18351
18352 : see if setlocale_r exists
18353 set setlocale_r d_setlocale_r
18354 eval $inlibc
18355 case "$d_setlocale_r" in
18356 "$define")
18357         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18358         case "$d_setlocale_r_proto:$usethreads" in
18359         ":define")      d_setlocale_r_proto=define
18360                 set d_setlocale_r_proto setlocale_r $hdrs
18361                 eval $hasproto ;;
18362         *)      ;;
18363         esac
18364         case "$d_setlocale_r_proto" in
18365         define)
18366         case "$setlocale_r_proto" in
18367         ''|0) try='int setlocale_r(int, const char*, char*, int);'
18368         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18369         esac
18370         case "$setlocale_r_proto" in
18371         ''|0)   d_setlocale_r=undef
18372                 setlocale_r_proto=0
18373                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18374         * )     case "$setlocale_r_proto" in
18375                 REENTRANT_PROTO*) ;;
18376                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18377                 esac
18378                 echo "Prototype: $try" ;;
18379         esac
18380         ;;
18381         *)      case "$usethreads" in
18382                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18383                 esac
18384                 d_setlocale_r=undef
18385                 setlocale_r_proto=0
18386                 ;;
18387         esac
18388         ;;
18389 *)      setlocale_r_proto=0
18390         ;;
18391 esac
18392
18393 : see if setnetent exists
18394 set setnetent d_setnent
18395 eval $inlibc
18396
18397 : see if setnetent_r exists
18398 set setnetent_r d_setnetent_r
18399 eval $inlibc
18400 case "$d_setnetent_r" in
18401 "$define")
18402         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18403         case "$d_setnetent_r_proto:$usethreads" in
18404         ":define")      d_setnetent_r_proto=define
18405                 set d_setnetent_r_proto setnetent_r $hdrs
18406                 eval $hasproto ;;
18407         *)      ;;
18408         esac
18409         case "$d_setnetent_r_proto" in
18410         define)
18411         case "$setnetent_r_proto" in
18412         ''|0) try='int setnetent_r(int, struct netent_data*);'
18413         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18414         esac
18415         case "$setnetent_r_proto" in
18416         ''|0) try='void setnetent_r(int, struct netent_data*);'
18417         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18418         esac
18419         case "$setnetent_r_proto" in
18420         ''|0)   d_setnetent_r=undef
18421                 setnetent_r_proto=0
18422                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18423         * )     case "$setnetent_r_proto" in
18424                 REENTRANT_PROTO*) ;;
18425                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18426                 esac
18427                 echo "Prototype: $try" ;;
18428         esac
18429         ;;
18430         *)      case "$usethreads" in
18431                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18432                 esac
18433                 d_setnetent_r=undef
18434                 setnetent_r_proto=0
18435                 ;;
18436         esac
18437         ;;
18438 *)      setnetent_r_proto=0
18439         ;;
18440 esac
18441
18442 : see if setprotoent exists
18443 set setprotoent d_setpent
18444 eval $inlibc
18445
18446 : see if setpgid exists
18447 set setpgid d_setpgid
18448 eval $inlibc
18449
18450 : see if setpgrp2 exists
18451 set setpgrp2 d_setpgrp2
18452 eval $inlibc
18453
18454 : see if setpriority exists
18455 set setpriority d_setprior
18456 eval $inlibc
18457
18458 : see if setproctitle exists
18459 set setproctitle d_setproctitle
18460 eval $inlibc
18461
18462 : see if setprotoent_r exists
18463 set setprotoent_r d_setprotoent_r
18464 eval $inlibc
18465 case "$d_setprotoent_r" in
18466 "$define")
18467         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18468         case "$d_setprotoent_r_proto:$usethreads" in
18469         ":define")      d_setprotoent_r_proto=define
18470                 set d_setprotoent_r_proto setprotoent_r $hdrs
18471                 eval $hasproto ;;
18472         *)      ;;
18473         esac
18474         case "$d_setprotoent_r_proto" in
18475         define)
18476         case "$setprotoent_r_proto" in
18477         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18478         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18479         esac
18480         case "$setprotoent_r_proto" in
18481         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18482         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18483         esac
18484         case "$setprotoent_r_proto" in
18485         ''|0)   d_setprotoent_r=undef
18486                 setprotoent_r_proto=0
18487                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18488         * )     case "$setprotoent_r_proto" in
18489                 REENTRANT_PROTO*) ;;
18490                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18491                 esac
18492                 echo "Prototype: $try" ;;
18493         esac
18494         ;;
18495         *)      case "$usethreads" in
18496                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18497                 esac
18498                 d_setprotoent_r=undef
18499                 setprotoent_r_proto=0
18500                 ;;
18501         esac
18502         ;;
18503 *)      setprotoent_r_proto=0
18504         ;;
18505 esac
18506
18507 : see if setpwent exists
18508 set setpwent d_setpwent
18509 eval $inlibc
18510
18511 : see if setpwent_r exists
18512 set setpwent_r d_setpwent_r
18513 eval $inlibc
18514 case "$d_setpwent_r" in
18515 "$define")
18516         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18517         case "$d_setpwent_r_proto:$usethreads" in
18518         ":define")      d_setpwent_r_proto=define
18519                 set d_setpwent_r_proto setpwent_r $hdrs
18520                 eval $hasproto ;;
18521         *)      ;;
18522         esac
18523         case "$d_setpwent_r_proto" in
18524         define)
18525         case "$setpwent_r_proto" in
18526         ''|0) try='int setpwent_r(FILE**);'
18527         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18528         esac
18529         case "$setpwent_r_proto" in
18530         ''|0) try='void setpwent_r(FILE**);'
18531         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18532         esac
18533         case "$setpwent_r_proto" in
18534         ''|0)   d_setpwent_r=undef
18535                 setpwent_r_proto=0
18536                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18537         * )     case "$setpwent_r_proto" in
18538                 REENTRANT_PROTO*) ;;
18539                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18540                 esac
18541                 echo "Prototype: $try" ;;
18542         esac
18543         ;;
18544         *)      case "$usethreads" in
18545                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18546                 esac
18547                 d_setpwent_r=undef
18548                 setpwent_r_proto=0
18549                 ;;
18550         esac
18551         ;;
18552 *)      setpwent_r_proto=0
18553         ;;
18554 esac
18555
18556 : see if setregid exists
18557 set setregid d_setregid
18558 eval $inlibc
18559 set setresgid d_setresgid
18560 eval $inlibc
18561
18562 : see if setreuid exists
18563 set setreuid d_setreuid
18564 eval $inlibc
18565 set setresuid d_setresuid
18566 eval $inlibc
18567
18568 : see if setrgid exists
18569 set setrgid d_setrgid
18570 eval $inlibc
18571
18572 : see if setruid exists
18573 set setruid d_setruid
18574 eval $inlibc
18575
18576 : see if setservent exists
18577 set setservent d_setsent
18578 eval $inlibc
18579
18580 : see if setservent_r exists
18581 set setservent_r d_setservent_r
18582 eval $inlibc
18583 case "$d_setservent_r" in
18584 "$define")
18585         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18586         case "$d_setservent_r_proto:$usethreads" in
18587         ":define")      d_setservent_r_proto=define
18588                 set d_setservent_r_proto setservent_r $hdrs
18589                 eval $hasproto ;;
18590         *)      ;;
18591         esac
18592         case "$d_setservent_r_proto" in
18593         define)
18594         case "$setservent_r_proto" in
18595         ''|0) try='int setservent_r(int, struct servent_data*);'
18596         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18597         esac
18598         case "$setservent_r_proto" in
18599         ''|0) try='void setservent_r(int, struct servent_data*);'
18600         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18601         esac
18602         case "$setservent_r_proto" in
18603         ''|0)   d_setservent_r=undef
18604                 setservent_r_proto=0
18605                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18606         * )     case "$setservent_r_proto" in
18607                 REENTRANT_PROTO*) ;;
18608                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18609                 esac
18610                 echo "Prototype: $try" ;;
18611         esac
18612         ;;
18613         *)      case "$usethreads" in
18614                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18615                 esac
18616                 d_setservent_r=undef
18617                 setservent_r_proto=0
18618                 ;;
18619         esac
18620         ;;
18621 *)      setservent_r_proto=0
18622         ;;
18623 esac
18624
18625 : see if setsid exists
18626 set setsid d_setsid
18627 eval $inlibc
18628
18629 : see if setvbuf exists
18630 set setvbuf d_setvbuf
18631 eval $inlibc
18632
18633 : see if shmctl exists
18634 set shmctl d_shmctl
18635 eval $inlibc
18636
18637 : see if shmget exists
18638 set shmget d_shmget
18639 eval $inlibc
18640
18641 : see if shmat exists
18642 set shmat d_shmat
18643 eval $inlibc
18644 : see what shmat returns
18645 case "$d_shmat" in
18646 "$define")
18647         $cat >shmat.c <<'END'
18648 #include <sys/shm.h>
18649 void *shmat();
18650 END
18651         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18652                 shmattype='void *'
18653         else
18654                 shmattype='char *'
18655         fi
18656         echo "and it returns ($shmattype)." >&4
18657         : see if a prototype for shmat is available
18658         xxx=`./findhdr sys/shm.h`
18659         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18660         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18661                 val="$define"
18662         else
18663                 val="$undef"
18664         fi
18665         $rm -f shmat.[co]
18666         ;;
18667 *)
18668         val="$undef"
18669         ;;
18670 esac
18671 set d_shmatprototype
18672 eval $setvar
18673
18674 : see if shmdt exists
18675 set shmdt d_shmdt
18676 eval $inlibc
18677
18678 : see how much of the 'shm*(2)' library is present.
18679 h_shm=true
18680 echo " "
18681 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18682 *"$undef"*) h_shm=false;;
18683 esac
18684 case "$osname" in
18685 freebsd)
18686     case "`ipcs 2>&1`" in
18687     "SVID shared memory"*"not configured"*)
18688         echo "Your $osname does not have the shm*(2) configured." >&4
18689         h_shm=false
18690         val="$undef"
18691         set shmctl d_shmctl
18692         eval $setvar
18693         set shmget d_shmget
18694         eval $setvar
18695         set shmat d_shmat
18696         eval $setvar
18697         set shmdt d_shmdt
18698         eval $setvar
18699         ;;
18700     esac
18701     ;;
18702 esac
18703 : we could also check for sys/ipc.h ...
18704 if $h_shm && $test `./findhdr sys/shm.h`; then
18705         echo "You have the full shm*(2) library." >&4
18706         val="$define"
18707 else
18708         echo "You don't have the full shm*(2) library." >&4
18709         val="$undef"
18710 fi
18711 set d_shm
18712 eval $setvar
18713
18714 : see if we have sigaction
18715 echo " "
18716 if set sigaction val -f d_sigaction; eval $csym; $val; then
18717         echo 'sigaction() found.' >&4
18718         $cat > try.c <<EOP
18719 #include <stdio.h>
18720 #include <sys/types.h>
18721 #include <signal.h>
18722 #$i_stdlib I_STDLIB
18723 #ifdef I_STDLIB
18724 #include <stdlib.h>
18725 #endif
18726 int main()
18727 {
18728     struct sigaction act, oact;
18729     act.sa_flags = 0;
18730     oact.sa_handler = 0;
18731     /* so that act and oact are used */
18732     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18733 }
18734 EOP
18735         set try
18736         if eval $compile_ok; then
18737                 val="$define"
18738         else
18739                 echo "But you don't seem to have a usable struct sigaction." >&4
18740                 val="$undef"
18741         fi
18742 else
18743         echo 'sigaction NOT found.' >&4
18744         val="$undef"
18745 fi
18746 set d_sigaction; eval $setvar
18747 $rm_try
18748
18749 : see what type pids are declared as in the kernel
18750 rp="What is the type of process ids on this system?"
18751 set pid_t pidtype int stdio.h sys/types.h
18752 eval $typedef_ask
18753
18754 : see what type uids are declared as in the kernel
18755 echo " "
18756 echo "Looking for the type for user ids returned by getuid()."
18757 set uid_t uidtype xxx stdio.h sys/types.h
18758 eval $typedef
18759 case "$uidtype" in
18760 xxx)
18761         xxx=`./findhdr sys/user.h`
18762         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18763         case $1 in
18764         unsigned) dflt="$1 $2" ;;
18765         *) dflt="$1" ;;
18766         esac
18767         ;;
18768 *) dflt="$uidtype";;
18769 esac
18770 case "$uidtype" in
18771 uid_t)  echo "uid_t found." ;;
18772 *)      rp="What is the type for user ids returned by getuid()?"
18773         . ./myread
18774         uidtype="$ans"
18775         ;;
18776 esac
18777
18778 : Define hasfield_t macro for Configure internal use
18779 hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
18780 while $test $# -ge 2; do
18781     case "$1" in
18782         $define) echo "#include <$2>";;
18783     esac ;
18784     shift 2;
18785 done > try.c;
18786 echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
18787 set try;
18788 if eval $compile; then
18789         val="$define";
18790 else
18791         val="$undef";
18792 fi;
18793 set $varname;
18794 eval $setvar;
18795 $rm_try'
18796
18797 : see what siginfo fields we have
18798 case "$d_sigaction" in
18799 "$define")
18800         echo "Checking if your siginfo_t has si_errno field...">&4
18801         set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
18802         eval $hasfield_t;
18803
18804         echo "Checking if your siginfo_t has si_pid field...">&4
18805         set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
18806         eval $hasfield_t;
18807
18808         echo "Checking if your siginfo_t has si_uid field...">&4
18809         set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
18810         eval $hasfield_t;
18811
18812         echo "Checking if your siginfo_t has si_addr field...">&4
18813         set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
18814         eval $hasfield_t;
18815
18816         echo "Checking if your siginfo_t has si_status field...">&4
18817         set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
18818         eval $hasfield_t;
18819
18820         echo "Checking if your siginfo_t has si_band field...">&4
18821         set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
18822         eval $hasfield_t;
18823
18824         echo "Checking if your siginfo_t has si_value field...">&4
18825         set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
18826         eval $hasfield_t;
18827
18828         echo "Checking if your siginfo_t has si_fd field...">&4
18829         set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
18830         eval $hasfield_t;
18831
18832         ;;
18833 *)
18834         d_siginfo_si_errno="$undef"
18835         d_siginfo_si_pid="$undef"
18836         d_siginfo_si_uid="$undef"
18837         d_siginfo_si_addr="$undef"
18838         d_siginfo_si_status="$undef"
18839         d_siginfo_si_band="$undef"
18840         d_siginfo_si_value="$undef"
18841         d_siginfo_si_fd="$undef"
18842         ;;
18843 esac
18844
18845 : see if this is a sunmath.h system
18846 set sunmath.h i_sunmath
18847 eval $inhdr
18848
18849 : see if signbit exists
18850 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18851 $cat >try.c <<EOCP
18852 #$i_math I_MATH
18853 #$i_sunmath I_SUNMATH
18854 #ifdef I_MATH
18855 #  include <math.h>
18856 #endif
18857 #ifdef I_SUNMATH  /* Solaris special math library */
18858 #  include <sunmath.h>
18859 #endif
18860 #define NV $nvtype
18861 int main(int argc, char **argv)
18862 {
18863     NV x = 0.0;
18864     NV y = -1.0;
18865     if ((signbit(x) == 0) && (signbit(y) != 0))
18866         return 0;
18867     else
18868         return 1;
18869 }
18870 EOCP
18871 val="$undef"
18872 set try
18873 if eval $compile; then
18874     if $run ./try; then
18875         $echo "Yes." >&4
18876         val="$define"
18877     else
18878         $echo "Signbit seems to be available, but doesn't work as I expected."
18879         $echo "I won't use it." >&4
18880         val="$undef"
18881     fi
18882 else
18883     $echo "Nope." >&4
18884     dflt="$undef"
18885 fi
18886 set d_signbit
18887 eval $setvar
18888 $rm_try
18889
18890 : see if sigprocmask exists
18891 set sigprocmask d_sigprocmask
18892 eval $inlibc
18893
18894 : see if sigsetjmp exists
18895 echo " "
18896 case "$d_sigsetjmp" in
18897 '')
18898         $cat >try.c <<EOP
18899 #include <setjmp.h>
18900 #$i_stdlib I_STDLIB
18901 #ifdef I_STDLIB
18902 #include <stdlib.h>
18903 #endif
18904 sigjmp_buf env;
18905 int set = 1;
18906 int main()
18907 {
18908         if (sigsetjmp(env,1))
18909                 exit(set);
18910         set = 0;
18911         siglongjmp(env, 1);
18912         exit(1);
18913 }
18914 EOP
18915         set try
18916         if eval $compile; then
18917                 if $run ./try >/dev/null 2>&1; then
18918                         echo "POSIX sigsetjmp found." >&4
18919                         val="$define"
18920                 else
18921                         $cat >&4 <<EOM
18922 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18923 I'll ignore them.
18924 EOM
18925                         val="$undef"
18926                 fi
18927         else
18928                 echo "sigsetjmp not found." >&4
18929                 val="$undef"
18930         fi
18931         ;;
18932 *) val="$d_sigsetjmp"
18933         case "$d_sigsetjmp" in
18934         $define) echo "POSIX sigsetjmp found." >&4;;
18935         $undef) echo "sigsetjmp not found." >&4;;
18936         esac
18937         ;;
18938 esac
18939 set d_sigsetjmp
18940 eval $setvar
18941 $rm_try
18942
18943 : see if snprintf exists
18944 set snprintf d_snprintf
18945 eval $inlibc
18946
18947 : see if vsnprintf exists
18948 set vsnprintf d_vsnprintf
18949 eval $inlibc
18950
18951 case "$d_snprintf-$d_vsnprintf" in
18952 "$define-$define")
18953     $cat <<EOM
18954 Checking whether your snprintf() and vsnprintf() work okay...
18955 EOM
18956     $cat >try.c <<'EOCP'
18957 /* v?snprintf testing logic courtesy of Russ Allbery.
18958  * According to C99:
18959  * - if the buffer is too short it still must be \0-terminated
18960  * - if the buffer is too short the potentially required length
18961  *   must be returned and not -1
18962  * - if the buffer is NULL the potentially required length
18963  *   must be returned and not -1 or core dump
18964  */
18965 #include <stdio.h>
18966 #include <stdarg.h>
18967
18968 char buf[2];
18969
18970 int test (char *format, ...)
18971 {
18972     va_list args;
18973     int count;
18974
18975     va_start (args, format);
18976     count = vsnprintf (buf, sizeof buf, format, args);
18977     va_end (args);
18978     return count;
18979 }
18980
18981 int main ()
18982 {
18983     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18984              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18985 }
18986 EOCP
18987     set try
18988     if eval $compile; then
18989         `$run ./try`
18990         case "$?" in
18991         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18992         *) cat <<EOM >&4
18993 Your snprintf() and snprintf() don't seem to be working okay.
18994 EOM
18995            d_snprintf="$undef"
18996            d_vsnprintf="$undef"
18997            ;;
18998         esac
18999     else
19000         echo "(I can't seem to compile the test program--assuming they don't)"
19001         d_snprintf="$undef"
19002         d_vsnprintf="$undef"
19003     fi
19004     $rm_try
19005     ;;
19006 esac
19007
19008 : see if sockatmark exists
19009 set sockatmark d_sockatmark
19010 eval $inlibc
19011
19012 : see if prototype for sockatmark is available
19013 echo " "
19014 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
19015 eval $hasproto
19016
19017 : see if socks5_init exists
19018 set socks5_init d_socks5_init
19019 eval $inlibc
19020
19021 : see if sprintf returns the length of the string in the buffer as per ANSI
19022 $echo "Checking whether sprintf returns the length of the string..." >&4
19023 $cat <<EOP >try.c
19024 #include <stdio.h>
19025 #$i_stdlib I_STDLIB
19026 #ifdef I_STDLIB
19027 #include <stdlib.h>
19028 #endif
19029 #$i_string I_STRING
19030 #ifdef I_STRING
19031 #  include <string.h>
19032 #else
19033 #  include <strings.h>
19034 #endif
19035 #$i_math I_MATH
19036 #ifdef I_MATH
19037 #include <math.h>
19038 #endif
19039
19040 char buffer[256];
19041
19042 int check (size_t expect, int test) {
19043   size_t got = strlen(buffer);
19044   if (expect == got)
19045     return 0;
19046
19047   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
19048        test, buffer);
19049   exit (test);
19050 }
19051
19052 int main(int argc, char **argv) {
19053   int test = 0;
19054
19055   check(sprintf(buffer, ""), ++test);
19056   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
19057   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
19058
19059   return 0;
19060 }
19061 EOP
19062 set try
19063
19064 if eval $compile; then
19065     xxx="`$run ./try`"
19066     case "$?" in
19067         0) cat >&4 <<EOM
19068 sprintf returns the length of the string (as ANSI says it should)
19069 EOM
19070         d_sprintf_returns_strlen="$define"
19071         ;;
19072         *) cat >&4 <<EOM
19073 sprintf does not return the length of the string (how old is this system?)
19074 EOM
19075         d_sprintf_returns_strlen="$undef"
19076         ;;
19077     esac
19078 else
19079     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
19080     d_sprintf_returns_strlen="$undef"
19081 fi
19082 $rm_try
19083
19084 : see if srand48_r exists
19085 set srand48_r d_srand48_r
19086 eval $inlibc
19087 case "$d_srand48_r" in
19088 "$define")
19089         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
19090         case "$d_srand48_r_proto:$usethreads" in
19091         ":define")      d_srand48_r_proto=define
19092                 set d_srand48_r_proto srand48_r $hdrs
19093                 eval $hasproto ;;
19094         *)      ;;
19095         esac
19096         case "$d_srand48_r_proto" in
19097         define)
19098         case "$srand48_r_proto" in
19099         ''|0) try='int srand48_r(long, struct drand48_data*);'
19100         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
19101         esac
19102         case "$srand48_r_proto" in
19103         ''|0)   d_srand48_r=undef
19104                 srand48_r_proto=0
19105                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
19106         * )     case "$srand48_r_proto" in
19107                 REENTRANT_PROTO*) ;;
19108                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
19109                 esac
19110                 echo "Prototype: $try" ;;
19111         esac
19112         ;;
19113         *)      case "$usethreads" in
19114                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
19115                 esac
19116                 d_srand48_r=undef
19117                 srand48_r_proto=0
19118                 ;;
19119         esac
19120         ;;
19121 *)      srand48_r_proto=0
19122         ;;
19123 esac
19124
19125 : see if srandom_r exists
19126 set srandom_r d_srandom_r
19127 eval $inlibc
19128 case "$d_srandom_r" in
19129 "$define")
19130         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
19131         case "$d_srandom_r_proto:$usethreads" in
19132         ":define")      d_srandom_r_proto=define
19133                 set d_srandom_r_proto srandom_r $hdrs
19134                 eval $hasproto ;;
19135         *)      ;;
19136         esac
19137         case "$d_srandom_r_proto" in
19138         define)
19139         case "$srandom_r_proto" in
19140         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
19141         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
19142         esac
19143         case "$srandom_r_proto" in
19144         ''|0)   d_srandom_r=undef
19145                 srandom_r_proto=0
19146                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
19147         * )     case "$srandom_r_proto" in
19148                 REENTRANT_PROTO*) ;;
19149                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
19150                 esac
19151                 echo "Prototype: $try" ;;
19152         esac
19153         ;;
19154         *)      case "$usethreads" in
19155                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
19156                 esac
19157                 d_srandom_r=undef
19158                 srandom_r_proto=0
19159                 ;;
19160         esac
19161         ;;
19162 *)      srandom_r_proto=0
19163         ;;
19164 esac
19165
19166 : see if prototype for setresgid is available
19167 echo " "
19168 set d_sresgproto setresgid $i_unistd unistd.h
19169 eval $hasproto
19170
19171 : see if prototype for setresuid is available
19172 echo " "
19173 set d_sresuproto setresuid $i_unistd unistd.h
19174 eval $hasproto
19175
19176 : see if stat exists
19177 set stat d_stat
19178 eval $inlibc
19179
19180 : see if sys/stat.h is available
19181 set sys/stat.h i_sysstat
19182 eval $inhdr
19183
19184 : see if stat knows about block sizes
19185 echo " "
19186 echo "Checking to see if your struct stat has st_blocks field..." >&4
19187 set d_statblks stat st_blocks $i_sysstat sys/stat.h
19188 eval $hasfield
19189
19190 : see if this is a sys/vfs.h system
19191 set sys/vfs.h i_sysvfs
19192 eval $inhdr
19193
19194 : see if this is a sys/statfs.h system
19195 set sys/statfs.h i_sysstatfs
19196 eval $inhdr
19197
19198 : Check for statfs_s
19199 echo " "
19200 echo "Checking to see if your system supports struct statfs..." >&4
19201 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
19202 eval $hasstruct
19203 case "$d_statfs_s" in
19204 "$define")      echo "Yes, it does."   ;;
19205 *)              echo "No, it doesn't." ;;
19206 esac
19207
19208
19209 : see if struct statfs knows about f_flags
19210 case "$d_statfs_s" in
19211 define)
19212         echo " "
19213         echo "Checking to see if your struct statfs has f_flags field..." >&4
19214         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
19215         eval $hasfield
19216         ;;
19217 *)      val="$undef"
19218         set d_statfs_f_flags
19219         eval $setvar
19220         ;;
19221 esac
19222 case "$d_statfs_f_flags" in
19223 "$define")      echo "Yes, it does."   ;;
19224 *)              echo "No, it doesn't." ;;
19225 esac
19226
19227 : see what flavor, if any, of static inline is supported
19228 echo " "
19229 echo "Checking to see if your system supports static inline..."
19230 $cat > try.c <<'EOCP'
19231 #include <stdlib.h>
19232 extern int f_via_a(int x);
19233 extern int f_via_b(int x);
19234 int main(int argc, char **argv)
19235 {
19236     int y;
19237
19238     y = f_via_a(0);
19239 #ifdef USE_B
19240     y = f_via_b(0);
19241 #endif
19242     if (y == 42) {
19243         return EXIT_SUCCESS;
19244     }
19245     else {
19246         return EXIT_FAILURE;
19247     }
19248 }
19249 EOCP
19250 $cat > a.c <<'EOCP'
19251 static INLINE int f(int x) {
19252     int y;
19253     y = x + 42;
19254     return y;
19255 }
19256
19257 int f_via_a(int x)
19258 {
19259     return f(x);
19260 }
19261 EOCP
19262 $cat > b.c <<'EOCP'
19263 extern int f(int x);
19264
19265 int f_via_b(int x)
19266 {
19267     return f(x);
19268 }
19269 EOCP
19270
19271 # Respect a hint (or previous) value for perl_static_inline, if there is one.
19272 case "$perl_static_inline" in
19273 '')     # Check the various possibilities, and break out on success.
19274         # For gcc, prefer __inline__, which will still permit
19275         # cflags.SH to add in -ansi.
19276         case "$gccversion" in
19277                 '') xxx="inline __inline__ __inline _inline";;
19278                 *)  xxx="__inline__ inline __inline _inline";;
19279         esac
19280         for inline in $xxx; do
19281                 set try -DINLINE=$inline a.c
19282                 if eval $compile && $run ./try; then
19283                         # Now make sure there is no external linkage of static
19284                         # functions
19285                         set try -DINLINE=$inline -DUSE_B a.c b.c
19286                         if eval $compile && $run ./try; then
19287                                 $echo "Your compiler supports static $inline, " >&4
19288                                 $echo "but it also creates an external definition," >&4
19289                                 $echo "so I won't use it." >&4
19290                                 val=$undef
19291                         else
19292                                 $echo "Your compiler supports static $inline." >&4
19293                                 val=$define
19294                                 perl_static_inline="static $inline";
19295                                 break;
19296                         fi
19297                 else
19298                         $echo "Your compiler does NOT support static $inline." >&4
19299                         val="$undef"
19300                 fi
19301         done
19302         ;;
19303 *inline*) # Some variant of inline exists.
19304         echo "Keeping your $hint value of $perl_static_inline."
19305         val=$define
19306         ;;
19307 static)  # No inline capabilities
19308         echo "Keeping your $hint value of $perl_static_inline."
19309         val=$undef
19310         ;;
19311 *)  # Unrecognized previous value -- blindly trust the supplied
19312         # value and hope it makes sense.  Use old value for
19313         # d_static_inline, if there is one.
19314         echo "Keeping your $hint value of $perl_static_inline."
19315         case "$d_static_inline" in
19316                 '') val=$define ;;
19317                 *)  val=$d_static_inline ;;
19318         esac
19319         ;;
19320 esac
19321 # Fallback to plain 'static' if nothing worked.
19322 case "$perl_static_inline" in
19323 '')
19324         perl_static_inline="static"
19325         val=$undef
19326         ;;
19327 esac
19328 set d_static_inline
19329 eval $setvar
19330 $rm -f a.[co] b.[co]
19331 $rm_try
19332
19333 : Check stream access
19334 $cat >&4 <<EOM
19335 Checking how to access stdio streams by file descriptor number...
19336 EOM
19337 case "$stdio_stream_array" in
19338 '')     $cat >try.c <<EOCP
19339 #include <stdio.h>
19340 int main() {
19341   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
19342     printf("yes\n");
19343 }
19344 EOCP
19345         for s in _iob __iob __sF
19346         do
19347                 set try -DSTDIO_STREAM_ARRAY=$s
19348                 if eval $compile; then
19349                         case "`$run ./try`" in
19350                         yes)    stdio_stream_array=$s; break ;;
19351                         esac
19352                 fi
19353         done
19354         $rm_try
19355 esac
19356 case "$stdio_stream_array" in
19357 '')     $cat >&4 <<EOM
19358 I can't figure out how to access stdio streams by file descriptor number.
19359 EOM
19360         d_stdio_stream_array="$undef"
19361         ;;
19362 *)      $cat >&4 <<EOM
19363 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
19364 EOM
19365         d_stdio_stream_array="$define"
19366         ;;
19367 esac
19368
19369 : see if strcoll exists
19370 set strcoll d_strcoll
19371 eval $inlibc
19372
19373 : check for structure copying
19374 echo " "
19375 echo "Checking to see if your C compiler can copy structs..." >&4
19376 $cat >try.c <<'EOCP'
19377 int main()
19378 {
19379         struct blurfl {
19380                 int dyick;
19381         } foo, bar;
19382
19383         foo = bar;
19384 }
19385 EOCP
19386 if $cc -c try.c >/dev/null 2>&1 ; then
19387         val="$define"
19388         echo "Yup, it can."
19389 else
19390         val="$undef"
19391         echo "Nope, it can't."
19392 fi
19393 set d_strctcpy
19394 eval $setvar
19395 $rm_try
19396
19397 : see if strerror and/or sys_errlist[] exist
19398 echo " "
19399 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
19400     if set strerror val -f d_strerror; eval $csym; $val; then
19401                 echo 'strerror() found.' >&4
19402                 d_strerror="$define"
19403                 d_strerrm='strerror(e)'
19404                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19405                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
19406                         d_syserrlst="$define"
19407                 else
19408                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
19409                         d_syserrlst="$undef"
19410                 fi
19411     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
19412                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
19413                 echo 'strerror() found in string header.' >&4
19414                 d_strerror="$define"
19415                 d_strerrm='strerror(e)'
19416                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19417                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
19418                                 d_syserrlst="$define"
19419                 else
19420                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
19421                         d_syserrlst="$undef"
19422                 fi
19423     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19424                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
19425                 d_strerror="$undef"
19426                 d_syserrlst="$define"
19427                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
19428     else
19429                 echo 'strerror() and sys_errlist[] NOT found.' >&4
19430                 d_strerror="$undef"
19431                 d_syserrlst="$undef"
19432                 d_strerrm='"unknown"'
19433     fi
19434 fi
19435
19436 : see if strerror_l exists
19437 set strerror_l d_strerror_l
19438 eval $inlibc
19439
19440 : see if strerror_r exists
19441 set strerror_r d_strerror_r
19442 eval $inlibc
19443 case "$d_strerror_r" in
19444 "$define")
19445         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
19446         case "$d_strerror_r_proto:$usethreads" in
19447         ":define")      d_strerror_r_proto=define
19448                 set d_strerror_r_proto strerror_r $hdrs
19449                 eval $hasproto ;;
19450         *)      ;;
19451         esac
19452         case "$d_strerror_r_proto" in
19453         define)
19454         case "$strerror_r_proto" in
19455         ''|0) try='int strerror_r(int, char*, size_t);'
19456         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
19457         esac
19458         case "$strerror_r_proto" in
19459         ''|0) try='int strerror_r(int, char*, int);'
19460         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
19461         esac
19462         case "$strerror_r_proto" in
19463         ''|0) try='char* strerror_r(int, char*, size_t);'
19464         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
19465         esac
19466         case "$strerror_r_proto" in
19467         ''|0)   d_strerror_r=undef
19468                 strerror_r_proto=0
19469                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19470         * )     case "$strerror_r_proto" in
19471                 REENTRANT_PROTO*) ;;
19472                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19473                 esac
19474                 echo "Prototype: $try" ;;
19475         esac
19476         ;;
19477         *)      case "$usethreads" in
19478                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
19479                 esac
19480                 d_strerror_r=undef
19481                 strerror_r_proto=0
19482                 ;;
19483         esac
19484         ;;
19485 *)      strerror_r_proto=0
19486         ;;
19487 esac
19488
19489 : see if strftime exists
19490 set strftime d_strftime
19491 eval $inlibc
19492
19493 : see if strlcat exists
19494 set strlcat d_strlcat
19495 eval $inlibc
19496
19497 : see if strlcpy exists
19498 set strlcpy d_strlcpy
19499 eval $inlibc
19500
19501 : see if strtod exists
19502 set strtod d_strtod
19503 eval $inlibc
19504
19505 : see if strtol exists
19506 set strtol d_strtol
19507 eval $inlibc
19508
19509 : see if strtold exists
19510 set strtold d_strtold
19511 eval $inlibc
19512
19513 : see if strtoll exists
19514 set strtoll d_strtoll
19515 eval $inlibc
19516
19517 case "$d_longlong-$d_strtoll" in
19518 "$define-$define")
19519         $cat <<EOM
19520 Checking whether your strtoll() works okay...
19521 EOM
19522         $cat >try.c <<'EOCP'
19523 #include <errno.h>
19524 #ifdef __hpux
19525 #define strtoll __strtoll
19526 #endif
19527 #ifdef __EMX__
19528 #define strtoll _strtoll
19529 #endif
19530 #include <stdio.h>
19531 extern long long int strtoll(char *s, char **, int);
19532 static int bad = 0;
19533 int check(char *s, long long ell, int een) {
19534         long long gll;
19535         errno = 0;
19536         gll = strtoll(s, 0, 10);
19537         if (!((gll == ell) && (errno == een)))
19538                 bad++;
19539 }
19540 int main() {
19541         check(" 1",                                      1LL, 0);
19542         check(" 0",                                      0LL, 0);
19543         check("-1",                                     -1LL, 0);
19544         check("-9223372036854775808", -9223372036854775808LL, 0);
19545         check("-9223372036854775808", -9223372036854775808LL, 0);
19546         check(" 9223372036854775807",  9223372036854775807LL, 0);
19547         check("-9223372036854775808", -9223372036854775808LL, 0);
19548         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19549         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19550         if (!bad)
19551                 printf("ok\n");
19552 }
19553 EOCP
19554         set try
19555         if eval $compile; then
19556                 yyy=`$run ./try`
19557                 case "$yyy" in
19558                 ok) echo "Your strtoll() seems to be working okay." ;;
19559                 *) cat <<EOM >&4
19560 Your strtoll() doesn't seem to be working okay.
19561 EOM
19562                    d_strtoll="$undef"
19563                    ;;
19564                 esac
19565         else
19566                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19567                 d_strtoll="$undef"
19568         fi
19569         ;;
19570 esac
19571
19572 : see if strtoq exists
19573 set strtoq d_strtoq
19574 eval $inlibc
19575
19576 : see if strtoul exists
19577 set strtoul d_strtoul
19578 eval $inlibc
19579
19580 case "$d_strtoul" in
19581 "$define")
19582         $cat <<EOM
19583 Checking whether your strtoul() works okay...
19584 EOM
19585         $cat >try.c <<'EOCP'
19586 #include <errno.h>
19587 #include <stdio.h>
19588 extern unsigned long int strtoul(char *s, char **, int);
19589 static int bad = 0;
19590 void check(char *s, unsigned long eul, int een) {
19591         unsigned long gul;
19592         errno = 0;
19593         gul = strtoul(s, 0, 10);
19594         if (!((gul == eul) && (errno == een)))
19595                 bad++;
19596 }
19597 int main() {
19598         check(" 1", 1L, 0);
19599         check(" 0", 0L, 0);
19600 EOCP
19601         case "$longsize" in
19602         8)
19603             $cat >>try.c <<'EOCP'
19604         check("18446744073709551615", 18446744073709551615UL, 0);
19605         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19606 #if 0 /* strtoul() for /^-/ strings is undefined. */
19607         check("-1", 18446744073709551615UL, 0);
19608         check("-18446744073709551614", 2, 0);
19609         check("-18446744073709551615", 1, 0);
19610         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19611         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19612 #endif
19613 EOCP
19614                 ;;
19615         4)
19616                     $cat >>try.c <<'EOCP'
19617         check("4294967295", 4294967295UL, 0);
19618         check("4294967296", 4294967295UL, ERANGE);
19619 #if 0 /* strtoul() for /^-/ strings is undefined. */
19620         check("-1", 4294967295UL, 0);
19621         check("-4294967294", 2, 0);
19622         check("-4294967295", 1, 0);
19623         check("-4294967296", 4294967295UL, ERANGE);
19624         check("-4294967297", 4294967295UL, ERANGE);
19625 #endif
19626 EOCP
19627                 ;;
19628         *)
19629 : Should we write these tests to be more portable by sprintf-ing
19630 : ~0 and then manipulating that char string as input for strtol?
19631                 ;;
19632         esac
19633         $cat >>try.c <<'EOCP'
19634         if (!bad)
19635                 printf("ok\n");
19636         return 0;
19637 }
19638 EOCP
19639         set try
19640         if eval $compile; then
19641                 case "`$run ./try`" in
19642                 ok) echo "Your strtoul() seems to be working okay." ;;
19643                 *) cat <<EOM >&4
19644 Your strtoul() doesn't seem to be working okay.
19645 EOM
19646                    d_strtoul="$undef"
19647                    ;;
19648                 esac
19649         else
19650                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19651                 d_strtoul="$undef"
19652         fi
19653         ;;
19654 esac
19655
19656 : see if strtoull exists
19657 set strtoull d_strtoull
19658 eval $inlibc
19659
19660 case "$d_longlong-$d_strtoull" in
19661 "$define-$define")
19662         $cat <<EOM
19663 Checking whether your strtoull() works okay...
19664 EOM
19665         $cat >try.c <<'EOCP'
19666 #include <errno.h>
19667 #ifdef __hpux
19668 #define strtoull __strtoull
19669 #endif
19670 #include <stdio.h>
19671 extern unsigned long long int strtoull(char *s, char **, int);
19672 static int bad = 0;
19673 int check(char *s, long long eull, int een) {
19674         long long gull;
19675         errno = 0;
19676         gull = strtoull(s, 0, 10);
19677         if (!((gull == eull) && (errno == een)))
19678                 bad++;
19679 }
19680 int main() {
19681         check(" 1",                                        1LL, 0);
19682         check(" 0",                                        0LL, 0);
19683         check("18446744073709551615",  18446744073709551615ULL, 0);
19684         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19685 #if 0 /* strtoull() for /^-/ strings is undefined. */
19686         check("-1",                    18446744073709551615ULL, 0);
19687         check("-18446744073709551614",                     2LL, 0);
19688         check("-18446744073709551615",                     1LL, 0);
19689         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19690         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19691 #endif
19692         if (!bad)
19693                 printf("ok\n");
19694 }
19695 EOCP
19696         set try
19697         if eval $compile; then
19698                 case "`$run ./try`" in
19699                 ok) echo "Your strtoull() seems to be working okay." ;;
19700                 *) cat <<EOM >&4
19701 Your strtoull() doesn't seem to be working okay.
19702 EOM
19703                    d_strtoull="$undef"
19704                    ;;
19705                 esac
19706         else
19707                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19708                 d_strtoull="$undef"
19709         fi
19710         ;;
19711 esac
19712
19713 : see if strtouq exists
19714 set strtouq d_strtouq
19715 eval $inlibc
19716
19717 case "$d_strtouq" in
19718 "$define")
19719         $cat <<EOM
19720 Checking whether your strtouq() works okay...
19721 EOM
19722         $cat >try.c <<'EOCP'
19723 #include <errno.h>
19724 #include <stdio.h>
19725 extern unsigned long long int strtouq(char *s, char **, int);
19726 static int bad = 0;
19727 void check(char *s, unsigned long long eull, int een) {
19728         unsigned long long gull;
19729         errno = 0;
19730         gull = strtouq(s, 0, 10);
19731         if (!((gull == eull) && (errno == een)))
19732                 bad++;
19733 }
19734 int main() {
19735         check(" 1",                                        1LL, 0);
19736         check(" 0",                                        0LL, 0);
19737         check("18446744073709551615",  18446744073709551615ULL, 0);
19738         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19739 #if 0 /* strtouq() for /^-/ strings is undefined. */
19740         check("-1",                    18446744073709551615ULL, 0);
19741         check("-18446744073709551614",                     2LL, 0);
19742         check("-18446744073709551615",                     1LL, 0);
19743         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19744         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19745 #endif
19746         if (!bad)
19747                 printf("ok\n");
19748         return 0;
19749 }
19750 EOCP
19751         set try
19752         if eval $compile; then
19753                 case "`$run ./try`" in
19754                 ok) echo "Your strtouq() seems to be working okay." ;;
19755                 *) cat <<EOM >&4
19756 Your strtouq() doesn't seem to be working okay.
19757 EOM
19758                    d_strtouq="$undef"
19759                    ;;
19760                 esac
19761         else
19762                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19763                 d_strtouq="$undef"
19764         fi
19765         ;;
19766 esac
19767
19768 : see if strxfrm exists
19769 set strxfrm d_strxfrm
19770 eval $inlibc
19771
19772 : see if symlink exists
19773 set symlink d_symlink
19774 eval $inlibc
19775
19776 : see if syscall exists
19777 set syscall d_syscall
19778 eval $inlibc
19779
19780 : see if prototype for syscall is available
19781 echo " "
19782 set d_syscallproto syscall $i_unistd unistd.h
19783 eval $hasproto
19784
19785 : see if sysconf exists
19786 set sysconf d_sysconf
19787 eval $inlibc
19788
19789 : see if system exists
19790 set system d_system
19791 eval $inlibc
19792
19793 : see if tcgetpgrp exists
19794 set tcgetpgrp d_tcgetpgrp
19795 eval $inlibc
19796
19797 : see if tcsetpgrp exists
19798 set tcsetpgrp d_tcsetpgrp
19799 eval $inlibc
19800
19801 : see if prototype for telldir is available
19802 echo " "
19803 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19804 eval $hasproto
19805
19806 : see if tgamma exists
19807 set tgamma d_tgamma
19808 eval $inlibc
19809
19810 : see if time exists
19811 echo " "
19812 if test "X$d_time" = X -o X"$timetype" = X; then
19813     if set time val -f d_time; eval $csym; $val; then
19814                 echo 'time() found.' >&4
19815                 val="$define"
19816                 rp="What is the type returned by time() on this system?"
19817                 set time_t timetype long stdio.h sys/types.h
19818                 eval $typedef_ask
19819     else
19820                 echo 'time() not found, hope that will do.' >&4
19821                 val="$undef"
19822                 timetype='int';
19823     fi
19824     set d_time
19825     eval $setvar
19826 fi
19827
19828 : see if timegm exists
19829 set timegm d_timegm
19830 eval $inlibc
19831
19832 : see if this is a sys/times.h system
19833 set sys/times.h i_systimes
19834 eval $inhdr
19835
19836 : see if times exists
19837 echo " "
19838 if set times val -f d_times; eval $csym; $val; then
19839         echo 'times() found.' >&4
19840         d_times="$define"
19841         inc=''
19842         case "$i_systimes" in
19843         "$define") inc='sys/times.h';;
19844         esac
19845         rp="What is the type returned by times() on this system?"
19846         set clock_t clocktype long stdio.h sys/types.h $inc
19847         eval $typedef_ask
19848 else
19849         echo 'times() NOT found, hope that will do.' >&4
19850         d_times="$undef"
19851         clocktype='int'
19852 fi
19853
19854 : see if tmpnam_r exists
19855 set tmpnam_r d_tmpnam_r
19856 eval $inlibc
19857 case "$d_tmpnam_r" in
19858 "$define")
19859         hdrs="$i_systypes sys/types.h define stdio.h "
19860         case "$d_tmpnam_r_proto:$usethreads" in
19861         ":define")      d_tmpnam_r_proto=define
19862                 set d_tmpnam_r_proto tmpnam_r $hdrs
19863                 eval $hasproto ;;
19864         *)      ;;
19865         esac
19866         case "$d_tmpnam_r_proto" in
19867         define)
19868         case "$tmpnam_r_proto" in
19869         ''|0) try='char* tmpnam_r(char*);'
19870         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19871         esac
19872         case "$tmpnam_r_proto" in
19873         ''|0)   d_tmpnam_r=undef
19874                 tmpnam_r_proto=0
19875                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19876         * )     case "$tmpnam_r_proto" in
19877                 REENTRANT_PROTO*) ;;
19878                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19879                 esac
19880                 echo "Prototype: $try" ;;
19881         esac
19882         ;;
19883         *)      case "$usethreads" in
19884                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19885                 esac
19886                 d_tmpnam_r=undef
19887                 tmpnam_r_proto=0
19888                 ;;
19889         esac
19890         ;;
19891 *)      tmpnam_r_proto=0
19892         ;;
19893 esac
19894
19895 : see if trunc exists
19896 set trunc d_trunc
19897 eval $inlibc
19898
19899 : see if truncate exists
19900 set truncate d_truncate
19901 eval $inlibc
19902
19903 : see if ttyname_r exists
19904 set ttyname_r d_ttyname_r
19905 eval $inlibc
19906 case "$d_ttyname_r" in
19907 "$define")
19908         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19909         case "$d_ttyname_r_proto:$usethreads" in
19910         ":define")      d_ttyname_r_proto=define
19911                 set d_ttyname_r_proto ttyname_r $hdrs
19912                 eval $hasproto ;;
19913         *)      ;;
19914         esac
19915         case "$d_ttyname_r_proto" in
19916         define)
19917         case "$ttyname_r_proto" in
19918         ''|0) try='int ttyname_r(int, char*, size_t);'
19919         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19920         esac
19921         case "$ttyname_r_proto" in
19922         ''|0) try='int ttyname_r(int, char*, int);'
19923         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19924         esac
19925         case "$ttyname_r_proto" in
19926         ''|0) try='char* ttyname_r(int, char*, int);'
19927         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19928         esac
19929         case "$ttyname_r_proto" in
19930         ''|0)   d_ttyname_r=undef
19931                 ttyname_r_proto=0
19932                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19933         * )     case "$ttyname_r_proto" in
19934                 REENTRANT_PROTO*) ;;
19935                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19936                 esac
19937                 echo "Prototype: $try" ;;
19938         esac
19939         ;;
19940         *)      case "$usethreads" in
19941                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19942                 esac
19943                 d_ttyname_r=undef
19944                 ttyname_r_proto=0
19945                 ;;
19946         esac
19947         ;;
19948 *)      ttyname_r_proto=0
19949         ;;
19950 esac
19951
19952 : see if tzname[] exists
19953 echo " "
19954 if set tzname val -a d_tzname; eval $csym; $val; then
19955         val="$define"
19956         echo 'tzname[] found.' >&4
19957 else
19958         val="$undef"
19959         echo 'tzname[] NOT found.' >&4
19960 fi
19961 set d_tzname
19962 eval $setvar
19963
19964 : Check if is a multiplatform env
19965 case "$osname" in
19966 darwin) multiarch="$define" ;;
19967 esac
19968 case "$multiarch" in
19969 ''|[nN]*) multiarch="$undef" ;;
19970 esac
19971
19972 : check for ordering of bytes in a UV
19973 echo " "
19974 case "$multiarch" in
19975 *$define*)
19976         $cat <<EOM
19977 You seem to be doing a multiarchitecture build,
19978 skipping the byteorder check.
19979
19980 EOM
19981         byteorder='ffff'
19982         ;;
19983 *)
19984         case "$byteorder" in
19985         '')
19986                 $cat <<'EOM'
19987 In the following, larger digits indicate more significance.  A big-endian
19988 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19989 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19990 machines may have weird orders like 3412.  A Cray will report 87654321,
19991 an Alpha will report 12345678. If the test program works the default is
19992 probably right.
19993 I'm now running the test program...
19994 EOM
19995                 $cat >try.c <<EOCP
19996 #include <stdio.h>
19997 #$i_stdlib I_STDLIB
19998 #ifdef I_STDLIB
19999 #include <stdlib.h>
20000 #endif
20001 #include <sys/types.h>
20002 typedef $uvtype UV;
20003 int main()
20004 {
20005         int i;
20006         union {
20007                 UV l;
20008                 char c[$uvsize];
20009         } u;
20010
20011         if ($uvsize > 4)
20012                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
20013         else
20014                 u.l = (UV)0x04030201;
20015         for (i = 0; i < $uvsize; i++)
20016                 printf("%c", u.c[i]+'0');
20017         printf("\n");
20018         exit(0);
20019 }
20020 EOCP
20021                 xxx_prompt=y
20022                 set try
20023                 if eval $compile && $run ./try > /dev/null; then
20024                         dflt=`$run ./try`
20025                         case "$dflt" in
20026                         [1-4][1-4][1-4][1-4]|12345678|87654321)
20027                                 echo "(The test program ran ok.)"
20028                                 echo "byteorder=$dflt"
20029                                 xxx_prompt=n
20030                         ;;
20031                         ????|????????) echo "(The test program ran ok.)" ;;
20032                         *) echo "(The test program didn't run right for some reason.)" ;;
20033                         esac
20034                 else
20035                         dflt='4321'
20036                         cat <<'EOM'
20037 (I can't seem to compile the test program.  Guessing big-endian...)
20038 EOM
20039                 fi
20040                 case "$xxx_prompt" in
20041                 y)
20042                         rp="What is the order of bytes in $uvtype?"
20043                         . ./myread
20044                         byteorder="$ans"
20045                         ;;
20046                 *)      byteorder=$dflt
20047                         ;;
20048                 esac
20049                 ;;
20050         esac
20051         $rm_try
20052         ;;
20053 esac
20054
20055 : Checking 32bit alignedness
20056 $cat <<EOM
20057
20058 Checking to see whether you can access character data unalignedly...
20059 EOM
20060 case "$d_u32align" in
20061 '')   $cat >try.c <<EOCP
20062 #include <stdio.h>
20063 #$i_stdlib I_STDLIB
20064 #ifdef I_STDLIB
20065 #include <stdlib.h>
20066 #endif
20067 #define U32 $u32type
20068 #define BYTEORDER 0x$byteorder
20069 #define U8 $u8type
20070 #include <signal.h>
20071 #ifdef SIGBUS
20072 $signal_t bletch(int s) { exit(4); }
20073 #endif
20074 int main() {
20075 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
20076     volatile U8 buf[8];
20077     volatile U32 *up;
20078     int i;
20079
20080     if (sizeof(U32) != 4) {
20081         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
20082         exit(1);
20083     }
20084
20085     fflush(stdout);
20086
20087 #ifdef SIGBUS
20088     signal(SIGBUS, bletch);
20089 #endif
20090
20091     buf[0] = 0;
20092     buf[1] = 0;
20093     buf[2] = 0;
20094     buf[3] = 1;
20095     buf[4] = 0;
20096     buf[5] = 0;
20097     buf[6] = 0;
20098     buf[7] = 1;
20099
20100     for (i = 0; i < 4; i++) {
20101         up = (U32*)(buf + i);
20102         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
20103                (*up == 1 << (8*(3-i)))  /* little-endian */
20104               )
20105            )
20106         {
20107             printf("read failed (%x)\n", *up);
20108             exit(2);
20109         }
20110     }
20111
20112     /* write test */
20113     for (i = 0; i < 4; i++) {
20114         up = (U32*)(buf + i);
20115         *up = 0xBeef;
20116         if (*up != 0xBeef) {
20117             printf("write failed (%x)\n", *up);
20118             exit(3);
20119         }
20120     }
20121
20122     exit(0);
20123 #else
20124     printf("1\n");
20125     exit(1);
20126 #endif
20127     return 0;
20128 }
20129 EOCP
20130 set try
20131 if eval $compile_ok; then
20132         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
20133         $run ./try 2>&1 >/dev/null
20134         case "$?" in
20135         0)      cat >&4 <<EOM
20136 You can access character data pretty unalignedly.
20137 EOM
20138                 d_u32align="$undef"
20139                 ;;
20140         *)      cat >&4 <<EOM
20141 It seems that you must access character data in an aligned manner.
20142 EOM
20143                 d_u32align="$define"
20144                 ;;
20145         esac
20146 else
20147         rp='Can you access character data at unaligned addresses?'
20148         dflt='n'
20149         . ./myread
20150         case "$ans" in
20151         [yY]*)  d_u32align="$undef"  ;;
20152         *)      d_u32align="$define" ;;
20153         esac
20154 fi
20155 $rm_try
20156 ;;
20157 esac
20158
20159 : see if ualarm exists
20160 set ualarm d_ualarm
20161 eval $inlibc
20162
20163 : see if umask exists
20164 set umask d_umask
20165 eval $inlibc
20166
20167 : see if unordered exists
20168 set unordered d_unordered
20169 eval $inlibc
20170
20171 : see if unsetenv exists
20172 set unsetenv d_unsetenv
20173 eval $inlibc
20174
20175 : see if usleep exists
20176 set usleep d_usleep
20177 eval $inlibc
20178
20179 : see if prototype for usleep is available
20180 echo " "
20181 set d_usleepproto usleep $i_unistd unistd.h
20182 eval $hasproto
20183
20184 : see if ustat exists
20185 set ustat d_ustat
20186 eval $inlibc
20187
20188 : see if closedir exists
20189 set closedir d_closedir
20190 eval $inlibc
20191
20192 case "$d_closedir" in
20193 "$define")
20194         echo " "
20195         echo "Checking whether closedir() returns a status..." >&4
20196         cat > try.c <<EOM
20197 #$i_dirent I_DIRENT             /**/
20198 #$i_sysdir I_SYS_DIR            /**/
20199 #$i_sysndir I_SYS_NDIR          /**/
20200 #$i_systypes I_SYS_TYPES        /**/
20201
20202 #if defined(I_SYS_TYPES)
20203 #include <sys/types.h>
20204 #endif
20205 #if defined(I_DIRENT)
20206 #include <dirent.h>
20207 #else
20208 #ifdef I_SYS_NDIR
20209 #include <sys/ndir.h>
20210 #else
20211 #ifdef I_SYS_DIR
20212 #ifdef hp9000s500
20213 #include <ndir.h>       /* may be wrong in the future */
20214 #else
20215 #include <sys/dir.h>
20216 #endif
20217 #endif
20218 #endif
20219 #endif
20220 int main() { return closedir(opendir(".")); }
20221 EOM
20222         set try
20223         if eval $compile_ok; then
20224                 if $run ./try > /dev/null 2>&1 ; then
20225                         echo "Yes, it does."
20226                         val="$undef"
20227                 else
20228                         echo "No, it doesn't."
20229                         val="$define"
20230                 fi
20231         else
20232                 echo "(I can't seem to compile the test program--assuming it doesn't)"
20233                 val="$define"
20234         fi
20235         ;;
20236 *)
20237         val="$undef";
20238         ;;
20239 esac
20240 set d_void_closedir
20241 eval $setvar
20242 $rm_try
20243
20244 : see if there is a wait4
20245 set wait4 d_wait4
20246 eval $inlibc
20247
20248 : see if waitpid exists
20249 set waitpid d_waitpid
20250 eval $inlibc
20251
20252 : look for wcscmp
20253 echo " "
20254 $cat >try.c <<'EOCP'
20255 #include <stdio.h>
20256 #include <wchar.h>
20257 int main ()
20258 {
20259     wchar_t *s = L" ";
20260     return (wcscmp (s, s) ? 1 : 0);
20261     }
20262 EOCP
20263 set try
20264 val="$undef"
20265 if eval $compile; then
20266     `$run ./try`
20267     case "$?" in
20268         0)  echo "A working wcscmp() found." >&4
20269             val="$define" ;;
20270         *)  echo "wcscmp() found, but it doesn't work" >&4
20271             ;;
20272         esac
20273 else
20274     echo "wcscmp() NOT found." >&4
20275     fi
20276 set d_wcscmp
20277 eval $setvar
20278 $rm_try
20279
20280 : see if wcstombs exists
20281 set wcstombs d_wcstombs
20282 eval $inlibc
20283
20284 : look for wcsxfrm
20285 echo " "
20286 $cat >try.c <<'EOCP'
20287 #include <errno.h>
20288 #include <wchar.h>
20289 int main ()
20290 {
20291     wchar_t dst[4], *src = L" ";
20292     errno = 0;
20293     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
20294     }
20295 EOCP
20296 set try
20297 val="$undef"
20298 if eval $compile; then
20299     `$run ./try`
20300     case "$?" in
20301         0)  echo "A working wcsxfrm() found." >&4
20302             val="$define" ;;
20303         *)  echo "wcsxfrm() found, but it doesn't work" >&4
20304             ;;
20305         esac
20306 else
20307     echo "wcsxfrm() NOT found." >&4
20308     fi
20309 set d_wcsxfrm
20310 eval $setvar
20311 $rm_try
20312
20313 : see if wctomb exists
20314 set wctomb d_wctomb
20315 eval $inlibc
20316
20317 : see if writev exists
20318 set writev d_writev
20319 eval $inlibc
20320
20321 : check for alignment requirements
20322 echo " "
20323 case "$alignbytes" in
20324     '') echo "Checking alignment constraints..." >&4
20325         $cat >try.c <<EOCP
20326 #include <stdio.h>
20327 struct foobar {
20328     char foo;
20329     $nvtype bar;
20330 } try_algn;
20331 int main()
20332 {
20333     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20334     return(0);
20335 }
20336 EOCP
20337         set try
20338         if eval $compile_ok; then
20339             dflt=`$run ./try`
20340         else
20341             dflt='8'
20342             echo "(I can't seem to compile the test program...)"
20343         fi
20344         case "$multiarch" in
20345             *$define*)
20346                 : The usual safe value is 8, but Darwin with -Duselongdouble
20347                 : needs 16.  Hence, we will take 8 as a minimum, but allow
20348                 : Configure to pick a larger value if needed.
20349                 if $test "$dflt" -lt 8; then
20350                     dflt='8'
20351                     echo "Setting alignment to 8 for multiarch support.">&4
20352                 fi
20353                 ;;
20354         esac
20355         ;;
20356     *) dflt="$alignbytes"
20357         ;;
20358 esac
20359 rp="Doubles must be aligned on a how-many-byte boundary?"
20360 . ./myread
20361 alignbytes="$ans"
20362 $rm_try
20363
20364 : set the base revision
20365 baserev=5.0
20366
20367 : length of character in bytes. Is always 1, otherwise it is not C
20368 : This used to be a test using sizeof
20369 charsize=1
20370
20371 : Check for the number of bits in a character
20372 case "$charbits" in
20373 '')     echo "Checking how long a character is (in bits)..." >&4
20374         $cat >try.c <<EOCP
20375 #include <stdio.h>
20376 int main ()
20377 {
20378     int n;
20379     unsigned char c;
20380     for (c = 1, n = 0; c; c <<= 1, n++) ;
20381     printf ("%d\n", n);
20382     return (0);
20383     }
20384 EOCP
20385         set try
20386         if eval $compile_ok; then
20387                 dflt=`$run ./try`
20388         else
20389                 dflt='8'
20390                 echo "(I can't seem to compile the test program.  Guessing...)"
20391         fi
20392         ;;
20393 *)
20394         dflt="$charbits"
20395         ;;
20396 esac
20397 rp="What is the length of a character (in bits)?"
20398 . ./myread
20399 charbits="$ans"
20400 $rm_try
20401 case "$charbits" in
20402 8)      ;;
20403 *)      cat >&4 << EOM
20404 Your system has an unsigned character size of $charbits bits, which
20405 is rather unusual (normally it is 8 bits).  Perl likely will not work
20406 correctly on your system, with subtle bugs in various places.
20407 EOM
20408         rp='Do you really want to continue?'
20409         dflt='n'
20410         . ./myread
20411         case "$ans" in
20412                 [yY])   echo >&4 "Okay, continuing."    ;;
20413                 *)      exit 1                          ;;
20414         esac
20415 esac
20416
20417 : how do we concatenate cpp tokens here?
20418 echo " "
20419 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20420 $cat >cpp_stuff.c <<'EOCP'
20421 #define RCAT(a,b)a/**/b
20422 #define ACAT(a,b)a ## b
20423 RCAT(Rei,ser)
20424 ACAT(Cir,cus)
20425 EOCP
20426 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20427 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20428         echo "Oh!  Smells like ANSI's been here." >&4
20429         echo "We can catify or stringify, separately or together!"
20430         cpp_stuff=42
20431 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20432         echo "Ah, yes!  The good old days!" >&4
20433         echo "However, in the good old days we don't know how to stringify and"
20434         echo "catify at the same time."
20435         cpp_stuff=1
20436 else
20437         $cat >&4 <<EOM
20438 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20439 You're going to have to edit the values of CAT[2-5] in config.h...
20440 EOM
20441         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20442 fi
20443 $rm -f cpp_stuff.*
20444
20445 : see if this is a db.h system
20446 set db.h i_db
20447 eval $inhdr
20448
20449 case "$i_db" in
20450 $define)
20451         : Check db version.
20452         echo " "
20453         echo "Checking Berkeley DB version ..." >&4
20454         $cat >try.c <<EOCP
20455 #$d_const HASCONST
20456 #ifndef HASCONST
20457 #define const
20458 #endif
20459 #include <sys/types.h>
20460 #include <stdio.h>
20461 #$i_stdlib I_STDLIB
20462 #ifdef I_STDLIB
20463 #include <stdlib.h>
20464 #endif
20465 #include <db.h>
20466 int main(int argc, char *argv[])
20467 {
20468 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20469     int Major, Minor, Patch ;
20470     unsigned long Version ;
20471     (void)db_version(&Major, &Minor, &Patch) ;
20472     if (argc == 2) {
20473         printf("%d %d %d %d %d %d\n",
20474                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20475                Major, Minor, Patch);
20476         exit(0);
20477     }
20478     printf("You have Berkeley DB Version 2 or greater.\n");
20479
20480     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20481                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20482     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20483                 Major, Minor, Patch) ;
20484
20485     /* check that db.h & libdb are compatible */
20486     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20487         printf("db.h and libdb are incompatible.\n") ;
20488         exit(3);
20489     }
20490
20491     printf("db.h and libdb are compatible.\n") ;
20492
20493     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20494                 + DB_VERSION_PATCH ;
20495
20496     /* needs to be >= 2.3.4 */
20497     if (Version < 2003004) {
20498     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20499         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20500         exit(2);
20501     }
20502
20503     exit(0);
20504 #else
20505 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20506     if (argc == 2) {
20507         printf("1 0 0\n");
20508         exit(0);
20509     }
20510     printf("You have Berkeley DB Version 1.\n");
20511     exit(0);    /* DB version < 2: the coast is clear. */
20512 #else
20513     exit(1);    /* <db.h> not Berkeley DB? */
20514 #endif
20515 #endif
20516 }
20517 EOCP
20518         set try
20519         if eval $compile_ok && $run ./try; then
20520                 echo 'Looks OK.' >&4
20521                 set `$run ./try 1`
20522                 db_version_major=$1
20523                 db_version_minor=$2
20524                 db_version_patch=$3
20525         else
20526                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20527                 i_db=$undef
20528                 case " $libs " in
20529                 *"-ldb "*)
20530                         : Remove db from list of libraries to use
20531                         echo "Removing unusable -ldb from library list" >&4
20532                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20533                         shift
20534                         libs="$*"
20535                         echo "libs = $libs" >&4
20536                         ;;
20537                 esac
20538         fi
20539         $rm_try
20540         ;;
20541 esac
20542
20543 case "$i_db" in
20544 define)
20545         : Check the return type needed for hash
20546         echo " "
20547         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20548         $cat >try.c <<EOCP
20549 #$d_const HASCONST
20550 #ifndef HASCONST
20551 #define const
20552 #endif
20553 #include <sys/types.h>
20554 #include <db.h>
20555
20556 #ifndef DB_VERSION_MAJOR
20557 u_int32_t hash_cb (const void* ptr, size_t size)
20558 {
20559 }
20560 HASHINFO info;
20561 int main()
20562 {
20563         info.hash = hash_cb;
20564 }
20565 #endif
20566 EOCP
20567         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20568                 if $contains warning try.out >>/dev/null 2>&1 ; then
20569                         db_hashtype='int'
20570                 else
20571                         db_hashtype='u_int32_t'
20572                 fi
20573         else
20574                 : XXX Maybe we should just give up here.
20575                 db_hashtype=u_int32_t
20576                 $cat try.out >&4
20577                 echo "Help:  I can't seem to compile the db test program." >&4
20578                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20579         fi
20580         $rm_try
20581         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20582         ;;
20583 *)      db_hashtype=u_int32_t
20584         ;;
20585 esac
20586 case "$i_db" in
20587 define)
20588         : Check the return type needed for prefix
20589         echo " "
20590         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20591         cat >try.c <<EOCP
20592 #$d_const HASCONST
20593 #ifndef HASCONST
20594 #define const
20595 #endif
20596 #include <sys/types.h>
20597 #include <db.h>
20598
20599 #ifndef DB_VERSION_MAJOR
20600 size_t prefix_cb (const DBT *key1, const DBT *key2)
20601 {
20602 }
20603 BTREEINFO info;
20604 int main()
20605 {
20606         info.prefix = prefix_cb;
20607 }
20608 #endif
20609 EOCP
20610         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20611                 if $contains warning try.out >>/dev/null 2>&1 ; then
20612                         db_prefixtype='int'
20613                 else
20614                         db_prefixtype='size_t'
20615                 fi
20616         else
20617                 db_prefixtype='size_t'
20618                 : XXX Maybe we should just give up here.
20619                 $cat try.out >&4
20620                 echo "Help:  I can't seem to compile the db test program." >&4
20621                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20622         fi
20623         $rm_try
20624         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20625         ;;
20626 *)      db_prefixtype='size_t'
20627         ;;
20628 esac
20629
20630 : Include . in @INC
20631 $cat <<EOM
20632
20633 Historically Perl has provided a final fallback of the current working
20634 directory '.' when searching for a library. This, however, can lead to
20635 problems when a Perl program which loads optional modules is called from
20636 a shared directory. This can lead to executing unexpected code.
20637
20638 EOM
20639
20640 # When changing to exclude by default:
20641 case "$default_inc_excludes_dot" in
20642     $undef|false|[nN]*) dflt="n" ;;
20643     *)                  dflt="y" ;;
20644 esac
20645 # To turn exclude off by default:
20646 #case "$default_inc_excludes_dot" in
20647 #    $define|true|[yY]*) dflt="y" ;;
20648 #    *)                  dflt="n" ;;
20649 #esac
20650
20651 rp='Exclude '.' from @INC by default? '
20652 . ./myread
20653 case "$ans" in
20654     [nN]|undef) default_inc_excludes_dot="$undef"  ;;
20655     *)          default_inc_excludes_dot="$define" ;;
20656 esac
20657
20658 : Check what kind of inf/nan your system has
20659 $echo "Checking the kind of infinities and nans you have..." >&4
20660 $echo "(The following tests may crash.  That's okay.)" >&4
20661 $cat >try.c <<EOP
20662 #define DOUBLESIZE $doublesize
20663 #$d_longdbl HAS_LONG_DOUBLE
20664 #ifdef HAS_LONG_DOUBLE
20665 #define LONG_DOUBLESIZE $longdblsize
20666 #define LONG_DOUBLEKIND $longdblkind
20667 #endif
20668 #$i_math I_MATH
20669 #$i_string I_STRING
20670 #ifdef I_MATH
20671 #include <math.h>
20672 #endif
20673 #ifdef I_STRING
20674 #  include <string.h>
20675 #endif
20676 #include <stdio.h>
20677 /* Note that whether the sign bit is on or off
20678  * for NaN depends on the CPU/FPU, and possibly
20679  * can be affected by the build toolchain.
20680  *
20681  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20682  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20683  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20684  * (respectively) as opposed to the more usual
20685  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20686  *
20687  * Pre-IEEE-754 floating point format do not even have inf/nan support
20688  * at all.  They might have a "max" value (DBL_MAX), which may be deadly
20689  * to even mention, causing immediate SIGFPE or equivalent: this is
20690  * the case with VAX floating point, for example.
20691  */
20692 static void bytes(void *v, unsigned int n) {
20693   unsigned char *p = (unsigned char *)v;
20694   int i;
20695   for (i = 0; i < n; i++) {
20696     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20697   }
20698 }
20699 int main(int argc, char *argv[]) {
20700    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20701     * because some compilers are 'smart' and not only warn but refuse to
20702     * compile such 'illegal' values. */
20703    double dinf = exp(1e9);
20704    double dnan = sqrt(-1.0);
20705 #ifdef HAS_LONG_DOUBLE
20706    long double ldinf = (long double)exp(1e9);
20707    long double ldnan = (long double)sqrt(-1.0);
20708 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20709 /* the 80-bit long doubles might have garbage in their excess bytes */
20710     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20711     memset((char *)&ldnan + 10, '\0', LONG_DOUBLESIZE - 10);
20712 # endif
20713   if (argc == 2) {
20714     switch (argv[1][0]) {
20715     case '1': bytes(&dinf, sizeof(dinf)); break;
20716     case '2': bytes(&dnan, sizeof(dnan)); break;
20717     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20718     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20719 #endif
20720     }
20721   }
20722   return 0;
20723 }
20724 EOP
20725 set try
20726 if eval $compile; then
20727     doubleinfbytes=`$run ./try 1`
20728     doublenanbytes=`$run ./try 2`
20729     case "$d_longdbl" in
20730     $define)
20731       longdblinfbytes=`$run ./try 3`
20732       longdblnanbytes=`$run ./try 4`
20733       ;;
20734     esac
20735 else
20736     # Defaults in case the above test program failed.
20737     case "$doublekind" in
20738     1) # IEEE 754 32-bit LE
20739        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20740        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20741        ;;
20742     2) # IEEE 754 32-bit BE
20743        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20744        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20745        ;;
20746     3) # IEEE 754 64-bit LE
20747        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20748        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20749        ;;
20750     4) # IEEE 754 64-bit BE
20751        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20752        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20753        ;;
20754     5) # IEEE 754 128-bit LE
20755        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20756        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20757        ;;
20758     6) # IEEE 754 128-bit BE
20759        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20760        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20761        ;;
20762     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20763        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20764        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20765        ;;
20766     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20767        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20768        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20769        ;;
20770     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20771        doubleinfbytes=$undef
20772        doublenanbytes=$undef
20773        ;;
20774     *) # No idea.
20775        doubleinfbytes=$undef
20776        doublenanbytes=$undef
20777        ;;
20778     esac
20779     case "$longdblkind" in
20780     1) # IEEE 754 128-bit LE
20781        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20782        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20783        ;;
20784     2) # IEEE 754 128-bit BE
20785        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20786        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20787        ;;
20788     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20789        case "$longdblsize" in
20790        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20791            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20792            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20793            ;;
20794        16) # x86_64
20795            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20796            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20797            ;;
20798        *)  # No idea.
20799            longdblinfbytes=$undef
20800            longdblnanbytes=$undef
20801        ;;
20802        esac
20803        ;;
20804     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20805        case "$longdblsize" in
20806        12) # 32-bit system
20807            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20808            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20809            ;;
20810        16) # 64-bit system
20811            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20812            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20813            ;;
20814        *)  # No idea.
20815            longdblinfbytes=$undef
20816            longdblnanbytes=$undef
20817        ;;
20818        esac
20819        ;;
20820     5) # 128-bit LE-LE "double double"
20821        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20822        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20823        ;;
20824     6) # 128-bit BE-BE "double double"
20825        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20826        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20827        ;;
20828     7) # 128-bit LE-BE "double double"
20829        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20830        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20831        ;;
20832     8) # 128-bit BE-LE "double double"
20833        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20834        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20835        ;;
20836     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20837        longdblinfbytes=$undef
20838        longdblnanbytes=$undef
20839        ;;
20840     *) # No idea.
20841        longdblinfbytes=$undef
20842        longdblnanbytes=$undef
20843        ;;
20844     esac
20845 fi
20846 # In case the program crashed the values are empty, turn them undef.
20847 case "$doubleinfbytes" in
20848 '') doubleinfbytes=$undef ;;
20849 esac
20850 case "$doublenanbytes" in
20851 '') doublenanbytes=$undef ;;
20852 esac
20853 case "$longdblinfbytes" in
20854 '') longdblinfbytes=$undef ;;
20855 esac
20856 case "$longdblnanbytes" in
20857 '') longdblnanbytes=$undef ;;
20858 esac
20859 $rm_try
20860
20861 : Check the length of the double mantissa
20862 $echo "Checking how many mantissa bits your doubles have..." >&4
20863 $cat >try.c <<EOP
20864 #$i_float I_FLOAT
20865 #$i_sunmath I_SUNMATH
20866 #ifdef I_FLOAT
20867 # include <float.h>
20868 #endif
20869 #ifdef I_SUNMATH
20870 # include <sunmath.h>
20871 #endif
20872 #ifdef DBL_MANT_DIG
20873 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20874 #endif
20875 #include <stdio.h>
20876 int main(int argc, char *argv[]) {
20877 #ifdef BITS
20878   printf("%d\n", BITS);
20879 #endif
20880   return 0;
20881 }
20882 EOP
20883 set try
20884 if eval $compile; then
20885     doublemantbits=`$run ./try`
20886 else
20887     doublemantbits="$undef"
20888 fi
20889 $rm_try
20890
20891 : Check the length of the longdouble mantissa
20892 $echo "Checking how many mantissa bits your long doubles have..." >&4
20893 $cat >try.c <<EOP
20894 #$i_float I_FLOAT
20895 #$i_sunmath I_SUNMATH
20896 #ifdef I_FLOAT
20897 # include <float.h>
20898 #endif
20899 #ifdef I_SUNMATH
20900 # include <sunmath.h>
20901 #endif
20902 #$d_longdbl HAS_LONG_DOUBLE
20903 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20904 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20905 /* This format has no implicit bit.  Beware, however, that for
20906  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20907  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20908  * and the top bit must have been one since 387, zero is plain invalid.
20909  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20910 #  define BITS LDBL_MANT_DIG
20911 # elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
20912 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20913  * reason e.g. Irix thinks 107.  But in any case, we want only
20914  * the number of real bits, the implicit bits are of no interest.  */
20915 #  define BITS 2 * (DBL_MANT_DIG - 1)
20916 # else
20917 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20918 # endif
20919 #endif
20920 #include <stdio.h>
20921 int main(int argc, char *argv[]) {
20922 #ifdef BITS
20923   printf("%d\n", BITS);
20924 #endif
20925   return 0;
20926 }
20927 EOP
20928 set try
20929 if eval $compile; then
20930     longdblmantbits=`$run ./try`
20931 else
20932     longdblmantbits="$undef"
20933 fi
20934 $rm_try
20935
20936 : Check the length of the NV mantissa
20937 $echo "Checking how many mantissa bits your NVs have..." >&4
20938 if test "X$usequadmath" = "X$define"; then
20939   nvmantbits=112 # 128-1-15
20940 else
20941   if test "X$nvsize" = "X$doublesize"; then
20942     nvmantbits="$doublemantbits"
20943   else
20944      if test "X$nvsize" = "X$longdblsize"; then
20945        nvmantbits="$longdblmantbits"
20946      else
20947        nvmantbits="$undef"
20948      fi
20949   fi
20950 fi
20951
20952 : How can we generate normalized random numbers ?
20953 echo " "
20954 echo "Using our internal random number implementation..." >&4
20955
20956 case "$ccflags" in
20957 *-Dmy_rand=*|*-Dmy_srand=*)
20958         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20959         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20960         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20961         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20962         ;;
20963 esac
20964
20965 randfunc=Perl_drand48
20966 drand01="Perl_drand48()"
20967 seedfunc="Perl_drand48_init"
20968 randbits=48
20969 randseedtype=U32
20970
20971 : Probe whether dtrace builds an object, as newer Illumos requires an input
20972 : object file that uses at least one of the probes defined in the .d file
20973 case "$usedtrace" in
20974 $define)
20975     case "$dtracexnolibs" in
20976     $define|true|[yY]*)
20977         dtracexnolibs=$define
20978         $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h
20979         ;;
20980     ' '|'')
20981         if $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20982              dtracexnolibs=$define
20983              echo "Your dtrace accepts -xnolibs"
20984         elif $dtrace -h -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20985              dtracexnolibs=$undef
20986              echo "Your dtrace doesn't accept -xnolibs"
20987         else
20988              echo "Your dtrace doesn't work at all, try building without dtrace support" >&4
20989              exit 1
20990         fi
20991         ;;
20992     *)
20993         dtracexnolibs=$undef
20994         $dtrace -h -s ../perldtrace.d -o perldtrace.h
20995         ;;
20996     esac
20997     case $dtracexnolibs in
20998     $define) xnolibs=-xnolibs ;;
20999     *) xnolibs= ;;
21000     esac
21001
21002     case "$dtraceobject" in
21003     $define|true|[yY]*)
21004         dtraceobject=$define
21005         ;;
21006     ' '|'')
21007         $cat >try.c <<EOM
21008 #include "perldtrace.h"
21009 int main(void) {
21010     PERL_LOADED_FILE("dummy");
21011     return 0;
21012 }
21013 EOM
21014         dtraceobject=$undef
21015         if $cc -c -o try.o $optimize $ccflags try.c \
21016                     && $dtrace -G $xnolibs -s ../perldtrace.d try.o >/dev/null 2>&1; then
21017                 dtraceobject=$define
21018             echo "Your dtrace builds an object file"
21019         fi
21020         ;;
21021     *) dtraceobject=$undef ;;
21022     esac
21023     $rm_try perldtrace.o perldtrace.h
21024 esac
21025
21026 : Determine if this is an EBCDIC system
21027 echo " "
21028 echo "Determining whether or not we are on an EBCDIC system..." >&4
21029 $cat >try.c <<'EOM'
21030 int main()
21031 {
21032   if ('M'==0xd4) return 0;
21033   return 1;
21034 }
21035 EOM
21036
21037 val=$undef
21038 set try
21039 if eval $compile_ok; then
21040         if $run ./try; then
21041                 echo "You seem to speak EBCDIC." >&4
21042                 val="$define"
21043         else
21044                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
21045         fi
21046 else
21047         echo "I'm unable to compile the test program." >&4
21048         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
21049 fi
21050 $rm_try
21051 set ebcdic
21052 eval $setvar
21053
21054 : Check how to flush
21055 echo " "
21056 $cat >&4 <<EOM
21057 Checking how to flush all pending stdio output...
21058 EOM
21059 # I only know how to find the first 32 possibly open files on SunOS.
21060 # See also hints/sunos_4_1.sh and util.c  --AD
21061 case "$osname" in
21062 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
21063 esac
21064 $cat >>try.c <<EOCP
21065 #include <stdio.h>
21066 #$i_stdlib I_STDLIB
21067 #ifdef I_STDLIB
21068 #include <stdlib.h>
21069 #endif
21070 #$i_unistd I_UNISTD
21071 #ifdef I_UNISTD
21072 # include <unistd.h>
21073 #endif
21074 #$d_sysconf HAS_SYSCONF
21075 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
21076 #ifdef HAS_STDIO_STREAM_ARRAY
21077 # define STDIO_STREAM_ARRAY $stdio_stream_array
21078 #endif
21079 int main() {
21080   FILE* p;
21081   unlink("try.out");
21082   p = fopen("try.out", "w");
21083 #ifdef TRY_FPUTC
21084   fputc('x', p);
21085 #else
21086 # ifdef TRY_FPRINTF
21087   fprintf(p, "x");
21088 # endif
21089 #endif
21090 #ifdef TRY_FFLUSH_NULL
21091   fflush(NULL);
21092 #endif
21093 #ifdef TRY_FFLUSH_ALL
21094   {
21095     long open_max = -1;
21096 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
21097     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
21098 # else
21099 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
21100     open_max = sysconf(_SC_OPEN_MAX);
21101 #  else
21102 #   ifdef FOPEN_MAX
21103     open_max = FOPEN_MAX;
21104 #   else
21105 #    ifdef OPEN_MAX
21106     open_max = OPEN_MAX;
21107 #    else
21108 #     ifdef _NFILE
21109     open_max = _NFILE;
21110 #     endif
21111 #    endif
21112 #   endif
21113 #  endif
21114 # endif
21115 # ifdef HAS_STDIO_STREAM_ARRAY
21116     if (open_max > 0) {
21117       long i;
21118       for (i = 0; i < open_max; i++)
21119             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
21120                 STDIO_STREAM_ARRAY[i]._file < open_max &&
21121                 STDIO_STREAM_ARRAY[i]._flag)
21122                 fflush(&STDIO_STREAM_ARRAY[i]);
21123     }
21124   }
21125 # endif
21126 #endif
21127   _exit(42);
21128 }
21129 EOCP
21130 : first we have to find out how _not_ to flush
21131 $to try.c
21132 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
21133     output=''
21134     set try -DTRY_FPUTC
21135     if eval $compile; then
21136             $run ./try 2>/dev/null
21137             code="$?"
21138             $from try.out
21139             if $test ! -s try.out -a "X$code" = X42; then
21140                 output=-DTRY_FPUTC
21141             fi
21142     fi
21143     case "$output" in
21144     '')
21145             set try -DTRY_FPRINTF
21146             if eval $compile; then
21147                     $run ./try 2>/dev/null
21148                     code="$?"
21149                     $from try.out
21150                     if $test ! -s try.out -a "X$code" = X42; then
21151                         output=-DTRY_FPRINTF
21152                     fi
21153             fi
21154         ;;
21155     esac
21156 fi
21157 : check for fflush NULL behavior
21158 case "$fflushNULL" in
21159 '')     set try -DTRY_FFLUSH_NULL $output
21160         if eval $compile; then
21161                 $run ./try 2>/dev/null
21162                 code="$?"
21163                 $from try.out
21164                 if $test -s try.out -a "X$code" = X42; then
21165                         fflushNULL="`$cat try.out`"
21166                 else
21167                         if $test "X$code" != X42; then
21168                                 $cat >&4 <<EOM
21169 (If this test failed, don't worry, we'll try another method shortly.)
21170 EOM
21171                         fi
21172                 fi
21173         fi
21174         $rm -f core try.core core.try.*
21175         case "$fflushNULL" in
21176         x)      $cat >&4 <<EOM
21177 Your fflush(NULL) works okay for output streams.
21178 Let's see if it clobbers input pipes...
21179 EOM
21180 # As of mid-March 2000 all versions of Solaris appear to have a stdio
21181 # bug that improperly flushes the input end of pipes.  So we avoid the
21182 # autoflush on fork/system/exec support for now. :-(
21183 $cat >tryp.c <<EOCP
21184 #include <stdio.h>
21185 int
21186 main(int argc, char **argv)
21187 {
21188     char buf[1024];
21189     int i;
21190     char *bp = buf;
21191     while (1) {
21192         while ((i = getc(stdin)) != -1
21193                && (*bp++ = i) != '\n'
21194                && bp < &buf[1024])
21195         /* DO NOTHING */ ;
21196         *bp = '\0';
21197         fprintf(stdout, "%s", buf);
21198         fflush(NULL);
21199         if (i == -1)
21200             return 0;
21201         bp = buf;
21202     }
21203 }
21204 EOCP
21205                 fflushNULL="$define"
21206                 set tryp
21207                 if eval $compile; then
21208                     $rm -f tryp.out
21209                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
21210                     if $test "X$targethost" != X; then
21211                         $to tryp.c
21212                         $to tryp
21213                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
21214                     else
21215                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
21216                     fi
21217                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
21218                        $cat >&4 <<EOM
21219 fflush(NULL) seems to behave okay with input streams.
21220 EOM
21221                         fflushNULL="$define"
21222                     else
21223                         $cat >&4 <<EOM
21224 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
21225 EOM
21226                         fflushNULL="$undef"
21227                     fi
21228                 fi
21229                 $rm -f core tryp.c tryp.core core.tryp.*
21230                 ;;
21231         '')     $cat >&4 <<EOM
21232 Your fflush(NULL) isn't working (contrary to ANSI C).
21233 EOM
21234                 fflushNULL="$undef"
21235                 ;;
21236         *)      $cat >&4 <<EOM
21237 Cannot figure out whether your fflush(NULL) works or not.
21238 I'm assuming it doesn't (contrary to ANSI C).
21239 EOM
21240                 fflushNULL="$undef"
21241                 ;;
21242         esac
21243         ;;
21244 $define|true|[yY]*)
21245         fflushNULL="$define"
21246         ;;
21247 *)
21248         fflushNULL="$undef"
21249         ;;
21250 esac
21251 : check explicit looping only if NULL did not work, and if the pipe
21252 : bug does not show up on an explicit flush too
21253 case "$fflushNULL" in
21254 "$undef")
21255         $cat >tryp.c <<EOCP
21256 #include <stdio.h>
21257 int
21258 main(int argc, char **argv)
21259 {
21260     char buf[1024];
21261     int i;
21262     char *bp = buf;
21263     while (1) {
21264         while ((i = getc(stdin)) != -1
21265                && (*bp++ = i) != '\n'
21266                && bp < &buf[1024])
21267         /* DO NOTHING */ ;
21268         *bp = '\0';
21269         fprintf(stdout, "%s", buf);
21270         fflush(stdin);
21271         if (i == -1)
21272             return 0;
21273         bp = buf;
21274     }
21275 }
21276 EOCP
21277         set tryp
21278         if eval $compile; then
21279             $rm -f tryp.out
21280             if $test "X$targethost" != X; then
21281                 $to tryp.c
21282                 $to tryp
21283                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
21284             else
21285                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
21286             fi
21287             if cmp tryp.c tryp.out >/dev/null 2>&1; then
21288                $cat >&4 <<EOM
21289 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
21290 EOM
21291                 : now check for fflushall behaviour
21292                 case "$fflushall" in
21293                 '')     set try -DTRY_FFLUSH_ALL $output
21294                         if eval $compile; then
21295                                 $cat >&4 <<EOM
21296 (Now testing the other method--but note that this also may fail.)
21297 EOM
21298                                 $run ./try 2>/dev/null
21299                                 code=$?
21300                                 $from try.out
21301                                 if $test -s try.out -a "X$code" = X42; then
21302                                         fflushall="`$cat try.out`"
21303                                 fi
21304                         fi
21305                         $rm_try
21306                         case "$fflushall" in
21307                         x)      $cat >&4 <<EOM
21308 Whew. Flushing explicitly all the stdio streams works.
21309 EOM
21310                                 fflushall="$define"
21311                                 ;;
21312                         '')     $cat >&4 <<EOM
21313 Sigh. Flushing explicitly all the stdio streams doesn't work.
21314 EOM
21315                                 fflushall="$undef"
21316                                 ;;
21317                         *)      $cat >&4 <<EOM
21318 Cannot figure out whether flushing stdio streams explicitly works or not.
21319 I'm assuming it doesn't.
21320 EOM
21321                                 fflushall="$undef"
21322                                 ;;
21323                         esac
21324                         ;;
21325                 "$define"|true|[yY]*)
21326                         fflushall="$define"
21327                         ;;
21328                 *)
21329                         fflushall="$undef"
21330                         ;;
21331                 esac
21332             else
21333                 $cat >&4 <<EOM
21334 All is futile.  Even fflush(stdin) clobbers input pipes!
21335 EOM
21336                 fflushall="$undef"
21337             fi
21338         else
21339             fflushall="$undef"
21340         fi
21341         $rm -f core tryp.c tryp.core core.tryp.*
21342         ;;
21343 *)      fflushall="$undef"
21344         ;;
21345 esac
21346
21347 case "$fflushNULL$fflushall" in
21348 undefundef)
21349         $cat <<EOM
21350 OK, I give up.  I cannot figure out how to flush pending stdio output.
21351 We won't be flushing handles at all before fork/exec/popen.
21352 EOM
21353         ;;
21354 esac
21355 $rm_try tryp
21356
21357 : Store the full pathname to the ar program for use in the C program
21358 : Respect a hint or command line value for full_ar.
21359 case "$full_ar" in
21360 '') full_ar=$ar ;;
21361 esac
21362
21363 : Store the full pathname to the sed program for use in the C program
21364 full_sed=$sed
21365
21366 : see what type gids are declared as in the kernel
21367 echo " "
21368 echo "Looking for the type for group ids returned by getgid()."
21369 set gid_t gidtype xxx stdio.h sys/types.h
21370 eval $typedef
21371 case "$gidtype" in
21372 xxx)
21373         xxx=`./findhdr sys/user.h`
21374         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
21375         case $1 in
21376         unsigned) dflt="$1 $2" ;;
21377         *) dflt="$1" ;;
21378         esac
21379         ;;
21380 *) dflt="$gidtype";;
21381 esac
21382 case "$gidtype" in
21383 gid_t) echo "gid_t found." ;;
21384 *)      rp="What is the type for group ids returned by getgid()?"
21385         . ./myread
21386         gidtype="$ans"
21387         ;;
21388 esac
21389
21390 : Check the size of GID
21391 echo " "
21392 case "$gidtype" in
21393 *_t) zzz="$gidtype"     ;;
21394 *)   zzz="gid"          ;;
21395 esac
21396 echo "Checking the size of $zzz..." >&4
21397 cat > try.c <<EOCP
21398 #include <sys/types.h>
21399 #include <stdio.h>
21400 #$i_stdlib I_STDLIB
21401 #ifdef I_STDLIB
21402 #include <stdlib.h>
21403 #endif
21404 int main() {
21405     printf("%d\n", (int)sizeof($gidtype));
21406     exit(0);
21407 }
21408 EOCP
21409 set try
21410 if eval $compile_ok; then
21411         yyy=`$run ./try`
21412         case "$yyy" in
21413         '')     gidsize=4
21414                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
21415                 ;;
21416         *)      gidsize=$yyy
21417                 echo "Your $zzz is $gidsize bytes long."
21418                 ;;
21419         esac
21420 else
21421         gidsize=4
21422         echo "(I can't compile the test program--guessing $gidsize.)" >&4
21423 fi
21424
21425
21426 : Check if GID is signed
21427 echo " "
21428 case "$gidtype" in
21429 *_t) zzz="$gidtype"     ;;
21430 *)   zzz="gid"          ;;
21431 esac
21432 echo "Checking the sign of $zzz..." >&4
21433 cat > try.c <<EOCP
21434 #include <sys/types.h>
21435 #include <stdio.h>
21436 int main() {
21437         $gidtype foo = -1;
21438         if (foo < 0)
21439                 printf("-1\n");
21440         else
21441                 printf("1\n");
21442 }
21443 EOCP
21444 set try
21445 if eval $compile; then
21446         yyy=`$run ./try`
21447         case "$yyy" in
21448         '')     gidsign=1
21449                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21450                 ;;
21451         *)      gidsign=$yyy
21452                 case "$gidsign" in
21453                  1) echo "Your $zzz is unsigned." ;;
21454                 -1) echo "Your $zzz is signed."   ;;
21455                 esac
21456                 ;;
21457         esac
21458 else
21459         gidsign=1
21460         echo "(I can't compile the test program--guessing unsigned.)" >&4
21461 fi
21462
21463
21464 : Check 64bit sizes
21465 echo " "
21466
21467 if $test X"$quadtype" != X; then
21468
21469 echo "Checking how to print 64-bit integers..." >&4
21470
21471 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21472         $cat >try.c <<'EOCP'
21473 #include <sys/types.h>
21474 #include <stdio.h>
21475 int main() {
21476   int q = 12345678901;
21477   printf("%ld\n", q);
21478 }
21479 EOCP
21480         set try
21481         if eval $compile; then
21482                 yyy=`$run ./try`
21483                 case "$yyy" in
21484                 12345678901)
21485                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21486                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21487                         echo "We will use %d."
21488                         ;;
21489                 esac
21490         fi
21491 fi
21492
21493 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21494         $cat >try.c <<'EOCP'
21495 #include <sys/types.h>
21496 #include <stdio.h>
21497 int main() {
21498   long q = 12345678901;
21499   printf("%ld\n", q);
21500 }
21501 EOCP
21502         set try
21503         if eval $compile; then
21504                 yyy=`$run ./try`
21505                 case "$yyy" in
21506                 12345678901)
21507                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21508                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21509                         echo "We will use %ld."
21510                         ;;
21511                 esac
21512         fi
21513 fi
21514
21515 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21516         $cat >try.c <<'EOCP'
21517 #include <sys/types.h>
21518 #include <inttypes.h>
21519 #include <stdio.h>
21520 int main() {
21521   int64_t q = 12345678901;
21522   printf("%" PRId64 "\n", q);
21523 }
21524 EOCP
21525         set try
21526         if eval $compile; then
21527                 yyy=`$run ./try`
21528                 case "$yyy" in
21529                 12345678901)
21530                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21531                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
21532                         echo "We will use the C9X style."
21533                         ;;
21534                 esac
21535         fi
21536 fi
21537
21538 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21539         $cat >try.c <<EOCP
21540 #include <sys/types.h>
21541 #include <stdio.h>
21542 int main() {
21543   $quadtype q = 12345678901;
21544   printf("%Ld\n", q);
21545 }
21546 EOCP
21547         set try
21548         if eval $compile; then
21549                 yyy=`$run ./try`
21550                 case "$yyy" in
21551                 12345678901)
21552                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21553                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21554                         echo "We will use %Ld."
21555                         ;;
21556                 esac
21557         fi
21558 fi
21559
21560 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21561         $cat >try.c <<'EOCP'
21562 #include <sys/types.h>
21563 #include <stdio.h>
21564 int main() {
21565   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21566   printf("%lld\n", q);
21567 }
21568 EOCP
21569         set try
21570         if eval $compile; then
21571                 yyy=`$run ./try`
21572                 case "$yyy" in
21573                 12345678901)
21574                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21575                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21576                         echo "We will use the %lld style."
21577                         ;;
21578                 esac
21579         fi
21580 fi
21581
21582 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21583         $cat >try.c <<EOCP
21584 #include <sys/types.h>
21585 #include <stdio.h>
21586 int main() {
21587   $quadtype q = 12345678901;
21588   printf("%qd\n", q);
21589 }
21590 EOCP
21591         set try
21592         if eval $compile; then
21593                 yyy=`$run ./try`
21594                 case "$yyy" in
21595                 12345678901)
21596                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21597                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21598                         echo "We will use %qd."
21599                         ;;
21600                 esac
21601         fi
21602 fi
21603
21604 if $test X"$sPRId64" = X; then
21605         echo "Cannot figure out how to print 64-bit integers." >&4
21606 fi
21607 $rm_try
21608
21609 fi
21610
21611 case "$sPRId64" in
21612 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21613         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21614         ;;
21615 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21616         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21617         ;;
21618 esac
21619
21620 : Check format strings for internal types
21621 echo " "
21622 $echo "Checking the format strings to be used for Perl's internal types..." >&4
21623
21624 if $test X"$ivsize" = X8; then
21625         ivdformat="$sPRId64"
21626         uvuformat="$sPRIu64"
21627         uvoformat="$sPRIo64"
21628         uvxformat="$sPRIx64"
21629         uvXUformat="$sPRIXU64"
21630 else
21631         if $test X"$ivsize" = X"$longsize"; then
21632                 ivdformat='"ld"'
21633                 uvuformat='"lu"'
21634                 uvoformat='"lo"'
21635                 uvxformat='"lx"'
21636                 uvXUformat='"lX"'
21637         else
21638                 if $test X"$ivsize" = X"$intsize"; then
21639                         ivdformat='"d"'
21640                         uvuformat='"u"'
21641                         uvoformat='"o"'
21642                         uvxformat='"x"'
21643                         uvXUformat='"X"'
21644                 else
21645                         : far out
21646                         if $test X"$ivsize" = X"$shortsize"; then
21647                                 ivdformat='"hd"'
21648                                 uvuformat='"hu"'
21649                                 uvoformat='"ho"'
21650                                 uvxformat='"hx"'
21651                                 uvXUformat='"hX"'
21652                         fi
21653                 fi
21654         fi
21655 fi
21656
21657 if $test X"$usequadmath" = X"$define"; then
21658     nveformat='"Qe"'
21659     nvfformat='"Qf"'
21660     nvgformat='"Qg"'
21661     nvEUformat='"QE"'
21662     nvFUformat='"QF"'
21663     nvGUformat='"QG"'
21664 else
21665     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21666         nveformat="$sPRIeldbl"
21667         nvfformat="$sPRIfldbl"
21668         nvgformat="$sPRIgldbl"
21669         nvEUformat="$sPRIEUldbl"
21670         nvFUformat="$sPRIFUldbl"
21671         nvGUformat="$sPRIGUldbl"
21672     else
21673         nveformat='"e"'
21674         nvfformat='"f"'
21675         nvgformat='"g"'
21676         nvEUformat='"E"'
21677         nvFUformat='"F"'
21678         nvGUformat='"G"'
21679     fi
21680 fi
21681
21682 case "$ivdformat" in
21683 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21684     exit 1
21685     ;;
21686 esac
21687
21688 : Check format string for GID
21689
21690 echo " "
21691 $echo "Checking the format string to be used for gids..." >&4
21692
21693 case "$gidsign" in
21694 -1)     if $test X"$gidsize" = X"$ivsize"; then
21695                 gidformat="$ivdformat"
21696         else
21697                 if $test X"$gidsize" = X"$longsize"; then
21698                         gidformat='"ld"'
21699                 else
21700                         if $test X"$gidsize" = X"$intsize"; then
21701                                 gidformat='"d"'
21702                         else
21703                                 if $test X"$gidsize" = X"$shortsize"; then
21704                                         gidformat='"hd"'
21705                                 fi
21706                         fi
21707                 fi
21708         fi
21709         ;;
21710 *)      if $test X"$gidsize" = X"$uvsize"; then
21711                 gidformat="$uvuformat"
21712         else
21713                 if $test X"$gidsize" = X"$longsize"; then
21714                         gidformat='"lu"'
21715                 else
21716                         if $test X"$gidsize" = X"$intsize"; then
21717                                 gidformat='"u"'
21718                         else
21719                                 if $test X"$gidsize" = X"$shortsize"; then
21720                                         gidformat='"hu"'
21721                                 fi
21722                         fi
21723                 fi
21724         fi
21725         ;;
21726 esac
21727
21728 : see if getgroups exists
21729 set getgroups d_getgrps
21730 eval $inlibc
21731
21732 : see if setgroups exists
21733 set setgroups d_setgrps
21734 eval $inlibc
21735
21736 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21737 echo " "
21738 case "$d_getgrps$d_setgrps" in
21739 *define*)
21740         case "$groupstype" in
21741         '') dflt="$gidtype" ;;
21742         *)  dflt="$groupstype" ;;
21743         esac
21744         $cat <<EOM
21745 What type of pointer is the second argument to getgroups() and setgroups()?
21746 Usually this is the same as group ids, $gidtype, but not always.
21747
21748 EOM
21749         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21750         . ./myread
21751         groupstype="$ans"
21752         ;;
21753 *)  groupstype="$gidtype";;
21754 esac
21755
21756 : check whether make sets MAKE
21757 echo " "
21758 echo "Checking if your $make program sets \$(MAKE)..." >&4
21759 case "$make_set_make" in
21760 '')
21761         $sed 's/^X //' > testmake.mak << 'EOF'
21762 Xall:
21763 X       @echo 'maketemp="$(MAKE)"'
21764 EOF
21765         case "`$make -f testmake.mak 2>/dev/null`" in
21766         *maketemp=*) make_set_make='#' ;;
21767         *)      make_set_make="MAKE=$make" ;;
21768         esac
21769         $rm -f testmake.mak
21770         ;;
21771 esac
21772 case "$make_set_make" in
21773 '#') echo "Yup, it does.";;
21774 *) echo "Nope, it doesn't.";;
21775 esac
21776
21777 : see what type is used for mode_t
21778 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21779 set mode_t modetype int stdio.h sys/types.h
21780 eval $typedef_ask
21781
21782 : see if we need va_copy
21783 echo " "
21784 case "$i_stdarg" in
21785 "$define")
21786         $cat >try.c <<EOCP
21787 #include <stdarg.h>
21788 #include <stdio.h>
21789 #$i_stdlib I_STDLIB
21790 #ifdef I_STDLIB
21791 #include <stdlib.h>
21792 #endif
21793 #include <signal.h>
21794
21795 int
21796 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21797 {
21798   return vfprintf(f, fmt, *valp);
21799 }
21800
21801 int
21802 myvfprintf(FILE *f, const  char *fmt, va_list val)
21803 {
21804   return ivfprintf(f, fmt, &val);
21805 }
21806
21807 int
21808 myprintf(char *fmt, ...)
21809 {
21810   va_list val;
21811   va_start(val, fmt);
21812   return myvfprintf(stdout, fmt, val);
21813 }
21814
21815 int
21816 main(int ac, char **av)
21817 {
21818   signal(SIGSEGV, exit);
21819
21820   myprintf("%s%cs all right, then\n", "that", '\'');
21821   exit(0);
21822 }
21823 EOCP
21824         set try
21825         if eval $compile && $run ./try 2>&1 >/dev/null; then
21826                 case "`$run ./try`" in
21827                 "that's all right, then")
21828                         okay=yes
21829                         ;;
21830                 esac
21831         fi
21832         case "$okay" in
21833         yes)    echo "It seems that you don't need va_copy()." >&4
21834                 need_va_copy="$undef"
21835                 ;;
21836         *)      echo "It seems that va_copy() or similar will be needed." >&4
21837                 need_va_copy="$define"
21838                 ;;
21839         esac
21840         $rm_try
21841         ;;
21842 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
21843         need_va_copy="$undef"
21844         ;;
21845 esac
21846
21847 : see what type is used for size_t
21848 rp="What is the type used for the length parameter for string functions?"
21849 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21850 eval $typedef_ask
21851
21852 : check for type of arguments to gethostbyaddr.
21853 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21854         case "$d_gethbyaddr" in
21855         $define)
21856                 $cat <<EOM
21857
21858 Checking to see what type of arguments are accepted by gethostbyaddr().
21859 EOM
21860                 hdrs="$define sys/types.h
21861                         $d_socket sys/socket.h
21862                         $i_niin netinet/in.h
21863                         $i_netdb netdb.h
21864                         $i_unistd unistd.h"
21865                 : The first arg can 'char *' or 'void *'
21866                 : The second arg is some of integral type
21867                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21868                         for yyy in size_t long int; do
21869                                 case "$netdb_host_type" in
21870                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21871                                         if ./protochk "$try" $hdrs; then
21872                                                 echo "Your system accepts $xxx for the first arg."
21873                                                 echo "...and $yyy for the second arg."
21874                                                 netdb_host_type="$xxx"
21875                                                 netdb_hlen_type="$yyy"
21876                                         fi
21877                                         ;;
21878                                 esac
21879                         done
21880                 done
21881                 : In case none of those worked, prompt the user.
21882                 case "$netdb_host_type" in
21883                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21884                         dflt='char *'
21885                         . ./myread
21886                         netdb_host_type=$ans
21887                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21888                         dflt="$sizetype"
21889                         . ./myread
21890                         netdb_hlen_type=$ans
21891                         ;;
21892                 esac
21893                 ;;
21894         *)      : no gethostbyaddr, so pick harmless defaults
21895                 netdb_host_type='char *'
21896                 netdb_hlen_type="$sizetype"
21897                 ;;
21898         esac
21899         # Remove the "const" if needed. -- but then we'll have a
21900         # prototype clash!
21901         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21902 fi
21903
21904 : check for type of argument to gethostbyname.
21905 if test "X$netdb_name_type" = X ; then
21906         case "$d_gethbyname" in
21907         $define)
21908                 $cat <<EOM
21909
21910 Checking to see what type of argument is accepted by gethostbyname().
21911 EOM
21912                 hdrs="$define sys/types.h
21913                         $d_socket sys/socket.h
21914                         $i_niin netinet/in.h
21915                         $i_netdb netdb.h
21916                         $i_unistd unistd.h"
21917                 for xxx in "const char *" "char *"; do
21918                         case "$netdb_name_type" in
21919                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21920                                 if ./protochk "$try" $hdrs; then
21921                                         echo "Your system accepts $xxx."
21922                                         netdb_name_type="$xxx"
21923                                 fi
21924                                 ;;
21925                         esac
21926                 done
21927                 : In case none of those worked, prompt the user.
21928                 case "$netdb_name_type" in
21929                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21930                         dflt='char *'
21931                         . ./myread
21932                         netdb_name_type=$ans
21933                         ;;
21934                 esac
21935                 ;;
21936         *)      : no gethostbyname, so pick harmless default
21937                 netdb_name_type='char *'
21938                 ;;
21939         esac
21940 fi
21941
21942 : check for type of 1st argument to getnetbyaddr.
21943 if test "X$netdb_net_type" = X ; then
21944         case "$d_getnbyaddr" in
21945         $define)
21946                 $cat <<EOM
21947
21948 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21949 EOM
21950                 hdrs="$define sys/types.h
21951                         $d_socket sys/socket.h
21952                         $i_niin netinet/in.h
21953                         $i_netdb netdb.h
21954                         $i_unistd unistd.h"
21955                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21956                         case "$netdb_net_type" in
21957                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21958                                 if ./protochk "$try" $hdrs; then
21959                                         echo "Your system accepts $xxx."
21960                                         netdb_net_type="$xxx"
21961                                 fi
21962                                 ;;
21963                         esac
21964                 done
21965                 : In case none of those worked, prompt the user.
21966                 case "$netdb_net_type" in
21967                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21968                         dflt='long'
21969                         . ./myread
21970                         netdb_net_type=$ans
21971                         ;;
21972                 esac
21973                 ;;
21974         *)      : no getnetbyaddr, so pick harmless default
21975                 netdb_net_type='long'
21976                 ;;
21977         esac
21978 fi
21979 : locate the preferred pager for this system
21980 fn=f/
21981 case "$pager" in
21982 '')
21983         dflt=''
21984         case "$pg" in
21985         /*) dflt=$pg;;
21986         [a-zA-Z]:/*) dflt=$pg;;
21987         esac
21988         case "$more" in
21989         /*) dflt=$more;;
21990         [a-zA-Z]:/*) dflt=$more;;
21991         esac
21992         case "$less" in
21993         /*) dflt=$less;;
21994         [a-zA-Z]:/*) dflt=$less;;
21995         esac
21996         case "$dflt" in
21997         '') dflt=/usr/ucb/more;;
21998         esac
21999         ;;
22000 *)      dflt="$pager"
22001         ;;
22002 esac
22003 fn="f/($dflt)"
22004 echo " "
22005 rp='What pager is used on your system?'
22006 . ./getfile
22007 pager="$ans"
22008
22009 : see if ar generates random libraries by itself
22010 echo " "
22011 echo "Checking how to generate random libraries on your machine..." >&4
22012 echo 'int bar1() { return bar2(); }' > bar1.c
22013 echo 'int bar2() { return 2; }' > bar2.c
22014 $cat > foo.c <<EOP
22015 #$i_stdlib I_STDLIB
22016 #ifdef I_STDLIB
22017 #include <stdlib.h>
22018 #endif
22019 int main() { printf("%d\n", bar1()); exit(0); }
22020 EOP
22021 $cc $ccflags -c bar1.c >/dev/null 2>&1
22022 $cc $ccflags -c bar2.c >/dev/null 2>&1
22023 $cc $ccflags -c foo.c >/dev/null 2>&1
22024 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
22025 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
22026         $run ./foobar >/dev/null 2>&1; then
22027         echo "$ar appears to generate random libraries itself."
22028         orderlib=false
22029         if [ "X$ranlib" = "X" ]; then
22030             ranlib=":"
22031         fi
22032 elif $ar s bar$_a >/dev/null 2>&1 &&
22033         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
22034         $run ./foobar >/dev/null 2>&1; then
22035                 echo "a table of contents needs to be added with '$ar s'."
22036                 orderlib=false
22037                 ranlib="$ar s"
22038 elif $ar ts bar$_a >/dev/null 2>&1 &&
22039         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
22040         $run ./foobar >/dev/null 2>&1; then
22041                 echo "a table of contents needs to be added with '$ar ts'."
22042                 orderlib=false
22043                 ranlib="$ar ts"
22044 else
22045         case "$ranlib" in
22046         :) ranlib='';;
22047         '')
22048                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
22049                 $test -f $ranlib || ranlib=''
22050                 ;;
22051         esac
22052         if $test -n "$ranlib"; then
22053                 echo "your system has '$ranlib'; we'll use that."
22054                 orderlib=false
22055         else
22056                 echo "your system doesn't seem to support random libraries"
22057                 echo "so we'll use lorder and tsort to order the libraries."
22058                 orderlib=true
22059                 ranlib=":"
22060         fi
22061 fi
22062 $rm -f foo* bar*
22063
22064 : see if this is a values.h system
22065 set values.h i_values
22066 eval $inhdr
22067
22068 : Check the max offset that gmtime and localtime accept
22069 echo "Checking max offsets that gmtime () accepts"
22070
22071 case $i_values in
22072     define) yyy="#include <values.h>" ;;
22073     *)      yyy="" ;;
22074     esac
22075
22076 case "$sGMTIME_min/$sGMTIME_max" in
22077     0/0|/)
22078         $cat >try.c <<EOCP
22079 #include <sys/types.h>
22080 #include <stdio.h>
22081 #include <time.h>
22082 $yyy
22083
22084 int i;
22085 struct tm *tmp;
22086 time_t pt;
22087
22088 void gm_check (time_t t, int min_year, int max_year)
22089 {
22090     tmp = gmtime (&t);
22091     if ( tmp == NULL ||
22092         /* Check tm_year overflow */
22093          tmp->tm_year < min_year || tmp->tm_year > max_year)
22094         tmp = NULL;
22095     else
22096         pt = t;
22097     } /* gm_check */
22098
22099 int check_max ()
22100 {
22101     tmp = NULL;
22102     pt  = 0;
22103 #ifdef MAXLONG
22104     gm_check (MAXLONG, 69, 0x7fffffff);
22105 #endif
22106     if (tmp == NULL || tmp->tm_year < 0) {
22107         for (i = 63; i >= 0; i--) {
22108             time_t x = pt | ((time_t)1 << i);
22109             if (x < 0 || x < pt) continue;
22110             gm_check (x, 69, 0x7fffffff);
22111             }
22112         }
22113     printf ("sGMTIME_max=%ld\n", pt);
22114     return (0);
22115     } /* check_max */
22116
22117 int check_min ()
22118 {
22119     tmp = NULL;
22120     pt  = 0;
22121 #ifdef MINLONG
22122     gm_check (MINLONG, -1900, 70);
22123 #endif
22124     if (tmp == NULL) {
22125         for (i = 36; i >= 0; i--) {
22126             time_t x = pt - ((time_t)1 << i);
22127             if (x > 0) continue;
22128             gm_check (x, -1900, 70);
22129             }
22130         }
22131     printf ("sGMTIME_min=%ld\n", pt);
22132     return (0);
22133     } /* check_min */
22134
22135 int main (int argc, char *argv[])
22136 {
22137     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
22138     check_max ();
22139     check_min ();
22140     return (0);
22141     } /* main */
22142 EOCP
22143         set try
22144         if eval $compile; then
22145             eval `$run ./try 2>/dev/null`
22146         else
22147             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
22148             fi
22149         $rm_try
22150         ;;
22151     esac
22152
22153 echo "Checking max offsets that localtime () accepts"
22154
22155 case "$sLOCALTIME_min/$sLOCALTIME_max" in
22156     0/0|/)
22157         $cat >try.c <<EOCP
22158 #include <sys/types.h>
22159 #include <stdio.h>
22160 #include <time.h>
22161 $yyy
22162
22163 int i;
22164 struct tm *tmp;
22165 time_t pt;
22166
22167 void local_check (time_t t, int min_year, int max_year)
22168 {
22169     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
22170         tmp = NULL;
22171     else
22172         tmp = localtime (&t);
22173     if ( tmp == NULL ||
22174         /* Check tm_year overflow */
22175          tmp->tm_year < min_year || tmp->tm_year > max_year)
22176         tmp = NULL;
22177     else
22178         pt = t;
22179     } /* local_check */
22180
22181 int check_max ()
22182 {
22183     tmp = NULL;
22184     pt  = 0;
22185 #ifdef MAXLONG
22186     local_check (MAXLONG, 69, 0x7fffffff);
22187 #endif
22188     if (tmp == NULL || tmp->tm_year < 0) {
22189         for (i = 63; i >= 0; i--) {
22190             time_t x = pt | ((time_t)1 << i);
22191             if (x < 0 || x < pt) continue;
22192             local_check (x, 69, 0x7fffffff);
22193             }
22194         }
22195     printf ("sLOCALTIME_max=%ld\n", pt);
22196     return (0);
22197    } /* check_max */
22198
22199 int check_min ()
22200 {
22201     tmp = NULL;
22202     pt  = 0;
22203 #ifdef MINLONG
22204     local_check (MINLONG, -1900, 70);
22205 #endif
22206     if (tmp == NULL) {
22207         for (i = 36; i >= 0; i--) {
22208             time_t x = pt - ((time_t)1 << i);
22209             if (x > 0) continue;
22210             local_check (x, -1900, 70);
22211             }
22212         }
22213     printf ("sLOCALTIME_min=%ld\n", pt);
22214     return (0);
22215     } /* check_min */
22216
22217 int main (int argc, char *argv[])
22218 {
22219     check_max ();
22220     check_min ();
22221     return (0);
22222     } /* main */
22223 EOCP
22224         set try
22225         if eval $compile; then
22226             eval `$run ./try 2>/dev/null`
22227         else
22228             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
22229             fi
22230         $rm_try
22231         ;;
22232     esac
22233
22234 : check for type of arguments to select.
22235 case "$selecttype" in
22236 '') case "$d_select" in
22237         $define)
22238                 echo " "
22239                 $cat <<EOM
22240 Checking to see what type of arguments are accepted by select().
22241 EOM
22242                 hdrs="$define sys/types.h
22243                         $i_systime sys/time.h
22244                         $i_sysselct sys/select.h
22245                         $d_socket sys/socket.h"
22246                 : The first arg can be int, unsigned, or size_t
22247                 : The last arg may or may not be 'const'
22248                 val=''
22249                 : void pointer has been seen but using that
22250                 : breaks the selectminbits test
22251                 for xxx in 'fd_set *' 'int *'; do
22252                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
22253                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
22254                                         case "$val" in
22255                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
22256                                                 if ./protochk "$try" $hdrs; then
22257                                                         echo "Your system accepts $xxx."
22258                                                         val="$xxx"
22259                                                 fi
22260                                                 ;;
22261                                         esac
22262                                 done
22263                         done
22264                 done
22265                 case "$val" in
22266                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
22267                         case "$d_fd_set" in
22268                                 $define) dflt="fd_set *" ;;
22269                                 *)              dflt="int *" ;;
22270                         esac
22271                         . ./myread
22272                         val=$ans
22273                         ;;
22274                 esac
22275                 selecttype="$val"
22276                 ;;
22277         *)      : no select, so pick a harmless default
22278                 selecttype='int *'
22279                 ;;
22280         esac
22281         ;;
22282 esac
22283
22284 : check for the select 'width'
22285 case "$selectminbits" in
22286 '') safebits=`expr $ptrsize \* 8`
22287     case "$d_select" in
22288         $define)
22289                 $cat <<EOM
22290
22291 Checking to see on how many bits at a time your select() operates...
22292 EOM
22293                 $cat >try.c <<EOCP
22294 #include <sys/types.h>
22295 #$i_time I_TIME
22296 #$i_systime I_SYS_TIME
22297 #$i_systimek I_SYS_TIME_KERNEL
22298 #ifdef I_TIME
22299 #   include <time.h>
22300 #endif
22301 #ifdef I_SYS_TIME
22302 #   ifdef I_SYS_TIME_KERNEL
22303 #       define KERNEL
22304 #   endif
22305 #   include <sys/time.h>
22306 #   ifdef I_SYS_TIME_KERNEL
22307 #       undef KERNEL
22308 #   endif
22309 #endif
22310 #$i_sysselct I_SYS_SELECT
22311 #ifdef I_SYS_SELECT
22312 #include <sys/select.h>
22313 #endif
22314 #$d_socket HAS_SOCKET
22315 #ifdef HAS_SOCKET
22316 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
22317 #endif
22318 #include <stdio.h>
22319 #$i_stdlib I_STDLIB
22320 #ifdef I_STDLIB
22321 #include <stdlib.h>
22322 #endif
22323 $selecttype b;
22324 #define S sizeof(*(b))
22325 #define MINBITS 64
22326 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
22327 #define NBITS  (NBYTES * 8)
22328 int main() {
22329     char *s = (char *)malloc(NBYTES);
22330     struct timeval t;
22331     int i;
22332     FILE* fp;
22333     int fd;
22334
22335     if (!s)
22336         exit(1);
22337     fclose(stdin);
22338     fp = fopen("try.c", "r");
22339     if (fp == 0)
22340       exit(2);
22341     fd = fileno(fp);
22342     if (fd < 0)
22343       exit(3);
22344     b = ($selecttype)s;
22345     for (i = 0; i < NBITS; i++)
22346         FD_SET(i, b);
22347     t.tv_sec  = 0;
22348     t.tv_usec = 0;
22349     select(fd + 1, b, 0, 0, &t);
22350     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
22351     free(s);
22352     printf("%d\n", i + 1);
22353     return 0;
22354 }
22355 EOCP
22356                 set try
22357                 if eval $compile_ok; then
22358                         selectminbits=`$run ./try 2>/dev/null`
22359                         case "$selectminbits" in
22360                         '')     cat >&4 <<EOM
22361 Cannot figure out on how many bits at a time your select() operates.
22362 I'll play safe and guess it is $safebits bits.
22363 EOM
22364                                 selectminbits=$safebits
22365                                 bits="$safebits bits"
22366                                 ;;
22367                         1)      bits="1 bit" ;;
22368                         *)      bits="$selectminbits bits" ;;
22369                         esac
22370                         echo "Your select() operates on $bits at a time." >&4
22371                 else
22372                         rp='What is the minimum number of bits your select() operates on?'
22373                         case "$byteorder" in
22374                         12345678)       dflt=64 ;;
22375                         1234)           dflt=32 ;;
22376                         *)              dflt=1  ;;
22377                         esac
22378                         . ./myread
22379                         val=$ans
22380                         selectminbits="$val"
22381                 fi
22382                 $rm_try
22383                 ;;
22384         *)      : no select, so pick a harmless default
22385                 selectminbits=$safebits
22386                 ;;
22387         esac
22388         ;;
22389 esac
22390
22391 : Trace out the files included by signal.h, then look for SIGxxx names.
22392 case "$sig_num_init" in
22393 '')
22394 if [ "X$fieldn" = X ]; then
22395         : Just make some guesses.  We check them later.
22396         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
22397 else
22398         xxx=`echo '#include <signal.h>' |
22399         $cppstdin $cppminus $cppflags 2>/dev/null |
22400         $grep '^[       ]*#.*include' |
22401         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
22402                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
22403 fi
22404 xxxfiles=''
22405 for xx in $xxx /dev/null ; do
22406         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
22407 done
22408 case "$xxxfiles" in
22409 '')     xxxfiles=`./findhdr signal.h` ;;
22410 esac
22411 xxx=`awk '
22412 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
22413         print substr($2, 4, 20)
22414 }
22415 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
22416         print substr($3, 4, 20)
22417 }' $xxxfiles`
22418 : Append some common names just in case the awk scan failed.
22419 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22420 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22421 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22422 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22423 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22424
22425 : generate a few handy files for later
22426 $cat > signal.c <<EOCP
22427 #include <sys/types.h>
22428 #include <signal.h>
22429 #$i_stdlib I_STDLIB
22430 #ifdef I_STDLIB
22431 #include <stdlib.h>
22432 #endif
22433 #include <stdio.h>
22434 int main() {
22435
22436 /* Strange style to avoid deeply-nested #if/#else/#endif */
22437 #ifndef NSIG
22438 #  ifdef _NSIG
22439 #    define NSIG (_NSIG)
22440 #  endif
22441 #endif
22442
22443 #ifndef NSIG
22444 #  ifdef SIGMAX
22445 #    define NSIG (SIGMAX+1)
22446 #  endif
22447 #endif
22448
22449 #ifndef NSIG
22450 #  ifdef SIG_MAX
22451 #    define NSIG (SIG_MAX+1)
22452 #  endif
22453 #endif
22454
22455 #ifndef NSIG
22456 #  ifdef _SIG_MAX
22457 #    define NSIG (_SIG_MAX+1)
22458 #  endif
22459 #endif
22460
22461 #ifndef NSIG
22462 #  ifdef MAXSIG
22463 #    define NSIG (MAXSIG+1)
22464 #  endif
22465 #endif
22466
22467 #ifndef NSIG
22468 #  ifdef MAX_SIG
22469 #    define NSIG (MAX_SIG+1)
22470 #  endif
22471 #endif
22472
22473 #ifndef NSIG
22474 #  ifdef SIGARRAYSIZE
22475 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22476 #  endif
22477 #endif
22478
22479 #ifndef NSIG
22480 #  ifdef _sys_nsig
22481 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
22482 #  endif
22483 #endif
22484
22485 /* Default to some arbitrary number that's big enough to get most
22486    of the common signals.
22487 */
22488 #ifndef NSIG
22489 #    define NSIG 50
22490 #endif
22491
22492 printf("NSIG %d\n", NSIG);
22493
22494 #ifndef JUST_NSIG
22495
22496 EOCP
22497
22498 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22499 {
22500         printf "#ifdef SIG"; printf $1; printf "\n"
22501         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22502         printf $1; printf ");\n"
22503         printf "#endif\n"
22504 }
22505 END {
22506         printf "#endif /* JUST_NSIG */\n";
22507         printf "exit(0);\n}\n";
22508 }
22509 ' >>signal.c
22510 $cat >signal.awk <<'EOP'
22511 BEGIN { ndups = 0 }
22512 $1 ~ /^NSIG$/ { nsig = $2 }
22513 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22514     if ($2 > maxsig) { maxsig = $2 }
22515     if (sig_name[$2]) {
22516         dup_name[ndups] = $1
22517         dup_num[ndups] = $2
22518         ndups++
22519     }
22520     else {
22521         sig_name[$2] = $1
22522         sig_num[$2] = $2
22523     }
22524 }
22525 END {
22526     if (nsig == 0) {
22527         nsig = maxsig + 1
22528     }
22529     printf("NSIG %d\n", nsig);
22530     for (n = 1; n < nsig; n++) {
22531         if (sig_name[n]) {
22532             printf("%s %d\n", sig_name[n], sig_num[n])
22533         }
22534         else {
22535             printf("NUM%d %d\n", n, n)
22536         }
22537     }
22538     for (n = 0; n < ndups; n++) {
22539         printf("%s %d\n", dup_name[n], dup_num[n])
22540     }
22541 }
22542 EOP
22543 $cat >signal_cmd <<EOS
22544 $startsh
22545 if $test -s signal.lst; then
22546     echo "Using your existing signal.lst file"
22547         exit 0
22548 fi
22549 xxx="$xxx"
22550 EOS
22551 $cat >>signal_cmd <<'EOS'
22552
22553 set signal
22554 if eval $compile_ok; then
22555         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22556                 $uniq | $awk -f signal.awk >signal.lst
22557 else
22558         echo "(I can't seem be able to compile the whole test program)" >&4
22559         echo "(I'll try it in little pieces.)" >&4
22560         set signal -DJUST_NSIG
22561         if eval $compile_ok; then
22562                 $run ./signal$_exe > signal.nsg
22563                 $cat signal.nsg
22564         else
22565                 echo "I can't seem to figure out how many signals you have." >&4
22566                 echo "Guessing 50." >&4
22567                 echo 'NSIG 50' > signal.nsg
22568         fi
22569         : Now look at all the signal names, one at a time.
22570         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22571                 $cat > signal.c <<EOCP
22572 #include <sys/types.h>
22573 #include <signal.h>
22574 #include <stdio.h>
22575 int main() {
22576 printf("$xx %d\n", SIG${xx});
22577 return 0;
22578 }
22579 EOCP
22580                 set signal
22581                 if eval $compile; then
22582                         echo "SIG${xx} found."
22583                         $run ./signal$_exe  >> signal.ls1
22584                 else
22585                         echo "SIG${xx} NOT found."
22586                 fi
22587         done
22588         if $test -s signal.ls1; then
22589                 $cat signal.nsg signal.ls1 |
22590                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
22591         fi
22592
22593 fi
22594 if $test -s signal.lst; then
22595         :
22596 else
22597         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
22598         echo 'kill -l' >signal
22599         set X `csh -f <signal`
22600         $rm -f signal
22601         shift
22602         case $# in
22603         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
22604         esac
22605         echo $@ | $tr ' ' $trnl | \
22606             $awk '{ printf "%s %d\n", $1, ++s; }
22607                   END { printf "NSIG %d\n", ++s }' >signal.lst
22608 fi
22609 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
22610 EOS
22611 chmod a+x signal_cmd
22612 $eunicefix signal_cmd
22613 ;;
22614 esac
22615
22616 : generate list of signal names
22617 case "$sig_num_init" in
22618 '')
22619 echo " "
22620 case "$sig_name_init" in
22621 '') doinit=yes ;;
22622 *)  case "$sig_num_init" in
22623     ''|*,*) doinit=yes ;;
22624     esac ;;
22625 esac
22626 case "$doinit" in
22627 yes)
22628         echo "Generating a list of signal names and numbers..." >&4
22629         . ./signal_cmd
22630         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22631         sig_name=`$awk 'BEGIN { printf "ZERO " }
22632                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
22633         sig_num=`$awk  'BEGIN { printf "0 " }
22634                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
22635         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
22636                              !/^NSIG/   { printf "\"%s\", ", $1 }
22637                              END        { printf "0\n" }' signal.lst`
22638         sig_num_init=`$awk  'BEGIN      { printf "0, " }
22639                              !/^NSIG/   { printf "%d, ", $2}
22640                              END        { printf "0\n"}' signal.lst`
22641         ;;
22642 esac
22643 echo "The following $sig_count signals are available:"
22644 echo " "
22645 echo $sig_name | $awk \
22646 'BEGIN { linelen = 0 }
22647 {
22648         for (i = 1; i <= NF; i++) {
22649                 name = "SIG" $i " "
22650                 linelen = linelen + length(name)
22651                 if (linelen > 70) {
22652                         printf "\n"
22653                         linelen = length(name)
22654                 }
22655                 printf "%s", name
22656         }
22657         printf "\n"
22658 }'
22659 sig_size=`echo $sig_name | awk '{print NF}'`
22660 $rm -f signal signal.c signal.awk signal.lst signal_cmd
22661 ;;
22662 esac
22663
22664 : Check size of size
22665 echo " "
22666 case "$sizetype" in
22667 *_t) zzz="$sizetype"    ;;
22668 *)   zzz="filesize"     ;;
22669 esac
22670 echo "Checking the size of $zzz..." >&4
22671 cat > try.c <<EOCP
22672 #include <sys/types.h>
22673 #include <stdio.h>
22674 #$i_stdlib I_STDLIB
22675 #ifdef I_STDLIB
22676 #include <stdlib.h>
22677 #endif
22678 int main() {
22679     printf("%d\n", (int)sizeof($sizetype));
22680     exit(0);
22681 }
22682 EOCP
22683 set try
22684 if eval $compile_ok; then
22685         yyy=`$run ./try`
22686         case "$yyy" in
22687         '')     sizesize=4
22688                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22689                 ;;
22690         *)      sizesize=$yyy
22691                 echo "Your $zzz size is $sizesize bytes."
22692                 ;;
22693         esac
22694 else
22695         sizesize=4
22696         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22697 fi
22698
22699
22700 : check for socklen_t
22701 echo " "
22702 echo "Checking to see if you have socklen_t..." >&4
22703 $cat >try.c <<EOCP
22704 #include <sys/types.h>
22705 #$d_socket HAS_SOCKET
22706 #ifdef HAS_SOCKET
22707 #include <sys/socket.h>
22708 #endif
22709 int main() { socklen_t x = 16; }
22710 EOCP
22711 set try
22712 if eval $compile; then
22713         val="$define"
22714         echo "You have socklen_t."
22715 else
22716         val="$undef"
22717         echo "You do not have socklen_t."
22718         case "$sizetype" in
22719         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22720         esac
22721 fi
22722 $rm_try
22723 set d_socklen_t
22724 eval $setvar
22725
22726 : see if this is a socks.h system
22727 set socks.h i_socks
22728 eval $inhdr
22729
22730 : check for type of the size argument to socket calls
22731 case "$d_socket" in
22732 "$define")
22733         $cat <<EOM
22734
22735 Checking to see what type is the last argument of accept().
22736 EOM
22737         yyy=''
22738         case "$d_socklen_t" in
22739         "$define") yyy="$yyy socklen_t"
22740         esac
22741         yyy="$yyy $sizetype int long unsigned"
22742         for xxx in $yyy; do
22743                 case "$socksizetype" in
22744                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22745                         case "$usesocks" in
22746                         "$define")
22747                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22748                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22749                                         socksizetype="$xxx"
22750                                 fi
22751                                 ;;
22752                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22753                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22754                                         socksizetype="$xxx"
22755                                 fi
22756                                 ;;
22757                         esac
22758                         ;;
22759                 esac
22760         done
22761 : In case none of those worked, prompt the user.
22762         case "$socksizetype" in
22763         '')     rp='What is the type for socket address structure sizes?'
22764                 dflt='int'
22765                 . ./myread
22766                 socksizetype=$ans
22767                 ;;
22768         esac
22769         ;;
22770 *)      : no sockets, so pick relatively harmless default
22771         socksizetype='int'
22772         ;;
22773 esac
22774
22775 : see what type is used for signed size_t
22776 set ssize_t ssizetype int stdio.h sys/types.h
22777 eval $typedef
22778 dflt="$ssizetype"
22779 $cat > try.c <<EOM
22780 #include <stdio.h>
22781 #$i_stdlib I_STDLIB
22782 #ifdef I_STDLIB
22783 #include <stdlib.h>
22784 #endif
22785 #include <sys/types.h>
22786 #define Size_t $sizetype
22787 #define SSize_t $dflt
22788 int main()
22789 {
22790         if (sizeof(Size_t) == sizeof(SSize_t))
22791                 printf("$dflt\n");
22792         else if (sizeof(Size_t) == sizeof(int))
22793                 printf("int\n");
22794         else
22795                 printf("long\n");
22796         exit(0);
22797 }
22798 EOM
22799 echo " "
22800 set try
22801 if eval $compile_ok && $run ./try > /dev/null; then
22802         ssizetype=`$run ./try`
22803         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22804 else
22805         $cat >&4 <<EOM
22806 Help! I can't compile and run the ssize_t test program: please enlighten me!
22807 (This is probably a misconfiguration in your system or libraries, and
22808 you really ought to fix it.  Still, I'll try anyway.)
22809
22810 I need a type that is the same size as $sizetype, but is guaranteed to
22811 be signed.  Common values are ssize_t, int and long.
22812
22813 EOM
22814         rp="What signed type is the same size as $sizetype?"
22815         . ./myread
22816         ssizetype="$ans"
22817 fi
22818 $rm_try
22819
22820 : Check the size of st_ino
22821 $echo " "
22822 $echo "Checking the size of st_ino..." >&4
22823 $cat > try.c <<EOCP
22824 #include <sys/stat.h>
22825 #include <stdio.h>
22826 #$i_stdlib I_STDLIB
22827 #ifdef I_STDLIB
22828 #include <stdlib.h>
22829 #endif
22830 int main() {
22831     struct stat st;
22832     printf("%d\n", (int)sizeof(st.st_ino));
22833     exit(0);
22834 }
22835 EOCP
22836 set try
22837 if eval $compile_ok; then
22838         val=`$run ./try`
22839         case "$val" in
22840         '')     st_ino_size=4
22841                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22842                 ;;
22843         *)      st_ino_size=$val
22844                 $echo "Your st_ino is $st_ino_size bytes long."
22845                 ;;
22846         esac
22847 else
22848         st_ino_size=4
22849         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22850 fi
22851 $rm_try
22852
22853 : Check if st_ino is signed
22854 $echo " "
22855 $echo "Checking the sign of st_ino..." >&4
22856 $cat > try.c <<EOCP
22857 #include <sys/stat.h>
22858 #include <stdio.h>
22859 int main() {
22860         struct stat foo;
22861         foo.st_ino = -1;
22862         if (foo.st_ino < 0)
22863                 printf("-1\n");
22864         else
22865                 printf("1\n");
22866 }
22867 EOCP
22868 set try
22869 if eval $compile; then
22870         val=`$run ./try`
22871         case "$val" in
22872         '')     st_ino_sign=1
22873                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22874                 ;;
22875         *)      st_ino_sign=$val
22876                 case "$st_ino_sign" in
22877                  1) $echo "Your st_ino is unsigned." ;;
22878                 -1) $echo "Your st_ino is signed."   ;;
22879                 esac
22880                 ;;
22881         esac
22882 else
22883         st_ino_sign=1
22884         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22885 fi
22886 $rm_try
22887
22888 : see what type of char stdio uses.
22889 echo " "
22890 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22891 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22892         echo "Your stdio uses unsigned chars." >&4
22893         stdchar="unsigned char"
22894 else
22895         echo "Your stdio uses signed chars." >&4
22896         stdchar="char"
22897 fi
22898 $rm -f stdioh
22899
22900 : Check size of UID
22901 echo " "
22902 case "$uidtype" in
22903 *_t) zzz="$uidtype"     ;;
22904 *)   zzz="uid"          ;;
22905 esac
22906 echo "Checking the size of $zzz..." >&4
22907 cat > try.c <<EOCP
22908 #include <sys/types.h>
22909 #include <stdio.h>
22910 #$i_stdlib I_STDLIB
22911 #ifdef I_STDLIB
22912 #include <stdlib.h>
22913 #endif
22914 int main() {
22915     printf("%d\n", (int)sizeof($uidtype));
22916     exit(0);
22917 }
22918 EOCP
22919 set try
22920 if eval $compile_ok; then
22921         yyy=`$run ./try`
22922         case "$yyy" in
22923         '')     uidsize=4
22924                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22925                 ;;
22926         *)      uidsize=$yyy
22927                 echo "Your $zzz is $uidsize bytes long."
22928                 ;;
22929         esac
22930 else
22931         uidsize=4
22932         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22933 fi
22934
22935 : Check if UID is signed
22936 echo " "
22937 case "$uidtype" in
22938 *_t) zzz="$uidtype"     ;;
22939 *)   zzz="uid"          ;;
22940 esac
22941 echo "Checking the sign of $zzz..." >&4
22942 cat > try.c <<EOCP
22943 #include <sys/types.h>
22944 #include <stdio.h>
22945 int main() {
22946         $uidtype foo = -1;
22947         if (foo < 0)
22948                 printf("-1\n");
22949         else
22950                 printf("1\n");
22951 }
22952 EOCP
22953 set try
22954 if eval $compile; then
22955         yyy=`$run ./try`
22956         case "$yyy" in
22957         '')     uidsign=1
22958                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22959                 ;;
22960         *)      uidsign=$yyy
22961                 case "$uidsign" in
22962                  1) echo "Your $zzz is unsigned." ;;
22963                 -1) echo "Your $zzz is signed."   ;;
22964                 esac
22965                 ;;
22966         esac
22967 else
22968         uidsign=1
22969         echo "(I can't compile the test program--guessing unsigned.)" >&4
22970 fi
22971
22972
22973 : Check format string for UID
22974 echo " "
22975 $echo "Checking the format string to be used for uids..." >&4
22976
22977 case "$uidsign" in
22978 -1)     if $test X"$uidsize" = X"$ivsize"; then
22979                 uidformat="$ivdformat"
22980         else
22981                 if $test X"$uidsize" = X"$longsize"; then
22982                         uidformat='"ld"'
22983                 else
22984                         if $test X"$uidsize" = X"$intsize"; then
22985                                 uidformat='"d"'
22986                         else
22987                                 if $test X"$uidsize" = X"$shortsize"; then
22988                                         uidformat='"hd"'
22989                                 fi
22990                         fi
22991                 fi
22992         fi
22993         ;;
22994 *)      if $test X"$uidsize" = X"$uvsize"; then
22995                 uidformat="$uvuformat"
22996         else
22997                 if $test X"$uidsize" = X"$longsize"; then
22998                         uidformat='"lu"'
22999                 else
23000                         if $test X"$uidsize" = X"$intsize"; then
23001                                 uidformat='"u"'
23002                         else
23003                                 if $test X"$uidsize" = X"$shortsize"; then
23004                                         uidformat='"hu"'
23005                                 fi
23006                         fi
23007                 fi
23008         fi
23009         ;;
23010 esac
23011
23012 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
23013 echo " "
23014 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
23015 $cat >try.c <<'EOM'
23016 /* Intentionally a long probe as I'd like to sanity check that the exact
23017    approach is going to work, as thinking it will work, but only having it
23018    part working at runtime is worse than not having it.  */
23019
23020 #include <sys/types.h>
23021 #include <sys/sysctl.h>
23022 #include <sys/param.h>
23023 #include <stdio.h>
23024 #include <string.h>
23025 #include <stdlib.h>
23026 #include <unistd.h>
23027
23028 int
23029 main(int argc, char **argv) {
23030     char *buffer;
23031     char *argv_leaf = strrchr(argv[0], '/');
23032     char *buffer_leaf;
23033     size_t size = 0;
23034     int mib[4];
23035
23036     mib[0] = CTL_KERN;
23037     mib[1] = KERN_PROC;
23038     mib[2] = KERN_PROC_PATHNAME;
23039     mib[3] = -1;
23040
23041     if (!argv_leaf) {
23042         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
23043         return 1;
23044     }
23045
23046     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
23047         perror("sysctl");
23048         return 2;
23049     }
23050
23051     if (size < strlen(argv_leaf) + 1) {
23052         fprintf(stderr, "size %lu is too short for a path\n",
23053                 (unsigned long) size);
23054         return 3;
23055     }
23056
23057     if (size > MAXPATHLEN * MAXPATHLEN) {
23058         fprintf(stderr, "size %lu is too long for a path\n",
23059                 (unsigned long) size);
23060         return 4;
23061     }
23062
23063     buffer = (char *)malloc(size);
23064     if (!buffer) {
23065         perror("malloc");
23066         return 5;
23067     }
23068
23069     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
23070         perror("sysctl");
23071         return 6;
23072     }
23073
23074     if (strlen(buffer) + 1 != size) {
23075         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
23076                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
23077         return 7;
23078     }
23079
23080
23081     if (*buffer != '/') {
23082         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
23083         return 8;
23084     }
23085
23086     if (strstr(buffer, "/./")) {
23087         fprintf(stderr, "Contains /./: '%s'\n", buffer);
23088         return 9;
23089     }
23090
23091     if (strstr(buffer, "/../")) {
23092         fprintf(stderr, "Contains /../: '%s'\n", buffer);
23093         return 10;
23094     }
23095
23096     buffer_leaf = strrchr(buffer, '/');
23097     if (strcmp(buffer_leaf, argv_leaf) != 0) {
23098         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
23099         return 11;
23100     }
23101
23102     free(buffer);
23103
23104     return 0;
23105 }
23106 EOM
23107
23108 val=$undef
23109 set try
23110 if eval $compile; then
23111         if $run ./try; then
23112                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
23113                 val="$define"
23114         else
23115                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
23116                 val="$undef"
23117         fi
23118 else
23119         echo "I'm unable to compile the test program." >&4
23120         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
23121         val="$undef"
23122 fi
23123 $rm_try
23124 set usekernprocpathname
23125 eval $setvar
23126
23127 : Determine if we can use _NSGetExecutablePath to find executing program
23128 echo " "
23129 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
23130 $cat >try.c <<'EOM'
23131 /* Intentionally a long probe as I'd like to sanity check that the exact
23132    approach is going to work, as thinking it will work, but only having it
23133    part working at runtime is worse than not having it.  */
23134 #include <mach-o/dyld.h>
23135 #include <stdio.h>
23136 #include <stdlib.h>
23137 #include <sys/param.h>
23138 #include <string.h>
23139
23140 int
23141 main(int argc, char **argv) {
23142     char buf[1];
23143     uint32_t size = sizeof(buf);
23144     int result;
23145     char *buffer;
23146     char *tidied;
23147     char *argv_leaf = strrchr(argv[0], '/');
23148     char *tidied_leaf;
23149
23150     if (!argv_leaf) {
23151         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
23152         return 1;
23153     }
23154
23155     _NSGetExecutablePath(buf, &size);
23156     if (size > MAXPATHLEN * MAXPATHLEN) {
23157         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
23158                 (unsigned int) size);
23159         return 2;
23160     }
23161
23162     buffer = (char *)malloc(size);
23163     if (!buffer) {
23164         perror("malloc");
23165         return 3;
23166     }
23167
23168     result = _NSGetExecutablePath(buffer, &size);
23169     if (result != 0) {
23170         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
23171                 result, (unsigned int) size);
23172         return 4;
23173     }
23174
23175     tidied = realpath(buffer, NULL);
23176     if (!tidied) {
23177         perror("realpath");
23178         return 5;
23179     }
23180
23181     free(buffer);
23182
23183     if (*tidied != '/') {
23184         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
23185         return 6;
23186     }
23187
23188     if (strstr(tidied, "/./")) {
23189         fprintf(stderr, "Contains /./: '%s'\n", tidied);
23190         return 7;
23191     }
23192
23193     if (strstr(tidied, "/../")) {
23194         fprintf(stderr, "Contains /../: '%s'\n", tidied);
23195         return 8;
23196     }
23197
23198     tidied_leaf = strrchr(tidied, '/');
23199     if (strcmp(tidied_leaf, argv_leaf) != 0) {
23200         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
23201         return 9;
23202     }
23203
23204     free(tidied);
23205
23206     return 0;
23207 }
23208 EOM
23209
23210 val=$undef
23211 set try
23212 if eval $compile; then
23213         if $run ./try; then
23214                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
23215                 val="$define"
23216         else
23217                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
23218         fi
23219 else
23220         echo "I'm unable to compile the test program." >&4
23221         echo "I'll assume no _NSGetExecutablePath here." >&4
23222 fi
23223 $rm_try
23224 set usensgetexecutablepath
23225 eval $setvar
23226
23227 : Check if site customization support was requested
23228 case "$usesitecustomize" in
23229     $define|true|[Yy]*)
23230         usesitecustomize="$define"
23231         ;;
23232     *)
23233         usesitecustomize="$undef"
23234         ;;
23235     esac
23236
23237 : see if prototypes support variable argument declarations
23238 echo " "
23239 case "$prototype$i_stdarg" in
23240 $define$define)
23241         echo "It appears we'll be able to prototype varargs functions." >&4
23242         val="$define"
23243         ;;
23244 *)
23245         echo "Too bad... We won't be using prototyped varargs functions..." >&4
23246         val="$undef"
23247         ;;
23248 esac
23249 set vaproto
23250 eval $setvar
23251
23252 : determine compiler compiler
23253 case "$yacc" in
23254 '')
23255         dflt=yacc;;
23256 *)
23257         dflt="$yacc";;
23258 esac
23259 echo " "
23260 comp='yacc'
23261 if $test -f "$byacc$_exe"; then
23262         dflt="$byacc"
23263         comp="byacc or $comp"
23264 fi
23265 if $test -f "$bison$_exe"; then
23266         comp="$comp or bison -y"
23267 fi
23268 rp="Which compiler compiler ($comp) shall I use?"
23269 . ./myread
23270 yacc="$ans"
23271 case "$yacc" in
23272 *bis*)
23273         case "$yacc" in
23274         *-y*) ;;
23275         *)
23276                 yacc="$yacc -y"
23277                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
23278                 ;;
23279         esac
23280         ;;
23281 esac
23282
23283 : see if this is a assert.h system
23284 set assert.h i_assert
23285 eval $inhdr
23286
23287 : see if this is a bfd.h system
23288 set bfd.h i_bfd
23289 eval $inhdr
23290
23291 : see if this is an execinfo.h system
23292 set execinfo.h i_execinfo
23293 eval $inhdr
23294
23295 : see if this is a fenv.h system
23296 set fenv.h i_fenv
23297 eval $inhdr
23298
23299 : see if this is a fp.h system
23300 set fp.h i_fp
23301 eval $inhdr
23302
23303 : see if this is a fp_class.h system
23304 set fp_class.h i_fp_class
23305 eval $inhdr
23306
23307 : see if gdbm.h is available
23308 set gdbm.h t_gdbm
23309 eval $inhdr
23310 case "$t_gdbm" in
23311 $define)
23312         : see if gdbm_open exists
23313         set gdbm_open d_gdbm_open
23314         eval $inlibc
23315         case "$d_gdbm_open" in
23316         $undef)
23317                 t_gdbm="$undef"
23318                 echo "We won't be including <gdbm.h>"
23319                 ;;
23320         esac
23321         ;;
23322 esac
23323 val="$t_gdbm"
23324 set i_gdbm
23325 eval $setvar
23326
23327 : see if this is a ieeefp.h system
23328 case "$i_ieeefp" in
23329 '' ) set ieeefp.h i_ieeefp
23330      eval $inhdr
23331      ;;
23332 esac
23333
23334 : see if this is a libutil.h system
23335 set libutil.h i_libutil
23336 eval $inhdr
23337
23338 : see if mach cthreads are available
23339 if test "X$usethreads" = "X$define"; then
23340         set mach/cthreads.h i_machcthr
23341         eval $inhdr
23342 else
23343         i_machcthr="$undef"
23344 fi
23345
23346 : see if this is a mntent.h system
23347 set mntent.h i_mntent
23348 eval $inhdr
23349
23350 : see if net/errno.h is available
23351 val=''
23352 set net/errno.h val
23353 eval $inhdr
23354
23355 : Unfortunately, it causes problems on some systems.  Arrgh.
23356 case "$val" in
23357 $define)
23358         cat > try.c <<'EOM'
23359 #include <stdio.h>
23360 #include <errno.h>
23361 #include <net/errno.h>
23362 int func()
23363 {
23364         return ENOTSOCK;
23365 }
23366 EOM
23367         if $cc $ccflags -c try.c >/dev/null 2>&1; then
23368                 echo "We'll be including <net/errno.h>." >&4
23369         else
23370                 echo "We won't be including <net/errno.h>." >&4
23371                 val="$undef"
23372         fi
23373         $rm_try
23374         ;;
23375 esac
23376 set i_neterrno
23377 eval $setvar
23378
23379 : see if netinet/tcp.h is available
23380 set netinet/tcp.h i_netinettcp
23381 eval $inhdr
23382
23383 : see if this is a poll.h system
23384 set poll.h i_poll
23385 eval $inhdr
23386
23387 : see if this is a prot.h system
23388 set prot.h i_prot
23389 eval $inhdr
23390
23391 : Preprocessor symbols
23392 echo " "
23393 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
23394 $cat <<'EOSH' > Cppsym.know
23395 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
23396 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
23397 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
23398 arch_pwr ardent ARM ARM32 atarist att386 att3b
23399 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
23400 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
23401 byteorder byte_order
23402 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
23403 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
23404 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
23405 ELF encore EPI EXTENSIONS
23406 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
23407 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
23408 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
23409 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
23410 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400 hp9000s500
23411 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
23412 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
23413 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
23414 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
23415 ksr1
23416 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
23417 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
23418 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
23419 luna88k Lynx
23420 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
23421 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
23422 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
23423 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
23424 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
23425 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
23426 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
23427 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
23428 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
23429 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
23430 ns32000 ns32016 ns32332 ns32k nsc32000
23431 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23432 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23433 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23434 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23435 QK_USER QNX
23436 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23437 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23438 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23439 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23440 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23441 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23442 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23443 SYSV4 SYSV5 sysV68 sysV88
23444 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23445 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23446 tower32_800 tower32_850 tss
23447 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23448 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23449 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23450 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23451 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23452 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23453 uxpm uxps
23454 vax venix VMESA vms
23455 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23456 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23457 z8000 zarch
23458 EOSH
23459 # Maybe put other stuff here too.
23460 ./tr '-' '_' <<EOSH >>Cppsym.know
23461 $osname
23462 EOSH
23463 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23464 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23465 $cat Cppsym.know > Cppsym.c
23466 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23467 $rm -f Cppsym.a Cppsym.b Cppsym.c
23468 cat <<EOSH > Cppsym
23469 $startsh
23470 if $test \$# -gt 0; then
23471     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23472     if $test -s Cppsym.got; then
23473         $rm -f Cppsym.got
23474         exit 0
23475     fi
23476     $rm -f Cppsym.got
23477     exit 1
23478 else
23479     $tr " " "$trnl" | ./Cppsym.try
23480     exit 0
23481 fi
23482 EOSH
23483 chmod +x Cppsym
23484 $eunicefix Cppsym
23485 cat <<EOSH > Cppsym.try
23486 $startsh
23487 cat <<'EOCP' > try.c
23488 #include <stdio.h>
23489 #if cpp_stuff == 1
23490 #define STRINGIFY(a)    "a"
23491 #endif
23492 #if cpp_stuff == 42
23493 #define StGiFy(a)  #a
23494 #define STRINGIFY(a)    StGiFy(a)
23495 #endif
23496 #if $cpp_stuff != 1 && $cpp_stuff != 42
23497 #   include "Bletch: How does this C preprocessor stringify macros?"
23498 #endif
23499 int main() {
23500 EOCP
23501 $awk \\
23502 EOSH
23503 cat <<'EOSH' >> Cppsym.try
23504 'length($1) > 0 {
23505     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23506     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23507     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23508     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23509 }'       >> try.c
23510 echo 'return 0;}' >> try.c
23511 EOSH
23512 cat <<EOSH >> Cppsym.try
23513 ccflags="$ccflags"
23514 case "$osname-$gccversion" in
23515 irix-) ccflags="\$ccflags -woff 1178" ;;
23516 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
23517 esac
23518 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
23519 EOSH
23520 chmod +x Cppsym.try
23521 $eunicefix Cppsym.try
23522 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
23523 : Add in any Linux cpp "predefined macros":
23524 case "$osname::$gccversion" in
23525   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
23526     tHdrH=_tmpHdr
23527     rm -f $tHdrH'.h' $tHdrH
23528     touch $tHdrH'.h'
23529     # Filter out macro arguments, such as Linux's __INT8_C(c)
23530     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
23531        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
23532        if [ -s $tHdrH'_cppsym.real' ]; then
23533           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
23534        fi
23535     fi
23536     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
23537   ;;
23538 esac
23539 : now check the C compiler for additional symbols
23540 postprocess_cc_v=''
23541 case "$osname" in
23542 aix) postprocess_cc_v="|$tr , ' '" ;;
23543 esac
23544 $cat >ccsym <<EOS
23545 $startsh
23546 $cat >tmp.c <<EOF
23547 extern int foo;
23548 EOF
23549 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
23550 do
23551         case "\$i" in
23552         -D*) echo "\$i" | $sed 's/^-D//';;
23553         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
23554         esac
23555 done
23556 $rm_try
23557 EOS
23558 postprocess_cc_v=''
23559 chmod +x ccsym
23560 $eunicefix ccsym
23561 ./ccsym > ccsym1.raw
23562 if $test -s ccsym1.raw; then
23563     $sort ccsym1.raw | $uniq >ccsym.raw
23564 else
23565     mv ccsym1.raw ccsym.raw
23566 fi
23567
23568 $awk '/\=/ { print $0; next }
23569         { print $0"=1" }' ccsym.raw >ccsym.list
23570 $comm -13 Cppsym.true ccsym.list >ccsym.own
23571 $comm -12 Cppsym.true ccsym.list >ccsym.com
23572 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
23573 also=''
23574 if $test -z ccsym.raw; then
23575         echo "Your C compiler doesn't seem to define any symbols!" >&4
23576         echo " "
23577         echo "However, your C preprocessor defines the following symbols:"
23578         $cat Cppsym.true
23579         ccsymbols=''
23580         cppsymbols=`$cat Cppsym.true`
23581         cppsymbols=`echo $cppsymbols`
23582         cppccsymbols="$cppsymbols"
23583 else
23584         if $test -s ccsym.com; then
23585                 echo "Your C compiler and pre-processor define these symbols:"
23586                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
23587                 also='also '
23588                 symbols='ones'
23589                 cppccsymbols=`$cat ccsym.com`
23590                 cppccsymbols=`echo $cppccsymbols`
23591                 $test "$silent" || sleep 1
23592         fi
23593         if $test -s ccsym.cpp; then
23594                 $test "$also" && echo " "
23595                 echo "Your C pre-processor ${also}defines the following symbols:"
23596                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
23597                 also='further '
23598                 cppsymbols=`$cat ccsym.cpp`
23599                 cppsymbols=`echo $cppsymbols`
23600                 $test "$silent" || sleep 1
23601         fi
23602         if $test -s ccsym.own; then
23603                 $test "$also" && echo " "
23604                 echo "Your C compiler ${also}defines the following cpp symbols:"
23605                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
23606                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
23607                 ccsymbols=`$cat ccsym.own`
23608                 ccsymbols=`echo $ccsymbols`
23609                 $test "$silent" || sleep 1
23610         fi
23611 fi
23612
23613 : add -D_FORTIFY_SOURCE if feasible and not already there
23614 case "$gccversion" in
23615 [45].*) case "$optimize$ccflags" in
23616         *-O*)   case "$ccflags$cppsymbols" in
23617                 *_FORTIFY_SOURCE=*) # Don't add it again.
23618                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
23619                         ;;
23620                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
23621                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
23622                         ;;
23623                 esac
23624                 ;;
23625         *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
23626                 ;;
23627         esac
23628         ;;
23629 *)      echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
23630         ;;
23631 esac
23632
23633 : see if this is a termio system
23634 val="$undef"
23635 val2="$undef"
23636 val3="$undef"
23637 if $test `./findhdr termios.h`; then
23638     set tcsetattr i_termios
23639     eval $inlibc
23640     val3="$i_termios"
23641 fi
23642 echo " "
23643 case "$val3" in
23644     "$define") echo "You have POSIX termios.h... good!" >&4;;
23645     *)  if ./Cppsym pyr; then
23646             case "`$run /bin/universe`" in
23647                 ucb) if $test `./findhdr sgtty.h`; then
23648                         val2="$define"
23649                         echo "<sgtty.h> found." >&4
23650                     else
23651                         echo "System is pyramid with BSD universe."
23652                         ./warn "<sgtty.h> not found--you could have problems."
23653                     fi;;
23654                 *)  if $test `./findhdr termio.h`; then
23655                         val="$define"
23656                         echo "<termio.h> found." >&4
23657                     else
23658                         echo "System is pyramid with USG universe."
23659                         ./warn "<termio.h> not found--you could have problems."
23660                     fi;;
23661             esac
23662         elif ./usg; then
23663             if $test `./findhdr termio.h`; then
23664                 echo "<termio.h> found." >&4
23665                 val="$define"
23666             elif $test `./findhdr sgtty.h`; then
23667                 echo "<sgtty.h> found." >&4
23668                 val2="$define"
23669             else
23670                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23671             fi
23672         else
23673             if $test `./findhdr sgtty.h`; then
23674                 echo "<sgtty.h> found." >&4
23675                 val2="$define"
23676             elif $test `./findhdr termio.h`; then
23677                 echo "<termio.h> found." >&4
23678                 val="$define"
23679             else
23680                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23681             fi
23682         fi;;
23683 esac
23684 set i_termio; eval $setvar
23685 val=$val2; set i_sgtty; eval $setvar
23686 val=$val3; set i_termios; eval $setvar
23687
23688 : see if stdbool is available
23689 : we want a real compile instead of Inhdr because some Solaris systems
23690 : have stdbool.h, but it can only be used if the compiler indicates it
23691 : is sufficiently c99-compliant.
23692 echo " "
23693 $cat >try.c <<EOCP
23694 #include <stdio.h>
23695 #include <stdbool.h>
23696 int func(bool x)
23697 {
23698     return x ? 1 : 0;
23699 }
23700 int main(int argc, char **argv)
23701 {
23702     return func(0);
23703 }
23704 EOCP
23705 set try
23706 if eval $compile; then
23707         echo "<stdbool.h> found." >&4
23708         val="$define"
23709 else
23710         echo "<stdbool.h> NOT found." >&4
23711         val="$undef"
23712 fi
23713 $rm_try
23714 set i_stdbool
23715 eval $setvar
23716
23717 : see if stddef is available
23718 set stddef.h i_stddef
23719 eval $inhdr
23720
23721 : see if stdint is available
23722 set stdint.h i_stdint
23723 eval $inhdr
23724
23725 : see if sys/access.h is available
23726 set sys/access.h i_sysaccess
23727 eval $inhdr
23728
23729 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23730 set sys/filio.h i_sysfilio
23731 eval $inhdr
23732 echo " "
23733 if $test `./findhdr sys/ioctl.h`; then
23734         val="$define"
23735         echo '<sys/ioctl.h> found.' >&4
23736 else
23737         val="$undef"
23738         if $test $i_sysfilio = "$define"; then
23739             echo '<sys/ioctl.h> NOT found.' >&4
23740         else
23741                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23742                 $test $i_termio = "$define" && xxx="termio.h"
23743                 $test $i_termios = "$define" && xxx="termios.h"
23744 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23745         fi
23746 fi
23747 set i_sysioctl
23748 eval $setvar
23749
23750 : see if socket ioctl defs are in sys/sockio.h
23751 echo " "
23752 xxx=`./findhdr sys/sockio.h`
23753 if $test "$xxx"; then
23754         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23755                 val="$define"
23756                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23757         else
23758                 val="$undef"
23759                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23760         fi
23761 else
23762         val="$undef"
23763         $cat <<EOM
23764 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23765 EOM
23766 fi
23767 set i_syssockio
23768 eval $setvar
23769
23770 : see if this is a syslog.h system
23771 set syslog.h i_syslog
23772 eval $inhdr
23773
23774 : see if this is a sys/mode.h system
23775 set sys/mode.h i_sysmode
23776 eval $inhdr
23777
23778 : see if there is a sys/poll.h file
23779 set sys/poll.h i_syspoll
23780 eval $inhdr
23781
23782 : see if sys/resource.h has to be included
23783 set sys/resource.h i_sysresrc
23784 eval $inhdr
23785
23786 : see if sys/security.h is available
23787 set sys/security.h i_syssecrt
23788 eval $inhdr
23789
23790 : see if this is a sys/statvfs.h system
23791 set sys/statvfs.h i_sysstatvfs
23792 eval $inhdr
23793
23794 : see if this is a sys/un.h system
23795 set sys/un.h i_sysun
23796 eval $inhdr
23797
23798 : see if this is a sys/utsname.h system
23799 set sys/utsname.h i_sysutsname
23800 eval $inhdr
23801
23802 : see if this is a syswait system
23803 set sys/wait.h i_syswait
23804 eval $inhdr
23805
23806 : see if this is a ustat.h system
23807 set ustat.h i_ustat
23808 eval $inhdr
23809
23810 : see if this is an utime system
23811 set utime.h i_utime
23812 eval $inhdr
23813
23814 : see if this is a vfork system
23815 case "$d_vfork" in
23816 "$define")
23817         set vfork.h i_vfork
23818         eval $inhdr
23819         ;;
23820 *)
23821         i_vfork="$undef"
23822         ;;
23823 esac
23824
23825 : Check extensions
23826 echo " "
23827 echo "Looking for extensions..." >&4
23828 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23829 : contain old or inaccurate or duplicate values.
23830 nonxs_extensions=''
23831 xs_extensions=''
23832 : We do not use find because it might not be available.
23833 : We do not just use MANIFEST because the user may have dropped
23834 : some additional extensions into the source tree and expect them
23835 : to be built.
23836
23837 : Function to recursively find available extensions, ignoring DynaLoader
23838 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23839 : In 5.10.1 and later, extensions are stored in directories
23840 : like File-Glob instead of the older File/Glob/.
23841 find_extensions='
23842     for xxx in *; do
23843         case "$xxx" in
23844             DynaLoader|dynaload) ;;
23845             *)
23846             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23847             case "$this_ext" in
23848                 Scalar/List/Utils) this_ext="List/Util" ;;
23849                 PathTools)         this_ext="Cwd"       ;;
23850             esac;
23851             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23852             if $contains " $this_ext " "$tdir/$$.tmp"; then
23853                 echo >&4;
23854                 echo "Duplicate directories detected for extension $xxx" >&4;
23855                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23856                 case "$knowitall" in
23857                 "") dflt=y;;
23858                 *) dflt=n;;
23859                 esac;
23860                 . ../UU/myread;
23861                 case "$ans" in
23862                 n*|N*) ;;
23863                 *) echo >&4;
23864                     echo "Ok.  Stopping Configure." >&4;
23865                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23866                     exit 1;;
23867                 esac;
23868                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23869             fi;
23870             $ls -1 "$xxx" > "$tdir/$$.tmp";
23871             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23872                 xs_extensions="$xs_extensions $this_ext";
23873             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
23874                 xs_extensions="$xs_extensions $this_ext";
23875             elif $test -d "$xxx"; then
23876                 nonxs_extensions="$nonxs_extensions $this_ext";
23877             fi;
23878             $rm -f "$tdir/$$.tmp";
23879             ;;
23880         esac;
23881     done'
23882 tdir=`pwd`
23883 cd "$rsrc/cpan"
23884 set X
23885 shift
23886 eval $find_extensions
23887 cd "$rsrc/dist"
23888 set X
23889 shift
23890 eval $find_extensions
23891 cd "$rsrc/ext"
23892 set X
23893 shift
23894 eval $find_extensions
23895 set X $xs_extensions
23896 shift
23897 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23898 set X $nonxs_extensions
23899 shift
23900 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23901 cd "$tdir"
23902 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23903
23904 : Now see which are supported on this system.
23905 avail_ext=''
23906 for xxx in $xs_extensions ; do
23907         case "$xxx" in
23908         Amiga*)
23909                 case "$osname" in
23910                 amigaos) avail_ext="$avail_ext $xxx" ;;
23911                 esac
23912                 ;;
23913         DB_File|db_file)
23914                 case "$i_db" in
23915                 $define) avail_ext="$avail_ext $xxx" ;;
23916                 esac
23917                 ;;
23918         GDBM_File|gdbm_fil)
23919                 case "$i_gdbm" in
23920                 $define) avail_ext="$avail_ext $xxx" ;;
23921                 esac
23922                 ;;
23923         I18N/Langinfo|i18n_lan)
23924                 case "$i_langinfo$d_nl_langinfo" in
23925                 $define$define) avail_ext="$avail_ext $xxx" ;;
23926                 esac
23927                 ;;
23928         IPC/SysV|ipc/sysv)
23929                 : XXX Do we need a useipcsysv variable here
23930                 case "${d_msg}${d_sem}${d_shm}" in
23931                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23932                 esac
23933                 ;;
23934         NDBM_File|ndbm_fil)
23935                 case "$d_ndbm" in
23936                 $define)
23937                     case "$osname-$use64bitint" in
23938                     hpux-define)
23939                         case "$libs" in
23940                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23941                         esac
23942                         ;;
23943                     *) avail_ext="$avail_ext $xxx" ;;
23944                     esac
23945                     ;;
23946                 esac
23947                 ;;
23948         ODBM_File|odbm_fil)
23949                 case "${i_dbm}${i_rpcsvcdbm}" in
23950                 *"${define}"*)
23951                     case "$d_cplusplus" in
23952                     define) ;; # delete as a function name will not work
23953                     *)  case "$osname-$use64bitint" in
23954                         hpux-define)
23955                             case "$libs" in
23956                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23957                             esac
23958                             ;;
23959                         *) avail_ext="$avail_ext $xxx" ;;
23960                         esac
23961                         ;;
23962                     esac
23963                     ;;
23964                 esac
23965                 ;;
23966         Opcode|opcode)
23967                 case "$useopcode" in
23968                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23969                 esac
23970                 ;;
23971         POSIX|posix)
23972                 case "$useposix" in
23973                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23974                 esac
23975                 ;;
23976         Socket|socket)
23977                 case "$d_socket" in
23978                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23979                 esac
23980                 ;;
23981         Sys/Syslog|sys/syslog)
23982                 case $osname in
23983                         amigaos) ;; # not really very useful on AmigaOS
23984                         *)
23985                         : XXX syslog requires socket
23986                         case "$d_socket" in
23987                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
23988                         esac
23989                         ;;
23990                 esac
23991                 ;;
23992         Thread|thread)
23993                 case "$usethreads" in
23994                 true|$define|y)
23995                         case "$use5005threads" in
23996                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23997                         esac
23998                 esac
23999                 ;;
24000         threads|threads/shared)
24001                 # threads and threads::shared are special cases.
24002                 # To stop people from asking "Perl 5.8.0 was supposed
24003                 # to have this new fancy threads implementation but my
24004                 # perl doesn't have it" and from people trying to
24005                 # (re)install the threads module using CPAN.pm and
24006                 # CPAN.pm then offering to reinstall Perl 5.8.0,
24007                 # the threads.pm and threads/shared.pm will always be
24008                 # there, croaking informatively ("you need to rebuild
24009                 # all of Perl with threads, sorry") when threads haven't
24010                 # been compiled in.
24011                 # --jhi
24012                 avail_ext="$avail_ext $xxx"
24013                 ;;
24014         VMS*)
24015                 ;;
24016         Win32*)
24017                 case "$osname" in
24018                 cygwin) avail_ext="$avail_ext $xxx" ;;
24019                 esac
24020                 ;;
24021         XS/APItest|xs/apitest)
24022                 # This is just for testing.  Skip it unless we have dynamic loading.
24023
24024                 case "$usedl" in
24025                 $define) avail_ext="$avail_ext $xxx" ;;
24026                 esac
24027                 ;;
24028         XS/Typemap|xs/typemap)
24029                 # This is just for testing.  Skip it unless we have dynamic loading.
24030                 case "$usedl" in
24031                 $define) avail_ext="$avail_ext $xxx" ;;
24032                 esac
24033                 ;;
24034         *)      avail_ext="$avail_ext $xxx"
24035                 ;;
24036         esac
24037 done
24038
24039 set X $avail_ext
24040 shift
24041 avail_ext="$*"
24042
24043 case "$onlyextensions" in
24044 '') ;;
24045 *)  keepextensions=''
24046     echo "You have requested that only certain extensions be included..." >&4
24047     for i in $onlyextensions; do
24048         case " $avail_ext " in
24049         *" $i "*)
24050             echo "Keeping extension $i."
24051             keepextensions="$keepextensions $i"
24052             ;;
24053         *) echo "Ignoring extension $i." ;;
24054         esac
24055     done
24056     avail_ext="$keepextensions"
24057     ;;
24058 esac
24059
24060 case "$noextensions" in
24061 '') ;;
24062 *)  keepextensions=''
24063     echo "You have requested that certain extensions be ignored..." >&4
24064     for i in $avail_ext; do
24065         case " $noextensions " in
24066         *" $i "*) echo "Ignoring extension $i." ;;
24067         *) echo "Keeping extension $i.";
24068            keepextensions="$keepextensions $i"
24069            ;;
24070         esac
24071     done
24072     avail_ext="$keepextensions"
24073     ;;
24074 esac
24075
24076 : Now see which nonxs extensions are supported on this system.
24077 : For now assume all are.
24078 nonxs_ext=''
24079 for xxx in $nonxs_extensions ; do
24080         case "$xxx" in
24081         VMS*)
24082                 ;;
24083         *)      nonxs_ext="$nonxs_ext $xxx"
24084                 ;;
24085         esac
24086 done
24087
24088 set X $nonxs_ext
24089 shift
24090 nonxs_ext="$*"
24091
24092 case $usedl in
24093 $define)
24094         $cat <<EOM
24095 A number of extensions are supplied with $package.  You may choose to
24096 compile these extensions for dynamic loading (the default), compile
24097 them into the $package executable (static loading), or not include
24098 them at all.  Answer "none" to include no extensions.
24099 Note that DynaLoader is always built and need not be mentioned here.
24100
24101 EOM
24102         case "$dynamic_ext" in
24103         '')
24104                 : Exclude those listed in static_ext
24105                 dflt=''
24106                 for xxx in $avail_ext; do
24107                         case " $static_ext " in
24108                         *" $xxx "*) ;;
24109                         *) dflt="$dflt $xxx" ;;
24110                         esac
24111                 done
24112                 set X $dflt
24113                 shift
24114                 dflt="$*"
24115                 ;;
24116         *)      dflt="$dynamic_ext"
24117                 # Perhaps we are reusing an old out-of-date config.sh.
24118                 case "$hint" in
24119                 previous)
24120                         if test X"$dynamic_ext" != X"$avail_ext"; then
24121                                 $cat <<EOM
24122 NOTICE:  Your previous config.sh list may be incorrect.
24123 The extensions now available to you are
24124         ${avail_ext}
24125 but the default list from your previous config.sh is
24126         ${dynamic_ext}
24127
24128 EOM
24129                         fi
24130                         ;;
24131                 esac
24132                 ;;
24133         esac
24134         case "$dflt" in
24135         '')     dflt=none;;
24136         esac
24137         rp="What extensions do you wish to load dynamically?"
24138         . ./myread
24139         case "$ans" in
24140         none) dynamic_ext=' ' ;;
24141         *) dynamic_ext="$ans" ;;
24142         esac
24143
24144         case "$static_ext" in
24145         '')
24146                 : Exclude those already listed in dynamic linking
24147                 dflt=''
24148                 for xxx in $avail_ext; do
24149                         case " $dynamic_ext " in
24150                         *" $xxx "*) ;;
24151                         *) dflt="$dflt $xxx" ;;
24152                         esac
24153                 done
24154                 set X $dflt
24155                 shift
24156                 dflt="$*"
24157                 ;;
24158         *)  dflt="$static_ext"
24159                 ;;
24160         esac
24161
24162         case "$dflt" in
24163         '')     dflt=none;;
24164         esac
24165         rp="What extensions do you wish to load statically?"
24166         . ./myread
24167         case "$ans" in
24168         none) static_ext=' ' ;;
24169         *) static_ext="$ans" ;;
24170         esac
24171         ;;
24172 *)
24173         $cat <<EOM
24174 A number of extensions are supplied with $package.  Answer "none"
24175 to include no extensions.
24176 Note that DynaLoader is always built and need not be mentioned here.
24177
24178 EOM
24179         case "$static_ext" in
24180         '') dflt="$avail_ext" ;;
24181         *)      dflt="$static_ext"
24182                 # Perhaps we are reusing an old out-of-date config.sh.
24183                 case "$hint" in
24184                 previous)
24185                         if test X"$static_ext" != X"$avail_ext"; then
24186                                 $cat <<EOM
24187 NOTICE:  Your previous config.sh list may be incorrect.
24188 The extensions now available to you are
24189         ${avail_ext}
24190 but the default list from your previous config.sh is
24191         ${static_ext}
24192
24193 EOM
24194                         fi
24195                         ;;
24196                 esac
24197                 ;;
24198         esac
24199         : Exclude those that are not xs extensions
24200         case "$dflt" in
24201         '')     dflt=none;;
24202         esac
24203         rp="What extensions do you wish to include?"
24204         . ./myread
24205         case "$ans" in
24206         none) static_ext=' ' ;;
24207         *) static_ext="$ans" ;;
24208         esac
24209         ;;
24210 esac
24211 #
24212 # Encode is a special case.  If we are building Encode as a static
24213 # extension, we need to explicitly list its subextensions as well.
24214 # For other nested extensions, this is handled automatically by
24215 # the appropriate Makefile.PL.
24216 case " $static_ext " in
24217         *" Encode "*) # Add the subextensions of Encode
24218         cd "$rsrc/cpan"
24219         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
24220                 static_ext="$static_ext Encode/$xxx"
24221                 known_extensions="$known_extensions Encode/$xxx"
24222         done
24223         cd "$tdir"
24224         ;;
24225 esac
24226
24227 set X $dynamic_ext $static_ext $nonxs_ext
24228 shift
24229 extensions="$*"
24230
24231 # Sanity check:  We require an extension suitable for use with
24232 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
24233 # should show up as failures in the test suite, but it's helpful to
24234 # catch them now.) The 'extensions' list is normally sorted
24235 # alphabetically, so we need to accept either
24236 #    DB_File ... Fcntl ... IO  ....
24237 # or something like
24238 #    Fcntl ... NDBM_File ... IO  ....
24239 case " $extensions"  in
24240 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
24241 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
24242 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
24243 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
24244    echo "WARNING: The Perl you are building will be quite crippled." >& 4
24245    ;;
24246 esac
24247
24248 : Remove libraries needed only for extensions
24249 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
24250 : The exception is SunOS 4.x, which needs them.
24251 case "${osname}X${osvers}" in
24252 sunos*X4*)
24253     perllibs="$libs"
24254     ;;
24255 *) case "$usedl" in
24256     $define|true|[yY]*)
24257             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
24258             shift
24259             perllibs="$*"
24260             ;;
24261     *)  perllibs="$libs"
24262             ;;
24263     esac
24264     ;;
24265 esac
24266
24267 : Remove build directory name from cppstdin so it can be used from
24268 : either the present location or the final installed location.
24269 echo " "
24270 : Get out of the UU directory to get correct path name.
24271 cd ..
24272 case "$cppstdin" in
24273 `pwd`/cppstdin)
24274         echo "Stripping down cppstdin path name"
24275         cppstdin=cppstdin
24276         ;;
24277 esac
24278 cd UU
24279
24280 : end of configuration questions
24281 echo " "
24282 echo "End of configuration questions."
24283 echo " "
24284
24285 : back to where it started
24286 if test -d ../UU; then
24287         cd ..
24288 fi
24289
24290 : configuration may be unconditionally patched via a 'config.arch' file
24291 if $test -f config.arch; then
24292         echo "I see a config.arch file, loading it." >&4
24293         . ./config.arch
24294 fi
24295
24296 : configuration may be patched via a 'config.over' file
24297 if $test -f config.over; then
24298         echo " "
24299         dflt=y
24300         rp='I see a config.over file.  Do you wish to load it?'
24301         . UU/myread
24302         case "$ans" in
24303         n*) echo "OK, I'll ignore it.";;
24304         *)      . ./config.over
24305                 echo "Configuration override changes have been loaded."
24306                 ;;
24307         esac
24308 fi
24309
24310 : in case they want portability, strip down executable paths
24311 case "$d_portable" in
24312 "$define")
24313         echo " "
24314         echo "Stripping down executable paths..." >&4
24315         for file in $loclist $trylist; do
24316                 eval temp=\$$file
24317                 eval $file=`basename $temp`
24318         done
24319         ;;
24320 esac
24321
24322 : create config.sh file
24323 echo " "
24324 echo "Creating config.sh..." >&4
24325 $spitshell <<EOT >config.sh
24326 $startsh
24327 #
24328 # This file was produced by running the Configure script. It holds all the
24329 # definitions figured out by Configure. Should you modify one of these values,
24330 # do not forget to propagate your changes by running "Configure -der". You may
24331 # instead choose to run each of the .SH files by yourself, or "Configure -S".
24332 #
24333
24334 # Package name      : $package
24335 # Source directory  : $src
24336 # Configuration time: $cf_time
24337 # Configured by     : $cf_by
24338 # Target system     : $myuname
24339
24340 EOT
24341 : Add in command line options if available
24342 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
24343
24344 $spitshell <<EOT >>config.sh
24345
24346 Author='$Author'
24347 Date='$Date'
24348 Header='$Header'
24349 Id='$Id'
24350 Locker='$Locker'
24351 Log='$Log'
24352 RCSfile='$RCSfile'
24353 Revision='$Revision'
24354 Source='$Source'
24355 State='$State'
24356 _a='$_a'
24357 _exe='$_exe'
24358 _o='$_o'
24359 afs='$afs'
24360 afsroot='$afsroot'
24361 alignbytes='$alignbytes'
24362 ansi2knr='$ansi2knr'
24363 aphostname='$aphostname'
24364 api_revision='$api_revision'
24365 api_subversion='$api_subversion'
24366 api_version='$api_version'
24367 api_versionstring='$api_versionstring'
24368 ar='$ar'
24369 archlib='$archlib'
24370 archlibexp='$archlibexp'
24371 archname64='$archname64'
24372 archname='$archname'
24373 archobjs='$archobjs'
24374 asctime_r_proto='$asctime_r_proto'
24375 awk='$awk'
24376 baserev='$baserev'
24377 bash='$bash'
24378 bin='$bin'
24379 bin_ELF='$bin_ELF'
24380 binexp='$binexp'
24381 bison='$bison'
24382 byacc='$byacc'
24383 byteorder='$byteorder'
24384 c='$c'
24385 castflags='$castflags'
24386 cat='$cat'
24387 cc='$cc'
24388 cccdlflags='$cccdlflags'
24389 ccdlflags='$ccdlflags'
24390 ccflags='$ccflags'
24391 ccflags_uselargefiles='$ccflags_uselargefiles'
24392 ccname='$ccname'
24393 ccsymbols='$ccsymbols'
24394 ccversion='$ccversion'
24395 cf_by='$cf_by'
24396 cf_email='$cf_email'
24397 cf_time='$cf_time'
24398 charbits='$charbits'
24399 charsize='$charsize'
24400 chgrp='$chgrp'
24401 chmod='$chmod'
24402 chown='$chown'
24403 clocktype='$clocktype'
24404 comm='$comm'
24405 compress='$compress'
24406 contains='$contains'
24407 cp='$cp'
24408 cpio='$cpio'
24409 cpp='$cpp'
24410 cpp_stuff='$cpp_stuff'
24411 cppccsymbols='$cppccsymbols'
24412 cppflags='$cppflags'
24413 cpplast='$cpplast'
24414 cppminus='$cppminus'
24415 cpprun='$cpprun'
24416 cppstdin='$cppstdin'
24417 cppsymbols='$cppsymbols'
24418 crypt_r_proto='$crypt_r_proto'
24419 cryptlib='$cryptlib'
24420 csh='$csh'
24421 ctermid_r_proto='$ctermid_r_proto'
24422 ctime_r_proto='$ctime_r_proto'
24423 d_Gconvert='$d_Gconvert'
24424 d_PRIEUldbl='$d_PRIEUldbl'
24425 d_PRIFUldbl='$d_PRIFUldbl'
24426 d_PRIGUldbl='$d_PRIGUldbl'
24427 d_PRIXU64='$d_PRIXU64'
24428 d_PRId64='$d_PRId64'
24429 d_PRIeldbl='$d_PRIeldbl'
24430 d_PRIfldbl='$d_PRIfldbl'
24431 d_PRIgldbl='$d_PRIgldbl'
24432 d_PRIi64='$d_PRIi64'
24433 d_PRIo64='$d_PRIo64'
24434 d_PRIu64='$d_PRIu64'
24435 d_PRIx64='$d_PRIx64'
24436 d_SCNfldbl='$d_SCNfldbl'
24437 d__fwalk='$d__fwalk'
24438 d_access='$d_access'
24439 d_accessx='$d_accessx'
24440 d_acosh='$d_acosh'
24441 d_aintl='$d_aintl'
24442 d_alarm='$d_alarm'
24443 d_archlib='$d_archlib'
24444 d_asctime64='$d_asctime64'
24445 d_asctime_r='$d_asctime_r'
24446 d_asinh='$d_asinh'
24447 d_atanh='$d_atanh'
24448 d_atolf='$d_atolf'
24449 d_atoll='$d_atoll'
24450 d_attribute_deprecated='$d_attribute_deprecated'
24451 d_attribute_format='$d_attribute_format'
24452 d_attribute_malloc='$d_attribute_malloc'
24453 d_attribute_nonnull='$d_attribute_nonnull'
24454 d_attribute_noreturn='$d_attribute_noreturn'
24455 d_attribute_pure='$d_attribute_pure'
24456 d_attribute_unused='$d_attribute_unused'
24457 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24458 d_backtrace='$d_backtrace'
24459 d_bcmp='$d_bcmp'
24460 d_bcopy='$d_bcopy'
24461 d_bsd='$d_bsd'
24462 d_bsdgetpgrp='$d_bsdgetpgrp'
24463 d_bsdsetpgrp='$d_bsdsetpgrp'
24464 d_builtin_choose_expr='$d_builtin_choose_expr'
24465 d_builtin_expect='$d_builtin_expect'
24466 d_bzero='$d_bzero'
24467 d_c99_variadic_macros='$d_c99_variadic_macros'
24468 d_casti32='$d_casti32'
24469 d_castneg='$d_castneg'
24470 d_cbrt='$d_cbrt'
24471 d_charvspr='$d_charvspr'
24472 d_chown='$d_chown'
24473 d_chroot='$d_chroot'
24474 d_chsize='$d_chsize'
24475 d_class='$d_class'
24476 d_clearenv='$d_clearenv'
24477 d_closedir='$d_closedir'
24478 d_cmsghdr_s='$d_cmsghdr_s'
24479 d_const='$d_const'
24480 d_copysign='$d_copysign'
24481 d_copysignl='$d_copysignl'
24482 d_cplusplus='$d_cplusplus'
24483 d_crypt='$d_crypt'
24484 d_crypt_r='$d_crypt_r'
24485 d_csh='$d_csh'
24486 d_ctermid='$d_ctermid'
24487 d_ctermid_r='$d_ctermid_r'
24488 d_ctime64='$d_ctime64'
24489 d_ctime_r='$d_ctime_r'
24490 d_cuserid='$d_cuserid'
24491 d_dbl_dig='$d_dbl_dig'
24492 d_dbminitproto='$d_dbminitproto'
24493 d_difftime64='$d_difftime64'
24494 d_difftime='$d_difftime'
24495 d_dir_dd_fd='$d_dir_dd_fd'
24496 d_dirfd='$d_dirfd'
24497 d_dirnamlen='$d_dirnamlen'
24498 d_dladdr='$d_dladdr'
24499 d_dlerror='$d_dlerror'
24500 d_dlopen='$d_dlopen'
24501 d_dlsymun='$d_dlsymun'
24502 d_dosuid='$d_dosuid'
24503 d_double_has_inf='$d_double_has_inf'
24504 d_double_has_nan='$d_double_has_nan'
24505 d_double_has_negative_zero='$d_double_has_negative_zero'
24506 d_double_has_subnormals='$d_double_has_subnormals'
24507 d_double_style_cray='$d_double_style_cray'
24508 d_double_style_ibm='$d_double_style_ibm'
24509 d_double_style_ieee='$d_double_style_ieee'
24510 d_double_style_vax='$d_double_style_vax'
24511 d_drand48_r='$d_drand48_r'
24512 d_drand48proto='$d_drand48proto'
24513 d_dup2='$d_dup2'
24514 d_duplocale='$d_duplocale'
24515 d_eaccess='$d_eaccess'
24516 d_endgrent='$d_endgrent'
24517 d_endgrent_r='$d_endgrent_r'
24518 d_endhent='$d_endhent'
24519 d_endhostent_r='$d_endhostent_r'
24520 d_endnent='$d_endnent'
24521 d_endnetent_r='$d_endnetent_r'
24522 d_endpent='$d_endpent'
24523 d_endprotoent_r='$d_endprotoent_r'
24524 d_endpwent='$d_endpwent'
24525 d_endpwent_r='$d_endpwent_r'
24526 d_endsent='$d_endsent'
24527 d_endservent_r='$d_endservent_r'
24528 d_eofnblk='$d_eofnblk'
24529 d_erf='$d_erf'
24530 d_erfc='$d_erfc'
24531 d_eunice='$d_eunice'
24532 d_exp2='$d_exp2'
24533 d_expm1='$d_expm1'
24534 d_faststdio='$d_faststdio'
24535 d_fchdir='$d_fchdir'
24536 d_fchmod='$d_fchmod'
24537 d_fchown='$d_fchown'
24538 d_fcntl='$d_fcntl'
24539 d_fcntl_can_lock='$d_fcntl_can_lock'
24540 d_fd_macros='$d_fd_macros'
24541 d_fd_set='$d_fd_set'
24542 d_fdclose='$d_fdclose'
24543 d_fdim='$d_fdim'
24544 d_fds_bits='$d_fds_bits'
24545 d_fegetround='$d_fegetround'
24546 d_fgetpos='$d_fgetpos'
24547 d_finite='$d_finite'
24548 d_finitel='$d_finitel'
24549 d_flexfnam='$d_flexfnam'
24550 d_flock='$d_flock'
24551 d_flockproto='$d_flockproto'
24552 d_fma='$d_fma'
24553 d_fmax='$d_fmax'
24554 d_fmin='$d_fmin'
24555 d_fork='$d_fork'
24556 d_fp_class='$d_fp_class'
24557 d_fp_classify='$d_fp_classify'
24558 d_fp_classl='$d_fp_classl'
24559 d_fpathconf='$d_fpathconf'
24560 d_fpclass='$d_fpclass'
24561 d_fpclassify='$d_fpclassify'
24562 d_fpclassl='$d_fpclassl'
24563 d_fpgetround='$d_fpgetround'
24564 d_fpos64_t='$d_fpos64_t'
24565 d_freelocale='$d_freelocale'
24566 d_frexpl='$d_frexpl'
24567 d_fs_data_s='$d_fs_data_s'
24568 d_fseeko='$d_fseeko'
24569 d_fsetpos='$d_fsetpos'
24570 d_fstatfs='$d_fstatfs'
24571 d_fstatvfs='$d_fstatvfs'
24572 d_fsync='$d_fsync'
24573 d_ftello='$d_ftello'
24574 d_ftime='$d_ftime'
24575 d_futimes='$d_futimes'
24576 d_gai_strerror='$d_gai_strerror'
24577 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
24578 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
24579 d_getaddrinfo='$d_getaddrinfo'
24580 d_getcwd='$d_getcwd'
24581 d_getespwnam='$d_getespwnam'
24582 d_getfsstat='$d_getfsstat'
24583 d_getgrent='$d_getgrent'
24584 d_getgrent_r='$d_getgrent_r'
24585 d_getgrgid_r='$d_getgrgid_r'
24586 d_getgrnam_r='$d_getgrnam_r'
24587 d_getgrps='$d_getgrps'
24588 d_gethbyaddr='$d_gethbyaddr'
24589 d_gethbyname='$d_gethbyname'
24590 d_gethent='$d_gethent'
24591 d_gethname='$d_gethname'
24592 d_gethostbyaddr_r='$d_gethostbyaddr_r'
24593 d_gethostbyname_r='$d_gethostbyname_r'
24594 d_gethostent_r='$d_gethostent_r'
24595 d_gethostprotos='$d_gethostprotos'
24596 d_getitimer='$d_getitimer'
24597 d_getlogin='$d_getlogin'
24598 d_getlogin_r='$d_getlogin_r'
24599 d_getmnt='$d_getmnt'
24600 d_getmntent='$d_getmntent'
24601 d_getnameinfo='$d_getnameinfo'
24602 d_getnbyaddr='$d_getnbyaddr'
24603 d_getnbyname='$d_getnbyname'
24604 d_getnent='$d_getnent'
24605 d_getnetbyaddr_r='$d_getnetbyaddr_r'
24606 d_getnetbyname_r='$d_getnetbyname_r'
24607 d_getnetent_r='$d_getnetent_r'
24608 d_getnetprotos='$d_getnetprotos'
24609 d_getpagsz='$d_getpagsz'
24610 d_getpbyname='$d_getpbyname'
24611 d_getpbynumber='$d_getpbynumber'
24612 d_getpent='$d_getpent'
24613 d_getpgid='$d_getpgid'
24614 d_getpgrp2='$d_getpgrp2'
24615 d_getpgrp='$d_getpgrp'
24616 d_getppid='$d_getppid'
24617 d_getprior='$d_getprior'
24618 d_getprotobyname_r='$d_getprotobyname_r'
24619 d_getprotobynumber_r='$d_getprotobynumber_r'
24620 d_getprotoent_r='$d_getprotoent_r'
24621 d_getprotoprotos='$d_getprotoprotos'
24622 d_getprpwnam='$d_getprpwnam'
24623 d_getpwent='$d_getpwent'
24624 d_getpwent_r='$d_getpwent_r'
24625 d_getpwnam_r='$d_getpwnam_r'
24626 d_getpwuid_r='$d_getpwuid_r'
24627 d_getsbyname='$d_getsbyname'
24628 d_getsbyport='$d_getsbyport'
24629 d_getsent='$d_getsent'
24630 d_getservbyname_r='$d_getservbyname_r'
24631 d_getservbyport_r='$d_getservbyport_r'
24632 d_getservent_r='$d_getservent_r'
24633 d_getservprotos='$d_getservprotos'
24634 d_getspnam='$d_getspnam'
24635 d_getspnam_r='$d_getspnam_r'
24636 d_gettimeod='$d_gettimeod'
24637 d_gmtime64='$d_gmtime64'
24638 d_gmtime_r='$d_gmtime_r'
24639 d_gnulibc='$d_gnulibc'
24640 d_grpasswd='$d_grpasswd'
24641 d_hasmntopt='$d_hasmntopt'
24642 d_htonl='$d_htonl'
24643 d_hypot='$d_hypot'
24644 d_ilogb='$d_ilogb'
24645 d_ilogbl='$d_ilogbl'
24646 d_inc_version_list='$d_inc_version_list'
24647 d_index='$d_index'
24648 d_inetaton='$d_inetaton'
24649 d_inetntop='$d_inetntop'
24650 d_inetpton='$d_inetpton'
24651 d_int64_t='$d_int64_t'
24652 d_ip_mreq='$d_ip_mreq'
24653 d_ip_mreq_source='$d_ip_mreq_source'
24654 d_ipv6_mreq='$d_ipv6_mreq'
24655 d_ipv6_mreq_source='$d_ipv6_mreq_source'
24656 d_isascii='$d_isascii'
24657 d_isblank='$d_isblank'
24658 d_isfinite='$d_isfinite'
24659 d_isfinitel='$d_isfinitel'
24660 d_isinf='$d_isinf'
24661 d_isinfl='$d_isinfl'
24662 d_isless='$d_isless'
24663 d_isnan='$d_isnan'
24664 d_isnanl='$d_isnanl'
24665 d_isnormal='$d_isnormal'
24666 d_j0='$d_j0'
24667 d_j0l='$d_j0l'
24668 d_killpg='$d_killpg'
24669 d_lc_monetary_2008='$d_lc_monetary_2008'
24670 d_lchown='$d_lchown'
24671 d_ldbl_dig='$d_ldbl_dig'
24672 d_ldexpl='$d_ldexpl'
24673 d_lgamma='$d_lgamma'
24674 d_lgamma_r='$d_lgamma_r'
24675 d_libm_lib_version='$d_libm_lib_version'
24676 d_libname_unique='$d_libname_unique'
24677 d_link='$d_link'
24678 d_llrint='$d_llrint'
24679 d_llrintl='$d_llrintl'
24680 d_llround='$d_llround'
24681 d_llroundl='$d_llroundl'
24682 d_localtime64='$d_localtime64'
24683 d_localtime_r='$d_localtime_r'
24684 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24685 d_locconv='$d_locconv'
24686 d_lockf='$d_lockf'
24687 d_log1p='$d_log1p'
24688 d_log2='$d_log2'
24689 d_logb='$d_logb'
24690 d_long_double_style_ieee='$d_long_double_style_ieee'
24691 d_long_double_style_ieee_doubledouble='$d_long_double_style_ieee_doubledouble'
24692 d_long_double_style_ieee_extended='$d_long_double_style_ieee_extended'
24693 d_long_double_style_ieee_std='$d_long_double_style_ieee_std'
24694 d_long_double_style_vax='$d_long_double_style_vax'
24695 d_longdbl='$d_longdbl'
24696 d_longlong='$d_longlong'
24697 d_lrint='$d_lrint'
24698 d_lrintl='$d_lrintl'
24699 d_lround='$d_lround'
24700 d_lroundl='$d_lroundl'
24701 d_lseekproto='$d_lseekproto'
24702 d_lstat='$d_lstat'
24703 d_madvise='$d_madvise'
24704 d_malloc_good_size='$d_malloc_good_size'
24705 d_malloc_size='$d_malloc_size'
24706 d_mblen='$d_mblen'
24707 d_mbstowcs='$d_mbstowcs'
24708 d_mbtowc='$d_mbtowc'
24709 d_memchr='$d_memchr'
24710 d_memcmp='$d_memcmp'
24711 d_memcpy='$d_memcpy'
24712 d_memmem='$d_memmem'
24713 d_memmove='$d_memmove'
24714 d_memset='$d_memset'
24715 d_mkdir='$d_mkdir'
24716 d_mkdtemp='$d_mkdtemp'
24717 d_mkfifo='$d_mkfifo'
24718 d_mkstemp='$d_mkstemp'
24719 d_mkstemps='$d_mkstemps'
24720 d_mktime64='$d_mktime64'
24721 d_mktime='$d_mktime'
24722 d_mmap='$d_mmap'
24723 d_modfl='$d_modfl'
24724 d_modflproto='$d_modflproto'
24725 d_mprotect='$d_mprotect'
24726 d_msg='$d_msg'
24727 d_msg_ctrunc='$d_msg_ctrunc'
24728 d_msg_dontroute='$d_msg_dontroute'
24729 d_msg_oob='$d_msg_oob'
24730 d_msg_peek='$d_msg_peek'
24731 d_msg_proxy='$d_msg_proxy'
24732 d_msgctl='$d_msgctl'
24733 d_msgget='$d_msgget'
24734 d_msghdr_s='$d_msghdr_s'
24735 d_msgrcv='$d_msgrcv'
24736 d_msgsnd='$d_msgsnd'
24737 d_msync='$d_msync'
24738 d_munmap='$d_munmap'
24739 d_mymalloc='$d_mymalloc'
24740 d_nan='$d_nan'
24741 d_ndbm='$d_ndbm'
24742 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24743 d_nearbyint='$d_nearbyint'
24744 d_newlocale='$d_newlocale'
24745 d_nextafter='$d_nextafter'
24746 d_nexttoward='$d_nexttoward'
24747 d_nice='$d_nice'
24748 d_nl_langinfo='$d_nl_langinfo'
24749 d_nv_preserves_uv='$d_nv_preserves_uv'
24750 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24751 d_off64_t='$d_off64_t'
24752 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24753 d_oldpthreads='$d_oldpthreads'
24754 d_oldsock='$d_oldsock'
24755 d_open3='$d_open3'
24756 d_pathconf='$d_pathconf'
24757 d_pause='$d_pause'
24758 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24759 d_phostname='$d_phostname'
24760 d_pipe='$d_pipe'
24761 d_poll='$d_poll'
24762 d_portable='$d_portable'
24763 d_prctl='$d_prctl'
24764 d_prctl_set_name='$d_prctl_set_name'
24765 d_printf_format_null='$d_printf_format_null'
24766 d_procselfexe='$d_procselfexe'
24767 d_pseudofork='$d_pseudofork'
24768 d_pthread_atfork='$d_pthread_atfork'
24769 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24770 d_pthread_yield='$d_pthread_yield'
24771 d_ptrdiff_t='$d_ptrdiff_t'
24772 d_pwage='$d_pwage'
24773 d_pwchange='$d_pwchange'
24774 d_pwclass='$d_pwclass'
24775 d_pwcomment='$d_pwcomment'
24776 d_pwexpire='$d_pwexpire'
24777 d_pwgecos='$d_pwgecos'
24778 d_pwpasswd='$d_pwpasswd'
24779 d_pwquota='$d_pwquota'
24780 d_qgcvt='$d_qgcvt'
24781 d_quad='$d_quad'
24782 d_querylocale='$d_querylocale'
24783 d_random_r='$d_random_r'
24784 d_re_comp='$d_re_comp'
24785 d_readdir64_r='$d_readdir64_r'
24786 d_readdir='$d_readdir'
24787 d_readdir_r='$d_readdir_r'
24788 d_readlink='$d_readlink'
24789 d_readv='$d_readv'
24790 d_recvmsg='$d_recvmsg'
24791 d_regcmp='$d_regcmp'
24792 d_regcomp='$d_regcomp'
24793 d_remainder='$d_remainder'
24794 d_remquo='$d_remquo'
24795 d_rename='$d_rename'
24796 d_rewinddir='$d_rewinddir'
24797 d_rint='$d_rint'
24798 d_rmdir='$d_rmdir'
24799 d_round='$d_round'
24800 d_safebcpy='$d_safebcpy'
24801 d_safemcpy='$d_safemcpy'
24802 d_sanemcmp='$d_sanemcmp'
24803 d_sbrkproto='$d_sbrkproto'
24804 d_scalbn='$d_scalbn'
24805 d_scalbnl='$d_scalbnl'
24806 d_sched_yield='$d_sched_yield'
24807 d_scm_rights='$d_scm_rights'
24808 d_seekdir='$d_seekdir'
24809 d_select='$d_select'
24810 d_sem='$d_sem'
24811 d_semctl='$d_semctl'
24812 d_semctl_semid_ds='$d_semctl_semid_ds'
24813 d_semctl_semun='$d_semctl_semun'
24814 d_semget='$d_semget'
24815 d_semop='$d_semop'
24816 d_sendmsg='$d_sendmsg'
24817 d_setegid='$d_setegid'
24818 d_seteuid='$d_seteuid'
24819 d_setgrent='$d_setgrent'
24820 d_setgrent_r='$d_setgrent_r'
24821 d_setgrps='$d_setgrps'
24822 d_sethent='$d_sethent'
24823 d_sethostent_r='$d_sethostent_r'
24824 d_setitimer='$d_setitimer'
24825 d_setlinebuf='$d_setlinebuf'
24826 d_setlocale='$d_setlocale'
24827 d_setlocale_r='$d_setlocale_r'
24828 d_setnent='$d_setnent'
24829 d_setnetent_r='$d_setnetent_r'
24830 d_setpent='$d_setpent'
24831 d_setpgid='$d_setpgid'
24832 d_setpgrp2='$d_setpgrp2'
24833 d_setpgrp='$d_setpgrp'
24834 d_setprior='$d_setprior'
24835 d_setproctitle='$d_setproctitle'
24836 d_setprotoent_r='$d_setprotoent_r'
24837 d_setpwent='$d_setpwent'
24838 d_setpwent_r='$d_setpwent_r'
24839 d_setregid='$d_setregid'
24840 d_setresgid='$d_setresgid'
24841 d_setresuid='$d_setresuid'
24842 d_setreuid='$d_setreuid'
24843 d_setrgid='$d_setrgid'
24844 d_setruid='$d_setruid'
24845 d_setsent='$d_setsent'
24846 d_setservent_r='$d_setservent_r'
24847 d_setsid='$d_setsid'
24848 d_setvbuf='$d_setvbuf'
24849 d_shm='$d_shm'
24850 d_shmat='$d_shmat'
24851 d_shmatprototype='$d_shmatprototype'
24852 d_shmctl='$d_shmctl'
24853 d_shmdt='$d_shmdt'
24854 d_shmget='$d_shmget'
24855 d_sigaction='$d_sigaction'
24856 d_siginfo_si_addr='$d_siginfo_si_addr'
24857 d_siginfo_si_band='$d_siginfo_si_band'
24858 d_siginfo_si_errno='$d_siginfo_si_errno'
24859 d_siginfo_si_fd='$d_siginfo_si_fd'
24860 d_siginfo_si_pid='$d_siginfo_si_pid'
24861 d_siginfo_si_status='$d_siginfo_si_status'
24862 d_siginfo_si_uid='$d_siginfo_si_uid'
24863 d_siginfo_si_value='$d_siginfo_si_value'
24864 d_signbit='$d_signbit'
24865 d_sigprocmask='$d_sigprocmask'
24866 d_sigsetjmp='$d_sigsetjmp'
24867 d_sin6_scope_id='$d_sin6_scope_id'
24868 d_sitearch='$d_sitearch'
24869 d_snprintf='$d_snprintf'
24870 d_sockaddr_in6='$d_sockaddr_in6'
24871 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24872 d_sockatmark='$d_sockatmark'
24873 d_sockatmarkproto='$d_sockatmarkproto'
24874 d_socket='$d_socket'
24875 d_socklen_t='$d_socklen_t'
24876 d_sockpair='$d_sockpair'
24877 d_socks5_init='$d_socks5_init'
24878 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
24879 d_sqrtl='$d_sqrtl'
24880 d_srand48_r='$d_srand48_r'
24881 d_srandom_r='$d_srandom_r'
24882 d_sresgproto='$d_sresgproto'
24883 d_sresuproto='$d_sresuproto'
24884 d_stat='$d_stat'
24885 d_statblks='$d_statblks'
24886 d_statfs_f_flags='$d_statfs_f_flags'
24887 d_statfs_s='$d_statfs_s'
24888 d_static_inline='$d_static_inline'
24889 d_statvfs='$d_statvfs'
24890 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24891 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24892 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24893 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24894 d_stdio_stream_array='$d_stdio_stream_array'
24895 d_stdiobase='$d_stdiobase'
24896 d_stdstdio='$d_stdstdio'
24897 d_strchr='$d_strchr'
24898 d_strcoll='$d_strcoll'
24899 d_strctcpy='$d_strctcpy'
24900 d_strerrm='$d_strerrm'
24901 d_strerror='$d_strerror'
24902 d_strerror_l='$d_strerror_l'
24903 d_strerror_r='$d_strerror_r'
24904 d_strftime='$d_strftime'
24905 d_strlcat='$d_strlcat'
24906 d_strlcpy='$d_strlcpy'
24907 d_strtod='$d_strtod'
24908 d_strtol='$d_strtol'
24909 d_strtold='$d_strtold'
24910 d_strtoll='$d_strtoll'
24911 d_strtoq='$d_strtoq'
24912 d_strtoul='$d_strtoul'
24913 d_strtoull='$d_strtoull'
24914 d_strtouq='$d_strtouq'
24915 d_strxfrm='$d_strxfrm'
24916 d_suidsafe='$d_suidsafe'
24917 d_symlink='$d_symlink'
24918 d_syscall='$d_syscall'
24919 d_syscallproto='$d_syscallproto'
24920 d_sysconf='$d_sysconf'
24921 d_sysernlst='$d_sysernlst'
24922 d_syserrlst='$d_syserrlst'
24923 d_system='$d_system'
24924 d_tcgetpgrp='$d_tcgetpgrp'
24925 d_tcsetpgrp='$d_tcsetpgrp'
24926 d_telldir='$d_telldir'
24927 d_telldirproto='$d_telldirproto'
24928 d_tgamma='$d_tgamma'
24929 d_time='$d_time'
24930 d_timegm='$d_timegm'
24931 d_times='$d_times'
24932 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24933 d_tm_tm_zone='$d_tm_tm_zone'
24934 d_tmpnam_r='$d_tmpnam_r'
24935 d_trunc='$d_trunc'
24936 d_truncate='$d_truncate'
24937 d_truncl='$d_truncl'
24938 d_ttyname_r='$d_ttyname_r'
24939 d_tzname='$d_tzname'
24940 d_u32align='$d_u32align'
24941 d_ualarm='$d_ualarm'
24942 d_umask='$d_umask'
24943 d_uname='$d_uname'
24944 d_union_semun='$d_union_semun'
24945 d_unordered='$d_unordered'
24946 d_unsetenv='$d_unsetenv'
24947 d_uselocale='$d_uselocale'
24948 d_usleep='$d_usleep'
24949 d_usleepproto='$d_usleepproto'
24950 d_ustat='$d_ustat'
24951 d_vendorarch='$d_vendorarch'
24952 d_vendorbin='$d_vendorbin'
24953 d_vendorlib='$d_vendorlib'
24954 d_vendorscript='$d_vendorscript'
24955 d_vfork='$d_vfork'
24956 d_void_closedir='$d_void_closedir'
24957 d_voidsig='$d_voidsig'
24958 d_voidtty='$d_voidtty'
24959 d_volatile='$d_volatile'
24960 d_vprintf='$d_vprintf'
24961 d_vsnprintf='$d_vsnprintf'
24962 d_wait4='$d_wait4'
24963 d_waitpid='$d_waitpid'
24964 d_wcscmp='$d_wcscmp'
24965 d_wcstombs='$d_wcstombs'
24966 d_wcsxfrm='$d_wcsxfrm'
24967 d_wctomb='$d_wctomb'
24968 d_writev='$d_writev'
24969 d_xenix='$d_xenix'
24970 date='$date'
24971 db_hashtype='$db_hashtype'
24972 db_prefixtype='$db_prefixtype'
24973 db_version_major='$db_version_major'
24974 db_version_minor='$db_version_minor'
24975 db_version_patch='$db_version_patch'
24976 default_inc_excludes_dot='$default_inc_excludes_dot'
24977 direntrytype='$direntrytype'
24978 dlext='$dlext'
24979 dlsrc='$dlsrc'
24980 doubleinfbytes='$doubleinfbytes'
24981 doublekind='$doublekind'
24982 doublemantbits='$doublemantbits'
24983 doublenanbytes='$doublenanbytes'
24984 doublesize='$doublesize'
24985 drand01='$drand01'
24986 drand48_r_proto='$drand48_r_proto'
24987 dtrace='$dtrace'
24988 dtraceobject='$dtraceobject'
24989 dtracexnolibs='$dtracexnolibs'
24990 dynamic_ext='$dynamic_ext'
24991 eagain='$eagain'
24992 ebcdic='$ebcdic'
24993 echo='$echo'
24994 egrep='$egrep'
24995 emacs='$emacs'
24996 endgrent_r_proto='$endgrent_r_proto'
24997 endhostent_r_proto='$endhostent_r_proto'
24998 endnetent_r_proto='$endnetent_r_proto'
24999 endprotoent_r_proto='$endprotoent_r_proto'
25000 endpwent_r_proto='$endpwent_r_proto'
25001 endservent_r_proto='$endservent_r_proto'
25002 eunicefix='$eunicefix'
25003 exe_ext='$exe_ext'
25004 expr='$expr'
25005 extensions='$extensions'
25006 extern_C='$extern_C'
25007 extras='$extras'
25008 fflushNULL='$fflushNULL'
25009 fflushall='$fflushall'
25010 find='$find'
25011 firstmakefile='$firstmakefile'
25012 flex='$flex'
25013 fpossize='$fpossize'
25014 fpostype='$fpostype'
25015 freetype='$freetype'
25016 from='$from'
25017 full_ar='$full_ar'
25018 full_csh='$full_csh'
25019 full_sed='$full_sed'
25020 gccansipedantic='$gccansipedantic'
25021 gccosandvers='$gccosandvers'
25022 gccversion='$gccversion'
25023 getgrent_r_proto='$getgrent_r_proto'
25024 getgrgid_r_proto='$getgrgid_r_proto'
25025 getgrnam_r_proto='$getgrnam_r_proto'
25026 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
25027 gethostbyname_r_proto='$gethostbyname_r_proto'
25028 gethostent_r_proto='$gethostent_r_proto'
25029 getlogin_r_proto='$getlogin_r_proto'
25030 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
25031 getnetbyname_r_proto='$getnetbyname_r_proto'
25032 getnetent_r_proto='$getnetent_r_proto'
25033 getprotobyname_r_proto='$getprotobyname_r_proto'
25034 getprotobynumber_r_proto='$getprotobynumber_r_proto'
25035 getprotoent_r_proto='$getprotoent_r_proto'
25036 getpwent_r_proto='$getpwent_r_proto'
25037 getpwnam_r_proto='$getpwnam_r_proto'
25038 getpwuid_r_proto='$getpwuid_r_proto'
25039 getservbyname_r_proto='$getservbyname_r_proto'
25040 getservbyport_r_proto='$getservbyport_r_proto'
25041 getservent_r_proto='$getservent_r_proto'
25042 getspnam_r_proto='$getspnam_r_proto'
25043 gidformat='$gidformat'
25044 gidsign='$gidsign'
25045 gidsize='$gidsize'
25046 gidtype='$gidtype'
25047 glibpth='$glibpth'
25048 gmake='$gmake'
25049 gmtime_r_proto='$gmtime_r_proto'
25050 gnulibc_version='$gnulibc_version'
25051 grep='$grep'
25052 groupcat='$groupcat'
25053 groupstype='$groupstype'
25054 gzip='$gzip'
25055 h_fcntl='$h_fcntl'
25056 h_sysfile='$h_sysfile'
25057 hint='$hint'
25058 hostcat='$hostcat'
25059 hostgenerate='$hostgenerate'
25060 hostosname='$hostosname'
25061 hostperl='$hostperl'
25062 html1dir='$html1dir'
25063 html1direxp='$html1direxp'
25064 html3dir='$html3dir'
25065 html3direxp='$html3direxp'
25066 i16size='$i16size'
25067 i16type='$i16type'
25068 i32size='$i32size'
25069 i32type='$i32type'
25070 i64size='$i64size'
25071 i64type='$i64type'
25072 i8size='$i8size'
25073 i8type='$i8type'
25074 i_arpainet='$i_arpainet'
25075 i_assert='$i_assert'
25076 i_bfd='$i_bfd'
25077 i_bsdioctl='$i_bsdioctl'
25078 i_crypt='$i_crypt'
25079 i_db='$i_db'
25080 i_dbm='$i_dbm'
25081 i_dirent='$i_dirent'
25082 i_dlfcn='$i_dlfcn'
25083 i_execinfo='$i_execinfo'
25084 i_fcntl='$i_fcntl'
25085 i_fenv='$i_fenv'
25086 i_float='$i_float'
25087 i_fp='$i_fp'
25088 i_fp_class='$i_fp_class'
25089 i_gdbm='$i_gdbm'
25090 i_gdbm_ndbm='$i_gdbm_ndbm'
25091 i_gdbmndbm='$i_gdbmndbm'
25092 i_grp='$i_grp'
25093 i_ieeefp='$i_ieeefp'
25094 i_inttypes='$i_inttypes'
25095 i_langinfo='$i_langinfo'
25096 i_libutil='$i_libutil'
25097 i_limits='$i_limits'
25098 i_locale='$i_locale'
25099 i_machcthr='$i_machcthr'
25100 i_malloc='$i_malloc'
25101 i_mallocmalloc='$i_mallocmalloc'
25102 i_math='$i_math'
25103 i_memory='$i_memory'
25104 i_mntent='$i_mntent'
25105 i_ndbm='$i_ndbm'
25106 i_netdb='$i_netdb'
25107 i_neterrno='$i_neterrno'
25108 i_netinettcp='$i_netinettcp'
25109 i_niin='$i_niin'
25110 i_poll='$i_poll'
25111 i_prot='$i_prot'
25112 i_pthread='$i_pthread'
25113 i_pwd='$i_pwd'
25114 i_quadmath='$i_quadmath'
25115 i_rpcsvcdbm='$i_rpcsvcdbm'
25116 i_sgtty='$i_sgtty'
25117 i_shadow='$i_shadow'
25118 i_socks='$i_socks'
25119 i_stdarg='$i_stdarg'
25120 i_stdbool='$i_stdbool'
25121 i_stddef='$i_stddef'
25122 i_stdint='$i_stdint'
25123 i_stdlib='$i_stdlib'
25124 i_string='$i_string'
25125 i_sunmath='$i_sunmath'
25126 i_sysaccess='$i_sysaccess'
25127 i_sysdir='$i_sysdir'
25128 i_sysfile='$i_sysfile'
25129 i_sysfilio='$i_sysfilio'
25130 i_sysin='$i_sysin'
25131 i_sysioctl='$i_sysioctl'
25132 i_syslog='$i_syslog'
25133 i_sysmman='$i_sysmman'
25134 i_sysmode='$i_sysmode'
25135 i_sysmount='$i_sysmount'
25136 i_sysndir='$i_sysndir'
25137 i_sysparam='$i_sysparam'
25138 i_syspoll='$i_syspoll'
25139 i_sysresrc='$i_sysresrc'
25140 i_syssecrt='$i_syssecrt'
25141 i_sysselct='$i_sysselct'
25142 i_syssockio='$i_syssockio'
25143 i_sysstat='$i_sysstat'
25144 i_sysstatfs='$i_sysstatfs'
25145 i_sysstatvfs='$i_sysstatvfs'
25146 i_systime='$i_systime'
25147 i_systimek='$i_systimek'
25148 i_systimes='$i_systimes'
25149 i_systypes='$i_systypes'
25150 i_sysuio='$i_sysuio'
25151 i_sysun='$i_sysun'
25152 i_sysutsname='$i_sysutsname'
25153 i_sysvfs='$i_sysvfs'
25154 i_syswait='$i_syswait'
25155 i_termio='$i_termio'
25156 i_termios='$i_termios'
25157 i_time='$i_time'
25158 i_unistd='$i_unistd'
25159 i_ustat='$i_ustat'
25160 i_utime='$i_utime'
25161 i_values='$i_values'
25162 i_varargs='$i_varargs'
25163 i_varhdr='$i_varhdr'
25164 i_vfork='$i_vfork'
25165 i_xlocale='$i_xlocale'
25166 ignore_versioned_solibs='$ignore_versioned_solibs'
25167 inc_version_list='$inc_version_list'
25168 inc_version_list_init='$inc_version_list_init'
25169 incpath='$incpath'
25170 incpth='$incpth'
25171 inews='$inews'
25172 initialinstalllocation='$initialinstalllocation'
25173 installarchlib='$installarchlib'
25174 installbin='$installbin'
25175 installhtml1dir='$installhtml1dir'
25176 installhtml3dir='$installhtml3dir'
25177 installman1dir='$installman1dir'
25178 installman3dir='$installman3dir'
25179 installprefix='$installprefix'
25180 installprefixexp='$installprefixexp'
25181 installprivlib='$installprivlib'
25182 installscript='$installscript'
25183 installsitearch='$installsitearch'
25184 installsitebin='$installsitebin'
25185 installsitehtml1dir='$installsitehtml1dir'
25186 installsitehtml3dir='$installsitehtml3dir'
25187 installsitelib='$installsitelib'
25188 installsiteman1dir='$installsiteman1dir'
25189 installsiteman3dir='$installsiteman3dir'
25190 installsitescript='$installsitescript'
25191 installstyle='$installstyle'
25192 installusrbinperl='$installusrbinperl'
25193 installvendorarch='$installvendorarch'
25194 installvendorbin='$installvendorbin'
25195 installvendorhtml1dir='$installvendorhtml1dir'
25196 installvendorhtml3dir='$installvendorhtml3dir'
25197 installvendorlib='$installvendorlib'
25198 installvendorman1dir='$installvendorman1dir'
25199 installvendorman3dir='$installvendorman3dir'
25200 installvendorscript='$installvendorscript'
25201 intsize='$intsize'
25202 issymlink='$issymlink'
25203 ivdformat='$ivdformat'
25204 ivsize='$ivsize'
25205 ivtype='$ivtype'
25206 known_extensions='$known_extensions'
25207 ksh='$ksh'
25208 ld='$ld'
25209 ld_can_script='$ld_can_script'
25210 lddlflags='$lddlflags'
25211 ldflags='$ldflags'
25212 ldflags_uselargefiles='$ldflags_uselargefiles'
25213 ldlibpthname='$ldlibpthname'
25214 less='$less'
25215 lib_ext='$lib_ext'
25216 libc='$libc'
25217 libperl='$libperl'
25218 libpth='$libpth'
25219 libs='$libs'
25220 libsdirs='$libsdirs'
25221 libsfiles='$libsfiles'
25222 libsfound='$libsfound'
25223 libspath='$libspath'
25224 libswanted='$libswanted'
25225 libswanted_uselargefiles='$libswanted_uselargefiles'
25226 line='$line'
25227 lint='$lint'
25228 lkflags='$lkflags'
25229 ln='$ln'
25230 lns='$lns'
25231 localtime_r_proto='$localtime_r_proto'
25232 locincpth='$locincpth'
25233 loclibpth='$loclibpth'
25234 longdblinfbytes='$longdblinfbytes'
25235 longdblkind='$longdblkind'
25236 longdblmantbits='$longdblmantbits'
25237 longdblnanbytes='$longdblnanbytes'
25238 longdblsize='$longdblsize'
25239 longlongsize='$longlongsize'
25240 longsize='$longsize'
25241 lp='$lp'
25242 lpr='$lpr'
25243 ls='$ls'
25244 lseeksize='$lseeksize'
25245 lseektype='$lseektype'
25246 mail='$mail'
25247 mailx='$mailx'
25248 make='$make'
25249 make_set_make='$make_set_make'
25250 mallocobj='$mallocobj'
25251 mallocsrc='$mallocsrc'
25252 malloctype='$malloctype'
25253 man1dir='$man1dir'
25254 man1direxp='$man1direxp'
25255 man1ext='$man1ext'
25256 man3dir='$man3dir'
25257 man3direxp='$man3direxp'
25258 man3ext='$man3ext'
25259 mips_type='$mips_type'
25260 mistrustnm='$mistrustnm'
25261 mkdir='$mkdir'
25262 mmaptype='$mmaptype'
25263 modetype='$modetype'
25264 more='$more'
25265 multiarch='$multiarch'
25266 mv='$mv'
25267 myarchname='$myarchname'
25268 mydomain='$mydomain'
25269 myhostname='$myhostname'
25270 myuname='$myuname'
25271 n='$n'
25272 need_va_copy='$need_va_copy'
25273 netdb_hlen_type='$netdb_hlen_type'
25274 netdb_host_type='$netdb_host_type'
25275 netdb_name_type='$netdb_name_type'
25276 netdb_net_type='$netdb_net_type'
25277 nm='$nm'
25278 nm_opt='$nm_opt'
25279 nm_so_opt='$nm_so_opt'
25280 nonxs_ext='$nonxs_ext'
25281 nroff='$nroff'
25282 nvEUformat='$nvEUformat'
25283 nvFUformat='$nvFUformat'
25284 nvGUformat='$nvGUformat'
25285 nv_overflows_integers_at='$nv_overflows_integers_at'
25286 nv_preserves_uv_bits='$nv_preserves_uv_bits'
25287 nveformat='$nveformat'
25288 nvfformat='$nvfformat'
25289 nvgformat='$nvgformat'
25290 nvmantbits='$nvmantbits'
25291 nvsize='$nvsize'
25292 nvtype='$nvtype'
25293 o_nonblock='$o_nonblock'
25294 obj_ext='$obj_ext'
25295 old_pthread_create_joinable='$old_pthread_create_joinable'
25296 optimize='$optimize'
25297 orderlib='$orderlib'
25298 osname='$osname'
25299 osvers='$osvers'
25300 otherlibdirs='$otherlibdirs'
25301 package='$package'
25302 pager='$pager'
25303 passcat='$passcat'
25304 patchlevel='$patchlevel'
25305 path_sep='$path_sep'
25306 perl5='$perl5'
25307 perl='$perl'
25308 perl_patchlevel='$perl_patchlevel'
25309 perl_static_inline='$perl_static_inline'
25310 perladmin='$perladmin'
25311 perllibs='$perllibs'
25312 perlpath='$perlpath'
25313 pg='$pg'
25314 phostname='$phostname'
25315 pidtype='$pidtype'
25316 plibpth='$plibpth'
25317 pmake='$pmake'
25318 pr='$pr'
25319 prefix='$prefix'
25320 prefixexp='$prefixexp'
25321 privlib='$privlib'
25322 privlibexp='$privlibexp'
25323 procselfexe='$procselfexe'
25324 prototype='$prototype'
25325 ptrsize='$ptrsize'
25326 quadkind='$quadkind'
25327 quadtype='$quadtype'
25328 randbits='$randbits'
25329 randfunc='$randfunc'
25330 random_r_proto='$random_r_proto'
25331 randseedtype='$randseedtype'
25332 ranlib='$ranlib'
25333 rd_nodata='$rd_nodata'
25334 readdir64_r_proto='$readdir64_r_proto'
25335 readdir_r_proto='$readdir_r_proto'
25336 revision='$revision'
25337 rm='$rm'
25338 rm_try='$rm_try'
25339 rmail='$rmail'
25340 run='$run'
25341 runnm='$runnm'
25342 sGMTIME_max='$sGMTIME_max'
25343 sGMTIME_min='$sGMTIME_min'
25344 sLOCALTIME_max='$sLOCALTIME_max'
25345 sLOCALTIME_min='$sLOCALTIME_min'
25346 sPRIEUldbl='$sPRIEUldbl'
25347 sPRIFUldbl='$sPRIFUldbl'
25348 sPRIGUldbl='$sPRIGUldbl'
25349 sPRIXU64='$sPRIXU64'
25350 sPRId64='$sPRId64'
25351 sPRIeldbl='$sPRIeldbl'
25352 sPRIfldbl='$sPRIfldbl'
25353 sPRIgldbl='$sPRIgldbl'
25354 sPRIi64='$sPRIi64'
25355 sPRIo64='$sPRIo64'
25356 sPRIu64='$sPRIu64'
25357 sPRIx64='$sPRIx64'
25358 sSCNfldbl='$sSCNfldbl'
25359 sched_yield='$sched_yield'
25360 scriptdir='$scriptdir'
25361 scriptdirexp='$scriptdirexp'
25362 sed='$sed'
25363 seedfunc='$seedfunc'
25364 selectminbits='$selectminbits'
25365 selecttype='$selecttype'
25366 sendmail='$sendmail'
25367 setgrent_r_proto='$setgrent_r_proto'
25368 sethostent_r_proto='$sethostent_r_proto'
25369 setlocale_r_proto='$setlocale_r_proto'
25370 setnetent_r_proto='$setnetent_r_proto'
25371 setprotoent_r_proto='$setprotoent_r_proto'
25372 setpwent_r_proto='$setpwent_r_proto'
25373 setservent_r_proto='$setservent_r_proto'
25374 sh='$sh'
25375 shar='$shar'
25376 sharpbang='$sharpbang'
25377 shmattype='$shmattype'
25378 shortsize='$shortsize'
25379 shrpenv='$shrpenv'
25380 shsharp='$shsharp'
25381 sig_count='$sig_count'
25382 sig_name='$sig_name'
25383 sig_name_init='$sig_name_init'
25384 sig_num='$sig_num'
25385 sig_num_init='$sig_num_init'
25386 sig_size='$sig_size'
25387 signal_t='$signal_t'
25388 sitearch='$sitearch'
25389 sitearchexp='$sitearchexp'
25390 sitebin='$sitebin'
25391 sitebinexp='$sitebinexp'
25392 sitehtml1dir='$sitehtml1dir'
25393 sitehtml1direxp='$sitehtml1direxp'
25394 sitehtml3dir='$sitehtml3dir'
25395 sitehtml3direxp='$sitehtml3direxp'
25396 sitelib='$sitelib'
25397 sitelib_stem='$sitelib_stem'
25398 sitelibexp='$sitelibexp'
25399 siteman1dir='$siteman1dir'
25400 siteman1direxp='$siteman1direxp'
25401 siteman3dir='$siteman3dir'
25402 siteman3direxp='$siteman3direxp'
25403 siteprefix='$siteprefix'
25404 siteprefixexp='$siteprefixexp'
25405 sitescript='$sitescript'
25406 sitescriptexp='$sitescriptexp'
25407 sizesize='$sizesize'
25408 sizetype='$sizetype'
25409 sleep='$sleep'
25410 smail='$smail'
25411 so='$so'
25412 sockethdr='$sockethdr'
25413 socketlib='$socketlib'
25414 socksizetype='$socksizetype'
25415 sort='$sort'
25416 spackage='$spackage'
25417 spitshell='$spitshell'
25418 srand48_r_proto='$srand48_r_proto'
25419 srandom_r_proto='$srandom_r_proto'
25420 src='$src'
25421 ssizetype='$ssizetype'
25422 st_ino_sign='$st_ino_sign'
25423 st_ino_size='$st_ino_size'
25424 startperl='$startperl'
25425 startsh='$startsh'
25426 static_ext='$static_ext'
25427 stdchar='$stdchar'
25428 stdio_base='$stdio_base'
25429 stdio_bufsiz='$stdio_bufsiz'
25430 stdio_cnt='$stdio_cnt'
25431 stdio_filbuf='$stdio_filbuf'
25432 stdio_ptr='$stdio_ptr'
25433 stdio_stream_array='$stdio_stream_array'
25434 strerror_r_proto='$strerror_r_proto'
25435 strings='$strings'
25436 submit='$submit'
25437 subversion='$subversion'
25438 sysman='$sysman'
25439 sysroot='$sysroot'
25440 tail='$tail'
25441 tar='$tar'
25442 targetarch='$targetarch'
25443 targetdir='$targetdir'
25444 targetenv='$targetenv'
25445 targethost='$targethost'
25446 targetmkdir='$targetmkdir'
25447 targetport='$targetport'
25448 targetsh='$targetsh'
25449 tbl='$tbl'
25450 tee='$tee'
25451 test='$test'
25452 timeincl='$timeincl'
25453 timetype='$timetype'
25454 tmpnam_r_proto='$tmpnam_r_proto'
25455 to='$to'
25456 touch='$touch'
25457 tr='$tr'
25458 trnl='$trnl'
25459 troff='$troff'
25460 ttyname_r_proto='$ttyname_r_proto'
25461 u16size='$u16size'
25462 u16type='$u16type'
25463 u32size='$u32size'
25464 u32type='$u32type'
25465 u64size='$u64size'
25466 u64type='$u64type'
25467 u8size='$u8size'
25468 u8type='$u8type'
25469 uidformat='$uidformat'
25470 uidsign='$uidsign'
25471 uidsize='$uidsize'
25472 uidtype='$uidtype'
25473 uname='$uname'
25474 uniq='$uniq'
25475 uquadtype='$uquadtype'
25476 use5005threads='$use5005threads'
25477 use64bitall='$use64bitall'
25478 use64bitint='$use64bitint'
25479 usecbacktrace='$usecbacktrace'
25480 usecrosscompile='$usecrosscompile'
25481 usedevel='$usedevel'
25482 usedl='$usedl'
25483 usedtrace='$usedtrace'
25484 usefaststdio='$usefaststdio'
25485 useithreads='$useithreads'
25486 usekernprocpathname='$usekernprocpathname'
25487 uselargefiles='$uselargefiles'
25488 uselongdouble='$uselongdouble'
25489 usemallocwrap='$usemallocwrap'
25490 usemorebits='$usemorebits'
25491 usemultiplicity='$usemultiplicity'
25492 usemymalloc='$usemymalloc'
25493 usenm='$usenm'
25494 usensgetexecutablepath='$usensgetexecutablepath'
25495 useopcode='$useopcode'
25496 useperlio='$useperlio'
25497 useposix='$useposix'
25498 usequadmath='$usequadmath'
25499 usereentrant='$usereentrant'
25500 userelocatableinc='$userelocatableinc'
25501 useshrplib='$useshrplib'
25502 usesitecustomize='$usesitecustomize'
25503 usesocks='$usesocks'
25504 usethreads='$usethreads'
25505 usevendorprefix='$usevendorprefix'
25506 useversionedarchname='$useversionedarchname'
25507 usevfork='$usevfork'
25508 usrinc='$usrinc'
25509 uuname='$uuname'
25510 uvXUformat='$uvXUformat'
25511 uvoformat='$uvoformat'
25512 uvsize='$uvsize'
25513 uvtype='$uvtype'
25514 uvuformat='$uvuformat'
25515 uvxformat='$uvxformat'
25516 vaproto='$vaproto'
25517 vendorarch='$vendorarch'
25518 vendorarchexp='$vendorarchexp'
25519 vendorbin='$vendorbin'
25520 vendorbinexp='$vendorbinexp'
25521 vendorhtml1dir='$vendorhtml1dir'
25522 vendorhtml1direxp='$vendorhtml1direxp'
25523 vendorhtml3dir='$vendorhtml3dir'
25524 vendorhtml3direxp='$vendorhtml3direxp'
25525 vendorlib='$vendorlib'
25526 vendorlib_stem='$vendorlib_stem'
25527 vendorlibexp='$vendorlibexp'
25528 vendorman1dir='$vendorman1dir'
25529 vendorman1direxp='$vendorman1direxp'
25530 vendorman3dir='$vendorman3dir'
25531 vendorman3direxp='$vendorman3direxp'
25532 vendorprefix='$vendorprefix'
25533 vendorprefixexp='$vendorprefixexp'
25534 vendorscript='$vendorscript'
25535 vendorscriptexp='$vendorscriptexp'
25536 version='$version'
25537 version_patchlevel_string='$version_patchlevel_string'
25538 versiononly='$versiononly'
25539 vi='$vi'
25540 xlibpth='$xlibpth'
25541 yacc='$yacc'
25542 yaccflags='$yaccflags'
25543 zcat='$zcat'
25544 zip='$zip'
25545 EOT
25546
25547 : add special variables
25548 $test -f $src/patchlevel.h && \
25549 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
25550 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
25551 echo "PERL_CONFIG_SH=true" >>config.sh
25552
25553 : propagate old symbols
25554 if $test -f UU/config.sh; then
25555         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
25556         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
25557                 config.sh config.sh UU/oldconfig.sh |\
25558                 $sort | $uniq -u >UU/oldsyms
25559         set X `$cat UU/oldsyms`
25560         shift
25561         case $# in
25562         0) ;;
25563         *)
25564                 $cat <<EOM
25565 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
25566 EOM
25567                 echo ": Variables propagated from previous config.sh file." >>config.sh
25568                 for sym in `$cat UU/oldsyms`; do
25569                         echo "    Propagating $hint variable "'$'"$sym..."
25570                         eval 'tmp="$'"${sym}"'"'
25571                         echo "$tmp" | \
25572                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
25573                 done
25574                 ;;
25575         esac
25576 fi
25577
25578 : preserve RCS keywords in files with variable substitution, grrr
25579 Id='$Id'
25580
25581 : Finish up by extracting the .SH files
25582 case "$alldone" in
25583 exit)
25584         echo "Stopping at your request, leaving temporary files around."
25585         exit 0
25586         ;;
25587 cont)
25588         ;;
25589 '')
25590         dflt=''
25591         nostick=true
25592         $cat <<EOM
25593
25594 If you'd like to make any changes to the config.sh file before I begin
25595 to configure things, do it as a shell escape now (e.g. !vi config.sh).
25596
25597 EOM
25598         rp="Press return or use a shell escape to edit config.sh:"
25599         . UU/myread
25600         nostick=''
25601         case "$ans" in
25602         '') ;;
25603         *) : in case they cannot read
25604                 sh 1>&4 -c "$ans";;
25605         esac
25606         ;;
25607 esac
25608
25609 : if this fails, just run all the .SH files by hand
25610 . ./config.sh
25611
25612 echo " "
25613 exec 1>&4
25614 pwd=`pwd`
25615 . ./UU/extract
25616 cd "$pwd"
25617
25618 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
25619         dflt=y
25620         case "$silent" in
25621         true) ;;
25622         *)
25623                 $cat <<EOM
25624
25625 Now you need to generate make dependencies by running "$make depend".
25626 You might prefer to run it in background: "$make depend > makedepend.out &"
25627 It can take a while, so you might not want to run it right now.
25628
25629 EOM
25630                 ;;
25631         esac
25632         rp="Run $make depend now?"
25633         . UU/myread
25634         case "$ans" in
25635         y*)
25636                 $make depend && echo "Now you must run '$make'."
25637                 ;;
25638         *)
25639                 echo "You must run '$make depend' then '$make'."
25640                 ;;
25641         esac
25642 elif test -f [Mm]akefile; then
25643         echo " "
25644         echo "Now you must run a $make."
25645 else
25646         echo "Configure done."
25647 fi
25648
25649 if $test -f Policy.sh; then
25650     $cat <<EOM
25651
25652 If you compile $package on a different machine or from a different object
25653 directory, copy the Policy.sh file from this object directory to the
25654 new one before you run Configure -- this will help you with most of
25655 the policy defaults.
25656
25657 EOM
25658 fi
25659 if $test -f UU/config.msg; then
25660     echo "Hmm.  I also noted the following information while running:"
25661     echo " "
25662     $cat UU/config.msg >&4
25663 fi
25664 $rm -f kit*isdone ark*isdone
25665 $rm -rf UU
25666
25667 : End of Configure
25668