This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Tentative fix for RT#125350 - AFL detected crash.
[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_fdim=''
479 d_fegetround=''
480 d_fgetpos=''
481 d_finite=''
482 d_finitel=''
483 d_flexfnam=''
484 d_flock=''
485 d_flockproto=''
486 d_fma=''
487 d_fmax=''
488 d_fmin=''
489 d_fork=''
490 d_fp_class=''
491 d_fp_classl=''
492 d_fpclass=''
493 d_fp_classify=''
494 d_fpclassify=''
495 d_fpclassl=''
496 d_fpgetround=''
497 d_fpos64_t=''
498 d_frexpl=''
499 d_fs_data_s=''
500 d_fseeko=''
501 d_fsetpos=''
502 d_fstatfs=''
503 d_fsync=''
504 d_ftello=''
505 d_ftime=''
506 d_gettimeod=''
507 d_futimes=''
508 d_Gconvert=''
509 d_getaddrinfo=''
510 d_getcwd=''
511 d_getespwnam=''
512 d_getfsstat=''
513 d_getgrent=''
514 d_getgrent_r=''
515 getgrent_r_proto=''
516 d_getgrgid_r=''
517 getgrgid_r_proto=''
518 d_getgrnam_r=''
519 getgrnam_r_proto=''
520 d_getgrps=''
521 d_gethbyaddr=''
522 d_gethbyname=''
523 d_gethent=''
524 aphostname=''
525 d_gethname=''
526 d_phostname=''
527 d_uname=''
528 d_gethostbyaddr_r=''
529 gethostbyaddr_r_proto=''
530 d_gethostbyname_r=''
531 gethostbyname_r_proto=''
532 d_gethostent_r=''
533 gethostent_r_proto=''
534 d_gethostprotos=''
535 d_getitimer=''
536 d_getlogin=''
537 d_getlogin_r=''
538 getlogin_r_proto=''
539 d_getmnt=''
540 d_getmntent=''
541 d_getnameinfo=''
542 d_getnbyaddr=''
543 d_getnbyname=''
544 d_getnent=''
545 d_getnetbyaddr_r=''
546 getnetbyaddr_r_proto=''
547 d_getnetbyname_r=''
548 getnetbyname_r_proto=''
549 d_getnetent_r=''
550 getnetent_r_proto=''
551 d_getnetprotos=''
552 d_getpagsz=''
553 d_getpent=''
554 d_getpgid=''
555 d_getpgrp2=''
556 d_bsdgetpgrp=''
557 d_getpgrp=''
558 d_getppid=''
559 d_getprior=''
560 d_getpbyname=''
561 d_getpbynumber=''
562 d_getprotobyname_r=''
563 getprotobyname_r_proto=''
564 d_getprotobynumber_r=''
565 getprotobynumber_r_proto=''
566 d_getprotoent_r=''
567 getprotoent_r_proto=''
568 d_getprotoprotos=''
569 d_getprpwnam=''
570 d_getpwent=''
571 d_getpwent_r=''
572 getpwent_r_proto=''
573 d_getpwnam_r=''
574 getpwnam_r_proto=''
575 d_getpwuid_r=''
576 getpwuid_r_proto=''
577 d_getsent=''
578 d_getservbyname_r=''
579 getservbyname_r_proto=''
580 d_getservbyport_r=''
581 getservbyport_r_proto=''
582 d_getservent_r=''
583 getservent_r_proto=''
584 d_getservprotos=''
585 d_getspnam=''
586 d_getspnam_r=''
587 getspnam_r_proto=''
588 d_getsbyname=''
589 d_getsbyport=''
590 d_gmtime_r=''
591 gmtime_r_proto=''
592 d_gnulibc=''
593 gnulibc_version=''
594 d_hasmntopt=''
595 d_htonl=''
596 d_hypot=''
597 d_ilogb=''
598 d_ilogbl=''
599 d_inetaton=''
600 d_inetntop=''
601 d_inetpton=''
602 d_int64_t=''
603 d_isascii=''
604 d_isblank=''
605 d_isfinite=''
606 d_isfinitel=''
607 d_isinf=''
608 d_isinfl=''
609 d_isless=''
610 d_isnan=''
611 d_isnanl=''
612 d_isnormal=''
613 d_j0=''
614 d_j0l=''
615 d_killpg=''
616 d_lc_monetary_2008=''
617 d_lchown=''
618 d_ldbl_dig=''
619 d_lgamma=''
620 d_lgamma_r=''
621 d_libm_lib_version=''
622 d_link=''
623 d_llrint=''
624 d_llrintl=''
625 d_llround=''
626 d_llroundl=''
627 d_localtime_r=''
628 d_localtime_r_needs_tzset=''
629 localtime_r_proto=''
630 d_locconv=''
631 d_lockf=''
632 d_log1p=''
633 d_log2=''
634 d_logb=''
635 d_ldexpl=''
636 d_longdbl=''
637 longdblkind=''
638 longdblsize=''
639 d_longlong=''
640 longlongsize=''
641 d_lrint=''
642 d_lrintl=''
643 d_lround=''
644 d_lroundl=''
645 d_lseekproto=''
646 d_lstat=''
647 d_madvise=''
648 d_malloc_good_size=''
649 d_malloc_size=''
650 d_mblen=''
651 d_mbstowcs=''
652 d_mbtowc=''
653 d_memchr=''
654 d_memcmp=''
655 d_memcpy=''
656 d_memmove=''
657 d_memset=''
658 d_mkdir=''
659 d_mkdtemp=''
660 d_mkfifo=''
661 d_mkstemp=''
662 d_mkstemps=''
663 d_mktime=''
664 d_mmap=''
665 mmaptype=''
666 d_modfl=''
667 d_modfl_pow32_bug=''
668 d_modflproto=''
669 d_mprotect=''
670 d_msg=''
671 d_msgctl=''
672 d_msgget=''
673 d_msghdr_s=''
674 d_msgrcv=''
675 d_msgsnd=''
676 d_msync=''
677 d_munmap=''
678 d_nan=''
679 d_nearbyint=''
680 d_nextafter=''
681 d_nexttoward=''
682 d_nice=''
683 d_nl_langinfo=''
684 d_off64_t=''
685 d_open3=''
686 d_fpathconf=''
687 d_pathconf=''
688 d_pause=''
689 d_pipe=''
690 d_poll=''
691 d_portable=''
692 d_prctl=''
693 d_prctl_set_name=''
694 d_procselfexe=''
695 procselfexe=''
696 d_old_pthread_create_joinable=''
697 old_pthread_create_joinable=''
698 d_pthread_atfork=''
699 d_pthread_attr_setscope=''
700 d_pthread_yield=''
701 d_sched_yield=''
702 sched_yield=''
703 d_ptrdiff_t=''
704 d_qgcvt=''
705 d_random_r=''
706 random_r_proto=''
707 d_readdir64_r=''
708 readdir64_r_proto=''
709 d_readdir=''
710 d_rewinddir=''
711 d_seekdir=''
712 d_telldir=''
713 d_readdir_r=''
714 readdir_r_proto=''
715 d_readlink=''
716 d_readv=''
717 d_recvmsg=''
718 d_re_comp=''
719 d_regcmp=''
720 d_regcomp=''
721 d_remainder=''
722 d_remquo=''
723 d_rename=''
724 d_rint=''
725 d_rmdir=''
726 d_round=''
727 d_safebcpy=''
728 d_safemcpy=''
729 d_sanemcmp=''
730 d_sbrkproto=''
731 d_scalbn=''
732 d_scalbnl=''
733 d_select=''
734 d_sem=''
735 d_semctl=''
736 d_semget=''
737 d_semop=''
738 d_sendmsg=''
739 d_setegid=''
740 d_seteuid=''
741 d_setgrent=''
742 d_setgrent_r=''
743 setgrent_r_proto=''
744 d_setgrps=''
745 d_sethent=''
746 d_sethostent_r=''
747 sethostent_r_proto=''
748 d_setitimer=''
749 d_setlinebuf=''
750 d_setlocale=''
751 d_setlocale_r=''
752 setlocale_r_proto=''
753 d_setnent=''
754 d_setnetent_r=''
755 setnetent_r_proto=''
756 d_setpent=''
757 d_setpgid=''
758 d_setpgrp2=''
759 d_bsdsetpgrp=''
760 d_setpgrp=''
761 d_setprior=''
762 d_setproctitle=''
763 d_setprotoent_r=''
764 setprotoent_r_proto=''
765 d_setpwent=''
766 d_setpwent_r=''
767 setpwent_r_proto=''
768 d_setregid=''
769 d_setresgid=''
770 d_setresuid=''
771 d_setreuid=''
772 d_setrgid=''
773 d_setruid=''
774 d_setsent=''
775 d_setservent_r=''
776 setservent_r_proto=''
777 d_setsid=''
778 d_setvbuf=''
779 d_shm=''
780 d_shmat=''
781 d_shmatprototype=''
782 shmattype=''
783 d_shmctl=''
784 d_shmdt=''
785 d_shmget=''
786 d_sigaction=''
787 d_signbit=''
788 d_sigprocmask=''
789 d_sigsetjmp=''
790 usesitecustomize=''
791 d_snprintf=''
792 d_vsnprintf=''
793 d_sockatmark=''
794 d_sockatmarkproto=''
795 d_ip_mreq=''
796 d_ip_mreq_source=''
797 d_ipv6_mreq=''
798 d_ipv6_mreq_source=''
799 d_msg_ctrunc=''
800 d_msg_dontroute=''
801 d_msg_oob=''
802 d_msg_peek=''
803 d_msg_proxy=''
804 d_oldsock=''
805 d_scm_rights=''
806 d_sin6_scope_id=''
807 d_sockaddr_in6=''
808 d_sockaddr_sa_len=''
809 d_socket=''
810 d_sockpair=''
811 sockethdr=''
812 socketlib=''
813 d_socklen_t=''
814 d_socks5_init=''
815 d_sprintf_returns_strlen=''
816 d_sqrtl=''
817 d_srand48_r=''
818 srand48_r_proto=''
819 d_srandom_r=''
820 srandom_r_proto=''
821 d_sresgproto=''
822 d_sresuproto=''
823 d_stat=''
824 d_statblks=''
825 d_statfs_f_flags=''
826 d_statfs_s=''
827 d_static_inline=''
828 perl_static_inline=''
829 d_fstatvfs=''
830 d_statvfs=''
831 d_stdio_cnt_lval=''
832 d_stdio_ptr_lval=''
833 d_stdio_ptr_lval_nochange_cnt=''
834 d_stdio_ptr_lval_sets_cnt=''
835 d_stdiobase=''
836 d_stdstdio=''
837 stdio_base=''
838 stdio_bufsiz=''
839 stdio_cnt=''
840 stdio_filbuf=''
841 stdio_ptr=''
842 d_index=''
843 d_strchr=''
844 d_strcoll=''
845 d_strctcpy=''
846 d_strerrm=''
847 d_strerror=''
848 d_sysernlst=''
849 d_syserrlst=''
850 d_strerror_r=''
851 strerror_r_proto=''
852 d_strftime=''
853 d_strlcat=''
854 d_strlcpy=''
855 d_strtod=''
856 d_strtol=''
857 d_strtold=''
858 d_strtoll=''
859 d_strtoq=''
860 d_strtoul=''
861 d_strtoull=''
862 d_strtouq=''
863 d_strxfrm=''
864 d_symlink=''
865 d_syscall=''
866 d_syscallproto=''
867 d_sysconf=''
868 d_system=''
869 d_tcgetpgrp=''
870 d_tcsetpgrp=''
871 d_telldirproto=''
872 d_tgamma=''
873 d_time=''
874 timetype=''
875 d_asctime64=''
876 d_ctime64=''
877 d_difftime64=''
878 d_gmtime64=''
879 d_localtime64=''
880 d_mktime64=''
881 d_timegm=''
882 clocktype=''
883 d_times=''
884 d_tmpnam_r=''
885 tmpnam_r_proto=''
886 d_trunc=''
887 d_truncate=''
888 d_truncl=''
889 d_ttyname_r=''
890 ttyname_r_proto=''
891 d_tzname=''
892 d_u32align=''
893 d_ualarm=''
894 d_umask=''
895 d_semctl_semid_ds=''
896 d_semctl_semun=''
897 d_union_semun=''
898 d_unordered=''
899 d_unsetenv=''
900 d_usleep=''
901 d_usleepproto=''
902 d_ustat=''
903 d_pseudofork=''
904 d_vfork=''
905 usevfork=''
906 d_voidsig=''
907 signal_t=''
908 d_volatile=''
909 d_charvspr=''
910 d_vprintf=''
911 d_wait4=''
912 d_waitpid=''
913 d_wcscmp=''
914 d_wcstombs=''
915 d_wcsxfrm=''
916 d_wctomb=''
917 d_writev=''
918 dlext=''
919 bin_ELF=''
920 cccdlflags=''
921 ccdlflags=''
922 dlsrc=''
923 ld=''
924 ld_can_script=''
925 lddlflags=''
926 usedl=''
927 doublesize=''
928 ebcdic=''
929 fflushNULL=''
930 fflushall=''
931 fpossize=''
932 fpostype=''
933 gccansipedantic=''
934 gccosandvers=''
935 gccversion=''
936 gidformat=''
937 gidsign=''
938 gidsize=''
939 gidtype=''
940 groupstype=''
941 h_fcntl=''
942 h_sysfile=''
943 html1dir=''
944 html1direxp=''
945 installhtml1dir=''
946 html3dir=''
947 html3direxp=''
948 installhtml3dir=''
949 i_arpainet=''
950 i_assert=''
951 i_bfd=''
952 i_crypt=''
953 db_hashtype=''
954 db_prefixtype=''
955 db_version_major=''
956 db_version_minor=''
957 db_version_patch=''
958 i_db=''
959 i_dbm=''
960 i_rpcsvcdbm=''
961 d_dirnamlen=''
962 direntrytype=''
963 i_dirent=''
964 i_dlfcn=''
965 i_execinfo=''
966 i_fcntl=''
967 i_fenv=''
968 i_float=''
969 i_fp=''
970 i_fp_class=''
971 i_gdbm=''
972 d_grpasswd=''
973 i_grp=''
974 i_ieeefp=''
975 i_inttypes=''
976 i_langinfo=''
977 i_libutil=''
978 i_limits=''
979 i_locale=''
980 i_machcthr=''
981 i_malloc=''
982 i_mallocmalloc=''
983 i_math=''
984 i_memory=''
985 i_mntent=''
986 d_gdbm_ndbm_h_uses_prototypes=''
987 d_gdbmndbm_h_uses_prototypes=''
988 d_ndbm=''
989 d_ndbm_h_uses_prototypes=''
990 i_gdbm_ndbm=''
991 i_gdbmndbm=''
992 i_ndbm=''
993 i_netdb=''
994 i_neterrno=''
995 i_netinettcp=''
996 i_niin=''
997 i_sysin=''
998 i_poll=''
999 i_prot=''
1000 i_pthread=''
1001 d_pwage=''
1002 d_pwchange=''
1003 d_pwclass=''
1004 d_pwcomment=''
1005 d_pwexpire=''
1006 d_pwgecos=''
1007 d_pwpasswd=''
1008 d_pwquota=''
1009 i_pwd=''
1010 i_quadmath=''
1011 i_shadow=''
1012 i_socks=''
1013 i_stdbool=''
1014 i_stddef=''
1015 i_stdint=''
1016 i_stdlib=''
1017 i_string=''
1018 strings=''
1019 i_sunmath=''
1020 i_sysaccess=''
1021 i_sysdir=''
1022 i_sysfile=''
1023 d_voidtty=''
1024 i_bsdioctl=''
1025 i_sysfilio=''
1026 i_sysioctl=''
1027 i_syssockio=''
1028 i_syslog=''
1029 i_sysmman=''
1030 i_sysmode=''
1031 i_sysmount=''
1032 i_sysndir=''
1033 i_sysparam=''
1034 i_syspoll=''
1035 i_sysresrc=''
1036 i_syssecrt=''
1037 i_sysselct=''
1038 i_sysstat=''
1039 i_sysstatfs=''
1040 i_sysstatvfs=''
1041 i_systimes=''
1042 i_systypes=''
1043 i_sysuio=''
1044 i_sysun=''
1045 i_sysutsname=''
1046 i_sysvfs=''
1047 i_syswait=''
1048 i_sgtty=''
1049 i_termio=''
1050 i_termios=''
1051 d_tm_tm_gmtoff=''
1052 d_tm_tm_zone=''
1053 i_systime=''
1054 i_systimek=''
1055 i_time=''
1056 timeincl=''
1057 i_unistd=''
1058 i_ustat=''
1059 i_utime=''
1060 i_values=''
1061 i_stdarg=''
1062 i_varargs=''
1063 i_varhdr=''
1064 i_vfork=''
1065 d_inc_version_list=''
1066 inc_version_list=''
1067 inc_version_list_init=''
1068 doubleinfbytes=''
1069 doublenanbytes=''
1070 longdblinfbytes=''
1071 longdblnanbytes=''
1072 installprefix=''
1073 installprefixexp=''
1074 installstyle=''
1075 installusrbinperl=''
1076 intsize=''
1077 longsize=''
1078 shortsize=''
1079 issymlink=''
1080 libc=''
1081 ldlibpthname=''
1082 libperl=''
1083 shrpenv=''
1084 useshrplib=''
1085 glibpth=''
1086 incpth=''
1087 libpth=''
1088 loclibpth=''
1089 plibpth=''
1090 xlibpth=''
1091 ignore_versioned_solibs=''
1092 libs=''
1093 libsdirs=''
1094 libsfiles=''
1095 libsfound=''
1096 libspath=''
1097 lns=''
1098 d_PRIEUldbl=''
1099 d_PRIFUldbl=''
1100 d_PRIGUldbl=''
1101 d_PRIeldbl=''
1102 d_PRIfldbl=''
1103 d_PRIgldbl=''
1104 d_SCNfldbl=''
1105 doublekind=''
1106 sPRIEUldbl=''
1107 sPRIFUldbl=''
1108 sPRIGUldbl=''
1109 sPRIeldbl=''
1110 sPRIfldbl=''
1111 sPRIgldbl=''
1112 sSCNfldbl=''
1113 lseeksize=''
1114 lseektype=''
1115 make_set_make=''
1116 d_mymalloc=''
1117 freetype=''
1118 mallocobj=''
1119 mallocsrc=''
1120 malloctype=''
1121 usemallocwrap=''
1122 usemymalloc=''
1123 installman1dir=''
1124 man1dir=''
1125 man1direxp=''
1126 man1ext=''
1127 installman3dir=''
1128 man3dir=''
1129 man3direxp=''
1130 man3ext=''
1131 doublemantbits=''
1132 longdblmantbits=''
1133 nvmantbits=''
1134 modetype=''
1135 multiarch=''
1136 mydomain=''
1137 myhostname=''
1138 phostname=''
1139 c=''
1140 n=''
1141 d_eofnblk=''
1142 eagain=''
1143 o_nonblock=''
1144 rd_nodata=''
1145 need_va_copy=''
1146 netdb_hlen_type=''
1147 netdb_host_type=''
1148 netdb_name_type=''
1149 netdb_net_type=''
1150 groupcat=''
1151 hostcat=''
1152 passcat=''
1153 orderlib=''
1154 ranlib=''
1155 d_perl_otherlibdirs=''
1156 otherlibdirs=''
1157 package=''
1158 spackage=''
1159 pager=''
1160 api_revision=''
1161 api_subversion=''
1162 api_version=''
1163 api_versionstring=''
1164 patchlevel=''
1165 perl_patchlevel=''
1166 revision=''
1167 subversion=''
1168 version=''
1169 version_patchlevel_string=''
1170 perl5=''
1171 perladmin=''
1172 perlpath=''
1173 d_nv_preserves_uv=''
1174 d_nv_zero_is_allbits_zero=''
1175 i16size=''
1176 i16type=''
1177 i32size=''
1178 i32type=''
1179 i64size=''
1180 i64type=''
1181 i8size=''
1182 i8type=''
1183 ivsize=''
1184 ivtype=''
1185 nv_overflows_integers_at=''
1186 nv_preserves_uv_bits=''
1187 nvsize=''
1188 nvtype=''
1189 u16size=''
1190 u16type=''
1191 u32size=''
1192 u32type=''
1193 u64size=''
1194 u64type=''
1195 u8size=''
1196 u8type=''
1197 uvsize=''
1198 uvtype=''
1199 ivdformat=''
1200 nvEUformat=''
1201 nvFUformat=''
1202 nvGUformat=''
1203 nveformat=''
1204 nvfformat=''
1205 nvgformat=''
1206 uvXUformat=''
1207 uvoformat=''
1208 uvuformat=''
1209 uvxformat=''
1210 pidtype=''
1211 prefix=''
1212 prefixexp=''
1213 installprivlib=''
1214 privlib=''
1215 privlibexp=''
1216 prototype=''
1217 ptrsize=''
1218 d_PRIXU64=''
1219 d_PRId64=''
1220 d_PRIi64=''
1221 d_PRIo64=''
1222 d_PRIu64=''
1223 d_PRIx64=''
1224 sPRIXU64=''
1225 sPRId64=''
1226 sPRIi64=''
1227 sPRIo64=''
1228 sPRIu64=''
1229 sPRIx64=''
1230 d_quad=''
1231 quadkind=''
1232 quadtype=''
1233 uquadtype=''
1234 drand01=''
1235 randbits=''
1236 randfunc=''
1237 randseedtype=''
1238 seedfunc=''
1239 installscript=''
1240 scriptdir=''
1241 scriptdirexp=''
1242 selectminbits=''
1243 selecttype=''
1244 sh=''
1245 targetsh=''
1246 sig_count=''
1247 sig_name=''
1248 sig_name_init=''
1249 sig_num=''
1250 sig_num_init=''
1251 sig_size=''
1252 d_sitearch=''
1253 installsitearch=''
1254 sitearch=''
1255 sitearchexp=''
1256 installsitebin=''
1257 sitebin=''
1258 sitebinexp=''
1259 installsitehtml1dir=''
1260 sitehtml1dir=''
1261 sitehtml1direxp=''
1262 installsitehtml3dir=''
1263 sitehtml3dir=''
1264 sitehtml3direxp=''
1265 installsitelib=''
1266 sitelib=''
1267 sitelib_stem=''
1268 sitelibexp=''
1269 installsiteman1dir=''
1270 siteman1dir=''
1271 siteman1direxp=''
1272 installsiteman3dir=''
1273 siteman3dir=''
1274 siteman3direxp=''
1275 siteprefix=''
1276 siteprefixexp=''
1277 installsitescript=''
1278 sitescript=''
1279 sitescriptexp=''
1280 sizesize=''
1281 sizetype=''
1282 d_libname_unique=''
1283 so=''
1284 socksizetype=''
1285 sharpbang=''
1286 shsharp=''
1287 spitshell=''
1288 src=''
1289 ssizetype=''
1290 st_ino_sign=''
1291 st_ino_size=''
1292 startperl=''
1293 startsh=''
1294 stdchar=''
1295 d_stdio_stream_array=''
1296 stdio_stream_array=''
1297 sysman=''
1298 sGMTIME_max=''
1299 sGMTIME_min=''
1300 sLOCALTIME_max=''
1301 sLOCALTIME_min=''
1302 trnl=''
1303 uidformat=''
1304 uidsign=''
1305 uidsize=''
1306 uidtype=''
1307 archname64=''
1308 use64bitall=''
1309 use64bitint=''
1310 usecbacktrace=''
1311 dtrace=''
1312 usedtrace=''
1313 usefaststdio=''
1314 usekernprocpathname=''
1315 ccflags_uselargefiles=''
1316 ldflags_uselargefiles=''
1317 libswanted_uselargefiles=''
1318 uselargefiles=''
1319 uselongdouble=''
1320 usemorebits=''
1321 usemultiplicity=''
1322 nm_opt=''
1323 nm_so_opt=''
1324 runnm=''
1325 usenm=''
1326 usensgetexecutablepath=''
1327 useperlio=''
1328 usequadmath=''
1329 usesocks=''
1330 d_oldpthreads=''
1331 use5005threads=''
1332 useithreads=''
1333 usereentrant=''
1334 usethreads=''
1335 incpath=''
1336 mips_type=''
1337 usrinc=''
1338 vaproto=''
1339 d_vendorarch=''
1340 installvendorarch=''
1341 vendorarch=''
1342 vendorarchexp=''
1343 d_vendorbin=''
1344 installvendorbin=''
1345 vendorbin=''
1346 vendorbinexp=''
1347 installvendorhtml1dir=''
1348 vendorhtml1dir=''
1349 vendorhtml1direxp=''
1350 installvendorhtml3dir=''
1351 vendorhtml3dir=''
1352 vendorhtml3direxp=''
1353 d_vendorlib=''
1354 installvendorlib=''
1355 vendorlib=''
1356 vendorlib_stem=''
1357 vendorlibexp=''
1358 installvendorman1dir=''
1359 vendorman1dir=''
1360 vendorman1direxp=''
1361 installvendorman3dir=''
1362 vendorman3dir=''
1363 vendorman3direxp=''
1364 usevendorprefix=''
1365 vendorprefix=''
1366 vendorprefixexp=''
1367 d_vendorscript=''
1368 installvendorscript=''
1369 vendorscript=''
1370 vendorscriptexp=''
1371 versiononly=''
1372 yacc=''
1373 yaccflags=''
1374 CONFIG=''
1375
1376 : Detect odd OSs
1377 define='define'
1378 undef='undef'
1379 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1380 rmlist=''
1381
1382 : We must find out about Eunice early
1383 eunicefix=':'
1384 if test -f /etc/unixtovms; then
1385         eunicefix=/etc/unixtovms
1386 fi
1387 if test -f /etc/unixtovms.exe; then
1388         eunicefix=/etc/unixtovms.exe
1389 fi
1390
1391 : Set executable suffix now -- needed before hints available
1392 if test -f "/libs/version.library"; then
1393 : Amiga OS
1394     _exe=""
1395 elif test -f "/system/gnu_library/bin/ar.pm"; then
1396 : Stratus VOS
1397     _exe=".pm"
1398 elif test -n "$DJGPP"; then
1399 : DOS DJGPP
1400     _exe=".exe"
1401 elif test -f /kern/cookiejar; then
1402 : MiNT
1403     _exe=""
1404 elif test -d c:/. -o -n "$is_os2" ; then
1405 : OS/2 or cygwin
1406     _exe=".exe"
1407 fi
1408
1409 groupstype=''
1410 i_whoami=''
1411 : Trailing extension.  Override this in a hint file, if needed.
1412 : Extra object files, if any, needed on this platform.
1413 archobjs=''
1414 archname=''
1415 : Possible local include directories to search.
1416 : Set locincpth to "" in a hint file to defeat local include searches.
1417 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1418 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1419 :
1420 : no include file wanted by default
1421 inclwanted=''
1422
1423 : Enable -DEBUGGING and -DDEBUGGING from the command line
1424 EBUGGING=''
1425 DEBUGGING=''
1426
1427 libnames=''
1428 : change the next line if compiling for Xenix/286 on Xenix/386
1429 xlibpth='/usr/lib/386 /lib/386'
1430 : Possible local library directories to search.
1431 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1432 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1433
1434 : general looking path for locating libraries
1435 glibpth="/lib /usr/lib $xlibpth"
1436 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1437 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1438 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1439 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1440
1441 : Private path used by Configure to find libraries.  Its value
1442 : is prepended to libpth. This variable takes care of special
1443 : machines, like the mips.  Usually, it should be empty.
1444 plibpth=''
1445
1446 : default library list
1447 libswanted=''
1448 : some systems want to use only the non-versioned libso:s
1449 ignore_versioned_solibs=''
1450 : set usethreads on the Configure command line to enable threads.
1451 usereentrant='undef'
1452 ccname=''
1453 ccversion=''
1454 perllibs=''
1455 : set useposix=false in your hint file to disable the POSIX extension.
1456 useposix=true
1457 : set useopcode=false in your hint file to disable the Opcode extension.
1458 useopcode=true
1459 archname64=''
1460 ccflags_uselargefiles=''
1461 ldflags_uselargefiles=''
1462 libswanted_uselargefiles=''
1463 : set usemultiplicity on the Configure command line to enable multiplicity.
1464 : set usesocks on the Configure command line to enable socks.
1465 : List of libraries we want.
1466 : If anyone needs extra -lxxx, put those in a hint file.
1467 libswanted="cl pthread socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld"
1468 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1469 : We probably want to search /usr/shlib before most other libraries.
1470 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1471 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1472 glibpth="/usr/shlib $glibpth"
1473 : Do not use vfork unless overridden by a hint file.
1474 usevfork=false
1475
1476 : Find the basic shell for Bourne shell scripts
1477 case "$sh" in
1478 '')
1479         case "$SYSTYPE" in
1480         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1481         *) xxx='/bin/sh';;
1482         esac
1483         if test -f "$xxx"; then
1484                 sh="$xxx"
1485         else
1486                 : Build up a list and do a single loop so we can 'break' out.
1487                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1488                 for xxx in sh bash ksh pdksh ash; do
1489                         for p in $pth; do
1490                                 try="$try ${p}/${xxx}"
1491                         done
1492                 done
1493                 for xxx in $try; do
1494                         if test -f "$xxx"; then
1495                                 sh="$xxx";
1496                                 break
1497                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1498                                 sh="$xxx";
1499                                 break
1500                         elif test -f "$xxx.exe"; then
1501                                 sh="$xxx";
1502                                 break
1503                         fi
1504                 done
1505         fi
1506         ;;
1507 esac
1508
1509 case "$sh" in
1510 '')     cat >&2 <<EOM
1511 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1512
1513 Usually it's in /bin/sh.  How did you even get this far?
1514 Please contact me (Perl Maintainers) at perlbug@perl.org and
1515 we'll try to straighten this all out.
1516 EOM
1517         exit 1
1518         ;;
1519 esac
1520
1521 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1522 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1523 targetsh=$sh
1524
1525 : see if sh knows # comments
1526 if `$sh -c '#' >/dev/null 2>&1`; then
1527         shsharp=true
1528         spitshell=cat
1529         xcat=/bin/cat
1530         test -f $xcat$_exe || xcat=/usr/bin/cat
1531         if test ! -f $xcat$_exe; then
1532                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1533                         if test -f $p/cat$_exe; then
1534                                 xcat=$p/cat
1535                                 break
1536                         fi
1537                 done
1538                 if test ! -f $xcat$_exe; then
1539                         echo "Can't find cat anywhere!"
1540                         exit 1
1541                 fi
1542         fi
1543         echo "#!$xcat" >sharp
1544         $eunicefix sharp
1545         chmod +x sharp
1546         ./sharp > today 2>/dev/null
1547         if test -s today; then
1548                 sharpbang='#!'
1549         else
1550                 echo "#! $xcat" > sharp
1551                 $eunicefix sharp
1552                 chmod +x sharp
1553                 ./sharp > today 2>/dev/null
1554                 if test -s today; then
1555                         sharpbang='#! '
1556                 else
1557                         sharpbang=': use '
1558                 fi
1559         fi
1560 else
1561         echo " "
1562         echo "Your $sh doesn't grok # comments--I will strip them later on."
1563         shsharp=false
1564         cd ..
1565         echo "exec grep -v '^[  ]*#'" >spitshell
1566         chmod +x spitshell
1567         $eunicefix spitshell
1568         spitshell=`pwd`/spitshell
1569         cd UU
1570         echo "I presume that if # doesn't work, #! won't work either!"
1571         sharpbang=': use '
1572 fi
1573 rm -f sharp today
1574
1575 : figure out how to guarantee sh startup
1576 case "$startsh" in
1577 '') startsh=${sharpbang}${sh} ;;
1578 *)
1579 esac
1580 cat >sharp <<EOSS
1581 $startsh
1582 set abc
1583 test "$?abc" != 1
1584 EOSS
1585
1586 chmod +x sharp
1587 $eunicefix sharp
1588 if ./sharp; then
1589         : echo "Yup, it does."
1590 else
1591         echo "Hmm... '$startsh' does not guarantee sh startup..."
1592         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1593 fi
1594 rm -f sharp
1595
1596 : Save command line options in file UU/cmdline.opt for later use in
1597 : generating config.sh.
1598 cat > cmdline.opt <<EOSH
1599 : Configure command line arguments.
1600 config_arg0='$0'
1601 config_args='$*'
1602 config_argc=$#
1603 EOSH
1604 argn=1
1605 args_exp=''
1606 args_sep=''
1607 for arg in "$@"; do
1608         cat >>cmdline.opt <<EOSH
1609 config_arg$argn='$arg'
1610 EOSH
1611         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1612 $arg
1613 EOC
1614         arg_exp=`cat cmdl.opt`
1615         args_exp="$args_exp$args_sep'$arg_exp'"
1616         argn=`expr $argn + 1`
1617         args_sep=' '
1618 done
1619 rm -f cmdl.opt
1620
1621 : produce awk script to parse command line options
1622 cat >options.awk <<'EOF'
1623 BEGIN {
1624         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1625
1626         len = length(optstr);
1627         for (i = 1; i <= len; i++) {
1628                 c = substr(optstr, i, 1);
1629                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1630                 if (a == ":") {
1631                         arg[c] = 1;
1632                         i++;
1633                 }
1634                 opt[c] = 1;
1635         }
1636 }
1637 {
1638         expect = 0;
1639         str = $0;
1640         if (substr(str, 1, 1) != "-") {
1641                 printf("'%s'\n", str);
1642                 next;
1643         }
1644         len = length($0);
1645         for (i = 2; i <= len; i++) {
1646                 c = substr(str, i, 1);
1647                 if (!opt[c]) {
1648                         printf("-%s\n", substr(str, i));
1649                         next;
1650                 }
1651                 printf("-%s\n", c);
1652                 if (arg[c]) {
1653                         if (i < len)
1654                                 printf("'%s'\n", substr(str, i + 1));
1655                         else
1656                                 expect = 1;
1657                         next;
1658                 }
1659         }
1660 }
1661 END {
1662         if (expect)
1663                 print "?";
1664 }
1665 EOF
1666
1667 : process the command line options
1668 set X `for arg in "$@"; do echo "X$arg"; done |
1669         sed -e s/X// | awk -f options.awk`
1670 eval "set $*"
1671 shift
1672 rm -f options.awk
1673
1674 : set up default values
1675 fastread=''
1676 reuseval=false
1677 config_sh=''
1678 alldone=''
1679 error=''
1680 silent=''
1681 extractsh=''
1682 override=''
1683 knowitall=''
1684 rm -f optdef.sh posthint.sh
1685 cat >optdef.sh <<EOS
1686 $startsh
1687 EOS
1688
1689
1690 : option parsing
1691 while test $# -gt 0; do
1692         case "$1" in
1693         -d) shift; fastread=yes;;
1694         -e) shift; alldone=cont;;
1695         -f)
1696                 shift
1697                 cd ..
1698                 if test -r "$1"; then
1699                         config_sh="$1"
1700                 else
1701                         echo "$me: cannot read config file $1." >&2
1702                         error=true
1703                 fi
1704                 cd UU
1705                 shift;;
1706         --help|\
1707         -h) shift; error=true;;
1708         -r) shift; reuseval=true;;
1709         -s) shift; silent=true; realsilent=true;;
1710         -E) shift; alldone=exit;;
1711         -K) shift; knowitall=true;;
1712         -O) shift; override=true;;
1713         -S) shift; silent=true; extractsh=true;;
1714         -D)
1715                 shift
1716                 case "$1" in
1717                 *=)
1718                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1719                         echo "$me: ignoring -D $1" >&2
1720                         ;;
1721                 *=*) echo "$1" | \
1722                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1723                 *) echo "$1='define'" >> optdef.sh;;
1724                 esac
1725                 shift
1726                 ;;
1727         -U)
1728                 shift
1729                 case "$1" in
1730                 *=) echo "$1" >> optdef.sh;;
1731                 *=*)
1732                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1733                         echo "$me: ignoring -U $1" >&2
1734                         ;;
1735                 *) echo "$1='undef'" >> optdef.sh;;
1736                 esac
1737                 shift
1738                 ;;
1739         -A)
1740             shift
1741             xxx=''
1742             yyy="$1"
1743             zzz=''
1744             uuu=undef
1745             case "$yyy" in
1746             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1747                  case "$zzz" in
1748                  *:*) zzz='' ;;
1749                  *)   xxx=append
1750                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1751                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1752                  esac
1753                  ;;
1754             esac
1755             case "$xxx" in
1756             '')  case "$yyy" in
1757                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1758                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1759                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1760                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1761                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1762                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1763                  esac
1764                  ;;
1765             esac
1766             case "$xxx" in
1767             append)
1768                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1769             clear)
1770                 echo "$yyy=''"                  >> posthint.sh ;;
1771             define)
1772                 case "$zzz" in
1773                 '') zzz=define ;;
1774                 esac
1775                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1776             eval)
1777                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1778             prepend)
1779                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1780             undef)
1781                 case "$zzz" in
1782                 '') zzz="$uuu" ;;
1783                 esac
1784                 echo "$yyy=$zzz"                >> posthint.sh ;;
1785             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1786             esac
1787             shift
1788             ;;
1789         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1790             exit 0;;
1791         --) break;;
1792         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1793         *) break;;
1794         esac
1795 done
1796
1797 case "$error" in
1798 true)
1799         cat >&2 <<EOM
1800 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1801                  [-U symbol] [-U symbol=] [-A command:symbol...]
1802   -d : use defaults for all answers.
1803   -e : go on without questioning past the production of config.sh.
1804   -f : specify an alternate default configuration file.
1805   -h : print this help message and exit (with an error status).
1806   -r : reuse C symbols value if possible (skips costly nm extraction).
1807   -s : silent mode, only echoes questions and essential information.
1808   -D : define symbol to have some value:
1809          -D symbol         symbol gets the value 'define'
1810          -D symbol=value   symbol gets the value 'value'
1811        common used examples (see INSTALL for more info):
1812          -Duse64bitint            use 64bit integers
1813          -Duse64bitall            use 64bit integers and pointers
1814          -Dusethreads             use thread support
1815          -Dinc_version_list=none  do not include older perl trees in @INC
1816          -DEBUGGING=none          DEBUGGING options
1817          -Dcc=gcc                 choose your compiler
1818          -Dprefix=/opt/perl5      choose your destination
1819   -E : stop at the end of questions, after having produced config.sh.
1820   -K : do not use unless you know what you are doing.
1821   -O : let -D and -U override definitions from loaded configuration file.
1822   -S : perform variable substitutions on all .SH files (can mix with -f)
1823   -U : undefine symbol:
1824          -U symbol    symbol gets the value 'undef'
1825          -U symbol=   symbol gets completely empty
1826        e.g.:  -Uversiononly
1827   -A : manipulate symbol after the platform specific hints have been applied:
1828          -A append:symbol=value   append value to symbol
1829          -A symbol=value          like append:, but with a separating space
1830          -A define:symbol=value   define symbol to have value
1831          -A clear:symbol          define symbol to be ''
1832          -A define:symbol         define symbol to be 'define'
1833          -A eval:symbol=value     define symbol to be eval of value
1834          -A prepend:symbol=value  prepend value to symbol
1835          -A undef:symbol          define symbol to be 'undef'
1836          -A undef:symbol=         define symbol to be ''
1837        e.g.:  -A prepend:libswanted='cl pthread '
1838               -A ccflags=-DSOME_MACRO
1839   -V : print version number and exit (with a zero status).
1840 EOM
1841         exit 1
1842         ;;
1843 esac
1844
1845 : Sanity checks
1846 case "$fastread$alldone" in
1847 yescont|yesexit) ;;
1848 *)
1849         case "$extractsh" in
1850         true) ;;
1851         *)
1852                 if test ! -t 0; then
1853                         echo "Say 'sh Configure', not 'sh <Configure'"
1854                         exit 1
1855                 fi
1856                 ;;
1857         esac
1858         ;;
1859 esac
1860
1861 exec 4>&1
1862 case "$silent" in
1863 true) exec 1>/dev/null;;
1864 esac
1865
1866 : run the defines and the undefines, if any, but leave the file out there...
1867 touch optdef.sh
1868 grep -q '\\' optdef.sh
1869 if test $? = 0; then
1870     echo "Configure does not support \\ in -D arguments"
1871     exit 1
1872 fi
1873 . ./optdef.sh
1874 : create the posthint manipulation script and leave the file out there...
1875 touch posthint.sh
1876
1877 : set package name
1878 package='perl5'
1879 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1880 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1881 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1882 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1883 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1884 esac
1885
1886 : Some greps do not return status, grrr.
1887 echo "grimblepritz" >grimble
1888 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1889         contains=contains
1890 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1891         contains=grep
1892 else
1893         contains=contains
1894 fi
1895 rm -f grimble
1896 : the following should work in any shell
1897 case "$contains" in
1898 contains*)
1899         echo " "
1900         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1901         cat >contains <<'EOSS'
1902 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1903 EOSS
1904 chmod +x contains
1905 esac
1906
1907 : Find the path to the source tree
1908 case "$src" in
1909 '') case "$0" in
1910     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1911          case "$src" in
1912          /*)    ;;
1913          .)     ;;
1914          *)     src=`cd ../$src && pwd` ;;
1915          esac
1916          ;;
1917     *)   src='.';;
1918     esac;;
1919 esac
1920 case "$src" in
1921 '')     src=/
1922         rsrc=/
1923         ;;
1924 /*)     rsrc="$src";;
1925 *)      rsrc="../$src";;
1926 esac
1927 if test -f $rsrc/Configure && \
1928         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1929 then
1930    : found it, so we are ok.
1931 else
1932         rsrc=''
1933         for src in . .. ../.. ../../.. ../../../..; do
1934                 if test -f ../$src/Configure && \
1935                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1936                 then
1937                         rsrc=../$src
1938                         break
1939                 fi
1940         done
1941 fi
1942 case "$rsrc" in
1943 '')
1944         cat <<EOM >&4
1945
1946 Sorry, I can't seem to locate the source dir for $package.  Please start
1947 Configure with an explicit path -- i.e. /some/path/Configure.
1948
1949 EOM
1950         exit 1
1951         ;;
1952 ../.)   rsrc='..';;
1953 *)
1954         echo " "
1955         echo "Sources for $package found in \"$src\"." >&4
1956         ;;
1957 esac
1958
1959 : script used to extract .SH files with variable substitutions
1960 cat >extract <<'EOS'
1961 PERL_CONFIG_SH=true
1962 echo "Doing variable substitutions on .SH files..."
1963 if test -f MANIFEST; then
1964         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1965 else
1966         echo "(Looking for .SH files under the source directory.)"
1967         set x `(cd "$src"; find . -name "*.SH" -print)`
1968 fi
1969 shift
1970 case $# in
1971 0) set x `(cd "$src"; echo *.SH)`; shift;;
1972 esac
1973 if test ! -f "$src/$1"; then
1974         shift
1975 fi
1976 mkdir_p='
1977 name=$1;
1978 create="";
1979 while test $name; do
1980         if test ! -d "$name"; then
1981                 create="$name $create";
1982                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1983                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1984         else
1985                 name="";
1986         fi;
1987 done;
1988 for file in $create; do
1989         mkdir $file;
1990 done
1991 '
1992 for file in $*; do
1993         case "$src" in
1994         ".")
1995                 case "$file" in
1996                 */*)
1997                         dir=`expr X$file : 'X\(.*\)/'`
1998                         file=`expr X$file : 'X.*/\(.*\)'`
1999                         (cd "$dir" && . ./$file)
2000                         ;;
2001                 *)
2002                         . ./$file
2003                         ;;
2004                 esac
2005                 ;;
2006         *)
2007                 case "$file" in
2008                 */*)
2009                         dir=`expr X$file : 'X\(.*\)/'`
2010                         file=`expr X$file : 'X.*/\(.*\)'`
2011                         (set x $dir; shift; eval $mkdir_p)
2012                         sh <"$src/$dir/$file"
2013                         ;;
2014                 *)
2015                         sh <"$src/$file"
2016                         ;;
2017                 esac
2018                 ;;
2019         esac
2020 done
2021 if test -f "$src/config_h.SH"; then
2022         if test ! -f config.h; then
2023         : oops, they left it out of MANIFEST, probably, so do it anyway.
2024         . "$src/config_h.SH"
2025         fi
2026 fi
2027 EOS
2028
2029 : extract files and exit if asked to do so
2030 case "$extractsh" in
2031 true)
2032         case "$realsilent" in
2033         true) ;;
2034         *) exec 1>&4;;
2035         esac
2036         case "$config_sh" in
2037         '') config_sh='config.sh';;
2038         esac
2039         echo " "
2040         echo "Fetching answers from $config_sh..."
2041         cd ..
2042         . $config_sh
2043         test "$override" && . ./optdef.sh
2044         echo " "
2045         . UU/extract
2046         rm -rf UU
2047         echo "Extraction done."
2048         exit 0
2049         ;;
2050 esac
2051
2052 : Eunice requires " " instead of "", can you believe it
2053 echo " "
2054 : Here we go...
2055 echo "Beginning of configuration questions for $package."
2056
2057 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2058
2059 : first determine how to suppress newline on echo command
2060 echo " "
2061 echo "Checking echo to see how to suppress newlines..."
2062 (echo "hi there\c" ; echo " ") >.echotmp
2063 if $contains c .echotmp >/dev/null 2>&1 ; then
2064         echo "...using -n."
2065         n='-n'
2066         c=''
2067 else
2068         cat <<'EOM'
2069 ...using \c
2070 EOM
2071         n=''
2072         c='\c'
2073 fi
2074 echo $n "The star should be here-->$c"
2075 echo '*'
2076 rm -f .echotmp
2077
2078 : Now test for existence of everything in MANIFEST
2079 echo " "
2080 if test -f "$rsrc/MANIFEST"; then
2081         echo "First let's make sure your kit is complete.  Checking..." >&4
2082         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2083                 (split -l 50 2>/dev/null || split -50)
2084         rm -f missing
2085         tmppwd=`pwd`
2086         for filelist in x??; do
2087                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2088                         >/dev/null 2>>"$tmppwd/missing")
2089         done
2090         if test -s missing; then
2091                 cat missing >&4
2092                 cat >&4 <<'EOM'
2093
2094 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2095
2096 You have the option of continuing the configuration process, despite the
2097 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2098 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2099 and contact the author (perlbug@perl.org).
2100
2101 EOM
2102                 echo $n "Continue? [n] $c" >&4
2103                 read ans
2104                 case "$ans" in
2105                 y*)
2106                         echo "Continuing..." >&4
2107                         rm -f missing
2108                         ;;
2109                 *)
2110                         echo "ABORTING..." >&4
2111                         kill $$
2112                         ;;
2113                 esac
2114         else
2115                 echo "Looks good..."
2116         fi
2117 else
2118         echo "There is no MANIFEST file.  I hope your kit is complete !"
2119 fi
2120 rm -f missing x??
2121
2122 : Find the appropriate value for a newline for tr
2123 echo " "
2124 if test -n "$DJGPP"; then
2125        trnl='\012'
2126 fi
2127 if test X"$trnl" = X; then
2128         case "`echo foo|tr '\n' x 2>/dev/null`" in
2129         foox) trnl='\n' ;;
2130         esac
2131 fi
2132 if test X"$trnl" = X; then
2133         case "`echo foo|tr '\012' x 2>/dev/null`" in
2134         foox) trnl='\012' ;;
2135         esac
2136 fi
2137 if test X"$trnl" = X; then
2138        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2139        fooxy) trnl='\n\r' ;;
2140        esac
2141 fi
2142 if test X"$trnl" = X; then
2143         cat <<EOM >&2
2144
2145 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2146
2147 EOM
2148         exit 1
2149 fi
2150
2151 : compute the number of columns on the terminal for proper question formatting
2152 case "$COLUMNS" in
2153 '') COLUMNS='80';;
2154 esac
2155
2156 : set up the echo used in my read
2157 myecho="case \"\$xxxm\" in
2158 '') echo $n \"\$rp $c\" >&4;;
2159 *) case \"\$rp\" in
2160         '') echo $n \"[\$xxxm] $c\";;
2161         *)
2162                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2163                         echo \"\$rp\" >&4
2164                         echo $n \"[\$xxxm] $c\" >&4
2165                 else
2166                         echo $n \"\$rp [\$xxxm] $c\" >&4
2167                 fi
2168                 ;;
2169         esac;;
2170 esac"
2171
2172 : now set up to do reads with possible shell escape and default assignment
2173 cat <<EOSC >myread
2174 $startsh
2175 xxxm=\$dflt
2176 $myecho
2177 ans='!'
2178 case "\$fastread" in
2179 yes) case "\$dflt" in
2180         '') ;;
2181         *) ans='';
2182                 case "\$silent-\$rp" in
2183                 true-) ;;
2184                 *) echo " " >&4;;
2185                 esac;;
2186         esac;;
2187 *) case "\$silent" in
2188         true) case "\$rp" in
2189                 '') ans='';;
2190                 esac;;
2191         esac;;
2192 esac
2193 while expr "X\$ans" : "X!" >/dev/null; do
2194         read answ
2195         set x \$xxxm
2196         shift
2197         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2198         case  "\$answ" in
2199         "!")
2200                 sh 1>&4
2201                 echo " "
2202                 $myecho
2203                 ;;
2204         !*)
2205                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2206                 shift
2207                 sh 1>&4 -c "\$*"
2208                 echo " "
2209                 $myecho
2210                 ;;
2211         "\$ans")
2212                 case "\$ans" in
2213                 \\&*)
2214                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2215                         shift
2216                         case "\$1" in
2217                         -d)
2218                                 fastread=yes
2219                                 echo "(OK, I'll run with -d after this question.)" >&4
2220                                 ;;
2221                         -*)
2222                                 echo "*** Sorry, \$1 not supported yet." >&4
2223                                 ;;
2224                         esac
2225                         $myecho
2226                         ans=!
2227                         ;;
2228                 esac;;
2229         *)
2230                 case "\$aok" in
2231                 y)
2232                         echo "*** Substitution done -- please confirm."
2233                         xxxm="\$ans"
2234                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2235                         xxxm="\$ans"
2236                         ans=!
2237                         ;;
2238                 *)
2239                         echo "*** Error -- try again."
2240                         ans=!
2241                         ;;
2242                 esac
2243                 $myecho
2244                 ;;
2245         esac
2246         case "\$ans\$xxxm\$nostick" in
2247         '')
2248                 ans=!
2249                 $myecho
2250                 ;;
2251         esac
2252 done
2253 case "\$ans" in
2254 '') ans="\$xxxm";;
2255 esac
2256 EOSC
2257
2258 : create .config dir to save info across Configure sessions
2259 test -d ../.config || mkdir ../.config
2260 cat >../.config/README <<EOF
2261 This directory created by Configure to save information that should
2262 persist across sessions for $package.
2263
2264 You may safely delete it if you wish.
2265 EOF
2266
2267 : See if we are using a devel version and want that
2268 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2269 case "$usedevel" in
2270 $define|true|[yY]*)
2271     usedevel="$define" ;;
2272 *) case "$xversion" in
2273    *[13579])
2274         cat >&4 <<EOH
2275 *** WHOA THERE!!! ***
2276
2277     This is an UNSTABLE DEVELOPMENT release.
2278     The version of this $package distribution is $xversion, that is, odd,
2279     (as opposed to even) and that signifies a development release.
2280     If you want a maintenance release, you want an even-numbered version.
2281
2282     Do ***NOT*** install this into production use.
2283     Data corruption and crashes are possible.
2284
2285     It is most seriously suggested that you do not continue any further
2286     unless you want to help in developing and debugging Perl.
2287
2288     If you *still* want to build perl, you can answer 'y' now,
2289     or pass -Dusedevel to Configure.
2290
2291 EOH
2292         rp='Do you really want to continue?'
2293         dflt='n'
2294         . ./myread
2295         case "$ans" in
2296         [yY]) echo >&4 "Okay, continuing."
2297               usedevel="$define" ;;
2298         *) echo >&4 "Okay, bye."
2299            exit 1
2300            ;;
2301         esac
2302         ;;
2303     esac
2304     usedevel="$undef"
2305     ;;
2306 esac
2307 case "$usedevel" in
2308 $define|true|[yY]*)
2309         case "$versiononly" in
2310         '') versiononly="$define" ;;
2311         esac
2312         case "$installusrbinperl" in
2313         '') installusrbinperl="$undef" ;;
2314         esac
2315         ;;
2316 esac
2317
2318 : general instructions
2319 needman=true
2320 firsttime=true
2321 user=`(logname) 2>/dev/null`
2322 case "$user" in
2323 '') user=`whoami 2>&1`;;
2324 esac
2325 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2326         firsttime=false
2327         echo " "
2328         rp='Would you like to see the instructions?'
2329         dflt=n
2330         . ./myread
2331         case "$ans" in
2332         [yY]*) ;;
2333         *) needman=false;;
2334         esac
2335 fi
2336 if $needman; then
2337         cat <<EOH
2338
2339 This installation shell script will examine your system and ask you questions
2340 to determine how the perl5 package should be installed. If you get
2341 stuck on a question, you may use a ! shell escape to start a subshell or
2342 execute a command.  Many of the questions will have default answers in square
2343 brackets; typing carriage return will give you the default.
2344
2345 On some of the questions which ask for file or directory names you are allowed
2346 to use the ~name construct to specify the login directory belonging to "name",
2347 even if you don't have a shell which knows about that.  Questions where this is
2348 allowed will be marked "(~name ok)".
2349
2350 EOH
2351         rp=''
2352         dflt='Type carriage return to continue'
2353         . ./myread
2354         cat <<'EOH'
2355
2356 The prompter used in this script allows you to use shell variables and
2357 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2358 in the default answer, as if the default line was a set of arguments given to a
2359 script shell.  This means you may also use $* to repeat the whole default line,
2360 so you do not have to re-type everything to add something to the default.
2361
2362 Every time there is a substitution, you will have to confirm.  If there is an
2363 error (e.g. an unmatched backtick), the default answer will remain unchanged
2364 and you will be prompted again.
2365
2366 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2367 the questions and use the computed defaults (or the previous answers if there
2368 was already a config.sh file). Type 'Configure -h' for a list of options.
2369 You may also start interactively and then answer '& -d' at any prompt to turn
2370 on the non-interactive behaviour for the remainder of the execution.
2371
2372 EOH
2373         . ./myread
2374         cat <<EOH
2375
2376 Much effort has been expended to ensure that this shell script will run on any
2377 Unix system.  If despite that it blows up on yours, your best bet is to edit
2378 Configure and run it again.  If you can't run Configure for some reason,
2379 you'll have to generate a config.sh file by hand.  Whatever problems you
2380 have, let me (perlbug@perl.org) know how I blew it.
2381
2382 This installation script affects things in two ways:
2383
2384 1) it may do direct variable substitutions on some of the files included
2385    in this kit.
2386 2) it builds a config.h file for inclusion in C programs.  You may edit
2387    any of these files as the need arises after running this script.
2388
2389 If you make a mistake on a question, there is no easy way to back up to it
2390 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2391 files.  Configure will offer to let you do this before it runs the SH files.
2392
2393 EOH
2394         dflt='Type carriage return to continue'
2395         . ./myread
2396         case "$firsttime" in
2397         true) echo $user >>../.config/instruct;;
2398         esac
2399 fi
2400
2401 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2402 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2403 if test "X$sysroot" = X; then
2404     sysroot=""
2405 else
2406     case "$cc" in
2407         *gcc*|*g++*)
2408             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2409             # _sysroot is used in places where we need --sysroot=foo
2410             # but using the rest of the flags could cause issues.
2411             _sysroot="--sysroot=$sysroot";
2412             case "$ccflags" in
2413                 *sysroot*) ;;
2414                 'undef'|*)
2415                 ccflags="$ccflags $_sysroot"
2416             esac
2417             case "$ldflags" in
2418                 *sysroot*) ;;
2419                 'undef'|*)
2420                 ldflags="$ldflags $_sysroot"
2421             esac
2422             case "$cppflags" in
2423                 *sysroot*) ;;
2424                 'undef'|*)
2425                 cppflags="$cppflags $_sysroot"
2426             esac
2427             # lddlflags updated below in lddlflags section;
2428             # same with cccdlflags
2429             ;;
2430     esac
2431
2432     # Adjust some defaults to also use $sysroot
2433     for var in xlibpth loclibpth locincpth glibpth; do
2434         eval xxx=\$$var
2435         eval $var=''
2436         for path in $xxx; do
2437             eval $var=\"\$$var $sysroot$path\"
2438         done
2439     done
2440
2441 fi
2442
2443 : find out where common programs are
2444 echo " "
2445 echo "Locating common programs..." >&4
2446 cat <<EOSC >loc
2447 $startsh
2448 case \$# in
2449 0) exit 1;;
2450 esac
2451 thing=\$1
2452 shift
2453 dflt=\$1
2454 shift
2455 for dir in \$*; do
2456         case "\$thing" in
2457         .)
2458         if test -d \$dir/\$thing; then
2459                 echo \$dir
2460                 exit 0
2461         fi
2462         ;;
2463         *)
2464         for thisthing in \$dir/\$thing; do
2465                 : just loop through to pick last item
2466         done
2467         if test -f \$thisthing; then
2468                 echo \$thisthing
2469                 exit 0
2470         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2471                 echo \$thisthing
2472                 exit 0
2473         elif test -f \$dir/\$thing.exe; then
2474                 if test -n "$DJGPP"; then
2475                         echo \$dir/\$thing.exe
2476                 elif test "$eunicefix" != ":"; then
2477                         : on Eunice apparently
2478                         echo \$dir/\$thing
2479                 fi
2480                 exit 0
2481         fi
2482         ;;
2483         esac
2484 done
2485 echo \$dflt
2486 exit 1
2487 EOSC
2488 chmod +x loc
2489 $eunicefix loc
2490 loclist="
2491 awk
2492 cat
2493 chmod
2494 comm
2495 cp
2496 echo
2497 expr
2498 grep
2499 ls
2500 mkdir
2501 rm
2502 sed
2503 sort
2504 touch
2505 tr
2506 uniq
2507 "
2508 trylist="
2509 ar
2510 bison
2511 byacc
2512 cpp
2513 csh
2514 date
2515 egrep
2516 gmake
2517 gzip
2518 less
2519 ln
2520 make
2521 more
2522 nm
2523 nroff
2524 perl
2525 pg
2526 test
2527 uname
2528 zip
2529 "
2530 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2531 pth="$pth $sysroot/lib $sysroot/usr/lib"
2532 for file in $loclist; do
2533         eval xxx=\$$file
2534         case "$xxx" in
2535         /*|?:[\\/]*)
2536                 if test -f "$xxx"; then
2537                         : ok
2538                 else
2539                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2540                         xxx=`./loc $file $file $pth`
2541                 fi
2542                 ;;
2543         '') xxx=`./loc $file $file $pth`;;
2544         *) xxx=`./loc $xxx $xxx $pth`;;
2545         esac
2546         eval $file=$xxx$_exe
2547         eval _$file=$xxx
2548         case "$xxx" in
2549         /*)
2550                 echo $file is in $xxx.
2551                 ;;
2552         ?:[\\/]*)
2553                 echo $file is in $xxx.
2554                 ;;
2555         *)
2556                 echo "I don't know where '$file' is, and my life depends on it." >&4
2557                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2558                 exit 1
2559                 ;;
2560         esac
2561 done
2562 echo " "
2563 echo "Don't worry if any of the following aren't found..."
2564 say=offhand
2565 for file in $trylist; do
2566         eval xxx=\$$file
2567         case "$xxx" in
2568         /*|?:[\\/]*)
2569                 if test -f "$xxx"; then
2570                         : ok
2571                 else
2572                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2573                         xxx=`./loc $file $file $pth`
2574                 fi
2575                 ;;
2576         '') xxx=`./loc $file $file $pth`;;
2577         *) xxx=`./loc $xxx $xxx $pth`;;
2578         esac
2579         eval $file=$xxx$_exe
2580         eval _$file=$xxx
2581         case "$xxx" in
2582         /*)
2583                 echo $file is in $xxx.
2584                 ;;
2585         ?:[\\/]*)
2586                 echo $file is in $xxx.
2587                 ;;
2588         *)
2589                 echo "I don't see $file out there, $say."
2590                 say=either
2591                 ;;
2592         esac
2593 done
2594 case "$egrep" in
2595 egrep)
2596         echo "Substituting grep for egrep."
2597         egrep=$grep
2598         _egrep=$grep
2599         ;;
2600 esac
2601 case "$less" in
2602 '')     ;;
2603 *)      if $less -R </dev/null >/dev/null 2>&1; then
2604                echo "Substituting less -R for less."
2605                less="$less -R"
2606                _less=$less
2607         fi
2608         ;;
2609 esac
2610 case "$ln" in
2611 ln)
2612         echo "Substituting cp for ln."
2613         ln=$cp
2614         _ln=$cp
2615         ;;
2616 esac
2617 case "$make" in
2618 make)
2619         case "$gmake" in
2620         gmake)
2621         echo "I can't find make or gmake, and my life depends on it." >&4
2622         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2623         exit 1
2624         ;;
2625         esac
2626         ;;
2627 esac
2628 case "$gmake" in
2629 gmake)  ;;
2630 *)      # We can't have osname yet.
2631         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2632                 # Assume that gmake, if found, is definitely GNU make
2633                 # and prefer it over the system make.
2634                 echo "Substituting gmake for make."
2635                 make=$gmake
2636                 _make=$gmake
2637         fi
2638         ;;
2639 esac
2640 case "$test" in
2641 test)
2642         echo "Hopefully test is built into your sh."
2643         ;;
2644 *)
2645         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2646                 echo "Using the test built into your sh."
2647                 test=test
2648                 _test=test
2649         fi
2650         ;;
2651 esac
2652 case "$echo" in
2653 echo)
2654         echo "Hopefully echo is built into your sh."
2655         ;;
2656 '') ;;
2657 *)
2658         echo " "
2659 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2660         $echo $n "hi there$c" >foo1
2661         echo $n "hi there$c" >foo2
2662         if cmp foo1 foo2 >/dev/null 2>&1; then
2663                 echo "They are compatible.  In fact, they may be identical."
2664         else
2665                 case "$n" in
2666                 '-n') n='' c='\c';;
2667                 *) n='-n' c='';;
2668                 esac
2669                 cat <<FOO
2670 They are not compatible!  You are probably running ksh on a non-USG system.
2671 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2672 have echo built in and we may have to run some Bourne shell scripts.  That
2673 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2674
2675 FOO
2676                 $echo $n "The star should be here-->$c"
2677                 $echo "*"
2678         fi
2679         $rm -f foo1 foo2
2680         ;;
2681 esac
2682
2683 # This question was auctioned at YAPC::Europe-2007 in Vienna
2684 # I never promised you could answer it. I only auctioned the question.
2685 cat <<FOO
2686 The following message is sponsored by
2687
2688   Dresden.pm<--The stars should be here.
2689
2690 Dear Perl user, system administrator or package
2691 maintainer, the Perl community sends greetings to
2692 you. Do you (emblematical) greet back [Y/n]? n
2693
2694 FOO
2695
2696 : Check what type of C compiler we use
2697 cat <<EOS >trygcc
2698 $startsh
2699 EOS
2700 cat <<'EOSC' >>trygcc
2701 case "$cc" in
2702 '') ;;
2703 *)  $rm -f try try.*
2704     $cat >try.c <<EOM
2705 int main(int argc, char *argv[]) {
2706   return 0;
2707 }
2708 EOM
2709     if $cc -o try $ccflags $ldflags try.c; then
2710        :
2711     else
2712         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2713         despair=yes
2714         trygcc=yes
2715         case "$cc" in
2716         *gcc*) trygcc=no ;;
2717         esac
2718         # Skip this test because it gives a false match on output like:
2719         #    ./trygcc: line 23: cc: command not found
2720         # case "`$cc -v -c try.c 2>&1`" in
2721         # *gcc*) trygcc=no ;;
2722         # esac
2723         if $test X"$trygcc" = Xyes; then
2724             if gcc -o try -c try.c; then
2725                 echo " "
2726                 echo "You seem to have a working gcc, though." >&4
2727                 # Switching compilers may undo the work of hints files.
2728                 # The most common problem is -D_REENTRANT for threads.
2729                 # This heuristic catches that case, but gets false positives
2730                 # if -Dusethreads was not actually specified.  Better to
2731                 # bail out here with a useful message than fail
2732                 # mysteriously later. Should we perhaps just try to
2733                 # re-invoke Configure -Dcc=gcc config_args ?
2734                 if $test -f usethreads.cbu; then
2735                         $cat >&4 <<EOM
2736
2737 *** However, any setting of the C compiler flags (e.g. for thread support)
2738 *** will be lost.  It may be necessary for you to restart Configure and
2739 *** add -Dcc=gcc to your Configure command line.
2740
2741 EOM
2742                         rp="Would you like to go ahead and try gcc anyway?"
2743                         dflt=n
2744                 else
2745                         rp="Would you like to use it?"
2746                         dflt=y
2747                 fi
2748                 if $test -f myread; then
2749                     . ./myread
2750                 else
2751                     if $test -f UU/myread; then
2752                         . ./UU/myread
2753                     else
2754                         echo "Cannot find myread, sorry.  Aborting." >&2
2755                         exit 1
2756                     fi
2757                 fi
2758                 case "$ans" in
2759                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2760                 esac
2761             fi
2762         fi
2763     fi
2764     $rm -f try try.*
2765     ;;
2766 esac
2767 EOSC
2768
2769 cat <<EOS >checkcc
2770 $startsh
2771 EOS
2772 cat <<'EOSC' >>checkcc
2773 case "$cc" in
2774 '') ;;
2775 *)  $rm -f try try.*
2776     $cat >try.c <<EOM
2777 int main(int argc, char *argv[]) {
2778   return 0;
2779 }
2780 EOM
2781     if $cc -o try $ccflags $ldflags try.c; then
2782        :
2783     else
2784         if $test X"$despair" = Xyes; then
2785            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2786         fi
2787         $cat >&4 <<EOM
2788 You need to find a working C compiler.
2789 Either (purchase and) install the C compiler supplied by your OS vendor,
2790 or for a free C compiler try http://gcc.gnu.org/
2791 I cannot continue any further, aborting.
2792 EOM
2793         exit 1
2794     fi
2795     $rm -f try try.*
2796     ;;
2797 esac
2798 EOSC
2799
2800 : determine whether symbolic links are supported
2801 echo " "
2802 $touch blurfl
2803 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2804         echo "Symbolic links are supported." >&4
2805         lns="$ln -s"
2806 else
2807         echo "Symbolic links are NOT supported." >&4
2808         lns="$ln"
2809 fi
2810 $rm -f blurfl sym
2811
2812 : determine whether symbolic links are supported
2813 echo " "
2814 case "$lns" in
2815 *"ln"*" -s")
2816         echo "Checking how to test for symbolic links..." >&4
2817         $lns blurfl sym
2818         if $test "X$issymlink" = X; then
2819                 case "$newsh" in
2820                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2821                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2822                 esac
2823                 if test $? = 0; then
2824                         issymlink="test -h"
2825                 else
2826                         echo "Your builtin 'test -h' may be broken." >&4
2827                         case "$test" in
2828                         /*)     ;;
2829                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2830                                 for p in $pth
2831                                 do
2832                                         if test -f "$p/$test"; then
2833                                                 test="$p/$test"
2834                                                 break
2835                                         fi
2836                                 done
2837                                 ;;
2838                         esac
2839                         case "$test" in
2840                         /*)
2841                                 echo "Trying external '$test -h'." >&4
2842                                 issymlink="$test -h"
2843                                 if $test ! -h sym >/dev/null 2>&1; then
2844                                         echo "External '$test -h' is broken, too." >&4
2845                                         issymlink=''
2846                                 fi
2847                                 ;;
2848                         *)      issymlink='' ;;
2849                         esac
2850                 fi
2851         fi
2852         if $test "X$issymlink" = X; then
2853                 if $test -L sym 2>/dev/null; then
2854                         issymlink="$test -L"
2855                         echo "The builtin '$test -L' worked." >&4
2856                 fi
2857         fi
2858         if $test "X$issymlink" != X; then
2859                 echo "You can test for symbolic links with '$issymlink'." >&4
2860         else
2861                 echo "I do not know how you can test for symbolic links." >&4
2862         fi
2863         $rm -f blurfl sym
2864         ;;
2865 *)      echo "No symbolic links, so not testing for their testing..." >&4
2866         ;;
2867 esac
2868 echo " "
2869
2870 : Make symlinks util
2871 case "$mksymlinks" in
2872 $define|true|[yY]*)
2873         case "$src" in
2874         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2875                 exit 1
2876                 ;;
2877         *)      case "$lns:$issymlink" in
2878                 *"ln"*" -s:"*"test -"?)
2879                         echo "Creating the symbolic links..." >&4
2880                         cd ..
2881                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2882                         awk 'NF == 1 {
2883                                 dir=".";
2884                                 file=$1 "";
2885                              }
2886                              NF == 2 {
2887                                 dir=$1 "";
2888                                 file=$2 "";
2889                              }
2890                              {
2891                                  print "# dir = ", dir, "file = ", file
2892                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2893                              } END {
2894                                  for (d in mf) {
2895                                      if (d != ".") { print("mkdir -p "d) }
2896                                      print("ln -sf "mf[d]" "d);
2897                                  }
2898                              }' source="$src" > UU/mksymlinks.$$
2899                         sh UU/mksymlinks.$$
2900                         rm UU/mksymlinks.$$
2901                         # Sanity check 1.
2902                         if test ! -d t/base; then
2903                                 echo "Failed to create the subdirectories.  Aborting." >&4
2904                                 exit 1
2905                         fi
2906                         # Sanity check 2.
2907                         if test ! -f t/base/lex.t; then
2908                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2909                                 exit 1
2910                         fi
2911                         if test ! -f win32/win32.c; then
2912                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2913                                 exit 1
2914                         fi
2915                         cd UU
2916                         ;;
2917                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2918                         ;;
2919                 esac
2920                 ;;
2921         esac
2922         ;;
2923 esac
2924
2925 : Check for Cross-Compilation
2926 if $test "X$targethost" = "X"; then
2927     targethost=""
2928 fi
2929 if $test "X$targetenv" = "X"; then
2930     targetenv=""
2931 fi
2932 case "$usecrosscompile" in
2933 $define|true|[yY]*)
2934         $echo "Cross-compiling..."
2935         croak=''
2936         case "$cc" in
2937         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2938             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2939             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2940             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2941             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2942             # leave out ld, choosing it is more complex
2943             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2944             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2945             # We are in a weird spot. Just before us, some values
2946             # were 'saved', to be restored after the hints are
2947             # run.  This means that the changes we made to ar,
2948             # nm and ranlib will get reverted.
2949             # To avoid that, we hijack the saving mechanism and
2950             # have it save our new values.
2951             for file in ar nm ranlib; do
2952                 eval xxx=\$$file
2953                 eval $file=$xxx$_exe
2954                 eval _$file=$xxx
2955             done
2956         ;;
2957         esac
2958         case "$targetarch" in
2959         '') echo "Targetarch not defined." >&4; croak=y ;;
2960         *)  echo "Using targetarch $targetarch." >&4 ;;
2961         esac
2962         case "$targethost" in
2963         '') echo "Targethost not defined." >&4; croak=y ;;
2964         *)  echo "Using targethost $targethost." >&4
2965         esac
2966         locincpth=' '
2967         loclibpth=' '
2968         case "$croak" in
2969         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2970         esac
2971     : compile a host miniperl and generate_uudmap, unless we got passed them
2972     if $test "X$hostperl" = X; then
2973       echo "Building host miniperl and generate_uudmap binaries" >&4
2974       before_host=`pwd`
2975       cd ..
2976       cd $src
2977       src=`pwd`
2978       rm -rf $src/host
2979       mkdir $src/host
2980       cd $src/host
2981       $src/Configure -des -Dusedevel -Dmksymlinks
2982       $make miniperl
2983       case "$hostgenerate" in
2984       '') $make generate_uudmap
2985           hostgenerate=$src/host/generate_uudmap
2986           ;;
2987        "$undef") hostgenerate=''
2988           ;;
2989       esac
2990       hostperl=$src/host/miniperl
2991       cd $before_host
2992     fi
2993     hostosname=`$hostperl -le 'print $^O'`
2994     ;;
2995 *)
2996     usecrosscompile="$undef"
2997     ;;
2998 esac
2999
3000 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3001 case "$targethost" in
3002     '') echo "Checking for cross-compile" >&4
3003     case "$usecrosscompile$multiarch" in
3004        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3005          if [ -f Makefile ]; then
3006            echo " "
3007            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3008          else
3009            echo "Configure done."
3010          fi
3011        exit 0
3012        ;;
3013      *) echo "No targethost for running compiler tests against defined, running locally" >&4
3014         run=''
3015         to=:
3016         from=:
3017         ;;
3018     esac
3019     ;;
3020     *) echo "Using targethost $targethost." >&4
3021         case "$src" in
3022         /*) run=$src/Cross/run
3023             targetmkdir=$src/Cross/mkdir
3024             to=$src/Cross/to
3025             from=$src/Cross/from
3026             ;;
3027         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3028             run=$pwd/Cross/run
3029             targetmkdir=$pwd/Cross/mkdir
3030             to=$pwd/Cross/to
3031             from=$pwd/Cross/from
3032             ;;
3033         esac
3034         case "$targetrun" in
3035         '') targetrun=ssh ;;
3036         esac
3037         case "$targetto" in
3038         '') targetto=scp ;;
3039         esac
3040         case "$targetfrom" in
3041         '') targetfrom=scp ;;
3042         esac
3043         run=$run-$targetrun
3044         to=$to-$targetto
3045         from=$from-$targetfrom
3046         case "$targetdir" in
3047         '')  targetdir=/tmp
3048              echo "Guessing targetdir $targetdir." >&4
3049              ;;
3050         esac
3051         case "$targetuser" in
3052         '')  targetuser=root
3053              echo "Guessing targetuser $targetuser." >&4
3054              ;;
3055         esac
3056         case "$targetport" in
3057         '')  targetport=22
3058              echo "Guessing targetport $targetport." >&4
3059              ;;
3060         esac
3061         case "$targetfrom" in
3062         scp)    q=-q ;;
3063         *)      q='' ;;
3064         esac
3065         case "$targetrun" in
3066         ssh|rsh)
3067             cat >$run <<EOF
3068 #!/bin/sh
3069 env=''
3070 case "\$1" in
3071 -cwd)
3072   shift
3073   cwd=\$1
3074   shift
3075   ;;
3076 esac
3077 case "\$1" in
3078 -env)
3079   shift
3080   env=\$1
3081   shift
3082   ;;
3083 esac
3084 case "\$cwd" in
3085 '') cwd=$targetdir ;;
3086 esac
3087 exe=\$1
3088 shift
3089 $to \$exe
3090 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3091 EOF
3092             ;;
3093         adb)
3094             $touch $run
3095             ;;
3096         *)  echo "Unknown targetrun '$targetrun'" >&4
3097             exit 1
3098             ;;
3099         esac
3100         case "$targetmkdir" in
3101         */Cross/mkdir)
3102             cat >$targetmkdir <<EOF
3103 #!/bin/sh
3104 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3105 EOF
3106             $chmod a+rx $targetmkdir
3107             ;;
3108         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3109             exit 1
3110             ;;
3111         esac
3112         case "$targetto" in
3113         scp|rcp)
3114             cat >$to <<EOF
3115 #!/bin/sh
3116 for f in \$@
3117 do
3118   case "\$f" in
3119   /*)
3120     $targetmkdir \`dirname \$f\`
3121     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3122     ;;
3123   *)
3124     $targetmkdir $targetdir/\`dirname \$f\`
3125     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3126     ;;
3127   esac
3128 done
3129 exit 0
3130 EOF
3131             ;;
3132         cp) cat >$to <<EOF
3133 #!/bin/sh
3134 for f in \$@
3135 do
3136   case "\$f" in
3137   /*)
3138     $mkdir -p $targetdir/\`dirname \$f\`
3139     $cp \$f $targetdir/\$f || exit 1
3140     ;;
3141   *)
3142     $targetmkdir $targetdir/\`dirname \$f\`
3143     $cp \$f $targetdir/\$f || exit 1
3144     ;;
3145   esac
3146 done
3147 exit 0
3148 EOF
3149             ;;
3150         *)  echo "Unknown targetto '$targetto'" >&4
3151             exit 1
3152             ;;
3153         esac
3154         case "$targetfrom" in
3155         scp|rcp)
3156           cat >$from <<EOF
3157 #!/bin/sh
3158 for f in \$@
3159 do
3160   $rm -f \$f
3161   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3162 done
3163 exit 0
3164 EOF
3165             ;;
3166         cp) cat >$from <<EOF
3167 #!/bin/sh
3168 for f in \$@
3169 do
3170   $rm -f \$f
3171   cp $targetdir/\$f . || exit 1
3172 done
3173 exit 0
3174 EOF
3175             ;;
3176         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3177             exit 1
3178             ;;
3179         esac
3180         if $test ! -f $run; then
3181             echo "Target 'run' script '$run' not found." >&4
3182         else
3183             $chmod a+rx $run
3184         fi
3185         if $test ! -f $to; then
3186             echo "Target 'to' script '$to' not found." >&4
3187         else
3188             $chmod a+rx $to
3189         fi
3190         if $test ! -f $from; then
3191             echo "Target 'from' script '$from' not found." >&4
3192         else
3193             $chmod a+rx $from
3194         fi
3195         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3196             exit 1
3197         fi
3198         cat >&4 <<EOF
3199 Using '$run' for remote execution,
3200 and '$from' and '$to'
3201 for remote file transfer.
3202 EOF
3203         ;;
3204 *)      run=''
3205         to=:
3206         from=:
3207         usecrosscompile="$undef"
3208         targetarch=''
3209         ;;
3210 esac
3211
3212 : see whether [:lower:] and [:upper:] are supported character classes
3213 echo " "
3214 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3215 ABYZ-abyz)
3216         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3217         up='[:upper:]'
3218         low='[:lower:]'
3219         ;;
3220 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3221         # (0xd9 and 0xe2), therefore that is a nice testing point.
3222         if test "X$up" = X -o "X$low" = X; then
3223             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3224             rs) up='[A-Z]'
3225                 low='[a-z]'
3226                 ;;
3227             esac
3228         fi
3229         if test "X$up" = X -o "X$low" = X; then
3230             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3231             rs) up='A-Z'
3232                 low='a-z'
3233                 ;;
3234             esac
3235         fi
3236         if test "X$up" = X -o "X$low" = X; then
3237             case "`echo RS | od -x 2>/dev/null`" in
3238             *D9E2*|*d9e2*)
3239                 echo "Hey, this might be EBCDIC." >&4
3240                 if test "X$up" = X -o "X$low" = X; then
3241                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3242                     rs) up='[A-IJ-RS-Z]'
3243                         low='[a-ij-rs-z]'
3244                         ;;
3245                     esac
3246                 fi
3247                 if test "X$up" = X -o "X$low" = X; then
3248                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3249                     rs) up='A-IJ-RS-Z'
3250                         low='a-ij-rs-z'
3251                         ;;
3252                     esac
3253                 fi
3254                 ;;
3255             esac
3256         fi
3257 esac
3258 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3259 rs)
3260     echo "Using $up and $low to convert case." >&4
3261     ;;
3262 *)
3263     echo "I don't know how to translate letters from upper to lower case." >&4
3264     echo "Your tr is not acting any way I know of." >&4
3265     exit 1
3266     ;;
3267 esac
3268 : set up the translation script tr, must be called with ./tr of course
3269 cat >tr <<EOSC
3270 $startsh
3271 case "\$1\$2" in
3272 '[A-Z][a-z]') exec $tr '$up' '$low';;
3273 '[a-z][A-Z]') exec $tr '$low' '$up';;
3274 esac
3275 exec $tr "\$@"
3276 EOSC
3277 chmod +x tr
3278 $eunicefix tr
3279
3280 : Try to determine whether config.sh was made on this system
3281 case "$config_sh" in
3282 '')
3283 myuname=`$uname -a 2>/dev/null`
3284 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3285 # Downcase everything to avoid ambiguity.
3286 # Remove slashes and single quotes so we can use parts of this in
3287 # directory and file names.
3288 # Remove newlines so myuname is sane to use elsewhere.
3289 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3290 # because the A-Z/a-z are not consecutive.
3291 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3292         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3293 newmyuname="$myuname"
3294 dflt=n
3295 case "$knowitall" in
3296 '')
3297         if test -f ../config.sh; then
3298                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3299                         eval "`grep myuname= ../config.sh`"
3300                 fi
3301                 if test "X$myuname" = "X$newmyuname"; then
3302                         dflt=y
3303                 fi
3304         fi
3305         ;;
3306 *) dflt=y;;
3307 esac
3308
3309 : Get old answers from old config file if Configure was run on the
3310 : same system, otherwise use the hints.
3311 hint=default
3312 cd ..
3313 if test -f config.sh; then
3314         echo " "
3315         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3316         . UU/myread
3317         case "$ans" in
3318         n*|N*) echo "OK, I'll ignore it."
3319                 mv config.sh config.sh.old
3320                 myuname="$newmyuname"
3321                 ;;
3322         *)  echo "Fetching default answers from your old config.sh file..." >&4
3323                 tmp_n="$n"
3324                 tmp_c="$c"
3325                 tmp_sh="$sh"
3326                 . ./config.sh
3327                 cp config.sh UU
3328                 n="$tmp_n"
3329                 c="$tmp_c"
3330                 : Older versions did not always set $sh.  Catch re-use of such
3331                 : an old config.sh.
3332                 case "$sh" in
3333                 '') sh="$tmp_sh" ;;
3334                 esac
3335                 hint=previous
3336                 ;;
3337         esac
3338 fi
3339 . ./UU/checkcc
3340 if test ! -f config.sh; then
3341         $cat <<EOM
3342
3343 First time through, eh?  I have some defaults handy for some systems
3344 that need some extra help getting the Configure answers right:
3345
3346 EOM
3347         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3348         dflt=''
3349         : Half the following guesses are probably wrong... If you have better
3350         : tests or hints, please send them to perlbug@perl.org
3351         : The metaconfig authors would also appreciate a copy...
3352         $test -f /irix && osname=irix
3353         $test -f /xenix && osname=sco_xenix
3354         $test -f /dynix && osname=dynix
3355         $test -f /dnix && osname=dnix
3356         $test -f /lynx.os && osname=lynxos
3357         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3358         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3359         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3360         $test -f /bin/mips && /bin/mips && osname=mips
3361         $test -d /usr/apollo/bin && osname=apollo
3362         $test -f /etc/saf/_sactab && osname=svr4
3363         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3364         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3365         $test -f /sys/utilities/MultiView && osname=amigaos
3366         if $test -d /MachTen -o -d /MachTen_Folder; then
3367                 osname=machten
3368                 if $test -x /sbin/version; then
3369                         osvers=`/sbin/version | $awk '{print $2}' |
3370                         $sed -e 's/[A-Za-z]$//'`
3371                 elif $test -x /usr/etc/version; then
3372                         osvers=`/usr/etc/version | $awk '{print $2}' |
3373                         $sed -e 's/[A-Za-z]$//'`
3374                 else
3375                         osvers="$2.$3"
3376                 fi
3377         fi
3378
3379         $test -f /sys/posix.dll &&
3380                 $test -f /usr/bin/what &&
3381                 set X `/usr/bin/what /sys/posix.dll` &&
3382                 $test "$3" = UWIN &&
3383                 osname=uwin &&
3384                 osvers="$5"
3385
3386         if $test -f $uname; then
3387                 set X $myuname
3388                 shift
3389
3390                 case "$5" in
3391                 fps*) osname=fps ;;
3392                 mips*)
3393                         case "$4" in
3394                         umips) osname=umips ;;
3395                         *) osname=mips ;;
3396                         esac;;
3397                 [23]100) osname=mips ;;
3398                 i386*)
3399                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3400                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3401                                 osname='sco'
3402                                 osvers=$tmp
3403                         elif $test -f /etc/kconfig; then
3404                                 osname=isc
3405                                 if test "$lns" = "$ln -s"; then
3406                                         osvers=4
3407                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3408                                         osvers=3
3409                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3410                                         osvers=2
3411                                 fi
3412                         fi
3413                         tmp=''
3414                         ;;
3415                 pc*)
3416                         if test -n "$DJGPP"; then
3417                                 osname=dos
3418                                 osvers=djgpp
3419                         fi
3420                         ;;
3421                 esac
3422
3423                 case "$1" in
3424                 aix) osname=aix
3425                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3426                         case "$tmp" in
3427                         # oslevel can fail with:
3428                         # oslevel: Unable to acquire lock.
3429                         *not\ found) osvers="$4"."$3" ;;
3430                         '<3240'|'<>3240') osvers=3.2.0 ;;
3431                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3432                         '=3250'|'>3250') osvers=3.2.5 ;;
3433                         *) osvers=$tmp;;
3434                         esac
3435                         ;;
3436                 bitrig) osname=bitrig
3437                         osvers="$3"
3438                         ;;
3439                 bsd386) osname=bsd386
3440                         osvers=`$uname -r`
3441                         ;;
3442                 cygwin*) osname=cygwin
3443                         osvers="$3"
3444                         ;;
3445                 *dc.osx) osname=dcosx
3446                         osvers="$3"
3447                         ;;
3448                 dnix) osname=dnix
3449                         osvers="$3"
3450                         ;;
3451                 domainos) osname=apollo
3452                         osvers="$3"
3453                         ;;
3454                 dgux)   osname=dgux
3455                         osvers="$3"
3456                         ;;
3457                 dragonfly) osname=dragonfly
3458                         osvers="$3"
3459                         ;;
3460                 dynixptx*) osname=dynixptx
3461                         osvers=`echo "$4"|sed 's/^v//'`
3462                         ;;
3463                 freebsd) osname=freebsd
3464                         osvers="$3" ;;
3465                 genix)  osname=genix ;;
3466                 gnu)    osname=gnu
3467                         osvers="$3" ;;
3468                 hp*)    osname=hpux
3469                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3470                         ;;
3471                 irix*)  osname=irix
3472                         case "$3" in
3473                         4*) osvers=4 ;;
3474                         5*) osvers=5 ;;
3475                         *)      osvers="$3" ;;
3476                         esac
3477                         ;;
3478                 linux)  osname=linux
3479                         case "$3" in
3480                         *)      osvers="$3" ;;
3481                         esac
3482                         $test -f /system/lib/libandroid.so && osname=linux-android
3483                         ;;
3484                 MiNT)   osname=mint
3485                         ;;
3486                 netbsd*) osname=netbsd
3487                         osvers="$3"
3488                         ;;
3489                 news-os) osvers="$3"
3490                         case "$3" in
3491                         4*) osname=newsos4 ;;
3492                         *) osname=newsos ;;
3493                         esac
3494                         ;;
3495                 nonstop-ux) osname=nonstopux ;;
3496                 openbsd) osname=openbsd
3497                         osvers="$3"
3498                         ;;
3499                 os2)    osname=os2
3500                         osvers="$4"
3501                         ;;
3502                 POSIX-BC | posix-bc ) osname=posix-bc
3503                         osvers="$3"
3504                         ;;
3505                 powerux | power_ux | powermax_os | powermaxos | \
3506                 powerunix | power_unix) osname=powerux
3507                         osvers="$3"
3508                         ;;
3509                 qnx) osname=qnx
3510                         osvers="$4"
3511                         ;;
3512                 solaris) osname=solaris
3513                         case "$3" in
3514                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3515                         *)      osvers="$3" ;;
3516                         esac
3517                         ;;
3518                 sunos) osname=sunos
3519                         case "$3" in
3520                         5*) osname=solaris
3521                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3522                         *)      osvers="$3" ;;
3523                         esac
3524                         ;;
3525                 titanos) osname=titanos
3526                         case "$3" in
3527                         1*) osvers=1 ;;
3528                         2*) osvers=2 ;;
3529                         3*) osvers=3 ;;
3530                         4*) osvers=4 ;;
3531                         *)      osvers="$3" ;;
3532                         esac
3533                         ;;
3534                 ultrix) osname=ultrix
3535                         osvers="$3"
3536                         ;;
3537                 osf1|mls+)      case "$5" in
3538                                 alpha)
3539                                         osname=dec_osf
3540                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3541                                         case "$osvers" in
3542                                         [1-9].[0-9]*) ;;
3543                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3544                                         esac
3545                                         ;;
3546                         hp*)    osname=hp_osf1  ;;
3547                         mips)   osname=mips_osf1 ;;
3548                         esac
3549                         ;;
3550                 # UnixWare 7.1.2 is known as Open UNIX 8
3551                 openunix|unixware) osname=svr5
3552                         osvers="$4"
3553                         ;;
3554                 uts)    osname=uts
3555                         osvers="$3"
3556                         ;;
3557                 vos) osvers="$3"
3558                         ;;
3559                 $2) case "$osname" in
3560                         *isc*) ;;
3561                         *freebsd*) ;;
3562                         svr*)
3563                                 : svr4.x or possibly later
3564                                 case "svr$3" in
3565                                 ${osname}*)
3566                                         osname=svr$3
3567                                         osvers=$4
3568                                         ;;
3569                                 esac
3570                                 case "$osname" in
3571                                 svr4.0)
3572                                         : Check for ESIX
3573                                         if test -f /stand/boot ; then
3574                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3575                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3576                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3577                                                         if test -n "$isesix"; then
3578                                                                 osname=esix4
3579                                                         fi
3580                                                 fi
3581                                         fi
3582                                         ;;
3583                                 esac
3584                                 ;;
3585                         *)      if test -f /etc/systemid; then
3586                                         osname=sco
3587                                         set `echo $3 | $sed 's/\./ /g'` $4
3588                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3589                                                 osvers=$1.$2.$3
3590                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3591                                                 osvers=$1.$2
3592                                         elif $test -f $src/hints/sco_$1.sh; then
3593                                                 osvers=$1
3594                                         fi
3595                                 else
3596                                         case "$osname" in
3597                                         '') : Still unknown.  Probably a generic Sys V.
3598                                                 osname="sysv"
3599                                                 osvers="$3"
3600                                                 ;;
3601                                         esac
3602                                 fi
3603                                 ;;
3604                         esac
3605                         ;;
3606                 *)      case "$osname" in
3607                         '') : Still unknown.  Probably a generic BSD.
3608                                 osname="$1"
3609                                 osvers="$3"
3610                                 ;;
3611                         esac
3612                         ;;
3613                 esac
3614         else
3615                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3616                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3617                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3618                                 osname=news_os
3619                         fi
3620                         $rm -f UU/kernel.what
3621                 elif test -d c:/. -o -n "$is_os2" ; then
3622                         set X $myuname
3623                         osname=os2
3624                         osvers="$5"
3625                 fi
3626         fi
3627
3628         case "$targetarch" in
3629         '') ;;
3630         *)  hostarch=$osname
3631             case "$targetarch" in
3632                 nto*|*-nto-*)
3633                     # Will load qnx.sh, which should change osname to nto
3634                     osname=qnx
3635                     osvers=''
3636                     ;;
3637                 *linux-android*)
3638                     # Catch arm-linux-androideabi, mipsel-linux-android,
3639                     # and i686-linux-android
3640                     osname=linux-android
3641                     osvers=''
3642                     ;;
3643                 *linux*)
3644                     # Something like arm-linux-gnueabihf is really just
3645                     # plain linux.
3646                     osname=linux
3647                     osvers=''
3648                     ;;
3649                 *solaris*|*sunos*)
3650                     osname=solaris
3651                     # XXX perhaps we should just assume
3652                     # osvers to be 2, or maybe take the value
3653                     # from targetarch. Using $run before the
3654                     # hints are run is somewhat icky.
3655                     set X `$run $uname -a 2>/dev/null`
3656                     shift
3657                     case "$3" in
3658                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3659                         *)  osvers="$3" ;;
3660                     esac
3661                     ;;
3662                 *)
3663                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3664                     osvers=''
3665                 ;;
3666             esac
3667             ;;
3668         esac
3669
3670         : Now look for a hint file osname_osvers, unless one has been
3671         : specified already.
3672         case "$hintfile" in
3673         ''|' ')
3674                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3675                 : Also try without trailing minor version numbers.
3676                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3677                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3678                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3679                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3680                 case "$file" in
3681                 '') dflt=none ;;
3682                 *)  case "$osvers" in
3683                         '') dflt=$file
3684                                 ;;
3685                         *)  if $test -f $src/hints/$file.sh ; then
3686                                         dflt=$file
3687                                 elif $test -f $src/hints/$xfile.sh ; then
3688                                         dflt=$xfile
3689                                 elif $test -f $src/hints/$xxfile.sh ; then
3690                                         dflt=$xxfile
3691                                 elif $test -f $src/hints/$xxxfile.sh ; then
3692                                         dflt=$xxxfile
3693                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3694                                         dflt=$xxxxfile
3695                                 elif $test -f "$src/hints/${osname}.sh" ; then
3696                                         dflt="${osname}"
3697                                 else
3698                                         dflt=none
3699                                 fi
3700                                 ;;
3701                         esac
3702                         ;;
3703                 esac
3704                 if $test -f Policy.sh ; then
3705                         case "$dflt" in
3706                         *Policy*) ;;
3707                         none) dflt="Policy" ;;
3708                         *) dflt="Policy $dflt" ;;
3709                         esac
3710                 fi
3711                 ;;
3712         *)
3713                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3714                 ;;
3715         esac
3716
3717         if $test -f Policy.sh ; then
3718                 $cat <<EOM
3719
3720 There's also a Policy hint file available, which should make the
3721 site-specific (policy) questions easier to answer.
3722 EOM
3723
3724         fi
3725
3726         $cat <<EOM
3727
3728 You may give one or more space-separated answers, or "none" if appropriate.
3729 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3730 previous run of Configure, you may specify it as well as or instead of
3731 OS-specific hints.  If hints are provided for your OS, you should use them:
3732 although Perl can probably be built without hints on many platforms, using
3733 hints often improve performance and may enable features that Configure can't
3734 set up on its own. If there are no hints that match your OS, specify "none";
3735 DO NOT give a wrong version or a wrong OS.
3736
3737 EOM
3738
3739         rp="Which of these apply, if any?"
3740         . UU/myread
3741         tans=$ans
3742         for file in $tans; do
3743                 if $test X$file = XPolicy -a -f Policy.sh; then
3744                         . Policy.sh
3745                         $cat Policy.sh >> UU/config.sh
3746                 elif $test -f $src/hints/$file.sh; then
3747                         . $src/hints/$file.sh
3748                         $cat $src/hints/$file.sh >> UU/config.sh
3749                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3750                         : nothing
3751                 else
3752                         : Give one chance to correct a possible typo.
3753                         echo "$file.sh does not exist"
3754                         dflt=$file
3755                         rp="hint to use instead?"
3756                         . UU/myread
3757                         for file in $ans; do
3758                                 if $test -f "$src/hints/$file.sh"; then
3759                                         . $src/hints/$file.sh
3760                                         $cat $src/hints/$file.sh >> UU/config.sh
3761                                 elif $test X$ans = X -o X$ans = Xnone ; then
3762                                         : nothing
3763                                 else
3764                                         echo "$file.sh does not exist -- ignored."
3765                                 fi
3766                         done
3767                 fi
3768         done
3769
3770         hint=recommended
3771         : Remember our hint file for later.
3772         if $test -f "$src/hints/$file.sh" ; then
3773                 hintfile="$file"
3774         else
3775                 hintfile=''
3776         fi
3777 fi
3778 cd UU
3779 ;;
3780 *)
3781         echo " "
3782         echo "Fetching default answers from $config_sh..." >&4
3783         tmp_n="$n"
3784         tmp_c="$c"
3785         cd ..
3786         cp $config_sh config.sh 2>/dev/null
3787         chmod +w config.sh
3788         . ./config.sh
3789         cd UU
3790         cp ../config.sh .
3791         n="$tmp_n"
3792         c="$tmp_c"
3793         hint=previous
3794         ;;
3795 esac
3796 test "$override" && . ./optdef.sh
3797
3798 : Restore computed paths
3799 for file in $loclist $trylist; do
3800         eval $file="\$_$file"
3801 done
3802
3803 cat << EOM
3804
3805 Configure uses the operating system name and version to set some defaults.
3806 The default value is probably right if the name rings a bell. Otherwise,
3807 since spelling matters for me, either accept the default or answer "none"
3808 to leave it blank.
3809
3810 EOM
3811 case "$osname" in
3812         ''|' ')
3813                 case "$hintfile" in
3814                 ''|' '|none) dflt=none ;;
3815                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3816                 esac
3817                 ;;
3818         *) dflt="$osname" ;;
3819 esac
3820 rp="Operating system name?"
3821 . ./myread
3822 case "$ans" in
3823 none)  osname='' ;;
3824 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3825 esac
3826 echo " "
3827 case "$osvers" in
3828         ''|' ')
3829                 case "$hintfile" in
3830                 ''|' '|none) dflt=none ;;
3831                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3832                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3833                         case "$dflt" in
3834                         ''|' ') dflt=none ;;
3835                         esac
3836                         ;;
3837                 esac
3838                 ;;
3839         *) dflt="$osvers" ;;
3840 esac
3841 rp="Operating system version?"
3842 . ./myread
3843 case "$ans" in
3844 none)  osvers='' ;;
3845 *) osvers="$ans" ;;
3846 esac
3847
3848
3849 . ./posthint.sh
3850
3851 : who configured the system
3852 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3853 case "$cf_by" in
3854 "")
3855         cf_by=`(logname) 2>/dev/null`
3856         case "$cf_by" in
3857         "")
3858                 cf_by=`(whoami) 2>/dev/null`
3859                 case "$cf_by" in
3860                 "") cf_by=unknown ;;
3861                 esac ;;
3862         esac ;;
3863 esac
3864
3865 : decide how portable to be.  Allow command line overrides.
3866 case "$d_portable" in
3867 "$undef") ;;
3868 *)      d_portable="$define" ;;
3869 esac
3870
3871 : set up shell script to do ~ expansion
3872 cat >filexp <<EOSS
3873 $startsh
3874 : expand filename
3875 case "\$1" in
3876  \~/*|\~)
3877         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3878         ;;
3879  \~*)
3880         if $test -f /bin/csh; then
3881                 /bin/csh -f -c "glob \$1"
3882                 failed=\$?
3883                 echo ""
3884                 exit \$failed
3885         else
3886                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3887                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3888                 if $test ! -d "\$dir"; then
3889                         me=\`basename \$0\`
3890                         echo "\$me: can't locate home directory for: \$name" >&2
3891                         exit 1
3892                 fi
3893                 case "\$1" in
3894                 */*)
3895                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3896                         ;;
3897                 *)
3898                         echo \$dir
3899                         ;;
3900                 esac
3901         fi
3902         ;;
3903 *)
3904         echo \$1
3905         ;;
3906 esac
3907 EOSS
3908 chmod +x filexp
3909 $eunicefix filexp
3910
3911 : now set up to get a file name
3912 cat <<EOS >getfile
3913 $startsh
3914 EOS
3915 cat <<'EOSC' >>getfile
3916 tilde=''
3917 fullpath=''
3918 already=''
3919 skip=''
3920 none_ok=''
3921 exp_file=''
3922 nopath_ok=''
3923 orig_rp="$rp"
3924 orig_dflt="$dflt"
3925 case "$gfpth" in
3926 '') gfpth='.' ;;
3927 esac
3928
3929 case "$fn" in
3930 *\(*)
3931         : getfile will accept an answer from the comma-separated list
3932         : enclosed in parentheses even if it does not meet other criteria.
3933         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3934         fn=`echo $fn | sed 's/(.*)//'`
3935         ;;
3936 esac
3937
3938 case "$fn" in
3939 *:*)
3940         loc_file=`expr $fn : '.*:\(.*\)'`
3941         fn=`expr $fn : '\(.*\):.*'`
3942         ;;
3943 esac
3944
3945 case "$fn" in
3946 *~*) tilde=true;;
3947 esac
3948 case "$fn" in
3949 */*) fullpath=true;;
3950 esac
3951 case "$fn" in
3952 *+*) skip=true;;
3953 esac
3954 case "$fn" in
3955 *n*) none_ok=true;;
3956 esac
3957 case "$fn" in
3958 *e*) exp_file=true;;
3959 esac
3960 case "$fn" in
3961 *p*) nopath_ok=true;;
3962 esac
3963
3964 case "$fn" in
3965 *f*) type='File';;
3966 *d*) type='Directory';;
3967 *l*) type='Locate';;
3968 esac
3969
3970 what="$type"
3971 case "$what" in
3972 Locate) what='File';;
3973 esac
3974
3975 case "$exp_file" in
3976 '')
3977         case "$d_portable" in
3978         "$define") ;;
3979         *) exp_file=true;;
3980         esac
3981         ;;
3982 esac
3983
3984 cd ..
3985 while test "$type"; do
3986         redo=''
3987         rp="$orig_rp"
3988         dflt="$orig_dflt"
3989         case "$tilde" in
3990         true) rp="$rp (~name ok)";;
3991         esac
3992         . UU/myread
3993         if test -f UU/getfile.ok && \
3994                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3995         then
3996                 value="$ans"
3997                 ansexp="$ans"
3998                 break
3999         fi
4000         case "$ans" in
4001         none)
4002                 value=''
4003                 ansexp=''
4004                 case "$none_ok" in
4005                 true) type='';;
4006                 esac
4007                 ;;
4008         *)
4009                 case "$tilde" in
4010                 '') value="$ans"
4011                         ansexp="$ans";;
4012                 *)
4013                         value=`UU/filexp $ans`
4014                         case $? in
4015                         0)
4016                                 if test "$ans" != "$value"; then
4017                                         echo "(That expands to $value on this system.)"
4018                                 fi
4019                                 ;;
4020                         *) value="$ans";;
4021                         esac
4022                         ansexp="$value"
4023                         case "$exp_file" in
4024                         '') value="$ans";;
4025                         esac
4026                         ;;
4027                 esac
4028                 case "$fullpath" in
4029                 true)
4030                         case "$ansexp" in
4031                         /*) value="$ansexp" ;;
4032                         [a-zA-Z]:/*) value="$ansexp" ;;
4033                         *)
4034                                 redo=true
4035                                 case "$already" in
4036                                 true)
4037                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4038                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4039                                         ;;
4040                                 *)
4041                                 echo "Please give a full path name, starting with slash." >&4
4042                                         case "$tilde" in
4043                                         true)
4044                                 echo "Note that using ~name is ok provided it expands well." >&4
4045                                                 already=true
4046                                                 ;;
4047                                         esac
4048                                 esac
4049                                 ;;
4050                         esac
4051                         ;;
4052                 esac
4053                 case "$redo" in
4054                 '')
4055                         case "$type" in
4056                         File)
4057                                 for fp in $gfpth; do
4058                                         if test "X$fp" = X.; then
4059                                             pf="$ansexp"
4060                                         else    
4061                                             pf="$fp/$ansexp"
4062                                         fi
4063                                         if test -f "$pf"; then
4064                                                 type=''
4065                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4066                                         then
4067                                                 echo "($value is not a plain file, but that's ok.)"
4068                                                 type=''
4069                                         fi
4070                                         if test X"$type" = X; then
4071                                             value="$pf"
4072                                             break
4073                                         fi
4074                                 done
4075                                 ;;
4076                         Directory)
4077                                 for fp in $gfpth; do
4078                                         if test "X$fp" = X.; then
4079                                             dir="$ans"
4080                                             direxp="$ansexp"
4081                                         else    
4082                                             dir="$fp/$ansexp"
4083                                             direxp="$fp/$ansexp"
4084                                         fi
4085                                         if test -d "$direxp"; then
4086                                                 type=''
4087                                                 value="$dir"
4088                                                 break
4089                                         fi
4090                                 done
4091                                 ;;
4092                         Locate)
4093                                 if test -d "$ansexp"; then
4094                                         echo "(Looking for $loc_file in directory $value.)"
4095                                         value="$value/$loc_file"
4096                                         ansexp="$ansexp/$loc_file"
4097                                 fi
4098                                 if test -f "$ansexp"; then
4099                                         type=''
4100                                 fi
4101                                 case "$nopath_ok" in
4102                                 true)   case "$value" in
4103                                         */*) ;;
4104                                         *)      echo "Assuming $value will be in people's path."
4105                                                 type=''
4106                                                 ;;
4107                                         esac
4108                                         ;;
4109                                 esac
4110                                 ;;
4111                         esac
4112
4113                         case "$skip" in
4114                         true) type='';
4115                         esac
4116
4117                         case "$type" in
4118                         '') ;;
4119                         *)
4120                                 if test "$fastread" = yes; then
4121                                         dflt=y
4122                                 else
4123                                         dflt=n
4124                                 fi
4125                                 rp="$what $value doesn't exist.  Use that name anyway?"
4126                                 . UU/myread
4127                                 dflt=''
4128                                 case "$ans" in
4129                                 y*) type='';;
4130                                 *) echo " ";;
4131                                 esac
4132                                 ;;
4133                         esac
4134                         ;;
4135                 esac
4136                 ;;
4137         esac
4138 done
4139 cd UU
4140 ans="$value"
4141 rp="$orig_rp"
4142 dflt="$orig_dflt"
4143 rm -f getfile.ok
4144 test "X$gfpthkeep" != Xy && gfpth=""
4145 EOSC
4146
4147 : determine root of directory hierarchy where package will be installed.
4148 case "$prefix" in
4149 '')
4150         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4151         ;;
4152 *?/)
4153         dflt=`echo "$prefix" | sed 's/.$//'`
4154         ;;
4155 *)
4156         dflt="$prefix"
4157         ;;
4158 esac
4159 $cat <<EOM
4160
4161 By default, $package will be installed in $dflt/bin, manual pages
4162 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4163 installation directories. Typically this is something like /usr/local.
4164 If you wish to have binaries under /usr/bin but other parts of the
4165 installation under /usr/local, that's ok: you will be prompted
4166 separately for each of the installation directories, the prefix being
4167 only used to set the defaults.
4168
4169 EOM
4170 fn=d~
4171 rp='Installation prefix to use?'
4172 . ./getfile
4173 oldprefix=''
4174 case "$prefix" in
4175 '') ;;
4176 *)
4177         case "$ans" in
4178         "$prefix") ;;
4179         *) oldprefix="$prefix";;
4180         esac
4181         ;;
4182 esac
4183 prefix="$ans"
4184 prefixexp="$ansexp"
4185
4186 : allow them to override the AFS root
4187 case "$afsroot" in
4188 '')     afsroot=/afs ;;
4189 *)      afsroot=$afsroot ;;
4190 esac
4191
4192 : is AFS running?
4193 echo " "
4194 case "$afs" in
4195 $define|true)   afs=true ;;
4196 $undef|false)   afs=false ;;
4197 *)      if $test -d $afsroot; then
4198                 afs=true
4199         else
4200                 afs=false
4201         fi
4202         ;;
4203 esac
4204 if $afs; then
4205         echo "AFS may be running... I'll be extra cautious then..." >&4
4206 else
4207         echo "AFS does not seem to be running..." >&4
4208 fi
4209
4210 : determine installation prefix for where package is to be installed.
4211 if $afs; then
4212 $cat <<EOM
4213
4214 Since you are running AFS, I need to distinguish the directory in which
4215 files will reside from the directory in which they are installed (and from
4216 which they are presumably copied to the former directory by occult means).
4217
4218 EOM
4219         case "$installprefix" in
4220         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4221         *) dflt="$installprefix";;
4222         esac
4223 else
4224 $cat <<EOM
4225
4226 In some special cases, particularly when building $package for distribution,
4227 it is convenient to distinguish the directory in which files should be
4228 installed from the directory ($prefix) in which they will
4229 eventually reside.  For most users, these two directories are the same.
4230
4231 EOM
4232         case "$installprefix" in
4233         '') dflt=$prefix ;;
4234         *) dflt=$installprefix;;
4235         esac
4236 fi
4237 fn=d~
4238 rp='What installation prefix should I use for installing files?'
4239 . ./getfile
4240 installprefix="$ans"
4241 installprefixexp="$ansexp"
4242
4243 : Perform the prefixexp/installprefixexp correction if necessary
4244 cat <<EOS >installprefix
4245 $startsh
4246 EOS
4247 cat <<'EOSC' >>installprefix
4248 : Change installation prefix, if necessary.
4249 if $test X"$prefix" != X"$installprefix"; then
4250     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4251 else
4252     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4253 fi
4254 EOSC
4255 chmod +x installprefix
4256 $eunicefix installprefix
4257
4258 : Set variables such as privlib and privlibexp from the output of ./getfile
4259 : performing the prefixexp/installprefixexp correction if necessary.
4260 cat <<EOS >setprefixvar
4261 $startsh
4262 EOS
4263 cat <<'EOSC' >>setprefixvar
4264 eval "${prefixvar}=\"\$ans\""
4265 eval "${prefixvar}exp=\"\$ansexp\""
4266 . ./installprefix
4267 EOSC
4268 chmod +x setprefixvar
4269 $eunicefix setprefixvar
4270
4271 : set up the script used to warn in case of inconsistency
4272 cat <<EOS >whoa
4273 $startsh
4274 EOS
4275 cat <<'EOSC' >>whoa
4276 dflt=y
4277 case "$hint" in
4278     recommended)
4279         case "$hintfile" in
4280         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4281                 ;;
4282         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4283                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4284                 ;;
4285         esac
4286         ;;
4287     *)  echo " "
4288         echo "*** WHOA THERE!!! ***" >&4
4289         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4290         ;;
4291 esac
4292 rp="    Keep the $hint value?"
4293 . ./myread
4294 case "$ans" in
4295 y) td=$was; tu=$was;;
4296 esac
4297 EOSC
4298
4299 : function used to set '$1' to '$val'
4300 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4301 case "$val$was" in
4302 $define$undef) . ./whoa; eval "$var=\$td";;
4303 $undef$define) . ./whoa; eval "$var=\$tu";;
4304 *) eval "$var=$val";;
4305 esac'
4306
4307 : get the patchlevel
4308 echo " "
4309 echo "Getting the current patchlevel..." >&4
4310 if $test -r $rsrc/patchlevel.h;then
4311         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4312         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4313         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4314         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4315         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4316         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4317         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4318 else
4319         revision=0
4320         patchlevel=0
4321         subversion=0
4322         api_revision=0
4323         api_version=0
4324         api_subversion=0
4325         perl_patchlevel=0
4326         $echo "(You do not have patchlevel.h.  Eek.)"
4327 fi
4328 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4329 version_patchlevel_string="version $patchlevel subversion $subversion"
4330 case "$perl_patchlevel" in
4331 0|'') ;;
4332 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4333     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4334     ;;
4335 esac
4336
4337 $echo "(You have $package $version_patchlevel_string.)"
4338
4339 case "$osname" in
4340 dos|vms)
4341         : XXX Should be a Configure test for double-dots in filenames.
4342         version=`echo $revision $patchlevel $subversion | \
4343                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4344         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4345                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4346         ;;
4347 *)
4348         version=`echo $revision $patchlevel $subversion | \
4349                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4350         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4351                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4352         ;;
4353 esac
4354 : Special case the 5.005_xx maintenance series, which used 5.005
4355 : without any subversion label as a subdirectory in $sitelib
4356 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4357         api_versionstring='5.005'
4358 fi
4359
4360 : Do we want threads support and if so, what type
4361 case "$usethreads" in
4362 $define|true|[yY]*)     dflt='y';;
4363 *)     # Catch case where user specified ithreads or 5005threads but
4364        # forgot -Dusethreads (A.D. 4/2002)
4365        case "$useithreads$use5005threads" in
4366        *$define*)       dflt='y';;
4367        *)               dflt='n';;
4368        esac
4369        ;;
4370 esac
4371 cat <<EOM
4372
4373 Perl can be built to offer a form of threading support on some systems
4374 To do so, Configure can be run with -Dusethreads.
4375
4376 Note that Perl built with threading support runs slightly slower
4377 and uses slightly more memory than plain Perl.
4378
4379 If this doesn't make any sense to you, just accept the default '$dflt'.
4380 EOM
4381 rp='Build a threading Perl?'
4382 . ./myread
4383 case "$ans" in
4384 y|Y)    val="$define" ;;
4385 *)      val="$undef" ;;
4386 esac
4387 set usethreads
4388 eval $setvar
4389
4390 if $test $patchlevel -lt 9; then
4391     case "$usethreads" in
4392     $define)
4393         : Default to ithreads unless overridden on command line or with
4394         : old config.sh
4395         dflt='y'
4396         case "$use5005threads" in
4397                 $define|true|[yY]*)
4398                         echo "5.005 threads are no longer supported"
4399                         exit 1
4400                 ;;
4401         esac
4402         case "$useithreads" in
4403                 $undef|false|[nN]*) dflt='n';;
4404         esac
4405         rp='Use the newer interpreter-based ithreads?'
4406         . ./myread
4407         case "$ans" in
4408         y|Y)    val="$define" ;;
4409         *)      val="$undef" ;;
4410         esac
4411         set useithreads
4412         eval $setvar
4413         : Now set use5005threads to the opposite value.
4414         case "$useithreads" in
4415         $define) val="$undef" ;;
4416         *) val="$define" ;;
4417         esac
4418         set use5005threads
4419         eval $setvar
4420         ;;
4421     *)
4422         useithreads="$undef"
4423         use5005threads="$undef"
4424         ;;
4425     esac
4426
4427     case "$useithreads$use5005threads" in
4428     "$define$define")
4429         $cat >&4 <<EOM
4430
4431 You cannot have both the ithreads and the 5.005 threads enabled
4432 at the same time.  Disabling the 5.005 threads since they are
4433 much less stable than the ithreads.
4434
4435 EOM
4436         use5005threads="$undef"
4437         ;;
4438     esac
4439
4440 else
4441 : perl-5.9.x and later
4442
4443     if test X"$usethreads" = "X$define"; then
4444         case "$use5005threads" in
4445             $define|true|[yY]*)
4446                 $cat >&4 <<EOM
4447
4448 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4449
4450 EOM
4451             ;;
4452         esac
4453     fi
4454
4455     use5005threads="$undef"
4456     useithreads="$usethreads"
4457 fi
4458
4459 case "$d_oldpthreads" in
4460 '')     : Configure tests would be welcome here.  For now, assume undef.
4461         val="$undef" ;;
4462 *)      val="$d_oldpthreads" ;;
4463 esac
4464 set d_oldpthreads
4465 eval $setvar
4466
4467
4468 : Look for a hint-file generated 'call-back-unit'.  If the
4469 : user has specified that a threading perl is to be built,
4470 : we may need to set or change some other defaults.
4471 if $test -f usethreads.cbu; then
4472     echo "Your platform has some specific hints regarding threaded builds, using them..."
4473     . ./usethreads.cbu
4474 else
4475     case "$usethreads" in
4476         "$define"|true|[yY]*)
4477                 $cat <<EOM
4478 (Your platform does not have any specific hints for threaded builds.
4479  Assuming POSIX threads, then.)
4480 EOM
4481         ;;
4482     esac
4483 fi
4484
4485 : Check if multiplicity is required
4486 cat <<EOM
4487
4488 Perl can be built so that multiple Perl interpreters can coexist
4489 within the same Perl executable.
4490 EOM
4491
4492 case "$useithreads" in
4493 $define)
4494         cat <<EOM
4495 This multiple interpreter support is required for interpreter-based threads.
4496 EOM
4497         val="$define"
4498         ;;
4499 *)      case "$usemultiplicity" in
4500         $define|true|[yY]*)     dflt='y';;
4501         *) dflt='n';;
4502         esac
4503         echo " "
4504         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4505         rp='Build Perl for multiplicity?'
4506         . ./myread
4507         case "$ans" in
4508         y|Y)    val="$define" ;;
4509         *)      val="$undef" ;;
4510         esac
4511         ;;
4512 esac
4513 set usemultiplicity
4514 eval $setvar
4515
4516 : Check if morebits is requested
4517 case "$usemorebits" in
4518 "$define"|true|[yY]*)
4519         use64bitint="$define"
4520         uselongdouble="$define"
4521         usemorebits="$define"
4522         ;;
4523 *)      usemorebits="$undef"
4524         ;;
4525 esac
4526
4527 : Determine the C compiler to be used
4528 echo " "
4529 case "$cc" in
4530 '') dflt=cc;;
4531 *) dflt="$cc";;
4532 esac
4533 rp="Use which C compiler?"
4534 . ./myread
4535 cc="$ans"
4536
4537 : See whether they have no cc but they do have gcc
4538 . ./trygcc
4539 if $test -f cc.cbu; then
4540     . ./cc.cbu
4541 fi
4542 . ./checkcc
4543
4544 : make some quick guesses about what we are up against
4545 echo " "
4546 $echo $n "Hmm...  $c"
4547 echo exit 1 >bsd
4548 echo exit 1 >usg
4549 echo exit 1 >v7
4550 echo exit 1 >osf1
4551 echo exit 1 >eunice
4552 echo exit 1 >xenix
4553 echo exit 1 >venix
4554 echo exit 1 >os2
4555 d_bsd="$undef"
4556 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4557 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4558 then
4559         echo "Looks kind of like an OSF/1 system, but we'll see..."
4560         echo exit 0 >osf1
4561 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4562         xxx=`./loc addbib blurfl $pth`
4563         if $test -f $xxx; then
4564         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4565                 echo exit 0 >bsd
4566                 echo exit 0 >usg
4567         else
4568                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4569                         echo "Looks kind of like an extended USG system, but we'll see..."
4570                 else
4571                         echo "Looks kind of like a USG system, but we'll see..."
4572                 fi
4573                 echo exit 0 >usg
4574         fi
4575 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4576         echo "Looks kind of like a BSD system, but we'll see..."
4577         d_bsd="$define"
4578         echo exit 0 >bsd
4579 else
4580         echo "Looks kind of like a Version 7 system, but we'll see..."
4581         echo exit 0 >v7
4582 fi
4583 case "$eunicefix" in
4584 *unixtovms*)
4585         $cat <<'EOI'
4586 There is, however, a strange, musty smell in the air that reminds me of
4587 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4588 EOI
4589         echo exit 0 >eunice
4590         d_eunice="$define"
4591 : it so happens the Eunice I know will not run shell scripts in Unix format
4592         ;;
4593 *)
4594         echo " "
4595         echo "Congratulations.  You aren't running Eunice."
4596         d_eunice="$undef"
4597         ;;
4598 esac
4599 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4600 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4601 : semicolon as a patch separator
4602 case "$p_" in
4603 :) ;;
4604 *)
4605         $cat <<'EOI'
4606 I have the feeling something is not exactly right, however...don't tell me...
4607 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4608 (Or you may be running DOS with DJGPP.)
4609 EOI
4610         echo exit 0 >os2
4611         ;;
4612 esac
4613 if test -f /xenix; then
4614         echo "Actually, this looks more like a XENIX system..."
4615         echo exit 0 >xenix
4616         d_xenix="$define"
4617 else
4618         echo " "
4619         echo "It's not Xenix..."
4620         d_xenix="$undef"
4621 fi
4622 chmod +x xenix
4623 $eunicefix xenix
4624 if test -f /venix; then
4625         echo "Actually, this looks more like a VENIX system..."
4626         echo exit 0 >venix
4627 else
4628         echo " "
4629         if ./xenix; then
4630                 : null
4631         else
4632                 echo "Nor is it Venix..."
4633         fi
4634 fi
4635 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4636 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4637 $rm -f foo
4638
4639 : Check if we are using GNU gcc and what its version is
4640 echo " "
4641 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4642 $cat >try.c <<EOM
4643 #include <stdio.h>
4644 int main() {
4645 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4646 #ifdef __VERSION__
4647         printf("%s\n", __VERSION__);
4648 #else
4649         printf("%s\n", "1");
4650 #endif
4651 #endif
4652         return(0);
4653 }
4654 EOM
4655 if $cc -o try $ccflags $ldflags try.c; then
4656         gccversion=`$run ./try`
4657         case "$gccversion" in
4658         '') echo "You are not using GNU cc." ;;
4659         *)  echo "You are using GNU cc $gccversion."
4660             ccname=gcc
4661             ;;
4662         esac
4663 else
4664         echo " "
4665         echo "*** WHOA THERE!!! ***" >&4
4666         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4667         case "$knowitall" in
4668         '')
4669         echo "    You'd better start hunting for one and let me know about it." >&4
4670                 exit 1
4671                 ;;
4672         esac
4673 fi
4674 $rm -f try try.*
4675 case "$gccversion" in
4676 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4677 esac
4678 case "$gccversion" in
4679 '') gccosandvers='' ;;
4680 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4681    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4682    gccshortvers=''
4683    case "$gccosandvers" in
4684    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4685    $osname$osvers) ;; # looking good
4686    $osname*) cat <<EOM >&4
4687
4688 *** WHOA THERE!!! ***
4689
4690     Your gcc has not been compiled for the exact release of
4691     your operating system ($gccosandvers versus $osname$osvers).
4692
4693     In general it is a good idea to keep gcc synchronized with
4694     the operating system because otherwise serious problems
4695     may ensue when trying to compile software, like Perl.
4696
4697     I'm trying to be optimistic here, though, and will continue.
4698     If later during the configuration and build icky compilation
4699     problems appear (headerfile conflicts being the most common
4700     manifestation), I suggest reinstalling the gcc to match
4701     your operating system release.
4702
4703 EOM
4704       ;;
4705    *) gccosandvers='' ;; # failed to parse, better be silent
4706    esac
4707    ;;
4708 esac
4709 case "$ccname" in
4710 '') ccname="$cc" ;;
4711 esac
4712
4713 # gcc 3.* complain about adding -Idirectories that they already know about,
4714 # so we will take those off from locincpth.
4715 case "$gccversion" in
4716 3*)
4717     echo "main(){}">try.c
4718     for incdir in $locincpth; do
4719        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4720              grep '^c[cp]p*[01]: warning: changing search order '`
4721        if test "X$warn" != X; then
4722            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4723        fi
4724     done
4725     $rm -f try try.*
4726 esac
4727
4728 # gcc 4.9 by default does some optimizations that break perl.
4729 # see ticket 121505.
4730 #
4731 # The -fwrapv disables those optimizations (and probably others,) so
4732 # for gcc 4.9 (and later, since the optimizations probably won't go
4733 # away), add -fwrapv unless the user requests -fno-wrapv, which
4734 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4735 # which turns the overflows -fwrapv ignores into runtime errors.
4736 case "$gccversion" in
4737 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4738     case "$ccflags" in
4739     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4740     *) ccflags="$ccflags -fwrapv" ;;
4741     esac
4742 esac
4743
4744 : What should the include directory be ?
4745 : Use sysroot if set, so findhdr looks in the right place.
4746 echo " "
4747 $echo $n "Hmm...  $c"
4748 dflt="$sysroot/usr/include"
4749 incpath=''
4750 mips_type=''
4751 if $test -f /bin/mips && /bin/mips; then
4752         echo "Looks like a MIPS system..."
4753         $cat >usr.c <<'EOCP'
4754 #ifdef SYSTYPE_BSD43
4755 /bsd43
4756 #endif
4757 EOCP
4758         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4759                 dflt='/bsd43/usr/include'
4760                 incpath='/bsd43'
4761                 mips_type='BSD 4.3'
4762         else
4763                 mips_type='System V'
4764         fi
4765         $rm -f usr.c usr.out
4766         echo "and you're compiling with the $mips_type compiler and libraries."
4767         xxx_prompt=y
4768         echo "exit 0" >mips
4769 else
4770         echo "Doesn't look like a MIPS system."
4771         xxx_prompt=n
4772         echo "exit 1" >mips
4773 fi
4774 chmod +x mips
4775 $eunicefix mips
4776 case "$usrinc" in
4777 '') ;;
4778 *) dflt="$usrinc";;
4779 esac
4780 case "$xxx_prompt" in
4781 y)      fn=d/
4782         echo " "
4783         rp='Where are the include files you want to use?'
4784         . ./getfile
4785         usrinc="$ans"
4786         ;;
4787 *)      usrinc="$dflt"
4788         ;;
4789 esac
4790
4791 : see how we invoke the C preprocessor
4792 echo " "
4793 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4794 cat <<'EOT' >testcpp.c
4795 #define ABC abc
4796 #define XYZ xyz
4797 ABC.XYZ
4798 EOT
4799 cd ..
4800 if test ! -f cppstdin; then
4801         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4802                 # AIX cc -E doesn't show the absolute headerfile
4803                 # locations but we'll cheat by using the -M flag.
4804                 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
4805         else
4806                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4807         fi
4808 else
4809         echo "Keeping your $hint cppstdin wrapper."
4810 fi
4811 chmod 755 cppstdin
4812 wrapper=`pwd`/cppstdin
4813 ok='false'
4814 cd UU
4815
4816 if $test "X$cppstdin" != "X" && \
4817         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4818         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4819 then
4820         echo "You used to use $cppstdin $cppminus so we'll use that again."
4821         case "$cpprun" in
4822         '') echo "But let's see if we can live without a wrapper..." ;;
4823         *)
4824                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4825                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4826                 then
4827                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4828                         ok='true'
4829                 else
4830                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4831                 fi
4832                 ;;
4833         esac
4834 else
4835         case "$cppstdin" in
4836         '') ;;
4837         *)
4838                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4839                 ;;
4840         esac
4841 fi
4842
4843 if $ok; then
4844         : nothing
4845 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4846         $cc -E <testcpp.c >testcpp.out 2>&1; \
4847         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4848         echo "Yup, it does."
4849         x_cpp="$cc $cppflags -E"
4850         x_minus='';
4851 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4852         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4853         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4854         echo "Yup, it does."
4855         x_cpp="$cc $cppflags -E"
4856         x_minus='-';
4857 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4858         $cc -P <testcpp.c >testcpp.out 2>&1; \
4859         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4860         echo "Yipee, that works!"
4861         x_cpp="$cc $cppflags -P"
4862         x_minus='';
4863 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4864         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4865         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4866         echo "At long last!"
4867         x_cpp="$cc $cppflags -P"
4868         x_minus='-';
4869 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4870         $cpp <testcpp.c >testcpp.out 2>&1; \
4871         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4872         echo "It works!"
4873         x_cpp="$cpp $cppflags"
4874         x_minus='';
4875 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4876         $cpp - <testcpp.c >testcpp.out 2>&1; \
4877         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4878         echo "Hooray, it works!  I was beginning to wonder."
4879         x_cpp="$cpp $cppflags"
4880         x_minus='-';
4881 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4882         $wrapper <testcpp.c >testcpp.out 2>&1; \
4883         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4884         x_cpp="$wrapper"
4885         x_minus=''
4886         echo "Eureka!"
4887 else
4888         dflt=''
4889         rp="No dice.  I can't find a C preprocessor.  Name one:"
4890         . ./myread
4891         x_cpp="$ans"
4892         x_minus=''
4893         $x_cpp <testcpp.c >testcpp.out 2>&1
4894         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4895                 echo "OK, that will do." >&4
4896         else
4897 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4898                 exit 1
4899         fi
4900 fi
4901
4902 case "$ok" in
4903 false)
4904         cppstdin="$x_cpp"
4905         cppminus="$x_minus"
4906         cpprun="$x_cpp"
4907         cpplast="$x_minus"
4908         set X $x_cpp
4909         shift
4910         case "$1" in
4911         "$cpp")
4912                 echo "Perhaps can we force $cc -E using a wrapper..."
4913                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4914                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4915                 then
4916                         echo "Yup, we can."
4917                         cppstdin="$wrapper"
4918                         cppminus='';
4919                 else
4920                         echo "Nope, we'll have to live without it..."
4921                 fi
4922                 ;;
4923         esac
4924         case "$cpprun" in
4925         "$wrapper")
4926                 cpprun=''
4927                 cpplast=''
4928                 ;;
4929         esac
4930         ;;
4931 esac
4932
4933 case "$cppstdin" in
4934 "$wrapper"|'cppstdin') ;;
4935 *) $rm -f $wrapper;;
4936 esac
4937 $rm -f testcpp.c testcpp.out
4938
4939 : Adjust cppfilter for path component separator
4940 case "$osname" in
4941 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4942 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4943 *)   cppfilter='' ;;
4944 esac
4945
4946 : Use gcc to determine libpth and incpth
4947 # If using gcc or clang, we can get better values for libpth, incpth
4948 # and usrinc directly from the compiler.
4949 # Note that ccname for clang is also gcc.
4950 case "$ccname" in
4951     gcc)
4952         $echo 'extern int foo;' > try.c
4953         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4954         shift
4955         if $test $# -gt 0; then
4956             incpth="$incpth $*"
4957             incpth="`$echo $incpth|$sed 's/^ //'`"
4958             for i in $*; do
4959                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4960                 if $test -d $j; then
4961                     libpth="$libpth $j"
4962                 fi
4963             done
4964             libpth="`$echo $libpth|$sed 's/^ //'`"
4965             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4966                 if $test -d $xxx; then
4967                     case " $libpth " in
4968                     *" $xxx "*) ;;
4969                     *) libpth="$libpth $xxx";;
4970                     esac
4971                 fi
4972             done
4973         fi
4974         $rm -f try.c
4975         case "$usrinc" in
4976         '') for i in $incpth; do
4977                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4978                     usrinc="$i"
4979                     break
4980                 fi
4981             done
4982             ;;
4983         esac
4984
4985         case "$usecrosscompile" in
4986         $define|true|[yY]*)
4987             case "$incpth" in
4988                 '') echo "Incpth not defined." >&4; croak=y ;;
4989                 *)  echo "Using incpth '$incpth'." >&4 ;;
4990             esac
4991             case "$libpth" in
4992                 '') echo "Libpth not defined." >&4; croak=y ;;
4993                 *)  echo "Using libpth '$libpth'." >&4 ;;
4994             esac
4995             case "$usrinc" in
4996                 '') echo "Usrinc not defined." >&4; croak=y ;;
4997                 *)  echo "Using usrinc $usrinc." >&4 ;;
4998             esac
4999             case "$croak" in
5000                 y)
5001                 if test "X$sysroot" = X; then
5002                     echo "Cannot continue, aborting." >&4; exit 1
5003                 else
5004                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5005                 fi
5006                 ;;
5007             esac
5008             ;;
5009         esac
5010     ;;
5011 esac
5012
5013 : Default value for incpth is just usrinc
5014 case "$incpth" in
5015 '') incpth="$usrinc";;
5016 esac
5017
5018 : Set private lib path
5019 case "$plibpth" in
5020 '') if ./mips; then
5021         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5022     fi;;
5023 esac
5024 case "$libpth" in
5025 ' ') dlist='';;
5026 '') dlist="$loclibpth $plibpth $glibpth";;
5027 *) dlist="$libpth";;
5028 esac
5029
5030 : Now check and see which directories actually exist, avoiding duplicates
5031 for xxx in $dlist
5032 do
5033     if $test -d $xxx; then
5034                 case " $libpth " in
5035                 *" $xxx "*) ;;
5036                 *) libpth="$libpth $xxx";;
5037                 esac
5038     fi
5039 done
5040 $cat <<'EOM'
5041
5042 Some systems have incompatible or broken versions of libraries.  Among
5043 the directories listed in the question below, please remove any you
5044 know not to be holding relevant libraries, and add any that are needed.
5045 Say "none" for none.
5046
5047 EOM
5048
5049 if test "X$sysroot" != X; then
5050     $cat <<EOM
5051 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5052
5053 EOM
5054 fi
5055
5056 case "$libpth" in
5057 '') dflt='none';;
5058 *)
5059         set X $libpth
5060         shift
5061         dflt=${1+"$@"}
5062         ;;
5063 esac
5064 rp="Directories to use for library searches?"
5065 . ./myread
5066 case "$ans" in
5067 none) libpth=' ';;
5068 *) libpth="$ans";;
5069 esac
5070
5071 : compute shared library extension
5072 case "$so" in
5073 '')
5074         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5075                 dflt='sl'
5076         else
5077                 dflt='so'
5078         fi
5079         ;;
5080 *) dflt="$so";;
5081 esac
5082 $cat <<EOM
5083
5084 On some systems, shared libraries may be available.  Answer 'none' if
5085 you want to suppress searching of shared libraries for the remainder
5086 of this configuration.
5087
5088 EOM
5089 rp='What is the file extension used for shared libraries?'
5090 . ./myread
5091 so="$ans"
5092
5093 : Does target system insist that shared library basenames are unique
5094 $cat << EOM
5095
5096 Some dynamic loaders assume that the *basename* of shared library filenames
5097 are globally unique.  We'll default this to undef as we assume your system
5098 is not this weird. Set to defined if you're on one of them.
5099
5100 EOM
5101
5102 dflt='n'
5103 rp='Make shared library basenames unique?'
5104 . ./myread
5105 case "$ans" in
5106 y|Y) val="$define" ;;
5107 *)   val="$undef"  ;;
5108 esac
5109 set d_libname_unique
5110 eval $setvar
5111
5112 : Define several unixisms.
5113 : Hints files or command line option can be used to override them.
5114 : The convoluted testing is in case hints files set either the old
5115 : or the new name.
5116 case "$_exe" in
5117 '')     case "$exe_ext" in
5118         '')     ;;
5119         *)      _exe="$exe_ext" ;;
5120         esac
5121         ;;
5122 esac
5123 case "$_a" in
5124 '')     case "$lib_ext" in
5125     '') _a='.a';;
5126         *)      _a="$lib_ext" ;;
5127         esac
5128         ;;
5129 esac
5130 case "$_o" in
5131 '') case "$obj_ext" in
5132         '')     _o='.o';;
5133         *)      _o="$obj_ext";;
5134         esac
5135         ;;
5136 esac
5137 case "$p_" in
5138 '') case "$path_sep" in
5139         '')     p_=':';;
5140         *)      p_="$path_sep";;
5141         esac
5142         ;;
5143 esac
5144 exe_ext=$_exe
5145 lib_ext=$_a
5146 obj_ext=$_o
5147 path_sep=$p_
5148
5149 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5150
5151 : Which makefile gets called first.  This is used by make depend.
5152 case "$firstmakefile" in
5153 '') firstmakefile='makefile';;
5154 esac
5155
5156 : Check is we will use socks
5157 case "$usesocks" in
5158 $define|true|[yY]*)     dflt='y';;
5159 *) dflt='n';;
5160 esac
5161 cat <<EOM
5162
5163 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5164 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5165 to use the PerlIO abstraction layer, this will be implicitly selected.
5166
5167 If this doesn't make any sense to you, just accept the default '$dflt'.
5168 EOM
5169 rp='Build Perl for SOCKS?'
5170 . ./myread
5171 case "$ans" in
5172 y|Y)    val="$define" ;;
5173 *)      val="$undef" ;;
5174 esac
5175 set usesocks
5176 eval $setvar
5177
5178 : Check for uselongdouble support
5179 case "$ccflags" in
5180 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5181 esac
5182
5183 case "$uselongdouble" in
5184 $define|true|[yY]*)     dflt='y';;
5185 *) dflt='n';;
5186 esac
5187 cat <<EOM
5188
5189 Perl can be built to take advantage of long doubles which
5190 (if available) may give more accuracy and range for floating point numbers.
5191
5192 If this doesn't make any sense to you, just accept the default '$dflt'.
5193 EOM
5194 rp='Try to use long doubles if available?'
5195 . ./myread
5196 case "$ans" in
5197 y|Y)    val="$define"   ;;
5198 *)      val="$undef"    ;;
5199 esac
5200 set uselongdouble
5201 eval $setvar
5202
5203 case "$uselongdouble" in
5204 true|[yY]*) uselongdouble="$define" ;;
5205 esac
5206
5207 : Look for a hint-file generated 'call-back-unit'.  If the
5208 : user has specified that long doubles should be used,
5209 : we may need to set or change some other defaults.
5210 if $test -f uselongdouble.cbu; then
5211     echo "Your platform has some specific hints regarding long doubles, using them..."
5212     . ./uselongdouble.cbu
5213 else
5214     case "$uselongdouble" in
5215         $define)
5216                 $cat <<EOM
5217 (Your platform does not have any specific hints for long doubles.)
5218 EOM
5219         ;;
5220     esac
5221 fi
5222
5223 : Check if quadmath is requested
5224 case "$usequadmath" in
5225 "$define"|true|[yY]*) usequadmath="$define" ;;
5226 *)                    usequadmath="$undef"  ;;
5227 esac
5228
5229 : Looking for optional libraries
5230 echo " "
5231 echo "Checking for optional libraries..." >&4
5232 case "$libs" in
5233 ' '|'') dflt='';;
5234 *) dflt="$libs";;
5235 esac
5236 case "$libswanted" in
5237 '') libswanted='c_s';;
5238 esac
5239 case "$usesocks" in
5240 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5241 esac
5242 case "$usecbacktrace" in
5243 "$define") libswanted="$libswanted bfd" ;;
5244 esac
5245 case "$usequadmath" in
5246 "$define") libswanted="$libswanted quadmath" ;;
5247 esac
5248 libsfound=''
5249 libsfiles=''
5250 libsdirs=''
5251 libspath=''
5252 for thisdir in $libpth $xlibpth; do
5253   test -d $thisdir && libspath="$libspath $thisdir"
5254 done
5255 for thislib in $libswanted; do
5256         for thisdir in $libspath; do
5257             xxx=''
5258             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5259                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5260                 $test -f "$xxx" && eval $libscheck
5261                 $test -f "$xxx" && libstyle=shared
5262                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5263                 $test -f "$xxx" && eval $libscheck
5264                 $test -f "$xxx" && libstyle=shared
5265             fi
5266             if test ! -f "$xxx"; then
5267                 xxx=$thisdir/lib$thislib.$so
5268                 $test -f "$xxx" && eval $libscheck
5269                 $test -f "$xxx" && libstyle=shared
5270             fi
5271             if test ! -f "$xxx"; then
5272                 xxx=$thisdir/lib$thislib$_a
5273                 $test -f "$xxx" && eval $libscheck
5274                 $test -f "$xxx" && libstyle=static
5275             fi
5276             if test ! -f "$xxx"; then
5277                 xxx=$thisdir/$thislib$_a
5278                 $test -f "$xxx" && eval $libscheck
5279                 $test -f "$xxx" && libstyle=static
5280             fi
5281             if test ! -f "$xxx"; then
5282                 xxx=$thisdir/lib${thislib}_s$_a
5283                 $test -f "$xxx" && eval $libscheck
5284                 $test -f "$xxx" && libstyle=static
5285                 $test -f "$xxx" && thislib=${thislib}_s
5286             fi
5287             if test ! -f "$xxx"; then
5288                 xxx=$thisdir/Slib$thislib$_a
5289                 $test -f "$xxx" && eval $libscheck
5290                 $test -f "$xxx" && libstyle=static
5291             fi
5292             if $test -f "$xxx"; then
5293                 case "$libstyle" in
5294                 shared) echo "Found -l$thislib (shared)." ;;
5295                 static) echo "Found -l$thislib." ;;
5296                 *)      echo "Found -l$thislib ($libstyle)." ;;
5297                 esac
5298                 case " $dflt " in
5299                 *"-l$thislib "*);;
5300                 *) dflt="$dflt -l$thislib"
5301                    libsfound="$libsfound $xxx"
5302                    yyy=`basename $xxx`
5303                    libsfiles="$libsfiles $yyy"
5304                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5305                    case " $libsdirs " in
5306                    *" $yyy "*) ;;
5307                    *) libsdirs="$libsdirs $yyy" ;;
5308                    esac
5309                    ;;
5310                 esac
5311                 break
5312             fi
5313         done
5314         if $test ! -f "$xxx"; then
5315             echo "No -l$thislib."
5316         fi
5317 done
5318 set X $dflt
5319 shift
5320 dflt="$*"
5321 case "$libs" in
5322 '') dflt="$dflt";;
5323 *) dflt="$libs";;
5324 esac
5325 case "$dflt" in
5326 ' '|'') dflt='none';;
5327 esac
5328
5329 $cat <<EOM
5330
5331 In order to compile $package on your machine, a number of libraries
5332 are usually needed.  Include any other special libraries here as well.
5333 Say "none" for none.  The default list is almost always right.
5334 EOM
5335
5336 echo " "
5337 rp="What libraries to use?"
5338 . ./myread
5339 case "$ans" in
5340 none) libs=' ';;
5341 *) libs="$ans";;
5342 esac
5343
5344 : determine optimization, if desired, or use for debug flag also
5345 case "$optimize" in
5346 ' '|$undef) dflt='none';;
5347 '') dflt='-O';;
5348 *) dflt="$optimize";;
5349 esac
5350 $cat <<EOH
5351
5352 By default, $package compiles with the -O flag to use the optimizer.
5353 Alternately, you might want to use the symbolic debugger, which uses
5354 the -g flag (on traditional Unix systems).  Either flag can be
5355 specified here.  To use neither flag, specify the word "none".
5356
5357 EOH
5358 rp="What optimizer/debugger flag should be used?"
5359 . ./myread
5360 optimize="$ans"
5361 case "$optimize" in
5362 'none') optimize=" ";;
5363 esac
5364
5365 : Check what DEBUGGING is required from the command line
5366 : -DEBUGGING      or -DDEBUGGING or
5367 : -DEBUGGING=both                       = -g + -DDEBUGGING
5368 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5369 : -DEBUGGING=none or -UDEBUGGING        =
5370 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5371 case "$EBUGGING" in
5372 '')     ;;
5373 *)      DEBUGGING=$EBUGGING ;;
5374 esac
5375
5376 case "$DEBUGGING" in
5377 -g|both|$define)
5378     case "$optimize" in
5379         *-g*) ;;
5380         *)    optimize="$optimize -g" ;;
5381     esac ;;
5382 none|$undef)
5383     case "$optimize" in
5384         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5385                 shift
5386                 optimize="$*"
5387                 ;;
5388     esac ;;
5389 esac
5390
5391 dflt=''
5392 case "$DEBUGGING" in
5393 both|$define) dflt='-DDEBUGGING'
5394 esac
5395
5396 : argument order is deliberate, as the flag will start with - which set could
5397 : think is an option
5398 checkccflag='check=$1; flag=$2; callback=$3;
5399 echo " ";
5400 echo "Checking if your compiler accepts $flag" 2>&1;
5401 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5402 echo "int main(void) { return 0; }" > gcctest.c;
5403 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5404     echo "Yes, it does." 2>&1;
5405     if $test -s gcctest.out ; then
5406         echo "But your platform does not like it:";
5407         cat gcctest.out;
5408     else
5409         case "$ccflags" in
5410         *$check*)
5411             echo "Leaving current flags $ccflags alone." 2>&1
5412             ;;
5413         *) dflt="$dflt $flag";
5414             eval $callback
5415             ;;
5416         esac
5417     fi
5418 else
5419     echo "Nope, it does not, but that is ok." 2>&1;
5420 fi
5421 '
5422
5423 : We will not override a previous value, but we might want to
5424 : augment a hint file
5425 case "$hint" in
5426 default|recommended)
5427         case "$gccversion" in
5428         1*) dflt="$dflt -fpcc-struct-return" ;;
5429         esac
5430         case "$optimize:$DEBUGGING" in
5431         *-g*:old) dflt="$dflt -DDEBUGGING";;
5432         esac
5433         case "$gccversion" in
5434         2*) if $test -d /etc/conf/kconfig.d &&
5435                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5436                 then
5437                         # Interactive Systems (ISC) POSIX mode.
5438                         dflt="$dflt -posix"
5439                 fi
5440                 ;;
5441         esac
5442         case "$gccversion" in
5443         1*) ;;
5444         2.[0-8]*) ;;
5445         ?*)     set strict-aliasing -fno-strict-aliasing
5446                 eval $checkccflag
5447                 ;;
5448         esac
5449         # For gcc, adding -pipe speeds up compilations for some, but apparently
5450         # some assemblers can't read from stdin.  (It also slows down compilations
5451         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5452         case "$gccversion" in
5453         ?*)     set pipe -pipe
5454                 eval $checkccflag
5455                 ;;
5456         esac
5457
5458         # on x86_64 (at least) we require an extra library (libssp) in the
5459         # link command line. This library is not named, so I infer that it is
5460         # an implementation detail that may change. Hence the safest approach
5461         # is to add the flag to the flags passed to the compiler at link time,
5462         # as that way the compiler can do the right implementation dependant
5463         # thing. (NWC)
5464         case "$osname" in
5465         amigaos) ;; # -fstack-protector builds but doesn't work
5466         *)      case "$gccversion" in
5467                 ?*)     set stack-protector-strong -fstack-protector-strong
5468                         eval $checkccflag
5469                         case "$dflt" in
5470                         *-fstack-protector-strong*) ;; # It got added.
5471                         *) # Try the plain/older -fstack-protector.
5472                            set stack-protector -fstack-protector
5473                            eval $checkccflag
5474                            ;;
5475                         esac
5476                         ;;
5477                 esac
5478                 ;;
5479         esac
5480         ;;
5481 esac
5482
5483 case "$mips_type" in
5484 *BSD*|'') inclwanted="$locincpth $usrinc";;
5485 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5486 esac
5487 for thisincl in $inclwanted; do
5488         if $test -d $thisincl; then
5489                 if $test x$thisincl != x$usrinc; then
5490                         case "$dflt" in
5491                         *" -I$thisincl "*);;
5492                         *) dflt="$dflt -I$thisincl ";;
5493                         esac
5494                 fi
5495         fi
5496 done
5497
5498 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5499         xxx=true;
5500 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5501         xxx=true;
5502 else
5503         xxx=false;
5504 fi;
5505 if $xxx; then
5506         case "$dflt" in
5507         *$2*);;
5508         *) dflt="$dflt -D$2";;
5509         esac;
5510 fi'
5511
5512 set signal.h LANGUAGE_C; eval $inctest
5513
5514 case "$usesocks" in
5515 $define)
5516         ccflags="$ccflags -DSOCKS"
5517         ;;
5518 esac
5519
5520 case "$hint" in
5521 default|recommended) dflt="$ccflags $dflt" ;;
5522 *) dflt="$ccflags";;
5523 esac
5524
5525 case "$dflt" in
5526 ''|' ') dflt=none;;
5527 esac
5528
5529 $cat <<EOH
5530
5531 Your C compiler may want other flags.  For this question you should include
5532 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5533 but you should NOT include libraries or ld flags like -lwhatever.  If you
5534 want $package to honor its debug switch, you should include -DDEBUGGING here.
5535 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5536
5537 To use no flags, specify the word "none".
5538
5539 EOH
5540 set X $dflt
5541 shift
5542 dflt=${1+"$@"}
5543 rp="Any additional cc flags?"
5544 . ./myread
5545 case "$ans" in
5546 none) ccflags='';;
5547 *) ccflags="$ans";;
5548 esac
5549
5550 : the following weeds options from ccflags that are of no interest to cpp
5551 case "$cppflags" in
5552 '') cppflags="$ccflags" ;;
5553 *)  cppflags="$cppflags $ccflags" ;;
5554 esac
5555 case "$gccversion" in
5556 1*) cppflags="$cppflags -D__GNUC__"
5557 esac
5558 case "$mips_type" in
5559 '');;
5560 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5561 esac
5562 case "$cppflags" in
5563 '');;
5564 *)
5565         echo " "
5566         echo "Let me guess what the preprocessor flags are..." >&4
5567         set X $cppflags
5568         shift
5569         cppflags=''
5570         $cat >cpp.c <<'EOM'
5571 #define BLURFL foo
5572
5573 BLURFL xx LFRULB
5574 EOM
5575         previous=''
5576         for flag in $*
5577         do
5578                 case "$flag" in
5579                 -*) ftry="$flag";;
5580                 *) ftry="$previous $flag";;
5581                 esac
5582                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5583                         >cpp1.out 2>/dev/null && \
5584                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5585                         >cpp2.out 2>/dev/null && \
5586                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5587                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5588                 then
5589                         cppflags="$cppflags $ftry"
5590                         previous=''
5591                 else
5592                         previous="$flag"
5593                 fi
5594         done
5595         set X $cppflags
5596         shift
5597         cppflags=${1+"$@"}
5598         case "$cppflags" in
5599         *-*)  echo "They appear to be: $cppflags";;
5600         esac
5601         $rm -f cpp.c cpp?.out
5602         ;;
5603 esac
5604
5605 : flags used in final linking phase
5606 case "$ldflags" in
5607 '') if ./venix; then
5608                 dflt='-i -z'
5609         else
5610                 dflt=''
5611         fi
5612         case "$ccflags" in
5613         *-posix*) dflt="$dflt -posix" ;;
5614         esac
5615         ;;
5616 *) dflt="$ldflags";;
5617 esac
5618 # See note above about -fstack-protector
5619 case "$ccflags" in
5620 *-fstack-protector-strong*)
5621         case "$dflt" in
5622         *-fstack-protector-strong*) ;; # Don't add it again
5623         *) dflt="$dflt -fstack-protector-strong" ;;
5624         esac
5625         ;;
5626 *-fstack-protector*)
5627         case "$dflt" in
5628         *-fstack-protector*) ;; # Don't add it again
5629         *) dflt="$dflt -fstack-protector" ;;
5630         esac
5631         ;;
5632 esac
5633
5634 : Try to guess additional flags to pick up local libraries.
5635 for thislibdir in $libpth; do
5636         case " $loclibpth " in
5637         *" $thislibdir "*)
5638                 case "$dflt " in
5639                 *"-L$thislibdir "*) ;;
5640                 *)  dflt="$dflt -L$thislibdir" ;;
5641                 esac
5642                 ;;
5643         esac
5644 done
5645
5646 case "$dflt" in
5647 '') dflt='none' ;;
5648 esac
5649
5650 $cat <<EOH
5651
5652 Your C linker may need flags.  For this question you should
5653 include -L/whatever and any other flags used by the C linker, but you
5654 should NOT include libraries like -lwhatever.
5655
5656 Make sure you include the appropriate -L/path flags if your C linker
5657 does not normally search all of the directories you specified above,
5658 namely
5659         $libpth
5660 To use no flags, specify the word "none".
5661
5662 EOH
5663
5664 rp="Any additional ld flags (NOT including libraries)?"
5665 . ./myread
5666 case "$ans" in
5667 none) ldflags='';;
5668 *) ldflags="$ans";;
5669 esac
5670 rmlist="$rmlist pdp11"
5671
5672 : coherency check
5673 echo " "
5674 echo "Checking your choice of C compiler and flags for coherency..." >&4
5675 $cat > try.c <<'EOF'
5676 #include <stdio.h>
5677 int main() { printf("Ok\n"); return(0); }
5678 EOF
5679 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5680 shift
5681 $cat >try.msg <<'EOM'
5682 I've tried to compile and run the following simple program:
5683
5684 EOM
5685 $cat try.c >> try.msg
5686
5687 $cat >> try.msg <<EOM
5688
5689 I used the command:
5690
5691         $*
5692         $run ./try
5693
5694 and I got the following output:
5695
5696 EOM
5697 dflt=y
5698 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5699         if $sh -c "$run ./try " >>try.msg 2>&1; then
5700                 xxx=`$run ./try`
5701                 case "$xxx" in
5702                 "Ok") dflt=n ;;
5703                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5704                 esac
5705         else
5706                 echo "The program compiled OK, but exited with status $?." >>try.msg
5707                 rp="You have a problem.  Shall I abort Configure"
5708                 dflt=y
5709         fi
5710 else
5711         echo "I can't compile the test program." >>try.msg
5712         rp="You have a BIG problem.  Shall I abort Configure"
5713         dflt=y
5714 fi
5715 case "$dflt" in
5716 y)
5717         $cat try.msg >&4
5718         case "$knowitall" in
5719         '')
5720                 echo "(The supplied flags or libraries might be incorrect.)"
5721                 ;;
5722         *) dflt=n;;
5723         esac
5724         echo " "
5725         . ./myread
5726         case "$ans" in
5727         n*|N*) ;;
5728         *)      echo "Ok.  Stopping Configure." >&4
5729                 exit 1
5730                 ;;
5731         esac
5732         ;;
5733 n) echo "OK, that should do.";;
5734 esac
5735 $rm_try gcctest gcctest.out
5736
5737 : define a shorthand compile call
5738 compile='
5739 mc_file=$1;
5740 shift;
5741 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5742 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5743 exit 1;
5744 fi;
5745 esac;
5746 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5747 : define a shorthand compile call for compilations that should be ok.
5748 compile_ok='
5749 mc_file=$1;
5750 shift;
5751 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5752
5753 : determine filename position in cpp output
5754 echo " "
5755 echo "Computing filename position in cpp output for #include directives..." >&4
5756 case "$osname" in
5757 amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5758 esac
5759 case "$fieldn" in
5760 '')
5761 case "$osname" in
5762 vos) testaccess=-e ;;
5763 *)   testaccess=-r ;;
5764 esac
5765 echo '#include <stdio.h>' > foo.c
5766 $cat >fieldn <<EOF
5767 $startsh
5768 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5769 $grep '^[       ]*#.*stdio\.h' | \
5770 while read cline; do
5771         pos=1
5772         set \$cline
5773         while $test \$# -gt 0; do
5774                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5775                         echo "\$pos"
5776                         exit 0
5777                 fi
5778                 shift
5779                 pos=\`expr \$pos + 1\`
5780         done
5781 done
5782 EOF
5783 chmod +x fieldn
5784 fieldn=`./fieldn`
5785 $rm -f foo.c fieldn
5786 ;;
5787 esac
5788 case $fieldn in
5789 '') pos='???';;
5790 1) pos=first;;
5791 2) pos=second;;
5792 3) pos=third;;
5793 *) pos="${fieldn}th";;
5794 esac
5795 echo "Your cpp writes the filename in the $pos field of the line."
5796
5797 : locate header file
5798 $cat >findhdr <<EOF
5799 $startsh
5800 wanted=\$1
5801 name=''
5802 for usrincdir in $incpth
5803 do
5804         if test -f \$usrincdir/\$wanted; then
5805                 echo "\$usrincdir/\$wanted"
5806                 exit 0
5807         fi
5808 done
5809 awkprg='{ print \$$fieldn }'
5810 echo "#include <\$wanted>" > foo\$\$.c
5811 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5812 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5813 while read cline; do
5814         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5815         case "\$name" in
5816         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5817         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5818         *) exit 2;;
5819         esac;
5820 done;
5821 #
5822 # status = 0: grep returned 0 lines, case statement not executed
5823 # status = 1: headerfile found
5824 # status = 2: while loop executed, no headerfile found
5825 #
5826 status=\$?
5827 $rm -f foo\$\$.c;
5828 if test \$status -eq 1; then
5829         exit 0;
5830 fi
5831 exit 1
5832 EOF
5833 chmod +x findhdr
5834
5835 : define an alternate in-header-list? function
5836 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5837 cont=true; xxf="echo \"<\$1> found.\" >&4";
5838 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5839 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5840 esac;
5841 case $# in 4) instead=instead;; *) instead="at last";; esac;
5842 while $test "$cont"; do
5843         xxx=`./findhdr $1`
5844         var=$2; eval "was=\$$2";
5845         if $test "$xxx" && $test -r "$xxx";
5846         then eval $xxf;
5847         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5848                 cont="";
5849         else eval $xxnf;
5850         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5851         set $yyy; shift; shift; yyy=$@;
5852         case $# in 0) cont="";;
5853         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5854                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5855         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5856                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5857         esac;
5858 done;
5859 while $test "$yyy";
5860 do set $yyy; var=$2; eval "was=\$$2";
5861         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5862         set $yyy; shift; shift; yyy=$@;
5863 done'
5864
5865 : see if stdlib is available
5866 set stdlib.h i_stdlib
5867 eval $inhdr
5868
5869 : check for lengths of integral types
5870 echo " "
5871 case "$intsize" in
5872 '')
5873         echo "Checking to see how big your integers are..." >&4
5874         $cat >try.c <<EOCP
5875 #include <stdio.h>
5876 #$i_stdlib I_STDLIB
5877 #ifdef I_STDLIB
5878 #include <stdlib.h>
5879 #endif
5880 int main()
5881 {
5882         printf("intsize=%d;\n", (int)sizeof(int));
5883         printf("longsize=%d;\n", (int)sizeof(long));
5884         printf("shortsize=%d;\n", (int)sizeof(short));
5885         exit(0);
5886 }
5887 EOCP
5888         set try
5889         if eval $compile_ok && $run ./try > /dev/null; then
5890                 eval `$run ./try`
5891                 echo "Your integers are $intsize bytes long."
5892                 echo "Your long integers are $longsize bytes long."
5893                 echo "Your short integers are $shortsize bytes long."
5894         else
5895                 $cat >&4 <<EOM
5896 !
5897 Help! I can't compile and run the intsize test program: please enlighten me!
5898 (This is probably a misconfiguration in your system or libraries, and
5899 you really ought to fix it.  Still, I'll try anyway.)
5900 !
5901 EOM
5902                 dflt=4
5903                 rp="What is the size of an integer (in bytes)?"
5904                 . ./myread
5905                 intsize="$ans"
5906                 dflt=$intsize
5907                 rp="What is the size of a long integer (in bytes)?"
5908                 . ./myread
5909                 longsize="$ans"
5910                 dflt=2
5911                 rp="What is the size of a short integer (in bytes)?"
5912                 . ./myread
5913                 shortsize="$ans"
5914         fi
5915         ;;
5916 esac
5917 $rm_try
5918
5919 : check for long long
5920 echo " "
5921 echo "Checking to see if you have long long..." >&4
5922 echo 'int main() { long long x = 7; return 0; }' > try.c
5923 set try
5924 if eval $compile; then
5925         val="$define"
5926         echo "You have long long."
5927 else
5928         val="$undef"
5929         echo "You do not have long long."
5930 fi
5931 $rm_try
5932 set d_longlong
5933 eval $setvar
5934
5935 : check for length of long long
5936 case "${d_longlong}${longlongsize}" in
5937 $define)
5938         echo " "
5939         echo "Checking to see how big your long longs are..." >&4
5940         $cat >try.c <<'EOCP'
5941 #include <stdio.h>
5942 int main()
5943 {
5944     printf("%d\n", (int)sizeof(long long));
5945     return(0);
5946 }
5947 EOCP
5948         set try
5949         if eval $compile_ok; then
5950                 longlongsize=`$run ./try`
5951                 echo "Your long longs are $longlongsize bytes long."
5952         else
5953                 dflt='8'
5954                 echo " "
5955                 echo "(I can't seem to compile the test program.  Guessing...)"
5956                 rp="What is the size of a long long (in bytes)?"
5957                 . ./myread
5958                 longlongsize="$ans"
5959         fi
5960         if $test "X$longsize" = "X$longlongsize"; then
5961                 echo "(That isn't any different from an ordinary long.)"
5962         fi
5963         ;;
5964 esac
5965 $rm_try
5966
5967 : see if inttypes.h is available
5968 : we want a real compile instead of Inhdr because some systems
5969 : have an inttypes.h which includes non-existent headers
5970 echo " "
5971 $cat >try.c <<EOCP
5972 #include <inttypes.h>
5973 int main() {
5974         static int32_t foo32 = 0x12345678;
5975 }
5976 EOCP
5977 set try
5978 if eval $compile; then
5979         echo "<inttypes.h> found." >&4
5980         val="$define"
5981 else
5982         echo "<inttypes.h> NOT found." >&4
5983         val="$undef"
5984 fi
5985 $rm_try
5986 set i_inttypes
5987 eval $setvar
5988
5989 : check for int64_t
5990 echo " "
5991 echo "Checking to see if you have int64_t..." >&4
5992 $cat >try.c <<EOCP
5993 #include <sys/types.h>
5994 #$i_inttypes I_INTTYPES
5995 #ifdef I_INTTYPES
5996 #include <inttypes.h>
5997 #endif
5998 int main() { int64_t x = 7; }
5999 EOCP
6000 set try
6001 if eval $compile; then
6002         val="$define"
6003         echo "You have int64_t."
6004 else
6005         val="$undef"
6006         echo "You do not have int64_t."
6007 fi
6008 $rm_try
6009 set d_int64_t
6010 eval $setvar
6011
6012 : Check if 64bit ints have a quad type
6013 echo " "
6014 echo "Checking which 64-bit integer type we could use..." >&4
6015
6016 case "$intsize" in
6017 8) val=int
6018    set quadtype
6019    eval $setvar
6020    val='"unsigned int"'
6021    set uquadtype
6022    eval $setvar
6023    quadkind=1
6024    ;;
6025 *) case "$longsize" in
6026    8) val=long
6027       set quadtype
6028       eval $setvar
6029       val='"unsigned long"'
6030       set uquadtype
6031       eval $setvar
6032       quadkind=2
6033       ;;
6034    *) case "$d_longlong:$longlongsize" in
6035       define:8)
6036         val='"long long"'
6037         set quadtype
6038         eval $setvar
6039         val='"unsigned long long"'
6040         set uquadtype
6041         eval $setvar
6042         quadkind=3
6043         ;;
6044       *) case "$d_int64_t" in
6045          define)
6046            val=int64_t
6047            set quadtype
6048            eval $setvar
6049            val=uint64_t
6050            set uquadtype
6051            eval $setvar
6052            quadkind=4
6053            ;;
6054          esac
6055          ;;
6056       esac
6057       ;;
6058    esac
6059    ;;
6060 esac
6061
6062 case "$quadtype" in
6063 '')     echo "Alas, no 64-bit integer types in sight." >&4
6064         d_quad="$undef"
6065         ;;
6066 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6067         d_quad="$define"
6068         ;;
6069 esac
6070
6071 : Do we want 64bit support
6072 case "$uselonglong" in
6073 "$define"|true|[yY]*)
6074         cat <<EOM >&4
6075
6076 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6077 EOM
6078         use64bitint="$define"
6079         ;;
6080 esac
6081 case "$use64bits" in
6082 "$define"|true|[yY]*)
6083         cat <<EOM >&4
6084
6085 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6086 EOM
6087         use64bitint="$define"
6088         ;;
6089 esac
6090 case "$use64bitints" in
6091 "$define"|true|[yY]*)
6092         cat <<EOM >&4
6093
6094 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6095 EOM
6096         use64bitint="$define"
6097         ;;
6098 esac
6099 case "$use64bitsint" in
6100 "$define"|true|[yY]*)
6101         cat <<EOM >&4
6102
6103 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6104 EOM
6105         use64bitint="$define"
6106         ;;
6107 esac
6108 case "$uselonglongs" in
6109 "$define"|true|[yY]*)
6110         cat <<EOM >&4
6111
6112 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6113 EOM
6114         use64bitint="$define"
6115         ;;
6116 esac
6117 case "$use64bitsall" in
6118 "$define"|true|[yY]*)
6119         cat <<EOM >&4
6120
6121 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6122 EOM
6123         use64bitall="$define"
6124         ;;
6125 esac
6126
6127 case "$ccflags" in
6128 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6129 esac
6130 case "$use64bitall" in
6131 "$define"|true|[yY]*) use64bitint="$define" ;;
6132 esac
6133
6134 case "$longsize" in
6135 8) cat <<EOM
6136
6137 You have natively 64-bit long integers.
6138 EOM
6139    val="$define"
6140    ;;
6141 *) case "$use64bitint" in
6142    "$define"|true|[yY]*) dflt='y';;
6143    *) dflt='n';;
6144    esac
6145    case "$d_quad" in
6146    "$define") ;;
6147    *) dflt='n' ;;
6148    esac
6149    cat <<EOM
6150
6151 Perl can be built to take advantage of 64-bit integer types
6152 on some systems.  To do so, Configure can be run with -Duse64bitint.
6153 Choosing this option will most probably introduce binary incompatibilities.
6154
6155 If this doesn't make any sense to you, just accept the default '$dflt'.
6156 (The default has been chosen based on your configuration.)
6157 EOM
6158    rp='Try to use 64-bit integers, if available?'
6159    . ./myread
6160    case "$ans" in
6161    [yY]*) val="$define" ;;
6162    *)     val="$undef"  ;;
6163    esac
6164    ;;
6165 esac
6166 set use64bitint
6167 eval $setvar
6168
6169 case "$use64bitall" in
6170 "$define"|true|[yY]*) dflt='y' ;;
6171 *) case "$longsize" in
6172    8) dflt='y' ;;
6173    *) dflt='n' ;;
6174    esac
6175    ;;
6176 esac
6177 cat <<EOM
6178
6179 You may also choose to try maximal 64-bitness.  It means using as much
6180 64-bitness as possible on the platform.  This in turn means even more
6181 binary incompatibilities.  On the other hand, your platform may not
6182 have any more 64-bitness available than what you already have chosen.
6183
6184 If this doesn't make any sense to you, just accept the default '$dflt'.
6185 (The default has been chosen based on your configuration.)
6186 EOM
6187 rp='Try to use maximal 64-bit support, if available?'
6188 . ./myread
6189 case "$ans" in
6190 [yY]*) val="$define" ;;
6191 *)     val="$undef"  ;;
6192 esac
6193 set use64bitall
6194 eval $setvar
6195 case "$use64bitall" in
6196 "$define")
6197         case "$use64bitint" in
6198         "$undef")
6199                 cat <<EOM
6200
6201 Since you have chosen a maximally 64-bit build, I'm also turning on
6202 the use of 64-bit integers.
6203 EOM
6204                 use64bitint="$define" ;;
6205         esac
6206         ;;
6207 esac
6208
6209 : Look for a hint-file generated 'call-back-unit'.  If the
6210 : user has specified that a 64-bit perl is to be built,
6211 : we may need to set or change some other defaults.
6212 if $test -f use64bitint.cbu; then
6213         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6214         . ./use64bitint.cbu
6215 fi
6216 case "$use64bitint" in
6217 "$define"|true|[yY]*)
6218         : This test was common to all the OpenBSD forks, and seems harmless for
6219         : other platforms:
6220         echo " "
6221         echo "Checking if your C library has broken 64-bit functions..." >&4
6222         cat >try.c <<EOCP
6223 #include <stdio.h>
6224 typedef $uquadtype myULL;
6225 int main (void)
6226 {
6227     struct {
6228         double d;
6229         myULL  u;
6230     } *p, test[] = {
6231         {4294967303.15, 4294967303ULL},
6232         {4294967294.2,  4294967294ULL},
6233         {4294967295.7,  4294967295ULL},
6234         {0.0, 0ULL}
6235     };
6236     for (p = test; p->u; p++) {
6237         myULL x = (myULL)p->d;
6238         if (x != p->u) {
6239             printf("buggy\n");
6240             return 0;
6241         }
6242     }
6243     printf("ok\n");
6244     return 0;
6245 }
6246 EOCP
6247         set try
6248         if eval $compile_ok; then
6249             libcquad=`$run ./try`
6250             echo "Your C library's 64-bit functions are $libcquad."
6251         else
6252             echo "(I can't seem to compile the test program.)"
6253             echo "Assuming that your C library's 64-bit functions are ok."
6254             libcquad="ok"
6255         fi
6256         $rm_try
6257
6258         case "$libcquad" in
6259             buggy*)
6260                 cat >&4 <<EOM
6261
6262 *** You have a C library with broken 64-bit functions.
6263 *** 64-bit support does not work reliably in this configuration.
6264 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6265 *** Cannot continue, aborting.
6266
6267 EOM
6268                 exit 1
6269                 ;;
6270         esac
6271         case "$longsize" in
6272         4) case "$archname64" in
6273            '') archname64=64int ;;
6274            esac
6275            ;;
6276         esac
6277         ;;
6278 esac
6279
6280 : Look for a hint-file generated 'call-back-unit'.  If the
6281 : user has specified that a maximally 64-bit perl is to be built,
6282 : we may need to set or change some other defaults.
6283 if $test -f use64bitall.cbu; then
6284         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6285         . ./use64bitall.cbu
6286 fi
6287 case "$use64bitall" in
6288 "$define"|true|[yY]*)
6289         case "$longsize" in
6290         4) case "$archname64" in
6291            ''|64int) archname64=64all ;;
6292            esac
6293            ;;
6294         esac
6295         ;;
6296 esac
6297
6298 case "$d_quad:$use64bitint" in
6299 $undef:$define)
6300         cat >&4 <<EOF
6301
6302 *** You have chosen to use 64-bit integers,
6303 *** but none can be found.
6304 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6305 *** Cannot continue, aborting.
6306
6307 EOF
6308         exit 1
6309         ;;
6310 esac
6311
6312 : Check if we are using the GNU C library
6313 echo " "
6314 echo "Checking for GNU C Library..." >&4
6315 cat >try.c <<'EOCP'
6316 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6317    alone are insufficient to distinguish different versions, such as
6318    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6319    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6320 */
6321 #include <stdio.h>
6322 int main(void)
6323 {
6324 #ifdef __GLIBC__
6325 #   ifdef __GLIBC_MINOR__
6326 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6327 #           include <gnu/libc-version.h>
6328             printf("%s\n",  gnu_get_libc_version());
6329 #       else
6330             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6331 #       endif
6332 #   else
6333         printf("%d\n",  __GLIBC__);
6334 #   endif
6335     return 0;
6336 #else
6337     return 1;
6338 #endif
6339 }
6340 EOCP
6341 set try
6342 if eval $compile_ok && $run ./try > glibc.ver; then
6343         val="$define"
6344         gnulibc_version=`$cat glibc.ver`
6345         echo "You are using the GNU C Library version $gnulibc_version"
6346 else
6347         val="$undef"
6348         gnulibc_version=''
6349         echo "You are not using the GNU C Library"
6350 fi
6351 $rm_try glibc.ver
6352 set d_gnulibc
6353 eval $setvar
6354
6355 : see if nm is to be used to determine whether a symbol is defined or not
6356 case "$usenm" in
6357 '')
6358         dflt=''
6359         case "$d_gnulibc" in
6360         "$define")
6361                 echo " "
6362                 echo "nm probably won't work on the GNU C Library." >&4
6363                 dflt=n
6364                 ;;
6365         esac
6366         case "$dflt" in
6367         '')
6368                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6369                         echo " "
6370                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6371                         echo "'nm' won't be sufficient on this system." >&4
6372                         dflt=n
6373                 fi
6374                 ;;
6375         esac
6376         case "$dflt" in
6377         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6378                 if $test $dflt -gt 20; then
6379                         dflt=y
6380                 else
6381                         dflt=n
6382                 fi
6383                 ;;
6384         esac
6385         ;;
6386 *)
6387         case "$usenm" in
6388         true|$define) dflt=y;;
6389         *) dflt=n;;
6390         esac
6391         ;;
6392 esac
6393 $cat <<EOM
6394
6395 I can use $nm to extract the symbols from your C libraries. This
6396 is a time consuming task which may generate huge output on the disk (up
6397 to 3 megabytes) but that should make the symbols extraction faster. The
6398 alternative is to skip the 'nm' extraction part and to compile a small
6399 test program instead to determine whether each symbol is present. If
6400 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6401 this may be the best solution.
6402
6403 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6404
6405 EOM
6406 rp="Shall I use $nm to extract C symbols from the libraries?"
6407 . ./myread
6408 case "$ans" in
6409 [Nn]*) usenm=false;;
6410 *) usenm=true;;
6411 esac
6412
6413 runnm=$usenm
6414 case "$reuseval" in
6415 true) runnm=false;;
6416 esac
6417
6418 : nm options which may be necessary
6419 case "$nm_opt" in
6420 '') if $test -f /mach_boot; then
6421                 nm_opt=''       # Mach
6422         elif $test -d /usr/ccs/lib; then
6423                 nm_opt='-p'     # Solaris (and SunOS?)
6424         elif $test -f /dgux; then
6425                 nm_opt='-p'     # DG-UX
6426         elif $test -f /lib64/rld; then
6427                 nm_opt='-p'     # 64-bit Irix
6428         else
6429                 nm_opt=''
6430         fi;;
6431 esac
6432
6433 : nm options which may be necessary for shared libraries but illegal
6434 : for archive libraries.  Thank you, Linux.
6435 case "$nm_so_opt" in
6436 '')     case "$myuname" in
6437         *linux*|gnu*)
6438                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6439                         nm_so_opt='--dynamic'
6440                 fi
6441                 ;;
6442         esac
6443         ;;
6444 esac
6445
6446 : Figure out where the libc is located
6447 case "$runnm" in
6448 true)
6449 : get list of predefined functions in a handy place
6450 echo " "
6451 case "$libc" in
6452 '') libc=unknown
6453         case "$libs" in
6454         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6455         esac
6456         ;;
6457 esac
6458 case "$libs" in
6459 '') ;;
6460 *)  for thislib in $libs; do
6461         case "$thislib" in
6462         -lc|-lc_s)
6463                 : Handle C library specially below.
6464                 ;;
6465         -l*)
6466                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6467                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6468                         :
6469                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6470                         :
6471                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6472                         :
6473                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6474                         :
6475                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6476                         :
6477                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6478                         :
6479                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6480                         :
6481                 else
6482                         try=''
6483                 fi
6484                 libnames="$libnames $try"
6485                 ;;
6486         *) libnames="$libnames $thislib" ;;
6487         esac
6488         done
6489         ;;
6490 esac
6491 xxx=normal
6492 case "$libc" in
6493 unknown)
6494         set /lib/libc.$so
6495         for xxx in $libpth; do
6496                 $test -r $1 || set $xxx/libc.$so
6497                 : The messy sed command sorts on library version numbers.
6498                 $test -r $1 || \
6499                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6500                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6501                                 h
6502                                 s/[0-9][0-9]*/0000&/g
6503                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6504                                 G
6505                                 s/\n/ /' | \
6506                          $sort | $sed -e 's/^.* //'`
6507                 eval set \$$#
6508         done
6509         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6510         $test -r $1 || set $sysroot/lib/libsys_s$_a
6511         ;;
6512 *)
6513         set blurfl
6514         ;;
6515 esac
6516 if $test -r "$1"; then
6517         echo "Your (shared) C library seems to be in $1."
6518         libc="$1"
6519 elif $test -r /lib/libc && $test -r /lib/clib; then
6520         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6521         xxx=apollo
6522         libc='/lib/clib /lib/libc'
6523         if $test -r /lib/syslib; then
6524                 echo "(Your math library is in /lib/syslib.)"
6525                 libc="$libc /lib/syslib"
6526         fi
6527 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6528         echo "Your C library seems to be in $libc, as you said before."
6529 elif $test -r $incpath/usr/lib/libc$_a; then
6530         libc=$incpath/usr/lib/libc$_a;
6531         echo "Your C library seems to be in $libc.  That's fine."
6532 elif $test -r /lib/libc$_a; then
6533         libc=/lib/libc$_a;
6534         echo "Your C library seems to be in $libc.  You're normal."
6535 else
6536         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6537                 :
6538         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6539                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6540         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6541                 :
6542         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6543                 :
6544         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6545                 :
6546         else
6547                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6548         fi
6549         if $test -r "$tans"; then
6550                 echo "Your C library seems to be in $tans, of all places."
6551                 libc=$tans
6552         else
6553                 libc='blurfl'
6554         fi
6555 fi
6556 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6557         dflt="$libc"
6558         cat <<EOM
6559
6560 If the guess above is wrong (which it might be if you're using a strange
6561 compiler, or your machine supports multiple models), you can override it here.
6562
6563 EOM
6564 else
6565         dflt=''
6566         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6567         cat >&4 <<EOM
6568 I can't seem to find your C library.  I've looked in the following places:
6569
6570 EOM
6571         $sed 's/^/      /' libpath
6572         cat <<EOM
6573
6574 None of these seems to contain your C library. I need to get its name...
6575
6576 EOM
6577 fi
6578 fn=f
6579 rp='Where is your C library?'
6580 . ./getfile
6581 libc="$ans"
6582
6583 echo " "
6584 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6585 set X `cat libnames`
6586 shift
6587 xxx=files
6588 case $# in 1) xxx=file; esac
6589 echo "Extracting names from the following $xxx for later perusal:" >&4
6590 echo " "
6591 $sed 's/^/      /' libnames >&4
6592 echo " "
6593 $echo $n "This may take a while...$c" >&4
6594
6595 for file in $*; do
6596         case $file in
6597         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6598         *) $nm $nm_opt $file 2>/dev/null;;
6599         esac
6600 done >libc.tmp
6601
6602 $echo $n ".$c"
6603 $grep fprintf libc.tmp > libc.ptf
6604 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6605 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6606 xxx='[ADTSIWi]'
6607 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6608         eval $xscan;\
6609         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6610                 eval $xrun
6611 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6612         eval $xscan;\
6613         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6614                 eval $xrun
6615 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6616         eval $xscan;\
6617         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6618                 eval $xrun
6619 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6620         eval $xscan;\
6621         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6622                 eval $xrun
6623 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6624         eval $xscan;\
6625         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6626                 eval $xrun
6627 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6628         eval $xscan;\
6629         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6630                 eval $xrun
6631 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6632                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6633         eval $xscan;\
6634         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6635                 eval $xrun
6636 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6637         eval $xscan;\
6638         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6639                 eval $xrun
6640 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6641         eval $xscan;\
6642         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6643                 eval $xrun
6644 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6645         eval $xscan;\
6646         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6647                 eval $xrun
6648 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6649         eval $xscan;\
6650         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6651                 eval $xrun
6652 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6653         eval $xscan;\
6654         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6655                 eval $xrun
6656 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//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/[       ]*D[    ]*[0-9]*.*//p'";\
6661         eval $xscan;\
6662         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6663                 eval $xrun
6664 else
6665         $nm -p $* 2>/dev/null >libc.tmp
6666         $grep fprintf libc.tmp > libc.ptf
6667         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6668                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6669         then
6670                 nm_opt='-p'
6671                 eval $xrun
6672         else
6673                 echo " "
6674                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6675                 com=''
6676                 if $ar t $libc > libc.tmp && \
6677                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6678                 then
6679                         for thisname in $libnames $libc; do
6680                                 $ar t $thisname >>libc.tmp
6681                         done
6682                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6683                         echo "Ok." >&4
6684                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6685                         for thisname in $libnames $libc; do
6686                                 $ar tv $thisname >>libc.tmp
6687                                 emximp -o tmp.imp $thisname \
6688                                     2>/dev/null && \
6689                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6690                                     < tmp.imp >>libc.tmp
6691                                 $rm -f tmp.imp
6692                         done
6693                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6694                         echo "Ok." >&4
6695                 else
6696                         echo "$ar didn't seem to work right." >&4
6697                         echo "Maybe this is a Cray...trying bld instead..." >&4
6698                         if  bld t $libc | \
6699                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6700                                 $test -s libc.list
6701                         then
6702                                 for thisname in $libnames; do
6703                                         bld t $libnames | \
6704                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6705                                         $ar t $thisname >>libc.tmp
6706                                 done
6707                                 echo "Ok." >&4
6708                         else
6709                                 echo "That didn't work either.  Giving up." >&4
6710                                 exit 1
6711                         fi
6712                 fi
6713         fi
6714 fi
6715 nm_extract="$com"
6716 case "$PASE" in
6717 define)
6718     echo " "
6719     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6720     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6721     ;;
6722 *)  if $test -f /lib/syscalls.exp; then
6723         echo " "
6724         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6725         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6726                 /lib/syscalls.exp >>libc.list
6727     fi
6728     ;;
6729 esac
6730 ;;
6731 esac
6732 $rm -f libnames libpath
6733
6734 : Check if we are using C++
6735 echo " "
6736 echo "Checking for C++..." >&4
6737 $cat >try.c <<'EOCP'
6738 #include <stdio.h>
6739 int main(void)
6740 {
6741 #ifdef __cplusplus
6742     return 0;
6743 #else
6744     return 1;
6745 #endif
6746 }
6747 EOCP
6748 set try
6749 if eval $compile_ok && $run ./try; then
6750         val="$define"
6751         echo "You are using a C++ compiler."
6752 else
6753         val="$undef"
6754         echo "You are not using a C++ compiler."
6755 fi
6756 $rm_try cplusplus$$
6757 set d_cplusplus
6758 eval $setvar
6759
6760 : is a C symbol defined?
6761 csym='tlook=$1;
6762 case "$3" in
6763 -v) tf=libc.tmp; tdc="";;
6764 -a) tf=libc.tmp; tdc="[]";;
6765 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6766 esac;
6767 case "$d_cplusplus" in
6768     $define)    extern_C="extern \"C\"" ;;
6769     *)          extern_C="extern"       ;;
6770 esac;
6771 tx=yes;
6772 case "$reuseval-$4" in
6773 true-) ;;
6774 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6775 esac;
6776 case "$tx" in
6777 yes)
6778         tval=false;
6779         if $test "$runnm" = true; then
6780                 if $contains $tlook $tf >/dev/null 2>&1; then
6781                         tval=true;
6782                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6783                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p() && p() != (void *)main) return(0); else return(1); }"> try.c;
6784                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6785                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6786                         $rm_try;
6787                 fi;
6788         else
6789                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p() && p() != (void *)main) return(0); else return(1); }"> try.c;
6790                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6791                 $rm_try;
6792         fi;
6793         ;;
6794 *)
6795         case "$tval" in
6796         $define) tval=true;;
6797         *) tval=false;;
6798         esac;
6799         ;;
6800 esac;
6801 eval "$2=$tval"'
6802
6803 : define an is-in-libc? function
6804 inlibc='echo " "; td=$define; tu=$undef;
6805 sym=$1; var=$2; eval "was=\$$2";
6806 tx=yes;
6807 case "$reuseval$was" in
6808 true) ;;
6809 true*) tx=no;;
6810 esac;
6811 case "$tx" in
6812 yes)
6813         set $sym tres -f;
6814         eval $csym;
6815         case "$tres" in
6816         true)
6817                 echo "$sym() found." >&4;
6818                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6819         *)
6820                 echo "$sym() NOT found." >&4;
6821                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6822         esac;;
6823 *)
6824         case "$was" in
6825         $define) echo "$sym() found." >&4;;
6826         *) echo "$sym() NOT found." >&4;;
6827         esac;;
6828 esac'
6829
6830 : check for length of double
6831 echo " "
6832 case "$doublesize" in
6833 '')
6834         echo "Checking to see how big your double precision numbers are..." >&4
6835         $cat >try.c <<EOCP
6836 #include <stdio.h>
6837 #$i_stdlib I_STDLIB
6838 #ifdef I_STDLIB
6839 #include <stdlib.h>
6840 #endif
6841 int main()
6842 {
6843     printf("%d\n", (int)sizeof(double));
6844     exit(0);
6845 }
6846 EOCP
6847         set try
6848         if eval $compile_ok; then
6849                 doublesize=`$run ./try`
6850                 echo "Your double is $doublesize bytes long."
6851         else
6852                 dflt='8'
6853                 echo "(I can't seem to compile the test program.  Guessing...)"
6854                 rp="What is the size of a double precision number (in bytes)?"
6855                 . ./myread
6856                 doublesize="$ans"
6857         fi
6858         ;;
6859 esac
6860 $rm_try
6861
6862 : see if this is a float.h system
6863 set float.h i_float
6864 eval $inhdr
6865
6866 : check for long doubles
6867 echo " "
6868 echo "Checking to see if you have long double..." >&4
6869 echo 'int main() { long double x = 7.0; }' > try.c
6870 set try
6871 if eval $compile; then
6872         val="$define"
6873         echo "You have long double."
6874 else
6875         val="$undef"
6876         echo "You do not have long double."
6877 fi
6878 $rm_try
6879 set d_longdbl
6880 eval $setvar
6881
6882 : see if ldexpl exists
6883 set ldexpl d_ldexpl
6884 eval $inlibc
6885
6886 : check for length of long double
6887 case "${d_longdbl}${longdblsize}" in
6888 $define)
6889         echo " "
6890         echo "Checking to see how big your long doubles are..." >&4
6891         $cat >try.c <<'EOCP'
6892 #include <stdio.h>
6893 int main()
6894 {
6895         printf("%d\n", sizeof(long double));
6896 }
6897 EOCP
6898         set try
6899         set try
6900         if eval $compile; then
6901                 longdblsize=`$run ./try`
6902                 echo "Your long doubles are $longdblsize bytes long."
6903         else
6904                 dflt='8'
6905                 echo " "
6906                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6907                 rp="What is the size of a long double (in bytes)?"
6908                 . ./myread
6909                 longdblsize="$ans"
6910         fi
6911         if $test "X$doublesize" = "X$longdblsize"; then
6912                 echo "That isn't any different from an ordinary double."
6913                 echo "I'll keep your setting anyway, but you may see some"
6914                 echo "harmless compilation warnings."
6915         fi
6916         ;;
6917 esac
6918 $rm_try
6919
6920 $echo "Checking the kind of long doubles you have..." >&4
6921 case "$d_longdbl" in
6922 define)
6923 $cat <<EOP >try.c
6924 #$i_float I_FLOAT
6925 #$i_stdlib I_STDLIB
6926 #define LONGDBLSIZE $longdblsize
6927 #define DOUBLESIZE $doublesize
6928 #ifdef I_FLOAT
6929 #include <float.h>
6930 #endif
6931 #ifdef I_STDLIB
6932 #include <stdlib.h>
6933 #endif
6934 #include <stdio.h>
6935 static const long double d = -0.1L;
6936 int main() {
6937   unsigned const char* b = (unsigned const char*)(&d);
6938 #if DOUBLESIZE == LONGDBLSIZE
6939   printf("0\n"); /* if it floats like double */
6940   exit(0);
6941 #endif
6942 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6943   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6944     /* IEEE 754 128-bit little-endian */
6945     printf("1\n");
6946     exit(0);
6947   }
6948   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6949     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6950     printf("2\n");
6951     exit(0);
6952   }
6953 #endif
6954 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6955  * while 64-bits platforms have it in 16 bytes. */
6956 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6957   if (b[0] == 0xCD && b[9] == 0xBF && b[10] == 0x00) {
6958     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6959      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6960      * Also known as "extended precision". */
6961     printf("3\n");
6962     exit(0);
6963   }
6964   if (b[0] == 0xBF && b[9] == 0xCD && b[10] == 0x00) {
6965     /* is there ever big-endian 80-bit, really? */
6966     printf("4\n");
6967     exit(0);
6968   }
6969 #endif
6970 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
6971   /* software "double double", the 106 is 53+53.
6972    * but irix thinks it is 107. */
6973   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
6974     /* double double 128-bit little-endian,
6975      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
6976     printf("5\n");
6977     exit(0);
6978   }
6979   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
6980     /* double double 128-bit big-endian, e.g. PPC/Power and MIPS:
6981      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
6982     printf("6\n");
6983     exit(0);
6984   }
6985 #endif
6986   printf("-1\n"); /* unknown */
6987   exit(0);
6988 }
6989 EOP
6990 set try
6991 if eval $compile; then
6992     longdblkind=`$run ./try`
6993 else
6994     longdblkind=-1
6995 fi
6996 ;;
6997 *) longdblkind=0 ;;
6998 esac
6999 case "$longdblkind" in
7000 0) echo "Your long doubles are doubles." >&4 ;;
7001 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7002 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7003 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
7004 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
7005 5) echo "You have 128-bit little-endian double-double long doubles." >& 4 ;;
7006 6) echo "You have 128-bit big-endian double-double long doubles." >& 4 ;;
7007 *) echo "Cannot figure out your long double." >&4 ;;
7008 esac
7009 $rm_try
7010
7011 : determine the architecture name
7012 echo " "
7013 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7014         tarch=`arch`"-$osname"
7015 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7016         if uname -m > tmparch 2>&1 ; then
7017                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7018                         -e 's/$/'"-$osname/" tmparch`
7019         else
7020                 tarch="$osname"
7021         fi
7022         $rm -f tmparch
7023 else
7024         tarch="$osname"
7025 fi
7026 case "$myarchname" in
7027 ''|"$tarch") ;;
7028 *)
7029         echo "(Your architecture name used to be $myarchname.)"
7030         archname=''
7031         ;;
7032 esac
7033 case "$targetarch" in
7034 '') ;;
7035 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7036 esac
7037 myarchname="$tarch"
7038 case "$archname" in
7039 '') dflt="$tarch";;
7040 *) dflt="$archname";;
7041 esac
7042 rp='What is your architecture name'
7043 . ./myread
7044 archname="$ans"
7045
7046 : optionally add API version to the architecture for versioned archlibs
7047 case "$useversionedarchname" in
7048 $define|true|[yY]*) dflt='y';;
7049 *)                  dflt='n';;
7050 esac
7051 rp='Add the Perl API version to your archname?'
7052 . ./myread
7053 case "$ans" in
7054 y|Y)    useversionedarchname="$define" ;;
7055 *)      useversionedarchname="$undef" ;;
7056 esac
7057 case "$useversionedarchname" in
7058 $define)
7059         case "$archname" in
7060         *-$api_versionstring)
7061                 echo "...and architecture name already has -$api_versionstring" >&4
7062                 ;;
7063         *)
7064                 archname="$archname-$api_versionstring"
7065                 echo "...setting architecture name to $archname." >&4
7066                 ;;
7067         esac
7068         ;;
7069 esac
7070
7071 case "$usethreads" in
7072 $define)
7073         echo "Threads selected." >&4
7074         case "$archname" in
7075         *-thread*) echo "...and architecture name already has -thread." >&4
7076                 ;;
7077         *)      archname="$archname-thread"
7078                 echo "...setting architecture name to $archname." >&4
7079                 ;;
7080         esac
7081         ;;
7082 esac
7083 case "$usemultiplicity" in
7084 $define)
7085         echo "Multiplicity selected." >&4
7086         case "$archname" in
7087         *-multi*) echo "...and architecture name already has -multi." >&4
7088                 ;;
7089         *)      archname="$archname-multi"
7090                 echo "...setting architecture name to $archname." >&4
7091                 ;;
7092         esac
7093         ;;
7094 esac
7095 case "$use64bitint$use64bitall" in
7096 *"$define"*)
7097         case "$archname64" in
7098         '')
7099                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7100                 ;;
7101         *)
7102                 case "$use64bitint" in
7103                 "$define") echo "64 bit integers selected." >&4 ;;
7104                 esac
7105                 case "$use64bitall" in
7106                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7107                 esac
7108                 case "$archname" in
7109                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7110                         ;;
7111                 *)      archname="$archname-$archname64"
7112                         echo "...setting architecture name to $archname." >&4
7113                         ;;
7114                 esac
7115                 ;;
7116         esac
7117 esac
7118 case "$uselongdouble" in
7119 $define)
7120         echo "Long doubles selected." >&4
7121         case "$longdblsize" in
7122         $doublesize)
7123                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7124                 ;;
7125         *)
7126                 case "$archname" in
7127                 *-ld*) echo "...and architecture name already has -ld." >&4
7128                         ;;
7129                 *)      archname="$archname-ld"
7130                         echo "...setting architecture name to $archname." >&4
7131                         ;;
7132                 esac
7133                 ;;
7134         esac
7135         ;;
7136 esac
7137 case "$usequadmath" in
7138 $define)
7139         echo "quadmath selected." >&4
7140         case "$archname" in
7141         *-ld*) echo "...and architecture name already has -quadmath." >&4
7142                 ;;
7143         *)      archname="$archname-quadmath"
7144                 echo "...setting architecture name to $archname." >&4
7145                 ;;
7146         esac
7147         ;;
7148 esac
7149 if $test -f archname.cbu; then
7150         echo "Your platform has some specific hints for architecture name, using them..."
7151         . ./archname.cbu
7152 fi
7153
7154 : set the prefixit variable, to compute a suitable default value
7155 prefixit='case "$3" in
7156 ""|none)
7157         case "$oldprefix" in
7158         "") eval "$1=\"\$$2\"";;
7159         *)
7160                 case "$3" in
7161                 "") eval "$1=";;
7162                 none)
7163                         eval "tp=\"\$$2\"";
7164                         case "$tp" in
7165                         ""|" ") eval "$1=\"\$$2\"";;
7166                         *) eval "$1=";;
7167                         esac;;
7168                 esac;;
7169         esac;;
7170 *)
7171         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7172         case "$tp" in
7173         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7174         /*-$oldprefix/*|\~*-$oldprefix/*)
7175                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7176         *) eval "$1=\"\$$2\"";;
7177         esac;;
7178 esac'
7179
7180 : determine installation style
7181 : For now, try to deduce it from prefix unless it is already set.
7182 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7183 case "$installstyle" in
7184 '')     case "$prefix" in
7185                 *perl*) dflt='lib';;
7186                 *) dflt='lib/perl5' ;;
7187         esac
7188         ;;
7189 *)      dflt="$installstyle" ;;
7190 esac
7191 : Probably not worth prompting for this since we prompt for all
7192 : the directories individually, and the prompt would be too long and
7193 : confusing anyway.
7194 installstyle=$dflt
7195
7196 : determine where public executables go
7197 echo " "
7198 set dflt bin bin
7199 eval $prefixit
7200 fn=d~
7201 rp='Pathname where the public executables will reside?'
7202 . ./getfile
7203 if $test "X$ansexp" != "X$binexp"; then
7204         installbin=''
7205 fi
7206 prefixvar=bin
7207 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7208 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7209 :     this via initialinstalllocation
7210 . ./setprefixvar
7211
7212 case "$userelocatableinc" in
7213 $define|true|[yY]*)     dflt='y' ;;
7214 *)                      dflt='n' ;;
7215 esac
7216 cat <<EOM
7217
7218 Would you like to build Perl so that the installation is relocatable, so that
7219 library paths in @INC are determined relative to the path of the perl binary?
7220 This is not advised for system Perl installs, or if you need to run setid
7221 scripts or scripts under taint mode.
7222
7223 If this doesn't make any sense to you, just accept the default '$dflt'.
7224 EOM
7225 rp='Use relocatable @INC?'
7226 . ./myread
7227 case "$ans" in
7228 y|Y)    val="$define" ;;
7229 *)      val="$undef"  ;;
7230 esac
7231 set userelocatableinc
7232 eval $setvar
7233
7234 initialinstalllocation="$binexp"
7235 : Default prefix is now "up one level from where the binaries are"
7236 case "$userelocatableinc" in
7237 $define|true|[yY]*)
7238     bin=".../"
7239     binexp=".../"
7240     prefix=".../.."
7241     prefixexp=".../.."
7242     installprefixexp=".../.."
7243     ;;
7244 esac
7245
7246 : determine where private library files go
7247 : Usual default is /usr/local/lib/perl5/$version.
7248 : Also allow things like /opt/perl/lib/$version, since
7249 : /opt/perl/lib/perl5... would be redundant.
7250 : The default "style" setting is made in installstyle.U
7251 case "$installstyle" in
7252 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7253 *)       set dflt privlib lib/$version ;;
7254 esac
7255 eval $prefixit
7256 $cat <<EOM
7257
7258 There are some auxiliary files for $package that need to be put into a
7259 private library directory that is accessible by everyone.
7260
7261 EOM
7262 fn=$binexp
7263 fn=d~+
7264 rp='Pathname where the private library files will reside?'
7265 . ./getfile
7266 prefixvar=privlib
7267 . ./setprefixvar
7268
7269 : set the prefixup variable, to restore leading tilda escape
7270 prefixup='case "$prefixexp" in
7271 "$prefix") ;;
7272 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7273 esac'
7274
7275 : determine where public architecture dependent libraries go
7276 set archlib archlib
7277 eval $prefixit
7278 : privlib default is /usr/local/lib/$package/$version
7279 : archlib default is /usr/local/lib/$package/$version/$archname
7280 : privlib may have an optional trailing /share.
7281 tdflt=`echo $privlib | $sed 's,/share$,,'`
7282 tdflt=$tdflt/$archname
7283 case "$archlib" in
7284 '')     dflt=$tdflt
7285         ;;
7286 *)      dflt="$archlib"
7287     ;;
7288 esac
7289 $cat <<EOM
7290
7291 $spackage contains architecture-dependent library files.  If you are
7292 sharing libraries in a heterogeneous environment, you might store
7293 these files in a separate location.  Otherwise, you can just include
7294 them with the rest of the public library files.
7295
7296 EOM
7297 fn=$binexp
7298 fn=d+~
7299 rp='Where do you want to put the public architecture-dependent libraries?'
7300 . ./getfile
7301 prefixvar=archlib
7302 . ./setprefixvar
7303 if $test X"$archlib" = X"$privlib"; then
7304         d_archlib="$undef"
7305 else
7306         d_archlib="$define"
7307 fi
7308
7309 : see if setuid scripts can be secure
7310 $cat <<EOM
7311
7312 Some kernels have a bug that prevents setuid #! scripts from being
7313 secure.  Some sites have disabled setuid #! scripts because of this.
7314
7315 First let's decide if your kernel supports secure setuid #! scripts.
7316 (If setuid #! scripts would be secure but have been disabled anyway,
7317 don't say that they are secure if asked.)
7318
7319 EOM
7320
7321 val="$undef"
7322 if $test -d /dev/fd; then
7323         echo "#!$ls" >reflect
7324         chmod +x,u+s reflect
7325         ./reflect >flect 2>&1
7326         if $contains "/dev/fd" flect >/dev/null; then
7327                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7328                 val="$define"
7329         else
7330                 $cat <<EOM
7331 If you are not sure if they are secure, I can check but I'll need a
7332 username and password different from the one you are using right now.
7333 If you don't have such a username or don't want me to test, simply
7334 enter 'none'.
7335
7336 EOM
7337                 rp='Other username to test security of setuid scripts with?'
7338                 dflt='none'
7339                 . ./myread
7340                 case "$ans" in
7341                 n|none)
7342                         case "$d_suidsafe" in
7343                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7344                                 dflt=n;;
7345                         "$undef")
7346                                 echo "Well, the $hint value is *not* secure." >&4
7347                                 dflt=n;;
7348                         *)      echo "Well, the $hint value *is* secure." >&4
7349                                 dflt=y;;
7350                         esac
7351                         ;;
7352                 *)
7353                         $rm -f reflect flect
7354                         echo "#!$ls" >reflect
7355                         chmod +x,u+s reflect
7356                         echo >flect
7357                         chmod a+w flect
7358                         echo '"su" will (probably) prompt you for '"$ans's password."
7359                         su $ans -c './reflect >flect'
7360                         if $contains "/dev/fd" flect >/dev/null; then
7361                                 echo "Okay, it looks like setuid scripts are secure." >&4
7362                                 dflt=y
7363                         else
7364                                 echo "I don't think setuid scripts are secure." >&4
7365                                 dflt=n
7366                         fi
7367                         ;;
7368                 esac
7369                 rp='Does your kernel have *secure* setuid scripts?'
7370                 . ./myread
7371                 case "$ans" in
7372                 [yY]*)  val="$define";;
7373                 *)      val="$undef";;
7374                 esac
7375         fi
7376 else
7377         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7378         echo "(That's for file descriptors, not floppy disks.)"
7379         val="$undef"
7380 fi
7381 set d_suidsafe
7382 eval $setvar
7383
7384 $rm -f reflect flect
7385
7386 : now see if they want to do setuid emulation
7387 if $test $patchlevel -lt 11; then
7388 echo " "
7389 val="$undef"
7390 case "$d_suidsafe" in
7391 "$define")
7392         val="$undef"
7393         echo "No need to emulate SUID scripts since they are secure here." >&4
7394         ;;
7395 *)
7396         $cat <<EOM
7397 Some systems have disabled setuid scripts, especially systems where
7398 setuid scripts cannot be secure.  On systems where setuid scripts have
7399 been disabled, the setuid/setgid bits on scripts are currently
7400 useless.  It is possible for $package to detect those bits and emulate
7401 setuid/setgid in a secure fashion.  This emulation will only work if
7402 setuid scripts have been disabled in your kernel.
7403
7404 EOM
7405         case "$d_dosuid" in
7406         "$define") dflt=y ;;
7407         *) dflt=n ;;
7408         esac
7409         rp="Do you want to do setuid/setgid emulation?"
7410         . ./myread
7411         case "$ans" in
7412         [yY]*)  val="$define";;
7413         *)      val="$undef";;
7414         esac
7415         ;;
7416 esac
7417 set d_dosuid
7418 eval $setvar
7419 else
7420     case "$d_dosuid" in
7421         "$define")
7422         cat >&4 <<EOH
7423
7424 SUID emulation has been removed for 5.12
7425 Please re-run Configure without -Dd_dosuid
7426
7427 EOH
7428         exit 1;
7429         ;;
7430     esac
7431     d_dosuid=undef
7432 fi
7433
7434 : Find perl5.005 or later.
7435 echo "Looking for a previously installed perl5.005 or later... "
7436 case "$perl5" in
7437 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7438                 : Check if this perl is recent and can load a simple module
7439                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7440                         perl5=$tdir/perl
7441                         break;
7442                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7443                         perl5=$tdir/perl5
7444                         break;
7445                 fi
7446         done
7447         ;;
7448 *)      perl5="$perl5"
7449         ;;
7450 esac
7451 case "$perl5" in
7452 '')     echo "None found.  That's ok.";;
7453 *)      echo "Using $perl5." ;;
7454 esac
7455
7456 : Set the siteprefix variables
7457 $cat <<EOM
7458
7459 After $package is installed, you may wish to install various
7460 add-on modules and utilities.  Typically, these add-ons will
7461 be installed under $prefix with the rest
7462 of this package.  However, you may wish to install such add-ons
7463 elsewhere under a different prefix.
7464
7465 If you do not wish to put everything under a single prefix, that's
7466 ok.  You will be prompted for the individual locations; this siteprefix
7467 is only used to suggest the defaults.
7468
7469 The default should be fine for most people.
7470
7471 EOM
7472 fn=d~+
7473 rp='Installation prefix to use for add-on modules and utilities?'
7474 : XXX Here might be another good place for an installstyle setting.
7475 case "$siteprefix" in
7476 '') dflt=$prefix ;;
7477 *)  dflt=$siteprefix ;;
7478 esac
7479 . ./getfile
7480 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7481 oldsiteprefix=''
7482 case "$siteprefix" in
7483 '') ;;
7484 *)      case "$ans" in
7485         "$prefix") ;;
7486         *) oldsiteprefix="$prefix";;
7487         esac
7488         ;;
7489 esac
7490 siteprefix="$ans"
7491 siteprefixexp="$ansexp"
7492
7493 : determine where site specific libraries go.
7494 : Usual default is /usr/local/lib/perl5/site_perl/$version
7495 : The default "style" setting is made in installstyle.U
7496 : XXX No longer works with Prefixit stuff.
7497 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7498 case "$sitelib" in
7499 '') case "$installstyle" in
7500         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7501         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7502         esac
7503         ;;
7504 *)      dflt="$sitelib"
7505         ;;
7506 esac
7507 $cat <<EOM
7508
7509 The installation process will create a directory for
7510 site-specific extensions and modules.  Most users find it convenient
7511 to place all site-specific files in this directory rather than in the
7512 main distribution directory.
7513
7514 EOM
7515 fn=d~+
7516 rp='Pathname for the site-specific library files?'
7517 . ./getfile
7518 prefixvar=sitelib
7519 . ./setprefixvar
7520 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7521
7522 : Determine list of previous versions to include in @INC
7523 $cat > getverlist <<EOPL
7524 #!$perl5 -w
7525 use File::Basename;
7526 \$api_versionstring = "$api_versionstring";
7527 \$version = "$version";
7528 \$stem = "$sitelib_stem";
7529 \$archname = "$archname";
7530 EOPL
7531         $cat >> getverlist <<'EOPL'
7532 # The list found is store twice for each entry: the original name, and
7533 # the binary broken down version as pack "sss", so sorting is easy and
7534 # unambiguous. This will work for all versions that have a maximum of
7535 # three digit groups, separate by '.'s or '_'s. Names are extended with
7536 # ".0.0" to ensure at least three elements for the pack.
7537 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7538
7539 # Can't have leading @ because metaconfig interprets it as a command!
7540 ;@inc_version_list=();
7541 # XXX Redo to do opendir/readdir?
7542 if (-d $stem) {
7543     chdir($stem);
7544     ;@candidates = map {
7545         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7546     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7547 }
7548 else {
7549     ;@candidates = ();
7550 }
7551
7552 ($pversion, $aversion, $vsn5005) = map {
7553     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7554 foreach $d (@candidates) {
7555     if ($d->[1] lt $pversion) {
7556         if ($d->[1] ge $aversion) {
7557             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7558         }
7559         elsif ($d->[1] ge $vsn5005) {
7560             unshift(@inc_version_list, grep { -d } $d->[0]);
7561         }
7562     }
7563     else {
7564         # Skip newer version.  I.e. don't look in
7565         # 5.7.0 if we're installing 5.6.1.
7566     }
7567 }
7568
7569 if (@inc_version_list) {
7570     print join(' ', @inc_version_list);
7571 }
7572 else {
7573     # Blank space to preserve value for next Configure run.
7574     print " ";
7575 }
7576 EOPL
7577 chmod +x getverlist
7578 case "$inc_version_list" in
7579 '')     if test -x "$perl5$exe_ext"; then
7580                 dflt=`$perl5 getverlist`
7581         else
7582                 dflt='none'
7583         fi
7584         ;;
7585 $undef) dflt='none' ;;
7586 *)  eval dflt=\"$inc_version_list\" ;;
7587 esac
7588 case "$dflt" in
7589 ''|' ') dflt=none ;;
7590 esac
7591 case "$dflt" in
7592 5.005) dflt=none ;;
7593 esac
7594 $cat <<EOM
7595
7596 In order to ease the process of upgrading, this version of perl
7597 can be configured to use modules built and installed with earlier
7598 versions of perl that were installed under $prefix.  Specify here
7599 the list of earlier versions that this version of perl should check.
7600 If Configure detected no earlier versions of perl installed under
7601 $prefix, then the list will be empty.  Answer 'none' to tell perl
7602 to not search earlier versions.
7603
7604 The default should almost always be sensible, so if you're not sure,
7605 just accept the default.
7606 EOM
7607
7608 rp='List of earlier versions to include in @INC?'
7609 . ./myread
7610 case "$ans" in
7611 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7612 *) inc_version_list="$ans" ;;
7613 esac
7614 case "$inc_version_list" in
7615 ''|' ')
7616         inc_version_list_init='0'
7617         d_inc_version_list="$undef"
7618         ;;
7619 *)      inc_version_list_init=`echo $inc_version_list |
7620                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7621         d_inc_version_list="$define"
7622         ;;
7623 esac
7624 $rm -f getverlist
7625
7626 : see if malloc/malloc.h has to be included
7627 set malloc/malloc.h i_mallocmalloc
7628 eval $inhdr
7629
7630 : see if this is a malloc.h system
7631 : we want a real compile instead of Inhdr because some systems have a
7632 : malloc.h that just gives a compile error saying to use stdlib.h instead
7633 echo " "
7634 $cat >try.c <<EOCP
7635 #include <stdlib.h>
7636 #include <malloc.h>
7637 #$i_mallocmalloc I_MALLOCMALLOC
7638 #ifdef I_MALLOCMALLOC
7639 # include <malloc/malloc.h>
7640 #endif
7641
7642 int main () { return 0; }
7643 EOCP
7644 set try
7645 if eval $compile; then
7646     echo "<malloc.h> found." >&4
7647     val="$define"
7648 else
7649     echo "<malloc.h> NOT found." >&4
7650     val="$undef"
7651 fi
7652 $rm_try
7653 set i_malloc
7654 eval $setvar
7655
7656 : check for length of pointer
7657 echo " "
7658 case "$ptrsize" in
7659 '')
7660         echo "Checking to see how big your pointers are..." >&4
7661         $cat >try.c <<EOCP
7662 #include <stdio.h>
7663 #$i_stdlib I_STDLIB
7664 #ifdef I_STDLIB
7665 #include <stdlib.h>
7666 #endif
7667 int main()
7668 {
7669     printf("%d\n", (int)sizeof(void *));
7670     exit(0);
7671 }
7672 EOCP
7673         set try
7674         if eval $compile_ok; then
7675                 ptrsize=`$run ./try`
7676                 echo "Your pointers are $ptrsize bytes long."
7677         else
7678                 dflt='4'
7679                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7680                 rp="What is the size of a pointer (in bytes)?"
7681                 . ./myread
7682                 ptrsize="$ans"
7683         fi
7684         ;;
7685 esac
7686 $rm_try
7687 case "$use64bitall" in
7688 "$define"|true|[yY]*)
7689         case "$ptrsize" in
7690         4)      cat <<EOM >&4
7691
7692 *** You have chosen a maximally 64-bit build,
7693 *** but your pointers are only 4 bytes wide.
7694 *** Please rerun Configure without -Duse64bitall.
7695 EOM
7696                 case "$d_quad" in
7697                 define)
7698                         cat <<EOM >&4
7699 *** Since you have quads, you could possibly try with -Duse64bitint.
7700 EOM
7701                         ;;
7702                 esac
7703                 cat <<EOM >&4
7704 *** Cannot continue, aborting.
7705
7706 EOM
7707
7708                 exit 1
7709                 ;;
7710         esac
7711         ;;
7712 esac
7713
7714
7715 : determine whether to use malloc wrapping
7716 echo " "
7717 case "$usemallocwrap" in
7718 [yY]*|true|$define)     dflt='y' ;;
7719 [nN]*|false|$undef)     dflt='n' ;;
7720 *)      case "$usedevel" in
7721         [yY]*|true|$define)     dflt='y' ;;
7722         *) dflt='n' ;;
7723         esac
7724         ;;
7725 esac
7726 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7727 . ./myread
7728 usemallocwrap="$ans"
7729 case "$ans" in
7730 y*|true)
7731         usemallocwrap="$define" ;;
7732 *)
7733         usemallocwrap="$undef" ;;
7734 esac
7735
7736 : determine which malloc to compile in
7737 echo " "
7738 case "$usemymalloc" in
7739 [yY]*|true|$define)     dflt='y' ;;
7740 [nN]*|false|$undef)     dflt='n' ;;
7741 *)      case "$ptrsize" in
7742         4) dflt='y' ;;
7743         *) dflt='n' ;;
7744         esac
7745         if test "$useithreads" = "$define"; then dflt='n'; fi
7746         ;;
7747 esac
7748 rp="Do you wish to attempt to use the malloc that comes with $package?"
7749 . ./myread
7750 usemymalloc="$ans"
7751 case "$ans" in
7752 y*|true)
7753         usemymalloc='y'
7754         mallocsrc='malloc.c'
7755         mallocobj="malloc$_o"
7756         d_mymalloc="$define"
7757         case "$libs" in
7758         *-lmalloc*)
7759                 : Remove malloc from list of libraries to use
7760                 echo "Removing unneeded -lmalloc from library list" >&4
7761                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7762                 shift
7763                 libs="$*"
7764                 echo "libs = $libs" >&4
7765                 ;;
7766         esac
7767         ;;
7768 *)
7769         usemymalloc='n'
7770         mallocsrc=''
7771         mallocobj=''
7772         d_mymalloc="$undef"
7773         ;;
7774 esac
7775
7776 : compute the return types of malloc and free
7777 echo " "
7778 $cat >malloc.c <<END
7779 #$i_malloc I_MALLOC
7780 #$i_stdlib I_STDLIB
7781 #include <stdio.h>
7782 #include <sys/types.h>
7783 #ifdef I_MALLOC
7784 #include <malloc.h>
7785 #endif
7786 #ifdef I_STDLIB
7787 #include <stdlib.h>
7788 #endif
7789 #ifdef TRY_MALLOC
7790 void *malloc();
7791 #endif
7792 #ifdef TRY_FREE
7793 void free();
7794 #endif
7795 END
7796 case "$malloctype" in
7797 '')
7798         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7799                 malloctype='void *'
7800         else
7801                 malloctype='char *'
7802         fi
7803         ;;
7804 esac
7805 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7806
7807 case "$freetype" in
7808 '')
7809         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7810                 freetype='void'
7811         else
7812                 freetype='int'
7813         fi
7814         ;;
7815 esac
7816 echo "Your system uses $freetype free(), it would seem." >&4
7817 $rm -f malloc.[co]
7818 : determine where site specific architecture-dependent libraries go.
7819 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7820 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7821 : sitelib may have an optional trailing /share.
7822 case "$sitearch" in
7823 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7824         dflt="$dflt/$archname"
7825         ;;
7826 *)      dflt="$sitearch"
7827         ;;
7828 esac
7829 set sitearch sitearch none
7830 eval $prefixit
7831 $cat <<EOM
7832
7833 The installation process will also create a directory for
7834 architecture-dependent site-specific extensions and modules.
7835
7836 EOM
7837 fn=d~+
7838 rp='Pathname for the site-specific architecture-dependent library files?'
7839 . ./getfile
7840 prefixvar=sitearch
7841 . ./setprefixvar
7842 if $test X"$sitearch" = X"$sitelib"; then
7843         d_sitearch="$undef"
7844 else
7845         d_sitearch="$define"
7846 fi
7847
7848 : Set the vendorprefix variables
7849 $cat <<EOM
7850
7851 The installation process will also create a directory for
7852 vendor-supplied add-ons.  Vendors who supply perl with their system
7853 may find it convenient to place all vendor-supplied files in this
7854 directory rather than in the main distribution directory.  This will
7855 ease upgrades between binary-compatible maintenance versions of perl.
7856
7857 Of course you may also use these directories in whatever way you see
7858 fit.  For example, you might use them to access modules shared over a
7859 company-wide network.
7860
7861 The default answer should be fine for most people.
7862 This causes further questions about vendor add-ons to be skipped
7863 and no vendor-specific directories will be configured for perl.
7864
7865 EOM
7866 rp='Do you want to configure vendor-specific add-on directories?'
7867 case "$usevendorprefix" in
7868 define|true|[yY]*) dflt=y ;;
7869 *)      : User may have set vendorprefix directly on Configure command line.
7870         case "$vendorprefix" in
7871         ''|' ') dflt=n ;;
7872         *)      dflt=y ;;
7873         esac
7874         ;;
7875 esac
7876 . ./myread
7877 case "$ans" in
7878 [yY]*)  fn=d~+
7879         rp='Installation prefix to use for vendor-supplied add-ons?'
7880         case "$vendorprefix" in
7881         '') dflt="$prefix" ;;
7882         *)  dflt=$vendorprefix ;;
7883         esac
7884         . ./getfile
7885         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7886         oldvendorprefix=''
7887         case "$vendorprefix" in
7888         '') ;;
7889         *)      case "$ans" in
7890                 "$prefix") ;;
7891                 *) oldvendorprefix="$prefix";;
7892                 esac
7893                 ;;
7894         esac
7895         usevendorprefix="$define"
7896         vendorprefix="$ans"
7897         vendorprefixexp="$ansexp"
7898         ;;
7899 *)      usevendorprefix="$undef"
7900         vendorprefix=''
7901         vendorprefixexp=''
7902         ;;
7903 esac
7904
7905 : Set the vendorlib variables
7906 case "$vendorprefix" in
7907 '')     d_vendorlib="$undef"
7908         vendorlib=''
7909         vendorlibexp=''
7910         ;;
7911 *)      d_vendorlib="$define"
7912         : determine where vendor-supplied modules go.
7913         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7914         case "$vendorlib" in
7915         '')
7916                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7917                 case "$installstyle" in
7918                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7919                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7920                 esac
7921                 ;;
7922         *)      dflt="$vendorlib"
7923                 ;;
7924         esac
7925         fn=d~+
7926         rp='Pathname for the vendor-supplied library files?'
7927         . ./getfile
7928         vendorlib="$ans"
7929         vendorlibexp="$ansexp"
7930         ;;
7931 esac
7932 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7933 prefixvar=vendorlib
7934 . ./installprefix
7935
7936 : Set the vendorarch variables
7937 case "$vendorprefix" in
7938 '')     d_vendorarch="$undef"
7939         vendorarch=''
7940         vendorarchexp=''
7941         ;;
7942 *)      d_vendorarch="$define"
7943         : determine where vendor-supplied architecture-dependent libraries go.
7944         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7945         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7946         : vendorlib may have an optional trailing /share.
7947         case "$vendorarch" in
7948         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7949                 dflt="$dflt/$archname"
7950                 ;;
7951         *)      dflt="$vendorarch" ;;
7952         esac
7953         fn=d~+
7954         rp='Pathname for vendor-supplied architecture-dependent files?'
7955         . ./getfile
7956         vendorarch="$ans"
7957         vendorarchexp="$ansexp"
7958         ;;
7959 esac
7960 prefixvar=vendorarch
7961 . ./installprefix
7962 if $test X"$vendorarch" = X"$vendorlib"; then
7963         d_vendorarch="$undef"
7964 else
7965         d_vendorarch="$define"
7966 fi
7967
7968 : Final catch-all directories to search
7969 $cat <<EOM
7970
7971 Lastly, you can have perl look in other directories for extensions and
7972 modules in addition to those already specified.
7973 These directories will be searched after
7974         $sitearch
7975         $sitelib
7976 EOM
7977 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7978 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7979 echo ' '
7980 case "$otherlibdirs" in
7981 ''|' ') dflt='none' ;;
7982 *)      dflt="$otherlibdirs" ;;
7983 esac
7984 $cat <<EOM
7985 Enter a colon-separated set of extra paths to include in perl's @INC
7986 search path, or enter 'none' for no extra paths.
7987
7988 EOM
7989
7990 rp='Colon-separated list of additional directories for perl to search?'
7991 . ./myread
7992 case "$ans" in
7993 ' '|''|none)    otherlibdirs=' ' ;;
7994 *)      otherlibdirs="$ans" ;;
7995 esac
7996 case "$otherlibdirs" in
7997 ' ') val=$undef ;;
7998 *)      val=$define ;;
7999 esac
8000 set d_perl_otherlibdirs
8001 eval $setvar
8002
8003 : Cruising for prototypes
8004 echo " "
8005 echo "Checking out function prototypes..." >&4
8006 $cat >prototype.c <<EOCP
8007 #$i_stdlib I_STDLIB
8008 #ifdef I_STDLIB
8009 #include <stdlib.h>
8010 #endif
8011 int main(int argc, char *argv[]) {
8012         exit(0);}
8013 EOCP
8014 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
8015         echo "Your C compiler appears to support function prototypes."
8016         val="$define"
8017 else
8018         echo "Your C compiler doesn't seem to understand function prototypes."
8019         val="$undef"
8020 fi
8021 set prototype
8022 eval $setvar
8023 $rm -f prototype*
8024
8025 : Check if ansi2knr is required
8026 case "$prototype" in
8027 "$define") ;;
8028 *)      ansi2knr='ansi2knr'
8029         echo " "
8030         cat <<EOM >&4
8031
8032 $me:  FATAL ERROR:
8033 This version of $package can only be compiled by a compiler that
8034 understands function prototypes.  Unfortunately, your C compiler
8035         $cc $ccflags
8036 doesn't seem to understand them.  Sorry about that.
8037
8038 If GNU cc is available for your system, perhaps you could try that instead.
8039
8040 Eventually, we hope to support building Perl with pre-ANSI compilers.
8041 If you would like to help in that effort, please contact <perlbug@perl.org>.
8042
8043 Aborting Configure now.
8044 EOM
8045         exit 2
8046         ;;
8047 esac
8048
8049 : DTrace support
8050 dflt_dtrace='/usr/sbin/dtrace'
8051 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8052
8053 cat <<EOM
8054
8055 Perl can be built to support DTrace on platforms that support it.
8056 DTrace is a diagnosis and performance analysis tool from Sun.
8057
8058 If this doesn't make any sense to you, just accept the default.
8059 EOM
8060
8061 while $test 1 ; do
8062         case "$usedtrace" in
8063         $define|true|[yY]*)
8064                 dflt='y'
8065                 ;;
8066         ?*)
8067                 dflt='y'
8068                 dflt_dtrace=$usedtrace
8069                 ;;
8070         *)
8071                 dflt='n'
8072                 ;;
8073         esac
8074
8075         rp='Support DTrace if available?'
8076         . ./myread
8077         case "$ans" in
8078         y|Y)    val="$define" ;;
8079         *)      val="$undef" ;;
8080         esac
8081         set usedtrace
8082         eval $setvar
8083
8084         test "X$usedtrace" != "X$define" && break
8085
8086         echo " "
8087         rp='Where is the dtrace executable?'
8088         dflt=$dflt_dtrace
8089         . ./getfile
8090         val="$ans"
8091         set dtrace
8092         eval $setvar
8093
8094         if $test -f $dtrace
8095         then
8096                 if $dtrace -h -s ../perldtrace.d \
8097                         -o perldtrace.tmp >/dev/null 2>&1 \
8098                         && rm -f perldtrace.tmp
8099                 then
8100                         echo " "
8101                         echo "Good: your $dtrace knows about the -h flag."
8102                 else
8103                         cat >&2 <<EOM
8104
8105 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8106 ***
8107 *** Your installed dtrace doesn't support the -h switch to compile a D
8108 *** program into a C header. Can't continue.
8109
8110 EOM
8111                         exit 1
8112                 fi
8113                 break;
8114         fi
8115
8116         case "$fastread" in
8117         yes)
8118                 cat >&2 <<EOM
8119
8120 *** $me:  Fatal Error:  $dtrace not found.
8121 *** Can't continue.
8122
8123 EOM
8124                 exit 1
8125                 ;;
8126         *)
8127                 echo "*** $dtrace was not found."
8128                 echo " "
8129                 ;;
8130         esac
8131 done
8132
8133 : See if we want extra modules installed
8134 echo " "
8135 case "$extras" in
8136 '') dflt='n';;
8137 *) dflt='y';;
8138 esac
8139 cat <<EOM
8140 Perl can be built with extra modules or bundles of modules which
8141 will be fetched from the CPAN and installed alongside Perl.
8142
8143 Notice that you will need access to the CPAN; either via the Internet,
8144 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8145 be asked later to configure the CPAN.pm module which will in turn do
8146 the installation of the rest of the extra modules or bundles.)
8147
8148 Notice also that if the modules require any external software such as
8149 libraries and headers (the libz library and the zlib.h header for the
8150 Compress::Zlib module, for example) you MUST have any such software
8151 already installed, this configuration process will NOT install such
8152 things for you.
8153
8154 If this doesn't make any sense to you, just accept the default '$dflt'.
8155 EOM
8156 rp='Install any extra modules (y or n)?'
8157 . ./myread
8158 case "$ans" in
8159 y|Y)
8160         cat <<EOM
8161
8162 Please list any extra modules or bundles to be installed from CPAN,
8163 with spaces between the names.  The names can be in any format the
8164 'install' command of CPAN.pm will understand.  (Answer 'none',
8165 without the quotes, to install no extra modules or bundles.)
8166 EOM
8167         rp='Extras?'
8168         dflt="$extras"
8169         . ./myread
8170         extras="$ans"
8171 esac
8172 case "$extras" in
8173 ''|'none')
8174         val=''
8175         $rm -f ../extras.lst
8176         ;;
8177 *)      echo "(Saving the list of extras for later...)"
8178         echo "$extras" > ../extras.lst
8179         val="'$extras'"
8180         ;;
8181 esac
8182 set extras
8183 eval $setvar
8184 echo " "
8185
8186 : determine where html pages for programs go
8187 set html1dir html1dir none
8188 eval $prefixit
8189 $cat <<EOM
8190
8191 If you wish to install html files for programs in $spackage, indicate
8192 the appropriate directory here.  To skip installing html files,
8193 answer "none".
8194 EOM
8195 case "$html1dir" in
8196 ''|none|$undef|' ') dflt=none ;;
8197 *) dflt=$html1dir ;;
8198 esac
8199 fn=dn+~
8200 rp="Directory for the main $spackage html pages?"
8201 . ./getfile
8202 prefixvar=html1dir
8203 . ./setprefixvar
8204 : Use ' ' for none so value is preserved next time through Configure
8205 $test X"$html1dir" = "X" && html1dir=' '
8206
8207 : determine where html pages for libraries and modules go
8208 set html3dir html3dir none
8209 eval $prefixit
8210 $cat <<EOM
8211
8212 If you wish to install html files for modules associated with $spackage,
8213 indicate the appropriate directory here.  To skip installing html files,
8214 answer "none".
8215 EOM
8216 : There is no obvious default.  If they have specified html1dir, then
8217 : try to key off that, possibly changing .../html1 into .../html3.
8218 case "$html3dir" in
8219 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8220 *) dflt=$html3dir ;;
8221 esac
8222 fn=dn+~
8223 rp="Directory for the $spackage module html pages?"
8224 . ./getfile
8225 prefixvar=html3dir
8226 . ./setprefixvar
8227 : Use ' ' for none so value is preserved next time through Configure
8228 $test X"$html3dir" = "X" && html3dir=' '
8229
8230 : determine whether to install perl also as /usr/bin/perl
8231
8232 echo " "
8233 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8234         $cat <<EOM
8235 Many scripts expect perl to be installed as /usr/bin/perl.
8236
8237 If you want to, I can install the perl you are about to compile
8238 as /usr/bin/perl (in addition to $bin/perl).
8239 EOM
8240         if test -f /usr/bin/perl; then
8241             $cat <<EOM
8242
8243 However, please note that because you already have a /usr/bin/perl,
8244 overwriting that with a new Perl would very probably cause problems.
8245 Therefore I'm assuming you don't want to do that (unless you insist).
8246
8247 EOM
8248             case "$installusrbinperl" in
8249             "$define"|[yY]*)    dflt='y';;
8250             *)                  dflt='n';;
8251             esac
8252         else
8253             $cat <<EOM
8254
8255 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8256
8257 EOM
8258             case "$installusrbinperl" in
8259             "$undef"|[nN]*)     dflt='n';;
8260             *)                  dflt='y';;
8261             esac
8262         fi
8263         rp="Do you want to install perl as /usr/bin/perl?"
8264         . ./myread
8265         case "$ans" in
8266         [yY]*)  val="$define";;
8267         *)      val="$undef" ;;
8268         esac
8269 else
8270         val="$undef"
8271 fi
8272 set installusrbinperl
8273 eval $setvar
8274
8275 : see if dlopen exists
8276 xxx_runnm="$runnm"
8277 xxx_ccflags="$ccflags"
8278 runnm=false
8279 : with g++ one needs -shared to get is-in-libc to work for dlopen
8280 case "$gccversion" in
8281 '')     ;;
8282 *Clang*)        ;;
8283 *)      case "$d_cplusplus" in
8284         "$define") ccflags="$ccflags -shared" ;;
8285         esac
8286         ;;
8287 esac
8288 set dlopen d_dlopen
8289 eval $inlibc
8290 runnm="$xxx_runnm"
8291 ccflags="$xxx_ccflags"
8292
8293 : see if this is a unistd.h system
8294 set unistd.h i_unistd
8295 eval $inhdr
8296
8297 : determine which dynamic loading, if any, to compile in
8298 echo " "
8299 dldir="ext/DynaLoader"
8300 case "$usedl" in
8301     $define|y|true)
8302         dflt='y'
8303         usedl="$define"
8304         ;;
8305     $undef|n|false)
8306         dflt='n'
8307         usedl="$undef"
8308         ;;
8309     *)
8310         dflt='n'
8311         case "$d_dlopen" in
8312             $define) dflt='y' ;;
8313         esac
8314         : Does a dl_xxx.xs file exist for this operating system
8315         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8316         ;;
8317 esac
8318 rp="Do you wish to use dynamic loading?"
8319 . ./myread
8320 usedl="$ans"
8321 bin_ELF="$undef"
8322 case "$ans" in
8323     y*) usedl="$define"
8324         case "$dlsrc" in
8325             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8326                     dflt="$dldir/dl_${osname}.xs"
8327                 elif $test "$d_dlopen" = "$define" ; then
8328                     dflt="$dldir/dl_dlopen.xs"
8329                 else
8330                     dflt=''
8331                 fi
8332                 ;;
8333             *)  dflt="$dldir/$dlsrc"
8334                 ;;
8335         esac
8336         echo "The following dynamic loading files are available:"
8337         : Can not go over to $dldir because getfile has path hard-coded in.
8338         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8339         rp="Source file to use for dynamic loading"
8340         fn="fne"
8341         gfpth="$src"
8342         . ./getfile
8343         usedl="$define"
8344         : emulate basename
8345         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8346
8347         $cat << EOM
8348
8349 Some systems may require passing special flags to $cc -c to
8350 compile modules that will be used to create a shared library.
8351 To use no flags, say "none".
8352
8353 EOM
8354         case "$cccdlflags" in
8355             '') case "$gccversion" in
8356                 '') case "$osname" in
8357                         hpux)   dflt='+z' ;;
8358                         irix*)  dflt='-KPIC' ;;
8359                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8360                         sunos)  dflt='-pic' ;;
8361                         *)      dflt='none' ;;
8362                     esac
8363                     ;;
8364                 *)  case "$osname" in
8365                         darwin) dflt='none' ;;
8366                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8367                         *)      dflt='-fpic' ;;
8368                     esac ;;
8369                 esac ;;
8370             ' ') dflt='none' ;;
8371             *)   dflt="$cccdlflags" ;;
8372         esac
8373
8374         case "$dflt" in
8375             none) dflt='' ;;
8376         esac
8377
8378         # If -Dsysroot was specified, now's the time to add it
8379         # to cccdlflags
8380         if test "X$sysroot" != X; then
8381             case "$gccversion" in
8382                 '') ;;
8383                 *)  case "$dflt" in
8384                         *sysroot*) ;;
8385                         'undef'|*)
8386                             dflt="$dflt --sysroot=$sysroot" ;;
8387                     esac
8388                     ;;
8389             esac
8390         fi
8391
8392         case "$dflt" in
8393             '') dflt='none';;
8394         esac
8395
8396         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8397         . ./myread
8398         case "$ans" in
8399             none) cccdlflags=' ' ;;
8400             *)    cccdlflags="$ans" ;;
8401         esac
8402
8403         cat << EOM
8404
8405 Some systems use ld to create libraries that can be dynamically loaded,
8406 while other systems (such as those using ELF) use $cc.
8407
8408 EOM
8409
8410 : Determine if this is ELF
8411         $cat >try.c <<EOM
8412 /* Test for whether ELF binaries are produced */
8413 #include <fcntl.h>
8414 #$i_stdlib I_STDLIB
8415 #ifdef I_STDLIB
8416 #include <stdlib.h>
8417 #endif
8418 #$i_unistd I_UNISTD
8419 #ifdef I_UNISTD
8420 #include <unistd.h>
8421 #endif
8422 int main() {
8423     char b[4];
8424     int i = open("a.out",O_RDONLY);
8425     if(i == -1)
8426         exit(1); /* fail */
8427     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8428         exit(0); /* succeed (yes, it is ELF) */
8429     exit(1); /* fail */
8430 }
8431 EOM
8432         if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8433             bin_ELF="$define"
8434         fi
8435         $rm_try
8436
8437         case "$ld" in
8438             '') if $test $bin_ELF = "$define"; then
8439                     cat <<EOM
8440 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8441 EOM
8442                     dflt="$cc"
8443                 else
8444                     echo "I'll use ld to build dynamic libraries."
8445                     dflt='ld'
8446                 fi
8447                 ;;
8448             *)  dflt="$ld"
8449                 ;;
8450         esac
8451
8452         rp="What command should be used to create dynamic libraries?"
8453         . ./myread
8454         ld="$ans"
8455
8456         cat << EOM
8457
8458 Some systems may require passing special flags to $ld to create a
8459 library that can be dynamically loaded.  If your ld flags include
8460 -L/other/path options to locate libraries outside your loader's normal
8461 search path, you may need to specify those -L options here as well.  To
8462 use no flags, say "none".
8463
8464 EOM
8465         case "$lddlflags" in
8466             '') case "$osname" in
8467                     haiku) dflt='-shared' ;;
8468                     hpux) dflt='-b';
8469                           case "$gccversion" in
8470                               '') dflt="$dflt +vnocompatwarnings" ;;
8471                           esac
8472                           ;;
8473                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8474                     solaris) # See [perl #66604].
8475                             # On Solaris 11, gcc -m64 on amd64
8476                             # appears not to understand -G.  gcc versions at
8477                             # least as old as 3.4.3 support -shared, so just
8478                             # use that with Solaris 11 and later, but keep
8479                             # the old behavior for older Solaris versions.
8480                             case "$gccversion" in
8481                                 '') dflt='-G' ;;
8482                                 *)  case "$osvers" in
8483                                         2.?|2.10) dflt='-G' ;;
8484                                         *) dflt='-shared' ;;
8485                                     esac
8486                                     ;;
8487                             esac
8488                             ;;
8489                     sunos) dflt='-assert nodefinitions' ;;
8490                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8491                     *)     dflt='none' ;;
8492                 esac
8493                 ;;
8494             *) dflt="$lddlflags" ;;
8495         esac
8496
8497         : Only do this for gcc, since, for example, qcc has no concept
8498         : of --sysroot.
8499         if $test "X$sysroot" != X; then
8500             case "$gccversion" in
8501                 '') ;;
8502                 *)  dflt="$dflt --sysroot $sysroot" ;;
8503             esac
8504         fi
8505
8506         : Try to guess additional flags to pick up local libraries.
8507         : Be careful not to append to a plain 'none'
8508         case "$dflt" in
8509             none) dflt='' ;;
8510         esac
8511         for thisflag in $ldflags; do
8512             case "$thisflag" in
8513                 -L*|-R*|-Wl,-R*)
8514                     case " $dflt " in
8515                         *" $thisflag "*) ;;
8516                         *) dflt="$dflt $thisflag" ;;
8517                     esac
8518                     ;;
8519             esac
8520         done
8521
8522         case "$dflt" in
8523             ''|' ') dflt='none' ;;
8524         esac
8525
8526         case "$ldflags" in
8527             *-fstack-protector-strong*)
8528                 case "$dflt" in
8529                     *-fstack-protector-strong*) ;; # Don't add it again
8530                     *) dflt="$dflt -fstack-protector-strong" ;;
8531                 esac
8532                 ;;
8533             *-fstack-protector*)
8534                 case "$dflt" in
8535                     *-fstack-protector*) ;; # Don't add it again
8536                     *) dflt="$dflt -fstack-protector" ;;
8537                 esac
8538                 ;;
8539         esac
8540
8541         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8542         . ./myread
8543         case "$ans" in
8544             none) lddlflags=' ' ;;
8545             *) lddlflags="$ans" ;;
8546         esac
8547
8548         cat <<EOM
8549
8550 Some systems may require passing special flags to $cc to indicate that
8551 the resulting executable will use dynamic linking.  To use no flags,
8552 say "none".
8553
8554 EOM
8555         case "$ccdlflags" in
8556             '') case "$osname" in
8557                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8558                     sunos)             dflt='none'   ;;
8559                     *)                 dflt='none'   ;;
8560                 esac ;;
8561             ' ') dflt='none' ;;
8562             *)   dflt="$ccdlflags" ;;
8563         esac
8564         rp="Any special flags to pass to $cc to use dynamic linking?"
8565         . ./myread
8566         case "$ans" in
8567             none) ccdlflags=' ' ;;
8568             *)    ccdlflags="$ans" ;;
8569         esac
8570         ;;
8571
8572     *)  usedl="$undef"
8573         ld='ld'
8574         dlsrc='dl_none.xs'
8575         lddlflags=''
8576         ccdlflags=''
8577         ;;
8578 esac
8579
8580 ld_can_script="$undef"
8581 case "$bin_ELF$usedl" in
8582     $define$define)
8583         # Abuse try.h and a.out names for neat cleanup
8584         $cat >try.c <<EOM
8585 void foo() {}
8586 void bar() {}
8587 EOM
8588         $cat >try.h <<EOM
8589 LIBTEST_42 {
8590  global:
8591   foo;
8592  local: *;
8593  };
8594 EOM
8595         if $cc $cccdlflags $ccdlflags $ccflags \
8596                $ldflags $lddlflags -o a.out try.c \
8597                -Wl,--version-script=try.h >/dev/null 2>&1 \
8598            &&  $test -s a.out ; then
8599             echo "ld supports scripting" >&4
8600             ld_can_script="$define"
8601         else
8602             echo "ld does not support scripting" >&4
8603         fi
8604         $rm_try
8605         ;;
8606 esac
8607
8608 : Do we want a shared libperl?
8609 also=''
8610 case "$usedl" in
8611 $undef)
8612         # No dynamic loading being used, so don't bother even to prompt.
8613         useshrplib='false'
8614         ;;
8615 *)      case "$useshrplib" in
8616         '')     case "$osname" in
8617                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8618                         dflt=y
8619                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8620                         ;;
8621                 *)      dflt=n
8622                         ;;
8623                 esac
8624                 ;;
8625         $define|true|[Yy]*)
8626                 dflt=y
8627                 ;;
8628         *)      dflt=n
8629                 ;;
8630         esac
8631         $cat << EOM
8632
8633 The perl executable is normally obtained by linking perlmain.c with
8634 libperl${_a}, any static extensions (usually just DynaLoader), and
8635 any other libraries needed on this system (such as -lm, etc.).  Since
8636 your system supports dynamic loading, it is probably possible to build
8637 a shared libperl.$so.  If you will have more than one executable linked
8638 to libperl.$so, this will significantly reduce the size of each
8639 executable, but it may have a noticeable effect on performance.  The
8640 default is probably sensible for your system.
8641 $also
8642
8643 EOM
8644         rp="Build a shared libperl.$so (y/n)"
8645         . ./myread
8646         case "$ans" in
8647         true|$define|[Yy]*)
8648                 useshrplib='true'  ;;
8649         *)      useshrplib='false' ;;
8650         esac
8651         ;;
8652 esac
8653
8654 case "$useshrplib" in
8655 true)
8656         case "$userelocatableinc" in
8657         true|define)
8658                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8659                 echo "See INSTALL for an explanation why that won't work." >&4
8660                 exit 4
8661                 ;;
8662         esac
8663         case "$libperl" in
8664         '')
8665                 # Figure out a good name for libperl.so.  Since it gets stored in
8666                 # a version-specific architecture-dependent library, the version
8667                 # number isn't really that important, except for making cc/ld happy.
8668                 #
8669                 # A name such as libperl.so.10.1
8670                 majmin="libperl.$so.$patchlevel.$subversion"
8671                 # A name such as libperl.so.100
8672                 majonly=`echo $patchlevel $subversion |
8673                         $awk '{printf "%d%02d", $1, $2}'`
8674                 majonly=libperl.$so.$majonly
8675                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8676                 # rely on figuring it out from the naming of libc.
8677                 case "${osname}${osvers}" in
8678                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8679                         dflt=libperl.$so
8680                         ;;
8681                 cygwin*) # ld links now against the dll directly
8682                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8683                         majonly=`echo $patchlevel $subversion |
8684                                 $awk '{printf "%03d%03d", $1, $2}'`
8685                         majonly=cygperl5.$majonly.$so
8686                         dflt=$majmin
8687                         ;;
8688                 *)      # Try to guess based on whether libc has major.minor.
8689                         case "$libc" in
8690                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8691                         *libc.$so.[0-9]*) dflt=$majonly ;;
8692                         *)      dflt=libperl.$so ;;
8693                         esac
8694                         ;;
8695                 esac
8696                 ;;
8697         *)      dflt=$libperl
8698                 ;;
8699         esac
8700         cat << EOM
8701
8702 I need to select a good name for the shared libperl.  If your system uses
8703 library names with major and minor numbers, then you might want something
8704 like $majmin.  Alternatively, if your system uses a single version
8705 number for shared libraries, then you might want to use $majonly.
8706 Or, your system might be quite happy with a simple libperl.$so.
8707
8708 Since the shared libperl will get installed into a version-specific
8709 architecture-dependent directory, the version number of the shared perl
8710 library probably isn't important, so the default should be o.k.
8711
8712 EOM
8713         rp='What name do you want to give to the shared libperl?'
8714         . ./myread
8715         libperl=$ans
8716         echo "Ok, I'll use $libperl"
8717         ;;
8718 *)
8719         libperl="libperl${_a}"
8720         ;;
8721 esac
8722
8723 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8724 case "$shrpdir" in
8725 '') ;;
8726 *)      $cat >&4 <<EOM
8727 WARNING:  Use of the shrpdir variable for the installation location of
8728 the shared $libperl is not supported.  It was never documented and
8729 will not work in this version.  Let me (perlbug@perl.org)
8730 know of any problems this may cause.
8731
8732 EOM
8733         case "$shrpdir" in
8734         "$archlibexp/CORE")
8735                 $cat >&4 <<EOM
8736 But your current setting of $shrpdir is
8737 the default anyway, so it's harmless.
8738 EOM
8739                 ;;
8740         *)
8741                 $cat >&4 <<EOM
8742 Further, your current attempted setting of $shrpdir
8743 conflicts with the value of $archlibexp/CORE
8744 that installperl will use.
8745 EOM
8746                 ;;
8747         esac
8748         ;;
8749 esac
8750
8751 # How will the perl executable find the installed shared $libperl?
8752 # Add $xxx to ccdlflags.
8753 # If we can't figure out a command-line option, use $shrpenv to
8754 # set env LD_RUN_PATH.  The main perl makefile uses this.
8755 shrpdir=$archlibexp/CORE
8756 xxx=''
8757 tmp_shrpenv=''
8758 if "$useshrplib"; then
8759     case "$osname" in
8760         aix)
8761                 # We'll set it in Makefile.SH...
8762                 ;;
8763         solaris)
8764                 xxx="-R $shrpdir"
8765                 ;;
8766         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8767                 xxx="-Wl,-R$shrpdir"
8768                 ;;
8769         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8770                 xxx="-Wl,-rpath,$shrpdir"
8771                 ;;
8772         hpux*)
8773                 # hpux doesn't like the default, either.
8774                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8775                 ;;
8776         cygwin)
8777                 # cygwin needs only ldlibpth
8778                 ;;
8779         *)
8780                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8781                 ;;
8782         esac
8783         case "$xxx" in
8784         '') ;;
8785         *)
8786                 # Only add $xxx if it isn't already in ccdlflags.
8787                 case " $ccdlflags " in
8788                 *" $xxx "*)     ;;
8789                 *)      ccdlflags="$ccdlflags $xxx"
8790                         cat <<EOM >&4
8791
8792 Adding $xxx to the flags
8793 passed to $ld so that the perl executable will find the
8794 installed shared $libperl.
8795
8796 EOM
8797                         ;;
8798                 esac
8799                 ;;
8800         esac
8801 fi
8802 # Fix ccdlflags in AIX for building external extensions.
8803 # (For building Perl itself bare -bE:perl.exp is needed,
8804 #  Makefile.SH takes care of this.)
8805 case "$osname" in
8806 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8807 esac
8808 # Respect a hint or command-line value.
8809 case "$shrpenv" in
8810 '') shrpenv="$tmp_shrpenv" ;;
8811 esac
8812 case "$ldlibpthname" in
8813 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8814 none)   ldlibpthname='' ;;
8815 esac
8816
8817 : determine where manual pages are on this system
8818 echo " "
8819 case "$sysman" in
8820 '')
8821         syspath='/usr/share/man/man1 /usr/man/man1'
8822         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8823         syspath="$syspath /usr/man/u_man/man1"
8824         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8825         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8826         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8827         sysman=`./loc . /usr/man/man1 $syspath`
8828         ;;
8829 esac
8830 if $test -d "$sysman"; then
8831         echo "System manual is in $sysman." >&4
8832 else
8833         echo "Could not find manual pages in source form." >&4
8834 fi
8835
8836 : determine where manual pages go
8837 set man1dir man1dir none
8838 eval $prefixit
8839 $cat <<EOM
8840
8841 $spackage has manual pages available in source form.
8842 EOM
8843 case "$nroff" in
8844 nroff)
8845         echo "However, you don't have nroff, so they're probably useless to you."
8846         case "$man1dir" in
8847         '') man1dir="none";;
8848         esac;;
8849 esac
8850 echo "If you don't want the manual sources installed, answer 'none'."
8851 case "$man1dir" in
8852 ' ') dflt=none
8853         ;;
8854 '')
8855         lookpath="$prefixexp/share/man/man1"
8856         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8857         lookpath="$lookpath $prefixexp/man/p_man/man1"
8858         lookpath="$lookpath $prefixexp/man/u_man/man1"
8859         lookpath="$lookpath $prefixexp/man/man.1"
8860         case "$sysman" in
8861         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8862         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8863         esac
8864         set dflt
8865         eval $prefixup
8866         ;;
8867 *)  dflt="$man1dir"
8868         ;;
8869 esac
8870 echo " "
8871 fn=dn+~
8872 rp="Where do the main $spackage manual pages (source) go?"
8873 . ./getfile
8874 if $test "X$man1direxp" != "X$ansexp"; then
8875         installman1dir=''
8876 fi
8877 prefixvar=man1dir
8878 . ./setprefixvar
8879
8880 case "$man1dir" in
8881 '')     man1dir=' '
8882         installman1dir='';;
8883 esac
8884
8885 : What suffix to use on installed man pages
8886
8887 case "$man1dir" in
8888 ' ')
8889         man1ext='0'
8890         ;;
8891 *)
8892         rp="What suffix should be used for the main $spackage man pages?"
8893         case "$man1ext" in
8894         '')     case "$man1dir" in
8895                 *1)  dflt=1 ;;
8896                 *1p) dflt=1p ;;
8897                 *1pm) dflt=1pm ;;
8898                 *l) dflt=l;;
8899                 *n) dflt=n;;
8900                 *o) dflt=o;;
8901                 *p) dflt=p;;
8902                 *C) dflt=C;;
8903                 *L) dflt=L;;
8904                 *L1) dflt=L1;;
8905                 *) dflt=1;;
8906                 esac
8907                 ;;
8908         *)      dflt="$man1ext";;
8909         esac
8910         . ./myread
8911         man1ext="$ans"
8912         ;;
8913 esac
8914
8915 : see if we can have long filenames
8916 echo " "
8917 first=123456789abcdef
8918 $rm -f $first
8919 if (echo hi >$first) 2>/dev/null; then
8920         if $test -f 123456789abcde; then
8921                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8922                 val="$undef"
8923         else
8924                 echo 'You can have filenames longer than 14 characters.'>&4
8925                 val="$define"
8926         fi
8927 else
8928         $cat <<'EOM'
8929 You can't have filenames longer than 14 chars.
8930 You can't even think about them!
8931 EOM
8932         val="$undef"
8933 fi
8934 set d_flexfnam
8935 eval $setvar
8936 $rm -rf 123456789abcde*
8937
8938 : determine where library module manual pages go
8939 set man3dir man3dir none
8940 eval $prefixit
8941 $cat <<EOM
8942
8943 $spackage has manual pages for many of the library modules.
8944 EOM
8945
8946 case "$nroff" in
8947 nroff)
8948         $cat <<'EOM'
8949 However, you don't have nroff, so they're probably useless to you.
8950 EOM
8951         case "$man3dir" in
8952         '') man3dir="none";;
8953         esac;;
8954 esac
8955
8956 case "$d_flexfnam" in
8957 undef)
8958         $cat <<'EOM'
8959 However, your system can't handle the long file names like File::Basename.3.
8960 EOM
8961         case "$man3dir" in
8962         '') man3dir="none";;
8963         esac;;
8964 esac
8965
8966 echo "If you don't want the manual sources installed, answer 'none'."
8967 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8968 case "$man3dir" in
8969 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8970         if $test -d "$privlib/man/man3"; then
8971                 cat <<EOM >&4
8972
8973 WARNING:  Previous versions of perl installed man3 pages into
8974 $privlib/man/man3.  This version will suggest a
8975 new default of $dflt.
8976 EOM
8977                 tdflt=$dflt
8978                 dflt='n'
8979                 rp='Do you wish to preserve the old behavior?(y/n)'
8980                 . ./myread
8981                 case "$ans" in
8982                 y*) dflt="$privlib/man/man3" ;;
8983                 *)  dflt=$tdflt ;;
8984                 esac
8985     fi
8986         ;;
8987 *)      dflt="$man3dir" ;;
8988 esac
8989 case "$dflt" in
8990 ' ') dflt=none ;;
8991 esac
8992 echo " "
8993 fn=dn+~
8994 rp="Where do the $package library man pages (source) go?"
8995 . ./getfile
8996 prefixvar=man3dir
8997 . ./setprefixvar
8998
8999 case "$man3dir" in
9000 '')     man3dir=' '
9001         installman3dir='';;
9002 esac
9003
9004 : What suffix to use on installed man pages
9005 case "$man3dir" in
9006 ' ')
9007         man3ext='0'
9008         ;;
9009 *)
9010         rp="What suffix should be used for the $package library man pages?"
9011         case "$man3ext" in
9012         '')     case "$man3dir" in
9013                 *3)  dflt=3 ;;
9014                 *3p) dflt=3p ;;
9015                 *3pm) dflt=3pm ;;
9016                 *l) dflt=l;;
9017                 *n) dflt=n;;
9018                 *o) dflt=o;;
9019                 *p) dflt=p;;
9020                 *C) dflt=C;;
9021                 *L) dflt=L;;
9022                 *L3) dflt=L3;;
9023                 *) dflt=3;;
9024                 esac
9025                 ;;
9026         *)      dflt="$man3ext";;
9027         esac
9028         . ./myread
9029         man3ext="$ans"
9030         ;;
9031 esac
9032
9033 : see if we have to deal with yellow pages, now NIS.
9034 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9035         case "$hostcat" in
9036         nidump*) ;;
9037         *)
9038                 case "$hostcat" in
9039                 *ypcat*) dflt=y;;
9040                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9041                                 dflt=y
9042                         else
9043                                 dflt=n
9044                         fi;;
9045                 *) dflt=n;;
9046                 esac
9047                 echo " "
9048                 rp='Are you getting the hosts file via yellow pages?'
9049                 . ./myread
9050                 case "$ans" in
9051                 y*) hostcat='ypcat hosts';;
9052                 *) hostcat='cat /etc/hosts';;
9053                 esac
9054                 ;;
9055         esac
9056 fi
9057 case "$hostcat" in
9058 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9059 esac
9060 case "$groupcat" in
9061 '') test -f /etc/group && groupcat='cat /etc/group';;
9062 esac
9063 case "$passcat" in
9064 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9065 esac
9066
9067 : now get the host name
9068 echo " "
9069 echo "Figuring out host name..." >&4
9070 case "$myhostname" in
9071 '') cont=true
9072         echo 'Maybe "hostname" will work...'
9073         if tans=`sh -c hostname 2>&1` ; then
9074                 myhostname=$tans
9075                 phostname=hostname
9076                 cont=''
9077         fi
9078         ;;
9079 *) cont='';;
9080 esac
9081 if $test "$cont"; then
9082         if ./xenix; then
9083                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9084                 if tans=`cat /etc/systemid 2>&1` ; then
9085                         myhostname=$tans
9086                         phostname='cat /etc/systemid'
9087                         echo "Whadyaknow.  Xenix always was a bit strange..."
9088                         cont=''
9089                 fi
9090         elif $test -r /etc/systemid; then
9091                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9092         fi
9093 fi
9094 if $test "$cont"; then
9095         echo 'No, maybe "uuname -l" will work...'
9096         if tans=`sh -c 'uuname -l' 2>&1` ; then
9097                 myhostname=$tans
9098                 phostname='uuname -l'
9099         else
9100                 echo 'Strange.  Maybe "uname -n" will work...'
9101                 if tans=`sh -c 'uname -n' 2>&1` ; then
9102                         myhostname=$tans
9103                         phostname='uname -n'
9104                 else
9105                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9106                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9107                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9108                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9109                         else
9110                                 case "$myhostname" in
9111                                 '') echo "Does this machine have an identity crisis or something?"
9112                                         phostname='';;
9113                                 *)
9114                                         echo "Well, you said $myhostname before..."
9115                                         phostname='echo $myhostname';;
9116                                 esac
9117                         fi
9118                 fi
9119         fi
9120 fi
9121 case "$myhostname" in
9122 '') myhostname=noname ;;
9123 esac
9124 : you do not want to know about this
9125 set $myhostname
9126 myhostname=$1
9127
9128 : verify guess
9129 if $test "$myhostname" ; then
9130         dflt=y
9131         rp='Your host name appears to be "'$myhostname'".'" Right?"
9132         . ./myread
9133         case "$ans" in
9134         y*) ;;
9135         *) myhostname='';;
9136         esac
9137 fi
9138
9139 : bad guess or no guess
9140 while $test "X$myhostname" = X ; do
9141         dflt=''
9142         rp="Please type the (one word) name of your host:"
9143         . ./myread
9144         myhostname="$ans"
9145 done
9146
9147 : translate upper to lower if necessary
9148 case "$myhostname" in
9149 *[A-Z]*)
9150         echo "(Normalizing case in your host name)"
9151         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9152         ;;
9153 esac
9154
9155 case "$myhostname" in
9156 *.*)
9157         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9158         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9159         echo "(Trimming domain name from host name--host name is now $myhostname)"
9160         ;;
9161 *) case "$mydomain" in
9162         '')
9163                 {
9164                         test "X$hostcat" = "Xypcat hosts" &&
9165                         ypmatch "$myhostname" hosts 2>/dev/null |\
9166                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9167                         $test -s hosts
9168                 } || {
9169                         test "X$hostcat" != "X" &&
9170                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9171                                         /[       ]$myhostname[  . ]/p" > hosts
9172                 }
9173                 tmp_re="[       . ]"
9174                 if $test -f hosts; then
9175                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9176                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9177                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9178                                 hosts | $sort | $uniq | \
9179                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9180                         case `$echo X$dflt` in
9181                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9182                                 dflt=.
9183                                 ;;
9184                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9185                                 ;;
9186                         esac
9187                 else
9188                         echo "(I cannot locate a hosts database anywhere)"
9189                         dflt=.
9190                 fi
9191                 case "$dflt" in
9192                 .)
9193                         tans=`./loc resolv.conf X /etc /usr/etc`
9194                         if $test -f "$tans"; then
9195                                 echo "(Attempting domain name extraction from $tans)"
9196                                 dflt=.`$sed -n -e 's/   / /g' \
9197                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9198                                   -e 1q 2>/dev/null`
9199                                 case "$dflt" in
9200                                 .) dflt=.`$sed -n -e 's/        / /g' \
9201                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9202                                      -e 1q 2>/dev/null`
9203                                         ;;
9204                                 esac
9205                         fi
9206                         ;;
9207                 esac
9208                 case "$dflt" in
9209                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9210                         dflt=.`sh -c domainname 2>/dev/null`
9211                         case "$dflt" in
9212                         '') dflt='.';;
9213                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9214                         esac
9215                         ;;
9216                 esac
9217                 case "$dflt$osname" in
9218                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9219                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9220                         ;;
9221                 esac
9222                 case "$dflt" in
9223                 .) echo "(Lost all hope -- silly guess then)"
9224                         dflt='.nonet'
9225                         ;;
9226                 esac
9227                 $rm -f hosts
9228                 ;;
9229         *) dflt="$mydomain";;
9230         esac;;
9231 esac
9232 echo " "
9233 rp="What is your domain name?"
9234 . ./myread
9235 tans="$ans"
9236 case "$ans" in
9237 '') ;;
9238 .*) ;;
9239 *) tans=".$tans";;
9240 esac
9241 mydomain="$tans"
9242
9243 : translate upper to lower if necessary
9244 case "$mydomain" in
9245 *[A-Z]*)
9246         echo "(Normalizing case in your domain name)"
9247         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9248         ;;
9249 esac
9250
9251 : a little sanity check here
9252 case "$phostname" in
9253 '') ;;
9254 *)
9255         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9256         $myhostname$mydomain|$myhostname) ;;
9257         *)
9258                 case "$phostname" in
9259                 sed*)
9260                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9261                         ;;
9262                 *)
9263                         echo "(That doesn't agree with your $phostname command, by the way.)"
9264                         ;;
9265                 esac
9266         ;;
9267         esac
9268         ;;
9269 esac
9270
9271 : determine the e-mail address of the user who is running us
9272 $cat <<EOM
9273
9274 I need to get your e-mail address in Internet format if possible, i.e.
9275 something like user@host.domain. Please answer accurately since I have
9276 no easy means to double check it. The default value provided below
9277 is most probably close to reality but may not be valid from outside
9278 your organization...
9279
9280 EOM
9281 cont=x
9282 while test "$cont"; do
9283         case "$MAILDOMAIN" in
9284         '')
9285                 if $test -s /etc/mailname; then
9286                         maildomain=`$cat /etc/mailname`
9287                 else
9288                         maildomain="$myhostname$mydomain"
9289                 fi
9290                 ;;
9291         *)  maildomain="$MAILDOMAIN";;
9292         esac
9293         case "$cf_email" in
9294         '') dflt="$cf_by@$maildomain";;
9295         *)  dflt="$cf_email";;
9296         esac
9297         rp='What is your e-mail address?'
9298         . ./myread
9299         cf_email="$ans"
9300         case "$cf_email" in
9301         *@*.*) cont='' ;;
9302         *)
9303                 rp='Address does not look like an Internet one.  Use it anyway?'
9304                 case "$fastread" in
9305                 yes) dflt=y ;;
9306                 *) dflt=n ;;
9307                 esac
9308                 . ./myread
9309                 case "$ans" in
9310                 y*) cont='' ;;
9311                 *) echo " " ;;
9312                 esac
9313                 ;;
9314         esac
9315 done
9316
9317 : Ask e-mail of administrator
9318 $cat <<EOM
9319
9320 If you or somebody else will be maintaining perl at your site, please
9321 fill in the correct e-mail address here so that they may be contacted
9322 if necessary. Currently, the "perlbug" program included with perl
9323 will send mail to this address in addition to perlbug@perl.org. You may
9324 enter "none" for no administrator.
9325
9326 EOM
9327 case "$perladmin" in
9328 '') dflt="$cf_email";;
9329 *) dflt="$perladmin";;
9330 esac
9331 rp='Perl administrator e-mail address'
9332 . ./myread
9333 perladmin="$ans"
9334
9335 : determine whether to only install version-specific parts.
9336 echo " "
9337 $cat <<EOM
9338 Do you want to install only the version-specific parts of the perl
9339 distribution?  Usually you do *not* want to do this.
9340 EOM
9341 case "$versiononly" in
9342 "$define"|[Yy]*|true) dflt='y' ;;
9343 *) dflt='n';
9344 esac
9345 rp="Do you want to install only the version-specific parts of perl?"
9346 . ./myread
9347 case "$ans" in
9348 [yY]*)  val="$define";;
9349 *)      val="$undef" ;;
9350 esac
9351 set versiononly
9352 eval $setvar
9353
9354 case "$versiononly" in
9355 "$define") inc_version_list=''
9356            inc_version_list_init=0
9357            ;;
9358 esac
9359
9360 : figure out how to guarantee perl startup
9361 : XXX Note that this currently takes advantage of the bug that binexp ignores
9362 :     the Configure -Dinstallprefix setting, which in turn means that under
9363 :     relocatable @INC, initialinstalllocation is what binexp started as.
9364 case "$startperl" in
9365 '')
9366         case "$sharpbang" in
9367         *!)
9368                 $cat <<EOH
9369
9370 I can use the #! construct to start perl on your system. This will
9371 make startup of perl scripts faster, but may cause problems if you
9372 want to share those scripts and perl is not in a standard place
9373 ($initialinstalllocation/perl) on all your platforms. The alternative
9374 is to force a shell by starting the script with a single ':' character.
9375
9376 EOH
9377                 case "$versiononly" in
9378                 "$define")      dflt="$initialinstalllocation/perl$version";;
9379                 *)              dflt="$initialinstalllocation/perl";;
9380                 esac
9381                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9382                 . ./myread
9383                 case "$ans" in
9384                 none)   startperl=": # use perl";;
9385                 *)      startperl="#!$ans"
9386                         if $test 30 -lt `echo "$ans" | wc -c`; then
9387                                 $cat >&4 <<EOM
9388
9389 WARNING:  Some systems limit the #! command to 32 characters.
9390 If you experience difficulty running Perl scripts with #!, try
9391 installing Perl in a directory with a shorter pathname.
9392
9393 EOM
9394                         fi ;;
9395                 esac
9396                 ;;
9397         *) startperl=": # use perl"
9398                 ;;
9399         esac
9400         ;;
9401 esac
9402 echo "I'll use $startperl to start perl scripts."
9403
9404 : figure best path for perl in scripts
9405 case "$perlpath" in
9406 '')
9407         case "$versiononly" in
9408         "$define")      perlpath="$initialinstalllocation/perl$version";;
9409         *)              perlpath="$initialinstalllocation/perl";;
9410         esac
9411         case "$startperl" in
9412         *!*) ;;
9413         *)
9414                 $cat <<EOH
9415
9416 I will use the "eval 'exec'" idiom to start Perl on your system.
9417 I can use the full path of your Perl binary for this purpose, but
9418 doing so may cause problems if you want to share those scripts and
9419 Perl is not always in a standard place ($initialinstalllocation/perl).
9420
9421 EOH
9422                 dflt="$initialinstalllocation/perl"
9423                 rp="What path shall I use in \"eval 'exec'\"?"
9424                 . ./myread
9425                 perlpath="$ans"
9426                 ;;
9427         esac
9428         ;;
9429 esac
9430 case "$startperl" in
9431 *!*)    ;;
9432 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9433 esac
9434
9435 : determine where public executable scripts go
9436 set scriptdir scriptdir
9437 eval $prefixit
9438 case "$scriptdir" in
9439 '')
9440         dflt="$bin"
9441         : guess some guesses
9442         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9443         $test -d /usr/share/bin     && dflt=/usr/share/bin
9444         $test -d /usr/local/script  && dflt=/usr/local/script
9445         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9446         $test -d $prefixexp/script  && dflt=$prefixexp/script
9447         set dflt
9448         eval $prefixup
9449         ;;
9450 *)  dflt="$scriptdir"
9451         ;;
9452 esac
9453 $cat <<EOM
9454
9455 Some installations have a separate directory just for executable scripts so
9456 that they can mount it across multiple architectures but keep the scripts in
9457 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9458 Or you might just lump your scripts in with all your other executables.
9459
9460 EOM
9461 fn=d~
9462 rp='Where do you keep publicly executable scripts?'
9463 . ./getfile
9464 if $test "X$ansexp" != "X$scriptdirexp"; then
9465         installscript=''
9466 fi
9467 installscriptdir=''
9468 prefixvar=scriptdir
9469 . ./setprefixvar
9470 : A little fix up for an irregularly named variable.
9471 installscript="$installscriptdir"
9472
9473 : determine where add-on public executables go
9474 case "$sitebin" in
9475 '')     dflt=$siteprefix/bin ;;
9476 *)      dflt=$sitebin ;;
9477 esac
9478 fn=d~
9479 rp='Pathname where the add-on public executables should be installed?'
9480 . ./getfile
9481 prefixvar=sitebin
9482 . ./setprefixvar
9483
9484 : determine where add-on html pages go
9485 : There is no standard location, so try to copy the previously-selected
9486 : directory structure for the core html pages.
9487 case "$sitehtml1dir" in
9488 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9489 *)     dflt=$sitehtml1dir ;;
9490 esac
9491 case "$dflt" in
9492 ''|' ') dflt=none ;;
9493 esac
9494 fn=dn+~
9495 rp='Pathname where the site-specific html pages should be installed?'
9496 . ./getfile
9497 prefixvar=sitehtml1dir
9498 . ./setprefixvar
9499
9500 : determine where add-on library html pages go
9501 : There is no standard location, so try to copy the previously-selected
9502 : directory structure for the core html pages.
9503 case "$sitehtml3dir" in
9504 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9505 *)     dflt=$sitehtml3dir ;;
9506 esac
9507 case "$dflt" in
9508 ''|' ') dflt=none ;;
9509 esac
9510 fn=dn+~
9511 rp='Pathname where the site-specific library html pages should be installed?'
9512 . ./getfile
9513 prefixvar=sitehtml3dir
9514 . ./setprefixvar
9515
9516 : determine where add-on manual pages go
9517 case "$siteman1dir" in
9518 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9519 *)      dflt=$siteman1dir ;;
9520 esac
9521 case "$dflt" in
9522 ''|' ') dflt=none ;;
9523 esac
9524 fn=dn+~
9525 rp='Pathname where the site-specific manual pages should be installed?'
9526 . ./getfile
9527 prefixvar=siteman1dir
9528 . ./setprefixvar
9529
9530 : determine where add-on library man pages go
9531 case "$siteman3dir" in
9532 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9533 *)      dflt=$siteman3dir ;;
9534 esac
9535 case "$dflt" in
9536 ''|' ') dflt=none ;;
9537 esac
9538 fn=dn+~
9539 rp='Pathname where the site-specific library manual pages should be installed?'
9540 . ./getfile
9541 prefixvar=siteman3dir
9542 . ./setprefixvar
9543
9544 : determine where add-on public executable scripts go
9545 case "$sitescript" in
9546 '')     dflt=$siteprefix/script
9547         $test -d $dflt || dflt=$sitebin ;;
9548 *)  dflt="$sitescript" ;;
9549 esac
9550 fn=d~+
9551 rp='Pathname where add-on public executable scripts should be installed?'
9552 . ./getfile
9553 prefixvar=sitescript
9554 . ./setprefixvar
9555
9556 : see if backtrace exists
9557 set backtrace d_backtrace
9558 eval $inlibc
9559
9560 : add flags if using c backtrace
9561 case "$usecbacktrace" in
9562   "") usecbacktrace=$undef ;;
9563   [yY]*|true|$define)
9564     case "$d_backtrace" in
9565       [yY]*|true|$define)
9566         case " $ccflags " in
9567           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9568           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9569           esac
9570         ;;
9571       *)
9572         echo "This system does not support backtrace" >&4
9573         usecbacktrace=$undef
9574         ;;
9575       esac
9576     ;;
9577   esac
9578
9579 : Check if faststdio is requested and available
9580 case "$usefaststdio" in
9581 $define|true|[yY]*|'')
9582         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9583         case "$xversion" in
9584         [68])   dflt='y' ;;
9585         *)      dflt='n' ;;
9586         esac
9587         ;;
9588 *) dflt='n';;
9589 esac
9590 cat <<EOM
9591
9592 Perl can be built to use 'fast stdio', which means using the stdio
9593 library but also directly manipulating the stdio buffers to enable
9594 faster I/O.  Using stdio is better for backward compatibility (especially
9595 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9596 interface has been preferred instead of stdio.
9597
9598 If this doesn't make any sense to you, just accept the default '$dflt'.
9599 EOM
9600 rp='Use the "fast stdio" if available?'
9601 . ./myread
9602 case "$ans" in
9603 y|Y)    val="$define" ;;
9604 *)      val="$undef" ;;
9605 esac
9606 set usefaststdio
9607 eval $setvar
9608
9609
9610 : define an is-a-typedef? function
9611 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9612 case "$inclist" in
9613 "") inclist="sys/types.h";;
9614 esac;
9615 eval "varval=\$$var";
9616 case "$varval" in
9617 "")
9618         $rm -f temp.c;
9619         for inc in $inclist; do
9620                 echo "#include <$inc>" >>temp.c;
9621         done;
9622         echo "#ifdef $type" >> temp.c;
9623         echo "printf(\"We have $type\");" >> temp.c;
9624         echo "#endif" >> temp.c;
9625         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9626         if $contains $type temp.E >/dev/null 2>&1; then
9627                 eval "$var=\$type";
9628         else
9629                 eval "$var=\$def";
9630         fi;
9631         $rm -f temp.?;;
9632 *) eval "$var=\$varval";;
9633 esac'
9634
9635 : define an is-a-typedef? function that prompts if the type is not available.
9636 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9637 case "$inclist" in
9638 "") inclist="sys/types.h";;
9639 esac;
9640 eval "varval=\$$var";
9641 case "$varval" in
9642 "")
9643         $rm -f temp.c;
9644         for inc in $inclist; do
9645                 echo "#include <$inc>" >>temp.c;
9646         done;
9647         echo "#ifdef $type" >> temp.c;
9648         echo "printf(\"We have $type\");" >> temp.c;
9649         echo "#endif" >> temp.c;
9650         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9651         echo " " ;
9652         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9653         if $contains $type temp.E >/dev/null 2>&1; then
9654                 echo "$type found." >&4;
9655                 eval "$var=\$type";
9656         else
9657                 echo "$type NOT found." >&4;
9658                 dflt="$def";
9659                 . ./myread ;
9660                 eval "$var=\$ans";
9661         fi;
9662         $rm -f temp.?;;
9663 *) eval "$var=\$varval";;
9664 esac'
9665
9666 : see what type lseek is declared as in the kernel
9667 rp="What is the type used for lseek's offset on this system?"
9668 set off_t lseektype long stdio.h sys/types.h
9669 eval $typedef_ask
9670
9671 echo " "
9672 echo "Checking to see how big your file offsets are..." >&4
9673 $cat >try.c <<EOCP
9674 #include <sys/types.h>
9675 #include <stdio.h>
9676 int main()
9677 {
9678     printf("%d\n", (int)sizeof($lseektype));
9679     return(0);
9680 }
9681 EOCP
9682 set try
9683 if eval $compile_ok; then
9684         lseeksize=`$run ./try`
9685         echo "Your file offsets are $lseeksize bytes long."
9686 else
9687         dflt=$longsize
9688         echo " "
9689         echo "(I can't seem to compile the test program.  Guessing...)"
9690         rp="What is the size of your file offsets (in bytes)?"
9691         . ./myread
9692         lseeksize="$ans"
9693 fi
9694 $rm_try
9695
9696 : see what type file positions are declared as in the library
9697 rp="What is the type for file position used by fsetpos()?"
9698 set fpos_t fpostype long stdio.h sys/types.h
9699 eval $typedef_ask
9700
9701 : Check size for Fpos_t
9702 echo " "
9703 case "$fpostype" in
9704 *_t) zzz="$fpostype"    ;;
9705 *)   zzz="fpos_t"       ;;
9706 esac
9707 echo "Checking the size of $zzz..." >&4
9708 cat > try.c <<EOCP
9709 #include <sys/types.h>
9710 #include <stdio.h>
9711 #$i_stdlib I_STDLIB
9712 #ifdef I_STDLIB
9713 #include <stdlib.h>
9714 #endif
9715 int main() {
9716     printf("%d\n", (int)sizeof($fpostype));
9717     exit(0);
9718 }
9719 EOCP
9720 set try
9721 if eval $compile_ok; then
9722         yyy=`$run ./try`
9723         case "$yyy" in
9724         '')     fpossize=4
9725                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9726                 ;;
9727         *)      fpossize=$yyy
9728                 echo "Your $zzz is $fpossize bytes long."
9729                 ;;
9730         esac
9731 else
9732         dflt="$longsize"
9733         echo " " >&4
9734         echo "(I can't compile the test program.  Guessing...)" >&4
9735         rp="What is the size of your file positions (in bytes)?"
9736         . ./myread
9737         fpossize="$ans"
9738 fi
9739
9740 : Check for large file support
9741 # Backward compatibility (uselfs is deprecated).
9742 case "$uselfs" in
9743 "$define"|true|[yY]*)
9744         cat <<EOM >&4
9745
9746 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9747 EOM
9748         uselargefiles="$define"
9749         ;;
9750 esac
9751
9752 case "$lseeksize:$fpossize" in
9753 8:8) cat <<EOM
9754
9755 You can have files larger than 2 gigabytes.
9756 EOM
9757    val="$define" ;;
9758 *)    case "$uselargefiles" in
9759    "$undef"|false|[nN]*) dflt='n' ;;
9760    *)   dflt='y' ;;
9761    esac
9762    cat <<EOM
9763
9764 Perl can be built to understand large files (files larger than 2 gigabytes)
9765 on some systems.  To do so, Configure can be run with -Duselargefiles.
9766
9767 If this doesn't make any sense to you, just accept the default '$dflt'.
9768 EOM
9769    rp='Try to understand large files, if available?'
9770    . ./myread
9771    case "$ans" in
9772    y|Y)         val="$define" ;;
9773    *)           val="$undef"  ;;
9774    esac
9775    ;;
9776 esac
9777 set uselargefiles
9778 eval $setvar
9779 : Look for a hint-file generated 'call-back-unit'.  If the
9780 : user has specified that a large files perl is to be built,
9781 : we may need to set or change some other defaults.
9782 if $test -f uselargefiles.cbu; then
9783         echo "Your platform has some specific hints regarding large file builds, using them..."
9784         . ./uselargefiles.cbu
9785 fi
9786 case "$uselargefiles" in
9787 "$define")
9788         if $test -f uselargefiles.cbu; then
9789                 echo " "
9790                 echo "Rechecking to see how big your file offsets are..." >&4
9791                 $cat >try.c <<EOCP
9792 #include <sys/types.h>
9793 #include <stdio.h>
9794 int main()
9795 {
9796     printf("%d\n", (int)sizeof($lseektype));
9797     return(0);
9798 }
9799 EOCP
9800                 set try
9801                 if eval $compile_ok; then
9802                         lseeksize=`$run ./try`
9803                         $echo "Your file offsets are now $lseeksize bytes long."
9804                 else
9805                         dflt="$lseeksize"
9806                         echo " "
9807                         echo "(I can't seem to compile the test program.  Guessing...)"
9808                         rp="What is the size of your file offsets (in bytes)?"
9809                         . ./myread
9810                         lseeksize="$ans"
9811                 fi
9812                 case "$fpostype" in
9813                 *_t) zzz="$fpostype"    ;;
9814                 *)   zzz="fpos_t"       ;;
9815                 esac
9816                 $echo $n "Rechecking the size of $zzz...$c" >&4
9817                 $cat > try.c <<EOCP
9818 #include <sys/types.h>
9819 #include <stdio.h>
9820 #$i_stdlib I_STDLIB
9821 #ifdef I_STDLIB
9822 #include <stdlib.h>
9823 #endif
9824 int main() {
9825     printf("%d\n", (int)sizeof($fpostype));
9826     return(0);
9827 }
9828 EOCP
9829                 set try
9830                 if eval $compile_ok; then
9831                         yyy=`$run ./try`
9832                         dflt="$lseeksize"
9833                         case "$yyy" in
9834                         '')     echo " "
9835                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9836                                 ;;
9837                         *)      fpossize=$yyy
9838                                 echo " $fpossize bytes." >&4
9839                                 ;;
9840                         esac
9841                 else
9842                         dflt="$fpossize"
9843                         echo " "
9844                         echo "(I can't compile the test program.  Guessing...)" >&4
9845                         rp="What is the size of your file positions (in bytes)?"
9846                         . ./myread
9847                         fpossize="$ans"
9848                 fi
9849                 $rm_try
9850         fi
9851         ;;
9852 esac
9853
9854 : Check if we want perlio
9855 useperlio="$define"
9856
9857 : Set the vendorbin variables
9858 case "$vendorprefix" in
9859 '')     d_vendorbin="$undef"
9860         vendorbin=''
9861         vendorbinexp=''
9862         ;;
9863 *)      d_vendorbin="$define"
9864         : determine where vendor-supplied executables go.
9865         case "$vendorbin" in
9866         '') dflt=$vendorprefix/bin ;;
9867         *)      dflt="$vendorbin" ;;
9868         esac
9869         fn=d~+
9870         rp='Pathname for the vendor-supplied executables directory?'
9871         . ./getfile
9872         vendorbin="$ans"
9873         vendorbinexp="$ansexp"
9874         ;;
9875 esac
9876 prefixvar=vendorbin
9877 . ./installprefix
9878
9879 : Set the vendorhtml1dir variables
9880 case "$vendorprefix" in
9881 '')     vendorhtml1dir=''
9882         vendorhtml1direxp=''
9883         ;;
9884 *)      : determine where vendor-supplied html pages go.
9885         : There is no standard location, so try to copy the previously-selected
9886         : directory structure for the core html pages.
9887         : XXX Better default suggestions would be welcome.
9888         case "$vendorhtml1dir" in
9889         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9890         *)      dflt=$vendorhtml1dir ;;
9891         esac
9892         case "$dflt" in
9893         ''|' ') dflt=none ;;
9894         esac
9895         fn=dn+~
9896         rp='Pathname for the vendor-supplied html pages?'
9897         . ./getfile
9898         vendorhtml1dir="$ans"
9899         vendorhtml1direxp="$ansexp"
9900         ;;
9901 esac
9902 : Use ' ' for none so value is preserved next time through Configure
9903 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9904 prefixvar=vendorhtml1dir
9905 . ./installprefix
9906
9907 : Set the vendorhtml3dir variables
9908 case "$vendorprefix" in
9909 '')     vendorhtml3dir=''
9910         vendorhtml3direxp=''
9911         ;;
9912 *)      : determine where vendor-supplied module html pages go.
9913         : There is no standard location, so try to copy the previously-selected
9914         : directory structure for the core html pages.
9915         : XXX Better default suggestions would be welcome.
9916         case "$vendorhtml3dir" in
9917         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9918         *)      dflt=$vendorhtml3dir ;;
9919         esac
9920         case "$dflt" in
9921         ''|' ') dflt=none ;;
9922         esac
9923         fn=dn+~
9924         rp='Pathname for the vendor-supplied html pages?'
9925         . ./getfile
9926         vendorhtml3dir="$ans"
9927         vendorhtml3direxp="$ansexp"
9928         ;;
9929 esac
9930 : Use ' ' for none so value is preserved next time through Configure
9931 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9932 prefixvar=vendorhtml3dir
9933 . ./installprefix
9934
9935 : Set the vendorman1dir variables
9936 case "$vendorprefix" in
9937 '')     vendorman1dir=''
9938         vendorman1direxp=''
9939         ;;
9940 *)      : determine where vendor-supplied manual pages go.
9941         case "$vendorman1dir" in
9942         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9943         *)      dflt=$vendorman1dir ;;
9944         esac
9945         case "$dflt" in
9946         ''|' ') dflt=none ;;
9947         esac
9948         fn=nd~+
9949         rp='Pathname for the vendor-supplied manual section 1 pages?'
9950         . ./getfile
9951         vendorman1dir="$ans"
9952         vendorman1direxp="$ansexp"
9953         ;;
9954 esac
9955 : Use ' ' for none so value is preserved next time through Configure
9956 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9957 prefixvar=vendorman1dir
9958 . ./installprefix
9959
9960 : Set the vendorman3dir variables
9961 case "$vendorprefix" in
9962 '')     vendorman3dir=''
9963         vendorman3direxp=''
9964         ;;
9965 *)      : determine where vendor-supplied module manual pages go.
9966         case "$vendorman3dir" in
9967         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9968         *)      dflt=$vendorman3dir ;;
9969         esac
9970         case "$dflt" in
9971         ''|' ') dflt=none ;;
9972         esac
9973         fn=nd~+
9974         rp='Pathname for the vendor-supplied manual section 3 pages?'
9975         . ./getfile
9976         vendorman3dir="$ans"
9977         vendorman3direxp="$ansexp"
9978         ;;
9979 esac
9980 : Use ' ' for none so value is preserved next time through Configure
9981 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9982 prefixvar=vendorman3dir
9983 . ./installprefix
9984
9985 : Set the vendorscript variables
9986 case "$vendorprefix" in
9987 '')     d_vendorscript="$undef"
9988         vendorscript=''
9989         vendorscriptexp=''
9990         ;;
9991 *)      d_vendorscript="$define"
9992         : determine where vendor-supplied scripts go.
9993         case "$vendorscript" in
9994         '')     dflt=$vendorprefix/script
9995                 $test -d $dflt || dflt=$vendorbin ;;
9996         *)  dflt="$vendorscript" ;;
9997         esac
9998         $cat <<EOM
9999
10000 The installation process will create a directory for
10001 vendor-supplied scripts.
10002
10003 EOM
10004         fn=d~+
10005         rp='Pathname for the vendor-supplied scripts directory?'
10006         . ./getfile
10007         vendorscript="$ans"
10008         vendorscriptexp="$ansexp"
10009         ;;
10010 esac
10011 prefixvar=vendorscript
10012 . ./installprefix
10013
10014 : script used to emit important warnings
10015 cat >warn <<EOS
10016 $startsh
10017 if test \$# -gt 0; then
10018         echo "\$@" >msg
10019 else
10020         cat >msg
10021 fi
10022 echo "*** WARNING:" >&4
10023 sed -e 's/^/*** /' <msg >&4
10024 echo "*** " >&4
10025 cat msg >>config.msg
10026 echo " " >>config.msg
10027 rm -f msg
10028 EOS
10029 chmod +x warn
10030 $eunicefix warn
10031
10032 : see which of string.h or strings.h is needed
10033 echo " "
10034 strings=`./findhdr string.h`
10035 if $test "$strings" && $test -r "$strings"; then
10036         echo "Using <string.h> instead of <strings.h>." >&4
10037         val="$define"
10038 else
10039         val="$undef"
10040         strings=`./findhdr strings.h`
10041         if $test "$strings" && $test -r "$strings"; then
10042                 echo "Using <strings.h> instead of <string.h>." >&4
10043         else
10044                 ./warn "No string header found -- You'll surely have problems."
10045         fi
10046 fi
10047 set i_string
10048 eval $setvar
10049 case "$i_string" in
10050 "$undef") strings=`./findhdr strings.h`;;
10051 *)        strings=`./findhdr string.h`;;
10052 esac
10053
10054 : see if qgcvt exists
10055 set qgcvt d_qgcvt
10056 eval $inlibc
10057
10058 : Check what kind of doubles your system has
10059 $echo "Checking the kind of doubles you have..." >&4
10060 $cat >try.c <<EOP
10061 #$i_stdlib I_STDLIB
10062 #define DOUBLESIZE $doublesize
10063 #ifdef I_STDLIB
10064 #include <stdlib.h>
10065 #endif
10066 #include <stdio.h>
10067 static const double d = -0.1;
10068 int main() {
10069   unsigned const char* b = (unsigned const char*)(&d);
10070 #if DOUBLESIZE == 4
10071   if (b[0] == 0xCD && b[3] == 0xBD) {
10072     /* IEEE 754 32-bit little-endian */
10073     printf("1\n");
10074     exit(0);
10075   }
10076   if (b[0] == 0xBD && b[3] == 0xCD) {
10077     /* IEEE 754 32-bit big-endian */
10078     printf("2\n");
10079     exit(0);
10080   }
10081 #endif
10082 #if DOUBLESIZE == 8
10083   if (b[0] == 0x9A && b[7] == 0xBF) {
10084     /* IEEE 754 64-bit little-endian */
10085     printf("3\n");
10086     exit(0);
10087   }
10088   if (b[0] == 0xBF && b[7] == 0x9A) {
10089     /* IEEE 754 64-bit big-endian */
10090     printf("4\n");
10091     exit(0);
10092   }
10093   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10094    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10095     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10096     * 99 99 b9 bf 9a 99 99 99 */
10097     printf("7\n");
10098     exit(0);
10099   }
10100   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10101    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10102     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10103     * 99 99 99 9a bf b9 99 99 */
10104     printf("8\n");
10105     exit(0);
10106   }
10107 #endif
10108 #if DOUBLESIZE == 16
10109   if (b[0] == 0x9A && b[15] == 0xBF) {
10110     /* IEEE 754 128-bit little-endian */
10111     printf("5\n");
10112     exit(0);
10113   }
10114   if (b[0] == 0xBF && b[15] == 0x9A) {
10115     /* IEEE 754 128-bit big-endian */
10116     printf("6\n");
10117     exit(0);
10118   }
10119 #endif
10120   /* Then there are old mainframe/miniframe formats like VAX, IBM, and CRAY.
10121    * Whether those environments can still build Perl is debatable. */
10122   printf("-1\n"); /* unknown */
10123   exit(0);
10124 }
10125 EOP
10126 set try
10127 if eval $compile; then
10128     doublekind=`$run ./try`
10129 else
10130     doublekind=-1
10131 fi
10132 case "$doublekind" in
10133 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10134 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10135 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10136 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10137 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10138 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10139 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10140 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10141 *) echo "Cannot figure out your double.  You VAX, or something?" >&4 ;;
10142 esac
10143 $rm_try
10144
10145 : Check print/scan long double stuff
10146 echo " "
10147
10148 if $test X"$d_longdbl" = X"$define"; then
10149
10150 echo "Checking how to print long doubles..." >&4
10151
10152 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10153         $cat >try.c <<'EOCP'
10154 #include <sys/types.h>
10155 #include <stdio.h>
10156 int main() {
10157   double d = 123.456;
10158   printf("%.3f\n", d);
10159 }
10160 EOCP
10161         set try
10162         if eval $compile; then
10163                 yyy=`$run ./try`
10164                 case "$yyy" in
10165                 123.456)
10166                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10167                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10168                         echo "We will use %f."
10169                         ;;
10170                 esac
10171         fi
10172 fi
10173
10174 if $test X"$sPRIfldbl" = X; then
10175         $cat >try.c <<'EOCP'
10176 #include <sys/types.h>
10177 #include <stdio.h>
10178 int main() {
10179   long double d = 123.456;
10180   printf("%.3Lf\n", d);
10181 }
10182 EOCP
10183         set try
10184         if eval $compile; then
10185                 yyy=`$run ./try`
10186                 case "$yyy" in
10187                 123.456)
10188                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10189                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10190                         echo "We will use %Lf."
10191                         ;;
10192                 esac
10193         fi
10194 fi
10195
10196 if $test X"$sPRIfldbl" = X; then
10197         $cat >try.c <<'EOCP'
10198 #include <sys/types.h>
10199 #include <stdio.h>
10200 int main() {
10201   long double d = 123.456;
10202   printf("%.3llf\n", d);
10203 }
10204 EOCP
10205         set try
10206         if eval $compile; then
10207                 yyy=`$run ./try`
10208                 case "$yyy" in
10209                 123.456)
10210                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10211                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10212                         echo "We will use %llf."
10213                         ;;
10214                 esac
10215         fi
10216 fi
10217
10218 if $test X"$sPRIfldbl" = X; then
10219         $cat >try.c <<'EOCP'
10220 #include <sys/types.h>
10221 #include <stdio.h>
10222 int main() {
10223   long double d = 123.456;
10224   printf("%.3lf\n", d);
10225 }
10226 EOCP
10227         set try
10228         if eval $compile; then
10229                 yyy=`$run ./try`
10230                 case "$yyy" in
10231                 123.456)
10232                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10233                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10234                         echo "We will use %lf."
10235                         ;;
10236                 esac
10237         fi
10238 fi
10239
10240 if $test X"$sPRIfldbl" = X; then
10241         echo "Cannot figure out how to print long doubles." >&4
10242 else
10243         sSCNfldbl=$sPRIfldbl    # expect consistency
10244 fi
10245
10246 $rm_try
10247
10248 fi # d_longdbl
10249
10250 case "$sPRIfldbl" in
10251 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10252         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10253         d_SCNfldbl="$undef";
10254         ;;
10255 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10256         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10257         d_SCNfldbl="$define";
10258         ;;
10259 esac
10260
10261 : Before committing on uselongdouble, see whether that looks sane.
10262 if $test "$uselongdouble" = "$define"; then
10263     message=""
10264     echo " "
10265     echo "Checking if your long double math functions work right..." >&4
10266     $cat > try.c <<EOF
10267 #include <math.h>
10268 #include <stdio.h>
10269 int main() {
10270   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10271 }
10272 EOF
10273     case "$osname:$gccversion" in
10274     aix:)       saveccflags="$ccflags"
10275                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10276     esac
10277     set try
10278     if eval $compile_ok; then
10279       yyy=`$run ./try`
10280     fi
10281     case "$yyy" in
10282     3) echo "Your long double math functions are working correctly." >&4 ;;
10283     *) echo "Your long double math functions are broken, not using long doubles." >&4
10284        uselongdouble=$undef
10285        ;;
10286     esac
10287     $rm_try
10288     case "$osname:$gccversion" in
10289     aix:)       ccflags="$saveccflags" ;; # restore
10290     esac
10291 fi
10292
10293 : Check how to convert floats to strings.
10294
10295 if test "X$d_Gconvert" = X; then
10296
10297 echo " "
10298 echo "Checking for an efficient way to convert floats to strings."
10299 echo " " > try.c
10300 case "$uselongdouble" in
10301 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10302 esac
10303 case "$d_longdbl" in
10304 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10305 esac
10306 case "$d_PRIgldbl" in
10307 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10308 esac
10309 $cat >>try.c <<EOP
10310 #ifdef TRY_gconvert
10311 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10312 char *myname = "gconvert";
10313 #endif
10314 #ifdef TRY_gcvt
10315 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10316 char *myname = "gcvt";
10317 #endif
10318 #ifdef TRY_qgcvt
10319 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10320 char *myname = "qgcvt";
10321 #define DOUBLETYPE long double
10322 #endif
10323 #ifdef TRY_sprintf
10324 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10325 #ifdef HAS_PRIgldbl
10326 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10327 #else
10328 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10329 #endif
10330 #else
10331 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10332 #endif
10333 char *myname = "sprintf";
10334 #endif
10335
10336 #ifndef DOUBLETYPE
10337 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10338 #define DOUBLETYPE long double
10339 #else
10340 #define DOUBLETYPE double
10341 #endif
10342 #endif
10343
10344 #include <stdio.h>
10345
10346 #$i_stdlib I_STDLIB
10347 #ifdef I_STDLIB
10348 #include <stdlib.h>
10349 #endif
10350 #$i_string I_STRING
10351 #ifdef I_STRING
10352 #  include <string.h>
10353 #else
10354 #  include <strings.h>
10355 #endif
10356
10357 int checkit(char *expect, char *got)
10358 {
10359     if (strcmp(expect, got)) {
10360                 printf("%s oddity:  Expected %s, got %s\n",
10361                         myname, expect, got);
10362                 exit(1);
10363         }
10364 }
10365
10366 int main()
10367 {
10368         char buf[64];
10369         buf[63] = '\0';
10370
10371         /* This must be 1st test on (which?) platform */
10372         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10373         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10374         checkit("0.1", buf);
10375
10376         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10377         checkit("0.01", buf);
10378
10379         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10380         checkit("0.001", buf);
10381
10382         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10383         checkit("0.0001", buf);
10384
10385         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10386         if (strlen(buf) > 5)
10387             checkit("9e-005", buf); /* for Microsoft ?? */
10388         else
10389             checkit("9e-05", buf);
10390
10391         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10392         checkit("1", buf);
10393
10394         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10395         checkit("1.1", buf);
10396
10397         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10398         checkit("1.01", buf);
10399
10400         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10401         checkit("1.001", buf);
10402
10403         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10404         checkit("1.0001", buf);
10405
10406         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10407         checkit("1.00001", buf);
10408
10409         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10410         checkit("1.000001", buf);
10411
10412         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10413         checkit("0", buf);
10414
10415         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10416         checkit("-1", buf);
10417
10418         /* Some Linux gcvt's give 1.e+5 here. */
10419         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10420         checkit("100000", buf);
10421
10422         /* Some Linux gcvt's give -1.e+5 here. */
10423         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10424         checkit("-100000", buf);
10425
10426         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10427         checkit("123.456", buf);
10428
10429         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10430         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10431         /* 34 should be enough to scare even long double
10432          * places into using the e notation. */
10433         if (strlen(buf) > 5)
10434             checkit("1e+034", buf); /* for Microsoft */
10435         else
10436             checkit("1e+34", buf);
10437
10438         /* For Perl, if you add additional tests here, also add them to
10439          * t/base/num.t for benefit of platforms not using Configure or
10440          * overriding d_Gconvert */
10441
10442         exit(0);
10443 }
10444 EOP
10445 : first add preferred functions to our list
10446 xxx_list=""
10447 for xxx_convert in $gconvert_preference; do
10448     case $xxx_convert in
10449     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10450     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10451     esac
10452 done
10453 : then add any others
10454 for xxx_convert in gconvert gcvt sprintf; do
10455     case "$xxx_list" in
10456     *$xxx_convert*) ;;
10457     *) xxx_list="$xxx_list $xxx_convert" ;;
10458     esac
10459 done
10460
10461 case "$d_longdbl$uselongdouble" in
10462 "$define$define")
10463     : again, add preferred functions to our list first
10464     xxx_ld_list=""
10465     for xxx_convert in $gconvert_ld_preference; do
10466         case $xxx_convert in
10467         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10468         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10469         esac
10470     done
10471     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10472     for xxx_convert in qgcvt sprintf $xxx_list; do
10473         case "$xxx_ld_list" in
10474         $xxx_convert*|*" $xxx_convert"*) ;;
10475         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10476         esac
10477     done
10478     : if sprintf cannot do long doubles, move it to the end
10479     if test "$d_PRIgldbl" != "$define"; then
10480         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10481     fi
10482     : if no qgcvt, remove it
10483     if test "$d_qgcvt" != "$define"; then
10484         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10485     fi
10486     : use the ld_list
10487     xxx_list="$xxx_ld_list"
10488     ;;
10489 esac
10490
10491 for xxx_convert in $xxx_list; do
10492         echo "Trying $xxx_convert..."
10493         $rm -f try try$_o core
10494         set try -DTRY_$xxx_convert
10495         if eval $compile; then
10496                 echo "$xxx_convert() found." >&4
10497                 if $run ./try; then
10498                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10499                         break;
10500                 else
10501                         echo "...But $xxx_convert didn't work as I expected."
10502                         xxx_convert=''
10503                 fi
10504         else
10505                 echo "$xxx_convert NOT found." >&4
10506         fi
10507 done
10508
10509 if test X$xxx_convert = X; then
10510     echo "*** WHOA THERE!!! ***" >&4
10511     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10512     xxx_convert=sprintf
10513 fi
10514
10515 case "$xxx_convert" in
10516 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10517 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10518 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10519 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10520    "$define$define$define")
10521       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10522    "$define$define$undef")
10523       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10524    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10525    esac
10526    ;;
10527 esac
10528
10529 fi
10530 $rm_try
10531
10532 : see if _fwalk exists
10533 set fwalk d__fwalk
10534 eval $inlibc
10535
10536 : Initialize h_fcntl
10537 h_fcntl=false
10538
10539 : Initialize h_sysfile
10540 h_sysfile=false
10541
10542 : access call always available on UNIX
10543 set access d_access
10544 eval $inlibc
10545
10546 : locate the flags for 'access()'
10547 case "$d_access" in
10548 "$define")
10549         echo " "
10550         $cat >access.c <<EOCP
10551 #include <sys/types.h>
10552 #ifdef I_FCNTL
10553 #include <fcntl.h>
10554 #endif
10555 #ifdef I_SYS_FILE
10556 #include <sys/file.h>
10557 #endif
10558 #ifdef I_UNISTD
10559 #include <unistd.h>
10560 #endif
10561 #$i_stdlib I_STDLIB
10562 #ifdef I_STDLIB
10563 #include <stdlib.h>
10564 #endif
10565 int main() {
10566         exit(R_OK);
10567 }
10568 EOCP
10569         : check sys/file.h first, no particular reason here
10570         if $test `./findhdr sys/file.h` && \
10571                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10572                 h_sysfile=true;
10573                 echo "<sys/file.h> defines the *_OK access constants." >&4
10574         elif $test `./findhdr fcntl.h` && \
10575                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10576                 h_fcntl=true;
10577                 echo "<fcntl.h> defines the *_OK access constants." >&4
10578         elif $test `./findhdr unistd.h` && \
10579                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10580                 echo "<unistd.h> defines the *_OK access constants." >&4
10581         else
10582                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10583         fi
10584         ;;
10585 esac
10586 $rm -f access*
10587
10588 : see if accessx exists
10589 set accessx d_accessx
10590 eval $inlibc
10591
10592 : see if acosh exists
10593 set acosh d_acosh
10594 eval $inlibc
10595
10596 : see if aintl exists
10597 set aintl d_aintl
10598 eval $inlibc
10599
10600 : see if alarm exists
10601 set alarm d_alarm
10602 eval $inlibc
10603
10604 : see if 64bit time functions exists
10605
10606 set ctime64 d_ctime64
10607 eval $inlibc
10608
10609 set localtime64 d_localtime64
10610 eval $inlibc
10611
10612 set gmtime64 d_gmtime64
10613 eval $inlibc
10614
10615 set mktime64 d_mktime64
10616 eval $inlibc
10617
10618 set difftime64 d_difftime64
10619 eval $inlibc
10620
10621 set asctime64 d_asctime64
10622 eval $inlibc
10623
10624 : see if POSIX threads are available
10625 set pthread.h i_pthread
10626 eval $inhdr
10627
10628 : define a function to check prototypes
10629 $cat > protochk <<EOSH
10630 $startsh
10631 cc="$cc"
10632 optimize="$optimize"
10633 ccflags="$ccflags"
10634 prototype="$prototype"
10635 define="$define"
10636 rm_try="$rm_try"
10637 usethreads=$usethreads
10638 i_pthread=$i_pthread
10639 pthread_h_first=$pthread_h_first
10640 EOSH
10641
10642 $cat >> protochk <<'EOSH'
10643
10644 $rm_try
10645 foo="$1"
10646 shift
10647 while test $# -ge 2; do
10648         case "$1" in
10649                 $define) echo "#include <$2>" >> try.c ;;
10650                 literal) echo "$2" >> try.c ;;
10651         esac
10652     # Extra magic for the benefit of systems that need pthread.h
10653     # to be included early to correctly detect threadsafe functions.
10654     # Such functions must guarantee themselves, though, that the usethreads
10655     # and i_pthread have been defined, before calling protochk.
10656     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10657         echo "#include <pthread.h>" >> try.c
10658         pthread_h_done=yes
10659     fi
10660     shift 2
10661 done
10662 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10663 cat >> try.c <<'EOCP'
10664 #ifdef CAN_PROTOTYPE
10665 #define _(args) args
10666 #else
10667 #define _(args) ()
10668 #endif
10669 EOCP
10670 echo "$foo" >> try.c
10671 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10672 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10673 status=$?
10674 $rm_try
10675 exit $status
10676 EOSH
10677 chmod +x protochk
10678 $eunicefix protochk
10679
10680 : Define hasproto macro for Configure internal use
10681 hasproto='varname=$1; func=$2; shift; shift;
10682 while $test $# -ge 2; do
10683         case "$1" in
10684         $define) echo "#include <$2>";;
10685         esac ;
10686     shift 2;
10687 done > try.c;
10688 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10689 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10690         echo "$func() prototype found.";
10691         val="$define";
10692 else
10693         echo "$func() prototype NOT found.";
10694         val="$undef";
10695 fi;
10696 set $varname;
10697 eval $setvar;
10698 $rm_try tryout.c'
10699
10700 : see if sys/types.h has to be included
10701 set sys/types.h i_systypes
10702 eval $inhdr
10703
10704 : see if sys/select.h has to be included
10705 set sys/select.h i_sysselct
10706 eval $inhdr
10707
10708 : Define hasfield macro for Configure internal use
10709 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10710 while $test $# -ge 2; do
10711         case "$1" in
10712         $define) echo "#include <$2>";;
10713         esac ;
10714     shift 2;
10715 done > try.c;
10716 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10717 set try;
10718 if eval $compile; then
10719         val="$define";
10720 else
10721         val="$undef";
10722 fi;
10723 set $varname;
10724 eval $setvar;
10725 $rm_try'
10726
10727 : see if we should include time.h, sys/time.h, or both
10728 echo " "
10729 if test "X$timeincl" = X; then
10730         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10731         $echo $n "I'm now running the test program...$c"
10732         $cat >try.c <<EOCP
10733 #include <sys/types.h>
10734 #ifdef I_TIME
10735 #include <time.h>
10736 #endif
10737 #ifdef I_SYSTIME
10738 #ifdef SYSTIMEKERNEL
10739 #define KERNEL
10740 #endif
10741 #include <sys/time.h>
10742 #endif
10743 #ifdef I_SYSSELECT
10744 #include <sys/select.h>
10745 #endif
10746 #$i_stdlib I_STDLIB
10747 #ifdef I_STDLIB
10748 #include <stdlib.h>
10749 #endif
10750 int main()
10751 {
10752         struct tm foo;
10753 #ifdef S_TIMEVAL
10754         struct timeval bar;
10755 #endif
10756 #ifdef S_TIMEZONE
10757         struct timezone tzp;
10758 #endif
10759         if (foo.tm_sec == foo.tm_sec)
10760                 exit(0);
10761 #ifdef S_TIMEVAL
10762         if (bar.tv_sec == bar.tv_sec)
10763                 exit(0);
10764 #endif
10765         exit(1);
10766 }
10767 EOCP
10768         flags=''
10769         for s_timezone in '-DS_TIMEZONE' ''; do
10770         sysselect=''
10771         for s_timeval in '-DS_TIMEVAL' ''; do
10772         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10773         for i_time in '' '-DI_TIME'; do
10774         for i_systime in '-DI_SYSTIME' ''; do
10775                 case "$flags" in
10776                 '') $echo $n ".$c"
10777                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10778                         if eval $compile; then
10779                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10780                                 shift
10781                                 flags="$*"
10782                                 echo " "
10783                                 $echo $n "Succeeded with $flags$c"
10784                         fi
10785                         ;;
10786                 esac
10787         done
10788         done
10789         done
10790         done
10791         done
10792         timeincl=''
10793         echo " "
10794         case "$flags" in
10795         *SYSTIMEKERNEL*) i_systimek="$define"
10796                 timeincl=`./findhdr sys/time.h`
10797                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10798         *) i_systimek="$undef";;
10799         esac
10800         case "$flags" in
10801         *I_TIME*) i_time="$define"
10802                 timeincl=`./findhdr time.h`" $timeincl"
10803                 echo "We'll include <time.h>." >&4;;
10804         *) i_time="$undef";;
10805         esac
10806         case "$flags" in
10807         *I_SYSTIME*) i_systime="$define"
10808                 timeincl=`./findhdr sys/time.h`" $timeincl"
10809                 echo "We'll include <sys/time.h>." >&4;;
10810         *) i_systime="$undef";;
10811         esac
10812         $rm_try
10813 fi
10814 : see if struct tm knows about tm_zone
10815 case "$i_systime$i_time" in
10816 *$define*)
10817         echo " "
10818         echo "Checking to see if your struct tm has tm_zone field..." >&4
10819         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10820         eval $hasfield
10821         ;;
10822 *)      val="$undef"
10823         set d_tm_tm_zone
10824         eval $setvar
10825         ;;
10826 esac
10827 case "$d_tm_tm_zone" in
10828 "$define")      echo "Yes, it does."   ;;
10829 *)              echo "No, it doesn't." ;;
10830 esac
10831 : see if struct tm knows about tm_gmtoff
10832 case "$i_systime$i_time" in
10833 *$define*)
10834         echo " "
10835         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10836         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10837         eval $hasfield
10838         ;;
10839 *)      val="$undef"
10840         set d_tm_tm_gmtoff
10841         eval $setvar
10842         ;;
10843 esac
10844 case "$d_tm_tm_gmtoff" in
10845 "$define")      echo "Yes, it does."   ;;
10846 *)              echo "No, it doesn't." ;;
10847 esac
10848
10849 : see if asctime_r exists
10850 set asctime_r d_asctime_r
10851 eval $inlibc
10852 case "$d_asctime_r" in
10853 "$define")
10854         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10855         case "$d_asctime_r_proto:$usethreads" in
10856         ":define")      d_asctime_r_proto=define
10857                 set d_asctime_r_proto asctime_r $hdrs
10858                 eval $hasproto ;;
10859         *)      ;;
10860         esac
10861         case "$d_asctime_r_proto" in
10862         define)
10863         case "$asctime_r_proto" in
10864         ''|0) try='char* asctime_r(const struct tm*, char*);'
10865         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10866         esac
10867         case "$asctime_r_proto" in
10868         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10869         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10870         esac
10871         case "$asctime_r_proto" in
10872         ''|0) try='int asctime_r(const struct tm*, char*);'
10873         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10874         esac
10875         case "$asctime_r_proto" in
10876         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10877         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10878         esac
10879         case "$asctime_r_proto" in
10880         ''|0)   d_asctime_r=undef
10881                 asctime_r_proto=0
10882                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10883         * )     case "$asctime_r_proto" in
10884                 REENTRANT_PROTO*) ;;
10885                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10886                 esac
10887                 echo "Prototype: $try" ;;
10888         esac
10889         ;;
10890         *)      case "$usethreads" in
10891                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10892                 esac
10893                 d_asctime_r=undef
10894                 asctime_r_proto=0
10895                 ;;
10896         esac
10897         ;;
10898 *)      asctime_r_proto=0
10899         ;;
10900 esac
10901
10902 : see if asinh exists
10903 set asinh d_asinh
10904 eval $inlibc
10905
10906 : see if atanh exists
10907 set atanh d_atanh
10908 eval $inlibc
10909
10910 : see if atolf exists
10911 set atolf d_atolf
10912 eval $inlibc
10913
10914 : see if atoll exists
10915 set atoll d_atoll
10916 eval $inlibc
10917
10918 : Look for GCC-style attribute format
10919 case "$d_attribute_format" in
10920 '')
10921 echo " "
10922 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10923 $cat >attrib.c <<'EOCP'
10924 #include <stdio.h>
10925 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10926 EOCP
10927 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10928         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10929                 echo "Your C compiler doesn't support __attribute__((format))."
10930                 val="$undef"
10931         else
10932                 echo "Your C compiler supports __attribute__((format))."
10933                 val="$define"
10934         fi
10935 else
10936         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10937         val="$undef"
10938 fi
10939 ;;
10940 *) val="$d_attribute_format" ;;
10941 esac
10942 set d_attribute_format
10943 eval $setvar
10944 $rm -f attrib*
10945
10946 : Look for GCC-style attribute format with null format allowed
10947 case "$d_printf_format_null" in
10948 '') case "$d_attribute_format" in
10949     $define)
10950         echo " "
10951         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10952 $cat >attrib.c <<EOCP
10953 #include <stdio.h>
10954 #$i_stdlib I_STDLIB
10955 #ifdef I_STDLIB
10956 #include <stdlib.h>
10957 #endif
10958 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10959 int null_printf (char* pat,...) { return (int)pat; }
10960 int main () { exit(null_printf(NULL)); }
10961 EOCP
10962         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10963             : run the executable in case it produces a run-time warning
10964             if $run ./attrib >>attrib.out 2>&1; then
10965                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10966                     echo "Your C compiler doesn't allow __printf__ format to be null."
10967                     val="$undef"
10968                 else
10969                     echo "Your C compiler allows __printf__ format to be null."
10970                     val="$define"
10971                 fi
10972             else
10973             echo "Your C compiler executable failed with __printf__ format null."
10974             val="$undef"
10975         fi
10976     else
10977         echo "Your C compiler fails with __printf__ format null."
10978         val="$undef"
10979     fi
10980     ;;
10981     *)  val="$undef" ;;
10982     esac
10983 ;;
10984 *)  val="$d_printf_format_null" ;;
10985 esac
10986 set d_printf_format_null
10987 eval $setvar
10988 $rm -f attrib*
10989
10990 : Look for GCC-style attribute malloc
10991 case "$d_attribute_malloc" in
10992 '')
10993 echo " "
10994 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10995 $cat >attrib.c <<'EOCP'
10996 #include <stdio.h>
10997 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10998 EOCP
10999 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11000         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11001                 echo "Your C compiler doesn't support __attribute__((malloc))."
11002                 val="$undef"
11003         else
11004                 echo "Your C compiler supports __attribute__((malloc))."
11005                 val="$define"
11006         fi
11007 else
11008         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11009         val="$undef"
11010 fi
11011 ;;
11012 *) val="$d_attribute_malloc" ;;
11013 esac
11014 set d_attribute_malloc
11015 eval $setvar
11016 $rm -f attrib*
11017
11018 : Look for GCC-style attribute nonnull
11019 case "$d_attribute_nonnull" in
11020 '')
11021 echo " "
11022 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11023 $cat >attrib.c <<'EOCP'
11024 #include <stdio.h>
11025 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11026 EOCP
11027 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11028         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11029                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11030                 val="$undef"
11031         else
11032                 echo "Your C compiler supports __attribute__((nonnull))."
11033                 val="$define"
11034         fi
11035 else
11036         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11037         val="$undef"
11038 fi
11039 ;;
11040 *) val="$d_attribute_nonnull" ;;
11041 esac
11042 set d_attribute_nonnull
11043 eval $setvar
11044 $rm -f attrib*
11045
11046 : Look for GCC-style attribute noreturn
11047 case "$d_attribute_noreturn" in
11048 '')
11049 echo " "
11050 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11051 $cat >attrib.c <<'EOCP'
11052 #include <stdio.h>
11053 void fall_over_dead( void ) __attribute__((noreturn));
11054 EOCP
11055 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11056         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11057                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11058                 val="$undef"
11059         else
11060                 echo "Your C compiler supports __attribute__((noreturn))."
11061                 val="$define"
11062         fi
11063 else
11064         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11065         val="$undef"
11066 fi
11067 ;;
11068 *) val="$d_attribute_noreturn" ;;
11069 esac
11070 set d_attribute_noreturn
11071 eval $setvar
11072 $rm -f attrib*
11073
11074 : Look for GCC-style attribute pure
11075 case "$d_attribute_pure" in
11076 '')
11077 echo " "
11078 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11079 $cat >attrib.c <<'EOCP'
11080 #include <stdio.h>
11081 int square( int n ) __attribute__((pure));
11082 EOCP
11083 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11084         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11085                 echo "Your C compiler doesn't support __attribute__((pure))."
11086                 val="$undef"
11087         else
11088                 echo "Your C compiler supports __attribute__((pure))."
11089                 val="$define"
11090         fi
11091 else
11092         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11093         val="$undef"
11094 fi
11095 ;;
11096 *) val="$d_attribute_pure" ;;
11097 esac
11098 set d_attribute_pure
11099 eval $setvar
11100 $rm -f attrib*
11101
11102 : Look for GCC-style attribute unused
11103 case "$d_attribute_unused" in
11104 '')
11105 echo " "
11106 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11107 $cat >attrib.c <<'EOCP'
11108 #include <stdio.h>
11109 int do_something( int dummy __attribute__((unused)), int n );
11110 EOCP
11111 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11112         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11113                 echo "Your C compiler doesn't support __attribute__((unused))."
11114                 val="$undef"
11115         else
11116                 echo "Your C compiler supports __attribute__((unused))."
11117                 val="$define"
11118         fi
11119 else
11120         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11121         val="$undef"
11122 fi
11123 ;;
11124 *) val="$d_attribute_unused" ;;
11125 esac
11126 set d_attribute_unused
11127 eval $setvar
11128 $rm -f attrib*
11129
11130 : Look for GCC-style attribute deprecated
11131 case "$d_attribute_deprecated" in
11132 '')
11133 echo " "
11134 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11135 $cat >attrib.c <<'EOCP'
11136 #include <stdio.h>
11137 int I_am_deprecated(void) __attribute__((deprecated));
11138 EOCP
11139 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11140         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11141                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11142                 val="$undef"
11143         else
11144                 echo "Your C compiler supports __attribute__((deprecated))."
11145                 val="$define"
11146         fi
11147 else
11148         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11149         val="$undef"
11150 fi
11151 ;;
11152 *) val="$d_attribute_deprecated" ;;
11153 esac
11154 set d_attribute_deprecated
11155 eval $setvar
11156 $rm -f attrib*
11157
11158 : Look for GCC-style attribute warn_unused_result
11159 case "$d_attribute_warn_unused_result" in
11160 '')
11161 echo " "
11162 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11163 $cat >attrib.c <<'EOCP'
11164 #include <stdio.h>
11165 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11166 EOCP
11167 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11168         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11169                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11170                 val="$undef"
11171         else
11172                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11173                 val="$define"
11174         fi
11175 else
11176         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11177         val="$undef"
11178 fi
11179 ;;
11180 *) val="$d_attribute_warn_unused_result" ;;
11181 esac
11182 set d_attribute_warn_unused_result
11183 eval $setvar
11184 $rm -f attrib*
11185
11186 : see if bcmp exists
11187 set bcmp d_bcmp
11188 eval $inlibc
11189
11190 : see if bcopy exists
11191 set bcopy d_bcopy
11192 eval $inlibc
11193
11194 : see if getpgrp exists
11195 set getpgrp d_getpgrp
11196 eval $inlibc
11197
11198 case "$d_getpgrp" in
11199 "$define")
11200         echo " "
11201         echo "Checking to see which flavor of getpgrp is in use..."
11202         $cat >try.c <<EOP
11203 #$i_unistd I_UNISTD
11204 #include <sys/types.h>
11205 #ifdef I_UNISTD
11206 #  include <unistd.h>
11207 #endif
11208 #$i_stdlib I_STDLIB
11209 #ifdef I_STDLIB
11210 #include <stdlib.h>
11211 #endif
11212 int main()
11213 {
11214         if (getuid() == 0) {
11215                 printf("(I see you are running Configure as super-user...)\n");
11216                 setuid(1);
11217         }
11218 #ifdef TRY_BSD_PGRP
11219         if (getpgrp(1) == 0)
11220                 exit(0);
11221 #else
11222         if (getpgrp() > 0)
11223                 exit(0);
11224 #endif
11225         exit(1);
11226 }
11227 EOP
11228         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11229                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11230                 val="$define"
11231         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11232                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11233                 val="$undef"
11234         else
11235                 echo "I can't seem to compile and run the test program."
11236                 if ./usg; then
11237                         xxx="a USG one, i.e. you use getpgrp()."
11238                 else
11239                         # SVR4 systems can appear rather BSD-ish.
11240                         case "$i_unistd" in
11241                         $undef)
11242                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11243                                 val="$define"
11244                                 ;;
11245                         $define)
11246                                 xxx="probably a USG one, i.e. you use getpgrp()."
11247                                 val="$undef"
11248                                 ;;
11249                         esac
11250                 fi
11251                 echo "Assuming your getpgrp is $xxx" >&4
11252         fi
11253         ;;
11254 *) val="$undef";;
11255 esac
11256 set d_bsdgetpgrp
11257 eval $setvar
11258 $rm_try
11259
11260 : see if setpgrp exists
11261 set setpgrp d_setpgrp
11262 eval $inlibc
11263
11264 case "$d_setpgrp" in
11265 "$define")
11266         echo " "
11267         echo "Checking to see which flavor of setpgrp is in use..."
11268         $cat >try.c <<EOP
11269 #$i_unistd I_UNISTD
11270 #include <sys/types.h>
11271 #ifdef I_UNISTD
11272 #  include <unistd.h>
11273 #endif
11274 #$i_stdlib I_STDLIB
11275 #ifdef I_STDLIB
11276 #include <stdlib.h>
11277 #endif
11278 int main()
11279 {
11280         if (getuid() == 0) {
11281                 printf("(I see you are running Configure as super-user...)\n");
11282                 setuid(1);
11283         }
11284 #ifdef TRY_BSD_PGRP
11285         if (-1 == setpgrp(1, 1))
11286                 exit(0);
11287 #else
11288         if (setpgrp() != -1)
11289                 exit(0);
11290 #endif
11291         exit(1);
11292 }
11293 EOP
11294         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11295                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11296                 val="$define"
11297         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11298                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11299                 val="$undef"
11300         else
11301                 echo "(I can't seem to compile and run the test program.)"
11302                 if ./usg; then
11303                         xxx="a USG one, i.e. you use setpgrp()."
11304                 else
11305                         # SVR4 systems can appear rather BSD-ish.
11306                         case "$i_unistd" in
11307                         $undef)
11308                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11309                                 val="$define"
11310                                 ;;
11311                         $define)
11312                                 xxx="probably a USG one, i.e. you use setpgrp()."
11313                                 val="$undef"
11314                                 ;;
11315                         esac
11316                 fi
11317                 echo "Assuming your setpgrp is $xxx" >&4
11318         fi
11319         ;;
11320 *) val="$undef";;
11321 esac
11322 set d_bsdsetpgrp
11323 eval $setvar
11324 $rm_try
11325
11326 : Look for GCC-style __builtin_choose_expr
11327 case "$d_builtin_choose_expr" in
11328 '')
11329     echo " "
11330     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11331     $cat >try.c <<'EOCP'
11332 #include <assert.h>
11333 #include <stdlib.h>
11334 #include <stdio.h>
11335
11336 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11337
11338 int main(void) {
11339     assert( SYRINX(1) == 2112 );
11340     assert( SYRINX(1) != 5150 );
11341     assert( SYRINX(0) == 5150 );
11342     assert( SYRINX(0) != 2112 );
11343     puts( "All good!" );
11344     exit(0);
11345 }
11346
11347 EOCP
11348     set try
11349     if eval $compile && $run ./try; then
11350         echo "Your C compiler supports __builtin_choose_expr."
11351         val="$define"
11352     else
11353         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11354         val="$undef"
11355     fi
11356 ;;
11357 *) val="$d_builtin_choose_expr" ;;
11358 esac
11359
11360 set d_builtin_choose_expr
11361 eval $setvar
11362 $rm_try
11363
11364 : Look for GCC-style __builtin_expect
11365 case "$d_builtin_expect" in
11366 '')
11367     echo " "
11368     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11369     $cat >try.c <<'EOCP'
11370 int main(void) {
11371     int n = 50;
11372     if ( __builtin_expect(n, 0) ) n = 1;
11373     /* Remember shell exit code truth is 0, C truth is non-zero */
11374     return !(n == 1);
11375 }
11376 EOCP
11377     set try
11378     if eval $compile && $run ./try; then
11379         echo "Your C compiler supports __builtin_expect."
11380         val="$define"
11381     else
11382         echo "Your C compiler doesn't seem to understand __builtin_expect."
11383         val="$undef"
11384     fi
11385     ;;
11386 *) val="$d_builtin_expect" ;;
11387 esac
11388
11389 set d_builtin_expect
11390 eval $setvar
11391 $rm_try
11392
11393 : see if bzero exists
11394 set bzero d_bzero
11395 eval $inlibc
11396
11397 : see if stdarg is available
11398 echo " "
11399 if $test `./findhdr stdarg.h`; then
11400         echo "<stdarg.h> found." >&4
11401         valstd="$define"
11402 else
11403         echo "<stdarg.h> NOT found." >&4
11404         valstd="$undef"
11405 fi
11406
11407 : see if varargs is available
11408 echo " "
11409 if $test `./findhdr varargs.h`; then
11410         echo "<varargs.h> found." >&4
11411 else
11412         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11413 fi
11414
11415 : set up the varargs testing programs
11416 $cat > varargs.c <<EOP
11417 #ifdef I_STDARG
11418 #include <stdarg.h>
11419 #endif
11420 #ifdef I_VARARGS
11421 #include <varargs.h>
11422 #endif
11423
11424 #ifdef I_STDARG
11425 int f(char *p, ...)
11426 #else
11427 int f(va_alist)
11428 va_dcl
11429 #endif
11430 {
11431         va_list ap;
11432 #ifndef I_STDARG
11433         char *p;
11434 #endif
11435 #ifdef I_STDARG
11436         va_start(ap,p);
11437 #else
11438         va_start(ap);
11439         p = va_arg(ap, char *);
11440 #endif
11441         va_end(ap);
11442         return 0;
11443 }
11444 EOP
11445 $cat > varargs <<EOP
11446 $startsh
11447 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11448         echo "true"
11449 else
11450         echo "false"
11451 fi
11452 $rm -f varargs$_o
11453 EOP
11454 chmod +x varargs
11455
11456 : now check which varargs header should be included
11457 echo " "
11458 i_varhdr=''
11459 val=''
11460 case "$valstd" in
11461 "$define")
11462         if `./varargs I_STDARG`; then
11463                 val='stdarg.h'
11464         elif `./varargs I_VARARGS`; then
11465                 val='varargs.h'
11466         fi
11467         ;;
11468 *)
11469         if `./varargs I_VARARGS`; then
11470                 val='varargs.h'
11471         fi
11472         ;;
11473 esac
11474 case "$val" in
11475 '')
11476         echo " "
11477         echo "*** WHOA THERE!!! ***" >&4
11478         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
11479         case "$knowitall" in
11480         '')
11481         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
11482                 exit 1
11483                 ;;
11484         esac
11485 echo "I could not find the definition for va_dcl... You have problems..." >&4
11486         val="$undef"; set i_stdarg; eval $setvar
11487         val="$undef"; set i_varargs; eval $setvar
11488         ;;
11489 *)
11490         set i_varhdr
11491         eval $setvar
11492         case "$i_varhdr" in
11493         stdarg.h)
11494                 val="$define"; set i_stdarg; eval $setvar
11495                 val="$undef"; set i_varargs; eval $setvar
11496                 ;;
11497         varargs.h)
11498                 val="$undef"; set i_stdarg; eval $setvar
11499                 val="$define"; set i_varargs; eval $setvar
11500                 ;;
11501         esac
11502         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11503 esac
11504 $rm -f varargs*
11505
11506 : see if the Compiler supports C99 variadic macros
11507 case "$i_stdarg$i_stdlib" in
11508     "$define$define")
11509     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11510     $cat >try.c <<EOCP
11511 #include <stdio.h>
11512 #include <stdarg.h>
11513
11514 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11515
11516 int main() {
11517   char buf[20];
11518   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11519   puts(buf);
11520   return 0;
11521 }
11522 EOCP
11523     set try
11524     if eval $compile && $run ./try 2>&1 >/dev/null; then
11525         case "`$run ./try`" in
11526             "123 456 789")
11527             echo "You have C99 variadic macros." >&4
11528             d_c99_variadic_macros="$define"
11529             ;;
11530             *)
11531             echo "You don't have functional C99 variadic macros." >&4
11532             d_c99_variadic_macros="$undef"
11533             ;;
11534         esac
11535     else
11536         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11537         d_c99_variadic_macros="$undef"
11538     fi
11539     $rm_try
11540     ;;
11541     *)
11542     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11543     d_c99_variadic_macros="$undef"
11544     ;;
11545 esac
11546
11547 : see if signal is declared as pointer to function returning int or void
11548 echo " "
11549 xxx=`./findhdr signal.h`
11550 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11551 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11552         echo "You have int (*signal())() instead of void." >&4
11553         val="$undef"
11554 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11555         echo "You have void (*signal())()." >&4
11556         val="$define"
11557 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11558         echo "You have int (*signal())() instead of void." >&4
11559         val="$undef"
11560 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11561         echo "You have void (*signal())()." >&4
11562         val="$define"
11563 else
11564         case "$d_voidsig" in
11565         '')
11566         echo "I can't determine whether signal handler returns void or int..." >&4
11567                 dflt=void
11568                 rp="What type does your signal handler return?"
11569                 . ./myread
11570                 case "$ans" in
11571                 v*) val="$define";;
11572                 *) val="$undef";;
11573                 esac;;
11574         "$define")
11575                 echo "As you already told me, signal handler returns void." >&4
11576                 val="$define"
11577                 ;;
11578         *)      echo "As you already told me, signal handler returns int." >&4
11579                 val="$undef"
11580                 ;;
11581         esac
11582 fi
11583 set d_voidsig
11584 eval $setvar
11585 case "$d_voidsig" in
11586 "$define") signal_t="void";;
11587 *) signal_t="int";;
11588 esac
11589 $rm -f $$.tmp
11590
11591 : check for ability to cast large floats to 32-bit ints.
11592 echo " "
11593 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11594 if $test "$intsize" -ge 4; then
11595         xxx=int
11596 else
11597         xxx=long
11598 fi
11599 $cat >try.c <<EOCP
11600 #include <stdio.h>
11601 #$i_stdlib I_STDLIB
11602 #ifdef I_STDLIB
11603 #include <stdlib.h>
11604 #endif
11605 #include <sys/types.h>
11606 #include <signal.h>
11607 $signal_t blech(int s) { exit(3); }
11608 int main()
11609 {
11610         $xxx i32;
11611         double f, g;
11612         int result = 0;
11613         char str[16];
11614         signal(SIGFPE, blech);
11615
11616         /* Don't let compiler optimize the test away.  Store the number
11617            in a writable string for gcc to pass to sscanf under HP-UX.
11618         */
11619         sprintf(str, "2147483647");
11620         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11621         g = 10 * f;
11622         i32  = ($xxx) g;
11623
11624         /* x86 processors will probably give 0x8000 0000, which is a
11625            sign change.  We don't want that.  We want to mimic SPARC
11626            behavior here, which is to preserve the sign and give
11627            back 0x7fff ffff.
11628         */
11629         if (i32 != ($xxx) f)
11630                 result |= 1;
11631         exit(result);
11632 }
11633 EOCP
11634 set try
11635 if eval $compile_ok; then
11636         $run ./try 2>/dev/null
11637         yyy=$?
11638 else
11639         echo "(I can't seem to compile the test program--assuming it can't)"
11640         yyy=1
11641 fi
11642 case "$yyy" in
11643 0)      val="$define"
11644         echo "Yup, it can."
11645         ;;
11646 *)      val="$undef"
11647         echo "Nope, it can't."
11648         ;;
11649 esac
11650 set d_casti32
11651 eval $setvar
11652 $rm_try
11653
11654 : check for ability to cast negative floats to unsigned
11655 echo " "
11656 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11657 $cat >try.c <<EOCP
11658 #include <stdio.h>
11659 #$i_stdlib I_STDLIB
11660 #ifdef I_STDLIB
11661 #include <stdlib.h>
11662 #endif
11663 #include <sys/types.h>
11664 #include <signal.h>
11665 $signal_t blech(int s) { exit(7); }
11666 $signal_t blech_in_list(int s) { exit(4); }
11667 unsigned long dummy_long(unsigned long p) { return p; }
11668 unsigned int dummy_int(unsigned int p) { return p; }
11669 unsigned short dummy_short(unsigned short p) { return p; }
11670 int main()
11671 {
11672         double f;
11673         unsigned long along;
11674         unsigned int aint;
11675         unsigned short ashort;
11676         int result = 0;
11677         char str[16];
11678
11679         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11680            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11681            optimized the whole file away
11682         */
11683         /* Store the number in a writable string for gcc to pass to
11684            sscanf under HP-UX.
11685         */
11686         sprintf(str, "-123");
11687         sscanf(str, "%lf", &f);  /* f = -123.; */
11688
11689         signal(SIGFPE, blech);
11690         along = (unsigned long)f;
11691         aint = (unsigned int)f;
11692         ashort = (unsigned short)f;
11693         if (along != (unsigned long)-123)
11694                 result |= 1;
11695         if (aint != (unsigned int)-123)
11696                 result |= 1;
11697         if (ashort != (unsigned short)-123)
11698                 result |= 1;
11699         sprintf(str, "1073741824.");
11700         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11701         f = f + f;
11702         along = 0;
11703         along = (unsigned long)f;
11704         if (along != 0x80000000)
11705                 result |= 2;
11706         f -= 1.;
11707         along = 0;
11708         along = (unsigned long)f;
11709         if (along != 0x7fffffff)
11710                 result |= 1;
11711         f += 2.;
11712         along = 0;
11713         along = (unsigned long)f;
11714         if (along != 0x80000001)
11715                 result |= 2;
11716         if (result)
11717                 exit(result);
11718         signal(SIGFPE, blech_in_list);
11719         sprintf(str, "123.");
11720         sscanf(str, "%lf", &f);  /* f = 123.; */
11721         along = dummy_long((unsigned long)f);
11722         aint = dummy_int((unsigned int)f);
11723         ashort = dummy_short((unsigned short)f);
11724         if (along != (unsigned long)123)
11725                 result |= 4;
11726         if (aint != (unsigned int)123)
11727                 result |= 4;
11728         if (ashort != (unsigned short)123)
11729                 result |= 4;
11730         exit(result);
11731
11732 }
11733 EOCP
11734 set try
11735 if eval $compile_ok; then
11736         $run ./try 2>/dev/null
11737         castflags=$?
11738 else
11739         echo "(I can't seem to compile the test program--assuming it can't)"
11740         castflags=7
11741 fi
11742 case "$castflags" in
11743 0)      val="$define"
11744         echo "Yup, it can."
11745         ;;
11746 *)      val="$undef"
11747         echo "Nope, it can't."
11748         ;;
11749 esac
11750 set d_castneg
11751 eval $setvar
11752 $rm_try
11753
11754 : see if cbrt exists
11755 set cbrt d_cbrt
11756 eval $inlibc
11757
11758 : see if vprintf exists
11759 echo " "
11760 if set vprintf val -f d_vprintf; eval $csym; $val; then
11761         echo 'vprintf() found.' >&4
11762         val="$define"
11763         $cat >try.c <<EOF
11764 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11765 #$i_varargs I_VARARGS
11766
11767 #$i_stdlib I_STDLIB
11768 #$i_unistd I_UNISTD
11769
11770 #ifdef I_STDARG
11771 #  include <stdarg.h>
11772 #else /* I_VARARGS */
11773 #  include <varargs.h>
11774 #endif
11775
11776 #ifdef I_UNISTD
11777 #  include <unistd.h>
11778 #endif
11779
11780 #ifdef I_STDLIB
11781 #  include <stdlib.h>
11782 #endif
11783
11784 #include <stdio.h> /* vsprintf prototype */
11785
11786 #ifdef I_STDARG
11787 void xxx(int n, ...)
11788 {
11789     va_list args;
11790     char buf[10];
11791     va_start(args, n);
11792     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11793 }
11794 int main() { xxx(1, "foo"); }
11795
11796 #else /* I_VARARGS */
11797
11798 xxx(va_alist)
11799 va_dcl
11800 {
11801     va_list args;
11802     char buf[10];
11803     va_start(args);
11804     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11805 }
11806 int main() { xxx("foo"); }
11807
11808 #endif
11809
11810 EOF
11811         set try
11812         if eval $compile_ok; then
11813                 if $run ./try; then
11814                         echo "Your vsprintf() returns (int)." >&4
11815                         val2="$undef"
11816                 else
11817                         echo "Your vsprintf() returns (char*)." >&4
11818                         val2="$define"
11819                 fi
11820         else
11821                 echo 'I am unable to compile the vsprintf() test program.' >&4
11822                 # We shouldn't get here.  If we do, assume the standard signature,
11823                 # not the old BSD one.
11824                 echo 'Guessing that vsprintf() returns (int).' >&4
11825                 val2="$undef"
11826         fi
11827 else
11828         echo 'vprintf() NOT found.' >&4
11829         val="$undef"
11830         val2="$undef"
11831 fi
11832 $rm_try
11833 set d_vprintf
11834 eval $setvar
11835 val=$val2
11836 set d_charvspr
11837 eval $setvar
11838
11839 : see if chown exists
11840 set chown d_chown
11841 eval $inlibc
11842
11843 : see if chroot exists
11844 set chroot d_chroot
11845 eval $inlibc
11846
11847 : see if chsize exists
11848 set chsize d_chsize
11849 eval $inlibc
11850
11851 : see if class exists
11852 set class d_class
11853 eval $inlibc
11854
11855 : see if clearenv exists
11856 set clearenv d_clearenv
11857 eval $inlibc
11858
11859 : Define hasstruct macro for Configure internal use
11860 hasstruct='varname=$1; struct=$2; shift; shift;
11861 while $test $# -ge 2; do
11862         case "$1" in
11863         $define) echo "#include <$2>";;
11864         esac ;
11865     shift 2;
11866 done > try.c;
11867 echo "int main () { struct $struct foo; }" >> try.c;
11868 set try;
11869 if eval $compile; then
11870         val="$define";
11871 else
11872         val="$undef";
11873 fi;
11874 set $varname;
11875 eval $setvar;
11876 $rm_try'
11877
11878 : see whether socket exists
11879 socketlib=''
11880 sockethdr=''
11881 echo " "
11882 $echo $n "Hmm... $c" >&4
11883 if set socket val -f d_socket; eval $csym; $val; then
11884     echo "Looks like you have Berkeley networking support." >&4
11885     d_socket="$define"
11886     if set setsockopt val -f; eval $csym; $val; then
11887         d_oldsock="$undef"
11888     else
11889         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11890         d_oldsock="$define"
11891     fi
11892 else
11893     if $contains socklib libc.list >/dev/null 2>&1; then
11894         echo "Looks like you have Berkeley networking support." >&4
11895         d_socket="$define"
11896         : we will have to assume that it supports the 4.2 BSD interface
11897         d_oldsock="$undef"
11898     else
11899         echo "You don't have Berkeley networking in libc$_a..." >&4
11900         if test "X$d_socket" = "X$define"; then
11901             echo "...but you seem to believe that you have sockets." >&4
11902         else
11903             for net in net socket
11904             do
11905                 if test -f $sysroot/usr/lib/lib$net$_a; then
11906                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11907                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11908                     if $contains socket libc.list >/dev/null 2>&1; then
11909                         d_socket="$define"
11910                         socketlib="-l$net"
11911                         case "$net" in
11912                         net)
11913                             echo "...but the Wollongong group seems to have hacked it in." >&4
11914                             sockethdr="-I$sysroot/usr/netinclude"
11915                             ;;
11916                         esac
11917                         echo "Found Berkeley sockets interface in lib$net." >&4
11918                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11919                             d_oldsock="$undef"
11920                         else
11921                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11922                             d_oldsock="$define"
11923                         fi
11924                         break
11925                     fi
11926                 fi
11927             done
11928             if test "X$d_socket" != "X$define"; then
11929                echo "or anywhere else I see." >&4
11930                d_socket="$undef"
11931                d_oldsock="$undef"
11932             fi
11933         fi
11934     fi
11935 fi
11936
11937 : see if socketpair exists
11938 set socketpair d_sockpair
11939 eval $inlibc
11940
11941
11942 echo " "
11943 echo "Checking the availability sa_len in the sock struct ..." >&4
11944 $cat >try.c <<EOF
11945 #include <sys/types.h>
11946 #include <sys/socket.h>
11947 int main() {
11948 struct sockaddr sa;
11949 return (sa.sa_len);
11950 }
11951 EOF
11952 val="$undef"
11953 set try; if eval $compile; then
11954     val="$define"
11955 fi
11956 set d_sockaddr_sa_len; eval $setvar
11957 $rm_try
11958
11959 echo " "
11960 echo "Checking the availability struct sockaddr_in6 ..." >&4
11961 $cat >try.c <<EOF
11962 #include <sys/types.h>
11963 #include <sys/socket.h>
11964 #include <netinet/in.h>
11965 int main() {
11966 struct sockaddr_in6 sin6;
11967 return (sin6.sin6_family);
11968 }
11969 EOF
11970 val="$undef"
11971 set try; if eval $compile; then
11972     val="$define"
11973 fi
11974 set d_sockaddr_in6; eval $setvar
11975 $rm_try
11976
11977 echo " "
11978 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11979 $cat >try.c <<EOF
11980 #include <sys/types.h>
11981 #include <sys/socket.h>
11982 #include <netinet/in.h>
11983 int main() {
11984 struct sockaddr_in6 sin6;
11985 return (sin6.sin6_scope_id);
11986 }
11987 EOF
11988 val="$undef"
11989 set try; if eval $compile; then
11990     val="$define"
11991 fi
11992 set d_sin6_scope_id; eval $setvar
11993 $rm_try
11994
11995 echo " "
11996 echo "Checking the availability struct ip_mreq ..." >&4
11997 $cat >try.c <<EOF
11998 #include <sys/types.h>
11999 #include <sys/socket.h>
12000 #include <netinet/in.h>
12001 int main() {
12002 struct ip_mreq mreq;
12003 return (mreq.imr_multiaddr.s_addr);
12004 }
12005 EOF
12006 val="$undef"
12007 set try; if eval $compile; then
12008        val="$define"
12009 fi
12010 set d_ip_mreq; eval $setvar
12011 $rm_try
12012
12013 echo " "
12014 echo "Checking the availability struct ip_mreq_source ..." >&4
12015 $cat >try.c <<EOF
12016 #include <sys/types.h>
12017 #include <sys/socket.h>
12018 #include <netinet/in.h>
12019 int main() {
12020 struct ip_mreq_source mreq;
12021 return (mreq.imr_multiaddr.s_addr);
12022 }
12023 EOF
12024 val="$undef"
12025 set try; if eval $compile; then
12026        val="$define"
12027 fi
12028 set d_ip_mreq_source; eval $setvar
12029 $rm_try
12030
12031 echo " "
12032 echo "Checking the availability struct ipv6_mreq ..." >&4
12033 $cat >try.c <<EOF
12034 #include <sys/types.h>
12035 #include <sys/socket.h>
12036 #include <netinet/in.h>
12037 int main() {
12038 struct ipv6_mreq mreq;
12039 return (mreq.ipv6mr_interface);
12040 }
12041 EOF
12042 val="$undef"
12043 set try; if eval $compile; then
12044     val="$define"
12045 fi
12046 set d_ipv6_mreq; eval $setvar
12047 $rm_try
12048
12049 echo " "
12050 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12051 $cat >try.c <<EOF
12052 #include <sys/types.h>
12053 #include <sys/socket.h>
12054 #include <netinet/in.h>
12055 int main() {
12056 struct ipv6_mreq_source mreq;
12057 return (mreq.imr_multiaddr.s_addr);
12058 }
12059 EOF
12060 val="$undef"
12061 set try; if eval $compile; then
12062        val="$define"
12063 fi
12064 set d_ipv6_mreq_source; eval $setvar
12065 $rm_try
12066
12067 echo " "
12068 echo "Checking the availability of certain socket constants..." >&4
12069 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12070     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12071     $cat >try.c <<EOF
12072 #include <sys/types.h>
12073 #include <sys/socket.h>
12074 int main() {
12075     int i = $ENUM;
12076 }
12077 EOF
12078     val="$undef"
12079     set try; if eval $compile; then
12080         val="$define"
12081     fi
12082     set d_${enum}; eval $setvar
12083     $rm_try
12084 done
12085
12086 : see if this is a sys/uio.h system
12087 set sys/uio.h i_sysuio
12088 eval $inhdr
12089
12090 : Check for cmsghdr support
12091 echo " "
12092 echo "Checking to see if your system supports struct cmsghdr..." >&4
12093 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12094 eval $hasstruct
12095 case "$d_cmsghdr_s" in
12096 "$define")      echo "Yes, it does."   ;;
12097 *)              echo "No, it doesn't." ;;
12098 esac
12099
12100
12101 : check for const keyword
12102 echo " "
12103 echo 'Checking to see if your C compiler knows about "const"...' >&4
12104 $cat >const.c <<'EOCP'
12105 typedef struct spug { int drokk; } spug;
12106 int main()
12107 {
12108         const char *foo;
12109         const spug y = { 0 };
12110 }
12111 EOCP
12112 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
12113         val="$define"
12114         echo "Yup, it does."
12115 else
12116         val="$undef"
12117         echo "Nope, it doesn't."
12118 fi
12119 set d_const
12120 eval $setvar
12121
12122 : see if copysign exists
12123 set copysign d_copysign
12124 eval $inlibc
12125
12126 : see if copysignl exists
12127 set copysignl d_copysignl
12128 eval $inlibc
12129
12130 : see if crypt exists
12131 echo " "
12132 set crypt d_crypt
12133 eval $inlibc
12134 case "$d_crypt" in
12135 $define) cryptlib='' ;;
12136 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12137                 echo 'crypt() found.' >&4
12138                 val="$define"
12139                 cryptlib=''
12140         else
12141                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12142                 if $test -z "$cryptlib"; then
12143                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12144                 else
12145                         cryptlib=-lcrypt
12146                 fi
12147                 if $test -z "$cryptlib"; then
12148                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12149                 else
12150                         cryptlib=-lcrypt
12151                 fi
12152                 if $test -z "$cryptlib"; then
12153                         cryptlib=`./loc libcrypt$_a "" $libpth`
12154                 else
12155                         cryptlib=-lcrypt
12156                 fi
12157                 if $test -z "$cryptlib"; then
12158                         echo 'crypt() NOT found.' >&4
12159                         val="$undef"
12160                 else
12161                         val="$define"
12162                 fi
12163         fi
12164         set d_crypt
12165         eval $setvar
12166         ;;
12167 esac
12168
12169 : see if this is a crypt.h system
12170 set crypt.h i_crypt
12171 eval $inhdr
12172
12173 : see if crypt_r exists
12174 set crypt_r d_crypt_r
12175 eval $inlibc
12176 case "$d_crypt_r" in
12177 "$define")
12178         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12179         case "$d_crypt_r_proto:$usethreads" in
12180         ":define")      d_crypt_r_proto=define
12181                 set d_crypt_r_proto crypt_r $hdrs
12182                 eval $hasproto ;;
12183         *)      ;;
12184         esac
12185         case "$d_crypt_r_proto" in
12186         define)
12187         case "$crypt_r_proto" in
12188         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12189         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12190         esac
12191         case "$crypt_r_proto" in
12192         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12193         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12194         esac
12195         case "$crypt_r_proto" in
12196         ''|0)   d_crypt_r=undef
12197                 crypt_r_proto=0
12198                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12199         * )     case "$crypt_r_proto" in
12200                 REENTRANT_PROTO*) ;;
12201                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12202                 esac
12203                 echo "Prototype: $try" ;;
12204         esac
12205         ;;
12206         *)      case "$usethreads" in
12207                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12208                 esac
12209                 d_crypt_r=undef
12210                 crypt_r_proto=0
12211                 ;;
12212         esac
12213         ;;
12214 *)      crypt_r_proto=0
12215         ;;
12216 esac
12217
12218 : get csh whereabouts
12219 case "$csh" in
12220 'csh') val="$undef" ;;
12221 *) val="$define" ;;
12222 esac
12223 set d_csh
12224 eval $setvar
12225 : Respect a hint or command line value for full_csh.
12226 case "$full_csh" in
12227 '') full_csh=$csh ;;
12228 esac
12229
12230 : see if ctermid exists
12231 set ctermid d_ctermid
12232 eval $inlibc
12233
12234 : see if ctermid_r exists
12235 set ctermid_r d_ctermid_r
12236 eval $inlibc
12237 case "$d_ctermid_r" in
12238 "$define")
12239         hdrs="$i_systypes sys/types.h define stdio.h "
12240         case "$d_ctermid_r_proto:$usethreads" in
12241         ":define")      d_ctermid_r_proto=define
12242                 set d_ctermid_r_proto ctermid_r $hdrs
12243                 eval $hasproto ;;
12244         *)      ;;
12245         esac
12246         case "$d_ctermid_r_proto" in
12247         define)
12248         case "$ctermid_r_proto" in
12249         ''|0) try='char* ctermid_r(char*);'
12250         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12251         esac
12252         case "$ctermid_r_proto" in
12253         ''|0)   d_ctermid_r=undef
12254                 ctermid_r_proto=0
12255                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12256         * )     case "$ctermid_r_proto" in
12257                 REENTRANT_PROTO*) ;;
12258                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12259                 esac
12260                 echo "Prototype: $try" ;;
12261         esac
12262         ;;
12263         *)      case "$usethreads" in
12264                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12265                 esac
12266                 d_ctermid_r=undef
12267                 ctermid_r_proto=0
12268                 ;;
12269         esac
12270         ;;
12271 *)      ctermid_r_proto=0
12272         ;;
12273 esac
12274
12275 : see if ctime_r exists
12276 set ctime_r d_ctime_r
12277 eval $inlibc
12278 case "$d_ctime_r" in
12279 "$define")
12280         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12281         case "$d_ctime_r_proto:$usethreads" in
12282         ":define")      d_ctime_r_proto=define
12283                 set d_ctime_r_proto ctime_r $hdrs
12284                 eval $hasproto ;;
12285         *)      ;;
12286         esac
12287         case "$d_ctime_r_proto" in
12288         define)
12289         case "$ctime_r_proto" in
12290         ''|0) try='char* ctime_r(const time_t*, char*);'
12291         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12292         esac
12293         case "$ctime_r_proto" in
12294         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12295         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12296         esac
12297         case "$ctime_r_proto" in
12298         ''|0) try='int ctime_r(const time_t*, char*);'
12299         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12300         esac
12301         case "$ctime_r_proto" in
12302         ''|0) try='int ctime_r(const time_t*, char*, int);'
12303         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12304         esac
12305         case "$ctime_r_proto" in
12306         ''|0)   d_ctime_r=undef
12307                 ctime_r_proto=0
12308                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12309         * )     case "$ctime_r_proto" in
12310                 REENTRANT_PROTO*) ;;
12311                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12312                 esac
12313                 echo "Prototype: $try" ;;
12314         esac
12315         ;;
12316         *)      case "$usethreads" in
12317                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12318                 esac
12319                 d_ctime_r=undef
12320                 ctime_r_proto=0
12321                 ;;
12322         esac
12323         ;;
12324 *)      ctime_r_proto=0
12325         ;;
12326 esac
12327
12328 : see if cuserid exists
12329 set cuserid d_cuserid
12330 eval $inlibc
12331
12332 : see if this is a limits.h system
12333 set limits.h i_limits
12334 eval $inhdr
12335
12336 : See if number of significant digits in a double precision number is known
12337 echo " "
12338 $cat >dbl_dig.c <<EOM
12339 #$i_limits I_LIMITS
12340 #$i_float I_FLOAT
12341 #ifdef I_LIMITS
12342 #include <limits.h>
12343 #endif
12344 #ifdef I_FLOAT
12345 #include <float.h>
12346 #endif
12347 #ifdef DBL_DIG
12348 printf("Contains DBL_DIG");
12349 #endif
12350 EOM
12351 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
12352 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
12353         echo "DBL_DIG found." >&4
12354         val="$define"
12355 else
12356         echo "DBL_DIG NOT found." >&4
12357         val="$undef"
12358 fi
12359 $rm -f dbl_dig.?
12360 set d_dbl_dig
12361 eval $setvar
12362
12363 : see if dbm.h is available
12364 : see if dbmclose exists
12365 set dbmclose d_dbmclose
12366 eval $inlibc
12367
12368 case "$d_dbmclose" in
12369 $define)
12370         set dbm.h i_dbm
12371         eval $inhdr
12372         case "$i_dbm" in
12373         $define)
12374                 val="$undef"
12375                 set i_rpcsvcdbm
12376                 eval $setvar
12377                 ;;
12378         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12379                 eval $inhdr
12380                 ;;
12381         esac
12382         ;;
12383 *)      echo "We won't be including <dbm.h>"
12384         val="$undef"
12385         set i_dbm
12386         eval $setvar
12387         val="$undef"
12388         set i_rpcsvcdbm
12389         eval $setvar
12390         ;;
12391 esac
12392
12393 : see if prototype for dbminit is available
12394 echo " "
12395 set d_dbminitproto dbminit $i_dbm dbm.h
12396 eval $hasproto
12397
12398 : see if difftime exists
12399 set difftime d_difftime
12400 eval $inlibc
12401
12402 : see if this is a dirent system
12403 echo " "
12404 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12405         val="$define"
12406         echo "<dirent.h> found." >&4
12407 else
12408         val="$undef"
12409         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12410                 echo "<sys/dir.h> found." >&4
12411                 echo " "
12412         else
12413                 xinc=`./findhdr sys/ndir.h`
12414         fi
12415         echo "<dirent.h> NOT found." >&4
12416 fi
12417 set i_dirent
12418 eval $setvar
12419
12420 : Look for type of directory structure.
12421 echo " "
12422 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12423
12424 case "$direntrytype" in
12425 ''|' ')
12426         case "$i_dirent" in
12427         $define) guess1='struct dirent' ;;
12428         *) guess1='struct direct'  ;;
12429         esac
12430         ;;
12431 *)      guess1="$direntrytype"
12432         ;;
12433 esac
12434
12435 case "$guess1" in
12436 'struct dirent') guess2='struct direct' ;;
12437 *) guess2='struct dirent' ;;
12438 esac
12439
12440 if $contains "$guess1" try.c >/dev/null 2>&1; then
12441         direntrytype="$guess1"
12442         echo "Your directory entries are $direntrytype." >&4
12443 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12444         direntrytype="$guess2"
12445         echo "Your directory entries seem to be $direntrytype." >&4
12446 else
12447         echo "I don't recognize your system's directory entries." >&4
12448         rp="What type is used for directory entries on this system?"
12449         dflt="$guess1"
12450         . ./myread
12451         direntrytype="$ans"
12452 fi
12453 $rm_try
12454
12455 : see if the directory entry stores field length
12456 echo " "
12457 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12458 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12459         echo "Good, your directory entry keeps length information in d_namlen." >&4
12460         val="$define"
12461 else
12462         echo "Your directory entry does not know about the d_namlen field." >&4
12463         val="$undef"
12464 fi
12465 set d_dirnamlen
12466 eval $setvar
12467 $rm_try
12468
12469 : Look for DIR.dd_fd
12470 case "$i_dirent" in
12471 "$define")
12472     echo "Checking to see if DIR has a dd_fd member variable" >&4
12473     $cat >try.c <<EOCP
12474 #$i_stdlib I_STDLIB
12475 #ifdef I_STDLIB
12476 #include <stdlib.h>
12477 #endif
12478 #include <dirent.h>
12479
12480 int main() {
12481     DIR dir;
12482     dir.dd_fd = 1;
12483     return 0;
12484 }
12485 EOCP
12486     val=$undef
12487     set try
12488     if eval $compile; then
12489         echo "Yes, it does."
12490         val="$define"
12491     else
12492         echo "No, it does not."
12493         val="$undef"
12494     fi
12495     ;;
12496 *)
12497     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12498     val="$undef"
12499     ;;
12500 esac
12501 set d_dir_dd_fd
12502 eval $setvar
12503 $rm_try
12504
12505 : see if this is an sysdir system
12506 set sys/dir.h i_sysdir
12507 eval $inhdr
12508
12509 : see if this is an sysndir system
12510 set sys/ndir.h i_sysndir
12511 eval $inhdr
12512
12513 : Look for dirfd
12514 echo " "
12515 $cat >dirfd.c <<EOM
12516 #include <stdio.h>
12517 #$i_stdlib I_STDLIB
12518 #ifdef I_STDLIB
12519 #include <stdlib.h>
12520 #endif
12521 #$i_dirent I_DIRENT             /**/
12522 #$i_sysdir I_SYS_DIR            /**/
12523 #$i_sysndir I_SYS_NDIR          /**/
12524 #$i_systypes I_SYS_TYPES        /**/
12525 #if defined(I_SYS_TYPES)
12526 #include <sys/types.h>
12527 #endif
12528 #if defined(I_DIRENT)
12529 #include <dirent.h>
12530 #else
12531 #ifdef I_SYS_NDIR
12532 #include <sys/ndir.h>
12533 #else
12534 #ifdef I_SYS_DIR
12535 #ifdef hp9000s500
12536 #include <ndir.h>       /* may be wrong in the future */
12537 #else
12538 #include <sys/dir.h>
12539 #endif
12540 #endif
12541 #endif
12542 #endif
12543 int main() {
12544         DIR *dirp = opendir(".");
12545         if (dirfd(dirp) >= 0)
12546                 exit(0);
12547         else
12548                 exit(1);
12549 }
12550 EOM
12551 val=$undef
12552 set dirfd
12553 if eval $compile; then
12554         val="$define"
12555 fi
12556 case "$val" in
12557 $define)        echo "dirfd() found." >&4       ;;
12558 *)              echo "dirfd() NOT found." >&4   ;;
12559 esac
12560 set d_dirfd
12561 eval $setvar
12562 $rm -f dirfd*
12563
12564 : see if dladdr exists
12565 set dladdr d_dladdr
12566 eval $inlibc
12567
12568 : see if dlerror exists
12569 xxx_runnm="$runnm"
12570 runnm=false
12571 set dlerror d_dlerror
12572 eval $inlibc
12573 runnm="$xxx_runnm"
12574
12575 : see if dlfcn is available
12576 set dlfcn.h i_dlfcn
12577 eval $inhdr
12578
12579 : Check what extension to use for shared libs
12580 case "$usedl" in
12581 $define|y|true)
12582         $cat << EOM
12583
12584 On a few systems, the dynamically loaded modules that perl generates and uses
12585 will need a different extension than shared libs. The default will probably
12586 be appropriate.
12587
12588 EOM
12589         case "$dlext" in
12590         '')     dflt="$so" ;;
12591         *)      dflt="$dlext" ;;
12592         esac
12593         rp='What is the extension of dynamically loaded modules'
12594         . ./myread
12595         dlext="$ans"
12596         ;;
12597 *)
12598         dlext="none"
12599         ;;
12600 esac
12601
12602 : Check if dlsym need a leading underscore
12603 echo " "
12604 val="$undef"
12605
12606 case "$dlsrc" in
12607 dl_dlopen.xs)
12608         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12609         $cat >dyna.c <<'EOM'
12610 fred () { }
12611 EOM
12612
12613 $cat >fred.c<<EOM
12614
12615 #include <stdio.h>
12616 #$i_stdlib I_STDLIB
12617 #ifdef I_STDLIB
12618 #include <stdlib.h>
12619 #endif
12620 #$i_dlfcn I_DLFCN
12621 #ifdef I_DLFCN
12622 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12623 #else
12624 #include <sys/types.h>
12625 #include <nlist.h>
12626 #include <link.h>
12627 #endif
12628
12629 extern int fred() ;
12630
12631 int main()
12632 {
12633     void * handle ;
12634     void * symbol ;
12635 #ifndef RTLD_LAZY
12636     int mode = 1 ;
12637 #else
12638     int mode = RTLD_LAZY ;
12639 #endif
12640     handle = dlopen("./dyna.$dlext", mode) ;
12641     if (handle == NULL) {
12642         printf ("1\n") ;
12643         fflush (stdout) ;
12644         exit(0);
12645     }
12646     symbol = dlsym(handle, "fred") ;
12647     if (symbol == NULL) {
12648         /* try putting a leading underscore */
12649         symbol = dlsym(handle, "_fred") ;
12650         if (symbol == NULL) {
12651             printf ("2\n") ;
12652             fflush (stdout) ;
12653             exit(0);
12654         }
12655         printf ("3\n") ;
12656     }
12657     else
12658         printf ("4\n") ;
12659     fflush (stdout) ;
12660     exit(0);
12661 }
12662 EOM
12663         : Call the object file tmp-dyna.o in case dlext=o.
12664         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12665                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12666                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12667                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12668                 xxx=`$run ./fred`
12669                 case $xxx in
12670                 1)      echo "Test program failed using dlopen." >&4
12671                         echo "Perhaps you should not use dynamic loading." >&4;;
12672                 2)      echo "Test program failed using dlsym." >&4
12673                         echo "Perhaps you should not use dynamic loading." >&4;;
12674                 3)      echo "dlsym needs a leading underscore" >&4
12675                         val="$define" ;;
12676                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12677                 esac
12678         else
12679                 echo "I can't compile and run the test program." >&4
12680                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12681         fi
12682         ;;
12683 esac
12684
12685 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12686
12687 set d_dlsymun
12688 eval $setvar
12689
12690 : see if drand48_r exists
12691 set drand48_r d_drand48_r
12692 eval $inlibc
12693 case "$d_drand48_r" in
12694 "$define")
12695         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12696         case "$d_drand48_r_proto:$usethreads" in
12697         ":define")      d_drand48_r_proto=define
12698                 set d_drand48_r_proto drand48_r $hdrs
12699                 eval $hasproto ;;
12700         *)      ;;
12701         esac
12702         case "$d_drand48_r_proto" in
12703         define)
12704         case "$drand48_r_proto" in
12705         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12706         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12707         esac
12708         case "$drand48_r_proto" in
12709         ''|0)   d_drand48_r=undef
12710                 drand48_r_proto=0
12711                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12712         * )     case "$drand48_r_proto" in
12713                 REENTRANT_PROTO*) ;;
12714                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12715                 esac
12716                 echo "Prototype: $try" ;;
12717         esac
12718         ;;
12719         *)      case "$usethreads" in
12720                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12721                 esac
12722                 d_drand48_r=undef
12723                 drand48_r_proto=0
12724                 ;;
12725         esac
12726         ;;
12727 *)      drand48_r_proto=0
12728         ;;
12729 esac
12730
12731 : see if prototype for drand48 is available
12732 echo " "
12733 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12734 eval $hasproto
12735
12736 : see if dup2 exists
12737 set dup2 d_dup2
12738 eval $inlibc
12739
12740 : see if eaccess exists
12741 set eaccess d_eaccess
12742 eval $inlibc
12743
12744 : see if endgrent exists
12745 set endgrent d_endgrent
12746 eval $inlibc
12747
12748 : see if this is an grp system
12749 set grp.h i_grp
12750 eval $inhdr
12751
12752 case "$i_grp" in
12753 $define)
12754         xxx=`./findhdr grp.h`
12755         $cppstdin $cppflags $cppminus < $xxx >$$.h
12756
12757         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12758                 val="$define"
12759         else
12760                 val="$undef"
12761         fi
12762         set d_grpasswd
12763         eval $setvar
12764
12765         $rm -f $$.h
12766         ;;
12767 *)
12768         val="$undef";
12769         set d_grpasswd; eval $setvar
12770         ;;
12771 esac
12772
12773 : see if endgrent_r exists
12774 set endgrent_r d_endgrent_r
12775 eval $inlibc
12776 case "$d_endgrent_r" in
12777 "$define")
12778         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12779         case "$d_endgrent_r_proto:$usethreads" in
12780         ":define")      d_endgrent_r_proto=define
12781                 set d_endgrent_r_proto endgrent_r $hdrs
12782                 eval $hasproto ;;
12783         *)      ;;
12784         esac
12785         case "$d_endgrent_r_proto" in
12786         define)
12787         case "$endgrent_r_proto" in
12788         ''|0) try='int endgrent_r(FILE**);'
12789         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12790         esac
12791         case "$endgrent_r_proto" in
12792         ''|0) try='void endgrent_r(FILE**);'
12793         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12794         esac
12795         case "$endgrent_r_proto" in
12796         ''|0)   d_endgrent_r=undef
12797                 endgrent_r_proto=0
12798                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12799         * )     case "$endgrent_r_proto" in
12800                 REENTRANT_PROTO*) ;;
12801                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12802                 esac
12803                 echo "Prototype: $try" ;;
12804         esac
12805         ;;
12806         *)      case "$usethreads" in
12807                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12808                 esac
12809                 d_endgrent_r=undef
12810                 endgrent_r_proto=0
12811                 ;;
12812         esac
12813         ;;
12814 *)      endgrent_r_proto=0
12815         ;;
12816 esac
12817
12818 : see if endhostent exists
12819 set endhostent d_endhent
12820 eval $inlibc
12821
12822 : see if this is a netdb.h system
12823 set netdb.h i_netdb
12824 eval $inhdr
12825
12826 : see if endhostent_r exists
12827 set endhostent_r d_endhostent_r
12828 eval $inlibc
12829 case "$d_endhostent_r" in
12830 "$define")
12831         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12832         case "$d_endhostent_r_proto:$usethreads" in
12833         ":define")      d_endhostent_r_proto=define
12834                 set d_endhostent_r_proto endhostent_r $hdrs
12835                 eval $hasproto ;;
12836         *)      ;;
12837         esac
12838         case "$d_endhostent_r_proto" in
12839         define)
12840         case "$endhostent_r_proto" in
12841         ''|0) try='int endhostent_r(struct hostent_data*);'
12842         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12843         esac
12844         case "$endhostent_r_proto" in
12845         ''|0) try='void endhostent_r(struct hostent_data*);'
12846         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12847         esac
12848         case "$endhostent_r_proto" in
12849         ''|0)   d_endhostent_r=undef
12850                 endhostent_r_proto=0
12851                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12852         * )     case "$endhostent_r_proto" in
12853                 REENTRANT_PROTO*) ;;
12854                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12855                 esac
12856                 echo "Prototype: $try" ;;
12857         esac
12858         ;;
12859         *)      case "$usethreads" in
12860                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12861                 esac
12862                 d_endhostent_r=undef
12863                 endhostent_r_proto=0
12864                 ;;
12865         esac
12866         ;;
12867 *)      endhostent_r_proto=0
12868         ;;
12869 esac
12870
12871 : see if endnetent exists
12872 set endnetent d_endnent
12873 eval $inlibc
12874
12875 : see if endnetent_r exists
12876 set endnetent_r d_endnetent_r
12877 eval $inlibc
12878 case "$d_endnetent_r" in
12879 "$define")
12880         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12881         case "$d_endnetent_r_proto:$usethreads" in
12882         ":define")      d_endnetent_r_proto=define
12883                 set d_endnetent_r_proto endnetent_r $hdrs
12884                 eval $hasproto ;;
12885         *)      ;;
12886         esac
12887         case "$d_endnetent_r_proto" in
12888         define)
12889         case "$endnetent_r_proto" in
12890         ''|0) try='int endnetent_r(struct netent_data*);'
12891         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12892         esac
12893         case "$endnetent_r_proto" in
12894         ''|0) try='void endnetent_r(struct netent_data*);'
12895         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12896         esac
12897         case "$endnetent_r_proto" in
12898         ''|0)   d_endnetent_r=undef
12899                 endnetent_r_proto=0
12900                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12901         * )     case "$endnetent_r_proto" in
12902                 REENTRANT_PROTO*) ;;
12903                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12904                 esac
12905                 echo "Prototype: $try" ;;
12906         esac
12907         ;;
12908         *)      case "$usethreads" in
12909                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12910                 esac
12911                 d_endnetent_r=undef
12912                 endnetent_r_proto=0
12913                 ;;
12914         esac
12915         ;;
12916 *)      endnetent_r_proto=0
12917         ;;
12918 esac
12919
12920 : see if endprotoent exists
12921 set endprotoent d_endpent
12922 eval $inlibc
12923
12924 : see if endprotoent_r exists
12925 set endprotoent_r d_endprotoent_r
12926 eval $inlibc
12927 case "$d_endprotoent_r" in
12928 "$define")
12929         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12930         case "$d_endprotoent_r_proto:$usethreads" in
12931         ":define")      d_endprotoent_r_proto=define
12932                 set d_endprotoent_r_proto endprotoent_r $hdrs
12933                 eval $hasproto ;;
12934         *)      ;;
12935         esac
12936         case "$d_endprotoent_r_proto" in
12937         define)
12938         case "$endprotoent_r_proto" in
12939         ''|0) try='int endprotoent_r(struct protoent_data*);'
12940         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12941         esac
12942         case "$endprotoent_r_proto" in
12943         ''|0) try='void endprotoent_r(struct protoent_data*);'
12944         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12945         esac
12946         case "$endprotoent_r_proto" in
12947         ''|0)   d_endprotoent_r=undef
12948                 endprotoent_r_proto=0
12949                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12950         * )     case "$endprotoent_r_proto" in
12951                 REENTRANT_PROTO*) ;;
12952                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12953                 esac
12954                 echo "Prototype: $try" ;;
12955         esac
12956         ;;
12957         *)      case "$usethreads" in
12958                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12959                 esac
12960                 d_endprotoent_r=undef
12961                 endprotoent_r_proto=0
12962                 ;;
12963         esac
12964         ;;
12965 *)      endprotoent_r_proto=0
12966         ;;
12967 esac
12968
12969 : see if endpwent exists
12970 set endpwent d_endpwent
12971 eval $inlibc
12972
12973 : see if this is a pwd.h system
12974 set pwd.h i_pwd
12975 eval $inhdr
12976
12977 case "$i_pwd" in
12978 $define)
12979         xxx=`./findhdr pwd.h`
12980         $cppstdin $cppflags $cppminus < $xxx >$$.h
12981
12982         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12983                 val="$define"
12984         else
12985                 val="$undef"
12986         fi
12987         set d_pwquota
12988         eval $setvar
12989
12990         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12991                 val="$define"
12992         else
12993                 val="$undef"
12994         fi
12995         set d_pwage
12996         eval $setvar
12997
12998         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12999                 val="$define"
13000         else
13001                 val="$undef"
13002         fi
13003         set d_pwchange
13004         eval $setvar
13005
13006         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
13007                 val="$define"
13008         else
13009                 val="$undef"
13010         fi
13011         set d_pwclass
13012         eval $setvar
13013
13014         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
13015                 val="$define"
13016         else
13017                 val="$undef"
13018         fi
13019         set d_pwexpire
13020         eval $setvar
13021
13022         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
13023                 val="$define"
13024         else
13025                 val="$undef"
13026         fi
13027         set d_pwcomment
13028         eval $setvar
13029
13030         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
13031                 val="$define"
13032         else
13033                 val="$undef"
13034         fi
13035         set d_pwgecos
13036         eval $setvar
13037
13038         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
13039                 val="$define"
13040         else
13041                 val="$undef"
13042         fi
13043         set d_pwpasswd
13044         eval $setvar
13045
13046         $rm -f $$.h
13047         ;;
13048 *)
13049         val="$undef";
13050         set d_pwquota; eval $setvar
13051         set d_pwage; eval $setvar
13052         set d_pwchange; eval $setvar
13053         set d_pwclass; eval $setvar
13054         set d_pwexpire; eval $setvar
13055         set d_pwcomment; eval $setvar
13056         set d_pwgecos; eval $setvar
13057         set d_pwpasswd; eval $setvar
13058         ;;
13059 esac
13060
13061 : see if endpwent_r exists
13062 set endpwent_r d_endpwent_r
13063 eval $inlibc
13064 case "$d_endpwent_r" in
13065 "$define")
13066         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13067         case "$d_endpwent_r_proto:$usethreads" in
13068         ":define")      d_endpwent_r_proto=define
13069                 set d_endpwent_r_proto endpwent_r $hdrs
13070                 eval $hasproto ;;
13071         *)      ;;
13072         esac
13073         case "$d_endpwent_r_proto" in
13074         define)
13075         case "$endpwent_r_proto" in
13076         ''|0) try='int endpwent_r(FILE**);'
13077         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13078         esac
13079         case "$endpwent_r_proto" in
13080         ''|0) try='void endpwent_r(FILE**);'
13081         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13082         esac
13083         case "$endpwent_r_proto" in
13084         ''|0)   d_endpwent_r=undef
13085                 endpwent_r_proto=0
13086                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13087         * )     case "$endpwent_r_proto" in
13088                 REENTRANT_PROTO*) ;;
13089                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13090                 esac
13091                 echo "Prototype: $try" ;;
13092         esac
13093         ;;
13094         *)      case "$usethreads" in
13095                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13096                 esac
13097                 d_endpwent_r=undef
13098                 endpwent_r_proto=0
13099                 ;;
13100         esac
13101         ;;
13102 *)      endpwent_r_proto=0
13103         ;;
13104 esac
13105
13106 : see if endservent exists
13107 set endservent d_endsent
13108 eval $inlibc
13109
13110 : see if endservent_r exists
13111 set endservent_r d_endservent_r
13112 eval $inlibc
13113 case "$d_endservent_r" in
13114 "$define")
13115         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13116         case "$d_endservent_r_proto:$usethreads" in
13117         ":define")      d_endservent_r_proto=define
13118                 set d_endservent_r_proto endservent_r $hdrs
13119                 eval $hasproto ;;
13120         *)      ;;
13121         esac
13122         case "$d_endservent_r_proto" in
13123         define)
13124         case "$endservent_r_proto" in
13125         ''|0) try='int endservent_r(struct servent_data*);'
13126         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13127         esac
13128         case "$endservent_r_proto" in
13129         ''|0) try='void endservent_r(struct servent_data*);'
13130         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13131         esac
13132         case "$endservent_r_proto" in
13133         ''|0)   d_endservent_r=undef
13134                 endservent_r_proto=0
13135                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13136         * )     case "$endservent_r_proto" in
13137                 REENTRANT_PROTO*) ;;
13138                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13139                 esac
13140                 echo "Prototype: $try" ;;
13141         esac
13142         ;;
13143         *)      case "$usethreads" in
13144                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13145                 esac
13146                 d_endservent_r=undef
13147                 endservent_r_proto=0
13148                 ;;
13149         esac
13150         ;;
13151 *)      endservent_r_proto=0
13152         ;;
13153 esac
13154
13155 : Locate the flags for 'open()'
13156 echo " "
13157 $cat >try.c <<EOCP
13158 #include <sys/types.h>
13159 #ifdef I_FCNTL
13160 #include <fcntl.h>
13161 #endif
13162 #ifdef I_SYS_FILE
13163 #include <sys/file.h>
13164 #endif
13165 #$i_stdlib I_STDLIB
13166 #ifdef I_STDLIB
13167 #include <stdlib.h>
13168 #endif
13169 int main() {
13170         if(O_RDONLY);
13171 #ifdef O_TRUNC
13172         exit(0);
13173 #else
13174         exit(1);
13175 #endif
13176 }
13177 EOCP
13178 : check sys/file.h first to get FREAD on Sun
13179 if $test `./findhdr sys/file.h` && \
13180                 set try -DI_SYS_FILE && eval $compile; then
13181         h_sysfile=true;
13182         echo "<sys/file.h> defines the O_* constants..." >&4
13183         if $run ./try; then
13184                 echo "and you have the 3 argument form of open()." >&4
13185                 val="$define"
13186         else
13187                 echo "but not the 3 argument form of open().  Oh, well." >&4
13188                 val="$undef"
13189         fi
13190 elif $test `./findhdr fcntl.h` && \
13191                 set try -DI_FCNTL && eval $compile; then
13192         h_fcntl=true;
13193         echo "<fcntl.h> defines the O_* constants..." >&4
13194         if $run ./try; then
13195                 echo "and you have the 3 argument form of open()." >&4
13196                 val="$define"
13197         else
13198                 echo "but not the 3 argument form of open().  Oh, well." >&4
13199                 val="$undef"
13200         fi
13201 else
13202         val="$undef"
13203         echo "I can't find the O_* constant definitions!  You got problems." >&4
13204 fi
13205 set d_open3
13206 eval $setvar
13207 $rm_try
13208
13209 : see if this is a sys/file.h system
13210 val=''
13211 set sys/file.h val
13212 eval $inhdr
13213
13214 : do we need to include sys/file.h ?
13215 case "$val" in
13216 "$define")
13217         echo " "
13218         if $h_sysfile; then
13219                 val="$define"
13220                 echo "We'll be including <sys/file.h>." >&4
13221         else
13222                 val="$undef"
13223                 echo "We won't be including <sys/file.h>." >&4
13224         fi
13225         ;;
13226 *)
13227         h_sysfile=false
13228         ;;
13229 esac
13230 set i_sysfile
13231 eval $setvar
13232
13233 : see if fcntl.h is there
13234 val=''
13235 set fcntl.h val
13236 eval $inhdr
13237
13238 : see if we can include fcntl.h
13239 case "$val" in
13240 "$define")
13241         echo " "
13242         if $h_fcntl; then
13243                 val="$define"
13244                 echo "We'll be including <fcntl.h>." >&4
13245         else
13246                 val="$undef"
13247                 if $h_sysfile; then
13248         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13249                 else
13250                         echo "We won't be including <fcntl.h>." >&4
13251                 fi
13252         fi
13253         ;;
13254 *)
13255         h_fcntl=false
13256         val="$undef"
13257         ;;
13258 esac
13259 set i_fcntl
13260 eval $setvar
13261
13262 : see if fork exists
13263 set fork d_fork
13264 eval $inlibc
13265
13266 : see if pipe exists
13267 set pipe d_pipe
13268 eval $inlibc
13269
13270 : check for non-blocking I/O stuff
13271 case "$h_sysfile" in
13272 true) echo "#include <sys/file.h>" > head.c;;
13273 *)
13274        case "$h_fcntl" in
13275        true) echo "#include <fcntl.h>" > head.c;;
13276        *) echo "#include <sys/fcntl.h>" > head.c;;
13277        esac
13278        ;;
13279 esac
13280 echo " "
13281 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13282 case "$o_nonblock" in
13283 '')
13284         $cat head.c > try.c
13285         $cat >>try.c <<EOCP
13286 #include <stdio.h>
13287 #$i_stdlib I_STDLIB
13288 #ifdef I_STDLIB
13289 #include <stdlib.h>
13290 #endif
13291 #$i_fcntl I_FCNTL
13292 #ifdef I_FCNTL
13293 #include <fcntl.h>
13294 #endif
13295 int main() {
13296 #ifdef O_NONBLOCK
13297         printf("O_NONBLOCK\n");
13298         exit(0);
13299 #endif
13300 #ifdef O_NDELAY
13301         printf("O_NDELAY\n");
13302         exit(0);
13303 #endif
13304 #ifdef FNDELAY
13305         printf("FNDELAY\n");
13306         exit(0);
13307 #endif
13308         exit(0);
13309 }
13310 EOCP
13311         set try
13312         if eval $compile_ok; then
13313                 o_nonblock=`$run ./try`
13314                 case "$o_nonblock" in
13315                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13316                 *) echo "Seems like we can use $o_nonblock.";;
13317                 esac
13318         else
13319                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13320         fi
13321         ;;
13322 *) echo "Using $hint value $o_nonblock.";;
13323 esac
13324 $rm_try
13325
13326 echo " "
13327 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13328 case "$eagain" in
13329 '')
13330         case "$d_fork:$d_pipe:$d_alarm" in
13331         define:define)
13332         $cat head.c > try.c
13333         $cat >>try.c <<EOCP
13334 #include <errno.h>
13335 #include <sys/types.h>
13336 #include <signal.h>
13337 #include <stdio.h>
13338 #$i_stdlib I_STDLIB
13339 #ifdef I_STDLIB
13340 #include <stdlib.h>
13341 #endif
13342 #$i_fcntl I_FCNTL
13343 #ifdef I_FCNTL
13344 #include <fcntl.h>
13345 #endif
13346 #define MY_O_NONBLOCK $o_nonblock
13347 #ifndef errno  /* XXX need better Configure test */
13348 extern int errno;
13349 #endif
13350 #$i_unistd I_UNISTD
13351 #ifdef I_UNISTD
13352 #include <unistd.h>
13353 #endif
13354 #$i_string I_STRING
13355 #ifdef I_STRING
13356 #include <string.h>
13357 #else
13358 #include <strings.h>
13359 #endif
13360 $signal_t blech(int x) { exit(3); }
13361 EOCP
13362         $cat >> try.c <<'EOCP'
13363 int main()
13364 {
13365         int pd[2];
13366         int pu[2];
13367         char buf[1];
13368         char string[100];
13369         int ret;
13370
13371         ret = pipe(pd); /* Down: child -> parent */
13372         if (ret != 0)
13373                 exit(3);
13374         ret = pipe(pu); /* Up: parent -> child */
13375         if (ret != 0)
13376                 exit(3);
13377         if (0 != fork()) {
13378                 close(pd[1]);   /* Parent reads from pd[0] */
13379                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13380 #ifdef F_SETFL
13381                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13382                         exit(1);
13383 #else
13384                 exit(4);
13385 #endif
13386                 signal(SIGALRM, blech);
13387                 alarm(5);
13388                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13389                         exit(2);
13390                 sprintf(string, "%d\n", ret);
13391                 ret = write(2, string, strlen(string));
13392                 if (ret != strlen(string))
13393                         exit(3);
13394                 alarm(0);
13395 #ifdef EAGAIN
13396                 if (errno == EAGAIN) {
13397                         printf("EAGAIN\n");
13398                         goto ok;
13399                 }
13400 #endif
13401 #ifdef EWOULDBLOCK
13402                 if (errno == EWOULDBLOCK)
13403                         printf("EWOULDBLOCK\n");
13404 #endif
13405         ok:
13406                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13407                 if (ret != 1)
13408                         exit(3);
13409                 sleep(2);                               /* Give it time to close our pipe */
13410                 alarm(5);
13411                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13412                 alarm(0);
13413                 sprintf(string, "%d\n", ret);
13414                 ret = write(4, string, strlen(string));
13415                 if (ret != strlen(string))
13416                         exit(3);
13417                 exit(0);
13418         }
13419
13420         close(pd[0]);                   /* We write to pd[1] */
13421         close(pu[1]);                   /* We read from pu[0] */
13422         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13423         if (ret != 1)
13424                 exit(3);
13425         close(pd[1]);                   /* Pipe pd is now fully closed! */
13426         exit(0);                                /* Bye bye, thank you for playing! */
13427 }
13428 EOCP
13429         set try
13430         if eval $compile_ok; then
13431                 echo "$startsh" >mtry
13432                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13433                 chmod +x mtry
13434                 $run ./mtry >/dev/null 2>&1
13435                 case $? in
13436                 0) eagain=`$cat try.out`;;
13437                 1) echo "Could not perform non-blocking setting!";;
13438                 2) echo "I did a successful read() for something that was not there!";;
13439                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13440                 4) echo "Could not find F_SETFL!";;
13441                 *) echo "Something terribly wrong happened during testing.";;
13442                 esac
13443                 rd_nodata=`$cat try.ret`
13444                 echo "A read() system call with no data present returns $rd_nodata."
13445                 case "$rd_nodata" in
13446                 0|-1) ;;
13447                 *)
13448                         echo "(That's peculiar, fixing that to be -1.)"
13449                         rd_nodata=-1
13450                         ;;
13451                 esac
13452                 case "$eagain" in
13453                 '')
13454                         echo "Forcing errno EAGAIN on read() with no data available."
13455                         eagain=EAGAIN
13456                         ;;
13457                 *)
13458                         echo "Your read() sets errno to $eagain when no data is available."
13459                         ;;
13460                 esac
13461                 status=`$cat try.err`
13462                 case "$status" in
13463                 0) echo "And it correctly returns 0 to signal EOF.";;
13464                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13465                 *) echo "However, your read() returns '$status' on EOF??";;
13466                 esac
13467                 val="$define"
13468                 if test "$status" = "$rd_nodata"; then
13469                         echo "WARNING: you can't distinguish between EOF and no data!"
13470                         val="$undef"
13471                 fi
13472         else
13473                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13474                 eagain=EAGAIN
13475         fi
13476         ;;
13477         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13478                 eagain=EAGAIN
13479                 val="$define"
13480                 ;;
13481         esac
13482         set d_eofnblk
13483         eval $setvar
13484         ;;
13485 *)
13486         echo "Using $hint value $eagain."
13487         echo "Your read() returns $rd_nodata when no data is present."
13488         case "$d_eofnblk" in
13489         "$define") echo "And you can see EOF because read() returns 0.";;
13490         "$undef") echo "But you can't see EOF status from read() returned value.";;
13491         *)
13492                 echo "(Assuming you can't see EOF status from read anyway.)"
13493                 d_eofnblk=$undef
13494                 ;;
13495         esac
13496         ;;
13497 esac
13498 $rm_try head.c mtry
13499
13500 : see if erf exists
13501 set erf d_erf
13502 eval $inlibc
13503
13504 : see if erfc exists
13505 set erfc d_erfc
13506 eval $inlibc
13507
13508 : see if exp2 exists
13509 set exp2 d_exp2
13510 eval $inlibc
13511
13512 : see if expm1 exists
13513 set expm1 d_expm1
13514 eval $inlibc
13515
13516 : see if _ptr and _cnt from stdio act std
13517 echo " "
13518
13519 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13520         echo "(Looks like you have stdio.h from BSD.)"
13521         case "$stdio_ptr" in
13522         '') stdio_ptr='((fp)->_p)'
13523                 ptr_lval=$define
13524                 ;;
13525         *)      ptr_lval=$d_stdio_ptr_lval;;
13526         esac
13527         case "$stdio_cnt" in
13528         '') stdio_cnt='((fp)->_r)'
13529                 cnt_lval=$define
13530                 ;;
13531         *)      cnt_lval=$d_stdio_cnt_lval;;
13532         esac
13533         case "$stdio_base" in
13534         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13535         esac
13536         case "$stdio_bufsiz" in
13537         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13538         esac
13539 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13540         echo "(Looks like you have stdio.h from Linux.)"
13541         case "$stdio_ptr" in
13542         '') stdio_ptr='((fp)->_IO_read_ptr)'
13543                 ptr_lval=$define
13544                 ;;
13545         *)      ptr_lval=$d_stdio_ptr_lval;;
13546         esac
13547         case "$stdio_cnt" in
13548         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13549                 cnt_lval=$undef
13550                 ;;
13551         *)      cnt_lval=$d_stdio_cnt_lval;;
13552         esac
13553         case "$stdio_base" in
13554         '') stdio_base='((fp)->_IO_read_base)';;
13555         esac
13556         case "$stdio_bufsiz" in
13557         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13558         esac
13559 else
13560         case "$stdio_ptr" in
13561         '') stdio_ptr='((fp)->_ptr)'
13562                 ptr_lval=$define
13563                 ;;
13564         *)      ptr_lval=$d_stdio_ptr_lval;;
13565         esac
13566         case "$stdio_cnt" in
13567         '') stdio_cnt='((fp)->_cnt)'
13568                 cnt_lval=$define
13569                 ;;
13570         *)      cnt_lval=$d_stdio_cnt_lval;;
13571         esac
13572         case "$stdio_base" in
13573         '') stdio_base='((fp)->_base)';;
13574         esac
13575         case "$stdio_bufsiz" in
13576         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13577         esac
13578 fi
13579
13580 : test whether _ptr and _cnt really work
13581 echo "Checking how std your stdio is..." >&4
13582 $cat >try.c <<EOP
13583 #include <stdio.h>
13584 #$i_stdlib I_STDLIB
13585 #ifdef I_STDLIB
13586 #include <stdlib.h>
13587 #endif
13588 #define FILE_ptr(fp)    $stdio_ptr
13589 #define FILE_cnt(fp)    $stdio_cnt
13590 int main() {
13591         FILE *fp = fopen("try.c", "r");
13592         char c = getc(fp);
13593         if (
13594                 18 <= FILE_cnt(fp) &&
13595                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13596         )
13597                 exit(0);
13598         exit(1);
13599 }
13600 EOP
13601 val="$undef"
13602 set try
13603 if eval $compile && $to try.c; then
13604         if $run ./try; then
13605                 echo "Your stdio acts pretty std."
13606                 val="$define"
13607         else
13608                 echo "Your stdio isn't very std."
13609         fi
13610 else
13611         echo "Your stdio doesn't appear very std."
13612 fi
13613 $rm_try
13614
13615 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13616 # direct buffer manipulation no longer works.  The Configure tests
13617 # should be changed to correctly detect this, but until then,
13618 # the following check should at least let perl compile and run.
13619 # (This quick fix should be updated before 5.8.1.)
13620 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13621 # A. Dougherty, June 3, 2002.
13622 case "$d_gnulibc" in
13623 $define)
13624         case "$gnulibc_version" in
13625         2.[01]*)  ;;
13626         2.2) ;;
13627         2.2.[0-9]) ;;
13628         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13629                 val="$undef"
13630                 ;;
13631         esac
13632         ;;
13633 esac
13634 set d_stdstdio
13635 eval $setvar
13636
13637 : Can _ptr be used as an lvalue?
13638 case "$d_stdstdio$ptr_lval" in
13639 $define$define) val=$define ;;
13640 *) val=$undef ;;
13641 esac
13642 set d_stdio_ptr_lval
13643 eval $setvar
13644
13645 : Can _cnt be used as an lvalue?
13646 case "$d_stdstdio$cnt_lval" in
13647 $define$define) val=$define ;;
13648 *) val=$undef ;;
13649 esac
13650 set d_stdio_cnt_lval
13651 eval $setvar
13652
13653
13654 : test whether setting _ptr sets _cnt as a side effect
13655 d_stdio_ptr_lval_sets_cnt="$undef"
13656 d_stdio_ptr_lval_nochange_cnt="$undef"
13657 case "$d_stdio_ptr_lval$d_stdstdio" in
13658 $define$define)
13659         echo "Checking to see what happens if we set the stdio ptr..." >&4
13660 $cat >try.c <<EOP
13661 #include <stdio.h>
13662 /* Can we scream? */
13663 /* Eat dust sed :-) */
13664 /* In the buffer space, no one can hear you scream. */
13665 #$i_stdlib I_STDLIB
13666 #ifdef I_STDLIB
13667 #include <stdlib.h>
13668 #endif
13669 #define FILE_ptr(fp)    $stdio_ptr
13670 #define FILE_cnt(fp)    $stdio_cnt
13671 #include <sys/types.h>
13672 int main() {
13673         FILE *fp = fopen("try.c", "r");
13674         int c;
13675         char *ptr;
13676         size_t cnt;
13677         if (!fp) {
13678             puts("Fail even to read");
13679             exit(1);
13680         }
13681         c = getc(fp); /* Read away the first # */
13682         if (c == EOF) {
13683             puts("Fail even to read");
13684             exit(1);
13685         }
13686         if (!(
13687                 18 <= FILE_cnt(fp) &&
13688                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13689         )) {
13690                 puts("Fail even to read");
13691                 exit (1);
13692         }
13693         ptr = (char*) FILE_ptr(fp);
13694         cnt = (size_t)FILE_cnt(fp);
13695
13696         FILE_ptr(fp) += 42;
13697
13698         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13699                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13700                 exit (1);
13701         }
13702         if (FILE_cnt(fp) <= 20) {
13703                 printf ("Fail (<20 chars to test)");
13704                 exit (1);
13705         }
13706         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13707                 puts("Fail compare");
13708                 exit (1);
13709         }
13710         if (cnt == FILE_cnt(fp)) {
13711                 puts("Pass_unchanged");
13712                 exit (0);
13713         }
13714         if (FILE_cnt(fp) == (cnt - 42)) {
13715                 puts("Pass_changed");
13716                 exit (0);
13717         }
13718         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13719         return 1;
13720
13721 }
13722 EOP
13723         set try
13724         if eval $compile && $to try.c; then
13725                 case `$run ./try` in
13726                 Pass_changed)
13727                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13728                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13729                 Pass_unchanged)
13730                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13731                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13732                 Fail*)
13733                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13734                 *)
13735                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13736         esac
13737         else
13738                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13739         fi
13740         $rm_try
13741         ;;
13742 esac
13743
13744 : see if _base is also standard
13745 val="$undef"
13746 case "$d_stdstdio" in
13747 $define)
13748         $cat >try.c <<EOP
13749 #include <stdio.h>
13750 #$i_stdlib I_STDLIB
13751 #ifdef I_STDLIB
13752 #include <stdlib.h>
13753 #endif
13754 #define FILE_base(fp)   $stdio_base
13755 #define FILE_bufsiz(fp) $stdio_bufsiz
13756 int main() {
13757         FILE *fp = fopen("try.c", "r");
13758         char c = getc(fp);
13759         if (
13760                 19 <= FILE_bufsiz(fp) &&
13761                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13762         )
13763                 exit(0);
13764         exit(1);
13765 }
13766 EOP
13767         set try
13768         if eval $compile && $to try.c; then
13769                 if $run ./try; then
13770                         echo "And its _base field acts std."
13771                         val="$define"
13772                 else
13773                         echo "But its _base field isn't std."
13774                 fi
13775         else
13776                 echo "However, it seems to be lacking the _base field."
13777         fi
13778         $rm_try
13779         ;;
13780 esac
13781 set d_stdiobase
13782 eval $setvar
13783
13784 : see if fast_stdio exists
13785 val="$undef"
13786 case "$d_stdstdio:$d_stdio_ptr_lval" in
13787 "$define:$define")
13788         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13789         *$define*)
13790                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13791                 val="$define"
13792                 ;;
13793         esac
13794         ;;
13795 esac
13796 set d_faststdio
13797 eval $setvar
13798
13799
13800
13801 : see if fchdir exists
13802 set fchdir d_fchdir
13803 eval $inlibc
13804
13805 : see if fchmod exists
13806 set fchmod d_fchmod
13807 eval $inlibc
13808
13809 : see if fchown exists
13810 set fchown d_fchown
13811 eval $inlibc
13812
13813 : see if this is an fcntl system
13814 set fcntl d_fcntl
13815 eval $inlibc
13816
13817 : See if fcntl-based locking works.
13818 echo " "
13819 $cat >try.c <<EOCP
13820 #$i_stdlib I_STDLIB
13821 #ifdef I_STDLIB
13822 #include <stdlib.h>
13823 #endif
13824 #include <unistd.h>
13825 #include <fcntl.h>
13826 #include <signal.h>
13827 $signal_t blech(int x) { exit(3); }
13828 int main() {
13829 #if defined(F_SETLK) && defined(F_SETLKW)
13830      struct flock flock;
13831      int retval, fd;
13832      fd = open("try.c", O_RDONLY);
13833      flock.l_type = F_RDLCK;
13834      flock.l_whence = SEEK_SET;
13835      flock.l_start = flock.l_len = 0;
13836      signal(SIGALRM, blech);
13837      alarm(10);
13838      retval = fcntl(fd, F_SETLK, &flock);
13839      close(fd);
13840      (retval < 0 ? exit(2) : exit(0));
13841 #else
13842      exit(2);
13843 #endif
13844 }
13845 EOCP
13846 echo "Checking if fcntl-based file locking works... "
13847 case "$d_fcntl" in
13848 "$define")
13849         set try
13850         if eval $compile_ok; then
13851                 if $run ./try; then
13852                         echo "Yes, it seems to work."
13853                         val="$define"
13854                 else
13855                         echo "Nope, it didn't work."
13856                         val="$undef"
13857                         case "$?" in
13858                         3) $cat >&4 <<EOM
13859 ***
13860 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13861 *** This is (almost) impossible.
13862 *** If your NFS lock daemons are not feeling well, something like
13863 *** this may happen, please investigate.  Cannot continue, aborting.
13864 ***
13865 EOM
13866                                 exit 1
13867                                 ;;
13868                         esac
13869                 fi
13870         else
13871                 echo "I'm unable to compile the test program, so I'll assume not."
13872                 val="$undef"
13873         fi
13874         ;;
13875 *) val="$undef";
13876         echo "Nope, since you don't even have fcntl()."
13877         ;;
13878 esac
13879 set d_fcntl_can_lock
13880 eval $setvar
13881 $rm_try
13882
13883 : check for fd_set items
13884 $cat <<EOM
13885
13886 Checking to see how well your C compiler handles fd_set and friends ...
13887 EOM
13888 $cat >try.c <<EOCP
13889 #$i_stdlib I_STDLIB
13890 #ifdef I_STDLIB
13891 #include <stdlib.h>
13892 #endif
13893 #$i_systime I_SYS_TIME
13894 #$i_sysselct I_SYS_SELECT
13895 #$d_socket HAS_SOCKET
13896 #include <sys/types.h>
13897 #ifdef HAS_SOCKET
13898 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13899 #endif
13900 #ifdef I_SYS_TIME
13901 #include <sys/time.h>
13902 #endif
13903 #ifdef I_SYS_SELECT
13904 #include <sys/select.h>
13905 #endif
13906 int main() {
13907         fd_set fds;
13908
13909 #ifdef TRYBITS
13910         if(fds.fds_bits);
13911 #endif
13912
13913 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13914         exit(0);
13915 #else
13916         exit(1);
13917 #endif
13918 }
13919 EOCP
13920 set try -DTRYBITS
13921 if eval $compile; then
13922         d_fds_bits="$define"
13923         d_fd_set="$define"
13924         echo "Well, your system knows about the normal fd_set typedef..." >&4
13925         if $run ./try; then
13926                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13927                 d_fd_macros="$define"
13928         else
13929                 $cat >&4 <<'EOM'
13930 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13931 EOM
13932                 d_fd_macros="$undef"
13933         fi
13934 else
13935         $cat <<'EOM'
13936 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13937 EOM
13938         set try
13939         if eval $compile; then
13940                 d_fds_bits="$undef"
13941                 d_fd_set="$define"
13942                 echo "Well, your system has some sort of fd_set available..." >&4
13943                 if $run ./try; then
13944                         echo "and you have the normal fd_set macros." >&4
13945                         d_fd_macros="$define"
13946                 else
13947                         $cat <<'EOM'
13948 but not the normal fd_set macros!  Gross!  More work for me...
13949 EOM
13950                         d_fd_macros="$undef"
13951                 fi
13952         else
13953         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13954                 d_fd_set="$undef"
13955                 d_fds_bits="$undef"
13956                 d_fd_macros="$undef"
13957         fi
13958 fi
13959 $rm_try
13960
13961 : see if fdim exists
13962 set fdim d_fdim
13963 eval $inlibc
13964
13965 : see if fegetround exists
13966 set fegetround d_fegetround
13967 eval $inlibc
13968
13969 : see if fgetpos exists
13970 set fgetpos d_fgetpos
13971 eval $inlibc
13972
13973 : see if finite exists
13974 set finite d_finite
13975 eval $inlibc
13976
13977 : see if finitel exists
13978 set finitel d_finitel
13979 eval $inlibc
13980
13981 : see if flock exists
13982 set flock d_flock
13983 eval $inlibc
13984
13985 : see if prototype for flock is available
13986 echo " "
13987 set d_flockproto flock $i_sysfile sys/file.h
13988 eval $hasproto
13989
13990 : see if fma exists
13991 set fma d_fma
13992 eval $inlibc
13993
13994 : see if fmax exists
13995 set fmax d_fmax
13996 eval $inlibc
13997
13998 : see if fmin exists
13999 set fmin d_fmin
14000 eval $inlibc
14001
14002 : see if fp_class exists
14003 set fp_class d_fp_class
14004 eval $inlibc
14005
14006 : see if this is a math.h system
14007 set math.h i_math
14008 eval $inhdr
14009
14010 : check for fpclassify
14011 echo "Checking to see if you have fpclassify..." >&4
14012 $cat >try.c <<EOCP
14013 #$i_math I_MATH
14014 #ifdef I_MATH
14015 #include <math.h>
14016 #endif
14017 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
14018 EOCP
14019 set try
14020 if eval $compile; then
14021         val="$define"
14022         echo "You have fpclassify."
14023 else
14024         val="$undef"
14025         echo "You do not have fpclassify."
14026 fi
14027 $rm_try
14028 set d_fpclassify
14029 eval $setvar
14030
14031 : see if fp_classify exists
14032 set fp_classify d_fp_classify
14033 eval $inlibc
14034
14035 : see if fp_classl exists
14036 set fp_classl d_fp_classl
14037 eval $inlibc
14038
14039 : see if pathconf exists
14040 set pathconf d_pathconf
14041 eval $inlibc
14042
14043 : see if fpathconf exists
14044 set fpathconf d_fpathconf
14045 eval $inlibc
14046
14047 : see if fpclass exists
14048 set fpclass d_fpclass
14049 eval $inlibc
14050
14051 : see if fpclassl exists
14052 set fpclassl d_fpclassl
14053 eval $inlibc
14054
14055 : see if fpgetround exists
14056 set fpgetround d_fpgetround
14057 eval $inlibc
14058
14059 : check for fpos64_t
14060 echo " "
14061 echo "Checking to see if you have fpos64_t..." >&4
14062 $cat >try.c <<EOCP
14063 #include <stdio.h>
14064 int main() { fpos64_t x = 7; }
14065 EOCP
14066 set try
14067 if eval $compile; then
14068         val="$define"
14069         echo "You have fpos64_t."
14070 else
14071         val="$undef"
14072         echo "You do not have fpos64_t."
14073         case "$fpossize" in
14074         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14075         esac
14076 fi
14077 $rm_try
14078 set d_fpos64_t
14079 eval $setvar
14080
14081 : see if frexpl exists
14082 set frexpl d_frexpl
14083 eval $inlibc
14084
14085 : see if this is a sys/param system
14086 set sys/param.h i_sysparam
14087 eval $inhdr
14088
14089 : see if this is a sys/mount.h system
14090 set sys/mount.h i_sysmount
14091 eval $inhdr
14092
14093 : Check for fs_data_s
14094 echo " "
14095 echo "Checking to see if your system supports struct fs_data..." >&4
14096 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14097 eval $hasstruct
14098 case "$d_fs_data_s" in
14099 "$define")      echo "Yes, it does."   ;;
14100 *)              echo "No, it doesn't." ;;
14101 esac
14102
14103 : see if fseeko exists
14104 set fseeko d_fseeko
14105 eval $inlibc
14106 case "$longsize" in
14107 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14108 esac
14109
14110 : see if fsetpos exists
14111 set fsetpos d_fsetpos
14112 eval $inlibc
14113
14114 : see if fstatfs exists
14115 set fstatfs d_fstatfs
14116 eval $inlibc
14117
14118 : see if statvfs exists
14119 set statvfs d_statvfs
14120 eval $inlibc
14121
14122 : see if fstatvfs exists
14123 set fstatvfs d_fstatvfs
14124 eval $inlibc
14125
14126
14127 : see if fsync exists
14128 set fsync d_fsync
14129 eval $inlibc
14130
14131 : see if ftello exists
14132 set ftello d_ftello
14133 eval $inlibc
14134 case "$longsize" in
14135 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14136 esac
14137
14138 : check for a working futimes
14139 d_futimes="$undef"
14140 echo " "
14141 echo "Checking if you have a working futimes()" >&4
14142 $cat >try.c <<EOCP
14143 #include <stdio.h>
14144 #include <sys/time.h>
14145 #include <errno.h>
14146 #include <fcntl.h>
14147
14148 int main ()
14149 {
14150     int fd, rv;
14151     fd = open ("try.c", O_RDWR);
14152     if (-1 == fd) exit (1);
14153     rv = futimes (fd, NULL);
14154     exit (rv == -1 ? errno : 0);
14155 }
14156 EOCP
14157 set try
14158 if eval $compile; then
14159     `$run ./try`
14160     rc=$?
14161     case "$rc" in
14162         0)  echo "Yes, you have" >&4
14163             d_futimes="$define"
14164             ;;
14165         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14166             ;;
14167     esac
14168 else
14169     echo "No, it does not (probably harmless)" >&4
14170 fi
14171 $rm_try
14172
14173 : see if ndbm.h is available
14174 set ndbm.h i_ndbm
14175 eval $inhdr
14176 : Compatibility location for RedHat 7.1
14177 set gdbm/ndbm.h i_gdbmndbm
14178 eval $inhdr
14179 : Compatibility location for Debian 4.0
14180 set gdbm-ndbm.h i_gdbm_ndbm
14181 eval $inhdr
14182
14183 val="$undef"
14184 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14185         : see if dbm_open exists
14186         set dbm_open d_dbm_open
14187         eval $inlibc
14188         case "$d_dbm_open" in
14189         $undef)
14190                 i_ndbm="$undef"
14191                 i_gdbmndbm="$undef"
14192                 i_gdbm_ndbm="$undef"
14193                 echo "We won't be including <ndbm.h>"
14194                 val="$undef"
14195                 ;;
14196         *) val="$define"
14197            ;;
14198         esac
14199 fi
14200 set d_ndbm
14201 eval $setvar
14202
14203 ndbm_hdr_protochk='name=$1; hdr=$2;
14204 eval "ihdr=\$""i_$name";
14205 val="$undef";
14206 if $test "$ihdr" = "$define"; then
14207         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14208         case "$d_cplusplus" in
14209         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14210         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14211         esac;
14212         case "$val" in
14213         $define) $echo "Your <$hdr> seems to have prototypes";;
14214         *) $echo "Your <$hdr> does not seem to have prototypes";;
14215         esac;
14216 fi;
14217 set "d_${name}_h_uses_prototypes";
14218 eval $setvar'
14219
14220 set ndbm ndbm.h
14221 eval $ndbm_hdr_protochk
14222 set gdbmndbm gdbm/ndbm.h
14223 eval $ndbm_hdr_protochk
14224 set gdbm_ndbm gdbm-ndbm.h
14225 eval $ndbm_hdr_protochk
14226
14227 : see if getaddrinfo exists
14228 set getaddrinfo d_getaddrinfo
14229 eval $inlibc
14230
14231 : see if getcwd exists
14232 set getcwd d_getcwd
14233 eval $inlibc
14234
14235 : see if getespwnam exists
14236 set getespwnam d_getespwnam
14237 eval $inlibc
14238
14239 : see if getfsstat exists
14240 set getfsstat d_getfsstat
14241 eval $inlibc
14242
14243 : see if getgrent exists
14244 set getgrent d_getgrent
14245 eval $inlibc
14246
14247 : see if getgrent_r exists
14248 set getgrent_r d_getgrent_r
14249 eval $inlibc
14250 case "$d_getgrent_r" in
14251 "$define")
14252         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14253         case "$d_getgrent_r_proto:$usethreads" in
14254         ":define")      d_getgrent_r_proto=define
14255                 set d_getgrent_r_proto getgrent_r $hdrs
14256                 eval $hasproto ;;
14257         *)      ;;
14258         esac
14259         case "$d_getgrent_r_proto" in
14260         define)
14261         case "$getgrent_r_proto" in
14262         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14263         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14264         esac
14265         case "$getgrent_r_proto" in
14266         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14267         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14268         esac
14269         case "$getgrent_r_proto" in
14270         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14271         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14272         esac
14273         case "$getgrent_r_proto" in
14274         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14275         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14276         esac
14277         case "$getgrent_r_proto" in
14278         ''|0) try='int getgrent_r(struct group*, char*, int);'
14279         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14280         esac
14281         case "$getgrent_r_proto" in
14282         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14283         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14284         esac
14285         case "$getgrent_r_proto" in
14286         ''|0)   d_getgrent_r=undef
14287                 getgrent_r_proto=0
14288                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14289         * )     case "$getgrent_r_proto" in
14290                 REENTRANT_PROTO*) ;;
14291                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14292                 esac
14293                 echo "Prototype: $try" ;;
14294         esac
14295         ;;
14296         *)      case "$usethreads" in
14297                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14298                 esac
14299                 d_getgrent_r=undef
14300                 getgrent_r_proto=0
14301                 ;;
14302         esac
14303         ;;
14304 *)      getgrent_r_proto=0
14305         ;;
14306 esac
14307
14308 : see if getgrgid_r exists
14309 set getgrgid_r d_getgrgid_r
14310 eval $inlibc
14311 case "$d_getgrgid_r" in
14312 "$define")
14313         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14314         case "$d_getgrgid_r_proto:$usethreads" in
14315         ":define")      d_getgrgid_r_proto=define
14316                 set d_getgrgid_r_proto getgrgid_r $hdrs
14317                 eval $hasproto ;;
14318         *)      ;;
14319         esac
14320         case "$d_getgrgid_r_proto" in
14321         define)
14322         case "$getgrgid_r_proto" in
14323         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14324         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14325         esac
14326         case "$getgrgid_r_proto" in
14327         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14328         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14329         esac
14330         case "$getgrgid_r_proto" in
14331         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14332         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14333         esac
14334         case "$getgrgid_r_proto" in
14335         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14336         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14337         esac
14338         case "$getgrgid_r_proto" in
14339         ''|0)   d_getgrgid_r=undef
14340                 getgrgid_r_proto=0
14341                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14342         * )     case "$getgrgid_r_proto" in
14343                 REENTRANT_PROTO*) ;;
14344                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14345                 esac
14346                 echo "Prototype: $try" ;;
14347         esac
14348         ;;
14349         *)      case "$usethreads" in
14350                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14351                 esac
14352                 d_getgrgid_r=undef
14353                 getgrgid_r_proto=0
14354                 ;;
14355         esac
14356         ;;
14357 *)      getgrgid_r_proto=0
14358         ;;
14359 esac
14360
14361 : see if getgrnam_r exists
14362 set getgrnam_r d_getgrnam_r
14363 eval $inlibc
14364 case "$d_getgrnam_r" in
14365 "$define")
14366         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14367         case "$d_getgrnam_r_proto:$usethreads" in
14368         ":define")      d_getgrnam_r_proto=define
14369                 set d_getgrnam_r_proto getgrnam_r $hdrs
14370                 eval $hasproto ;;
14371         *)      ;;
14372         esac
14373         case "$d_getgrnam_r_proto" in
14374         define)
14375         case "$getgrnam_r_proto" in
14376         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14377         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14378         esac
14379         case "$getgrnam_r_proto" in
14380         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14381         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14382         esac
14383         case "$getgrnam_r_proto" in
14384         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14385         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14386         esac
14387         case "$getgrnam_r_proto" in
14388         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14389         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14390         esac
14391         case "$getgrnam_r_proto" in
14392         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14393         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14394         esac
14395         case "$getgrnam_r_proto" in
14396         ''|0)   d_getgrnam_r=undef
14397                 getgrnam_r_proto=0
14398                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14399         * )     case "$getgrnam_r_proto" in
14400                 REENTRANT_PROTO*) ;;
14401                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14402                 esac
14403                 echo "Prototype: $try" ;;
14404         esac
14405         ;;
14406         *)      case "$usethreads" in
14407                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14408                 esac
14409                 d_getgrnam_r=undef
14410                 getgrnam_r_proto=0
14411                 ;;
14412         esac
14413         ;;
14414 *)      getgrnam_r_proto=0
14415         ;;
14416 esac
14417
14418 : see if gethostbyaddr exists
14419 set gethostbyaddr d_gethbyaddr
14420 eval $inlibc
14421
14422 : see if gethostbyname exists
14423 set gethostbyname d_gethbyname
14424 eval $inlibc
14425
14426 : see if gethostent exists
14427 set gethostent d_gethent
14428 eval $inlibc
14429
14430 : see how we will look up host name
14431 echo " "
14432 call=''
14433 if set gethostname val -f d_gethname; eval $csym; $val; then
14434         echo 'gethostname() found.' >&4
14435         d_gethname="$define"
14436         call=gethostname
14437 fi
14438 if set uname val -f d_uname; eval $csym; $val; then
14439         if ./xenix; then
14440                 $cat <<'EOM'
14441 uname() was found, but you're running xenix, and older versions of xenix
14442 have a broken uname(). If you don't really know whether your xenix is old
14443 enough to have a broken system call, use the default answer.
14444
14445 EOM
14446                 dflt=y
14447                 case "$d_uname" in
14448                 "$define") dflt=n;;
14449                 esac
14450                 rp='Is your uname() broken?'
14451                 . ./myread
14452                 case "$ans" in
14453                 n*) d_uname="$define"; call=uname;;
14454                 esac
14455         else
14456                 echo 'uname() found.' >&4
14457                 d_uname="$define"
14458                 case "$call" in
14459                 '') call=uname ;;
14460                 esac
14461         fi
14462 fi
14463 case "$d_gethname" in
14464 '') d_gethname="$undef";;
14465 esac
14466 case "$d_uname" in
14467 '') d_uname="$undef";;
14468 esac
14469 case "$d_uname$d_gethname" in
14470 *define*)
14471         dflt=n
14472         cat <<EOM
14473
14474 Every now and then someone has a $call() that lies about the hostname
14475 but can't be fixed for political or economic reasons.  If you wish, I can
14476 pretend $call() isn't there and maybe compute hostname at run-time
14477 thanks to the '$phostname' command.
14478
14479 EOM
14480         rp="Shall I ignore $call() from now on?"
14481         . ./myread
14482         case "$ans" in
14483         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14484         esac;;
14485 esac
14486 case "$phostname" in
14487 '') aphostname='';;
14488 *) case "$aphostname" in
14489         /*) ;;
14490         *) set X $phostname
14491                 shift
14492                 file=$1
14493                 shift
14494                 file=`./loc $file $file $pth`
14495                 aphostname=`echo $file $*`
14496                 ;;
14497         esac
14498         ;;
14499 esac
14500 case "$d_uname$d_gethname" in
14501 *define*) ;;
14502 *)
14503         case "$phostname" in
14504         '')
14505                 echo "There will be no way for $package to get your hostname." >&4;;
14506         *)
14507         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14508                 ;;
14509         esac;;
14510 esac
14511 case "$d_phostname" in
14512 '') d_phostname="$undef";;
14513 esac
14514
14515 : see if gethostbyaddr_r exists
14516 set gethostbyaddr_r d_gethostbyaddr_r
14517 eval $inlibc
14518 case "$d_gethostbyaddr_r" in
14519 "$define")
14520         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14521         case "$d_gethostbyaddr_r_proto:$usethreads" in
14522         ":define")      d_gethostbyaddr_r_proto=define
14523                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14524                 eval $hasproto ;;
14525         *)      ;;
14526         esac
14527         case "$d_gethostbyaddr_r_proto" in
14528         define)
14529         case "$gethostbyaddr_r_proto" in
14530         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14531         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14532         esac
14533         case "$gethostbyaddr_r_proto" in
14534         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14535         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14536         esac
14537         case "$gethostbyaddr_r_proto" in
14538         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14539         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14540         esac
14541         case "$gethostbyaddr_r_proto" in
14542         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14543         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14544         esac
14545         case "$gethostbyaddr_r_proto" in
14546         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14547         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14548         esac
14549         case "$gethostbyaddr_r_proto" in
14550         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14551         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14552         esac
14553         case "$gethostbyaddr_r_proto" in
14554         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14555         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14556         esac
14557         case "$gethostbyaddr_r_proto" in
14558         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14559         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14560         esac
14561         case "$gethostbyaddr_r_proto" in
14562         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14563         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14564         esac
14565         case "$gethostbyaddr_r_proto" in
14566         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14567         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14568         esac
14569         case "$gethostbyaddr_r_proto" in
14570         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14571         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14572         esac
14573         case "$gethostbyaddr_r_proto" in
14574         ''|0)   d_gethostbyaddr_r=undef
14575                 gethostbyaddr_r_proto=0
14576                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14577         * )     case "$gethostbyaddr_r_proto" in
14578                 REENTRANT_PROTO*) ;;
14579                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14580                 esac
14581                 echo "Prototype: $try" ;;
14582         esac
14583         ;;
14584         *)      case "$usethreads" in
14585                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14586                 esac
14587                 d_gethostbyaddr_r=undef
14588                 gethostbyaddr_r_proto=0
14589                 ;;
14590         esac
14591         ;;
14592 *)      gethostbyaddr_r_proto=0
14593         ;;
14594 esac
14595
14596 : see if gethostbyname_r exists
14597 set gethostbyname_r d_gethostbyname_r
14598 eval $inlibc
14599 case "$d_gethostbyname_r" in
14600 "$define")
14601         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14602         case "$d_gethostbyname_r_proto:$usethreads" in
14603         ":define")      d_gethostbyname_r_proto=define
14604                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14605                 eval $hasproto ;;
14606         *)      ;;
14607         esac
14608         case "$d_gethostbyname_r_proto" in
14609         define)
14610         case "$gethostbyname_r_proto" in
14611         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14612         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14613         esac
14614         case "$gethostbyname_r_proto" in
14615         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14616         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14617         esac
14618         case "$gethostbyname_r_proto" in
14619         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14620         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14621         esac
14622         case "$gethostbyname_r_proto" in
14623         ''|0)   d_gethostbyname_r=undef
14624                 gethostbyname_r_proto=0
14625                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14626         * )     case "$gethostbyname_r_proto" in
14627                 REENTRANT_PROTO*) ;;
14628                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14629                 esac
14630                 echo "Prototype: $try" ;;
14631         esac
14632         ;;
14633         *)      case "$usethreads" in
14634                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14635                 esac
14636                 d_gethostbyname_r=undef
14637                 gethostbyname_r_proto=0
14638                 ;;
14639         esac
14640         ;;
14641 *)      gethostbyname_r_proto=0
14642         ;;
14643 esac
14644
14645 : see if gethostent_r exists
14646 set gethostent_r d_gethostent_r
14647 eval $inlibc
14648 case "$d_gethostent_r" in
14649 "$define")
14650         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14651         case "$d_gethostent_r_proto:$usethreads" in
14652         ":define")      d_gethostent_r_proto=define
14653                 set d_gethostent_r_proto gethostent_r $hdrs
14654                 eval $hasproto ;;
14655         *)      ;;
14656         esac
14657         case "$d_gethostent_r_proto" in
14658         define)
14659         case "$gethostent_r_proto" in
14660         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14661         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14662         esac
14663         case "$gethostent_r_proto" in
14664         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14665         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14666         esac
14667         case "$gethostent_r_proto" in
14668         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14669         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14670         esac
14671         case "$gethostent_r_proto" in
14672         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14673         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14674         esac
14675         case "$gethostent_r_proto" in
14676         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14677         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14678         esac
14679         case "$gethostent_r_proto" in
14680         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14681         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14682         esac
14683         case "$gethostent_r_proto" in
14684         ''|0)   d_gethostent_r=undef
14685                 gethostent_r_proto=0
14686                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14687         * )     case "$gethostent_r_proto" in
14688                 REENTRANT_PROTO*) ;;
14689                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14690                 esac
14691                 echo "Prototype: $try" ;;
14692         esac
14693         ;;
14694         *)      case "$usethreads" in
14695                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14696                 esac
14697                 d_gethostent_r=undef
14698                 gethostent_r_proto=0
14699                 ;;
14700         esac
14701         ;;
14702 *)      gethostent_r_proto=0
14703         ;;
14704 esac
14705
14706 : see if prototypes for various gethostxxx netdb.h functions are available
14707 echo " "
14708 set d_gethostprotos gethostent $i_netdb netdb.h
14709 eval $hasproto
14710
14711 : see if getitimer exists
14712 set getitimer d_getitimer
14713 eval $inlibc
14714
14715 : see if getlogin exists
14716 set getlogin d_getlogin
14717 eval $inlibc
14718
14719 : see if getlogin_r exists
14720 set getlogin_r d_getlogin_r
14721 eval $inlibc
14722 case "$d_getlogin_r" in
14723 "$define")
14724         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14725         case "$d_getlogin_r_proto:$usethreads" in
14726         ":define")      d_getlogin_r_proto=define
14727                 set d_getlogin_r_proto getlogin_r $hdrs
14728                 eval $hasproto ;;
14729         *)      ;;
14730         esac
14731         case "$d_getlogin_r_proto" in
14732         define)
14733         case "$getlogin_r_proto" in
14734         ''|0) try='int getlogin_r(char*, size_t);'
14735         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14736         esac
14737         case "$getlogin_r_proto" in
14738         ''|0) try='int getlogin_r(char*, int);'
14739         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14740         esac
14741         case "$getlogin_r_proto" in
14742         ''|0) try='char* getlogin_r(char*, size_t);'
14743         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14744         esac
14745         case "$getlogin_r_proto" in
14746         ''|0) try='char* getlogin_r(char*, int);'
14747         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14748         esac
14749         case "$getlogin_r_proto" in
14750         ''|0)   d_getlogin_r=undef
14751                 getlogin_r_proto=0
14752                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14753         * )     case "$getlogin_r_proto" in
14754                 REENTRANT_PROTO*) ;;
14755                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14756                 esac
14757                 echo "Prototype: $try" ;;
14758         esac
14759         ;;
14760         *)      case "$usethreads" in
14761                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14762                 esac
14763                 d_getlogin_r=undef
14764                 getlogin_r_proto=0
14765                 ;;
14766         esac
14767         ;;
14768 *)      getlogin_r_proto=0
14769         ;;
14770 esac
14771
14772 : see if getmnt exists
14773 set getmnt d_getmnt
14774 eval $inlibc
14775
14776 : see if getmntent exists
14777 set getmntent d_getmntent
14778 eval $inlibc
14779
14780 : see if getnameinfo exists
14781 set getnameinfo d_getnameinfo
14782 eval $inlibc
14783
14784 : see if getnetbyaddr exists
14785 set getnetbyaddr d_getnbyaddr
14786 eval $inlibc
14787
14788 : see if getnetbyname exists
14789 set getnetbyname d_getnbyname
14790 eval $inlibc
14791
14792 : see if getnetent exists
14793 set getnetent d_getnent
14794 eval $inlibc
14795
14796 : see if getnetbyaddr_r exists
14797 set getnetbyaddr_r d_getnetbyaddr_r
14798 eval $inlibc
14799 case "$d_getnetbyaddr_r" in
14800 "$define")
14801         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14802         case "$d_getnetbyaddr_r_proto:$usethreads" in
14803         ":define")      d_getnetbyaddr_r_proto=define
14804                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14805                 eval $hasproto ;;
14806         *)      ;;
14807         esac
14808         case "$d_getnetbyaddr_r_proto" in
14809         define)
14810         case "$getnetbyaddr_r_proto" in
14811         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14812         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14813         esac
14814         case "$getnetbyaddr_r_proto" in
14815         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14816         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14817         esac
14818         case "$getnetbyaddr_r_proto" in
14819         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14820         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14821         esac
14822         case "$getnetbyaddr_r_proto" in
14823         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14824         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14825         esac
14826         case "$getnetbyaddr_r_proto" in
14827         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14828         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14829         esac
14830         case "$getnetbyaddr_r_proto" in
14831         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14832         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14833         esac
14834         case "$getnetbyaddr_r_proto" in
14835         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14836         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14837         esac
14838         case "$getnetbyaddr_r_proto" in
14839         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14840         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14841         esac
14842         case "$getnetbyaddr_r_proto" in
14843         ''|0)   d_getnetbyaddr_r=undef
14844                 getnetbyaddr_r_proto=0
14845                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14846         * )     case "$getnetbyaddr_r_proto" in
14847                 REENTRANT_PROTO*) ;;
14848                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14849                 esac
14850                 echo "Prototype: $try" ;;
14851         esac
14852         ;;
14853         *)      case "$usethreads" in
14854                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14855                 esac
14856                 d_getnetbyaddr_r=undef
14857                 getnetbyaddr_r_proto=0
14858                 ;;
14859         esac
14860         ;;
14861 *)      getnetbyaddr_r_proto=0
14862         ;;
14863 esac
14864
14865 : see if getnetbyname_r exists
14866 set getnetbyname_r d_getnetbyname_r
14867 eval $inlibc
14868 case "$d_getnetbyname_r" in
14869 "$define")
14870         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14871         case "$d_getnetbyname_r_proto:$usethreads" in
14872         ":define")      d_getnetbyname_r_proto=define
14873                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14874                 eval $hasproto ;;
14875         *)      ;;
14876         esac
14877         case "$d_getnetbyname_r_proto" in
14878         define)
14879         case "$getnetbyname_r_proto" in
14880         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14881         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14882         esac
14883         case "$getnetbyname_r_proto" in
14884         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14885         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14886         esac
14887         case "$getnetbyname_r_proto" in
14888         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14889         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14890         esac
14891         case "$getnetbyname_r_proto" in
14892         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14893         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14894         esac
14895         case "$getnetbyname_r_proto" in
14896         ''|0)   d_getnetbyname_r=undef
14897                 getnetbyname_r_proto=0
14898                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14899         * )     case "$getnetbyname_r_proto" in
14900                 REENTRANT_PROTO*) ;;
14901                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14902                 esac
14903                 echo "Prototype: $try" ;;
14904         esac
14905         ;;
14906         *)      case "$usethreads" in
14907                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14908                 esac
14909                 d_getnetbyname_r=undef
14910                 getnetbyname_r_proto=0
14911                 ;;
14912         esac
14913         ;;
14914 *)      getnetbyname_r_proto=0
14915         ;;
14916 esac
14917
14918 : see if getnetent_r exists
14919 set getnetent_r d_getnetent_r
14920 eval $inlibc
14921 case "$d_getnetent_r" in
14922 "$define")
14923         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14924         case "$d_getnetent_r_proto:$usethreads" in
14925         ":define")      d_getnetent_r_proto=define
14926                 set d_getnetent_r_proto getnetent_r $hdrs
14927                 eval $hasproto ;;
14928         *)      ;;
14929         esac
14930         case "$d_getnetent_r_proto" in
14931         define)
14932         case "$getnetent_r_proto" in
14933         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14934         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14935         esac
14936         case "$getnetent_r_proto" in
14937         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14938         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14939         esac
14940         case "$getnetent_r_proto" in
14941         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14942         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14943         esac
14944         case "$getnetent_r_proto" in
14945         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14946         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14947         esac
14948         case "$getnetent_r_proto" in
14949         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14950         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14951         esac
14952         case "$getnetent_r_proto" in
14953         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14954         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14955         esac
14956         case "$getnetent_r_proto" in
14957         ''|0)   d_getnetent_r=undef
14958                 getnetent_r_proto=0
14959                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14960         * )     case "$getnetent_r_proto" in
14961                 REENTRANT_PROTO*) ;;
14962                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14963                 esac
14964                 echo "Prototype: $try" ;;
14965         esac
14966         ;;
14967         *)      case "$usethreads" in
14968                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14969                 esac
14970                 d_getnetent_r=undef
14971                 getnetent_r_proto=0
14972                 ;;
14973         esac
14974         ;;
14975 *)      getnetent_r_proto=0
14976         ;;
14977 esac
14978
14979 : see if prototypes for various getnetxxx netdb.h functions are available
14980 echo " "
14981 set d_getnetprotos getnetent $i_netdb netdb.h
14982 eval $hasproto
14983
14984 : see if getpagesize exists
14985 set getpagesize d_getpagsz
14986 eval $inlibc
14987
14988 : Optional checks for getprotobyname and getprotobynumber
14989
14990 : see if getprotobyname exists
14991 set getprotobyname d_getpbyname
14992 eval $inlibc
14993
14994 : see if getprotobynumber exists
14995 set getprotobynumber d_getpbynumber
14996 eval $inlibc
14997
14998 : see if getprotoent exists
14999 set getprotoent d_getpent
15000 eval $inlibc
15001
15002 : see if getpgid exists
15003 set getpgid d_getpgid
15004 eval $inlibc
15005
15006 : see if getpgrp2 exists
15007 set getpgrp2 d_getpgrp2
15008 eval $inlibc
15009
15010 : see if getppid exists
15011 set getppid d_getppid
15012 eval $inlibc
15013
15014 : see if getpriority exists
15015 set getpriority d_getprior
15016 eval $inlibc
15017
15018 : see if getprotobyname_r exists
15019 set getprotobyname_r d_getprotobyname_r
15020 eval $inlibc
15021 case "$d_getprotobyname_r" in
15022 "$define")
15023         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15024         case "$d_getprotobyname_r_proto:$usethreads" in
15025         ":define")      d_getprotobyname_r_proto=define
15026                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
15027                 eval $hasproto ;;
15028         *)      ;;
15029         esac
15030         case "$d_getprotobyname_r_proto" in
15031         define)
15032         case "$getprotobyname_r_proto" in
15033         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15034         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15035         esac
15036         case "$getprotobyname_r_proto" in
15037         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15038         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15039         esac
15040         case "$getprotobyname_r_proto" in
15041         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15042         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15043         esac
15044         case "$getprotobyname_r_proto" in
15045         ''|0)   d_getprotobyname_r=undef
15046                 getprotobyname_r_proto=0
15047                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15048         * )     case "$getprotobyname_r_proto" in
15049                 REENTRANT_PROTO*) ;;
15050                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15051                 esac
15052                 echo "Prototype: $try" ;;
15053         esac
15054         ;;
15055         *)      case "$usethreads" in
15056                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15057                 esac
15058                 d_getprotobyname_r=undef
15059                 getprotobyname_r_proto=0
15060                 ;;
15061         esac
15062         ;;
15063 *)      getprotobyname_r_proto=0
15064         ;;
15065 esac
15066
15067 : see if getprotobynumber_r exists
15068 set getprotobynumber_r d_getprotobynumber_r
15069 eval $inlibc
15070 case "$d_getprotobynumber_r" in
15071 "$define")
15072         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15073         case "$d_getprotobynumber_r_proto:$usethreads" in
15074         ":define")      d_getprotobynumber_r_proto=define
15075                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15076                 eval $hasproto ;;
15077         *)      ;;
15078         esac
15079         case "$d_getprotobynumber_r_proto" in
15080         define)
15081         case "$getprotobynumber_r_proto" in
15082         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15083         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15084         esac
15085         case "$getprotobynumber_r_proto" in
15086         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15087         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15088         esac
15089         case "$getprotobynumber_r_proto" in
15090         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15091         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15092         esac
15093         case "$getprotobynumber_r_proto" in
15094         ''|0)   d_getprotobynumber_r=undef
15095                 getprotobynumber_r_proto=0
15096                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15097         * )     case "$getprotobynumber_r_proto" in
15098                 REENTRANT_PROTO*) ;;
15099                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15100                 esac
15101                 echo "Prototype: $try" ;;
15102         esac
15103         ;;
15104         *)      case "$usethreads" in
15105                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15106                 esac
15107                 d_getprotobynumber_r=undef
15108                 getprotobynumber_r_proto=0
15109                 ;;
15110         esac
15111         ;;
15112 *)      getprotobynumber_r_proto=0
15113         ;;
15114 esac
15115
15116 : see if getprotoent_r exists
15117 set getprotoent_r d_getprotoent_r
15118 eval $inlibc
15119 case "$d_getprotoent_r" in
15120 "$define")
15121         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15122         case "$d_getprotoent_r_proto:$usethreads" in
15123         ":define")      d_getprotoent_r_proto=define
15124                 set d_getprotoent_r_proto getprotoent_r $hdrs
15125                 eval $hasproto ;;
15126         *)      ;;
15127         esac
15128         case "$d_getprotoent_r_proto" in
15129         define)
15130         case "$getprotoent_r_proto" in
15131         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15132         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15133         esac
15134         case "$getprotoent_r_proto" in
15135         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15136         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15137         esac
15138         case "$getprotoent_r_proto" in
15139         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15140         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15141         esac
15142         case "$getprotoent_r_proto" in
15143         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15144         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15145         esac
15146         case "$getprotoent_r_proto" in
15147         ''|0)   d_getprotoent_r=undef
15148                 getprotoent_r_proto=0
15149                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15150         * )     case "$getprotoent_r_proto" in
15151                 REENTRANT_PROTO*) ;;
15152                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15153                 esac
15154                 echo "Prototype: $try" ;;
15155         esac
15156         ;;
15157         *)      case "$usethreads" in
15158                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15159                 esac
15160                 d_getprotoent_r=undef
15161                 getprotoent_r_proto=0
15162                 ;;
15163         esac
15164         ;;
15165 *)      getprotoent_r_proto=0
15166         ;;
15167 esac
15168
15169 : see if prototypes for various getprotoxxx netdb.h functions are available
15170 echo " "
15171 set d_getprotoprotos getprotoent $i_netdb netdb.h
15172 eval $hasproto
15173
15174 : see if getprpwnam exists
15175 set getprpwnam d_getprpwnam
15176 eval $inlibc
15177
15178 : see if getpwent exists
15179 set getpwent d_getpwent
15180 eval $inlibc
15181
15182 : see if getpwent_r exists
15183 set getpwent_r d_getpwent_r
15184 eval $inlibc
15185 case "$d_getpwent_r" in
15186 "$define")
15187         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15188         case "$d_getpwent_r_proto:$usethreads" in
15189         ":define")      d_getpwent_r_proto=define
15190                 set d_getpwent_r_proto getpwent_r $hdrs
15191                 eval $hasproto ;;
15192         *)      ;;
15193         esac
15194         case "$d_getpwent_r_proto" in
15195         define)
15196         case "$getpwent_r_proto" in
15197         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15198         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15199         esac
15200         case "$getpwent_r_proto" in
15201         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15202         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15203         esac
15204         case "$getpwent_r_proto" in
15205         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15206         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15207         esac
15208         case "$getpwent_r_proto" in
15209         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15210         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15211         esac
15212         case "$getpwent_r_proto" in
15213         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15214         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15215         esac
15216         case "$getpwent_r_proto" in
15217         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15218         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15219         esac
15220         case "$getpwent_r_proto" in
15221         ''|0)   d_getpwent_r=undef
15222                 getpwent_r_proto=0
15223                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15224         * )     case "$getpwent_r_proto" in
15225                 REENTRANT_PROTO*) ;;
15226                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15227                 esac
15228                 echo "Prototype: $try" ;;
15229         esac
15230         ;;
15231         *)      case "$usethreads" in
15232                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15233                 esac
15234                 d_getpwent_r=undef
15235                 getpwent_r_proto=0
15236                 ;;
15237         esac
15238         ;;
15239 *)      getpwent_r_proto=0
15240         ;;
15241 esac
15242
15243 : see if getpwnam_r exists
15244 set getpwnam_r d_getpwnam_r
15245 eval $inlibc
15246 case "$d_getpwnam_r" in
15247 "$define")
15248         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15249         case "$d_getpwnam_r_proto:$usethreads" in
15250         ":define")      d_getpwnam_r_proto=define
15251                 set d_getpwnam_r_proto getpwnam_r $hdrs
15252                 eval $hasproto ;;
15253         *)      ;;
15254         esac
15255         case "$d_getpwnam_r_proto" in
15256         define)
15257         case "$getpwnam_r_proto" in
15258         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15259         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15260         esac
15261         case "$getpwnam_r_proto" in
15262         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15263         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15264         esac
15265         case "$getpwnam_r_proto" in
15266         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15267         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15268         esac
15269         case "$getpwnam_r_proto" in
15270         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15271         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15272         esac
15273         case "$getpwnam_r_proto" in
15274         ''|0)   d_getpwnam_r=undef
15275                 getpwnam_r_proto=0
15276                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15277         * )     case "$getpwnam_r_proto" in
15278                 REENTRANT_PROTO*) ;;
15279                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15280                 esac
15281                 echo "Prototype: $try" ;;
15282         esac
15283         ;;
15284         *)      case "$usethreads" in
15285                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15286                 esac
15287                 d_getpwnam_r=undef
15288                 getpwnam_r_proto=0
15289                 ;;
15290         esac
15291         ;;
15292 *)      getpwnam_r_proto=0
15293         ;;
15294 esac
15295
15296 : see if getpwuid_r exists
15297 set getpwuid_r d_getpwuid_r
15298 eval $inlibc
15299 case "$d_getpwuid_r" in
15300 "$define")
15301         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15302         case "$d_getpwuid_r_proto:$usethreads" in
15303         ":define")      d_getpwuid_r_proto=define
15304                 set d_getpwuid_r_proto getpwuid_r $hdrs
15305                 eval $hasproto ;;
15306         *)      ;;
15307         esac
15308         case "$d_getpwuid_r_proto" in
15309         define)
15310         case "$getpwuid_r_proto" in
15311         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15312         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15313         esac
15314         case "$getpwuid_r_proto" in
15315         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15316         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15317         esac
15318         case "$getpwuid_r_proto" in
15319         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15320         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15321         esac
15322         case "$getpwuid_r_proto" in
15323         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15324         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15325         esac
15326         case "$getpwuid_r_proto" in
15327         ''|0)   d_getpwuid_r=undef
15328                 getpwuid_r_proto=0
15329                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15330         * )     case "$getpwuid_r_proto" in
15331                 REENTRANT_PROTO*) ;;
15332                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15333                 esac
15334                 echo "Prototype: $try" ;;
15335         esac
15336         ;;
15337         *)      case "$usethreads" in
15338                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15339                 esac
15340                 d_getpwuid_r=undef
15341                 getpwuid_r_proto=0
15342                 ;;
15343         esac
15344         ;;
15345 *)      getpwuid_r_proto=0
15346         ;;
15347 esac
15348
15349 : Optional checks for getsbyname and getsbyport
15350
15351 : see if getservbyname exists
15352 set getservbyname d_getsbyname
15353 eval $inlibc
15354
15355 : see if getservbyport exists
15356 set getservbyport d_getsbyport
15357 eval $inlibc
15358
15359 : see if getservent exists
15360 set getservent d_getsent
15361 eval $inlibc
15362
15363 : see if getservbyname_r exists
15364 set getservbyname_r d_getservbyname_r
15365 eval $inlibc
15366 case "$d_getservbyname_r" in
15367 "$define")
15368         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15369         case "$d_getservbyname_r_proto:$usethreads" in
15370         ":define")      d_getservbyname_r_proto=define
15371                 set d_getservbyname_r_proto getservbyname_r $hdrs
15372                 eval $hasproto ;;
15373         *)      ;;
15374         esac
15375         case "$d_getservbyname_r_proto" in
15376         define)
15377         case "$getservbyname_r_proto" in
15378         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15379         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15380         esac
15381         case "$getservbyname_r_proto" in
15382         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15383         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15384         esac
15385         case "$getservbyname_r_proto" in
15386         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15387         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15388         esac
15389         case "$getservbyname_r_proto" in
15390         ''|0)   d_getservbyname_r=undef
15391                 getservbyname_r_proto=0
15392                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15393         * )     case "$getservbyname_r_proto" in
15394                 REENTRANT_PROTO*) ;;
15395                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15396                 esac
15397                 echo "Prototype: $try" ;;
15398         esac
15399         ;;
15400         *)      case "$usethreads" in
15401                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15402                 esac
15403                 d_getservbyname_r=undef
15404                 getservbyname_r_proto=0
15405                 ;;
15406         esac
15407         ;;
15408 *)      getservbyname_r_proto=0
15409         ;;
15410 esac
15411
15412 : see if getservbyport_r exists
15413 set getservbyport_r d_getservbyport_r
15414 eval $inlibc
15415 case "$d_getservbyport_r" in
15416 "$define")
15417         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15418         case "$d_getservbyport_r_proto:$usethreads" in
15419         ":define")      d_getservbyport_r_proto=define
15420                 set d_getservbyport_r_proto getservbyport_r $hdrs
15421                 eval $hasproto ;;
15422         *)      ;;
15423         esac
15424         case "$d_getservbyport_r_proto" in
15425         define)
15426         case "$getservbyport_r_proto" in
15427         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15428         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15429         esac
15430         case "$getservbyport_r_proto" in
15431         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15432         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15433         esac
15434         case "$getservbyport_r_proto" in
15435         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15436         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15437         esac
15438         case "$getservbyport_r_proto" in
15439         ''|0)   d_getservbyport_r=undef
15440                 getservbyport_r_proto=0
15441                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15442         * )     case "$getservbyport_r_proto" in
15443                 REENTRANT_PROTO*) ;;
15444                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15445                 esac
15446                 echo "Prototype: $try" ;;
15447         esac
15448         ;;
15449         *)      case "$usethreads" in
15450                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15451                 esac
15452                 d_getservbyport_r=undef
15453                 getservbyport_r_proto=0
15454                 ;;
15455         esac
15456         ;;
15457 *)      getservbyport_r_proto=0
15458         ;;
15459 esac
15460
15461 : see if getservent_r exists
15462 set getservent_r d_getservent_r
15463 eval $inlibc
15464 case "$d_getservent_r" in
15465 "$define")
15466         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15467         case "$d_getservent_r_proto:$usethreads" in
15468         ":define")      d_getservent_r_proto=define
15469                 set d_getservent_r_proto getservent_r $hdrs
15470                 eval $hasproto ;;
15471         *)      ;;
15472         esac
15473         case "$d_getservent_r_proto" in
15474         define)
15475         case "$getservent_r_proto" in
15476         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15477         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15478         esac
15479         case "$getservent_r_proto" in
15480         ''|0) try='int getservent_r(struct servent*, char*, int);'
15481         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15482         esac
15483         case "$getservent_r_proto" in
15484         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15485         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15486         esac
15487         case "$getservent_r_proto" in
15488         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15489         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15490         esac
15491         case "$getservent_r_proto" in
15492         ''|0)   d_getservent_r=undef
15493                 getservent_r_proto=0
15494                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15495         * )     case "$getservent_r_proto" in
15496                 REENTRANT_PROTO*) ;;
15497                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15498                 esac
15499                 echo "Prototype: $try" ;;
15500         esac
15501         ;;
15502         *)      case "$usethreads" in
15503                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15504                 esac
15505                 d_getservent_r=undef
15506                 getservent_r_proto=0
15507                 ;;
15508         esac
15509         ;;
15510 *)      getservent_r_proto=0
15511         ;;
15512 esac
15513
15514 : see if prototypes for various getservxxx netdb.h functions are available
15515 echo " "
15516 set d_getservprotos getservent $i_netdb netdb.h
15517 eval $hasproto
15518
15519 : see if getspnam exists
15520 set getspnam d_getspnam
15521 eval $inlibc
15522
15523 : see if this is a shadow.h system
15524 set shadow.h i_shadow
15525 eval $inhdr
15526
15527 : see if getspnam_r exists
15528 set getspnam_r d_getspnam_r
15529 eval $inlibc
15530 case "$d_getspnam_r" in
15531 "$define")
15532         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15533         case "$d_getspnam_r_proto:$usethreads" in
15534         ":define")      d_getspnam_r_proto=define
15535                 set d_getspnam_r_proto getspnam_r $hdrs
15536                 eval $hasproto ;;
15537         *)      ;;
15538         esac
15539         case "$d_getspnam_r_proto" in
15540         define)
15541         case "$getspnam_r_proto" in
15542         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15543         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15544         esac
15545         case "$getspnam_r_proto" in
15546         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15547         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15548         esac
15549         case "$getspnam_r_proto" in
15550         ''|0)   d_getspnam_r=undef
15551                 getspnam_r_proto=0
15552                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15553         * )     case "$getspnam_r_proto" in
15554                 REENTRANT_PROTO*) ;;
15555                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15556                 esac
15557                 echo "Prototype: $try" ;;
15558         esac
15559         ;;
15560         *)      case "$usethreads" in
15561                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15562                 esac
15563                 d_getspnam_r=undef
15564                 getspnam_r_proto=0
15565                 ;;
15566         esac
15567         ;;
15568 *)      getspnam_r_proto=0
15569         ;;
15570 esac
15571
15572 : see if gettimeofday or ftime exists
15573 set gettimeofday d_gettimeod
15574 eval $inlibc
15575 case "$d_gettimeod" in
15576 "$undef")
15577         set ftime d_ftime 
15578         eval $inlibc
15579         ;;
15580 *)
15581         val="$undef"; set d_ftime; eval $setvar
15582         ;;
15583 esac
15584 case "$d_gettimeod$d_ftime" in
15585 "$undef$undef")
15586         echo " "
15587         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15588         ;;
15589 esac
15590
15591 : see if gmtime_r exists
15592 set gmtime_r d_gmtime_r
15593 eval $inlibc
15594 case "$d_gmtime_r" in
15595 "$define")
15596         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15597         case "$d_gmtime_r_proto:$usethreads" in
15598         ":define")      d_gmtime_r_proto=define
15599                 set d_gmtime_r_proto gmtime_r $hdrs
15600                 eval $hasproto ;;
15601         *)      ;;
15602         esac
15603         case "$d_gmtime_r_proto" in
15604         define)
15605         case "$gmtime_r_proto" in
15606         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15607         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15608         esac
15609         case "$gmtime_r_proto" in
15610         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15611         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15612         esac
15613         case "$gmtime_r_proto" in
15614         ''|0)   d_gmtime_r=undef
15615                 gmtime_r_proto=0
15616                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15617         * )     case "$gmtime_r_proto" in
15618                 REENTRANT_PROTO*) ;;
15619                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15620                 esac
15621                 echo "Prototype: $try" ;;
15622         esac
15623         ;;
15624         *)      case "$usethreads" in
15625                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15626                 esac
15627                 d_gmtime_r=undef
15628                 gmtime_r_proto=0
15629                 ;;
15630         esac
15631         ;;
15632 *)      gmtime_r_proto=0
15633         ;;
15634 esac
15635
15636 : see if hasmntopt exists
15637 set hasmntopt d_hasmntopt
15638 eval $inlibc
15639
15640 : see if this is a netinet/in.h or sys/in.h system
15641 set netinet/in.h i_niin sys/in.h i_sysin
15642 eval $inhdr
15643
15644 : see if arpa/inet.h has to be included
15645 set arpa/inet.h i_arpainet
15646 eval $inhdr
15647
15648 : see if htonl --and friends-- exists
15649 val=''
15650 set htonl val
15651 eval $inlibc
15652
15653 : Maybe they are macros.
15654 case "$val" in
15655 $undef)
15656         $cat >htonl.c <<EOM
15657 #include <stdio.h>
15658 #include <sys/types.h>
15659 #$i_niin I_NETINET_IN
15660 #$i_sysin I_SYS_IN
15661 #$i_arpainet I_ARPA_INET
15662 #ifdef I_NETINET_IN
15663 #include <netinet/in.h>
15664 #endif
15665 #ifdef I_SYS_IN
15666 #include <sys/in.h>
15667 #endif
15668 #ifdef I_ARPA_INET
15669 #include <arpa/inet.h>
15670 #endif
15671 #ifdef htonl
15672 printf("Defined as a macro.");
15673 #endif
15674 EOM
15675         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15676         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15677                 val="$define"
15678                 echo "But it seems to be defined as a macro." >&4
15679         fi
15680         $rm -f htonl.?
15681         ;;
15682 esac
15683 set d_htonl
15684 eval $setvar
15685
15686 : see if hypot exists
15687 set hypot d_hypot
15688 eval $inlibc
15689
15690 : see if ilogb exists
15691 set ilogb d_ilogb
15692 eval $inlibc
15693
15694 : see if ilogbl exists
15695 set ilogbl d_ilogbl
15696 eval $inlibc
15697
15698 : index or strchr
15699 echo " "
15700 if set index val -f; eval $csym; $val; then
15701         if set strchr val -f d_strchr; eval $csym; $val; then
15702                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15703                         val="$define"
15704                         vali="$undef"
15705                         echo "strchr() found." >&4
15706                 else
15707                         val="$undef"
15708                         vali="$define"
15709                         echo "index() found." >&4
15710                 fi
15711         else
15712                 val="$undef"
15713                 vali="$define"
15714                 echo "index() found." >&4
15715         fi
15716 else
15717         if set strchr val -f d_strchr; eval $csym; $val; then
15718                 val="$define"
15719                 vali="$undef"
15720                 echo "strchr() found." >&4
15721         else
15722                 echo "No index() or strchr() found!" >&4
15723                 val="$undef"
15724                 vali="$undef"
15725         fi
15726 fi
15727 set d_strchr; eval $setvar
15728 val="$vali"
15729 set d_index; eval $setvar
15730
15731 : check whether inet_aton exists
15732 set inet_aton d_inetaton
15733 eval $inlibc
15734
15735 : see if inet_ntop exists
15736 set inet_ntop d_inetntop
15737 eval $inlibc
15738
15739 : see if inet_pton exists
15740 set inet_pton d_inetpton
15741 eval $inlibc
15742
15743 : Look for isascii
15744 echo " "
15745 $cat >isascii.c <<EOCP
15746 #include <stdio.h>
15747 #include <ctype.h>
15748 #$i_stdlib I_STDLIB
15749 #ifdef I_STDLIB
15750 #include <stdlib.h>
15751 #endif
15752 int main() {
15753         int c = 'A';
15754         if (isascii(c))
15755                 exit(0);
15756         else
15757                 exit(1);
15758 }
15759 EOCP
15760 set isascii
15761 if eval $compile; then
15762         echo "isascii() found." >&4
15763         val="$define"
15764 else
15765         echo "isascii() NOT found." >&4
15766         val="$undef"
15767 fi
15768 set d_isascii
15769 eval $setvar
15770 $rm -f isascii*
15771
15772 : Look for isblank
15773 echo " "
15774 $cat >isblank.c <<'EOCP'
15775 #include <stdio.h>
15776 #include <ctype.h>
15777 int main() {
15778         int c = ' ';
15779         if (isblank(c))
15780                 return 0 ;
15781         else
15782                 return 1 ;
15783 }
15784 EOCP
15785 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15786         echo "isblank() found." >&4
15787         val="$define"
15788 else
15789         echo "isblank() NOT found." >&4
15790         val="$undef"
15791 fi
15792 set d_isblank
15793 eval $setvar
15794 $rm -f isblank*
15795
15796 : check for isfinite
15797 echo "Checking to see if you have isfinite..." >&4
15798 $cat >try.c <<EOCP
15799 #$i_math I_MATH
15800 #ifdef I_MATH
15801 #include <math.h>
15802 #endif
15803 int main() { return isfinite(0.0); }
15804 EOCP
15805 set try
15806 if eval $compile; then
15807         val="$define"
15808         echo "You have isfinite."
15809 else
15810         val="$undef"
15811         echo "You do not have isfinite."
15812 fi
15813 $rm_try
15814 set d_isfinite
15815 eval $setvar
15816
15817 : see if isfinitel exists
15818 set isfinitel d_isfinitel
15819 eval $inlibc
15820
15821 : check for isinf
15822 echo "Checking to see if you have isinf..." >&4
15823 $cat >try.c <<EOCP
15824 #$i_math I_MATH
15825 #ifdef I_MATH
15826 #include <math.h>
15827 #endif
15828 int main() { return isinf(0.0); }
15829 EOCP
15830 set try
15831 if eval $compile; then
15832         val="$define"
15833         echo "You have isinf."
15834 else
15835         val="$undef"
15836         echo "You do not have isinf."
15837 fi
15838 $rm_try
15839 set d_isinf
15840 eval $setvar
15841
15842 : see if isinfl exists
15843 set isinfl d_isinfl
15844 eval $inlibc
15845
15846 : check for isless
15847 echo "Checking to see if you have isless..." >&4
15848 $cat >try.c <<EOCP
15849 #$i_math I_MATH
15850 #ifdef I_MATH
15851 #include <math.h>
15852 #endif
15853 int main() { return isless(0.0); }
15854 EOCP
15855 set try
15856 if eval $compile; then
15857         val="$define"
15858         echo "You have isless."
15859 else
15860         val="$undef"
15861         echo "You do not have isless."
15862 fi
15863 $rm_try
15864 set d_isless
15865 eval $setvar
15866
15867 : check for isnan
15868 echo "Checking to see if you have isnan..." >&4
15869 $cat >try.c <<EOCP
15870 #$i_math I_MATH
15871 #ifdef I_MATH
15872 #include <math.h>
15873 #endif
15874 int main() { return isnan(0.0); }
15875 EOCP
15876 set try
15877 if eval $compile; then
15878         val="$define"
15879         echo "You have isnan."
15880 else
15881         val="$undef"
15882         echo "You do not have isnan."
15883 fi
15884 $rm_try
15885 set d_isnan
15886 eval $setvar
15887
15888 : see if isnanl exists
15889 set isnanl d_isnanl
15890 eval $inlibc
15891
15892 : check for isnormal
15893 echo "Checking to see if you have isnormal..." >&4
15894 $cat >try.c <<EOCP
15895 #$i_math I_MATH
15896 #ifdef I_MATH
15897 #include <math.h>
15898 #endif
15899 int main() { return isnormal(0.0); }
15900 EOCP
15901 set try
15902 if eval $compile; then
15903         val="$define"
15904         echo "You have isnormal."
15905 else
15906         val="$undef"
15907         echo "You do not have isnormal."
15908 fi
15909 $rm_try
15910 set d_isnormal
15911 eval $setvar
15912
15913 : see if j0 exists
15914 set j0 d_j0
15915 eval $inlibc
15916
15917 : see if j0l exists
15918 set j0l d_j0l
15919 eval $inlibc
15920
15921 : see if killpg exists
15922 set killpg d_killpg
15923 eval $inlibc
15924
15925 : see if localeconv exists
15926 set localeconv d_locconv
15927 eval $inlibc
15928
15929 : see if libc has the POSIX.1-2008 currency locale rules
15930 case "$d_locconv:$d_lc_monetary_2008" in
15931 $define:)
15932         $cat >try.c <<EOCP
15933 #include <locale.h>
15934 int main() {
15935         struct lconv *lc = localeconv();
15936         char int_p_cs_precedes = lc->int_p_cs_precedes;
15937         return 0;
15938 }
15939 EOCP
15940         set try
15941         if eval $compile; then
15942                 d_lc_monetary_2008="$define"
15943         else
15944                 d_lc_monetary_2008="$undef"
15945         fi;
15946         $rm_try
15947         ;;
15948 esac
15949
15950 : see if lchown exists
15951 echo " "
15952 $cat > try.c <<'EOCP'
15953 /* System header to define __stub macros and hopefully few prototypes,
15954     which can conflict with char lchown(); below.  */
15955 #include <assert.h>
15956 /* Override any gcc2 internal prototype to avoid an error.  */
15957 /* We use char because int might match the return type of a gcc2
15958    builtin and then its argument prototype would still apply.  */
15959 char lchown();
15960 int main() {
15961     /*  The GNU C library defines this for functions which it implements
15962         to always fail with ENOSYS.  Some functions are actually named
15963         something starting with __ and the normal name is an alias.  */
15964 #if defined (__stub_lchown) || defined (__stub___lchown)
15965 choke me
15966 #else
15967 lchown();
15968 #endif
15969 ; return 0; }
15970 EOCP
15971 set try
15972 if eval $compile; then
15973     $echo "lchown() found." >&4
15974     val="$define"
15975 else
15976     $echo "lchown() NOT found." >&4
15977     val="$undef"
15978 fi
15979 set d_lchown
15980 eval $setvar
15981
15982 : See if number of significant digits in a double precision number is known
15983 echo " "
15984 $cat >ldbl_dig.c <<EOM
15985 #$i_limits I_LIMITS
15986 #$i_float I_FLOAT
15987 #ifdef I_LIMITS
15988 #include <limits.h>
15989 #endif
15990 #ifdef I_FLOAT
15991 #include <float.h>
15992 #endif
15993 #ifdef LDBL_DIG
15994 printf("Contains LDBL_DIG");
15995 #endif
15996 EOM
15997 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15998 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15999         echo "LDBL_DIG found." >&4
16000         val="$define"
16001 else
16002         echo "LDBL_DIG NOT found." >&4
16003         val="$undef"
16004 fi
16005 $rm -f ldbl_dig.?
16006 set d_ldbl_dig
16007 eval $setvar
16008
16009 : see if lgamma exists
16010 set lgamma d_lgamma
16011 eval $inlibc
16012
16013 : see if lgamma_r exists
16014 set lgamma_r d_lgamma_r
16015 eval $inlibc
16016
16017 : check to see if math.h defines _LIB_VERSION
16018 d_libm_lib_version="$undef"
16019 case $i_math in
16020     $define)
16021         echo " "
16022         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
16023         $cat >try.c <<EOCP
16024 #include <unistd.h>
16025 #include <math.h>
16026 int main (int argc, char *argv[])
16027 {
16028     printf ("%d\n", _LIB_VERSION);
16029     return (0);
16030     } /* main */
16031 EOCP
16032         set try
16033         if eval $compile; then
16034             foo=`$run ./try`
16035             echo "Yes, it does ($foo)" >&4
16036             d_libm_lib_version="$define"
16037         else
16038             echo "No, it does not (probably harmless)" >&4
16039             fi
16040         $rm_try
16041         ;;
16042
16043     esac
16044
16045 : see if link exists
16046 set link d_link
16047 eval $inlibc
16048
16049 : see if llrint exists
16050 set llrint d_llrint
16051 eval $inlibc
16052
16053 : see if llrintl exists
16054 set llrintl d_llrintl
16055 eval $inlibc
16056
16057 : see if llround exists
16058 set llround d_llround
16059 eval $inlibc
16060
16061 : see if llroundl exists
16062 set llroundl d_llroundl
16063 eval $inlibc
16064
16065 : see if localtime_r exists
16066 set localtime_r d_localtime_r
16067 eval $inlibc
16068 case "$d_localtime_r" in
16069 "$define")
16070         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16071         case "$d_localtime_r_proto:$usethreads" in
16072         ":define")      d_localtime_r_proto=define
16073                 set d_localtime_r_proto localtime_r $hdrs
16074                 eval $hasproto ;;
16075         *)      ;;
16076         esac
16077         case "$d_localtime_r_proto" in
16078         define)
16079         case "$localtime_r_proto" in
16080         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16081         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16082         esac
16083         case "$localtime_r_proto" in
16084         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16085         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16086         esac
16087         case "$localtime_r_proto" in
16088         ''|0)   d_localtime_r=undef
16089                 localtime_r_proto=0
16090                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16091         * )     case "$localtime_r_proto" in
16092                 REENTRANT_PROTO*) ;;
16093                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16094                 esac
16095                 echo "Prototype: $try" ;;
16096         esac
16097         ;;
16098         *)      case "$usethreads" in
16099                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16100                 esac
16101                 d_localtime_r=undef
16102                 localtime_r_proto=0
16103                 ;;
16104         esac
16105         ;;
16106 *)      localtime_r_proto=0
16107         ;;
16108 esac
16109
16110 : see if localtime_r calls tzset
16111 case "$localtime_r_proto" in
16112 REENTRANT_PROTO*)
16113         $cat >try.c <<EOCP
16114 /*  Does our libc's localtime_r call tzset ?
16115  *  return 0 if so, 1 otherwise.
16116  */
16117 #$i_systypes    I_SYS_TYPES
16118 #$i_unistd      I_UNISTD
16119 #$i_time        I_TIME
16120 #$i_stdlib      I_STDLIB
16121 #$i_string      I_STRING
16122 #$i_malloc      I_MALLOC
16123 #ifdef I_SYS_TYPES
16124 #  include <sys/types.h>
16125 #endif
16126 #ifdef I_UNISTD
16127 #  include <unistd.h>
16128 #endif
16129 #ifdef I_TIME
16130 #  include <time.h>
16131 #endif
16132 #ifdef I_STDLIB
16133 #include <stdlib.h>
16134 #endif
16135 #ifdef I_STRING
16136 #  include <string.h>
16137 #else
16138 #  include <strings.h>
16139 #endif
16140 #ifdef I_MALLOC
16141 #  include <malloc.h>
16142 #endif
16143 int main()
16144 {
16145     time_t t = time(0L);
16146     char w_tz[]="TZ" "=GMT+5",
16147          e_tz[]="TZ" "=GMT-5",
16148         *tz_e = (char*)malloc(16),
16149         *tz_w = (char*)malloc(16);
16150     struct tm tm_e, tm_w;
16151     memset(&tm_e,'\0',sizeof(struct tm));
16152     memset(&tm_w,'\0',sizeof(struct tm));
16153     strcpy(tz_e,e_tz);
16154     strcpy(tz_w,w_tz);
16155
16156     putenv(tz_e);
16157     localtime_r(&t, &tm_e);
16158
16159     putenv(tz_w);
16160     localtime_r(&t, &tm_w);
16161
16162     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16163         return 1;
16164     return 0;
16165 }
16166 EOCP
16167         set try
16168         if eval $compile; then
16169             if $run ./try; then
16170                 d_localtime_r_needs_tzset=undef;
16171             else
16172                 d_localtime_r_needs_tzset=define;
16173             fi;
16174         else
16175             d_localtime_r_needs_tzset=undef;
16176         fi;
16177      ;;
16178   *)
16179      d_localtime_r_needs_tzset=undef;
16180      ;;
16181 esac
16182 $rm_try
16183
16184 : see if lockf exists
16185 set lockf d_lockf
16186 eval $inlibc
16187
16188 : see if log1p exists
16189 set log1p d_log1p
16190 eval $inlibc
16191
16192 : see if log2 exists
16193 set log2 d_log2
16194 eval $inlibc
16195
16196 : see if logb exists
16197 set logb d_logb
16198 eval $inlibc
16199
16200 : see if lrint exists
16201 set lrint d_lrint
16202 eval $inlibc
16203
16204 : see if lrintl exists
16205 set lrintl d_lrintl
16206 eval $inlibc
16207
16208 : see if lround exists
16209 set lround d_lround
16210 eval $inlibc
16211
16212 : see if lroundl exists
16213 set lroundl d_lroundl
16214 eval $inlibc
16215
16216 : see if prototype for lseek is available
16217 echo " "
16218 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16219 eval $hasproto
16220
16221 : see if lstat exists
16222 set lstat d_lstat
16223 eval $inlibc
16224
16225 : see if madvise exists
16226 set madvise d_madvise
16227 eval $inlibc
16228
16229 : see if malloc_size exists
16230 set malloc_size d_malloc_size
16231 eval $inlibc
16232
16233 : see if malloc_size_good exists
16234 set malloc_good_size d_malloc_good_size
16235 eval $inlibc
16236
16237 : see if mblen exists
16238 set mblen d_mblen
16239 eval $inlibc
16240
16241 : see if mbstowcs exists
16242 set mbstowcs d_mbstowcs
16243 eval $inlibc
16244
16245 : see if mbtowc exists
16246 set mbtowc d_mbtowc
16247 eval $inlibc
16248
16249 : see if memchr exists
16250 set memchr d_memchr
16251 eval $inlibc
16252
16253 : see if memcmp exists
16254 set memcmp d_memcmp
16255 eval $inlibc
16256
16257 : see if memcpy exists
16258 set memcpy d_memcpy
16259 eval $inlibc
16260
16261 : see if memmove exists
16262 set memmove d_memmove
16263 eval $inlibc
16264
16265 : see if memset exists
16266 set memset d_memset
16267 eval $inlibc
16268
16269 : see if mkdir exists
16270 set mkdir d_mkdir
16271 eval $inlibc
16272
16273 : see if mkdtemp exists
16274 set mkdtemp d_mkdtemp
16275 eval $inlibc
16276
16277 : see if mkfifo exists
16278 set mkfifo d_mkfifo
16279 eval $inlibc
16280
16281 : see if mkstemp exists
16282 set mkstemp d_mkstemp
16283 eval $inlibc
16284
16285 : see if mkstemps exists
16286 set mkstemps d_mkstemps
16287 eval $inlibc
16288
16289 : see if mktime exists
16290 set mktime d_mktime
16291 eval $inlibc
16292
16293 : see if this is a sys/mman.h system
16294 set sys/mman.h i_sysmman
16295 eval $inhdr
16296
16297 : see if mmap exists
16298 set mmap d_mmap
16299 eval $inlibc
16300 : see what shmat returns
16301 : default to something harmless
16302 mmaptype='void *'
16303 case "$i_sysmman$d_mmap" in
16304 "$define$define")
16305         $cat >mmap.c <<'END'
16306 #include <sys/mman.h>
16307 void *mmap();
16308 END
16309         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16310                 mmaptype='void *'
16311         else
16312                 mmaptype='caddr_t'
16313         fi
16314         echo "and it returns ($mmaptype)." >&4
16315         ;;
16316 esac
16317
16318
16319
16320 : see if sqrtl exists
16321 set sqrtl d_sqrtl
16322 eval $inlibc
16323
16324 : see if scalbnl exists
16325 set scalbnl d_scalbnl
16326 eval $inlibc
16327
16328 : see if truncl exists
16329 set truncl d_truncl
16330 eval $inlibc
16331
16332 : see if modfl exists
16333 set modfl d_modfl
16334 eval $inlibc
16335
16336 : see if prototype for modfl is available
16337 echo " "
16338 set d_modflproto modfl $i_math math.h
16339 eval $hasproto
16340
16341 d_modfl_pow32_bug="$undef"
16342
16343 case "$d_longdbl$d_modfl" in
16344 $define$define)
16345         $cat <<EOM
16346 Checking to see whether your modfl() is okay for large values...
16347 EOM
16348 $cat >try.c <<EOCP
16349 #include <math.h>
16350 #include <stdio.h>
16351 EOCP
16352 if $test "X$d_modflproto" != "X$define"; then
16353         $cat >>try.c <<EOCP
16354 /* Sigh. many current glibcs provide the function, but do not prototype it. */
16355 long double modfl (long double, long double *);
16356 EOCP
16357 fi
16358 $cat >>try.c <<EOCP
16359 int main() {
16360     long double nv = 4294967303.15;
16361     long double v, w;
16362     v = modfl(nv, &w);
16363 #ifdef __GLIBC__
16364     printf("glibc");
16365 #endif
16366     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
16367     return 0;
16368 }
16369 EOCP
16370         case "$osname:$gccversion" in
16371         aix:)   saveccflags="$ccflags"
16372                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
16373         esac
16374         set try
16375         if eval $compile; then
16376                 foo=`$run ./try`
16377                 case "$foo" in
16378                 *" 4294967303.150000 1.150000 4294967302.000000")
16379                         echo >&4 "Your modfl() is broken for large values."
16380                         d_modfl_pow32_bug="$define"
16381                         case "$foo" in
16382                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
16383                         ;;
16384                         esac
16385                         ;;
16386                 *" 4294967303.150000 0.150000 4294967303.000000")
16387                         echo >&4 "Your modfl() seems okay for large values."
16388                         ;;
16389                 *)      echo >&4 "I don't understand your modfl() at all."
16390                         d_modfl="$undef"
16391                         ;;
16392                 esac
16393                 $rm_try
16394         else
16395                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
16396                 d_modfl="$undef"
16397         fi
16398         case "$osname:$gccversion" in
16399         aix:)   ccflags="$saveccflags" ;; # restore
16400         esac
16401         ;;
16402 esac
16403
16404 if $test "$uselongdouble" = "$define"; then
16405     message=""
16406     if $test "$d_sqrtl" != "$define"; then
16407         message="$message sqrtl"
16408     fi
16409     if $test "$d_modfl" != "$define"; then
16410         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16411             echo "You have both truncl and copysignl, so I can emulate modfl."
16412         else
16413             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16414                 echo "You have both aintl and copysignl, so I can emulate modfl."
16415             else
16416                 message="$message modfl"
16417             fi
16418         fi
16419     fi
16420     if $test "$d_frexpl" != "$define"; then
16421         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16422             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16423         else
16424             message="$message frexpl"
16425         fi
16426     fi
16427     if $test "$d_ldexpl" != "$define"; then
16428         message="$message ldexpl"
16429     fi
16430
16431     if $test "$message" != ""; then
16432         $cat <<EOM >&4
16433
16434 *** You requested the use of long doubles but you do not seem to have
16435 *** the following mathematical functions needed for long double support:
16436 ***    $message
16437 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16438 *** Cannot continue, aborting.
16439
16440 EOM
16441
16442         exit 1
16443     fi
16444 fi
16445
16446 : see if mprotect exists
16447 set mprotect d_mprotect
16448 eval $inlibc
16449
16450 : see if msgctl exists
16451 set msgctl d_msgctl
16452 eval $inlibc
16453
16454 : see if msgget exists
16455 set msgget d_msgget
16456 eval $inlibc
16457
16458 : see if msgsnd exists
16459 set msgsnd d_msgsnd
16460 eval $inlibc
16461
16462 : see if msgrcv exists
16463 set msgrcv d_msgrcv
16464 eval $inlibc
16465
16466 : see how much of the 'msg*(2)' library is present.
16467 h_msg=true
16468 echo " "
16469 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16470 *"$undef"*) h_msg=false;;
16471 esac
16472 case "$osname" in
16473 freebsd)
16474     case "`ipcs 2>&1`" in
16475     "SVID messages"*"not configured"*)
16476         echo "Your $osname does not have the msg*(2) configured." >&4
16477         h_msg=false
16478         val="$undef"
16479         set msgctl d_msgctl
16480         eval $setvar
16481         set msgget d_msgget
16482         eval $setvar
16483         set msgsnd d_msgsnd
16484         eval $setvar
16485         set msgrcv d_msgrcv
16486         eval $setvar
16487         ;;
16488     esac
16489     ;;
16490 esac
16491 : we could also check for sys/ipc.h ...
16492 if $h_msg && $test `./findhdr sys/msg.h`; then
16493         echo "You have the full msg*(2) library." >&4
16494         val="$define"
16495 else
16496         echo "You don't have the full msg*(2) library." >&4
16497         val="$undef"
16498 fi
16499 set d_msg
16500 eval $setvar
16501
16502 : Check for msghdr_s
16503 echo " "
16504 echo "Checking to see if your system supports struct msghdr..." >&4
16505 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16506 eval $hasstruct
16507 case "$d_msghdr_s" in
16508 "$define")      echo "Yes, it does."   ;;
16509 *)              echo "No, it doesn't." ;;
16510 esac
16511
16512
16513 : see if msync exists
16514 set msync d_msync
16515 eval $inlibc
16516
16517 : see if munmap exists
16518 set munmap d_munmap
16519 eval $inlibc
16520
16521 : see if nan exists
16522 set nan d_nan
16523 eval $inlibc
16524
16525 : see if nearbyint exists
16526 set nearbyint d_nearbyint
16527 eval $inlibc
16528
16529 : see if nextafter exists
16530 set nextafter d_nextafter
16531 eval $inlibc
16532
16533 : see if nexttoward exists
16534 set nexttoward d_nexttoward
16535 eval $inlibc
16536
16537 : see if nice exists
16538 set nice d_nice
16539 eval $inlibc
16540
16541 : see if this is a langinfo.h system
16542 set langinfo.h i_langinfo
16543 eval $inhdr
16544
16545 : see if nl_langinfo exists
16546 set nl_langinfo d_nl_langinfo
16547 eval $inlibc
16548
16549 : see if this is a quadmath.h system
16550 set quadmath.h i_quadmath
16551 eval $inhdr
16552
16553 : check for volatile keyword
16554 echo " "
16555 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
16556 $cat >try.c <<'EOCP'
16557 int main()
16558 {
16559         typedef struct _goo_struct goo_struct;
16560         goo_struct * volatile goo = ((goo_struct *)0);
16561         struct _goo_struct {
16562                 long long_int;
16563                 int reg_int;
16564                 char char_var;
16565         };
16566         typedef unsigned short foo_t;
16567         char *volatile foo;
16568         volatile int bar;
16569         volatile foo_t blech;
16570         foo = foo;
16571 }
16572 EOCP
16573 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
16574         val="$define"
16575         echo "Yup, it does."
16576 else
16577         val="$undef"
16578         echo "Nope, it doesn't."
16579 fi
16580 set d_volatile
16581 eval $setvar
16582 $rm_try
16583
16584 : Check basic sizes
16585 echo " "
16586 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16587
16588 case "$use64bitint:$d_quad:$quadtype" in
16589 define:define:?*)
16590         ivtype="$quadtype"
16591         uvtype="$uquadtype"
16592         ivsize=8
16593         uvsize=8
16594         ;;
16595 *)      ivtype="long"
16596         uvtype="unsigned long"
16597         ivsize=$longsize
16598         uvsize=$longsize
16599         ;;
16600 esac
16601
16602 case "$uselongdouble:$d_longdbl" in
16603 define:define)
16604         nvtype="long double"
16605         nvsize=$longdblsize
16606         ;;
16607 *)      nvtype=double
16608         nvsize=$doublesize
16609         ;;
16610 esac
16611
16612 case "$usequadmath:$i_quadmath" in
16613 define:define)
16614   nvtype="__float128"
16615   nvsize=16
16616   case "$libs" in
16617   *quadmath*) ;;
16618   *) $cat <<EOM >&4
16619
16620 *** You requested the use of the quadmath library, but you
16621 *** do not seem to have the quadmath library installed.
16622 *** Cannot continue, aborting.
16623 EOM
16624     exit 1
16625     ;;
16626   esac
16627   ;;
16628 define:*) $cat <<EOM >&4
16629
16630 *** You requested the use of the quadmath library, but you
16631 *** do not seem to have the required header, <quadmath.h>.
16632 EOM
16633   case "$gccversion" in
16634   [23].*|4.[0-5]*)
16635    $cat <<EOM >&4
16636 *** Your gcc looks a bit old:
16637 *** $gccversion
16638 EOM
16639     ;;
16640   '')
16641    $cat <<EOM >&4
16642 *** You are not running a gcc.
16643 EOM
16644     ;;
16645   esac
16646   $cat <<EOM >&4
16647 *** For the quadmath library you need at least gcc 4.6.
16648 *** Cannot continue, aborting.
16649 EOM
16650   exit 1
16651   ;;
16652 esac
16653
16654 $echo "(IV will be "$ivtype", $ivsize bytes)"
16655 $echo "(UV will be "$uvtype", $uvsize bytes)"
16656 $echo "(NV will be "$nvtype", $nvsize bytes)"
16657
16658 $cat >try.c <<EOCP
16659 #$i_inttypes I_INTTYPES
16660 #ifdef I_INTTYPES
16661 #include <inttypes.h>
16662 #endif
16663 #include <stdio.h>
16664 int main() {
16665 #ifdef INT8
16666    int8_t i =  INT8_MAX;
16667   uint8_t u = UINT8_MAX;
16668   printf("int8_t\n");
16669 #endif
16670 #ifdef INT16
16671    int16_t i =  INT16_MAX;
16672   uint16_t u = UINT16_MAX;
16673   printf("int16_t\n");
16674 #endif
16675 #ifdef INT32
16676    int32_t i =  INT32_MAX;
16677   uint32_t u = UINT32_MAX;
16678   printf("int32_t\n");
16679 #endif
16680 }
16681 EOCP
16682
16683 i8type="signed char"
16684 u8type="unsigned char"
16685 i8size=1
16686 u8size=1
16687
16688 case "$i16type" in
16689 '')     case "$shortsize" in
16690         2)      i16type=short
16691                 u16type="unsigned short"
16692                 i16size=$shortsize
16693                 u16size=$shortsize
16694                 ;;
16695         esac
16696         ;;
16697 esac
16698 case "$i16type" in
16699 '')     set try -DINT16
16700         if eval $compile; then
16701                 case "`$run ./try`" in
16702                 int16_t)
16703                         i16type=int16_t
16704                         u16type=uint16_t
16705                         i16size=2
16706                         u16size=2
16707                         ;;
16708                 esac
16709         fi
16710         ;;
16711 esac
16712 case "$i16type" in
16713 '')     if $test $shortsize -ge 2; then
16714                 i16type=short
16715                 u16type="unsigned short"
16716                 i16size=$shortsize
16717                 u16size=$shortsize
16718         fi
16719         ;;
16720 esac
16721
16722 case "$i32type" in
16723 '')     case "$longsize" in
16724         4)      i32type=long
16725                 u32type="unsigned long"
16726                 i32size=$longsize
16727                 u32size=$longsize
16728                 ;;
16729         *)      case "$intsize" in
16730                 4)      i32type=int
16731                         u32type="unsigned int"
16732                         i32size=$intsize
16733                         u32size=$intsize
16734                         ;;
16735                 esac
16736                 ;;
16737         esac
16738         ;;
16739 esac
16740 case "$i32type" in
16741 '')     set try -DINT32
16742         if eval $compile; then
16743                 case "`$run ./try`" in
16744                 int32_t)
16745                         i32type=int32_t
16746                         u32type=uint32_t
16747                         i32size=4
16748                         u32size=4
16749                         ;;
16750                 esac
16751         fi
16752         ;;
16753 esac
16754 case "$i32type" in
16755 '')     if $test $intsize -ge 4; then
16756                 i32type=int
16757                 u32type="unsigned int"
16758                 i32size=$intsize
16759                 u32size=$intsize
16760         fi
16761         ;;
16762 esac
16763
16764 case "$i64type" in
16765 '')     case "$d_quad:$quadtype" in
16766         define:?*)
16767                 i64type="$quadtype"
16768                 u64type="$uquadtype"
16769                 i64size=8
16770                 u64size=8
16771                 ;;
16772         esac
16773         ;;
16774 esac
16775
16776 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16777 : volatile so that the compiler has to store it out to memory.
16778 if test X"$d_volatile" = X"$define"; then
16779         volatile=volatile
16780 fi
16781 $cat <<EOP >try.c
16782 #include <stdio.h>
16783 #$i_stdlib I_STDLIB
16784 #ifdef I_STDLIB
16785 #include <stdlib.h>
16786 #endif
16787 #include <sys/types.h>
16788 #include <signal.h>
16789 #ifdef SIGFPE
16790 $volatile int bletched = 0;
16791 $signal_t blech(int s) { bletched = 1; }
16792 #endif
16793 int main() {
16794     $uvtype u = 0;
16795     $nvtype d;
16796     int     n = 8 * $uvsize;
16797     int     i;
16798 #ifdef SIGFPE
16799     signal(SIGFPE, blech);
16800 #endif
16801
16802     for (i = 0; i < n; i++) {
16803       u = u << 1 | ($uvtype)1;
16804       d = ($nvtype)u;
16805       if (($uvtype)d != u)
16806         break;
16807       if (d <= 0)
16808         break;
16809       d = ($nvtype)(u - 1);
16810       if (($uvtype)d != (u - 1))
16811         break;
16812 #ifdef SIGFPE
16813       if (bletched)
16814         break;
16815 #endif
16816     }
16817     printf("%d\n", ((i == n) ? -n : i));
16818     exit(0);
16819 }
16820 EOP
16821 set try
16822
16823 d_nv_preserves_uv="$undef"
16824 if eval $compile; then
16825         nv_preserves_uv_bits="`$run ./try`"
16826 fi
16827 case "$nv_preserves_uv_bits" in
16828 \-[1-9]*)
16829         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16830         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16831         d_nv_preserves_uv="$define"
16832         ;;
16833 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16834         d_nv_preserves_uv="$undef" ;;
16835 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16836         nv_preserves_uv_bits="0" ;;
16837 esac
16838 $rm_try
16839
16840 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16841 : volatile so that the compiler has to store it out to memory.
16842 if test X"$d_volatile" = X"$define"; then
16843         volatile=volatile
16844 fi
16845 $cat <<EOP >try.c
16846 #include <stdio.h>
16847
16848 typedef $nvtype NV;
16849
16850 int
16851 main() {
16852   NV value = 2;
16853   int count = 1;
16854
16855   while(count < 256) {
16856     $volatile NV up = value + 1.0;
16857     $volatile NV negated = -value;
16858     $volatile NV down = negated - 1.0;
16859     $volatile NV got_up = up - value;
16860     int up_good = got_up == 1.0;
16861     int got_down = down - negated;
16862     int down_good = got_down == -1.0;
16863
16864     if (down_good != up_good) {
16865       fprintf(stderr,
16866               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16867               up_good, (double) got_up, down_good, (double) got_down,
16868               count, (double) value);
16869       return 1;
16870     }
16871     if (!up_good) {
16872       while (1) {
16873         if (count > 8) {
16874           count -= 8;
16875           fputs("256.0", stdout);
16876         } else {
16877           count--;
16878           fputs("2.0", stdout);
16879         }
16880         if (!count) {
16881           puts("");
16882           return 0;
16883         }
16884         fputs("*", stdout);
16885       }
16886     }
16887     value *= 2;
16888     ++count;
16889   }
16890   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16891           count, (double) value);
16892   return 1;
16893 }
16894 EOP
16895 set try
16896
16897 nv_overflows_integers_at='0'
16898 if eval $compile; then
16899     xxx="`$run ./try`"
16900     case "$?" in
16901         0)
16902             case "$xxx" in
16903                 2*)  cat >&4 <<EOM
16904 The largest integer your NVs can preserve is equal to $xxx
16905 EOM
16906                     nv_overflows_integers_at="$xxx"
16907                     ;;
16908                 *)  cat >&4 <<EOM
16909 Cannot determine the largest integer value your NVs can hold, unexpected output
16910 '$xxx'
16911 EOM
16912                     ;;
16913             esac
16914             ;;
16915         *)  cat >&4 <<EOM
16916 Cannot determine the largest integer value your NVs can hold
16917 EOM
16918             ;;
16919     esac
16920 fi
16921 $rm_try
16922
16923 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16924 : volatile so that the compiler has to store it out to memory.
16925 if test X"$d_volatile" = X"$define"; then
16926         volatile=volatile
16927 fi
16928 $cat <<EOP >try.c
16929 #include <stdio.h>
16930 #$i_stdlib I_STDLIB
16931 #ifdef I_STDLIB
16932 #include <stdlib.h>
16933 #endif
16934 #$i_string I_STRING
16935 #ifdef I_STRING
16936 #  include <string.h>
16937 #else
16938 #  include <strings.h>
16939 #endif
16940 #include <sys/types.h>
16941 #include <signal.h>
16942 #ifdef SIGFPE
16943 $volatile int bletched = 0;
16944 $signal_t blech(int s) { bletched = 1; }
16945 #endif
16946
16947 int checkit($nvtype d, char *where) {
16948     unsigned char *p = (char *)&d;
16949     unsigned char *end = p + sizeof(d);
16950     int fail = 0;
16951
16952     while (p < end)
16953         fail += *p++;
16954
16955     if (!fail)
16956         return 0;
16957
16958     p = (char *)&d;
16959     printf("No - %s: 0x", where);
16960     while (p < end)
16961         printf ("%02X", *p++);
16962     printf("\n");
16963     return 1;
16964 }
16965
16966 int main(int argc, char **argv) {
16967     $nvtype d = 0.0;
16968     int fail = 0;
16969     fail += checkit(d, "0.0");
16970
16971     /* The compiler shouldn't be assuming that bletched is 0  */
16972     d = bletched;
16973
16974     fail += checkit(d, "bleched");
16975
16976 #ifdef SIGFPE
16977     signal(SIGFPE, blech);
16978 #endif
16979
16980     /* Paranoia - the compiler should have no way of knowing that ANSI says
16981        that argv[argc] will always be NULL.  Actually, if it did assume this it
16982        would be buggy, as this is C and main() can be called from elsewhere in
16983        the program.  */
16984     d = argv[argc] ? 1 : 0;
16985
16986     if (d) {
16987         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16988     }
16989
16990     fail += checkit(d, "ternary");
16991
16992     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16993
16994     if (d != 0.0) {
16995         printf("No - memset doesn't give 0.0\n");
16996         /* This might just blow up:  */
16997         printf("(gives %g)\n", d);
16998         return 1;
16999     }
17000
17001 #ifdef SIGFPE
17002     if (bletched) {
17003         printf("No - something bleched\n");
17004         return 1;
17005     }
17006 #endif
17007     if (fail) {
17008       printf("No - %d fail(s)\n", fail);
17009       return 1;
17010     }
17011     printf("Yes\n");
17012     return 0;
17013 }
17014 EOP
17015 set try
17016
17017 d_nv_zero_is_allbits_zero="$undef"
17018 if eval $compile; then
17019     xxx="`$run ./try`"
17020     case "$?" in
17021         0)
17022             case "$xxx" in
17023                 Yes)  cat >&4 <<EOM
17024 0.0 is represented as all bits zero in memory
17025 EOM
17026                     d_nv_zero_is_allbits_zero="$define"
17027                     ;;
17028                 *)  cat >&4 <<EOM
17029 0.0 is not represented as all bits zero in memory
17030 EOM
17031                     d_nv_zero_is_allbits_zero="$undef"
17032                     ;;
17033             esac
17034             ;;
17035         *)  cat >&4 <<EOM
17036 0.0 is not represented as all bits zero in memory
17037 EOM
17038             d_nv_zero_is_allbits_zero="$undef"
17039             ;;
17040     esac
17041 fi
17042 $rm_try
17043
17044 : check for off64_t
17045 echo " "
17046 echo "Checking to see if you have off64_t..." >&4
17047 $cat >try.c <<EOCP
17048 #include <sys/types.h>
17049 #include <unistd.h>
17050 int main() { off64_t x = 7; }
17051 EOCP
17052 set try
17053 if eval $compile; then
17054         val="$define"
17055         echo "You have off64_t."
17056 else
17057         val="$undef"
17058         echo "You do not have off64_t."
17059         case "$lseeksize" in
17060         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
17061         esac
17062 fi
17063 $rm_try
17064 set d_off64_t
17065 eval $setvar
17066
17067 : how to create joinable pthreads
17068 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
17069         echo " "
17070         echo "Checking what constant to use for creating joinable pthreads..." >&4
17071         $cat >try.c <<'EOCP'
17072 #include <pthread.h>
17073 int main() {
17074     int detachstate = JOINABLE;
17075 }
17076 EOCP
17077         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
17078         if eval $compile; then
17079                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
17080                 val="$undef" # Yes, undef.
17081                 set d_old_pthread_create_joinable
17082                 eval $setvar
17083                 val=""
17084                 set old_pthread_create_joinable
17085                 eval $setvar
17086         else
17087                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
17088                 if eval $compile; then
17089                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
17090                         val="$define"
17091                         set d_old_pthread_create_joinable
17092                         eval $setvar
17093                         val=PTHREAD_CREATE_UNDETACHED
17094                         set old_pthread_create_joinable
17095                         eval $setvar
17096                 else
17097                         set try -DJOINABLE=__UNDETACHED
17098                         if eval $compile; then
17099                                 echo "You seem to use __UNDETACHED." >&4
17100                                 val="$define"
17101                                 set d_old_pthread_create_joinable
17102                                 eval $setvar
17103                                 val=__UNDETACHED
17104                                 set old_pthread_create_joinable
17105                                 eval $setvar
17106                         else
17107                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
17108                                 val="$define"
17109                                 set d_old_pthread_create_joinable
17110                                 eval $setvar
17111                                 val=0
17112                                 set old_pthread_create_joinable
17113                                 eval $setvar
17114                         fi
17115                 fi
17116         fi
17117         $rm_try
17118 else
17119     d_old_pthread_create_joinable="$undef"
17120     old_pthread_create_joinable=""
17121 fi
17122
17123 : see if pause exists
17124 set pause d_pause
17125 eval $inlibc
17126
17127 : see if poll exists
17128 set poll d_poll
17129 eval $inlibc
17130
17131 : see if prctl exists
17132 set prctl d_prctl
17133 eval $inlibc
17134
17135 : see if prctl supports PR_SET_NAME
17136 d_prctl_set_name=$undef
17137 case $d_prctl in
17138     $define)
17139         $cat >try.c <<EOM
17140 #ifdef __ANDROID__
17141 #include <unistd.h>
17142 #endif
17143 #include <sys/prctl.h>
17144
17145 int main (int argc, char *argv[])
17146 {
17147     return (prctl (PR_SET_NAME, "Test"));
17148     } /* main */
17149 EOM
17150         set try
17151         if eval $compile_ok && $run ./try; then
17152             echo "Your prctl (PR_SET_NAME, ...) works"
17153             d_prctl_set_name=$define
17154             fi
17155         $rm_try
17156         ;;
17157     esac
17158
17159 : see if readlink exists
17160 set readlink d_readlink
17161 eval $inlibc
17162
17163 : Check if exe is symlink to abs path of executing program
17164 echo " "
17165 procselfexe=''
17166 val="$undef"
17167 case "$d_procselfexe" in
17168 '')
17169 case "$d_readlink" in
17170     "$define")
17171         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
17172         : more tidy to avoid an extra level of symlink
17173         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17174         while test $# -gt 0; do
17175             type=$1; try=$2
17176             shift; shift
17177             if $issymlink $try; then
17178                 $ls -l $try > reflect
17179                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17180                     echo "You have $type-like $try."
17181                     procselfexe='"'$try'"'
17182                     val="$define"
17183                     : This will break out of the loop
17184                     set X; shift
17185                 fi
17186             fi
17187         done
17188         ;;
17189 esac
17190 $rm -f reflect
17191 set d_procselfexe
17192 eval $setvar
17193 ;;
17194 esac
17195
17196 : backward compatibility for d_hvfork
17197 if test X$d_hvfork != X; then
17198         d_vfork="$d_hvfork"
17199         d_hvfork=''
17200 fi
17201 : see if there is a vfork
17202 val=''
17203 set vfork val
17204 eval $inlibc
17205
17206 d_pseudofork=$undef
17207
17208 : Ok, but do we want to use it. vfork is reportedly unreliable in
17209 : perl on Solaris 2.x, and probably elsewhere.
17210 case "$val" in
17211 $define)
17212         echo " "
17213         case "$usevfork" in
17214         false) dflt='n';;
17215         *) dflt='y';;
17216         esac
17217         cat <<'EOM'
17218
17219 Perl can only use a vfork() that doesn't suffer from strict
17220 restrictions on calling functions or modifying global data in
17221 the child.  For example, glibc-2.1 contains such a vfork()
17222 that is unsuitable.  If your system provides a proper fork()
17223 call, chances are that you do NOT want perl to use vfork().
17224
17225 EOM
17226         rp="Do you still want to use vfork()?"
17227         . ./myread
17228         case "$ans" in
17229         y|Y) ;;
17230         *)
17231                 echo "Ok, we won't use vfork()."
17232                 val="$undef"
17233                 ;;
17234         esac
17235         ;;
17236 esac
17237 set d_vfork
17238 eval $setvar
17239 case "$d_vfork" in
17240 $define) usevfork='true';;
17241 *) usevfork='false';;
17242 esac
17243
17244 : see whether the pthread_atfork exists
17245 $cat >try.c <<EOP
17246 #include <pthread.h>
17247 #include <stdio.h>
17248 int main() {
17249 #ifdef  PTHREAD_ATFORK
17250         pthread_atfork(NULL,NULL,NULL);
17251 #endif
17252 }
17253 EOP
17254
17255 : see if pthread_atfork exists
17256 set try -DPTHREAD_ATFORK
17257 if eval $compile; then
17258     val="$define"
17259 else
17260     val="$undef"
17261 fi
17262 case "$usethreads" in
17263 $define)
17264         case "$val" in
17265         $define) echo 'pthread_atfork found.' >&4        ;;
17266         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17267         esac
17268 esac
17269 set d_pthread_atfork
17270 eval $setvar
17271
17272 : see if pthread_attr_setscope exists
17273 set pthread_attr_setscope d_pthread_attr_setscope
17274 eval $inlibc
17275
17276 : see whether the various POSIXish _yields exist
17277 $cat >try.c <<EOP
17278 #include <pthread.h>
17279 #include <stdio.h>
17280 int main() {
17281 #ifdef SCHED_YIELD
17282         sched_yield();
17283 #else
17284 #ifdef PTHREAD_YIELD
17285         pthread_yield();
17286 #else
17287 #ifdef PTHREAD_YIELD_NULL
17288         pthread_yield(NULL);
17289 #endif
17290 #endif
17291 #endif
17292 }
17293 EOP
17294 : see if sched_yield exists
17295 set try -DSCHED_YIELD
17296 if eval $compile; then
17297     val="$define"
17298     sched_yield='sched_yield()'
17299 else
17300     val="$undef"
17301 fi
17302 case "$usethreads" in
17303 $define)
17304         case "$val" in
17305         $define) echo 'sched_yield() found.' >&4        ;;
17306         *)       echo 'sched_yield() NOT found.' >&4    ;;
17307         esac
17308 esac
17309 set d_sched_yield
17310 eval $setvar
17311
17312 : see if pthread_yield exists
17313 set try -DPTHREAD_YIELD
17314 if eval $compile; then
17315     val="$define"
17316     case "$sched_yield" in
17317     '') sched_yield='pthread_yield()' ;;
17318     esac
17319 else
17320     set try -DPTHREAD_YIELD_NULL
17321     if eval $compile; then
17322         val="$define"
17323         case "$sched_yield" in
17324         '') sched_yield='pthread_yield(NULL)' ;;
17325         esac
17326     else
17327         val="$undef"
17328     fi
17329 fi
17330 case "$usethreads" in
17331 $define)
17332         case "$val" in
17333         $define) echo 'pthread_yield() found.' >&4      ;;
17334         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17335         esac
17336         ;;
17337 esac
17338 set d_pthread_yield
17339 eval $setvar
17340 case "$sched_yield" in
17341 '') sched_yield=undef ;;
17342 esac
17343 $rm_try
17344
17345 : check for ptrdiff_t
17346 echo " "
17347 echo "Checking to see if you have ptrdiff_t..." >&4
17348 $cat >try.c <<EOCP
17349 #include <stddef.h>
17350 int main() { ptrdiff_t x = 7; }
17351 EOCP
17352 set try
17353 if eval $compile; then
17354         val="$define"
17355         echo "You have ptrdiff_t."
17356 else
17357         val="$undef"
17358         echo "You do not have ptrdiff_t."
17359 fi
17360 $rm_try
17361 set d_ptrdiff_t
17362 eval $setvar
17363
17364 : see if random_r exists
17365 set random_r d_random_r
17366 eval $inlibc
17367 case "$d_random_r" in
17368 "$define")
17369         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17370         case "$d_random_r_proto:$usethreads" in
17371         ":define")      d_random_r_proto=define
17372                 set d_random_r_proto random_r $hdrs
17373                 eval $hasproto ;;
17374         *)      ;;
17375         esac
17376         case "$d_random_r_proto" in
17377         define)
17378         case "$random_r_proto" in
17379         ''|0) try='int random_r(int*, struct random_data*);'
17380         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17381         esac
17382         case "$random_r_proto" in
17383         ''|0) try='int random_r(long*, struct random_data*);'
17384         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17385         esac
17386         case "$random_r_proto" in
17387         ''|0) try='int random_r(struct random_data*, int32_t*);'
17388         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17389         esac
17390         case "$random_r_proto" in
17391         ''|0)   d_random_r=undef
17392                 random_r_proto=0
17393                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17394         * )     case "$random_r_proto" in
17395                 REENTRANT_PROTO*) ;;
17396                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17397                 esac
17398                 echo "Prototype: $try" ;;
17399         esac
17400         ;;
17401         *)      case "$usethreads" in
17402                 define) echo "random_r has no prototype, not using it." >&4 ;;
17403                 esac
17404                 d_random_r=undef
17405                 random_r_proto=0
17406                 ;;
17407         esac
17408         ;;
17409 *)      random_r_proto=0
17410         ;;
17411 esac
17412
17413 : see if readdir and friends exist
17414 set readdir d_readdir
17415 eval $inlibc
17416 set seekdir d_seekdir
17417 eval $inlibc
17418 set telldir d_telldir
17419 eval $inlibc
17420 set rewinddir d_rewinddir
17421 eval $inlibc
17422
17423 : see if readdir64_r exists
17424 set readdir64_r d_readdir64_r
17425 eval $inlibc
17426 case "$d_readdir64_r" in
17427 "$define")
17428         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17429         case "$d_readdir64_r_proto:$usethreads" in
17430         ":define")      d_readdir64_r_proto=define
17431                 set d_readdir64_r_proto readdir64_r $hdrs
17432                 eval $hasproto ;;
17433         *)      ;;
17434         esac
17435         case "$d_readdir64_r_proto" in
17436         define)
17437         case "$readdir64_r_proto" in
17438         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17439         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17440         esac
17441         case "$readdir64_r_proto" in
17442         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17443         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17444         esac
17445         case "$readdir64_r_proto" in
17446         ''|0)   d_readdir64_r=undef
17447                 readdir64_r_proto=0
17448                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17449         * )     case "$readdir64_r_proto" in
17450                 REENTRANT_PROTO*) ;;
17451                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17452                 esac
17453                 echo "Prototype: $try" ;;
17454         esac
17455         ;;
17456         *)      case "$usethreads" in
17457                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17458                 esac
17459                 d_readdir64_r=undef
17460                 readdir64_r_proto=0
17461                 ;;
17462         esac
17463         ;;
17464 *)      readdir64_r_proto=0
17465         ;;
17466 esac
17467
17468 : see if readdir_r exists
17469 set readdir_r d_readdir_r
17470 eval $inlibc
17471 case "$d_readdir_r" in
17472 "$define")
17473         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17474         case "$d_readdir_r_proto:$usethreads" in
17475         ":define")      d_readdir_r_proto=define
17476                 set d_readdir_r_proto readdir_r $hdrs
17477                 eval $hasproto ;;
17478         *)      ;;
17479         esac
17480         case "$d_readdir_r_proto" in
17481         define)
17482         case "$readdir_r_proto" in
17483         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17484         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17485         esac
17486         case "$readdir_r_proto" in
17487         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17488         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17489         esac
17490         case "$readdir_r_proto" in
17491         ''|0)   d_readdir_r=undef
17492                 readdir_r_proto=0
17493                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17494         * )     case "$readdir_r_proto" in
17495                 REENTRANT_PROTO*) ;;
17496                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17497                 esac
17498                 echo "Prototype: $try" ;;
17499         esac
17500         ;;
17501         *)      case "$usethreads" in
17502                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17503                 esac
17504                 d_readdir_r=undef
17505                 readdir_r_proto=0
17506                 ;;
17507         esac
17508         ;;
17509 *)      readdir_r_proto=0
17510         ;;
17511 esac
17512
17513 : see if readv exists
17514 set readv d_readv
17515 eval $inlibc
17516
17517 : see if recvmsg exists
17518 set recvmsg d_recvmsg
17519 eval $inlibc
17520
17521 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17522 echo " "
17523 if set regcomp val -f d_regcomp; eval $csym; $val; then
17524         echo 'regcomp() found.' >&4
17525         d_regcomp="$define"
17526         d_regcmp="$undef"
17527         d_re_comp="$undef"
17528 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17529         echo 'regcmp() found.' >&4
17530         d_regcmp="$define"
17531         d_regcomp="$undef"
17532         d_re_comp="$undef"
17533 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17534         echo 're_comp() found, assuming re_exec() also exists.' >&4
17535         d_re_comp="$define"
17536         d_regcomp="$undef"
17537         d_regcmp="$undef"
17538 else
17539         $cat >&4 <<EOM
17540 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17541 EOM
17542         d_regcmp="$undef"
17543         d_re_comp="$undef"
17544         d_regcomp="$undef"
17545 fi
17546
17547 : see if remainder exists
17548 set remainder d_remainder
17549 eval $inlibc
17550
17551 : see if remquo exists
17552 set remquo d_remquo
17553 eval $inlibc
17554
17555 : see if rename exists
17556 set rename d_rename
17557 eval $inlibc
17558
17559 : see if rint exists
17560 set rint d_rint
17561 eval $inlibc
17562
17563 : see if rmdir exists
17564 set rmdir d_rmdir
17565 eval $inlibc
17566
17567 : see if round exists
17568 set round d_round
17569 eval $inlibc
17570
17571 : see if memory.h is available.
17572 val=''
17573 set memory.h val
17574 eval $inhdr
17575
17576 : See if it conflicts with string.h
17577 case "$val" in
17578 $define)
17579         case "$strings" in
17580         '') ;;
17581         *)
17582                 $cppstdin $cppflags $cppminus < $strings > mem.h
17583                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
17584                         echo " "
17585                         echo "We won't be including <memory.h>."
17586                         val="$undef"
17587                 fi
17588                 $rm -f mem.h
17589                 ;;
17590         esac
17591 esac
17592 set i_memory
17593 eval $setvar
17594
17595 : can bcopy handle overlapping blocks?
17596 echo " "
17597 val="$undef"
17598 case "$d_memmove" in
17599 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
17600 *)      case "$d_bcopy" in
17601         "$define")
17602                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
17603                 $cat >try.c <<EOCP
17604 #$i_memory I_MEMORY
17605 #$i_stdlib I_STDLIB
17606 #$i_string I_STRING
17607 #$i_unistd I_UNISTD
17608 EOCP
17609         $cat >>try.c <<'EOCP'
17610 #include <stdio.h>
17611 #ifdef I_MEMORY
17612 #  include <memory.h>
17613 #endif
17614 #ifdef I_STDLIB
17615 #  include <stdlib.h>
17616 #endif
17617 #ifdef I_STRING
17618 #  include <string.h>
17619 #else
17620 #  include <strings.h>
17621 #endif
17622 #ifdef I_UNISTD
17623 #  include <unistd.h>  /* Needed for NetBSD */
17624 #endif
17625 int main()
17626 {
17627 char buf[128], abc[128];
17628 char *b;
17629 int len;
17630 int off;
17631 int align;
17632
17633 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17634    try to store the string in read-only memory. */
17635 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
17636
17637 for (align = 7; align >= 0; align--) {
17638         for (len = 36; len; len--) {
17639                 b = buf+align;
17640                 bcopy(abc, b, len);
17641                 for (off = 1; off <= len; off++) {
17642                         bcopy(b, b+off, len);
17643                         bcopy(b+off, b, len);
17644                         if (bcmp(b, abc, len))
17645                                 exit(1);
17646                 }
17647         }
17648 }
17649 exit(0);
17650 }
17651 EOCP
17652                 set try
17653                 if eval $compile_ok; then
17654                         if $run ./try 2>/dev/null; then
17655                                 echo "Yes, it can."
17656                                 val="$define"
17657                         else
17658                                 echo "It can't, sorry."
17659                         fi
17660                 else
17661                         echo "(I can't compile the test program, so we'll assume not...)"
17662                 fi
17663                 ;;
17664         esac
17665         $rm_try
17666         ;;
17667 esac
17668 set d_safebcpy
17669 eval $setvar
17670
17671 : can memcpy handle overlapping blocks?
17672 echo " "
17673 val="$undef"
17674 case "$d_memmove" in
17675 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
17676 *)      case "$d_memcpy" in
17677         "$define")
17678                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
17679                 $cat >try.c <<EOCP
17680 #$i_memory I_MEMORY
17681 #$i_stdlib I_STDLIB
17682 #$i_string I_STRING
17683 #$i_unistd I_UNISTD
17684 EOCP
17685         $cat >>try.c <<'EOCP'
17686 #include <stdio.h>
17687 #ifdef I_MEMORY
17688 #  include <memory.h>
17689 #endif
17690 #ifdef I_STDLIB
17691 #  include <stdlib.h>
17692 #endif
17693 #ifdef I_STRING
17694 #  include <string.h>
17695 #else
17696 #  include <strings.h>
17697 #endif
17698 #ifdef I_UNISTD
17699 #  include <unistd.h>  /* Needed for NetBSD */
17700 #endif
17701 int main()
17702 {
17703 char buf[128], abc[128];
17704 char *b;
17705 int len;
17706 int off;
17707 int align;
17708
17709 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17710    try to store the string in read-only memory. */
17711 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
17712
17713 for (align = 7; align >= 0; align--) {
17714         for (len = 36; len; len--) {
17715                 b = buf+align;
17716                 memcpy(b, abc, len);
17717                 for (off = 1; off <= len; off++) {
17718                         memcpy(b+off, b, len);
17719                         memcpy(b, b+off, len);
17720                         if (memcmp(b, abc, len))
17721                                 exit(1);
17722                 }
17723         }
17724 }
17725 exit(0);
17726 }
17727 EOCP
17728                 set try
17729                 if eval $compile_ok; then
17730                         if $run ./try 2>/dev/null; then
17731                                 echo "Yes, it can."
17732                                 val="$define"
17733                         else
17734                                 echo "It can't, sorry."
17735                         fi
17736                 else
17737                         echo "(I can't compile the test program, so we'll assume not...)"
17738                 fi
17739                 ;;
17740         esac
17741         $rm_try
17742         ;;
17743 esac
17744 set d_safemcpy
17745 eval $setvar
17746
17747 : can memcmp be trusted to compare relative magnitude?
17748 val="$undef"
17749 case "$d_memcmp" in
17750 "$define")
17751         echo " "
17752         echo "Checking if your memcmp() can compare relative magnitude..." >&4
17753         $cat >try.c <<EOCP
17754 #$i_memory I_MEMORY
17755 #$i_stdlib I_STDLIB
17756 #$i_string I_STRING
17757 #$i_unistd I_UNISTD
17758 EOCP
17759         $cat >>try.c <<'EOCP'
17760 #include <stdio.h>
17761 #ifdef I_MEMORY
17762 #  include <memory.h>
17763 #endif
17764 #ifdef I_STDLIB
17765 #  include <stdlib.h>
17766 #endif
17767 #ifdef I_STRING
17768 #  include <string.h>
17769 #else
17770 #  include <strings.h>
17771 #endif
17772 #ifdef I_UNISTD
17773 #  include <unistd.h>  /* Needed for NetBSD */
17774 #endif
17775 int main()
17776 {
17777 char a = -1;
17778 char b = 0;
17779 if ((a < b) && memcmp(&a, &b, 1) < 0)
17780         exit(1);
17781 exit(0);
17782 }
17783 EOCP
17784         set try
17785         if eval $compile_ok; then
17786                 if $run ./try 2>/dev/null; then
17787                         echo "Yes, it can."
17788                         val="$define"
17789                 else
17790                         echo "No, it can't (it uses signed chars)."
17791                 fi
17792         else
17793                 echo "(I can't compile the test program, so we'll assume not...)"
17794         fi
17795         ;;
17796 esac
17797 $rm_try
17798 set d_sanemcmp
17799 eval $setvar
17800
17801 : see if prototype for sbrk is available
17802 echo " "
17803 set d_sbrkproto sbrk $i_unistd unistd.h
17804 eval $hasproto
17805
17806 : see if scalbn exists
17807 set scalbn d_scalbn
17808 eval $inlibc
17809
17810 : see if select exists
17811 set select d_select
17812 eval $inlibc
17813
17814 : see if semctl exists
17815 set semctl d_semctl
17816 eval $inlibc
17817
17818 : see if semget exists
17819 set semget d_semget
17820 eval $inlibc
17821
17822 : see if semop exists
17823 set semop d_semop
17824 eval $inlibc
17825
17826 : see how much of the 'sem*(2)' library is present.
17827 h_sem=true
17828 echo " "
17829 case "$d_semctl$d_semget$d_semop" in
17830 *"$undef"*) h_sem=false;;
17831 esac
17832 case "$osname" in
17833 freebsd)
17834     case "`ipcs 2>&1`" in
17835     "SVID messages"*"not configured"*)
17836         echo "Your $osname does not have the sem*(2) configured." >&4
17837         h_sem=false
17838         val="$undef"
17839         set semctl d_semctl
17840         eval $setvar
17841         set semget d_semget
17842         eval $setvar
17843         set semop d_semop
17844         eval $setvar
17845         ;;
17846     esac
17847     ;;
17848 esac
17849 : we could also check for sys/ipc.h ...
17850 if $h_sem && $test `./findhdr sys/sem.h`; then
17851         echo "You have the full sem*(2) library." >&4
17852         val="$define"
17853 else
17854         echo "You don't have the full sem*(2) library." >&4
17855         val="$undef"
17856 fi
17857 set d_sem
17858 eval $setvar
17859
17860 : see whether sys/sem.h defines union semun
17861 echo " "
17862 $cat > try.c <<'END'
17863 #include <sys/types.h>
17864 #include <sys/ipc.h>
17865 #include <sys/sem.h>
17866 int main () { union semun semun; semun.buf = 0; }
17867 END
17868 set try
17869 if eval $compile; then
17870     echo "You have union semun in <sys/sem.h>." >&4
17871     val="$define"
17872 else
17873     echo "You do not have union semun in <sys/sem.h>." >&4
17874     val="$undef"
17875 fi
17876 $rm_try
17877 set d_union_semun
17878 eval $setvar
17879
17880 : see how to do semctl IPC_STAT
17881 case "$d_sem" in
17882 $define)
17883     echo " "
17884     $cat > tryh.h <<END
17885 #ifndef S_IRUSR
17886 #   ifdef S_IREAD
17887 #       define S_IRUSR S_IREAD
17888 #       define S_IWUSR S_IWRITE
17889 #       define S_IXUSR S_IEXEC
17890 #   else
17891 #       define S_IRUSR 0400
17892 #       define S_IWUSR 0200
17893 #       define S_IXUSR 0100
17894 #   endif
17895 #   define S_IRGRP (S_IRUSR>>3)
17896 #   define S_IWGRP (S_IWUSR>>3)
17897 #   define S_IXGRP (S_IXUSR>>3)
17898 #   define S_IROTH (S_IRUSR>>6)
17899 #   define S_IWOTH (S_IWUSR>>6)
17900 #   define S_IXOTH (S_IXUSR>>6)
17901 #endif
17902 #ifndef S_IRWXU
17903 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17904 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17905 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17906 #endif
17907 END
17908     : see whether semctl IPC_STAT can use union semun
17909     case "$d_semctl_semun" in
17910     '')
17911       val="$undef"
17912       $cat > try.c <<END
17913 #include <sys/types.h>
17914 #include <sys/ipc.h>
17915 #include <sys/sem.h>
17916 #include <sys/stat.h>
17917 #include <stdio.h>
17918 #include <errno.h>
17919 #include "tryh.h"
17920 #ifndef errno
17921 extern int errno;
17922 #endif
17923 #$d_union_semun HAS_UNION_SEMUN
17924 int main() {
17925     union semun
17926 #ifndef HAS_UNION_SEMUN
17927     {
17928         int val;
17929         struct semid_ds *buf;
17930         unsigned short *array;
17931     }
17932 #endif
17933     arg;
17934     int sem, st;
17935
17936 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17937     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17938     if (sem > -1) {
17939         struct semid_ds argbuf;
17940         arg.buf = &argbuf;
17941 #       ifdef IPC_STAT
17942         st = semctl(sem, 0, IPC_STAT, arg);
17943         if (st == 0)
17944             printf("semun\n");
17945         else
17946 #       endif /* IPC_STAT */
17947             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17948 #       ifdef IPC_RMID
17949         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17950 #       endif /* IPC_RMID */
17951             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17952     } else
17953 #endif /* IPC_PRIVATE && ... */
17954         printf("semget failed: errno = %d\n", errno);
17955   return 0;
17956 }
17957 END
17958       set try
17959       if eval $compile; then
17960           xxx=`$run ./try`
17961           case "$xxx" in
17962           semun) val="$define" ;;
17963           esac
17964       fi
17965       $rm_try
17966       set d_semctl_semun
17967       eval $setvar
17968       ;;
17969     esac
17970     case "$d_semctl_semun" in
17971     $define)
17972         echo "You can use union semun for semctl IPC_STAT." >&4
17973         also='also'
17974         ;;
17975     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17976         also=''
17977         ;;
17978     esac
17979
17980     : see whether semctl IPC_STAT can use struct semid_ds pointer
17981     case "$d_semctl_semid_ds" in
17982     '')
17983       val="$undef"
17984       $cat > try.c <<'END'
17985 #include <sys/types.h>
17986 #include <sys/ipc.h>
17987 #include <sys/sem.h>
17988 #include <sys/stat.h>
17989 #include "tryh.h"
17990 #include <stdio.h>
17991 #include <errno.h>
17992 #ifndef errno
17993 extern int errno;
17994 #endif
17995 int main() {
17996     struct semid_ds arg;
17997     int sem, st;
17998
17999 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
18000     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18001     if (sem > -1) {
18002 #       ifdef IPC_STAT
18003         st = semctl(sem, 0, IPC_STAT, &arg);
18004         if (st == 0)
18005             printf("semid_ds\n");
18006         else
18007 #       endif /* IPC_STAT */
18008             printf("semctl IPC_STAT failed: errno = %d\n", errno);
18009 #       ifdef IPC_RMID
18010         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
18011 #       endif /* IPC_RMID */
18012             printf("semctl IPC_RMID failed: errno = %d\n", errno);
18013     } else
18014 #endif /* IPC_PRIVATE && ... */
18015         printf("semget failed: errno = %d\n", errno);
18016
18017     return 0;
18018 }
18019 END
18020       set try
18021       if eval $compile; then
18022           xxx=`$run ./try`
18023           case "$xxx" in
18024           semid_ds) val="$define" ;;
18025           esac
18026       fi
18027       $rm_try
18028       set d_semctl_semid_ds
18029       eval $setvar
18030       ;;
18031     esac
18032     case "$d_semctl_semid_ds" in
18033     $define)
18034         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
18035         ;;
18036     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
18037         ;;
18038     esac
18039     ;;
18040 *)  val="$undef"
18041
18042     # We do not have the full sem*(2) library, so assume we can not
18043     # use either.
18044
18045     set d_semctl_semun
18046     eval $setvar
18047
18048     set d_semctl_semid_ds
18049     eval $setvar
18050     ;;
18051 esac
18052 $rm_try tryh.h
18053
18054 : see if sendmsg exists
18055 set sendmsg d_sendmsg
18056 eval $inlibc
18057
18058 : see if setegid exists
18059 set setegid d_setegid
18060 eval $inlibc
18061
18062 : see if seteuid exists
18063 set seteuid d_seteuid
18064 eval $inlibc
18065
18066 : see if setgrent exists
18067 set setgrent d_setgrent
18068 eval $inlibc
18069
18070 : see if setgrent_r exists
18071 set setgrent_r d_setgrent_r
18072 eval $inlibc
18073 case "$d_setgrent_r" in
18074 "$define")
18075         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
18076         case "$d_setgrent_r_proto:$usethreads" in
18077         ":define")      d_setgrent_r_proto=define
18078                 set d_setgrent_r_proto setgrent_r $hdrs
18079                 eval $hasproto ;;
18080         *)      ;;
18081         esac
18082         case "$d_setgrent_r_proto" in
18083         define)
18084         case "$setgrent_r_proto" in
18085         ''|0) try='int setgrent_r(FILE**);'
18086         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
18087         esac
18088         case "$setgrent_r_proto" in
18089         ''|0) try='void setgrent_r(FILE**);'
18090         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
18091         esac
18092         case "$setgrent_r_proto" in
18093         ''|0)   d_setgrent_r=undef
18094                 setgrent_r_proto=0
18095                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
18096         * )     case "$setgrent_r_proto" in
18097                 REENTRANT_PROTO*) ;;
18098                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
18099                 esac
18100                 echo "Prototype: $try" ;;
18101         esac
18102         ;;
18103         *)      case "$usethreads" in
18104                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
18105                 esac
18106                 d_setgrent_r=undef
18107                 setgrent_r_proto=0
18108                 ;;
18109         esac
18110         ;;
18111 *)      setgrent_r_proto=0
18112         ;;
18113 esac
18114
18115 : see if sethostent exists
18116 set sethostent d_sethent
18117 eval $inlibc
18118
18119 : see if sethostent_r exists
18120 set sethostent_r d_sethostent_r
18121 eval $inlibc
18122 case "$d_sethostent_r" in
18123 "$define")
18124         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18125         case "$d_sethostent_r_proto:$usethreads" in
18126         ":define")      d_sethostent_r_proto=define
18127                 set d_sethostent_r_proto sethostent_r $hdrs
18128                 eval $hasproto ;;
18129         *)      ;;
18130         esac
18131         case "$d_sethostent_r_proto" in
18132         define)
18133         case "$sethostent_r_proto" in
18134         ''|0) try='int sethostent_r(int, struct hostent_data*);'
18135         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
18136         esac
18137         case "$sethostent_r_proto" in
18138         ''|0) try='void sethostent_r(int, struct hostent_data*);'
18139         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
18140         esac
18141         case "$sethostent_r_proto" in
18142         ''|0)   d_sethostent_r=undef
18143                 sethostent_r_proto=0
18144                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
18145         * )     case "$sethostent_r_proto" in
18146                 REENTRANT_PROTO*) ;;
18147                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
18148                 esac
18149                 echo "Prototype: $try" ;;
18150         esac
18151         ;;
18152         *)      case "$usethreads" in
18153                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
18154                 esac
18155                 d_sethostent_r=undef
18156                 sethostent_r_proto=0
18157                 ;;
18158         esac
18159         ;;
18160 *)      sethostent_r_proto=0
18161         ;;
18162 esac
18163
18164 : see if setitimer exists
18165 set setitimer d_setitimer
18166 eval $inlibc
18167
18168 : see if setlinebuf exists
18169 set setlinebuf d_setlinebuf
18170 eval $inlibc
18171
18172 : see if setlocale exists
18173 set setlocale d_setlocale
18174 eval $inlibc
18175
18176 : see if locale.h is available
18177 set locale.h i_locale
18178 eval $inhdr
18179
18180 : see if setlocale_r exists
18181 set setlocale_r d_setlocale_r
18182 eval $inlibc
18183 case "$d_setlocale_r" in
18184 "$define")
18185         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18186         case "$d_setlocale_r_proto:$usethreads" in
18187         ":define")      d_setlocale_r_proto=define
18188                 set d_setlocale_r_proto setlocale_r $hdrs
18189                 eval $hasproto ;;
18190         *)      ;;
18191         esac
18192         case "$d_setlocale_r_proto" in
18193         define)
18194         case "$setlocale_r_proto" in
18195         ''|0) try='int setlocale_r(int, const char*, char*, int);'
18196         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18197         esac
18198         case "$setlocale_r_proto" in
18199         ''|0)   d_setlocale_r=undef
18200                 setlocale_r_proto=0
18201                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18202         * )     case "$setlocale_r_proto" in
18203                 REENTRANT_PROTO*) ;;
18204                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18205                 esac
18206                 echo "Prototype: $try" ;;
18207         esac
18208         ;;
18209         *)      case "$usethreads" in
18210                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18211                 esac
18212                 d_setlocale_r=undef
18213                 setlocale_r_proto=0
18214                 ;;
18215         esac
18216         ;;
18217 *)      setlocale_r_proto=0
18218         ;;
18219 esac
18220
18221 : see if setnetent exists
18222 set setnetent d_setnent
18223 eval $inlibc
18224
18225 : see if setnetent_r exists
18226 set setnetent_r d_setnetent_r
18227 eval $inlibc
18228 case "$d_setnetent_r" in
18229 "$define")
18230         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18231         case "$d_setnetent_r_proto:$usethreads" in
18232         ":define")      d_setnetent_r_proto=define
18233                 set d_setnetent_r_proto setnetent_r $hdrs
18234                 eval $hasproto ;;
18235         *)      ;;
18236         esac
18237         case "$d_setnetent_r_proto" in
18238         define)
18239         case "$setnetent_r_proto" in
18240         ''|0) try='int setnetent_r(int, struct netent_data*);'
18241         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18242         esac
18243         case "$setnetent_r_proto" in
18244         ''|0) try='void setnetent_r(int, struct netent_data*);'
18245         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18246         esac
18247         case "$setnetent_r_proto" in
18248         ''|0)   d_setnetent_r=undef
18249                 setnetent_r_proto=0
18250                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18251         * )     case "$setnetent_r_proto" in
18252                 REENTRANT_PROTO*) ;;
18253                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18254                 esac
18255                 echo "Prototype: $try" ;;
18256         esac
18257         ;;
18258         *)      case "$usethreads" in
18259                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18260                 esac
18261                 d_setnetent_r=undef
18262                 setnetent_r_proto=0
18263                 ;;
18264         esac
18265         ;;
18266 *)      setnetent_r_proto=0
18267         ;;
18268 esac
18269
18270 : see if setprotoent exists
18271 set setprotoent d_setpent
18272 eval $inlibc
18273
18274 : see if setpgid exists
18275 set setpgid d_setpgid
18276 eval $inlibc
18277
18278 : see if setpgrp2 exists
18279 set setpgrp2 d_setpgrp2
18280 eval $inlibc
18281
18282 : see if setpriority exists
18283 set setpriority d_setprior
18284 eval $inlibc
18285
18286 : see if setproctitle exists
18287 set setproctitle d_setproctitle
18288 eval $inlibc
18289
18290 : see if setprotoent_r exists
18291 set setprotoent_r d_setprotoent_r
18292 eval $inlibc
18293 case "$d_setprotoent_r" in
18294 "$define")
18295         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18296         case "$d_setprotoent_r_proto:$usethreads" in
18297         ":define")      d_setprotoent_r_proto=define
18298                 set d_setprotoent_r_proto setprotoent_r $hdrs
18299                 eval $hasproto ;;
18300         *)      ;;
18301         esac
18302         case "$d_setprotoent_r_proto" in
18303         define)
18304         case "$setprotoent_r_proto" in
18305         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18306         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18307         esac
18308         case "$setprotoent_r_proto" in
18309         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18310         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18311         esac
18312         case "$setprotoent_r_proto" in
18313         ''|0)   d_setprotoent_r=undef
18314                 setprotoent_r_proto=0
18315                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18316         * )     case "$setprotoent_r_proto" in
18317                 REENTRANT_PROTO*) ;;
18318                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18319                 esac
18320                 echo "Prototype: $try" ;;
18321         esac
18322         ;;
18323         *)      case "$usethreads" in
18324                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18325                 esac
18326                 d_setprotoent_r=undef
18327                 setprotoent_r_proto=0
18328                 ;;
18329         esac
18330         ;;
18331 *)      setprotoent_r_proto=0
18332         ;;
18333 esac
18334
18335 : see if setpwent exists
18336 set setpwent d_setpwent
18337 eval $inlibc
18338
18339 : see if setpwent_r exists
18340 set setpwent_r d_setpwent_r
18341 eval $inlibc
18342 case "$d_setpwent_r" in
18343 "$define")
18344         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18345         case "$d_setpwent_r_proto:$usethreads" in
18346         ":define")      d_setpwent_r_proto=define
18347                 set d_setpwent_r_proto setpwent_r $hdrs
18348                 eval $hasproto ;;
18349         *)      ;;
18350         esac
18351         case "$d_setpwent_r_proto" in
18352         define)
18353         case "$setpwent_r_proto" in
18354         ''|0) try='int setpwent_r(FILE**);'
18355         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18356         esac
18357         case "$setpwent_r_proto" in
18358         ''|0) try='void setpwent_r(FILE**);'
18359         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18360         esac
18361         case "$setpwent_r_proto" in
18362         ''|0)   d_setpwent_r=undef
18363                 setpwent_r_proto=0
18364                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18365         * )     case "$setpwent_r_proto" in
18366                 REENTRANT_PROTO*) ;;
18367                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18368                 esac
18369                 echo "Prototype: $try" ;;
18370         esac
18371         ;;
18372         *)      case "$usethreads" in
18373                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18374                 esac
18375                 d_setpwent_r=undef
18376                 setpwent_r_proto=0
18377                 ;;
18378         esac
18379         ;;
18380 *)      setpwent_r_proto=0
18381         ;;
18382 esac
18383
18384 : see if setregid exists
18385 set setregid d_setregid
18386 eval $inlibc
18387 set setresgid d_setresgid
18388 eval $inlibc
18389
18390 : see if setreuid exists
18391 set setreuid d_setreuid
18392 eval $inlibc
18393 set setresuid d_setresuid
18394 eval $inlibc
18395
18396 : see if setrgid exists
18397 set setrgid d_setrgid
18398 eval $inlibc
18399
18400 : see if setruid exists
18401 set setruid d_setruid
18402 eval $inlibc
18403
18404 : see if setservent exists
18405 set setservent d_setsent
18406 eval $inlibc
18407
18408 : see if setservent_r exists
18409 set setservent_r d_setservent_r
18410 eval $inlibc
18411 case "$d_setservent_r" in
18412 "$define")
18413         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18414         case "$d_setservent_r_proto:$usethreads" in
18415         ":define")      d_setservent_r_proto=define
18416                 set d_setservent_r_proto setservent_r $hdrs
18417                 eval $hasproto ;;
18418         *)      ;;
18419         esac
18420         case "$d_setservent_r_proto" in
18421         define)
18422         case "$setservent_r_proto" in
18423         ''|0) try='int setservent_r(int, struct servent_data*);'
18424         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18425         esac
18426         case "$setservent_r_proto" in
18427         ''|0) try='void setservent_r(int, struct servent_data*);'
18428         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18429         esac
18430         case "$setservent_r_proto" in
18431         ''|0)   d_setservent_r=undef
18432                 setservent_r_proto=0
18433                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18434         * )     case "$setservent_r_proto" in
18435                 REENTRANT_PROTO*) ;;
18436                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18437                 esac
18438                 echo "Prototype: $try" ;;
18439         esac
18440         ;;
18441         *)      case "$usethreads" in
18442                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18443                 esac
18444                 d_setservent_r=undef
18445                 setservent_r_proto=0
18446                 ;;
18447         esac
18448         ;;
18449 *)      setservent_r_proto=0
18450         ;;
18451 esac
18452
18453 : see if setsid exists
18454 set setsid d_setsid
18455 eval $inlibc
18456
18457 : see if setvbuf exists
18458 set setvbuf d_setvbuf
18459 eval $inlibc
18460
18461 : see if shmctl exists
18462 set shmctl d_shmctl
18463 eval $inlibc
18464
18465 : see if shmget exists
18466 set shmget d_shmget
18467 eval $inlibc
18468
18469 : see if shmat exists
18470 set shmat d_shmat
18471 eval $inlibc
18472 : see what shmat returns
18473 case "$d_shmat" in
18474 "$define")
18475         $cat >shmat.c <<'END'
18476 #include <sys/shm.h>
18477 void *shmat();
18478 END
18479         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18480                 shmattype='void *'
18481         else
18482                 shmattype='char *'
18483         fi
18484         echo "and it returns ($shmattype)." >&4
18485         : see if a prototype for shmat is available
18486         xxx=`./findhdr sys/shm.h`
18487         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18488         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18489                 val="$define"
18490         else
18491                 val="$undef"
18492         fi
18493         $rm -f shmat.[co]
18494         ;;
18495 *)
18496         val="$undef"
18497         ;;
18498 esac
18499 set d_shmatprototype
18500 eval $setvar
18501
18502 : see if shmdt exists
18503 set shmdt d_shmdt
18504 eval $inlibc
18505
18506 : see how much of the 'shm*(2)' library is present.
18507 h_shm=true
18508 echo " "
18509 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18510 *"$undef"*) h_shm=false;;
18511 esac
18512 case "$osname" in
18513 freebsd)
18514     case "`ipcs 2>&1`" in
18515     "SVID shared memory"*"not configured"*)
18516         echo "Your $osname does not have the shm*(2) configured." >&4
18517         h_shm=false
18518         val="$undef"
18519         set shmctl d_shmctl
18520         eval $setvar
18521         set shmget d_shmget
18522         eval $setvar
18523         set shmat d_shmat
18524         eval $setvar
18525         set shmdt d_shmdt
18526         eval $setvar
18527         ;;
18528     esac
18529     ;;
18530 esac
18531 : we could also check for sys/ipc.h ...
18532 if $h_shm && $test `./findhdr sys/shm.h`; then
18533         echo "You have the full shm*(2) library." >&4
18534         val="$define"
18535 else
18536         echo "You don't have the full shm*(2) library." >&4
18537         val="$undef"
18538 fi
18539 set d_shm
18540 eval $setvar
18541
18542 : see if we have sigaction
18543 echo " "
18544 if set sigaction val -f d_sigaction; eval $csym; $val; then
18545         echo 'sigaction() found.' >&4
18546         $cat > try.c <<EOP
18547 #include <stdio.h>
18548 #include <sys/types.h>
18549 #include <signal.h>
18550 #$i_stdlib I_STDLIB
18551 #ifdef I_STDLIB
18552 #include <stdlib.h>
18553 #endif
18554 int main()
18555 {
18556     struct sigaction act, oact;
18557     act.sa_flags = 0;
18558     oact.sa_handler = 0;
18559     /* so that act and oact are used */
18560     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18561 }
18562 EOP
18563         set try
18564         if eval $compile_ok; then
18565                 val="$define"
18566         else
18567                 echo "But you don't seem to have a usable struct sigaction." >&4
18568                 val="$undef"
18569         fi
18570 else
18571         echo 'sigaction NOT found.' >&4
18572         val="$undef"
18573 fi
18574 set d_sigaction; eval $setvar
18575 $rm_try
18576
18577 : see if this is a sunmath.h system
18578 set sunmath.h i_sunmath
18579 eval $inhdr
18580
18581 : see if signbit exists
18582 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18583 $cat >try.c <<EOCP
18584 #$i_math I_MATH
18585 #$i_sunmath I_SUNMATH
18586 #ifdef I_MATH
18587 #  include <math.h>
18588 #endif
18589 #ifdef I_SUNMATH  /* Solaris special math library */
18590 #  include <sunmath.h>
18591 #endif
18592 #define NV $nvtype
18593 int main(int argc, char **argv)
18594 {
18595     NV x = 0.0;
18596     NV y = -0.0;
18597     if ((signbit(x) == 0) && (signbit(y) != 0))
18598         return 0;
18599     else
18600         return 1;
18601 }
18602 EOCP
18603 val="$undef"
18604 set try
18605 if eval $compile; then
18606     if $run ./try; then
18607         $echo "Yes." >&4
18608         val="$define"
18609     else
18610         $echo "Signbit seems to be available, but doesn't work as I expected."
18611         $echo "I won't use it." >&4
18612         val="$undef"
18613     fi
18614 else
18615     $echo "Nope." >&4
18616     dflt="$undef"
18617 fi
18618 set d_signbit
18619 eval $setvar
18620 $rm_try
18621
18622 : see if sigprocmask exists
18623 set sigprocmask d_sigprocmask
18624 eval $inlibc
18625
18626 : see if sigsetjmp exists
18627 echo " "
18628 case "$d_sigsetjmp" in
18629 '')
18630         $cat >try.c <<EOP
18631 #include <setjmp.h>
18632 #$i_stdlib I_STDLIB
18633 #ifdef I_STDLIB
18634 #include <stdlib.h>
18635 #endif
18636 sigjmp_buf env;
18637 int set = 1;
18638 int main()
18639 {
18640         if (sigsetjmp(env,1))
18641                 exit(set);
18642         set = 0;
18643         siglongjmp(env, 1);
18644         exit(1);
18645 }
18646 EOP
18647         set try
18648         if eval $compile; then
18649                 if $run ./try >/dev/null 2>&1; then
18650                         echo "POSIX sigsetjmp found." >&4
18651                         val="$define"
18652                 else
18653                         $cat >&4 <<EOM
18654 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18655 I'll ignore them.
18656 EOM
18657                         val="$undef"
18658                 fi
18659         else
18660                 echo "sigsetjmp not found." >&4
18661                 val="$undef"
18662         fi
18663         ;;
18664 *) val="$d_sigsetjmp"
18665         case "$d_sigsetjmp" in
18666         $define) echo "POSIX sigsetjmp found." >&4;;
18667         $undef) echo "sigsetjmp not found." >&4;;
18668         esac
18669         ;;
18670 esac
18671 set d_sigsetjmp
18672 eval $setvar
18673 $rm_try
18674
18675 : see if snprintf exists
18676 set snprintf d_snprintf
18677 eval $inlibc
18678
18679 : see if vsnprintf exists
18680 set vsnprintf d_vsnprintf
18681 eval $inlibc
18682
18683 case "$d_snprintf-$d_vsnprintf" in
18684 "$define-$define")
18685     $cat <<EOM
18686 Checking whether your snprintf() and vsnprintf() work okay...
18687 EOM
18688     $cat >try.c <<'EOCP'
18689 /* v?snprintf testing logic courtesy of Russ Allbery.
18690  * According to C99:
18691  * - if the buffer is too short it still must be \0-terminated
18692  * - if the buffer is too short the potentially required length
18693  *   must be returned and not -1
18694  * - if the buffer is NULL the potentially required length
18695  *   must be returned and not -1 or core dump
18696  */
18697 #include <stdio.h>
18698 #include <stdarg.h>
18699
18700 char buf[2];
18701
18702 int test (char *format, ...)
18703 {
18704     va_list args;
18705     int count;
18706
18707     va_start (args, format);
18708     count = vsnprintf (buf, sizeof buf, format, args);
18709     va_end (args);
18710     return count;
18711 }
18712
18713 int main ()
18714 {
18715     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18716              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18717 }
18718 EOCP
18719     set try
18720     if eval $compile; then
18721         `$run ./try`
18722         case "$?" in
18723         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18724         *) cat <<EOM >&4
18725 Your snprintf() and snprintf() don't seem to be working okay.
18726 EOM
18727            d_snprintf="$undef"
18728            d_vsnprintf="$undef"
18729            ;;
18730         esac
18731     else
18732         echo "(I can't seem to compile the test program--assuming they don't)"
18733         d_snprintf="$undef"
18734         d_vsnprintf="$undef"
18735     fi
18736     $rm_try
18737     ;;
18738 esac
18739
18740 : see if sockatmark exists
18741 set sockatmark d_sockatmark
18742 eval $inlibc
18743
18744 : see if prototype for sockatmark is available
18745 echo " "
18746 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18747 eval $hasproto
18748
18749 : see if socks5_init exists
18750 set socks5_init d_socks5_init
18751 eval $inlibc
18752
18753 : see if sprintf returns the length of the string in the buffer as per ANSI
18754 $echo "Checking whether sprintf returns the length of the string..." >&4
18755 $cat <<EOP >try.c
18756 #include <stdio.h>
18757 #$i_stdlib I_STDLIB
18758 #ifdef I_STDLIB
18759 #include <stdlib.h>
18760 #endif
18761 #$i_string I_STRING
18762 #ifdef I_STRING
18763 #  include <string.h>
18764 #else
18765 #  include <strings.h>
18766 #endif
18767 #$i_math I_MATH
18768 #ifdef I_MATH
18769 #include <math.h>
18770 #endif
18771
18772 char buffer[256];
18773
18774 int check (size_t expect, int test) {
18775   size_t got = strlen(buffer);
18776   if (expect == got)
18777     return 0;
18778
18779   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
18780        test, buffer);
18781   exit (test);
18782 }
18783
18784 int main(int argc, char **argv) {
18785   int test = 0;
18786
18787   check(sprintf(buffer, ""), ++test);
18788   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
18789   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
18790
18791   return 0;
18792 }
18793 EOP
18794 set try
18795
18796 if eval $compile; then
18797     xxx="`$run ./try`"
18798     case "$?" in
18799         0) cat >&4 <<EOM
18800 sprintf returns the length of the string (as ANSI says it should)
18801 EOM
18802         d_sprintf_returns_strlen="$define"
18803         ;;
18804         *) cat >&4 <<EOM
18805 sprintf does not return the length of the string (how old is this system?)
18806 EOM
18807         d_sprintf_returns_strlen="$undef"
18808         ;;
18809     esac
18810 else
18811     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
18812     d_sprintf_returns_strlen="$undef"
18813 fi
18814 $rm_try
18815
18816 : see if srand48_r exists
18817 set srand48_r d_srand48_r
18818 eval $inlibc
18819 case "$d_srand48_r" in
18820 "$define")
18821         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18822         case "$d_srand48_r_proto:$usethreads" in
18823         ":define")      d_srand48_r_proto=define
18824                 set d_srand48_r_proto srand48_r $hdrs
18825                 eval $hasproto ;;
18826         *)      ;;
18827         esac
18828         case "$d_srand48_r_proto" in
18829         define)
18830         case "$srand48_r_proto" in
18831         ''|0) try='int srand48_r(long, struct drand48_data*);'
18832         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18833         esac
18834         case "$srand48_r_proto" in
18835         ''|0)   d_srand48_r=undef
18836                 srand48_r_proto=0
18837                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18838         * )     case "$srand48_r_proto" in
18839                 REENTRANT_PROTO*) ;;
18840                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18841                 esac
18842                 echo "Prototype: $try" ;;
18843         esac
18844         ;;
18845         *)      case "$usethreads" in
18846                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18847                 esac
18848                 d_srand48_r=undef
18849                 srand48_r_proto=0
18850                 ;;
18851         esac
18852         ;;
18853 *)      srand48_r_proto=0
18854         ;;
18855 esac
18856
18857 : see if srandom_r exists
18858 set srandom_r d_srandom_r
18859 eval $inlibc
18860 case "$d_srandom_r" in
18861 "$define")
18862         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18863         case "$d_srandom_r_proto:$usethreads" in
18864         ":define")      d_srandom_r_proto=define
18865                 set d_srandom_r_proto srandom_r $hdrs
18866                 eval $hasproto ;;
18867         *)      ;;
18868         esac
18869         case "$d_srandom_r_proto" in
18870         define)
18871         case "$srandom_r_proto" in
18872         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18873         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18874         esac
18875         case "$srandom_r_proto" in
18876         ''|0)   d_srandom_r=undef
18877                 srandom_r_proto=0
18878                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18879         * )     case "$srandom_r_proto" in
18880                 REENTRANT_PROTO*) ;;
18881                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18882                 esac
18883                 echo "Prototype: $try" ;;
18884         esac
18885         ;;
18886         *)      case "$usethreads" in
18887                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18888                 esac
18889                 d_srandom_r=undef
18890                 srandom_r_proto=0
18891                 ;;
18892         esac
18893         ;;
18894 *)      srandom_r_proto=0
18895         ;;
18896 esac
18897
18898 : see if prototype for setresgid is available
18899 echo " "
18900 set d_sresgproto setresgid $i_unistd unistd.h
18901 eval $hasproto
18902
18903 : see if prototype for setresuid is available
18904 echo " "
18905 set d_sresuproto setresuid $i_unistd unistd.h
18906 eval $hasproto
18907
18908 : see if stat exists
18909 set stat d_stat
18910 eval $inlibc
18911
18912 : see if sys/stat.h is available
18913 set sys/stat.h i_sysstat
18914 eval $inhdr
18915
18916 : see if stat knows about block sizes
18917 echo " "
18918 echo "Checking to see if your struct stat has st_blocks field..." >&4
18919 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18920 eval $hasfield
18921
18922 : see if this is a sys/vfs.h system
18923 set sys/vfs.h i_sysvfs
18924 eval $inhdr
18925
18926 : see if this is a sys/statfs.h system
18927 set sys/statfs.h i_sysstatfs
18928 eval $inhdr
18929
18930 : Check for statfs_s
18931 echo " "
18932 echo "Checking to see if your system supports struct statfs..." >&4
18933 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
18934 eval $hasstruct
18935 case "$d_statfs_s" in
18936 "$define")      echo "Yes, it does."   ;;
18937 *)              echo "No, it doesn't." ;;
18938 esac
18939
18940
18941 : see if struct statfs knows about f_flags
18942 case "$d_statfs_s" in
18943 define)
18944         echo " "
18945         echo "Checking to see if your struct statfs has f_flags field..." >&4
18946         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
18947         eval $hasfield
18948         ;;
18949 *)      val="$undef"
18950         set d_statfs_f_flags
18951         eval $setvar
18952         ;;
18953 esac
18954 case "$d_statfs_f_flags" in
18955 "$define")      echo "Yes, it does."   ;;
18956 *)              echo "No, it doesn't." ;;
18957 esac
18958
18959 : see what flavor, if any, of static inline is supported
18960 echo " "
18961 echo "Checking to see if your system supports static inline..."
18962 $cat > try.c <<'EOCP'
18963 #include <stdlib.h>
18964 extern int f_via_a(int x);
18965 extern int f_via_b(int x);
18966 int main(int argc, char **argv)
18967 {
18968     int y;
18969
18970     y = f_via_a(0);
18971 #ifdef USE_B
18972     y = f_via_b(0);
18973 #endif
18974     if (y == 42) {
18975         return EXIT_SUCCESS;
18976     }
18977     else {
18978         return EXIT_FAILURE;
18979     }
18980 }
18981 EOCP
18982 $cat > a.c <<'EOCP'
18983 static INLINE int f(int x) {
18984     int y;
18985     y = x + 42;
18986     return y;
18987 }
18988
18989 int f_via_a(int x)
18990 {
18991     return f(x);
18992 }
18993 EOCP
18994 $cat > b.c <<'EOCP'
18995 extern int f(int x);
18996
18997 int f_via_b(int x)
18998 {
18999     return f(x);
19000 }
19001 EOCP
19002
19003 # Respect a hint (or previous) value for perl_static_inline, if there is one.
19004 case "$perl_static_inline" in
19005 '')     # Check the various possibilities, and break out on success.
19006         # For gcc, prefer __inline__, which will still permit
19007         # cflags.SH to add in -ansi.
19008         case "$gccversion" in
19009                 '') xxx="inline __inline__ __inline _inline";;
19010                 *)  xxx="__inline__ inline __inline _inline";;
19011         esac
19012         for inline in $xxx; do
19013                 set try -DINLINE=$inline a.c
19014                 if eval $compile && $run ./try; then
19015                         # Now make sure there is no external linkage of static
19016                         # functions
19017                         set try -DINLINE=$inline -DUSE_B a.c b.c
19018                         if eval $compile && $run ./try; then
19019                                 $echo "Your compiler supports static $inline, " >&4
19020                                 $echo "but it also creates an external definition," >&4
19021                                 $echo "so I won't use it." >&4
19022                                 val=$undef
19023                         else
19024                                 $echo "Your compiler supports static $inline." >&4
19025                                 val=$define
19026                                 perl_static_inline="static $inline";
19027                                 break;
19028                         fi
19029                 else
19030                         $echo "Your compiler does NOT support static $inline." >&4
19031                         val="$undef"
19032                 fi
19033         done
19034         ;;
19035 *inline*) # Some variant of inline exists.
19036         echo "Keeping your $hint value of $perl_static_inline."
19037         val=$define
19038         ;;
19039 static)  # No inline capabilities
19040         echo "Keeping your $hint value of $perl_static_inline."
19041         val=$undef
19042         ;;
19043 *)  # Unrecognized previous value -- blindly trust the supplied
19044         # value and hope it makes sense.  Use old value for
19045         # d_static_inline, if there is one.
19046         echo "Keeping your $hint value of $perl_static_inline."
19047         case "$d_static_inline" in
19048                 '') val=$define ;;
19049                 *)  val=$d_static_inline ;;
19050         esac
19051         ;;
19052 esac
19053 # Fallback to plain 'static' if nothing worked.
19054 case "$perl_static_inline" in
19055 '')
19056         perl_static_inline="static"
19057         val=$undef
19058         ;;
19059 esac
19060 set d_static_inline
19061 eval $setvar
19062 $rm -f a.[co] b.[co]
19063 $rm_try
19064
19065 : Check stream access
19066 $cat >&4 <<EOM
19067 Checking how to access stdio streams by file descriptor number...
19068 EOM
19069 case "$stdio_stream_array" in
19070 '')     $cat >try.c <<EOCP
19071 #include <stdio.h>
19072 int main() {
19073   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
19074     printf("yes\n");
19075 }
19076 EOCP
19077         for s in _iob __iob __sF
19078         do
19079                 set try -DSTDIO_STREAM_ARRAY=$s
19080                 if eval $compile; then
19081                         case "`$run ./try`" in
19082                         yes)    stdio_stream_array=$s; break ;;
19083                         esac
19084                 fi
19085         done
19086         $rm_try
19087 esac
19088 case "$stdio_stream_array" in
19089 '')     $cat >&4 <<EOM
19090 I can't figure out how to access stdio streams by file descriptor number.
19091 EOM
19092         d_stdio_stream_array="$undef"
19093         ;;
19094 *)      $cat >&4 <<EOM
19095 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
19096 EOM
19097         d_stdio_stream_array="$define"
19098         ;;
19099 esac
19100
19101 : see if strcoll exists
19102 set strcoll d_strcoll
19103 eval $inlibc
19104
19105 : check for structure copying
19106 echo " "
19107 echo "Checking to see if your C compiler can copy structs..." >&4
19108 $cat >try.c <<'EOCP'
19109 int main()
19110 {
19111         struct blurfl {
19112                 int dyick;
19113         } foo, bar;
19114
19115         foo = bar;
19116 }
19117 EOCP
19118 if $cc -c try.c >/dev/null 2>&1 ; then
19119         val="$define"
19120         echo "Yup, it can."
19121 else
19122         val="$undef"
19123         echo "Nope, it can't."
19124 fi
19125 set d_strctcpy
19126 eval $setvar
19127 $rm_try
19128
19129 : see if strerror and/or sys_errlist[] exist
19130 echo " "
19131 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
19132     if set strerror val -f d_strerror; eval $csym; $val; then
19133                 echo 'strerror() found.' >&4
19134                 d_strerror="$define"
19135                 d_strerrm='strerror(e)'
19136                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19137                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
19138                         d_syserrlst="$define"
19139                 else
19140                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
19141                         d_syserrlst="$undef"
19142                 fi
19143     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
19144                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
19145                 echo 'strerror() found in string header.' >&4
19146                 d_strerror="$define"
19147                 d_strerrm='strerror(e)'
19148                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19149                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
19150                                 d_syserrlst="$define"
19151                 else
19152                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
19153                         d_syserrlst="$undef"
19154                 fi
19155     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19156                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
19157                 d_strerror="$undef"
19158                 d_syserrlst="$define"
19159                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
19160     else
19161                 echo 'strerror() and sys_errlist[] NOT found.' >&4
19162                 d_strerror="$undef"
19163                 d_syserrlst="$undef"
19164                 d_strerrm='"unknown"'
19165     fi
19166 fi
19167
19168 : see if strerror_r exists
19169 set strerror_r d_strerror_r
19170 eval $inlibc
19171 case "$d_strerror_r" in
19172 "$define")
19173         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
19174         case "$d_strerror_r_proto:$usethreads" in
19175         ":define")      d_strerror_r_proto=define
19176                 set d_strerror_r_proto strerror_r $hdrs
19177                 eval $hasproto ;;
19178         *)      ;;
19179         esac
19180         case "$d_strerror_r_proto" in
19181         define)
19182         case "$strerror_r_proto" in
19183         ''|0) try='int strerror_r(int, char*, size_t);'
19184         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
19185         esac
19186         case "$strerror_r_proto" in
19187         ''|0) try='int strerror_r(int, char*, int);'
19188         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
19189         esac
19190         case "$strerror_r_proto" in
19191         ''|0) try='char* strerror_r(int, char*, size_t);'
19192         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
19193         esac
19194         case "$strerror_r_proto" in
19195         ''|0)   d_strerror_r=undef
19196                 strerror_r_proto=0
19197                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19198         * )     case "$strerror_r_proto" in
19199                 REENTRANT_PROTO*) ;;
19200                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19201                 esac
19202                 echo "Prototype: $try" ;;
19203         esac
19204         ;;
19205         *)      case "$usethreads" in
19206                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
19207                 esac
19208                 d_strerror_r=undef
19209                 strerror_r_proto=0
19210                 ;;
19211         esac
19212         ;;
19213 *)      strerror_r_proto=0
19214         ;;
19215 esac
19216
19217 : see if strftime exists
19218 set strftime d_strftime
19219 eval $inlibc
19220
19221 : see if strlcat exists
19222 set strlcat d_strlcat
19223 eval $inlibc
19224
19225 : see if strlcpy exists
19226 set strlcpy d_strlcpy
19227 eval $inlibc
19228
19229 : see if strtod exists
19230 set strtod d_strtod
19231 eval $inlibc
19232
19233 : see if strtol exists
19234 set strtol d_strtol
19235 eval $inlibc
19236
19237 : see if strtold exists
19238 set strtold d_strtold
19239 eval $inlibc
19240
19241 : see if strtoll exists
19242 set strtoll d_strtoll
19243 eval $inlibc
19244
19245 case "$d_longlong-$d_strtoll" in
19246 "$define-$define")
19247         $cat <<EOM
19248 Checking whether your strtoll() works okay...
19249 EOM
19250         $cat >try.c <<'EOCP'
19251 #include <errno.h>
19252 #ifdef __hpux
19253 #define strtoll __strtoll
19254 #endif
19255 #ifdef __EMX__
19256 #define strtoll _strtoll
19257 #endif
19258 #include <stdio.h>
19259 extern long long int strtoll(char *s, char **, int);
19260 static int bad = 0;
19261 int check(char *s, long long ell, int een) {
19262         long long gll;
19263         errno = 0;
19264         gll = strtoll(s, 0, 10);
19265         if (!((gll == ell) && (errno == een)))
19266                 bad++;
19267 }
19268 int main() {
19269         check(" 1",                                      1LL, 0);
19270         check(" 0",                                      0LL, 0);
19271         check("-1",                                     -1LL, 0);
19272         check("-9223372036854775808", -9223372036854775808LL, 0);
19273         check("-9223372036854775808", -9223372036854775808LL, 0);
19274         check(" 9223372036854775807",  9223372036854775807LL, 0);
19275         check("-9223372036854775808", -9223372036854775808LL, 0);
19276         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19277         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19278         if (!bad)
19279                 printf("ok\n");
19280 }
19281 EOCP
19282         set try
19283         if eval $compile; then
19284                 yyy=`$run ./try`
19285                 case "$yyy" in
19286                 ok) echo "Your strtoll() seems to be working okay." ;;
19287                 *) cat <<EOM >&4
19288 Your strtoll() doesn't seem to be working okay.
19289 EOM
19290                    d_strtoll="$undef"
19291                    ;;
19292                 esac
19293         else
19294                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19295                 d_strtoll="$undef"
19296         fi
19297         ;;
19298 esac
19299
19300 : see if strtoq exists
19301 set strtoq d_strtoq
19302 eval $inlibc
19303
19304 : see if strtoul exists
19305 set strtoul d_strtoul
19306 eval $inlibc
19307
19308 case "$d_strtoul" in
19309 "$define")
19310         $cat <<EOM
19311 Checking whether your strtoul() works okay...
19312 EOM
19313         $cat >try.c <<'EOCP'
19314 #include <errno.h>
19315 #include <stdio.h>
19316 extern unsigned long int strtoul(char *s, char **, int);
19317 static int bad = 0;
19318 void check(char *s, unsigned long eul, int een) {
19319         unsigned long gul;
19320         errno = 0;
19321         gul = strtoul(s, 0, 10);
19322         if (!((gul == eul) && (errno == een)))
19323                 bad++;
19324 }
19325 int main() {
19326         check(" 1", 1L, 0);
19327         check(" 0", 0L, 0);
19328 EOCP
19329         case "$longsize" in
19330         8)
19331             $cat >>try.c <<'EOCP'
19332         check("18446744073709551615", 18446744073709551615UL, 0);
19333         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19334 #if 0 /* strtoul() for /^-/ strings is undefined. */
19335         check("-1", 18446744073709551615UL, 0);
19336         check("-18446744073709551614", 2, 0);
19337         check("-18446744073709551615", 1, 0);
19338         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19339         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19340 #endif
19341 EOCP
19342                 ;;
19343         4)
19344                     $cat >>try.c <<'EOCP'
19345         check("4294967295", 4294967295UL, 0);
19346         check("4294967296", 4294967295UL, ERANGE);
19347 #if 0 /* strtoul() for /^-/ strings is undefined. */
19348         check("-1", 4294967295UL, 0);
19349         check("-4294967294", 2, 0);
19350         check("-4294967295", 1, 0);
19351         check("-4294967296", 4294967295UL, ERANGE);
19352         check("-4294967297", 4294967295UL, ERANGE);
19353 #endif
19354 EOCP
19355                 ;;
19356         *)
19357 : Should we write these tests to be more portable by sprintf-ing
19358 : ~0 and then manipulating that char string as input for strtol?
19359                 ;;
19360         esac
19361         $cat >>try.c <<'EOCP'
19362         if (!bad)
19363                 printf("ok\n");
19364         return 0;
19365 }
19366 EOCP
19367         set try
19368         if eval $compile; then
19369                 case "`$run ./try`" in
19370                 ok) echo "Your strtoul() seems to be working okay." ;;
19371                 *) cat <<EOM >&4
19372 Your strtoul() doesn't seem to be working okay.
19373 EOM
19374                    d_strtoul="$undef"
19375                    ;;
19376                 esac
19377         else
19378                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19379                 d_strtoul="$undef"
19380         fi
19381         ;;
19382 esac
19383
19384 : see if strtoull exists
19385 set strtoull d_strtoull
19386 eval $inlibc
19387
19388 case "$d_longlong-$d_strtoull" in
19389 "$define-$define")
19390         $cat <<EOM
19391 Checking whether your strtoull() works okay...
19392 EOM
19393         $cat >try.c <<'EOCP'
19394 #include <errno.h>
19395 #ifdef __hpux
19396 #define strtoull __strtoull
19397 #endif
19398 #include <stdio.h>
19399 extern unsigned long long int strtoull(char *s, char **, int);
19400 static int bad = 0;
19401 int check(char *s, long long eull, int een) {
19402         long long gull;
19403         errno = 0;
19404         gull = strtoull(s, 0, 10);
19405         if (!((gull == eull) && (errno == een)))
19406                 bad++;
19407 }
19408 int main() {
19409         check(" 1",                                        1LL, 0);
19410         check(" 0",                                        0LL, 0);
19411         check("18446744073709551615",  18446744073709551615ULL, 0);
19412         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19413 #if 0 /* strtoull() for /^-/ strings is undefined. */
19414         check("-1",                    18446744073709551615ULL, 0);
19415         check("-18446744073709551614",                     2LL, 0);
19416         check("-18446744073709551615",                     1LL, 0);
19417         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19418         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19419 #endif
19420         if (!bad)
19421                 printf("ok\n");
19422 }
19423 EOCP
19424         set try
19425         if eval $compile; then
19426                 case "`$run ./try`" in
19427                 ok) echo "Your strtoull() seems to be working okay." ;;
19428                 *) cat <<EOM >&4
19429 Your strtoull() doesn't seem to be working okay.
19430 EOM
19431                    d_strtoull="$undef"
19432                    ;;
19433                 esac
19434         else
19435                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19436                 d_strtoull="$undef"
19437         fi
19438         ;;
19439 esac
19440
19441 : see if strtouq exists
19442 set strtouq d_strtouq
19443 eval $inlibc
19444
19445 case "$d_strtouq" in
19446 "$define")
19447         $cat <<EOM
19448 Checking whether your strtouq() works okay...
19449 EOM
19450         $cat >try.c <<'EOCP'
19451 #include <errno.h>
19452 #include <stdio.h>
19453 extern unsigned long long int strtouq(char *s, char **, int);
19454 static int bad = 0;
19455 void check(char *s, unsigned long long eull, int een) {
19456         unsigned long long gull;
19457         errno = 0;
19458         gull = strtouq(s, 0, 10);
19459         if (!((gull == eull) && (errno == een)))
19460                 bad++;
19461 }
19462 int main() {
19463         check(" 1",                                        1LL, 0);
19464         check(" 0",                                        0LL, 0);
19465         check("18446744073709551615",  18446744073709551615ULL, 0);
19466         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19467 #if 0 /* strtouq() for /^-/ strings is undefined. */
19468         check("-1",                    18446744073709551615ULL, 0);
19469         check("-18446744073709551614",                     2LL, 0);
19470         check("-18446744073709551615",                     1LL, 0);
19471         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19472         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19473 #endif
19474         if (!bad)
19475                 printf("ok\n");
19476         return 0;
19477 }
19478 EOCP
19479         set try
19480         if eval $compile; then
19481                 case "`$run ./try`" in
19482                 ok) echo "Your strtouq() seems to be working okay." ;;
19483                 *) cat <<EOM >&4
19484 Your strtouq() doesn't seem to be working okay.
19485 EOM
19486                    d_strtouq="$undef"
19487                    ;;
19488                 esac
19489         else
19490                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19491                 d_strtouq="$undef"
19492         fi
19493         ;;
19494 esac
19495
19496 : see if strxfrm exists
19497 set strxfrm d_strxfrm
19498 eval $inlibc
19499
19500 : see if symlink exists
19501 set symlink d_symlink
19502 eval $inlibc
19503
19504 : see if syscall exists
19505 set syscall d_syscall
19506 eval $inlibc
19507
19508 : see if prototype for syscall is available
19509 echo " "
19510 set d_syscallproto syscall $i_unistd unistd.h
19511 eval $hasproto
19512
19513 : see if sysconf exists
19514 set sysconf d_sysconf
19515 eval $inlibc
19516
19517 : see if system exists
19518 set system d_system
19519 eval $inlibc
19520
19521 : see if tcgetpgrp exists
19522 set tcgetpgrp d_tcgetpgrp
19523 eval $inlibc
19524
19525 : see if tcsetpgrp exists
19526 set tcsetpgrp d_tcsetpgrp
19527 eval $inlibc
19528
19529 : see if prototype for telldir is available
19530 echo " "
19531 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19532 eval $hasproto
19533
19534 : see if tgamma exists
19535 set tgamma d_tgamma
19536 eval $inlibc
19537
19538 : see if time exists
19539 echo " "
19540 if test "X$d_time" = X -o X"$timetype" = X; then
19541     if set time val -f d_time; eval $csym; $val; then
19542                 echo 'time() found.' >&4
19543                 val="$define"
19544                 rp="What is the type returned by time() on this system?"
19545                 set time_t timetype long stdio.h sys/types.h
19546                 eval $typedef_ask
19547     else
19548                 echo 'time() not found, hope that will do.' >&4
19549                 val="$undef"
19550                 timetype='int';
19551     fi
19552     set d_time
19553     eval $setvar
19554 fi
19555
19556 : see if timegm exists
19557 set timegm d_timegm
19558 eval $inlibc
19559
19560 : see if this is a sys/times.h system
19561 set sys/times.h i_systimes
19562 eval $inhdr
19563
19564 : see if times exists
19565 echo " "
19566 if set times val -f d_times; eval $csym; $val; then
19567         echo 'times() found.' >&4
19568         d_times="$define"
19569         inc=''
19570         case "$i_systimes" in
19571         "$define") inc='sys/times.h';;
19572         esac
19573         rp="What is the type returned by times() on this system?"
19574         set clock_t clocktype long stdio.h sys/types.h $inc
19575         eval $typedef_ask
19576 else
19577         echo 'times() NOT found, hope that will do.' >&4
19578         d_times="$undef"
19579         clocktype='int'
19580 fi
19581
19582 : see if tmpnam_r exists
19583 set tmpnam_r d_tmpnam_r
19584 eval $inlibc
19585 case "$d_tmpnam_r" in
19586 "$define")
19587         hdrs="$i_systypes sys/types.h define stdio.h "
19588         case "$d_tmpnam_r_proto:$usethreads" in
19589         ":define")      d_tmpnam_r_proto=define
19590                 set d_tmpnam_r_proto tmpnam_r $hdrs
19591                 eval $hasproto ;;
19592         *)      ;;
19593         esac
19594         case "$d_tmpnam_r_proto" in
19595         define)
19596         case "$tmpnam_r_proto" in
19597         ''|0) try='char* tmpnam_r(char*);'
19598         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19599         esac
19600         case "$tmpnam_r_proto" in
19601         ''|0)   d_tmpnam_r=undef
19602                 tmpnam_r_proto=0
19603                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19604         * )     case "$tmpnam_r_proto" in
19605                 REENTRANT_PROTO*) ;;
19606                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19607                 esac
19608                 echo "Prototype: $try" ;;
19609         esac
19610         ;;
19611         *)      case "$usethreads" in
19612                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19613                 esac
19614                 d_tmpnam_r=undef
19615                 tmpnam_r_proto=0
19616                 ;;
19617         esac
19618         ;;
19619 *)      tmpnam_r_proto=0
19620         ;;
19621 esac
19622
19623 : see if trunc exists
19624 set trunc d_trunc
19625 eval $inlibc
19626
19627 : see if truncate exists
19628 set truncate d_truncate
19629 eval $inlibc
19630
19631 : see if ttyname_r exists
19632 set ttyname_r d_ttyname_r
19633 eval $inlibc
19634 case "$d_ttyname_r" in
19635 "$define")
19636         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19637         case "$d_ttyname_r_proto:$usethreads" in
19638         ":define")      d_ttyname_r_proto=define
19639                 set d_ttyname_r_proto ttyname_r $hdrs
19640                 eval $hasproto ;;
19641         *)      ;;
19642         esac
19643         case "$d_ttyname_r_proto" in
19644         define)
19645         case "$ttyname_r_proto" in
19646         ''|0) try='int ttyname_r(int, char*, size_t);'
19647         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19648         esac
19649         case "$ttyname_r_proto" in
19650         ''|0) try='int ttyname_r(int, char*, int);'
19651         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19652         esac
19653         case "$ttyname_r_proto" in
19654         ''|0) try='char* ttyname_r(int, char*, int);'
19655         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19656         esac
19657         case "$ttyname_r_proto" in
19658         ''|0)   d_ttyname_r=undef
19659                 ttyname_r_proto=0
19660                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19661         * )     case "$ttyname_r_proto" in
19662                 REENTRANT_PROTO*) ;;
19663                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19664                 esac
19665                 echo "Prototype: $try" ;;
19666         esac
19667         ;;
19668         *)      case "$usethreads" in
19669                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19670                 esac
19671                 d_ttyname_r=undef
19672                 ttyname_r_proto=0
19673                 ;;
19674         esac
19675         ;;
19676 *)      ttyname_r_proto=0
19677         ;;
19678 esac
19679
19680 : see if tzname[] exists
19681 echo " "
19682 if set tzname val -a d_tzname; eval $csym; $val; then
19683         val="$define"
19684         echo 'tzname[] found.' >&4
19685 else
19686         val="$undef"
19687         echo 'tzname[] NOT found.' >&4
19688 fi
19689 set d_tzname
19690 eval $setvar
19691
19692 : Check if is a multiplatform env
19693 case "$osname" in
19694 darwin) multiarch="$define" ;;
19695 esac
19696 case "$multiarch" in
19697 ''|[nN]*) multiarch="$undef" ;;
19698 esac
19699
19700 : check for ordering of bytes in a UV
19701 echo " "
19702 case "$multiarch" in
19703 *$define*)
19704         $cat <<EOM
19705 You seem to be doing a multiarchitecture build,
19706 skipping the byteorder check.
19707
19708 EOM
19709         byteorder='ffff'
19710         ;;
19711 *)
19712         case "$byteorder" in
19713         '')
19714                 $cat <<'EOM'
19715 In the following, larger digits indicate more significance.  A big-endian
19716 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19717 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19718 machines may have weird orders like 3412.  A Cray will report 87654321,
19719 an Alpha will report 12345678. If the test program works the default is
19720 probably right.
19721 I'm now running the test program...
19722 EOM
19723                 $cat >try.c <<EOCP
19724 #include <stdio.h>
19725 #$i_stdlib I_STDLIB
19726 #ifdef I_STDLIB
19727 #include <stdlib.h>
19728 #endif
19729 #include <sys/types.h>
19730 typedef $uvtype UV;
19731 int main()
19732 {
19733         int i;
19734         union {
19735                 UV l;
19736                 char c[$uvsize];
19737         } u;
19738
19739         if ($uvsize > 4)
19740                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19741         else
19742                 u.l = (UV)0x04030201;
19743         for (i = 0; i < $uvsize; i++)
19744                 printf("%c", u.c[i]+'0');
19745         printf("\n");
19746         exit(0);
19747 }
19748 EOCP
19749                 xxx_prompt=y
19750                 set try
19751                 if eval $compile && $run ./try > /dev/null; then
19752                         dflt=`$run ./try`
19753                         case "$dflt" in
19754                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19755                                 echo "(The test program ran ok.)"
19756                                 echo "byteorder=$dflt"
19757                                 xxx_prompt=n
19758                         ;;
19759                         ????|????????) echo "(The test program ran ok.)" ;;
19760                         *) echo "(The test program didn't run right for some reason.)" ;;
19761                         esac
19762                 else
19763                         dflt='4321'
19764                         cat <<'EOM'
19765 (I can't seem to compile the test program.  Guessing big-endian...)
19766 EOM
19767                 fi
19768                 case "$xxx_prompt" in
19769                 y)
19770                         rp="What is the order of bytes in $uvtype?"
19771                         . ./myread
19772                         byteorder="$ans"
19773                         ;;
19774                 *)      byteorder=$dflt
19775                         ;;
19776                 esac
19777                 ;;
19778         esac
19779         $rm_try
19780         ;;
19781 esac
19782
19783 : Checking 32bit alignedness
19784 $cat <<EOM
19785
19786 Checking to see whether you can access character data unalignedly...
19787 EOM
19788 case "$d_u32align" in
19789 '')   $cat >try.c <<EOCP
19790 #include <stdio.h>
19791 #$i_stdlib I_STDLIB
19792 #ifdef I_STDLIB
19793 #include <stdlib.h>
19794 #endif
19795 #define U32 $u32type
19796 #define BYTEORDER 0x$byteorder
19797 #define U8 $u8type
19798 #include <signal.h>
19799 #ifdef SIGBUS
19800 $signal_t bletch(int s) { exit(4); }
19801 #endif
19802 int main() {
19803 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19804     volatile U8 buf[8];
19805     volatile U32 *up;
19806     int i;
19807
19808     if (sizeof(U32) != 4) {
19809         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19810         exit(1);
19811     }
19812
19813     fflush(stdout);
19814
19815 #ifdef SIGBUS
19816     signal(SIGBUS, bletch);
19817 #endif
19818
19819     buf[0] = 0;
19820     buf[1] = 0;
19821     buf[2] = 0;
19822     buf[3] = 1;
19823     buf[4] = 0;
19824     buf[5] = 0;
19825     buf[6] = 0;
19826     buf[7] = 1;
19827
19828     for (i = 0; i < 4; i++) {
19829         up = (U32*)(buf + i);
19830         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19831                (*up == 1 << (8*(3-i)))  /* little-endian */
19832               )
19833            )
19834         {
19835             printf("read failed (%x)\n", *up);
19836             exit(2);
19837         }
19838     }
19839
19840     /* write test */
19841     for (i = 0; i < 4; i++) {
19842         up = (U32*)(buf + i);
19843         *up = 0xBeef;
19844         if (*up != 0xBeef) {
19845             printf("write failed (%x)\n", *up);
19846             exit(3);
19847         }
19848     }
19849
19850     exit(0);
19851 #else
19852     printf("1\n");
19853     exit(1);
19854 #endif
19855     return 0;
19856 }
19857 EOCP
19858 set try
19859 if eval $compile_ok; then
19860         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19861         $run ./try 2>&1 >/dev/null
19862         case "$?" in
19863         0)      cat >&4 <<EOM
19864 You can access character data pretty unalignedly.
19865 EOM
19866                 d_u32align="$undef"
19867                 ;;
19868         *)      cat >&4 <<EOM
19869 It seems that you must access character data in an aligned manner.
19870 EOM
19871                 d_u32align="$define"
19872                 ;;
19873         esac
19874 else
19875         rp='Can you access character data at unaligned addresses?'
19876         dflt='n'
19877         . ./myread
19878         case "$ans" in
19879         [yY]*)  d_u32align="$undef"  ;;
19880         *)      d_u32align="$define" ;;
19881         esac
19882 fi
19883 $rm_try
19884 ;;
19885 esac
19886
19887 : see if ualarm exists
19888 set ualarm d_ualarm
19889 eval $inlibc
19890
19891 : see if umask exists
19892 set umask d_umask
19893 eval $inlibc
19894
19895 : see if unordered exists
19896 set unordered d_unordered
19897 eval $inlibc
19898
19899 : see if unsetenv exists
19900 set unsetenv d_unsetenv
19901 eval $inlibc
19902
19903 : see if usleep exists
19904 set usleep d_usleep
19905 eval $inlibc
19906
19907 : see if prototype for usleep is available
19908 echo " "
19909 set d_usleepproto usleep $i_unistd unistd.h
19910 eval $hasproto
19911
19912 : see if ustat exists
19913 set ustat d_ustat
19914 eval $inlibc
19915
19916 : see if closedir exists
19917 set closedir d_closedir
19918 eval $inlibc
19919
19920 case "$d_closedir" in
19921 "$define")
19922         echo " "
19923         echo "Checking whether closedir() returns a status..." >&4
19924         cat > try.c <<EOM
19925 #$i_dirent I_DIRENT             /**/
19926 #$i_sysdir I_SYS_DIR            /**/
19927 #$i_sysndir I_SYS_NDIR          /**/
19928 #$i_systypes I_SYS_TYPES        /**/
19929
19930 #if defined(I_SYS_TYPES)
19931 #include <sys/types.h>
19932 #endif
19933 #if defined(I_DIRENT)
19934 #include <dirent.h>
19935 #else
19936 #ifdef I_SYS_NDIR
19937 #include <sys/ndir.h>
19938 #else
19939 #ifdef I_SYS_DIR
19940 #ifdef hp9000s500
19941 #include <ndir.h>       /* may be wrong in the future */
19942 #else
19943 #include <sys/dir.h>
19944 #endif
19945 #endif
19946 #endif
19947 #endif
19948 int main() { return closedir(opendir(".")); }
19949 EOM
19950         set try
19951         if eval $compile_ok; then
19952                 if $run ./try > /dev/null 2>&1 ; then
19953                         echo "Yes, it does."
19954                         val="$undef"
19955                 else
19956                         echo "No, it doesn't."
19957                         val="$define"
19958                 fi
19959         else
19960                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19961                 val="$define"
19962         fi
19963         ;;
19964 *)
19965         val="$undef";
19966         ;;
19967 esac
19968 set d_void_closedir
19969 eval $setvar
19970 $rm_try
19971
19972 : see if there is a wait4
19973 set wait4 d_wait4
19974 eval $inlibc
19975
19976 : see if waitpid exists
19977 set waitpid d_waitpid
19978 eval $inlibc
19979
19980 : look for wcscmp
19981 echo " "
19982 $cat >try.c <<'EOCP'
19983 #include <stdio.h>
19984 #include <wchar.h>
19985 int main ()
19986 {
19987     wchar_t *s = L" ";
19988     return (wcscmp (s, s) ? 1 : 0);
19989     }
19990 EOCP
19991 set try
19992 val="$undef"
19993 if eval $compile; then
19994     `$run ./try`
19995     case "$?" in
19996         0)  echo "A working wcscmp() found." >&4
19997             val="$define" ;;
19998         *)  echo "wcscmp() found, but it doesn't work" >&4
19999             ;;
20000         esac
20001 else
20002     echo "wcscmp() NOT found." >&4
20003     fi
20004 set d_wcscmp
20005 eval $setvar
20006 $rm_try
20007
20008 : see if wcstombs exists
20009 set wcstombs d_wcstombs
20010 eval $inlibc
20011
20012 : look for wcsxfrm
20013 echo " "
20014 $cat >try.c <<'EOCP'
20015 #include <errno.h>
20016 #include <wchar.h>
20017 int main ()
20018 {
20019     wchar_t dst[4], *src = L" ";
20020     errno = 0;
20021     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
20022     }
20023 EOCP
20024 set try
20025 val="$undef"
20026 if eval $compile; then
20027     `$run ./try`
20028     case "$?" in
20029         0)  echo "A working wcsxfrm() found." >&4
20030             val="$define" ;;
20031         *)  echo "wcsxfrm() found, but it doesn't work" >&4
20032             ;;
20033         esac
20034 else
20035     echo "wcsxfrm() NOT found." >&4
20036     fi
20037 set d_wcsxfrm
20038 eval $setvar
20039 $rm_try
20040
20041 : see if wctomb exists
20042 set wctomb d_wctomb
20043 eval $inlibc
20044
20045 : see if writev exists
20046 set writev d_writev
20047 eval $inlibc
20048
20049 : check for alignment requirements
20050 echo " "
20051 case "$alignbytes" in
20052     '') echo "Checking alignment constraints..." >&4
20053         if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
20054             $cat >try.c <<'EOCP'
20055 typedef long double NV;
20056 EOCP
20057         else
20058             $cat >try.c <<'EOCP'
20059 typedef double NV;
20060 EOCP
20061         fi
20062         $cat >>try.c <<'EOCP'
20063 #include <stdio.h>
20064 struct foobar {
20065     char foo;
20066     NV bar;
20067 } try_algn;
20068 int main()
20069 {
20070     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20071     return(0);
20072 }
20073 EOCP
20074         set try
20075         if eval $compile_ok; then
20076             dflt=`$run ./try`
20077         else
20078             dflt='8'
20079             echo "(I can't seem to compile the test program...)"
20080         fi
20081         case "$multiarch" in
20082             *$define*)
20083                 : The usual safe value is 8, but Darwin with -Duselongdouble
20084                 : needs 16.  Hence, we will take 8 as a minimum, but allow
20085                 : Configure to pick a larger value if needed.
20086                 if $test "$dflt" -lt 8; then
20087                     dflt='8'
20088                     echo "Setting alignment to 8 for multiarch support.">&4
20089                 fi
20090                 ;;
20091         esac
20092         ;;
20093     *) dflt="$alignbytes"
20094         ;;
20095 esac
20096 rp="Doubles must be aligned on a how-many-byte boundary?"
20097 . ./myread
20098 alignbytes="$ans"
20099 $rm_try
20100
20101 : set the base revision
20102 baserev=5.0
20103
20104 : length of character in bytes. Is always 1, otherwise it is not C
20105 : This used to be a test using sizeof
20106 charsize=1
20107
20108 : Check for the number of bits in a character
20109 case "$charbits" in
20110 '')     echo "Checking how long a character is (in bits)..." >&4
20111         $cat >try.c <<EOCP
20112 #include <stdio.h>
20113 int main ()
20114 {
20115     int n;
20116     unsigned char c;
20117     for (c = 1, n = 0; c; c <<= 1, n++) ;
20118     printf ("%d\n", n);
20119     return (0);
20120     }
20121 EOCP
20122         set try
20123         if eval $compile_ok; then
20124                 dflt=`$run ./try`
20125         else
20126                 dflt='8'
20127                 echo "(I can't seem to compile the test program.  Guessing...)"
20128         fi
20129         ;;
20130 *)
20131         dflt="$charbits"
20132         ;;
20133 esac
20134 rp="What is the length of a character (in bits)?"
20135 . ./myread
20136 charbits="$ans"
20137 $rm_try
20138 case "$charbits" in
20139 8)      ;;
20140 *)      cat >&4 << EOM
20141 Your system has an unsigned character size of $charbits bits, which
20142 is rather unusual (normally it is 8 bits).  Perl likely will not work
20143 correctly on your system, with subtle bugs in various places.
20144 EOM
20145         rp='Do you really want to continue?'
20146         dflt='n'
20147         . ./myread
20148         case "$ans" in
20149                 [yY])   echo >&4 "Okay, continuing."    ;;
20150                 *)      exit 1                          ;;
20151         esac
20152 esac
20153
20154 : how do we concatenate cpp tokens here?
20155 echo " "
20156 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20157 $cat >cpp_stuff.c <<'EOCP'
20158 #define RCAT(a,b)a/**/b
20159 #define ACAT(a,b)a ## b
20160 RCAT(Rei,ser)
20161 ACAT(Cir,cus)
20162 EOCP
20163 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20164 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20165         echo "Oh!  Smells like ANSI's been here." >&4
20166         echo "We can catify or stringify, separately or together!"
20167         cpp_stuff=42
20168 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20169         echo "Ah, yes!  The good old days!" >&4
20170         echo "However, in the good old days we don't know how to stringify and"
20171         echo "catify at the same time."
20172         cpp_stuff=1
20173 else
20174         $cat >&4 <<EOM
20175 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20176 You're going to have to edit the values of CAT[2-5] in config.h...
20177 EOM
20178         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20179 fi
20180 $rm -f cpp_stuff.*
20181
20182 : see if this is a db.h system
20183 set db.h i_db
20184 eval $inhdr
20185
20186 case "$i_db" in
20187 $define)
20188         : Check db version.
20189         echo " "
20190         echo "Checking Berkeley DB version ..." >&4
20191         $cat >try.c <<EOCP
20192 #$d_const HASCONST
20193 #ifndef HASCONST
20194 #define const
20195 #endif
20196 #include <sys/types.h>
20197 #include <stdio.h>
20198 #$i_stdlib I_STDLIB
20199 #ifdef I_STDLIB
20200 #include <stdlib.h>
20201 #endif
20202 #include <db.h>
20203 int main(int argc, char *argv[])
20204 {
20205 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20206     int Major, Minor, Patch ;
20207     unsigned long Version ;
20208     (void)db_version(&Major, &Minor, &Patch) ;
20209     if (argc == 2) {
20210         printf("%d %d %d %d %d %d\n",
20211                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20212                Major, Minor, Patch);
20213         exit(0);
20214     }
20215     printf("You have Berkeley DB Version 2 or greater.\n");
20216
20217     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20218                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20219     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20220                 Major, Minor, Patch) ;
20221
20222     /* check that db.h & libdb are compatible */
20223     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20224         printf("db.h and libdb are incompatible.\n") ;
20225         exit(3);
20226     }
20227
20228     printf("db.h and libdb are compatible.\n") ;
20229
20230     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20231                 + DB_VERSION_PATCH ;
20232
20233     /* needs to be >= 2.3.4 */
20234     if (Version < 2003004) {
20235     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20236         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20237         exit(2);
20238     }
20239
20240     exit(0);
20241 #else
20242 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20243     if (argc == 2) {
20244         printf("1 0 0\n");
20245         exit(0);
20246     }
20247     printf("You have Berkeley DB Version 1.\n");
20248     exit(0);    /* DB version < 2: the coast is clear. */
20249 #else
20250     exit(1);    /* <db.h> not Berkeley DB? */
20251 #endif
20252 #endif
20253 }
20254 EOCP
20255         set try
20256         if eval $compile_ok && $run ./try; then
20257                 echo 'Looks OK.' >&4
20258                 set `$run ./try 1`
20259                 db_version_major=$1
20260                 db_version_minor=$2
20261                 db_version_patch=$3
20262         else
20263                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20264                 i_db=$undef
20265                 case " $libs " in
20266                 *"-ldb "*)
20267                         : Remove db from list of libraries to use
20268                         echo "Removing unusable -ldb from library list" >&4
20269                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20270                         shift
20271                         libs="$*"
20272                         echo "libs = $libs" >&4
20273                         ;;
20274                 esac
20275         fi
20276         $rm_try
20277         ;;
20278 esac
20279
20280 case "$i_db" in
20281 define)
20282         : Check the return type needed for hash
20283         echo " "
20284         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20285         $cat >try.c <<EOCP
20286 #$d_const HASCONST
20287 #ifndef HASCONST
20288 #define const
20289 #endif
20290 #include <sys/types.h>
20291 #include <db.h>
20292
20293 #ifndef DB_VERSION_MAJOR
20294 u_int32_t hash_cb (const void* ptr, size_t size)
20295 {
20296 }
20297 HASHINFO info;
20298 int main()
20299 {
20300         info.hash = hash_cb;
20301 }
20302 #endif
20303 EOCP
20304         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20305                 if $contains warning try.out >>/dev/null 2>&1 ; then
20306                         db_hashtype='int'
20307                 else
20308                         db_hashtype='u_int32_t'
20309                 fi
20310         else
20311                 : XXX Maybe we should just give up here.
20312                 db_hashtype=u_int32_t
20313                 $cat try.out >&4
20314                 echo "Help:  I can't seem to compile the db test program." >&4
20315                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20316         fi
20317         $rm_try
20318         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20319         ;;
20320 *)      db_hashtype=u_int32_t
20321         ;;
20322 esac
20323 case "$i_db" in
20324 define)
20325         : Check the return type needed for prefix
20326         echo " "
20327         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20328         cat >try.c <<EOCP
20329 #$d_const HASCONST
20330 #ifndef HASCONST
20331 #define const
20332 #endif
20333 #include <sys/types.h>
20334 #include <db.h>
20335
20336 #ifndef DB_VERSION_MAJOR
20337 size_t prefix_cb (const DBT *key1, const DBT *key2)
20338 {
20339 }
20340 BTREEINFO info;
20341 int main()
20342 {
20343         info.prefix = prefix_cb;
20344 }
20345 #endif
20346 EOCP
20347         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20348                 if $contains warning try.out >>/dev/null 2>&1 ; then
20349                         db_prefixtype='int'
20350                 else
20351                         db_prefixtype='size_t'
20352                 fi
20353         else
20354                 db_prefixtype='size_t'
20355                 : XXX Maybe we should just give up here.
20356                 $cat try.out >&4
20357                 echo "Help:  I can't seem to compile the db test program." >&4
20358                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20359         fi
20360         $rm_try
20361         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20362         ;;
20363 *)      db_prefixtype='size_t'
20364         ;;
20365 esac
20366
20367 : Check what kind of inf/nan your system has
20368 $echo "Checking the kind of infinities and nans you have..." >&4
20369 $cat >try.c <<EOP
20370 #define DOUBLESIZE $doublesize
20371 #$d_longdbl HAS_LONG_DOUBLE
20372 #ifdef HAS_LONG_DOUBLE
20373 #define LONGDBLSIZE $longdblsize
20374 #define LONGDBLKIND $longdblkind
20375 #endif
20376 #$i_math I_MATH
20377 #ifdef I_MATH
20378 #include <math.h>
20379 #endif
20380 #include <stdio.h>
20381 /* Note that whether the sign bit is on or off
20382  * for NaN depends on the CPU/FPU, and possibly
20383  * can be affected by the build toolchain.
20384  *
20385  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20386  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20387  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20388  * (respectively) as opposed to the more usual
20389  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20390  */
20391 static void bytes(unsigned char *p, unsigned int n) {
20392   int i;
20393   for (i = 0; i < n; i++) {
20394     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20395   }
20396 }
20397 int main(int argc, char *argv[]) {
20398    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20399     * because some compilers are 'smart' and not only warn but refuse to
20400     * compile such 'illegal' values. */
20401    double dinf = exp(1e9);
20402    double dnan = sqrt(-1.0);
20403 #ifdef HAS_LONG_DOUBLE
20404    long double ldinf = (long double)exp(1e9);
20405    long double ldnan = (long double)sqrt(-1.0);
20406 #endif
20407   if (argc == 2) {
20408     switch (argv[1][0]) {
20409     case '1': bytes(&dinf, sizeof(dinf)); break;
20410     case '2': bytes(&dnan, sizeof(dnan)); break;
20411 #ifdef HAS_LONG_DOUBLE
20412 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20413 /* the 80-bit long doubles might have garbage in their excess bytes */
20414     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20415 # endif
20416     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20417     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20418 #endif
20419     }
20420   }
20421   return 0;
20422 }
20423 EOP
20424 set try
20425 if eval $compile; then
20426     doubleinfbytes=`$run ./try 1`
20427     doublenanbytes=`$run ./try 2`
20428     case "$d_longdbl" in
20429     $define)
20430       longdblinfbytes=`$run ./try 3`
20431       longdblnanbytes=`$run ./try 4`
20432       ;;
20433     esac
20434 else
20435     # Defaults in case the above test program failed.
20436     case "$doublekind" in
20437     1) # IEEE 754 32-bit LE
20438        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20439        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20440        ;;
20441     2) # IEEE 754 32-bit BE
20442        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20443        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20444        ;;
20445     3) # IEEE 754 64-bit LE
20446        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20447        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20448        ;;
20449     4) # IEEE 754 64-bit BE
20450        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20451        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20452        ;;
20453     5) # IEEE 754 128-bit LE
20454        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20455        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20456        ;;
20457     6) # IEEE 754 128-bit BE
20458        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20459        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20460        ;;
20461     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20462        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20463        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20464        ;;
20465     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20466        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20467        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20468        ;;
20469     *) # No idea.
20470        doubleinfbytes=$undef
20471        doublenanbytes=$undef
20472        ;;
20473     esac
20474     case "$longdblkind" in
20475     1) # IEEE 754 128-bit LE
20476        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20477        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20478        ;;
20479     2) # IEEE 754 128-bit BE
20480        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20481        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20482        ;;
20483     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20484        case "$longdblsize" in
20485        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20486            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20487            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20488            ;;
20489        16) # x86_64
20490            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20491            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20492            ;;
20493        *)  # No idea.
20494            longdblinfbytes=$undef
20495            longdblnanbytes=$undef
20496        ;;
20497        esac
20498        ;;
20499     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20500        case "$longdblsize" in
20501        12) # 32-bit system
20502            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20503            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20504            ;;
20505        16) # 64-bit system
20506            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20507            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20508            ;;
20509        *)  # No idea.
20510            longdblinfbytes=$undef
20511            longdblnanbytes=$undef
20512        ;;
20513        esac
20514        ;;
20515     5) # 128-bit LE "double double"
20516        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20517        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20518        ;;
20519     6) # 128-bit BE "double double"
20520        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20521        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20522        ;;
20523     *) # No idea.
20524        longdblinfbytes=$undef
20525        longdblnanbytes=$undef
20526        ;;
20527     esac
20528 fi
20529 $rm_try
20530
20531 : Check the length of the double mantissa
20532 $echo "Checking how many mantissa bits your doubles have..." >&4
20533 $cat >try.c <<EOP
20534 #$i_float I_FLOAT
20535 #$i_sunmath I_SUNMATH
20536 #ifdef I_FLOAT
20537 # include <float.h>
20538 #endif
20539 #ifdef I_SUNMATH
20540 # include <sunmath.h>
20541 #endif
20542 #ifdef DBL_MANT_DIG
20543 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20544 #endif
20545 #include <stdio.h>
20546 int main(int argc, char *argv[]) {
20547 #ifdef BITS
20548   printf("%d\n", BITS);
20549 #endif
20550   return 0;
20551 }
20552 EOP
20553 set try
20554 if eval $compile; then
20555     doublemantbits=`$run ./try`
20556 else
20557     doublemantbits="$undef"
20558 fi
20559 $rm_try
20560
20561 : Check the length of the longdouble mantissa
20562 $echo "Checking how many mantissa bits your long doubles have..." >&4
20563 $cat >try.c <<EOP
20564 #$i_float I_FLOAT
20565 #$i_sunmath I_SUNMATH
20566 #ifdef I_FLOAT
20567 # include <float.h>
20568 #endif
20569 #ifdef I_SUNMATH
20570 # include <sunmath.h>
20571 #endif
20572 #$d_longdbl HAS_LONG_DOUBLE
20573 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20574 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20575 /* This format has no implicit bit.  Beware, however, that for
20576  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20577  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20578  * and the top bit must have been one since 387, zero is plain invalid.
20579  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20580 #  define BITS LDBL_MANT_DIG
20581 # elif ($longdblkind == 5 || $longdblkind == 6) /* double double */
20582 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20583  * reason e.g. Irix thinks 107.  But in any case, we want only
20584  * the number of real bits, the implicit bits are of no interest.  */
20585 #  define BITS 2 * (DBL_MANT_DIG - 1)
20586 # else
20587 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20588 # endif
20589 #endif
20590 #include <stdio.h>
20591 int main(int argc, char *argv[]) {
20592 #ifdef BITS
20593   printf("%d\n", BITS);
20594 #endif
20595   return 0;
20596 }
20597 EOP
20598 set try
20599 if eval $compile; then
20600     longdblmantbits=`$run ./try`
20601 else
20602     longdblmantbits="$undef"
20603 fi
20604 $rm_try
20605
20606 : Check the length of the NV mantissa
20607 $echo "Checking how many mantissa bits your NVs have..." >&4
20608 if test "X$usequadmath" = "X$define"; then
20609   nvmantbits=112 # 128-1-15
20610 else
20611   if test "X$nvsize" = "X$doublesize"; then
20612     nvmantbits="$doublemantbits"
20613   else
20614      if test "X$nvsize" = "X$longdblsize"; then
20615        nvmantbits="$longdblmantbits"
20616      else
20617        nvmantbits="$undef"
20618      fi
20619   fi
20620 fi
20621
20622 : How can we generate normalized random numbers ?
20623 echo " "
20624 echo "Using our internal random number implementation..." >&4
20625
20626 case "$ccflags" in
20627 *-Dmy_rand=*|*-Dmy_srand=*)
20628         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20629         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20630         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20631         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20632         ;;
20633 esac
20634
20635 randfunc=Perl_drand48
20636 drand01="Perl_drand48()"
20637 seedfunc="Perl_drand48_init"
20638 randbits=48
20639 randseedtype=U32
20640
20641 : Determine if this is an EBCDIC system
20642 echo " "
20643 echo "Determining whether or not we are on an EBCDIC system..." >&4
20644 $cat >try.c <<'EOM'
20645 int main()
20646 {
20647   if ('M'==0xd4) return 0;
20648   return 1;
20649 }
20650 EOM
20651
20652 val=$undef
20653 set try
20654 if eval $compile_ok; then
20655         if $run ./try; then
20656                 echo "You seem to speak EBCDIC." >&4
20657                 val="$define"
20658         else
20659                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20660         fi
20661 else
20662         echo "I'm unable to compile the test program." >&4
20663         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20664 fi
20665 $rm_try
20666 set ebcdic
20667 eval $setvar
20668
20669 : Check how to flush
20670 echo " "
20671 $cat >&4 <<EOM
20672 Checking how to flush all pending stdio output...
20673 EOM
20674 # I only know how to find the first 32 possibly open files on SunOS.
20675 # See also hints/sunos_4_1.sh and util.c  --AD
20676 case "$osname" in
20677 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20678 esac
20679 $cat >>try.c <<EOCP
20680 #include <stdio.h>
20681 #$i_stdlib I_STDLIB
20682 #ifdef I_STDLIB
20683 #include <stdlib.h>
20684 #endif
20685 #$i_unistd I_UNISTD
20686 #ifdef I_UNISTD
20687 # include <unistd.h>
20688 #endif
20689 #$d_sysconf HAS_SYSCONF
20690 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20691 #ifdef HAS_STDIO_STREAM_ARRAY
20692 # define STDIO_STREAM_ARRAY $stdio_stream_array
20693 #endif
20694 int main() {
20695   FILE* p;
20696   unlink("try.out");
20697   p = fopen("try.out", "w");
20698 #ifdef TRY_FPUTC
20699   fputc('x', p);
20700 #else
20701 # ifdef TRY_FPRINTF
20702   fprintf(p, "x");
20703 # endif
20704 #endif
20705 #ifdef TRY_FFLUSH_NULL
20706   fflush(NULL);
20707 #endif
20708 #ifdef TRY_FFLUSH_ALL
20709   {
20710     long open_max = -1;
20711 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20712     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20713 # else
20714 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20715     open_max = sysconf(_SC_OPEN_MAX);
20716 #  else
20717 #   ifdef FOPEN_MAX
20718     open_max = FOPEN_MAX;
20719 #   else
20720 #    ifdef OPEN_MAX
20721     open_max = OPEN_MAX;
20722 #    else
20723 #     ifdef _NFILE
20724     open_max = _NFILE;
20725 #     endif
20726 #    endif
20727 #   endif
20728 #  endif
20729 # endif
20730 # ifdef HAS_STDIO_STREAM_ARRAY
20731     if (open_max > 0) {
20732       long i;
20733       for (i = 0; i < open_max; i++)
20734             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20735                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20736                 STDIO_STREAM_ARRAY[i]._flag)
20737                 fflush(&STDIO_STREAM_ARRAY[i]);
20738     }
20739   }
20740 # endif
20741 #endif
20742   _exit(42);
20743 }
20744 EOCP
20745 : first we have to find out how _not_ to flush
20746 $to try.c
20747 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20748     output=''
20749     set try -DTRY_FPUTC
20750     if eval $compile; then
20751             $run ./try 2>/dev/null
20752             code="$?"
20753             $from try.out
20754             if $test ! -s try.out -a "X$code" = X42; then
20755                 output=-DTRY_FPUTC
20756             fi
20757     fi
20758     case "$output" in
20759     '')
20760             set try -DTRY_FPRINTF
20761             if eval $compile; then
20762                     $run ./try 2>/dev/null
20763                     code="$?"
20764                     $from try.out
20765                     if $test ! -s try.out -a "X$code" = X42; then
20766                         output=-DTRY_FPRINTF
20767                     fi
20768             fi
20769         ;;
20770     esac
20771 fi
20772 : check for fflush NULL behavior
20773 case "$fflushNULL" in
20774 '')     set try -DTRY_FFLUSH_NULL $output
20775         if eval $compile; then
20776                 $run ./try 2>/dev/null
20777                 code="$?"
20778                 $from try.out
20779                 if $test -s try.out -a "X$code" = X42; then
20780                         fflushNULL="`$cat try.out`"
20781                 else
20782                         if $test "X$code" != X42; then
20783                                 $cat >&4 <<EOM
20784 (If this test failed, don't worry, we'll try another method shortly.)
20785 EOM
20786                         fi
20787                 fi
20788         fi
20789         $rm -f core try.core core.try.*
20790         case "$fflushNULL" in
20791         x)      $cat >&4 <<EOM
20792 Your fflush(NULL) works okay for output streams.
20793 Let's see if it clobbers input pipes...
20794 EOM
20795 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20796 # bug that improperly flushes the input end of pipes.  So we avoid the
20797 # autoflush on fork/system/exec support for now. :-(
20798 $cat >tryp.c <<EOCP
20799 #include <stdio.h>
20800 int
20801 main(int argc, char **argv)
20802 {
20803     char buf[1024];
20804     int i;
20805     char *bp = buf;
20806     while (1) {
20807         while ((i = getc(stdin)) != -1
20808                && (*bp++ = i) != '\n'
20809                && bp < &buf[1024])
20810         /* DO NOTHING */ ;
20811         *bp = '\0';
20812         fprintf(stdout, "%s", buf);
20813         fflush(NULL);
20814         if (i == -1)
20815             return 0;
20816         bp = buf;
20817     }
20818 }
20819 EOCP
20820                 fflushNULL="$define"
20821                 set tryp
20822                 if eval $compile; then
20823                     $rm -f tryp.out
20824                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20825                     if $test "X$targethost" != X; then
20826                         $to tryp.c
20827                         $to tryp
20828                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20829                     else
20830                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20831                     fi
20832                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20833                        $cat >&4 <<EOM
20834 fflush(NULL) seems to behave okay with input streams.
20835 EOM
20836                         fflushNULL="$define"
20837                     else
20838                         $cat >&4 <<EOM
20839 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20840 EOM
20841                         fflushNULL="$undef"
20842                     fi
20843                 fi
20844                 $rm -f core tryp.c tryp.core core.tryp.*
20845                 ;;
20846         '')     $cat >&4 <<EOM
20847 Your fflush(NULL) isn't working (contrary to ANSI C).
20848 EOM
20849                 fflushNULL="$undef"
20850                 ;;
20851         *)      $cat >&4 <<EOM
20852 Cannot figure out whether your fflush(NULL) works or not.
20853 I'm assuming it doesn't (contrary to ANSI C).
20854 EOM
20855                 fflushNULL="$undef"
20856                 ;;
20857         esac
20858         ;;
20859 $define|true|[yY]*)
20860         fflushNULL="$define"
20861         ;;
20862 *)
20863         fflushNULL="$undef"
20864         ;;
20865 esac
20866 : check explicit looping only if NULL did not work, and if the pipe
20867 : bug does not show up on an explicit flush too
20868 case "$fflushNULL" in
20869 "$undef")
20870         $cat >tryp.c <<EOCP
20871 #include <stdio.h>
20872 int
20873 main(int argc, char **argv)
20874 {
20875     char buf[1024];
20876     int i;
20877     char *bp = buf;
20878     while (1) {
20879         while ((i = getc(stdin)) != -1
20880                && (*bp++ = i) != '\n'
20881                && bp < &buf[1024])
20882         /* DO NOTHING */ ;
20883         *bp = '\0';
20884         fprintf(stdout, "%s", buf);
20885         fflush(stdin);
20886         if (i == -1)
20887             return 0;
20888         bp = buf;
20889     }
20890 }
20891 EOCP
20892         set tryp
20893         if eval $compile; then
20894             $rm -f tryp.out
20895             if $test "X$targethost" != X; then
20896                 $to tryp.c
20897                 $to tryp
20898                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20899             else
20900                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20901             fi
20902             if cmp tryp.c tryp.out >/dev/null 2>&1; then
20903                $cat >&4 <<EOM
20904 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20905 EOM
20906                 : now check for fflushall behaviour
20907                 case "$fflushall" in
20908                 '')     set try -DTRY_FFLUSH_ALL $output
20909                         if eval $compile; then
20910                                 $cat >&4 <<EOM
20911 (Now testing the other method--but note that this also may fail.)
20912 EOM
20913                                 $run ./try 2>/dev/null
20914                                 code=$?
20915                                 $from try.out
20916                                 if $test -s try.out -a "X$code" = X42; then
20917                                         fflushall="`$cat try.out`"
20918                                 fi
20919                         fi
20920                         $rm_try
20921                         case "$fflushall" in
20922                         x)      $cat >&4 <<EOM
20923 Whew. Flushing explicitly all the stdio streams works.
20924 EOM
20925                                 fflushall="$define"
20926                                 ;;
20927                         '')     $cat >&4 <<EOM
20928 Sigh. Flushing explicitly all the stdio streams doesn't work.
20929 EOM
20930                                 fflushall="$undef"
20931                                 ;;
20932                         *)      $cat >&4 <<EOM
20933 Cannot figure out whether flushing stdio streams explicitly works or not.
20934 I'm assuming it doesn't.
20935 EOM
20936                                 fflushall="$undef"
20937                                 ;;
20938                         esac
20939                         ;;
20940                 "$define"|true|[yY]*)
20941                         fflushall="$define"
20942                         ;;
20943                 *)
20944                         fflushall="$undef"
20945                         ;;
20946                 esac
20947             else
20948                 $cat >&4 <<EOM
20949 All is futile.  Even fflush(stdin) clobbers input pipes!
20950 EOM
20951                 fflushall="$undef"
20952             fi
20953         else
20954             fflushall="$undef"
20955         fi
20956         $rm -f core tryp.c tryp.core core.tryp.*
20957         ;;
20958 *)      fflushall="$undef"
20959         ;;
20960 esac
20961
20962 case "$fflushNULL$fflushall" in
20963 undefundef)
20964         $cat <<EOM
20965 OK, I give up.  I cannot figure out how to flush pending stdio output.
20966 We won't be flushing handles at all before fork/exec/popen.
20967 EOM
20968         ;;
20969 esac
20970 $rm_try tryp
20971
20972 : Store the full pathname to the ar program for use in the C program
20973 : Respect a hint or command line value for full_ar.
20974 case "$full_ar" in
20975 '') full_ar=$ar ;;
20976 esac
20977
20978 : Store the full pathname to the sed program for use in the C program
20979 full_sed=$sed
20980
20981 : see what type gids are declared as in the kernel
20982 echo " "
20983 echo "Looking for the type for group ids returned by getgid()."
20984 set gid_t gidtype xxx stdio.h sys/types.h
20985 eval $typedef
20986 case "$gidtype" in
20987 xxx)
20988         xxx=`./findhdr sys/user.h`
20989         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
20990         case $1 in
20991         unsigned) dflt="$1 $2" ;;
20992         *) dflt="$1" ;;
20993         esac
20994         ;;
20995 *) dflt="$gidtype";;
20996 esac
20997 case "$gidtype" in
20998 gid_t) echo "gid_t found." ;;
20999 *)      rp="What is the type for group ids returned by getgid()?"
21000         . ./myread
21001         gidtype="$ans"
21002         ;;
21003 esac
21004
21005 : Check the size of GID
21006 echo " "
21007 case "$gidtype" in
21008 *_t) zzz="$gidtype"     ;;
21009 *)   zzz="gid"          ;;
21010 esac
21011 echo "Checking the size of $zzz..." >&4
21012 cat > try.c <<EOCP
21013 #include <sys/types.h>
21014 #include <stdio.h>
21015 #$i_stdlib I_STDLIB
21016 #ifdef I_STDLIB
21017 #include <stdlib.h>
21018 #endif
21019 int main() {
21020     printf("%d\n", (int)sizeof($gidtype));
21021     exit(0);
21022 }
21023 EOCP
21024 set try
21025 if eval $compile_ok; then
21026         yyy=`$run ./try`
21027         case "$yyy" in
21028         '')     gidsize=4
21029                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
21030                 ;;
21031         *)      gidsize=$yyy
21032                 echo "Your $zzz is $gidsize bytes long."
21033                 ;;
21034         esac
21035 else
21036         gidsize=4
21037         echo "(I can't compile the test program--guessing $gidsize.)" >&4
21038 fi
21039
21040
21041 : Check if GID is signed
21042 echo " "
21043 case "$gidtype" in
21044 *_t) zzz="$gidtype"     ;;
21045 *)   zzz="gid"          ;;
21046 esac
21047 echo "Checking the sign of $zzz..." >&4
21048 cat > try.c <<EOCP
21049 #include <sys/types.h>
21050 #include <stdio.h>
21051 int main() {
21052         $gidtype foo = -1;
21053         if (foo < 0)
21054                 printf("-1\n");
21055         else
21056                 printf("1\n");
21057 }
21058 EOCP
21059 set try
21060 if eval $compile; then
21061         yyy=`$run ./try`
21062         case "$yyy" in
21063         '')     gidsign=1
21064                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21065                 ;;
21066         *)      gidsign=$yyy
21067                 case "$gidsign" in
21068                  1) echo "Your $zzz is unsigned." ;;
21069                 -1) echo "Your $zzz is signed."   ;;
21070                 esac
21071                 ;;
21072         esac
21073 else
21074         gidsign=1
21075         echo "(I can't compile the test program--guessing unsigned.)" >&4
21076 fi
21077
21078
21079 : Check 64bit sizes
21080 echo " "
21081
21082 if $test X"$quadtype" != X; then
21083
21084 echo "Checking how to print 64-bit integers..." >&4
21085
21086 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21087         $cat >try.c <<'EOCP'
21088 #include <sys/types.h>
21089 #include <stdio.h>
21090 int main() {
21091   int q = 12345678901;
21092   printf("%ld\n", q);
21093 }
21094 EOCP
21095         set try
21096         if eval $compile; then
21097                 yyy=`$run ./try`
21098                 case "$yyy" in
21099                 12345678901)
21100                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21101                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21102                         echo "We will use %d."
21103                         ;;
21104                 esac
21105         fi
21106 fi
21107
21108 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21109         $cat >try.c <<'EOCP'
21110 #include <sys/types.h>
21111 #include <stdio.h>
21112 int main() {
21113   long q = 12345678901;
21114   printf("%ld\n", q);
21115 }
21116 EOCP
21117         set try
21118         if eval $compile; then
21119                 yyy=`$run ./try`
21120                 case "$yyy" in
21121                 12345678901)
21122                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21123                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21124                         echo "We will use %ld."
21125                         ;;
21126                 esac
21127         fi
21128 fi
21129
21130 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21131         $cat >try.c <<'EOCP'
21132 #include <sys/types.h>
21133 #include <inttypes.h>
21134 #include <stdio.h>
21135 int main() {
21136   int64_t q = 12345678901;
21137   printf("%" PRId64 "\n", q);
21138 }
21139 EOCP
21140         set try
21141         if eval $compile; then
21142                 yyy=`$run ./try`
21143                 case "$yyy" in
21144                 12345678901)
21145                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21146                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
21147                         echo "We will use the C9X style."
21148                         ;;
21149                 esac
21150         fi
21151 fi
21152
21153 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21154         $cat >try.c <<EOCP
21155 #include <sys/types.h>
21156 #include <stdio.h>
21157 int main() {
21158   $quadtype q = 12345678901;
21159   printf("%Ld\n", q);
21160 }
21161 EOCP
21162         set try
21163         if eval $compile; then
21164                 yyy=`$run ./try`
21165                 case "$yyy" in
21166                 12345678901)
21167                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21168                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21169                         echo "We will use %Ld."
21170                         ;;
21171                 esac
21172         fi
21173 fi
21174
21175 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21176         $cat >try.c <<'EOCP'
21177 #include <sys/types.h>
21178 #include <stdio.h>
21179 int main() {
21180   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21181   printf("%lld\n", q);
21182 }
21183 EOCP
21184         set try
21185         if eval $compile; then
21186                 yyy=`$run ./try`
21187                 case "$yyy" in
21188                 12345678901)
21189                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21190                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21191                         echo "We will use the %lld style."
21192                         ;;
21193                 esac
21194         fi
21195 fi
21196
21197 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21198         $cat >try.c <<EOCP
21199 #include <sys/types.h>
21200 #include <stdio.h>
21201 int main() {
21202   $quadtype q = 12345678901;
21203   printf("%qd\n", q);
21204 }
21205 EOCP
21206         set try
21207         if eval $compile; then
21208                 yyy=`$run ./try`
21209                 case "$yyy" in
21210                 12345678901)
21211                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21212                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21213                         echo "We will use %qd."
21214                         ;;
21215                 esac
21216         fi
21217 fi
21218
21219 if $test X"$sPRId64" = X; then
21220         echo "Cannot figure out how to print 64-bit integers." >&4
21221 fi
21222 $rm_try
21223
21224 fi
21225
21226 case "$sPRId64" in
21227 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21228         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21229         ;;
21230 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21231         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21232         ;;
21233 esac
21234
21235 : Check format strings for internal types
21236 echo " "
21237 $echo "Checking the format strings to be used for Perl's internal types..." >&4
21238
21239 if $test X"$ivsize" = X8; then
21240         ivdformat="$sPRId64"
21241         uvuformat="$sPRIu64"
21242         uvoformat="$sPRIo64"
21243         uvxformat="$sPRIx64"
21244         uvXUformat="$sPRIXU64"
21245 else
21246         if $test X"$ivsize" = X"$longsize"; then
21247                 ivdformat='"ld"'
21248                 uvuformat='"lu"'
21249                 uvoformat='"lo"'
21250                 uvxformat='"lx"'
21251                 uvXUformat='"lX"'
21252         else
21253                 if $test X"$ivsize" = X"$intsize"; then
21254                         ivdformat='"d"'
21255                         uvuformat='"u"'
21256                         uvoformat='"o"'
21257                         uvxformat='"x"'
21258                         uvXUformat='"X"'
21259                 else
21260                         : far out
21261                         if $test X"$ivsize" = X"$shortsize"; then
21262                                 ivdformat='"hd"'
21263                                 uvuformat='"hu"'
21264                                 uvoformat='"ho"'
21265                                 uvxformat='"hx"'
21266                                 uvXUformat='"hX"'
21267                         fi
21268                 fi
21269         fi
21270 fi
21271
21272 if $test X"$usequadmath" = X"$define"; then
21273     nveformat='"Qe"'
21274     nvfformat='"Qf"'
21275     nvgformat='"Qg"'
21276     nvEUformat='"QE"'
21277     nvFUformat='"QF"'
21278     nvGUformat='"QG"'
21279 else
21280     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21281         nveformat="$sPRIeldbl"
21282         nvfformat="$sPRIfldbl"
21283         nvgformat="$sPRIgldbl"
21284         nvEUformat="$sPRIEUldbl"
21285         nvFUformat="$sPRIFUldbl"
21286         nvGUformat="$sPRIGUldbl"
21287     else
21288         nveformat='"e"'
21289         nvfformat='"f"'
21290         nvgformat='"g"'
21291         nvEUformat='"E"'
21292         nvFUformat='"F"'
21293         nvGUformat='"G"'
21294     fi
21295 fi
21296
21297 case "$ivdformat" in
21298 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21299     exit 1
21300     ;;
21301 esac
21302
21303 : Check format string for GID
21304
21305 echo " "
21306 $echo "Checking the format string to be used for gids..." >&4
21307
21308 case "$gidsign" in
21309 -1)     if $test X"$gidsize" = X"$ivsize"; then
21310                 gidformat="$ivdformat"
21311         else
21312                 if $test X"$gidsize" = X"$longsize"; then
21313                         gidformat='"ld"'
21314                 else
21315                         if $test X"$gidsize" = X"$intsize"; then
21316                                 gidformat='"d"'
21317                         else
21318                                 if $test X"$gidsize" = X"$shortsize"; then
21319                                         gidformat='"hd"'
21320                                 fi
21321                         fi
21322                 fi
21323         fi
21324         ;;
21325 *)      if $test X"$gidsize" = X"$uvsize"; then
21326                 gidformat="$uvuformat"
21327         else
21328                 if $test X"$gidsize" = X"$longsize"; then
21329                         gidformat='"lu"'
21330                 else
21331                         if $test X"$gidsize" = X"$intsize"; then
21332                                 gidformat='"u"'
21333                         else
21334                                 if $test X"$gidsize" = X"$shortsize"; then
21335                                         gidformat='"hu"'
21336                                 fi
21337                         fi
21338                 fi
21339         fi
21340         ;;
21341 esac
21342
21343 : see if getgroups exists
21344 set getgroups d_getgrps
21345 eval $inlibc
21346
21347 : see if setgroups exists
21348 set setgroups d_setgrps
21349 eval $inlibc
21350
21351 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21352 echo " "
21353 case "$d_getgrps$d_setgrps" in
21354 *define*)
21355         case "$groupstype" in
21356         '') dflt="$gidtype" ;;
21357         *)  dflt="$groupstype" ;;
21358         esac
21359         $cat <<EOM
21360 What type of pointer is the second argument to getgroups() and setgroups()?
21361 Usually this is the same as group ids, $gidtype, but not always.
21362
21363 EOM
21364         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21365         . ./myread
21366         groupstype="$ans"
21367         ;;
21368 *)  groupstype="$gidtype";;
21369 esac
21370
21371 : check whether make sets MAKE
21372 echo " "
21373 echo "Checking if your $make program sets \$(MAKE)..." >&4
21374 case "$make_set_make" in
21375 '')
21376         $sed 's/^X //' > testmake.mak << 'EOF'
21377 Xall:
21378 X       @echo 'maketemp="$(MAKE)"'
21379 EOF
21380         case "`$make -f testmake.mak 2>/dev/null`" in
21381         *maketemp=*) make_set_make='#' ;;
21382         *)      make_set_make="MAKE=$make" ;;
21383         esac
21384         $rm -f testmake.mak
21385         ;;
21386 esac
21387 case "$make_set_make" in
21388 '#') echo "Yup, it does.";;
21389 *) echo "Nope, it doesn't.";;
21390 esac
21391
21392 : see what type is used for mode_t
21393 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21394 set mode_t modetype int stdio.h sys/types.h
21395 eval $typedef_ask
21396
21397 : see if we need va_copy
21398 echo " "
21399 case "$i_stdarg" in
21400 "$define")
21401         $cat >try.c <<EOCP
21402 #include <stdarg.h>
21403 #include <stdio.h>
21404 #$i_stdlib I_STDLIB
21405 #ifdef I_STDLIB
21406 #include <stdlib.h>
21407 #endif
21408 #include <signal.h>
21409
21410 int
21411 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21412 {
21413   return vfprintf(f, fmt, *valp);
21414 }
21415
21416 int
21417 myvfprintf(FILE *f, const  char *fmt, va_list val)
21418 {
21419   return ivfprintf(f, fmt, &val);
21420 }
21421
21422 int
21423 myprintf(char *fmt, ...)
21424 {
21425   va_list val;
21426   va_start(val, fmt);
21427   return myvfprintf(stdout, fmt, val);
21428 }
21429
21430 int
21431 main(int ac, char **av)
21432 {
21433   signal(SIGSEGV, exit);
21434
21435   myprintf("%s%cs all right, then\n", "that", '\'');
21436   exit(0);
21437 }
21438 EOCP
21439         set try
21440         if eval $compile && $run ./try 2>&1 >/dev/null; then
21441                 case "`$run ./try`" in
21442                 "that's all right, then")
21443                         okay=yes
21444                         ;;
21445                 esac
21446         fi
21447         case "$okay" in
21448         yes)    echo "It seems that you don't need va_copy()." >&4
21449                 need_va_copy="$undef"
21450                 ;;
21451         *)      echo "It seems that va_copy() or similar will be needed." >&4
21452                 need_va_copy="$define"
21453                 ;;
21454         esac
21455         $rm_try
21456         ;;
21457 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
21458         need_va_copy="$undef"
21459         ;;
21460 esac
21461
21462 : see what type is used for size_t
21463 rp="What is the type used for the length parameter for string functions?"
21464 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21465 eval $typedef_ask
21466
21467 : check for type of arguments to gethostbyaddr.
21468 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21469         case "$d_gethbyaddr" in
21470         $define)
21471                 $cat <<EOM
21472
21473 Checking to see what type of arguments are accepted by gethostbyaddr().
21474 EOM
21475                 hdrs="$define sys/types.h
21476                         $d_socket sys/socket.h
21477                         $i_niin netinet/in.h
21478                         $i_netdb netdb.h
21479                         $i_unistd unistd.h"
21480                 : The first arg can 'char *' or 'void *'
21481                 : The second arg is some of integral type
21482                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21483                         for yyy in size_t long int; do
21484                                 case "$netdb_host_type" in
21485                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21486                                         if ./protochk "$try" $hdrs; then
21487                                                 echo "Your system accepts $xxx for the first arg."
21488                                                 echo "...and $yyy for the second arg."
21489                                                 netdb_host_type="$xxx"
21490                                                 netdb_hlen_type="$yyy"
21491                                         fi
21492                                         ;;
21493                                 esac
21494                         done
21495                 done
21496                 : In case none of those worked, prompt the user.
21497                 case "$netdb_host_type" in
21498                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21499                         dflt='char *'
21500                         . ./myread
21501                         netdb_host_type=$ans
21502                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21503                         dflt="$sizetype"
21504                         . ./myread
21505                         netdb_hlen_type=$ans
21506                         ;;
21507                 esac
21508                 ;;
21509         *)      : no gethostbyaddr, so pick harmless defaults
21510                 netdb_host_type='char *'
21511                 netdb_hlen_type="$sizetype"
21512                 ;;
21513         esac
21514         # Remove the "const" if needed. -- but then we'll have a
21515         # prototype clash!
21516         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21517 fi
21518
21519 : check for type of argument to gethostbyname.
21520 if test "X$netdb_name_type" = X ; then
21521         case "$d_gethbyname" in
21522         $define)
21523                 $cat <<EOM
21524
21525 Checking to see what type of argument is accepted by gethostbyname().
21526 EOM
21527                 hdrs="$define sys/types.h
21528                         $d_socket sys/socket.h
21529                         $i_niin netinet/in.h
21530                         $i_netdb netdb.h
21531                         $i_unistd unistd.h"
21532                 for xxx in "const char *" "char *"; do
21533                         case "$netdb_name_type" in
21534                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21535                                 if ./protochk "$try" $hdrs; then
21536                                         echo "Your system accepts $xxx."
21537                                         netdb_name_type="$xxx"
21538                                 fi
21539                                 ;;
21540                         esac
21541                 done
21542                 : In case none of those worked, prompt the user.
21543                 case "$netdb_name_type" in
21544                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21545                         dflt='char *'
21546                         . ./myread
21547                         netdb_name_type=$ans
21548                         ;;
21549                 esac
21550                 ;;
21551         *)      : no gethostbyname, so pick harmless default
21552                 netdb_name_type='char *'
21553                 ;;
21554         esac
21555 fi
21556
21557 : check for type of 1st argument to getnetbyaddr.
21558 if test "X$netdb_net_type" = X ; then
21559         case "$d_getnbyaddr" in
21560         $define)
21561                 $cat <<EOM
21562
21563 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21564 EOM
21565                 hdrs="$define sys/types.h
21566                         $d_socket sys/socket.h
21567                         $i_niin netinet/in.h
21568                         $i_netdb netdb.h
21569                         $i_unistd unistd.h"
21570                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21571                         case "$netdb_net_type" in
21572                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21573                                 if ./protochk "$try" $hdrs; then
21574                                         echo "Your system accepts $xxx."
21575                                         netdb_net_type="$xxx"
21576                                 fi
21577                                 ;;
21578                         esac
21579                 done
21580                 : In case none of those worked, prompt the user.
21581                 case "$netdb_net_type" in
21582                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21583                         dflt='long'
21584                         . ./myread
21585                         netdb_net_type=$ans
21586                         ;;
21587                 esac
21588                 ;;
21589         *)      : no getnetbyaddr, so pick harmless default
21590                 netdb_net_type='long'
21591                 ;;
21592         esac
21593 fi
21594 : locate the preferred pager for this system
21595 fn=f/
21596 case "$pager" in
21597 '')
21598         dflt=''
21599         case "$pg" in
21600         /*) dflt=$pg;;
21601         [a-zA-Z]:/*) dflt=$pg;;
21602         esac
21603         case "$more" in
21604         /*) dflt=$more;;
21605         [a-zA-Z]:/*) dflt=$more;;
21606         esac
21607         case "$less" in
21608         /*) dflt=$less;;
21609         [a-zA-Z]:/*) dflt=$less;;
21610         esac
21611         case "$dflt" in
21612         '') dflt=/usr/ucb/more;;
21613         esac
21614         ;;
21615 *)      dflt="$pager"
21616         ;;
21617 esac
21618 fn="f/($dflt)"
21619 echo " "
21620 rp='What pager is used on your system?'
21621 . ./getfile
21622 pager="$ans"
21623
21624 : see what type pids are declared as in the kernel
21625 rp="What is the type of process ids on this system?"
21626 set pid_t pidtype int stdio.h sys/types.h
21627 eval $typedef_ask
21628
21629 : see if ar generates random libraries by itself
21630 echo " "
21631 echo "Checking how to generate random libraries on your machine..." >&4
21632 echo 'int bar1() { return bar2(); }' > bar1.c
21633 echo 'int bar2() { return 2; }' > bar2.c
21634 $cat > foo.c <<EOP
21635 #$i_stdlib I_STDLIB
21636 #ifdef I_STDLIB
21637 #include <stdlib.h>
21638 #endif
21639 int main() { printf("%d\n", bar1()); exit(0); }
21640 EOP
21641 $cc $ccflags -c bar1.c >/dev/null 2>&1
21642 $cc $ccflags -c bar2.c >/dev/null 2>&1
21643 $cc $ccflags -c foo.c >/dev/null 2>&1
21644 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21645 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21646         $run ./foobar >/dev/null 2>&1; then
21647         echo "$ar appears to generate random libraries itself."
21648         orderlib=false
21649         if [ "X$ranlib" = "X" ]; then
21650             ranlib=":"
21651         fi
21652 elif $ar s bar$_a >/dev/null 2>&1 &&
21653         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21654         $run ./foobar >/dev/null 2>&1; then
21655                 echo "a table of contents needs to be added with '$ar s'."
21656                 orderlib=false
21657                 ranlib="$ar s"
21658 elif $ar ts bar$_a >/dev/null 2>&1 &&
21659         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21660         $run ./foobar >/dev/null 2>&1; then
21661                 echo "a table of contents needs to be added with '$ar ts'."
21662                 orderlib=false
21663                 ranlib="$ar ts"
21664 else
21665         case "$ranlib" in
21666         :) ranlib='';;
21667         '')
21668                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21669                 $test -f $ranlib || ranlib=''
21670                 ;;
21671         esac
21672         if $test -n "$ranlib"; then
21673                 echo "your system has '$ranlib'; we'll use that."
21674                 orderlib=false
21675         else
21676                 echo "your system doesn't seem to support random libraries"
21677                 echo "so we'll use lorder and tsort to order the libraries."
21678                 orderlib=true
21679                 ranlib=":"
21680         fi
21681 fi
21682 $rm -f foo* bar*
21683
21684 : see if this is a values.h system
21685 set values.h i_values
21686 eval $inhdr
21687
21688 : Check the max offset that gmtime and localtime accept
21689 echo "Checking max offsets that gmtime () accepts"
21690
21691 case $i_values in
21692     define) yyy="#include <values.h>" ;;
21693     *)      yyy="" ;;
21694     esac
21695
21696 case "$sGMTIME_min/$sGMTIME_max" in
21697     0/0|/)
21698         $cat >try.c <<EOCP
21699 #include <sys/types.h>
21700 #include <stdio.h>
21701 #include <time.h>
21702 $yyy
21703
21704 int i;
21705 struct tm *tmp;
21706 time_t pt;
21707
21708 void gm_check (time_t t, int min_year, int max_year)
21709 {
21710     tmp = gmtime (&t);
21711     if ( tmp == NULL ||
21712         /* Check tm_year overflow */
21713          tmp->tm_year < min_year || tmp->tm_year > max_year)
21714         tmp = NULL;
21715     else
21716         pt = t;
21717     } /* gm_check */
21718
21719 int check_max ()
21720 {
21721     tmp = NULL;
21722     pt  = 0;
21723 #ifdef MAXLONG
21724     gm_check (MAXLONG, 69, 0x7fffffff);
21725 #endif
21726     if (tmp == NULL || tmp->tm_year < 0) {
21727         for (i = 63; i >= 0; i--) {
21728             time_t x = pt | ((time_t)1 << i);
21729             if (x < 0 || x < pt) continue;
21730             gm_check (x, 69, 0x7fffffff);
21731             }
21732         }
21733     printf ("sGMTIME_max=%ld\n", pt);
21734     return (0);
21735     } /* check_max */
21736
21737 int check_min ()
21738 {
21739     tmp = NULL;
21740     pt  = 0;
21741 #ifdef MINLONG
21742     gm_check (MINLONG, -1900, 70);
21743 #endif
21744     if (tmp == NULL) {
21745         for (i = 36; i >= 0; i--) {
21746             time_t x = pt - ((time_t)1 << i);
21747             if (x > 0) continue;
21748             gm_check (x, -1900, 70);
21749             }
21750         }
21751     printf ("sGMTIME_min=%ld\n", pt);
21752     return (0);
21753     } /* check_min */
21754
21755 int main (int argc, char *argv[])
21756 {
21757     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21758     check_max ();
21759     check_min ();
21760     return (0);
21761     } /* main */
21762 EOCP
21763         set try
21764         if eval $compile; then
21765             eval `$run ./try 2>/dev/null`
21766         else
21767             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21768             fi
21769         $rm_try
21770         ;;
21771     esac
21772
21773 echo "Checking max offsets that localtime () accepts"
21774
21775 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21776     0/0|/)
21777         $cat >try.c <<EOCP
21778 #include <sys/types.h>
21779 #include <stdio.h>
21780 #include <time.h>
21781 $yyy
21782
21783 int i;
21784 struct tm *tmp;
21785 time_t pt;
21786
21787 void local_check (time_t t, int min_year, int max_year)
21788 {
21789     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21790         tmp = NULL;
21791     else
21792         tmp = localtime (&t);
21793     if ( tmp == NULL ||
21794         /* Check tm_year overflow */
21795          tmp->tm_year < min_year || tmp->tm_year > max_year)
21796         tmp = NULL;
21797     else
21798         pt = t;
21799     } /* local_check */
21800
21801 int check_max ()
21802 {
21803     tmp = NULL;
21804     pt  = 0;
21805 #ifdef MAXLONG
21806     local_check (MAXLONG, 69, 0x7fffffff);
21807 #endif
21808     if (tmp == NULL || tmp->tm_year < 0) {
21809         for (i = 63; i >= 0; i--) {
21810             time_t x = pt | ((time_t)1 << i);
21811             if (x < 0 || x < pt) continue;
21812             local_check (x, 69, 0x7fffffff);
21813             }
21814         }
21815     printf ("sLOCALTIME_max=%ld\n", pt);
21816     return (0);
21817    } /* check_max */
21818
21819 int check_min ()
21820 {
21821     tmp = NULL;
21822     pt  = 0;
21823 #ifdef MINLONG
21824     local_check (MINLONG, -1900, 70);
21825 #endif
21826     if (tmp == NULL) {
21827         for (i = 36; i >= 0; i--) {
21828             time_t x = pt - ((time_t)1 << i);
21829             if (x > 0) continue;
21830             local_check (x, -1900, 70);
21831             }
21832         }
21833     printf ("sLOCALTIME_min=%ld\n", pt);
21834     return (0);
21835     } /* check_min */
21836
21837 int main (int argc, char *argv[])
21838 {
21839     check_max ();
21840     check_min ();
21841     return (0);
21842     } /* main */
21843 EOCP
21844         set try
21845         if eval $compile; then
21846             eval `$run ./try 2>/dev/null`
21847         else
21848             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21849             fi
21850         $rm_try
21851         ;;
21852     esac
21853
21854 : check for type of arguments to select.
21855 case "$selecttype" in
21856 '') case "$d_select" in
21857         $define)
21858                 echo " "
21859                 $cat <<EOM
21860 Checking to see what type of arguments are accepted by select().
21861 EOM
21862                 hdrs="$define sys/types.h
21863                         $i_systime sys/time.h
21864                         $i_sysselct sys/select.h
21865                         $d_socket sys/socket.h"
21866                 : The first arg can be int, unsigned, or size_t
21867                 : The last arg may or may not be 'const'
21868                 val=''
21869                 : void pointer has been seen but using that
21870                 : breaks the selectminbits test
21871                 for xxx in 'fd_set *' 'int *'; do
21872                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21873                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
21874                                         case "$val" in
21875                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21876                                                 if ./protochk "$try" $hdrs; then
21877                                                         echo "Your system accepts $xxx."
21878                                                         val="$xxx"
21879                                                 fi
21880                                                 ;;
21881                                         esac
21882                                 done
21883                         done
21884                 done
21885                 case "$val" in
21886                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21887                         case "$d_fd_set" in
21888                                 $define) dflt="fd_set *" ;;
21889                                 *)              dflt="int *" ;;
21890                         esac
21891                         . ./myread
21892                         val=$ans
21893                         ;;
21894                 esac
21895                 selecttype="$val"
21896                 ;;
21897         *)      : no select, so pick a harmless default
21898                 selecttype='int *'
21899                 ;;
21900         esac
21901         ;;
21902 esac
21903
21904 : check for the select 'width'
21905 case "$selectminbits" in
21906 '') safebits=`expr $ptrsize \* 8`
21907     case "$d_select" in
21908         $define)
21909                 $cat <<EOM
21910
21911 Checking to see on how many bits at a time your select() operates...
21912 EOM
21913                 $cat >try.c <<EOCP
21914 #include <sys/types.h>
21915 #$i_time I_TIME
21916 #$i_systime I_SYS_TIME
21917 #$i_systimek I_SYS_TIME_KERNEL
21918 #ifdef I_TIME
21919 #   include <time.h>
21920 #endif
21921 #ifdef I_SYS_TIME
21922 #   ifdef I_SYS_TIME_KERNEL
21923 #       define KERNEL
21924 #   endif
21925 #   include <sys/time.h>
21926 #   ifdef I_SYS_TIME_KERNEL
21927 #       undef KERNEL
21928 #   endif
21929 #endif
21930 #$i_sysselct I_SYS_SELECT
21931 #ifdef I_SYS_SELECT
21932 #include <sys/select.h>
21933 #endif
21934 #$d_socket HAS_SOCKET
21935 #ifdef HAS_SOCKET
21936 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21937 #endif
21938 #include <stdio.h>
21939 #$i_stdlib I_STDLIB
21940 #ifdef I_STDLIB
21941 #include <stdlib.h>
21942 #endif
21943 $selecttype b;
21944 #define S sizeof(*(b))
21945 #define MINBITS 64
21946 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21947 #define NBITS  (NBYTES * 8)
21948 int main() {
21949     char *s = (char *)malloc(NBYTES);
21950     struct timeval t;
21951     int i;
21952     FILE* fp;
21953     int fd;
21954
21955     if (!s)
21956         exit(1);
21957     fclose(stdin);
21958     fp = fopen("try.c", "r");
21959     if (fp == 0)
21960       exit(2);
21961     fd = fileno(fp);
21962     if (fd < 0)
21963       exit(3);
21964     b = ($selecttype)s;
21965     for (i = 0; i < NBITS; i++)
21966         FD_SET(i, b);
21967     t.tv_sec  = 0;
21968     t.tv_usec = 0;
21969     select(fd + 1, b, 0, 0, &t);
21970     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
21971     free(s);
21972     printf("%d\n", i + 1);
21973     return 0;
21974 }
21975 EOCP
21976                 set try
21977                 if eval $compile_ok; then
21978                         selectminbits=`$run ./try 2>/dev/null`
21979                         case "$selectminbits" in
21980                         '')     cat >&4 <<EOM
21981 Cannot figure out on how many bits at a time your select() operates.
21982 I'll play safe and guess it is $safebits bits.
21983 EOM
21984                                 selectminbits=$safebits
21985                                 bits="$safebits bits"
21986                                 ;;
21987                         1)      bits="1 bit" ;;
21988                         *)      bits="$selectminbits bits" ;;
21989                         esac
21990                         echo "Your select() operates on $bits at a time." >&4
21991                 else
21992                         rp='What is the minimum number of bits your select() operates on?'
21993                         case "$byteorder" in
21994                         12345678)       dflt=64 ;;
21995                         1234)           dflt=32 ;;
21996                         *)              dflt=1  ;;
21997                         esac
21998                         . ./myread
21999                         val=$ans
22000                         selectminbits="$val"
22001                 fi
22002                 $rm_try
22003                 ;;
22004         *)      : no select, so pick a harmless default
22005                 selectminbits=$safebits
22006                 ;;
22007         esac
22008         ;;
22009 esac
22010
22011 : Trace out the files included by signal.h, then look for SIGxxx names.
22012 case "$sig_num_init" in
22013 '')
22014 if [ "X$fieldn" = X ]; then
22015         : Just make some guesses.  We check them later.
22016         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
22017 else
22018         xxx=`echo '#include <signal.h>' |
22019         $cppstdin $cppminus $cppflags 2>/dev/null |
22020         $grep '^[       ]*#.*include' |
22021         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
22022                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
22023 fi
22024 xxxfiles=''
22025 for xx in $xxx /dev/null ; do
22026         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
22027 done
22028 case "$xxxfiles" in
22029 '')     xxxfiles=`./findhdr signal.h` ;;
22030 esac
22031 xxx=`awk '
22032 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
22033         print substr($2, 4, 20)
22034 }
22035 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
22036         print substr($3, 4, 20)
22037 }' $xxxfiles`
22038 : Append some common names just in case the awk scan failed.
22039 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22040 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22041 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22042 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22043 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22044
22045 : generate a few handy files for later
22046 $cat > signal.c <<EOCP
22047 #include <sys/types.h>
22048 #include <signal.h>
22049 #$i_stdlib I_STDLIB
22050 #ifdef I_STDLIB
22051 #include <stdlib.h>
22052 #endif
22053 #include <stdio.h>
22054 int main() {
22055
22056 /* Strange style to avoid deeply-nested #if/#else/#endif */
22057 #ifndef NSIG
22058 #  ifdef _NSIG
22059 #    define NSIG (_NSIG)
22060 #  endif
22061 #endif
22062
22063 #ifndef NSIG
22064 #  ifdef SIGMAX
22065 #    define NSIG (SIGMAX+1)
22066 #  endif
22067 #endif
22068
22069 #ifndef NSIG
22070 #  ifdef SIG_MAX
22071 #    define NSIG (SIG_MAX+1)
22072 #  endif
22073 #endif
22074
22075 #ifndef NSIG
22076 #  ifdef _SIG_MAX
22077 #    define NSIG (_SIG_MAX+1)
22078 #  endif
22079 #endif
22080
22081 #ifndef NSIG
22082 #  ifdef MAXSIG
22083 #    define NSIG (MAXSIG+1)
22084 #  endif
22085 #endif
22086
22087 #ifndef NSIG
22088 #  ifdef MAX_SIG
22089 #    define NSIG (MAX_SIG+1)
22090 #  endif
22091 #endif
22092
22093 #ifndef NSIG
22094 #  ifdef SIGARRAYSIZE
22095 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22096 #  endif
22097 #endif
22098
22099 #ifndef NSIG
22100 #  ifdef _sys_nsig
22101 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
22102 #  endif
22103 #endif
22104
22105 /* Default to some arbitrary number that's big enough to get most
22106    of the common signals.
22107 */
22108 #ifndef NSIG
22109 #    define NSIG 50
22110 #endif
22111
22112 printf("NSIG %d\n", NSIG);
22113
22114 #ifndef JUST_NSIG
22115
22116 EOCP
22117
22118 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22119 {
22120         printf "#ifdef SIG"; printf $1; printf "\n"
22121         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22122         printf $1; printf ");\n"
22123         printf "#endif\n"
22124 }
22125 END {
22126         printf "#endif /* JUST_NSIG */\n";
22127         printf "exit(0);\n}\n";
22128 }
22129 ' >>signal.c
22130 $cat >signal.awk <<'EOP'
22131 BEGIN { ndups = 0 }
22132 $1 ~ /^NSIG$/ { nsig = $2 }
22133 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22134     if ($2 > maxsig) { maxsig = $2 }
22135     if (sig_name[$2]) {
22136         dup_name[ndups] = $1
22137         dup_num[ndups] = $2
22138         ndups++
22139     }
22140     else {
22141         sig_name[$2] = $1
22142         sig_num[$2] = $2
22143     }
22144 }
22145 END {
22146     if (nsig == 0) {
22147         nsig = maxsig + 1
22148     }
22149     printf("NSIG %d\n", nsig);
22150     for (n = 1; n < nsig; n++) {
22151         if (sig_name[n]) {
22152             printf("%s %d\n", sig_name[n], sig_num[n])
22153         }
22154         else {
22155             printf("NUM%d %d\n", n, n)
22156         }
22157     }
22158     for (n = 0; n < ndups; n++) {
22159         printf("%s %d\n", dup_name[n], dup_num[n])
22160     }
22161 }
22162 EOP
22163 $cat >signal_cmd <<EOS
22164 $startsh
22165 if $test -s signal.lst; then
22166     echo "Using your existing signal.lst file"
22167         exit 0
22168 fi
22169 xxx="$xxx"
22170 EOS
22171 $cat >>signal_cmd <<'EOS'
22172
22173 set signal
22174 if eval $compile_ok; then
22175         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22176                 $uniq | $awk -f signal.awk >signal.lst
22177 else
22178         echo "(I can't seem be able to compile the whole test program)" >&4
22179         echo "(I'll try it in little pieces.)" >&4
22180         set signal -DJUST_NSIG
22181         if eval $compile_ok; then
22182                 $run ./signal$_exe > signal.nsg
22183                 $cat signal.nsg
22184         else
22185                 echo "I can't seem to figure out how many signals you have." >&4
22186                 echo "Guessing 50." >&4
22187                 echo 'NSIG 50' > signal.nsg
22188         fi
22189         : Now look at all the signal names, one at a time.
22190         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22191                 $cat > signal.c <<EOCP
22192 #include <sys/types.h>
22193 #include <signal.h>
22194 #include <stdio.h>
22195 int main() {
22196 printf("$xx %d\n", SIG${xx});
22197 return 0;
22198 }
22199 EOCP
22200                 set signal
22201                 if eval $compile; then
22202                         echo "SIG${xx} found."
22203                         $run ./signal$_exe  >> signal.ls1
22204                 else
22205                         echo "SIG${xx} NOT found."
22206                 fi
22207         done
22208         if $test -s signal.ls1; then
22209                 $cat signal.nsg signal.ls1 |
22210                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
22211         fi
22212
22213 fi
22214 if $test -s signal.lst; then
22215         :
22216 else
22217         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
22218         echo 'kill -l' >signal
22219         set X `csh -f <signal`
22220         $rm -f signal
22221         shift
22222         case $# in
22223         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
22224         esac
22225         echo $@ | $tr ' ' $trnl | \
22226             $awk '{ printf "%s %d\n", $1, ++s; }
22227                   END { printf "NSIG %d\n", ++s }' >signal.lst
22228 fi
22229 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
22230 EOS
22231 chmod a+x signal_cmd
22232 $eunicefix signal_cmd
22233
22234 : generate list of signal names
22235 echo " "
22236 case "$sig_name_init" in
22237 '') doinit=yes ;;
22238 *)  case "$sig_num_init" in
22239     ''|*,*) doinit=yes ;;
22240     esac ;;
22241 esac
22242 case "$doinit" in
22243 yes)
22244         echo "Generating a list of signal names and numbers..." >&4
22245         . ./signal_cmd
22246         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22247         sig_name=`$awk 'BEGIN { printf "ZERO " }
22248                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
22249         sig_num=`$awk  'BEGIN { printf "0 " }
22250                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
22251         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
22252                              !/^NSIG/   { printf "\"%s\", ", $1 }
22253                              END        { printf "0\n" }' signal.lst`
22254         sig_num_init=`$awk  'BEGIN      { printf "0, " }
22255                              !/^NSIG/   { printf "%d, ", $2}
22256                              END        { printf "0\n"}' signal.lst`
22257         ;;
22258 esac
22259 echo "The following $sig_count signals are available:"
22260 echo " "
22261 echo $sig_name | $awk \
22262 'BEGIN { linelen = 0 }
22263 {
22264         for (i = 1; i <= NF; i++) {
22265                 name = "SIG" $i " "
22266                 linelen = linelen + length(name)
22267                 if (linelen > 70) {
22268                         printf "\n"
22269                         linelen = length(name)
22270                 }
22271                 printf "%s", name
22272         }
22273         printf "\n"
22274 }'
22275 sig_size=`echo $sig_name | awk '{print NF}'`
22276 $rm -f signal signal.c signal.awk signal.lst signal_cmd
22277 ;;
22278 esac
22279
22280 : Check size of size
22281 echo " "
22282 case "$sizetype" in
22283 *_t) zzz="$sizetype"    ;;
22284 *)   zzz="filesize"     ;;
22285 esac
22286 echo "Checking the size of $zzz..." >&4
22287 cat > try.c <<EOCP
22288 #include <sys/types.h>
22289 #include <stdio.h>
22290 #$i_stdlib I_STDLIB
22291 #ifdef I_STDLIB
22292 #include <stdlib.h>
22293 #endif
22294 int main() {
22295     printf("%d\n", (int)sizeof($sizetype));
22296     exit(0);
22297 }
22298 EOCP
22299 set try
22300 if eval $compile_ok; then
22301         yyy=`$run ./try`
22302         case "$yyy" in
22303         '')     sizesize=4
22304                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22305                 ;;
22306         *)      sizesize=$yyy
22307                 echo "Your $zzz size is $sizesize bytes."
22308                 ;;
22309         esac
22310 else
22311         sizesize=4
22312         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22313 fi
22314
22315
22316 : check for socklen_t
22317 echo " "
22318 echo "Checking to see if you have socklen_t..." >&4
22319 $cat >try.c <<EOCP
22320 #include <sys/types.h>
22321 #$d_socket HAS_SOCKET
22322 #ifdef HAS_SOCKET
22323 #include <sys/socket.h>
22324 #endif
22325 int main() { socklen_t x = 16; }
22326 EOCP
22327 set try
22328 if eval $compile; then
22329         val="$define"
22330         echo "You have socklen_t."
22331 else
22332         val="$undef"
22333         echo "You do not have socklen_t."
22334         case "$sizetype" in
22335         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22336         esac
22337 fi
22338 $rm_try
22339 set d_socklen_t
22340 eval $setvar
22341
22342 : see if this is a socks.h system
22343 set socks.h i_socks
22344 eval $inhdr
22345
22346 : check for type of the size argument to socket calls
22347 case "$d_socket" in
22348 "$define")
22349         $cat <<EOM
22350
22351 Checking to see what type is the last argument of accept().
22352 EOM
22353         yyy=''
22354         case "$d_socklen_t" in
22355         "$define") yyy="$yyy socklen_t"
22356         esac
22357         yyy="$yyy $sizetype int long unsigned"
22358         for xxx in $yyy; do
22359                 case "$socksizetype" in
22360                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22361                         case "$usesocks" in
22362                         "$define")
22363                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22364                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22365                                         socksizetype="$xxx"
22366                                 fi
22367                                 ;;
22368                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22369                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22370                                         socksizetype="$xxx"
22371                                 fi
22372                                 ;;
22373                         esac
22374                         ;;
22375                 esac
22376         done
22377 : In case none of those worked, prompt the user.
22378         case "$socksizetype" in
22379         '')     rp='What is the type for socket address structure sizes?'
22380                 dflt='int'
22381                 . ./myread
22382                 socksizetype=$ans
22383                 ;;
22384         esac
22385         ;;
22386 *)      : no sockets, so pick relatively harmless default
22387         socksizetype='int'
22388         ;;
22389 esac
22390
22391 : see what type is used for signed size_t
22392 set ssize_t ssizetype int stdio.h sys/types.h
22393 eval $typedef
22394 dflt="$ssizetype"
22395 $cat > try.c <<EOM
22396 #include <stdio.h>
22397 #$i_stdlib I_STDLIB
22398 #ifdef I_STDLIB
22399 #include <stdlib.h>
22400 #endif
22401 #include <sys/types.h>
22402 #define Size_t $sizetype
22403 #define SSize_t $dflt
22404 int main()
22405 {
22406         if (sizeof(Size_t) == sizeof(SSize_t))
22407                 printf("$dflt\n");
22408         else if (sizeof(Size_t) == sizeof(int))
22409                 printf("int\n");
22410         else
22411                 printf("long\n");
22412         exit(0);
22413 }
22414 EOM
22415 echo " "
22416 set try
22417 if eval $compile_ok && $run ./try > /dev/null; then
22418         ssizetype=`$run ./try`
22419         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22420 else
22421         $cat >&4 <<EOM
22422 Help! I can't compile and run the ssize_t test program: please enlighten me!
22423 (This is probably a misconfiguration in your system or libraries, and
22424 you really ought to fix it.  Still, I'll try anyway.)
22425
22426 I need a type that is the same size as $sizetype, but is guaranteed to
22427 be signed.  Common values are ssize_t, int and long.
22428
22429 EOM
22430         rp="What signed type is the same size as $sizetype?"
22431         . ./myread
22432         ssizetype="$ans"
22433 fi
22434 $rm_try
22435
22436 : Check the size of st_ino
22437 $echo " "
22438 $echo "Checking the size of st_ino..." >&4
22439 $cat > try.c <<EOCP
22440 #include <sys/stat.h>
22441 #include <stdio.h>
22442 #$i_stdlib I_STDLIB
22443 #ifdef I_STDLIB
22444 #include <stdlib.h>
22445 #endif
22446 int main() {
22447     struct stat st;
22448     printf("%d\n", (int)sizeof(st.st_ino));
22449     exit(0);
22450 }
22451 EOCP
22452 set try
22453 if eval $compile_ok; then
22454         val=`$run ./try`
22455         case "$val" in
22456         '')     st_ino_size=4
22457                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22458                 ;;
22459         *)      st_ino_size=$val
22460                 $echo "Your st_ino is $st_ino_size bytes long."
22461                 ;;
22462         esac
22463 else
22464         st_ino_size=4
22465         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22466 fi
22467 $rm_try
22468
22469 : Check if st_ino is signed
22470 $echo " "
22471 $echo "Checking the sign of st_ino..." >&4
22472 $cat > try.c <<EOCP
22473 #include <sys/stat.h>
22474 #include <stdio.h>
22475 int main() {
22476         struct stat foo;
22477         foo.st_ino = -1;
22478         if (foo.st_ino < 0)
22479                 printf("-1\n");
22480         else
22481                 printf("1\n");
22482 }
22483 EOCP
22484 set try
22485 if eval $compile; then
22486         val=`$run ./try`
22487         case "$val" in
22488         '')     st_ino_sign=1
22489                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22490                 ;;
22491         *)      st_ino_sign=$val
22492                 case "$st_ino_sign" in
22493                  1) $echo "Your st_ino is unsigned." ;;
22494                 -1) $echo "Your st_ino is signed."   ;;
22495                 esac
22496                 ;;
22497         esac
22498 else
22499         st_ino_sign=1
22500         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22501 fi
22502 $rm_try
22503
22504 : see what type of char stdio uses.
22505 echo " "
22506 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22507 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22508         echo "Your stdio uses unsigned chars." >&4
22509         stdchar="unsigned char"
22510 else
22511         echo "Your stdio uses signed chars." >&4
22512         stdchar="char"
22513 fi
22514 $rm -f stdioh
22515
22516 : see what type uids are declared as in the kernel
22517 echo " "
22518 echo "Looking for the type for user ids returned by getuid()."
22519 set uid_t uidtype xxx stdio.h sys/types.h
22520 eval $typedef
22521 case "$uidtype" in
22522 xxx)
22523         xxx=`./findhdr sys/user.h`
22524         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
22525         case $1 in
22526         unsigned) dflt="$1 $2" ;;
22527         *) dflt="$1" ;;
22528         esac
22529         ;;
22530 *) dflt="$uidtype";;
22531 esac
22532 case "$uidtype" in
22533 uid_t)  echo "uid_t found." ;;
22534 *)      rp="What is the type for user ids returned by getuid()?"
22535         . ./myread
22536         uidtype="$ans"
22537         ;;
22538 esac
22539
22540 : Check size of UID
22541 echo " "
22542 case "$uidtype" in
22543 *_t) zzz="$uidtype"     ;;
22544 *)   zzz="uid"          ;;
22545 esac
22546 echo "Checking the size of $zzz..." >&4
22547 cat > try.c <<EOCP
22548 #include <sys/types.h>
22549 #include <stdio.h>
22550 #$i_stdlib I_STDLIB
22551 #ifdef I_STDLIB
22552 #include <stdlib.h>
22553 #endif
22554 int main() {
22555     printf("%d\n", (int)sizeof($uidtype));
22556     exit(0);
22557 }
22558 EOCP
22559 set try
22560 if eval $compile_ok; then
22561         yyy=`$run ./try`
22562         case "$yyy" in
22563         '')     uidsize=4
22564                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22565                 ;;
22566         *)      uidsize=$yyy
22567                 echo "Your $zzz is $uidsize bytes long."
22568                 ;;
22569         esac
22570 else
22571         uidsize=4
22572         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22573 fi
22574
22575 : Check if UID is signed
22576 echo " "
22577 case "$uidtype" in
22578 *_t) zzz="$uidtype"     ;;
22579 *)   zzz="uid"          ;;
22580 esac
22581 echo "Checking the sign of $zzz..." >&4
22582 cat > try.c <<EOCP
22583 #include <sys/types.h>
22584 #include <stdio.h>
22585 int main() {
22586         $uidtype foo = -1;
22587         if (foo < 0)
22588                 printf("-1\n");
22589         else
22590                 printf("1\n");
22591 }
22592 EOCP
22593 set try
22594 if eval $compile; then
22595         yyy=`$run ./try`
22596         case "$yyy" in
22597         '')     uidsign=1
22598                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22599                 ;;
22600         *)      uidsign=$yyy
22601                 case "$uidsign" in
22602                  1) echo "Your $zzz is unsigned." ;;
22603                 -1) echo "Your $zzz is signed."   ;;
22604                 esac
22605                 ;;
22606         esac
22607 else
22608         uidsign=1
22609         echo "(I can't compile the test program--guessing unsigned.)" >&4
22610 fi
22611
22612
22613 : Check format string for UID
22614 echo " "
22615 $echo "Checking the format string to be used for uids..." >&4
22616
22617 case "$uidsign" in
22618 -1)     if $test X"$uidsize" = X"$ivsize"; then
22619                 uidformat="$ivdformat"
22620         else
22621                 if $test X"$uidsize" = X"$longsize"; then
22622                         uidformat='"ld"'
22623                 else
22624                         if $test X"$uidsize" = X"$intsize"; then
22625                                 uidformat='"d"'
22626                         else
22627                                 if $test X"$uidsize" = X"$shortsize"; then
22628                                         uidformat='"hd"'
22629                                 fi
22630                         fi
22631                 fi
22632         fi
22633         ;;
22634 *)      if $test X"$uidsize" = X"$uvsize"; then
22635                 uidformat="$uvuformat"
22636         else
22637                 if $test X"$uidsize" = X"$longsize"; then
22638                         uidformat='"lu"'
22639                 else
22640                         if $test X"$uidsize" = X"$intsize"; then
22641                                 uidformat='"u"'
22642                         else
22643                                 if $test X"$uidsize" = X"$shortsize"; then
22644                                         uidformat='"hu"'
22645                                 fi
22646                         fi
22647                 fi
22648         fi
22649         ;;
22650 esac
22651
22652 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22653 echo " "
22654 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22655 $cat >try.c <<'EOM'
22656 /* Intentionally a long probe as I'd like to sanity check that the exact
22657    approach is going to work, as thinking it will work, but only having it
22658    part working at runtime is worse than not having it.  */
22659
22660 #include <sys/types.h>
22661 #include <sys/sysctl.h>
22662 #include <sys/param.h>
22663 #include <stdio.h>
22664 #include <string.h>
22665 #include <stdlib.h>
22666 #include <unistd.h>
22667
22668 int
22669 main(int argc, char **argv) {
22670     char *buffer;
22671     char *argv_leaf = strrchr(argv[0], '/');
22672     char *buffer_leaf;
22673     size_t size = 0;
22674     int mib[4];
22675
22676     mib[0] = CTL_KERN;
22677     mib[1] = KERN_PROC;
22678     mib[2] = KERN_PROC_PATHNAME;
22679     mib[3] = -1;
22680
22681     if (!argv_leaf) {
22682         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22683         return 1;
22684     }
22685
22686     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22687         perror("sysctl");
22688         return 2;
22689     }
22690
22691     if (size < strlen(argv_leaf) + 1) {
22692         fprintf(stderr, "size %lu is too short for a path\n",
22693                 (unsigned long) size);
22694         return 3;
22695     }
22696
22697     if (size > MAXPATHLEN * MAXPATHLEN) {
22698         fprintf(stderr, "size %lu is too long for a path\n",
22699                 (unsigned long) size);
22700         return 4;
22701     }
22702
22703     buffer = malloc(size);
22704     if (!buffer) {
22705         perror("malloc");
22706         return 5;
22707     }
22708
22709     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22710         perror("sysctl");
22711         return 6;
22712     }
22713
22714     if (strlen(buffer) + 1 != size) {
22715         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22716                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22717         return 7;
22718     }
22719
22720
22721     if (*buffer != '/') {
22722         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22723         return 8;
22724     }
22725
22726     if (strstr(buffer, "/./")) {
22727         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22728         return 9;
22729     }
22730
22731     if (strstr(buffer, "/../")) {
22732         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22733         return 10;
22734     }
22735
22736     buffer_leaf = strrchr(buffer, '/');
22737     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22738         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22739         return 11;
22740     }
22741
22742     free(buffer);
22743
22744     return 0;
22745 }
22746 EOM
22747
22748 val=$undef
22749 set try
22750 if eval $compile; then
22751         if $run ./try; then
22752                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22753                 val="$define"
22754         else
22755                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22756                 val="$undef"
22757         fi
22758 else
22759         echo "I'm unable to compile the test program." >&4
22760         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22761         val="$undef"
22762 fi
22763 $rm_try
22764 set usekernprocpathname
22765 eval $setvar
22766
22767 : Determine if we can use _NSGetExecutablePath to find executing program
22768 echo " "
22769 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22770 $cat >try.c <<'EOM'
22771 /* Intentionally a long probe as I'd like to sanity check that the exact
22772    approach is going to work, as thinking it will work, but only having it
22773    part working at runtime is worse than not having it.  */
22774 #include <mach-o/dyld.h>
22775 #include <stdio.h>
22776 #include <stdlib.h>
22777 #include <sys/param.h>
22778 #include <string.h>
22779
22780 int
22781 main(int argc, char **argv) {
22782     char buf[1];
22783     uint32_t size = sizeof(buf);
22784     int result;
22785     char *buffer;
22786     char *tidied;
22787     char *argv_leaf = strrchr(argv[0], '/');
22788     char *tidied_leaf;
22789
22790     if (!argv_leaf) {
22791         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22792         return 1;
22793     }
22794
22795     _NSGetExecutablePath(buf, &size);
22796     if (size > MAXPATHLEN * MAXPATHLEN) {
22797         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22798                 (unsigned int) size);
22799         return 2;
22800     }
22801
22802     buffer = malloc(size);
22803     if (!buffer) {
22804         perror("malloc");
22805         return 3;
22806     }
22807
22808     result = _NSGetExecutablePath(buffer, &size);
22809     if (result != 0) {
22810         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22811                 result, (unsigned int) size);
22812         return 4;
22813     }
22814
22815     tidied = realpath(buffer, NULL);
22816     if (!tidied) {
22817         perror("realpath");
22818         return 5;
22819     }
22820
22821     free(buffer);
22822
22823     if (*tidied != '/') {
22824         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22825         return 6;
22826     }
22827
22828     if (strstr(tidied, "/./")) {
22829         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22830         return 7;
22831     }
22832
22833     if (strstr(tidied, "/../")) {
22834         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22835         return 8;
22836     }
22837
22838     tidied_leaf = strrchr(tidied, '/');
22839     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22840         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22841         return 9;
22842     }
22843
22844     free(tidied);
22845
22846     return 0;
22847 }
22848 EOM
22849
22850 val=$undef
22851 set try
22852 if eval $compile; then
22853         if $run ./try; then
22854                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22855                 val="$define"
22856         else
22857                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22858         fi
22859 else
22860         echo "I'm unable to compile the test program." >&4
22861         echo "I'll assume no _NSGetExecutablePath here." >&4
22862 fi
22863 $rm_try
22864 set usensgetexecutablepath
22865 eval $setvar
22866
22867 : Check if site customization support was requested
22868 case "$usesitecustomize" in
22869     $define|true|[Yy]*)
22870         usesitecustomize="$define"
22871         ;;
22872     *)
22873         usesitecustomize="$undef"
22874         ;;
22875     esac
22876
22877 : see if prototypes support variable argument declarations
22878 echo " "
22879 case "$prototype$i_stdarg" in
22880 $define$define)
22881         echo "It appears we'll be able to prototype varargs functions." >&4
22882         val="$define"
22883         ;;
22884 *)
22885         echo "Too bad... We won't be using prototyped varargs functions..." >&4
22886         val="$undef"
22887         ;;
22888 esac
22889 set vaproto
22890 eval $setvar
22891
22892 : determine compiler compiler
22893 case "$yacc" in
22894 '')
22895         dflt=yacc;;
22896 *)
22897         dflt="$yacc";;
22898 esac
22899 echo " "
22900 comp='yacc'
22901 if $test -f "$byacc$_exe"; then
22902         dflt="$byacc"
22903         comp="byacc or $comp"
22904 fi
22905 if $test -f "$bison$_exe"; then
22906         comp="$comp or bison -y"
22907 fi
22908 rp="Which compiler compiler ($comp) shall I use?"
22909 . ./myread
22910 yacc="$ans"
22911 case "$yacc" in
22912 *bis*)
22913         case "$yacc" in
22914         *-y*) ;;
22915         *)
22916                 yacc="$yacc -y"
22917                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22918                 ;;
22919         esac
22920         ;;
22921 esac
22922
22923 : see if this is a assert.h system
22924 set assert.h i_assert
22925 eval $inhdr
22926
22927 : see if this is a bfd.h system
22928 set bfd.h i_bfd
22929 eval $inhdr
22930
22931 : see if this is an execinfo.h system
22932 set execinfo.h i_execinfo
22933 eval $inhdr
22934
22935 : see if this is a fenv.h system
22936 set fenv.h i_fenv
22937 eval $inhdr
22938
22939 : see if this is a fp.h system
22940 set fp.h i_fp
22941 eval $inhdr
22942
22943 : see if this is a fp_class.h system
22944 set fp_class.h i_fp_class
22945 eval $inhdr
22946
22947 : see if gdbm.h is available
22948 set gdbm.h t_gdbm
22949 eval $inhdr
22950 case "$t_gdbm" in
22951 $define)
22952         : see if gdbm_open exists
22953         set gdbm_open d_gdbm_open
22954         eval $inlibc
22955         case "$d_gdbm_open" in
22956         $undef)
22957                 t_gdbm="$undef"
22958                 echo "We won't be including <gdbm.h>"
22959                 ;;
22960         esac
22961         ;;
22962 esac
22963 val="$t_gdbm"
22964 set i_gdbm
22965 eval $setvar
22966
22967 : see if this is a ieeefp.h system
22968 case "$i_ieeefp" in
22969 '' ) set ieeefp.h i_ieeefp
22970      eval $inhdr
22971      ;;
22972 esac
22973
22974 : see if this is a libutil.h system
22975 set libutil.h i_libutil
22976 eval $inhdr
22977
22978 : see if mach cthreads are available
22979 if test "X$usethreads" = "X$define"; then
22980         set mach/cthreads.h i_machcthr
22981         eval $inhdr
22982 else
22983         i_machcthr="$undef"
22984 fi
22985
22986 : see if this is a mntent.h system
22987 set mntent.h i_mntent
22988 eval $inhdr
22989
22990 : see if net/errno.h is available
22991 val=''
22992 set net/errno.h val
22993 eval $inhdr
22994
22995 : Unfortunately, it causes problems on some systems.  Arrgh.
22996 case "$val" in
22997 $define)
22998         cat > try.c <<'EOM'
22999 #include <stdio.h>
23000 #include <errno.h>
23001 #include <net/errno.h>
23002 int func()
23003 {
23004         return ENOTSOCK;
23005 }
23006 EOM
23007         if $cc $ccflags -c try.c >/dev/null 2>&1; then
23008                 echo "We'll be including <net/errno.h>." >&4
23009         else
23010                 echo "We won't be including <net/errno.h>." >&4
23011                 val="$undef"
23012         fi
23013         $rm_try
23014         ;;
23015 esac
23016 set i_neterrno
23017 eval $setvar
23018
23019 : see if netinet/tcp.h is available
23020 set netinet/tcp.h i_netinettcp
23021 eval $inhdr
23022
23023 : see if this is a poll.h system
23024 set poll.h i_poll
23025 eval $inhdr
23026
23027 : see if this is a prot.h system
23028 set prot.h i_prot
23029 eval $inhdr
23030
23031 : Preprocessor symbols
23032 echo " "
23033 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
23034 $cat <<'EOSH' > Cppsym.know
23035 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
23036 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
23037 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
23038 arch_pwr ardent ARM ARM32 atarist att386 att3b
23039 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
23040 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
23041 byteorder byte_order
23042 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
23043 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
23044 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
23045 ELF encore EPI EXTENSIONS
23046 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
23047 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
23048 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
23049 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
23050 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400 hp9000s500
23051 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
23052 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
23053 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
23054 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
23055 ksr1
23056 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
23057 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
23058 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
23059 luna88k Lynx
23060 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
23061 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
23062 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
23063 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
23064 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
23065 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
23066 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
23067 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
23068 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
23069 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
23070 ns32000 ns32016 ns32332 ns32k nsc32000
23071 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23072 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23073 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23074 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23075 QK_USER QNX
23076 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23077 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23078 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23079 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23080 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23081 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23082 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23083 SYSV4 SYSV5 sysV68 sysV88
23084 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23085 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23086 tower32_800 tower32_850 tss
23087 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23088 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23089 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23090 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23091 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23092 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23093 uxpm uxps
23094 vax venix VMESA vms
23095 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23096 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23097 z8000 zarch
23098 EOSH
23099 # Maybe put other stuff here too.
23100 ./tr '-' '_' <<EOSH >>Cppsym.know
23101 $osname
23102 EOSH
23103 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23104 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23105 $cat Cppsym.know > Cppsym.c
23106 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23107 $rm -f Cppsym.a Cppsym.b Cppsym.c
23108 cat <<EOSH > Cppsym
23109 $startsh
23110 if $test \$# -gt 0; then
23111     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23112     if $test -s Cppsym.got; then
23113         $rm -f Cppsym.got
23114         exit 0
23115     fi
23116     $rm -f Cppsym.got
23117     exit 1
23118 else
23119     $tr " " "$trnl" | ./Cppsym.try
23120     exit 0
23121 fi
23122 EOSH
23123 chmod +x Cppsym
23124 $eunicefix Cppsym
23125 cat <<EOSH > Cppsym.try
23126 $startsh
23127 cat <<'EOCP' > try.c
23128 #include <stdio.h>
23129 #if cpp_stuff == 1
23130 #define STRINGIFY(a)    "a"
23131 #endif
23132 #if cpp_stuff == 42
23133 #define StGiFy(a)  #a
23134 #define STRINGIFY(a)    StGiFy(a)
23135 #endif
23136 #if $cpp_stuff != 1 && $cpp_stuff != 42
23137 #   include "Bletch: How does this C preprocessor stringify macros?"
23138 #endif
23139 int main() {
23140 EOCP
23141 $awk \\
23142 EOSH
23143 cat <<'EOSH' >> Cppsym.try
23144 'length($1) > 0 {
23145     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23146     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23147     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23148     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23149 }'       >> try.c
23150 echo 'return 0;}' >> try.c
23151 EOSH
23152 cat <<EOSH >> Cppsym.try
23153 ccflags="$ccflags"
23154 case "$osname-$gccversion" in
23155 irix-) ccflags="\$ccflags -woff 1178" ;;
23156 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
23157 esac
23158 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
23159 EOSH
23160 chmod +x Cppsym.try
23161 $eunicefix Cppsym.try
23162 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
23163 : Add in any Linux cpp "predefined macros":
23164 case "$osname::$gccversion" in
23165   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
23166     tHdrH=_tmpHdr
23167     rm -f $tHdrH'.h' $tHdrH
23168     touch $tHdrH'.h'
23169     # Filter out macro arguments, such as Linux's __INT8_C(c)
23170     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
23171        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
23172        if [ -s $tHdrH'_cppsym.real' ]; then
23173           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
23174        fi
23175     fi
23176     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
23177   ;;
23178 esac
23179 : now check the C compiler for additional symbols
23180 postprocess_cc_v=''
23181 case "$osname" in
23182 aix) postprocess_cc_v="|$tr , ' '" ;;
23183 esac
23184 $cat >ccsym <<EOS
23185 $startsh
23186 $cat >tmp.c <<EOF
23187 extern int foo;
23188 EOF
23189 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
23190 do
23191         case "\$i" in
23192         -D*) echo "\$i" | $sed 's/^-D//';;
23193         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
23194         esac
23195 done
23196 $rm_try
23197 EOS
23198 postprocess_cc_v=''
23199 chmod +x ccsym
23200 $eunicefix ccsym
23201 ./ccsym > ccsym1.raw
23202 if $test -s ccsym1.raw; then
23203     $sort ccsym1.raw | $uniq >ccsym.raw
23204 else
23205     mv ccsym1.raw ccsym.raw
23206 fi
23207
23208 $awk '/\=/ { print $0; next }
23209         { print $0"=1" }' ccsym.raw >ccsym.list
23210 $comm -13 Cppsym.true ccsym.list >ccsym.own
23211 $comm -12 Cppsym.true ccsym.list >ccsym.com
23212 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
23213 also=''
23214 if $test -z ccsym.raw; then
23215         echo "Your C compiler doesn't seem to define any symbols!" >&4
23216         echo " "
23217         echo "However, your C preprocessor defines the following symbols:"
23218         $cat Cppsym.true
23219         ccsymbols=''
23220         cppsymbols=`$cat Cppsym.true`
23221         cppsymbols=`echo $cppsymbols`
23222         cppccsymbols="$cppsymbols"
23223 else
23224         if $test -s ccsym.com; then
23225                 echo "Your C compiler and pre-processor define these symbols:"
23226                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
23227                 also='also '
23228                 symbols='ones'
23229                 cppccsymbols=`$cat ccsym.com`
23230                 cppccsymbols=`echo $cppccsymbols`
23231                 $test "$silent" || sleep 1
23232         fi
23233         if $test -s ccsym.cpp; then
23234                 $test "$also" && echo " "
23235                 echo "Your C pre-processor ${also}defines the following symbols:"
23236                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
23237                 also='further '
23238                 cppsymbols=`$cat ccsym.cpp`
23239                 cppsymbols=`echo $cppsymbols`
23240                 $test "$silent" || sleep 1
23241         fi
23242         if $test -s ccsym.own; then
23243                 $test "$also" && echo " "
23244                 echo "Your C compiler ${also}defines the following cpp symbols:"
23245                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
23246                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
23247                 ccsymbols=`$cat ccsym.own`
23248                 ccsymbols=`echo $ccsymbols`
23249                 $test "$silent" || sleep 1
23250         fi
23251 fi
23252
23253 : add -D_FORTIFY_SOURCE if feasible and not already there
23254 case "$gccversion" in
23255 4.*)    case "$optimize$ccflags" in
23256         *-O*)   case "$ccflags$cppsymbols" in
23257                 *_FORTIFY_SOURCE=*) # Don't add it again.
23258                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
23259                         ;;
23260                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
23261                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
23262                         ;;
23263                 esac
23264                 ;;
23265         *)      echo "You have gcc 4.* but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
23266                 ;;
23267         esac
23268         ;;
23269 *)      echo "You seem not to have gcc 4.*, not adding -D_FORTIFY_SOURCE." >&4
23270         ;;
23271 esac
23272
23273 : see if this is a termio system
23274 val="$undef"
23275 val2="$undef"
23276 val3="$undef"
23277 if $test `./findhdr termios.h`; then
23278     set tcsetattr i_termios
23279     eval $inlibc
23280     val3="$i_termios"
23281 fi
23282 echo " "
23283 case "$val3" in
23284     "$define") echo "You have POSIX termios.h... good!" >&4;;
23285     *)  if ./Cppsym pyr; then
23286             case "`$run /bin/universe`" in
23287                 ucb) if $test `./findhdr sgtty.h`; then
23288                         val2="$define"
23289                         echo "<sgtty.h> found." >&4
23290                     else
23291                         echo "System is pyramid with BSD universe."
23292                         ./warn "<sgtty.h> not found--you could have problems."
23293                     fi;;
23294                 *)  if $test `./findhdr termio.h`; then
23295                         val="$define"
23296                         echo "<termio.h> found." >&4
23297                     else
23298                         echo "System is pyramid with USG universe."
23299                         ./warn "<termio.h> not found--you could have problems."
23300                     fi;;
23301             esac
23302         elif ./usg; then
23303             if $test `./findhdr termio.h`; then
23304                 echo "<termio.h> found." >&4
23305                 val="$define"
23306             elif $test `./findhdr sgtty.h`; then
23307                 echo "<sgtty.h> found." >&4
23308                 val2="$define"
23309             else
23310                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23311             fi
23312         else
23313             if $test `./findhdr sgtty.h`; then
23314                 echo "<sgtty.h> found." >&4
23315                 val2="$define"
23316             elif $test `./findhdr termio.h`; then
23317                 echo "<termio.h> found." >&4
23318                 val="$define"
23319             else
23320                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23321             fi
23322         fi;;
23323 esac
23324 set i_termio; eval $setvar
23325 val=$val2; set i_sgtty; eval $setvar
23326 val=$val3; set i_termios; eval $setvar
23327
23328 : see if stdbool is available
23329 : we want a real compile instead of Inhdr because some Solaris systems
23330 : have stdbool.h, but it can only be used if the compiler indicates it
23331 : is sufficiently c99-compliant.
23332 echo " "
23333 $cat >try.c <<EOCP
23334 #include <stdio.h>
23335 #include <stdbool.h>
23336 int func(bool x)
23337 {
23338     return x ? 1 : 0;
23339 }
23340 int main(int argc, char **argv)
23341 {
23342     return func(0);
23343 }
23344 EOCP
23345 set try
23346 if eval $compile; then
23347         echo "<stdbool.h> found." >&4
23348         val="$define"
23349 else
23350         echo "<stdbool.h> NOT found." >&4
23351         val="$undef"
23352 fi
23353 $rm_try
23354 set i_stdbool
23355 eval $setvar
23356
23357 : see if stddef is available
23358 set stddef.h i_stddef
23359 eval $inhdr
23360
23361 : see if stdint is available
23362 set stdint.h i_stdint
23363 eval $inhdr
23364
23365 : see if sys/access.h is available
23366 set sys/access.h i_sysaccess
23367 eval $inhdr
23368
23369 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23370 set sys/filio.h i_sysfilio
23371 eval $inhdr
23372 echo " "
23373 if $test `./findhdr sys/ioctl.h`; then
23374         val="$define"
23375         echo '<sys/ioctl.h> found.' >&4
23376 else
23377         val="$undef"
23378         if $test $i_sysfilio = "$define"; then
23379             echo '<sys/ioctl.h> NOT found.' >&4
23380         else
23381                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23382                 $test $i_termio = "$define" && xxx="termio.h"
23383                 $test $i_termios = "$define" && xxx="termios.h"
23384 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23385         fi
23386 fi
23387 set i_sysioctl
23388 eval $setvar
23389
23390 : see if socket ioctl defs are in sys/sockio.h
23391 echo " "
23392 xxx=`./findhdr sys/sockio.h`
23393 if $test "$xxx"; then
23394         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23395                 val="$define"
23396                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23397         else
23398                 val="$undef"
23399                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23400         fi
23401 else
23402         val="$undef"
23403         $cat <<EOM
23404 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23405 EOM
23406 fi
23407 set i_syssockio
23408 eval $setvar
23409
23410 : see if this is a syslog.h system
23411 set syslog.h i_syslog
23412 eval $inhdr
23413
23414 : see if this is a sys/mode.h system
23415 set sys/mode.h i_sysmode
23416 eval $inhdr
23417
23418 : see if there is a sys/poll.h file
23419 set sys/poll.h i_syspoll
23420 eval $inhdr
23421
23422 : see if sys/resource.h has to be included
23423 set sys/resource.h i_sysresrc
23424 eval $inhdr
23425
23426 : see if sys/security.h is available
23427 set sys/security.h i_syssecrt
23428 eval $inhdr
23429
23430 : see if this is a sys/statvfs.h system
23431 set sys/statvfs.h i_sysstatvfs
23432 eval $inhdr
23433
23434 : see if this is a sys/un.h system
23435 set sys/un.h i_sysun
23436 eval $inhdr
23437
23438 : see if this is a sys/utsname.h system
23439 set sys/utsname.h i_sysutsname
23440 eval $inhdr
23441
23442 : see if this is a syswait system
23443 set sys/wait.h i_syswait
23444 eval $inhdr
23445
23446 : see if this is a ustat.h system
23447 set ustat.h i_ustat
23448 eval $inhdr
23449
23450 : see if this is an utime system
23451 set utime.h i_utime
23452 eval $inhdr
23453
23454 : see if this is a vfork system
23455 case "$d_vfork" in
23456 "$define")
23457         set vfork.h i_vfork
23458         eval $inhdr
23459         ;;
23460 *)
23461         i_vfork="$undef"
23462         ;;
23463 esac
23464
23465 : Check extensions
23466 echo " "
23467 echo "Looking for extensions..." >&4
23468 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23469 : contain old or inaccurate or duplicate values.
23470 nonxs_extensions=''
23471 xs_extensions=''
23472 : We do not use find because it might not be available.
23473 : We do not just use MANIFEST because the user may have dropped
23474 : some additional extensions into the source tree and expect them
23475 : to be built.
23476
23477 : Function to recursively find available extensions, ignoring DynaLoader
23478 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23479 : In 5.10.1 and later, extensions are stored in directories
23480 : like File-Glob instead of the older File/Glob/.
23481 find_extensions='
23482     for xxx in *; do
23483         case "$xxx" in
23484             DynaLoader|dynaload) ;;
23485             *)
23486             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23487             case "$this_ext" in
23488                 Scalar/List/Utils) this_ext="List/Util" ;;
23489                 PathTools)         this_ext="Cwd"       ;;
23490             esac;
23491             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23492             if $contains " $this_ext " "$tdir/$$.tmp"; then
23493                 echo >&4;
23494                 echo "Duplicate directories detected for extension $xxx" >&4;
23495                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23496                 case "$knowitall" in
23497                 "") dflt=y;;
23498                 *) dflt=n;;
23499                 esac;
23500                 . ../UU/myread;
23501                 case "$ans" in
23502                 n*|N*) ;;
23503                 *) echo >&4;
23504                     echo "Ok.  Stopping Configure." >&4;
23505                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23506                     exit 1;;
23507                 esac;
23508                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23509             fi;
23510             $ls -1 "$xxx" > "$tdir/$$.tmp";
23511             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23512                 xs_extensions="$xs_extensions $this_ext";
23513             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
23514                 xs_extensions="$xs_extensions $this_ext";
23515             elif $test -d "$xxx"; then
23516                 nonxs_extensions="$nonxs_extensions $this_ext";
23517             fi;
23518             $rm -f "$tdir/$$.tmp";
23519             ;;
23520         esac;
23521     done'
23522 tdir=`pwd`
23523 cd "$rsrc/cpan"
23524 set X
23525 shift
23526 eval $find_extensions
23527 cd "$rsrc/dist"
23528 set X
23529 shift
23530 eval $find_extensions
23531 cd "$rsrc/ext"
23532 set X
23533 shift
23534 eval $find_extensions
23535 set X $xs_extensions
23536 shift
23537 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23538 set X $nonxs_extensions
23539 shift
23540 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23541 cd "$tdir"
23542 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23543
23544 : Now see which are supported on this system.
23545 avail_ext=''
23546 for xxx in $xs_extensions ; do
23547         case "$xxx" in
23548         Amiga*)
23549                 case "$osname" in
23550                 amigaos) avail_ext="$avail_ext $xxx" ;;
23551                 esac
23552                 ;;
23553         DB_File|db_file)
23554                 case "$i_db" in
23555                 $define) avail_ext="$avail_ext $xxx" ;;
23556                 esac
23557                 ;;
23558         GDBM_File|gdbm_fil)
23559                 case "$i_gdbm" in
23560                 $define) avail_ext="$avail_ext $xxx" ;;
23561                 esac
23562                 ;;
23563         I18N/Langinfo|i18n_lan)
23564                 case "$i_langinfo$d_nl_langinfo" in
23565                 $define$define) avail_ext="$avail_ext $xxx" ;;
23566                 esac
23567                 ;;
23568         IPC/SysV|ipc/sysv)
23569                 : XXX Do we need a useipcsysv variable here
23570                 case "${d_msg}${d_sem}${d_shm}" in
23571                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23572                 esac
23573                 ;;
23574         NDBM_File|ndbm_fil)
23575                 case "$d_ndbm" in
23576                 $define)
23577                     case "$osname-$use64bitint" in
23578                     hpux-define)
23579                         case "$libs" in
23580                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23581                         esac
23582                         ;;
23583                     *) avail_ext="$avail_ext $xxx" ;;
23584                     esac
23585                     ;;
23586                 esac
23587                 ;;
23588         ODBM_File|odbm_fil)
23589                 case "${i_dbm}${i_rpcsvcdbm}" in
23590                 *"${define}"*)
23591                     case "$d_cplusplus" in
23592                     define) ;; # delete as a function name will not work
23593                     *)  case "$osname-$use64bitint" in
23594                         hpux-define)
23595                             case "$libs" in
23596                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23597                             esac
23598                             ;;
23599                         *) avail_ext="$avail_ext $xxx" ;;
23600                         esac
23601                         ;;
23602                     esac
23603                     ;;
23604                 esac
23605                 ;;
23606         Opcode|opcode)
23607                 case "$useopcode" in
23608                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23609                 esac
23610                 ;;
23611         POSIX|posix)
23612                 case "$useposix" in
23613                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23614                 esac
23615                 ;;
23616         Socket|socket)
23617                 case "$d_socket" in
23618                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23619                 esac
23620                 ;;
23621         Sys/Syslog|sys/syslog)
23622                 case $osname in
23623                         amigaos) ;; # not really very useful on AmigaOS
23624                         *)
23625                         : XXX syslog requires socket
23626                         case "$d_socket" in
23627                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
23628                         esac
23629                         ;;
23630                 esac
23631                 ;;
23632         Thread|thread)
23633                 case "$usethreads" in
23634                 true|$define|y)
23635                         case "$use5005threads" in
23636                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23637                         esac
23638                 esac
23639                 ;;
23640         threads|threads/shared)
23641                 # threads and threads::shared are special cases.
23642                 # To stop people from asking "Perl 5.8.0 was supposed
23643                 # to have this new fancy threads implementation but my
23644                 # perl doesn't have it" and from people trying to
23645                 # (re)install the threads module using CPAN.pm and
23646                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23647                 # the threads.pm and threads/shared.pm will always be
23648                 # there, croaking informatively ("you need to rebuild
23649                 # all of Perl with threads, sorry") when threads haven't
23650                 # been compiled in.
23651                 # --jhi
23652                 avail_ext="$avail_ext $xxx"
23653                 ;;
23654         VMS*)
23655                 ;;
23656         Win32*)
23657                 case "$osname" in
23658                 cygwin) avail_ext="$avail_ext $xxx" ;;
23659                 esac
23660                 ;;
23661         XS/APItest|xs/apitest)
23662                 # This is just for testing.  Skip it unless we have dynamic loading.
23663
23664                 case "$usedl" in
23665                 $define) avail_ext="$avail_ext $xxx" ;;
23666                 esac
23667                 ;;
23668         XS/Typemap|xs/typemap)
23669                 # This is just for testing.  Skip it unless we have dynamic loading.
23670                 case "$usedl" in
23671                 $define) avail_ext="$avail_ext $xxx" ;;
23672                 esac
23673                 ;;
23674         *)      avail_ext="$avail_ext $xxx"
23675                 ;;
23676         esac
23677 done
23678
23679 set X $avail_ext
23680 shift
23681 avail_ext="$*"
23682
23683 case "$onlyextensions" in
23684 '') ;;
23685 *)  keepextensions=''
23686     echo "You have requested that only certain extensions be included..." >&4
23687     for i in $onlyextensions; do
23688         case " $avail_ext " in
23689         *" $i "*)
23690             echo "Keeping extension $i."
23691             keepextensions="$keepextensions $i"
23692             ;;
23693         *) echo "Ignoring extension $i." ;;
23694         esac
23695     done
23696     avail_ext="$keepextensions"
23697     ;;
23698 esac
23699
23700 case "$noextensions" in
23701 '') ;;
23702 *)  keepextensions=''
23703     echo "You have requested that certain extensions be ignored..." >&4
23704     for i in $avail_ext; do
23705         case " $noextensions " in
23706         *" $i "*) echo "Ignoring extension $i." ;;
23707         *) echo "Keeping extension $i.";
23708            keepextensions="$keepextensions $i"
23709            ;;
23710         esac
23711     done
23712     avail_ext="$keepextensions"
23713     ;;
23714 esac
23715
23716 : Now see which nonxs extensions are supported on this system.
23717 : For now assume all are.
23718 nonxs_ext=''
23719 for xxx in $nonxs_extensions ; do
23720         case "$xxx" in
23721         VMS*)
23722                 ;;
23723         *)      nonxs_ext="$nonxs_ext $xxx"
23724                 ;;
23725         esac
23726 done
23727
23728 set X $nonxs_ext
23729 shift
23730 nonxs_ext="$*"
23731
23732 case $usedl in
23733 $define)
23734         $cat <<EOM
23735 A number of extensions are supplied with $package.  You may choose to
23736 compile these extensions for dynamic loading (the default), compile
23737 them into the $package executable (static loading), or not include
23738 them at all.  Answer "none" to include no extensions.
23739 Note that DynaLoader is always built and need not be mentioned here.
23740
23741 EOM
23742         case "$dynamic_ext" in
23743         '')
23744                 : Exclude those listed in static_ext
23745                 dflt=''
23746                 for xxx in $avail_ext; do
23747                         case " $static_ext " in
23748                         *" $xxx "*) ;;
23749                         *) dflt="$dflt $xxx" ;;
23750                         esac
23751                 done
23752                 set X $dflt
23753                 shift
23754                 dflt="$*"
23755                 ;;
23756         *)      dflt="$dynamic_ext"
23757                 # Perhaps we are reusing an old out-of-date config.sh.
23758                 case "$hint" in
23759                 previous)
23760                         if test X"$dynamic_ext" != X"$avail_ext"; then
23761                                 $cat <<EOM
23762 NOTICE:  Your previous config.sh list may be incorrect.
23763 The extensions now available to you are
23764         ${avail_ext}
23765 but the default list from your previous config.sh is
23766         ${dynamic_ext}
23767
23768 EOM
23769                         fi
23770                         ;;
23771                 esac
23772                 ;;
23773         esac
23774         case "$dflt" in
23775         '')     dflt=none;;
23776         esac
23777         rp="What extensions do you wish to load dynamically?"
23778         . ./myread
23779         case "$ans" in
23780         none) dynamic_ext=' ' ;;
23781         *) dynamic_ext="$ans" ;;
23782         esac
23783
23784         case "$static_ext" in
23785         '')
23786                 : Exclude those already listed in dynamic linking
23787                 dflt=''
23788                 for xxx in $avail_ext; do
23789                         case " $dynamic_ext " in
23790                         *" $xxx "*) ;;
23791                         *) dflt="$dflt $xxx" ;;
23792                         esac
23793                 done
23794                 set X $dflt
23795                 shift
23796                 dflt="$*"
23797                 ;;
23798         *)  dflt="$static_ext"
23799                 ;;
23800         esac
23801
23802         case "$dflt" in
23803         '')     dflt=none;;
23804         esac
23805         rp="What extensions do you wish to load statically?"
23806         . ./myread
23807         case "$ans" in
23808         none) static_ext=' ' ;;
23809         *) static_ext="$ans" ;;
23810         esac
23811         ;;
23812 *)
23813         $cat <<EOM
23814 A number of extensions are supplied with $package.  Answer "none"
23815 to include no extensions.
23816 Note that DynaLoader is always built and need not be mentioned here.
23817
23818 EOM
23819         case "$static_ext" in
23820         '') dflt="$avail_ext" ;;
23821         *)      dflt="$static_ext"
23822                 # Perhaps we are reusing an old out-of-date config.sh.
23823                 case "$hint" in
23824                 previous)
23825                         if test X"$static_ext" != X"$avail_ext"; then
23826                                 $cat <<EOM
23827 NOTICE:  Your previous config.sh list may be incorrect.
23828 The extensions now available to you are
23829         ${avail_ext}
23830 but the default list from your previous config.sh is
23831         ${static_ext}
23832
23833 EOM
23834                         fi
23835                         ;;
23836                 esac
23837                 ;;
23838         esac
23839         : Exclude those that are not xs extensions
23840         case "$dflt" in
23841         '')     dflt=none;;
23842         esac
23843         rp="What extensions do you wish to include?"
23844         . ./myread
23845         case "$ans" in
23846         none) static_ext=' ' ;;
23847         *) static_ext="$ans" ;;
23848         esac
23849         ;;
23850 esac
23851 #
23852 # Encode is a special case.  If we are building Encode as a static
23853 # extension, we need to explicitly list its subextensions as well.
23854 # For other nested extensions, this is handled automatically by
23855 # the appropriate Makefile.PL.
23856 case " $static_ext " in
23857         *" Encode "*) # Add the subextensions of Encode
23858         cd "$rsrc/cpan"
23859         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23860                 static_ext="$static_ext Encode/$xxx"
23861                 known_extensions="$known_extensions Encode/$xxx"
23862         done
23863         cd "$tdir"
23864         ;;
23865 esac
23866
23867 set X $dynamic_ext $static_ext $nonxs_ext
23868 shift
23869 extensions="$*"
23870
23871 # Sanity check:  We require an extension suitable for use with
23872 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23873 # should show up as failures in the test suite, but it's helpful to
23874 # catch them now.) The 'extensions' list is normally sorted
23875 # alphabetically, so we need to accept either
23876 #    DB_File ... Fcntl ... IO  ....
23877 # or something like
23878 #    Fcntl ... NDBM_File ... IO  ....
23879 case " $extensions"  in
23880 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
23881 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23882 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23883 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23884    echo "WARNING: The Perl you are building will be quite crippled." >& 4
23885    ;;
23886 esac
23887
23888 : Remove libraries needed only for extensions
23889 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23890 : The exception is SunOS 4.x, which needs them.
23891 case "${osname}X${osvers}" in
23892 sunos*X4*)
23893     perllibs="$libs"
23894     ;;
23895 *) case "$usedl" in
23896     $define|true|[yY]*)
23897             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23898             shift
23899             perllibs="$*"
23900             ;;
23901     *)  perllibs="$libs"
23902             ;;
23903     esac
23904     ;;
23905 esac
23906
23907 : Remove build directory name from cppstdin so it can be used from
23908 : either the present location or the final installed location.
23909 echo " "
23910 : Get out of the UU directory to get correct path name.
23911 cd ..
23912 case "$cppstdin" in
23913 `pwd`/cppstdin)
23914         echo "Stripping down cppstdin path name"
23915         cppstdin=cppstdin
23916         ;;
23917 esac
23918 cd UU
23919
23920 : end of configuration questions
23921 echo " "
23922 echo "End of configuration questions."
23923 echo " "
23924
23925 : back to where it started
23926 if test -d ../UU; then
23927         cd ..
23928 fi
23929
23930 : configuration may be unconditionally patched via a 'config.arch' file
23931 if $test -f config.arch; then
23932         echo "I see a config.arch file, loading it." >&4
23933         . ./config.arch
23934 fi
23935
23936 : configuration may be patched via a 'config.over' file
23937 if $test -f config.over; then
23938         echo " "
23939         dflt=y
23940         rp='I see a config.over file.  Do you wish to load it?'
23941         . UU/myread
23942         case "$ans" in
23943         n*) echo "OK, I'll ignore it.";;
23944         *)      . ./config.over
23945                 echo "Configuration override changes have been loaded."
23946                 ;;
23947         esac
23948 fi
23949
23950 : in case they want portability, strip down executable paths
23951 case "$d_portable" in
23952 "$define")
23953         echo " "
23954         echo "Stripping down executable paths..." >&4
23955         for file in $loclist $trylist; do
23956                 eval temp=\$$file
23957                 eval $file=`basename $temp`
23958         done
23959         ;;
23960 esac
23961
23962 : create config.sh file
23963 echo " "
23964 echo "Creating config.sh..." >&4
23965 $spitshell <<EOT >config.sh
23966 $startsh
23967 #
23968 # This file was produced by running the Configure script. It holds all the
23969 # definitions figured out by Configure. Should you modify one of these values,
23970 # do not forget to propagate your changes by running "Configure -der". You may
23971 # instead choose to run each of the .SH files by yourself, or "Configure -S".
23972 #
23973
23974 # Package name      : $package
23975 # Source directory  : $src
23976 # Configuration time: $cf_time
23977 # Configured by     : $cf_by
23978 # Target system     : $myuname
23979
23980 EOT
23981 : Add in command line options if available
23982 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23983
23984 $spitshell <<EOT >>config.sh
23985
23986 Author='$Author'
23987 Date='$Date'
23988 Header='$Header'
23989 Id='$Id'
23990 Locker='$Locker'
23991 Log='$Log'
23992 RCSfile='$RCSfile'
23993 Revision='$Revision'
23994 Source='$Source'
23995 State='$State'
23996 _a='$_a'
23997 _exe='$_exe'
23998 _o='$_o'
23999 afs='$afs'
24000 afsroot='$afsroot'
24001 alignbytes='$alignbytes'
24002 ansi2knr='$ansi2knr'
24003 aphostname='$aphostname'
24004 api_revision='$api_revision'
24005 api_subversion='$api_subversion'
24006 api_version='$api_version'
24007 api_versionstring='$api_versionstring'
24008 ar='$ar'
24009 archlib='$archlib'
24010 archlibexp='$archlibexp'
24011 archname64='$archname64'
24012 archname='$archname'
24013 archobjs='$archobjs'
24014 asctime_r_proto='$asctime_r_proto'
24015 awk='$awk'
24016 baserev='$baserev'
24017 bash='$bash'
24018 bin='$bin'
24019 bin_ELF='$bin_ELF'
24020 binexp='$binexp'
24021 bison='$bison'
24022 byacc='$byacc'
24023 byteorder='$byteorder'
24024 c='$c'
24025 castflags='$castflags'
24026 cat='$cat'
24027 cc='$cc'
24028 cccdlflags='$cccdlflags'
24029 ccdlflags='$ccdlflags'
24030 ccflags='$ccflags'
24031 ccflags_uselargefiles='$ccflags_uselargefiles'
24032 ccname='$ccname'
24033 ccsymbols='$ccsymbols'
24034 ccversion='$ccversion'
24035 cf_by='$cf_by'
24036 cf_email='$cf_email'
24037 cf_time='$cf_time'
24038 charbits='$charbits'
24039 charsize='$charsize'
24040 chgrp='$chgrp'
24041 chmod='$chmod'
24042 chown='$chown'
24043 clocktype='$clocktype'
24044 comm='$comm'
24045 compress='$compress'
24046 contains='$contains'
24047 cp='$cp'
24048 cpio='$cpio'
24049 cpp='$cpp'
24050 cpp_stuff='$cpp_stuff'
24051 cppccsymbols='$cppccsymbols'
24052 cppflags='$cppflags'
24053 cpplast='$cpplast'
24054 cppminus='$cppminus'
24055 cpprun='$cpprun'
24056 cppstdin='$cppstdin'
24057 cppsymbols='$cppsymbols'
24058 crypt_r_proto='$crypt_r_proto'
24059 cryptlib='$cryptlib'
24060 csh='$csh'
24061 ctermid_r_proto='$ctermid_r_proto'
24062 ctime_r_proto='$ctime_r_proto'
24063 d_Gconvert='$d_Gconvert'
24064 d_PRIEUldbl='$d_PRIEUldbl'
24065 d_PRIFUldbl='$d_PRIFUldbl'
24066 d_PRIGUldbl='$d_PRIGUldbl'
24067 d_PRIXU64='$d_PRIXU64'
24068 d_PRId64='$d_PRId64'
24069 d_PRIeldbl='$d_PRIeldbl'
24070 d_PRIfldbl='$d_PRIfldbl'
24071 d_PRIgldbl='$d_PRIgldbl'
24072 d_PRIi64='$d_PRIi64'
24073 d_PRIo64='$d_PRIo64'
24074 d_PRIu64='$d_PRIu64'
24075 d_PRIx64='$d_PRIx64'
24076 d_SCNfldbl='$d_SCNfldbl'
24077 d__fwalk='$d__fwalk'
24078 d_access='$d_access'
24079 d_accessx='$d_accessx'
24080 d_acosh='$d_acosh'
24081 d_aintl='$d_aintl'
24082 d_alarm='$d_alarm'
24083 d_archlib='$d_archlib'
24084 d_asctime64='$d_asctime64'
24085 d_asctime_r='$d_asctime_r'
24086 d_asinh='$d_asinh'
24087 d_atanh='$d_atanh'
24088 d_atolf='$d_atolf'
24089 d_atoll='$d_atoll'
24090 d_attribute_deprecated='$d_attribute_deprecated'
24091 d_attribute_format='$d_attribute_format'
24092 d_attribute_malloc='$d_attribute_malloc'
24093 d_attribute_nonnull='$d_attribute_nonnull'
24094 d_attribute_noreturn='$d_attribute_noreturn'
24095 d_attribute_pure='$d_attribute_pure'
24096 d_attribute_unused='$d_attribute_unused'
24097 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24098 d_backtrace='$d_backtrace'
24099 d_bcmp='$d_bcmp'
24100 d_bcopy='$d_bcopy'
24101 d_bsd='$d_bsd'
24102 d_bsdgetpgrp='$d_bsdgetpgrp'
24103 d_bsdsetpgrp='$d_bsdsetpgrp'
24104 d_builtin_choose_expr='$d_builtin_choose_expr'
24105 d_builtin_expect='$d_builtin_expect'
24106 d_bzero='$d_bzero'
24107 d_c99_variadic_macros='$d_c99_variadic_macros'
24108 d_casti32='$d_casti32'
24109 d_castneg='$d_castneg'
24110 d_cbrt='$d_cbrt'
24111 d_charvspr='$d_charvspr'
24112 d_chown='$d_chown'
24113 d_chroot='$d_chroot'
24114 d_chsize='$d_chsize'
24115 d_class='$d_class'
24116 d_clearenv='$d_clearenv'
24117 d_closedir='$d_closedir'
24118 d_cmsghdr_s='$d_cmsghdr_s'
24119 d_const='$d_const'
24120 d_copysign='$d_copysign'
24121 d_copysignl='$d_copysignl'
24122 d_cplusplus='$d_cplusplus'
24123 d_crypt='$d_crypt'
24124 d_crypt_r='$d_crypt_r'
24125 d_csh='$d_csh'
24126 d_ctermid='$d_ctermid'
24127 d_ctermid_r='$d_ctermid_r'
24128 d_ctime64='$d_ctime64'
24129 d_ctime_r='$d_ctime_r'
24130 d_cuserid='$d_cuserid'
24131 d_dbl_dig='$d_dbl_dig'
24132 d_dbminitproto='$d_dbminitproto'
24133 d_difftime64='$d_difftime64'
24134 d_difftime='$d_difftime'
24135 d_dir_dd_fd='$d_dir_dd_fd'
24136 d_dirfd='$d_dirfd'
24137 d_dirnamlen='$d_dirnamlen'
24138 d_dladdr='$d_dladdr'
24139 d_dlerror='$d_dlerror'
24140 d_dlopen='$d_dlopen'
24141 d_dlsymun='$d_dlsymun'
24142 d_dosuid='$d_dosuid'
24143 d_drand48_r='$d_drand48_r'
24144 d_drand48proto='$d_drand48proto'
24145 d_dup2='$d_dup2'
24146 d_eaccess='$d_eaccess'
24147 d_endgrent='$d_endgrent'
24148 d_endgrent_r='$d_endgrent_r'
24149 d_endhent='$d_endhent'
24150 d_endhostent_r='$d_endhostent_r'
24151 d_endnent='$d_endnent'
24152 d_endnetent_r='$d_endnetent_r'
24153 d_endpent='$d_endpent'
24154 d_endprotoent_r='$d_endprotoent_r'
24155 d_endpwent='$d_endpwent'
24156 d_endpwent_r='$d_endpwent_r'
24157 d_endsent='$d_endsent'
24158 d_endservent_r='$d_endservent_r'
24159 d_eofnblk='$d_eofnblk'
24160 d_erf='$d_erf'
24161 d_erfc='$d_erfc'
24162 d_eunice='$d_eunice'
24163 d_exp2='$d_exp2'
24164 d_expm1='$d_expm1'
24165 d_faststdio='$d_faststdio'
24166 d_fchdir='$d_fchdir'
24167 d_fchmod='$d_fchmod'
24168 d_fchown='$d_fchown'
24169 d_fcntl='$d_fcntl'
24170 d_fcntl_can_lock='$d_fcntl_can_lock'
24171 d_fd_macros='$d_fd_macros'
24172 d_fd_set='$d_fd_set'
24173 d_fdim='$d_fdim'
24174 d_fds_bits='$d_fds_bits'
24175 d_fegetround='$d_fegetround'
24176 d_fgetpos='$d_fgetpos'
24177 d_finite='$d_finite'
24178 d_finitel='$d_finitel'
24179 d_flexfnam='$d_flexfnam'
24180 d_flock='$d_flock'
24181 d_flockproto='$d_flockproto'
24182 d_fma='$d_fma'
24183 d_fmax='$d_fmax'
24184 d_fmin='$d_fmin'
24185 d_fork='$d_fork'
24186 d_fp_class='$d_fp_class'
24187 d_fp_classify='$d_fp_classify'
24188 d_fp_classl='$d_fp_classl'
24189 d_fpathconf='$d_fpathconf'
24190 d_fpclass='$d_fpclass'
24191 d_fpclassify='$d_fpclassify'
24192 d_fpclassl='$d_fpclassl'
24193 d_fpgetround='$d_fpgetround'
24194 d_fpos64_t='$d_fpos64_t'
24195 d_frexpl='$d_frexpl'
24196 d_fs_data_s='$d_fs_data_s'
24197 d_fseeko='$d_fseeko'
24198 d_fsetpos='$d_fsetpos'
24199 d_fstatfs='$d_fstatfs'
24200 d_fstatvfs='$d_fstatvfs'
24201 d_fsync='$d_fsync'
24202 d_ftello='$d_ftello'
24203 d_ftime='$d_ftime'
24204 d_futimes='$d_futimes'
24205 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
24206 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
24207 d_getaddrinfo='$d_getaddrinfo'
24208 d_getcwd='$d_getcwd'
24209 d_getespwnam='$d_getespwnam'
24210 d_getfsstat='$d_getfsstat'
24211 d_getgrent='$d_getgrent'
24212 d_getgrent_r='$d_getgrent_r'
24213 d_getgrgid_r='$d_getgrgid_r'
24214 d_getgrnam_r='$d_getgrnam_r'
24215 d_getgrps='$d_getgrps'
24216 d_gethbyaddr='$d_gethbyaddr'
24217 d_gethbyname='$d_gethbyname'
24218 d_gethent='$d_gethent'
24219 d_gethname='$d_gethname'
24220 d_gethostbyaddr_r='$d_gethostbyaddr_r'
24221 d_gethostbyname_r='$d_gethostbyname_r'
24222 d_gethostent_r='$d_gethostent_r'
24223 d_gethostprotos='$d_gethostprotos'
24224 d_getitimer='$d_getitimer'
24225 d_getlogin='$d_getlogin'
24226 d_getlogin_r='$d_getlogin_r'
24227 d_getmnt='$d_getmnt'
24228 d_getmntent='$d_getmntent'
24229 d_getnameinfo='$d_getnameinfo'
24230 d_getnbyaddr='$d_getnbyaddr'
24231 d_getnbyname='$d_getnbyname'
24232 d_getnent='$d_getnent'
24233 d_getnetbyaddr_r='$d_getnetbyaddr_r'
24234 d_getnetbyname_r='$d_getnetbyname_r'
24235 d_getnetent_r='$d_getnetent_r'
24236 d_getnetprotos='$d_getnetprotos'
24237 d_getpagsz='$d_getpagsz'
24238 d_getpbyname='$d_getpbyname'
24239 d_getpbynumber='$d_getpbynumber'
24240 d_getpent='$d_getpent'
24241 d_getpgid='$d_getpgid'
24242 d_getpgrp2='$d_getpgrp2'
24243 d_getpgrp='$d_getpgrp'
24244 d_getppid='$d_getppid'
24245 d_getprior='$d_getprior'
24246 d_getprotobyname_r='$d_getprotobyname_r'
24247 d_getprotobynumber_r='$d_getprotobynumber_r'
24248 d_getprotoent_r='$d_getprotoent_r'
24249 d_getprotoprotos='$d_getprotoprotos'
24250 d_getprpwnam='$d_getprpwnam'
24251 d_getpwent='$d_getpwent'
24252 d_getpwent_r='$d_getpwent_r'
24253 d_getpwnam_r='$d_getpwnam_r'
24254 d_getpwuid_r='$d_getpwuid_r'
24255 d_getsbyname='$d_getsbyname'
24256 d_getsbyport='$d_getsbyport'
24257 d_getsent='$d_getsent'
24258 d_getservbyname_r='$d_getservbyname_r'
24259 d_getservbyport_r='$d_getservbyport_r'
24260 d_getservent_r='$d_getservent_r'
24261 d_getservprotos='$d_getservprotos'
24262 d_getspnam='$d_getspnam'
24263 d_getspnam_r='$d_getspnam_r'
24264 d_gettimeod='$d_gettimeod'
24265 d_gmtime64='$d_gmtime64'
24266 d_gmtime_r='$d_gmtime_r'
24267 d_gnulibc='$d_gnulibc'
24268 d_grpasswd='$d_grpasswd'
24269 d_hasmntopt='$d_hasmntopt'
24270 d_htonl='$d_htonl'
24271 d_hypot='$d_hypot'
24272 d_ilogb='$d_ilogb'
24273 d_ilogbl='$d_ilogbl'
24274 d_inc_version_list='$d_inc_version_list'
24275 d_index='$d_index'
24276 d_inetaton='$d_inetaton'
24277 d_inetntop='$d_inetntop'
24278 d_inetpton='$d_inetpton'
24279 d_int64_t='$d_int64_t'
24280 d_ip_mreq='$d_ip_mreq'
24281 d_ip_mreq_source='$d_ip_mreq_source'
24282 d_ipv6_mreq='$d_ipv6_mreq'
24283 d_ipv6_mreq_source='$d_ipv6_mreq_source'
24284 d_isascii='$d_isascii'
24285 d_isblank='$d_isblank'
24286 d_isfinite='$d_isfinite'
24287 d_isfinitel='$d_isfinitel'
24288 d_isinf='$d_isinf'
24289 d_isinfl='$d_isinfl'
24290 d_isless='$d_isless'
24291 d_isnan='$d_isnan'
24292 d_isnanl='$d_isnanl'
24293 d_isnormal='$d_isnormal'
24294 d_j0='$d_j0'
24295 d_j0l='$d_j0l'
24296 d_killpg='$d_killpg'
24297 d_lc_monetary_2008='$d_lc_monetary_2008'
24298 d_lchown='$d_lchown'
24299 d_ldbl_dig='$d_ldbl_dig'
24300 d_ldexpl='$d_ldexpl'
24301 d_lgamma='$d_lgamma'
24302 d_lgamma_r='$d_lgamma_r'
24303 d_libm_lib_version='$d_libm_lib_version'
24304 d_libname_unique='$d_libname_unique'
24305 d_link='$d_link'
24306 d_llrint='$d_llrint'
24307 d_llrintl='$d_llrintl'
24308 d_llround='$d_llround'
24309 d_llroundl='$d_llroundl'
24310 d_localtime64='$d_localtime64'
24311 d_localtime_r='$d_localtime_r'
24312 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24313 d_locconv='$d_locconv'
24314 d_lockf='$d_lockf'
24315 d_log1p='$d_log1p'
24316 d_log2='$d_log2'
24317 d_logb='$d_logb'
24318 d_longdbl='$d_longdbl'
24319 d_longlong='$d_longlong'
24320 d_lrint='$d_lrint'
24321 d_lrintl='$d_lrintl'
24322 d_lround='$d_lround'
24323 d_lroundl='$d_lroundl'
24324 d_lseekproto='$d_lseekproto'
24325 d_lstat='$d_lstat'
24326 d_madvise='$d_madvise'
24327 d_malloc_good_size='$d_malloc_good_size'
24328 d_malloc_size='$d_malloc_size'
24329 d_mblen='$d_mblen'
24330 d_mbstowcs='$d_mbstowcs'
24331 d_mbtowc='$d_mbtowc'
24332 d_memchr='$d_memchr'
24333 d_memcmp='$d_memcmp'
24334 d_memcpy='$d_memcpy'
24335 d_memmove='$d_memmove'
24336 d_memset='$d_memset'
24337 d_mkdir='$d_mkdir'
24338 d_mkdtemp='$d_mkdtemp'
24339 d_mkfifo='$d_mkfifo'
24340 d_mkstemp='$d_mkstemp'
24341 d_mkstemps='$d_mkstemps'
24342 d_mktime64='$d_mktime64'
24343 d_mktime='$d_mktime'
24344 d_mmap='$d_mmap'
24345 d_modfl='$d_modfl'
24346 d_modfl_pow32_bug='$d_modfl_pow32_bug'
24347 d_modflproto='$d_modflproto'
24348 d_mprotect='$d_mprotect'
24349 d_msg='$d_msg'
24350 d_msg_ctrunc='$d_msg_ctrunc'
24351 d_msg_dontroute='$d_msg_dontroute'
24352 d_msg_oob='$d_msg_oob'
24353 d_msg_peek='$d_msg_peek'
24354 d_msg_proxy='$d_msg_proxy'
24355 d_msgctl='$d_msgctl'
24356 d_msgget='$d_msgget'
24357 d_msghdr_s='$d_msghdr_s'
24358 d_msgrcv='$d_msgrcv'
24359 d_msgsnd='$d_msgsnd'
24360 d_msync='$d_msync'
24361 d_munmap='$d_munmap'
24362 d_mymalloc='$d_mymalloc'
24363 d_nan='$d_nan'
24364 d_ndbm='$d_ndbm'
24365 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24366 d_nearbyint='$d_nearbyint'
24367 d_nextafter='$d_nextafter'
24368 d_nexttoward='$d_nexttoward'
24369 d_nice='$d_nice'
24370 d_nl_langinfo='$d_nl_langinfo'
24371 d_nv_preserves_uv='$d_nv_preserves_uv'
24372 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24373 d_off64_t='$d_off64_t'
24374 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24375 d_oldpthreads='$d_oldpthreads'
24376 d_oldsock='$d_oldsock'
24377 d_open3='$d_open3'
24378 d_pathconf='$d_pathconf'
24379 d_pause='$d_pause'
24380 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24381 d_phostname='$d_phostname'
24382 d_pipe='$d_pipe'
24383 d_poll='$d_poll'
24384 d_portable='$d_portable'
24385 d_prctl='$d_prctl'
24386 d_prctl_set_name='$d_prctl_set_name'
24387 d_printf_format_null='$d_printf_format_null'
24388 d_procselfexe='$d_procselfexe'
24389 d_pseudofork='$d_pseudofork'
24390 d_pthread_atfork='$d_pthread_atfork'
24391 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24392 d_pthread_yield='$d_pthread_yield'
24393 d_ptrdiff_t='$d_ptrdiff_t'
24394 d_pwage='$d_pwage'
24395 d_pwchange='$d_pwchange'
24396 d_pwclass='$d_pwclass'
24397 d_pwcomment='$d_pwcomment'
24398 d_pwexpire='$d_pwexpire'
24399 d_pwgecos='$d_pwgecos'
24400 d_pwpasswd='$d_pwpasswd'
24401 d_pwquota='$d_pwquota'
24402 d_qgcvt='$d_qgcvt'
24403 d_quad='$d_quad'
24404 d_random_r='$d_random_r'
24405 d_re_comp='$d_re_comp'
24406 d_readdir64_r='$d_readdir64_r'
24407 d_readdir='$d_readdir'
24408 d_readdir_r='$d_readdir_r'
24409 d_readlink='$d_readlink'
24410 d_readv='$d_readv'
24411 d_recvmsg='$d_recvmsg'
24412 d_regcmp='$d_regcmp'
24413 d_regcomp='$d_regcomp'
24414 d_remainder='$d_remainder'
24415 d_remquo='$d_remquo'
24416 d_rename='$d_rename'
24417 d_rewinddir='$d_rewinddir'
24418 d_rint='$d_rint'
24419 d_rmdir='$d_rmdir'
24420 d_round='$d_round'
24421 d_safebcpy='$d_safebcpy'
24422 d_safemcpy='$d_safemcpy'
24423 d_sanemcmp='$d_sanemcmp'
24424 d_sbrkproto='$d_sbrkproto'
24425 d_scalbn='$d_scalbn'
24426 d_scalbnl='$d_scalbnl'
24427 d_sched_yield='$d_sched_yield'
24428 d_scm_rights='$d_scm_rights'
24429 d_seekdir='$d_seekdir'
24430 d_select='$d_select'
24431 d_sem='$d_sem'
24432 d_semctl='$d_semctl'
24433 d_semctl_semid_ds='$d_semctl_semid_ds'
24434 d_semctl_semun='$d_semctl_semun'
24435 d_semget='$d_semget'
24436 d_semop='$d_semop'
24437 d_sendmsg='$d_sendmsg'
24438 d_setegid='$d_setegid'
24439 d_seteuid='$d_seteuid'
24440 d_setgrent='$d_setgrent'
24441 d_setgrent_r='$d_setgrent_r'
24442 d_setgrps='$d_setgrps'
24443 d_sethent='$d_sethent'
24444 d_sethostent_r='$d_sethostent_r'
24445 d_setitimer='$d_setitimer'
24446 d_setlinebuf='$d_setlinebuf'
24447 d_setlocale='$d_setlocale'
24448 d_setlocale_r='$d_setlocale_r'
24449 d_setnent='$d_setnent'
24450 d_setnetent_r='$d_setnetent_r'
24451 d_setpent='$d_setpent'
24452 d_setpgid='$d_setpgid'
24453 d_setpgrp2='$d_setpgrp2'
24454 d_setpgrp='$d_setpgrp'
24455 d_setprior='$d_setprior'
24456 d_setproctitle='$d_setproctitle'
24457 d_setprotoent_r='$d_setprotoent_r'
24458 d_setpwent='$d_setpwent'
24459 d_setpwent_r='$d_setpwent_r'
24460 d_setregid='$d_setregid'
24461 d_setresgid='$d_setresgid'
24462 d_setresuid='$d_setresuid'
24463 d_setreuid='$d_setreuid'
24464 d_setrgid='$d_setrgid'
24465 d_setruid='$d_setruid'
24466 d_setsent='$d_setsent'
24467 d_setservent_r='$d_setservent_r'
24468 d_setsid='$d_setsid'
24469 d_setvbuf='$d_setvbuf'
24470 d_shm='$d_shm'
24471 d_shmat='$d_shmat'
24472 d_shmatprototype='$d_shmatprototype'
24473 d_shmctl='$d_shmctl'
24474 d_shmdt='$d_shmdt'
24475 d_shmget='$d_shmget'
24476 d_sigaction='$d_sigaction'
24477 d_signbit='$d_signbit'
24478 d_sigprocmask='$d_sigprocmask'
24479 d_sigsetjmp='$d_sigsetjmp'
24480 d_sin6_scope_id='$d_sin6_scope_id'
24481 d_sitearch='$d_sitearch'
24482 d_snprintf='$d_snprintf'
24483 d_sockaddr_in6='$d_sockaddr_in6'
24484 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24485 d_sockatmark='$d_sockatmark'
24486 d_sockatmarkproto='$d_sockatmarkproto'
24487 d_socket='$d_socket'
24488 d_socklen_t='$d_socklen_t'
24489 d_sockpair='$d_sockpair'
24490 d_socks5_init='$d_socks5_init'
24491 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
24492 d_sqrtl='$d_sqrtl'
24493 d_srand48_r='$d_srand48_r'
24494 d_srandom_r='$d_srandom_r'
24495 d_sresgproto='$d_sresgproto'
24496 d_sresuproto='$d_sresuproto'
24497 d_stat='$d_stat'
24498 d_statblks='$d_statblks'
24499 d_statfs_f_flags='$d_statfs_f_flags'
24500 d_statfs_s='$d_statfs_s'
24501 d_static_inline='$d_static_inline'
24502 d_statvfs='$d_statvfs'
24503 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24504 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24505 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24506 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24507 d_stdio_stream_array='$d_stdio_stream_array'
24508 d_stdiobase='$d_stdiobase'
24509 d_stdstdio='$d_stdstdio'
24510 d_strchr='$d_strchr'
24511 d_strcoll='$d_strcoll'
24512 d_strctcpy='$d_strctcpy'
24513 d_strerrm='$d_strerrm'
24514 d_strerror='$d_strerror'
24515 d_strerror_r='$d_strerror_r'
24516 d_strftime='$d_strftime'
24517 d_strlcat='$d_strlcat'
24518 d_strlcpy='$d_strlcpy'
24519 d_strtod='$d_strtod'
24520 d_strtol='$d_strtol'
24521 d_strtold='$d_strtold'
24522 d_strtoll='$d_strtoll'
24523 d_strtoq='$d_strtoq'
24524 d_strtoul='$d_strtoul'
24525 d_strtoull='$d_strtoull'
24526 d_strtouq='$d_strtouq'
24527 d_strxfrm='$d_strxfrm'
24528 d_suidsafe='$d_suidsafe'
24529 d_symlink='$d_symlink'
24530 d_syscall='$d_syscall'
24531 d_syscallproto='$d_syscallproto'
24532 d_sysconf='$d_sysconf'
24533 d_sysernlst='$d_sysernlst'
24534 d_syserrlst='$d_syserrlst'
24535 d_system='$d_system'
24536 d_tcgetpgrp='$d_tcgetpgrp'
24537 d_tcsetpgrp='$d_tcsetpgrp'
24538 d_telldir='$d_telldir'
24539 d_telldirproto='$d_telldirproto'
24540 d_tgamma='$d_tgamma'
24541 d_time='$d_time'
24542 d_timegm='$d_timegm'
24543 d_times='$d_times'
24544 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24545 d_tm_tm_zone='$d_tm_tm_zone'
24546 d_tmpnam_r='$d_tmpnam_r'
24547 d_trunc='$d_trunc'
24548 d_truncate='$d_truncate'
24549 d_truncl='$d_truncl'
24550 d_ttyname_r='$d_ttyname_r'
24551 d_tzname='$d_tzname'
24552 d_u32align='$d_u32align'
24553 d_ualarm='$d_ualarm'
24554 d_umask='$d_umask'
24555 d_uname='$d_uname'
24556 d_union_semun='$d_union_semun'
24557 d_unordered='$d_unordered'
24558 d_unsetenv='$d_unsetenv'
24559 d_usleep='$d_usleep'
24560 d_usleepproto='$d_usleepproto'
24561 d_ustat='$d_ustat'
24562 d_vendorarch='$d_vendorarch'
24563 d_vendorbin='$d_vendorbin'
24564 d_vendorlib='$d_vendorlib'
24565 d_vendorscript='$d_vendorscript'
24566 d_vfork='$d_vfork'
24567 d_void_closedir='$d_void_closedir'
24568 d_voidsig='$d_voidsig'
24569 d_voidtty='$d_voidtty'
24570 d_volatile='$d_volatile'
24571 d_vprintf='$d_vprintf'
24572 d_vsnprintf='$d_vsnprintf'
24573 d_wait4='$d_wait4'
24574 d_waitpid='$d_waitpid'
24575 d_wcscmp='$d_wcscmp'
24576 d_wcstombs='$d_wcstombs'
24577 d_wcsxfrm='$d_wcsxfrm'
24578 d_wctomb='$d_wctomb'
24579 d_writev='$d_writev'
24580 d_xenix='$d_xenix'
24581 date='$date'
24582 db_hashtype='$db_hashtype'
24583 db_prefixtype='$db_prefixtype'
24584 db_version_major='$db_version_major'
24585 db_version_minor='$db_version_minor'
24586 db_version_patch='$db_version_patch'
24587 direntrytype='$direntrytype'
24588 dlext='$dlext'
24589 dlsrc='$dlsrc'
24590 doubleinfbytes='$doubleinfbytes'
24591 doublekind='$doublekind'
24592 doublemantbits='$doublemantbits'
24593 doublenanbytes='$doublenanbytes'
24594 doublesize='$doublesize'
24595 drand01='$drand01'
24596 drand48_r_proto='$drand48_r_proto'
24597 dtrace='$dtrace'
24598 dynamic_ext='$dynamic_ext'
24599 eagain='$eagain'
24600 ebcdic='$ebcdic'
24601 echo='$echo'
24602 egrep='$egrep'
24603 emacs='$emacs'
24604 endgrent_r_proto='$endgrent_r_proto'
24605 endhostent_r_proto='$endhostent_r_proto'
24606 endnetent_r_proto='$endnetent_r_proto'
24607 endprotoent_r_proto='$endprotoent_r_proto'
24608 endpwent_r_proto='$endpwent_r_proto'
24609 endservent_r_proto='$endservent_r_proto'
24610 eunicefix='$eunicefix'
24611 exe_ext='$exe_ext'
24612 expr='$expr'
24613 extensions='$extensions'
24614 extern_C='$extern_C'
24615 extras='$extras'
24616 fflushNULL='$fflushNULL'
24617 fflushall='$fflushall'
24618 find='$find'
24619 firstmakefile='$firstmakefile'
24620 flex='$flex'
24621 fpossize='$fpossize'
24622 fpostype='$fpostype'
24623 freetype='$freetype'
24624 from='$from'
24625 full_ar='$full_ar'
24626 full_csh='$full_csh'
24627 full_sed='$full_sed'
24628 gccansipedantic='$gccansipedantic'
24629 gccosandvers='$gccosandvers'
24630 gccversion='$gccversion'
24631 getgrent_r_proto='$getgrent_r_proto'
24632 getgrgid_r_proto='$getgrgid_r_proto'
24633 getgrnam_r_proto='$getgrnam_r_proto'
24634 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24635 gethostbyname_r_proto='$gethostbyname_r_proto'
24636 gethostent_r_proto='$gethostent_r_proto'
24637 getlogin_r_proto='$getlogin_r_proto'
24638 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24639 getnetbyname_r_proto='$getnetbyname_r_proto'
24640 getnetent_r_proto='$getnetent_r_proto'
24641 getprotobyname_r_proto='$getprotobyname_r_proto'
24642 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24643 getprotoent_r_proto='$getprotoent_r_proto'
24644 getpwent_r_proto='$getpwent_r_proto'
24645 getpwnam_r_proto='$getpwnam_r_proto'
24646 getpwuid_r_proto='$getpwuid_r_proto'
24647 getservbyname_r_proto='$getservbyname_r_proto'
24648 getservbyport_r_proto='$getservbyport_r_proto'
24649 getservent_r_proto='$getservent_r_proto'
24650 getspnam_r_proto='$getspnam_r_proto'
24651 gidformat='$gidformat'
24652 gidsign='$gidsign'
24653 gidsize='$gidsize'
24654 gidtype='$gidtype'
24655 glibpth='$glibpth'
24656 gmake='$gmake'
24657 gmtime_r_proto='$gmtime_r_proto'
24658 gnulibc_version='$gnulibc_version'
24659 grep='$grep'
24660 groupcat='$groupcat'
24661 groupstype='$groupstype'
24662 gzip='$gzip'
24663 h_fcntl='$h_fcntl'
24664 h_sysfile='$h_sysfile'
24665 hint='$hint'
24666 hostcat='$hostcat'
24667 hostgenerate='$hostgenerate'
24668 hostosname='$hostosname'
24669 hostperl='$hostperl'
24670 html1dir='$html1dir'
24671 html1direxp='$html1direxp'
24672 html3dir='$html3dir'
24673 html3direxp='$html3direxp'
24674 i16size='$i16size'
24675 i16type='$i16type'
24676 i32size='$i32size'
24677 i32type='$i32type'
24678 i64size='$i64size'
24679 i64type='$i64type'
24680 i8size='$i8size'
24681 i8type='$i8type'
24682 i_arpainet='$i_arpainet'
24683 i_assert='$i_assert'
24684 i_bfd='$i_bfd'
24685 i_bsdioctl='$i_bsdioctl'
24686 i_crypt='$i_crypt'
24687 i_db='$i_db'
24688 i_dbm='$i_dbm'
24689 i_dirent='$i_dirent'
24690 i_dlfcn='$i_dlfcn'
24691 i_execinfo='$i_execinfo'
24692 i_fcntl='$i_fcntl'
24693 i_fenv='$i_fenv'
24694 i_float='$i_float'
24695 i_fp='$i_fp'
24696 i_fp_class='$i_fp_class'
24697 i_gdbm='$i_gdbm'
24698 i_gdbm_ndbm='$i_gdbm_ndbm'
24699 i_gdbmndbm='$i_gdbmndbm'
24700 i_grp='$i_grp'
24701 i_ieeefp='$i_ieeefp'
24702 i_inttypes='$i_inttypes'
24703 i_langinfo='$i_langinfo'
24704 i_libutil='$i_libutil'
24705 i_limits='$i_limits'
24706 i_locale='$i_locale'
24707 i_machcthr='$i_machcthr'
24708 i_malloc='$i_malloc'
24709 i_mallocmalloc='$i_mallocmalloc'
24710 i_math='$i_math'
24711 i_memory='$i_memory'
24712 i_mntent='$i_mntent'
24713 i_ndbm='$i_ndbm'
24714 i_netdb='$i_netdb'
24715 i_neterrno='$i_neterrno'
24716 i_netinettcp='$i_netinettcp'
24717 i_niin='$i_niin'
24718 i_poll='$i_poll'
24719 i_prot='$i_prot'
24720 i_pthread='$i_pthread'
24721 i_pwd='$i_pwd'
24722 i_quadmath='$i_quadmath'
24723 i_rpcsvcdbm='$i_rpcsvcdbm'
24724 i_sgtty='$i_sgtty'
24725 i_shadow='$i_shadow'
24726 i_socks='$i_socks'
24727 i_stdarg='$i_stdarg'
24728 i_stdbool='$i_stdbool'
24729 i_stddef='$i_stddef'
24730 i_stdint='$i_stdint'
24731 i_stdlib='$i_stdlib'
24732 i_string='$i_string'
24733 i_sunmath='$i_sunmath'
24734 i_sysaccess='$i_sysaccess'
24735 i_sysdir='$i_sysdir'
24736 i_sysfile='$i_sysfile'
24737 i_sysfilio='$i_sysfilio'
24738 i_sysin='$i_sysin'
24739 i_sysioctl='$i_sysioctl'
24740 i_syslog='$i_syslog'
24741 i_sysmman='$i_sysmman'
24742 i_sysmode='$i_sysmode'
24743 i_sysmount='$i_sysmount'
24744 i_sysndir='$i_sysndir'
24745 i_sysparam='$i_sysparam'
24746 i_syspoll='$i_syspoll'
24747 i_sysresrc='$i_sysresrc'
24748 i_syssecrt='$i_syssecrt'
24749 i_sysselct='$i_sysselct'
24750 i_syssockio='$i_syssockio'
24751 i_sysstat='$i_sysstat'
24752 i_sysstatfs='$i_sysstatfs'
24753 i_sysstatvfs='$i_sysstatvfs'
24754 i_systime='$i_systime'
24755 i_systimek='$i_systimek'
24756 i_systimes='$i_systimes'
24757 i_systypes='$i_systypes'
24758 i_sysuio='$i_sysuio'
24759 i_sysun='$i_sysun'
24760 i_sysutsname='$i_sysutsname'
24761 i_sysvfs='$i_sysvfs'
24762 i_syswait='$i_syswait'
24763 i_termio='$i_termio'
24764 i_termios='$i_termios'
24765 i_time='$i_time'
24766 i_unistd='$i_unistd'
24767 i_ustat='$i_ustat'
24768 i_utime='$i_utime'
24769 i_values='$i_values'
24770 i_varargs='$i_varargs'
24771 i_varhdr='$i_varhdr'
24772 i_vfork='$i_vfork'
24773 ignore_versioned_solibs='$ignore_versioned_solibs'
24774 inc_version_list='$inc_version_list'
24775 inc_version_list_init='$inc_version_list_init'
24776 incpath='$incpath'
24777 incpth='$incpth'
24778 inews='$inews'
24779 initialinstalllocation='$initialinstalllocation'
24780 installarchlib='$installarchlib'
24781 installbin='$installbin'
24782 installhtml1dir='$installhtml1dir'
24783 installhtml3dir='$installhtml3dir'
24784 installman1dir='$installman1dir'
24785 installman3dir='$installman3dir'
24786 installprefix='$installprefix'
24787 installprefixexp='$installprefixexp'
24788 installprivlib='$installprivlib'
24789 installscript='$installscript'
24790 installsitearch='$installsitearch'
24791 installsitebin='$installsitebin'
24792 installsitehtml1dir='$installsitehtml1dir'
24793 installsitehtml3dir='$installsitehtml3dir'
24794 installsitelib='$installsitelib'
24795 installsiteman1dir='$installsiteman1dir'
24796 installsiteman3dir='$installsiteman3dir'
24797 installsitescript='$installsitescript'
24798 installstyle='$installstyle'
24799 installusrbinperl='$installusrbinperl'
24800 installvendorarch='$installvendorarch'
24801 installvendorbin='$installvendorbin'
24802 installvendorhtml1dir='$installvendorhtml1dir'
24803 installvendorhtml3dir='$installvendorhtml3dir'
24804 installvendorlib='$installvendorlib'
24805 installvendorman1dir='$installvendorman1dir'
24806 installvendorman3dir='$installvendorman3dir'
24807 installvendorscript='$installvendorscript'
24808 intsize='$intsize'
24809 issymlink='$issymlink'
24810 ivdformat='$ivdformat'
24811 ivsize='$ivsize'
24812 ivtype='$ivtype'
24813 known_extensions='$known_extensions'
24814 ksh='$ksh'
24815 ld='$ld'
24816 ld_can_script='$ld_can_script'
24817 lddlflags='$lddlflags'
24818 ldflags='$ldflags'
24819 ldflags_uselargefiles='$ldflags_uselargefiles'
24820 ldlibpthname='$ldlibpthname'
24821 less='$less'
24822 lib_ext='$lib_ext'
24823 libc='$libc'
24824 libperl='$libperl'
24825 libpth='$libpth'
24826 libs='$libs'
24827 libsdirs='$libsdirs'
24828 libsfiles='$libsfiles'
24829 libsfound='$libsfound'
24830 libspath='$libspath'
24831 libswanted='$libswanted'
24832 libswanted_uselargefiles='$libswanted_uselargefiles'
24833 line='$line'
24834 lint='$lint'
24835 lkflags='$lkflags'
24836 ln='$ln'
24837 lns='$lns'
24838 localtime_r_proto='$localtime_r_proto'
24839 locincpth='$locincpth'
24840 loclibpth='$loclibpth'
24841 longdblinfbytes='$longdblinfbytes'
24842 longdblkind='$longdblkind'
24843 longdblmantbits='$longdblmantbits'
24844 longdblnanbytes='$longdblnanbytes'
24845 longdblsize='$longdblsize'
24846 longlongsize='$longlongsize'
24847 longsize='$longsize'
24848 lp='$lp'
24849 lpr='$lpr'
24850 ls='$ls'
24851 lseeksize='$lseeksize'
24852 lseektype='$lseektype'
24853 mail='$mail'
24854 mailx='$mailx'
24855 make='$make'
24856 make_set_make='$make_set_make'
24857 mallocobj='$mallocobj'
24858 mallocsrc='$mallocsrc'
24859 malloctype='$malloctype'
24860 man1dir='$man1dir'
24861 man1direxp='$man1direxp'
24862 man1ext='$man1ext'
24863 man3dir='$man3dir'
24864 man3direxp='$man3direxp'
24865 man3ext='$man3ext'
24866 mips_type='$mips_type'
24867 mistrustnm='$mistrustnm'
24868 mkdir='$mkdir'
24869 mmaptype='$mmaptype'
24870 modetype='$modetype'
24871 more='$more'
24872 multiarch='$multiarch'
24873 mv='$mv'
24874 myarchname='$myarchname'
24875 mydomain='$mydomain'
24876 myhostname='$myhostname'
24877 myuname='$myuname'
24878 n='$n'
24879 need_va_copy='$need_va_copy'
24880 netdb_hlen_type='$netdb_hlen_type'
24881 netdb_host_type='$netdb_host_type'
24882 netdb_name_type='$netdb_name_type'
24883 netdb_net_type='$netdb_net_type'
24884 nm='$nm'
24885 nm_opt='$nm_opt'
24886 nm_so_opt='$nm_so_opt'
24887 nonxs_ext='$nonxs_ext'
24888 nroff='$nroff'
24889 nvEUformat='$nvEUformat'
24890 nvFUformat='$nvFUformat'
24891 nvGUformat='$nvGUformat'
24892 nv_overflows_integers_at='$nv_overflows_integers_at'
24893 nv_preserves_uv_bits='$nv_preserves_uv_bits'
24894 nveformat='$nveformat'
24895 nvfformat='$nvfformat'
24896 nvgformat='$nvgformat'
24897 nvmantbits='$nvmantbits'
24898 nvsize='$nvsize'
24899 nvtype='$nvtype'
24900 o_nonblock='$o_nonblock'
24901 obj_ext='$obj_ext'
24902 old_pthread_create_joinable='$old_pthread_create_joinable'
24903 optimize='$optimize'
24904 orderlib='$orderlib'
24905 osname='$osname'
24906 osvers='$osvers'
24907 otherlibdirs='$otherlibdirs'
24908 package='$package'
24909 pager='$pager'
24910 passcat='$passcat'
24911 patchlevel='$patchlevel'
24912 path_sep='$path_sep'
24913 perl5='$perl5'
24914 perl='$perl'
24915 perl_patchlevel='$perl_patchlevel'
24916 perl_static_inline='$perl_static_inline'
24917 perladmin='$perladmin'
24918 perllibs='$perllibs'
24919 perlpath='$perlpath'
24920 pg='$pg'
24921 phostname='$phostname'
24922 pidtype='$pidtype'
24923 plibpth='$plibpth'
24924 pmake='$pmake'
24925 pr='$pr'
24926 prefix='$prefix'
24927 prefixexp='$prefixexp'
24928 privlib='$privlib'
24929 privlibexp='$privlibexp'
24930 procselfexe='$procselfexe'
24931 prototype='$prototype'
24932 ptrsize='$ptrsize'
24933 quadkind='$quadkind'
24934 quadtype='$quadtype'
24935 randbits='$randbits'
24936 randfunc='$randfunc'
24937 random_r_proto='$random_r_proto'
24938 randseedtype='$randseedtype'
24939 ranlib='$ranlib'
24940 rd_nodata='$rd_nodata'
24941 readdir64_r_proto='$readdir64_r_proto'
24942 readdir_r_proto='$readdir_r_proto'
24943 revision='$revision'
24944 rm='$rm'
24945 rm_try='$rm_try'
24946 rmail='$rmail'
24947 run='$run'
24948 runnm='$runnm'
24949 sGMTIME_max='$sGMTIME_max'
24950 sGMTIME_min='$sGMTIME_min'
24951 sLOCALTIME_max='$sLOCALTIME_max'
24952 sLOCALTIME_min='$sLOCALTIME_min'
24953 sPRIEUldbl='$sPRIEUldbl'
24954 sPRIFUldbl='$sPRIFUldbl'
24955 sPRIGUldbl='$sPRIGUldbl'
24956 sPRIXU64='$sPRIXU64'
24957 sPRId64='$sPRId64'
24958 sPRIeldbl='$sPRIeldbl'
24959 sPRIfldbl='$sPRIfldbl'
24960 sPRIgldbl='$sPRIgldbl'
24961 sPRIi64='$sPRIi64'
24962 sPRIo64='$sPRIo64'
24963 sPRIu64='$sPRIu64'
24964 sPRIx64='$sPRIx64'
24965 sSCNfldbl='$sSCNfldbl'
24966 sched_yield='$sched_yield'
24967 scriptdir='$scriptdir'
24968 scriptdirexp='$scriptdirexp'
24969 sed='$sed'
24970 seedfunc='$seedfunc'
24971 selectminbits='$selectminbits'
24972 selecttype='$selecttype'
24973 sendmail='$sendmail'
24974 setgrent_r_proto='$setgrent_r_proto'
24975 sethostent_r_proto='$sethostent_r_proto'
24976 setlocale_r_proto='$setlocale_r_proto'
24977 setnetent_r_proto='$setnetent_r_proto'
24978 setprotoent_r_proto='$setprotoent_r_proto'
24979 setpwent_r_proto='$setpwent_r_proto'
24980 setservent_r_proto='$setservent_r_proto'
24981 sh='$sh'
24982 shar='$shar'
24983 sharpbang='$sharpbang'
24984 shmattype='$shmattype'
24985 shortsize='$shortsize'
24986 shrpenv='$shrpenv'
24987 shsharp='$shsharp'
24988 sig_count='$sig_count'
24989 sig_name='$sig_name'
24990 sig_name_init='$sig_name_init'
24991 sig_num='$sig_num'
24992 sig_num_init='$sig_num_init'
24993 sig_size='$sig_size'
24994 signal_t='$signal_t'
24995 sitearch='$sitearch'
24996 sitearchexp='$sitearchexp'
24997 sitebin='$sitebin'
24998 sitebinexp='$sitebinexp'
24999 sitehtml1dir='$sitehtml1dir'
25000 sitehtml1direxp='$sitehtml1direxp'
25001 sitehtml3dir='$sitehtml3dir'
25002 sitehtml3direxp='$sitehtml3direxp'
25003 sitelib='$sitelib'
25004 sitelib_stem='$sitelib_stem'
25005 sitelibexp='$sitelibexp'
25006 siteman1dir='$siteman1dir'
25007 siteman1direxp='$siteman1direxp'
25008 siteman3dir='$siteman3dir'
25009 siteman3direxp='$siteman3direxp'
25010 siteprefix='$siteprefix'
25011 siteprefixexp='$siteprefixexp'
25012 sitescript='$sitescript'
25013 sitescriptexp='$sitescriptexp'
25014 sizesize='$sizesize'
25015 sizetype='$sizetype'
25016 sleep='$sleep'
25017 smail='$smail'
25018 so='$so'
25019 sockethdr='$sockethdr'
25020 socketlib='$socketlib'
25021 socksizetype='$socksizetype'
25022 sort='$sort'
25023 spackage='$spackage'
25024 spitshell='$spitshell'
25025 srand48_r_proto='$srand48_r_proto'
25026 srandom_r_proto='$srandom_r_proto'
25027 src='$src'
25028 ssizetype='$ssizetype'
25029 st_ino_sign='$st_ino_sign'
25030 st_ino_size='$st_ino_size'
25031 startperl='$startperl'
25032 startsh='$startsh'
25033 static_ext='$static_ext'
25034 stdchar='$stdchar'
25035 stdio_base='$stdio_base'
25036 stdio_bufsiz='$stdio_bufsiz'
25037 stdio_cnt='$stdio_cnt'
25038 stdio_filbuf='$stdio_filbuf'
25039 stdio_ptr='$stdio_ptr'
25040 stdio_stream_array='$stdio_stream_array'
25041 strerror_r_proto='$strerror_r_proto'
25042 strings='$strings'
25043 submit='$submit'
25044 subversion='$subversion'
25045 sysman='$sysman'
25046 sysroot='$sysroot'
25047 tail='$tail'
25048 tar='$tar'
25049 targetarch='$targetarch'
25050 targetdir='$targetdir'
25051 targetenv='$targetenv'
25052 targethost='$targethost'
25053 targetmkdir='$targetmkdir'
25054 targetport='$targetport'
25055 targetsh='$targetsh'
25056 tbl='$tbl'
25057 tee='$tee'
25058 test='$test'
25059 timeincl='$timeincl'
25060 timetype='$timetype'
25061 tmpnam_r_proto='$tmpnam_r_proto'
25062 to='$to'
25063 touch='$touch'
25064 tr='$tr'
25065 trnl='$trnl'
25066 troff='$troff'
25067 ttyname_r_proto='$ttyname_r_proto'
25068 u16size='$u16size'
25069 u16type='$u16type'
25070 u32size='$u32size'
25071 u32type='$u32type'
25072 u64size='$u64size'
25073 u64type='$u64type'
25074 u8size='$u8size'
25075 u8type='$u8type'
25076 uidformat='$uidformat'
25077 uidsign='$uidsign'
25078 uidsize='$uidsize'
25079 uidtype='$uidtype'
25080 uname='$uname'
25081 uniq='$uniq'
25082 uquadtype='$uquadtype'
25083 use5005threads='$use5005threads'
25084 use64bitall='$use64bitall'
25085 use64bitint='$use64bitint'
25086 usecbacktrace='$usecbacktrace'
25087 usecrosscompile='$usecrosscompile'
25088 usedevel='$usedevel'
25089 usedl='$usedl'
25090 usedtrace='$usedtrace'
25091 usefaststdio='$usefaststdio'
25092 useithreads='$useithreads'
25093 usekernprocpathname='$usekernprocpathname'
25094 uselargefiles='$uselargefiles'
25095 uselongdouble='$uselongdouble'
25096 usemallocwrap='$usemallocwrap'
25097 usemorebits='$usemorebits'
25098 usemultiplicity='$usemultiplicity'
25099 usemymalloc='$usemymalloc'
25100 usenm='$usenm'
25101 usensgetexecutablepath='$usensgetexecutablepath'
25102 useopcode='$useopcode'
25103 useperlio='$useperlio'
25104 useposix='$useposix'
25105 usequadmath='$usequadmath'
25106 usereentrant='$usereentrant'
25107 userelocatableinc='$userelocatableinc'
25108 useshrplib='$useshrplib'
25109 usesitecustomize='$usesitecustomize'
25110 usesocks='$usesocks'
25111 usethreads='$usethreads'
25112 usevendorprefix='$usevendorprefix'
25113 useversionedarchname='$useversionedarchname'
25114 usevfork='$usevfork'
25115 usrinc='$usrinc'
25116 uuname='$uuname'
25117 uvXUformat='$uvXUformat'
25118 uvoformat='$uvoformat'
25119 uvsize='$uvsize'
25120 uvtype='$uvtype'
25121 uvuformat='$uvuformat'
25122 uvxformat='$uvxformat'
25123 vaproto='$vaproto'
25124 vendorarch='$vendorarch'
25125 vendorarchexp='$vendorarchexp'
25126 vendorbin='$vendorbin'
25127 vendorbinexp='$vendorbinexp'
25128 vendorhtml1dir='$vendorhtml1dir'
25129 vendorhtml1direxp='$vendorhtml1direxp'
25130 vendorhtml3dir='$vendorhtml3dir'
25131 vendorhtml3direxp='$vendorhtml3direxp'
25132 vendorlib='$vendorlib'
25133 vendorlib_stem='$vendorlib_stem'
25134 vendorlibexp='$vendorlibexp'
25135 vendorman1dir='$vendorman1dir'
25136 vendorman1direxp='$vendorman1direxp'
25137 vendorman3dir='$vendorman3dir'
25138 vendorman3direxp='$vendorman3direxp'
25139 vendorprefix='$vendorprefix'
25140 vendorprefixexp='$vendorprefixexp'
25141 vendorscript='$vendorscript'
25142 vendorscriptexp='$vendorscriptexp'
25143 version='$version'
25144 version_patchlevel_string='$version_patchlevel_string'
25145 versiononly='$versiononly'
25146 vi='$vi'
25147 xlibpth='$xlibpth'
25148 yacc='$yacc'
25149 yaccflags='$yaccflags'
25150 zcat='$zcat'
25151 zip='$zip'
25152 EOT
25153
25154 : add special variables
25155 $test -f $src/patchlevel.h && \
25156 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
25157 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
25158 echo "PERL_CONFIG_SH=true" >>config.sh
25159
25160 : propagate old symbols
25161 if $test -f UU/config.sh; then
25162         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
25163         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
25164                 config.sh config.sh UU/oldconfig.sh |\
25165                 $sort | $uniq -u >UU/oldsyms
25166         set X `$cat UU/oldsyms`
25167         shift
25168         case $# in
25169         0) ;;
25170         *)
25171                 $cat <<EOM
25172 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
25173 EOM
25174                 echo ": Variables propagated from previous config.sh file." >>config.sh
25175                 for sym in `$cat UU/oldsyms`; do
25176                         echo "    Propagating $hint variable "'$'"$sym..."
25177                         eval 'tmp="$'"${sym}"'"'
25178                         echo "$tmp" | \
25179                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
25180                 done
25181                 ;;
25182         esac
25183 fi
25184
25185 : preserve RCS keywords in files with variable substitution, grrr
25186 Id='$Id'
25187
25188 : Finish up by extracting the .SH files
25189 case "$alldone" in
25190 exit)
25191         $rm -rf UU
25192         echo "Extraction done."
25193         exit 0
25194         ;;
25195 cont)
25196         ;;
25197 '')
25198         dflt=''
25199         nostick=true
25200         $cat <<EOM
25201
25202 If you'd like to make any changes to the config.sh file before I begin
25203 to configure things, do it as a shell escape now (e.g. !vi config.sh).
25204
25205 EOM
25206         rp="Press return or use a shell escape to edit config.sh:"
25207         . UU/myread
25208         nostick=''
25209         case "$ans" in
25210         '') ;;
25211         *) : in case they cannot read
25212                 sh 1>&4 -c "$ans";;
25213         esac
25214         ;;
25215 esac
25216
25217 : if this fails, just run all the .SH files by hand
25218 . ./config.sh
25219
25220 echo " "
25221 exec 1>&4
25222 pwd=`pwd`
25223 . ./UU/extract
25224 cd "$pwd"
25225
25226 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
25227         dflt=y
25228         case "$silent" in
25229         true) ;;
25230         *)
25231                 $cat <<EOM
25232
25233 Now you need to generate make dependencies by running "$make depend".
25234 You might prefer to run it in background: "$make depend > makedepend.out &"
25235 It can take a while, so you might not want to run it right now.
25236
25237 EOM
25238                 ;;
25239         esac
25240         rp="Run $make depend now?"
25241         . UU/myread
25242         case "$ans" in
25243         y*)
25244                 $make depend && echo "Now you must run '$make'."
25245                 ;;
25246         *)
25247                 echo "You must run '$make depend' then '$make'."
25248                 ;;
25249         esac
25250 elif test -f [Mm]akefile; then
25251         echo " "
25252         echo "Now you must run a $make."
25253 else
25254         echo "Configure done."
25255 fi
25256
25257 if $test -f Policy.sh; then
25258     $cat <<EOM
25259
25260 If you compile $package on a different machine or from a different object
25261 directory, copy the Policy.sh file from this object directory to the
25262 new one before you run Configure -- this will help you with most of
25263 the policy defaults.
25264
25265 EOM
25266 fi
25267 if $test -f config.msg; then
25268     echo "Hmm.  I also noted the following information while running:"
25269     echo " "
25270     $cat config.msg >&4
25271     $rm -f config.msg
25272 fi
25273 $rm -f kit*isdone ark*isdone
25274 $rm -rf UU
25275
25276 : End of Configure
25277